Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
pirms 8 gadiem
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107
  1. (function webpackUniversalModuleDefinition(root, factory) {
  2. if(typeof exports === 'object' && typeof module === 'object')
  3. module.exports = factory();
  4. else if(typeof define === 'function' && define.amd)
  5. define([], factory);
  6. else if(typeof exports === 'object')
  7. exports["LessPass"] = factory();
  8. else
  9. root["LessPass"] = factory();
  10. })(this, function() {
  11. return /******/ (function(modules) { // webpackBootstrap
  12. /******/ // The module cache
  13. /******/ var installedModules = {};
  14. /******/ // The require function
  15. /******/ function __webpack_require__(moduleId) {
  16. /******/ // Check if module is in cache
  17. /******/ if(installedModules[moduleId])
  18. /******/ return installedModules[moduleId].exports;
  19. /******/ // Create a new module (and put it into the cache)
  20. /******/ var module = installedModules[moduleId] = {
  21. /******/ i: moduleId,
  22. /******/ l: false,
  23. /******/ exports: {}
  24. /******/ };
  25. /******/ // Execute the module function
  26. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  27. /******/ // Flag the module as loaded
  28. /******/ module.l = true;
  29. /******/ // Return the exports of the module
  30. /******/ return module.exports;
  31. /******/ }
  32. /******/ // expose the modules object (__webpack_modules__)
  33. /******/ __webpack_require__.m = modules;
  34. /******/ // expose the module cache
  35. /******/ __webpack_require__.c = installedModules;
  36. /******/ // identity function for calling harmony imports with the correct context
  37. /******/ __webpack_require__.i = function(value) { return value; };
  38. /******/ // define getter function for harmony exports
  39. /******/ __webpack_require__.d = function(exports, name, getter) {
  40. /******/ if(!__webpack_require__.o(exports, name)) {
  41. /******/ Object.defineProperty(exports, name, {
  42. /******/ configurable: false,
  43. /******/ enumerable: true,
  44. /******/ get: getter
  45. /******/ });
  46. /******/ }
  47. /******/ };
  48. /******/ // getDefaultExport function for compatibility with non-harmony modules
  49. /******/ __webpack_require__.n = function(module) {
  50. /******/ var getter = module && module.__esModule ?
  51. /******/ function getDefault() { return module['default']; } :
  52. /******/ function getModuleExports() { return module; };
  53. /******/ __webpack_require__.d(getter, 'a', getter);
  54. /******/ return getter;
  55. /******/ };
  56. /******/ // Object.prototype.hasOwnProperty.call
  57. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  58. /******/ // __webpack_public_path__
  59. /******/ __webpack_require__.p = "";
  60. /******/ // Load entry module and return exports
  61. /******/ return __webpack_require__(__webpack_require__.s = 52);
  62. /******/ })
  63. /************************************************************************/
  64. /******/ ([
  65. /* 0 */
  66. /***/ (function(module, exports, __webpack_require__) {
  67. "use strict";
  68. /* WEBPACK VAR INJECTION */(function(global) {/*!
  69. * The buffer module from node.js, for the browser.
  70. *
  71. * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
  72. * @license MIT
  73. */
  74. /* eslint-disable no-proto */
  75. var base64 = __webpack_require__(26)
  76. var ieee754 = __webpack_require__(32)
  77. var isArray = __webpack_require__(16)
  78. exports.Buffer = Buffer
  79. exports.SlowBuffer = SlowBuffer
  80. exports.INSPECT_MAX_BYTES = 50
  81. /**
  82. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  83. * === true Use Uint8Array implementation (fastest)
  84. * === false Use Object implementation (most compatible, even IE6)
  85. *
  86. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  87. * Opera 11.6+, iOS 4.2+.
  88. *
  89. * Due to various browser bugs, sometimes the Object implementation will be used even
  90. * when the browser supports typed arrays.
  91. *
  92. * Note:
  93. *
  94. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  95. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  96. *
  97. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  98. *
  99. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  100. * incorrect length in some situations.
  101. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  102. * get the Object implementation, which is slower but behaves correctly.
  103. */
  104. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  105. ? global.TYPED_ARRAY_SUPPORT
  106. : typedArraySupport()
  107. /*
  108. * Export kMaxLength after typed array support is determined.
  109. */
  110. exports.kMaxLength = kMaxLength()
  111. function typedArraySupport () {
  112. try {
  113. var arr = new Uint8Array(1)
  114. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  115. return arr.foo() === 42 && // typed array instances can be augmented
  116. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  117. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  118. } catch (e) {
  119. return false
  120. }
  121. }
  122. function kMaxLength () {
  123. return Buffer.TYPED_ARRAY_SUPPORT
  124. ? 0x7fffffff
  125. : 0x3fffffff
  126. }
  127. function createBuffer (that, length) {
  128. if (kMaxLength() < length) {
  129. throw new RangeError('Invalid typed array length')
  130. }
  131. if (Buffer.TYPED_ARRAY_SUPPORT) {
  132. // Return an augmented `Uint8Array` instance, for best performance
  133. that = new Uint8Array(length)
  134. that.__proto__ = Buffer.prototype
  135. } else {
  136. // Fallback: Return an object instance of the Buffer class
  137. if (that === null) {
  138. that = new Buffer(length)
  139. }
  140. that.length = length
  141. }
  142. return that
  143. }
  144. /**
  145. * The Buffer constructor returns instances of `Uint8Array` that have their
  146. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  147. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  148. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  149. * returns a single octet.
  150. *
  151. * The `Uint8Array` prototype remains unmodified.
  152. */
  153. function Buffer (arg, encodingOrOffset, length) {
  154. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  155. return new Buffer(arg, encodingOrOffset, length)
  156. }
  157. // Common case.
  158. if (typeof arg === 'number') {
  159. if (typeof encodingOrOffset === 'string') {
  160. throw new Error(
  161. 'If encoding is specified then the first argument must be a string'
  162. )
  163. }
  164. return allocUnsafe(this, arg)
  165. }
  166. return from(this, arg, encodingOrOffset, length)
  167. }
  168. Buffer.poolSize = 8192 // not used by this implementation
  169. // TODO: Legacy, not needed anymore. Remove in next major version.
  170. Buffer._augment = function (arr) {
  171. arr.__proto__ = Buffer.prototype
  172. return arr
  173. }
  174. function from (that, value, encodingOrOffset, length) {
  175. if (typeof value === 'number') {
  176. throw new TypeError('"value" argument must not be a number')
  177. }
  178. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  179. return fromArrayBuffer(that, value, encodingOrOffset, length)
  180. }
  181. if (typeof value === 'string') {
  182. return fromString(that, value, encodingOrOffset)
  183. }
  184. return fromObject(that, value)
  185. }
  186. /**
  187. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  188. * if value is a number.
  189. * Buffer.from(str[, encoding])
  190. * Buffer.from(array)
  191. * Buffer.from(buffer)
  192. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  193. **/
  194. Buffer.from = function (value, encodingOrOffset, length) {
  195. return from(null, value, encodingOrOffset, length)
  196. }
  197. if (Buffer.TYPED_ARRAY_SUPPORT) {
  198. Buffer.prototype.__proto__ = Uint8Array.prototype
  199. Buffer.__proto__ = Uint8Array
  200. if (typeof Symbol !== 'undefined' && Symbol.species &&
  201. Buffer[Symbol.species] === Buffer) {
  202. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  203. Object.defineProperty(Buffer, Symbol.species, {
  204. value: null,
  205. configurable: true
  206. })
  207. }
  208. }
  209. function assertSize (size) {
  210. if (typeof size !== 'number') {
  211. throw new TypeError('"size" argument must be a number')
  212. } else if (size < 0) {
  213. throw new RangeError('"size" argument must not be negative')
  214. }
  215. }
  216. function alloc (that, size, fill, encoding) {
  217. assertSize(size)
  218. if (size <= 0) {
  219. return createBuffer(that, size)
  220. }
  221. if (fill !== undefined) {
  222. // Only pay attention to encoding if it's a string. This
  223. // prevents accidentally sending in a number that would
  224. // be interpretted as a start offset.
  225. return typeof encoding === 'string'
  226. ? createBuffer(that, size).fill(fill, encoding)
  227. : createBuffer(that, size).fill(fill)
  228. }
  229. return createBuffer(that, size)
  230. }
  231. /**
  232. * Creates a new filled Buffer instance.
  233. * alloc(size[, fill[, encoding]])
  234. **/
  235. Buffer.alloc = function (size, fill, encoding) {
  236. return alloc(null, size, fill, encoding)
  237. }
  238. function allocUnsafe (that, size) {
  239. assertSize(size)
  240. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  241. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  242. for (var i = 0; i < size; ++i) {
  243. that[i] = 0
  244. }
  245. }
  246. return that
  247. }
  248. /**
  249. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  250. * */
  251. Buffer.allocUnsafe = function (size) {
  252. return allocUnsafe(null, size)
  253. }
  254. /**
  255. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  256. */
  257. Buffer.allocUnsafeSlow = function (size) {
  258. return allocUnsafe(null, size)
  259. }
  260. function fromString (that, string, encoding) {
  261. if (typeof encoding !== 'string' || encoding === '') {
  262. encoding = 'utf8'
  263. }
  264. if (!Buffer.isEncoding(encoding)) {
  265. throw new TypeError('"encoding" must be a valid string encoding')
  266. }
  267. var length = byteLength(string, encoding) | 0
  268. that = createBuffer(that, length)
  269. var actual = that.write(string, encoding)
  270. if (actual !== length) {
  271. // Writing a hex string, for example, that contains invalid characters will
  272. // cause everything after the first invalid character to be ignored. (e.g.
  273. // 'abxxcd' will be treated as 'ab')
  274. that = that.slice(0, actual)
  275. }
  276. return that
  277. }
  278. function fromArrayLike (that, array) {
  279. var length = array.length < 0 ? 0 : checked(array.length) | 0
  280. that = createBuffer(that, length)
  281. for (var i = 0; i < length; i += 1) {
  282. that[i] = array[i] & 255
  283. }
  284. return that
  285. }
  286. function fromArrayBuffer (that, array, byteOffset, length) {
  287. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  288. if (byteOffset < 0 || array.byteLength < byteOffset) {
  289. throw new RangeError('\'offset\' is out of bounds')
  290. }
  291. if (array.byteLength < byteOffset + (length || 0)) {
  292. throw new RangeError('\'length\' is out of bounds')
  293. }
  294. if (byteOffset === undefined && length === undefined) {
  295. array = new Uint8Array(array)
  296. } else if (length === undefined) {
  297. array = new Uint8Array(array, byteOffset)
  298. } else {
  299. array = new Uint8Array(array, byteOffset, length)
  300. }
  301. if (Buffer.TYPED_ARRAY_SUPPORT) {
  302. // Return an augmented `Uint8Array` instance, for best performance
  303. that = array
  304. that.__proto__ = Buffer.prototype
  305. } else {
  306. // Fallback: Return an object instance of the Buffer class
  307. that = fromArrayLike(that, array)
  308. }
  309. return that
  310. }
  311. function fromObject (that, obj) {
  312. if (Buffer.isBuffer(obj)) {
  313. var len = checked(obj.length) | 0
  314. that = createBuffer(that, len)
  315. if (that.length === 0) {
  316. return that
  317. }
  318. obj.copy(that, 0, 0, len)
  319. return that
  320. }
  321. if (obj) {
  322. if ((typeof ArrayBuffer !== 'undefined' &&
  323. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  324. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  325. return createBuffer(that, 0)
  326. }
  327. return fromArrayLike(that, obj)
  328. }
  329. if (obj.type === 'Buffer' && isArray(obj.data)) {
  330. return fromArrayLike(that, obj.data)
  331. }
  332. }
  333. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  334. }
  335. function checked (length) {
  336. // Note: cannot use `length < kMaxLength()` here because that fails when
  337. // length is NaN (which is otherwise coerced to zero.)
  338. if (length >= kMaxLength()) {
  339. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  340. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  341. }
  342. return length | 0
  343. }
  344. function SlowBuffer (length) {
  345. if (+length != length) { // eslint-disable-line eqeqeq
  346. length = 0
  347. }
  348. return Buffer.alloc(+length)
  349. }
  350. Buffer.isBuffer = function isBuffer (b) {
  351. return !!(b != null && b._isBuffer)
  352. }
  353. Buffer.compare = function compare (a, b) {
  354. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  355. throw new TypeError('Arguments must be Buffers')
  356. }
  357. if (a === b) return 0
  358. var x = a.length
  359. var y = b.length
  360. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  361. if (a[i] !== b[i]) {
  362. x = a[i]
  363. y = b[i]
  364. break
  365. }
  366. }
  367. if (x < y) return -1
  368. if (y < x) return 1
  369. return 0
  370. }
  371. Buffer.isEncoding = function isEncoding (encoding) {
  372. switch (String(encoding).toLowerCase()) {
  373. case 'hex':
  374. case 'utf8':
  375. case 'utf-8':
  376. case 'ascii':
  377. case 'latin1':
  378. case 'binary':
  379. case 'base64':
  380. case 'ucs2':
  381. case 'ucs-2':
  382. case 'utf16le':
  383. case 'utf-16le':
  384. return true
  385. default:
  386. return false
  387. }
  388. }
  389. Buffer.concat = function concat (list, length) {
  390. if (!isArray(list)) {
  391. throw new TypeError('"list" argument must be an Array of Buffers')
  392. }
  393. if (list.length === 0) {
  394. return Buffer.alloc(0)
  395. }
  396. var i
  397. if (length === undefined) {
  398. length = 0
  399. for (i = 0; i < list.length; ++i) {
  400. length += list[i].length
  401. }
  402. }
  403. var buffer = Buffer.allocUnsafe(length)
  404. var pos = 0
  405. for (i = 0; i < list.length; ++i) {
  406. var buf = list[i]
  407. if (!Buffer.isBuffer(buf)) {
  408. throw new TypeError('"list" argument must be an Array of Buffers')
  409. }
  410. buf.copy(buffer, pos)
  411. pos += buf.length
  412. }
  413. return buffer
  414. }
  415. function byteLength (string, encoding) {
  416. if (Buffer.isBuffer(string)) {
  417. return string.length
  418. }
  419. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  420. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  421. return string.byteLength
  422. }
  423. if (typeof string !== 'string') {
  424. string = '' + string
  425. }
  426. var len = string.length
  427. if (len === 0) return 0
  428. // Use a for loop to avoid recursion
  429. var loweredCase = false
  430. for (;;) {
  431. switch (encoding) {
  432. case 'ascii':
  433. case 'latin1':
  434. case 'binary':
  435. return len
  436. case 'utf8':
  437. case 'utf-8':
  438. case undefined:
  439. return utf8ToBytes(string).length
  440. case 'ucs2':
  441. case 'ucs-2':
  442. case 'utf16le':
  443. case 'utf-16le':
  444. return len * 2
  445. case 'hex':
  446. return len >>> 1
  447. case 'base64':
  448. return base64ToBytes(string).length
  449. default:
  450. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  451. encoding = ('' + encoding).toLowerCase()
  452. loweredCase = true
  453. }
  454. }
  455. }
  456. Buffer.byteLength = byteLength
  457. function slowToString (encoding, start, end) {
  458. var loweredCase = false
  459. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  460. // property of a typed array.
  461. // This behaves neither like String nor Uint8Array in that we set start/end
  462. // to their upper/lower bounds if the value passed is out of range.
  463. // undefined is handled specially as per ECMA-262 6th Edition,
  464. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  465. if (start === undefined || start < 0) {
  466. start = 0
  467. }
  468. // Return early if start > this.length. Done here to prevent potential uint32
  469. // coercion fail below.
  470. if (start > this.length) {
  471. return ''
  472. }
  473. if (end === undefined || end > this.length) {
  474. end = this.length
  475. }
  476. if (end <= 0) {
  477. return ''
  478. }
  479. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  480. end >>>= 0
  481. start >>>= 0
  482. if (end <= start) {
  483. return ''
  484. }
  485. if (!encoding) encoding = 'utf8'
  486. while (true) {
  487. switch (encoding) {
  488. case 'hex':
  489. return hexSlice(this, start, end)
  490. case 'utf8':
  491. case 'utf-8':
  492. return utf8Slice(this, start, end)
  493. case 'ascii':
  494. return asciiSlice(this, start, end)
  495. case 'latin1':
  496. case 'binary':
  497. return latin1Slice(this, start, end)
  498. case 'base64':
  499. return base64Slice(this, start, end)
  500. case 'ucs2':
  501. case 'ucs-2':
  502. case 'utf16le':
  503. case 'utf-16le':
  504. return utf16leSlice(this, start, end)
  505. default:
  506. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  507. encoding = (encoding + '').toLowerCase()
  508. loweredCase = true
  509. }
  510. }
  511. }
  512. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  513. // Buffer instances.
  514. Buffer.prototype._isBuffer = true
  515. function swap (b, n, m) {
  516. var i = b[n]
  517. b[n] = b[m]
  518. b[m] = i
  519. }
  520. Buffer.prototype.swap16 = function swap16 () {
  521. var len = this.length
  522. if (len % 2 !== 0) {
  523. throw new RangeError('Buffer size must be a multiple of 16-bits')
  524. }
  525. for (var i = 0; i < len; i += 2) {
  526. swap(this, i, i + 1)
  527. }
  528. return this
  529. }
  530. Buffer.prototype.swap32 = function swap32 () {
  531. var len = this.length
  532. if (len % 4 !== 0) {
  533. throw new RangeError('Buffer size must be a multiple of 32-bits')
  534. }
  535. for (var i = 0; i < len; i += 4) {
  536. swap(this, i, i + 3)
  537. swap(this, i + 1, i + 2)
  538. }
  539. return this
  540. }
  541. Buffer.prototype.swap64 = function swap64 () {
  542. var len = this.length
  543. if (len % 8 !== 0) {
  544. throw new RangeError('Buffer size must be a multiple of 64-bits')
  545. }
  546. for (var i = 0; i < len; i += 8) {
  547. swap(this, i, i + 7)
  548. swap(this, i + 1, i + 6)
  549. swap(this, i + 2, i + 5)
  550. swap(this, i + 3, i + 4)
  551. }
  552. return this
  553. }
  554. Buffer.prototype.toString = function toString () {
  555. var length = this.length | 0
  556. if (length === 0) return ''
  557. if (arguments.length === 0) return utf8Slice(this, 0, length)
  558. return slowToString.apply(this, arguments)
  559. }
  560. Buffer.prototype.equals = function equals (b) {
  561. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  562. if (this === b) return true
  563. return Buffer.compare(this, b) === 0
  564. }
  565. Buffer.prototype.inspect = function inspect () {
  566. var str = ''
  567. var max = exports.INSPECT_MAX_BYTES
  568. if (this.length > 0) {
  569. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  570. if (this.length > max) str += ' ... '
  571. }
  572. return '<Buffer ' + str + '>'
  573. }
  574. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  575. if (!Buffer.isBuffer(target)) {
  576. throw new TypeError('Argument must be a Buffer')
  577. }
  578. if (start === undefined) {
  579. start = 0
  580. }
  581. if (end === undefined) {
  582. end = target ? target.length : 0
  583. }
  584. if (thisStart === undefined) {
  585. thisStart = 0
  586. }
  587. if (thisEnd === undefined) {
  588. thisEnd = this.length
  589. }
  590. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  591. throw new RangeError('out of range index')
  592. }
  593. if (thisStart >= thisEnd && start >= end) {
  594. return 0
  595. }
  596. if (thisStart >= thisEnd) {
  597. return -1
  598. }
  599. if (start >= end) {
  600. return 1
  601. }
  602. start >>>= 0
  603. end >>>= 0
  604. thisStart >>>= 0
  605. thisEnd >>>= 0
  606. if (this === target) return 0
  607. var x = thisEnd - thisStart
  608. var y = end - start
  609. var len = Math.min(x, y)
  610. var thisCopy = this.slice(thisStart, thisEnd)
  611. var targetCopy = target.slice(start, end)
  612. for (var i = 0; i < len; ++i) {
  613. if (thisCopy[i] !== targetCopy[i]) {
  614. x = thisCopy[i]
  615. y = targetCopy[i]
  616. break
  617. }
  618. }
  619. if (x < y) return -1
  620. if (y < x) return 1
  621. return 0
  622. }
  623. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  624. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  625. //
  626. // Arguments:
  627. // - buffer - a Buffer to search
  628. // - val - a string, Buffer, or number
  629. // - byteOffset - an index into `buffer`; will be clamped to an int32
  630. // - encoding - an optional encoding, relevant is val is a string
  631. // - dir - true for indexOf, false for lastIndexOf
  632. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  633. // Empty buffer means no match
  634. if (buffer.length === 0) return -1
  635. // Normalize byteOffset
  636. if (typeof byteOffset === 'string') {
  637. encoding = byteOffset
  638. byteOffset = 0
  639. } else if (byteOffset > 0x7fffffff) {
  640. byteOffset = 0x7fffffff
  641. } else if (byteOffset < -0x80000000) {
  642. byteOffset = -0x80000000
  643. }
  644. byteOffset = +byteOffset // Coerce to Number.
  645. if (isNaN(byteOffset)) {
  646. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  647. byteOffset = dir ? 0 : (buffer.length - 1)
  648. }
  649. // Normalize byteOffset: negative offsets start from the end of the buffer
  650. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  651. if (byteOffset >= buffer.length) {
  652. if (dir) return -1
  653. else byteOffset = buffer.length - 1
  654. } else if (byteOffset < 0) {
  655. if (dir) byteOffset = 0
  656. else return -1
  657. }
  658. // Normalize val
  659. if (typeof val === 'string') {
  660. val = Buffer.from(val, encoding)
  661. }
  662. // Finally, search either indexOf (if dir is true) or lastIndexOf
  663. if (Buffer.isBuffer(val)) {
  664. // Special case: looking for empty string/buffer always fails
  665. if (val.length === 0) {
  666. return -1
  667. }
  668. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  669. } else if (typeof val === 'number') {
  670. val = val & 0xFF // Search for a byte value [0-255]
  671. if (Buffer.TYPED_ARRAY_SUPPORT &&
  672. typeof Uint8Array.prototype.indexOf === 'function') {
  673. if (dir) {
  674. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  675. } else {
  676. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  677. }
  678. }
  679. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  680. }
  681. throw new TypeError('val must be string, number or Buffer')
  682. }
  683. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  684. var indexSize = 1
  685. var arrLength = arr.length
  686. var valLength = val.length
  687. if (encoding !== undefined) {
  688. encoding = String(encoding).toLowerCase()
  689. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  690. encoding === 'utf16le' || encoding === 'utf-16le') {
  691. if (arr.length < 2 || val.length < 2) {
  692. return -1
  693. }
  694. indexSize = 2
  695. arrLength /= 2
  696. valLength /= 2
  697. byteOffset /= 2
  698. }
  699. }
  700. function read (buf, i) {
  701. if (indexSize === 1) {
  702. return buf[i]
  703. } else {
  704. return buf.readUInt16BE(i * indexSize)
  705. }
  706. }
  707. var i
  708. if (dir) {
  709. var foundIndex = -1
  710. for (i = byteOffset; i < arrLength; i++) {
  711. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  712. if (foundIndex === -1) foundIndex = i
  713. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  714. } else {
  715. if (foundIndex !== -1) i -= i - foundIndex
  716. foundIndex = -1
  717. }
  718. }
  719. } else {
  720. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  721. for (i = byteOffset; i >= 0; i--) {
  722. var found = true
  723. for (var j = 0; j < valLength; j++) {
  724. if (read(arr, i + j) !== read(val, j)) {
  725. found = false
  726. break
  727. }
  728. }
  729. if (found) return i
  730. }
  731. }
  732. return -1
  733. }
  734. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  735. return this.indexOf(val, byteOffset, encoding) !== -1
  736. }
  737. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  738. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  739. }
  740. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  741. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  742. }
  743. function hexWrite (buf, string, offset, length) {
  744. offset = Number(offset) || 0
  745. var remaining = buf.length - offset
  746. if (!length) {
  747. length = remaining
  748. } else {
  749. length = Number(length)
  750. if (length > remaining) {
  751. length = remaining
  752. }
  753. }
  754. // must be an even number of digits
  755. var strLen = string.length
  756. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  757. if (length > strLen / 2) {
  758. length = strLen / 2
  759. }
  760. for (var i = 0; i < length; ++i) {
  761. var parsed = parseInt(string.substr(i * 2, 2), 16)
  762. if (isNaN(parsed)) return i
  763. buf[offset + i] = parsed
  764. }
  765. return i
  766. }
  767. function utf8Write (buf, string, offset, length) {
  768. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  769. }
  770. function asciiWrite (buf, string, offset, length) {
  771. return blitBuffer(asciiToBytes(string), buf, offset, length)
  772. }
  773. function latin1Write (buf, string, offset, length) {
  774. return asciiWrite(buf, string, offset, length)
  775. }
  776. function base64Write (buf, string, offset, length) {
  777. return blitBuffer(base64ToBytes(string), buf, offset, length)
  778. }
  779. function ucs2Write (buf, string, offset, length) {
  780. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  781. }
  782. Buffer.prototype.write = function write (string, offset, length, encoding) {
  783. // Buffer#write(string)
  784. if (offset === undefined) {
  785. encoding = 'utf8'
  786. length = this.length
  787. offset = 0
  788. // Buffer#write(string, encoding)
  789. } else if (length === undefined && typeof offset === 'string') {
  790. encoding = offset
  791. length = this.length
  792. offset = 0
  793. // Buffer#write(string, offset[, length][, encoding])
  794. } else if (isFinite(offset)) {
  795. offset = offset | 0
  796. if (isFinite(length)) {
  797. length = length | 0
  798. if (encoding === undefined) encoding = 'utf8'
  799. } else {
  800. encoding = length
  801. length = undefined
  802. }
  803. // legacy write(string, encoding, offset, length) - remove in v0.13
  804. } else {
  805. throw new Error(
  806. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  807. )
  808. }
  809. var remaining = this.length - offset
  810. if (length === undefined || length > remaining) length = remaining
  811. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  812. throw new RangeError('Attempt to write outside buffer bounds')
  813. }
  814. if (!encoding) encoding = 'utf8'
  815. var loweredCase = false
  816. for (;;) {
  817. switch (encoding) {
  818. case 'hex':
  819. return hexWrite(this, string, offset, length)
  820. case 'utf8':
  821. case 'utf-8':
  822. return utf8Write(this, string, offset, length)
  823. case 'ascii':
  824. return asciiWrite(this, string, offset, length)
  825. case 'latin1':
  826. case 'binary':
  827. return latin1Write(this, string, offset, length)
  828. case 'base64':
  829. // Warning: maxLength not taken into account in base64Write
  830. return base64Write(this, string, offset, length)
  831. case 'ucs2':
  832. case 'ucs-2':
  833. case 'utf16le':
  834. case 'utf-16le':
  835. return ucs2Write(this, string, offset, length)
  836. default:
  837. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  838. encoding = ('' + encoding).toLowerCase()
  839. loweredCase = true
  840. }
  841. }
  842. }
  843. Buffer.prototype.toJSON = function toJSON () {
  844. return {
  845. type: 'Buffer',
  846. data: Array.prototype.slice.call(this._arr || this, 0)
  847. }
  848. }
  849. function base64Slice (buf, start, end) {
  850. if (start === 0 && end === buf.length) {
  851. return base64.fromByteArray(buf)
  852. } else {
  853. return base64.fromByteArray(buf.slice(start, end))
  854. }
  855. }
  856. function utf8Slice (buf, start, end) {
  857. end = Math.min(buf.length, end)
  858. var res = []
  859. var i = start
  860. while (i < end) {
  861. var firstByte = buf[i]
  862. var codePoint = null
  863. var bytesPerSequence = (firstByte > 0xEF) ? 4
  864. : (firstByte > 0xDF) ? 3
  865. : (firstByte > 0xBF) ? 2
  866. : 1
  867. if (i + bytesPerSequence <= end) {
  868. var secondByte, thirdByte, fourthByte, tempCodePoint
  869. switch (bytesPerSequence) {
  870. case 1:
  871. if (firstByte < 0x80) {
  872. codePoint = firstByte
  873. }
  874. break
  875. case 2:
  876. secondByte = buf[i + 1]
  877. if ((secondByte & 0xC0) === 0x80) {
  878. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  879. if (tempCodePoint > 0x7F) {
  880. codePoint = tempCodePoint
  881. }
  882. }
  883. break
  884. case 3:
  885. secondByte = buf[i + 1]
  886. thirdByte = buf[i + 2]
  887. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  888. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  889. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  890. codePoint = tempCodePoint
  891. }
  892. }
  893. break
  894. case 4:
  895. secondByte = buf[i + 1]
  896. thirdByte = buf[i + 2]
  897. fourthByte = buf[i + 3]
  898. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  899. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  900. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  901. codePoint = tempCodePoint
  902. }
  903. }
  904. }
  905. }
  906. if (codePoint === null) {
  907. // we did not generate a valid codePoint so insert a
  908. // replacement char (U+FFFD) and advance only 1 byte
  909. codePoint = 0xFFFD
  910. bytesPerSequence = 1
  911. } else if (codePoint > 0xFFFF) {
  912. // encode to utf16 (surrogate pair dance)
  913. codePoint -= 0x10000
  914. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  915. codePoint = 0xDC00 | codePoint & 0x3FF
  916. }
  917. res.push(codePoint)
  918. i += bytesPerSequence
  919. }
  920. return decodeCodePointsArray(res)
  921. }
  922. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  923. // the lowest limit is Chrome, with 0x10000 args.
  924. // We go 1 magnitude less, for safety
  925. var MAX_ARGUMENTS_LENGTH = 0x1000
  926. function decodeCodePointsArray (codePoints) {
  927. var len = codePoints.length
  928. if (len <= MAX_ARGUMENTS_LENGTH) {
  929. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  930. }
  931. // Decode in chunks to avoid "call stack size exceeded".
  932. var res = ''
  933. var i = 0
  934. while (i < len) {
  935. res += String.fromCharCode.apply(
  936. String,
  937. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  938. )
  939. }
  940. return res
  941. }
  942. function asciiSlice (buf, start, end) {
  943. var ret = ''
  944. end = Math.min(buf.length, end)
  945. for (var i = start; i < end; ++i) {
  946. ret += String.fromCharCode(buf[i] & 0x7F)
  947. }
  948. return ret
  949. }
  950. function latin1Slice (buf, start, end) {
  951. var ret = ''
  952. end = Math.min(buf.length, end)
  953. for (var i = start; i < end; ++i) {
  954. ret += String.fromCharCode(buf[i])
  955. }
  956. return ret
  957. }
  958. function hexSlice (buf, start, end) {
  959. var len = buf.length
  960. if (!start || start < 0) start = 0
  961. if (!end || end < 0 || end > len) end = len
  962. var out = ''
  963. for (var i = start; i < end; ++i) {
  964. out += toHex(buf[i])
  965. }
  966. return out
  967. }
  968. function utf16leSlice (buf, start, end) {
  969. var bytes = buf.slice(start, end)
  970. var res = ''
  971. for (var i = 0; i < bytes.length; i += 2) {
  972. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  973. }
  974. return res
  975. }
  976. Buffer.prototype.slice = function slice (start, end) {
  977. var len = this.length
  978. start = ~~start
  979. end = end === undefined ? len : ~~end
  980. if (start < 0) {
  981. start += len
  982. if (start < 0) start = 0
  983. } else if (start > len) {
  984. start = len
  985. }
  986. if (end < 0) {
  987. end += len
  988. if (end < 0) end = 0
  989. } else if (end > len) {
  990. end = len
  991. }
  992. if (end < start) end = start
  993. var newBuf
  994. if (Buffer.TYPED_ARRAY_SUPPORT) {
  995. newBuf = this.subarray(start, end)
  996. newBuf.__proto__ = Buffer.prototype
  997. } else {
  998. var sliceLen = end - start
  999. newBuf = new Buffer(sliceLen, undefined)
  1000. for (var i = 0; i < sliceLen; ++i) {
  1001. newBuf[i] = this[i + start]
  1002. }
  1003. }
  1004. return newBuf
  1005. }
  1006. /*
  1007. * Need to make sure that buffer isn't trying to write out of bounds.
  1008. */
  1009. function checkOffset (offset, ext, length) {
  1010. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  1011. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  1012. }
  1013. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  1014. offset = offset | 0
  1015. byteLength = byteLength | 0
  1016. if (!noAssert) checkOffset(offset, byteLength, this.length)
  1017. var val = this[offset]
  1018. var mul = 1
  1019. var i = 0
  1020. while (++i < byteLength && (mul *= 0x100)) {
  1021. val += this[offset + i] * mul
  1022. }
  1023. return val
  1024. }
  1025. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  1026. offset = offset | 0
  1027. byteLength = byteLength | 0
  1028. if (!noAssert) {
  1029. checkOffset(offset, byteLength, this.length)
  1030. }
  1031. var val = this[offset + --byteLength]
  1032. var mul = 1
  1033. while (byteLength > 0 && (mul *= 0x100)) {
  1034. val += this[offset + --byteLength] * mul
  1035. }
  1036. return val
  1037. }
  1038. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  1039. if (!noAssert) checkOffset(offset, 1, this.length)
  1040. return this[offset]
  1041. }
  1042. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  1043. if (!noAssert) checkOffset(offset, 2, this.length)
  1044. return this[offset] | (this[offset + 1] << 8)
  1045. }
  1046. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  1047. if (!noAssert) checkOffset(offset, 2, this.length)
  1048. return (this[offset] << 8) | this[offset + 1]
  1049. }
  1050. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  1051. if (!noAssert) checkOffset(offset, 4, this.length)
  1052. return ((this[offset]) |
  1053. (this[offset + 1] << 8) |
  1054. (this[offset + 2] << 16)) +
  1055. (this[offset + 3] * 0x1000000)
  1056. }
  1057. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  1058. if (!noAssert) checkOffset(offset, 4, this.length)
  1059. return (this[offset] * 0x1000000) +
  1060. ((this[offset + 1] << 16) |
  1061. (this[offset + 2] << 8) |
  1062. this[offset + 3])
  1063. }
  1064. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  1065. offset = offset | 0
  1066. byteLength = byteLength | 0
  1067. if (!noAssert) checkOffset(offset, byteLength, this.length)
  1068. var val = this[offset]
  1069. var mul = 1
  1070. var i = 0
  1071. while (++i < byteLength && (mul *= 0x100)) {
  1072. val += this[offset + i] * mul
  1073. }
  1074. mul *= 0x80
  1075. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  1076. return val
  1077. }
  1078. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  1079. offset = offset | 0
  1080. byteLength = byteLength | 0
  1081. if (!noAssert) checkOffset(offset, byteLength, this.length)
  1082. var i = byteLength
  1083. var mul = 1
  1084. var val = this[offset + --i]
  1085. while (i > 0 && (mul *= 0x100)) {
  1086. val += this[offset + --i] * mul
  1087. }
  1088. mul *= 0x80
  1089. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  1090. return val
  1091. }
  1092. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  1093. if (!noAssert) checkOffset(offset, 1, this.length)
  1094. if (!(this[offset] & 0x80)) return (this[offset])
  1095. return ((0xff - this[offset] + 1) * -1)
  1096. }
  1097. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  1098. if (!noAssert) checkOffset(offset, 2, this.length)
  1099. var val = this[offset] | (this[offset + 1] << 8)
  1100. return (val & 0x8000) ? val | 0xFFFF0000 : val
  1101. }
  1102. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  1103. if (!noAssert) checkOffset(offset, 2, this.length)
  1104. var val = this[offset + 1] | (this[offset] << 8)
  1105. return (val & 0x8000) ? val | 0xFFFF0000 : val
  1106. }
  1107. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  1108. if (!noAssert) checkOffset(offset, 4, this.length)
  1109. return (this[offset]) |
  1110. (this[offset + 1] << 8) |
  1111. (this[offset + 2] << 16) |
  1112. (this[offset + 3] << 24)
  1113. }
  1114. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  1115. if (!noAssert) checkOffset(offset, 4, this.length)
  1116. return (this[offset] << 24) |
  1117. (this[offset + 1] << 16) |
  1118. (this[offset + 2] << 8) |
  1119. (this[offset + 3])
  1120. }
  1121. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  1122. if (!noAssert) checkOffset(offset, 4, this.length)
  1123. return ieee754.read(this, offset, true, 23, 4)
  1124. }
  1125. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  1126. if (!noAssert) checkOffset(offset, 4, this.length)
  1127. return ieee754.read(this, offset, false, 23, 4)
  1128. }
  1129. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  1130. if (!noAssert) checkOffset(offset, 8, this.length)
  1131. return ieee754.read(this, offset, true, 52, 8)
  1132. }
  1133. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  1134. if (!noAssert) checkOffset(offset, 8, this.length)
  1135. return ieee754.read(this, offset, false, 52, 8)
  1136. }
  1137. function checkInt (buf, value, offset, ext, max, min) {
  1138. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  1139. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  1140. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  1141. }
  1142. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  1143. value = +value
  1144. offset = offset | 0
  1145. byteLength = byteLength | 0
  1146. if (!noAssert) {
  1147. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  1148. checkInt(this, value, offset, byteLength, maxBytes, 0)
  1149. }
  1150. var mul = 1
  1151. var i = 0
  1152. this[offset] = value & 0xFF
  1153. while (++i < byteLength && (mul *= 0x100)) {
  1154. this[offset + i] = (value / mul) & 0xFF
  1155. }
  1156. return offset + byteLength
  1157. }
  1158. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  1159. value = +value
  1160. offset = offset | 0
  1161. byteLength = byteLength | 0
  1162. if (!noAssert) {
  1163. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  1164. checkInt(this, value, offset, byteLength, maxBytes, 0)
  1165. }
  1166. var i = byteLength - 1
  1167. var mul = 1
  1168. this[offset + i] = value & 0xFF
  1169. while (--i >= 0 && (mul *= 0x100)) {
  1170. this[offset + i] = (value / mul) & 0xFF
  1171. }
  1172. return offset + byteLength
  1173. }
  1174. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  1175. value = +value
  1176. offset = offset | 0
  1177. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  1178. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  1179. this[offset] = (value & 0xff)
  1180. return offset + 1
  1181. }
  1182. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  1183. if (value < 0) value = 0xffff + value + 1
  1184. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  1185. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  1186. (littleEndian ? i : 1 - i) * 8
  1187. }
  1188. }
  1189. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  1190. value = +value
  1191. offset = offset | 0
  1192. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  1193. if (Buffer.TYPED_ARRAY_SUPPORT) {
  1194. this[offset] = (value & 0xff)
  1195. this[offset + 1] = (value >>> 8)
  1196. } else {
  1197. objectWriteUInt16(this, value, offset, true)
  1198. }
  1199. return offset + 2
  1200. }
  1201. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  1202. value = +value
  1203. offset = offset | 0
  1204. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  1205. if (Buffer.TYPED_ARRAY_SUPPORT) {
  1206. this[offset] = (value >>> 8)
  1207. this[offset + 1] = (value & 0xff)
  1208. } else {
  1209. objectWriteUInt16(this, value, offset, false)
  1210. }
  1211. return offset + 2
  1212. }
  1213. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  1214. if (value < 0) value = 0xffffffff + value + 1
  1215. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  1216. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  1217. }
  1218. }
  1219. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  1220. value = +value
  1221. offset = offset | 0
  1222. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  1223. if (Buffer.TYPED_ARRAY_SUPPORT) {
  1224. this[offset + 3] = (value >>> 24)
  1225. this[offset + 2] = (value >>> 16)
  1226. this[offset + 1] = (value >>> 8)
  1227. this[offset] = (value & 0xff)
  1228. } else {
  1229. objectWriteUInt32(this, value, offset, true)
  1230. }
  1231. return offset + 4
  1232. }
  1233. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  1234. value = +value
  1235. offset = offset | 0
  1236. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  1237. if (Buffer.TYPED_ARRAY_SUPPORT) {
  1238. this[offset] = (value >>> 24)
  1239. this[offset + 1] = (value >>> 16)
  1240. this[offset + 2] = (value >>> 8)
  1241. this[offset + 3] = (value & 0xff)
  1242. } else {
  1243. objectWriteUInt32(this, value, offset, false)
  1244. }
  1245. return offset + 4
  1246. }
  1247. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  1248. value = +value
  1249. offset = offset | 0
  1250. if (!noAssert) {
  1251. var limit = Math.pow(2, 8 * byteLength - 1)
  1252. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  1253. }
  1254. var i = 0
  1255. var mul = 1
  1256. var sub = 0
  1257. this[offset] = value & 0xFF
  1258. while (++i < byteLength && (mul *= 0x100)) {
  1259. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  1260. sub = 1
  1261. }
  1262. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  1263. }
  1264. return offset + byteLength
  1265. }
  1266. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  1267. value = +value
  1268. offset = offset | 0
  1269. if (!noAssert) {
  1270. var limit = Math.pow(2, 8 * byteLength - 1)
  1271. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  1272. }
  1273. var i = byteLength - 1
  1274. var mul = 1
  1275. var sub = 0
  1276. this[offset + i] = value & 0xFF
  1277. while (--i >= 0 && (mul *= 0x100)) {
  1278. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  1279. sub = 1
  1280. }
  1281. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  1282. }
  1283. return offset + byteLength
  1284. }
  1285. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  1286. value = +value
  1287. offset = offset | 0
  1288. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  1289. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  1290. if (value < 0) value = 0xff + value + 1
  1291. this[offset] = (value & 0xff)
  1292. return offset + 1
  1293. }
  1294. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  1295. value = +value
  1296. offset = offset | 0
  1297. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  1298. if (Buffer.TYPED_ARRAY_SUPPORT) {
  1299. this[offset] = (value & 0xff)
  1300. this[offset + 1] = (value >>> 8)
  1301. } else {
  1302. objectWriteUInt16(this, value, offset, true)
  1303. }
  1304. return offset + 2
  1305. }
  1306. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  1307. value = +value
  1308. offset = offset | 0
  1309. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  1310. if (Buffer.TYPED_ARRAY_SUPPORT) {
  1311. this[offset] = (value >>> 8)
  1312. this[offset + 1] = (value & 0xff)
  1313. } else {
  1314. objectWriteUInt16(this, value, offset, false)
  1315. }
  1316. return offset + 2
  1317. }
  1318. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  1319. value = +value
  1320. offset = offset | 0
  1321. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  1322. if (Buffer.TYPED_ARRAY_SUPPORT) {
  1323. this[offset] = (value & 0xff)
  1324. this[offset + 1] = (value >>> 8)
  1325. this[offset + 2] = (value >>> 16)
  1326. this[offset + 3] = (value >>> 24)
  1327. } else {
  1328. objectWriteUInt32(this, value, offset, true)
  1329. }
  1330. return offset + 4
  1331. }
  1332. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  1333. value = +value
  1334. offset = offset | 0
  1335. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  1336. if (value < 0) value = 0xffffffff + value + 1
  1337. if (Buffer.TYPED_ARRAY_SUPPORT) {
  1338. this[offset] = (value >>> 24)
  1339. this[offset + 1] = (value >>> 16)
  1340. this[offset + 2] = (value >>> 8)
  1341. this[offset + 3] = (value & 0xff)
  1342. } else {
  1343. objectWriteUInt32(this, value, offset, false)
  1344. }
  1345. return offset + 4
  1346. }
  1347. function checkIEEE754 (buf, value, offset, ext, max, min) {
  1348. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  1349. if (offset < 0) throw new RangeError('Index out of range')
  1350. }
  1351. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  1352. if (!noAssert) {
  1353. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  1354. }
  1355. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  1356. return offset + 4
  1357. }
  1358. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  1359. return writeFloat(this, value, offset, true, noAssert)
  1360. }
  1361. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  1362. return writeFloat(this, value, offset, false, noAssert)
  1363. }
  1364. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  1365. if (!noAssert) {
  1366. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  1367. }
  1368. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  1369. return offset + 8
  1370. }
  1371. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  1372. return writeDouble(this, value, offset, true, noAssert)
  1373. }
  1374. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  1375. return writeDouble(this, value, offset, false, noAssert)
  1376. }
  1377. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  1378. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  1379. if (!start) start = 0
  1380. if (!end && end !== 0) end = this.length
  1381. if (targetStart >= target.length) targetStart = target.length
  1382. if (!targetStart) targetStart = 0
  1383. if (end > 0 && end < start) end = start
  1384. // Copy 0 bytes; we're done
  1385. if (end === start) return 0
  1386. if (target.length === 0 || this.length === 0) return 0
  1387. // Fatal error conditions
  1388. if (targetStart < 0) {
  1389. throw new RangeError('targetStart out of bounds')
  1390. }
  1391. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  1392. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  1393. // Are we oob?
  1394. if (end > this.length) end = this.length
  1395. if (target.length - targetStart < end - start) {
  1396. end = target.length - targetStart + start
  1397. }
  1398. var len = end - start
  1399. var i
  1400. if (this === target && start < targetStart && targetStart < end) {
  1401. // descending copy from end
  1402. for (i = len - 1; i >= 0; --i) {
  1403. target[i + targetStart] = this[i + start]
  1404. }
  1405. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  1406. // ascending copy from start
  1407. for (i = 0; i < len; ++i) {
  1408. target[i + targetStart] = this[i + start]
  1409. }
  1410. } else {
  1411. Uint8Array.prototype.set.call(
  1412. target,
  1413. this.subarray(start, start + len),
  1414. targetStart
  1415. )
  1416. }
  1417. return len
  1418. }
  1419. // Usage:
  1420. // buffer.fill(number[, offset[, end]])
  1421. // buffer.fill(buffer[, offset[, end]])
  1422. // buffer.fill(string[, offset[, end]][, encoding])
  1423. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  1424. // Handle string cases:
  1425. if (typeof val === 'string') {
  1426. if (typeof start === 'string') {
  1427. encoding = start
  1428. start = 0
  1429. end = this.length
  1430. } else if (typeof end === 'string') {
  1431. encoding = end
  1432. end = this.length
  1433. }
  1434. if (val.length === 1) {
  1435. var code = val.charCodeAt(0)
  1436. if (code < 256) {
  1437. val = code
  1438. }
  1439. }
  1440. if (encoding !== undefined && typeof encoding !== 'string') {
  1441. throw new TypeError('encoding must be a string')
  1442. }
  1443. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  1444. throw new TypeError('Unknown encoding: ' + encoding)
  1445. }
  1446. } else if (typeof val === 'number') {
  1447. val = val & 255
  1448. }
  1449. // Invalid ranges are not set to a default, so can range check early.
  1450. if (start < 0 || this.length < start || this.length < end) {
  1451. throw new RangeError('Out of range index')
  1452. }
  1453. if (end <= start) {
  1454. return this
  1455. }
  1456. start = start >>> 0
  1457. end = end === undefined ? this.length : end >>> 0
  1458. if (!val) val = 0
  1459. var i
  1460. if (typeof val === 'number') {
  1461. for (i = start; i < end; ++i) {
  1462. this[i] = val
  1463. }
  1464. } else {
  1465. var bytes = Buffer.isBuffer(val)
  1466. ? val
  1467. : utf8ToBytes(new Buffer(val, encoding).toString())
  1468. var len = bytes.length
  1469. for (i = 0; i < end - start; ++i) {
  1470. this[i + start] = bytes[i % len]
  1471. }
  1472. }
  1473. return this
  1474. }
  1475. // HELPER FUNCTIONS
  1476. // ================
  1477. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  1478. function base64clean (str) {
  1479. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  1480. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  1481. // Node converts strings with length < 2 to ''
  1482. if (str.length < 2) return ''
  1483. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  1484. while (str.length % 4 !== 0) {
  1485. str = str + '='
  1486. }
  1487. return str
  1488. }
  1489. function stringtrim (str) {
  1490. if (str.trim) return str.trim()
  1491. return str.replace(/^\s+|\s+$/g, '')
  1492. }
  1493. function toHex (n) {
  1494. if (n < 16) return '0' + n.toString(16)
  1495. return n.toString(16)
  1496. }
  1497. function utf8ToBytes (string, units) {
  1498. units = units || Infinity
  1499. var codePoint
  1500. var length = string.length
  1501. var leadSurrogate = null
  1502. var bytes = []
  1503. for (var i = 0; i < length; ++i) {
  1504. codePoint = string.charCodeAt(i)
  1505. // is surrogate component
  1506. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  1507. // last char was a lead
  1508. if (!leadSurrogate) {
  1509. // no lead yet
  1510. if (codePoint > 0xDBFF) {
  1511. // unexpected trail
  1512. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  1513. continue
  1514. } else if (i + 1 === length) {
  1515. // unpaired lead
  1516. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  1517. continue
  1518. }
  1519. // valid lead
  1520. leadSurrogate = codePoint
  1521. continue
  1522. }
  1523. // 2 leads in a row
  1524. if (codePoint < 0xDC00) {
  1525. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  1526. leadSurrogate = codePoint
  1527. continue
  1528. }
  1529. // valid surrogate pair
  1530. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  1531. } else if (leadSurrogate) {
  1532. // valid bmp char, but last char was a lead
  1533. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  1534. }
  1535. leadSurrogate = null
  1536. // encode utf8
  1537. if (codePoint < 0x80) {
  1538. if ((units -= 1) < 0) break
  1539. bytes.push(codePoint)
  1540. } else if (codePoint < 0x800) {
  1541. if ((units -= 2) < 0) break
  1542. bytes.push(
  1543. codePoint >> 0x6 | 0xC0,
  1544. codePoint & 0x3F | 0x80
  1545. )
  1546. } else if (codePoint < 0x10000) {
  1547. if ((units -= 3) < 0) break
  1548. bytes.push(
  1549. codePoint >> 0xC | 0xE0,
  1550. codePoint >> 0x6 & 0x3F | 0x80,
  1551. codePoint & 0x3F | 0x80
  1552. )
  1553. } else if (codePoint < 0x110000) {
  1554. if ((units -= 4) < 0) break
  1555. bytes.push(
  1556. codePoint >> 0x12 | 0xF0,
  1557. codePoint >> 0xC & 0x3F | 0x80,
  1558. codePoint >> 0x6 & 0x3F | 0x80,
  1559. codePoint & 0x3F | 0x80
  1560. )
  1561. } else {
  1562. throw new Error('Invalid code point')
  1563. }
  1564. }
  1565. return bytes
  1566. }
  1567. function asciiToBytes (str) {
  1568. var byteArray = []
  1569. for (var i = 0; i < str.length; ++i) {
  1570. // Node's code seems to be doing this and not & 0x7F..
  1571. byteArray.push(str.charCodeAt(i) & 0xFF)
  1572. }
  1573. return byteArray
  1574. }
  1575. function utf16leToBytes (str, units) {
  1576. var c, hi, lo
  1577. var byteArray = []
  1578. for (var i = 0; i < str.length; ++i) {
  1579. if ((units -= 2) < 0) break
  1580. c = str.charCodeAt(i)
  1581. hi = c >> 8
  1582. lo = c % 256
  1583. byteArray.push(lo)
  1584. byteArray.push(hi)
  1585. }
  1586. return byteArray
  1587. }
  1588. function base64ToBytes (str) {
  1589. return base64.toByteArray(base64clean(str))
  1590. }
  1591. function blitBuffer (src, dst, offset, length) {
  1592. for (var i = 0; i < length; ++i) {
  1593. if ((i + offset >= dst.length) || (i >= src.length)) break
  1594. dst[i + offset] = src[i]
  1595. }
  1596. return i
  1597. }
  1598. function isnan (val) {
  1599. return val !== val // eslint-disable-line no-self-compare
  1600. }
  1601. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7)))
  1602. /***/ }),
  1603. /* 1 */
  1604. /***/ (function(module, exports) {
  1605. if (typeof Object.create === 'function') {
  1606. // implementation from standard node.js 'util' module
  1607. module.exports = function inherits(ctor, superCtor) {
  1608. ctor.super_ = superCtor
  1609. ctor.prototype = Object.create(superCtor.prototype, {
  1610. constructor: {
  1611. value: ctor,
  1612. enumerable: false,
  1613. writable: true,
  1614. configurable: true
  1615. }
  1616. });
  1617. };
  1618. } else {
  1619. // old school shim for old browsers
  1620. module.exports = function inherits(ctor, superCtor) {
  1621. ctor.super_ = superCtor
  1622. var TempCtor = function () {}
  1623. TempCtor.prototype = superCtor.prototype
  1624. ctor.prototype = new TempCtor()
  1625. ctor.prototype.constructor = ctor
  1626. }
  1627. }
  1628. /***/ }),
  1629. /* 2 */
  1630. /***/ (function(module, exports, __webpack_require__) {
  1631. "use strict";
  1632. // a duplex stream is just a stream that is both readable and writable.
  1633. // Since JS doesn't have multiple prototypal inheritance, this class
  1634. // prototypally inherits from Readable, and then parasitically from
  1635. // Writable.
  1636. /*<replacement>*/
  1637. var objectKeys = Object.keys || function (obj) {
  1638. var keys = [];
  1639. for (var key in obj) {
  1640. keys.push(key);
  1641. }return keys;
  1642. };
  1643. /*</replacement>*/
  1644. module.exports = Duplex;
  1645. /*<replacement>*/
  1646. var processNextTick = __webpack_require__(11);
  1647. /*</replacement>*/
  1648. /*<replacement>*/
  1649. var util = __webpack_require__(5);
  1650. util.inherits = __webpack_require__(1);
  1651. /*</replacement>*/
  1652. var Readable = __webpack_require__(20);
  1653. var Writable = __webpack_require__(13);
  1654. util.inherits(Duplex, Readable);
  1655. var keys = objectKeys(Writable.prototype);
  1656. for (var v = 0; v < keys.length; v++) {
  1657. var method = keys[v];
  1658. if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
  1659. }
  1660. function Duplex(options) {
  1661. if (!(this instanceof Duplex)) return new Duplex(options);
  1662. Readable.call(this, options);
  1663. Writable.call(this, options);
  1664. if (options && options.readable === false) this.readable = false;
  1665. if (options && options.writable === false) this.writable = false;
  1666. this.allowHalfOpen = true;
  1667. if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
  1668. this.once('end', onend);
  1669. }
  1670. // the no-half-open enforcer
  1671. function onend() {
  1672. // if we allow half-open state, or if the writable side ended,
  1673. // then we're ok.
  1674. if (this.allowHalfOpen || this._writableState.ended) return;
  1675. // no more data can be written.
  1676. // But allow more writes to happen in this tick.
  1677. processNextTick(onEndNT, this);
  1678. }
  1679. function onEndNT(self) {
  1680. self.end();
  1681. }
  1682. function forEach(xs, f) {
  1683. for (var i = 0, l = xs.length; i < l; i++) {
  1684. f(xs[i], i);
  1685. }
  1686. }
  1687. /***/ }),
  1688. /* 3 */
  1689. /***/ (function(module, exports) {
  1690. // shim for using process in browser
  1691. var process = module.exports = {};
  1692. // cached from whatever global is present so that test runners that stub it
  1693. // don't break things. But we need to wrap it in a try catch in case it is
  1694. // wrapped in strict mode code which doesn't define any globals. It's inside a
  1695. // function because try/catches deoptimize in certain engines.
  1696. var cachedSetTimeout;
  1697. var cachedClearTimeout;
  1698. function defaultSetTimout() {
  1699. throw new Error('setTimeout has not been defined');
  1700. }
  1701. function defaultClearTimeout () {
  1702. throw new Error('clearTimeout has not been defined');
  1703. }
  1704. (function () {
  1705. try {
  1706. if (typeof setTimeout === 'function') {
  1707. cachedSetTimeout = setTimeout;
  1708. } else {
  1709. cachedSetTimeout = defaultSetTimout;
  1710. }
  1711. } catch (e) {
  1712. cachedSetTimeout = defaultSetTimout;
  1713. }
  1714. try {
  1715. if (typeof clearTimeout === 'function') {
  1716. cachedClearTimeout = clearTimeout;
  1717. } else {
  1718. cachedClearTimeout = defaultClearTimeout;
  1719. }
  1720. } catch (e) {
  1721. cachedClearTimeout = defaultClearTimeout;
  1722. }
  1723. } ())
  1724. function runTimeout(fun) {
  1725. if (cachedSetTimeout === setTimeout) {
  1726. //normal enviroments in sane situations
  1727. return setTimeout(fun, 0);
  1728. }
  1729. // if setTimeout wasn't available but was latter defined
  1730. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  1731. cachedSetTimeout = setTimeout;
  1732. return setTimeout(fun, 0);
  1733. }
  1734. try {
  1735. // when when somebody has screwed with setTimeout but no I.E. maddness
  1736. return cachedSetTimeout(fun, 0);
  1737. } catch(e){
  1738. try {
  1739. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  1740. return cachedSetTimeout.call(null, fun, 0);
  1741. } catch(e){
  1742. // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
  1743. return cachedSetTimeout.call(this, fun, 0);
  1744. }
  1745. }
  1746. }
  1747. function runClearTimeout(marker) {
  1748. if (cachedClearTimeout === clearTimeout) {
  1749. //normal enviroments in sane situations
  1750. return clearTimeout(marker);
  1751. }
  1752. // if clearTimeout wasn't available but was latter defined
  1753. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  1754. cachedClearTimeout = clearTimeout;
  1755. return clearTimeout(marker);
  1756. }
  1757. try {
  1758. // when when somebody has screwed with setTimeout but no I.E. maddness
  1759. return cachedClearTimeout(marker);
  1760. } catch (e){
  1761. try {
  1762. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  1763. return cachedClearTimeout.call(null, marker);
  1764. } catch (e){
  1765. // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
  1766. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  1767. return cachedClearTimeout.call(this, marker);
  1768. }
  1769. }
  1770. }
  1771. var queue = [];
  1772. var draining = false;
  1773. var currentQueue;
  1774. var queueIndex = -1;
  1775. function cleanUpNextTick() {
  1776. if (!draining || !currentQueue) {
  1777. return;
  1778. }
  1779. draining = false;
  1780. if (currentQueue.length) {
  1781. queue = currentQueue.concat(queue);
  1782. } else {
  1783. queueIndex = -1;
  1784. }
  1785. if (queue.length) {
  1786. drainQueue();
  1787. }
  1788. }
  1789. function drainQueue() {
  1790. if (draining) {
  1791. return;
  1792. }
  1793. var timeout = runTimeout(cleanUpNextTick);
  1794. draining = true;
  1795. var len = queue.length;
  1796. while(len) {
  1797. currentQueue = queue;
  1798. queue = [];
  1799. while (++queueIndex < len) {
  1800. if (currentQueue) {
  1801. currentQueue[queueIndex].run();
  1802. }
  1803. }
  1804. queueIndex = -1;
  1805. len = queue.length;
  1806. }
  1807. currentQueue = null;
  1808. draining = false;
  1809. runClearTimeout(timeout);
  1810. }
  1811. process.nextTick = function (fun) {
  1812. var args = new Array(arguments.length - 1);
  1813. if (arguments.length > 1) {
  1814. for (var i = 1; i < arguments.length; i++) {
  1815. args[i - 1] = arguments[i];
  1816. }
  1817. }
  1818. queue.push(new Item(fun, args));
  1819. if (queue.length === 1 && !draining) {
  1820. runTimeout(drainQueue);
  1821. }
  1822. };
  1823. // v8 likes predictible objects
  1824. function Item(fun, array) {
  1825. this.fun = fun;
  1826. this.array = array;
  1827. }
  1828. Item.prototype.run = function () {
  1829. this.fun.apply(null, this.array);
  1830. };
  1831. process.title = 'browser';
  1832. process.browser = true;
  1833. process.env = {};
  1834. process.argv = [];
  1835. process.version = ''; // empty string to avoid regexp issues
  1836. process.versions = {};
  1837. function noop() {}
  1838. process.on = noop;
  1839. process.addListener = noop;
  1840. process.once = noop;
  1841. process.off = noop;
  1842. process.removeListener = noop;
  1843. process.removeAllListeners = noop;
  1844. process.emit = noop;
  1845. process.binding = function (name) {
  1846. throw new Error('process.binding is not supported');
  1847. };
  1848. process.cwd = function () { return '/' };
  1849. process.chdir = function (dir) {
  1850. throw new Error('process.chdir is not supported');
  1851. };
  1852. process.umask = function() { return 0; };
  1853. /***/ }),
  1854. /* 4 */
  1855. /***/ (function(module, exports, __webpack_require__) {
  1856. /* WEBPACK VAR INJECTION */(function(Buffer) {// prototype class for hash functions
  1857. function Hash (blockSize, finalSize) {
  1858. this._block = new Buffer(blockSize)
  1859. this._finalSize = finalSize
  1860. this._blockSize = blockSize
  1861. this._len = 0
  1862. this._s = 0
  1863. }
  1864. Hash.prototype.update = function (data, enc) {
  1865. if (typeof data === 'string') {
  1866. enc = enc || 'utf8'
  1867. data = new Buffer(data, enc)
  1868. }
  1869. var l = this._len += data.length
  1870. var s = this._s || 0
  1871. var f = 0
  1872. var buffer = this._block
  1873. while (s < l) {
  1874. var t = Math.min(data.length, f + this._blockSize - (s % this._blockSize))
  1875. var ch = (t - f)
  1876. for (var i = 0; i < ch; i++) {
  1877. buffer[(s % this._blockSize) + i] = data[i + f]
  1878. }
  1879. s += ch
  1880. f += ch
  1881. if ((s % this._blockSize) === 0) {
  1882. this._update(buffer)
  1883. }
  1884. }
  1885. this._s = s
  1886. return this
  1887. }
  1888. Hash.prototype.digest = function (enc) {
  1889. // Suppose the length of the message M, in bits, is l
  1890. var l = this._len * 8
  1891. // Append the bit 1 to the end of the message
  1892. this._block[this._len % this._blockSize] = 0x80
  1893. // and then k zero bits, where k is the smallest non-negative solution to the equation (l + 1 + k) === finalSize mod blockSize
  1894. this._block.fill(0, this._len % this._blockSize + 1)
  1895. if (l % (this._blockSize * 8) >= this._finalSize * 8) {
  1896. this._update(this._block)
  1897. this._block.fill(0)
  1898. }
  1899. // to this append the block which is equal to the number l written in binary
  1900. // TODO: handle case where l is > Math.pow(2, 29)
  1901. this._block.writeInt32BE(l, this._blockSize - 4)
  1902. var hash = this._update(this._block) || this._hash()
  1903. return enc ? hash.toString(enc) : hash
  1904. }
  1905. Hash.prototype._update = function () {
  1906. throw new Error('_update must be implemented by subclass')
  1907. }
  1908. module.exports = Hash
  1909. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  1910. /***/ }),
  1911. /* 5 */
  1912. /***/ (function(module, exports, __webpack_require__) {
  1913. /* WEBPACK VAR INJECTION */(function(Buffer) {// Copyright Joyent, Inc. and other Node contributors.
  1914. //
  1915. // Permission is hereby granted, free of charge, to any person obtaining a
  1916. // copy of this software and associated documentation files (the
  1917. // "Software"), to deal in the Software without restriction, including
  1918. // without limitation the rights to use, copy, modify, merge, publish,
  1919. // distribute, sublicense, and/or sell copies of the Software, and to permit
  1920. // persons to whom the Software is furnished to do so, subject to the
  1921. // following conditions:
  1922. //
  1923. // The above copyright notice and this permission notice shall be included
  1924. // in all copies or substantial portions of the Software.
  1925. //
  1926. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  1927. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  1928. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  1929. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  1930. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  1931. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  1932. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  1933. // NOTE: These type checking functions intentionally don't use `instanceof`
  1934. // because it is fragile and can be easily faked with `Object.create()`.
  1935. function isArray(arg) {
  1936. if (Array.isArray) {
  1937. return Array.isArray(arg);
  1938. }
  1939. return objectToString(arg) === '[object Array]';
  1940. }
  1941. exports.isArray = isArray;
  1942. function isBoolean(arg) {
  1943. return typeof arg === 'boolean';
  1944. }
  1945. exports.isBoolean = isBoolean;
  1946. function isNull(arg) {
  1947. return arg === null;
  1948. }
  1949. exports.isNull = isNull;
  1950. function isNullOrUndefined(arg) {
  1951. return arg == null;
  1952. }
  1953. exports.isNullOrUndefined = isNullOrUndefined;
  1954. function isNumber(arg) {
  1955. return typeof arg === 'number';
  1956. }
  1957. exports.isNumber = isNumber;
  1958. function isString(arg) {
  1959. return typeof arg === 'string';
  1960. }
  1961. exports.isString = isString;
  1962. function isSymbol(arg) {
  1963. return typeof arg === 'symbol';
  1964. }
  1965. exports.isSymbol = isSymbol;
  1966. function isUndefined(arg) {
  1967. return arg === void 0;
  1968. }
  1969. exports.isUndefined = isUndefined;
  1970. function isRegExp(re) {
  1971. return objectToString(re) === '[object RegExp]';
  1972. }
  1973. exports.isRegExp = isRegExp;
  1974. function isObject(arg) {
  1975. return typeof arg === 'object' && arg !== null;
  1976. }
  1977. exports.isObject = isObject;
  1978. function isDate(d) {
  1979. return objectToString(d) === '[object Date]';
  1980. }
  1981. exports.isDate = isDate;
  1982. function isError(e) {
  1983. return (objectToString(e) === '[object Error]' || e instanceof Error);
  1984. }
  1985. exports.isError = isError;
  1986. function isFunction(arg) {
  1987. return typeof arg === 'function';
  1988. }
  1989. exports.isFunction = isFunction;
  1990. function isPrimitive(arg) {
  1991. return arg === null ||
  1992. typeof arg === 'boolean' ||
  1993. typeof arg === 'number' ||
  1994. typeof arg === 'string' ||
  1995. typeof arg === 'symbol' || // ES6 symbol
  1996. typeof arg === 'undefined';
  1997. }
  1998. exports.isPrimitive = isPrimitive;
  1999. exports.isBuffer = Buffer.isBuffer;
  2000. function objectToString(o) {
  2001. return Object.prototype.toString.call(o);
  2002. }
  2003. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  2004. /***/ }),
  2005. /* 6 */
  2006. /***/ (function(module, exports, __webpack_require__) {
  2007. // Copyright Joyent, Inc. and other Node contributors.
  2008. //
  2009. // Permission is hereby granted, free of charge, to any person obtaining a
  2010. // copy of this software and associated documentation files (the
  2011. // "Software"), to deal in the Software without restriction, including
  2012. // without limitation the rights to use, copy, modify, merge, publish,
  2013. // distribute, sublicense, and/or sell copies of the Software, and to permit
  2014. // persons to whom the Software is furnished to do so, subject to the
  2015. // following conditions:
  2016. //
  2017. // The above copyright notice and this permission notice shall be included
  2018. // in all copies or substantial portions of the Software.
  2019. //
  2020. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  2021. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  2022. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  2023. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  2024. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  2025. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  2026. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  2027. module.exports = Stream;
  2028. var EE = __webpack_require__(8).EventEmitter;
  2029. var inherits = __webpack_require__(1);
  2030. inherits(Stream, EE);
  2031. Stream.Readable = __webpack_require__(39);
  2032. Stream.Writable = __webpack_require__(41);
  2033. Stream.Duplex = __webpack_require__(36);
  2034. Stream.Transform = __webpack_require__(40);
  2035. Stream.PassThrough = __webpack_require__(38);
  2036. // Backwards-compat with node 0.4.x
  2037. Stream.Stream = Stream;
  2038. // old-style streams. Note that the pipe method (the only relevant
  2039. // part of this class) is overridden in the Readable class.
  2040. function Stream() {
  2041. EE.call(this);
  2042. }
  2043. Stream.prototype.pipe = function(dest, options) {
  2044. var source = this;
  2045. function ondata(chunk) {
  2046. if (dest.writable) {
  2047. if (false === dest.write(chunk) && source.pause) {
  2048. source.pause();
  2049. }
  2050. }
  2051. }
  2052. source.on('data', ondata);
  2053. function ondrain() {
  2054. if (source.readable && source.resume) {
  2055. source.resume();
  2056. }
  2057. }
  2058. dest.on('drain', ondrain);
  2059. // If the 'end' option is not supplied, dest.end() will be called when
  2060. // source gets the 'end' or 'close' events. Only dest.end() once.
  2061. if (!dest._isStdio && (!options || options.end !== false)) {
  2062. source.on('end', onend);
  2063. source.on('close', onclose);
  2064. }
  2065. var didOnEnd = false;
  2066. function onend() {
  2067. if (didOnEnd) return;
  2068. didOnEnd = true;
  2069. dest.end();
  2070. }
  2071. function onclose() {
  2072. if (didOnEnd) return;
  2073. didOnEnd = true;
  2074. if (typeof dest.destroy === 'function') dest.destroy();
  2075. }
  2076. // don't leave dangling pipes when there are errors.
  2077. function onerror(er) {
  2078. cleanup();
  2079. if (EE.listenerCount(this, 'error') === 0) {
  2080. throw er; // Unhandled stream error in pipe.
  2081. }
  2082. }
  2083. source.on('error', onerror);
  2084. dest.on('error', onerror);
  2085. // remove all the event listeners that were added.
  2086. function cleanup() {
  2087. source.removeListener('data', ondata);
  2088. dest.removeListener('drain', ondrain);
  2089. source.removeListener('end', onend);
  2090. source.removeListener('close', onclose);
  2091. source.removeListener('error', onerror);
  2092. dest.removeListener('error', onerror);
  2093. source.removeListener('end', cleanup);
  2094. source.removeListener('close', cleanup);
  2095. dest.removeListener('close', cleanup);
  2096. }
  2097. source.on('end', cleanup);
  2098. source.on('close', cleanup);
  2099. dest.on('close', cleanup);
  2100. dest.emit('pipe', source);
  2101. // Allow for unix-like usage: A.pipe(B).pipe(C)
  2102. return dest;
  2103. };
  2104. /***/ }),
  2105. /* 7 */
  2106. /***/ (function(module, exports) {
  2107. var g;
  2108. // This works in non-strict mode
  2109. g = (function() {
  2110. return this;
  2111. })();
  2112. try {
  2113. // This works if eval is allowed (see CSP)
  2114. g = g || Function("return this")() || (1,eval)("this");
  2115. } catch(e) {
  2116. // This works if the window reference is available
  2117. if(typeof window === "object")
  2118. g = window;
  2119. }
  2120. // g can still be undefined, but nothing to do about it...
  2121. // We return undefined, instead of nothing here, so it's
  2122. // easier to handle this case. if(!global) { ...}
  2123. module.exports = g;
  2124. /***/ }),
  2125. /* 8 */
  2126. /***/ (function(module, exports) {
  2127. // Copyright Joyent, Inc. and other Node contributors.
  2128. //
  2129. // Permission is hereby granted, free of charge, to any person obtaining a
  2130. // copy of this software and associated documentation files (the
  2131. // "Software"), to deal in the Software without restriction, including
  2132. // without limitation the rights to use, copy, modify, merge, publish,
  2133. // distribute, sublicense, and/or sell copies of the Software, and to permit
  2134. // persons to whom the Software is furnished to do so, subject to the
  2135. // following conditions:
  2136. //
  2137. // The above copyright notice and this permission notice shall be included
  2138. // in all copies or substantial portions of the Software.
  2139. //
  2140. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  2141. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  2142. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  2143. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  2144. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  2145. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  2146. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  2147. function EventEmitter() {
  2148. this._events = this._events || {};
  2149. this._maxListeners = this._maxListeners || undefined;
  2150. }
  2151. module.exports = EventEmitter;
  2152. // Backwards-compat with node 0.10.x
  2153. EventEmitter.EventEmitter = EventEmitter;
  2154. EventEmitter.prototype._events = undefined;
  2155. EventEmitter.prototype._maxListeners = undefined;
  2156. // By default EventEmitters will print a warning if more than 10 listeners are
  2157. // added to it. This is a useful default which helps finding memory leaks.
  2158. EventEmitter.defaultMaxListeners = 10;
  2159. // Obviously not all Emitters should be limited to 10. This function allows
  2160. // that to be increased. Set to zero for unlimited.
  2161. EventEmitter.prototype.setMaxListeners = function(n) {
  2162. if (!isNumber(n) || n < 0 || isNaN(n))
  2163. throw TypeError('n must be a positive number');
  2164. this._maxListeners = n;
  2165. return this;
  2166. };
  2167. EventEmitter.prototype.emit = function(type) {
  2168. var er, handler, len, args, i, listeners;
  2169. if (!this._events)
  2170. this._events = {};
  2171. // If there is no 'error' event listener then throw.
  2172. if (type === 'error') {
  2173. if (!this._events.error ||
  2174. (isObject(this._events.error) && !this._events.error.length)) {
  2175. er = arguments[1];
  2176. if (er instanceof Error) {
  2177. throw er; // Unhandled 'error' event
  2178. } else {
  2179. // At least give some kind of context to the user
  2180. var err = new Error('Uncaught, unspecified "error" event. (' + er + ')');
  2181. err.context = er;
  2182. throw err;
  2183. }
  2184. }
  2185. }
  2186. handler = this._events[type];
  2187. if (isUndefined(handler))
  2188. return false;
  2189. if (isFunction(handler)) {
  2190. switch (arguments.length) {
  2191. // fast cases
  2192. case 1:
  2193. handler.call(this);
  2194. break;
  2195. case 2:
  2196. handler.call(this, arguments[1]);
  2197. break;
  2198. case 3:
  2199. handler.call(this, arguments[1], arguments[2]);
  2200. break;
  2201. // slower
  2202. default:
  2203. args = Array.prototype.slice.call(arguments, 1);
  2204. handler.apply(this, args);
  2205. }
  2206. } else if (isObject(handler)) {
  2207. args = Array.prototype.slice.call(arguments, 1);
  2208. listeners = handler.slice();
  2209. len = listeners.length;
  2210. for (i = 0; i < len; i++)
  2211. listeners[i].apply(this, args);
  2212. }
  2213. return true;
  2214. };
  2215. EventEmitter.prototype.addListener = function(type, listener) {
  2216. var m;
  2217. if (!isFunction(listener))
  2218. throw TypeError('listener must be a function');
  2219. if (!this._events)
  2220. this._events = {};
  2221. // To avoid recursion in the case that type === "newListener"! Before
  2222. // adding it to the listeners, first emit "newListener".
  2223. if (this._events.newListener)
  2224. this.emit('newListener', type,
  2225. isFunction(listener.listener) ?
  2226. listener.listener : listener);
  2227. if (!this._events[type])
  2228. // Optimize the case of one listener. Don't need the extra array object.
  2229. this._events[type] = listener;
  2230. else if (isObject(this._events[type]))
  2231. // If we've already got an array, just append.
  2232. this._events[type].push(listener);
  2233. else
  2234. // Adding the second element, need to change to array.
  2235. this._events[type] = [this._events[type], listener];
  2236. // Check for listener leak
  2237. if (isObject(this._events[type]) && !this._events[type].warned) {
  2238. if (!isUndefined(this._maxListeners)) {
  2239. m = this._maxListeners;
  2240. } else {
  2241. m = EventEmitter.defaultMaxListeners;
  2242. }
  2243. if (m && m > 0 && this._events[type].length > m) {
  2244. this._events[type].warned = true;
  2245. console.error('(node) warning: possible EventEmitter memory ' +
  2246. 'leak detected. %d listeners added. ' +
  2247. 'Use emitter.setMaxListeners() to increase limit.',
  2248. this._events[type].length);
  2249. if (typeof console.trace === 'function') {
  2250. // not supported in IE 10
  2251. console.trace();
  2252. }
  2253. }
  2254. }
  2255. return this;
  2256. };
  2257. EventEmitter.prototype.on = EventEmitter.prototype.addListener;
  2258. EventEmitter.prototype.once = function(type, listener) {
  2259. if (!isFunction(listener))
  2260. throw TypeError('listener must be a function');
  2261. var fired = false;
  2262. function g() {
  2263. this.removeListener(type, g);
  2264. if (!fired) {
  2265. fired = true;
  2266. listener.apply(this, arguments);
  2267. }
  2268. }
  2269. g.listener = listener;
  2270. this.on(type, g);
  2271. return this;
  2272. };
  2273. // emits a 'removeListener' event iff the listener was removed
  2274. EventEmitter.prototype.removeListener = function(type, listener) {
  2275. var list, position, length, i;
  2276. if (!isFunction(listener))
  2277. throw TypeError('listener must be a function');
  2278. if (!this._events || !this._events[type])
  2279. return this;
  2280. list = this._events[type];
  2281. length = list.length;
  2282. position = -1;
  2283. if (list === listener ||
  2284. (isFunction(list.listener) && list.listener === listener)) {
  2285. delete this._events[type];
  2286. if (this._events.removeListener)
  2287. this.emit('removeListener', type, listener);
  2288. } else if (isObject(list)) {
  2289. for (i = length; i-- > 0;) {
  2290. if (list[i] === listener ||
  2291. (list[i].listener && list[i].listener === listener)) {
  2292. position = i;
  2293. break;
  2294. }
  2295. }
  2296. if (position < 0)
  2297. return this;
  2298. if (list.length === 1) {
  2299. list.length = 0;
  2300. delete this._events[type];
  2301. } else {
  2302. list.splice(position, 1);
  2303. }
  2304. if (this._events.removeListener)
  2305. this.emit('removeListener', type, listener);
  2306. }
  2307. return this;
  2308. };
  2309. EventEmitter.prototype.removeAllListeners = function(type) {
  2310. var key, listeners;
  2311. if (!this._events)
  2312. return this;
  2313. // not listening for removeListener, no need to emit
  2314. if (!this._events.removeListener) {
  2315. if (arguments.length === 0)
  2316. this._events = {};
  2317. else if (this._events[type])
  2318. delete this._events[type];
  2319. return this;
  2320. }
  2321. // emit removeListener for all listeners on all events
  2322. if (arguments.length === 0) {
  2323. for (key in this._events) {
  2324. if (key === 'removeListener') continue;
  2325. this.removeAllListeners(key);
  2326. }
  2327. this.removeAllListeners('removeListener');
  2328. this._events = {};
  2329. return this;
  2330. }
  2331. listeners = this._events[type];
  2332. if (isFunction(listeners)) {
  2333. this.removeListener(type, listeners);
  2334. } else if (listeners) {
  2335. // LIFO order
  2336. while (listeners.length)
  2337. this.removeListener(type, listeners[listeners.length - 1]);
  2338. }
  2339. delete this._events[type];
  2340. return this;
  2341. };
  2342. EventEmitter.prototype.listeners = function(type) {
  2343. var ret;
  2344. if (!this._events || !this._events[type])
  2345. ret = [];
  2346. else if (isFunction(this._events[type]))
  2347. ret = [this._events[type]];
  2348. else
  2349. ret = this._events[type].slice();
  2350. return ret;
  2351. };
  2352. EventEmitter.prototype.listenerCount = function(type) {
  2353. if (this._events) {
  2354. var evlistener = this._events[type];
  2355. if (isFunction(evlistener))
  2356. return 1;
  2357. else if (evlistener)
  2358. return evlistener.length;
  2359. }
  2360. return 0;
  2361. };
  2362. EventEmitter.listenerCount = function(emitter, type) {
  2363. return emitter.listenerCount(type);
  2364. };
  2365. function isFunction(arg) {
  2366. return typeof arg === 'function';
  2367. }
  2368. function isNumber(arg) {
  2369. return typeof arg === 'number';
  2370. }
  2371. function isObject(arg) {
  2372. return typeof arg === 'object' && arg !== null;
  2373. }
  2374. function isUndefined(arg) {
  2375. return arg === void 0;
  2376. }
  2377. /***/ }),
  2378. /* 9 */
  2379. /***/ (function(module, exports, __webpack_require__) {
  2380. /* WEBPACK VAR INJECTION */(function(Buffer) {var pbkdf2 = __webpack_require__(33);
  2381. var Promise = __webpack_require__(18);
  2382. function shouldUseNative() {
  2383. return !!(typeof window !== 'undefined' && window.crypto && window.crypto.subtle);
  2384. }
  2385. function pbkdf2Native(password, salt, iterations, keylen, digest) {
  2386. var algorithms = {
  2387. 'sha1': 'SHA-1',
  2388. 'sha-1': 'SHA-1',
  2389. 'sha256': 'SHA-256',
  2390. 'sha-256': 'SHA-256',
  2391. 'sha512': 'SHA-512',
  2392. 'sha-512': 'SHA-512'
  2393. };
  2394. return window.crypto.subtle.importKey('raw', new Buffer(password), 'PBKDF2', false, ['deriveKey']).then(function (key) {
  2395. var algo = {
  2396. name: 'PBKDF2',
  2397. salt: new Buffer(salt),
  2398. iterations: iterations,
  2399. hash: algorithms[digest.toLowerCase()]
  2400. };
  2401. return window.crypto.subtle.deriveKey(algo, key, {
  2402. name: 'AES-CTR',
  2403. length: keylen * 8
  2404. }, true, ['encrypt', 'decrypt']);
  2405. }).then(function (derivedKey) {
  2406. return window.crypto.subtle.exportKey('raw', derivedKey).then(function (keyArray) {
  2407. return new Buffer(keyArray).toString('hex');
  2408. });
  2409. });
  2410. }
  2411. function pbkdf2Browserified(password, salt, iterations, keylen, digest) {
  2412. return new Promise(function (resolve, reject) {
  2413. pbkdf2.pbkdf2(password, salt, iterations, keylen, digest, function (error, key) {
  2414. if (error) {
  2415. reject('error in pbkdf2');
  2416. } else {
  2417. resolve(key.toString('hex'));
  2418. }
  2419. });
  2420. });
  2421. }
  2422. module.exports = shouldUseNative() ? pbkdf2Native : pbkdf2Browserified;
  2423. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  2424. /***/ }),
  2425. /* 10 */
  2426. /***/ (function(module, exports, __webpack_require__) {
  2427. "use strict";
  2428. /* WEBPACK VAR INJECTION */(function(global) {
  2429. var buffer = __webpack_require__(0);
  2430. var Buffer = buffer.Buffer;
  2431. var SlowBuffer = buffer.SlowBuffer;
  2432. var MAX_LEN = buffer.kMaxLength || 2147483647;
  2433. exports.alloc = function alloc(size, fill, encoding) {
  2434. if (typeof Buffer.alloc === 'function') {
  2435. return Buffer.alloc(size, fill, encoding);
  2436. }
  2437. if (typeof encoding === 'number') {
  2438. throw new TypeError('encoding must not be number');
  2439. }
  2440. if (typeof size !== 'number') {
  2441. throw new TypeError('size must be a number');
  2442. }
  2443. if (size > MAX_LEN) {
  2444. throw new RangeError('size is too large');
  2445. }
  2446. var enc = encoding;
  2447. var _fill = fill;
  2448. if (_fill === undefined) {
  2449. enc = undefined;
  2450. _fill = 0;
  2451. }
  2452. var buf = new Buffer(size);
  2453. if (typeof _fill === 'string') {
  2454. var fillBuf = new Buffer(_fill, enc);
  2455. var flen = fillBuf.length;
  2456. var i = -1;
  2457. while (++i < size) {
  2458. buf[i] = fillBuf[i % flen];
  2459. }
  2460. } else {
  2461. buf.fill(_fill);
  2462. }
  2463. return buf;
  2464. }
  2465. exports.allocUnsafe = function allocUnsafe(size) {
  2466. if (typeof Buffer.allocUnsafe === 'function') {
  2467. return Buffer.allocUnsafe(size);
  2468. }
  2469. if (typeof size !== 'number') {
  2470. throw new TypeError('size must be a number');
  2471. }
  2472. if (size > MAX_LEN) {
  2473. throw new RangeError('size is too large');
  2474. }
  2475. return new Buffer(size);
  2476. }
  2477. exports.from = function from(value, encodingOrOffset, length) {
  2478. if (typeof Buffer.from === 'function' && (!global.Uint8Array || Uint8Array.from !== Buffer.from)) {
  2479. return Buffer.from(value, encodingOrOffset, length);
  2480. }
  2481. if (typeof value === 'number') {
  2482. throw new TypeError('"value" argument must not be a number');
  2483. }
  2484. if (typeof value === 'string') {
  2485. return new Buffer(value, encodingOrOffset);
  2486. }
  2487. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  2488. var offset = encodingOrOffset;
  2489. if (arguments.length === 1) {
  2490. return new Buffer(value);
  2491. }
  2492. if (typeof offset === 'undefined') {
  2493. offset = 0;
  2494. }
  2495. var len = length;
  2496. if (typeof len === 'undefined') {
  2497. len = value.byteLength - offset;
  2498. }
  2499. if (offset >= value.byteLength) {
  2500. throw new RangeError('\'offset\' is out of bounds');
  2501. }
  2502. if (len > value.byteLength - offset) {
  2503. throw new RangeError('\'length\' is out of bounds');
  2504. }
  2505. return new Buffer(value.slice(offset, offset + len));
  2506. }
  2507. if (Buffer.isBuffer(value)) {
  2508. var out = new Buffer(value.length);
  2509. value.copy(out, 0, 0, value.length);
  2510. return out;
  2511. }
  2512. if (value) {
  2513. if (Array.isArray(value) || (typeof ArrayBuffer !== 'undefined' && value.buffer instanceof ArrayBuffer) || 'length' in value) {
  2514. return new Buffer(value);
  2515. }
  2516. if (value.type === 'Buffer' && Array.isArray(value.data)) {
  2517. return new Buffer(value.data);
  2518. }
  2519. }
  2520. throw new TypeError('First argument must be a string, Buffer, ' + 'ArrayBuffer, Array, or array-like object.');
  2521. }
  2522. exports.allocUnsafeSlow = function allocUnsafeSlow(size) {
  2523. if (typeof Buffer.allocUnsafeSlow === 'function') {
  2524. return Buffer.allocUnsafeSlow(size);
  2525. }
  2526. if (typeof size !== 'number') {
  2527. throw new TypeError('size must be a number');
  2528. }
  2529. if (size >= MAX_LEN) {
  2530. throw new RangeError('size is too large');
  2531. }
  2532. return new SlowBuffer(size);
  2533. }
  2534. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7)))
  2535. /***/ }),
  2536. /* 11 */
  2537. /***/ (function(module, exports, __webpack_require__) {
  2538. "use strict";
  2539. /* WEBPACK VAR INJECTION */(function(process) {
  2540. if (!process.version ||
  2541. process.version.indexOf('v0.') === 0 ||
  2542. process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {
  2543. module.exports = nextTick;
  2544. } else {
  2545. module.exports = process.nextTick;
  2546. }
  2547. function nextTick(fn, arg1, arg2, arg3) {
  2548. if (typeof fn !== 'function') {
  2549. throw new TypeError('"callback" argument must be a function');
  2550. }
  2551. var len = arguments.length;
  2552. var args, i;
  2553. switch (len) {
  2554. case 0:
  2555. case 1:
  2556. return process.nextTick(fn);
  2557. case 2:
  2558. return process.nextTick(function afterTickOne() {
  2559. fn.call(null, arg1);
  2560. });
  2561. case 3:
  2562. return process.nextTick(function afterTickTwo() {
  2563. fn.call(null, arg1, arg2);
  2564. });
  2565. case 4:
  2566. return process.nextTick(function afterTickThree() {
  2567. fn.call(null, arg1, arg2, arg3);
  2568. });
  2569. default:
  2570. args = new Array(len - 1);
  2571. i = 0;
  2572. while (i < args.length) {
  2573. args[i++] = arguments[i];
  2574. }
  2575. return process.nextTick(function afterTick() {
  2576. fn.apply(null, args);
  2577. });
  2578. }
  2579. }
  2580. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
  2581. /***/ }),
  2582. /* 12 */
  2583. /***/ (function(module, exports, __webpack_require__) {
  2584. "use strict";
  2585. // a transform stream is a readable/writable stream where you do
  2586. // something with the data. Sometimes it's called a "filter",
  2587. // but that's not a great name for it, since that implies a thing where
  2588. // some bits pass through, and others are simply ignored. (That would
  2589. // be a valid example of a transform, of course.)
  2590. //
  2591. // While the output is causally related to the input, it's not a
  2592. // necessarily symmetric or synchronous transformation. For example,
  2593. // a zlib stream might take multiple plain-text writes(), and then
  2594. // emit a single compressed chunk some time in the future.
  2595. //
  2596. // Here's how this works:
  2597. //
  2598. // The Transform stream has all the aspects of the readable and writable
  2599. // stream classes. When you write(chunk), that calls _write(chunk,cb)
  2600. // internally, and returns false if there's a lot of pending writes
  2601. // buffered up. When you call read(), that calls _read(n) until
  2602. // there's enough pending readable data buffered up.
  2603. //
  2604. // In a transform stream, the written data is placed in a buffer. When
  2605. // _read(n) is called, it transforms the queued up data, calling the
  2606. // buffered _write cb's as it consumes chunks. If consuming a single
  2607. // written chunk would result in multiple output chunks, then the first
  2608. // outputted bit calls the readcb, and subsequent chunks just go into
  2609. // the read buffer, and will cause it to emit 'readable' if necessary.
  2610. //
  2611. // This way, back-pressure is actually determined by the reading side,
  2612. // since _read has to be called to start processing a new chunk. However,
  2613. // a pathological inflate type of transform can cause excessive buffering
  2614. // here. For example, imagine a stream where every byte of input is
  2615. // interpreted as an integer from 0-255, and then results in that many
  2616. // bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
  2617. // 1kb of data being output. In this case, you could write a very small
  2618. // amount of input, and end up with a very large amount of output. In
  2619. // such a pathological inflating mechanism, there'd be no way to tell
  2620. // the system to stop doing the transform. A single 4MB write could
  2621. // cause the system to run out of memory.
  2622. //
  2623. // However, even in such a pathological case, only a single written chunk
  2624. // would be consumed, and then the rest would wait (un-transformed) until
  2625. // the results of the previous transformed chunk were consumed.
  2626. module.exports = Transform;
  2627. var Duplex = __webpack_require__(2);
  2628. /*<replacement>*/
  2629. var util = __webpack_require__(5);
  2630. util.inherits = __webpack_require__(1);
  2631. /*</replacement>*/
  2632. util.inherits(Transform, Duplex);
  2633. function TransformState(stream) {
  2634. this.afterTransform = function (er, data) {
  2635. return afterTransform(stream, er, data);
  2636. };
  2637. this.needTransform = false;
  2638. this.transforming = false;
  2639. this.writecb = null;
  2640. this.writechunk = null;
  2641. this.writeencoding = null;
  2642. }
  2643. function afterTransform(stream, er, data) {
  2644. var ts = stream._transformState;
  2645. ts.transforming = false;
  2646. var cb = ts.writecb;
  2647. if (!cb) return stream.emit('error', new Error('no writecb in Transform class'));
  2648. ts.writechunk = null;
  2649. ts.writecb = null;
  2650. if (data !== null && data !== undefined) stream.push(data);
  2651. cb(er);
  2652. var rs = stream._readableState;
  2653. rs.reading = false;
  2654. if (rs.needReadable || rs.length < rs.highWaterMark) {
  2655. stream._read(rs.highWaterMark);
  2656. }
  2657. }
  2658. function Transform(options) {
  2659. if (!(this instanceof Transform)) return new Transform(options);
  2660. Duplex.call(this, options);
  2661. this._transformState = new TransformState(this);
  2662. var stream = this;
  2663. // start out asking for a readable event once data is transformed.
  2664. this._readableState.needReadable = true;
  2665. // we have implemented the _read method, and done the other things
  2666. // that Readable wants before the first _read call, so unset the
  2667. // sync guard flag.
  2668. this._readableState.sync = false;
  2669. if (options) {
  2670. if (typeof options.transform === 'function') this._transform = options.transform;
  2671. if (typeof options.flush === 'function') this._flush = options.flush;
  2672. }
  2673. // When the writable side finishes, then flush out anything remaining.
  2674. this.once('prefinish', function () {
  2675. if (typeof this._flush === 'function') this._flush(function (er, data) {
  2676. done(stream, er, data);
  2677. });else done(stream);
  2678. });
  2679. }
  2680. Transform.prototype.push = function (chunk, encoding) {
  2681. this._transformState.needTransform = false;
  2682. return Duplex.prototype.push.call(this, chunk, encoding);
  2683. };
  2684. // This is the part where you do stuff!
  2685. // override this function in implementation classes.
  2686. // 'chunk' is an input chunk.
  2687. //
  2688. // Call `push(newChunk)` to pass along transformed output
  2689. // to the readable side. You may call 'push' zero or more times.
  2690. //
  2691. // Call `cb(err)` when you are done with this chunk. If you pass
  2692. // an error, then that'll put the hurt on the whole operation. If you
  2693. // never call cb(), then you'll never get another chunk.
  2694. Transform.prototype._transform = function (chunk, encoding, cb) {
  2695. throw new Error('_transform() is not implemented');
  2696. };
  2697. Transform.prototype._write = function (chunk, encoding, cb) {
  2698. var ts = this._transformState;
  2699. ts.writecb = cb;
  2700. ts.writechunk = chunk;
  2701. ts.writeencoding = encoding;
  2702. if (!ts.transforming) {
  2703. var rs = this._readableState;
  2704. if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
  2705. }
  2706. };
  2707. // Doesn't matter what the args are here.
  2708. // _transform does all the work.
  2709. // That we got here means that the readable side wants more data.
  2710. Transform.prototype._read = function (n) {
  2711. var ts = this._transformState;
  2712. if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
  2713. ts.transforming = true;
  2714. this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
  2715. } else {
  2716. // mark that we need a transform, so that any data that comes in
  2717. // will get processed, now that we've asked for it.
  2718. ts.needTransform = true;
  2719. }
  2720. };
  2721. function done(stream, er, data) {
  2722. if (er) return stream.emit('error', er);
  2723. if (data !== null && data !== undefined) stream.push(data);
  2724. // if there's nothing in the write buffer, then that means
  2725. // that nothing more will ever be provided
  2726. var ws = stream._writableState;
  2727. var ts = stream._transformState;
  2728. if (ws.length) throw new Error('Calling transform done when ws.length != 0');
  2729. if (ts.transforming) throw new Error('Calling transform done when still transforming');
  2730. return stream.push(null);
  2731. }
  2732. /***/ }),
  2733. /* 13 */
  2734. /***/ (function(module, exports, __webpack_require__) {
  2735. "use strict";
  2736. /* WEBPACK VAR INJECTION */(function(process, setImmediate) {// A bit simpler than readable streams.
  2737. // Implement an async ._write(chunk, encoding, cb), and it'll handle all
  2738. // the drain event emission and buffering.
  2739. module.exports = Writable;
  2740. /*<replacement>*/
  2741. var processNextTick = __webpack_require__(11);
  2742. /*</replacement>*/
  2743. /*<replacement>*/
  2744. var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : processNextTick;
  2745. /*</replacement>*/
  2746. /*<replacement>*/
  2747. var Duplex;
  2748. /*</replacement>*/
  2749. Writable.WritableState = WritableState;
  2750. /*<replacement>*/
  2751. var util = __webpack_require__(5);
  2752. util.inherits = __webpack_require__(1);
  2753. /*</replacement>*/
  2754. /*<replacement>*/
  2755. var internalUtil = {
  2756. deprecate: __webpack_require__(49)
  2757. };
  2758. /*</replacement>*/
  2759. /*<replacement>*/
  2760. var Stream;
  2761. (function () {
  2762. try {
  2763. Stream = __webpack_require__(6);
  2764. } catch (_) {} finally {
  2765. if (!Stream) Stream = __webpack_require__(8).EventEmitter;
  2766. }
  2767. })();
  2768. /*</replacement>*/
  2769. var Buffer = __webpack_require__(0).Buffer;
  2770. /*<replacement>*/
  2771. var bufferShim = __webpack_require__(10);
  2772. /*</replacement>*/
  2773. util.inherits(Writable, Stream);
  2774. function nop() {}
  2775. function WriteReq(chunk, encoding, cb) {
  2776. this.chunk = chunk;
  2777. this.encoding = encoding;
  2778. this.callback = cb;
  2779. this.next = null;
  2780. }
  2781. function WritableState(options, stream) {
  2782. Duplex = Duplex || __webpack_require__(2);
  2783. options = options || {};
  2784. // object stream flag to indicate whether or not this stream
  2785. // contains buffers or objects.
  2786. this.objectMode = !!options.objectMode;
  2787. if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
  2788. // the point at which write() starts returning false
  2789. // Note: 0 is a valid value, means that we always return false if
  2790. // the entire buffer is not flushed immediately on write()
  2791. var hwm = options.highWaterMark;
  2792. var defaultHwm = this.objectMode ? 16 : 16 * 1024;
  2793. this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm;
  2794. // cast to ints.
  2795. this.highWaterMark = ~ ~this.highWaterMark;
  2796. // drain event flag.
  2797. this.needDrain = false;
  2798. // at the start of calling end()
  2799. this.ending = false;
  2800. // when end() has been called, and returned
  2801. this.ended = false;
  2802. // when 'finish' is emitted
  2803. this.finished = false;
  2804. // should we decode strings into buffers before passing to _write?
  2805. // this is here so that some node-core streams can optimize string
  2806. // handling at a lower level.
  2807. var noDecode = options.decodeStrings === false;
  2808. this.decodeStrings = !noDecode;
  2809. // Crypto is kind of old and crusty. Historically, its default string
  2810. // encoding is 'binary' so we have to make this configurable.
  2811. // Everything else in the universe uses 'utf8', though.
  2812. this.defaultEncoding = options.defaultEncoding || 'utf8';
  2813. // not an actual buffer we keep track of, but a measurement
  2814. // of how much we're waiting to get pushed to some underlying
  2815. // socket or file.
  2816. this.length = 0;
  2817. // a flag to see when we're in the middle of a write.
  2818. this.writing = false;
  2819. // when true all writes will be buffered until .uncork() call
  2820. this.corked = 0;
  2821. // a flag to be able to tell if the onwrite cb is called immediately,
  2822. // or on a later tick. We set this to true at first, because any
  2823. // actions that shouldn't happen until "later" should generally also
  2824. // not happen before the first write call.
  2825. this.sync = true;
  2826. // a flag to know if we're processing previously buffered items, which
  2827. // may call the _write() callback in the same tick, so that we don't
  2828. // end up in an overlapped onwrite situation.
  2829. this.bufferProcessing = false;
  2830. // the callback that's passed to _write(chunk,cb)
  2831. this.onwrite = function (er) {
  2832. onwrite(stream, er);
  2833. };
  2834. // the callback that the user supplies to write(chunk,encoding,cb)
  2835. this.writecb = null;
  2836. // the amount that is being written when _write is called.
  2837. this.writelen = 0;
  2838. this.bufferedRequest = null;
  2839. this.lastBufferedRequest = null;
  2840. // number of pending user-supplied write callbacks
  2841. // this must be 0 before 'finish' can be emitted
  2842. this.pendingcb = 0;
  2843. // emit prefinish if the only thing we're waiting for is _write cbs
  2844. // This is relevant for synchronous Transform streams
  2845. this.prefinished = false;
  2846. // True if the error was already emitted and should not be thrown again
  2847. this.errorEmitted = false;
  2848. // count buffered requests
  2849. this.bufferedRequestCount = 0;
  2850. // allocate the first CorkedRequest, there is always
  2851. // one allocated and free to use, and we maintain at most two
  2852. this.corkedRequestsFree = new CorkedRequest(this);
  2853. }
  2854. WritableState.prototype.getBuffer = function getBuffer() {
  2855. var current = this.bufferedRequest;
  2856. var out = [];
  2857. while (current) {
  2858. out.push(current);
  2859. current = current.next;
  2860. }
  2861. return out;
  2862. };
  2863. (function () {
  2864. try {
  2865. Object.defineProperty(WritableState.prototype, 'buffer', {
  2866. get: internalUtil.deprecate(function () {
  2867. return this.getBuffer();
  2868. }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.')
  2869. });
  2870. } catch (_) {}
  2871. })();
  2872. // Test _writableState for inheritance to account for Duplex streams,
  2873. // whose prototype chain only points to Readable.
  2874. var realHasInstance;
  2875. if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
  2876. realHasInstance = Function.prototype[Symbol.hasInstance];
  2877. Object.defineProperty(Writable, Symbol.hasInstance, {
  2878. value: function (object) {
  2879. if (realHasInstance.call(this, object)) return true;
  2880. return object && object._writableState instanceof WritableState;
  2881. }
  2882. });
  2883. } else {
  2884. realHasInstance = function (object) {
  2885. return object instanceof this;
  2886. };
  2887. }
  2888. function Writable(options) {
  2889. Duplex = Duplex || __webpack_require__(2);
  2890. // Writable ctor is applied to Duplexes, too.
  2891. // `realHasInstance` is necessary because using plain `instanceof`
  2892. // would return false, as no `_writableState` property is attached.
  2893. // Trying to use the custom `instanceof` for Writable here will also break the
  2894. // Node.js LazyTransform implementation, which has a non-trivial getter for
  2895. // `_writableState` that would lead to infinite recursion.
  2896. if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
  2897. return new Writable(options);
  2898. }
  2899. this._writableState = new WritableState(options, this);
  2900. // legacy.
  2901. this.writable = true;
  2902. if (options) {
  2903. if (typeof options.write === 'function') this._write = options.write;
  2904. if (typeof options.writev === 'function') this._writev = options.writev;
  2905. }
  2906. Stream.call(this);
  2907. }
  2908. // Otherwise people can pipe Writable streams, which is just wrong.
  2909. Writable.prototype.pipe = function () {
  2910. this.emit('error', new Error('Cannot pipe, not readable'));
  2911. };
  2912. function writeAfterEnd(stream, cb) {
  2913. var er = new Error('write after end');
  2914. // TODO: defer error events consistently everywhere, not just the cb
  2915. stream.emit('error', er);
  2916. processNextTick(cb, er);
  2917. }
  2918. // If we get something that is not a buffer, string, null, or undefined,
  2919. // and we're not in objectMode, then that's an error.
  2920. // Otherwise stream chunks are all considered to be of length=1, and the
  2921. // watermarks determine how many objects to keep in the buffer, rather than
  2922. // how many bytes or characters.
  2923. function validChunk(stream, state, chunk, cb) {
  2924. var valid = true;
  2925. var er = false;
  2926. // Always throw error if a null is written
  2927. // if we are not in object mode then throw
  2928. // if it is not a buffer, string, or undefined.
  2929. if (chunk === null) {
  2930. er = new TypeError('May not write null values to stream');
  2931. } else if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
  2932. er = new TypeError('Invalid non-string/buffer chunk');
  2933. }
  2934. if (er) {
  2935. stream.emit('error', er);
  2936. processNextTick(cb, er);
  2937. valid = false;
  2938. }
  2939. return valid;
  2940. }
  2941. Writable.prototype.write = function (chunk, encoding, cb) {
  2942. var state = this._writableState;
  2943. var ret = false;
  2944. if (typeof encoding === 'function') {
  2945. cb = encoding;
  2946. encoding = null;
  2947. }
  2948. if (Buffer.isBuffer(chunk)) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
  2949. if (typeof cb !== 'function') cb = nop;
  2950. if (state.ended) writeAfterEnd(this, cb);else if (validChunk(this, state, chunk, cb)) {
  2951. state.pendingcb++;
  2952. ret = writeOrBuffer(this, state, chunk, encoding, cb);
  2953. }
  2954. return ret;
  2955. };
  2956. Writable.prototype.cork = function () {
  2957. var state = this._writableState;
  2958. state.corked++;
  2959. };
  2960. Writable.prototype.uncork = function () {
  2961. var state = this._writableState;
  2962. if (state.corked) {
  2963. state.corked--;
  2964. if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
  2965. }
  2966. };
  2967. Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
  2968. // node::ParseEncoding() requires lower case.
  2969. if (typeof encoding === 'string') encoding = encoding.toLowerCase();
  2970. if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding);
  2971. this._writableState.defaultEncoding = encoding;
  2972. return this;
  2973. };
  2974. function decodeChunk(state, chunk, encoding) {
  2975. if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
  2976. chunk = bufferShim.from(chunk, encoding);
  2977. }
  2978. return chunk;
  2979. }
  2980. // if we're already writing something, then just put this
  2981. // in the queue, and wait our turn. Otherwise, call _write
  2982. // If we return false, then we need a drain event, so set that flag.
  2983. function writeOrBuffer(stream, state, chunk, encoding, cb) {
  2984. chunk = decodeChunk(state, chunk, encoding);
  2985. if (Buffer.isBuffer(chunk)) encoding = 'buffer';
  2986. var len = state.objectMode ? 1 : chunk.length;
  2987. state.length += len;
  2988. var ret = state.length < state.highWaterMark;
  2989. // we must ensure that previous needDrain will not be reset to false.
  2990. if (!ret) state.needDrain = true;
  2991. if (state.writing || state.corked) {
  2992. var last = state.lastBufferedRequest;
  2993. state.lastBufferedRequest = new WriteReq(chunk, encoding, cb);
  2994. if (last) {
  2995. last.next = state.lastBufferedRequest;
  2996. } else {
  2997. state.bufferedRequest = state.lastBufferedRequest;
  2998. }
  2999. state.bufferedRequestCount += 1;
  3000. } else {
  3001. doWrite(stream, state, false, len, chunk, encoding, cb);
  3002. }
  3003. return ret;
  3004. }
  3005. function doWrite(stream, state, writev, len, chunk, encoding, cb) {
  3006. state.writelen = len;
  3007. state.writecb = cb;
  3008. state.writing = true;
  3009. state.sync = true;
  3010. if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
  3011. state.sync = false;
  3012. }
  3013. function onwriteError(stream, state, sync, er, cb) {
  3014. --state.pendingcb;
  3015. if (sync) processNextTick(cb, er);else cb(er);
  3016. stream._writableState.errorEmitted = true;
  3017. stream.emit('error', er);
  3018. }
  3019. function onwriteStateUpdate(state) {
  3020. state.writing = false;
  3021. state.writecb = null;
  3022. state.length -= state.writelen;
  3023. state.writelen = 0;
  3024. }
  3025. function onwrite(stream, er) {
  3026. var state = stream._writableState;
  3027. var sync = state.sync;
  3028. var cb = state.writecb;
  3029. onwriteStateUpdate(state);
  3030. if (er) onwriteError(stream, state, sync, er, cb);else {
  3031. // Check if we're actually ready to finish, but don't emit yet
  3032. var finished = needFinish(state);
  3033. if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
  3034. clearBuffer(stream, state);
  3035. }
  3036. if (sync) {
  3037. /*<replacement>*/
  3038. asyncWrite(afterWrite, stream, state, finished, cb);
  3039. /*</replacement>*/
  3040. } else {
  3041. afterWrite(stream, state, finished, cb);
  3042. }
  3043. }
  3044. }
  3045. function afterWrite(stream, state, finished, cb) {
  3046. if (!finished) onwriteDrain(stream, state);
  3047. state.pendingcb--;
  3048. cb();
  3049. finishMaybe(stream, state);
  3050. }
  3051. // Must force callback to be called on nextTick, so that we don't
  3052. // emit 'drain' before the write() consumer gets the 'false' return
  3053. // value, and has a chance to attach a 'drain' listener.
  3054. function onwriteDrain(stream, state) {
  3055. if (state.length === 0 && state.needDrain) {
  3056. state.needDrain = false;
  3057. stream.emit('drain');
  3058. }
  3059. }
  3060. // if there's something in the buffer waiting, then process it
  3061. function clearBuffer(stream, state) {
  3062. state.bufferProcessing = true;
  3063. var entry = state.bufferedRequest;
  3064. if (stream._writev && entry && entry.next) {
  3065. // Fast case, write everything using _writev()
  3066. var l = state.bufferedRequestCount;
  3067. var buffer = new Array(l);
  3068. var holder = state.corkedRequestsFree;
  3069. holder.entry = entry;
  3070. var count = 0;
  3071. while (entry) {
  3072. buffer[count] = entry;
  3073. entry = entry.next;
  3074. count += 1;
  3075. }
  3076. doWrite(stream, state, true, state.length, buffer, '', holder.finish);
  3077. // doWrite is almost always async, defer these to save a bit of time
  3078. // as the hot path ends with doWrite
  3079. state.pendingcb++;
  3080. state.lastBufferedRequest = null;
  3081. if (holder.next) {
  3082. state.corkedRequestsFree = holder.next;
  3083. holder.next = null;
  3084. } else {
  3085. state.corkedRequestsFree = new CorkedRequest(state);
  3086. }
  3087. } else {
  3088. // Slow case, write chunks one-by-one
  3089. while (entry) {
  3090. var chunk = entry.chunk;
  3091. var encoding = entry.encoding;
  3092. var cb = entry.callback;
  3093. var len = state.objectMode ? 1 : chunk.length;
  3094. doWrite(stream, state, false, len, chunk, encoding, cb);
  3095. entry = entry.next;
  3096. // if we didn't call the onwrite immediately, then
  3097. // it means that we need to wait until it does.
  3098. // also, that means that the chunk and cb are currently
  3099. // being processed, so move the buffer counter past them.
  3100. if (state.writing) {
  3101. break;
  3102. }
  3103. }
  3104. if (entry === null) state.lastBufferedRequest = null;
  3105. }
  3106. state.bufferedRequestCount = 0;
  3107. state.bufferedRequest = entry;
  3108. state.bufferProcessing = false;
  3109. }
  3110. Writable.prototype._write = function (chunk, encoding, cb) {
  3111. cb(new Error('_write() is not implemented'));
  3112. };
  3113. Writable.prototype._writev = null;
  3114. Writable.prototype.end = function (chunk, encoding, cb) {
  3115. var state = this._writableState;
  3116. if (typeof chunk === 'function') {
  3117. cb = chunk;
  3118. chunk = null;
  3119. encoding = null;
  3120. } else if (typeof encoding === 'function') {
  3121. cb = encoding;
  3122. encoding = null;
  3123. }
  3124. if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
  3125. // .end() fully uncorks
  3126. if (state.corked) {
  3127. state.corked = 1;
  3128. this.uncork();
  3129. }
  3130. // ignore unnecessary end() calls.
  3131. if (!state.ending && !state.finished) endWritable(this, state, cb);
  3132. };
  3133. function needFinish(state) {
  3134. return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
  3135. }
  3136. function prefinish(stream, state) {
  3137. if (!state.prefinished) {
  3138. state.prefinished = true;
  3139. stream.emit('prefinish');
  3140. }
  3141. }
  3142. function finishMaybe(stream, state) {
  3143. var need = needFinish(state);
  3144. if (need) {
  3145. if (state.pendingcb === 0) {
  3146. prefinish(stream, state);
  3147. state.finished = true;
  3148. stream.emit('finish');
  3149. } else {
  3150. prefinish(stream, state);
  3151. }
  3152. }
  3153. return need;
  3154. }
  3155. function endWritable(stream, state, cb) {
  3156. state.ending = true;
  3157. finishMaybe(stream, state);
  3158. if (cb) {
  3159. if (state.finished) processNextTick(cb);else stream.once('finish', cb);
  3160. }
  3161. state.ended = true;
  3162. stream.writable = false;
  3163. }
  3164. // It seems a linked list but it is not
  3165. // there will be only 2 of these for each stream
  3166. function CorkedRequest(state) {
  3167. var _this = this;
  3168. this.next = null;
  3169. this.entry = null;
  3170. this.finish = function (err) {
  3171. var entry = _this.entry;
  3172. _this.entry = null;
  3173. while (entry) {
  3174. var cb = entry.callback;
  3175. state.pendingcb--;
  3176. cb(err);
  3177. entry = entry.next;
  3178. }
  3179. if (state.corkedRequestsFree) {
  3180. state.corkedRequestsFree.next = _this;
  3181. } else {
  3182. state.corkedRequestsFree = _this;
  3183. }
  3184. };
  3185. }
  3186. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(17).setImmediate))
  3187. /***/ }),
  3188. /* 14 */
  3189. /***/ (function(module, exports, __webpack_require__) {
  3190. // Copyright Joyent, Inc. and other Node contributors.
  3191. //
  3192. // Permission is hereby granted, free of charge, to any person obtaining a
  3193. // copy of this software and associated documentation files (the
  3194. // "Software"), to deal in the Software without restriction, including
  3195. // without limitation the rights to use, copy, modify, merge, publish,
  3196. // distribute, sublicense, and/or sell copies of the Software, and to permit
  3197. // persons to whom the Software is furnished to do so, subject to the
  3198. // following conditions:
  3199. //
  3200. // The above copyright notice and this permission notice shall be included
  3201. // in all copies or substantial portions of the Software.
  3202. //
  3203. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  3204. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  3205. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  3206. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  3207. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  3208. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  3209. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  3210. var Buffer = __webpack_require__(0).Buffer;
  3211. var isBufferEncoding = Buffer.isEncoding
  3212. || function(encoding) {
  3213. switch (encoding && encoding.toLowerCase()) {
  3214. case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': case 'raw': return true;
  3215. default: return false;
  3216. }
  3217. }
  3218. function assertEncoding(encoding) {
  3219. if (encoding && !isBufferEncoding(encoding)) {
  3220. throw new Error('Unknown encoding: ' + encoding);
  3221. }
  3222. }
  3223. // StringDecoder provides an interface for efficiently splitting a series of
  3224. // buffers into a series of JS strings without breaking apart multi-byte
  3225. // characters. CESU-8 is handled as part of the UTF-8 encoding.
  3226. //
  3227. // @TODO Handling all encodings inside a single object makes it very difficult
  3228. // to reason about this code, so it should be split up in the future.
  3229. // @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code
  3230. // points as used by CESU-8.
  3231. var StringDecoder = exports.StringDecoder = function(encoding) {
  3232. this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, '');
  3233. assertEncoding(encoding);
  3234. switch (this.encoding) {
  3235. case 'utf8':
  3236. // CESU-8 represents each of Surrogate Pair by 3-bytes
  3237. this.surrogateSize = 3;
  3238. break;
  3239. case 'ucs2':
  3240. case 'utf16le':
  3241. // UTF-16 represents each of Surrogate Pair by 2-bytes
  3242. this.surrogateSize = 2;
  3243. this.detectIncompleteChar = utf16DetectIncompleteChar;
  3244. break;
  3245. case 'base64':
  3246. // Base-64 stores 3 bytes in 4 chars, and pads the remainder.
  3247. this.surrogateSize = 3;
  3248. this.detectIncompleteChar = base64DetectIncompleteChar;
  3249. break;
  3250. default:
  3251. this.write = passThroughWrite;
  3252. return;
  3253. }
  3254. // Enough space to store all bytes of a single character. UTF-8 needs 4
  3255. // bytes, but CESU-8 may require up to 6 (3 bytes per surrogate).
  3256. this.charBuffer = new Buffer(6);
  3257. // Number of bytes received for the current incomplete multi-byte character.
  3258. this.charReceived = 0;
  3259. // Number of bytes expected for the current incomplete multi-byte character.
  3260. this.charLength = 0;
  3261. };
  3262. // write decodes the given buffer and returns it as JS string that is
  3263. // guaranteed to not contain any partial multi-byte characters. Any partial
  3264. // character found at the end of the buffer is buffered up, and will be
  3265. // returned when calling write again with the remaining bytes.
  3266. //
  3267. // Note: Converting a Buffer containing an orphan surrogate to a String
  3268. // currently works, but converting a String to a Buffer (via `new Buffer`, or
  3269. // Buffer#write) will replace incomplete surrogates with the unicode
  3270. // replacement character. See https://codereview.chromium.org/121173009/ .
  3271. StringDecoder.prototype.write = function(buffer) {
  3272. var charStr = '';
  3273. // if our last write ended with an incomplete multibyte character
  3274. while (this.charLength) {
  3275. // determine how many remaining bytes this buffer has to offer for this char
  3276. var available = (buffer.length >= this.charLength - this.charReceived) ?
  3277. this.charLength - this.charReceived :
  3278. buffer.length;
  3279. // add the new bytes to the char buffer
  3280. buffer.copy(this.charBuffer, this.charReceived, 0, available);
  3281. this.charReceived += available;
  3282. if (this.charReceived < this.charLength) {
  3283. // still not enough chars in this buffer? wait for more ...
  3284. return '';
  3285. }
  3286. // remove bytes belonging to the current character from the buffer
  3287. buffer = buffer.slice(available, buffer.length);
  3288. // get the character that was split
  3289. charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding);
  3290. // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
  3291. var charCode = charStr.charCodeAt(charStr.length - 1);
  3292. if (charCode >= 0xD800 && charCode <= 0xDBFF) {
  3293. this.charLength += this.surrogateSize;
  3294. charStr = '';
  3295. continue;
  3296. }
  3297. this.charReceived = this.charLength = 0;
  3298. // if there are no more bytes in this buffer, just emit our char
  3299. if (buffer.length === 0) {
  3300. return charStr;
  3301. }
  3302. break;
  3303. }
  3304. // determine and set charLength / charReceived
  3305. this.detectIncompleteChar(buffer);
  3306. var end = buffer.length;
  3307. if (this.charLength) {
  3308. // buffer the incomplete character bytes we got
  3309. buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end);
  3310. end -= this.charReceived;
  3311. }
  3312. charStr += buffer.toString(this.encoding, 0, end);
  3313. var end = charStr.length - 1;
  3314. var charCode = charStr.charCodeAt(end);
  3315. // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
  3316. if (charCode >= 0xD800 && charCode <= 0xDBFF) {
  3317. var size = this.surrogateSize;
  3318. this.charLength += size;
  3319. this.charReceived += size;
  3320. this.charBuffer.copy(this.charBuffer, size, 0, size);
  3321. buffer.copy(this.charBuffer, 0, 0, size);
  3322. return charStr.substring(0, end);
  3323. }
  3324. // or just emit the charStr
  3325. return charStr;
  3326. };
  3327. // detectIncompleteChar determines if there is an incomplete UTF-8 character at
  3328. // the end of the given buffer. If so, it sets this.charLength to the byte
  3329. // length that character, and sets this.charReceived to the number of bytes
  3330. // that are available for this character.
  3331. StringDecoder.prototype.detectIncompleteChar = function(buffer) {
  3332. // determine how many bytes we have to check at the end of this buffer
  3333. var i = (buffer.length >= 3) ? 3 : buffer.length;
  3334. // Figure out if one of the last i bytes of our buffer announces an
  3335. // incomplete char.
  3336. for (; i > 0; i--) {
  3337. var c = buffer[buffer.length - i];
  3338. // See http://en.wikipedia.org/wiki/UTF-8#Description
  3339. // 110XXXXX
  3340. if (i == 1 && c >> 5 == 0x06) {
  3341. this.charLength = 2;
  3342. break;
  3343. }
  3344. // 1110XXXX
  3345. if (i <= 2 && c >> 4 == 0x0E) {
  3346. this.charLength = 3;
  3347. break;
  3348. }
  3349. // 11110XXX
  3350. if (i <= 3 && c >> 3 == 0x1E) {
  3351. this.charLength = 4;
  3352. break;
  3353. }
  3354. }
  3355. this.charReceived = i;
  3356. };
  3357. StringDecoder.prototype.end = function(buffer) {
  3358. var res = '';
  3359. if (buffer && buffer.length)
  3360. res = this.write(buffer);
  3361. if (this.charReceived) {
  3362. var cr = this.charReceived;
  3363. var buf = this.charBuffer;
  3364. var enc = this.encoding;
  3365. res += buf.slice(0, cr).toString(enc);
  3366. }
  3367. return res;
  3368. };
  3369. function passThroughWrite(buffer) {
  3370. return buffer.toString(this.encoding);
  3371. }
  3372. function utf16DetectIncompleteChar(buffer) {
  3373. this.charReceived = buffer.length % 2;
  3374. this.charLength = this.charReceived ? 2 : 0;
  3375. }
  3376. function base64DetectIncompleteChar(buffer) {
  3377. this.charReceived = buffer.length % 3;
  3378. this.charLength = this.charReceived ? 3 : 0;
  3379. }
  3380. /***/ }),
  3381. /* 15 */
  3382. /***/ (function(module, exports, __webpack_require__) {
  3383. "use strict";
  3384. /* WEBPACK VAR INJECTION */(function(Buffer) {
  3385. var createHash = __webpack_require__(29);
  3386. var inherits = __webpack_require__(1)
  3387. var Transform = __webpack_require__(6).Transform
  3388. var ZEROS = new Buffer(128)
  3389. ZEROS.fill(0)
  3390. function Hmac(alg, key) {
  3391. Transform.call(this)
  3392. alg = alg.toLowerCase()
  3393. if (typeof key === 'string') {
  3394. key = new Buffer(key)
  3395. }
  3396. var blocksize = (alg === 'sha512' || alg === 'sha384') ? 128 : 64
  3397. this._alg = alg
  3398. this._key = key
  3399. if (key.length > blocksize) {
  3400. key = createHash(alg).update(key).digest()
  3401. } else if (key.length < blocksize) {
  3402. key = Buffer.concat([key, ZEROS], blocksize)
  3403. }
  3404. var ipad = this._ipad = new Buffer(blocksize)
  3405. var opad = this._opad = new Buffer(blocksize)
  3406. for (var i = 0; i < blocksize; i++) {
  3407. ipad[i] = key[i] ^ 0x36
  3408. opad[i] = key[i] ^ 0x5C
  3409. }
  3410. this._hash = createHash(alg).update(ipad)
  3411. }
  3412. inherits(Hmac, Transform)
  3413. Hmac.prototype.update = function (data, enc) {
  3414. this._hash.update(data, enc)
  3415. return this
  3416. }
  3417. Hmac.prototype._transform = function (data, _, next) {
  3418. this._hash.update(data)
  3419. next()
  3420. }
  3421. Hmac.prototype._flush = function (next) {
  3422. this.push(this.digest())
  3423. next()
  3424. }
  3425. Hmac.prototype.digest = function (enc) {
  3426. var h = this._hash.digest()
  3427. return createHash(this._alg).update(this._opad).update(h).digest(enc)
  3428. }
  3429. module.exports = function createHmac(alg, key) {
  3430. return new Hmac(alg, key)
  3431. }
  3432. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  3433. /***/ }),
  3434. /* 16 */
  3435. /***/ (function(module, exports) {
  3436. var toString = {}.toString;
  3437. module.exports = Array.isArray || function (arr) {
  3438. return toString.call(arr) == '[object Array]';
  3439. };
  3440. /***/ }),
  3441. /* 17 */
  3442. /***/ (function(module, exports, __webpack_require__) {
  3443. var apply = Function.prototype.apply;
  3444. // DOM APIs, for completeness
  3445. exports.setTimeout = function() {
  3446. return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);
  3447. };
  3448. exports.setInterval = function() {
  3449. return new Timeout(apply.call(setInterval, window, arguments), clearInterval);
  3450. };
  3451. exports.clearTimeout =
  3452. exports.clearInterval = function(timeout) {
  3453. if (timeout) {
  3454. timeout.close();
  3455. }
  3456. };
  3457. function Timeout(id, clearFn) {
  3458. this._id = id;
  3459. this._clearFn = clearFn;
  3460. }
  3461. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  3462. Timeout.prototype.close = function() {
  3463. this._clearFn.call(window, this._id);
  3464. };
  3465. // Does not start the time, just sets up the members needed.
  3466. exports.enroll = function(item, msecs) {
  3467. clearTimeout(item._idleTimeoutId);
  3468. item._idleTimeout = msecs;
  3469. };
  3470. exports.unenroll = function(item) {
  3471. clearTimeout(item._idleTimeoutId);
  3472. item._idleTimeout = -1;
  3473. };
  3474. exports._unrefActive = exports.active = function(item) {
  3475. clearTimeout(item._idleTimeoutId);
  3476. var msecs = item._idleTimeout;
  3477. if (msecs >= 0) {
  3478. item._idleTimeoutId = setTimeout(function onTimeout() {
  3479. if (item._onTimeout)
  3480. item._onTimeout();
  3481. }, msecs);
  3482. }
  3483. };
  3484. // setimmediate attaches itself to the global object
  3485. __webpack_require__(43);
  3486. exports.setImmediate = setImmediate;
  3487. exports.clearImmediate = clearImmediate;
  3488. /***/ }),
  3489. /* 18 */
  3490. /***/ (function(module, exports, __webpack_require__) {
  3491. "use strict";
  3492. module.exports = typeof Promise === 'function' ? Promise : __webpack_require__(35);
  3493. /***/ }),
  3494. /* 19 */
  3495. /***/ (function(module, exports, __webpack_require__) {
  3496. "use strict";
  3497. // a passthrough stream.
  3498. // basically just the most minimal sort of Transform stream.
  3499. // Every written chunk gets output as-is.
  3500. module.exports = PassThrough;
  3501. var Transform = __webpack_require__(12);
  3502. /*<replacement>*/
  3503. var util = __webpack_require__(5);
  3504. util.inherits = __webpack_require__(1);
  3505. /*</replacement>*/
  3506. util.inherits(PassThrough, Transform);
  3507. function PassThrough(options) {
  3508. if (!(this instanceof PassThrough)) return new PassThrough(options);
  3509. Transform.call(this, options);
  3510. }
  3511. PassThrough.prototype._transform = function (chunk, encoding, cb) {
  3512. cb(null, chunk);
  3513. };
  3514. /***/ }),
  3515. /* 20 */
  3516. /***/ (function(module, exports, __webpack_require__) {
  3517. "use strict";
  3518. /* WEBPACK VAR INJECTION */(function(process) {
  3519. module.exports = Readable;
  3520. /*<replacement>*/
  3521. var processNextTick = __webpack_require__(11);
  3522. /*</replacement>*/
  3523. /*<replacement>*/
  3524. var isArray = __webpack_require__(16);
  3525. /*</replacement>*/
  3526. /*<replacement>*/
  3527. var Duplex;
  3528. /*</replacement>*/
  3529. Readable.ReadableState = ReadableState;
  3530. /*<replacement>*/
  3531. var EE = __webpack_require__(8).EventEmitter;
  3532. var EElistenerCount = function (emitter, type) {
  3533. return emitter.listeners(type).length;
  3534. };
  3535. /*</replacement>*/
  3536. /*<replacement>*/
  3537. var Stream;
  3538. (function () {
  3539. try {
  3540. Stream = __webpack_require__(6);
  3541. } catch (_) {} finally {
  3542. if (!Stream) Stream = __webpack_require__(8).EventEmitter;
  3543. }
  3544. })();
  3545. /*</replacement>*/
  3546. var Buffer = __webpack_require__(0).Buffer;
  3547. /*<replacement>*/
  3548. var bufferShim = __webpack_require__(10);
  3549. /*</replacement>*/
  3550. /*<replacement>*/
  3551. var util = __webpack_require__(5);
  3552. util.inherits = __webpack_require__(1);
  3553. /*</replacement>*/
  3554. /*<replacement>*/
  3555. var debugUtil = __webpack_require__(51);
  3556. var debug = void 0;
  3557. if (debugUtil && debugUtil.debuglog) {
  3558. debug = debugUtil.debuglog('stream');
  3559. } else {
  3560. debug = function () {};
  3561. }
  3562. /*</replacement>*/
  3563. var BufferList = __webpack_require__(37);
  3564. var StringDecoder;
  3565. util.inherits(Readable, Stream);
  3566. function prependListener(emitter, event, fn) {
  3567. // Sadly this is not cacheable as some libraries bundle their own
  3568. // event emitter implementation with them.
  3569. if (typeof emitter.prependListener === 'function') {
  3570. return emitter.prependListener(event, fn);
  3571. } else {
  3572. // This is a hack to make sure that our error handler is attached before any
  3573. // userland ones. NEVER DO THIS. This is here only because this code needs
  3574. // to continue to work with older versions of Node.js that do not include
  3575. // the prependListener() method. The goal is to eventually remove this hack.
  3576. if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];
  3577. }
  3578. }
  3579. function ReadableState(options, stream) {
  3580. Duplex = Duplex || __webpack_require__(2);
  3581. options = options || {};
  3582. // object stream flag. Used to make read(n) ignore n and to
  3583. // make all the buffer merging and length checks go away
  3584. this.objectMode = !!options.objectMode;
  3585. if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
  3586. // the point at which it stops calling _read() to fill the buffer
  3587. // Note: 0 is a valid value, means "don't call _read preemptively ever"
  3588. var hwm = options.highWaterMark;
  3589. var defaultHwm = this.objectMode ? 16 : 16 * 1024;
  3590. this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm;
  3591. // cast to ints.
  3592. this.highWaterMark = ~ ~this.highWaterMark;
  3593. // A linked list is used to store data chunks instead of an array because the
  3594. // linked list can remove elements from the beginning faster than
  3595. // array.shift()
  3596. this.buffer = new BufferList();
  3597. this.length = 0;
  3598. this.pipes = null;
  3599. this.pipesCount = 0;
  3600. this.flowing = null;
  3601. this.ended = false;
  3602. this.endEmitted = false;
  3603. this.reading = false;
  3604. // a flag to be able to tell if the onwrite cb is called immediately,
  3605. // or on a later tick. We set this to true at first, because any
  3606. // actions that shouldn't happen until "later" should generally also
  3607. // not happen before the first write call.
  3608. this.sync = true;
  3609. // whenever we return null, then we set a flag to say
  3610. // that we're awaiting a 'readable' event emission.
  3611. this.needReadable = false;
  3612. this.emittedReadable = false;
  3613. this.readableListening = false;
  3614. this.resumeScheduled = false;
  3615. // Crypto is kind of old and crusty. Historically, its default string
  3616. // encoding is 'binary' so we have to make this configurable.
  3617. // Everything else in the universe uses 'utf8', though.
  3618. this.defaultEncoding = options.defaultEncoding || 'utf8';
  3619. // when piping, we only care about 'readable' events that happen
  3620. // after read()ing all the bytes and not getting any pushback.
  3621. this.ranOut = false;
  3622. // the number of writers that are awaiting a drain event in .pipe()s
  3623. this.awaitDrain = 0;
  3624. // if true, a maybeReadMore has been scheduled
  3625. this.readingMore = false;
  3626. this.decoder = null;
  3627. this.encoding = null;
  3628. if (options.encoding) {
  3629. if (!StringDecoder) StringDecoder = __webpack_require__(14).StringDecoder;
  3630. this.decoder = new StringDecoder(options.encoding);
  3631. this.encoding = options.encoding;
  3632. }
  3633. }
  3634. function Readable(options) {
  3635. Duplex = Duplex || __webpack_require__(2);
  3636. if (!(this instanceof Readable)) return new Readable(options);
  3637. this._readableState = new ReadableState(options, this);
  3638. // legacy
  3639. this.readable = true;
  3640. if (options && typeof options.read === 'function') this._read = options.read;
  3641. Stream.call(this);
  3642. }
  3643. // Manually shove something into the read() buffer.
  3644. // This returns true if the highWaterMark has not been hit yet,
  3645. // similar to how Writable.write() returns true if you should
  3646. // write() some more.
  3647. Readable.prototype.push = function (chunk, encoding) {
  3648. var state = this._readableState;
  3649. if (!state.objectMode && typeof chunk === 'string') {
  3650. encoding = encoding || state.defaultEncoding;
  3651. if (encoding !== state.encoding) {
  3652. chunk = bufferShim.from(chunk, encoding);
  3653. encoding = '';
  3654. }
  3655. }
  3656. return readableAddChunk(this, state, chunk, encoding, false);
  3657. };
  3658. // Unshift should *always* be something directly out of read()
  3659. Readable.prototype.unshift = function (chunk) {
  3660. var state = this._readableState;
  3661. return readableAddChunk(this, state, chunk, '', true);
  3662. };
  3663. Readable.prototype.isPaused = function () {
  3664. return this._readableState.flowing === false;
  3665. };
  3666. function readableAddChunk(stream, state, chunk, encoding, addToFront) {
  3667. var er = chunkInvalid(state, chunk);
  3668. if (er) {
  3669. stream.emit('error', er);
  3670. } else if (chunk === null) {
  3671. state.reading = false;
  3672. onEofChunk(stream, state);
  3673. } else if (state.objectMode || chunk && chunk.length > 0) {
  3674. if (state.ended && !addToFront) {
  3675. var e = new Error('stream.push() after EOF');
  3676. stream.emit('error', e);
  3677. } else if (state.endEmitted && addToFront) {
  3678. var _e = new Error('stream.unshift() after end event');
  3679. stream.emit('error', _e);
  3680. } else {
  3681. var skipAdd;
  3682. if (state.decoder && !addToFront && !encoding) {
  3683. chunk = state.decoder.write(chunk);
  3684. skipAdd = !state.objectMode && chunk.length === 0;
  3685. }
  3686. if (!addToFront) state.reading = false;
  3687. // Don't add to the buffer if we've decoded to an empty string chunk and
  3688. // we're not in object mode
  3689. if (!skipAdd) {
  3690. // if we want the data now, just emit it.
  3691. if (state.flowing && state.length === 0 && !state.sync) {
  3692. stream.emit('data', chunk);
  3693. stream.read(0);
  3694. } else {
  3695. // update the buffer info.
  3696. state.length += state.objectMode ? 1 : chunk.length;
  3697. if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
  3698. if (state.needReadable) emitReadable(stream);
  3699. }
  3700. }
  3701. maybeReadMore(stream, state);
  3702. }
  3703. } else if (!addToFront) {
  3704. state.reading = false;
  3705. }
  3706. return needMoreData(state);
  3707. }
  3708. // if it's past the high water mark, we can push in some more.
  3709. // Also, if we have no data yet, we can stand some
  3710. // more bytes. This is to work around cases where hwm=0,
  3711. // such as the repl. Also, if the push() triggered a
  3712. // readable event, and the user called read(largeNumber) such that
  3713. // needReadable was set, then we ought to push more, so that another
  3714. // 'readable' event will be triggered.
  3715. function needMoreData(state) {
  3716. return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
  3717. }
  3718. // backwards compatibility.
  3719. Readable.prototype.setEncoding = function (enc) {
  3720. if (!StringDecoder) StringDecoder = __webpack_require__(14).StringDecoder;
  3721. this._readableState.decoder = new StringDecoder(enc);
  3722. this._readableState.encoding = enc;
  3723. return this;
  3724. };
  3725. // Don't raise the hwm > 8MB
  3726. var MAX_HWM = 0x800000;
  3727. function computeNewHighWaterMark(n) {
  3728. if (n >= MAX_HWM) {
  3729. n = MAX_HWM;
  3730. } else {
  3731. // Get the next highest power of 2 to prevent increasing hwm excessively in
  3732. // tiny amounts
  3733. n--;
  3734. n |= n >>> 1;
  3735. n |= n >>> 2;
  3736. n |= n >>> 4;
  3737. n |= n >>> 8;
  3738. n |= n >>> 16;
  3739. n++;
  3740. }
  3741. return n;
  3742. }
  3743. // This function is designed to be inlinable, so please take care when making
  3744. // changes to the function body.
  3745. function howMuchToRead(n, state) {
  3746. if (n <= 0 || state.length === 0 && state.ended) return 0;
  3747. if (state.objectMode) return 1;
  3748. if (n !== n) {
  3749. // Only flow one buffer at a time
  3750. if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
  3751. }
  3752. // If we're asking for more than the current hwm, then raise the hwm.
  3753. if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
  3754. if (n <= state.length) return n;
  3755. // Don't have enough
  3756. if (!state.ended) {
  3757. state.needReadable = true;
  3758. return 0;
  3759. }
  3760. return state.length;
  3761. }
  3762. // you can override either this method, or the async _read(n) below.
  3763. Readable.prototype.read = function (n) {
  3764. debug('read', n);
  3765. n = parseInt(n, 10);
  3766. var state = this._readableState;
  3767. var nOrig = n;
  3768. if (n !== 0) state.emittedReadable = false;
  3769. // if we're doing read(0) to trigger a readable event, but we
  3770. // already have a bunch of data in the buffer, then just trigger
  3771. // the 'readable' event and move on.
  3772. if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
  3773. debug('read: emitReadable', state.length, state.ended);
  3774. if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
  3775. return null;
  3776. }
  3777. n = howMuchToRead(n, state);
  3778. // if we've ended, and we're now clear, then finish it up.
  3779. if (n === 0 && state.ended) {
  3780. if (state.length === 0) endReadable(this);
  3781. return null;
  3782. }
  3783. // All the actual chunk generation logic needs to be
  3784. // *below* the call to _read. The reason is that in certain
  3785. // synthetic stream cases, such as passthrough streams, _read
  3786. // may be a completely synchronous operation which may change
  3787. // the state of the read buffer, providing enough data when
  3788. // before there was *not* enough.
  3789. //
  3790. // So, the steps are:
  3791. // 1. Figure out what the state of things will be after we do
  3792. // a read from the buffer.
  3793. //
  3794. // 2. If that resulting state will trigger a _read, then call _read.
  3795. // Note that this may be asynchronous, or synchronous. Yes, it is
  3796. // deeply ugly to write APIs this way, but that still doesn't mean
  3797. // that the Readable class should behave improperly, as streams are
  3798. // designed to be sync/async agnostic.
  3799. // Take note if the _read call is sync or async (ie, if the read call
  3800. // has returned yet), so that we know whether or not it's safe to emit
  3801. // 'readable' etc.
  3802. //
  3803. // 3. Actually pull the requested chunks out of the buffer and return.
  3804. // if we need a readable event, then we need to do some reading.
  3805. var doRead = state.needReadable;
  3806. debug('need readable', doRead);
  3807. // if we currently have less than the highWaterMark, then also read some
  3808. if (state.length === 0 || state.length - n < state.highWaterMark) {
  3809. doRead = true;
  3810. debug('length less than watermark', doRead);
  3811. }
  3812. // however, if we've ended, then there's no point, and if we're already
  3813. // reading, then it's unnecessary.
  3814. if (state.ended || state.reading) {
  3815. doRead = false;
  3816. debug('reading or ended', doRead);
  3817. } else if (doRead) {
  3818. debug('do read');
  3819. state.reading = true;
  3820. state.sync = true;
  3821. // if the length is currently zero, then we *need* a readable event.
  3822. if (state.length === 0) state.needReadable = true;
  3823. // call internal read method
  3824. this._read(state.highWaterMark);
  3825. state.sync = false;
  3826. // If _read pushed data synchronously, then `reading` will be false,
  3827. // and we need to re-evaluate how much data we can return to the user.
  3828. if (!state.reading) n = howMuchToRead(nOrig, state);
  3829. }
  3830. var ret;
  3831. if (n > 0) ret = fromList(n, state);else ret = null;
  3832. if (ret === null) {
  3833. state.needReadable = true;
  3834. n = 0;
  3835. } else {
  3836. state.length -= n;
  3837. }
  3838. if (state.length === 0) {
  3839. // If we have nothing in the buffer, then we want to know
  3840. // as soon as we *do* get something into the buffer.
  3841. if (!state.ended) state.needReadable = true;
  3842. // If we tried to read() past the EOF, then emit end on the next tick.
  3843. if (nOrig !== n && state.ended) endReadable(this);
  3844. }
  3845. if (ret !== null) this.emit('data', ret);
  3846. return ret;
  3847. };
  3848. function chunkInvalid(state, chunk) {
  3849. var er = null;
  3850. if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== null && chunk !== undefined && !state.objectMode) {
  3851. er = new TypeError('Invalid non-string/buffer chunk');
  3852. }
  3853. return er;
  3854. }
  3855. function onEofChunk(stream, state) {
  3856. if (state.ended) return;
  3857. if (state.decoder) {
  3858. var chunk = state.decoder.end();
  3859. if (chunk && chunk.length) {
  3860. state.buffer.push(chunk);
  3861. state.length += state.objectMode ? 1 : chunk.length;
  3862. }
  3863. }
  3864. state.ended = true;
  3865. // emit 'readable' now to make sure it gets picked up.
  3866. emitReadable(stream);
  3867. }
  3868. // Don't emit readable right away in sync mode, because this can trigger
  3869. // another read() call => stack overflow. This way, it might trigger
  3870. // a nextTick recursion warning, but that's not so bad.
  3871. function emitReadable(stream) {
  3872. var state = stream._readableState;
  3873. state.needReadable = false;
  3874. if (!state.emittedReadable) {
  3875. debug('emitReadable', state.flowing);
  3876. state.emittedReadable = true;
  3877. if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);
  3878. }
  3879. }
  3880. function emitReadable_(stream) {
  3881. debug('emit readable');
  3882. stream.emit('readable');
  3883. flow(stream);
  3884. }
  3885. // at this point, the user has presumably seen the 'readable' event,
  3886. // and called read() to consume some data. that may have triggered
  3887. // in turn another _read(n) call, in which case reading = true if
  3888. // it's in progress.
  3889. // However, if we're not ended, or reading, and the length < hwm,
  3890. // then go ahead and try to read some more preemptively.
  3891. function maybeReadMore(stream, state) {
  3892. if (!state.readingMore) {
  3893. state.readingMore = true;
  3894. processNextTick(maybeReadMore_, stream, state);
  3895. }
  3896. }
  3897. function maybeReadMore_(stream, state) {
  3898. var len = state.length;
  3899. while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
  3900. debug('maybeReadMore read 0');
  3901. stream.read(0);
  3902. if (len === state.length)
  3903. // didn't get any data, stop spinning.
  3904. break;else len = state.length;
  3905. }
  3906. state.readingMore = false;
  3907. }
  3908. // abstract method. to be overridden in specific implementation classes.
  3909. // call cb(er, data) where data is <= n in length.
  3910. // for virtual (non-string, non-buffer) streams, "length" is somewhat
  3911. // arbitrary, and perhaps not very meaningful.
  3912. Readable.prototype._read = function (n) {
  3913. this.emit('error', new Error('_read() is not implemented'));
  3914. };
  3915. Readable.prototype.pipe = function (dest, pipeOpts) {
  3916. var src = this;
  3917. var state = this._readableState;
  3918. switch (state.pipesCount) {
  3919. case 0:
  3920. state.pipes = dest;
  3921. break;
  3922. case 1:
  3923. state.pipes = [state.pipes, dest];
  3924. break;
  3925. default:
  3926. state.pipes.push(dest);
  3927. break;
  3928. }
  3929. state.pipesCount += 1;
  3930. debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
  3931. var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
  3932. var endFn = doEnd ? onend : cleanup;
  3933. if (state.endEmitted) processNextTick(endFn);else src.once('end', endFn);
  3934. dest.on('unpipe', onunpipe);
  3935. function onunpipe(readable) {
  3936. debug('onunpipe');
  3937. if (readable === src) {
  3938. cleanup();
  3939. }
  3940. }
  3941. function onend() {
  3942. debug('onend');
  3943. dest.end();
  3944. }
  3945. // when the dest drains, it reduces the awaitDrain counter
  3946. // on the source. This would be more elegant with a .once()
  3947. // handler in flow(), but adding and removing repeatedly is
  3948. // too slow.
  3949. var ondrain = pipeOnDrain(src);
  3950. dest.on('drain', ondrain);
  3951. var cleanedUp = false;
  3952. function cleanup() {
  3953. debug('cleanup');
  3954. // cleanup event handlers once the pipe is broken
  3955. dest.removeListener('close', onclose);
  3956. dest.removeListener('finish', onfinish);
  3957. dest.removeListener('drain', ondrain);
  3958. dest.removeListener('error', onerror);
  3959. dest.removeListener('unpipe', onunpipe);
  3960. src.removeListener('end', onend);
  3961. src.removeListener('end', cleanup);
  3962. src.removeListener('data', ondata);
  3963. cleanedUp = true;
  3964. // if the reader is waiting for a drain event from this
  3965. // specific writer, then it would cause it to never start
  3966. // flowing again.
  3967. // So, if this is awaiting a drain, then we just call it now.
  3968. // If we don't know, then assume that we are waiting for one.
  3969. if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
  3970. }
  3971. // If the user pushes more data while we're writing to dest then we'll end up
  3972. // in ondata again. However, we only want to increase awaitDrain once because
  3973. // dest will only emit one 'drain' event for the multiple writes.
  3974. // => Introduce a guard on increasing awaitDrain.
  3975. var increasedAwaitDrain = false;
  3976. src.on('data', ondata);
  3977. function ondata(chunk) {
  3978. debug('ondata');
  3979. increasedAwaitDrain = false;
  3980. var ret = dest.write(chunk);
  3981. if (false === ret && !increasedAwaitDrain) {
  3982. // If the user unpiped during `dest.write()`, it is possible
  3983. // to get stuck in a permanently paused state if that write
  3984. // also returned false.
  3985. // => Check whether `dest` is still a piping destination.
  3986. if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
  3987. debug('false write response, pause', src._readableState.awaitDrain);
  3988. src._readableState.awaitDrain++;
  3989. increasedAwaitDrain = true;
  3990. }
  3991. src.pause();
  3992. }
  3993. }
  3994. // if the dest has an error, then stop piping into it.
  3995. // however, don't suppress the throwing behavior for this.
  3996. function onerror(er) {
  3997. debug('onerror', er);
  3998. unpipe();
  3999. dest.removeListener('error', onerror);
  4000. if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
  4001. }
  4002. // Make sure our error handler is attached before userland ones.
  4003. prependListener(dest, 'error', onerror);
  4004. // Both close and finish should trigger unpipe, but only once.
  4005. function onclose() {
  4006. dest.removeListener('finish', onfinish);
  4007. unpipe();
  4008. }
  4009. dest.once('close', onclose);
  4010. function onfinish() {
  4011. debug('onfinish');
  4012. dest.removeListener('close', onclose);
  4013. unpipe();
  4014. }
  4015. dest.once('finish', onfinish);
  4016. function unpipe() {
  4017. debug('unpipe');
  4018. src.unpipe(dest);
  4019. }
  4020. // tell the dest that it's being piped to
  4021. dest.emit('pipe', src);
  4022. // start the flow if it hasn't been started already.
  4023. if (!state.flowing) {
  4024. debug('pipe resume');
  4025. src.resume();
  4026. }
  4027. return dest;
  4028. };
  4029. function pipeOnDrain(src) {
  4030. return function () {
  4031. var state = src._readableState;
  4032. debug('pipeOnDrain', state.awaitDrain);
  4033. if (state.awaitDrain) state.awaitDrain--;
  4034. if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
  4035. state.flowing = true;
  4036. flow(src);
  4037. }
  4038. };
  4039. }
  4040. Readable.prototype.unpipe = function (dest) {
  4041. var state = this._readableState;
  4042. // if we're not piping anywhere, then do nothing.
  4043. if (state.pipesCount === 0) return this;
  4044. // just one destination. most common case.
  4045. if (state.pipesCount === 1) {
  4046. // passed in one, but it's not the right one.
  4047. if (dest && dest !== state.pipes) return this;
  4048. if (!dest) dest = state.pipes;
  4049. // got a match.
  4050. state.pipes = null;
  4051. state.pipesCount = 0;
  4052. state.flowing = false;
  4053. if (dest) dest.emit('unpipe', this);
  4054. return this;
  4055. }
  4056. // slow case. multiple pipe destinations.
  4057. if (!dest) {
  4058. // remove all.
  4059. var dests = state.pipes;
  4060. var len = state.pipesCount;
  4061. state.pipes = null;
  4062. state.pipesCount = 0;
  4063. state.flowing = false;
  4064. for (var i = 0; i < len; i++) {
  4065. dests[i].emit('unpipe', this);
  4066. }return this;
  4067. }
  4068. // try to find the right one.
  4069. var index = indexOf(state.pipes, dest);
  4070. if (index === -1) return this;
  4071. state.pipes.splice(index, 1);
  4072. state.pipesCount -= 1;
  4073. if (state.pipesCount === 1) state.pipes = state.pipes[0];
  4074. dest.emit('unpipe', this);
  4075. return this;
  4076. };
  4077. // set up data events if they are asked for
  4078. // Ensure readable listeners eventually get something
  4079. Readable.prototype.on = function (ev, fn) {
  4080. var res = Stream.prototype.on.call(this, ev, fn);
  4081. if (ev === 'data') {
  4082. // Start flowing on next tick if stream isn't explicitly paused
  4083. if (this._readableState.flowing !== false) this.resume();
  4084. } else if (ev === 'readable') {
  4085. var state = this._readableState;
  4086. if (!state.endEmitted && !state.readableListening) {
  4087. state.readableListening = state.needReadable = true;
  4088. state.emittedReadable = false;
  4089. if (!state.reading) {
  4090. processNextTick(nReadingNextTick, this);
  4091. } else if (state.length) {
  4092. emitReadable(this, state);
  4093. }
  4094. }
  4095. }
  4096. return res;
  4097. };
  4098. Readable.prototype.addListener = Readable.prototype.on;
  4099. function nReadingNextTick(self) {
  4100. debug('readable nexttick read 0');
  4101. self.read(0);
  4102. }
  4103. // pause() and resume() are remnants of the legacy readable stream API
  4104. // If the user uses them, then switch into old mode.
  4105. Readable.prototype.resume = function () {
  4106. var state = this._readableState;
  4107. if (!state.flowing) {
  4108. debug('resume');
  4109. state.flowing = true;
  4110. resume(this, state);
  4111. }
  4112. return this;
  4113. };
  4114. function resume(stream, state) {
  4115. if (!state.resumeScheduled) {
  4116. state.resumeScheduled = true;
  4117. processNextTick(resume_, stream, state);
  4118. }
  4119. }
  4120. function resume_(stream, state) {
  4121. if (!state.reading) {
  4122. debug('resume read 0');
  4123. stream.read(0);
  4124. }
  4125. state.resumeScheduled = false;
  4126. state.awaitDrain = 0;
  4127. stream.emit('resume');
  4128. flow(stream);
  4129. if (state.flowing && !state.reading) stream.read(0);
  4130. }
  4131. Readable.prototype.pause = function () {
  4132. debug('call pause flowing=%j', this._readableState.flowing);
  4133. if (false !== this._readableState.flowing) {
  4134. debug('pause');
  4135. this._readableState.flowing = false;
  4136. this.emit('pause');
  4137. }
  4138. return this;
  4139. };
  4140. function flow(stream) {
  4141. var state = stream._readableState;
  4142. debug('flow', state.flowing);
  4143. while (state.flowing && stream.read() !== null) {}
  4144. }
  4145. // wrap an old-style stream as the async data source.
  4146. // This is *not* part of the readable stream interface.
  4147. // It is an ugly unfortunate mess of history.
  4148. Readable.prototype.wrap = function (stream) {
  4149. var state = this._readableState;
  4150. var paused = false;
  4151. var self = this;
  4152. stream.on('end', function () {
  4153. debug('wrapped end');
  4154. if (state.decoder && !state.ended) {
  4155. var chunk = state.decoder.end();
  4156. if (chunk && chunk.length) self.push(chunk);
  4157. }
  4158. self.push(null);
  4159. });
  4160. stream.on('data', function (chunk) {
  4161. debug('wrapped data');
  4162. if (state.decoder) chunk = state.decoder.write(chunk);
  4163. // don't skip over falsy values in objectMode
  4164. if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
  4165. var ret = self.push(chunk);
  4166. if (!ret) {
  4167. paused = true;
  4168. stream.pause();
  4169. }
  4170. });
  4171. // proxy all the other methods.
  4172. // important when wrapping filters and duplexes.
  4173. for (var i in stream) {
  4174. if (this[i] === undefined && typeof stream[i] === 'function') {
  4175. this[i] = function (method) {
  4176. return function () {
  4177. return stream[method].apply(stream, arguments);
  4178. };
  4179. }(i);
  4180. }
  4181. }
  4182. // proxy certain important events.
  4183. var events = ['error', 'close', 'destroy', 'pause', 'resume'];
  4184. forEach(events, function (ev) {
  4185. stream.on(ev, self.emit.bind(self, ev));
  4186. });
  4187. // when we try to consume some more bytes, simply unpause the
  4188. // underlying stream.
  4189. self._read = function (n) {
  4190. debug('wrapped _read', n);
  4191. if (paused) {
  4192. paused = false;
  4193. stream.resume();
  4194. }
  4195. };
  4196. return self;
  4197. };
  4198. // exposed for testing purposes only.
  4199. Readable._fromList = fromList;
  4200. // Pluck off n bytes from an array of buffers.
  4201. // Length is the combined lengths of all the buffers in the list.
  4202. // This function is designed to be inlinable, so please take care when making
  4203. // changes to the function body.
  4204. function fromList(n, state) {
  4205. // nothing buffered
  4206. if (state.length === 0) return null;
  4207. var ret;
  4208. if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
  4209. // read it all, truncate the list
  4210. if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length);
  4211. state.buffer.clear();
  4212. } else {
  4213. // read part of list
  4214. ret = fromListPartial(n, state.buffer, state.decoder);
  4215. }
  4216. return ret;
  4217. }
  4218. // Extracts only enough buffered data to satisfy the amount requested.
  4219. // This function is designed to be inlinable, so please take care when making
  4220. // changes to the function body.
  4221. function fromListPartial(n, list, hasStrings) {
  4222. var ret;
  4223. if (n < list.head.data.length) {
  4224. // slice is the same for buffers and strings
  4225. ret = list.head.data.slice(0, n);
  4226. list.head.data = list.head.data.slice(n);
  4227. } else if (n === list.head.data.length) {
  4228. // first chunk is a perfect match
  4229. ret = list.shift();
  4230. } else {
  4231. // result spans more than one buffer
  4232. ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
  4233. }
  4234. return ret;
  4235. }
  4236. // Copies a specified amount of characters from the list of buffered data
  4237. // chunks.
  4238. // This function is designed to be inlinable, so please take care when making
  4239. // changes to the function body.
  4240. function copyFromBufferString(n, list) {
  4241. var p = list.head;
  4242. var c = 1;
  4243. var ret = p.data;
  4244. n -= ret.length;
  4245. while (p = p.next) {
  4246. var str = p.data;
  4247. var nb = n > str.length ? str.length : n;
  4248. if (nb === str.length) ret += str;else ret += str.slice(0, n);
  4249. n -= nb;
  4250. if (n === 0) {
  4251. if (nb === str.length) {
  4252. ++c;
  4253. if (p.next) list.head = p.next;else list.head = list.tail = null;
  4254. } else {
  4255. list.head = p;
  4256. p.data = str.slice(nb);
  4257. }
  4258. break;
  4259. }
  4260. ++c;
  4261. }
  4262. list.length -= c;
  4263. return ret;
  4264. }
  4265. // Copies a specified amount of bytes from the list of buffered data chunks.
  4266. // This function is designed to be inlinable, so please take care when making
  4267. // changes to the function body.
  4268. function copyFromBuffer(n, list) {
  4269. var ret = bufferShim.allocUnsafe(n);
  4270. var p = list.head;
  4271. var c = 1;
  4272. p.data.copy(ret);
  4273. n -= p.data.length;
  4274. while (p = p.next) {
  4275. var buf = p.data;
  4276. var nb = n > buf.length ? buf.length : n;
  4277. buf.copy(ret, ret.length - n, 0, nb);
  4278. n -= nb;
  4279. if (n === 0) {
  4280. if (nb === buf.length) {
  4281. ++c;
  4282. if (p.next) list.head = p.next;else list.head = list.tail = null;
  4283. } else {
  4284. list.head = p;
  4285. p.data = buf.slice(nb);
  4286. }
  4287. break;
  4288. }
  4289. ++c;
  4290. }
  4291. list.length -= c;
  4292. return ret;
  4293. }
  4294. function endReadable(stream) {
  4295. var state = stream._readableState;
  4296. // If we get here before consuming all the bytes, then that is a
  4297. // bug in node. Should never happen.
  4298. if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream');
  4299. if (!state.endEmitted) {
  4300. state.ended = true;
  4301. processNextTick(endReadableNT, state, stream);
  4302. }
  4303. }
  4304. function endReadableNT(state, stream) {
  4305. // Check that we didn't get one last unshift.
  4306. if (!state.endEmitted && state.length === 0) {
  4307. state.endEmitted = true;
  4308. stream.readable = false;
  4309. stream.emit('end');
  4310. }
  4311. }
  4312. function forEach(xs, f) {
  4313. for (var i = 0, l = xs.length; i < l; i++) {
  4314. f(xs[i], i);
  4315. }
  4316. }
  4317. function indexOf(xs, x) {
  4318. for (var i = 0, l = xs.length; i < l; i++) {
  4319. if (xs[i] === x) return i;
  4320. }
  4321. return -1;
  4322. }
  4323. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
  4324. /***/ }),
  4325. /* 21 */
  4326. /***/ (function(module, exports, __webpack_require__) {
  4327. /* WEBPACK VAR INJECTION */(function(Buffer) {/**
  4328. * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
  4329. * in FIPS 180-2
  4330. * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009.
  4331. * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
  4332. *
  4333. */
  4334. var inherits = __webpack_require__(1)
  4335. var Hash = __webpack_require__(4)
  4336. var K = [
  4337. 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5,
  4338. 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5,
  4339. 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3,
  4340. 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174,
  4341. 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC,
  4342. 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA,
  4343. 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7,
  4344. 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967,
  4345. 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13,
  4346. 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85,
  4347. 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3,
  4348. 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070,
  4349. 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5,
  4350. 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3,
  4351. 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208,
  4352. 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2
  4353. ]
  4354. var W = new Array(64)
  4355. function Sha256 () {
  4356. this.init()
  4357. this._w = W // new Array(64)
  4358. Hash.call(this, 64, 56)
  4359. }
  4360. inherits(Sha256, Hash)
  4361. Sha256.prototype.init = function () {
  4362. this._a = 0x6a09e667
  4363. this._b = 0xbb67ae85
  4364. this._c = 0x3c6ef372
  4365. this._d = 0xa54ff53a
  4366. this._e = 0x510e527f
  4367. this._f = 0x9b05688c
  4368. this._g = 0x1f83d9ab
  4369. this._h = 0x5be0cd19
  4370. return this
  4371. }
  4372. function ch (x, y, z) {
  4373. return z ^ (x & (y ^ z))
  4374. }
  4375. function maj (x, y, z) {
  4376. return (x & y) | (z & (x | y))
  4377. }
  4378. function sigma0 (x) {
  4379. return (x >>> 2 | x << 30) ^ (x >>> 13 | x << 19) ^ (x >>> 22 | x << 10)
  4380. }
  4381. function sigma1 (x) {
  4382. return (x >>> 6 | x << 26) ^ (x >>> 11 | x << 21) ^ (x >>> 25 | x << 7)
  4383. }
  4384. function gamma0 (x) {
  4385. return (x >>> 7 | x << 25) ^ (x >>> 18 | x << 14) ^ (x >>> 3)
  4386. }
  4387. function gamma1 (x) {
  4388. return (x >>> 17 | x << 15) ^ (x >>> 19 | x << 13) ^ (x >>> 10)
  4389. }
  4390. Sha256.prototype._update = function (M) {
  4391. var W = this._w
  4392. var a = this._a | 0
  4393. var b = this._b | 0
  4394. var c = this._c | 0
  4395. var d = this._d | 0
  4396. var e = this._e | 0
  4397. var f = this._f | 0
  4398. var g = this._g | 0
  4399. var h = this._h | 0
  4400. for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)
  4401. for (; i < 64; ++i) W[i] = (gamma1(W[i - 2]) + W[i - 7] + gamma0(W[i - 15]) + W[i - 16]) | 0
  4402. for (var j = 0; j < 64; ++j) {
  4403. var T1 = (h + sigma1(e) + ch(e, f, g) + K[j] + W[j]) | 0
  4404. var T2 = (sigma0(a) + maj(a, b, c)) | 0
  4405. h = g
  4406. g = f
  4407. f = e
  4408. e = (d + T1) | 0
  4409. d = c
  4410. c = b
  4411. b = a
  4412. a = (T1 + T2) | 0
  4413. }
  4414. this._a = (a + this._a) | 0
  4415. this._b = (b + this._b) | 0
  4416. this._c = (c + this._c) | 0
  4417. this._d = (d + this._d) | 0
  4418. this._e = (e + this._e) | 0
  4419. this._f = (f + this._f) | 0
  4420. this._g = (g + this._g) | 0
  4421. this._h = (h + this._h) | 0
  4422. }
  4423. Sha256.prototype._hash = function () {
  4424. var H = new Buffer(32)
  4425. H.writeInt32BE(this._a, 0)
  4426. H.writeInt32BE(this._b, 4)
  4427. H.writeInt32BE(this._c, 8)
  4428. H.writeInt32BE(this._d, 12)
  4429. H.writeInt32BE(this._e, 16)
  4430. H.writeInt32BE(this._f, 20)
  4431. H.writeInt32BE(this._g, 24)
  4432. H.writeInt32BE(this._h, 28)
  4433. return H
  4434. }
  4435. module.exports = Sha256
  4436. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  4437. /***/ }),
  4438. /* 22 */
  4439. /***/ (function(module, exports, __webpack_require__) {
  4440. /* WEBPACK VAR INJECTION */(function(Buffer) {var inherits = __webpack_require__(1)
  4441. var Hash = __webpack_require__(4)
  4442. var K = [
  4443. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  4444. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  4445. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  4446. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  4447. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  4448. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  4449. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  4450. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  4451. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  4452. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  4453. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  4454. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  4455. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  4456. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  4457. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  4458. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  4459. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  4460. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  4461. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  4462. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  4463. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  4464. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  4465. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  4466. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  4467. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  4468. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  4469. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  4470. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  4471. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  4472. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  4473. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  4474. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  4475. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  4476. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  4477. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  4478. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  4479. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  4480. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  4481. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  4482. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  4483. ]
  4484. var W = new Array(160)
  4485. function Sha512 () {
  4486. this.init()
  4487. this._w = W
  4488. Hash.call(this, 128, 112)
  4489. }
  4490. inherits(Sha512, Hash)
  4491. Sha512.prototype.init = function () {
  4492. this._ah = 0x6a09e667
  4493. this._bh = 0xbb67ae85
  4494. this._ch = 0x3c6ef372
  4495. this._dh = 0xa54ff53a
  4496. this._eh = 0x510e527f
  4497. this._fh = 0x9b05688c
  4498. this._gh = 0x1f83d9ab
  4499. this._hh = 0x5be0cd19
  4500. this._al = 0xf3bcc908
  4501. this._bl = 0x84caa73b
  4502. this._cl = 0xfe94f82b
  4503. this._dl = 0x5f1d36f1
  4504. this._el = 0xade682d1
  4505. this._fl = 0x2b3e6c1f
  4506. this._gl = 0xfb41bd6b
  4507. this._hl = 0x137e2179
  4508. return this
  4509. }
  4510. function Ch (x, y, z) {
  4511. return z ^ (x & (y ^ z))
  4512. }
  4513. function maj (x, y, z) {
  4514. return (x & y) | (z & (x | y))
  4515. }
  4516. function sigma0 (x, xl) {
  4517. return (x >>> 28 | xl << 4) ^ (xl >>> 2 | x << 30) ^ (xl >>> 7 | x << 25)
  4518. }
  4519. function sigma1 (x, xl) {
  4520. return (x >>> 14 | xl << 18) ^ (x >>> 18 | xl << 14) ^ (xl >>> 9 | x << 23)
  4521. }
  4522. function Gamma0 (x, xl) {
  4523. return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7)
  4524. }
  4525. function Gamma0l (x, xl) {
  4526. return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7 | xl << 25)
  4527. }
  4528. function Gamma1 (x, xl) {
  4529. return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6)
  4530. }
  4531. function Gamma1l (x, xl) {
  4532. return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6 | xl << 26)
  4533. }
  4534. function getCarry (a, b) {
  4535. return (a >>> 0) < (b >>> 0) ? 1 : 0
  4536. }
  4537. Sha512.prototype._update = function (M) {
  4538. var W = this._w
  4539. var ah = this._ah | 0
  4540. var bh = this._bh | 0
  4541. var ch = this._ch | 0
  4542. var dh = this._dh | 0
  4543. var eh = this._eh | 0
  4544. var fh = this._fh | 0
  4545. var gh = this._gh | 0
  4546. var hh = this._hh | 0
  4547. var al = this._al | 0
  4548. var bl = this._bl | 0
  4549. var cl = this._cl | 0
  4550. var dl = this._dl | 0
  4551. var el = this._el | 0
  4552. var fl = this._fl | 0
  4553. var gl = this._gl | 0
  4554. var hl = this._hl | 0
  4555. for (var i = 0; i < 32; i += 2) {
  4556. W[i] = M.readInt32BE(i * 4)
  4557. W[i + 1] = M.readInt32BE(i * 4 + 4)
  4558. }
  4559. for (; i < 160; i += 2) {
  4560. var xh = W[i - 15 * 2]
  4561. var xl = W[i - 15 * 2 + 1]
  4562. var gamma0 = Gamma0(xh, xl)
  4563. var gamma0l = Gamma0l(xl, xh)
  4564. xh = W[i - 2 * 2]
  4565. xl = W[i - 2 * 2 + 1]
  4566. var gamma1 = Gamma1(xh, xl)
  4567. var gamma1l = Gamma1l(xl, xh)
  4568. // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]
  4569. var Wi7h = W[i - 7 * 2]
  4570. var Wi7l = W[i - 7 * 2 + 1]
  4571. var Wi16h = W[i - 16 * 2]
  4572. var Wi16l = W[i - 16 * 2 + 1]
  4573. var Wil = (gamma0l + Wi7l) | 0
  4574. var Wih = (gamma0 + Wi7h + getCarry(Wil, gamma0l)) | 0
  4575. Wil = (Wil + gamma1l) | 0
  4576. Wih = (Wih + gamma1 + getCarry(Wil, gamma1l)) | 0
  4577. Wil = (Wil + Wi16l) | 0
  4578. Wih = (Wih + Wi16h + getCarry(Wil, Wi16l)) | 0
  4579. W[i] = Wih
  4580. W[i + 1] = Wil
  4581. }
  4582. for (var j = 0; j < 160; j += 2) {
  4583. Wih = W[j]
  4584. Wil = W[j + 1]
  4585. var majh = maj(ah, bh, ch)
  4586. var majl = maj(al, bl, cl)
  4587. var sigma0h = sigma0(ah, al)
  4588. var sigma0l = sigma0(al, ah)
  4589. var sigma1h = sigma1(eh, el)
  4590. var sigma1l = sigma1(el, eh)
  4591. // t1 = h + sigma1 + ch + K[j] + W[j]
  4592. var Kih = K[j]
  4593. var Kil = K[j + 1]
  4594. var chh = Ch(eh, fh, gh)
  4595. var chl = Ch(el, fl, gl)
  4596. var t1l = (hl + sigma1l) | 0
  4597. var t1h = (hh + sigma1h + getCarry(t1l, hl)) | 0
  4598. t1l = (t1l + chl) | 0
  4599. t1h = (t1h + chh + getCarry(t1l, chl)) | 0
  4600. t1l = (t1l + Kil) | 0
  4601. t1h = (t1h + Kih + getCarry(t1l, Kil)) | 0
  4602. t1l = (t1l + Wil) | 0
  4603. t1h = (t1h + Wih + getCarry(t1l, Wil)) | 0
  4604. // t2 = sigma0 + maj
  4605. var t2l = (sigma0l + majl) | 0
  4606. var t2h = (sigma0h + majh + getCarry(t2l, sigma0l)) | 0
  4607. hh = gh
  4608. hl = gl
  4609. gh = fh
  4610. gl = fl
  4611. fh = eh
  4612. fl = el
  4613. el = (dl + t1l) | 0
  4614. eh = (dh + t1h + getCarry(el, dl)) | 0
  4615. dh = ch
  4616. dl = cl
  4617. ch = bh
  4618. cl = bl
  4619. bh = ah
  4620. bl = al
  4621. al = (t1l + t2l) | 0
  4622. ah = (t1h + t2h + getCarry(al, t1l)) | 0
  4623. }
  4624. this._al = (this._al + al) | 0
  4625. this._bl = (this._bl + bl) | 0
  4626. this._cl = (this._cl + cl) | 0
  4627. this._dl = (this._dl + dl) | 0
  4628. this._el = (this._el + el) | 0
  4629. this._fl = (this._fl + fl) | 0
  4630. this._gl = (this._gl + gl) | 0
  4631. this._hl = (this._hl + hl) | 0
  4632. this._ah = (this._ah + ah + getCarry(this._al, al)) | 0
  4633. this._bh = (this._bh + bh + getCarry(this._bl, bl)) | 0
  4634. this._ch = (this._ch + ch + getCarry(this._cl, cl)) | 0
  4635. this._dh = (this._dh + dh + getCarry(this._dl, dl)) | 0
  4636. this._eh = (this._eh + eh + getCarry(this._el, el)) | 0
  4637. this._fh = (this._fh + fh + getCarry(this._fl, fl)) | 0
  4638. this._gh = (this._gh + gh + getCarry(this._gl, gl)) | 0
  4639. this._hh = (this._hh + hh + getCarry(this._hl, hl)) | 0
  4640. }
  4641. Sha512.prototype._hash = function () {
  4642. var H = new Buffer(64)
  4643. function writeInt64BE (h, l, offset) {
  4644. H.writeInt32BE(h, offset)
  4645. H.writeInt32BE(l, offset + 4)
  4646. }
  4647. writeInt64BE(this._ah, this._al, 0)
  4648. writeInt64BE(this._bh, this._bl, 8)
  4649. writeInt64BE(this._ch, this._cl, 16)
  4650. writeInt64BE(this._dh, this._dl, 24)
  4651. writeInt64BE(this._eh, this._el, 32)
  4652. writeInt64BE(this._fh, this._fl, 40)
  4653. writeInt64BE(this._gh, this._gl, 48)
  4654. writeInt64BE(this._hh, this._hl, 56)
  4655. return H
  4656. }
  4657. module.exports = Sha512
  4658. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  4659. /***/ }),
  4660. /* 23 */
  4661. /***/ (function(module, exports, __webpack_require__) {
  4662. /* WEBPACK VAR INJECTION */(function(Buffer) {var pbkdf2 = __webpack_require__(9);
  4663. var createHMAC = __webpack_require__(15);
  4664. var Promise = __webpack_require__(18);
  4665. module.exports = {
  4666. encryptLogin: encryptLogin,
  4667. renderPassword: renderPassword,
  4668. createFingerprint: createFingerprint,
  4669. _deriveEncryptedLogin: deriveEncryptedLogin,
  4670. _getPasswordTemplate: getPasswordTemplate,
  4671. _prettyPrint: prettyPrint,
  4672. _string2charCodes: string2charCodes,
  4673. _getCharType: getCharType,
  4674. _getPasswordChar: getPasswordChar,
  4675. _createHmac: createHmac
  4676. };
  4677. function encryptLogin(login, masterPassword, options) {
  4678. var _options = options !== undefined ? options : {};
  4679. var iterations = _options.iterations || 8192;
  4680. var keylen = _options.keylen || 32;
  4681. return pbkdf2(masterPassword, login, iterations, keylen, 'sha256');
  4682. }
  4683. function renderPassword(encryptedLogin, site, passwordOptions) {
  4684. return deriveEncryptedLogin(encryptedLogin, site, passwordOptions).then(function (derivedEncryptedLogin) {
  4685. var template = passwordOptions.template || getPasswordTemplate(passwordOptions);
  4686. return prettyPrint(derivedEncryptedLogin, template);
  4687. });
  4688. }
  4689. function createHmac(encryptedLogin, salt) {
  4690. return new Promise(function (resolve) {
  4691. resolve(createHMAC('sha256', new Buffer(encryptedLogin)).update(salt).digest('hex'));
  4692. });
  4693. }
  4694. function deriveEncryptedLogin(encryptedLogin, site, options) {
  4695. var _options = options !== undefined ? options : {};
  4696. var length = _options.length || 12;
  4697. var counter = _options.counter || 1;
  4698. var salt = site + counter.toString();
  4699. return createHmac(encryptedLogin, salt).then(function (derivedHash) {
  4700. return derivedHash.substring(0, length);
  4701. });
  4702. }
  4703. function getPasswordTemplate(passwordTypes) {
  4704. var templates = {
  4705. lowercase: 'vc',
  4706. uppercase: 'VC',
  4707. numbers: 'n',
  4708. symbols: 's'
  4709. };
  4710. var returnedTemplate = '';
  4711. Object.keys(templates).forEach(function (template) {
  4712. if (passwordTypes.hasOwnProperty(template) && passwordTypes[template]) {
  4713. returnedTemplate += templates[template];
  4714. }
  4715. });
  4716. return returnedTemplate;
  4717. }
  4718. function prettyPrint(hash, template) {
  4719. var password = '';
  4720. string2charCodes(hash).forEach(function (charCode, index) {
  4721. var charType = getCharType(template, index);
  4722. password += getPasswordChar(charType, charCode);
  4723. });
  4724. return password;
  4725. }
  4726. function string2charCodes(text) {
  4727. var charCodes = [];
  4728. for (var i = 0; i < text.length; i++) {
  4729. charCodes.push(text.charCodeAt(i));
  4730. }
  4731. return charCodes;
  4732. }
  4733. function getCharType(template, index) {
  4734. return template[index % template.length];
  4735. }
  4736. function getPasswordChar(charType, index) {
  4737. var passwordsChars = {
  4738. V: 'AEIOUY',
  4739. C: 'BCDFGHJKLMNPQRSTVWXZ',
  4740. v: 'aeiouy',
  4741. c: 'bcdfghjklmnpqrstvwxz',
  4742. A: 'AEIOUYBCDFGHJKLMNPQRSTVWXZ',
  4743. a: 'AEIOUYaeiouyBCDFGHJKLMNPQRSTVWXZbcdfghjklmnpqrstvwxz',
  4744. n: '0123456789',
  4745. s: '@&%?,=[]_:-+*$#!\'^~;()/.',
  4746. x: 'AEIOUYaeiouyBCDFGHJKLMNPQRSTVWXZbcdfghjklmnpqrstvwxz0123456789@&%?,=[]_:-+*$#!\'^~;()/.'
  4747. };
  4748. var passwordChar = passwordsChars[charType];
  4749. return passwordChar[index % passwordChar.length];
  4750. }
  4751. function createFingerprint(str) {
  4752. return new Promise(function (resolve) {
  4753. resolve(createHMAC('sha256', new Buffer(str)).digest('hex'));
  4754. });
  4755. }
  4756. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  4757. /***/ }),
  4758. /* 24 */
  4759. /***/ (function(module, exports, __webpack_require__) {
  4760. var pbkdf2 = __webpack_require__(9);
  4761. var bigInt = __webpack_require__(27);
  4762. module.exports = {
  4763. generatePassword: generatePassword,
  4764. _calcEntropy: calcEntropy,
  4765. _consumeEntropy: consumeEntropy,
  4766. _getSetOfCharacters: getSetOfCharacters,
  4767. _getConfiguredRules: getConfiguredRules,
  4768. _insertStringPseudoRandomly: insertStringPseudoRandomly,
  4769. _getOneCharPerRule: getOneCharPerRule,
  4770. _renderPassword: renderPassword
  4771. };
  4772. function generatePassword(site, login, masterPassword, passwordProfile) {
  4773. return calcEntropy(site, login, masterPassword, passwordProfile).then(function (entropy) {
  4774. return renderPassword(entropy, passwordProfile);
  4775. });
  4776. }
  4777. function calcEntropy(site, login, masterPassword, passwordProfile) {
  4778. var salt = site + login + passwordProfile.counter.toString(16);
  4779. return pbkdf2(masterPassword, salt, passwordProfile.iterations, passwordProfile.keylen, passwordProfile.digest);
  4780. }
  4781. var characterSubsets = {
  4782. lowercase: 'abcdefghijklmnopqrstuvwxyz',
  4783. uppercase: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
  4784. numbers: '0123456789',
  4785. symbols: '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'
  4786. };
  4787. function getSetOfCharacters(rules) {
  4788. if (typeof rules === 'undefined') {
  4789. return characterSubsets.lowercase + characterSubsets.uppercase + characterSubsets.numbers + characterSubsets.symbols;
  4790. }
  4791. var setOfChars = '';
  4792. rules.forEach(function (rule) {
  4793. setOfChars += characterSubsets[rule];
  4794. });
  4795. return setOfChars;
  4796. }
  4797. function consumeEntropy(generatedPassword, quotient, setOfCharacters, maxLength) {
  4798. if (generatedPassword.length >= maxLength) {
  4799. return { value: generatedPassword, entropy: quotient };
  4800. }
  4801. var longDivision = quotient.divmod(setOfCharacters.length);
  4802. generatedPassword += setOfCharacters[longDivision.remainder];
  4803. return consumeEntropy(generatedPassword, longDivision.quotient, setOfCharacters, maxLength);
  4804. }
  4805. function insertStringPseudoRandomly(generatedPassword, entropy, string) {
  4806. for (var i = 0; i < string.length; i++) {
  4807. var longDivision = entropy.divmod(generatedPassword.length);
  4808. generatedPassword = generatedPassword.slice(0, longDivision.remainder) + string[i] + generatedPassword.slice(longDivision.remainder);
  4809. entropy = longDivision.quotient;
  4810. }
  4811. return generatedPassword;
  4812. }
  4813. function getOneCharPerRule(entropy, rules) {
  4814. var oneCharPerRules = '';
  4815. rules.forEach(function (rule) {
  4816. var password = consumeEntropy('', entropy, characterSubsets[rule], 1);
  4817. oneCharPerRules += password.value;
  4818. entropy = password.entropy;
  4819. });
  4820. return { value: oneCharPerRules, entropy: entropy };
  4821. }
  4822. function getConfiguredRules(passwordProfile) {
  4823. return ['lowercase', 'uppercase', 'numbers', 'symbols'].filter(function (rule) {
  4824. return passwordProfile[rule];
  4825. });
  4826. }
  4827. function renderPassword(entropy, passwordProfile) {
  4828. var rules = getConfiguredRules(passwordProfile);
  4829. var setOfCharacters = getSetOfCharacters(rules);
  4830. var password = consumeEntropy('', bigInt(entropy, 16), setOfCharacters, passwordProfile.length - rules.length);
  4831. var charactersToAdd = getOneCharPerRule(password.entropy, rules);
  4832. return insertStringPseudoRandomly(password.value, charactersToAdd.entropy, charactersToAdd.value);
  4833. }
  4834. /***/ }),
  4835. /* 25 */
  4836. /***/ (function(module, exports, __webpack_require__) {
  4837. "use strict";
  4838. /* eslint-disable no-unused-vars */
  4839. var hasOwnProperty = Object.prototype.hasOwnProperty;
  4840. var propIsEnumerable = Object.prototype.propertyIsEnumerable;
  4841. function toObject(val) {
  4842. if (val === null || val === undefined) {
  4843. throw new TypeError('Object.assign cannot be called with null or undefined');
  4844. }
  4845. return Object(val);
  4846. }
  4847. function shouldUseNative() {
  4848. try {
  4849. if (!Object.assign) {
  4850. return false;
  4851. }
  4852. // Detect buggy property enumeration order in older V8 versions.
  4853. // https://bugs.chromium.org/p/v8/issues/detail?id=4118
  4854. var test1 = new String('abc'); // eslint-disable-line
  4855. test1[5] = 'de';
  4856. if (Object.getOwnPropertyNames(test1)[0] === '5') {
  4857. return false;
  4858. }
  4859. // https://bugs.chromium.org/p/v8/issues/detail?id=3056
  4860. var test2 = {};
  4861. for (var i = 0; i < 10; i++) {
  4862. test2['_' + String.fromCharCode(i)] = i;
  4863. }
  4864. var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
  4865. return test2[n];
  4866. });
  4867. if (order2.join('') !== '0123456789') {
  4868. return false;
  4869. }
  4870. // https://bugs.chromium.org/p/v8/issues/detail?id=3056
  4871. var test3 = {};
  4872. 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
  4873. test3[letter] = letter;
  4874. });
  4875. if (Object.keys(Object.assign({}, test3)).join('') !==
  4876. 'abcdefghijklmnopqrst') {
  4877. return false;
  4878. }
  4879. return true;
  4880. } catch (e) {
  4881. // We don't expect any of the above to throw, but better to be safe.
  4882. return false;
  4883. }
  4884. }
  4885. module.exports = shouldUseNative() ? Object.assign : function (target, source) {
  4886. var from;
  4887. var to = toObject(target);
  4888. var symbols;
  4889. for (var s = 1; s < arguments.length; s++) {
  4890. from = Object(arguments[s]);
  4891. for (var key in from) {
  4892. if (hasOwnProperty.call(from, key)) {
  4893. to[key] = from[key];
  4894. }
  4895. }
  4896. if (Object.getOwnPropertySymbols) {
  4897. symbols = Object.getOwnPropertySymbols(from);
  4898. for (var i = 0; i < symbols.length; i++) {
  4899. if (propIsEnumerable.call(from, symbols[i])) {
  4900. to[symbols[i]] = from[symbols[i]];
  4901. }
  4902. }
  4903. }
  4904. }
  4905. return to;
  4906. };
  4907. /***/ }),
  4908. /* 26 */
  4909. /***/ (function(module, exports, __webpack_require__) {
  4910. "use strict";
  4911. exports.byteLength = byteLength
  4912. exports.toByteArray = toByteArray
  4913. exports.fromByteArray = fromByteArray
  4914. var lookup = []
  4915. var revLookup = []
  4916. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  4917. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  4918. for (var i = 0, len = code.length; i < len; ++i) {
  4919. lookup[i] = code[i]
  4920. revLookup[code.charCodeAt(i)] = i
  4921. }
  4922. revLookup['-'.charCodeAt(0)] = 62
  4923. revLookup['_'.charCodeAt(0)] = 63
  4924. function placeHoldersCount (b64) {
  4925. var len = b64.length
  4926. if (len % 4 > 0) {
  4927. throw new Error('Invalid string. Length must be a multiple of 4')
  4928. }
  4929. // the number of equal signs (place holders)
  4930. // if there are two placeholders, than the two characters before it
  4931. // represent one byte
  4932. // if there is only one, then the three characters before it represent 2 bytes
  4933. // this is just a cheap hack to not do indexOf twice
  4934. return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0
  4935. }
  4936. function byteLength (b64) {
  4937. // base64 is 4/3 + up to two characters of the original data
  4938. return b64.length * 3 / 4 - placeHoldersCount(b64)
  4939. }
  4940. function toByteArray (b64) {
  4941. var i, j, l, tmp, placeHolders, arr
  4942. var len = b64.length
  4943. placeHolders = placeHoldersCount(b64)
  4944. arr = new Arr(len * 3 / 4 - placeHolders)
  4945. // if there are placeholders, only get up to the last complete 4 chars
  4946. l = placeHolders > 0 ? len - 4 : len
  4947. var L = 0
  4948. for (i = 0, j = 0; i < l; i += 4, j += 3) {
  4949. tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)]
  4950. arr[L++] = (tmp >> 16) & 0xFF
  4951. arr[L++] = (tmp >> 8) & 0xFF
  4952. arr[L++] = tmp & 0xFF
  4953. }
  4954. if (placeHolders === 2) {
  4955. tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4)
  4956. arr[L++] = tmp & 0xFF
  4957. } else if (placeHolders === 1) {
  4958. tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2)
  4959. arr[L++] = (tmp >> 8) & 0xFF
  4960. arr[L++] = tmp & 0xFF
  4961. }
  4962. return arr
  4963. }
  4964. function tripletToBase64 (num) {
  4965. return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]
  4966. }
  4967. function encodeChunk (uint8, start, end) {
  4968. var tmp
  4969. var output = []
  4970. for (var i = start; i < end; i += 3) {
  4971. tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])
  4972. output.push(tripletToBase64(tmp))
  4973. }
  4974. return output.join('')
  4975. }
  4976. function fromByteArray (uint8) {
  4977. var tmp
  4978. var len = uint8.length
  4979. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  4980. var output = ''
  4981. var parts = []
  4982. var maxChunkLength = 16383 // must be multiple of 3
  4983. // go through the array every three bytes, we'll deal with trailing stuff later
  4984. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  4985. parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
  4986. }
  4987. // pad the end with zeros, but make sure to not forget the extra bytes
  4988. if (extraBytes === 1) {
  4989. tmp = uint8[len - 1]
  4990. output += lookup[tmp >> 2]
  4991. output += lookup[(tmp << 4) & 0x3F]
  4992. output += '=='
  4993. } else if (extraBytes === 2) {
  4994. tmp = (uint8[len - 2] << 8) + (uint8[len - 1])
  4995. output += lookup[tmp >> 10]
  4996. output += lookup[(tmp >> 4) & 0x3F]
  4997. output += lookup[(tmp << 2) & 0x3F]
  4998. output += '='
  4999. }
  5000. parts.push(output)
  5001. return parts.join('')
  5002. }
  5003. /***/ }),
  5004. /* 27 */
  5005. /***/ (function(module, exports, __webpack_require__) {
  5006. /* WEBPACK VAR INJECTION */(function(module) {var bigInt = (function (undefined) {
  5007. "use strict";
  5008. var BASE = 1e7,
  5009. LOG_BASE = 7,
  5010. MAX_INT = 9007199254740992,
  5011. MAX_INT_ARR = smallToArray(MAX_INT),
  5012. LOG_MAX_INT = Math.log(MAX_INT);
  5013. function Integer(v, radix) {
  5014. if (typeof v === "undefined") return Integer[0];
  5015. if (typeof radix !== "undefined") return +radix === 10 ? parseValue(v) : parseBase(v, radix);
  5016. return parseValue(v);
  5017. }
  5018. function BigInteger(value, sign) {
  5019. this.value = value;
  5020. this.sign = sign;
  5021. this.isSmall = false;
  5022. }
  5023. BigInteger.prototype = Object.create(Integer.prototype);
  5024. function SmallInteger(value) {
  5025. this.value = value;
  5026. this.sign = value < 0;
  5027. this.isSmall = true;
  5028. }
  5029. SmallInteger.prototype = Object.create(Integer.prototype);
  5030. function isPrecise(n) {
  5031. return -MAX_INT < n && n < MAX_INT;
  5032. }
  5033. function smallToArray(n) { // For performance reasons doesn't reference BASE, need to change this function if BASE changes
  5034. if (n < 1e7)
  5035. return [n];
  5036. if (n < 1e14)
  5037. return [n % 1e7, Math.floor(n / 1e7)];
  5038. return [n % 1e7, Math.floor(n / 1e7) % 1e7, Math.floor(n / 1e14)];
  5039. }
  5040. function arrayToSmall(arr) { // If BASE changes this function may need to change
  5041. trim(arr);
  5042. var length = arr.length;
  5043. if (length < 4 && compareAbs(arr, MAX_INT_ARR) < 0) {
  5044. switch (length) {
  5045. case 0: return 0;
  5046. case 1: return arr[0];
  5047. case 2: return arr[0] + arr[1] * BASE;
  5048. default: return arr[0] + (arr[1] + arr[2] * BASE) * BASE;
  5049. }
  5050. }
  5051. return arr;
  5052. }
  5053. function trim(v) {
  5054. var i = v.length;
  5055. while (v[--i] === 0);
  5056. v.length = i + 1;
  5057. }
  5058. function createArray(length) { // function shamelessly stolen from Yaffle's library https://github.com/Yaffle/BigInteger
  5059. var x = new Array(length);
  5060. var i = -1;
  5061. while (++i < length) {
  5062. x[i] = 0;
  5063. }
  5064. return x;
  5065. }
  5066. function truncate(n) {
  5067. if (n > 0) return Math.floor(n);
  5068. return Math.ceil(n);
  5069. }
  5070. function add(a, b) { // assumes a and b are arrays with a.length >= b.length
  5071. var l_a = a.length,
  5072. l_b = b.length,
  5073. r = new Array(l_a),
  5074. carry = 0,
  5075. base = BASE,
  5076. sum, i;
  5077. for (i = 0; i < l_b; i++) {
  5078. sum = a[i] + b[i] + carry;
  5079. carry = sum >= base ? 1 : 0;
  5080. r[i] = sum - carry * base;
  5081. }
  5082. while (i < l_a) {
  5083. sum = a[i] + carry;
  5084. carry = sum === base ? 1 : 0;
  5085. r[i++] = sum - carry * base;
  5086. }
  5087. if (carry > 0) r.push(carry);
  5088. return r;
  5089. }
  5090. function addAny(a, b) {
  5091. if (a.length >= b.length) return add(a, b);
  5092. return add(b, a);
  5093. }
  5094. function addSmall(a, carry) { // assumes a is array, carry is number with 0 <= carry < MAX_INT
  5095. var l = a.length,
  5096. r = new Array(l),
  5097. base = BASE,
  5098. sum, i;
  5099. for (i = 0; i < l; i++) {
  5100. sum = a[i] - base + carry;
  5101. carry = Math.floor(sum / base);
  5102. r[i] = sum - carry * base;
  5103. carry += 1;
  5104. }
  5105. while (carry > 0) {
  5106. r[i++] = carry % base;
  5107. carry = Math.floor(carry / base);
  5108. }
  5109. return r;
  5110. }
  5111. BigInteger.prototype.add = function (v) {
  5112. var value, n = parseValue(v);
  5113. if (this.sign !== n.sign) {
  5114. return this.subtract(n.negate());
  5115. }
  5116. var a = this.value, b = n.value;
  5117. if (n.isSmall) {
  5118. return new BigInteger(addSmall(a, Math.abs(b)), this.sign);
  5119. }
  5120. return new BigInteger(addAny(a, b), this.sign);
  5121. };
  5122. BigInteger.prototype.plus = BigInteger.prototype.add;
  5123. SmallInteger.prototype.add = function (v) {
  5124. var n = parseValue(v);
  5125. var a = this.value;
  5126. if (a < 0 !== n.sign) {
  5127. return this.subtract(n.negate());
  5128. }
  5129. var b = n.value;
  5130. if (n.isSmall) {
  5131. if (isPrecise(a + b)) return new SmallInteger(a + b);
  5132. b = smallToArray(Math.abs(b));
  5133. }
  5134. return new BigInteger(addSmall(b, Math.abs(a)), a < 0);
  5135. };
  5136. SmallInteger.prototype.plus = SmallInteger.prototype.add;
  5137. function subtract(a, b) { // assumes a and b are arrays with a >= b
  5138. var a_l = a.length,
  5139. b_l = b.length,
  5140. r = new Array(a_l),
  5141. borrow = 0,
  5142. base = BASE,
  5143. i, difference;
  5144. for (i = 0; i < b_l; i++) {
  5145. difference = a[i] - borrow - b[i];
  5146. if (difference < 0) {
  5147. difference += base;
  5148. borrow = 1;
  5149. } else borrow = 0;
  5150. r[i] = difference;
  5151. }
  5152. for (i = b_l; i < a_l; i++) {
  5153. difference = a[i] - borrow;
  5154. if (difference < 0) difference += base;
  5155. else {
  5156. r[i++] = difference;
  5157. break;
  5158. }
  5159. r[i] = difference;
  5160. }
  5161. for (; i < a_l; i++) {
  5162. r[i] = a[i];
  5163. }
  5164. trim(r);
  5165. return r;
  5166. }
  5167. function subtractAny(a, b, sign) {
  5168. var value, isSmall;
  5169. if (compareAbs(a, b) >= 0) {
  5170. value = subtract(a,b);
  5171. } else {
  5172. value = subtract(b, a);
  5173. sign = !sign;
  5174. }
  5175. value = arrayToSmall(value);
  5176. if (typeof value === "number") {
  5177. if (sign) value = -value;
  5178. return new SmallInteger(value);
  5179. }
  5180. return new BigInteger(value, sign);
  5181. }
  5182. function subtractSmall(a, b, sign) { // assumes a is array, b is number with 0 <= b < MAX_INT
  5183. var l = a.length,
  5184. r = new Array(l),
  5185. carry = -b,
  5186. base = BASE,
  5187. i, difference;
  5188. for (i = 0; i < l; i++) {
  5189. difference = a[i] + carry;
  5190. carry = Math.floor(difference / base);
  5191. difference %= base;
  5192. r[i] = difference < 0 ? difference + base : difference;
  5193. }
  5194. r = arrayToSmall(r);
  5195. if (typeof r === "number") {
  5196. if (sign) r = -r;
  5197. return new SmallInteger(r);
  5198. } return new BigInteger(r, sign);
  5199. }
  5200. BigInteger.prototype.subtract = function (v) {
  5201. var n = parseValue(v);
  5202. if (this.sign !== n.sign) {
  5203. return this.add(n.negate());
  5204. }
  5205. var a = this.value, b = n.value;
  5206. if (n.isSmall)
  5207. return subtractSmall(a, Math.abs(b), this.sign);
  5208. return subtractAny(a, b, this.sign);
  5209. };
  5210. BigInteger.prototype.minus = BigInteger.prototype.subtract;
  5211. SmallInteger.prototype.subtract = function (v) {
  5212. var n = parseValue(v);
  5213. var a = this.value;
  5214. if (a < 0 !== n.sign) {
  5215. return this.add(n.negate());
  5216. }
  5217. var b = n.value;
  5218. if (n.isSmall) {
  5219. return new SmallInteger(a - b);
  5220. }
  5221. return subtractSmall(b, Math.abs(a), a >= 0);
  5222. };
  5223. SmallInteger.prototype.minus = SmallInteger.prototype.subtract;
  5224. BigInteger.prototype.negate = function () {
  5225. return new BigInteger(this.value, !this.sign);
  5226. };
  5227. SmallInteger.prototype.negate = function () {
  5228. var sign = this.sign;
  5229. var small = new SmallInteger(-this.value);
  5230. small.sign = !sign;
  5231. return small;
  5232. };
  5233. BigInteger.prototype.abs = function () {
  5234. return new BigInteger(this.value, false);
  5235. };
  5236. SmallInteger.prototype.abs = function () {
  5237. return new SmallInteger(Math.abs(this.value));
  5238. };
  5239. function multiplyLong(a, b) {
  5240. var a_l = a.length,
  5241. b_l = b.length,
  5242. l = a_l + b_l,
  5243. r = createArray(l),
  5244. base = BASE,
  5245. product, carry, i, a_i, b_j;
  5246. for (i = 0; i < a_l; ++i) {
  5247. a_i = a[i];
  5248. for (var j = 0; j < b_l; ++j) {
  5249. b_j = b[j];
  5250. product = a_i * b_j + r[i + j];
  5251. carry = Math.floor(product / base);
  5252. r[i + j] = product - carry * base;
  5253. r[i + j + 1] += carry;
  5254. }
  5255. }
  5256. trim(r);
  5257. return r;
  5258. }
  5259. function multiplySmall(a, b) { // assumes a is array, b is number with |b| < BASE
  5260. var l = a.length,
  5261. r = new Array(l),
  5262. base = BASE,
  5263. carry = 0,
  5264. product, i;
  5265. for (i = 0; i < l; i++) {
  5266. product = a[i] * b + carry;
  5267. carry = Math.floor(product / base);
  5268. r[i] = product - carry * base;
  5269. }
  5270. while (carry > 0) {
  5271. r[i++] = carry % base;
  5272. carry = Math.floor(carry / base);
  5273. }
  5274. return r;
  5275. }
  5276. function shiftLeft(x, n) {
  5277. var r = [];
  5278. while (n-- > 0) r.push(0);
  5279. return r.concat(x);
  5280. }
  5281. function multiplyKaratsuba(x, y) {
  5282. var n = Math.max(x.length, y.length);
  5283. if (n <= 30) return multiplyLong(x, y);
  5284. n = Math.ceil(n / 2);
  5285. var b = x.slice(n),
  5286. a = x.slice(0, n),
  5287. d = y.slice(n),
  5288. c = y.slice(0, n);
  5289. var ac = multiplyKaratsuba(a, c),
  5290. bd = multiplyKaratsuba(b, d),
  5291. abcd = multiplyKaratsuba(addAny(a, b), addAny(c, d));
  5292. var product = addAny(addAny(ac, shiftLeft(subtract(subtract(abcd, ac), bd), n)), shiftLeft(bd, 2 * n));
  5293. trim(product);
  5294. return product;
  5295. }
  5296. // The following function is derived from a surface fit of a graph plotting the performance difference
  5297. // between long multiplication and karatsuba multiplication versus the lengths of the two arrays.
  5298. function useKaratsuba(l1, l2) {
  5299. return -0.012 * l1 - 0.012 * l2 + 0.000015 * l1 * l2 > 0;
  5300. }
  5301. BigInteger.prototype.multiply = function (v) {
  5302. var value, n = parseValue(v),
  5303. a = this.value, b = n.value,
  5304. sign = this.sign !== n.sign,
  5305. abs;
  5306. if (n.isSmall) {
  5307. if (b === 0) return Integer[0];
  5308. if (b === 1) return this;
  5309. if (b === -1) return this.negate();
  5310. abs = Math.abs(b);
  5311. if (abs < BASE) {
  5312. return new BigInteger(multiplySmall(a, abs), sign);
  5313. }
  5314. b = smallToArray(abs);
  5315. }
  5316. if (useKaratsuba(a.length, b.length)) // Karatsuba is only faster for certain array sizes
  5317. return new BigInteger(multiplyKaratsuba(a, b), sign);
  5318. return new BigInteger(multiplyLong(a, b), sign);
  5319. };
  5320. BigInteger.prototype.times = BigInteger.prototype.multiply;
  5321. function multiplySmallAndArray(a, b, sign) { // a >= 0
  5322. if (a < BASE) {
  5323. return new BigInteger(multiplySmall(b, a), sign);
  5324. }
  5325. return new BigInteger(multiplyLong(b, smallToArray(a)), sign);
  5326. }
  5327. SmallInteger.prototype._multiplyBySmall = function (a) {
  5328. if (isPrecise(a.value * this.value)) {
  5329. return new SmallInteger(a.value * this.value);
  5330. }
  5331. return multiplySmallAndArray(Math.abs(a.value), smallToArray(Math.abs(this.value)), this.sign !== a.sign);
  5332. };
  5333. BigInteger.prototype._multiplyBySmall = function (a) {
  5334. if (a.value === 0) return Integer[0];
  5335. if (a.value === 1) return this;
  5336. if (a.value === -1) return this.negate();
  5337. return multiplySmallAndArray(Math.abs(a.value), this.value, this.sign !== a.sign);
  5338. };
  5339. SmallInteger.prototype.multiply = function (v) {
  5340. return parseValue(v)._multiplyBySmall(this);
  5341. };
  5342. SmallInteger.prototype.times = SmallInteger.prototype.multiply;
  5343. function square(a) {
  5344. var l = a.length,
  5345. r = createArray(l + l),
  5346. base = BASE,
  5347. product, carry, i, a_i, a_j;
  5348. for (i = 0; i < l; i++) {
  5349. a_i = a[i];
  5350. for (var j = 0; j < l; j++) {
  5351. a_j = a[j];
  5352. product = a_i * a_j + r[i + j];
  5353. carry = Math.floor(product / base);
  5354. r[i + j] = product - carry * base;
  5355. r[i + j + 1] += carry;
  5356. }
  5357. }
  5358. trim(r);
  5359. return r;
  5360. }
  5361. BigInteger.prototype.square = function () {
  5362. return new BigInteger(square(this.value), false);
  5363. };
  5364. SmallInteger.prototype.square = function () {
  5365. var value = this.value * this.value;
  5366. if (isPrecise(value)) return new SmallInteger(value);
  5367. return new BigInteger(square(smallToArray(Math.abs(this.value))), false);
  5368. };
  5369. function divMod1(a, b) { // Left over from previous version. Performs faster than divMod2 on smaller input sizes.
  5370. var a_l = a.length,
  5371. b_l = b.length,
  5372. base = BASE,
  5373. result = createArray(b.length),
  5374. divisorMostSignificantDigit = b[b_l - 1],
  5375. // normalization
  5376. lambda = Math.ceil(base / (2 * divisorMostSignificantDigit)),
  5377. remainder = multiplySmall(a, lambda),
  5378. divisor = multiplySmall(b, lambda),
  5379. quotientDigit, shift, carry, borrow, i, l, q;
  5380. if (remainder.length <= a_l) remainder.push(0);
  5381. divisor.push(0);
  5382. divisorMostSignificantDigit = divisor[b_l - 1];
  5383. for (shift = a_l - b_l; shift >= 0; shift--) {
  5384. quotientDigit = base - 1;
  5385. if (remainder[shift + b_l] !== divisorMostSignificantDigit) {
  5386. quotientDigit = Math.floor((remainder[shift + b_l] * base + remainder[shift + b_l - 1]) / divisorMostSignificantDigit);
  5387. }
  5388. // quotientDigit <= base - 1
  5389. carry = 0;
  5390. borrow = 0;
  5391. l = divisor.length;
  5392. for (i = 0; i < l; i++) {
  5393. carry += quotientDigit * divisor[i];
  5394. q = Math.floor(carry / base);
  5395. borrow += remainder[shift + i] - (carry - q * base);
  5396. carry = q;
  5397. if (borrow < 0) {
  5398. remainder[shift + i] = borrow + base;
  5399. borrow = -1;
  5400. } else {
  5401. remainder[shift + i] = borrow;
  5402. borrow = 0;
  5403. }
  5404. }
  5405. while (borrow !== 0) {
  5406. quotientDigit -= 1;
  5407. carry = 0;
  5408. for (i = 0; i < l; i++) {
  5409. carry += remainder[shift + i] - base + divisor[i];
  5410. if (carry < 0) {
  5411. remainder[shift + i] = carry + base;
  5412. carry = 0;
  5413. } else {
  5414. remainder[shift + i] = carry;
  5415. carry = 1;
  5416. }
  5417. }
  5418. borrow += carry;
  5419. }
  5420. result[shift] = quotientDigit;
  5421. }
  5422. // denormalization
  5423. remainder = divModSmall(remainder, lambda)[0];
  5424. return [arrayToSmall(result), arrayToSmall(remainder)];
  5425. }
  5426. function divMod2(a, b) { // Implementation idea shamelessly stolen from Silent Matt's library http://silentmatt.com/biginteger/
  5427. // Performs faster than divMod1 on larger input sizes.
  5428. var a_l = a.length,
  5429. b_l = b.length,
  5430. result = [],
  5431. part = [],
  5432. base = BASE,
  5433. guess, xlen, highx, highy, check;
  5434. while (a_l) {
  5435. part.unshift(a[--a_l]);
  5436. if (compareAbs(part, b) < 0) {
  5437. result.push(0);
  5438. continue;
  5439. }
  5440. xlen = part.length;
  5441. highx = part[xlen - 1] * base + part[xlen - 2];
  5442. highy = b[b_l - 1] * base + b[b_l - 2];
  5443. if (xlen > b_l) {
  5444. highx = (highx + 1) * base;
  5445. }
  5446. guess = Math.ceil(highx / highy);
  5447. do {
  5448. check = multiplySmall(b, guess);
  5449. if (compareAbs(check, part) <= 0) break;
  5450. guess--;
  5451. } while (guess);
  5452. result.push(guess);
  5453. part = subtract(part, check);
  5454. }
  5455. result.reverse();
  5456. return [arrayToSmall(result), arrayToSmall(part)];
  5457. }
  5458. function divModSmall(value, lambda) {
  5459. var length = value.length,
  5460. quotient = createArray(length),
  5461. base = BASE,
  5462. i, q, remainder, divisor;
  5463. remainder = 0;
  5464. for (i = length - 1; i >= 0; --i) {
  5465. divisor = remainder * base + value[i];
  5466. q = truncate(divisor / lambda);
  5467. remainder = divisor - q * lambda;
  5468. quotient[i] = q | 0;
  5469. }
  5470. return [quotient, remainder | 0];
  5471. }
  5472. function divModAny(self, v) {
  5473. var value, n = parseValue(v);
  5474. var a = self.value, b = n.value;
  5475. var quotient;
  5476. if (b === 0) throw new Error("Cannot divide by zero");
  5477. if (self.isSmall) {
  5478. if (n.isSmall) {
  5479. return [new SmallInteger(truncate(a / b)), new SmallInteger(a % b)];
  5480. }
  5481. return [Integer[0], self];
  5482. }
  5483. if (n.isSmall) {
  5484. if (b === 1) return [self, Integer[0]];
  5485. if (b == -1) return [self.negate(), Integer[0]];
  5486. var abs = Math.abs(b);
  5487. if (abs < BASE) {
  5488. value = divModSmall(a, abs);
  5489. quotient = arrayToSmall(value[0]);
  5490. var remainder = value[1];
  5491. if (self.sign) remainder = -remainder;
  5492. if (typeof quotient === "number") {
  5493. if (self.sign !== n.sign) quotient = -quotient;
  5494. return [new SmallInteger(quotient), new SmallInteger(remainder)];
  5495. }
  5496. return [new BigInteger(quotient, self.sign !== n.sign), new SmallInteger(remainder)];
  5497. }
  5498. b = smallToArray(abs);
  5499. }
  5500. var comparison = compareAbs(a, b);
  5501. if (comparison === -1) return [Integer[0], self];
  5502. if (comparison === 0) return [Integer[self.sign === n.sign ? 1 : -1], Integer[0]];
  5503. // divMod1 is faster on smaller input sizes
  5504. if (a.length + b.length <= 200)
  5505. value = divMod1(a, b);
  5506. else value = divMod2(a, b);
  5507. quotient = value[0];
  5508. var qSign = self.sign !== n.sign,
  5509. mod = value[1],
  5510. mSign = self.sign;
  5511. if (typeof quotient === "number") {
  5512. if (qSign) quotient = -quotient;
  5513. quotient = new SmallInteger(quotient);
  5514. } else quotient = new BigInteger(quotient, qSign);
  5515. if (typeof mod === "number") {
  5516. if (mSign) mod = -mod;
  5517. mod = new SmallInteger(mod);
  5518. } else mod = new BigInteger(mod, mSign);
  5519. return [quotient, mod];
  5520. }
  5521. BigInteger.prototype.divmod = function (v) {
  5522. var result = divModAny(this, v);
  5523. return {
  5524. quotient: result[0],
  5525. remainder: result[1]
  5526. };
  5527. };
  5528. SmallInteger.prototype.divmod = BigInteger.prototype.divmod;
  5529. BigInteger.prototype.divide = function (v) {
  5530. return divModAny(this, v)[0];
  5531. };
  5532. SmallInteger.prototype.over = SmallInteger.prototype.divide = BigInteger.prototype.over = BigInteger.prototype.divide;
  5533. BigInteger.prototype.mod = function (v) {
  5534. return divModAny(this, v)[1];
  5535. };
  5536. SmallInteger.prototype.remainder = SmallInteger.prototype.mod = BigInteger.prototype.remainder = BigInteger.prototype.mod;
  5537. BigInteger.prototype.pow = function (v) {
  5538. var n = parseValue(v),
  5539. a = this.value,
  5540. b = n.value,
  5541. value, x, y;
  5542. if (b === 0) return Integer[1];
  5543. if (a === 0) return Integer[0];
  5544. if (a === 1) return Integer[1];
  5545. if (a === -1) return n.isEven() ? Integer[1] : Integer[-1];
  5546. if (n.sign) {
  5547. return Integer[0];
  5548. }
  5549. if (!n.isSmall) throw new Error("The exponent " + n.toString() + " is too large.");
  5550. if (this.isSmall) {
  5551. if (isPrecise(value = Math.pow(a, b)))
  5552. return new SmallInteger(truncate(value));
  5553. }
  5554. x = this;
  5555. y = Integer[1];
  5556. while (true) {
  5557. if (b & 1 === 1) {
  5558. y = y.times(x);
  5559. --b;
  5560. }
  5561. if (b === 0) break;
  5562. b /= 2;
  5563. x = x.square();
  5564. }
  5565. return y;
  5566. };
  5567. SmallInteger.prototype.pow = BigInteger.prototype.pow;
  5568. BigInteger.prototype.modPow = function (exp, mod) {
  5569. exp = parseValue(exp);
  5570. mod = parseValue(mod);
  5571. if (mod.isZero()) throw new Error("Cannot take modPow with modulus 0");
  5572. var r = Integer[1],
  5573. base = this.mod(mod);
  5574. while (exp.isPositive()) {
  5575. if (base.isZero()) return Integer[0];
  5576. if (exp.isOdd()) r = r.multiply(base).mod(mod);
  5577. exp = exp.divide(2);
  5578. base = base.square().mod(mod);
  5579. }
  5580. return r;
  5581. };
  5582. SmallInteger.prototype.modPow = BigInteger.prototype.modPow;
  5583. function compareAbs(a, b) {
  5584. if (a.length !== b.length) {
  5585. return a.length > b.length ? 1 : -1;
  5586. }
  5587. for (var i = a.length - 1; i >= 0; i--) {
  5588. if (a[i] !== b[i]) return a[i] > b[i] ? 1 : -1;
  5589. }
  5590. return 0;
  5591. }
  5592. BigInteger.prototype.compareAbs = function (v) {
  5593. var n = parseValue(v),
  5594. a = this.value,
  5595. b = n.value;
  5596. if (n.isSmall) return 1;
  5597. return compareAbs(a, b);
  5598. };
  5599. SmallInteger.prototype.compareAbs = function (v) {
  5600. var n = parseValue(v),
  5601. a = Math.abs(this.value),
  5602. b = n.value;
  5603. if (n.isSmall) {
  5604. b = Math.abs(b);
  5605. return a === b ? 0 : a > b ? 1 : -1;
  5606. }
  5607. return -1;
  5608. };
  5609. BigInteger.prototype.compare = function (v) {
  5610. // See discussion about comparison with Infinity:
  5611. // https://github.com/peterolson/BigInteger.js/issues/61
  5612. if (v === Infinity) {
  5613. return -1;
  5614. }
  5615. if (v === -Infinity) {
  5616. return 1;
  5617. }
  5618. var n = parseValue(v),
  5619. a = this.value,
  5620. b = n.value;
  5621. if (this.sign !== n.sign) {
  5622. return n.sign ? 1 : -1;
  5623. }
  5624. if (n.isSmall) {
  5625. return this.sign ? -1 : 1;
  5626. }
  5627. return compareAbs(a, b) * (this.sign ? -1 : 1);
  5628. };
  5629. BigInteger.prototype.compareTo = BigInteger.prototype.compare;
  5630. SmallInteger.prototype.compare = function (v) {
  5631. if (v === Infinity) {
  5632. return -1;
  5633. }
  5634. if (v === -Infinity) {
  5635. return 1;
  5636. }
  5637. var n = parseValue(v),
  5638. a = this.value,
  5639. b = n.value;
  5640. if (n.isSmall) {
  5641. return a == b ? 0 : a > b ? 1 : -1;
  5642. }
  5643. if (a < 0 !== n.sign) {
  5644. return a < 0 ? -1 : 1;
  5645. }
  5646. return a < 0 ? 1 : -1;
  5647. };
  5648. SmallInteger.prototype.compareTo = SmallInteger.prototype.compare;
  5649. BigInteger.prototype.equals = function (v) {
  5650. return this.compare(v) === 0;
  5651. };
  5652. SmallInteger.prototype.eq = SmallInteger.prototype.equals = BigInteger.prototype.eq = BigInteger.prototype.equals;
  5653. BigInteger.prototype.notEquals = function (v) {
  5654. return this.compare(v) !== 0;
  5655. };
  5656. SmallInteger.prototype.neq = SmallInteger.prototype.notEquals = BigInteger.prototype.neq = BigInteger.prototype.notEquals;
  5657. BigInteger.prototype.greater = function (v) {
  5658. return this.compare(v) > 0;
  5659. };
  5660. SmallInteger.prototype.gt = SmallInteger.prototype.greater = BigInteger.prototype.gt = BigInteger.prototype.greater;
  5661. BigInteger.prototype.lesser = function (v) {
  5662. return this.compare(v) < 0;
  5663. };
  5664. SmallInteger.prototype.lt = SmallInteger.prototype.lesser = BigInteger.prototype.lt = BigInteger.prototype.lesser;
  5665. BigInteger.prototype.greaterOrEquals = function (v) {
  5666. return this.compare(v) >= 0;
  5667. };
  5668. SmallInteger.prototype.geq = SmallInteger.prototype.greaterOrEquals = BigInteger.prototype.geq = BigInteger.prototype.greaterOrEquals;
  5669. BigInteger.prototype.lesserOrEquals = function (v) {
  5670. return this.compare(v) <= 0;
  5671. };
  5672. SmallInteger.prototype.leq = SmallInteger.prototype.lesserOrEquals = BigInteger.prototype.leq = BigInteger.prototype.lesserOrEquals;
  5673. BigInteger.prototype.isEven = function () {
  5674. return (this.value[0] & 1) === 0;
  5675. };
  5676. SmallInteger.prototype.isEven = function () {
  5677. return (this.value & 1) === 0;
  5678. };
  5679. BigInteger.prototype.isOdd = function () {
  5680. return (this.value[0] & 1) === 1;
  5681. };
  5682. SmallInteger.prototype.isOdd = function () {
  5683. return (this.value & 1) === 1;
  5684. };
  5685. BigInteger.prototype.isPositive = function () {
  5686. return !this.sign;
  5687. };
  5688. SmallInteger.prototype.isPositive = function () {
  5689. return this.value > 0;
  5690. };
  5691. BigInteger.prototype.isNegative = function () {
  5692. return this.sign;
  5693. };
  5694. SmallInteger.prototype.isNegative = function () {
  5695. return this.value < 0;
  5696. };
  5697. BigInteger.prototype.isUnit = function () {
  5698. return false;
  5699. };
  5700. SmallInteger.prototype.isUnit = function () {
  5701. return Math.abs(this.value) === 1;
  5702. };
  5703. BigInteger.prototype.isZero = function () {
  5704. return false;
  5705. };
  5706. SmallInteger.prototype.isZero = function () {
  5707. return this.value === 0;
  5708. };
  5709. BigInteger.prototype.isDivisibleBy = function (v) {
  5710. var n = parseValue(v);
  5711. var value = n.value;
  5712. if (value === 0) return false;
  5713. if (value === 1) return true;
  5714. if (value === 2) return this.isEven();
  5715. return this.mod(n).equals(Integer[0]);
  5716. };
  5717. SmallInteger.prototype.isDivisibleBy = BigInteger.prototype.isDivisibleBy;
  5718. function isBasicPrime(v) {
  5719. var n = v.abs();
  5720. if (n.isUnit()) return false;
  5721. if (n.equals(2) || n.equals(3) || n.equals(5)) return true;
  5722. if (n.isEven() || n.isDivisibleBy(3) || n.isDivisibleBy(5)) return false;
  5723. if (n.lesser(25)) return true;
  5724. // we don't know if it's prime: let the other functions figure it out
  5725. }
  5726. BigInteger.prototype.isPrime = function () {
  5727. var isPrime = isBasicPrime(this);
  5728. if (isPrime !== undefined) return isPrime;
  5729. var n = this.abs(),
  5730. nPrev = n.prev();
  5731. var a = [2, 3, 5, 7, 11, 13, 17, 19],
  5732. b = nPrev,
  5733. d, t, i, x;
  5734. while (b.isEven()) b = b.divide(2);
  5735. for (i = 0; i < a.length; i++) {
  5736. x = bigInt(a[i]).modPow(b, n);
  5737. if (x.equals(Integer[1]) || x.equals(nPrev)) continue;
  5738. for (t = true, d = b; t && d.lesser(nPrev) ; d = d.multiply(2)) {
  5739. x = x.square().mod(n);
  5740. if (x.equals(nPrev)) t = false;
  5741. }
  5742. if (t) return false;
  5743. }
  5744. return true;
  5745. };
  5746. SmallInteger.prototype.isPrime = BigInteger.prototype.isPrime;
  5747. BigInteger.prototype.isProbablePrime = function (iterations) {
  5748. var isPrime = isBasicPrime(this);
  5749. if (isPrime !== undefined) return isPrime;
  5750. var n = this.abs();
  5751. var t = iterations === undefined ? 5 : iterations;
  5752. // use the Fermat primality test
  5753. for (var i = 0; i < t; i++) {
  5754. var a = bigInt.randBetween(2, n.minus(2));
  5755. if (!a.modPow(n.prev(), n).isUnit()) return false; // definitely composite
  5756. }
  5757. return true; // large chance of being prime
  5758. };
  5759. SmallInteger.prototype.isProbablePrime = BigInteger.prototype.isProbablePrime;
  5760. BigInteger.prototype.modInv = function (n) {
  5761. var t = bigInt.zero, newT = bigInt.one, r = parseValue(n), newR = this.abs(), q, lastT, lastR;
  5762. while (!newR.equals(bigInt.zero)) {
  5763. q = r.divide(newR);
  5764. lastT = t;
  5765. lastR = r;
  5766. t = newT;
  5767. r = newR;
  5768. newT = lastT.subtract(q.multiply(newT));
  5769. newR = lastR.subtract(q.multiply(newR));
  5770. }
  5771. if (!r.equals(1)) throw new Error(this.toString() + " and " + n.toString() + " are not co-prime");
  5772. if (t.compare(0) === -1) {
  5773. t = t.add(n);
  5774. }
  5775. return t;
  5776. }
  5777. SmallInteger.prototype.modInv = BigInteger.prototype.modInv;
  5778. BigInteger.prototype.next = function () {
  5779. var value = this.value;
  5780. if (this.sign) {
  5781. return subtractSmall(value, 1, this.sign);
  5782. }
  5783. return new BigInteger(addSmall(value, 1), this.sign);
  5784. };
  5785. SmallInteger.prototype.next = function () {
  5786. var value = this.value;
  5787. if (value + 1 < MAX_INT) return new SmallInteger(value + 1);
  5788. return new BigInteger(MAX_INT_ARR, false);
  5789. };
  5790. BigInteger.prototype.prev = function () {
  5791. var value = this.value;
  5792. if (this.sign) {
  5793. return new BigInteger(addSmall(value, 1), true);
  5794. }
  5795. return subtractSmall(value, 1, this.sign);
  5796. };
  5797. SmallInteger.prototype.prev = function () {
  5798. var value = this.value;
  5799. if (value - 1 > -MAX_INT) return new SmallInteger(value - 1);
  5800. return new BigInteger(MAX_INT_ARR, true);
  5801. };
  5802. var powersOfTwo = [1];
  5803. while (powersOfTwo[powersOfTwo.length - 1] <= BASE) powersOfTwo.push(2 * powersOfTwo[powersOfTwo.length - 1]);
  5804. var powers2Length = powersOfTwo.length, highestPower2 = powersOfTwo[powers2Length - 1];
  5805. function shift_isSmall(n) {
  5806. return ((typeof n === "number" || typeof n === "string") && +Math.abs(n) <= BASE) ||
  5807. (n instanceof BigInteger && n.value.length <= 1);
  5808. }
  5809. BigInteger.prototype.shiftLeft = function (n) {
  5810. if (!shift_isSmall(n)) {
  5811. throw new Error(String(n) + " is too large for shifting.");
  5812. }
  5813. n = +n;
  5814. if (n < 0) return this.shiftRight(-n);
  5815. var result = this;
  5816. while (n >= powers2Length) {
  5817. result = result.multiply(highestPower2);
  5818. n -= powers2Length - 1;
  5819. }
  5820. return result.multiply(powersOfTwo[n]);
  5821. };
  5822. SmallInteger.prototype.shiftLeft = BigInteger.prototype.shiftLeft;
  5823. BigInteger.prototype.shiftRight = function (n) {
  5824. var remQuo;
  5825. if (!shift_isSmall(n)) {
  5826. throw new Error(String(n) + " is too large for shifting.");
  5827. }
  5828. n = +n;
  5829. if (n < 0) return this.shiftLeft(-n);
  5830. var result = this;
  5831. while (n >= powers2Length) {
  5832. if (result.isZero()) return result;
  5833. remQuo = divModAny(result, highestPower2);
  5834. result = remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0];
  5835. n -= powers2Length - 1;
  5836. }
  5837. remQuo = divModAny(result, powersOfTwo[n]);
  5838. return remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0];
  5839. };
  5840. SmallInteger.prototype.shiftRight = BigInteger.prototype.shiftRight;
  5841. function bitwise(x, y, fn) {
  5842. y = parseValue(y);
  5843. var xSign = x.isNegative(), ySign = y.isNegative();
  5844. var xRem = xSign ? x.not() : x,
  5845. yRem = ySign ? y.not() : y;
  5846. var xBits = [], yBits = [];
  5847. var xStop = false, yStop = false;
  5848. while (!xStop || !yStop) {
  5849. if (xRem.isZero()) { // virtual sign extension for simulating two's complement
  5850. xStop = true;
  5851. xBits.push(xSign ? 1 : 0);
  5852. }
  5853. else if (xSign) xBits.push(xRem.isEven() ? 1 : 0); // two's complement for negative numbers
  5854. else xBits.push(xRem.isEven() ? 0 : 1);
  5855. if (yRem.isZero()) {
  5856. yStop = true;
  5857. yBits.push(ySign ? 1 : 0);
  5858. }
  5859. else if (ySign) yBits.push(yRem.isEven() ? 1 : 0);
  5860. else yBits.push(yRem.isEven() ? 0 : 1);
  5861. xRem = xRem.over(2);
  5862. yRem = yRem.over(2);
  5863. }
  5864. var result = [];
  5865. for (var i = 0; i < xBits.length; i++) result.push(fn(xBits[i], yBits[i]));
  5866. var sum = bigInt(result.pop()).negate().times(bigInt(2).pow(result.length));
  5867. while (result.length) {
  5868. sum = sum.add(bigInt(result.pop()).times(bigInt(2).pow(result.length)));
  5869. }
  5870. return sum;
  5871. }
  5872. BigInteger.prototype.not = function () {
  5873. return this.negate().prev();
  5874. };
  5875. SmallInteger.prototype.not = BigInteger.prototype.not;
  5876. BigInteger.prototype.and = function (n) {
  5877. return bitwise(this, n, function (a, b) { return a & b; });
  5878. };
  5879. SmallInteger.prototype.and = BigInteger.prototype.and;
  5880. BigInteger.prototype.or = function (n) {
  5881. return bitwise(this, n, function (a, b) { return a | b; });
  5882. };
  5883. SmallInteger.prototype.or = BigInteger.prototype.or;
  5884. BigInteger.prototype.xor = function (n) {
  5885. return bitwise(this, n, function (a, b) { return a ^ b; });
  5886. };
  5887. SmallInteger.prototype.xor = BigInteger.prototype.xor;
  5888. var LOBMASK_I = 1 << 30, LOBMASK_BI = (BASE & -BASE) * (BASE & -BASE) | LOBMASK_I;
  5889. function roughLOB(n) { // get lowestOneBit (rough)
  5890. // SmallInteger: return Min(lowestOneBit(n), 1 << 30)
  5891. // BigInteger: return Min(lowestOneBit(n), 1 << 14) [BASE=1e7]
  5892. var v = n.value, x = typeof v === "number" ? v | LOBMASK_I : v[0] + v[1] * BASE | LOBMASK_BI;
  5893. return x & -x;
  5894. }
  5895. function max(a, b) {
  5896. a = parseValue(a);
  5897. b = parseValue(b);
  5898. return a.greater(b) ? a : b;
  5899. }
  5900. function min(a,b) {
  5901. a = parseValue(a);
  5902. b = parseValue(b);
  5903. return a.lesser(b) ? a : b;
  5904. }
  5905. function gcd(a, b) {
  5906. a = parseValue(a).abs();
  5907. b = parseValue(b).abs();
  5908. if (a.equals(b)) return a;
  5909. if (a.isZero()) return b;
  5910. if (b.isZero()) return a;
  5911. var c = Integer[1], d, t;
  5912. while (a.isEven() && b.isEven()) {
  5913. d = Math.min(roughLOB(a), roughLOB(b));
  5914. a = a.divide(d);
  5915. b = b.divide(d);
  5916. c = c.multiply(d);
  5917. }
  5918. while (a.isEven()) {
  5919. a = a.divide(roughLOB(a));
  5920. }
  5921. do {
  5922. while (b.isEven()) {
  5923. b = b.divide(roughLOB(b));
  5924. }
  5925. if (a.greater(b)) {
  5926. t = b; b = a; a = t;
  5927. }
  5928. b = b.subtract(a);
  5929. } while (!b.isZero());
  5930. return c.isUnit() ? a : a.multiply(c);
  5931. }
  5932. function lcm(a, b) {
  5933. a = parseValue(a).abs();
  5934. b = parseValue(b).abs();
  5935. return a.divide(gcd(a, b)).multiply(b);
  5936. }
  5937. function randBetween(a, b) {
  5938. a = parseValue(a);
  5939. b = parseValue(b);
  5940. var low = min(a, b), high = max(a, b);
  5941. var range = high.subtract(low);
  5942. if (range.isSmall) return low.add(Math.round(Math.random() * range));
  5943. var length = range.value.length - 1;
  5944. var result = [], restricted = true;
  5945. for (var i = length; i >= 0; i--) {
  5946. var top = restricted ? range.value[i] : BASE;
  5947. var digit = truncate(Math.random() * top);
  5948. result.unshift(digit);
  5949. if (digit < top) restricted = false;
  5950. }
  5951. result = arrayToSmall(result);
  5952. return low.add(typeof result === "number" ? new SmallInteger(result) : new BigInteger(result, false));
  5953. }
  5954. var parseBase = function (text, base) {
  5955. var val = Integer[0], pow = Integer[1],
  5956. length = text.length;
  5957. if (2 <= base && base <= 36) {
  5958. if (length <= LOG_MAX_INT / Math.log(base)) {
  5959. return new SmallInteger(parseInt(text, base));
  5960. }
  5961. }
  5962. base = parseValue(base);
  5963. var digits = [];
  5964. var i;
  5965. var isNegative = text[0] === "-";
  5966. for (i = isNegative ? 1 : 0; i < text.length; i++) {
  5967. var c = text[i].toLowerCase(),
  5968. charCode = c.charCodeAt(0);
  5969. if (48 <= charCode && charCode <= 57) digits.push(parseValue(c));
  5970. else if (97 <= charCode && charCode <= 122) digits.push(parseValue(c.charCodeAt(0) - 87));
  5971. else if (c === "<") {
  5972. var start = i;
  5973. do { i++; } while (text[i] !== ">");
  5974. digits.push(parseValue(text.slice(start + 1, i)));
  5975. }
  5976. else throw new Error(c + " is not a valid character");
  5977. }
  5978. digits.reverse();
  5979. for (i = 0; i < digits.length; i++) {
  5980. val = val.add(digits[i].times(pow));
  5981. pow = pow.times(base);
  5982. }
  5983. return isNegative ? val.negate() : val;
  5984. };
  5985. function stringify(digit) {
  5986. var v = digit.value;
  5987. if (typeof v === "number") v = [v];
  5988. if (v.length === 1 && v[0] <= 35) {
  5989. return "0123456789abcdefghijklmnopqrstuvwxyz".charAt(v[0]);
  5990. }
  5991. return "<" + v + ">";
  5992. }
  5993. function toBase(n, base) {
  5994. base = bigInt(base);
  5995. if (base.isZero()) {
  5996. if (n.isZero()) return "0";
  5997. throw new Error("Cannot convert nonzero numbers to base 0.");
  5998. }
  5999. if (base.equals(-1)) {
  6000. if (n.isZero()) return "0";
  6001. if (n.isNegative()) return new Array(1 - n).join("10");
  6002. return "1" + new Array(+n).join("01");
  6003. }
  6004. var minusSign = "";
  6005. if (n.isNegative() && base.isPositive()) {
  6006. minusSign = "-";
  6007. n = n.abs();
  6008. }
  6009. if (base.equals(1)) {
  6010. if (n.isZero()) return "0";
  6011. return minusSign + new Array(+n + 1).join(1);
  6012. }
  6013. var out = [];
  6014. var left = n, divmod;
  6015. while (left.isNegative() || left.compareAbs(base) >= 0) {
  6016. divmod = left.divmod(base);
  6017. left = divmod.quotient;
  6018. var digit = divmod.remainder;
  6019. if (digit.isNegative()) {
  6020. digit = base.minus(digit).abs();
  6021. left = left.next();
  6022. }
  6023. out.push(stringify(digit));
  6024. }
  6025. out.push(stringify(left));
  6026. return minusSign + out.reverse().join("");
  6027. }
  6028. BigInteger.prototype.toString = function (radix) {
  6029. if (radix === undefined) radix = 10;
  6030. if (radix !== 10) return toBase(this, radix);
  6031. var v = this.value, l = v.length, str = String(v[--l]), zeros = "0000000", digit;
  6032. while (--l >= 0) {
  6033. digit = String(v[l]);
  6034. str += zeros.slice(digit.length) + digit;
  6035. }
  6036. var sign = this.sign ? "-" : "";
  6037. return sign + str;
  6038. };
  6039. SmallInteger.prototype.toString = function (radix) {
  6040. if (radix === undefined) radix = 10;
  6041. if (radix != 10) return toBase(this, radix);
  6042. return String(this.value);
  6043. };
  6044. BigInteger.prototype.valueOf = function () {
  6045. return +this.toString();
  6046. };
  6047. BigInteger.prototype.toJSNumber = BigInteger.prototype.valueOf;
  6048. SmallInteger.prototype.valueOf = function () {
  6049. return this.value;
  6050. };
  6051. SmallInteger.prototype.toJSNumber = SmallInteger.prototype.valueOf;
  6052. function parseStringValue(v) {
  6053. if (isPrecise(+v)) {
  6054. var x = +v;
  6055. if (x === truncate(x))
  6056. return new SmallInteger(x);
  6057. throw "Invalid integer: " + v;
  6058. }
  6059. var sign = v[0] === "-";
  6060. if (sign) v = v.slice(1);
  6061. var split = v.split(/e/i);
  6062. if (split.length > 2) throw new Error("Invalid integer: " + split.join("e"));
  6063. if (split.length === 2) {
  6064. var exp = split[1];
  6065. if (exp[0] === "+") exp = exp.slice(1);
  6066. exp = +exp;
  6067. if (exp !== truncate(exp) || !isPrecise(exp)) throw new Error("Invalid integer: " + exp + " is not a valid exponent.");
  6068. var text = split[0];
  6069. var decimalPlace = text.indexOf(".");
  6070. if (decimalPlace >= 0) {
  6071. exp -= text.length - decimalPlace - 1;
  6072. text = text.slice(0, decimalPlace) + text.slice(decimalPlace + 1);
  6073. }
  6074. if (exp < 0) throw new Error("Cannot include negative exponent part for integers");
  6075. text += (new Array(exp + 1)).join("0");
  6076. v = text;
  6077. }
  6078. var isValid = /^([0-9][0-9]*)$/.test(v);
  6079. if (!isValid) throw new Error("Invalid integer: " + v);
  6080. var r = [], max = v.length, l = LOG_BASE, min = max - l;
  6081. while (max > 0) {
  6082. r.push(+v.slice(min, max));
  6083. min -= l;
  6084. if (min < 0) min = 0;
  6085. max -= l;
  6086. }
  6087. trim(r);
  6088. return new BigInteger(r, sign);
  6089. }
  6090. function parseNumberValue(v) {
  6091. if (isPrecise(v)) {
  6092. if (v !== truncate(v)) throw new Error(v + " is not an integer.");
  6093. return new SmallInteger(v);
  6094. }
  6095. return parseStringValue(v.toString());
  6096. }
  6097. function parseValue(v) {
  6098. if (typeof v === "number") {
  6099. return parseNumberValue(v);
  6100. }
  6101. if (typeof v === "string") {
  6102. return parseStringValue(v);
  6103. }
  6104. return v;
  6105. }
  6106. // Pre-define numbers in range [-999,999]
  6107. for (var i = 0; i < 1000; i++) {
  6108. Integer[i] = new SmallInteger(i);
  6109. if (i > 0) Integer[-i] = new SmallInteger(-i);
  6110. }
  6111. // Backwards compatibility
  6112. Integer.one = Integer[1];
  6113. Integer.zero = Integer[0];
  6114. Integer.minusOne = Integer[-1];
  6115. Integer.max = max;
  6116. Integer.min = min;
  6117. Integer.gcd = gcd;
  6118. Integer.lcm = lcm;
  6119. Integer.isInstance = function (x) { return x instanceof BigInteger || x instanceof SmallInteger; };
  6120. Integer.randBetween = randBetween;
  6121. return Integer;
  6122. })();
  6123. // Node.js check
  6124. if (typeof module !== "undefined" && module.hasOwnProperty("exports")) {
  6125. module.exports = bigInt;
  6126. }
  6127. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(50)(module)))
  6128. /***/ }),
  6129. /* 28 */
  6130. /***/ (function(module, exports, __webpack_require__) {
  6131. /* WEBPACK VAR INJECTION */(function(Buffer) {var Transform = __webpack_require__(6).Transform
  6132. var inherits = __webpack_require__(1)
  6133. var StringDecoder = __webpack_require__(14).StringDecoder
  6134. module.exports = CipherBase
  6135. inherits(CipherBase, Transform)
  6136. function CipherBase (hashMode) {
  6137. Transform.call(this)
  6138. this.hashMode = typeof hashMode === 'string'
  6139. if (this.hashMode) {
  6140. this[hashMode] = this._finalOrDigest
  6141. } else {
  6142. this.final = this._finalOrDigest
  6143. }
  6144. this._decoder = null
  6145. this._encoding = null
  6146. }
  6147. CipherBase.prototype.update = function (data, inputEnc, outputEnc) {
  6148. if (typeof data === 'string') {
  6149. data = new Buffer(data, inputEnc)
  6150. }
  6151. var outData = this._update(data)
  6152. if (this.hashMode) {
  6153. return this
  6154. }
  6155. if (outputEnc) {
  6156. outData = this._toString(outData, outputEnc)
  6157. }
  6158. return outData
  6159. }
  6160. CipherBase.prototype.setAutoPadding = function () {}
  6161. CipherBase.prototype.getAuthTag = function () {
  6162. throw new Error('trying to get auth tag in unsupported state')
  6163. }
  6164. CipherBase.prototype.setAuthTag = function () {
  6165. throw new Error('trying to set auth tag in unsupported state')
  6166. }
  6167. CipherBase.prototype.setAAD = function () {
  6168. throw new Error('trying to set aad in unsupported state')
  6169. }
  6170. CipherBase.prototype._transform = function (data, _, next) {
  6171. var err
  6172. try {
  6173. if (this.hashMode) {
  6174. this._update(data)
  6175. } else {
  6176. this.push(this._update(data))
  6177. }
  6178. } catch (e) {
  6179. err = e
  6180. } finally {
  6181. next(err)
  6182. }
  6183. }
  6184. CipherBase.prototype._flush = function (done) {
  6185. var err
  6186. try {
  6187. this.push(this._final())
  6188. } catch (e) {
  6189. err = e
  6190. } finally {
  6191. done(err)
  6192. }
  6193. }
  6194. CipherBase.prototype._finalOrDigest = function (outputEnc) {
  6195. var outData = this._final() || new Buffer('')
  6196. if (outputEnc) {
  6197. outData = this._toString(outData, outputEnc, true)
  6198. }
  6199. return outData
  6200. }
  6201. CipherBase.prototype._toString = function (value, enc, fin) {
  6202. if (!this._decoder) {
  6203. this._decoder = new StringDecoder(enc)
  6204. this._encoding = enc
  6205. }
  6206. if (this._encoding !== enc) {
  6207. throw new Error('can\'t switch encodings')
  6208. }
  6209. var out = this._decoder.write(value)
  6210. if (fin) {
  6211. out += this._decoder.end()
  6212. }
  6213. return out
  6214. }
  6215. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  6216. /***/ }),
  6217. /* 29 */
  6218. /***/ (function(module, exports, __webpack_require__) {
  6219. "use strict";
  6220. /* WEBPACK VAR INJECTION */(function(Buffer) {
  6221. var inherits = __webpack_require__(1)
  6222. var md5 = __webpack_require__(31)
  6223. var rmd160 = __webpack_require__(42)
  6224. var sha = __webpack_require__(44)
  6225. var Base = __webpack_require__(28)
  6226. function HashNoConstructor(hash) {
  6227. Base.call(this, 'digest')
  6228. this._hash = hash
  6229. this.buffers = []
  6230. }
  6231. inherits(HashNoConstructor, Base)
  6232. HashNoConstructor.prototype._update = function (data) {
  6233. this.buffers.push(data)
  6234. }
  6235. HashNoConstructor.prototype._final = function () {
  6236. var buf = Buffer.concat(this.buffers)
  6237. var r = this._hash(buf)
  6238. this.buffers = null
  6239. return r
  6240. }
  6241. function Hash(hash) {
  6242. Base.call(this, 'digest')
  6243. this._hash = hash
  6244. }
  6245. inherits(Hash, Base)
  6246. Hash.prototype._update = function (data) {
  6247. this._hash.update(data)
  6248. }
  6249. Hash.prototype._final = function () {
  6250. return this._hash.digest()
  6251. }
  6252. module.exports = function createHash (alg) {
  6253. alg = alg.toLowerCase()
  6254. if ('md5' === alg) return new HashNoConstructor(md5)
  6255. if ('rmd160' === alg || 'ripemd160' === alg) return new HashNoConstructor(rmd160)
  6256. return new Hash(sha(alg))
  6257. }
  6258. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  6259. /***/ }),
  6260. /* 30 */
  6261. /***/ (function(module, exports, __webpack_require__) {
  6262. "use strict";
  6263. /* WEBPACK VAR INJECTION */(function(Buffer) {
  6264. var intSize = 4;
  6265. var zeroBuffer = new Buffer(intSize); zeroBuffer.fill(0);
  6266. var chrsz = 8;
  6267. function toArray(buf, bigEndian) {
  6268. if ((buf.length % intSize) !== 0) {
  6269. var len = buf.length + (intSize - (buf.length % intSize));
  6270. buf = Buffer.concat([buf, zeroBuffer], len);
  6271. }
  6272. var arr = [];
  6273. var fn = bigEndian ? buf.readInt32BE : buf.readInt32LE;
  6274. for (var i = 0; i < buf.length; i += intSize) {
  6275. arr.push(fn.call(buf, i));
  6276. }
  6277. return arr;
  6278. }
  6279. function toBuffer(arr, size, bigEndian) {
  6280. var buf = new Buffer(size);
  6281. var fn = bigEndian ? buf.writeInt32BE : buf.writeInt32LE;
  6282. for (var i = 0; i < arr.length; i++) {
  6283. fn.call(buf, arr[i], i * 4, true);
  6284. }
  6285. return buf;
  6286. }
  6287. function hash(buf, fn, hashSize, bigEndian) {
  6288. if (!Buffer.isBuffer(buf)) buf = new Buffer(buf);
  6289. var arr = fn(toArray(buf, bigEndian), buf.length * chrsz);
  6290. return toBuffer(arr, hashSize, bigEndian);
  6291. }
  6292. exports.hash = hash;
  6293. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  6294. /***/ }),
  6295. /* 31 */
  6296. /***/ (function(module, exports, __webpack_require__) {
  6297. "use strict";
  6298. /*
  6299. * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
  6300. * Digest Algorithm, as defined in RFC 1321.
  6301. * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002.
  6302. * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
  6303. * Distributed under the BSD License
  6304. * See http://pajhome.org.uk/crypt/md5 for more info.
  6305. */
  6306. var helpers = __webpack_require__(30);
  6307. /*
  6308. * Calculate the MD5 of an array of little-endian words, and a bit length
  6309. */
  6310. function core_md5(x, len)
  6311. {
  6312. /* append padding */
  6313. x[len >> 5] |= 0x80 << ((len) % 32);
  6314. x[(((len + 64) >>> 9) << 4) + 14] = len;
  6315. var a = 1732584193;
  6316. var b = -271733879;
  6317. var c = -1732584194;
  6318. var d = 271733878;
  6319. for(var i = 0; i < x.length; i += 16)
  6320. {
  6321. var olda = a;
  6322. var oldb = b;
  6323. var oldc = c;
  6324. var oldd = d;
  6325. a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936);
  6326. d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586);
  6327. c = md5_ff(c, d, a, b, x[i+ 2], 17, 606105819);
  6328. b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330);
  6329. a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897);
  6330. d = md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426);
  6331. c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);
  6332. b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983);
  6333. a = md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416);
  6334. d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417);
  6335. c = md5_ff(c, d, a, b, x[i+10], 17, -42063);
  6336. b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162);
  6337. a = md5_ff(a, b, c, d, x[i+12], 7 , 1804603682);
  6338. d = md5_ff(d, a, b, c, x[i+13], 12, -40341101);
  6339. c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290);
  6340. b = md5_ff(b, c, d, a, x[i+15], 22, 1236535329);
  6341. a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510);
  6342. d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632);
  6343. c = md5_gg(c, d, a, b, x[i+11], 14, 643717713);
  6344. b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302);
  6345. a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691);
  6346. d = md5_gg(d, a, b, c, x[i+10], 9 , 38016083);
  6347. c = md5_gg(c, d, a, b, x[i+15], 14, -660478335);
  6348. b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848);
  6349. a = md5_gg(a, b, c, d, x[i+ 9], 5 , 568446438);
  6350. d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690);
  6351. c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961);
  6352. b = md5_gg(b, c, d, a, x[i+ 8], 20, 1163531501);
  6353. a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467);
  6354. d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784);
  6355. c = md5_gg(c, d, a, b, x[i+ 7], 14, 1735328473);
  6356. b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734);
  6357. a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558);
  6358. d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463);
  6359. c = md5_hh(c, d, a, b, x[i+11], 16, 1839030562);
  6360. b = md5_hh(b, c, d, a, x[i+14], 23, -35309556);
  6361. a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060);
  6362. d = md5_hh(d, a, b, c, x[i+ 4], 11, 1272893353);
  6363. c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632);
  6364. b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640);
  6365. a = md5_hh(a, b, c, d, x[i+13], 4 , 681279174);
  6366. d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222);
  6367. c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979);
  6368. b = md5_hh(b, c, d, a, x[i+ 6], 23, 76029189);
  6369. a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487);
  6370. d = md5_hh(d, a, b, c, x[i+12], 11, -421815835);
  6371. c = md5_hh(c, d, a, b, x[i+15], 16, 530742520);
  6372. b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651);
  6373. a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844);
  6374. d = md5_ii(d, a, b, c, x[i+ 7], 10, 1126891415);
  6375. c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905);
  6376. b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055);
  6377. a = md5_ii(a, b, c, d, x[i+12], 6 , 1700485571);
  6378. d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606);
  6379. c = md5_ii(c, d, a, b, x[i+10], 15, -1051523);
  6380. b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799);
  6381. a = md5_ii(a, b, c, d, x[i+ 8], 6 , 1873313359);
  6382. d = md5_ii(d, a, b, c, x[i+15], 10, -30611744);
  6383. c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380);
  6384. b = md5_ii(b, c, d, a, x[i+13], 21, 1309151649);
  6385. a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070);
  6386. d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379);
  6387. c = md5_ii(c, d, a, b, x[i+ 2], 15, 718787259);
  6388. b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551);
  6389. a = safe_add(a, olda);
  6390. b = safe_add(b, oldb);
  6391. c = safe_add(c, oldc);
  6392. d = safe_add(d, oldd);
  6393. }
  6394. return Array(a, b, c, d);
  6395. }
  6396. /*
  6397. * These functions implement the four basic operations the algorithm uses.
  6398. */
  6399. function md5_cmn(q, a, b, x, s, t)
  6400. {
  6401. return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b);
  6402. }
  6403. function md5_ff(a, b, c, d, x, s, t)
  6404. {
  6405. return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
  6406. }
  6407. function md5_gg(a, b, c, d, x, s, t)
  6408. {
  6409. return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
  6410. }
  6411. function md5_hh(a, b, c, d, x, s, t)
  6412. {
  6413. return md5_cmn(b ^ c ^ d, a, b, x, s, t);
  6414. }
  6415. function md5_ii(a, b, c, d, x, s, t)
  6416. {
  6417. return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
  6418. }
  6419. /*
  6420. * Add integers, wrapping at 2^32. This uses 16-bit operations internally
  6421. * to work around bugs in some JS interpreters.
  6422. */
  6423. function safe_add(x, y)
  6424. {
  6425. var lsw = (x & 0xFFFF) + (y & 0xFFFF);
  6426. var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
  6427. return (msw << 16) | (lsw & 0xFFFF);
  6428. }
  6429. /*
  6430. * Bitwise rotate a 32-bit number to the left.
  6431. */
  6432. function bit_rol(num, cnt)
  6433. {
  6434. return (num << cnt) | (num >>> (32 - cnt));
  6435. }
  6436. module.exports = function md5(buf) {
  6437. return helpers.hash(buf, core_md5, 16);
  6438. };
  6439. /***/ }),
  6440. /* 32 */
  6441. /***/ (function(module, exports) {
  6442. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  6443. var e, m
  6444. var eLen = nBytes * 8 - mLen - 1
  6445. var eMax = (1 << eLen) - 1
  6446. var eBias = eMax >> 1
  6447. var nBits = -7
  6448. var i = isLE ? (nBytes - 1) : 0
  6449. var d = isLE ? -1 : 1
  6450. var s = buffer[offset + i]
  6451. i += d
  6452. e = s & ((1 << (-nBits)) - 1)
  6453. s >>= (-nBits)
  6454. nBits += eLen
  6455. for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
  6456. m = e & ((1 << (-nBits)) - 1)
  6457. e >>= (-nBits)
  6458. nBits += mLen
  6459. for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
  6460. if (e === 0) {
  6461. e = 1 - eBias
  6462. } else if (e === eMax) {
  6463. return m ? NaN : ((s ? -1 : 1) * Infinity)
  6464. } else {
  6465. m = m + Math.pow(2, mLen)
  6466. e = e - eBias
  6467. }
  6468. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  6469. }
  6470. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  6471. var e, m, c
  6472. var eLen = nBytes * 8 - mLen - 1
  6473. var eMax = (1 << eLen) - 1
  6474. var eBias = eMax >> 1
  6475. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  6476. var i = isLE ? 0 : (nBytes - 1)
  6477. var d = isLE ? 1 : -1
  6478. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  6479. value = Math.abs(value)
  6480. if (isNaN(value) || value === Infinity) {
  6481. m = isNaN(value) ? 1 : 0
  6482. e = eMax
  6483. } else {
  6484. e = Math.floor(Math.log(value) / Math.LN2)
  6485. if (value * (c = Math.pow(2, -e)) < 1) {
  6486. e--
  6487. c *= 2
  6488. }
  6489. if (e + eBias >= 1) {
  6490. value += rt / c
  6491. } else {
  6492. value += rt * Math.pow(2, 1 - eBias)
  6493. }
  6494. if (value * c >= 2) {
  6495. e++
  6496. c /= 2
  6497. }
  6498. if (e + eBias >= eMax) {
  6499. m = 0
  6500. e = eMax
  6501. } else if (e + eBias >= 1) {
  6502. m = (value * c - 1) * Math.pow(2, mLen)
  6503. e = e + eBias
  6504. } else {
  6505. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  6506. e = 0
  6507. }
  6508. }
  6509. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  6510. e = (e << mLen) | m
  6511. eLen += mLen
  6512. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  6513. buffer[offset + i - d] |= s * 128
  6514. }
  6515. /***/ }),
  6516. /* 33 */
  6517. /***/ (function(module, exports, __webpack_require__) {
  6518. /* WEBPACK VAR INJECTION */(function(process, Buffer) {var createHmac = __webpack_require__(15)
  6519. var checkParameters = __webpack_require__(34)
  6520. exports.pbkdf2 = function (password, salt, iterations, keylen, digest, callback) {
  6521. if (typeof digest === 'function') {
  6522. callback = digest
  6523. digest = undefined
  6524. }
  6525. checkParameters(iterations, keylen)
  6526. if (typeof callback !== 'function') throw new Error('No callback provided to pbkdf2')
  6527. setTimeout(function () {
  6528. callback(null, exports.pbkdf2Sync(password, salt, iterations, keylen, digest))
  6529. })
  6530. }
  6531. var defaultEncoding
  6532. if (process.browser) {
  6533. defaultEncoding = 'utf-8'
  6534. } else {
  6535. var pVersionMajor = parseInt(process.version.split('.')[0].slice(1), 10)
  6536. defaultEncoding = pVersionMajor >= 6 ? 'utf-8' : 'binary'
  6537. }
  6538. exports.pbkdf2Sync = function (password, salt, iterations, keylen, digest) {
  6539. if (!Buffer.isBuffer(password)) password = new Buffer(password, defaultEncoding)
  6540. if (!Buffer.isBuffer(salt)) salt = new Buffer(salt, defaultEncoding)
  6541. checkParameters(iterations, keylen)
  6542. digest = digest || 'sha1'
  6543. var hLen
  6544. var l = 1
  6545. var DK = new Buffer(keylen)
  6546. var block1 = new Buffer(salt.length + 4)
  6547. salt.copy(block1, 0, 0, salt.length)
  6548. var r
  6549. var T
  6550. for (var i = 1; i <= l; i++) {
  6551. block1.writeUInt32BE(i, salt.length)
  6552. var U = createHmac(digest, password).update(block1).digest()
  6553. if (!hLen) {
  6554. hLen = U.length
  6555. T = new Buffer(hLen)
  6556. l = Math.ceil(keylen / hLen)
  6557. r = keylen - (l - 1) * hLen
  6558. }
  6559. U.copy(T, 0, 0, hLen)
  6560. for (var j = 1; j < iterations; j++) {
  6561. U = createHmac(digest, password).update(U).digest()
  6562. for (var k = 0; k < hLen; k++) T[k] ^= U[k]
  6563. }
  6564. var destPos = (i - 1) * hLen
  6565. var len = (i === l ? r : hLen)
  6566. T.copy(DK, destPos, 0, len)
  6567. }
  6568. return DK
  6569. }
  6570. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(0).Buffer))
  6571. /***/ }),
  6572. /* 34 */
  6573. /***/ (function(module, exports) {
  6574. var MAX_ALLOC = Math.pow(2, 30) - 1 // default in iojs
  6575. module.exports = function (iterations, keylen) {
  6576. if (typeof iterations !== 'number') {
  6577. throw new TypeError('Iterations not a number')
  6578. }
  6579. if (iterations < 0) {
  6580. throw new TypeError('Bad iterations')
  6581. }
  6582. if (typeof keylen !== 'number') {
  6583. throw new TypeError('Key length not a number')
  6584. }
  6585. if (keylen < 0 || keylen > MAX_ALLOC || keylen !== keylen) { /* eslint no-self-compare: 0 */
  6586. throw new TypeError('Bad key length')
  6587. }
  6588. }
  6589. /***/ }),
  6590. /* 35 */
  6591. /***/ (function(module, exports, __webpack_require__) {
  6592. "use strict";
  6593. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {
  6594. var PENDING = 'pending';
  6595. var SETTLED = 'settled';
  6596. var FULFILLED = 'fulfilled';
  6597. var REJECTED = 'rejected';
  6598. var NOOP = function () {};
  6599. var isNode = typeof global !== 'undefined' && typeof global.process !== 'undefined' && typeof global.process.emit === 'function';
  6600. var asyncSetTimer = typeof setImmediate === 'undefined' ? setTimeout : setImmediate;
  6601. var asyncQueue = [];
  6602. var asyncTimer;
  6603. function asyncFlush() {
  6604. // run promise callbacks
  6605. for (var i = 0; i < asyncQueue.length; i++) {
  6606. asyncQueue[i][0](asyncQueue[i][1]);
  6607. }
  6608. // reset async asyncQueue
  6609. asyncQueue = [];
  6610. asyncTimer = false;
  6611. }
  6612. function asyncCall(callback, arg) {
  6613. asyncQueue.push([callback, arg]);
  6614. if (!asyncTimer) {
  6615. asyncTimer = true;
  6616. asyncSetTimer(asyncFlush, 0);
  6617. }
  6618. }
  6619. function invokeResolver(resolver, promise) {
  6620. function resolvePromise(value) {
  6621. resolve(promise, value);
  6622. }
  6623. function rejectPromise(reason) {
  6624. reject(promise, reason);
  6625. }
  6626. try {
  6627. resolver(resolvePromise, rejectPromise);
  6628. } catch (e) {
  6629. rejectPromise(e);
  6630. }
  6631. }
  6632. function invokeCallback(subscriber) {
  6633. var owner = subscriber.owner;
  6634. var settled = owner._state;
  6635. var value = owner._data;
  6636. var callback = subscriber[settled];
  6637. var promise = subscriber.then;
  6638. if (typeof callback === 'function') {
  6639. settled = FULFILLED;
  6640. try {
  6641. value = callback(value);
  6642. } catch (e) {
  6643. reject(promise, e);
  6644. }
  6645. }
  6646. if (!handleThenable(promise, value)) {
  6647. if (settled === FULFILLED) {
  6648. resolve(promise, value);
  6649. }
  6650. if (settled === REJECTED) {
  6651. reject(promise, value);
  6652. }
  6653. }
  6654. }
  6655. function handleThenable(promise, value) {
  6656. var resolved;
  6657. try {
  6658. if (promise === value) {
  6659. throw new TypeError('A promises callback cannot return that same promise.');
  6660. }
  6661. if (value && (typeof value === 'function' || typeof value === 'object')) {
  6662. // then should be retrieved only once
  6663. var then = value.then;
  6664. if (typeof then === 'function') {
  6665. then.call(value, function (val) {
  6666. if (!resolved) {
  6667. resolved = true;
  6668. if (value === val) {
  6669. fulfill(promise, val);
  6670. } else {
  6671. resolve(promise, val);
  6672. }
  6673. }
  6674. }, function (reason) {
  6675. if (!resolved) {
  6676. resolved = true;
  6677. reject(promise, reason);
  6678. }
  6679. });
  6680. return true;
  6681. }
  6682. }
  6683. } catch (e) {
  6684. if (!resolved) {
  6685. reject(promise, e);
  6686. }
  6687. return true;
  6688. }
  6689. return false;
  6690. }
  6691. function resolve(promise, value) {
  6692. if (promise === value || !handleThenable(promise, value)) {
  6693. fulfill(promise, value);
  6694. }
  6695. }
  6696. function fulfill(promise, value) {
  6697. if (promise._state === PENDING) {
  6698. promise._state = SETTLED;
  6699. promise._data = value;
  6700. asyncCall(publishFulfillment, promise);
  6701. }
  6702. }
  6703. function reject(promise, reason) {
  6704. if (promise._state === PENDING) {
  6705. promise._state = SETTLED;
  6706. promise._data = reason;
  6707. asyncCall(publishRejection, promise);
  6708. }
  6709. }
  6710. function publish(promise) {
  6711. promise._then = promise._then.forEach(invokeCallback);
  6712. }
  6713. function publishFulfillment(promise) {
  6714. promise._state = FULFILLED;
  6715. publish(promise);
  6716. }
  6717. function publishRejection(promise) {
  6718. promise._state = REJECTED;
  6719. publish(promise);
  6720. if (!promise._handled && isNode) {
  6721. global.process.emit('unhandledRejection', promise._data, promise);
  6722. }
  6723. }
  6724. function notifyRejectionHandled(promise) {
  6725. global.process.emit('rejectionHandled', promise);
  6726. }
  6727. /**
  6728. * @class
  6729. */
  6730. function Promise(resolver) {
  6731. if (typeof resolver !== 'function') {
  6732. throw new TypeError('Promise resolver ' + resolver + ' is not a function');
  6733. }
  6734. if (this instanceof Promise === false) {
  6735. throw new TypeError('Failed to construct \'Promise\': Please use the \'new\' operator, this object constructor cannot be called as a function.');
  6736. }
  6737. this._then = [];
  6738. invokeResolver(resolver, this);
  6739. }
  6740. Promise.prototype = {
  6741. constructor: Promise,
  6742. _state: PENDING,
  6743. _then: null,
  6744. _data: undefined,
  6745. _handled: false,
  6746. then: function (onFulfillment, onRejection) {
  6747. var subscriber = {
  6748. owner: this,
  6749. then: new this.constructor(NOOP),
  6750. fulfilled: onFulfillment,
  6751. rejected: onRejection
  6752. };
  6753. if ((onRejection || onFulfillment) && !this._handled) {
  6754. this._handled = true;
  6755. if (this._state === REJECTED && isNode) {
  6756. asyncCall(notifyRejectionHandled, this);
  6757. }
  6758. }
  6759. if (this._state === FULFILLED || this._state === REJECTED) {
  6760. // already resolved, call callback async
  6761. asyncCall(invokeCallback, subscriber);
  6762. } else {
  6763. // subscribe
  6764. this._then.push(subscriber);
  6765. }
  6766. return subscriber.then;
  6767. },
  6768. catch: function (onRejection) {
  6769. return this.then(null, onRejection);
  6770. }
  6771. };
  6772. Promise.all = function (promises) {
  6773. if (!Array.isArray(promises)) {
  6774. throw new TypeError('You must pass an array to Promise.all().');
  6775. }
  6776. return new Promise(function (resolve, reject) {
  6777. var results = [];
  6778. var remaining = 0;
  6779. function resolver(index) {
  6780. remaining++;
  6781. return function (value) {
  6782. results[index] = value;
  6783. if (!--remaining) {
  6784. resolve(results);
  6785. }
  6786. };
  6787. }
  6788. for (var i = 0, promise; i < promises.length; i++) {
  6789. promise = promises[i];
  6790. if (promise && typeof promise.then === 'function') {
  6791. promise.then(resolver(i), reject);
  6792. } else {
  6793. results[i] = promise;
  6794. }
  6795. }
  6796. if (!remaining) {
  6797. resolve(results);
  6798. }
  6799. });
  6800. };
  6801. Promise.race = function (promises) {
  6802. if (!Array.isArray(promises)) {
  6803. throw new TypeError('You must pass an array to Promise.race().');
  6804. }
  6805. return new Promise(function (resolve, reject) {
  6806. for (var i = 0, promise; i < promises.length; i++) {
  6807. promise = promises[i];
  6808. if (promise && typeof promise.then === 'function') {
  6809. promise.then(resolve, reject);
  6810. } else {
  6811. resolve(promise);
  6812. }
  6813. }
  6814. });
  6815. };
  6816. Promise.resolve = function (value) {
  6817. if (value && typeof value === 'object' && value.constructor === Promise) {
  6818. return value;
  6819. }
  6820. return new Promise(function (resolve) {
  6821. resolve(value);
  6822. });
  6823. };
  6824. Promise.reject = function (reason) {
  6825. return new Promise(function (resolve, reject) {
  6826. reject(reason);
  6827. });
  6828. };
  6829. module.exports = Promise;
  6830. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7), __webpack_require__(17).setImmediate))
  6831. /***/ }),
  6832. /* 36 */
  6833. /***/ (function(module, exports, __webpack_require__) {
  6834. module.exports = __webpack_require__(2)
  6835. /***/ }),
  6836. /* 37 */
  6837. /***/ (function(module, exports, __webpack_require__) {
  6838. "use strict";
  6839. var Buffer = __webpack_require__(0).Buffer;
  6840. /*<replacement>*/
  6841. var bufferShim = __webpack_require__(10);
  6842. /*</replacement>*/
  6843. module.exports = BufferList;
  6844. function BufferList() {
  6845. this.head = null;
  6846. this.tail = null;
  6847. this.length = 0;
  6848. }
  6849. BufferList.prototype.push = function (v) {
  6850. var entry = { data: v, next: null };
  6851. if (this.length > 0) this.tail.next = entry;else this.head = entry;
  6852. this.tail = entry;
  6853. ++this.length;
  6854. };
  6855. BufferList.prototype.unshift = function (v) {
  6856. var entry = { data: v, next: this.head };
  6857. if (this.length === 0) this.tail = entry;
  6858. this.head = entry;
  6859. ++this.length;
  6860. };
  6861. BufferList.prototype.shift = function () {
  6862. if (this.length === 0) return;
  6863. var ret = this.head.data;
  6864. if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
  6865. --this.length;
  6866. return ret;
  6867. };
  6868. BufferList.prototype.clear = function () {
  6869. this.head = this.tail = null;
  6870. this.length = 0;
  6871. };
  6872. BufferList.prototype.join = function (s) {
  6873. if (this.length === 0) return '';
  6874. var p = this.head;
  6875. var ret = '' + p.data;
  6876. while (p = p.next) {
  6877. ret += s + p.data;
  6878. }return ret;
  6879. };
  6880. BufferList.prototype.concat = function (n) {
  6881. if (this.length === 0) return bufferShim.alloc(0);
  6882. if (this.length === 1) return this.head.data;
  6883. var ret = bufferShim.allocUnsafe(n >>> 0);
  6884. var p = this.head;
  6885. var i = 0;
  6886. while (p) {
  6887. p.data.copy(ret, i);
  6888. i += p.data.length;
  6889. p = p.next;
  6890. }
  6891. return ret;
  6892. };
  6893. /***/ }),
  6894. /* 38 */
  6895. /***/ (function(module, exports, __webpack_require__) {
  6896. module.exports = __webpack_require__(19)
  6897. /***/ }),
  6898. /* 39 */
  6899. /***/ (function(module, exports, __webpack_require__) {
  6900. /* WEBPACK VAR INJECTION */(function(process) {var Stream = (function (){
  6901. try {
  6902. return __webpack_require__(6); // hack to fix a circular dependency issue when used with browserify
  6903. } catch(_){}
  6904. }());
  6905. exports = module.exports = __webpack_require__(20);
  6906. exports.Stream = Stream || exports;
  6907. exports.Readable = exports;
  6908. exports.Writable = __webpack_require__(13);
  6909. exports.Duplex = __webpack_require__(2);
  6910. exports.Transform = __webpack_require__(12);
  6911. exports.PassThrough = __webpack_require__(19);
  6912. if (!process.browser && process.env.READABLE_STREAM === 'disable' && Stream) {
  6913. module.exports = Stream;
  6914. }
  6915. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
  6916. /***/ }),
  6917. /* 40 */
  6918. /***/ (function(module, exports, __webpack_require__) {
  6919. module.exports = __webpack_require__(12)
  6920. /***/ }),
  6921. /* 41 */
  6922. /***/ (function(module, exports, __webpack_require__) {
  6923. module.exports = __webpack_require__(13)
  6924. /***/ }),
  6925. /* 42 */
  6926. /***/ (function(module, exports, __webpack_require__) {
  6927. /* WEBPACK VAR INJECTION */(function(Buffer) {/*
  6928. CryptoJS v3.1.2
  6929. code.google.com/p/crypto-js
  6930. (c) 2009-2013 by Jeff Mott. All rights reserved.
  6931. code.google.com/p/crypto-js/wiki/License
  6932. */
  6933. /** @preserve
  6934. (c) 2012 by Cédric Mesnil. All rights reserved.
  6935. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
  6936. - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  6937. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  6938. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  6939. */
  6940. // constants table
  6941. var zl = [
  6942. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
  6943. 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,
  6944. 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,
  6945. 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,
  6946. 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13
  6947. ]
  6948. var zr = [
  6949. 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,
  6950. 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,
  6951. 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,
  6952. 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,
  6953. 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11
  6954. ]
  6955. var sl = [
  6956. 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,
  6957. 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,
  6958. 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,
  6959. 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,
  6960. 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6
  6961. ]
  6962. var sr = [
  6963. 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,
  6964. 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,
  6965. 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,
  6966. 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,
  6967. 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11
  6968. ]
  6969. var hl = [0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E]
  6970. var hr = [0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000]
  6971. function bytesToWords (bytes) {
  6972. var words = []
  6973. for (var i = 0, b = 0; i < bytes.length; i++, b += 8) {
  6974. words[b >>> 5] |= bytes[i] << (24 - b % 32)
  6975. }
  6976. return words
  6977. }
  6978. function wordsToBytes (words) {
  6979. var bytes = []
  6980. for (var b = 0; b < words.length * 32; b += 8) {
  6981. bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF)
  6982. }
  6983. return bytes
  6984. }
  6985. function processBlock (H, M, offset) {
  6986. // swap endian
  6987. for (var i = 0; i < 16; i++) {
  6988. var offset_i = offset + i
  6989. var M_offset_i = M[offset_i]
  6990. // Swap
  6991. M[offset_i] = (
  6992. (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) |
  6993. (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00)
  6994. )
  6995. }
  6996. // Working variables
  6997. var al, bl, cl, dl, el
  6998. var ar, br, cr, dr, er
  6999. ar = al = H[0]
  7000. br = bl = H[1]
  7001. cr = cl = H[2]
  7002. dr = dl = H[3]
  7003. er = el = H[4]
  7004. // computation
  7005. var t
  7006. for (i = 0; i < 80; i += 1) {
  7007. t = (al + M[offset + zl[i]]) | 0
  7008. if (i < 16) {
  7009. t += f1(bl, cl, dl) + hl[0]
  7010. } else if (i < 32) {
  7011. t += f2(bl, cl, dl) + hl[1]
  7012. } else if (i < 48) {
  7013. t += f3(bl, cl, dl) + hl[2]
  7014. } else if (i < 64) {
  7015. t += f4(bl, cl, dl) + hl[3]
  7016. } else {// if (i<80) {
  7017. t += f5(bl, cl, dl) + hl[4]
  7018. }
  7019. t = t | 0
  7020. t = rotl(t, sl[i])
  7021. t = (t + el) | 0
  7022. al = el
  7023. el = dl
  7024. dl = rotl(cl, 10)
  7025. cl = bl
  7026. bl = t
  7027. t = (ar + M[offset + zr[i]]) | 0
  7028. if (i < 16) {
  7029. t += f5(br, cr, dr) + hr[0]
  7030. } else if (i < 32) {
  7031. t += f4(br, cr, dr) + hr[1]
  7032. } else if (i < 48) {
  7033. t += f3(br, cr, dr) + hr[2]
  7034. } else if (i < 64) {
  7035. t += f2(br, cr, dr) + hr[3]
  7036. } else {// if (i<80) {
  7037. t += f1(br, cr, dr) + hr[4]
  7038. }
  7039. t = t | 0
  7040. t = rotl(t, sr[i])
  7041. t = (t + er) | 0
  7042. ar = er
  7043. er = dr
  7044. dr = rotl(cr, 10)
  7045. cr = br
  7046. br = t
  7047. }
  7048. // intermediate hash value
  7049. t = (H[1] + cl + dr) | 0
  7050. H[1] = (H[2] + dl + er) | 0
  7051. H[2] = (H[3] + el + ar) | 0
  7052. H[3] = (H[4] + al + br) | 0
  7053. H[4] = (H[0] + bl + cr) | 0
  7054. H[0] = t
  7055. }
  7056. function f1 (x, y, z) {
  7057. return ((x) ^ (y) ^ (z))
  7058. }
  7059. function f2 (x, y, z) {
  7060. return (((x) & (y)) | ((~x) & (z)))
  7061. }
  7062. function f3 (x, y, z) {
  7063. return (((x) | (~(y))) ^ (z))
  7064. }
  7065. function f4 (x, y, z) {
  7066. return (((x) & (z)) | ((y) & (~(z))))
  7067. }
  7068. function f5 (x, y, z) {
  7069. return ((x) ^ ((y) | (~(z))))
  7070. }
  7071. function rotl (x, n) {
  7072. return (x << n) | (x >>> (32 - n))
  7073. }
  7074. function ripemd160 (message) {
  7075. var H = [0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]
  7076. if (typeof message === 'string') {
  7077. message = new Buffer(message, 'utf8')
  7078. }
  7079. var m = bytesToWords(message)
  7080. var nBitsLeft = message.length * 8
  7081. var nBitsTotal = message.length * 8
  7082. // Add padding
  7083. m[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32)
  7084. m[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (
  7085. (((nBitsTotal << 8) | (nBitsTotal >>> 24)) & 0x00ff00ff) |
  7086. (((nBitsTotal << 24) | (nBitsTotal >>> 8)) & 0xff00ff00)
  7087. )
  7088. for (var i = 0; i < m.length; i += 16) {
  7089. processBlock(H, m, i)
  7090. }
  7091. // swap endian
  7092. for (i = 0; i < 5; i++) {
  7093. // shortcut
  7094. var H_i = H[i]
  7095. // Swap
  7096. H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) |
  7097. (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00)
  7098. }
  7099. var digestbytes = wordsToBytes(H)
  7100. return new Buffer(digestbytes)
  7101. }
  7102. module.exports = ripemd160
  7103. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  7104. /***/ }),
  7105. /* 43 */
  7106. /***/ (function(module, exports, __webpack_require__) {
  7107. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  7108. "use strict";
  7109. if (global.setImmediate) {
  7110. return;
  7111. }
  7112. var nextHandle = 1; // Spec says greater than zero
  7113. var tasksByHandle = {};
  7114. var currentlyRunningATask = false;
  7115. var doc = global.document;
  7116. var registerImmediate;
  7117. function setImmediate(callback) {
  7118. // Callback can either be a function or a string
  7119. if (typeof callback !== "function") {
  7120. callback = new Function("" + callback);
  7121. }
  7122. // Copy function arguments
  7123. var args = new Array(arguments.length - 1);
  7124. for (var i = 0; i < args.length; i++) {
  7125. args[i] = arguments[i + 1];
  7126. }
  7127. // Store and register the task
  7128. var task = { callback: callback, args: args };
  7129. tasksByHandle[nextHandle] = task;
  7130. registerImmediate(nextHandle);
  7131. return nextHandle++;
  7132. }
  7133. function clearImmediate(handle) {
  7134. delete tasksByHandle[handle];
  7135. }
  7136. function run(task) {
  7137. var callback = task.callback;
  7138. var args = task.args;
  7139. switch (args.length) {
  7140. case 0:
  7141. callback();
  7142. break;
  7143. case 1:
  7144. callback(args[0]);
  7145. break;
  7146. case 2:
  7147. callback(args[0], args[1]);
  7148. break;
  7149. case 3:
  7150. callback(args[0], args[1], args[2]);
  7151. break;
  7152. default:
  7153. callback.apply(undefined, args);
  7154. break;
  7155. }
  7156. }
  7157. function runIfPresent(handle) {
  7158. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  7159. // So if we're currently running a task, we'll need to delay this invocation.
  7160. if (currentlyRunningATask) {
  7161. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  7162. // "too much recursion" error.
  7163. setTimeout(runIfPresent, 0, handle);
  7164. } else {
  7165. var task = tasksByHandle[handle];
  7166. if (task) {
  7167. currentlyRunningATask = true;
  7168. try {
  7169. run(task);
  7170. } finally {
  7171. clearImmediate(handle);
  7172. currentlyRunningATask = false;
  7173. }
  7174. }
  7175. }
  7176. }
  7177. function installNextTickImplementation() {
  7178. registerImmediate = function(handle) {
  7179. process.nextTick(function () { runIfPresent(handle); });
  7180. };
  7181. }
  7182. function canUsePostMessage() {
  7183. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  7184. // where `global.postMessage` means something completely different and can't be used for this purpose.
  7185. if (global.postMessage && !global.importScripts) {
  7186. var postMessageIsAsynchronous = true;
  7187. var oldOnMessage = global.onmessage;
  7188. global.onmessage = function() {
  7189. postMessageIsAsynchronous = false;
  7190. };
  7191. global.postMessage("", "*");
  7192. global.onmessage = oldOnMessage;
  7193. return postMessageIsAsynchronous;
  7194. }
  7195. }
  7196. function installPostMessageImplementation() {
  7197. // Installs an event handler on `global` for the `message` event: see
  7198. // * https://developer.mozilla.org/en/DOM/window.postMessage
  7199. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  7200. var messagePrefix = "setImmediate$" + Math.random() + "$";
  7201. var onGlobalMessage = function(event) {
  7202. if (event.source === global &&
  7203. typeof event.data === "string" &&
  7204. event.data.indexOf(messagePrefix) === 0) {
  7205. runIfPresent(+event.data.slice(messagePrefix.length));
  7206. }
  7207. };
  7208. if (global.addEventListener) {
  7209. global.addEventListener("message", onGlobalMessage, false);
  7210. } else {
  7211. global.attachEvent("onmessage", onGlobalMessage);
  7212. }
  7213. registerImmediate = function(handle) {
  7214. global.postMessage(messagePrefix + handle, "*");
  7215. };
  7216. }
  7217. function installMessageChannelImplementation() {
  7218. var channel = new MessageChannel();
  7219. channel.port1.onmessage = function(event) {
  7220. var handle = event.data;
  7221. runIfPresent(handle);
  7222. };
  7223. registerImmediate = function(handle) {
  7224. channel.port2.postMessage(handle);
  7225. };
  7226. }
  7227. function installReadyStateChangeImplementation() {
  7228. var html = doc.documentElement;
  7229. registerImmediate = function(handle) {
  7230. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  7231. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  7232. var script = doc.createElement("script");
  7233. script.onreadystatechange = function () {
  7234. runIfPresent(handle);
  7235. script.onreadystatechange = null;
  7236. html.removeChild(script);
  7237. script = null;
  7238. };
  7239. html.appendChild(script);
  7240. };
  7241. }
  7242. function installSetTimeoutImplementation() {
  7243. registerImmediate = function(handle) {
  7244. setTimeout(runIfPresent, 0, handle);
  7245. };
  7246. }
  7247. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  7248. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  7249. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  7250. // Don't get fooled by e.g. browserify environments.
  7251. if ({}.toString.call(global.process) === "[object process]") {
  7252. // For Node.js before 0.9
  7253. installNextTickImplementation();
  7254. } else if (canUsePostMessage()) {
  7255. // For non-IE10 modern browsers
  7256. installPostMessageImplementation();
  7257. } else if (global.MessageChannel) {
  7258. // For web workers, where supported
  7259. installMessageChannelImplementation();
  7260. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  7261. // For IE 6–8
  7262. installReadyStateChangeImplementation();
  7263. } else {
  7264. // For older browsers
  7265. installSetTimeoutImplementation();
  7266. }
  7267. attachTo.setImmediate = setImmediate;
  7268. attachTo.clearImmediate = clearImmediate;
  7269. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  7270. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7), __webpack_require__(3)))
  7271. /***/ }),
  7272. /* 44 */
  7273. /***/ (function(module, exports, __webpack_require__) {
  7274. var exports = module.exports = function SHA (algorithm) {
  7275. algorithm = algorithm.toLowerCase()
  7276. var Algorithm = exports[algorithm]
  7277. if (!Algorithm) throw new Error(algorithm + ' is not supported (we accept pull requests)')
  7278. return new Algorithm()
  7279. }
  7280. exports.sha = __webpack_require__(45)
  7281. exports.sha1 = __webpack_require__(46)
  7282. exports.sha224 = __webpack_require__(47)
  7283. exports.sha256 = __webpack_require__(21)
  7284. exports.sha384 = __webpack_require__(48)
  7285. exports.sha512 = __webpack_require__(22)
  7286. /***/ }),
  7287. /* 45 */
  7288. /***/ (function(module, exports, __webpack_require__) {
  7289. /* WEBPACK VAR INJECTION */(function(Buffer) {/*
  7290. * A JavaScript implementation of the Secure Hash Algorithm, SHA-0, as defined
  7291. * in FIPS PUB 180-1
  7292. * This source code is derived from sha1.js of the same repository.
  7293. * The difference between SHA-0 and SHA-1 is just a bitwise rotate left
  7294. * operation was added.
  7295. */
  7296. var inherits = __webpack_require__(1)
  7297. var Hash = __webpack_require__(4)
  7298. var K = [
  7299. 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0
  7300. ]
  7301. var W = new Array(80)
  7302. function Sha () {
  7303. this.init()
  7304. this._w = W
  7305. Hash.call(this, 64, 56)
  7306. }
  7307. inherits(Sha, Hash)
  7308. Sha.prototype.init = function () {
  7309. this._a = 0x67452301
  7310. this._b = 0xefcdab89
  7311. this._c = 0x98badcfe
  7312. this._d = 0x10325476
  7313. this._e = 0xc3d2e1f0
  7314. return this
  7315. }
  7316. function rotl5 (num) {
  7317. return (num << 5) | (num >>> 27)
  7318. }
  7319. function rotl30 (num) {
  7320. return (num << 30) | (num >>> 2)
  7321. }
  7322. function ft (s, b, c, d) {
  7323. if (s === 0) return (b & c) | ((~b) & d)
  7324. if (s === 2) return (b & c) | (b & d) | (c & d)
  7325. return b ^ c ^ d
  7326. }
  7327. Sha.prototype._update = function (M) {
  7328. var W = this._w
  7329. var a = this._a | 0
  7330. var b = this._b | 0
  7331. var c = this._c | 0
  7332. var d = this._d | 0
  7333. var e = this._e | 0
  7334. for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)
  7335. for (; i < 80; ++i) W[i] = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]
  7336. for (var j = 0; j < 80; ++j) {
  7337. var s = ~~(j / 20)
  7338. var t = (rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s]) | 0
  7339. e = d
  7340. d = c
  7341. c = rotl30(b)
  7342. b = a
  7343. a = t
  7344. }
  7345. this._a = (a + this._a) | 0
  7346. this._b = (b + this._b) | 0
  7347. this._c = (c + this._c) | 0
  7348. this._d = (d + this._d) | 0
  7349. this._e = (e + this._e) | 0
  7350. }
  7351. Sha.prototype._hash = function () {
  7352. var H = new Buffer(20)
  7353. H.writeInt32BE(this._a | 0, 0)
  7354. H.writeInt32BE(this._b | 0, 4)
  7355. H.writeInt32BE(this._c | 0, 8)
  7356. H.writeInt32BE(this._d | 0, 12)
  7357. H.writeInt32BE(this._e | 0, 16)
  7358. return H
  7359. }
  7360. module.exports = Sha
  7361. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  7362. /***/ }),
  7363. /* 46 */
  7364. /***/ (function(module, exports, __webpack_require__) {
  7365. /* WEBPACK VAR INJECTION */(function(Buffer) {/*
  7366. * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined
  7367. * in FIPS PUB 180-1
  7368. * Version 2.1a Copyright Paul Johnston 2000 - 2002.
  7369. * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
  7370. * Distributed under the BSD License
  7371. * See http://pajhome.org.uk/crypt/md5 for details.
  7372. */
  7373. var inherits = __webpack_require__(1)
  7374. var Hash = __webpack_require__(4)
  7375. var K = [
  7376. 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0
  7377. ]
  7378. var W = new Array(80)
  7379. function Sha1 () {
  7380. this.init()
  7381. this._w = W
  7382. Hash.call(this, 64, 56)
  7383. }
  7384. inherits(Sha1, Hash)
  7385. Sha1.prototype.init = function () {
  7386. this._a = 0x67452301
  7387. this._b = 0xefcdab89
  7388. this._c = 0x98badcfe
  7389. this._d = 0x10325476
  7390. this._e = 0xc3d2e1f0
  7391. return this
  7392. }
  7393. function rotl1 (num) {
  7394. return (num << 1) | (num >>> 31)
  7395. }
  7396. function rotl5 (num) {
  7397. return (num << 5) | (num >>> 27)
  7398. }
  7399. function rotl30 (num) {
  7400. return (num << 30) | (num >>> 2)
  7401. }
  7402. function ft (s, b, c, d) {
  7403. if (s === 0) return (b & c) | ((~b) & d)
  7404. if (s === 2) return (b & c) | (b & d) | (c & d)
  7405. return b ^ c ^ d
  7406. }
  7407. Sha1.prototype._update = function (M) {
  7408. var W = this._w
  7409. var a = this._a | 0
  7410. var b = this._b | 0
  7411. var c = this._c | 0
  7412. var d = this._d | 0
  7413. var e = this._e | 0
  7414. for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)
  7415. for (; i < 80; ++i) W[i] = rotl1(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16])
  7416. for (var j = 0; j < 80; ++j) {
  7417. var s = ~~(j / 20)
  7418. var t = (rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s]) | 0
  7419. e = d
  7420. d = c
  7421. c = rotl30(b)
  7422. b = a
  7423. a = t
  7424. }
  7425. this._a = (a + this._a) | 0
  7426. this._b = (b + this._b) | 0
  7427. this._c = (c + this._c) | 0
  7428. this._d = (d + this._d) | 0
  7429. this._e = (e + this._e) | 0
  7430. }
  7431. Sha1.prototype._hash = function () {
  7432. var H = new Buffer(20)
  7433. H.writeInt32BE(this._a | 0, 0)
  7434. H.writeInt32BE(this._b | 0, 4)
  7435. H.writeInt32BE(this._c | 0, 8)
  7436. H.writeInt32BE(this._d | 0, 12)
  7437. H.writeInt32BE(this._e | 0, 16)
  7438. return H
  7439. }
  7440. module.exports = Sha1
  7441. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  7442. /***/ }),
  7443. /* 47 */
  7444. /***/ (function(module, exports, __webpack_require__) {
  7445. /* WEBPACK VAR INJECTION */(function(Buffer) {/**
  7446. * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
  7447. * in FIPS 180-2
  7448. * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009.
  7449. * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
  7450. *
  7451. */
  7452. var inherits = __webpack_require__(1)
  7453. var Sha256 = __webpack_require__(21)
  7454. var Hash = __webpack_require__(4)
  7455. var W = new Array(64)
  7456. function Sha224 () {
  7457. this.init()
  7458. this._w = W // new Array(64)
  7459. Hash.call(this, 64, 56)
  7460. }
  7461. inherits(Sha224, Sha256)
  7462. Sha224.prototype.init = function () {
  7463. this._a = 0xc1059ed8
  7464. this._b = 0x367cd507
  7465. this._c = 0x3070dd17
  7466. this._d = 0xf70e5939
  7467. this._e = 0xffc00b31
  7468. this._f = 0x68581511
  7469. this._g = 0x64f98fa7
  7470. this._h = 0xbefa4fa4
  7471. return this
  7472. }
  7473. Sha224.prototype._hash = function () {
  7474. var H = new Buffer(28)
  7475. H.writeInt32BE(this._a, 0)
  7476. H.writeInt32BE(this._b, 4)
  7477. H.writeInt32BE(this._c, 8)
  7478. H.writeInt32BE(this._d, 12)
  7479. H.writeInt32BE(this._e, 16)
  7480. H.writeInt32BE(this._f, 20)
  7481. H.writeInt32BE(this._g, 24)
  7482. return H
  7483. }
  7484. module.exports = Sha224
  7485. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  7486. /***/ }),
  7487. /* 48 */
  7488. /***/ (function(module, exports, __webpack_require__) {
  7489. /* WEBPACK VAR INJECTION */(function(Buffer) {var inherits = __webpack_require__(1)
  7490. var SHA512 = __webpack_require__(22)
  7491. var Hash = __webpack_require__(4)
  7492. var W = new Array(160)
  7493. function Sha384 () {
  7494. this.init()
  7495. this._w = W
  7496. Hash.call(this, 128, 112)
  7497. }
  7498. inherits(Sha384, SHA512)
  7499. Sha384.prototype.init = function () {
  7500. this._ah = 0xcbbb9d5d
  7501. this._bh = 0x629a292a
  7502. this._ch = 0x9159015a
  7503. this._dh = 0x152fecd8
  7504. this._eh = 0x67332667
  7505. this._fh = 0x8eb44a87
  7506. this._gh = 0xdb0c2e0d
  7507. this._hh = 0x47b5481d
  7508. this._al = 0xc1059ed8
  7509. this._bl = 0x367cd507
  7510. this._cl = 0x3070dd17
  7511. this._dl = 0xf70e5939
  7512. this._el = 0xffc00b31
  7513. this._fl = 0x68581511
  7514. this._gl = 0x64f98fa7
  7515. this._hl = 0xbefa4fa4
  7516. return this
  7517. }
  7518. Sha384.prototype._hash = function () {
  7519. var H = new Buffer(48)
  7520. function writeInt64BE (h, l, offset) {
  7521. H.writeInt32BE(h, offset)
  7522. H.writeInt32BE(l, offset + 4)
  7523. }
  7524. writeInt64BE(this._ah, this._al, 0)
  7525. writeInt64BE(this._bh, this._bl, 8)
  7526. writeInt64BE(this._ch, this._cl, 16)
  7527. writeInt64BE(this._dh, this._dl, 24)
  7528. writeInt64BE(this._eh, this._el, 32)
  7529. writeInt64BE(this._fh, this._fl, 40)
  7530. return H
  7531. }
  7532. module.exports = Sha384
  7533. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  7534. /***/ }),
  7535. /* 49 */
  7536. /***/ (function(module, exports, __webpack_require__) {
  7537. /* WEBPACK VAR INJECTION */(function(global) {
  7538. /**
  7539. * Module exports.
  7540. */
  7541. module.exports = deprecate;
  7542. /**
  7543. * Mark that a method should not be used.
  7544. * Returns a modified function which warns once by default.
  7545. *
  7546. * If `localStorage.noDeprecation = true` is set, then it is a no-op.
  7547. *
  7548. * If `localStorage.throwDeprecation = true` is set, then deprecated functions
  7549. * will throw an Error when invoked.
  7550. *
  7551. * If `localStorage.traceDeprecation = true` is set, then deprecated functions
  7552. * will invoke `console.trace()` instead of `console.error()`.
  7553. *
  7554. * @param {Function} fn - the function to deprecate
  7555. * @param {String} msg - the string to print to the console when `fn` is invoked
  7556. * @returns {Function} a new "deprecated" version of `fn`
  7557. * @api public
  7558. */
  7559. function deprecate (fn, msg) {
  7560. if (config('noDeprecation')) {
  7561. return fn;
  7562. }
  7563. var warned = false;
  7564. function deprecated() {
  7565. if (!warned) {
  7566. if (config('throwDeprecation')) {
  7567. throw new Error(msg);
  7568. } else if (config('traceDeprecation')) {
  7569. console.trace(msg);
  7570. } else {
  7571. console.warn(msg);
  7572. }
  7573. warned = true;
  7574. }
  7575. return fn.apply(this, arguments);
  7576. }
  7577. return deprecated;
  7578. }
  7579. /**
  7580. * Checks `localStorage` for boolean values for the given `name`.
  7581. *
  7582. * @param {String} name
  7583. * @returns {Boolean}
  7584. * @api private
  7585. */
  7586. function config (name) {
  7587. // accessing global.localStorage can trigger a DOMException in sandboxed iframes
  7588. try {
  7589. if (!global.localStorage) return false;
  7590. } catch (_) {
  7591. return false;
  7592. }
  7593. var val = global.localStorage[name];
  7594. if (null == val) return false;
  7595. return String(val).toLowerCase() === 'true';
  7596. }
  7597. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7)))
  7598. /***/ }),
  7599. /* 50 */
  7600. /***/ (function(module, exports) {
  7601. module.exports = function(module) {
  7602. if(!module.webpackPolyfill) {
  7603. module.deprecate = function() {};
  7604. module.paths = [];
  7605. // module.parent = undefined by default
  7606. if(!module.children) module.children = [];
  7607. Object.defineProperty(module, "loaded", {
  7608. enumerable: true,
  7609. get: function() {
  7610. return module.l;
  7611. }
  7612. });
  7613. Object.defineProperty(module, "id", {
  7614. enumerable: true,
  7615. get: function() {
  7616. return module.i;
  7617. }
  7618. });
  7619. module.webpackPolyfill = 1;
  7620. }
  7621. return module;
  7622. };
  7623. /***/ }),
  7624. /* 51 */
  7625. /***/ (function(module, exports) {
  7626. /* (ignored) */
  7627. /***/ }),
  7628. /* 52 */
  7629. /***/ (function(module, exports, __webpack_require__) {
  7630. var v1 = __webpack_require__(23);
  7631. var v2 = __webpack_require__(24);
  7632. var pbkdf2 = __webpack_require__(9);
  7633. var objectAssign = __webpack_require__(25);
  7634. module.exports = {
  7635. encryptLogin: v1.encryptLogin,
  7636. renderPassword: v1.renderPassword,
  7637. createFingerprint: v1.createFingerprint,
  7638. _deriveEncryptedLogin: v1._deriveEncryptedLogin,
  7639. _getPasswordTemplate: v1._getPasswordTemplate,
  7640. _prettyPrint: v1._prettyPrint,
  7641. _string2charCodes: v1._string2charCodes,
  7642. _getCharType: v1._getCharType,
  7643. _getPasswordChar: v1._getPasswordChar,
  7644. _createHmac: v1._createHmac,
  7645. generatePassword: generatePassword,
  7646. _calcEntropy: v2._calcEntropy,
  7647. _consumeEntropy: v2._consumeEntropy,
  7648. _getSetOfCharacters: v2._getSetOfCharacters,
  7649. _getConfiguredRules: v2._getConfiguredRules,
  7650. _insertStringPseudoRandomly: v2._insertStringPseudoRandomly,
  7651. _getOneCharPerRule: v2._getOneCharPerRule,
  7652. _renderPassword: v2._renderPassword,
  7653. pbkdf2: pbkdf2
  7654. };
  7655. var defaultPasswordProfile = {
  7656. version: 2,
  7657. lowercase: true,
  7658. numbers: true,
  7659. uppercase: true,
  7660. symbols: true,
  7661. keylen: 32,
  7662. digest: 'sha256',
  7663. length: 16,
  7664. index: 1,
  7665. iterations: 100000
  7666. };
  7667. function generatePassword(site, login, masterPassword, passwordProfile) {
  7668. var _passwordProfile = objectAssign({}, defaultPasswordProfile, passwordProfile);
  7669. if (_passwordProfile.version === 1) {
  7670. var options = {
  7671. counter: _passwordProfile.counter,
  7672. length: _passwordProfile.length,
  7673. lowercase: _passwordProfile.lowercase,
  7674. uppercase: _passwordProfile.uppercase,
  7675. numbers: _passwordProfile.numbers,
  7676. symbols: _passwordProfile.symbols
  7677. };
  7678. return v1.encryptLogin(login, masterPassword).then(function (encryptedLogin) {
  7679. return v1.renderPassword(encryptedLogin, site, options).then(function (generatedPassword) {
  7680. return generatedPassword;
  7681. });
  7682. });
  7683. }
  7684. return v2.generatePassword(site, login, masterPassword, _passwordProfile);
  7685. }
  7686. /***/ })
  7687. /******/ ]);
  7688. });