From f3f389f81f7caf84175e93c15f943eed16d6651f Mon Sep 17 00:00:00 2001 From: Mridul Aggarwal Date: Fri, 7 Sep 2018 17:24:41 +0530 Subject: [PATCH 1/8] Add manifest.json --- examples/index.html | 2 +- examples/manifest.json | 21 +++++++++++++++++++++ icons/ic_512.png | Bin 0 -> 48895 bytes 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 examples/manifest.json create mode 100644 icons/ic_512.png diff --git a/examples/index.html b/examples/index.html index e2cbd6347e..2805e22952 100644 --- a/examples/index.html +++ b/examples/index.html @@ -8,7 +8,7 @@ - + Image Sequencer diff --git a/examples/manifest.json b/examples/manifest.json new file mode 100644 index 0000000000..d90fa4d357 --- /dev/null +++ b/examples/manifest.json @@ -0,0 +1,21 @@ +{ + "short_name": "IS", + "name": "Image Sequencer", + "icons": [ + { + "src": "../icons/ic_192.png", + "type": "image/png", + "sizes": "192x192" + }, + { + "src": "../icons/ic_512.png", + "type": "image/png", + "sizes": "512x512" + } + ], + "start_url": "/examples/#steps=", + "background_color": "#428bca", + "display": "standalone", + "scope": "/examples/", + "theme_color": "#428bca" +} \ No newline at end of file diff --git a/icons/ic_512.png b/icons/ic_512.png new file mode 100644 index 0000000000000000000000000000000000000000..a80674a1d0fa4b4d34c1f6d71cfb2847fac92a7d GIT binary patch literal 48895 zcmaI7Wn5I<_da}P7`g^fI)(;8>24X2E&)ji=?>`{LKp;8q#Hqy?nX+G4wdc>>5z{3 z&;5NqzqikenKN%@?X~w>`&!qE6RoB3f)I}y4*&o{WhJ-{0D#dy!2k{x`ti?q;s*V| zbyG6*1OR-p|2`lfJ(CguV1P1QPS-bcfAN(MjdBgoO$fY&{}_hruia1}EKqBk;d$78 zdE2p2KiVz5UBMUNU-&IojZVQ9 z0t?t}xY410=@smMQTgZ}tk|V+?4a?i-7KVx?^=hN>Zbp|@3MJpTlM;G;^`MDV7D+m zC35{q<9glnXHUssx@R>b+kWL^X`9Qa;)B-1F}Y&T|28xvHf_k5z&u1{tU;Jy!2|^n zbmD}9cq1qgU01>BCK>CuY-8KR^fK*I2c0{xT2+~LvaSquBifziMVTd{)3|Ugh^-tnQK(zWyr=FFA=1W6U+g`N_$XcH^su2qIgJ43DWFINE<1ErZoNmFQheAEBV>;1J^~B2@5%6319&qQJA0mluKBqA% z;YNwg!irGo4V8=b@dTa#kLi}#bu{RCJ|5Yw{h6(E`nvbd$4|TW0q7(N{Q%I)?m#<3 zafl$4%WSkb10dzVaD#Tv!M1yma0bPBciklStJMqokPq9qkitnQ1M0Q&&ZNmNK-M(H zPmHF!Nq(6$;SCcTVoAM;*%F{Fuwv>i-kb9`AkNyipf~x3*?|9iAyg{{P7P2)1d+V$ zQtcHOMfh6GTF-lIBqN~80I66t=Qrmi>_%(prPlS_Zp#IHQ05nGYmdHx4ujZ}&uJB3 zD@<{%fE5HH2nc}AVN|h)Nr8GBaRZ*$sFF64487{Myj5r2wCD&FDAP)2(zB{rkB(+y zXJb=gC1q7%)K-b#bBx;N%a9KWMIZY(??=BIhOD|5R-9h=na!;0&QccqVzOR<7>PCD z5uZw`ojjvIMUdfFb+C|OWZEw%tBdhz+;>5m*IokOPR3B+-LY4WFckUt|nyeSs3~ZQjHqX-V7}I=>)k zL81^V85J+lCzseSe#V>@`99uUr^24D4$0p1arl&5k%+!`MmAp1Hl?l30MqJ7T3eR^ z9;;<5p=HNv+!(k4(=iyw6f6#i!yITl)cfogJwD^JfS%w}`SdaPOvc<5wgzWzU3v$; z{KN7KbHT;w%~*qBZj5lo zd5youMe-dvdA!-RbDi<(g(!7$Yd*(M_eU42(r--#Zt6!7>70bXg!5^a+-J-xSj~ng zrEQosKM{<$GX~BMrBIU+{2cc^-f6-yxOt>E2L~upm5q|61Ds{4!DtTy9dCaa@}H0< z1_9!H+pA|du$teV`3%1#A$G)_A7t4;h)f(nktgkbl;iLqr8-2k>>>*C1nJ8^tEH$t zm{+7|O%j!)#JMiY{F+Tx%fZDS$bGiwxjr@Sdp{od>!&8=(GnGb5C<`SMbfj)=#dO~ z;nT1W$hy#(n#4N(jv1ApR(oeV-ZXLEzf(B`pcUs=?GU7a-#mvMSx6fWfb7I2F+`98 zUSM*77Hg6z2FIxNAJHY-aB`9|o~>eo`Wm%OGvtpm6k| z9*UE|7g~O8$DBK9{uk zM*ICDWz00#5A;JoHk;(Q?)}f&@YM{8G2&qV`_tpTHj8UZ_zX#&d~5=(0njf>O=*_( z<)TxNX2+8vPiL3q0Hn3ecTjt;c|Ahaz6n{HSWz2{lsEUFBGDY35PPirGB+MFKa%m+ zf$LH=YeJ|+?K?-90-#En!`XmY&BnwD)BpHQgS41fL}su2$qd*VIR{rl|q(y^_sJMyIto@S|x+b)*r-<)p~VrWH19kv#i)X3F7 zr0u&)w}X1%(Y;jyX=W>mH7+z3%$h+yztiVRR;yHcxPWp}JIqf0P;p2J$#1K*%@#S9Ki3)ZxGPUPUfi zaE9~e#p-cCVX6R1fMS@A0_U4VQtd(e2W@c?S<_T>s1uxCq{IvTnSr(09@Wzjx2naQ zhXo=GouDerZqhH`3OJv5D%e)uSguTwYJ#0Bj1Z2qJ!r)3$NU|Q1Myf4$w(*uh7|390MqxQ@SKA1GyLs7MoXZVzU}fomB8*G;};bE#$WvYo%&D6#sYroKuP zoB3-iUq6R+fd8pML*jI#==5&urcv7#tlb_42YLyGmvuUw<90>$C$DVtK!_HX=P)P% z0c~m-qwwgwzYg)9AM>o8;OCKw#`?!>ORzP)uri>U{Szw?1GWd&mfIHwC^{l#lop*5 zWaE!r(l+m|_`taFpaeR@(F@WQOj(|Yon~MRa+1PPEl_e1LK0mWHF?;sG|TY#79(1Z zq#*V&9*J(>8I~Z2-n1eHf@i!=^*o!)C#Q4m6I1R7b0cZoEd69|?oA87dUF50B{s*% zktZZiF(z2GJTt#Bcp^6tS7OB94``A6lVvBPcY9O$=qPQzCqg6A3YPRQiqd+d#y2u z0so&?*##B%#I9$kitDAzs4JoU6q$_s-PvrM!S^a81nkA-EQo$82RxJHWNQ7R-@wX{ zM^;Q04#2n3lP2!>vNkg4ht*#4Xa6u8sR9=P&lvoAE5D~Fi-eAMY)ZnI?o_gGbb_Z% zyBoO98Grm`jgbQ3hI%mN7!wgo|<6i61W+3}VTmE_H( zs3^K}8Jl)5d#Z(p@gf&&+sx z>tz3czec)KEv;i(x|BPbWP2Cxcz>KSh;>xuMLc4Pi5w1J*>g=D_D=W8rr^J-PVD-q zKzpaF8=ix`Ia+$ZIyU)GC94-FttTVPep$>_0P0Lx7eBqS_pp!?g!dLStnXP&HhvB` zALc3Zf7xmq7t+~79PLJ&OCOgqO&Dh9-quF0l0~7(_Ensu7-Rq`5`0Eitxg2qXvTS< zFW600-K>2|+`%lUNyL0~gE)^DA~w3$p1YxtaEE;T7+U4LHCC z4+ua=!l@(g(k(7OMF(T*@nk8#CLUUR#WXoY8FL_aT^M5U9og+6g2#01(mqr+ND!hF z9%hVo=J~x6BGPTYto3bvBu8qYGwWr7qQ|#&XXl}+Agh_>TDG<~qGePy&P*F&Pu|g{ zY`kkLjzgvVc^6`s5|rbz0tLshUw47^2-p3%O_?OCdg(|-d@>0;CK3u5N+osTNW#Kzn5*SDp&;=S=U8$&A_@_mV|Xyp<45*Yo^@f02Jz+D zPmuiL86qqMb&d!R;d&(05;8Gaf)kW5LqBcyOy7C5f0Fq-@ncs!;To@~-Lk{&c7eo04BR|CkxVOon?pF_o1wFp=IV<*91 zZ>&?D+8%M5eJr`BWAY~}kfcp)y_c(gndq)%;Y}se7l*QUq%ES6#Q?mfFcctwt;f8| z(bmDguDr&2FHl43zKx}^QHjT6AHh8gJth0M6O^}<`DOSq}_G8ij)wRX#om<^U@qc(on=QzRvAl9LjB9u?>B5Jc z*Xaooul})G*LW^ZO*zbmUTt14M=s~hV_Bv?uZaV?iraIe^t!2_{&rmHkTvy($Dv31 z?h`+oVwOLa<_y#)@3v)E1WC1#y%pY|ueF5_^>9N7^i>YB{WW)LCW)EE% zb2(9~$7A`c@dw1-FK+X5N=vvcNr;c-oZ}KgcJzqwcUZb;6wxOA%xl=dcG4x7kZ!6; zL(?W$*MY})+iP(780QkxT@U*5Pi2EnZO?iV?@v%ard@c`y4q786MWpqf1yF! zR_x5ZX9ffpGfE)_2SkGo25`=G+mP@ZOFMwqtfHh9Rc3qRv3BG8Imhv9#<@*ReQN7w zTq4CG=J@wLXa7FR#@-&O(6_MZ#wW}F#{LPFG>eU%8Jdoy-S%B{?CnscLRLN?Ti|fs zid8B7&Qm1UUANxqZJ8YkjYTJ$ODo%p7R|5Jf)h{X>3cPw!rz{r2)NPTR=X4f-h#%ZuvHmo$<07@_q1?i59*9DL>`gSux|N$JFjEK`_D zz+dWaAF!>NUqpwEUHxfZ0<@p#y=iPoxKz9W2^A1VR*zArK!XxPBfxp<2hdL(D6Q>= zdP3F!8IucT!{RVcIXZ!oC^l}QaJna931-zP2lbyk7>4UONJD$=L$KhXNCzwvW{+O& z=Wr9pueYlCC8#%5<+ggzA-w)AZ6bHU2ED;vmh+lYuLF-$ zgX3Lr34w}fg0qc2Ls_^Jj#cJ>{BBB(qW`zw1U|3Grmse+Zh0aPnAu)4YrXoK-pVAc zQY^p+wa3x2ohg{`)(^8U*KOZ_r1ux=Cw+CbCjRU^*XD6i(T7NIG2BwJdbm$-oI6x3 zAAN|a?wn>|^Cz9rn?~uk8sEs1{m-k~buJxg(j1-rGZt;P0@UijN-w{v@6mdNNohmn6>H_zM8MK2foM!#wjTuZ3^VeK)2aN39t967Y!o?m^b__2MF zUrNK2`nw8<>46{^Vb;mnJ`eHLswlOfd(CFEhjFflRi6A^*Ze$xY4F9mDCdsI8Ms1R zb!EfxZ^|XL9pEN`E6cml?=cuDK)iwbGT#uNt8~Qb%w1siN_=MS&GSGOWGO(348~4s zd4~gyIXRJLect!Uu&$qGX(DWun@W$5;C;Mp(>Lu4@6c|!#~&4~_xn`d+uPz5Ip%>n z|Cw5IF4wl}vq1gE;fs}?TmC|hyT-j%AIYZuweVvuxuYcDbp&59!S80Rrp+!ycI1>s z!ap8FZKI6LUQ~8oO>#o*LXoSY6EqgpFFLbqYK|LA#BV$e4^VEpk|DJ+H)2GC)1OXe zyX@P-UI{5{)j}#lv4C+e)0kCC8(Y%((~%9ACAGr}EVLs~qe2Y5&8WP&)a;bG`FEsq zCn&5JezQY$#lGUf?QARBsntBb#SWEP3wd-~R?g5_>Gp(oYcJ5~xf@vA#8qpMX7Wj0 zY4*jkUxQK!<_w9ZG88{w|5RjNFf3xTQ#cyr~*w)9BpB^+#%I`=Ixoy*k` z8`^KQ9xlKbO{%W<^N+_G^ZSlhJ2FDOZQ|5zXz2mr{6s?oW22TIKB1T3M_;0GG4v9m z+JlW*OO6e-QG3m1*H7Hbm&M5F$ICYJ}p!H@l<*x%9@oV{F3oIxEeNF>z zTO4JR&6l>e-67WPw<%fqs0Y7R)UqB`6lQP8&dJG}xdh1MBQ)knjZ2tZ=A;5YN?zS zAuk2=Xm5h64@w;BUMllJv>z4c<&wtZs8za8*P=N804ok7PQy8}YwFL^4wz;N1vXlT zEuMPf`%n+`-mg#-b4Ou=XGwdA{?+QM1kG6)AP7Rm;olYDd`*h^@lM(shO>0q1mI% zfevrB5UYNd_dS>ZmAy}gj^|2U(EWZ?tf4i5nm(nKYztVKaQ3xSSsC_AGv|oK!>*lr zG0JvY+7H=D+A76sD=+&(OSxIgj0~>XnzqPn|6r@R#2`~J|0Hq-HuyJG zPUy9gw1LTU$v-+`MNEiL!wt^a?pW)~W$5Bw-!;kH_#IVUv3@AIUpKt{=GOFP4! zP;`cCpCxirHPCcTQRp-xd%RVlCme_LXSW|KnGyXPCQ@a> z;j*EueK-l57O0lCXgc3v*W@ye&JZmr*_-%54o}2&dG9WxBM3Pb}K%9H&J4p}H zrwvp~**L8nW}Ay{qnQ3=={Osv@ePn6X`b*Vr#NL_ep?gOp=!GAIJ63arYL-s{(IV? zL$P-=eUze8>n=ov@hXi~c76J7n8RZhFWcHpZ*Ny2_wsC!bEC&mKZ_Qm9(6&FL>|V6 zNq?c2K(lvR7!*eXUHHgk-zsdZf2UY;-4wrYZThtAe#!k5rqYbp6L~nMQY>Z(D1*ML zNh>>%6MSorW&Rg)VDb0`WfFEJOK)(ZrS2D~oZPq>!X)Se7Vxcg-yt|hsyhUwfe|H% z^;R@hKbvjj)^ILZ2cOGqJ9yPt{_q(r2KbEcG~{Y>7xT@`pkQn0Ismg!QkfTIHSj5a zfoJCD-QK4;@9mfxm0$^u4*8+A3ww@dj( zEmwULBJILc&d8nyB{g&bNo5h}GXxh~OxHh}f$=4_ggqgfook7^uw@^($ela>UL&q+Pjo5 z&e*f`f>Z>5&V`WJlL_2@nic1%4~#Ff(pyJKJrPIQhWtCT^SP4O`?*?1PNu`~3s}jb z+Po$Mn1<5SokW}?;%p?Eec0X0k77?y7BfK#aD2oDQ&P^u1xLX|5;IA)tTjl~(bOi^ z*^uE>Yw9LgR{|g*F1^3kmZT-0)D|;5v?`f@yVih3@(Tb`-9dESpsu?37S?&34Ao|{ zU|N$s8rxbK-i%xL0tO3N^h@I(uQ&^A`bpiLb!N+~Qkj8@#4gmUo-Q-FL;DV2ZK6^- zU3cD6=RZs6;KmyxiMn(#)@a^()tt8AI?+9-ztw^or$$x61F=87JMl$r?q2V4hZIb> zW;quuaa!SiLehT2dnQ1$?ld=QRn55a!_B)&wV@<3+~B9&-9{mu>!9nA#Pmhx)htho zMrR5=FboNmvsx8hAHJwbH`|-&zEM1ET^7#>a-5N7drpDChEtqrt1Pk!+P|Ueb;Mzb zG~IG;1BQjoBlZ3(S-9-J3 z&WF%N`5Tj;ox~zWdyvfW6lwsdrMa~o>iX(3@S*j7T0~&^;f>oh>dovTbDl7QxBCDc zv-Ug!Gx62xp7*lmerGknV%(=z!P0);#&npH@1QF;O^{l`^At$c%kBW+Q(qscg}>}b z75b6&)4!%A>H3{(_(*%b(-A2e93*?St94X@I0tMUF0tjgrEE3B64%Js)(pwqw`T9E~ryz<66WzbGu`5Xz_HqOSr=`^C2|4 z0a=6(TUjS5NAFyj0I3764s9J8ZnZ=#oX^XLT)m3k`m24CN2@1M1V;zJf_b$2NRQ=^ zjxMI#vt6d2SNV&09iaZs+)I!-ll}@d2^>aQnxY#0QF9i-nU$6pQi$Zz?kyFCxya;S+kMHRk1H*$lZ^;;C{M4i< z#eu~k`GY|9^$|hqZSBxmhtMs$MWrZu%hIJvfDMHy0!(WkYFBZQNW%2qs>^3|`^3TY zhlIh2CBB%~zPFWLVChw1Oh91p3>(1dt`!;4!gu_yMv!*>t}?tB_1ohrUDjFle@Z@! zislfonod*Wjcltv>@+|r!mYIS=?P-mwBO0~{QHP%te{x=PnKNOkK?2lLo9VO$_GEX zC%oDT3oin?4@JjhLhYPG3KCnukvKw3HeA7QcmOn-Ilw^k>f9`92POU^gWu8|bMqv6 zrQ9y}n>q$!>_yy>HH4Rz)+jM|`{iyq%fhwDSUrlDmY%cdW#9t>8Gx8@>lOGPHns%W z)TDmG{HoX^b##UuS9X~mtF(V~Z_gWefuTacMq?>c&G<^2eMMi5H7K5r;tvK{Xdg*e5C8Bc>5U^-4iP-HAH`2)!;gF^sPd* zk_dHopYgDqqrmxsl6WY17qeqW93&zJq+X<<=}dGiVZ&_EbyA$SKPtoD;C8g8gZRCa zT$#E%4SMt`>jO{?F6QIYnf6<8KIpId*zMsu!}FSYh~`5 z#i^xaXp;lp!89ZURul`#m%aikc}WkWa|a=T#t8TOfu4q1mz$z#4F;!z;8iZ$&+K8R z^s-`adppp|bzj#)M$@TaI$jDa1}b0E7G}NKmc7|3^J0VP^lt-v8@-PWBQc(3P`NGT zvC_1=<*7o}{W3$QXnY3WT?A+fc2^L)m^?Iw*+0a4d%82}m| z`i-ri(AKl{x5na+=`I`8-`LwoWHRWg^x!6E9-)P%Vs;KOxPIWLG&QI-vGZcn-1OO* zxX6neU-B0<>P)tHfQwfaVxAl@iGXIF7bb1ElpCHo(nLFlI6GfS@i~KZ88msd(R-8U zC8@`)8uiVXyU-Y^yeG}4)!jKF-wXylGP{fI^dkgp^mawS+-k}=74;^nujr=|mX1i5 zeTSW1;Y=iI@;v#HsN?Ve1vKI6Hm#&4_wG_j)A4u$ouwV;r72@isA3UHO)IAdwhNKX z&mK!wf&jN>#mhJHAofTAXFVw(96Fh>(vorh_GH;n`I30_>J}ylIi2k_v%NzbQcu)4 z3*q^l9@jj&nIzCZCytYgI^w?O<*%xCLIUDYM$luBNAk^23Ngf(^E&ac55TJqMi3N? zrdN#J?^@FP`@CHCCw00&BK@@o1*WfFsc;IVAZ2lD5BR8*gFI8Cmd1^$Z--WqgEjtA zB^$XvGKGJQ3%i0k75+R(UoIq6`Yo`MMbEHRq=}5T#*AznhTGJfcFu1QDft5qls?2J zp*$Yw8&QmZ^RK59Ul&ghF(HR&{2MG`8qnV}=7TNgeY-i7zqTX$Rs667b&RPgfiU~} z%KTX=Wb`HA_FJce;>J|1x3J>(t`&`s#B3XTwEcqZTDFo?f0EDxdWx}v>P0c7?D%Ih zmk6{|j!#DpdFV>>U~R_8vFg3MoX@ov{NqUh8J0)KUKejR%?|=!y}PFGd!M_c&=(Y* zl=BTFD@_7$n*Tyk5J9}X!G$rWo33X}x1zyvamlJihp*|Q6KK+-+PUQBR2p7l^uA5L zPVfMo?hd;y;Tfwg<*Op->Z%mhm9dfu_NT1Pl#t-HWfO=G+H1N^uia#^qBCGy=0-2d zHy$(zP))~0`jnA-6Txb2d?dv^nw48J{YE-vScd(G?L&N9aowMQs1t`KMj9erz z%d;AIj7Cceu5xla3dH$^UmuZO89(N?r`sYY`s8r9%Dv4G{ew-`R{Mjlts89HXx9Bu31If zpC&#X$Wz&xG&#|b?W@tj#6QHO$A9mPhDM<=oJ4A(p~(GLdiz9s!T0C9`%*Hw+vr-K zS&}<~s%~uhvxYC(7LX}q;9FT5DZ8(pfNr1){>aiFsdP0Oq?g|zfzbu7xlUsSqm_Cc z)FRw@J0>~qhIrhchlpJ*E4q$jC{+p((VbtWd3dAs)8diRU5{emPVWR(sx`nnq|*WB zKQ7Fkx-LVPv8j1TqJn3pjBLj^7%`Rb9Z&4%FFRKT@JwuLxCb63S`SQCZ~A zsd(h8s1NhP;z2iZt3OG#AE_UlyPz0se6GeXsum=~w|ScF^7#_}b=sqy!E_%R@EfgB ztZ8USl=08Jeis$F$WJn zteu-^;x<^`xkyePa={UL#989;{X|es|20G9#fzTN*6%6oi+z57g4Wbp zo?Cr(Uq{Vfs=c~;sls{wcNGZ5k?o20`OD8opYoRXSV4S)I6SP)(ylN-BlF_Z24X1}+pG-;NGB4zx{-+g;=`?wPltfC+be+RTt_=9xPHfm`dl4nkx*ldj^!hR!_<)WkXyjRkQXByY@b$`(OGDx}N zt4=QFFKf5AnG9RO2eF>kE{m?}Y4uz;GTR0z?9B^xw2z-)AgFjQ9O(eTtVUH_9LLF0)g0BF_SHK) ze`eX90*1{wyOMWJkg~1KDIW-aI(Yw_Z3u523q50_fDYCb-b2yKYV(`H z%~J$EE=cQ(~V)GLw zJ2C^(aU<8L+adD5VWBh!J#rnf_h%Yd-_;a53n=hg+~tADKqb>wWBgK@W;2sUHg5hR zP=8zo0?qDr6&b^z;nbs6s%at_V9A4&N=2KU91Kd!n^MfzY3Lx4DBkP&p?`tA2MIvUv?^i~OXPi}w~GQAmBrXL%PzpBOYTGY*yQ$E~xRVJNJ)50aX- z!#xhv+E=3b$f4qui6`3T+_YgSSBr-KF-w_mQczl#qYjgEBHO&)B!mrxO&r{Wm;bFpCXtUVFT4j2XQx;~;XndTh4BJuYSa?Pp zsp-Q$mT?i$sX9W_gzE_~bxu_si5s^bIiu(F%plSKbB|qWTx37ZDL&}Bt+QTAHCSmy z{=4xrUl&s!^3HEI_hh}boR|pKHCCH5oS7!1K^Ezf->@V5KYxHF|bskN*G-9dM7+X*J&qemdmr+T~HB z*ogD6~Nfc8qL27(OTGW{rXF#`dAk-O8VR)Ob5; zZ+vY1>Epvk9f}`NW!MB?BDb}RU$x3t!e1IjnZ`)*5vKZ7!AKEPD zl}z$qDK|^McO@bkJf@BC_=Cyo^CHD?8YJqBv)auFfM5_N;R^adXJ*_u?4>QPNcGcI zkP-Vsv1dl$<5_4Kvw=*zaB`=l&$71HJIhD91-aZzgYmiCIC`8SMgFbn?J<*BFfhS< zPwQLOyoX$~t)T7-&D?IXfEmBbn&xs0UOlxb10r?T1c|Of;xczG;PXlTTv2HZ8K8!! zj$jc`a=@~8iT{c<#fQwbeb-1pA_w7!LCST=qN?DiT)1RxQHeWGr>m_GmzRD50cg#f z@DltvV5z`06IYY4d0TtXajAWL#1xR_h1IO7C1lwP5`5e1Ii!#O8x4PYm;dYqKmtOp zkSXS`|1wnh^;+%s{#PY_2^a3XL)%7NJ`nidN4)Q|(myU@B%}7H zjo4K;gop$YBW8ahk{|wfL{tez2%fM;zWan(^hVTFX<_ZTKB3V&f+%J&?!gi>^A9c6 zW2At|#{6+LCPG^8S`+xR3gusR78#E_H!?6hDV$7?}DT6?lS`Apq z=Zo=AUPg@yzt0CG+FxQZVoRhg>&(BLY-`w%LhN9<&v+R>0hUCgTO-_tCLeSwh^;Fn z%U(O>KaXCX0z{qhcC9I}#9z90ZG#cD&O1&3dkRd!b356M((I>Z$OtrmAu3Ycpdbyl0PP$3pU2vm+GUG8Yl6ffsB2TyLd>OTLbe08K@Q?%v_7 zH#kOjwni@GZ3>D!azX=LHk&J|`56N~piw#@Lb#rsQ-)h;FVLv#7!jwxOHM)1tN=|1 ze%!rHp1-v*gh3_PD`f#U_G7nI`>TC5V1)ajjBQ1VcTL}c&5S|+;`8ZGuAqL+WUKL6 z6k2Z~X*IgB8;akF5#m_3Frd@d#EU54ICvC;5xM+ zTC)-GAO!{}l#6w3^rpN=|F&PI$IVJEOkY1NThRBmxL%6sB_)-5tFTnVo5th;7NyYJ zCj%k&Dk?A_Ocq#O9g3tqYD;#zVwSZ#KVHk8)8D1d*0zb)aPx z*tS!It^ogIt4T-5(%FrJk%ic>HK>@cHcBry|^5GxX4 zgF6A`VzS)m&_NvoCQps34yyMR$Q|{+&)4J`W?Ha1`JcAC*W{cW!6R_6=-|F&hHsal zYi2kX6o@5&7s2+x`MyTAP~!M6h)NFdb%&B8d3$mRFnf5Bf_%r5)ish;jK65W_s?@( zfwnKdA|RAMKkHxr65mt7#1O5*?##0$^LLckx>vSbGBIG0Aw8xyx~=3G{0)PW_>w@B zYoK5NS_c;7(@OgY`h~ee*YyBRyYO?;5XU5ZL(UUL+oM4P1dKnhe^Sm%xZ-}e{`dX- z^730b!;(Uw7nT;g66(qOJX(B45-n&U(FOe%Nv$7_zitAGT?NDHfu#7JaQ>V!V0RaiXqyJa|H z9>3<~U!+%c&${jFi;w7JIkUkptE~O!uIB1f1O+hQQ!H8f9uHr}{VyF!vmRuv=JL^| zQVG@`H`qKO$MurO%iHAr4F&?`v?+Z%|(1`?+MmXy}vo##qnT#Y0(%p}%6|kG)sDI5jUZ(&)@(c8hvjL97DrkpIg=j7xrM|Y#XG#+?owP)hEfqb z2CB1n((1hf^e&^svfua<#s+w+;QSl?bUz7uu={;zRM+K(Q@Vc%`c6oP@T=+2d|;zw zWI?()SZ2O``k8@nmeeFggs0oU5qtohZpfh!zxXO2$QAcrt-_srgp0_J;&V6X z2J}j=Vz4YaBH8AM9tiL65sjI@2$JA))qGmNOgfAyYZ{kIhxG=x{DVTK0p+b^4&D#2 zP3R@TE8fiYKdEAcCn=}2j7)V#s}EIEovDV*c43V8jz&l|{A5xCvTm)2Hv`zmueCOa z6h@)?Tq^+lxhQL%&s5zr(%XwV=jFzq*K(l&r^f-#EP6u=*kDANy~5&7)Q0-r5ryqR z&NAD@MxyM2f_=!K3k*DG8p9AG)io9(@$;`Amjti_s)M$*2C1eWZ#H{bDz95*5+e-6-=0 zhbb)TmcZ=cd*9_4u@W{t6rb9UBfC!uHOz;Dd%VaZ9^^Uoa80M`E=Ohi@!5!!E#`$M zBhJi65HAT{6`OL)0mBk{p7dn3?);3{{p}yj_{Yb-Q{`!P7>m!ql(|8qtBol4NYp** zE;i@E8_yAEl+L8kpHXk5{%_zG;s4D7a7jjn6I?b11wPbb_hB9$Q3mgrt4C=2H{=Qa zF~Ni`JcNlhT%Bx-Ty>x>U9aXlI=ZhFC=Oi0IPe@Q5)^@VlmW%Wlx&3JcN`M$3BOYW z-un{Qh`G2P@ltNUSPHn?YQ)YNzGKKP;f8Xa@u6}8ZE-MHhLd}1eexX9Tp>d_8~v;6aK0Tt;n+ zm9akhDZmHdaCk&L$iKhfmnmqeYANFtNABbb$Hz5+)J0p9qjPpCa zKfmvv=W)*K+~c~h=k>hS{aOlJJ!gU@;wrSFr)a@(F!j(kFzzM@U0cL0z0c41{Cjx# ztT3os?N5TaMJwWh-n~jiO1}d7q83QQ-t`~iN_}XFVO$q4TMNanGcg`-=Rg995MQvB!Co& zle}*&A1ks4+C*lyJL`LM!hui>L>;s)P%45To2R9jEPy3AgJKZ&##;qxY7>~a z!-jHkPJcs-VPT5_p|Z*sgK`}RK%MH`$yC6iFlh;1yN-dn`IxVbcv9+9LS`NMY|k8_ zkFHSCHaF2(DWgeUHBgv=F-9aoX}rcXblH{lC^KY8{lY?AJn=JI$Nu}^N2x}v!59F8 zMAhsYcz3H_#I)Na|JIG3)+nZh-%8yUh3FPRoT17@{G6(d#bnt{KD7Lf2?&Wd zmOnzGgXZ~6ISKr;{ppuhYHa4Y1V+C|%1b;X@qYcFZnyxyjdjBUKnIDx@_jb+K5(x^ z?IvJ6V!l~~G7J2(Y+FZpDrCc@-&(m0{S}Q+#Iz&2EZdiBcX-NE_EShkgb6tQu)HnM zAVL`HZ_pNTp-fd1-9RkpX{hgqlD)}S$_SHp^gDSatjnYE1v zF-{E!VMkr*ndBO_mHRQd4#7VM`4i{(i5XP(e}-bh>K?4tvULD(Vww&cVy|G`j%_bJ zHgRa3@;|=P|EbcRi$Y#W7~7 z!M(e?0;>H)xi9*&Rg;65TG%YMnOT$uya|@+1%8B8R*`;UpcDrvZT{v6bf740rX0M# zq$F)ZOS_uh-^9UY(LeA~iDH`pT^gi+M32e%xEn2M1SInew+ow##26`NA0knw2V*<} z49b$+iCY$KqP)tf*^kokA{KjXei2NP;b)T|op5ZRHAZFyb_O^ooEV5hH_20p5N3!X zJ}H%wT<(5d{Z+flgzB+z!qE^*THI6kp-3~__o+l+ce1~|8CgFxiP6f2zzGMnk{Rn! zbYBxh7nWO)SLL)BS`&SqIPu-Bw9fn9rJh<|DG364%@0Dvp$)iD^da6L;Z3H-d|#W_ z8EtMF&)5XecYFa1vE`#b{1HX|mZ*hLZ{UY6DH=Bk*BnBaM8zi5fnE_=n9jB?z_N*W z-+UZ1ir@C>vD4a$JTw<0RbaF5A^tqssJBJBa!iVA@fP#vThS)EnPDq=LFBBXwR3+I zUsGeJU#aYA@pl)p{)rlVsH{u5N~d!dFQi?sNUQC%Na{TLf!pn+k7Z!u0!M$+`HmZ`^1%DE#Bql(waj&Z|tJh~-nr8&FFzNa-b z-P)2fn?;l`8_k(vIU8ZG)9`1lzBq5MPKK68GzOFB7Yor%_xmd|YO^Syig z#c{In`%&WqN%2Kq(z1g1o0T`)gAgRMD5uu@df)j+S_|E}mt(P011pL+-riqEhVc^q zI7Yzz9r#6H9Q=dJltLxre20!~p2pAfBKFHAl-NdvEqU%O0MLq7=AVn@uFUGp;*Gf3 z1?T=-DjD2Z2FqgrKjIoN^ zDxIc3@>a~aQJErj_ne`K8@* zIMDMA{BCfai{wYnRk80!p`r1g(7!d;?n)2oSkW+|pETyu3KudT;b#jnZ-R6vmAze5 zC5w}Y+U=9{xZ0Sx+aF7T`eoqOAUF8htspH0rUvPInqcUMX1ow)$5_N4G2^>qRG2k@ z+t<>_XVi^*XZ77d!m7zVf?bZkQP01en?SyI+w!sF|J_%iB4IAxfWDAGf$j~aS!q2e zFue_ol9q0G4@@{#rFrye;y<|Vv;u1p9OEPXL)rcvrfywMe8LzXXl^Vm-2V1mUVU0{ z?XAILkUPPhWx5=Tv9jpXrqhqcY=a(5gRhTegD}MFP2x&8BDu=4ph!{xmgF((hPk z0&h;V^MAoMNu7o^8&tKQ6xV5jBcUmM1V1jzLOHV4+ay7@ll%k~yDTr7ilmPL1Q3B( zlawQ11a5)2anm6AI7q;)aMo$C2}MM0LI-mPLD_c^8EEcIm*~1R&}0ZFN88V7VL&4U zaVd}YBeWmj!#%~S5JVqI6e!AUGa&?}HP$3f?*h}(1GIF2w4~&b8&EKZ9WVfmVQwLm z6$%7GqLJ^{PL6Z=8d2swhXZBDMoG5jJodcc=Fqon{wYiZJl}=AW-+OG_ z1ZqAu)}>UYV-aUVcNlcwvkg3Q2R}3z*PYS%skNPE#Mgki8>Y(65j3-j@ty`I>$N&R zbk*%#p0i)n`rgLQstu}HqQovOB*7mZ-u!y43HB2Zd*@4IenB%O^L#b*a{+1nPcAJl zaQ`q@P!7(Zp$}gYMWt}(jEc8Ps(!eri9U7vt=uX2a8@L<^N^d>~o zm%Bb$l31p0GSyKQisG(v8GH5R_mLxcmV2q%GHSe8mEs9*wI&24;X&ED$p|+vocgfe z9n4GRFFM|(OP=L1ebbay?>InNH+fnpAPRh_x+=tG8f#fQSid)NkmjnitG#8?*vRlu zIrX`@o<(ziqhqW+`Ql6K=jz3jTOH|j@qDe^A39KNyR9!0X=ynTgi;`mhbXdE#|(hL zwlDS_YrGrlj8rYBBSk7D3%#@Mko_y|qeSqRJ76G)m~N)--tKJ*cTChK7I$8_^%JVv zV`GW?xZS~kqJa;{JpEU#m=dQb=cX~e=eNmw&sZN=@^L-C%(xpTVomXKxlBa2Q4IK# zIOY5g!N}p(p<2i*UYtB1piw~0=kUf*2R&&rQ>!}=lX8{a(&H&;ObfD8aLkfhv@T;=cXxvseePQ%7 zLr#RR_UFzPfG~MuM=?e5W&;ry3Q*!CB{}vEU8w~S1U^wF8TB0OJ(5h}+qrGc1$$kgFkz?wu>$sXzNigm=qO_!Tt4i;}hfW0t$_wD4>UY9>cW{6sBilTT=R zX;!IiCuZm^F;akhle|b1e0k`|fP)^J%Y^Wtj+}u{4KfsBuT^@c_|VXM$2ntoMO1&s zcdAZ!0R(Z7C96F}5gw}{$N;yTq=(E1uL{b2LoGDV7T7$}K{$>h$7m|Kr_niZ>=t@M z3cE337pQB+&0KWD!h)mYP$|5M*N8O^(5DBV5-?HmH=npBOWBb&iXYtY*WN-lr9i9V z!ZL)grZ+DwLA;lG2@wrJB&v!)Fn! zhbn$g6dU9{HTQ^CgJStdve8$!8C-B24MGGVf)S8%qfy;|N1UDqYm1Q(rtp)ci|2<^ zAHO~VYkX#UR}tLeMq`8rvIK>b&0_5VZdi7)iTp`uF?^pd%s$*^Rl`C16Oced;AgPcJ26AhAO5&45!ZW-#Wp3|l~X$w z0!%`_2U4Ji$V&7RuTN9135EbwK01gKz{NSa8z1&af`lG&p?NhkK79-*WI=n2hn}3R z+YI7ji$QPOkhg$UV9-NTytSMMRZgo3ej23Ac6G9K)j2-Ob~Uvnmro3nd6|LcT8}9z zg|@9IAvHD5=0+`?eHt?~@eTZqZ2+7!xcf;`31O-Spxofqm7Tir6f;b#{a%z zT*8@o8QTo>Cg6En%c2J`9t+ZTKQzdAMsG>``q=h~x5*gA<>tG`*=m6iRdUq@=_;Lv zHfQHzOHSrH*w+b{bQ@5Efg)m<(l7@X8eJvCA$sxypys+3pxTQ(obWs0 zM^mWccPcyqf>NMJODuimD@ZnD^^b7$KXE{GH=xeKPzgxT1B1W#-`=32&A1j(Ea(FE zP33Q+&r;iP8y8XKxhAeP=%uZj5TPu1b257~&~W~RCM#>4ppRt`0WoHQ;!M3#NlfaG zEJ2@AO|0yl@~JdR=aU?qLg5w*Q^CdF-@sgS?IEgtdXQ*YE>xi*Ff(gM<-mgjiv&K+ zW+}m*2@Z{FI!E%jSme>u*b$fH-so@aZK*Sc@)R>+cVr6p%J~Zd{J#c#uH4pF%dCkX zIUUaa92Mb{ef_o$Fb<8L( zMu3&j5O`PuWDzJav&M=D_q5#x%R{iY$li9DTcHN5?uRA?#D*l%wcLMKhwHQ1@zs!F2z^mzCE#n=~(m&FTACrpdpv_KCnhNl(wD{CM!+CT1x_UP%+@SoDD8;=1uiEKbb zK^g_7<83Uplg&^RrYdEp#f{oq4nf>b2@(;Zqky3HU&v*12%R1*XbV9JMD;lzGH|HA zr+)I8+CfP;l+@puh>i}hUV6%`T{akR+~dvA8NHxkig$~m_}JisZs>$HgFA4VD>eO;=#KGJFk zu94~k>hAEjU!shDDo}P;+zVwP%27_b;l*#O3iYf8Ib){%K#GejHjioFgL|bwGfb{R zt+_d|m$n)VJ!8_UMzf(HVeu|5+6Y7{G|mpxfjTeNq)s<-r`--mKq4K8TxK6O&OIy~ z4SENUlf5CS5CvF&x4nH(XqG)^k88PBqU_Xzes~FVVSe}T+vUyeW{++Zf%d`0#At`U z7aXtHU5MgdwSS-uU9QRyqX&{Km2`3LUsUuiF9=|Nfo4mMj&TL=G3PJ-Q`* z{#UXzBdybRM!VrmC8G(h)KQE7_U5H1L&e^2B3eQ{sW>&%AGMkQzRHLlUjWHmB}^Ha zL(AMVN*6@KaDaGI|3Q`F!jp9|VYGrRlcEDhzqQ?2BQGZ$(c533fG^Q()4IfD{?k*MrHURb!Y|<+EdPl;wgjzxl$bwh9u? zPmUV!kc$(pR)zq*F9FnXazZBX(47^-KUjCPOTGK49T(@xG4`;D-OeRMDwJzCd62Z_ zBI2uTGz8oze%_CgyrHld1{L-0mB2Jz$x&2~^F+_uqguY?xG=Wg^(x@wLoA=@nOjLW z>_*axLlj<^CULp~nc*Ovxlxw0oF-T%rske(;r%T)YR|u6UX$ANVB#d5JBx}MBFB~( zkw>O{J$HX{JwF!0WYMl+N;P= zf z7U@aQaxPhbBJ$M|yw!VduIdp<=hzudXj}VTyp1~#C4+RDjJZ(vEwmATe`XLDc_u&r z!F+0336Birf1a4T{^~6P<12|l{rvEhDz-d-PuskJW0WMoM_%)*KX|;d0SDkC)$f+J zM0`|?^gY+q3(6tzn-uUVM;&P+aPn6EA(RoRwRv zjsNSBIFrSVsZ6@`3V3C`c|+@uHB11q^o9dVwR%^otYlOM3^}3Q$ot+Ayi+KvvP*w;D10q9I?pu49B8u_ubjvup&IzModLVl7D8p z0!iN^Glz1hLpG>nkeSpU1j9ZN7@CV|3eNYhO5XYNlNZQ;NVUMBBfuy_0&6OLE-G|4 zz}}9dq82&t+3JWjbR)bSU0YWgkWommgq9(;d)X*T8Duo%YO#BTP*q@h#2BxD)W6=* zV;ZlYFLMXP$aHX=&U@T|)ea29fFxEDVnNmkcWd1{ZP%~=IQ9d0ByZk8&EMQd9ryUv z{IQrKH=Hb$i+r94Ez*3Hs(6xq+vd$grbShk{`PrsW0RNtg~NxZT$>v?lkuA zc*Qaeo@Vux`8B;aj$(JNO~>*4pBxq9N>J`g-Qtjw9#}PA-7biGfQm548oUz1w(3%gh6P4HGuJKK0$1Anv;|Gzet2s_={v`u!9J@A~6&}Y_}V^Zg252^zZn1*7ShX_M$(cE= zXarM~aEpsL6eW-XlGIj6@mFSF<&yMoqw1y0wg zbj)vwm-j4($bYDO>b)^0D?d6gQgOv0s&}S%RMcuWH&@*c_aCYH?gmaOETho5k<6z+ zapFF(zQED`8b_dSZ0}`t9s+1$t`|^^2mVoSn(zD>00fN;?bs`!)8&7l-}~(&Y%xU< zV1=_Hy^CROEUYCsF)(oTZthJU*Cz>4%rYiwp&@D{%X-AN2COfV4xkt$j=we$7c-f` zQMbv0XjDOQ#ET4;l715|nmerKPx5yT?rL3?%=!(pv={RbAjHb`e5X%TeyctZP}}~> z{(!ecM;%|RqmQHo12r_;(Q9IT zJ0hpw@5-#F&|=4<&{J7vr-@(^{~~KJk5XM0tb*+hzynQxgb?2EeQEZOX9pF~UgV@w z4KG+<&Yh}Q2?PeUg^kE3v%QPc0t9j>nB|Iq*H1XXa-??v>LI!S?vB)0iD@PHKjqfV zyd$0g@b>ST_Ar8~m{aJ?se_Q|a9d(|>*D9k(}L2fU`o;@gOE$s015H%pxo_nlZ(00 z@EWm`ye7_`<(APzmS0-~0dBua022N6)_(Z)#-UHW_Cruw;Xpz19_6Q6rs62HuqR*) z=zD`LX(OI*Ktt3{x=5AlNtbH2)d%i4g}w3xxY-5I)AMOX{Wv=WjirRHjr9JJ=0eQA z7q8tA2vB+k&ault>zXxJSe-}Z(-QhIehm8ZvfDu(%8a7Uy4%Q7t=^3p!Y^V#+lN?a z*Li<{N_=g}1>((fY1ZgiqsT#>s)@b7cZ1olUKtfGh;_*K6}1joQ`^)!e|$fj5Z0>s z=jTq;CJ^NHJXy4nC309%Z_#6_-K}jf(`;9Q$%jXj>{L%m1~(_l)f2Lw6Si(-(rZ7x z+bQ@J7_v1=P7G3M(w9fH_u@zOfX&CdO|o^F5ay1-blc3)pfeNR@y30@XD~_P2+?3= z$$zd_7;^}ORyn04M6sQRt__K3unEF=&aW4*yS1g;va&%?LXyD1xQ0e47wYu=`dcOv z8C#x6*Z7h@knDE~XXa?lerHg!-!w#+=b1>_*R5Bw(6(hs&lr;@v&1ta-qX0&74?Iq;rMZ{ z^5@2Vxx6gYfBfgIPH6q2_o<*{`-XxLf!JJS&r$*(`A#tfKXXa-9`g7E`5|`elox>@ zMhCcTWUO>bNU1OU#V!pfz;><@Wvhw^k-F$Y#-DbdG06pF5AqRaRD@IOvLlp+=KjxH zl-+N9KZ9TNpF5R;U*z877VHF}-sI2{$BZppnxFDCt7B=O@5<2})YUD0qA7F1Z#Odl zVc?g8b2MM~Y%-4wn2QnQ{x|>hte+i>&(4ltMY*rH@^;TQwQ=~a=i`d{MTSYyEm~lJ z9hM|c`kv_gLC7BSdt7P9_bQc$@~WuU|5po8WhMqgnuK!7VkYvS_4Gz`OXZpSUtWZ? zR_kJ`*siF^F7JMyas?Pmt`bj1eK{}~JB(W_>Mt~UP=5g%(9}bt2wJCb_Ei=)! zkdi%aaTkW5j9xFgac6(K*1`1YgfQW~w}g$-@jkkH@-2YUhFVh%-T!=0Dyu}h*ViEa zTI|<_P{#g!tK`}}1IE@c6g*Caj1I0t3X)MXbTmFHV7G(doiKw+tZj>@afe|@ljUo?zr*F zvc>35s|HmtT!x(%Ajco-j+*V zp#go%K49DcuXh*cI6!5Ysg(?@9g^w?e{_$HXVHB=wbhA=y7yDvXA7a57kbmTjS6{| zoT@+eo3O1kYo6YH8PfWqDoeRBBfd*Q&UM+ut8LlW{3;Lmdg}WN6ZD-eprU^EVo7m{ zanEvehd#nzJSZs|`)_!gD7f$NRQ7(b@9+j&WXU?$RvWkZwph?3ISJ*}3Xp-%LaewGNxHGl zsOCnmyH!ci>~5|7z;X+inLt387HamfGrz^Qd8aJ<3PDlRhcT}Z3@ds;P( z6hz;;W9)*=X=s+?W%rr+QrN}V3-4bISnsX9pAcs5tL#7P$r>1+xfMmM01X|In6>s_ zu$2-o9|E9~SO;dWv$HJZNal8au$?5Dyt$(^bYBDdT8u=ziY&4~HSCFk&# zETHpHfJ3ATLu_)@jA`ZL8Y(#}+`7^jT_Ky?3@*eo>}E>fIJc2CGF|)Fr{UGBtYN%d`}qs!EQc?5%@Y{T z+&+Ipbz~0xenb|%+A=!$J^4Zl9J-I#-fO=h=}<(iuw>D^w&*#LPd4)fcy*bFm+_;+ zzC?$4j}9Nw(UYLNLy+ z-ey!LBhbjEBRhH5=B>e#GJ#syy+@O1PI86+4vIUXNrbrKcW&0#cK0>>iRhyiWHc*O zM^m9fW7<}qoEeCPyS4|nSJXG#DLXk?x=LZb6VMxibUe_6jlBJwrF!eFPoG~MA9@dX z^yErmy$34Nc=18ZgHP*gvZzTX><*lF{KjeG>~5iL%&s-JzCR5VVgZ7ZXJtQLUzrNk z&0Tu9-TVj_3WYvJHUt0U#%Glt*>1N4iwR!-8({qOjBwW$Y(WazE)7n%1;$jc1JGB` zH}DaW$zyZUAH`}gjM~ejq_*FjVk*R-AMx(g@c3F8btK=;>3?Y}9e-V#6Y_=WUix<7 z#`%2%0ZITba&O%aE8%9r2;1FaJ|le#pAhP4YPiYM0z(zxNJ8u%SzB)h>EPM9Gvf$T zv`~Nb{B)h1b6;{81RJa)w!@+a`2eh8u2>f?^=d!-<}!_2_TILJ<^|>A2N2D z5uM*bkpl!cY`{I(#P}NN18%XYhb76_);ANbC>xKLSErb$p+~8stj>L@J-;mn3WvC& zhwfcDD4V<~NdNHHH{x*m#i5vxP(n2a&+JZBL}Z{E&iz?EN)iZ%vs3kDU|KDgU<8ao z2P);9Cyj^ekjsqNFhmDPtLr4?NIhwp3w*6%Z9u8|&$|@BAVtXndzZ_hvx?l;GcV<4 zTW$gHkNev`T8HYx-2zkGwZhX!d|QfW5qw>1GG*$XACnamN%^Jf0=9#+3Y2t8aY2XuzSVygD6riUd@akY{OWCU#fy7woOjU5gC(+*WEK)yd#-0*hLi1|b0qHG z`+3k>B}ZN`x<80|j_Hf)5!*SO;00{RpzsG!6m^9y+{s-o2~ur5=y5ZyZMH)HyvJz> zm%PoLy7~0$RIi)4V_CmeQcvyx)g+RDu?%%|~#@`z!_Gm8;t^@Ws0_#K%T ztA&!s*}sf;*;zj!wnA_seR%GVlihXKrj-1>>w}5GHoW}}?g7f2wI9og^4{`z>_z;S z&awRR{O<;1Of%*DT~(NUKR$HMFX$|)*F2&;Yxl=y*Ppq zSTpV6m32GcuiPPdGV*nT+6xXxp!SUyv#>62+xJ0SPPd?p^V0B-O}s~C-#6VmW+|N1E<}c+CJGnM3rC7M# za~n>y>jXPLALct|s`?pUnciSw+~CjA^v=X4q}94(!7-kefE`+)y2cpVd_25$c|5!q ze04bF`ed~tG7=yjMWq6zqpIbkcuKyjm~>-6i+Ws<*t7h?8n5|a9){D zHG*{J$;$RS2M_i~)Lpn1O$nX=pF0^wx0I2H;XcurCT^W`;iE=;wH}G@skt!V z1Mob%C!LUKq{>zQJp`GxUC8+C%M}>F&pkIXf9Qj zMVt=qvF}JT7JyxVWq+n&sf<_pRVe?9<4et9cfwFKvEr?dm%PiS=qA&nl!RIWMy{8Z z>}05@x0U!qX(*^OC{tR5>ifCBJMYos+ere})_?)zv+`O-^sJ(>Vw@$+%(FmS>M!>mDXa|6}s@>-gkCbk~Cvus4({!d2Y(r zzgrYFVCY)&p$XKxNT5R!j3j&(xb^kCW4T<3T_DTL*Aoi~!-Y3JW6?1Fi~RL%BK3oI z*1vStIb}172tlIu4xKkI#29Eo(y1Qb2Kkub?8LYNyX_LaP&e1wavGdeSnF!WxA#jQ zFsTGX>ApaxMh3Zd?hT#D`;J~TR?fZYE8ExYKc$Vq)ffp|cVG$`YQ6CN^2jP4QM+8n zXO?}4K)BizVU%(4B7qRpw>C4^#DOA`d|XIePscvC@>s-be~K3f?IU{+TP; z2e-x*Lp(fp*A+!ge!*DZurxCTG~tbUw$1m9YzWtJkqC=WZ;^6Kcem+;^wk7EK=U4i zw>cvYygqnVaWAcHJkc~QABW$c>(mRaI<&O2@8ql52<69i+TJ*=S#T{qned z&sg?{tg)D*^jnt~6I+){@~x*wPLIC^(vIIAG6+c$A6VPQADn zK0n{QakcY6DU_0&)o7qjw@!7nU#ublt)nmVd%wj8gp*T}!lP=@qx93Ti?hqiJ&6~U?s|~^_f$B!*H@^!7U@VvjJ`*bKv!&l%P`>!t0Eq}N!%f@ z#AV|QGJ$`N0|-BsU?qCVscA)actfWx@p!LYbitMmaJLxw6pq#mnEbn-?|6&!;hOPb zX7Vz9Z~&lS>z6ouyglqiOd9F$RS7tzJoU<6_>mnvQWt4BIB+iJpg*vo4!Ehxc_(wMiZKA!5V*suO~V2J4cNxyQ*je zLGpvF7UyJPyvPFgBrg9*VEeXr@s?en8Kz?H!0647hReWl3V-vuz|ljlx0B#gJks6K z3(VPhS@&-Ei+C)>kE;Av}ll&R`)&lYTkow@J%uQ5`eYi^Oe{Y8f_p{mMw`>8oxV z1z;-#f3y4@X``Yq00+XohGrG9BG}h-Q>SNrb-T+&(lwlt6YGbSx)THl%+knf;Wq9! z<_+c&xUCR@0!sVaqqApw_}#zG9=Ld?x?*(~V|pMJ`~!@CJ~09n67u|IdVnlhi{|z> z&HDkKuu)k^(JfUfBAw{aM_k!dZa+bQ-fhrtXQYj53^vQ!s9_|&*>o0_vUJ_J~mLz)?Ok|E$9l?^# zcY>=`VcA1fclJNApu-0R$%dLJaowBp%_~kogRr$=KcmezMV(Vc=bRXK@L-5mn*1FoVokOGEr*X=1X}}iDt2kP0|c@fAqpJ3F<2&cz9crAn;}1C0He)i&oA8`jcj< zyknOwvXxv_PO5Z=>sp+#EB94&7X--mW34{V-M`)%oAZy_`9}H~bMvm~JATFVH4|H{ zGeD;LiN2!g$?8fF*yu=8H{me=LOu8JUmq<`^*tZGIDQmTJx!?6UP%Y+zqbj#+FX;n zK2PntvG0?6ICdz^8T!ZXxOc#qt4$A_qPCUR4O-Uy1!Hhfh?BzQaZ#l_h9so^$o?`G za8c7*kIv^if`Sl(gl+@|&cFC(H0)Wx$*KtUukDjrbMJ4i45?c#G=?}@kVOMV^qR~I zwJhk~?(I=Z7Vy3KQRj3QK20CcQl;OsJA%6~vyWbJwnvW+Y=hZcbiYY6Y-h-!bi8<`-f;d{Vi;C#`JxHeD3wL!=)5r8 z;_t1B{VT&?<|wl+$$8oS>Plm;B!GET#w0)k#})zCrO{;%)rzy7KUW1WWX&t<=_A>} zAK$XcJkKA}&p`XQBl9VoRkgLm?|*S+3=W96Op_~XIr(9)LVN5Q%TlqvS){_B7L?7v z^#7?={ohmcWf}}}sFRycHMJ0-6DcjpYqPV* zG5Yc_`tbaG0E+XWMe2?}8}oSmEO1p4JL>Yc`&)%YpAKzHgvcGkUU%F}a{#nbx@W+C z3bkhz?Bcs5%U_mot$^wTh6NLY=fW0TX!Q)V;!{nsHY&#JFkuCXYn6OkSVt;ULQ}!&5RDT{nYbll~(%F-GcSpRB-vhAS$1=p4^0x z(2F^)^=g%w3x?y^>Ct+3eemd&EuQzEp$sP^|m>u^dL=j-Lmwv?g?&3SX_n-je@ zdBmV8AOiTtvKfstpBrawLPMC6d@ND5H;!b$q6^JeBUptq@FkE4b-?9#loI_7KP!;` z7s}Ndu6uDQ;*Yl~$qG;byCxA^g9~%Vk>$-}W~AxF%~5mAqF=u+y$iA-Mw`G)Jh4JY z%G6)^I2p6RWW9>dc|tIug}cc!9i(!18;L~6f!Cne+rV&WrLVglSGHgI7(pyfl{6h( zLY}xjxcB*Mg;P;EGVPs?XXmJE?T5%?cs1?Bcip1D*BerS-VJ_%4#ShjdaM*8}_&apX(P%C7?ePgcCzLR%6iy3)K$TH2&3T#eV9;1t|9(sXpKC2o%`WEK=W>Y!pkE4_py|F^Md|_G)I;E z!@48&6vh`Ou#neJHMXD$ni#uBTmbF;avR^tHO|JV@gm#zvSvmWExmCoylhQttC0`S z!z!K|U0hK;j6W8GEeaC^nqFzqTVQXQZQ@yZ@cKTiSEwtQN4P0(iz$X3)3jLkir z&u?9jvCd+Ajg1xMtkL}Nx7Q>TR|?a1EO%d&G4m}9*`>~+D0nC)UhqqL?`fcW3wC5C zK3c>@A^RS0vCwL&E)gus4Q!tmfbUg=NEDHDBv~-!G7P3~#S1-@++m%&UNvesB1#S4*7-dt6cB+KNwfeNOz$#fgPqHk$~( zBM2mRjeA~pmT&R2wsa$%F5>2y#&&pLs5ohWR$?t}qpbjku=Rj5k^sV3wsd3PPnK2KfPhW zU~Gr>s+X6}#9Fa29cS{9=QVXd`IB!x$&X$tbna=w8YywgW=stRguF%ECcfafW0&5c zx`XuN$_=@;MFD2~OMf38Q?3;#0+eKlv5PUqzTjQT6V9Z<(Zkq;TH6>r(sKOnlfr@X6xq*cx4Y!_Vpxb(QtV^PtPygJS%p{+F?LMSEF^4yEd4)@iUE1uV!E0|^CkB2l|Fw?|#L89{&UyH`Fs2UqD(b5DpClxA)Mx=#xl#ZL z;uZ{dDFBb*5SS)2vZUh-oBA~^Fn@Pf^sG55-|O`6$`&t3(CX9YOQ`t@$m>upk}tIT z`>(nE7%aZV7Q^9|-Qj3!dzUTykD*27sury_sC3G(9~JexeGmP0`ImFAD(N$VY*fx0 z=}-2U!(HBz-ONAiqvvdAlnHm?Ea7NRQoQBmVzRs2D!;aHv&C|G94P7;$g>ahV+uwRRQ5Yelvv`<}OXjoXdnse&+&xF9SG5 zj;@**%!U%Y%A;?S>C!!ua&7g0o$epit)jFhi;kaTDys^_by6l#Al-2hi765=3f?YI zjZL_`Nq*+yFUw!%`*v>~T-JZ{Toy$#T`4qB1FC2seR-N(@)BD58fFwE^`$_)VpGG8A9cR0 z=bFdN`32zW!k&@e)X^+UG*LRf6X5vY9uAnd?uVj%Sr5b3x8+?IuzW|&y@T>z!zTK@ zEt;gr_{+eISmdaP#y+_WU~uy&Q=jLllQ4Igoc!|zZOpPGSHPuQRfgw3U$j-JX9>vt zL23Pn3#~GM3%pQ20P6R*chi|};u;#U{j=8-9kK}6&nj}c34vJJszLti z4taCAk6Bo+KDp~NtJ9dif&Z%oI9+|&zEM%P+`x#=vowRC=$IzPXDRQ_I~^i0zn^(z z1vGu11Nd*uq~)+<;X(m57=C6c)5S=eZN|EUw%9vi5VX!6q>V(jT*iLpza*&O{M^{Z z@Doo{2Mb#i6%BTG?uH`Es73Iv)=~9&4Da25PTrKfQp?F~!cag(0hihQ7BN53cpM|Y z7mB^&bN9T@U)*Vpt&U_8yON7}7ZtI-0x~8{>ZqnvZsjh@$O^o(_PEvdAnXg2!X(0y zHLWx=DO-jK$4GEjwIGrd-)N!HB4q2hmK6~5;-Go}j+|K(H(pL;*I$Wp3p$xpf%>21 zC3n@`LO1-wN@Dsdp#j!+X#)#LS>GE!r!F4v-dl3xcD8LhLh~EOg**4{n}u&cQ=KXb(}G6Mv@On+ulU`ulbyuy+ht$ zPv@%#To|T~q5;)MkMvV*X1==(56M=aZ3ke7T|Bd-rDf-S*)(YQu&EF+vu4tK6iwvy zj_1MgL_ZERPles?LfFhxu${_=8)G+XML=a<)EsO;a z1OIq!sVzEjH7#z-RovWAnNH0-o2DRE`XH+|$bzpEl>icsBz2i=xqkN=E8JG`oAYEF zcXQ^VHv-T>w&^`mbIA-=Eo5ZKVi*tbd;B{OL3wkFtQCTE0vyCW^RT4u;N7Pg0KeWh ze4!XM!TAfbkCAvepF_LfAZ%R@V;{ zSND|V%Y<#Xm6$K;) zq=gx}L8Utc=@Myyp_Lk?I|ZasI_IAEf1ms1e&yle9QIjzt@Vq&_A0RV7O$Y3fH9Yh z>?oSZN2aAWOM%M_mf@)RBYe=JU3+(2#jZ+M6DhdW-X1%BixQ(NvYAJ=9)D>HQh3pv z_lGO1R#B~9iDBR^n%*8pxJ~Jbe5t6Af3A{hSc8$#Tg31@Jt;^l>vL@}?|#A%8CEPE zI;c2es<)(7Zj;UuwNJ<6qU-0QU_){yCgftQ5a8Hl3z~s$Mrs*A=2P9~zSyg0N;Se` zhBnTlfCp`{XfT zGjd$iUSv&$i+{K;9rOHDJ`34cuhZDIevYO3+ipM-<$j+T0UNFUG+bqZj!dgiEqsgWml z;z+nd^64#JE(-%VeIsexEk0UD7Irb*jAuQ1sU$w+U@O3j^z$ zHcv$cd^hoG<$oK?0Kr1hyX%$590CFkBubUxf=qdG5<2MdK+|hKzdeS})L?Na)WYC( zL86HQ`RPLHr9d(>vp&4t;_ymscUCj4Egbh+_P4R`nQrMN`R8~|(>tWe?QIfB$nBMt ziK(;6vALTDwiM{ z!Qj_vU}-yqR<_K7PM)Uv_$UlN><@wK`HxQbRv&PKw1OgUa`$u3?3vlck1H##{_yF9A6FR(x;t;yc8{CgAPZRy z6Z%j+ms&01()(+=Pn|6c)?vXf;hk3#5CP1H<662Uvd{~CCQJw58ajj+y_wWG5p8H_ zFFM(>U9ZfL6eW*-X~egJ+vC*TYoIIt1Q8nakQYErTmwKzsM%h6*6h*zt!Ps9s13C( z7Z;||2|zEL{kEd0$j&rj?|U?ZBz$0ckX^P@ey)_HEq%6}o2C6Z5;L zEymhVdjR*$U!`y7MW{QQrmbF$Ac!D;U&>0{$c+$@n==Ke0e{HRS$P}T+0S^a{_-C5 z2HXy}wt{+usNWni&kF;a!yE-yOhqhQv` z@6l%`C+>DtRS~3IYr&?+?{EqYxat#!Z0o?#|29+U{T5$#j7OB z7wt50Ex^|=>p26EDM{uXtPg^df%iSleXh)iGHMZZqfDvE>cR!m<%TAm9`Ro9AdRe#*j=~^C z+PSz;$(cYp;NzC67YDIA)*-nR9h!vu45zf;y|d7ly^E`V%V{||>EJq??rCZ3eOf1L zlg`KsHLcw^VyZ-!<8QW?hpY_-Z@|68f5-qB-Gebk-2pxt)YY~gthM-_U8N~L3v|BH zw>=mE|175k4`y}x@sp}hAySWsAw#7sucnr3E|19~$$7CmMXG2bbJD}3-{RSQVgS@% zV!#b|n&WP#OkhN2w5e0+JTt$tW6mH$4Sc=)Rn|;Gk#k>pet+g@2TwL-|G%(x#mIh| z|NQ?|sZE6!iv?i9VH|BfQ`7R#yx3vxP4@0z5S8<;V`0X z_bvyNRP(i)oyR#PGaf_3HSbO{(UO1$9HSvX=rJ;8kr~p{rd#Y77`5=4_Rgo$Rsci% zq(mL7C2Yn6Fro{@r7_Imtk_X50zj*K-sDO9i}m%>ZnLZ8=?u~VWWNrXV`3|jRdDL3 zz?=tc5O{=pN_rUqtcrGNLw)~R`X_m8?oD{-lAp4_(ELl8*`CKzkn1jpoET=+=P3*Z zze}G>n!l1zv%7fP{iMXP&0=lu-aUb2$wkydvS1%_v_?Rk#wCRxqL%plsb6c_VI=vh z6V-@krR)-Aglg?!zKa~ZF-JFfsvc-`#;K+sUBSje+vF_-wVFQg$pYdxYOH}55RHgkpFI;c9rwRt!mn~3dCl`R z>PEO~Z%vN&=@LOG223YJ*N3W3Z0?&$I~KAzM?}Fxa>7fIETvMsWAf}6_eNckqonIS z;bLm^%cnq0#+_;b2r9wXXf^n3LKoaTZj>lb?r%Js9N3Yr93Aj#-s?@@>jBE3ioG15 zn!Ix(dGxeK^7?1LT!6-4Pg0)qgrSw;{AJE>2*czyTS}WqeFwhK*-tuAptK~AGt6c~ zLX)pZJh0NgG#qkbq@Gfl7;ihnl%`NU;T_S(Fks@dGiq*?P85(k`{UvAS(JiwdVtJzR@%@ zTkS%K2Dw#zlG56GFm92{>;mLM*9L)oiy6ra4?M+2m+QQbqz6(ER&3OJoe%i25v}*l zF5PV^1Hg_3b@yat4#DzB0>Aao{8lRW)#bWe*l(9X(snX@tB>-pl2`kLx8_FAj5i1& z;G6dJZ1N)&LLGx6cGP@b9dy4%rLEG&EAEKduQMQR51z`NH}Y&cZCt&O{& z$k=GlhM*q3E2?w*U>M_e31+UMhS`Wq)IauK!hywWi`HvB3gB7a$z1^u+t|6Fw&{4- z+$J4rjEKr2f2B|03t?dxzSC-&Z$wt_y-VeaB1Z5cEji0%;wI z1M!0yhFWax3)U@y#9=PRmMF0KHYTXyt5cUnzb{a7AyMle(qXxWM*4q`{(?<0KAk8)W6cW&7- z1P&}IfJufop>H*f{Dra#-xG_LiQ__LY^L;KBls|6?Uvt-M-PJ=B9@z6Rvn zu({DrW^-FY0Fx)t1}7UOHTKr#d0$KAoXeJU2jOQ_yz!m4T#YgSE~*fpa(|m0LWY@4^hiD`!rB2@KccGYb^*fieY%XDdbS}NI1cNsXC2zC$^V_`)-f%ax-54rfHEi0{7LJgEsptssidxWeA%Jado6dun`edD&4|6g^p&x-8wJ9A__5D#v) zl;2)mHY&e5)}1f2Y9ff{5J*pRYI`==gNu!>l_zm9zx@J=iQW281yYv3PMkJ(SH*k* zI*+EO{b~S$lZ>#=H0vsw@B^7bXke+lA%oagl6Xh~6g_+PPL_I8|0~H`K{#T*C`A}D z;q_c5dy^ef!#O6FnEknD+-3d>JcF@*)s4uEk_frXo9ugi&=B^_CD+%y7&(vbU~^)$ z72(C~NIcZ>bD~1n&wCentRmoV_+>6ki?>{8pqF^LK(`;B=SNT)0cgU!zI4b=4M6>5 zxJsa-$|0nE(}j7zbsZ{E(L?8#-Da5^mDBfzjrX?ydrsf+iFlkoBQSco7Pc?FtF$Y6 z^XXmCs2NI&AcCJ^lNcy?5HH8!z*&>^>YrgzzBtvE5W#!my`lnd&!}vk+>u)Vfu8>J zMt3M8M++mv#~Ui$(Sv&oL6wnl`YATxz6#t(&fWai9+jO}Mklo|`&sWNQ2nCPEpnYd z)j*zG)=1(i9JSgD_M}8vNTWk(8#-3Wf{ep~-on_HoBjh<^zugLzZC*4;%*Nz8`t}} zI#j|;U9E66q6oEIp?7h`C-1D51RiPeU;x7>5Z3q&3Y#UfRH?9!f@!Vit&Una#*Etd zw3aQVJ&D_+v!}x5Hw*aH>wGg9?7!gTCxJ^-hz9s42FNfi6bA*~*6k;#o?Wr!E#MR& zVlUQ5{p!Pw-{SdR`pL8qM*+-g=Y`0>mtzaxVxvbbS66l(yH7f4M!w8dnCyB$jt0+r zsMb0|F?@B4-{gBm$kG1*YtPL52wR8)DaQ0RJ#~v-U?ri^Y`B}oGSKgVFC(pnZEbs# zh1TGDU8{CgRrJjTb@9*acf1sf(3@-=3l(m=Zf4PD&4n1O?;%pjAF)W}UrVqt$%&Md zezyB^77<<+T7RKm$2tq7PU2U4Lc5z8f%uMmDCYfbes<24yF9MDG;n&f5${+XLfpcE zcEYh^S(_x-R(UrZ-;=3|dg*TrT1A3O_?hPBuhvGjVvy;X}f+|-~&y9!K6w3 z0IJLfOw=6iFjkzJ@prgY&5Pn5gnB+46zi`o0gcm7`!`-(?{4Jr?+_3hm2n!j=6Jng z9J^Hg#EATl)JfD}a_OGB~9DfVIwf#;g)o1PNg` z)vSSYOMB7!x+M~MA|{~KZg(P5&tgg^J+*BiPKlAR2(*?l$pG`|z<}T?q?>~}Q0N2H zgW75d&JLw|&hQwfUo0e}NKi#xU3+Bq3&fxVM!tc83#vzNWcfP7LYtFEs?wUy>oRh# z4Q+`qFZir4I00f8=Na3)}Q+|mH z$)A3U_G5l{D;{{B$=O;!kRqgl)sy|37W!32$!~v^5O*H1X8(4#b6)TqI-mXWx4lg) z)9Cg<(!-auvN#1*AE5rDhbVCGJoU4+-X|&VI2Go_ybWrgCbMShp^}Z1)}SAckF}(u zY#DBRudMpB9t>?oz%D1`$^(uvC7^MD7wbzwyo~XsAYEqVwei&zlQ!~Qd#JYOU3DKi z@B9y>VGBknns7z8&P>Zem=+g6^)A;>X~hnxJ;iei(8)hKqHd3(at-X z?UKxa?pU2j2Hz{WL)QoJbzsBTbi99QlTh2JNtY3U$P=C;)w|BsiI7&+i*=K*su+lR z^^$ChK<^GK7(LS#5ut8Wdkj(SFTjREWCnL->riE*ys@Y_lfhFJxbz@&6^xboOt2EZo*p(V`w6$D; zeSF&6xi10Vz&ojl0nW}P2_h;Rh%+gM?XH;T8yx~#`xvHT2NH0=#(z)K+nXnnf}92u zU_Phc5t_Q6F1v#I7>)99#wDqIFjR~8`YUhJjf>hikDu}KdFu8TE3FL9@B|k&tvUIl z;E!t=T3Lii9}W=@tAK;zdkXuxBP*mc9+ZV6>ty|z+fD%iewZb z03X1uruRH|Ta6^Rnoj02+Ta&yXh%RH^-_zsv_`uYoB(oke9>s zI-ukBF+F3^2JB14HrO8d%?m$%n~f_MxHLAuksi`z1P;^Qcg3UL&^3!ib19hz;oYV= zrd0?XyeC(Deb#>RX%biR_Dq&jOj)_(`gTfomTjUICYMU+=GeHZCm`(jfWC|*+w7K$ z5hW_l0vD_s*N9UiwaNUU^k{saCn5@x%PuV5PSM$8ywjeP@TxGgb*1c6vm`Ab5E0cG2mFSjN$EzRu#pGlTn-h&zJU>b z00aNuHd$t+s(dyuQ%I@tVOF~EWSN5>;@=d%G`o@%OTq1|7vXpWhP6bz7?~ZYBUMrt zc5y~f;K<*Zd)66&3A`r~q_qJKG&j;*ZS$qIbdIjyp<08)rK~W$%}NjvW8r-aq48e*ru;;H$fu5T+Ii?8O(}}+Ie_q{m8cfzw>wdY)}Jt#^H)6?XyBo zxV;RJKo%BTmMcC4g5a`?n$MCh+F}ewneS6Ob$nl%6>Ups(}X=h)S*8aviu2qP0LGQ z9=ssKgpK=EMeSYD{%r8x1}0Ue=Px|*i%PTRI-nb$MJa@UXe1+@9@N(NIwKL&2O zG10f40(>9L#Q@cs*Vd`$-c+1ClF>qtC2sZ`XYLy8mb_Q?I7;g@-w;JEFTCXr;IDIaX?YQ^S~#G`>*x8~_84@Ct87W>w(lrnSLH0Q?)1GPHASx|7I z)Vc5R0~rk+r+VeV5TST^*D>Mk1AMF-W$Q9PV5MTkUS#J```g_?u%*e-iv}vD=SP9h zAF<_k6c{M|WQ|o7AXF%%MxTbp@(UTkHivTecI5-;Fc0?YUex&9P+~7CqOUYKZ+JjV zX-$Voz}k3YIHkz-v(-B=lW`;9LjOCRJ&L!SJ>Q7$^+>;~a&O5htQVyZ#qd&MtZtUN z7z`S)qwD2L(uBaaHBc^Hdt=n9UU7q3{WH$QtN16Rd{w3)@x>Dr1Z6x|q2lz0xWEXJ z03voW!k3MT>tK|?3r0Xd7(t?}k)s79*5ZQ|W8<$iP|cYsAyCP}&GzU&;Lvu%N^iMX zbaM5yn+|AgDhCcE_WW_TpIXh6p?#W(6J&@p48S%(S@{jfqkt@P`$IEv=}KIyzaGxi zUGUwpW-hb*!=ElN{oe!Ul|e~baB|;=BzU0B@25P=Pp|Gzgjf7xSlnjPfvS)bC92y! z0K`UlgDZKAPxq6gk$CThtlEvX-fjKn*>CAdiAN%lI*oSJ-NzIE{L58Q>8!Y~tZ3^& z)8$HYl~%CBvE{0MmxX=_BNn2oOk#|}ig+E*^LUFhHG5=#rNT`{cuyoX+m08NR*f!rzl)7T3Q7Zmy=D%4gD5&c8&`fd*Id z_}K$(TL7FztMz3Y3YT{@gegx&GMG*!M;}Lq7zf|ks9d%H86TMnLTmt;$EtpA{wv}K zx2;@=cWAsPFAaHf^7+}9Q%YlFePSk495~+gSWK8chuYo8u6XuE z4RkMDVR8t6Dezbnusdbek_#A#Z{ssZ8)F}BdcUYiOdXi2`Os~)7Ji(Q9$uHDb@FK+ zS7YgS*q%fZ@Vq!X(25wCN!d5g+qeZo6hrbntEdq_RLMqf8TH7{nY+I*L0#+wBCj{K zS5An~D)g5=|6BHdm)2>K>Sl4LsG;3muqW}!m>H;wY;7K#cdB*G3hALD!{vpG{;XX% z;OsliDZ;ty%;ZlRYfg*<-XzJ#O8kdJ?Fp0uX0r@iQmayFtKT%>B!YW&xt?P@do#NJ~0phBoJ?O3Lq0L*Xobe94c?5h3VV-)_0_8 zQc9Mm(5@~&`U9eEW>_!sW#8>XQXwutOwqrRVLdAY{YImZA8x88ts5-rUSDn4=cd>Lz!{!=veP3V?3{tE1t{P0B?i9R zRJ-zX3?FuiVry48wZQWiy8*s|4BaGMie)pFFnyyZ#8tL2pI)8o?Y%625nKq4JY9tp zuu#B#*vY@K&_!}u>fWC-HoNNjoiyn|*QHF4Ye+m5yxVDR<8Cl@(&q{CjGiawPJ7OR znFV*kIJtxemtg%R0ntZ44POE=A|zo>@xB`Mm7Mcp_*Qoq`0mOID(){Tx}T~rsFQGr zO;|gWM@z@mG9+;p;@`dhR8~eTZw6aeDyybPPCzT*YmWVVfZ&0HgG%v?>R!qT{d`2r z$F3Ff$Zpg#Gl#bF@cw;)1+SqWF6QnR9j--OR!v_;)WmwbM(FI9WHnz%}kk7l0|%4IUfNmiOaj%RK+W0|=5=Pv7g6Fm`|Bf9bs6t3^gaDyBL zz|M{j!(evMKEAmLpwKhZwX=IZ_Qac(RN$o6Kp}=Q^*4LP2o(ga5;D`>qoFV_Xpj7R zUtm~{d;Q$6ZdQ^Po!A3M*YyXiPFK)&@qk+x4G;CDEBRNirV zv`mivd&CSGkl7f~(m#2S3SK|cBvU7TZ?K(#z=@pu3w`TH--B<=U|JwPUeJvF1p&eU z&{BOfKV=cNNr1^RssmMlIq@rAz{;2xnYm~Zg(aChf7H-`dU0}r1(7jbrT?k~w*PuR z#2@Gt9|Iq455#Qk`a!22XN{uIvfni*@p%w3;BI5_k`1{f$nxA(1y#V-{uwCl5r&#FDDxF~50n9qshH%h-|CQ&u$NUnu72 zjgErNZBETwg(v-AB!p?gOPcbp|6G=JUBsiNDHpF82tm_n5PifJ0F?TyWbYPO^04Do zP@$71Z%rxmtK=aF?oxlCLn5=%W=Fft{6QsdV@^z-rqbWJcodmwLbpX5v+y+knGhhO zTU`Rh=mk^=_f^aeqG{RH&EU?aHfHI)J!>g&l*65|fU}FRTFWtu1Gb2>Q~2a_1z6HD z_{2gtZLY*FNK(FZwO+to(iqPmElk1WEBr#&aFr`8$3AJbYAu86&Apet=f~Yqt{L3{ z0%lh=x|uh>o-X>U4~|PBCuot9(cDm?q}gIzcg72VY?f93`-VNKSo8Ii9==rq10Opc zr3d8RIIMP$ven;6{mHhhIPgBWWmhCaLMN6J@xdcAo!5I^u{9^8`LCJv*CNCucO z>d!EhT?olZlz)c5Z%j371q`l|Gq`ZN@ZhlzyNTOxpe!VY=PZss*U`60&Vm{HD}C#E zA&9*k3r;Ljl<;)$Vc%R>WoA{t&}`1R@h_qla*(iUMz`1LcV^Uw%jZwFCo9A#l?m<) z?5dmxQ+?>JX%R3x)!duOA)S-~i#P27+!f8Hf0eEhvZ3AkT-h!H8^&Mul4@tY;u);oHD@_v2OU31tUGEhGtk&yPu2IrO=nO{-LQ%qS{dH zuekx}9ML)bz`7inKxElQhv3JhXDgYf_K z)>;vJw34Q<=@U1|FqPgT_l6X}tpu@1+)_@*qELLQu{~3xXs$L!g$G@#!>^A3Uq~NG zSFDG3v2BV?=Rgc?(pxJjGA5Cpy{pe`8`>Fa(YiTym%codac{Uob&s#;FgkJH6*m{a z@V6-r3P-iQqWA`>W=LSd1>oo5QbqH`H#Gsk2whQ_+R}3ipBPLaV?i58SqV8O<*K$t zQp+}q;Omr#4k|nrAoql7b+%Io^o=AiKG24{NLW>?`(;DRGwHqqsZr{E&jS*s*H!GC zwaGoS%J1@oNo|xgeXGy(RF)tDU`rk23Lt(u;0pwM4PQdrg&F&izq3XMzKi-0Kx&v< zK&y7Hu9DM(L9OH0w8h!_IC9km6)Jmn$-1(Lr;p3%%#F)E@|62%UT}3Me49Xh^A`Lx z)@aP+$@1_DcvIzqmyo~N%oamt9HneLIRqX)9Uv@lGc}~OSU)Pr=HA@u`TjG3v1%rL zH({3&IqoLGsT3mQ;KvYcU|?!E?UVtj9)4=-?K@va+Xu`Q$~Rh+F#U1;@4zKig zyx&Cln*b5B`nZZvO{Mq*Y`AkAX(wo*RDdcVYrI_Hr|lWxmjxiMJ)9XYmg!->5B4mq zA@Crb?|sz>)i*|=Hz)(STuOGR0R0t>x>qMO&o0|JZ0>`TKw_SpFZ{dRs#lB zNGB`s;M^`0fn5(o7b}$gasG^%*Xi_EMbAygpSCXl=P4N9{=c3As#9E|LX1(5J;2Uk zbq{0ScQVrW`>t0O7`&OUPX2M$iKnEswmvAxg8eo?1A9qVP-fhJWYs3*p!G)hO&O$` z;*DEJiGv#y8XU%A94B4U^!?+?)kXEhmCe@XL&Jvw%iph+6fgX8x3sK*{{Y!|@ZlL` zmHgA>&yp`SO66~t3s`OgC2#R$9=I+Y|*NRT$gzi7)+d|b7 zPz-z9Ulf672l%<*(G)~vekHxa&go0}fl+04f4sN_BpSrSB(^`V$KdP7b6xLjgSlrl zct%_BJ&P)@0Za9HZ^w-q+q`aMi>a41!mL~PVo@eWoCdnV^YBpgR-AFs5r>KziCCz%W zl&i1gS7wV|OYcVC{jWJWw(txx7Xq?B#-0FrGQ@XZAgv_n1|lIaQoLRGe%40icy*$@ zdtxgxalTn-TeU->RDb9-E!|otCMw0fApWR$;KZoAHpZ& zVMkP)tbkPxsgENoHu)cd2Wb0si(Q^YNc7Yn!gqa51`Z67K<(UA676^)E?F;r9`KOSFXIA^oxoMW90p zB;SCDinn;I=N=4nf8~R}?F-T4w&rh6H>!e;NvK}mZh5r2QdQCf`bf$I(^}eo%sqQk zoN+s&+^m0+@irId;~nrw?-ZrxEDgTZ)Jd^o{p;n~rsj8(WM~h&iB2A&cL6BWg-{mS z7)Qr24>zPvAdDd8;AH_M0Cg(8S%jfNnEx1q7KGDPV|>s5QWScCgpB3s;!9;X3$nMV#rmU}o7cen zl{?*L*8qa;TYS(f!IRFEsuRb>R2zS^Q4e|{wrU2NBw@CTeic#g;pjeozN1!08 z3tB6zTxmPFXON>O2Wm$bJjVxyAX|51#tXplJ_flaOj)eeyC+R&M91C>m`wqjM-T(aU68)v0D-xboOMuw9fVN6fq&ecd&qU1dC{&3*`%ZpD3MGx+ zG>P}h57V}R&GJ(H#s{!PzxeV)5Q>M6s3sOtY>KM};95qxt1J=GV$qr^W(JK0x3_{l zbD0c3ETGIOmvjh__|-%(Kop#fOXDkKj6QQD)1tVAQ!eI5ZQ_}%LKnFT}JJpgnTPs@jMN(2H=i6oNDGn zel&%el3YK-S;RXWT{ajVpUOO4g``d>RsYf4e;7;R0+b8R>Zr33(2)>FNLX>O3q%FY zKo#nq1EQ+F*l%()d6N-aYJKNU1*fZUQLtKD*vG`df}!~&)p`ZLysLPY!ilqE6taLe zmsAz>!$LHFNEzxbe6TYvRD^DpL#!b#T32&=V^FO9?O_$q?$xNuUiuv>PGuM`&zJ$F z=0&h;kv)6P2morO{2k1Ic2_06H+U&83<@cp%YJG@r7o%ejx(rp>|d92uEQj#ZO#!} zw!H}v%$W@Ow2|k`Vz2M_Sx81%?~=F_>dNMSQ(ZHCtafemrXBQJgaZ#v=`axWdryTU z?T!1L$vs?1C!Im2?rWlDLMmvC^{{hszT-8^c`x|O!727D z--TJPRt9r|7{h_sp1bkr72Ubtlx*yUR##geMl7fkPFTtcZD!^8LrmrPL2gRE9JltT z@$YF0(XZ3R@nCv+m5Zf5_+)Zjgz6xQ zx8;7Pf%HiDE?hj_By^JL(<*$N*<_qE);gqEiGUU;t~LpW%YWmsq%4m^g4#p1Bq{N& z#MN^OczJ{bRlN?$Uj~~55rkTZ^BsD6us&_nAK$N=q_2^5e6=pcEgVdGNak!f*>uS= z38!#$fTO?D3$)g7Fl7Bklv)Exqj z*srB`Ky2YE=zIJ|(AQs&G%hE!6j`AEwm?`$@i`VY&dMI5!>B^Z%#J%V>;kQ90bEw! zw?#`QO`F{wJF(;Tu@jR>Fm%HLBlxFF^}>0qp7YnK7b zs9ar{(3$y~=t=J34*i1YB?8_#!WYd6+nn?+M|;<*K*MG{QEra$H^}IU<$SB-b8`uZ|kXQHDFMg7mD zFulwb4lao#mJi3URL89OBve9}mUPxqg{?eRQtaFj(+s$Eiqn;iiL%iB_c_Mv(ZmrE z2uaGtmz-nPxu&~)JD&V3O4s_s_2-_(TqKdB(*_yD^kEC0yRREL;N~QJ~16y z+t)GywU2*lTZ2*IH$euP(*>lDY;ILc;31WPagx{UM#my|3aN;_l+DB&h75{NUA~r@ zJH%M9hY5mHq`QJNczO|tVH@{8A3L+mq*lLC+9f*DI^{WjB+|6;E!Lly48$02WJ$Nc;*movb+Ly2WtF8gG1wxd#T znnP52qiB7`0*M30s!TG@e^BrQyE!wco-sUyeo zrRV#Si9k1?ey`J<&Vef9UXsAoY^P{Ojik$~_0rY5nuNK)dqrgts(y{AIh|z5;nXx& zh3JK)@V=Hsk;jPNd_Bb7tJtwbcgT7L`EQV%OXjRBmeG&coOs71FaCRPHz!7)H7jJp2s+JunTe}wM?;00VP;mKsGZ2Pf zf~k-6*g~o7wRWB}d#O~uGhlTG!lg_GARxra6r1w?G>_!1QEF692s!`jJhBRKKpKvCaKRe(uQCyZ36q4g9f@qQ+jje>SXn zzO&9|g_9m;sB$aj5Y0aTq}Fw0C*o+JXu&h)u>Bss;e4#C&NFe%oAS}4-fP*NDV39) zWvT3dLB45E6Z2GzVUo$#}l%!M8U0w&}%a3${I#s+`F#daP0_ zilz9Ek+pY$kc0sP%l)535e}3!iQEB3tLGOkBEeD+mGk>_Ml9;>UVv5pZ2MN$BY+9` zPH-2JD-i7%jmQWwiTh&bEG?d9zwrCyb3#+b7~&z1uJ+e z&!wRiB4l|ZbC%)^0Udl^49EYD<43E&?V-ui5xh#s5J7s6x0vN!SUHY8G*3i<=W*f$ zSr1Xz%4)MCXpXyaugJHp=;R_yf}of443+~8ma{u~^&XJXKuMkx5*L?Q z2>mZTw!N`lc>>#$xBgr<6%>5Kq4D!QmRC0mU?8ZZaBD zgkcDj9KAg_x3GRv51Q5HT>EMopGVUiQHt`H1?K#>@R-M^JJU8G4I*(ZI3Tltw(h&6 zcNHb8NF%WnJ4#} zptQb7=ru3dRz!0pVw~#j9mG8L@t?@sKdw_7juzwIT^>>j5^tNxwDI3a>{OK+R+Tma zg?I=SaFRf`0Rvy4#6t`r@oyc0%7kcjD5i<{6`xq0fClMgEa~Jk{+_f1K3m}?U<2=C zN}yk+@az~en<3?M+-N6q{QqjM=>#~k@m@NN@Hx7fA);A=VOooo3Ou@ls=dvzqZ{03#kZ;V^UWmtIW>P+D9i_^x5|;d^{;X`J1s?#6SNxg8+7y;zcnGSo_7ZHv> z@lG<$&ea>{0+27$6Dxf`WDjJkgcQ*9bI@^8-Lq4RBYjn@Nm!RvI0nlI>d|lY{{gTk zxy@Mg!y}1#`0fc;&i;5-meJyAQ{q@&&~0%&#v>Fb%x+!EE1)fmmGL7qC)Fs0Q1D&XzJg-$m=Q@HR}jcO`DP^ zHikC^>*p04$0UQJf8sAPKSM0-@a3Z+LREp)#o(=b@3~jW(c=f8fwthC3-B%jTD!g| zxs}KBAjYU^L(Rex4nTzUE;}sFq-IDhCmolc%aTwqyEm0DEApqqQEEqZSgh=!Cd z3))g`mB#QCb8JcBO+fU?A!QQyc5y@5iRGlxPX_l1OIgN<3*?{ z^-jz>R@`o9P|s#I^0I6+74nG-{2-kj*7Zv(I{8w~A`SWA5VZIcss zW~+tL5p!?N58vwSsTlPn?^fR9n0pt^$Z6O)q;&T4B-@7=$qu~hP4KaXk#LLc%SvrB$Ps1Nn>D}FV z#=oO!c`VKEDle*C+Vl_4U-zURi4y^|_wfD}JlW7ms>3z4_$<`R#X!80C?6Xg0BWs$k6{Kww))B1*IDaM znDD}(QJ@kGm(4ScQ+XG;!4G1BAm7IkKx}nP_7HPukUM&UmdWUnq5Z>0`&NE5xy5++ zk%QmNwzgC+GqCLhV93rB4m_s0z$lwvsj(Ca-0VBMJWac&YBh2$9%?KjQPwyi#9B)v zu6-lL0Mv^0CNQ1(#N}|KraXF`{5$~{!23#bpRpTk@eUh$fP)<&5F#^OSYmv9y+2u4 zWxki+OI6vo28~-(_k4)0qOP9L5`U54;y zg?H#5vR56pm+_2q+3Qo!`}k@n+amc!!F3bUypbXQ{SDfgPk#1=4AlDXf^X<+u)K0y zOCX~iDGp44za@sEiJstY6EJxMKFOGFRF5?}W?6fLHTC79iU*!mBpAqdlEs_|n;%qx zYkBrH_M-U8TogP>CLjOG8T>>RWPUX{QtCffH$nY(GadyhOKG4VWy6fdaUJWlqJ(76Cui z6>XAO(thW8mp>`lc*gK8UcV0@yS#~B*Zx<{w-x9U6&8?wr6K#< z=ilVZ2&;uF>$9+hS{iU6jGwwKSFL2$K1O8EW0-;X6v{`xDWx|aZ$>X|2a$u%$o6=V zCOg)bNmyNe^_(xgoew0(7`z7g`ut=ZK{-q;N8gX|TWRhqmqQlPJ6Isl3L#%gAX?55Camx$N;_R*`Uej|w Date: Fri, 7 Sep 2018 20:26:10 +0530 Subject: [PATCH 2/8] cache static assets for offline use --- examples/demo.js | 10 +++++++++ examples/sw.js | 58 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 examples/sw.js diff --git a/examples/demo.js b/examples/demo.js index f610fe3be1..2a18341950 100644 --- a/examples/demo.js +++ b/examples/demo.js @@ -51,4 +51,14 @@ window.onload = function() { step.options.step.imgElement.src = reader.result; } }); + + if ('serviceWorker' in navigator) { + navigator.serviceWorker.register('sw.js',{scope : '/examples/'}) + .then(function(registration) { + console.log('Registration successful, scope is:', registration.scope); + }) + .catch(function(error) { + console.log('Service worker registration failed, error:', error); + }); + } }; diff --git a/examples/sw.js b/examples/sw.js new file mode 100644 index 0000000000..6c299f6da1 --- /dev/null +++ b/examples/sw.js @@ -0,0 +1,58 @@ +const filesToCache = [ + 'index.html', + 'demo.css', + '../icons/ic_192.png', + 'index.html', + 'demo.js', + 'lib/defaultHtmlSequencerUi.js', + 'lib/defaultHtmlStepUi.js', + 'lib/urlHash.js', + 'images/tulips.png', + '../node_modules/jquery/dist/jquery.min.js', + '../node_modules/bootstrap/dist/js/bootstrap.min.js', + '../src/ui/prepareDynamic.js', + '../dist/image-sequencer.js', + '../node_modules/imgareaselect/jquery.imgareaselect.dev.js', + '../node_modules/bootstrap/dist/css/bootstrap.min.css', + '../node_modules/font-awesome/css/font-awesome.min.css', + '../node_modules/imgareaselect/distfiles/css/imgareaselect-default.css', + 'images/cyan.jpg', + 'images/diagram-6-steps.png', + 'images/diagram-workflows.png', + 'images/grid-crop.png', + 'images/grid.png', + 'images/IS-QR.png', + 'images/load.gif', + 'images/monarch.png', + 'images/red.jpg', + 'images/red.png', + 'images/replace.jpg', + 'images/test.gif', + 'images/test.png', + 'images/test.png.js', + 'images/test.gif.js', + 'images/IS-QR.js', + 'fisheye.html', + 'replace.html', + 'demo-old.css' +]; + +const staticCacheName = 'pages-cache-v1'; + +self.addEventListener('install', event => { + console.log('Attempting to install service worker and cache static assets'); + event.waitUntil( + caches.open(staticCacheName) + .then(cache => { + return cache.addAll(filesToCache); + }) + ); +}); + +self.addEventListener('fetch', function(event) { + event.respondWith( + fetch(event.request).catch(function() { + return caches.match(event.request); + }) + ); +}); \ No newline at end of file From ffa145098ac4768faec51b1b8672d6a59d24609f Mon Sep 17 00:00:00 2001 From: Mridul Aggarwal Date: Sat, 8 Sep 2018 19:54:34 +0530 Subject: [PATCH 3/8] update cache --- examples/sw.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/examples/sw.js b/examples/sw.js index 6c299f6da1..0d73f901ab 100644 --- a/examples/sw.js +++ b/examples/sw.js @@ -37,7 +37,7 @@ const filesToCache = [ 'demo-old.css' ]; -const staticCacheName = 'pages-cache-v1'; +const staticCacheName = 'image-sequencer-static-v1'; self.addEventListener('install', event => { console.log('Attempting to install service worker and cache static assets'); @@ -49,6 +49,22 @@ self.addEventListener('install', event => { ); }); +self.addEventListener('activate', function(e) { + console.log('[ServiceWorker] Activate'); + e.waitUntil( + caches.keys().then(function(cacheNames) { + return Promise.all( + cacheNames.filter(function(cacheName){ + return cacheName.startsWith('image-sequencer-') && + cacheName != staticCacheName; + }).map(function(cacheName){ + return cache.delete(cacheName); + }) + ); + }) + ); +}); + self.addEventListener('fetch', function(event) { event.respondWith( fetch(event.request).catch(function() { From 56d9c20dce52fe8612f9aecd60a34bd17d6ac5de Mon Sep 17 00:00:00 2001 From: Mridul Aggarwal Date: Sun, 9 Sep 2018 16:27:09 +0530 Subject: [PATCH 4/8] add meta theme-color and change static files to be cache --- examples/index.html | 1 + examples/sw.js | 56 +++++++++++++++------------------------------ 2 files changed, 20 insertions(+), 37 deletions(-) diff --git a/examples/index.html b/examples/index.html index 2805e22952..39f574d026 100644 --- a/examples/index.html +++ b/examples/index.html @@ -7,6 +7,7 @@ + diff --git a/examples/sw.js b/examples/sw.js index 0d73f901ab..8c22ecc40a 100644 --- a/examples/sw.js +++ b/examples/sw.js @@ -1,40 +1,21 @@ const filesToCache = [ - 'index.html', - 'demo.css', - '../icons/ic_192.png', - 'index.html', - 'demo.js', - 'lib/defaultHtmlSequencerUi.js', - 'lib/defaultHtmlStepUi.js', - 'lib/urlHash.js', - 'images/tulips.png', - '../node_modules/jquery/dist/jquery.min.js', - '../node_modules/bootstrap/dist/js/bootstrap.min.js', - '../src/ui/prepareDynamic.js', - '../dist/image-sequencer.js', - '../node_modules/imgareaselect/jquery.imgareaselect.dev.js', - '../node_modules/bootstrap/dist/css/bootstrap.min.css', - '../node_modules/font-awesome/css/font-awesome.min.css', - '../node_modules/imgareaselect/distfiles/css/imgareaselect-default.css', - 'images/cyan.jpg', - 'images/diagram-6-steps.png', - 'images/diagram-workflows.png', - 'images/grid-crop.png', - 'images/grid.png', - 'images/IS-QR.png', - 'images/load.gif', - 'images/monarch.png', - 'images/red.jpg', - 'images/red.png', - 'images/replace.jpg', - 'images/test.gif', - 'images/test.png', - 'images/test.png.js', - 'images/test.gif.js', - 'images/IS-QR.js', - 'fisheye.html', - 'replace.html', - 'demo-old.css' + '/examples/#steps=', + '/node_modules/jquery/dist/jquery.min.js', + '/node_modules/bootstrap/dist/js/bootstrap.min.js', + '/src/ui/prepareDynamic.js', + '/dist/image-sequencer.js', + '/examples/lib/urlHash.js', + '/examples/lib/defaultHtmlStepUi.js', + '/examples/lib/defaultHtmlSequencerUi.js', + '/examples/demo.js', + '/node_modules/imgareaselect/jquery.imgareaselect.dev.js', + '/node_modules/bootstrap/dist/css/bootstrap.min.css', + '/node_modules/font-awesome/css/font-awesome.min.css', + '/node_modules/imgareaselect/distfiles/css/imgareaselect-default.css', + '/examples/demo.css', + 'https://raw.githubusercontent.com/theleagueof/league-spartan/master/_webfonts/leaguespartan-bold.woff2', + '/node_modules/font-awesome/fonts/fontawesome-webfont.woff2?v=4.5.0', + '/examples/images/tulips.png' ]; const staticCacheName = 'image-sequencer-static-v1'; @@ -58,7 +39,7 @@ self.addEventListener('activate', function(e) { return cacheName.startsWith('image-sequencer-') && cacheName != staticCacheName; }).map(function(cacheName){ - return cache.delete(cacheName); + return caches.delete(cacheName); }) ); }) @@ -66,6 +47,7 @@ self.addEventListener('activate', function(e) { }); self.addEventListener('fetch', function(event) { + console.log(event.request); event.respondWith( fetch(event.request).catch(function() { return caches.match(event.request); From 7786dde5529a5dd51fc0cc56e7a7594c80c188cb Mon Sep 17 00:00:00 2001 From: Mridul Aggarwal Date: Tue, 11 Sep 2018 22:46:01 +0530 Subject: [PATCH 5/8] cache the files on network request --- examples/sw.js | 42 +++++++++++------------------------------- 1 file changed, 11 insertions(+), 31 deletions(-) diff --git a/examples/sw.js b/examples/sw.js index 8c22ecc40a..7ed8eab217 100644 --- a/examples/sw.js +++ b/examples/sw.js @@ -1,33 +1,7 @@ -const filesToCache = [ - '/examples/#steps=', - '/node_modules/jquery/dist/jquery.min.js', - '/node_modules/bootstrap/dist/js/bootstrap.min.js', - '/src/ui/prepareDynamic.js', - '/dist/image-sequencer.js', - '/examples/lib/urlHash.js', - '/examples/lib/defaultHtmlStepUi.js', - '/examples/lib/defaultHtmlSequencerUi.js', - '/examples/demo.js', - '/node_modules/imgareaselect/jquery.imgareaselect.dev.js', - '/node_modules/bootstrap/dist/css/bootstrap.min.css', - '/node_modules/font-awesome/css/font-awesome.min.css', - '/node_modules/imgareaselect/distfiles/css/imgareaselect-default.css', - '/examples/demo.css', - 'https://raw.githubusercontent.com/theleagueof/league-spartan/master/_webfonts/leaguespartan-bold.woff2', - '/node_modules/font-awesome/fonts/fontawesome-webfont.woff2?v=4.5.0', - '/examples/images/tulips.png' -]; - const staticCacheName = 'image-sequencer-static-v1'; self.addEventListener('install', event => { - console.log('Attempting to install service worker and cache static assets'); - event.waitUntil( - caches.open(staticCacheName) - .then(cache => { - return cache.addAll(filesToCache); - }) - ); + console.log('Attempting to install service worker'); }); self.addEventListener('activate', function(e) { @@ -47,10 +21,16 @@ self.addEventListener('activate', function(e) { }); self.addEventListener('fetch', function(event) { - console.log(event.request); event.respondWith( - fetch(event.request).catch(function() { - return caches.match(event.request); + caches.open(staticCacheName).then(function(cache) { + return cache.match(event.request).then(function (response) { + return response || fetch(event.request).then(function(response) { + if(event.request.method == "GET") + cache.put(event.request, response.clone()); + return response; + }); + }); }) ); -}); \ No newline at end of file +}); + From 7667928ab4af18b01855248b219e38a4198c38fc Mon Sep 17 00:00:00 2001 From: tech4GT Date: Mon, 24 Sep 2018 11:10:47 +0530 Subject: [PATCH 6/8] caching on first run Signed-off-by: tech4GT --- dist/image-sequencer.js | 6562 +++++++++++++++++------------------ dist/image-sequencer.min.js | 2 +- examples/demo.js | 27 +- 3 files changed, 3299 insertions(+), 3292 deletions(-) diff --git a/dist/image-sequencer.js b/dist/image-sequencer.js index bbf0eaef33..f5ae299809 100644 --- a/dist/image-sequencer.js +++ b/dist/image-sequencer.js @@ -47312,3377 +47312,3377 @@ arguments[4][38][0].apply(exports,arguments) },{"dup":38}],135:[function(require,module,exports){ arguments[4][39][0].apply(exports,arguments) },{"./support/isBuffer":134,"_process":98,"dup":39,"inherits":57}],136:[function(require,module,exports){ -// add steps to the sequencer -function AddStep(_sequencer, image, name, o) { - return require('./InsertStep')(_sequencer,image,-1,name,o); -} -module.exports = AddStep; +// add steps to the sequencer +function AddStep(_sequencer, image, name, o) { + return require('./InsertStep')(_sequencer,image,-1,name,o); +} +module.exports = AddStep; },{"./InsertStep":140}],137:[function(require,module,exports){ -var fs = require('fs'); -var getDirectories = function(rootDir, cb) { - fs.readdir(rootDir, function(err, files) { - var dirs = []; - if (typeof (files) == "undefined" || files.length == 0) { - cb(dirs); - return []; - } - for (var index = 0; index < files.length; ++index) { - var file = files[index]; - if (file[0] !== '.') { - var filePath = rootDir + '/' + file; - fs.stat(filePath, function(err, stat) { - if (stat.isDirectory()) { - dirs.push(this.file); - } - if (files.length === (this.index + 1)) { - return cb(dirs); - } - }.bind({ index: index, file: file })); - } - } - }); -} - -module.exports = function ExportBin(dir = "./output/", ref, basic, filename) { - - // If user did not give an output filename so we can continue without doing anything - dir = (dir[dir.length - 1] == "/") ? dir : dir + "/"; - if (ref.options.inBrowser) return false; - fs.access(dir, function(err) { - if (err) console.error(err) - }); - if (filename && basic) { - for (var image in ref.images) { - var steps = ref.images[image].steps; - var datauri = steps.slice(-1)[0].output.src; - var ext = steps.slice(-1)[0].output.format; - var buffer = require('data-uri-to-buffer')(datauri); - fs.writeFile(dir + filename, buffer, function() { }); - } - } - else { - getDirectories(dir, function(dirs) { - var num = 1; - for (var d in dirs) { - if (dirs[d].match(/^sequencer(.*)$/) == null) continue; - var n = parseInt(dirs[d].match(/^sequencer(.*)$/)[1]); - num = (n >= num) ? (n + 1) : num; - } - fs.mkdir(dir + 'sequencer' + num, function() { - var root = dir + 'sequencer' + num + '/'; - for (var image in ref.images) { - var steps = ref.images[image].steps; - if (basic) { - var datauri = steps.slice(-1)[0].output.src; - var ext = steps.slice(-1)[0].output.format; - var buffer = require('data-uri-to-buffer')(datauri); - fs.writeFile(root + image + "_" + (steps.length - 1) + "." + ext, buffer, function() { }); - } - else { - for (var i in steps) { - var datauri = steps[i].output.src; - var ext = steps[i].output.format; - var buffer = require('data-uri-to-buffer')(datauri); - fs.writeFile(root + image + "_" + i + "." + ext, buffer, function() { }); - } - } - } - }); - }); - } -} +var fs = require('fs'); +var getDirectories = function(rootDir, cb) { + fs.readdir(rootDir, function(err, files) { + var dirs = []; + if (typeof (files) == "undefined" || files.length == 0) { + cb(dirs); + return []; + } + for (var index = 0; index < files.length; ++index) { + var file = files[index]; + if (file[0] !== '.') { + var filePath = rootDir + '/' + file; + fs.stat(filePath, function(err, stat) { + if (stat.isDirectory()) { + dirs.push(this.file); + } + if (files.length === (this.index + 1)) { + return cb(dirs); + } + }.bind({ index: index, file: file })); + } + } + }); +} + +module.exports = function ExportBin(dir = "./output/", ref, basic, filename) { + + // If user did not give an output filename so we can continue without doing anything + dir = (dir[dir.length - 1] == "/") ? dir : dir + "/"; + if (ref.options.inBrowser) return false; + fs.access(dir, function(err) { + if (err) console.error(err) + }); + if (filename && basic) { + for (var image in ref.images) { + var steps = ref.images[image].steps; + var datauri = steps.slice(-1)[0].output.src; + var ext = steps.slice(-1)[0].output.format; + var buffer = require('data-uri-to-buffer')(datauri); + fs.writeFile(dir + filename, buffer, function() { }); + } + } + else { + getDirectories(dir, function(dirs) { + var num = 1; + for (var d in dirs) { + if (dirs[d].match(/^sequencer(.*)$/) == null) continue; + var n = parseInt(dirs[d].match(/^sequencer(.*)$/)[1]); + num = (n >= num) ? (n + 1) : num; + } + fs.mkdir(dir + 'sequencer' + num, function() { + var root = dir + 'sequencer' + num + '/'; + for (var image in ref.images) { + var steps = ref.images[image].steps; + if (basic) { + var datauri = steps.slice(-1)[0].output.src; + var ext = steps.slice(-1)[0].output.format; + var buffer = require('data-uri-to-buffer')(datauri); + fs.writeFile(root + image + "_" + (steps.length - 1) + "." + ext, buffer, function() { }); + } + else { + for (var i in steps) { + var datauri = steps[i].output.src; + var ext = steps[i].output.format; + var buffer = require('data-uri-to-buffer')(datauri); + fs.writeFile(root + image + "_" + i + "." + ext, buffer, function() { }); + } + } + } + }); + }); + } +} },{"data-uri-to-buffer":13,"fs":42}],138:[function(require,module,exports){ -function objTypeOf(object){ - return Object.prototype.toString.call(object).split(" ")[1].slice(0,-1) -} - -function getPrimitive(object){ - return (objTypeOf(object)=='Array')?object[0]:object; -} - -function makeArray(input) { - return (objTypeOf(input)=="Array")?input:[input]; -} - -function copy(a) { - if (!typeof(a) == "object") return a; - if (objTypeOf(a) == "Array") return a.slice(); - if (objTypeOf(a) == "Object") { - var b = {}; - for (var v in a) { - b[v] = copy(a[v]); - } - return b; - } - return a; -} - -function formatInput(args,format,images) { - images = []; - for (var image in this.images) { - images.push(image); - } - var json_q = {}; - var format_i = format; - if (format == "+") - format = ['o_string_a', 'string_a', 'o_object']; - else if (format == "-") - format = ['o_string_a', 'number_a']; - else if (format == "^") - format = ['o_string_a', 'number', 'string', 'o_object']; - else if (format == "r") - format = ['o_string_a', 'o_number']; - else if (format == "l") - format = ['o_string','string','o_function']; - - /* - formats: - addSteps :: o_image_a, name_a, o_o - o_string_a, string_a, o_object => { image: [{name,o}] } - removeSteps :: o_image_a, index_a - o_string_a, number_a => { image: [index] } - insertSteps :: o_image_a, index, name, o_o - o_string_a, number, string, o_object => { image: [{index,name,o}] } - run :: o_image_a, o_from - o_string_a, o_number => { image: index } - loadImages :: image, src, o_function - string, string, o_function => { images: [{image:src}], callback } - - optionals: - image: o_string_a - options: o_object - from: o_number - callback: o_function - */ - - if(format[format.length-1] == "o_object") { - if(objTypeOf(args[args.length-1]) != "Object") - args.push({}); - } - else if (format[format.length-1] == "o_number") { - if(typeof(args[args.length-1]) != "number" && objTypeOf(args[0])!="Object") - args.push(1); - } - else if (format[format.length-1] == "o_function") { - if(objTypeOf(args[args.length-1]) != "Function" && objTypeOf(args[0])!="Object") - args.push(function(){}); - } - - if(format[0] == "o_string_a") { - if(args.length == format.length - 1) { - var insert = false; - for (var i in args) { - if (format[parseInt(i)+1].includes( typeof(getPrimitive(args[i])) )){ - insert = true; - } - else {insert = false; break;} - } - if(insert) - args.splice(0,0,copy(images)); - } - } - else if (format[0] == "o_string" && format_i == "l" && args.length == 2) { - if (typeof(args[0]) == "string") { - var identifier = "image"; - var number = 1; - while (this.images.hasOwnProperty(identifier+number)) number++; - args.splice(0,0,identifier+number); - } - } - - if(args.length == format.length) { - for (var i in format) { - if (format[i].substr(format[i].length-2,2)=="_a") - args[i] = makeArray(args[i]); - } - } - - if (args.length == 1) { - json_q = copy(args[0]); - if(!(format_i == "r" || format_i == "l")) { - for (var img in json_q) - json_q[img] = makeArray(json_q[img]); - } - } - else if (format_i == "r") { - for (var img in args[0]) json_q[args[0][img]] = args[1]; - } - else if (format_i == "l") { - json_q = { - images: {}, - callback: args[2] - } - json_q.images[args[0]] = args[1]; - } - else { - for (var img in args[0]) { - var image = args[0][img]; - json_q[image] = []; - - if(format_i == "+") { - for(var s in args[1]) { - json_q[image].push({ - name: args[1][s], - o: args[2] - }); - } - } - - if(format_i == "-") { - json_q[image] = args[1]; - } - - if(format_i == "^") { - var size = this.images[image].steps.length; - var index = args[1]; - index = (index==size)?index:index%size; - if (index<0) index += size+1; - json_q[image].push({ - index: index, - name: args[2], - o: args[3] - }); - } - - } - } - - if(format_i == "l") { - json_q.loadedimages = []; - for (var i in json_q.images) json_q.loadedimages.push(i); - } - - return json_q; - -} -module.exports = formatInput; +function objTypeOf(object){ + return Object.prototype.toString.call(object).split(" ")[1].slice(0,-1) +} -},{}],139:[function(require,module,exports){ -if (typeof window !== 'undefined') { isBrowser = true } -else { var isBrowser = false } -require('./util/getStep.js'); - -ImageSequencer = function ImageSequencer(options) { - - var sequencer = (this.name == "ImageSequencer") ? this : this.sequencer; - options = options || {}; - options.inBrowser = options.inBrowser || isBrowser; - options.sequencerCounter = 0; - - function objTypeOf(object) { - return Object.prototype.toString.call(object).split(" ")[1].slice(0, -1) - } - - function log(color, msg) { - if (options.ui != "none") { - if (arguments.length == 1) console.log(arguments[0]); - else if (arguments.length == 2) console.log(color, msg); - } - } - - function copy(a) { - if (!typeof (a) == "object") return a; - if (objTypeOf(a) == "Array") return a.slice(); - if (objTypeOf(a) == "Object") { - var b = {}; - for (var v in a) { - b[v] = copy(a[v]); - } - return b; - } - return a; - } - - function makeArray(input) { - return (objTypeOf(input) == "Array") ? input : [input]; - } - - var image, - steps = [], - modules = require('./Modules'), - sequences = require('./SavedSequences.json'), - formatInput = require('./FormatInput'), - images = {}, - inputlog = [], - events = require('./ui/UserInterface')(), - fs = require('fs'); - - - - if (options.inBrowser) { - for (o in sequencer) { - modules[o] = sequencer[o]; - } - sequences = JSON.parse(window.localStorage.getItem('sequences')); - if (!sequences) { - sequences = {}; - window.localStorage.setItem('sequences', JSON.stringify(sequences)); - } - } - - // if in browser, prompt for an image - // if (options.imageSelect || options.inBrowser) addStep('image-select'); - // else if (options.imageUrl) loadImage(imageUrl); - - function addSteps() { - var this_ = (this.name == "ImageSequencer") ? this : this.sequencer; - var args = (this.name == "ImageSequencer") ? [] : [this.images]; - var json_q = {}; - for (var arg in arguments) { args.push(copy(arguments[arg])); } - json_q = formatInput.call(this_, args, "+"); - - inputlog.push({ method: "addSteps", json_q: copy(json_q) }); - - for (var i in json_q) - for (var j in json_q[i]) - require("./AddStep")(this_, i, json_q[i][j].name, json_q[i][j].o); - - return this; - } - - function removeStep(image, index) { - //remove the step from images[image].steps and redraw remaining images - if (index > 0) { - thisStep = images[image].steps[index]; - thisStep.UI.onRemove(thisStep.options.step); - images[image].steps.splice(index, 1); - } - //tell the UI a step has been removed - } - - function removeSteps(image, index) { - var run = {}, indices; - var this_ = (this.name == "ImageSequencer") ? this : this.sequencer; - var args = (this.name == "ImageSequencer") ? [] : [this.images]; - for (var arg in arguments) args.push(copy(arguments[arg])); - - var json_q = formatInput.call(this_, args, "-"); - inputlog.push({ method: "removeSteps", json_q: copy(json_q) }); - - for (var img in json_q) { - indices = json_q[img].sort(function(a, b) { return b - a }); - run[img] = indices[indices.length - 1]; - for (var i in indices) - removeStep(img, indices[i]); - } - // this.run(run); // This is creating problems - return this; - } - - function insertSteps(image, index, name, o) { - var run = {}; - var this_ = (this.name == "ImageSequencer") ? this : this.sequencer; - var args = (this.name == "ImageSequencer") ? [] : [this.images]; - for (var arg in arguments) args.push(arguments[arg]); - - var json_q = formatInput.call(this_, args, "^"); - inputlog.push({ method: "insertSteps", json_q: copy(json_q) }); - - for (var img in json_q) { - var details = json_q[img]; - details = details.sort(function(a, b) { return b.index - a.index }); - for (var i in details) - require("./InsertStep")(this_, img, details[i].index, details[i].name, details[i].o); - run[img] = details[details.length - 1].index; - } - // this.run(run); // This is Creating issues - return this; - } - - // Config is an object which contains the runtime configuration like progress bar - // information and index from which the sequencer should run - function run(config, t_image, t_from) { - let progressObj, index = 0; - config = config || { mode: 'no-arg' }; - if (config.index) index = config.index; - - if (config.mode != 'test') { - if (config.mode != "no-arg" && typeof config != 'function') { - if (config.progressObj) progressObj = config.progressObj; - delete arguments['0']; - } - } - else { - arguments['0'] = config.mode; - } - - var this_ = (this.name == "ImageSequencer") ? this : this.sequencer; - var args = (this.name == "ImageSequencer") ? [] : [this.images]; - for (var arg in arguments) args.push(copy(arguments[arg])); - - var callback = function() { }; - for (var arg in args) - if (objTypeOf(args[arg]) == "Function") - callback = args.splice(arg, 1)[0]; - - var json_q = formatInput.call(this_, args, "r"); - - require('./Run')(this_, json_q, callback, index, progressObj); - - return true; - } - - function loadImages() { - var args = []; - var sequencer = this; - for (var arg in arguments) args.push(copy(arguments[arg])); - var json_q = formatInput.call(this, args, "l"); - - inputlog.push({ method: "loadImages", json_q: copy(json_q) }); - var loadedimages = this.copy(json_q.loadedimages); - - var ret = { - name: "ImageSequencer Wrapper", - sequencer: this, - addSteps: this.addSteps, - removeSteps: this.removeSteps, - insertSteps: this.insertSteps, - run: this.run, - UI: this.UI, - setUI: this.setUI, - images: loadedimages - }; - - function load(i) { - if (i == loadedimages.length) { - json_q.callback.call(ret); - return; - } - var img = loadedimages[i]; - require('./ui/LoadImage')(sequencer, img, json_q.images[img], function() { - load(++i); - }); - } - - load(0); - } - - function replaceImage(selector, steps, options) { - options = options || {}; - options.callback = options.callback || function() { }; - return require('./ReplaceImage')(this, selector, steps, options); - } - - function setUI(UI) { - this.events = require('./ui/UserInterface')(UI); - } - - var exportBin = function(dir, basic, filename) { - return require('./ExportBin')(dir, this, basic, filename); - } - - function modulesInfo(name) { - var modulesdata = {} - if (name == "load-image") return {}; - if (arguments.length == 0) { - for (var modulename in this.modules) { - modulesdata[modulename] = modules[modulename][1]; - } - for (var sequencename in this.sequences) { - modulesdata[sequencename] = { name: sequencename, steps: sequences[sequencename] }; - } - } - else { - if (modules[name]) - modulesdata = modules[name][1]; - else - modulesdata = { 'inputs': sequences[name]['options'] }; - } - return modulesdata; - } - - // Genates a CLI string for the current sequence - function toCliString() { - var cliStringSteps = `"`, cliOptions = {}; - for (var step in this.steps) { - if (this.steps[step].options.name !== "load-image") - cliStringSteps += `${this.steps[step].options.name} `; - for (var inp in modulesInfo(this.steps[step].options.name).inputs) { - cliOptions[inp] = this.steps[step].options[inp]; - } - } - cliStringSteps = cliStringSteps.substr(0, cliStringSteps.length - 1) + `"`; - return `sequencer -i [PATH] -s ${cliStringSteps} -d '${JSON.stringify(cliOptions)}'` - } - - // Strigifies the current sequence - function toString(step) { - if (step) { - return stepToString(step); - } else { - return copy(this.images.image1.steps).map(stepToString).slice(1).join(','); - } - } - - // Stringifies one step of the sequence - function stepToString(step) { - let inputs = copy(modulesInfo(step.options.name).inputs); - inputs = inputs || {}; - - for (let input in inputs) { - inputs[input] = step.options[input] || inputs[input].default; - inputs[input] = encodeURIComponent(inputs[input]); - } - - var configurations = Object.keys(inputs).map(key => key + ':' + inputs[key]).join('|'); - return `${step.options.name}{${configurations}}`; - } - - // exports the current sequence as an array of JSON steps - function toJSON() { - return this.stringToJSON(this.toString()); - } - - // Coverts stringified sequence into an array of JSON steps - function stringToJSON(str) { - let steps; - if (str.includes(',')) - steps = str.split(','); - else - steps = [str]; - return steps.map(stringToJSONstep); - } - - // Converts one stringified step into JSON - function stringToJSONstep(str) { - var bracesStrings; - if (str.includes('{')) - if (str.includes('(') && str.indexOf('(') < str.indexOf('{')) - bracesStrings = ['(', ')']; - else - bracesStrings = ['{', '}']; - else - bracesStrings = ['(', ')']; - - if (str.indexOf(bracesStrings[0]) === -1) { // if there are no settings specified - var moduleName = str.substr(0); - stepSettings = ""; - } else { - var moduleName = str.substr(0, str.indexOf(bracesStrings[0])); - stepSettings = str.slice(str.indexOf(bracesStrings[0]) + 1, -1); - } - - stepSettings = stepSettings.split('|').reduce(function formatSettings(accumulator, current, i) { - var settingName = current.substr(0, current.indexOf(':')), - settingValue = current.substr(current.indexOf(':') + 1); - settingValue = settingValue.replace(/^\(/, '').replace(/\)$/, ''); // strip () at start/end - settingValue = settingValue.replace(/^\{/, '').replace(/\}$/, ''); // strip {} at start/end - settingValue = decodeURIComponent(settingValue); - current = [ - settingName, - settingValue - ]; - if (!!settingName) accumulator[settingName] = settingValue; - return accumulator; - }, {}); - - return { - name: moduleName, - options: stepSettings - } - } - - // imports a string into the sequencer steps - function importString(str) { - let sequencer = this; - if (this.name != "ImageSequencer") - sequencer = this.sequencer; - var stepsFromString = stringToJSON(str); - stepsFromString.forEach(function eachStep(stepObj) { - sequencer.addSteps(stepObj.name, stepObj.options); - }); - } - - // imports a array of JSON steps into the sequencer steps - function importJSON(obj) { - let sequencer = this; - if (this.name != "ImageSequencer") - sequencer = this.sequencer; - obj.forEach(function eachStep(stepObj) { - sequencer.addSteps(stepObj.name, stepObj.options); - }); - } - - function loadNewModule(name, options) { - - if (!options) { - return this; - - } else if (Array.isArray(options)) { - // contains the array of module and info - this.modules[name] = options; - - } else if (options.func && options.info) { - // passed in options object - this.modules[name] = [ - options.func, options.info - ]; - - } else if (options.path && !this.inBrowser) { - // load from path(only in node) - const module = [ - require(`${options.path}/Module.js`), - require(`${options.path}/info.json`) - ]; - this.modules[name] = module; - } - return this; - } - - function saveNewModule(name, path) { - if (options.inBrowser) { - // Not for browser context - return; - } - var mods = fs.readFileSync('./src/Modules.js').toString(); - mods = mods.substr(0, mods.length - 1) + " '" + name + "': require('" + path + "'),\n}"; - fs.writeFileSync('./src/Modules.js', mods); - } - - function createMetaModule(stepsCollection, info) { - var stepsArr = stepsCollection; - if (typeof stepsCollection === 'string') - stepsArr = stringToJSON(stepsCollection); - var metaMod = function() { - this.expandSteps(stepsArr); - return { - isMeta: true - } - } - return [metaMod, info]; - } - - function saveSequence(name, sequenceString) { - const sequence = stringToJSON(sequenceString); - // Save the given sequence string as a module - if (options.inBrowser) { - // Inside the browser we save the meta-modules using the Web Storage API - var sequences = JSON.parse(window.localStorage.getItem('sequences')); - sequences[name] = sequence; - window.localStorage.setItem('sequences', JSON.stringify(sequences)); - } - else { - // In node we save the sequences in the json file SavedSequences.json - var sequences = require('./SavedSequences.json'); - sequences[name] = sequence; - fs.writeFileSync('./src/SavedSequences.json', JSON.stringify(sequences)); - } - } - - function loadModules() { - // This function loads the modules and saved sequences - this.modules = require('./Modules'); - if (options.inBrowser) - this.sequences = JSON.parse(window.localStorage.getItem('sequences')); - else - this.sequences = require('./SavedSequences.json'); - } - - return { - //literals and objects - name: "ImageSequencer", - options: options, - inputlog: inputlog, - modules: modules, - sequences: sequences, - images: images, - events: events, - - //user functions - loadImages: loadImages, - loadImage: loadImages, - addSteps: addSteps, - removeSteps: removeSteps, - insertSteps: insertSteps, - replaceImage: replaceImage, - run: run, - setUI: setUI, - exportBin: exportBin, - modulesInfo: modulesInfo, - toCliString: toCliString, - toString: toString, - stepToString: stepToString, - toJSON: toJSON, - stringToJSON: stringToJSON, - stringToJSONstep: stringToJSONstep, - importString: importString, - importJSON: importJSON, - loadNewModule: loadNewModule, - saveNewModule: saveNewModule, - createMetaModule: createMetaModule, - saveSequence: saveSequence, - loadModules: loadModules, - - //other functions - log: log, - objTypeOf: objTypeOf, - copy: copy, - - setInputStep: require('./ui/SetInputStep')(sequencer) - } - -} -module.exports = ImageSequencer; +function getPrimitive(object){ + return (objTypeOf(object)=='Array')?object[0]:object; +} -},{"./AddStep":136,"./ExportBin":137,"./FormatInput":138,"./InsertStep":140,"./Modules":141,"./ReplaceImage":142,"./Run":143,"./SavedSequences.json":145,"./ui/LoadImage":208,"./ui/SetInputStep":209,"./ui/UserInterface":210,"./util/getStep.js":212,"fs":42}],140:[function(require,module,exports){ -const getStepUtils = require('./util/getStep.js'); - -// insert one or more steps at a given index in the sequencer -function InsertStep(ref, image, index, name, o) { - if (ref.sequences[name]) { - return ref.importJSON(ref.sequences[name]); - } - - function insertStep(image, index, name, o_) { - if (ref.modules[name]) var moduleInfo = ref.modules[name][1]; - else { - console.log('Module ' + name + ' not found.'); - } - - var o = ref.copy(o_); - o.number = ref.options.sequencerCounter++; //Gives a Unique ID to each step - o.name = o_.name || name || moduleInfo.name; - o.description = o_.description || moduleInfo.description; - o.selector = o_.selector || 'ismod-' + name; - o.container = o_.container || ref.options.selector; - o.image = image; - o.inBrowser = ref.options.inBrowser; - - if (index == -1) index = ref.images[image].steps.length; - - o.step = { - name: o.name, - description: o.description, - ID: o.number, - imageName: o.image, - inBrowser: ref.options.inBrowser, - ui: ref.options.ui, - options: o - }; - var UI = ref.events; - - // Tell UI that a step has been set up. - o = o || {}; - ref.modules[name].expandSteps = function expandSteps(stepsArray) { - for (var step of stepsArray) { - ref.addSteps(step['name'], step['options']); - } - } - if (!ref.modules[name][1].length) { - UI.onSetup(o.step); - ref.images[image].steps.splice(index, 0, ref.modules[name][0](o, UI)); - } else { - ref.modules[name][0](o, UI); - } - - return true; - } - - insertStep(image, index, name, o); - ref.steps = ref.images[image].steps; - -} -module.exports = InsertStep; +function makeArray(input) { + return (objTypeOf(input)=="Array")?input:[input]; +} -},{"./util/getStep.js":212}],141:[function(require,module,exports){ -/* -* Core modules and their info files -*/ -module.exports = { - 'channel': require('./modules/Channel'), - 'brightness': require('./modules/Brightness'), - 'edge-detect': require('./modules/EdgeDetect'), - 'ndvi': require('./modules/Ndvi'), - 'crop': require('./modules/Crop'), - 'colormap': require('./modules/Colormap'), - 'decode-qr': require('./modules/DecodeQr'), - 'fisheye-gl': require('./modules/FisheyeGl'), - 'dynamic': require('./modules/Dynamic'), - 'blur': require('./modules/Blur'), - 'saturation': require('./modules/Saturation'), - 'average': require('./modules/Average'), - 'blend': require('./modules/Blend'), - 'import-image': require('./modules/ImportImage'), - 'overlay': require('./modules/Overlay'), - 'gradient': require('./modules/Gradient'), - 'invert': require('image-sequencer-invert'), - 'ndvi-colormap': require('./modules/NdviColormap'), - 'colorbar': require('./modules/Colorbar'), -} -},{"./modules/Average":147,"./modules/Blend":150,"./modules/Blur":154,"./modules/Brightness":157,"./modules/Channel":160,"./modules/Colorbar":163,"./modules/Colormap":167,"./modules/Crop":172,"./modules/DecodeQr":175,"./modules/Dynamic":178,"./modules/EdgeDetect":182,"./modules/FisheyeGl":185,"./modules/Gradient":188,"./modules/ImportImage":192,"./modules/Ndvi":199,"./modules/NdviColormap":195,"./modules/Overlay":202,"./modules/Saturation":205,"image-sequencer-invert":56}],142:[function(require,module,exports){ -// Uses a given image as input and replaces it with the output. -// Works only in the browser. -function ReplaceImage(ref,selector,steps,options) { - if(!ref.options.inBrowser) return false; // This isn't for Node.js - var tempSequencer = ImageSequencer({ui: false}); - var this_ = ref; - if (window.hasOwnProperty('$')) var input = $(selector); - else var input = document.querySelectorAll(selector); - var images = []; - for (var i = 0; i < input.length; i++) { - if (input[i] instanceof HTMLImageElement) images.push(input[i]); - } - - function replaceImage (img, steps) { - var url = img.src; - // refactor to filetypeFromUrl() - var ext = url.split('?')[0].split('.').pop(); - - var xmlHTTP = new XMLHttpRequest(); - xmlHTTP.open('GET', url, true); - xmlHTTP.responseType = 'arraybuffer'; - xmlHTTP.onload = function(e) { - var arr = new Uint8Array(this.response); - - // in chunks to avoid "RangeError: Maximum call stack exceeded" - // https://github.com/publiclab/image-sequencer/issues/241 - // https://stackoverflow.com/a/20048852/1116657 - var raw = ''; - var i,j,subArray,chunk = 5000; - for (i=0,j=arr.length; i= ref.images[image].steps.length) return { options: { name: undefined } }; - else return ref.images[image].steps.slice(i + offset)[0]; - }; - ref.images[image].steps[i].getIndex = function getIndex() { - return i; - } - - for (var util in getStepUtils) { - if (getStepUtils.hasOwnProperty(util)) { - ref.images[image].steps[i][util] = getStepUtils[util]; - } - } - - // Tell UI that a step is being drawn. - ref.images[image].steps[i].UI.onDraw(ref.images[image].steps[i].options.step); - - // provides a set of standard tools for each step - var inputForNextStep = require('./RunToolkit')(ref.copy(input)); - - ref.images[image].steps[i].draw( - inputForNextStep, - function onEachStep() { - - // This output is accessible by UI - ref.images[image].steps[i].options.step.output = ref.images[image].steps[i].output.src; - - // Tell UI that step has been drawn. - ref.images[image].steps[i].UI.onComplete(ref.images[image].steps[i].options.step); - - drawStep(drawarray, ++pos); - }, - progressObj - ); - } - } - - function drawSteps(json_q) { - var drawarray = []; - for (var image in json_q) { - var no_steps = ref.images[image].steps.length; - var init = json_q[image]; - for (var i = 0; i < no_steps - init; i++) { - drawarray.push({ image: image, i: init + i }); - } - } - drawStep(drawarray, ind); - } - - function filter(json_q) { - for (var image in json_q) { - if (json_q[image] == 0 && ref.images[image].steps.length == 1) - delete json_q[image]; - else if (json_q[image] == 0) json_q[image]++; - } - for (var image in json_q) { - var prevstep = ref.images[image].steps[json_q[image] - 1]; - while ( - typeof prevstep == "undefined" || - typeof prevstep.output == "undefined" - ) { - prevstep = ref.images[image].steps[--json_q[image] - 1]; - } - } - return json_q; - } - - var json_q = filter(json_q); - return drawSteps(json_q); -} -module.exports = Run; +function formatInput(args,format,images) { + images = []; + for (var image in this.images) { + images.push(image); + } + var json_q = {}; + var format_i = format; + if (format == "+") + format = ['o_string_a', 'string_a', 'o_object']; + else if (format == "-") + format = ['o_string_a', 'number_a']; + else if (format == "^") + format = ['o_string_a', 'number', 'string', 'o_object']; + else if (format == "r") + format = ['o_string_a', 'o_number']; + else if (format == "l") + format = ['o_string','string','o_function']; + + /* + formats: + addSteps :: o_image_a, name_a, o_o + o_string_a, string_a, o_object => { image: [{name,o}] } + removeSteps :: o_image_a, index_a + o_string_a, number_a => { image: [index] } + insertSteps :: o_image_a, index, name, o_o + o_string_a, number, string, o_object => { image: [{index,name,o}] } + run :: o_image_a, o_from + o_string_a, o_number => { image: index } + loadImages :: image, src, o_function + string, string, o_function => { images: [{image:src}], callback } + + optionals: + image: o_string_a + options: o_object + from: o_number + callback: o_function + */ + + if(format[format.length-1] == "o_object") { + if(objTypeOf(args[args.length-1]) != "Object") + args.push({}); + } + else if (format[format.length-1] == "o_number") { + if(typeof(args[args.length-1]) != "number" && objTypeOf(args[0])!="Object") + args.push(1); + } + else if (format[format.length-1] == "o_function") { + if(objTypeOf(args[args.length-1]) != "Function" && objTypeOf(args[0])!="Object") + args.push(function(){}); + } + + if(format[0] == "o_string_a") { + if(args.length == format.length - 1) { + var insert = false; + for (var i in args) { + if (format[parseInt(i)+1].includes( typeof(getPrimitive(args[i])) )){ + insert = true; + } + else {insert = false; break;} + } + if(insert) + args.splice(0,0,copy(images)); + } + } + else if (format[0] == "o_string" && format_i == "l" && args.length == 2) { + if (typeof(args[0]) == "string") { + var identifier = "image"; + var number = 1; + while (this.images.hasOwnProperty(identifier+number)) number++; + args.splice(0,0,identifier+number); + } + } + + if(args.length == format.length) { + for (var i in format) { + if (format[i].substr(format[i].length-2,2)=="_a") + args[i] = makeArray(args[i]); + } + } + + if (args.length == 1) { + json_q = copy(args[0]); + if(!(format_i == "r" || format_i == "l")) { + for (var img in json_q) + json_q[img] = makeArray(json_q[img]); + } + } + else if (format_i == "r") { + for (var img in args[0]) json_q[args[0][img]] = args[1]; + } + else if (format_i == "l") { + json_q = { + images: {}, + callback: args[2] + } + json_q.images[args[0]] = args[1]; + } + else { + for (var img in args[0]) { + var image = args[0][img]; + json_q[image] = []; + + if(format_i == "+") { + for(var s in args[1]) { + json_q[image].push({ + name: args[1][s], + o: args[2] + }); + } + } + + if(format_i == "-") { + json_q[image] = args[1]; + } + + if(format_i == "^") { + var size = this.images[image].steps.length; + var index = args[1]; + index = (index==size)?index:index%size; + if (index<0) index += size+1; + json_q[image].push({ + index: index, + name: args[2], + o: args[3] + }); + } + + } + } + + if(format_i == "l") { + json_q.loadedimages = []; + for (var i in json_q.images) json_q.loadedimages.push(i); + } + + return json_q; + +} +module.exports = formatInput; + +},{}],139:[function(require,module,exports){ +if (typeof window !== 'undefined') { isBrowser = true } +else { var isBrowser = false } +require('./util/getStep.js'); + +ImageSequencer = function ImageSequencer(options) { + + var sequencer = (this.name == "ImageSequencer") ? this : this.sequencer; + options = options || {}; + options.inBrowser = options.inBrowser || isBrowser; + options.sequencerCounter = 0; + + function objTypeOf(object) { + return Object.prototype.toString.call(object).split(" ")[1].slice(0, -1) + } + + function log(color, msg) { + if (options.ui != "none") { + if (arguments.length == 1) console.log(arguments[0]); + else if (arguments.length == 2) console.log(color, msg); + } + } + + function copy(a) { + if (!typeof (a) == "object") return a; + if (objTypeOf(a) == "Array") return a.slice(); + if (objTypeOf(a) == "Object") { + var b = {}; + for (var v in a) { + b[v] = copy(a[v]); + } + return b; + } + return a; + } + + function makeArray(input) { + return (objTypeOf(input) == "Array") ? input : [input]; + } + + var image, + steps = [], + modules = require('./Modules'), + sequences = require('./SavedSequences.json'), + formatInput = require('./FormatInput'), + images = {}, + inputlog = [], + events = require('./ui/UserInterface')(), + fs = require('fs'); + + + + if (options.inBrowser) { + for (o in sequencer) { + modules[o] = sequencer[o]; + } + sequences = JSON.parse(window.localStorage.getItem('sequences')); + if (!sequences) { + sequences = {}; + window.localStorage.setItem('sequences', JSON.stringify(sequences)); + } + } + + // if in browser, prompt for an image + // if (options.imageSelect || options.inBrowser) addStep('image-select'); + // else if (options.imageUrl) loadImage(imageUrl); + + function addSteps() { + var this_ = (this.name == "ImageSequencer") ? this : this.sequencer; + var args = (this.name == "ImageSequencer") ? [] : [this.images]; + var json_q = {}; + for (var arg in arguments) { args.push(copy(arguments[arg])); } + json_q = formatInput.call(this_, args, "+"); + + inputlog.push({ method: "addSteps", json_q: copy(json_q) }); + + for (var i in json_q) + for (var j in json_q[i]) + require("./AddStep")(this_, i, json_q[i][j].name, json_q[i][j].o); + + return this; + } + + function removeStep(image, index) { + //remove the step from images[image].steps and redraw remaining images + if (index > 0) { + thisStep = images[image].steps[index]; + thisStep.UI.onRemove(thisStep.options.step); + images[image].steps.splice(index, 1); + } + //tell the UI a step has been removed + } + + function removeSteps(image, index) { + var run = {}, indices; + var this_ = (this.name == "ImageSequencer") ? this : this.sequencer; + var args = (this.name == "ImageSequencer") ? [] : [this.images]; + for (var arg in arguments) args.push(copy(arguments[arg])); + + var json_q = formatInput.call(this_, args, "-"); + inputlog.push({ method: "removeSteps", json_q: copy(json_q) }); + + for (var img in json_q) { + indices = json_q[img].sort(function(a, b) { return b - a }); + run[img] = indices[indices.length - 1]; + for (var i in indices) + removeStep(img, indices[i]); + } + // this.run(run); // This is creating problems + return this; + } + + function insertSteps(image, index, name, o) { + var run = {}; + var this_ = (this.name == "ImageSequencer") ? this : this.sequencer; + var args = (this.name == "ImageSequencer") ? [] : [this.images]; + for (var arg in arguments) args.push(arguments[arg]); + + var json_q = formatInput.call(this_, args, "^"); + inputlog.push({ method: "insertSteps", json_q: copy(json_q) }); + + for (var img in json_q) { + var details = json_q[img]; + details = details.sort(function(a, b) { return b.index - a.index }); + for (var i in details) + require("./InsertStep")(this_, img, details[i].index, details[i].name, details[i].o); + run[img] = details[details.length - 1].index; + } + // this.run(run); // This is Creating issues + return this; + } + + // Config is an object which contains the runtime configuration like progress bar + // information and index from which the sequencer should run + function run(config, t_image, t_from) { + let progressObj, index = 0; + config = config || { mode: 'no-arg' }; + if (config.index) index = config.index; + + if (config.mode != 'test') { + if (config.mode != "no-arg" && typeof config != 'function') { + if (config.progressObj) progressObj = config.progressObj; + delete arguments['0']; + } + } + else { + arguments['0'] = config.mode; + } + + var this_ = (this.name == "ImageSequencer") ? this : this.sequencer; + var args = (this.name == "ImageSequencer") ? [] : [this.images]; + for (var arg in arguments) args.push(copy(arguments[arg])); + + var callback = function() { }; + for (var arg in args) + if (objTypeOf(args[arg]) == "Function") + callback = args.splice(arg, 1)[0]; + + var json_q = formatInput.call(this_, args, "r"); + + require('./Run')(this_, json_q, callback, index, progressObj); + + return true; + } + + function loadImages() { + var args = []; + var sequencer = this; + for (var arg in arguments) args.push(copy(arguments[arg])); + var json_q = formatInput.call(this, args, "l"); + + inputlog.push({ method: "loadImages", json_q: copy(json_q) }); + var loadedimages = this.copy(json_q.loadedimages); + + var ret = { + name: "ImageSequencer Wrapper", + sequencer: this, + addSteps: this.addSteps, + removeSteps: this.removeSteps, + insertSteps: this.insertSteps, + run: this.run, + UI: this.UI, + setUI: this.setUI, + images: loadedimages + }; + + function load(i) { + if (i == loadedimages.length) { + json_q.callback.call(ret); + return; + } + var img = loadedimages[i]; + require('./ui/LoadImage')(sequencer, img, json_q.images[img], function() { + load(++i); + }); + } + + load(0); + } + + function replaceImage(selector, steps, options) { + options = options || {}; + options.callback = options.callback || function() { }; + return require('./ReplaceImage')(this, selector, steps, options); + } + + function setUI(UI) { + this.events = require('./ui/UserInterface')(UI); + } + + var exportBin = function(dir, basic, filename) { + return require('./ExportBin')(dir, this, basic, filename); + } + + function modulesInfo(name) { + var modulesdata = {} + if (name == "load-image") return {}; + if (arguments.length == 0) { + for (var modulename in this.modules) { + modulesdata[modulename] = modules[modulename][1]; + } + for (var sequencename in this.sequences) { + modulesdata[sequencename] = { name: sequencename, steps: sequences[sequencename] }; + } + } + else { + if (modules[name]) + modulesdata = modules[name][1]; + else + modulesdata = { 'inputs': sequences[name]['options'] }; + } + return modulesdata; + } + + // Genates a CLI string for the current sequence + function toCliString() { + var cliStringSteps = `"`, cliOptions = {}; + for (var step in this.steps) { + if (this.steps[step].options.name !== "load-image") + cliStringSteps += `${this.steps[step].options.name} `; + for (var inp in modulesInfo(this.steps[step].options.name).inputs) { + cliOptions[inp] = this.steps[step].options[inp]; + } + } + cliStringSteps = cliStringSteps.substr(0, cliStringSteps.length - 1) + `"`; + return `sequencer -i [PATH] -s ${cliStringSteps} -d '${JSON.stringify(cliOptions)}'` + } + + // Strigifies the current sequence + function toString(step) { + if (step) { + return stepToString(step); + } else { + return copy(this.images.image1.steps).map(stepToString).slice(1).join(','); + } + } + + // Stringifies one step of the sequence + function stepToString(step) { + let inputs = copy(modulesInfo(step.options.name).inputs); + inputs = inputs || {}; + + for (let input in inputs) { + inputs[input] = step.options[input] || inputs[input].default; + inputs[input] = encodeURIComponent(inputs[input]); + } + + var configurations = Object.keys(inputs).map(key => key + ':' + inputs[key]).join('|'); + return `${step.options.name}{${configurations}}`; + } + + // exports the current sequence as an array of JSON steps + function toJSON() { + return this.stringToJSON(this.toString()); + } + + // Coverts stringified sequence into an array of JSON steps + function stringToJSON(str) { + let steps; + if (str.includes(',')) + steps = str.split(','); + else + steps = [str]; + return steps.map(stringToJSONstep); + } + + // Converts one stringified step into JSON + function stringToJSONstep(str) { + var bracesStrings; + if (str.includes('{')) + if (str.includes('(') && str.indexOf('(') < str.indexOf('{')) + bracesStrings = ['(', ')']; + else + bracesStrings = ['{', '}']; + else + bracesStrings = ['(', ')']; + + if (str.indexOf(bracesStrings[0]) === -1) { // if there are no settings specified + var moduleName = str.substr(0); + stepSettings = ""; + } else { + var moduleName = str.substr(0, str.indexOf(bracesStrings[0])); + stepSettings = str.slice(str.indexOf(bracesStrings[0]) + 1, -1); + } + + stepSettings = stepSettings.split('|').reduce(function formatSettings(accumulator, current, i) { + var settingName = current.substr(0, current.indexOf(':')), + settingValue = current.substr(current.indexOf(':') + 1); + settingValue = settingValue.replace(/^\(/, '').replace(/\)$/, ''); // strip () at start/end + settingValue = settingValue.replace(/^\{/, '').replace(/\}$/, ''); // strip {} at start/end + settingValue = decodeURIComponent(settingValue); + current = [ + settingName, + settingValue + ]; + if (!!settingName) accumulator[settingName] = settingValue; + return accumulator; + }, {}); + + return { + name: moduleName, + options: stepSettings + } + } + + // imports a string into the sequencer steps + function importString(str) { + let sequencer = this; + if (this.name != "ImageSequencer") + sequencer = this.sequencer; + var stepsFromString = stringToJSON(str); + stepsFromString.forEach(function eachStep(stepObj) { + sequencer.addSteps(stepObj.name, stepObj.options); + }); + } + + // imports a array of JSON steps into the sequencer steps + function importJSON(obj) { + let sequencer = this; + if (this.name != "ImageSequencer") + sequencer = this.sequencer; + obj.forEach(function eachStep(stepObj) { + sequencer.addSteps(stepObj.name, stepObj.options); + }); + } + + function loadNewModule(name, options) { + + if (!options) { + return this; + + } else if (Array.isArray(options)) { + // contains the array of module and info + this.modules[name] = options; + + } else if (options.func && options.info) { + // passed in options object + this.modules[name] = [ + options.func, options.info + ]; + + } else if (options.path && !this.inBrowser) { + // load from path(only in node) + const module = [ + require(`${options.path}/Module.js`), + require(`${options.path}/info.json`) + ]; + this.modules[name] = module; + } + return this; + } + + function saveNewModule(name, path) { + if (options.inBrowser) { + // Not for browser context + return; + } + var mods = fs.readFileSync('./src/Modules.js').toString(); + mods = mods.substr(0, mods.length - 1) + " '" + name + "': require('" + path + "'),\n}"; + fs.writeFileSync('./src/Modules.js', mods); + } + + function createMetaModule(stepsCollection, info) { + var stepsArr = stepsCollection; + if (typeof stepsCollection === 'string') + stepsArr = stringToJSON(stepsCollection); + var metaMod = function() { + this.expandSteps(stepsArr); + return { + isMeta: true + } + } + return [metaMod, info]; + } + + function saveSequence(name, sequenceString) { + const sequence = stringToJSON(sequenceString); + // Save the given sequence string as a module + if (options.inBrowser) { + // Inside the browser we save the meta-modules using the Web Storage API + var sequences = JSON.parse(window.localStorage.getItem('sequences')); + sequences[name] = sequence; + window.localStorage.setItem('sequences', JSON.stringify(sequences)); + } + else { + // In node we save the sequences in the json file SavedSequences.json + var sequences = require('./SavedSequences.json'); + sequences[name] = sequence; + fs.writeFileSync('./src/SavedSequences.json', JSON.stringify(sequences)); + } + } + + function loadModules() { + // This function loads the modules and saved sequences + this.modules = require('./Modules'); + if (options.inBrowser) + this.sequences = JSON.parse(window.localStorage.getItem('sequences')); + else + this.sequences = require('./SavedSequences.json'); + } + + return { + //literals and objects + name: "ImageSequencer", + options: options, + inputlog: inputlog, + modules: modules, + sequences: sequences, + images: images, + events: events, + + //user functions + loadImages: loadImages, + loadImage: loadImages, + addSteps: addSteps, + removeSteps: removeSteps, + insertSteps: insertSteps, + replaceImage: replaceImage, + run: run, + setUI: setUI, + exportBin: exportBin, + modulesInfo: modulesInfo, + toCliString: toCliString, + toString: toString, + stepToString: stepToString, + toJSON: toJSON, + stringToJSON: stringToJSON, + stringToJSONstep: stringToJSONstep, + importString: importString, + importJSON: importJSON, + loadNewModule: loadNewModule, + saveNewModule: saveNewModule, + createMetaModule: createMetaModule, + saveSequence: saveSequence, + loadModules: loadModules, + + //other functions + log: log, + objTypeOf: objTypeOf, + copy: copy, + + setInputStep: require('./ui/SetInputStep')(sequencer) + } + +} +module.exports = ImageSequencer; + +},{"./AddStep":136,"./ExportBin":137,"./FormatInput":138,"./InsertStep":140,"./Modules":141,"./ReplaceImage":142,"./Run":143,"./SavedSequences.json":145,"./ui/LoadImage":208,"./ui/SetInputStep":209,"./ui/UserInterface":210,"./util/getStep.js":212,"fs":42}],140:[function(require,module,exports){ +const getStepUtils = require('./util/getStep.js'); + +// insert one or more steps at a given index in the sequencer +function InsertStep(ref, image, index, name, o) { + if (ref.sequences[name]) { + return ref.importJSON(ref.sequences[name]); + } + + function insertStep(image, index, name, o_) { + if (ref.modules[name]) var moduleInfo = ref.modules[name][1]; + else { + console.log('Module ' + name + ' not found.'); + } + + var o = ref.copy(o_); + o.number = ref.options.sequencerCounter++; //Gives a Unique ID to each step + o.name = o_.name || name || moduleInfo.name; + o.description = o_.description || moduleInfo.description; + o.selector = o_.selector || 'ismod-' + name; + o.container = o_.container || ref.options.selector; + o.image = image; + o.inBrowser = ref.options.inBrowser; + + if (index == -1) index = ref.images[image].steps.length; + + o.step = { + name: o.name, + description: o.description, + ID: o.number, + imageName: o.image, + inBrowser: ref.options.inBrowser, + ui: ref.options.ui, + options: o + }; + var UI = ref.events; + + // Tell UI that a step has been set up. + o = o || {}; + ref.modules[name].expandSteps = function expandSteps(stepsArray) { + for (var step of stepsArray) { + ref.addSteps(step['name'], step['options']); + } + } + if (!ref.modules[name][1].length) { + UI.onSetup(o.step); + ref.images[image].steps.splice(index, 0, ref.modules[name][0](o, UI)); + } else { + ref.modules[name][0](o, UI); + } + + return true; + } + + insertStep(image, index, name, o); + ref.steps = ref.images[image].steps; + +} +module.exports = InsertStep; + +},{"./util/getStep.js":212}],141:[function(require,module,exports){ +/* +* Core modules and their info files +*/ +module.exports = { + 'channel': require('./modules/Channel'), + 'brightness': require('./modules/Brightness'), + 'edge-detect': require('./modules/EdgeDetect'), + 'ndvi': require('./modules/Ndvi'), + 'crop': require('./modules/Crop'), + 'colormap': require('./modules/Colormap'), + 'decode-qr': require('./modules/DecodeQr'), + 'fisheye-gl': require('./modules/FisheyeGl'), + 'dynamic': require('./modules/Dynamic'), + 'blur': require('./modules/Blur'), + 'saturation': require('./modules/Saturation'), + 'average': require('./modules/Average'), + 'blend': require('./modules/Blend'), + 'import-image': require('./modules/ImportImage'), + 'overlay': require('./modules/Overlay'), + 'gradient': require('./modules/Gradient'), + 'invert': require('image-sequencer-invert'), + 'ndvi-colormap': require('./modules/NdviColormap'), + 'colorbar': require('./modules/Colorbar'), +} +},{"./modules/Average":147,"./modules/Blend":150,"./modules/Blur":154,"./modules/Brightness":157,"./modules/Channel":160,"./modules/Colorbar":163,"./modules/Colormap":167,"./modules/Crop":172,"./modules/DecodeQr":175,"./modules/Dynamic":178,"./modules/EdgeDetect":182,"./modules/FisheyeGl":185,"./modules/Gradient":188,"./modules/ImportImage":192,"./modules/Ndvi":196,"./modules/NdviColormap":199,"./modules/Overlay":202,"./modules/Saturation":205,"image-sequencer-invert":56}],142:[function(require,module,exports){ +// Uses a given image as input and replaces it with the output. +// Works only in the browser. +function ReplaceImage(ref,selector,steps,options) { + if(!ref.options.inBrowser) return false; // This isn't for Node.js + var tempSequencer = ImageSequencer({ui: false}); + var this_ = ref; + if (window.hasOwnProperty('$')) var input = $(selector); + else var input = document.querySelectorAll(selector); + var images = []; + for (var i = 0; i < input.length; i++) { + if (input[i] instanceof HTMLImageElement) images.push(input[i]); + } + + function replaceImage (img, steps) { + var url = img.src; + // refactor to filetypeFromUrl() + var ext = url.split('?')[0].split('.').pop(); + + var xmlHTTP = new XMLHttpRequest(); + xmlHTTP.open('GET', url, true); + xmlHTTP.responseType = 'arraybuffer'; + xmlHTTP.onload = function(e) { + var arr = new Uint8Array(this.response); + + // in chunks to avoid "RangeError: Maximum call stack exceeded" + // https://github.com/publiclab/image-sequencer/issues/241 + // https://stackoverflow.com/a/20048852/1116657 + var raw = ''; + var i,j,subArray,chunk = 5000; + for (i=0,j=arr.length; i= ref.images[image].steps.length) return { options: { name: undefined } }; + else return ref.images[image].steps.slice(i + offset)[0]; + }; + ref.images[image].steps[i].getIndex = function getIndex() { + return i; + } + + for (var util in getStepUtils) { + if (getStepUtils.hasOwnProperty(util)) { + ref.images[image].steps[i][util] = getStepUtils[util]; + } + } + + // Tell UI that a step is being drawn. + ref.images[image].steps[i].UI.onDraw(ref.images[image].steps[i].options.step); + + // provides a set of standard tools for each step + var inputForNextStep = require('./RunToolkit')(ref.copy(input)); + + ref.images[image].steps[i].draw( + inputForNextStep, + function onEachStep() { + + // This output is accessible by UI + ref.images[image].steps[i].options.step.output = ref.images[image].steps[i].output.src; + + // Tell UI that step has been drawn. + ref.images[image].steps[i].UI.onComplete(ref.images[image].steps[i].options.step); + + drawStep(drawarray, ++pos); + }, + progressObj + ); + } + } + + function drawSteps(json_q) { + var drawarray = []; + for (var image in json_q) { + var no_steps = ref.images[image].steps.length; + var init = json_q[image]; + for (var i = 0; i < no_steps - init; i++) { + drawarray.push({ image: image, i: init + i }); + } + } + drawStep(drawarray, ind); + } + + function filter(json_q) { + for (var image in json_q) { + if (json_q[image] == 0 && ref.images[image].steps.length == 1) + delete json_q[image]; + else if (json_q[image] == 0) json_q[image]++; + } + for (var image in json_q) { + var prevstep = ref.images[image].steps[json_q[image] - 1]; + while ( + typeof prevstep == "undefined" || + typeof prevstep.output == "undefined" + ) { + prevstep = ref.images[image].steps[--json_q[image] - 1]; + } + } + return json_q; + } + + var json_q = filter(json_q); + return drawSteps(json_q); +} +module.exports = Run; + +},{"./RunToolkit":144,"./util/getStep.js":212}],144:[function(require,module,exports){ +const getPixels = require('get-pixels'); +const pixelManipulation = require('./modules/_nomodule/PixelManipulation'); +const lodash = require('lodash'); +const dataUriToBuffer = require('data-uri-to-buffer'); +const savePixels = require('save-pixels'); + +module.exports = function(input) { + input.getPixels = getPixels; + input.pixelManipulation = pixelManipulation; + input.lodash = lodash; + input.dataUriToBuffer = dataUriToBuffer; + input.savePixels = savePixels; + return input; +} +},{"./modules/_nomodule/PixelManipulation":207,"data-uri-to-buffer":13,"get-pixels":23,"lodash":62,"save-pixels":111}],145:[function(require,module,exports){ +module.exports={"sample":[{"name":"invert","options":{}},{"name":"channel","options":{"channel":"red"}},{"name":"blur","options":{"blur":"5"}}]} +},{}],146:[function(require,module,exports){ +/* +* Average all pixel colors +*/ +module.exports = function Average(options, UI){ + + options.blur = options.blur || 2 + var output; + + options.step.metadata = options.step.metadata || {}; + + function draw(input,callback,progressObj){ + + progressObj.stop(true); + progressObj.overrideFlag = true; + + var step = this; + + function changePixel(r, g, b, a){ + return [r,g,b,a] + } + + // do the averaging + function extraManipulation(pixels){ + var sum = [0,0,0,0]; + for (var i = 0; i < pixels.data.length; i += 4) { + sum[0] += pixels.data[i + 0]; + sum[1] += pixels.data[i + 1]; + sum[2] += pixels.data[i + 2]; + sum[3] += pixels.data[i + 3]; + } + + sum[0] = parseInt(sum[0] / (pixels.data.length / 4)); + sum[1] = parseInt(sum[1] / (pixels.data.length / 4)); + sum[2] = parseInt(sum[2] / (pixels.data.length / 4)); + sum[3] = parseInt(sum[3] / (pixels.data.length / 4)); + + for (var i = 0; i < pixels.data.length; i += 4) { + pixels.data[i + 0] = sum[0]; + pixels.data[i + 1] = sum[1]; + pixels.data[i + 2] = sum[2]; + pixels.data[i + 3] = sum[3]; + } + // report back and store average in metadata: + options.step.metadata.averages = sum; + console.log("average: ", sum); + // TODO: refactor into a new "display()" method as per https://github.com/publiclab/image-sequencer/issues/242 + if (options.step.inBrowser && options.step.ui) $(options.step.ui).find('.details').append("

Averages (r, g, b, a): " + sum.join(', ') + "

"); + return pixels; + } + + function output(image, datauri, mimetype){ + + // This output is accessible by Image Sequencer + step.output = { + src: datauri, + format: mimetype + }; + } + + return require('../_nomodule/PixelManipulation.js')(input, { + output: output, + changePixel: changePixel, + extraManipulation: extraManipulation, + format: input.format, + image: options.image, + callback: callback + }); + + } + return { + options: options, + draw: draw, + output: output, + UI: UI + } +} + +},{"../_nomodule/PixelManipulation.js":207}],147:[function(require,module,exports){ +module.exports = [ + require('./Module'), + require('./info.json') +] +},{"./Module":146,"./info.json":148}],148:[function(require,module,exports){ +module.exports={ + "name": "Average", + "description": "Average all pixel color", + "inputs": { + } +} + +},{}],149:[function(require,module,exports){ +module.exports = function Dynamic(options, UI, util) { + + options.func = options.func || "function(r1, g1, b1, a1, r2, g2, b2, a2) { return [ r1, g2, b2, a2 ] }"; + + var output; + + // This function is called on every draw. + function draw(input, callback, progressObj) { + + progressObj.stop(true); + progressObj.overrideFlag = true; + + var step = this; + + // convert to runnable code: + if (typeof options.func === "string") eval('options.func = ' + options.func); + + var getPixels = require('get-pixels'); + + // save first image's pixels + var priorStep = this.getStep(-2); + + getPixels(priorStep.output.src, function(err, pixels) { + options.firstImagePixels = pixels; + + function changePixel(r2, g2, b2, a2, x, y) { + // blend! + var p = options.firstImagePixels; + return options.func( + r2, g2, b2, a2, + p.get(x, y, 0), + p.get(x, y, 1), + p.get(x, y, 2), + p.get(x, y, 3) + ) + } + + function output(image, datauri, mimetype) { + + // This output is accessible by Image Sequencer + step.output = { src: datauri, format: mimetype }; + + } + + // run PixelManipulatin on second image's pixels + return require('../_nomodule/PixelManipulation.js')(input, { + output: output, + changePixel: changePixel, + format: input.format, + image: options.image, + inBrowser: options.inBrowser, + callback: callback + }); + }); + } + + return { + options: options, + draw: draw, + output: output, + UI: UI + } +} + +},{"../_nomodule/PixelManipulation.js":207,"get-pixels":23}],150:[function(require,module,exports){ +arguments[4][147][0].apply(exports,arguments) +},{"./Module":149,"./info.json":151,"dup":147}],151:[function(require,module,exports){ +module.exports={ + "name": "Blend", + "description": "Blend the past two image steps with the given function. Defaults to using the red channel from image 1 and the green and blue and alpha channels of image 2. Easier to use interfaces coming soon!", + "inputs": { + "blend": { + "type": "input", + "desc": "Function to use to blend the two images.", + "default": "function(r1, g1, b1, a1, r2, g2, b2, a2) { return [ r1, g2, b2, a2 ] }" + } + } +} + +},{}],152:[function(require,module,exports){ +module.exports = exports = function(pixels, blur) { + let kernel = kernelGenerator(blur, 1), oldpix = pixels; + kernel = flipKernel(kernel); + + for (let i = 0; i < pixels.shape[0]; i++) { + for (let j = 0; j < pixels.shape[1]; j++) { + let neighboutPos = getNeighbouringPixelPositions([i, j]); + let acc = [0.0, 0.0, 0.0, 0.0]; + for (let a = 0; a < kernel.length; a++) { + for (let b = 0; b < kernel.length; b++) { + acc[0] += (oldpix.get(neighboutPos[a][b][0], neighboutPos[a][b][1], 0) * kernel[a][b]); + acc[1] += (oldpix.get(neighboutPos[a][b][0], neighboutPos[a][b][1], 1) * kernel[a][b]); + acc[2] += (oldpix.get(neighboutPos[a][b][0], neighboutPos[a][b][1], 2) * kernel[a][b]); + acc[3] += (oldpix.get(neighboutPos[a][b][0], neighboutPos[a][b][1], 3) * kernel[a][b]); + } + } + pixels.set(i, j, 0, acc[0]); + pixels.set(i, j, 1, acc[1]); + pixels.set(i, j, 2, acc[2]); + } + } + return pixels; + + + + //Generates a 3x3 Gaussian kernel + function kernelGenerator(sigma, size) { + + /* + Trying out a variable radius kernel not working as of now + */ + // const coeff = (1.0/(2.0*Math.PI*sigma*sigma)) + // const expCoeff = -1 * (1.0/2.0 * sigma * sigma) + // let e = Math.E + // let result = [] + // for(let i = -1 * size;i<=size;i++){ + // let arr = [] + // for(let j= -1 * size;j<=size;j++){ + // arr.push(coeff * Math.pow(e,expCoeff * ((i * i) + (j*j)))) + // } + // result.push(arr) + // } + // let sum = result.reduce((sum,val)=>{ + // return val.reduce((sumInner,valInner)=>{ + // return sumInner+valInner + // }) + // }) + // result = result.map(arr=>arr.map(val=>(val + 0.0)/(sum + 0.0))) + + // return result + + return [ + [2.0 / 159.0, 4.0 / 159.0, 5.0 / 159.0, 4.0 / 159.0, 2.0 / 159.0], + [4.0 / 159.0, 9.0 / 159.0, 12.0 / 159.0, 9.0 / 159.0, 4.0 / 159.0], + [5.0 / 159.0, 12.0 / 159.0, 15.0 / 159.0, 12.0 / 159.0, 5.0 / 159.0], + [4.0 / 159.0, 9.0 / 159.0, 12.0 / 159.0, 9.0 / 159.0, 4.0 / 159.0], + [2.0 / 159.0, 4.0 / 159.0, 5.0 / 159.0, 4.0 / 159.0, 2.0 / 159.0] + ]; + } + function getNeighbouringPixelPositions(pixelPosition) { + let x = pixelPosition[0], y = pixelPosition[1], result = []; + + for (let i = -2; i <= 2; i++) { + let arr = []; + for (let j = -2; j <= 2; j++) + arr.push([x + i, y + j]); + + result.push(arr); + } + return result; + } + + function flipKernel(kernel) { + let result = []; + for (let i = kernel.length - 1; i >= 0; i--) { + let arr = []; + for (let j = kernel[i].length - 1; j >= 0; j--) { + arr.push(kernel[i][j]); + } + result.push(arr); + } + return result; + } +} +},{}],153:[function(require,module,exports){ +/* +* Blur an Image +*/ +module.exports = function Blur(options, UI) { + + options.blur = options.blur || 2 + var output; + + function draw(input, callback, progressObj) { + + progressObj.stop(true); + progressObj.overrideFlag = true; + + var step = this; + + function changePixel(r, g, b, a) { + return [r, g, b, a] + } + + function extraManipulation(pixels) { + pixels = require('./Blur')(pixels, options.blur) + return pixels + } + + function output(image, datauri, mimetype) { + + // This output is accessible by Image Sequencer + step.output = { src: datauri, format: mimetype }; + + } + + return require('../_nomodule/PixelManipulation.js')(input, { + output: output, + changePixel: changePixel, + extraManipulation: extraManipulation, + format: input.format, + image: options.image, + callback: callback + }); + + } + return { + options: options, + draw: draw, + output: output, + UI: UI + } +} + +},{"../_nomodule/PixelManipulation.js":207,"./Blur":152}],154:[function(require,module,exports){ +arguments[4][147][0].apply(exports,arguments) +},{"./Module":153,"./info.json":155,"dup":147}],155:[function(require,module,exports){ +module.exports={ + "name": "Blur", + "description": "Gaussian blur an image by a given value, typically 0-5", + "inputs": { + "blur": { + "type": "integer", + "desc": "amount of gaussian blur(Less blur gives more detail, typically 0-5)", + "default": 2 + } + } +} + +},{}],156:[function(require,module,exports){ +/* +* Changes the Image Brightness +*/ + +module.exports = function Brightness(options,UI){ + + var output; + + function draw(input,callback,progressObj){ + + progressObj.stop(true); + progressObj.overrideFlag = true; + + /* + In this case progress is handled by changepixel internally otherwise progressObj + needs to be overriden and used + For eg. progressObj = new SomeProgressModule() + */ + + var step = this; + + function changePixel(r, g, b, a){ + var val = (options.brightness)/100.0 + + r = val*r<255?val*r:255 + g = val*g<255?val*g:255 + b = val*b<255?val*b:255 + return [r , g, b, a] + } + + function output(image,datauri,mimetype){ + + // This output is accessible by Image Sequencer + step.output = {src:datauri,format:mimetype}; + + } + + return require('../_nomodule/PixelManipulation.js')(input, { + output: output, + changePixel: changePixel, + format: input.format, + image: options.image, + inBrowser: options.inBrowser, + callback: callback + }); + + } + return { + options: options, + draw: draw, + output: output, + UI: UI + } +} + +},{"../_nomodule/PixelManipulation.js":207}],157:[function(require,module,exports){ +arguments[4][147][0].apply(exports,arguments) +},{"./Module":156,"./info.json":158,"dup":147}],158:[function(require,module,exports){ +module.exports={ + "name": "Brightness", + "description": "Change the brightness of the image by given percent value", + "inputs": { + "brightness": { + "type": "integer", + "desc": "% brightness for the new image", + "default": 0 + } + } +} + +},{}],159:[function(require,module,exports){ +/* + * Display only one color channel + */ +module.exports = function Channel(options, UI) { + + options.channel = options.channel || "green"; + + var output; + + function draw(input, callback, progressObj) { + + progressObj.stop(true); + progressObj.overrideFlag = true; + + var step = this; + + function changePixel(r, g, b, a) { + if (options.channel == "red") return [r, 0, 0, a]; + if (options.channel == "green") return [0, g, 0, a]; + if (options.channel == "blue") return [0, 0, b, a]; + } + + function output(image, datauri, mimetype) { + + // This output is accesible by Image Sequencer + step.output = { src: datauri, format: mimetype }; + + } + + return require('../_nomodule/PixelManipulation.js')(input, { + output: output, + changePixel: changePixel, + format: input.format, + image: options.image, + inBrowser: options.inBrowser, + callback: callback + }); + + } + + return { + options: options, + //setup: setup, // optional + draw: draw, + output: output, + UI: UI + } +} + +},{"../_nomodule/PixelManipulation.js":207}],160:[function(require,module,exports){ +arguments[4][147][0].apply(exports,arguments) +},{"./Module":159,"./info.json":161,"dup":147}],161:[function(require,module,exports){ +module.exports={ + "name": "Channel", + "description": "Displays only one color channel of an image -- default is green", + "inputs": { + "channel": { + "type": "select", + "desc": "Color channel", + "default": "green", + "values": ["red", "green", "blue"] + } + } +} + +},{}],162:[function(require,module,exports){ +module.exports = function NdviColormapfunction(options, UI) { + + options.x = options.x || 0; + options.y = options.y || 0; + options.colormap = options.colormap || "default"; + options.h = options.h || 10; + this.expandSteps([ + { 'name': 'gradient', 'options': {} }, + { 'name': 'colormap', 'options': { colormap: options.colormap } }, + { 'name': 'crop', 'options': { 'y': 0, 'h': options.h } }, + { 'name': 'overlay', 'options': { 'x': options.x, 'y': options.y, 'offset': -4 } } + ]); + return { + isMeta: true + } +} +},{}],163:[function(require,module,exports){ +arguments[4][147][0].apply(exports,arguments) +},{"./Module":162,"./info.json":164,"dup":147}],164:[function(require,module,exports){ +module.exports={ + "name": "Colorbar", + "description": "Generates a colorbar to lay over the image", + "inputs": { + "colormap": { + "type": "select", + "desc": "Name of the Colormap", + "default": "default", + "values": [ + "default", + "greyscale", + "stretched", + "fastie" + ] + }, + "x": { + "type": "integer", + "desc": "X-position of the image on which the new image is overlayed", + "default": 0 + }, + "y": { + "type": "integer", + "desc": "Y-position of the image on which the new image is overlayed", + "default": 0 + }, + "h": { + "type": "iinteger", + "desc": "height of the colorbar", + "default": 10 + } + }, + "length": 4 +} +},{}],165:[function(require,module,exports){ +/* + * Accepts a value from 0-255 and returns the new color-mapped pixel + * from a lookup table, which can be specified as an array of [begin, end] + * gradients, where begin and end are represented as [r, g, b] colors. In + * combination, a lookup table which maps values from 0 - 255 smoothly from black to white looks like: + * [ + * [0, [0, 0, 0], [255, 255, 255]], + * [1, [255, 255, 255], [255, 255, 255]] + * ] + * + * Adapted from bgamari's work in Infragram: https://github.com/p-v-o-s/infragram-js/commit/346c97576a07b71a55671d17e0153b7df74e803b + */ -},{"./RunToolkit":144,"./util/getStep.js":212}],144:[function(require,module,exports){ -const getPixels = require('get-pixels'); -const pixelManipulation = require('./modules/_nomodule/PixelManipulation'); -const lodash = require('lodash'); -const dataUriToBuffer = require('data-uri-to-buffer'); -const savePixels = require('save-pixels'); - -module.exports = function(input) { - input.getPixels = getPixels; - input.pixelManipulation = pixelManipulation; - input.lodash = lodash; - input.dataUriToBuffer = dataUriToBuffer; - input.savePixels = savePixels; - return input; +module.exports = function Colormap(value, options) { + options.colormap = options.colormap || colormaps.default; + // if a lookup table is provided as an array: + if(typeof(options.colormap) == "object") + colormapFunction = colormap(options.colormap); + // if a stored colormap is named with a string like "fastie": + else if(colormaps.hasOwnProperty(options.colormap)) + colormapFunction = colormaps[options.colormap]; + else colormapFunction = colormaps.default; + return colormapFunction(value / 255.00); +} + +function colormap(segments) { + return function(x) { + var i, result, x0, x1, xstart, y0, y1, _i, _j, _len, _ref, _ref1, _ref2, _ref3; + _ref = [0, 0], y0 = _ref[0], y1 = _ref[1]; + _ref1 = [segments[0][0], 1], x0 = _ref1[0], x1 = _ref1[1]; + if (x < x0) { + return y0; + } + for (i = _i = 0, _len = segments.length; _i < _len; i = ++_i) { + _ref2 = segments[i], xstart = _ref2[0], y0 = _ref2[1], y1 = _ref2[2]; + x0 = xstart; + if (i === segments.length - 1) { + x1 = 1; + break; + } + x1 = segments[i + 1][0]; + if ((xstart <= x && x < x1)) { + break; + } + } + result = []; + for (i = _j = 0, _ref3 = y0.length; 0 <= _ref3 ? _j < _ref3 : _j > _ref3; i = 0 <= _ref3 ? ++_j : --_j) { + result[i] = (x - x0) / (x1 - x0) * (y1[i] - y0[i]) + y0[i]; + } + return result; + }; +}; + +var colormaps = { + greyscale: colormap([ + [0, [0, 0, 0], [255, 255, 255] ], + [1, [255, 255, 255], [255, 255, 255] ] + ]), + default: colormap([ + [0, [0, 0, 255], [0, 255, 0] ], + [0.25, [0, 255, 0], [255, 255, 0] ], + [0.50, [0, 255, 255], [255, 255, 0] ], + [0.75, [255, 255, 0], [255, 0, 0] ] + ]), + ndvi: colormap([ + [0, [0, 0, 255], [38, 195, 195] ], + [0.5, [0, 150, 0], [255, 255, 0] ], + [0.75, [255, 255, 0], [255, 50, 50] ] + ]), + stretched: colormap([ + [0, [0, 0, 255], [0, 0, 255] ], + [0.1, [0, 0, 255], [38, 195, 195] ], + [0.5, [0, 150, 0], [255, 255, 0] ], + [0.7, [255, 255, 0], [255, 50, 50] ], + [0.9, [255, 50, 50], [255, 50, 50] ] + ]), + fastie: colormap([ + [0, [255, 255, 255], [0, 0, 0] ], + [0.167, [0, 0, 0], [255, 255, 255] ], + [0.33, [255, 255, 255], [0, 0, 0] ], + [0.5, [0, 0, 0], [140, 140, 255] ], + [0.55, [140, 140, 255], [0, 255, 0] ], + [0.63, [0, 255, 0], [255, 255, 0] ], + [0.75, [255, 255, 0], [255, 0, 0] ], + [0.95, [255, 0, 0], [255, 0, 255] ] + ]) } -},{"./modules/_nomodule/PixelManipulation":207,"data-uri-to-buffer":13,"get-pixels":23,"lodash":62,"save-pixels":111}],145:[function(require,module,exports){ -module.exports={"sample":[{"name":"invert","options":{}},{"name":"channel","options":{"channel":"red"}},{"name":"blur","options":{"blur":"5"}}]} -},{}],146:[function(require,module,exports){ -/* -* Average all pixel colors -*/ -module.exports = function Average(options, UI){ - - options.blur = options.blur || 2 - var output; - - options.step.metadata = options.step.metadata || {}; - - function draw(input,callback,progressObj){ - - progressObj.stop(true); - progressObj.overrideFlag = true; - - var step = this; - - function changePixel(r, g, b, a){ - return [r,g,b,a] - } - - // do the averaging - function extraManipulation(pixels){ - var sum = [0,0,0,0]; - for (var i = 0; i < pixels.data.length; i += 4) { - sum[0] += pixels.data[i + 0]; - sum[1] += pixels.data[i + 1]; - sum[2] += pixels.data[i + 2]; - sum[3] += pixels.data[i + 3]; - } - - sum[0] = parseInt(sum[0] / (pixels.data.length / 4)); - sum[1] = parseInt(sum[1] / (pixels.data.length / 4)); - sum[2] = parseInt(sum[2] / (pixels.data.length / 4)); - sum[3] = parseInt(sum[3] / (pixels.data.length / 4)); - - for (var i = 0; i < pixels.data.length; i += 4) { - pixels.data[i + 0] = sum[0]; - pixels.data[i + 1] = sum[1]; - pixels.data[i + 2] = sum[2]; - pixels.data[i + 3] = sum[3]; - } - // report back and store average in metadata: - options.step.metadata.averages = sum; - console.log("average: ", sum); - // TODO: refactor into a new "display()" method as per https://github.com/publiclab/image-sequencer/issues/242 - if (options.step.inBrowser && options.step.ui) $(options.step.ui).find('.details').append("

Averages (r, g, b, a): " + sum.join(', ') + "

"); - return pixels; - } - - function output(image, datauri, mimetype){ - - // This output is accessible by Image Sequencer - step.output = { - src: datauri, - format: mimetype - }; - } - - return require('../_nomodule/PixelManipulation.js')(input, { - output: output, - changePixel: changePixel, - extraManipulation: extraManipulation, - format: input.format, - image: options.image, - callback: callback - }); - - } - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} -},{"../_nomodule/PixelManipulation.js":207}],147:[function(require,module,exports){ -module.exports = [ - require('./Module'), - require('./info.json') -] -},{"./Module":146,"./info.json":148}],148:[function(require,module,exports){ -module.exports={ - "name": "Average", - "description": "Average all pixel color", - "inputs": { - } -} +},{}],166:[function(require,module,exports){ +module.exports = function Colormap(options,UI) { -},{}],149:[function(require,module,exports){ -module.exports = function Dynamic(options, UI, util) { - - options.func = options.func || "function(r1, g1, b1, a1, r2, g2, b2, a2) { return [ r1, g2, b2, a2 ] }"; - - var output; - - // This function is called on every draw. - function draw(input, callback, progressObj) { - - progressObj.stop(true); - progressObj.overrideFlag = true; - - var step = this; - - // convert to runnable code: - if (typeof options.func === "string") eval('options.func = ' + options.func); - - var getPixels = require('get-pixels'); - - // save first image's pixels - var priorStep = this.getStep(-2); - - getPixels(priorStep.output.src, function(err, pixels) { - options.firstImagePixels = pixels; - - function changePixel(r2, g2, b2, a2, x, y) { - // blend! - var p = options.firstImagePixels; - return options.func( - r2, g2, b2, a2, - p.get(x, y, 0), - p.get(x, y, 1), - p.get(x, y, 2), - p.get(x, y, 3) - ) - } - - function output(image, datauri, mimetype) { - - // This output is accessible by Image Sequencer - step.output = { src: datauri, format: mimetype }; - - } - - // run PixelManipulatin on second image's pixels - return require('../_nomodule/PixelManipulation.js')(input, { - output: output, - changePixel: changePixel, - format: input.format, - image: options.image, - inBrowser: options.inBrowser, - callback: callback - }); - }); - } - - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} + var output; + + // This function is called on every draw. + function draw(input,callback,progressObj) { + + progressObj.stop(true); + progressObj.overrideFlag = true; + + var step = this; + + function changePixel(r, g, b, a) { + var combined = (r + g + b) / 3.000; + var res = require('./Colormap')(combined, options); + return [res[0], res[1], res[2], 255]; + } + + function output(image,datauri,mimetype){ + + // This output is accessible by Image Sequencer + step.output = { src: datauri, format: mimetype }; + + } + return require('../_nomodule/PixelManipulation.js')(input, { + output: output, + changePixel: changePixel, + format: input.format, + image: options.image, + inBrowser: options.inBrowser, + callback: callback + }); + + } + + return { + options: options, + draw: draw, + output: output, + UI: UI + } +} + +},{"../_nomodule/PixelManipulation.js":207,"./Colormap":165}],167:[function(require,module,exports){ +arguments[4][147][0].apply(exports,arguments) +},{"./Module":166,"./info.json":168,"dup":147}],168:[function(require,module,exports){ +module.exports={ + "name": "Colormap", + "description": "Maps brightness values (average of red, green & blue) to a given color lookup table, made up of a set of one more color gradients.\n\nFor example, 'cooler' colors like blue could represent low values, while 'hot' colors like red could represent high values.", + "inputs": { + "colormap": { + "type": "select", + "desc": "Name of the Colormap", + "default": "default", + "values": ["default","greyscale","stretched","fastie"] + } + } +} + +},{}],169:[function(require,module,exports){ +(function (Buffer){ +module.exports = function Crop(input,options,callback) { + + var getPixels = require('get-pixels'), + savePixels = require('save-pixels'); + + options.x = parseInt(options.x) || 0; + options.y = parseInt(options.y) || 0; + + getPixels(input.src,function(err,pixels){ + options.w = parseInt(options.w) || Math.floor(pixels.shape[0]); + options.h = parseInt(options.h) || Math.floor(pixels.shape[1]); + var ox = options.x; + var oy = options.y; + var w = options.w; + var h = options.h; + var iw = pixels.shape[0]; //Width of Original Image + var newarray = new Uint8Array(4*w*h); + for (var n = oy; n < oy + h; n++) { + newarray.set(pixels.data.slice(n*4*iw + ox, n*4*iw + ox + 4*w),4*w*(n-oy)); + } + pixels.data = newarray; + pixels.shape = [w,h,4]; + pixels.stride[1] = 4*w; + + options.format = input.format; + + var chunks = []; + var totalLength = 0; + var r = savePixels(pixels, options.format); + + r.on('data', function(chunk){ + totalLength += chunk.length; + chunks.push(chunk); + }); + + r.on('end', function(){ + var data = Buffer.concat(chunks, totalLength).toString('base64'); + var datauri = 'data:image/' + options.format + ';base64,' + data; + callback(datauri,options.format); + }); + }); +}; + +}).call(this,require("buffer").Buffer) +},{"buffer":4,"get-pixels":23,"save-pixels":111}],170:[function(require,module,exports){ +/* + * Image Cropping module + * Usage: + * Expected Inputs: + * options.x : x-coordinate of image where the modules starts cropping | default : 0 + * options.y : y-coordinate of image where the modules starts cropping | default : 0 + * options.w : width of the resulting cropped image | default : 50% of input image width + * options.h : height of the resulting cropped image | default : 50% of input image height + * Output: + * The cropped image, which is essentially a rectangle bounded by the lines: + * x = options.x + * x = options.x + options.w + * y = options.y + * y = options.y + options.h + */ +module.exports = function CropModule(options, UI) { + + // we should get UI to return the image thumbnail so we can attach our own UI extensions + // add our custom in-module html ui: + if (options.step.inBrowser) var ui = require('./Ui.js')(options.step, UI); + var output, + setupComplete = false; + + // This function is caled everytime the step has to be redrawn + function draw(input,callback) { + + var step = this; + + // save the input image; + // TODO: this should be moved to module API to persist the input image + options.step.input = input.src; + + require('./Crop')(input, options, function(out, format){ + + // This output is accessible to Image Sequencer + step.output = { + src: out, + format: format + } + + // This output is accessible to the UI + options.step.output = out; + + // Tell the UI that the step has been drawn + UI.onComplete(options.step); + + // we should do this via event/listener: + if (ui && ui.hide) ui.hide(); + + // start custom UI setup (draggable UI) + // only once we have an input image + if (setupComplete === false && options.step.inBrowser) { + setupComplete = true; + ui.setup(); + } + + // Tell Image Sequencer that step has been drawn + callback(); + + }); + + } + + return { + options: options, + draw: draw, + output: output, + UI: UI + } +} + +},{"./Crop":169,"./Ui.js":171}],171:[function(require,module,exports){ +// hide on save +module.exports = function CropModuleUi(step, ui) { + + let inputWidth = 0, + inputHeight = 0; + + // We don't have input image dimensions at the + // time of setting up the UI; that comes when draw() is triggered. + // So we trigger setup only on first run of draw() + // TODO: link this to an event rather than an explicit call in Module.js + function setup() { + let x = 0, + y = 0; + + // display original uncropped input image on initial setup + showOriginal(); + + inputWidth = Math.floor(imgEl().naturalWidth); + inputHeight = Math.floor(imgEl().naturalHeight); + + // display with 50%/50% default crop: + setOptions(x, y, inputWidth, inputHeight); + + $(imgEl()).imgAreaSelect({ + handles: true, + x1: x, + y1: y, + x2: x + inputWidth / 2, + y2: y + inputHeight / 2, + // when selection is complete + onSelectEnd: function onSelectEnd(img, selection) { + // assign crop values to module UI form inputs: + let converted = convertToNatural( + selection.x1, + selection.y1, + selection.width, + selection.height + ); + setOptions( + converted[0], + converted[1], + converted[2], + converted[3] + ); + } + }); + } + + function convertToNatural(_x, _y, _width, _height) { + let displayWidth = $(imgEl()).width(), + displayHeight = $(imgEl()).height(); + // return in same order [ x, y, width, height ]: + return [ + Math.floor(( _x / displayWidth ) * inputWidth), + Math.floor(( _y / displayHeight ) * inputHeight), + Math.floor(( _width / displayWidth ) * inputWidth), + Math.floor(( _height / displayHeight ) * inputHeight) + ] + } + + function remove() { + $(imgEl()).imgAreaSelect({ + remove: true + }); + } + + function hide() { + // then hide the draggable UI + $(imgEl()).imgAreaSelect({ + hide: true + }); + } + + // step.imgSelector is not defined, imgElement is: + function imgEl() { + return step.imgElement; + } + + function setOptions(x1, y1, width, height) { + let options = $($(imgEl()).parents()[2]).find("input"); + options[0].value = x1; + options[1].value = y1; + options[2].value = width; + options[3].value = height; + } + + // replaces currently displayed output thumbnail with the input image, for ui dragging purposes + function showOriginal() { + step.imgElement.src = step.input; + } + + return { + setup: setup, + remove: remove, + hide: hide + } +} + +},{}],172:[function(require,module,exports){ +arguments[4][147][0].apply(exports,arguments) +},{"./Module":170,"./info.json":173,"dup":147}],173:[function(require,module,exports){ +module.exports={ + "name": "Crop", + "description": "Crop image to given x, y, w, h in pixels, measured from top left", + "url": "https://github.com/publiclab/image-sequencer/tree/master/MODULES.md", + "inputs": { + "x": { + "type": "integer", + "desc": "X-position (measured from left) from where cropping starts", + "default": 0 + }, + "y": { + "type": "integer", + "desc": "Y-position (measured from top) from where cropping starts", + "default": 0 + }, + "w": { + "type": "integer", + "desc": "Width of crop", + "default": "(100%)" + }, + "h": { + "type": "integer", + "desc": "Height of crop", + "default": "(100%)" + } + } +} +},{}],174:[function(require,module,exports){ +/* + * Decodes QR from a given image. + */ +module.exports = function DoNothing(options,UI) { + + var output; + var jsQR = require('jsqr'); + var getPixels = require('get-pixels'); + + // This function is called everytime a step has to be redrawn + function draw(input,callback) { + + var step = this; + + getPixels(input.src,function(err,pixels){ + + if(err) throw err; + + var w = pixels.shape[0]; + var h = pixels.shape[1]; + var decoded = jsQR.decodeQRFromImage(pixels.data,w,h); + + // This output is accessible to Image Sequencer + step.output = input; + step.output.data = decoded; + + // Tell Image Sequencer that this step is complete + callback(); + options.step.qrval = decoded; + + }); + + } + + return { + options: options, + draw: draw, + output: output, + UI: UI + } +} + +},{"get-pixels":23,"jsqr":61}],175:[function(require,module,exports){ +arguments[4][147][0].apply(exports,arguments) +},{"./Module":174,"./info.json":176,"dup":147}],176:[function(require,module,exports){ +module.exports={ + "name": "Decode QR", + "description": "Search for and decode a QR code in the image", + "inputs": { + }, + "outputs": { + "qrval": { + "type": "text" + } + } +} + +},{}],177:[function(require,module,exports){ +module.exports = function Dynamic(options,UI) { + + var output; + + // This function is called on every draw. + function draw(input,callback,progressObj) { + + progressObj.stop(true); + progressObj.overrideFlag = true; + + var step = this; + + // start with monochrome, but if options.red, options.green, and options.blue are set, accept them too + options.monochrome = options.monochrome || "(R+G+B)/3"; + + function generator(expression) { + var func = 'f = function (r, g, b, a) { var R = r, G = g, B = b, A = a;' + func = func + 'return '; + func = func + expression + '}'; + var f; + eval(func); + return f; + } + + var channels = ['red', 'green', 'blue', 'alpha']; + + channels.forEach(function(channel) { + if (options.hasOwnProperty(channel)) options[channel + '_function'] = generator(options[channel]); + else if (channel === 'alpha') options['alpha_function'] = function() { return 255; } + else options[channel + '_function'] = generator(options.monochrome); + }); + + function changePixel(r, g, b, a) { + + /* neighbourpixels can be calculated by + this.getNeighbourPixel.fun(x,y) or this.getNeighborPixel.fun(x,y) + */ + var combined = (r + g + b) / 3.000; + return [ + options.red_function(r, g, b, a), + options.green_function(r, g, b, a), + options.blue_function(r, g, b, a), + options.alpha_function(r, g, b, a), + ]; + } + + /* Functions to get the neighbouring pixel by position (x,y) */ + function getNeighbourPixel(pixels,curX,curY,distX,distY){ + return [ + pixels.get(curX+distX,curY+distY,0) + ,pixels.get(curX+distX,curY+distY,1) + ,pixels.get(curX+distX,curY+distY,2) + ,pixels.get(curX+distX,curY+distY,3) + ] + } + + + function output(image,datauri,mimetype){ + + // This output is accessible by Image Sequencer + step.output = { src: datauri, format: mimetype }; + + } + return require('../_nomodule/PixelManipulation.js')(input, { + output: output, + changePixel: changePixel, + getNeighbourPixel: getNeighbourPixel, + getNeighborPixel: getNeighbourPixel, + format: input.format, + image: options.image, + inBrowser: options.inBrowser, + callback: callback + }); -},{"../_nomodule/PixelManipulation.js":207,"get-pixels":23}],150:[function(require,module,exports){ -arguments[4][147][0].apply(exports,arguments) -},{"./Module":149,"./info.json":151,"dup":147}],151:[function(require,module,exports){ -module.exports={ - "name": "Blend", - "description": "Blend the past two image steps with the given function. Defaults to using the red channel from image 1 and the green and blue and alpha channels of image 2. Easier to use interfaces coming soon!", - "inputs": { - "blend": { - "type": "input", - "desc": "Function to use to blend the two images.", - "default": "function(r1, g1, b1, a1, r2, g2, b2, a2) { return [ r1, g2, b2, a2 ] }" - } - } -} + } -},{}],152:[function(require,module,exports){ -module.exports = exports = function(pixels, blur) { - let kernel = kernelGenerator(blur, 1), oldpix = pixels; - kernel = flipKernel(kernel); - - for (let i = 0; i < pixels.shape[0]; i++) { - for (let j = 0; j < pixels.shape[1]; j++) { - let neighboutPos = getNeighbouringPixelPositions([i, j]); - let acc = [0.0, 0.0, 0.0, 0.0]; - for (let a = 0; a < kernel.length; a++) { - for (let b = 0; b < kernel.length; b++) { - acc[0] += (oldpix.get(neighboutPos[a][b][0], neighboutPos[a][b][1], 0) * kernel[a][b]); - acc[1] += (oldpix.get(neighboutPos[a][b][0], neighboutPos[a][b][1], 1) * kernel[a][b]); - acc[2] += (oldpix.get(neighboutPos[a][b][0], neighboutPos[a][b][1], 2) * kernel[a][b]); - acc[3] += (oldpix.get(neighboutPos[a][b][0], neighboutPos[a][b][1], 3) * kernel[a][b]); - } - } - pixels.set(i, j, 0, acc[0]); - pixels.set(i, j, 1, acc[1]); - pixels.set(i, j, 2, acc[2]); - } - } - return pixels; - - - - //Generates a 3x3 Gaussian kernel - function kernelGenerator(sigma, size) { - - /* - Trying out a variable radius kernel not working as of now - */ - // const coeff = (1.0/(2.0*Math.PI*sigma*sigma)) - // const expCoeff = -1 * (1.0/2.0 * sigma * sigma) - // let e = Math.E - // let result = [] - // for(let i = -1 * size;i<=size;i++){ - // let arr = [] - // for(let j= -1 * size;j<=size;j++){ - // arr.push(coeff * Math.pow(e,expCoeff * ((i * i) + (j*j)))) - // } - // result.push(arr) - // } - // let sum = result.reduce((sum,val)=>{ - // return val.reduce((sumInner,valInner)=>{ - // return sumInner+valInner - // }) - // }) - // result = result.map(arr=>arr.map(val=>(val + 0.0)/(sum + 0.0))) - - // return result - - return [ - [2.0 / 159.0, 4.0 / 159.0, 5.0 / 159.0, 4.0 / 159.0, 2.0 / 159.0], - [4.0 / 159.0, 9.0 / 159.0, 12.0 / 159.0, 9.0 / 159.0, 4.0 / 159.0], - [5.0 / 159.0, 12.0 / 159.0, 15.0 / 159.0, 12.0 / 159.0, 5.0 / 159.0], - [4.0 / 159.0, 9.0 / 159.0, 12.0 / 159.0, 9.0 / 159.0, 4.0 / 159.0], - [2.0 / 159.0, 4.0 / 159.0, 5.0 / 159.0, 4.0 / 159.0, 2.0 / 159.0] - ]; - } - function getNeighbouringPixelPositions(pixelPosition) { - let x = pixelPosition[0], y = pixelPosition[1], result = []; - - for (let i = -2; i <= 2; i++) { - let arr = []; - for (let j = -2; j <= 2; j++) - arr.push([x + i, y + j]); - - result.push(arr); - } - return result; - } - - function flipKernel(kernel) { - let result = []; - for (let i = kernel.length - 1; i >= 0; i--) { - let arr = []; - for (let j = kernel[i].length - 1; j >= 0; j--) { - arr.push(kernel[i][j]); - } - result.push(arr); - } - return result; - } + return { + options: options, + draw: draw, + output: output, + UI: UI + } } -},{}],153:[function(require,module,exports){ -/* -* Blur an Image -*/ -module.exports = function Blur(options, UI) { - - options.blur = options.blur || 2 - var output; - - function draw(input, callback, progressObj) { - - progressObj.stop(true); - progressObj.overrideFlag = true; - - var step = this; - - function changePixel(r, g, b, a) { - return [r, g, b, a] - } - - function extraManipulation(pixels) { - pixels = require('./Blur')(pixels, options.blur) - return pixels - } - - function output(image, datauri, mimetype) { - - // This output is accessible by Image Sequencer - step.output = { src: datauri, format: mimetype }; - - } - - return require('../_nomodule/PixelManipulation.js')(input, { - output: output, - changePixel: changePixel, - extraManipulation: extraManipulation, - format: input.format, - image: options.image, - callback: callback - }); - - } - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} -},{"../_nomodule/PixelManipulation.js":207,"./Blur":152}],154:[function(require,module,exports){ +},{"../_nomodule/PixelManipulation.js":207}],178:[function(require,module,exports){ arguments[4][147][0].apply(exports,arguments) -},{"./Module":153,"./info.json":155,"dup":147}],155:[function(require,module,exports){ -module.exports={ - "name": "Blur", - "description": "Gaussian blur an image by a given value, typically 0-5", - "inputs": { - "blur": { - "type": "integer", - "desc": "amount of gaussian blur(Less blur gives more detail, typically 0-5)", - "default": 2 - } - } -} +},{"./Module":177,"./info.json":179,"dup":147}],179:[function(require,module,exports){ +module.exports={ + "name": "Dynamic", + "description": "A module which accepts JavaScript math expressions to produce each color channel based on the original image's color. See
Infragrammar.", + "inputs": { + "red": { + "type": "input", + "desc": "Expression to return for red channel with R, G, B, and A inputs", + "default": "r" + }, + "green": { + "type": "input", + "desc": "Expression to return for green channel with R, G, B, and A inputs", + "default": "g" + }, + "blue": { + "type": "input", + "desc": "Expression to return for blue channel with R, G, B, and A inputs", + "default": "b" + }, + "monochrome (fallback)": { + "type": "input", + "desc": "Expression to return with R, G, B, and A inputs; fallback for other channels if none provided", + "default": "r + g + b" + } + } +} -},{}],156:[function(require,module,exports){ -/* -* Changes the Image Brightness -*/ - -module.exports = function Brightness(options,UI){ - - var output; - - function draw(input,callback,progressObj){ - - progressObj.stop(true); - progressObj.overrideFlag = true; - - /* - In this case progress is handled by changepixel internally otherwise progressObj - needs to be overriden and used - For eg. progressObj = new SomeProgressModule() - */ - - var step = this; - - function changePixel(r, g, b, a){ - var val = (options.brightness)/100.0 - - r = val*r<255?val*r:255 - g = val*g<255?val*g:255 - b = val*b<255?val*b:255 - return [r , g, b, a] - } - - function output(image,datauri,mimetype){ - - // This output is accessible by Image Sequencer - step.output = {src:datauri,format:mimetype}; - - } - - return require('../_nomodule/PixelManipulation.js')(input, { - output: output, - changePixel: changePixel, - format: input.format, - image: options.image, - inBrowser: options.inBrowser, - callback: callback - }); - - } - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} +},{}],180:[function(require,module,exports){ +const _ = require('lodash') -},{"../_nomodule/PixelManipulation.js":207}],157:[function(require,module,exports){ -arguments[4][147][0].apply(exports,arguments) -},{"./Module":156,"./info.json":158,"dup":147}],158:[function(require,module,exports){ -module.exports={ - "name": "Brightness", - "description": "Change the brightness of the image by given percent value", - "inputs": { - "brightness": { - "type": "integer", - "desc": "% brightness for the new image", - "default": 0 - } - } -} +//define kernels for the sobel filter +const kernelx = [[-1, 0, 1], [-2, 0, 2], [-1, 0, 1]], + kernely = [[-1, -2, -1], [0, 0, 0], [1, 2, 1]]; -},{}],159:[function(require,module,exports){ -/* - * Display only one color channel - */ -module.exports = function Channel(options, UI) { - - options.channel = options.channel || "green"; - - var output; - - function draw(input, callback, progressObj) { - - progressObj.stop(true); - progressObj.overrideFlag = true; - - var step = this; - - function changePixel(r, g, b, a) { - if (options.channel == "red") return [r, 0, 0, a]; - if (options.channel == "green") return [0, g, 0, a]; - if (options.channel == "blue") return [0, 0, b, a]; - } - - function output(image, datauri, mimetype) { - - // This output is accesible by Image Sequencer - step.output = { src: datauri, format: mimetype }; - - } - - return require('../_nomodule/PixelManipulation.js')(input, { - output: output, - changePixel: changePixel, - format: input.format, - image: options.image, - inBrowser: options.inBrowser, - callback: callback - }); - - } - - return { - options: options, - //setup: setup, // optional - draw: draw, - output: output, - UI: UI - } -} +let angles = [], mags = [], strongEdgePixels = [], weakEdgePixels = [], notInUI; +module.exports = function(pixels, highThresholdRatio, lowThresholdRatio, inBrowser) { + notInUI = !inBrowser; + for (var x = 0; x < pixels.shape[0]; x++) { + angles.push([]); + mags.push([]); + for (var y = 0; y < pixels.shape[1]; y++) { + var result = changePixel( + pixels, + pixels.get(x, y, 0), + pixels.get(x, y, 3), + x, + y + ); + let pixel = result.pixel; -},{"../_nomodule/PixelManipulation.js":207}],160:[function(require,module,exports){ -arguments[4][147][0].apply(exports,arguments) -},{"./Module":159,"./info.json":161,"dup":147}],161:[function(require,module,exports){ -module.exports={ - "name": "Channel", - "description": "Displays only one color channel of an image -- default is green", - "inputs": { - "channel": { - "type": "select", - "desc": "Color channel", - "default": "green", - "values": ["red", "green", "blue"] - } - } -} + pixels.set(x, y, 0, pixel[0]); + pixels.set(x, y, 1, pixel[1]); + pixels.set(x, y, 2, pixel[2]); + pixels.set(x, y, 3, pixel[3]); -},{}],162:[function(require,module,exports){ -module.exports = function NdviColormapfunction(options, UI) { - - options.x = options.x || 0; - options.y = options.y || 0; - options.colormap = options.colormap || "default"; - options.h = options.h || 10; - this.expandSteps([ - { 'name': 'gradient', 'options': {} }, - { 'name': 'colormap', 'options': { colormap: options.colormap } }, - { 'name': 'crop', 'options': { 'y': 0, 'h': options.h } }, - { 'name': 'overlay', 'options': { 'x': options.x, 'y': options.y, 'offset': -4 } } - ]); - return { - isMeta: true - } + mags.slice(-1)[0].push(pixel[3]); + angles.slice(-1)[0].push(result.angle); + } + } + + return doubleThreshold(nonMaxSupress(pixels), highThresholdRatio, lowThresholdRatio); } -},{}],163:[function(require,module,exports){ -arguments[4][147][0].apply(exports,arguments) -},{"./Module":162,"./info.json":164,"dup":147}],164:[function(require,module,exports){ -module.exports={ - "name": "Colorbar", - "description": "Generates a colorbar to lay over the image", - "inputs": { - "colormap": { - "type": "select", - "desc": "Name of the Colormap", - "default": "default", - "values": [ - "default", - "greyscale", - "stretched", - "fastie" - ] - }, - "x": { - "type": "integer", - "desc": "X-position of the image on which the new image is overlayed", - "default": 0 - }, - "y": { - "type": "integer", - "desc": "Y-position of the image on which the new image is overlayed", - "default": 0 - }, - "h": { - "type": "iinteger", - "desc": "height of the colorbar", - "default": 10 - } - }, - "length": 4 + +//changepixel function that convolutes every pixel (sobel filter) +function changePixel(pixels, val, a, x, y) { + let magX = 0.0; + for (let a = 0; a < 3; a++) { + for (let b = 0; b < 3; b++) { + + let xn = x + a - 1; + let yn = y + b - 1; + + magX += pixels.get(xn, yn, 0) * kernelx[a][b]; + } + } + let magY = 0.0; + for (let a = 0; a < 3; a++) { + for (let b = 0; b < 3; b++) { + + let xn = x + a - 1; + let yn = y + b - 1; + + magY += pixels.get(xn, yn, 0) * kernely[a][b]; + } + } + let mag = Math.sqrt(Math.pow(magX, 2) + Math.pow(magY, 2)); + let angle = Math.atan2(magY, magX); + return { + pixel: + [val, val, val, mag], + angle: angle + }; } -},{}],165:[function(require,module,exports){ -/* - * Accepts a value from 0-255 and returns the new color-mapped pixel - * from a lookup table, which can be specified as an array of [begin, end] - * gradients, where begin and end are represented as [r, g, b] colors. In - * combination, a lookup table which maps values from 0 - 255 smoothly from black to white looks like: - * [ - * [0, [0, 0, 0], [255, 255, 255]], - * [1, [255, 255, 255], [255, 255, 255]] - * ] - * - * Adapted from bgamari's work in Infragram: https://github.com/p-v-o-s/infragram-js/commit/346c97576a07b71a55671d17e0153b7df74e803b - */ - -module.exports = function Colormap(value, options) { - options.colormap = options.colormap || colormaps.default; - // if a lookup table is provided as an array: - if(typeof(options.colormap) == "object") - colormapFunction = colormap(options.colormap); - // if a stored colormap is named with a string like "fastie": - else if(colormaps.hasOwnProperty(options.colormap)) - colormapFunction = colormaps[options.colormap]; - else colormapFunction = colormaps.default; - return colormapFunction(value / 255.00); -} - -function colormap(segments) { - return function(x) { - var i, result, x0, x1, xstart, y0, y1, _i, _j, _len, _ref, _ref1, _ref2, _ref3; - _ref = [0, 0], y0 = _ref[0], y1 = _ref[1]; - _ref1 = [segments[0][0], 1], x0 = _ref1[0], x1 = _ref1[1]; - if (x < x0) { - return y0; - } - for (i = _i = 0, _len = segments.length; _i < _len; i = ++_i) { - _ref2 = segments[i], xstart = _ref2[0], y0 = _ref2[1], y1 = _ref2[2]; - x0 = xstart; - if (i === segments.length - 1) { - x1 = 1; - break; - } - x1 = segments[i + 1][0]; - if ((xstart <= x && x < x1)) { - break; - } - } - result = []; - for (i = _j = 0, _ref3 = y0.length; 0 <= _ref3 ? _j < _ref3 : _j > _ref3; i = 0 <= _ref3 ? ++_j : --_j) { - result[i] = (x - x0) / (x1 - x0) * (y1[i] - y0[i]) + y0[i]; - } - return result; - }; -}; - -var colormaps = { - greyscale: colormap([ - [0, [0, 0, 0], [255, 255, 255] ], - [1, [255, 255, 255], [255, 255, 255] ] - ]), - default: colormap([ - [0, [0, 0, 255], [0, 255, 0] ], - [0.25, [0, 255, 0], [255, 255, 0] ], - [0.50, [0, 255, 255], [255, 255, 0] ], - [0.75, [255, 255, 0], [255, 0, 0] ] - ]), - ndvi: colormap([ - [0, [0, 0, 255], [38, 195, 195] ], - [0.5, [0, 150, 0], [255, 255, 0] ], - [0.75, [255, 255, 0], [255, 50, 50] ] - ]), - stretched: colormap([ - [0, [0, 0, 255], [0, 0, 255] ], - [0.1, [0, 0, 255], [38, 195, 195] ], - [0.5, [0, 150, 0], [255, 255, 0] ], - [0.7, [255, 255, 0], [255, 50, 50] ], - [0.9, [255, 50, 50], [255, 50, 50] ] - ]), - fastie: colormap([ - [0, [255, 255, 255], [0, 0, 0] ], - [0.167, [0, 0, 0], [255, 255, 255] ], - [0.33, [255, 255, 255], [0, 0, 0] ], - [0.5, [0, 0, 0], [140, 140, 255] ], - [0.55, [140, 140, 255], [0, 255, 0] ], - [0.63, [0, 255, 0], [255, 255, 0] ], - [0.75, [255, 255, 0], [255, 0, 0] ], - [0.95, [255, 0, 0], [255, 0, 255] ] - ]) -} -},{}],166:[function(require,module,exports){ -module.exports = function Colormap(options,UI) { - - var output; - - // This function is called on every draw. - function draw(input,callback,progressObj) { - - progressObj.stop(true); - progressObj.overrideFlag = true; - - var step = this; - - function changePixel(r, g, b, a) { - var combined = (r + g + b) / 3.000; - var res = require('./Colormap')(combined, options); - return [res[0], res[1], res[2], 255]; - } - - function output(image,datauri,mimetype){ - - // This output is accessible by Image Sequencer - step.output = { src: datauri, format: mimetype }; - - } - return require('../_nomodule/PixelManipulation.js')(input, { - output: output, - changePixel: changePixel, - format: input.format, - image: options.image, - inBrowser: options.inBrowser, - callback: callback - }); - - } - - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} +//Non Maximum Supression without interpolation +function nonMaxSupress(pixels) { -},{"../_nomodule/PixelManipulation.js":207,"./Colormap":165}],167:[function(require,module,exports){ -arguments[4][147][0].apply(exports,arguments) -},{"./Module":166,"./info.json":168,"dup":147}],168:[function(require,module,exports){ -module.exports={ - "name": "Colormap", - "description": "Maps brightness values (average of red, green & blue) to a given color lookup table, made up of a set of one more color gradients.\n\nFor example, 'cooler' colors like blue could represent low values, while 'hot' colors like red could represent high values.", - "inputs": { - "colormap": { - "type": "select", - "desc": "Name of the Colormap", - "default": "default", - "values": ["default","greyscale","stretched","fastie"] - } - } -} + angles = angles.map((arr) => arr.map(convertToDegrees)); -},{}],169:[function(require,module,exports){ -(function (Buffer){ -module.exports = function Crop(input,options,callback) { - - var getPixels = require('get-pixels'), - savePixels = require('save-pixels'); - - options.x = parseInt(options.x) || 0; - options.y = parseInt(options.y) || 0; - - getPixels(input.src,function(err,pixels){ - options.w = parseInt(options.w) || Math.floor(pixels.shape[0]); - options.h = parseInt(options.h) || Math.floor(pixels.shape[1]); - var ox = options.x; - var oy = options.y; - var w = options.w; - var h = options.h; - var iw = pixels.shape[0]; //Width of Original Image - var newarray = new Uint8Array(4*w*h); - for (var n = oy; n < oy + h; n++) { - newarray.set(pixels.data.slice(n*4*iw + ox, n*4*iw + ox + 4*w),4*w*(n-oy)); - } - pixels.data = newarray; - pixels.shape = [w,h,4]; - pixels.stride[1] = 4*w; - - options.format = input.format; - - var chunks = []; - var totalLength = 0; - var r = savePixels(pixels, options.format); - - r.on('data', function(chunk){ - totalLength += chunk.length; - chunks.push(chunk); - }); - - r.on('end', function(){ - var data = Buffer.concat(chunks, totalLength).toString('base64'); - var datauri = 'data:image/' + options.format + ';base64,' + data; - callback(datauri,options.format); - }); - }); -}; + for (let i = 1; i < pixels.shape[0] - 1; i++) { + for (let j = 1; j < pixels.shape[1] - 1; j++) { -}).call(this,require("buffer").Buffer) -},{"buffer":4,"get-pixels":23,"save-pixels":111}],170:[function(require,module,exports){ -/* - * Image Cropping module - * Usage: - * Expected Inputs: - * options.x : x-coordinate of image where the modules starts cropping | default : 0 - * options.y : y-coordinate of image where the modules starts cropping | default : 0 - * options.w : width of the resulting cropped image | default : 50% of input image width - * options.h : height of the resulting cropped image | default : 50% of input image height - * Output: - * The cropped image, which is essentially a rectangle bounded by the lines: - * x = options.x - * x = options.x + options.w - * y = options.y - * y = options.y + options.h - */ -module.exports = function CropModule(options, UI) { - - // we should get UI to return the image thumbnail so we can attach our own UI extensions - // add our custom in-module html ui: - if (options.step.inBrowser) var ui = require('./Ui.js')(options.step, UI); - var output, - setupComplete = false; - - // This function is caled everytime the step has to be redrawn - function draw(input,callback) { - - var step = this; - - // save the input image; - // TODO: this should be moved to module API to persist the input image - options.step.input = input.src; - - require('./Crop')(input, options, function(out, format){ - - // This output is accessible to Image Sequencer - step.output = { - src: out, - format: format - } - - // This output is accessible to the UI - options.step.output = out; - - // Tell the UI that the step has been drawn - UI.onComplete(options.step); - - // we should do this via event/listener: - if (ui && ui.hide) ui.hide(); - - // start custom UI setup (draggable UI) - // only once we have an input image - if (setupComplete === false && options.step.inBrowser) { - setupComplete = true; - ui.setup(); - } - - // Tell Image Sequencer that step has been drawn - callback(); - - }); - - } - - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} + let angle = angles[i][j]; + let pixel = pixels.get(i, j); -},{"./Crop":169,"./Ui.js":171}],171:[function(require,module,exports){ -// hide on save -module.exports = function CropModuleUi(step, ui) { - - let inputWidth = 0, - inputHeight = 0; - - // We don't have input image dimensions at the - // time of setting up the UI; that comes when draw() is triggered. - // So we trigger setup only on first run of draw() - // TODO: link this to an event rather than an explicit call in Module.js - function setup() { - let x = 0, - y = 0; - - // display original uncropped input image on initial setup - showOriginal(); - - inputWidth = Math.floor(imgEl().naturalWidth); - inputHeight = Math.floor(imgEl().naturalHeight); - - // display with 50%/50% default crop: - setOptions(x, y, inputWidth, inputHeight); - - $(imgEl()).imgAreaSelect({ - handles: true, - x1: x, - y1: y, - x2: x + inputWidth / 2, - y2: y + inputHeight / 2, - // when selection is complete - onSelectEnd: function onSelectEnd(img, selection) { - // assign crop values to module UI form inputs: - let converted = convertToNatural( - selection.x1, - selection.y1, - selection.width, - selection.height - ); - setOptions( - converted[0], - converted[1], - converted[2], - converted[3] - ); - } - }); - } - - function convertToNatural(_x, _y, _width, _height) { - let displayWidth = $(imgEl()).width(), - displayHeight = $(imgEl()).height(); - // return in same order [ x, y, width, height ]: - return [ - Math.floor(( _x / displayWidth ) * inputWidth), - Math.floor(( _y / displayHeight ) * inputHeight), - Math.floor(( _width / displayWidth ) * inputWidth), - Math.floor(( _height / displayHeight ) * inputHeight) - ] - } - - function remove() { - $(imgEl()).imgAreaSelect({ - remove: true - }); - } - - function hide() { - // then hide the draggable UI - $(imgEl()).imgAreaSelect({ - hide: true - }); - } - - // step.imgSelector is not defined, imgElement is: - function imgEl() { - return step.imgElement; - } - - function setOptions(x1, y1, width, height) { - let options = $($(imgEl()).parents()[2]).find("input"); - options[0].value = x1; - options[1].value = y1; - options[2].value = width; - options[3].value = height; - } - - // replaces currently displayed output thumbnail with the input image, for ui dragging purposes - function showOriginal() { - step.imgElement.src = step.input; - } - - return { - setup: setup, - remove: remove, - hide: hide - } -} + if ((angle >= -22.5 && angle <= 22.5) || + (angle < -157.5 && angle >= -180)) -},{}],172:[function(require,module,exports){ -arguments[4][147][0].apply(exports,arguments) -},{"./Module":170,"./info.json":173,"dup":147}],173:[function(require,module,exports){ -module.exports={ - "name": "Crop", - "description": "Crop image to given x, y, w, h in pixels, measured from top left", - "url": "https://github.com/publiclab/image-sequencer/tree/master/MODULES.md", - "inputs": { - "x": { - "type": "integer", - "desc": "X-position (measured from left) from where cropping starts", - "default": 0 - }, - "y": { - "type": "integer", - "desc": "Y-position (measured from top) from where cropping starts", - "default": 0 - }, - "w": { - "type": "integer", - "desc": "Width of crop", - "default": "(100%)" - }, - "h": { - "type": "integer", - "desc": "Height of crop", - "default": "(100%)" - } - } + if ((mags[i][j] >= mags[i][j + 1]) && + (mags[i][j] >= mags[i][j - 1])) + pixels.set(i, j, 3, mags[i][j]); + else + pixels.set(i, j, 3, 0); + + else if ((angle >= 22.5 && angle <= 67.5) || + (angle < -112.5 && angle >= -157.5)) + + if ((mags[i][j] >= mags[i + 1][j + 1]) && + (mags[i][j] >= mags[i - 1][j - 1])) + pixels.set(i, j, 3, mags[i][j]); + else + pixels.set(i, j, 3, 0); + + else if ((angle >= 67.5 && angle <= 112.5) || + (angle < -67.5 && angle >= -112.5)) + + if ((mags[i][i] >= mags[i + 1][j]) && + (mags[i][j] >= mags[i][j])) + pixels.set(i, j, 3, mags[i][j]); + else + pixels.set(i, j, 3, 0); + + else if ((angle >= 112.5 && angle <= 157.5) || + (angle < -22.5 && angle >= -67.5)) + + if ((mags[i][j] >= mags[i + 1][j - 1]) && + (mags[i][j] >= mags[i - 1][j + 1])) + pixels.set(i, j, 3, mags[i][j]); + else + pixels.set(i, j, 3, 0); + + } + } + return pixels; } -},{}],174:[function(require,module,exports){ -/* - * Decodes QR from a given image. - */ -module.exports = function DoNothing(options,UI) { - - var output; - var jsQR = require('jsqr'); - var getPixels = require('get-pixels'); - - // This function is called everytime a step has to be redrawn - function draw(input,callback) { - - var step = this; - - getPixels(input.src,function(err,pixels){ - - if(err) throw err; - - var w = pixels.shape[0]; - var h = pixels.shape[1]; - var decoded = jsQR.decodeQRFromImage(pixels.data,w,h); - - // This output is accessible to Image Sequencer - step.output = input; - step.output.data = decoded; - - // Tell Image Sequencer that this step is complete - callback(); - options.step.qrval = decoded; - - }); - - } - - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} +//Converts radians to degrees +var convertToDegrees = radians => (radians * 180) / Math.PI; + +//Finds the max value in a 2d array like mags +var findMaxInMatrix = arr => Math.max(...arr.map(el => el.map(val => !!val ? val : 0)).map(el => Math.max(...el))); + +//Applies the double threshold to the image +function doubleThreshold(pixels, highThresholdRatio, lowThresholdRatio) { + + const highThreshold = findMaxInMatrix(mags) * 0.2; + const lowThreshold = highThreshold * lowThresholdRatio; + + for (let i = 0; i < pixels.shape[0]; i++) { + for (let j = 0; j < pixels.shape[1]; j++) { + let pixelPos = [i, j]; -},{"get-pixels":23,"jsqr":61}],175:[function(require,module,exports){ -arguments[4][147][0].apply(exports,arguments) -},{"./Module":174,"./info.json":176,"dup":147}],176:[function(require,module,exports){ -module.exports={ - "name": "Decode QR", - "description": "Search for and decode a QR code in the image", - "inputs": { - }, - "outputs": { - "qrval": { - "type": "text" - } - } -} + mags[i][j] > lowThreshold + ? mags[i][j] > highThreshold + ? strongEdgePixels.push(pixelPos) + : weakEdgePixels.push(pixelPos) + : pixels.set(i, j, 3, 0); + } + } + + strongEdgePixels.forEach(pix => pixels.set(pix[0], pix[1], 3, 255)); + + return pixels; +} + +// hysteresis edge tracking algorithm -- not working as of now +/* function hysteresis(pixels) { + function getNeighbouringPixelPositions(pixelPosition) { + let x = pixelPosition[0], y = pixelPosition[1] + return [[x + 1, y + 1], + [x + 1, y], + [x + 1, y - 1], + [x, y + 1], + [x, y - 1], + [x - 1, y + 1], + [x - 1, y], + [x - 1, y - 1]] + } + + //This can potentially be improved see https://en.wikipedia.org/wiki/Connected-component_labeling + for (weakPixel in weakEdgePixels) { + let neighbourPixels = getNeighbouringPixelPositions(weakEdgePixels[weakPixel]) + for (pixel in neighbourPixels) { + if (strongEdgePixels.find(el => _.isEqual(el, neighbourPixels[pixel]))) { + pixels.set(weakPixel[0], weakPixel[1], 3, 255) + weakEdgePixels.splice(weakPixel, weakPixel) + break + } + } + } + weakEdgePixels.forEach(pix => pixels.set(pix[0], pix[1], 3, 0)) + return pixels +} */ -},{}],177:[function(require,module,exports){ -module.exports = function Dynamic(options,UI) { - - var output; - - // This function is called on every draw. - function draw(input,callback,progressObj) { - - progressObj.stop(true); - progressObj.overrideFlag = true; - - var step = this; - - // start with monochrome, but if options.red, options.green, and options.blue are set, accept them too - options.monochrome = options.monochrome || "(R+G+B)/3"; - - function generator(expression) { - var func = 'f = function (r, g, b, a) { var R = r, G = g, B = b, A = a;' - func = func + 'return '; - func = func + expression + '}'; - var f; - eval(func); - return f; - } - - var channels = ['red', 'green', 'blue', 'alpha']; - - channels.forEach(function(channel) { - if (options.hasOwnProperty(channel)) options[channel + '_function'] = generator(options[channel]); - else if (channel === 'alpha') options['alpha_function'] = function() { return 255; } - else options[channel + '_function'] = generator(options.monochrome); - }); - - function changePixel(r, g, b, a) { - - /* neighbourpixels can be calculated by - this.getNeighbourPixel.fun(x,y) or this.getNeighborPixel.fun(x,y) - */ - var combined = (r + g + b) / 3.000; - return [ - options.red_function(r, g, b, a), - options.green_function(r, g, b, a), - options.blue_function(r, g, b, a), - options.alpha_function(r, g, b, a), - ]; - } - - /* Functions to get the neighbouring pixel by position (x,y) */ - function getNeighbourPixel(pixels,curX,curY,distX,distY){ - return [ - pixels.get(curX+distX,curY+distY,0) - ,pixels.get(curX+distX,curY+distY,1) - ,pixels.get(curX+distX,curY+distY,2) - ,pixels.get(curX+distX,curY+distY,3) - ] - } - - - function output(image,datauri,mimetype){ - - // This output is accessible by Image Sequencer - step.output = { src: datauri, format: mimetype }; - - } - return require('../_nomodule/PixelManipulation.js')(input, { - output: output, - changePixel: changePixel, - getNeighbourPixel: getNeighbourPixel, - getNeighborPixel: getNeighbourPixel, - format: input.format, - image: options.image, - inBrowser: options.inBrowser, - callback: callback - }); - - } - - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} -},{"../_nomodule/PixelManipulation.js":207}],178:[function(require,module,exports){ -arguments[4][147][0].apply(exports,arguments) -},{"./Module":177,"./info.json":179,"dup":147}],179:[function(require,module,exports){ -module.exports={ - "name": "Dynamic", - "description": "A module which accepts JavaScript math expressions to produce each color channel based on the original image's color. See Infragrammar.", - "inputs": { - "red": { - "type": "input", - "desc": "Expression to return for red channel with R, G, B, and A inputs", - "default": "r" - }, - "green": { - "type": "input", - "desc": "Expression to return for green channel with R, G, B, and A inputs", - "default": "g" - }, - "blue": { - "type": "input", - "desc": "Expression to return for blue channel with R, G, B, and A inputs", - "default": "b" - }, - "monochrome (fallback)": { - "type": "input", - "desc": "Expression to return with R, G, B, and A inputs; fallback for other channels if none provided", - "default": "r + g + b" - } - } -} -},{}],180:[function(require,module,exports){ -const _ = require('lodash') - -//define kernels for the sobel filter -const kernelx = [[-1, 0, 1], [-2, 0, 2], [-1, 0, 1]], - kernely = [[-1, -2, -1], [0, 0, 0], [1, 2, 1]]; - -let angles = [], mags = [], strongEdgePixels = [], weakEdgePixels = [], notInUI; -module.exports = function(pixels, highThresholdRatio, lowThresholdRatio, inBrowser) { - notInUI = !inBrowser; - for (var x = 0; x < pixels.shape[0]; x++) { - angles.push([]); - mags.push([]); - for (var y = 0; y < pixels.shape[1]; y++) { - var result = changePixel( - pixels, - pixels.get(x, y, 0), - pixels.get(x, y, 3), - x, - y - ); - let pixel = result.pixel; - - pixels.set(x, y, 0, pixel[0]); - pixels.set(x, y, 1, pixel[1]); - pixels.set(x, y, 2, pixel[2]); - pixels.set(x, y, 3, pixel[3]); - - mags.slice(-1)[0].push(pixel[3]); - angles.slice(-1)[0].push(result.angle); - } - } - - return doubleThreshold(nonMaxSupress(pixels), highThresholdRatio, lowThresholdRatio); -} - -//changepixel function that convolutes every pixel (sobel filter) -function changePixel(pixels, val, a, x, y) { - let magX = 0.0; - for (let a = 0; a < 3; a++) { - for (let b = 0; b < 3; b++) { - - let xn = x + a - 1; - let yn = y + b - 1; - - magX += pixels.get(xn, yn, 0) * kernelx[a][b]; - } - } - let magY = 0.0; - for (let a = 0; a < 3; a++) { - for (let b = 0; b < 3; b++) { - - let xn = x + a - 1; - let yn = y + b - 1; - - magY += pixels.get(xn, yn, 0) * kernely[a][b]; - } - } - let mag = Math.sqrt(Math.pow(magX, 2) + Math.pow(magY, 2)); - let angle = Math.atan2(magY, magX); - return { - pixel: - [val, val, val, mag], - angle: angle - }; -} - -//Non Maximum Supression without interpolation -function nonMaxSupress(pixels) { - - angles = angles.map((arr) => arr.map(convertToDegrees)); - - for (let i = 1; i < pixels.shape[0] - 1; i++) { - for (let j = 1; j < pixels.shape[1] - 1; j++) { - - let angle = angles[i][j]; - let pixel = pixels.get(i, j); - - if ((angle >= -22.5 && angle <= 22.5) || - (angle < -157.5 && angle >= -180)) - - if ((mags[i][j] >= mags[i][j + 1]) && - (mags[i][j] >= mags[i][j - 1])) - pixels.set(i, j, 3, mags[i][j]); - else - pixels.set(i, j, 3, 0); - - else if ((angle >= 22.5 && angle <= 67.5) || - (angle < -112.5 && angle >= -157.5)) - - if ((mags[i][j] >= mags[i + 1][j + 1]) && - (mags[i][j] >= mags[i - 1][j - 1])) - pixels.set(i, j, 3, mags[i][j]); - else - pixels.set(i, j, 3, 0); - - else if ((angle >= 67.5 && angle <= 112.5) || - (angle < -67.5 && angle >= -112.5)) - - if ((mags[i][i] >= mags[i + 1][j]) && - (mags[i][j] >= mags[i][j])) - pixels.set(i, j, 3, mags[i][j]); - else - pixels.set(i, j, 3, 0); - - else if ((angle >= 112.5 && angle <= 157.5) || - (angle < -22.5 && angle >= -67.5)) - - if ((mags[i][j] >= mags[i + 1][j - 1]) && - (mags[i][j] >= mags[i - 1][j + 1])) - pixels.set(i, j, 3, mags[i][j]); - else - pixels.set(i, j, 3, 0); - - } - } - return pixels; -} -//Converts radians to degrees -var convertToDegrees = radians => (radians * 180) / Math.PI; - -//Finds the max value in a 2d array like mags -var findMaxInMatrix = arr => Math.max(...arr.map(el => el.map(val => !!val ? val : 0)).map(el => Math.max(...el))); - -//Applies the double threshold to the image -function doubleThreshold(pixels, highThresholdRatio, lowThresholdRatio) { - - const highThreshold = findMaxInMatrix(mags) * 0.2; - const lowThreshold = highThreshold * lowThresholdRatio; - - for (let i = 0; i < pixels.shape[0]; i++) { - for (let j = 0; j < pixels.shape[1]; j++) { - let pixelPos = [i, j]; - - mags[i][j] > lowThreshold - ? mags[i][j] > highThreshold - ? strongEdgePixels.push(pixelPos) - : weakEdgePixels.push(pixelPos) - : pixels.set(i, j, 3, 0); - } - } - - strongEdgePixels.forEach(pix => pixels.set(pix[0], pix[1], 3, 255)); - - return pixels; -} - -// hysteresis edge tracking algorithm -- not working as of now -/* function hysteresis(pixels) { - function getNeighbouringPixelPositions(pixelPosition) { - let x = pixelPosition[0], y = pixelPosition[1] - return [[x + 1, y + 1], - [x + 1, y], - [x + 1, y - 1], - [x, y + 1], - [x, y - 1], - [x - 1, y + 1], - [x - 1, y], - [x - 1, y - 1]] - } - - //This can potentially be improved see https://en.wikipedia.org/wiki/Connected-component_labeling - for (weakPixel in weakEdgePixels) { - let neighbourPixels = getNeighbouringPixelPositions(weakEdgePixels[weakPixel]) - for (pixel in neighbourPixels) { - if (strongEdgePixels.find(el => _.isEqual(el, neighbourPixels[pixel]))) { - pixels.set(weakPixel[0], weakPixel[1], 3, 255) - weakEdgePixels.splice(weakPixel, weakPixel) - break - } - } - } - weakEdgePixels.forEach(pix => pixels.set(pix[0], pix[1], 3, 0)) - return pixels -} */ - - - },{"lodash":62}],181:[function(require,module,exports){ -/* -* Detect Edges in an Image -*/ -module.exports = function edgeDetect(options,UI) { - - options.blur = options.blur || 2; - options.highThresholdRatio = options.highThresholdRatio||0.2; - options.lowThresholdRatio = options.lowThresholdRatio||0.15; - - var output; - - // The function which is called on every draw. - function draw(input,callback,progressObj) { - - progressObj.stop(true); - progressObj.overrideFlag = true; - - var step = this; - - - // Extra Manipulation function used as an enveloper for applying gaussian blur and Convolution - function extraManipulation(pixels){ - pixels = require('ndarray-gaussian-filter')(pixels,options.blur); - return require('./EdgeUtils')(pixels,options.highThresholdRatio,options.lowThresholdRatio,options.inBrowser); - } - - function changePixel(r, g, b, a) { - return [(r+g+b)/3, (r+g+b)/3, (r+g+b)/3, a]; - } - - function output(image,datauri,mimetype){ - - // This output is accessible by Image Sequencer - step.output = {src:datauri,format:mimetype}; - - } - - return require('../_nomodule/PixelManipulation.js')(input, { - output: output, - changePixel: changePixel, - extraManipulation: extraManipulation, - format: input.format, - image: options.image, - inBrowser: options.inBrowser, - callback: callback - }); - - } - - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} +/* +* Detect Edges in an Image +*/ +module.exports = function edgeDetect(options,UI) { + + options.blur = options.blur || 2; + options.highThresholdRatio = options.highThresholdRatio||0.2; + options.lowThresholdRatio = options.lowThresholdRatio||0.15; + + var output; + + // The function which is called on every draw. + function draw(input,callback,progressObj) { + + progressObj.stop(true); + progressObj.overrideFlag = true; + + var step = this; + + + // Extra Manipulation function used as an enveloper for applying gaussian blur and Convolution + function extraManipulation(pixels){ + pixels = require('ndarray-gaussian-filter')(pixels,options.blur); + return require('./EdgeUtils')(pixels,options.highThresholdRatio,options.lowThresholdRatio,options.inBrowser); + } + + function changePixel(r, g, b, a) { + return [(r+g+b)/3, (r+g+b)/3, (r+g+b)/3, a]; + } + + function output(image,datauri,mimetype){ + + // This output is accessible by Image Sequencer + step.output = {src:datauri,format:mimetype}; + + } + + return require('../_nomodule/PixelManipulation.js')(input, { + output: output, + changePixel: changePixel, + extraManipulation: extraManipulation, + format: input.format, + image: options.image, + inBrowser: options.inBrowser, + callback: callback + }); + + } + + return { + options: options, + draw: draw, + output: output, + UI: UI + } +} },{"../_nomodule/PixelManipulation.js":207,"./EdgeUtils":180,"ndarray-gaussian-filter":67}],182:[function(require,module,exports){ arguments[4][147][0].apply(exports,arguments) },{"./Module":181,"./info.json":183,"dup":147}],183:[function(require,module,exports){ -module.exports={ - "name": "Detect Edges", - "description": "this module detects edges using the Canny method, which first Gaussian blurs the image to reduce noise (amount of blur configurable in settings as `options.blur`), then applies a number of steps to highlight edges, resulting in a greyscale image where the brighter the pixel, the stronger the detected edge. Read more at: https://en.wikipedia.org/wiki/Canny_edge_detector", - "inputs": { - "blur": { - "type": "integer", - "desc": "amount of gaussian blur(Less blur gives more detail, typically 0-5)", - "default": 2 - }, - "highThresholdRatio":{ - "type": "float", - "desc": "The high threshold ratio for the image", - "default": 0.2 - }, - "lowThresholdRatio": { - "type": "float", - "desc": "The low threshold value for the image", - "default": 0.15 - } - } -} +module.exports={ + "name": "Detect Edges", + "description": "this module detects edges using the Canny method, which first Gaussian blurs the image to reduce noise (amount of blur configurable in settings as `options.blur`), then applies a number of steps to highlight edges, resulting in a greyscale image where the brighter the pixel, the stronger the detected edge. Read more at: https://en.wikipedia.org/wiki/Canny_edge_detector", + "inputs": { + "blur": { + "type": "integer", + "desc": "amount of gaussian blur(Less blur gives more detail, typically 0-5)", + "default": 2 + }, + "highThresholdRatio":{ + "type": "float", + "desc": "The high threshold ratio for the image", + "default": 0.2 + }, + "lowThresholdRatio": { + "type": "float", + "desc": "The low threshold value for the image", + "default": 0.15 + } + } +} },{}],184:[function(require,module,exports){ -/* - * Resolves Fisheye Effect - */ -module.exports = function DoNothing(options,UI) { - - var output; - - require('fisheyegl'); - - function draw(input,callback) { - - var step = this; - - if (!options.inBrowser) { // This module is only for browser - this.output = input; - callback(); - } - else { - // Create a canvas, if it doesn't already exist. - if (!document.querySelector('#image-sequencer-canvas')) { - var canvas = document.createElement('canvas'); - canvas.style.display = "none"; - canvas.setAttribute('id','image-sequencer-canvas'); - document.body.append(canvas); - } - else var canvas = document.querySelector('#image-sequencer-canvas'); - - distorter = FisheyeGl({ - selector: "#image-sequencer-canvas" - }); - - // Parse the inputs - options.a = parseFloat(options.a) || distorter.lens.a; - options.b = parseFloat(options.b) || distorter.lens.b; - options.Fx = parseFloat(options.Fx) || distorter.lens.Fx; - options.Fy = parseFloat(options.Fy) || distorter.lens.Fy; - options.scale = parseFloat(options.scale) || distorter.lens.scale; - options.x = parseFloat(options.x) || distorter.fov.x; - options.y = parseFloat(options.y) || distorter.fov.y; - - // Set fisheyegl inputs - distorter.lens.a = options.a; - distorter.lens.b = options.b; - distorter.lens.Fx = options.Fx; - distorter.lens.Fy = options.Fy; - distorter.lens.scale = options.scale; - distorter.fov.x = options.x; - distorter.fov.y = options.y; - - // generate fisheyegl output - distorter.setImage(input.src,function(){ - - // this output is accessible to Image Sequencer - step.output = {src: canvas.toDataURL(), format: input.format}; - - // Tell Image Sequencer and UI that step has been drawn - callback(); - - }); - - } - } - - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} +/* + * Resolves Fisheye Effect + */ +module.exports = function DoNothing(options,UI) { + + var output; + + require('fisheyegl'); + + function draw(input,callback) { + + var step = this; + + if (!options.inBrowser) { // This module is only for browser + this.output = input; + callback(); + } + else { + // Create a canvas, if it doesn't already exist. + if (!document.querySelector('#image-sequencer-canvas')) { + var canvas = document.createElement('canvas'); + canvas.style.display = "none"; + canvas.setAttribute('id','image-sequencer-canvas'); + document.body.append(canvas); + } + else var canvas = document.querySelector('#image-sequencer-canvas'); + + distorter = FisheyeGl({ + selector: "#image-sequencer-canvas" + }); + + // Parse the inputs + options.a = parseFloat(options.a) || distorter.lens.a; + options.b = parseFloat(options.b) || distorter.lens.b; + options.Fx = parseFloat(options.Fx) || distorter.lens.Fx; + options.Fy = parseFloat(options.Fy) || distorter.lens.Fy; + options.scale = parseFloat(options.scale) || distorter.lens.scale; + options.x = parseFloat(options.x) || distorter.fov.x; + options.y = parseFloat(options.y) || distorter.fov.y; + + // Set fisheyegl inputs + distorter.lens.a = options.a; + distorter.lens.b = options.b; + distorter.lens.Fx = options.Fx; + distorter.lens.Fy = options.Fy; + distorter.lens.scale = options.scale; + distorter.fov.x = options.x; + distorter.fov.y = options.y; + + // generate fisheyegl output + distorter.setImage(input.src,function(){ + + // this output is accessible to Image Sequencer + step.output = {src: canvas.toDataURL(), format: input.format}; + + // Tell Image Sequencer and UI that step has been drawn + callback(); + + }); + + } + } + + return { + options: options, + draw: draw, + output: output, + UI: UI + } +} },{"fisheyegl":15}],185:[function(require,module,exports){ arguments[4][147][0].apply(exports,arguments) },{"./Module":184,"./info.json":186,"dup":147}],186:[function(require,module,exports){ -module.exports={ - "name": "Fisheye GL", - "description": "Correct fisheye, or barrel distortion, in images (with WebGL -- adapted from fisheye-correction-webgl by @bluemir).", - "requires": [ "webgl" ], - "inputs": { - "a": { - "type": "float", - "desc": "a parameter", - "default": 1, - "min": 1, - "max": 4 - }, - "b": { - "type": "float", - "desc": "b parameter", - "default": 1, - "min": 1, - "max": 4 - }, - "Fx": { - "type": "float", - "desc": "Fx parameter", - "default": 0, - "min": 0, - "max": 4 - }, - "Fy": { - "type": "float", - "desc": "Fy parameter", - "default": 0, - "min": 0, - "max": 4 - }, - "scale": { - "type": "float", - "desc": "Image Scaling", - "default": 1.5, - "min": 0, - "max": 20 - }, - "x": { - "type": "float", - "desc": "FOV x parameter", - "default": 1.5, - "min": 0, - "max": 20 - }, - "y": { - "type": "float", - "desc": "FOV y parameter", - "default": 1.5, - "min": 0, - "max": 20 - }, - "fragmentSrc": { - "type": "PATH", - "desc": "Patht to a WebGL fragment shader file", - "default": "(inbuilt)" - }, - "vertexSrc": { - "type": "PATH", - "desc": "Patht to a WebGL vertex shader file", - "default": "(inbuilt)" - } - } -} +module.exports={ + "name": "Fisheye GL", + "description": "Correct fisheye, or barrel distortion, in images (with WebGL -- adapted from fisheye-correction-webgl by @bluemir).", + "requires": [ "webgl" ], + "inputs": { + "a": { + "type": "float", + "desc": "a parameter", + "default": 1, + "min": 1, + "max": 4 + }, + "b": { + "type": "float", + "desc": "b parameter", + "default": 1, + "min": 1, + "max": 4 + }, + "Fx": { + "type": "float", + "desc": "Fx parameter", + "default": 0, + "min": 0, + "max": 4 + }, + "Fy": { + "type": "float", + "desc": "Fy parameter", + "default": 0, + "min": 0, + "max": 4 + }, + "scale": { + "type": "float", + "desc": "Image Scaling", + "default": 1.5, + "min": 0, + "max": 20 + }, + "x": { + "type": "float", + "desc": "FOV x parameter", + "default": 1.5, + "min": 0, + "max": 20 + }, + "y": { + "type": "float", + "desc": "FOV y parameter", + "default": 1.5, + "min": 0, + "max": 20 + }, + "fragmentSrc": { + "type": "PATH", + "desc": "Patht to a WebGL fragment shader file", + "default": "(inbuilt)" + }, + "vertexSrc": { + "type": "PATH", + "desc": "Patht to a WebGL vertex shader file", + "default": "(inbuilt)" + } + } +} },{}],187:[function(require,module,exports){ (function (Buffer){ -module.exports = function Invert(options, UI) { - - var output; - - // The function which is called on every draw. - function draw(input, callback, progressObj) { - var getPixels = require('get-pixels'); - var savePixels = require('save-pixels'); - - var step = this; - - getPixels(input.src, function(err, pixels) { - - if (err) { - console.log("Bad Image path"); - return; - } - var width = 0; - - for (var i = 0; i < pixels.shape[0]; i++) width++; - - for (var i = 0; i < pixels.shape[0]; i++) { - for (var j = 0; j < pixels.shape[1]; j++) { - let val = (i / width) * 255; - pixels.set(i, j, 0, val); - pixels.set(i, j, 1, val); - pixels.set(i, j, 2, val); - pixels.set(i, j, 3, 255); - } - } - var chunks = []; - var totalLength = 0; - var r = savePixels(pixels, input.format, { quality: 100 }); - - r.on("data", function(chunk) { - totalLength += chunk.length; - chunks.push(chunk); - }); - - r.on("end", function() { - var data = Buffer.concat(chunks, totalLength).toString("base64"); - var datauri = "data:image/" + input.format + ";base64," + data; - output(input.image, datauri, input.format); - callback(); - }); - }); - - function output(image, datauri, mimetype) { - - // This output is accessible by Image Sequencer - step.output = { src: datauri, format: mimetype }; - - } - } - - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} +module.exports = function Invert(options, UI) { + + var output; + + // The function which is called on every draw. + function draw(input, callback, progressObj) { + var getPixels = require('get-pixels'); + var savePixels = require('save-pixels'); + + var step = this; + + getPixels(input.src, function(err, pixels) { + + if (err) { + console.log("Bad Image path"); + return; + } + var width = 0; + + for (var i = 0; i < pixels.shape[0]; i++) width++; + + for (var i = 0; i < pixels.shape[0]; i++) { + for (var j = 0; j < pixels.shape[1]; j++) { + let val = (i / width) * 255; + pixels.set(i, j, 0, val); + pixels.set(i, j, 1, val); + pixels.set(i, j, 2, val); + pixels.set(i, j, 3, 255); + } + } + var chunks = []; + var totalLength = 0; + var r = savePixels(pixels, input.format, { quality: 100 }); + + r.on("data", function(chunk) { + totalLength += chunk.length; + chunks.push(chunk); + }); + + r.on("end", function() { + var data = Buffer.concat(chunks, totalLength).toString("base64"); + var datauri = "data:image/" + input.format + ";base64," + data; + output(input.image, datauri, input.format); + callback(); + }); + }); + + function output(image, datauri, mimetype) { + + // This output is accessible by Image Sequencer + step.output = { src: datauri, format: mimetype }; + + } + } + + return { + options: options, + draw: draw, + output: output, + UI: UI + } +} }).call(this,require("buffer").Buffer) },{"buffer":4,"get-pixels":23,"save-pixels":111}],188:[function(require,module,exports){ arguments[4][147][0].apply(exports,arguments) },{"./Module":187,"./info.json":189,"dup":147}],189:[function(require,module,exports){ -module.exports={ - "name": "Gradient", - "description": "Gives a gradient of the image", - "inputs": {} +module.exports={ + "name": "Gradient", + "description": "Gives a gradient of the image", + "inputs": {} } },{}],190:[function(require,module,exports){ -/* - * Import Image module; this fetches a given remote or local image via URL - * or data-url, and overwrites the current one. It saves the original as - * step.metadata.input for use in future modules such as blending. - * TODO: we could accept an operation for blending like "screen" or "overlay", - * or a function with blend(r1,g1,b1,a1,r2,g2,b2,a2), OR we could simply allow - * subsequent modules to do this blending and keep this one simple. - */ -module.exports = function ImportImageModule(options, UI) { - - options.imageUrl = options.url || "./images/monarch.png"; - - var output, - imgObj = new Image(); - - // we should get UI to return the image thumbnail so we can attach our own UI extensions - - // add our custom in-module html ui: - if (options.step.inBrowser) { - var ui = require('./Ui.js')(options.step, UI); - ui.setup(); - } - - // This function is caled everytime the step has to be redrawn - function draw(input,callback) { - - var step = this; - - step.metadata = step.metadata || {}; - // TODO: develop a standard API method for saving each input state, - // for reference in future steps (for blending, for example) - step.metadata.input = input; - - function onLoad() { - - // This output is accessible to Image Sequencer - step.output = { - src: imgObj.src, - format: options.format - } - - // Tell Image Sequencer that step has been drawn - callback(); - } - - options.format = require('../../util/GetFormat')(options.imageUrl); - imgObj.onload = onLoad; - imgObj.src = options.imageUrl; - - } - - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} +/* + * Import Image module; this fetches a given remote or local image via URL + * or data-url, and overwrites the current one. It saves the original as + * step.metadata.input for use in future modules such as blending. + * TODO: we could accept an operation for blending like "screen" or "overlay", + * or a function with blend(r1,g1,b1,a1,r2,g2,b2,a2), OR we could simply allow + * subsequent modules to do this blending and keep this one simple. + */ +module.exports = function ImportImageModule(options, UI) { + + options.imageUrl = options.url || "./images/monarch.png"; + + var output, + imgObj = new Image(); + + // we should get UI to return the image thumbnail so we can attach our own UI extensions + + // add our custom in-module html ui: + if (options.step.inBrowser) { + var ui = require('./Ui.js')(options.step, UI); + ui.setup(); + } + + // This function is caled everytime the step has to be redrawn + function draw(input,callback) { + + var step = this; + + step.metadata = step.metadata || {}; + // TODO: develop a standard API method for saving each input state, + // for reference in future steps (for blending, for example) + step.metadata.input = input; + + function onLoad() { + + // This output is accessible to Image Sequencer + step.output = { + src: imgObj.src, + format: options.format + } + + // Tell Image Sequencer that step has been drawn + callback(); + } + + options.format = require('../../util/GetFormat')(options.imageUrl); + imgObj.onload = onLoad; + imgObj.src = options.imageUrl; + + } + + return { + options: options, + draw: draw, + output: output, + UI: UI + } +} },{"../../util/GetFormat":211,"./Ui.js":191}],191:[function(require,module,exports){ -// hide on save -module.exports = function ImportImageModuleUi(step, ui) { - - function setup(setImage, onLoad) { - - // generate a unique timestamp based id for the dropzone - var dropzoneId = 'dropzone-import-image-' + step.ID; - - // add a file input listener - var dropZone ='\ -
\ -

\ - Select or drag in an image to overlay.\ -

\ -
\ - \ -
\ -
'; - - // insert into .details area - // TODO: develop API-based consistent way to add UI elements - $(step.ui) - .find('.details') - .prepend(dropZone); - - // setup file input listener - sequencer.setInputStep({ - dropZoneSelector: "#" + dropzoneId, - fileInputSelector: "#" + dropzoneId + " .file-input", - onLoad: function onLoadFromInput(progress) { - var reader = progress.target; - step.options.imageUrl = reader.result; - step.options.url = reader.result; - sequencer.run(); - setUrlHashParameter("steps", sequencer.toString()); - } - }); - - $(step.ui) - .find('.btn-save').on('click', function onClickSave() { - - var src = $(step.ui) - .find('.det input').val(); - step.options.imageUrl = src; - sequencer.run(); - - }); - - } - - return { - setup: setup - } -} +// hide on save +module.exports = function ImportImageModuleUi(step, ui) { + + function setup(setImage, onLoad) { + + // generate a unique timestamp based id for the dropzone + var dropzoneId = 'dropzone-import-image-' + step.ID; + + // add a file input listener + var dropZone ='\ +
\ +

\ + Select or drag in an image to overlay.\ +

\ +
\ + \ +
\ +
'; + + // insert into .details area + // TODO: develop API-based consistent way to add UI elements + $(step.ui) + .find('.details') + .prepend(dropZone); + + // setup file input listener + sequencer.setInputStep({ + dropZoneSelector: "#" + dropzoneId, + fileInputSelector: "#" + dropzoneId + " .file-input", + onLoad: function onLoadFromInput(progress) { + var reader = progress.target; + step.options.imageUrl = reader.result; + step.options.url = reader.result; + sequencer.run(); + setUrlHashParameter("steps", sequencer.toString()); + } + }); + + $(step.ui) + .find('.btn-save').on('click', function onClickSave() { + + var src = $(step.ui) + .find('.det input').val(); + step.options.imageUrl = src; + sequencer.run(); + + }); + + } + + return { + setup: setup + } +} },{}],192:[function(require,module,exports){ arguments[4][147][0].apply(exports,arguments) },{"./Module":190,"./info.json":193,"dup":147}],193:[function(require,module,exports){ -module.exports={ - "name": "Import Image", - "description": "Import a new image and replace the original with it. Future versions may enable a blend mode. Specify an image by URL or by file selector.", - "url": "https://github.com/publiclab/image-sequencer/tree/master/MODULES.md", - "inputs": { - "url": { - "type": "string", - "desc": "URL of image to import", - "default": "./images/monarch.png" - } - } +module.exports={ + "name": "Import Image", + "description": "Import a new image and replace the original with it. Future versions may enable a blend mode. Specify an image by URL or by file selector.", + "url": "https://github.com/publiclab/image-sequencer/tree/master/MODULES.md", + "inputs": { + "url": { + "type": "string", + "desc": "URL of image to import", + "default": "./images/monarch.png" + } + } } },{}],194:[function(require,module,exports){ -/* - * Sample Meta Module for demonstration purpose only - */ -module.exports = function NdviColormapfunction() { - this.expandSteps([{ 'name': 'ndvi', 'options': {} }, { 'name': 'colormap', options: {} }]); - return { - isMeta: true - } +/* + * NDVI with red filter (blue channel is infrared) + */ +module.exports = function Ndvi(options, UI) { + + if (options.step.inBrowser) var ui = require('./Ui.js')(options.step, UI); + + options.filter = options.filter || "red"; + + var output; + + // The function which is called on every draw. + function draw(input, callback, progressObj) { + + progressObj.stop(true); + progressObj.overrideFlag = true; + + var step = this; + + function changePixel(r, g, b, a) { + if (options.filter == "red") var ndvi = (b - r) / (1.00 * b + r); + if (options.filter == "blue") var ndvi = (r - b) / (1.00 * b + r); + var x = 255 * (ndvi + 1) / 2; + return [x, x, x, a]; + } + + function output(image, datauri, mimetype) { + + // This output is accessible by Image Sequencer + step.output = { src: datauri, format: mimetype }; + + } + + function modifiedCallback() { + if (options.step.inBrowser) { + ui.setup(); + } + callback(); + } + + return require('../_nomodule/PixelManipulation.js')(input, { + output: output, + changePixel: changePixel, + format: input.format, + image: options.image, + inBrowser: options.inBrowser, + callback: modifiedCallback + }); + + } + + return { + options: options, + draw: draw, + output: output, + UI: UI + } } -},{}],195:[function(require,module,exports){ -arguments[4][147][0].apply(exports,arguments) -},{"./Module":194,"./info.json":196,"dup":147}],196:[function(require,module,exports){ -module.exports={ - "name": "NDVI-Colormap", - "description": "Sequentially Applies NDVI and Colormap steps", - "inputs": {}, - "length": 2 -} -},{}],197:[function(require,module,exports){ -/* - * NDVI with red filter (blue channel is infrared) - */ -module.exports = function Ndvi(options, UI) { - - if (options.step.inBrowser) var ui = require('./Ui.js')(options.step, UI); - - options.filter = options.filter || "red"; - - var output; - - // The function which is called on every draw. - function draw(input, callback, progressObj) { - - progressObj.stop(true); - progressObj.overrideFlag = true; - - var step = this; - - function changePixel(r, g, b, a) { - if (options.filter == "red") var ndvi = (b - r) / (1.00 * b + r); - if (options.filter == "blue") var ndvi = (r - b) / (1.00 * b + r); - var x = 255 * (ndvi + 1) / 2; - return [x, x, x, a]; - } - - function output(image, datauri, mimetype) { - - // This output is accessible by Image Sequencer - step.output = { src: datauri, format: mimetype }; - - } - - function modifiedCallback() { - if (options.step.inBrowser) { - ui.setup(); - } - callback(); - } - - return require('../_nomodule/PixelManipulation.js')(input, { - output: output, - changePixel: changePixel, - format: input.format, - image: options.image, - inBrowser: options.inBrowser, - callback: modifiedCallback - }); - - } - - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} -},{"../_nomodule/PixelManipulation.js":207,"./Ui.js":198}],198:[function(require,module,exports){ -// hide on save -module.exports = function CropModuleUi(step, ui) { - - /* sets the pixel value under the mouse pointer - * on the title attribute of the image element. - */ - function setup() { - var ndviImage = $(imgEl()); - - ndviImage.mousemove(function ndviMousemove(e) { - - var canvas = document.createElement("canvas"); - canvas.width = ndviImage.width(); - canvas.height = ndviImage.height(); - canvas.getContext('2d').drawImage(this, 0, 0); - - var offset = $(this).offset(); - var xPos = e.pageX - offset.left; - var yPos = e.pageY - offset.top; - var ndvi = canvas.getContext('2d').getImageData(xPos, yPos, 1, 1).data[0]; - ndvi = ndvi/127.5 - 1 ; - ndvi = ndvi.toFixed(2); - ndviImage[0].title = "NDVI: " + ndvi; - }); - } - // step.imgSelector is not defined, imgElement is: - function imgEl() { - return step.imgElement; - } - - return { - setup: setup - } -} +},{"../_nomodule/PixelManipulation.js":207,"./Ui.js":195}],195:[function(require,module,exports){ +// hide on save +module.exports = function CropModuleUi(step, ui) { -},{}],199:[function(require,module,exports){ + /* sets the pixel value under the mouse pointer + * on the title attribute of the image element. + */ + function setup() { + var ndviImage = $(imgEl()); + + ndviImage.mousemove(function ndviMousemove(e) { + + var canvas = document.createElement("canvas"); + canvas.width = ndviImage.width(); + canvas.height = ndviImage.height(); + canvas.getContext('2d').drawImage(this, 0, 0); + + var offset = $(this).offset(); + var xPos = e.pageX - offset.left; + var yPos = e.pageY - offset.top; + var ndvi = canvas.getContext('2d').getImageData(xPos, yPos, 1, 1).data[0]; + ndvi = ndvi/127.5 - 1 ; + ndvi = ndvi.toFixed(2); + ndviImage[0].title = "NDVI: " + ndvi; + }); + } + // step.imgSelector is not defined, imgElement is: + function imgEl() { + return step.imgElement; + } + + return { + setup: setup + } +} + +},{}],196:[function(require,module,exports){ arguments[4][147][0].apply(exports,arguments) -},{"./Module":197,"./info.json":200,"dup":147}],200:[function(require,module,exports){ -module.exports={ - "name": "NDVI", - "description": "Normalized Difference Vegetation Index, or NDVI, is an image analysis technique used with aerial photography. It's a way to visualize the amounts of infrared and other wavelengths of light reflected from vegetation by comparing ratios of blue and red light absorbed versus green and IR light reflected. NDVI is used to evaluate the health of vegetation in satellite imagery, where it correlates with how much photosynthesis is happening. This is helpful in assessing vegetative health or stress. Read more.

This is designed for use with red-filtered single camera DIY Infragram cameras; change to 'blue' for blue filters", - "inputs": { - "filter": { - "type": "select", - "desc": "Filter color", - "default": "red", - "values": ["red", "blue"] - } - } -} +},{"./Module":194,"./info.json":197,"dup":147}],197:[function(require,module,exports){ +module.exports={ + "name": "NDVI", + "description": "Normalized Difference Vegetation Index, or NDVI, is an image analysis technique used with aerial photography. It's a way to visualize the amounts of infrared and other wavelengths of light reflected from vegetation by comparing ratios of blue and red light absorbed versus green and IR light reflected. NDVI is used to evaluate the health of vegetation in satellite imagery, where it correlates with how much photosynthesis is happening. This is helpful in assessing vegetative health or stress. Read more.

This is designed for use with red-filtered single camera DIY Infragram cameras; change to 'blue' for blue filters", + "inputs": { + "filter": { + "type": "select", + "desc": "Filter color", + "default": "red", + "values": ["red", "blue"] + } + } +} +},{}],198:[function(require,module,exports){ +/* + * Sample Meta Module for demonstration purpose only + */ +module.exports = function NdviColormapfunction() { + this.expandSteps([{ 'name': 'ndvi', 'options': {} }, { 'name': 'colormap', options: {} }]); + return { + isMeta: true + } +} +},{}],199:[function(require,module,exports){ +arguments[4][147][0].apply(exports,arguments) +},{"./Module":198,"./info.json":200,"dup":147}],200:[function(require,module,exports){ +module.exports={ + "name": "NDVI-Colormap", + "description": "Sequentially Applies NDVI and Colormap steps", + "inputs": {}, + "length": 2 +} },{}],201:[function(require,module,exports){ -module.exports = function Dynamic(options, UI, util) { - - options.x = options.x || 0; - options.y = options.y || 0; - - var output; - - // This function is called on every draw. - function draw(input, callback, progressObj) { - - options.offset = options.offset || -2; - - progressObj.stop(true); - progressObj.overrideFlag = true; - - var step = this; - - // save the pixels of the base image - var baseStepImage = this.getStep(options.offset).image; - var baseStepOutput = this.getOutput(options.offset); - - var getPixels = require('get-pixels'); - - getPixels(input.src, function(err, pixels) { - options.secondImagePixels = pixels; - - function changePixel(r1, g1, b1, a1, x, y) { - - // overlay - var p = options.secondImagePixels; - if (x >= options.x - && x < p.shape[0] - && y >= options.y - && y < p.shape[1]) - return [ - p.get(x, y, 0), - p.get(x, y, 1), - p.get(x, y, 2), - p.get(x, y, 3) - ]; - else - return [r1, g1, b1, a1]; - } - - function output(image, datauri, mimetype) { - - // This output is accessible by Image Sequencer - step.output = { src: datauri, format: mimetype }; - - } - - // run PixelManipulation on first Image pixels - return require('../_nomodule/PixelManipulation.js')(baseStepOutput, { - output: output, - changePixel: changePixel, - format: baseStepOutput.format, - image: baseStepImage, - inBrowser: options.inBrowser, - callback: callback - }); - }); - } - - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} +module.exports = function Dynamic(options, UI, util) { + + options.x = options.x || 0; + options.y = options.y || 0; + + var output; + + // This function is called on every draw. + function draw(input, callback, progressObj) { + + options.offset = options.offset || -2; + + progressObj.stop(true); + progressObj.overrideFlag = true; + + var step = this; + + // save the pixels of the base image + var baseStepImage = this.getStep(options.offset).image; + var baseStepOutput = this.getOutput(options.offset); + + var getPixels = require('get-pixels'); + + getPixels(input.src, function(err, pixels) { + options.secondImagePixels = pixels; + + function changePixel(r1, g1, b1, a1, x, y) { + + // overlay + var p = options.secondImagePixels; + if (x >= options.x + && x < p.shape[0] + && y >= options.y + && y < p.shape[1]) + return [ + p.get(x, y, 0), + p.get(x, y, 1), + p.get(x, y, 2), + p.get(x, y, 3) + ]; + else + return [r1, g1, b1, a1]; + } + + function output(image, datauri, mimetype) { + + // This output is accessible by Image Sequencer + step.output = { src: datauri, format: mimetype }; + + } + + // run PixelManipulation on first Image pixels + return require('../_nomodule/PixelManipulation.js')(baseStepOutput, { + output: output, + changePixel: changePixel, + format: baseStepOutput.format, + image: baseStepImage, + inBrowser: options.inBrowser, + callback: callback + }); + }); + } + + return { + options: options, + draw: draw, + output: output, + UI: UI + } +} + +},{"../_nomodule/PixelManipulation.js":207,"get-pixels":23}],202:[function(require,module,exports){ +arguments[4][147][0].apply(exports,arguments) +},{"./Module":201,"./info.json":203,"dup":147}],203:[function(require,module,exports){ +module.exports={ + "name": "Overlay", + "description": "Overlays an Image over another at a given position(x,y)", + "inputs": { + "x": { + "type": "integer", + "desc": "X-position of the image on which the new image is overlayed", + "default": 0 + }, + "y": { + "type": "integer", + "desc": "Y-position of the image on which the new image is overlayed", + "default": 0 + }, + "offset": { + "type": "integer", + "desc": "offset to the output of the step on which the output of the last step is overlayed", + "default": -2 + } + } +} +},{}],204:[function(require,module,exports){ +/* + * Saturate an image with a value from 0 to 1 + */ +module.exports = function Saturation(options,UI) { + + var output; + + function draw(input,callback,progressObj) { + + progressObj.stop(true); + progressObj.overrideFlag = true; + + var step = this; + + function changePixel(r, g, b, a) { + + var cR = 0.299; + var cG = 0.587; + var cB = 0.114; + + var p = Math.sqrt((cR * (r*r)) + (cG * (g*g)) + (cB * (g*g))); + + r = p+(r-p)*(options.saturation); + g = p+(g-p)*(options.saturation); + b = p+(b-p)*(options.saturation); + + + return [Math.round(r), Math.round(g), Math.round(b), a]; + } + + function output(image,datauri,mimetype){ + + // This output is accesible by Image Sequencer + step.output = {src:datauri,format:mimetype}; + + } + + return require('../_nomodule/PixelManipulation.js')(input, { + output: output, + changePixel: changePixel, + format: input.format, + image: options.image, + inBrowser: options.inBrowser, + callback: callback + }); -},{"../_nomodule/PixelManipulation.js":207,"get-pixels":23}],202:[function(require,module,exports){ -arguments[4][147][0].apply(exports,arguments) -},{"./Module":201,"./info.json":203,"dup":147}],203:[function(require,module,exports){ -module.exports={ - "name": "Overlay", - "description": "Overlays an Image over another at a given position(x,y)", - "inputs": { - "x": { - "type": "integer", - "desc": "X-position of the image on which the new image is overlayed", - "default": 0 - }, - "y": { - "type": "integer", - "desc": "Y-position of the image on which the new image is overlayed", - "default": 0 - }, - "offset": { - "type": "integer", - "desc": "offset to the output of the step on which the output of the last step is overlayed", - "default": -2 - } - } + } + + return { + options: options, + //setup: setup, // optional + draw: draw, + output: output, + UI: UI + } } -},{}],204:[function(require,module,exports){ -/* - * Saturate an image with a value from 0 to 1 - */ -module.exports = function Saturation(options,UI) { - - var output; - - function draw(input,callback,progressObj) { - - progressObj.stop(true); - progressObj.overrideFlag = true; - - var step = this; - - function changePixel(r, g, b, a) { - - var cR = 0.299; - var cG = 0.587; - var cB = 0.114; - - var p = Math.sqrt((cR * (r*r)) + (cG * (g*g)) + (cB * (g*g))); - - r = p+(r-p)*(options.saturation); - g = p+(g-p)*(options.saturation); - b = p+(b-p)*(options.saturation); - - - return [Math.round(r), Math.round(g), Math.round(b), a]; - } - - function output(image,datauri,mimetype){ - - // This output is accesible by Image Sequencer - step.output = {src:datauri,format:mimetype}; - - } - - return require('../_nomodule/PixelManipulation.js')(input, { - output: output, - changePixel: changePixel, - format: input.format, - image: options.image, - inBrowser: options.inBrowser, - callback: callback - }); - - } - - return { - options: options, - //setup: setup, // optional - draw: draw, - output: output, - UI: UI - } -} },{"../_nomodule/PixelManipulation.js":207}],205:[function(require,module,exports){ arguments[4][147][0].apply(exports,arguments) },{"./Module":204,"./info.json":206,"dup":147}],206:[function(require,module,exports){ -module.exports={ - "name": "Saturation", - "description": "Change the saturation of the image by given value, from 0-1, with 1 being 100% saturated.", - "inputs": { - "saturation": { - "type": "integer", - "desc": "saturation for the new image between 0 and 2, 0 being black and white and 2 being highly saturated", - "default": 0 - } - } -} +module.exports={ + "name": "Saturation", + "description": "Change the saturation of the image by given value, from 0-1, with 1 being 100% saturated.", + "inputs": { + "saturation": { + "type": "integer", + "desc": "saturation for the new image between 0 and 2, 0 being black and white and 2 being highly saturated", + "default": 0 + } + } +} },{}],207:[function(require,module,exports){ (function (process,Buffer){ -/* -* General purpose per-pixel manipulation -* accepting a changePixel() method to remix a pixel's channels -*/ -module.exports = function PixelManipulation(image, options) { - - // To handle the case where pixelmanipulation is called on the input object itself - // like input.pixelManipulation(options) - if(arguments.length <= 1){ - options = image; - image = this; - } - - options = options || {}; - options.changePixel = - options.changePixel || - function changePixel(r, g, b, a) { - return [r, g, b, a]; - }; - - // - options.extraManipulation = - options.extraManipulation || - function extraManipulation(pixels) { - return pixels; - }; - - var getPixels = require("get-pixels"), - savePixels = require("save-pixels"); - - getPixels(image.src, function (err, pixels) { - if (err) { - console.log("Bad image path", image); - return; - } - - if (options.getNeighbourPixel) { - options.getNeighbourPixel.fun = function getNeighborPixel(distX, distY) { - return options.getNeighbourPixel(pixels, x, y, distX, distY); - }; - } - - // iterate through pixels; - // TODO: this could possibly be more efficient; see - // https://github.com/p-v-o-s/infragram-js/blob/master/public/infragram.js#L173-L181 - - if (!options.inBrowser && !process.env.TEST) { - try { - var pace = require("pace")(pixels.shape[0] * pixels.shape[1]); - } catch (e) { - options.inBrowser = true; - } - } - - for (var x = 0; x < pixels.shape[0]; x++) { - for (var y = 0; y < pixels.shape[1]; y++) { - var pixel = options.changePixel( - pixels.get(x, y, 0), - pixels.get(x, y, 1), - pixels.get(x, y, 2), - pixels.get(x, y, 3), - x, - y - ); - - pixels.set(x, y, 0, pixel[0]); - pixels.set(x, y, 1, pixel[1]); - pixels.set(x, y, 2, pixel[2]); - pixels.set(x, y, 3, pixel[3]); - - if (!options.inBrowser && !process.env.TEST) pace.op(); - } - } - - // perform any extra operations on the entire array: - if (options.extraManipulation) pixels = options.extraManipulation(pixels); - - // there may be a more efficient means to encode an image object, - // but node modules and their documentation are essentially arcane on this point - var chunks = []; - var totalLength = 0; - var r = savePixels(pixels, options.format, { quality: 100 }); - - r.on("data", function (chunk) { - totalLength += chunk.length; - chunks.push(chunk); - }); - - r.on("end", function () { - var data = Buffer.concat(chunks, totalLength).toString("base64"); - var datauri = "data:image/" + options.format + ";base64," + data; - if (options.output) - options.output(options.image, datauri, options.format); - if (options.callback) options.callback(); - }); - }); -}; +/* +* General purpose per-pixel manipulation +* accepting a changePixel() method to remix a pixel's channels +*/ +module.exports = function PixelManipulation(image, options) { + + // To handle the case where pixelmanipulation is called on the input object itself + // like input.pixelManipulation(options) + if(arguments.length <= 1){ + options = image; + image = this; + } + + options = options || {}; + options.changePixel = + options.changePixel || + function changePixel(r, g, b, a) { + return [r, g, b, a]; + }; + + // + options.extraManipulation = + options.extraManipulation || + function extraManipulation(pixels) { + return pixels; + }; + + var getPixels = require("get-pixels"), + savePixels = require("save-pixels"); + + getPixels(image.src, function (err, pixels) { + if (err) { + console.log("Bad image path", image); + return; + } + + if (options.getNeighbourPixel) { + options.getNeighbourPixel.fun = function getNeighborPixel(distX, distY) { + return options.getNeighbourPixel(pixels, x, y, distX, distY); + }; + } + + // iterate through pixels; + // TODO: this could possibly be more efficient; see + // https://github.com/p-v-o-s/infragram-js/blob/master/public/infragram.js#L173-L181 + + if (!options.inBrowser && !process.env.TEST) { + try { + var pace = require("pace")(pixels.shape[0] * pixels.shape[1]); + } catch (e) { + options.inBrowser = true; + } + } + + for (var x = 0; x < pixels.shape[0]; x++) { + for (var y = 0; y < pixels.shape[1]; y++) { + var pixel = options.changePixel( + pixels.get(x, y, 0), + pixels.get(x, y, 1), + pixels.get(x, y, 2), + pixels.get(x, y, 3), + x, + y + ); + + pixels.set(x, y, 0, pixel[0]); + pixels.set(x, y, 1, pixel[1]); + pixels.set(x, y, 2, pixel[2]); + pixels.set(x, y, 3, pixel[3]); + + if (!options.inBrowser && !process.env.TEST) pace.op(); + } + } + + // perform any extra operations on the entire array: + if (options.extraManipulation) pixels = options.extraManipulation(pixels); + + // there may be a more efficient means to encode an image object, + // but node modules and their documentation are essentially arcane on this point + var chunks = []; + var totalLength = 0; + var r = savePixels(pixels, options.format, { quality: 100 }); + + r.on("data", function (chunk) { + totalLength += chunk.length; + chunks.push(chunk); + }); + + r.on("end", function () { + var data = Buffer.concat(chunks, totalLength).toString("base64"); + var datauri = "data:image/" + options.format + ";base64," + data; + if (options.output) + options.output(options.image, datauri, options.format); + if (options.callback) options.callback(); + }); + }); +}; }).call(this,require('_process'),require("buffer").Buffer) },{"_process":98,"buffer":4,"get-pixels":23,"pace":74,"save-pixels":111}],208:[function(require,module,exports){ -// special module to load an image into the start of the sequence; used in the HTML UI -function LoadImage(ref, name, src, main_callback) { - function makeImage(datauri) { - var image = { - src: datauri, - format: datauri.split(':')[1].split(';')[0].split('/')[1] - } - return image; - } - function CImage(src, callback) { - var datauri; - if (!!src.match(/^data:/i)) { - datauri = src; - callback(datauri); - } - else if (!ref.options.inBrowser && !!src.match(/^https?:\/\//i)) { - require( src.match(/^(https?):\/\//i)[1] ).get(src,function(res){ - var data = ''; - var contentType = res.headers['content-type']; - res.setEncoding('base64'); - res.on('data',function(chunk) {data += chunk;}); - res.on('end',function() { - callback("data:"+contentType+";base64,"+data); - }); - }); - } - else if (ref.options.inBrowser) { - var ext = src.split('.').pop(); - var image = document.createElement('img'); - var canvas = document.createElement('canvas'); - var context = canvas.getContext('2d'); - image.onload = function() { - canvas.width = image.naturalWidth; - canvas.height = image.naturalHeight; - context.drawImage(image,0,0); - datauri = canvas.toDataURL(ext); - callback(datauri); - } - image.src = src; - } - else { - datauri = require('urify')(src); - callback(datauri); - } - } - - function loadImage(name, src) { - var step = { - name: "load-image", - description: "This initial step loads and displays the original image without any modifications.

To work with a new or different image, drag one into the drop zone.", - ID: ref.options.sequencerCounter++, - imageName: name, - inBrowser: ref.options.inBrowser, - ui: ref.options.ui - }; - - var image = { - src: src, - steps: [{ - options: { - id: step.ID, - name: "load-image", - description: "This initial step loads and displays the original image without any modifications.", - title: "Load Image", - step: step - }, - UI: ref.events, - draw: function() { - UI.onDraw(options.step); - if(arguments.length==1){ - this.output = CImage(arguments[0]); - options.step.output = this.output; - UI.onComplete(options.step); - return true; - } - else if(arguments.length==2) { - this.output = CImage(arguments[0]); - options.step.output = this.output; - arguments[1](); - UI.onComplete(options.step); - return true; - } - return false; - }, - }] - }; - CImage(src, function(datauri) { - var output = makeImage(datauri); - ref.images[name] = image; - var loadImageStep = ref.images[name].steps[0]; - loadImageStep.output = output; - loadImageStep.options.step.output = loadImageStep.output.src; - loadImageStep.UI.onSetup(loadImageStep.options.step); - loadImageStep.UI.onDraw(loadImageStep.options.step); - loadImageStep.UI.onComplete(loadImageStep.options.step); - - main_callback(); - return true; - }); - } - - return loadImage(name,src); -} - -module.exports = LoadImage; +// special module to load an image into the start of the sequence; used in the HTML UI +function LoadImage(ref, name, src, main_callback) { + function makeImage(datauri) { + var image = { + src: datauri, + format: datauri.split(':')[1].split(';')[0].split('/')[1] + } + return image; + } + function CImage(src, callback) { + var datauri; + if (!!src.match(/^data:/i)) { + datauri = src; + callback(datauri); + } + else if (!ref.options.inBrowser && !!src.match(/^https?:\/\//i)) { + require( src.match(/^(https?):\/\//i)[1] ).get(src,function(res){ + var data = ''; + var contentType = res.headers['content-type']; + res.setEncoding('base64'); + res.on('data',function(chunk) {data += chunk;}); + res.on('end',function() { + callback("data:"+contentType+";base64,"+data); + }); + }); + } + else if (ref.options.inBrowser) { + var ext = src.split('.').pop(); + var image = document.createElement('img'); + var canvas = document.createElement('canvas'); + var context = canvas.getContext('2d'); + image.onload = function() { + canvas.width = image.naturalWidth; + canvas.height = image.naturalHeight; + context.drawImage(image,0,0); + datauri = canvas.toDataURL(ext); + callback(datauri); + } + image.src = src; + } + else { + datauri = require('urify')(src); + callback(datauri); + } + } + + function loadImage(name, src) { + var step = { + name: "load-image", + description: "This initial step loads and displays the original image without any modifications.

To work with a new or different image, drag one into the drop zone.", + ID: ref.options.sequencerCounter++, + imageName: name, + inBrowser: ref.options.inBrowser, + ui: ref.options.ui + }; + + var image = { + src: src, + steps: [{ + options: { + id: step.ID, + name: "load-image", + description: "This initial step loads and displays the original image without any modifications.", + title: "Load Image", + step: step + }, + UI: ref.events, + draw: function() { + UI.onDraw(options.step); + if(arguments.length==1){ + this.output = CImage(arguments[0]); + options.step.output = this.output; + UI.onComplete(options.step); + return true; + } + else if(arguments.length==2) { + this.output = CImage(arguments[0]); + options.step.output = this.output; + arguments[1](); + UI.onComplete(options.step); + return true; + } + return false; + }, + }] + }; + CImage(src, function(datauri) { + var output = makeImage(datauri); + ref.images[name] = image; + var loadImageStep = ref.images[name].steps[0]; + loadImageStep.output = output; + loadImageStep.options.step.output = loadImageStep.output.src; + loadImageStep.UI.onSetup(loadImageStep.options.step); + loadImageStep.UI.onDraw(loadImageStep.options.step); + loadImageStep.UI.onComplete(loadImageStep.options.step); + + main_callback(); + return true; + }); + } + + return loadImage(name,src); +} + +module.exports = LoadImage; },{"urify":132}],209:[function(require,module,exports){ -// TODO: potentially move this into ImportImage module -function setInputStepInit() { - - return function setInputStep(options) { - - var dropzone = $(options.dropZoneSelector); - var fileInput = $(options.fileInputSelector); - - var onLoad = options.onLoad; - - var reader = new FileReader(); - - function handleFile(e) { - - e.preventDefault(); - e.stopPropagation(); // stops the browser from redirecting. - - if (e.target && e.target.files) var file = e.target.files[0]; - else var file = e.dataTransfer.files[0]; - if(!file) return; - - var reader = new FileReader(); - - reader.onload = onLoad; - - reader.readAsDataURL(file); - } - - fileInput.on('change', handleFile); - - dropzone[0].addEventListener('drop', handleFile, false); - - dropzone.on('dragover', function onDragover(e) { - e.stopPropagation(); - e.preventDefault(); - e.dataTransfer.dropEffect = 'copy'; // Explicitly show this is a copy. - }, false); - - dropzone.on('dragenter', function onDragEnter(e) { - dropzone.addClass('hover'); - }); - - dropzone.on('dragleave', function onDragLeave(e) { - dropzone.removeClass('hover'); - }); - - } - -} -module.exports = setInputStepInit; +// TODO: potentially move this into ImportImage module +function setInputStepInit() { + + return function setInputStep(options) { + + var dropzone = $(options.dropZoneSelector); + var fileInput = $(options.fileInputSelector); + + var onLoad = options.onLoad; + + var reader = new FileReader(); + + function handleFile(e) { + + e.preventDefault(); + e.stopPropagation(); // stops the browser from redirecting. + + if (e.target && e.target.files) var file = e.target.files[0]; + else var file = e.dataTransfer.files[0]; + if(!file) return; + + var reader = new FileReader(); + + reader.onload = onLoad; + + reader.readAsDataURL(file); + } + + fileInput.on('change', handleFile); + + dropzone[0].addEventListener('drop', handleFile, false); + + dropzone.on('dragover', function onDragover(e) { + e.stopPropagation(); + e.preventDefault(); + e.dataTransfer.dropEffect = 'copy'; // Explicitly show this is a copy. + }, false); + + dropzone.on('dragenter', function onDragEnter(e) { + dropzone.addClass('hover'); + }); + + dropzone.on('dragleave', function onDragLeave(e) { + dropzone.removeClass('hover'); + }); + + } + +} +module.exports = setInputStepInit; },{}],210:[function(require,module,exports){ -/* - * User Interface Handling Module - */ - -module.exports = function UserInterface(events = {}) { - - events.onSetup = events.onSetup || function(step) { - if (step.ui == false) { - // No UI - } else if(step.inBrowser) { - // Create and append an HTML Element - console.log("Added Step \""+step.name+"\" to \""+step.imageName+"\"."); - } else { - // Create a NodeJS Object - console.log('\x1b[36m%s\x1b[0m',"Added Step \""+step.name+"\" to \""+step.imageName+"\"."); - } - } - - events.onDraw = events.onDraw || function(step) { - if (step.ui == false) { - // No UI - } else if(step.inBrowser) { - // Overlay a loading spinner - console.log("Drawing Step \""+step.name+"\" on \""+step.imageName+"\"."); - } else { - // Don't do anything - console.log('\x1b[33m%s\x1b[0m',"Drawing Step \""+step.name+"\" on \""+step.imageName+"\"."); - } - } - - events.onComplete = events.onComplete || function(step) { - if (step.ui == false) { - // No UI - } else if(step.inBrowser) { - // Update the DIV Element - // Hide the laoding spinner - console.log("Drawn Step \""+step.name+"\" on \""+step.imageName+"\"."); - } else { - // Update the NodeJS Object - console.log('\x1b[32m%s\x1b[0m',"Drawn Step \""+step.name+"\" on \""+step.imageName+"\"."); - } - } - - events.onRemove = events.onRemove || function(step) { - if (step.ui == false){ - // No UI - } else if(step.inBrowser) { - // Remove the DIV Element - console.log("Removing Step \""+step.name+"\" of \""+step.imageName+"\"."); - } else { - // Delete the NodeJS Object - console.log('\x1b[31m%s\x1b[0m',"Removing Step \""+step.name+"\" of \""+step.imageName+"\"."); - } - } - - return events; - -} +/* + * User Interface Handling Module + */ + +module.exports = function UserInterface(events = {}) { + + events.onSetup = events.onSetup || function(step) { + if (step.ui == false) { + // No UI + } else if(step.inBrowser) { + // Create and append an HTML Element + console.log("Added Step \""+step.name+"\" to \""+step.imageName+"\"."); + } else { + // Create a NodeJS Object + console.log('\x1b[36m%s\x1b[0m',"Added Step \""+step.name+"\" to \""+step.imageName+"\"."); + } + } + + events.onDraw = events.onDraw || function(step) { + if (step.ui == false) { + // No UI + } else if(step.inBrowser) { + // Overlay a loading spinner + console.log("Drawing Step \""+step.name+"\" on \""+step.imageName+"\"."); + } else { + // Don't do anything + console.log('\x1b[33m%s\x1b[0m',"Drawing Step \""+step.name+"\" on \""+step.imageName+"\"."); + } + } + + events.onComplete = events.onComplete || function(step) { + if (step.ui == false) { + // No UI + } else if(step.inBrowser) { + // Update the DIV Element + // Hide the laoding spinner + console.log("Drawn Step \""+step.name+"\" on \""+step.imageName+"\"."); + } else { + // Update the NodeJS Object + console.log('\x1b[32m%s\x1b[0m',"Drawn Step \""+step.name+"\" on \""+step.imageName+"\"."); + } + } + + events.onRemove = events.onRemove || function(step) { + if (step.ui == false){ + // No UI + } else if(step.inBrowser) { + // Remove the DIV Element + console.log("Removing Step \""+step.name+"\" of \""+step.imageName+"\"."); + } else { + // Delete the NodeJS Object + console.log('\x1b[31m%s\x1b[0m',"Removing Step \""+step.name+"\" of \""+step.imageName+"\"."); + } + } + + return events; + +} },{}],211:[function(require,module,exports){ -/* -* Determine format from a URL or data-url, return "jpg" "png" "gif" etc -* TODO: write a test for this using the examples -*/ -module.exports = function GetFormat(src) { - - var format = undefined; // haha default - - // EXAMPLE: "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAAQABADASIAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAf/xAAUEAEAAAAAAAAAAAAAAAAAAAAA/8QAFQEBAQAAAAAAAAAAAAAAAAAABgj/xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwCdABykX//Z"; - // EXAMPLE: "http://example.com/example.png" - // EXAMPLE: "/example.png" - - if (isDataUrl(src)) { - format = src.split(';')[0].split('/').pop(); - } else { - format = src.split('.').pop(); - } - - function isDataUrl(src) { - return src.substr(0, 10) === "data:image" - } - - format = format.toLowerCase(); - - if (format === "jpeg") format = "jpg"; - - function validateFormat(data){ - let supportedFormats = [ - 'jpg', - 'jpeg', - 'png', - 'gif', - 'canvas', - ]; - return supportedFormats.includes(data); - } - - return validateFormat(format)?format:'jpg'; - -} +/* +* Determine format from a URL or data-url, return "jpg" "png" "gif" etc +* TODO: write a test for this using the examples +*/ +module.exports = function GetFormat(src) { + + var format = undefined; // haha default + + // EXAMPLE: "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAAQABADASIAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAf/xAAUEAEAAAAAAAAAAAAAAAAAAAAA/8QAFQEBAQAAAAAAAAAAAAAAAAAABgj/xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwCdABykX//Z"; + // EXAMPLE: "http://example.com/example.png" + // EXAMPLE: "/example.png" + + if (isDataUrl(src)) { + format = src.split(';')[0].split('/').pop(); + } else { + format = src.split('.').pop(); + } + + function isDataUrl(src) { + return src.substr(0, 10) === "data:image" + } + + format = format.toLowerCase(); + + if (format === "jpeg") format = "jpg"; + + function validateFormat(data){ + let supportedFormats = [ + 'jpg', + 'jpeg', + 'png', + 'gif', + 'canvas', + ]; + return supportedFormats.includes(data); + } + + return validateFormat(format)?format:'jpg'; + +} },{}],212:[function(require,module,exports){ -module.exports = { - getPreviousStep: function() { - return this.getStep(-1); - }, - - getNextStep: function() { - return this.getStep(1); - }, - - getInput: function(offset) { - if (offset + this.getIndex() === 0) offset++; - return this.getStep(offset - 1).output; - }, - - getOutput: function(offset) { - return this.getStep(offset).output; - }, - - getOptions: function() { - return this.getStep(0).options; - }, - - setOptions: function(optionsObj) { - let options = this.getStep(0).options; - for (let key in optionsObj) { - if (options[key]) options[key] = optionsObj[key]; - } - }, - - getFormat: function() { - return this.getStep(-1).output.format; - }, - - getHeight: function(callback) { - let img = new Image(); - img.onload = function() { - callback(img.height); - }; - img.src = this.getInput(0).src; - }, - - getWidth: function(callback) { - let img = new Image(); - img.onload = function() { - callback(img.width); - }; - img.src = this.getInput(0).src; - } +module.exports = { + getPreviousStep: function() { + return this.getStep(-1); + }, + + getNextStep: function() { + return this.getStep(1); + }, + + getInput: function(offset) { + if (offset + this.getIndex() === 0) offset++; + return this.getStep(offset - 1).output; + }, + + getOutput: function(offset) { + return this.getStep(offset).output; + }, + + getOptions: function() { + return this.getStep(0).options; + }, + + setOptions: function(optionsObj) { + let options = this.getStep(0).options; + for (let key in optionsObj) { + if (options[key]) options[key] = optionsObj[key]; + } + }, + + getFormat: function() { + return this.getStep(-1).output.format; + }, + + getHeight: function(callback) { + let img = new Image(); + img.onload = function() { + callback(img.height); + }; + img.src = this.getInput(0).src; + }, + + getWidth: function(callback) { + let img = new Image(); + img.onload = function() { + callback(img.width); + }; + img.src = this.getInput(0).src; + } } },{}]},{},[139]); diff --git a/dist/image-sequencer.min.js b/dist/image-sequencer.min.js index a32730537f..1ce912d013 100644 --- a/dist/image-sequencer.min.js +++ b/dist/image-sequencer.min.js @@ -1 +1 @@ -!function(){return function e(t,n,r){function i(o,s){if(!n[o]){if(!t[o]){var u="function"==typeof require&&require;if(!s&&u)return u(o,!0);if(a)return a(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[o]={exports:{}};t[o][0].call(c.exports,function(e){return i(t[o][1][e]||e)},c,c.exports,e,t,n,r)}return n[o].exports}for(var a="function"==typeof require&&require,o=0;o0?r-4:r,f=0;f>16&255,s[u++]=t>>8&255,s[u++]=255&t;2===o&&(t=i[e.charCodeAt(f)]<<2|i[e.charCodeAt(f+1)]>>4,s[u++]=255&t);1===o&&(t=i[e.charCodeAt(f)]<<10|i[e.charCodeAt(f+1)]<<4|i[e.charCodeAt(f+2)]>>2,s[u++]=t>>8&255,s[u++]=255&t);return s},n.fromByteArray=function(e){for(var t,n=e.length,i=n%3,a=[],o=0,s=n-i;os?s:o+16383));1===i?(t=e[n-1],a.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],a.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return a.join("")};for(var r=[],i=[],a="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=o.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function c(e,t,n){for(var i,a,o=[],s=t;s>18&63]+r[a>>12&63]+r[a>>6&63]+r[63&a]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],2:[function(e,t,n){"use strict";"use restrict";function r(e){var t=32;return(e&=-e)&&t--,65535&e&&(t-=16),16711935&e&&(t-=8),252645135&e&&(t-=4),858993459&e&&(t-=2),1431655765&e&&(t-=1),t}n.INT_BITS=32,n.INT_MAX=2147483647,n.INT_MIN=-1<<31,n.sign=function(e){return(e>0)-(e<0)},n.abs=function(e){var t=e>>31;return(e^t)-t},n.min=function(e,t){return t^(e^t)&-(e65535)<<4,t|=n=((e>>>=t)>255)<<3,t|=n=((e>>>=n)>15)<<2,(t|=n=((e>>>=n)>3)<<1)|(e>>>=n)>>1},n.log10=function(e){return e>=1e9?9:e>=1e8?8:e>=1e7?7:e>=1e6?6:e>=1e5?5:e>=1e4?4:e>=1e3?3:e>=100?2:e>=10?1:0},n.popCount=function(e){return 16843009*((e=(858993459&(e-=e>>>1&1431655765))+(e>>>2&858993459))+(e>>>4)&252645135)>>>24},n.countTrailingZeros=r,n.nextPow2=function(e){return e+=0===e,--e,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,(e|=e>>>16)+1},n.prevPow2=function(e){return e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,(e|=e>>>16)-(e>>>1)},n.parity=function(e){return e^=e>>>16,e^=e>>>8,e^=e>>>4,27030>>>(e&=15)&1};var i=new Array(256);!function(e){for(var t=0;t<256;++t){var n=t,r=t,i=7;for(n>>>=1;n;n>>>=1)r<<=1,r|=1&n,--i;e[t]=r<>>8&255]<<16|i[e>>>16&255]<<8|i[e>>>24&255]},n.interleave2=function(e,t){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e&=65535)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t&=65535)|t<<8))|t<<4))|t<<2))|t<<1))<<1},n.deinterleave2=function(e,t){return(e=65535&((e=16711935&((e=252645135&((e=858993459&((e=e>>>t&1431655765)|e>>>1))|e>>>2))|e>>>4))|e>>>16))<<16>>16},n.interleave3=function(e,t,n){return e=1227133513&((e=3272356035&((e=251719695&((e=4278190335&((e&=1023)|e<<16))|e<<8))|e<<4))|e<<2),(e|=(t=1227133513&((t=3272356035&((t=251719695&((t=4278190335&((t&=1023)|t<<16))|t<<8))|t<<4))|t<<2))<<1)|(n=1227133513&((n=3272356035&((n=251719695&((n=4278190335&((n&=1023)|n<<16))|n<<8))|n<<4))|n<<2))<<2},n.deinterleave3=function(e,t){return(e=1023&((e=4278190335&((e=251719695&((e=3272356035&((e=e>>>t&1227133513)|e>>>2))|e>>>4))|e>>>8))|e>>>16))<<22>>22},n.nextCombination=function(e){var t=e|e-1;return t+1|(~t&-~t)-1>>>r(e)+1}},{}],3:[function(e,t,n){},{}],4:[function(e,t,n){"use strict";var r=e("base64-js"),i=e("ieee754");n.Buffer=s,n.SlowBuffer=function(e){+e!=e&&(e=0);return s.alloc(+e)},n.INSPECT_MAX_BYTES=50;var a=2147483647;function o(e){if(e>a)throw new RangeError("Invalid typed array length");var t=new Uint8Array(e);return t.__proto__=s.prototype,t}function s(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return c(e)}return u(e,t,n)}function u(e,t,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return P(e)?function(e,t,n){if(t<0||e.byteLength=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|e}function p(e,t){if(s.isBuffer(e))return e.length;if(U(e)||P(e))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return D(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return F(e).length;default:if(r)return D(e).length;t=(""+t).toLowerCase(),r=!0}}function d(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function g(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),q(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=s.from(t,r)),s.isBuffer(t))return 0===t.length?-1:v(e,t,n,r,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,r,i){var a,o=1,s=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,s/=2,u/=2,n/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var c=-1;for(a=n;as&&(n=s-u),a=n;a>=0;a--){for(var f=!0,h=0;hi&&(r=i):r=i;var a=t.length;if(a%2!=0)throw new TypeError("Invalid hex string");r>a/2&&(r=a/2);for(var o=0;o>8,i=n%256,a.push(i),a.push(r);return a}(t,e.length-n),e,n,r)}function k(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function E(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i239?4:l>223?3:l>191?2:1;if(i+f<=n)switch(f){case 1:l<128&&(c=l);break;case 2:128==(192&(a=e[i+1]))&&(u=(31&l)<<6|63&a)>127&&(c=u);break;case 3:a=e[i+1],o=e[i+2],128==(192&a)&&128==(192&o)&&(u=(15&l)<<12|(63&a)<<6|63&o)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:a=e[i+1],o=e[i+2],s=e[i+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(u=(15&l)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&u<1114112&&(c=u)}null===c?(c=65533,f=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),i+=f}return function(e){var t=e.length;if(t<=S)return String.fromCharCode.apply(String,e);var n="",r=0;for(;rthis.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,n);case"utf8":case"utf-8":return E(this,t,n);case"ascii":return A(this,t,n);case"latin1":case"binary":return T(this,t,n);case"base64":return k(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}.apply(this,arguments)},s.prototype.equals=function(e){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===s.compare(this,e)},s.prototype.inspect=function(){var e="",t=n.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),""},s.prototype.compare=function(e,t,n,r,i){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var a=(i>>>=0)-(r>>>=0),o=(n>>>=0)-(t>>>=0),u=Math.min(a,o),l=this.slice(r,i),c=e.slice(t,n),f=0;f>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var a=!1;;)switch(r){case"hex":return m(this,e,t,n);case"utf8":case"utf-8":return _(this,e,t,n);case"ascii":return w(this,e,t,n);case"latin1":case"binary":return b(this,e,t,n);case"base64":return y(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,e,t,n);default:if(a)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),a=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var S=4096;function A(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;ir)&&(n=r);for(var i="",a=t;an)throw new RangeError("Trying to access beyond buffer length")}function R(e,t,n,r,i,a){if(!s.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function L(e,t,n,r,i,a){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function B(e,t,n,r,a){return t=+t,n>>>=0,a||L(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function C(e,t,n,r,a){return t=+t,n>>>=0,a||L(e,0,n,8),i.write(e,t,n,r,52,8),n+8}s.prototype.slice=function(e,t){var n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t>>=0,t>>>=0,n||j(e,t,this.length);for(var r=this[e],i=1,a=0;++a>>=0,t>>>=0,n||j(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},s.prototype.readUInt8=function(e,t){return e>>>=0,t||j(e,1,this.length),this[e]},s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||j(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||j(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||j(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||j(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||j(e,t,this.length);for(var r=this[e],i=1,a=0;++a=(i*=128)&&(r-=Math.pow(2,8*t)),r},s.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||j(e,t,this.length);for(var r=t,i=1,a=this[e+--r];r>0&&(i*=256);)a+=this[e+--r]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},s.prototype.readInt8=function(e,t){return e>>>=0,t||j(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||j(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt16BE=function(e,t){e>>>=0,t||j(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||j(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||j(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readFloatLE=function(e,t){return e>>>=0,t||j(e,4,this.length),i.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||j(e,4,this.length),i.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||j(e,8,this.length),i.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||j(e,8,this.length),i.read(this,e,!1,52,8)},s.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t>>>=0,n>>>=0,r)||R(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,a=0;for(this[t]=255&e;++a>>=0,n>>>=0,r)||R(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},s.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,255,0),this[t]=255&e,t+1},s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var i=Math.pow(2,8*n-1);R(this,e,t,n,i-1,-i)}var a=0,o=1,s=0;for(this[t]=255&e;++a>0)-s&255;return t+n},s.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var i=Math.pow(2,8*n-1);R(this,e,t,n,i-1,-i)}var a=n-1,o=1,s=0;for(this[t+a]=255&e;--a>=0&&(o*=256);)e<0&&0===s&&0!==this[t+a+1]&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+n},s.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeFloatLE=function(e,t,n){return B(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return B(this,e,t,!1,n)},s.prototype.writeDoubleLE=function(e,t,n){return C(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return C(this,e,t,!1,n)},s.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(a<1e3)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(a=t;a55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return a}function F(e){return r.toByteArray(function(e){if((e=e.trim().replace(O,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function N(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function P(e){return e instanceof ArrayBuffer||null!=e&&null!=e.constructor&&"ArrayBuffer"===e.constructor.name&&"number"==typeof e.byteLength}function U(e){return"function"==typeof ArrayBuffer.isView&&ArrayBuffer.isView(e)}function q(e){return e!=e}},{"base64-js":1,ieee754:55}],5:[function(e,t,n){(function(n){var r=e("tty"),i=e("./lib/encode"),a=e("stream").Stream,o=t.exports=function(){var e=null;function t(t){if(e)throw new Error("multiple inputs specified");e=t}var i=null;function a(e){if(i)throw new Error("multiple outputs specified");i=e}for(var o=0;o0&&this.down(t),e>0?this.right(e):e<0&&this.left(-e),this},s.prototype.up=function(e){return void 0===e&&(e=1),this.write(i("["+Math.floor(e)+"A")),this},s.prototype.down=function(e){return void 0===e&&(e=1),this.write(i("["+Math.floor(e)+"B")),this},s.prototype.right=function(e){return void 0===e&&(e=1),this.write(i("["+Math.floor(e)+"C")),this},s.prototype.left=function(e){return void 0===e&&(e=1),this.write(i("["+Math.floor(e)+"D")),this},s.prototype.column=function(e){return this.write(i("["+Math.floor(e)+"G")),this},s.prototype.push=function(e){return this.write(i(e?"7":"[s")),this},s.prototype.pop=function(e){return this.write(i(e?"8":"[u")),this},s.prototype.erase=function(e){return"end"===e||"$"===e?this.write(i("[K")):"start"===e||"^"===e?this.write(i("[1K")):"line"===e?this.write(i("[2K")):"down"===e?this.write(i("[J")):"up"===e?this.write(i("[1J")):"screen"===e?this.write(i("[1J")):this.emit("error",new Error("Unknown erase type: "+e)),this},s.prototype.display=function(e){var t={reset:0,bright:1,dim:2,underscore:4,blink:5,reverse:7,hidden:8}[e];return void 0===t&&this.emit("error",new Error("Unknown attribute: "+e)),this.write(i("["+t+"m")),this},s.prototype.foreground=function(e){if("number"==typeof e)(e<0||e>=256)&&this.emit("error",new Error("Color out of range: "+e)),this.write(i("[38;5;"+e+"m"));else{var t={black:30,red:31,green:32,yellow:33,blue:34,magenta:35,cyan:36,white:37}[e.toLowerCase()];t||this.emit("error",new Error("Unknown color: "+e)),this.write(i("["+t+"m"))}return this},s.prototype.background=function(e){if("number"==typeof e)(e<0||e>=256)&&this.emit("error",new Error("Color out of range: "+e)),this.write(i("[48;5;"+e+"m"));else{var t={black:40,red:41,green:42,yellow:43,blue:44,magenta:45,cyan:46,white:47}[e.toLowerCase()];t||this.emit("error",new Error("Unknown color: "+e)),this.write(i("["+t+"m"))}return this},s.prototype.cursor=function(e){return this.write(i(e?"[?25h":"[?25l")),this};var u=o.extractCodes=function(e){for(var t=[],n=-1,r=0;r=0&&t.push(e.slice(n,r)),n=r):n>=0&&r===e.length-1&&t.push(e.slice(n));return t}}).call(this,e("_process"))},{"./lib/encode":6,_process:98,stream:112,tty:129}],6:[function(e,t,n){(function(e){var n=(t.exports=function(t){return new e([27].concat(function e(t){return"string"==typeof t?t.split("").map(n):Array.isArray(t)?t.reduce(function(t,n){return t.concat(e(n))},[]):void 0}(t)))}).ord=function(e){return e.charCodeAt(0)}}).call(this,e("buffer").Buffer)},{buffer:4}],7:[function(e,t,n){(function(n){"use strict";var r=e("readable-stream").Readable,i=e("util");function a(e,t){if(!(this instanceof a))return new a(e,t);r.call(this,t),null==e&&(e=String(e)),this._obj=e}t.exports=a,i.inherits(a,r),a.prototype._read=function(e){var t=this._obj;"string"==typeof t?this.push(new n(t)):n.isBuffer(t)?this.push(t):this.push(new n(JSON.stringify(t))),this.push(null)}}).call(this,e("buffer").Buffer)},{buffer:4,"readable-stream":106,util:135}],8:[function(e,t,n){(function(e){function t(e){return Object.prototype.toString.call(e)}n.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===t(e)},n.isBoolean=function(e){return"boolean"==typeof e},n.isNull=function(e){return null===e},n.isNullOrUndefined=function(e){return null==e},n.isNumber=function(e){return"number"==typeof e},n.isString=function(e){return"string"==typeof e},n.isSymbol=function(e){return"symbol"==typeof e},n.isUndefined=function(e){return void 0===e},n.isRegExp=function(e){return"[object RegExp]"===t(e)},n.isObject=function(e){return"object"==typeof e&&null!==e},n.isDate=function(e){return"[object Date]"===t(e)},n.isError=function(e){return"[object Error]"===t(e)||e instanceof Error},n.isFunction=function(e){return"function"==typeof e},n.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},n.isBuffer=e.isBuffer}).call(this,{isBuffer:e("../../is-buffer/index.js")})},{"../../is-buffer/index.js":59}],9:[function(e,t,n){"use strict";var r=e("./lib/thunk.js");t.exports=function(e){var t=new function(){this.argTypes=[],this.shimArgs=[],this.arrayArgs=[],this.arrayBlockIndices=[],this.scalarArgs=[],this.offsetArgs=[],this.offsetArgIndex=[],this.indexArgs=[],this.shapeArgs=[],this.funcName="",this.pre=null,this.body=null,this.post=null,this.debug=!1};t.pre=e.pre,t.body=e.body,t.post=e.post;var n=e.args.slice(0);t.argTypes=n;for(var i=0;i0)throw new Error("cwise: pre() block may not reference array args");if(i0)throw new Error("cwise: post() block may not reference array args")}else if("scalar"===a)t.scalarArgs.push(i),t.shimArgs.push("scalar"+i);else if("index"===a){if(t.indexArgs.push(i),i0)throw new Error("cwise: pre() block may not reference array index");if(i0)throw new Error("cwise: post() block may not reference array index")}else if("shape"===a){if(t.shapeArgs.push(i),in.length)throw new Error("cwise: Too many arguments in pre() block");if(t.body.args.length>n.length)throw new Error("cwise: Too many arguments in body() block");if(t.post.args.length>n.length)throw new Error("cwise: Too many arguments in post() block");return t.debug=!!e.printCode||!!e.debug,t.funcName=e.funcName||"cwise",t.blockSize=e.blockSize||64,r(t)}},{"./lib/thunk.js":11}],10:[function(e,t,n){"use strict";var r=e("uniq");function i(e,t,n){var r,i,a=e.length,o=t.arrayArgs.length,s=t.indexArgs.length>0,u=[],l=[],c=0,f=0;for(r=0;r0&&u.push("var "+l.join(",")),r=a-1;r>=0;--r)c=e[r],u.push(["for(i",r,"=0;i",r,"0&&u.push(["index[",f,"]-=s",f].join("")),u.push(["++index[",c,"]"].join(""))),u.push("}")}return u.join("\n")}function a(e,t,n){for(var r=e.body,i=[],a=[],o=0;o0&&_.push("shape=SS.slice(0)"),e.indexArgs.length>0){var w=new Array(n);for(u=0;u0&&m.push("var "+_.join(",")),u=0;u3&&m.push(a(e.pre,e,s));var k=a(e.body,e,s),E=function(e){for(var t=0,n=e[0].length;t0,l=[],c=0;c0;){"].join("")),l.push(["if(j",c,"<",s,"){"].join("")),l.push(["s",t[c],"=j",c].join("")),l.push(["j",c,"=0"].join("")),l.push(["}else{s",t[c],"=",s].join("")),l.push(["j",c,"-=",s,"}"].join("")),u&&l.push(["index[",t[c],"]=j",c].join(""));for(c=0;c3&&m.push(a(e.post,e,s)),e.debug&&console.log("-----Generated cwise routine for ",t,":\n"+m.join("\n")+"\n----------");var S=[e.funcName||"unnamed","_cwise_loop_",o[0].join("s"),"m",E,function(e){for(var t=new Array(e.length),n=!0,r=0;r0&&(n=n&&t[r]===t[r-1])}return n?t[0]:t.join("")}(s)].join("");return new Function(["function ",S,"(",v.join(","),"){",m.join("\n"),"} return ",S].join(""))()}},{uniq:131}],11:[function(e,t,n){"use strict";var r=e("./compile.js");t.exports=function(e){var t=["'use strict'","var CACHED={}"],n=[],i=e.funcName+"_cwise_thunk";t.push(["return function ",i,"(",e.shimArgs.join(","),"){"].join(""));for(var a=[],o=[],s=[["array",e.arrayArgs[0],".shape.slice(",Math.max(0,e.arrayBlockIndices[0]),e.arrayBlockIndices[0]<0?","+e.arrayBlockIndices[0]+")":")"].join("")],u=[],l=[],c=0;c0&&(u.push("array"+e.arrayArgs[0]+".shape.length===array"+f+".shape.length+"+(Math.abs(e.arrayBlockIndices[0])-Math.abs(e.arrayBlockIndices[c]))),l.push("array"+e.arrayArgs[0]+".shape[shapeIndex+"+Math.max(0,e.arrayBlockIndices[0])+"]===array"+f+".shape[shapeIndex+"+Math.max(0,e.arrayBlockIndices[c])+"]"))}for(e.arrayArgs.length>1&&(t.push("if (!("+u.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same dimensionality!')"),t.push("for(var shapeIndex=array"+e.arrayArgs[0]+".shape.length-"+Math.abs(e.arrayBlockIndices[0])+"; shapeIndex--\x3e0;) {"),t.push("if (!("+l.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),t.push("}")),c=0;c0)return function(e,t){var n,r;for(n=new Array(e),r=0;r 0.99 || vMapping.x < 0.01 || vMapping.y > 0.99 || vMapping.y < 0.01){\n\t\ttexture = vec4(0.0, 0.0, 0.0, 1.0);\n\t} \n\tgl_FragColor = texture;\n}\n"},{}],18:[function(e,t,n){t.exports="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec4 uLens;\nuniform vec2 uFov;\nuniform sampler2D uSampler;\nvarying vec3 vPosition;\nvarying vec2 vTextureCoord;\nvec2 TextureCoord2GLCoord(vec2 textureCoord) {\n\treturn (textureCoord - vec2(0.5, 0.5)) * 2.0;\n}\nvec2 GLCoord2TextureCoord(vec2 glCoord) {\n\treturn glCoord / 2.0 + vec2(0.5, 0.5);\n}\nvoid main(void){\n\tfloat correctionRadius = 0.5;\n\tfloat distance = sqrt(vPosition.x * vPosition.x + vPosition.y * vPosition.y) / correctionRadius;\n\tfloat theta = 1.0;\n\tif(distance != 0.0){\n\t\ttheta = atan(distance);\n\t}\n\tvec2 vMapping = theta * vPosition.xy;\n\tvMapping = GLCoord2TextureCoord(vMapping);\n\t\t\n\tvec4 texture = texture2D(uSampler, vMapping);\n\tif(vMapping.x > 0.99 || vMapping.x < 0.01 || vMapping.y > 0.99 || vMapping.y < 0.01){\n\t\ttexture = vec4(0.0, 0.0, 0.0, 1.0);\n\t} \n\tgl_FragColor = texture;\n}\n"},{}],19:[function(e,t,n){t.exports="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec3 uLensS;\nuniform vec2 uLensF;\nuniform vec2 uFov;\nuniform sampler2D uSampler;\nvarying vec3 vPosition;\nvarying vec2 vTextureCoord;\nvec2 GLCoord2TextureCoord(vec2 glCoord) {\n\treturn glCoord * vec2(1.0, -1.0)/ 2.0 + vec2(0.5, 0.5);\n}\nvoid main(void){\n\tfloat scale = uLensS.z;\n\tvec3 vPos = vPosition;\n\tfloat Fx = uLensF.x;\n\tfloat Fy = uLensF.y;\n\tvec2 vMapping = vPos.xy;\n\tvMapping.x = vMapping.x + ((pow(vPos.y, 2.0)/scale)*vPos.x/scale)*-Fx;\n\tvMapping.y = vMapping.y + ((pow(vPos.x, 2.0)/scale)*vPos.y/scale)*-Fy;\n\tvMapping = vMapping * uLensS.xy;\n\tvMapping = GLCoord2TextureCoord(vMapping/scale);\n\tvec4 texture = texture2D(uSampler, vMapping);\n\tif(vMapping.x > 0.99 || vMapping.x < 0.01 || vMapping.y > 0.99 || vMapping.y < 0.01){\n\t\ttexture = vec4(0.0, 0.0, 0.0, 1.0);\n\t}\n\tgl_FragColor = texture;\n}\n"},{}],20:[function(e,t,n){t.exports="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec4 uLens;\nuniform vec2 uFov;\nuniform sampler2D uSampler;\nvarying vec3 vPosition;\nvarying vec2 vTextureCoord;\nvec2 TextureCoord2GLCoord(vec2 textureCoord) {\n\treturn (textureCoord - vec2(0.5, 0.5)) * 2.0;\n}\nvec2 GLCoord2TextureCoord(vec2 glCoord) {\n\treturn glCoord / 2.0 + vec2(0.5, 0.5);\n}\nvoid main(void){\n\tvec2 vMapping = vec2(vTextureCoord.x, 1.0 - vTextureCoord.y);\n\tvMapping = TextureCoord2GLCoord(vMapping);\n\t//TODO insert Code\n\tfloat F = uLens.x/ uLens.w;\n\tfloat seta = length(vMapping) / F;\n\tvMapping = sin(seta) * F / length(vMapping) * vMapping;\n\tvMapping *= uLens.w * 1.414;\n\tvMapping = GLCoord2TextureCoord(vMapping);\n\tvec4 texture = texture2D(uSampler, vMapping);\n\tif(vMapping.x > 0.99 || vMapping.x < 0.01 || vMapping.y > 0.99 || vMapping.y < 0.01){\n\t\ttexture = vec4(0.0, 0.0, 0.0, 1.0);\n\t} \n\tgl_FragColor = texture;\n}\n"},{}],21:[function(e,t,n){t.exports="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec4 uLens;\nuniform vec2 uFov;\nuniform sampler2D uSampler;\nvarying vec3 vPosition;\nvarying vec2 vTextureCoord;\nvec2 TextureCoord2GLCoord(vec2 textureCoord) {\n\treturn (textureCoord - vec2(0.5, 0.5)) * 2.0;\n}\nvec2 GLCoord2TextureCoord(vec2 glCoord) {\n\treturn glCoord / 2.0 + vec2(0.5, 0.5);\n}\nvoid main(void){\n\tvec2 vMapping = vec2(vTextureCoord.x, 1.0 - vTextureCoord.y);\n\tvMapping = TextureCoord2GLCoord(vMapping);\n\t//TOD insert Code\n\tfloat F = uLens.x/ uLens.w;\n\tfloat seta = length(vMapping) / F;\n\tvMapping = sin(seta) * F / length(vMapping) * vMapping;\n\tvMapping *= uLens.w * 1.414;\n\tvMapping = GLCoord2TextureCoord(vMapping);\n\tvec4 texture = texture2D(uSampler, vMapping);\n\tif(vMapping.x > 0.99 || vMapping.x < 0.01 || vMapping.y > 0.99 || vMapping.y < 0.01){\n\t\ttexture = vec4(0.0, 0.0, 0.0, 1.0);\n\t} \n\tgl_FragColor = texture;\n}\n"},{}],22:[function(e,t,n){t.exports="#ifdef GL_ES\nprecision highp float;\n#endif\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nvarying vec3 vPosition;\nvarying vec2 vTextureCoord;\nvoid main(void){\n\tvPosition = aVertexPosition;\n\tvTextureCoord = aTextureCoord;\n\tgl_Position = vec4(vPosition,1.0);\n}\n"},{}],23:[function(e,t,n){(function(n,r){"use strict";var i=e("path"),a=e("ndarray"),o=e("omggif").GifReader,s=(e("ndarray-pack"),e("through"),e("data-uri-to-buffer"));function u(e,t){var n;try{n=new o(e)}catch(e){return void t(e)}if(n.numFrames()>0){var r=[n.numFrames(),n.height,n.width,4],i=new Uint8Array(r[0]*r[1]*r[2]*r[3]),s=a(i,r);try{for(var u=0;u=0&&(this.dispose=e)},u.prototype.setRepeat=function(e){this.repeat=e},u.prototype.setTransparent=function(e){this.transparent=e},u.prototype.analyzeImage=function(e){this.setImagePixels(this.removeAlphaChannel(e)),this.analyzePixels()},u.prototype.writeImageInfo=function(){this.firstFrame&&(this.writeLSD(),this.writePalette(),this.repeat>=0&&this.writeNetscapeExt()),this.writeGraphicCtrlExt(),this.writeImageDesc(),this.firstFrame||this.writePalette(),this.firstFrame=!1},u.prototype.outputImage=function(){this.writePixels()},u.prototype.addFrame=function(e){this.emit("frame#start"),this.analyzeImage(e),this.writeImageInfo(),this.outputImage(),this.emit("frame#stop")},u.prototype.finish=function(){this.emit("finish#start"),this.writeByte(59),this.emit("finish#stop")},u.prototype.setQuality=function(e){e<1&&(e=1),this.sample=e},u.prototype.writeHeader=function(){this.emit("writeHeader#start"),this.writeUTFBytes("GIF89a"),this.emit("writeHeader#stop")},u.prototype.analyzePixels=function(){var e=this.pixels.length/3;this.indexedPixels=new Uint8Array(e);var t=new a(this.pixels,this.sample);t.buildColormap(),this.colorTab=t.getColormap();for(var n=0,r=0;r>16,n=(65280&e)>>8,r=255&e,i=0,a=16777216,o=this.colorTab.length,s=0;s=0&&(t=7&dispose),t<<=2,this.writeByte(0|t|e),this.writeShort(this.delay),this.writeByte(this.transIndex),this.writeByte(0)},u.prototype.writeImageDesc=function(){this.writeByte(44),this.writeShort(0),this.writeShort(0),this.writeShort(this.width),this.writeShort(this.height),this.firstFrame?this.writeByte(0):this.writeByte(128|this.palSize)},u.prototype.writeLSD=function(){this.writeShort(this.width),this.writeShort(this.height),this.writeByte(240|this.palSize),this.writeByte(0),this.writeByte(0)},u.prototype.writeNetscapeExt=function(){this.writeByte(33),this.writeByte(255),this.writeByte(11),this.writeUTFBytes("NETSCAPE2.0"),this.writeByte(3),this.writeByte(1),this.writeShort(this.repeat),this.writeByte(0)},u.prototype.writePalette=function(){this.writeBytes(this.colorTab);for(var e=768-this.colorTab.length,t=0;t>8&255)},u.prototype.writePixels=function(){new o(this.width,this.height,this.indexedPixels,this.colorDepth).encode(this)},u.prototype.stream=function(){return this},u.ByteCapacitor=s,t.exports=u}).call(this,e("buffer").Buffer)},{"./LZWEncoder.js":26,"./TypedNeuQuant.js":27,assert:36,buffer:4,events:43,"readable-stream":34,util:135}],26:[function(e,t,n){var r=-1,i=12,a=5003,o=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535];t.exports=function(e,t,n,s){var u,l,c,f,h,p,d,g,v,m=Math.max(2,s),_=new Uint8Array(256),w=new Int32Array(a),b=new Int32Array(a),y=0,x=0,k=!1;function E(e,t){_[l++]=e,l>=254&&T(t)}function S(e){A(a),x=g+2,k=!0,j(g,e)}function A(e){for(var t=0;t0&&(e.writeByte(l),e.writeBytes(_,0,l),l=0)}function M(e){return(1<0?u|=e<=8;)E(255&u,t),u>>=8,y-=8;if((x>c||k)&&(k?(c=M(p=d),k=!1):c=++p==i?1<0;)E(255&u,t),u>>=8,y-=8;T(t)}}this.encode=function(n){n.writeByte(m),f=e*t,h=0,function(e,t){var n,o,s,u,f,h,m;for(k=!1,c=M(p=d=e),v=1+(g=1<=0){f=h-s,0===s&&(f=1);do{if((s-=f)<0&&(s+=h),w[s]===n){u=b[s];continue e}}while(w[s]>=0)}j(u,t),u=o,x<1<>c,h=u<>3)*(1<l;)u=T[p++],fl&&((s=n[h--])[0]-=u*(s[0]-r)/_,s[1]-=u*(s[1]-a)/_,s[2]-=u*(s[2]-o)/_)}function j(e,t,r){var a,u,p,d,g,v=~(1<<31),m=v,_=-1,w=_;for(a=0;a>s-o))>c,A[a]-=g,S[a]+=g<>3),e=0;e>p;for(A<=1&&(A=0),n=0;n=c&&(R-=c),0===_&&(_=1),++n%_==0)for(E-=E/f,(A=(S-=S/g)>>p)<=1&&(A=0),l=0;l>=o,n[e][1]>>=o,n[e][2]>>=o,n[e][3]=e}(),function(){var e,t,r,o,s,u,l=0,c=0;for(e=0;e>1,t=l+1;t>1,t=l+1;t<256;t++)E[t]=a}()},this.getColormap=function(){for(var e=[],t=[],r=0;r=0;)c=u?c=i:(c++,s<0&&(s=-s),(a=o[0]-e)<0&&(a=-a),(s+=a)=0&&((s=t-(o=n[f])[1])>=u?f=-1:(f--,s<0&&(s=-s),(a=o[0]-e)<0&&(a=-a),(s+=a)0)if(t.ended&&!a){var s=new Error("stream.push() after EOF");e.emit("error",s)}else if(t.endEmitted&&a){s=new Error("stream.unshift() after end event");e.emit("error",s)}else!t.decoder||a||i||(r=t.decoder.write(r)),a||(t.reading=!1),t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,a?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&g(e)),function(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(function(){!function(e,t){var n=t.length;for(;!t.reading&&!t.flowing&&!t.ended&&t.lengtht.highWaterMark&&(t.highWaterMark=function(e){if(e>=p)e=p;else{e--;for(var t=1;t<32;t<<=1)e|=e>>t;e++}return e}(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function g(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(l("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?n.nextTick(function(){v(e)}):v(e))}function v(e){l("emit readable"),e.emit("readable"),m(e)}function m(e){var t=e._readableState;if(l("flow",t.flowing),t.flowing)do{var n=e.read()}while(null!==n&&t.flowing)}function _(e,t){var n,r=t.buffer,a=t.length,o=!!t.decoder,s=!!t.objectMode;if(0===r.length)return null;if(0===a)n=null;else if(s)n=r.shift();else if(!e||e>=a)n=o?r.join(""):i.concat(r,a),r.length=0;else{if(e0)throw new Error("endReadable called on non-empty stream");t.endEmitted||(t.ended=!0,n.nextTick(function(){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}))}f.prototype.read=function(e){l("read",e);var t=this._readableState,n=e;if((!u.isNumber(e)||e>0)&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return l("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?w(this):g(this),null;if(0===(e=d(e,t))&&t.ended)return 0===t.length&&w(this),null;var r,i=t.needReadable;return l("need readable",i),(0===t.length||t.length-e0?_(e,t):null,u.isNull(r)&&(t.needReadable=!0,e=0),t.length-=e,0!==t.length||t.ended||(t.needReadable=!0),n!==e&&t.ended&&0===t.length&&w(this),u.isNull(r)||this.emit("data",r),r},f.prototype._read=function(e){this.emit("error",new Error("not implemented"))},f.prototype.pipe=function(e,t){var i=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,l("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?c:h;function u(e){l("onunpipe"),e===i&&h()}function c(){l("onend"),e.end()}o.endEmitted?n.nextTick(s):i.once("end",s),e.on("unpipe",u);var f=function(e){return function(){var t=e._readableState;l("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&a.listenerCount(e,"data")&&(t.flowing=!0,m(e))}}(i);function h(){l("cleanup"),e.removeListener("close",g),e.removeListener("finish",v),e.removeListener("drain",f),e.removeListener("error",d),e.removeListener("unpipe",u),i.removeListener("end",c),i.removeListener("end",h),i.removeListener("data",p),!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f()}function p(t){l("ondata"),!1===e.write(t)&&(l("false write response, pause",i._readableState.awaitDrain),i._readableState.awaitDrain++,i.pause())}function d(t){l("onerror",t),_(),e.removeListener("error",d),0===a.listenerCount(e,"error")&&e.emit("error",t)}function g(){e.removeListener("finish",v),_()}function v(){l("onfinish"),e.removeListener("close",g),_()}function _(){l("unpipe"),i.unpipe(e)}return e.on("drain",f),i.on("data",p),e._events&&e._events.error?r(e._events.error)?e._events.error.unshift(d):e._events.error=[d,e._events.error]:e.on("error",d),e.once("close",g),e.once("finish",v),e.emit("pipe",i),o.flowing||(l("pipe resume"),i.resume()),e},f.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i1){for(var n=[],r=0;r=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived=55296&&i<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var r=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,r),r-=this.charReceived);var i;r=(t+=e.toString(this.encoding,0,r)).length-1;if((i=t.charCodeAt(r))>=55296&&i<=56319){var a=this.surrogateSize;return this.charLength+=a,this.charReceived+=a,this.charBuffer.copy(this.charBuffer,a,0,a),e.copy(this.charBuffer,0,0,a),t.substring(0,r)}return t},a.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(t<=2&&n>>4==14){this.charLength=3;break}if(t<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=t},a.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;t+=r.slice(0,n).toString(i)}return t}},{buffer:4}],36:[function(e,t,n){(function(n){"use strict";function r(e,t){if(e===t)return 0;for(var n=e.length,r=t.length,i=0,a=Math.min(n,r);i=0;l--)if(c[l]!==f[l])return!1;for(l=c.length-1;l>=0;l--)if(u=c[l],!_(e[u],t[u],n,r))return!1;return!0}(e,t,n,o))}return n?e===t:e==t}function w(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function b(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function y(e,t,n,r){var i;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof n&&(r=n,n=null),i=function(e){var t;try{e()}catch(e){t=e}return t}(t),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),e&&!i&&v(i,n,"Missing expected exception"+r);var o="string"==typeof r,s=!e&&i&&!n;if((!e&&a.isError(i)&&o&&b(i,n)||s)&&v(i,n,"Got unwanted exception"+r),e&&i&&n&&!b(i,n)||!e&&i)throw i}f.AssertionError=function(e){var t;this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=d(g((t=this).actual),128)+" "+t.operator+" "+d(g(t.expected),128),this.generatedMessage=!0);var n=e.stackStartFunction||v;if(Error.captureStackTrace)Error.captureStackTrace(this,n);else{var r=new Error;if(r.stack){var i=r.stack,a=p(n),o=i.indexOf("\n"+a);if(o>=0){var s=i.indexOf("\n",o+1);i=i.substring(s+1)}this.stack=i}}},a.inherits(f.AssertionError,Error),f.fail=v,f.ok=m,f.equal=function(e,t,n){e!=t&&v(e,t,n,"==",f.equal)},f.notEqual=function(e,t,n){e==t&&v(e,t,n,"!=",f.notEqual)},f.deepEqual=function(e,t,n){_(e,t,!1)||v(e,t,n,"deepEqual",f.deepEqual)},f.deepStrictEqual=function(e,t,n){_(e,t,!0)||v(e,t,n,"deepStrictEqual",f.deepStrictEqual)},f.notDeepEqual=function(e,t,n){_(e,t,!1)&&v(e,t,n,"notDeepEqual",f.notDeepEqual)},f.notDeepStrictEqual=function e(t,n,r){_(t,n,!0)&&v(t,n,r,"notDeepStrictEqual",e)},f.strictEqual=function(e,t,n){e!==t&&v(e,t,n,"===",f.strictEqual)},f.notStrictEqual=function(e,t,n){e===t&&v(e,t,n,"!==",f.notStrictEqual)},f.throws=function(e,t,n){y(!0,e,t,n)},f.doesNotThrow=function(e,t,n){y(!1,e,t,n)},f.ifError=function(e){if(e)throw e};var x=Object.keys||function(e){var t=[];for(var n in e)o.call(e,n)&&t.push(n);return t}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"util/":39}],37:[function(e,t,n){"function"==typeof Object.create?t.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},{}],38:[function(e,t,n){t.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},{}],39:[function(e,t,n){(function(t,r){var i=/%[sdj%]/g;n.format=function(e){if(!m(e)){for(var t=[],n=0;n=a)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}}),u=r[n];n=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),d(t)?r.showHidden=t:t&&n._extend(r,t),_(r.showHidden)&&(r.showHidden=!1),_(r.depth)&&(r.depth=2),_(r.colors)&&(r.colors=!1),_(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=u),c(r,e,r.depth)}function u(e,t){var n=s.styles[t];return n?"["+s.colors[n][0]+"m"+e+"["+s.colors[n][1]+"m":e}function l(e,t){return e}function c(e,t,r){if(e.customInspect&&t&&k(t.inspect)&&t.inspect!==n.inspect&&(!t.constructor||t.constructor.prototype!==t)){var i=t.inspect(r,e);return m(i)||(i=c(e,i,r)),i}var a=function(e,t){if(_(t))return e.stylize("undefined","undefined");if(m(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(v(t))return e.stylize(""+t,"number");if(d(t))return e.stylize(""+t,"boolean");if(g(t))return e.stylize("null","null")}(e,t);if(a)return a;var o=Object.keys(t),s=function(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(t)),x(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return f(t);if(0===o.length){if(k(t)){var u=t.name?": "+t.name:"";return e.stylize("[Function"+u+"]","special")}if(w(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(y(t))return e.stylize(Date.prototype.toString.call(t),"date");if(x(t))return f(t)}var l,b="",E=!1,S=["{","}"];(p(t)&&(E=!0,S=["[","]"]),k(t))&&(b=" [Function"+(t.name?": "+t.name:"")+"]");return w(t)&&(b=" "+RegExp.prototype.toString.call(t)),y(t)&&(b=" "+Date.prototype.toUTCString.call(t)),x(t)&&(b=" "+f(t)),0!==o.length||E&&0!=t.length?r<0?w(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),l=E?function(e,t,n,r,i){for(var a=[],o=0,s=t.length;o=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1];return n[0]+t+" "+e.join(", ")+" "+n[1]}(l,b,S)):S[0]+b+S[1]}function f(e){return"["+Error.prototype.toString.call(e)+"]"}function h(e,t,n,r,i,a){var o,s,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?s=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(s=e.stylize("[Setter]","special")),T(r,i)||(o="["+i+"]"),s||(e.seen.indexOf(u.value)<0?(s=g(n)?c(e,u.value,null):c(e,u.value,n-1)).indexOf("\n")>-1&&(s=a?s.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+s.split("\n").map(function(e){return" "+e}).join("\n")):s=e.stylize("[Circular]","special")),_(o)){if(a&&i.match(/^\d+$/))return s;(o=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+s}function p(e){return Array.isArray(e)}function d(e){return"boolean"==typeof e}function g(e){return null===e}function v(e){return"number"==typeof e}function m(e){return"string"==typeof e}function _(e){return void 0===e}function w(e){return b(e)&&"[object RegExp]"===E(e)}function b(e){return"object"==typeof e&&null!==e}function y(e){return b(e)&&"[object Date]"===E(e)}function x(e){return b(e)&&("[object Error]"===E(e)||e instanceof Error)}function k(e){return"function"==typeof e}function E(e){return Object.prototype.toString.call(e)}function S(e){return e<10?"0"+e.toString(10):e.toString(10)}n.debuglog=function(e){if(_(a)&&(a=t.env.NODE_DEBUG||""),e=e.toUpperCase(),!o[e])if(new RegExp("\\b"+e+"\\b","i").test(a)){var r=t.pid;o[e]=function(){var t=n.format.apply(n,arguments);console.error("%s %d: %s",e,r,t)}}else o[e]=function(){};return o[e]},n.inspect=s,s.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},s.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},n.isArray=p,n.isBoolean=d,n.isNull=g,n.isNullOrUndefined=function(e){return null==e},n.isNumber=v,n.isString=m,n.isSymbol=function(e){return"symbol"==typeof e},n.isUndefined=_,n.isRegExp=w,n.isObject=b,n.isDate=y,n.isError=x,n.isFunction=k,n.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},n.isBuffer=e("./support/isBuffer");var A=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function T(e,t){return Object.prototype.hasOwnProperty.call(e,t)}n.log=function(){var e,t;console.log("%s - %s",(e=new Date,t=[S(e.getHours()),S(e.getMinutes()),S(e.getSeconds())].join(":"),[e.getDate(),A[e.getMonth()],t].join(" ")),n.format.apply(n,arguments))},n.inherits=e("inherits"),n._extend=function(e,t){if(!t||!b(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":38,_process:98,inherits:37}],40:[function(e,t,n){(function(t,r){"use strict";var i=e("assert"),a=e("pako/lib/zlib/zstream"),o=e("pako/lib/zlib/deflate.js"),s=e("pako/lib/zlib/inflate.js"),u=e("pako/lib/zlib/constants");for(var l in u)n[l]=u[l];n.NONE=0,n.DEFLATE=1,n.INFLATE=2,n.GZIP=3,n.GUNZIP=4,n.DEFLATERAW=5,n.INFLATERAW=6,n.UNZIP=7;function c(e){if("number"!=typeof e||en.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=e,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}c.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,i(this.init_done,"close before init"),i(this.mode<=n.UNZIP),this.mode===n.DEFLATE||this.mode===n.GZIP||this.mode===n.DEFLATERAW?o.deflateEnd(this.strm):this.mode!==n.INFLATE&&this.mode!==n.GUNZIP&&this.mode!==n.INFLATERAW&&this.mode!==n.UNZIP||s.inflateEnd(this.strm),this.mode=n.NONE,this.dictionary=null)},c.prototype.write=function(e,t,n,r,i,a,o){return this._write(!0,e,t,n,r,i,a,o)},c.prototype.writeSync=function(e,t,n,r,i,a,o){return this._write(!1,e,t,n,r,i,a,o)},c.prototype._write=function(e,a,o,s,u,l,c,f){if(i.equal(arguments.length,8),i(this.init_done,"write before init"),i(this.mode!==n.NONE,"already finalized"),i.equal(!1,this.write_in_progress,"write already in progress"),i.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,i.equal(!1,void 0===a,"must provide flush value"),this.write_in_progress=!0,a!==n.Z_NO_FLUSH&&a!==n.Z_PARTIAL_FLUSH&&a!==n.Z_SYNC_FLUSH&&a!==n.Z_FULL_FLUSH&&a!==n.Z_FINISH&&a!==n.Z_BLOCK)throw new Error("Invalid flush value");if(null==o&&(o=r.alloc(0),u=0,s=0),this.strm.avail_in=u,this.strm.input=o,this.strm.next_in=s,this.strm.avail_out=f,this.strm.output=l,this.strm.next_out=c,this.flush=a,!e)return this._process(),this._checkError()?this._afterSync():void 0;var h=this;return t.nextTick(function(){h._process(),h._after()}),this},c.prototype._afterSync=function(){var e=this.strm.avail_out,t=this.strm.avail_in;return this.write_in_progress=!1,[t,e]},c.prototype._process=function(){var e=null;switch(this.mode){case n.DEFLATE:case n.GZIP:case n.DEFLATERAW:this.err=o.deflate(this.strm,this.flush);break;case n.UNZIP:switch(this.strm.avail_in>0&&(e=this.strm.next_in),this.gzip_id_bytes_read){case 0:if(null===e)break;if(31!==this.strm.input[e]){this.mode=n.INFLATE;break}if(this.gzip_id_bytes_read=1,e++,1===this.strm.avail_in)break;case 1:if(null===e)break;139===this.strm.input[e]?(this.gzip_id_bytes_read=2,this.mode=n.GUNZIP):this.mode=n.INFLATE;break;default:throw new Error("invalid number of gzip magic number bytes read")}case n.INFLATE:case n.GUNZIP:case n.INFLATERAW:for(this.err=s.inflate(this.strm,this.flush),this.err===n.Z_NEED_DICT&&this.dictionary&&(this.err=s.inflateSetDictionary(this.strm,this.dictionary),this.err===n.Z_OK?this.err=s.inflate(this.strm,this.flush):this.err===n.Z_DATA_ERROR&&(this.err=n.Z_NEED_DICT));this.strm.avail_in>0&&this.mode===n.GUNZIP&&this.err===n.Z_STREAM_END&&0!==this.strm.next_in[0];)this.reset(),this.err=s.inflate(this.strm,this.flush);break;default:throw new Error("Unknown mode "+this.mode)}},c.prototype._checkError=function(){switch(this.err){case n.Z_OK:case n.Z_BUF_ERROR:if(0!==this.strm.avail_out&&this.flush===n.Z_FINISH)return this._error("unexpected end of file"),!1;break;case n.Z_STREAM_END:break;case n.Z_NEED_DICT:return null==this.dictionary?this._error("Missing dictionary"):this._error("Bad dictionary"),!1;default:return this._error("Zlib error"),!1}return!0},c.prototype._after=function(){if(this._checkError()){var e=this.strm.avail_out,t=this.strm.avail_in;this.write_in_progress=!1,this.callback(t,e),this.pending_close&&this.close()}},c.prototype._error=function(e){this.strm.msg&&(e=this.strm.msg),this.onerror(e,this.err),this.write_in_progress=!1,this.pending_close&&this.close()},c.prototype.init=function(e,t,r,a,o){i(4===arguments.length||5===arguments.length,"init(windowBits, level, memLevel, strategy, [dictionary])"),i(e>=8&&e<=15,"invalid windowBits"),i(t>=-1&&t<=9,"invalid compression level"),i(r>=1&&r<=9,"invalid memlevel"),i(a===n.Z_FILTERED||a===n.Z_HUFFMAN_ONLY||a===n.Z_RLE||a===n.Z_FIXED||a===n.Z_DEFAULT_STRATEGY,"invalid strategy"),this._init(t,e,r,a,o),this._setDictionary()},c.prototype.params=function(){throw new Error("deflateParams Not supported")},c.prototype.reset=function(){this._reset(),this._setDictionary()},c.prototype._init=function(e,t,r,i,u){switch(this.level=e,this.windowBits=t,this.memLevel=r,this.strategy=i,this.flush=n.Z_NO_FLUSH,this.err=n.Z_OK,this.mode!==n.GZIP&&this.mode!==n.GUNZIP||(this.windowBits+=16),this.mode===n.UNZIP&&(this.windowBits+=32),this.mode!==n.DEFLATERAW&&this.mode!==n.INFLATERAW||(this.windowBits=-1*this.windowBits),this.strm=new a,this.mode){case n.DEFLATE:case n.GZIP:case n.DEFLATERAW:this.err=o.deflateInit2(this.strm,this.level,n.Z_DEFLATED,this.windowBits,this.memLevel,this.strategy);break;case n.INFLATE:case n.GUNZIP:case n.INFLATERAW:case n.UNZIP:this.err=s.inflateInit2(this.strm,this.windowBits);break;default:throw new Error("Unknown mode "+this.mode)}this.err!==n.Z_OK&&this._error("Init error"),this.dictionary=u,this.write_in_progress=!1,this.init_done=!0},c.prototype._setDictionary=function(){if(null!=this.dictionary){switch(this.err=n.Z_OK,this.mode){case n.DEFLATE:case n.DEFLATERAW:this.err=o.deflateSetDictionary(this.strm,this.dictionary)}this.err!==n.Z_OK&&this._error("Failed to set dictionary")}},c.prototype._reset=function(){switch(this.err=n.Z_OK,this.mode){case n.DEFLATE:case n.DEFLATERAW:case n.GZIP:this.err=o.deflateReset(this.strm);break;case n.INFLATE:case n.INFLATERAW:case n.GUNZIP:this.err=s.inflateReset(this.strm)}this.err!==n.Z_OK&&this._error("Failed to reset stream")},n.Zlib=c}).call(this,e("_process"),e("buffer").Buffer)},{_process:98,assert:36,buffer:4,"pako/lib/zlib/constants":46,"pako/lib/zlib/deflate.js":48,"pako/lib/zlib/inflate.js":50,"pako/lib/zlib/zstream":54}],41:[function(e,t,n){(function(t){"use strict";var r=e("buffer").Buffer,i=e("stream").Transform,a=e("./binding"),o=e("util"),s=e("assert").ok,u=e("buffer").kMaxLength,l="Cannot create final Buffer. It would be larger than 0x"+u.toString(16)+" bytes";a.Z_MIN_WINDOWBITS=8,a.Z_MAX_WINDOWBITS=15,a.Z_DEFAULT_WINDOWBITS=15,a.Z_MIN_CHUNK=64,a.Z_MAX_CHUNK=1/0,a.Z_DEFAULT_CHUNK=16384,a.Z_MIN_MEMLEVEL=1,a.Z_MAX_MEMLEVEL=9,a.Z_DEFAULT_MEMLEVEL=8,a.Z_MIN_LEVEL=-1,a.Z_MAX_LEVEL=9,a.Z_DEFAULT_LEVEL=a.Z_DEFAULT_COMPRESSION;for(var c=Object.keys(a),f=0;f=u?o=new RangeError(l):t=r.concat(i,a),i=[],e.close(),n(o,t)}e.on("error",function(t){e.removeListener("end",s),e.removeListener("readable",o),n(t)}),e.on("end",s),e.end(t),o()}function _(e,t){if("string"==typeof t&&(t=r.from(t)),!r.isBuffer(t))throw new TypeError("Not a string or buffer");var n=e._finishFlushFlag;return e._processChunk(t,n)}function w(e){if(!(this instanceof w))return new w(e);T.call(this,e,a.DEFLATE)}function b(e){if(!(this instanceof b))return new b(e);T.call(this,e,a.INFLATE)}function y(e){if(!(this instanceof y))return new y(e);T.call(this,e,a.GZIP)}function x(e){if(!(this instanceof x))return new x(e);T.call(this,e,a.GUNZIP)}function k(e){if(!(this instanceof k))return new k(e);T.call(this,e,a.DEFLATERAW)}function E(e){if(!(this instanceof E))return new E(e);T.call(this,e,a.INFLATERAW)}function S(e){if(!(this instanceof S))return new S(e);T.call(this,e,a.UNZIP)}function A(e){return e===a.Z_NO_FLUSH||e===a.Z_PARTIAL_FLUSH||e===a.Z_SYNC_FLUSH||e===a.Z_FULL_FLUSH||e===a.Z_FINISH||e===a.Z_BLOCK}function T(e,t){var o=this;if(this._opts=e=e||{},this._chunkSize=e.chunkSize||n.Z_DEFAULT_CHUNK,i.call(this,e),e.flush&&!A(e.flush))throw new Error("Invalid flush flag: "+e.flush);if(e.finishFlush&&!A(e.finishFlush))throw new Error("Invalid flush flag: "+e.finishFlush);if(this._flushFlag=e.flush||a.Z_NO_FLUSH,this._finishFlushFlag=void 0!==e.finishFlush?e.finishFlush:a.Z_FINISH,e.chunkSize&&(e.chunkSizen.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitsn.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.leveln.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLeveln.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=n.Z_FILTERED&&e.strategy!=n.Z_HUFFMAN_ONLY&&e.strategy!=n.Z_RLE&&e.strategy!=n.Z_FIXED&&e.strategy!=n.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!r.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new a.Zlib(t);var s=this;this._hadError=!1,this._handle.onerror=function(e,t){M(s),s._hadError=!0;var r=new Error(e);r.errno=t,r.code=n.codes[t],s.emit("error",r)};var u=n.Z_DEFAULT_COMPRESSION;"number"==typeof e.level&&(u=e.level);var l=n.Z_DEFAULT_STRATEGY;"number"==typeof e.strategy&&(l=e.strategy),this._handle.init(e.windowBits||n.Z_DEFAULT_WINDOWBITS,u,e.memLevel||n.Z_DEFAULT_MEMLEVEL,l,e.dictionary),this._buffer=r.allocUnsafe(this._chunkSize),this._offset=0,this._level=u,this._strategy=l,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!o._handle},configurable:!0,enumerable:!0})}function M(e,n){n&&t.nextTick(n),e._handle&&(e._handle.close(),e._handle=null)}function I(e){e.emit("close")}Object.defineProperty(n,"codes",{enumerable:!0,value:Object.freeze(p),writable:!1}),n.Deflate=w,n.Inflate=b,n.Gzip=y,n.Gunzip=x,n.DeflateRaw=k,n.InflateRaw=E,n.Unzip=S,n.createDeflate=function(e){return new w(e)},n.createInflate=function(e){return new b(e)},n.createDeflateRaw=function(e){return new k(e)},n.createInflateRaw=function(e){return new E(e)},n.createGzip=function(e){return new y(e)},n.createGunzip=function(e){return new x(e)},n.createUnzip=function(e){return new S(e)},n.deflate=function(e,t,n){return"function"==typeof t&&(n=t,t={}),m(new w(t),e,n)},n.deflateSync=function(e,t){return _(new w(t),e)},n.gzip=function(e,t,n){return"function"==typeof t&&(n=t,t={}),m(new y(t),e,n)},n.gzipSync=function(e,t){return _(new y(t),e)},n.deflateRaw=function(e,t,n){return"function"==typeof t&&(n=t,t={}),m(new k(t),e,n)},n.deflateRawSync=function(e,t){return _(new k(t),e)},n.unzip=function(e,t,n){return"function"==typeof t&&(n=t,t={}),m(new S(t),e,n)},n.unzipSync=function(e,t){return _(new S(t),e)},n.inflate=function(e,t,n){return"function"==typeof t&&(n=t,t={}),m(new b(t),e,n)},n.inflateSync=function(e,t){return _(new b(t),e)},n.gunzip=function(e,t,n){return"function"==typeof t&&(n=t,t={}),m(new x(t),e,n)},n.gunzipSync=function(e,t){return _(new x(t),e)},n.inflateRaw=function(e,t,n){return"function"==typeof t&&(n=t,t={}),m(new E(t),e,n)},n.inflateRawSync=function(e,t){return _(new E(t),e)},o.inherits(T,i),T.prototype.params=function(e,r,i){if(en.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(r!=n.Z_FILTERED&&r!=n.Z_HUFFMAN_ONLY&&r!=n.Z_RLE&&r!=n.Z_FIXED&&r!=n.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+r);if(this._level!==e||this._strategy!==r){var o=this;this.flush(a.Z_SYNC_FLUSH,function(){s(o._handle,"zlib binding closed"),o._handle.params(e,r),o._hadError||(o._level=e,o._strategy=r,i&&i())})}else t.nextTick(i)},T.prototype.reset=function(){return s(this._handle,"zlib binding closed"),this._handle.reset()},T.prototype._flush=function(e){this._transform(r.alloc(0),"",e)},T.prototype.flush=function(e,n){var i=this,o=this._writableState;("function"==typeof e||void 0===e&&!n)&&(n=e,e=a.Z_FULL_FLUSH),o.ended?n&&t.nextTick(n):o.ending?n&&this.once("end",n):o.needDrain?n&&this.once("drain",function(){return i.flush(e,n)}):(this._flushFlag=e,this.write(r.alloc(0),"",n))},T.prototype.close=function(e){M(this,e),t.nextTick(I,this)},T.prototype._transform=function(e,t,n){var i,o=this._writableState,s=(o.ending||o.ended)&&(!e||o.length===e.length);return null===e||r.isBuffer(e)?this._handle?(s?i=this._finishFlushFlag:(i=this._flushFlag,e.length>=o.length&&(this._flushFlag=this._opts.flush||a.Z_NO_FLUSH)),void this._processChunk(e,i,n)):n(new Error("zlib binding closed")):n(new Error("invalid input"))},T.prototype._processChunk=function(e,t,n){var i=e&&e.length,a=this._chunkSize-this._offset,o=0,c=this,f="function"==typeof n;if(!f){var h,p=[],d=0;this.on("error",function(e){h=e}),s(this._handle,"zlib binding closed");do{var g=this._handle.writeSync(t,e,o,i,this._buffer,this._offset,a)}while(!this._hadError&&_(g[0],g[1]));if(this._hadError)throw h;if(d>=u)throw M(this),new RangeError(l);var v=r.concat(p,d);return M(this),v}s(this._handle,"zlib binding closed");var m=this._handle.write(t,e,o,i,this._buffer,this._offset,a);function _(u,l){if(this&&(this.buffer=null,this.callback=null),!c._hadError){var h=a-l;if(s(h>=0,"have should not go down"),h>0){var g=c._buffer.slice(c._offset,c._offset+h);c._offset+=h,f?c.push(g):(p.push(g),d+=g.length)}if((0===l||c._offset>=c._chunkSize)&&(a=c._chunkSize,c._offset=0,c._buffer=r.allocUnsafe(c._chunkSize)),0===l){if(o+=i-u,i=u,!f)return!0;var v=c._handle.write(t,e,o,i,c._buffer,c._offset,c._chunkSize);return v.callback=_,void(v.buffer=e)}if(!f)return!1;n()}}m.buffer=e,m.callback=_},o.inherits(w,T),o.inherits(b,T),o.inherits(y,T),o.inherits(x,T),o.inherits(k,T),o.inherits(E,T),o.inherits(S,T)}).call(this,e("_process"))},{"./binding":40,_process:98,assert:36,buffer:4,stream:112,util:135}],42:[function(e,t,n){arguments[4][3][0].apply(n,arguments)},{dup:3}],43:[function(e,t,n){var r=Object.create||function(e){var t=function(){};return t.prototype=e,new t},i=Object.keys||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return n},a=Function.prototype.bind||function(e){var t=this;return function(){return t.apply(e,arguments)}};function o(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=r(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}t.exports=o,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._maxListeners=void 0;var s,u=10;try{var l={};Object.defineProperty&&Object.defineProperty(l,"x",{value:0}),s=0===l.x}catch(e){s=!1}function c(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function f(e,t,n,i){var a,o,s;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if((o=e._events)?(o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),s=o[t]):(o=e._events=r(null),e._eventsCount=0),s){if("function"==typeof s?s=o[t]=i?[n,s]:[s,n]:i?s.unshift(n):s.push(n),!s.warned&&(a=c(e))&&a>0&&s.length>a){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+' "'+String(t)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=s.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",u.name,u.message)}}else s=o[t]=n,++e._eventsCount;return e}function h(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var e=new Array(arguments.length),t=0;t1&&(t=arguments[1]),t instanceof Error)throw t;var u=new Error('Unhandled "error" event. ('+t+")");throw u.context=t,u}if(!(n=o[e]))return!1;var l="function"==typeof n;switch(r=arguments.length){case 1:!function(e,t,n){if(t)e.call(n);else for(var r=e.length,i=v(e,r),a=0;a=0;o--)if(n[o]===t||n[o].listener===t){s=n[o].listener,a=o;break}if(a<0)return this;0===a?n.shift():function(e,t){for(var n=t,r=n+1,i=e.length;r=0;a--)this.removeListener(e,t[a]);return this},o.prototype.listeners=function(e){return d(this,e,!0)},o.prototype.rawListeners=function(e){return d(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):g.call(e,t)},o.prototype.listenerCount=g,o.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],44:[function(e,t,n){"use strict";var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}n.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var r in n)i(n,r)&&(e[r]=n[r])}}return e},n.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var a={arraySet:function(e,t,n,r,i){if(t.subarray&&e.subarray)e.set(t.subarray(n,n+r),i);else for(var a=0;a>>16&65535|0,o=0;0!==n;){n-=o=n>2e3?2e3:n;do{a=a+(i=i+t[r++]|0)|0}while(--o);i%=65521,a%=65521}return i|a<<16|0}},{}],46:[function(e,t,n){"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],47:[function(e,t,n){"use strict";var r=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t,n,i){var a=r,o=i+n;e^=-1;for(var s=i;s>>8^a[255&(e^t[s])];return-1^e}},{}],48:[function(e,t,n){"use strict";var r,i=e("../utils/common"),a=e("./trees"),o=e("./adler32"),s=e("./crc32"),u=e("./messages"),l=0,c=1,f=3,h=4,p=5,d=0,g=1,v=-2,m=-3,_=-5,w=-1,b=1,y=2,x=3,k=4,E=0,S=2,A=8,T=9,M=15,I=8,j=286,R=30,L=19,B=2*j+1,C=15,O=3,z=258,D=z+O+1,F=32,N=42,P=69,U=73,q=91,V=103,Z=113,W=666,G=1,H=2,Y=3,$=4,X=3;function J(e,t){return e.msg=u[t],t}function K(e){return(e<<1)-(e>4?9:0)}function Q(e){for(var t=e.length;--t>=0;)e[t]=0}function ee(e){var t=e.state,n=t.pending;n>e.avail_out&&(n=e.avail_out),0!==n&&(i.arraySet(e.output,t.pending_buf,t.pending_out,n,e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))}function te(e,t){a._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,ee(e.strm)}function ne(e,t){e.pending_buf[e.pending++]=t}function re(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function ie(e,t){var n,r,i=e.max_chain_length,a=e.strstart,o=e.prev_length,s=e.nice_match,u=e.strstart>e.w_size-D?e.strstart-(e.w_size-D):0,l=e.window,c=e.w_mask,f=e.prev,h=e.strstart+z,p=l[a+o-1],d=l[a+o];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do{if(l[(n=t)+o]===d&&l[n+o-1]===p&&l[n]===l[a]&&l[++n]===l[a+1]){a+=2,n++;do{}while(l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&ao){if(e.match_start=t,o=r,r>=s)break;p=l[a+o-1],d=l[a+o]}}}while((t=f[t&c])>u&&0!=--i);return o<=e.lookahead?o:e.lookahead}function ae(e){var t,n,r,a,u,l,c,f,h,p,d=e.w_size;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=d+(d-D)){i.arraySet(e.window,e.window,d,d,0),e.match_start-=d,e.strstart-=d,e.block_start-=d,t=n=e.hash_size;do{r=e.head[--t],e.head[t]=r>=d?r-d:0}while(--n);t=n=d;do{r=e.prev[--t],e.prev[t]=r>=d?r-d:0}while(--n);a+=d}if(0===e.strm.avail_in)break;if(l=e.strm,c=e.window,f=e.strstart+e.lookahead,h=a,p=void 0,(p=l.avail_in)>h&&(p=h),n=0===p?0:(l.avail_in-=p,i.arraySet(c,l.input,l.next_in,p,f),1===l.state.wrap?l.adler=o(l.adler,c,p,f):2===l.state.wrap&&(l.adler=s(l.adler,c,p,f)),l.next_in+=p,l.total_in+=p,p),e.lookahead+=n,e.lookahead+e.insert>=O)for(u=e.strstart-e.insert,e.ins_h=e.window[u],e.ins_h=(e.ins_h<=O&&(e.ins_h=(e.ins_h<=O)if(r=a._tr_tally(e,e.strstart-e.match_start,e.match_length-O),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=O){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<=O&&(e.ins_h=(e.ins_h<4096)&&(e.match_length=O-1)),e.prev_length>=O&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-O,r=a._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-O),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=i&&(e.ins_h=(e.ins_h<15&&(s=2,r-=16),a<1||a>T||n!==A||r<8||r>15||t<0||t>9||o<0||o>k)return J(e,v);8===r&&(r=9);var u=new function(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=A,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new i.Buf16(2*B),this.dyn_dtree=new i.Buf16(2*(2*R+1)),this.bl_tree=new i.Buf16(2*(2*L+1)),Q(this.dyn_ltree),Q(this.dyn_dtree),Q(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(C+1),this.heap=new i.Buf16(2*j+1),Q(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(2*j+1),Q(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0};return e.state=u,u.strm=e,u.wrap=s,u.gzhead=null,u.w_bits=r,u.w_size=1<e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(ae(e),0===e.lookahead&&t===l)return G;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+n;if((0===e.strstart||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,te(e,!1),0===e.strm.avail_out))return G;if(e.strstart-e.block_start>=e.w_size-D&&(te(e,!1),0===e.strm.avail_out))return G}return e.insert=0,t===h?(te(e,!0),0===e.strm.avail_out?Y:$):(e.strstart>e.block_start&&(te(e,!1),e.strm.avail_out),G)}),new ue(4,4,8,4,oe),new ue(4,5,16,8,oe),new ue(4,6,32,32,oe),new ue(4,4,16,16,se),new ue(8,16,32,32,se),new ue(8,16,128,128,se),new ue(8,32,128,256,se),new ue(32,128,258,1024,se),new ue(32,258,258,4096,se)],n.deflateInit=function(e,t){return fe(e,t,A,M,I,E)},n.deflateInit2=fe,n.deflateReset=ce,n.deflateResetKeep=le,n.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?v:(e.state.gzhead=t,d):v},n.deflate=function(e,t){var n,i,o,u;if(!e||!e.state||t>p||t<0)return e?J(e,v):v;if(i=e.state,!e.output||!e.input&&0!==e.avail_in||i.status===W&&t!==h)return J(e,0===e.avail_out?_:v);if(i.strm=e,n=i.last_flush,i.last_flush=t,i.status===N)if(2===i.wrap)e.adler=0,ne(i,31),ne(i,139),ne(i,8),i.gzhead?(ne(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),ne(i,255&i.gzhead.time),ne(i,i.gzhead.time>>8&255),ne(i,i.gzhead.time>>16&255),ne(i,i.gzhead.time>>24&255),ne(i,9===i.level?2:i.strategy>=y||i.level<2?4:0),ne(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(ne(i,255&i.gzhead.extra.length),ne(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=s(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=P):(ne(i,0),ne(i,0),ne(i,0),ne(i,0),ne(i,0),ne(i,9===i.level?2:i.strategy>=y||i.level<2?4:0),ne(i,X),i.status=Z);else{var m=A+(i.w_bits-8<<4)<<8;m|=(i.strategy>=y||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(m|=F),m+=31-m%31,i.status=Z,re(i,m),0!==i.strstart&&(re(i,e.adler>>>16),re(i,65535&e.adler)),e.adler=1}if(i.status===P)if(i.gzhead.extra){for(o=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),ee(e),o=i.pending,i.pending!==i.pending_buf_size));)ne(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=U)}else i.status=U;if(i.status===U)if(i.gzhead.name){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),ee(e),o=i.pending,i.pending===i.pending_buf_size)){u=1;break}u=i.gzindexo&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),0===u&&(i.gzindex=0,i.status=q)}else i.status=q;if(i.status===q)if(i.gzhead.comment){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),ee(e),o=i.pending,i.pending===i.pending_buf_size)){u=1;break}u=i.gzindexo&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),0===u&&(i.status=V)}else i.status=V;if(i.status===V&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&ee(e),i.pending+2<=i.pending_buf_size&&(ne(i,255&e.adler),ne(i,e.adler>>8&255),e.adler=0,i.status=Z)):i.status=Z),0!==i.pending){if(ee(e),0===e.avail_out)return i.last_flush=-1,d}else if(0===e.avail_in&&K(t)<=K(n)&&t!==h)return J(e,_);if(i.status===W&&0!==e.avail_in)return J(e,_);if(0!==e.avail_in||0!==i.lookahead||t!==l&&i.status!==W){var w=i.strategy===y?function(e,t){for(var n;;){if(0===e.lookahead&&(ae(e),0===e.lookahead)){if(t===l)return G;break}if(e.match_length=0,n=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(te(e,!1),0===e.strm.avail_out))return G}return e.insert=0,t===h?(te(e,!0),0===e.strm.avail_out?Y:$):e.last_lit&&(te(e,!1),0===e.strm.avail_out)?G:H}(i,t):i.strategy===x?function(e,t){for(var n,r,i,o,s=e.window;;){if(e.lookahead<=z){if(ae(e),e.lookahead<=z&&t===l)return G;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=O&&e.strstart>0&&(r=s[i=e.strstart-1])===s[++i]&&r===s[++i]&&r===s[++i]){o=e.strstart+z;do{}while(r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&ie.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=O?(n=a._tr_tally(e,1,e.match_length-O),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(te(e,!1),0===e.strm.avail_out))return G}return e.insert=0,t===h?(te(e,!0),0===e.strm.avail_out?Y:$):e.last_lit&&(te(e,!1),0===e.strm.avail_out)?G:H}(i,t):r[i.level].func(i,t);if(w!==Y&&w!==$||(i.status=W),w===G||w===Y)return 0===e.avail_out&&(i.last_flush=-1),d;if(w===H&&(t===c?a._tr_align(i):t!==p&&(a._tr_stored_block(i,0,0,!1),t===f&&(Q(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),ee(e),0===e.avail_out))return i.last_flush=-1,d}return t!==h?d:i.wrap<=0?g:(2===i.wrap?(ne(i,255&e.adler),ne(i,e.adler>>8&255),ne(i,e.adler>>16&255),ne(i,e.adler>>24&255),ne(i,255&e.total_in),ne(i,e.total_in>>8&255),ne(i,e.total_in>>16&255),ne(i,e.total_in>>24&255)):(re(i,e.adler>>>16),re(i,65535&e.adler)),ee(e),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?d:g)},n.deflateEnd=function(e){var t;return e&&e.state?(t=e.state.status)!==N&&t!==P&&t!==U&&t!==q&&t!==V&&t!==Z&&t!==W?J(e,v):(e.state=null,t===Z?J(e,m):d):v},n.deflateSetDictionary=function(e,t){var n,r,a,s,u,l,c,f,h=t.length;if(!e||!e.state)return v;if(2===(s=(n=e.state).wrap)||1===s&&n.status!==N||n.lookahead)return v;for(1===s&&(e.adler=o(e.adler,t,h,0)),n.wrap=0,h>=n.w_size&&(0===s&&(Q(n.head),n.strstart=0,n.block_start=0,n.insert=0),f=new i.Buf8(n.w_size),i.arraySet(f,t,h-n.w_size,n.w_size,0),t=f,h=n.w_size),u=e.avail_in,l=e.next_in,c=e.input,e.avail_in=h,e.next_in=0,e.input=t,ae(n);n.lookahead>=O;){r=n.strstart,a=n.lookahead-(O-1);do{n.ins_h=(n.ins_h<>>=b=w>>>24,d-=b,0===(b=w>>>16&255))A[a++]=65535&w;else{if(!(16&b)){if(0==(64&b)){w=g[(65535&w)+(p&(1<>>=b,d-=b),d<15&&(p+=S[r++]<>>=b=w>>>24,d-=b,!(16&(b=w>>>16&255))){if(0==(64&b)){w=v[(65535&w)+(p&(1<u){e.msg="invalid distance too far back",n.mode=30;break e}if(p>>>=b,d-=b,x>(b=a-o)){if((b=x-b)>c&&n.sane){e.msg="invalid distance too far back",n.mode=30;break e}if(k=0,E=h,0===f){if(k+=l-b,b2;)A[a++]=E[k++],A[a++]=E[k++],A[a++]=E[k++],y-=3;y&&(A[a++]=E[k++],y>1&&(A[a++]=E[k++]))}else{k=a-x;do{A[a++]=A[k++],A[a++]=A[k++],A[a++]=A[k++],y-=3}while(y>2);y&&(A[a++]=A[k++],y>1&&(A[a++]=A[k++]))}break}}break}}while(r>3,p&=(1<<(d-=y<<3))-1,e.next_in=r,e.next_out=a,e.avail_in=r>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function ie(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=x,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new r.Buf32(ee),t.distcode=t.distdyn=new r.Buf32(te),t.sane=1,t.back=-1,d):m}function ae(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,ie(e)):m}function oe(e,t){var n,r;return e&&e.state?(r=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?m:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,ae(e))):m}function se(e,t){var n,i;return e?(i=new function(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0},e.state=i,i.window=null,(n=oe(e,t))!==d&&(e.state=null),n):m}var ue,le,ce=!0;function fe(e){if(ce){var t;for(ue=new r.Buf32(512),le=new r.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(s(l,e.lens,0,288,ue,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;s(c,e.lens,0,32,le,0,e.work,{bits:5}),ce=!1}e.lencode=ue,e.lenbits=9,e.distcode=le,e.distbits=5}function he(e,t,n,i){var a,o=e.state;return null===o.window&&(o.wsize=1<=o.wsize?(r.arraySet(o.window,t,n-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((a=o.wsize-o.wnext)>i&&(a=i),r.arraySet(o.window,t,n-i,a,o.wnext),(i-=a)?(r.arraySet(o.window,t,n-i,i,0),o.wnext=i,o.whave=o.wsize):(o.wnext+=a,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,n.check=a(n.check,Te,2,0),se=0,ue=0,n.mode=k;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&se)<<8)+(se>>8))%31){e.msg="incorrect header check",n.mode=J;break}if((15&se)!==y){e.msg="unknown compression method",n.mode=J;break}if(ue-=4,xe=8+(15&(se>>>=4)),0===n.wbits)n.wbits=xe;else if(xe>n.wbits){e.msg="invalid window size",n.mode=J;break}n.dmax=1<>8&1),512&n.flags&&(Te[0]=255&se,Te[1]=se>>>8&255,n.check=a(n.check,Te,2,0)),se=0,ue=0,n.mode=E;case E:for(;ue<32;){if(0===ae)break e;ae--,se+=ee[ne++]<>>8&255,Te[2]=se>>>16&255,Te[3]=se>>>24&255,n.check=a(n.check,Te,4,0)),se=0,ue=0,n.mode=S;case S:for(;ue<16;){if(0===ae)break e;ae--,se+=ee[ne++]<>8),512&n.flags&&(Te[0]=255&se,Te[1]=se>>>8&255,n.check=a(n.check,Te,2,0)),se=0,ue=0,n.mode=A;case A:if(1024&n.flags){for(;ue<16;){if(0===ae)break e;ae--,se+=ee[ne++]<>>8&255,n.check=a(n.check,Te,2,0)),se=0,ue=0}else n.head&&(n.head.extra=null);n.mode=T;case T:if(1024&n.flags&&((pe=n.length)>ae&&(pe=ae),pe&&(n.head&&(xe=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),r.arraySet(n.head.extra,ee,ne,pe,xe)),512&n.flags&&(n.check=a(n.check,ee,pe,ne)),ae-=pe,ne+=pe,n.length-=pe),n.length))break e;n.length=0,n.mode=M;case M:if(2048&n.flags){if(0===ae)break e;pe=0;do{xe=ee[ne+pe++],n.head&&xe&&n.length<65536&&(n.head.name+=String.fromCharCode(xe))}while(xe&&pe>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=B;break;case R:for(;ue<32;){if(0===ae)break e;ae--,se+=ee[ne++]<>>=7&ue,ue-=7&ue,n.mode=Y;break}for(;ue<3;){if(0===ae)break e;ae--,se+=ee[ne++]<>>=1)){case 0:n.mode=O;break;case 1:if(fe(n),n.mode=U,t===p){se>>>=2,ue-=2;break e}break;case 2:n.mode=F;break;case 3:e.msg="invalid block type",n.mode=J}se>>>=2,ue-=2;break;case O:for(se>>>=7&ue,ue-=7&ue;ue<32;){if(0===ae)break e;ae--,se+=ee[ne++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=J;break}if(n.length=65535&se,se=0,ue=0,n.mode=z,t===p)break e;case z:n.mode=D;case D:if(pe=n.length){if(pe>ae&&(pe=ae),pe>oe&&(pe=oe),0===pe)break e;r.arraySet(te,ee,ne,pe,ie),ae-=pe,ne+=pe,oe-=pe,ie+=pe,n.length-=pe;break}n.mode=B;break;case F:for(;ue<14;){if(0===ae)break e;ae--,se+=ee[ne++]<>>=5,ue-=5,n.ndist=1+(31&se),se>>>=5,ue-=5,n.ncode=4+(15&se),se>>>=4,ue-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=J;break}n.have=0,n.mode=N;case N:for(;n.have>>=3,ue-=3}for(;n.have<19;)n.lens[Me[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,Ee={bits:n.lenbits},ke=s(u,n.lens,0,19,n.lencode,0,n.work,Ee),n.lenbits=Ee.bits,ke){e.msg="invalid code lengths set",n.mode=J;break}n.have=0,n.mode=P;case P:for(;n.have>>16&255,_e=65535&Ae,!((ve=Ae>>>24)<=ue);){if(0===ae)break e;ae--,se+=ee[ne++]<>>=ve,ue-=ve,n.lens[n.have++]=_e;else{if(16===_e){for(Se=ve+2;ue>>=ve,ue-=ve,0===n.have){e.msg="invalid bit length repeat",n.mode=J;break}xe=n.lens[n.have-1],pe=3+(3&se),se>>>=2,ue-=2}else if(17===_e){for(Se=ve+3;ue>>=ve)),se>>>=3,ue-=3}else{for(Se=ve+7;ue>>=ve)),se>>>=7,ue-=7}if(n.have+pe>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=J;break}for(;pe--;)n.lens[n.have++]=xe}}if(n.mode===J)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=J;break}if(n.lenbits=9,Ee={bits:n.lenbits},ke=s(l,n.lens,0,n.nlen,n.lencode,0,n.work,Ee),n.lenbits=Ee.bits,ke){e.msg="invalid literal/lengths set",n.mode=J;break}if(n.distbits=6,n.distcode=n.distdyn,Ee={bits:n.distbits},ke=s(c,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,Ee),n.distbits=Ee.bits,ke){e.msg="invalid distances set",n.mode=J;break}if(n.mode=U,t===p)break e;case U:n.mode=q;case q:if(ae>=6&&oe>=258){e.next_out=ie,e.avail_out=oe,e.next_in=ne,e.avail_in=ae,n.hold=se,n.bits=ue,o(e,ce),ie=e.next_out,te=e.output,oe=e.avail_out,ne=e.next_in,ee=e.input,ae=e.avail_in,se=n.hold,ue=n.bits,n.mode===B&&(n.back=-1);break}for(n.back=0;me=(Ae=n.lencode[se&(1<>>16&255,_e=65535&Ae,!((ve=Ae>>>24)<=ue);){if(0===ae)break e;ae--,se+=ee[ne++]<>we)])>>>16&255,_e=65535&Ae,!(we+(ve=Ae>>>24)<=ue);){if(0===ae)break e;ae--,se+=ee[ne++]<>>=we,ue-=we,n.back+=we}if(se>>>=ve,ue-=ve,n.back+=ve,n.length=_e,0===me){n.mode=H;break}if(32&me){n.back=-1,n.mode=B;break}if(64&me){e.msg="invalid literal/length code",n.mode=J;break}n.extra=15&me,n.mode=V;case V:if(n.extra){for(Se=n.extra;ue>>=n.extra,ue-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=Z;case Z:for(;me=(Ae=n.distcode[se&(1<>>16&255,_e=65535&Ae,!((ve=Ae>>>24)<=ue);){if(0===ae)break e;ae--,se+=ee[ne++]<>we)])>>>16&255,_e=65535&Ae,!(we+(ve=Ae>>>24)<=ue);){if(0===ae)break e;ae--,se+=ee[ne++]<>>=we,ue-=we,n.back+=we}if(se>>>=ve,ue-=ve,n.back+=ve,64&me){e.msg="invalid distance code",n.mode=J;break}n.offset=_e,n.extra=15&me,n.mode=W;case W:if(n.extra){for(Se=n.extra;ue>>=n.extra,ue-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=J;break}n.mode=G;case G:if(0===oe)break e;if(pe=ce-oe,n.offset>pe){if((pe=n.offset-pe)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=J;break}pe>n.wnext?(pe-=n.wnext,de=n.wsize-pe):de=n.wnext-pe,pe>n.length&&(pe=n.length),ge=n.window}else ge=te,de=ie-n.offset,pe=n.length;pe>oe&&(pe=oe),oe-=pe,n.length-=pe;do{te[ie++]=ge[de++]}while(--pe);0===n.length&&(n.mode=q);break;case H:if(0===oe)break e;te[ie++]=n.length,oe--,n.mode=q;break;case Y:if(n.wrap){for(;ue<32;){if(0===ae)break e;ae--,se|=ee[ne++]<=1&&0===O[A];A--);if(T>A&&(T=A),0===A)return l[c++]=20971520,l[c++]=20971520,h.bits=1,0;for(S=1;S0&&(0===e||1!==A))return-1;for(z[1]=0,k=1;k<15;k++)z[k+1]=z[k]+O[k];for(E=0;E852||2===e&&R>592)return 1;for(;;){w=k-I,f[E]<_?(b=0,y=f[E]):f[E]>_?(b=D[F+f[E]],y=B[C+f[E]]):(b=96,y=0),p=1<>I)+(d-=p)]=w<<24|b<<16|y|0}while(0!==d);for(p=1<>=1;if(0!==p?(L&=p-1,L+=p):L=0,E++,0==--O[k]){if(k===A)break;k=t[n+f[E]]}if(k>T&&(L&v)!==g){for(0===I&&(I=T),m+=S,j=1<<(M=k-I);M+I852||2===e&&R>592)return 1;l[g=L&v]=T<<24|M<<16|m-c|0}}return 0!==L&&(l[m+L]=k-I<<24|64<<16|0),h.bits=T,0}},{"../utils/common":44}],52:[function(e,t,n){"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],53:[function(e,t,n){"use strict";var r=e("../utils/common"),i=4,a=0,o=1,s=2;function u(e){for(var t=e.length;--t>=0;)e[t]=0}var l=0,c=1,f=2,h=29,p=256,d=p+1+h,g=30,v=19,m=2*d+1,_=15,w=16,b=7,y=256,x=16,k=17,E=18,S=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],A=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],T=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],M=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],I=new Array(2*(d+2));u(I);var j=new Array(2*g);u(j);var R=new Array(512);u(R);var L=new Array(256);u(L);var B=new Array(h);u(B);var C,O,z,D=new Array(g);function F(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}function N(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function P(e){return e<256?R[e]:R[256+(e>>>7)]}function U(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function q(e,t,n){e.bi_valid>w-n?(e.bi_buf|=t<>w-e.bi_valid,e.bi_valid+=n-w):(e.bi_buf|=t<>>=1,n<<=1}while(--t>0);return n>>>1}function W(e,t,n){var r,i,a=new Array(_+1),o=0;for(r=1;r<=_;r++)a[r]=o=o+n[r-1]<<1;for(i=0;i<=t;i++){var s=e[2*i+1];0!==s&&(e[2*i]=Z(a[s]++,s))}}function G(e){var t;for(t=0;t8?U(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function Y(e,t,n,r){var i=2*t,a=2*n;return e[i]>1;n>=1;n--)$(e,a,n);i=u;do{n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],$(e,a,1),r=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=r,a[2*i]=a[2*n]+a[2*r],e.depth[i]=(e.depth[n]>=e.depth[r]?e.depth[n]:e.depth[r])+1,a[2*n+1]=a[2*r+1]=i,e.heap[1]=i++,$(e,a,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var n,r,i,a,o,s,u=t.dyn_tree,l=t.max_code,c=t.stat_desc.static_tree,f=t.stat_desc.has_stree,h=t.stat_desc.extra_bits,p=t.stat_desc.extra_base,d=t.stat_desc.max_length,g=0;for(a=0;a<=_;a++)e.bl_count[a]=0;for(u[2*e.heap[e.heap_max]+1]=0,n=e.heap_max+1;nd&&(a=d,g++),u[2*r+1]=a,r>l||(e.bl_count[a]++,o=0,r>=p&&(o=h[r-p]),s=u[2*r],e.opt_len+=s*(a+o),f&&(e.static_len+=s*(c[2*r+1]+o)));if(0!==g){do{for(a=d-1;0===e.bl_count[a];)a--;e.bl_count[a]--,e.bl_count[a+1]+=2,e.bl_count[d]--,g-=2}while(g>0);for(a=d;0!==a;a--)for(r=e.bl_count[a];0!==r;)(i=e.heap[--n])>l||(u[2*i+1]!==a&&(e.opt_len+=(a-u[2*i+1])*u[2*i],u[2*i+1]=a),r--)}}(e,t),W(a,l,e.bl_count)}function K(e,t,n){var r,i,a=-1,o=t[1],s=0,u=7,l=4;for(0===o&&(u=138,l=3),t[2*(n+1)+1]=65535,r=0;r<=n;r++)i=o,o=t[2*(r+1)+1],++s>=7;r0?(e.strm.data_type===s&&(e.strm.data_type=function(e){var t,n=4093624447;for(t=0;t<=31;t++,n>>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return a;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return o;for(t=32;t=3&&0===e.bl_tree[2*M[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),u=e.opt_len+3+7>>>3,(l=e.static_len+3+7>>>3)<=u&&(u=l)):u=l=n+5,n+4<=u&&-1!==t?te(e,t,n,r):e.strategy===i||l===u?(q(e,(c<<1)+(r?1:0),3),X(e,I,j)):(q(e,(f<<1)+(r?1:0),3),function(e,t,n,r){var i;for(q(e,t-257,5),q(e,n-1,5),q(e,r-4,4),i=0;i>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&n,e.last_lit++,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(L[n]+p+1)]++,e.dyn_dtree[2*P(t)]++),e.last_lit===e.lit_bufsize-1},n._tr_align=function(e){q(e,c<<1,3),V(e,y,I),function(e){16===e.bi_valid?(U(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":44}],54:[function(e,t,n){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],55:[function(e,t,n){n.read=function(e,t,n,r,i){var a,o,s=8*i-r-1,u=(1<>1,c=-7,f=n?i-1:0,h=n?-1:1,p=e[t+f];for(f+=h,a=p&(1<<-c)-1,p>>=-c,c+=s;c>0;a=256*a+e[t+f],f+=h,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=r;c>0;o=256*o+e[t+f],f+=h,c-=8);if(0===a)a=1-l;else{if(a===u)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,r),a-=l}return(p?-1:1)*o*Math.pow(2,a-r)},n.write=function(e,t,n,r,i,a){var o,s,u,l=8*a-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:a-1,d=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),(t+=o+f>=1?h/u:h*Math.pow(2,1-f))*u>=2&&(o++,u/=2),o+f>=c?(s=0,o=c):o+f>=1?(s=(t*u-1)*Math.pow(2,i),o+=f):(s=t*Math.pow(2,f-1)*Math.pow(2,i),o=0));i>=8;e[n+p]=255&s,p+=d,s/=256,i-=8);for(o=o<0;e[n+p]=255&o,p+=d,o/=256,l-=8);e[n+p-d]|=128*g}},{}],56:[function(e,t,n){t.exports=[function(e,t){return{options:e,draw:function(t,n,r){r.stop(!0),r.overrideFlag=!0;var i=this;return t.pixelManipulation({output:function(e,t,n){i.output={src:t,format:n}},changePixel:function(e,t,n,r){return[255-e,255-t,255-n,r]},format:t.format,image:e.image,inBrowser:e.inBrowser,callback:n})},output:void 0,UI:t}},{name:"Invert",description:"Inverts the image.",inputs:{}}]},{}],57:[function(e,t,n){arguments[4][37][0].apply(n,arguments)},{dup:37}],58:[function(e,t,n){"use strict";t.exports=function(e){for(var t=new Array(e),n=0;n>i;0!=(t&o)&&p++;var d=n>>i;return 0!=(n&o)&&d++,function(e,t,n,o,s,u){function l(e,t,n){return en?n:e}var c=r.BitMatrix.createEmpty(o,s);function f(e,t,n,r,i){for(var o=n*i+t,s=0;sd&&(p=d);for(var g=0;gm&&(v=m);for(var _=l(g,2,t-3),w=l(h,2,n-3),b=0,y=-2;y<=2;y++){var x=u[w+y];b+=x[_-2],b+=x[_-1],b+=x[_],b+=x[_+1],b+=x[_+2]}f(e,v,p,b/25,o)}}return c}(u,p,d,t,n,function(e,t,n,r,o){for(var u=new Array(n),l=0;lh&&(f=h);for(var p=0;pg&&(d=g);for(var v=0,m=255,_=0,w=0,b=f*r+d;w_&&(_=x)}if(_-m>s)for(w++,b+=r;w>2*i;if(_-m<=s&&(k=m>>1,c>0&&p>0)){var E=u[c-1][p]+2*u[c][p-1]+u[c-1][p-1]>>2;m=n&&(e++,r+=t.estimatedModuleSize)}),e<3)return!1;for(var a=r/i,o=0,s=0;s=0&&c(n,l);)o[2]++,l--;if(l<0)return null;for(;l>=0&&!c(n,l)&&o[1]<=r;)o[1]++,l--;if(l<0||o[1]>r)return null;for(;l>=0&&c(n,l)&&o[0]<=r;)o[0]++,l--;if(o[0]>r)return null;for(l=t+1;l=r)return null;for(;l=r)return null;var f=o[0]+o[1]+o[2]+o[3]+o[4];return 5*Math.abs(f-i)>=2*i?null:s(o)?u(o,l):null}(r,Math.floor(f),n[2],l);if(null!=h&&null!=(f=function(t,n,r,i){for(var a=e.width,o=[0,0,0,0,0],l=t;l>=0&&c(l,n);)o[2]++,l--;if(l<0)return null;for(;l>=0&&!c(l,n)&&o[1]<=r;)o[1]++,l--;if(l<0||o[1]>r)return null;for(;l>=0&&c(l,n)&&o[0]<=r;)o[0]++,l--;if(o[0]>r)return null;for(l=t+1;l=r)return null;for(;l=r)return null;var f=o[0]+o[1]+o[2]+o[3]+o[4];return 5*Math.abs(f-i)>=i?null:s(o)?u(o,l):null}(Math.floor(f),Math.floor(h),n[2],l))&&(!a||function(t,n,r,i){for(var a=e.height,o=e.width,u=[0,0,0,0,0],l=0;t-l>=0&&c(n-l,t-l);)u[2]++,l++;if(t-l<0||n-l<0)return!1;for(;t-l>=0&&n-l>=0&&!c(n-l,t-l)&&u[1]<=r;)u[1]++,l++;if(t-l<0||n-l<0||u[1]>r)return!1;for(;t-l>=0&&n-l>=0&&c(n-l,t-l)&&u[0]<=r;)u[0]++,l++;if(u[0]>r)return!1;for(l=1;t+l=a||n+l>=o)return!1;for(;t+l=a||n+l>=o||u[3]>=r)return!1;for(;t+l=r)return!1;var f=u[0]+u[1]+u[2]+u[3]+u[4];return Math.abs(f-i)<2*i&&s(u)}(Math.floor(h),Math.floor(f),n[2],l))){for(var p=l/7,d=!1,g=0;g=n){if(null!=e)return a=!0,Math.floor(Math.abs(e.x-t.x)-Math.abs(e.y-t.y))/2;e=t}}),0}var d=e.height,g=e.width,v=Math.floor(3*d/(4*i));v_[2]&&(w+=x-_[2]-v,y=g-1)}_=[0,0,0,0,0],b=0}else _=[_[2],_[3],_[4],1,0],b=3;else _[++b]++;else _[b]++;s(_)&&h(_,w,g,!1)&&(v=_[0],a&&(m=f()))}var k=function(){var e=t.length;if(e<3)return null;if(e>3){var n=0,r=0;t.forEach(function(e){var t=e.estimatedModuleSize;n+=t,r+=t*t});var i=n/e,a=Math.sqrt(r/e-i*i);t.sort(function(e,t){var n=Math.abs(t.estimatedModuleSize-i),r=Math.abs(e.estimatedModuleSize-i);return n3;s++){var u=t[s];Math.abs(u.estimatedModuleSize-i)>o&&(t.splice(s,1),s--)}}return t.length>3&&(n=0,t.forEach(function(e){n+=e.estimatedModuleSize}),i=n/t.length,t.sort(function(e,t){if(t.count===e.count){var n=Math.abs(t.estimatedModuleSize-i),r=Math.abs(e.estimatedModuleSize-i);return n=i&&a>=o?(n=e[0],t=e[1],r=e[2]):o>=a&&o>=i?(n=e[1],t=e[0],r=e[2]):(n=e[2],t=e[0],r=e[1]),function(e,t,n){var r=t.x,i=t.y;return(n.x-r)*(e.y-i)-(n.y-i)*(e.x-r)}(t,n,r)<0){var s=t;t=r,r=s}return{bottomLeft:{x:t.x,y:t.y},topLeft:{x:n.x,y:n.y},topRight:{x:r.x,y:r.y}}}(k):null}},function(e,t,n){"use strict";var r=n(5),i=n(7),a=n(8),o=n(2),s=n(6);function u(e,t,n){for(var r=!0,i=0;ie||o<-1||o>t)throw new Error;r=!1,-1==a?(n[i]=0,r=!0):a==e&&(n[i]=e-1,r=!0),-1==o?(n[i+1]=0,r=!0):o==t&&(n[i+1]=t-1,r=!0)}r=!0;for(i=n.length-2;i>=0&&r;i-=2){a=Math.floor(n[i]),o=Math.floor(n[i+1]);if(a<-1||a>e||o<-1||o>t)throw new Error;r=!1,-1==a?(n[i]=0,r=!0):a==e&&(n[i]=e-1,r=!0),-1==o?(n[i+1]=0,r=!0):o==t&&(n[i+1]=t-1,r=!0)}return n}function l(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))}function c(e,t,n,i,a){t=Math.floor(t),n=Math.floor(n);var o=Math.floor(i*e),s=Math.max(0,t-o),u=Math.min(a.width,t+o);if(u-s<3*e)return null;var l=Math.max(0,n-o),c=Math.min(a.height-1,n+o);return r.findAlignment(s,l,u-s,c-l,e,a)}function f(e,t,n,r,i){e=Math.floor(e),t=Math.floor(t),n=Math.floor(n),r=Math.floor(r);var a=Math.abs(r-t)>Math.abs(n-e);if(a){var o=e;e=t,t=o,o=n,n=r,r=o}for(var s=Math.abs(n-e),u=Math.abs(r-t),c=-s>>1,f=e0){if(v==r)break;v+=h,c-=s}}return 2==p?l(n+f,r,e,t):NaN}function h(e,t,n,r,i){var a=f(e,t,n,r,i),o=1,s=e-(n-e);s<0?(o=e/(e-s),s=0):s>=i.width&&(o=(i.width-1-e)/(s-e),s=i.width-1);var u=t-(r-t)*o;return o=1,u<0?(o=t/(t-u),u=0):u>=i.height&&(o=(i.height-1-t)/(u-t),u=i.height-1),(a+=f(e,t,s=e+(s-e)*o,u,i))-1}function p(e,t,n){var r=h(e.x,e.y,t.x,t.y,n),i=h(t.x,t.y,e.x,e.y,n);return s.isNaN(r)?i/7:s.isNaN(i)?r/7:(r+i)/14}t.extract=function(e,t){var n=function(e,t,n,r){return(p(e,t,r)+p(e,n,r))/2}(t.topLeft,t.topRight,t.bottomLeft,e);if(n<1)return null;var r=function(e,t,n,r){var i=7+(Math.round(l(e.x,e.y,t.x,t.y)/r)+Math.round(l(e.x,e.y,n.x,n.y)/r)>>1);switch(3&i){case 0:i++;break;case 2:i--}return i}(t.topLeft,t.topRight,t.bottomLeft,n);if(!r)return null;var s=function(e){if(e%4!=1)return null;var t=e-17>>2;return t<1||t>40?null:a.getVersionForNumber(t)}(r);if(null==s)return null;var f=s.getDimensionForVersion()-7,h=null;if(s.alignmentPatternCenters.length>0)for(var d=t.topRight.x-t.topLeft.x+t.bottomLeft.x,g=t.topRight.y-t.topLeft.y+t.bottomLeft.y,v=1-3/f,m=t.topLeft.x+v*(d-t.topLeft.x),_=t.topLeft.y+v*(g-t.topLeft.y),w=4;w<=16&&!(h=c(n,m,_,w,e));w<<=1);return function(e,t,n){if(t<=0)return null;for(var r=o.BitMatrix.createEmpty(t,t),a=new Array(t<<1),s=0;s>1),a[f+1]=c;a=i.transformPoints(n,a);try{var h=u(e.width,e.height,a)}catch(e){return null}for(f=0;f>1,s,e.get(Math.floor(h[f]),Math.floor(h[f+1])))}return r}(e,r,function(e,t,n,r,a){var o,s,u,l,c=a-3.5;return null!=r?(o=r.x,s=r.y,u=l=c-3):(o=t.x-e.x+n.x,s=t.y-e.y+n.y,u=l=c),i.quadrilateralToQuadrilateral(3.5,3.5,c,3.5,u,l,3.5,c,e.x,e.y,t.x,t.y,o,s,n.x,n.y)}(t.topLeft,t.topRight,t.bottomLeft,h,r))}},function(e,t,n){"use strict";var r=n(6);function i(e,t,n,r){if(Math.abs(n-e.y)<=t&&Math.abs(r-e.x)<=t){var i=Math.abs(t-e.estimatedModuleSize);return i<=1||i<=e.estimatedModuleSize}return!1}function a(e,t,n,r){return{x:(e.x+n)/2,y:(e.y+t)/2,estimatedModuleSize:(e.estimatedModuleSize+r)/2}}function o(e,t){for(var n=t/2,r=0;r<3;r++)if(Math.abs(t-e[r])>=n)return!1;return!0}function s(e,t){var n=t-e[2]-e[1]/2;return r.isNaN(n)?null:n}t.findAlignment=function(e,t,n,r,u,l){var c=[];function f(e,t,n,r){var u=e[0]+e[1]+e[2],f=s(e,n);if(null==f)return null;var h=function(e,t,n,r,i,a){for(var u=a.height,l=[0,0,0],c=e;c>=0&&a.get(t,c)&&l[1]<=n;)l[1]++,c--;if(c<0||l[1]>n)return null;for(;c>=0&&!a.get(t,c)&&l[0]<=n;)l[0]++,c--;if(l[0]>n)return null;for(c=e+1;cn)return null;for(;cn)return null;var f=l[0]+l[1]+l[2];return 5*Math.abs(f-r)>=2*r?null:o(l,i)?s(l,c):null}(t,Math.floor(f),2*e[1],u,r,l);if(null!=h){var p=(e[0]+e[1]+e[2])/3;for(var d in c){var g=c[d];if(i(g,p,h,f))return a(g,h,f,p)}var v={x:f,y:h,estimatedModuleSize:p};c.push(v)}return null}for(var h=e+n,p=t+(r>>1),d=[0,0,0],g=0;g>1:-(g+1>>1));d[0]=0,d[1]=0,d[2]=0;for(var m=e;m>4&15]+n[e>>8&15]+n[e>>12&15]+n[e>>16&15]+n[e>>20&15]+n[e>>24&15]+n[e>>28&15]},t.isNaN=function(e){return"[object Number]"===Object.prototype.toString.call(e)&&e!==+e}},function(e,t){"use strict";function n(e,t,n,r,i,a,o,s){var u=e-n+i-o,l=t-r+a-s;if(0==u&&0==l)return{a11:n-e,a21:i-n,a31:e,a12:r-t,a22:a-r,a32:t,a13:0,a23:0,a33:1};var c=n-i,f=o-i,h=r-a,p=s-a,d=c*p-f*h,g=(u*p-f*l)/d,v=(c*l-u*h)/d;return{a11:n-e+g*n,a21:o-e+v*o,a31:e,a12:r-t+g*r,a22:s-t+v*s,a32:t,a13:g,a23:v,a33:1}}t.transformPoints=function(e,t){for(var n=t.length,r=e.a11,i=e.a12,a=e.a13,o=e.a21,s=e.a22,u=e.a23,l=e.a31,c=e.a32,f=e.a33,h=0;h40)throw new Error("Invalid version number "+e);return u[e-1]}t.getVersionForNumber=l},function(e,t,n){"use strict";var r=n(2),i=n(10),a=n(6),o=n(12),s=n(8),u=21522,l=[[21522,0],[20773,1],[24188,2],[23371,3],[17913,4],[16590,5],[20375,6],[19104,7],[30660,8],[29427,9],[32170,10],[30877,11],[26159,12],[25368,13],[27713,14],[26998,15],[5769,16],[5054,17],[7399,18],[6608,19],[1890,20],[597,21],[3340,22],[2107,23],[13663,24],[12392,25],[16177,26],[14854,27],[9396,28],[8579,29],[11994,30],[11245,31]],c=[function(e,t){return 0==(e+t&1)},function(e,t){return 0==(1&e)},function(e,t){return t%3==0},function(e,t){return(e+t)%3==0},function(e,t){return 0==((e>>1)+t/3&1)},function(e,t){return(e*t&1)+e*t%3==0},function(e,t){return 0==((e*t&1)+e*t%3&1)},function(e,t){return 0==((e+t&1)+e*t%3&1)}],f=[{ordinal:1,bits:0,name:"M"},{ordinal:0,bits:1,name:"L"},{ordinal:3,bits:2,name:"H"},{ordinal:2,bits:3,name:"Q"}];function h(e,t,n){for(var i=c[n.dataMask],a=e.height,o=function(e){for(var t=e.getDimensionForVersion(),n=new Array(t*t),i=0;i6&&(a.setRegion(t-11,0,3,6),a.setRegion(0,t-11,6,3)),a}(t),s=!0,u=[],l=0,f=0,h=0,p=a-1;p>0;p-=2){6==p&&p--;for(var d=0;d>3&3],dataMask:7&e}}function d(e,t){for(var n=1/0,r=0,i=0;i=0;r--)t=e.copyBit(8,r,t);var i=e.height,a=0,o=i-7;for(r=i-1;r>=o;r--)a=e.copyBit(8,r,a);for(n=i-8;n>2;if(n<=6)return s.getVersionForNumber(n);for(var r=0,i=t-11,a=5;a>=0;a--)for(var o=t-9;o>=i;o--)r=e.copyBit(o,a,r);var u=s.Version.decodeVersionInformation(r);if(null!=u&&u.getDimensionForVersion()==t)return u;for(r=0,o=5;o>=0;o--)for(a=t-9;a>=i;a--)r=e.copyBit(o,a,r);return null!=(u=s.Version.decodeVersionInformation(r))&&u.getDimensionForVersion()==t?u:null}(e);if(!t)return null;var n=g(e);if(!n)return null;var r=n.errorCorrectionLevel,a=h(e,t,n);if(!a)return null;var o=function(e,t,n){if(e.length!=t.totalCodewords)throw new Error("Invalid number of codewords for version; got "+e.length+" expected "+t.totalCodewords);var r=t.getECBlocksForLevel(n),i=0,a=r.ecBlocks;a.forEach(function(e){i+=e.count});var o=new Array(i),s=0;a.forEach(function(e){for(var t=0;t=0&&o[l].codewords.length!=u;)l--;l++;for(var c=u-r.ecCodewordsPerBlock,f=0,h=0;h=t.length)throw new Error("Could not decode alphanumeric char");return t[e].charCodeAt(0)}var a=function(){function e(e,t){this.characterCountBitsForVersions=e,this.bits=t}return e.prototype.getCharacterCountBits=function(e){if(null==this.characterCountBitsForVersions)throw new Error("Character count doesn't apply to this mode");var t;return t=e<=9?0:e<=26?1:2,this.characterCountBitsForVersions[t]},e}(),o=new a([0,0,0],0),s=new a([10,12,14],1),u=new a([9,11,13],2),l=new a([0,0,0],3),c=new a([8,16,16],4),f=new a(null,7),h=new a([8,10,12],8),p=new a(null,5),d=new a(null,9),g=new a([8,10,12],13);function v(e){switch(e){case 0:return o;case 1:return s;case 2:return u;case 3:return l;case 4:return c;case 5:return p;case 7:return f;case 8:return h;case 9:return d;case 13:return g;default:throw new Error("Couldn't decode mode from byte array")}}function m(e){var t=e.readBits(8);if(0==(128&t))return 127&t;if(128==(192&t))return(63&t)<<8|e.readBits(8);if(192==(224&t))return(31&t)<<16|e.readBits(16);throw new Error("Bad ECI bits starting with byte "+t)}function _(e,t,n){if(13*n>e.available())return!1;for(var r=new Array(2*n),i=0;n>0;){var a=e.readBits(13),o=Math.floor(a/96)<<8|a%96;o+=o<959?41377:42657,r[i]=o>>8&255,r[i+1]=255&o,i+=2,n--}return t.val=r,!0}function w(e,t,n){for(;n>=3;){if(e.available()<10)return!1;var r=e.readBits(10);if(r>=1e3)return!1;t.val.push(i(Math.floor(r/100))),t.val.push(i(Math.floor(r/10)%10)),t.val.push(i(r%10)),n-=3}if(2==n){if(e.available()<7)return!1;var a=e.readBits(7);if(a>=100)return!1;t.val.push(i(Math.floor(a/10))),t.val.push(i(a%10))}else if(1==n){if(e.available()<4)return!1;var o=e.readBits(4);if(o>=10)return!1;t.val.push(i(o))}return!0}function b(e,t,n,r){for(var a=t.val.length;n>1;){if(e.available()<11)return!1;var o=e.readBits(11);t.val.push(i(Math.floor(o/45))),t.val.push(i(o%45)),n-=2}if(1==n){if(e.available()<6)return!1;t.val.push(i(e.readBits(6)))}if(r)for(var s=a;se.available())return!1;for(var r=new Array(n),i=0;i30)return null}else if(i==g){var A=a.readBits(4),T=a.readBits(i.getCharacterCountBits(t));if(A==x&&!_(a,k,T))return null}else{var M=a.readBits(i.getCharacterCountBits(t));if(i==s){if(!w(a,k,M))return null}else if(i==u){if(!b(a,k,M,E))return null}else if(i==c){if(!y(a,k,M))return null}else if(i!=h)return null}return k.val}},function(e,t){"use strict";var n=function(){function e(e){this.byteOffset=0,this.bitOffset=0,this.bytes=e}return e.prototype.readBits=function(e){if(e<1||e>32||e>this.available())throw new Error("Cannot read "+e.toString()+" bits");var t=0;if(this.bitOffset>0){var n=8-this.bitOffset,r=e>8-r<<(a=n-r);t=(this.bytes[this.byteOffset]&i)>>a,e-=r,this.bitOffset+=r,8==this.bitOffset&&(this.bitOffset=0,this.byteOffset++)}if(e>0){for(;e>=8;)t=t<<8|255&this.bytes[this.byteOffset],this.byteOffset++,e-=8;if(e>0){var a;i=255>>(a=8-e)<>a,this.bitOffset+=e}}return t},e.prototype.available=function(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset},e}();t.BitStream=n},function(e,t){"use strict";var n=function(){function e(){this.field=new i(285,256,0)}return e.prototype.decode=function(e,t){for(var n=new r(this.field,e),a=new Array(t),o=!0,s=0;s=n/2;){var u=i,l=o;if(o=s,(i=a).isZero())return null;a=u;for(var c=this.field.zero,f=i.getCoefficient(i.degree()),h=this.field.inverse(f);a.degree()>=i.degree()&&!a.isZero();){var p=a.degree()-i.degree(),d=this.field.multiply(a.getCoefficient(a.degree()),h);c=c.addOrSubtract(this.field.buildMonomial(p,d)),a=a.addOrSubtract(i.multiplyByMonomial(p,d))}if(s=c.multiplyPoly(o).addOrSubtract(l),a.degree()>=i.degree())return null}var g=s.getCoefficient(0);if(0==g)return null;var v=this.field.inverse(g);return[s.multiply(v),a.multiply(v)]},e.prototype.findErrorLocations=function(e){var t=e.degree();if(1==t)return[e.getCoefficient(1)];for(var n=new Array(t),r=0,i=1;i1&&0==t[0]){for(var r=1;rr.length){var a=n;n=r,r=a}for(var o=new Array(r.length),s=r.length-n.length,u=0;u=this.size&&(e^=this.primitive,e&=this.size-1);for(t=0;t>>1,F=[["ary",x],["bind",g],["bindKey",v],["curry",_],["curryRight",w],["flip",E],["partial",b],["partialRight",y],["rearg",k]],N="[object Arguments]",P="[object Array]",U="[object AsyncFunction]",q="[object Boolean]",V="[object Date]",Z="[object DOMException]",W="[object Error]",G="[object Function]",H="[object GeneratorFunction]",Y="[object Map]",$="[object Number]",X="[object Null]",J="[object Object]",K="[object Proxy]",Q="[object RegExp]",ee="[object Set]",te="[object String]",ne="[object Symbol]",re="[object Undefined]",ie="[object WeakMap]",ae="[object WeakSet]",oe="[object ArrayBuffer]",se="[object DataView]",ue="[object Float32Array]",le="[object Float64Array]",ce="[object Int8Array]",fe="[object Int16Array]",he="[object Int32Array]",pe="[object Uint8Array]",de="[object Uint8ClampedArray]",ge="[object Uint16Array]",ve="[object Uint32Array]",me=/\b__p \+= '';/g,_e=/\b(__p \+=) '' \+/g,we=/(__e\(.*?\)|\b__t\)) \+\n'';/g,be=/&(?:amp|lt|gt|quot|#39);/g,ye=/[&<>"']/g,xe=RegExp(be.source),ke=RegExp(ye.source),Ee=/<%-([\s\S]+?)%>/g,Se=/<%([\s\S]+?)%>/g,Ae=/<%=([\s\S]+?)%>/g,Te=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Me=/^\w*$/,Ie=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,je=/[\\^$.*+?()[\]{}|]/g,Re=RegExp(je.source),Le=/^\s+|\s+$/g,Be=/^\s+/,Ce=/\s+$/,Oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ze=/\{\n\/\* \[wrapped with (.+)\] \*/,De=/,? & /,Fe=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Ne=/\\(\\)?/g,Pe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ue=/\w*$/,qe=/^[-+]0x[0-9a-f]+$/i,Ve=/^0b[01]+$/i,Ze=/^\[object .+?Constructor\]$/,We=/^0o[0-7]+$/i,Ge=/^(?:0|[1-9]\d*)$/,He=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ye=/($^)/,$e=/['\n\r\u2028\u2029\\]/g,Xe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Je="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ke="[\\ud800-\\udfff]",Qe="["+Je+"]",et="["+Xe+"]",tt="\\d+",nt="[\\u2700-\\u27bf]",rt="[a-z\\xdf-\\xf6\\xf8-\\xff]",it="[^\\ud800-\\udfff"+Je+tt+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",at="\\ud83c[\\udffb-\\udfff]",ot="[^\\ud800-\\udfff]",st="(?:\\ud83c[\\udde6-\\uddff]){2}",ut="[\\ud800-\\udbff][\\udc00-\\udfff]",lt="[A-Z\\xc0-\\xd6\\xd8-\\xde]",ct="(?:"+rt+"|"+it+")",ft="(?:"+lt+"|"+it+")",ht="(?:"+et+"|"+at+")"+"?",pt="[\\ufe0e\\ufe0f]?"+ht+("(?:\\u200d(?:"+[ot,st,ut].join("|")+")[\\ufe0e\\ufe0f]?"+ht+")*"),dt="(?:"+[nt,st,ut].join("|")+")"+pt,gt="(?:"+[ot+et+"?",et,st,ut,Ke].join("|")+")",vt=RegExp("['’]","g"),mt=RegExp(et,"g"),_t=RegExp(at+"(?="+at+")|"+gt+pt,"g"),wt=RegExp([lt+"?"+rt+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[Qe,lt,"$"].join("|")+")",ft+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[Qe,lt+ct,"$"].join("|")+")",lt+"?"+ct+"+(?:['’](?:d|ll|m|re|s|t|ve))?",lt+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",tt,dt].join("|"),"g"),bt=RegExp("[\\u200d\\ud800-\\udfff"+Xe+"\\ufe0e\\ufe0f]"),yt=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,xt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],kt=-1,Et={};Et[ue]=Et[le]=Et[ce]=Et[fe]=Et[he]=Et[pe]=Et[de]=Et[ge]=Et[ve]=!0,Et[N]=Et[P]=Et[oe]=Et[q]=Et[se]=Et[V]=Et[W]=Et[G]=Et[Y]=Et[$]=Et[J]=Et[Q]=Et[ee]=Et[te]=Et[ie]=!1;var St={};St[N]=St[P]=St[oe]=St[se]=St[q]=St[V]=St[ue]=St[le]=St[ce]=St[fe]=St[he]=St[Y]=St[$]=St[J]=St[Q]=St[ee]=St[te]=St[ne]=St[pe]=St[de]=St[ge]=St[ve]=!0,St[W]=St[G]=St[ie]=!1;var At={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Tt=parseFloat,Mt=parseInt,It="object"==typeof e&&e&&e.Object===Object&&e,jt="object"==typeof self&&self&&self.Object===Object&&self,Rt=It||jt||Function("return this")(),Lt="object"==typeof n&&n&&!n.nodeType&&n,Bt=Lt&&"object"==typeof t&&t&&!t.nodeType&&t,Ct=Bt&&Bt.exports===Lt,Ot=Ct&&It.process,zt=function(){try{var e=Bt&&Bt.require&&Bt.require("util").types;return e||Ot&&Ot.binding&&Ot.binding("util")}catch(e){}}(),Dt=zt&&zt.isArrayBuffer,Ft=zt&&zt.isDate,Nt=zt&&zt.isMap,Pt=zt&&zt.isRegExp,Ut=zt&&zt.isSet,qt=zt&&zt.isTypedArray;function Vt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Zt(e,t,n,r){for(var i=-1,a=null==e?0:e.length;++i-1}function Xt(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function wn(e,t){for(var n=e.length;n--&&on(t,e[n],0)>-1;);return n}var bn=fn({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),yn=fn({"&":"&","<":"<",">":">",'"':""","'":"'"});function xn(e){return"\\"+At[e]}function kn(e){return bt.test(e)}function En(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function Sn(e,t){return function(n){return e(t(n))}}function An(e,t){for(var n=-1,r=e.length,i=0,a=[];++n",""":'"',"'":"'"});var Bn=function e(t){var n,Xe=(t=null==t?Rt:Bn.defaults(Rt.Object(),t,Bn.pick(Rt,xt))).Array,Je=t.Date,Ke=t.Error,Qe=t.Function,et=t.Math,tt=t.Object,nt=t.RegExp,rt=t.String,it=t.TypeError,at=Xe.prototype,ot=Qe.prototype,st=tt.prototype,ut=t["__core-js_shared__"],lt=ot.toString,ct=st.hasOwnProperty,ft=0,ht=(n=/[^.]+$/.exec(ut&&ut.keys&&ut.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",pt=st.toString,dt=lt.call(tt),gt=Rt._,_t=nt("^"+lt.call(ct).replace(je,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),bt=Ct?t.Buffer:r,At=t.Symbol,It=t.Uint8Array,jt=bt?bt.allocUnsafe:r,Lt=Sn(tt.getPrototypeOf,tt),Bt=tt.create,Ot=st.propertyIsEnumerable,zt=at.splice,nn=At?At.isConcatSpreadable:r,fn=At?At.iterator:r,Cn=At?At.toStringTag:r,On=function(){try{var e=Na(tt,"defineProperty");return e({},"",{}),e}catch(e){}}(),zn=t.clearTimeout!==Rt.clearTimeout&&t.clearTimeout,Dn=Je&&Je.now!==Rt.Date.now&&Je.now,Fn=t.setTimeout!==Rt.setTimeout&&t.setTimeout,Nn=et.ceil,Pn=et.floor,Un=tt.getOwnPropertySymbols,qn=bt?bt.isBuffer:r,Vn=t.isFinite,Zn=at.join,Wn=Sn(tt.keys,tt),Gn=et.max,Hn=et.min,Yn=Je.now,$n=t.parseInt,Xn=et.random,Jn=at.reverse,Kn=Na(t,"DataView"),Qn=Na(t,"Map"),er=Na(t,"Promise"),tr=Na(t,"Set"),nr=Na(t,"WeakMap"),rr=Na(tt,"create"),ir=nr&&new nr,ar={},or=co(Kn),sr=co(Qn),ur=co(er),lr=co(tr),cr=co(nr),fr=At?At.prototype:r,hr=fr?fr.valueOf:r,pr=fr?fr.toString:r;function dr(e){if(Ms(e)&&!ms(e)&&!(e instanceof _r)){if(e instanceof mr)return e;if(ct.call(e,"__wrapped__"))return fo(e)}return new mr(e)}var gr=function(){function e(){}return function(t){if(!Ts(t))return{};if(Bt)return Bt(t);e.prototype=t;var n=new e;return e.prototype=r,n}}();function vr(){}function mr(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=r}function _r(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=O,this.__views__=[]}function wr(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function zr(e,t,n,i,a,o){var s,u=t&c,l=t&f,p=t&h;if(n&&(s=a?n(e,i,a,o):n(e)),s!==r)return s;if(!Ts(e))return e;var d=ms(e);if(d){if(s=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&ct.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!u)return ra(e,s)}else{var g=qa(e),v=g==G||g==H;if(ys(e))return Ji(e,u);if(g==J||g==N||v&&!a){if(s=l||v?{}:Za(e),!u)return l?function(e,t){return ia(e,Ua(e),t)}(e,function(e,t){return e&&ia(t,au(t),e)}(s,e)):function(e,t){return ia(e,Pa(e),t)}(e,Lr(s,e))}else{if(!St[g])return a?e:{};s=function(e,t,n){var r,i,a,o=e.constructor;switch(t){case oe:return Ki(e);case q:case V:return new o(+e);case se:return function(e,t){var n=t?Ki(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case ue:case le:case ce:case fe:case he:case pe:case de:case ge:case ve:return Qi(e,n);case Y:return new o;case $:case te:return new o(e);case Q:return(a=new(i=e).constructor(i.source,Ue.exec(i))).lastIndex=i.lastIndex,a;case ee:return new o;case ne:return r=e,hr?tt(hr.call(r)):{}}}(e,g,u)}}o||(o=new kr);var m=o.get(e);if(m)return m;if(o.set(e,s),Bs(e))return e.forEach(function(r){s.add(zr(r,t,n,r,e,o))}),s;if(Is(e))return e.forEach(function(r,i){s.set(i,zr(r,t,n,i,e,o))}),s;var _=d?r:(p?l?La:Ra:l?au:iu)(e);return Wt(_||e,function(r,i){_&&(r=e[i=r]),Ir(s,i,zr(r,t,n,i,e,o))}),s}function Dr(e,t,n){var i=n.length;if(null==e)return!i;for(e=tt(e);i--;){var a=n[i],o=t[a],s=e[a];if(s===r&&!(a in e)||!o(s))return!1}return!0}function Fr(e,t,n){if("function"!=typeof e)throw new it(o);return ro(function(){e.apply(r,n)},t)}function Nr(e,t,n,r){var a=-1,o=$t,s=!0,u=e.length,l=[],c=t.length;if(!u)return l;n&&(t=Jt(t,gn(n))),r?(o=Xt,s=!1):t.length>=i&&(o=mn,s=!1,t=new xr(t));e:for(;++a-1},br.prototype.set=function(e,t){var n=this.__data__,r=jr(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},yr.prototype.clear=function(){this.size=0,this.__data__={hash:new wr,map:new(Qn||br),string:new wr}},yr.prototype.delete=function(e){var t=Da(this,e).delete(e);return this.size-=t?1:0,t},yr.prototype.get=function(e){return Da(this,e).get(e)},yr.prototype.has=function(e){return Da(this,e).has(e)},yr.prototype.set=function(e,t){var n=Da(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},xr.prototype.add=xr.prototype.push=function(e){return this.__data__.set(e,s),this},xr.prototype.has=function(e){return this.__data__.has(e)},kr.prototype.clear=function(){this.__data__=new br,this.size=0},kr.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},kr.prototype.get=function(e){return this.__data__.get(e)},kr.prototype.has=function(e){return this.__data__.has(e)},kr.prototype.set=function(e,t){var n=this.__data__;if(n instanceof br){var r=n.__data__;if(!Qn||r.length0&&n(s)?t>1?Wr(s,t-1,n,r,i):Kt(i,s):r||(i[i.length]=s)}return i}var Gr=ua(),Hr=ua(!0);function Yr(e,t){return e&&Gr(e,t,iu)}function $r(e,t){return e&&Hr(e,t,iu)}function Xr(e,t){return Yt(t,function(t){return Es(e[t])})}function Jr(e,t){for(var n=0,i=(t=Hi(t,e)).length;null!=e&&nt}function ti(e,t){return null!=e&&ct.call(e,t)}function ni(e,t){return null!=e&&t in tt(e)}function ri(e,t,n){for(var i=n?Xt:$t,a=e[0].length,o=e.length,s=o,u=Xe(o),l=1/0,c=[];s--;){var f=e[s];s&&t&&(f=Jt(f,gn(t))),l=Hn(f.length,l),u[s]=!n&&(t||a>=120&&f.length>=120)?new xr(s&&f):r}f=e[0];var h=-1,p=u[0];e:for(;++h=s)return u;var l=n[r];return u*("desc"==l?-1:1)}}return e.index-t.index}(e,t,n)})}function wi(e,t,n){for(var r=-1,i=t.length,a={};++r-1;)s!==e&&zt.call(s,u,1),zt.call(e,u,1);return e}function yi(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==a){var a=i;Ga(i)?zt.call(e,i,1):Ni(e,i)}}return e}function xi(e,t){return e+Pn(Xn()*(t-e+1))}function ki(e,t){var n="";if(!e||t<1||t>L)return n;do{t%2&&(n+=e),(t=Pn(t/2))&&(e+=e)}while(t);return n}function Ei(e,t){return io(eo(e,t,ju),e+"")}function Si(e){return Sr(pu(e))}function Ai(e,t){var n=pu(e);return so(n,Or(t,0,n.length))}function Ti(e,t,n,i){if(!Ts(e))return e;for(var a=-1,o=(t=Hi(t,e)).length,s=o-1,u=e;null!=u&&++ai?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=Xe(i);++r>>1,o=e[a];null!==o&&!Os(o)&&(n?o<=t:o=i){var c=t?null:ka(e);if(c)return Mn(c);s=!1,a=mn,l=new xr}else l=t?[]:u;e:for(;++r=i?e:Ri(e,t,n)}var Xi=zn||function(e){return Rt.clearTimeout(e)};function Ji(e,t){if(t)return e.slice();var n=e.length,r=jt?jt(n):new e.constructor(n);return e.copy(r),r}function Ki(e){var t=new e.constructor(e.byteLength);return new It(t).set(new It(e)),t}function Qi(e,t){var n=t?Ki(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ea(e,t){if(e!==t){var n=e!==r,i=null===e,a=e==e,o=Os(e),s=t!==r,u=null===t,l=t==t,c=Os(t);if(!u&&!c&&!o&&e>t||o&&s&&l&&!u&&!c||i&&s&&l||!n&&l||!a)return 1;if(!i&&!o&&!c&&e1?n[a-1]:r,s=a>2?n[2]:r;for(o=e.length>3&&"function"==typeof o?(a--,o):r,s&&Ha(n[0],n[1],s)&&(o=a<3?r:o,a=1),t=tt(t);++i-1?a[o?t[s]:s]:r}}function pa(e){return ja(function(t){var n=t.length,i=n,a=mr.prototype.thru;for(e&&t.reverse();i--;){var s=t[i];if("function"!=typeof s)throw new it(o);if(a&&!u&&"wrapper"==Ca(s))var u=new mr([],!0)}for(i=u?i:n;++i1&&_.reverse(),f&&lu))return!1;var c=o.get(e);if(c&&o.get(t))return c==t;var f=-1,h=!0,g=n&d?new xr:r;for(o.set(e,t),o.set(t,e);++f-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(Oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return Wt(F,function(n){var r="_."+n[0];t&n[1]&&!$t(e,r)&&e.push(r)}),e.sort()}(function(e){var t=e.match(ze);return t?t[1].split(De):[]}(r),n)))}function oo(e){var t=0,n=0;return function(){var i=Yn(),a=M-(i-n);if(n=i,a>0){if(++t>=T)return arguments[0]}else t=0;return e.apply(r,arguments)}}function so(e,t){var n=-1,i=e.length,a=i-1;for(t=t===r?i:t;++n1?e[t-1]:r;return Lo(e,n="function"==typeof n?(e.pop(),n):r)});function No(e){var t=dr(e);return t.__chain__=!0,t}function Po(e,t){return t(e)}var Uo=ja(function(e){var t=e.length,n=t?e[0]:0,i=this.__wrapped__,a=function(t){return Cr(t,e)};return!(t>1||this.__actions__.length)&&i instanceof _r&&Ga(n)?((i=i.slice(n,+n+(t?1:0))).__actions__.push({func:Po,args:[a],thisArg:r}),new mr(i,this.__chain__).thru(function(e){return t&&!e.length&&e.push(r),e})):this.thru(a)});var qo=aa(function(e,t,n){ct.call(e,n)?++e[n]:Br(e,n,1)});var Vo=ha(vo),Zo=ha(mo);function Wo(e,t){return(ms(e)?Wt:Pr)(e,za(t,3))}function Go(e,t){return(ms(e)?Gt:Ur)(e,za(t,3))}var Ho=aa(function(e,t,n){ct.call(e,n)?e[n].push(t):Br(e,n,[t])});var Yo=Ei(function(e,t,n){var r=-1,i="function"==typeof t,a=ws(e)?Xe(e.length):[];return Pr(e,function(e){a[++r]=i?Vt(t,e,n):ii(e,t,n)}),a}),$o=aa(function(e,t,n){Br(e,n,t)});function Xo(e,t){return(ms(e)?Jt:pi)(e,za(t,3))}var Jo=aa(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]});var Ko=Ei(function(e,t){if(null==e)return[];var n=t.length;return n>1&&Ha(e,t[0],t[1])?t=[]:n>2&&Ha(t[0],t[1],t[2])&&(t=[t[0]]),_i(e,Wr(t,1),[])}),Qo=Dn||function(){return Rt.Date.now()};function es(e,t,n){return t=n?r:t,t=e&&null==t?e.length:t,Sa(e,x,r,r,r,r,t)}function ts(e,t){var n;if("function"!=typeof t)throw new it(o);return e=Us(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=r),n}}var ns=Ei(function(e,t,n){var r=g;if(n.length){var i=An(n,Oa(ns));r|=b}return Sa(e,r,t,n,i)}),rs=Ei(function(e,t,n){var r=g|v;if(n.length){var i=An(n,Oa(rs));r|=b}return Sa(t,r,e,n,i)});function is(e,t,n){var i,a,s,u,l,c,f=0,h=!1,p=!1,d=!0;if("function"!=typeof e)throw new it(o);function g(t){var n=i,o=a;return i=a=r,f=t,u=e.apply(o,n)}function v(e){var n=e-c;return c===r||n>=t||n<0||p&&e-f>=s}function m(){var e=Qo();if(v(e))return _(e);l=ro(m,function(e){var n=t-(e-c);return p?Hn(n,s-(e-f)):n}(e))}function _(e){return l=r,d&&i?g(e):(i=a=r,u)}function w(){var e=Qo(),n=v(e);if(i=arguments,a=this,c=e,n){if(l===r)return function(e){return f=e,l=ro(m,t),h?g(e):u}(c);if(p)return l=ro(m,t),g(c)}return l===r&&(l=ro(m,t)),u}return t=Vs(t)||0,Ts(n)&&(h=!!n.leading,s=(p="maxWait"in n)?Gn(Vs(n.maxWait)||0,t):s,d="trailing"in n?!!n.trailing:d),w.cancel=function(){l!==r&&Xi(l),f=0,i=c=a=l=r},w.flush=function(){return l===r?u:_(Qo())},w}var as=Ei(function(e,t){return Fr(e,1,t)}),os=Ei(function(e,t,n){return Fr(e,Vs(t)||0,n)});function ss(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new it(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(ss.Cache||yr),n}function us(e){if("function"!=typeof e)throw new it(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}ss.Cache=yr;var ls=Yi(function(e,t){var n=(t=1==t.length&&ms(t[0])?Jt(t[0],gn(za())):Jt(Wr(t,1),gn(za()))).length;return Ei(function(r){for(var i=-1,a=Hn(r.length,n);++i=t}),vs=ai(function(){return arguments}())?ai:function(e){return Ms(e)&&ct.call(e,"callee")&&!Ot.call(e,"callee")},ms=Xe.isArray,_s=Dt?gn(Dt):function(e){return Ms(e)&&Qr(e)==oe};function ws(e){return null!=e&&As(e.length)&&!Es(e)}function bs(e){return Ms(e)&&ws(e)}var ys=qn||Vu,xs=Ft?gn(Ft):function(e){return Ms(e)&&Qr(e)==V};function ks(e){if(!Ms(e))return!1;var t=Qr(e);return t==W||t==Z||"string"==typeof e.message&&"string"==typeof e.name&&!Rs(e)}function Es(e){if(!Ts(e))return!1;var t=Qr(e);return t==G||t==H||t==U||t==K}function Ss(e){return"number"==typeof e&&e==Us(e)}function As(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=L}function Ts(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Ms(e){return null!=e&&"object"==typeof e}var Is=Nt?gn(Nt):function(e){return Ms(e)&&qa(e)==Y};function js(e){return"number"==typeof e||Ms(e)&&Qr(e)==$}function Rs(e){if(!Ms(e)||Qr(e)!=J)return!1;var t=Lt(e);if(null===t)return!0;var n=ct.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&<.call(n)==dt}var Ls=Pt?gn(Pt):function(e){return Ms(e)&&Qr(e)==Q};var Bs=Ut?gn(Ut):function(e){return Ms(e)&&qa(e)==ee};function Cs(e){return"string"==typeof e||!ms(e)&&Ms(e)&&Qr(e)==te}function Os(e){return"symbol"==typeof e||Ms(e)&&Qr(e)==ne}var zs=qt?gn(qt):function(e){return Ms(e)&&As(e.length)&&!!Et[Qr(e)]};var Ds=ba(hi),Fs=ba(function(e,t){return e<=t});function Ns(e){if(!e)return[];if(ws(e))return Cs(e)?Rn(e):ra(e);if(fn&&e[fn])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[fn]());var t=qa(e);return(t==Y?En:t==ee?Mn:pu)(e)}function Ps(e){return e?(e=Vs(e))===R||e===-R?(e<0?-1:1)*B:e==e?e:0:0===e?e:0}function Us(e){var t=Ps(e),n=t%1;return t==t?n?t-n:t:0}function qs(e){return e?Or(Us(e),0,O):0}function Vs(e){if("number"==typeof e)return e;if(Os(e))return C;if(Ts(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Ts(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(Le,"");var n=Ve.test(e);return n||We.test(e)?Mt(e.slice(2),n?2:8):qe.test(e)?C:+e}function Zs(e){return ia(e,au(e))}function Ws(e){return null==e?"":Di(e)}var Gs=oa(function(e,t){if(Ja(t)||ws(t))ia(t,iu(t),e);else for(var n in t)ct.call(t,n)&&Ir(e,n,t[n])}),Hs=oa(function(e,t){ia(t,au(t),e)}),Ys=oa(function(e,t,n,r){ia(t,au(t),e,r)}),$s=oa(function(e,t,n,r){ia(t,iu(t),e,r)}),Xs=ja(Cr);var Js=Ei(function(e,t){e=tt(e);var n=-1,i=t.length,a=i>2?t[2]:r;for(a&&Ha(t[0],t[1],a)&&(i=1);++n1),t}),ia(e,La(e),n),r&&(n=zr(n,c|f|h,Ma));for(var i=t.length;i--;)Ni(n,t[i]);return n});var lu=ja(function(e,t){return null==e?{}:function(e,t){return wi(e,t,function(t,n){return eu(e,n)})}(e,t)});function cu(e,t){if(null==e)return{};var n=Jt(La(e),function(e){return[e]});return t=za(t),wi(e,n,function(e,n){return t(e,n[0])})}var fu=Ea(iu),hu=Ea(au);function pu(e){return null==e?[]:vn(e,iu(e))}var du=ca(function(e,t,n){return t=t.toLowerCase(),e+(n?gu(t):t)});function gu(e){return ku(Ws(e).toLowerCase())}function vu(e){return(e=Ws(e))&&e.replace(He,bn).replace(mt,"")}var mu=ca(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),_u=ca(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),wu=la("toLowerCase");var bu=ca(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()});var yu=ca(function(e,t,n){return e+(n?" ":"")+ku(t)});var xu=ca(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),ku=la("toUpperCase");function Eu(e,t,n){return e=Ws(e),(t=n?r:t)===r?function(e){return yt.test(e)}(e)?function(e){return e.match(wt)||[]}(e):function(e){return e.match(Fe)||[]}(e):e.match(t)||[]}var Su=Ei(function(e,t){try{return Vt(e,r,t)}catch(e){return ks(e)?e:new Ke(e)}}),Au=ja(function(e,t){return Wt(t,function(t){t=lo(t),Br(e,t,ns(e[t],e))}),e});function Tu(e){return function(){return e}}var Mu=pa(),Iu=pa(!0);function ju(e){return e}function Ru(e){return li("function"==typeof e?e:zr(e,c))}var Lu=Ei(function(e,t){return function(n){return ii(n,e,t)}}),Bu=Ei(function(e,t){return function(n){return ii(e,n,t)}});function Cu(e,t,n){var r=iu(t),i=Xr(t,r);null!=n||Ts(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=Xr(t,iu(t)));var a=!(Ts(n)&&"chain"in n&&!n.chain),o=Es(e);return Wt(i,function(n){var r=t[n];e[n]=r,o&&(e.prototype[n]=function(){var t=this.__chain__;if(a||t){var n=e(this.__wrapped__);return(n.__actions__=ra(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,Kt([this.value()],arguments))})}),e}function Ou(){}var zu=ma(Jt),Du=ma(Ht),Fu=ma(tn);function Nu(e){return Ya(e)?cn(lo(e)):function(e){return function(t){return Jr(t,e)}}(e)}var Pu=wa(),Uu=wa(!0);function qu(){return[]}function Vu(){return!1}var Zu=va(function(e,t){return e+t},0),Wu=xa("ceil"),Gu=va(function(e,t){return e/t},1),Hu=xa("floor");var Yu,$u=va(function(e,t){return e*t},1),Xu=xa("round"),Ju=va(function(e,t){return e-t},0);return dr.after=function(e,t){if("function"!=typeof t)throw new it(o);return e=Us(e),function(){if(--e<1)return t.apply(this,arguments)}},dr.ary=es,dr.assign=Gs,dr.assignIn=Hs,dr.assignInWith=Ys,dr.assignWith=$s,dr.at=Xs,dr.before=ts,dr.bind=ns,dr.bindAll=Au,dr.bindKey=rs,dr.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return ms(e)?e:[e]},dr.chain=No,dr.chunk=function(e,t,n){t=(n?Ha(e,t,n):t===r)?1:Gn(Us(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var a=0,o=0,s=Xe(Nn(i/t));aa?0:a+n),(i=i===r||i>a?a:Us(i))<0&&(i+=a),i=n>i?0:qs(i);n>>0)?(e=Ws(e))&&("string"==typeof t||null!=t&&!Ls(t))&&!(t=Di(t))&&kn(e)?$i(Rn(e),0,n):e.split(t,n):[]},dr.spread=function(e,t){if("function"!=typeof e)throw new it(o);return t=null==t?0:Gn(Us(t),0),Ei(function(n){var r=n[t],i=$i(n,0,t);return r&&Kt(i,r),Vt(e,this,i)})},dr.tail=function(e){var t=null==e?0:e.length;return t?Ri(e,1,t):[]},dr.take=function(e,t,n){return e&&e.length?Ri(e,0,(t=n||t===r?1:Us(t))<0?0:t):[]},dr.takeRight=function(e,t,n){var i=null==e?0:e.length;return i?Ri(e,(t=i-(t=n||t===r?1:Us(t)))<0?0:t,i):[]},dr.takeRightWhile=function(e,t){return e&&e.length?Ui(e,za(t,3),!1,!0):[]},dr.takeWhile=function(e,t){return e&&e.length?Ui(e,za(t,3)):[]},dr.tap=function(e,t){return t(e),e},dr.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new it(o);return Ts(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),is(e,t,{leading:r,maxWait:t,trailing:i})},dr.thru=Po,dr.toArray=Ns,dr.toPairs=fu,dr.toPairsIn=hu,dr.toPath=function(e){return ms(e)?Jt(e,lo):Os(e)?[e]:ra(uo(Ws(e)))},dr.toPlainObject=Zs,dr.transform=function(e,t,n){var r=ms(e),i=r||ys(e)||zs(e);if(t=za(t,4),null==n){var a=e&&e.constructor;n=i?r?new a:[]:Ts(e)&&Es(a)?gr(Lt(e)):{}}return(i?Wt:Yr)(e,function(e,r,i){return t(n,e,r,i)}),n},dr.unary=function(e){return es(e,1)},dr.union=Mo,dr.unionBy=Io,dr.unionWith=jo,dr.uniq=function(e){return e&&e.length?Fi(e):[]},dr.uniqBy=function(e,t){return e&&e.length?Fi(e,za(t,2)):[]},dr.uniqWith=function(e,t){return t="function"==typeof t?t:r,e&&e.length?Fi(e,r,t):[]},dr.unset=function(e,t){return null==e||Ni(e,t)},dr.unzip=Ro,dr.unzipWith=Lo,dr.update=function(e,t,n){return null==e?e:Pi(e,t,Gi(n))},dr.updateWith=function(e,t,n,i){return i="function"==typeof i?i:r,null==e?e:Pi(e,t,Gi(n),i)},dr.values=pu,dr.valuesIn=function(e){return null==e?[]:vn(e,au(e))},dr.without=Bo,dr.words=Eu,dr.wrap=function(e,t){return cs(Gi(t),e)},dr.xor=Co,dr.xorBy=Oo,dr.xorWith=zo,dr.zip=Do,dr.zipObject=function(e,t){return Zi(e||[],t||[],Ir)},dr.zipObjectDeep=function(e,t){return Zi(e||[],t||[],Ti)},dr.zipWith=Fo,dr.entries=fu,dr.entriesIn=hu,dr.extend=Hs,dr.extendWith=Ys,Cu(dr,dr),dr.add=Zu,dr.attempt=Su,dr.camelCase=du,dr.capitalize=gu,dr.ceil=Wu,dr.clamp=function(e,t,n){return n===r&&(n=t,t=r),n!==r&&(n=(n=Vs(n))==n?n:0),t!==r&&(t=(t=Vs(t))==t?t:0),Or(Vs(e),t,n)},dr.clone=function(e){return zr(e,h)},dr.cloneDeep=function(e){return zr(e,c|h)},dr.cloneDeepWith=function(e,t){return zr(e,c|h,t="function"==typeof t?t:r)},dr.cloneWith=function(e,t){return zr(e,h,t="function"==typeof t?t:r)},dr.conformsTo=function(e,t){return null==t||Dr(e,t,iu(t))},dr.deburr=vu,dr.defaultTo=function(e,t){return null==e||e!=e?t:e},dr.divide=Gu,dr.endsWith=function(e,t,n){e=Ws(e),t=Di(t);var i=e.length,a=n=n===r?i:Or(Us(n),0,i);return(n-=t.length)>=0&&e.slice(n,a)==t},dr.eq=ps,dr.escape=function(e){return(e=Ws(e))&&ke.test(e)?e.replace(ye,yn):e},dr.escapeRegExp=function(e){return(e=Ws(e))&&Re.test(e)?e.replace(je,"\\$&"):e},dr.every=function(e,t,n){var i=ms(e)?Ht:qr;return n&&Ha(e,t,n)&&(t=r),i(e,za(t,3))},dr.find=Vo,dr.findIndex=vo,dr.findKey=function(e,t){return rn(e,za(t,3),Yr)},dr.findLast=Zo,dr.findLastIndex=mo,dr.findLastKey=function(e,t){return rn(e,za(t,3),$r)},dr.floor=Hu,dr.forEach=Wo,dr.forEachRight=Go,dr.forIn=function(e,t){return null==e?e:Gr(e,za(t,3),au)},dr.forInRight=function(e,t){return null==e?e:Hr(e,za(t,3),au)},dr.forOwn=function(e,t){return e&&Yr(e,za(t,3))},dr.forOwnRight=function(e,t){return e&&$r(e,za(t,3))},dr.get=Qs,dr.gt=ds,dr.gte=gs,dr.has=function(e,t){return null!=e&&Va(e,t,ti)},dr.hasIn=eu,dr.head=wo,dr.identity=ju,dr.includes=function(e,t,n,r){e=ws(e)?e:pu(e),n=n&&!r?Us(n):0;var i=e.length;return n<0&&(n=Gn(i+n,0)),Cs(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&on(e,t,n)>-1},dr.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:Us(n);return i<0&&(i=Gn(r+i,0)),on(e,t,i)},dr.inRange=function(e,t,n){return t=Ps(t),n===r?(n=t,t=0):n=Ps(n),function(e,t,n){return e>=Hn(t,n)&&e=-L&&e<=L},dr.isSet=Bs,dr.isString=Cs,dr.isSymbol=Os,dr.isTypedArray=zs,dr.isUndefined=function(e){return e===r},dr.isWeakMap=function(e){return Ms(e)&&qa(e)==ie},dr.isWeakSet=function(e){return Ms(e)&&Qr(e)==ae},dr.join=function(e,t){return null==e?"":Zn.call(e,t)},dr.kebabCase=mu,dr.last=ko,dr.lastIndexOf=function(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var a=i;return n!==r&&(a=(a=Us(n))<0?Gn(i+a,0):Hn(a,i-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,a):an(e,un,a,!0)},dr.lowerCase=_u,dr.lowerFirst=wu,dr.lt=Ds,dr.lte=Fs,dr.max=function(e){return e&&e.length?Vr(e,ju,ei):r},dr.maxBy=function(e,t){return e&&e.length?Vr(e,za(t,2),ei):r},dr.mean=function(e){return ln(e,ju)},dr.meanBy=function(e,t){return ln(e,za(t,2))},dr.min=function(e){return e&&e.length?Vr(e,ju,hi):r},dr.minBy=function(e,t){return e&&e.length?Vr(e,za(t,2),hi):r},dr.stubArray=qu,dr.stubFalse=Vu,dr.stubObject=function(){return{}},dr.stubString=function(){return""},dr.stubTrue=function(){return!0},dr.multiply=$u,dr.nth=function(e,t){return e&&e.length?mi(e,Us(t)):r},dr.noConflict=function(){return Rt._===this&&(Rt._=gt),this},dr.noop=Ou,dr.now=Qo,dr.pad=function(e,t,n){e=Ws(e);var r=(t=Us(t))?jn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return _a(Pn(i),n)+e+_a(Nn(i),n)},dr.padEnd=function(e,t,n){e=Ws(e);var r=(t=Us(t))?jn(e):0;return t&&rt){var i=e;e=t,t=i}if(n||e%1||t%1){var a=Xn();return Hn(e+a*(t-e+Tt("1e-"+((a+"").length-1))),t)}return xi(e,t)},dr.reduce=function(e,t,n){var r=ms(e)?Qt:hn,i=arguments.length<3;return r(e,za(t,4),n,i,Pr)},dr.reduceRight=function(e,t,n){var r=ms(e)?en:hn,i=arguments.length<3;return r(e,za(t,4),n,i,Ur)},dr.repeat=function(e,t,n){return t=(n?Ha(e,t,n):t===r)?1:Us(t),ki(Ws(e),t)},dr.replace=function(){var e=arguments,t=Ws(e[0]);return e.length<3?t:t.replace(e[1],e[2])},dr.result=function(e,t,n){var i=-1,a=(t=Hi(t,e)).length;for(a||(a=1,e=r);++iL)return[];var n=O,r=Hn(e,O);t=za(t),e-=O;for(var i=dn(r,t);++n=o)return e;var u=n-jn(i);if(u<1)return i;var l=s?$i(s,0,u).join(""):e.slice(0,u);if(a===r)return l+i;if(s&&(u+=l.length-u),Ls(a)){if(e.slice(u).search(a)){var c,f=l;for(a.global||(a=nt(a.source,Ws(Ue.exec(a))+"g")),a.lastIndex=0;c=a.exec(f);)var h=c.index;l=l.slice(0,h===r?u:h)}}else if(e.indexOf(Di(a),u)!=u){var p=l.lastIndexOf(a);p>-1&&(l=l.slice(0,p))}return l+i},dr.unescape=function(e){return(e=Ws(e))&&xe.test(e)?e.replace(be,Ln):e},dr.uniqueId=function(e){var t=++ft;return Ws(e)+t},dr.upperCase=xu,dr.upperFirst=ku,dr.each=Wo,dr.eachRight=Go,dr.first=wo,Cu(dr,(Yu={},Yr(dr,function(e,t){ct.call(dr.prototype,t)||(Yu[t]=e)}),Yu),{chain:!1}),dr.VERSION="4.17.10",Wt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){dr[e].placeholder=dr}),Wt(["drop","take"],function(e,t){_r.prototype[e]=function(n){n=n===r?1:Gn(Us(n),0);var i=this.__filtered__&&!t?new _r(this):this.clone();return i.__filtered__?i.__takeCount__=Hn(n,i.__takeCount__):i.__views__.push({size:Hn(n,O),type:e+(i.__dir__<0?"Right":"")}),i},_r.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),Wt(["filter","map","takeWhile"],function(e,t){var n=t+1,r=n==I||3==n;_r.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:za(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}}),Wt(["head","last"],function(e,t){var n="take"+(t?"Right":"");_r.prototype[e]=function(){return this[n](1).value()[0]}}),Wt(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");_r.prototype[e]=function(){return this.__filtered__?new _r(this):this[n](1)}}),_r.prototype.compact=function(){return this.filter(ju)},_r.prototype.find=function(e){return this.filter(e).head()},_r.prototype.findLast=function(e){return this.reverse().find(e)},_r.prototype.invokeMap=Ei(function(e,t){return"function"==typeof e?new _r(this):this.map(function(n){return ii(n,e,t)})}),_r.prototype.reject=function(e){return this.filter(us(za(e)))},_r.prototype.slice=function(e,t){e=Us(e);var n=this;return n.__filtered__&&(e>0||t<0)?new _r(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==r&&(n=(t=Us(t))<0?n.dropRight(-t):n.take(t-e)),n)},_r.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},_r.prototype.toArray=function(){return this.take(O)},Yr(_r.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),a=dr[i?"take"+("last"==t?"Right":""):t],o=i||/^find/.test(t);a&&(dr.prototype[t]=function(){var t=this.__wrapped__,s=i?[1]:arguments,u=t instanceof _r,l=s[0],c=u||ms(t),f=function(e){var t=a.apply(dr,Kt([e],s));return i&&h?t[0]:t};c&&n&&"function"==typeof l&&1!=l.length&&(u=c=!1);var h=this.__chain__,p=!!this.__actions__.length,d=o&&!h,g=u&&!p;if(!o&&c){t=g?t:new _r(this);var v=e.apply(t,s);return v.__actions__.push({func:Po,args:[f],thisArg:r}),new mr(v,h)}return d&&g?e.apply(this,s):(v=this.thru(f),d?i?v.value()[0]:v.value():v)})}),Wt(["pop","push","shift","sort","splice","unshift"],function(e){var t=at[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);dr.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(ms(i)?i:[],e)}return this[n](function(n){return t.apply(ms(n)?n:[],e)})}}),Yr(_r.prototype,function(e,t){var n=dr[t];if(n){var r=n.name+"";(ar[r]||(ar[r]=[])).push({name:t,func:n})}}),ar[da(r,v).name]=[{name:"wrapper",func:r}],_r.prototype.clone=function(){var e=new _r(this.__wrapped__);return e.__actions__=ra(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=ra(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=ra(this.__views__),e},_r.prototype.reverse=function(){if(this.__filtered__){var e=new _r(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},_r.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=ms(e),r=t<0,i=n?e.length:0,a=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?r:this.__values__[this.__index__++]}},dr.prototype.plant=function(e){for(var t,n=this;n instanceof vr;){var i=fo(n);i.__index__=0,i.__values__=r,t?a.__wrapped__=i:t=i;var a=i;n=n.__wrapped__}return a.__wrapped__=e,t},dr.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof _r){var t=e;return this.__actions__.length&&(t=new _r(this)),(t=t.reverse()).__actions__.push({func:Po,args:[To],thisArg:r}),new mr(t,this.__chain__)}return this.thru(To)},dr.prototype.toJSON=dr.prototype.valueOf=dr.prototype.value=function(){return qi(this.__wrapped__,this.__actions__)},dr.prototype.first=dr.prototype.head,fn&&(dr.prototype[fn]=function(){return this}),dr}();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(Rt._=Bn,define(function(){return Bn})):Bt?((Bt.exports=Bn)._=Bn,Lt._=Bn):Rt._=Bn}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],63:[function(e,t,n){(function(n){e("path");var r=e("fs");function i(){this.types=Object.create(null),this.extensions=Object.create(null)}i.prototype.define=function(e){for(var t in e){for(var r=e[t],i=0;i=0;--s)if(h[s]=f,f*=l[s],p=Math.max(p,o.scratchMemory(l[s])),t.shape[s]!==n.shape[s])throw new Error("Shape mismatch, real and imaginary arrays must have same size");var d,g=4*f+p;d="array"===t.dtype||"float64"===t.dtype||"custom"===t.dtype?a.mallocDouble(g):a.mallocFloat(g);var v,m,_,w,b=i(d,l.slice(0),h,0),y=i(d,l.slice(0),h.slice(0),f),x=i(d,l.slice(0),h.slice(0),2*f),k=i(d,l.slice(0),h.slice(0),3*f),E=4*f;for(r.assign(b,t),r.assign(y,n),s=c-1;s>=0&&(o(e,f/l[s],l[s],d,b.offset,y.offset,E),0!==s);--s){for(m=1,_=x.stride,w=k.stride,u=s-1;u=0;--u)w[u]=_[u]=m,m*=l[u];r.assign(x,b),r.assign(k,y),v=b,b=x,x=v,v=y,y=k,k=v}r.assign(t,b),r.assign(n,y),a.free(d)}},{"./lib/fft-matrix.js":66,ndarray:71,"ndarray-ops":68,"typedarray-pool":130}],66:[function(e,t,n){var r=e("bit-twiddle");function i(e,t,n,i,a,o){var s,u,l,c,f,h,p,d,g,v,m,_,w,b,y,x,k,E,S,A,T,M,I,j;for(e|=0,t|=0,a|=0,o|=0,s=n|=0,u=r.log2(s),E=0;E>1,f=0,l=0;l>=1;f+=h}for(m=-1,_=0,v=1,d=0;d>",rrshift:">>>"};!function(){for(var e in s){var t=s[e];n[e]=o({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+t+"c"},funcName:e}),n[e+"eq"]=o({args:["array","array"],body:{args:["a","b"],body:"a"+t+"=b"},rvalue:!0,funcName:e+"eq"}),n[e+"s"]=o({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+t+"s"},funcName:e+"s"}),n[e+"seq"]=o({args:["array","scalar"],body:{args:["a","s"],body:"a"+t+"=s"},rvalue:!0,funcName:e+"seq"})}}();var u={not:"!",bnot:"~",neg:"-",recip:"1.0/"};!function(){for(var e in u){var t=u[e];n[e]=o({args:["array","array"],body:{args:["a","b"],body:"a="+t+"b"},funcName:e}),n[e+"eq"]=o({args:["array"],body:{args:["a"],body:"a="+t+"a"},rvalue:!0,count:2,funcName:e+"eq"})}}();var l={and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">="};!function(){for(var e in l){var t=l[e];n[e]=o({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+t+"c"},funcName:e}),n[e+"s"]=o({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+t+"s"},funcName:e+"s"}),n[e+"eq"]=o({args:["array","array"],body:{args:["a","b"],body:"a=a"+t+"b"},rvalue:!0,count:2,funcName:e+"eq"}),n[e+"seq"]=o({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+t+"s"},rvalue:!0,count:2,funcName:e+"seq"})}}();var c=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan"];!function(){for(var e=0;ethis_s){this_s=-a}else if(a>this_s){this_s=a}",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norminf"}),n.norm1=r({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:3}],body:"this_s+=a<0?-a:a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm1"}),n.sup=r({args:["array"],pre:{body:"this_h=-Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_>this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}}),n.inf=r({args:["array"],pre:{body:"this_h=Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),n.random=o({args:["array"],pre:{args:[],body:"this_f=Math.random",thisVars:["this_f"]},body:{args:["a"],body:"a=this_f()",thisVars:["this_f"]},funcName:"random"}),n.assign=o({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),n.assigns=o({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),n.equals=r({args:["array","array"],pre:i,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})},{"cwise-compiler":9}],69:[function(e,t,n){"use strict";var r=e("ndarray"),i=e("./doConvert.js");t.exports=function(e,t){for(var n=[],a=e,o=1;Array.isArray(a);)n.push(a.length),o*=a.length,a=a[0];return 0===n.length?r():(t||(t=r(new Float64Array(o),n)),i(t,e),t)}},{"./doConvert.js":70,ndarray:71}],70:[function(e,t,n){t.exports=e("cwise-compiler")({args:["array","scalar","index"],pre:{body:"{}",args:[],thisVars:[],localVars:[]},body:{body:"{\nvar _inline_1_v=_inline_1_arg1_,_inline_1_i\nfor(_inline_1_i=0;_inline_1_i<_inline_1_arg2_.length-1;++_inline_1_i) {\n_inline_1_v=_inline_1_v[_inline_1_arg2_[_inline_1_i]]\n}\n_inline_1_arg0_=_inline_1_v[_inline_1_arg2_[_inline_1_arg2_.length-1]]\n}",args:[{name:"_inline_1_arg0_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg2_",lvalue:!1,rvalue:!0,count:4}],thisVars:[],localVars:["_inline_1_i","_inline_1_v"]},post:{body:"{}",args:[],thisVars:[],localVars:[]},funcName:"convert",blockSize:64})},{"cwise-compiler":9}],71:[function(e,t,n){var r=e("iota-array"),i=e("is-buffer"),a="undefined"!=typeof Float64Array;function o(e,t){return e[0]-t[0]}function s(){var e,t=this.stride,n=new Array(t.length);for(e=0;eMath.abs(this.stride[1]))?[1,0]:[0,1]}})"):3===t&&a.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")):a.push("ORDER})")),a.push("proto.set=function "+n+"_set("+u.join(",")+",v){"),i?a.push("return this.data.set("+c+",v)}"):a.push("return this.data["+c+"]=v}"),a.push("proto.get=function "+n+"_get("+u.join(",")+"){"),i?a.push("return this.data.get("+c+")}"):a.push("return this.data["+c+"]}"),a.push("proto.index=function "+n+"_index(",u.join(),"){return "+c+"}"),a.push("proto.hi=function "+n+"_hi("+u.join(",")+"){return new "+n+"(this.data,"+o.map(function(e){return["(typeof i",e,"!=='number'||i",e,"<0)?this.shape[",e,"]:i",e,"|0"].join("")}).join(",")+","+o.map(function(e){return"this.stride["+e+"]"}).join(",")+",this.offset)}");var p=o.map(function(e){return"a"+e+"=this.shape["+e+"]"}),d=o.map(function(e){return"c"+e+"=this.stride["+e+"]"});a.push("proto.lo=function "+n+"_lo("+u.join(",")+"){var b=this.offset,d=0,"+p.join(",")+","+d.join(","));for(var g=0;g=0){d=i"+g+"|0;b+=c"+g+"*d;a"+g+"-=d}");a.push("return new "+n+"(this.data,"+o.map(function(e){return"a"+e}).join(",")+","+o.map(function(e){return"c"+e}).join(",")+",b)}"),a.push("proto.step=function "+n+"_step("+u.join(",")+"){var "+o.map(function(e){return"a"+e+"=this.shape["+e+"]"}).join(",")+","+o.map(function(e){return"b"+e+"=this.stride["+e+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(g=0;g=0){c=(c+this.stride["+g+"]*i"+g+")|0}else{a.push(this.shape["+g+"]);b.push(this.stride["+g+"])}");return a.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),a.push("return function construct_"+n+"(data,shape,stride,offset){return new "+n+"(data,"+o.map(function(e){return"shape["+e+"]"}).join(",")+","+o.map(function(e){return"stride["+e+"]"}).join(",")+",offset)}"),new Function("CTOR_LIST","ORDER",a.join("\n"))(l[e],s)}var l={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],buffer:[],generic:[]};t.exports=function(e,t,n,r){if(void 0===e)return(0,l.array[0])([]);"number"==typeof e&&(e=[e]),void 0===t&&(t=[e.length]);var o=t.length;if(void 0===n){n=new Array(o);for(var s=o-1,c=1;s>=0;--s)n[s]=c,c*=t[s]}if(void 0===r)for(r=0,s=0;s>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,(e|=e>>>16)+1}},{}],73:[function(e,t,n){"use strict";function r(e,t,n,r){for(var i=e[t++],a=1<>=u,c-=u,v!==a){if(v===o)break;for(var m=va;)w=d[w]>>8,++_;var b=w;if(h+_+(m!==v?1:0)>r)return void console.log("Warning, gif stream longer than expected.");n[h++]=b;var y=h+=_;for(m!==v&&(n[h++]=b),w=m;_--;)w=d[w],n[--y]=255&w,w>>=8;null!==g&&s<4096&&(d[s++]=g<<8|b,s>=l+1&&u<12&&(++u,l=l<<1|1)),g=v}else s=o+1,l=(1<<(u=i+1))-1,g=null}return h!==r&&console.log("Warning, gif stream shorter than expected."),n}try{n.GifWriter=function(e,t,n,r){var i=0,a=void 0===(r=void 0===r?{}:r).loop?null:r.loop,o=void 0===r.palette?null:r.palette;if(t<=0||n<=0||t>65535||n>65535)throw new Error("Width/Height invalid.");function s(e){var t=e.length;if(t<2||t>256||t&t-1)throw new Error("Invalid code/color length, must be power of 2 and 2 .. 256.");return t}e[i++]=71,e[i++]=73,e[i++]=70,e[i++]=56,e[i++]=57,e[i++]=97;var u=0,l=0;if(null!==o){for(var c=s(o);c>>=1;)++u;if(c=1<=c)throw new Error("Background index out of range.");if(0===l)throw new Error("Background index explicitly passed as 0.")}}if(e[i++]=255&t,e[i++]=t>>8&255,e[i++]=255&n,e[i++]=n>>8&255,e[i++]=(null!==o?128:0)|u,e[i++]=l,e[i++]=0,null!==o)for(var f=0,h=o.length;f>16&255,e[i++]=p>>8&255,e[i++]=255&p}if(null!==a){if(a<0||a>65535)throw new Error("Loop count invalid.");e[i++]=33,e[i++]=255,e[i++]=11,e[i++]=78,e[i++]=69,e[i++]=84,e[i++]=83,e[i++]=67,e[i++]=65,e[i++]=80,e[i++]=69,e[i++]=50,e[i++]=46,e[i++]=48,e[i++]=3,e[i++]=1,e[i++]=255&a,e[i++]=a>>8&255,e[i++]=0}var d=!1;this.addFrame=function(t,n,r,a,u,l){if(!0===d&&(--i,d=!1),l=void 0===l?{}:l,t<0||n<0||t>65535||n>65535)throw new Error("x/y invalid.");if(r<=0||a<=0||r>65535||a>65535)throw new Error("Width/Height invalid.");if(u.length>=1;)++p;h=1<3)throw new Error("Disposal out of range.");var m=!1,_=0;if(void 0!==l.transparent&&null!==l.transparent&&(m=!0,(_=l.transparent)<0||_>=h))throw new Error("Transparent color index.");if((0!==v||m||0!==g)&&(e[i++]=33,e[i++]=249,e[i++]=4,e[i++]=v<<2|(!0===m?1:0),e[i++]=255&g,e[i++]=g>>8&255,e[i++]=_,e[i++]=0),e[i++]=44,e[i++]=255&t,e[i++]=t>>8&255,e[i++]=255&n,e[i++]=n>>8&255,e[i++]=255&r,e[i++]=r>>8&255,e[i++]=255&a,e[i++]=a>>8&255,e[i++]=!0===c?128|p-1:0,!0===c)for(var w=0,b=f.length;w>16&255,e[i++]=y>>8&255,e[i++]=255&y}return i=function(e,t,n,r){e[t++]=n;var i=t++,a=1<=n;)e[t++]=255&f,f>>=8,c-=8,t===i+256&&(e[i]=255,i=t++)}function p(e){f|=e<=8;)e[t++]=255&f,f>>=8,c-=8,t===i+256&&(e[i]=255,i=t++);4096===u?(p(a),u=s+1,l=n+1,g={}):(u>=1<>7,s=1<<1+(7&a);e[t++],e[t++];var u=null,l=null;o&&(u=t,l=s,t+=3*s);var c=!0,f=[],h=0,p=null,d=0,g=null;for(this.width=n,this.height=i;c&&t=0))throw Error("Invalid block size");if(0===M)break;t+=M}break;case 249:if(4!==e[t++]||0!==e[t+4])throw new Error("Invalid graphics extension block.");var v=e[t++];h=e[t++]|e[t++]<<8,p=e[t++],0==(1&v)&&(p=null),d=v>>2&7,t++;break;case 254:for(;;){if(!((M=e[t++])>=0))throw Error("Invalid block size");if(0===M)break;t+=M}break;default:throw new Error("Unknown graphic control label: 0x"+e[t-1].toString(16))}break;case 44:var m=e[t++]|e[t++]<<8,_=e[t++]|e[t++]<<8,w=e[t++]|e[t++]<<8,b=e[t++]|e[t++]<<8,y=e[t++],x=y>>6&1,k=1<<1+(7&y),E=u,S=l,A=!1;y>>7&&(A=!0,E=t,S=k,t+=3*k);var T=t;for(t++;;){var M;if(!((M=e[t++])>=0))throw Error("Invalid block size");if(0===M)break;t+=M}f.push({x:m,y:_,width:w,height:b,has_local_palette:A,palette_offset:E,palette_size:S,data_offset:T,data_length:t-T,transparent_index:p,interlaced:!!x,delay:h,disposal:d});break;case 59:c=!1;break;default:throw new Error("Unknown gif block: 0x"+e[t-1].toString(16))}this.numFrames=function(){return f.length},this.loopCount=function(){return g},this.frameInfo=function(e){if(e<0||e>=f.length)throw new Error("Frame index out of range.");return f[e]},this.decodeAndBlitFrameBGRA=function(t,i){var a=this.frameInfo(t),o=a.width*a.height,s=new Uint8Array(o);r(e,a.data_offset,s,o);var u=a.palette_offset,l=a.transparent_index;null===l&&(l=256);var c=a.width,f=n-c,h=c,p=4*(a.y*n+a.x),d=4*((a.y+a.height)*n+a.x),g=p,v=4*f;!0===a.interlaced&&(v+=4*n*7);for(var m=8,_=0,w=s.length;_=d&&(v=4*f+4*n*(m-1),g=p+(c+f)*(m<<1),m>>=1)),b===l)g+=4;else{var y=e[u+3*b],x=e[u+3*b+1],k=e[u+3*b+2];i[g++]=k,i[g++]=x,i[g++]=y,i[g++]=255}--h}},this.decodeAndBlitFrameRGBA=function(t,i){var a=this.frameInfo(t),o=a.width*a.height,s=new Uint8Array(o);r(e,a.data_offset,s,o);var u=a.palette_offset,l=a.transparent_index;null===l&&(l=256);var c=a.width,f=n-c,h=c,p=4*(a.y*n+a.x),d=4*((a.y+a.height)*n+a.x),g=p,v=4*f;!0===a.interlaced&&(v+=4*n*7);for(var m=8,_=0,w=s.length;_=d&&(v=4*f+4*n*(m-1),g=p+(c+f)*(m<<1),m>>=1)),b===l)g+=4;else{var y=e[u+3*b],x=e[u+3*b+1],k=e[u+3*b+2];i[g++]=y,i[g++]=x,i[g++]=k,i[g++]=255}--h}}}}catch(e){}},{}],74:[function(e,t,n){(function(n){var r=e("charm");function i(e){if(!(e=e||{}).total)throw new Error("You MUST specify the total number of operations that will be processed.");this.total=e.total,this.current=0,this.max_burden=e.maxBurden||.5,this.show_burden=e.showBurden||!1,this.started=!1,this.size=50,this.inner_time=0,this.outer_time=0,this.elapsed=0,this.time_start=0,this.time_end=0,this.time_left=0,this.time_burden=0,this.skip_steps=0,this.skipped=0,this.aborted=!1,this.charm=r(),this.charm.pipe(n.stdout),this.charm.write("\n\n\n")}function a(e,t,n){for(n=n||" ";e.length3&&(u[0]=u[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,o)),(u[1]||"").length=this.total&&this.finished(),this.time_end=(new Date).getTime(),this.inner_time=this.time_end-this.time_start)},i.prototype.updateTimes=function(){this.elapsed=this.time_start-this.started,this.time_end>0&&(this.outer_time=this.time_start-this.time_end),this.inner_time>0&&this.outer_time>0&&(this.time_burden=this.inner_time/(this.inner_time+this.outer_time)*100,this.time_left=this.elapsed/this.current*(this.total-this.current),this.time_left<0&&(this.time_left=0)),this.time_burden>this.max_burden&&this.skip_steps0&&this.current=0;r--){var i=e[r];"."===i?e.splice(r,1):".."===i?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}var r=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,i=function(e){return r.exec(e).slice(1)};function a(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r=-1&&!r;i--){var o=i>=0?arguments[i]:e.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");o&&(n=o+"/"+n,r="/"===o.charAt(0))}return(r?"/":"")+(n=t(a(n.split("/"),function(e){return!!e}),!r).join("/"))||"."},n.normalize=function(e){var r=n.isAbsolute(e),i="/"===o(e,-1);return(e=t(a(e.split("/"),function(e){return!!e}),!r).join("/"))||r||(e="."),e&&i&&(e+="/"),(r?"/":"")+e},n.isAbsolute=function(e){return"/"===e.charAt(0)},n.join=function(){var e=Array.prototype.slice.call(arguments,0);return n.normalize(a(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},n.relative=function(e,t){function r(e){for(var t=0;t=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=n.resolve(e).substr(1),t=n.resolve(t).substr(1);for(var i=r(e.split("/")),a=r(t.split("/")),o=Math.min(i.length,a.length),s=o,u=0;u>4,n.push(f,c);break;case 2:u=3&h,l=h>>2&3,c=h>>4&3,f=h>>6&3,n.push(f,c,l,u);break;case 1:i=1&h,a=h>>1&1,o=h>>2&1,s=h>>3&1,u=h>>4&1,l=h>>5&1,c=h>>6&1,f=h>>7&1,n.push(f,c,l,u,s,o,a,i)}}return{get:function(e){for(;n.length0&&(this._paused=!1,this.emit("drain"))}.bind(this))},o.prototype.write=function(e,t){return this.writable?(n=r.isBuffer(e)?e:new r(e,t||this._encoding),this._buffers.push(n),this._buffered+=n.length,this._process(),this._reads&&0===this._reads.length&&(this._paused=!0),this.writable&&!this._paused):(this.emit("error",new Error("Stream not writable")),!1);var n},o.prototype.end=function(e,t){e&&this.write(e,t),this.writable=!1,this._buffers&&(0===this._buffers.length?this._end():(this._buffers.push(null),this._process()))},o.prototype.destroySoon=o.prototype.end,o.prototype._end=function(){this._reads.length>0&&this.emit("error",new Error("There are some read requests waitng on finished stream")),this.destroy()},o.prototype.destroy=function(){this._buffers&&(this.writable=!1,this._reads=null,this._buffers=null,this.emit("close"))},o.prototype._processReadAllowingLess=function(e){this._reads.shift();var t=this._buffers[0];t.length>e.length?(this._buffered-=e.length,this._buffers[0]=t.slice(e.length),e.func.call(this,t.slice(0,e.length))):(this._buffered-=t.length,this._buffers.shift(),e.func.call(this,t))},o.prototype._processRead=function(e){this._reads.shift();for(var t=0,n=0,i=new r(e.length);t0&&this._buffers.splice(0,n),this._buffered-=e.length,e.func.call(this,i)},o.prototype._process=function(){try{for(;this._buffered>0&&this._reads&&this._reads.length>0;){var e=this._reads[0];if(e.allowLess)this._processReadAllowingLess(e);else{if(!(this._buffered>=e.length))break;this._processRead(e)}}this._buffers&&this._buffers.length>0&&null===this._buffers[0]&&this._end()}catch(e){this.emit("error",e)}}}).call(this,e("_process"),e("buffer").Buffer)},{_process:98,buffer:4,stream:112,util:135}],79:[function(e,t,n){"use strict";t.exports={PNG_SIGNATURE:[137,80,78,71,13,10,26,10],TYPE_IHDR:1229472850,TYPE_IEND:1229278788,TYPE_IDAT:1229209940,TYPE_PLTE:1347179589,TYPE_tRNS:1951551059,TYPE_gAMA:1732332865,COLORTYPE_GRAYSCALE:0,COLORTYPE_PALETTE:1,COLORTYPE_COLOR:2,COLORTYPE_ALPHA:4,COLORTYPE_PALETTE_COLOR:3,COLORTYPE_COLOR_ALPHA:6,COLORTYPE_TO_BPP_MAP:{0:1,2:3,3:1,4:2,6:4},GAMMA_DIVISION:1e5}},{}],80:[function(e,t,n){"use strict";var r=[];!function(){for(var e=0;e<256;e++){for(var t=e,n=0;n<8;n++)1&t?t=3988292384^t>>>1:t>>>=1;r[e]=t}}();var i=t.exports=function(){this._crc=-1};i.prototype.write=function(e){for(var t=0;t>>8;return!0},i.prototype.crc32=function(){return-1^this._crc},i.crc32=function(e){for(var t=-1,n=0;n>>8;return-1^t}},{}],81:[function(e,t,n){(function(n){"use strict";var r=e("./paeth-predictor");var i={0:function(e,t,n,r,i){e.copy(r,i,t,t+n)},1:function(e,t,n,r,i,a){for(var o=0;o=a?e[t+o-a]:0,u=e[t+o]-s;r[i+o]=u}},2:function(e,t,n,r,i){for(var a=0;a0?e[t+a-n]:0,s=e[t+a]-o;r[i+a]=s}},3:function(e,t,n,r,i,a){for(var o=0;o=a?e[t+o-a]:0,u=t>0?e[t+o-n]:0,l=e[t+o]-(s+u>>1);r[i+o]=l}},4:function(e,t,n,i,a,o){for(var s=0;s=o?e[t+s-o]:0,l=t>0?e[t+s-n]:0,c=t>0&&s>=o?e[t+s-(n+o)]:0,f=e[t+s]-r(u,l,c);i[a+s]=f}}},a={0:function(e,t,n){for(var r=0,i=t+n,a=t;a=r?e[t+a-r]:0,s=e[t+a]-o;i+=Math.abs(s)}return i},2:function(e,t,n){for(var r=0,i=t+n,a=t;a0?e[a-n]:0,s=e[a]-o;r+=Math.abs(s)}return r},3:function(e,t,n,r){for(var i=0,a=0;a=r?e[t+a-r]:0,s=t>0?e[t+a-n]:0,u=e[t+a]-(o+s>>1);i+=Math.abs(u)}return i},4:function(e,t,n,i){for(var a=0,o=0;o=i?e[t+o-i]:0,u=t>0?e[t+o-n]:0,l=t>0&&o>=i?e[t+o-(n+i)]:0,c=e[t+o]-r(s,u,l);a+=Math.abs(c)}return a}};t.exports=function(e,t,r,o,s){var u;if("filterType"in o&&-1!==o.filterType){if("number"!=typeof o.filterType)throw new Error("unrecognised filter types");u=[o.filterType]}else u=[0,1,2,3,4];for(var l=t*s,c=0,f=0,h=new n((l+1)*r),p=u[0],d=0;d1)for(var g=1/0,v=0;vi?t[a-r]:0;t[a]=o+s}},o.prototype._unFilterType2=function(e,t,n){for(var r=this._lastLine,i=0;ii?t[o-r]:0,c=Math.floor((l+u)/2);t[o]=s+c}},o.prototype._unFilterType4=function(e,t,n){for(var r=this._xComparison,a=r-1,o=this._lastLine,s=0;sa?t[s-r]:0,f=s>a&&o?o[s-r]:0,h=i(c,l,f);t[s]=u+h}},o.prototype._reverseFilterLine=function(e){var t,r=e[0],i=this._images[this._imageIndex],a=i.byteWidth;if(0===r)t=e.slice(1,a+1);else switch(t=new n(a),r){case 1:this._unFilterType1(e,t,a);break;case 2:this._unFilterType2(e,t,a);break;case 3:this._unFilterType3(e,t,a);break;case 4:this._unFilterType4(e,t,a);break;default:throw new Error("Unrecognised filter type - "+r)}this.write(t),i.lineIndex++,i.lineIndex>=i.height?(this._lastLine=null,this._imageIndex++,i=this._images[this._imageIndex]):this._lastLine=t,i?this.read(i.byteWidth+1,this._reverseFilterLine.bind(this)):(this._lastLine=null,this.complete())}}).call(this,e("buffer").Buffer)},{"./interlace":86,"./paeth-predictor":90,buffer:4}],85:[function(e,t,n){(function(e){"use strict";t.exports=function(t,n){var r=n.depth,i=n.width,a=n.height,o=n.colorType,s=n.transColor,u=n.palette,l=t;return 3===o?function(e,t,n,r,i){for(var a=0,o=0;o0&&f>0&&n.push({width:c,height:f,index:u})}return n},n.getInterlaceIterator=function(e){return function(t,n,i){var a=t%r[i].x.length,o=(t-a)/r[i].x.length*8+r[i].x[a],s=n%r[i].y.length;return 4*o+((n-s)/r[i].y.length*8+r[i].y[s])*e*4}}},{}],87:[function(e,t,n){(function(n){"use strict";var r=e("util"),i=e("stream"),a=e("./constants"),o=e("./packer"),s=t.exports=function(e){i.call(this);var t=e||{};this._packer=new o(t),this._deflate=this._packer.createDeflate(),this.readable=!0};r.inherits(s,i),s.prototype.pack=function(e,t,r,i){this.emit("data",new n(a.PNG_SIGNATURE)),this.emit("data",this._packer.packIHDR(t,r)),i&&this.emit("data",this._packer.packGAMA(i));var o=this._packer.filterData(e,t,r);this._deflate.on("error",this.emit.bind(this,"error")),this._deflate.on("data",function(e){this.emit("data",this._packer.packIDAT(e))}.bind(this)),this._deflate.on("end",function(){this.emit("data",this._packer.packIEND()),this.emit("end")}.bind(this)),this._deflate.end(o)}}).call(this,e("buffer").Buffer)},{"./constants":79,"./packer":89,buffer:4,stream:112,util:135}],88:[function(e,t,n){(function(n){"use strict";var r=!0,i=e("zlib");i.deflateSync||(r=!1);var a=e("./constants"),o=e("./packer");t.exports=function(e,t){if(!r)throw new Error("To use the sync capability of this library in old node versions, please also add a dependency on node-zlb-backport");var s=new o(t||{}),u=[];u.push(new n(a.PNG_SIGNATURE)),u.push(s.packIHDR(e.width,e.height)),e.gamma&&u.push(s.packGAMA(e.gamma));var l=s.filterData(e.data,e.width,e.height),c=i.deflateSync(l,s.getDeflateOptions());if(l=null,!c||!c.length)throw new Error("bad png - invalid compressed data response");return u.push(s.packIDAT(c)),u.push(s.packIEND()),n.concat(u)}}).call(this,e("buffer").Buffer)},{"./constants":79,"./packer":89,buffer:4,zlib:41}],89:[function(e,t,n){(function(n){"use strict";var r=e("./constants"),i=e("./crc"),a=e("./bitpacker"),o=e("./filter-pack"),s=e("zlib"),u=t.exports=function(e){if(this._options=e,e.deflateChunkSize=e.deflateChunkSize||32768,e.deflateLevel=null!=e.deflateLevel?e.deflateLevel:9,e.deflateStrategy=null!=e.deflateStrategy?e.deflateStrategy:3,e.inputHasAlpha=null==e.inputHasAlpha||e.inputHasAlpha,e.deflateFactory=e.deflateFactory||s.createDeflate,e.bitDepth=e.bitDepth||8,e.colorType="number"==typeof e.colorType?e.colorType:r.COLORTYPE_COLOR_ALPHA,e.colorType!==r.COLORTYPE_COLOR&&e.colorType!==r.COLORTYPE_COLOR_ALPHA)throw new Error("option color type:"+e.colorType+" is not supported at present");if(8!==e.bitDepth)throw new Error("option bit depth:"+e.bitDepth+" is not supported at present")};u.prototype.getDeflateOptions=function(){return{chunkSize:this._options.deflateChunkSize,level:this._options.deflateLevel,strategy:this._options.deflateStrategy}},u.prototype.createDeflate=function(){return this._options.deflateFactory(this.getDeflateOptions())},u.prototype.filterData=function(e,t,n){var i=a(e,t,n,this._options),s=r.COLORTYPE_TO_BPP_MAP[this._options.colorType];return o(i,t,n,this._options,s)},u.prototype._packChunk=function(e,t){var r=t?t.length:0,a=new n(r+12);return a.writeUInt32BE(r,0),a.writeUInt32BE(e,4),t&&t.copy(a,8),a.writeInt32BE(i.crc32(a.slice(4,a.length-4)),a.length-4),a},u.prototype.packGAMA=function(e){var t=new n(4);return t.writeUInt32BE(Math.floor(e*r.GAMMA_DIVISION),0),this._packChunk(r.TYPE_gAMA,t)},u.prototype.packIHDR=function(e,t){var i=new n(13);return i.writeUInt32BE(e,0),i.writeUInt32BE(t,4),i[8]=this._options.bitDepth,i[9]=this._options.colorType,i[10]=0,i[11]=0,i[12]=0,this._packChunk(r.TYPE_IHDR,i)},u.prototype.packIDAT=function(e){return this._packChunk(r.TYPE_IDAT,e)},u.prototype.packIEND=function(){return this._packChunk(r.TYPE_IEND,null)}}).call(this,e("buffer").Buffer)},{"./bitpacker":77,"./constants":79,"./crc":80,"./filter-pack":81,buffer:4,zlib:41}],90:[function(e,t,n){"use strict";t.exports=function(e,t,n){var r=e+t-n,i=Math.abs(r-e),a=Math.abs(r-t),o=Math.abs(r-n);return i<=a&&i<=o?e:a<=o?t:n}},{}],91:[function(e,t,n){"use strict";var r=e("util"),i=e("zlib"),a=e("./chunkstream"),o=e("./filter-parse-async"),s=e("./parser"),u=e("./bitmapper"),l=e("./format-normaliser"),c=t.exports=function(e){a.call(this),this._parser=new s(e,{read:this.read.bind(this),error:this._handleError.bind(this),metadata:this._handleMetaData.bind(this),gamma:this.emit.bind(this,"gamma"),palette:this._handlePalette.bind(this),transColor:this._handleTransColor.bind(this),finished:this._finished.bind(this),inflateData:this._inflateData.bind(this)}),this._options=e,this.writable=!0,this._parser.start()};r.inherits(c,a),c.prototype._handleError=function(e){this.emit("error",e),this.writable=!1,this.destroy(),this._inflate&&this._inflate.destroy&&this._inflate.destroy(),this.errord=!0},c.prototype._inflateData=function(e){this._inflate||(this._inflate=i.createInflate(),this._inflate.on("error",this.emit.bind(this,"error")),this._filter.on("complete",this._complete.bind(this)),this._inflate.pipe(this._filter)),this._inflate.write(e)},c.prototype._handleMetaData=function(e){this.emit("metadata",e),this._bitmapInfo=Object.create(e),this._filter=new o(this._bitmapInfo)},c.prototype._handleTransColor=function(e){this._bitmapInfo.transColor=e},c.prototype._handlePalette=function(e){this._bitmapInfo.palette=e},c.prototype._finished=function(){this.errord||(this._inflate?this._inflate.end():this.emit("error","No Inflate block"),this.destroySoon())},c.prototype._complete=function(e){if(!this.errord){try{var t=u.dataToBitMap(e,this._bitmapInfo),n=l(t,this._bitmapInfo);t=null}catch(e){return void this._handleError(e)}this.emit("parsed",n)}}},{"./bitmapper":76,"./chunkstream":78,"./filter-parse-async":82,"./format-normaliser":85,"./parser":93,util:135,zlib:41}],92:[function(e,t,n){(function(n){"use strict";var r=!0,i=e("zlib");i.deflateSync||(r=!1);var a=e("./sync-reader"),o=e("./filter-parse-sync"),s=e("./parser"),u=e("./bitmapper"),l=e("./format-normaliser");t.exports=function(e,t){if(!r)throw new Error("To use the sync capability of this library in old node versions, please also add a dependency on node-zlb-backport");var c,f,h;var p=[];var d=new a(e);if(new s(t,{read:d.read.bind(d),error:function(e){c=e},metadata:function(e){f=e},gamma:function(e){h=e},palette:function(e){f.palette=e},transColor:function(e){f.transColor=e},inflateData:function(e){p.push(e)}}).start(),d.process(),c)throw c;var g=n.concat(p);p.length=0;var v=i.inflateSync(g);if(g=null,!v||!v.length)throw new Error("bad png - invalid inflate data response");var m=o.process(v,f);g=null;var _=u.dataToBitMap(m,f);m=null;var w=l(_,f);return f.data=w,f.gamma=h||0,f}}).call(this,e("buffer").Buffer)},{"./bitmapper":76,"./filter-parse-sync":83,"./format-normaliser":85,"./parser":93,"./sync-reader":96,buffer:4,zlib:41}],93:[function(e,t,n){(function(n){"use strict";var r=e("./constants"),i=e("./crc"),a=t.exports=function(e,t){this._options=e,e.checkCRC=!1!==e.checkCRC,this._hasIHDR=!1,this._hasIEND=!1,this._palette=[],this._colorType=0,this._chunks={},this._chunks[r.TYPE_IHDR]=this._handleIHDR.bind(this),this._chunks[r.TYPE_IEND]=this._handleIEND.bind(this),this._chunks[r.TYPE_IDAT]=this._handleIDAT.bind(this),this._chunks[r.TYPE_PLTE]=this._handlePLTE.bind(this),this._chunks[r.TYPE_tRNS]=this._handleTRNS.bind(this),this._chunks[r.TYPE_gAMA]=this._handleGAMA.bind(this),this.read=t.read,this.error=t.error,this.metadata=t.metadata,this.gamma=t.gamma,this.transColor=t.transColor,this.palette=t.palette,this.parsed=t.parsed,this.inflateData=t.inflateData,this.inflateData=t.inflateData,this.finished=t.finished};a.prototype.start=function(){this.read(r.PNG_SIGNATURE.length,this._parseSignature.bind(this))},a.prototype._parseSignature=function(e){for(var t=r.PNG_SIGNATURE,n=0;nthis._palette.length)return void this.error(new Error("More transparent colors than palette size"));for(var t=0;t0?this._handleIDAT(n):this._handleChunkEnd()},a.prototype._handleIEND=function(e){this.read(e,this._parseIEND.bind(this))},a.prototype._parseIEND=function(e){this._crc.write(e),this._hasIEND=!0,this._handleChunkEnd(),this.finished&&this.finished()}}).call(this,e("buffer").Buffer)},{"./constants":79,"./crc":80,buffer:4}],94:[function(e,t,n){"use strict";var r=e("./parser-sync"),i=e("./packer-sync");n.read=function(e,t){return r(e,t||{})},n.write=function(e){return i(e)}},{"./packer-sync":88,"./parser-sync":92}],95:[function(e,t,n){(function(t,r){"use strict";var i=e("util"),a=e("stream"),o=e("./parser-async"),s=e("./packer-async"),u=e("./png-sync"),l=n.PNG=function(e){a.call(this),e=e||{},this.width=e.width||0,this.height=e.height||0,this.data=this.width>0&&this.height>0?new r(4*this.width*this.height):null,e.fill&&this.data&&this.data.fill(0),this.gamma=0,this.readable=this.writable=!0,this._parser=new o(e),this._parser.on("error",this.emit.bind(this,"error")),this._parser.on("close",this._handleClose.bind(this)),this._parser.on("metadata",this._metadata.bind(this)),this._parser.on("gamma",this._gamma.bind(this)),this._parser.on("parsed",function(e){this.data=e,this.emit("parsed",e)}.bind(this)),this._packer=new s(e),this._packer.on("data",this.emit.bind(this,"data")),this._packer.on("end",this.emit.bind(this,"end")),this._parser.on("close",this._handleClose.bind(this)),this._packer.on("error",this.emit.bind(this,"error"))};i.inherits(l,a),l.sync=u,l.prototype.pack=function(){return this.data&&this.data.length?(t.nextTick(function(){this._packer.pack(this.data,this.width,this.height,this.gamma)}.bind(this)),this):(this.emit("error","No data provided"),this)},l.prototype.parse=function(e,t){var n,r;t&&(n=function(e){this.removeListener("error",r),this.data=e,t(null,this)}.bind(this),r=function(e){this.removeListener("parsed",n),t(e,null)}.bind(this),this.once("parsed",n),this.once("error",r));return this.end(e),this},l.prototype.write=function(e){return this._parser.write(e),!0},l.prototype.end=function(e){this._parser.end(e)},l.prototype._metadata=function(e){this.width=e.width,this.height=e.height,this.emit("metadata",e)},l.prototype._gamma=function(e){this.gamma=e},l.prototype._handleClose=function(){this._parser.writable||this._packer.readable||this.emit("close")},l.bitblt=function(e,t,n,r,i,a,o,s){if(n>e.width||r>e.height||n+i>e.width||r+a>e.height)throw new Error("bitblt reading outside image");if(o>t.width||s>t.height||o+i>t.width||s+a>t.height)throw new Error("bitblt writing outside image");for(var u=0;u0&&this._buffer.length;){var e=this._reads[0];if(!this._buffer.length||!(this._buffer.length>=e.length||e.allowLess))break;this._reads.shift();var t=this._buffer;this._buffer=t.slice(e.length),e.func.call(this,t.slice(0,e.length))}return this._reads.length>0?new Error("There are some read requests waitng on finished stream"):this._buffer.length>0?new Error("unrecognised content at end of stream"):void 0}},{}],97:[function(e,t,n){(function(e){"use strict";!e.version||0===e.version.indexOf("v0.")||0===e.version.indexOf("v1.")&&0!==e.version.indexOf("v1.8.")?t.exports={nextTick:function(t,n,r,i){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var a,o,s=arguments.length;switch(s){case 0:case 1:return e.nextTick(t);case 2:return e.nextTick(function(){t.call(null,n)});case 3:return e.nextTick(function(){t.call(null,n,r)});case 4:return e.nextTick(function(){t.call(null,n,r,i)});default:for(a=new Array(s-1),o=0;o1)for(var n=1;n0?d(e):b(e)}(e,t);else if(t.objectMode||r&&r.length>0)if(t.ended&&!o){var u=new Error("stream.push() after EOF");e.emit("error",u)}else if(t.endEmitted&&o){u=new Error("stream.unshift() after end event");e.emit("error",u)}else!t.decoder||o||a||(r=t.decoder.write(r)),t.length+=t.objectMode?1:r.length,o?t.buffer.unshift(r):(t.reading=!1,t.buffer.push(r)),t.needReadable&&d(e),function(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(function(){!function(e,t){var n=t.length;for(;!t.reading&&!t.flowing&&!t.ended&&t.lengtht.highWaterMark&&(t.highWaterMark=function(e){if(e>=h)e=h;else{e--;for(var t=1;t<32;t<<=1)e|=e>>t;e++}return e}(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function d(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,t.sync?n.nextTick(function(){g(e)}):g(e))}function g(e){e.emit("readable")}function v(e){var t,n=e._readableState;function r(e,r,i){!1===e.write(t)&&n.awaitDrain++}for(n.awaitDrain=0;n.pipesCount&&null!==(t=e.read());)if(1===n.pipesCount?r(n.pipes):y(n.pipes,r),e.emit("data",t),n.awaitDrain>0)return;if(0===n.pipesCount)return n.flowing=!1,void(a.listenerCount(e,"data")>0&&_(e));n.ranOut=!0}function m(){this._readableState.ranOut&&(this._readableState.ranOut=!1,v(this))}function _(e,t){if(e._readableState.flowing)throw new Error("Cannot switch to old mode now.");var r=t||!1,i=!1;e.readable=!0,e.pipe=s.prototype.pipe,e.on=e.addListener=s.prototype.on,e.on("readable",function(){var t;for(i=!0;!r&&null!==(t=e.read());)e.emit("data",t);null===t&&(i=!1,e._readableState.needReadable=!0)}),e.pause=function(){r=!0,this.emit("pause")},e.resume=function(){r=!1,i?n.nextTick(function(){e.emit("readable")}):this.read(0),this.emit("resume")},e.emit("readable")}function w(e,t){var n,r=t.buffer,a=t.length,o=!!t.decoder,s=!!t.objectMode;if(0===r.length)return null;if(0===a)n=null;else if(s)n=r.shift();else if(!e||e>=a)n=o?r.join(""):i.concat(r,a),r.length=0;else{if(e0)throw new Error("endReadable called on non-empty stream");!t.endEmitted&&t.calledRead&&(t.ended=!0,n.nextTick(function(){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}))}function y(e,t){for(var n=0,r=e.length;n0)&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return d(this),null;if(0===(e=p(e,t))&&t.ended)return n=null,t.length>0&&t.decoder&&(n=w(e,t),t.length-=n.length),0===t.length&&b(this),n;var i=t.needReadable;return t.length-e<=t.highWaterMark&&(i=!0),(t.ended||t.reading)&&(i=!1),i&&(t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1),i&&!t.reading&&(e=p(r,t)),null===(n=e>0?w(e,t):null)&&(t.needReadable=!0,e=0),t.length-=e,0!==t.length||t.ended||(t.needReadable=!0),t.ended&&!t.endEmitted&&0===t.length&&b(this),n},c.prototype._read=function(e){this.emit("error",new Error("not implemented"))},c.prototype.pipe=function(e,t){var i=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1;var s=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?l:f;function u(e){e===i&&f()}function l(){e.end()}o.endEmitted?n.nextTick(s):i.once("end",s),e.on("unpipe",u);var c=function(e){return function(){var t=e._readableState;t.awaitDrain--,0===t.awaitDrain&&v(e)}}(i);function f(){e.removeListener("close",p),e.removeListener("finish",d),e.removeListener("drain",c),e.removeListener("error",h),e.removeListener("unpipe",u),i.removeListener("end",l),i.removeListener("end",f),e._writableState&&!e._writableState.needDrain||c()}function h(t){g(),e.removeListener("error",h),0===a.listenerCount(e,"error")&&e.emit("error",t)}function p(){e.removeListener("finish",d),g()}function d(){e.removeListener("close",p),g()}function g(){i.unpipe(e)}return e.on("drain",c),e._events&&e._events.error?r(e._events.error)?e._events.error.unshift(h):e._events.error=[h,e._events.error]:e.on("error",h),e.once("close",p),e.once("finish",d),e.emit("pipe",i),o.flowing||(this.on("readable",m),o.flowing=!0,n.nextTick(function(){v(i)})),e},c.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,this.removeListener("readable",m),t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,this.removeListener("readable",m),t.flowing=!1;for(var i=0;i0&&!e[o-1];)o--;a.push({children:[],index:0});var s,u=a[0];for(n=0;n0;)u=a.pop();for(u.index++,a.push(u);a.length<=n;)a.push(s={children:[],index:0}),u.children[u.index]=s.children,u=s;i++}n+10)return p>>--d&1;if(255==(p=t[n++])){var e=t[n++];if(e)throw"unexpected marker: "+(p<<8|e).toString(16)}return d=7,p>>>7}function v(e){for(var t,n=e;null!==(t=g());){if("number"==typeof(n=n[t]))return n;if("object"!=typeof n)throw"invalid huffman sequence"}return null}function m(e){for(var t=0;e>0;){var n=g();if(null===n)return;t=t<<1|n,e--}return t}function _(e){var t=m(e);return t>=1<0)w--;else for(var r=o,i=s;r<=i;){var a=v(t.huffmanTableAC),u=15&a,c=a>>4;if(0!==u)n[e[r+=c]]=_(u)*(1<>4,0===f)a<15?(w=m(a)+(1<>4;if(0!==s)n[e[a+=u]]=_(s),a++;else{if(u<15)break;a+=16}}};var R,L,B,C,O=0;for(L=1==j?i[0].blocksPerLine*i[0].blocksPerColumn:c*r.mcusPerColumn,a||(a=L);O=65488&&R<=65495))break;n+=2}return n-h}function h(e,l){var c,f,h=[],p=l.blocksPerLine,d=l.blocksPerColumn,g=p<<3,v=new Int32Array(64),m=new Uint8Array(64);function _(e,c,f){var h,p,d,g,v,m,_,w,b,y,x=l.quantizationTable,k=f;for(y=0;y<64;y++)k[y]=e[y]*x[y];for(y=0;y<8;++y){var E=8*y;0!=k[1+E]||0!=k[2+E]||0!=k[3+E]||0!=k[4+E]||0!=k[5+E]||0!=k[6+E]||0!=k[7+E]?(h=s*k[0+E]+128>>8,p=s*k[4+E]+128>>8,d=k[2+E],g=k[6+E],v=u*(k[1+E]-k[7+E])+128>>8,w=u*(k[1+E]+k[7+E])+128>>8,m=k[3+E]<<4,_=k[5+E]<<4,b=h-p+1>>1,h=h+p+1>>1,p=b,b=d*o+g*a+128>>8,d=d*a-g*o+128>>8,g=b,b=v-_+1>>1,v=v+_+1>>1,_=b,b=w+m+1>>1,m=w-m+1>>1,w=b,b=h-g+1>>1,h=h+g+1>>1,g=b,b=p-d+1>>1,p=p+d+1>>1,d=b,b=v*i+w*r+2048>>12,v=v*r-w*i+2048>>12,w=b,b=m*n+_*t+2048>>12,m=m*t-_*n+2048>>12,_=b,k[0+E]=h+w,k[7+E]=h-w,k[1+E]=p+_,k[6+E]=p-_,k[2+E]=d+m,k[5+E]=d-m,k[3+E]=g+v,k[4+E]=g-v):(b=s*k[0+E]+512>>10,k[0+E]=b,k[1+E]=b,k[2+E]=b,k[3+E]=b,k[4+E]=b,k[5+E]=b,k[6+E]=b,k[7+E]=b)}for(y=0;y<8;++y){var S=y;0!=k[8+S]||0!=k[16+S]||0!=k[24+S]||0!=k[32+S]||0!=k[40+S]||0!=k[48+S]||0!=k[56+S]?(h=s*k[0+S]+2048>>12,p=s*k[32+S]+2048>>12,d=k[16+S],g=k[48+S],v=u*(k[8+S]-k[56+S])+2048>>12,w=u*(k[8+S]+k[56+S])+2048>>12,m=k[24+S],_=k[40+S],b=h-p+1>>1,h=h+p+1>>1,p=b,b=d*o+g*a+2048>>12,d=d*a-g*o+2048>>12,g=b,b=v-_+1>>1,v=v+_+1>>1,_=b,b=w+m+1>>1,m=w-m+1>>1,w=b,b=h-g+1>>1,h=h+g+1>>1,g=b,b=p-d+1>>1,p=p+d+1>>1,d=b,b=v*i+w*r+2048>>12,v=v*r-w*i+2048>>12,w=b,b=m*n+_*t+2048>>12,m=m*t-_*n+2048>>12,_=b,k[0+S]=h+w,k[56+S]=h-w,k[8+S]=p+_,k[48+S]=p-_,k[16+S]=d+m,k[40+S]=d-m,k[24+S]=g+v,k[32+S]=g-v):(b=s*f[y+0]+8192>>14,k[0+S]=b,k[8+S]=b,k[16+S]=b,k[24+S]=b,k[32+S]=b,k[40+S]=b,k[48+S]=b,k[56+S]=b)}for(y=0;y<64;++y){var A=128+(k[y]+8>>4);c[y]=A<0?0:A>255?255:A}}for(var w=0;w255?255:e}return l.prototype={load:function(e){var t=new XMLHttpRequest;t.open("GET",e,!0),t.responseType="arraybuffer",t.onload=function(){var e=new Uint8Array(t.response||t.mozResponseArrayBuffer);this.parse(e),this.onload&&this.onload()}.bind(this),t.send(null)},parse:function(t){var n=0;t.length;function r(){var e=t[n]<<8|t[n+1];return n+=2,e}function i(){var e=r(),i=t.subarray(n,n+e-2);return n+=i.length,i}function a(e){var t,n,r=0,i=0;for(n in e.components)e.components.hasOwnProperty(n)&&(r<(t=e.components[n]).h&&(r=t.h),i>4==0)for(_=0;_<64;_++){x[e[_]]=t[n++]}else{if(y>>4!=1)throw"DQT: invalid table spec";for(_=0;_<64;_++){x[e[_]]=r()}}p[15&y]=x}break;case 65472:case 65473:case 65474:r(),(o={}).extended=65473===m,o.progressive=65474===m,o.precision=t[n++],o.scanLines=r(),o.samplesPerLine=r(),o.components={},o.componentsOrder=[];var k,E=t[n++];for(P=0;P>4,A=15&t[n+1],T=t[n+2];o.componentsOrder.push(k),o.components[k]={h:S,v:A,quantizationTable:p[T]},n+=3}a(o),d.push(o);break;case 65476:var M=r();for(P=2;P>4==0?v:g)[15&I]=c(j,L)}break;case 65501:r(),s=r();break;case 65498:r();var B=t[n++],C=[];for(P=0;P>4],U.huffmanTableAC=g[15&O],C.push(U)}var z=t[n++],D=t[n++],F=t[n++],N=f(t,n,o,C,s,z,D,F>>4,15&F);n+=N;break;default:if(255==t[n-3]&&t[n-2]>=192&&t[n-2]<=254){n-=3;break}throw"unknown JPEG marker "+m.toString(16)}m=r()}if(1!=d.length)throw"only single frame JPEGs supported";this.width=o.samplesPerLine,this.height=o.scanLines,this.jfif=u,this.adobe=l,this.components=[];for(var P=0;P=0;)t&1<>8&255),O(255&e)}function D(e,t,n,r,i){var a,o=i[0],s=i[240];for(var u=function(e,t){var n,r,i,a,o,s,u,l,c,f,h=0;for(c=0;c<8;++c){n=e[h],r=e[h+1],i=e[h+2],a=e[h+3],o=e[h+4],s=e[h+5],u=e[h+6];var p=n+(l=e[h+7]),g=n-l,v=r+u,m=r-u,_=i+s,w=i-s,b=a+o,y=a-o,x=p+b,k=p-b,E=v+_,S=v-_;e[h]=x+E,e[h+4]=x-E;var A=.707106781*(S+k);e[h+2]=k+A,e[h+6]=k-A;var T=.382683433*((x=y+w)-(S=m+g)),M=.5411961*x+T,I=1.306562965*S+T,j=.707106781*(E=w+m),R=g+j,L=g-j;e[h+5]=L+M,e[h+3]=L-M,e[h+1]=R+I,e[h+7]=R-I,h+=8}for(h=0,c=0;c<8;++c){n=e[h],r=e[h+8],i=e[h+16],a=e[h+24],o=e[h+32],s=e[h+40],u=e[h+48];var B=n+(l=e[h+56]),C=n-l,O=r+u,z=r-u,D=i+s,F=i-s,N=a+o,P=a-o,U=B+N,q=B-N,V=O+D,Z=O-D;e[h]=U+V,e[h+32]=U-V;var W=.707106781*(Z+q);e[h+16]=q+W,e[h+48]=q-W;var G=.382683433*((U=P+F)-(Z=z+C)),H=.5411961*U+G,Y=1.306562965*Z+G,$=.707106781*(V=F+z),X=C+$,J=C-$;e[h+40]=J+H,e[h+24]=J-H,e[h+8]=X+Y,e[h+56]=X-Y,h++}for(c=0;c<64;++c)f=e[c]*t[c],d[c]=f>0?f+.5|0:f-.5|0;return d}(e,t),l=0;l<64;++l)g[E[l]]=u[l];var c=g[0]-n;n=g[0],0==c?C(r[0]):(C(r[p[a=32767+c]]),C(h[a]));for(var f=63;f>0&&0==g[f];f--);if(0==f)return C(o),n;for(var v,m=1;m<=f;){for(var _=m;0==g[m]&&m<=f;++m);var w=m-_;if(w>=16){v=w>>4;for(var b=1;b<=v;++b)C(s);w&=15}a=32767+g[m],C(i[(w<<4)+p[a]]),C(h[a]),m++}return 63!=f&&C(o),n}function F(e){if(e<=0&&(e=1),e>100&&(e=100),o!=e){(function(e){for(var t=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],n=0;n<64;n++){var r=s((t[n]*e+50)/100);r<1?r=1:r>255&&(r=255),u[E[n]]=r}for(var i=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],a=0;a<64;a++){var o=s((i[a]*e+50)/100);o<1?o=1:o>255&&(o=255),l[E[a]]=o}for(var h=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],p=0,d=0;d<8;d++)for(var g=0;g<8;g++)c[p]=1/(u[E[p]]*h[d]*h[g]*8),f[p]=1/(l[E[p]]*h[d]*h[g]*8),p++})(e<50?Math.floor(5e3/e):Math.floor(200-2*e)),o=e}}this.encode=function(t,o){(new Date).getTime();o&&F(o),v=new Array,m=0,_=7,z(65496),z(65504),z(16),O(74),O(70),O(73),O(70),O(0),O(1),O(1),O(0),z(1),z(1),O(0),O(0),function(){z(65499),z(132),O(0);for(var e=0;e<64;e++)O(u[e]);O(1);for(var t=0;t<64;t++)O(l[t])}(),function(e,t){z(65472),z(17),O(8),z(t),z(e),O(3),O(1),O(17),O(0),O(2),O(17),O(1),O(3),O(17),O(1)}(t.width,t.height),function(){z(65476),z(418),O(0);for(var e=0;e<16;e++)O(S[e+1]);for(var t=0;t<=11;t++)O(A[t]);O(16);for(var n=0;n<16;n++)O(T[n+1]);for(var r=0;r<=161;r++)O(M[r]);O(1);for(var i=0;i<16;i++)O(I[i+1]);for(var a=0;a<=11;a++)O(j[a]);O(17);for(var o=0;o<16;o++)O(R[o+1]);for(var s=0;s<=161;s++)O(L[s])}(),z(65498),z(12),O(3),O(1),O(0),O(2),O(17),O(3),O(17),O(0),O(63),O(0);var s=0,h=0,p=0;m=0,_=7,this.encode.displayName="_encode_";for(var d,g,x,E,B,N,P,U,q,V=t.data,Z=t.width,W=t.height,G=4*Z,H=0;H>3)*G+(P=4*(7&q)),H+U>=W&&(N-=G*(H+1+U-W)),d+P>=G&&(N-=d+P-G+4),g=V[N++],x=V[N++],E=V[N++],w[q]=(k[g]+k[x+256>>0]+k[E+512>>0]>>16)-128,b[q]=(k[g+768>>0]+k[x+1024>>0]+k[E+1280>>0]>>16)-128,y[q]=(k[g+1280>>0]+k[x+1536>>0]+k[E+1792>>0]>>16)-128;s=D(w,c,s,n,i),h=D(b,f,h,r,a),p=D(y,f,p,r,a),d+=32}H+=8}if(_>=0){var Y=[];Y[1]=_+1,Y[0]=(1<<_+1)-1,C(Y)}return z(65497),new e(v)},function(){(new Date).getTime();t||(t=50),function(){for(var e=String.fromCharCode,t=0;t<256;t++)x[t]=e(t)}(),n=B(S,A),r=B(I,j),i=B(T,M),a=B(R,L),function(){for(var e=1,t=2,n=1;n<=15;n++){for(var r=e;r>0]=38470*e,k[e+512>>0]=7471*e+32768,k[e+768>>0]=-11059*e,k[e+1024>>0]=-21709*e,k[e+1280>>0]=32768*e+8421375,k[e+1536>>0]=-27439*e,k[e+1792>>0]=-5329*e}(),F(t),(new Date).getTime()}()}t.exports=function(e,t){void 0===t&&(t=50);return{data:new n(t).encode(e,t),width:e.width,height:e.height}}}).call(this,e("buffer").Buffer)},{buffer:4}],111:[function(e,t,n){(function(n){"use strict";var r=e("contentstream"),i=e("gif-encoder"),a=e("jpeg-js"),o=e("pngjs-nozlib").PNG,s=e("ndarray"),u=e("ndarray-ops"),l=e("through");function c(e,t,n){if(4===e.shape.length)return c(e.pick(n),t,0);if(3===e.shape.length)if(3===e.shape[2])u.assign(s(t,[e.shape[0],e.shape[1],3],[4,4*e.shape[0],1]),e),u.assigns(s(t,[e.shape[0]*e.shape[1]],[4],3),255);else if(4===e.shape[2])u.assign(s(t,[e.shape[0],e.shape[1],4],[4,4*e.shape[0],1]),e);else{if(1!==e.shape[2])return new Error("Incompatible array shape");u.assign(s(t,[e.shape[0],e.shape[1],3],[4,4*e.shape[0],1]),s(e.data,[e.shape[0],e.shape[1],3],[e.stride[0],e.stride[1],0],e.offset)),u.assigns(s(t,[e.shape[0]*e.shape[1]],[4],3),255)}else{if(2!==e.shape.length)return new Error("Incompatible array shape");u.assign(s(t,[e.shape[0],e.shape[1],3],[4,4*e.shape[0],1]),s(e.data,[e.shape[0],e.shape[1],3],[e.stride[0],e.stride[1],0],e.offset)),u.assigns(s(t,[e.shape[0]*e.shape[1]],[4],3),255)}return t}function f(e){var t=l();return t.emit("error",e),t}t.exports=function(e,t,s){switch(s=s||{},t.toUpperCase()){case"JPG":case".JPG":case"JPEG":case".JPEG":case"JPE":case".JPE":var u=e.shape[0],l=e.shape[1],h={data:g=c(e,g=new n(u*l*4)),width:u,height:l},p=a.encode(h,s.quality);return new r(p.data);case"GIF":case".GIF":var d=4===e.shape.length?e.shape[0]:1,g=(u=4===e.shape.length?e.shape[1]:e.shape[0],l=4===e.shape.length?e.shape[2]:e.shape[1],new n(u*l*4)),v=new i(u,l);v.writeHeader();for(var m=0;m0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===l.prototype||(t=function(e){return l.from(e)}(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):y(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?y(e,o,t,!1):A(e,o)):y(e,o,t,!1))):r||(o.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=x?e=x:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function E(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(p("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(S,e):S(e))}function S(e){p("emit readable"),e.emit("readable"),j(e)}function A(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(T,e,t))}function T(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;ea.length?a.length:e;if(o===a.length?i+=a:i+=a.slice(0,e),0===(e-=o)){o===a.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=a.slice(o));break}++r}return t.length-=r,i}(e,t):function(e,t){var n=l.allocUnsafe(e),r=t.head,i=1;r.data.copy(n),e-=r.data.length;for(;r=r.next;){var a=r.data,o=e>a.length?a.length:e;if(a.copy(n,n.length-e,0,o),0===(e-=o)){o===a.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=a.slice(o));break}++i}return t.length-=i,n}(e,t);return r}(e,t.buffer,t.decoder),n);var n}function L(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(B,t,e))}function B(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function C(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return p("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?L(this):E(this),null;if(0===(e=k(e,t))&&t.ended)return 0===t.length&&L(this),null;var r,i=t.needReadable;return p("need readable",i),(0===t.length||t.length-e0?R(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&L(this)),null!==r&&this.emit("data",r),r},w.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},w.prototype.pipe=function(e,t){var r=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=e;break;case 1:a.pipes=[a.pipes,e];break;default:a.pipes.push(e)}a.pipesCount+=1,p("pipe count=%d opts=%j",a.pipesCount,t);var u=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?c:w;function l(t,n){p("onunpipe"),t===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,p("cleanup"),e.removeListener("close",m),e.removeListener("finish",_),e.removeListener("drain",f),e.removeListener("error",v),e.removeListener("unpipe",l),r.removeListener("end",c),r.removeListener("end",w),r.removeListener("data",g),h=!0,!a.awaitDrain||e._writableState&&!e._writableState.needDrain||f())}function c(){p("onend"),e.end()}a.endEmitted?i.nextTick(u):r.once("end",u),e.on("unpipe",l);var f=function(e){return function(){var t=e._readableState;p("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&s(e,"data")&&(t.flowing=!0,j(e))}}(r);e.on("drain",f);var h=!1;var d=!1;function g(t){p("ondata"),d=!1,!1!==e.write(t)||d||((1===a.pipesCount&&a.pipes===e||a.pipesCount>1&&-1!==C(a.pipes,e))&&!h&&(p("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,d=!0),r.pause())}function v(t){p("onerror",t),w(),e.removeListener("error",v),0===s(e,"error")&&e.emit("error",t)}function m(){e.removeListener("finish",_),w()}function _(){p("onfinish"),e.removeListener("close",m),w()}function w(){p("unpipe"),r.unpipe(e)}return r.on("data",g),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",v),e.once("close",m),e.once("finish",_),e.emit("pipe",r),a.flowing||(p("pipe resume"),r.resume()),e},w.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var a=0;a-1?i:a.nextTick;_.WritableState=m;var l=e("core-util-is");l.inherits=e("inherits");var c={deprecate:e("util-deprecate")},f=e("./internal/streams/stream"),h=e("safe-buffer").Buffer,p=r.Uint8Array||function(){};var d,g=e("./internal/streams/destroy");function v(){}function m(t,n){s=s||e("./_stream_duplex"),t=t||{};var r=n instanceof s;this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var i=t.highWaterMark,l=t.writableHighWaterMark,c=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(l||0===l)?l:c,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var f=!1===t.decodeStrings;this.decodeStrings=!f,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,i){--t.pendingcb,n?(a.nextTick(i,r),a.nextTick(E,e,t),e._writableState.errorEmitted=!0,e.emit("error",r)):(i(r),e._writableState.errorEmitted=!0,e.emit("error",r),E(e,t))}(e,n,r,t,i);else{var o=x(n);o||n.corked||n.bufferProcessing||!n.bufferedRequest||y(e,n),r?u(b,e,n,o,i):b(e,n,o,i)}}(n,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function _(t){if(s=s||e("./_stream_duplex"),!(d.call(_,this)||this instanceof s))return new _(t);this._writableState=new m(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),f.call(this)}function w(e,t,n,r,i,a,o){t.writelen=r,t.writecb=o,t.writing=!0,t.sync=!0,n?e._writev(i,t.onwrite):e._write(i,a,t.onwrite),t.sync=!1}function b(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),E(e,t)}function y(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,i=new Array(r),a=t.corkedRequestsFree;a.entry=n;for(var s=0,u=!0;n;)i[s]=n,n.isBuf||(u=!1),n=n.next,s+=1;i.allBuffers=u,w(e,t,!0,t.length,i,"",a.finish),t.pendingcb++,t.lastBufferedRequest=null,a.next?(t.corkedRequestsFree=a.next,a.next=null):t.corkedRequestsFree=new o(t),t.bufferedRequestCount=0}else{for(;n;){var l=n.chunk,c=n.encoding,f=n.callback;if(w(e,t,!1,t.objectMode?1:l.length,l,c,f),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function x(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function k(e,t){e._final(function(n){t.pendingcb--,n&&e.emit("error",n),t.prefinished=!0,e.emit("prefinish"),E(e,t)})}function E(e,t){var n=x(t);return n&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,a.nextTick(k,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),n}l.inherits(_,f),m.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(m.prototype,"buffer",{get:c.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(d=Function.prototype[Symbol.hasInstance],Object.defineProperty(_,Symbol.hasInstance,{value:function(e){return!!d.call(this,e)||this===_&&(e&&e._writableState instanceof m)}})):d=function(e){return e instanceof this},_.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},_.prototype.write=function(e,t,n){var r,i=this._writableState,o=!1,s=!i.objectMode&&(r=e,h.isBuffer(r)||r instanceof p);return s&&!h.isBuffer(e)&&(e=function(e){return h.from(e)}(e)),"function"==typeof t&&(n=t,t=null),s?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof n&&(n=v),i.ended?function(e,t){var n=new Error("write after end");e.emit("error",n),a.nextTick(t,n)}(this,n):(s||function(e,t,n,r){var i=!0,o=!1;return null===n?o=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(e.emit("error",o),a.nextTick(r,o),i=!1),i}(this,i,e,n))&&(i.pendingcb++,o=function(e,t,n,r,i,a){if(!n){var o=function(e,t,n){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n));return t}(t,r,i);r!==o&&(n=!0,i="buffer",r=o)}var s=t.objectMode?1:r.length;t.length+=s;var u=t.length-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(e,t,n){t.ending=!0,E(e,t),n&&(t.finished?a.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("timers").setImmediate)},{"./_stream_duplex":114,"./internal/streams/destroy":120,"./internal/streams/stream":121,_process:98,"core-util-is":8,inherits:57,"process-nextick-args":97,"safe-buffer":107,timers:128,"util-deprecate":133}],119:[function(e,t,n){"use strict";var r=e("safe-buffer").Buffer,i=e("util");t.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},e.prototype.concat=function(e){if(0===this.length)return r.alloc(0);if(1===this.length)return this.head.data;for(var t,n,i,a=r.allocUnsafe(e>>>0),o=this.head,s=0;o;)t=o.data,n=a,i=s,t.copy(n,i),s+=o.data.length,o=o.next;return a},e}(),i&&i.inspect&&i.inspect.custom&&(t.exports.prototype[i.inspect.custom]=function(){var e=i.inspect({length:this.length});return this.constructor.name+" "+e})},{"safe-buffer":107,util:3}],120:[function(e,t,n){"use strict";var r=e("process-nextick-args");function i(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var n=this,a=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return a||o?(t?t(e):!e||this._writableState&&this._writableState.errorEmitted||r.nextTick(i,this,e),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?(r.nextTick(i,n,e),n._writableState&&(n._writableState.errorEmitted=!0)):t&&t(e)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},{"process-nextick-args":97}],121:[function(e,t,n){t.exports=e("events").EventEmitter},{events:43}],122:[function(e,t,n){t.exports=e("./readable").PassThrough},{"./readable":123}],123:[function(e,t,n){(n=t.exports=e("./lib/_stream_readable.js")).Stream=n,n.Readable=n,n.Writable=e("./lib/_stream_writable.js"),n.Duplex=e("./lib/_stream_duplex.js"),n.Transform=e("./lib/_stream_transform.js"),n.PassThrough=e("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":114,"./lib/_stream_passthrough.js":115,"./lib/_stream_readable.js":116,"./lib/_stream_transform.js":117,"./lib/_stream_writable.js":118}],124:[function(e,t,n){t.exports=e("./readable").Transform},{"./readable":123}],125:[function(e,t,n){t.exports=e("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":118}],126:[function(e,t,n){"use strict";var r=e("safe-buffer").Buffer,i=r.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){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!0;default:return!1}};function a(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(r.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=u,this.end=l,t=4;break;case"utf8":this.fillLast=s,t=4;break;case"base64":this.text=c,this.end=f,t=3;break;default:return this.write=h,void(this.end=p)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(t)}function o(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function s(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function u(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function l(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function c(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function f(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function h(e){return e.toString(this.encoding)}function p(e){return e&&e.length?this.write(e):""}n.StringDecoder=a,a.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0)return i>0&&(e.lastNeed=i-1),i;if(--r=0)return i>0&&(e.lastNeed=i-2),i;if(--r=0)return i>0&&(2===i?i=0:e.lastNeed=i-3),i;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)},a.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},{"safe-buffer":107}],127:[function(e,t,n){(function(n){var r=e("stream");function i(e,t,i){e=e||function(e){this.queue(e)},t=t||function(){this.queue(null)};var a=!1,o=!1,s=[],u=!1,l=new r;function c(){for(;s.length&&!l.paused;){var e=s.shift();if(null===e)return l.emit("end");l.emit("data",e)}}return l.readable=l.writable=!0,l.paused=!1,l.autoDestroy=!(i&&!1===i.autoDestroy),l.write=function(t){return e.call(this,t),!l.paused},l.queue=l.push=function(e){return u?l:(null===e&&(u=!0),s.push(e),c(),l)},l.on("end",function(){l.readable=!1,!l.writable&&l.autoDestroy&&n.nextTick(function(){l.destroy()})}),l.end=function(e){if(!a)return a=!0,arguments.length&&l.write(e),l.writable=!1,t.call(l),!l.readable&&l.autoDestroy&&l.destroy(),l},l.destroy=function(){if(!o)return o=!0,a=!0,s.length=0,l.writable=l.readable=!1,l.emit("close"),l},l.pause=function(){if(!l.paused)return l.paused=!0,l},l.resume=function(){return l.paused&&(l.paused=!1,l.emit("resume")),c(),l.paused||l.emit("drain"),l},l}t.exports=i,i.through=i}).call(this,e("_process"))},{_process:98,stream:112}],128:[function(e,t,n){(function(t,r){var i=e("process/browser.js").nextTick,a=Function.prototype.apply,o=Array.prototype.slice,s={},u=0;function l(e,t){this._id=e,this._clearFn=t}n.setTimeout=function(){return new l(a.call(setTimeout,window,arguments),clearTimeout)},n.setInterval=function(){return new l(a.call(setInterval,window,arguments),clearInterval)},n.clearTimeout=n.clearInterval=function(e){e.close()},l.prototype.unref=l.prototype.ref=function(){},l.prototype.close=function(){this._clearFn.call(window,this._id)},n.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},n.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},n._unrefActive=n.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},n.setImmediate="function"==typeof t?t:function(e){var t=u++,r=!(arguments.length<2)&&o.call(arguments,1);return s[t]=!0,i(function(){s[t]&&(r?e.apply(null,r):e.call(null),n.clearImmediate(t))}),t},n.clearImmediate="function"==typeof r?r:function(e){delete s[e]}}).call(this,e("timers").setImmediate,e("timers").clearImmediate)},{"process/browser.js":98,timers:128}],129:[function(e,t,n){n.isatty=function(){return!1},n.ReadStream=function(){throw new Error("tty.ReadStream is not implemented")},n.WriteStream=function(){throw new Error("tty.WriteStream is not implemented")}},{}],130:[function(e,t,n){(function(t,r){"use strict";var i=e("bit-twiddle"),a=e("dup");t.__TYPEDARRAY_POOL||(t.__TYPEDARRAY_POOL={UINT8:a([32,0]),UINT16:a([32,0]),UINT32:a([32,0]),INT8:a([32,0]),INT16:a([32,0]),INT32:a([32,0]),FLOAT:a([32,0]),DOUBLE:a([32,0]),DATA:a([32,0]),UINT8C:a([32,0]),BUFFER:a([32,0])});var o="undefined"!=typeof Uint8ClampedArray,s=t.__TYPEDARRAY_POOL;s.UINT8C||(s.UINT8C=a([32,0])),s.BUFFER||(s.BUFFER=a([32,0]));var u=s.DATA,l=s.BUFFER;function c(e){if(e){var t=e.length||e.byteLength,n=i.log2(t);u[n].push(e)}}function f(e){e=i.nextPow2(e);var t=i.log2(e),n=u[t];return n.length>0?n.pop():new ArrayBuffer(e)}function h(e){return new Uint8Array(f(e),0,e)}function p(e){return new Uint16Array(f(2*e),0,e)}function d(e){return new Uint32Array(f(4*e),0,e)}function g(e){return new Int8Array(f(e),0,e)}function v(e){return new Int16Array(f(2*e),0,e)}function m(e){return new Int32Array(f(4*e),0,e)}function _(e){return new Float32Array(f(4*e),0,e)}function w(e){return new Float64Array(f(8*e),0,e)}function b(e){return o?new Uint8ClampedArray(f(e),0,e):h(e)}function y(e){return new DataView(f(e),0,e)}function x(e){e=i.nextPow2(e);var t=i.log2(e),n=l[t];return n.length>0?n.pop():new r(e)}n.free=function(e){if(r.isBuffer(e))l[i.log2(e.length)].push(e);else{if("[object ArrayBuffer]"!==Object.prototype.toString.call(e)&&(e=e.buffer),!e)return;var t=e.length||e.byteLength,n=0|i.log2(t);u[n].push(e)}},n.freeUint8=n.freeUint16=n.freeUint32=n.freeInt8=n.freeInt16=n.freeInt32=n.freeFloat32=n.freeFloat=n.freeFloat64=n.freeDouble=n.freeUint8Clamped=n.freeDataView=function(e){c(e.buffer)},n.freeArrayBuffer=c,n.freeBuffer=function(e){l[i.log2(e.length)].push(e)},n.malloc=function(e,t){if(void 0===t||"arraybuffer"===t)return f(e);switch(t){case"uint8":return h(e);case"uint16":return p(e);case"uint32":return d(e);case"int8":return g(e);case"int16":return v(e);case"int32":return m(e);case"float":case"float32":return _(e);case"double":case"float64":return w(e);case"uint8_clamped":return b(e);case"buffer":return x(e);case"data":case"dataview":return y(e);default:return null}return null},n.mallocArrayBuffer=f,n.mallocUint8=h,n.mallocUint16=p,n.mallocUint32=d,n.mallocInt8=g,n.mallocInt16=v,n.mallocInt32=m,n.mallocFloat32=n.mallocFloat=_,n.mallocFloat64=n.mallocDouble=w,n.mallocUint8Clamped=b,n.mallocDataView=y,n.mallocBuffer=x,n.clearCache=function(){for(var e=0;e<32;++e)s.UINT8[e].length=0,s.UINT16[e].length=0,s.UINT32[e].length=0,s.INT8[e].length=0,s.INT16[e].length=0,s.INT32[e].length=0,s.FLOAT[e].length=0,s.DOUBLE[e].length=0,s.UINT8C[e].length=0,u[e].length=0,l[e].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer)},{"bit-twiddle":2,buffer:4,dup:14}],131:[function(e,t,n){"use strict";t.exports=function(e,t,n){return 0===e.length?e:t?(n||e.sort(t),function(e,t){for(var n=1,r=e.length,i=e[0],a=e[0],o=1;o=o?u+1:o}r.mkdir(t+"sequencer"+o,function(){var a=t+"sequencer"+o+"/";for(var s in n.images){var u=n.images[s].steps;if(i){var l=u.slice(-1)[0].output.src,c=u.slice(-1)[0].output.format,f=e("data-uri-to-buffer")(l);r.writeFile(a+s+"_"+(u.length-1)+"."+c,f,function(){})}else for(var h in u){l=u[h].output.src,c=u[h].output.format,f=e("data-uri-to-buffer")(l);r.writeFile(a+s+"_"+h+"."+c,f,function(){})}}})},r.readdir(c,function(e,t){var n=[];if(void 0===t||0==t.length)return f(n),[];for(var i=0;i0&&(thisStep=c[e].steps[t],thisStep.UI.onRemove(thisStep.options.step),c[e].steps.splice(t,1))}function g(){var t=[],n=this;for(var r in arguments)t.push(a(arguments[r]));var i=l.call(this,t,"l");f.push({method:"loadImages",json_q:a(i)});var o=this.copy(i.loadedimages),s={name:"ImageSequencer Wrapper",sequencer:this,addSteps:this.addSteps,removeSteps:this.removeSteps,insertSteps:this.insertSteps,run:this.run,UI:this.UI,setUI:this.setUI,images:o};!function t(r){if(r!=o.length){var a=o[r];e("./ui/LoadImage")(n,a,i.images[a],function(){t(++r)})}else i.callback.call(s)}(0)}function v(e){var t={};if("load-image"==e)return{};if(0==arguments.length){for(var n in this.modules)t[n]=s[n][1];for(var r in this.sequences)t[r]={name:r,steps:u[r]}}else t=s[e]?s[e][1]:{inputs:u[e].options};return t}function m(e){let t=a(v(e.options.name).inputs);t=t||{};for(let n in t)t[n]=e.options[n]||t[n].default,t[n]=encodeURIComponent(t[n]);var n=Object.keys(t).map(e=>e+":"+t[e]).join("|");return`${e.options.name}{${n}}`}function _(e){let t;return(t=e.includes(",")?e.split(","):[e]).map(w)}function w(e){var t;if(t=e.includes("{")?e.includes("(")&&e.indexOf("(")=t.images[u].steps.length?{options:{name:void 0}}:t.images[u].steps.slice(f+e)[0]},t.images[u].steps[f].getIndex=function(){return f},r)r.hasOwnProperty(p)&&(t.images[u].steps[f][p]=r[p]);t.images[u].steps[f].UI.onDraw(t.images[u].steps[f].options.step);var d=e("./RunToolkit")(t.copy(h));t.images[u].steps[f].draw(d,function(){t.images[u].steps[f].options.step.output=t.images[u].steps[f].output.src,t.images[u].steps[f].UI.onComplete(t.images[u].steps[f].options.step),n(a,++s)},o)}}(s,a)}(n=function(e){for(var n in e)0==e[n]&&1==t.images[n].steps.length?delete e[n]:0==e[n]&&e[n]++;for(var n in e)for(var r=t.images[n].steps[e[n]-1];void 0===r||void 0===r.output;)r=t.images[n].steps[--e[n]-1];return e}(n))}},{"./RunToolkit":144,"./util/getStep.js":212}],144:[function(e,t,n){const r=e("get-pixels"),i=e("./modules/_nomodule/PixelManipulation"),a=e("lodash"),o=e("data-uri-to-buffer"),s=e("save-pixels");t.exports=function(e){return e.getPixels=r,e.pixelManipulation=i,e.lodash=a,e.dataUriToBuffer=o,e.savePixels=s,e}},{"./modules/_nomodule/PixelManipulation":207,"data-uri-to-buffer":13,"get-pixels":23,lodash:62,"save-pixels":111}],145:[function(e,t,n){t.exports={sample:[{name:"invert",options:{}},{name:"channel",options:{channel:"red"}},{name:"blur",options:{blur:"5"}}]}},{}],146:[function(e,t,n){t.exports=function(t,n){return t.blur=t.blur||2,t.step.metadata=t.step.metadata||{},{options:t,draw:function(n,r,i){i.stop(!0),i.overrideFlag=!0;var a=this;return e("../_nomodule/PixelManipulation.js")(n,{output:function(e,t,n){a.output={src:t,format:n}},changePixel:function(e,t,n,r){return[e,t,n,r]},extraManipulation:function(e){for(var n=[0,0,0,0],r=0;rAverages (r, g, b, a): "+n.join(", ")+"

"),e},format:n.format,image:t.image,callback:r})},output:void 0,UI:n}}},{"../_nomodule/PixelManipulation.js":207}],147:[function(e,t,n){t.exports=[e("./Module"),e("./info.json")]},{"./Module":146,"./info.json":148}],148:[function(e,t,n){t.exports={name:"Average",description:"Average all pixel color",inputs:{}}},{}],149:[function(require,module,exports){module.exports=function Dynamic(options,UI,util){var output;function draw(input,callback,progressObj){progressObj.stop(!0),progressObj.overrideFlag=!0;var step=this;"string"==typeof options.func&&eval("options.func = "+options.func);var getPixels=require("get-pixels"),priorStep=this.getStep(-2);getPixels(priorStep.output.src,function(e,t){return options.firstImagePixels=t,require("../_nomodule/PixelManipulation.js")(input,{output:function(e,t,n){step.output={src:t,format:n}},changePixel:function(e,t,n,r,i,a){var o=options.firstImagePixels;return options.func(e,t,n,r,o.get(i,a,0),o.get(i,a,1),o.get(i,a,2),o.get(i,a,3))},format:input.format,image:options.image,inBrowser:options.inBrowser,callback:callback})})}return options.func=options.func||"function(r1, g1, b1, a1, r2, g2, b2, a2) { return [ r1, g2, b2, a2 ] }",{options:options,draw:draw,output:output,UI:UI}}},{"../_nomodule/PixelManipulation.js":207,"get-pixels":23}],150:[function(e,t,n){arguments[4][147][0].apply(n,arguments)},{"./Module":149,"./info.json":151,dup:147}],151:[function(e,t,n){t.exports={name:"Blend",description:"Blend the past two image steps with the given function. Defaults to using the red channel from image 1 and the green and blue and alpha channels of image 2. Easier to use interfaces coming soon!",inputs:{blend:{type:"input",desc:"Function to use to blend the two images.",default:"function(r1, g1, b1, a1, r2, g2, b2, a2) { return [ r1, g2, b2, a2 ] }"}}}},{}],152:[function(e,t,n){t.exports=function(e,t){let n=[[2/159,4/159,5/159,4/159,2/159],[4/159,9/159,12/159,9/159,4/159],[5/159,12/159,15/159,12/159,5/159],[4/159,9/159,12/159,9/159,4/159],[2/159,4/159,5/159,4/159,2/159]],r=e;n=function(e){let t=[];for(let n=e.length-1;n>=0;n--){let r=[];for(let t=e[n].length-1;t>=0;t--)r.push(e[n][t]);t.push(r)}return t}(n);for(let t=0;tg;n=0<=g?++c:--c)r[n]=(t-i)/(a-i)*(u[n]-s[n])+s[n];return r}}t.exports=function(e,t){return t.colormap=t.colormap||i.default,"object"==typeof t.colormap?colormapFunction=r(t.colormap):i.hasOwnProperty(t.colormap)?colormapFunction=i[t.colormap]:colormapFunction=i.default,colormapFunction(e/255)};var i={greyscale:r([[0,[0,0,0],[255,255,255]],[1,[255,255,255],[255,255,255]]]),default:r([[0,[0,0,255],[0,255,0]],[.25,[0,255,0],[255,255,0]],[.5,[0,255,255],[255,255,0]],[.75,[255,255,0],[255,0,0]]]),ndvi:r([[0,[0,0,255],[38,195,195]],[.5,[0,150,0],[255,255,0]],[.75,[255,255,0],[255,50,50]]]),stretched:r([[0,[0,0,255],[0,0,255]],[.1,[0,0,255],[38,195,195]],[.5,[0,150,0],[255,255,0]],[.7,[255,255,0],[255,50,50]],[.9,[255,50,50],[255,50,50]]]),fastie:r([[0,[255,255,255],[0,0,0]],[.167,[0,0,0],[255,255,255]],[.33,[255,255,255],[0,0,0]],[.5,[0,0,0],[140,140,255]],[.55,[140,140,255],[0,255,0]],[.63,[0,255,0],[255,255,0]],[.75,[255,255,0],[255,0,0]],[.95,[255,0,0],[255,0,255]]])}},{}],166:[function(e,t,n){t.exports=function(t,n){return{options:t,draw:function(n,r,i){i.stop(!0),i.overrideFlag=!0;var a=this;return e("../_nomodule/PixelManipulation.js")(n,{output:function(e,t,n){a.output={src:t,format:n}},changePixel:function(n,r,i,a){var o=(n+r+i)/3,s=e("./Colormap")(o,t);return[s[0],s[1],s[2],255]},format:n.format,image:t.image,inBrowser:t.inBrowser,callback:r})},output:void 0,UI:n}}},{"../_nomodule/PixelManipulation.js":207,"./Colormap":165}],167:[function(e,t,n){arguments[4][147][0].apply(n,arguments)},{"./Module":166,"./info.json":168,dup:147}],168:[function(e,t,n){t.exports={name:"Colormap",description:"Maps brightness values (average of red, green & blue) to a given color lookup table, made up of a set of one more color gradients.\n\nFor example, 'cooler' colors like blue could represent low values, while 'hot' colors like red could represent high values.",inputs:{colormap:{type:"select",desc:"Name of the Colormap",default:"default",values:["default","greyscale","stretched","fastie"]}}}},{}],169:[function(e,t,n){(function(n){t.exports=function(t,r,i){var a=e("get-pixels"),o=e("save-pixels");r.x=parseInt(r.x)||0,r.y=parseInt(r.y)||0,a(t.src,function(e,a){r.w=parseInt(r.w)||Math.floor(a.shape[0]),r.h=parseInt(r.h)||Math.floor(a.shape[1]);for(var s=r.x,u=r.y,l=r.w,c=r.h,f=a.shape[0],h=new Uint8Array(4*l*c),p=u;pInfragrammar.",inputs:{red:{type:"input",desc:"Expression to return for red channel with R, G, B, and A inputs",default:"r"},green:{type:"input",desc:"Expression to return for green channel with R, G, B, and A inputs",default:"g"},blue:{type:"input",desc:"Expression to return for blue channel with R, G, B, and A inputs",default:"b"},"monochrome (fallback)":{type:"input",desc:"Expression to return with R, G, B, and A inputs; fallback for other channels if none provided",default:"r + g + b"}}}},{}],180:[function(e,t,n){e("lodash");const r=[[-1,0,1],[-2,0,2],[-1,0,1]],i=[[-1,-2,-1],[0,0,0],[1,2,1]];let a,o=[],s=[],u=[],l=[];function c(e,t,n,a,o){let s=0;for(let t=0;t<3;t++)for(let n=0;n<3;n++){let i=a+t-1,u=o+n-1;s+=e.get(i,u,0)*r[t][n]}let u=0;for(let t=0;t<3;t++)for(let n=0;n<3;n++){let r=a+t-1,s=o+n-1;u+=e.get(r,s,0)*i[t][n]}return{pixel:[t,t,t,Math.sqrt(Math.pow(s,2)+Math.pow(u,2))],angle:Math.atan2(u,s)}}t.exports=function(e,t,n,r){a=!r;for(var i=0;ii?s[t][n]>r?u.push(a):l.push(a):e.set(t,n,3,0)}return u.forEach(t=>e.set(t[0],t[1],3,255)),e}(function(e){o=o.map(e=>e.map(f));for(let t=1;t=-22.5&&r<=22.5||r<-157.5&&r>=-180?s[t][n]>=s[t][n+1]&&s[t][n]>=s[t][n-1]?e.set(t,n,3,s[t][n]):e.set(t,n,3,0):r>=22.5&&r<=67.5||r<-112.5&&r>=-157.5?s[t][n]>=s[t+1][n+1]&&s[t][n]>=s[t-1][n-1]?e.set(t,n,3,s[t][n]):e.set(t,n,3,0):r>=67.5&&r<=112.5||r<-67.5&&r>=-112.5?s[t][t]>=s[t+1][n]&&s[t][n]>=s[t][n]?e.set(t,n,3,s[t][n]):e.set(t,n,3,0):(r>=112.5&&r<=157.5||r<-22.5&&r>=-67.5)&&(s[t][n]>=s[t+1][n-1]&&s[t][n]>=s[t-1][n+1]?e.set(t,n,3,s[t][n]):e.set(t,n,3,0))}return e}(e),0,n)};var f=e=>180*e/Math.PI,h=e=>Math.max(...e.map(e=>e.map(e=>e||0)).map(e=>Math.max(...e)))},{lodash:62}],181:[function(e,t,n){t.exports=function(t,n){return t.blur=t.blur||2,t.highThresholdRatio=t.highThresholdRatio||.2,t.lowThresholdRatio=t.lowThresholdRatio||.15,{options:t,draw:function(n,r,i){i.stop(!0),i.overrideFlag=!0;var a=this;return e("../_nomodule/PixelManipulation.js")(n,{output:function(e,t,n){a.output={src:t,format:n}},changePixel:function(e,t,n,r){return[(e+t+n)/3,(e+t+n)/3,(e+t+n)/3,r]},extraManipulation:function(n){return n=e("ndarray-gaussian-filter")(n,t.blur),e("./EdgeUtils")(n,t.highThresholdRatio,t.lowThresholdRatio,t.inBrowser)},format:n.format,image:t.image,inBrowser:t.inBrowser,callback:r})},output:void 0,UI:n}}},{"../_nomodule/PixelManipulation.js":207,"./EdgeUtils":180,"ndarray-gaussian-filter":67}],182:[function(e,t,n){arguments[4][147][0].apply(n,arguments)},{"./Module":181,"./info.json":183,dup:147}],183:[function(e,t,n){t.exports={name:"Detect Edges",description:"this module detects edges using the Canny method, which first Gaussian blurs the image to reduce noise (amount of blur configurable in settings as `options.blur`), then applies a number of steps to highlight edges, resulting in a greyscale image where the brighter the pixel, the stronger the detected edge. Read more at: https://en.wikipedia.org/wiki/Canny_edge_detector",inputs:{blur:{type:"integer",desc:"amount of gaussian blur(Less blur gives more detail, typically 0-5)",default:2},highThresholdRatio:{type:"float",desc:"The high threshold ratio for the image",default:.2},lowThresholdRatio:{type:"float",desc:"The low threshold value for the image",default:.15}}}},{}],184:[function(e,t,n){t.exports=function(t,n){return e("fisheyegl"),{options:t,draw:function(e,n){var r=this;if(t.inBrowser){if(document.querySelector("#image-sequencer-canvas"))var i=document.querySelector("#image-sequencer-canvas");else(i=document.createElement("canvas")).style.display="none",i.setAttribute("id","image-sequencer-canvas"),document.body.append(i);distorter=FisheyeGl({selector:"#image-sequencer-canvas"}),t.a=parseFloat(t.a)||distorter.lens.a,t.b=parseFloat(t.b)||distorter.lens.b,t.Fx=parseFloat(t.Fx)||distorter.lens.Fx,t.Fy=parseFloat(t.Fy)||distorter.lens.Fy,t.scale=parseFloat(t.scale)||distorter.lens.scale,t.x=parseFloat(t.x)||distorter.fov.x,t.y=parseFloat(t.y)||distorter.fov.y,distorter.lens.a=t.a,distorter.lens.b=t.b,distorter.lens.Fx=t.Fx,distorter.lens.Fy=t.Fy,distorter.lens.scale=t.scale,distorter.fov.x=t.x,distorter.fov.y=t.y,distorter.setImage(e.src,function(){r.output={src:i.toDataURL(),format:e.format},n()})}else this.output=e,n()},output:void 0,UI:n}}},{fisheyegl:15}],185:[function(e,t,n){arguments[4][147][0].apply(n,arguments)},{"./Module":184,"./info.json":186,dup:147}],186:[function(e,t,n){t.exports={name:"Fisheye GL",description:"Correct fisheye, or barrel distortion, in images (with WebGL -- adapted from fisheye-correction-webgl by @bluemir).",requires:["webgl"],inputs:{a:{type:"float",desc:"a parameter",default:1,min:1,max:4},b:{type:"float",desc:"b parameter",default:1,min:1,max:4},Fx:{type:"float",desc:"Fx parameter",default:0,min:0,max:4},Fy:{type:"float",desc:"Fy parameter",default:0,min:0,max:4},scale:{type:"float",desc:"Image Scaling",default:1.5,min:0,max:20},x:{type:"float",desc:"FOV x parameter",default:1.5,min:0,max:20},y:{type:"float",desc:"FOV y parameter",default:1.5,min:0,max:20},fragmentSrc:{type:"PATH",desc:"Patht to a WebGL fragment shader file",default:"(inbuilt)"},vertexSrc:{type:"PATH",desc:"Patht to a WebGL vertex shader file",default:"(inbuilt)"}}}},{}],187:[function(e,t,n){(function(n){t.exports=function(t,r){return{options:t,draw:function(t,r,i){var a=e("get-pixels"),o=e("save-pixels"),s=this;a(t.src,function(e,i){if(e)console.log("Bad Image path");else{for(var a=0,u=0;u

Select or drag in an image to overlay.

';$(e.ui).find(".details").prepend(i),sequencer.setInputStep({dropZoneSelector:"#"+r,fileInputSelector:"#"+r+" .file-input",onLoad:function(t){var n=t.target;e.options.imageUrl=n.result,e.options.url=n.result,sequencer.run(),setUrlHashParameter("steps",sequencer.toString())}}),$(e.ui).find(".btn-save").on("click",function(){var t=$(e.ui).find(".det input").val();e.options.imageUrl=t,sequencer.run()})}}}},{}],192:[function(e,t,n){arguments[4][147][0].apply(n,arguments)},{"./Module":190,"./info.json":193,dup:147}],193:[function(e,t,n){t.exports={name:"Import Image",description:"Import a new image and replace the original with it. Future versions may enable a blend mode. Specify an image by URL or by file selector.",url:"https://github.com/publiclab/image-sequencer/tree/master/MODULES.md",inputs:{url:{type:"string",desc:"URL of image to import",default:"./images/monarch.png"}}}},{}],194:[function(e,t,n){t.exports=function(){return this.expandSteps([{name:"ndvi",options:{}},{name:"colormap",options:{}}]),{isMeta:!0}}},{}],195:[function(e,t,n){arguments[4][147][0].apply(n,arguments)},{"./Module":194,"./info.json":196,dup:147}],196:[function(e,t,n){t.exports={name:"NDVI-Colormap",description:"Sequentially Applies NDVI and Colormap steps",inputs:{},length:2}},{}],197:[function(e,t,n){t.exports=function(t,n){if(t.step.inBrowser)var r=e("./Ui.js")(t.step,n);return t.filter=t.filter||"red",{options:t,draw:function(n,i,a){a.stop(!0),a.overrideFlag=!0;var o=this;return e("../_nomodule/PixelManipulation.js")(n,{output:function(e,t,n){o.output={src:t,format:n}},changePixel:function(e,n,r,i){if("red"==t.filter)var a=(r-e)/(1*r+e);"blue"==t.filter&&(a=(e-r)/(1*r+e));var o=255*(a+1)/2;return[o,o,o,i]},format:n.format,image:t.image,inBrowser:t.inBrowser,callback:function(){t.step.inBrowser&&r.setup(),i()}})},output:void 0,UI:n}}},{"../_nomodule/PixelManipulation.js":207,"./Ui.js":198}],198:[function(e,t,n){t.exports=function(e,t){return{setup:function(){var t=$(e.imgElement);t.mousemove(function(e){var n=document.createElement("canvas");n.width=t.width(),n.height=t.height(),n.getContext("2d").drawImage(this,0,0);var r=$(this).offset(),i=e.pageX-r.left,a=e.pageY-r.top,o=n.getContext("2d").getImageData(i,a,1,1).data[0];o=(o=o/127.5-1).toFixed(2),t[0].title="NDVI: "+o})}}}},{}],199:[function(e,t,n){arguments[4][147][0].apply(n,arguments)},{"./Module":197,"./info.json":200,dup:147}],200:[function(e,t,n){t.exports={name:"NDVI",description:"Normalized Difference Vegetation Index, or NDVI, is an image analysis technique used with aerial photography. It's a way to visualize the amounts of infrared and other wavelengths of light reflected from vegetation by comparing ratios of blue and red light absorbed versus green and IR light reflected. NDVI is used to evaluate the health of vegetation in satellite imagery, where it correlates with how much photosynthesis is happening. This is helpful in assessing vegetative health or stress. Read more.

This is designed for use with red-filtered single camera DIY Infragram cameras; change to 'blue' for blue filters",inputs:{filter:{type:"select",desc:"Filter color",default:"red",values:["red","blue"]}}}},{}],201:[function(e,t,n){t.exports=function(t,n,r){return t.x=t.x||0,t.y=t.y||0,{options:t,draw:function(n,r,i){t.offset=t.offset||-2,i.stop(!0),i.overrideFlag=!0;var a=this,o=this.getStep(t.offset).image,s=this.getOutput(t.offset);e("get-pixels")(n.src,function(n,i){return t.secondImagePixels=i,e("../_nomodule/PixelManipulation.js")(s,{output:function(e,t,n){a.output={src:t,format:n}},changePixel:function(e,n,r,i,a,o){var s=t.secondImagePixels;return a>=t.x&&a=t.y&&o
To work with a new or different image, drag one into the drop zone.",ID:t.options.sequencerCounter++,imageName:e,inBrowser:t.options.inBrowser,ui:t.options.ui},o={src:n,steps:[{options:{id:r.ID,name:"load-image",description:"This initial step loads and displays the original image without any modifications.",title:"Load Image",step:r},UI:t.events,draw:function(){return UI.onDraw(options.step),1==arguments.length?(this.output=a(arguments[0]),options.step.output=this.output,UI.onComplete(options.step),!0):2==arguments.length&&(this.output=a(arguments[0]),options.step.output=this.output,arguments[1](),UI.onComplete(options.step),!0)}}]};a(n,function(n){var r=function(e){return{src:e,format:e.split(":")[1].split(";")[0].split("/")[1]}}(n);t.images[e]=o;var a=t.images[e].steps[0];return a.output=r,a.options.step.output=a.output.src,a.UI.onSetup(a.options.step),a.UI.onDraw(a.options.step),a.UI.onComplete(a.options.step),i(),!0})}(n,r)}},{urify:132}],209:[function(e,t,n){t.exports=function(){return function(e){var t=$(e.dropZoneSelector),n=$(e.fileInputSelector),r=e.onLoad;function i(e){if(e.preventDefault(),e.stopPropagation(),e.target&&e.target.files)var t=e.target.files[0];else t=e.dataTransfer.files[0];if(t){var n=new FileReader;n.onload=r,n.readAsDataURL(t)}}new FileReader,n.on("change",i),t[0].addEventListener("drop",i,!1),t.on("dragover",function(e){e.stopPropagation(),e.preventDefault(),e.dataTransfer.dropEffect="copy"},!1),t.on("dragenter",function(e){t.addClass("hover")}),t.on("dragleave",function(e){t.removeClass("hover")})}}},{}],210:[function(e,t,n){t.exports=function(e={}){return e.onSetup=e.onSetup||function(e){0==e.ui||(e.inBrowser?console.log('Added Step "'+e.name+'" to "'+e.imageName+'".'):console.log("%s",'Added Step "'+e.name+'" to "'+e.imageName+'".'))},e.onDraw=e.onDraw||function(e){0==e.ui||(e.inBrowser?console.log('Drawing Step "'+e.name+'" on "'+e.imageName+'".'):console.log("%s",'Drawing Step "'+e.name+'" on "'+e.imageName+'".'))},e.onComplete=e.onComplete||function(e){0==e.ui||(e.inBrowser?console.log('Drawn Step "'+e.name+'" on "'+e.imageName+'".'):console.log("%s",'Drawn Step "'+e.name+'" on "'+e.imageName+'".'))},e.onRemove=e.onRemove||function(e){0==e.ui||(e.inBrowser?console.log('Removing Step "'+e.name+'" of "'+e.imageName+'".'):console.log("%s",'Removing Step "'+e.name+'" of "'+e.imageName+'".'))},e}},{}],211:[function(e,t,n){t.exports=function(e){var t=void 0;return"jpeg"===(t=(t=function(e){return"data:image"===e.substr(0,10)}(e)?e.split(";")[0].split("/").pop():e.split(".").pop()).toLowerCase())&&(t="jpg"),["jpg","jpeg","png","gif","canvas"].includes(t)?t:"jpg"}},{}],212:[function(e,t,n){t.exports={getPreviousStep:function(){return this.getStep(-1)},getNextStep:function(){return this.getStep(1)},getInput:function(e){return e+this.getIndex()===0&&e++,this.getStep(e-1).output},getOutput:function(e){return this.getStep(e).output},getOptions:function(){return this.getStep(0).options},setOptions:function(e){let t=this.getStep(0).options;for(let n in e)t[n]&&(t[n]=e[n])},getFormat:function(){return this.getStep(-1).output.format},getHeight:function(e){let t=new Image;t.onload=function(){e(t.height)},t.src=this.getInput(0).src},getWidth:function(e){let t=new Image;t.onload=function(){e(t.width)},t.src=this.getInput(0).src}}},{}]},{},[139]); \ No newline at end of file +!function(){return function e(t,n,r){function i(o,s){if(!n[o]){if(!t[o]){var u="function"==typeof require&&require;if(!s&&u)return u(o,!0);if(a)return a(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[o]={exports:{}};t[o][0].call(c.exports,function(e){return i(t[o][1][e]||e)},c,c.exports,e,t,n,r)}return n[o].exports}for(var a="function"==typeof require&&require,o=0;o0?r-4:r,f=0;f>16&255,s[u++]=t>>8&255,s[u++]=255&t;2===o&&(t=i[e.charCodeAt(f)]<<2|i[e.charCodeAt(f+1)]>>4,s[u++]=255&t);1===o&&(t=i[e.charCodeAt(f)]<<10|i[e.charCodeAt(f+1)]<<4|i[e.charCodeAt(f+2)]>>2,s[u++]=t>>8&255,s[u++]=255&t);return s},n.fromByteArray=function(e){for(var t,n=e.length,i=n%3,a=[],o=0,s=n-i;os?s:o+16383));1===i?(t=e[n-1],a.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],a.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return a.join("")};for(var r=[],i=[],a="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=o.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function c(e,t,n){for(var i,a,o=[],s=t;s>18&63]+r[a>>12&63]+r[a>>6&63]+r[63&a]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],2:[function(e,t,n){"use strict";"use restrict";function r(e){var t=32;return(e&=-e)&&t--,65535&e&&(t-=16),16711935&e&&(t-=8),252645135&e&&(t-=4),858993459&e&&(t-=2),1431655765&e&&(t-=1),t}n.INT_BITS=32,n.INT_MAX=2147483647,n.INT_MIN=-1<<31,n.sign=function(e){return(e>0)-(e<0)},n.abs=function(e){var t=e>>31;return(e^t)-t},n.min=function(e,t){return t^(e^t)&-(e65535)<<4,t|=n=((e>>>=t)>255)<<3,t|=n=((e>>>=n)>15)<<2,(t|=n=((e>>>=n)>3)<<1)|(e>>>=n)>>1},n.log10=function(e){return e>=1e9?9:e>=1e8?8:e>=1e7?7:e>=1e6?6:e>=1e5?5:e>=1e4?4:e>=1e3?3:e>=100?2:e>=10?1:0},n.popCount=function(e){return 16843009*((e=(858993459&(e-=e>>>1&1431655765))+(e>>>2&858993459))+(e>>>4)&252645135)>>>24},n.countTrailingZeros=r,n.nextPow2=function(e){return e+=0===e,--e,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,(e|=e>>>16)+1},n.prevPow2=function(e){return e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,(e|=e>>>16)-(e>>>1)},n.parity=function(e){return e^=e>>>16,e^=e>>>8,e^=e>>>4,27030>>>(e&=15)&1};var i=new Array(256);!function(e){for(var t=0;t<256;++t){var n=t,r=t,i=7;for(n>>>=1;n;n>>>=1)r<<=1,r|=1&n,--i;e[t]=r<>>8&255]<<16|i[e>>>16&255]<<8|i[e>>>24&255]},n.interleave2=function(e,t){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e&=65535)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t&=65535)|t<<8))|t<<4))|t<<2))|t<<1))<<1},n.deinterleave2=function(e,t){return(e=65535&((e=16711935&((e=252645135&((e=858993459&((e=e>>>t&1431655765)|e>>>1))|e>>>2))|e>>>4))|e>>>16))<<16>>16},n.interleave3=function(e,t,n){return e=1227133513&((e=3272356035&((e=251719695&((e=4278190335&((e&=1023)|e<<16))|e<<8))|e<<4))|e<<2),(e|=(t=1227133513&((t=3272356035&((t=251719695&((t=4278190335&((t&=1023)|t<<16))|t<<8))|t<<4))|t<<2))<<1)|(n=1227133513&((n=3272356035&((n=251719695&((n=4278190335&((n&=1023)|n<<16))|n<<8))|n<<4))|n<<2))<<2},n.deinterleave3=function(e,t){return(e=1023&((e=4278190335&((e=251719695&((e=3272356035&((e=e>>>t&1227133513)|e>>>2))|e>>>4))|e>>>8))|e>>>16))<<22>>22},n.nextCombination=function(e){var t=e|e-1;return t+1|(~t&-~t)-1>>>r(e)+1}},{}],3:[function(e,t,n){},{}],4:[function(e,t,n){"use strict";var r=e("base64-js"),i=e("ieee754");n.Buffer=s,n.SlowBuffer=function(e){+e!=e&&(e=0);return s.alloc(+e)},n.INSPECT_MAX_BYTES=50;var a=2147483647;function o(e){if(e>a)throw new RangeError("Invalid typed array length");var t=new Uint8Array(e);return t.__proto__=s.prototype,t}function s(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return c(e)}return u(e,t,n)}function u(e,t,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return P(e)?function(e,t,n){if(t<0||e.byteLength=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|e}function p(e,t){if(s.isBuffer(e))return e.length;if(U(e)||P(e))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return D(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return F(e).length;default:if(r)return D(e).length;t=(""+t).toLowerCase(),r=!0}}function d(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function g(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),q(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=s.from(t,r)),s.isBuffer(t))return 0===t.length?-1:v(e,t,n,r,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,r,i){var a,o=1,s=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,s/=2,u/=2,n/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var c=-1;for(a=n;as&&(n=s-u),a=n;a>=0;a--){for(var f=!0,h=0;hi&&(r=i):r=i;var a=t.length;if(a%2!=0)throw new TypeError("Invalid hex string");r>a/2&&(r=a/2);for(var o=0;o>8,i=n%256,a.push(i),a.push(r);return a}(t,e.length-n),e,n,r)}function k(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function E(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i239?4:l>223?3:l>191?2:1;if(i+f<=n)switch(f){case 1:l<128&&(c=l);break;case 2:128==(192&(a=e[i+1]))&&(u=(31&l)<<6|63&a)>127&&(c=u);break;case 3:a=e[i+1],o=e[i+2],128==(192&a)&&128==(192&o)&&(u=(15&l)<<12|(63&a)<<6|63&o)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:a=e[i+1],o=e[i+2],s=e[i+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(u=(15&l)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&u<1114112&&(c=u)}null===c?(c=65533,f=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),i+=f}return function(e){var t=e.length;if(t<=S)return String.fromCharCode.apply(String,e);var n="",r=0;for(;rthis.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,n);case"utf8":case"utf-8":return E(this,t,n);case"ascii":return A(this,t,n);case"latin1":case"binary":return T(this,t,n);case"base64":return k(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}.apply(this,arguments)},s.prototype.equals=function(e){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===s.compare(this,e)},s.prototype.inspect=function(){var e="",t=n.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),""},s.prototype.compare=function(e,t,n,r,i){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var a=(i>>>=0)-(r>>>=0),o=(n>>>=0)-(t>>>=0),u=Math.min(a,o),l=this.slice(r,i),c=e.slice(t,n),f=0;f>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var a=!1;;)switch(r){case"hex":return m(this,e,t,n);case"utf8":case"utf-8":return _(this,e,t,n);case"ascii":return w(this,e,t,n);case"latin1":case"binary":return b(this,e,t,n);case"base64":return y(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,e,t,n);default:if(a)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),a=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var S=4096;function A(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;ir)&&(n=r);for(var i="",a=t;an)throw new RangeError("Trying to access beyond buffer length")}function R(e,t,n,r,i,a){if(!s.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function L(e,t,n,r,i,a){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function B(e,t,n,r,a){return t=+t,n>>>=0,a||L(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function C(e,t,n,r,a){return t=+t,n>>>=0,a||L(e,0,n,8),i.write(e,t,n,r,52,8),n+8}s.prototype.slice=function(e,t){var n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t>>=0,t>>>=0,n||j(e,t,this.length);for(var r=this[e],i=1,a=0;++a>>=0,t>>>=0,n||j(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},s.prototype.readUInt8=function(e,t){return e>>>=0,t||j(e,1,this.length),this[e]},s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||j(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||j(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||j(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||j(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||j(e,t,this.length);for(var r=this[e],i=1,a=0;++a=(i*=128)&&(r-=Math.pow(2,8*t)),r},s.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||j(e,t,this.length);for(var r=t,i=1,a=this[e+--r];r>0&&(i*=256);)a+=this[e+--r]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},s.prototype.readInt8=function(e,t){return e>>>=0,t||j(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||j(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt16BE=function(e,t){e>>>=0,t||j(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||j(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||j(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readFloatLE=function(e,t){return e>>>=0,t||j(e,4,this.length),i.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||j(e,4,this.length),i.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||j(e,8,this.length),i.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||j(e,8,this.length),i.read(this,e,!1,52,8)},s.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t>>>=0,n>>>=0,r)||R(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,a=0;for(this[t]=255&e;++a>>=0,n>>>=0,r)||R(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},s.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,255,0),this[t]=255&e,t+1},s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var i=Math.pow(2,8*n-1);R(this,e,t,n,i-1,-i)}var a=0,o=1,s=0;for(this[t]=255&e;++a>0)-s&255;return t+n},s.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var i=Math.pow(2,8*n-1);R(this,e,t,n,i-1,-i)}var a=n-1,o=1,s=0;for(this[t+a]=255&e;--a>=0&&(o*=256);)e<0&&0===s&&0!==this[t+a+1]&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+n},s.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeFloatLE=function(e,t,n){return B(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return B(this,e,t,!1,n)},s.prototype.writeDoubleLE=function(e,t,n){return C(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return C(this,e,t,!1,n)},s.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(a<1e3)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(a=t;a55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return a}function F(e){return r.toByteArray(function(e){if((e=e.trim().replace(O,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function N(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function P(e){return e instanceof ArrayBuffer||null!=e&&null!=e.constructor&&"ArrayBuffer"===e.constructor.name&&"number"==typeof e.byteLength}function U(e){return"function"==typeof ArrayBuffer.isView&&ArrayBuffer.isView(e)}function q(e){return e!=e}},{"base64-js":1,ieee754:55}],5:[function(e,t,n){(function(n){var r=e("tty"),i=e("./lib/encode"),a=e("stream").Stream,o=t.exports=function(){var e=null;function t(t){if(e)throw new Error("multiple inputs specified");e=t}var i=null;function a(e){if(i)throw new Error("multiple outputs specified");i=e}for(var o=0;o0&&this.down(t),e>0?this.right(e):e<0&&this.left(-e),this},s.prototype.up=function(e){return void 0===e&&(e=1),this.write(i("["+Math.floor(e)+"A")),this},s.prototype.down=function(e){return void 0===e&&(e=1),this.write(i("["+Math.floor(e)+"B")),this},s.prototype.right=function(e){return void 0===e&&(e=1),this.write(i("["+Math.floor(e)+"C")),this},s.prototype.left=function(e){return void 0===e&&(e=1),this.write(i("["+Math.floor(e)+"D")),this},s.prototype.column=function(e){return this.write(i("["+Math.floor(e)+"G")),this},s.prototype.push=function(e){return this.write(i(e?"7":"[s")),this},s.prototype.pop=function(e){return this.write(i(e?"8":"[u")),this},s.prototype.erase=function(e){return"end"===e||"$"===e?this.write(i("[K")):"start"===e||"^"===e?this.write(i("[1K")):"line"===e?this.write(i("[2K")):"down"===e?this.write(i("[J")):"up"===e?this.write(i("[1J")):"screen"===e?this.write(i("[1J")):this.emit("error",new Error("Unknown erase type: "+e)),this},s.prototype.display=function(e){var t={reset:0,bright:1,dim:2,underscore:4,blink:5,reverse:7,hidden:8}[e];return void 0===t&&this.emit("error",new Error("Unknown attribute: "+e)),this.write(i("["+t+"m")),this},s.prototype.foreground=function(e){if("number"==typeof e)(e<0||e>=256)&&this.emit("error",new Error("Color out of range: "+e)),this.write(i("[38;5;"+e+"m"));else{var t={black:30,red:31,green:32,yellow:33,blue:34,magenta:35,cyan:36,white:37}[e.toLowerCase()];t||this.emit("error",new Error("Unknown color: "+e)),this.write(i("["+t+"m"))}return this},s.prototype.background=function(e){if("number"==typeof e)(e<0||e>=256)&&this.emit("error",new Error("Color out of range: "+e)),this.write(i("[48;5;"+e+"m"));else{var t={black:40,red:41,green:42,yellow:43,blue:44,magenta:45,cyan:46,white:47}[e.toLowerCase()];t||this.emit("error",new Error("Unknown color: "+e)),this.write(i("["+t+"m"))}return this},s.prototype.cursor=function(e){return this.write(i(e?"[?25h":"[?25l")),this};var u=o.extractCodes=function(e){for(var t=[],n=-1,r=0;r=0&&t.push(e.slice(n,r)),n=r):n>=0&&r===e.length-1&&t.push(e.slice(n));return t}}).call(this,e("_process"))},{"./lib/encode":6,_process:98,stream:112,tty:129}],6:[function(e,t,n){(function(e){var n=(t.exports=function(t){return new e([27].concat(function e(t){return"string"==typeof t?t.split("").map(n):Array.isArray(t)?t.reduce(function(t,n){return t.concat(e(n))},[]):void 0}(t)))}).ord=function(e){return e.charCodeAt(0)}}).call(this,e("buffer").Buffer)},{buffer:4}],7:[function(e,t,n){(function(n){"use strict";var r=e("readable-stream").Readable,i=e("util");function a(e,t){if(!(this instanceof a))return new a(e,t);r.call(this,t),null==e&&(e=String(e)),this._obj=e}t.exports=a,i.inherits(a,r),a.prototype._read=function(e){var t=this._obj;"string"==typeof t?this.push(new n(t)):n.isBuffer(t)?this.push(t):this.push(new n(JSON.stringify(t))),this.push(null)}}).call(this,e("buffer").Buffer)},{buffer:4,"readable-stream":106,util:135}],8:[function(e,t,n){(function(e){function t(e){return Object.prototype.toString.call(e)}n.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===t(e)},n.isBoolean=function(e){return"boolean"==typeof e},n.isNull=function(e){return null===e},n.isNullOrUndefined=function(e){return null==e},n.isNumber=function(e){return"number"==typeof e},n.isString=function(e){return"string"==typeof e},n.isSymbol=function(e){return"symbol"==typeof e},n.isUndefined=function(e){return void 0===e},n.isRegExp=function(e){return"[object RegExp]"===t(e)},n.isObject=function(e){return"object"==typeof e&&null!==e},n.isDate=function(e){return"[object Date]"===t(e)},n.isError=function(e){return"[object Error]"===t(e)||e instanceof Error},n.isFunction=function(e){return"function"==typeof e},n.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},n.isBuffer=e.isBuffer}).call(this,{isBuffer:e("../../is-buffer/index.js")})},{"../../is-buffer/index.js":59}],9:[function(e,t,n){"use strict";var r=e("./lib/thunk.js");t.exports=function(e){var t=new function(){this.argTypes=[],this.shimArgs=[],this.arrayArgs=[],this.arrayBlockIndices=[],this.scalarArgs=[],this.offsetArgs=[],this.offsetArgIndex=[],this.indexArgs=[],this.shapeArgs=[],this.funcName="",this.pre=null,this.body=null,this.post=null,this.debug=!1};t.pre=e.pre,t.body=e.body,t.post=e.post;var n=e.args.slice(0);t.argTypes=n;for(var i=0;i0)throw new Error("cwise: pre() block may not reference array args");if(i0)throw new Error("cwise: post() block may not reference array args")}else if("scalar"===a)t.scalarArgs.push(i),t.shimArgs.push("scalar"+i);else if("index"===a){if(t.indexArgs.push(i),i0)throw new Error("cwise: pre() block may not reference array index");if(i0)throw new Error("cwise: post() block may not reference array index")}else if("shape"===a){if(t.shapeArgs.push(i),in.length)throw new Error("cwise: Too many arguments in pre() block");if(t.body.args.length>n.length)throw new Error("cwise: Too many arguments in body() block");if(t.post.args.length>n.length)throw new Error("cwise: Too many arguments in post() block");return t.debug=!!e.printCode||!!e.debug,t.funcName=e.funcName||"cwise",t.blockSize=e.blockSize||64,r(t)}},{"./lib/thunk.js":11}],10:[function(e,t,n){"use strict";var r=e("uniq");function i(e,t,n){var r,i,a=e.length,o=t.arrayArgs.length,s=t.indexArgs.length>0,u=[],l=[],c=0,f=0;for(r=0;r0&&u.push("var "+l.join(",")),r=a-1;r>=0;--r)c=e[r],u.push(["for(i",r,"=0;i",r,"0&&u.push(["index[",f,"]-=s",f].join("")),u.push(["++index[",c,"]"].join(""))),u.push("}")}return u.join("\n")}function a(e,t,n){for(var r=e.body,i=[],a=[],o=0;o0&&_.push("shape=SS.slice(0)"),e.indexArgs.length>0){var w=new Array(n);for(u=0;u0&&m.push("var "+_.join(",")),u=0;u3&&m.push(a(e.pre,e,s));var k=a(e.body,e,s),E=function(e){for(var t=0,n=e[0].length;t0,l=[],c=0;c0;){"].join("")),l.push(["if(j",c,"<",s,"){"].join("")),l.push(["s",t[c],"=j",c].join("")),l.push(["j",c,"=0"].join("")),l.push(["}else{s",t[c],"=",s].join("")),l.push(["j",c,"-=",s,"}"].join("")),u&&l.push(["index[",t[c],"]=j",c].join(""));for(c=0;c3&&m.push(a(e.post,e,s)),e.debug&&console.log("-----Generated cwise routine for ",t,":\n"+m.join("\n")+"\n----------");var S=[e.funcName||"unnamed","_cwise_loop_",o[0].join("s"),"m",E,function(e){for(var t=new Array(e.length),n=!0,r=0;r0&&(n=n&&t[r]===t[r-1])}return n?t[0]:t.join("")}(s)].join("");return new Function(["function ",S,"(",v.join(","),"){",m.join("\n"),"} return ",S].join(""))()}},{uniq:131}],11:[function(e,t,n){"use strict";var r=e("./compile.js");t.exports=function(e){var t=["'use strict'","var CACHED={}"],n=[],i=e.funcName+"_cwise_thunk";t.push(["return function ",i,"(",e.shimArgs.join(","),"){"].join(""));for(var a=[],o=[],s=[["array",e.arrayArgs[0],".shape.slice(",Math.max(0,e.arrayBlockIndices[0]),e.arrayBlockIndices[0]<0?","+e.arrayBlockIndices[0]+")":")"].join("")],u=[],l=[],c=0;c0&&(u.push("array"+e.arrayArgs[0]+".shape.length===array"+f+".shape.length+"+(Math.abs(e.arrayBlockIndices[0])-Math.abs(e.arrayBlockIndices[c]))),l.push("array"+e.arrayArgs[0]+".shape[shapeIndex+"+Math.max(0,e.arrayBlockIndices[0])+"]===array"+f+".shape[shapeIndex+"+Math.max(0,e.arrayBlockIndices[c])+"]"))}for(e.arrayArgs.length>1&&(t.push("if (!("+u.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same dimensionality!')"),t.push("for(var shapeIndex=array"+e.arrayArgs[0]+".shape.length-"+Math.abs(e.arrayBlockIndices[0])+"; shapeIndex--\x3e0;) {"),t.push("if (!("+l.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),t.push("}")),c=0;c0)return function(e,t){var n,r;for(n=new Array(e),r=0;r 0.99 || vMapping.x < 0.01 || vMapping.y > 0.99 || vMapping.y < 0.01){\n\t\ttexture = vec4(0.0, 0.0, 0.0, 1.0);\n\t} \n\tgl_FragColor = texture;\n}\n"},{}],18:[function(e,t,n){t.exports="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec4 uLens;\nuniform vec2 uFov;\nuniform sampler2D uSampler;\nvarying vec3 vPosition;\nvarying vec2 vTextureCoord;\nvec2 TextureCoord2GLCoord(vec2 textureCoord) {\n\treturn (textureCoord - vec2(0.5, 0.5)) * 2.0;\n}\nvec2 GLCoord2TextureCoord(vec2 glCoord) {\n\treturn glCoord / 2.0 + vec2(0.5, 0.5);\n}\nvoid main(void){\n\tfloat correctionRadius = 0.5;\n\tfloat distance = sqrt(vPosition.x * vPosition.x + vPosition.y * vPosition.y) / correctionRadius;\n\tfloat theta = 1.0;\n\tif(distance != 0.0){\n\t\ttheta = atan(distance);\n\t}\n\tvec2 vMapping = theta * vPosition.xy;\n\tvMapping = GLCoord2TextureCoord(vMapping);\n\t\t\n\tvec4 texture = texture2D(uSampler, vMapping);\n\tif(vMapping.x > 0.99 || vMapping.x < 0.01 || vMapping.y > 0.99 || vMapping.y < 0.01){\n\t\ttexture = vec4(0.0, 0.0, 0.0, 1.0);\n\t} \n\tgl_FragColor = texture;\n}\n"},{}],19:[function(e,t,n){t.exports="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec3 uLensS;\nuniform vec2 uLensF;\nuniform vec2 uFov;\nuniform sampler2D uSampler;\nvarying vec3 vPosition;\nvarying vec2 vTextureCoord;\nvec2 GLCoord2TextureCoord(vec2 glCoord) {\n\treturn glCoord * vec2(1.0, -1.0)/ 2.0 + vec2(0.5, 0.5);\n}\nvoid main(void){\n\tfloat scale = uLensS.z;\n\tvec3 vPos = vPosition;\n\tfloat Fx = uLensF.x;\n\tfloat Fy = uLensF.y;\n\tvec2 vMapping = vPos.xy;\n\tvMapping.x = vMapping.x + ((pow(vPos.y, 2.0)/scale)*vPos.x/scale)*-Fx;\n\tvMapping.y = vMapping.y + ((pow(vPos.x, 2.0)/scale)*vPos.y/scale)*-Fy;\n\tvMapping = vMapping * uLensS.xy;\n\tvMapping = GLCoord2TextureCoord(vMapping/scale);\n\tvec4 texture = texture2D(uSampler, vMapping);\n\tif(vMapping.x > 0.99 || vMapping.x < 0.01 || vMapping.y > 0.99 || vMapping.y < 0.01){\n\t\ttexture = vec4(0.0, 0.0, 0.0, 1.0);\n\t}\n\tgl_FragColor = texture;\n}\n"},{}],20:[function(e,t,n){t.exports="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec4 uLens;\nuniform vec2 uFov;\nuniform sampler2D uSampler;\nvarying vec3 vPosition;\nvarying vec2 vTextureCoord;\nvec2 TextureCoord2GLCoord(vec2 textureCoord) {\n\treturn (textureCoord - vec2(0.5, 0.5)) * 2.0;\n}\nvec2 GLCoord2TextureCoord(vec2 glCoord) {\n\treturn glCoord / 2.0 + vec2(0.5, 0.5);\n}\nvoid main(void){\n\tvec2 vMapping = vec2(vTextureCoord.x, 1.0 - vTextureCoord.y);\n\tvMapping = TextureCoord2GLCoord(vMapping);\n\t//TODO insert Code\n\tfloat F = uLens.x/ uLens.w;\n\tfloat seta = length(vMapping) / F;\n\tvMapping = sin(seta) * F / length(vMapping) * vMapping;\n\tvMapping *= uLens.w * 1.414;\n\tvMapping = GLCoord2TextureCoord(vMapping);\n\tvec4 texture = texture2D(uSampler, vMapping);\n\tif(vMapping.x > 0.99 || vMapping.x < 0.01 || vMapping.y > 0.99 || vMapping.y < 0.01){\n\t\ttexture = vec4(0.0, 0.0, 0.0, 1.0);\n\t} \n\tgl_FragColor = texture;\n}\n"},{}],21:[function(e,t,n){t.exports="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec4 uLens;\nuniform vec2 uFov;\nuniform sampler2D uSampler;\nvarying vec3 vPosition;\nvarying vec2 vTextureCoord;\nvec2 TextureCoord2GLCoord(vec2 textureCoord) {\n\treturn (textureCoord - vec2(0.5, 0.5)) * 2.0;\n}\nvec2 GLCoord2TextureCoord(vec2 glCoord) {\n\treturn glCoord / 2.0 + vec2(0.5, 0.5);\n}\nvoid main(void){\n\tvec2 vMapping = vec2(vTextureCoord.x, 1.0 - vTextureCoord.y);\n\tvMapping = TextureCoord2GLCoord(vMapping);\n\t//TOD insert Code\n\tfloat F = uLens.x/ uLens.w;\n\tfloat seta = length(vMapping) / F;\n\tvMapping = sin(seta) * F / length(vMapping) * vMapping;\n\tvMapping *= uLens.w * 1.414;\n\tvMapping = GLCoord2TextureCoord(vMapping);\n\tvec4 texture = texture2D(uSampler, vMapping);\n\tif(vMapping.x > 0.99 || vMapping.x < 0.01 || vMapping.y > 0.99 || vMapping.y < 0.01){\n\t\ttexture = vec4(0.0, 0.0, 0.0, 1.0);\n\t} \n\tgl_FragColor = texture;\n}\n"},{}],22:[function(e,t,n){t.exports="#ifdef GL_ES\nprecision highp float;\n#endif\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nvarying vec3 vPosition;\nvarying vec2 vTextureCoord;\nvoid main(void){\n\tvPosition = aVertexPosition;\n\tvTextureCoord = aTextureCoord;\n\tgl_Position = vec4(vPosition,1.0);\n}\n"},{}],23:[function(e,t,n){(function(n,r){"use strict";var i=e("path"),a=e("ndarray"),o=e("omggif").GifReader,s=(e("ndarray-pack"),e("through"),e("data-uri-to-buffer"));function u(e,t){var n;try{n=new o(e)}catch(e){return void t(e)}if(n.numFrames()>0){var r=[n.numFrames(),n.height,n.width,4],i=new Uint8Array(r[0]*r[1]*r[2]*r[3]),s=a(i,r);try{for(var u=0;u=0&&(this.dispose=e)},u.prototype.setRepeat=function(e){this.repeat=e},u.prototype.setTransparent=function(e){this.transparent=e},u.prototype.analyzeImage=function(e){this.setImagePixels(this.removeAlphaChannel(e)),this.analyzePixels()},u.prototype.writeImageInfo=function(){this.firstFrame&&(this.writeLSD(),this.writePalette(),this.repeat>=0&&this.writeNetscapeExt()),this.writeGraphicCtrlExt(),this.writeImageDesc(),this.firstFrame||this.writePalette(),this.firstFrame=!1},u.prototype.outputImage=function(){this.writePixels()},u.prototype.addFrame=function(e){this.emit("frame#start"),this.analyzeImage(e),this.writeImageInfo(),this.outputImage(),this.emit("frame#stop")},u.prototype.finish=function(){this.emit("finish#start"),this.writeByte(59),this.emit("finish#stop")},u.prototype.setQuality=function(e){e<1&&(e=1),this.sample=e},u.prototype.writeHeader=function(){this.emit("writeHeader#start"),this.writeUTFBytes("GIF89a"),this.emit("writeHeader#stop")},u.prototype.analyzePixels=function(){var e=this.pixels.length/3;this.indexedPixels=new Uint8Array(e);var t=new a(this.pixels,this.sample);t.buildColormap(),this.colorTab=t.getColormap();for(var n=0,r=0;r>16,n=(65280&e)>>8,r=255&e,i=0,a=16777216,o=this.colorTab.length,s=0;s=0&&(t=7&dispose),t<<=2,this.writeByte(0|t|e),this.writeShort(this.delay),this.writeByte(this.transIndex),this.writeByte(0)},u.prototype.writeImageDesc=function(){this.writeByte(44),this.writeShort(0),this.writeShort(0),this.writeShort(this.width),this.writeShort(this.height),this.firstFrame?this.writeByte(0):this.writeByte(128|this.palSize)},u.prototype.writeLSD=function(){this.writeShort(this.width),this.writeShort(this.height),this.writeByte(240|this.palSize),this.writeByte(0),this.writeByte(0)},u.prototype.writeNetscapeExt=function(){this.writeByte(33),this.writeByte(255),this.writeByte(11),this.writeUTFBytes("NETSCAPE2.0"),this.writeByte(3),this.writeByte(1),this.writeShort(this.repeat),this.writeByte(0)},u.prototype.writePalette=function(){this.writeBytes(this.colorTab);for(var e=768-this.colorTab.length,t=0;t>8&255)},u.prototype.writePixels=function(){new o(this.width,this.height,this.indexedPixels,this.colorDepth).encode(this)},u.prototype.stream=function(){return this},u.ByteCapacitor=s,t.exports=u}).call(this,e("buffer").Buffer)},{"./LZWEncoder.js":26,"./TypedNeuQuant.js":27,assert:36,buffer:4,events:43,"readable-stream":34,util:135}],26:[function(e,t,n){var r=-1,i=12,a=5003,o=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535];t.exports=function(e,t,n,s){var u,l,c,f,h,p,d,g,v,m=Math.max(2,s),_=new Uint8Array(256),w=new Int32Array(a),b=new Int32Array(a),y=0,x=0,k=!1;function E(e,t){_[l++]=e,l>=254&&T(t)}function S(e){A(a),x=g+2,k=!0,j(g,e)}function A(e){for(var t=0;t0&&(e.writeByte(l),e.writeBytes(_,0,l),l=0)}function M(e){return(1<0?u|=e<=8;)E(255&u,t),u>>=8,y-=8;if((x>c||k)&&(k?(c=M(p=d),k=!1):c=++p==i?1<0;)E(255&u,t),u>>=8,y-=8;T(t)}}this.encode=function(n){n.writeByte(m),f=e*t,h=0,function(e,t){var n,o,s,u,f,h,m;for(k=!1,c=M(p=d=e),v=1+(g=1<=0){f=h-s,0===s&&(f=1);do{if((s-=f)<0&&(s+=h),w[s]===n){u=b[s];continue e}}while(w[s]>=0)}j(u,t),u=o,x<1<>c,h=u<>3)*(1<l;)u=T[p++],fl&&((s=n[h--])[0]-=u*(s[0]-r)/_,s[1]-=u*(s[1]-a)/_,s[2]-=u*(s[2]-o)/_)}function j(e,t,r){var a,u,p,d,g,v=~(1<<31),m=v,_=-1,w=_;for(a=0;a>s-o))>c,A[a]-=g,S[a]+=g<>3),e=0;e>p;for(A<=1&&(A=0),n=0;n=c&&(R-=c),0===_&&(_=1),++n%_==0)for(E-=E/f,(A=(S-=S/g)>>p)<=1&&(A=0),l=0;l>=o,n[e][1]>>=o,n[e][2]>>=o,n[e][3]=e}(),function(){var e,t,r,o,s,u,l=0,c=0;for(e=0;e>1,t=l+1;t>1,t=l+1;t<256;t++)E[t]=a}()},this.getColormap=function(){for(var e=[],t=[],r=0;r=0;)c=u?c=i:(c++,s<0&&(s=-s),(a=o[0]-e)<0&&(a=-a),(s+=a)=0&&((s=t-(o=n[f])[1])>=u?f=-1:(f--,s<0&&(s=-s),(a=o[0]-e)<0&&(a=-a),(s+=a)0)if(t.ended&&!a){var s=new Error("stream.push() after EOF");e.emit("error",s)}else if(t.endEmitted&&a){s=new Error("stream.unshift() after end event");e.emit("error",s)}else!t.decoder||a||i||(r=t.decoder.write(r)),a||(t.reading=!1),t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,a?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&g(e)),function(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(function(){!function(e,t){var n=t.length;for(;!t.reading&&!t.flowing&&!t.ended&&t.lengtht.highWaterMark&&(t.highWaterMark=function(e){if(e>=p)e=p;else{e--;for(var t=1;t<32;t<<=1)e|=e>>t;e++}return e}(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function g(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(l("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?n.nextTick(function(){v(e)}):v(e))}function v(e){l("emit readable"),e.emit("readable"),m(e)}function m(e){var t=e._readableState;if(l("flow",t.flowing),t.flowing)do{var n=e.read()}while(null!==n&&t.flowing)}function _(e,t){var n,r=t.buffer,a=t.length,o=!!t.decoder,s=!!t.objectMode;if(0===r.length)return null;if(0===a)n=null;else if(s)n=r.shift();else if(!e||e>=a)n=o?r.join(""):i.concat(r,a),r.length=0;else{if(e0)throw new Error("endReadable called on non-empty stream");t.endEmitted||(t.ended=!0,n.nextTick(function(){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}))}f.prototype.read=function(e){l("read",e);var t=this._readableState,n=e;if((!u.isNumber(e)||e>0)&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return l("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?w(this):g(this),null;if(0===(e=d(e,t))&&t.ended)return 0===t.length&&w(this),null;var r,i=t.needReadable;return l("need readable",i),(0===t.length||t.length-e0?_(e,t):null,u.isNull(r)&&(t.needReadable=!0,e=0),t.length-=e,0!==t.length||t.ended||(t.needReadable=!0),n!==e&&t.ended&&0===t.length&&w(this),u.isNull(r)||this.emit("data",r),r},f.prototype._read=function(e){this.emit("error",new Error("not implemented"))},f.prototype.pipe=function(e,t){var i=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,l("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?c:h;function u(e){l("onunpipe"),e===i&&h()}function c(){l("onend"),e.end()}o.endEmitted?n.nextTick(s):i.once("end",s),e.on("unpipe",u);var f=function(e){return function(){var t=e._readableState;l("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&a.listenerCount(e,"data")&&(t.flowing=!0,m(e))}}(i);function h(){l("cleanup"),e.removeListener("close",g),e.removeListener("finish",v),e.removeListener("drain",f),e.removeListener("error",d),e.removeListener("unpipe",u),i.removeListener("end",c),i.removeListener("end",h),i.removeListener("data",p),!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f()}function p(t){l("ondata"),!1===e.write(t)&&(l("false write response, pause",i._readableState.awaitDrain),i._readableState.awaitDrain++,i.pause())}function d(t){l("onerror",t),_(),e.removeListener("error",d),0===a.listenerCount(e,"error")&&e.emit("error",t)}function g(){e.removeListener("finish",v),_()}function v(){l("onfinish"),e.removeListener("close",g),_()}function _(){l("unpipe"),i.unpipe(e)}return e.on("drain",f),i.on("data",p),e._events&&e._events.error?r(e._events.error)?e._events.error.unshift(d):e._events.error=[d,e._events.error]:e.on("error",d),e.once("close",g),e.once("finish",v),e.emit("pipe",i),o.flowing||(l("pipe resume"),i.resume()),e},f.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i1){for(var n=[],r=0;r=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived=55296&&i<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var r=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,r),r-=this.charReceived);var i;r=(t+=e.toString(this.encoding,0,r)).length-1;if((i=t.charCodeAt(r))>=55296&&i<=56319){var a=this.surrogateSize;return this.charLength+=a,this.charReceived+=a,this.charBuffer.copy(this.charBuffer,a,0,a),e.copy(this.charBuffer,0,0,a),t.substring(0,r)}return t},a.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(t<=2&&n>>4==14){this.charLength=3;break}if(t<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=t},a.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;t+=r.slice(0,n).toString(i)}return t}},{buffer:4}],36:[function(e,t,n){(function(n){"use strict";function r(e,t){if(e===t)return 0;for(var n=e.length,r=t.length,i=0,a=Math.min(n,r);i=0;l--)if(c[l]!==f[l])return!1;for(l=c.length-1;l>=0;l--)if(u=c[l],!_(e[u],t[u],n,r))return!1;return!0}(e,t,n,o))}return n?e===t:e==t}function w(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function b(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function y(e,t,n,r){var i;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof n&&(r=n,n=null),i=function(e){var t;try{e()}catch(e){t=e}return t}(t),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),e&&!i&&v(i,n,"Missing expected exception"+r);var o="string"==typeof r,s=!e&&i&&!n;if((!e&&a.isError(i)&&o&&b(i,n)||s)&&v(i,n,"Got unwanted exception"+r),e&&i&&n&&!b(i,n)||!e&&i)throw i}f.AssertionError=function(e){var t;this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=d(g((t=this).actual),128)+" "+t.operator+" "+d(g(t.expected),128),this.generatedMessage=!0);var n=e.stackStartFunction||v;if(Error.captureStackTrace)Error.captureStackTrace(this,n);else{var r=new Error;if(r.stack){var i=r.stack,a=p(n),o=i.indexOf("\n"+a);if(o>=0){var s=i.indexOf("\n",o+1);i=i.substring(s+1)}this.stack=i}}},a.inherits(f.AssertionError,Error),f.fail=v,f.ok=m,f.equal=function(e,t,n){e!=t&&v(e,t,n,"==",f.equal)},f.notEqual=function(e,t,n){e==t&&v(e,t,n,"!=",f.notEqual)},f.deepEqual=function(e,t,n){_(e,t,!1)||v(e,t,n,"deepEqual",f.deepEqual)},f.deepStrictEqual=function(e,t,n){_(e,t,!0)||v(e,t,n,"deepStrictEqual",f.deepStrictEqual)},f.notDeepEqual=function(e,t,n){_(e,t,!1)&&v(e,t,n,"notDeepEqual",f.notDeepEqual)},f.notDeepStrictEqual=function e(t,n,r){_(t,n,!0)&&v(t,n,r,"notDeepStrictEqual",e)},f.strictEqual=function(e,t,n){e!==t&&v(e,t,n,"===",f.strictEqual)},f.notStrictEqual=function(e,t,n){e===t&&v(e,t,n,"!==",f.notStrictEqual)},f.throws=function(e,t,n){y(!0,e,t,n)},f.doesNotThrow=function(e,t,n){y(!1,e,t,n)},f.ifError=function(e){if(e)throw e};var x=Object.keys||function(e){var t=[];for(var n in e)o.call(e,n)&&t.push(n);return t}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"util/":39}],37:[function(e,t,n){"function"==typeof Object.create?t.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},{}],38:[function(e,t,n){t.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},{}],39:[function(e,t,n){(function(t,r){var i=/%[sdj%]/g;n.format=function(e){if(!m(e)){for(var t=[],n=0;n=a)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}}),u=r[n];n=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),d(t)?r.showHidden=t:t&&n._extend(r,t),_(r.showHidden)&&(r.showHidden=!1),_(r.depth)&&(r.depth=2),_(r.colors)&&(r.colors=!1),_(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=u),c(r,e,r.depth)}function u(e,t){var n=s.styles[t];return n?"["+s.colors[n][0]+"m"+e+"["+s.colors[n][1]+"m":e}function l(e,t){return e}function c(e,t,r){if(e.customInspect&&t&&k(t.inspect)&&t.inspect!==n.inspect&&(!t.constructor||t.constructor.prototype!==t)){var i=t.inspect(r,e);return m(i)||(i=c(e,i,r)),i}var a=function(e,t){if(_(t))return e.stylize("undefined","undefined");if(m(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(v(t))return e.stylize(""+t,"number");if(d(t))return e.stylize(""+t,"boolean");if(g(t))return e.stylize("null","null")}(e,t);if(a)return a;var o=Object.keys(t),s=function(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(t)),x(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return f(t);if(0===o.length){if(k(t)){var u=t.name?": "+t.name:"";return e.stylize("[Function"+u+"]","special")}if(w(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(y(t))return e.stylize(Date.prototype.toString.call(t),"date");if(x(t))return f(t)}var l,b="",E=!1,S=["{","}"];(p(t)&&(E=!0,S=["[","]"]),k(t))&&(b=" [Function"+(t.name?": "+t.name:"")+"]");return w(t)&&(b=" "+RegExp.prototype.toString.call(t)),y(t)&&(b=" "+Date.prototype.toUTCString.call(t)),x(t)&&(b=" "+f(t)),0!==o.length||E&&0!=t.length?r<0?w(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),l=E?function(e,t,n,r,i){for(var a=[],o=0,s=t.length;o=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1];return n[0]+t+" "+e.join(", ")+" "+n[1]}(l,b,S)):S[0]+b+S[1]}function f(e){return"["+Error.prototype.toString.call(e)+"]"}function h(e,t,n,r,i,a){var o,s,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?s=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(s=e.stylize("[Setter]","special")),T(r,i)||(o="["+i+"]"),s||(e.seen.indexOf(u.value)<0?(s=g(n)?c(e,u.value,null):c(e,u.value,n-1)).indexOf("\n")>-1&&(s=a?s.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+s.split("\n").map(function(e){return" "+e}).join("\n")):s=e.stylize("[Circular]","special")),_(o)){if(a&&i.match(/^\d+$/))return s;(o=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+s}function p(e){return Array.isArray(e)}function d(e){return"boolean"==typeof e}function g(e){return null===e}function v(e){return"number"==typeof e}function m(e){return"string"==typeof e}function _(e){return void 0===e}function w(e){return b(e)&&"[object RegExp]"===E(e)}function b(e){return"object"==typeof e&&null!==e}function y(e){return b(e)&&"[object Date]"===E(e)}function x(e){return b(e)&&("[object Error]"===E(e)||e instanceof Error)}function k(e){return"function"==typeof e}function E(e){return Object.prototype.toString.call(e)}function S(e){return e<10?"0"+e.toString(10):e.toString(10)}n.debuglog=function(e){if(_(a)&&(a=t.env.NODE_DEBUG||""),e=e.toUpperCase(),!o[e])if(new RegExp("\\b"+e+"\\b","i").test(a)){var r=t.pid;o[e]=function(){var t=n.format.apply(n,arguments);console.error("%s %d: %s",e,r,t)}}else o[e]=function(){};return o[e]},n.inspect=s,s.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},s.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},n.isArray=p,n.isBoolean=d,n.isNull=g,n.isNullOrUndefined=function(e){return null==e},n.isNumber=v,n.isString=m,n.isSymbol=function(e){return"symbol"==typeof e},n.isUndefined=_,n.isRegExp=w,n.isObject=b,n.isDate=y,n.isError=x,n.isFunction=k,n.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},n.isBuffer=e("./support/isBuffer");var A=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function T(e,t){return Object.prototype.hasOwnProperty.call(e,t)}n.log=function(){var e,t;console.log("%s - %s",(e=new Date,t=[S(e.getHours()),S(e.getMinutes()),S(e.getSeconds())].join(":"),[e.getDate(),A[e.getMonth()],t].join(" ")),n.format.apply(n,arguments))},n.inherits=e("inherits"),n._extend=function(e,t){if(!t||!b(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":38,_process:98,inherits:37}],40:[function(e,t,n){(function(t,r){"use strict";var i=e("assert"),a=e("pako/lib/zlib/zstream"),o=e("pako/lib/zlib/deflate.js"),s=e("pako/lib/zlib/inflate.js"),u=e("pako/lib/zlib/constants");for(var l in u)n[l]=u[l];n.NONE=0,n.DEFLATE=1,n.INFLATE=2,n.GZIP=3,n.GUNZIP=4,n.DEFLATERAW=5,n.INFLATERAW=6,n.UNZIP=7;function c(e){if("number"!=typeof e||en.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=e,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}c.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,i(this.init_done,"close before init"),i(this.mode<=n.UNZIP),this.mode===n.DEFLATE||this.mode===n.GZIP||this.mode===n.DEFLATERAW?o.deflateEnd(this.strm):this.mode!==n.INFLATE&&this.mode!==n.GUNZIP&&this.mode!==n.INFLATERAW&&this.mode!==n.UNZIP||s.inflateEnd(this.strm),this.mode=n.NONE,this.dictionary=null)},c.prototype.write=function(e,t,n,r,i,a,o){return this._write(!0,e,t,n,r,i,a,o)},c.prototype.writeSync=function(e,t,n,r,i,a,o){return this._write(!1,e,t,n,r,i,a,o)},c.prototype._write=function(e,a,o,s,u,l,c,f){if(i.equal(arguments.length,8),i(this.init_done,"write before init"),i(this.mode!==n.NONE,"already finalized"),i.equal(!1,this.write_in_progress,"write already in progress"),i.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,i.equal(!1,void 0===a,"must provide flush value"),this.write_in_progress=!0,a!==n.Z_NO_FLUSH&&a!==n.Z_PARTIAL_FLUSH&&a!==n.Z_SYNC_FLUSH&&a!==n.Z_FULL_FLUSH&&a!==n.Z_FINISH&&a!==n.Z_BLOCK)throw new Error("Invalid flush value");if(null==o&&(o=r.alloc(0),u=0,s=0),this.strm.avail_in=u,this.strm.input=o,this.strm.next_in=s,this.strm.avail_out=f,this.strm.output=l,this.strm.next_out=c,this.flush=a,!e)return this._process(),this._checkError()?this._afterSync():void 0;var h=this;return t.nextTick(function(){h._process(),h._after()}),this},c.prototype._afterSync=function(){var e=this.strm.avail_out,t=this.strm.avail_in;return this.write_in_progress=!1,[t,e]},c.prototype._process=function(){var e=null;switch(this.mode){case n.DEFLATE:case n.GZIP:case n.DEFLATERAW:this.err=o.deflate(this.strm,this.flush);break;case n.UNZIP:switch(this.strm.avail_in>0&&(e=this.strm.next_in),this.gzip_id_bytes_read){case 0:if(null===e)break;if(31!==this.strm.input[e]){this.mode=n.INFLATE;break}if(this.gzip_id_bytes_read=1,e++,1===this.strm.avail_in)break;case 1:if(null===e)break;139===this.strm.input[e]?(this.gzip_id_bytes_read=2,this.mode=n.GUNZIP):this.mode=n.INFLATE;break;default:throw new Error("invalid number of gzip magic number bytes read")}case n.INFLATE:case n.GUNZIP:case n.INFLATERAW:for(this.err=s.inflate(this.strm,this.flush),this.err===n.Z_NEED_DICT&&this.dictionary&&(this.err=s.inflateSetDictionary(this.strm,this.dictionary),this.err===n.Z_OK?this.err=s.inflate(this.strm,this.flush):this.err===n.Z_DATA_ERROR&&(this.err=n.Z_NEED_DICT));this.strm.avail_in>0&&this.mode===n.GUNZIP&&this.err===n.Z_STREAM_END&&0!==this.strm.next_in[0];)this.reset(),this.err=s.inflate(this.strm,this.flush);break;default:throw new Error("Unknown mode "+this.mode)}},c.prototype._checkError=function(){switch(this.err){case n.Z_OK:case n.Z_BUF_ERROR:if(0!==this.strm.avail_out&&this.flush===n.Z_FINISH)return this._error("unexpected end of file"),!1;break;case n.Z_STREAM_END:break;case n.Z_NEED_DICT:return null==this.dictionary?this._error("Missing dictionary"):this._error("Bad dictionary"),!1;default:return this._error("Zlib error"),!1}return!0},c.prototype._after=function(){if(this._checkError()){var e=this.strm.avail_out,t=this.strm.avail_in;this.write_in_progress=!1,this.callback(t,e),this.pending_close&&this.close()}},c.prototype._error=function(e){this.strm.msg&&(e=this.strm.msg),this.onerror(e,this.err),this.write_in_progress=!1,this.pending_close&&this.close()},c.prototype.init=function(e,t,r,a,o){i(4===arguments.length||5===arguments.length,"init(windowBits, level, memLevel, strategy, [dictionary])"),i(e>=8&&e<=15,"invalid windowBits"),i(t>=-1&&t<=9,"invalid compression level"),i(r>=1&&r<=9,"invalid memlevel"),i(a===n.Z_FILTERED||a===n.Z_HUFFMAN_ONLY||a===n.Z_RLE||a===n.Z_FIXED||a===n.Z_DEFAULT_STRATEGY,"invalid strategy"),this._init(t,e,r,a,o),this._setDictionary()},c.prototype.params=function(){throw new Error("deflateParams Not supported")},c.prototype.reset=function(){this._reset(),this._setDictionary()},c.prototype._init=function(e,t,r,i,u){switch(this.level=e,this.windowBits=t,this.memLevel=r,this.strategy=i,this.flush=n.Z_NO_FLUSH,this.err=n.Z_OK,this.mode!==n.GZIP&&this.mode!==n.GUNZIP||(this.windowBits+=16),this.mode===n.UNZIP&&(this.windowBits+=32),this.mode!==n.DEFLATERAW&&this.mode!==n.INFLATERAW||(this.windowBits=-1*this.windowBits),this.strm=new a,this.mode){case n.DEFLATE:case n.GZIP:case n.DEFLATERAW:this.err=o.deflateInit2(this.strm,this.level,n.Z_DEFLATED,this.windowBits,this.memLevel,this.strategy);break;case n.INFLATE:case n.GUNZIP:case n.INFLATERAW:case n.UNZIP:this.err=s.inflateInit2(this.strm,this.windowBits);break;default:throw new Error("Unknown mode "+this.mode)}this.err!==n.Z_OK&&this._error("Init error"),this.dictionary=u,this.write_in_progress=!1,this.init_done=!0},c.prototype._setDictionary=function(){if(null!=this.dictionary){switch(this.err=n.Z_OK,this.mode){case n.DEFLATE:case n.DEFLATERAW:this.err=o.deflateSetDictionary(this.strm,this.dictionary)}this.err!==n.Z_OK&&this._error("Failed to set dictionary")}},c.prototype._reset=function(){switch(this.err=n.Z_OK,this.mode){case n.DEFLATE:case n.DEFLATERAW:case n.GZIP:this.err=o.deflateReset(this.strm);break;case n.INFLATE:case n.INFLATERAW:case n.GUNZIP:this.err=s.inflateReset(this.strm)}this.err!==n.Z_OK&&this._error("Failed to reset stream")},n.Zlib=c}).call(this,e("_process"),e("buffer").Buffer)},{_process:98,assert:36,buffer:4,"pako/lib/zlib/constants":46,"pako/lib/zlib/deflate.js":48,"pako/lib/zlib/inflate.js":50,"pako/lib/zlib/zstream":54}],41:[function(e,t,n){(function(t){"use strict";var r=e("buffer").Buffer,i=e("stream").Transform,a=e("./binding"),o=e("util"),s=e("assert").ok,u=e("buffer").kMaxLength,l="Cannot create final Buffer. It would be larger than 0x"+u.toString(16)+" bytes";a.Z_MIN_WINDOWBITS=8,a.Z_MAX_WINDOWBITS=15,a.Z_DEFAULT_WINDOWBITS=15,a.Z_MIN_CHUNK=64,a.Z_MAX_CHUNK=1/0,a.Z_DEFAULT_CHUNK=16384,a.Z_MIN_MEMLEVEL=1,a.Z_MAX_MEMLEVEL=9,a.Z_DEFAULT_MEMLEVEL=8,a.Z_MIN_LEVEL=-1,a.Z_MAX_LEVEL=9,a.Z_DEFAULT_LEVEL=a.Z_DEFAULT_COMPRESSION;for(var c=Object.keys(a),f=0;f=u?o=new RangeError(l):t=r.concat(i,a),i=[],e.close(),n(o,t)}e.on("error",function(t){e.removeListener("end",s),e.removeListener("readable",o),n(t)}),e.on("end",s),e.end(t),o()}function _(e,t){if("string"==typeof t&&(t=r.from(t)),!r.isBuffer(t))throw new TypeError("Not a string or buffer");var n=e._finishFlushFlag;return e._processChunk(t,n)}function w(e){if(!(this instanceof w))return new w(e);T.call(this,e,a.DEFLATE)}function b(e){if(!(this instanceof b))return new b(e);T.call(this,e,a.INFLATE)}function y(e){if(!(this instanceof y))return new y(e);T.call(this,e,a.GZIP)}function x(e){if(!(this instanceof x))return new x(e);T.call(this,e,a.GUNZIP)}function k(e){if(!(this instanceof k))return new k(e);T.call(this,e,a.DEFLATERAW)}function E(e){if(!(this instanceof E))return new E(e);T.call(this,e,a.INFLATERAW)}function S(e){if(!(this instanceof S))return new S(e);T.call(this,e,a.UNZIP)}function A(e){return e===a.Z_NO_FLUSH||e===a.Z_PARTIAL_FLUSH||e===a.Z_SYNC_FLUSH||e===a.Z_FULL_FLUSH||e===a.Z_FINISH||e===a.Z_BLOCK}function T(e,t){var o=this;if(this._opts=e=e||{},this._chunkSize=e.chunkSize||n.Z_DEFAULT_CHUNK,i.call(this,e),e.flush&&!A(e.flush))throw new Error("Invalid flush flag: "+e.flush);if(e.finishFlush&&!A(e.finishFlush))throw new Error("Invalid flush flag: "+e.finishFlush);if(this._flushFlag=e.flush||a.Z_NO_FLUSH,this._finishFlushFlag=void 0!==e.finishFlush?e.finishFlush:a.Z_FINISH,e.chunkSize&&(e.chunkSizen.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitsn.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.leveln.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLeveln.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=n.Z_FILTERED&&e.strategy!=n.Z_HUFFMAN_ONLY&&e.strategy!=n.Z_RLE&&e.strategy!=n.Z_FIXED&&e.strategy!=n.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!r.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new a.Zlib(t);var s=this;this._hadError=!1,this._handle.onerror=function(e,t){M(s),s._hadError=!0;var r=new Error(e);r.errno=t,r.code=n.codes[t],s.emit("error",r)};var u=n.Z_DEFAULT_COMPRESSION;"number"==typeof e.level&&(u=e.level);var l=n.Z_DEFAULT_STRATEGY;"number"==typeof e.strategy&&(l=e.strategy),this._handle.init(e.windowBits||n.Z_DEFAULT_WINDOWBITS,u,e.memLevel||n.Z_DEFAULT_MEMLEVEL,l,e.dictionary),this._buffer=r.allocUnsafe(this._chunkSize),this._offset=0,this._level=u,this._strategy=l,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!o._handle},configurable:!0,enumerable:!0})}function M(e,n){n&&t.nextTick(n),e._handle&&(e._handle.close(),e._handle=null)}function I(e){e.emit("close")}Object.defineProperty(n,"codes",{enumerable:!0,value:Object.freeze(p),writable:!1}),n.Deflate=w,n.Inflate=b,n.Gzip=y,n.Gunzip=x,n.DeflateRaw=k,n.InflateRaw=E,n.Unzip=S,n.createDeflate=function(e){return new w(e)},n.createInflate=function(e){return new b(e)},n.createDeflateRaw=function(e){return new k(e)},n.createInflateRaw=function(e){return new E(e)},n.createGzip=function(e){return new y(e)},n.createGunzip=function(e){return new x(e)},n.createUnzip=function(e){return new S(e)},n.deflate=function(e,t,n){return"function"==typeof t&&(n=t,t={}),m(new w(t),e,n)},n.deflateSync=function(e,t){return _(new w(t),e)},n.gzip=function(e,t,n){return"function"==typeof t&&(n=t,t={}),m(new y(t),e,n)},n.gzipSync=function(e,t){return _(new y(t),e)},n.deflateRaw=function(e,t,n){return"function"==typeof t&&(n=t,t={}),m(new k(t),e,n)},n.deflateRawSync=function(e,t){return _(new k(t),e)},n.unzip=function(e,t,n){return"function"==typeof t&&(n=t,t={}),m(new S(t),e,n)},n.unzipSync=function(e,t){return _(new S(t),e)},n.inflate=function(e,t,n){return"function"==typeof t&&(n=t,t={}),m(new b(t),e,n)},n.inflateSync=function(e,t){return _(new b(t),e)},n.gunzip=function(e,t,n){return"function"==typeof t&&(n=t,t={}),m(new x(t),e,n)},n.gunzipSync=function(e,t){return _(new x(t),e)},n.inflateRaw=function(e,t,n){return"function"==typeof t&&(n=t,t={}),m(new E(t),e,n)},n.inflateRawSync=function(e,t){return _(new E(t),e)},o.inherits(T,i),T.prototype.params=function(e,r,i){if(en.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(r!=n.Z_FILTERED&&r!=n.Z_HUFFMAN_ONLY&&r!=n.Z_RLE&&r!=n.Z_FIXED&&r!=n.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+r);if(this._level!==e||this._strategy!==r){var o=this;this.flush(a.Z_SYNC_FLUSH,function(){s(o._handle,"zlib binding closed"),o._handle.params(e,r),o._hadError||(o._level=e,o._strategy=r,i&&i())})}else t.nextTick(i)},T.prototype.reset=function(){return s(this._handle,"zlib binding closed"),this._handle.reset()},T.prototype._flush=function(e){this._transform(r.alloc(0),"",e)},T.prototype.flush=function(e,n){var i=this,o=this._writableState;("function"==typeof e||void 0===e&&!n)&&(n=e,e=a.Z_FULL_FLUSH),o.ended?n&&t.nextTick(n):o.ending?n&&this.once("end",n):o.needDrain?n&&this.once("drain",function(){return i.flush(e,n)}):(this._flushFlag=e,this.write(r.alloc(0),"",n))},T.prototype.close=function(e){M(this,e),t.nextTick(I,this)},T.prototype._transform=function(e,t,n){var i,o=this._writableState,s=(o.ending||o.ended)&&(!e||o.length===e.length);return null===e||r.isBuffer(e)?this._handle?(s?i=this._finishFlushFlag:(i=this._flushFlag,e.length>=o.length&&(this._flushFlag=this._opts.flush||a.Z_NO_FLUSH)),void this._processChunk(e,i,n)):n(new Error("zlib binding closed")):n(new Error("invalid input"))},T.prototype._processChunk=function(e,t,n){var i=e&&e.length,a=this._chunkSize-this._offset,o=0,c=this,f="function"==typeof n;if(!f){var h,p=[],d=0;this.on("error",function(e){h=e}),s(this._handle,"zlib binding closed");do{var g=this._handle.writeSync(t,e,o,i,this._buffer,this._offset,a)}while(!this._hadError&&_(g[0],g[1]));if(this._hadError)throw h;if(d>=u)throw M(this),new RangeError(l);var v=r.concat(p,d);return M(this),v}s(this._handle,"zlib binding closed");var m=this._handle.write(t,e,o,i,this._buffer,this._offset,a);function _(u,l){if(this&&(this.buffer=null,this.callback=null),!c._hadError){var h=a-l;if(s(h>=0,"have should not go down"),h>0){var g=c._buffer.slice(c._offset,c._offset+h);c._offset+=h,f?c.push(g):(p.push(g),d+=g.length)}if((0===l||c._offset>=c._chunkSize)&&(a=c._chunkSize,c._offset=0,c._buffer=r.allocUnsafe(c._chunkSize)),0===l){if(o+=i-u,i=u,!f)return!0;var v=c._handle.write(t,e,o,i,c._buffer,c._offset,c._chunkSize);return v.callback=_,void(v.buffer=e)}if(!f)return!1;n()}}m.buffer=e,m.callback=_},o.inherits(w,T),o.inherits(b,T),o.inherits(y,T),o.inherits(x,T),o.inherits(k,T),o.inherits(E,T),o.inherits(S,T)}).call(this,e("_process"))},{"./binding":40,_process:98,assert:36,buffer:4,stream:112,util:135}],42:[function(e,t,n){arguments[4][3][0].apply(n,arguments)},{dup:3}],43:[function(e,t,n){var r=Object.create||function(e){var t=function(){};return t.prototype=e,new t},i=Object.keys||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return n},a=Function.prototype.bind||function(e){var t=this;return function(){return t.apply(e,arguments)}};function o(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=r(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}t.exports=o,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._maxListeners=void 0;var s,u=10;try{var l={};Object.defineProperty&&Object.defineProperty(l,"x",{value:0}),s=0===l.x}catch(e){s=!1}function c(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function f(e,t,n,i){var a,o,s;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if((o=e._events)?(o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),s=o[t]):(o=e._events=r(null),e._eventsCount=0),s){if("function"==typeof s?s=o[t]=i?[n,s]:[s,n]:i?s.unshift(n):s.push(n),!s.warned&&(a=c(e))&&a>0&&s.length>a){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+' "'+String(t)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=s.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",u.name,u.message)}}else s=o[t]=n,++e._eventsCount;return e}function h(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var e=new Array(arguments.length),t=0;t1&&(t=arguments[1]),t instanceof Error)throw t;var u=new Error('Unhandled "error" event. ('+t+")");throw u.context=t,u}if(!(n=o[e]))return!1;var l="function"==typeof n;switch(r=arguments.length){case 1:!function(e,t,n){if(t)e.call(n);else for(var r=e.length,i=v(e,r),a=0;a=0;o--)if(n[o]===t||n[o].listener===t){s=n[o].listener,a=o;break}if(a<0)return this;0===a?n.shift():function(e,t){for(var n=t,r=n+1,i=e.length;r=0;a--)this.removeListener(e,t[a]);return this},o.prototype.listeners=function(e){return d(this,e,!0)},o.prototype.rawListeners=function(e){return d(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):g.call(e,t)},o.prototype.listenerCount=g,o.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],44:[function(e,t,n){"use strict";var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}n.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var r in n)i(n,r)&&(e[r]=n[r])}}return e},n.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var a={arraySet:function(e,t,n,r,i){if(t.subarray&&e.subarray)e.set(t.subarray(n,n+r),i);else for(var a=0;a>>16&65535|0,o=0;0!==n;){n-=o=n>2e3?2e3:n;do{a=a+(i=i+t[r++]|0)|0}while(--o);i%=65521,a%=65521}return i|a<<16|0}},{}],46:[function(e,t,n){"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],47:[function(e,t,n){"use strict";var r=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t,n,i){var a=r,o=i+n;e^=-1;for(var s=i;s>>8^a[255&(e^t[s])];return-1^e}},{}],48:[function(e,t,n){"use strict";var r,i=e("../utils/common"),a=e("./trees"),o=e("./adler32"),s=e("./crc32"),u=e("./messages"),l=0,c=1,f=3,h=4,p=5,d=0,g=1,v=-2,m=-3,_=-5,w=-1,b=1,y=2,x=3,k=4,E=0,S=2,A=8,T=9,M=15,I=8,j=286,R=30,L=19,B=2*j+1,C=15,O=3,z=258,D=z+O+1,F=32,N=42,P=69,U=73,q=91,V=103,Z=113,W=666,G=1,H=2,Y=3,$=4,X=3;function J(e,t){return e.msg=u[t],t}function K(e){return(e<<1)-(e>4?9:0)}function Q(e){for(var t=e.length;--t>=0;)e[t]=0}function ee(e){var t=e.state,n=t.pending;n>e.avail_out&&(n=e.avail_out),0!==n&&(i.arraySet(e.output,t.pending_buf,t.pending_out,n,e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))}function te(e,t){a._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,ee(e.strm)}function ne(e,t){e.pending_buf[e.pending++]=t}function re(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function ie(e,t){var n,r,i=e.max_chain_length,a=e.strstart,o=e.prev_length,s=e.nice_match,u=e.strstart>e.w_size-D?e.strstart-(e.w_size-D):0,l=e.window,c=e.w_mask,f=e.prev,h=e.strstart+z,p=l[a+o-1],d=l[a+o];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do{if(l[(n=t)+o]===d&&l[n+o-1]===p&&l[n]===l[a]&&l[++n]===l[a+1]){a+=2,n++;do{}while(l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&ao){if(e.match_start=t,o=r,r>=s)break;p=l[a+o-1],d=l[a+o]}}}while((t=f[t&c])>u&&0!=--i);return o<=e.lookahead?o:e.lookahead}function ae(e){var t,n,r,a,u,l,c,f,h,p,d=e.w_size;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=d+(d-D)){i.arraySet(e.window,e.window,d,d,0),e.match_start-=d,e.strstart-=d,e.block_start-=d,t=n=e.hash_size;do{r=e.head[--t],e.head[t]=r>=d?r-d:0}while(--n);t=n=d;do{r=e.prev[--t],e.prev[t]=r>=d?r-d:0}while(--n);a+=d}if(0===e.strm.avail_in)break;if(l=e.strm,c=e.window,f=e.strstart+e.lookahead,h=a,p=void 0,(p=l.avail_in)>h&&(p=h),n=0===p?0:(l.avail_in-=p,i.arraySet(c,l.input,l.next_in,p,f),1===l.state.wrap?l.adler=o(l.adler,c,p,f):2===l.state.wrap&&(l.adler=s(l.adler,c,p,f)),l.next_in+=p,l.total_in+=p,p),e.lookahead+=n,e.lookahead+e.insert>=O)for(u=e.strstart-e.insert,e.ins_h=e.window[u],e.ins_h=(e.ins_h<=O&&(e.ins_h=(e.ins_h<=O)if(r=a._tr_tally(e,e.strstart-e.match_start,e.match_length-O),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=O){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<=O&&(e.ins_h=(e.ins_h<4096)&&(e.match_length=O-1)),e.prev_length>=O&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-O,r=a._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-O),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=i&&(e.ins_h=(e.ins_h<15&&(s=2,r-=16),a<1||a>T||n!==A||r<8||r>15||t<0||t>9||o<0||o>k)return J(e,v);8===r&&(r=9);var u=new function(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=A,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new i.Buf16(2*B),this.dyn_dtree=new i.Buf16(2*(2*R+1)),this.bl_tree=new i.Buf16(2*(2*L+1)),Q(this.dyn_ltree),Q(this.dyn_dtree),Q(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(C+1),this.heap=new i.Buf16(2*j+1),Q(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(2*j+1),Q(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0};return e.state=u,u.strm=e,u.wrap=s,u.gzhead=null,u.w_bits=r,u.w_size=1<e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(ae(e),0===e.lookahead&&t===l)return G;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+n;if((0===e.strstart||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,te(e,!1),0===e.strm.avail_out))return G;if(e.strstart-e.block_start>=e.w_size-D&&(te(e,!1),0===e.strm.avail_out))return G}return e.insert=0,t===h?(te(e,!0),0===e.strm.avail_out?Y:$):(e.strstart>e.block_start&&(te(e,!1),e.strm.avail_out),G)}),new ue(4,4,8,4,oe),new ue(4,5,16,8,oe),new ue(4,6,32,32,oe),new ue(4,4,16,16,se),new ue(8,16,32,32,se),new ue(8,16,128,128,se),new ue(8,32,128,256,se),new ue(32,128,258,1024,se),new ue(32,258,258,4096,se)],n.deflateInit=function(e,t){return fe(e,t,A,M,I,E)},n.deflateInit2=fe,n.deflateReset=ce,n.deflateResetKeep=le,n.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?v:(e.state.gzhead=t,d):v},n.deflate=function(e,t){var n,i,o,u;if(!e||!e.state||t>p||t<0)return e?J(e,v):v;if(i=e.state,!e.output||!e.input&&0!==e.avail_in||i.status===W&&t!==h)return J(e,0===e.avail_out?_:v);if(i.strm=e,n=i.last_flush,i.last_flush=t,i.status===N)if(2===i.wrap)e.adler=0,ne(i,31),ne(i,139),ne(i,8),i.gzhead?(ne(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),ne(i,255&i.gzhead.time),ne(i,i.gzhead.time>>8&255),ne(i,i.gzhead.time>>16&255),ne(i,i.gzhead.time>>24&255),ne(i,9===i.level?2:i.strategy>=y||i.level<2?4:0),ne(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(ne(i,255&i.gzhead.extra.length),ne(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=s(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=P):(ne(i,0),ne(i,0),ne(i,0),ne(i,0),ne(i,0),ne(i,9===i.level?2:i.strategy>=y||i.level<2?4:0),ne(i,X),i.status=Z);else{var m=A+(i.w_bits-8<<4)<<8;m|=(i.strategy>=y||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(m|=F),m+=31-m%31,i.status=Z,re(i,m),0!==i.strstart&&(re(i,e.adler>>>16),re(i,65535&e.adler)),e.adler=1}if(i.status===P)if(i.gzhead.extra){for(o=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),ee(e),o=i.pending,i.pending!==i.pending_buf_size));)ne(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=U)}else i.status=U;if(i.status===U)if(i.gzhead.name){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),ee(e),o=i.pending,i.pending===i.pending_buf_size)){u=1;break}u=i.gzindexo&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),0===u&&(i.gzindex=0,i.status=q)}else i.status=q;if(i.status===q)if(i.gzhead.comment){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),ee(e),o=i.pending,i.pending===i.pending_buf_size)){u=1;break}u=i.gzindexo&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),0===u&&(i.status=V)}else i.status=V;if(i.status===V&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&ee(e),i.pending+2<=i.pending_buf_size&&(ne(i,255&e.adler),ne(i,e.adler>>8&255),e.adler=0,i.status=Z)):i.status=Z),0!==i.pending){if(ee(e),0===e.avail_out)return i.last_flush=-1,d}else if(0===e.avail_in&&K(t)<=K(n)&&t!==h)return J(e,_);if(i.status===W&&0!==e.avail_in)return J(e,_);if(0!==e.avail_in||0!==i.lookahead||t!==l&&i.status!==W){var w=i.strategy===y?function(e,t){for(var n;;){if(0===e.lookahead&&(ae(e),0===e.lookahead)){if(t===l)return G;break}if(e.match_length=0,n=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(te(e,!1),0===e.strm.avail_out))return G}return e.insert=0,t===h?(te(e,!0),0===e.strm.avail_out?Y:$):e.last_lit&&(te(e,!1),0===e.strm.avail_out)?G:H}(i,t):i.strategy===x?function(e,t){for(var n,r,i,o,s=e.window;;){if(e.lookahead<=z){if(ae(e),e.lookahead<=z&&t===l)return G;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=O&&e.strstart>0&&(r=s[i=e.strstart-1])===s[++i]&&r===s[++i]&&r===s[++i]){o=e.strstart+z;do{}while(r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&ie.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=O?(n=a._tr_tally(e,1,e.match_length-O),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(te(e,!1),0===e.strm.avail_out))return G}return e.insert=0,t===h?(te(e,!0),0===e.strm.avail_out?Y:$):e.last_lit&&(te(e,!1),0===e.strm.avail_out)?G:H}(i,t):r[i.level].func(i,t);if(w!==Y&&w!==$||(i.status=W),w===G||w===Y)return 0===e.avail_out&&(i.last_flush=-1),d;if(w===H&&(t===c?a._tr_align(i):t!==p&&(a._tr_stored_block(i,0,0,!1),t===f&&(Q(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),ee(e),0===e.avail_out))return i.last_flush=-1,d}return t!==h?d:i.wrap<=0?g:(2===i.wrap?(ne(i,255&e.adler),ne(i,e.adler>>8&255),ne(i,e.adler>>16&255),ne(i,e.adler>>24&255),ne(i,255&e.total_in),ne(i,e.total_in>>8&255),ne(i,e.total_in>>16&255),ne(i,e.total_in>>24&255)):(re(i,e.adler>>>16),re(i,65535&e.adler)),ee(e),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?d:g)},n.deflateEnd=function(e){var t;return e&&e.state?(t=e.state.status)!==N&&t!==P&&t!==U&&t!==q&&t!==V&&t!==Z&&t!==W?J(e,v):(e.state=null,t===Z?J(e,m):d):v},n.deflateSetDictionary=function(e,t){var n,r,a,s,u,l,c,f,h=t.length;if(!e||!e.state)return v;if(2===(s=(n=e.state).wrap)||1===s&&n.status!==N||n.lookahead)return v;for(1===s&&(e.adler=o(e.adler,t,h,0)),n.wrap=0,h>=n.w_size&&(0===s&&(Q(n.head),n.strstart=0,n.block_start=0,n.insert=0),f=new i.Buf8(n.w_size),i.arraySet(f,t,h-n.w_size,n.w_size,0),t=f,h=n.w_size),u=e.avail_in,l=e.next_in,c=e.input,e.avail_in=h,e.next_in=0,e.input=t,ae(n);n.lookahead>=O;){r=n.strstart,a=n.lookahead-(O-1);do{n.ins_h=(n.ins_h<>>=b=w>>>24,d-=b,0===(b=w>>>16&255))A[a++]=65535&w;else{if(!(16&b)){if(0==(64&b)){w=g[(65535&w)+(p&(1<>>=b,d-=b),d<15&&(p+=S[r++]<>>=b=w>>>24,d-=b,!(16&(b=w>>>16&255))){if(0==(64&b)){w=v[(65535&w)+(p&(1<u){e.msg="invalid distance too far back",n.mode=30;break e}if(p>>>=b,d-=b,x>(b=a-o)){if((b=x-b)>c&&n.sane){e.msg="invalid distance too far back",n.mode=30;break e}if(k=0,E=h,0===f){if(k+=l-b,b2;)A[a++]=E[k++],A[a++]=E[k++],A[a++]=E[k++],y-=3;y&&(A[a++]=E[k++],y>1&&(A[a++]=E[k++]))}else{k=a-x;do{A[a++]=A[k++],A[a++]=A[k++],A[a++]=A[k++],y-=3}while(y>2);y&&(A[a++]=A[k++],y>1&&(A[a++]=A[k++]))}break}}break}}while(r>3,p&=(1<<(d-=y<<3))-1,e.next_in=r,e.next_out=a,e.avail_in=r>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function ie(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=x,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new r.Buf32(ee),t.distcode=t.distdyn=new r.Buf32(te),t.sane=1,t.back=-1,d):m}function ae(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,ie(e)):m}function oe(e,t){var n,r;return e&&e.state?(r=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?m:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,ae(e))):m}function se(e,t){var n,i;return e?(i=new function(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0},e.state=i,i.window=null,(n=oe(e,t))!==d&&(e.state=null),n):m}var ue,le,ce=!0;function fe(e){if(ce){var t;for(ue=new r.Buf32(512),le=new r.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(s(l,e.lens,0,288,ue,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;s(c,e.lens,0,32,le,0,e.work,{bits:5}),ce=!1}e.lencode=ue,e.lenbits=9,e.distcode=le,e.distbits=5}function he(e,t,n,i){var a,o=e.state;return null===o.window&&(o.wsize=1<=o.wsize?(r.arraySet(o.window,t,n-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((a=o.wsize-o.wnext)>i&&(a=i),r.arraySet(o.window,t,n-i,a,o.wnext),(i-=a)?(r.arraySet(o.window,t,n-i,i,0),o.wnext=i,o.whave=o.wsize):(o.wnext+=a,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,n.check=a(n.check,Te,2,0),se=0,ue=0,n.mode=k;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&se)<<8)+(se>>8))%31){e.msg="incorrect header check",n.mode=J;break}if((15&se)!==y){e.msg="unknown compression method",n.mode=J;break}if(ue-=4,xe=8+(15&(se>>>=4)),0===n.wbits)n.wbits=xe;else if(xe>n.wbits){e.msg="invalid window size",n.mode=J;break}n.dmax=1<>8&1),512&n.flags&&(Te[0]=255&se,Te[1]=se>>>8&255,n.check=a(n.check,Te,2,0)),se=0,ue=0,n.mode=E;case E:for(;ue<32;){if(0===ae)break e;ae--,se+=ee[ne++]<>>8&255,Te[2]=se>>>16&255,Te[3]=se>>>24&255,n.check=a(n.check,Te,4,0)),se=0,ue=0,n.mode=S;case S:for(;ue<16;){if(0===ae)break e;ae--,se+=ee[ne++]<>8),512&n.flags&&(Te[0]=255&se,Te[1]=se>>>8&255,n.check=a(n.check,Te,2,0)),se=0,ue=0,n.mode=A;case A:if(1024&n.flags){for(;ue<16;){if(0===ae)break e;ae--,se+=ee[ne++]<>>8&255,n.check=a(n.check,Te,2,0)),se=0,ue=0}else n.head&&(n.head.extra=null);n.mode=T;case T:if(1024&n.flags&&((pe=n.length)>ae&&(pe=ae),pe&&(n.head&&(xe=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),r.arraySet(n.head.extra,ee,ne,pe,xe)),512&n.flags&&(n.check=a(n.check,ee,pe,ne)),ae-=pe,ne+=pe,n.length-=pe),n.length))break e;n.length=0,n.mode=M;case M:if(2048&n.flags){if(0===ae)break e;pe=0;do{xe=ee[ne+pe++],n.head&&xe&&n.length<65536&&(n.head.name+=String.fromCharCode(xe))}while(xe&&pe>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=B;break;case R:for(;ue<32;){if(0===ae)break e;ae--,se+=ee[ne++]<>>=7&ue,ue-=7&ue,n.mode=Y;break}for(;ue<3;){if(0===ae)break e;ae--,se+=ee[ne++]<>>=1)){case 0:n.mode=O;break;case 1:if(fe(n),n.mode=U,t===p){se>>>=2,ue-=2;break e}break;case 2:n.mode=F;break;case 3:e.msg="invalid block type",n.mode=J}se>>>=2,ue-=2;break;case O:for(se>>>=7&ue,ue-=7&ue;ue<32;){if(0===ae)break e;ae--,se+=ee[ne++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=J;break}if(n.length=65535&se,se=0,ue=0,n.mode=z,t===p)break e;case z:n.mode=D;case D:if(pe=n.length){if(pe>ae&&(pe=ae),pe>oe&&(pe=oe),0===pe)break e;r.arraySet(te,ee,ne,pe,ie),ae-=pe,ne+=pe,oe-=pe,ie+=pe,n.length-=pe;break}n.mode=B;break;case F:for(;ue<14;){if(0===ae)break e;ae--,se+=ee[ne++]<>>=5,ue-=5,n.ndist=1+(31&se),se>>>=5,ue-=5,n.ncode=4+(15&se),se>>>=4,ue-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=J;break}n.have=0,n.mode=N;case N:for(;n.have>>=3,ue-=3}for(;n.have<19;)n.lens[Me[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,Ee={bits:n.lenbits},ke=s(u,n.lens,0,19,n.lencode,0,n.work,Ee),n.lenbits=Ee.bits,ke){e.msg="invalid code lengths set",n.mode=J;break}n.have=0,n.mode=P;case P:for(;n.have>>16&255,_e=65535&Ae,!((ve=Ae>>>24)<=ue);){if(0===ae)break e;ae--,se+=ee[ne++]<>>=ve,ue-=ve,n.lens[n.have++]=_e;else{if(16===_e){for(Se=ve+2;ue>>=ve,ue-=ve,0===n.have){e.msg="invalid bit length repeat",n.mode=J;break}xe=n.lens[n.have-1],pe=3+(3&se),se>>>=2,ue-=2}else if(17===_e){for(Se=ve+3;ue>>=ve)),se>>>=3,ue-=3}else{for(Se=ve+7;ue>>=ve)),se>>>=7,ue-=7}if(n.have+pe>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=J;break}for(;pe--;)n.lens[n.have++]=xe}}if(n.mode===J)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=J;break}if(n.lenbits=9,Ee={bits:n.lenbits},ke=s(l,n.lens,0,n.nlen,n.lencode,0,n.work,Ee),n.lenbits=Ee.bits,ke){e.msg="invalid literal/lengths set",n.mode=J;break}if(n.distbits=6,n.distcode=n.distdyn,Ee={bits:n.distbits},ke=s(c,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,Ee),n.distbits=Ee.bits,ke){e.msg="invalid distances set",n.mode=J;break}if(n.mode=U,t===p)break e;case U:n.mode=q;case q:if(ae>=6&&oe>=258){e.next_out=ie,e.avail_out=oe,e.next_in=ne,e.avail_in=ae,n.hold=se,n.bits=ue,o(e,ce),ie=e.next_out,te=e.output,oe=e.avail_out,ne=e.next_in,ee=e.input,ae=e.avail_in,se=n.hold,ue=n.bits,n.mode===B&&(n.back=-1);break}for(n.back=0;me=(Ae=n.lencode[se&(1<>>16&255,_e=65535&Ae,!((ve=Ae>>>24)<=ue);){if(0===ae)break e;ae--,se+=ee[ne++]<>we)])>>>16&255,_e=65535&Ae,!(we+(ve=Ae>>>24)<=ue);){if(0===ae)break e;ae--,se+=ee[ne++]<>>=we,ue-=we,n.back+=we}if(se>>>=ve,ue-=ve,n.back+=ve,n.length=_e,0===me){n.mode=H;break}if(32&me){n.back=-1,n.mode=B;break}if(64&me){e.msg="invalid literal/length code",n.mode=J;break}n.extra=15&me,n.mode=V;case V:if(n.extra){for(Se=n.extra;ue>>=n.extra,ue-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=Z;case Z:for(;me=(Ae=n.distcode[se&(1<>>16&255,_e=65535&Ae,!((ve=Ae>>>24)<=ue);){if(0===ae)break e;ae--,se+=ee[ne++]<>we)])>>>16&255,_e=65535&Ae,!(we+(ve=Ae>>>24)<=ue);){if(0===ae)break e;ae--,se+=ee[ne++]<>>=we,ue-=we,n.back+=we}if(se>>>=ve,ue-=ve,n.back+=ve,64&me){e.msg="invalid distance code",n.mode=J;break}n.offset=_e,n.extra=15&me,n.mode=W;case W:if(n.extra){for(Se=n.extra;ue>>=n.extra,ue-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=J;break}n.mode=G;case G:if(0===oe)break e;if(pe=ce-oe,n.offset>pe){if((pe=n.offset-pe)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=J;break}pe>n.wnext?(pe-=n.wnext,de=n.wsize-pe):de=n.wnext-pe,pe>n.length&&(pe=n.length),ge=n.window}else ge=te,de=ie-n.offset,pe=n.length;pe>oe&&(pe=oe),oe-=pe,n.length-=pe;do{te[ie++]=ge[de++]}while(--pe);0===n.length&&(n.mode=q);break;case H:if(0===oe)break e;te[ie++]=n.length,oe--,n.mode=q;break;case Y:if(n.wrap){for(;ue<32;){if(0===ae)break e;ae--,se|=ee[ne++]<=1&&0===O[A];A--);if(T>A&&(T=A),0===A)return l[c++]=20971520,l[c++]=20971520,h.bits=1,0;for(S=1;S0&&(0===e||1!==A))return-1;for(z[1]=0,k=1;k<15;k++)z[k+1]=z[k]+O[k];for(E=0;E852||2===e&&R>592)return 1;for(;;){w=k-I,f[E]<_?(b=0,y=f[E]):f[E]>_?(b=D[F+f[E]],y=B[C+f[E]]):(b=96,y=0),p=1<>I)+(d-=p)]=w<<24|b<<16|y|0}while(0!==d);for(p=1<>=1;if(0!==p?(L&=p-1,L+=p):L=0,E++,0==--O[k]){if(k===A)break;k=t[n+f[E]]}if(k>T&&(L&v)!==g){for(0===I&&(I=T),m+=S,j=1<<(M=k-I);M+I852||2===e&&R>592)return 1;l[g=L&v]=T<<24|M<<16|m-c|0}}return 0!==L&&(l[m+L]=k-I<<24|64<<16|0),h.bits=T,0}},{"../utils/common":44}],52:[function(e,t,n){"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],53:[function(e,t,n){"use strict";var r=e("../utils/common"),i=4,a=0,o=1,s=2;function u(e){for(var t=e.length;--t>=0;)e[t]=0}var l=0,c=1,f=2,h=29,p=256,d=p+1+h,g=30,v=19,m=2*d+1,_=15,w=16,b=7,y=256,x=16,k=17,E=18,S=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],A=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],T=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],M=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],I=new Array(2*(d+2));u(I);var j=new Array(2*g);u(j);var R=new Array(512);u(R);var L=new Array(256);u(L);var B=new Array(h);u(B);var C,O,z,D=new Array(g);function F(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}function N(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function P(e){return e<256?R[e]:R[256+(e>>>7)]}function U(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function q(e,t,n){e.bi_valid>w-n?(e.bi_buf|=t<>w-e.bi_valid,e.bi_valid+=n-w):(e.bi_buf|=t<>>=1,n<<=1}while(--t>0);return n>>>1}function W(e,t,n){var r,i,a=new Array(_+1),o=0;for(r=1;r<=_;r++)a[r]=o=o+n[r-1]<<1;for(i=0;i<=t;i++){var s=e[2*i+1];0!==s&&(e[2*i]=Z(a[s]++,s))}}function G(e){var t;for(t=0;t8?U(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function Y(e,t,n,r){var i=2*t,a=2*n;return e[i]>1;n>=1;n--)$(e,a,n);i=u;do{n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],$(e,a,1),r=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=r,a[2*i]=a[2*n]+a[2*r],e.depth[i]=(e.depth[n]>=e.depth[r]?e.depth[n]:e.depth[r])+1,a[2*n+1]=a[2*r+1]=i,e.heap[1]=i++,$(e,a,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var n,r,i,a,o,s,u=t.dyn_tree,l=t.max_code,c=t.stat_desc.static_tree,f=t.stat_desc.has_stree,h=t.stat_desc.extra_bits,p=t.stat_desc.extra_base,d=t.stat_desc.max_length,g=0;for(a=0;a<=_;a++)e.bl_count[a]=0;for(u[2*e.heap[e.heap_max]+1]=0,n=e.heap_max+1;nd&&(a=d,g++),u[2*r+1]=a,r>l||(e.bl_count[a]++,o=0,r>=p&&(o=h[r-p]),s=u[2*r],e.opt_len+=s*(a+o),f&&(e.static_len+=s*(c[2*r+1]+o)));if(0!==g){do{for(a=d-1;0===e.bl_count[a];)a--;e.bl_count[a]--,e.bl_count[a+1]+=2,e.bl_count[d]--,g-=2}while(g>0);for(a=d;0!==a;a--)for(r=e.bl_count[a];0!==r;)(i=e.heap[--n])>l||(u[2*i+1]!==a&&(e.opt_len+=(a-u[2*i+1])*u[2*i],u[2*i+1]=a),r--)}}(e,t),W(a,l,e.bl_count)}function K(e,t,n){var r,i,a=-1,o=t[1],s=0,u=7,l=4;for(0===o&&(u=138,l=3),t[2*(n+1)+1]=65535,r=0;r<=n;r++)i=o,o=t[2*(r+1)+1],++s>=7;r0?(e.strm.data_type===s&&(e.strm.data_type=function(e){var t,n=4093624447;for(t=0;t<=31;t++,n>>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return a;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return o;for(t=32;t=3&&0===e.bl_tree[2*M[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),u=e.opt_len+3+7>>>3,(l=e.static_len+3+7>>>3)<=u&&(u=l)):u=l=n+5,n+4<=u&&-1!==t?te(e,t,n,r):e.strategy===i||l===u?(q(e,(c<<1)+(r?1:0),3),X(e,I,j)):(q(e,(f<<1)+(r?1:0),3),function(e,t,n,r){var i;for(q(e,t-257,5),q(e,n-1,5),q(e,r-4,4),i=0;i>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&n,e.last_lit++,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(L[n]+p+1)]++,e.dyn_dtree[2*P(t)]++),e.last_lit===e.lit_bufsize-1},n._tr_align=function(e){q(e,c<<1,3),V(e,y,I),function(e){16===e.bi_valid?(U(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":44}],54:[function(e,t,n){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],55:[function(e,t,n){n.read=function(e,t,n,r,i){var a,o,s=8*i-r-1,u=(1<>1,c=-7,f=n?i-1:0,h=n?-1:1,p=e[t+f];for(f+=h,a=p&(1<<-c)-1,p>>=-c,c+=s;c>0;a=256*a+e[t+f],f+=h,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=r;c>0;o=256*o+e[t+f],f+=h,c-=8);if(0===a)a=1-l;else{if(a===u)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,r),a-=l}return(p?-1:1)*o*Math.pow(2,a-r)},n.write=function(e,t,n,r,i,a){var o,s,u,l=8*a-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:a-1,d=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),(t+=o+f>=1?h/u:h*Math.pow(2,1-f))*u>=2&&(o++,u/=2),o+f>=c?(s=0,o=c):o+f>=1?(s=(t*u-1)*Math.pow(2,i),o+=f):(s=t*Math.pow(2,f-1)*Math.pow(2,i),o=0));i>=8;e[n+p]=255&s,p+=d,s/=256,i-=8);for(o=o<0;e[n+p]=255&o,p+=d,o/=256,l-=8);e[n+p-d]|=128*g}},{}],56:[function(e,t,n){t.exports=[function(e,t){return{options:e,draw:function(t,n,r){r.stop(!0),r.overrideFlag=!0;var i=this;return t.pixelManipulation({output:function(e,t,n){i.output={src:t,format:n}},changePixel:function(e,t,n,r){return[255-e,255-t,255-n,r]},format:t.format,image:e.image,inBrowser:e.inBrowser,callback:n})},output:void 0,UI:t}},{name:"Invert",description:"Inverts the image.",inputs:{}}]},{}],57:[function(e,t,n){arguments[4][37][0].apply(n,arguments)},{dup:37}],58:[function(e,t,n){"use strict";t.exports=function(e){for(var t=new Array(e),n=0;n>i;0!=(t&o)&&p++;var d=n>>i;return 0!=(n&o)&&d++,function(e,t,n,o,s,u){function l(e,t,n){return en?n:e}var c=r.BitMatrix.createEmpty(o,s);function f(e,t,n,r,i){for(var o=n*i+t,s=0;sd&&(p=d);for(var g=0;gm&&(v=m);for(var _=l(g,2,t-3),w=l(h,2,n-3),b=0,y=-2;y<=2;y++){var x=u[w+y];b+=x[_-2],b+=x[_-1],b+=x[_],b+=x[_+1],b+=x[_+2]}f(e,v,p,b/25,o)}}return c}(u,p,d,t,n,function(e,t,n,r,o){for(var u=new Array(n),l=0;lh&&(f=h);for(var p=0;pg&&(d=g);for(var v=0,m=255,_=0,w=0,b=f*r+d;w_&&(_=x)}if(_-m>s)for(w++,b+=r;w>2*i;if(_-m<=s&&(k=m>>1,c>0&&p>0)){var E=u[c-1][p]+2*u[c][p-1]+u[c-1][p-1]>>2;m=n&&(e++,r+=t.estimatedModuleSize)}),e<3)return!1;for(var a=r/i,o=0,s=0;s=0&&c(n,l);)o[2]++,l--;if(l<0)return null;for(;l>=0&&!c(n,l)&&o[1]<=r;)o[1]++,l--;if(l<0||o[1]>r)return null;for(;l>=0&&c(n,l)&&o[0]<=r;)o[0]++,l--;if(o[0]>r)return null;for(l=t+1;l=r)return null;for(;l=r)return null;var f=o[0]+o[1]+o[2]+o[3]+o[4];return 5*Math.abs(f-i)>=2*i?null:s(o)?u(o,l):null}(r,Math.floor(f),n[2],l);if(null!=h&&null!=(f=function(t,n,r,i){for(var a=e.width,o=[0,0,0,0,0],l=t;l>=0&&c(l,n);)o[2]++,l--;if(l<0)return null;for(;l>=0&&!c(l,n)&&o[1]<=r;)o[1]++,l--;if(l<0||o[1]>r)return null;for(;l>=0&&c(l,n)&&o[0]<=r;)o[0]++,l--;if(o[0]>r)return null;for(l=t+1;l=r)return null;for(;l=r)return null;var f=o[0]+o[1]+o[2]+o[3]+o[4];return 5*Math.abs(f-i)>=i?null:s(o)?u(o,l):null}(Math.floor(f),Math.floor(h),n[2],l))&&(!a||function(t,n,r,i){for(var a=e.height,o=e.width,u=[0,0,0,0,0],l=0;t-l>=0&&c(n-l,t-l);)u[2]++,l++;if(t-l<0||n-l<0)return!1;for(;t-l>=0&&n-l>=0&&!c(n-l,t-l)&&u[1]<=r;)u[1]++,l++;if(t-l<0||n-l<0||u[1]>r)return!1;for(;t-l>=0&&n-l>=0&&c(n-l,t-l)&&u[0]<=r;)u[0]++,l++;if(u[0]>r)return!1;for(l=1;t+l=a||n+l>=o)return!1;for(;t+l=a||n+l>=o||u[3]>=r)return!1;for(;t+l=r)return!1;var f=u[0]+u[1]+u[2]+u[3]+u[4];return Math.abs(f-i)<2*i&&s(u)}(Math.floor(h),Math.floor(f),n[2],l))){for(var p=l/7,d=!1,g=0;g=n){if(null!=e)return a=!0,Math.floor(Math.abs(e.x-t.x)-Math.abs(e.y-t.y))/2;e=t}}),0}var d=e.height,g=e.width,v=Math.floor(3*d/(4*i));v_[2]&&(w+=x-_[2]-v,y=g-1)}_=[0,0,0,0,0],b=0}else _=[_[2],_[3],_[4],1,0],b=3;else _[++b]++;else _[b]++;s(_)&&h(_,w,g,!1)&&(v=_[0],a&&(m=f()))}var k=function(){var e=t.length;if(e<3)return null;if(e>3){var n=0,r=0;t.forEach(function(e){var t=e.estimatedModuleSize;n+=t,r+=t*t});var i=n/e,a=Math.sqrt(r/e-i*i);t.sort(function(e,t){var n=Math.abs(t.estimatedModuleSize-i),r=Math.abs(e.estimatedModuleSize-i);return n3;s++){var u=t[s];Math.abs(u.estimatedModuleSize-i)>o&&(t.splice(s,1),s--)}}return t.length>3&&(n=0,t.forEach(function(e){n+=e.estimatedModuleSize}),i=n/t.length,t.sort(function(e,t){if(t.count===e.count){var n=Math.abs(t.estimatedModuleSize-i),r=Math.abs(e.estimatedModuleSize-i);return n=i&&a>=o?(n=e[0],t=e[1],r=e[2]):o>=a&&o>=i?(n=e[1],t=e[0],r=e[2]):(n=e[2],t=e[0],r=e[1]),function(e,t,n){var r=t.x,i=t.y;return(n.x-r)*(e.y-i)-(n.y-i)*(e.x-r)}(t,n,r)<0){var s=t;t=r,r=s}return{bottomLeft:{x:t.x,y:t.y},topLeft:{x:n.x,y:n.y},topRight:{x:r.x,y:r.y}}}(k):null}},function(e,t,n){"use strict";var r=n(5),i=n(7),a=n(8),o=n(2),s=n(6);function u(e,t,n){for(var r=!0,i=0;ie||o<-1||o>t)throw new Error;r=!1,-1==a?(n[i]=0,r=!0):a==e&&(n[i]=e-1,r=!0),-1==o?(n[i+1]=0,r=!0):o==t&&(n[i+1]=t-1,r=!0)}r=!0;for(i=n.length-2;i>=0&&r;i-=2){a=Math.floor(n[i]),o=Math.floor(n[i+1]);if(a<-1||a>e||o<-1||o>t)throw new Error;r=!1,-1==a?(n[i]=0,r=!0):a==e&&(n[i]=e-1,r=!0),-1==o?(n[i+1]=0,r=!0):o==t&&(n[i+1]=t-1,r=!0)}return n}function l(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))}function c(e,t,n,i,a){t=Math.floor(t),n=Math.floor(n);var o=Math.floor(i*e),s=Math.max(0,t-o),u=Math.min(a.width,t+o);if(u-s<3*e)return null;var l=Math.max(0,n-o),c=Math.min(a.height-1,n+o);return r.findAlignment(s,l,u-s,c-l,e,a)}function f(e,t,n,r,i){e=Math.floor(e),t=Math.floor(t),n=Math.floor(n),r=Math.floor(r);var a=Math.abs(r-t)>Math.abs(n-e);if(a){var o=e;e=t,t=o,o=n,n=r,r=o}for(var s=Math.abs(n-e),u=Math.abs(r-t),c=-s>>1,f=e0){if(v==r)break;v+=h,c-=s}}return 2==p?l(n+f,r,e,t):NaN}function h(e,t,n,r,i){var a=f(e,t,n,r,i),o=1,s=e-(n-e);s<0?(o=e/(e-s),s=0):s>=i.width&&(o=(i.width-1-e)/(s-e),s=i.width-1);var u=t-(r-t)*o;return o=1,u<0?(o=t/(t-u),u=0):u>=i.height&&(o=(i.height-1-t)/(u-t),u=i.height-1),(a+=f(e,t,s=e+(s-e)*o,u,i))-1}function p(e,t,n){var r=h(e.x,e.y,t.x,t.y,n),i=h(t.x,t.y,e.x,e.y,n);return s.isNaN(r)?i/7:s.isNaN(i)?r/7:(r+i)/14}t.extract=function(e,t){var n=function(e,t,n,r){return(p(e,t,r)+p(e,n,r))/2}(t.topLeft,t.topRight,t.bottomLeft,e);if(n<1)return null;var r=function(e,t,n,r){var i=7+(Math.round(l(e.x,e.y,t.x,t.y)/r)+Math.round(l(e.x,e.y,n.x,n.y)/r)>>1);switch(3&i){case 0:i++;break;case 2:i--}return i}(t.topLeft,t.topRight,t.bottomLeft,n);if(!r)return null;var s=function(e){if(e%4!=1)return null;var t=e-17>>2;return t<1||t>40?null:a.getVersionForNumber(t)}(r);if(null==s)return null;var f=s.getDimensionForVersion()-7,h=null;if(s.alignmentPatternCenters.length>0)for(var d=t.topRight.x-t.topLeft.x+t.bottomLeft.x,g=t.topRight.y-t.topLeft.y+t.bottomLeft.y,v=1-3/f,m=t.topLeft.x+v*(d-t.topLeft.x),_=t.topLeft.y+v*(g-t.topLeft.y),w=4;w<=16&&!(h=c(n,m,_,w,e));w<<=1);return function(e,t,n){if(t<=0)return null;for(var r=o.BitMatrix.createEmpty(t,t),a=new Array(t<<1),s=0;s>1),a[f+1]=c;a=i.transformPoints(n,a);try{var h=u(e.width,e.height,a)}catch(e){return null}for(f=0;f>1,s,e.get(Math.floor(h[f]),Math.floor(h[f+1])))}return r}(e,r,function(e,t,n,r,a){var o,s,u,l,c=a-3.5;return null!=r?(o=r.x,s=r.y,u=l=c-3):(o=t.x-e.x+n.x,s=t.y-e.y+n.y,u=l=c),i.quadrilateralToQuadrilateral(3.5,3.5,c,3.5,u,l,3.5,c,e.x,e.y,t.x,t.y,o,s,n.x,n.y)}(t.topLeft,t.topRight,t.bottomLeft,h,r))}},function(e,t,n){"use strict";var r=n(6);function i(e,t,n,r){if(Math.abs(n-e.y)<=t&&Math.abs(r-e.x)<=t){var i=Math.abs(t-e.estimatedModuleSize);return i<=1||i<=e.estimatedModuleSize}return!1}function a(e,t,n,r){return{x:(e.x+n)/2,y:(e.y+t)/2,estimatedModuleSize:(e.estimatedModuleSize+r)/2}}function o(e,t){for(var n=t/2,r=0;r<3;r++)if(Math.abs(t-e[r])>=n)return!1;return!0}function s(e,t){var n=t-e[2]-e[1]/2;return r.isNaN(n)?null:n}t.findAlignment=function(e,t,n,r,u,l){var c=[];function f(e,t,n,r){var u=e[0]+e[1]+e[2],f=s(e,n);if(null==f)return null;var h=function(e,t,n,r,i,a){for(var u=a.height,l=[0,0,0],c=e;c>=0&&a.get(t,c)&&l[1]<=n;)l[1]++,c--;if(c<0||l[1]>n)return null;for(;c>=0&&!a.get(t,c)&&l[0]<=n;)l[0]++,c--;if(l[0]>n)return null;for(c=e+1;cn)return null;for(;cn)return null;var f=l[0]+l[1]+l[2];return 5*Math.abs(f-r)>=2*r?null:o(l,i)?s(l,c):null}(t,Math.floor(f),2*e[1],u,r,l);if(null!=h){var p=(e[0]+e[1]+e[2])/3;for(var d in c){var g=c[d];if(i(g,p,h,f))return a(g,h,f,p)}var v={x:f,y:h,estimatedModuleSize:p};c.push(v)}return null}for(var h=e+n,p=t+(r>>1),d=[0,0,0],g=0;g>1:-(g+1>>1));d[0]=0,d[1]=0,d[2]=0;for(var m=e;m>4&15]+n[e>>8&15]+n[e>>12&15]+n[e>>16&15]+n[e>>20&15]+n[e>>24&15]+n[e>>28&15]},t.isNaN=function(e){return"[object Number]"===Object.prototype.toString.call(e)&&e!==+e}},function(e,t){"use strict";function n(e,t,n,r,i,a,o,s){var u=e-n+i-o,l=t-r+a-s;if(0==u&&0==l)return{a11:n-e,a21:i-n,a31:e,a12:r-t,a22:a-r,a32:t,a13:0,a23:0,a33:1};var c=n-i,f=o-i,h=r-a,p=s-a,d=c*p-f*h,g=(u*p-f*l)/d,v=(c*l-u*h)/d;return{a11:n-e+g*n,a21:o-e+v*o,a31:e,a12:r-t+g*r,a22:s-t+v*s,a32:t,a13:g,a23:v,a33:1}}t.transformPoints=function(e,t){for(var n=t.length,r=e.a11,i=e.a12,a=e.a13,o=e.a21,s=e.a22,u=e.a23,l=e.a31,c=e.a32,f=e.a33,h=0;h40)throw new Error("Invalid version number "+e);return u[e-1]}t.getVersionForNumber=l},function(e,t,n){"use strict";var r=n(2),i=n(10),a=n(6),o=n(12),s=n(8),u=21522,l=[[21522,0],[20773,1],[24188,2],[23371,3],[17913,4],[16590,5],[20375,6],[19104,7],[30660,8],[29427,9],[32170,10],[30877,11],[26159,12],[25368,13],[27713,14],[26998,15],[5769,16],[5054,17],[7399,18],[6608,19],[1890,20],[597,21],[3340,22],[2107,23],[13663,24],[12392,25],[16177,26],[14854,27],[9396,28],[8579,29],[11994,30],[11245,31]],c=[function(e,t){return 0==(e+t&1)},function(e,t){return 0==(1&e)},function(e,t){return t%3==0},function(e,t){return(e+t)%3==0},function(e,t){return 0==((e>>1)+t/3&1)},function(e,t){return(e*t&1)+e*t%3==0},function(e,t){return 0==((e*t&1)+e*t%3&1)},function(e,t){return 0==((e+t&1)+e*t%3&1)}],f=[{ordinal:1,bits:0,name:"M"},{ordinal:0,bits:1,name:"L"},{ordinal:3,bits:2,name:"H"},{ordinal:2,bits:3,name:"Q"}];function h(e,t,n){for(var i=c[n.dataMask],a=e.height,o=function(e){for(var t=e.getDimensionForVersion(),n=new Array(t*t),i=0;i6&&(a.setRegion(t-11,0,3,6),a.setRegion(0,t-11,6,3)),a}(t),s=!0,u=[],l=0,f=0,h=0,p=a-1;p>0;p-=2){6==p&&p--;for(var d=0;d>3&3],dataMask:7&e}}function d(e,t){for(var n=1/0,r=0,i=0;i=0;r--)t=e.copyBit(8,r,t);var i=e.height,a=0,o=i-7;for(r=i-1;r>=o;r--)a=e.copyBit(8,r,a);for(n=i-8;n>2;if(n<=6)return s.getVersionForNumber(n);for(var r=0,i=t-11,a=5;a>=0;a--)for(var o=t-9;o>=i;o--)r=e.copyBit(o,a,r);var u=s.Version.decodeVersionInformation(r);if(null!=u&&u.getDimensionForVersion()==t)return u;for(r=0,o=5;o>=0;o--)for(a=t-9;a>=i;a--)r=e.copyBit(o,a,r);return null!=(u=s.Version.decodeVersionInformation(r))&&u.getDimensionForVersion()==t?u:null}(e);if(!t)return null;var n=g(e);if(!n)return null;var r=n.errorCorrectionLevel,a=h(e,t,n);if(!a)return null;var o=function(e,t,n){if(e.length!=t.totalCodewords)throw new Error("Invalid number of codewords for version; got "+e.length+" expected "+t.totalCodewords);var r=t.getECBlocksForLevel(n),i=0,a=r.ecBlocks;a.forEach(function(e){i+=e.count});var o=new Array(i),s=0;a.forEach(function(e){for(var t=0;t=0&&o[l].codewords.length!=u;)l--;l++;for(var c=u-r.ecCodewordsPerBlock,f=0,h=0;h=t.length)throw new Error("Could not decode alphanumeric char");return t[e].charCodeAt(0)}var a=function(){function e(e,t){this.characterCountBitsForVersions=e,this.bits=t}return e.prototype.getCharacterCountBits=function(e){if(null==this.characterCountBitsForVersions)throw new Error("Character count doesn't apply to this mode");var t;return t=e<=9?0:e<=26?1:2,this.characterCountBitsForVersions[t]},e}(),o=new a([0,0,0],0),s=new a([10,12,14],1),u=new a([9,11,13],2),l=new a([0,0,0],3),c=new a([8,16,16],4),f=new a(null,7),h=new a([8,10,12],8),p=new a(null,5),d=new a(null,9),g=new a([8,10,12],13);function v(e){switch(e){case 0:return o;case 1:return s;case 2:return u;case 3:return l;case 4:return c;case 5:return p;case 7:return f;case 8:return h;case 9:return d;case 13:return g;default:throw new Error("Couldn't decode mode from byte array")}}function m(e){var t=e.readBits(8);if(0==(128&t))return 127&t;if(128==(192&t))return(63&t)<<8|e.readBits(8);if(192==(224&t))return(31&t)<<16|e.readBits(16);throw new Error("Bad ECI bits starting with byte "+t)}function _(e,t,n){if(13*n>e.available())return!1;for(var r=new Array(2*n),i=0;n>0;){var a=e.readBits(13),o=Math.floor(a/96)<<8|a%96;o+=o<959?41377:42657,r[i]=o>>8&255,r[i+1]=255&o,i+=2,n--}return t.val=r,!0}function w(e,t,n){for(;n>=3;){if(e.available()<10)return!1;var r=e.readBits(10);if(r>=1e3)return!1;t.val.push(i(Math.floor(r/100))),t.val.push(i(Math.floor(r/10)%10)),t.val.push(i(r%10)),n-=3}if(2==n){if(e.available()<7)return!1;var a=e.readBits(7);if(a>=100)return!1;t.val.push(i(Math.floor(a/10))),t.val.push(i(a%10))}else if(1==n){if(e.available()<4)return!1;var o=e.readBits(4);if(o>=10)return!1;t.val.push(i(o))}return!0}function b(e,t,n,r){for(var a=t.val.length;n>1;){if(e.available()<11)return!1;var o=e.readBits(11);t.val.push(i(Math.floor(o/45))),t.val.push(i(o%45)),n-=2}if(1==n){if(e.available()<6)return!1;t.val.push(i(e.readBits(6)))}if(r)for(var s=a;se.available())return!1;for(var r=new Array(n),i=0;i30)return null}else if(i==g){var A=a.readBits(4),T=a.readBits(i.getCharacterCountBits(t));if(A==x&&!_(a,k,T))return null}else{var M=a.readBits(i.getCharacterCountBits(t));if(i==s){if(!w(a,k,M))return null}else if(i==u){if(!b(a,k,M,E))return null}else if(i==c){if(!y(a,k,M))return null}else if(i!=h)return null}return k.val}},function(e,t){"use strict";var n=function(){function e(e){this.byteOffset=0,this.bitOffset=0,this.bytes=e}return e.prototype.readBits=function(e){if(e<1||e>32||e>this.available())throw new Error("Cannot read "+e.toString()+" bits");var t=0;if(this.bitOffset>0){var n=8-this.bitOffset,r=e>8-r<<(a=n-r);t=(this.bytes[this.byteOffset]&i)>>a,e-=r,this.bitOffset+=r,8==this.bitOffset&&(this.bitOffset=0,this.byteOffset++)}if(e>0){for(;e>=8;)t=t<<8|255&this.bytes[this.byteOffset],this.byteOffset++,e-=8;if(e>0){var a;i=255>>(a=8-e)<>a,this.bitOffset+=e}}return t},e.prototype.available=function(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset},e}();t.BitStream=n},function(e,t){"use strict";var n=function(){function e(){this.field=new i(285,256,0)}return e.prototype.decode=function(e,t){for(var n=new r(this.field,e),a=new Array(t),o=!0,s=0;s=n/2;){var u=i,l=o;if(o=s,(i=a).isZero())return null;a=u;for(var c=this.field.zero,f=i.getCoefficient(i.degree()),h=this.field.inverse(f);a.degree()>=i.degree()&&!a.isZero();){var p=a.degree()-i.degree(),d=this.field.multiply(a.getCoefficient(a.degree()),h);c=c.addOrSubtract(this.field.buildMonomial(p,d)),a=a.addOrSubtract(i.multiplyByMonomial(p,d))}if(s=c.multiplyPoly(o).addOrSubtract(l),a.degree()>=i.degree())return null}var g=s.getCoefficient(0);if(0==g)return null;var v=this.field.inverse(g);return[s.multiply(v),a.multiply(v)]},e.prototype.findErrorLocations=function(e){var t=e.degree();if(1==t)return[e.getCoefficient(1)];for(var n=new Array(t),r=0,i=1;i1&&0==t[0]){for(var r=1;rr.length){var a=n;n=r,r=a}for(var o=new Array(r.length),s=r.length-n.length,u=0;u=this.size&&(e^=this.primitive,e&=this.size-1);for(t=0;t>>1,F=[["ary",x],["bind",g],["bindKey",v],["curry",_],["curryRight",w],["flip",E],["partial",b],["partialRight",y],["rearg",k]],N="[object Arguments]",P="[object Array]",U="[object AsyncFunction]",q="[object Boolean]",V="[object Date]",Z="[object DOMException]",W="[object Error]",G="[object Function]",H="[object GeneratorFunction]",Y="[object Map]",$="[object Number]",X="[object Null]",J="[object Object]",K="[object Proxy]",Q="[object RegExp]",ee="[object Set]",te="[object String]",ne="[object Symbol]",re="[object Undefined]",ie="[object WeakMap]",ae="[object WeakSet]",oe="[object ArrayBuffer]",se="[object DataView]",ue="[object Float32Array]",le="[object Float64Array]",ce="[object Int8Array]",fe="[object Int16Array]",he="[object Int32Array]",pe="[object Uint8Array]",de="[object Uint8ClampedArray]",ge="[object Uint16Array]",ve="[object Uint32Array]",me=/\b__p \+= '';/g,_e=/\b(__p \+=) '' \+/g,we=/(__e\(.*?\)|\b__t\)) \+\n'';/g,be=/&(?:amp|lt|gt|quot|#39);/g,ye=/[&<>"']/g,xe=RegExp(be.source),ke=RegExp(ye.source),Ee=/<%-([\s\S]+?)%>/g,Se=/<%([\s\S]+?)%>/g,Ae=/<%=([\s\S]+?)%>/g,Te=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Me=/^\w*$/,Ie=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,je=/[\\^$.*+?()[\]{}|]/g,Re=RegExp(je.source),Le=/^\s+|\s+$/g,Be=/^\s+/,Ce=/\s+$/,Oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ze=/\{\n\/\* \[wrapped with (.+)\] \*/,De=/,? & /,Fe=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Ne=/\\(\\)?/g,Pe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ue=/\w*$/,qe=/^[-+]0x[0-9a-f]+$/i,Ve=/^0b[01]+$/i,Ze=/^\[object .+?Constructor\]$/,We=/^0o[0-7]+$/i,Ge=/^(?:0|[1-9]\d*)$/,He=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ye=/($^)/,$e=/['\n\r\u2028\u2029\\]/g,Xe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Je="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ke="[\\ud800-\\udfff]",Qe="["+Je+"]",et="["+Xe+"]",tt="\\d+",nt="[\\u2700-\\u27bf]",rt="[a-z\\xdf-\\xf6\\xf8-\\xff]",it="[^\\ud800-\\udfff"+Je+tt+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",at="\\ud83c[\\udffb-\\udfff]",ot="[^\\ud800-\\udfff]",st="(?:\\ud83c[\\udde6-\\uddff]){2}",ut="[\\ud800-\\udbff][\\udc00-\\udfff]",lt="[A-Z\\xc0-\\xd6\\xd8-\\xde]",ct="(?:"+rt+"|"+it+")",ft="(?:"+lt+"|"+it+")",ht="(?:"+et+"|"+at+")"+"?",pt="[\\ufe0e\\ufe0f]?"+ht+("(?:\\u200d(?:"+[ot,st,ut].join("|")+")[\\ufe0e\\ufe0f]?"+ht+")*"),dt="(?:"+[nt,st,ut].join("|")+")"+pt,gt="(?:"+[ot+et+"?",et,st,ut,Ke].join("|")+")",vt=RegExp("['’]","g"),mt=RegExp(et,"g"),_t=RegExp(at+"(?="+at+")|"+gt+pt,"g"),wt=RegExp([lt+"?"+rt+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[Qe,lt,"$"].join("|")+")",ft+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[Qe,lt+ct,"$"].join("|")+")",lt+"?"+ct+"+(?:['’](?:d|ll|m|re|s|t|ve))?",lt+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",tt,dt].join("|"),"g"),bt=RegExp("[\\u200d\\ud800-\\udfff"+Xe+"\\ufe0e\\ufe0f]"),yt=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,xt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],kt=-1,Et={};Et[ue]=Et[le]=Et[ce]=Et[fe]=Et[he]=Et[pe]=Et[de]=Et[ge]=Et[ve]=!0,Et[N]=Et[P]=Et[oe]=Et[q]=Et[se]=Et[V]=Et[W]=Et[G]=Et[Y]=Et[$]=Et[J]=Et[Q]=Et[ee]=Et[te]=Et[ie]=!1;var St={};St[N]=St[P]=St[oe]=St[se]=St[q]=St[V]=St[ue]=St[le]=St[ce]=St[fe]=St[he]=St[Y]=St[$]=St[J]=St[Q]=St[ee]=St[te]=St[ne]=St[pe]=St[de]=St[ge]=St[ve]=!0,St[W]=St[G]=St[ie]=!1;var At={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Tt=parseFloat,Mt=parseInt,It="object"==typeof e&&e&&e.Object===Object&&e,jt="object"==typeof self&&self&&self.Object===Object&&self,Rt=It||jt||Function("return this")(),Lt="object"==typeof n&&n&&!n.nodeType&&n,Bt=Lt&&"object"==typeof t&&t&&!t.nodeType&&t,Ct=Bt&&Bt.exports===Lt,Ot=Ct&&It.process,zt=function(){try{var e=Bt&&Bt.require&&Bt.require("util").types;return e||Ot&&Ot.binding&&Ot.binding("util")}catch(e){}}(),Dt=zt&&zt.isArrayBuffer,Ft=zt&&zt.isDate,Nt=zt&&zt.isMap,Pt=zt&&zt.isRegExp,Ut=zt&&zt.isSet,qt=zt&&zt.isTypedArray;function Vt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Zt(e,t,n,r){for(var i=-1,a=null==e?0:e.length;++i-1}function Xt(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function wn(e,t){for(var n=e.length;n--&&on(t,e[n],0)>-1;);return n}var bn=fn({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),yn=fn({"&":"&","<":"<",">":">",'"':""","'":"'"});function xn(e){return"\\"+At[e]}function kn(e){return bt.test(e)}function En(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function Sn(e,t){return function(n){return e(t(n))}}function An(e,t){for(var n=-1,r=e.length,i=0,a=[];++n",""":'"',"'":"'"});var Bn=function e(t){var n,Xe=(t=null==t?Rt:Bn.defaults(Rt.Object(),t,Bn.pick(Rt,xt))).Array,Je=t.Date,Ke=t.Error,Qe=t.Function,et=t.Math,tt=t.Object,nt=t.RegExp,rt=t.String,it=t.TypeError,at=Xe.prototype,ot=Qe.prototype,st=tt.prototype,ut=t["__core-js_shared__"],lt=ot.toString,ct=st.hasOwnProperty,ft=0,ht=(n=/[^.]+$/.exec(ut&&ut.keys&&ut.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",pt=st.toString,dt=lt.call(tt),gt=Rt._,_t=nt("^"+lt.call(ct).replace(je,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),bt=Ct?t.Buffer:r,At=t.Symbol,It=t.Uint8Array,jt=bt?bt.allocUnsafe:r,Lt=Sn(tt.getPrototypeOf,tt),Bt=tt.create,Ot=st.propertyIsEnumerable,zt=at.splice,nn=At?At.isConcatSpreadable:r,fn=At?At.iterator:r,Cn=At?At.toStringTag:r,On=function(){try{var e=Na(tt,"defineProperty");return e({},"",{}),e}catch(e){}}(),zn=t.clearTimeout!==Rt.clearTimeout&&t.clearTimeout,Dn=Je&&Je.now!==Rt.Date.now&&Je.now,Fn=t.setTimeout!==Rt.setTimeout&&t.setTimeout,Nn=et.ceil,Pn=et.floor,Un=tt.getOwnPropertySymbols,qn=bt?bt.isBuffer:r,Vn=t.isFinite,Zn=at.join,Wn=Sn(tt.keys,tt),Gn=et.max,Hn=et.min,Yn=Je.now,$n=t.parseInt,Xn=et.random,Jn=at.reverse,Kn=Na(t,"DataView"),Qn=Na(t,"Map"),er=Na(t,"Promise"),tr=Na(t,"Set"),nr=Na(t,"WeakMap"),rr=Na(tt,"create"),ir=nr&&new nr,ar={},or=co(Kn),sr=co(Qn),ur=co(er),lr=co(tr),cr=co(nr),fr=At?At.prototype:r,hr=fr?fr.valueOf:r,pr=fr?fr.toString:r;function dr(e){if(Ms(e)&&!ms(e)&&!(e instanceof _r)){if(e instanceof mr)return e;if(ct.call(e,"__wrapped__"))return fo(e)}return new mr(e)}var gr=function(){function e(){}return function(t){if(!Ts(t))return{};if(Bt)return Bt(t);e.prototype=t;var n=new e;return e.prototype=r,n}}();function vr(){}function mr(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=r}function _r(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=O,this.__views__=[]}function wr(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function zr(e,t,n,i,a,o){var s,u=t&c,l=t&f,p=t&h;if(n&&(s=a?n(e,i,a,o):n(e)),s!==r)return s;if(!Ts(e))return e;var d=ms(e);if(d){if(s=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&ct.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!u)return ra(e,s)}else{var g=qa(e),v=g==G||g==H;if(ys(e))return Ji(e,u);if(g==J||g==N||v&&!a){if(s=l||v?{}:Za(e),!u)return l?function(e,t){return ia(e,Ua(e),t)}(e,function(e,t){return e&&ia(t,au(t),e)}(s,e)):function(e,t){return ia(e,Pa(e),t)}(e,Lr(s,e))}else{if(!St[g])return a?e:{};s=function(e,t,n){var r,i,a,o=e.constructor;switch(t){case oe:return Ki(e);case q:case V:return new o(+e);case se:return function(e,t){var n=t?Ki(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case ue:case le:case ce:case fe:case he:case pe:case de:case ge:case ve:return Qi(e,n);case Y:return new o;case $:case te:return new o(e);case Q:return(a=new(i=e).constructor(i.source,Ue.exec(i))).lastIndex=i.lastIndex,a;case ee:return new o;case ne:return r=e,hr?tt(hr.call(r)):{}}}(e,g,u)}}o||(o=new kr);var m=o.get(e);if(m)return m;if(o.set(e,s),Bs(e))return e.forEach(function(r){s.add(zr(r,t,n,r,e,o))}),s;if(Is(e))return e.forEach(function(r,i){s.set(i,zr(r,t,n,i,e,o))}),s;var _=d?r:(p?l?La:Ra:l?au:iu)(e);return Wt(_||e,function(r,i){_&&(r=e[i=r]),Ir(s,i,zr(r,t,n,i,e,o))}),s}function Dr(e,t,n){var i=n.length;if(null==e)return!i;for(e=tt(e);i--;){var a=n[i],o=t[a],s=e[a];if(s===r&&!(a in e)||!o(s))return!1}return!0}function Fr(e,t,n){if("function"!=typeof e)throw new it(o);return ro(function(){e.apply(r,n)},t)}function Nr(e,t,n,r){var a=-1,o=$t,s=!0,u=e.length,l=[],c=t.length;if(!u)return l;n&&(t=Jt(t,gn(n))),r?(o=Xt,s=!1):t.length>=i&&(o=mn,s=!1,t=new xr(t));e:for(;++a-1},br.prototype.set=function(e,t){var n=this.__data__,r=jr(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},yr.prototype.clear=function(){this.size=0,this.__data__={hash:new wr,map:new(Qn||br),string:new wr}},yr.prototype.delete=function(e){var t=Da(this,e).delete(e);return this.size-=t?1:0,t},yr.prototype.get=function(e){return Da(this,e).get(e)},yr.prototype.has=function(e){return Da(this,e).has(e)},yr.prototype.set=function(e,t){var n=Da(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},xr.prototype.add=xr.prototype.push=function(e){return this.__data__.set(e,s),this},xr.prototype.has=function(e){return this.__data__.has(e)},kr.prototype.clear=function(){this.__data__=new br,this.size=0},kr.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},kr.prototype.get=function(e){return this.__data__.get(e)},kr.prototype.has=function(e){return this.__data__.has(e)},kr.prototype.set=function(e,t){var n=this.__data__;if(n instanceof br){var r=n.__data__;if(!Qn||r.length0&&n(s)?t>1?Wr(s,t-1,n,r,i):Kt(i,s):r||(i[i.length]=s)}return i}var Gr=ua(),Hr=ua(!0);function Yr(e,t){return e&&Gr(e,t,iu)}function $r(e,t){return e&&Hr(e,t,iu)}function Xr(e,t){return Yt(t,function(t){return Es(e[t])})}function Jr(e,t){for(var n=0,i=(t=Hi(t,e)).length;null!=e&&nt}function ti(e,t){return null!=e&&ct.call(e,t)}function ni(e,t){return null!=e&&t in tt(e)}function ri(e,t,n){for(var i=n?Xt:$t,a=e[0].length,o=e.length,s=o,u=Xe(o),l=1/0,c=[];s--;){var f=e[s];s&&t&&(f=Jt(f,gn(t))),l=Hn(f.length,l),u[s]=!n&&(t||a>=120&&f.length>=120)?new xr(s&&f):r}f=e[0];var h=-1,p=u[0];e:for(;++h=s)return u;var l=n[r];return u*("desc"==l?-1:1)}}return e.index-t.index}(e,t,n)})}function wi(e,t,n){for(var r=-1,i=t.length,a={};++r-1;)s!==e&&zt.call(s,u,1),zt.call(e,u,1);return e}function yi(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==a){var a=i;Ga(i)?zt.call(e,i,1):Ni(e,i)}}return e}function xi(e,t){return e+Pn(Xn()*(t-e+1))}function ki(e,t){var n="";if(!e||t<1||t>L)return n;do{t%2&&(n+=e),(t=Pn(t/2))&&(e+=e)}while(t);return n}function Ei(e,t){return io(eo(e,t,ju),e+"")}function Si(e){return Sr(pu(e))}function Ai(e,t){var n=pu(e);return so(n,Or(t,0,n.length))}function Ti(e,t,n,i){if(!Ts(e))return e;for(var a=-1,o=(t=Hi(t,e)).length,s=o-1,u=e;null!=u&&++ai?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=Xe(i);++r>>1,o=e[a];null!==o&&!Os(o)&&(n?o<=t:o=i){var c=t?null:ka(e);if(c)return Mn(c);s=!1,a=mn,l=new xr}else l=t?[]:u;e:for(;++r=i?e:Ri(e,t,n)}var Xi=zn||function(e){return Rt.clearTimeout(e)};function Ji(e,t){if(t)return e.slice();var n=e.length,r=jt?jt(n):new e.constructor(n);return e.copy(r),r}function Ki(e){var t=new e.constructor(e.byteLength);return new It(t).set(new It(e)),t}function Qi(e,t){var n=t?Ki(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ea(e,t){if(e!==t){var n=e!==r,i=null===e,a=e==e,o=Os(e),s=t!==r,u=null===t,l=t==t,c=Os(t);if(!u&&!c&&!o&&e>t||o&&s&&l&&!u&&!c||i&&s&&l||!n&&l||!a)return 1;if(!i&&!o&&!c&&e1?n[a-1]:r,s=a>2?n[2]:r;for(o=e.length>3&&"function"==typeof o?(a--,o):r,s&&Ha(n[0],n[1],s)&&(o=a<3?r:o,a=1),t=tt(t);++i-1?a[o?t[s]:s]:r}}function pa(e){return ja(function(t){var n=t.length,i=n,a=mr.prototype.thru;for(e&&t.reverse();i--;){var s=t[i];if("function"!=typeof s)throw new it(o);if(a&&!u&&"wrapper"==Ca(s))var u=new mr([],!0)}for(i=u?i:n;++i1&&_.reverse(),f&&lu))return!1;var c=o.get(e);if(c&&o.get(t))return c==t;var f=-1,h=!0,g=n&d?new xr:r;for(o.set(e,t),o.set(t,e);++f-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(Oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return Wt(F,function(n){var r="_."+n[0];t&n[1]&&!$t(e,r)&&e.push(r)}),e.sort()}(function(e){var t=e.match(ze);return t?t[1].split(De):[]}(r),n)))}function oo(e){var t=0,n=0;return function(){var i=Yn(),a=M-(i-n);if(n=i,a>0){if(++t>=T)return arguments[0]}else t=0;return e.apply(r,arguments)}}function so(e,t){var n=-1,i=e.length,a=i-1;for(t=t===r?i:t;++n1?e[t-1]:r;return Lo(e,n="function"==typeof n?(e.pop(),n):r)});function No(e){var t=dr(e);return t.__chain__=!0,t}function Po(e,t){return t(e)}var Uo=ja(function(e){var t=e.length,n=t?e[0]:0,i=this.__wrapped__,a=function(t){return Cr(t,e)};return!(t>1||this.__actions__.length)&&i instanceof _r&&Ga(n)?((i=i.slice(n,+n+(t?1:0))).__actions__.push({func:Po,args:[a],thisArg:r}),new mr(i,this.__chain__).thru(function(e){return t&&!e.length&&e.push(r),e})):this.thru(a)});var qo=aa(function(e,t,n){ct.call(e,n)?++e[n]:Br(e,n,1)});var Vo=ha(vo),Zo=ha(mo);function Wo(e,t){return(ms(e)?Wt:Pr)(e,za(t,3))}function Go(e,t){return(ms(e)?Gt:Ur)(e,za(t,3))}var Ho=aa(function(e,t,n){ct.call(e,n)?e[n].push(t):Br(e,n,[t])});var Yo=Ei(function(e,t,n){var r=-1,i="function"==typeof t,a=ws(e)?Xe(e.length):[];return Pr(e,function(e){a[++r]=i?Vt(t,e,n):ii(e,t,n)}),a}),$o=aa(function(e,t,n){Br(e,n,t)});function Xo(e,t){return(ms(e)?Jt:pi)(e,za(t,3))}var Jo=aa(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]});var Ko=Ei(function(e,t){if(null==e)return[];var n=t.length;return n>1&&Ha(e,t[0],t[1])?t=[]:n>2&&Ha(t[0],t[1],t[2])&&(t=[t[0]]),_i(e,Wr(t,1),[])}),Qo=Dn||function(){return Rt.Date.now()};function es(e,t,n){return t=n?r:t,t=e&&null==t?e.length:t,Sa(e,x,r,r,r,r,t)}function ts(e,t){var n;if("function"!=typeof t)throw new it(o);return e=Us(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=r),n}}var ns=Ei(function(e,t,n){var r=g;if(n.length){var i=An(n,Oa(ns));r|=b}return Sa(e,r,t,n,i)}),rs=Ei(function(e,t,n){var r=g|v;if(n.length){var i=An(n,Oa(rs));r|=b}return Sa(t,r,e,n,i)});function is(e,t,n){var i,a,s,u,l,c,f=0,h=!1,p=!1,d=!0;if("function"!=typeof e)throw new it(o);function g(t){var n=i,o=a;return i=a=r,f=t,u=e.apply(o,n)}function v(e){var n=e-c;return c===r||n>=t||n<0||p&&e-f>=s}function m(){var e=Qo();if(v(e))return _(e);l=ro(m,function(e){var n=t-(e-c);return p?Hn(n,s-(e-f)):n}(e))}function _(e){return l=r,d&&i?g(e):(i=a=r,u)}function w(){var e=Qo(),n=v(e);if(i=arguments,a=this,c=e,n){if(l===r)return function(e){return f=e,l=ro(m,t),h?g(e):u}(c);if(p)return l=ro(m,t),g(c)}return l===r&&(l=ro(m,t)),u}return t=Vs(t)||0,Ts(n)&&(h=!!n.leading,s=(p="maxWait"in n)?Gn(Vs(n.maxWait)||0,t):s,d="trailing"in n?!!n.trailing:d),w.cancel=function(){l!==r&&Xi(l),f=0,i=c=a=l=r},w.flush=function(){return l===r?u:_(Qo())},w}var as=Ei(function(e,t){return Fr(e,1,t)}),os=Ei(function(e,t,n){return Fr(e,Vs(t)||0,n)});function ss(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new it(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(ss.Cache||yr),n}function us(e){if("function"!=typeof e)throw new it(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}ss.Cache=yr;var ls=Yi(function(e,t){var n=(t=1==t.length&&ms(t[0])?Jt(t[0],gn(za())):Jt(Wr(t,1),gn(za()))).length;return Ei(function(r){for(var i=-1,a=Hn(r.length,n);++i=t}),vs=ai(function(){return arguments}())?ai:function(e){return Ms(e)&&ct.call(e,"callee")&&!Ot.call(e,"callee")},ms=Xe.isArray,_s=Dt?gn(Dt):function(e){return Ms(e)&&Qr(e)==oe};function ws(e){return null!=e&&As(e.length)&&!Es(e)}function bs(e){return Ms(e)&&ws(e)}var ys=qn||Vu,xs=Ft?gn(Ft):function(e){return Ms(e)&&Qr(e)==V};function ks(e){if(!Ms(e))return!1;var t=Qr(e);return t==W||t==Z||"string"==typeof e.message&&"string"==typeof e.name&&!Rs(e)}function Es(e){if(!Ts(e))return!1;var t=Qr(e);return t==G||t==H||t==U||t==K}function Ss(e){return"number"==typeof e&&e==Us(e)}function As(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=L}function Ts(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Ms(e){return null!=e&&"object"==typeof e}var Is=Nt?gn(Nt):function(e){return Ms(e)&&qa(e)==Y};function js(e){return"number"==typeof e||Ms(e)&&Qr(e)==$}function Rs(e){if(!Ms(e)||Qr(e)!=J)return!1;var t=Lt(e);if(null===t)return!0;var n=ct.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&<.call(n)==dt}var Ls=Pt?gn(Pt):function(e){return Ms(e)&&Qr(e)==Q};var Bs=Ut?gn(Ut):function(e){return Ms(e)&&qa(e)==ee};function Cs(e){return"string"==typeof e||!ms(e)&&Ms(e)&&Qr(e)==te}function Os(e){return"symbol"==typeof e||Ms(e)&&Qr(e)==ne}var zs=qt?gn(qt):function(e){return Ms(e)&&As(e.length)&&!!Et[Qr(e)]};var Ds=ba(hi),Fs=ba(function(e,t){return e<=t});function Ns(e){if(!e)return[];if(ws(e))return Cs(e)?Rn(e):ra(e);if(fn&&e[fn])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[fn]());var t=qa(e);return(t==Y?En:t==ee?Mn:pu)(e)}function Ps(e){return e?(e=Vs(e))===R||e===-R?(e<0?-1:1)*B:e==e?e:0:0===e?e:0}function Us(e){var t=Ps(e),n=t%1;return t==t?n?t-n:t:0}function qs(e){return e?Or(Us(e),0,O):0}function Vs(e){if("number"==typeof e)return e;if(Os(e))return C;if(Ts(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Ts(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(Le,"");var n=Ve.test(e);return n||We.test(e)?Mt(e.slice(2),n?2:8):qe.test(e)?C:+e}function Zs(e){return ia(e,au(e))}function Ws(e){return null==e?"":Di(e)}var Gs=oa(function(e,t){if(Ja(t)||ws(t))ia(t,iu(t),e);else for(var n in t)ct.call(t,n)&&Ir(e,n,t[n])}),Hs=oa(function(e,t){ia(t,au(t),e)}),Ys=oa(function(e,t,n,r){ia(t,au(t),e,r)}),$s=oa(function(e,t,n,r){ia(t,iu(t),e,r)}),Xs=ja(Cr);var Js=Ei(function(e,t){e=tt(e);var n=-1,i=t.length,a=i>2?t[2]:r;for(a&&Ha(t[0],t[1],a)&&(i=1);++n1),t}),ia(e,La(e),n),r&&(n=zr(n,c|f|h,Ma));for(var i=t.length;i--;)Ni(n,t[i]);return n});var lu=ja(function(e,t){return null==e?{}:function(e,t){return wi(e,t,function(t,n){return eu(e,n)})}(e,t)});function cu(e,t){if(null==e)return{};var n=Jt(La(e),function(e){return[e]});return t=za(t),wi(e,n,function(e,n){return t(e,n[0])})}var fu=Ea(iu),hu=Ea(au);function pu(e){return null==e?[]:vn(e,iu(e))}var du=ca(function(e,t,n){return t=t.toLowerCase(),e+(n?gu(t):t)});function gu(e){return ku(Ws(e).toLowerCase())}function vu(e){return(e=Ws(e))&&e.replace(He,bn).replace(mt,"")}var mu=ca(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),_u=ca(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),wu=la("toLowerCase");var bu=ca(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()});var yu=ca(function(e,t,n){return e+(n?" ":"")+ku(t)});var xu=ca(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),ku=la("toUpperCase");function Eu(e,t,n){return e=Ws(e),(t=n?r:t)===r?function(e){return yt.test(e)}(e)?function(e){return e.match(wt)||[]}(e):function(e){return e.match(Fe)||[]}(e):e.match(t)||[]}var Su=Ei(function(e,t){try{return Vt(e,r,t)}catch(e){return ks(e)?e:new Ke(e)}}),Au=ja(function(e,t){return Wt(t,function(t){t=lo(t),Br(e,t,ns(e[t],e))}),e});function Tu(e){return function(){return e}}var Mu=pa(),Iu=pa(!0);function ju(e){return e}function Ru(e){return li("function"==typeof e?e:zr(e,c))}var Lu=Ei(function(e,t){return function(n){return ii(n,e,t)}}),Bu=Ei(function(e,t){return function(n){return ii(e,n,t)}});function Cu(e,t,n){var r=iu(t),i=Xr(t,r);null!=n||Ts(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=Xr(t,iu(t)));var a=!(Ts(n)&&"chain"in n&&!n.chain),o=Es(e);return Wt(i,function(n){var r=t[n];e[n]=r,o&&(e.prototype[n]=function(){var t=this.__chain__;if(a||t){var n=e(this.__wrapped__);return(n.__actions__=ra(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,Kt([this.value()],arguments))})}),e}function Ou(){}var zu=ma(Jt),Du=ma(Ht),Fu=ma(tn);function Nu(e){return Ya(e)?cn(lo(e)):function(e){return function(t){return Jr(t,e)}}(e)}var Pu=wa(),Uu=wa(!0);function qu(){return[]}function Vu(){return!1}var Zu=va(function(e,t){return e+t},0),Wu=xa("ceil"),Gu=va(function(e,t){return e/t},1),Hu=xa("floor");var Yu,$u=va(function(e,t){return e*t},1),Xu=xa("round"),Ju=va(function(e,t){return e-t},0);return dr.after=function(e,t){if("function"!=typeof t)throw new it(o);return e=Us(e),function(){if(--e<1)return t.apply(this,arguments)}},dr.ary=es,dr.assign=Gs,dr.assignIn=Hs,dr.assignInWith=Ys,dr.assignWith=$s,dr.at=Xs,dr.before=ts,dr.bind=ns,dr.bindAll=Au,dr.bindKey=rs,dr.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return ms(e)?e:[e]},dr.chain=No,dr.chunk=function(e,t,n){t=(n?Ha(e,t,n):t===r)?1:Gn(Us(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var a=0,o=0,s=Xe(Nn(i/t));aa?0:a+n),(i=i===r||i>a?a:Us(i))<0&&(i+=a),i=n>i?0:qs(i);n>>0)?(e=Ws(e))&&("string"==typeof t||null!=t&&!Ls(t))&&!(t=Di(t))&&kn(e)?$i(Rn(e),0,n):e.split(t,n):[]},dr.spread=function(e,t){if("function"!=typeof e)throw new it(o);return t=null==t?0:Gn(Us(t),0),Ei(function(n){var r=n[t],i=$i(n,0,t);return r&&Kt(i,r),Vt(e,this,i)})},dr.tail=function(e){var t=null==e?0:e.length;return t?Ri(e,1,t):[]},dr.take=function(e,t,n){return e&&e.length?Ri(e,0,(t=n||t===r?1:Us(t))<0?0:t):[]},dr.takeRight=function(e,t,n){var i=null==e?0:e.length;return i?Ri(e,(t=i-(t=n||t===r?1:Us(t)))<0?0:t,i):[]},dr.takeRightWhile=function(e,t){return e&&e.length?Ui(e,za(t,3),!1,!0):[]},dr.takeWhile=function(e,t){return e&&e.length?Ui(e,za(t,3)):[]},dr.tap=function(e,t){return t(e),e},dr.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new it(o);return Ts(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),is(e,t,{leading:r,maxWait:t,trailing:i})},dr.thru=Po,dr.toArray=Ns,dr.toPairs=fu,dr.toPairsIn=hu,dr.toPath=function(e){return ms(e)?Jt(e,lo):Os(e)?[e]:ra(uo(Ws(e)))},dr.toPlainObject=Zs,dr.transform=function(e,t,n){var r=ms(e),i=r||ys(e)||zs(e);if(t=za(t,4),null==n){var a=e&&e.constructor;n=i?r?new a:[]:Ts(e)&&Es(a)?gr(Lt(e)):{}}return(i?Wt:Yr)(e,function(e,r,i){return t(n,e,r,i)}),n},dr.unary=function(e){return es(e,1)},dr.union=Mo,dr.unionBy=Io,dr.unionWith=jo,dr.uniq=function(e){return e&&e.length?Fi(e):[]},dr.uniqBy=function(e,t){return e&&e.length?Fi(e,za(t,2)):[]},dr.uniqWith=function(e,t){return t="function"==typeof t?t:r,e&&e.length?Fi(e,r,t):[]},dr.unset=function(e,t){return null==e||Ni(e,t)},dr.unzip=Ro,dr.unzipWith=Lo,dr.update=function(e,t,n){return null==e?e:Pi(e,t,Gi(n))},dr.updateWith=function(e,t,n,i){return i="function"==typeof i?i:r,null==e?e:Pi(e,t,Gi(n),i)},dr.values=pu,dr.valuesIn=function(e){return null==e?[]:vn(e,au(e))},dr.without=Bo,dr.words=Eu,dr.wrap=function(e,t){return cs(Gi(t),e)},dr.xor=Co,dr.xorBy=Oo,dr.xorWith=zo,dr.zip=Do,dr.zipObject=function(e,t){return Zi(e||[],t||[],Ir)},dr.zipObjectDeep=function(e,t){return Zi(e||[],t||[],Ti)},dr.zipWith=Fo,dr.entries=fu,dr.entriesIn=hu,dr.extend=Hs,dr.extendWith=Ys,Cu(dr,dr),dr.add=Zu,dr.attempt=Su,dr.camelCase=du,dr.capitalize=gu,dr.ceil=Wu,dr.clamp=function(e,t,n){return n===r&&(n=t,t=r),n!==r&&(n=(n=Vs(n))==n?n:0),t!==r&&(t=(t=Vs(t))==t?t:0),Or(Vs(e),t,n)},dr.clone=function(e){return zr(e,h)},dr.cloneDeep=function(e){return zr(e,c|h)},dr.cloneDeepWith=function(e,t){return zr(e,c|h,t="function"==typeof t?t:r)},dr.cloneWith=function(e,t){return zr(e,h,t="function"==typeof t?t:r)},dr.conformsTo=function(e,t){return null==t||Dr(e,t,iu(t))},dr.deburr=vu,dr.defaultTo=function(e,t){return null==e||e!=e?t:e},dr.divide=Gu,dr.endsWith=function(e,t,n){e=Ws(e),t=Di(t);var i=e.length,a=n=n===r?i:Or(Us(n),0,i);return(n-=t.length)>=0&&e.slice(n,a)==t},dr.eq=ps,dr.escape=function(e){return(e=Ws(e))&&ke.test(e)?e.replace(ye,yn):e},dr.escapeRegExp=function(e){return(e=Ws(e))&&Re.test(e)?e.replace(je,"\\$&"):e},dr.every=function(e,t,n){var i=ms(e)?Ht:qr;return n&&Ha(e,t,n)&&(t=r),i(e,za(t,3))},dr.find=Vo,dr.findIndex=vo,dr.findKey=function(e,t){return rn(e,za(t,3),Yr)},dr.findLast=Zo,dr.findLastIndex=mo,dr.findLastKey=function(e,t){return rn(e,za(t,3),$r)},dr.floor=Hu,dr.forEach=Wo,dr.forEachRight=Go,dr.forIn=function(e,t){return null==e?e:Gr(e,za(t,3),au)},dr.forInRight=function(e,t){return null==e?e:Hr(e,za(t,3),au)},dr.forOwn=function(e,t){return e&&Yr(e,za(t,3))},dr.forOwnRight=function(e,t){return e&&$r(e,za(t,3))},dr.get=Qs,dr.gt=ds,dr.gte=gs,dr.has=function(e,t){return null!=e&&Va(e,t,ti)},dr.hasIn=eu,dr.head=wo,dr.identity=ju,dr.includes=function(e,t,n,r){e=ws(e)?e:pu(e),n=n&&!r?Us(n):0;var i=e.length;return n<0&&(n=Gn(i+n,0)),Cs(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&on(e,t,n)>-1},dr.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:Us(n);return i<0&&(i=Gn(r+i,0)),on(e,t,i)},dr.inRange=function(e,t,n){return t=Ps(t),n===r?(n=t,t=0):n=Ps(n),function(e,t,n){return e>=Hn(t,n)&&e=-L&&e<=L},dr.isSet=Bs,dr.isString=Cs,dr.isSymbol=Os,dr.isTypedArray=zs,dr.isUndefined=function(e){return e===r},dr.isWeakMap=function(e){return Ms(e)&&qa(e)==ie},dr.isWeakSet=function(e){return Ms(e)&&Qr(e)==ae},dr.join=function(e,t){return null==e?"":Zn.call(e,t)},dr.kebabCase=mu,dr.last=ko,dr.lastIndexOf=function(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var a=i;return n!==r&&(a=(a=Us(n))<0?Gn(i+a,0):Hn(a,i-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,a):an(e,un,a,!0)},dr.lowerCase=_u,dr.lowerFirst=wu,dr.lt=Ds,dr.lte=Fs,dr.max=function(e){return e&&e.length?Vr(e,ju,ei):r},dr.maxBy=function(e,t){return e&&e.length?Vr(e,za(t,2),ei):r},dr.mean=function(e){return ln(e,ju)},dr.meanBy=function(e,t){return ln(e,za(t,2))},dr.min=function(e){return e&&e.length?Vr(e,ju,hi):r},dr.minBy=function(e,t){return e&&e.length?Vr(e,za(t,2),hi):r},dr.stubArray=qu,dr.stubFalse=Vu,dr.stubObject=function(){return{}},dr.stubString=function(){return""},dr.stubTrue=function(){return!0},dr.multiply=$u,dr.nth=function(e,t){return e&&e.length?mi(e,Us(t)):r},dr.noConflict=function(){return Rt._===this&&(Rt._=gt),this},dr.noop=Ou,dr.now=Qo,dr.pad=function(e,t,n){e=Ws(e);var r=(t=Us(t))?jn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return _a(Pn(i),n)+e+_a(Nn(i),n)},dr.padEnd=function(e,t,n){e=Ws(e);var r=(t=Us(t))?jn(e):0;return t&&rt){var i=e;e=t,t=i}if(n||e%1||t%1){var a=Xn();return Hn(e+a*(t-e+Tt("1e-"+((a+"").length-1))),t)}return xi(e,t)},dr.reduce=function(e,t,n){var r=ms(e)?Qt:hn,i=arguments.length<3;return r(e,za(t,4),n,i,Pr)},dr.reduceRight=function(e,t,n){var r=ms(e)?en:hn,i=arguments.length<3;return r(e,za(t,4),n,i,Ur)},dr.repeat=function(e,t,n){return t=(n?Ha(e,t,n):t===r)?1:Us(t),ki(Ws(e),t)},dr.replace=function(){var e=arguments,t=Ws(e[0]);return e.length<3?t:t.replace(e[1],e[2])},dr.result=function(e,t,n){var i=-1,a=(t=Hi(t,e)).length;for(a||(a=1,e=r);++iL)return[];var n=O,r=Hn(e,O);t=za(t),e-=O;for(var i=dn(r,t);++n=o)return e;var u=n-jn(i);if(u<1)return i;var l=s?$i(s,0,u).join(""):e.slice(0,u);if(a===r)return l+i;if(s&&(u+=l.length-u),Ls(a)){if(e.slice(u).search(a)){var c,f=l;for(a.global||(a=nt(a.source,Ws(Ue.exec(a))+"g")),a.lastIndex=0;c=a.exec(f);)var h=c.index;l=l.slice(0,h===r?u:h)}}else if(e.indexOf(Di(a),u)!=u){var p=l.lastIndexOf(a);p>-1&&(l=l.slice(0,p))}return l+i},dr.unescape=function(e){return(e=Ws(e))&&xe.test(e)?e.replace(be,Ln):e},dr.uniqueId=function(e){var t=++ft;return Ws(e)+t},dr.upperCase=xu,dr.upperFirst=ku,dr.each=Wo,dr.eachRight=Go,dr.first=wo,Cu(dr,(Yu={},Yr(dr,function(e,t){ct.call(dr.prototype,t)||(Yu[t]=e)}),Yu),{chain:!1}),dr.VERSION="4.17.10",Wt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){dr[e].placeholder=dr}),Wt(["drop","take"],function(e,t){_r.prototype[e]=function(n){n=n===r?1:Gn(Us(n),0);var i=this.__filtered__&&!t?new _r(this):this.clone();return i.__filtered__?i.__takeCount__=Hn(n,i.__takeCount__):i.__views__.push({size:Hn(n,O),type:e+(i.__dir__<0?"Right":"")}),i},_r.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),Wt(["filter","map","takeWhile"],function(e,t){var n=t+1,r=n==I||3==n;_r.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:za(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}}),Wt(["head","last"],function(e,t){var n="take"+(t?"Right":"");_r.prototype[e]=function(){return this[n](1).value()[0]}}),Wt(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");_r.prototype[e]=function(){return this.__filtered__?new _r(this):this[n](1)}}),_r.prototype.compact=function(){return this.filter(ju)},_r.prototype.find=function(e){return this.filter(e).head()},_r.prototype.findLast=function(e){return this.reverse().find(e)},_r.prototype.invokeMap=Ei(function(e,t){return"function"==typeof e?new _r(this):this.map(function(n){return ii(n,e,t)})}),_r.prototype.reject=function(e){return this.filter(us(za(e)))},_r.prototype.slice=function(e,t){e=Us(e);var n=this;return n.__filtered__&&(e>0||t<0)?new _r(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==r&&(n=(t=Us(t))<0?n.dropRight(-t):n.take(t-e)),n)},_r.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},_r.prototype.toArray=function(){return this.take(O)},Yr(_r.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),a=dr[i?"take"+("last"==t?"Right":""):t],o=i||/^find/.test(t);a&&(dr.prototype[t]=function(){var t=this.__wrapped__,s=i?[1]:arguments,u=t instanceof _r,l=s[0],c=u||ms(t),f=function(e){var t=a.apply(dr,Kt([e],s));return i&&h?t[0]:t};c&&n&&"function"==typeof l&&1!=l.length&&(u=c=!1);var h=this.__chain__,p=!!this.__actions__.length,d=o&&!h,g=u&&!p;if(!o&&c){t=g?t:new _r(this);var v=e.apply(t,s);return v.__actions__.push({func:Po,args:[f],thisArg:r}),new mr(v,h)}return d&&g?e.apply(this,s):(v=this.thru(f),d?i?v.value()[0]:v.value():v)})}),Wt(["pop","push","shift","sort","splice","unshift"],function(e){var t=at[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);dr.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(ms(i)?i:[],e)}return this[n](function(n){return t.apply(ms(n)?n:[],e)})}}),Yr(_r.prototype,function(e,t){var n=dr[t];if(n){var r=n.name+"";(ar[r]||(ar[r]=[])).push({name:t,func:n})}}),ar[da(r,v).name]=[{name:"wrapper",func:r}],_r.prototype.clone=function(){var e=new _r(this.__wrapped__);return e.__actions__=ra(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=ra(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=ra(this.__views__),e},_r.prototype.reverse=function(){if(this.__filtered__){var e=new _r(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},_r.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=ms(e),r=t<0,i=n?e.length:0,a=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?r:this.__values__[this.__index__++]}},dr.prototype.plant=function(e){for(var t,n=this;n instanceof vr;){var i=fo(n);i.__index__=0,i.__values__=r,t?a.__wrapped__=i:t=i;var a=i;n=n.__wrapped__}return a.__wrapped__=e,t},dr.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof _r){var t=e;return this.__actions__.length&&(t=new _r(this)),(t=t.reverse()).__actions__.push({func:Po,args:[To],thisArg:r}),new mr(t,this.__chain__)}return this.thru(To)},dr.prototype.toJSON=dr.prototype.valueOf=dr.prototype.value=function(){return qi(this.__wrapped__,this.__actions__)},dr.prototype.first=dr.prototype.head,fn&&(dr.prototype[fn]=function(){return this}),dr}();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(Rt._=Bn,define(function(){return Bn})):Bt?((Bt.exports=Bn)._=Bn,Lt._=Bn):Rt._=Bn}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],63:[function(e,t,n){(function(n){e("path");var r=e("fs");function i(){this.types=Object.create(null),this.extensions=Object.create(null)}i.prototype.define=function(e){for(var t in e){for(var r=e[t],i=0;i=0;--s)if(h[s]=f,f*=l[s],p=Math.max(p,o.scratchMemory(l[s])),t.shape[s]!==n.shape[s])throw new Error("Shape mismatch, real and imaginary arrays must have same size");var d,g=4*f+p;d="array"===t.dtype||"float64"===t.dtype||"custom"===t.dtype?a.mallocDouble(g):a.mallocFloat(g);var v,m,_,w,b=i(d,l.slice(0),h,0),y=i(d,l.slice(0),h.slice(0),f),x=i(d,l.slice(0),h.slice(0),2*f),k=i(d,l.slice(0),h.slice(0),3*f),E=4*f;for(r.assign(b,t),r.assign(y,n),s=c-1;s>=0&&(o(e,f/l[s],l[s],d,b.offset,y.offset,E),0!==s);--s){for(m=1,_=x.stride,w=k.stride,u=s-1;u=0;--u)w[u]=_[u]=m,m*=l[u];r.assign(x,b),r.assign(k,y),v=b,b=x,x=v,v=y,y=k,k=v}r.assign(t,b),r.assign(n,y),a.free(d)}},{"./lib/fft-matrix.js":66,ndarray:71,"ndarray-ops":68,"typedarray-pool":130}],66:[function(e,t,n){var r=e("bit-twiddle");function i(e,t,n,i,a,o){var s,u,l,c,f,h,p,d,g,v,m,_,w,b,y,x,k,E,S,A,T,M,I,j;for(e|=0,t|=0,a|=0,o|=0,s=n|=0,u=r.log2(s),E=0;E>1,f=0,l=0;l>=1;f+=h}for(m=-1,_=0,v=1,d=0;d>",rrshift:">>>"};!function(){for(var e in s){var t=s[e];n[e]=o({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+t+"c"},funcName:e}),n[e+"eq"]=o({args:["array","array"],body:{args:["a","b"],body:"a"+t+"=b"},rvalue:!0,funcName:e+"eq"}),n[e+"s"]=o({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+t+"s"},funcName:e+"s"}),n[e+"seq"]=o({args:["array","scalar"],body:{args:["a","s"],body:"a"+t+"=s"},rvalue:!0,funcName:e+"seq"})}}();var u={not:"!",bnot:"~",neg:"-",recip:"1.0/"};!function(){for(var e in u){var t=u[e];n[e]=o({args:["array","array"],body:{args:["a","b"],body:"a="+t+"b"},funcName:e}),n[e+"eq"]=o({args:["array"],body:{args:["a"],body:"a="+t+"a"},rvalue:!0,count:2,funcName:e+"eq"})}}();var l={and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">="};!function(){for(var e in l){var t=l[e];n[e]=o({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+t+"c"},funcName:e}),n[e+"s"]=o({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+t+"s"},funcName:e+"s"}),n[e+"eq"]=o({args:["array","array"],body:{args:["a","b"],body:"a=a"+t+"b"},rvalue:!0,count:2,funcName:e+"eq"}),n[e+"seq"]=o({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+t+"s"},rvalue:!0,count:2,funcName:e+"seq"})}}();var c=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan"];!function(){for(var e=0;ethis_s){this_s=-a}else if(a>this_s){this_s=a}",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norminf"}),n.norm1=r({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:3}],body:"this_s+=a<0?-a:a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm1"}),n.sup=r({args:["array"],pre:{body:"this_h=-Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_>this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}}),n.inf=r({args:["array"],pre:{body:"this_h=Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),n.random=o({args:["array"],pre:{args:[],body:"this_f=Math.random",thisVars:["this_f"]},body:{args:["a"],body:"a=this_f()",thisVars:["this_f"]},funcName:"random"}),n.assign=o({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),n.assigns=o({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),n.equals=r({args:["array","array"],pre:i,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})},{"cwise-compiler":9}],69:[function(e,t,n){"use strict";var r=e("ndarray"),i=e("./doConvert.js");t.exports=function(e,t){for(var n=[],a=e,o=1;Array.isArray(a);)n.push(a.length),o*=a.length,a=a[0];return 0===n.length?r():(t||(t=r(new Float64Array(o),n)),i(t,e),t)}},{"./doConvert.js":70,ndarray:71}],70:[function(e,t,n){t.exports=e("cwise-compiler")({args:["array","scalar","index"],pre:{body:"{}",args:[],thisVars:[],localVars:[]},body:{body:"{\nvar _inline_1_v=_inline_1_arg1_,_inline_1_i\nfor(_inline_1_i=0;_inline_1_i<_inline_1_arg2_.length-1;++_inline_1_i) {\n_inline_1_v=_inline_1_v[_inline_1_arg2_[_inline_1_i]]\n}\n_inline_1_arg0_=_inline_1_v[_inline_1_arg2_[_inline_1_arg2_.length-1]]\n}",args:[{name:"_inline_1_arg0_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg2_",lvalue:!1,rvalue:!0,count:4}],thisVars:[],localVars:["_inline_1_i","_inline_1_v"]},post:{body:"{}",args:[],thisVars:[],localVars:[]},funcName:"convert",blockSize:64})},{"cwise-compiler":9}],71:[function(e,t,n){var r=e("iota-array"),i=e("is-buffer"),a="undefined"!=typeof Float64Array;function o(e,t){return e[0]-t[0]}function s(){var e,t=this.stride,n=new Array(t.length);for(e=0;eMath.abs(this.stride[1]))?[1,0]:[0,1]}})"):3===t&&a.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")):a.push("ORDER})")),a.push("proto.set=function "+n+"_set("+u.join(",")+",v){"),i?a.push("return this.data.set("+c+",v)}"):a.push("return this.data["+c+"]=v}"),a.push("proto.get=function "+n+"_get("+u.join(",")+"){"),i?a.push("return this.data.get("+c+")}"):a.push("return this.data["+c+"]}"),a.push("proto.index=function "+n+"_index(",u.join(),"){return "+c+"}"),a.push("proto.hi=function "+n+"_hi("+u.join(",")+"){return new "+n+"(this.data,"+o.map(function(e){return["(typeof i",e,"!=='number'||i",e,"<0)?this.shape[",e,"]:i",e,"|0"].join("")}).join(",")+","+o.map(function(e){return"this.stride["+e+"]"}).join(",")+",this.offset)}");var p=o.map(function(e){return"a"+e+"=this.shape["+e+"]"}),d=o.map(function(e){return"c"+e+"=this.stride["+e+"]"});a.push("proto.lo=function "+n+"_lo("+u.join(",")+"){var b=this.offset,d=0,"+p.join(",")+","+d.join(","));for(var g=0;g=0){d=i"+g+"|0;b+=c"+g+"*d;a"+g+"-=d}");a.push("return new "+n+"(this.data,"+o.map(function(e){return"a"+e}).join(",")+","+o.map(function(e){return"c"+e}).join(",")+",b)}"),a.push("proto.step=function "+n+"_step("+u.join(",")+"){var "+o.map(function(e){return"a"+e+"=this.shape["+e+"]"}).join(",")+","+o.map(function(e){return"b"+e+"=this.stride["+e+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(g=0;g=0){c=(c+this.stride["+g+"]*i"+g+")|0}else{a.push(this.shape["+g+"]);b.push(this.stride["+g+"])}");return a.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),a.push("return function construct_"+n+"(data,shape,stride,offset){return new "+n+"(data,"+o.map(function(e){return"shape["+e+"]"}).join(",")+","+o.map(function(e){return"stride["+e+"]"}).join(",")+",offset)}"),new Function("CTOR_LIST","ORDER",a.join("\n"))(l[e],s)}var l={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],buffer:[],generic:[]};t.exports=function(e,t,n,r){if(void 0===e)return(0,l.array[0])([]);"number"==typeof e&&(e=[e]),void 0===t&&(t=[e.length]);var o=t.length;if(void 0===n){n=new Array(o);for(var s=o-1,c=1;s>=0;--s)n[s]=c,c*=t[s]}if(void 0===r)for(r=0,s=0;s>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,(e|=e>>>16)+1}},{}],73:[function(e,t,n){"use strict";function r(e,t,n,r){for(var i=e[t++],a=1<>=u,c-=u,v!==a){if(v===o)break;for(var m=va;)w=d[w]>>8,++_;var b=w;if(h+_+(m!==v?1:0)>r)return void console.log("Warning, gif stream longer than expected.");n[h++]=b;var y=h+=_;for(m!==v&&(n[h++]=b),w=m;_--;)w=d[w],n[--y]=255&w,w>>=8;null!==g&&s<4096&&(d[s++]=g<<8|b,s>=l+1&&u<12&&(++u,l=l<<1|1)),g=v}else s=o+1,l=(1<<(u=i+1))-1,g=null}return h!==r&&console.log("Warning, gif stream shorter than expected."),n}try{n.GifWriter=function(e,t,n,r){var i=0,a=void 0===(r=void 0===r?{}:r).loop?null:r.loop,o=void 0===r.palette?null:r.palette;if(t<=0||n<=0||t>65535||n>65535)throw new Error("Width/Height invalid.");function s(e){var t=e.length;if(t<2||t>256||t&t-1)throw new Error("Invalid code/color length, must be power of 2 and 2 .. 256.");return t}e[i++]=71,e[i++]=73,e[i++]=70,e[i++]=56,e[i++]=57,e[i++]=97;var u=0,l=0;if(null!==o){for(var c=s(o);c>>=1;)++u;if(c=1<=c)throw new Error("Background index out of range.");if(0===l)throw new Error("Background index explicitly passed as 0.")}}if(e[i++]=255&t,e[i++]=t>>8&255,e[i++]=255&n,e[i++]=n>>8&255,e[i++]=(null!==o?128:0)|u,e[i++]=l,e[i++]=0,null!==o)for(var f=0,h=o.length;f>16&255,e[i++]=p>>8&255,e[i++]=255&p}if(null!==a){if(a<0||a>65535)throw new Error("Loop count invalid.");e[i++]=33,e[i++]=255,e[i++]=11,e[i++]=78,e[i++]=69,e[i++]=84,e[i++]=83,e[i++]=67,e[i++]=65,e[i++]=80,e[i++]=69,e[i++]=50,e[i++]=46,e[i++]=48,e[i++]=3,e[i++]=1,e[i++]=255&a,e[i++]=a>>8&255,e[i++]=0}var d=!1;this.addFrame=function(t,n,r,a,u,l){if(!0===d&&(--i,d=!1),l=void 0===l?{}:l,t<0||n<0||t>65535||n>65535)throw new Error("x/y invalid.");if(r<=0||a<=0||r>65535||a>65535)throw new Error("Width/Height invalid.");if(u.length>=1;)++p;h=1<3)throw new Error("Disposal out of range.");var m=!1,_=0;if(void 0!==l.transparent&&null!==l.transparent&&(m=!0,(_=l.transparent)<0||_>=h))throw new Error("Transparent color index.");if((0!==v||m||0!==g)&&(e[i++]=33,e[i++]=249,e[i++]=4,e[i++]=v<<2|(!0===m?1:0),e[i++]=255&g,e[i++]=g>>8&255,e[i++]=_,e[i++]=0),e[i++]=44,e[i++]=255&t,e[i++]=t>>8&255,e[i++]=255&n,e[i++]=n>>8&255,e[i++]=255&r,e[i++]=r>>8&255,e[i++]=255&a,e[i++]=a>>8&255,e[i++]=!0===c?128|p-1:0,!0===c)for(var w=0,b=f.length;w>16&255,e[i++]=y>>8&255,e[i++]=255&y}return i=function(e,t,n,r){e[t++]=n;var i=t++,a=1<=n;)e[t++]=255&f,f>>=8,c-=8,t===i+256&&(e[i]=255,i=t++)}function p(e){f|=e<=8;)e[t++]=255&f,f>>=8,c-=8,t===i+256&&(e[i]=255,i=t++);4096===u?(p(a),u=s+1,l=n+1,g={}):(u>=1<>7,s=1<<1+(7&a);e[t++],e[t++];var u=null,l=null;o&&(u=t,l=s,t+=3*s);var c=!0,f=[],h=0,p=null,d=0,g=null;for(this.width=n,this.height=i;c&&t=0))throw Error("Invalid block size");if(0===M)break;t+=M}break;case 249:if(4!==e[t++]||0!==e[t+4])throw new Error("Invalid graphics extension block.");var v=e[t++];h=e[t++]|e[t++]<<8,p=e[t++],0==(1&v)&&(p=null),d=v>>2&7,t++;break;case 254:for(;;){if(!((M=e[t++])>=0))throw Error("Invalid block size");if(0===M)break;t+=M}break;default:throw new Error("Unknown graphic control label: 0x"+e[t-1].toString(16))}break;case 44:var m=e[t++]|e[t++]<<8,_=e[t++]|e[t++]<<8,w=e[t++]|e[t++]<<8,b=e[t++]|e[t++]<<8,y=e[t++],x=y>>6&1,k=1<<1+(7&y),E=u,S=l,A=!1;y>>7&&(A=!0,E=t,S=k,t+=3*k);var T=t;for(t++;;){var M;if(!((M=e[t++])>=0))throw Error("Invalid block size");if(0===M)break;t+=M}f.push({x:m,y:_,width:w,height:b,has_local_palette:A,palette_offset:E,palette_size:S,data_offset:T,data_length:t-T,transparent_index:p,interlaced:!!x,delay:h,disposal:d});break;case 59:c=!1;break;default:throw new Error("Unknown gif block: 0x"+e[t-1].toString(16))}this.numFrames=function(){return f.length},this.loopCount=function(){return g},this.frameInfo=function(e){if(e<0||e>=f.length)throw new Error("Frame index out of range.");return f[e]},this.decodeAndBlitFrameBGRA=function(t,i){var a=this.frameInfo(t),o=a.width*a.height,s=new Uint8Array(o);r(e,a.data_offset,s,o);var u=a.palette_offset,l=a.transparent_index;null===l&&(l=256);var c=a.width,f=n-c,h=c,p=4*(a.y*n+a.x),d=4*((a.y+a.height)*n+a.x),g=p,v=4*f;!0===a.interlaced&&(v+=4*n*7);for(var m=8,_=0,w=s.length;_=d&&(v=4*f+4*n*(m-1),g=p+(c+f)*(m<<1),m>>=1)),b===l)g+=4;else{var y=e[u+3*b],x=e[u+3*b+1],k=e[u+3*b+2];i[g++]=k,i[g++]=x,i[g++]=y,i[g++]=255}--h}},this.decodeAndBlitFrameRGBA=function(t,i){var a=this.frameInfo(t),o=a.width*a.height,s=new Uint8Array(o);r(e,a.data_offset,s,o);var u=a.palette_offset,l=a.transparent_index;null===l&&(l=256);var c=a.width,f=n-c,h=c,p=4*(a.y*n+a.x),d=4*((a.y+a.height)*n+a.x),g=p,v=4*f;!0===a.interlaced&&(v+=4*n*7);for(var m=8,_=0,w=s.length;_=d&&(v=4*f+4*n*(m-1),g=p+(c+f)*(m<<1),m>>=1)),b===l)g+=4;else{var y=e[u+3*b],x=e[u+3*b+1],k=e[u+3*b+2];i[g++]=y,i[g++]=x,i[g++]=k,i[g++]=255}--h}}}}catch(e){}},{}],74:[function(e,t,n){(function(n){var r=e("charm");function i(e){if(!(e=e||{}).total)throw new Error("You MUST specify the total number of operations that will be processed.");this.total=e.total,this.current=0,this.max_burden=e.maxBurden||.5,this.show_burden=e.showBurden||!1,this.started=!1,this.size=50,this.inner_time=0,this.outer_time=0,this.elapsed=0,this.time_start=0,this.time_end=0,this.time_left=0,this.time_burden=0,this.skip_steps=0,this.skipped=0,this.aborted=!1,this.charm=r(),this.charm.pipe(n.stdout),this.charm.write("\n\n\n")}function a(e,t,n){for(n=n||" ";e.length3&&(u[0]=u[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,o)),(u[1]||"").length=this.total&&this.finished(),this.time_end=(new Date).getTime(),this.inner_time=this.time_end-this.time_start)},i.prototype.updateTimes=function(){this.elapsed=this.time_start-this.started,this.time_end>0&&(this.outer_time=this.time_start-this.time_end),this.inner_time>0&&this.outer_time>0&&(this.time_burden=this.inner_time/(this.inner_time+this.outer_time)*100,this.time_left=this.elapsed/this.current*(this.total-this.current),this.time_left<0&&(this.time_left=0)),this.time_burden>this.max_burden&&this.skip_steps0&&this.current=0;r--){var i=e[r];"."===i?e.splice(r,1):".."===i?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}var r=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,i=function(e){return r.exec(e).slice(1)};function a(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r=-1&&!r;i--){var o=i>=0?arguments[i]:e.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");o&&(n=o+"/"+n,r="/"===o.charAt(0))}return(r?"/":"")+(n=t(a(n.split("/"),function(e){return!!e}),!r).join("/"))||"."},n.normalize=function(e){var r=n.isAbsolute(e),i="/"===o(e,-1);return(e=t(a(e.split("/"),function(e){return!!e}),!r).join("/"))||r||(e="."),e&&i&&(e+="/"),(r?"/":"")+e},n.isAbsolute=function(e){return"/"===e.charAt(0)},n.join=function(){var e=Array.prototype.slice.call(arguments,0);return n.normalize(a(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},n.relative=function(e,t){function r(e){for(var t=0;t=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=n.resolve(e).substr(1),t=n.resolve(t).substr(1);for(var i=r(e.split("/")),a=r(t.split("/")),o=Math.min(i.length,a.length),s=o,u=0;u>4,n.push(f,c);break;case 2:u=3&h,l=h>>2&3,c=h>>4&3,f=h>>6&3,n.push(f,c,l,u);break;case 1:i=1&h,a=h>>1&1,o=h>>2&1,s=h>>3&1,u=h>>4&1,l=h>>5&1,c=h>>6&1,f=h>>7&1,n.push(f,c,l,u,s,o,a,i)}}return{get:function(e){for(;n.length0&&(this._paused=!1,this.emit("drain"))}.bind(this))},o.prototype.write=function(e,t){return this.writable?(n=r.isBuffer(e)?e:new r(e,t||this._encoding),this._buffers.push(n),this._buffered+=n.length,this._process(),this._reads&&0===this._reads.length&&(this._paused=!0),this.writable&&!this._paused):(this.emit("error",new Error("Stream not writable")),!1);var n},o.prototype.end=function(e,t){e&&this.write(e,t),this.writable=!1,this._buffers&&(0===this._buffers.length?this._end():(this._buffers.push(null),this._process()))},o.prototype.destroySoon=o.prototype.end,o.prototype._end=function(){this._reads.length>0&&this.emit("error",new Error("There are some read requests waitng on finished stream")),this.destroy()},o.prototype.destroy=function(){this._buffers&&(this.writable=!1,this._reads=null,this._buffers=null,this.emit("close"))},o.prototype._processReadAllowingLess=function(e){this._reads.shift();var t=this._buffers[0];t.length>e.length?(this._buffered-=e.length,this._buffers[0]=t.slice(e.length),e.func.call(this,t.slice(0,e.length))):(this._buffered-=t.length,this._buffers.shift(),e.func.call(this,t))},o.prototype._processRead=function(e){this._reads.shift();for(var t=0,n=0,i=new r(e.length);t0&&this._buffers.splice(0,n),this._buffered-=e.length,e.func.call(this,i)},o.prototype._process=function(){try{for(;this._buffered>0&&this._reads&&this._reads.length>0;){var e=this._reads[0];if(e.allowLess)this._processReadAllowingLess(e);else{if(!(this._buffered>=e.length))break;this._processRead(e)}}this._buffers&&this._buffers.length>0&&null===this._buffers[0]&&this._end()}catch(e){this.emit("error",e)}}}).call(this,e("_process"),e("buffer").Buffer)},{_process:98,buffer:4,stream:112,util:135}],79:[function(e,t,n){"use strict";t.exports={PNG_SIGNATURE:[137,80,78,71,13,10,26,10],TYPE_IHDR:1229472850,TYPE_IEND:1229278788,TYPE_IDAT:1229209940,TYPE_PLTE:1347179589,TYPE_tRNS:1951551059,TYPE_gAMA:1732332865,COLORTYPE_GRAYSCALE:0,COLORTYPE_PALETTE:1,COLORTYPE_COLOR:2,COLORTYPE_ALPHA:4,COLORTYPE_PALETTE_COLOR:3,COLORTYPE_COLOR_ALPHA:6,COLORTYPE_TO_BPP_MAP:{0:1,2:3,3:1,4:2,6:4},GAMMA_DIVISION:1e5}},{}],80:[function(e,t,n){"use strict";var r=[];!function(){for(var e=0;e<256;e++){for(var t=e,n=0;n<8;n++)1&t?t=3988292384^t>>>1:t>>>=1;r[e]=t}}();var i=t.exports=function(){this._crc=-1};i.prototype.write=function(e){for(var t=0;t>>8;return!0},i.prototype.crc32=function(){return-1^this._crc},i.crc32=function(e){for(var t=-1,n=0;n>>8;return-1^t}},{}],81:[function(e,t,n){(function(n){"use strict";var r=e("./paeth-predictor");var i={0:function(e,t,n,r,i){e.copy(r,i,t,t+n)},1:function(e,t,n,r,i,a){for(var o=0;o=a?e[t+o-a]:0,u=e[t+o]-s;r[i+o]=u}},2:function(e,t,n,r,i){for(var a=0;a0?e[t+a-n]:0,s=e[t+a]-o;r[i+a]=s}},3:function(e,t,n,r,i,a){for(var o=0;o=a?e[t+o-a]:0,u=t>0?e[t+o-n]:0,l=e[t+o]-(s+u>>1);r[i+o]=l}},4:function(e,t,n,i,a,o){for(var s=0;s=o?e[t+s-o]:0,l=t>0?e[t+s-n]:0,c=t>0&&s>=o?e[t+s-(n+o)]:0,f=e[t+s]-r(u,l,c);i[a+s]=f}}},a={0:function(e,t,n){for(var r=0,i=t+n,a=t;a=r?e[t+a-r]:0,s=e[t+a]-o;i+=Math.abs(s)}return i},2:function(e,t,n){for(var r=0,i=t+n,a=t;a0?e[a-n]:0,s=e[a]-o;r+=Math.abs(s)}return r},3:function(e,t,n,r){for(var i=0,a=0;a=r?e[t+a-r]:0,s=t>0?e[t+a-n]:0,u=e[t+a]-(o+s>>1);i+=Math.abs(u)}return i},4:function(e,t,n,i){for(var a=0,o=0;o=i?e[t+o-i]:0,u=t>0?e[t+o-n]:0,l=t>0&&o>=i?e[t+o-(n+i)]:0,c=e[t+o]-r(s,u,l);a+=Math.abs(c)}return a}};t.exports=function(e,t,r,o,s){var u;if("filterType"in o&&-1!==o.filterType){if("number"!=typeof o.filterType)throw new Error("unrecognised filter types");u=[o.filterType]}else u=[0,1,2,3,4];for(var l=t*s,c=0,f=0,h=new n((l+1)*r),p=u[0],d=0;d1)for(var g=1/0,v=0;vi?t[a-r]:0;t[a]=o+s}},o.prototype._unFilterType2=function(e,t,n){for(var r=this._lastLine,i=0;ii?t[o-r]:0,c=Math.floor((l+u)/2);t[o]=s+c}},o.prototype._unFilterType4=function(e,t,n){for(var r=this._xComparison,a=r-1,o=this._lastLine,s=0;sa?t[s-r]:0,f=s>a&&o?o[s-r]:0,h=i(c,l,f);t[s]=u+h}},o.prototype._reverseFilterLine=function(e){var t,r=e[0],i=this._images[this._imageIndex],a=i.byteWidth;if(0===r)t=e.slice(1,a+1);else switch(t=new n(a),r){case 1:this._unFilterType1(e,t,a);break;case 2:this._unFilterType2(e,t,a);break;case 3:this._unFilterType3(e,t,a);break;case 4:this._unFilterType4(e,t,a);break;default:throw new Error("Unrecognised filter type - "+r)}this.write(t),i.lineIndex++,i.lineIndex>=i.height?(this._lastLine=null,this._imageIndex++,i=this._images[this._imageIndex]):this._lastLine=t,i?this.read(i.byteWidth+1,this._reverseFilterLine.bind(this)):(this._lastLine=null,this.complete())}}).call(this,e("buffer").Buffer)},{"./interlace":86,"./paeth-predictor":90,buffer:4}],85:[function(e,t,n){(function(e){"use strict";t.exports=function(t,n){var r=n.depth,i=n.width,a=n.height,o=n.colorType,s=n.transColor,u=n.palette,l=t;return 3===o?function(e,t,n,r,i){for(var a=0,o=0;o0&&f>0&&n.push({width:c,height:f,index:u})}return n},n.getInterlaceIterator=function(e){return function(t,n,i){var a=t%r[i].x.length,o=(t-a)/r[i].x.length*8+r[i].x[a],s=n%r[i].y.length;return 4*o+((n-s)/r[i].y.length*8+r[i].y[s])*e*4}}},{}],87:[function(e,t,n){(function(n){"use strict";var r=e("util"),i=e("stream"),a=e("./constants"),o=e("./packer"),s=t.exports=function(e){i.call(this);var t=e||{};this._packer=new o(t),this._deflate=this._packer.createDeflate(),this.readable=!0};r.inherits(s,i),s.prototype.pack=function(e,t,r,i){this.emit("data",new n(a.PNG_SIGNATURE)),this.emit("data",this._packer.packIHDR(t,r)),i&&this.emit("data",this._packer.packGAMA(i));var o=this._packer.filterData(e,t,r);this._deflate.on("error",this.emit.bind(this,"error")),this._deflate.on("data",function(e){this.emit("data",this._packer.packIDAT(e))}.bind(this)),this._deflate.on("end",function(){this.emit("data",this._packer.packIEND()),this.emit("end")}.bind(this)),this._deflate.end(o)}}).call(this,e("buffer").Buffer)},{"./constants":79,"./packer":89,buffer:4,stream:112,util:135}],88:[function(e,t,n){(function(n){"use strict";var r=!0,i=e("zlib");i.deflateSync||(r=!1);var a=e("./constants"),o=e("./packer");t.exports=function(e,t){if(!r)throw new Error("To use the sync capability of this library in old node versions, please also add a dependency on node-zlb-backport");var s=new o(t||{}),u=[];u.push(new n(a.PNG_SIGNATURE)),u.push(s.packIHDR(e.width,e.height)),e.gamma&&u.push(s.packGAMA(e.gamma));var l=s.filterData(e.data,e.width,e.height),c=i.deflateSync(l,s.getDeflateOptions());if(l=null,!c||!c.length)throw new Error("bad png - invalid compressed data response");return u.push(s.packIDAT(c)),u.push(s.packIEND()),n.concat(u)}}).call(this,e("buffer").Buffer)},{"./constants":79,"./packer":89,buffer:4,zlib:41}],89:[function(e,t,n){(function(n){"use strict";var r=e("./constants"),i=e("./crc"),a=e("./bitpacker"),o=e("./filter-pack"),s=e("zlib"),u=t.exports=function(e){if(this._options=e,e.deflateChunkSize=e.deflateChunkSize||32768,e.deflateLevel=null!=e.deflateLevel?e.deflateLevel:9,e.deflateStrategy=null!=e.deflateStrategy?e.deflateStrategy:3,e.inputHasAlpha=null==e.inputHasAlpha||e.inputHasAlpha,e.deflateFactory=e.deflateFactory||s.createDeflate,e.bitDepth=e.bitDepth||8,e.colorType="number"==typeof e.colorType?e.colorType:r.COLORTYPE_COLOR_ALPHA,e.colorType!==r.COLORTYPE_COLOR&&e.colorType!==r.COLORTYPE_COLOR_ALPHA)throw new Error("option color type:"+e.colorType+" is not supported at present");if(8!==e.bitDepth)throw new Error("option bit depth:"+e.bitDepth+" is not supported at present")};u.prototype.getDeflateOptions=function(){return{chunkSize:this._options.deflateChunkSize,level:this._options.deflateLevel,strategy:this._options.deflateStrategy}},u.prototype.createDeflate=function(){return this._options.deflateFactory(this.getDeflateOptions())},u.prototype.filterData=function(e,t,n){var i=a(e,t,n,this._options),s=r.COLORTYPE_TO_BPP_MAP[this._options.colorType];return o(i,t,n,this._options,s)},u.prototype._packChunk=function(e,t){var r=t?t.length:0,a=new n(r+12);return a.writeUInt32BE(r,0),a.writeUInt32BE(e,4),t&&t.copy(a,8),a.writeInt32BE(i.crc32(a.slice(4,a.length-4)),a.length-4),a},u.prototype.packGAMA=function(e){var t=new n(4);return t.writeUInt32BE(Math.floor(e*r.GAMMA_DIVISION),0),this._packChunk(r.TYPE_gAMA,t)},u.prototype.packIHDR=function(e,t){var i=new n(13);return i.writeUInt32BE(e,0),i.writeUInt32BE(t,4),i[8]=this._options.bitDepth,i[9]=this._options.colorType,i[10]=0,i[11]=0,i[12]=0,this._packChunk(r.TYPE_IHDR,i)},u.prototype.packIDAT=function(e){return this._packChunk(r.TYPE_IDAT,e)},u.prototype.packIEND=function(){return this._packChunk(r.TYPE_IEND,null)}}).call(this,e("buffer").Buffer)},{"./bitpacker":77,"./constants":79,"./crc":80,"./filter-pack":81,buffer:4,zlib:41}],90:[function(e,t,n){"use strict";t.exports=function(e,t,n){var r=e+t-n,i=Math.abs(r-e),a=Math.abs(r-t),o=Math.abs(r-n);return i<=a&&i<=o?e:a<=o?t:n}},{}],91:[function(e,t,n){"use strict";var r=e("util"),i=e("zlib"),a=e("./chunkstream"),o=e("./filter-parse-async"),s=e("./parser"),u=e("./bitmapper"),l=e("./format-normaliser"),c=t.exports=function(e){a.call(this),this._parser=new s(e,{read:this.read.bind(this),error:this._handleError.bind(this),metadata:this._handleMetaData.bind(this),gamma:this.emit.bind(this,"gamma"),palette:this._handlePalette.bind(this),transColor:this._handleTransColor.bind(this),finished:this._finished.bind(this),inflateData:this._inflateData.bind(this)}),this._options=e,this.writable=!0,this._parser.start()};r.inherits(c,a),c.prototype._handleError=function(e){this.emit("error",e),this.writable=!1,this.destroy(),this._inflate&&this._inflate.destroy&&this._inflate.destroy(),this.errord=!0},c.prototype._inflateData=function(e){this._inflate||(this._inflate=i.createInflate(),this._inflate.on("error",this.emit.bind(this,"error")),this._filter.on("complete",this._complete.bind(this)),this._inflate.pipe(this._filter)),this._inflate.write(e)},c.prototype._handleMetaData=function(e){this.emit("metadata",e),this._bitmapInfo=Object.create(e),this._filter=new o(this._bitmapInfo)},c.prototype._handleTransColor=function(e){this._bitmapInfo.transColor=e},c.prototype._handlePalette=function(e){this._bitmapInfo.palette=e},c.prototype._finished=function(){this.errord||(this._inflate?this._inflate.end():this.emit("error","No Inflate block"),this.destroySoon())},c.prototype._complete=function(e){if(!this.errord){try{var t=u.dataToBitMap(e,this._bitmapInfo),n=l(t,this._bitmapInfo);t=null}catch(e){return void this._handleError(e)}this.emit("parsed",n)}}},{"./bitmapper":76,"./chunkstream":78,"./filter-parse-async":82,"./format-normaliser":85,"./parser":93,util:135,zlib:41}],92:[function(e,t,n){(function(n){"use strict";var r=!0,i=e("zlib");i.deflateSync||(r=!1);var a=e("./sync-reader"),o=e("./filter-parse-sync"),s=e("./parser"),u=e("./bitmapper"),l=e("./format-normaliser");t.exports=function(e,t){if(!r)throw new Error("To use the sync capability of this library in old node versions, please also add a dependency on node-zlb-backport");var c,f,h;var p=[];var d=new a(e);if(new s(t,{read:d.read.bind(d),error:function(e){c=e},metadata:function(e){f=e},gamma:function(e){h=e},palette:function(e){f.palette=e},transColor:function(e){f.transColor=e},inflateData:function(e){p.push(e)}}).start(),d.process(),c)throw c;var g=n.concat(p);p.length=0;var v=i.inflateSync(g);if(g=null,!v||!v.length)throw new Error("bad png - invalid inflate data response");var m=o.process(v,f);g=null;var _=u.dataToBitMap(m,f);m=null;var w=l(_,f);return f.data=w,f.gamma=h||0,f}}).call(this,e("buffer").Buffer)},{"./bitmapper":76,"./filter-parse-sync":83,"./format-normaliser":85,"./parser":93,"./sync-reader":96,buffer:4,zlib:41}],93:[function(e,t,n){(function(n){"use strict";var r=e("./constants"),i=e("./crc"),a=t.exports=function(e,t){this._options=e,e.checkCRC=!1!==e.checkCRC,this._hasIHDR=!1,this._hasIEND=!1,this._palette=[],this._colorType=0,this._chunks={},this._chunks[r.TYPE_IHDR]=this._handleIHDR.bind(this),this._chunks[r.TYPE_IEND]=this._handleIEND.bind(this),this._chunks[r.TYPE_IDAT]=this._handleIDAT.bind(this),this._chunks[r.TYPE_PLTE]=this._handlePLTE.bind(this),this._chunks[r.TYPE_tRNS]=this._handleTRNS.bind(this),this._chunks[r.TYPE_gAMA]=this._handleGAMA.bind(this),this.read=t.read,this.error=t.error,this.metadata=t.metadata,this.gamma=t.gamma,this.transColor=t.transColor,this.palette=t.palette,this.parsed=t.parsed,this.inflateData=t.inflateData,this.inflateData=t.inflateData,this.finished=t.finished};a.prototype.start=function(){this.read(r.PNG_SIGNATURE.length,this._parseSignature.bind(this))},a.prototype._parseSignature=function(e){for(var t=r.PNG_SIGNATURE,n=0;nthis._palette.length)return void this.error(new Error("More transparent colors than palette size"));for(var t=0;t0?this._handleIDAT(n):this._handleChunkEnd()},a.prototype._handleIEND=function(e){this.read(e,this._parseIEND.bind(this))},a.prototype._parseIEND=function(e){this._crc.write(e),this._hasIEND=!0,this._handleChunkEnd(),this.finished&&this.finished()}}).call(this,e("buffer").Buffer)},{"./constants":79,"./crc":80,buffer:4}],94:[function(e,t,n){"use strict";var r=e("./parser-sync"),i=e("./packer-sync");n.read=function(e,t){return r(e,t||{})},n.write=function(e){return i(e)}},{"./packer-sync":88,"./parser-sync":92}],95:[function(e,t,n){(function(t,r){"use strict";var i=e("util"),a=e("stream"),o=e("./parser-async"),s=e("./packer-async"),u=e("./png-sync"),l=n.PNG=function(e){a.call(this),e=e||{},this.width=e.width||0,this.height=e.height||0,this.data=this.width>0&&this.height>0?new r(4*this.width*this.height):null,e.fill&&this.data&&this.data.fill(0),this.gamma=0,this.readable=this.writable=!0,this._parser=new o(e),this._parser.on("error",this.emit.bind(this,"error")),this._parser.on("close",this._handleClose.bind(this)),this._parser.on("metadata",this._metadata.bind(this)),this._parser.on("gamma",this._gamma.bind(this)),this._parser.on("parsed",function(e){this.data=e,this.emit("parsed",e)}.bind(this)),this._packer=new s(e),this._packer.on("data",this.emit.bind(this,"data")),this._packer.on("end",this.emit.bind(this,"end")),this._parser.on("close",this._handleClose.bind(this)),this._packer.on("error",this.emit.bind(this,"error"))};i.inherits(l,a),l.sync=u,l.prototype.pack=function(){return this.data&&this.data.length?(t.nextTick(function(){this._packer.pack(this.data,this.width,this.height,this.gamma)}.bind(this)),this):(this.emit("error","No data provided"),this)},l.prototype.parse=function(e,t){var n,r;t&&(n=function(e){this.removeListener("error",r),this.data=e,t(null,this)}.bind(this),r=function(e){this.removeListener("parsed",n),t(e,null)}.bind(this),this.once("parsed",n),this.once("error",r));return this.end(e),this},l.prototype.write=function(e){return this._parser.write(e),!0},l.prototype.end=function(e){this._parser.end(e)},l.prototype._metadata=function(e){this.width=e.width,this.height=e.height,this.emit("metadata",e)},l.prototype._gamma=function(e){this.gamma=e},l.prototype._handleClose=function(){this._parser.writable||this._packer.readable||this.emit("close")},l.bitblt=function(e,t,n,r,i,a,o,s){if(n>e.width||r>e.height||n+i>e.width||r+a>e.height)throw new Error("bitblt reading outside image");if(o>t.width||s>t.height||o+i>t.width||s+a>t.height)throw new Error("bitblt writing outside image");for(var u=0;u0&&this._buffer.length;){var e=this._reads[0];if(!this._buffer.length||!(this._buffer.length>=e.length||e.allowLess))break;this._reads.shift();var t=this._buffer;this._buffer=t.slice(e.length),e.func.call(this,t.slice(0,e.length))}return this._reads.length>0?new Error("There are some read requests waitng on finished stream"):this._buffer.length>0?new Error("unrecognised content at end of stream"):void 0}},{}],97:[function(e,t,n){(function(e){"use strict";!e.version||0===e.version.indexOf("v0.")||0===e.version.indexOf("v1.")&&0!==e.version.indexOf("v1.8.")?t.exports={nextTick:function(t,n,r,i){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var a,o,s=arguments.length;switch(s){case 0:case 1:return e.nextTick(t);case 2:return e.nextTick(function(){t.call(null,n)});case 3:return e.nextTick(function(){t.call(null,n,r)});case 4:return e.nextTick(function(){t.call(null,n,r,i)});default:for(a=new Array(s-1),o=0;o1)for(var n=1;n0?d(e):b(e)}(e,t);else if(t.objectMode||r&&r.length>0)if(t.ended&&!o){var u=new Error("stream.push() after EOF");e.emit("error",u)}else if(t.endEmitted&&o){u=new Error("stream.unshift() after end event");e.emit("error",u)}else!t.decoder||o||a||(r=t.decoder.write(r)),t.length+=t.objectMode?1:r.length,o?t.buffer.unshift(r):(t.reading=!1,t.buffer.push(r)),t.needReadable&&d(e),function(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(function(){!function(e,t){var n=t.length;for(;!t.reading&&!t.flowing&&!t.ended&&t.lengtht.highWaterMark&&(t.highWaterMark=function(e){if(e>=h)e=h;else{e--;for(var t=1;t<32;t<<=1)e|=e>>t;e++}return e}(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function d(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,t.sync?n.nextTick(function(){g(e)}):g(e))}function g(e){e.emit("readable")}function v(e){var t,n=e._readableState;function r(e,r,i){!1===e.write(t)&&n.awaitDrain++}for(n.awaitDrain=0;n.pipesCount&&null!==(t=e.read());)if(1===n.pipesCount?r(n.pipes):y(n.pipes,r),e.emit("data",t),n.awaitDrain>0)return;if(0===n.pipesCount)return n.flowing=!1,void(a.listenerCount(e,"data")>0&&_(e));n.ranOut=!0}function m(){this._readableState.ranOut&&(this._readableState.ranOut=!1,v(this))}function _(e,t){if(e._readableState.flowing)throw new Error("Cannot switch to old mode now.");var r=t||!1,i=!1;e.readable=!0,e.pipe=s.prototype.pipe,e.on=e.addListener=s.prototype.on,e.on("readable",function(){var t;for(i=!0;!r&&null!==(t=e.read());)e.emit("data",t);null===t&&(i=!1,e._readableState.needReadable=!0)}),e.pause=function(){r=!0,this.emit("pause")},e.resume=function(){r=!1,i?n.nextTick(function(){e.emit("readable")}):this.read(0),this.emit("resume")},e.emit("readable")}function w(e,t){var n,r=t.buffer,a=t.length,o=!!t.decoder,s=!!t.objectMode;if(0===r.length)return null;if(0===a)n=null;else if(s)n=r.shift();else if(!e||e>=a)n=o?r.join(""):i.concat(r,a),r.length=0;else{if(e0)throw new Error("endReadable called on non-empty stream");!t.endEmitted&&t.calledRead&&(t.ended=!0,n.nextTick(function(){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}))}function y(e,t){for(var n=0,r=e.length;n0)&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return d(this),null;if(0===(e=p(e,t))&&t.ended)return n=null,t.length>0&&t.decoder&&(n=w(e,t),t.length-=n.length),0===t.length&&b(this),n;var i=t.needReadable;return t.length-e<=t.highWaterMark&&(i=!0),(t.ended||t.reading)&&(i=!1),i&&(t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1),i&&!t.reading&&(e=p(r,t)),null===(n=e>0?w(e,t):null)&&(t.needReadable=!0,e=0),t.length-=e,0!==t.length||t.ended||(t.needReadable=!0),t.ended&&!t.endEmitted&&0===t.length&&b(this),n},c.prototype._read=function(e){this.emit("error",new Error("not implemented"))},c.prototype.pipe=function(e,t){var i=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1;var s=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?l:f;function u(e){e===i&&f()}function l(){e.end()}o.endEmitted?n.nextTick(s):i.once("end",s),e.on("unpipe",u);var c=function(e){return function(){var t=e._readableState;t.awaitDrain--,0===t.awaitDrain&&v(e)}}(i);function f(){e.removeListener("close",p),e.removeListener("finish",d),e.removeListener("drain",c),e.removeListener("error",h),e.removeListener("unpipe",u),i.removeListener("end",l),i.removeListener("end",f),e._writableState&&!e._writableState.needDrain||c()}function h(t){g(),e.removeListener("error",h),0===a.listenerCount(e,"error")&&e.emit("error",t)}function p(){e.removeListener("finish",d),g()}function d(){e.removeListener("close",p),g()}function g(){i.unpipe(e)}return e.on("drain",c),e._events&&e._events.error?r(e._events.error)?e._events.error.unshift(h):e._events.error=[h,e._events.error]:e.on("error",h),e.once("close",p),e.once("finish",d),e.emit("pipe",i),o.flowing||(this.on("readable",m),o.flowing=!0,n.nextTick(function(){v(i)})),e},c.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,this.removeListener("readable",m),t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,this.removeListener("readable",m),t.flowing=!1;for(var i=0;i0&&!e[o-1];)o--;a.push({children:[],index:0});var s,u=a[0];for(n=0;n0;)u=a.pop();for(u.index++,a.push(u);a.length<=n;)a.push(s={children:[],index:0}),u.children[u.index]=s.children,u=s;i++}n+10)return p>>--d&1;if(255==(p=t[n++])){var e=t[n++];if(e)throw"unexpected marker: "+(p<<8|e).toString(16)}return d=7,p>>>7}function v(e){for(var t,n=e;null!==(t=g());){if("number"==typeof(n=n[t]))return n;if("object"!=typeof n)throw"invalid huffman sequence"}return null}function m(e){for(var t=0;e>0;){var n=g();if(null===n)return;t=t<<1|n,e--}return t}function _(e){var t=m(e);return t>=1<0)w--;else for(var r=o,i=s;r<=i;){var a=v(t.huffmanTableAC),u=15&a,c=a>>4;if(0!==u)n[e[r+=c]]=_(u)*(1<>4,0===f)a<15?(w=m(a)+(1<>4;if(0!==s)n[e[a+=u]]=_(s),a++;else{if(u<15)break;a+=16}}};var R,L,B,C,O=0;for(L=1==j?i[0].blocksPerLine*i[0].blocksPerColumn:c*r.mcusPerColumn,a||(a=L);O=65488&&R<=65495))break;n+=2}return n-h}function h(e,l){var c,f,h=[],p=l.blocksPerLine,d=l.blocksPerColumn,g=p<<3,v=new Int32Array(64),m=new Uint8Array(64);function _(e,c,f){var h,p,d,g,v,m,_,w,b,y,x=l.quantizationTable,k=f;for(y=0;y<64;y++)k[y]=e[y]*x[y];for(y=0;y<8;++y){var E=8*y;0!=k[1+E]||0!=k[2+E]||0!=k[3+E]||0!=k[4+E]||0!=k[5+E]||0!=k[6+E]||0!=k[7+E]?(h=s*k[0+E]+128>>8,p=s*k[4+E]+128>>8,d=k[2+E],g=k[6+E],v=u*(k[1+E]-k[7+E])+128>>8,w=u*(k[1+E]+k[7+E])+128>>8,m=k[3+E]<<4,_=k[5+E]<<4,b=h-p+1>>1,h=h+p+1>>1,p=b,b=d*o+g*a+128>>8,d=d*a-g*o+128>>8,g=b,b=v-_+1>>1,v=v+_+1>>1,_=b,b=w+m+1>>1,m=w-m+1>>1,w=b,b=h-g+1>>1,h=h+g+1>>1,g=b,b=p-d+1>>1,p=p+d+1>>1,d=b,b=v*i+w*r+2048>>12,v=v*r-w*i+2048>>12,w=b,b=m*n+_*t+2048>>12,m=m*t-_*n+2048>>12,_=b,k[0+E]=h+w,k[7+E]=h-w,k[1+E]=p+_,k[6+E]=p-_,k[2+E]=d+m,k[5+E]=d-m,k[3+E]=g+v,k[4+E]=g-v):(b=s*k[0+E]+512>>10,k[0+E]=b,k[1+E]=b,k[2+E]=b,k[3+E]=b,k[4+E]=b,k[5+E]=b,k[6+E]=b,k[7+E]=b)}for(y=0;y<8;++y){var S=y;0!=k[8+S]||0!=k[16+S]||0!=k[24+S]||0!=k[32+S]||0!=k[40+S]||0!=k[48+S]||0!=k[56+S]?(h=s*k[0+S]+2048>>12,p=s*k[32+S]+2048>>12,d=k[16+S],g=k[48+S],v=u*(k[8+S]-k[56+S])+2048>>12,w=u*(k[8+S]+k[56+S])+2048>>12,m=k[24+S],_=k[40+S],b=h-p+1>>1,h=h+p+1>>1,p=b,b=d*o+g*a+2048>>12,d=d*a-g*o+2048>>12,g=b,b=v-_+1>>1,v=v+_+1>>1,_=b,b=w+m+1>>1,m=w-m+1>>1,w=b,b=h-g+1>>1,h=h+g+1>>1,g=b,b=p-d+1>>1,p=p+d+1>>1,d=b,b=v*i+w*r+2048>>12,v=v*r-w*i+2048>>12,w=b,b=m*n+_*t+2048>>12,m=m*t-_*n+2048>>12,_=b,k[0+S]=h+w,k[56+S]=h-w,k[8+S]=p+_,k[48+S]=p-_,k[16+S]=d+m,k[40+S]=d-m,k[24+S]=g+v,k[32+S]=g-v):(b=s*f[y+0]+8192>>14,k[0+S]=b,k[8+S]=b,k[16+S]=b,k[24+S]=b,k[32+S]=b,k[40+S]=b,k[48+S]=b,k[56+S]=b)}for(y=0;y<64;++y){var A=128+(k[y]+8>>4);c[y]=A<0?0:A>255?255:A}}for(var w=0;w255?255:e}return l.prototype={load:function(e){var t=new XMLHttpRequest;t.open("GET",e,!0),t.responseType="arraybuffer",t.onload=function(){var e=new Uint8Array(t.response||t.mozResponseArrayBuffer);this.parse(e),this.onload&&this.onload()}.bind(this),t.send(null)},parse:function(t){var n=0;t.length;function r(){var e=t[n]<<8|t[n+1];return n+=2,e}function i(){var e=r(),i=t.subarray(n,n+e-2);return n+=i.length,i}function a(e){var t,n,r=0,i=0;for(n in e.components)e.components.hasOwnProperty(n)&&(r<(t=e.components[n]).h&&(r=t.h),i>4==0)for(_=0;_<64;_++){x[e[_]]=t[n++]}else{if(y>>4!=1)throw"DQT: invalid table spec";for(_=0;_<64;_++){x[e[_]]=r()}}p[15&y]=x}break;case 65472:case 65473:case 65474:r(),(o={}).extended=65473===m,o.progressive=65474===m,o.precision=t[n++],o.scanLines=r(),o.samplesPerLine=r(),o.components={},o.componentsOrder=[];var k,E=t[n++];for(P=0;P>4,A=15&t[n+1],T=t[n+2];o.componentsOrder.push(k),o.components[k]={h:S,v:A,quantizationTable:p[T]},n+=3}a(o),d.push(o);break;case 65476:var M=r();for(P=2;P>4==0?v:g)[15&I]=c(j,L)}break;case 65501:r(),s=r();break;case 65498:r();var B=t[n++],C=[];for(P=0;P>4],U.huffmanTableAC=g[15&O],C.push(U)}var z=t[n++],D=t[n++],F=t[n++],N=f(t,n,o,C,s,z,D,F>>4,15&F);n+=N;break;default:if(255==t[n-3]&&t[n-2]>=192&&t[n-2]<=254){n-=3;break}throw"unknown JPEG marker "+m.toString(16)}m=r()}if(1!=d.length)throw"only single frame JPEGs supported";this.width=o.samplesPerLine,this.height=o.scanLines,this.jfif=u,this.adobe=l,this.components=[];for(var P=0;P=0;)t&1<>8&255),O(255&e)}function D(e,t,n,r,i){var a,o=i[0],s=i[240];for(var u=function(e,t){var n,r,i,a,o,s,u,l,c,f,h=0;for(c=0;c<8;++c){n=e[h],r=e[h+1],i=e[h+2],a=e[h+3],o=e[h+4],s=e[h+5],u=e[h+6];var p=n+(l=e[h+7]),g=n-l,v=r+u,m=r-u,_=i+s,w=i-s,b=a+o,y=a-o,x=p+b,k=p-b,E=v+_,S=v-_;e[h]=x+E,e[h+4]=x-E;var A=.707106781*(S+k);e[h+2]=k+A,e[h+6]=k-A;var T=.382683433*((x=y+w)-(S=m+g)),M=.5411961*x+T,I=1.306562965*S+T,j=.707106781*(E=w+m),R=g+j,L=g-j;e[h+5]=L+M,e[h+3]=L-M,e[h+1]=R+I,e[h+7]=R-I,h+=8}for(h=0,c=0;c<8;++c){n=e[h],r=e[h+8],i=e[h+16],a=e[h+24],o=e[h+32],s=e[h+40],u=e[h+48];var B=n+(l=e[h+56]),C=n-l,O=r+u,z=r-u,D=i+s,F=i-s,N=a+o,P=a-o,U=B+N,q=B-N,V=O+D,Z=O-D;e[h]=U+V,e[h+32]=U-V;var W=.707106781*(Z+q);e[h+16]=q+W,e[h+48]=q-W;var G=.382683433*((U=P+F)-(Z=z+C)),H=.5411961*U+G,Y=1.306562965*Z+G,$=.707106781*(V=F+z),X=C+$,J=C-$;e[h+40]=J+H,e[h+24]=J-H,e[h+8]=X+Y,e[h+56]=X-Y,h++}for(c=0;c<64;++c)f=e[c]*t[c],d[c]=f>0?f+.5|0:f-.5|0;return d}(e,t),l=0;l<64;++l)g[E[l]]=u[l];var c=g[0]-n;n=g[0],0==c?C(r[0]):(C(r[p[a=32767+c]]),C(h[a]));for(var f=63;f>0&&0==g[f];f--);if(0==f)return C(o),n;for(var v,m=1;m<=f;){for(var _=m;0==g[m]&&m<=f;++m);var w=m-_;if(w>=16){v=w>>4;for(var b=1;b<=v;++b)C(s);w&=15}a=32767+g[m],C(i[(w<<4)+p[a]]),C(h[a]),m++}return 63!=f&&C(o),n}function F(e){if(e<=0&&(e=1),e>100&&(e=100),o!=e){(function(e){for(var t=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],n=0;n<64;n++){var r=s((t[n]*e+50)/100);r<1?r=1:r>255&&(r=255),u[E[n]]=r}for(var i=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],a=0;a<64;a++){var o=s((i[a]*e+50)/100);o<1?o=1:o>255&&(o=255),l[E[a]]=o}for(var h=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],p=0,d=0;d<8;d++)for(var g=0;g<8;g++)c[p]=1/(u[E[p]]*h[d]*h[g]*8),f[p]=1/(l[E[p]]*h[d]*h[g]*8),p++})(e<50?Math.floor(5e3/e):Math.floor(200-2*e)),o=e}}this.encode=function(t,o){(new Date).getTime();o&&F(o),v=new Array,m=0,_=7,z(65496),z(65504),z(16),O(74),O(70),O(73),O(70),O(0),O(1),O(1),O(0),z(1),z(1),O(0),O(0),function(){z(65499),z(132),O(0);for(var e=0;e<64;e++)O(u[e]);O(1);for(var t=0;t<64;t++)O(l[t])}(),function(e,t){z(65472),z(17),O(8),z(t),z(e),O(3),O(1),O(17),O(0),O(2),O(17),O(1),O(3),O(17),O(1)}(t.width,t.height),function(){z(65476),z(418),O(0);for(var e=0;e<16;e++)O(S[e+1]);for(var t=0;t<=11;t++)O(A[t]);O(16);for(var n=0;n<16;n++)O(T[n+1]);for(var r=0;r<=161;r++)O(M[r]);O(1);for(var i=0;i<16;i++)O(I[i+1]);for(var a=0;a<=11;a++)O(j[a]);O(17);for(var o=0;o<16;o++)O(R[o+1]);for(var s=0;s<=161;s++)O(L[s])}(),z(65498),z(12),O(3),O(1),O(0),O(2),O(17),O(3),O(17),O(0),O(63),O(0);var s=0,h=0,p=0;m=0,_=7,this.encode.displayName="_encode_";for(var d,g,x,E,B,N,P,U,q,V=t.data,Z=t.width,W=t.height,G=4*Z,H=0;H>3)*G+(P=4*(7&q)),H+U>=W&&(N-=G*(H+1+U-W)),d+P>=G&&(N-=d+P-G+4),g=V[N++],x=V[N++],E=V[N++],w[q]=(k[g]+k[x+256>>0]+k[E+512>>0]>>16)-128,b[q]=(k[g+768>>0]+k[x+1024>>0]+k[E+1280>>0]>>16)-128,y[q]=(k[g+1280>>0]+k[x+1536>>0]+k[E+1792>>0]>>16)-128;s=D(w,c,s,n,i),h=D(b,f,h,r,a),p=D(y,f,p,r,a),d+=32}H+=8}if(_>=0){var Y=[];Y[1]=_+1,Y[0]=(1<<_+1)-1,C(Y)}return z(65497),new e(v)},function(){(new Date).getTime();t||(t=50),function(){for(var e=String.fromCharCode,t=0;t<256;t++)x[t]=e(t)}(),n=B(S,A),r=B(I,j),i=B(T,M),a=B(R,L),function(){for(var e=1,t=2,n=1;n<=15;n++){for(var r=e;r>0]=38470*e,k[e+512>>0]=7471*e+32768,k[e+768>>0]=-11059*e,k[e+1024>>0]=-21709*e,k[e+1280>>0]=32768*e+8421375,k[e+1536>>0]=-27439*e,k[e+1792>>0]=-5329*e}(),F(t),(new Date).getTime()}()}t.exports=function(e,t){void 0===t&&(t=50);return{data:new n(t).encode(e,t),width:e.width,height:e.height}}}).call(this,e("buffer").Buffer)},{buffer:4}],111:[function(e,t,n){(function(n){"use strict";var r=e("contentstream"),i=e("gif-encoder"),a=e("jpeg-js"),o=e("pngjs-nozlib").PNG,s=e("ndarray"),u=e("ndarray-ops"),l=e("through");function c(e,t,n){if(4===e.shape.length)return c(e.pick(n),t,0);if(3===e.shape.length)if(3===e.shape[2])u.assign(s(t,[e.shape[0],e.shape[1],3],[4,4*e.shape[0],1]),e),u.assigns(s(t,[e.shape[0]*e.shape[1]],[4],3),255);else if(4===e.shape[2])u.assign(s(t,[e.shape[0],e.shape[1],4],[4,4*e.shape[0],1]),e);else{if(1!==e.shape[2])return new Error("Incompatible array shape");u.assign(s(t,[e.shape[0],e.shape[1],3],[4,4*e.shape[0],1]),s(e.data,[e.shape[0],e.shape[1],3],[e.stride[0],e.stride[1],0],e.offset)),u.assigns(s(t,[e.shape[0]*e.shape[1]],[4],3),255)}else{if(2!==e.shape.length)return new Error("Incompatible array shape");u.assign(s(t,[e.shape[0],e.shape[1],3],[4,4*e.shape[0],1]),s(e.data,[e.shape[0],e.shape[1],3],[e.stride[0],e.stride[1],0],e.offset)),u.assigns(s(t,[e.shape[0]*e.shape[1]],[4],3),255)}return t}function f(e){var t=l();return t.emit("error",e),t}t.exports=function(e,t,s){switch(s=s||{},t.toUpperCase()){case"JPG":case".JPG":case"JPEG":case".JPEG":case"JPE":case".JPE":var u=e.shape[0],l=e.shape[1],h={data:g=c(e,g=new n(u*l*4)),width:u,height:l},p=a.encode(h,s.quality);return new r(p.data);case"GIF":case".GIF":var d=4===e.shape.length?e.shape[0]:1,g=(u=4===e.shape.length?e.shape[1]:e.shape[0],l=4===e.shape.length?e.shape[2]:e.shape[1],new n(u*l*4)),v=new i(u,l);v.writeHeader();for(var m=0;m0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===l.prototype||(t=function(e){return l.from(e)}(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):y(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?y(e,o,t,!1):A(e,o)):y(e,o,t,!1))):r||(o.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=x?e=x:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function E(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(p("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(S,e):S(e))}function S(e){p("emit readable"),e.emit("readable"),j(e)}function A(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(T,e,t))}function T(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;ea.length?a.length:e;if(o===a.length?i+=a:i+=a.slice(0,e),0===(e-=o)){o===a.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=a.slice(o));break}++r}return t.length-=r,i}(e,t):function(e,t){var n=l.allocUnsafe(e),r=t.head,i=1;r.data.copy(n),e-=r.data.length;for(;r=r.next;){var a=r.data,o=e>a.length?a.length:e;if(a.copy(n,n.length-e,0,o),0===(e-=o)){o===a.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=a.slice(o));break}++i}return t.length-=i,n}(e,t);return r}(e,t.buffer,t.decoder),n);var n}function L(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(B,t,e))}function B(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function C(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return p("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?L(this):E(this),null;if(0===(e=k(e,t))&&t.ended)return 0===t.length&&L(this),null;var r,i=t.needReadable;return p("need readable",i),(0===t.length||t.length-e0?R(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&L(this)),null!==r&&this.emit("data",r),r},w.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},w.prototype.pipe=function(e,t){var r=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=e;break;case 1:a.pipes=[a.pipes,e];break;default:a.pipes.push(e)}a.pipesCount+=1,p("pipe count=%d opts=%j",a.pipesCount,t);var u=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?c:w;function l(t,n){p("onunpipe"),t===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,p("cleanup"),e.removeListener("close",m),e.removeListener("finish",_),e.removeListener("drain",f),e.removeListener("error",v),e.removeListener("unpipe",l),r.removeListener("end",c),r.removeListener("end",w),r.removeListener("data",g),h=!0,!a.awaitDrain||e._writableState&&!e._writableState.needDrain||f())}function c(){p("onend"),e.end()}a.endEmitted?i.nextTick(u):r.once("end",u),e.on("unpipe",l);var f=function(e){return function(){var t=e._readableState;p("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&s(e,"data")&&(t.flowing=!0,j(e))}}(r);e.on("drain",f);var h=!1;var d=!1;function g(t){p("ondata"),d=!1,!1!==e.write(t)||d||((1===a.pipesCount&&a.pipes===e||a.pipesCount>1&&-1!==C(a.pipes,e))&&!h&&(p("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,d=!0),r.pause())}function v(t){p("onerror",t),w(),e.removeListener("error",v),0===s(e,"error")&&e.emit("error",t)}function m(){e.removeListener("finish",_),w()}function _(){p("onfinish"),e.removeListener("close",m),w()}function w(){p("unpipe"),r.unpipe(e)}return r.on("data",g),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",v),e.once("close",m),e.once("finish",_),e.emit("pipe",r),a.flowing||(p("pipe resume"),r.resume()),e},w.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var a=0;a-1?i:a.nextTick;_.WritableState=m;var l=e("core-util-is");l.inherits=e("inherits");var c={deprecate:e("util-deprecate")},f=e("./internal/streams/stream"),h=e("safe-buffer").Buffer,p=r.Uint8Array||function(){};var d,g=e("./internal/streams/destroy");function v(){}function m(t,n){s=s||e("./_stream_duplex"),t=t||{};var r=n instanceof s;this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var i=t.highWaterMark,l=t.writableHighWaterMark,c=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(l||0===l)?l:c,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var f=!1===t.decodeStrings;this.decodeStrings=!f,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,i){--t.pendingcb,n?(a.nextTick(i,r),a.nextTick(E,e,t),e._writableState.errorEmitted=!0,e.emit("error",r)):(i(r),e._writableState.errorEmitted=!0,e.emit("error",r),E(e,t))}(e,n,r,t,i);else{var o=x(n);o||n.corked||n.bufferProcessing||!n.bufferedRequest||y(e,n),r?u(b,e,n,o,i):b(e,n,o,i)}}(n,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function _(t){if(s=s||e("./_stream_duplex"),!(d.call(_,this)||this instanceof s))return new _(t);this._writableState=new m(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),f.call(this)}function w(e,t,n,r,i,a,o){t.writelen=r,t.writecb=o,t.writing=!0,t.sync=!0,n?e._writev(i,t.onwrite):e._write(i,a,t.onwrite),t.sync=!1}function b(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),E(e,t)}function y(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,i=new Array(r),a=t.corkedRequestsFree;a.entry=n;for(var s=0,u=!0;n;)i[s]=n,n.isBuf||(u=!1),n=n.next,s+=1;i.allBuffers=u,w(e,t,!0,t.length,i,"",a.finish),t.pendingcb++,t.lastBufferedRequest=null,a.next?(t.corkedRequestsFree=a.next,a.next=null):t.corkedRequestsFree=new o(t),t.bufferedRequestCount=0}else{for(;n;){var l=n.chunk,c=n.encoding,f=n.callback;if(w(e,t,!1,t.objectMode?1:l.length,l,c,f),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function x(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function k(e,t){e._final(function(n){t.pendingcb--,n&&e.emit("error",n),t.prefinished=!0,e.emit("prefinish"),E(e,t)})}function E(e,t){var n=x(t);return n&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,a.nextTick(k,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),n}l.inherits(_,f),m.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(m.prototype,"buffer",{get:c.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(d=Function.prototype[Symbol.hasInstance],Object.defineProperty(_,Symbol.hasInstance,{value:function(e){return!!d.call(this,e)||this===_&&(e&&e._writableState instanceof m)}})):d=function(e){return e instanceof this},_.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},_.prototype.write=function(e,t,n){var r,i=this._writableState,o=!1,s=!i.objectMode&&(r=e,h.isBuffer(r)||r instanceof p);return s&&!h.isBuffer(e)&&(e=function(e){return h.from(e)}(e)),"function"==typeof t&&(n=t,t=null),s?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof n&&(n=v),i.ended?function(e,t){var n=new Error("write after end");e.emit("error",n),a.nextTick(t,n)}(this,n):(s||function(e,t,n,r){var i=!0,o=!1;return null===n?o=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(e.emit("error",o),a.nextTick(r,o),i=!1),i}(this,i,e,n))&&(i.pendingcb++,o=function(e,t,n,r,i,a){if(!n){var o=function(e,t,n){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n));return t}(t,r,i);r!==o&&(n=!0,i="buffer",r=o)}var s=t.objectMode?1:r.length;t.length+=s;var u=t.length-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(e,t,n){t.ending=!0,E(e,t),n&&(t.finished?a.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("timers").setImmediate)},{"./_stream_duplex":114,"./internal/streams/destroy":120,"./internal/streams/stream":121,_process:98,"core-util-is":8,inherits:57,"process-nextick-args":97,"safe-buffer":107,timers:128,"util-deprecate":133}],119:[function(e,t,n){"use strict";var r=e("safe-buffer").Buffer,i=e("util");t.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},e.prototype.concat=function(e){if(0===this.length)return r.alloc(0);if(1===this.length)return this.head.data;for(var t,n,i,a=r.allocUnsafe(e>>>0),o=this.head,s=0;o;)t=o.data,n=a,i=s,t.copy(n,i),s+=o.data.length,o=o.next;return a},e}(),i&&i.inspect&&i.inspect.custom&&(t.exports.prototype[i.inspect.custom]=function(){var e=i.inspect({length:this.length});return this.constructor.name+" "+e})},{"safe-buffer":107,util:3}],120:[function(e,t,n){"use strict";var r=e("process-nextick-args");function i(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var n=this,a=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return a||o?(t?t(e):!e||this._writableState&&this._writableState.errorEmitted||r.nextTick(i,this,e),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?(r.nextTick(i,n,e),n._writableState&&(n._writableState.errorEmitted=!0)):t&&t(e)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},{"process-nextick-args":97}],121:[function(e,t,n){t.exports=e("events").EventEmitter},{events:43}],122:[function(e,t,n){t.exports=e("./readable").PassThrough},{"./readable":123}],123:[function(e,t,n){(n=t.exports=e("./lib/_stream_readable.js")).Stream=n,n.Readable=n,n.Writable=e("./lib/_stream_writable.js"),n.Duplex=e("./lib/_stream_duplex.js"),n.Transform=e("./lib/_stream_transform.js"),n.PassThrough=e("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":114,"./lib/_stream_passthrough.js":115,"./lib/_stream_readable.js":116,"./lib/_stream_transform.js":117,"./lib/_stream_writable.js":118}],124:[function(e,t,n){t.exports=e("./readable").Transform},{"./readable":123}],125:[function(e,t,n){t.exports=e("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":118}],126:[function(e,t,n){"use strict";var r=e("safe-buffer").Buffer,i=r.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){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!0;default:return!1}};function a(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(r.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=u,this.end=l,t=4;break;case"utf8":this.fillLast=s,t=4;break;case"base64":this.text=c,this.end=f,t=3;break;default:return this.write=h,void(this.end=p)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(t)}function o(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function s(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function u(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function l(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function c(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function f(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function h(e){return e.toString(this.encoding)}function p(e){return e&&e.length?this.write(e):""}n.StringDecoder=a,a.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0)return i>0&&(e.lastNeed=i-1),i;if(--r=0)return i>0&&(e.lastNeed=i-2),i;if(--r=0)return i>0&&(2===i?i=0:e.lastNeed=i-3),i;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)},a.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},{"safe-buffer":107}],127:[function(e,t,n){(function(n){var r=e("stream");function i(e,t,i){e=e||function(e){this.queue(e)},t=t||function(){this.queue(null)};var a=!1,o=!1,s=[],u=!1,l=new r;function c(){for(;s.length&&!l.paused;){var e=s.shift();if(null===e)return l.emit("end");l.emit("data",e)}}return l.readable=l.writable=!0,l.paused=!1,l.autoDestroy=!(i&&!1===i.autoDestroy),l.write=function(t){return e.call(this,t),!l.paused},l.queue=l.push=function(e){return u?l:(null===e&&(u=!0),s.push(e),c(),l)},l.on("end",function(){l.readable=!1,!l.writable&&l.autoDestroy&&n.nextTick(function(){l.destroy()})}),l.end=function(e){if(!a)return a=!0,arguments.length&&l.write(e),l.writable=!1,t.call(l),!l.readable&&l.autoDestroy&&l.destroy(),l},l.destroy=function(){if(!o)return o=!0,a=!0,s.length=0,l.writable=l.readable=!1,l.emit("close"),l},l.pause=function(){if(!l.paused)return l.paused=!0,l},l.resume=function(){return l.paused&&(l.paused=!1,l.emit("resume")),c(),l.paused||l.emit("drain"),l},l}t.exports=i,i.through=i}).call(this,e("_process"))},{_process:98,stream:112}],128:[function(e,t,n){(function(t,r){var i=e("process/browser.js").nextTick,a=Function.prototype.apply,o=Array.prototype.slice,s={},u=0;function l(e,t){this._id=e,this._clearFn=t}n.setTimeout=function(){return new l(a.call(setTimeout,window,arguments),clearTimeout)},n.setInterval=function(){return new l(a.call(setInterval,window,arguments),clearInterval)},n.clearTimeout=n.clearInterval=function(e){e.close()},l.prototype.unref=l.prototype.ref=function(){},l.prototype.close=function(){this._clearFn.call(window,this._id)},n.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},n.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},n._unrefActive=n.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},n.setImmediate="function"==typeof t?t:function(e){var t=u++,r=!(arguments.length<2)&&o.call(arguments,1);return s[t]=!0,i(function(){s[t]&&(r?e.apply(null,r):e.call(null),n.clearImmediate(t))}),t},n.clearImmediate="function"==typeof r?r:function(e){delete s[e]}}).call(this,e("timers").setImmediate,e("timers").clearImmediate)},{"process/browser.js":98,timers:128}],129:[function(e,t,n){n.isatty=function(){return!1},n.ReadStream=function(){throw new Error("tty.ReadStream is not implemented")},n.WriteStream=function(){throw new Error("tty.WriteStream is not implemented")}},{}],130:[function(e,t,n){(function(t,r){"use strict";var i=e("bit-twiddle"),a=e("dup");t.__TYPEDARRAY_POOL||(t.__TYPEDARRAY_POOL={UINT8:a([32,0]),UINT16:a([32,0]),UINT32:a([32,0]),INT8:a([32,0]),INT16:a([32,0]),INT32:a([32,0]),FLOAT:a([32,0]),DOUBLE:a([32,0]),DATA:a([32,0]),UINT8C:a([32,0]),BUFFER:a([32,0])});var o="undefined"!=typeof Uint8ClampedArray,s=t.__TYPEDARRAY_POOL;s.UINT8C||(s.UINT8C=a([32,0])),s.BUFFER||(s.BUFFER=a([32,0]));var u=s.DATA,l=s.BUFFER;function c(e){if(e){var t=e.length||e.byteLength,n=i.log2(t);u[n].push(e)}}function f(e){e=i.nextPow2(e);var t=i.log2(e),n=u[t];return n.length>0?n.pop():new ArrayBuffer(e)}function h(e){return new Uint8Array(f(e),0,e)}function p(e){return new Uint16Array(f(2*e),0,e)}function d(e){return new Uint32Array(f(4*e),0,e)}function g(e){return new Int8Array(f(e),0,e)}function v(e){return new Int16Array(f(2*e),0,e)}function m(e){return new Int32Array(f(4*e),0,e)}function _(e){return new Float32Array(f(4*e),0,e)}function w(e){return new Float64Array(f(8*e),0,e)}function b(e){return o?new Uint8ClampedArray(f(e),0,e):h(e)}function y(e){return new DataView(f(e),0,e)}function x(e){e=i.nextPow2(e);var t=i.log2(e),n=l[t];return n.length>0?n.pop():new r(e)}n.free=function(e){if(r.isBuffer(e))l[i.log2(e.length)].push(e);else{if("[object ArrayBuffer]"!==Object.prototype.toString.call(e)&&(e=e.buffer),!e)return;var t=e.length||e.byteLength,n=0|i.log2(t);u[n].push(e)}},n.freeUint8=n.freeUint16=n.freeUint32=n.freeInt8=n.freeInt16=n.freeInt32=n.freeFloat32=n.freeFloat=n.freeFloat64=n.freeDouble=n.freeUint8Clamped=n.freeDataView=function(e){c(e.buffer)},n.freeArrayBuffer=c,n.freeBuffer=function(e){l[i.log2(e.length)].push(e)},n.malloc=function(e,t){if(void 0===t||"arraybuffer"===t)return f(e);switch(t){case"uint8":return h(e);case"uint16":return p(e);case"uint32":return d(e);case"int8":return g(e);case"int16":return v(e);case"int32":return m(e);case"float":case"float32":return _(e);case"double":case"float64":return w(e);case"uint8_clamped":return b(e);case"buffer":return x(e);case"data":case"dataview":return y(e);default:return null}return null},n.mallocArrayBuffer=f,n.mallocUint8=h,n.mallocUint16=p,n.mallocUint32=d,n.mallocInt8=g,n.mallocInt16=v,n.mallocInt32=m,n.mallocFloat32=n.mallocFloat=_,n.mallocFloat64=n.mallocDouble=w,n.mallocUint8Clamped=b,n.mallocDataView=y,n.mallocBuffer=x,n.clearCache=function(){for(var e=0;e<32;++e)s.UINT8[e].length=0,s.UINT16[e].length=0,s.UINT32[e].length=0,s.INT8[e].length=0,s.INT16[e].length=0,s.INT32[e].length=0,s.FLOAT[e].length=0,s.DOUBLE[e].length=0,s.UINT8C[e].length=0,u[e].length=0,l[e].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer)},{"bit-twiddle":2,buffer:4,dup:14}],131:[function(e,t,n){"use strict";t.exports=function(e,t,n){return 0===e.length?e:t?(n||e.sort(t),function(e,t){for(var n=1,r=e.length,i=e[0],a=e[0],o=1;o=o?u+1:o}r.mkdir(t+"sequencer"+o,function(){var a=t+"sequencer"+o+"/";for(var s in n.images){var u=n.images[s].steps;if(i){var l=u.slice(-1)[0].output.src,c=u.slice(-1)[0].output.format,f=e("data-uri-to-buffer")(l);r.writeFile(a+s+"_"+(u.length-1)+"."+c,f,function(){})}else for(var h in u){l=u[h].output.src,c=u[h].output.format,f=e("data-uri-to-buffer")(l);r.writeFile(a+s+"_"+h+"."+c,f,function(){})}}})},r.readdir(c,function(e,t){var n=[];if(void 0===t||0==t.length)return f(n),[];for(var i=0;i0&&(thisStep=c[e].steps[t],thisStep.UI.onRemove(thisStep.options.step),c[e].steps.splice(t,1))}function g(){var t=[],n=this;for(var r in arguments)t.push(a(arguments[r]));var i=l.call(this,t,"l");f.push({method:"loadImages",json_q:a(i)});var o=this.copy(i.loadedimages),s={name:"ImageSequencer Wrapper",sequencer:this,addSteps:this.addSteps,removeSteps:this.removeSteps,insertSteps:this.insertSteps,run:this.run,UI:this.UI,setUI:this.setUI,images:o};!function t(r){if(r!=o.length){var a=o[r];e("./ui/LoadImage")(n,a,i.images[a],function(){t(++r)})}else i.callback.call(s)}(0)}function v(e){var t={};if("load-image"==e)return{};if(0==arguments.length){for(var n in this.modules)t[n]=s[n][1];for(var r in this.sequences)t[r]={name:r,steps:u[r]}}else t=s[e]?s[e][1]:{inputs:u[e].options};return t}function m(e){let t=a(v(e.options.name).inputs);t=t||{};for(let n in t)t[n]=e.options[n]||t[n].default,t[n]=encodeURIComponent(t[n]);var n=Object.keys(t).map(e=>e+":"+t[e]).join("|");return`${e.options.name}{${n}}`}function _(e){let t;return(t=e.includes(",")?e.split(","):[e]).map(w)}function w(e){var t;if(t=e.includes("{")?e.includes("(")&&e.indexOf("(")=t.images[u].steps.length?{options:{name:void 0}}:t.images[u].steps.slice(f+e)[0]},t.images[u].steps[f].getIndex=function(){return f},r)r.hasOwnProperty(p)&&(t.images[u].steps[f][p]=r[p]);t.images[u].steps[f].UI.onDraw(t.images[u].steps[f].options.step);var d=e("./RunToolkit")(t.copy(h));t.images[u].steps[f].draw(d,function(){t.images[u].steps[f].options.step.output=t.images[u].steps[f].output.src,t.images[u].steps[f].UI.onComplete(t.images[u].steps[f].options.step),n(a,++s)},o)}}(s,a)}(n=function(e){for(var n in e)0==e[n]&&1==t.images[n].steps.length?delete e[n]:0==e[n]&&e[n]++;for(var n in e)for(var r=t.images[n].steps[e[n]-1];void 0===r||void 0===r.output;)r=t.images[n].steps[--e[n]-1];return e}(n))}},{"./RunToolkit":144,"./util/getStep.js":212}],144:[function(e,t,n){const r=e("get-pixels"),i=e("./modules/_nomodule/PixelManipulation"),a=e("lodash"),o=e("data-uri-to-buffer"),s=e("save-pixels");t.exports=function(e){return e.getPixels=r,e.pixelManipulation=i,e.lodash=a,e.dataUriToBuffer=o,e.savePixels=s,e}},{"./modules/_nomodule/PixelManipulation":207,"data-uri-to-buffer":13,"get-pixels":23,lodash:62,"save-pixels":111}],145:[function(e,t,n){t.exports={sample:[{name:"invert",options:{}},{name:"channel",options:{channel:"red"}},{name:"blur",options:{blur:"5"}}]}},{}],146:[function(e,t,n){t.exports=function(t,n){return t.blur=t.blur||2,t.step.metadata=t.step.metadata||{},{options:t,draw:function(n,r,i){i.stop(!0),i.overrideFlag=!0;var a=this;return e("../_nomodule/PixelManipulation.js")(n,{output:function(e,t,n){a.output={src:t,format:n}},changePixel:function(e,t,n,r){return[e,t,n,r]},extraManipulation:function(e){for(var n=[0,0,0,0],r=0;rAverages (r, g, b, a): "+n.join(", ")+"

"),e},format:n.format,image:t.image,callback:r})},output:void 0,UI:n}}},{"../_nomodule/PixelManipulation.js":207}],147:[function(e,t,n){t.exports=[e("./Module"),e("./info.json")]},{"./Module":146,"./info.json":148}],148:[function(e,t,n){t.exports={name:"Average",description:"Average all pixel color",inputs:{}}},{}],149:[function(require,module,exports){module.exports=function Dynamic(options,UI,util){var output;function draw(input,callback,progressObj){progressObj.stop(!0),progressObj.overrideFlag=!0;var step=this;"string"==typeof options.func&&eval("options.func = "+options.func);var getPixels=require("get-pixels"),priorStep=this.getStep(-2);getPixels(priorStep.output.src,function(e,t){return options.firstImagePixels=t,require("../_nomodule/PixelManipulation.js")(input,{output:function(e,t,n){step.output={src:t,format:n}},changePixel:function(e,t,n,r,i,a){var o=options.firstImagePixels;return options.func(e,t,n,r,o.get(i,a,0),o.get(i,a,1),o.get(i,a,2),o.get(i,a,3))},format:input.format,image:options.image,inBrowser:options.inBrowser,callback:callback})})}return options.func=options.func||"function(r1, g1, b1, a1, r2, g2, b2, a2) { return [ r1, g2, b2, a2 ] }",{options:options,draw:draw,output:output,UI:UI}}},{"../_nomodule/PixelManipulation.js":207,"get-pixels":23}],150:[function(e,t,n){arguments[4][147][0].apply(n,arguments)},{"./Module":149,"./info.json":151,dup:147}],151:[function(e,t,n){t.exports={name:"Blend",description:"Blend the past two image steps with the given function. Defaults to using the red channel from image 1 and the green and blue and alpha channels of image 2. Easier to use interfaces coming soon!",inputs:{blend:{type:"input",desc:"Function to use to blend the two images.",default:"function(r1, g1, b1, a1, r2, g2, b2, a2) { return [ r1, g2, b2, a2 ] }"}}}},{}],152:[function(e,t,n){t.exports=function(e,t){let n=[[2/159,4/159,5/159,4/159,2/159],[4/159,9/159,12/159,9/159,4/159],[5/159,12/159,15/159,12/159,5/159],[4/159,9/159,12/159,9/159,4/159],[2/159,4/159,5/159,4/159,2/159]],r=e;n=function(e){let t=[];for(let n=e.length-1;n>=0;n--){let r=[];for(let t=e[n].length-1;t>=0;t--)r.push(e[n][t]);t.push(r)}return t}(n);for(let t=0;tg;n=0<=g?++c:--c)r[n]=(t-i)/(a-i)*(u[n]-s[n])+s[n];return r}}t.exports=function(e,t){return t.colormap=t.colormap||i.default,"object"==typeof t.colormap?colormapFunction=r(t.colormap):i.hasOwnProperty(t.colormap)?colormapFunction=i[t.colormap]:colormapFunction=i.default,colormapFunction(e/255)};var i={greyscale:r([[0,[0,0,0],[255,255,255]],[1,[255,255,255],[255,255,255]]]),default:r([[0,[0,0,255],[0,255,0]],[.25,[0,255,0],[255,255,0]],[.5,[0,255,255],[255,255,0]],[.75,[255,255,0],[255,0,0]]]),ndvi:r([[0,[0,0,255],[38,195,195]],[.5,[0,150,0],[255,255,0]],[.75,[255,255,0],[255,50,50]]]),stretched:r([[0,[0,0,255],[0,0,255]],[.1,[0,0,255],[38,195,195]],[.5,[0,150,0],[255,255,0]],[.7,[255,255,0],[255,50,50]],[.9,[255,50,50],[255,50,50]]]),fastie:r([[0,[255,255,255],[0,0,0]],[.167,[0,0,0],[255,255,255]],[.33,[255,255,255],[0,0,0]],[.5,[0,0,0],[140,140,255]],[.55,[140,140,255],[0,255,0]],[.63,[0,255,0],[255,255,0]],[.75,[255,255,0],[255,0,0]],[.95,[255,0,0],[255,0,255]]])}},{}],166:[function(e,t,n){t.exports=function(t,n){return{options:t,draw:function(n,r,i){i.stop(!0),i.overrideFlag=!0;var a=this;return e("../_nomodule/PixelManipulation.js")(n,{output:function(e,t,n){a.output={src:t,format:n}},changePixel:function(n,r,i,a){var o=(n+r+i)/3,s=e("./Colormap")(o,t);return[s[0],s[1],s[2],255]},format:n.format,image:t.image,inBrowser:t.inBrowser,callback:r})},output:void 0,UI:n}}},{"../_nomodule/PixelManipulation.js":207,"./Colormap":165}],167:[function(e,t,n){arguments[4][147][0].apply(n,arguments)},{"./Module":166,"./info.json":168,dup:147}],168:[function(e,t,n){t.exports={name:"Colormap",description:"Maps brightness values (average of red, green & blue) to a given color lookup table, made up of a set of one more color gradients.\n\nFor example, 'cooler' colors like blue could represent low values, while 'hot' colors like red could represent high values.",inputs:{colormap:{type:"select",desc:"Name of the Colormap",default:"default",values:["default","greyscale","stretched","fastie"]}}}},{}],169:[function(e,t,n){(function(n){t.exports=function(t,r,i){var a=e("get-pixels"),o=e("save-pixels");r.x=parseInt(r.x)||0,r.y=parseInt(r.y)||0,a(t.src,function(e,a){r.w=parseInt(r.w)||Math.floor(a.shape[0]),r.h=parseInt(r.h)||Math.floor(a.shape[1]);for(var s=r.x,u=r.y,l=r.w,c=r.h,f=a.shape[0],h=new Uint8Array(4*l*c),p=u;pInfragrammar.",inputs:{red:{type:"input",desc:"Expression to return for red channel with R, G, B, and A inputs",default:"r"},green:{type:"input",desc:"Expression to return for green channel with R, G, B, and A inputs",default:"g"},blue:{type:"input",desc:"Expression to return for blue channel with R, G, B, and A inputs",default:"b"},"monochrome (fallback)":{type:"input",desc:"Expression to return with R, G, B, and A inputs; fallback for other channels if none provided",default:"r + g + b"}}}},{}],180:[function(e,t,n){e("lodash");const r=[[-1,0,1],[-2,0,2],[-1,0,1]],i=[[-1,-2,-1],[0,0,0],[1,2,1]];let a,o=[],s=[],u=[],l=[];function c(e,t,n,a,o){let s=0;for(let t=0;t<3;t++)for(let n=0;n<3;n++){let i=a+t-1,u=o+n-1;s+=e.get(i,u,0)*r[t][n]}let u=0;for(let t=0;t<3;t++)for(let n=0;n<3;n++){let r=a+t-1,s=o+n-1;u+=e.get(r,s,0)*i[t][n]}return{pixel:[t,t,t,Math.sqrt(Math.pow(s,2)+Math.pow(u,2))],angle:Math.atan2(u,s)}}t.exports=function(e,t,n,r){a=!r;for(var i=0;ii?s[t][n]>r?u.push(a):l.push(a):e.set(t,n,3,0)}return u.forEach(t=>e.set(t[0],t[1],3,255)),e}(function(e){o=o.map(e=>e.map(f));for(let t=1;t=-22.5&&r<=22.5||r<-157.5&&r>=-180?s[t][n]>=s[t][n+1]&&s[t][n]>=s[t][n-1]?e.set(t,n,3,s[t][n]):e.set(t,n,3,0):r>=22.5&&r<=67.5||r<-112.5&&r>=-157.5?s[t][n]>=s[t+1][n+1]&&s[t][n]>=s[t-1][n-1]?e.set(t,n,3,s[t][n]):e.set(t,n,3,0):r>=67.5&&r<=112.5||r<-67.5&&r>=-112.5?s[t][t]>=s[t+1][n]&&s[t][n]>=s[t][n]?e.set(t,n,3,s[t][n]):e.set(t,n,3,0):(r>=112.5&&r<=157.5||r<-22.5&&r>=-67.5)&&(s[t][n]>=s[t+1][n-1]&&s[t][n]>=s[t-1][n+1]?e.set(t,n,3,s[t][n]):e.set(t,n,3,0))}return e}(e),0,n)};var f=e=>180*e/Math.PI,h=e=>Math.max(...e.map(e=>e.map(e=>e||0)).map(e=>Math.max(...e)))},{lodash:62}],181:[function(e,t,n){t.exports=function(t,n){return t.blur=t.blur||2,t.highThresholdRatio=t.highThresholdRatio||.2,t.lowThresholdRatio=t.lowThresholdRatio||.15,{options:t,draw:function(n,r,i){i.stop(!0),i.overrideFlag=!0;var a=this;return e("../_nomodule/PixelManipulation.js")(n,{output:function(e,t,n){a.output={src:t,format:n}},changePixel:function(e,t,n,r){return[(e+t+n)/3,(e+t+n)/3,(e+t+n)/3,r]},extraManipulation:function(n){return n=e("ndarray-gaussian-filter")(n,t.blur),e("./EdgeUtils")(n,t.highThresholdRatio,t.lowThresholdRatio,t.inBrowser)},format:n.format,image:t.image,inBrowser:t.inBrowser,callback:r})},output:void 0,UI:n}}},{"../_nomodule/PixelManipulation.js":207,"./EdgeUtils":180,"ndarray-gaussian-filter":67}],182:[function(e,t,n){arguments[4][147][0].apply(n,arguments)},{"./Module":181,"./info.json":183,dup:147}],183:[function(e,t,n){t.exports={name:"Detect Edges",description:"this module detects edges using the Canny method, which first Gaussian blurs the image to reduce noise (amount of blur configurable in settings as `options.blur`), then applies a number of steps to highlight edges, resulting in a greyscale image where the brighter the pixel, the stronger the detected edge. Read more at: https://en.wikipedia.org/wiki/Canny_edge_detector",inputs:{blur:{type:"integer",desc:"amount of gaussian blur(Less blur gives more detail, typically 0-5)",default:2},highThresholdRatio:{type:"float",desc:"The high threshold ratio for the image",default:.2},lowThresholdRatio:{type:"float",desc:"The low threshold value for the image",default:.15}}}},{}],184:[function(e,t,n){t.exports=function(t,n){return e("fisheyegl"),{options:t,draw:function(e,n){var r=this;if(t.inBrowser){if(document.querySelector("#image-sequencer-canvas"))var i=document.querySelector("#image-sequencer-canvas");else(i=document.createElement("canvas")).style.display="none",i.setAttribute("id","image-sequencer-canvas"),document.body.append(i);distorter=FisheyeGl({selector:"#image-sequencer-canvas"}),t.a=parseFloat(t.a)||distorter.lens.a,t.b=parseFloat(t.b)||distorter.lens.b,t.Fx=parseFloat(t.Fx)||distorter.lens.Fx,t.Fy=parseFloat(t.Fy)||distorter.lens.Fy,t.scale=parseFloat(t.scale)||distorter.lens.scale,t.x=parseFloat(t.x)||distorter.fov.x,t.y=parseFloat(t.y)||distorter.fov.y,distorter.lens.a=t.a,distorter.lens.b=t.b,distorter.lens.Fx=t.Fx,distorter.lens.Fy=t.Fy,distorter.lens.scale=t.scale,distorter.fov.x=t.x,distorter.fov.y=t.y,distorter.setImage(e.src,function(){r.output={src:i.toDataURL(),format:e.format},n()})}else this.output=e,n()},output:void 0,UI:n}}},{fisheyegl:15}],185:[function(e,t,n){arguments[4][147][0].apply(n,arguments)},{"./Module":184,"./info.json":186,dup:147}],186:[function(e,t,n){t.exports={name:"Fisheye GL",description:"Correct fisheye, or barrel distortion, in images (with WebGL -- adapted from fisheye-correction-webgl by @bluemir).",requires:["webgl"],inputs:{a:{type:"float",desc:"a parameter",default:1,min:1,max:4},b:{type:"float",desc:"b parameter",default:1,min:1,max:4},Fx:{type:"float",desc:"Fx parameter",default:0,min:0,max:4},Fy:{type:"float",desc:"Fy parameter",default:0,min:0,max:4},scale:{type:"float",desc:"Image Scaling",default:1.5,min:0,max:20},x:{type:"float",desc:"FOV x parameter",default:1.5,min:0,max:20},y:{type:"float",desc:"FOV y parameter",default:1.5,min:0,max:20},fragmentSrc:{type:"PATH",desc:"Patht to a WebGL fragment shader file",default:"(inbuilt)"},vertexSrc:{type:"PATH",desc:"Patht to a WebGL vertex shader file",default:"(inbuilt)"}}}},{}],187:[function(e,t,n){(function(n){t.exports=function(t,r){return{options:t,draw:function(t,r,i){var a=e("get-pixels"),o=e("save-pixels"),s=this;a(t.src,function(e,i){if(e)console.log("Bad Image path");else{for(var a=0,u=0;u

Select or drag in an image to overlay.

';$(e.ui).find(".details").prepend(i),sequencer.setInputStep({dropZoneSelector:"#"+r,fileInputSelector:"#"+r+" .file-input",onLoad:function(t){var n=t.target;e.options.imageUrl=n.result,e.options.url=n.result,sequencer.run(),setUrlHashParameter("steps",sequencer.toString())}}),$(e.ui).find(".btn-save").on("click",function(){var t=$(e.ui).find(".det input").val();e.options.imageUrl=t,sequencer.run()})}}}},{}],192:[function(e,t,n){arguments[4][147][0].apply(n,arguments)},{"./Module":190,"./info.json":193,dup:147}],193:[function(e,t,n){t.exports={name:"Import Image",description:"Import a new image and replace the original with it. Future versions may enable a blend mode. Specify an image by URL or by file selector.",url:"https://github.com/publiclab/image-sequencer/tree/master/MODULES.md",inputs:{url:{type:"string",desc:"URL of image to import",default:"./images/monarch.png"}}}},{}],194:[function(e,t,n){t.exports=function(t,n){if(t.step.inBrowser)var r=e("./Ui.js")(t.step,n);return t.filter=t.filter||"red",{options:t,draw:function(n,i,a){a.stop(!0),a.overrideFlag=!0;var o=this;return e("../_nomodule/PixelManipulation.js")(n,{output:function(e,t,n){o.output={src:t,format:n}},changePixel:function(e,n,r,i){if("red"==t.filter)var a=(r-e)/(1*r+e);"blue"==t.filter&&(a=(e-r)/(1*r+e));var o=255*(a+1)/2;return[o,o,o,i]},format:n.format,image:t.image,inBrowser:t.inBrowser,callback:function(){t.step.inBrowser&&r.setup(),i()}})},output:void 0,UI:n}}},{"../_nomodule/PixelManipulation.js":207,"./Ui.js":195}],195:[function(e,t,n){t.exports=function(e,t){return{setup:function(){var t=$(e.imgElement);t.mousemove(function(e){var n=document.createElement("canvas");n.width=t.width(),n.height=t.height(),n.getContext("2d").drawImage(this,0,0);var r=$(this).offset(),i=e.pageX-r.left,a=e.pageY-r.top,o=n.getContext("2d").getImageData(i,a,1,1).data[0];o=(o=o/127.5-1).toFixed(2),t[0].title="NDVI: "+o})}}}},{}],196:[function(e,t,n){arguments[4][147][0].apply(n,arguments)},{"./Module":194,"./info.json":197,dup:147}],197:[function(e,t,n){t.exports={name:"NDVI",description:"Normalized Difference Vegetation Index, or NDVI, is an image analysis technique used with aerial photography. It's a way to visualize the amounts of infrared and other wavelengths of light reflected from vegetation by comparing ratios of blue and red light absorbed versus green and IR light reflected. NDVI is used to evaluate the health of vegetation in satellite imagery, where it correlates with how much photosynthesis is happening. This is helpful in assessing vegetative health or stress. Read more.

This is designed for use with red-filtered single camera DIY Infragram cameras; change to 'blue' for blue filters",inputs:{filter:{type:"select",desc:"Filter color",default:"red",values:["red","blue"]}}}},{}],198:[function(e,t,n){t.exports=function(){return this.expandSteps([{name:"ndvi",options:{}},{name:"colormap",options:{}}]),{isMeta:!0}}},{}],199:[function(e,t,n){arguments[4][147][0].apply(n,arguments)},{"./Module":198,"./info.json":200,dup:147}],200:[function(e,t,n){t.exports={name:"NDVI-Colormap",description:"Sequentially Applies NDVI and Colormap steps",inputs:{},length:2}},{}],201:[function(e,t,n){t.exports=function(t,n,r){return t.x=t.x||0,t.y=t.y||0,{options:t,draw:function(n,r,i){t.offset=t.offset||-2,i.stop(!0),i.overrideFlag=!0;var a=this,o=this.getStep(t.offset).image,s=this.getOutput(t.offset);e("get-pixels")(n.src,function(n,i){return t.secondImagePixels=i,e("../_nomodule/PixelManipulation.js")(s,{output:function(e,t,n){a.output={src:t,format:n}},changePixel:function(e,n,r,i,a,o){var s=t.secondImagePixels;return a>=t.x&&a=t.y&&o
To work with a new or different image, drag one into the drop zone.",ID:t.options.sequencerCounter++,imageName:e,inBrowser:t.options.inBrowser,ui:t.options.ui},o={src:n,steps:[{options:{id:r.ID,name:"load-image",description:"This initial step loads and displays the original image without any modifications.",title:"Load Image",step:r},UI:t.events,draw:function(){return UI.onDraw(options.step),1==arguments.length?(this.output=a(arguments[0]),options.step.output=this.output,UI.onComplete(options.step),!0):2==arguments.length&&(this.output=a(arguments[0]),options.step.output=this.output,arguments[1](),UI.onComplete(options.step),!0)}}]};a(n,function(n){var r=function(e){return{src:e,format:e.split(":")[1].split(";")[0].split("/")[1]}}(n);t.images[e]=o;var a=t.images[e].steps[0];return a.output=r,a.options.step.output=a.output.src,a.UI.onSetup(a.options.step),a.UI.onDraw(a.options.step),a.UI.onComplete(a.options.step),i(),!0})}(n,r)}},{urify:132}],209:[function(e,t,n){t.exports=function(){return function(e){var t=$(e.dropZoneSelector),n=$(e.fileInputSelector),r=e.onLoad;function i(e){if(e.preventDefault(),e.stopPropagation(),e.target&&e.target.files)var t=e.target.files[0];else t=e.dataTransfer.files[0];if(t){var n=new FileReader;n.onload=r,n.readAsDataURL(t)}}new FileReader,n.on("change",i),t[0].addEventListener("drop",i,!1),t.on("dragover",function(e){e.stopPropagation(),e.preventDefault(),e.dataTransfer.dropEffect="copy"},!1),t.on("dragenter",function(e){t.addClass("hover")}),t.on("dragleave",function(e){t.removeClass("hover")})}}},{}],210:[function(e,t,n){t.exports=function(e={}){return e.onSetup=e.onSetup||function(e){0==e.ui||(e.inBrowser?console.log('Added Step "'+e.name+'" to "'+e.imageName+'".'):console.log("%s",'Added Step "'+e.name+'" to "'+e.imageName+'".'))},e.onDraw=e.onDraw||function(e){0==e.ui||(e.inBrowser?console.log('Drawing Step "'+e.name+'" on "'+e.imageName+'".'):console.log("%s",'Drawing Step "'+e.name+'" on "'+e.imageName+'".'))},e.onComplete=e.onComplete||function(e){0==e.ui||(e.inBrowser?console.log('Drawn Step "'+e.name+'" on "'+e.imageName+'".'):console.log("%s",'Drawn Step "'+e.name+'" on "'+e.imageName+'".'))},e.onRemove=e.onRemove||function(e){0==e.ui||(e.inBrowser?console.log('Removing Step "'+e.name+'" of "'+e.imageName+'".'):console.log("%s",'Removing Step "'+e.name+'" of "'+e.imageName+'".'))},e}},{}],211:[function(e,t,n){t.exports=function(e){var t=void 0;return"jpeg"===(t=(t=function(e){return"data:image"===e.substr(0,10)}(e)?e.split(";")[0].split("/").pop():e.split(".").pop()).toLowerCase())&&(t="jpg"),["jpg","jpeg","png","gif","canvas"].includes(t)?t:"jpg"}},{}],212:[function(e,t,n){t.exports={getPreviousStep:function(){return this.getStep(-1)},getNextStep:function(){return this.getStep(1)},getInput:function(e){return e+this.getIndex()===0&&e++,this.getStep(e-1).output},getOutput:function(e){return this.getStep(e).output},getOptions:function(){return this.getStep(0).options},setOptions:function(e){let t=this.getStep(0).options;for(let n in e)t[n]&&(t[n]=e[n])},getFormat:function(){return this.getStep(-1).output.format},getHeight:function(e){let t=new Image;t.onload=function(){e(t.height)},t.src=this.getInput(0).src},getWidth:function(e){let t=new Image;t.onload=function(){e(t.width)},t.src=this.getInput(0).src}}},{}]},{},[139]); \ No newline at end of file diff --git a/examples/demo.js b/examples/demo.js index 2a18341950..5f080207ff 100644 --- a/examples/demo.js +++ b/examples/demo.js @@ -28,10 +28,10 @@ window.onload = function() { $("#addStep select").on("change", ui.selectNewStepUi); $("#addStep #add-step-btn").on("click", ui.addStepUi); $('#addStep #download-btn').click(function() { - $('img:last()').trigger( "click" ); - + $('img:last()').trigger("click"); + return false; - }); + }); $('body').on('click', 'button.remove', ui.removeStepUi); $('#save-seq').click(() => { sequencer.saveSequence(window.prompt("Please give a name to your sequence..."), sequencer.toString()); @@ -53,12 +53,19 @@ window.onload = function() { }); if ('serviceWorker' in navigator) { - navigator.serviceWorker.register('sw.js',{scope : '/examples/'}) - .then(function(registration) { - console.log('Registration successful, scope is:', registration.scope); - }) - .catch(function(error) { - console.log('Service worker registration failed, error:', error); - }); + navigator.serviceWorker.register('sw.js', { scope: '/examples/' }) + .then(function(registration) { + const installingWorker = registration.installing; + installingWorker.onstatechange = () => { + console.log(installingWorker) + if (installingWorker.state === 'installed') { + location.reload(); + } + } + console.log('Registration successful, scope is:', registration.scope); + }) + .catch(function(error) { + console.log('Service worker registration failed, error:', error); + }); } }; From 88e151a6aa4acf206d2dc6ff1ac482bf81a23190 Mon Sep 17 00:00:00 2001 From: Mridul Aggarwal Date: Fri, 5 Oct 2018 23:08:21 +0530 Subject: [PATCH 7/8] add a button to clear cache --- dist/image-sequencer.js | 6570 +++++++++++++++++------------------ dist/image-sequencer.min.js | 2 +- examples/demo.js | 11 + examples/index.html | 5 +- examples/sw.js | 3 +- 5 files changed, 3302 insertions(+), 3289 deletions(-) diff --git a/dist/image-sequencer.js b/dist/image-sequencer.js index f5ae299809..bbf0eaef33 100644 --- a/dist/image-sequencer.js +++ b/dist/image-sequencer.js @@ -47312,3377 +47312,3377 @@ arguments[4][38][0].apply(exports,arguments) },{"dup":38}],135:[function(require,module,exports){ arguments[4][39][0].apply(exports,arguments) },{"./support/isBuffer":134,"_process":98,"dup":39,"inherits":57}],136:[function(require,module,exports){ -// add steps to the sequencer -function AddStep(_sequencer, image, name, o) { - return require('./InsertStep')(_sequencer,image,-1,name,o); -} -module.exports = AddStep; +// add steps to the sequencer +function AddStep(_sequencer, image, name, o) { + return require('./InsertStep')(_sequencer,image,-1,name,o); +} +module.exports = AddStep; },{"./InsertStep":140}],137:[function(require,module,exports){ -var fs = require('fs'); -var getDirectories = function(rootDir, cb) { - fs.readdir(rootDir, function(err, files) { - var dirs = []; - if (typeof (files) == "undefined" || files.length == 0) { - cb(dirs); - return []; - } - for (var index = 0; index < files.length; ++index) { - var file = files[index]; - if (file[0] !== '.') { - var filePath = rootDir + '/' + file; - fs.stat(filePath, function(err, stat) { - if (stat.isDirectory()) { - dirs.push(this.file); - } - if (files.length === (this.index + 1)) { - return cb(dirs); - } - }.bind({ index: index, file: file })); - } - } - }); -} - -module.exports = function ExportBin(dir = "./output/", ref, basic, filename) { - - // If user did not give an output filename so we can continue without doing anything - dir = (dir[dir.length - 1] == "/") ? dir : dir + "/"; - if (ref.options.inBrowser) return false; - fs.access(dir, function(err) { - if (err) console.error(err) - }); - if (filename && basic) { - for (var image in ref.images) { - var steps = ref.images[image].steps; - var datauri = steps.slice(-1)[0].output.src; - var ext = steps.slice(-1)[0].output.format; - var buffer = require('data-uri-to-buffer')(datauri); - fs.writeFile(dir + filename, buffer, function() { }); - } - } - else { - getDirectories(dir, function(dirs) { - var num = 1; - for (var d in dirs) { - if (dirs[d].match(/^sequencer(.*)$/) == null) continue; - var n = parseInt(dirs[d].match(/^sequencer(.*)$/)[1]); - num = (n >= num) ? (n + 1) : num; - } - fs.mkdir(dir + 'sequencer' + num, function() { - var root = dir + 'sequencer' + num + '/'; - for (var image in ref.images) { - var steps = ref.images[image].steps; - if (basic) { - var datauri = steps.slice(-1)[0].output.src; - var ext = steps.slice(-1)[0].output.format; - var buffer = require('data-uri-to-buffer')(datauri); - fs.writeFile(root + image + "_" + (steps.length - 1) + "." + ext, buffer, function() { }); - } - else { - for (var i in steps) { - var datauri = steps[i].output.src; - var ext = steps[i].output.format; - var buffer = require('data-uri-to-buffer')(datauri); - fs.writeFile(root + image + "_" + i + "." + ext, buffer, function() { }); - } - } - } - }); - }); - } -} +var fs = require('fs'); +var getDirectories = function(rootDir, cb) { + fs.readdir(rootDir, function(err, files) { + var dirs = []; + if (typeof (files) == "undefined" || files.length == 0) { + cb(dirs); + return []; + } + for (var index = 0; index < files.length; ++index) { + var file = files[index]; + if (file[0] !== '.') { + var filePath = rootDir + '/' + file; + fs.stat(filePath, function(err, stat) { + if (stat.isDirectory()) { + dirs.push(this.file); + } + if (files.length === (this.index + 1)) { + return cb(dirs); + } + }.bind({ index: index, file: file })); + } + } + }); +} + +module.exports = function ExportBin(dir = "./output/", ref, basic, filename) { + + // If user did not give an output filename so we can continue without doing anything + dir = (dir[dir.length - 1] == "/") ? dir : dir + "/"; + if (ref.options.inBrowser) return false; + fs.access(dir, function(err) { + if (err) console.error(err) + }); + if (filename && basic) { + for (var image in ref.images) { + var steps = ref.images[image].steps; + var datauri = steps.slice(-1)[0].output.src; + var ext = steps.slice(-1)[0].output.format; + var buffer = require('data-uri-to-buffer')(datauri); + fs.writeFile(dir + filename, buffer, function() { }); + } + } + else { + getDirectories(dir, function(dirs) { + var num = 1; + for (var d in dirs) { + if (dirs[d].match(/^sequencer(.*)$/) == null) continue; + var n = parseInt(dirs[d].match(/^sequencer(.*)$/)[1]); + num = (n >= num) ? (n + 1) : num; + } + fs.mkdir(dir + 'sequencer' + num, function() { + var root = dir + 'sequencer' + num + '/'; + for (var image in ref.images) { + var steps = ref.images[image].steps; + if (basic) { + var datauri = steps.slice(-1)[0].output.src; + var ext = steps.slice(-1)[0].output.format; + var buffer = require('data-uri-to-buffer')(datauri); + fs.writeFile(root + image + "_" + (steps.length - 1) + "." + ext, buffer, function() { }); + } + else { + for (var i in steps) { + var datauri = steps[i].output.src; + var ext = steps[i].output.format; + var buffer = require('data-uri-to-buffer')(datauri); + fs.writeFile(root + image + "_" + i + "." + ext, buffer, function() { }); + } + } + } + }); + }); + } +} },{"data-uri-to-buffer":13,"fs":42}],138:[function(require,module,exports){ -function objTypeOf(object){ - return Object.prototype.toString.call(object).split(" ")[1].slice(0,-1) -} - -function getPrimitive(object){ - return (objTypeOf(object)=='Array')?object[0]:object; -} +function objTypeOf(object){ + return Object.prototype.toString.call(object).split(" ")[1].slice(0,-1) +} + +function getPrimitive(object){ + return (objTypeOf(object)=='Array')?object[0]:object; +} + +function makeArray(input) { + return (objTypeOf(input)=="Array")?input:[input]; +} + +function copy(a) { + if (!typeof(a) == "object") return a; + if (objTypeOf(a) == "Array") return a.slice(); + if (objTypeOf(a) == "Object") { + var b = {}; + for (var v in a) { + b[v] = copy(a[v]); + } + return b; + } + return a; +} + +function formatInput(args,format,images) { + images = []; + for (var image in this.images) { + images.push(image); + } + var json_q = {}; + var format_i = format; + if (format == "+") + format = ['o_string_a', 'string_a', 'o_object']; + else if (format == "-") + format = ['o_string_a', 'number_a']; + else if (format == "^") + format = ['o_string_a', 'number', 'string', 'o_object']; + else if (format == "r") + format = ['o_string_a', 'o_number']; + else if (format == "l") + format = ['o_string','string','o_function']; + + /* + formats: + addSteps :: o_image_a, name_a, o_o + o_string_a, string_a, o_object => { image: [{name,o}] } + removeSteps :: o_image_a, index_a + o_string_a, number_a => { image: [index] } + insertSteps :: o_image_a, index, name, o_o + o_string_a, number, string, o_object => { image: [{index,name,o}] } + run :: o_image_a, o_from + o_string_a, o_number => { image: index } + loadImages :: image, src, o_function + string, string, o_function => { images: [{image:src}], callback } + + optionals: + image: o_string_a + options: o_object + from: o_number + callback: o_function + */ + + if(format[format.length-1] == "o_object") { + if(objTypeOf(args[args.length-1]) != "Object") + args.push({}); + } + else if (format[format.length-1] == "o_number") { + if(typeof(args[args.length-1]) != "number" && objTypeOf(args[0])!="Object") + args.push(1); + } + else if (format[format.length-1] == "o_function") { + if(objTypeOf(args[args.length-1]) != "Function" && objTypeOf(args[0])!="Object") + args.push(function(){}); + } + + if(format[0] == "o_string_a") { + if(args.length == format.length - 1) { + var insert = false; + for (var i in args) { + if (format[parseInt(i)+1].includes( typeof(getPrimitive(args[i])) )){ + insert = true; + } + else {insert = false; break;} + } + if(insert) + args.splice(0,0,copy(images)); + } + } + else if (format[0] == "o_string" && format_i == "l" && args.length == 2) { + if (typeof(args[0]) == "string") { + var identifier = "image"; + var number = 1; + while (this.images.hasOwnProperty(identifier+number)) number++; + args.splice(0,0,identifier+number); + } + } + + if(args.length == format.length) { + for (var i in format) { + if (format[i].substr(format[i].length-2,2)=="_a") + args[i] = makeArray(args[i]); + } + } + + if (args.length == 1) { + json_q = copy(args[0]); + if(!(format_i == "r" || format_i == "l")) { + for (var img in json_q) + json_q[img] = makeArray(json_q[img]); + } + } + else if (format_i == "r") { + for (var img in args[0]) json_q[args[0][img]] = args[1]; + } + else if (format_i == "l") { + json_q = { + images: {}, + callback: args[2] + } + json_q.images[args[0]] = args[1]; + } + else { + for (var img in args[0]) { + var image = args[0][img]; + json_q[image] = []; + + if(format_i == "+") { + for(var s in args[1]) { + json_q[image].push({ + name: args[1][s], + o: args[2] + }); + } + } + + if(format_i == "-") { + json_q[image] = args[1]; + } + + if(format_i == "^") { + var size = this.images[image].steps.length; + var index = args[1]; + index = (index==size)?index:index%size; + if (index<0) index += size+1; + json_q[image].push({ + index: index, + name: args[2], + o: args[3] + }); + } + + } + } + + if(format_i == "l") { + json_q.loadedimages = []; + for (var i in json_q.images) json_q.loadedimages.push(i); + } + + return json_q; + +} +module.exports = formatInput; -function makeArray(input) { - return (objTypeOf(input)=="Array")?input:[input]; -} +},{}],139:[function(require,module,exports){ +if (typeof window !== 'undefined') { isBrowser = true } +else { var isBrowser = false } +require('./util/getStep.js'); + +ImageSequencer = function ImageSequencer(options) { + + var sequencer = (this.name == "ImageSequencer") ? this : this.sequencer; + options = options || {}; + options.inBrowser = options.inBrowser || isBrowser; + options.sequencerCounter = 0; + + function objTypeOf(object) { + return Object.prototype.toString.call(object).split(" ")[1].slice(0, -1) + } + + function log(color, msg) { + if (options.ui != "none") { + if (arguments.length == 1) console.log(arguments[0]); + else if (arguments.length == 2) console.log(color, msg); + } + } + + function copy(a) { + if (!typeof (a) == "object") return a; + if (objTypeOf(a) == "Array") return a.slice(); + if (objTypeOf(a) == "Object") { + var b = {}; + for (var v in a) { + b[v] = copy(a[v]); + } + return b; + } + return a; + } + + function makeArray(input) { + return (objTypeOf(input) == "Array") ? input : [input]; + } + + var image, + steps = [], + modules = require('./Modules'), + sequences = require('./SavedSequences.json'), + formatInput = require('./FormatInput'), + images = {}, + inputlog = [], + events = require('./ui/UserInterface')(), + fs = require('fs'); + + + + if (options.inBrowser) { + for (o in sequencer) { + modules[o] = sequencer[o]; + } + sequences = JSON.parse(window.localStorage.getItem('sequences')); + if (!sequences) { + sequences = {}; + window.localStorage.setItem('sequences', JSON.stringify(sequences)); + } + } + + // if in browser, prompt for an image + // if (options.imageSelect || options.inBrowser) addStep('image-select'); + // else if (options.imageUrl) loadImage(imageUrl); + + function addSteps() { + var this_ = (this.name == "ImageSequencer") ? this : this.sequencer; + var args = (this.name == "ImageSequencer") ? [] : [this.images]; + var json_q = {}; + for (var arg in arguments) { args.push(copy(arguments[arg])); } + json_q = formatInput.call(this_, args, "+"); + + inputlog.push({ method: "addSteps", json_q: copy(json_q) }); + + for (var i in json_q) + for (var j in json_q[i]) + require("./AddStep")(this_, i, json_q[i][j].name, json_q[i][j].o); + + return this; + } + + function removeStep(image, index) { + //remove the step from images[image].steps and redraw remaining images + if (index > 0) { + thisStep = images[image].steps[index]; + thisStep.UI.onRemove(thisStep.options.step); + images[image].steps.splice(index, 1); + } + //tell the UI a step has been removed + } + + function removeSteps(image, index) { + var run = {}, indices; + var this_ = (this.name == "ImageSequencer") ? this : this.sequencer; + var args = (this.name == "ImageSequencer") ? [] : [this.images]; + for (var arg in arguments) args.push(copy(arguments[arg])); + + var json_q = formatInput.call(this_, args, "-"); + inputlog.push({ method: "removeSteps", json_q: copy(json_q) }); + + for (var img in json_q) { + indices = json_q[img].sort(function(a, b) { return b - a }); + run[img] = indices[indices.length - 1]; + for (var i in indices) + removeStep(img, indices[i]); + } + // this.run(run); // This is creating problems + return this; + } + + function insertSteps(image, index, name, o) { + var run = {}; + var this_ = (this.name == "ImageSequencer") ? this : this.sequencer; + var args = (this.name == "ImageSequencer") ? [] : [this.images]; + for (var arg in arguments) args.push(arguments[arg]); + + var json_q = formatInput.call(this_, args, "^"); + inputlog.push({ method: "insertSteps", json_q: copy(json_q) }); + + for (var img in json_q) { + var details = json_q[img]; + details = details.sort(function(a, b) { return b.index - a.index }); + for (var i in details) + require("./InsertStep")(this_, img, details[i].index, details[i].name, details[i].o); + run[img] = details[details.length - 1].index; + } + // this.run(run); // This is Creating issues + return this; + } + + // Config is an object which contains the runtime configuration like progress bar + // information and index from which the sequencer should run + function run(config, t_image, t_from) { + let progressObj, index = 0; + config = config || { mode: 'no-arg' }; + if (config.index) index = config.index; + + if (config.mode != 'test') { + if (config.mode != "no-arg" && typeof config != 'function') { + if (config.progressObj) progressObj = config.progressObj; + delete arguments['0']; + } + } + else { + arguments['0'] = config.mode; + } + + var this_ = (this.name == "ImageSequencer") ? this : this.sequencer; + var args = (this.name == "ImageSequencer") ? [] : [this.images]; + for (var arg in arguments) args.push(copy(arguments[arg])); + + var callback = function() { }; + for (var arg in args) + if (objTypeOf(args[arg]) == "Function") + callback = args.splice(arg, 1)[0]; + + var json_q = formatInput.call(this_, args, "r"); + + require('./Run')(this_, json_q, callback, index, progressObj); + + return true; + } + + function loadImages() { + var args = []; + var sequencer = this; + for (var arg in arguments) args.push(copy(arguments[arg])); + var json_q = formatInput.call(this, args, "l"); + + inputlog.push({ method: "loadImages", json_q: copy(json_q) }); + var loadedimages = this.copy(json_q.loadedimages); + + var ret = { + name: "ImageSequencer Wrapper", + sequencer: this, + addSteps: this.addSteps, + removeSteps: this.removeSteps, + insertSteps: this.insertSteps, + run: this.run, + UI: this.UI, + setUI: this.setUI, + images: loadedimages + }; + + function load(i) { + if (i == loadedimages.length) { + json_q.callback.call(ret); + return; + } + var img = loadedimages[i]; + require('./ui/LoadImage')(sequencer, img, json_q.images[img], function() { + load(++i); + }); + } + + load(0); + } + + function replaceImage(selector, steps, options) { + options = options || {}; + options.callback = options.callback || function() { }; + return require('./ReplaceImage')(this, selector, steps, options); + } + + function setUI(UI) { + this.events = require('./ui/UserInterface')(UI); + } + + var exportBin = function(dir, basic, filename) { + return require('./ExportBin')(dir, this, basic, filename); + } + + function modulesInfo(name) { + var modulesdata = {} + if (name == "load-image") return {}; + if (arguments.length == 0) { + for (var modulename in this.modules) { + modulesdata[modulename] = modules[modulename][1]; + } + for (var sequencename in this.sequences) { + modulesdata[sequencename] = { name: sequencename, steps: sequences[sequencename] }; + } + } + else { + if (modules[name]) + modulesdata = modules[name][1]; + else + modulesdata = { 'inputs': sequences[name]['options'] }; + } + return modulesdata; + } + + // Genates a CLI string for the current sequence + function toCliString() { + var cliStringSteps = `"`, cliOptions = {}; + for (var step in this.steps) { + if (this.steps[step].options.name !== "load-image") + cliStringSteps += `${this.steps[step].options.name} `; + for (var inp in modulesInfo(this.steps[step].options.name).inputs) { + cliOptions[inp] = this.steps[step].options[inp]; + } + } + cliStringSteps = cliStringSteps.substr(0, cliStringSteps.length - 1) + `"`; + return `sequencer -i [PATH] -s ${cliStringSteps} -d '${JSON.stringify(cliOptions)}'` + } + + // Strigifies the current sequence + function toString(step) { + if (step) { + return stepToString(step); + } else { + return copy(this.images.image1.steps).map(stepToString).slice(1).join(','); + } + } + + // Stringifies one step of the sequence + function stepToString(step) { + let inputs = copy(modulesInfo(step.options.name).inputs); + inputs = inputs || {}; + + for (let input in inputs) { + inputs[input] = step.options[input] || inputs[input].default; + inputs[input] = encodeURIComponent(inputs[input]); + } + + var configurations = Object.keys(inputs).map(key => key + ':' + inputs[key]).join('|'); + return `${step.options.name}{${configurations}}`; + } + + // exports the current sequence as an array of JSON steps + function toJSON() { + return this.stringToJSON(this.toString()); + } + + // Coverts stringified sequence into an array of JSON steps + function stringToJSON(str) { + let steps; + if (str.includes(',')) + steps = str.split(','); + else + steps = [str]; + return steps.map(stringToJSONstep); + } + + // Converts one stringified step into JSON + function stringToJSONstep(str) { + var bracesStrings; + if (str.includes('{')) + if (str.includes('(') && str.indexOf('(') < str.indexOf('{')) + bracesStrings = ['(', ')']; + else + bracesStrings = ['{', '}']; + else + bracesStrings = ['(', ')']; + + if (str.indexOf(bracesStrings[0]) === -1) { // if there are no settings specified + var moduleName = str.substr(0); + stepSettings = ""; + } else { + var moduleName = str.substr(0, str.indexOf(bracesStrings[0])); + stepSettings = str.slice(str.indexOf(bracesStrings[0]) + 1, -1); + } + + stepSettings = stepSettings.split('|').reduce(function formatSettings(accumulator, current, i) { + var settingName = current.substr(0, current.indexOf(':')), + settingValue = current.substr(current.indexOf(':') + 1); + settingValue = settingValue.replace(/^\(/, '').replace(/\)$/, ''); // strip () at start/end + settingValue = settingValue.replace(/^\{/, '').replace(/\}$/, ''); // strip {} at start/end + settingValue = decodeURIComponent(settingValue); + current = [ + settingName, + settingValue + ]; + if (!!settingName) accumulator[settingName] = settingValue; + return accumulator; + }, {}); + + return { + name: moduleName, + options: stepSettings + } + } + + // imports a string into the sequencer steps + function importString(str) { + let sequencer = this; + if (this.name != "ImageSequencer") + sequencer = this.sequencer; + var stepsFromString = stringToJSON(str); + stepsFromString.forEach(function eachStep(stepObj) { + sequencer.addSteps(stepObj.name, stepObj.options); + }); + } + + // imports a array of JSON steps into the sequencer steps + function importJSON(obj) { + let sequencer = this; + if (this.name != "ImageSequencer") + sequencer = this.sequencer; + obj.forEach(function eachStep(stepObj) { + sequencer.addSteps(stepObj.name, stepObj.options); + }); + } + + function loadNewModule(name, options) { + + if (!options) { + return this; + + } else if (Array.isArray(options)) { + // contains the array of module and info + this.modules[name] = options; + + } else if (options.func && options.info) { + // passed in options object + this.modules[name] = [ + options.func, options.info + ]; + + } else if (options.path && !this.inBrowser) { + // load from path(only in node) + const module = [ + require(`${options.path}/Module.js`), + require(`${options.path}/info.json`) + ]; + this.modules[name] = module; + } + return this; + } + + function saveNewModule(name, path) { + if (options.inBrowser) { + // Not for browser context + return; + } + var mods = fs.readFileSync('./src/Modules.js').toString(); + mods = mods.substr(0, mods.length - 1) + " '" + name + "': require('" + path + "'),\n}"; + fs.writeFileSync('./src/Modules.js', mods); + } + + function createMetaModule(stepsCollection, info) { + var stepsArr = stepsCollection; + if (typeof stepsCollection === 'string') + stepsArr = stringToJSON(stepsCollection); + var metaMod = function() { + this.expandSteps(stepsArr); + return { + isMeta: true + } + } + return [metaMod, info]; + } + + function saveSequence(name, sequenceString) { + const sequence = stringToJSON(sequenceString); + // Save the given sequence string as a module + if (options.inBrowser) { + // Inside the browser we save the meta-modules using the Web Storage API + var sequences = JSON.parse(window.localStorage.getItem('sequences')); + sequences[name] = sequence; + window.localStorage.setItem('sequences', JSON.stringify(sequences)); + } + else { + // In node we save the sequences in the json file SavedSequences.json + var sequences = require('./SavedSequences.json'); + sequences[name] = sequence; + fs.writeFileSync('./src/SavedSequences.json', JSON.stringify(sequences)); + } + } + + function loadModules() { + // This function loads the modules and saved sequences + this.modules = require('./Modules'); + if (options.inBrowser) + this.sequences = JSON.parse(window.localStorage.getItem('sequences')); + else + this.sequences = require('./SavedSequences.json'); + } + + return { + //literals and objects + name: "ImageSequencer", + options: options, + inputlog: inputlog, + modules: modules, + sequences: sequences, + images: images, + events: events, + + //user functions + loadImages: loadImages, + loadImage: loadImages, + addSteps: addSteps, + removeSteps: removeSteps, + insertSteps: insertSteps, + replaceImage: replaceImage, + run: run, + setUI: setUI, + exportBin: exportBin, + modulesInfo: modulesInfo, + toCliString: toCliString, + toString: toString, + stepToString: stepToString, + toJSON: toJSON, + stringToJSON: stringToJSON, + stringToJSONstep: stringToJSONstep, + importString: importString, + importJSON: importJSON, + loadNewModule: loadNewModule, + saveNewModule: saveNewModule, + createMetaModule: createMetaModule, + saveSequence: saveSequence, + loadModules: loadModules, + + //other functions + log: log, + objTypeOf: objTypeOf, + copy: copy, + + setInputStep: require('./ui/SetInputStep')(sequencer) + } + +} +module.exports = ImageSequencer; -function copy(a) { - if (!typeof(a) == "object") return a; - if (objTypeOf(a) == "Array") return a.slice(); - if (objTypeOf(a) == "Object") { - var b = {}; - for (var v in a) { - b[v] = copy(a[v]); - } - return b; - } - return a; -} +},{"./AddStep":136,"./ExportBin":137,"./FormatInput":138,"./InsertStep":140,"./Modules":141,"./ReplaceImage":142,"./Run":143,"./SavedSequences.json":145,"./ui/LoadImage":208,"./ui/SetInputStep":209,"./ui/UserInterface":210,"./util/getStep.js":212,"fs":42}],140:[function(require,module,exports){ +const getStepUtils = require('./util/getStep.js'); + +// insert one or more steps at a given index in the sequencer +function InsertStep(ref, image, index, name, o) { + if (ref.sequences[name]) { + return ref.importJSON(ref.sequences[name]); + } + + function insertStep(image, index, name, o_) { + if (ref.modules[name]) var moduleInfo = ref.modules[name][1]; + else { + console.log('Module ' + name + ' not found.'); + } + + var o = ref.copy(o_); + o.number = ref.options.sequencerCounter++; //Gives a Unique ID to each step + o.name = o_.name || name || moduleInfo.name; + o.description = o_.description || moduleInfo.description; + o.selector = o_.selector || 'ismod-' + name; + o.container = o_.container || ref.options.selector; + o.image = image; + o.inBrowser = ref.options.inBrowser; + + if (index == -1) index = ref.images[image].steps.length; + + o.step = { + name: o.name, + description: o.description, + ID: o.number, + imageName: o.image, + inBrowser: ref.options.inBrowser, + ui: ref.options.ui, + options: o + }; + var UI = ref.events; + + // Tell UI that a step has been set up. + o = o || {}; + ref.modules[name].expandSteps = function expandSteps(stepsArray) { + for (var step of stepsArray) { + ref.addSteps(step['name'], step['options']); + } + } + if (!ref.modules[name][1].length) { + UI.onSetup(o.step); + ref.images[image].steps.splice(index, 0, ref.modules[name][0](o, UI)); + } else { + ref.modules[name][0](o, UI); + } + + return true; + } + + insertStep(image, index, name, o); + ref.steps = ref.images[image].steps; + +} +module.exports = InsertStep; -function formatInput(args,format,images) { - images = []; - for (var image in this.images) { - images.push(image); - } - var json_q = {}; - var format_i = format; - if (format == "+") - format = ['o_string_a', 'string_a', 'o_object']; - else if (format == "-") - format = ['o_string_a', 'number_a']; - else if (format == "^") - format = ['o_string_a', 'number', 'string', 'o_object']; - else if (format == "r") - format = ['o_string_a', 'o_number']; - else if (format == "l") - format = ['o_string','string','o_function']; - - /* - formats: - addSteps :: o_image_a, name_a, o_o - o_string_a, string_a, o_object => { image: [{name,o}] } - removeSteps :: o_image_a, index_a - o_string_a, number_a => { image: [index] } - insertSteps :: o_image_a, index, name, o_o - o_string_a, number, string, o_object => { image: [{index,name,o}] } - run :: o_image_a, o_from - o_string_a, o_number => { image: index } - loadImages :: image, src, o_function - string, string, o_function => { images: [{image:src}], callback } - - optionals: - image: o_string_a - options: o_object - from: o_number - callback: o_function - */ - - if(format[format.length-1] == "o_object") { - if(objTypeOf(args[args.length-1]) != "Object") - args.push({}); - } - else if (format[format.length-1] == "o_number") { - if(typeof(args[args.length-1]) != "number" && objTypeOf(args[0])!="Object") - args.push(1); - } - else if (format[format.length-1] == "o_function") { - if(objTypeOf(args[args.length-1]) != "Function" && objTypeOf(args[0])!="Object") - args.push(function(){}); - } - - if(format[0] == "o_string_a") { - if(args.length == format.length - 1) { - var insert = false; - for (var i in args) { - if (format[parseInt(i)+1].includes( typeof(getPrimitive(args[i])) )){ - insert = true; - } - else {insert = false; break;} - } - if(insert) - args.splice(0,0,copy(images)); - } - } - else if (format[0] == "o_string" && format_i == "l" && args.length == 2) { - if (typeof(args[0]) == "string") { - var identifier = "image"; - var number = 1; - while (this.images.hasOwnProperty(identifier+number)) number++; - args.splice(0,0,identifier+number); - } - } - - if(args.length == format.length) { - for (var i in format) { - if (format[i].substr(format[i].length-2,2)=="_a") - args[i] = makeArray(args[i]); - } - } - - if (args.length == 1) { - json_q = copy(args[0]); - if(!(format_i == "r" || format_i == "l")) { - for (var img in json_q) - json_q[img] = makeArray(json_q[img]); - } - } - else if (format_i == "r") { - for (var img in args[0]) json_q[args[0][img]] = args[1]; - } - else if (format_i == "l") { - json_q = { - images: {}, - callback: args[2] - } - json_q.images[args[0]] = args[1]; - } - else { - for (var img in args[0]) { - var image = args[0][img]; - json_q[image] = []; - - if(format_i == "+") { - for(var s in args[1]) { - json_q[image].push({ - name: args[1][s], - o: args[2] - }); - } - } - - if(format_i == "-") { - json_q[image] = args[1]; - } - - if(format_i == "^") { - var size = this.images[image].steps.length; - var index = args[1]; - index = (index==size)?index:index%size; - if (index<0) index += size+1; - json_q[image].push({ - index: index, - name: args[2], - o: args[3] - }); - } - - } - } - - if(format_i == "l") { - json_q.loadedimages = []; - for (var i in json_q.images) json_q.loadedimages.push(i); - } - - return json_q; - -} -module.exports = formatInput; - -},{}],139:[function(require,module,exports){ -if (typeof window !== 'undefined') { isBrowser = true } -else { var isBrowser = false } -require('./util/getStep.js'); - -ImageSequencer = function ImageSequencer(options) { - - var sequencer = (this.name == "ImageSequencer") ? this : this.sequencer; - options = options || {}; - options.inBrowser = options.inBrowser || isBrowser; - options.sequencerCounter = 0; - - function objTypeOf(object) { - return Object.prototype.toString.call(object).split(" ")[1].slice(0, -1) - } - - function log(color, msg) { - if (options.ui != "none") { - if (arguments.length == 1) console.log(arguments[0]); - else if (arguments.length == 2) console.log(color, msg); - } - } - - function copy(a) { - if (!typeof (a) == "object") return a; - if (objTypeOf(a) == "Array") return a.slice(); - if (objTypeOf(a) == "Object") { - var b = {}; - for (var v in a) { - b[v] = copy(a[v]); - } - return b; - } - return a; - } - - function makeArray(input) { - return (objTypeOf(input) == "Array") ? input : [input]; - } - - var image, - steps = [], - modules = require('./Modules'), - sequences = require('./SavedSequences.json'), - formatInput = require('./FormatInput'), - images = {}, - inputlog = [], - events = require('./ui/UserInterface')(), - fs = require('fs'); - - - - if (options.inBrowser) { - for (o in sequencer) { - modules[o] = sequencer[o]; - } - sequences = JSON.parse(window.localStorage.getItem('sequences')); - if (!sequences) { - sequences = {}; - window.localStorage.setItem('sequences', JSON.stringify(sequences)); - } - } - - // if in browser, prompt for an image - // if (options.imageSelect || options.inBrowser) addStep('image-select'); - // else if (options.imageUrl) loadImage(imageUrl); - - function addSteps() { - var this_ = (this.name == "ImageSequencer") ? this : this.sequencer; - var args = (this.name == "ImageSequencer") ? [] : [this.images]; - var json_q = {}; - for (var arg in arguments) { args.push(copy(arguments[arg])); } - json_q = formatInput.call(this_, args, "+"); - - inputlog.push({ method: "addSteps", json_q: copy(json_q) }); - - for (var i in json_q) - for (var j in json_q[i]) - require("./AddStep")(this_, i, json_q[i][j].name, json_q[i][j].o); - - return this; - } - - function removeStep(image, index) { - //remove the step from images[image].steps and redraw remaining images - if (index > 0) { - thisStep = images[image].steps[index]; - thisStep.UI.onRemove(thisStep.options.step); - images[image].steps.splice(index, 1); - } - //tell the UI a step has been removed - } - - function removeSteps(image, index) { - var run = {}, indices; - var this_ = (this.name == "ImageSequencer") ? this : this.sequencer; - var args = (this.name == "ImageSequencer") ? [] : [this.images]; - for (var arg in arguments) args.push(copy(arguments[arg])); - - var json_q = formatInput.call(this_, args, "-"); - inputlog.push({ method: "removeSteps", json_q: copy(json_q) }); - - for (var img in json_q) { - indices = json_q[img].sort(function(a, b) { return b - a }); - run[img] = indices[indices.length - 1]; - for (var i in indices) - removeStep(img, indices[i]); - } - // this.run(run); // This is creating problems - return this; - } - - function insertSteps(image, index, name, o) { - var run = {}; - var this_ = (this.name == "ImageSequencer") ? this : this.sequencer; - var args = (this.name == "ImageSequencer") ? [] : [this.images]; - for (var arg in arguments) args.push(arguments[arg]); - - var json_q = formatInput.call(this_, args, "^"); - inputlog.push({ method: "insertSteps", json_q: copy(json_q) }); - - for (var img in json_q) { - var details = json_q[img]; - details = details.sort(function(a, b) { return b.index - a.index }); - for (var i in details) - require("./InsertStep")(this_, img, details[i].index, details[i].name, details[i].o); - run[img] = details[details.length - 1].index; - } - // this.run(run); // This is Creating issues - return this; - } - - // Config is an object which contains the runtime configuration like progress bar - // information and index from which the sequencer should run - function run(config, t_image, t_from) { - let progressObj, index = 0; - config = config || { mode: 'no-arg' }; - if (config.index) index = config.index; - - if (config.mode != 'test') { - if (config.mode != "no-arg" && typeof config != 'function') { - if (config.progressObj) progressObj = config.progressObj; - delete arguments['0']; - } - } - else { - arguments['0'] = config.mode; - } - - var this_ = (this.name == "ImageSequencer") ? this : this.sequencer; - var args = (this.name == "ImageSequencer") ? [] : [this.images]; - for (var arg in arguments) args.push(copy(arguments[arg])); - - var callback = function() { }; - for (var arg in args) - if (objTypeOf(args[arg]) == "Function") - callback = args.splice(arg, 1)[0]; - - var json_q = formatInput.call(this_, args, "r"); - - require('./Run')(this_, json_q, callback, index, progressObj); - - return true; - } - - function loadImages() { - var args = []; - var sequencer = this; - for (var arg in arguments) args.push(copy(arguments[arg])); - var json_q = formatInput.call(this, args, "l"); - - inputlog.push({ method: "loadImages", json_q: copy(json_q) }); - var loadedimages = this.copy(json_q.loadedimages); - - var ret = { - name: "ImageSequencer Wrapper", - sequencer: this, - addSteps: this.addSteps, - removeSteps: this.removeSteps, - insertSteps: this.insertSteps, - run: this.run, - UI: this.UI, - setUI: this.setUI, - images: loadedimages - }; - - function load(i) { - if (i == loadedimages.length) { - json_q.callback.call(ret); - return; - } - var img = loadedimages[i]; - require('./ui/LoadImage')(sequencer, img, json_q.images[img], function() { - load(++i); - }); - } - - load(0); - } - - function replaceImage(selector, steps, options) { - options = options || {}; - options.callback = options.callback || function() { }; - return require('./ReplaceImage')(this, selector, steps, options); - } - - function setUI(UI) { - this.events = require('./ui/UserInterface')(UI); - } - - var exportBin = function(dir, basic, filename) { - return require('./ExportBin')(dir, this, basic, filename); - } - - function modulesInfo(name) { - var modulesdata = {} - if (name == "load-image") return {}; - if (arguments.length == 0) { - for (var modulename in this.modules) { - modulesdata[modulename] = modules[modulename][1]; - } - for (var sequencename in this.sequences) { - modulesdata[sequencename] = { name: sequencename, steps: sequences[sequencename] }; - } - } - else { - if (modules[name]) - modulesdata = modules[name][1]; - else - modulesdata = { 'inputs': sequences[name]['options'] }; - } - return modulesdata; - } - - // Genates a CLI string for the current sequence - function toCliString() { - var cliStringSteps = `"`, cliOptions = {}; - for (var step in this.steps) { - if (this.steps[step].options.name !== "load-image") - cliStringSteps += `${this.steps[step].options.name} `; - for (var inp in modulesInfo(this.steps[step].options.name).inputs) { - cliOptions[inp] = this.steps[step].options[inp]; - } - } - cliStringSteps = cliStringSteps.substr(0, cliStringSteps.length - 1) + `"`; - return `sequencer -i [PATH] -s ${cliStringSteps} -d '${JSON.stringify(cliOptions)}'` - } - - // Strigifies the current sequence - function toString(step) { - if (step) { - return stepToString(step); - } else { - return copy(this.images.image1.steps).map(stepToString).slice(1).join(','); - } - } - - // Stringifies one step of the sequence - function stepToString(step) { - let inputs = copy(modulesInfo(step.options.name).inputs); - inputs = inputs || {}; - - for (let input in inputs) { - inputs[input] = step.options[input] || inputs[input].default; - inputs[input] = encodeURIComponent(inputs[input]); - } - - var configurations = Object.keys(inputs).map(key => key + ':' + inputs[key]).join('|'); - return `${step.options.name}{${configurations}}`; - } - - // exports the current sequence as an array of JSON steps - function toJSON() { - return this.stringToJSON(this.toString()); - } - - // Coverts stringified sequence into an array of JSON steps - function stringToJSON(str) { - let steps; - if (str.includes(',')) - steps = str.split(','); - else - steps = [str]; - return steps.map(stringToJSONstep); - } - - // Converts one stringified step into JSON - function stringToJSONstep(str) { - var bracesStrings; - if (str.includes('{')) - if (str.includes('(') && str.indexOf('(') < str.indexOf('{')) - bracesStrings = ['(', ')']; - else - bracesStrings = ['{', '}']; - else - bracesStrings = ['(', ')']; - - if (str.indexOf(bracesStrings[0]) === -1) { // if there are no settings specified - var moduleName = str.substr(0); - stepSettings = ""; - } else { - var moduleName = str.substr(0, str.indexOf(bracesStrings[0])); - stepSettings = str.slice(str.indexOf(bracesStrings[0]) + 1, -1); - } - - stepSettings = stepSettings.split('|').reduce(function formatSettings(accumulator, current, i) { - var settingName = current.substr(0, current.indexOf(':')), - settingValue = current.substr(current.indexOf(':') + 1); - settingValue = settingValue.replace(/^\(/, '').replace(/\)$/, ''); // strip () at start/end - settingValue = settingValue.replace(/^\{/, '').replace(/\}$/, ''); // strip {} at start/end - settingValue = decodeURIComponent(settingValue); - current = [ - settingName, - settingValue - ]; - if (!!settingName) accumulator[settingName] = settingValue; - return accumulator; - }, {}); - - return { - name: moduleName, - options: stepSettings - } - } - - // imports a string into the sequencer steps - function importString(str) { - let sequencer = this; - if (this.name != "ImageSequencer") - sequencer = this.sequencer; - var stepsFromString = stringToJSON(str); - stepsFromString.forEach(function eachStep(stepObj) { - sequencer.addSteps(stepObj.name, stepObj.options); - }); - } - - // imports a array of JSON steps into the sequencer steps - function importJSON(obj) { - let sequencer = this; - if (this.name != "ImageSequencer") - sequencer = this.sequencer; - obj.forEach(function eachStep(stepObj) { - sequencer.addSteps(stepObj.name, stepObj.options); - }); - } - - function loadNewModule(name, options) { - - if (!options) { - return this; - - } else if (Array.isArray(options)) { - // contains the array of module and info - this.modules[name] = options; - - } else if (options.func && options.info) { - // passed in options object - this.modules[name] = [ - options.func, options.info - ]; - - } else if (options.path && !this.inBrowser) { - // load from path(only in node) - const module = [ - require(`${options.path}/Module.js`), - require(`${options.path}/info.json`) - ]; - this.modules[name] = module; - } - return this; - } - - function saveNewModule(name, path) { - if (options.inBrowser) { - // Not for browser context - return; - } - var mods = fs.readFileSync('./src/Modules.js').toString(); - mods = mods.substr(0, mods.length - 1) + " '" + name + "': require('" + path + "'),\n}"; - fs.writeFileSync('./src/Modules.js', mods); - } - - function createMetaModule(stepsCollection, info) { - var stepsArr = stepsCollection; - if (typeof stepsCollection === 'string') - stepsArr = stringToJSON(stepsCollection); - var metaMod = function() { - this.expandSteps(stepsArr); - return { - isMeta: true - } - } - return [metaMod, info]; - } - - function saveSequence(name, sequenceString) { - const sequence = stringToJSON(sequenceString); - // Save the given sequence string as a module - if (options.inBrowser) { - // Inside the browser we save the meta-modules using the Web Storage API - var sequences = JSON.parse(window.localStorage.getItem('sequences')); - sequences[name] = sequence; - window.localStorage.setItem('sequences', JSON.stringify(sequences)); - } - else { - // In node we save the sequences in the json file SavedSequences.json - var sequences = require('./SavedSequences.json'); - sequences[name] = sequence; - fs.writeFileSync('./src/SavedSequences.json', JSON.stringify(sequences)); - } - } - - function loadModules() { - // This function loads the modules and saved sequences - this.modules = require('./Modules'); - if (options.inBrowser) - this.sequences = JSON.parse(window.localStorage.getItem('sequences')); - else - this.sequences = require('./SavedSequences.json'); - } - - return { - //literals and objects - name: "ImageSequencer", - options: options, - inputlog: inputlog, - modules: modules, - sequences: sequences, - images: images, - events: events, - - //user functions - loadImages: loadImages, - loadImage: loadImages, - addSteps: addSteps, - removeSteps: removeSteps, - insertSteps: insertSteps, - replaceImage: replaceImage, - run: run, - setUI: setUI, - exportBin: exportBin, - modulesInfo: modulesInfo, - toCliString: toCliString, - toString: toString, - stepToString: stepToString, - toJSON: toJSON, - stringToJSON: stringToJSON, - stringToJSONstep: stringToJSONstep, - importString: importString, - importJSON: importJSON, - loadNewModule: loadNewModule, - saveNewModule: saveNewModule, - createMetaModule: createMetaModule, - saveSequence: saveSequence, - loadModules: loadModules, - - //other functions - log: log, - objTypeOf: objTypeOf, - copy: copy, - - setInputStep: require('./ui/SetInputStep')(sequencer) - } - -} -module.exports = ImageSequencer; - -},{"./AddStep":136,"./ExportBin":137,"./FormatInput":138,"./InsertStep":140,"./Modules":141,"./ReplaceImage":142,"./Run":143,"./SavedSequences.json":145,"./ui/LoadImage":208,"./ui/SetInputStep":209,"./ui/UserInterface":210,"./util/getStep.js":212,"fs":42}],140:[function(require,module,exports){ -const getStepUtils = require('./util/getStep.js'); - -// insert one or more steps at a given index in the sequencer -function InsertStep(ref, image, index, name, o) { - if (ref.sequences[name]) { - return ref.importJSON(ref.sequences[name]); - } - - function insertStep(image, index, name, o_) { - if (ref.modules[name]) var moduleInfo = ref.modules[name][1]; - else { - console.log('Module ' + name + ' not found.'); - } - - var o = ref.copy(o_); - o.number = ref.options.sequencerCounter++; //Gives a Unique ID to each step - o.name = o_.name || name || moduleInfo.name; - o.description = o_.description || moduleInfo.description; - o.selector = o_.selector || 'ismod-' + name; - o.container = o_.container || ref.options.selector; - o.image = image; - o.inBrowser = ref.options.inBrowser; - - if (index == -1) index = ref.images[image].steps.length; - - o.step = { - name: o.name, - description: o.description, - ID: o.number, - imageName: o.image, - inBrowser: ref.options.inBrowser, - ui: ref.options.ui, - options: o - }; - var UI = ref.events; - - // Tell UI that a step has been set up. - o = o || {}; - ref.modules[name].expandSteps = function expandSteps(stepsArray) { - for (var step of stepsArray) { - ref.addSteps(step['name'], step['options']); - } - } - if (!ref.modules[name][1].length) { - UI.onSetup(o.step); - ref.images[image].steps.splice(index, 0, ref.modules[name][0](o, UI)); - } else { - ref.modules[name][0](o, UI); - } - - return true; - } - - insertStep(image, index, name, o); - ref.steps = ref.images[image].steps; - -} -module.exports = InsertStep; - -},{"./util/getStep.js":212}],141:[function(require,module,exports){ -/* -* Core modules and their info files -*/ -module.exports = { - 'channel': require('./modules/Channel'), - 'brightness': require('./modules/Brightness'), - 'edge-detect': require('./modules/EdgeDetect'), - 'ndvi': require('./modules/Ndvi'), - 'crop': require('./modules/Crop'), - 'colormap': require('./modules/Colormap'), - 'decode-qr': require('./modules/DecodeQr'), - 'fisheye-gl': require('./modules/FisheyeGl'), - 'dynamic': require('./modules/Dynamic'), - 'blur': require('./modules/Blur'), - 'saturation': require('./modules/Saturation'), - 'average': require('./modules/Average'), - 'blend': require('./modules/Blend'), - 'import-image': require('./modules/ImportImage'), - 'overlay': require('./modules/Overlay'), - 'gradient': require('./modules/Gradient'), - 'invert': require('image-sequencer-invert'), - 'ndvi-colormap': require('./modules/NdviColormap'), - 'colorbar': require('./modules/Colorbar'), -} -},{"./modules/Average":147,"./modules/Blend":150,"./modules/Blur":154,"./modules/Brightness":157,"./modules/Channel":160,"./modules/Colorbar":163,"./modules/Colormap":167,"./modules/Crop":172,"./modules/DecodeQr":175,"./modules/Dynamic":178,"./modules/EdgeDetect":182,"./modules/FisheyeGl":185,"./modules/Gradient":188,"./modules/ImportImage":192,"./modules/Ndvi":196,"./modules/NdviColormap":199,"./modules/Overlay":202,"./modules/Saturation":205,"image-sequencer-invert":56}],142:[function(require,module,exports){ -// Uses a given image as input and replaces it with the output. -// Works only in the browser. -function ReplaceImage(ref,selector,steps,options) { - if(!ref.options.inBrowser) return false; // This isn't for Node.js - var tempSequencer = ImageSequencer({ui: false}); - var this_ = ref; - if (window.hasOwnProperty('$')) var input = $(selector); - else var input = document.querySelectorAll(selector); - var images = []; - for (var i = 0; i < input.length; i++) { - if (input[i] instanceof HTMLImageElement) images.push(input[i]); - } - - function replaceImage (img, steps) { - var url = img.src; - // refactor to filetypeFromUrl() - var ext = url.split('?')[0].split('.').pop(); - - var xmlHTTP = new XMLHttpRequest(); - xmlHTTP.open('GET', url, true); - xmlHTTP.responseType = 'arraybuffer'; - xmlHTTP.onload = function(e) { - var arr = new Uint8Array(this.response); - - // in chunks to avoid "RangeError: Maximum call stack exceeded" - // https://github.com/publiclab/image-sequencer/issues/241 - // https://stackoverflow.com/a/20048852/1116657 - var raw = ''; - var i,j,subArray,chunk = 5000; - for (i=0,j=arr.length; i= ref.images[image].steps.length) return { options: { name: undefined } }; - else return ref.images[image].steps.slice(i + offset)[0]; - }; - ref.images[image].steps[i].getIndex = function getIndex() { - return i; - } - - for (var util in getStepUtils) { - if (getStepUtils.hasOwnProperty(util)) { - ref.images[image].steps[i][util] = getStepUtils[util]; - } - } - - // Tell UI that a step is being drawn. - ref.images[image].steps[i].UI.onDraw(ref.images[image].steps[i].options.step); - - // provides a set of standard tools for each step - var inputForNextStep = require('./RunToolkit')(ref.copy(input)); - - ref.images[image].steps[i].draw( - inputForNextStep, - function onEachStep() { - - // This output is accessible by UI - ref.images[image].steps[i].options.step.output = ref.images[image].steps[i].output.src; - - // Tell UI that step has been drawn. - ref.images[image].steps[i].UI.onComplete(ref.images[image].steps[i].options.step); - - drawStep(drawarray, ++pos); - }, - progressObj - ); - } - } - - function drawSteps(json_q) { - var drawarray = []; - for (var image in json_q) { - var no_steps = ref.images[image].steps.length; - var init = json_q[image]; - for (var i = 0; i < no_steps - init; i++) { - drawarray.push({ image: image, i: init + i }); - } - } - drawStep(drawarray, ind); - } - - function filter(json_q) { - for (var image in json_q) { - if (json_q[image] == 0 && ref.images[image].steps.length == 1) - delete json_q[image]; - else if (json_q[image] == 0) json_q[image]++; - } - for (var image in json_q) { - var prevstep = ref.images[image].steps[json_q[image] - 1]; - while ( - typeof prevstep == "undefined" || - typeof prevstep.output == "undefined" - ) { - prevstep = ref.images[image].steps[--json_q[image] - 1]; - } - } - return json_q; - } - - var json_q = filter(json_q); - return drawSteps(json_q); -} -module.exports = Run; - -},{"./RunToolkit":144,"./util/getStep.js":212}],144:[function(require,module,exports){ -const getPixels = require('get-pixels'); -const pixelManipulation = require('./modules/_nomodule/PixelManipulation'); -const lodash = require('lodash'); -const dataUriToBuffer = require('data-uri-to-buffer'); -const savePixels = require('save-pixels'); - -module.exports = function(input) { - input.getPixels = getPixels; - input.pixelManipulation = pixelManipulation; - input.lodash = lodash; - input.dataUriToBuffer = dataUriToBuffer; - input.savePixels = savePixels; - return input; -} -},{"./modules/_nomodule/PixelManipulation":207,"data-uri-to-buffer":13,"get-pixels":23,"lodash":62,"save-pixels":111}],145:[function(require,module,exports){ -module.exports={"sample":[{"name":"invert","options":{}},{"name":"channel","options":{"channel":"red"}},{"name":"blur","options":{"blur":"5"}}]} -},{}],146:[function(require,module,exports){ -/* -* Average all pixel colors -*/ -module.exports = function Average(options, UI){ - - options.blur = options.blur || 2 - var output; - - options.step.metadata = options.step.metadata || {}; - - function draw(input,callback,progressObj){ - - progressObj.stop(true); - progressObj.overrideFlag = true; - - var step = this; - - function changePixel(r, g, b, a){ - return [r,g,b,a] - } - - // do the averaging - function extraManipulation(pixels){ - var sum = [0,0,0,0]; - for (var i = 0; i < pixels.data.length; i += 4) { - sum[0] += pixels.data[i + 0]; - sum[1] += pixels.data[i + 1]; - sum[2] += pixels.data[i + 2]; - sum[3] += pixels.data[i + 3]; - } - - sum[0] = parseInt(sum[0] / (pixels.data.length / 4)); - sum[1] = parseInt(sum[1] / (pixels.data.length / 4)); - sum[2] = parseInt(sum[2] / (pixels.data.length / 4)); - sum[3] = parseInt(sum[3] / (pixels.data.length / 4)); - - for (var i = 0; i < pixels.data.length; i += 4) { - pixels.data[i + 0] = sum[0]; - pixels.data[i + 1] = sum[1]; - pixels.data[i + 2] = sum[2]; - pixels.data[i + 3] = sum[3]; - } - // report back and store average in metadata: - options.step.metadata.averages = sum; - console.log("average: ", sum); - // TODO: refactor into a new "display()" method as per https://github.com/publiclab/image-sequencer/issues/242 - if (options.step.inBrowser && options.step.ui) $(options.step.ui).find('.details').append("

Averages (r, g, b, a): " + sum.join(', ') + "

"); - return pixels; - } - - function output(image, datauri, mimetype){ - - // This output is accessible by Image Sequencer - step.output = { - src: datauri, - format: mimetype - }; - } - - return require('../_nomodule/PixelManipulation.js')(input, { - output: output, - changePixel: changePixel, - extraManipulation: extraManipulation, - format: input.format, - image: options.image, - callback: callback - }); - - } - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} - -},{"../_nomodule/PixelManipulation.js":207}],147:[function(require,module,exports){ -module.exports = [ - require('./Module'), - require('./info.json') -] -},{"./Module":146,"./info.json":148}],148:[function(require,module,exports){ -module.exports={ - "name": "Average", - "description": "Average all pixel color", - "inputs": { - } -} - -},{}],149:[function(require,module,exports){ -module.exports = function Dynamic(options, UI, util) { - - options.func = options.func || "function(r1, g1, b1, a1, r2, g2, b2, a2) { return [ r1, g2, b2, a2 ] }"; - - var output; - - // This function is called on every draw. - function draw(input, callback, progressObj) { - - progressObj.stop(true); - progressObj.overrideFlag = true; - - var step = this; - - // convert to runnable code: - if (typeof options.func === "string") eval('options.func = ' + options.func); - - var getPixels = require('get-pixels'); - - // save first image's pixels - var priorStep = this.getStep(-2); - - getPixels(priorStep.output.src, function(err, pixels) { - options.firstImagePixels = pixels; - - function changePixel(r2, g2, b2, a2, x, y) { - // blend! - var p = options.firstImagePixels; - return options.func( - r2, g2, b2, a2, - p.get(x, y, 0), - p.get(x, y, 1), - p.get(x, y, 2), - p.get(x, y, 3) - ) - } - - function output(image, datauri, mimetype) { - - // This output is accessible by Image Sequencer - step.output = { src: datauri, format: mimetype }; - - } - - // run PixelManipulatin on second image's pixels - return require('../_nomodule/PixelManipulation.js')(input, { - output: output, - changePixel: changePixel, - format: input.format, - image: options.image, - inBrowser: options.inBrowser, - callback: callback - }); - }); - } - - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} - -},{"../_nomodule/PixelManipulation.js":207,"get-pixels":23}],150:[function(require,module,exports){ -arguments[4][147][0].apply(exports,arguments) -},{"./Module":149,"./info.json":151,"dup":147}],151:[function(require,module,exports){ -module.exports={ - "name": "Blend", - "description": "Blend the past two image steps with the given function. Defaults to using the red channel from image 1 and the green and blue and alpha channels of image 2. Easier to use interfaces coming soon!", - "inputs": { - "blend": { - "type": "input", - "desc": "Function to use to blend the two images.", - "default": "function(r1, g1, b1, a1, r2, g2, b2, a2) { return [ r1, g2, b2, a2 ] }" - } - } -} - -},{}],152:[function(require,module,exports){ -module.exports = exports = function(pixels, blur) { - let kernel = kernelGenerator(blur, 1), oldpix = pixels; - kernel = flipKernel(kernel); - - for (let i = 0; i < pixels.shape[0]; i++) { - for (let j = 0; j < pixels.shape[1]; j++) { - let neighboutPos = getNeighbouringPixelPositions([i, j]); - let acc = [0.0, 0.0, 0.0, 0.0]; - for (let a = 0; a < kernel.length; a++) { - for (let b = 0; b < kernel.length; b++) { - acc[0] += (oldpix.get(neighboutPos[a][b][0], neighboutPos[a][b][1], 0) * kernel[a][b]); - acc[1] += (oldpix.get(neighboutPos[a][b][0], neighboutPos[a][b][1], 1) * kernel[a][b]); - acc[2] += (oldpix.get(neighboutPos[a][b][0], neighboutPos[a][b][1], 2) * kernel[a][b]); - acc[3] += (oldpix.get(neighboutPos[a][b][0], neighboutPos[a][b][1], 3) * kernel[a][b]); - } - } - pixels.set(i, j, 0, acc[0]); - pixels.set(i, j, 1, acc[1]); - pixels.set(i, j, 2, acc[2]); - } - } - return pixels; - - - - //Generates a 3x3 Gaussian kernel - function kernelGenerator(sigma, size) { - - /* - Trying out a variable radius kernel not working as of now - */ - // const coeff = (1.0/(2.0*Math.PI*sigma*sigma)) - // const expCoeff = -1 * (1.0/2.0 * sigma * sigma) - // let e = Math.E - // let result = [] - // for(let i = -1 * size;i<=size;i++){ - // let arr = [] - // for(let j= -1 * size;j<=size;j++){ - // arr.push(coeff * Math.pow(e,expCoeff * ((i * i) + (j*j)))) - // } - // result.push(arr) - // } - // let sum = result.reduce((sum,val)=>{ - // return val.reduce((sumInner,valInner)=>{ - // return sumInner+valInner - // }) - // }) - // result = result.map(arr=>arr.map(val=>(val + 0.0)/(sum + 0.0))) - - // return result - - return [ - [2.0 / 159.0, 4.0 / 159.0, 5.0 / 159.0, 4.0 / 159.0, 2.0 / 159.0], - [4.0 / 159.0, 9.0 / 159.0, 12.0 / 159.0, 9.0 / 159.0, 4.0 / 159.0], - [5.0 / 159.0, 12.0 / 159.0, 15.0 / 159.0, 12.0 / 159.0, 5.0 / 159.0], - [4.0 / 159.0, 9.0 / 159.0, 12.0 / 159.0, 9.0 / 159.0, 4.0 / 159.0], - [2.0 / 159.0, 4.0 / 159.0, 5.0 / 159.0, 4.0 / 159.0, 2.0 / 159.0] - ]; - } - function getNeighbouringPixelPositions(pixelPosition) { - let x = pixelPosition[0], y = pixelPosition[1], result = []; - - for (let i = -2; i <= 2; i++) { - let arr = []; - for (let j = -2; j <= 2; j++) - arr.push([x + i, y + j]); - - result.push(arr); - } - return result; - } - - function flipKernel(kernel) { - let result = []; - for (let i = kernel.length - 1; i >= 0; i--) { - let arr = []; - for (let j = kernel[i].length - 1; j >= 0; j--) { - arr.push(kernel[i][j]); - } - result.push(arr); - } - return result; - } -} -},{}],153:[function(require,module,exports){ -/* -* Blur an Image -*/ -module.exports = function Blur(options, UI) { - - options.blur = options.blur || 2 - var output; - - function draw(input, callback, progressObj) { - - progressObj.stop(true); - progressObj.overrideFlag = true; - - var step = this; - - function changePixel(r, g, b, a) { - return [r, g, b, a] - } - - function extraManipulation(pixels) { - pixels = require('./Blur')(pixels, options.blur) - return pixels - } - - function output(image, datauri, mimetype) { - - // This output is accessible by Image Sequencer - step.output = { src: datauri, format: mimetype }; - - } - - return require('../_nomodule/PixelManipulation.js')(input, { - output: output, - changePixel: changePixel, - extraManipulation: extraManipulation, - format: input.format, - image: options.image, - callback: callback - }); - - } - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} - -},{"../_nomodule/PixelManipulation.js":207,"./Blur":152}],154:[function(require,module,exports){ -arguments[4][147][0].apply(exports,arguments) -},{"./Module":153,"./info.json":155,"dup":147}],155:[function(require,module,exports){ -module.exports={ - "name": "Blur", - "description": "Gaussian blur an image by a given value, typically 0-5", - "inputs": { - "blur": { - "type": "integer", - "desc": "amount of gaussian blur(Less blur gives more detail, typically 0-5)", - "default": 2 - } - } -} - -},{}],156:[function(require,module,exports){ -/* -* Changes the Image Brightness -*/ - -module.exports = function Brightness(options,UI){ - - var output; - - function draw(input,callback,progressObj){ - - progressObj.stop(true); - progressObj.overrideFlag = true; - - /* - In this case progress is handled by changepixel internally otherwise progressObj - needs to be overriden and used - For eg. progressObj = new SomeProgressModule() - */ - - var step = this; - - function changePixel(r, g, b, a){ - var val = (options.brightness)/100.0 - - r = val*r<255?val*r:255 - g = val*g<255?val*g:255 - b = val*b<255?val*b:255 - return [r , g, b, a] - } - - function output(image,datauri,mimetype){ - - // This output is accessible by Image Sequencer - step.output = {src:datauri,format:mimetype}; - - } - - return require('../_nomodule/PixelManipulation.js')(input, { - output: output, - changePixel: changePixel, - format: input.format, - image: options.image, - inBrowser: options.inBrowser, - callback: callback - }); - - } - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} - -},{"../_nomodule/PixelManipulation.js":207}],157:[function(require,module,exports){ -arguments[4][147][0].apply(exports,arguments) -},{"./Module":156,"./info.json":158,"dup":147}],158:[function(require,module,exports){ -module.exports={ - "name": "Brightness", - "description": "Change the brightness of the image by given percent value", - "inputs": { - "brightness": { - "type": "integer", - "desc": "% brightness for the new image", - "default": 0 - } - } -} - -},{}],159:[function(require,module,exports){ -/* - * Display only one color channel - */ -module.exports = function Channel(options, UI) { - - options.channel = options.channel || "green"; - - var output; - - function draw(input, callback, progressObj) { - - progressObj.stop(true); - progressObj.overrideFlag = true; - - var step = this; - - function changePixel(r, g, b, a) { - if (options.channel == "red") return [r, 0, 0, a]; - if (options.channel == "green") return [0, g, 0, a]; - if (options.channel == "blue") return [0, 0, b, a]; - } - - function output(image, datauri, mimetype) { - - // This output is accesible by Image Sequencer - step.output = { src: datauri, format: mimetype }; - - } - - return require('../_nomodule/PixelManipulation.js')(input, { - output: output, - changePixel: changePixel, - format: input.format, - image: options.image, - inBrowser: options.inBrowser, - callback: callback - }); - - } - - return { - options: options, - //setup: setup, // optional - draw: draw, - output: output, - UI: UI - } -} - -},{"../_nomodule/PixelManipulation.js":207}],160:[function(require,module,exports){ -arguments[4][147][0].apply(exports,arguments) -},{"./Module":159,"./info.json":161,"dup":147}],161:[function(require,module,exports){ -module.exports={ - "name": "Channel", - "description": "Displays only one color channel of an image -- default is green", - "inputs": { - "channel": { - "type": "select", - "desc": "Color channel", - "default": "green", - "values": ["red", "green", "blue"] - } - } -} - -},{}],162:[function(require,module,exports){ -module.exports = function NdviColormapfunction(options, UI) { - - options.x = options.x || 0; - options.y = options.y || 0; - options.colormap = options.colormap || "default"; - options.h = options.h || 10; - this.expandSteps([ - { 'name': 'gradient', 'options': {} }, - { 'name': 'colormap', 'options': { colormap: options.colormap } }, - { 'name': 'crop', 'options': { 'y': 0, 'h': options.h } }, - { 'name': 'overlay', 'options': { 'x': options.x, 'y': options.y, 'offset': -4 } } - ]); - return { - isMeta: true - } -} -},{}],163:[function(require,module,exports){ -arguments[4][147][0].apply(exports,arguments) -},{"./Module":162,"./info.json":164,"dup":147}],164:[function(require,module,exports){ -module.exports={ - "name": "Colorbar", - "description": "Generates a colorbar to lay over the image", - "inputs": { - "colormap": { - "type": "select", - "desc": "Name of the Colormap", - "default": "default", - "values": [ - "default", - "greyscale", - "stretched", - "fastie" - ] - }, - "x": { - "type": "integer", - "desc": "X-position of the image on which the new image is overlayed", - "default": 0 - }, - "y": { - "type": "integer", - "desc": "Y-position of the image on which the new image is overlayed", - "default": 0 - }, - "h": { - "type": "iinteger", - "desc": "height of the colorbar", - "default": 10 - } - }, - "length": 4 -} -},{}],165:[function(require,module,exports){ -/* - * Accepts a value from 0-255 and returns the new color-mapped pixel - * from a lookup table, which can be specified as an array of [begin, end] - * gradients, where begin and end are represented as [r, g, b] colors. In - * combination, a lookup table which maps values from 0 - 255 smoothly from black to white looks like: - * [ - * [0, [0, 0, 0], [255, 255, 255]], - * [1, [255, 255, 255], [255, 255, 255]] - * ] - * - * Adapted from bgamari's work in Infragram: https://github.com/p-v-o-s/infragram-js/commit/346c97576a07b71a55671d17e0153b7df74e803b - */ - -module.exports = function Colormap(value, options) { - options.colormap = options.colormap || colormaps.default; - // if a lookup table is provided as an array: - if(typeof(options.colormap) == "object") - colormapFunction = colormap(options.colormap); - // if a stored colormap is named with a string like "fastie": - else if(colormaps.hasOwnProperty(options.colormap)) - colormapFunction = colormaps[options.colormap]; - else colormapFunction = colormaps.default; - return colormapFunction(value / 255.00); -} - -function colormap(segments) { - return function(x) { - var i, result, x0, x1, xstart, y0, y1, _i, _j, _len, _ref, _ref1, _ref2, _ref3; - _ref = [0, 0], y0 = _ref[0], y1 = _ref[1]; - _ref1 = [segments[0][0], 1], x0 = _ref1[0], x1 = _ref1[1]; - if (x < x0) { - return y0; - } - for (i = _i = 0, _len = segments.length; _i < _len; i = ++_i) { - _ref2 = segments[i], xstart = _ref2[0], y0 = _ref2[1], y1 = _ref2[2]; - x0 = xstart; - if (i === segments.length - 1) { - x1 = 1; - break; - } - x1 = segments[i + 1][0]; - if ((xstart <= x && x < x1)) { - break; - } - } - result = []; - for (i = _j = 0, _ref3 = y0.length; 0 <= _ref3 ? _j < _ref3 : _j > _ref3; i = 0 <= _ref3 ? ++_j : --_j) { - result[i] = (x - x0) / (x1 - x0) * (y1[i] - y0[i]) + y0[i]; - } - return result; - }; -}; - -var colormaps = { - greyscale: colormap([ - [0, [0, 0, 0], [255, 255, 255] ], - [1, [255, 255, 255], [255, 255, 255] ] - ]), - default: colormap([ - [0, [0, 0, 255], [0, 255, 0] ], - [0.25, [0, 255, 0], [255, 255, 0] ], - [0.50, [0, 255, 255], [255, 255, 0] ], - [0.75, [255, 255, 0], [255, 0, 0] ] - ]), - ndvi: colormap([ - [0, [0, 0, 255], [38, 195, 195] ], - [0.5, [0, 150, 0], [255, 255, 0] ], - [0.75, [255, 255, 0], [255, 50, 50] ] - ]), - stretched: colormap([ - [0, [0, 0, 255], [0, 0, 255] ], - [0.1, [0, 0, 255], [38, 195, 195] ], - [0.5, [0, 150, 0], [255, 255, 0] ], - [0.7, [255, 255, 0], [255, 50, 50] ], - [0.9, [255, 50, 50], [255, 50, 50] ] - ]), - fastie: colormap([ - [0, [255, 255, 255], [0, 0, 0] ], - [0.167, [0, 0, 0], [255, 255, 255] ], - [0.33, [255, 255, 255], [0, 0, 0] ], - [0.5, [0, 0, 0], [140, 140, 255] ], - [0.55, [140, 140, 255], [0, 255, 0] ], - [0.63, [0, 255, 0], [255, 255, 0] ], - [0.75, [255, 255, 0], [255, 0, 0] ], - [0.95, [255, 0, 0], [255, 0, 255] ] - ]) -} - -},{}],166:[function(require,module,exports){ -module.exports = function Colormap(options,UI) { - - var output; - - // This function is called on every draw. - function draw(input,callback,progressObj) { - - progressObj.stop(true); - progressObj.overrideFlag = true; - - var step = this; - - function changePixel(r, g, b, a) { - var combined = (r + g + b) / 3.000; - var res = require('./Colormap')(combined, options); - return [res[0], res[1], res[2], 255]; - } - - function output(image,datauri,mimetype){ - - // This output is accessible by Image Sequencer - step.output = { src: datauri, format: mimetype }; - - } - return require('../_nomodule/PixelManipulation.js')(input, { - output: output, - changePixel: changePixel, - format: input.format, - image: options.image, - inBrowser: options.inBrowser, - callback: callback - }); - - } - - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} - -},{"../_nomodule/PixelManipulation.js":207,"./Colormap":165}],167:[function(require,module,exports){ -arguments[4][147][0].apply(exports,arguments) -},{"./Module":166,"./info.json":168,"dup":147}],168:[function(require,module,exports){ -module.exports={ - "name": "Colormap", - "description": "Maps brightness values (average of red, green & blue) to a given color lookup table, made up of a set of one more color gradients.\n\nFor example, 'cooler' colors like blue could represent low values, while 'hot' colors like red could represent high values.", - "inputs": { - "colormap": { - "type": "select", - "desc": "Name of the Colormap", - "default": "default", - "values": ["default","greyscale","stretched","fastie"] - } - } -} - -},{}],169:[function(require,module,exports){ -(function (Buffer){ -module.exports = function Crop(input,options,callback) { - - var getPixels = require('get-pixels'), - savePixels = require('save-pixels'); - - options.x = parseInt(options.x) || 0; - options.y = parseInt(options.y) || 0; - - getPixels(input.src,function(err,pixels){ - options.w = parseInt(options.w) || Math.floor(pixels.shape[0]); - options.h = parseInt(options.h) || Math.floor(pixels.shape[1]); - var ox = options.x; - var oy = options.y; - var w = options.w; - var h = options.h; - var iw = pixels.shape[0]; //Width of Original Image - var newarray = new Uint8Array(4*w*h); - for (var n = oy; n < oy + h; n++) { - newarray.set(pixels.data.slice(n*4*iw + ox, n*4*iw + ox + 4*w),4*w*(n-oy)); - } - pixels.data = newarray; - pixels.shape = [w,h,4]; - pixels.stride[1] = 4*w; - - options.format = input.format; - - var chunks = []; - var totalLength = 0; - var r = savePixels(pixels, options.format); - - r.on('data', function(chunk){ - totalLength += chunk.length; - chunks.push(chunk); - }); - - r.on('end', function(){ - var data = Buffer.concat(chunks, totalLength).toString('base64'); - var datauri = 'data:image/' + options.format + ';base64,' + data; - callback(datauri,options.format); - }); - }); -}; - -}).call(this,require("buffer").Buffer) -},{"buffer":4,"get-pixels":23,"save-pixels":111}],170:[function(require,module,exports){ -/* - * Image Cropping module - * Usage: - * Expected Inputs: - * options.x : x-coordinate of image where the modules starts cropping | default : 0 - * options.y : y-coordinate of image where the modules starts cropping | default : 0 - * options.w : width of the resulting cropped image | default : 50% of input image width - * options.h : height of the resulting cropped image | default : 50% of input image height - * Output: - * The cropped image, which is essentially a rectangle bounded by the lines: - * x = options.x - * x = options.x + options.w - * y = options.y - * y = options.y + options.h - */ -module.exports = function CropModule(options, UI) { - - // we should get UI to return the image thumbnail so we can attach our own UI extensions - // add our custom in-module html ui: - if (options.step.inBrowser) var ui = require('./Ui.js')(options.step, UI); - var output, - setupComplete = false; - - // This function is caled everytime the step has to be redrawn - function draw(input,callback) { - - var step = this; - - // save the input image; - // TODO: this should be moved to module API to persist the input image - options.step.input = input.src; - - require('./Crop')(input, options, function(out, format){ - - // This output is accessible to Image Sequencer - step.output = { - src: out, - format: format - } - - // This output is accessible to the UI - options.step.output = out; - - // Tell the UI that the step has been drawn - UI.onComplete(options.step); - - // we should do this via event/listener: - if (ui && ui.hide) ui.hide(); - - // start custom UI setup (draggable UI) - // only once we have an input image - if (setupComplete === false && options.step.inBrowser) { - setupComplete = true; - ui.setup(); - } - - // Tell Image Sequencer that step has been drawn - callback(); - - }); - - } - - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} - -},{"./Crop":169,"./Ui.js":171}],171:[function(require,module,exports){ -// hide on save -module.exports = function CropModuleUi(step, ui) { - - let inputWidth = 0, - inputHeight = 0; - - // We don't have input image dimensions at the - // time of setting up the UI; that comes when draw() is triggered. - // So we trigger setup only on first run of draw() - // TODO: link this to an event rather than an explicit call in Module.js - function setup() { - let x = 0, - y = 0; - - // display original uncropped input image on initial setup - showOriginal(); - - inputWidth = Math.floor(imgEl().naturalWidth); - inputHeight = Math.floor(imgEl().naturalHeight); - - // display with 50%/50% default crop: - setOptions(x, y, inputWidth, inputHeight); - - $(imgEl()).imgAreaSelect({ - handles: true, - x1: x, - y1: y, - x2: x + inputWidth / 2, - y2: y + inputHeight / 2, - // when selection is complete - onSelectEnd: function onSelectEnd(img, selection) { - // assign crop values to module UI form inputs: - let converted = convertToNatural( - selection.x1, - selection.y1, - selection.width, - selection.height - ); - setOptions( - converted[0], - converted[1], - converted[2], - converted[3] - ); - } - }); - } - - function convertToNatural(_x, _y, _width, _height) { - let displayWidth = $(imgEl()).width(), - displayHeight = $(imgEl()).height(); - // return in same order [ x, y, width, height ]: - return [ - Math.floor(( _x / displayWidth ) * inputWidth), - Math.floor(( _y / displayHeight ) * inputHeight), - Math.floor(( _width / displayWidth ) * inputWidth), - Math.floor(( _height / displayHeight ) * inputHeight) - ] - } - - function remove() { - $(imgEl()).imgAreaSelect({ - remove: true - }); - } - - function hide() { - // then hide the draggable UI - $(imgEl()).imgAreaSelect({ - hide: true - }); - } - - // step.imgSelector is not defined, imgElement is: - function imgEl() { - return step.imgElement; - } - - function setOptions(x1, y1, width, height) { - let options = $($(imgEl()).parents()[2]).find("input"); - options[0].value = x1; - options[1].value = y1; - options[2].value = width; - options[3].value = height; - } - - // replaces currently displayed output thumbnail with the input image, for ui dragging purposes - function showOriginal() { - step.imgElement.src = step.input; - } - - return { - setup: setup, - remove: remove, - hide: hide - } -} - -},{}],172:[function(require,module,exports){ -arguments[4][147][0].apply(exports,arguments) -},{"./Module":170,"./info.json":173,"dup":147}],173:[function(require,module,exports){ -module.exports={ - "name": "Crop", - "description": "Crop image to given x, y, w, h in pixels, measured from top left", - "url": "https://github.com/publiclab/image-sequencer/tree/master/MODULES.md", - "inputs": { - "x": { - "type": "integer", - "desc": "X-position (measured from left) from where cropping starts", - "default": 0 - }, - "y": { - "type": "integer", - "desc": "Y-position (measured from top) from where cropping starts", - "default": 0 - }, - "w": { - "type": "integer", - "desc": "Width of crop", - "default": "(100%)" - }, - "h": { - "type": "integer", - "desc": "Height of crop", - "default": "(100%)" - } - } -} -},{}],174:[function(require,module,exports){ -/* - * Decodes QR from a given image. - */ -module.exports = function DoNothing(options,UI) { - - var output; - var jsQR = require('jsqr'); - var getPixels = require('get-pixels'); - - // This function is called everytime a step has to be redrawn - function draw(input,callback) { - - var step = this; - - getPixels(input.src,function(err,pixels){ - - if(err) throw err; - - var w = pixels.shape[0]; - var h = pixels.shape[1]; - var decoded = jsQR.decodeQRFromImage(pixels.data,w,h); - - // This output is accessible to Image Sequencer - step.output = input; - step.output.data = decoded; - - // Tell Image Sequencer that this step is complete - callback(); - options.step.qrval = decoded; - - }); - - } - - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} - -},{"get-pixels":23,"jsqr":61}],175:[function(require,module,exports){ -arguments[4][147][0].apply(exports,arguments) -},{"./Module":174,"./info.json":176,"dup":147}],176:[function(require,module,exports){ -module.exports={ - "name": "Decode QR", - "description": "Search for and decode a QR code in the image", - "inputs": { - }, - "outputs": { - "qrval": { - "type": "text" - } - } -} - -},{}],177:[function(require,module,exports){ -module.exports = function Dynamic(options,UI) { - - var output; - - // This function is called on every draw. - function draw(input,callback,progressObj) { - - progressObj.stop(true); - progressObj.overrideFlag = true; - - var step = this; - - // start with monochrome, but if options.red, options.green, and options.blue are set, accept them too - options.monochrome = options.monochrome || "(R+G+B)/3"; - - function generator(expression) { - var func = 'f = function (r, g, b, a) { var R = r, G = g, B = b, A = a;' - func = func + 'return '; - func = func + expression + '}'; - var f; - eval(func); - return f; - } - - var channels = ['red', 'green', 'blue', 'alpha']; - - channels.forEach(function(channel) { - if (options.hasOwnProperty(channel)) options[channel + '_function'] = generator(options[channel]); - else if (channel === 'alpha') options['alpha_function'] = function() { return 255; } - else options[channel + '_function'] = generator(options.monochrome); - }); - - function changePixel(r, g, b, a) { - - /* neighbourpixels can be calculated by - this.getNeighbourPixel.fun(x,y) or this.getNeighborPixel.fun(x,y) - */ - var combined = (r + g + b) / 3.000; - return [ - options.red_function(r, g, b, a), - options.green_function(r, g, b, a), - options.blue_function(r, g, b, a), - options.alpha_function(r, g, b, a), - ]; - } - - /* Functions to get the neighbouring pixel by position (x,y) */ - function getNeighbourPixel(pixels,curX,curY,distX,distY){ - return [ - pixels.get(curX+distX,curY+distY,0) - ,pixels.get(curX+distX,curY+distY,1) - ,pixels.get(curX+distX,curY+distY,2) - ,pixels.get(curX+distX,curY+distY,3) - ] - } - - - function output(image,datauri,mimetype){ - - // This output is accessible by Image Sequencer - step.output = { src: datauri, format: mimetype }; - - } - return require('../_nomodule/PixelManipulation.js')(input, { - output: output, - changePixel: changePixel, - getNeighbourPixel: getNeighbourPixel, - getNeighborPixel: getNeighbourPixel, - format: input.format, - image: options.image, - inBrowser: options.inBrowser, - callback: callback - }); - - } - - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} - -},{"../_nomodule/PixelManipulation.js":207}],178:[function(require,module,exports){ -arguments[4][147][0].apply(exports,arguments) -},{"./Module":177,"./info.json":179,"dup":147}],179:[function(require,module,exports){ -module.exports={ - "name": "Dynamic", - "description": "A module which accepts JavaScript math expressions to produce each color channel based on the original image's color. See Infragrammar.", - "inputs": { - "red": { - "type": "input", - "desc": "Expression to return for red channel with R, G, B, and A inputs", - "default": "r" - }, - "green": { - "type": "input", - "desc": "Expression to return for green channel with R, G, B, and A inputs", - "default": "g" - }, - "blue": { - "type": "input", - "desc": "Expression to return for blue channel with R, G, B, and A inputs", - "default": "b" - }, - "monochrome (fallback)": { - "type": "input", - "desc": "Expression to return with R, G, B, and A inputs; fallback for other channels if none provided", - "default": "r + g + b" - } - } -} - -},{}],180:[function(require,module,exports){ -const _ = require('lodash') - -//define kernels for the sobel filter -const kernelx = [[-1, 0, 1], [-2, 0, 2], [-1, 0, 1]], - kernely = [[-1, -2, -1], [0, 0, 0], [1, 2, 1]]; - -let angles = [], mags = [], strongEdgePixels = [], weakEdgePixels = [], notInUI; -module.exports = function(pixels, highThresholdRatio, lowThresholdRatio, inBrowser) { - notInUI = !inBrowser; - for (var x = 0; x < pixels.shape[0]; x++) { - angles.push([]); - mags.push([]); - for (var y = 0; y < pixels.shape[1]; y++) { - var result = changePixel( - pixels, - pixels.get(x, y, 0), - pixels.get(x, y, 3), - x, - y - ); - let pixel = result.pixel; - - pixels.set(x, y, 0, pixel[0]); - pixels.set(x, y, 1, pixel[1]); - pixels.set(x, y, 2, pixel[2]); - pixels.set(x, y, 3, pixel[3]); - - mags.slice(-1)[0].push(pixel[3]); - angles.slice(-1)[0].push(result.angle); - } - } - - return doubleThreshold(nonMaxSupress(pixels), highThresholdRatio, lowThresholdRatio); -} - -//changepixel function that convolutes every pixel (sobel filter) -function changePixel(pixels, val, a, x, y) { - let magX = 0.0; - for (let a = 0; a < 3; a++) { - for (let b = 0; b < 3; b++) { - - let xn = x + a - 1; - let yn = y + b - 1; - - magX += pixels.get(xn, yn, 0) * kernelx[a][b]; - } - } - let magY = 0.0; - for (let a = 0; a < 3; a++) { - for (let b = 0; b < 3; b++) { - - let xn = x + a - 1; - let yn = y + b - 1; - - magY += pixels.get(xn, yn, 0) * kernely[a][b]; - } - } - let mag = Math.sqrt(Math.pow(magX, 2) + Math.pow(magY, 2)); - let angle = Math.atan2(magY, magX); - return { - pixel: - [val, val, val, mag], - angle: angle - }; -} - -//Non Maximum Supression without interpolation -function nonMaxSupress(pixels) { - - angles = angles.map((arr) => arr.map(convertToDegrees)); - - for (let i = 1; i < pixels.shape[0] - 1; i++) { - for (let j = 1; j < pixels.shape[1] - 1; j++) { - - let angle = angles[i][j]; - let pixel = pixels.get(i, j); - - if ((angle >= -22.5 && angle <= 22.5) || - (angle < -157.5 && angle >= -180)) - - if ((mags[i][j] >= mags[i][j + 1]) && - (mags[i][j] >= mags[i][j - 1])) - pixels.set(i, j, 3, mags[i][j]); - else - pixels.set(i, j, 3, 0); - - else if ((angle >= 22.5 && angle <= 67.5) || - (angle < -112.5 && angle >= -157.5)) - - if ((mags[i][j] >= mags[i + 1][j + 1]) && - (mags[i][j] >= mags[i - 1][j - 1])) - pixels.set(i, j, 3, mags[i][j]); - else - pixels.set(i, j, 3, 0); - - else if ((angle >= 67.5 && angle <= 112.5) || - (angle < -67.5 && angle >= -112.5)) - - if ((mags[i][i] >= mags[i + 1][j]) && - (mags[i][j] >= mags[i][j])) - pixels.set(i, j, 3, mags[i][j]); - else - pixels.set(i, j, 3, 0); - - else if ((angle >= 112.5 && angle <= 157.5) || - (angle < -22.5 && angle >= -67.5)) - - if ((mags[i][j] >= mags[i + 1][j - 1]) && - (mags[i][j] >= mags[i - 1][j + 1])) - pixels.set(i, j, 3, mags[i][j]); - else - pixels.set(i, j, 3, 0); +const getStepUtils = require('./util/getStep.js'); + +function Run(ref, json_q, callback, ind, progressObj) { + if (!progressObj) progressObj = { stop: function() { } }; + + function drawStep(drawarray, pos) { + if (pos == drawarray.length && drawarray[pos - 1] !== undefined) { + var image = drawarray[pos - 1].image; + if (ref.objTypeOf(callback) == "Function" && ref.images[image].steps.slice(-1)[0].output) { + var steps = ref.images[image].steps; + var out = steps[steps.length - 1].output.src; + callback(out); + return true; + } + } + + // so we don't run on the loadImage module: + if (drawarray[pos] !== undefined) { + var image = drawarray[pos].image; + var i = drawarray[pos].i; + var input = ref.images[image].steps[i - 1].output; + + ref.images[image].steps[i].getStep = function getStep(offset) { + if (i + offset >= ref.images[image].steps.length) return { options: { name: undefined } }; + else return ref.images[image].steps.slice(i + offset)[0]; + }; + ref.images[image].steps[i].getIndex = function getIndex() { + return i; + } + + for (var util in getStepUtils) { + if (getStepUtils.hasOwnProperty(util)) { + ref.images[image].steps[i][util] = getStepUtils[util]; + } + } + + // Tell UI that a step is being drawn. + ref.images[image].steps[i].UI.onDraw(ref.images[image].steps[i].options.step); + + // provides a set of standard tools for each step + var inputForNextStep = require('./RunToolkit')(ref.copy(input)); + + ref.images[image].steps[i].draw( + inputForNextStep, + function onEachStep() { + + // This output is accessible by UI + ref.images[image].steps[i].options.step.output = ref.images[image].steps[i].output.src; + + // Tell UI that step has been drawn. + ref.images[image].steps[i].UI.onComplete(ref.images[image].steps[i].options.step); + + drawStep(drawarray, ++pos); + }, + progressObj + ); + } + } + + function drawSteps(json_q) { + var drawarray = []; + for (var image in json_q) { + var no_steps = ref.images[image].steps.length; + var init = json_q[image]; + for (var i = 0; i < no_steps - init; i++) { + drawarray.push({ image: image, i: init + i }); + } + } + drawStep(drawarray, ind); + } + + function filter(json_q) { + for (var image in json_q) { + if (json_q[image] == 0 && ref.images[image].steps.length == 1) + delete json_q[image]; + else if (json_q[image] == 0) json_q[image]++; + } + for (var image in json_q) { + var prevstep = ref.images[image].steps[json_q[image] - 1]; + while ( + typeof prevstep == "undefined" || + typeof prevstep.output == "undefined" + ) { + prevstep = ref.images[image].steps[--json_q[image] - 1]; + } + } + return json_q; + } + + var json_q = filter(json_q); + return drawSteps(json_q); +} +module.exports = Run; - } - } - return pixels; +},{"./RunToolkit":144,"./util/getStep.js":212}],144:[function(require,module,exports){ +const getPixels = require('get-pixels'); +const pixelManipulation = require('./modules/_nomodule/PixelManipulation'); +const lodash = require('lodash'); +const dataUriToBuffer = require('data-uri-to-buffer'); +const savePixels = require('save-pixels'); + +module.exports = function(input) { + input.getPixels = getPixels; + input.pixelManipulation = pixelManipulation; + input.lodash = lodash; + input.dataUriToBuffer = dataUriToBuffer; + input.savePixels = savePixels; + return input; } -//Converts radians to degrees -var convertToDegrees = radians => (radians * 180) / Math.PI; - -//Finds the max value in a 2d array like mags -var findMaxInMatrix = arr => Math.max(...arr.map(el => el.map(val => !!val ? val : 0)).map(el => Math.max(...el))); - -//Applies the double threshold to the image -function doubleThreshold(pixels, highThresholdRatio, lowThresholdRatio) { - - const highThreshold = findMaxInMatrix(mags) * 0.2; - const lowThreshold = highThreshold * lowThresholdRatio; +},{"./modules/_nomodule/PixelManipulation":207,"data-uri-to-buffer":13,"get-pixels":23,"lodash":62,"save-pixels":111}],145:[function(require,module,exports){ +module.exports={"sample":[{"name":"invert","options":{}},{"name":"channel","options":{"channel":"red"}},{"name":"blur","options":{"blur":"5"}}]} +},{}],146:[function(require,module,exports){ +/* +* Average all pixel colors +*/ +module.exports = function Average(options, UI){ + + options.blur = options.blur || 2 + var output; + + options.step.metadata = options.step.metadata || {}; + + function draw(input,callback,progressObj){ + + progressObj.stop(true); + progressObj.overrideFlag = true; + + var step = this; + + function changePixel(r, g, b, a){ + return [r,g,b,a] + } + + // do the averaging + function extraManipulation(pixels){ + var sum = [0,0,0,0]; + for (var i = 0; i < pixels.data.length; i += 4) { + sum[0] += pixels.data[i + 0]; + sum[1] += pixels.data[i + 1]; + sum[2] += pixels.data[i + 2]; + sum[3] += pixels.data[i + 3]; + } + + sum[0] = parseInt(sum[0] / (pixels.data.length / 4)); + sum[1] = parseInt(sum[1] / (pixels.data.length / 4)); + sum[2] = parseInt(sum[2] / (pixels.data.length / 4)); + sum[3] = parseInt(sum[3] / (pixels.data.length / 4)); + + for (var i = 0; i < pixels.data.length; i += 4) { + pixels.data[i + 0] = sum[0]; + pixels.data[i + 1] = sum[1]; + pixels.data[i + 2] = sum[2]; + pixels.data[i + 3] = sum[3]; + } + // report back and store average in metadata: + options.step.metadata.averages = sum; + console.log("average: ", sum); + // TODO: refactor into a new "display()" method as per https://github.com/publiclab/image-sequencer/issues/242 + if (options.step.inBrowser && options.step.ui) $(options.step.ui).find('.details').append("

Averages (r, g, b, a): " + sum.join(', ') + "

"); + return pixels; + } + + function output(image, datauri, mimetype){ + + // This output is accessible by Image Sequencer + step.output = { + src: datauri, + format: mimetype + }; + } + + return require('../_nomodule/PixelManipulation.js')(input, { + output: output, + changePixel: changePixel, + extraManipulation: extraManipulation, + format: input.format, + image: options.image, + callback: callback + }); + + } + return { + options: options, + draw: draw, + output: output, + UI: UI + } +} - for (let i = 0; i < pixels.shape[0]; i++) { - for (let j = 0; j < pixels.shape[1]; j++) { - let pixelPos = [i, j]; +},{"../_nomodule/PixelManipulation.js":207}],147:[function(require,module,exports){ +module.exports = [ + require('./Module'), + require('./info.json') +] +},{"./Module":146,"./info.json":148}],148:[function(require,module,exports){ +module.exports={ + "name": "Average", + "description": "Average all pixel color", + "inputs": { + } +} - mags[i][j] > lowThreshold - ? mags[i][j] > highThreshold - ? strongEdgePixels.push(pixelPos) - : weakEdgePixels.push(pixelPos) - : pixels.set(i, j, 3, 0); - } - } +},{}],149:[function(require,module,exports){ +module.exports = function Dynamic(options, UI, util) { + + options.func = options.func || "function(r1, g1, b1, a1, r2, g2, b2, a2) { return [ r1, g2, b2, a2 ] }"; + + var output; + + // This function is called on every draw. + function draw(input, callback, progressObj) { + + progressObj.stop(true); + progressObj.overrideFlag = true; + + var step = this; + + // convert to runnable code: + if (typeof options.func === "string") eval('options.func = ' + options.func); + + var getPixels = require('get-pixels'); + + // save first image's pixels + var priorStep = this.getStep(-2); + + getPixels(priorStep.output.src, function(err, pixels) { + options.firstImagePixels = pixels; + + function changePixel(r2, g2, b2, a2, x, y) { + // blend! + var p = options.firstImagePixels; + return options.func( + r2, g2, b2, a2, + p.get(x, y, 0), + p.get(x, y, 1), + p.get(x, y, 2), + p.get(x, y, 3) + ) + } + + function output(image, datauri, mimetype) { + + // This output is accessible by Image Sequencer + step.output = { src: datauri, format: mimetype }; + + } + + // run PixelManipulatin on second image's pixels + return require('../_nomodule/PixelManipulation.js')(input, { + output: output, + changePixel: changePixel, + format: input.format, + image: options.image, + inBrowser: options.inBrowser, + callback: callback + }); + }); + } + + return { + options: options, + draw: draw, + output: output, + UI: UI + } +} - strongEdgePixels.forEach(pix => pixels.set(pix[0], pix[1], 3, 255)); +},{"../_nomodule/PixelManipulation.js":207,"get-pixels":23}],150:[function(require,module,exports){ +arguments[4][147][0].apply(exports,arguments) +},{"./Module":149,"./info.json":151,"dup":147}],151:[function(require,module,exports){ +module.exports={ + "name": "Blend", + "description": "Blend the past two image steps with the given function. Defaults to using the red channel from image 1 and the green and blue and alpha channels of image 2. Easier to use interfaces coming soon!", + "inputs": { + "blend": { + "type": "input", + "desc": "Function to use to blend the two images.", + "default": "function(r1, g1, b1, a1, r2, g2, b2, a2) { return [ r1, g2, b2, a2 ] }" + } + } +} - return pixels; +},{}],152:[function(require,module,exports){ +module.exports = exports = function(pixels, blur) { + let kernel = kernelGenerator(blur, 1), oldpix = pixels; + kernel = flipKernel(kernel); + + for (let i = 0; i < pixels.shape[0]; i++) { + for (let j = 0; j < pixels.shape[1]; j++) { + let neighboutPos = getNeighbouringPixelPositions([i, j]); + let acc = [0.0, 0.0, 0.0, 0.0]; + for (let a = 0; a < kernel.length; a++) { + for (let b = 0; b < kernel.length; b++) { + acc[0] += (oldpix.get(neighboutPos[a][b][0], neighboutPos[a][b][1], 0) * kernel[a][b]); + acc[1] += (oldpix.get(neighboutPos[a][b][0], neighboutPos[a][b][1], 1) * kernel[a][b]); + acc[2] += (oldpix.get(neighboutPos[a][b][0], neighboutPos[a][b][1], 2) * kernel[a][b]); + acc[3] += (oldpix.get(neighboutPos[a][b][0], neighboutPos[a][b][1], 3) * kernel[a][b]); + } + } + pixels.set(i, j, 0, acc[0]); + pixels.set(i, j, 1, acc[1]); + pixels.set(i, j, 2, acc[2]); + } + } + return pixels; + + + + //Generates a 3x3 Gaussian kernel + function kernelGenerator(sigma, size) { + + /* + Trying out a variable radius kernel not working as of now + */ + // const coeff = (1.0/(2.0*Math.PI*sigma*sigma)) + // const expCoeff = -1 * (1.0/2.0 * sigma * sigma) + // let e = Math.E + // let result = [] + // for(let i = -1 * size;i<=size;i++){ + // let arr = [] + // for(let j= -1 * size;j<=size;j++){ + // arr.push(coeff * Math.pow(e,expCoeff * ((i * i) + (j*j)))) + // } + // result.push(arr) + // } + // let sum = result.reduce((sum,val)=>{ + // return val.reduce((sumInner,valInner)=>{ + // return sumInner+valInner + // }) + // }) + // result = result.map(arr=>arr.map(val=>(val + 0.0)/(sum + 0.0))) + + // return result + + return [ + [2.0 / 159.0, 4.0 / 159.0, 5.0 / 159.0, 4.0 / 159.0, 2.0 / 159.0], + [4.0 / 159.0, 9.0 / 159.0, 12.0 / 159.0, 9.0 / 159.0, 4.0 / 159.0], + [5.0 / 159.0, 12.0 / 159.0, 15.0 / 159.0, 12.0 / 159.0, 5.0 / 159.0], + [4.0 / 159.0, 9.0 / 159.0, 12.0 / 159.0, 9.0 / 159.0, 4.0 / 159.0], + [2.0 / 159.0, 4.0 / 159.0, 5.0 / 159.0, 4.0 / 159.0, 2.0 / 159.0] + ]; + } + function getNeighbouringPixelPositions(pixelPosition) { + let x = pixelPosition[0], y = pixelPosition[1], result = []; + + for (let i = -2; i <= 2; i++) { + let arr = []; + for (let j = -2; j <= 2; j++) + arr.push([x + i, y + j]); + + result.push(arr); + } + return result; + } + + function flipKernel(kernel) { + let result = []; + for (let i = kernel.length - 1; i >= 0; i--) { + let arr = []; + for (let j = kernel[i].length - 1; j >= 0; j--) { + arr.push(kernel[i][j]); + } + result.push(arr); + } + return result; + } } +},{}],153:[function(require,module,exports){ +/* +* Blur an Image +*/ +module.exports = function Blur(options, UI) { + + options.blur = options.blur || 2 + var output; + + function draw(input, callback, progressObj) { + + progressObj.stop(true); + progressObj.overrideFlag = true; + + var step = this; + + function changePixel(r, g, b, a) { + return [r, g, b, a] + } + + function extraManipulation(pixels) { + pixels = require('./Blur')(pixels, options.blur) + return pixels + } + + function output(image, datauri, mimetype) { + + // This output is accessible by Image Sequencer + step.output = { src: datauri, format: mimetype }; + + } + + return require('../_nomodule/PixelManipulation.js')(input, { + output: output, + changePixel: changePixel, + extraManipulation: extraManipulation, + format: input.format, + image: options.image, + callback: callback + }); + + } + return { + options: options, + draw: draw, + output: output, + UI: UI + } +} -// hysteresis edge tracking algorithm -- not working as of now -/* function hysteresis(pixels) { - function getNeighbouringPixelPositions(pixelPosition) { - let x = pixelPosition[0], y = pixelPosition[1] - return [[x + 1, y + 1], - [x + 1, y], - [x + 1, y - 1], - [x, y + 1], - [x, y - 1], - [x - 1, y + 1], - [x - 1, y], - [x - 1, y - 1]] - } - - //This can potentially be improved see https://en.wikipedia.org/wiki/Connected-component_labeling - for (weakPixel in weakEdgePixels) { - let neighbourPixels = getNeighbouringPixelPositions(weakEdgePixels[weakPixel]) - for (pixel in neighbourPixels) { - if (strongEdgePixels.find(el => _.isEqual(el, neighbourPixels[pixel]))) { - pixels.set(weakPixel[0], weakPixel[1], 3, 255) - weakEdgePixels.splice(weakPixel, weakPixel) - break - } - } - } - weakEdgePixels.forEach(pix => pixels.set(pix[0], pix[1], 3, 0)) - return pixels -} */ - - +},{"../_nomodule/PixelManipulation.js":207,"./Blur":152}],154:[function(require,module,exports){ +arguments[4][147][0].apply(exports,arguments) +},{"./Module":153,"./info.json":155,"dup":147}],155:[function(require,module,exports){ +module.exports={ + "name": "Blur", + "description": "Gaussian blur an image by a given value, typically 0-5", + "inputs": { + "blur": { + "type": "integer", + "desc": "amount of gaussian blur(Less blur gives more detail, typically 0-5)", + "default": 2 + } + } +} +},{}],156:[function(require,module,exports){ +/* +* Changes the Image Brightness +*/ + +module.exports = function Brightness(options,UI){ + + var output; + + function draw(input,callback,progressObj){ + + progressObj.stop(true); + progressObj.overrideFlag = true; + + /* + In this case progress is handled by changepixel internally otherwise progressObj + needs to be overriden and used + For eg. progressObj = new SomeProgressModule() + */ + + var step = this; + + function changePixel(r, g, b, a){ + var val = (options.brightness)/100.0 + + r = val*r<255?val*r:255 + g = val*g<255?val*g:255 + b = val*b<255?val*b:255 + return [r , g, b, a] + } + + function output(image,datauri,mimetype){ + + // This output is accessible by Image Sequencer + step.output = {src:datauri,format:mimetype}; + + } + + return require('../_nomodule/PixelManipulation.js')(input, { + output: output, + changePixel: changePixel, + format: input.format, + image: options.image, + inBrowser: options.inBrowser, + callback: callback + }); + + } + return { + options: options, + draw: draw, + output: output, + UI: UI + } +} -},{"lodash":62}],181:[function(require,module,exports){ -/* -* Detect Edges in an Image -*/ -module.exports = function edgeDetect(options,UI) { +},{"../_nomodule/PixelManipulation.js":207}],157:[function(require,module,exports){ +arguments[4][147][0].apply(exports,arguments) +},{"./Module":156,"./info.json":158,"dup":147}],158:[function(require,module,exports){ +module.exports={ + "name": "Brightness", + "description": "Change the brightness of the image by given percent value", + "inputs": { + "brightness": { + "type": "integer", + "desc": "% brightness for the new image", + "default": 0 + } + } +} - options.blur = options.blur || 2; - options.highThresholdRatio = options.highThresholdRatio||0.2; - options.lowThresholdRatio = options.lowThresholdRatio||0.15; +},{}],159:[function(require,module,exports){ +/* + * Display only one color channel + */ +module.exports = function Channel(options, UI) { + + options.channel = options.channel || "green"; + + var output; + + function draw(input, callback, progressObj) { + + progressObj.stop(true); + progressObj.overrideFlag = true; + + var step = this; + + function changePixel(r, g, b, a) { + if (options.channel == "red") return [r, 0, 0, a]; + if (options.channel == "green") return [0, g, 0, a]; + if (options.channel == "blue") return [0, 0, b, a]; + } + + function output(image, datauri, mimetype) { + + // This output is accesible by Image Sequencer + step.output = { src: datauri, format: mimetype }; + + } + + return require('../_nomodule/PixelManipulation.js')(input, { + output: output, + changePixel: changePixel, + format: input.format, + image: options.image, + inBrowser: options.inBrowser, + callback: callback + }); + + } + + return { + options: options, + //setup: setup, // optional + draw: draw, + output: output, + UI: UI + } +} - var output; +},{"../_nomodule/PixelManipulation.js":207}],160:[function(require,module,exports){ +arguments[4][147][0].apply(exports,arguments) +},{"./Module":159,"./info.json":161,"dup":147}],161:[function(require,module,exports){ +module.exports={ + "name": "Channel", + "description": "Displays only one color channel of an image -- default is green", + "inputs": { + "channel": { + "type": "select", + "desc": "Color channel", + "default": "green", + "values": ["red", "green", "blue"] + } + } +} - // The function which is called on every draw. - function draw(input,callback,progressObj) { +},{}],162:[function(require,module,exports){ +module.exports = function NdviColormapfunction(options, UI) { + + options.x = options.x || 0; + options.y = options.y || 0; + options.colormap = options.colormap || "default"; + options.h = options.h || 10; + this.expandSteps([ + { 'name': 'gradient', 'options': {} }, + { 'name': 'colormap', 'options': { colormap: options.colormap } }, + { 'name': 'crop', 'options': { 'y': 0, 'h': options.h } }, + { 'name': 'overlay', 'options': { 'x': options.x, 'y': options.y, 'offset': -4 } } + ]); + return { + isMeta: true + } +} +},{}],163:[function(require,module,exports){ +arguments[4][147][0].apply(exports,arguments) +},{"./Module":162,"./info.json":164,"dup":147}],164:[function(require,module,exports){ +module.exports={ + "name": "Colorbar", + "description": "Generates a colorbar to lay over the image", + "inputs": { + "colormap": { + "type": "select", + "desc": "Name of the Colormap", + "default": "default", + "values": [ + "default", + "greyscale", + "stretched", + "fastie" + ] + }, + "x": { + "type": "integer", + "desc": "X-position of the image on which the new image is overlayed", + "default": 0 + }, + "y": { + "type": "integer", + "desc": "Y-position of the image on which the new image is overlayed", + "default": 0 + }, + "h": { + "type": "iinteger", + "desc": "height of the colorbar", + "default": 10 + } + }, + "length": 4 +} +},{}],165:[function(require,module,exports){ +/* + * Accepts a value from 0-255 and returns the new color-mapped pixel + * from a lookup table, which can be specified as an array of [begin, end] + * gradients, where begin and end are represented as [r, g, b] colors. In + * combination, a lookup table which maps values from 0 - 255 smoothly from black to white looks like: + * [ + * [0, [0, 0, 0], [255, 255, 255]], + * [1, [255, 255, 255], [255, 255, 255]] + * ] + * + * Adapted from bgamari's work in Infragram: https://github.com/p-v-o-s/infragram-js/commit/346c97576a07b71a55671d17e0153b7df74e803b + */ + +module.exports = function Colormap(value, options) { + options.colormap = options.colormap || colormaps.default; + // if a lookup table is provided as an array: + if(typeof(options.colormap) == "object") + colormapFunction = colormap(options.colormap); + // if a stored colormap is named with a string like "fastie": + else if(colormaps.hasOwnProperty(options.colormap)) + colormapFunction = colormaps[options.colormap]; + else colormapFunction = colormaps.default; + return colormapFunction(value / 255.00); +} + +function colormap(segments) { + return function(x) { + var i, result, x0, x1, xstart, y0, y1, _i, _j, _len, _ref, _ref1, _ref2, _ref3; + _ref = [0, 0], y0 = _ref[0], y1 = _ref[1]; + _ref1 = [segments[0][0], 1], x0 = _ref1[0], x1 = _ref1[1]; + if (x < x0) { + return y0; + } + for (i = _i = 0, _len = segments.length; _i < _len; i = ++_i) { + _ref2 = segments[i], xstart = _ref2[0], y0 = _ref2[1], y1 = _ref2[2]; + x0 = xstart; + if (i === segments.length - 1) { + x1 = 1; + break; + } + x1 = segments[i + 1][0]; + if ((xstart <= x && x < x1)) { + break; + } + } + result = []; + for (i = _j = 0, _ref3 = y0.length; 0 <= _ref3 ? _j < _ref3 : _j > _ref3; i = 0 <= _ref3 ? ++_j : --_j) { + result[i] = (x - x0) / (x1 - x0) * (y1[i] - y0[i]) + y0[i]; + } + return result; + }; +}; + +var colormaps = { + greyscale: colormap([ + [0, [0, 0, 0], [255, 255, 255] ], + [1, [255, 255, 255], [255, 255, 255] ] + ]), + default: colormap([ + [0, [0, 0, 255], [0, 255, 0] ], + [0.25, [0, 255, 0], [255, 255, 0] ], + [0.50, [0, 255, 255], [255, 255, 0] ], + [0.75, [255, 255, 0], [255, 0, 0] ] + ]), + ndvi: colormap([ + [0, [0, 0, 255], [38, 195, 195] ], + [0.5, [0, 150, 0], [255, 255, 0] ], + [0.75, [255, 255, 0], [255, 50, 50] ] + ]), + stretched: colormap([ + [0, [0, 0, 255], [0, 0, 255] ], + [0.1, [0, 0, 255], [38, 195, 195] ], + [0.5, [0, 150, 0], [255, 255, 0] ], + [0.7, [255, 255, 0], [255, 50, 50] ], + [0.9, [255, 50, 50], [255, 50, 50] ] + ]), + fastie: colormap([ + [0, [255, 255, 255], [0, 0, 0] ], + [0.167, [0, 0, 0], [255, 255, 255] ], + [0.33, [255, 255, 255], [0, 0, 0] ], + [0.5, [0, 0, 0], [140, 140, 255] ], + [0.55, [140, 140, 255], [0, 255, 0] ], + [0.63, [0, 255, 0], [255, 255, 0] ], + [0.75, [255, 255, 0], [255, 0, 0] ], + [0.95, [255, 0, 0], [255, 0, 255] ] + ]) +} - progressObj.stop(true); - progressObj.overrideFlag = true; +},{}],166:[function(require,module,exports){ +module.exports = function Colormap(options,UI) { + + var output; + + // This function is called on every draw. + function draw(input,callback,progressObj) { + + progressObj.stop(true); + progressObj.overrideFlag = true; + + var step = this; + + function changePixel(r, g, b, a) { + var combined = (r + g + b) / 3.000; + var res = require('./Colormap')(combined, options); + return [res[0], res[1], res[2], 255]; + } + + function output(image,datauri,mimetype){ + + // This output is accessible by Image Sequencer + step.output = { src: datauri, format: mimetype }; + + } + return require('../_nomodule/PixelManipulation.js')(input, { + output: output, + changePixel: changePixel, + format: input.format, + image: options.image, + inBrowser: options.inBrowser, + callback: callback + }); + + } + + return { + options: options, + draw: draw, + output: output, + UI: UI + } +} - var step = this; +},{"../_nomodule/PixelManipulation.js":207,"./Colormap":165}],167:[function(require,module,exports){ +arguments[4][147][0].apply(exports,arguments) +},{"./Module":166,"./info.json":168,"dup":147}],168:[function(require,module,exports){ +module.exports={ + "name": "Colormap", + "description": "Maps brightness values (average of red, green & blue) to a given color lookup table, made up of a set of one more color gradients.\n\nFor example, 'cooler' colors like blue could represent low values, while 'hot' colors like red could represent high values.", + "inputs": { + "colormap": { + "type": "select", + "desc": "Name of the Colormap", + "default": "default", + "values": ["default","greyscale","stretched","fastie"] + } + } +} +},{}],169:[function(require,module,exports){ +(function (Buffer){ +module.exports = function Crop(input,options,callback) { + + var getPixels = require('get-pixels'), + savePixels = require('save-pixels'); + + options.x = parseInt(options.x) || 0; + options.y = parseInt(options.y) || 0; + + getPixels(input.src,function(err,pixels){ + options.w = parseInt(options.w) || Math.floor(pixels.shape[0]); + options.h = parseInt(options.h) || Math.floor(pixels.shape[1]); + var ox = options.x; + var oy = options.y; + var w = options.w; + var h = options.h; + var iw = pixels.shape[0]; //Width of Original Image + var newarray = new Uint8Array(4*w*h); + for (var n = oy; n < oy + h; n++) { + newarray.set(pixels.data.slice(n*4*iw + ox, n*4*iw + ox + 4*w),4*w*(n-oy)); + } + pixels.data = newarray; + pixels.shape = [w,h,4]; + pixels.stride[1] = 4*w; + + options.format = input.format; + + var chunks = []; + var totalLength = 0; + var r = savePixels(pixels, options.format); + + r.on('data', function(chunk){ + totalLength += chunk.length; + chunks.push(chunk); + }); + + r.on('end', function(){ + var data = Buffer.concat(chunks, totalLength).toString('base64'); + var datauri = 'data:image/' + options.format + ';base64,' + data; + callback(datauri,options.format); + }); + }); +}; - // Extra Manipulation function used as an enveloper for applying gaussian blur and Convolution - function extraManipulation(pixels){ - pixels = require('ndarray-gaussian-filter')(pixels,options.blur); - return require('./EdgeUtils')(pixels,options.highThresholdRatio,options.lowThresholdRatio,options.inBrowser); - } +}).call(this,require("buffer").Buffer) +},{"buffer":4,"get-pixels":23,"save-pixels":111}],170:[function(require,module,exports){ +/* + * Image Cropping module + * Usage: + * Expected Inputs: + * options.x : x-coordinate of image where the modules starts cropping | default : 0 + * options.y : y-coordinate of image where the modules starts cropping | default : 0 + * options.w : width of the resulting cropped image | default : 50% of input image width + * options.h : height of the resulting cropped image | default : 50% of input image height + * Output: + * The cropped image, which is essentially a rectangle bounded by the lines: + * x = options.x + * x = options.x + options.w + * y = options.y + * y = options.y + options.h + */ +module.exports = function CropModule(options, UI) { + + // we should get UI to return the image thumbnail so we can attach our own UI extensions + // add our custom in-module html ui: + if (options.step.inBrowser) var ui = require('./Ui.js')(options.step, UI); + var output, + setupComplete = false; + + // This function is caled everytime the step has to be redrawn + function draw(input,callback) { + + var step = this; + + // save the input image; + // TODO: this should be moved to module API to persist the input image + options.step.input = input.src; + + require('./Crop')(input, options, function(out, format){ + + // This output is accessible to Image Sequencer + step.output = { + src: out, + format: format + } + + // This output is accessible to the UI + options.step.output = out; + + // Tell the UI that the step has been drawn + UI.onComplete(options.step); + + // we should do this via event/listener: + if (ui && ui.hide) ui.hide(); + + // start custom UI setup (draggable UI) + // only once we have an input image + if (setupComplete === false && options.step.inBrowser) { + setupComplete = true; + ui.setup(); + } + + // Tell Image Sequencer that step has been drawn + callback(); + + }); + + } + + return { + options: options, + draw: draw, + output: output, + UI: UI + } +} - function changePixel(r, g, b, a) { - return [(r+g+b)/3, (r+g+b)/3, (r+g+b)/3, a]; - } +},{"./Crop":169,"./Ui.js":171}],171:[function(require,module,exports){ +// hide on save +module.exports = function CropModuleUi(step, ui) { + + let inputWidth = 0, + inputHeight = 0; + + // We don't have input image dimensions at the + // time of setting up the UI; that comes when draw() is triggered. + // So we trigger setup only on first run of draw() + // TODO: link this to an event rather than an explicit call in Module.js + function setup() { + let x = 0, + y = 0; + + // display original uncropped input image on initial setup + showOriginal(); + + inputWidth = Math.floor(imgEl().naturalWidth); + inputHeight = Math.floor(imgEl().naturalHeight); + + // display with 50%/50% default crop: + setOptions(x, y, inputWidth, inputHeight); + + $(imgEl()).imgAreaSelect({ + handles: true, + x1: x, + y1: y, + x2: x + inputWidth / 2, + y2: y + inputHeight / 2, + // when selection is complete + onSelectEnd: function onSelectEnd(img, selection) { + // assign crop values to module UI form inputs: + let converted = convertToNatural( + selection.x1, + selection.y1, + selection.width, + selection.height + ); + setOptions( + converted[0], + converted[1], + converted[2], + converted[3] + ); + } + }); + } + + function convertToNatural(_x, _y, _width, _height) { + let displayWidth = $(imgEl()).width(), + displayHeight = $(imgEl()).height(); + // return in same order [ x, y, width, height ]: + return [ + Math.floor(( _x / displayWidth ) * inputWidth), + Math.floor(( _y / displayHeight ) * inputHeight), + Math.floor(( _width / displayWidth ) * inputWidth), + Math.floor(( _height / displayHeight ) * inputHeight) + ] + } + + function remove() { + $(imgEl()).imgAreaSelect({ + remove: true + }); + } + + function hide() { + // then hide the draggable UI + $(imgEl()).imgAreaSelect({ + hide: true + }); + } + + // step.imgSelector is not defined, imgElement is: + function imgEl() { + return step.imgElement; + } + + function setOptions(x1, y1, width, height) { + let options = $($(imgEl()).parents()[2]).find("input"); + options[0].value = x1; + options[1].value = y1; + options[2].value = width; + options[3].value = height; + } + + // replaces currently displayed output thumbnail with the input image, for ui dragging purposes + function showOriginal() { + step.imgElement.src = step.input; + } + + return { + setup: setup, + remove: remove, + hide: hide + } +} - function output(image,datauri,mimetype){ +},{}],172:[function(require,module,exports){ +arguments[4][147][0].apply(exports,arguments) +},{"./Module":170,"./info.json":173,"dup":147}],173:[function(require,module,exports){ +module.exports={ + "name": "Crop", + "description": "Crop image to given x, y, w, h in pixels, measured from top left", + "url": "https://github.com/publiclab/image-sequencer/tree/master/MODULES.md", + "inputs": { + "x": { + "type": "integer", + "desc": "X-position (measured from left) from where cropping starts", + "default": 0 + }, + "y": { + "type": "integer", + "desc": "Y-position (measured from top) from where cropping starts", + "default": 0 + }, + "w": { + "type": "integer", + "desc": "Width of crop", + "default": "(100%)" + }, + "h": { + "type": "integer", + "desc": "Height of crop", + "default": "(100%)" + } + } +} +},{}],174:[function(require,module,exports){ +/* + * Decodes QR from a given image. + */ +module.exports = function DoNothing(options,UI) { + + var output; + var jsQR = require('jsqr'); + var getPixels = require('get-pixels'); + + // This function is called everytime a step has to be redrawn + function draw(input,callback) { + + var step = this; + + getPixels(input.src,function(err,pixels){ + + if(err) throw err; + + var w = pixels.shape[0]; + var h = pixels.shape[1]; + var decoded = jsQR.decodeQRFromImage(pixels.data,w,h); + + // This output is accessible to Image Sequencer + step.output = input; + step.output.data = decoded; + + // Tell Image Sequencer that this step is complete + callback(); + options.step.qrval = decoded; + + }); + + } + + return { + options: options, + draw: draw, + output: output, + UI: UI + } +} - // This output is accessible by Image Sequencer - step.output = {src:datauri,format:mimetype}; +},{"get-pixels":23,"jsqr":61}],175:[function(require,module,exports){ +arguments[4][147][0].apply(exports,arguments) +},{"./Module":174,"./info.json":176,"dup":147}],176:[function(require,module,exports){ +module.exports={ + "name": "Decode QR", + "description": "Search for and decode a QR code in the image", + "inputs": { + }, + "outputs": { + "qrval": { + "type": "text" + } + } +} - } +},{}],177:[function(require,module,exports){ +module.exports = function Dynamic(options,UI) { + + var output; + + // This function is called on every draw. + function draw(input,callback,progressObj) { + + progressObj.stop(true); + progressObj.overrideFlag = true; + + var step = this; + + // start with monochrome, but if options.red, options.green, and options.blue are set, accept them too + options.monochrome = options.monochrome || "(R+G+B)/3"; + + function generator(expression) { + var func = 'f = function (r, g, b, a) { var R = r, G = g, B = b, A = a;' + func = func + 'return '; + func = func + expression + '}'; + var f; + eval(func); + return f; + } + + var channels = ['red', 'green', 'blue', 'alpha']; + + channels.forEach(function(channel) { + if (options.hasOwnProperty(channel)) options[channel + '_function'] = generator(options[channel]); + else if (channel === 'alpha') options['alpha_function'] = function() { return 255; } + else options[channel + '_function'] = generator(options.monochrome); + }); + + function changePixel(r, g, b, a) { + + /* neighbourpixels can be calculated by + this.getNeighbourPixel.fun(x,y) or this.getNeighborPixel.fun(x,y) + */ + var combined = (r + g + b) / 3.000; + return [ + options.red_function(r, g, b, a), + options.green_function(r, g, b, a), + options.blue_function(r, g, b, a), + options.alpha_function(r, g, b, a), + ]; + } + + /* Functions to get the neighbouring pixel by position (x,y) */ + function getNeighbourPixel(pixels,curX,curY,distX,distY){ + return [ + pixels.get(curX+distX,curY+distY,0) + ,pixels.get(curX+distX,curY+distY,1) + ,pixels.get(curX+distX,curY+distY,2) + ,pixels.get(curX+distX,curY+distY,3) + ] + } + + + function output(image,datauri,mimetype){ + + // This output is accessible by Image Sequencer + step.output = { src: datauri, format: mimetype }; + + } + return require('../_nomodule/PixelManipulation.js')(input, { + output: output, + changePixel: changePixel, + getNeighbourPixel: getNeighbourPixel, + getNeighborPixel: getNeighbourPixel, + format: input.format, + image: options.image, + inBrowser: options.inBrowser, + callback: callback + }); + + } + + return { + options: options, + draw: draw, + output: output, + UI: UI + } +} - return require('../_nomodule/PixelManipulation.js')(input, { - output: output, - changePixel: changePixel, - extraManipulation: extraManipulation, - format: input.format, - image: options.image, - inBrowser: options.inBrowser, - callback: callback - }); +},{"../_nomodule/PixelManipulation.js":207}],178:[function(require,module,exports){ +arguments[4][147][0].apply(exports,arguments) +},{"./Module":177,"./info.json":179,"dup":147}],179:[function(require,module,exports){ +module.exports={ + "name": "Dynamic", + "description": "A module which accepts JavaScript math expressions to produce each color channel based on the original image's color. See Infragrammar.", + "inputs": { + "red": { + "type": "input", + "desc": "Expression to return for red channel with R, G, B, and A inputs", + "default": "r" + }, + "green": { + "type": "input", + "desc": "Expression to return for green channel with R, G, B, and A inputs", + "default": "g" + }, + "blue": { + "type": "input", + "desc": "Expression to return for blue channel with R, G, B, and A inputs", + "default": "b" + }, + "monochrome (fallback)": { + "type": "input", + "desc": "Expression to return with R, G, B, and A inputs; fallback for other channels if none provided", + "default": "r + g + b" + } + } +} - } +},{}],180:[function(require,module,exports){ +const _ = require('lodash') + +//define kernels for the sobel filter +const kernelx = [[-1, 0, 1], [-2, 0, 2], [-1, 0, 1]], + kernely = [[-1, -2, -1], [0, 0, 0], [1, 2, 1]]; + +let angles = [], mags = [], strongEdgePixels = [], weakEdgePixels = [], notInUI; +module.exports = function(pixels, highThresholdRatio, lowThresholdRatio, inBrowser) { + notInUI = !inBrowser; + for (var x = 0; x < pixels.shape[0]; x++) { + angles.push([]); + mags.push([]); + for (var y = 0; y < pixels.shape[1]; y++) { + var result = changePixel( + pixels, + pixels.get(x, y, 0), + pixels.get(x, y, 3), + x, + y + ); + let pixel = result.pixel; + + pixels.set(x, y, 0, pixel[0]); + pixels.set(x, y, 1, pixel[1]); + pixels.set(x, y, 2, pixel[2]); + pixels.set(x, y, 3, pixel[3]); + + mags.slice(-1)[0].push(pixel[3]); + angles.slice(-1)[0].push(result.angle); + } + } + + return doubleThreshold(nonMaxSupress(pixels), highThresholdRatio, lowThresholdRatio); +} + +//changepixel function that convolutes every pixel (sobel filter) +function changePixel(pixels, val, a, x, y) { + let magX = 0.0; + for (let a = 0; a < 3; a++) { + for (let b = 0; b < 3; b++) { + + let xn = x + a - 1; + let yn = y + b - 1; + + magX += pixels.get(xn, yn, 0) * kernelx[a][b]; + } + } + let magY = 0.0; + for (let a = 0; a < 3; a++) { + for (let b = 0; b < 3; b++) { + + let xn = x + a - 1; + let yn = y + b - 1; + + magY += pixels.get(xn, yn, 0) * kernely[a][b]; + } + } + let mag = Math.sqrt(Math.pow(magX, 2) + Math.pow(magY, 2)); + let angle = Math.atan2(magY, magX); + return { + pixel: + [val, val, val, mag], + angle: angle + }; +} + +//Non Maximum Supression without interpolation +function nonMaxSupress(pixels) { + + angles = angles.map((arr) => arr.map(convertToDegrees)); + + for (let i = 1; i < pixels.shape[0] - 1; i++) { + for (let j = 1; j < pixels.shape[1] - 1; j++) { + + let angle = angles[i][j]; + let pixel = pixels.get(i, j); + + if ((angle >= -22.5 && angle <= 22.5) || + (angle < -157.5 && angle >= -180)) + + if ((mags[i][j] >= mags[i][j + 1]) && + (mags[i][j] >= mags[i][j - 1])) + pixels.set(i, j, 3, mags[i][j]); + else + pixels.set(i, j, 3, 0); + + else if ((angle >= 22.5 && angle <= 67.5) || + (angle < -112.5 && angle >= -157.5)) + + if ((mags[i][j] >= mags[i + 1][j + 1]) && + (mags[i][j] >= mags[i - 1][j - 1])) + pixels.set(i, j, 3, mags[i][j]); + else + pixels.set(i, j, 3, 0); + + else if ((angle >= 67.5 && angle <= 112.5) || + (angle < -67.5 && angle >= -112.5)) + + if ((mags[i][i] >= mags[i + 1][j]) && + (mags[i][j] >= mags[i][j])) + pixels.set(i, j, 3, mags[i][j]); + else + pixels.set(i, j, 3, 0); + + else if ((angle >= 112.5 && angle <= 157.5) || + (angle < -22.5 && angle >= -67.5)) + + if ((mags[i][j] >= mags[i + 1][j - 1]) && + (mags[i][j] >= mags[i - 1][j + 1])) + pixels.set(i, j, 3, mags[i][j]); + else + pixels.set(i, j, 3, 0); + + } + } + return pixels; +} +//Converts radians to degrees +var convertToDegrees = radians => (radians * 180) / Math.PI; + +//Finds the max value in a 2d array like mags +var findMaxInMatrix = arr => Math.max(...arr.map(el => el.map(val => !!val ? val : 0)).map(el => Math.max(...el))); + +//Applies the double threshold to the image +function doubleThreshold(pixels, highThresholdRatio, lowThresholdRatio) { + + const highThreshold = findMaxInMatrix(mags) * 0.2; + const lowThreshold = highThreshold * lowThresholdRatio; + + for (let i = 0; i < pixels.shape[0]; i++) { + for (let j = 0; j < pixels.shape[1]; j++) { + let pixelPos = [i, j]; + + mags[i][j] > lowThreshold + ? mags[i][j] > highThreshold + ? strongEdgePixels.push(pixelPos) + : weakEdgePixels.push(pixelPos) + : pixels.set(i, j, 3, 0); + } + } + + strongEdgePixels.forEach(pix => pixels.set(pix[0], pix[1], 3, 255)); + + return pixels; +} + +// hysteresis edge tracking algorithm -- not working as of now +/* function hysteresis(pixels) { + function getNeighbouringPixelPositions(pixelPosition) { + let x = pixelPosition[0], y = pixelPosition[1] + return [[x + 1, y + 1], + [x + 1, y], + [x + 1, y - 1], + [x, y + 1], + [x, y - 1], + [x - 1, y + 1], + [x - 1, y], + [x - 1, y - 1]] + } + + //This can potentially be improved see https://en.wikipedia.org/wiki/Connected-component_labeling + for (weakPixel in weakEdgePixels) { + let neighbourPixels = getNeighbouringPixelPositions(weakEdgePixels[weakPixel]) + for (pixel in neighbourPixels) { + if (strongEdgePixels.find(el => _.isEqual(el, neighbourPixels[pixel]))) { + pixels.set(weakPixel[0], weakPixel[1], 3, 255) + weakEdgePixels.splice(weakPixel, weakPixel) + break + } + } + } + weakEdgePixels.forEach(pix => pixels.set(pix[0], pix[1], 3, 0)) + return pixels +} */ + + + - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} +},{"lodash":62}],181:[function(require,module,exports){ +/* +* Detect Edges in an Image +*/ +module.exports = function edgeDetect(options,UI) { + + options.blur = options.blur || 2; + options.highThresholdRatio = options.highThresholdRatio||0.2; + options.lowThresholdRatio = options.lowThresholdRatio||0.15; + + var output; + + // The function which is called on every draw. + function draw(input,callback,progressObj) { + + progressObj.stop(true); + progressObj.overrideFlag = true; + + var step = this; + + + // Extra Manipulation function used as an enveloper for applying gaussian blur and Convolution + function extraManipulation(pixels){ + pixels = require('ndarray-gaussian-filter')(pixels,options.blur); + return require('./EdgeUtils')(pixels,options.highThresholdRatio,options.lowThresholdRatio,options.inBrowser); + } + + function changePixel(r, g, b, a) { + return [(r+g+b)/3, (r+g+b)/3, (r+g+b)/3, a]; + } + + function output(image,datauri,mimetype){ + + // This output is accessible by Image Sequencer + step.output = {src:datauri,format:mimetype}; + + } + + return require('../_nomodule/PixelManipulation.js')(input, { + output: output, + changePixel: changePixel, + extraManipulation: extraManipulation, + format: input.format, + image: options.image, + inBrowser: options.inBrowser, + callback: callback + }); + + } + + return { + options: options, + draw: draw, + output: output, + UI: UI + } +} },{"../_nomodule/PixelManipulation.js":207,"./EdgeUtils":180,"ndarray-gaussian-filter":67}],182:[function(require,module,exports){ arguments[4][147][0].apply(exports,arguments) },{"./Module":181,"./info.json":183,"dup":147}],183:[function(require,module,exports){ -module.exports={ - "name": "Detect Edges", - "description": "this module detects edges using the Canny method, which first Gaussian blurs the image to reduce noise (amount of blur configurable in settings as `options.blur`), then applies a number of steps to highlight edges, resulting in a greyscale image where the brighter the pixel, the stronger the detected edge. Read more at: https://en.wikipedia.org/wiki/Canny_edge_detector", - "inputs": { - "blur": { - "type": "integer", - "desc": "amount of gaussian blur(Less blur gives more detail, typically 0-5)", - "default": 2 - }, - "highThresholdRatio":{ - "type": "float", - "desc": "The high threshold ratio for the image", - "default": 0.2 - }, - "lowThresholdRatio": { - "type": "float", - "desc": "The low threshold value for the image", - "default": 0.15 - } - } -} +module.exports={ + "name": "Detect Edges", + "description": "this module detects edges using the Canny method, which first Gaussian blurs the image to reduce noise (amount of blur configurable in settings as `options.blur`), then applies a number of steps to highlight edges, resulting in a greyscale image where the brighter the pixel, the stronger the detected edge. Read more at: https://en.wikipedia.org/wiki/Canny_edge_detector", + "inputs": { + "blur": { + "type": "integer", + "desc": "amount of gaussian blur(Less blur gives more detail, typically 0-5)", + "default": 2 + }, + "highThresholdRatio":{ + "type": "float", + "desc": "The high threshold ratio for the image", + "default": 0.2 + }, + "lowThresholdRatio": { + "type": "float", + "desc": "The low threshold value for the image", + "default": 0.15 + } + } +} },{}],184:[function(require,module,exports){ -/* - * Resolves Fisheye Effect - */ -module.exports = function DoNothing(options,UI) { - - var output; - - require('fisheyegl'); - - function draw(input,callback) { - - var step = this; - - if (!options.inBrowser) { // This module is only for browser - this.output = input; - callback(); - } - else { - // Create a canvas, if it doesn't already exist. - if (!document.querySelector('#image-sequencer-canvas')) { - var canvas = document.createElement('canvas'); - canvas.style.display = "none"; - canvas.setAttribute('id','image-sequencer-canvas'); - document.body.append(canvas); - } - else var canvas = document.querySelector('#image-sequencer-canvas'); - - distorter = FisheyeGl({ - selector: "#image-sequencer-canvas" - }); - - // Parse the inputs - options.a = parseFloat(options.a) || distorter.lens.a; - options.b = parseFloat(options.b) || distorter.lens.b; - options.Fx = parseFloat(options.Fx) || distorter.lens.Fx; - options.Fy = parseFloat(options.Fy) || distorter.lens.Fy; - options.scale = parseFloat(options.scale) || distorter.lens.scale; - options.x = parseFloat(options.x) || distorter.fov.x; - options.y = parseFloat(options.y) || distorter.fov.y; - - // Set fisheyegl inputs - distorter.lens.a = options.a; - distorter.lens.b = options.b; - distorter.lens.Fx = options.Fx; - distorter.lens.Fy = options.Fy; - distorter.lens.scale = options.scale; - distorter.fov.x = options.x; - distorter.fov.y = options.y; - - // generate fisheyegl output - distorter.setImage(input.src,function(){ - - // this output is accessible to Image Sequencer - step.output = {src: canvas.toDataURL(), format: input.format}; - - // Tell Image Sequencer and UI that step has been drawn - callback(); - - }); - - } - } - - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} +/* + * Resolves Fisheye Effect + */ +module.exports = function DoNothing(options,UI) { + + var output; + + require('fisheyegl'); + + function draw(input,callback) { + + var step = this; + + if (!options.inBrowser) { // This module is only for browser + this.output = input; + callback(); + } + else { + // Create a canvas, if it doesn't already exist. + if (!document.querySelector('#image-sequencer-canvas')) { + var canvas = document.createElement('canvas'); + canvas.style.display = "none"; + canvas.setAttribute('id','image-sequencer-canvas'); + document.body.append(canvas); + } + else var canvas = document.querySelector('#image-sequencer-canvas'); + + distorter = FisheyeGl({ + selector: "#image-sequencer-canvas" + }); + + // Parse the inputs + options.a = parseFloat(options.a) || distorter.lens.a; + options.b = parseFloat(options.b) || distorter.lens.b; + options.Fx = parseFloat(options.Fx) || distorter.lens.Fx; + options.Fy = parseFloat(options.Fy) || distorter.lens.Fy; + options.scale = parseFloat(options.scale) || distorter.lens.scale; + options.x = parseFloat(options.x) || distorter.fov.x; + options.y = parseFloat(options.y) || distorter.fov.y; + + // Set fisheyegl inputs + distorter.lens.a = options.a; + distorter.lens.b = options.b; + distorter.lens.Fx = options.Fx; + distorter.lens.Fy = options.Fy; + distorter.lens.scale = options.scale; + distorter.fov.x = options.x; + distorter.fov.y = options.y; + + // generate fisheyegl output + distorter.setImage(input.src,function(){ + + // this output is accessible to Image Sequencer + step.output = {src: canvas.toDataURL(), format: input.format}; + + // Tell Image Sequencer and UI that step has been drawn + callback(); + + }); + + } + } + + return { + options: options, + draw: draw, + output: output, + UI: UI + } +} },{"fisheyegl":15}],185:[function(require,module,exports){ arguments[4][147][0].apply(exports,arguments) },{"./Module":184,"./info.json":186,"dup":147}],186:[function(require,module,exports){ -module.exports={ - "name": "Fisheye GL", - "description": "Correct fisheye, or barrel distortion, in images (with WebGL -- adapted from fisheye-correction-webgl by @bluemir).", - "requires": [ "webgl" ], - "inputs": { - "a": { - "type": "float", - "desc": "a parameter", - "default": 1, - "min": 1, - "max": 4 - }, - "b": { - "type": "float", - "desc": "b parameter", - "default": 1, - "min": 1, - "max": 4 - }, - "Fx": { - "type": "float", - "desc": "Fx parameter", - "default": 0, - "min": 0, - "max": 4 - }, - "Fy": { - "type": "float", - "desc": "Fy parameter", - "default": 0, - "min": 0, - "max": 4 - }, - "scale": { - "type": "float", - "desc": "Image Scaling", - "default": 1.5, - "min": 0, - "max": 20 - }, - "x": { - "type": "float", - "desc": "FOV x parameter", - "default": 1.5, - "min": 0, - "max": 20 - }, - "y": { - "type": "float", - "desc": "FOV y parameter", - "default": 1.5, - "min": 0, - "max": 20 - }, - "fragmentSrc": { - "type": "PATH", - "desc": "Patht to a WebGL fragment shader file", - "default": "(inbuilt)" - }, - "vertexSrc": { - "type": "PATH", - "desc": "Patht to a WebGL vertex shader file", - "default": "(inbuilt)" - } - } -} +module.exports={ + "name": "Fisheye GL", + "description": "Correct fisheye, or barrel distortion, in images (with WebGL -- adapted from fisheye-correction-webgl by @bluemir).", + "requires": [ "webgl" ], + "inputs": { + "a": { + "type": "float", + "desc": "a parameter", + "default": 1, + "min": 1, + "max": 4 + }, + "b": { + "type": "float", + "desc": "b parameter", + "default": 1, + "min": 1, + "max": 4 + }, + "Fx": { + "type": "float", + "desc": "Fx parameter", + "default": 0, + "min": 0, + "max": 4 + }, + "Fy": { + "type": "float", + "desc": "Fy parameter", + "default": 0, + "min": 0, + "max": 4 + }, + "scale": { + "type": "float", + "desc": "Image Scaling", + "default": 1.5, + "min": 0, + "max": 20 + }, + "x": { + "type": "float", + "desc": "FOV x parameter", + "default": 1.5, + "min": 0, + "max": 20 + }, + "y": { + "type": "float", + "desc": "FOV y parameter", + "default": 1.5, + "min": 0, + "max": 20 + }, + "fragmentSrc": { + "type": "PATH", + "desc": "Patht to a WebGL fragment shader file", + "default": "(inbuilt)" + }, + "vertexSrc": { + "type": "PATH", + "desc": "Patht to a WebGL vertex shader file", + "default": "(inbuilt)" + } + } +} },{}],187:[function(require,module,exports){ (function (Buffer){ -module.exports = function Invert(options, UI) { - - var output; - - // The function which is called on every draw. - function draw(input, callback, progressObj) { - var getPixels = require('get-pixels'); - var savePixels = require('save-pixels'); - - var step = this; - - getPixels(input.src, function(err, pixels) { - - if (err) { - console.log("Bad Image path"); - return; - } - var width = 0; - - for (var i = 0; i < pixels.shape[0]; i++) width++; - - for (var i = 0; i < pixels.shape[0]; i++) { - for (var j = 0; j < pixels.shape[1]; j++) { - let val = (i / width) * 255; - pixels.set(i, j, 0, val); - pixels.set(i, j, 1, val); - pixels.set(i, j, 2, val); - pixels.set(i, j, 3, 255); - } - } - var chunks = []; - var totalLength = 0; - var r = savePixels(pixels, input.format, { quality: 100 }); - - r.on("data", function(chunk) { - totalLength += chunk.length; - chunks.push(chunk); - }); - - r.on("end", function() { - var data = Buffer.concat(chunks, totalLength).toString("base64"); - var datauri = "data:image/" + input.format + ";base64," + data; - output(input.image, datauri, input.format); - callback(); - }); - }); - - function output(image, datauri, mimetype) { - - // This output is accessible by Image Sequencer - step.output = { src: datauri, format: mimetype }; - - } - } - - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} +module.exports = function Invert(options, UI) { + + var output; + + // The function which is called on every draw. + function draw(input, callback, progressObj) { + var getPixels = require('get-pixels'); + var savePixels = require('save-pixels'); + + var step = this; + + getPixels(input.src, function(err, pixels) { + + if (err) { + console.log("Bad Image path"); + return; + } + var width = 0; + + for (var i = 0; i < pixels.shape[0]; i++) width++; + + for (var i = 0; i < pixels.shape[0]; i++) { + for (var j = 0; j < pixels.shape[1]; j++) { + let val = (i / width) * 255; + pixels.set(i, j, 0, val); + pixels.set(i, j, 1, val); + pixels.set(i, j, 2, val); + pixels.set(i, j, 3, 255); + } + } + var chunks = []; + var totalLength = 0; + var r = savePixels(pixels, input.format, { quality: 100 }); + + r.on("data", function(chunk) { + totalLength += chunk.length; + chunks.push(chunk); + }); + + r.on("end", function() { + var data = Buffer.concat(chunks, totalLength).toString("base64"); + var datauri = "data:image/" + input.format + ";base64," + data; + output(input.image, datauri, input.format); + callback(); + }); + }); + + function output(image, datauri, mimetype) { + + // This output is accessible by Image Sequencer + step.output = { src: datauri, format: mimetype }; + + } + } + + return { + options: options, + draw: draw, + output: output, + UI: UI + } +} }).call(this,require("buffer").Buffer) },{"buffer":4,"get-pixels":23,"save-pixels":111}],188:[function(require,module,exports){ arguments[4][147][0].apply(exports,arguments) },{"./Module":187,"./info.json":189,"dup":147}],189:[function(require,module,exports){ -module.exports={ - "name": "Gradient", - "description": "Gives a gradient of the image", - "inputs": {} +module.exports={ + "name": "Gradient", + "description": "Gives a gradient of the image", + "inputs": {} } },{}],190:[function(require,module,exports){ -/* - * Import Image module; this fetches a given remote or local image via URL - * or data-url, and overwrites the current one. It saves the original as - * step.metadata.input for use in future modules such as blending. - * TODO: we could accept an operation for blending like "screen" or "overlay", - * or a function with blend(r1,g1,b1,a1,r2,g2,b2,a2), OR we could simply allow - * subsequent modules to do this blending and keep this one simple. - */ -module.exports = function ImportImageModule(options, UI) { - - options.imageUrl = options.url || "./images/monarch.png"; - - var output, - imgObj = new Image(); - - // we should get UI to return the image thumbnail so we can attach our own UI extensions - - // add our custom in-module html ui: - if (options.step.inBrowser) { - var ui = require('./Ui.js')(options.step, UI); - ui.setup(); - } - - // This function is caled everytime the step has to be redrawn - function draw(input,callback) { - - var step = this; - - step.metadata = step.metadata || {}; - // TODO: develop a standard API method for saving each input state, - // for reference in future steps (for blending, for example) - step.metadata.input = input; - - function onLoad() { - - // This output is accessible to Image Sequencer - step.output = { - src: imgObj.src, - format: options.format - } - - // Tell Image Sequencer that step has been drawn - callback(); - } - - options.format = require('../../util/GetFormat')(options.imageUrl); - imgObj.onload = onLoad; - imgObj.src = options.imageUrl; - - } - - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} +/* + * Import Image module; this fetches a given remote or local image via URL + * or data-url, and overwrites the current one. It saves the original as + * step.metadata.input for use in future modules such as blending. + * TODO: we could accept an operation for blending like "screen" or "overlay", + * or a function with blend(r1,g1,b1,a1,r2,g2,b2,a2), OR we could simply allow + * subsequent modules to do this blending and keep this one simple. + */ +module.exports = function ImportImageModule(options, UI) { + + options.imageUrl = options.url || "./images/monarch.png"; + + var output, + imgObj = new Image(); + + // we should get UI to return the image thumbnail so we can attach our own UI extensions + + // add our custom in-module html ui: + if (options.step.inBrowser) { + var ui = require('./Ui.js')(options.step, UI); + ui.setup(); + } + + // This function is caled everytime the step has to be redrawn + function draw(input,callback) { + + var step = this; + + step.metadata = step.metadata || {}; + // TODO: develop a standard API method for saving each input state, + // for reference in future steps (for blending, for example) + step.metadata.input = input; + + function onLoad() { + + // This output is accessible to Image Sequencer + step.output = { + src: imgObj.src, + format: options.format + } + + // Tell Image Sequencer that step has been drawn + callback(); + } + + options.format = require('../../util/GetFormat')(options.imageUrl); + imgObj.onload = onLoad; + imgObj.src = options.imageUrl; + + } + + return { + options: options, + draw: draw, + output: output, + UI: UI + } +} },{"../../util/GetFormat":211,"./Ui.js":191}],191:[function(require,module,exports){ -// hide on save -module.exports = function ImportImageModuleUi(step, ui) { - - function setup(setImage, onLoad) { - - // generate a unique timestamp based id for the dropzone - var dropzoneId = 'dropzone-import-image-' + step.ID; - - // add a file input listener - var dropZone ='\ -
\ -

\ - Select or drag in an image to overlay.\ -

\ -
\ - \ -
\ -
'; - - // insert into .details area - // TODO: develop API-based consistent way to add UI elements - $(step.ui) - .find('.details') - .prepend(dropZone); - - // setup file input listener - sequencer.setInputStep({ - dropZoneSelector: "#" + dropzoneId, - fileInputSelector: "#" + dropzoneId + " .file-input", - onLoad: function onLoadFromInput(progress) { - var reader = progress.target; - step.options.imageUrl = reader.result; - step.options.url = reader.result; - sequencer.run(); - setUrlHashParameter("steps", sequencer.toString()); - } - }); - - $(step.ui) - .find('.btn-save').on('click', function onClickSave() { - - var src = $(step.ui) - .find('.det input').val(); - step.options.imageUrl = src; - sequencer.run(); - - }); - - } - - return { - setup: setup - } -} +// hide on save +module.exports = function ImportImageModuleUi(step, ui) { + + function setup(setImage, onLoad) { + + // generate a unique timestamp based id for the dropzone + var dropzoneId = 'dropzone-import-image-' + step.ID; + + // add a file input listener + var dropZone ='\ +
\ +

\ + Select or drag in an image to overlay.\ +

\ +
\ + \ +
\ +
'; + + // insert into .details area + // TODO: develop API-based consistent way to add UI elements + $(step.ui) + .find('.details') + .prepend(dropZone); + + // setup file input listener + sequencer.setInputStep({ + dropZoneSelector: "#" + dropzoneId, + fileInputSelector: "#" + dropzoneId + " .file-input", + onLoad: function onLoadFromInput(progress) { + var reader = progress.target; + step.options.imageUrl = reader.result; + step.options.url = reader.result; + sequencer.run(); + setUrlHashParameter("steps", sequencer.toString()); + } + }); + + $(step.ui) + .find('.btn-save').on('click', function onClickSave() { + + var src = $(step.ui) + .find('.det input').val(); + step.options.imageUrl = src; + sequencer.run(); + + }); + + } + + return { + setup: setup + } +} },{}],192:[function(require,module,exports){ arguments[4][147][0].apply(exports,arguments) },{"./Module":190,"./info.json":193,"dup":147}],193:[function(require,module,exports){ -module.exports={ - "name": "Import Image", - "description": "Import a new image and replace the original with it. Future versions may enable a blend mode. Specify an image by URL or by file selector.", - "url": "https://github.com/publiclab/image-sequencer/tree/master/MODULES.md", - "inputs": { - "url": { - "type": "string", - "desc": "URL of image to import", - "default": "./images/monarch.png" - } - } +module.exports={ + "name": "Import Image", + "description": "Import a new image and replace the original with it. Future versions may enable a blend mode. Specify an image by URL or by file selector.", + "url": "https://github.com/publiclab/image-sequencer/tree/master/MODULES.md", + "inputs": { + "url": { + "type": "string", + "desc": "URL of image to import", + "default": "./images/monarch.png" + } + } } },{}],194:[function(require,module,exports){ -/* - * NDVI with red filter (blue channel is infrared) - */ -module.exports = function Ndvi(options, UI) { - - if (options.step.inBrowser) var ui = require('./Ui.js')(options.step, UI); - - options.filter = options.filter || "red"; - - var output; - - // The function which is called on every draw. - function draw(input, callback, progressObj) { - - progressObj.stop(true); - progressObj.overrideFlag = true; - - var step = this; - - function changePixel(r, g, b, a) { - if (options.filter == "red") var ndvi = (b - r) / (1.00 * b + r); - if (options.filter == "blue") var ndvi = (r - b) / (1.00 * b + r); - var x = 255 * (ndvi + 1) / 2; - return [x, x, x, a]; - } - - function output(image, datauri, mimetype) { - - // This output is accessible by Image Sequencer - step.output = { src: datauri, format: mimetype }; - - } - - function modifiedCallback() { - if (options.step.inBrowser) { - ui.setup(); - } - callback(); - } - - return require('../_nomodule/PixelManipulation.js')(input, { - output: output, - changePixel: changePixel, - format: input.format, - image: options.image, - inBrowser: options.inBrowser, - callback: modifiedCallback - }); - - } - - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} - -},{"../_nomodule/PixelManipulation.js":207,"./Ui.js":195}],195:[function(require,module,exports){ -// hide on save -module.exports = function CropModuleUi(step, ui) { - - /* sets the pixel value under the mouse pointer - * on the title attribute of the image element. - */ - function setup() { - var ndviImage = $(imgEl()); - - ndviImage.mousemove(function ndviMousemove(e) { - - var canvas = document.createElement("canvas"); - canvas.width = ndviImage.width(); - canvas.height = ndviImage.height(); - canvas.getContext('2d').drawImage(this, 0, 0); - - var offset = $(this).offset(); - var xPos = e.pageX - offset.left; - var yPos = e.pageY - offset.top; - var ndvi = canvas.getContext('2d').getImageData(xPos, yPos, 1, 1).data[0]; - ndvi = ndvi/127.5 - 1 ; - ndvi = ndvi.toFixed(2); - ndviImage[0].title = "NDVI: " + ndvi; - }); - } - // step.imgSelector is not defined, imgElement is: - function imgEl() { - return step.imgElement; - } - - return { - setup: setup - } -} - -},{}],196:[function(require,module,exports){ -arguments[4][147][0].apply(exports,arguments) -},{"./Module":194,"./info.json":197,"dup":147}],197:[function(require,module,exports){ -module.exports={ - "name": "NDVI", - "description": "Normalized Difference Vegetation Index, or NDVI, is an image analysis technique used with aerial photography. It's a way to visualize the amounts of infrared and other wavelengths of light reflected from vegetation by comparing ratios of blue and red light absorbed versus green and IR light reflected. NDVI is used to evaluate the health of vegetation in satellite imagery, where it correlates with how much photosynthesis is happening. This is helpful in assessing vegetative health or stress. Read more.

This is designed for use with red-filtered single camera DIY Infragram cameras; change to 'blue' for blue filters", - "inputs": { - "filter": { - "type": "select", - "desc": "Filter color", - "default": "red", - "values": ["red", "blue"] - } - } -} - -},{}],198:[function(require,module,exports){ -/* - * Sample Meta Module for demonstration purpose only - */ -module.exports = function NdviColormapfunction() { - this.expandSteps([{ 'name': 'ndvi', 'options': {} }, { 'name': 'colormap', options: {} }]); - return { - isMeta: true - } +/* + * Sample Meta Module for demonstration purpose only + */ +module.exports = function NdviColormapfunction() { + this.expandSteps([{ 'name': 'ndvi', 'options': {} }, { 'name': 'colormap', options: {} }]); + return { + isMeta: true + } } -},{}],199:[function(require,module,exports){ +},{}],195:[function(require,module,exports){ arguments[4][147][0].apply(exports,arguments) -},{"./Module":198,"./info.json":200,"dup":147}],200:[function(require,module,exports){ -module.exports={ - "name": "NDVI-Colormap", - "description": "Sequentially Applies NDVI and Colormap steps", - "inputs": {}, - "length": 2 -} -},{}],201:[function(require,module,exports){ -module.exports = function Dynamic(options, UI, util) { - - options.x = options.x || 0; - options.y = options.y || 0; - - var output; - - // This function is called on every draw. - function draw(input, callback, progressObj) { - - options.offset = options.offset || -2; - - progressObj.stop(true); - progressObj.overrideFlag = true; - - var step = this; - - // save the pixels of the base image - var baseStepImage = this.getStep(options.offset).image; - var baseStepOutput = this.getOutput(options.offset); - - var getPixels = require('get-pixels'); - - getPixels(input.src, function(err, pixels) { - options.secondImagePixels = pixels; - - function changePixel(r1, g1, b1, a1, x, y) { - - // overlay - var p = options.secondImagePixels; - if (x >= options.x - && x < p.shape[0] - && y >= options.y - && y < p.shape[1]) - return [ - p.get(x, y, 0), - p.get(x, y, 1), - p.get(x, y, 2), - p.get(x, y, 3) - ]; - else - return [r1, g1, b1, a1]; - } - - function output(image, datauri, mimetype) { - - // This output is accessible by Image Sequencer - step.output = { src: datauri, format: mimetype }; - - } - - // run PixelManipulation on first Image pixels - return require('../_nomodule/PixelManipulation.js')(baseStepOutput, { - output: output, - changePixel: changePixel, - format: baseStepOutput.format, - image: baseStepImage, - inBrowser: options.inBrowser, - callback: callback - }); - }); - } +},{"./Module":194,"./info.json":196,"dup":147}],196:[function(require,module,exports){ +module.exports={ + "name": "NDVI-Colormap", + "description": "Sequentially Applies NDVI and Colormap steps", + "inputs": {}, + "length": 2 +} +},{}],197:[function(require,module,exports){ +/* + * NDVI with red filter (blue channel is infrared) + */ +module.exports = function Ndvi(options, UI) { + + if (options.step.inBrowser) var ui = require('./Ui.js')(options.step, UI); + + options.filter = options.filter || "red"; + + var output; + + // The function which is called on every draw. + function draw(input, callback, progressObj) { + + progressObj.stop(true); + progressObj.overrideFlag = true; + + var step = this; + + function changePixel(r, g, b, a) { + if (options.filter == "red") var ndvi = (b - r) / (1.00 * b + r); + if (options.filter == "blue") var ndvi = (r - b) / (1.00 * b + r); + var x = 255 * (ndvi + 1) / 2; + return [x, x, x, a]; + } + + function output(image, datauri, mimetype) { + + // This output is accessible by Image Sequencer + step.output = { src: datauri, format: mimetype }; + + } + + function modifiedCallback() { + if (options.step.inBrowser) { + ui.setup(); + } + callback(); + } + + return require('../_nomodule/PixelManipulation.js')(input, { + output: output, + changePixel: changePixel, + format: input.format, + image: options.image, + inBrowser: options.inBrowser, + callback: modifiedCallback + }); + + } + + return { + options: options, + draw: draw, + output: output, + UI: UI + } +} - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} +},{"../_nomodule/PixelManipulation.js":207,"./Ui.js":198}],198:[function(require,module,exports){ +// hide on save +module.exports = function CropModuleUi(step, ui) { + + /* sets the pixel value under the mouse pointer + * on the title attribute of the image element. + */ + function setup() { + var ndviImage = $(imgEl()); + + ndviImage.mousemove(function ndviMousemove(e) { + + var canvas = document.createElement("canvas"); + canvas.width = ndviImage.width(); + canvas.height = ndviImage.height(); + canvas.getContext('2d').drawImage(this, 0, 0); + + var offset = $(this).offset(); + var xPos = e.pageX - offset.left; + var yPos = e.pageY - offset.top; + var ndvi = canvas.getContext('2d').getImageData(xPos, yPos, 1, 1).data[0]; + ndvi = ndvi/127.5 - 1 ; + ndvi = ndvi.toFixed(2); + ndviImage[0].title = "NDVI: " + ndvi; + }); + } + // step.imgSelector is not defined, imgElement is: + function imgEl() { + return step.imgElement; + } + + return { + setup: setup + } +} -},{"../_nomodule/PixelManipulation.js":207,"get-pixels":23}],202:[function(require,module,exports){ +},{}],199:[function(require,module,exports){ arguments[4][147][0].apply(exports,arguments) -},{"./Module":201,"./info.json":203,"dup":147}],203:[function(require,module,exports){ -module.exports={ - "name": "Overlay", - "description": "Overlays an Image over another at a given position(x,y)", - "inputs": { - "x": { - "type": "integer", - "desc": "X-position of the image on which the new image is overlayed", - "default": 0 - }, - "y": { - "type": "integer", - "desc": "Y-position of the image on which the new image is overlayed", - "default": 0 - }, - "offset": { - "type": "integer", - "desc": "offset to the output of the step on which the output of the last step is overlayed", - "default": -2 - } - } -} -},{}],204:[function(require,module,exports){ -/* - * Saturate an image with a value from 0 to 1 - */ -module.exports = function Saturation(options,UI) { - - var output; - - function draw(input,callback,progressObj) { - - progressObj.stop(true); - progressObj.overrideFlag = true; - - var step = this; - - function changePixel(r, g, b, a) { - - var cR = 0.299; - var cG = 0.587; - var cB = 0.114; - - var p = Math.sqrt((cR * (r*r)) + (cG * (g*g)) + (cB * (g*g))); - - r = p+(r-p)*(options.saturation); - g = p+(g-p)*(options.saturation); - b = p+(b-p)*(options.saturation); - - - return [Math.round(r), Math.round(g), Math.round(b), a]; - } - - function output(image,datauri,mimetype){ - - // This output is accesible by Image Sequencer - step.output = {src:datauri,format:mimetype}; - - } - - return require('../_nomodule/PixelManipulation.js')(input, { - output: output, - changePixel: changePixel, - format: input.format, - image: options.image, - inBrowser: options.inBrowser, - callback: callback - }); +},{"./Module":197,"./info.json":200,"dup":147}],200:[function(require,module,exports){ +module.exports={ + "name": "NDVI", + "description": "Normalized Difference Vegetation Index, or NDVI, is an image analysis technique used with aerial photography. It's a way to visualize the amounts of infrared and other wavelengths of light reflected from vegetation by comparing ratios of blue and red light absorbed versus green and IR light reflected. NDVI is used to evaluate the health of vegetation in satellite imagery, where it correlates with how much photosynthesis is happening. This is helpful in assessing vegetative health or stress. Read more.

This is designed for use with red-filtered single camera DIY Infragram cameras; change to 'blue' for blue filters", + "inputs": { + "filter": { + "type": "select", + "desc": "Filter color", + "default": "red", + "values": ["red", "blue"] + } + } +} - } +},{}],201:[function(require,module,exports){ +module.exports = function Dynamic(options, UI, util) { + + options.x = options.x || 0; + options.y = options.y || 0; + + var output; + + // This function is called on every draw. + function draw(input, callback, progressObj) { + + options.offset = options.offset || -2; + + progressObj.stop(true); + progressObj.overrideFlag = true; + + var step = this; + + // save the pixels of the base image + var baseStepImage = this.getStep(options.offset).image; + var baseStepOutput = this.getOutput(options.offset); + + var getPixels = require('get-pixels'); + + getPixels(input.src, function(err, pixels) { + options.secondImagePixels = pixels; + + function changePixel(r1, g1, b1, a1, x, y) { + + // overlay + var p = options.secondImagePixels; + if (x >= options.x + && x < p.shape[0] + && y >= options.y + && y < p.shape[1]) + return [ + p.get(x, y, 0), + p.get(x, y, 1), + p.get(x, y, 2), + p.get(x, y, 3) + ]; + else + return [r1, g1, b1, a1]; + } + + function output(image, datauri, mimetype) { + + // This output is accessible by Image Sequencer + step.output = { src: datauri, format: mimetype }; + + } + + // run PixelManipulation on first Image pixels + return require('../_nomodule/PixelManipulation.js')(baseStepOutput, { + output: output, + changePixel: changePixel, + format: baseStepOutput.format, + image: baseStepImage, + inBrowser: options.inBrowser, + callback: callback + }); + }); + } + + return { + options: options, + draw: draw, + output: output, + UI: UI + } +} - return { - options: options, - //setup: setup, // optional - draw: draw, - output: output, - UI: UI - } +},{"../_nomodule/PixelManipulation.js":207,"get-pixels":23}],202:[function(require,module,exports){ +arguments[4][147][0].apply(exports,arguments) +},{"./Module":201,"./info.json":203,"dup":147}],203:[function(require,module,exports){ +module.exports={ + "name": "Overlay", + "description": "Overlays an Image over another at a given position(x,y)", + "inputs": { + "x": { + "type": "integer", + "desc": "X-position of the image on which the new image is overlayed", + "default": 0 + }, + "y": { + "type": "integer", + "desc": "Y-position of the image on which the new image is overlayed", + "default": 0 + }, + "offset": { + "type": "integer", + "desc": "offset to the output of the step on which the output of the last step is overlayed", + "default": -2 + } + } } +},{}],204:[function(require,module,exports){ +/* + * Saturate an image with a value from 0 to 1 + */ +module.exports = function Saturation(options,UI) { + + var output; + + function draw(input,callback,progressObj) { + + progressObj.stop(true); + progressObj.overrideFlag = true; + + var step = this; + + function changePixel(r, g, b, a) { + + var cR = 0.299; + var cG = 0.587; + var cB = 0.114; + + var p = Math.sqrt((cR * (r*r)) + (cG * (g*g)) + (cB * (g*g))); + + r = p+(r-p)*(options.saturation); + g = p+(g-p)*(options.saturation); + b = p+(b-p)*(options.saturation); + + + return [Math.round(r), Math.round(g), Math.round(b), a]; + } + + function output(image,datauri,mimetype){ + + // This output is accesible by Image Sequencer + step.output = {src:datauri,format:mimetype}; + + } + + return require('../_nomodule/PixelManipulation.js')(input, { + output: output, + changePixel: changePixel, + format: input.format, + image: options.image, + inBrowser: options.inBrowser, + callback: callback + }); + + } + + return { + options: options, + //setup: setup, // optional + draw: draw, + output: output, + UI: UI + } +} },{"../_nomodule/PixelManipulation.js":207}],205:[function(require,module,exports){ arguments[4][147][0].apply(exports,arguments) },{"./Module":204,"./info.json":206,"dup":147}],206:[function(require,module,exports){ -module.exports={ - "name": "Saturation", - "description": "Change the saturation of the image by given value, from 0-1, with 1 being 100% saturated.", - "inputs": { - "saturation": { - "type": "integer", - "desc": "saturation for the new image between 0 and 2, 0 being black and white and 2 being highly saturated", - "default": 0 - } - } -} +module.exports={ + "name": "Saturation", + "description": "Change the saturation of the image by given value, from 0-1, with 1 being 100% saturated.", + "inputs": { + "saturation": { + "type": "integer", + "desc": "saturation for the new image between 0 and 2, 0 being black and white and 2 being highly saturated", + "default": 0 + } + } +} },{}],207:[function(require,module,exports){ (function (process,Buffer){ -/* -* General purpose per-pixel manipulation -* accepting a changePixel() method to remix a pixel's channels -*/ -module.exports = function PixelManipulation(image, options) { - - // To handle the case where pixelmanipulation is called on the input object itself - // like input.pixelManipulation(options) - if(arguments.length <= 1){ - options = image; - image = this; - } - - options = options || {}; - options.changePixel = - options.changePixel || - function changePixel(r, g, b, a) { - return [r, g, b, a]; - }; - - // - options.extraManipulation = - options.extraManipulation || - function extraManipulation(pixels) { - return pixels; - }; - - var getPixels = require("get-pixels"), - savePixels = require("save-pixels"); - - getPixels(image.src, function (err, pixels) { - if (err) { - console.log("Bad image path", image); - return; - } - - if (options.getNeighbourPixel) { - options.getNeighbourPixel.fun = function getNeighborPixel(distX, distY) { - return options.getNeighbourPixel(pixels, x, y, distX, distY); - }; - } - - // iterate through pixels; - // TODO: this could possibly be more efficient; see - // https://github.com/p-v-o-s/infragram-js/blob/master/public/infragram.js#L173-L181 - - if (!options.inBrowser && !process.env.TEST) { - try { - var pace = require("pace")(pixels.shape[0] * pixels.shape[1]); - } catch (e) { - options.inBrowser = true; - } - } - - for (var x = 0; x < pixels.shape[0]; x++) { - for (var y = 0; y < pixels.shape[1]; y++) { - var pixel = options.changePixel( - pixels.get(x, y, 0), - pixels.get(x, y, 1), - pixels.get(x, y, 2), - pixels.get(x, y, 3), - x, - y - ); - - pixels.set(x, y, 0, pixel[0]); - pixels.set(x, y, 1, pixel[1]); - pixels.set(x, y, 2, pixel[2]); - pixels.set(x, y, 3, pixel[3]); - - if (!options.inBrowser && !process.env.TEST) pace.op(); - } - } - - // perform any extra operations on the entire array: - if (options.extraManipulation) pixels = options.extraManipulation(pixels); - - // there may be a more efficient means to encode an image object, - // but node modules and their documentation are essentially arcane on this point - var chunks = []; - var totalLength = 0; - var r = savePixels(pixels, options.format, { quality: 100 }); - - r.on("data", function (chunk) { - totalLength += chunk.length; - chunks.push(chunk); - }); - - r.on("end", function () { - var data = Buffer.concat(chunks, totalLength).toString("base64"); - var datauri = "data:image/" + options.format + ";base64," + data; - if (options.output) - options.output(options.image, datauri, options.format); - if (options.callback) options.callback(); - }); - }); -}; +/* +* General purpose per-pixel manipulation +* accepting a changePixel() method to remix a pixel's channels +*/ +module.exports = function PixelManipulation(image, options) { + + // To handle the case where pixelmanipulation is called on the input object itself + // like input.pixelManipulation(options) + if(arguments.length <= 1){ + options = image; + image = this; + } + + options = options || {}; + options.changePixel = + options.changePixel || + function changePixel(r, g, b, a) { + return [r, g, b, a]; + }; + + // + options.extraManipulation = + options.extraManipulation || + function extraManipulation(pixels) { + return pixels; + }; + + var getPixels = require("get-pixels"), + savePixels = require("save-pixels"); + + getPixels(image.src, function (err, pixels) { + if (err) { + console.log("Bad image path", image); + return; + } + + if (options.getNeighbourPixel) { + options.getNeighbourPixel.fun = function getNeighborPixel(distX, distY) { + return options.getNeighbourPixel(pixels, x, y, distX, distY); + }; + } + + // iterate through pixels; + // TODO: this could possibly be more efficient; see + // https://github.com/p-v-o-s/infragram-js/blob/master/public/infragram.js#L173-L181 + + if (!options.inBrowser && !process.env.TEST) { + try { + var pace = require("pace")(pixels.shape[0] * pixels.shape[1]); + } catch (e) { + options.inBrowser = true; + } + } + + for (var x = 0; x < pixels.shape[0]; x++) { + for (var y = 0; y < pixels.shape[1]; y++) { + var pixel = options.changePixel( + pixels.get(x, y, 0), + pixels.get(x, y, 1), + pixels.get(x, y, 2), + pixels.get(x, y, 3), + x, + y + ); + + pixels.set(x, y, 0, pixel[0]); + pixels.set(x, y, 1, pixel[1]); + pixels.set(x, y, 2, pixel[2]); + pixels.set(x, y, 3, pixel[3]); + + if (!options.inBrowser && !process.env.TEST) pace.op(); + } + } + + // perform any extra operations on the entire array: + if (options.extraManipulation) pixels = options.extraManipulation(pixels); + + // there may be a more efficient means to encode an image object, + // but node modules and their documentation are essentially arcane on this point + var chunks = []; + var totalLength = 0; + var r = savePixels(pixels, options.format, { quality: 100 }); + + r.on("data", function (chunk) { + totalLength += chunk.length; + chunks.push(chunk); + }); + + r.on("end", function () { + var data = Buffer.concat(chunks, totalLength).toString("base64"); + var datauri = "data:image/" + options.format + ";base64," + data; + if (options.output) + options.output(options.image, datauri, options.format); + if (options.callback) options.callback(); + }); + }); +}; }).call(this,require('_process'),require("buffer").Buffer) },{"_process":98,"buffer":4,"get-pixels":23,"pace":74,"save-pixels":111}],208:[function(require,module,exports){ -// special module to load an image into the start of the sequence; used in the HTML UI -function LoadImage(ref, name, src, main_callback) { - function makeImage(datauri) { - var image = { - src: datauri, - format: datauri.split(':')[1].split(';')[0].split('/')[1] - } - return image; - } - function CImage(src, callback) { - var datauri; - if (!!src.match(/^data:/i)) { - datauri = src; - callback(datauri); - } - else if (!ref.options.inBrowser && !!src.match(/^https?:\/\//i)) { - require( src.match(/^(https?):\/\//i)[1] ).get(src,function(res){ - var data = ''; - var contentType = res.headers['content-type']; - res.setEncoding('base64'); - res.on('data',function(chunk) {data += chunk;}); - res.on('end',function() { - callback("data:"+contentType+";base64,"+data); - }); - }); - } - else if (ref.options.inBrowser) { - var ext = src.split('.').pop(); - var image = document.createElement('img'); - var canvas = document.createElement('canvas'); - var context = canvas.getContext('2d'); - image.onload = function() { - canvas.width = image.naturalWidth; - canvas.height = image.naturalHeight; - context.drawImage(image,0,0); - datauri = canvas.toDataURL(ext); - callback(datauri); - } - image.src = src; - } - else { - datauri = require('urify')(src); - callback(datauri); - } - } - - function loadImage(name, src) { - var step = { - name: "load-image", - description: "This initial step loads and displays the original image without any modifications.

To work with a new or different image, drag one into the drop zone.", - ID: ref.options.sequencerCounter++, - imageName: name, - inBrowser: ref.options.inBrowser, - ui: ref.options.ui - }; - - var image = { - src: src, - steps: [{ - options: { - id: step.ID, - name: "load-image", - description: "This initial step loads and displays the original image without any modifications.", - title: "Load Image", - step: step - }, - UI: ref.events, - draw: function() { - UI.onDraw(options.step); - if(arguments.length==1){ - this.output = CImage(arguments[0]); - options.step.output = this.output; - UI.onComplete(options.step); - return true; - } - else if(arguments.length==2) { - this.output = CImage(arguments[0]); - options.step.output = this.output; - arguments[1](); - UI.onComplete(options.step); - return true; - } - return false; - }, - }] - }; - CImage(src, function(datauri) { - var output = makeImage(datauri); - ref.images[name] = image; - var loadImageStep = ref.images[name].steps[0]; - loadImageStep.output = output; - loadImageStep.options.step.output = loadImageStep.output.src; - loadImageStep.UI.onSetup(loadImageStep.options.step); - loadImageStep.UI.onDraw(loadImageStep.options.step); - loadImageStep.UI.onComplete(loadImageStep.options.step); - - main_callback(); - return true; - }); - } - - return loadImage(name,src); -} - -module.exports = LoadImage; +// special module to load an image into the start of the sequence; used in the HTML UI +function LoadImage(ref, name, src, main_callback) { + function makeImage(datauri) { + var image = { + src: datauri, + format: datauri.split(':')[1].split(';')[0].split('/')[1] + } + return image; + } + function CImage(src, callback) { + var datauri; + if (!!src.match(/^data:/i)) { + datauri = src; + callback(datauri); + } + else if (!ref.options.inBrowser && !!src.match(/^https?:\/\//i)) { + require( src.match(/^(https?):\/\//i)[1] ).get(src,function(res){ + var data = ''; + var contentType = res.headers['content-type']; + res.setEncoding('base64'); + res.on('data',function(chunk) {data += chunk;}); + res.on('end',function() { + callback("data:"+contentType+";base64,"+data); + }); + }); + } + else if (ref.options.inBrowser) { + var ext = src.split('.').pop(); + var image = document.createElement('img'); + var canvas = document.createElement('canvas'); + var context = canvas.getContext('2d'); + image.onload = function() { + canvas.width = image.naturalWidth; + canvas.height = image.naturalHeight; + context.drawImage(image,0,0); + datauri = canvas.toDataURL(ext); + callback(datauri); + } + image.src = src; + } + else { + datauri = require('urify')(src); + callback(datauri); + } + } + + function loadImage(name, src) { + var step = { + name: "load-image", + description: "This initial step loads and displays the original image without any modifications.

To work with a new or different image, drag one into the drop zone.", + ID: ref.options.sequencerCounter++, + imageName: name, + inBrowser: ref.options.inBrowser, + ui: ref.options.ui + }; + + var image = { + src: src, + steps: [{ + options: { + id: step.ID, + name: "load-image", + description: "This initial step loads and displays the original image without any modifications.", + title: "Load Image", + step: step + }, + UI: ref.events, + draw: function() { + UI.onDraw(options.step); + if(arguments.length==1){ + this.output = CImage(arguments[0]); + options.step.output = this.output; + UI.onComplete(options.step); + return true; + } + else if(arguments.length==2) { + this.output = CImage(arguments[0]); + options.step.output = this.output; + arguments[1](); + UI.onComplete(options.step); + return true; + } + return false; + }, + }] + }; + CImage(src, function(datauri) { + var output = makeImage(datauri); + ref.images[name] = image; + var loadImageStep = ref.images[name].steps[0]; + loadImageStep.output = output; + loadImageStep.options.step.output = loadImageStep.output.src; + loadImageStep.UI.onSetup(loadImageStep.options.step); + loadImageStep.UI.onDraw(loadImageStep.options.step); + loadImageStep.UI.onComplete(loadImageStep.options.step); + + main_callback(); + return true; + }); + } + + return loadImage(name,src); +} + +module.exports = LoadImage; },{"urify":132}],209:[function(require,module,exports){ -// TODO: potentially move this into ImportImage module -function setInputStepInit() { - - return function setInputStep(options) { - - var dropzone = $(options.dropZoneSelector); - var fileInput = $(options.fileInputSelector); - - var onLoad = options.onLoad; - - var reader = new FileReader(); - - function handleFile(e) { - - e.preventDefault(); - e.stopPropagation(); // stops the browser from redirecting. - - if (e.target && e.target.files) var file = e.target.files[0]; - else var file = e.dataTransfer.files[0]; - if(!file) return; - - var reader = new FileReader(); - - reader.onload = onLoad; - - reader.readAsDataURL(file); - } - - fileInput.on('change', handleFile); - - dropzone[0].addEventListener('drop', handleFile, false); - - dropzone.on('dragover', function onDragover(e) { - e.stopPropagation(); - e.preventDefault(); - e.dataTransfer.dropEffect = 'copy'; // Explicitly show this is a copy. - }, false); - - dropzone.on('dragenter', function onDragEnter(e) { - dropzone.addClass('hover'); - }); - - dropzone.on('dragleave', function onDragLeave(e) { - dropzone.removeClass('hover'); - }); - - } - -} -module.exports = setInputStepInit; +// TODO: potentially move this into ImportImage module +function setInputStepInit() { + + return function setInputStep(options) { + + var dropzone = $(options.dropZoneSelector); + var fileInput = $(options.fileInputSelector); + + var onLoad = options.onLoad; + + var reader = new FileReader(); + + function handleFile(e) { + + e.preventDefault(); + e.stopPropagation(); // stops the browser from redirecting. + + if (e.target && e.target.files) var file = e.target.files[0]; + else var file = e.dataTransfer.files[0]; + if(!file) return; + + var reader = new FileReader(); + + reader.onload = onLoad; + + reader.readAsDataURL(file); + } + + fileInput.on('change', handleFile); + + dropzone[0].addEventListener('drop', handleFile, false); + + dropzone.on('dragover', function onDragover(e) { + e.stopPropagation(); + e.preventDefault(); + e.dataTransfer.dropEffect = 'copy'; // Explicitly show this is a copy. + }, false); + + dropzone.on('dragenter', function onDragEnter(e) { + dropzone.addClass('hover'); + }); + + dropzone.on('dragleave', function onDragLeave(e) { + dropzone.removeClass('hover'); + }); + + } + +} +module.exports = setInputStepInit; },{}],210:[function(require,module,exports){ -/* - * User Interface Handling Module - */ - -module.exports = function UserInterface(events = {}) { - - events.onSetup = events.onSetup || function(step) { - if (step.ui == false) { - // No UI - } else if(step.inBrowser) { - // Create and append an HTML Element - console.log("Added Step \""+step.name+"\" to \""+step.imageName+"\"."); - } else { - // Create a NodeJS Object - console.log('\x1b[36m%s\x1b[0m',"Added Step \""+step.name+"\" to \""+step.imageName+"\"."); - } - } - - events.onDraw = events.onDraw || function(step) { - if (step.ui == false) { - // No UI - } else if(step.inBrowser) { - // Overlay a loading spinner - console.log("Drawing Step \""+step.name+"\" on \""+step.imageName+"\"."); - } else { - // Don't do anything - console.log('\x1b[33m%s\x1b[0m',"Drawing Step \""+step.name+"\" on \""+step.imageName+"\"."); - } - } - - events.onComplete = events.onComplete || function(step) { - if (step.ui == false) { - // No UI - } else if(step.inBrowser) { - // Update the DIV Element - // Hide the laoding spinner - console.log("Drawn Step \""+step.name+"\" on \""+step.imageName+"\"."); - } else { - // Update the NodeJS Object - console.log('\x1b[32m%s\x1b[0m',"Drawn Step \""+step.name+"\" on \""+step.imageName+"\"."); - } - } - - events.onRemove = events.onRemove || function(step) { - if (step.ui == false){ - // No UI - } else if(step.inBrowser) { - // Remove the DIV Element - console.log("Removing Step \""+step.name+"\" of \""+step.imageName+"\"."); - } else { - // Delete the NodeJS Object - console.log('\x1b[31m%s\x1b[0m',"Removing Step \""+step.name+"\" of \""+step.imageName+"\"."); - } - } - - return events; - -} +/* + * User Interface Handling Module + */ + +module.exports = function UserInterface(events = {}) { + + events.onSetup = events.onSetup || function(step) { + if (step.ui == false) { + // No UI + } else if(step.inBrowser) { + // Create and append an HTML Element + console.log("Added Step \""+step.name+"\" to \""+step.imageName+"\"."); + } else { + // Create a NodeJS Object + console.log('\x1b[36m%s\x1b[0m',"Added Step \""+step.name+"\" to \""+step.imageName+"\"."); + } + } + + events.onDraw = events.onDraw || function(step) { + if (step.ui == false) { + // No UI + } else if(step.inBrowser) { + // Overlay a loading spinner + console.log("Drawing Step \""+step.name+"\" on \""+step.imageName+"\"."); + } else { + // Don't do anything + console.log('\x1b[33m%s\x1b[0m',"Drawing Step \""+step.name+"\" on \""+step.imageName+"\"."); + } + } + + events.onComplete = events.onComplete || function(step) { + if (step.ui == false) { + // No UI + } else if(step.inBrowser) { + // Update the DIV Element + // Hide the laoding spinner + console.log("Drawn Step \""+step.name+"\" on \""+step.imageName+"\"."); + } else { + // Update the NodeJS Object + console.log('\x1b[32m%s\x1b[0m',"Drawn Step \""+step.name+"\" on \""+step.imageName+"\"."); + } + } + + events.onRemove = events.onRemove || function(step) { + if (step.ui == false){ + // No UI + } else if(step.inBrowser) { + // Remove the DIV Element + console.log("Removing Step \""+step.name+"\" of \""+step.imageName+"\"."); + } else { + // Delete the NodeJS Object + console.log('\x1b[31m%s\x1b[0m',"Removing Step \""+step.name+"\" of \""+step.imageName+"\"."); + } + } + + return events; + +} },{}],211:[function(require,module,exports){ -/* -* Determine format from a URL or data-url, return "jpg" "png" "gif" etc -* TODO: write a test for this using the examples -*/ -module.exports = function GetFormat(src) { - - var format = undefined; // haha default - - // EXAMPLE: "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAAQABADASIAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAf/xAAUEAEAAAAAAAAAAAAAAAAAAAAA/8QAFQEBAQAAAAAAAAAAAAAAAAAABgj/xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwCdABykX//Z"; - // EXAMPLE: "http://example.com/example.png" - // EXAMPLE: "/example.png" - - if (isDataUrl(src)) { - format = src.split(';')[0].split('/').pop(); - } else { - format = src.split('.').pop(); - } - - function isDataUrl(src) { - return src.substr(0, 10) === "data:image" - } - - format = format.toLowerCase(); - - if (format === "jpeg") format = "jpg"; - - function validateFormat(data){ - let supportedFormats = [ - 'jpg', - 'jpeg', - 'png', - 'gif', - 'canvas', - ]; - return supportedFormats.includes(data); - } - - return validateFormat(format)?format:'jpg'; - -} +/* +* Determine format from a URL or data-url, return "jpg" "png" "gif" etc +* TODO: write a test for this using the examples +*/ +module.exports = function GetFormat(src) { + + var format = undefined; // haha default + + // EXAMPLE: "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAAQABADASIAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAf/xAAUEAEAAAAAAAAAAAAAAAAAAAAA/8QAFQEBAQAAAAAAAAAAAAAAAAAABgj/xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwCdABykX//Z"; + // EXAMPLE: "http://example.com/example.png" + // EXAMPLE: "/example.png" + + if (isDataUrl(src)) { + format = src.split(';')[0].split('/').pop(); + } else { + format = src.split('.').pop(); + } + + function isDataUrl(src) { + return src.substr(0, 10) === "data:image" + } + + format = format.toLowerCase(); + + if (format === "jpeg") format = "jpg"; + + function validateFormat(data){ + let supportedFormats = [ + 'jpg', + 'jpeg', + 'png', + 'gif', + 'canvas', + ]; + return supportedFormats.includes(data); + } + + return validateFormat(format)?format:'jpg'; + +} },{}],212:[function(require,module,exports){ -module.exports = { - getPreviousStep: function() { - return this.getStep(-1); - }, - - getNextStep: function() { - return this.getStep(1); - }, - - getInput: function(offset) { - if (offset + this.getIndex() === 0) offset++; - return this.getStep(offset - 1).output; - }, - - getOutput: function(offset) { - return this.getStep(offset).output; - }, - - getOptions: function() { - return this.getStep(0).options; - }, - - setOptions: function(optionsObj) { - let options = this.getStep(0).options; - for (let key in optionsObj) { - if (options[key]) options[key] = optionsObj[key]; - } - }, - - getFormat: function() { - return this.getStep(-1).output.format; - }, - - getHeight: function(callback) { - let img = new Image(); - img.onload = function() { - callback(img.height); - }; - img.src = this.getInput(0).src; - }, - - getWidth: function(callback) { - let img = new Image(); - img.onload = function() { - callback(img.width); - }; - img.src = this.getInput(0).src; - } +module.exports = { + getPreviousStep: function() { + return this.getStep(-1); + }, + + getNextStep: function() { + return this.getStep(1); + }, + + getInput: function(offset) { + if (offset + this.getIndex() === 0) offset++; + return this.getStep(offset - 1).output; + }, + + getOutput: function(offset) { + return this.getStep(offset).output; + }, + + getOptions: function() { + return this.getStep(0).options; + }, + + setOptions: function(optionsObj) { + let options = this.getStep(0).options; + for (let key in optionsObj) { + if (options[key]) options[key] = optionsObj[key]; + } + }, + + getFormat: function() { + return this.getStep(-1).output.format; + }, + + getHeight: function(callback) { + let img = new Image(); + img.onload = function() { + callback(img.height); + }; + img.src = this.getInput(0).src; + }, + + getWidth: function(callback) { + let img = new Image(); + img.onload = function() { + callback(img.width); + }; + img.src = this.getInput(0).src; + } } },{}]},{},[139]); diff --git a/dist/image-sequencer.min.js b/dist/image-sequencer.min.js index 1ce912d013..a32730537f 100644 --- a/dist/image-sequencer.min.js +++ b/dist/image-sequencer.min.js @@ -1 +1 @@ -!function(){return function e(t,n,r){function i(o,s){if(!n[o]){if(!t[o]){var u="function"==typeof require&&require;if(!s&&u)return u(o,!0);if(a)return a(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[o]={exports:{}};t[o][0].call(c.exports,function(e){return i(t[o][1][e]||e)},c,c.exports,e,t,n,r)}return n[o].exports}for(var a="function"==typeof require&&require,o=0;o0?r-4:r,f=0;f>16&255,s[u++]=t>>8&255,s[u++]=255&t;2===o&&(t=i[e.charCodeAt(f)]<<2|i[e.charCodeAt(f+1)]>>4,s[u++]=255&t);1===o&&(t=i[e.charCodeAt(f)]<<10|i[e.charCodeAt(f+1)]<<4|i[e.charCodeAt(f+2)]>>2,s[u++]=t>>8&255,s[u++]=255&t);return s},n.fromByteArray=function(e){for(var t,n=e.length,i=n%3,a=[],o=0,s=n-i;os?s:o+16383));1===i?(t=e[n-1],a.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],a.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return a.join("")};for(var r=[],i=[],a="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=o.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function c(e,t,n){for(var i,a,o=[],s=t;s>18&63]+r[a>>12&63]+r[a>>6&63]+r[63&a]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],2:[function(e,t,n){"use strict";"use restrict";function r(e){var t=32;return(e&=-e)&&t--,65535&e&&(t-=16),16711935&e&&(t-=8),252645135&e&&(t-=4),858993459&e&&(t-=2),1431655765&e&&(t-=1),t}n.INT_BITS=32,n.INT_MAX=2147483647,n.INT_MIN=-1<<31,n.sign=function(e){return(e>0)-(e<0)},n.abs=function(e){var t=e>>31;return(e^t)-t},n.min=function(e,t){return t^(e^t)&-(e65535)<<4,t|=n=((e>>>=t)>255)<<3,t|=n=((e>>>=n)>15)<<2,(t|=n=((e>>>=n)>3)<<1)|(e>>>=n)>>1},n.log10=function(e){return e>=1e9?9:e>=1e8?8:e>=1e7?7:e>=1e6?6:e>=1e5?5:e>=1e4?4:e>=1e3?3:e>=100?2:e>=10?1:0},n.popCount=function(e){return 16843009*((e=(858993459&(e-=e>>>1&1431655765))+(e>>>2&858993459))+(e>>>4)&252645135)>>>24},n.countTrailingZeros=r,n.nextPow2=function(e){return e+=0===e,--e,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,(e|=e>>>16)+1},n.prevPow2=function(e){return e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,(e|=e>>>16)-(e>>>1)},n.parity=function(e){return e^=e>>>16,e^=e>>>8,e^=e>>>4,27030>>>(e&=15)&1};var i=new Array(256);!function(e){for(var t=0;t<256;++t){var n=t,r=t,i=7;for(n>>>=1;n;n>>>=1)r<<=1,r|=1&n,--i;e[t]=r<>>8&255]<<16|i[e>>>16&255]<<8|i[e>>>24&255]},n.interleave2=function(e,t){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e&=65535)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t&=65535)|t<<8))|t<<4))|t<<2))|t<<1))<<1},n.deinterleave2=function(e,t){return(e=65535&((e=16711935&((e=252645135&((e=858993459&((e=e>>>t&1431655765)|e>>>1))|e>>>2))|e>>>4))|e>>>16))<<16>>16},n.interleave3=function(e,t,n){return e=1227133513&((e=3272356035&((e=251719695&((e=4278190335&((e&=1023)|e<<16))|e<<8))|e<<4))|e<<2),(e|=(t=1227133513&((t=3272356035&((t=251719695&((t=4278190335&((t&=1023)|t<<16))|t<<8))|t<<4))|t<<2))<<1)|(n=1227133513&((n=3272356035&((n=251719695&((n=4278190335&((n&=1023)|n<<16))|n<<8))|n<<4))|n<<2))<<2},n.deinterleave3=function(e,t){return(e=1023&((e=4278190335&((e=251719695&((e=3272356035&((e=e>>>t&1227133513)|e>>>2))|e>>>4))|e>>>8))|e>>>16))<<22>>22},n.nextCombination=function(e){var t=e|e-1;return t+1|(~t&-~t)-1>>>r(e)+1}},{}],3:[function(e,t,n){},{}],4:[function(e,t,n){"use strict";var r=e("base64-js"),i=e("ieee754");n.Buffer=s,n.SlowBuffer=function(e){+e!=e&&(e=0);return s.alloc(+e)},n.INSPECT_MAX_BYTES=50;var a=2147483647;function o(e){if(e>a)throw new RangeError("Invalid typed array length");var t=new Uint8Array(e);return t.__proto__=s.prototype,t}function s(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return c(e)}return u(e,t,n)}function u(e,t,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return P(e)?function(e,t,n){if(t<0||e.byteLength=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|e}function p(e,t){if(s.isBuffer(e))return e.length;if(U(e)||P(e))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return D(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return F(e).length;default:if(r)return D(e).length;t=(""+t).toLowerCase(),r=!0}}function d(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function g(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),q(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=s.from(t,r)),s.isBuffer(t))return 0===t.length?-1:v(e,t,n,r,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,r,i){var a,o=1,s=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,s/=2,u/=2,n/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var c=-1;for(a=n;as&&(n=s-u),a=n;a>=0;a--){for(var f=!0,h=0;hi&&(r=i):r=i;var a=t.length;if(a%2!=0)throw new TypeError("Invalid hex string");r>a/2&&(r=a/2);for(var o=0;o>8,i=n%256,a.push(i),a.push(r);return a}(t,e.length-n),e,n,r)}function k(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function E(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i239?4:l>223?3:l>191?2:1;if(i+f<=n)switch(f){case 1:l<128&&(c=l);break;case 2:128==(192&(a=e[i+1]))&&(u=(31&l)<<6|63&a)>127&&(c=u);break;case 3:a=e[i+1],o=e[i+2],128==(192&a)&&128==(192&o)&&(u=(15&l)<<12|(63&a)<<6|63&o)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:a=e[i+1],o=e[i+2],s=e[i+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(u=(15&l)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&u<1114112&&(c=u)}null===c?(c=65533,f=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),i+=f}return function(e){var t=e.length;if(t<=S)return String.fromCharCode.apply(String,e);var n="",r=0;for(;rthis.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,n);case"utf8":case"utf-8":return E(this,t,n);case"ascii":return A(this,t,n);case"latin1":case"binary":return T(this,t,n);case"base64":return k(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}.apply(this,arguments)},s.prototype.equals=function(e){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===s.compare(this,e)},s.prototype.inspect=function(){var e="",t=n.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),""},s.prototype.compare=function(e,t,n,r,i){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var a=(i>>>=0)-(r>>>=0),o=(n>>>=0)-(t>>>=0),u=Math.min(a,o),l=this.slice(r,i),c=e.slice(t,n),f=0;f>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var a=!1;;)switch(r){case"hex":return m(this,e,t,n);case"utf8":case"utf-8":return _(this,e,t,n);case"ascii":return w(this,e,t,n);case"latin1":case"binary":return b(this,e,t,n);case"base64":return y(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,e,t,n);default:if(a)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),a=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var S=4096;function A(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;ir)&&(n=r);for(var i="",a=t;an)throw new RangeError("Trying to access beyond buffer length")}function R(e,t,n,r,i,a){if(!s.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function L(e,t,n,r,i,a){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function B(e,t,n,r,a){return t=+t,n>>>=0,a||L(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function C(e,t,n,r,a){return t=+t,n>>>=0,a||L(e,0,n,8),i.write(e,t,n,r,52,8),n+8}s.prototype.slice=function(e,t){var n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t>>=0,t>>>=0,n||j(e,t,this.length);for(var r=this[e],i=1,a=0;++a>>=0,t>>>=0,n||j(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},s.prototype.readUInt8=function(e,t){return e>>>=0,t||j(e,1,this.length),this[e]},s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||j(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||j(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||j(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||j(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||j(e,t,this.length);for(var r=this[e],i=1,a=0;++a=(i*=128)&&(r-=Math.pow(2,8*t)),r},s.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||j(e,t,this.length);for(var r=t,i=1,a=this[e+--r];r>0&&(i*=256);)a+=this[e+--r]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},s.prototype.readInt8=function(e,t){return e>>>=0,t||j(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||j(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt16BE=function(e,t){e>>>=0,t||j(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||j(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||j(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readFloatLE=function(e,t){return e>>>=0,t||j(e,4,this.length),i.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||j(e,4,this.length),i.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||j(e,8,this.length),i.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||j(e,8,this.length),i.read(this,e,!1,52,8)},s.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t>>>=0,n>>>=0,r)||R(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,a=0;for(this[t]=255&e;++a>>=0,n>>>=0,r)||R(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},s.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,255,0),this[t]=255&e,t+1},s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var i=Math.pow(2,8*n-1);R(this,e,t,n,i-1,-i)}var a=0,o=1,s=0;for(this[t]=255&e;++a>0)-s&255;return t+n},s.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var i=Math.pow(2,8*n-1);R(this,e,t,n,i-1,-i)}var a=n-1,o=1,s=0;for(this[t+a]=255&e;--a>=0&&(o*=256);)e<0&&0===s&&0!==this[t+a+1]&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+n},s.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeFloatLE=function(e,t,n){return B(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return B(this,e,t,!1,n)},s.prototype.writeDoubleLE=function(e,t,n){return C(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return C(this,e,t,!1,n)},s.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(a<1e3)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(a=t;a55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return a}function F(e){return r.toByteArray(function(e){if((e=e.trim().replace(O,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function N(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function P(e){return e instanceof ArrayBuffer||null!=e&&null!=e.constructor&&"ArrayBuffer"===e.constructor.name&&"number"==typeof e.byteLength}function U(e){return"function"==typeof ArrayBuffer.isView&&ArrayBuffer.isView(e)}function q(e){return e!=e}},{"base64-js":1,ieee754:55}],5:[function(e,t,n){(function(n){var r=e("tty"),i=e("./lib/encode"),a=e("stream").Stream,o=t.exports=function(){var e=null;function t(t){if(e)throw new Error("multiple inputs specified");e=t}var i=null;function a(e){if(i)throw new Error("multiple outputs specified");i=e}for(var o=0;o0&&this.down(t),e>0?this.right(e):e<0&&this.left(-e),this},s.prototype.up=function(e){return void 0===e&&(e=1),this.write(i("["+Math.floor(e)+"A")),this},s.prototype.down=function(e){return void 0===e&&(e=1),this.write(i("["+Math.floor(e)+"B")),this},s.prototype.right=function(e){return void 0===e&&(e=1),this.write(i("["+Math.floor(e)+"C")),this},s.prototype.left=function(e){return void 0===e&&(e=1),this.write(i("["+Math.floor(e)+"D")),this},s.prototype.column=function(e){return this.write(i("["+Math.floor(e)+"G")),this},s.prototype.push=function(e){return this.write(i(e?"7":"[s")),this},s.prototype.pop=function(e){return this.write(i(e?"8":"[u")),this},s.prototype.erase=function(e){return"end"===e||"$"===e?this.write(i("[K")):"start"===e||"^"===e?this.write(i("[1K")):"line"===e?this.write(i("[2K")):"down"===e?this.write(i("[J")):"up"===e?this.write(i("[1J")):"screen"===e?this.write(i("[1J")):this.emit("error",new Error("Unknown erase type: "+e)),this},s.prototype.display=function(e){var t={reset:0,bright:1,dim:2,underscore:4,blink:5,reverse:7,hidden:8}[e];return void 0===t&&this.emit("error",new Error("Unknown attribute: "+e)),this.write(i("["+t+"m")),this},s.prototype.foreground=function(e){if("number"==typeof e)(e<0||e>=256)&&this.emit("error",new Error("Color out of range: "+e)),this.write(i("[38;5;"+e+"m"));else{var t={black:30,red:31,green:32,yellow:33,blue:34,magenta:35,cyan:36,white:37}[e.toLowerCase()];t||this.emit("error",new Error("Unknown color: "+e)),this.write(i("["+t+"m"))}return this},s.prototype.background=function(e){if("number"==typeof e)(e<0||e>=256)&&this.emit("error",new Error("Color out of range: "+e)),this.write(i("[48;5;"+e+"m"));else{var t={black:40,red:41,green:42,yellow:43,blue:44,magenta:45,cyan:46,white:47}[e.toLowerCase()];t||this.emit("error",new Error("Unknown color: "+e)),this.write(i("["+t+"m"))}return this},s.prototype.cursor=function(e){return this.write(i(e?"[?25h":"[?25l")),this};var u=o.extractCodes=function(e){for(var t=[],n=-1,r=0;r=0&&t.push(e.slice(n,r)),n=r):n>=0&&r===e.length-1&&t.push(e.slice(n));return t}}).call(this,e("_process"))},{"./lib/encode":6,_process:98,stream:112,tty:129}],6:[function(e,t,n){(function(e){var n=(t.exports=function(t){return new e([27].concat(function e(t){return"string"==typeof t?t.split("").map(n):Array.isArray(t)?t.reduce(function(t,n){return t.concat(e(n))},[]):void 0}(t)))}).ord=function(e){return e.charCodeAt(0)}}).call(this,e("buffer").Buffer)},{buffer:4}],7:[function(e,t,n){(function(n){"use strict";var r=e("readable-stream").Readable,i=e("util");function a(e,t){if(!(this instanceof a))return new a(e,t);r.call(this,t),null==e&&(e=String(e)),this._obj=e}t.exports=a,i.inherits(a,r),a.prototype._read=function(e){var t=this._obj;"string"==typeof t?this.push(new n(t)):n.isBuffer(t)?this.push(t):this.push(new n(JSON.stringify(t))),this.push(null)}}).call(this,e("buffer").Buffer)},{buffer:4,"readable-stream":106,util:135}],8:[function(e,t,n){(function(e){function t(e){return Object.prototype.toString.call(e)}n.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===t(e)},n.isBoolean=function(e){return"boolean"==typeof e},n.isNull=function(e){return null===e},n.isNullOrUndefined=function(e){return null==e},n.isNumber=function(e){return"number"==typeof e},n.isString=function(e){return"string"==typeof e},n.isSymbol=function(e){return"symbol"==typeof e},n.isUndefined=function(e){return void 0===e},n.isRegExp=function(e){return"[object RegExp]"===t(e)},n.isObject=function(e){return"object"==typeof e&&null!==e},n.isDate=function(e){return"[object Date]"===t(e)},n.isError=function(e){return"[object Error]"===t(e)||e instanceof Error},n.isFunction=function(e){return"function"==typeof e},n.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},n.isBuffer=e.isBuffer}).call(this,{isBuffer:e("../../is-buffer/index.js")})},{"../../is-buffer/index.js":59}],9:[function(e,t,n){"use strict";var r=e("./lib/thunk.js");t.exports=function(e){var t=new function(){this.argTypes=[],this.shimArgs=[],this.arrayArgs=[],this.arrayBlockIndices=[],this.scalarArgs=[],this.offsetArgs=[],this.offsetArgIndex=[],this.indexArgs=[],this.shapeArgs=[],this.funcName="",this.pre=null,this.body=null,this.post=null,this.debug=!1};t.pre=e.pre,t.body=e.body,t.post=e.post;var n=e.args.slice(0);t.argTypes=n;for(var i=0;i0)throw new Error("cwise: pre() block may not reference array args");if(i0)throw new Error("cwise: post() block may not reference array args")}else if("scalar"===a)t.scalarArgs.push(i),t.shimArgs.push("scalar"+i);else if("index"===a){if(t.indexArgs.push(i),i0)throw new Error("cwise: pre() block may not reference array index");if(i0)throw new Error("cwise: post() block may not reference array index")}else if("shape"===a){if(t.shapeArgs.push(i),in.length)throw new Error("cwise: Too many arguments in pre() block");if(t.body.args.length>n.length)throw new Error("cwise: Too many arguments in body() block");if(t.post.args.length>n.length)throw new Error("cwise: Too many arguments in post() block");return t.debug=!!e.printCode||!!e.debug,t.funcName=e.funcName||"cwise",t.blockSize=e.blockSize||64,r(t)}},{"./lib/thunk.js":11}],10:[function(e,t,n){"use strict";var r=e("uniq");function i(e,t,n){var r,i,a=e.length,o=t.arrayArgs.length,s=t.indexArgs.length>0,u=[],l=[],c=0,f=0;for(r=0;r0&&u.push("var "+l.join(",")),r=a-1;r>=0;--r)c=e[r],u.push(["for(i",r,"=0;i",r,"0&&u.push(["index[",f,"]-=s",f].join("")),u.push(["++index[",c,"]"].join(""))),u.push("}")}return u.join("\n")}function a(e,t,n){for(var r=e.body,i=[],a=[],o=0;o0&&_.push("shape=SS.slice(0)"),e.indexArgs.length>0){var w=new Array(n);for(u=0;u0&&m.push("var "+_.join(",")),u=0;u3&&m.push(a(e.pre,e,s));var k=a(e.body,e,s),E=function(e){for(var t=0,n=e[0].length;t0,l=[],c=0;c0;){"].join("")),l.push(["if(j",c,"<",s,"){"].join("")),l.push(["s",t[c],"=j",c].join("")),l.push(["j",c,"=0"].join("")),l.push(["}else{s",t[c],"=",s].join("")),l.push(["j",c,"-=",s,"}"].join("")),u&&l.push(["index[",t[c],"]=j",c].join(""));for(c=0;c3&&m.push(a(e.post,e,s)),e.debug&&console.log("-----Generated cwise routine for ",t,":\n"+m.join("\n")+"\n----------");var S=[e.funcName||"unnamed","_cwise_loop_",o[0].join("s"),"m",E,function(e){for(var t=new Array(e.length),n=!0,r=0;r0&&(n=n&&t[r]===t[r-1])}return n?t[0]:t.join("")}(s)].join("");return new Function(["function ",S,"(",v.join(","),"){",m.join("\n"),"} return ",S].join(""))()}},{uniq:131}],11:[function(e,t,n){"use strict";var r=e("./compile.js");t.exports=function(e){var t=["'use strict'","var CACHED={}"],n=[],i=e.funcName+"_cwise_thunk";t.push(["return function ",i,"(",e.shimArgs.join(","),"){"].join(""));for(var a=[],o=[],s=[["array",e.arrayArgs[0],".shape.slice(",Math.max(0,e.arrayBlockIndices[0]),e.arrayBlockIndices[0]<0?","+e.arrayBlockIndices[0]+")":")"].join("")],u=[],l=[],c=0;c0&&(u.push("array"+e.arrayArgs[0]+".shape.length===array"+f+".shape.length+"+(Math.abs(e.arrayBlockIndices[0])-Math.abs(e.arrayBlockIndices[c]))),l.push("array"+e.arrayArgs[0]+".shape[shapeIndex+"+Math.max(0,e.arrayBlockIndices[0])+"]===array"+f+".shape[shapeIndex+"+Math.max(0,e.arrayBlockIndices[c])+"]"))}for(e.arrayArgs.length>1&&(t.push("if (!("+u.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same dimensionality!')"),t.push("for(var shapeIndex=array"+e.arrayArgs[0]+".shape.length-"+Math.abs(e.arrayBlockIndices[0])+"; shapeIndex--\x3e0;) {"),t.push("if (!("+l.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),t.push("}")),c=0;c0)return function(e,t){var n,r;for(n=new Array(e),r=0;r 0.99 || vMapping.x < 0.01 || vMapping.y > 0.99 || vMapping.y < 0.01){\n\t\ttexture = vec4(0.0, 0.0, 0.0, 1.0);\n\t} \n\tgl_FragColor = texture;\n}\n"},{}],18:[function(e,t,n){t.exports="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec4 uLens;\nuniform vec2 uFov;\nuniform sampler2D uSampler;\nvarying vec3 vPosition;\nvarying vec2 vTextureCoord;\nvec2 TextureCoord2GLCoord(vec2 textureCoord) {\n\treturn (textureCoord - vec2(0.5, 0.5)) * 2.0;\n}\nvec2 GLCoord2TextureCoord(vec2 glCoord) {\n\treturn glCoord / 2.0 + vec2(0.5, 0.5);\n}\nvoid main(void){\n\tfloat correctionRadius = 0.5;\n\tfloat distance = sqrt(vPosition.x * vPosition.x + vPosition.y * vPosition.y) / correctionRadius;\n\tfloat theta = 1.0;\n\tif(distance != 0.0){\n\t\ttheta = atan(distance);\n\t}\n\tvec2 vMapping = theta * vPosition.xy;\n\tvMapping = GLCoord2TextureCoord(vMapping);\n\t\t\n\tvec4 texture = texture2D(uSampler, vMapping);\n\tif(vMapping.x > 0.99 || vMapping.x < 0.01 || vMapping.y > 0.99 || vMapping.y < 0.01){\n\t\ttexture = vec4(0.0, 0.0, 0.0, 1.0);\n\t} \n\tgl_FragColor = texture;\n}\n"},{}],19:[function(e,t,n){t.exports="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec3 uLensS;\nuniform vec2 uLensF;\nuniform vec2 uFov;\nuniform sampler2D uSampler;\nvarying vec3 vPosition;\nvarying vec2 vTextureCoord;\nvec2 GLCoord2TextureCoord(vec2 glCoord) {\n\treturn glCoord * vec2(1.0, -1.0)/ 2.0 + vec2(0.5, 0.5);\n}\nvoid main(void){\n\tfloat scale = uLensS.z;\n\tvec3 vPos = vPosition;\n\tfloat Fx = uLensF.x;\n\tfloat Fy = uLensF.y;\n\tvec2 vMapping = vPos.xy;\n\tvMapping.x = vMapping.x + ((pow(vPos.y, 2.0)/scale)*vPos.x/scale)*-Fx;\n\tvMapping.y = vMapping.y + ((pow(vPos.x, 2.0)/scale)*vPos.y/scale)*-Fy;\n\tvMapping = vMapping * uLensS.xy;\n\tvMapping = GLCoord2TextureCoord(vMapping/scale);\n\tvec4 texture = texture2D(uSampler, vMapping);\n\tif(vMapping.x > 0.99 || vMapping.x < 0.01 || vMapping.y > 0.99 || vMapping.y < 0.01){\n\t\ttexture = vec4(0.0, 0.0, 0.0, 1.0);\n\t}\n\tgl_FragColor = texture;\n}\n"},{}],20:[function(e,t,n){t.exports="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec4 uLens;\nuniform vec2 uFov;\nuniform sampler2D uSampler;\nvarying vec3 vPosition;\nvarying vec2 vTextureCoord;\nvec2 TextureCoord2GLCoord(vec2 textureCoord) {\n\treturn (textureCoord - vec2(0.5, 0.5)) * 2.0;\n}\nvec2 GLCoord2TextureCoord(vec2 glCoord) {\n\treturn glCoord / 2.0 + vec2(0.5, 0.5);\n}\nvoid main(void){\n\tvec2 vMapping = vec2(vTextureCoord.x, 1.0 - vTextureCoord.y);\n\tvMapping = TextureCoord2GLCoord(vMapping);\n\t//TODO insert Code\n\tfloat F = uLens.x/ uLens.w;\n\tfloat seta = length(vMapping) / F;\n\tvMapping = sin(seta) * F / length(vMapping) * vMapping;\n\tvMapping *= uLens.w * 1.414;\n\tvMapping = GLCoord2TextureCoord(vMapping);\n\tvec4 texture = texture2D(uSampler, vMapping);\n\tif(vMapping.x > 0.99 || vMapping.x < 0.01 || vMapping.y > 0.99 || vMapping.y < 0.01){\n\t\ttexture = vec4(0.0, 0.0, 0.0, 1.0);\n\t} \n\tgl_FragColor = texture;\n}\n"},{}],21:[function(e,t,n){t.exports="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec4 uLens;\nuniform vec2 uFov;\nuniform sampler2D uSampler;\nvarying vec3 vPosition;\nvarying vec2 vTextureCoord;\nvec2 TextureCoord2GLCoord(vec2 textureCoord) {\n\treturn (textureCoord - vec2(0.5, 0.5)) * 2.0;\n}\nvec2 GLCoord2TextureCoord(vec2 glCoord) {\n\treturn glCoord / 2.0 + vec2(0.5, 0.5);\n}\nvoid main(void){\n\tvec2 vMapping = vec2(vTextureCoord.x, 1.0 - vTextureCoord.y);\n\tvMapping = TextureCoord2GLCoord(vMapping);\n\t//TOD insert Code\n\tfloat F = uLens.x/ uLens.w;\n\tfloat seta = length(vMapping) / F;\n\tvMapping = sin(seta) * F / length(vMapping) * vMapping;\n\tvMapping *= uLens.w * 1.414;\n\tvMapping = GLCoord2TextureCoord(vMapping);\n\tvec4 texture = texture2D(uSampler, vMapping);\n\tif(vMapping.x > 0.99 || vMapping.x < 0.01 || vMapping.y > 0.99 || vMapping.y < 0.01){\n\t\ttexture = vec4(0.0, 0.0, 0.0, 1.0);\n\t} \n\tgl_FragColor = texture;\n}\n"},{}],22:[function(e,t,n){t.exports="#ifdef GL_ES\nprecision highp float;\n#endif\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nvarying vec3 vPosition;\nvarying vec2 vTextureCoord;\nvoid main(void){\n\tvPosition = aVertexPosition;\n\tvTextureCoord = aTextureCoord;\n\tgl_Position = vec4(vPosition,1.0);\n}\n"},{}],23:[function(e,t,n){(function(n,r){"use strict";var i=e("path"),a=e("ndarray"),o=e("omggif").GifReader,s=(e("ndarray-pack"),e("through"),e("data-uri-to-buffer"));function u(e,t){var n;try{n=new o(e)}catch(e){return void t(e)}if(n.numFrames()>0){var r=[n.numFrames(),n.height,n.width,4],i=new Uint8Array(r[0]*r[1]*r[2]*r[3]),s=a(i,r);try{for(var u=0;u=0&&(this.dispose=e)},u.prototype.setRepeat=function(e){this.repeat=e},u.prototype.setTransparent=function(e){this.transparent=e},u.prototype.analyzeImage=function(e){this.setImagePixels(this.removeAlphaChannel(e)),this.analyzePixels()},u.prototype.writeImageInfo=function(){this.firstFrame&&(this.writeLSD(),this.writePalette(),this.repeat>=0&&this.writeNetscapeExt()),this.writeGraphicCtrlExt(),this.writeImageDesc(),this.firstFrame||this.writePalette(),this.firstFrame=!1},u.prototype.outputImage=function(){this.writePixels()},u.prototype.addFrame=function(e){this.emit("frame#start"),this.analyzeImage(e),this.writeImageInfo(),this.outputImage(),this.emit("frame#stop")},u.prototype.finish=function(){this.emit("finish#start"),this.writeByte(59),this.emit("finish#stop")},u.prototype.setQuality=function(e){e<1&&(e=1),this.sample=e},u.prototype.writeHeader=function(){this.emit("writeHeader#start"),this.writeUTFBytes("GIF89a"),this.emit("writeHeader#stop")},u.prototype.analyzePixels=function(){var e=this.pixels.length/3;this.indexedPixels=new Uint8Array(e);var t=new a(this.pixels,this.sample);t.buildColormap(),this.colorTab=t.getColormap();for(var n=0,r=0;r>16,n=(65280&e)>>8,r=255&e,i=0,a=16777216,o=this.colorTab.length,s=0;s=0&&(t=7&dispose),t<<=2,this.writeByte(0|t|e),this.writeShort(this.delay),this.writeByte(this.transIndex),this.writeByte(0)},u.prototype.writeImageDesc=function(){this.writeByte(44),this.writeShort(0),this.writeShort(0),this.writeShort(this.width),this.writeShort(this.height),this.firstFrame?this.writeByte(0):this.writeByte(128|this.palSize)},u.prototype.writeLSD=function(){this.writeShort(this.width),this.writeShort(this.height),this.writeByte(240|this.palSize),this.writeByte(0),this.writeByte(0)},u.prototype.writeNetscapeExt=function(){this.writeByte(33),this.writeByte(255),this.writeByte(11),this.writeUTFBytes("NETSCAPE2.0"),this.writeByte(3),this.writeByte(1),this.writeShort(this.repeat),this.writeByte(0)},u.prototype.writePalette=function(){this.writeBytes(this.colorTab);for(var e=768-this.colorTab.length,t=0;t>8&255)},u.prototype.writePixels=function(){new o(this.width,this.height,this.indexedPixels,this.colorDepth).encode(this)},u.prototype.stream=function(){return this},u.ByteCapacitor=s,t.exports=u}).call(this,e("buffer").Buffer)},{"./LZWEncoder.js":26,"./TypedNeuQuant.js":27,assert:36,buffer:4,events:43,"readable-stream":34,util:135}],26:[function(e,t,n){var r=-1,i=12,a=5003,o=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535];t.exports=function(e,t,n,s){var u,l,c,f,h,p,d,g,v,m=Math.max(2,s),_=new Uint8Array(256),w=new Int32Array(a),b=new Int32Array(a),y=0,x=0,k=!1;function E(e,t){_[l++]=e,l>=254&&T(t)}function S(e){A(a),x=g+2,k=!0,j(g,e)}function A(e){for(var t=0;t0&&(e.writeByte(l),e.writeBytes(_,0,l),l=0)}function M(e){return(1<0?u|=e<=8;)E(255&u,t),u>>=8,y-=8;if((x>c||k)&&(k?(c=M(p=d),k=!1):c=++p==i?1<0;)E(255&u,t),u>>=8,y-=8;T(t)}}this.encode=function(n){n.writeByte(m),f=e*t,h=0,function(e,t){var n,o,s,u,f,h,m;for(k=!1,c=M(p=d=e),v=1+(g=1<=0){f=h-s,0===s&&(f=1);do{if((s-=f)<0&&(s+=h),w[s]===n){u=b[s];continue e}}while(w[s]>=0)}j(u,t),u=o,x<1<>c,h=u<>3)*(1<l;)u=T[p++],fl&&((s=n[h--])[0]-=u*(s[0]-r)/_,s[1]-=u*(s[1]-a)/_,s[2]-=u*(s[2]-o)/_)}function j(e,t,r){var a,u,p,d,g,v=~(1<<31),m=v,_=-1,w=_;for(a=0;a>s-o))>c,A[a]-=g,S[a]+=g<>3),e=0;e>p;for(A<=1&&(A=0),n=0;n=c&&(R-=c),0===_&&(_=1),++n%_==0)for(E-=E/f,(A=(S-=S/g)>>p)<=1&&(A=0),l=0;l>=o,n[e][1]>>=o,n[e][2]>>=o,n[e][3]=e}(),function(){var e,t,r,o,s,u,l=0,c=0;for(e=0;e>1,t=l+1;t>1,t=l+1;t<256;t++)E[t]=a}()},this.getColormap=function(){for(var e=[],t=[],r=0;r=0;)c=u?c=i:(c++,s<0&&(s=-s),(a=o[0]-e)<0&&(a=-a),(s+=a)=0&&((s=t-(o=n[f])[1])>=u?f=-1:(f--,s<0&&(s=-s),(a=o[0]-e)<0&&(a=-a),(s+=a)0)if(t.ended&&!a){var s=new Error("stream.push() after EOF");e.emit("error",s)}else if(t.endEmitted&&a){s=new Error("stream.unshift() after end event");e.emit("error",s)}else!t.decoder||a||i||(r=t.decoder.write(r)),a||(t.reading=!1),t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,a?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&g(e)),function(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(function(){!function(e,t){var n=t.length;for(;!t.reading&&!t.flowing&&!t.ended&&t.lengtht.highWaterMark&&(t.highWaterMark=function(e){if(e>=p)e=p;else{e--;for(var t=1;t<32;t<<=1)e|=e>>t;e++}return e}(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function g(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(l("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?n.nextTick(function(){v(e)}):v(e))}function v(e){l("emit readable"),e.emit("readable"),m(e)}function m(e){var t=e._readableState;if(l("flow",t.flowing),t.flowing)do{var n=e.read()}while(null!==n&&t.flowing)}function _(e,t){var n,r=t.buffer,a=t.length,o=!!t.decoder,s=!!t.objectMode;if(0===r.length)return null;if(0===a)n=null;else if(s)n=r.shift();else if(!e||e>=a)n=o?r.join(""):i.concat(r,a),r.length=0;else{if(e0)throw new Error("endReadable called on non-empty stream");t.endEmitted||(t.ended=!0,n.nextTick(function(){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}))}f.prototype.read=function(e){l("read",e);var t=this._readableState,n=e;if((!u.isNumber(e)||e>0)&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return l("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?w(this):g(this),null;if(0===(e=d(e,t))&&t.ended)return 0===t.length&&w(this),null;var r,i=t.needReadable;return l("need readable",i),(0===t.length||t.length-e0?_(e,t):null,u.isNull(r)&&(t.needReadable=!0,e=0),t.length-=e,0!==t.length||t.ended||(t.needReadable=!0),n!==e&&t.ended&&0===t.length&&w(this),u.isNull(r)||this.emit("data",r),r},f.prototype._read=function(e){this.emit("error",new Error("not implemented"))},f.prototype.pipe=function(e,t){var i=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,l("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?c:h;function u(e){l("onunpipe"),e===i&&h()}function c(){l("onend"),e.end()}o.endEmitted?n.nextTick(s):i.once("end",s),e.on("unpipe",u);var f=function(e){return function(){var t=e._readableState;l("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&a.listenerCount(e,"data")&&(t.flowing=!0,m(e))}}(i);function h(){l("cleanup"),e.removeListener("close",g),e.removeListener("finish",v),e.removeListener("drain",f),e.removeListener("error",d),e.removeListener("unpipe",u),i.removeListener("end",c),i.removeListener("end",h),i.removeListener("data",p),!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f()}function p(t){l("ondata"),!1===e.write(t)&&(l("false write response, pause",i._readableState.awaitDrain),i._readableState.awaitDrain++,i.pause())}function d(t){l("onerror",t),_(),e.removeListener("error",d),0===a.listenerCount(e,"error")&&e.emit("error",t)}function g(){e.removeListener("finish",v),_()}function v(){l("onfinish"),e.removeListener("close",g),_()}function _(){l("unpipe"),i.unpipe(e)}return e.on("drain",f),i.on("data",p),e._events&&e._events.error?r(e._events.error)?e._events.error.unshift(d):e._events.error=[d,e._events.error]:e.on("error",d),e.once("close",g),e.once("finish",v),e.emit("pipe",i),o.flowing||(l("pipe resume"),i.resume()),e},f.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i1){for(var n=[],r=0;r=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived=55296&&i<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var r=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,r),r-=this.charReceived);var i;r=(t+=e.toString(this.encoding,0,r)).length-1;if((i=t.charCodeAt(r))>=55296&&i<=56319){var a=this.surrogateSize;return this.charLength+=a,this.charReceived+=a,this.charBuffer.copy(this.charBuffer,a,0,a),e.copy(this.charBuffer,0,0,a),t.substring(0,r)}return t},a.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(t<=2&&n>>4==14){this.charLength=3;break}if(t<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=t},a.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;t+=r.slice(0,n).toString(i)}return t}},{buffer:4}],36:[function(e,t,n){(function(n){"use strict";function r(e,t){if(e===t)return 0;for(var n=e.length,r=t.length,i=0,a=Math.min(n,r);i=0;l--)if(c[l]!==f[l])return!1;for(l=c.length-1;l>=0;l--)if(u=c[l],!_(e[u],t[u],n,r))return!1;return!0}(e,t,n,o))}return n?e===t:e==t}function w(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function b(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function y(e,t,n,r){var i;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof n&&(r=n,n=null),i=function(e){var t;try{e()}catch(e){t=e}return t}(t),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),e&&!i&&v(i,n,"Missing expected exception"+r);var o="string"==typeof r,s=!e&&i&&!n;if((!e&&a.isError(i)&&o&&b(i,n)||s)&&v(i,n,"Got unwanted exception"+r),e&&i&&n&&!b(i,n)||!e&&i)throw i}f.AssertionError=function(e){var t;this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=d(g((t=this).actual),128)+" "+t.operator+" "+d(g(t.expected),128),this.generatedMessage=!0);var n=e.stackStartFunction||v;if(Error.captureStackTrace)Error.captureStackTrace(this,n);else{var r=new Error;if(r.stack){var i=r.stack,a=p(n),o=i.indexOf("\n"+a);if(o>=0){var s=i.indexOf("\n",o+1);i=i.substring(s+1)}this.stack=i}}},a.inherits(f.AssertionError,Error),f.fail=v,f.ok=m,f.equal=function(e,t,n){e!=t&&v(e,t,n,"==",f.equal)},f.notEqual=function(e,t,n){e==t&&v(e,t,n,"!=",f.notEqual)},f.deepEqual=function(e,t,n){_(e,t,!1)||v(e,t,n,"deepEqual",f.deepEqual)},f.deepStrictEqual=function(e,t,n){_(e,t,!0)||v(e,t,n,"deepStrictEqual",f.deepStrictEqual)},f.notDeepEqual=function(e,t,n){_(e,t,!1)&&v(e,t,n,"notDeepEqual",f.notDeepEqual)},f.notDeepStrictEqual=function e(t,n,r){_(t,n,!0)&&v(t,n,r,"notDeepStrictEqual",e)},f.strictEqual=function(e,t,n){e!==t&&v(e,t,n,"===",f.strictEqual)},f.notStrictEqual=function(e,t,n){e===t&&v(e,t,n,"!==",f.notStrictEqual)},f.throws=function(e,t,n){y(!0,e,t,n)},f.doesNotThrow=function(e,t,n){y(!1,e,t,n)},f.ifError=function(e){if(e)throw e};var x=Object.keys||function(e){var t=[];for(var n in e)o.call(e,n)&&t.push(n);return t}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"util/":39}],37:[function(e,t,n){"function"==typeof Object.create?t.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},{}],38:[function(e,t,n){t.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},{}],39:[function(e,t,n){(function(t,r){var i=/%[sdj%]/g;n.format=function(e){if(!m(e)){for(var t=[],n=0;n=a)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}}),u=r[n];n=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),d(t)?r.showHidden=t:t&&n._extend(r,t),_(r.showHidden)&&(r.showHidden=!1),_(r.depth)&&(r.depth=2),_(r.colors)&&(r.colors=!1),_(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=u),c(r,e,r.depth)}function u(e,t){var n=s.styles[t];return n?"["+s.colors[n][0]+"m"+e+"["+s.colors[n][1]+"m":e}function l(e,t){return e}function c(e,t,r){if(e.customInspect&&t&&k(t.inspect)&&t.inspect!==n.inspect&&(!t.constructor||t.constructor.prototype!==t)){var i=t.inspect(r,e);return m(i)||(i=c(e,i,r)),i}var a=function(e,t){if(_(t))return e.stylize("undefined","undefined");if(m(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(v(t))return e.stylize(""+t,"number");if(d(t))return e.stylize(""+t,"boolean");if(g(t))return e.stylize("null","null")}(e,t);if(a)return a;var o=Object.keys(t),s=function(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(t)),x(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return f(t);if(0===o.length){if(k(t)){var u=t.name?": "+t.name:"";return e.stylize("[Function"+u+"]","special")}if(w(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(y(t))return e.stylize(Date.prototype.toString.call(t),"date");if(x(t))return f(t)}var l,b="",E=!1,S=["{","}"];(p(t)&&(E=!0,S=["[","]"]),k(t))&&(b=" [Function"+(t.name?": "+t.name:"")+"]");return w(t)&&(b=" "+RegExp.prototype.toString.call(t)),y(t)&&(b=" "+Date.prototype.toUTCString.call(t)),x(t)&&(b=" "+f(t)),0!==o.length||E&&0!=t.length?r<0?w(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),l=E?function(e,t,n,r,i){for(var a=[],o=0,s=t.length;o=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1];return n[0]+t+" "+e.join(", ")+" "+n[1]}(l,b,S)):S[0]+b+S[1]}function f(e){return"["+Error.prototype.toString.call(e)+"]"}function h(e,t,n,r,i,a){var o,s,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?s=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(s=e.stylize("[Setter]","special")),T(r,i)||(o="["+i+"]"),s||(e.seen.indexOf(u.value)<0?(s=g(n)?c(e,u.value,null):c(e,u.value,n-1)).indexOf("\n")>-1&&(s=a?s.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+s.split("\n").map(function(e){return" "+e}).join("\n")):s=e.stylize("[Circular]","special")),_(o)){if(a&&i.match(/^\d+$/))return s;(o=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+s}function p(e){return Array.isArray(e)}function d(e){return"boolean"==typeof e}function g(e){return null===e}function v(e){return"number"==typeof e}function m(e){return"string"==typeof e}function _(e){return void 0===e}function w(e){return b(e)&&"[object RegExp]"===E(e)}function b(e){return"object"==typeof e&&null!==e}function y(e){return b(e)&&"[object Date]"===E(e)}function x(e){return b(e)&&("[object Error]"===E(e)||e instanceof Error)}function k(e){return"function"==typeof e}function E(e){return Object.prototype.toString.call(e)}function S(e){return e<10?"0"+e.toString(10):e.toString(10)}n.debuglog=function(e){if(_(a)&&(a=t.env.NODE_DEBUG||""),e=e.toUpperCase(),!o[e])if(new RegExp("\\b"+e+"\\b","i").test(a)){var r=t.pid;o[e]=function(){var t=n.format.apply(n,arguments);console.error("%s %d: %s",e,r,t)}}else o[e]=function(){};return o[e]},n.inspect=s,s.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},s.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},n.isArray=p,n.isBoolean=d,n.isNull=g,n.isNullOrUndefined=function(e){return null==e},n.isNumber=v,n.isString=m,n.isSymbol=function(e){return"symbol"==typeof e},n.isUndefined=_,n.isRegExp=w,n.isObject=b,n.isDate=y,n.isError=x,n.isFunction=k,n.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},n.isBuffer=e("./support/isBuffer");var A=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function T(e,t){return Object.prototype.hasOwnProperty.call(e,t)}n.log=function(){var e,t;console.log("%s - %s",(e=new Date,t=[S(e.getHours()),S(e.getMinutes()),S(e.getSeconds())].join(":"),[e.getDate(),A[e.getMonth()],t].join(" ")),n.format.apply(n,arguments))},n.inherits=e("inherits"),n._extend=function(e,t){if(!t||!b(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":38,_process:98,inherits:37}],40:[function(e,t,n){(function(t,r){"use strict";var i=e("assert"),a=e("pako/lib/zlib/zstream"),o=e("pako/lib/zlib/deflate.js"),s=e("pako/lib/zlib/inflate.js"),u=e("pako/lib/zlib/constants");for(var l in u)n[l]=u[l];n.NONE=0,n.DEFLATE=1,n.INFLATE=2,n.GZIP=3,n.GUNZIP=4,n.DEFLATERAW=5,n.INFLATERAW=6,n.UNZIP=7;function c(e){if("number"!=typeof e||en.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=e,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}c.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,i(this.init_done,"close before init"),i(this.mode<=n.UNZIP),this.mode===n.DEFLATE||this.mode===n.GZIP||this.mode===n.DEFLATERAW?o.deflateEnd(this.strm):this.mode!==n.INFLATE&&this.mode!==n.GUNZIP&&this.mode!==n.INFLATERAW&&this.mode!==n.UNZIP||s.inflateEnd(this.strm),this.mode=n.NONE,this.dictionary=null)},c.prototype.write=function(e,t,n,r,i,a,o){return this._write(!0,e,t,n,r,i,a,o)},c.prototype.writeSync=function(e,t,n,r,i,a,o){return this._write(!1,e,t,n,r,i,a,o)},c.prototype._write=function(e,a,o,s,u,l,c,f){if(i.equal(arguments.length,8),i(this.init_done,"write before init"),i(this.mode!==n.NONE,"already finalized"),i.equal(!1,this.write_in_progress,"write already in progress"),i.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,i.equal(!1,void 0===a,"must provide flush value"),this.write_in_progress=!0,a!==n.Z_NO_FLUSH&&a!==n.Z_PARTIAL_FLUSH&&a!==n.Z_SYNC_FLUSH&&a!==n.Z_FULL_FLUSH&&a!==n.Z_FINISH&&a!==n.Z_BLOCK)throw new Error("Invalid flush value");if(null==o&&(o=r.alloc(0),u=0,s=0),this.strm.avail_in=u,this.strm.input=o,this.strm.next_in=s,this.strm.avail_out=f,this.strm.output=l,this.strm.next_out=c,this.flush=a,!e)return this._process(),this._checkError()?this._afterSync():void 0;var h=this;return t.nextTick(function(){h._process(),h._after()}),this},c.prototype._afterSync=function(){var e=this.strm.avail_out,t=this.strm.avail_in;return this.write_in_progress=!1,[t,e]},c.prototype._process=function(){var e=null;switch(this.mode){case n.DEFLATE:case n.GZIP:case n.DEFLATERAW:this.err=o.deflate(this.strm,this.flush);break;case n.UNZIP:switch(this.strm.avail_in>0&&(e=this.strm.next_in),this.gzip_id_bytes_read){case 0:if(null===e)break;if(31!==this.strm.input[e]){this.mode=n.INFLATE;break}if(this.gzip_id_bytes_read=1,e++,1===this.strm.avail_in)break;case 1:if(null===e)break;139===this.strm.input[e]?(this.gzip_id_bytes_read=2,this.mode=n.GUNZIP):this.mode=n.INFLATE;break;default:throw new Error("invalid number of gzip magic number bytes read")}case n.INFLATE:case n.GUNZIP:case n.INFLATERAW:for(this.err=s.inflate(this.strm,this.flush),this.err===n.Z_NEED_DICT&&this.dictionary&&(this.err=s.inflateSetDictionary(this.strm,this.dictionary),this.err===n.Z_OK?this.err=s.inflate(this.strm,this.flush):this.err===n.Z_DATA_ERROR&&(this.err=n.Z_NEED_DICT));this.strm.avail_in>0&&this.mode===n.GUNZIP&&this.err===n.Z_STREAM_END&&0!==this.strm.next_in[0];)this.reset(),this.err=s.inflate(this.strm,this.flush);break;default:throw new Error("Unknown mode "+this.mode)}},c.prototype._checkError=function(){switch(this.err){case n.Z_OK:case n.Z_BUF_ERROR:if(0!==this.strm.avail_out&&this.flush===n.Z_FINISH)return this._error("unexpected end of file"),!1;break;case n.Z_STREAM_END:break;case n.Z_NEED_DICT:return null==this.dictionary?this._error("Missing dictionary"):this._error("Bad dictionary"),!1;default:return this._error("Zlib error"),!1}return!0},c.prototype._after=function(){if(this._checkError()){var e=this.strm.avail_out,t=this.strm.avail_in;this.write_in_progress=!1,this.callback(t,e),this.pending_close&&this.close()}},c.prototype._error=function(e){this.strm.msg&&(e=this.strm.msg),this.onerror(e,this.err),this.write_in_progress=!1,this.pending_close&&this.close()},c.prototype.init=function(e,t,r,a,o){i(4===arguments.length||5===arguments.length,"init(windowBits, level, memLevel, strategy, [dictionary])"),i(e>=8&&e<=15,"invalid windowBits"),i(t>=-1&&t<=9,"invalid compression level"),i(r>=1&&r<=9,"invalid memlevel"),i(a===n.Z_FILTERED||a===n.Z_HUFFMAN_ONLY||a===n.Z_RLE||a===n.Z_FIXED||a===n.Z_DEFAULT_STRATEGY,"invalid strategy"),this._init(t,e,r,a,o),this._setDictionary()},c.prototype.params=function(){throw new Error("deflateParams Not supported")},c.prototype.reset=function(){this._reset(),this._setDictionary()},c.prototype._init=function(e,t,r,i,u){switch(this.level=e,this.windowBits=t,this.memLevel=r,this.strategy=i,this.flush=n.Z_NO_FLUSH,this.err=n.Z_OK,this.mode!==n.GZIP&&this.mode!==n.GUNZIP||(this.windowBits+=16),this.mode===n.UNZIP&&(this.windowBits+=32),this.mode!==n.DEFLATERAW&&this.mode!==n.INFLATERAW||(this.windowBits=-1*this.windowBits),this.strm=new a,this.mode){case n.DEFLATE:case n.GZIP:case n.DEFLATERAW:this.err=o.deflateInit2(this.strm,this.level,n.Z_DEFLATED,this.windowBits,this.memLevel,this.strategy);break;case n.INFLATE:case n.GUNZIP:case n.INFLATERAW:case n.UNZIP:this.err=s.inflateInit2(this.strm,this.windowBits);break;default:throw new Error("Unknown mode "+this.mode)}this.err!==n.Z_OK&&this._error("Init error"),this.dictionary=u,this.write_in_progress=!1,this.init_done=!0},c.prototype._setDictionary=function(){if(null!=this.dictionary){switch(this.err=n.Z_OK,this.mode){case n.DEFLATE:case n.DEFLATERAW:this.err=o.deflateSetDictionary(this.strm,this.dictionary)}this.err!==n.Z_OK&&this._error("Failed to set dictionary")}},c.prototype._reset=function(){switch(this.err=n.Z_OK,this.mode){case n.DEFLATE:case n.DEFLATERAW:case n.GZIP:this.err=o.deflateReset(this.strm);break;case n.INFLATE:case n.INFLATERAW:case n.GUNZIP:this.err=s.inflateReset(this.strm)}this.err!==n.Z_OK&&this._error("Failed to reset stream")},n.Zlib=c}).call(this,e("_process"),e("buffer").Buffer)},{_process:98,assert:36,buffer:4,"pako/lib/zlib/constants":46,"pako/lib/zlib/deflate.js":48,"pako/lib/zlib/inflate.js":50,"pako/lib/zlib/zstream":54}],41:[function(e,t,n){(function(t){"use strict";var r=e("buffer").Buffer,i=e("stream").Transform,a=e("./binding"),o=e("util"),s=e("assert").ok,u=e("buffer").kMaxLength,l="Cannot create final Buffer. It would be larger than 0x"+u.toString(16)+" bytes";a.Z_MIN_WINDOWBITS=8,a.Z_MAX_WINDOWBITS=15,a.Z_DEFAULT_WINDOWBITS=15,a.Z_MIN_CHUNK=64,a.Z_MAX_CHUNK=1/0,a.Z_DEFAULT_CHUNK=16384,a.Z_MIN_MEMLEVEL=1,a.Z_MAX_MEMLEVEL=9,a.Z_DEFAULT_MEMLEVEL=8,a.Z_MIN_LEVEL=-1,a.Z_MAX_LEVEL=9,a.Z_DEFAULT_LEVEL=a.Z_DEFAULT_COMPRESSION;for(var c=Object.keys(a),f=0;f=u?o=new RangeError(l):t=r.concat(i,a),i=[],e.close(),n(o,t)}e.on("error",function(t){e.removeListener("end",s),e.removeListener("readable",o),n(t)}),e.on("end",s),e.end(t),o()}function _(e,t){if("string"==typeof t&&(t=r.from(t)),!r.isBuffer(t))throw new TypeError("Not a string or buffer");var n=e._finishFlushFlag;return e._processChunk(t,n)}function w(e){if(!(this instanceof w))return new w(e);T.call(this,e,a.DEFLATE)}function b(e){if(!(this instanceof b))return new b(e);T.call(this,e,a.INFLATE)}function y(e){if(!(this instanceof y))return new y(e);T.call(this,e,a.GZIP)}function x(e){if(!(this instanceof x))return new x(e);T.call(this,e,a.GUNZIP)}function k(e){if(!(this instanceof k))return new k(e);T.call(this,e,a.DEFLATERAW)}function E(e){if(!(this instanceof E))return new E(e);T.call(this,e,a.INFLATERAW)}function S(e){if(!(this instanceof S))return new S(e);T.call(this,e,a.UNZIP)}function A(e){return e===a.Z_NO_FLUSH||e===a.Z_PARTIAL_FLUSH||e===a.Z_SYNC_FLUSH||e===a.Z_FULL_FLUSH||e===a.Z_FINISH||e===a.Z_BLOCK}function T(e,t){var o=this;if(this._opts=e=e||{},this._chunkSize=e.chunkSize||n.Z_DEFAULT_CHUNK,i.call(this,e),e.flush&&!A(e.flush))throw new Error("Invalid flush flag: "+e.flush);if(e.finishFlush&&!A(e.finishFlush))throw new Error("Invalid flush flag: "+e.finishFlush);if(this._flushFlag=e.flush||a.Z_NO_FLUSH,this._finishFlushFlag=void 0!==e.finishFlush?e.finishFlush:a.Z_FINISH,e.chunkSize&&(e.chunkSizen.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitsn.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.leveln.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLeveln.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=n.Z_FILTERED&&e.strategy!=n.Z_HUFFMAN_ONLY&&e.strategy!=n.Z_RLE&&e.strategy!=n.Z_FIXED&&e.strategy!=n.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!r.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new a.Zlib(t);var s=this;this._hadError=!1,this._handle.onerror=function(e,t){M(s),s._hadError=!0;var r=new Error(e);r.errno=t,r.code=n.codes[t],s.emit("error",r)};var u=n.Z_DEFAULT_COMPRESSION;"number"==typeof e.level&&(u=e.level);var l=n.Z_DEFAULT_STRATEGY;"number"==typeof e.strategy&&(l=e.strategy),this._handle.init(e.windowBits||n.Z_DEFAULT_WINDOWBITS,u,e.memLevel||n.Z_DEFAULT_MEMLEVEL,l,e.dictionary),this._buffer=r.allocUnsafe(this._chunkSize),this._offset=0,this._level=u,this._strategy=l,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!o._handle},configurable:!0,enumerable:!0})}function M(e,n){n&&t.nextTick(n),e._handle&&(e._handle.close(),e._handle=null)}function I(e){e.emit("close")}Object.defineProperty(n,"codes",{enumerable:!0,value:Object.freeze(p),writable:!1}),n.Deflate=w,n.Inflate=b,n.Gzip=y,n.Gunzip=x,n.DeflateRaw=k,n.InflateRaw=E,n.Unzip=S,n.createDeflate=function(e){return new w(e)},n.createInflate=function(e){return new b(e)},n.createDeflateRaw=function(e){return new k(e)},n.createInflateRaw=function(e){return new E(e)},n.createGzip=function(e){return new y(e)},n.createGunzip=function(e){return new x(e)},n.createUnzip=function(e){return new S(e)},n.deflate=function(e,t,n){return"function"==typeof t&&(n=t,t={}),m(new w(t),e,n)},n.deflateSync=function(e,t){return _(new w(t),e)},n.gzip=function(e,t,n){return"function"==typeof t&&(n=t,t={}),m(new y(t),e,n)},n.gzipSync=function(e,t){return _(new y(t),e)},n.deflateRaw=function(e,t,n){return"function"==typeof t&&(n=t,t={}),m(new k(t),e,n)},n.deflateRawSync=function(e,t){return _(new k(t),e)},n.unzip=function(e,t,n){return"function"==typeof t&&(n=t,t={}),m(new S(t),e,n)},n.unzipSync=function(e,t){return _(new S(t),e)},n.inflate=function(e,t,n){return"function"==typeof t&&(n=t,t={}),m(new b(t),e,n)},n.inflateSync=function(e,t){return _(new b(t),e)},n.gunzip=function(e,t,n){return"function"==typeof t&&(n=t,t={}),m(new x(t),e,n)},n.gunzipSync=function(e,t){return _(new x(t),e)},n.inflateRaw=function(e,t,n){return"function"==typeof t&&(n=t,t={}),m(new E(t),e,n)},n.inflateRawSync=function(e,t){return _(new E(t),e)},o.inherits(T,i),T.prototype.params=function(e,r,i){if(en.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(r!=n.Z_FILTERED&&r!=n.Z_HUFFMAN_ONLY&&r!=n.Z_RLE&&r!=n.Z_FIXED&&r!=n.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+r);if(this._level!==e||this._strategy!==r){var o=this;this.flush(a.Z_SYNC_FLUSH,function(){s(o._handle,"zlib binding closed"),o._handle.params(e,r),o._hadError||(o._level=e,o._strategy=r,i&&i())})}else t.nextTick(i)},T.prototype.reset=function(){return s(this._handle,"zlib binding closed"),this._handle.reset()},T.prototype._flush=function(e){this._transform(r.alloc(0),"",e)},T.prototype.flush=function(e,n){var i=this,o=this._writableState;("function"==typeof e||void 0===e&&!n)&&(n=e,e=a.Z_FULL_FLUSH),o.ended?n&&t.nextTick(n):o.ending?n&&this.once("end",n):o.needDrain?n&&this.once("drain",function(){return i.flush(e,n)}):(this._flushFlag=e,this.write(r.alloc(0),"",n))},T.prototype.close=function(e){M(this,e),t.nextTick(I,this)},T.prototype._transform=function(e,t,n){var i,o=this._writableState,s=(o.ending||o.ended)&&(!e||o.length===e.length);return null===e||r.isBuffer(e)?this._handle?(s?i=this._finishFlushFlag:(i=this._flushFlag,e.length>=o.length&&(this._flushFlag=this._opts.flush||a.Z_NO_FLUSH)),void this._processChunk(e,i,n)):n(new Error("zlib binding closed")):n(new Error("invalid input"))},T.prototype._processChunk=function(e,t,n){var i=e&&e.length,a=this._chunkSize-this._offset,o=0,c=this,f="function"==typeof n;if(!f){var h,p=[],d=0;this.on("error",function(e){h=e}),s(this._handle,"zlib binding closed");do{var g=this._handle.writeSync(t,e,o,i,this._buffer,this._offset,a)}while(!this._hadError&&_(g[0],g[1]));if(this._hadError)throw h;if(d>=u)throw M(this),new RangeError(l);var v=r.concat(p,d);return M(this),v}s(this._handle,"zlib binding closed");var m=this._handle.write(t,e,o,i,this._buffer,this._offset,a);function _(u,l){if(this&&(this.buffer=null,this.callback=null),!c._hadError){var h=a-l;if(s(h>=0,"have should not go down"),h>0){var g=c._buffer.slice(c._offset,c._offset+h);c._offset+=h,f?c.push(g):(p.push(g),d+=g.length)}if((0===l||c._offset>=c._chunkSize)&&(a=c._chunkSize,c._offset=0,c._buffer=r.allocUnsafe(c._chunkSize)),0===l){if(o+=i-u,i=u,!f)return!0;var v=c._handle.write(t,e,o,i,c._buffer,c._offset,c._chunkSize);return v.callback=_,void(v.buffer=e)}if(!f)return!1;n()}}m.buffer=e,m.callback=_},o.inherits(w,T),o.inherits(b,T),o.inherits(y,T),o.inherits(x,T),o.inherits(k,T),o.inherits(E,T),o.inherits(S,T)}).call(this,e("_process"))},{"./binding":40,_process:98,assert:36,buffer:4,stream:112,util:135}],42:[function(e,t,n){arguments[4][3][0].apply(n,arguments)},{dup:3}],43:[function(e,t,n){var r=Object.create||function(e){var t=function(){};return t.prototype=e,new t},i=Object.keys||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return n},a=Function.prototype.bind||function(e){var t=this;return function(){return t.apply(e,arguments)}};function o(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=r(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}t.exports=o,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._maxListeners=void 0;var s,u=10;try{var l={};Object.defineProperty&&Object.defineProperty(l,"x",{value:0}),s=0===l.x}catch(e){s=!1}function c(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function f(e,t,n,i){var a,o,s;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if((o=e._events)?(o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),s=o[t]):(o=e._events=r(null),e._eventsCount=0),s){if("function"==typeof s?s=o[t]=i?[n,s]:[s,n]:i?s.unshift(n):s.push(n),!s.warned&&(a=c(e))&&a>0&&s.length>a){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+' "'+String(t)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=s.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",u.name,u.message)}}else s=o[t]=n,++e._eventsCount;return e}function h(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var e=new Array(arguments.length),t=0;t1&&(t=arguments[1]),t instanceof Error)throw t;var u=new Error('Unhandled "error" event. ('+t+")");throw u.context=t,u}if(!(n=o[e]))return!1;var l="function"==typeof n;switch(r=arguments.length){case 1:!function(e,t,n){if(t)e.call(n);else for(var r=e.length,i=v(e,r),a=0;a=0;o--)if(n[o]===t||n[o].listener===t){s=n[o].listener,a=o;break}if(a<0)return this;0===a?n.shift():function(e,t){for(var n=t,r=n+1,i=e.length;r=0;a--)this.removeListener(e,t[a]);return this},o.prototype.listeners=function(e){return d(this,e,!0)},o.prototype.rawListeners=function(e){return d(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):g.call(e,t)},o.prototype.listenerCount=g,o.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],44:[function(e,t,n){"use strict";var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}n.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var r in n)i(n,r)&&(e[r]=n[r])}}return e},n.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var a={arraySet:function(e,t,n,r,i){if(t.subarray&&e.subarray)e.set(t.subarray(n,n+r),i);else for(var a=0;a>>16&65535|0,o=0;0!==n;){n-=o=n>2e3?2e3:n;do{a=a+(i=i+t[r++]|0)|0}while(--o);i%=65521,a%=65521}return i|a<<16|0}},{}],46:[function(e,t,n){"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],47:[function(e,t,n){"use strict";var r=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t,n,i){var a=r,o=i+n;e^=-1;for(var s=i;s>>8^a[255&(e^t[s])];return-1^e}},{}],48:[function(e,t,n){"use strict";var r,i=e("../utils/common"),a=e("./trees"),o=e("./adler32"),s=e("./crc32"),u=e("./messages"),l=0,c=1,f=3,h=4,p=5,d=0,g=1,v=-2,m=-3,_=-5,w=-1,b=1,y=2,x=3,k=4,E=0,S=2,A=8,T=9,M=15,I=8,j=286,R=30,L=19,B=2*j+1,C=15,O=3,z=258,D=z+O+1,F=32,N=42,P=69,U=73,q=91,V=103,Z=113,W=666,G=1,H=2,Y=3,$=4,X=3;function J(e,t){return e.msg=u[t],t}function K(e){return(e<<1)-(e>4?9:0)}function Q(e){for(var t=e.length;--t>=0;)e[t]=0}function ee(e){var t=e.state,n=t.pending;n>e.avail_out&&(n=e.avail_out),0!==n&&(i.arraySet(e.output,t.pending_buf,t.pending_out,n,e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))}function te(e,t){a._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,ee(e.strm)}function ne(e,t){e.pending_buf[e.pending++]=t}function re(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function ie(e,t){var n,r,i=e.max_chain_length,a=e.strstart,o=e.prev_length,s=e.nice_match,u=e.strstart>e.w_size-D?e.strstart-(e.w_size-D):0,l=e.window,c=e.w_mask,f=e.prev,h=e.strstart+z,p=l[a+o-1],d=l[a+o];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do{if(l[(n=t)+o]===d&&l[n+o-1]===p&&l[n]===l[a]&&l[++n]===l[a+1]){a+=2,n++;do{}while(l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&ao){if(e.match_start=t,o=r,r>=s)break;p=l[a+o-1],d=l[a+o]}}}while((t=f[t&c])>u&&0!=--i);return o<=e.lookahead?o:e.lookahead}function ae(e){var t,n,r,a,u,l,c,f,h,p,d=e.w_size;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=d+(d-D)){i.arraySet(e.window,e.window,d,d,0),e.match_start-=d,e.strstart-=d,e.block_start-=d,t=n=e.hash_size;do{r=e.head[--t],e.head[t]=r>=d?r-d:0}while(--n);t=n=d;do{r=e.prev[--t],e.prev[t]=r>=d?r-d:0}while(--n);a+=d}if(0===e.strm.avail_in)break;if(l=e.strm,c=e.window,f=e.strstart+e.lookahead,h=a,p=void 0,(p=l.avail_in)>h&&(p=h),n=0===p?0:(l.avail_in-=p,i.arraySet(c,l.input,l.next_in,p,f),1===l.state.wrap?l.adler=o(l.adler,c,p,f):2===l.state.wrap&&(l.adler=s(l.adler,c,p,f)),l.next_in+=p,l.total_in+=p,p),e.lookahead+=n,e.lookahead+e.insert>=O)for(u=e.strstart-e.insert,e.ins_h=e.window[u],e.ins_h=(e.ins_h<=O&&(e.ins_h=(e.ins_h<=O)if(r=a._tr_tally(e,e.strstart-e.match_start,e.match_length-O),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=O){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<=O&&(e.ins_h=(e.ins_h<4096)&&(e.match_length=O-1)),e.prev_length>=O&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-O,r=a._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-O),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=i&&(e.ins_h=(e.ins_h<15&&(s=2,r-=16),a<1||a>T||n!==A||r<8||r>15||t<0||t>9||o<0||o>k)return J(e,v);8===r&&(r=9);var u=new function(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=A,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new i.Buf16(2*B),this.dyn_dtree=new i.Buf16(2*(2*R+1)),this.bl_tree=new i.Buf16(2*(2*L+1)),Q(this.dyn_ltree),Q(this.dyn_dtree),Q(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(C+1),this.heap=new i.Buf16(2*j+1),Q(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(2*j+1),Q(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0};return e.state=u,u.strm=e,u.wrap=s,u.gzhead=null,u.w_bits=r,u.w_size=1<e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(ae(e),0===e.lookahead&&t===l)return G;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+n;if((0===e.strstart||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,te(e,!1),0===e.strm.avail_out))return G;if(e.strstart-e.block_start>=e.w_size-D&&(te(e,!1),0===e.strm.avail_out))return G}return e.insert=0,t===h?(te(e,!0),0===e.strm.avail_out?Y:$):(e.strstart>e.block_start&&(te(e,!1),e.strm.avail_out),G)}),new ue(4,4,8,4,oe),new ue(4,5,16,8,oe),new ue(4,6,32,32,oe),new ue(4,4,16,16,se),new ue(8,16,32,32,se),new ue(8,16,128,128,se),new ue(8,32,128,256,se),new ue(32,128,258,1024,se),new ue(32,258,258,4096,se)],n.deflateInit=function(e,t){return fe(e,t,A,M,I,E)},n.deflateInit2=fe,n.deflateReset=ce,n.deflateResetKeep=le,n.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?v:(e.state.gzhead=t,d):v},n.deflate=function(e,t){var n,i,o,u;if(!e||!e.state||t>p||t<0)return e?J(e,v):v;if(i=e.state,!e.output||!e.input&&0!==e.avail_in||i.status===W&&t!==h)return J(e,0===e.avail_out?_:v);if(i.strm=e,n=i.last_flush,i.last_flush=t,i.status===N)if(2===i.wrap)e.adler=0,ne(i,31),ne(i,139),ne(i,8),i.gzhead?(ne(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),ne(i,255&i.gzhead.time),ne(i,i.gzhead.time>>8&255),ne(i,i.gzhead.time>>16&255),ne(i,i.gzhead.time>>24&255),ne(i,9===i.level?2:i.strategy>=y||i.level<2?4:0),ne(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(ne(i,255&i.gzhead.extra.length),ne(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=s(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=P):(ne(i,0),ne(i,0),ne(i,0),ne(i,0),ne(i,0),ne(i,9===i.level?2:i.strategy>=y||i.level<2?4:0),ne(i,X),i.status=Z);else{var m=A+(i.w_bits-8<<4)<<8;m|=(i.strategy>=y||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(m|=F),m+=31-m%31,i.status=Z,re(i,m),0!==i.strstart&&(re(i,e.adler>>>16),re(i,65535&e.adler)),e.adler=1}if(i.status===P)if(i.gzhead.extra){for(o=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),ee(e),o=i.pending,i.pending!==i.pending_buf_size));)ne(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=U)}else i.status=U;if(i.status===U)if(i.gzhead.name){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),ee(e),o=i.pending,i.pending===i.pending_buf_size)){u=1;break}u=i.gzindexo&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),0===u&&(i.gzindex=0,i.status=q)}else i.status=q;if(i.status===q)if(i.gzhead.comment){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),ee(e),o=i.pending,i.pending===i.pending_buf_size)){u=1;break}u=i.gzindexo&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),0===u&&(i.status=V)}else i.status=V;if(i.status===V&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&ee(e),i.pending+2<=i.pending_buf_size&&(ne(i,255&e.adler),ne(i,e.adler>>8&255),e.adler=0,i.status=Z)):i.status=Z),0!==i.pending){if(ee(e),0===e.avail_out)return i.last_flush=-1,d}else if(0===e.avail_in&&K(t)<=K(n)&&t!==h)return J(e,_);if(i.status===W&&0!==e.avail_in)return J(e,_);if(0!==e.avail_in||0!==i.lookahead||t!==l&&i.status!==W){var w=i.strategy===y?function(e,t){for(var n;;){if(0===e.lookahead&&(ae(e),0===e.lookahead)){if(t===l)return G;break}if(e.match_length=0,n=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(te(e,!1),0===e.strm.avail_out))return G}return e.insert=0,t===h?(te(e,!0),0===e.strm.avail_out?Y:$):e.last_lit&&(te(e,!1),0===e.strm.avail_out)?G:H}(i,t):i.strategy===x?function(e,t){for(var n,r,i,o,s=e.window;;){if(e.lookahead<=z){if(ae(e),e.lookahead<=z&&t===l)return G;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=O&&e.strstart>0&&(r=s[i=e.strstart-1])===s[++i]&&r===s[++i]&&r===s[++i]){o=e.strstart+z;do{}while(r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&ie.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=O?(n=a._tr_tally(e,1,e.match_length-O),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(te(e,!1),0===e.strm.avail_out))return G}return e.insert=0,t===h?(te(e,!0),0===e.strm.avail_out?Y:$):e.last_lit&&(te(e,!1),0===e.strm.avail_out)?G:H}(i,t):r[i.level].func(i,t);if(w!==Y&&w!==$||(i.status=W),w===G||w===Y)return 0===e.avail_out&&(i.last_flush=-1),d;if(w===H&&(t===c?a._tr_align(i):t!==p&&(a._tr_stored_block(i,0,0,!1),t===f&&(Q(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),ee(e),0===e.avail_out))return i.last_flush=-1,d}return t!==h?d:i.wrap<=0?g:(2===i.wrap?(ne(i,255&e.adler),ne(i,e.adler>>8&255),ne(i,e.adler>>16&255),ne(i,e.adler>>24&255),ne(i,255&e.total_in),ne(i,e.total_in>>8&255),ne(i,e.total_in>>16&255),ne(i,e.total_in>>24&255)):(re(i,e.adler>>>16),re(i,65535&e.adler)),ee(e),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?d:g)},n.deflateEnd=function(e){var t;return e&&e.state?(t=e.state.status)!==N&&t!==P&&t!==U&&t!==q&&t!==V&&t!==Z&&t!==W?J(e,v):(e.state=null,t===Z?J(e,m):d):v},n.deflateSetDictionary=function(e,t){var n,r,a,s,u,l,c,f,h=t.length;if(!e||!e.state)return v;if(2===(s=(n=e.state).wrap)||1===s&&n.status!==N||n.lookahead)return v;for(1===s&&(e.adler=o(e.adler,t,h,0)),n.wrap=0,h>=n.w_size&&(0===s&&(Q(n.head),n.strstart=0,n.block_start=0,n.insert=0),f=new i.Buf8(n.w_size),i.arraySet(f,t,h-n.w_size,n.w_size,0),t=f,h=n.w_size),u=e.avail_in,l=e.next_in,c=e.input,e.avail_in=h,e.next_in=0,e.input=t,ae(n);n.lookahead>=O;){r=n.strstart,a=n.lookahead-(O-1);do{n.ins_h=(n.ins_h<>>=b=w>>>24,d-=b,0===(b=w>>>16&255))A[a++]=65535&w;else{if(!(16&b)){if(0==(64&b)){w=g[(65535&w)+(p&(1<>>=b,d-=b),d<15&&(p+=S[r++]<>>=b=w>>>24,d-=b,!(16&(b=w>>>16&255))){if(0==(64&b)){w=v[(65535&w)+(p&(1<u){e.msg="invalid distance too far back",n.mode=30;break e}if(p>>>=b,d-=b,x>(b=a-o)){if((b=x-b)>c&&n.sane){e.msg="invalid distance too far back",n.mode=30;break e}if(k=0,E=h,0===f){if(k+=l-b,b2;)A[a++]=E[k++],A[a++]=E[k++],A[a++]=E[k++],y-=3;y&&(A[a++]=E[k++],y>1&&(A[a++]=E[k++]))}else{k=a-x;do{A[a++]=A[k++],A[a++]=A[k++],A[a++]=A[k++],y-=3}while(y>2);y&&(A[a++]=A[k++],y>1&&(A[a++]=A[k++]))}break}}break}}while(r>3,p&=(1<<(d-=y<<3))-1,e.next_in=r,e.next_out=a,e.avail_in=r>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function ie(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=x,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new r.Buf32(ee),t.distcode=t.distdyn=new r.Buf32(te),t.sane=1,t.back=-1,d):m}function ae(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,ie(e)):m}function oe(e,t){var n,r;return e&&e.state?(r=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?m:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,ae(e))):m}function se(e,t){var n,i;return e?(i=new function(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0},e.state=i,i.window=null,(n=oe(e,t))!==d&&(e.state=null),n):m}var ue,le,ce=!0;function fe(e){if(ce){var t;for(ue=new r.Buf32(512),le=new r.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(s(l,e.lens,0,288,ue,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;s(c,e.lens,0,32,le,0,e.work,{bits:5}),ce=!1}e.lencode=ue,e.lenbits=9,e.distcode=le,e.distbits=5}function he(e,t,n,i){var a,o=e.state;return null===o.window&&(o.wsize=1<=o.wsize?(r.arraySet(o.window,t,n-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((a=o.wsize-o.wnext)>i&&(a=i),r.arraySet(o.window,t,n-i,a,o.wnext),(i-=a)?(r.arraySet(o.window,t,n-i,i,0),o.wnext=i,o.whave=o.wsize):(o.wnext+=a,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,n.check=a(n.check,Te,2,0),se=0,ue=0,n.mode=k;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&se)<<8)+(se>>8))%31){e.msg="incorrect header check",n.mode=J;break}if((15&se)!==y){e.msg="unknown compression method",n.mode=J;break}if(ue-=4,xe=8+(15&(se>>>=4)),0===n.wbits)n.wbits=xe;else if(xe>n.wbits){e.msg="invalid window size",n.mode=J;break}n.dmax=1<>8&1),512&n.flags&&(Te[0]=255&se,Te[1]=se>>>8&255,n.check=a(n.check,Te,2,0)),se=0,ue=0,n.mode=E;case E:for(;ue<32;){if(0===ae)break e;ae--,se+=ee[ne++]<>>8&255,Te[2]=se>>>16&255,Te[3]=se>>>24&255,n.check=a(n.check,Te,4,0)),se=0,ue=0,n.mode=S;case S:for(;ue<16;){if(0===ae)break e;ae--,se+=ee[ne++]<>8),512&n.flags&&(Te[0]=255&se,Te[1]=se>>>8&255,n.check=a(n.check,Te,2,0)),se=0,ue=0,n.mode=A;case A:if(1024&n.flags){for(;ue<16;){if(0===ae)break e;ae--,se+=ee[ne++]<>>8&255,n.check=a(n.check,Te,2,0)),se=0,ue=0}else n.head&&(n.head.extra=null);n.mode=T;case T:if(1024&n.flags&&((pe=n.length)>ae&&(pe=ae),pe&&(n.head&&(xe=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),r.arraySet(n.head.extra,ee,ne,pe,xe)),512&n.flags&&(n.check=a(n.check,ee,pe,ne)),ae-=pe,ne+=pe,n.length-=pe),n.length))break e;n.length=0,n.mode=M;case M:if(2048&n.flags){if(0===ae)break e;pe=0;do{xe=ee[ne+pe++],n.head&&xe&&n.length<65536&&(n.head.name+=String.fromCharCode(xe))}while(xe&&pe>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=B;break;case R:for(;ue<32;){if(0===ae)break e;ae--,se+=ee[ne++]<>>=7&ue,ue-=7&ue,n.mode=Y;break}for(;ue<3;){if(0===ae)break e;ae--,se+=ee[ne++]<>>=1)){case 0:n.mode=O;break;case 1:if(fe(n),n.mode=U,t===p){se>>>=2,ue-=2;break e}break;case 2:n.mode=F;break;case 3:e.msg="invalid block type",n.mode=J}se>>>=2,ue-=2;break;case O:for(se>>>=7&ue,ue-=7&ue;ue<32;){if(0===ae)break e;ae--,se+=ee[ne++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=J;break}if(n.length=65535&se,se=0,ue=0,n.mode=z,t===p)break e;case z:n.mode=D;case D:if(pe=n.length){if(pe>ae&&(pe=ae),pe>oe&&(pe=oe),0===pe)break e;r.arraySet(te,ee,ne,pe,ie),ae-=pe,ne+=pe,oe-=pe,ie+=pe,n.length-=pe;break}n.mode=B;break;case F:for(;ue<14;){if(0===ae)break e;ae--,se+=ee[ne++]<>>=5,ue-=5,n.ndist=1+(31&se),se>>>=5,ue-=5,n.ncode=4+(15&se),se>>>=4,ue-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=J;break}n.have=0,n.mode=N;case N:for(;n.have>>=3,ue-=3}for(;n.have<19;)n.lens[Me[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,Ee={bits:n.lenbits},ke=s(u,n.lens,0,19,n.lencode,0,n.work,Ee),n.lenbits=Ee.bits,ke){e.msg="invalid code lengths set",n.mode=J;break}n.have=0,n.mode=P;case P:for(;n.have>>16&255,_e=65535&Ae,!((ve=Ae>>>24)<=ue);){if(0===ae)break e;ae--,se+=ee[ne++]<>>=ve,ue-=ve,n.lens[n.have++]=_e;else{if(16===_e){for(Se=ve+2;ue>>=ve,ue-=ve,0===n.have){e.msg="invalid bit length repeat",n.mode=J;break}xe=n.lens[n.have-1],pe=3+(3&se),se>>>=2,ue-=2}else if(17===_e){for(Se=ve+3;ue>>=ve)),se>>>=3,ue-=3}else{for(Se=ve+7;ue>>=ve)),se>>>=7,ue-=7}if(n.have+pe>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=J;break}for(;pe--;)n.lens[n.have++]=xe}}if(n.mode===J)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=J;break}if(n.lenbits=9,Ee={bits:n.lenbits},ke=s(l,n.lens,0,n.nlen,n.lencode,0,n.work,Ee),n.lenbits=Ee.bits,ke){e.msg="invalid literal/lengths set",n.mode=J;break}if(n.distbits=6,n.distcode=n.distdyn,Ee={bits:n.distbits},ke=s(c,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,Ee),n.distbits=Ee.bits,ke){e.msg="invalid distances set",n.mode=J;break}if(n.mode=U,t===p)break e;case U:n.mode=q;case q:if(ae>=6&&oe>=258){e.next_out=ie,e.avail_out=oe,e.next_in=ne,e.avail_in=ae,n.hold=se,n.bits=ue,o(e,ce),ie=e.next_out,te=e.output,oe=e.avail_out,ne=e.next_in,ee=e.input,ae=e.avail_in,se=n.hold,ue=n.bits,n.mode===B&&(n.back=-1);break}for(n.back=0;me=(Ae=n.lencode[se&(1<>>16&255,_e=65535&Ae,!((ve=Ae>>>24)<=ue);){if(0===ae)break e;ae--,se+=ee[ne++]<>we)])>>>16&255,_e=65535&Ae,!(we+(ve=Ae>>>24)<=ue);){if(0===ae)break e;ae--,se+=ee[ne++]<>>=we,ue-=we,n.back+=we}if(se>>>=ve,ue-=ve,n.back+=ve,n.length=_e,0===me){n.mode=H;break}if(32&me){n.back=-1,n.mode=B;break}if(64&me){e.msg="invalid literal/length code",n.mode=J;break}n.extra=15&me,n.mode=V;case V:if(n.extra){for(Se=n.extra;ue>>=n.extra,ue-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=Z;case Z:for(;me=(Ae=n.distcode[se&(1<>>16&255,_e=65535&Ae,!((ve=Ae>>>24)<=ue);){if(0===ae)break e;ae--,se+=ee[ne++]<>we)])>>>16&255,_e=65535&Ae,!(we+(ve=Ae>>>24)<=ue);){if(0===ae)break e;ae--,se+=ee[ne++]<>>=we,ue-=we,n.back+=we}if(se>>>=ve,ue-=ve,n.back+=ve,64&me){e.msg="invalid distance code",n.mode=J;break}n.offset=_e,n.extra=15&me,n.mode=W;case W:if(n.extra){for(Se=n.extra;ue>>=n.extra,ue-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=J;break}n.mode=G;case G:if(0===oe)break e;if(pe=ce-oe,n.offset>pe){if((pe=n.offset-pe)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=J;break}pe>n.wnext?(pe-=n.wnext,de=n.wsize-pe):de=n.wnext-pe,pe>n.length&&(pe=n.length),ge=n.window}else ge=te,de=ie-n.offset,pe=n.length;pe>oe&&(pe=oe),oe-=pe,n.length-=pe;do{te[ie++]=ge[de++]}while(--pe);0===n.length&&(n.mode=q);break;case H:if(0===oe)break e;te[ie++]=n.length,oe--,n.mode=q;break;case Y:if(n.wrap){for(;ue<32;){if(0===ae)break e;ae--,se|=ee[ne++]<=1&&0===O[A];A--);if(T>A&&(T=A),0===A)return l[c++]=20971520,l[c++]=20971520,h.bits=1,0;for(S=1;S0&&(0===e||1!==A))return-1;for(z[1]=0,k=1;k<15;k++)z[k+1]=z[k]+O[k];for(E=0;E852||2===e&&R>592)return 1;for(;;){w=k-I,f[E]<_?(b=0,y=f[E]):f[E]>_?(b=D[F+f[E]],y=B[C+f[E]]):(b=96,y=0),p=1<>I)+(d-=p)]=w<<24|b<<16|y|0}while(0!==d);for(p=1<>=1;if(0!==p?(L&=p-1,L+=p):L=0,E++,0==--O[k]){if(k===A)break;k=t[n+f[E]]}if(k>T&&(L&v)!==g){for(0===I&&(I=T),m+=S,j=1<<(M=k-I);M+I852||2===e&&R>592)return 1;l[g=L&v]=T<<24|M<<16|m-c|0}}return 0!==L&&(l[m+L]=k-I<<24|64<<16|0),h.bits=T,0}},{"../utils/common":44}],52:[function(e,t,n){"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],53:[function(e,t,n){"use strict";var r=e("../utils/common"),i=4,a=0,o=1,s=2;function u(e){for(var t=e.length;--t>=0;)e[t]=0}var l=0,c=1,f=2,h=29,p=256,d=p+1+h,g=30,v=19,m=2*d+1,_=15,w=16,b=7,y=256,x=16,k=17,E=18,S=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],A=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],T=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],M=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],I=new Array(2*(d+2));u(I);var j=new Array(2*g);u(j);var R=new Array(512);u(R);var L=new Array(256);u(L);var B=new Array(h);u(B);var C,O,z,D=new Array(g);function F(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}function N(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function P(e){return e<256?R[e]:R[256+(e>>>7)]}function U(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function q(e,t,n){e.bi_valid>w-n?(e.bi_buf|=t<>w-e.bi_valid,e.bi_valid+=n-w):(e.bi_buf|=t<>>=1,n<<=1}while(--t>0);return n>>>1}function W(e,t,n){var r,i,a=new Array(_+1),o=0;for(r=1;r<=_;r++)a[r]=o=o+n[r-1]<<1;for(i=0;i<=t;i++){var s=e[2*i+1];0!==s&&(e[2*i]=Z(a[s]++,s))}}function G(e){var t;for(t=0;t8?U(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function Y(e,t,n,r){var i=2*t,a=2*n;return e[i]>1;n>=1;n--)$(e,a,n);i=u;do{n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],$(e,a,1),r=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=r,a[2*i]=a[2*n]+a[2*r],e.depth[i]=(e.depth[n]>=e.depth[r]?e.depth[n]:e.depth[r])+1,a[2*n+1]=a[2*r+1]=i,e.heap[1]=i++,$(e,a,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var n,r,i,a,o,s,u=t.dyn_tree,l=t.max_code,c=t.stat_desc.static_tree,f=t.stat_desc.has_stree,h=t.stat_desc.extra_bits,p=t.stat_desc.extra_base,d=t.stat_desc.max_length,g=0;for(a=0;a<=_;a++)e.bl_count[a]=0;for(u[2*e.heap[e.heap_max]+1]=0,n=e.heap_max+1;nd&&(a=d,g++),u[2*r+1]=a,r>l||(e.bl_count[a]++,o=0,r>=p&&(o=h[r-p]),s=u[2*r],e.opt_len+=s*(a+o),f&&(e.static_len+=s*(c[2*r+1]+o)));if(0!==g){do{for(a=d-1;0===e.bl_count[a];)a--;e.bl_count[a]--,e.bl_count[a+1]+=2,e.bl_count[d]--,g-=2}while(g>0);for(a=d;0!==a;a--)for(r=e.bl_count[a];0!==r;)(i=e.heap[--n])>l||(u[2*i+1]!==a&&(e.opt_len+=(a-u[2*i+1])*u[2*i],u[2*i+1]=a),r--)}}(e,t),W(a,l,e.bl_count)}function K(e,t,n){var r,i,a=-1,o=t[1],s=0,u=7,l=4;for(0===o&&(u=138,l=3),t[2*(n+1)+1]=65535,r=0;r<=n;r++)i=o,o=t[2*(r+1)+1],++s>=7;r0?(e.strm.data_type===s&&(e.strm.data_type=function(e){var t,n=4093624447;for(t=0;t<=31;t++,n>>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return a;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return o;for(t=32;t=3&&0===e.bl_tree[2*M[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),u=e.opt_len+3+7>>>3,(l=e.static_len+3+7>>>3)<=u&&(u=l)):u=l=n+5,n+4<=u&&-1!==t?te(e,t,n,r):e.strategy===i||l===u?(q(e,(c<<1)+(r?1:0),3),X(e,I,j)):(q(e,(f<<1)+(r?1:0),3),function(e,t,n,r){var i;for(q(e,t-257,5),q(e,n-1,5),q(e,r-4,4),i=0;i>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&n,e.last_lit++,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(L[n]+p+1)]++,e.dyn_dtree[2*P(t)]++),e.last_lit===e.lit_bufsize-1},n._tr_align=function(e){q(e,c<<1,3),V(e,y,I),function(e){16===e.bi_valid?(U(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":44}],54:[function(e,t,n){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],55:[function(e,t,n){n.read=function(e,t,n,r,i){var a,o,s=8*i-r-1,u=(1<>1,c=-7,f=n?i-1:0,h=n?-1:1,p=e[t+f];for(f+=h,a=p&(1<<-c)-1,p>>=-c,c+=s;c>0;a=256*a+e[t+f],f+=h,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=r;c>0;o=256*o+e[t+f],f+=h,c-=8);if(0===a)a=1-l;else{if(a===u)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,r),a-=l}return(p?-1:1)*o*Math.pow(2,a-r)},n.write=function(e,t,n,r,i,a){var o,s,u,l=8*a-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:a-1,d=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),(t+=o+f>=1?h/u:h*Math.pow(2,1-f))*u>=2&&(o++,u/=2),o+f>=c?(s=0,o=c):o+f>=1?(s=(t*u-1)*Math.pow(2,i),o+=f):(s=t*Math.pow(2,f-1)*Math.pow(2,i),o=0));i>=8;e[n+p]=255&s,p+=d,s/=256,i-=8);for(o=o<0;e[n+p]=255&o,p+=d,o/=256,l-=8);e[n+p-d]|=128*g}},{}],56:[function(e,t,n){t.exports=[function(e,t){return{options:e,draw:function(t,n,r){r.stop(!0),r.overrideFlag=!0;var i=this;return t.pixelManipulation({output:function(e,t,n){i.output={src:t,format:n}},changePixel:function(e,t,n,r){return[255-e,255-t,255-n,r]},format:t.format,image:e.image,inBrowser:e.inBrowser,callback:n})},output:void 0,UI:t}},{name:"Invert",description:"Inverts the image.",inputs:{}}]},{}],57:[function(e,t,n){arguments[4][37][0].apply(n,arguments)},{dup:37}],58:[function(e,t,n){"use strict";t.exports=function(e){for(var t=new Array(e),n=0;n>i;0!=(t&o)&&p++;var d=n>>i;return 0!=(n&o)&&d++,function(e,t,n,o,s,u){function l(e,t,n){return en?n:e}var c=r.BitMatrix.createEmpty(o,s);function f(e,t,n,r,i){for(var o=n*i+t,s=0;sd&&(p=d);for(var g=0;gm&&(v=m);for(var _=l(g,2,t-3),w=l(h,2,n-3),b=0,y=-2;y<=2;y++){var x=u[w+y];b+=x[_-2],b+=x[_-1],b+=x[_],b+=x[_+1],b+=x[_+2]}f(e,v,p,b/25,o)}}return c}(u,p,d,t,n,function(e,t,n,r,o){for(var u=new Array(n),l=0;lh&&(f=h);for(var p=0;pg&&(d=g);for(var v=0,m=255,_=0,w=0,b=f*r+d;w_&&(_=x)}if(_-m>s)for(w++,b+=r;w>2*i;if(_-m<=s&&(k=m>>1,c>0&&p>0)){var E=u[c-1][p]+2*u[c][p-1]+u[c-1][p-1]>>2;m=n&&(e++,r+=t.estimatedModuleSize)}),e<3)return!1;for(var a=r/i,o=0,s=0;s=0&&c(n,l);)o[2]++,l--;if(l<0)return null;for(;l>=0&&!c(n,l)&&o[1]<=r;)o[1]++,l--;if(l<0||o[1]>r)return null;for(;l>=0&&c(n,l)&&o[0]<=r;)o[0]++,l--;if(o[0]>r)return null;for(l=t+1;l=r)return null;for(;l=r)return null;var f=o[0]+o[1]+o[2]+o[3]+o[4];return 5*Math.abs(f-i)>=2*i?null:s(o)?u(o,l):null}(r,Math.floor(f),n[2],l);if(null!=h&&null!=(f=function(t,n,r,i){for(var a=e.width,o=[0,0,0,0,0],l=t;l>=0&&c(l,n);)o[2]++,l--;if(l<0)return null;for(;l>=0&&!c(l,n)&&o[1]<=r;)o[1]++,l--;if(l<0||o[1]>r)return null;for(;l>=0&&c(l,n)&&o[0]<=r;)o[0]++,l--;if(o[0]>r)return null;for(l=t+1;l=r)return null;for(;l=r)return null;var f=o[0]+o[1]+o[2]+o[3]+o[4];return 5*Math.abs(f-i)>=i?null:s(o)?u(o,l):null}(Math.floor(f),Math.floor(h),n[2],l))&&(!a||function(t,n,r,i){for(var a=e.height,o=e.width,u=[0,0,0,0,0],l=0;t-l>=0&&c(n-l,t-l);)u[2]++,l++;if(t-l<0||n-l<0)return!1;for(;t-l>=0&&n-l>=0&&!c(n-l,t-l)&&u[1]<=r;)u[1]++,l++;if(t-l<0||n-l<0||u[1]>r)return!1;for(;t-l>=0&&n-l>=0&&c(n-l,t-l)&&u[0]<=r;)u[0]++,l++;if(u[0]>r)return!1;for(l=1;t+l=a||n+l>=o)return!1;for(;t+l=a||n+l>=o||u[3]>=r)return!1;for(;t+l=r)return!1;var f=u[0]+u[1]+u[2]+u[3]+u[4];return Math.abs(f-i)<2*i&&s(u)}(Math.floor(h),Math.floor(f),n[2],l))){for(var p=l/7,d=!1,g=0;g=n){if(null!=e)return a=!0,Math.floor(Math.abs(e.x-t.x)-Math.abs(e.y-t.y))/2;e=t}}),0}var d=e.height,g=e.width,v=Math.floor(3*d/(4*i));v_[2]&&(w+=x-_[2]-v,y=g-1)}_=[0,0,0,0,0],b=0}else _=[_[2],_[3],_[4],1,0],b=3;else _[++b]++;else _[b]++;s(_)&&h(_,w,g,!1)&&(v=_[0],a&&(m=f()))}var k=function(){var e=t.length;if(e<3)return null;if(e>3){var n=0,r=0;t.forEach(function(e){var t=e.estimatedModuleSize;n+=t,r+=t*t});var i=n/e,a=Math.sqrt(r/e-i*i);t.sort(function(e,t){var n=Math.abs(t.estimatedModuleSize-i),r=Math.abs(e.estimatedModuleSize-i);return n3;s++){var u=t[s];Math.abs(u.estimatedModuleSize-i)>o&&(t.splice(s,1),s--)}}return t.length>3&&(n=0,t.forEach(function(e){n+=e.estimatedModuleSize}),i=n/t.length,t.sort(function(e,t){if(t.count===e.count){var n=Math.abs(t.estimatedModuleSize-i),r=Math.abs(e.estimatedModuleSize-i);return n=i&&a>=o?(n=e[0],t=e[1],r=e[2]):o>=a&&o>=i?(n=e[1],t=e[0],r=e[2]):(n=e[2],t=e[0],r=e[1]),function(e,t,n){var r=t.x,i=t.y;return(n.x-r)*(e.y-i)-(n.y-i)*(e.x-r)}(t,n,r)<0){var s=t;t=r,r=s}return{bottomLeft:{x:t.x,y:t.y},topLeft:{x:n.x,y:n.y},topRight:{x:r.x,y:r.y}}}(k):null}},function(e,t,n){"use strict";var r=n(5),i=n(7),a=n(8),o=n(2),s=n(6);function u(e,t,n){for(var r=!0,i=0;ie||o<-1||o>t)throw new Error;r=!1,-1==a?(n[i]=0,r=!0):a==e&&(n[i]=e-1,r=!0),-1==o?(n[i+1]=0,r=!0):o==t&&(n[i+1]=t-1,r=!0)}r=!0;for(i=n.length-2;i>=0&&r;i-=2){a=Math.floor(n[i]),o=Math.floor(n[i+1]);if(a<-1||a>e||o<-1||o>t)throw new Error;r=!1,-1==a?(n[i]=0,r=!0):a==e&&(n[i]=e-1,r=!0),-1==o?(n[i+1]=0,r=!0):o==t&&(n[i+1]=t-1,r=!0)}return n}function l(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))}function c(e,t,n,i,a){t=Math.floor(t),n=Math.floor(n);var o=Math.floor(i*e),s=Math.max(0,t-o),u=Math.min(a.width,t+o);if(u-s<3*e)return null;var l=Math.max(0,n-o),c=Math.min(a.height-1,n+o);return r.findAlignment(s,l,u-s,c-l,e,a)}function f(e,t,n,r,i){e=Math.floor(e),t=Math.floor(t),n=Math.floor(n),r=Math.floor(r);var a=Math.abs(r-t)>Math.abs(n-e);if(a){var o=e;e=t,t=o,o=n,n=r,r=o}for(var s=Math.abs(n-e),u=Math.abs(r-t),c=-s>>1,f=e0){if(v==r)break;v+=h,c-=s}}return 2==p?l(n+f,r,e,t):NaN}function h(e,t,n,r,i){var a=f(e,t,n,r,i),o=1,s=e-(n-e);s<0?(o=e/(e-s),s=0):s>=i.width&&(o=(i.width-1-e)/(s-e),s=i.width-1);var u=t-(r-t)*o;return o=1,u<0?(o=t/(t-u),u=0):u>=i.height&&(o=(i.height-1-t)/(u-t),u=i.height-1),(a+=f(e,t,s=e+(s-e)*o,u,i))-1}function p(e,t,n){var r=h(e.x,e.y,t.x,t.y,n),i=h(t.x,t.y,e.x,e.y,n);return s.isNaN(r)?i/7:s.isNaN(i)?r/7:(r+i)/14}t.extract=function(e,t){var n=function(e,t,n,r){return(p(e,t,r)+p(e,n,r))/2}(t.topLeft,t.topRight,t.bottomLeft,e);if(n<1)return null;var r=function(e,t,n,r){var i=7+(Math.round(l(e.x,e.y,t.x,t.y)/r)+Math.round(l(e.x,e.y,n.x,n.y)/r)>>1);switch(3&i){case 0:i++;break;case 2:i--}return i}(t.topLeft,t.topRight,t.bottomLeft,n);if(!r)return null;var s=function(e){if(e%4!=1)return null;var t=e-17>>2;return t<1||t>40?null:a.getVersionForNumber(t)}(r);if(null==s)return null;var f=s.getDimensionForVersion()-7,h=null;if(s.alignmentPatternCenters.length>0)for(var d=t.topRight.x-t.topLeft.x+t.bottomLeft.x,g=t.topRight.y-t.topLeft.y+t.bottomLeft.y,v=1-3/f,m=t.topLeft.x+v*(d-t.topLeft.x),_=t.topLeft.y+v*(g-t.topLeft.y),w=4;w<=16&&!(h=c(n,m,_,w,e));w<<=1);return function(e,t,n){if(t<=0)return null;for(var r=o.BitMatrix.createEmpty(t,t),a=new Array(t<<1),s=0;s>1),a[f+1]=c;a=i.transformPoints(n,a);try{var h=u(e.width,e.height,a)}catch(e){return null}for(f=0;f>1,s,e.get(Math.floor(h[f]),Math.floor(h[f+1])))}return r}(e,r,function(e,t,n,r,a){var o,s,u,l,c=a-3.5;return null!=r?(o=r.x,s=r.y,u=l=c-3):(o=t.x-e.x+n.x,s=t.y-e.y+n.y,u=l=c),i.quadrilateralToQuadrilateral(3.5,3.5,c,3.5,u,l,3.5,c,e.x,e.y,t.x,t.y,o,s,n.x,n.y)}(t.topLeft,t.topRight,t.bottomLeft,h,r))}},function(e,t,n){"use strict";var r=n(6);function i(e,t,n,r){if(Math.abs(n-e.y)<=t&&Math.abs(r-e.x)<=t){var i=Math.abs(t-e.estimatedModuleSize);return i<=1||i<=e.estimatedModuleSize}return!1}function a(e,t,n,r){return{x:(e.x+n)/2,y:(e.y+t)/2,estimatedModuleSize:(e.estimatedModuleSize+r)/2}}function o(e,t){for(var n=t/2,r=0;r<3;r++)if(Math.abs(t-e[r])>=n)return!1;return!0}function s(e,t){var n=t-e[2]-e[1]/2;return r.isNaN(n)?null:n}t.findAlignment=function(e,t,n,r,u,l){var c=[];function f(e,t,n,r){var u=e[0]+e[1]+e[2],f=s(e,n);if(null==f)return null;var h=function(e,t,n,r,i,a){for(var u=a.height,l=[0,0,0],c=e;c>=0&&a.get(t,c)&&l[1]<=n;)l[1]++,c--;if(c<0||l[1]>n)return null;for(;c>=0&&!a.get(t,c)&&l[0]<=n;)l[0]++,c--;if(l[0]>n)return null;for(c=e+1;cn)return null;for(;cn)return null;var f=l[0]+l[1]+l[2];return 5*Math.abs(f-r)>=2*r?null:o(l,i)?s(l,c):null}(t,Math.floor(f),2*e[1],u,r,l);if(null!=h){var p=(e[0]+e[1]+e[2])/3;for(var d in c){var g=c[d];if(i(g,p,h,f))return a(g,h,f,p)}var v={x:f,y:h,estimatedModuleSize:p};c.push(v)}return null}for(var h=e+n,p=t+(r>>1),d=[0,0,0],g=0;g>1:-(g+1>>1));d[0]=0,d[1]=0,d[2]=0;for(var m=e;m>4&15]+n[e>>8&15]+n[e>>12&15]+n[e>>16&15]+n[e>>20&15]+n[e>>24&15]+n[e>>28&15]},t.isNaN=function(e){return"[object Number]"===Object.prototype.toString.call(e)&&e!==+e}},function(e,t){"use strict";function n(e,t,n,r,i,a,o,s){var u=e-n+i-o,l=t-r+a-s;if(0==u&&0==l)return{a11:n-e,a21:i-n,a31:e,a12:r-t,a22:a-r,a32:t,a13:0,a23:0,a33:1};var c=n-i,f=o-i,h=r-a,p=s-a,d=c*p-f*h,g=(u*p-f*l)/d,v=(c*l-u*h)/d;return{a11:n-e+g*n,a21:o-e+v*o,a31:e,a12:r-t+g*r,a22:s-t+v*s,a32:t,a13:g,a23:v,a33:1}}t.transformPoints=function(e,t){for(var n=t.length,r=e.a11,i=e.a12,a=e.a13,o=e.a21,s=e.a22,u=e.a23,l=e.a31,c=e.a32,f=e.a33,h=0;h40)throw new Error("Invalid version number "+e);return u[e-1]}t.getVersionForNumber=l},function(e,t,n){"use strict";var r=n(2),i=n(10),a=n(6),o=n(12),s=n(8),u=21522,l=[[21522,0],[20773,1],[24188,2],[23371,3],[17913,4],[16590,5],[20375,6],[19104,7],[30660,8],[29427,9],[32170,10],[30877,11],[26159,12],[25368,13],[27713,14],[26998,15],[5769,16],[5054,17],[7399,18],[6608,19],[1890,20],[597,21],[3340,22],[2107,23],[13663,24],[12392,25],[16177,26],[14854,27],[9396,28],[8579,29],[11994,30],[11245,31]],c=[function(e,t){return 0==(e+t&1)},function(e,t){return 0==(1&e)},function(e,t){return t%3==0},function(e,t){return(e+t)%3==0},function(e,t){return 0==((e>>1)+t/3&1)},function(e,t){return(e*t&1)+e*t%3==0},function(e,t){return 0==((e*t&1)+e*t%3&1)},function(e,t){return 0==((e+t&1)+e*t%3&1)}],f=[{ordinal:1,bits:0,name:"M"},{ordinal:0,bits:1,name:"L"},{ordinal:3,bits:2,name:"H"},{ordinal:2,bits:3,name:"Q"}];function h(e,t,n){for(var i=c[n.dataMask],a=e.height,o=function(e){for(var t=e.getDimensionForVersion(),n=new Array(t*t),i=0;i6&&(a.setRegion(t-11,0,3,6),a.setRegion(0,t-11,6,3)),a}(t),s=!0,u=[],l=0,f=0,h=0,p=a-1;p>0;p-=2){6==p&&p--;for(var d=0;d>3&3],dataMask:7&e}}function d(e,t){for(var n=1/0,r=0,i=0;i=0;r--)t=e.copyBit(8,r,t);var i=e.height,a=0,o=i-7;for(r=i-1;r>=o;r--)a=e.copyBit(8,r,a);for(n=i-8;n>2;if(n<=6)return s.getVersionForNumber(n);for(var r=0,i=t-11,a=5;a>=0;a--)for(var o=t-9;o>=i;o--)r=e.copyBit(o,a,r);var u=s.Version.decodeVersionInformation(r);if(null!=u&&u.getDimensionForVersion()==t)return u;for(r=0,o=5;o>=0;o--)for(a=t-9;a>=i;a--)r=e.copyBit(o,a,r);return null!=(u=s.Version.decodeVersionInformation(r))&&u.getDimensionForVersion()==t?u:null}(e);if(!t)return null;var n=g(e);if(!n)return null;var r=n.errorCorrectionLevel,a=h(e,t,n);if(!a)return null;var o=function(e,t,n){if(e.length!=t.totalCodewords)throw new Error("Invalid number of codewords for version; got "+e.length+" expected "+t.totalCodewords);var r=t.getECBlocksForLevel(n),i=0,a=r.ecBlocks;a.forEach(function(e){i+=e.count});var o=new Array(i),s=0;a.forEach(function(e){for(var t=0;t=0&&o[l].codewords.length!=u;)l--;l++;for(var c=u-r.ecCodewordsPerBlock,f=0,h=0;h=t.length)throw new Error("Could not decode alphanumeric char");return t[e].charCodeAt(0)}var a=function(){function e(e,t){this.characterCountBitsForVersions=e,this.bits=t}return e.prototype.getCharacterCountBits=function(e){if(null==this.characterCountBitsForVersions)throw new Error("Character count doesn't apply to this mode");var t;return t=e<=9?0:e<=26?1:2,this.characterCountBitsForVersions[t]},e}(),o=new a([0,0,0],0),s=new a([10,12,14],1),u=new a([9,11,13],2),l=new a([0,0,0],3),c=new a([8,16,16],4),f=new a(null,7),h=new a([8,10,12],8),p=new a(null,5),d=new a(null,9),g=new a([8,10,12],13);function v(e){switch(e){case 0:return o;case 1:return s;case 2:return u;case 3:return l;case 4:return c;case 5:return p;case 7:return f;case 8:return h;case 9:return d;case 13:return g;default:throw new Error("Couldn't decode mode from byte array")}}function m(e){var t=e.readBits(8);if(0==(128&t))return 127&t;if(128==(192&t))return(63&t)<<8|e.readBits(8);if(192==(224&t))return(31&t)<<16|e.readBits(16);throw new Error("Bad ECI bits starting with byte "+t)}function _(e,t,n){if(13*n>e.available())return!1;for(var r=new Array(2*n),i=0;n>0;){var a=e.readBits(13),o=Math.floor(a/96)<<8|a%96;o+=o<959?41377:42657,r[i]=o>>8&255,r[i+1]=255&o,i+=2,n--}return t.val=r,!0}function w(e,t,n){for(;n>=3;){if(e.available()<10)return!1;var r=e.readBits(10);if(r>=1e3)return!1;t.val.push(i(Math.floor(r/100))),t.val.push(i(Math.floor(r/10)%10)),t.val.push(i(r%10)),n-=3}if(2==n){if(e.available()<7)return!1;var a=e.readBits(7);if(a>=100)return!1;t.val.push(i(Math.floor(a/10))),t.val.push(i(a%10))}else if(1==n){if(e.available()<4)return!1;var o=e.readBits(4);if(o>=10)return!1;t.val.push(i(o))}return!0}function b(e,t,n,r){for(var a=t.val.length;n>1;){if(e.available()<11)return!1;var o=e.readBits(11);t.val.push(i(Math.floor(o/45))),t.val.push(i(o%45)),n-=2}if(1==n){if(e.available()<6)return!1;t.val.push(i(e.readBits(6)))}if(r)for(var s=a;se.available())return!1;for(var r=new Array(n),i=0;i30)return null}else if(i==g){var A=a.readBits(4),T=a.readBits(i.getCharacterCountBits(t));if(A==x&&!_(a,k,T))return null}else{var M=a.readBits(i.getCharacterCountBits(t));if(i==s){if(!w(a,k,M))return null}else if(i==u){if(!b(a,k,M,E))return null}else if(i==c){if(!y(a,k,M))return null}else if(i!=h)return null}return k.val}},function(e,t){"use strict";var n=function(){function e(e){this.byteOffset=0,this.bitOffset=0,this.bytes=e}return e.prototype.readBits=function(e){if(e<1||e>32||e>this.available())throw new Error("Cannot read "+e.toString()+" bits");var t=0;if(this.bitOffset>0){var n=8-this.bitOffset,r=e>8-r<<(a=n-r);t=(this.bytes[this.byteOffset]&i)>>a,e-=r,this.bitOffset+=r,8==this.bitOffset&&(this.bitOffset=0,this.byteOffset++)}if(e>0){for(;e>=8;)t=t<<8|255&this.bytes[this.byteOffset],this.byteOffset++,e-=8;if(e>0){var a;i=255>>(a=8-e)<>a,this.bitOffset+=e}}return t},e.prototype.available=function(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset},e}();t.BitStream=n},function(e,t){"use strict";var n=function(){function e(){this.field=new i(285,256,0)}return e.prototype.decode=function(e,t){for(var n=new r(this.field,e),a=new Array(t),o=!0,s=0;s=n/2;){var u=i,l=o;if(o=s,(i=a).isZero())return null;a=u;for(var c=this.field.zero,f=i.getCoefficient(i.degree()),h=this.field.inverse(f);a.degree()>=i.degree()&&!a.isZero();){var p=a.degree()-i.degree(),d=this.field.multiply(a.getCoefficient(a.degree()),h);c=c.addOrSubtract(this.field.buildMonomial(p,d)),a=a.addOrSubtract(i.multiplyByMonomial(p,d))}if(s=c.multiplyPoly(o).addOrSubtract(l),a.degree()>=i.degree())return null}var g=s.getCoefficient(0);if(0==g)return null;var v=this.field.inverse(g);return[s.multiply(v),a.multiply(v)]},e.prototype.findErrorLocations=function(e){var t=e.degree();if(1==t)return[e.getCoefficient(1)];for(var n=new Array(t),r=0,i=1;i1&&0==t[0]){for(var r=1;rr.length){var a=n;n=r,r=a}for(var o=new Array(r.length),s=r.length-n.length,u=0;u=this.size&&(e^=this.primitive,e&=this.size-1);for(t=0;t>>1,F=[["ary",x],["bind",g],["bindKey",v],["curry",_],["curryRight",w],["flip",E],["partial",b],["partialRight",y],["rearg",k]],N="[object Arguments]",P="[object Array]",U="[object AsyncFunction]",q="[object Boolean]",V="[object Date]",Z="[object DOMException]",W="[object Error]",G="[object Function]",H="[object GeneratorFunction]",Y="[object Map]",$="[object Number]",X="[object Null]",J="[object Object]",K="[object Proxy]",Q="[object RegExp]",ee="[object Set]",te="[object String]",ne="[object Symbol]",re="[object Undefined]",ie="[object WeakMap]",ae="[object WeakSet]",oe="[object ArrayBuffer]",se="[object DataView]",ue="[object Float32Array]",le="[object Float64Array]",ce="[object Int8Array]",fe="[object Int16Array]",he="[object Int32Array]",pe="[object Uint8Array]",de="[object Uint8ClampedArray]",ge="[object Uint16Array]",ve="[object Uint32Array]",me=/\b__p \+= '';/g,_e=/\b(__p \+=) '' \+/g,we=/(__e\(.*?\)|\b__t\)) \+\n'';/g,be=/&(?:amp|lt|gt|quot|#39);/g,ye=/[&<>"']/g,xe=RegExp(be.source),ke=RegExp(ye.source),Ee=/<%-([\s\S]+?)%>/g,Se=/<%([\s\S]+?)%>/g,Ae=/<%=([\s\S]+?)%>/g,Te=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Me=/^\w*$/,Ie=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,je=/[\\^$.*+?()[\]{}|]/g,Re=RegExp(je.source),Le=/^\s+|\s+$/g,Be=/^\s+/,Ce=/\s+$/,Oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ze=/\{\n\/\* \[wrapped with (.+)\] \*/,De=/,? & /,Fe=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Ne=/\\(\\)?/g,Pe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ue=/\w*$/,qe=/^[-+]0x[0-9a-f]+$/i,Ve=/^0b[01]+$/i,Ze=/^\[object .+?Constructor\]$/,We=/^0o[0-7]+$/i,Ge=/^(?:0|[1-9]\d*)$/,He=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ye=/($^)/,$e=/['\n\r\u2028\u2029\\]/g,Xe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Je="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ke="[\\ud800-\\udfff]",Qe="["+Je+"]",et="["+Xe+"]",tt="\\d+",nt="[\\u2700-\\u27bf]",rt="[a-z\\xdf-\\xf6\\xf8-\\xff]",it="[^\\ud800-\\udfff"+Je+tt+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",at="\\ud83c[\\udffb-\\udfff]",ot="[^\\ud800-\\udfff]",st="(?:\\ud83c[\\udde6-\\uddff]){2}",ut="[\\ud800-\\udbff][\\udc00-\\udfff]",lt="[A-Z\\xc0-\\xd6\\xd8-\\xde]",ct="(?:"+rt+"|"+it+")",ft="(?:"+lt+"|"+it+")",ht="(?:"+et+"|"+at+")"+"?",pt="[\\ufe0e\\ufe0f]?"+ht+("(?:\\u200d(?:"+[ot,st,ut].join("|")+")[\\ufe0e\\ufe0f]?"+ht+")*"),dt="(?:"+[nt,st,ut].join("|")+")"+pt,gt="(?:"+[ot+et+"?",et,st,ut,Ke].join("|")+")",vt=RegExp("['’]","g"),mt=RegExp(et,"g"),_t=RegExp(at+"(?="+at+")|"+gt+pt,"g"),wt=RegExp([lt+"?"+rt+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[Qe,lt,"$"].join("|")+")",ft+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[Qe,lt+ct,"$"].join("|")+")",lt+"?"+ct+"+(?:['’](?:d|ll|m|re|s|t|ve))?",lt+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",tt,dt].join("|"),"g"),bt=RegExp("[\\u200d\\ud800-\\udfff"+Xe+"\\ufe0e\\ufe0f]"),yt=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,xt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],kt=-1,Et={};Et[ue]=Et[le]=Et[ce]=Et[fe]=Et[he]=Et[pe]=Et[de]=Et[ge]=Et[ve]=!0,Et[N]=Et[P]=Et[oe]=Et[q]=Et[se]=Et[V]=Et[W]=Et[G]=Et[Y]=Et[$]=Et[J]=Et[Q]=Et[ee]=Et[te]=Et[ie]=!1;var St={};St[N]=St[P]=St[oe]=St[se]=St[q]=St[V]=St[ue]=St[le]=St[ce]=St[fe]=St[he]=St[Y]=St[$]=St[J]=St[Q]=St[ee]=St[te]=St[ne]=St[pe]=St[de]=St[ge]=St[ve]=!0,St[W]=St[G]=St[ie]=!1;var At={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Tt=parseFloat,Mt=parseInt,It="object"==typeof e&&e&&e.Object===Object&&e,jt="object"==typeof self&&self&&self.Object===Object&&self,Rt=It||jt||Function("return this")(),Lt="object"==typeof n&&n&&!n.nodeType&&n,Bt=Lt&&"object"==typeof t&&t&&!t.nodeType&&t,Ct=Bt&&Bt.exports===Lt,Ot=Ct&&It.process,zt=function(){try{var e=Bt&&Bt.require&&Bt.require("util").types;return e||Ot&&Ot.binding&&Ot.binding("util")}catch(e){}}(),Dt=zt&&zt.isArrayBuffer,Ft=zt&&zt.isDate,Nt=zt&&zt.isMap,Pt=zt&&zt.isRegExp,Ut=zt&&zt.isSet,qt=zt&&zt.isTypedArray;function Vt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Zt(e,t,n,r){for(var i=-1,a=null==e?0:e.length;++i-1}function Xt(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function wn(e,t){for(var n=e.length;n--&&on(t,e[n],0)>-1;);return n}var bn=fn({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),yn=fn({"&":"&","<":"<",">":">",'"':""","'":"'"});function xn(e){return"\\"+At[e]}function kn(e){return bt.test(e)}function En(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function Sn(e,t){return function(n){return e(t(n))}}function An(e,t){for(var n=-1,r=e.length,i=0,a=[];++n",""":'"',"'":"'"});var Bn=function e(t){var n,Xe=(t=null==t?Rt:Bn.defaults(Rt.Object(),t,Bn.pick(Rt,xt))).Array,Je=t.Date,Ke=t.Error,Qe=t.Function,et=t.Math,tt=t.Object,nt=t.RegExp,rt=t.String,it=t.TypeError,at=Xe.prototype,ot=Qe.prototype,st=tt.prototype,ut=t["__core-js_shared__"],lt=ot.toString,ct=st.hasOwnProperty,ft=0,ht=(n=/[^.]+$/.exec(ut&&ut.keys&&ut.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",pt=st.toString,dt=lt.call(tt),gt=Rt._,_t=nt("^"+lt.call(ct).replace(je,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),bt=Ct?t.Buffer:r,At=t.Symbol,It=t.Uint8Array,jt=bt?bt.allocUnsafe:r,Lt=Sn(tt.getPrototypeOf,tt),Bt=tt.create,Ot=st.propertyIsEnumerable,zt=at.splice,nn=At?At.isConcatSpreadable:r,fn=At?At.iterator:r,Cn=At?At.toStringTag:r,On=function(){try{var e=Na(tt,"defineProperty");return e({},"",{}),e}catch(e){}}(),zn=t.clearTimeout!==Rt.clearTimeout&&t.clearTimeout,Dn=Je&&Je.now!==Rt.Date.now&&Je.now,Fn=t.setTimeout!==Rt.setTimeout&&t.setTimeout,Nn=et.ceil,Pn=et.floor,Un=tt.getOwnPropertySymbols,qn=bt?bt.isBuffer:r,Vn=t.isFinite,Zn=at.join,Wn=Sn(tt.keys,tt),Gn=et.max,Hn=et.min,Yn=Je.now,$n=t.parseInt,Xn=et.random,Jn=at.reverse,Kn=Na(t,"DataView"),Qn=Na(t,"Map"),er=Na(t,"Promise"),tr=Na(t,"Set"),nr=Na(t,"WeakMap"),rr=Na(tt,"create"),ir=nr&&new nr,ar={},or=co(Kn),sr=co(Qn),ur=co(er),lr=co(tr),cr=co(nr),fr=At?At.prototype:r,hr=fr?fr.valueOf:r,pr=fr?fr.toString:r;function dr(e){if(Ms(e)&&!ms(e)&&!(e instanceof _r)){if(e instanceof mr)return e;if(ct.call(e,"__wrapped__"))return fo(e)}return new mr(e)}var gr=function(){function e(){}return function(t){if(!Ts(t))return{};if(Bt)return Bt(t);e.prototype=t;var n=new e;return e.prototype=r,n}}();function vr(){}function mr(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=r}function _r(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=O,this.__views__=[]}function wr(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function zr(e,t,n,i,a,o){var s,u=t&c,l=t&f,p=t&h;if(n&&(s=a?n(e,i,a,o):n(e)),s!==r)return s;if(!Ts(e))return e;var d=ms(e);if(d){if(s=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&ct.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!u)return ra(e,s)}else{var g=qa(e),v=g==G||g==H;if(ys(e))return Ji(e,u);if(g==J||g==N||v&&!a){if(s=l||v?{}:Za(e),!u)return l?function(e,t){return ia(e,Ua(e),t)}(e,function(e,t){return e&&ia(t,au(t),e)}(s,e)):function(e,t){return ia(e,Pa(e),t)}(e,Lr(s,e))}else{if(!St[g])return a?e:{};s=function(e,t,n){var r,i,a,o=e.constructor;switch(t){case oe:return Ki(e);case q:case V:return new o(+e);case se:return function(e,t){var n=t?Ki(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case ue:case le:case ce:case fe:case he:case pe:case de:case ge:case ve:return Qi(e,n);case Y:return new o;case $:case te:return new o(e);case Q:return(a=new(i=e).constructor(i.source,Ue.exec(i))).lastIndex=i.lastIndex,a;case ee:return new o;case ne:return r=e,hr?tt(hr.call(r)):{}}}(e,g,u)}}o||(o=new kr);var m=o.get(e);if(m)return m;if(o.set(e,s),Bs(e))return e.forEach(function(r){s.add(zr(r,t,n,r,e,o))}),s;if(Is(e))return e.forEach(function(r,i){s.set(i,zr(r,t,n,i,e,o))}),s;var _=d?r:(p?l?La:Ra:l?au:iu)(e);return Wt(_||e,function(r,i){_&&(r=e[i=r]),Ir(s,i,zr(r,t,n,i,e,o))}),s}function Dr(e,t,n){var i=n.length;if(null==e)return!i;for(e=tt(e);i--;){var a=n[i],o=t[a],s=e[a];if(s===r&&!(a in e)||!o(s))return!1}return!0}function Fr(e,t,n){if("function"!=typeof e)throw new it(o);return ro(function(){e.apply(r,n)},t)}function Nr(e,t,n,r){var a=-1,o=$t,s=!0,u=e.length,l=[],c=t.length;if(!u)return l;n&&(t=Jt(t,gn(n))),r?(o=Xt,s=!1):t.length>=i&&(o=mn,s=!1,t=new xr(t));e:for(;++a-1},br.prototype.set=function(e,t){var n=this.__data__,r=jr(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},yr.prototype.clear=function(){this.size=0,this.__data__={hash:new wr,map:new(Qn||br),string:new wr}},yr.prototype.delete=function(e){var t=Da(this,e).delete(e);return this.size-=t?1:0,t},yr.prototype.get=function(e){return Da(this,e).get(e)},yr.prototype.has=function(e){return Da(this,e).has(e)},yr.prototype.set=function(e,t){var n=Da(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},xr.prototype.add=xr.prototype.push=function(e){return this.__data__.set(e,s),this},xr.prototype.has=function(e){return this.__data__.has(e)},kr.prototype.clear=function(){this.__data__=new br,this.size=0},kr.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},kr.prototype.get=function(e){return this.__data__.get(e)},kr.prototype.has=function(e){return this.__data__.has(e)},kr.prototype.set=function(e,t){var n=this.__data__;if(n instanceof br){var r=n.__data__;if(!Qn||r.length0&&n(s)?t>1?Wr(s,t-1,n,r,i):Kt(i,s):r||(i[i.length]=s)}return i}var Gr=ua(),Hr=ua(!0);function Yr(e,t){return e&&Gr(e,t,iu)}function $r(e,t){return e&&Hr(e,t,iu)}function Xr(e,t){return Yt(t,function(t){return Es(e[t])})}function Jr(e,t){for(var n=0,i=(t=Hi(t,e)).length;null!=e&&nt}function ti(e,t){return null!=e&&ct.call(e,t)}function ni(e,t){return null!=e&&t in tt(e)}function ri(e,t,n){for(var i=n?Xt:$t,a=e[0].length,o=e.length,s=o,u=Xe(o),l=1/0,c=[];s--;){var f=e[s];s&&t&&(f=Jt(f,gn(t))),l=Hn(f.length,l),u[s]=!n&&(t||a>=120&&f.length>=120)?new xr(s&&f):r}f=e[0];var h=-1,p=u[0];e:for(;++h=s)return u;var l=n[r];return u*("desc"==l?-1:1)}}return e.index-t.index}(e,t,n)})}function wi(e,t,n){for(var r=-1,i=t.length,a={};++r-1;)s!==e&&zt.call(s,u,1),zt.call(e,u,1);return e}function yi(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==a){var a=i;Ga(i)?zt.call(e,i,1):Ni(e,i)}}return e}function xi(e,t){return e+Pn(Xn()*(t-e+1))}function ki(e,t){var n="";if(!e||t<1||t>L)return n;do{t%2&&(n+=e),(t=Pn(t/2))&&(e+=e)}while(t);return n}function Ei(e,t){return io(eo(e,t,ju),e+"")}function Si(e){return Sr(pu(e))}function Ai(e,t){var n=pu(e);return so(n,Or(t,0,n.length))}function Ti(e,t,n,i){if(!Ts(e))return e;for(var a=-1,o=(t=Hi(t,e)).length,s=o-1,u=e;null!=u&&++ai?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=Xe(i);++r>>1,o=e[a];null!==o&&!Os(o)&&(n?o<=t:o=i){var c=t?null:ka(e);if(c)return Mn(c);s=!1,a=mn,l=new xr}else l=t?[]:u;e:for(;++r=i?e:Ri(e,t,n)}var Xi=zn||function(e){return Rt.clearTimeout(e)};function Ji(e,t){if(t)return e.slice();var n=e.length,r=jt?jt(n):new e.constructor(n);return e.copy(r),r}function Ki(e){var t=new e.constructor(e.byteLength);return new It(t).set(new It(e)),t}function Qi(e,t){var n=t?Ki(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ea(e,t){if(e!==t){var n=e!==r,i=null===e,a=e==e,o=Os(e),s=t!==r,u=null===t,l=t==t,c=Os(t);if(!u&&!c&&!o&&e>t||o&&s&&l&&!u&&!c||i&&s&&l||!n&&l||!a)return 1;if(!i&&!o&&!c&&e1?n[a-1]:r,s=a>2?n[2]:r;for(o=e.length>3&&"function"==typeof o?(a--,o):r,s&&Ha(n[0],n[1],s)&&(o=a<3?r:o,a=1),t=tt(t);++i-1?a[o?t[s]:s]:r}}function pa(e){return ja(function(t){var n=t.length,i=n,a=mr.prototype.thru;for(e&&t.reverse();i--;){var s=t[i];if("function"!=typeof s)throw new it(o);if(a&&!u&&"wrapper"==Ca(s))var u=new mr([],!0)}for(i=u?i:n;++i1&&_.reverse(),f&&lu))return!1;var c=o.get(e);if(c&&o.get(t))return c==t;var f=-1,h=!0,g=n&d?new xr:r;for(o.set(e,t),o.set(t,e);++f-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(Oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return Wt(F,function(n){var r="_."+n[0];t&n[1]&&!$t(e,r)&&e.push(r)}),e.sort()}(function(e){var t=e.match(ze);return t?t[1].split(De):[]}(r),n)))}function oo(e){var t=0,n=0;return function(){var i=Yn(),a=M-(i-n);if(n=i,a>0){if(++t>=T)return arguments[0]}else t=0;return e.apply(r,arguments)}}function so(e,t){var n=-1,i=e.length,a=i-1;for(t=t===r?i:t;++n1?e[t-1]:r;return Lo(e,n="function"==typeof n?(e.pop(),n):r)});function No(e){var t=dr(e);return t.__chain__=!0,t}function Po(e,t){return t(e)}var Uo=ja(function(e){var t=e.length,n=t?e[0]:0,i=this.__wrapped__,a=function(t){return Cr(t,e)};return!(t>1||this.__actions__.length)&&i instanceof _r&&Ga(n)?((i=i.slice(n,+n+(t?1:0))).__actions__.push({func:Po,args:[a],thisArg:r}),new mr(i,this.__chain__).thru(function(e){return t&&!e.length&&e.push(r),e})):this.thru(a)});var qo=aa(function(e,t,n){ct.call(e,n)?++e[n]:Br(e,n,1)});var Vo=ha(vo),Zo=ha(mo);function Wo(e,t){return(ms(e)?Wt:Pr)(e,za(t,3))}function Go(e,t){return(ms(e)?Gt:Ur)(e,za(t,3))}var Ho=aa(function(e,t,n){ct.call(e,n)?e[n].push(t):Br(e,n,[t])});var Yo=Ei(function(e,t,n){var r=-1,i="function"==typeof t,a=ws(e)?Xe(e.length):[];return Pr(e,function(e){a[++r]=i?Vt(t,e,n):ii(e,t,n)}),a}),$o=aa(function(e,t,n){Br(e,n,t)});function Xo(e,t){return(ms(e)?Jt:pi)(e,za(t,3))}var Jo=aa(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]});var Ko=Ei(function(e,t){if(null==e)return[];var n=t.length;return n>1&&Ha(e,t[0],t[1])?t=[]:n>2&&Ha(t[0],t[1],t[2])&&(t=[t[0]]),_i(e,Wr(t,1),[])}),Qo=Dn||function(){return Rt.Date.now()};function es(e,t,n){return t=n?r:t,t=e&&null==t?e.length:t,Sa(e,x,r,r,r,r,t)}function ts(e,t){var n;if("function"!=typeof t)throw new it(o);return e=Us(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=r),n}}var ns=Ei(function(e,t,n){var r=g;if(n.length){var i=An(n,Oa(ns));r|=b}return Sa(e,r,t,n,i)}),rs=Ei(function(e,t,n){var r=g|v;if(n.length){var i=An(n,Oa(rs));r|=b}return Sa(t,r,e,n,i)});function is(e,t,n){var i,a,s,u,l,c,f=0,h=!1,p=!1,d=!0;if("function"!=typeof e)throw new it(o);function g(t){var n=i,o=a;return i=a=r,f=t,u=e.apply(o,n)}function v(e){var n=e-c;return c===r||n>=t||n<0||p&&e-f>=s}function m(){var e=Qo();if(v(e))return _(e);l=ro(m,function(e){var n=t-(e-c);return p?Hn(n,s-(e-f)):n}(e))}function _(e){return l=r,d&&i?g(e):(i=a=r,u)}function w(){var e=Qo(),n=v(e);if(i=arguments,a=this,c=e,n){if(l===r)return function(e){return f=e,l=ro(m,t),h?g(e):u}(c);if(p)return l=ro(m,t),g(c)}return l===r&&(l=ro(m,t)),u}return t=Vs(t)||0,Ts(n)&&(h=!!n.leading,s=(p="maxWait"in n)?Gn(Vs(n.maxWait)||0,t):s,d="trailing"in n?!!n.trailing:d),w.cancel=function(){l!==r&&Xi(l),f=0,i=c=a=l=r},w.flush=function(){return l===r?u:_(Qo())},w}var as=Ei(function(e,t){return Fr(e,1,t)}),os=Ei(function(e,t,n){return Fr(e,Vs(t)||0,n)});function ss(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new it(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(ss.Cache||yr),n}function us(e){if("function"!=typeof e)throw new it(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}ss.Cache=yr;var ls=Yi(function(e,t){var n=(t=1==t.length&&ms(t[0])?Jt(t[0],gn(za())):Jt(Wr(t,1),gn(za()))).length;return Ei(function(r){for(var i=-1,a=Hn(r.length,n);++i=t}),vs=ai(function(){return arguments}())?ai:function(e){return Ms(e)&&ct.call(e,"callee")&&!Ot.call(e,"callee")},ms=Xe.isArray,_s=Dt?gn(Dt):function(e){return Ms(e)&&Qr(e)==oe};function ws(e){return null!=e&&As(e.length)&&!Es(e)}function bs(e){return Ms(e)&&ws(e)}var ys=qn||Vu,xs=Ft?gn(Ft):function(e){return Ms(e)&&Qr(e)==V};function ks(e){if(!Ms(e))return!1;var t=Qr(e);return t==W||t==Z||"string"==typeof e.message&&"string"==typeof e.name&&!Rs(e)}function Es(e){if(!Ts(e))return!1;var t=Qr(e);return t==G||t==H||t==U||t==K}function Ss(e){return"number"==typeof e&&e==Us(e)}function As(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=L}function Ts(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Ms(e){return null!=e&&"object"==typeof e}var Is=Nt?gn(Nt):function(e){return Ms(e)&&qa(e)==Y};function js(e){return"number"==typeof e||Ms(e)&&Qr(e)==$}function Rs(e){if(!Ms(e)||Qr(e)!=J)return!1;var t=Lt(e);if(null===t)return!0;var n=ct.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&<.call(n)==dt}var Ls=Pt?gn(Pt):function(e){return Ms(e)&&Qr(e)==Q};var Bs=Ut?gn(Ut):function(e){return Ms(e)&&qa(e)==ee};function Cs(e){return"string"==typeof e||!ms(e)&&Ms(e)&&Qr(e)==te}function Os(e){return"symbol"==typeof e||Ms(e)&&Qr(e)==ne}var zs=qt?gn(qt):function(e){return Ms(e)&&As(e.length)&&!!Et[Qr(e)]};var Ds=ba(hi),Fs=ba(function(e,t){return e<=t});function Ns(e){if(!e)return[];if(ws(e))return Cs(e)?Rn(e):ra(e);if(fn&&e[fn])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[fn]());var t=qa(e);return(t==Y?En:t==ee?Mn:pu)(e)}function Ps(e){return e?(e=Vs(e))===R||e===-R?(e<0?-1:1)*B:e==e?e:0:0===e?e:0}function Us(e){var t=Ps(e),n=t%1;return t==t?n?t-n:t:0}function qs(e){return e?Or(Us(e),0,O):0}function Vs(e){if("number"==typeof e)return e;if(Os(e))return C;if(Ts(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Ts(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(Le,"");var n=Ve.test(e);return n||We.test(e)?Mt(e.slice(2),n?2:8):qe.test(e)?C:+e}function Zs(e){return ia(e,au(e))}function Ws(e){return null==e?"":Di(e)}var Gs=oa(function(e,t){if(Ja(t)||ws(t))ia(t,iu(t),e);else for(var n in t)ct.call(t,n)&&Ir(e,n,t[n])}),Hs=oa(function(e,t){ia(t,au(t),e)}),Ys=oa(function(e,t,n,r){ia(t,au(t),e,r)}),$s=oa(function(e,t,n,r){ia(t,iu(t),e,r)}),Xs=ja(Cr);var Js=Ei(function(e,t){e=tt(e);var n=-1,i=t.length,a=i>2?t[2]:r;for(a&&Ha(t[0],t[1],a)&&(i=1);++n1),t}),ia(e,La(e),n),r&&(n=zr(n,c|f|h,Ma));for(var i=t.length;i--;)Ni(n,t[i]);return n});var lu=ja(function(e,t){return null==e?{}:function(e,t){return wi(e,t,function(t,n){return eu(e,n)})}(e,t)});function cu(e,t){if(null==e)return{};var n=Jt(La(e),function(e){return[e]});return t=za(t),wi(e,n,function(e,n){return t(e,n[0])})}var fu=Ea(iu),hu=Ea(au);function pu(e){return null==e?[]:vn(e,iu(e))}var du=ca(function(e,t,n){return t=t.toLowerCase(),e+(n?gu(t):t)});function gu(e){return ku(Ws(e).toLowerCase())}function vu(e){return(e=Ws(e))&&e.replace(He,bn).replace(mt,"")}var mu=ca(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),_u=ca(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),wu=la("toLowerCase");var bu=ca(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()});var yu=ca(function(e,t,n){return e+(n?" ":"")+ku(t)});var xu=ca(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),ku=la("toUpperCase");function Eu(e,t,n){return e=Ws(e),(t=n?r:t)===r?function(e){return yt.test(e)}(e)?function(e){return e.match(wt)||[]}(e):function(e){return e.match(Fe)||[]}(e):e.match(t)||[]}var Su=Ei(function(e,t){try{return Vt(e,r,t)}catch(e){return ks(e)?e:new Ke(e)}}),Au=ja(function(e,t){return Wt(t,function(t){t=lo(t),Br(e,t,ns(e[t],e))}),e});function Tu(e){return function(){return e}}var Mu=pa(),Iu=pa(!0);function ju(e){return e}function Ru(e){return li("function"==typeof e?e:zr(e,c))}var Lu=Ei(function(e,t){return function(n){return ii(n,e,t)}}),Bu=Ei(function(e,t){return function(n){return ii(e,n,t)}});function Cu(e,t,n){var r=iu(t),i=Xr(t,r);null!=n||Ts(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=Xr(t,iu(t)));var a=!(Ts(n)&&"chain"in n&&!n.chain),o=Es(e);return Wt(i,function(n){var r=t[n];e[n]=r,o&&(e.prototype[n]=function(){var t=this.__chain__;if(a||t){var n=e(this.__wrapped__);return(n.__actions__=ra(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,Kt([this.value()],arguments))})}),e}function Ou(){}var zu=ma(Jt),Du=ma(Ht),Fu=ma(tn);function Nu(e){return Ya(e)?cn(lo(e)):function(e){return function(t){return Jr(t,e)}}(e)}var Pu=wa(),Uu=wa(!0);function qu(){return[]}function Vu(){return!1}var Zu=va(function(e,t){return e+t},0),Wu=xa("ceil"),Gu=va(function(e,t){return e/t},1),Hu=xa("floor");var Yu,$u=va(function(e,t){return e*t},1),Xu=xa("round"),Ju=va(function(e,t){return e-t},0);return dr.after=function(e,t){if("function"!=typeof t)throw new it(o);return e=Us(e),function(){if(--e<1)return t.apply(this,arguments)}},dr.ary=es,dr.assign=Gs,dr.assignIn=Hs,dr.assignInWith=Ys,dr.assignWith=$s,dr.at=Xs,dr.before=ts,dr.bind=ns,dr.bindAll=Au,dr.bindKey=rs,dr.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return ms(e)?e:[e]},dr.chain=No,dr.chunk=function(e,t,n){t=(n?Ha(e,t,n):t===r)?1:Gn(Us(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var a=0,o=0,s=Xe(Nn(i/t));aa?0:a+n),(i=i===r||i>a?a:Us(i))<0&&(i+=a),i=n>i?0:qs(i);n>>0)?(e=Ws(e))&&("string"==typeof t||null!=t&&!Ls(t))&&!(t=Di(t))&&kn(e)?$i(Rn(e),0,n):e.split(t,n):[]},dr.spread=function(e,t){if("function"!=typeof e)throw new it(o);return t=null==t?0:Gn(Us(t),0),Ei(function(n){var r=n[t],i=$i(n,0,t);return r&&Kt(i,r),Vt(e,this,i)})},dr.tail=function(e){var t=null==e?0:e.length;return t?Ri(e,1,t):[]},dr.take=function(e,t,n){return e&&e.length?Ri(e,0,(t=n||t===r?1:Us(t))<0?0:t):[]},dr.takeRight=function(e,t,n){var i=null==e?0:e.length;return i?Ri(e,(t=i-(t=n||t===r?1:Us(t)))<0?0:t,i):[]},dr.takeRightWhile=function(e,t){return e&&e.length?Ui(e,za(t,3),!1,!0):[]},dr.takeWhile=function(e,t){return e&&e.length?Ui(e,za(t,3)):[]},dr.tap=function(e,t){return t(e),e},dr.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new it(o);return Ts(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),is(e,t,{leading:r,maxWait:t,trailing:i})},dr.thru=Po,dr.toArray=Ns,dr.toPairs=fu,dr.toPairsIn=hu,dr.toPath=function(e){return ms(e)?Jt(e,lo):Os(e)?[e]:ra(uo(Ws(e)))},dr.toPlainObject=Zs,dr.transform=function(e,t,n){var r=ms(e),i=r||ys(e)||zs(e);if(t=za(t,4),null==n){var a=e&&e.constructor;n=i?r?new a:[]:Ts(e)&&Es(a)?gr(Lt(e)):{}}return(i?Wt:Yr)(e,function(e,r,i){return t(n,e,r,i)}),n},dr.unary=function(e){return es(e,1)},dr.union=Mo,dr.unionBy=Io,dr.unionWith=jo,dr.uniq=function(e){return e&&e.length?Fi(e):[]},dr.uniqBy=function(e,t){return e&&e.length?Fi(e,za(t,2)):[]},dr.uniqWith=function(e,t){return t="function"==typeof t?t:r,e&&e.length?Fi(e,r,t):[]},dr.unset=function(e,t){return null==e||Ni(e,t)},dr.unzip=Ro,dr.unzipWith=Lo,dr.update=function(e,t,n){return null==e?e:Pi(e,t,Gi(n))},dr.updateWith=function(e,t,n,i){return i="function"==typeof i?i:r,null==e?e:Pi(e,t,Gi(n),i)},dr.values=pu,dr.valuesIn=function(e){return null==e?[]:vn(e,au(e))},dr.without=Bo,dr.words=Eu,dr.wrap=function(e,t){return cs(Gi(t),e)},dr.xor=Co,dr.xorBy=Oo,dr.xorWith=zo,dr.zip=Do,dr.zipObject=function(e,t){return Zi(e||[],t||[],Ir)},dr.zipObjectDeep=function(e,t){return Zi(e||[],t||[],Ti)},dr.zipWith=Fo,dr.entries=fu,dr.entriesIn=hu,dr.extend=Hs,dr.extendWith=Ys,Cu(dr,dr),dr.add=Zu,dr.attempt=Su,dr.camelCase=du,dr.capitalize=gu,dr.ceil=Wu,dr.clamp=function(e,t,n){return n===r&&(n=t,t=r),n!==r&&(n=(n=Vs(n))==n?n:0),t!==r&&(t=(t=Vs(t))==t?t:0),Or(Vs(e),t,n)},dr.clone=function(e){return zr(e,h)},dr.cloneDeep=function(e){return zr(e,c|h)},dr.cloneDeepWith=function(e,t){return zr(e,c|h,t="function"==typeof t?t:r)},dr.cloneWith=function(e,t){return zr(e,h,t="function"==typeof t?t:r)},dr.conformsTo=function(e,t){return null==t||Dr(e,t,iu(t))},dr.deburr=vu,dr.defaultTo=function(e,t){return null==e||e!=e?t:e},dr.divide=Gu,dr.endsWith=function(e,t,n){e=Ws(e),t=Di(t);var i=e.length,a=n=n===r?i:Or(Us(n),0,i);return(n-=t.length)>=0&&e.slice(n,a)==t},dr.eq=ps,dr.escape=function(e){return(e=Ws(e))&&ke.test(e)?e.replace(ye,yn):e},dr.escapeRegExp=function(e){return(e=Ws(e))&&Re.test(e)?e.replace(je,"\\$&"):e},dr.every=function(e,t,n){var i=ms(e)?Ht:qr;return n&&Ha(e,t,n)&&(t=r),i(e,za(t,3))},dr.find=Vo,dr.findIndex=vo,dr.findKey=function(e,t){return rn(e,za(t,3),Yr)},dr.findLast=Zo,dr.findLastIndex=mo,dr.findLastKey=function(e,t){return rn(e,za(t,3),$r)},dr.floor=Hu,dr.forEach=Wo,dr.forEachRight=Go,dr.forIn=function(e,t){return null==e?e:Gr(e,za(t,3),au)},dr.forInRight=function(e,t){return null==e?e:Hr(e,za(t,3),au)},dr.forOwn=function(e,t){return e&&Yr(e,za(t,3))},dr.forOwnRight=function(e,t){return e&&$r(e,za(t,3))},dr.get=Qs,dr.gt=ds,dr.gte=gs,dr.has=function(e,t){return null!=e&&Va(e,t,ti)},dr.hasIn=eu,dr.head=wo,dr.identity=ju,dr.includes=function(e,t,n,r){e=ws(e)?e:pu(e),n=n&&!r?Us(n):0;var i=e.length;return n<0&&(n=Gn(i+n,0)),Cs(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&on(e,t,n)>-1},dr.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:Us(n);return i<0&&(i=Gn(r+i,0)),on(e,t,i)},dr.inRange=function(e,t,n){return t=Ps(t),n===r?(n=t,t=0):n=Ps(n),function(e,t,n){return e>=Hn(t,n)&&e=-L&&e<=L},dr.isSet=Bs,dr.isString=Cs,dr.isSymbol=Os,dr.isTypedArray=zs,dr.isUndefined=function(e){return e===r},dr.isWeakMap=function(e){return Ms(e)&&qa(e)==ie},dr.isWeakSet=function(e){return Ms(e)&&Qr(e)==ae},dr.join=function(e,t){return null==e?"":Zn.call(e,t)},dr.kebabCase=mu,dr.last=ko,dr.lastIndexOf=function(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var a=i;return n!==r&&(a=(a=Us(n))<0?Gn(i+a,0):Hn(a,i-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,a):an(e,un,a,!0)},dr.lowerCase=_u,dr.lowerFirst=wu,dr.lt=Ds,dr.lte=Fs,dr.max=function(e){return e&&e.length?Vr(e,ju,ei):r},dr.maxBy=function(e,t){return e&&e.length?Vr(e,za(t,2),ei):r},dr.mean=function(e){return ln(e,ju)},dr.meanBy=function(e,t){return ln(e,za(t,2))},dr.min=function(e){return e&&e.length?Vr(e,ju,hi):r},dr.minBy=function(e,t){return e&&e.length?Vr(e,za(t,2),hi):r},dr.stubArray=qu,dr.stubFalse=Vu,dr.stubObject=function(){return{}},dr.stubString=function(){return""},dr.stubTrue=function(){return!0},dr.multiply=$u,dr.nth=function(e,t){return e&&e.length?mi(e,Us(t)):r},dr.noConflict=function(){return Rt._===this&&(Rt._=gt),this},dr.noop=Ou,dr.now=Qo,dr.pad=function(e,t,n){e=Ws(e);var r=(t=Us(t))?jn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return _a(Pn(i),n)+e+_a(Nn(i),n)},dr.padEnd=function(e,t,n){e=Ws(e);var r=(t=Us(t))?jn(e):0;return t&&rt){var i=e;e=t,t=i}if(n||e%1||t%1){var a=Xn();return Hn(e+a*(t-e+Tt("1e-"+((a+"").length-1))),t)}return xi(e,t)},dr.reduce=function(e,t,n){var r=ms(e)?Qt:hn,i=arguments.length<3;return r(e,za(t,4),n,i,Pr)},dr.reduceRight=function(e,t,n){var r=ms(e)?en:hn,i=arguments.length<3;return r(e,za(t,4),n,i,Ur)},dr.repeat=function(e,t,n){return t=(n?Ha(e,t,n):t===r)?1:Us(t),ki(Ws(e),t)},dr.replace=function(){var e=arguments,t=Ws(e[0]);return e.length<3?t:t.replace(e[1],e[2])},dr.result=function(e,t,n){var i=-1,a=(t=Hi(t,e)).length;for(a||(a=1,e=r);++iL)return[];var n=O,r=Hn(e,O);t=za(t),e-=O;for(var i=dn(r,t);++n=o)return e;var u=n-jn(i);if(u<1)return i;var l=s?$i(s,0,u).join(""):e.slice(0,u);if(a===r)return l+i;if(s&&(u+=l.length-u),Ls(a)){if(e.slice(u).search(a)){var c,f=l;for(a.global||(a=nt(a.source,Ws(Ue.exec(a))+"g")),a.lastIndex=0;c=a.exec(f);)var h=c.index;l=l.slice(0,h===r?u:h)}}else if(e.indexOf(Di(a),u)!=u){var p=l.lastIndexOf(a);p>-1&&(l=l.slice(0,p))}return l+i},dr.unescape=function(e){return(e=Ws(e))&&xe.test(e)?e.replace(be,Ln):e},dr.uniqueId=function(e){var t=++ft;return Ws(e)+t},dr.upperCase=xu,dr.upperFirst=ku,dr.each=Wo,dr.eachRight=Go,dr.first=wo,Cu(dr,(Yu={},Yr(dr,function(e,t){ct.call(dr.prototype,t)||(Yu[t]=e)}),Yu),{chain:!1}),dr.VERSION="4.17.10",Wt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){dr[e].placeholder=dr}),Wt(["drop","take"],function(e,t){_r.prototype[e]=function(n){n=n===r?1:Gn(Us(n),0);var i=this.__filtered__&&!t?new _r(this):this.clone();return i.__filtered__?i.__takeCount__=Hn(n,i.__takeCount__):i.__views__.push({size:Hn(n,O),type:e+(i.__dir__<0?"Right":"")}),i},_r.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),Wt(["filter","map","takeWhile"],function(e,t){var n=t+1,r=n==I||3==n;_r.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:za(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}}),Wt(["head","last"],function(e,t){var n="take"+(t?"Right":"");_r.prototype[e]=function(){return this[n](1).value()[0]}}),Wt(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");_r.prototype[e]=function(){return this.__filtered__?new _r(this):this[n](1)}}),_r.prototype.compact=function(){return this.filter(ju)},_r.prototype.find=function(e){return this.filter(e).head()},_r.prototype.findLast=function(e){return this.reverse().find(e)},_r.prototype.invokeMap=Ei(function(e,t){return"function"==typeof e?new _r(this):this.map(function(n){return ii(n,e,t)})}),_r.prototype.reject=function(e){return this.filter(us(za(e)))},_r.prototype.slice=function(e,t){e=Us(e);var n=this;return n.__filtered__&&(e>0||t<0)?new _r(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==r&&(n=(t=Us(t))<0?n.dropRight(-t):n.take(t-e)),n)},_r.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},_r.prototype.toArray=function(){return this.take(O)},Yr(_r.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),a=dr[i?"take"+("last"==t?"Right":""):t],o=i||/^find/.test(t);a&&(dr.prototype[t]=function(){var t=this.__wrapped__,s=i?[1]:arguments,u=t instanceof _r,l=s[0],c=u||ms(t),f=function(e){var t=a.apply(dr,Kt([e],s));return i&&h?t[0]:t};c&&n&&"function"==typeof l&&1!=l.length&&(u=c=!1);var h=this.__chain__,p=!!this.__actions__.length,d=o&&!h,g=u&&!p;if(!o&&c){t=g?t:new _r(this);var v=e.apply(t,s);return v.__actions__.push({func:Po,args:[f],thisArg:r}),new mr(v,h)}return d&&g?e.apply(this,s):(v=this.thru(f),d?i?v.value()[0]:v.value():v)})}),Wt(["pop","push","shift","sort","splice","unshift"],function(e){var t=at[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);dr.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(ms(i)?i:[],e)}return this[n](function(n){return t.apply(ms(n)?n:[],e)})}}),Yr(_r.prototype,function(e,t){var n=dr[t];if(n){var r=n.name+"";(ar[r]||(ar[r]=[])).push({name:t,func:n})}}),ar[da(r,v).name]=[{name:"wrapper",func:r}],_r.prototype.clone=function(){var e=new _r(this.__wrapped__);return e.__actions__=ra(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=ra(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=ra(this.__views__),e},_r.prototype.reverse=function(){if(this.__filtered__){var e=new _r(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},_r.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=ms(e),r=t<0,i=n?e.length:0,a=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?r:this.__values__[this.__index__++]}},dr.prototype.plant=function(e){for(var t,n=this;n instanceof vr;){var i=fo(n);i.__index__=0,i.__values__=r,t?a.__wrapped__=i:t=i;var a=i;n=n.__wrapped__}return a.__wrapped__=e,t},dr.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof _r){var t=e;return this.__actions__.length&&(t=new _r(this)),(t=t.reverse()).__actions__.push({func:Po,args:[To],thisArg:r}),new mr(t,this.__chain__)}return this.thru(To)},dr.prototype.toJSON=dr.prototype.valueOf=dr.prototype.value=function(){return qi(this.__wrapped__,this.__actions__)},dr.prototype.first=dr.prototype.head,fn&&(dr.prototype[fn]=function(){return this}),dr}();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(Rt._=Bn,define(function(){return Bn})):Bt?((Bt.exports=Bn)._=Bn,Lt._=Bn):Rt._=Bn}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],63:[function(e,t,n){(function(n){e("path");var r=e("fs");function i(){this.types=Object.create(null),this.extensions=Object.create(null)}i.prototype.define=function(e){for(var t in e){for(var r=e[t],i=0;i=0;--s)if(h[s]=f,f*=l[s],p=Math.max(p,o.scratchMemory(l[s])),t.shape[s]!==n.shape[s])throw new Error("Shape mismatch, real and imaginary arrays must have same size");var d,g=4*f+p;d="array"===t.dtype||"float64"===t.dtype||"custom"===t.dtype?a.mallocDouble(g):a.mallocFloat(g);var v,m,_,w,b=i(d,l.slice(0),h,0),y=i(d,l.slice(0),h.slice(0),f),x=i(d,l.slice(0),h.slice(0),2*f),k=i(d,l.slice(0),h.slice(0),3*f),E=4*f;for(r.assign(b,t),r.assign(y,n),s=c-1;s>=0&&(o(e,f/l[s],l[s],d,b.offset,y.offset,E),0!==s);--s){for(m=1,_=x.stride,w=k.stride,u=s-1;u=0;--u)w[u]=_[u]=m,m*=l[u];r.assign(x,b),r.assign(k,y),v=b,b=x,x=v,v=y,y=k,k=v}r.assign(t,b),r.assign(n,y),a.free(d)}},{"./lib/fft-matrix.js":66,ndarray:71,"ndarray-ops":68,"typedarray-pool":130}],66:[function(e,t,n){var r=e("bit-twiddle");function i(e,t,n,i,a,o){var s,u,l,c,f,h,p,d,g,v,m,_,w,b,y,x,k,E,S,A,T,M,I,j;for(e|=0,t|=0,a|=0,o|=0,s=n|=0,u=r.log2(s),E=0;E>1,f=0,l=0;l>=1;f+=h}for(m=-1,_=0,v=1,d=0;d>",rrshift:">>>"};!function(){for(var e in s){var t=s[e];n[e]=o({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+t+"c"},funcName:e}),n[e+"eq"]=o({args:["array","array"],body:{args:["a","b"],body:"a"+t+"=b"},rvalue:!0,funcName:e+"eq"}),n[e+"s"]=o({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+t+"s"},funcName:e+"s"}),n[e+"seq"]=o({args:["array","scalar"],body:{args:["a","s"],body:"a"+t+"=s"},rvalue:!0,funcName:e+"seq"})}}();var u={not:"!",bnot:"~",neg:"-",recip:"1.0/"};!function(){for(var e in u){var t=u[e];n[e]=o({args:["array","array"],body:{args:["a","b"],body:"a="+t+"b"},funcName:e}),n[e+"eq"]=o({args:["array"],body:{args:["a"],body:"a="+t+"a"},rvalue:!0,count:2,funcName:e+"eq"})}}();var l={and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">="};!function(){for(var e in l){var t=l[e];n[e]=o({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+t+"c"},funcName:e}),n[e+"s"]=o({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+t+"s"},funcName:e+"s"}),n[e+"eq"]=o({args:["array","array"],body:{args:["a","b"],body:"a=a"+t+"b"},rvalue:!0,count:2,funcName:e+"eq"}),n[e+"seq"]=o({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+t+"s"},rvalue:!0,count:2,funcName:e+"seq"})}}();var c=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan"];!function(){for(var e=0;ethis_s){this_s=-a}else if(a>this_s){this_s=a}",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norminf"}),n.norm1=r({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:3}],body:"this_s+=a<0?-a:a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm1"}),n.sup=r({args:["array"],pre:{body:"this_h=-Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_>this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}}),n.inf=r({args:["array"],pre:{body:"this_h=Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),n.random=o({args:["array"],pre:{args:[],body:"this_f=Math.random",thisVars:["this_f"]},body:{args:["a"],body:"a=this_f()",thisVars:["this_f"]},funcName:"random"}),n.assign=o({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),n.assigns=o({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),n.equals=r({args:["array","array"],pre:i,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})},{"cwise-compiler":9}],69:[function(e,t,n){"use strict";var r=e("ndarray"),i=e("./doConvert.js");t.exports=function(e,t){for(var n=[],a=e,o=1;Array.isArray(a);)n.push(a.length),o*=a.length,a=a[0];return 0===n.length?r():(t||(t=r(new Float64Array(o),n)),i(t,e),t)}},{"./doConvert.js":70,ndarray:71}],70:[function(e,t,n){t.exports=e("cwise-compiler")({args:["array","scalar","index"],pre:{body:"{}",args:[],thisVars:[],localVars:[]},body:{body:"{\nvar _inline_1_v=_inline_1_arg1_,_inline_1_i\nfor(_inline_1_i=0;_inline_1_i<_inline_1_arg2_.length-1;++_inline_1_i) {\n_inline_1_v=_inline_1_v[_inline_1_arg2_[_inline_1_i]]\n}\n_inline_1_arg0_=_inline_1_v[_inline_1_arg2_[_inline_1_arg2_.length-1]]\n}",args:[{name:"_inline_1_arg0_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg2_",lvalue:!1,rvalue:!0,count:4}],thisVars:[],localVars:["_inline_1_i","_inline_1_v"]},post:{body:"{}",args:[],thisVars:[],localVars:[]},funcName:"convert",blockSize:64})},{"cwise-compiler":9}],71:[function(e,t,n){var r=e("iota-array"),i=e("is-buffer"),a="undefined"!=typeof Float64Array;function o(e,t){return e[0]-t[0]}function s(){var e,t=this.stride,n=new Array(t.length);for(e=0;eMath.abs(this.stride[1]))?[1,0]:[0,1]}})"):3===t&&a.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")):a.push("ORDER})")),a.push("proto.set=function "+n+"_set("+u.join(",")+",v){"),i?a.push("return this.data.set("+c+",v)}"):a.push("return this.data["+c+"]=v}"),a.push("proto.get=function "+n+"_get("+u.join(",")+"){"),i?a.push("return this.data.get("+c+")}"):a.push("return this.data["+c+"]}"),a.push("proto.index=function "+n+"_index(",u.join(),"){return "+c+"}"),a.push("proto.hi=function "+n+"_hi("+u.join(",")+"){return new "+n+"(this.data,"+o.map(function(e){return["(typeof i",e,"!=='number'||i",e,"<0)?this.shape[",e,"]:i",e,"|0"].join("")}).join(",")+","+o.map(function(e){return"this.stride["+e+"]"}).join(",")+",this.offset)}");var p=o.map(function(e){return"a"+e+"=this.shape["+e+"]"}),d=o.map(function(e){return"c"+e+"=this.stride["+e+"]"});a.push("proto.lo=function "+n+"_lo("+u.join(",")+"){var b=this.offset,d=0,"+p.join(",")+","+d.join(","));for(var g=0;g=0){d=i"+g+"|0;b+=c"+g+"*d;a"+g+"-=d}");a.push("return new "+n+"(this.data,"+o.map(function(e){return"a"+e}).join(",")+","+o.map(function(e){return"c"+e}).join(",")+",b)}"),a.push("proto.step=function "+n+"_step("+u.join(",")+"){var "+o.map(function(e){return"a"+e+"=this.shape["+e+"]"}).join(",")+","+o.map(function(e){return"b"+e+"=this.stride["+e+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(g=0;g=0){c=(c+this.stride["+g+"]*i"+g+")|0}else{a.push(this.shape["+g+"]);b.push(this.stride["+g+"])}");return a.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),a.push("return function construct_"+n+"(data,shape,stride,offset){return new "+n+"(data,"+o.map(function(e){return"shape["+e+"]"}).join(",")+","+o.map(function(e){return"stride["+e+"]"}).join(",")+",offset)}"),new Function("CTOR_LIST","ORDER",a.join("\n"))(l[e],s)}var l={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],buffer:[],generic:[]};t.exports=function(e,t,n,r){if(void 0===e)return(0,l.array[0])([]);"number"==typeof e&&(e=[e]),void 0===t&&(t=[e.length]);var o=t.length;if(void 0===n){n=new Array(o);for(var s=o-1,c=1;s>=0;--s)n[s]=c,c*=t[s]}if(void 0===r)for(r=0,s=0;s>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,(e|=e>>>16)+1}},{}],73:[function(e,t,n){"use strict";function r(e,t,n,r){for(var i=e[t++],a=1<>=u,c-=u,v!==a){if(v===o)break;for(var m=va;)w=d[w]>>8,++_;var b=w;if(h+_+(m!==v?1:0)>r)return void console.log("Warning, gif stream longer than expected.");n[h++]=b;var y=h+=_;for(m!==v&&(n[h++]=b),w=m;_--;)w=d[w],n[--y]=255&w,w>>=8;null!==g&&s<4096&&(d[s++]=g<<8|b,s>=l+1&&u<12&&(++u,l=l<<1|1)),g=v}else s=o+1,l=(1<<(u=i+1))-1,g=null}return h!==r&&console.log("Warning, gif stream shorter than expected."),n}try{n.GifWriter=function(e,t,n,r){var i=0,a=void 0===(r=void 0===r?{}:r).loop?null:r.loop,o=void 0===r.palette?null:r.palette;if(t<=0||n<=0||t>65535||n>65535)throw new Error("Width/Height invalid.");function s(e){var t=e.length;if(t<2||t>256||t&t-1)throw new Error("Invalid code/color length, must be power of 2 and 2 .. 256.");return t}e[i++]=71,e[i++]=73,e[i++]=70,e[i++]=56,e[i++]=57,e[i++]=97;var u=0,l=0;if(null!==o){for(var c=s(o);c>>=1;)++u;if(c=1<=c)throw new Error("Background index out of range.");if(0===l)throw new Error("Background index explicitly passed as 0.")}}if(e[i++]=255&t,e[i++]=t>>8&255,e[i++]=255&n,e[i++]=n>>8&255,e[i++]=(null!==o?128:0)|u,e[i++]=l,e[i++]=0,null!==o)for(var f=0,h=o.length;f>16&255,e[i++]=p>>8&255,e[i++]=255&p}if(null!==a){if(a<0||a>65535)throw new Error("Loop count invalid.");e[i++]=33,e[i++]=255,e[i++]=11,e[i++]=78,e[i++]=69,e[i++]=84,e[i++]=83,e[i++]=67,e[i++]=65,e[i++]=80,e[i++]=69,e[i++]=50,e[i++]=46,e[i++]=48,e[i++]=3,e[i++]=1,e[i++]=255&a,e[i++]=a>>8&255,e[i++]=0}var d=!1;this.addFrame=function(t,n,r,a,u,l){if(!0===d&&(--i,d=!1),l=void 0===l?{}:l,t<0||n<0||t>65535||n>65535)throw new Error("x/y invalid.");if(r<=0||a<=0||r>65535||a>65535)throw new Error("Width/Height invalid.");if(u.length>=1;)++p;h=1<3)throw new Error("Disposal out of range.");var m=!1,_=0;if(void 0!==l.transparent&&null!==l.transparent&&(m=!0,(_=l.transparent)<0||_>=h))throw new Error("Transparent color index.");if((0!==v||m||0!==g)&&(e[i++]=33,e[i++]=249,e[i++]=4,e[i++]=v<<2|(!0===m?1:0),e[i++]=255&g,e[i++]=g>>8&255,e[i++]=_,e[i++]=0),e[i++]=44,e[i++]=255&t,e[i++]=t>>8&255,e[i++]=255&n,e[i++]=n>>8&255,e[i++]=255&r,e[i++]=r>>8&255,e[i++]=255&a,e[i++]=a>>8&255,e[i++]=!0===c?128|p-1:0,!0===c)for(var w=0,b=f.length;w>16&255,e[i++]=y>>8&255,e[i++]=255&y}return i=function(e,t,n,r){e[t++]=n;var i=t++,a=1<=n;)e[t++]=255&f,f>>=8,c-=8,t===i+256&&(e[i]=255,i=t++)}function p(e){f|=e<=8;)e[t++]=255&f,f>>=8,c-=8,t===i+256&&(e[i]=255,i=t++);4096===u?(p(a),u=s+1,l=n+1,g={}):(u>=1<>7,s=1<<1+(7&a);e[t++],e[t++];var u=null,l=null;o&&(u=t,l=s,t+=3*s);var c=!0,f=[],h=0,p=null,d=0,g=null;for(this.width=n,this.height=i;c&&t=0))throw Error("Invalid block size");if(0===M)break;t+=M}break;case 249:if(4!==e[t++]||0!==e[t+4])throw new Error("Invalid graphics extension block.");var v=e[t++];h=e[t++]|e[t++]<<8,p=e[t++],0==(1&v)&&(p=null),d=v>>2&7,t++;break;case 254:for(;;){if(!((M=e[t++])>=0))throw Error("Invalid block size");if(0===M)break;t+=M}break;default:throw new Error("Unknown graphic control label: 0x"+e[t-1].toString(16))}break;case 44:var m=e[t++]|e[t++]<<8,_=e[t++]|e[t++]<<8,w=e[t++]|e[t++]<<8,b=e[t++]|e[t++]<<8,y=e[t++],x=y>>6&1,k=1<<1+(7&y),E=u,S=l,A=!1;y>>7&&(A=!0,E=t,S=k,t+=3*k);var T=t;for(t++;;){var M;if(!((M=e[t++])>=0))throw Error("Invalid block size");if(0===M)break;t+=M}f.push({x:m,y:_,width:w,height:b,has_local_palette:A,palette_offset:E,palette_size:S,data_offset:T,data_length:t-T,transparent_index:p,interlaced:!!x,delay:h,disposal:d});break;case 59:c=!1;break;default:throw new Error("Unknown gif block: 0x"+e[t-1].toString(16))}this.numFrames=function(){return f.length},this.loopCount=function(){return g},this.frameInfo=function(e){if(e<0||e>=f.length)throw new Error("Frame index out of range.");return f[e]},this.decodeAndBlitFrameBGRA=function(t,i){var a=this.frameInfo(t),o=a.width*a.height,s=new Uint8Array(o);r(e,a.data_offset,s,o);var u=a.palette_offset,l=a.transparent_index;null===l&&(l=256);var c=a.width,f=n-c,h=c,p=4*(a.y*n+a.x),d=4*((a.y+a.height)*n+a.x),g=p,v=4*f;!0===a.interlaced&&(v+=4*n*7);for(var m=8,_=0,w=s.length;_=d&&(v=4*f+4*n*(m-1),g=p+(c+f)*(m<<1),m>>=1)),b===l)g+=4;else{var y=e[u+3*b],x=e[u+3*b+1],k=e[u+3*b+2];i[g++]=k,i[g++]=x,i[g++]=y,i[g++]=255}--h}},this.decodeAndBlitFrameRGBA=function(t,i){var a=this.frameInfo(t),o=a.width*a.height,s=new Uint8Array(o);r(e,a.data_offset,s,o);var u=a.palette_offset,l=a.transparent_index;null===l&&(l=256);var c=a.width,f=n-c,h=c,p=4*(a.y*n+a.x),d=4*((a.y+a.height)*n+a.x),g=p,v=4*f;!0===a.interlaced&&(v+=4*n*7);for(var m=8,_=0,w=s.length;_=d&&(v=4*f+4*n*(m-1),g=p+(c+f)*(m<<1),m>>=1)),b===l)g+=4;else{var y=e[u+3*b],x=e[u+3*b+1],k=e[u+3*b+2];i[g++]=y,i[g++]=x,i[g++]=k,i[g++]=255}--h}}}}catch(e){}},{}],74:[function(e,t,n){(function(n){var r=e("charm");function i(e){if(!(e=e||{}).total)throw new Error("You MUST specify the total number of operations that will be processed.");this.total=e.total,this.current=0,this.max_burden=e.maxBurden||.5,this.show_burden=e.showBurden||!1,this.started=!1,this.size=50,this.inner_time=0,this.outer_time=0,this.elapsed=0,this.time_start=0,this.time_end=0,this.time_left=0,this.time_burden=0,this.skip_steps=0,this.skipped=0,this.aborted=!1,this.charm=r(),this.charm.pipe(n.stdout),this.charm.write("\n\n\n")}function a(e,t,n){for(n=n||" ";e.length3&&(u[0]=u[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,o)),(u[1]||"").length=this.total&&this.finished(),this.time_end=(new Date).getTime(),this.inner_time=this.time_end-this.time_start)},i.prototype.updateTimes=function(){this.elapsed=this.time_start-this.started,this.time_end>0&&(this.outer_time=this.time_start-this.time_end),this.inner_time>0&&this.outer_time>0&&(this.time_burden=this.inner_time/(this.inner_time+this.outer_time)*100,this.time_left=this.elapsed/this.current*(this.total-this.current),this.time_left<0&&(this.time_left=0)),this.time_burden>this.max_burden&&this.skip_steps0&&this.current=0;r--){var i=e[r];"."===i?e.splice(r,1):".."===i?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}var r=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,i=function(e){return r.exec(e).slice(1)};function a(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r=-1&&!r;i--){var o=i>=0?arguments[i]:e.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");o&&(n=o+"/"+n,r="/"===o.charAt(0))}return(r?"/":"")+(n=t(a(n.split("/"),function(e){return!!e}),!r).join("/"))||"."},n.normalize=function(e){var r=n.isAbsolute(e),i="/"===o(e,-1);return(e=t(a(e.split("/"),function(e){return!!e}),!r).join("/"))||r||(e="."),e&&i&&(e+="/"),(r?"/":"")+e},n.isAbsolute=function(e){return"/"===e.charAt(0)},n.join=function(){var e=Array.prototype.slice.call(arguments,0);return n.normalize(a(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},n.relative=function(e,t){function r(e){for(var t=0;t=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=n.resolve(e).substr(1),t=n.resolve(t).substr(1);for(var i=r(e.split("/")),a=r(t.split("/")),o=Math.min(i.length,a.length),s=o,u=0;u>4,n.push(f,c);break;case 2:u=3&h,l=h>>2&3,c=h>>4&3,f=h>>6&3,n.push(f,c,l,u);break;case 1:i=1&h,a=h>>1&1,o=h>>2&1,s=h>>3&1,u=h>>4&1,l=h>>5&1,c=h>>6&1,f=h>>7&1,n.push(f,c,l,u,s,o,a,i)}}return{get:function(e){for(;n.length0&&(this._paused=!1,this.emit("drain"))}.bind(this))},o.prototype.write=function(e,t){return this.writable?(n=r.isBuffer(e)?e:new r(e,t||this._encoding),this._buffers.push(n),this._buffered+=n.length,this._process(),this._reads&&0===this._reads.length&&(this._paused=!0),this.writable&&!this._paused):(this.emit("error",new Error("Stream not writable")),!1);var n},o.prototype.end=function(e,t){e&&this.write(e,t),this.writable=!1,this._buffers&&(0===this._buffers.length?this._end():(this._buffers.push(null),this._process()))},o.prototype.destroySoon=o.prototype.end,o.prototype._end=function(){this._reads.length>0&&this.emit("error",new Error("There are some read requests waitng on finished stream")),this.destroy()},o.prototype.destroy=function(){this._buffers&&(this.writable=!1,this._reads=null,this._buffers=null,this.emit("close"))},o.prototype._processReadAllowingLess=function(e){this._reads.shift();var t=this._buffers[0];t.length>e.length?(this._buffered-=e.length,this._buffers[0]=t.slice(e.length),e.func.call(this,t.slice(0,e.length))):(this._buffered-=t.length,this._buffers.shift(),e.func.call(this,t))},o.prototype._processRead=function(e){this._reads.shift();for(var t=0,n=0,i=new r(e.length);t0&&this._buffers.splice(0,n),this._buffered-=e.length,e.func.call(this,i)},o.prototype._process=function(){try{for(;this._buffered>0&&this._reads&&this._reads.length>0;){var e=this._reads[0];if(e.allowLess)this._processReadAllowingLess(e);else{if(!(this._buffered>=e.length))break;this._processRead(e)}}this._buffers&&this._buffers.length>0&&null===this._buffers[0]&&this._end()}catch(e){this.emit("error",e)}}}).call(this,e("_process"),e("buffer").Buffer)},{_process:98,buffer:4,stream:112,util:135}],79:[function(e,t,n){"use strict";t.exports={PNG_SIGNATURE:[137,80,78,71,13,10,26,10],TYPE_IHDR:1229472850,TYPE_IEND:1229278788,TYPE_IDAT:1229209940,TYPE_PLTE:1347179589,TYPE_tRNS:1951551059,TYPE_gAMA:1732332865,COLORTYPE_GRAYSCALE:0,COLORTYPE_PALETTE:1,COLORTYPE_COLOR:2,COLORTYPE_ALPHA:4,COLORTYPE_PALETTE_COLOR:3,COLORTYPE_COLOR_ALPHA:6,COLORTYPE_TO_BPP_MAP:{0:1,2:3,3:1,4:2,6:4},GAMMA_DIVISION:1e5}},{}],80:[function(e,t,n){"use strict";var r=[];!function(){for(var e=0;e<256;e++){for(var t=e,n=0;n<8;n++)1&t?t=3988292384^t>>>1:t>>>=1;r[e]=t}}();var i=t.exports=function(){this._crc=-1};i.prototype.write=function(e){for(var t=0;t>>8;return!0},i.prototype.crc32=function(){return-1^this._crc},i.crc32=function(e){for(var t=-1,n=0;n>>8;return-1^t}},{}],81:[function(e,t,n){(function(n){"use strict";var r=e("./paeth-predictor");var i={0:function(e,t,n,r,i){e.copy(r,i,t,t+n)},1:function(e,t,n,r,i,a){for(var o=0;o=a?e[t+o-a]:0,u=e[t+o]-s;r[i+o]=u}},2:function(e,t,n,r,i){for(var a=0;a0?e[t+a-n]:0,s=e[t+a]-o;r[i+a]=s}},3:function(e,t,n,r,i,a){for(var o=0;o=a?e[t+o-a]:0,u=t>0?e[t+o-n]:0,l=e[t+o]-(s+u>>1);r[i+o]=l}},4:function(e,t,n,i,a,o){for(var s=0;s=o?e[t+s-o]:0,l=t>0?e[t+s-n]:0,c=t>0&&s>=o?e[t+s-(n+o)]:0,f=e[t+s]-r(u,l,c);i[a+s]=f}}},a={0:function(e,t,n){for(var r=0,i=t+n,a=t;a=r?e[t+a-r]:0,s=e[t+a]-o;i+=Math.abs(s)}return i},2:function(e,t,n){for(var r=0,i=t+n,a=t;a0?e[a-n]:0,s=e[a]-o;r+=Math.abs(s)}return r},3:function(e,t,n,r){for(var i=0,a=0;a=r?e[t+a-r]:0,s=t>0?e[t+a-n]:0,u=e[t+a]-(o+s>>1);i+=Math.abs(u)}return i},4:function(e,t,n,i){for(var a=0,o=0;o=i?e[t+o-i]:0,u=t>0?e[t+o-n]:0,l=t>0&&o>=i?e[t+o-(n+i)]:0,c=e[t+o]-r(s,u,l);a+=Math.abs(c)}return a}};t.exports=function(e,t,r,o,s){var u;if("filterType"in o&&-1!==o.filterType){if("number"!=typeof o.filterType)throw new Error("unrecognised filter types");u=[o.filterType]}else u=[0,1,2,3,4];for(var l=t*s,c=0,f=0,h=new n((l+1)*r),p=u[0],d=0;d1)for(var g=1/0,v=0;vi?t[a-r]:0;t[a]=o+s}},o.prototype._unFilterType2=function(e,t,n){for(var r=this._lastLine,i=0;ii?t[o-r]:0,c=Math.floor((l+u)/2);t[o]=s+c}},o.prototype._unFilterType4=function(e,t,n){for(var r=this._xComparison,a=r-1,o=this._lastLine,s=0;sa?t[s-r]:0,f=s>a&&o?o[s-r]:0,h=i(c,l,f);t[s]=u+h}},o.prototype._reverseFilterLine=function(e){var t,r=e[0],i=this._images[this._imageIndex],a=i.byteWidth;if(0===r)t=e.slice(1,a+1);else switch(t=new n(a),r){case 1:this._unFilterType1(e,t,a);break;case 2:this._unFilterType2(e,t,a);break;case 3:this._unFilterType3(e,t,a);break;case 4:this._unFilterType4(e,t,a);break;default:throw new Error("Unrecognised filter type - "+r)}this.write(t),i.lineIndex++,i.lineIndex>=i.height?(this._lastLine=null,this._imageIndex++,i=this._images[this._imageIndex]):this._lastLine=t,i?this.read(i.byteWidth+1,this._reverseFilterLine.bind(this)):(this._lastLine=null,this.complete())}}).call(this,e("buffer").Buffer)},{"./interlace":86,"./paeth-predictor":90,buffer:4}],85:[function(e,t,n){(function(e){"use strict";t.exports=function(t,n){var r=n.depth,i=n.width,a=n.height,o=n.colorType,s=n.transColor,u=n.palette,l=t;return 3===o?function(e,t,n,r,i){for(var a=0,o=0;o0&&f>0&&n.push({width:c,height:f,index:u})}return n},n.getInterlaceIterator=function(e){return function(t,n,i){var a=t%r[i].x.length,o=(t-a)/r[i].x.length*8+r[i].x[a],s=n%r[i].y.length;return 4*o+((n-s)/r[i].y.length*8+r[i].y[s])*e*4}}},{}],87:[function(e,t,n){(function(n){"use strict";var r=e("util"),i=e("stream"),a=e("./constants"),o=e("./packer"),s=t.exports=function(e){i.call(this);var t=e||{};this._packer=new o(t),this._deflate=this._packer.createDeflate(),this.readable=!0};r.inherits(s,i),s.prototype.pack=function(e,t,r,i){this.emit("data",new n(a.PNG_SIGNATURE)),this.emit("data",this._packer.packIHDR(t,r)),i&&this.emit("data",this._packer.packGAMA(i));var o=this._packer.filterData(e,t,r);this._deflate.on("error",this.emit.bind(this,"error")),this._deflate.on("data",function(e){this.emit("data",this._packer.packIDAT(e))}.bind(this)),this._deflate.on("end",function(){this.emit("data",this._packer.packIEND()),this.emit("end")}.bind(this)),this._deflate.end(o)}}).call(this,e("buffer").Buffer)},{"./constants":79,"./packer":89,buffer:4,stream:112,util:135}],88:[function(e,t,n){(function(n){"use strict";var r=!0,i=e("zlib");i.deflateSync||(r=!1);var a=e("./constants"),o=e("./packer");t.exports=function(e,t){if(!r)throw new Error("To use the sync capability of this library in old node versions, please also add a dependency on node-zlb-backport");var s=new o(t||{}),u=[];u.push(new n(a.PNG_SIGNATURE)),u.push(s.packIHDR(e.width,e.height)),e.gamma&&u.push(s.packGAMA(e.gamma));var l=s.filterData(e.data,e.width,e.height),c=i.deflateSync(l,s.getDeflateOptions());if(l=null,!c||!c.length)throw new Error("bad png - invalid compressed data response");return u.push(s.packIDAT(c)),u.push(s.packIEND()),n.concat(u)}}).call(this,e("buffer").Buffer)},{"./constants":79,"./packer":89,buffer:4,zlib:41}],89:[function(e,t,n){(function(n){"use strict";var r=e("./constants"),i=e("./crc"),a=e("./bitpacker"),o=e("./filter-pack"),s=e("zlib"),u=t.exports=function(e){if(this._options=e,e.deflateChunkSize=e.deflateChunkSize||32768,e.deflateLevel=null!=e.deflateLevel?e.deflateLevel:9,e.deflateStrategy=null!=e.deflateStrategy?e.deflateStrategy:3,e.inputHasAlpha=null==e.inputHasAlpha||e.inputHasAlpha,e.deflateFactory=e.deflateFactory||s.createDeflate,e.bitDepth=e.bitDepth||8,e.colorType="number"==typeof e.colorType?e.colorType:r.COLORTYPE_COLOR_ALPHA,e.colorType!==r.COLORTYPE_COLOR&&e.colorType!==r.COLORTYPE_COLOR_ALPHA)throw new Error("option color type:"+e.colorType+" is not supported at present");if(8!==e.bitDepth)throw new Error("option bit depth:"+e.bitDepth+" is not supported at present")};u.prototype.getDeflateOptions=function(){return{chunkSize:this._options.deflateChunkSize,level:this._options.deflateLevel,strategy:this._options.deflateStrategy}},u.prototype.createDeflate=function(){return this._options.deflateFactory(this.getDeflateOptions())},u.prototype.filterData=function(e,t,n){var i=a(e,t,n,this._options),s=r.COLORTYPE_TO_BPP_MAP[this._options.colorType];return o(i,t,n,this._options,s)},u.prototype._packChunk=function(e,t){var r=t?t.length:0,a=new n(r+12);return a.writeUInt32BE(r,0),a.writeUInt32BE(e,4),t&&t.copy(a,8),a.writeInt32BE(i.crc32(a.slice(4,a.length-4)),a.length-4),a},u.prototype.packGAMA=function(e){var t=new n(4);return t.writeUInt32BE(Math.floor(e*r.GAMMA_DIVISION),0),this._packChunk(r.TYPE_gAMA,t)},u.prototype.packIHDR=function(e,t){var i=new n(13);return i.writeUInt32BE(e,0),i.writeUInt32BE(t,4),i[8]=this._options.bitDepth,i[9]=this._options.colorType,i[10]=0,i[11]=0,i[12]=0,this._packChunk(r.TYPE_IHDR,i)},u.prototype.packIDAT=function(e){return this._packChunk(r.TYPE_IDAT,e)},u.prototype.packIEND=function(){return this._packChunk(r.TYPE_IEND,null)}}).call(this,e("buffer").Buffer)},{"./bitpacker":77,"./constants":79,"./crc":80,"./filter-pack":81,buffer:4,zlib:41}],90:[function(e,t,n){"use strict";t.exports=function(e,t,n){var r=e+t-n,i=Math.abs(r-e),a=Math.abs(r-t),o=Math.abs(r-n);return i<=a&&i<=o?e:a<=o?t:n}},{}],91:[function(e,t,n){"use strict";var r=e("util"),i=e("zlib"),a=e("./chunkstream"),o=e("./filter-parse-async"),s=e("./parser"),u=e("./bitmapper"),l=e("./format-normaliser"),c=t.exports=function(e){a.call(this),this._parser=new s(e,{read:this.read.bind(this),error:this._handleError.bind(this),metadata:this._handleMetaData.bind(this),gamma:this.emit.bind(this,"gamma"),palette:this._handlePalette.bind(this),transColor:this._handleTransColor.bind(this),finished:this._finished.bind(this),inflateData:this._inflateData.bind(this)}),this._options=e,this.writable=!0,this._parser.start()};r.inherits(c,a),c.prototype._handleError=function(e){this.emit("error",e),this.writable=!1,this.destroy(),this._inflate&&this._inflate.destroy&&this._inflate.destroy(),this.errord=!0},c.prototype._inflateData=function(e){this._inflate||(this._inflate=i.createInflate(),this._inflate.on("error",this.emit.bind(this,"error")),this._filter.on("complete",this._complete.bind(this)),this._inflate.pipe(this._filter)),this._inflate.write(e)},c.prototype._handleMetaData=function(e){this.emit("metadata",e),this._bitmapInfo=Object.create(e),this._filter=new o(this._bitmapInfo)},c.prototype._handleTransColor=function(e){this._bitmapInfo.transColor=e},c.prototype._handlePalette=function(e){this._bitmapInfo.palette=e},c.prototype._finished=function(){this.errord||(this._inflate?this._inflate.end():this.emit("error","No Inflate block"),this.destroySoon())},c.prototype._complete=function(e){if(!this.errord){try{var t=u.dataToBitMap(e,this._bitmapInfo),n=l(t,this._bitmapInfo);t=null}catch(e){return void this._handleError(e)}this.emit("parsed",n)}}},{"./bitmapper":76,"./chunkstream":78,"./filter-parse-async":82,"./format-normaliser":85,"./parser":93,util:135,zlib:41}],92:[function(e,t,n){(function(n){"use strict";var r=!0,i=e("zlib");i.deflateSync||(r=!1);var a=e("./sync-reader"),o=e("./filter-parse-sync"),s=e("./parser"),u=e("./bitmapper"),l=e("./format-normaliser");t.exports=function(e,t){if(!r)throw new Error("To use the sync capability of this library in old node versions, please also add a dependency on node-zlb-backport");var c,f,h;var p=[];var d=new a(e);if(new s(t,{read:d.read.bind(d),error:function(e){c=e},metadata:function(e){f=e},gamma:function(e){h=e},palette:function(e){f.palette=e},transColor:function(e){f.transColor=e},inflateData:function(e){p.push(e)}}).start(),d.process(),c)throw c;var g=n.concat(p);p.length=0;var v=i.inflateSync(g);if(g=null,!v||!v.length)throw new Error("bad png - invalid inflate data response");var m=o.process(v,f);g=null;var _=u.dataToBitMap(m,f);m=null;var w=l(_,f);return f.data=w,f.gamma=h||0,f}}).call(this,e("buffer").Buffer)},{"./bitmapper":76,"./filter-parse-sync":83,"./format-normaliser":85,"./parser":93,"./sync-reader":96,buffer:4,zlib:41}],93:[function(e,t,n){(function(n){"use strict";var r=e("./constants"),i=e("./crc"),a=t.exports=function(e,t){this._options=e,e.checkCRC=!1!==e.checkCRC,this._hasIHDR=!1,this._hasIEND=!1,this._palette=[],this._colorType=0,this._chunks={},this._chunks[r.TYPE_IHDR]=this._handleIHDR.bind(this),this._chunks[r.TYPE_IEND]=this._handleIEND.bind(this),this._chunks[r.TYPE_IDAT]=this._handleIDAT.bind(this),this._chunks[r.TYPE_PLTE]=this._handlePLTE.bind(this),this._chunks[r.TYPE_tRNS]=this._handleTRNS.bind(this),this._chunks[r.TYPE_gAMA]=this._handleGAMA.bind(this),this.read=t.read,this.error=t.error,this.metadata=t.metadata,this.gamma=t.gamma,this.transColor=t.transColor,this.palette=t.palette,this.parsed=t.parsed,this.inflateData=t.inflateData,this.inflateData=t.inflateData,this.finished=t.finished};a.prototype.start=function(){this.read(r.PNG_SIGNATURE.length,this._parseSignature.bind(this))},a.prototype._parseSignature=function(e){for(var t=r.PNG_SIGNATURE,n=0;nthis._palette.length)return void this.error(new Error("More transparent colors than palette size"));for(var t=0;t0?this._handleIDAT(n):this._handleChunkEnd()},a.prototype._handleIEND=function(e){this.read(e,this._parseIEND.bind(this))},a.prototype._parseIEND=function(e){this._crc.write(e),this._hasIEND=!0,this._handleChunkEnd(),this.finished&&this.finished()}}).call(this,e("buffer").Buffer)},{"./constants":79,"./crc":80,buffer:4}],94:[function(e,t,n){"use strict";var r=e("./parser-sync"),i=e("./packer-sync");n.read=function(e,t){return r(e,t||{})},n.write=function(e){return i(e)}},{"./packer-sync":88,"./parser-sync":92}],95:[function(e,t,n){(function(t,r){"use strict";var i=e("util"),a=e("stream"),o=e("./parser-async"),s=e("./packer-async"),u=e("./png-sync"),l=n.PNG=function(e){a.call(this),e=e||{},this.width=e.width||0,this.height=e.height||0,this.data=this.width>0&&this.height>0?new r(4*this.width*this.height):null,e.fill&&this.data&&this.data.fill(0),this.gamma=0,this.readable=this.writable=!0,this._parser=new o(e),this._parser.on("error",this.emit.bind(this,"error")),this._parser.on("close",this._handleClose.bind(this)),this._parser.on("metadata",this._metadata.bind(this)),this._parser.on("gamma",this._gamma.bind(this)),this._parser.on("parsed",function(e){this.data=e,this.emit("parsed",e)}.bind(this)),this._packer=new s(e),this._packer.on("data",this.emit.bind(this,"data")),this._packer.on("end",this.emit.bind(this,"end")),this._parser.on("close",this._handleClose.bind(this)),this._packer.on("error",this.emit.bind(this,"error"))};i.inherits(l,a),l.sync=u,l.prototype.pack=function(){return this.data&&this.data.length?(t.nextTick(function(){this._packer.pack(this.data,this.width,this.height,this.gamma)}.bind(this)),this):(this.emit("error","No data provided"),this)},l.prototype.parse=function(e,t){var n,r;t&&(n=function(e){this.removeListener("error",r),this.data=e,t(null,this)}.bind(this),r=function(e){this.removeListener("parsed",n),t(e,null)}.bind(this),this.once("parsed",n),this.once("error",r));return this.end(e),this},l.prototype.write=function(e){return this._parser.write(e),!0},l.prototype.end=function(e){this._parser.end(e)},l.prototype._metadata=function(e){this.width=e.width,this.height=e.height,this.emit("metadata",e)},l.prototype._gamma=function(e){this.gamma=e},l.prototype._handleClose=function(){this._parser.writable||this._packer.readable||this.emit("close")},l.bitblt=function(e,t,n,r,i,a,o,s){if(n>e.width||r>e.height||n+i>e.width||r+a>e.height)throw new Error("bitblt reading outside image");if(o>t.width||s>t.height||o+i>t.width||s+a>t.height)throw new Error("bitblt writing outside image");for(var u=0;u0&&this._buffer.length;){var e=this._reads[0];if(!this._buffer.length||!(this._buffer.length>=e.length||e.allowLess))break;this._reads.shift();var t=this._buffer;this._buffer=t.slice(e.length),e.func.call(this,t.slice(0,e.length))}return this._reads.length>0?new Error("There are some read requests waitng on finished stream"):this._buffer.length>0?new Error("unrecognised content at end of stream"):void 0}},{}],97:[function(e,t,n){(function(e){"use strict";!e.version||0===e.version.indexOf("v0.")||0===e.version.indexOf("v1.")&&0!==e.version.indexOf("v1.8.")?t.exports={nextTick:function(t,n,r,i){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var a,o,s=arguments.length;switch(s){case 0:case 1:return e.nextTick(t);case 2:return e.nextTick(function(){t.call(null,n)});case 3:return e.nextTick(function(){t.call(null,n,r)});case 4:return e.nextTick(function(){t.call(null,n,r,i)});default:for(a=new Array(s-1),o=0;o1)for(var n=1;n0?d(e):b(e)}(e,t);else if(t.objectMode||r&&r.length>0)if(t.ended&&!o){var u=new Error("stream.push() after EOF");e.emit("error",u)}else if(t.endEmitted&&o){u=new Error("stream.unshift() after end event");e.emit("error",u)}else!t.decoder||o||a||(r=t.decoder.write(r)),t.length+=t.objectMode?1:r.length,o?t.buffer.unshift(r):(t.reading=!1,t.buffer.push(r)),t.needReadable&&d(e),function(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(function(){!function(e,t){var n=t.length;for(;!t.reading&&!t.flowing&&!t.ended&&t.lengtht.highWaterMark&&(t.highWaterMark=function(e){if(e>=h)e=h;else{e--;for(var t=1;t<32;t<<=1)e|=e>>t;e++}return e}(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function d(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,t.sync?n.nextTick(function(){g(e)}):g(e))}function g(e){e.emit("readable")}function v(e){var t,n=e._readableState;function r(e,r,i){!1===e.write(t)&&n.awaitDrain++}for(n.awaitDrain=0;n.pipesCount&&null!==(t=e.read());)if(1===n.pipesCount?r(n.pipes):y(n.pipes,r),e.emit("data",t),n.awaitDrain>0)return;if(0===n.pipesCount)return n.flowing=!1,void(a.listenerCount(e,"data")>0&&_(e));n.ranOut=!0}function m(){this._readableState.ranOut&&(this._readableState.ranOut=!1,v(this))}function _(e,t){if(e._readableState.flowing)throw new Error("Cannot switch to old mode now.");var r=t||!1,i=!1;e.readable=!0,e.pipe=s.prototype.pipe,e.on=e.addListener=s.prototype.on,e.on("readable",function(){var t;for(i=!0;!r&&null!==(t=e.read());)e.emit("data",t);null===t&&(i=!1,e._readableState.needReadable=!0)}),e.pause=function(){r=!0,this.emit("pause")},e.resume=function(){r=!1,i?n.nextTick(function(){e.emit("readable")}):this.read(0),this.emit("resume")},e.emit("readable")}function w(e,t){var n,r=t.buffer,a=t.length,o=!!t.decoder,s=!!t.objectMode;if(0===r.length)return null;if(0===a)n=null;else if(s)n=r.shift();else if(!e||e>=a)n=o?r.join(""):i.concat(r,a),r.length=0;else{if(e0)throw new Error("endReadable called on non-empty stream");!t.endEmitted&&t.calledRead&&(t.ended=!0,n.nextTick(function(){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}))}function y(e,t){for(var n=0,r=e.length;n0)&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return d(this),null;if(0===(e=p(e,t))&&t.ended)return n=null,t.length>0&&t.decoder&&(n=w(e,t),t.length-=n.length),0===t.length&&b(this),n;var i=t.needReadable;return t.length-e<=t.highWaterMark&&(i=!0),(t.ended||t.reading)&&(i=!1),i&&(t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1),i&&!t.reading&&(e=p(r,t)),null===(n=e>0?w(e,t):null)&&(t.needReadable=!0,e=0),t.length-=e,0!==t.length||t.ended||(t.needReadable=!0),t.ended&&!t.endEmitted&&0===t.length&&b(this),n},c.prototype._read=function(e){this.emit("error",new Error("not implemented"))},c.prototype.pipe=function(e,t){var i=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1;var s=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?l:f;function u(e){e===i&&f()}function l(){e.end()}o.endEmitted?n.nextTick(s):i.once("end",s),e.on("unpipe",u);var c=function(e){return function(){var t=e._readableState;t.awaitDrain--,0===t.awaitDrain&&v(e)}}(i);function f(){e.removeListener("close",p),e.removeListener("finish",d),e.removeListener("drain",c),e.removeListener("error",h),e.removeListener("unpipe",u),i.removeListener("end",l),i.removeListener("end",f),e._writableState&&!e._writableState.needDrain||c()}function h(t){g(),e.removeListener("error",h),0===a.listenerCount(e,"error")&&e.emit("error",t)}function p(){e.removeListener("finish",d),g()}function d(){e.removeListener("close",p),g()}function g(){i.unpipe(e)}return e.on("drain",c),e._events&&e._events.error?r(e._events.error)?e._events.error.unshift(h):e._events.error=[h,e._events.error]:e.on("error",h),e.once("close",p),e.once("finish",d),e.emit("pipe",i),o.flowing||(this.on("readable",m),o.flowing=!0,n.nextTick(function(){v(i)})),e},c.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,this.removeListener("readable",m),t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,this.removeListener("readable",m),t.flowing=!1;for(var i=0;i0&&!e[o-1];)o--;a.push({children:[],index:0});var s,u=a[0];for(n=0;n0;)u=a.pop();for(u.index++,a.push(u);a.length<=n;)a.push(s={children:[],index:0}),u.children[u.index]=s.children,u=s;i++}n+10)return p>>--d&1;if(255==(p=t[n++])){var e=t[n++];if(e)throw"unexpected marker: "+(p<<8|e).toString(16)}return d=7,p>>>7}function v(e){for(var t,n=e;null!==(t=g());){if("number"==typeof(n=n[t]))return n;if("object"!=typeof n)throw"invalid huffman sequence"}return null}function m(e){for(var t=0;e>0;){var n=g();if(null===n)return;t=t<<1|n,e--}return t}function _(e){var t=m(e);return t>=1<0)w--;else for(var r=o,i=s;r<=i;){var a=v(t.huffmanTableAC),u=15&a,c=a>>4;if(0!==u)n[e[r+=c]]=_(u)*(1<>4,0===f)a<15?(w=m(a)+(1<>4;if(0!==s)n[e[a+=u]]=_(s),a++;else{if(u<15)break;a+=16}}};var R,L,B,C,O=0;for(L=1==j?i[0].blocksPerLine*i[0].blocksPerColumn:c*r.mcusPerColumn,a||(a=L);O=65488&&R<=65495))break;n+=2}return n-h}function h(e,l){var c,f,h=[],p=l.blocksPerLine,d=l.blocksPerColumn,g=p<<3,v=new Int32Array(64),m=new Uint8Array(64);function _(e,c,f){var h,p,d,g,v,m,_,w,b,y,x=l.quantizationTable,k=f;for(y=0;y<64;y++)k[y]=e[y]*x[y];for(y=0;y<8;++y){var E=8*y;0!=k[1+E]||0!=k[2+E]||0!=k[3+E]||0!=k[4+E]||0!=k[5+E]||0!=k[6+E]||0!=k[7+E]?(h=s*k[0+E]+128>>8,p=s*k[4+E]+128>>8,d=k[2+E],g=k[6+E],v=u*(k[1+E]-k[7+E])+128>>8,w=u*(k[1+E]+k[7+E])+128>>8,m=k[3+E]<<4,_=k[5+E]<<4,b=h-p+1>>1,h=h+p+1>>1,p=b,b=d*o+g*a+128>>8,d=d*a-g*o+128>>8,g=b,b=v-_+1>>1,v=v+_+1>>1,_=b,b=w+m+1>>1,m=w-m+1>>1,w=b,b=h-g+1>>1,h=h+g+1>>1,g=b,b=p-d+1>>1,p=p+d+1>>1,d=b,b=v*i+w*r+2048>>12,v=v*r-w*i+2048>>12,w=b,b=m*n+_*t+2048>>12,m=m*t-_*n+2048>>12,_=b,k[0+E]=h+w,k[7+E]=h-w,k[1+E]=p+_,k[6+E]=p-_,k[2+E]=d+m,k[5+E]=d-m,k[3+E]=g+v,k[4+E]=g-v):(b=s*k[0+E]+512>>10,k[0+E]=b,k[1+E]=b,k[2+E]=b,k[3+E]=b,k[4+E]=b,k[5+E]=b,k[6+E]=b,k[7+E]=b)}for(y=0;y<8;++y){var S=y;0!=k[8+S]||0!=k[16+S]||0!=k[24+S]||0!=k[32+S]||0!=k[40+S]||0!=k[48+S]||0!=k[56+S]?(h=s*k[0+S]+2048>>12,p=s*k[32+S]+2048>>12,d=k[16+S],g=k[48+S],v=u*(k[8+S]-k[56+S])+2048>>12,w=u*(k[8+S]+k[56+S])+2048>>12,m=k[24+S],_=k[40+S],b=h-p+1>>1,h=h+p+1>>1,p=b,b=d*o+g*a+2048>>12,d=d*a-g*o+2048>>12,g=b,b=v-_+1>>1,v=v+_+1>>1,_=b,b=w+m+1>>1,m=w-m+1>>1,w=b,b=h-g+1>>1,h=h+g+1>>1,g=b,b=p-d+1>>1,p=p+d+1>>1,d=b,b=v*i+w*r+2048>>12,v=v*r-w*i+2048>>12,w=b,b=m*n+_*t+2048>>12,m=m*t-_*n+2048>>12,_=b,k[0+S]=h+w,k[56+S]=h-w,k[8+S]=p+_,k[48+S]=p-_,k[16+S]=d+m,k[40+S]=d-m,k[24+S]=g+v,k[32+S]=g-v):(b=s*f[y+0]+8192>>14,k[0+S]=b,k[8+S]=b,k[16+S]=b,k[24+S]=b,k[32+S]=b,k[40+S]=b,k[48+S]=b,k[56+S]=b)}for(y=0;y<64;++y){var A=128+(k[y]+8>>4);c[y]=A<0?0:A>255?255:A}}for(var w=0;w255?255:e}return l.prototype={load:function(e){var t=new XMLHttpRequest;t.open("GET",e,!0),t.responseType="arraybuffer",t.onload=function(){var e=new Uint8Array(t.response||t.mozResponseArrayBuffer);this.parse(e),this.onload&&this.onload()}.bind(this),t.send(null)},parse:function(t){var n=0;t.length;function r(){var e=t[n]<<8|t[n+1];return n+=2,e}function i(){var e=r(),i=t.subarray(n,n+e-2);return n+=i.length,i}function a(e){var t,n,r=0,i=0;for(n in e.components)e.components.hasOwnProperty(n)&&(r<(t=e.components[n]).h&&(r=t.h),i>4==0)for(_=0;_<64;_++){x[e[_]]=t[n++]}else{if(y>>4!=1)throw"DQT: invalid table spec";for(_=0;_<64;_++){x[e[_]]=r()}}p[15&y]=x}break;case 65472:case 65473:case 65474:r(),(o={}).extended=65473===m,o.progressive=65474===m,o.precision=t[n++],o.scanLines=r(),o.samplesPerLine=r(),o.components={},o.componentsOrder=[];var k,E=t[n++];for(P=0;P>4,A=15&t[n+1],T=t[n+2];o.componentsOrder.push(k),o.components[k]={h:S,v:A,quantizationTable:p[T]},n+=3}a(o),d.push(o);break;case 65476:var M=r();for(P=2;P>4==0?v:g)[15&I]=c(j,L)}break;case 65501:r(),s=r();break;case 65498:r();var B=t[n++],C=[];for(P=0;P>4],U.huffmanTableAC=g[15&O],C.push(U)}var z=t[n++],D=t[n++],F=t[n++],N=f(t,n,o,C,s,z,D,F>>4,15&F);n+=N;break;default:if(255==t[n-3]&&t[n-2]>=192&&t[n-2]<=254){n-=3;break}throw"unknown JPEG marker "+m.toString(16)}m=r()}if(1!=d.length)throw"only single frame JPEGs supported";this.width=o.samplesPerLine,this.height=o.scanLines,this.jfif=u,this.adobe=l,this.components=[];for(var P=0;P=0;)t&1<>8&255),O(255&e)}function D(e,t,n,r,i){var a,o=i[0],s=i[240];for(var u=function(e,t){var n,r,i,a,o,s,u,l,c,f,h=0;for(c=0;c<8;++c){n=e[h],r=e[h+1],i=e[h+2],a=e[h+3],o=e[h+4],s=e[h+5],u=e[h+6];var p=n+(l=e[h+7]),g=n-l,v=r+u,m=r-u,_=i+s,w=i-s,b=a+o,y=a-o,x=p+b,k=p-b,E=v+_,S=v-_;e[h]=x+E,e[h+4]=x-E;var A=.707106781*(S+k);e[h+2]=k+A,e[h+6]=k-A;var T=.382683433*((x=y+w)-(S=m+g)),M=.5411961*x+T,I=1.306562965*S+T,j=.707106781*(E=w+m),R=g+j,L=g-j;e[h+5]=L+M,e[h+3]=L-M,e[h+1]=R+I,e[h+7]=R-I,h+=8}for(h=0,c=0;c<8;++c){n=e[h],r=e[h+8],i=e[h+16],a=e[h+24],o=e[h+32],s=e[h+40],u=e[h+48];var B=n+(l=e[h+56]),C=n-l,O=r+u,z=r-u,D=i+s,F=i-s,N=a+o,P=a-o,U=B+N,q=B-N,V=O+D,Z=O-D;e[h]=U+V,e[h+32]=U-V;var W=.707106781*(Z+q);e[h+16]=q+W,e[h+48]=q-W;var G=.382683433*((U=P+F)-(Z=z+C)),H=.5411961*U+G,Y=1.306562965*Z+G,$=.707106781*(V=F+z),X=C+$,J=C-$;e[h+40]=J+H,e[h+24]=J-H,e[h+8]=X+Y,e[h+56]=X-Y,h++}for(c=0;c<64;++c)f=e[c]*t[c],d[c]=f>0?f+.5|0:f-.5|0;return d}(e,t),l=0;l<64;++l)g[E[l]]=u[l];var c=g[0]-n;n=g[0],0==c?C(r[0]):(C(r[p[a=32767+c]]),C(h[a]));for(var f=63;f>0&&0==g[f];f--);if(0==f)return C(o),n;for(var v,m=1;m<=f;){for(var _=m;0==g[m]&&m<=f;++m);var w=m-_;if(w>=16){v=w>>4;for(var b=1;b<=v;++b)C(s);w&=15}a=32767+g[m],C(i[(w<<4)+p[a]]),C(h[a]),m++}return 63!=f&&C(o),n}function F(e){if(e<=0&&(e=1),e>100&&(e=100),o!=e){(function(e){for(var t=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],n=0;n<64;n++){var r=s((t[n]*e+50)/100);r<1?r=1:r>255&&(r=255),u[E[n]]=r}for(var i=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],a=0;a<64;a++){var o=s((i[a]*e+50)/100);o<1?o=1:o>255&&(o=255),l[E[a]]=o}for(var h=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],p=0,d=0;d<8;d++)for(var g=0;g<8;g++)c[p]=1/(u[E[p]]*h[d]*h[g]*8),f[p]=1/(l[E[p]]*h[d]*h[g]*8),p++})(e<50?Math.floor(5e3/e):Math.floor(200-2*e)),o=e}}this.encode=function(t,o){(new Date).getTime();o&&F(o),v=new Array,m=0,_=7,z(65496),z(65504),z(16),O(74),O(70),O(73),O(70),O(0),O(1),O(1),O(0),z(1),z(1),O(0),O(0),function(){z(65499),z(132),O(0);for(var e=0;e<64;e++)O(u[e]);O(1);for(var t=0;t<64;t++)O(l[t])}(),function(e,t){z(65472),z(17),O(8),z(t),z(e),O(3),O(1),O(17),O(0),O(2),O(17),O(1),O(3),O(17),O(1)}(t.width,t.height),function(){z(65476),z(418),O(0);for(var e=0;e<16;e++)O(S[e+1]);for(var t=0;t<=11;t++)O(A[t]);O(16);for(var n=0;n<16;n++)O(T[n+1]);for(var r=0;r<=161;r++)O(M[r]);O(1);for(var i=0;i<16;i++)O(I[i+1]);for(var a=0;a<=11;a++)O(j[a]);O(17);for(var o=0;o<16;o++)O(R[o+1]);for(var s=0;s<=161;s++)O(L[s])}(),z(65498),z(12),O(3),O(1),O(0),O(2),O(17),O(3),O(17),O(0),O(63),O(0);var s=0,h=0,p=0;m=0,_=7,this.encode.displayName="_encode_";for(var d,g,x,E,B,N,P,U,q,V=t.data,Z=t.width,W=t.height,G=4*Z,H=0;H>3)*G+(P=4*(7&q)),H+U>=W&&(N-=G*(H+1+U-W)),d+P>=G&&(N-=d+P-G+4),g=V[N++],x=V[N++],E=V[N++],w[q]=(k[g]+k[x+256>>0]+k[E+512>>0]>>16)-128,b[q]=(k[g+768>>0]+k[x+1024>>0]+k[E+1280>>0]>>16)-128,y[q]=(k[g+1280>>0]+k[x+1536>>0]+k[E+1792>>0]>>16)-128;s=D(w,c,s,n,i),h=D(b,f,h,r,a),p=D(y,f,p,r,a),d+=32}H+=8}if(_>=0){var Y=[];Y[1]=_+1,Y[0]=(1<<_+1)-1,C(Y)}return z(65497),new e(v)},function(){(new Date).getTime();t||(t=50),function(){for(var e=String.fromCharCode,t=0;t<256;t++)x[t]=e(t)}(),n=B(S,A),r=B(I,j),i=B(T,M),a=B(R,L),function(){for(var e=1,t=2,n=1;n<=15;n++){for(var r=e;r>0]=38470*e,k[e+512>>0]=7471*e+32768,k[e+768>>0]=-11059*e,k[e+1024>>0]=-21709*e,k[e+1280>>0]=32768*e+8421375,k[e+1536>>0]=-27439*e,k[e+1792>>0]=-5329*e}(),F(t),(new Date).getTime()}()}t.exports=function(e,t){void 0===t&&(t=50);return{data:new n(t).encode(e,t),width:e.width,height:e.height}}}).call(this,e("buffer").Buffer)},{buffer:4}],111:[function(e,t,n){(function(n){"use strict";var r=e("contentstream"),i=e("gif-encoder"),a=e("jpeg-js"),o=e("pngjs-nozlib").PNG,s=e("ndarray"),u=e("ndarray-ops"),l=e("through");function c(e,t,n){if(4===e.shape.length)return c(e.pick(n),t,0);if(3===e.shape.length)if(3===e.shape[2])u.assign(s(t,[e.shape[0],e.shape[1],3],[4,4*e.shape[0],1]),e),u.assigns(s(t,[e.shape[0]*e.shape[1]],[4],3),255);else if(4===e.shape[2])u.assign(s(t,[e.shape[0],e.shape[1],4],[4,4*e.shape[0],1]),e);else{if(1!==e.shape[2])return new Error("Incompatible array shape");u.assign(s(t,[e.shape[0],e.shape[1],3],[4,4*e.shape[0],1]),s(e.data,[e.shape[0],e.shape[1],3],[e.stride[0],e.stride[1],0],e.offset)),u.assigns(s(t,[e.shape[0]*e.shape[1]],[4],3),255)}else{if(2!==e.shape.length)return new Error("Incompatible array shape");u.assign(s(t,[e.shape[0],e.shape[1],3],[4,4*e.shape[0],1]),s(e.data,[e.shape[0],e.shape[1],3],[e.stride[0],e.stride[1],0],e.offset)),u.assigns(s(t,[e.shape[0]*e.shape[1]],[4],3),255)}return t}function f(e){var t=l();return t.emit("error",e),t}t.exports=function(e,t,s){switch(s=s||{},t.toUpperCase()){case"JPG":case".JPG":case"JPEG":case".JPEG":case"JPE":case".JPE":var u=e.shape[0],l=e.shape[1],h={data:g=c(e,g=new n(u*l*4)),width:u,height:l},p=a.encode(h,s.quality);return new r(p.data);case"GIF":case".GIF":var d=4===e.shape.length?e.shape[0]:1,g=(u=4===e.shape.length?e.shape[1]:e.shape[0],l=4===e.shape.length?e.shape[2]:e.shape[1],new n(u*l*4)),v=new i(u,l);v.writeHeader();for(var m=0;m0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===l.prototype||(t=function(e){return l.from(e)}(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):y(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?y(e,o,t,!1):A(e,o)):y(e,o,t,!1))):r||(o.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=x?e=x:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function E(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(p("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(S,e):S(e))}function S(e){p("emit readable"),e.emit("readable"),j(e)}function A(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(T,e,t))}function T(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;ea.length?a.length:e;if(o===a.length?i+=a:i+=a.slice(0,e),0===(e-=o)){o===a.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=a.slice(o));break}++r}return t.length-=r,i}(e,t):function(e,t){var n=l.allocUnsafe(e),r=t.head,i=1;r.data.copy(n),e-=r.data.length;for(;r=r.next;){var a=r.data,o=e>a.length?a.length:e;if(a.copy(n,n.length-e,0,o),0===(e-=o)){o===a.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=a.slice(o));break}++i}return t.length-=i,n}(e,t);return r}(e,t.buffer,t.decoder),n);var n}function L(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(B,t,e))}function B(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function C(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return p("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?L(this):E(this),null;if(0===(e=k(e,t))&&t.ended)return 0===t.length&&L(this),null;var r,i=t.needReadable;return p("need readable",i),(0===t.length||t.length-e0?R(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&L(this)),null!==r&&this.emit("data",r),r},w.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},w.prototype.pipe=function(e,t){var r=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=e;break;case 1:a.pipes=[a.pipes,e];break;default:a.pipes.push(e)}a.pipesCount+=1,p("pipe count=%d opts=%j",a.pipesCount,t);var u=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?c:w;function l(t,n){p("onunpipe"),t===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,p("cleanup"),e.removeListener("close",m),e.removeListener("finish",_),e.removeListener("drain",f),e.removeListener("error",v),e.removeListener("unpipe",l),r.removeListener("end",c),r.removeListener("end",w),r.removeListener("data",g),h=!0,!a.awaitDrain||e._writableState&&!e._writableState.needDrain||f())}function c(){p("onend"),e.end()}a.endEmitted?i.nextTick(u):r.once("end",u),e.on("unpipe",l);var f=function(e){return function(){var t=e._readableState;p("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&s(e,"data")&&(t.flowing=!0,j(e))}}(r);e.on("drain",f);var h=!1;var d=!1;function g(t){p("ondata"),d=!1,!1!==e.write(t)||d||((1===a.pipesCount&&a.pipes===e||a.pipesCount>1&&-1!==C(a.pipes,e))&&!h&&(p("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,d=!0),r.pause())}function v(t){p("onerror",t),w(),e.removeListener("error",v),0===s(e,"error")&&e.emit("error",t)}function m(){e.removeListener("finish",_),w()}function _(){p("onfinish"),e.removeListener("close",m),w()}function w(){p("unpipe"),r.unpipe(e)}return r.on("data",g),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",v),e.once("close",m),e.once("finish",_),e.emit("pipe",r),a.flowing||(p("pipe resume"),r.resume()),e},w.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var a=0;a-1?i:a.nextTick;_.WritableState=m;var l=e("core-util-is");l.inherits=e("inherits");var c={deprecate:e("util-deprecate")},f=e("./internal/streams/stream"),h=e("safe-buffer").Buffer,p=r.Uint8Array||function(){};var d,g=e("./internal/streams/destroy");function v(){}function m(t,n){s=s||e("./_stream_duplex"),t=t||{};var r=n instanceof s;this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var i=t.highWaterMark,l=t.writableHighWaterMark,c=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(l||0===l)?l:c,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var f=!1===t.decodeStrings;this.decodeStrings=!f,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,i){--t.pendingcb,n?(a.nextTick(i,r),a.nextTick(E,e,t),e._writableState.errorEmitted=!0,e.emit("error",r)):(i(r),e._writableState.errorEmitted=!0,e.emit("error",r),E(e,t))}(e,n,r,t,i);else{var o=x(n);o||n.corked||n.bufferProcessing||!n.bufferedRequest||y(e,n),r?u(b,e,n,o,i):b(e,n,o,i)}}(n,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function _(t){if(s=s||e("./_stream_duplex"),!(d.call(_,this)||this instanceof s))return new _(t);this._writableState=new m(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),f.call(this)}function w(e,t,n,r,i,a,o){t.writelen=r,t.writecb=o,t.writing=!0,t.sync=!0,n?e._writev(i,t.onwrite):e._write(i,a,t.onwrite),t.sync=!1}function b(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),E(e,t)}function y(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,i=new Array(r),a=t.corkedRequestsFree;a.entry=n;for(var s=0,u=!0;n;)i[s]=n,n.isBuf||(u=!1),n=n.next,s+=1;i.allBuffers=u,w(e,t,!0,t.length,i,"",a.finish),t.pendingcb++,t.lastBufferedRequest=null,a.next?(t.corkedRequestsFree=a.next,a.next=null):t.corkedRequestsFree=new o(t),t.bufferedRequestCount=0}else{for(;n;){var l=n.chunk,c=n.encoding,f=n.callback;if(w(e,t,!1,t.objectMode?1:l.length,l,c,f),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function x(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function k(e,t){e._final(function(n){t.pendingcb--,n&&e.emit("error",n),t.prefinished=!0,e.emit("prefinish"),E(e,t)})}function E(e,t){var n=x(t);return n&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,a.nextTick(k,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),n}l.inherits(_,f),m.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(m.prototype,"buffer",{get:c.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(d=Function.prototype[Symbol.hasInstance],Object.defineProperty(_,Symbol.hasInstance,{value:function(e){return!!d.call(this,e)||this===_&&(e&&e._writableState instanceof m)}})):d=function(e){return e instanceof this},_.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},_.prototype.write=function(e,t,n){var r,i=this._writableState,o=!1,s=!i.objectMode&&(r=e,h.isBuffer(r)||r instanceof p);return s&&!h.isBuffer(e)&&(e=function(e){return h.from(e)}(e)),"function"==typeof t&&(n=t,t=null),s?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof n&&(n=v),i.ended?function(e,t){var n=new Error("write after end");e.emit("error",n),a.nextTick(t,n)}(this,n):(s||function(e,t,n,r){var i=!0,o=!1;return null===n?o=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(e.emit("error",o),a.nextTick(r,o),i=!1),i}(this,i,e,n))&&(i.pendingcb++,o=function(e,t,n,r,i,a){if(!n){var o=function(e,t,n){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n));return t}(t,r,i);r!==o&&(n=!0,i="buffer",r=o)}var s=t.objectMode?1:r.length;t.length+=s;var u=t.length-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(e,t,n){t.ending=!0,E(e,t),n&&(t.finished?a.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("timers").setImmediate)},{"./_stream_duplex":114,"./internal/streams/destroy":120,"./internal/streams/stream":121,_process:98,"core-util-is":8,inherits:57,"process-nextick-args":97,"safe-buffer":107,timers:128,"util-deprecate":133}],119:[function(e,t,n){"use strict";var r=e("safe-buffer").Buffer,i=e("util");t.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},e.prototype.concat=function(e){if(0===this.length)return r.alloc(0);if(1===this.length)return this.head.data;for(var t,n,i,a=r.allocUnsafe(e>>>0),o=this.head,s=0;o;)t=o.data,n=a,i=s,t.copy(n,i),s+=o.data.length,o=o.next;return a},e}(),i&&i.inspect&&i.inspect.custom&&(t.exports.prototype[i.inspect.custom]=function(){var e=i.inspect({length:this.length});return this.constructor.name+" "+e})},{"safe-buffer":107,util:3}],120:[function(e,t,n){"use strict";var r=e("process-nextick-args");function i(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var n=this,a=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return a||o?(t?t(e):!e||this._writableState&&this._writableState.errorEmitted||r.nextTick(i,this,e),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?(r.nextTick(i,n,e),n._writableState&&(n._writableState.errorEmitted=!0)):t&&t(e)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},{"process-nextick-args":97}],121:[function(e,t,n){t.exports=e("events").EventEmitter},{events:43}],122:[function(e,t,n){t.exports=e("./readable").PassThrough},{"./readable":123}],123:[function(e,t,n){(n=t.exports=e("./lib/_stream_readable.js")).Stream=n,n.Readable=n,n.Writable=e("./lib/_stream_writable.js"),n.Duplex=e("./lib/_stream_duplex.js"),n.Transform=e("./lib/_stream_transform.js"),n.PassThrough=e("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":114,"./lib/_stream_passthrough.js":115,"./lib/_stream_readable.js":116,"./lib/_stream_transform.js":117,"./lib/_stream_writable.js":118}],124:[function(e,t,n){t.exports=e("./readable").Transform},{"./readable":123}],125:[function(e,t,n){t.exports=e("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":118}],126:[function(e,t,n){"use strict";var r=e("safe-buffer").Buffer,i=r.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){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!0;default:return!1}};function a(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(r.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=u,this.end=l,t=4;break;case"utf8":this.fillLast=s,t=4;break;case"base64":this.text=c,this.end=f,t=3;break;default:return this.write=h,void(this.end=p)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(t)}function o(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function s(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function u(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function l(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function c(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function f(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function h(e){return e.toString(this.encoding)}function p(e){return e&&e.length?this.write(e):""}n.StringDecoder=a,a.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0)return i>0&&(e.lastNeed=i-1),i;if(--r=0)return i>0&&(e.lastNeed=i-2),i;if(--r=0)return i>0&&(2===i?i=0:e.lastNeed=i-3),i;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)},a.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},{"safe-buffer":107}],127:[function(e,t,n){(function(n){var r=e("stream");function i(e,t,i){e=e||function(e){this.queue(e)},t=t||function(){this.queue(null)};var a=!1,o=!1,s=[],u=!1,l=new r;function c(){for(;s.length&&!l.paused;){var e=s.shift();if(null===e)return l.emit("end");l.emit("data",e)}}return l.readable=l.writable=!0,l.paused=!1,l.autoDestroy=!(i&&!1===i.autoDestroy),l.write=function(t){return e.call(this,t),!l.paused},l.queue=l.push=function(e){return u?l:(null===e&&(u=!0),s.push(e),c(),l)},l.on("end",function(){l.readable=!1,!l.writable&&l.autoDestroy&&n.nextTick(function(){l.destroy()})}),l.end=function(e){if(!a)return a=!0,arguments.length&&l.write(e),l.writable=!1,t.call(l),!l.readable&&l.autoDestroy&&l.destroy(),l},l.destroy=function(){if(!o)return o=!0,a=!0,s.length=0,l.writable=l.readable=!1,l.emit("close"),l},l.pause=function(){if(!l.paused)return l.paused=!0,l},l.resume=function(){return l.paused&&(l.paused=!1,l.emit("resume")),c(),l.paused||l.emit("drain"),l},l}t.exports=i,i.through=i}).call(this,e("_process"))},{_process:98,stream:112}],128:[function(e,t,n){(function(t,r){var i=e("process/browser.js").nextTick,a=Function.prototype.apply,o=Array.prototype.slice,s={},u=0;function l(e,t){this._id=e,this._clearFn=t}n.setTimeout=function(){return new l(a.call(setTimeout,window,arguments),clearTimeout)},n.setInterval=function(){return new l(a.call(setInterval,window,arguments),clearInterval)},n.clearTimeout=n.clearInterval=function(e){e.close()},l.prototype.unref=l.prototype.ref=function(){},l.prototype.close=function(){this._clearFn.call(window,this._id)},n.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},n.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},n._unrefActive=n.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},n.setImmediate="function"==typeof t?t:function(e){var t=u++,r=!(arguments.length<2)&&o.call(arguments,1);return s[t]=!0,i(function(){s[t]&&(r?e.apply(null,r):e.call(null),n.clearImmediate(t))}),t},n.clearImmediate="function"==typeof r?r:function(e){delete s[e]}}).call(this,e("timers").setImmediate,e("timers").clearImmediate)},{"process/browser.js":98,timers:128}],129:[function(e,t,n){n.isatty=function(){return!1},n.ReadStream=function(){throw new Error("tty.ReadStream is not implemented")},n.WriteStream=function(){throw new Error("tty.WriteStream is not implemented")}},{}],130:[function(e,t,n){(function(t,r){"use strict";var i=e("bit-twiddle"),a=e("dup");t.__TYPEDARRAY_POOL||(t.__TYPEDARRAY_POOL={UINT8:a([32,0]),UINT16:a([32,0]),UINT32:a([32,0]),INT8:a([32,0]),INT16:a([32,0]),INT32:a([32,0]),FLOAT:a([32,0]),DOUBLE:a([32,0]),DATA:a([32,0]),UINT8C:a([32,0]),BUFFER:a([32,0])});var o="undefined"!=typeof Uint8ClampedArray,s=t.__TYPEDARRAY_POOL;s.UINT8C||(s.UINT8C=a([32,0])),s.BUFFER||(s.BUFFER=a([32,0]));var u=s.DATA,l=s.BUFFER;function c(e){if(e){var t=e.length||e.byteLength,n=i.log2(t);u[n].push(e)}}function f(e){e=i.nextPow2(e);var t=i.log2(e),n=u[t];return n.length>0?n.pop():new ArrayBuffer(e)}function h(e){return new Uint8Array(f(e),0,e)}function p(e){return new Uint16Array(f(2*e),0,e)}function d(e){return new Uint32Array(f(4*e),0,e)}function g(e){return new Int8Array(f(e),0,e)}function v(e){return new Int16Array(f(2*e),0,e)}function m(e){return new Int32Array(f(4*e),0,e)}function _(e){return new Float32Array(f(4*e),0,e)}function w(e){return new Float64Array(f(8*e),0,e)}function b(e){return o?new Uint8ClampedArray(f(e),0,e):h(e)}function y(e){return new DataView(f(e),0,e)}function x(e){e=i.nextPow2(e);var t=i.log2(e),n=l[t];return n.length>0?n.pop():new r(e)}n.free=function(e){if(r.isBuffer(e))l[i.log2(e.length)].push(e);else{if("[object ArrayBuffer]"!==Object.prototype.toString.call(e)&&(e=e.buffer),!e)return;var t=e.length||e.byteLength,n=0|i.log2(t);u[n].push(e)}},n.freeUint8=n.freeUint16=n.freeUint32=n.freeInt8=n.freeInt16=n.freeInt32=n.freeFloat32=n.freeFloat=n.freeFloat64=n.freeDouble=n.freeUint8Clamped=n.freeDataView=function(e){c(e.buffer)},n.freeArrayBuffer=c,n.freeBuffer=function(e){l[i.log2(e.length)].push(e)},n.malloc=function(e,t){if(void 0===t||"arraybuffer"===t)return f(e);switch(t){case"uint8":return h(e);case"uint16":return p(e);case"uint32":return d(e);case"int8":return g(e);case"int16":return v(e);case"int32":return m(e);case"float":case"float32":return _(e);case"double":case"float64":return w(e);case"uint8_clamped":return b(e);case"buffer":return x(e);case"data":case"dataview":return y(e);default:return null}return null},n.mallocArrayBuffer=f,n.mallocUint8=h,n.mallocUint16=p,n.mallocUint32=d,n.mallocInt8=g,n.mallocInt16=v,n.mallocInt32=m,n.mallocFloat32=n.mallocFloat=_,n.mallocFloat64=n.mallocDouble=w,n.mallocUint8Clamped=b,n.mallocDataView=y,n.mallocBuffer=x,n.clearCache=function(){for(var e=0;e<32;++e)s.UINT8[e].length=0,s.UINT16[e].length=0,s.UINT32[e].length=0,s.INT8[e].length=0,s.INT16[e].length=0,s.INT32[e].length=0,s.FLOAT[e].length=0,s.DOUBLE[e].length=0,s.UINT8C[e].length=0,u[e].length=0,l[e].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer)},{"bit-twiddle":2,buffer:4,dup:14}],131:[function(e,t,n){"use strict";t.exports=function(e,t,n){return 0===e.length?e:t?(n||e.sort(t),function(e,t){for(var n=1,r=e.length,i=e[0],a=e[0],o=1;o=o?u+1:o}r.mkdir(t+"sequencer"+o,function(){var a=t+"sequencer"+o+"/";for(var s in n.images){var u=n.images[s].steps;if(i){var l=u.slice(-1)[0].output.src,c=u.slice(-1)[0].output.format,f=e("data-uri-to-buffer")(l);r.writeFile(a+s+"_"+(u.length-1)+"."+c,f,function(){})}else for(var h in u){l=u[h].output.src,c=u[h].output.format,f=e("data-uri-to-buffer")(l);r.writeFile(a+s+"_"+h+"."+c,f,function(){})}}})},r.readdir(c,function(e,t){var n=[];if(void 0===t||0==t.length)return f(n),[];for(var i=0;i0&&(thisStep=c[e].steps[t],thisStep.UI.onRemove(thisStep.options.step),c[e].steps.splice(t,1))}function g(){var t=[],n=this;for(var r in arguments)t.push(a(arguments[r]));var i=l.call(this,t,"l");f.push({method:"loadImages",json_q:a(i)});var o=this.copy(i.loadedimages),s={name:"ImageSequencer Wrapper",sequencer:this,addSteps:this.addSteps,removeSteps:this.removeSteps,insertSteps:this.insertSteps,run:this.run,UI:this.UI,setUI:this.setUI,images:o};!function t(r){if(r!=o.length){var a=o[r];e("./ui/LoadImage")(n,a,i.images[a],function(){t(++r)})}else i.callback.call(s)}(0)}function v(e){var t={};if("load-image"==e)return{};if(0==arguments.length){for(var n in this.modules)t[n]=s[n][1];for(var r in this.sequences)t[r]={name:r,steps:u[r]}}else t=s[e]?s[e][1]:{inputs:u[e].options};return t}function m(e){let t=a(v(e.options.name).inputs);t=t||{};for(let n in t)t[n]=e.options[n]||t[n].default,t[n]=encodeURIComponent(t[n]);var n=Object.keys(t).map(e=>e+":"+t[e]).join("|");return`${e.options.name}{${n}}`}function _(e){let t;return(t=e.includes(",")?e.split(","):[e]).map(w)}function w(e){var t;if(t=e.includes("{")?e.includes("(")&&e.indexOf("(")=t.images[u].steps.length?{options:{name:void 0}}:t.images[u].steps.slice(f+e)[0]},t.images[u].steps[f].getIndex=function(){return f},r)r.hasOwnProperty(p)&&(t.images[u].steps[f][p]=r[p]);t.images[u].steps[f].UI.onDraw(t.images[u].steps[f].options.step);var d=e("./RunToolkit")(t.copy(h));t.images[u].steps[f].draw(d,function(){t.images[u].steps[f].options.step.output=t.images[u].steps[f].output.src,t.images[u].steps[f].UI.onComplete(t.images[u].steps[f].options.step),n(a,++s)},o)}}(s,a)}(n=function(e){for(var n in e)0==e[n]&&1==t.images[n].steps.length?delete e[n]:0==e[n]&&e[n]++;for(var n in e)for(var r=t.images[n].steps[e[n]-1];void 0===r||void 0===r.output;)r=t.images[n].steps[--e[n]-1];return e}(n))}},{"./RunToolkit":144,"./util/getStep.js":212}],144:[function(e,t,n){const r=e("get-pixels"),i=e("./modules/_nomodule/PixelManipulation"),a=e("lodash"),o=e("data-uri-to-buffer"),s=e("save-pixels");t.exports=function(e){return e.getPixels=r,e.pixelManipulation=i,e.lodash=a,e.dataUriToBuffer=o,e.savePixels=s,e}},{"./modules/_nomodule/PixelManipulation":207,"data-uri-to-buffer":13,"get-pixels":23,lodash:62,"save-pixels":111}],145:[function(e,t,n){t.exports={sample:[{name:"invert",options:{}},{name:"channel",options:{channel:"red"}},{name:"blur",options:{blur:"5"}}]}},{}],146:[function(e,t,n){t.exports=function(t,n){return t.blur=t.blur||2,t.step.metadata=t.step.metadata||{},{options:t,draw:function(n,r,i){i.stop(!0),i.overrideFlag=!0;var a=this;return e("../_nomodule/PixelManipulation.js")(n,{output:function(e,t,n){a.output={src:t,format:n}},changePixel:function(e,t,n,r){return[e,t,n,r]},extraManipulation:function(e){for(var n=[0,0,0,0],r=0;rAverages (r, g, b, a): "+n.join(", ")+"

"),e},format:n.format,image:t.image,callback:r})},output:void 0,UI:n}}},{"../_nomodule/PixelManipulation.js":207}],147:[function(e,t,n){t.exports=[e("./Module"),e("./info.json")]},{"./Module":146,"./info.json":148}],148:[function(e,t,n){t.exports={name:"Average",description:"Average all pixel color",inputs:{}}},{}],149:[function(require,module,exports){module.exports=function Dynamic(options,UI,util){var output;function draw(input,callback,progressObj){progressObj.stop(!0),progressObj.overrideFlag=!0;var step=this;"string"==typeof options.func&&eval("options.func = "+options.func);var getPixels=require("get-pixels"),priorStep=this.getStep(-2);getPixels(priorStep.output.src,function(e,t){return options.firstImagePixels=t,require("../_nomodule/PixelManipulation.js")(input,{output:function(e,t,n){step.output={src:t,format:n}},changePixel:function(e,t,n,r,i,a){var o=options.firstImagePixels;return options.func(e,t,n,r,o.get(i,a,0),o.get(i,a,1),o.get(i,a,2),o.get(i,a,3))},format:input.format,image:options.image,inBrowser:options.inBrowser,callback:callback})})}return options.func=options.func||"function(r1, g1, b1, a1, r2, g2, b2, a2) { return [ r1, g2, b2, a2 ] }",{options:options,draw:draw,output:output,UI:UI}}},{"../_nomodule/PixelManipulation.js":207,"get-pixels":23}],150:[function(e,t,n){arguments[4][147][0].apply(n,arguments)},{"./Module":149,"./info.json":151,dup:147}],151:[function(e,t,n){t.exports={name:"Blend",description:"Blend the past two image steps with the given function. Defaults to using the red channel from image 1 and the green and blue and alpha channels of image 2. Easier to use interfaces coming soon!",inputs:{blend:{type:"input",desc:"Function to use to blend the two images.",default:"function(r1, g1, b1, a1, r2, g2, b2, a2) { return [ r1, g2, b2, a2 ] }"}}}},{}],152:[function(e,t,n){t.exports=function(e,t){let n=[[2/159,4/159,5/159,4/159,2/159],[4/159,9/159,12/159,9/159,4/159],[5/159,12/159,15/159,12/159,5/159],[4/159,9/159,12/159,9/159,4/159],[2/159,4/159,5/159,4/159,2/159]],r=e;n=function(e){let t=[];for(let n=e.length-1;n>=0;n--){let r=[];for(let t=e[n].length-1;t>=0;t--)r.push(e[n][t]);t.push(r)}return t}(n);for(let t=0;tg;n=0<=g?++c:--c)r[n]=(t-i)/(a-i)*(u[n]-s[n])+s[n];return r}}t.exports=function(e,t){return t.colormap=t.colormap||i.default,"object"==typeof t.colormap?colormapFunction=r(t.colormap):i.hasOwnProperty(t.colormap)?colormapFunction=i[t.colormap]:colormapFunction=i.default,colormapFunction(e/255)};var i={greyscale:r([[0,[0,0,0],[255,255,255]],[1,[255,255,255],[255,255,255]]]),default:r([[0,[0,0,255],[0,255,0]],[.25,[0,255,0],[255,255,0]],[.5,[0,255,255],[255,255,0]],[.75,[255,255,0],[255,0,0]]]),ndvi:r([[0,[0,0,255],[38,195,195]],[.5,[0,150,0],[255,255,0]],[.75,[255,255,0],[255,50,50]]]),stretched:r([[0,[0,0,255],[0,0,255]],[.1,[0,0,255],[38,195,195]],[.5,[0,150,0],[255,255,0]],[.7,[255,255,0],[255,50,50]],[.9,[255,50,50],[255,50,50]]]),fastie:r([[0,[255,255,255],[0,0,0]],[.167,[0,0,0],[255,255,255]],[.33,[255,255,255],[0,0,0]],[.5,[0,0,0],[140,140,255]],[.55,[140,140,255],[0,255,0]],[.63,[0,255,0],[255,255,0]],[.75,[255,255,0],[255,0,0]],[.95,[255,0,0],[255,0,255]]])}},{}],166:[function(e,t,n){t.exports=function(t,n){return{options:t,draw:function(n,r,i){i.stop(!0),i.overrideFlag=!0;var a=this;return e("../_nomodule/PixelManipulation.js")(n,{output:function(e,t,n){a.output={src:t,format:n}},changePixel:function(n,r,i,a){var o=(n+r+i)/3,s=e("./Colormap")(o,t);return[s[0],s[1],s[2],255]},format:n.format,image:t.image,inBrowser:t.inBrowser,callback:r})},output:void 0,UI:n}}},{"../_nomodule/PixelManipulation.js":207,"./Colormap":165}],167:[function(e,t,n){arguments[4][147][0].apply(n,arguments)},{"./Module":166,"./info.json":168,dup:147}],168:[function(e,t,n){t.exports={name:"Colormap",description:"Maps brightness values (average of red, green & blue) to a given color lookup table, made up of a set of one more color gradients.\n\nFor example, 'cooler' colors like blue could represent low values, while 'hot' colors like red could represent high values.",inputs:{colormap:{type:"select",desc:"Name of the Colormap",default:"default",values:["default","greyscale","stretched","fastie"]}}}},{}],169:[function(e,t,n){(function(n){t.exports=function(t,r,i){var a=e("get-pixels"),o=e("save-pixels");r.x=parseInt(r.x)||0,r.y=parseInt(r.y)||0,a(t.src,function(e,a){r.w=parseInt(r.w)||Math.floor(a.shape[0]),r.h=parseInt(r.h)||Math.floor(a.shape[1]);for(var s=r.x,u=r.y,l=r.w,c=r.h,f=a.shape[0],h=new Uint8Array(4*l*c),p=u;pInfragrammar.",inputs:{red:{type:"input",desc:"Expression to return for red channel with R, G, B, and A inputs",default:"r"},green:{type:"input",desc:"Expression to return for green channel with R, G, B, and A inputs",default:"g"},blue:{type:"input",desc:"Expression to return for blue channel with R, G, B, and A inputs",default:"b"},"monochrome (fallback)":{type:"input",desc:"Expression to return with R, G, B, and A inputs; fallback for other channels if none provided",default:"r + g + b"}}}},{}],180:[function(e,t,n){e("lodash");const r=[[-1,0,1],[-2,0,2],[-1,0,1]],i=[[-1,-2,-1],[0,0,0],[1,2,1]];let a,o=[],s=[],u=[],l=[];function c(e,t,n,a,o){let s=0;for(let t=0;t<3;t++)for(let n=0;n<3;n++){let i=a+t-1,u=o+n-1;s+=e.get(i,u,0)*r[t][n]}let u=0;for(let t=0;t<3;t++)for(let n=0;n<3;n++){let r=a+t-1,s=o+n-1;u+=e.get(r,s,0)*i[t][n]}return{pixel:[t,t,t,Math.sqrt(Math.pow(s,2)+Math.pow(u,2))],angle:Math.atan2(u,s)}}t.exports=function(e,t,n,r){a=!r;for(var i=0;ii?s[t][n]>r?u.push(a):l.push(a):e.set(t,n,3,0)}return u.forEach(t=>e.set(t[0],t[1],3,255)),e}(function(e){o=o.map(e=>e.map(f));for(let t=1;t=-22.5&&r<=22.5||r<-157.5&&r>=-180?s[t][n]>=s[t][n+1]&&s[t][n]>=s[t][n-1]?e.set(t,n,3,s[t][n]):e.set(t,n,3,0):r>=22.5&&r<=67.5||r<-112.5&&r>=-157.5?s[t][n]>=s[t+1][n+1]&&s[t][n]>=s[t-1][n-1]?e.set(t,n,3,s[t][n]):e.set(t,n,3,0):r>=67.5&&r<=112.5||r<-67.5&&r>=-112.5?s[t][t]>=s[t+1][n]&&s[t][n]>=s[t][n]?e.set(t,n,3,s[t][n]):e.set(t,n,3,0):(r>=112.5&&r<=157.5||r<-22.5&&r>=-67.5)&&(s[t][n]>=s[t+1][n-1]&&s[t][n]>=s[t-1][n+1]?e.set(t,n,3,s[t][n]):e.set(t,n,3,0))}return e}(e),0,n)};var f=e=>180*e/Math.PI,h=e=>Math.max(...e.map(e=>e.map(e=>e||0)).map(e=>Math.max(...e)))},{lodash:62}],181:[function(e,t,n){t.exports=function(t,n){return t.blur=t.blur||2,t.highThresholdRatio=t.highThresholdRatio||.2,t.lowThresholdRatio=t.lowThresholdRatio||.15,{options:t,draw:function(n,r,i){i.stop(!0),i.overrideFlag=!0;var a=this;return e("../_nomodule/PixelManipulation.js")(n,{output:function(e,t,n){a.output={src:t,format:n}},changePixel:function(e,t,n,r){return[(e+t+n)/3,(e+t+n)/3,(e+t+n)/3,r]},extraManipulation:function(n){return n=e("ndarray-gaussian-filter")(n,t.blur),e("./EdgeUtils")(n,t.highThresholdRatio,t.lowThresholdRatio,t.inBrowser)},format:n.format,image:t.image,inBrowser:t.inBrowser,callback:r})},output:void 0,UI:n}}},{"../_nomodule/PixelManipulation.js":207,"./EdgeUtils":180,"ndarray-gaussian-filter":67}],182:[function(e,t,n){arguments[4][147][0].apply(n,arguments)},{"./Module":181,"./info.json":183,dup:147}],183:[function(e,t,n){t.exports={name:"Detect Edges",description:"this module detects edges using the Canny method, which first Gaussian blurs the image to reduce noise (amount of blur configurable in settings as `options.blur`), then applies a number of steps to highlight edges, resulting in a greyscale image where the brighter the pixel, the stronger the detected edge. Read more at: https://en.wikipedia.org/wiki/Canny_edge_detector",inputs:{blur:{type:"integer",desc:"amount of gaussian blur(Less blur gives more detail, typically 0-5)",default:2},highThresholdRatio:{type:"float",desc:"The high threshold ratio for the image",default:.2},lowThresholdRatio:{type:"float",desc:"The low threshold value for the image",default:.15}}}},{}],184:[function(e,t,n){t.exports=function(t,n){return e("fisheyegl"),{options:t,draw:function(e,n){var r=this;if(t.inBrowser){if(document.querySelector("#image-sequencer-canvas"))var i=document.querySelector("#image-sequencer-canvas");else(i=document.createElement("canvas")).style.display="none",i.setAttribute("id","image-sequencer-canvas"),document.body.append(i);distorter=FisheyeGl({selector:"#image-sequencer-canvas"}),t.a=parseFloat(t.a)||distorter.lens.a,t.b=parseFloat(t.b)||distorter.lens.b,t.Fx=parseFloat(t.Fx)||distorter.lens.Fx,t.Fy=parseFloat(t.Fy)||distorter.lens.Fy,t.scale=parseFloat(t.scale)||distorter.lens.scale,t.x=parseFloat(t.x)||distorter.fov.x,t.y=parseFloat(t.y)||distorter.fov.y,distorter.lens.a=t.a,distorter.lens.b=t.b,distorter.lens.Fx=t.Fx,distorter.lens.Fy=t.Fy,distorter.lens.scale=t.scale,distorter.fov.x=t.x,distorter.fov.y=t.y,distorter.setImage(e.src,function(){r.output={src:i.toDataURL(),format:e.format},n()})}else this.output=e,n()},output:void 0,UI:n}}},{fisheyegl:15}],185:[function(e,t,n){arguments[4][147][0].apply(n,arguments)},{"./Module":184,"./info.json":186,dup:147}],186:[function(e,t,n){t.exports={name:"Fisheye GL",description:"Correct fisheye, or barrel distortion, in images (with WebGL -- adapted from fisheye-correction-webgl by @bluemir).",requires:["webgl"],inputs:{a:{type:"float",desc:"a parameter",default:1,min:1,max:4},b:{type:"float",desc:"b parameter",default:1,min:1,max:4},Fx:{type:"float",desc:"Fx parameter",default:0,min:0,max:4},Fy:{type:"float",desc:"Fy parameter",default:0,min:0,max:4},scale:{type:"float",desc:"Image Scaling",default:1.5,min:0,max:20},x:{type:"float",desc:"FOV x parameter",default:1.5,min:0,max:20},y:{type:"float",desc:"FOV y parameter",default:1.5,min:0,max:20},fragmentSrc:{type:"PATH",desc:"Patht to a WebGL fragment shader file",default:"(inbuilt)"},vertexSrc:{type:"PATH",desc:"Patht to a WebGL vertex shader file",default:"(inbuilt)"}}}},{}],187:[function(e,t,n){(function(n){t.exports=function(t,r){return{options:t,draw:function(t,r,i){var a=e("get-pixels"),o=e("save-pixels"),s=this;a(t.src,function(e,i){if(e)console.log("Bad Image path");else{for(var a=0,u=0;u

Select or drag in an image to overlay.

';$(e.ui).find(".details").prepend(i),sequencer.setInputStep({dropZoneSelector:"#"+r,fileInputSelector:"#"+r+" .file-input",onLoad:function(t){var n=t.target;e.options.imageUrl=n.result,e.options.url=n.result,sequencer.run(),setUrlHashParameter("steps",sequencer.toString())}}),$(e.ui).find(".btn-save").on("click",function(){var t=$(e.ui).find(".det input").val();e.options.imageUrl=t,sequencer.run()})}}}},{}],192:[function(e,t,n){arguments[4][147][0].apply(n,arguments)},{"./Module":190,"./info.json":193,dup:147}],193:[function(e,t,n){t.exports={name:"Import Image",description:"Import a new image and replace the original with it. Future versions may enable a blend mode. Specify an image by URL or by file selector.",url:"https://github.com/publiclab/image-sequencer/tree/master/MODULES.md",inputs:{url:{type:"string",desc:"URL of image to import",default:"./images/monarch.png"}}}},{}],194:[function(e,t,n){t.exports=function(t,n){if(t.step.inBrowser)var r=e("./Ui.js")(t.step,n);return t.filter=t.filter||"red",{options:t,draw:function(n,i,a){a.stop(!0),a.overrideFlag=!0;var o=this;return e("../_nomodule/PixelManipulation.js")(n,{output:function(e,t,n){o.output={src:t,format:n}},changePixel:function(e,n,r,i){if("red"==t.filter)var a=(r-e)/(1*r+e);"blue"==t.filter&&(a=(e-r)/(1*r+e));var o=255*(a+1)/2;return[o,o,o,i]},format:n.format,image:t.image,inBrowser:t.inBrowser,callback:function(){t.step.inBrowser&&r.setup(),i()}})},output:void 0,UI:n}}},{"../_nomodule/PixelManipulation.js":207,"./Ui.js":195}],195:[function(e,t,n){t.exports=function(e,t){return{setup:function(){var t=$(e.imgElement);t.mousemove(function(e){var n=document.createElement("canvas");n.width=t.width(),n.height=t.height(),n.getContext("2d").drawImage(this,0,0);var r=$(this).offset(),i=e.pageX-r.left,a=e.pageY-r.top,o=n.getContext("2d").getImageData(i,a,1,1).data[0];o=(o=o/127.5-1).toFixed(2),t[0].title="NDVI: "+o})}}}},{}],196:[function(e,t,n){arguments[4][147][0].apply(n,arguments)},{"./Module":194,"./info.json":197,dup:147}],197:[function(e,t,n){t.exports={name:"NDVI",description:"Normalized Difference Vegetation Index, or NDVI, is an image analysis technique used with aerial photography. It's a way to visualize the amounts of infrared and other wavelengths of light reflected from vegetation by comparing ratios of blue and red light absorbed versus green and IR light reflected. NDVI is used to evaluate the health of vegetation in satellite imagery, where it correlates with how much photosynthesis is happening. This is helpful in assessing vegetative health or stress. Read more.

This is designed for use with red-filtered single camera DIY Infragram cameras; change to 'blue' for blue filters",inputs:{filter:{type:"select",desc:"Filter color",default:"red",values:["red","blue"]}}}},{}],198:[function(e,t,n){t.exports=function(){return this.expandSteps([{name:"ndvi",options:{}},{name:"colormap",options:{}}]),{isMeta:!0}}},{}],199:[function(e,t,n){arguments[4][147][0].apply(n,arguments)},{"./Module":198,"./info.json":200,dup:147}],200:[function(e,t,n){t.exports={name:"NDVI-Colormap",description:"Sequentially Applies NDVI and Colormap steps",inputs:{},length:2}},{}],201:[function(e,t,n){t.exports=function(t,n,r){return t.x=t.x||0,t.y=t.y||0,{options:t,draw:function(n,r,i){t.offset=t.offset||-2,i.stop(!0),i.overrideFlag=!0;var a=this,o=this.getStep(t.offset).image,s=this.getOutput(t.offset);e("get-pixels")(n.src,function(n,i){return t.secondImagePixels=i,e("../_nomodule/PixelManipulation.js")(s,{output:function(e,t,n){a.output={src:t,format:n}},changePixel:function(e,n,r,i,a,o){var s=t.secondImagePixels;return a>=t.x&&a=t.y&&o
To work with a new or different image, drag one into the drop zone.",ID:t.options.sequencerCounter++,imageName:e,inBrowser:t.options.inBrowser,ui:t.options.ui},o={src:n,steps:[{options:{id:r.ID,name:"load-image",description:"This initial step loads and displays the original image without any modifications.",title:"Load Image",step:r},UI:t.events,draw:function(){return UI.onDraw(options.step),1==arguments.length?(this.output=a(arguments[0]),options.step.output=this.output,UI.onComplete(options.step),!0):2==arguments.length&&(this.output=a(arguments[0]),options.step.output=this.output,arguments[1](),UI.onComplete(options.step),!0)}}]};a(n,function(n){var r=function(e){return{src:e,format:e.split(":")[1].split(";")[0].split("/")[1]}}(n);t.images[e]=o;var a=t.images[e].steps[0];return a.output=r,a.options.step.output=a.output.src,a.UI.onSetup(a.options.step),a.UI.onDraw(a.options.step),a.UI.onComplete(a.options.step),i(),!0})}(n,r)}},{urify:132}],209:[function(e,t,n){t.exports=function(){return function(e){var t=$(e.dropZoneSelector),n=$(e.fileInputSelector),r=e.onLoad;function i(e){if(e.preventDefault(),e.stopPropagation(),e.target&&e.target.files)var t=e.target.files[0];else t=e.dataTransfer.files[0];if(t){var n=new FileReader;n.onload=r,n.readAsDataURL(t)}}new FileReader,n.on("change",i),t[0].addEventListener("drop",i,!1),t.on("dragover",function(e){e.stopPropagation(),e.preventDefault(),e.dataTransfer.dropEffect="copy"},!1),t.on("dragenter",function(e){t.addClass("hover")}),t.on("dragleave",function(e){t.removeClass("hover")})}}},{}],210:[function(e,t,n){t.exports=function(e={}){return e.onSetup=e.onSetup||function(e){0==e.ui||(e.inBrowser?console.log('Added Step "'+e.name+'" to "'+e.imageName+'".'):console.log("%s",'Added Step "'+e.name+'" to "'+e.imageName+'".'))},e.onDraw=e.onDraw||function(e){0==e.ui||(e.inBrowser?console.log('Drawing Step "'+e.name+'" on "'+e.imageName+'".'):console.log("%s",'Drawing Step "'+e.name+'" on "'+e.imageName+'".'))},e.onComplete=e.onComplete||function(e){0==e.ui||(e.inBrowser?console.log('Drawn Step "'+e.name+'" on "'+e.imageName+'".'):console.log("%s",'Drawn Step "'+e.name+'" on "'+e.imageName+'".'))},e.onRemove=e.onRemove||function(e){0==e.ui||(e.inBrowser?console.log('Removing Step "'+e.name+'" of "'+e.imageName+'".'):console.log("%s",'Removing Step "'+e.name+'" of "'+e.imageName+'".'))},e}},{}],211:[function(e,t,n){t.exports=function(e){var t=void 0;return"jpeg"===(t=(t=function(e){return"data:image"===e.substr(0,10)}(e)?e.split(";")[0].split("/").pop():e.split(".").pop()).toLowerCase())&&(t="jpg"),["jpg","jpeg","png","gif","canvas"].includes(t)?t:"jpg"}},{}],212:[function(e,t,n){t.exports={getPreviousStep:function(){return this.getStep(-1)},getNextStep:function(){return this.getStep(1)},getInput:function(e){return e+this.getIndex()===0&&e++,this.getStep(e-1).output},getOutput:function(e){return this.getStep(e).output},getOptions:function(){return this.getStep(0).options},setOptions:function(e){let t=this.getStep(0).options;for(let n in e)t[n]&&(t[n]=e[n])},getFormat:function(){return this.getStep(-1).output.format},getHeight:function(e){let t=new Image;t.onload=function(){e(t.height)},t.src=this.getInput(0).src},getWidth:function(e){let t=new Image;t.onload=function(){e(t.width)},t.src=this.getInput(0).src}}},{}]},{},[139]); \ No newline at end of file +!function(){return function e(t,n,r){function i(o,s){if(!n[o]){if(!t[o]){var u="function"==typeof require&&require;if(!s&&u)return u(o,!0);if(a)return a(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[o]={exports:{}};t[o][0].call(c.exports,function(e){return i(t[o][1][e]||e)},c,c.exports,e,t,n,r)}return n[o].exports}for(var a="function"==typeof require&&require,o=0;o0?r-4:r,f=0;f>16&255,s[u++]=t>>8&255,s[u++]=255&t;2===o&&(t=i[e.charCodeAt(f)]<<2|i[e.charCodeAt(f+1)]>>4,s[u++]=255&t);1===o&&(t=i[e.charCodeAt(f)]<<10|i[e.charCodeAt(f+1)]<<4|i[e.charCodeAt(f+2)]>>2,s[u++]=t>>8&255,s[u++]=255&t);return s},n.fromByteArray=function(e){for(var t,n=e.length,i=n%3,a=[],o=0,s=n-i;os?s:o+16383));1===i?(t=e[n-1],a.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],a.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return a.join("")};for(var r=[],i=[],a="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=o.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function c(e,t,n){for(var i,a,o=[],s=t;s>18&63]+r[a>>12&63]+r[a>>6&63]+r[63&a]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],2:[function(e,t,n){"use strict";"use restrict";function r(e){var t=32;return(e&=-e)&&t--,65535&e&&(t-=16),16711935&e&&(t-=8),252645135&e&&(t-=4),858993459&e&&(t-=2),1431655765&e&&(t-=1),t}n.INT_BITS=32,n.INT_MAX=2147483647,n.INT_MIN=-1<<31,n.sign=function(e){return(e>0)-(e<0)},n.abs=function(e){var t=e>>31;return(e^t)-t},n.min=function(e,t){return t^(e^t)&-(e65535)<<4,t|=n=((e>>>=t)>255)<<3,t|=n=((e>>>=n)>15)<<2,(t|=n=((e>>>=n)>3)<<1)|(e>>>=n)>>1},n.log10=function(e){return e>=1e9?9:e>=1e8?8:e>=1e7?7:e>=1e6?6:e>=1e5?5:e>=1e4?4:e>=1e3?3:e>=100?2:e>=10?1:0},n.popCount=function(e){return 16843009*((e=(858993459&(e-=e>>>1&1431655765))+(e>>>2&858993459))+(e>>>4)&252645135)>>>24},n.countTrailingZeros=r,n.nextPow2=function(e){return e+=0===e,--e,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,(e|=e>>>16)+1},n.prevPow2=function(e){return e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,(e|=e>>>16)-(e>>>1)},n.parity=function(e){return e^=e>>>16,e^=e>>>8,e^=e>>>4,27030>>>(e&=15)&1};var i=new Array(256);!function(e){for(var t=0;t<256;++t){var n=t,r=t,i=7;for(n>>>=1;n;n>>>=1)r<<=1,r|=1&n,--i;e[t]=r<>>8&255]<<16|i[e>>>16&255]<<8|i[e>>>24&255]},n.interleave2=function(e,t){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e&=65535)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t&=65535)|t<<8))|t<<4))|t<<2))|t<<1))<<1},n.deinterleave2=function(e,t){return(e=65535&((e=16711935&((e=252645135&((e=858993459&((e=e>>>t&1431655765)|e>>>1))|e>>>2))|e>>>4))|e>>>16))<<16>>16},n.interleave3=function(e,t,n){return e=1227133513&((e=3272356035&((e=251719695&((e=4278190335&((e&=1023)|e<<16))|e<<8))|e<<4))|e<<2),(e|=(t=1227133513&((t=3272356035&((t=251719695&((t=4278190335&((t&=1023)|t<<16))|t<<8))|t<<4))|t<<2))<<1)|(n=1227133513&((n=3272356035&((n=251719695&((n=4278190335&((n&=1023)|n<<16))|n<<8))|n<<4))|n<<2))<<2},n.deinterleave3=function(e,t){return(e=1023&((e=4278190335&((e=251719695&((e=3272356035&((e=e>>>t&1227133513)|e>>>2))|e>>>4))|e>>>8))|e>>>16))<<22>>22},n.nextCombination=function(e){var t=e|e-1;return t+1|(~t&-~t)-1>>>r(e)+1}},{}],3:[function(e,t,n){},{}],4:[function(e,t,n){"use strict";var r=e("base64-js"),i=e("ieee754");n.Buffer=s,n.SlowBuffer=function(e){+e!=e&&(e=0);return s.alloc(+e)},n.INSPECT_MAX_BYTES=50;var a=2147483647;function o(e){if(e>a)throw new RangeError("Invalid typed array length");var t=new Uint8Array(e);return t.__proto__=s.prototype,t}function s(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return c(e)}return u(e,t,n)}function u(e,t,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return P(e)?function(e,t,n){if(t<0||e.byteLength=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|e}function p(e,t){if(s.isBuffer(e))return e.length;if(U(e)||P(e))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return D(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return F(e).length;default:if(r)return D(e).length;t=(""+t).toLowerCase(),r=!0}}function d(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function g(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),q(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=s.from(t,r)),s.isBuffer(t))return 0===t.length?-1:v(e,t,n,r,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,r,i){var a,o=1,s=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,s/=2,u/=2,n/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var c=-1;for(a=n;as&&(n=s-u),a=n;a>=0;a--){for(var f=!0,h=0;hi&&(r=i):r=i;var a=t.length;if(a%2!=0)throw new TypeError("Invalid hex string");r>a/2&&(r=a/2);for(var o=0;o>8,i=n%256,a.push(i),a.push(r);return a}(t,e.length-n),e,n,r)}function k(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function E(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i239?4:l>223?3:l>191?2:1;if(i+f<=n)switch(f){case 1:l<128&&(c=l);break;case 2:128==(192&(a=e[i+1]))&&(u=(31&l)<<6|63&a)>127&&(c=u);break;case 3:a=e[i+1],o=e[i+2],128==(192&a)&&128==(192&o)&&(u=(15&l)<<12|(63&a)<<6|63&o)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:a=e[i+1],o=e[i+2],s=e[i+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(u=(15&l)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&u<1114112&&(c=u)}null===c?(c=65533,f=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),i+=f}return function(e){var t=e.length;if(t<=S)return String.fromCharCode.apply(String,e);var n="",r=0;for(;rthis.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,n);case"utf8":case"utf-8":return E(this,t,n);case"ascii":return A(this,t,n);case"latin1":case"binary":return T(this,t,n);case"base64":return k(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}.apply(this,arguments)},s.prototype.equals=function(e){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===s.compare(this,e)},s.prototype.inspect=function(){var e="",t=n.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),""},s.prototype.compare=function(e,t,n,r,i){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var a=(i>>>=0)-(r>>>=0),o=(n>>>=0)-(t>>>=0),u=Math.min(a,o),l=this.slice(r,i),c=e.slice(t,n),f=0;f>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var a=!1;;)switch(r){case"hex":return m(this,e,t,n);case"utf8":case"utf-8":return _(this,e,t,n);case"ascii":return w(this,e,t,n);case"latin1":case"binary":return b(this,e,t,n);case"base64":return y(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,e,t,n);default:if(a)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),a=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var S=4096;function A(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;ir)&&(n=r);for(var i="",a=t;an)throw new RangeError("Trying to access beyond buffer length")}function R(e,t,n,r,i,a){if(!s.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function L(e,t,n,r,i,a){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function B(e,t,n,r,a){return t=+t,n>>>=0,a||L(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function C(e,t,n,r,a){return t=+t,n>>>=0,a||L(e,0,n,8),i.write(e,t,n,r,52,8),n+8}s.prototype.slice=function(e,t){var n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t>>=0,t>>>=0,n||j(e,t,this.length);for(var r=this[e],i=1,a=0;++a>>=0,t>>>=0,n||j(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},s.prototype.readUInt8=function(e,t){return e>>>=0,t||j(e,1,this.length),this[e]},s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||j(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||j(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||j(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||j(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||j(e,t,this.length);for(var r=this[e],i=1,a=0;++a=(i*=128)&&(r-=Math.pow(2,8*t)),r},s.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||j(e,t,this.length);for(var r=t,i=1,a=this[e+--r];r>0&&(i*=256);)a+=this[e+--r]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},s.prototype.readInt8=function(e,t){return e>>>=0,t||j(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||j(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt16BE=function(e,t){e>>>=0,t||j(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||j(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||j(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readFloatLE=function(e,t){return e>>>=0,t||j(e,4,this.length),i.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||j(e,4,this.length),i.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||j(e,8,this.length),i.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||j(e,8,this.length),i.read(this,e,!1,52,8)},s.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t>>>=0,n>>>=0,r)||R(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,a=0;for(this[t]=255&e;++a>>=0,n>>>=0,r)||R(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},s.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,255,0),this[t]=255&e,t+1},s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var i=Math.pow(2,8*n-1);R(this,e,t,n,i-1,-i)}var a=0,o=1,s=0;for(this[t]=255&e;++a>0)-s&255;return t+n},s.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var i=Math.pow(2,8*n-1);R(this,e,t,n,i-1,-i)}var a=n-1,o=1,s=0;for(this[t+a]=255&e;--a>=0&&(o*=256);)e<0&&0===s&&0!==this[t+a+1]&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+n},s.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeFloatLE=function(e,t,n){return B(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return B(this,e,t,!1,n)},s.prototype.writeDoubleLE=function(e,t,n){return C(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return C(this,e,t,!1,n)},s.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(a<1e3)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(a=t;a55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return a}function F(e){return r.toByteArray(function(e){if((e=e.trim().replace(O,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function N(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function P(e){return e instanceof ArrayBuffer||null!=e&&null!=e.constructor&&"ArrayBuffer"===e.constructor.name&&"number"==typeof e.byteLength}function U(e){return"function"==typeof ArrayBuffer.isView&&ArrayBuffer.isView(e)}function q(e){return e!=e}},{"base64-js":1,ieee754:55}],5:[function(e,t,n){(function(n){var r=e("tty"),i=e("./lib/encode"),a=e("stream").Stream,o=t.exports=function(){var e=null;function t(t){if(e)throw new Error("multiple inputs specified");e=t}var i=null;function a(e){if(i)throw new Error("multiple outputs specified");i=e}for(var o=0;o0&&this.down(t),e>0?this.right(e):e<0&&this.left(-e),this},s.prototype.up=function(e){return void 0===e&&(e=1),this.write(i("["+Math.floor(e)+"A")),this},s.prototype.down=function(e){return void 0===e&&(e=1),this.write(i("["+Math.floor(e)+"B")),this},s.prototype.right=function(e){return void 0===e&&(e=1),this.write(i("["+Math.floor(e)+"C")),this},s.prototype.left=function(e){return void 0===e&&(e=1),this.write(i("["+Math.floor(e)+"D")),this},s.prototype.column=function(e){return this.write(i("["+Math.floor(e)+"G")),this},s.prototype.push=function(e){return this.write(i(e?"7":"[s")),this},s.prototype.pop=function(e){return this.write(i(e?"8":"[u")),this},s.prototype.erase=function(e){return"end"===e||"$"===e?this.write(i("[K")):"start"===e||"^"===e?this.write(i("[1K")):"line"===e?this.write(i("[2K")):"down"===e?this.write(i("[J")):"up"===e?this.write(i("[1J")):"screen"===e?this.write(i("[1J")):this.emit("error",new Error("Unknown erase type: "+e)),this},s.prototype.display=function(e){var t={reset:0,bright:1,dim:2,underscore:4,blink:5,reverse:7,hidden:8}[e];return void 0===t&&this.emit("error",new Error("Unknown attribute: "+e)),this.write(i("["+t+"m")),this},s.prototype.foreground=function(e){if("number"==typeof e)(e<0||e>=256)&&this.emit("error",new Error("Color out of range: "+e)),this.write(i("[38;5;"+e+"m"));else{var t={black:30,red:31,green:32,yellow:33,blue:34,magenta:35,cyan:36,white:37}[e.toLowerCase()];t||this.emit("error",new Error("Unknown color: "+e)),this.write(i("["+t+"m"))}return this},s.prototype.background=function(e){if("number"==typeof e)(e<0||e>=256)&&this.emit("error",new Error("Color out of range: "+e)),this.write(i("[48;5;"+e+"m"));else{var t={black:40,red:41,green:42,yellow:43,blue:44,magenta:45,cyan:46,white:47}[e.toLowerCase()];t||this.emit("error",new Error("Unknown color: "+e)),this.write(i("["+t+"m"))}return this},s.prototype.cursor=function(e){return this.write(i(e?"[?25h":"[?25l")),this};var u=o.extractCodes=function(e){for(var t=[],n=-1,r=0;r=0&&t.push(e.slice(n,r)),n=r):n>=0&&r===e.length-1&&t.push(e.slice(n));return t}}).call(this,e("_process"))},{"./lib/encode":6,_process:98,stream:112,tty:129}],6:[function(e,t,n){(function(e){var n=(t.exports=function(t){return new e([27].concat(function e(t){return"string"==typeof t?t.split("").map(n):Array.isArray(t)?t.reduce(function(t,n){return t.concat(e(n))},[]):void 0}(t)))}).ord=function(e){return e.charCodeAt(0)}}).call(this,e("buffer").Buffer)},{buffer:4}],7:[function(e,t,n){(function(n){"use strict";var r=e("readable-stream").Readable,i=e("util");function a(e,t){if(!(this instanceof a))return new a(e,t);r.call(this,t),null==e&&(e=String(e)),this._obj=e}t.exports=a,i.inherits(a,r),a.prototype._read=function(e){var t=this._obj;"string"==typeof t?this.push(new n(t)):n.isBuffer(t)?this.push(t):this.push(new n(JSON.stringify(t))),this.push(null)}}).call(this,e("buffer").Buffer)},{buffer:4,"readable-stream":106,util:135}],8:[function(e,t,n){(function(e){function t(e){return Object.prototype.toString.call(e)}n.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===t(e)},n.isBoolean=function(e){return"boolean"==typeof e},n.isNull=function(e){return null===e},n.isNullOrUndefined=function(e){return null==e},n.isNumber=function(e){return"number"==typeof e},n.isString=function(e){return"string"==typeof e},n.isSymbol=function(e){return"symbol"==typeof e},n.isUndefined=function(e){return void 0===e},n.isRegExp=function(e){return"[object RegExp]"===t(e)},n.isObject=function(e){return"object"==typeof e&&null!==e},n.isDate=function(e){return"[object Date]"===t(e)},n.isError=function(e){return"[object Error]"===t(e)||e instanceof Error},n.isFunction=function(e){return"function"==typeof e},n.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},n.isBuffer=e.isBuffer}).call(this,{isBuffer:e("../../is-buffer/index.js")})},{"../../is-buffer/index.js":59}],9:[function(e,t,n){"use strict";var r=e("./lib/thunk.js");t.exports=function(e){var t=new function(){this.argTypes=[],this.shimArgs=[],this.arrayArgs=[],this.arrayBlockIndices=[],this.scalarArgs=[],this.offsetArgs=[],this.offsetArgIndex=[],this.indexArgs=[],this.shapeArgs=[],this.funcName="",this.pre=null,this.body=null,this.post=null,this.debug=!1};t.pre=e.pre,t.body=e.body,t.post=e.post;var n=e.args.slice(0);t.argTypes=n;for(var i=0;i0)throw new Error("cwise: pre() block may not reference array args");if(i0)throw new Error("cwise: post() block may not reference array args")}else if("scalar"===a)t.scalarArgs.push(i),t.shimArgs.push("scalar"+i);else if("index"===a){if(t.indexArgs.push(i),i0)throw new Error("cwise: pre() block may not reference array index");if(i0)throw new Error("cwise: post() block may not reference array index")}else if("shape"===a){if(t.shapeArgs.push(i),in.length)throw new Error("cwise: Too many arguments in pre() block");if(t.body.args.length>n.length)throw new Error("cwise: Too many arguments in body() block");if(t.post.args.length>n.length)throw new Error("cwise: Too many arguments in post() block");return t.debug=!!e.printCode||!!e.debug,t.funcName=e.funcName||"cwise",t.blockSize=e.blockSize||64,r(t)}},{"./lib/thunk.js":11}],10:[function(e,t,n){"use strict";var r=e("uniq");function i(e,t,n){var r,i,a=e.length,o=t.arrayArgs.length,s=t.indexArgs.length>0,u=[],l=[],c=0,f=0;for(r=0;r0&&u.push("var "+l.join(",")),r=a-1;r>=0;--r)c=e[r],u.push(["for(i",r,"=0;i",r,"0&&u.push(["index[",f,"]-=s",f].join("")),u.push(["++index[",c,"]"].join(""))),u.push("}")}return u.join("\n")}function a(e,t,n){for(var r=e.body,i=[],a=[],o=0;o0&&_.push("shape=SS.slice(0)"),e.indexArgs.length>0){var w=new Array(n);for(u=0;u0&&m.push("var "+_.join(",")),u=0;u3&&m.push(a(e.pre,e,s));var k=a(e.body,e,s),E=function(e){for(var t=0,n=e[0].length;t0,l=[],c=0;c0;){"].join("")),l.push(["if(j",c,"<",s,"){"].join("")),l.push(["s",t[c],"=j",c].join("")),l.push(["j",c,"=0"].join("")),l.push(["}else{s",t[c],"=",s].join("")),l.push(["j",c,"-=",s,"}"].join("")),u&&l.push(["index[",t[c],"]=j",c].join(""));for(c=0;c3&&m.push(a(e.post,e,s)),e.debug&&console.log("-----Generated cwise routine for ",t,":\n"+m.join("\n")+"\n----------");var S=[e.funcName||"unnamed","_cwise_loop_",o[0].join("s"),"m",E,function(e){for(var t=new Array(e.length),n=!0,r=0;r0&&(n=n&&t[r]===t[r-1])}return n?t[0]:t.join("")}(s)].join("");return new Function(["function ",S,"(",v.join(","),"){",m.join("\n"),"} return ",S].join(""))()}},{uniq:131}],11:[function(e,t,n){"use strict";var r=e("./compile.js");t.exports=function(e){var t=["'use strict'","var CACHED={}"],n=[],i=e.funcName+"_cwise_thunk";t.push(["return function ",i,"(",e.shimArgs.join(","),"){"].join(""));for(var a=[],o=[],s=[["array",e.arrayArgs[0],".shape.slice(",Math.max(0,e.arrayBlockIndices[0]),e.arrayBlockIndices[0]<0?","+e.arrayBlockIndices[0]+")":")"].join("")],u=[],l=[],c=0;c0&&(u.push("array"+e.arrayArgs[0]+".shape.length===array"+f+".shape.length+"+(Math.abs(e.arrayBlockIndices[0])-Math.abs(e.arrayBlockIndices[c]))),l.push("array"+e.arrayArgs[0]+".shape[shapeIndex+"+Math.max(0,e.arrayBlockIndices[0])+"]===array"+f+".shape[shapeIndex+"+Math.max(0,e.arrayBlockIndices[c])+"]"))}for(e.arrayArgs.length>1&&(t.push("if (!("+u.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same dimensionality!')"),t.push("for(var shapeIndex=array"+e.arrayArgs[0]+".shape.length-"+Math.abs(e.arrayBlockIndices[0])+"; shapeIndex--\x3e0;) {"),t.push("if (!("+l.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),t.push("}")),c=0;c0)return function(e,t){var n,r;for(n=new Array(e),r=0;r 0.99 || vMapping.x < 0.01 || vMapping.y > 0.99 || vMapping.y < 0.01){\n\t\ttexture = vec4(0.0, 0.0, 0.0, 1.0);\n\t} \n\tgl_FragColor = texture;\n}\n"},{}],18:[function(e,t,n){t.exports="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec4 uLens;\nuniform vec2 uFov;\nuniform sampler2D uSampler;\nvarying vec3 vPosition;\nvarying vec2 vTextureCoord;\nvec2 TextureCoord2GLCoord(vec2 textureCoord) {\n\treturn (textureCoord - vec2(0.5, 0.5)) * 2.0;\n}\nvec2 GLCoord2TextureCoord(vec2 glCoord) {\n\treturn glCoord / 2.0 + vec2(0.5, 0.5);\n}\nvoid main(void){\n\tfloat correctionRadius = 0.5;\n\tfloat distance = sqrt(vPosition.x * vPosition.x + vPosition.y * vPosition.y) / correctionRadius;\n\tfloat theta = 1.0;\n\tif(distance != 0.0){\n\t\ttheta = atan(distance);\n\t}\n\tvec2 vMapping = theta * vPosition.xy;\n\tvMapping = GLCoord2TextureCoord(vMapping);\n\t\t\n\tvec4 texture = texture2D(uSampler, vMapping);\n\tif(vMapping.x > 0.99 || vMapping.x < 0.01 || vMapping.y > 0.99 || vMapping.y < 0.01){\n\t\ttexture = vec4(0.0, 0.0, 0.0, 1.0);\n\t} \n\tgl_FragColor = texture;\n}\n"},{}],19:[function(e,t,n){t.exports="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec3 uLensS;\nuniform vec2 uLensF;\nuniform vec2 uFov;\nuniform sampler2D uSampler;\nvarying vec3 vPosition;\nvarying vec2 vTextureCoord;\nvec2 GLCoord2TextureCoord(vec2 glCoord) {\n\treturn glCoord * vec2(1.0, -1.0)/ 2.0 + vec2(0.5, 0.5);\n}\nvoid main(void){\n\tfloat scale = uLensS.z;\n\tvec3 vPos = vPosition;\n\tfloat Fx = uLensF.x;\n\tfloat Fy = uLensF.y;\n\tvec2 vMapping = vPos.xy;\n\tvMapping.x = vMapping.x + ((pow(vPos.y, 2.0)/scale)*vPos.x/scale)*-Fx;\n\tvMapping.y = vMapping.y + ((pow(vPos.x, 2.0)/scale)*vPos.y/scale)*-Fy;\n\tvMapping = vMapping * uLensS.xy;\n\tvMapping = GLCoord2TextureCoord(vMapping/scale);\n\tvec4 texture = texture2D(uSampler, vMapping);\n\tif(vMapping.x > 0.99 || vMapping.x < 0.01 || vMapping.y > 0.99 || vMapping.y < 0.01){\n\t\ttexture = vec4(0.0, 0.0, 0.0, 1.0);\n\t}\n\tgl_FragColor = texture;\n}\n"},{}],20:[function(e,t,n){t.exports="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec4 uLens;\nuniform vec2 uFov;\nuniform sampler2D uSampler;\nvarying vec3 vPosition;\nvarying vec2 vTextureCoord;\nvec2 TextureCoord2GLCoord(vec2 textureCoord) {\n\treturn (textureCoord - vec2(0.5, 0.5)) * 2.0;\n}\nvec2 GLCoord2TextureCoord(vec2 glCoord) {\n\treturn glCoord / 2.0 + vec2(0.5, 0.5);\n}\nvoid main(void){\n\tvec2 vMapping = vec2(vTextureCoord.x, 1.0 - vTextureCoord.y);\n\tvMapping = TextureCoord2GLCoord(vMapping);\n\t//TODO insert Code\n\tfloat F = uLens.x/ uLens.w;\n\tfloat seta = length(vMapping) / F;\n\tvMapping = sin(seta) * F / length(vMapping) * vMapping;\n\tvMapping *= uLens.w * 1.414;\n\tvMapping = GLCoord2TextureCoord(vMapping);\n\tvec4 texture = texture2D(uSampler, vMapping);\n\tif(vMapping.x > 0.99 || vMapping.x < 0.01 || vMapping.y > 0.99 || vMapping.y < 0.01){\n\t\ttexture = vec4(0.0, 0.0, 0.0, 1.0);\n\t} \n\tgl_FragColor = texture;\n}\n"},{}],21:[function(e,t,n){t.exports="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec4 uLens;\nuniform vec2 uFov;\nuniform sampler2D uSampler;\nvarying vec3 vPosition;\nvarying vec2 vTextureCoord;\nvec2 TextureCoord2GLCoord(vec2 textureCoord) {\n\treturn (textureCoord - vec2(0.5, 0.5)) * 2.0;\n}\nvec2 GLCoord2TextureCoord(vec2 glCoord) {\n\treturn glCoord / 2.0 + vec2(0.5, 0.5);\n}\nvoid main(void){\n\tvec2 vMapping = vec2(vTextureCoord.x, 1.0 - vTextureCoord.y);\n\tvMapping = TextureCoord2GLCoord(vMapping);\n\t//TOD insert Code\n\tfloat F = uLens.x/ uLens.w;\n\tfloat seta = length(vMapping) / F;\n\tvMapping = sin(seta) * F / length(vMapping) * vMapping;\n\tvMapping *= uLens.w * 1.414;\n\tvMapping = GLCoord2TextureCoord(vMapping);\n\tvec4 texture = texture2D(uSampler, vMapping);\n\tif(vMapping.x > 0.99 || vMapping.x < 0.01 || vMapping.y > 0.99 || vMapping.y < 0.01){\n\t\ttexture = vec4(0.0, 0.0, 0.0, 1.0);\n\t} \n\tgl_FragColor = texture;\n}\n"},{}],22:[function(e,t,n){t.exports="#ifdef GL_ES\nprecision highp float;\n#endif\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nvarying vec3 vPosition;\nvarying vec2 vTextureCoord;\nvoid main(void){\n\tvPosition = aVertexPosition;\n\tvTextureCoord = aTextureCoord;\n\tgl_Position = vec4(vPosition,1.0);\n}\n"},{}],23:[function(e,t,n){(function(n,r){"use strict";var i=e("path"),a=e("ndarray"),o=e("omggif").GifReader,s=(e("ndarray-pack"),e("through"),e("data-uri-to-buffer"));function u(e,t){var n;try{n=new o(e)}catch(e){return void t(e)}if(n.numFrames()>0){var r=[n.numFrames(),n.height,n.width,4],i=new Uint8Array(r[0]*r[1]*r[2]*r[3]),s=a(i,r);try{for(var u=0;u=0&&(this.dispose=e)},u.prototype.setRepeat=function(e){this.repeat=e},u.prototype.setTransparent=function(e){this.transparent=e},u.prototype.analyzeImage=function(e){this.setImagePixels(this.removeAlphaChannel(e)),this.analyzePixels()},u.prototype.writeImageInfo=function(){this.firstFrame&&(this.writeLSD(),this.writePalette(),this.repeat>=0&&this.writeNetscapeExt()),this.writeGraphicCtrlExt(),this.writeImageDesc(),this.firstFrame||this.writePalette(),this.firstFrame=!1},u.prototype.outputImage=function(){this.writePixels()},u.prototype.addFrame=function(e){this.emit("frame#start"),this.analyzeImage(e),this.writeImageInfo(),this.outputImage(),this.emit("frame#stop")},u.prototype.finish=function(){this.emit("finish#start"),this.writeByte(59),this.emit("finish#stop")},u.prototype.setQuality=function(e){e<1&&(e=1),this.sample=e},u.prototype.writeHeader=function(){this.emit("writeHeader#start"),this.writeUTFBytes("GIF89a"),this.emit("writeHeader#stop")},u.prototype.analyzePixels=function(){var e=this.pixels.length/3;this.indexedPixels=new Uint8Array(e);var t=new a(this.pixels,this.sample);t.buildColormap(),this.colorTab=t.getColormap();for(var n=0,r=0;r>16,n=(65280&e)>>8,r=255&e,i=0,a=16777216,o=this.colorTab.length,s=0;s=0&&(t=7&dispose),t<<=2,this.writeByte(0|t|e),this.writeShort(this.delay),this.writeByte(this.transIndex),this.writeByte(0)},u.prototype.writeImageDesc=function(){this.writeByte(44),this.writeShort(0),this.writeShort(0),this.writeShort(this.width),this.writeShort(this.height),this.firstFrame?this.writeByte(0):this.writeByte(128|this.palSize)},u.prototype.writeLSD=function(){this.writeShort(this.width),this.writeShort(this.height),this.writeByte(240|this.palSize),this.writeByte(0),this.writeByte(0)},u.prototype.writeNetscapeExt=function(){this.writeByte(33),this.writeByte(255),this.writeByte(11),this.writeUTFBytes("NETSCAPE2.0"),this.writeByte(3),this.writeByte(1),this.writeShort(this.repeat),this.writeByte(0)},u.prototype.writePalette=function(){this.writeBytes(this.colorTab);for(var e=768-this.colorTab.length,t=0;t>8&255)},u.prototype.writePixels=function(){new o(this.width,this.height,this.indexedPixels,this.colorDepth).encode(this)},u.prototype.stream=function(){return this},u.ByteCapacitor=s,t.exports=u}).call(this,e("buffer").Buffer)},{"./LZWEncoder.js":26,"./TypedNeuQuant.js":27,assert:36,buffer:4,events:43,"readable-stream":34,util:135}],26:[function(e,t,n){var r=-1,i=12,a=5003,o=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535];t.exports=function(e,t,n,s){var u,l,c,f,h,p,d,g,v,m=Math.max(2,s),_=new Uint8Array(256),w=new Int32Array(a),b=new Int32Array(a),y=0,x=0,k=!1;function E(e,t){_[l++]=e,l>=254&&T(t)}function S(e){A(a),x=g+2,k=!0,j(g,e)}function A(e){for(var t=0;t0&&(e.writeByte(l),e.writeBytes(_,0,l),l=0)}function M(e){return(1<0?u|=e<=8;)E(255&u,t),u>>=8,y-=8;if((x>c||k)&&(k?(c=M(p=d),k=!1):c=++p==i?1<0;)E(255&u,t),u>>=8,y-=8;T(t)}}this.encode=function(n){n.writeByte(m),f=e*t,h=0,function(e,t){var n,o,s,u,f,h,m;for(k=!1,c=M(p=d=e),v=1+(g=1<=0){f=h-s,0===s&&(f=1);do{if((s-=f)<0&&(s+=h),w[s]===n){u=b[s];continue e}}while(w[s]>=0)}j(u,t),u=o,x<1<>c,h=u<>3)*(1<l;)u=T[p++],fl&&((s=n[h--])[0]-=u*(s[0]-r)/_,s[1]-=u*(s[1]-a)/_,s[2]-=u*(s[2]-o)/_)}function j(e,t,r){var a,u,p,d,g,v=~(1<<31),m=v,_=-1,w=_;for(a=0;a>s-o))>c,A[a]-=g,S[a]+=g<>3),e=0;e>p;for(A<=1&&(A=0),n=0;n=c&&(R-=c),0===_&&(_=1),++n%_==0)for(E-=E/f,(A=(S-=S/g)>>p)<=1&&(A=0),l=0;l>=o,n[e][1]>>=o,n[e][2]>>=o,n[e][3]=e}(),function(){var e,t,r,o,s,u,l=0,c=0;for(e=0;e>1,t=l+1;t>1,t=l+1;t<256;t++)E[t]=a}()},this.getColormap=function(){for(var e=[],t=[],r=0;r=0;)c=u?c=i:(c++,s<0&&(s=-s),(a=o[0]-e)<0&&(a=-a),(s+=a)=0&&((s=t-(o=n[f])[1])>=u?f=-1:(f--,s<0&&(s=-s),(a=o[0]-e)<0&&(a=-a),(s+=a)0)if(t.ended&&!a){var s=new Error("stream.push() after EOF");e.emit("error",s)}else if(t.endEmitted&&a){s=new Error("stream.unshift() after end event");e.emit("error",s)}else!t.decoder||a||i||(r=t.decoder.write(r)),a||(t.reading=!1),t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,a?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&g(e)),function(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(function(){!function(e,t){var n=t.length;for(;!t.reading&&!t.flowing&&!t.ended&&t.lengtht.highWaterMark&&(t.highWaterMark=function(e){if(e>=p)e=p;else{e--;for(var t=1;t<32;t<<=1)e|=e>>t;e++}return e}(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function g(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(l("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?n.nextTick(function(){v(e)}):v(e))}function v(e){l("emit readable"),e.emit("readable"),m(e)}function m(e){var t=e._readableState;if(l("flow",t.flowing),t.flowing)do{var n=e.read()}while(null!==n&&t.flowing)}function _(e,t){var n,r=t.buffer,a=t.length,o=!!t.decoder,s=!!t.objectMode;if(0===r.length)return null;if(0===a)n=null;else if(s)n=r.shift();else if(!e||e>=a)n=o?r.join(""):i.concat(r,a),r.length=0;else{if(e0)throw new Error("endReadable called on non-empty stream");t.endEmitted||(t.ended=!0,n.nextTick(function(){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}))}f.prototype.read=function(e){l("read",e);var t=this._readableState,n=e;if((!u.isNumber(e)||e>0)&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return l("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?w(this):g(this),null;if(0===(e=d(e,t))&&t.ended)return 0===t.length&&w(this),null;var r,i=t.needReadable;return l("need readable",i),(0===t.length||t.length-e0?_(e,t):null,u.isNull(r)&&(t.needReadable=!0,e=0),t.length-=e,0!==t.length||t.ended||(t.needReadable=!0),n!==e&&t.ended&&0===t.length&&w(this),u.isNull(r)||this.emit("data",r),r},f.prototype._read=function(e){this.emit("error",new Error("not implemented"))},f.prototype.pipe=function(e,t){var i=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,l("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?c:h;function u(e){l("onunpipe"),e===i&&h()}function c(){l("onend"),e.end()}o.endEmitted?n.nextTick(s):i.once("end",s),e.on("unpipe",u);var f=function(e){return function(){var t=e._readableState;l("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&a.listenerCount(e,"data")&&(t.flowing=!0,m(e))}}(i);function h(){l("cleanup"),e.removeListener("close",g),e.removeListener("finish",v),e.removeListener("drain",f),e.removeListener("error",d),e.removeListener("unpipe",u),i.removeListener("end",c),i.removeListener("end",h),i.removeListener("data",p),!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f()}function p(t){l("ondata"),!1===e.write(t)&&(l("false write response, pause",i._readableState.awaitDrain),i._readableState.awaitDrain++,i.pause())}function d(t){l("onerror",t),_(),e.removeListener("error",d),0===a.listenerCount(e,"error")&&e.emit("error",t)}function g(){e.removeListener("finish",v),_()}function v(){l("onfinish"),e.removeListener("close",g),_()}function _(){l("unpipe"),i.unpipe(e)}return e.on("drain",f),i.on("data",p),e._events&&e._events.error?r(e._events.error)?e._events.error.unshift(d):e._events.error=[d,e._events.error]:e.on("error",d),e.once("close",g),e.once("finish",v),e.emit("pipe",i),o.flowing||(l("pipe resume"),i.resume()),e},f.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i1){for(var n=[],r=0;r=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived=55296&&i<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var r=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,r),r-=this.charReceived);var i;r=(t+=e.toString(this.encoding,0,r)).length-1;if((i=t.charCodeAt(r))>=55296&&i<=56319){var a=this.surrogateSize;return this.charLength+=a,this.charReceived+=a,this.charBuffer.copy(this.charBuffer,a,0,a),e.copy(this.charBuffer,0,0,a),t.substring(0,r)}return t},a.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(t<=2&&n>>4==14){this.charLength=3;break}if(t<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=t},a.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;t+=r.slice(0,n).toString(i)}return t}},{buffer:4}],36:[function(e,t,n){(function(n){"use strict";function r(e,t){if(e===t)return 0;for(var n=e.length,r=t.length,i=0,a=Math.min(n,r);i=0;l--)if(c[l]!==f[l])return!1;for(l=c.length-1;l>=0;l--)if(u=c[l],!_(e[u],t[u],n,r))return!1;return!0}(e,t,n,o))}return n?e===t:e==t}function w(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function b(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function y(e,t,n,r){var i;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof n&&(r=n,n=null),i=function(e){var t;try{e()}catch(e){t=e}return t}(t),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),e&&!i&&v(i,n,"Missing expected exception"+r);var o="string"==typeof r,s=!e&&i&&!n;if((!e&&a.isError(i)&&o&&b(i,n)||s)&&v(i,n,"Got unwanted exception"+r),e&&i&&n&&!b(i,n)||!e&&i)throw i}f.AssertionError=function(e){var t;this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=d(g((t=this).actual),128)+" "+t.operator+" "+d(g(t.expected),128),this.generatedMessage=!0);var n=e.stackStartFunction||v;if(Error.captureStackTrace)Error.captureStackTrace(this,n);else{var r=new Error;if(r.stack){var i=r.stack,a=p(n),o=i.indexOf("\n"+a);if(o>=0){var s=i.indexOf("\n",o+1);i=i.substring(s+1)}this.stack=i}}},a.inherits(f.AssertionError,Error),f.fail=v,f.ok=m,f.equal=function(e,t,n){e!=t&&v(e,t,n,"==",f.equal)},f.notEqual=function(e,t,n){e==t&&v(e,t,n,"!=",f.notEqual)},f.deepEqual=function(e,t,n){_(e,t,!1)||v(e,t,n,"deepEqual",f.deepEqual)},f.deepStrictEqual=function(e,t,n){_(e,t,!0)||v(e,t,n,"deepStrictEqual",f.deepStrictEqual)},f.notDeepEqual=function(e,t,n){_(e,t,!1)&&v(e,t,n,"notDeepEqual",f.notDeepEqual)},f.notDeepStrictEqual=function e(t,n,r){_(t,n,!0)&&v(t,n,r,"notDeepStrictEqual",e)},f.strictEqual=function(e,t,n){e!==t&&v(e,t,n,"===",f.strictEqual)},f.notStrictEqual=function(e,t,n){e===t&&v(e,t,n,"!==",f.notStrictEqual)},f.throws=function(e,t,n){y(!0,e,t,n)},f.doesNotThrow=function(e,t,n){y(!1,e,t,n)},f.ifError=function(e){if(e)throw e};var x=Object.keys||function(e){var t=[];for(var n in e)o.call(e,n)&&t.push(n);return t}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"util/":39}],37:[function(e,t,n){"function"==typeof Object.create?t.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},{}],38:[function(e,t,n){t.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},{}],39:[function(e,t,n){(function(t,r){var i=/%[sdj%]/g;n.format=function(e){if(!m(e)){for(var t=[],n=0;n=a)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}}),u=r[n];n=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),d(t)?r.showHidden=t:t&&n._extend(r,t),_(r.showHidden)&&(r.showHidden=!1),_(r.depth)&&(r.depth=2),_(r.colors)&&(r.colors=!1),_(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=u),c(r,e,r.depth)}function u(e,t){var n=s.styles[t];return n?"["+s.colors[n][0]+"m"+e+"["+s.colors[n][1]+"m":e}function l(e,t){return e}function c(e,t,r){if(e.customInspect&&t&&k(t.inspect)&&t.inspect!==n.inspect&&(!t.constructor||t.constructor.prototype!==t)){var i=t.inspect(r,e);return m(i)||(i=c(e,i,r)),i}var a=function(e,t){if(_(t))return e.stylize("undefined","undefined");if(m(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(v(t))return e.stylize(""+t,"number");if(d(t))return e.stylize(""+t,"boolean");if(g(t))return e.stylize("null","null")}(e,t);if(a)return a;var o=Object.keys(t),s=function(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(t)),x(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return f(t);if(0===o.length){if(k(t)){var u=t.name?": "+t.name:"";return e.stylize("[Function"+u+"]","special")}if(w(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(y(t))return e.stylize(Date.prototype.toString.call(t),"date");if(x(t))return f(t)}var l,b="",E=!1,S=["{","}"];(p(t)&&(E=!0,S=["[","]"]),k(t))&&(b=" [Function"+(t.name?": "+t.name:"")+"]");return w(t)&&(b=" "+RegExp.prototype.toString.call(t)),y(t)&&(b=" "+Date.prototype.toUTCString.call(t)),x(t)&&(b=" "+f(t)),0!==o.length||E&&0!=t.length?r<0?w(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),l=E?function(e,t,n,r,i){for(var a=[],o=0,s=t.length;o=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1];return n[0]+t+" "+e.join(", ")+" "+n[1]}(l,b,S)):S[0]+b+S[1]}function f(e){return"["+Error.prototype.toString.call(e)+"]"}function h(e,t,n,r,i,a){var o,s,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?s=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(s=e.stylize("[Setter]","special")),T(r,i)||(o="["+i+"]"),s||(e.seen.indexOf(u.value)<0?(s=g(n)?c(e,u.value,null):c(e,u.value,n-1)).indexOf("\n")>-1&&(s=a?s.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+s.split("\n").map(function(e){return" "+e}).join("\n")):s=e.stylize("[Circular]","special")),_(o)){if(a&&i.match(/^\d+$/))return s;(o=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+s}function p(e){return Array.isArray(e)}function d(e){return"boolean"==typeof e}function g(e){return null===e}function v(e){return"number"==typeof e}function m(e){return"string"==typeof e}function _(e){return void 0===e}function w(e){return b(e)&&"[object RegExp]"===E(e)}function b(e){return"object"==typeof e&&null!==e}function y(e){return b(e)&&"[object Date]"===E(e)}function x(e){return b(e)&&("[object Error]"===E(e)||e instanceof Error)}function k(e){return"function"==typeof e}function E(e){return Object.prototype.toString.call(e)}function S(e){return e<10?"0"+e.toString(10):e.toString(10)}n.debuglog=function(e){if(_(a)&&(a=t.env.NODE_DEBUG||""),e=e.toUpperCase(),!o[e])if(new RegExp("\\b"+e+"\\b","i").test(a)){var r=t.pid;o[e]=function(){var t=n.format.apply(n,arguments);console.error("%s %d: %s",e,r,t)}}else o[e]=function(){};return o[e]},n.inspect=s,s.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},s.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},n.isArray=p,n.isBoolean=d,n.isNull=g,n.isNullOrUndefined=function(e){return null==e},n.isNumber=v,n.isString=m,n.isSymbol=function(e){return"symbol"==typeof e},n.isUndefined=_,n.isRegExp=w,n.isObject=b,n.isDate=y,n.isError=x,n.isFunction=k,n.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},n.isBuffer=e("./support/isBuffer");var A=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function T(e,t){return Object.prototype.hasOwnProperty.call(e,t)}n.log=function(){var e,t;console.log("%s - %s",(e=new Date,t=[S(e.getHours()),S(e.getMinutes()),S(e.getSeconds())].join(":"),[e.getDate(),A[e.getMonth()],t].join(" ")),n.format.apply(n,arguments))},n.inherits=e("inherits"),n._extend=function(e,t){if(!t||!b(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":38,_process:98,inherits:37}],40:[function(e,t,n){(function(t,r){"use strict";var i=e("assert"),a=e("pako/lib/zlib/zstream"),o=e("pako/lib/zlib/deflate.js"),s=e("pako/lib/zlib/inflate.js"),u=e("pako/lib/zlib/constants");for(var l in u)n[l]=u[l];n.NONE=0,n.DEFLATE=1,n.INFLATE=2,n.GZIP=3,n.GUNZIP=4,n.DEFLATERAW=5,n.INFLATERAW=6,n.UNZIP=7;function c(e){if("number"!=typeof e||en.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=e,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}c.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,i(this.init_done,"close before init"),i(this.mode<=n.UNZIP),this.mode===n.DEFLATE||this.mode===n.GZIP||this.mode===n.DEFLATERAW?o.deflateEnd(this.strm):this.mode!==n.INFLATE&&this.mode!==n.GUNZIP&&this.mode!==n.INFLATERAW&&this.mode!==n.UNZIP||s.inflateEnd(this.strm),this.mode=n.NONE,this.dictionary=null)},c.prototype.write=function(e,t,n,r,i,a,o){return this._write(!0,e,t,n,r,i,a,o)},c.prototype.writeSync=function(e,t,n,r,i,a,o){return this._write(!1,e,t,n,r,i,a,o)},c.prototype._write=function(e,a,o,s,u,l,c,f){if(i.equal(arguments.length,8),i(this.init_done,"write before init"),i(this.mode!==n.NONE,"already finalized"),i.equal(!1,this.write_in_progress,"write already in progress"),i.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,i.equal(!1,void 0===a,"must provide flush value"),this.write_in_progress=!0,a!==n.Z_NO_FLUSH&&a!==n.Z_PARTIAL_FLUSH&&a!==n.Z_SYNC_FLUSH&&a!==n.Z_FULL_FLUSH&&a!==n.Z_FINISH&&a!==n.Z_BLOCK)throw new Error("Invalid flush value");if(null==o&&(o=r.alloc(0),u=0,s=0),this.strm.avail_in=u,this.strm.input=o,this.strm.next_in=s,this.strm.avail_out=f,this.strm.output=l,this.strm.next_out=c,this.flush=a,!e)return this._process(),this._checkError()?this._afterSync():void 0;var h=this;return t.nextTick(function(){h._process(),h._after()}),this},c.prototype._afterSync=function(){var e=this.strm.avail_out,t=this.strm.avail_in;return this.write_in_progress=!1,[t,e]},c.prototype._process=function(){var e=null;switch(this.mode){case n.DEFLATE:case n.GZIP:case n.DEFLATERAW:this.err=o.deflate(this.strm,this.flush);break;case n.UNZIP:switch(this.strm.avail_in>0&&(e=this.strm.next_in),this.gzip_id_bytes_read){case 0:if(null===e)break;if(31!==this.strm.input[e]){this.mode=n.INFLATE;break}if(this.gzip_id_bytes_read=1,e++,1===this.strm.avail_in)break;case 1:if(null===e)break;139===this.strm.input[e]?(this.gzip_id_bytes_read=2,this.mode=n.GUNZIP):this.mode=n.INFLATE;break;default:throw new Error("invalid number of gzip magic number bytes read")}case n.INFLATE:case n.GUNZIP:case n.INFLATERAW:for(this.err=s.inflate(this.strm,this.flush),this.err===n.Z_NEED_DICT&&this.dictionary&&(this.err=s.inflateSetDictionary(this.strm,this.dictionary),this.err===n.Z_OK?this.err=s.inflate(this.strm,this.flush):this.err===n.Z_DATA_ERROR&&(this.err=n.Z_NEED_DICT));this.strm.avail_in>0&&this.mode===n.GUNZIP&&this.err===n.Z_STREAM_END&&0!==this.strm.next_in[0];)this.reset(),this.err=s.inflate(this.strm,this.flush);break;default:throw new Error("Unknown mode "+this.mode)}},c.prototype._checkError=function(){switch(this.err){case n.Z_OK:case n.Z_BUF_ERROR:if(0!==this.strm.avail_out&&this.flush===n.Z_FINISH)return this._error("unexpected end of file"),!1;break;case n.Z_STREAM_END:break;case n.Z_NEED_DICT:return null==this.dictionary?this._error("Missing dictionary"):this._error("Bad dictionary"),!1;default:return this._error("Zlib error"),!1}return!0},c.prototype._after=function(){if(this._checkError()){var e=this.strm.avail_out,t=this.strm.avail_in;this.write_in_progress=!1,this.callback(t,e),this.pending_close&&this.close()}},c.prototype._error=function(e){this.strm.msg&&(e=this.strm.msg),this.onerror(e,this.err),this.write_in_progress=!1,this.pending_close&&this.close()},c.prototype.init=function(e,t,r,a,o){i(4===arguments.length||5===arguments.length,"init(windowBits, level, memLevel, strategy, [dictionary])"),i(e>=8&&e<=15,"invalid windowBits"),i(t>=-1&&t<=9,"invalid compression level"),i(r>=1&&r<=9,"invalid memlevel"),i(a===n.Z_FILTERED||a===n.Z_HUFFMAN_ONLY||a===n.Z_RLE||a===n.Z_FIXED||a===n.Z_DEFAULT_STRATEGY,"invalid strategy"),this._init(t,e,r,a,o),this._setDictionary()},c.prototype.params=function(){throw new Error("deflateParams Not supported")},c.prototype.reset=function(){this._reset(),this._setDictionary()},c.prototype._init=function(e,t,r,i,u){switch(this.level=e,this.windowBits=t,this.memLevel=r,this.strategy=i,this.flush=n.Z_NO_FLUSH,this.err=n.Z_OK,this.mode!==n.GZIP&&this.mode!==n.GUNZIP||(this.windowBits+=16),this.mode===n.UNZIP&&(this.windowBits+=32),this.mode!==n.DEFLATERAW&&this.mode!==n.INFLATERAW||(this.windowBits=-1*this.windowBits),this.strm=new a,this.mode){case n.DEFLATE:case n.GZIP:case n.DEFLATERAW:this.err=o.deflateInit2(this.strm,this.level,n.Z_DEFLATED,this.windowBits,this.memLevel,this.strategy);break;case n.INFLATE:case n.GUNZIP:case n.INFLATERAW:case n.UNZIP:this.err=s.inflateInit2(this.strm,this.windowBits);break;default:throw new Error("Unknown mode "+this.mode)}this.err!==n.Z_OK&&this._error("Init error"),this.dictionary=u,this.write_in_progress=!1,this.init_done=!0},c.prototype._setDictionary=function(){if(null!=this.dictionary){switch(this.err=n.Z_OK,this.mode){case n.DEFLATE:case n.DEFLATERAW:this.err=o.deflateSetDictionary(this.strm,this.dictionary)}this.err!==n.Z_OK&&this._error("Failed to set dictionary")}},c.prototype._reset=function(){switch(this.err=n.Z_OK,this.mode){case n.DEFLATE:case n.DEFLATERAW:case n.GZIP:this.err=o.deflateReset(this.strm);break;case n.INFLATE:case n.INFLATERAW:case n.GUNZIP:this.err=s.inflateReset(this.strm)}this.err!==n.Z_OK&&this._error("Failed to reset stream")},n.Zlib=c}).call(this,e("_process"),e("buffer").Buffer)},{_process:98,assert:36,buffer:4,"pako/lib/zlib/constants":46,"pako/lib/zlib/deflate.js":48,"pako/lib/zlib/inflate.js":50,"pako/lib/zlib/zstream":54}],41:[function(e,t,n){(function(t){"use strict";var r=e("buffer").Buffer,i=e("stream").Transform,a=e("./binding"),o=e("util"),s=e("assert").ok,u=e("buffer").kMaxLength,l="Cannot create final Buffer. It would be larger than 0x"+u.toString(16)+" bytes";a.Z_MIN_WINDOWBITS=8,a.Z_MAX_WINDOWBITS=15,a.Z_DEFAULT_WINDOWBITS=15,a.Z_MIN_CHUNK=64,a.Z_MAX_CHUNK=1/0,a.Z_DEFAULT_CHUNK=16384,a.Z_MIN_MEMLEVEL=1,a.Z_MAX_MEMLEVEL=9,a.Z_DEFAULT_MEMLEVEL=8,a.Z_MIN_LEVEL=-1,a.Z_MAX_LEVEL=9,a.Z_DEFAULT_LEVEL=a.Z_DEFAULT_COMPRESSION;for(var c=Object.keys(a),f=0;f=u?o=new RangeError(l):t=r.concat(i,a),i=[],e.close(),n(o,t)}e.on("error",function(t){e.removeListener("end",s),e.removeListener("readable",o),n(t)}),e.on("end",s),e.end(t),o()}function _(e,t){if("string"==typeof t&&(t=r.from(t)),!r.isBuffer(t))throw new TypeError("Not a string or buffer");var n=e._finishFlushFlag;return e._processChunk(t,n)}function w(e){if(!(this instanceof w))return new w(e);T.call(this,e,a.DEFLATE)}function b(e){if(!(this instanceof b))return new b(e);T.call(this,e,a.INFLATE)}function y(e){if(!(this instanceof y))return new y(e);T.call(this,e,a.GZIP)}function x(e){if(!(this instanceof x))return new x(e);T.call(this,e,a.GUNZIP)}function k(e){if(!(this instanceof k))return new k(e);T.call(this,e,a.DEFLATERAW)}function E(e){if(!(this instanceof E))return new E(e);T.call(this,e,a.INFLATERAW)}function S(e){if(!(this instanceof S))return new S(e);T.call(this,e,a.UNZIP)}function A(e){return e===a.Z_NO_FLUSH||e===a.Z_PARTIAL_FLUSH||e===a.Z_SYNC_FLUSH||e===a.Z_FULL_FLUSH||e===a.Z_FINISH||e===a.Z_BLOCK}function T(e,t){var o=this;if(this._opts=e=e||{},this._chunkSize=e.chunkSize||n.Z_DEFAULT_CHUNK,i.call(this,e),e.flush&&!A(e.flush))throw new Error("Invalid flush flag: "+e.flush);if(e.finishFlush&&!A(e.finishFlush))throw new Error("Invalid flush flag: "+e.finishFlush);if(this._flushFlag=e.flush||a.Z_NO_FLUSH,this._finishFlushFlag=void 0!==e.finishFlush?e.finishFlush:a.Z_FINISH,e.chunkSize&&(e.chunkSizen.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitsn.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.leveln.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLeveln.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=n.Z_FILTERED&&e.strategy!=n.Z_HUFFMAN_ONLY&&e.strategy!=n.Z_RLE&&e.strategy!=n.Z_FIXED&&e.strategy!=n.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!r.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new a.Zlib(t);var s=this;this._hadError=!1,this._handle.onerror=function(e,t){M(s),s._hadError=!0;var r=new Error(e);r.errno=t,r.code=n.codes[t],s.emit("error",r)};var u=n.Z_DEFAULT_COMPRESSION;"number"==typeof e.level&&(u=e.level);var l=n.Z_DEFAULT_STRATEGY;"number"==typeof e.strategy&&(l=e.strategy),this._handle.init(e.windowBits||n.Z_DEFAULT_WINDOWBITS,u,e.memLevel||n.Z_DEFAULT_MEMLEVEL,l,e.dictionary),this._buffer=r.allocUnsafe(this._chunkSize),this._offset=0,this._level=u,this._strategy=l,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!o._handle},configurable:!0,enumerable:!0})}function M(e,n){n&&t.nextTick(n),e._handle&&(e._handle.close(),e._handle=null)}function I(e){e.emit("close")}Object.defineProperty(n,"codes",{enumerable:!0,value:Object.freeze(p),writable:!1}),n.Deflate=w,n.Inflate=b,n.Gzip=y,n.Gunzip=x,n.DeflateRaw=k,n.InflateRaw=E,n.Unzip=S,n.createDeflate=function(e){return new w(e)},n.createInflate=function(e){return new b(e)},n.createDeflateRaw=function(e){return new k(e)},n.createInflateRaw=function(e){return new E(e)},n.createGzip=function(e){return new y(e)},n.createGunzip=function(e){return new x(e)},n.createUnzip=function(e){return new S(e)},n.deflate=function(e,t,n){return"function"==typeof t&&(n=t,t={}),m(new w(t),e,n)},n.deflateSync=function(e,t){return _(new w(t),e)},n.gzip=function(e,t,n){return"function"==typeof t&&(n=t,t={}),m(new y(t),e,n)},n.gzipSync=function(e,t){return _(new y(t),e)},n.deflateRaw=function(e,t,n){return"function"==typeof t&&(n=t,t={}),m(new k(t),e,n)},n.deflateRawSync=function(e,t){return _(new k(t),e)},n.unzip=function(e,t,n){return"function"==typeof t&&(n=t,t={}),m(new S(t),e,n)},n.unzipSync=function(e,t){return _(new S(t),e)},n.inflate=function(e,t,n){return"function"==typeof t&&(n=t,t={}),m(new b(t),e,n)},n.inflateSync=function(e,t){return _(new b(t),e)},n.gunzip=function(e,t,n){return"function"==typeof t&&(n=t,t={}),m(new x(t),e,n)},n.gunzipSync=function(e,t){return _(new x(t),e)},n.inflateRaw=function(e,t,n){return"function"==typeof t&&(n=t,t={}),m(new E(t),e,n)},n.inflateRawSync=function(e,t){return _(new E(t),e)},o.inherits(T,i),T.prototype.params=function(e,r,i){if(en.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(r!=n.Z_FILTERED&&r!=n.Z_HUFFMAN_ONLY&&r!=n.Z_RLE&&r!=n.Z_FIXED&&r!=n.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+r);if(this._level!==e||this._strategy!==r){var o=this;this.flush(a.Z_SYNC_FLUSH,function(){s(o._handle,"zlib binding closed"),o._handle.params(e,r),o._hadError||(o._level=e,o._strategy=r,i&&i())})}else t.nextTick(i)},T.prototype.reset=function(){return s(this._handle,"zlib binding closed"),this._handle.reset()},T.prototype._flush=function(e){this._transform(r.alloc(0),"",e)},T.prototype.flush=function(e,n){var i=this,o=this._writableState;("function"==typeof e||void 0===e&&!n)&&(n=e,e=a.Z_FULL_FLUSH),o.ended?n&&t.nextTick(n):o.ending?n&&this.once("end",n):o.needDrain?n&&this.once("drain",function(){return i.flush(e,n)}):(this._flushFlag=e,this.write(r.alloc(0),"",n))},T.prototype.close=function(e){M(this,e),t.nextTick(I,this)},T.prototype._transform=function(e,t,n){var i,o=this._writableState,s=(o.ending||o.ended)&&(!e||o.length===e.length);return null===e||r.isBuffer(e)?this._handle?(s?i=this._finishFlushFlag:(i=this._flushFlag,e.length>=o.length&&(this._flushFlag=this._opts.flush||a.Z_NO_FLUSH)),void this._processChunk(e,i,n)):n(new Error("zlib binding closed")):n(new Error("invalid input"))},T.prototype._processChunk=function(e,t,n){var i=e&&e.length,a=this._chunkSize-this._offset,o=0,c=this,f="function"==typeof n;if(!f){var h,p=[],d=0;this.on("error",function(e){h=e}),s(this._handle,"zlib binding closed");do{var g=this._handle.writeSync(t,e,o,i,this._buffer,this._offset,a)}while(!this._hadError&&_(g[0],g[1]));if(this._hadError)throw h;if(d>=u)throw M(this),new RangeError(l);var v=r.concat(p,d);return M(this),v}s(this._handle,"zlib binding closed");var m=this._handle.write(t,e,o,i,this._buffer,this._offset,a);function _(u,l){if(this&&(this.buffer=null,this.callback=null),!c._hadError){var h=a-l;if(s(h>=0,"have should not go down"),h>0){var g=c._buffer.slice(c._offset,c._offset+h);c._offset+=h,f?c.push(g):(p.push(g),d+=g.length)}if((0===l||c._offset>=c._chunkSize)&&(a=c._chunkSize,c._offset=0,c._buffer=r.allocUnsafe(c._chunkSize)),0===l){if(o+=i-u,i=u,!f)return!0;var v=c._handle.write(t,e,o,i,c._buffer,c._offset,c._chunkSize);return v.callback=_,void(v.buffer=e)}if(!f)return!1;n()}}m.buffer=e,m.callback=_},o.inherits(w,T),o.inherits(b,T),o.inherits(y,T),o.inherits(x,T),o.inherits(k,T),o.inherits(E,T),o.inherits(S,T)}).call(this,e("_process"))},{"./binding":40,_process:98,assert:36,buffer:4,stream:112,util:135}],42:[function(e,t,n){arguments[4][3][0].apply(n,arguments)},{dup:3}],43:[function(e,t,n){var r=Object.create||function(e){var t=function(){};return t.prototype=e,new t},i=Object.keys||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return n},a=Function.prototype.bind||function(e){var t=this;return function(){return t.apply(e,arguments)}};function o(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=r(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}t.exports=o,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._maxListeners=void 0;var s,u=10;try{var l={};Object.defineProperty&&Object.defineProperty(l,"x",{value:0}),s=0===l.x}catch(e){s=!1}function c(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function f(e,t,n,i){var a,o,s;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if((o=e._events)?(o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),s=o[t]):(o=e._events=r(null),e._eventsCount=0),s){if("function"==typeof s?s=o[t]=i?[n,s]:[s,n]:i?s.unshift(n):s.push(n),!s.warned&&(a=c(e))&&a>0&&s.length>a){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+' "'+String(t)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=s.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",u.name,u.message)}}else s=o[t]=n,++e._eventsCount;return e}function h(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var e=new Array(arguments.length),t=0;t1&&(t=arguments[1]),t instanceof Error)throw t;var u=new Error('Unhandled "error" event. ('+t+")");throw u.context=t,u}if(!(n=o[e]))return!1;var l="function"==typeof n;switch(r=arguments.length){case 1:!function(e,t,n){if(t)e.call(n);else for(var r=e.length,i=v(e,r),a=0;a=0;o--)if(n[o]===t||n[o].listener===t){s=n[o].listener,a=o;break}if(a<0)return this;0===a?n.shift():function(e,t){for(var n=t,r=n+1,i=e.length;r=0;a--)this.removeListener(e,t[a]);return this},o.prototype.listeners=function(e){return d(this,e,!0)},o.prototype.rawListeners=function(e){return d(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):g.call(e,t)},o.prototype.listenerCount=g,o.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],44:[function(e,t,n){"use strict";var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}n.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var r in n)i(n,r)&&(e[r]=n[r])}}return e},n.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var a={arraySet:function(e,t,n,r,i){if(t.subarray&&e.subarray)e.set(t.subarray(n,n+r),i);else for(var a=0;a>>16&65535|0,o=0;0!==n;){n-=o=n>2e3?2e3:n;do{a=a+(i=i+t[r++]|0)|0}while(--o);i%=65521,a%=65521}return i|a<<16|0}},{}],46:[function(e,t,n){"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],47:[function(e,t,n){"use strict";var r=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t,n,i){var a=r,o=i+n;e^=-1;for(var s=i;s>>8^a[255&(e^t[s])];return-1^e}},{}],48:[function(e,t,n){"use strict";var r,i=e("../utils/common"),a=e("./trees"),o=e("./adler32"),s=e("./crc32"),u=e("./messages"),l=0,c=1,f=3,h=4,p=5,d=0,g=1,v=-2,m=-3,_=-5,w=-1,b=1,y=2,x=3,k=4,E=0,S=2,A=8,T=9,M=15,I=8,j=286,R=30,L=19,B=2*j+1,C=15,O=3,z=258,D=z+O+1,F=32,N=42,P=69,U=73,q=91,V=103,Z=113,W=666,G=1,H=2,Y=3,$=4,X=3;function J(e,t){return e.msg=u[t],t}function K(e){return(e<<1)-(e>4?9:0)}function Q(e){for(var t=e.length;--t>=0;)e[t]=0}function ee(e){var t=e.state,n=t.pending;n>e.avail_out&&(n=e.avail_out),0!==n&&(i.arraySet(e.output,t.pending_buf,t.pending_out,n,e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))}function te(e,t){a._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,ee(e.strm)}function ne(e,t){e.pending_buf[e.pending++]=t}function re(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function ie(e,t){var n,r,i=e.max_chain_length,a=e.strstart,o=e.prev_length,s=e.nice_match,u=e.strstart>e.w_size-D?e.strstart-(e.w_size-D):0,l=e.window,c=e.w_mask,f=e.prev,h=e.strstart+z,p=l[a+o-1],d=l[a+o];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do{if(l[(n=t)+o]===d&&l[n+o-1]===p&&l[n]===l[a]&&l[++n]===l[a+1]){a+=2,n++;do{}while(l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&ao){if(e.match_start=t,o=r,r>=s)break;p=l[a+o-1],d=l[a+o]}}}while((t=f[t&c])>u&&0!=--i);return o<=e.lookahead?o:e.lookahead}function ae(e){var t,n,r,a,u,l,c,f,h,p,d=e.w_size;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=d+(d-D)){i.arraySet(e.window,e.window,d,d,0),e.match_start-=d,e.strstart-=d,e.block_start-=d,t=n=e.hash_size;do{r=e.head[--t],e.head[t]=r>=d?r-d:0}while(--n);t=n=d;do{r=e.prev[--t],e.prev[t]=r>=d?r-d:0}while(--n);a+=d}if(0===e.strm.avail_in)break;if(l=e.strm,c=e.window,f=e.strstart+e.lookahead,h=a,p=void 0,(p=l.avail_in)>h&&(p=h),n=0===p?0:(l.avail_in-=p,i.arraySet(c,l.input,l.next_in,p,f),1===l.state.wrap?l.adler=o(l.adler,c,p,f):2===l.state.wrap&&(l.adler=s(l.adler,c,p,f)),l.next_in+=p,l.total_in+=p,p),e.lookahead+=n,e.lookahead+e.insert>=O)for(u=e.strstart-e.insert,e.ins_h=e.window[u],e.ins_h=(e.ins_h<=O&&(e.ins_h=(e.ins_h<=O)if(r=a._tr_tally(e,e.strstart-e.match_start,e.match_length-O),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=O){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<=O&&(e.ins_h=(e.ins_h<4096)&&(e.match_length=O-1)),e.prev_length>=O&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-O,r=a._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-O),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=i&&(e.ins_h=(e.ins_h<15&&(s=2,r-=16),a<1||a>T||n!==A||r<8||r>15||t<0||t>9||o<0||o>k)return J(e,v);8===r&&(r=9);var u=new function(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=A,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new i.Buf16(2*B),this.dyn_dtree=new i.Buf16(2*(2*R+1)),this.bl_tree=new i.Buf16(2*(2*L+1)),Q(this.dyn_ltree),Q(this.dyn_dtree),Q(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(C+1),this.heap=new i.Buf16(2*j+1),Q(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(2*j+1),Q(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0};return e.state=u,u.strm=e,u.wrap=s,u.gzhead=null,u.w_bits=r,u.w_size=1<e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(ae(e),0===e.lookahead&&t===l)return G;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+n;if((0===e.strstart||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,te(e,!1),0===e.strm.avail_out))return G;if(e.strstart-e.block_start>=e.w_size-D&&(te(e,!1),0===e.strm.avail_out))return G}return e.insert=0,t===h?(te(e,!0),0===e.strm.avail_out?Y:$):(e.strstart>e.block_start&&(te(e,!1),e.strm.avail_out),G)}),new ue(4,4,8,4,oe),new ue(4,5,16,8,oe),new ue(4,6,32,32,oe),new ue(4,4,16,16,se),new ue(8,16,32,32,se),new ue(8,16,128,128,se),new ue(8,32,128,256,se),new ue(32,128,258,1024,se),new ue(32,258,258,4096,se)],n.deflateInit=function(e,t){return fe(e,t,A,M,I,E)},n.deflateInit2=fe,n.deflateReset=ce,n.deflateResetKeep=le,n.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?v:(e.state.gzhead=t,d):v},n.deflate=function(e,t){var n,i,o,u;if(!e||!e.state||t>p||t<0)return e?J(e,v):v;if(i=e.state,!e.output||!e.input&&0!==e.avail_in||i.status===W&&t!==h)return J(e,0===e.avail_out?_:v);if(i.strm=e,n=i.last_flush,i.last_flush=t,i.status===N)if(2===i.wrap)e.adler=0,ne(i,31),ne(i,139),ne(i,8),i.gzhead?(ne(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),ne(i,255&i.gzhead.time),ne(i,i.gzhead.time>>8&255),ne(i,i.gzhead.time>>16&255),ne(i,i.gzhead.time>>24&255),ne(i,9===i.level?2:i.strategy>=y||i.level<2?4:0),ne(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(ne(i,255&i.gzhead.extra.length),ne(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=s(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=P):(ne(i,0),ne(i,0),ne(i,0),ne(i,0),ne(i,0),ne(i,9===i.level?2:i.strategy>=y||i.level<2?4:0),ne(i,X),i.status=Z);else{var m=A+(i.w_bits-8<<4)<<8;m|=(i.strategy>=y||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(m|=F),m+=31-m%31,i.status=Z,re(i,m),0!==i.strstart&&(re(i,e.adler>>>16),re(i,65535&e.adler)),e.adler=1}if(i.status===P)if(i.gzhead.extra){for(o=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),ee(e),o=i.pending,i.pending!==i.pending_buf_size));)ne(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=U)}else i.status=U;if(i.status===U)if(i.gzhead.name){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),ee(e),o=i.pending,i.pending===i.pending_buf_size)){u=1;break}u=i.gzindexo&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),0===u&&(i.gzindex=0,i.status=q)}else i.status=q;if(i.status===q)if(i.gzhead.comment){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),ee(e),o=i.pending,i.pending===i.pending_buf_size)){u=1;break}u=i.gzindexo&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),0===u&&(i.status=V)}else i.status=V;if(i.status===V&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&ee(e),i.pending+2<=i.pending_buf_size&&(ne(i,255&e.adler),ne(i,e.adler>>8&255),e.adler=0,i.status=Z)):i.status=Z),0!==i.pending){if(ee(e),0===e.avail_out)return i.last_flush=-1,d}else if(0===e.avail_in&&K(t)<=K(n)&&t!==h)return J(e,_);if(i.status===W&&0!==e.avail_in)return J(e,_);if(0!==e.avail_in||0!==i.lookahead||t!==l&&i.status!==W){var w=i.strategy===y?function(e,t){for(var n;;){if(0===e.lookahead&&(ae(e),0===e.lookahead)){if(t===l)return G;break}if(e.match_length=0,n=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(te(e,!1),0===e.strm.avail_out))return G}return e.insert=0,t===h?(te(e,!0),0===e.strm.avail_out?Y:$):e.last_lit&&(te(e,!1),0===e.strm.avail_out)?G:H}(i,t):i.strategy===x?function(e,t){for(var n,r,i,o,s=e.window;;){if(e.lookahead<=z){if(ae(e),e.lookahead<=z&&t===l)return G;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=O&&e.strstart>0&&(r=s[i=e.strstart-1])===s[++i]&&r===s[++i]&&r===s[++i]){o=e.strstart+z;do{}while(r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&ie.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=O?(n=a._tr_tally(e,1,e.match_length-O),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(te(e,!1),0===e.strm.avail_out))return G}return e.insert=0,t===h?(te(e,!0),0===e.strm.avail_out?Y:$):e.last_lit&&(te(e,!1),0===e.strm.avail_out)?G:H}(i,t):r[i.level].func(i,t);if(w!==Y&&w!==$||(i.status=W),w===G||w===Y)return 0===e.avail_out&&(i.last_flush=-1),d;if(w===H&&(t===c?a._tr_align(i):t!==p&&(a._tr_stored_block(i,0,0,!1),t===f&&(Q(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),ee(e),0===e.avail_out))return i.last_flush=-1,d}return t!==h?d:i.wrap<=0?g:(2===i.wrap?(ne(i,255&e.adler),ne(i,e.adler>>8&255),ne(i,e.adler>>16&255),ne(i,e.adler>>24&255),ne(i,255&e.total_in),ne(i,e.total_in>>8&255),ne(i,e.total_in>>16&255),ne(i,e.total_in>>24&255)):(re(i,e.adler>>>16),re(i,65535&e.adler)),ee(e),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?d:g)},n.deflateEnd=function(e){var t;return e&&e.state?(t=e.state.status)!==N&&t!==P&&t!==U&&t!==q&&t!==V&&t!==Z&&t!==W?J(e,v):(e.state=null,t===Z?J(e,m):d):v},n.deflateSetDictionary=function(e,t){var n,r,a,s,u,l,c,f,h=t.length;if(!e||!e.state)return v;if(2===(s=(n=e.state).wrap)||1===s&&n.status!==N||n.lookahead)return v;for(1===s&&(e.adler=o(e.adler,t,h,0)),n.wrap=0,h>=n.w_size&&(0===s&&(Q(n.head),n.strstart=0,n.block_start=0,n.insert=0),f=new i.Buf8(n.w_size),i.arraySet(f,t,h-n.w_size,n.w_size,0),t=f,h=n.w_size),u=e.avail_in,l=e.next_in,c=e.input,e.avail_in=h,e.next_in=0,e.input=t,ae(n);n.lookahead>=O;){r=n.strstart,a=n.lookahead-(O-1);do{n.ins_h=(n.ins_h<>>=b=w>>>24,d-=b,0===(b=w>>>16&255))A[a++]=65535&w;else{if(!(16&b)){if(0==(64&b)){w=g[(65535&w)+(p&(1<>>=b,d-=b),d<15&&(p+=S[r++]<>>=b=w>>>24,d-=b,!(16&(b=w>>>16&255))){if(0==(64&b)){w=v[(65535&w)+(p&(1<u){e.msg="invalid distance too far back",n.mode=30;break e}if(p>>>=b,d-=b,x>(b=a-o)){if((b=x-b)>c&&n.sane){e.msg="invalid distance too far back",n.mode=30;break e}if(k=0,E=h,0===f){if(k+=l-b,b2;)A[a++]=E[k++],A[a++]=E[k++],A[a++]=E[k++],y-=3;y&&(A[a++]=E[k++],y>1&&(A[a++]=E[k++]))}else{k=a-x;do{A[a++]=A[k++],A[a++]=A[k++],A[a++]=A[k++],y-=3}while(y>2);y&&(A[a++]=A[k++],y>1&&(A[a++]=A[k++]))}break}}break}}while(r>3,p&=(1<<(d-=y<<3))-1,e.next_in=r,e.next_out=a,e.avail_in=r>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function ie(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=x,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new r.Buf32(ee),t.distcode=t.distdyn=new r.Buf32(te),t.sane=1,t.back=-1,d):m}function ae(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,ie(e)):m}function oe(e,t){var n,r;return e&&e.state?(r=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?m:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,ae(e))):m}function se(e,t){var n,i;return e?(i=new function(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0},e.state=i,i.window=null,(n=oe(e,t))!==d&&(e.state=null),n):m}var ue,le,ce=!0;function fe(e){if(ce){var t;for(ue=new r.Buf32(512),le=new r.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(s(l,e.lens,0,288,ue,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;s(c,e.lens,0,32,le,0,e.work,{bits:5}),ce=!1}e.lencode=ue,e.lenbits=9,e.distcode=le,e.distbits=5}function he(e,t,n,i){var a,o=e.state;return null===o.window&&(o.wsize=1<=o.wsize?(r.arraySet(o.window,t,n-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((a=o.wsize-o.wnext)>i&&(a=i),r.arraySet(o.window,t,n-i,a,o.wnext),(i-=a)?(r.arraySet(o.window,t,n-i,i,0),o.wnext=i,o.whave=o.wsize):(o.wnext+=a,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,n.check=a(n.check,Te,2,0),se=0,ue=0,n.mode=k;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&se)<<8)+(se>>8))%31){e.msg="incorrect header check",n.mode=J;break}if((15&se)!==y){e.msg="unknown compression method",n.mode=J;break}if(ue-=4,xe=8+(15&(se>>>=4)),0===n.wbits)n.wbits=xe;else if(xe>n.wbits){e.msg="invalid window size",n.mode=J;break}n.dmax=1<>8&1),512&n.flags&&(Te[0]=255&se,Te[1]=se>>>8&255,n.check=a(n.check,Te,2,0)),se=0,ue=0,n.mode=E;case E:for(;ue<32;){if(0===ae)break e;ae--,se+=ee[ne++]<>>8&255,Te[2]=se>>>16&255,Te[3]=se>>>24&255,n.check=a(n.check,Te,4,0)),se=0,ue=0,n.mode=S;case S:for(;ue<16;){if(0===ae)break e;ae--,se+=ee[ne++]<>8),512&n.flags&&(Te[0]=255&se,Te[1]=se>>>8&255,n.check=a(n.check,Te,2,0)),se=0,ue=0,n.mode=A;case A:if(1024&n.flags){for(;ue<16;){if(0===ae)break e;ae--,se+=ee[ne++]<>>8&255,n.check=a(n.check,Te,2,0)),se=0,ue=0}else n.head&&(n.head.extra=null);n.mode=T;case T:if(1024&n.flags&&((pe=n.length)>ae&&(pe=ae),pe&&(n.head&&(xe=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),r.arraySet(n.head.extra,ee,ne,pe,xe)),512&n.flags&&(n.check=a(n.check,ee,pe,ne)),ae-=pe,ne+=pe,n.length-=pe),n.length))break e;n.length=0,n.mode=M;case M:if(2048&n.flags){if(0===ae)break e;pe=0;do{xe=ee[ne+pe++],n.head&&xe&&n.length<65536&&(n.head.name+=String.fromCharCode(xe))}while(xe&&pe>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=B;break;case R:for(;ue<32;){if(0===ae)break e;ae--,se+=ee[ne++]<>>=7&ue,ue-=7&ue,n.mode=Y;break}for(;ue<3;){if(0===ae)break e;ae--,se+=ee[ne++]<>>=1)){case 0:n.mode=O;break;case 1:if(fe(n),n.mode=U,t===p){se>>>=2,ue-=2;break e}break;case 2:n.mode=F;break;case 3:e.msg="invalid block type",n.mode=J}se>>>=2,ue-=2;break;case O:for(se>>>=7&ue,ue-=7&ue;ue<32;){if(0===ae)break e;ae--,se+=ee[ne++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=J;break}if(n.length=65535&se,se=0,ue=0,n.mode=z,t===p)break e;case z:n.mode=D;case D:if(pe=n.length){if(pe>ae&&(pe=ae),pe>oe&&(pe=oe),0===pe)break e;r.arraySet(te,ee,ne,pe,ie),ae-=pe,ne+=pe,oe-=pe,ie+=pe,n.length-=pe;break}n.mode=B;break;case F:for(;ue<14;){if(0===ae)break e;ae--,se+=ee[ne++]<>>=5,ue-=5,n.ndist=1+(31&se),se>>>=5,ue-=5,n.ncode=4+(15&se),se>>>=4,ue-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=J;break}n.have=0,n.mode=N;case N:for(;n.have>>=3,ue-=3}for(;n.have<19;)n.lens[Me[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,Ee={bits:n.lenbits},ke=s(u,n.lens,0,19,n.lencode,0,n.work,Ee),n.lenbits=Ee.bits,ke){e.msg="invalid code lengths set",n.mode=J;break}n.have=0,n.mode=P;case P:for(;n.have>>16&255,_e=65535&Ae,!((ve=Ae>>>24)<=ue);){if(0===ae)break e;ae--,se+=ee[ne++]<>>=ve,ue-=ve,n.lens[n.have++]=_e;else{if(16===_e){for(Se=ve+2;ue>>=ve,ue-=ve,0===n.have){e.msg="invalid bit length repeat",n.mode=J;break}xe=n.lens[n.have-1],pe=3+(3&se),se>>>=2,ue-=2}else if(17===_e){for(Se=ve+3;ue>>=ve)),se>>>=3,ue-=3}else{for(Se=ve+7;ue>>=ve)),se>>>=7,ue-=7}if(n.have+pe>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=J;break}for(;pe--;)n.lens[n.have++]=xe}}if(n.mode===J)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=J;break}if(n.lenbits=9,Ee={bits:n.lenbits},ke=s(l,n.lens,0,n.nlen,n.lencode,0,n.work,Ee),n.lenbits=Ee.bits,ke){e.msg="invalid literal/lengths set",n.mode=J;break}if(n.distbits=6,n.distcode=n.distdyn,Ee={bits:n.distbits},ke=s(c,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,Ee),n.distbits=Ee.bits,ke){e.msg="invalid distances set",n.mode=J;break}if(n.mode=U,t===p)break e;case U:n.mode=q;case q:if(ae>=6&&oe>=258){e.next_out=ie,e.avail_out=oe,e.next_in=ne,e.avail_in=ae,n.hold=se,n.bits=ue,o(e,ce),ie=e.next_out,te=e.output,oe=e.avail_out,ne=e.next_in,ee=e.input,ae=e.avail_in,se=n.hold,ue=n.bits,n.mode===B&&(n.back=-1);break}for(n.back=0;me=(Ae=n.lencode[se&(1<>>16&255,_e=65535&Ae,!((ve=Ae>>>24)<=ue);){if(0===ae)break e;ae--,se+=ee[ne++]<>we)])>>>16&255,_e=65535&Ae,!(we+(ve=Ae>>>24)<=ue);){if(0===ae)break e;ae--,se+=ee[ne++]<>>=we,ue-=we,n.back+=we}if(se>>>=ve,ue-=ve,n.back+=ve,n.length=_e,0===me){n.mode=H;break}if(32&me){n.back=-1,n.mode=B;break}if(64&me){e.msg="invalid literal/length code",n.mode=J;break}n.extra=15&me,n.mode=V;case V:if(n.extra){for(Se=n.extra;ue>>=n.extra,ue-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=Z;case Z:for(;me=(Ae=n.distcode[se&(1<>>16&255,_e=65535&Ae,!((ve=Ae>>>24)<=ue);){if(0===ae)break e;ae--,se+=ee[ne++]<>we)])>>>16&255,_e=65535&Ae,!(we+(ve=Ae>>>24)<=ue);){if(0===ae)break e;ae--,se+=ee[ne++]<>>=we,ue-=we,n.back+=we}if(se>>>=ve,ue-=ve,n.back+=ve,64&me){e.msg="invalid distance code",n.mode=J;break}n.offset=_e,n.extra=15&me,n.mode=W;case W:if(n.extra){for(Se=n.extra;ue>>=n.extra,ue-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=J;break}n.mode=G;case G:if(0===oe)break e;if(pe=ce-oe,n.offset>pe){if((pe=n.offset-pe)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=J;break}pe>n.wnext?(pe-=n.wnext,de=n.wsize-pe):de=n.wnext-pe,pe>n.length&&(pe=n.length),ge=n.window}else ge=te,de=ie-n.offset,pe=n.length;pe>oe&&(pe=oe),oe-=pe,n.length-=pe;do{te[ie++]=ge[de++]}while(--pe);0===n.length&&(n.mode=q);break;case H:if(0===oe)break e;te[ie++]=n.length,oe--,n.mode=q;break;case Y:if(n.wrap){for(;ue<32;){if(0===ae)break e;ae--,se|=ee[ne++]<=1&&0===O[A];A--);if(T>A&&(T=A),0===A)return l[c++]=20971520,l[c++]=20971520,h.bits=1,0;for(S=1;S0&&(0===e||1!==A))return-1;for(z[1]=0,k=1;k<15;k++)z[k+1]=z[k]+O[k];for(E=0;E852||2===e&&R>592)return 1;for(;;){w=k-I,f[E]<_?(b=0,y=f[E]):f[E]>_?(b=D[F+f[E]],y=B[C+f[E]]):(b=96,y=0),p=1<>I)+(d-=p)]=w<<24|b<<16|y|0}while(0!==d);for(p=1<>=1;if(0!==p?(L&=p-1,L+=p):L=0,E++,0==--O[k]){if(k===A)break;k=t[n+f[E]]}if(k>T&&(L&v)!==g){for(0===I&&(I=T),m+=S,j=1<<(M=k-I);M+I852||2===e&&R>592)return 1;l[g=L&v]=T<<24|M<<16|m-c|0}}return 0!==L&&(l[m+L]=k-I<<24|64<<16|0),h.bits=T,0}},{"../utils/common":44}],52:[function(e,t,n){"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],53:[function(e,t,n){"use strict";var r=e("../utils/common"),i=4,a=0,o=1,s=2;function u(e){for(var t=e.length;--t>=0;)e[t]=0}var l=0,c=1,f=2,h=29,p=256,d=p+1+h,g=30,v=19,m=2*d+1,_=15,w=16,b=7,y=256,x=16,k=17,E=18,S=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],A=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],T=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],M=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],I=new Array(2*(d+2));u(I);var j=new Array(2*g);u(j);var R=new Array(512);u(R);var L=new Array(256);u(L);var B=new Array(h);u(B);var C,O,z,D=new Array(g);function F(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}function N(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function P(e){return e<256?R[e]:R[256+(e>>>7)]}function U(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function q(e,t,n){e.bi_valid>w-n?(e.bi_buf|=t<>w-e.bi_valid,e.bi_valid+=n-w):(e.bi_buf|=t<>>=1,n<<=1}while(--t>0);return n>>>1}function W(e,t,n){var r,i,a=new Array(_+1),o=0;for(r=1;r<=_;r++)a[r]=o=o+n[r-1]<<1;for(i=0;i<=t;i++){var s=e[2*i+1];0!==s&&(e[2*i]=Z(a[s]++,s))}}function G(e){var t;for(t=0;t8?U(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function Y(e,t,n,r){var i=2*t,a=2*n;return e[i]>1;n>=1;n--)$(e,a,n);i=u;do{n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],$(e,a,1),r=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=r,a[2*i]=a[2*n]+a[2*r],e.depth[i]=(e.depth[n]>=e.depth[r]?e.depth[n]:e.depth[r])+1,a[2*n+1]=a[2*r+1]=i,e.heap[1]=i++,$(e,a,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var n,r,i,a,o,s,u=t.dyn_tree,l=t.max_code,c=t.stat_desc.static_tree,f=t.stat_desc.has_stree,h=t.stat_desc.extra_bits,p=t.stat_desc.extra_base,d=t.stat_desc.max_length,g=0;for(a=0;a<=_;a++)e.bl_count[a]=0;for(u[2*e.heap[e.heap_max]+1]=0,n=e.heap_max+1;nd&&(a=d,g++),u[2*r+1]=a,r>l||(e.bl_count[a]++,o=0,r>=p&&(o=h[r-p]),s=u[2*r],e.opt_len+=s*(a+o),f&&(e.static_len+=s*(c[2*r+1]+o)));if(0!==g){do{for(a=d-1;0===e.bl_count[a];)a--;e.bl_count[a]--,e.bl_count[a+1]+=2,e.bl_count[d]--,g-=2}while(g>0);for(a=d;0!==a;a--)for(r=e.bl_count[a];0!==r;)(i=e.heap[--n])>l||(u[2*i+1]!==a&&(e.opt_len+=(a-u[2*i+1])*u[2*i],u[2*i+1]=a),r--)}}(e,t),W(a,l,e.bl_count)}function K(e,t,n){var r,i,a=-1,o=t[1],s=0,u=7,l=4;for(0===o&&(u=138,l=3),t[2*(n+1)+1]=65535,r=0;r<=n;r++)i=o,o=t[2*(r+1)+1],++s>=7;r0?(e.strm.data_type===s&&(e.strm.data_type=function(e){var t,n=4093624447;for(t=0;t<=31;t++,n>>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return a;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return o;for(t=32;t=3&&0===e.bl_tree[2*M[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),u=e.opt_len+3+7>>>3,(l=e.static_len+3+7>>>3)<=u&&(u=l)):u=l=n+5,n+4<=u&&-1!==t?te(e,t,n,r):e.strategy===i||l===u?(q(e,(c<<1)+(r?1:0),3),X(e,I,j)):(q(e,(f<<1)+(r?1:0),3),function(e,t,n,r){var i;for(q(e,t-257,5),q(e,n-1,5),q(e,r-4,4),i=0;i>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&n,e.last_lit++,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(L[n]+p+1)]++,e.dyn_dtree[2*P(t)]++),e.last_lit===e.lit_bufsize-1},n._tr_align=function(e){q(e,c<<1,3),V(e,y,I),function(e){16===e.bi_valid?(U(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":44}],54:[function(e,t,n){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],55:[function(e,t,n){n.read=function(e,t,n,r,i){var a,o,s=8*i-r-1,u=(1<>1,c=-7,f=n?i-1:0,h=n?-1:1,p=e[t+f];for(f+=h,a=p&(1<<-c)-1,p>>=-c,c+=s;c>0;a=256*a+e[t+f],f+=h,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=r;c>0;o=256*o+e[t+f],f+=h,c-=8);if(0===a)a=1-l;else{if(a===u)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,r),a-=l}return(p?-1:1)*o*Math.pow(2,a-r)},n.write=function(e,t,n,r,i,a){var o,s,u,l=8*a-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:a-1,d=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),(t+=o+f>=1?h/u:h*Math.pow(2,1-f))*u>=2&&(o++,u/=2),o+f>=c?(s=0,o=c):o+f>=1?(s=(t*u-1)*Math.pow(2,i),o+=f):(s=t*Math.pow(2,f-1)*Math.pow(2,i),o=0));i>=8;e[n+p]=255&s,p+=d,s/=256,i-=8);for(o=o<0;e[n+p]=255&o,p+=d,o/=256,l-=8);e[n+p-d]|=128*g}},{}],56:[function(e,t,n){t.exports=[function(e,t){return{options:e,draw:function(t,n,r){r.stop(!0),r.overrideFlag=!0;var i=this;return t.pixelManipulation({output:function(e,t,n){i.output={src:t,format:n}},changePixel:function(e,t,n,r){return[255-e,255-t,255-n,r]},format:t.format,image:e.image,inBrowser:e.inBrowser,callback:n})},output:void 0,UI:t}},{name:"Invert",description:"Inverts the image.",inputs:{}}]},{}],57:[function(e,t,n){arguments[4][37][0].apply(n,arguments)},{dup:37}],58:[function(e,t,n){"use strict";t.exports=function(e){for(var t=new Array(e),n=0;n>i;0!=(t&o)&&p++;var d=n>>i;return 0!=(n&o)&&d++,function(e,t,n,o,s,u){function l(e,t,n){return en?n:e}var c=r.BitMatrix.createEmpty(o,s);function f(e,t,n,r,i){for(var o=n*i+t,s=0;sd&&(p=d);for(var g=0;gm&&(v=m);for(var _=l(g,2,t-3),w=l(h,2,n-3),b=0,y=-2;y<=2;y++){var x=u[w+y];b+=x[_-2],b+=x[_-1],b+=x[_],b+=x[_+1],b+=x[_+2]}f(e,v,p,b/25,o)}}return c}(u,p,d,t,n,function(e,t,n,r,o){for(var u=new Array(n),l=0;lh&&(f=h);for(var p=0;pg&&(d=g);for(var v=0,m=255,_=0,w=0,b=f*r+d;w_&&(_=x)}if(_-m>s)for(w++,b+=r;w>2*i;if(_-m<=s&&(k=m>>1,c>0&&p>0)){var E=u[c-1][p]+2*u[c][p-1]+u[c-1][p-1]>>2;m=n&&(e++,r+=t.estimatedModuleSize)}),e<3)return!1;for(var a=r/i,o=0,s=0;s=0&&c(n,l);)o[2]++,l--;if(l<0)return null;for(;l>=0&&!c(n,l)&&o[1]<=r;)o[1]++,l--;if(l<0||o[1]>r)return null;for(;l>=0&&c(n,l)&&o[0]<=r;)o[0]++,l--;if(o[0]>r)return null;for(l=t+1;l=r)return null;for(;l=r)return null;var f=o[0]+o[1]+o[2]+o[3]+o[4];return 5*Math.abs(f-i)>=2*i?null:s(o)?u(o,l):null}(r,Math.floor(f),n[2],l);if(null!=h&&null!=(f=function(t,n,r,i){for(var a=e.width,o=[0,0,0,0,0],l=t;l>=0&&c(l,n);)o[2]++,l--;if(l<0)return null;for(;l>=0&&!c(l,n)&&o[1]<=r;)o[1]++,l--;if(l<0||o[1]>r)return null;for(;l>=0&&c(l,n)&&o[0]<=r;)o[0]++,l--;if(o[0]>r)return null;for(l=t+1;l=r)return null;for(;l=r)return null;var f=o[0]+o[1]+o[2]+o[3]+o[4];return 5*Math.abs(f-i)>=i?null:s(o)?u(o,l):null}(Math.floor(f),Math.floor(h),n[2],l))&&(!a||function(t,n,r,i){for(var a=e.height,o=e.width,u=[0,0,0,0,0],l=0;t-l>=0&&c(n-l,t-l);)u[2]++,l++;if(t-l<0||n-l<0)return!1;for(;t-l>=0&&n-l>=0&&!c(n-l,t-l)&&u[1]<=r;)u[1]++,l++;if(t-l<0||n-l<0||u[1]>r)return!1;for(;t-l>=0&&n-l>=0&&c(n-l,t-l)&&u[0]<=r;)u[0]++,l++;if(u[0]>r)return!1;for(l=1;t+l=a||n+l>=o)return!1;for(;t+l=a||n+l>=o||u[3]>=r)return!1;for(;t+l=r)return!1;var f=u[0]+u[1]+u[2]+u[3]+u[4];return Math.abs(f-i)<2*i&&s(u)}(Math.floor(h),Math.floor(f),n[2],l))){for(var p=l/7,d=!1,g=0;g=n){if(null!=e)return a=!0,Math.floor(Math.abs(e.x-t.x)-Math.abs(e.y-t.y))/2;e=t}}),0}var d=e.height,g=e.width,v=Math.floor(3*d/(4*i));v_[2]&&(w+=x-_[2]-v,y=g-1)}_=[0,0,0,0,0],b=0}else _=[_[2],_[3],_[4],1,0],b=3;else _[++b]++;else _[b]++;s(_)&&h(_,w,g,!1)&&(v=_[0],a&&(m=f()))}var k=function(){var e=t.length;if(e<3)return null;if(e>3){var n=0,r=0;t.forEach(function(e){var t=e.estimatedModuleSize;n+=t,r+=t*t});var i=n/e,a=Math.sqrt(r/e-i*i);t.sort(function(e,t){var n=Math.abs(t.estimatedModuleSize-i),r=Math.abs(e.estimatedModuleSize-i);return n3;s++){var u=t[s];Math.abs(u.estimatedModuleSize-i)>o&&(t.splice(s,1),s--)}}return t.length>3&&(n=0,t.forEach(function(e){n+=e.estimatedModuleSize}),i=n/t.length,t.sort(function(e,t){if(t.count===e.count){var n=Math.abs(t.estimatedModuleSize-i),r=Math.abs(e.estimatedModuleSize-i);return n=i&&a>=o?(n=e[0],t=e[1],r=e[2]):o>=a&&o>=i?(n=e[1],t=e[0],r=e[2]):(n=e[2],t=e[0],r=e[1]),function(e,t,n){var r=t.x,i=t.y;return(n.x-r)*(e.y-i)-(n.y-i)*(e.x-r)}(t,n,r)<0){var s=t;t=r,r=s}return{bottomLeft:{x:t.x,y:t.y},topLeft:{x:n.x,y:n.y},topRight:{x:r.x,y:r.y}}}(k):null}},function(e,t,n){"use strict";var r=n(5),i=n(7),a=n(8),o=n(2),s=n(6);function u(e,t,n){for(var r=!0,i=0;ie||o<-1||o>t)throw new Error;r=!1,-1==a?(n[i]=0,r=!0):a==e&&(n[i]=e-1,r=!0),-1==o?(n[i+1]=0,r=!0):o==t&&(n[i+1]=t-1,r=!0)}r=!0;for(i=n.length-2;i>=0&&r;i-=2){a=Math.floor(n[i]),o=Math.floor(n[i+1]);if(a<-1||a>e||o<-1||o>t)throw new Error;r=!1,-1==a?(n[i]=0,r=!0):a==e&&(n[i]=e-1,r=!0),-1==o?(n[i+1]=0,r=!0):o==t&&(n[i+1]=t-1,r=!0)}return n}function l(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))}function c(e,t,n,i,a){t=Math.floor(t),n=Math.floor(n);var o=Math.floor(i*e),s=Math.max(0,t-o),u=Math.min(a.width,t+o);if(u-s<3*e)return null;var l=Math.max(0,n-o),c=Math.min(a.height-1,n+o);return r.findAlignment(s,l,u-s,c-l,e,a)}function f(e,t,n,r,i){e=Math.floor(e),t=Math.floor(t),n=Math.floor(n),r=Math.floor(r);var a=Math.abs(r-t)>Math.abs(n-e);if(a){var o=e;e=t,t=o,o=n,n=r,r=o}for(var s=Math.abs(n-e),u=Math.abs(r-t),c=-s>>1,f=e0){if(v==r)break;v+=h,c-=s}}return 2==p?l(n+f,r,e,t):NaN}function h(e,t,n,r,i){var a=f(e,t,n,r,i),o=1,s=e-(n-e);s<0?(o=e/(e-s),s=0):s>=i.width&&(o=(i.width-1-e)/(s-e),s=i.width-1);var u=t-(r-t)*o;return o=1,u<0?(o=t/(t-u),u=0):u>=i.height&&(o=(i.height-1-t)/(u-t),u=i.height-1),(a+=f(e,t,s=e+(s-e)*o,u,i))-1}function p(e,t,n){var r=h(e.x,e.y,t.x,t.y,n),i=h(t.x,t.y,e.x,e.y,n);return s.isNaN(r)?i/7:s.isNaN(i)?r/7:(r+i)/14}t.extract=function(e,t){var n=function(e,t,n,r){return(p(e,t,r)+p(e,n,r))/2}(t.topLeft,t.topRight,t.bottomLeft,e);if(n<1)return null;var r=function(e,t,n,r){var i=7+(Math.round(l(e.x,e.y,t.x,t.y)/r)+Math.round(l(e.x,e.y,n.x,n.y)/r)>>1);switch(3&i){case 0:i++;break;case 2:i--}return i}(t.topLeft,t.topRight,t.bottomLeft,n);if(!r)return null;var s=function(e){if(e%4!=1)return null;var t=e-17>>2;return t<1||t>40?null:a.getVersionForNumber(t)}(r);if(null==s)return null;var f=s.getDimensionForVersion()-7,h=null;if(s.alignmentPatternCenters.length>0)for(var d=t.topRight.x-t.topLeft.x+t.bottomLeft.x,g=t.topRight.y-t.topLeft.y+t.bottomLeft.y,v=1-3/f,m=t.topLeft.x+v*(d-t.topLeft.x),_=t.topLeft.y+v*(g-t.topLeft.y),w=4;w<=16&&!(h=c(n,m,_,w,e));w<<=1);return function(e,t,n){if(t<=0)return null;for(var r=o.BitMatrix.createEmpty(t,t),a=new Array(t<<1),s=0;s>1),a[f+1]=c;a=i.transformPoints(n,a);try{var h=u(e.width,e.height,a)}catch(e){return null}for(f=0;f>1,s,e.get(Math.floor(h[f]),Math.floor(h[f+1])))}return r}(e,r,function(e,t,n,r,a){var o,s,u,l,c=a-3.5;return null!=r?(o=r.x,s=r.y,u=l=c-3):(o=t.x-e.x+n.x,s=t.y-e.y+n.y,u=l=c),i.quadrilateralToQuadrilateral(3.5,3.5,c,3.5,u,l,3.5,c,e.x,e.y,t.x,t.y,o,s,n.x,n.y)}(t.topLeft,t.topRight,t.bottomLeft,h,r))}},function(e,t,n){"use strict";var r=n(6);function i(e,t,n,r){if(Math.abs(n-e.y)<=t&&Math.abs(r-e.x)<=t){var i=Math.abs(t-e.estimatedModuleSize);return i<=1||i<=e.estimatedModuleSize}return!1}function a(e,t,n,r){return{x:(e.x+n)/2,y:(e.y+t)/2,estimatedModuleSize:(e.estimatedModuleSize+r)/2}}function o(e,t){for(var n=t/2,r=0;r<3;r++)if(Math.abs(t-e[r])>=n)return!1;return!0}function s(e,t){var n=t-e[2]-e[1]/2;return r.isNaN(n)?null:n}t.findAlignment=function(e,t,n,r,u,l){var c=[];function f(e,t,n,r){var u=e[0]+e[1]+e[2],f=s(e,n);if(null==f)return null;var h=function(e,t,n,r,i,a){for(var u=a.height,l=[0,0,0],c=e;c>=0&&a.get(t,c)&&l[1]<=n;)l[1]++,c--;if(c<0||l[1]>n)return null;for(;c>=0&&!a.get(t,c)&&l[0]<=n;)l[0]++,c--;if(l[0]>n)return null;for(c=e+1;cn)return null;for(;cn)return null;var f=l[0]+l[1]+l[2];return 5*Math.abs(f-r)>=2*r?null:o(l,i)?s(l,c):null}(t,Math.floor(f),2*e[1],u,r,l);if(null!=h){var p=(e[0]+e[1]+e[2])/3;for(var d in c){var g=c[d];if(i(g,p,h,f))return a(g,h,f,p)}var v={x:f,y:h,estimatedModuleSize:p};c.push(v)}return null}for(var h=e+n,p=t+(r>>1),d=[0,0,0],g=0;g>1:-(g+1>>1));d[0]=0,d[1]=0,d[2]=0;for(var m=e;m>4&15]+n[e>>8&15]+n[e>>12&15]+n[e>>16&15]+n[e>>20&15]+n[e>>24&15]+n[e>>28&15]},t.isNaN=function(e){return"[object Number]"===Object.prototype.toString.call(e)&&e!==+e}},function(e,t){"use strict";function n(e,t,n,r,i,a,o,s){var u=e-n+i-o,l=t-r+a-s;if(0==u&&0==l)return{a11:n-e,a21:i-n,a31:e,a12:r-t,a22:a-r,a32:t,a13:0,a23:0,a33:1};var c=n-i,f=o-i,h=r-a,p=s-a,d=c*p-f*h,g=(u*p-f*l)/d,v=(c*l-u*h)/d;return{a11:n-e+g*n,a21:o-e+v*o,a31:e,a12:r-t+g*r,a22:s-t+v*s,a32:t,a13:g,a23:v,a33:1}}t.transformPoints=function(e,t){for(var n=t.length,r=e.a11,i=e.a12,a=e.a13,o=e.a21,s=e.a22,u=e.a23,l=e.a31,c=e.a32,f=e.a33,h=0;h40)throw new Error("Invalid version number "+e);return u[e-1]}t.getVersionForNumber=l},function(e,t,n){"use strict";var r=n(2),i=n(10),a=n(6),o=n(12),s=n(8),u=21522,l=[[21522,0],[20773,1],[24188,2],[23371,3],[17913,4],[16590,5],[20375,6],[19104,7],[30660,8],[29427,9],[32170,10],[30877,11],[26159,12],[25368,13],[27713,14],[26998,15],[5769,16],[5054,17],[7399,18],[6608,19],[1890,20],[597,21],[3340,22],[2107,23],[13663,24],[12392,25],[16177,26],[14854,27],[9396,28],[8579,29],[11994,30],[11245,31]],c=[function(e,t){return 0==(e+t&1)},function(e,t){return 0==(1&e)},function(e,t){return t%3==0},function(e,t){return(e+t)%3==0},function(e,t){return 0==((e>>1)+t/3&1)},function(e,t){return(e*t&1)+e*t%3==0},function(e,t){return 0==((e*t&1)+e*t%3&1)},function(e,t){return 0==((e+t&1)+e*t%3&1)}],f=[{ordinal:1,bits:0,name:"M"},{ordinal:0,bits:1,name:"L"},{ordinal:3,bits:2,name:"H"},{ordinal:2,bits:3,name:"Q"}];function h(e,t,n){for(var i=c[n.dataMask],a=e.height,o=function(e){for(var t=e.getDimensionForVersion(),n=new Array(t*t),i=0;i6&&(a.setRegion(t-11,0,3,6),a.setRegion(0,t-11,6,3)),a}(t),s=!0,u=[],l=0,f=0,h=0,p=a-1;p>0;p-=2){6==p&&p--;for(var d=0;d>3&3],dataMask:7&e}}function d(e,t){for(var n=1/0,r=0,i=0;i=0;r--)t=e.copyBit(8,r,t);var i=e.height,a=0,o=i-7;for(r=i-1;r>=o;r--)a=e.copyBit(8,r,a);for(n=i-8;n>2;if(n<=6)return s.getVersionForNumber(n);for(var r=0,i=t-11,a=5;a>=0;a--)for(var o=t-9;o>=i;o--)r=e.copyBit(o,a,r);var u=s.Version.decodeVersionInformation(r);if(null!=u&&u.getDimensionForVersion()==t)return u;for(r=0,o=5;o>=0;o--)for(a=t-9;a>=i;a--)r=e.copyBit(o,a,r);return null!=(u=s.Version.decodeVersionInformation(r))&&u.getDimensionForVersion()==t?u:null}(e);if(!t)return null;var n=g(e);if(!n)return null;var r=n.errorCorrectionLevel,a=h(e,t,n);if(!a)return null;var o=function(e,t,n){if(e.length!=t.totalCodewords)throw new Error("Invalid number of codewords for version; got "+e.length+" expected "+t.totalCodewords);var r=t.getECBlocksForLevel(n),i=0,a=r.ecBlocks;a.forEach(function(e){i+=e.count});var o=new Array(i),s=0;a.forEach(function(e){for(var t=0;t=0&&o[l].codewords.length!=u;)l--;l++;for(var c=u-r.ecCodewordsPerBlock,f=0,h=0;h=t.length)throw new Error("Could not decode alphanumeric char");return t[e].charCodeAt(0)}var a=function(){function e(e,t){this.characterCountBitsForVersions=e,this.bits=t}return e.prototype.getCharacterCountBits=function(e){if(null==this.characterCountBitsForVersions)throw new Error("Character count doesn't apply to this mode");var t;return t=e<=9?0:e<=26?1:2,this.characterCountBitsForVersions[t]},e}(),o=new a([0,0,0],0),s=new a([10,12,14],1),u=new a([9,11,13],2),l=new a([0,0,0],3),c=new a([8,16,16],4),f=new a(null,7),h=new a([8,10,12],8),p=new a(null,5),d=new a(null,9),g=new a([8,10,12],13);function v(e){switch(e){case 0:return o;case 1:return s;case 2:return u;case 3:return l;case 4:return c;case 5:return p;case 7:return f;case 8:return h;case 9:return d;case 13:return g;default:throw new Error("Couldn't decode mode from byte array")}}function m(e){var t=e.readBits(8);if(0==(128&t))return 127&t;if(128==(192&t))return(63&t)<<8|e.readBits(8);if(192==(224&t))return(31&t)<<16|e.readBits(16);throw new Error("Bad ECI bits starting with byte "+t)}function _(e,t,n){if(13*n>e.available())return!1;for(var r=new Array(2*n),i=0;n>0;){var a=e.readBits(13),o=Math.floor(a/96)<<8|a%96;o+=o<959?41377:42657,r[i]=o>>8&255,r[i+1]=255&o,i+=2,n--}return t.val=r,!0}function w(e,t,n){for(;n>=3;){if(e.available()<10)return!1;var r=e.readBits(10);if(r>=1e3)return!1;t.val.push(i(Math.floor(r/100))),t.val.push(i(Math.floor(r/10)%10)),t.val.push(i(r%10)),n-=3}if(2==n){if(e.available()<7)return!1;var a=e.readBits(7);if(a>=100)return!1;t.val.push(i(Math.floor(a/10))),t.val.push(i(a%10))}else if(1==n){if(e.available()<4)return!1;var o=e.readBits(4);if(o>=10)return!1;t.val.push(i(o))}return!0}function b(e,t,n,r){for(var a=t.val.length;n>1;){if(e.available()<11)return!1;var o=e.readBits(11);t.val.push(i(Math.floor(o/45))),t.val.push(i(o%45)),n-=2}if(1==n){if(e.available()<6)return!1;t.val.push(i(e.readBits(6)))}if(r)for(var s=a;se.available())return!1;for(var r=new Array(n),i=0;i30)return null}else if(i==g){var A=a.readBits(4),T=a.readBits(i.getCharacterCountBits(t));if(A==x&&!_(a,k,T))return null}else{var M=a.readBits(i.getCharacterCountBits(t));if(i==s){if(!w(a,k,M))return null}else if(i==u){if(!b(a,k,M,E))return null}else if(i==c){if(!y(a,k,M))return null}else if(i!=h)return null}return k.val}},function(e,t){"use strict";var n=function(){function e(e){this.byteOffset=0,this.bitOffset=0,this.bytes=e}return e.prototype.readBits=function(e){if(e<1||e>32||e>this.available())throw new Error("Cannot read "+e.toString()+" bits");var t=0;if(this.bitOffset>0){var n=8-this.bitOffset,r=e>8-r<<(a=n-r);t=(this.bytes[this.byteOffset]&i)>>a,e-=r,this.bitOffset+=r,8==this.bitOffset&&(this.bitOffset=0,this.byteOffset++)}if(e>0){for(;e>=8;)t=t<<8|255&this.bytes[this.byteOffset],this.byteOffset++,e-=8;if(e>0){var a;i=255>>(a=8-e)<>a,this.bitOffset+=e}}return t},e.prototype.available=function(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset},e}();t.BitStream=n},function(e,t){"use strict";var n=function(){function e(){this.field=new i(285,256,0)}return e.prototype.decode=function(e,t){for(var n=new r(this.field,e),a=new Array(t),o=!0,s=0;s=n/2;){var u=i,l=o;if(o=s,(i=a).isZero())return null;a=u;for(var c=this.field.zero,f=i.getCoefficient(i.degree()),h=this.field.inverse(f);a.degree()>=i.degree()&&!a.isZero();){var p=a.degree()-i.degree(),d=this.field.multiply(a.getCoefficient(a.degree()),h);c=c.addOrSubtract(this.field.buildMonomial(p,d)),a=a.addOrSubtract(i.multiplyByMonomial(p,d))}if(s=c.multiplyPoly(o).addOrSubtract(l),a.degree()>=i.degree())return null}var g=s.getCoefficient(0);if(0==g)return null;var v=this.field.inverse(g);return[s.multiply(v),a.multiply(v)]},e.prototype.findErrorLocations=function(e){var t=e.degree();if(1==t)return[e.getCoefficient(1)];for(var n=new Array(t),r=0,i=1;i1&&0==t[0]){for(var r=1;rr.length){var a=n;n=r,r=a}for(var o=new Array(r.length),s=r.length-n.length,u=0;u=this.size&&(e^=this.primitive,e&=this.size-1);for(t=0;t>>1,F=[["ary",x],["bind",g],["bindKey",v],["curry",_],["curryRight",w],["flip",E],["partial",b],["partialRight",y],["rearg",k]],N="[object Arguments]",P="[object Array]",U="[object AsyncFunction]",q="[object Boolean]",V="[object Date]",Z="[object DOMException]",W="[object Error]",G="[object Function]",H="[object GeneratorFunction]",Y="[object Map]",$="[object Number]",X="[object Null]",J="[object Object]",K="[object Proxy]",Q="[object RegExp]",ee="[object Set]",te="[object String]",ne="[object Symbol]",re="[object Undefined]",ie="[object WeakMap]",ae="[object WeakSet]",oe="[object ArrayBuffer]",se="[object DataView]",ue="[object Float32Array]",le="[object Float64Array]",ce="[object Int8Array]",fe="[object Int16Array]",he="[object Int32Array]",pe="[object Uint8Array]",de="[object Uint8ClampedArray]",ge="[object Uint16Array]",ve="[object Uint32Array]",me=/\b__p \+= '';/g,_e=/\b(__p \+=) '' \+/g,we=/(__e\(.*?\)|\b__t\)) \+\n'';/g,be=/&(?:amp|lt|gt|quot|#39);/g,ye=/[&<>"']/g,xe=RegExp(be.source),ke=RegExp(ye.source),Ee=/<%-([\s\S]+?)%>/g,Se=/<%([\s\S]+?)%>/g,Ae=/<%=([\s\S]+?)%>/g,Te=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Me=/^\w*$/,Ie=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,je=/[\\^$.*+?()[\]{}|]/g,Re=RegExp(je.source),Le=/^\s+|\s+$/g,Be=/^\s+/,Ce=/\s+$/,Oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ze=/\{\n\/\* \[wrapped with (.+)\] \*/,De=/,? & /,Fe=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Ne=/\\(\\)?/g,Pe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ue=/\w*$/,qe=/^[-+]0x[0-9a-f]+$/i,Ve=/^0b[01]+$/i,Ze=/^\[object .+?Constructor\]$/,We=/^0o[0-7]+$/i,Ge=/^(?:0|[1-9]\d*)$/,He=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ye=/($^)/,$e=/['\n\r\u2028\u2029\\]/g,Xe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Je="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ke="[\\ud800-\\udfff]",Qe="["+Je+"]",et="["+Xe+"]",tt="\\d+",nt="[\\u2700-\\u27bf]",rt="[a-z\\xdf-\\xf6\\xf8-\\xff]",it="[^\\ud800-\\udfff"+Je+tt+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",at="\\ud83c[\\udffb-\\udfff]",ot="[^\\ud800-\\udfff]",st="(?:\\ud83c[\\udde6-\\uddff]){2}",ut="[\\ud800-\\udbff][\\udc00-\\udfff]",lt="[A-Z\\xc0-\\xd6\\xd8-\\xde]",ct="(?:"+rt+"|"+it+")",ft="(?:"+lt+"|"+it+")",ht="(?:"+et+"|"+at+")"+"?",pt="[\\ufe0e\\ufe0f]?"+ht+("(?:\\u200d(?:"+[ot,st,ut].join("|")+")[\\ufe0e\\ufe0f]?"+ht+")*"),dt="(?:"+[nt,st,ut].join("|")+")"+pt,gt="(?:"+[ot+et+"?",et,st,ut,Ke].join("|")+")",vt=RegExp("['’]","g"),mt=RegExp(et,"g"),_t=RegExp(at+"(?="+at+")|"+gt+pt,"g"),wt=RegExp([lt+"?"+rt+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[Qe,lt,"$"].join("|")+")",ft+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[Qe,lt+ct,"$"].join("|")+")",lt+"?"+ct+"+(?:['’](?:d|ll|m|re|s|t|ve))?",lt+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",tt,dt].join("|"),"g"),bt=RegExp("[\\u200d\\ud800-\\udfff"+Xe+"\\ufe0e\\ufe0f]"),yt=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,xt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],kt=-1,Et={};Et[ue]=Et[le]=Et[ce]=Et[fe]=Et[he]=Et[pe]=Et[de]=Et[ge]=Et[ve]=!0,Et[N]=Et[P]=Et[oe]=Et[q]=Et[se]=Et[V]=Et[W]=Et[G]=Et[Y]=Et[$]=Et[J]=Et[Q]=Et[ee]=Et[te]=Et[ie]=!1;var St={};St[N]=St[P]=St[oe]=St[se]=St[q]=St[V]=St[ue]=St[le]=St[ce]=St[fe]=St[he]=St[Y]=St[$]=St[J]=St[Q]=St[ee]=St[te]=St[ne]=St[pe]=St[de]=St[ge]=St[ve]=!0,St[W]=St[G]=St[ie]=!1;var At={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Tt=parseFloat,Mt=parseInt,It="object"==typeof e&&e&&e.Object===Object&&e,jt="object"==typeof self&&self&&self.Object===Object&&self,Rt=It||jt||Function("return this")(),Lt="object"==typeof n&&n&&!n.nodeType&&n,Bt=Lt&&"object"==typeof t&&t&&!t.nodeType&&t,Ct=Bt&&Bt.exports===Lt,Ot=Ct&&It.process,zt=function(){try{var e=Bt&&Bt.require&&Bt.require("util").types;return e||Ot&&Ot.binding&&Ot.binding("util")}catch(e){}}(),Dt=zt&&zt.isArrayBuffer,Ft=zt&&zt.isDate,Nt=zt&&zt.isMap,Pt=zt&&zt.isRegExp,Ut=zt&&zt.isSet,qt=zt&&zt.isTypedArray;function Vt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Zt(e,t,n,r){for(var i=-1,a=null==e?0:e.length;++i-1}function Xt(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function wn(e,t){for(var n=e.length;n--&&on(t,e[n],0)>-1;);return n}var bn=fn({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),yn=fn({"&":"&","<":"<",">":">",'"':""","'":"'"});function xn(e){return"\\"+At[e]}function kn(e){return bt.test(e)}function En(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function Sn(e,t){return function(n){return e(t(n))}}function An(e,t){for(var n=-1,r=e.length,i=0,a=[];++n",""":'"',"'":"'"});var Bn=function e(t){var n,Xe=(t=null==t?Rt:Bn.defaults(Rt.Object(),t,Bn.pick(Rt,xt))).Array,Je=t.Date,Ke=t.Error,Qe=t.Function,et=t.Math,tt=t.Object,nt=t.RegExp,rt=t.String,it=t.TypeError,at=Xe.prototype,ot=Qe.prototype,st=tt.prototype,ut=t["__core-js_shared__"],lt=ot.toString,ct=st.hasOwnProperty,ft=0,ht=(n=/[^.]+$/.exec(ut&&ut.keys&&ut.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",pt=st.toString,dt=lt.call(tt),gt=Rt._,_t=nt("^"+lt.call(ct).replace(je,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),bt=Ct?t.Buffer:r,At=t.Symbol,It=t.Uint8Array,jt=bt?bt.allocUnsafe:r,Lt=Sn(tt.getPrototypeOf,tt),Bt=tt.create,Ot=st.propertyIsEnumerable,zt=at.splice,nn=At?At.isConcatSpreadable:r,fn=At?At.iterator:r,Cn=At?At.toStringTag:r,On=function(){try{var e=Na(tt,"defineProperty");return e({},"",{}),e}catch(e){}}(),zn=t.clearTimeout!==Rt.clearTimeout&&t.clearTimeout,Dn=Je&&Je.now!==Rt.Date.now&&Je.now,Fn=t.setTimeout!==Rt.setTimeout&&t.setTimeout,Nn=et.ceil,Pn=et.floor,Un=tt.getOwnPropertySymbols,qn=bt?bt.isBuffer:r,Vn=t.isFinite,Zn=at.join,Wn=Sn(tt.keys,tt),Gn=et.max,Hn=et.min,Yn=Je.now,$n=t.parseInt,Xn=et.random,Jn=at.reverse,Kn=Na(t,"DataView"),Qn=Na(t,"Map"),er=Na(t,"Promise"),tr=Na(t,"Set"),nr=Na(t,"WeakMap"),rr=Na(tt,"create"),ir=nr&&new nr,ar={},or=co(Kn),sr=co(Qn),ur=co(er),lr=co(tr),cr=co(nr),fr=At?At.prototype:r,hr=fr?fr.valueOf:r,pr=fr?fr.toString:r;function dr(e){if(Ms(e)&&!ms(e)&&!(e instanceof _r)){if(e instanceof mr)return e;if(ct.call(e,"__wrapped__"))return fo(e)}return new mr(e)}var gr=function(){function e(){}return function(t){if(!Ts(t))return{};if(Bt)return Bt(t);e.prototype=t;var n=new e;return e.prototype=r,n}}();function vr(){}function mr(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=r}function _r(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=O,this.__views__=[]}function wr(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function zr(e,t,n,i,a,o){var s,u=t&c,l=t&f,p=t&h;if(n&&(s=a?n(e,i,a,o):n(e)),s!==r)return s;if(!Ts(e))return e;var d=ms(e);if(d){if(s=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&ct.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!u)return ra(e,s)}else{var g=qa(e),v=g==G||g==H;if(ys(e))return Ji(e,u);if(g==J||g==N||v&&!a){if(s=l||v?{}:Za(e),!u)return l?function(e,t){return ia(e,Ua(e),t)}(e,function(e,t){return e&&ia(t,au(t),e)}(s,e)):function(e,t){return ia(e,Pa(e),t)}(e,Lr(s,e))}else{if(!St[g])return a?e:{};s=function(e,t,n){var r,i,a,o=e.constructor;switch(t){case oe:return Ki(e);case q:case V:return new o(+e);case se:return function(e,t){var n=t?Ki(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case ue:case le:case ce:case fe:case he:case pe:case de:case ge:case ve:return Qi(e,n);case Y:return new o;case $:case te:return new o(e);case Q:return(a=new(i=e).constructor(i.source,Ue.exec(i))).lastIndex=i.lastIndex,a;case ee:return new o;case ne:return r=e,hr?tt(hr.call(r)):{}}}(e,g,u)}}o||(o=new kr);var m=o.get(e);if(m)return m;if(o.set(e,s),Bs(e))return e.forEach(function(r){s.add(zr(r,t,n,r,e,o))}),s;if(Is(e))return e.forEach(function(r,i){s.set(i,zr(r,t,n,i,e,o))}),s;var _=d?r:(p?l?La:Ra:l?au:iu)(e);return Wt(_||e,function(r,i){_&&(r=e[i=r]),Ir(s,i,zr(r,t,n,i,e,o))}),s}function Dr(e,t,n){var i=n.length;if(null==e)return!i;for(e=tt(e);i--;){var a=n[i],o=t[a],s=e[a];if(s===r&&!(a in e)||!o(s))return!1}return!0}function Fr(e,t,n){if("function"!=typeof e)throw new it(o);return ro(function(){e.apply(r,n)},t)}function Nr(e,t,n,r){var a=-1,o=$t,s=!0,u=e.length,l=[],c=t.length;if(!u)return l;n&&(t=Jt(t,gn(n))),r?(o=Xt,s=!1):t.length>=i&&(o=mn,s=!1,t=new xr(t));e:for(;++a-1},br.prototype.set=function(e,t){var n=this.__data__,r=jr(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},yr.prototype.clear=function(){this.size=0,this.__data__={hash:new wr,map:new(Qn||br),string:new wr}},yr.prototype.delete=function(e){var t=Da(this,e).delete(e);return this.size-=t?1:0,t},yr.prototype.get=function(e){return Da(this,e).get(e)},yr.prototype.has=function(e){return Da(this,e).has(e)},yr.prototype.set=function(e,t){var n=Da(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},xr.prototype.add=xr.prototype.push=function(e){return this.__data__.set(e,s),this},xr.prototype.has=function(e){return this.__data__.has(e)},kr.prototype.clear=function(){this.__data__=new br,this.size=0},kr.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},kr.prototype.get=function(e){return this.__data__.get(e)},kr.prototype.has=function(e){return this.__data__.has(e)},kr.prototype.set=function(e,t){var n=this.__data__;if(n instanceof br){var r=n.__data__;if(!Qn||r.length0&&n(s)?t>1?Wr(s,t-1,n,r,i):Kt(i,s):r||(i[i.length]=s)}return i}var Gr=ua(),Hr=ua(!0);function Yr(e,t){return e&&Gr(e,t,iu)}function $r(e,t){return e&&Hr(e,t,iu)}function Xr(e,t){return Yt(t,function(t){return Es(e[t])})}function Jr(e,t){for(var n=0,i=(t=Hi(t,e)).length;null!=e&&nt}function ti(e,t){return null!=e&&ct.call(e,t)}function ni(e,t){return null!=e&&t in tt(e)}function ri(e,t,n){for(var i=n?Xt:$t,a=e[0].length,o=e.length,s=o,u=Xe(o),l=1/0,c=[];s--;){var f=e[s];s&&t&&(f=Jt(f,gn(t))),l=Hn(f.length,l),u[s]=!n&&(t||a>=120&&f.length>=120)?new xr(s&&f):r}f=e[0];var h=-1,p=u[0];e:for(;++h=s)return u;var l=n[r];return u*("desc"==l?-1:1)}}return e.index-t.index}(e,t,n)})}function wi(e,t,n){for(var r=-1,i=t.length,a={};++r-1;)s!==e&&zt.call(s,u,1),zt.call(e,u,1);return e}function yi(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==a){var a=i;Ga(i)?zt.call(e,i,1):Ni(e,i)}}return e}function xi(e,t){return e+Pn(Xn()*(t-e+1))}function ki(e,t){var n="";if(!e||t<1||t>L)return n;do{t%2&&(n+=e),(t=Pn(t/2))&&(e+=e)}while(t);return n}function Ei(e,t){return io(eo(e,t,ju),e+"")}function Si(e){return Sr(pu(e))}function Ai(e,t){var n=pu(e);return so(n,Or(t,0,n.length))}function Ti(e,t,n,i){if(!Ts(e))return e;for(var a=-1,o=(t=Hi(t,e)).length,s=o-1,u=e;null!=u&&++ai?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=Xe(i);++r>>1,o=e[a];null!==o&&!Os(o)&&(n?o<=t:o=i){var c=t?null:ka(e);if(c)return Mn(c);s=!1,a=mn,l=new xr}else l=t?[]:u;e:for(;++r=i?e:Ri(e,t,n)}var Xi=zn||function(e){return Rt.clearTimeout(e)};function Ji(e,t){if(t)return e.slice();var n=e.length,r=jt?jt(n):new e.constructor(n);return e.copy(r),r}function Ki(e){var t=new e.constructor(e.byteLength);return new It(t).set(new It(e)),t}function Qi(e,t){var n=t?Ki(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ea(e,t){if(e!==t){var n=e!==r,i=null===e,a=e==e,o=Os(e),s=t!==r,u=null===t,l=t==t,c=Os(t);if(!u&&!c&&!o&&e>t||o&&s&&l&&!u&&!c||i&&s&&l||!n&&l||!a)return 1;if(!i&&!o&&!c&&e1?n[a-1]:r,s=a>2?n[2]:r;for(o=e.length>3&&"function"==typeof o?(a--,o):r,s&&Ha(n[0],n[1],s)&&(o=a<3?r:o,a=1),t=tt(t);++i-1?a[o?t[s]:s]:r}}function pa(e){return ja(function(t){var n=t.length,i=n,a=mr.prototype.thru;for(e&&t.reverse();i--;){var s=t[i];if("function"!=typeof s)throw new it(o);if(a&&!u&&"wrapper"==Ca(s))var u=new mr([],!0)}for(i=u?i:n;++i1&&_.reverse(),f&&lu))return!1;var c=o.get(e);if(c&&o.get(t))return c==t;var f=-1,h=!0,g=n&d?new xr:r;for(o.set(e,t),o.set(t,e);++f-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(Oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return Wt(F,function(n){var r="_."+n[0];t&n[1]&&!$t(e,r)&&e.push(r)}),e.sort()}(function(e){var t=e.match(ze);return t?t[1].split(De):[]}(r),n)))}function oo(e){var t=0,n=0;return function(){var i=Yn(),a=M-(i-n);if(n=i,a>0){if(++t>=T)return arguments[0]}else t=0;return e.apply(r,arguments)}}function so(e,t){var n=-1,i=e.length,a=i-1;for(t=t===r?i:t;++n1?e[t-1]:r;return Lo(e,n="function"==typeof n?(e.pop(),n):r)});function No(e){var t=dr(e);return t.__chain__=!0,t}function Po(e,t){return t(e)}var Uo=ja(function(e){var t=e.length,n=t?e[0]:0,i=this.__wrapped__,a=function(t){return Cr(t,e)};return!(t>1||this.__actions__.length)&&i instanceof _r&&Ga(n)?((i=i.slice(n,+n+(t?1:0))).__actions__.push({func:Po,args:[a],thisArg:r}),new mr(i,this.__chain__).thru(function(e){return t&&!e.length&&e.push(r),e})):this.thru(a)});var qo=aa(function(e,t,n){ct.call(e,n)?++e[n]:Br(e,n,1)});var Vo=ha(vo),Zo=ha(mo);function Wo(e,t){return(ms(e)?Wt:Pr)(e,za(t,3))}function Go(e,t){return(ms(e)?Gt:Ur)(e,za(t,3))}var Ho=aa(function(e,t,n){ct.call(e,n)?e[n].push(t):Br(e,n,[t])});var Yo=Ei(function(e,t,n){var r=-1,i="function"==typeof t,a=ws(e)?Xe(e.length):[];return Pr(e,function(e){a[++r]=i?Vt(t,e,n):ii(e,t,n)}),a}),$o=aa(function(e,t,n){Br(e,n,t)});function Xo(e,t){return(ms(e)?Jt:pi)(e,za(t,3))}var Jo=aa(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]});var Ko=Ei(function(e,t){if(null==e)return[];var n=t.length;return n>1&&Ha(e,t[0],t[1])?t=[]:n>2&&Ha(t[0],t[1],t[2])&&(t=[t[0]]),_i(e,Wr(t,1),[])}),Qo=Dn||function(){return Rt.Date.now()};function es(e,t,n){return t=n?r:t,t=e&&null==t?e.length:t,Sa(e,x,r,r,r,r,t)}function ts(e,t){var n;if("function"!=typeof t)throw new it(o);return e=Us(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=r),n}}var ns=Ei(function(e,t,n){var r=g;if(n.length){var i=An(n,Oa(ns));r|=b}return Sa(e,r,t,n,i)}),rs=Ei(function(e,t,n){var r=g|v;if(n.length){var i=An(n,Oa(rs));r|=b}return Sa(t,r,e,n,i)});function is(e,t,n){var i,a,s,u,l,c,f=0,h=!1,p=!1,d=!0;if("function"!=typeof e)throw new it(o);function g(t){var n=i,o=a;return i=a=r,f=t,u=e.apply(o,n)}function v(e){var n=e-c;return c===r||n>=t||n<0||p&&e-f>=s}function m(){var e=Qo();if(v(e))return _(e);l=ro(m,function(e){var n=t-(e-c);return p?Hn(n,s-(e-f)):n}(e))}function _(e){return l=r,d&&i?g(e):(i=a=r,u)}function w(){var e=Qo(),n=v(e);if(i=arguments,a=this,c=e,n){if(l===r)return function(e){return f=e,l=ro(m,t),h?g(e):u}(c);if(p)return l=ro(m,t),g(c)}return l===r&&(l=ro(m,t)),u}return t=Vs(t)||0,Ts(n)&&(h=!!n.leading,s=(p="maxWait"in n)?Gn(Vs(n.maxWait)||0,t):s,d="trailing"in n?!!n.trailing:d),w.cancel=function(){l!==r&&Xi(l),f=0,i=c=a=l=r},w.flush=function(){return l===r?u:_(Qo())},w}var as=Ei(function(e,t){return Fr(e,1,t)}),os=Ei(function(e,t,n){return Fr(e,Vs(t)||0,n)});function ss(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new it(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(ss.Cache||yr),n}function us(e){if("function"!=typeof e)throw new it(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}ss.Cache=yr;var ls=Yi(function(e,t){var n=(t=1==t.length&&ms(t[0])?Jt(t[0],gn(za())):Jt(Wr(t,1),gn(za()))).length;return Ei(function(r){for(var i=-1,a=Hn(r.length,n);++i=t}),vs=ai(function(){return arguments}())?ai:function(e){return Ms(e)&&ct.call(e,"callee")&&!Ot.call(e,"callee")},ms=Xe.isArray,_s=Dt?gn(Dt):function(e){return Ms(e)&&Qr(e)==oe};function ws(e){return null!=e&&As(e.length)&&!Es(e)}function bs(e){return Ms(e)&&ws(e)}var ys=qn||Vu,xs=Ft?gn(Ft):function(e){return Ms(e)&&Qr(e)==V};function ks(e){if(!Ms(e))return!1;var t=Qr(e);return t==W||t==Z||"string"==typeof e.message&&"string"==typeof e.name&&!Rs(e)}function Es(e){if(!Ts(e))return!1;var t=Qr(e);return t==G||t==H||t==U||t==K}function Ss(e){return"number"==typeof e&&e==Us(e)}function As(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=L}function Ts(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Ms(e){return null!=e&&"object"==typeof e}var Is=Nt?gn(Nt):function(e){return Ms(e)&&qa(e)==Y};function js(e){return"number"==typeof e||Ms(e)&&Qr(e)==$}function Rs(e){if(!Ms(e)||Qr(e)!=J)return!1;var t=Lt(e);if(null===t)return!0;var n=ct.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&<.call(n)==dt}var Ls=Pt?gn(Pt):function(e){return Ms(e)&&Qr(e)==Q};var Bs=Ut?gn(Ut):function(e){return Ms(e)&&qa(e)==ee};function Cs(e){return"string"==typeof e||!ms(e)&&Ms(e)&&Qr(e)==te}function Os(e){return"symbol"==typeof e||Ms(e)&&Qr(e)==ne}var zs=qt?gn(qt):function(e){return Ms(e)&&As(e.length)&&!!Et[Qr(e)]};var Ds=ba(hi),Fs=ba(function(e,t){return e<=t});function Ns(e){if(!e)return[];if(ws(e))return Cs(e)?Rn(e):ra(e);if(fn&&e[fn])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[fn]());var t=qa(e);return(t==Y?En:t==ee?Mn:pu)(e)}function Ps(e){return e?(e=Vs(e))===R||e===-R?(e<0?-1:1)*B:e==e?e:0:0===e?e:0}function Us(e){var t=Ps(e),n=t%1;return t==t?n?t-n:t:0}function qs(e){return e?Or(Us(e),0,O):0}function Vs(e){if("number"==typeof e)return e;if(Os(e))return C;if(Ts(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Ts(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(Le,"");var n=Ve.test(e);return n||We.test(e)?Mt(e.slice(2),n?2:8):qe.test(e)?C:+e}function Zs(e){return ia(e,au(e))}function Ws(e){return null==e?"":Di(e)}var Gs=oa(function(e,t){if(Ja(t)||ws(t))ia(t,iu(t),e);else for(var n in t)ct.call(t,n)&&Ir(e,n,t[n])}),Hs=oa(function(e,t){ia(t,au(t),e)}),Ys=oa(function(e,t,n,r){ia(t,au(t),e,r)}),$s=oa(function(e,t,n,r){ia(t,iu(t),e,r)}),Xs=ja(Cr);var Js=Ei(function(e,t){e=tt(e);var n=-1,i=t.length,a=i>2?t[2]:r;for(a&&Ha(t[0],t[1],a)&&(i=1);++n1),t}),ia(e,La(e),n),r&&(n=zr(n,c|f|h,Ma));for(var i=t.length;i--;)Ni(n,t[i]);return n});var lu=ja(function(e,t){return null==e?{}:function(e,t){return wi(e,t,function(t,n){return eu(e,n)})}(e,t)});function cu(e,t){if(null==e)return{};var n=Jt(La(e),function(e){return[e]});return t=za(t),wi(e,n,function(e,n){return t(e,n[0])})}var fu=Ea(iu),hu=Ea(au);function pu(e){return null==e?[]:vn(e,iu(e))}var du=ca(function(e,t,n){return t=t.toLowerCase(),e+(n?gu(t):t)});function gu(e){return ku(Ws(e).toLowerCase())}function vu(e){return(e=Ws(e))&&e.replace(He,bn).replace(mt,"")}var mu=ca(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),_u=ca(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),wu=la("toLowerCase");var bu=ca(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()});var yu=ca(function(e,t,n){return e+(n?" ":"")+ku(t)});var xu=ca(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),ku=la("toUpperCase");function Eu(e,t,n){return e=Ws(e),(t=n?r:t)===r?function(e){return yt.test(e)}(e)?function(e){return e.match(wt)||[]}(e):function(e){return e.match(Fe)||[]}(e):e.match(t)||[]}var Su=Ei(function(e,t){try{return Vt(e,r,t)}catch(e){return ks(e)?e:new Ke(e)}}),Au=ja(function(e,t){return Wt(t,function(t){t=lo(t),Br(e,t,ns(e[t],e))}),e});function Tu(e){return function(){return e}}var Mu=pa(),Iu=pa(!0);function ju(e){return e}function Ru(e){return li("function"==typeof e?e:zr(e,c))}var Lu=Ei(function(e,t){return function(n){return ii(n,e,t)}}),Bu=Ei(function(e,t){return function(n){return ii(e,n,t)}});function Cu(e,t,n){var r=iu(t),i=Xr(t,r);null!=n||Ts(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=Xr(t,iu(t)));var a=!(Ts(n)&&"chain"in n&&!n.chain),o=Es(e);return Wt(i,function(n){var r=t[n];e[n]=r,o&&(e.prototype[n]=function(){var t=this.__chain__;if(a||t){var n=e(this.__wrapped__);return(n.__actions__=ra(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,Kt([this.value()],arguments))})}),e}function Ou(){}var zu=ma(Jt),Du=ma(Ht),Fu=ma(tn);function Nu(e){return Ya(e)?cn(lo(e)):function(e){return function(t){return Jr(t,e)}}(e)}var Pu=wa(),Uu=wa(!0);function qu(){return[]}function Vu(){return!1}var Zu=va(function(e,t){return e+t},0),Wu=xa("ceil"),Gu=va(function(e,t){return e/t},1),Hu=xa("floor");var Yu,$u=va(function(e,t){return e*t},1),Xu=xa("round"),Ju=va(function(e,t){return e-t},0);return dr.after=function(e,t){if("function"!=typeof t)throw new it(o);return e=Us(e),function(){if(--e<1)return t.apply(this,arguments)}},dr.ary=es,dr.assign=Gs,dr.assignIn=Hs,dr.assignInWith=Ys,dr.assignWith=$s,dr.at=Xs,dr.before=ts,dr.bind=ns,dr.bindAll=Au,dr.bindKey=rs,dr.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return ms(e)?e:[e]},dr.chain=No,dr.chunk=function(e,t,n){t=(n?Ha(e,t,n):t===r)?1:Gn(Us(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var a=0,o=0,s=Xe(Nn(i/t));aa?0:a+n),(i=i===r||i>a?a:Us(i))<0&&(i+=a),i=n>i?0:qs(i);n>>0)?(e=Ws(e))&&("string"==typeof t||null!=t&&!Ls(t))&&!(t=Di(t))&&kn(e)?$i(Rn(e),0,n):e.split(t,n):[]},dr.spread=function(e,t){if("function"!=typeof e)throw new it(o);return t=null==t?0:Gn(Us(t),0),Ei(function(n){var r=n[t],i=$i(n,0,t);return r&&Kt(i,r),Vt(e,this,i)})},dr.tail=function(e){var t=null==e?0:e.length;return t?Ri(e,1,t):[]},dr.take=function(e,t,n){return e&&e.length?Ri(e,0,(t=n||t===r?1:Us(t))<0?0:t):[]},dr.takeRight=function(e,t,n){var i=null==e?0:e.length;return i?Ri(e,(t=i-(t=n||t===r?1:Us(t)))<0?0:t,i):[]},dr.takeRightWhile=function(e,t){return e&&e.length?Ui(e,za(t,3),!1,!0):[]},dr.takeWhile=function(e,t){return e&&e.length?Ui(e,za(t,3)):[]},dr.tap=function(e,t){return t(e),e},dr.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new it(o);return Ts(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),is(e,t,{leading:r,maxWait:t,trailing:i})},dr.thru=Po,dr.toArray=Ns,dr.toPairs=fu,dr.toPairsIn=hu,dr.toPath=function(e){return ms(e)?Jt(e,lo):Os(e)?[e]:ra(uo(Ws(e)))},dr.toPlainObject=Zs,dr.transform=function(e,t,n){var r=ms(e),i=r||ys(e)||zs(e);if(t=za(t,4),null==n){var a=e&&e.constructor;n=i?r?new a:[]:Ts(e)&&Es(a)?gr(Lt(e)):{}}return(i?Wt:Yr)(e,function(e,r,i){return t(n,e,r,i)}),n},dr.unary=function(e){return es(e,1)},dr.union=Mo,dr.unionBy=Io,dr.unionWith=jo,dr.uniq=function(e){return e&&e.length?Fi(e):[]},dr.uniqBy=function(e,t){return e&&e.length?Fi(e,za(t,2)):[]},dr.uniqWith=function(e,t){return t="function"==typeof t?t:r,e&&e.length?Fi(e,r,t):[]},dr.unset=function(e,t){return null==e||Ni(e,t)},dr.unzip=Ro,dr.unzipWith=Lo,dr.update=function(e,t,n){return null==e?e:Pi(e,t,Gi(n))},dr.updateWith=function(e,t,n,i){return i="function"==typeof i?i:r,null==e?e:Pi(e,t,Gi(n),i)},dr.values=pu,dr.valuesIn=function(e){return null==e?[]:vn(e,au(e))},dr.without=Bo,dr.words=Eu,dr.wrap=function(e,t){return cs(Gi(t),e)},dr.xor=Co,dr.xorBy=Oo,dr.xorWith=zo,dr.zip=Do,dr.zipObject=function(e,t){return Zi(e||[],t||[],Ir)},dr.zipObjectDeep=function(e,t){return Zi(e||[],t||[],Ti)},dr.zipWith=Fo,dr.entries=fu,dr.entriesIn=hu,dr.extend=Hs,dr.extendWith=Ys,Cu(dr,dr),dr.add=Zu,dr.attempt=Su,dr.camelCase=du,dr.capitalize=gu,dr.ceil=Wu,dr.clamp=function(e,t,n){return n===r&&(n=t,t=r),n!==r&&(n=(n=Vs(n))==n?n:0),t!==r&&(t=(t=Vs(t))==t?t:0),Or(Vs(e),t,n)},dr.clone=function(e){return zr(e,h)},dr.cloneDeep=function(e){return zr(e,c|h)},dr.cloneDeepWith=function(e,t){return zr(e,c|h,t="function"==typeof t?t:r)},dr.cloneWith=function(e,t){return zr(e,h,t="function"==typeof t?t:r)},dr.conformsTo=function(e,t){return null==t||Dr(e,t,iu(t))},dr.deburr=vu,dr.defaultTo=function(e,t){return null==e||e!=e?t:e},dr.divide=Gu,dr.endsWith=function(e,t,n){e=Ws(e),t=Di(t);var i=e.length,a=n=n===r?i:Or(Us(n),0,i);return(n-=t.length)>=0&&e.slice(n,a)==t},dr.eq=ps,dr.escape=function(e){return(e=Ws(e))&&ke.test(e)?e.replace(ye,yn):e},dr.escapeRegExp=function(e){return(e=Ws(e))&&Re.test(e)?e.replace(je,"\\$&"):e},dr.every=function(e,t,n){var i=ms(e)?Ht:qr;return n&&Ha(e,t,n)&&(t=r),i(e,za(t,3))},dr.find=Vo,dr.findIndex=vo,dr.findKey=function(e,t){return rn(e,za(t,3),Yr)},dr.findLast=Zo,dr.findLastIndex=mo,dr.findLastKey=function(e,t){return rn(e,za(t,3),$r)},dr.floor=Hu,dr.forEach=Wo,dr.forEachRight=Go,dr.forIn=function(e,t){return null==e?e:Gr(e,za(t,3),au)},dr.forInRight=function(e,t){return null==e?e:Hr(e,za(t,3),au)},dr.forOwn=function(e,t){return e&&Yr(e,za(t,3))},dr.forOwnRight=function(e,t){return e&&$r(e,za(t,3))},dr.get=Qs,dr.gt=ds,dr.gte=gs,dr.has=function(e,t){return null!=e&&Va(e,t,ti)},dr.hasIn=eu,dr.head=wo,dr.identity=ju,dr.includes=function(e,t,n,r){e=ws(e)?e:pu(e),n=n&&!r?Us(n):0;var i=e.length;return n<0&&(n=Gn(i+n,0)),Cs(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&on(e,t,n)>-1},dr.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:Us(n);return i<0&&(i=Gn(r+i,0)),on(e,t,i)},dr.inRange=function(e,t,n){return t=Ps(t),n===r?(n=t,t=0):n=Ps(n),function(e,t,n){return e>=Hn(t,n)&&e=-L&&e<=L},dr.isSet=Bs,dr.isString=Cs,dr.isSymbol=Os,dr.isTypedArray=zs,dr.isUndefined=function(e){return e===r},dr.isWeakMap=function(e){return Ms(e)&&qa(e)==ie},dr.isWeakSet=function(e){return Ms(e)&&Qr(e)==ae},dr.join=function(e,t){return null==e?"":Zn.call(e,t)},dr.kebabCase=mu,dr.last=ko,dr.lastIndexOf=function(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var a=i;return n!==r&&(a=(a=Us(n))<0?Gn(i+a,0):Hn(a,i-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,a):an(e,un,a,!0)},dr.lowerCase=_u,dr.lowerFirst=wu,dr.lt=Ds,dr.lte=Fs,dr.max=function(e){return e&&e.length?Vr(e,ju,ei):r},dr.maxBy=function(e,t){return e&&e.length?Vr(e,za(t,2),ei):r},dr.mean=function(e){return ln(e,ju)},dr.meanBy=function(e,t){return ln(e,za(t,2))},dr.min=function(e){return e&&e.length?Vr(e,ju,hi):r},dr.minBy=function(e,t){return e&&e.length?Vr(e,za(t,2),hi):r},dr.stubArray=qu,dr.stubFalse=Vu,dr.stubObject=function(){return{}},dr.stubString=function(){return""},dr.stubTrue=function(){return!0},dr.multiply=$u,dr.nth=function(e,t){return e&&e.length?mi(e,Us(t)):r},dr.noConflict=function(){return Rt._===this&&(Rt._=gt),this},dr.noop=Ou,dr.now=Qo,dr.pad=function(e,t,n){e=Ws(e);var r=(t=Us(t))?jn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return _a(Pn(i),n)+e+_a(Nn(i),n)},dr.padEnd=function(e,t,n){e=Ws(e);var r=(t=Us(t))?jn(e):0;return t&&rt){var i=e;e=t,t=i}if(n||e%1||t%1){var a=Xn();return Hn(e+a*(t-e+Tt("1e-"+((a+"").length-1))),t)}return xi(e,t)},dr.reduce=function(e,t,n){var r=ms(e)?Qt:hn,i=arguments.length<3;return r(e,za(t,4),n,i,Pr)},dr.reduceRight=function(e,t,n){var r=ms(e)?en:hn,i=arguments.length<3;return r(e,za(t,4),n,i,Ur)},dr.repeat=function(e,t,n){return t=(n?Ha(e,t,n):t===r)?1:Us(t),ki(Ws(e),t)},dr.replace=function(){var e=arguments,t=Ws(e[0]);return e.length<3?t:t.replace(e[1],e[2])},dr.result=function(e,t,n){var i=-1,a=(t=Hi(t,e)).length;for(a||(a=1,e=r);++iL)return[];var n=O,r=Hn(e,O);t=za(t),e-=O;for(var i=dn(r,t);++n=o)return e;var u=n-jn(i);if(u<1)return i;var l=s?$i(s,0,u).join(""):e.slice(0,u);if(a===r)return l+i;if(s&&(u+=l.length-u),Ls(a)){if(e.slice(u).search(a)){var c,f=l;for(a.global||(a=nt(a.source,Ws(Ue.exec(a))+"g")),a.lastIndex=0;c=a.exec(f);)var h=c.index;l=l.slice(0,h===r?u:h)}}else if(e.indexOf(Di(a),u)!=u){var p=l.lastIndexOf(a);p>-1&&(l=l.slice(0,p))}return l+i},dr.unescape=function(e){return(e=Ws(e))&&xe.test(e)?e.replace(be,Ln):e},dr.uniqueId=function(e){var t=++ft;return Ws(e)+t},dr.upperCase=xu,dr.upperFirst=ku,dr.each=Wo,dr.eachRight=Go,dr.first=wo,Cu(dr,(Yu={},Yr(dr,function(e,t){ct.call(dr.prototype,t)||(Yu[t]=e)}),Yu),{chain:!1}),dr.VERSION="4.17.10",Wt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){dr[e].placeholder=dr}),Wt(["drop","take"],function(e,t){_r.prototype[e]=function(n){n=n===r?1:Gn(Us(n),0);var i=this.__filtered__&&!t?new _r(this):this.clone();return i.__filtered__?i.__takeCount__=Hn(n,i.__takeCount__):i.__views__.push({size:Hn(n,O),type:e+(i.__dir__<0?"Right":"")}),i},_r.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),Wt(["filter","map","takeWhile"],function(e,t){var n=t+1,r=n==I||3==n;_r.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:za(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}}),Wt(["head","last"],function(e,t){var n="take"+(t?"Right":"");_r.prototype[e]=function(){return this[n](1).value()[0]}}),Wt(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");_r.prototype[e]=function(){return this.__filtered__?new _r(this):this[n](1)}}),_r.prototype.compact=function(){return this.filter(ju)},_r.prototype.find=function(e){return this.filter(e).head()},_r.prototype.findLast=function(e){return this.reverse().find(e)},_r.prototype.invokeMap=Ei(function(e,t){return"function"==typeof e?new _r(this):this.map(function(n){return ii(n,e,t)})}),_r.prototype.reject=function(e){return this.filter(us(za(e)))},_r.prototype.slice=function(e,t){e=Us(e);var n=this;return n.__filtered__&&(e>0||t<0)?new _r(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==r&&(n=(t=Us(t))<0?n.dropRight(-t):n.take(t-e)),n)},_r.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},_r.prototype.toArray=function(){return this.take(O)},Yr(_r.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),a=dr[i?"take"+("last"==t?"Right":""):t],o=i||/^find/.test(t);a&&(dr.prototype[t]=function(){var t=this.__wrapped__,s=i?[1]:arguments,u=t instanceof _r,l=s[0],c=u||ms(t),f=function(e){var t=a.apply(dr,Kt([e],s));return i&&h?t[0]:t};c&&n&&"function"==typeof l&&1!=l.length&&(u=c=!1);var h=this.__chain__,p=!!this.__actions__.length,d=o&&!h,g=u&&!p;if(!o&&c){t=g?t:new _r(this);var v=e.apply(t,s);return v.__actions__.push({func:Po,args:[f],thisArg:r}),new mr(v,h)}return d&&g?e.apply(this,s):(v=this.thru(f),d?i?v.value()[0]:v.value():v)})}),Wt(["pop","push","shift","sort","splice","unshift"],function(e){var t=at[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);dr.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(ms(i)?i:[],e)}return this[n](function(n){return t.apply(ms(n)?n:[],e)})}}),Yr(_r.prototype,function(e,t){var n=dr[t];if(n){var r=n.name+"";(ar[r]||(ar[r]=[])).push({name:t,func:n})}}),ar[da(r,v).name]=[{name:"wrapper",func:r}],_r.prototype.clone=function(){var e=new _r(this.__wrapped__);return e.__actions__=ra(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=ra(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=ra(this.__views__),e},_r.prototype.reverse=function(){if(this.__filtered__){var e=new _r(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},_r.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=ms(e),r=t<0,i=n?e.length:0,a=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?r:this.__values__[this.__index__++]}},dr.prototype.plant=function(e){for(var t,n=this;n instanceof vr;){var i=fo(n);i.__index__=0,i.__values__=r,t?a.__wrapped__=i:t=i;var a=i;n=n.__wrapped__}return a.__wrapped__=e,t},dr.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof _r){var t=e;return this.__actions__.length&&(t=new _r(this)),(t=t.reverse()).__actions__.push({func:Po,args:[To],thisArg:r}),new mr(t,this.__chain__)}return this.thru(To)},dr.prototype.toJSON=dr.prototype.valueOf=dr.prototype.value=function(){return qi(this.__wrapped__,this.__actions__)},dr.prototype.first=dr.prototype.head,fn&&(dr.prototype[fn]=function(){return this}),dr}();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(Rt._=Bn,define(function(){return Bn})):Bt?((Bt.exports=Bn)._=Bn,Lt._=Bn):Rt._=Bn}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],63:[function(e,t,n){(function(n){e("path");var r=e("fs");function i(){this.types=Object.create(null),this.extensions=Object.create(null)}i.prototype.define=function(e){for(var t in e){for(var r=e[t],i=0;i=0;--s)if(h[s]=f,f*=l[s],p=Math.max(p,o.scratchMemory(l[s])),t.shape[s]!==n.shape[s])throw new Error("Shape mismatch, real and imaginary arrays must have same size");var d,g=4*f+p;d="array"===t.dtype||"float64"===t.dtype||"custom"===t.dtype?a.mallocDouble(g):a.mallocFloat(g);var v,m,_,w,b=i(d,l.slice(0),h,0),y=i(d,l.slice(0),h.slice(0),f),x=i(d,l.slice(0),h.slice(0),2*f),k=i(d,l.slice(0),h.slice(0),3*f),E=4*f;for(r.assign(b,t),r.assign(y,n),s=c-1;s>=0&&(o(e,f/l[s],l[s],d,b.offset,y.offset,E),0!==s);--s){for(m=1,_=x.stride,w=k.stride,u=s-1;u=0;--u)w[u]=_[u]=m,m*=l[u];r.assign(x,b),r.assign(k,y),v=b,b=x,x=v,v=y,y=k,k=v}r.assign(t,b),r.assign(n,y),a.free(d)}},{"./lib/fft-matrix.js":66,ndarray:71,"ndarray-ops":68,"typedarray-pool":130}],66:[function(e,t,n){var r=e("bit-twiddle");function i(e,t,n,i,a,o){var s,u,l,c,f,h,p,d,g,v,m,_,w,b,y,x,k,E,S,A,T,M,I,j;for(e|=0,t|=0,a|=0,o|=0,s=n|=0,u=r.log2(s),E=0;E>1,f=0,l=0;l>=1;f+=h}for(m=-1,_=0,v=1,d=0;d>",rrshift:">>>"};!function(){for(var e in s){var t=s[e];n[e]=o({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+t+"c"},funcName:e}),n[e+"eq"]=o({args:["array","array"],body:{args:["a","b"],body:"a"+t+"=b"},rvalue:!0,funcName:e+"eq"}),n[e+"s"]=o({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+t+"s"},funcName:e+"s"}),n[e+"seq"]=o({args:["array","scalar"],body:{args:["a","s"],body:"a"+t+"=s"},rvalue:!0,funcName:e+"seq"})}}();var u={not:"!",bnot:"~",neg:"-",recip:"1.0/"};!function(){for(var e in u){var t=u[e];n[e]=o({args:["array","array"],body:{args:["a","b"],body:"a="+t+"b"},funcName:e}),n[e+"eq"]=o({args:["array"],body:{args:["a"],body:"a="+t+"a"},rvalue:!0,count:2,funcName:e+"eq"})}}();var l={and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">="};!function(){for(var e in l){var t=l[e];n[e]=o({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+t+"c"},funcName:e}),n[e+"s"]=o({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+t+"s"},funcName:e+"s"}),n[e+"eq"]=o({args:["array","array"],body:{args:["a","b"],body:"a=a"+t+"b"},rvalue:!0,count:2,funcName:e+"eq"}),n[e+"seq"]=o({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+t+"s"},rvalue:!0,count:2,funcName:e+"seq"})}}();var c=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan"];!function(){for(var e=0;ethis_s){this_s=-a}else if(a>this_s){this_s=a}",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norminf"}),n.norm1=r({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:3}],body:"this_s+=a<0?-a:a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm1"}),n.sup=r({args:["array"],pre:{body:"this_h=-Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_>this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}}),n.inf=r({args:["array"],pre:{body:"this_h=Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),n.random=o({args:["array"],pre:{args:[],body:"this_f=Math.random",thisVars:["this_f"]},body:{args:["a"],body:"a=this_f()",thisVars:["this_f"]},funcName:"random"}),n.assign=o({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),n.assigns=o({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),n.equals=r({args:["array","array"],pre:i,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})},{"cwise-compiler":9}],69:[function(e,t,n){"use strict";var r=e("ndarray"),i=e("./doConvert.js");t.exports=function(e,t){for(var n=[],a=e,o=1;Array.isArray(a);)n.push(a.length),o*=a.length,a=a[0];return 0===n.length?r():(t||(t=r(new Float64Array(o),n)),i(t,e),t)}},{"./doConvert.js":70,ndarray:71}],70:[function(e,t,n){t.exports=e("cwise-compiler")({args:["array","scalar","index"],pre:{body:"{}",args:[],thisVars:[],localVars:[]},body:{body:"{\nvar _inline_1_v=_inline_1_arg1_,_inline_1_i\nfor(_inline_1_i=0;_inline_1_i<_inline_1_arg2_.length-1;++_inline_1_i) {\n_inline_1_v=_inline_1_v[_inline_1_arg2_[_inline_1_i]]\n}\n_inline_1_arg0_=_inline_1_v[_inline_1_arg2_[_inline_1_arg2_.length-1]]\n}",args:[{name:"_inline_1_arg0_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg2_",lvalue:!1,rvalue:!0,count:4}],thisVars:[],localVars:["_inline_1_i","_inline_1_v"]},post:{body:"{}",args:[],thisVars:[],localVars:[]},funcName:"convert",blockSize:64})},{"cwise-compiler":9}],71:[function(e,t,n){var r=e("iota-array"),i=e("is-buffer"),a="undefined"!=typeof Float64Array;function o(e,t){return e[0]-t[0]}function s(){var e,t=this.stride,n=new Array(t.length);for(e=0;eMath.abs(this.stride[1]))?[1,0]:[0,1]}})"):3===t&&a.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")):a.push("ORDER})")),a.push("proto.set=function "+n+"_set("+u.join(",")+",v){"),i?a.push("return this.data.set("+c+",v)}"):a.push("return this.data["+c+"]=v}"),a.push("proto.get=function "+n+"_get("+u.join(",")+"){"),i?a.push("return this.data.get("+c+")}"):a.push("return this.data["+c+"]}"),a.push("proto.index=function "+n+"_index(",u.join(),"){return "+c+"}"),a.push("proto.hi=function "+n+"_hi("+u.join(",")+"){return new "+n+"(this.data,"+o.map(function(e){return["(typeof i",e,"!=='number'||i",e,"<0)?this.shape[",e,"]:i",e,"|0"].join("")}).join(",")+","+o.map(function(e){return"this.stride["+e+"]"}).join(",")+",this.offset)}");var p=o.map(function(e){return"a"+e+"=this.shape["+e+"]"}),d=o.map(function(e){return"c"+e+"=this.stride["+e+"]"});a.push("proto.lo=function "+n+"_lo("+u.join(",")+"){var b=this.offset,d=0,"+p.join(",")+","+d.join(","));for(var g=0;g=0){d=i"+g+"|0;b+=c"+g+"*d;a"+g+"-=d}");a.push("return new "+n+"(this.data,"+o.map(function(e){return"a"+e}).join(",")+","+o.map(function(e){return"c"+e}).join(",")+",b)}"),a.push("proto.step=function "+n+"_step("+u.join(",")+"){var "+o.map(function(e){return"a"+e+"=this.shape["+e+"]"}).join(",")+","+o.map(function(e){return"b"+e+"=this.stride["+e+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(g=0;g=0){c=(c+this.stride["+g+"]*i"+g+")|0}else{a.push(this.shape["+g+"]);b.push(this.stride["+g+"])}");return a.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),a.push("return function construct_"+n+"(data,shape,stride,offset){return new "+n+"(data,"+o.map(function(e){return"shape["+e+"]"}).join(",")+","+o.map(function(e){return"stride["+e+"]"}).join(",")+",offset)}"),new Function("CTOR_LIST","ORDER",a.join("\n"))(l[e],s)}var l={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],buffer:[],generic:[]};t.exports=function(e,t,n,r){if(void 0===e)return(0,l.array[0])([]);"number"==typeof e&&(e=[e]),void 0===t&&(t=[e.length]);var o=t.length;if(void 0===n){n=new Array(o);for(var s=o-1,c=1;s>=0;--s)n[s]=c,c*=t[s]}if(void 0===r)for(r=0,s=0;s>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,(e|=e>>>16)+1}},{}],73:[function(e,t,n){"use strict";function r(e,t,n,r){for(var i=e[t++],a=1<>=u,c-=u,v!==a){if(v===o)break;for(var m=va;)w=d[w]>>8,++_;var b=w;if(h+_+(m!==v?1:0)>r)return void console.log("Warning, gif stream longer than expected.");n[h++]=b;var y=h+=_;for(m!==v&&(n[h++]=b),w=m;_--;)w=d[w],n[--y]=255&w,w>>=8;null!==g&&s<4096&&(d[s++]=g<<8|b,s>=l+1&&u<12&&(++u,l=l<<1|1)),g=v}else s=o+1,l=(1<<(u=i+1))-1,g=null}return h!==r&&console.log("Warning, gif stream shorter than expected."),n}try{n.GifWriter=function(e,t,n,r){var i=0,a=void 0===(r=void 0===r?{}:r).loop?null:r.loop,o=void 0===r.palette?null:r.palette;if(t<=0||n<=0||t>65535||n>65535)throw new Error("Width/Height invalid.");function s(e){var t=e.length;if(t<2||t>256||t&t-1)throw new Error("Invalid code/color length, must be power of 2 and 2 .. 256.");return t}e[i++]=71,e[i++]=73,e[i++]=70,e[i++]=56,e[i++]=57,e[i++]=97;var u=0,l=0;if(null!==o){for(var c=s(o);c>>=1;)++u;if(c=1<=c)throw new Error("Background index out of range.");if(0===l)throw new Error("Background index explicitly passed as 0.")}}if(e[i++]=255&t,e[i++]=t>>8&255,e[i++]=255&n,e[i++]=n>>8&255,e[i++]=(null!==o?128:0)|u,e[i++]=l,e[i++]=0,null!==o)for(var f=0,h=o.length;f>16&255,e[i++]=p>>8&255,e[i++]=255&p}if(null!==a){if(a<0||a>65535)throw new Error("Loop count invalid.");e[i++]=33,e[i++]=255,e[i++]=11,e[i++]=78,e[i++]=69,e[i++]=84,e[i++]=83,e[i++]=67,e[i++]=65,e[i++]=80,e[i++]=69,e[i++]=50,e[i++]=46,e[i++]=48,e[i++]=3,e[i++]=1,e[i++]=255&a,e[i++]=a>>8&255,e[i++]=0}var d=!1;this.addFrame=function(t,n,r,a,u,l){if(!0===d&&(--i,d=!1),l=void 0===l?{}:l,t<0||n<0||t>65535||n>65535)throw new Error("x/y invalid.");if(r<=0||a<=0||r>65535||a>65535)throw new Error("Width/Height invalid.");if(u.length>=1;)++p;h=1<3)throw new Error("Disposal out of range.");var m=!1,_=0;if(void 0!==l.transparent&&null!==l.transparent&&(m=!0,(_=l.transparent)<0||_>=h))throw new Error("Transparent color index.");if((0!==v||m||0!==g)&&(e[i++]=33,e[i++]=249,e[i++]=4,e[i++]=v<<2|(!0===m?1:0),e[i++]=255&g,e[i++]=g>>8&255,e[i++]=_,e[i++]=0),e[i++]=44,e[i++]=255&t,e[i++]=t>>8&255,e[i++]=255&n,e[i++]=n>>8&255,e[i++]=255&r,e[i++]=r>>8&255,e[i++]=255&a,e[i++]=a>>8&255,e[i++]=!0===c?128|p-1:0,!0===c)for(var w=0,b=f.length;w>16&255,e[i++]=y>>8&255,e[i++]=255&y}return i=function(e,t,n,r){e[t++]=n;var i=t++,a=1<=n;)e[t++]=255&f,f>>=8,c-=8,t===i+256&&(e[i]=255,i=t++)}function p(e){f|=e<=8;)e[t++]=255&f,f>>=8,c-=8,t===i+256&&(e[i]=255,i=t++);4096===u?(p(a),u=s+1,l=n+1,g={}):(u>=1<>7,s=1<<1+(7&a);e[t++],e[t++];var u=null,l=null;o&&(u=t,l=s,t+=3*s);var c=!0,f=[],h=0,p=null,d=0,g=null;for(this.width=n,this.height=i;c&&t=0))throw Error("Invalid block size");if(0===M)break;t+=M}break;case 249:if(4!==e[t++]||0!==e[t+4])throw new Error("Invalid graphics extension block.");var v=e[t++];h=e[t++]|e[t++]<<8,p=e[t++],0==(1&v)&&(p=null),d=v>>2&7,t++;break;case 254:for(;;){if(!((M=e[t++])>=0))throw Error("Invalid block size");if(0===M)break;t+=M}break;default:throw new Error("Unknown graphic control label: 0x"+e[t-1].toString(16))}break;case 44:var m=e[t++]|e[t++]<<8,_=e[t++]|e[t++]<<8,w=e[t++]|e[t++]<<8,b=e[t++]|e[t++]<<8,y=e[t++],x=y>>6&1,k=1<<1+(7&y),E=u,S=l,A=!1;y>>7&&(A=!0,E=t,S=k,t+=3*k);var T=t;for(t++;;){var M;if(!((M=e[t++])>=0))throw Error("Invalid block size");if(0===M)break;t+=M}f.push({x:m,y:_,width:w,height:b,has_local_palette:A,palette_offset:E,palette_size:S,data_offset:T,data_length:t-T,transparent_index:p,interlaced:!!x,delay:h,disposal:d});break;case 59:c=!1;break;default:throw new Error("Unknown gif block: 0x"+e[t-1].toString(16))}this.numFrames=function(){return f.length},this.loopCount=function(){return g},this.frameInfo=function(e){if(e<0||e>=f.length)throw new Error("Frame index out of range.");return f[e]},this.decodeAndBlitFrameBGRA=function(t,i){var a=this.frameInfo(t),o=a.width*a.height,s=new Uint8Array(o);r(e,a.data_offset,s,o);var u=a.palette_offset,l=a.transparent_index;null===l&&(l=256);var c=a.width,f=n-c,h=c,p=4*(a.y*n+a.x),d=4*((a.y+a.height)*n+a.x),g=p,v=4*f;!0===a.interlaced&&(v+=4*n*7);for(var m=8,_=0,w=s.length;_=d&&(v=4*f+4*n*(m-1),g=p+(c+f)*(m<<1),m>>=1)),b===l)g+=4;else{var y=e[u+3*b],x=e[u+3*b+1],k=e[u+3*b+2];i[g++]=k,i[g++]=x,i[g++]=y,i[g++]=255}--h}},this.decodeAndBlitFrameRGBA=function(t,i){var a=this.frameInfo(t),o=a.width*a.height,s=new Uint8Array(o);r(e,a.data_offset,s,o);var u=a.palette_offset,l=a.transparent_index;null===l&&(l=256);var c=a.width,f=n-c,h=c,p=4*(a.y*n+a.x),d=4*((a.y+a.height)*n+a.x),g=p,v=4*f;!0===a.interlaced&&(v+=4*n*7);for(var m=8,_=0,w=s.length;_=d&&(v=4*f+4*n*(m-1),g=p+(c+f)*(m<<1),m>>=1)),b===l)g+=4;else{var y=e[u+3*b],x=e[u+3*b+1],k=e[u+3*b+2];i[g++]=y,i[g++]=x,i[g++]=k,i[g++]=255}--h}}}}catch(e){}},{}],74:[function(e,t,n){(function(n){var r=e("charm");function i(e){if(!(e=e||{}).total)throw new Error("You MUST specify the total number of operations that will be processed.");this.total=e.total,this.current=0,this.max_burden=e.maxBurden||.5,this.show_burden=e.showBurden||!1,this.started=!1,this.size=50,this.inner_time=0,this.outer_time=0,this.elapsed=0,this.time_start=0,this.time_end=0,this.time_left=0,this.time_burden=0,this.skip_steps=0,this.skipped=0,this.aborted=!1,this.charm=r(),this.charm.pipe(n.stdout),this.charm.write("\n\n\n")}function a(e,t,n){for(n=n||" ";e.length3&&(u[0]=u[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,o)),(u[1]||"").length=this.total&&this.finished(),this.time_end=(new Date).getTime(),this.inner_time=this.time_end-this.time_start)},i.prototype.updateTimes=function(){this.elapsed=this.time_start-this.started,this.time_end>0&&(this.outer_time=this.time_start-this.time_end),this.inner_time>0&&this.outer_time>0&&(this.time_burden=this.inner_time/(this.inner_time+this.outer_time)*100,this.time_left=this.elapsed/this.current*(this.total-this.current),this.time_left<0&&(this.time_left=0)),this.time_burden>this.max_burden&&this.skip_steps0&&this.current=0;r--){var i=e[r];"."===i?e.splice(r,1):".."===i?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}var r=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,i=function(e){return r.exec(e).slice(1)};function a(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r=-1&&!r;i--){var o=i>=0?arguments[i]:e.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");o&&(n=o+"/"+n,r="/"===o.charAt(0))}return(r?"/":"")+(n=t(a(n.split("/"),function(e){return!!e}),!r).join("/"))||"."},n.normalize=function(e){var r=n.isAbsolute(e),i="/"===o(e,-1);return(e=t(a(e.split("/"),function(e){return!!e}),!r).join("/"))||r||(e="."),e&&i&&(e+="/"),(r?"/":"")+e},n.isAbsolute=function(e){return"/"===e.charAt(0)},n.join=function(){var e=Array.prototype.slice.call(arguments,0);return n.normalize(a(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},n.relative=function(e,t){function r(e){for(var t=0;t=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=n.resolve(e).substr(1),t=n.resolve(t).substr(1);for(var i=r(e.split("/")),a=r(t.split("/")),o=Math.min(i.length,a.length),s=o,u=0;u>4,n.push(f,c);break;case 2:u=3&h,l=h>>2&3,c=h>>4&3,f=h>>6&3,n.push(f,c,l,u);break;case 1:i=1&h,a=h>>1&1,o=h>>2&1,s=h>>3&1,u=h>>4&1,l=h>>5&1,c=h>>6&1,f=h>>7&1,n.push(f,c,l,u,s,o,a,i)}}return{get:function(e){for(;n.length0&&(this._paused=!1,this.emit("drain"))}.bind(this))},o.prototype.write=function(e,t){return this.writable?(n=r.isBuffer(e)?e:new r(e,t||this._encoding),this._buffers.push(n),this._buffered+=n.length,this._process(),this._reads&&0===this._reads.length&&(this._paused=!0),this.writable&&!this._paused):(this.emit("error",new Error("Stream not writable")),!1);var n},o.prototype.end=function(e,t){e&&this.write(e,t),this.writable=!1,this._buffers&&(0===this._buffers.length?this._end():(this._buffers.push(null),this._process()))},o.prototype.destroySoon=o.prototype.end,o.prototype._end=function(){this._reads.length>0&&this.emit("error",new Error("There are some read requests waitng on finished stream")),this.destroy()},o.prototype.destroy=function(){this._buffers&&(this.writable=!1,this._reads=null,this._buffers=null,this.emit("close"))},o.prototype._processReadAllowingLess=function(e){this._reads.shift();var t=this._buffers[0];t.length>e.length?(this._buffered-=e.length,this._buffers[0]=t.slice(e.length),e.func.call(this,t.slice(0,e.length))):(this._buffered-=t.length,this._buffers.shift(),e.func.call(this,t))},o.prototype._processRead=function(e){this._reads.shift();for(var t=0,n=0,i=new r(e.length);t0&&this._buffers.splice(0,n),this._buffered-=e.length,e.func.call(this,i)},o.prototype._process=function(){try{for(;this._buffered>0&&this._reads&&this._reads.length>0;){var e=this._reads[0];if(e.allowLess)this._processReadAllowingLess(e);else{if(!(this._buffered>=e.length))break;this._processRead(e)}}this._buffers&&this._buffers.length>0&&null===this._buffers[0]&&this._end()}catch(e){this.emit("error",e)}}}).call(this,e("_process"),e("buffer").Buffer)},{_process:98,buffer:4,stream:112,util:135}],79:[function(e,t,n){"use strict";t.exports={PNG_SIGNATURE:[137,80,78,71,13,10,26,10],TYPE_IHDR:1229472850,TYPE_IEND:1229278788,TYPE_IDAT:1229209940,TYPE_PLTE:1347179589,TYPE_tRNS:1951551059,TYPE_gAMA:1732332865,COLORTYPE_GRAYSCALE:0,COLORTYPE_PALETTE:1,COLORTYPE_COLOR:2,COLORTYPE_ALPHA:4,COLORTYPE_PALETTE_COLOR:3,COLORTYPE_COLOR_ALPHA:6,COLORTYPE_TO_BPP_MAP:{0:1,2:3,3:1,4:2,6:4},GAMMA_DIVISION:1e5}},{}],80:[function(e,t,n){"use strict";var r=[];!function(){for(var e=0;e<256;e++){for(var t=e,n=0;n<8;n++)1&t?t=3988292384^t>>>1:t>>>=1;r[e]=t}}();var i=t.exports=function(){this._crc=-1};i.prototype.write=function(e){for(var t=0;t>>8;return!0},i.prototype.crc32=function(){return-1^this._crc},i.crc32=function(e){for(var t=-1,n=0;n>>8;return-1^t}},{}],81:[function(e,t,n){(function(n){"use strict";var r=e("./paeth-predictor");var i={0:function(e,t,n,r,i){e.copy(r,i,t,t+n)},1:function(e,t,n,r,i,a){for(var o=0;o=a?e[t+o-a]:0,u=e[t+o]-s;r[i+o]=u}},2:function(e,t,n,r,i){for(var a=0;a0?e[t+a-n]:0,s=e[t+a]-o;r[i+a]=s}},3:function(e,t,n,r,i,a){for(var o=0;o=a?e[t+o-a]:0,u=t>0?e[t+o-n]:0,l=e[t+o]-(s+u>>1);r[i+o]=l}},4:function(e,t,n,i,a,o){for(var s=0;s=o?e[t+s-o]:0,l=t>0?e[t+s-n]:0,c=t>0&&s>=o?e[t+s-(n+o)]:0,f=e[t+s]-r(u,l,c);i[a+s]=f}}},a={0:function(e,t,n){for(var r=0,i=t+n,a=t;a=r?e[t+a-r]:0,s=e[t+a]-o;i+=Math.abs(s)}return i},2:function(e,t,n){for(var r=0,i=t+n,a=t;a0?e[a-n]:0,s=e[a]-o;r+=Math.abs(s)}return r},3:function(e,t,n,r){for(var i=0,a=0;a=r?e[t+a-r]:0,s=t>0?e[t+a-n]:0,u=e[t+a]-(o+s>>1);i+=Math.abs(u)}return i},4:function(e,t,n,i){for(var a=0,o=0;o=i?e[t+o-i]:0,u=t>0?e[t+o-n]:0,l=t>0&&o>=i?e[t+o-(n+i)]:0,c=e[t+o]-r(s,u,l);a+=Math.abs(c)}return a}};t.exports=function(e,t,r,o,s){var u;if("filterType"in o&&-1!==o.filterType){if("number"!=typeof o.filterType)throw new Error("unrecognised filter types");u=[o.filterType]}else u=[0,1,2,3,4];for(var l=t*s,c=0,f=0,h=new n((l+1)*r),p=u[0],d=0;d1)for(var g=1/0,v=0;vi?t[a-r]:0;t[a]=o+s}},o.prototype._unFilterType2=function(e,t,n){for(var r=this._lastLine,i=0;ii?t[o-r]:0,c=Math.floor((l+u)/2);t[o]=s+c}},o.prototype._unFilterType4=function(e,t,n){for(var r=this._xComparison,a=r-1,o=this._lastLine,s=0;sa?t[s-r]:0,f=s>a&&o?o[s-r]:0,h=i(c,l,f);t[s]=u+h}},o.prototype._reverseFilterLine=function(e){var t,r=e[0],i=this._images[this._imageIndex],a=i.byteWidth;if(0===r)t=e.slice(1,a+1);else switch(t=new n(a),r){case 1:this._unFilterType1(e,t,a);break;case 2:this._unFilterType2(e,t,a);break;case 3:this._unFilterType3(e,t,a);break;case 4:this._unFilterType4(e,t,a);break;default:throw new Error("Unrecognised filter type - "+r)}this.write(t),i.lineIndex++,i.lineIndex>=i.height?(this._lastLine=null,this._imageIndex++,i=this._images[this._imageIndex]):this._lastLine=t,i?this.read(i.byteWidth+1,this._reverseFilterLine.bind(this)):(this._lastLine=null,this.complete())}}).call(this,e("buffer").Buffer)},{"./interlace":86,"./paeth-predictor":90,buffer:4}],85:[function(e,t,n){(function(e){"use strict";t.exports=function(t,n){var r=n.depth,i=n.width,a=n.height,o=n.colorType,s=n.transColor,u=n.palette,l=t;return 3===o?function(e,t,n,r,i){for(var a=0,o=0;o0&&f>0&&n.push({width:c,height:f,index:u})}return n},n.getInterlaceIterator=function(e){return function(t,n,i){var a=t%r[i].x.length,o=(t-a)/r[i].x.length*8+r[i].x[a],s=n%r[i].y.length;return 4*o+((n-s)/r[i].y.length*8+r[i].y[s])*e*4}}},{}],87:[function(e,t,n){(function(n){"use strict";var r=e("util"),i=e("stream"),a=e("./constants"),o=e("./packer"),s=t.exports=function(e){i.call(this);var t=e||{};this._packer=new o(t),this._deflate=this._packer.createDeflate(),this.readable=!0};r.inherits(s,i),s.prototype.pack=function(e,t,r,i){this.emit("data",new n(a.PNG_SIGNATURE)),this.emit("data",this._packer.packIHDR(t,r)),i&&this.emit("data",this._packer.packGAMA(i));var o=this._packer.filterData(e,t,r);this._deflate.on("error",this.emit.bind(this,"error")),this._deflate.on("data",function(e){this.emit("data",this._packer.packIDAT(e))}.bind(this)),this._deflate.on("end",function(){this.emit("data",this._packer.packIEND()),this.emit("end")}.bind(this)),this._deflate.end(o)}}).call(this,e("buffer").Buffer)},{"./constants":79,"./packer":89,buffer:4,stream:112,util:135}],88:[function(e,t,n){(function(n){"use strict";var r=!0,i=e("zlib");i.deflateSync||(r=!1);var a=e("./constants"),o=e("./packer");t.exports=function(e,t){if(!r)throw new Error("To use the sync capability of this library in old node versions, please also add a dependency on node-zlb-backport");var s=new o(t||{}),u=[];u.push(new n(a.PNG_SIGNATURE)),u.push(s.packIHDR(e.width,e.height)),e.gamma&&u.push(s.packGAMA(e.gamma));var l=s.filterData(e.data,e.width,e.height),c=i.deflateSync(l,s.getDeflateOptions());if(l=null,!c||!c.length)throw new Error("bad png - invalid compressed data response");return u.push(s.packIDAT(c)),u.push(s.packIEND()),n.concat(u)}}).call(this,e("buffer").Buffer)},{"./constants":79,"./packer":89,buffer:4,zlib:41}],89:[function(e,t,n){(function(n){"use strict";var r=e("./constants"),i=e("./crc"),a=e("./bitpacker"),o=e("./filter-pack"),s=e("zlib"),u=t.exports=function(e){if(this._options=e,e.deflateChunkSize=e.deflateChunkSize||32768,e.deflateLevel=null!=e.deflateLevel?e.deflateLevel:9,e.deflateStrategy=null!=e.deflateStrategy?e.deflateStrategy:3,e.inputHasAlpha=null==e.inputHasAlpha||e.inputHasAlpha,e.deflateFactory=e.deflateFactory||s.createDeflate,e.bitDepth=e.bitDepth||8,e.colorType="number"==typeof e.colorType?e.colorType:r.COLORTYPE_COLOR_ALPHA,e.colorType!==r.COLORTYPE_COLOR&&e.colorType!==r.COLORTYPE_COLOR_ALPHA)throw new Error("option color type:"+e.colorType+" is not supported at present");if(8!==e.bitDepth)throw new Error("option bit depth:"+e.bitDepth+" is not supported at present")};u.prototype.getDeflateOptions=function(){return{chunkSize:this._options.deflateChunkSize,level:this._options.deflateLevel,strategy:this._options.deflateStrategy}},u.prototype.createDeflate=function(){return this._options.deflateFactory(this.getDeflateOptions())},u.prototype.filterData=function(e,t,n){var i=a(e,t,n,this._options),s=r.COLORTYPE_TO_BPP_MAP[this._options.colorType];return o(i,t,n,this._options,s)},u.prototype._packChunk=function(e,t){var r=t?t.length:0,a=new n(r+12);return a.writeUInt32BE(r,0),a.writeUInt32BE(e,4),t&&t.copy(a,8),a.writeInt32BE(i.crc32(a.slice(4,a.length-4)),a.length-4),a},u.prototype.packGAMA=function(e){var t=new n(4);return t.writeUInt32BE(Math.floor(e*r.GAMMA_DIVISION),0),this._packChunk(r.TYPE_gAMA,t)},u.prototype.packIHDR=function(e,t){var i=new n(13);return i.writeUInt32BE(e,0),i.writeUInt32BE(t,4),i[8]=this._options.bitDepth,i[9]=this._options.colorType,i[10]=0,i[11]=0,i[12]=0,this._packChunk(r.TYPE_IHDR,i)},u.prototype.packIDAT=function(e){return this._packChunk(r.TYPE_IDAT,e)},u.prototype.packIEND=function(){return this._packChunk(r.TYPE_IEND,null)}}).call(this,e("buffer").Buffer)},{"./bitpacker":77,"./constants":79,"./crc":80,"./filter-pack":81,buffer:4,zlib:41}],90:[function(e,t,n){"use strict";t.exports=function(e,t,n){var r=e+t-n,i=Math.abs(r-e),a=Math.abs(r-t),o=Math.abs(r-n);return i<=a&&i<=o?e:a<=o?t:n}},{}],91:[function(e,t,n){"use strict";var r=e("util"),i=e("zlib"),a=e("./chunkstream"),o=e("./filter-parse-async"),s=e("./parser"),u=e("./bitmapper"),l=e("./format-normaliser"),c=t.exports=function(e){a.call(this),this._parser=new s(e,{read:this.read.bind(this),error:this._handleError.bind(this),metadata:this._handleMetaData.bind(this),gamma:this.emit.bind(this,"gamma"),palette:this._handlePalette.bind(this),transColor:this._handleTransColor.bind(this),finished:this._finished.bind(this),inflateData:this._inflateData.bind(this)}),this._options=e,this.writable=!0,this._parser.start()};r.inherits(c,a),c.prototype._handleError=function(e){this.emit("error",e),this.writable=!1,this.destroy(),this._inflate&&this._inflate.destroy&&this._inflate.destroy(),this.errord=!0},c.prototype._inflateData=function(e){this._inflate||(this._inflate=i.createInflate(),this._inflate.on("error",this.emit.bind(this,"error")),this._filter.on("complete",this._complete.bind(this)),this._inflate.pipe(this._filter)),this._inflate.write(e)},c.prototype._handleMetaData=function(e){this.emit("metadata",e),this._bitmapInfo=Object.create(e),this._filter=new o(this._bitmapInfo)},c.prototype._handleTransColor=function(e){this._bitmapInfo.transColor=e},c.prototype._handlePalette=function(e){this._bitmapInfo.palette=e},c.prototype._finished=function(){this.errord||(this._inflate?this._inflate.end():this.emit("error","No Inflate block"),this.destroySoon())},c.prototype._complete=function(e){if(!this.errord){try{var t=u.dataToBitMap(e,this._bitmapInfo),n=l(t,this._bitmapInfo);t=null}catch(e){return void this._handleError(e)}this.emit("parsed",n)}}},{"./bitmapper":76,"./chunkstream":78,"./filter-parse-async":82,"./format-normaliser":85,"./parser":93,util:135,zlib:41}],92:[function(e,t,n){(function(n){"use strict";var r=!0,i=e("zlib");i.deflateSync||(r=!1);var a=e("./sync-reader"),o=e("./filter-parse-sync"),s=e("./parser"),u=e("./bitmapper"),l=e("./format-normaliser");t.exports=function(e,t){if(!r)throw new Error("To use the sync capability of this library in old node versions, please also add a dependency on node-zlb-backport");var c,f,h;var p=[];var d=new a(e);if(new s(t,{read:d.read.bind(d),error:function(e){c=e},metadata:function(e){f=e},gamma:function(e){h=e},palette:function(e){f.palette=e},transColor:function(e){f.transColor=e},inflateData:function(e){p.push(e)}}).start(),d.process(),c)throw c;var g=n.concat(p);p.length=0;var v=i.inflateSync(g);if(g=null,!v||!v.length)throw new Error("bad png - invalid inflate data response");var m=o.process(v,f);g=null;var _=u.dataToBitMap(m,f);m=null;var w=l(_,f);return f.data=w,f.gamma=h||0,f}}).call(this,e("buffer").Buffer)},{"./bitmapper":76,"./filter-parse-sync":83,"./format-normaliser":85,"./parser":93,"./sync-reader":96,buffer:4,zlib:41}],93:[function(e,t,n){(function(n){"use strict";var r=e("./constants"),i=e("./crc"),a=t.exports=function(e,t){this._options=e,e.checkCRC=!1!==e.checkCRC,this._hasIHDR=!1,this._hasIEND=!1,this._palette=[],this._colorType=0,this._chunks={},this._chunks[r.TYPE_IHDR]=this._handleIHDR.bind(this),this._chunks[r.TYPE_IEND]=this._handleIEND.bind(this),this._chunks[r.TYPE_IDAT]=this._handleIDAT.bind(this),this._chunks[r.TYPE_PLTE]=this._handlePLTE.bind(this),this._chunks[r.TYPE_tRNS]=this._handleTRNS.bind(this),this._chunks[r.TYPE_gAMA]=this._handleGAMA.bind(this),this.read=t.read,this.error=t.error,this.metadata=t.metadata,this.gamma=t.gamma,this.transColor=t.transColor,this.palette=t.palette,this.parsed=t.parsed,this.inflateData=t.inflateData,this.inflateData=t.inflateData,this.finished=t.finished};a.prototype.start=function(){this.read(r.PNG_SIGNATURE.length,this._parseSignature.bind(this))},a.prototype._parseSignature=function(e){for(var t=r.PNG_SIGNATURE,n=0;nthis._palette.length)return void this.error(new Error("More transparent colors than palette size"));for(var t=0;t0?this._handleIDAT(n):this._handleChunkEnd()},a.prototype._handleIEND=function(e){this.read(e,this._parseIEND.bind(this))},a.prototype._parseIEND=function(e){this._crc.write(e),this._hasIEND=!0,this._handleChunkEnd(),this.finished&&this.finished()}}).call(this,e("buffer").Buffer)},{"./constants":79,"./crc":80,buffer:4}],94:[function(e,t,n){"use strict";var r=e("./parser-sync"),i=e("./packer-sync");n.read=function(e,t){return r(e,t||{})},n.write=function(e){return i(e)}},{"./packer-sync":88,"./parser-sync":92}],95:[function(e,t,n){(function(t,r){"use strict";var i=e("util"),a=e("stream"),o=e("./parser-async"),s=e("./packer-async"),u=e("./png-sync"),l=n.PNG=function(e){a.call(this),e=e||{},this.width=e.width||0,this.height=e.height||0,this.data=this.width>0&&this.height>0?new r(4*this.width*this.height):null,e.fill&&this.data&&this.data.fill(0),this.gamma=0,this.readable=this.writable=!0,this._parser=new o(e),this._parser.on("error",this.emit.bind(this,"error")),this._parser.on("close",this._handleClose.bind(this)),this._parser.on("metadata",this._metadata.bind(this)),this._parser.on("gamma",this._gamma.bind(this)),this._parser.on("parsed",function(e){this.data=e,this.emit("parsed",e)}.bind(this)),this._packer=new s(e),this._packer.on("data",this.emit.bind(this,"data")),this._packer.on("end",this.emit.bind(this,"end")),this._parser.on("close",this._handleClose.bind(this)),this._packer.on("error",this.emit.bind(this,"error"))};i.inherits(l,a),l.sync=u,l.prototype.pack=function(){return this.data&&this.data.length?(t.nextTick(function(){this._packer.pack(this.data,this.width,this.height,this.gamma)}.bind(this)),this):(this.emit("error","No data provided"),this)},l.prototype.parse=function(e,t){var n,r;t&&(n=function(e){this.removeListener("error",r),this.data=e,t(null,this)}.bind(this),r=function(e){this.removeListener("parsed",n),t(e,null)}.bind(this),this.once("parsed",n),this.once("error",r));return this.end(e),this},l.prototype.write=function(e){return this._parser.write(e),!0},l.prototype.end=function(e){this._parser.end(e)},l.prototype._metadata=function(e){this.width=e.width,this.height=e.height,this.emit("metadata",e)},l.prototype._gamma=function(e){this.gamma=e},l.prototype._handleClose=function(){this._parser.writable||this._packer.readable||this.emit("close")},l.bitblt=function(e,t,n,r,i,a,o,s){if(n>e.width||r>e.height||n+i>e.width||r+a>e.height)throw new Error("bitblt reading outside image");if(o>t.width||s>t.height||o+i>t.width||s+a>t.height)throw new Error("bitblt writing outside image");for(var u=0;u0&&this._buffer.length;){var e=this._reads[0];if(!this._buffer.length||!(this._buffer.length>=e.length||e.allowLess))break;this._reads.shift();var t=this._buffer;this._buffer=t.slice(e.length),e.func.call(this,t.slice(0,e.length))}return this._reads.length>0?new Error("There are some read requests waitng on finished stream"):this._buffer.length>0?new Error("unrecognised content at end of stream"):void 0}},{}],97:[function(e,t,n){(function(e){"use strict";!e.version||0===e.version.indexOf("v0.")||0===e.version.indexOf("v1.")&&0!==e.version.indexOf("v1.8.")?t.exports={nextTick:function(t,n,r,i){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var a,o,s=arguments.length;switch(s){case 0:case 1:return e.nextTick(t);case 2:return e.nextTick(function(){t.call(null,n)});case 3:return e.nextTick(function(){t.call(null,n,r)});case 4:return e.nextTick(function(){t.call(null,n,r,i)});default:for(a=new Array(s-1),o=0;o1)for(var n=1;n0?d(e):b(e)}(e,t);else if(t.objectMode||r&&r.length>0)if(t.ended&&!o){var u=new Error("stream.push() after EOF");e.emit("error",u)}else if(t.endEmitted&&o){u=new Error("stream.unshift() after end event");e.emit("error",u)}else!t.decoder||o||a||(r=t.decoder.write(r)),t.length+=t.objectMode?1:r.length,o?t.buffer.unshift(r):(t.reading=!1,t.buffer.push(r)),t.needReadable&&d(e),function(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(function(){!function(e,t){var n=t.length;for(;!t.reading&&!t.flowing&&!t.ended&&t.lengtht.highWaterMark&&(t.highWaterMark=function(e){if(e>=h)e=h;else{e--;for(var t=1;t<32;t<<=1)e|=e>>t;e++}return e}(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function d(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,t.sync?n.nextTick(function(){g(e)}):g(e))}function g(e){e.emit("readable")}function v(e){var t,n=e._readableState;function r(e,r,i){!1===e.write(t)&&n.awaitDrain++}for(n.awaitDrain=0;n.pipesCount&&null!==(t=e.read());)if(1===n.pipesCount?r(n.pipes):y(n.pipes,r),e.emit("data",t),n.awaitDrain>0)return;if(0===n.pipesCount)return n.flowing=!1,void(a.listenerCount(e,"data")>0&&_(e));n.ranOut=!0}function m(){this._readableState.ranOut&&(this._readableState.ranOut=!1,v(this))}function _(e,t){if(e._readableState.flowing)throw new Error("Cannot switch to old mode now.");var r=t||!1,i=!1;e.readable=!0,e.pipe=s.prototype.pipe,e.on=e.addListener=s.prototype.on,e.on("readable",function(){var t;for(i=!0;!r&&null!==(t=e.read());)e.emit("data",t);null===t&&(i=!1,e._readableState.needReadable=!0)}),e.pause=function(){r=!0,this.emit("pause")},e.resume=function(){r=!1,i?n.nextTick(function(){e.emit("readable")}):this.read(0),this.emit("resume")},e.emit("readable")}function w(e,t){var n,r=t.buffer,a=t.length,o=!!t.decoder,s=!!t.objectMode;if(0===r.length)return null;if(0===a)n=null;else if(s)n=r.shift();else if(!e||e>=a)n=o?r.join(""):i.concat(r,a),r.length=0;else{if(e0)throw new Error("endReadable called on non-empty stream");!t.endEmitted&&t.calledRead&&(t.ended=!0,n.nextTick(function(){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}))}function y(e,t){for(var n=0,r=e.length;n0)&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return d(this),null;if(0===(e=p(e,t))&&t.ended)return n=null,t.length>0&&t.decoder&&(n=w(e,t),t.length-=n.length),0===t.length&&b(this),n;var i=t.needReadable;return t.length-e<=t.highWaterMark&&(i=!0),(t.ended||t.reading)&&(i=!1),i&&(t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1),i&&!t.reading&&(e=p(r,t)),null===(n=e>0?w(e,t):null)&&(t.needReadable=!0,e=0),t.length-=e,0!==t.length||t.ended||(t.needReadable=!0),t.ended&&!t.endEmitted&&0===t.length&&b(this),n},c.prototype._read=function(e){this.emit("error",new Error("not implemented"))},c.prototype.pipe=function(e,t){var i=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1;var s=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?l:f;function u(e){e===i&&f()}function l(){e.end()}o.endEmitted?n.nextTick(s):i.once("end",s),e.on("unpipe",u);var c=function(e){return function(){var t=e._readableState;t.awaitDrain--,0===t.awaitDrain&&v(e)}}(i);function f(){e.removeListener("close",p),e.removeListener("finish",d),e.removeListener("drain",c),e.removeListener("error",h),e.removeListener("unpipe",u),i.removeListener("end",l),i.removeListener("end",f),e._writableState&&!e._writableState.needDrain||c()}function h(t){g(),e.removeListener("error",h),0===a.listenerCount(e,"error")&&e.emit("error",t)}function p(){e.removeListener("finish",d),g()}function d(){e.removeListener("close",p),g()}function g(){i.unpipe(e)}return e.on("drain",c),e._events&&e._events.error?r(e._events.error)?e._events.error.unshift(h):e._events.error=[h,e._events.error]:e.on("error",h),e.once("close",p),e.once("finish",d),e.emit("pipe",i),o.flowing||(this.on("readable",m),o.flowing=!0,n.nextTick(function(){v(i)})),e},c.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,this.removeListener("readable",m),t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,this.removeListener("readable",m),t.flowing=!1;for(var i=0;i0&&!e[o-1];)o--;a.push({children:[],index:0});var s,u=a[0];for(n=0;n0;)u=a.pop();for(u.index++,a.push(u);a.length<=n;)a.push(s={children:[],index:0}),u.children[u.index]=s.children,u=s;i++}n+10)return p>>--d&1;if(255==(p=t[n++])){var e=t[n++];if(e)throw"unexpected marker: "+(p<<8|e).toString(16)}return d=7,p>>>7}function v(e){for(var t,n=e;null!==(t=g());){if("number"==typeof(n=n[t]))return n;if("object"!=typeof n)throw"invalid huffman sequence"}return null}function m(e){for(var t=0;e>0;){var n=g();if(null===n)return;t=t<<1|n,e--}return t}function _(e){var t=m(e);return t>=1<0)w--;else for(var r=o,i=s;r<=i;){var a=v(t.huffmanTableAC),u=15&a,c=a>>4;if(0!==u)n[e[r+=c]]=_(u)*(1<>4,0===f)a<15?(w=m(a)+(1<>4;if(0!==s)n[e[a+=u]]=_(s),a++;else{if(u<15)break;a+=16}}};var R,L,B,C,O=0;for(L=1==j?i[0].blocksPerLine*i[0].blocksPerColumn:c*r.mcusPerColumn,a||(a=L);O=65488&&R<=65495))break;n+=2}return n-h}function h(e,l){var c,f,h=[],p=l.blocksPerLine,d=l.blocksPerColumn,g=p<<3,v=new Int32Array(64),m=new Uint8Array(64);function _(e,c,f){var h,p,d,g,v,m,_,w,b,y,x=l.quantizationTable,k=f;for(y=0;y<64;y++)k[y]=e[y]*x[y];for(y=0;y<8;++y){var E=8*y;0!=k[1+E]||0!=k[2+E]||0!=k[3+E]||0!=k[4+E]||0!=k[5+E]||0!=k[6+E]||0!=k[7+E]?(h=s*k[0+E]+128>>8,p=s*k[4+E]+128>>8,d=k[2+E],g=k[6+E],v=u*(k[1+E]-k[7+E])+128>>8,w=u*(k[1+E]+k[7+E])+128>>8,m=k[3+E]<<4,_=k[5+E]<<4,b=h-p+1>>1,h=h+p+1>>1,p=b,b=d*o+g*a+128>>8,d=d*a-g*o+128>>8,g=b,b=v-_+1>>1,v=v+_+1>>1,_=b,b=w+m+1>>1,m=w-m+1>>1,w=b,b=h-g+1>>1,h=h+g+1>>1,g=b,b=p-d+1>>1,p=p+d+1>>1,d=b,b=v*i+w*r+2048>>12,v=v*r-w*i+2048>>12,w=b,b=m*n+_*t+2048>>12,m=m*t-_*n+2048>>12,_=b,k[0+E]=h+w,k[7+E]=h-w,k[1+E]=p+_,k[6+E]=p-_,k[2+E]=d+m,k[5+E]=d-m,k[3+E]=g+v,k[4+E]=g-v):(b=s*k[0+E]+512>>10,k[0+E]=b,k[1+E]=b,k[2+E]=b,k[3+E]=b,k[4+E]=b,k[5+E]=b,k[6+E]=b,k[7+E]=b)}for(y=0;y<8;++y){var S=y;0!=k[8+S]||0!=k[16+S]||0!=k[24+S]||0!=k[32+S]||0!=k[40+S]||0!=k[48+S]||0!=k[56+S]?(h=s*k[0+S]+2048>>12,p=s*k[32+S]+2048>>12,d=k[16+S],g=k[48+S],v=u*(k[8+S]-k[56+S])+2048>>12,w=u*(k[8+S]+k[56+S])+2048>>12,m=k[24+S],_=k[40+S],b=h-p+1>>1,h=h+p+1>>1,p=b,b=d*o+g*a+2048>>12,d=d*a-g*o+2048>>12,g=b,b=v-_+1>>1,v=v+_+1>>1,_=b,b=w+m+1>>1,m=w-m+1>>1,w=b,b=h-g+1>>1,h=h+g+1>>1,g=b,b=p-d+1>>1,p=p+d+1>>1,d=b,b=v*i+w*r+2048>>12,v=v*r-w*i+2048>>12,w=b,b=m*n+_*t+2048>>12,m=m*t-_*n+2048>>12,_=b,k[0+S]=h+w,k[56+S]=h-w,k[8+S]=p+_,k[48+S]=p-_,k[16+S]=d+m,k[40+S]=d-m,k[24+S]=g+v,k[32+S]=g-v):(b=s*f[y+0]+8192>>14,k[0+S]=b,k[8+S]=b,k[16+S]=b,k[24+S]=b,k[32+S]=b,k[40+S]=b,k[48+S]=b,k[56+S]=b)}for(y=0;y<64;++y){var A=128+(k[y]+8>>4);c[y]=A<0?0:A>255?255:A}}for(var w=0;w255?255:e}return l.prototype={load:function(e){var t=new XMLHttpRequest;t.open("GET",e,!0),t.responseType="arraybuffer",t.onload=function(){var e=new Uint8Array(t.response||t.mozResponseArrayBuffer);this.parse(e),this.onload&&this.onload()}.bind(this),t.send(null)},parse:function(t){var n=0;t.length;function r(){var e=t[n]<<8|t[n+1];return n+=2,e}function i(){var e=r(),i=t.subarray(n,n+e-2);return n+=i.length,i}function a(e){var t,n,r=0,i=0;for(n in e.components)e.components.hasOwnProperty(n)&&(r<(t=e.components[n]).h&&(r=t.h),i>4==0)for(_=0;_<64;_++){x[e[_]]=t[n++]}else{if(y>>4!=1)throw"DQT: invalid table spec";for(_=0;_<64;_++){x[e[_]]=r()}}p[15&y]=x}break;case 65472:case 65473:case 65474:r(),(o={}).extended=65473===m,o.progressive=65474===m,o.precision=t[n++],o.scanLines=r(),o.samplesPerLine=r(),o.components={},o.componentsOrder=[];var k,E=t[n++];for(P=0;P>4,A=15&t[n+1],T=t[n+2];o.componentsOrder.push(k),o.components[k]={h:S,v:A,quantizationTable:p[T]},n+=3}a(o),d.push(o);break;case 65476:var M=r();for(P=2;P>4==0?v:g)[15&I]=c(j,L)}break;case 65501:r(),s=r();break;case 65498:r();var B=t[n++],C=[];for(P=0;P>4],U.huffmanTableAC=g[15&O],C.push(U)}var z=t[n++],D=t[n++],F=t[n++],N=f(t,n,o,C,s,z,D,F>>4,15&F);n+=N;break;default:if(255==t[n-3]&&t[n-2]>=192&&t[n-2]<=254){n-=3;break}throw"unknown JPEG marker "+m.toString(16)}m=r()}if(1!=d.length)throw"only single frame JPEGs supported";this.width=o.samplesPerLine,this.height=o.scanLines,this.jfif=u,this.adobe=l,this.components=[];for(var P=0;P=0;)t&1<>8&255),O(255&e)}function D(e,t,n,r,i){var a,o=i[0],s=i[240];for(var u=function(e,t){var n,r,i,a,o,s,u,l,c,f,h=0;for(c=0;c<8;++c){n=e[h],r=e[h+1],i=e[h+2],a=e[h+3],o=e[h+4],s=e[h+5],u=e[h+6];var p=n+(l=e[h+7]),g=n-l,v=r+u,m=r-u,_=i+s,w=i-s,b=a+o,y=a-o,x=p+b,k=p-b,E=v+_,S=v-_;e[h]=x+E,e[h+4]=x-E;var A=.707106781*(S+k);e[h+2]=k+A,e[h+6]=k-A;var T=.382683433*((x=y+w)-(S=m+g)),M=.5411961*x+T,I=1.306562965*S+T,j=.707106781*(E=w+m),R=g+j,L=g-j;e[h+5]=L+M,e[h+3]=L-M,e[h+1]=R+I,e[h+7]=R-I,h+=8}for(h=0,c=0;c<8;++c){n=e[h],r=e[h+8],i=e[h+16],a=e[h+24],o=e[h+32],s=e[h+40],u=e[h+48];var B=n+(l=e[h+56]),C=n-l,O=r+u,z=r-u,D=i+s,F=i-s,N=a+o,P=a-o,U=B+N,q=B-N,V=O+D,Z=O-D;e[h]=U+V,e[h+32]=U-V;var W=.707106781*(Z+q);e[h+16]=q+W,e[h+48]=q-W;var G=.382683433*((U=P+F)-(Z=z+C)),H=.5411961*U+G,Y=1.306562965*Z+G,$=.707106781*(V=F+z),X=C+$,J=C-$;e[h+40]=J+H,e[h+24]=J-H,e[h+8]=X+Y,e[h+56]=X-Y,h++}for(c=0;c<64;++c)f=e[c]*t[c],d[c]=f>0?f+.5|0:f-.5|0;return d}(e,t),l=0;l<64;++l)g[E[l]]=u[l];var c=g[0]-n;n=g[0],0==c?C(r[0]):(C(r[p[a=32767+c]]),C(h[a]));for(var f=63;f>0&&0==g[f];f--);if(0==f)return C(o),n;for(var v,m=1;m<=f;){for(var _=m;0==g[m]&&m<=f;++m);var w=m-_;if(w>=16){v=w>>4;for(var b=1;b<=v;++b)C(s);w&=15}a=32767+g[m],C(i[(w<<4)+p[a]]),C(h[a]),m++}return 63!=f&&C(o),n}function F(e){if(e<=0&&(e=1),e>100&&(e=100),o!=e){(function(e){for(var t=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],n=0;n<64;n++){var r=s((t[n]*e+50)/100);r<1?r=1:r>255&&(r=255),u[E[n]]=r}for(var i=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],a=0;a<64;a++){var o=s((i[a]*e+50)/100);o<1?o=1:o>255&&(o=255),l[E[a]]=o}for(var h=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],p=0,d=0;d<8;d++)for(var g=0;g<8;g++)c[p]=1/(u[E[p]]*h[d]*h[g]*8),f[p]=1/(l[E[p]]*h[d]*h[g]*8),p++})(e<50?Math.floor(5e3/e):Math.floor(200-2*e)),o=e}}this.encode=function(t,o){(new Date).getTime();o&&F(o),v=new Array,m=0,_=7,z(65496),z(65504),z(16),O(74),O(70),O(73),O(70),O(0),O(1),O(1),O(0),z(1),z(1),O(0),O(0),function(){z(65499),z(132),O(0);for(var e=0;e<64;e++)O(u[e]);O(1);for(var t=0;t<64;t++)O(l[t])}(),function(e,t){z(65472),z(17),O(8),z(t),z(e),O(3),O(1),O(17),O(0),O(2),O(17),O(1),O(3),O(17),O(1)}(t.width,t.height),function(){z(65476),z(418),O(0);for(var e=0;e<16;e++)O(S[e+1]);for(var t=0;t<=11;t++)O(A[t]);O(16);for(var n=0;n<16;n++)O(T[n+1]);for(var r=0;r<=161;r++)O(M[r]);O(1);for(var i=0;i<16;i++)O(I[i+1]);for(var a=0;a<=11;a++)O(j[a]);O(17);for(var o=0;o<16;o++)O(R[o+1]);for(var s=0;s<=161;s++)O(L[s])}(),z(65498),z(12),O(3),O(1),O(0),O(2),O(17),O(3),O(17),O(0),O(63),O(0);var s=0,h=0,p=0;m=0,_=7,this.encode.displayName="_encode_";for(var d,g,x,E,B,N,P,U,q,V=t.data,Z=t.width,W=t.height,G=4*Z,H=0;H>3)*G+(P=4*(7&q)),H+U>=W&&(N-=G*(H+1+U-W)),d+P>=G&&(N-=d+P-G+4),g=V[N++],x=V[N++],E=V[N++],w[q]=(k[g]+k[x+256>>0]+k[E+512>>0]>>16)-128,b[q]=(k[g+768>>0]+k[x+1024>>0]+k[E+1280>>0]>>16)-128,y[q]=(k[g+1280>>0]+k[x+1536>>0]+k[E+1792>>0]>>16)-128;s=D(w,c,s,n,i),h=D(b,f,h,r,a),p=D(y,f,p,r,a),d+=32}H+=8}if(_>=0){var Y=[];Y[1]=_+1,Y[0]=(1<<_+1)-1,C(Y)}return z(65497),new e(v)},function(){(new Date).getTime();t||(t=50),function(){for(var e=String.fromCharCode,t=0;t<256;t++)x[t]=e(t)}(),n=B(S,A),r=B(I,j),i=B(T,M),a=B(R,L),function(){for(var e=1,t=2,n=1;n<=15;n++){for(var r=e;r>0]=38470*e,k[e+512>>0]=7471*e+32768,k[e+768>>0]=-11059*e,k[e+1024>>0]=-21709*e,k[e+1280>>0]=32768*e+8421375,k[e+1536>>0]=-27439*e,k[e+1792>>0]=-5329*e}(),F(t),(new Date).getTime()}()}t.exports=function(e,t){void 0===t&&(t=50);return{data:new n(t).encode(e,t),width:e.width,height:e.height}}}).call(this,e("buffer").Buffer)},{buffer:4}],111:[function(e,t,n){(function(n){"use strict";var r=e("contentstream"),i=e("gif-encoder"),a=e("jpeg-js"),o=e("pngjs-nozlib").PNG,s=e("ndarray"),u=e("ndarray-ops"),l=e("through");function c(e,t,n){if(4===e.shape.length)return c(e.pick(n),t,0);if(3===e.shape.length)if(3===e.shape[2])u.assign(s(t,[e.shape[0],e.shape[1],3],[4,4*e.shape[0],1]),e),u.assigns(s(t,[e.shape[0]*e.shape[1]],[4],3),255);else if(4===e.shape[2])u.assign(s(t,[e.shape[0],e.shape[1],4],[4,4*e.shape[0],1]),e);else{if(1!==e.shape[2])return new Error("Incompatible array shape");u.assign(s(t,[e.shape[0],e.shape[1],3],[4,4*e.shape[0],1]),s(e.data,[e.shape[0],e.shape[1],3],[e.stride[0],e.stride[1],0],e.offset)),u.assigns(s(t,[e.shape[0]*e.shape[1]],[4],3),255)}else{if(2!==e.shape.length)return new Error("Incompatible array shape");u.assign(s(t,[e.shape[0],e.shape[1],3],[4,4*e.shape[0],1]),s(e.data,[e.shape[0],e.shape[1],3],[e.stride[0],e.stride[1],0],e.offset)),u.assigns(s(t,[e.shape[0]*e.shape[1]],[4],3),255)}return t}function f(e){var t=l();return t.emit("error",e),t}t.exports=function(e,t,s){switch(s=s||{},t.toUpperCase()){case"JPG":case".JPG":case"JPEG":case".JPEG":case"JPE":case".JPE":var u=e.shape[0],l=e.shape[1],h={data:g=c(e,g=new n(u*l*4)),width:u,height:l},p=a.encode(h,s.quality);return new r(p.data);case"GIF":case".GIF":var d=4===e.shape.length?e.shape[0]:1,g=(u=4===e.shape.length?e.shape[1]:e.shape[0],l=4===e.shape.length?e.shape[2]:e.shape[1],new n(u*l*4)),v=new i(u,l);v.writeHeader();for(var m=0;m0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===l.prototype||(t=function(e){return l.from(e)}(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):y(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?y(e,o,t,!1):A(e,o)):y(e,o,t,!1))):r||(o.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=x?e=x:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function E(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(p("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(S,e):S(e))}function S(e){p("emit readable"),e.emit("readable"),j(e)}function A(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(T,e,t))}function T(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;ea.length?a.length:e;if(o===a.length?i+=a:i+=a.slice(0,e),0===(e-=o)){o===a.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=a.slice(o));break}++r}return t.length-=r,i}(e,t):function(e,t){var n=l.allocUnsafe(e),r=t.head,i=1;r.data.copy(n),e-=r.data.length;for(;r=r.next;){var a=r.data,o=e>a.length?a.length:e;if(a.copy(n,n.length-e,0,o),0===(e-=o)){o===a.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=a.slice(o));break}++i}return t.length-=i,n}(e,t);return r}(e,t.buffer,t.decoder),n);var n}function L(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(B,t,e))}function B(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function C(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return p("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?L(this):E(this),null;if(0===(e=k(e,t))&&t.ended)return 0===t.length&&L(this),null;var r,i=t.needReadable;return p("need readable",i),(0===t.length||t.length-e0?R(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&L(this)),null!==r&&this.emit("data",r),r},w.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},w.prototype.pipe=function(e,t){var r=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=e;break;case 1:a.pipes=[a.pipes,e];break;default:a.pipes.push(e)}a.pipesCount+=1,p("pipe count=%d opts=%j",a.pipesCount,t);var u=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?c:w;function l(t,n){p("onunpipe"),t===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,p("cleanup"),e.removeListener("close",m),e.removeListener("finish",_),e.removeListener("drain",f),e.removeListener("error",v),e.removeListener("unpipe",l),r.removeListener("end",c),r.removeListener("end",w),r.removeListener("data",g),h=!0,!a.awaitDrain||e._writableState&&!e._writableState.needDrain||f())}function c(){p("onend"),e.end()}a.endEmitted?i.nextTick(u):r.once("end",u),e.on("unpipe",l);var f=function(e){return function(){var t=e._readableState;p("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&s(e,"data")&&(t.flowing=!0,j(e))}}(r);e.on("drain",f);var h=!1;var d=!1;function g(t){p("ondata"),d=!1,!1!==e.write(t)||d||((1===a.pipesCount&&a.pipes===e||a.pipesCount>1&&-1!==C(a.pipes,e))&&!h&&(p("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,d=!0),r.pause())}function v(t){p("onerror",t),w(),e.removeListener("error",v),0===s(e,"error")&&e.emit("error",t)}function m(){e.removeListener("finish",_),w()}function _(){p("onfinish"),e.removeListener("close",m),w()}function w(){p("unpipe"),r.unpipe(e)}return r.on("data",g),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",v),e.once("close",m),e.once("finish",_),e.emit("pipe",r),a.flowing||(p("pipe resume"),r.resume()),e},w.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var a=0;a-1?i:a.nextTick;_.WritableState=m;var l=e("core-util-is");l.inherits=e("inherits");var c={deprecate:e("util-deprecate")},f=e("./internal/streams/stream"),h=e("safe-buffer").Buffer,p=r.Uint8Array||function(){};var d,g=e("./internal/streams/destroy");function v(){}function m(t,n){s=s||e("./_stream_duplex"),t=t||{};var r=n instanceof s;this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var i=t.highWaterMark,l=t.writableHighWaterMark,c=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(l||0===l)?l:c,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var f=!1===t.decodeStrings;this.decodeStrings=!f,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,i){--t.pendingcb,n?(a.nextTick(i,r),a.nextTick(E,e,t),e._writableState.errorEmitted=!0,e.emit("error",r)):(i(r),e._writableState.errorEmitted=!0,e.emit("error",r),E(e,t))}(e,n,r,t,i);else{var o=x(n);o||n.corked||n.bufferProcessing||!n.bufferedRequest||y(e,n),r?u(b,e,n,o,i):b(e,n,o,i)}}(n,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function _(t){if(s=s||e("./_stream_duplex"),!(d.call(_,this)||this instanceof s))return new _(t);this._writableState=new m(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),f.call(this)}function w(e,t,n,r,i,a,o){t.writelen=r,t.writecb=o,t.writing=!0,t.sync=!0,n?e._writev(i,t.onwrite):e._write(i,a,t.onwrite),t.sync=!1}function b(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),E(e,t)}function y(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,i=new Array(r),a=t.corkedRequestsFree;a.entry=n;for(var s=0,u=!0;n;)i[s]=n,n.isBuf||(u=!1),n=n.next,s+=1;i.allBuffers=u,w(e,t,!0,t.length,i,"",a.finish),t.pendingcb++,t.lastBufferedRequest=null,a.next?(t.corkedRequestsFree=a.next,a.next=null):t.corkedRequestsFree=new o(t),t.bufferedRequestCount=0}else{for(;n;){var l=n.chunk,c=n.encoding,f=n.callback;if(w(e,t,!1,t.objectMode?1:l.length,l,c,f),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function x(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function k(e,t){e._final(function(n){t.pendingcb--,n&&e.emit("error",n),t.prefinished=!0,e.emit("prefinish"),E(e,t)})}function E(e,t){var n=x(t);return n&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,a.nextTick(k,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),n}l.inherits(_,f),m.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(m.prototype,"buffer",{get:c.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(d=Function.prototype[Symbol.hasInstance],Object.defineProperty(_,Symbol.hasInstance,{value:function(e){return!!d.call(this,e)||this===_&&(e&&e._writableState instanceof m)}})):d=function(e){return e instanceof this},_.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},_.prototype.write=function(e,t,n){var r,i=this._writableState,o=!1,s=!i.objectMode&&(r=e,h.isBuffer(r)||r instanceof p);return s&&!h.isBuffer(e)&&(e=function(e){return h.from(e)}(e)),"function"==typeof t&&(n=t,t=null),s?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof n&&(n=v),i.ended?function(e,t){var n=new Error("write after end");e.emit("error",n),a.nextTick(t,n)}(this,n):(s||function(e,t,n,r){var i=!0,o=!1;return null===n?o=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(e.emit("error",o),a.nextTick(r,o),i=!1),i}(this,i,e,n))&&(i.pendingcb++,o=function(e,t,n,r,i,a){if(!n){var o=function(e,t,n){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n));return t}(t,r,i);r!==o&&(n=!0,i="buffer",r=o)}var s=t.objectMode?1:r.length;t.length+=s;var u=t.length-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(e,t,n){t.ending=!0,E(e,t),n&&(t.finished?a.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=g.destroy,_.prototype._undestroy=g.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("timers").setImmediate)},{"./_stream_duplex":114,"./internal/streams/destroy":120,"./internal/streams/stream":121,_process:98,"core-util-is":8,inherits:57,"process-nextick-args":97,"safe-buffer":107,timers:128,"util-deprecate":133}],119:[function(e,t,n){"use strict";var r=e("safe-buffer").Buffer,i=e("util");t.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},e.prototype.concat=function(e){if(0===this.length)return r.alloc(0);if(1===this.length)return this.head.data;for(var t,n,i,a=r.allocUnsafe(e>>>0),o=this.head,s=0;o;)t=o.data,n=a,i=s,t.copy(n,i),s+=o.data.length,o=o.next;return a},e}(),i&&i.inspect&&i.inspect.custom&&(t.exports.prototype[i.inspect.custom]=function(){var e=i.inspect({length:this.length});return this.constructor.name+" "+e})},{"safe-buffer":107,util:3}],120:[function(e,t,n){"use strict";var r=e("process-nextick-args");function i(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var n=this,a=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return a||o?(t?t(e):!e||this._writableState&&this._writableState.errorEmitted||r.nextTick(i,this,e),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?(r.nextTick(i,n,e),n._writableState&&(n._writableState.errorEmitted=!0)):t&&t(e)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},{"process-nextick-args":97}],121:[function(e,t,n){t.exports=e("events").EventEmitter},{events:43}],122:[function(e,t,n){t.exports=e("./readable").PassThrough},{"./readable":123}],123:[function(e,t,n){(n=t.exports=e("./lib/_stream_readable.js")).Stream=n,n.Readable=n,n.Writable=e("./lib/_stream_writable.js"),n.Duplex=e("./lib/_stream_duplex.js"),n.Transform=e("./lib/_stream_transform.js"),n.PassThrough=e("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":114,"./lib/_stream_passthrough.js":115,"./lib/_stream_readable.js":116,"./lib/_stream_transform.js":117,"./lib/_stream_writable.js":118}],124:[function(e,t,n){t.exports=e("./readable").Transform},{"./readable":123}],125:[function(e,t,n){t.exports=e("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":118}],126:[function(e,t,n){"use strict";var r=e("safe-buffer").Buffer,i=r.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){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!0;default:return!1}};function a(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(r.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=u,this.end=l,t=4;break;case"utf8":this.fillLast=s,t=4;break;case"base64":this.text=c,this.end=f,t=3;break;default:return this.write=h,void(this.end=p)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(t)}function o(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function s(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function u(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function l(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function c(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function f(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function h(e){return e.toString(this.encoding)}function p(e){return e&&e.length?this.write(e):""}n.StringDecoder=a,a.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0)return i>0&&(e.lastNeed=i-1),i;if(--r=0)return i>0&&(e.lastNeed=i-2),i;if(--r=0)return i>0&&(2===i?i=0:e.lastNeed=i-3),i;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)},a.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},{"safe-buffer":107}],127:[function(e,t,n){(function(n){var r=e("stream");function i(e,t,i){e=e||function(e){this.queue(e)},t=t||function(){this.queue(null)};var a=!1,o=!1,s=[],u=!1,l=new r;function c(){for(;s.length&&!l.paused;){var e=s.shift();if(null===e)return l.emit("end");l.emit("data",e)}}return l.readable=l.writable=!0,l.paused=!1,l.autoDestroy=!(i&&!1===i.autoDestroy),l.write=function(t){return e.call(this,t),!l.paused},l.queue=l.push=function(e){return u?l:(null===e&&(u=!0),s.push(e),c(),l)},l.on("end",function(){l.readable=!1,!l.writable&&l.autoDestroy&&n.nextTick(function(){l.destroy()})}),l.end=function(e){if(!a)return a=!0,arguments.length&&l.write(e),l.writable=!1,t.call(l),!l.readable&&l.autoDestroy&&l.destroy(),l},l.destroy=function(){if(!o)return o=!0,a=!0,s.length=0,l.writable=l.readable=!1,l.emit("close"),l},l.pause=function(){if(!l.paused)return l.paused=!0,l},l.resume=function(){return l.paused&&(l.paused=!1,l.emit("resume")),c(),l.paused||l.emit("drain"),l},l}t.exports=i,i.through=i}).call(this,e("_process"))},{_process:98,stream:112}],128:[function(e,t,n){(function(t,r){var i=e("process/browser.js").nextTick,a=Function.prototype.apply,o=Array.prototype.slice,s={},u=0;function l(e,t){this._id=e,this._clearFn=t}n.setTimeout=function(){return new l(a.call(setTimeout,window,arguments),clearTimeout)},n.setInterval=function(){return new l(a.call(setInterval,window,arguments),clearInterval)},n.clearTimeout=n.clearInterval=function(e){e.close()},l.prototype.unref=l.prototype.ref=function(){},l.prototype.close=function(){this._clearFn.call(window,this._id)},n.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},n.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},n._unrefActive=n.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},n.setImmediate="function"==typeof t?t:function(e){var t=u++,r=!(arguments.length<2)&&o.call(arguments,1);return s[t]=!0,i(function(){s[t]&&(r?e.apply(null,r):e.call(null),n.clearImmediate(t))}),t},n.clearImmediate="function"==typeof r?r:function(e){delete s[e]}}).call(this,e("timers").setImmediate,e("timers").clearImmediate)},{"process/browser.js":98,timers:128}],129:[function(e,t,n){n.isatty=function(){return!1},n.ReadStream=function(){throw new Error("tty.ReadStream is not implemented")},n.WriteStream=function(){throw new Error("tty.WriteStream is not implemented")}},{}],130:[function(e,t,n){(function(t,r){"use strict";var i=e("bit-twiddle"),a=e("dup");t.__TYPEDARRAY_POOL||(t.__TYPEDARRAY_POOL={UINT8:a([32,0]),UINT16:a([32,0]),UINT32:a([32,0]),INT8:a([32,0]),INT16:a([32,0]),INT32:a([32,0]),FLOAT:a([32,0]),DOUBLE:a([32,0]),DATA:a([32,0]),UINT8C:a([32,0]),BUFFER:a([32,0])});var o="undefined"!=typeof Uint8ClampedArray,s=t.__TYPEDARRAY_POOL;s.UINT8C||(s.UINT8C=a([32,0])),s.BUFFER||(s.BUFFER=a([32,0]));var u=s.DATA,l=s.BUFFER;function c(e){if(e){var t=e.length||e.byteLength,n=i.log2(t);u[n].push(e)}}function f(e){e=i.nextPow2(e);var t=i.log2(e),n=u[t];return n.length>0?n.pop():new ArrayBuffer(e)}function h(e){return new Uint8Array(f(e),0,e)}function p(e){return new Uint16Array(f(2*e),0,e)}function d(e){return new Uint32Array(f(4*e),0,e)}function g(e){return new Int8Array(f(e),0,e)}function v(e){return new Int16Array(f(2*e),0,e)}function m(e){return new Int32Array(f(4*e),0,e)}function _(e){return new Float32Array(f(4*e),0,e)}function w(e){return new Float64Array(f(8*e),0,e)}function b(e){return o?new Uint8ClampedArray(f(e),0,e):h(e)}function y(e){return new DataView(f(e),0,e)}function x(e){e=i.nextPow2(e);var t=i.log2(e),n=l[t];return n.length>0?n.pop():new r(e)}n.free=function(e){if(r.isBuffer(e))l[i.log2(e.length)].push(e);else{if("[object ArrayBuffer]"!==Object.prototype.toString.call(e)&&(e=e.buffer),!e)return;var t=e.length||e.byteLength,n=0|i.log2(t);u[n].push(e)}},n.freeUint8=n.freeUint16=n.freeUint32=n.freeInt8=n.freeInt16=n.freeInt32=n.freeFloat32=n.freeFloat=n.freeFloat64=n.freeDouble=n.freeUint8Clamped=n.freeDataView=function(e){c(e.buffer)},n.freeArrayBuffer=c,n.freeBuffer=function(e){l[i.log2(e.length)].push(e)},n.malloc=function(e,t){if(void 0===t||"arraybuffer"===t)return f(e);switch(t){case"uint8":return h(e);case"uint16":return p(e);case"uint32":return d(e);case"int8":return g(e);case"int16":return v(e);case"int32":return m(e);case"float":case"float32":return _(e);case"double":case"float64":return w(e);case"uint8_clamped":return b(e);case"buffer":return x(e);case"data":case"dataview":return y(e);default:return null}return null},n.mallocArrayBuffer=f,n.mallocUint8=h,n.mallocUint16=p,n.mallocUint32=d,n.mallocInt8=g,n.mallocInt16=v,n.mallocInt32=m,n.mallocFloat32=n.mallocFloat=_,n.mallocFloat64=n.mallocDouble=w,n.mallocUint8Clamped=b,n.mallocDataView=y,n.mallocBuffer=x,n.clearCache=function(){for(var e=0;e<32;++e)s.UINT8[e].length=0,s.UINT16[e].length=0,s.UINT32[e].length=0,s.INT8[e].length=0,s.INT16[e].length=0,s.INT32[e].length=0,s.FLOAT[e].length=0,s.DOUBLE[e].length=0,s.UINT8C[e].length=0,u[e].length=0,l[e].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer)},{"bit-twiddle":2,buffer:4,dup:14}],131:[function(e,t,n){"use strict";t.exports=function(e,t,n){return 0===e.length?e:t?(n||e.sort(t),function(e,t){for(var n=1,r=e.length,i=e[0],a=e[0],o=1;o=o?u+1:o}r.mkdir(t+"sequencer"+o,function(){var a=t+"sequencer"+o+"/";for(var s in n.images){var u=n.images[s].steps;if(i){var l=u.slice(-1)[0].output.src,c=u.slice(-1)[0].output.format,f=e("data-uri-to-buffer")(l);r.writeFile(a+s+"_"+(u.length-1)+"."+c,f,function(){})}else for(var h in u){l=u[h].output.src,c=u[h].output.format,f=e("data-uri-to-buffer")(l);r.writeFile(a+s+"_"+h+"."+c,f,function(){})}}})},r.readdir(c,function(e,t){var n=[];if(void 0===t||0==t.length)return f(n),[];for(var i=0;i0&&(thisStep=c[e].steps[t],thisStep.UI.onRemove(thisStep.options.step),c[e].steps.splice(t,1))}function g(){var t=[],n=this;for(var r in arguments)t.push(a(arguments[r]));var i=l.call(this,t,"l");f.push({method:"loadImages",json_q:a(i)});var o=this.copy(i.loadedimages),s={name:"ImageSequencer Wrapper",sequencer:this,addSteps:this.addSteps,removeSteps:this.removeSteps,insertSteps:this.insertSteps,run:this.run,UI:this.UI,setUI:this.setUI,images:o};!function t(r){if(r!=o.length){var a=o[r];e("./ui/LoadImage")(n,a,i.images[a],function(){t(++r)})}else i.callback.call(s)}(0)}function v(e){var t={};if("load-image"==e)return{};if(0==arguments.length){for(var n in this.modules)t[n]=s[n][1];for(var r in this.sequences)t[r]={name:r,steps:u[r]}}else t=s[e]?s[e][1]:{inputs:u[e].options};return t}function m(e){let t=a(v(e.options.name).inputs);t=t||{};for(let n in t)t[n]=e.options[n]||t[n].default,t[n]=encodeURIComponent(t[n]);var n=Object.keys(t).map(e=>e+":"+t[e]).join("|");return`${e.options.name}{${n}}`}function _(e){let t;return(t=e.includes(",")?e.split(","):[e]).map(w)}function w(e){var t;if(t=e.includes("{")?e.includes("(")&&e.indexOf("(")=t.images[u].steps.length?{options:{name:void 0}}:t.images[u].steps.slice(f+e)[0]},t.images[u].steps[f].getIndex=function(){return f},r)r.hasOwnProperty(p)&&(t.images[u].steps[f][p]=r[p]);t.images[u].steps[f].UI.onDraw(t.images[u].steps[f].options.step);var d=e("./RunToolkit")(t.copy(h));t.images[u].steps[f].draw(d,function(){t.images[u].steps[f].options.step.output=t.images[u].steps[f].output.src,t.images[u].steps[f].UI.onComplete(t.images[u].steps[f].options.step),n(a,++s)},o)}}(s,a)}(n=function(e){for(var n in e)0==e[n]&&1==t.images[n].steps.length?delete e[n]:0==e[n]&&e[n]++;for(var n in e)for(var r=t.images[n].steps[e[n]-1];void 0===r||void 0===r.output;)r=t.images[n].steps[--e[n]-1];return e}(n))}},{"./RunToolkit":144,"./util/getStep.js":212}],144:[function(e,t,n){const r=e("get-pixels"),i=e("./modules/_nomodule/PixelManipulation"),a=e("lodash"),o=e("data-uri-to-buffer"),s=e("save-pixels");t.exports=function(e){return e.getPixels=r,e.pixelManipulation=i,e.lodash=a,e.dataUriToBuffer=o,e.savePixels=s,e}},{"./modules/_nomodule/PixelManipulation":207,"data-uri-to-buffer":13,"get-pixels":23,lodash:62,"save-pixels":111}],145:[function(e,t,n){t.exports={sample:[{name:"invert",options:{}},{name:"channel",options:{channel:"red"}},{name:"blur",options:{blur:"5"}}]}},{}],146:[function(e,t,n){t.exports=function(t,n){return t.blur=t.blur||2,t.step.metadata=t.step.metadata||{},{options:t,draw:function(n,r,i){i.stop(!0),i.overrideFlag=!0;var a=this;return e("../_nomodule/PixelManipulation.js")(n,{output:function(e,t,n){a.output={src:t,format:n}},changePixel:function(e,t,n,r){return[e,t,n,r]},extraManipulation:function(e){for(var n=[0,0,0,0],r=0;rAverages (r, g, b, a): "+n.join(", ")+"

"),e},format:n.format,image:t.image,callback:r})},output:void 0,UI:n}}},{"../_nomodule/PixelManipulation.js":207}],147:[function(e,t,n){t.exports=[e("./Module"),e("./info.json")]},{"./Module":146,"./info.json":148}],148:[function(e,t,n){t.exports={name:"Average",description:"Average all pixel color",inputs:{}}},{}],149:[function(require,module,exports){module.exports=function Dynamic(options,UI,util){var output;function draw(input,callback,progressObj){progressObj.stop(!0),progressObj.overrideFlag=!0;var step=this;"string"==typeof options.func&&eval("options.func = "+options.func);var getPixels=require("get-pixels"),priorStep=this.getStep(-2);getPixels(priorStep.output.src,function(e,t){return options.firstImagePixels=t,require("../_nomodule/PixelManipulation.js")(input,{output:function(e,t,n){step.output={src:t,format:n}},changePixel:function(e,t,n,r,i,a){var o=options.firstImagePixels;return options.func(e,t,n,r,o.get(i,a,0),o.get(i,a,1),o.get(i,a,2),o.get(i,a,3))},format:input.format,image:options.image,inBrowser:options.inBrowser,callback:callback})})}return options.func=options.func||"function(r1, g1, b1, a1, r2, g2, b2, a2) { return [ r1, g2, b2, a2 ] }",{options:options,draw:draw,output:output,UI:UI}}},{"../_nomodule/PixelManipulation.js":207,"get-pixels":23}],150:[function(e,t,n){arguments[4][147][0].apply(n,arguments)},{"./Module":149,"./info.json":151,dup:147}],151:[function(e,t,n){t.exports={name:"Blend",description:"Blend the past two image steps with the given function. Defaults to using the red channel from image 1 and the green and blue and alpha channels of image 2. Easier to use interfaces coming soon!",inputs:{blend:{type:"input",desc:"Function to use to blend the two images.",default:"function(r1, g1, b1, a1, r2, g2, b2, a2) { return [ r1, g2, b2, a2 ] }"}}}},{}],152:[function(e,t,n){t.exports=function(e,t){let n=[[2/159,4/159,5/159,4/159,2/159],[4/159,9/159,12/159,9/159,4/159],[5/159,12/159,15/159,12/159,5/159],[4/159,9/159,12/159,9/159,4/159],[2/159,4/159,5/159,4/159,2/159]],r=e;n=function(e){let t=[];for(let n=e.length-1;n>=0;n--){let r=[];for(let t=e[n].length-1;t>=0;t--)r.push(e[n][t]);t.push(r)}return t}(n);for(let t=0;tg;n=0<=g?++c:--c)r[n]=(t-i)/(a-i)*(u[n]-s[n])+s[n];return r}}t.exports=function(e,t){return t.colormap=t.colormap||i.default,"object"==typeof t.colormap?colormapFunction=r(t.colormap):i.hasOwnProperty(t.colormap)?colormapFunction=i[t.colormap]:colormapFunction=i.default,colormapFunction(e/255)};var i={greyscale:r([[0,[0,0,0],[255,255,255]],[1,[255,255,255],[255,255,255]]]),default:r([[0,[0,0,255],[0,255,0]],[.25,[0,255,0],[255,255,0]],[.5,[0,255,255],[255,255,0]],[.75,[255,255,0],[255,0,0]]]),ndvi:r([[0,[0,0,255],[38,195,195]],[.5,[0,150,0],[255,255,0]],[.75,[255,255,0],[255,50,50]]]),stretched:r([[0,[0,0,255],[0,0,255]],[.1,[0,0,255],[38,195,195]],[.5,[0,150,0],[255,255,0]],[.7,[255,255,0],[255,50,50]],[.9,[255,50,50],[255,50,50]]]),fastie:r([[0,[255,255,255],[0,0,0]],[.167,[0,0,0],[255,255,255]],[.33,[255,255,255],[0,0,0]],[.5,[0,0,0],[140,140,255]],[.55,[140,140,255],[0,255,0]],[.63,[0,255,0],[255,255,0]],[.75,[255,255,0],[255,0,0]],[.95,[255,0,0],[255,0,255]]])}},{}],166:[function(e,t,n){t.exports=function(t,n){return{options:t,draw:function(n,r,i){i.stop(!0),i.overrideFlag=!0;var a=this;return e("../_nomodule/PixelManipulation.js")(n,{output:function(e,t,n){a.output={src:t,format:n}},changePixel:function(n,r,i,a){var o=(n+r+i)/3,s=e("./Colormap")(o,t);return[s[0],s[1],s[2],255]},format:n.format,image:t.image,inBrowser:t.inBrowser,callback:r})},output:void 0,UI:n}}},{"../_nomodule/PixelManipulation.js":207,"./Colormap":165}],167:[function(e,t,n){arguments[4][147][0].apply(n,arguments)},{"./Module":166,"./info.json":168,dup:147}],168:[function(e,t,n){t.exports={name:"Colormap",description:"Maps brightness values (average of red, green & blue) to a given color lookup table, made up of a set of one more color gradients.\n\nFor example, 'cooler' colors like blue could represent low values, while 'hot' colors like red could represent high values.",inputs:{colormap:{type:"select",desc:"Name of the Colormap",default:"default",values:["default","greyscale","stretched","fastie"]}}}},{}],169:[function(e,t,n){(function(n){t.exports=function(t,r,i){var a=e("get-pixels"),o=e("save-pixels");r.x=parseInt(r.x)||0,r.y=parseInt(r.y)||0,a(t.src,function(e,a){r.w=parseInt(r.w)||Math.floor(a.shape[0]),r.h=parseInt(r.h)||Math.floor(a.shape[1]);for(var s=r.x,u=r.y,l=r.w,c=r.h,f=a.shape[0],h=new Uint8Array(4*l*c),p=u;pInfragrammar.",inputs:{red:{type:"input",desc:"Expression to return for red channel with R, G, B, and A inputs",default:"r"},green:{type:"input",desc:"Expression to return for green channel with R, G, B, and A inputs",default:"g"},blue:{type:"input",desc:"Expression to return for blue channel with R, G, B, and A inputs",default:"b"},"monochrome (fallback)":{type:"input",desc:"Expression to return with R, G, B, and A inputs; fallback for other channels if none provided",default:"r + g + b"}}}},{}],180:[function(e,t,n){e("lodash");const r=[[-1,0,1],[-2,0,2],[-1,0,1]],i=[[-1,-2,-1],[0,0,0],[1,2,1]];let a,o=[],s=[],u=[],l=[];function c(e,t,n,a,o){let s=0;for(let t=0;t<3;t++)for(let n=0;n<3;n++){let i=a+t-1,u=o+n-1;s+=e.get(i,u,0)*r[t][n]}let u=0;for(let t=0;t<3;t++)for(let n=0;n<3;n++){let r=a+t-1,s=o+n-1;u+=e.get(r,s,0)*i[t][n]}return{pixel:[t,t,t,Math.sqrt(Math.pow(s,2)+Math.pow(u,2))],angle:Math.atan2(u,s)}}t.exports=function(e,t,n,r){a=!r;for(var i=0;ii?s[t][n]>r?u.push(a):l.push(a):e.set(t,n,3,0)}return u.forEach(t=>e.set(t[0],t[1],3,255)),e}(function(e){o=o.map(e=>e.map(f));for(let t=1;t=-22.5&&r<=22.5||r<-157.5&&r>=-180?s[t][n]>=s[t][n+1]&&s[t][n]>=s[t][n-1]?e.set(t,n,3,s[t][n]):e.set(t,n,3,0):r>=22.5&&r<=67.5||r<-112.5&&r>=-157.5?s[t][n]>=s[t+1][n+1]&&s[t][n]>=s[t-1][n-1]?e.set(t,n,3,s[t][n]):e.set(t,n,3,0):r>=67.5&&r<=112.5||r<-67.5&&r>=-112.5?s[t][t]>=s[t+1][n]&&s[t][n]>=s[t][n]?e.set(t,n,3,s[t][n]):e.set(t,n,3,0):(r>=112.5&&r<=157.5||r<-22.5&&r>=-67.5)&&(s[t][n]>=s[t+1][n-1]&&s[t][n]>=s[t-1][n+1]?e.set(t,n,3,s[t][n]):e.set(t,n,3,0))}return e}(e),0,n)};var f=e=>180*e/Math.PI,h=e=>Math.max(...e.map(e=>e.map(e=>e||0)).map(e=>Math.max(...e)))},{lodash:62}],181:[function(e,t,n){t.exports=function(t,n){return t.blur=t.blur||2,t.highThresholdRatio=t.highThresholdRatio||.2,t.lowThresholdRatio=t.lowThresholdRatio||.15,{options:t,draw:function(n,r,i){i.stop(!0),i.overrideFlag=!0;var a=this;return e("../_nomodule/PixelManipulation.js")(n,{output:function(e,t,n){a.output={src:t,format:n}},changePixel:function(e,t,n,r){return[(e+t+n)/3,(e+t+n)/3,(e+t+n)/3,r]},extraManipulation:function(n){return n=e("ndarray-gaussian-filter")(n,t.blur),e("./EdgeUtils")(n,t.highThresholdRatio,t.lowThresholdRatio,t.inBrowser)},format:n.format,image:t.image,inBrowser:t.inBrowser,callback:r})},output:void 0,UI:n}}},{"../_nomodule/PixelManipulation.js":207,"./EdgeUtils":180,"ndarray-gaussian-filter":67}],182:[function(e,t,n){arguments[4][147][0].apply(n,arguments)},{"./Module":181,"./info.json":183,dup:147}],183:[function(e,t,n){t.exports={name:"Detect Edges",description:"this module detects edges using the Canny method, which first Gaussian blurs the image to reduce noise (amount of blur configurable in settings as `options.blur`), then applies a number of steps to highlight edges, resulting in a greyscale image where the brighter the pixel, the stronger the detected edge. Read more at: https://en.wikipedia.org/wiki/Canny_edge_detector",inputs:{blur:{type:"integer",desc:"amount of gaussian blur(Less blur gives more detail, typically 0-5)",default:2},highThresholdRatio:{type:"float",desc:"The high threshold ratio for the image",default:.2},lowThresholdRatio:{type:"float",desc:"The low threshold value for the image",default:.15}}}},{}],184:[function(e,t,n){t.exports=function(t,n){return e("fisheyegl"),{options:t,draw:function(e,n){var r=this;if(t.inBrowser){if(document.querySelector("#image-sequencer-canvas"))var i=document.querySelector("#image-sequencer-canvas");else(i=document.createElement("canvas")).style.display="none",i.setAttribute("id","image-sequencer-canvas"),document.body.append(i);distorter=FisheyeGl({selector:"#image-sequencer-canvas"}),t.a=parseFloat(t.a)||distorter.lens.a,t.b=parseFloat(t.b)||distorter.lens.b,t.Fx=parseFloat(t.Fx)||distorter.lens.Fx,t.Fy=parseFloat(t.Fy)||distorter.lens.Fy,t.scale=parseFloat(t.scale)||distorter.lens.scale,t.x=parseFloat(t.x)||distorter.fov.x,t.y=parseFloat(t.y)||distorter.fov.y,distorter.lens.a=t.a,distorter.lens.b=t.b,distorter.lens.Fx=t.Fx,distorter.lens.Fy=t.Fy,distorter.lens.scale=t.scale,distorter.fov.x=t.x,distorter.fov.y=t.y,distorter.setImage(e.src,function(){r.output={src:i.toDataURL(),format:e.format},n()})}else this.output=e,n()},output:void 0,UI:n}}},{fisheyegl:15}],185:[function(e,t,n){arguments[4][147][0].apply(n,arguments)},{"./Module":184,"./info.json":186,dup:147}],186:[function(e,t,n){t.exports={name:"Fisheye GL",description:"Correct fisheye, or barrel distortion, in images (with WebGL -- adapted from fisheye-correction-webgl by @bluemir).",requires:["webgl"],inputs:{a:{type:"float",desc:"a parameter",default:1,min:1,max:4},b:{type:"float",desc:"b parameter",default:1,min:1,max:4},Fx:{type:"float",desc:"Fx parameter",default:0,min:0,max:4},Fy:{type:"float",desc:"Fy parameter",default:0,min:0,max:4},scale:{type:"float",desc:"Image Scaling",default:1.5,min:0,max:20},x:{type:"float",desc:"FOV x parameter",default:1.5,min:0,max:20},y:{type:"float",desc:"FOV y parameter",default:1.5,min:0,max:20},fragmentSrc:{type:"PATH",desc:"Patht to a WebGL fragment shader file",default:"(inbuilt)"},vertexSrc:{type:"PATH",desc:"Patht to a WebGL vertex shader file",default:"(inbuilt)"}}}},{}],187:[function(e,t,n){(function(n){t.exports=function(t,r){return{options:t,draw:function(t,r,i){var a=e("get-pixels"),o=e("save-pixels"),s=this;a(t.src,function(e,i){if(e)console.log("Bad Image path");else{for(var a=0,u=0;u

Select or drag in an image to overlay.

';$(e.ui).find(".details").prepend(i),sequencer.setInputStep({dropZoneSelector:"#"+r,fileInputSelector:"#"+r+" .file-input",onLoad:function(t){var n=t.target;e.options.imageUrl=n.result,e.options.url=n.result,sequencer.run(),setUrlHashParameter("steps",sequencer.toString())}}),$(e.ui).find(".btn-save").on("click",function(){var t=$(e.ui).find(".det input").val();e.options.imageUrl=t,sequencer.run()})}}}},{}],192:[function(e,t,n){arguments[4][147][0].apply(n,arguments)},{"./Module":190,"./info.json":193,dup:147}],193:[function(e,t,n){t.exports={name:"Import Image",description:"Import a new image and replace the original with it. Future versions may enable a blend mode. Specify an image by URL or by file selector.",url:"https://github.com/publiclab/image-sequencer/tree/master/MODULES.md",inputs:{url:{type:"string",desc:"URL of image to import",default:"./images/monarch.png"}}}},{}],194:[function(e,t,n){t.exports=function(){return this.expandSteps([{name:"ndvi",options:{}},{name:"colormap",options:{}}]),{isMeta:!0}}},{}],195:[function(e,t,n){arguments[4][147][0].apply(n,arguments)},{"./Module":194,"./info.json":196,dup:147}],196:[function(e,t,n){t.exports={name:"NDVI-Colormap",description:"Sequentially Applies NDVI and Colormap steps",inputs:{},length:2}},{}],197:[function(e,t,n){t.exports=function(t,n){if(t.step.inBrowser)var r=e("./Ui.js")(t.step,n);return t.filter=t.filter||"red",{options:t,draw:function(n,i,a){a.stop(!0),a.overrideFlag=!0;var o=this;return e("../_nomodule/PixelManipulation.js")(n,{output:function(e,t,n){o.output={src:t,format:n}},changePixel:function(e,n,r,i){if("red"==t.filter)var a=(r-e)/(1*r+e);"blue"==t.filter&&(a=(e-r)/(1*r+e));var o=255*(a+1)/2;return[o,o,o,i]},format:n.format,image:t.image,inBrowser:t.inBrowser,callback:function(){t.step.inBrowser&&r.setup(),i()}})},output:void 0,UI:n}}},{"../_nomodule/PixelManipulation.js":207,"./Ui.js":198}],198:[function(e,t,n){t.exports=function(e,t){return{setup:function(){var t=$(e.imgElement);t.mousemove(function(e){var n=document.createElement("canvas");n.width=t.width(),n.height=t.height(),n.getContext("2d").drawImage(this,0,0);var r=$(this).offset(),i=e.pageX-r.left,a=e.pageY-r.top,o=n.getContext("2d").getImageData(i,a,1,1).data[0];o=(o=o/127.5-1).toFixed(2),t[0].title="NDVI: "+o})}}}},{}],199:[function(e,t,n){arguments[4][147][0].apply(n,arguments)},{"./Module":197,"./info.json":200,dup:147}],200:[function(e,t,n){t.exports={name:"NDVI",description:"Normalized Difference Vegetation Index, or NDVI, is an image analysis technique used with aerial photography. It's a way to visualize the amounts of infrared and other wavelengths of light reflected from vegetation by comparing ratios of blue and red light absorbed versus green and IR light reflected. NDVI is used to evaluate the health of vegetation in satellite imagery, where it correlates with how much photosynthesis is happening. This is helpful in assessing vegetative health or stress. Read more.

This is designed for use with red-filtered single camera DIY Infragram cameras; change to 'blue' for blue filters",inputs:{filter:{type:"select",desc:"Filter color",default:"red",values:["red","blue"]}}}},{}],201:[function(e,t,n){t.exports=function(t,n,r){return t.x=t.x||0,t.y=t.y||0,{options:t,draw:function(n,r,i){t.offset=t.offset||-2,i.stop(!0),i.overrideFlag=!0;var a=this,o=this.getStep(t.offset).image,s=this.getOutput(t.offset);e("get-pixels")(n.src,function(n,i){return t.secondImagePixels=i,e("../_nomodule/PixelManipulation.js")(s,{output:function(e,t,n){a.output={src:t,format:n}},changePixel:function(e,n,r,i,a,o){var s=t.secondImagePixels;return a>=t.x&&a=t.y&&o
To work with a new or different image, drag one into the drop zone.",ID:t.options.sequencerCounter++,imageName:e,inBrowser:t.options.inBrowser,ui:t.options.ui},o={src:n,steps:[{options:{id:r.ID,name:"load-image",description:"This initial step loads and displays the original image without any modifications.",title:"Load Image",step:r},UI:t.events,draw:function(){return UI.onDraw(options.step),1==arguments.length?(this.output=a(arguments[0]),options.step.output=this.output,UI.onComplete(options.step),!0):2==arguments.length&&(this.output=a(arguments[0]),options.step.output=this.output,arguments[1](),UI.onComplete(options.step),!0)}}]};a(n,function(n){var r=function(e){return{src:e,format:e.split(":")[1].split(";")[0].split("/")[1]}}(n);t.images[e]=o;var a=t.images[e].steps[0];return a.output=r,a.options.step.output=a.output.src,a.UI.onSetup(a.options.step),a.UI.onDraw(a.options.step),a.UI.onComplete(a.options.step),i(),!0})}(n,r)}},{urify:132}],209:[function(e,t,n){t.exports=function(){return function(e){var t=$(e.dropZoneSelector),n=$(e.fileInputSelector),r=e.onLoad;function i(e){if(e.preventDefault(),e.stopPropagation(),e.target&&e.target.files)var t=e.target.files[0];else t=e.dataTransfer.files[0];if(t){var n=new FileReader;n.onload=r,n.readAsDataURL(t)}}new FileReader,n.on("change",i),t[0].addEventListener("drop",i,!1),t.on("dragover",function(e){e.stopPropagation(),e.preventDefault(),e.dataTransfer.dropEffect="copy"},!1),t.on("dragenter",function(e){t.addClass("hover")}),t.on("dragleave",function(e){t.removeClass("hover")})}}},{}],210:[function(e,t,n){t.exports=function(e={}){return e.onSetup=e.onSetup||function(e){0==e.ui||(e.inBrowser?console.log('Added Step "'+e.name+'" to "'+e.imageName+'".'):console.log("%s",'Added Step "'+e.name+'" to "'+e.imageName+'".'))},e.onDraw=e.onDraw||function(e){0==e.ui||(e.inBrowser?console.log('Drawing Step "'+e.name+'" on "'+e.imageName+'".'):console.log("%s",'Drawing Step "'+e.name+'" on "'+e.imageName+'".'))},e.onComplete=e.onComplete||function(e){0==e.ui||(e.inBrowser?console.log('Drawn Step "'+e.name+'" on "'+e.imageName+'".'):console.log("%s",'Drawn Step "'+e.name+'" on "'+e.imageName+'".'))},e.onRemove=e.onRemove||function(e){0==e.ui||(e.inBrowser?console.log('Removing Step "'+e.name+'" of "'+e.imageName+'".'):console.log("%s",'Removing Step "'+e.name+'" of "'+e.imageName+'".'))},e}},{}],211:[function(e,t,n){t.exports=function(e){var t=void 0;return"jpeg"===(t=(t=function(e){return"data:image"===e.substr(0,10)}(e)?e.split(";")[0].split("/").pop():e.split(".").pop()).toLowerCase())&&(t="jpg"),["jpg","jpeg","png","gif","canvas"].includes(t)?t:"jpg"}},{}],212:[function(e,t,n){t.exports={getPreviousStep:function(){return this.getStep(-1)},getNextStep:function(){return this.getStep(1)},getInput:function(e){return e+this.getIndex()===0&&e++,this.getStep(e-1).output},getOutput:function(e){return this.getStep(e).output},getOptions:function(){return this.getStep(0).options},setOptions:function(e){let t=this.getStep(0).options;for(let n in e)t[n]&&(t[n]=e[n])},getFormat:function(){return this.getStep(-1).output.format},getHeight:function(e){let t=new Image;t.onload=function(){e(t.height)},t.src=this.getInput(0).src},getWidth:function(e){let t=new Image;t.onload=function(){e(t.width)},t.src=this.getInput(0).src}}},{}]},{},[139]); \ No newline at end of file diff --git a/examples/demo.js b/examples/demo.js index 5f080207ff..ea0a68ddd3 100644 --- a/examples/demo.js +++ b/examples/demo.js @@ -68,4 +68,15 @@ window.onload = function() { console.log('Service worker registration failed, error:', error); }); } + + $("#clear-cache").click(function() { + if ('serviceWorker' in navigator) { + caches.keys().then(function(cacheNames) { + cacheNames.forEach(function(cacheName) { + caches.delete(cacheName); + }); + }); + } + }); + }; diff --git a/examples/index.html b/examples/index.html index 39f574d026..126f5e7266 100644 --- a/examples/index.html +++ b/examples/index.html @@ -84,8 +84,11 @@

Image Sequencer

- + +
+ +