)]}' {"version":3,"sources":["blaze/preamble.js","blaze/dombackend.js","blaze/domrange.js","blaze/events.js","blaze/attrs.js","blaze/materializer.js","blaze/exceptions.js","blaze/view.js","blaze/builtins.js","blaze/lookup.js","blaze/template.js","blaze/backcompat.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,G;AACA,mB;AACA,oE;AACA,G;AACA,W;;AAEA,iE;AACA,6B;AACA,oB;AACA,gB;AACA,gB;AACA,kB;AACA,kB;AACA,kE;AACA,gB;AACA,I;AACA,gC;AACA,yB;AACA,I;;AAEA,uB;AACA,8C;AACA,I;AACA,K;;AAEA,8B;AACA,0B;;AAEA,sD;AACA,oD;AACA,2D;AACA,qB;AACA,E;;;;;;;;;;;;;;;;;;;AChCA,oB;AACA,+B;;AAEA,mD;AACA,4C;AACA,6D;AACA,U;AACA,sC;;AAEA,sB;;AAEA,wC;AACA,8B;AACA,I;AACA,yD;AACA,2D;AACA,yC;AACA,mC;AACA,E;;AAEA,qB;AACA,qD;AACA,4D;AACA,qC;AACA,4D;AACA,0C;AACA,I;;AAEA,oD;AACA,uC;AACA,I;;AAEA,+D;AACA,0B;;AAEA,oC;AACA,mC;AACA,yC;;AAEA,uE;AACA,wE;AACA,yE;AACA,mE;AACA,2E;AACA,4B;AACA,6C;AACA,2C;AACA,kC;AACA,M;;AAEA,wC;;AAEA,kD;AACA,qC;AACA,+C;AACA,I;;AAEA,uD;AACA,kD;AACA,oE;AACA,I;;AAEA,mC;AACA,2B;AACA,mC;AACA,oB;AACA,mC;AACA,gB;AACA,G;AACA,E;;;AAGA,6C;;AAEA,6C;AACA,mD;AACA,E;AACA,2D;AACA,mD;AACA,2D;AACA,Q;;AAEA,0B;;AAEA,8B;AACA,wC;AACA,mB;AACA,mB;AACA,mB;AACA,E;;AAEA,mD;AACA,0D;AACA,0B;AACA,qB;AACA,0B;AACA,qB;AACA,E;;AAEA,iD;AACA,6B;AACA,6B;AACA,E;;AAEA,6C;AACA,uB;AACA,iB;AACA,E;;AAEA,oE;;AAEA,uB;AACA,+C;AACA,wC;AACA,yE;AACA,0E;AACA,8E;AACA,gC;AACA,4C;AACA,yC;;AAEA,gD;AACA,2B;AACA,oD;AACA,4C;;AAEA,+C;AACA,iE;AACA,K;;AAEA,mC;;AAEA,4C;AACA,I;AACA,uE;AACA,0C;AACA,oC;AACA,mB;AACA,uE;AACA,uC;AACA,kD;AACA,+C;AACA,8B;AACA,K;AACA,qB;AACA,yB;AACA,G;AACA,E;;AAEA,6D;AACA,sB;AACA,kE;AACA,gE;AACA,kE;AACA,uB;AACA,I;AACA,wB;AACA,oB;AACA,uD;AACA,oB;AACA,+B;AACA,iC;AACA,iB;AACA,uB;AACA,O;AACA,qB;;AAEA,gD;AACA,K;AACA,G;AACA,E;;;AAGA,+C;AACA,qD;AACA,+C;AACA,0D;AACA,gC;AACA,E;;;;;;;;;;;;;;;;;;;;ACjLA,gE;AACA,yD;;AAEA,+C;AACA,E;AACA,sE;AACA,uE;AACA,+D;AACA,+D;AACA,gD;AACA,mC;AACA,2B;AACA,2C;;AAEA,mD;AACA,0D;AACA,sC;;AAEA,0C;AACA,+B;;AAEA,yB;AACA,oC;AACA,wB;AACA,4B;AACA,0B;AACA,uC;AACA,E;AACA,+B;;AAEA,sD;AACA,wD;AACA,uD;AACA,2D;AACA,uD;AACA,wD;AACA,sD;AACA,yD;AACA,qD;AACA,uB;AACA,mD;AACA,qB;AACA,6C;AACA,O;AACA,6B;AACA,e;AACA,W;AACA,kB;AACA,G;AACA,gB;AACA,K;;AAEA,iB;AACA,6E;AACA,sB;AACA,8B;AACA,+C;AACA,U;AACA,gB;AACA,8D;AACA,Q;AACA,gE;AACA,G;AACA,E;;AAEA,2C;AACA,sB;AACA,8B;AACA,e;AACA,U;AACA,qC;AACA,G;AACA,E;;AAEA,8C;AACA,qB;AACA,W;AACA,yB;AACA,qE;AACA,2C;AACA,U;AACA,gC;AACA,G;AACA,E;;AAEA,4D;AACA,gE;AACA,sB;AACA,yB;AACA,yD;AACA,2C;AACA,U;AACA,iC;AACA,G;AACA,E;;AAEA,0D;AACA,8B;AACA,W;AACA,gE;AACA,sB;AACA,yB;AACA,uD;AACA,yC;AACA,U;AACA,iC;AACA,G;AACA,E;;AAEA,uC;AACA,0B;AACA,wD;AACA,mB;AACA,2B;AACA,wC;AACA,gB;AACA,6B;AACA,G;AACA,e;AACA,E;;AAEA,qF;AACA,kE;AACA,uD;AACA,sB;AACA,I;AACA,gE;AACA,2C;AACA,8B;AACA,kD;AACA,0B;AACA,+G;AACA,G;;AAEA,6B;AACA,uB;AACA,sC;AACA,8C;AACA,qE;AACA,K;AACA,U;AACA,uB;AACA,0C;AACA,oC;AACA,qC;AACA,6C;AACA,8D;AACA,G;AACA,uB;AACA,qC;;AAEA,kC;AACA,4D;AACA,0C;AACA,wD;AACA,K;AACA,G;AACA,E;;AAEA,iE;AACA,wC;AACA,gE;AACA,sC;;AAEA,gC;;AAEA,6C;AACA,mC;AACA,6C;AACA,kC;;AAEA,wB;AACA,8B;AACA,U;AACA,2D;AACA,iD;AACA,0D;AACA,iD;AACA,6C;AACA,kE;AACA,uC;AACA,gC;AACA,uE;AACA,K;AACA,G;AACA,E;;AAEA,4C;AACA,sB;AACA,wC;;AAEA,4B;AACA,sC;;AAEA,0B;AACA,qD;AACA,E;;AAEA,2C;AACA,sB;AACA,wC;;AAEA,4B;AACA,sC;;AAEA,gD;AACA,oD;AACA,E;;AAEA,mD;AACA,sB;AACA,wC;;AAEA,4C;AACA,6B;AACA,uB;AACA,8C;AACA,mC;AACA,K;AACA,U;AACA,iD;AACA,gD;AACA,sC;AACA,G;;AAEA,qB;AACA,0B;AACA,8B;;AAEA,4D;AACA,0C;AACA,2D;AACA,K;AACA,G;AACA,E;;AAEA,uE;AACA,6B;AACA,oD;AACA,gE;;AAEA,gB;AACA,8B;;AAEA,wB;AACA,+C;AACA,0C;AACA,oC;AACA,8D;AACA,iC;AACA,U;AACA,iB;AACA,qC;AACA,sB;AACA,6C;AACA,Y;AACA,+B;AACA,6D;AACA,K;AACA,0C;AACA,uE;AACA,G;AACA,E;;AAEA,+D;AACA,6B;AACA,mD;AACA,mE;;AAEA,gB;AACA,+B;AACA,U;AACA,qC;AACA,+B;;AAEA,+B;AACA,oD;AACA,mC;AACA,Y;AACA,iC;AACA,wB;AACA,oC;AACA,K;AACA,G;AACA,E;;AAEA,+D;AACA,sC;AACA,gD;AACA,qD;AACA,E;;AAEA,mD;AACA,6B;AACA,mD;AACA,gE;AACA,+B;AACA,E;;AAEA,6C;AACA,4B;AACA,yB;AACA,2C;AACA,0B;AACA,E;;AAEA,8C;AACA,8B;AACA,e;AACA,6C;AACA,kD;AACA,kB;AACA,yB;AACA,4B;AACA,4B;AACA,K;AACA,G;AACA,E;;AAEA,kD;;AAEA,8D;AACA,0C;AACA,2D;AACA,6B;AACA,0C;AACA,4C;AACA,E;;AAEA,oD;AACA,sC;AACA,E;;AAEA,sD;AACA,sB;AACA,wC;;AAEA,iE;AACA,mE;AACA,oE;AACA,8D;AACA,8D;AACA,uC;;AAEA,iE;AACA,0B;AACA,yD;AACA,iB;;AAEA,6D;AACA,qC;AACA,gD;AACA,2B;;AAEA,gC;AACA,iC;AACA,8B;;AAEA,wB;AACA,E;;AAEA,qD;AACA,sB;AACA,wC;;AAEA,uB;AACA,iB;;AAEA,8D;AACA,8D;AACA,2D;AACA,+D;AACA,+B;;AAEA,iD;AACA,qD;;AAEA,qB;AACA,uC;;AAEA,iC;AACA,8B;;AAEA,wB;AACA,E;;AAEA,qD;AACA,kD;AACA,E;;AAEA,+C;AACA,2C;AACA,2C;AACA,2C;AACA,oD;AACA,8D;AACA,6C;AACA,gC;AACA,yC;AACA,E;;AAEA,4C;AACA,kB;;AAEA,sC;AACA,mB;AACA,wD;;AAEA,0D;AACA,0D;AACA,+C;AACA,wD;AACA,2D;AACA,0D;AACA,4B;;AAEA,4D;AACA,4C;AACA,wD;AACA,yD;;AAEA,uE;;AAEA,4D;AACA,6D;AACA,sD;AACA,e;;AAEA,0D;AACA,yD;AACA,kB;AACA,oC;AACA,0D;AACA,wD;AACA,iC;AACA,kB;;AAEA,sC;AACA,I;;AAEA,yB;AACA,iD;AACA,0C;AACA,wB;AACA,8C;AACA,yB;AACA,wB;AACA,2B;AACA,K;AACA,yB;AACA,U;AACA,mE;AACA,yC;AACA,G;;AAEA,iB;AACA,E;;AAEA,+D;AACA,E;AACA,mE;AACA,2D;AACA,0C;AACA,kC;AACA,iB;AACA,c;AACA,iB;;AAEA,kC;AACA,+C;AACA,U;AACA,+D;AACA,0E;AACA,gE;AACA,yC;AACA,qB;AACA,6C;AACA,mB;AACA,gB;AACA,kB;;AAEA,yB;AACA,G;AACA,E;;;;;;;;;;;;;;;;;;;ACpeA,4C;;AAEA,mC;;AAEA,oD;AACA,oD;AACA,qD;AACA,kB;AACA,E;AACA,mC;AACA,sD;AACA,kD;AACA,wD;AACA,qD;AACA,kC;AACA,E;;AAEA,4C;AACA,S;AACA,c;AACA,c;AACA,E;;AAEA,2B;;AAEA,sE;AACA,mB;AACA,mB;AACA,2B;AACA,yB;AACA,6B;AACA,mC;;AAEA,6B;;AAEA,wD;AACA,0D;AACA,0B;AACA,I;AACA,wD;AACA,8C;AACA,yC;AACA,2B;AACA,6D;AACA,gD;AACA,e;AACA,qD;AACA,M;AACA,W;;AAEA,oD;AACA,iC;AACA,wD;AACA,qD;AACA,qD;AACA,sD;AACA,8C;;AAEA,6C;AACA,kC;AACA,0D;;AAEA,qB;AACA,2C;AACA,6B;AACA,wC;AACA,6C;AACA,4B;AACA,mD;AACA,gC;AACA,yC;AACA,kD;AACA,kD;AACA,mB;AACA,kB;AACA,iD;AACA,mD;AACA,mC;AACA,0C;AACA,+C;AACA,kD;AACA,W;AACA,S;;AAEA,gC;AACA,Q;AACA,a;;AAEA,U;AACA,oC;AACA,G;AACA,E;AACA,qC;;AAEA,yC;AACA,sE;AACA,gE;AACA,4D;AACA,0C;AACA,wC;AACA,iD;AACA,6B;AACA,G;;AAEA,yC;AACA,qC;AACA,2B;AACA,mD;AACA,E;;AAEA,2C;AACA,wC;AACA,+D;AACA,iE;;AAEA,yC;AACA,4D;AACA,8D;AACA,E;;AAEA,oG;;AAEA,8D;AACA,4D;AACA,sE;AACA,iB;AACA,uE;AACA,uC;;AAEA,sB;AACA,0C;AACA,uB;AACA,K;;AAEA,0B;AACA,sD;AACA,6B;;AAEA,0C;AACA,oB;AACA,+C;;AAEA,+B;AACA,iB;AACA,kC;AACA,yB;AACA,K;AACA,oC;AACA,oC;AACA,mD;AACA,oC;AACA,sB;AACA,iC;AACA,2E;AACA,sE;AACA,wD;AACA,6B;AACA,oD;AACA,uC;AACA,8C;AACA,gD;AACA,2B;AACA,iC;AACA,kC;AACA,uB;AACA,qB;AACA,8D;AACA,gC;AACA,+C;AACA,kD;AACA,W;AACA,S;AACA,O;AACA,K;AACA,G;;AAEA,U;AACA,sD;AACA,uB;AACA,4C;AACA,sB;AACA,e;AACA,qE;AACA,oE;AACA,qE;AACA,kE;AACA,oB;AACA,uD;AACA,gD;AACA,mD;AACA,mB;AACA,mB;AACA,wC;AACA,2D;AACA,mD;AACA,qC;AACA,8D;AACA,W;AACA,S;AACA,O;AACA,gC;AACA,K;AACA,I;AACA,E;;;;;;;;;;;;;;;;;;;AC3MA,0B;AACA,0C;AACA,uB;AACA,E;AACA,4C;AACA,uB;AACA,E;;AAEA,gF;AACA,kE;AACA,uE;AACA,sB;AACA,E;AACA,gD;AACA,uE;AACA,4E;AACA,yE;AACA,uE;AACA,0E;AACA,yE;AACA,wE;AACA,sE;AACA,0E;AACA,+B;AACA,E;AACA,2E;AACA,kE;AACA,E;AACA,4E;AACA,0D;;AAEA,2C;AACA,mB;AACA,qB;AACA,E;AACA,2C;;AAEA,yE;AACA,uB;AACA,0B;AACA,yC;AACA,U;AACA,2C;AACA,G;AACA,E;;AAEA,8C;AACA,qB;AACA,iE;AACA,4C;AACA,I;AACA,kC;AACA,kC;AACA,c;AACA,yC;AACA,iB;AACA,E;;AAEA,iF;AACA,E;AACA,wE;AACA,qE;AACA,6E;AACA,2E;AACA,E;AACA,8D;;AAEA,uD;AACA,+C;AACA,oE;AACA,kF;;AAEA,gE;AACA,0D;;AAEA,mE;;AAEA,mD;AACA,iE;;AAEA,8C;AACA,+B;AACA,2B;AACA,O;;AAEA,8C;AACA,mC;AACA,O;;AAEA,yD;AACA,G;AACA,G;;AAEA,mD;AACA,6B;AACA,uC;AACA,6B;AACA,I;AACA,2C;AACA,kC;AACA,I;AACA,qC;AACA,oB;;AAEA,mD;AACA,gB;AACA,8B;AACA,O;AACA,kB;AACA,G;AACA,G;;AAEA,2C;AACA,uC;AACA,qC;AACA,I;AACA,2C;AACA,6C;AACA,G;AACA,G;;AAEA,mD;AACA,uC;AACA,yC;AACA,I;AACA,uC;AACA,uB;AACA,uC;AACA,Y;AACA,2C;AACA,K;AACA,I;;AAEA,uE;AACA,I;AACA,a;AACA,gF;AACA,qC;AACA,oB;;AAEA,2E;AACA,yG;AACA,4H;AACA,uC;AACA,mB;AACA,0C;AACA,gC;AACA,wE;;AAEA,wE;AACA,qC;AACA,8C;AACA,2C;;AAEA,qC;AACA,K;;AAEA,kB;AACA,G;AACA,G;;AAEA,8C;AACA,+C;AACA,yB;AACA,wB;AACA,2B;AACA,8B;AACA,Y;AACA,2B;AACA,K;AACA,G;AACA,G;;AAEA,4C;AACA,+C;AACA,gC;AACA,4B;AACA,G;AACA,G;;AAEA,+D;AACA,yC;AACA,4C;AACA,8C;AACA,4C;AACA,yB;AACA,4B;AACA,iD;AACA,Y;AACA,wD;AACA,K;AACA,G;AACA,G;;AAEA,mD;AACA,oC;AACA,mC;AACA,E;;AAEA,mD;AACA,wE;AACA,Q;AACA,yE;AACA,kB;AACA,qB;AACA,yB;AACA,yB;AACA,gB;AACA,kB;AACA,kB;AACA,sD;AACA,yB;AACA,gB;AACA,mB;AACA,mB;AACA,mB;AACA,uC;AACA,+B;AACA,gC;AACA,sB;AACA,oB;AACA,2C;AACA,2B;AACA,mB;AACA,uB;AACA,uB;AACA,qB;AACA,I;;AAEA,8B;AACA,gB;AACA,G;;AAEA,6C;AACA,4C;AACA,E;;AAEA,qE;AACA,uE;AACA,2B;AACA,sB;AACA,2D;AACA,C;;AAEA,qC;AACA,wB;AACA,sC;AACA,iE;AACA,U;AACA,oE;AACA,G;AACA,E;;AAEA,uE;AACA,oD;AACA,sE;AACA,qE;AACA,gD;AACA,mD;AACA,0C;AACA,+C;AACA,oB;AACA,yB;;AAEA,yC;AACA,mC;AACA,Y;AACA,2E;AACA,iC;AACA,yE;AACA,yD;AACA,0D;AACA,uC;AACA,0D;AACA,c;AACA,qC;AACA,O;AACA,K;AACA,G;AACA,G;;AAEA,iE;AACA,qD;AACA,sE;AACA,kE;AACA,yB;AACA,6B;AACA,8C;AACA,Y;AACA,2C;AACA,K;AACA,gC;AACA,yC;AACA,kE;AACA,gE;AACA,2C;AACA,sE;AACA,mC;AACA,8D;AACA,kC;AACA,yC;AACA,gD;AACA,sD;AACA,kD;AACA,uC;AACA,U;AACA,6C;AACA,G;;AAEA,gE;AACA,oC;AACA,E;;;AAGA,4C;AACA,mB;AACA,qB;AACA,E;;AAEA,+D;AACA,sB;AACA,gE;AACA,uB;AACA,+B;;AAEA,2B;AACA,+B;AACA,6D;AACA,4D;AACA,yD;AACA,sD;AACA,4B;AACA,gC;AACA,mC;AACA,2B;AACA,2C;AACA,yB;AACA,K;AACA,G;;AAEA,2B;AACA,uB;AACA,iB;AACA,4B;AACA,+B;AACA,2B;AACA,2B;AACA,uD;AACA,8B;AACA,wB;AACA,O;AACA,Y;AACA,4B;AACA,+B;AACA,K;AACA,6B;AACA,4B;AACA,4C;AACA,yB;AACA,2B;AACA,K;AACA,G;AACA,E;;;;;;;;;;;;;;;;;;;AC1WA,6C;AACA,E;AACA,uE;AACA,uE;AACA,qE;AACA,uB;AACA,yE;AACA,oB;AACA,uE;AACA,E;AACA,uE;AACA,kE;AACA,qE;AACA,wD;AACA,iE;AACA,mE;AACA,0C;AACA,qB;AACA,gE;;AAEA,kE;AACA,mE;AACA,kE;AACA,sE;AACA,4B;AACA,mE;AACA,qB;AACA,+B;AACA,qC;AACA,a;AACA,Y;AACA,qB;AACA,gE;AACA,K;AACA,G;;AAEA,mB;AACA,E;;AAEA,+E;AACA,uB;AACA,wB;AACA,W;AACA,G;;AAEA,0B;AACA,+C;AACA,4D;AACA,W;AACA,gB;AACA,4B;AACA,kC;AACA,+B;AACA,sE;AACA,e;AACA,mC;AACA,4D;AACA,e;AACA,mC;AACA,sE;AACA,e;AACA,+B;AACA,uE;AACA,4B;AACA,8D;AACA,8C;AACA,mC;AACA,e;AACA,O;AACA,sC;AACA,kD;AACA,2D;AACA,O;AACA,a;AACA,Y;AACA,6C;AACA,wC;AACA,gD;AACA,O;AACA,yC;AACA,yE;AACA,e;AACA,O;AACA,K;AACA,G;;AAEA,4D;AACA,E;;AAEA,4D;AACA,4B;AACA,W;AACA,2D;AACA,oC;AACA,iB;AACA,2E;AACA,U;AACA,sB;AACA,2C;AACA,G;;AAEA,2B;AACA,8B;AACA,sD;AACA,8C;AACA,mE;AACA,uC;AACA,mE;AACA,mE;AACA,uE;AACA,qB;AACA,yC;AACA,iC;AACA,yE;AACA,4D;AACA,K;AACA,8C;AACA,yD;AACA,kB;AACA,G;;AAEA,iB;AACA,yD;AACA,wC;AACA,wE;AACA,iE;AACA,2B;AACA,4C;AACA,uE;AACA,yD;AACA,oE;AACA,O;AACA,sC;AACA,M;AACA,2B;AACA,qB;AACA,0B;AACA,mE;AACA,Y;AACA,4D;AACA,4C;AACA,iE;AACA,W;AACA,S;AACA,K;AACA,gF;AACA,gC;AACA,O;AACA,G;;AAEA,wB;AACA,iC;AACA,sD;AACA,gC;AACA,4D;AACA,uC;AACA,yC;AACA,yB;AACA,Y;AACA,8B;AACA,O;AACA,O;AACA,4D;AACA,gE;AACA,G;;AAEA,c;AACA,E;;;AAGA,mC;AACA,gE;AACA,iE;AACA,qC;AACA,8D;AACA,iE;AACA,wC;AACA,I;AACA,gE;AACA,iD;AACA,+D;AACA,qD;AACA,oB;AACA,iC;AACA,uB;AACA,kD;AACA,E;;;;;;;;;;;;;;;;;;;AC1LA,c;;AAEA,2E;AACA,8E;AACA,4E;AACA,sB;AACA,E;AACA,S;AACA,E;AACA,M;AACA,Q;AACA,yB;AACA,gB;AACA,0B;AACA,I;AACA,M;AACA,E;AACA,6D;;AAEA,yD;AACA,wD;AACA,iD;AACA,kC;;AAEA,4C;AACA,kC;AACA,sC;AACA,Y;AACA,G;;AAEA,kB;AACA,2B;AACA,6B;AACA,6D;AACA,8E;AACA,gC;AACA,M;;AAEA,4E;AACA,gF;AACA,gE;AACA,4E;AACA,E;;AAEA,qD;AACA,8B;AACA,a;;AAEA,sB;AACA,S;AACA,sC;AACA,iB;AACA,+D;AACA,K;AACA,I;AACA,E;;;;;;;;;;;;;;;;;;;ACvDA,0C;AACA,G;AACA,iE;AACA,2B;AACA,G;AACA,uE;AACA,uE;AACA,G;AACA,oE;AACA,gE;AACA,iC;AACA,G;AACA,kE;AACA,+D;AACA,8C;AACA,G;AACA,iE;AACA,4D;AACA,G;AACA,iE;AACA,oE;AACA,+D;AACA,yE;AACA,iE;AACA,6C;AACA,G;AACA,2B;AACA,G;AACA,oE;AACA,mE;AACA,mE;AACA,gE;AACA,sE;AACA,0E;;AAEA,G;AACA,S;AACA,8E;AACA,gB;AACA,kG;AACA,wJ;AACA,G;AACA,sC;AACA,qC;AACA,2B;AACA,wC;;AAEA,mC;AACA,8B;AACA,kB;AACA,c;AACA,G;AACA,mB;AACA,wB;;AAEA,qB;AACA,kB;AACA,mB;AACA,mB;AACA,I;;AAEA,yD;AACA,0D;AACA,kD;AACA,yB;AACA,sC;AACA,0B;AACA,2B;AACA,2B;AACA,2B;AACA,yB;AACA,wB;AACA,+E;AACA,2E;AACA,a;AACA,+E;AACA,8E;AACA,8E;AACA,6E;AACA,+E;AACA,mC;;AAEA,uB;AACA,E;;AAEA,4D;;AAEA,oD;AACA,0D;AACA,mC;AACA,E;;AAEA,sD;AACA,4D;AACA,oC;AACA,E;;AAEA,kD;AACA,kB;AACA,0B;AACA,oC;AACA,+B;AACA,kD;AACA,wB;AACA,W;AACA,O;AACA,O;AACA,I;AACA,kD;AACA,yB;AACA,a;AACA,kC;AACA,sC;AACA,Q;AACA,a;AACA,K;AACA,E;;AAEA,sD;AACA,8D;AACA,qC;AACA,E;;AAEA,sB;AACA,G;AACA,kE;AACA,6D;AACA,2D;AACA,iE;AACA,gE;AACA,4C;AACA,G;AACA,+D;AACA,qE;AACA,uE;AACA,8C;AACA,G;AACA,6C;AACA,0E;AACA,6D;AACA,6D;AACA,oC;AACA,wE;AACA,kB;;AAEA,qE;AACA,sE;AACA,mE;AACA,qE;AACA,0E;AACA,+C;AACA,I;AACA,qE;AACA,iE;AACA,sE;AACA,iE;AACA,iE;AACA,kE;AACA,0B;AACA,I;AACA,uE;AACA,oE;AACA,yE;AACA,oE;AACA,uE;AACA,0B;AACA,yB;AACA,6F;AACA,G;AACA,yB;AACA,0H;AACA,G;AACA,uB;AACA,gI;AACA,G;;AAEA,uE;AACA,6E;AACA,8E;AACA,+E;AACA,uB;AACA,6E;AACA,8E;AACA,6C;AACA,kB;AACA,4E;;AAEA,sC;AACA,qE;AACA,gG;AACA,+B;AACA,S;AACA,O;AACA,I;;AAEA,yE;AACA,gF;AACA,+E;AACA,wB;AACA,oE;AACA,uC;;AAEA,yD;;AAEA,kB;AACA,E;;AAEA,kE;AACA,kB;;AAEA,yB;AACA,+F;AACA,G;AACA,yB;AACA,4H;AACA,G;AACA,yB;AACA,gI;AACA,G;AACA,E;;AAEA,G;AACA,qE;AACA,qE;AACA,4E;AACA,0C;AACA,G;AACA,2D;AACA,kB;AACA,0B;;AAEA,uC;;AAEA,gB;AACA,2B;AACA,6E;AACA,U;AACA,qD;AACA,G;;AAEA,oC;AACA,qB;AACA,K;;AAEA,mB;AACA,E;;AAEA,8C;AACA,yB;AACA,sE;;AAEA,oC;AACA,E;;AAEA,6C;AACA,yB;AACA,sE;;AAEA,mC;AACA,E;;AAEA,+C;AACA,4C;AACA,kD;AACA,uC;AACA,0D;AACA,0B;AACA,O;AACA,K;AACA,E;;AAEA,+D;AACA,qB;AACA,wD;;AAEA,yC;AACA,wB;AACA,mB;AACA,uC;;AAEA,wC;AACA,E;;AAEA,qD;AACA,qD;AACA,4B;AACA,uB;AACA,yB;AACA,yC;;AAEA,0B;;AAEA,yD;AACA,4B;;AAEA,gE;AACA,oC;AACA,wD;AACA,S;AACA,K;;AAEA,gC;AACA,oC;AACA,wC;AACA,wB;AACA,K;;AAEA,kB;AACA,E;;AAEA,iE;AACA,+D;AACA,qD;AACA,E;AACA,oE;AACA,mE;AACA,oE;AACA,sE;AACA,kE;AACA,4D;AACA,qE;AACA,0C;AACA,8E;AACA,sC;;AAEA,e;AACA,iB;AACA,qE;AACA,iC;AACA,mC;AACA,uC;AACA,8C;AACA,yB;AACA,8B;AACA,sE;AACA,wB;AACA,kC;AACA,+B;;AAEA,yB;AACA,sD;AACA,sB;AACA,uE;AACA,4D;AACA,gD;AACA,mD;AACA,W;AACA,W;AACA,O;AACA,0B;;AAEA,sE;AACA,mE;AACA,kE;AACA,wD;AACA,wC;AACA,uB;AACA,oC;AACA,S;AACA,S;AACA,iC;;AAEA,qD;AACA,wB;AACA,uB;AACA,oE;AACA,sD;AACA,+E;AACA,Y;AACA,mE;AACA,qE;AACA,gE;AACA,+D;AACA,kE;AACA,sE;AACA,2D;AACA,2B;AACA,yD;AACA,mC;AACA,wD;AACA,2E;AACA,kC;AACA,S;AACA,0D;AACA,2D;AACA,K;AACA,K;;AAEA,qB;AACA,oB;AACA,U;AACA,gB;AACA,G;AACA,E;;AAEA,gE;AACA,oE;AACA,gE;AACA,yE;AACA,mE;AACA,oE;AACA,gE;AACA,oE;AACA,Y;AACA,iD;AACA,6D;;AAEA,0B;AACA,yD;AACA,0B;AACA,K;AACA,2B;;AAEA,2C;;AAEA,uB;AACA,sC;AACA,+B;AACA,O;AACA,U;AACA,6B;AACA,G;;AAEA,gB;AACA,E;;AAEA,wB;AACA,0D;AACA,2B;AACA,6B;AACA,oC;AACA,4B;AACA,gC;AACA,mD;;AAEA,+D;AACA,wE;AACA,I;AACA,qC;AACA,gC;AACA,oC;AACA,6D;;AAEA,2D;AACA,gF;AACA,I;AACA,+C;AACA,uE;AACA,yD;AACA,oC;AACA,6D;;AAEA,kE;AACA,8B;AACA,G;AACA,G;;AAEA,6D;AACA,wC;AACA,0C;AACA,+B;AACA,kD;AACA,E;;AAEA,+C;AACA,sD;AACA,oC;AACA,6C;AACA,E;;AAEA,wD;AACA,sD;AACA,oC;AACA,sD;AACA,E;;AAEA,kD;AACA,uB;AACA,W;AACA,0B;;AAEA,0C;;AAEA,4D;AACA,+D;AACA,iE;;AAEA,qB;AACA,8C;AACA,E;;AAEA,sC;AACA,0B;AACA,qD;AACA,E;;AAEA,6D;AACA,+D;AACA,S;AACA,yC;AACA,8B;AACA,4D;AACA,yB;AACA,uB;AACA,U;AACA,uB;AACA,6D;AACA,gC;AACA,G;AACA,E;;AAEA,G;AACA,oI;AACA,gB;AACA,qB;AACA,G;AACA,yB;;AAEA,gD;AACA,kC;AACA,O;AACA,6B;AACA,kB;AACA,a;AACA,gC;AACA,G;AACA,E;;AAEA,oD;AACA,qE;AACA,oE;AACA,U;AACA,6C;AACA,uB;AACA,yC;AACA,qC;AACA,8C;;AAEA,wC;AACA,4C;AACA,sC;AACA,W;;AAEA,O;AACA,iE;AACA,0D;AACA,4B;AACA,sC;AACA,e;AACA,iD;AACA,iD;AACA,G;AACA,E;;AAEA,sD;AACA,kD;AACA,oB;AACA,wC;AACA,8B;;AAEA,0C;AACA,mC;AACA,6C;AACA,mB;AACA,U;AACA,uB;AACA,qC;AACA,0B;AACA,uB;AACA,Q;AACA,K;AACA,sC;AACA,G;AACA,E;;AAEA,kE;AACA,6D;AACA,gB;AACA,wC;AACA,8B;;AAEA,sC;AACA,wB;AACA,qB;AACA,M;AACA,U;AACA,mB;AACA,G;AACA,E;;AAEA,G;AACA,iL;AACA,gB;AACA,qR;AACA,sH;AACA,6N;AACA,kI;AACA,G;AACA,wE;AACA,wB;AACA,yE;AACA,0E;AACA,G;;AAEA,uC;AACA,8B;AACA,0B;AACA,oB;AACA,G;;AAEA,kE;AACA,sE;AACA,4C;AACA,kE;AACA,0D;AACA,kF;AACA,qD;;AAEA,sD;;AAEA,oC;AACA,2C;;AAEA,sB;AACA,mD;AACA,G;;AAEA,c;AACA,E;;AAEA,yD;AACA,iF;AACA,+D;;AAEA,8D;AACA,oE;;AAEA,iD;AACA,E;;AAEA,G;AACA,gH;AACA,gB;AACA,kH;AACA,2J;AACA,sH;AACA,6N;AACA,kI;AACA,G;AACA,sF;AACA,iF;AACA,6C;AACA,wE;AACA,+D;AACA,E;;AAEA,G;AACA,0G;AACA,gB;AACA,mG;AACA,G;AACA,gC;AACA,8D;AACA,oE;;AAEA,gB;AACA,6B;AACA,iC;AACA,gD;AACA,uB;AACA,sB;AACA,K;;AAEA,uD;AACA,G;AACA,E;;AAEA,G;AACA,2D;AACA,gB;AACA,oI;AACA,G;AACA,+C;AACA,sD;;AAEA,4E;AACA,E;;AAEA,G;AACA,2G;AACA,gB;AACA,oI;AACA,iG;AACA,G;AACA,6D;AACA,sD;;AAEA,2D;AACA,gD;AACA,E;;AAEA,yD;AACA,mC;AACA,0E;;AAEA,qE;AACA,kC;AACA,0B;AACA,sB;AACA,G;AACA,sD;;AAEA,iB;AACA,yC;AACA,6C;AACA,6C;AACA,+C;AACA,qD;;AAEA,kE;AACA,E;;AAEA,G;AACA,uJ;AACA,gB;AACA,iH;AACA,G;AACA,0C;AACA,c;;AAEA,wB;AACA,oC;AACA,mD;AACA,6B;AACA,4C;AACA,4C;AACA,0D;AACA,qC;AACA,8C;AACA,mD;AACA,U;AACA,oD;AACA,G;;AAEA,gD;AACA,E;;AAEA,kB;AACA,2C;AACA,iE;AACA,iD;;AAEA,6B;AACA,4C;;AAEA,gC;AACA,E;;AAEA,+B;;AAEA,G;AACA,sF;AACA,gB;AACA,mG;AACA,G;AACA,qD;AACA,2B;;AAEA,4C;AACA,8C;AACA,6B;AACA,yB;AACA,G;;AAEA,8D;AACA,6C;AACA,wB;AACA,2C;AACA,mD;AACA,yD;AACA,0D;AACA,0D;AACA,U;AACA,oD;AACA,G;AACA,E;;AAEA,wD;AACA,U;AACA,yC;AACA,+B;AACA,wD;AACA,6D;AACA,4D;AACA,qD;AACA,a;AACA,gD;;AAEA,a;AACA,sC;AACA,6B;AACA,wB;AACA,U;AACA,6D;AACA,yB;AACA,gB;AACA,G;AACA,E;;AAEA,8C;AACA,0B;;AAEA,a;AACA,gC;AACA,uB;AACA,G;;AAEA,mB;AACA,E;;AAEA,+C;AACA,+C;AACA,kB;AACA,2B;AACA,gC;AACA,iB;AACA,4B;AACA,kC;AACA,U;AACA,gE;AACA,K;AACA,G;;AAEA,a;AACA,sC;AACA,6B;AACA,wB;AACA,U;AACA,gB;AACA,G;AACA,E;;AAEA,+D;AACA,0C;AACA,mB;;AAEA,uB;AACA,iD;;AAEA,yE;AACA,+C;AACA,uC;AACA,wE;AACA,yC;AACA,wC;AACA,+B;AACA,iB;;AAEA,sC;AACA,uC;AACA,gD;AACA,uC;AACA,0B;AACA,2D;AACA,0B;AACA,oD;AACA,wC;AACA,6D;AACA,6D;AACA,e;AACA,Y;AACA,+B;AACA,iC;AACA,c;AACA,S;AACA,O;AACA,K;;AAEA,oC;AACA,kC;AACA,e;AACA,O;AACA,uB;AACA,K;AACA,E;;;;;;;;;;;;;;;;;;;ACp3BA,6C;AACA,iD;AACA,iB;AACA,iB;AACA,E;;AAEA,G;AACA,uE;AACA,gB;AACA,wK;AACA,qG;AACA,G;AACA,2C;AACA,6C;;AAEA,iC;;AAEA,kC;AACA,qC;AACA,sC;AACA,gC;AACA,iC;AACA,qC;AACA,Y;AACA,6B;AACA,K;AACA,K;;AAEA,c;AACA,E;;AAEA,G;AACA,iE;AACA,gB;AACA,wM;AACA,qG;AACA,sL;AACA,G;AACA,kE;AACA,qC;;AAEA,6D;AACA,+C;AACA,qC;AACA,K;AACA,qC;AACA,kC;AACA,8B;AACA,4D;AACA,+C;AACA,qC;AACA,K;;AAEA,c;AACA,E;;AAEA,G;AACA,gD;AACA,gB;AACA,wL;AACA,qG;AACA,sL;AACA,G;AACA,gE;AACA,uE;AACA,E;;AAEA,G;AACA,qF;AACA,gB;AACA,8H;AACA,qG;AACA,yK;AACA,G;AACA,wD;AACA,iD;AACA,wC;AACA,gC;AACA,sC;AACA,qD;AACA,qC;AACA,K;AACA,oB;AACA,K;AACA,gC;AACA,wB;AACA,8B;AACA,6B;AACA,qC;AACA,+B;AACA,oC;;AAEA,sC;AACA,qD;AACA,gE;AACA,oD;AACA,kC;AACA,qC;AACA,0C;;AAEA,+D;AACA,mC;AACA,Q;AACA,2C;AACA,yC;AACA,mE;AACA,8B;;AAEA,0C;AACA,gD;AACA,0C;AACA,sC;AACA,iD;AACA,0C;AACA,a;;AAEA,sE;AACA,uD;AACA,kB;AACA,mE;AACA,W;AACA,W;AACA,Q;AACA,6C;AACA,yC;AACA,8B;AACA,0C;AACA,gD;AACA,0C;AACA,mD;AACA,+D;AACA,yC;AACA,2C;AACA,uC;AACA,4D;AACA,gC;AACA,a;AACA,kB;AACA,sD;AACA,W;AACA,W;AACA,Q;AACA,yD;AACA,yC;AACA,0C;AACA,gD;AACA,kB;AACA,yB;AACA,qC;AACA,kE;AACA,oB;AACA,yD;AACA,a;AACA,0C;AACA,W;AACA,W;AACA,Q;AACA,wD;AACA,yC;AACA,0C;AACA,gD;AACA,0C;AACA,8D;AACA,kB;AACA,oD;AACA,+C;AACA,0C;AACA,kD;AACA,W;AACA,W;AACA,O;AACA,O;;AAEA,uD;AACA,iC;AACA,mC;AACA,mD;AACA,K;AACA,K;;AAEA,wC;AACA,4B;AACA,iC;AACA,K;;AAEA,kB;AACA,E;;AAEA,mD;AACA,Q;;AAEA,oB;AACA,kC;AACA,2B;AACA,iB;AACA,M;AACA,G;;AAEA,+E;AACA,6E;AACA,6E;AACA,4E;AACA,0D;AACA,4E;AACA,qE;AACA,iC;AACA,I;AACA,0E;AACA,mE;AACA,oC;AACA,iC;AACA,uE;AACA,0D;AACA,K;AACA,4B;AACA,gE;AACA,Y;AACA,uB;AACA,K;AACA,I;;AAEA,wC;AACA,yC;;AAEA,mE;AACA,yE;AACA,sD;AACA,4C;AACA,wC;AACA,K;AACA,wC;AACA,yC;AACA,K;;AAEA,mB;AACA,I;;AAEA,qD;AACA,4B;AACA,W;AACA,E;;AAEA,oE;AACA,6D;AACA,2C;;AAEA,iE;AACA,oE;AACA,qE;AACA,qE;AACA,kC;AACA,uC;;AAEA,kC;AACA,8C;AACA,iC;AACA,K;AACA,c;AACA,E;;AAEA,wB;AACA,yD;;;;;;;;;;;;;;;;;;;ACrQA,0B;;AAEA,yC;AACA,qE;AACA,8C;AACA,oC;AACA,E;;AAEA,6C;AACA,8B;AACA,a;AACA,2B;AACA,E;;AAEA,oE;AACA,+B;AACA,oC;AACA,gC;AACA,wB;AACA,iC;AACA,uB;AACA,kB;AACA,sC;AACA,M;AACA,G;AACA,W;AACA,E;;AAEA,4B;;AAEA,8E;AACA,0B;AACA,oC;;AAEA,qC;AACA,8C;AACA,4C;AACA,mC;AACA,Y;AACA,oB;AACA,K;AACA,G;;AAEA,qB;AACA,yB;AACA,gC;AACA,kC;AACA,2D;AACA,gD;AACA,yE;AACA,gF;AACA,+C;AACA,O;AACA,K;AACA,0B;AACA,G;;AAEA,c;AACA,E;;AAEA,6C;AACA,gC;AACA,a;AACA,G;;AAEA,sB;AACA,oB;AACA,yB;;AAEA,+E;AACA,mF;AACA,O;AACA,I;AACA,E;;AAEA,0D;AACA,6D;AACA,4D;AACA,uD;AACA,wD;AACA,2D;AACA,mC;AACA,E;AACA,yD;AACA,kD;AACA,E;AACA,sD;AACA,0D;AACA,0C;AACA,yD;AACA,+B;AACA,qD;AACA,a;AACA,wB;;AAEA,8B;AACA,4D;AACA,G;;AAEA,yB;AACA,mE;AACA,0C;AACA,8B;AACA,uE;;AAEA,yE;;AAEA,wB;AACA,sE;AACA,kE;AACA,0D;AACA,gE;AACA,gC;AACA,kD;AACA,kE;AACA,yB;AACA,U;AACA,wB;AACA,sD;AACA,iC;AACA,qD;AACA,qD;AACA,O;AACA,yD;AACA,qD;AACA,O;AACA,iB;AACA,oB;AACA,yB;AACA,oC;AACA,iC;AACA,2D;AACA,S;AACA,iB;AACA,O;AACA,sC;AACA,M;AACA,G;AACA,c;AACA,E;;AAEA,kC;AACA,6C;AACA,yD;AACA,uE;AACA,uB;AACA,e;AACA,G;AACA,sC;AACA,iD;AACA,6C;AACA,G;;AAEA,gB;AACA,gB;AACA,uB;AACA,yD;AACA,+B;AACA,E;;;AAGA,uD;AACA,4C;AACA,E;;;;;;;;;;;;;;;;;;;ACnKA,mD;AACA,E;AACA,qE;AACA,0C;AACA,E;AACA,sE;AACA,2B;;AAEA,G;AACA,S;AACA,0G;AACA,gB;AACA,uH;AACA,+L;AACA,G;AACA,sD;AACA,yC;AACA,2B;AACA,wD;;AAEA,uC;AACA,kC;AACA,8B;AACA,kB;AACA,G;AACA,mC;AACA,8D;AACA,2C;AACA,yD;;AAEA,2B;AACA,uC;;AAEA,iC;AACA,wB;;AAEA,qB;AACA,gB;AACA,iB;AACA,iB;AACA,I;AACA,E;AACA,8B;;AAEA,+B;AACA,2C;AACA,wB;AACA,E;AACA,mD;AACA,0B;AACA,E;AACA,2C;AACA,4B;AACA,E;;AAEA,G;AACA,oF;AACA,gB;AACA,wC;AACA,G;AACA,iC;AACA,uC;AACA,E;;AAEA,G;AACA,mB;AACA,Y;AACA,qB;AACA,0F;AACA,mE;AACA,gB;AACA,G;AACA,8C;AACA,mC;AACA,E;;AAEA,G;AACA,oB;AACA,Y;AACA,qB;AACA,wG;AACA,mE;AACA,gB;AACA,G;AACA,+C;AACA,oC;AACA,E;;AAEA,G;AACA,qB;AACA,Y;AACA,qB;AACA,qH;AACA,mE;AACA,gB;AACA,G;AACA,gD;AACA,qC;AACA,E;;AAEA,qD;AACA,kB;AACA,mD;AACA,sE;AACA,mE;AACA,6B;AACA,uD;AACA,mB;AACA,E;;AAEA,oD;AACA,qC;AACA,qC;AACA,iB;AACA,yD;AACA,oC;AACA,O;AACA,O;AACA,E;;AAEA,qE;AACA,kB;AACA,4D;AACA,uB;;AAEA,+B;AACA,sE;AACA,4B;AACA,6D;;AAEA,4D;AACA,sC;AACA,iC;AACA,e;;AAEA,yE;AACA,oE;AACA,yE;AACA,mE;AACA,kE;AACA,sE;AACA,mD;AACA,0D;AACA,O;;AAEA,6C;AACA,0C;AACA,S;AACA,O;AACA,G;;AAEA,4D;AACA,uC;AACA,4E;AACA,c;AACA,sC;;AAEA,O;AACA,gB;AACA,uC;AACA,kB;AACA,sE;AACA,oB;AACA,O;AACA,oC;;AAEA,8C;AACA,kD;AACA,gD;AACA,Y;AACA,uE;AACA,4B;AACA,2B;AACA,K;;AAEA,gB;AACA,I;;AAEA,K;AACA,mB;AACA,c;AACA,uB;AACA,2E;AACA,kB;AACA,uB;AACA,K;AACA,qE;AACA,yE;AACA,iD;AACA,uD;AACA,kC;AACA,6D;AACA,K;;AAEA,K;AACA,oB;AACA,c;AACA,uB;AACA,4E;AACA,kB;AACA,uB;AACA,K;AACA,yD;AACA,gC;AACA,8D;AACA,K;;AAEA,K;AACA,qB;AACA,c;AACA,uB;AACA,6E;AACA,kB;AACA,uB;AACA,K;AACA,2D;AACA,oC;AACA,+D;AACA,K;;AAEA,c;AACA,E;;AAEA,G;AACA,S;AACA,4C;AACA,2B;AACA,yB;AACA,G;AACA,0C;AACA,iD;AACA,2B;AACA,4C;;AAEA,qC;AACA,qC;;AAEA,gC;;AAEA,K;AACA,e;AACA,qC;AACA,c;AACA,iF;AACA,kB;AACA,uB;AACA,K;AACA,mB;AACA,mB;;AAEA,K;AACA,oB;AACA,qC;AACA,c;AACA,qE;AACA,kB;AACA,oB;AACA,K;AACA,wB;;AAEA,K;AACA,mB;AACA,qC;AACA,c;AACA,oE;AACA,kB;AACA,oB;AACA,K;AACA,uB;;AAEA,6D;AACA,yD;AACA,+E;AACA,8E;AACA,uC;AACA,mD;AACA,6B;;AAEA,iC;AACA,E;;AAEA,G;AACA,gH;AACA,gB;AACA,uF;AACA,uB;AACA,G;AACA,0D;AACA,uB;AACA,uB;AACA,oE;AACA,oC;AACA,E;;AAEA,G;AACA,4E;AACA,gB;AACA,uF;AACA,0B;AACA,G;AACA,gE;AACA,sD;AACA,E;;AAEA,G;AACA,2E;AACA,gB;AACA,uF;AACA,wB;AACA,G;AACA,6D;AACA,gC;AACA,2B;AACA,E;;AAEA,G;AACA,4G;AACA,gB;AACA,yG;AACA,G;AACA,yD;AACA,8B;AACA,E;;AAEA,G;AACA,8E;AACA,kC;AACA,yE;AACA,2E;AACA,8E;AACA,sB;AACA,gB;AACA,0E;AACA,6B;AACA,8E;AACA,a;AACA,0E;AACA,2E;AACA,wC;AACA,G;AACA,yE;AACA,kB;;AAEA,6C;AACA,kC;;AAEA,0C;AACA,qB;AACA,oB;AACA,iC;AACA,kC;AACA,qC;AACA,2B;AACA,sE;AACA,+C;AACA,qE;AACA,wB;AACA,6B;AACA,K;AACA,G;;AAEA,gB;AACA,oC;AACA,uC;AACA,0E;AACA,6D;AACA,gD;;AAEA,+E;AACA,gF;AACA,c;AACA,+B;AACA,sC;AACA,K;;AAEA,qB;AACA,wB;AACA,K;AACA,I;AACA,uB;;AAEA,wD;;AAEA,sD;AACA,qD;;AAEA,8E;AACA,4E;AACA,a;AACA,6B;AACA,sC;AACA,K;AACA,G;;AAEA,mB;AACA,E;;AAEA,G;AACA,+E;AACA,uE;AACA,4E;AACA,S;AACA,G;AACA,mE;AACA,iC;;AAEA,2E;AACA,0B;AACA,K;;AAEA,4B;AACA,E;;AAEA,G;AACA,gE;AACA,gB;AACA,kE;AACA,G;AACA,8C;AACA,qB;AACA,mC;AACA,E;;AAEA,gE;AACA,6D;AACA,+E;AACA,uE;AACA,a;AACA,6C;;AAEA,4E;AACA,iC;AACA,uD;AACA,kE;AACA,O;AACA,iE;AACA,kB;AACA,a;AACA,gE;AACA,G;AACA,E;;AAEA,G;AACA,qD;AACA,gB;AACA,6E;AACA,G;AACA,iD;AACA,sB;AACA,qB;AACA,2B;AACA,qC;AACA,wC;AACA,oD;AACA,sD;AACA,yB;AACA,oB;AACA,yD;AACA,mE;AACA,8C;;AAEA,iF;AACA,qC;AACA,W;AACA,Q;AACA,uB;AACA,G;;AAEA,uC;AACA,E;;AAEA,G;AACA,Y;AACA,iB;AACA,qB;AACA,mK;AACA,gB;AACA,oC;AACA,G;AACA,iC;AACA,8C;AACA,+C;AACA,E;;AAEA,qE;AACA,uC;;AAEA,G;AACA,W;AACA,E;AACA,4E;AACA,oC;AACA,+E;AACA,kC;AACA,+E;AACA,Y;AACA,E;AACA,mD;AACA,gB;AACA,Y;AACA,G;AACA,qC;;AAEA,G;AACA,+E;AACA,gB;AACA,Y;AACA,4G;AACA,G;AACA,wC;;AAEA,G;AACA,gG;AACA,gB;AACA,Y;AACA,yE;AACA,yD;AACA,G;AACA,+C;;;;;;;;;;;;;;;;;;;ACtgBA,W;;AAEA,gC;AACA,+C;;AAEA,gB;AACA,iD;;AAEA,mC;;AAEA,qE;AACA,iC;AACA,0C;AACA,uB;AACA,E;AACA,uD;AACA,gC;AACA,E","file":"/packages/blaze.js","sourcesContent":["/**\n * @namespace Blaze\n * @summary The namespace for all Blaze-related methods and classes.\n */\nBlaze = {};\n\n// Utility to HTML-escape a string. Included for legacy reasons.\nBlaze._escape = (function() {\n var escape_map = {\n \"<\": \"<\",\n \">\": \">\",\n '\"': \""\",\n \"'\": \"'\",\n \"`\": \"`\", /* IE allows backtick-delimited attributes?? */\n \"&\": \"&\"\n };\n var escape_one = function(c) {\n return escape_map[c];\n };\n\n return function (x) {\n return x.replace(/[&<>\"'`]/g, escape_one);\n };\n})();\n\nBlaze._warn = function (msg) {\n msg = 'Warning: ' + msg;\n\n if ((typeof Log !== 'undefined') && Log && Log.warn)\n Log.warn(msg); // use Meteor's \"logging\" package\n else if ((typeof console !== 'undefined') && console.log)\n console.log(msg);\n};\n","var DOMBackend = {};\nBlaze._DOMBackend = DOMBackend;\n\nvar $jq = (typeof jQuery !== 'undefined' ? jQuery :\n (typeof Package !== 'undefined' ?\n Package.jquery && Package.jquery.jQuery : null));\nif (! $jq)\n throw new Error(\"jQuery not found\");\n\nDOMBackend._$jq = $jq;\n\nDOMBackend.parseHTML = function (html) {\n // Return an array of nodes.\n //\n // jQuery does fancy stuff like creating an appropriate\n // container element and setting innerHTML on it, as well\n // as working around various IE quirks.\n return $jq.parseHTML(html) || [];\n};\n\nDOMBackend.Events = {\n // `selector` is non-null. `type` is one type (but\n // may be in backend-specific form, e.g. have namespaces).\n // Order fired must be order bound.\n delegateEvents: function (elem, type, selector, handler) {\n $jq(elem).on(type, selector, handler);\n },\n\n undelegateEvents: function (elem, type, handler) {\n $jq(elem).off(type, '**', handler);\n },\n\n bindEventCapturer: function (elem, type, selector, handler) {\n var $elem = $jq(elem);\n\n var wrapper = function (event) {\n event = $jq.event.fix(event);\n event.currentTarget = event.target;\n\n // Note: It might improve jQuery interop if we called into jQuery\n // here somehow. Since we don't use jQuery to dispatch the event,\n // we don't fire any of jQuery's event hooks or anything. However,\n // since jQuery can't bind capturing handlers, it's not clear\n // where we would hook in. Internal jQuery functions like `dispatch`\n // are too high-level.\n var $target = $jq(event.currentTarget);\n if ($target.is($elem.find(selector)))\n handler.call(elem, event);\n };\n\n handler._meteorui_wrapper = wrapper;\n\n type = DOMBackend.Events.parseEventType(type);\n // add *capturing* event listener\n elem.addEventListener(type, wrapper, true);\n },\n\n unbindEventCapturer: function (elem, type, handler) {\n type = DOMBackend.Events.parseEventType(type);\n elem.removeEventListener(type, handler._meteorui_wrapper, true);\n },\n\n parseEventType: function (type) {\n // strip off namespaces\n var dotLoc = type.indexOf('.');\n if (dotLoc >= 0)\n return type.slice(0, dotLoc);\n return type;\n }\n};\n\n\n///// Removal detection and interoperability.\n\n// For an explanation of this technique, see:\n// http://bugs.jquery.com/ticket/12213#comment:23 .\n//\n// In short, an element is considered \"removed\" when jQuery\n// cleans up its *private* userdata on the element,\n// which we can detect using a custom event with a teardown\n// hook.\n\nvar NOOP = function () {};\n\n// Circular doubly-linked list\nvar TeardownCallback = function (func) {\n this.next = this;\n this.prev = this;\n this.func = func;\n};\n\n// Insert newElt before oldElt in the circular list\nTeardownCallback.prototype.linkBefore = function(oldElt) {\n this.prev = oldElt.prev;\n this.next = oldElt;\n oldElt.prev.next = this;\n oldElt.prev = this;\n};\n\nTeardownCallback.prototype.unlink = function () {\n this.prev.next = this.next;\n this.next.prev = this.prev;\n};\n\nTeardownCallback.prototype.go = function () {\n var func = this.func;\n func && func();\n};\n\nTeardownCallback.prototype.stop = TeardownCallback.prototype.unlink;\n\nDOMBackend.Teardown = {\n _JQUERY_EVENT_NAME: 'blaze_teardown_watcher',\n _CB_PROP: '$blaze_teardown_callbacks',\n // Registers a callback function to be called when the given element or\n // one of its ancestors is removed from the DOM via the backend library.\n // The callback function is called at most once, and it receives the element\n // in question as an argument.\n onElementTeardown: function (elem, func) {\n var elt = new TeardownCallback(func);\n\n var propName = DOMBackend.Teardown._CB_PROP;\n if (! elem[propName]) {\n // create an empty node that is never unlinked\n elem[propName] = new TeardownCallback;\n\n // Set up the event, only the first time.\n $jq(elem).on(DOMBackend.Teardown._JQUERY_EVENT_NAME, NOOP);\n }\n\n elt.linkBefore(elem[propName]);\n\n return elt; // so caller can call stop()\n },\n // Recursively call all teardown hooks, in the backend and registered\n // through DOMBackend.onElementTeardown.\n tearDownElement: function (elem) {\n var elems = [];\n // Array.prototype.slice.call doesn't work when given a NodeList in\n // IE8 (\"JScript object expected\").\n var nodeList = elem.getElementsByTagName('*');\n for (var i = 0; i < nodeList.length; i++) {\n elems.push(nodeList[i]);\n }\n elems.push(elem);\n $jq.cleanData(elems);\n }\n};\n\n$jq.event.special[DOMBackend.Teardown._JQUERY_EVENT_NAME] = {\n setup: function () {\n // This \"setup\" callback is important even though it is empty!\n // Without it, jQuery will call addEventListener, which is a\n // performance hit, especially with Chrome's async stack trace\n // feature enabled.\n },\n teardown: function() {\n var elem = this;\n var callbacks = elem[DOMBackend.Teardown._CB_PROP];\n if (callbacks) {\n var elt = callbacks.next;\n while (elt !== callbacks) {\n elt.go();\n elt = elt.next;\n }\n callbacks.go();\n\n elem[DOMBackend.Teardown._CB_PROP] = null;\n }\n }\n};\n\n\n// Must use jQuery semantics for `context`, not\n// querySelectorAll's. In other words, all the parts\n// of `selector` must be found under `context`.\nDOMBackend.findBySelector = function (selector, context) {\n return $jq(selector, context);\n};\n","\n// A constant empty array (frozen if the JS engine supports it).\nvar _emptyArray = Object.freeze ? Object.freeze([]) : [];\n\n// `[new] Blaze._DOMRange([nodeAndRangeArray])`\n//\n// A DOMRange consists of an array of consecutive nodes and DOMRanges,\n// which may be replaced at any time with a new array. If the DOMRange\n// has been attached to the DOM at some location, then updating\n// the array will cause the DOM to be updated at that location.\nBlaze._DOMRange = function (nodeAndRangeArray) {\n if (! (this instanceof DOMRange))\n // called without `new`\n return new DOMRange(nodeAndRangeArray);\n\n var members = (nodeAndRangeArray || _emptyArray);\n if (! (members && (typeof members.length) === 'number'))\n throw new Error(\"Expected array\");\n\n for (var i = 0; i < members.length; i++)\n this._memberIn(members[i]);\n\n this.members = members;\n this.emptyRangePlaceholder = null;\n this.attached = false;\n this.parentElement = null;\n this.parentRange = null;\n this.attachedCallbacks = _emptyArray;\n};\nvar DOMRange = Blaze._DOMRange;\n\n// In IE 8, don't use empty text nodes as placeholders\n// in empty DOMRanges, use comment nodes instead. Using\n// empty text nodes in modern browsers is great because\n// it doesn't clutter the web inspector. In IE 8, however,\n// it seems to lead in some roundabout way to the OAuth\n// pop-up crashing the browser completely. In the past,\n// we didn't use empty text nodes on IE 8 because they\n// don't accept JS properties, so just use the same logic\n// even though we don't need to set properties on the\n// placeholder anymore.\nDOMRange._USE_COMMENT_PLACEHOLDERS = (function () {\n var result = false;\n var textNode = document.createTextNode(\"\");\n try {\n textNode.someProp = true;\n } catch (e) {\n // IE 8\n result = true;\n }\n return result;\n})();\n\n// static methods\nDOMRange._insert = function (rangeOrNode, parentElement, nextNode, _isMove) {\n var m = rangeOrNode;\n if (m instanceof DOMRange) {\n m.attach(parentElement, nextNode, _isMove);\n } else {\n if (_isMove)\n DOMRange._moveNodeWithHooks(m, parentElement, nextNode);\n else\n DOMRange._insertNodeWithHooks(m, parentElement, nextNode);\n }\n};\n\nDOMRange._remove = function (rangeOrNode) {\n var m = rangeOrNode;\n if (m instanceof DOMRange) {\n m.detach();\n } else {\n DOMRange._removeNodeWithHooks(m);\n }\n};\n\nDOMRange._removeNodeWithHooks = function (n) {\n if (! n.parentNode)\n return;\n if (n.nodeType === 1 &&\n n.parentNode._uihooks && n.parentNode._uihooks.removeElement) {\n n.parentNode._uihooks.removeElement(n);\n } else {\n n.parentNode.removeChild(n);\n }\n};\n\nDOMRange._insertNodeWithHooks = function (n, parent, next) {\n // `|| null` because IE throws an error if 'next' is undefined\n next = next || null;\n if (n.nodeType === 1 &&\n parent._uihooks && parent._uihooks.insertElement) {\n parent._uihooks.insertElement(n, next);\n } else {\n parent.insertBefore(n, next);\n }\n};\n\nDOMRange._moveNodeWithHooks = function (n, parent, next) {\n if (n.parentNode !== parent)\n return;\n // `|| null` because IE throws an error if 'next' is undefined\n next = next || null;\n if (n.nodeType === 1 &&\n parent._uihooks && parent._uihooks.moveElement) {\n parent._uihooks.moveElement(n, next);\n } else {\n parent.insertBefore(n, next);\n }\n};\n\nDOMRange.forElement = function (elem) {\n if (elem.nodeType !== 1)\n throw new Error(\"Expected element, found: \" + elem);\n var range = null;\n while (elem && ! range) {\n range = (elem.$blaze_range || null);\n if (! range)\n elem = elem.parentNode;\n }\n return range;\n};\n\nDOMRange.prototype.attach = function (parentElement, nextNode, _isMove, _isReplace) {\n // This method is called to insert the DOMRange into the DOM for\n // the first time, but it's also used internally when\n // updating the DOM.\n //\n // If _isMove is true, move this attached range to a different\n // location under the same parentElement.\n if (_isMove || _isReplace) {\n if (! (this.parentElement === parentElement &&\n this.attached))\n throw new Error(\"Can only move or replace an attached DOMRange, and only under the same parent element\");\n }\n\n var members = this.members;\n if (members.length) {\n this.emptyRangePlaceholder = null;\n for (var i = 0; i < members.length; i++) {\n DOMRange._insert(members[i], parentElement, nextNode, _isMove);\n }\n } else {\n var placeholder = (\n DOMRange._USE_COMMENT_PLACEHOLDERS ?\n document.createComment(\"\") :\n document.createTextNode(\"\"));\n this.emptyRangePlaceholder = placeholder;\n parentElement.insertBefore(placeholder, nextNode || null);\n }\n this.attached = true;\n this.parentElement = parentElement;\n\n if (! (_isMove || _isReplace)) {\n for(var i = 0; i < this.attachedCallbacks.length; i++) {\n var obj = this.attachedCallbacks[i];\n obj.attached && obj.attached(this, parentElement);\n }\n }\n};\n\nDOMRange.prototype.setMembers = function (newNodeAndRangeArray) {\n var newMembers = newNodeAndRangeArray;\n if (! (newMembers && (typeof newMembers.length) === 'number'))\n throw new Error(\"Expected array\");\n\n var oldMembers = this.members;\n\n for (var i = 0; i < oldMembers.length; i++)\n this._memberOut(oldMembers[i]);\n for (var i = 0; i < newMembers.length; i++)\n this._memberIn(newMembers[i]);\n\n if (! this.attached) {\n this.members = newMembers;\n } else {\n // don't do anything if we're going from empty to empty\n if (newMembers.length || oldMembers.length) {\n // detach the old members and insert the new members\n var nextNode = this.lastNode().nextSibling;\n var parentElement = this.parentElement;\n // Use detach/attach, but don't fire attached/detached hooks\n this.detach(true /*_isReplace*/);\n this.members = newMembers;\n this.attach(parentElement, nextNode, false, true /*_isReplace*/);\n }\n }\n};\n\nDOMRange.prototype.firstNode = function () {\n if (! this.attached)\n throw new Error(\"Must be attached\");\n\n if (! this.members.length)\n return this.emptyRangePlaceholder;\n\n var m = this.members[0];\n return (m instanceof DOMRange) ? m.firstNode() : m;\n};\n\nDOMRange.prototype.lastNode = function () {\n if (! this.attached)\n throw new Error(\"Must be attached\");\n\n if (! this.members.length)\n return this.emptyRangePlaceholder;\n\n var m = this.members[this.members.length - 1];\n return (m instanceof DOMRange) ? m.lastNode() : m;\n};\n\nDOMRange.prototype.detach = function (_isReplace) {\n if (! this.attached)\n throw new Error(\"Must be attached\");\n\n var oldParentElement = this.parentElement;\n var members = this.members;\n if (members.length) {\n for (var i = 0; i < members.length; i++) {\n DOMRange._remove(members[i]);\n }\n } else {\n var placeholder = this.emptyRangePlaceholder;\n this.parentElement.removeChild(placeholder);\n this.emptyRangePlaceholder = null;\n }\n\n if (! _isReplace) {\n this.attached = false;\n this.parentElement = null;\n\n for(var i = 0; i < this.attachedCallbacks.length; i++) {\n var obj = this.attachedCallbacks[i];\n obj.detached && obj.detached(this, oldParentElement);\n }\n }\n};\n\nDOMRange.prototype.addMember = function (newMember, atIndex, _isMove) {\n var members = this.members;\n if (! (atIndex >= 0 && atIndex <= members.length))\n throw new Error(\"Bad index in range.addMember: \" + atIndex);\n\n if (! _isMove)\n this._memberIn(newMember);\n\n if (! this.attached) {\n // currently detached; just updated members\n members.splice(atIndex, 0, newMember);\n } else if (members.length === 0) {\n // empty; use the empty-to-nonempty handling of setMembers\n this.setMembers([newMember]);\n } else {\n var nextNode;\n if (atIndex === members.length) {\n // insert at end\n nextNode = this.lastNode().nextSibling;\n } else {\n var m = members[atIndex];\n nextNode = (m instanceof DOMRange) ? m.firstNode() : m;\n }\n members.splice(atIndex, 0, newMember);\n DOMRange._insert(newMember, this.parentElement, nextNode, _isMove);\n }\n};\n\nDOMRange.prototype.removeMember = function (atIndex, _isMove) {\n var members = this.members;\n if (! (atIndex >= 0 && atIndex < members.length))\n throw new Error(\"Bad index in range.removeMember: \" + atIndex);\n\n if (_isMove) {\n members.splice(atIndex, 1);\n } else {\n var oldMember = members[atIndex];\n this._memberOut(oldMember);\n\n if (members.length === 1) {\n // becoming empty; use the logic in setMembers\n this.setMembers(_emptyArray);\n } else {\n members.splice(atIndex, 1);\n if (this.attached)\n DOMRange._remove(oldMember);\n }\n }\n};\n\nDOMRange.prototype.moveMember = function (oldIndex, newIndex) {\n var member = this.members[oldIndex];\n this.removeMember(oldIndex, true /*_isMove*/);\n this.addMember(member, newIndex, true /*_isMove*/);\n};\n\nDOMRange.prototype.getMember = function (atIndex) {\n var members = this.members;\n if (! (atIndex >= 0 && atIndex < members.length))\n throw new Error(\"Bad index in range.getMember: \" + atIndex);\n return this.members[atIndex];\n};\n\nDOMRange.prototype._memberIn = function (m) {\n if (m instanceof DOMRange)\n m.parentRange = this;\n else if (m.nodeType === 1) // DOM Element\n m.$blaze_range = this;\n};\n\nDOMRange._destroy = function (m, _skipNodes) {\n if (m instanceof DOMRange) {\n if (m.view)\n Blaze._destroyView(m.view, _skipNodes);\n } else if ((! _skipNodes) && m.nodeType === 1) {\n // DOM Element\n if (m.$blaze_range) {\n Blaze._destroyNode(m);\n m.$blaze_range = null;\n }\n }\n};\n\nDOMRange.prototype._memberOut = DOMRange._destroy;\n\n// Tear down, but don't remove, the members. Used when chunks\n// of DOM are being torn down or replaced.\nDOMRange.prototype.destroyMembers = function (_skipNodes) {\n var members = this.members;\n for (var i = 0; i < members.length; i++)\n this._memberOut(members[i], _skipNodes);\n};\n\nDOMRange.prototype.destroy = function (_skipNodes) {\n DOMRange._destroy(this, _skipNodes);\n};\n\nDOMRange.prototype.containsElement = function (elem) {\n if (! this.attached)\n throw new Error(\"Must be attached\");\n\n // An element is contained in this DOMRange if it's possible to\n // reach it by walking parent pointers, first through the DOM and\n // then parentRange pointers. In other words, the element or some\n // ancestor of it is at our level of the DOM (a child of our\n // parentElement), and this element is one of our members or\n // is a member of a descendant Range.\n\n // First check that elem is a descendant of this.parentElement,\n // according to the DOM.\n if (! Blaze._elementContains(this.parentElement, elem))\n return false;\n\n // If elem is not an immediate child of this.parentElement,\n // walk up to its ancestor that is.\n while (elem.parentNode !== this.parentElement)\n elem = elem.parentNode;\n\n var range = elem.$blaze_range;\n while (range && range !== this)\n range = range.parentRange;\n\n return range === this;\n};\n\nDOMRange.prototype.containsRange = function (range) {\n if (! this.attached)\n throw new Error(\"Must be attached\");\n\n if (! range.attached)\n return false;\n\n // A DOMRange is contained in this DOMRange if it's possible\n // to reach this range by following parent pointers. If the\n // DOMRange has the same parentElement, then it should be\n // a member, or a member of a member etc. Otherwise, we must\n // contain its parentElement.\n\n if (range.parentElement !== this.parentElement)\n return this.containsElement(range.parentElement);\n\n if (range === this)\n return false; // don't contain self\n\n while (range && range !== this)\n range = range.parentRange;\n\n return range === this;\n};\n\nDOMRange.prototype.onAttached = function (attached) {\n this.onAttachedDetached({ attached: attached });\n};\n\n// callbacks are `attached(range, element)` and\n// `detached(range, element)`, and they may\n// access the `callbacks` object in `this`.\n// The arguments to `detached` are the same\n// range and element that were passed to `attached`.\nDOMRange.prototype.onAttachedDetached = function (callbacks) {\n if (this.attachedCallbacks === _emptyArray)\n this.attachedCallbacks = [];\n this.attachedCallbacks.push(callbacks);\n};\n\nDOMRange.prototype.$ = function (selector) {\n var self = this;\n\n var parentNode = this.parentElement;\n if (! parentNode)\n throw new Error(\"Can't select in removed DomRange\");\n\n // Strategy: Find all selector matches under parentNode,\n // then filter out the ones that aren't in this DomRange\n // using `DOMRange#containsElement`. This is\n // asymptotically slow in the presence of O(N) sibling\n // content that is under parentNode but not in our range,\n // so if performance is an issue, the selector should be\n // run on a child element.\n\n // Since jQuery can't run selectors on a DocumentFragment,\n // we don't expect findBySelector to work.\n if (parentNode.nodeType === 11 /* DocumentFragment */)\n throw new Error(\"Can't use $ on an offscreen range\");\n\n var results = Blaze._DOMBackend.findBySelector(selector, parentNode);\n\n // We don't assume `results` has jQuery API; a plain array\n // should do just as well. However, if we do have a jQuery\n // array, we want to end up with one also, so we use\n // `.filter`.\n\n // Function that selects only elements that are actually\n // in this DomRange, rather than simply descending from\n // `parentNode`.\n var filterFunc = function (elem) {\n // handle jQuery's arguments to filter, where the node\n // is in `this` and the index is the first argument.\n if (typeof elem === 'number')\n elem = this;\n\n return self.containsElement(elem);\n };\n\n if (! results.filter) {\n // not a jQuery array, and not a browser with\n // Array.prototype.filter (e.g. IE <9)\n var newResults = [];\n for (var i = 0; i < results.length; i++) {\n var x = results[i];\n if (filterFunc(x))\n newResults.push(x);\n }\n results = newResults;\n } else {\n // `results.filter` is either jQuery's or ECMAScript's `filter`\n results = results.filter(filterFunc);\n }\n\n return results;\n};\n\n// Returns true if element a contains node b and is not node b.\n//\n// The restriction that `a` be an element (not a document fragment,\n// say) is based on what's easy to implement cross-browser.\nBlaze._elementContains = function (a, b) {\n if (a.nodeType !== 1) // ELEMENT\n return false;\n if (a === b)\n return false;\n\n if (a.compareDocumentPosition) {\n return a.compareDocumentPosition(b) & 0x10;\n } else {\n // Should be only old IE and maybe other old browsers here.\n // Modern Safari has both functions but seems to get contains() wrong.\n // IE can't handle b being a text node. We work around this\n // by doing a direct parent test now.\n b = b.parentNode;\n if (! (b && b.nodeType === 1)) // ELEMENT\n return false;\n if (a === b)\n return true;\n\n return a.contains(b);\n }\n};\n","var EventSupport = Blaze._EventSupport = {};\n\nvar DOMBackend = Blaze._DOMBackend;\n\n// List of events to always delegate, never capture.\n// Since jQuery fakes bubbling for certain events in\n// certain browsers (like `submit`), we don't want to\n// get in its way.\n//\n// We could list all known bubbling\n// events here to avoid creating speculative capturers\n// for them, but it would only be an optimization.\nvar eventsToDelegate = EventSupport.eventsToDelegate = {\n blur: 1, change: 1, click: 1, focus: 1, focusin: 1,\n focusout: 1, reset: 1, submit: 1\n};\n\nvar EVENT_MODE = EventSupport.EVENT_MODE = {\n TBD: 0,\n BUBBLING: 1,\n CAPTURING: 2\n};\n\nvar NEXT_HANDLERREC_ID = 1;\n\nvar HandlerRec = function (elem, type, selector, handler, recipient) {\n this.elem = elem;\n this.type = type;\n this.selector = selector;\n this.handler = handler;\n this.recipient = recipient;\n this.id = (NEXT_HANDLERREC_ID++);\n\n this.mode = EVENT_MODE.TBD;\n\n // It's important that delegatedHandler be a different\n // instance for each handlerRecord, because its identity\n // is used to remove it.\n //\n // It's also important that the closure have access to\n // `this` when it is not called with it set.\n this.delegatedHandler = (function (h) {\n return function (evt) {\n if ((! h.selector) && evt.currentTarget !== evt.target)\n // no selector means only fire on target\n return;\n return h.handler.apply(h.recipient, arguments);\n };\n })(this);\n\n // WHY CAPTURE AND DELEGATE: jQuery can't delegate\n // non-bubbling events, because\n // event capture doesn't work in IE 8. However, there\n // are all sorts of new-fangled non-bubbling events\n // like \"play\" and \"touchenter\". We delegate these\n // events using capture in all browsers except IE 8.\n // IE 8 doesn't support these events anyway.\n\n var tryCapturing = elem.addEventListener &&\n (! _.has(eventsToDelegate,\n DOMBackend.Events.parseEventType(type)));\n\n if (tryCapturing) {\n this.capturingHandler = (function (h) {\n return function (evt) {\n if (h.mode === EVENT_MODE.TBD) {\n // must be first time we're called.\n if (evt.bubbles) {\n // this type of event bubbles, so don't\n // get called again.\n h.mode = EVENT_MODE.BUBBLING;\n DOMBackend.Events.unbindEventCapturer(\n h.elem, h.type, h.capturingHandler);\n return;\n } else {\n // this type of event doesn't bubble,\n // so unbind the delegation, preventing\n // it from ever firing.\n h.mode = EVENT_MODE.CAPTURING;\n DOMBackend.Events.undelegateEvents(\n h.elem, h.type, h.delegatedHandler);\n }\n }\n\n h.delegatedHandler(evt);\n };\n })(this);\n\n } else {\n this.mode = EVENT_MODE.BUBBLING;\n }\n};\nEventSupport.HandlerRec = HandlerRec;\n\nHandlerRec.prototype.bind = function () {\n // `this.mode` may be EVENT_MODE_TBD, in which case we bind both. in\n // this case, 'capturingHandler' is in charge of detecting the\n // correct mode and turning off one or the other handlers.\n if (this.mode !== EVENT_MODE.BUBBLING) {\n DOMBackend.Events.bindEventCapturer(\n this.elem, this.type, this.selector || '*',\n this.capturingHandler);\n }\n\n if (this.mode !== EVENT_MODE.CAPTURING)\n DOMBackend.Events.delegateEvents(\n this.elem, this.type,\n this.selector || '*', this.delegatedHandler);\n};\n\nHandlerRec.prototype.unbind = function () {\n if (this.mode !== EVENT_MODE.BUBBLING)\n DOMBackend.Events.unbindEventCapturer(this.elem, this.type,\n this.capturingHandler);\n\n if (this.mode !== EVENT_MODE.CAPTURING)\n DOMBackend.Events.undelegateEvents(this.elem, this.type,\n this.delegatedHandler);\n};\n\nEventSupport.listen = function (element, events, selector, handler, recipient, getParentRecipient) {\n\n // Prevent this method from being JITed by Safari. Due to a\n // presumed JIT bug in Safari -- observed in Version 7.0.6\n // (9537.78.2) -- this method may crash the Safari render process if\n // it is JITed.\n // Repro: https://github.com/dgreensp/public/tree/master/safari-crash\n try { element = element; } finally {}\n\n var eventTypes = [];\n events.replace(/[^ /]+/g, function (e) {\n eventTypes.push(e);\n });\n\n var newHandlerRecs = [];\n for (var i = 0, N = eventTypes.length; i < N; i++) {\n var type = eventTypes[i];\n\n var eventDict = element.$blaze_events;\n if (! eventDict)\n eventDict = (element.$blaze_events = {});\n\n var info = eventDict[type];\n if (! info) {\n info = eventDict[type] = {};\n info.handlers = [];\n }\n var handlerList = info.handlers;\n var handlerRec = new HandlerRec(\n element, type, selector, handler, recipient);\n newHandlerRecs.push(handlerRec);\n handlerRec.bind();\n handlerList.push(handlerRec);\n // Move handlers of enclosing ranges to end, by unbinding and rebinding\n // them. In jQuery (or other DOMBackend) this causes them to fire\n // later when the backend dispatches event handlers.\n if (getParentRecipient) {\n for (var r = getParentRecipient(recipient); r;\n r = getParentRecipient(r)) {\n // r is an enclosing range (recipient)\n for (var j = 0, Nj = handlerList.length;\n j < Nj; j++) {\n var h = handlerList[j];\n if (h.recipient === r) {\n h.unbind();\n h.bind();\n handlerList.splice(j, 1); // remove handlerList[j]\n handlerList.push(h);\n j--; // account for removed handler\n Nj--; // don't visit appended handlers\n }\n }\n }\n }\n }\n\n return {\n // closes over just `element` and `newHandlerRecs`\n stop: function () {\n var eventDict = element.$blaze_events;\n if (! eventDict)\n return;\n // newHandlerRecs has only one item unless you specify multiple\n // event types. If this code is slow, it's because we have to\n // iterate over handlerList here. Clearing a whole handlerList\n // via stop() methods is O(N^2) in the number of handlers on\n // an element.\n for (var i = 0; i < newHandlerRecs.length; i++) {\n var handlerToRemove = newHandlerRecs[i];\n var info = eventDict[handlerToRemove.type];\n if (! info)\n continue;\n var handlerList = info.handlers;\n for (var j = handlerList.length - 1; j >= 0; j--) {\n if (handlerList[j] === handlerToRemove) {\n handlerToRemove.unbind();\n handlerList.splice(j, 1); // remove handlerList[j]\n }\n }\n }\n newHandlerRecs.length = 0;\n }\n };\n};\n","var jsUrlsAllowed = false;\nBlaze._allowJavascriptUrls = function () {\n jsUrlsAllowed = true;\n};\nBlaze._javascriptUrlsAllowed = function () {\n return jsUrlsAllowed;\n};\n\n// An AttributeHandler object is responsible for updating a particular attribute\n// of a particular element. AttributeHandler subclasses implement\n// browser-specific logic for dealing with particular attributes across\n// different browsers.\n//\n// To define a new type of AttributeHandler, use\n// `var FooHandler = AttributeHandler.extend({ update: function ... })`\n// where the `update` function takes arguments `(element, oldValue, value)`.\n// The `element` argument is always the same between calls to `update` on\n// the same instance. `oldValue` and `value` are each either `null` or\n// a Unicode string of the type that might be passed to the value argument\n// of `setAttribute` (i.e. not an HTML string with character references).\n// When an AttributeHandler is installed, an initial call to `update` is\n// always made with `oldValue = null`. The `update` method can access\n// `this.name` if the AttributeHandler class is a generic one that applies\n// to multiple attribute names.\n//\n// AttributeHandlers can store custom properties on `this`, as long as they\n// don't use the names `element`, `name`, `value`, and `oldValue`.\n//\n// AttributeHandlers can't influence how attributes appear in rendered HTML,\n// only how they are updated after materialization as DOM.\n\nAttributeHandler = function (name, value) {\n this.name = name;\n this.value = value;\n};\nBlaze._AttributeHandler = AttributeHandler;\n\nAttributeHandler.prototype.update = function (element, oldValue, value) {\n if (value === null) {\n if (oldValue !== null)\n element.removeAttribute(this.name);\n } else {\n element.setAttribute(this.name, value);\n }\n};\n\nAttributeHandler.extend = function (options) {\n var curType = this;\n var subType = function AttributeHandlerSubtype(/*arguments*/) {\n AttributeHandler.apply(this, arguments);\n };\n subType.prototype = new curType;\n subType.extend = curType.extend;\n if (options)\n _.extend(subType.prototype, options);\n return subType;\n};\n\n/// Apply the diff between the attributes of \"oldValue\" and \"value\" to \"element.\"\n//\n// Each subclass must implement a parseValue method which takes a string\n// as an input and returns a dict of attributes. The keys of the dict\n// are unique identifiers (ie. css properties in the case of styles), and the\n// values are the entire attribute which will be injected into the element.\n//\n// Extended below to support classes, SVG elements and styles.\n\nvar DiffingAttributeHandler = AttributeHandler.extend({\n update: function (element, oldValue, value) {\n if (!this.getCurrentValue || !this.setValue || !this.parseValue)\n throw new Error(\"Missing methods in subclass of 'DiffingAttributeHandler'\");\n\n var oldAttrsMap = oldValue ? this.parseValue(oldValue) : {};\n var newAttrsMap = value ? this.parseValue(value) : {};\n\n // the current attributes on the element, which we will mutate.\n\n var attrString = this.getCurrentValue(element);\n var attrsMap = attrString ? this.parseValue(attrString) : {};\n\n _.each(_.keys(oldAttrsMap), function (t) {\n if (! (t in newAttrsMap))\n delete attrsMap[t];\n });\n\n _.each(_.keys(newAttrsMap), function (t) {\n attrsMap[t] = newAttrsMap[t];\n });\n\n this.setValue(element, _.values(attrsMap).join(' '));\n }\n});\n\nvar ClassHandler = DiffingAttributeHandler.extend({\n // @param rawValue {String}\n getCurrentValue: function (element) {\n return element.className;\n },\n setValue: function (element, className) {\n element.className = className;\n },\n parseValue: function (attrString) {\n var tokens = {};\n\n _.each(attrString.split(' '), function(token) {\n if (token)\n tokens[token] = token;\n });\n return tokens;\n }\n});\n\nvar SVGClassHandler = ClassHandler.extend({\n getCurrentValue: function (element) {\n return element.className.baseVal;\n },\n setValue: function (element, className) {\n element.setAttribute('class', className);\n }\n});\n\nvar StyleHandler = DiffingAttributeHandler.extend({\n getCurrentValue: function (element) {\n return element.getAttribute('style');\n },\n setValue: function (element, style) {\n if (style === '') {\n element.removeAttribute('style');\n } else {\n element.setAttribute('style', style);\n }\n },\n\n // Parse a string to produce a map from property to attribute string.\n //\n // Example:\n // \"color:red; foo:12px\" produces a token {color: \"color:red\", foo:\"foo:12px\"}\n parseValue: function (attrString) {\n var tokens = {};\n\n // Regex for parsing a css attribute declaration, taken from css-parse:\n // https://github.com/reworkcss/css-parse/blob/7cef3658d0bba872cde05a85339034b187cb3397/index.js#L219\n var regex = /(\\*?[-#\\/\\*\\\\\\w]+(?:\\[[0-9a-z_-]+\\])?)\\s*:\\s*(?:\\'(?:\\\\\\'|.)*?\\'|\"(?:\\\\\"|.)*?\"|\\([^\\)]*?\\)|[^};])+[;\\s]*/g;\n var match = regex.exec(attrString);\n while (match) {\n // match[0] = entire matching string\n // match[1] = css property\n // Prefix the token to prevent conflicts with existing properties.\n\n // XXX No `String.trim` on Safari 4. Swap out $.trim if we want to\n // remove strong dep on jquery.\n tokens[' ' + match[1]] = match[0].trim ?\n match[0].trim() : $.trim(match[0]);\n\n match = regex.exec(attrString);\n }\n\n return tokens;\n }\n});\n\nvar BooleanHandler = AttributeHandler.extend({\n update: function (element, oldValue, value) {\n var name = this.name;\n if (value == null) {\n if (oldValue != null)\n element[name] = false;\n } else {\n element[name] = true;\n }\n }\n});\n\nvar ValueHandler = AttributeHandler.extend({\n update: function (element, oldValue, value) {\n if (value !== element.value)\n element.value = value;\n }\n});\n\n// attributes of the type 'xlink:something' should be set using\n// the correct namespace in order to work\nvar XlinkHandler = AttributeHandler.extend({\n update: function(element, oldValue, value) {\n var NS = 'http://www.w3.org/1999/xlink';\n if (value === null) {\n if (oldValue !== null)\n element.removeAttributeNS(NS, this.name);\n } else {\n element.setAttributeNS(NS, this.name, this.value);\n }\n }\n});\n\n// cross-browser version of `instanceof SVGElement`\nvar isSVGElement = function (elem) {\n return 'ownerSVGElement' in elem;\n};\n\nvar isUrlAttribute = function (tagName, attrName) {\n // Compiled from http://www.w3.org/TR/REC-html40/index/attributes.html\n // and\n // http://www.w3.org/html/wg/drafts/html/master/index.html#attributes-1\n var urlAttrs = {\n FORM: ['action'],\n BODY: ['background'],\n BLOCKQUOTE: ['cite'],\n Q: ['cite'],\n DEL: ['cite'],\n INS: ['cite'],\n OBJECT: ['classid', 'codebase', 'data', 'usemap'],\n APPLET: ['codebase'],\n A: ['href'],\n AREA: ['href'],\n LINK: ['href'],\n BASE: ['href'],\n IMG: ['longdesc', 'src', 'usemap'],\n FRAME: ['longdesc', 'src'],\n IFRAME: ['longdesc', 'src'],\n HEAD: ['profile'],\n SCRIPT: ['src'],\n INPUT: ['src', 'usemap', 'formaction'],\n BUTTON: ['formaction'],\n BASE: ['href'],\n MENUITEM: ['icon'],\n HTML: ['manifest'],\n VIDEO: ['poster']\n };\n\n if (attrName === 'itemid') {\n return true;\n }\n\n var urlAttrNames = urlAttrs[tagName] || [];\n return _.contains(urlAttrNames, attrName);\n};\n\n// To get the protocol for a URL, we let the browser normalize it for\n// us, by setting it as the href for an anchor tag and then reading out\n// the 'protocol' property.\nif (Meteor.isClient) {\n var anchorForNormalization = document.createElement('A');\n}\n\nvar getUrlProtocol = function (url) {\n if (Meteor.isClient) {\n anchorForNormalization.href = url;\n return (anchorForNormalization.protocol || \"\").toLowerCase();\n } else {\n throw new Error('getUrlProtocol not implemented on the server');\n }\n};\n\n// UrlHandler is an attribute handler for all HTML attributes that take\n// URL values. It disallows javascript: URLs, unless\n// Blaze._allowJavascriptUrls() has been called. To detect javascript:\n// urls, we set the attribute on a dummy anchor element and then read\n// out the 'protocol' property of the attribute.\nvar origUpdate = AttributeHandler.prototype.update;\nvar UrlHandler = AttributeHandler.extend({\n update: function (element, oldValue, value) {\n var self = this;\n var args = arguments;\n\n if (Blaze._javascriptUrlsAllowed()) {\n origUpdate.apply(self, args);\n } else {\n var isJavascriptProtocol = (getUrlProtocol(value) === \"javascript:\");\n if (isJavascriptProtocol) {\n Blaze._warn(\"URLs that use the 'javascript:' protocol are not \" +\n \"allowed in URL attribute values. \" +\n \"Call Blaze._allowJavascriptUrls() \" +\n \"to enable them.\");\n origUpdate.apply(self, [element, oldValue, null]);\n } else {\n origUpdate.apply(self, args);\n }\n }\n }\n});\n\n// XXX make it possible for users to register attribute handlers!\nmakeAttributeHandler = function (elem, name, value) {\n // generally, use setAttribute but certain attributes need to be set\n // by directly setting a JavaScript property on the DOM element.\n if (name === 'class') {\n if (isSVGElement(elem)) {\n return new SVGClassHandler(name, value);\n } else {\n return new ClassHandler(name, value);\n }\n } else if (name === 'style') {\n return new StyleHandler(name, value);\n } else if ((elem.tagName === 'OPTION' && name === 'selected') ||\n (elem.tagName === 'INPUT' && name === 'checked')) {\n return new BooleanHandler(name, value);\n } else if ((elem.tagName === 'TEXTAREA' || elem.tagName === 'INPUT')\n && name === 'value') {\n // internally, TEXTAREAs tracks their value in the 'value'\n // attribute just like INPUTs.\n return new ValueHandler(name, value);\n } else if (name.substring(0,6) === 'xlink:') {\n return new XlinkHandler(name.substring(6), value);\n } else if (isUrlAttribute(elem.tagName, name)) {\n return new UrlHandler(name, value);\n } else {\n return new AttributeHandler(name, value);\n }\n\n // XXX will need one for 'style' on IE, though modern browsers\n // seem to handle setAttribute ok.\n};\n\n\nElementAttributesUpdater = function (elem) {\n this.elem = elem;\n this.handlers = {};\n};\n\n// Update attributes on `elem` to the dictionary `attrs`, whose\n// values are strings.\nElementAttributesUpdater.prototype.update = function(newAttrs) {\n var elem = this.elem;\n var handlers = this.handlers;\n\n for (var k in handlers) {\n if (! _.has(newAttrs, k)) {\n // remove attributes (and handlers) for attribute names\n // that don't exist as keys of `newAttrs` and so won't\n // be visited when traversing it. (Attributes that\n // exist in the `newAttrs` object but are `null`\n // are handled later.)\n var handler = handlers[k];\n var oldValue = handler.value;\n handler.value = null;\n handler.update(elem, oldValue, null);\n delete handlers[k];\n }\n }\n\n for (var k in newAttrs) {\n var handler = null;\n var oldValue;\n var value = newAttrs[k];\n if (! _.has(handlers, k)) {\n if (value !== null) {\n // make new handler\n handler = makeAttributeHandler(elem, k, value);\n handlers[k] = handler;\n oldValue = null;\n }\n } else {\n handler = handlers[k];\n oldValue = handler.value;\n }\n if (oldValue !== value) {\n handler.value = value;\n handler.update(elem, oldValue, value);\n if (value === null)\n delete handlers[k];\n }\n }\n};\n","// Turns HTMLjs into DOM nodes and DOMRanges.\n//\n// - `htmljs`: the value to materialize, which may be any of the htmljs\n// types (Tag, CharRef, Comment, Raw, array, string, boolean, number,\n// null, or undefined) or a View or Template (which will be used to\n// construct a View).\n// - `intoArray`: the array of DOM nodes and DOMRanges to push the output\n// into (required)\n// - `parentView`: the View we are materializing content for (optional)\n//\n// Returns `intoArray`, which is especially useful if you pass in `[]`.\nBlaze._materializeDOM = function (htmljs, intoArray, parentView) {\n // In order to use fewer stack frames, materializeDOMInner can push\n // tasks onto `workStack`, and they will be popped off\n // and run, last first, after materializeDOMInner returns. The\n // reason we use a stack instead of a queue is so that we recurse\n // depth-first, doing newer tasks first.\n var workStack = [];\n materializeDOMInner(htmljs, intoArray, parentView, workStack);\n\n // A \"task\" is either an array of arguments to materializeDOM or\n // a function to execute. If we only allowed functions as tasks,\n // we would have to generate the functions using _.bind or close\n // over a loop variable, either of which is a little less efficient.\n while (workStack.length) {\n // Note that running the workStack task may push new items onto\n // the workStack.\n var task = workStack.pop();\n if (typeof task === 'function') {\n task();\n } else {\n // assume array\n materializeDOMInner(task[0], task[1], task[2], workStack);\n }\n }\n\n return intoArray;\n};\n\nvar materializeDOMInner = function (htmljs, intoArray, parentView, workStack) {\n if (htmljs == null) {\n // null or undefined\n return;\n }\n\n switch (typeof htmljs) {\n case 'string': case 'boolean': case 'number':\n intoArray.push(document.createTextNode(String(htmljs)));\n return;\n case 'object':\n if (htmljs.htmljsType) {\n switch (htmljs.htmljsType) {\n case HTML.Tag.htmljsType:\n intoArray.push(materializeTag(htmljs, parentView, workStack));\n return;\n case HTML.CharRef.htmljsType:\n intoArray.push(document.createTextNode(htmljs.str));\n return;\n case HTML.Comment.htmljsType:\n intoArray.push(document.createComment(htmljs.sanitizedValue));\n return;\n case HTML.Raw.htmljsType:\n // Get an array of DOM nodes by using the browser's HTML parser\n // (like innerHTML).\n var nodes = Blaze._DOMBackend.parseHTML(htmljs.value);\n for (var i = 0; i < nodes.length; i++)\n intoArray.push(nodes[i]);\n return;\n }\n } else if (HTML.isArray(htmljs)) {\n for (var i = htmljs.length-1; i >= 0; i--) {\n workStack.push([htmljs[i], intoArray, parentView]);\n }\n return;\n } else {\n if (htmljs instanceof Blaze.Template) {\n htmljs = htmljs.constructView();\n // fall through to Blaze.View case below\n }\n if (htmljs instanceof Blaze.View) {\n Blaze._materializeView(htmljs, parentView, workStack, intoArray);\n return;\n }\n }\n }\n\n throw new Error(\"Unexpected object in htmljs: \" + htmljs);\n};\n\nvar materializeTag = function (tag, parentView, workStack) {\n var tagName = tag.tagName;\n var elem;\n if ((HTML.isKnownSVGElement(tagName) || isSVGAnchor(tag))\n && document.createElementNS) {\n // inline SVG\n elem = document.createElementNS('http://www.w3.org/2000/svg', tagName);\n } else {\n // normal elements\n elem = document.createElement(tagName);\n }\n\n var rawAttrs = tag.attrs;\n var children = tag.children;\n if (tagName === 'textarea' && tag.children.length &&\n ! (rawAttrs && ('value' in rawAttrs))) {\n // Provide very limited support for TEXTAREA tags with children\n // rather than a \"value\" attribute.\n // Reactivity in the form of Views nested in the tag's children\n // won't work. Compilers should compile textarea contents into\n // the \"value\" attribute of the tag, wrapped in a function if there\n // is reactivity.\n if (typeof rawAttrs === 'function' ||\n HTML.isArray(rawAttrs)) {\n throw new Error(\"Can't have reactive children of TEXTAREA node; \" +\n \"use the 'value' attribute instead.\");\n }\n rawAttrs = _.extend({}, rawAttrs || null);\n rawAttrs.value = Blaze._expand(children, parentView);\n children = [];\n }\n\n if (rawAttrs) {\n var attrUpdater = new ElementAttributesUpdater(elem);\n var updateAttributes = function () {\n var expandedAttrs = Blaze._expandAttributes(rawAttrs, parentView);\n var flattenedAttrs = HTML.flattenAttributes(expandedAttrs);\n var stringAttrs = {};\n for (var attrName in flattenedAttrs) {\n stringAttrs[attrName] = Blaze._toText(flattenedAttrs[attrName],\n parentView,\n HTML.TEXTMODE.STRING);\n }\n attrUpdater.update(stringAttrs);\n };\n var updaterComputation;\n if (parentView) {\n updaterComputation =\n parentView.autorun(updateAttributes, undefined, 'updater');\n } else {\n updaterComputation = Tracker.nonreactive(function () {\n return Tracker.autorun(function () {\n Tracker._withCurrentView(parentView, updateAttributes);\n });\n });\n }\n Blaze._DOMBackend.Teardown.onElementTeardown(elem, function attrTeardown() {\n updaterComputation.stop();\n });\n }\n\n if (children.length) {\n var childNodesAndRanges = [];\n // push this function first so that it's done last\n workStack.push(function () {\n for (var i = 0; i < childNodesAndRanges.length; i++) {\n var x = childNodesAndRanges[i];\n if (x instanceof Blaze._DOMRange)\n x.attach(elem);\n else\n elem.appendChild(x);\n }\n });\n // now push the task that calculates childNodesAndRanges\n workStack.push([children, childNodesAndRanges, parentView]);\n }\n\n return elem;\n};\n\n\nvar isSVGAnchor = function (node) {\n // We generally aren't able to detect SVG elements because\n // if \"A\" were in our list of known svg element names, then all\n // nodes would be created using\n // `document.createElementNS`. But in the special case of , we can at least detect that attribute and\n // create an SVG tag in that case.\n //\n // However, we still have a general problem of knowing when to\n // use document.createElementNS and when to use\n // document.createElement; for example, font tags will always\n // be created as SVG elements which can cause other\n // problems. #1977\n return (node.tagName === \"a\" &&\n node.attrs &&\n node.attrs[\"xlink:href\"] !== undefined);\n};\n","var debugFunc;\n\n// We call into user code in many places, and it's nice to catch exceptions\n// propagated from user code immediately so that the whole system doesn't just\n// break. Catching exceptions is easy; reporting them is hard. This helper\n// reports exceptions.\n//\n// Usage:\n//\n// ```\n// try {\n// // ... someStuff ...\n// } catch (e) {\n// reportUIException(e);\n// }\n// ```\n//\n// An optional second argument overrides the default message.\n\n// Set this to `true` to cause `reportException` to throw\n// the next exception rather than reporting it. This is\n// useful in unit tests that test error messages.\nBlaze._throwNextException = false;\n\nBlaze._reportException = function (e, msg) {\n if (Blaze._throwNextException) {\n Blaze._throwNextException = false;\n throw e;\n }\n\n if (! debugFunc)\n // adapted from Tracker\n debugFunc = function () {\n return (typeof Meteor !== \"undefined\" ? Meteor._debug :\n ((typeof console !== \"undefined\") && console.log ? console.log :\n function () {}));\n };\n\n // In Chrome, `e.stack` is a multiline string that starts with the message\n // and contains a stack trace. Furthermore, `console.log` makes it clickable.\n // `console.log` supplies the space between the two arguments.\n debugFunc()(msg || 'Exception caught in template:', e.stack || e.message);\n};\n\nBlaze._wrapCatchingExceptions = function (f, where) {\n if (typeof f !== 'function')\n return f;\n\n return function () {\n try {\n return f.apply(this, arguments);\n } catch (e) {\n Blaze._reportException(e, 'Exception in ' + where + ':');\n }\n };\n};\n","/// [new] Blaze.View([name], renderMethod)\n///\n/// Blaze.View is the building block of reactive DOM. Views have\n/// the following features:\n///\n/// * lifecycle callbacks - Views are created, rendered, and destroyed,\n/// and callbacks can be registered to fire when these things happen.\n///\n/// * parent pointer - A View points to its parentView, which is the\n/// View that caused it to be rendered. These pointers form a\n/// hierarchy or tree of Views.\n///\n/// * render() method - A View's render() method specifies the DOM\n/// (or HTML) content of the View. If the method establishes\n/// reactive dependencies, it may be re-run.\n///\n/// * a DOMRange - If a View is rendered to DOM, its position and\n/// extent in the DOM are tracked using a DOMRange object.\n///\n/// When a View is constructed by calling Blaze.View, the View is\n/// not yet considered \"created.\" It doesn't have a parentView yet,\n/// and no logic has been run to initialize the View. All real\n/// work is deferred until at least creation time, when the onViewCreated\n/// callbacks are fired, which happens when the View is \"used\" in\n/// some way that requires it to be rendered.\n///\n/// ...more lifecycle stuff\n///\n/// `name` is an optional string tag identifying the View. The only\n/// time it's used is when looking in the View tree for a View of a\n/// particular name; for example, data contexts are stored on Views\n/// of name \"with\". Names are also useful when debugging, so in\n/// general it's good for functions that create Views to set the name.\n/// Views associated with templates have names of the form \"Template.foo\".\n\n/**\n * @class\n * @summary Constructor for a View, which represents a reactive region of DOM.\n * @locus Client\n * @param {String} [name] Optional. A name for this type of View. See [`view.name`](#view_name).\n * @param {Function} renderFunction A function that returns [*renderable content*](#renderable_content). In this function, `this` is bound to the View.\n */\nBlaze.View = function (name, render) {\n if (! (this instanceof Blaze.View))\n // called without `new`\n return new Blaze.View(name, render);\n\n if (typeof name === 'function') {\n // omitted \"name\" argument\n render = name;\n name = '';\n }\n this.name = name;\n this._render = render;\n\n this._callbacks = {\n created: null,\n rendered: null,\n destroyed: null\n };\n\n // Setting all properties here is good for readability,\n // and also may help Chrome optimize the code by keeping\n // the View object from changing shape too much.\n this.isCreated = false;\n this._isCreatedForExpansion = false;\n this.isRendered = false;\n this._isAttached = false;\n this.isDestroyed = false;\n this._isInRender = false;\n this.parentView = null;\n this._domrange = null;\n // This flag is normally set to false except for the cases when view's parent\n // was generated as part of expanding some syntactic sugar expressions or\n // methods.\n // Ex.: Blaze.renderWithData is an equivalent to creating a view with regular\n // Blaze.render and wrapping it into {{#with data}}{{/with}} view. Since the\n // users don't know anything about these generated parent views, Blaze needs\n // this information to be available on views to make smarter decisions. For\n // example: removing the generated parent view with the view on Blaze.remove.\n this._hasGeneratedParent = false;\n\n this.renderCount = 0;\n};\n\nBlaze.View.prototype._render = function () { return null; };\n\nBlaze.View.prototype.onViewCreated = function (cb) {\n this._callbacks.created = this._callbacks.created || [];\n this._callbacks.created.push(cb);\n};\n\nBlaze.View.prototype._onViewRendered = function (cb) {\n this._callbacks.rendered = this._callbacks.rendered || [];\n this._callbacks.rendered.push(cb);\n};\n\nBlaze.View.prototype.onViewReady = function (cb) {\n var self = this;\n var fire = function () {\n Tracker.afterFlush(function () {\n if (! self.isDestroyed) {\n Blaze._withCurrentView(self, function () {\n cb.call(self);\n });\n }\n });\n };\n self._onViewRendered(function onViewRendered() {\n if (self.isDestroyed)\n return;\n if (! self._domrange.attached)\n self._domrange.onAttached(fire);\n else\n fire();\n });\n};\n\nBlaze.View.prototype.onViewDestroyed = function (cb) {\n this._callbacks.destroyed = this._callbacks.destroyed || [];\n this._callbacks.destroyed.push(cb);\n};\n\n/// View#autorun(func)\n///\n/// Sets up a Tracker autorun that is \"scoped\" to this View in two\n/// important ways: 1) Blaze.currentView is automatically set\n/// on every re-run, and 2) the autorun is stopped when the\n/// View is destroyed. As with Tracker.autorun, the first run of\n/// the function is immediate, and a Computation object that can\n/// be used to stop the autorun is returned.\n///\n/// View#autorun is meant to be called from View callbacks like\n/// onViewCreated, or from outside the rendering process. It may not\n/// be called before the onViewCreated callbacks are fired (too early),\n/// or from a render() method (too confusing).\n///\n/// Typically, autoruns that update the state\n/// of the View (as in Blaze.With) should be started from an onViewCreated\n/// callback. Autoruns that update the DOM should be started\n/// from either onViewCreated (guarded against the absence of\n/// view._domrange), or onViewReady.\nBlaze.View.prototype.autorun = function (f, _inViewScope, displayName) {\n var self = this;\n\n // The restrictions on when View#autorun can be called are in order\n // to avoid bad patterns, like creating a Blaze.View and immediately\n // calling autorun on it. A freshly created View is not ready to\n // have logic run on it; it doesn't have a parentView, for example.\n // It's when the View is materialized or expanded that the onViewCreated\n // handlers are fired and the View starts up.\n //\n // Letting the render() method call `this.autorun()` is problematic\n // because of re-render. The best we can do is to stop the old\n // autorun and start a new one for each render, but that's a pattern\n // we try to avoid internally because it leads to helpers being\n // called extra times, in the case where the autorun causes the\n // view to re-render (and thus the autorun to be torn down and a\n // new one established).\n //\n // We could lift these restrictions in various ways. One interesting\n // idea is to allow you to call `view.autorun` after instantiating\n // `view`, and automatically wrap it in `view.onViewCreated`, deferring\n // the autorun so that it starts at an appropriate time. However,\n // then we can't return the Computation object to the caller, because\n // it doesn't exist yet.\n if (! self.isCreated) {\n throw new Error(\"View#autorun must be called from the created callback at the earliest\");\n }\n if (this._isInRender) {\n throw new Error(\"Can't call View#autorun from inside render(); try calling it from the created or rendered callback\");\n }\n if (Tracker.active) {\n throw new Error(\"Can't call View#autorun from a Tracker Computation; try calling it from the created or rendered callback\");\n }\n\n // Each local variable allocate additional space on each frame of the\n // execution stack. When too many variables are allocated on stack, you can\n // run out of memory on stack running a deep recursion (which is typical for\n // Blaze functions) and get stackoverlow error. (The size of the stack varies\n // between browsers).\n // The trick we use here is to allocate only one variable on stack `locals`\n // that keeps references to all the rest. Since locals is allocated on heap,\n // we don't take up any space on the stack.\n var locals = {};\n locals.templateInstanceFunc = Blaze.Template._currentTemplateInstanceFunc;\n\n locals.f = function viewAutorun(c) {\n return Blaze._withCurrentView(_inViewScope || self, function () {\n return Blaze.Template._withTemplateInstanceFunc(locals.templateInstanceFunc, function () {\n return f.call(self, c);\n });\n });\n };\n\n // Give the autorun function a better name for debugging and profiling.\n // The `displayName` property is not part of the spec but browsers like Chrome\n // and Firefox prefer it in debuggers over the name function was declared by.\n locals.f.displayName =\n (self.name || 'anonymous') + ':' + (displayName || 'anonymous');\n locals.c = Tracker.autorun(locals.f);\n\n self.onViewDestroyed(function () { locals.c.stop(); });\n\n return locals.c;\n};\n\nBlaze.View.prototype._errorIfShouldntCallSubscribe = function () {\n var self = this;\n\n if (! self.isCreated) {\n throw new Error(\"View#subscribe must be called from the created callback at the earliest\");\n }\n if (self._isInRender) {\n throw new Error(\"Can't call View#subscribe from inside render(); try calling it from the created or rendered callback\");\n }\n if (self.isDestroyed) {\n throw new Error(\"Can't call View#subscribe from inside the destroyed callback, try calling it inside created or rendered.\");\n }\n};\n\n/**\n * Just like Blaze.View#autorun, but with Meteor.subscribe instead of\n * Tracker.autorun. Stop the subscription when the view is destroyed.\n * @return {SubscriptionHandle} A handle to the subscription so that you can\n * see if it is ready, or stop it manually\n */\nBlaze.View.prototype.subscribe = function (args, options) {\n var self = this;\n options = {} || options;\n\n self._errorIfShouldntCallSubscribe();\n\n var subHandle;\n if (options.connection) {\n subHandle = options.connection.subscribe.apply(options.connection, args);\n } else {\n subHandle = Meteor.subscribe.apply(Meteor, args);\n }\n\n self.onViewDestroyed(function () {\n subHandle.stop();\n });\n\n return subHandle;\n};\n\nBlaze.View.prototype.firstNode = function () {\n if (! this._isAttached)\n throw new Error(\"View must be attached before accessing its DOM\");\n\n return this._domrange.firstNode();\n};\n\nBlaze.View.prototype.lastNode = function () {\n if (! this._isAttached)\n throw new Error(\"View must be attached before accessing its DOM\");\n\n return this._domrange.lastNode();\n};\n\nBlaze._fireCallbacks = function (view, which) {\n Blaze._withCurrentView(view, function () {\n Tracker.nonreactive(function fireCallbacks() {\n var cbs = view._callbacks[which];\n for (var i = 0, N = (cbs && cbs.length); i < N; i++)\n cbs[i].call(view);\n });\n });\n};\n\nBlaze._createView = function (view, parentView, forExpansion) {\n if (view.isCreated)\n throw new Error(\"Can't render the same View twice\");\n\n view.parentView = (parentView || null);\n view.isCreated = true;\n if (forExpansion)\n view._isCreatedForExpansion = true;\n\n Blaze._fireCallbacks(view, 'created');\n};\n\nvar doFirstRender = function (view, initialContent) {\n var domrange = new Blaze._DOMRange(initialContent);\n view._domrange = domrange;\n domrange.view = view;\n view.isRendered = true;\n Blaze._fireCallbacks(view, 'rendered');\n\n var teardownHook = null;\n\n domrange.onAttached(function attached(range, element) {\n view._isAttached = true;\n\n teardownHook = Blaze._DOMBackend.Teardown.onElementTeardown(\n element, function teardown() {\n Blaze._destroyView(view, true /* _skipNodes */);\n });\n });\n\n // tear down the teardown hook\n view.onViewDestroyed(function () {\n teardownHook && teardownHook.stop();\n teardownHook = null;\n });\n\n return domrange;\n};\n\n// Take an uncreated View `view` and create and render it to DOM,\n// setting up the autorun that updates the View. Returns a new\n// DOMRange, which has been associated with the View.\n//\n// The private arguments `_workStack` and `_intoArray` are passed in\n// by Blaze._materializeDOM. If provided, then we avoid the mutual\n// recursion of calling back into Blaze._materializeDOM so that deep\n// View hierarchies don't blow the stack. Instead, we push tasks onto\n// workStack for the initial rendering and subsequent setup of the\n// View, and they are done after we return. When there is a\n// _workStack, we do not return the new DOMRange, but instead push it\n// into _intoArray from a _workStack task.\nBlaze._materializeView = function (view, parentView, _workStack, _intoArray) {\n Blaze._createView(view, parentView);\n\n var domrange;\n var lastHtmljs;\n // We don't expect to be called in a Computation, but just in case,\n // wrap in Tracker.nonreactive.\n Tracker.nonreactive(function () {\n view.autorun(function doRender(c) {\n // `view.autorun` sets the current view.\n view.renderCount++;\n view._isInRender = true;\n // Any dependencies that should invalidate this Computation come\n // from this line:\n var htmljs = view._render();\n view._isInRender = false;\n\n if (! c.firstRun) {\n Tracker.nonreactive(function doMaterialize() {\n // re-render\n var rangesAndNodes = Blaze._materializeDOM(htmljs, [], view);\n if (! Blaze._isContentEqual(lastHtmljs, htmljs)) {\n domrange.setMembers(rangesAndNodes);\n Blaze._fireCallbacks(view, 'rendered');\n }\n });\n }\n lastHtmljs = htmljs;\n\n // Causes any nested views to stop immediately, not when we call\n // `setMembers` the next time around the autorun. Otherwise,\n // helpers in the DOM tree to be replaced might be scheduled\n // to re-run before we have a chance to stop them.\n Tracker.onInvalidate(function () {\n if (domrange) {\n domrange.destroyMembers();\n }\n });\n }, undefined, 'materialize');\n\n // first render. lastHtmljs is the first htmljs.\n var initialContents;\n if (! _workStack) {\n initialContents = Blaze._materializeDOM(lastHtmljs, [], view);\n domrange = doFirstRender(view, initialContents);\n initialContents = null; // help GC because we close over this scope a lot\n } else {\n // We're being called from Blaze._materializeDOM, so to avoid\n // recursion and save stack space, provide a description of the\n // work to be done instead of doing it. Tasks pushed onto\n // _workStack will be done in LIFO order after we return.\n // The work will still be done within a Tracker.nonreactive,\n // because it will be done by some call to Blaze._materializeDOM\n // (which is always called in a Tracker.nonreactive).\n initialContents = [];\n // push this function first so that it happens last\n _workStack.push(function () {\n domrange = doFirstRender(view, initialContents);\n initialContents = null; // help GC because of all the closures here\n _intoArray.push(domrange);\n });\n // now push the task that calculates initialContents\n _workStack.push([lastHtmljs, initialContents, view]);\n }\n });\n\n if (! _workStack) {\n return domrange;\n } else {\n return null;\n }\n};\n\n// Expands a View to HTMLjs, calling `render` recursively on all\n// Views and evaluating any dynamic attributes. Calls the `created`\n// callback, but not the `materialized` or `rendered` callbacks.\n// Destroys the view immediately, unless called in a Tracker Computation,\n// in which case the view will be destroyed when the Computation is\n// invalidated. If called in a Tracker Computation, the result is a\n// reactive string; that is, the Computation will be invalidated\n// if any changes are made to the view or subviews that might affect\n// the HTML.\nBlaze._expandView = function (view, parentView) {\n Blaze._createView(view, parentView, true /*forExpansion*/);\n\n view._isInRender = true;\n var htmljs = Blaze._withCurrentView(view, function () {\n return view._render();\n });\n view._isInRender = false;\n\n var result = Blaze._expand(htmljs, view);\n\n if (Tracker.active) {\n Tracker.onInvalidate(function () {\n Blaze._destroyView(view);\n });\n } else {\n Blaze._destroyView(view);\n }\n\n return result;\n};\n\n// Options: `parentView`\nBlaze._HTMLJSExpander = HTML.TransformingVisitor.extend();\nBlaze._HTMLJSExpander.def({\n visitObject: function (x) {\n if (x instanceof Blaze.Template)\n x = x.constructView();\n if (x instanceof Blaze.View)\n return Blaze._expandView(x, this.parentView);\n\n // this will throw an error; other objects are not allowed!\n return HTML.TransformingVisitor.prototype.visitObject.call(this, x);\n },\n visitAttributes: function (attrs) {\n // expand dynamic attributes\n if (typeof attrs === 'function')\n attrs = Blaze._withCurrentView(this.parentView, attrs);\n\n // call super (e.g. for case where `attrs` is an array)\n return HTML.TransformingVisitor.prototype.visitAttributes.call(this, attrs);\n },\n visitAttribute: function (name, value, tag) {\n // expand attribute values that are functions. Any attribute value\n // that contains Views must be wrapped in a function.\n if (typeof value === 'function')\n value = Blaze._withCurrentView(this.parentView, value);\n\n return HTML.TransformingVisitor.prototype.visitAttribute.call(\n this, name, value, tag);\n }\n});\n\n// Return Blaze.currentView, but only if it is being rendered\n// (i.e. we are in its render() method).\nvar currentViewIfRendering = function () {\n var view = Blaze.currentView;\n return (view && view._isInRender) ? view : null;\n};\n\nBlaze._expand = function (htmljs, parentView) {\n parentView = parentView || currentViewIfRendering();\n return (new Blaze._HTMLJSExpander(\n {parentView: parentView})).visit(htmljs);\n};\n\nBlaze._expandAttributes = function (attrs, parentView) {\n parentView = parentView || currentViewIfRendering();\n return (new Blaze._HTMLJSExpander(\n {parentView: parentView})).visitAttributes(attrs);\n};\n\nBlaze._destroyView = function (view, _skipNodes) {\n if (view.isDestroyed)\n return;\n view.isDestroyed = true;\n\n Blaze._fireCallbacks(view, 'destroyed');\n\n // Destroy views and elements recursively. If _skipNodes,\n // only recurse up to views, not elements, for the case where\n // the backend (jQuery) is recursing over the elements already.\n\n if (view._domrange)\n view._domrange.destroyMembers(_skipNodes);\n};\n\nBlaze._destroyNode = function (node) {\n if (node.nodeType === 1)\n Blaze._DOMBackend.Teardown.tearDownElement(node);\n};\n\n// Are the HTMLjs entities `a` and `b` the same? We could be\n// more elaborate here but the point is to catch the most basic\n// cases.\nBlaze._isContentEqual = function (a, b) {\n if (a instanceof HTML.Raw) {\n return (b instanceof HTML.Raw) && (a.value === b.value);\n } else if (a == null) {\n return (b == null);\n } else {\n return (a === b) &&\n ((typeof a === 'number') || (typeof a === 'boolean') ||\n (typeof a === 'string'));\n }\n};\n\n/**\n * @summary The View corresponding to the current template helper, event handler, callback, or autorun. If there isn't one, `null`.\n * @locus Client\n * @type {Blaze.View}\n */\nBlaze.currentView = null;\n\nBlaze._withCurrentView = function (view, func) {\n var oldView = Blaze.currentView;\n try {\n Blaze.currentView = view;\n return func();\n } finally {\n Blaze.currentView = oldView;\n }\n};\n\n// Blaze.render publicly takes a View or a Template.\n// Privately, it takes any HTMLJS (extended with Views and Templates)\n// except null or undefined, or a function that returns any extended\n// HTMLJS.\nvar checkRenderContent = function (content) {\n if (content === null)\n throw new Error(\"Can't render null\");\n if (typeof content === 'undefined')\n throw new Error(\"Can't render undefined\");\n\n if ((content instanceof Blaze.View) ||\n (content instanceof Blaze.Template) ||\n (typeof content === 'function'))\n return;\n\n try {\n // Throw if content doesn't look like HTMLJS at the top level\n // (i.e. verify that this is an HTML.Tag, or an array,\n // or a primitive, etc.)\n (new HTML.Visitor).visit(content);\n } catch (e) {\n // Make error message suitable for public API\n throw new Error(\"Expected Template or View\");\n }\n};\n\n// For Blaze.render and Blaze.toHTML, take content and\n// wrap it in a View, unless it's a single View or\n// Template already.\nvar contentAsView = function (content) {\n checkRenderContent(content);\n\n if (content instanceof Blaze.Template) {\n return content.constructView();\n } else if (content instanceof Blaze.View) {\n return content;\n } else {\n var func = content;\n if (typeof func !== 'function') {\n func = function () {\n return content;\n };\n }\n return Blaze.View('render', func);\n }\n};\n\n// For Blaze.renderWithData and Blaze.toHTMLWithData, wrap content\n// in a function, if necessary, so it can be a content arg to\n// a Blaze.With.\nvar contentAsFunc = function (content) {\n checkRenderContent(content);\n\n if (typeof content !== 'function') {\n return function () {\n return content;\n };\n } else {\n return content;\n }\n};\n\n/**\n * @summary Renders a template or View to DOM nodes and inserts it into the DOM, returning a rendered [View](#blaze_view) which can be passed to [`Blaze.remove`](#blaze_remove).\n * @locus Client\n * @param {Template|Blaze.View} templateOrView The template (e.g. `Template.myTemplate`) or View object to render. If a template, a View object is [constructed](#template_constructview). If a View, it must be an unrendered View, which becomes a rendered View and is returned.\n * @param {DOMNode} parentNode The node that will be the parent of the rendered template. It must be an Element node.\n * @param {DOMNode} [nextNode] Optional. If provided, must be a child of parentNode; the template will be inserted before this node. If not provided, the template will be inserted as the last child of parentNode.\n * @param {Blaze.View} [parentView] Optional. If provided, it will be set as the rendered View's [`parentView`](#view_parentview).\n */\nBlaze.render = function (content, parentElement, nextNode, parentView) {\n if (! parentElement) {\n Blaze._warn(\"Blaze.render without a parent element is deprecated. \" +\n \"You must specify where to insert the rendered content.\");\n }\n\n if (nextNode instanceof Blaze.View) {\n // handle omitted nextNode\n parentView = nextNode;\n nextNode = null;\n }\n\n // parentElement must be a DOM node. in particular, can't be the\n // result of a call to `$`. Can't check if `parentElement instanceof\n // Node` since 'Node' is undefined in IE8.\n if (parentElement && typeof parentElement.nodeType !== 'number')\n throw new Error(\"'parentElement' must be a DOM node\");\n if (nextNode && typeof nextNode.nodeType !== 'number') // 'nextNode' is optional\n throw new Error(\"'nextNode' must be a DOM node\");\n\n parentView = parentView || currentViewIfRendering();\n\n var view = contentAsView(content);\n Blaze._materializeView(view, parentView);\n\n if (parentElement) {\n view._domrange.attach(parentElement, nextNode);\n }\n\n return view;\n};\n\nBlaze.insert = function (view, parentElement, nextNode) {\n Blaze._warn(\"Blaze.insert has been deprecated. Specify where to insert the \" +\n \"rendered content in the call to Blaze.render.\");\n\n if (! (view && (view._domrange instanceof Blaze._DOMRange)))\n throw new Error(\"Expected template rendered with Blaze.render\");\n\n view._domrange.attach(parentElement, nextNode);\n};\n\n/**\n * @summary Renders a template or View to DOM nodes with a data context. Otherwise identical to `Blaze.render`.\n * @locus Client\n * @param {Template|Blaze.View} templateOrView The template (e.g. `Template.myTemplate`) or View object to render.\n * @param {Object|Function} data The data context to use, or a function returning a data context. If a function is provided, it will be reactively re-run.\n * @param {DOMNode} parentNode The node that will be the parent of the rendered template. It must be an Element node.\n * @param {DOMNode} [nextNode] Optional. If provided, must be a child of parentNode; the template will be inserted before this node. If not provided, the template will be inserted as the last child of parentNode.\n * @param {Blaze.View} [parentView] Optional. If provided, it will be set as the rendered View's [`parentView`](#view_parentview).\n */\nBlaze.renderWithData = function (content, data, parentElement, nextNode, parentView) {\n // We defer the handling of optional arguments to Blaze.render. At this point,\n // `nextNode` may actually be `parentView`.\n return Blaze.render(Blaze._TemplateWith(data, contentAsFunc(content)),\n parentElement, nextNode, parentView);\n};\n\n/**\n * @summary Removes a rendered View from the DOM, stopping all reactive updates and event listeners on it.\n * @locus Client\n * @param {Blaze.View} renderedView The return value from `Blaze.render` or `Blaze.renderWithData`.\n */\nBlaze.remove = function (view) {\n if (! (view && (view._domrange instanceof Blaze._DOMRange)))\n throw new Error(\"Expected template rendered with Blaze.render\");\n\n while (view) {\n if (! view.isDestroyed) {\n var range = view._domrange;\n if (range.attached && ! range.parentRange)\n range.detach();\n range.destroy();\n }\n\n view = view._hasGeneratedParent && view.parentView;\n }\n};\n\n/**\n * @summary Renders a template or View to a string of HTML.\n * @locus Client\n * @param {Template|Blaze.View} templateOrView The template (e.g. `Template.myTemplate`) or View object from which to generate HTML.\n */\nBlaze.toHTML = function (content, parentView) {\n parentView = parentView || currentViewIfRendering();\n\n return HTML.toHTML(Blaze._expandView(contentAsView(content), parentView));\n};\n\n/**\n * @summary Renders a template or View to HTML with a data context. Otherwise identical to `Blaze.toHTML`.\n * @locus Client\n * @param {Template|Blaze.View} templateOrView The template (e.g. `Template.myTemplate`) or View object from which to generate HTML.\n * @param {Object|Function} data The data context to use, or a function returning a data context.\n */\nBlaze.toHTMLWithData = function (content, data, parentView) {\n parentView = parentView || currentViewIfRendering();\n\n return HTML.toHTML(Blaze._expandView(Blaze._TemplateWith(\n data, contentAsFunc(content)), parentView));\n};\n\nBlaze._toText = function (htmljs, parentView, textMode) {\n if (typeof htmljs === 'function')\n throw new Error(\"Blaze._toText doesn't take a function, just HTMLjs\");\n\n if ((parentView != null) && ! (parentView instanceof Blaze.View)) {\n // omitted parentView argument\n textMode = parentView;\n parentView = null;\n }\n parentView = parentView || currentViewIfRendering();\n\n if (! textMode)\n throw new Error(\"textMode required\");\n if (! (textMode === HTML.TEXTMODE.STRING ||\n textMode === HTML.TEXTMODE.RCDATA ||\n textMode === HTML.TEXTMODE.ATTRIBUTE))\n throw new Error(\"Unknown textMode: \" + textMode);\n\n return HTML.toText(Blaze._expand(htmljs, parentView), textMode);\n};\n\n/**\n * @summary Returns the current data context, or the data context that was used when rendering a particular DOM element or View from a Meteor template.\n * @locus Client\n * @param {DOMElement|Blaze.View} [elementOrView] Optional. An element that was rendered by a Meteor, or a View.\n */\nBlaze.getData = function (elementOrView) {\n var theWith;\n\n if (! elementOrView) {\n theWith = Blaze.getView('with');\n } else if (elementOrView instanceof Blaze.View) {\n var view = elementOrView;\n theWith = (view.name === 'with' ? view :\n Blaze.getView(view, 'with'));\n } else if (typeof elementOrView.nodeType === 'number') {\n if (elementOrView.nodeType !== 1)\n throw new Error(\"Expected DOM element\");\n theWith = Blaze.getView(elementOrView, 'with');\n } else {\n throw new Error(\"Expected DOM element or View\");\n }\n\n return theWith ? theWith.dataVar.get() : null;\n};\n\n// For back-compat\nBlaze.getElementData = function (element) {\n Blaze._warn(\"Blaze.getElementData has been deprecated. Use \" +\n \"Blaze.getData(element) instead.\");\n\n if (element.nodeType !== 1)\n throw new Error(\"Expected DOM element\");\n\n return Blaze.getData(element);\n};\n\n// Both arguments are optional.\n\n/**\n * @summary Gets either the current View, or the View enclosing the given DOM element.\n * @locus Client\n * @param {DOMElement} [element] Optional. If specified, the View enclosing `element` is returned.\n */\nBlaze.getView = function (elementOrView, _viewName) {\n var viewName = _viewName;\n\n if ((typeof elementOrView) === 'string') {\n // omitted elementOrView; viewName present\n viewName = elementOrView;\n elementOrView = null;\n }\n\n // We could eventually shorten the code by folding the logic\n // from the other methods into this method.\n if (! elementOrView) {\n return Blaze._getCurrentView(viewName);\n } else if (elementOrView instanceof Blaze.View) {\n return Blaze._getParentView(elementOrView, viewName);\n } else if (typeof elementOrView.nodeType === 'number') {\n return Blaze._getElementView(elementOrView, viewName);\n } else {\n throw new Error(\"Expected DOM element or View\");\n }\n};\n\n// Gets the current view or its nearest ancestor of name\n// `name`.\nBlaze._getCurrentView = function (name) {\n var view = Blaze.currentView;\n // Better to fail in cases where it doesn't make sense\n // to use Blaze._getCurrentView(). There will be a current\n // view anywhere it does. You can check Blaze.currentView\n // if you want to know whether there is one or not.\n if (! view)\n throw new Error(\"There is no current view\");\n\n if (name) {\n while (view && view.name !== name)\n view = view.parentView;\n return view || null;\n } else {\n // Blaze._getCurrentView() with no arguments just returns\n // Blaze.currentView.\n return view;\n }\n};\n\nBlaze._getParentView = function (view, name) {\n var v = view.parentView;\n\n if (name) {\n while (v && v.name !== name)\n v = v.parentView;\n }\n\n return v || null;\n};\n\nBlaze._getElementView = function (elem, name) {\n var range = Blaze._DOMRange.forElement(elem);\n var view = null;\n while (range && ! view) {\n view = (range.view || null);\n if (! view) {\n if (range.parentRange)\n range = range.parentRange;\n else\n range = Blaze._DOMRange.forElement(range.parentElement);\n }\n }\n\n if (name) {\n while (view && view.name !== name)\n view = view.parentView;\n return view || null;\n } else {\n return view;\n }\n};\n\nBlaze._addEventMap = function (view, eventMap, thisInHandler) {\n thisInHandler = (thisInHandler || null);\n var handles = [];\n\n if (! view._domrange)\n throw new Error(\"View must have a DOMRange\");\n\n view._domrange.onAttached(function attached_eventMaps(range, element) {\n _.each(eventMap, function (handler, spec) {\n var clauses = spec.split(/,\\s+/);\n // iterate over clauses of spec, e.g. ['click .foo', 'click .bar']\n _.each(clauses, function (clause) {\n var parts = clause.split(/\\s+/);\n if (parts.length === 0)\n return;\n\n var newEvents = parts.shift();\n var selector = parts.join(' ');\n handles.push(Blaze._EventSupport.listen(\n element, newEvents, selector,\n function (evt) {\n if (! range.containsElement(evt.currentTarget))\n return null;\n var handlerThis = thisInHandler || this;\n var handlerArgs = arguments;\n return Blaze._withCurrentView(view, function () {\n return handler.apply(handlerThis, handlerArgs);\n });\n },\n range, function (r) {\n return r.parentRange;\n }));\n });\n });\n });\n\n view.onViewDestroyed(function () {\n _.each(handles, function (h) {\n h.stop();\n });\n handles.length = 0;\n });\n};\n","Blaze._calculateCondition = function (cond) {\n if (cond instanceof Array && cond.length === 0)\n cond = false;\n return !! cond;\n};\n\n/**\n * @summary Constructs a View that renders content with a data context.\n * @locus Client\n * @param {Object|Function} data An object to use as the data context, or a function returning such an object. If a function is provided, it will be reactively re-run.\n * @param {Function} contentFunc A Function that returns [*renderable content*](#renderable_content).\n */\nBlaze.With = function (data, contentFunc) {\n var view = Blaze.View('with', contentFunc);\n\n view.dataVar = new ReactiveVar;\n\n view.onViewCreated(function () {\n if (typeof data === 'function') {\n // `data` is a reactive function\n view.autorun(function () {\n view.dataVar.set(data());\n }, view.parentView, 'setData');\n } else {\n view.dataVar.set(data);\n }\n });\n\n return view;\n};\n\n/**\n * @summary Constructs a View that renders content conditionally.\n * @locus Client\n * @param {Function} conditionFunc A function to reactively re-run. Whether the result is truthy or falsy determines whether `contentFunc` or `elseFunc` is shown. An empty array is considered falsy.\n * @param {Function} contentFunc A Function that returns [*renderable content*](#renderable_content).\n * @param {Function} [elseFunc] Optional. A Function that returns [*renderable content*](#renderable_content). If no `elseFunc` is supplied, no content is shown in the \"else\" case.\n */\nBlaze.If = function (conditionFunc, contentFunc, elseFunc, _not) {\n var conditionVar = new ReactiveVar;\n\n var view = Blaze.View(_not ? 'unless' : 'if', function () {\n return conditionVar.get() ? contentFunc() :\n (elseFunc ? elseFunc() : null);\n });\n view.__conditionVar = conditionVar;\n view.onViewCreated(function () {\n this.autorun(function () {\n var cond = Blaze._calculateCondition(conditionFunc());\n conditionVar.set(_not ? (! cond) : cond);\n }, this.parentView, 'condition');\n });\n\n return view;\n};\n\n/**\n * @summary An inverted [`Blaze.If`](#blaze_if).\n * @locus Client\n * @param {Function} conditionFunc A function to reactively re-run. If the result is falsy, `contentFunc` is shown, otherwise `elseFunc` is shown. An empty array is considered falsy.\n * @param {Function} contentFunc A Function that returns [*renderable content*](#renderable_content).\n * @param {Function} [elseFunc] Optional. A Function that returns [*renderable content*](#renderable_content). If no `elseFunc` is supplied, no content is shown in the \"else\" case.\n */\nBlaze.Unless = function (conditionFunc, contentFunc, elseFunc) {\n return Blaze.If(conditionFunc, contentFunc, elseFunc, true /*_not*/);\n};\n\n/**\n * @summary Constructs a View that renders `contentFunc` for each item in a sequence.\n * @locus Client\n * @param {Function} argFunc A function to reactively re-run. The function may return a Cursor, an array, null, or undefined.\n * @param {Function} contentFunc A Function that returns [*renderable content*](#renderable_content).\n * @param {Function} [elseFunc] Optional. A Function that returns [*renderable content*](#renderable_content) to display in the case when there are no items to display.\n */\nBlaze.Each = function (argFunc, contentFunc, elseFunc) {\n var eachView = Blaze.View('each', function () {\n var subviews = this.initialSubviews;\n this.initialSubviews = null;\n if (this._isCreatedForExpansion) {\n this.expandedValueDep = new Tracker.Dependency;\n this.expandedValueDep.depend();\n }\n return subviews;\n });\n eachView.initialSubviews = [];\n eachView.numItems = 0;\n eachView.inElseMode = false;\n eachView.stopHandle = null;\n eachView.contentFunc = contentFunc;\n eachView.elseFunc = elseFunc;\n eachView.argVar = new ReactiveVar;\n\n eachView.onViewCreated(function () {\n // We evaluate argFunc in an autorun to make sure\n // Blaze.currentView is always set when it runs (rather than\n // passing argFunc straight to ObserveSequence).\n eachView.autorun(function () {\n eachView.argVar.set(argFunc());\n }, eachView.parentView, 'collection');\n\n eachView.stopHandle = ObserveSequence.observe(function () {\n return eachView.argVar.get();\n }, {\n addedAt: function (id, item, index) {\n Tracker.nonreactive(function () {\n var newItemView = Blaze.With(item, eachView.contentFunc);\n eachView.numItems++;\n\n if (eachView.expandedValueDep) {\n eachView.expandedValueDep.changed();\n } else if (eachView._domrange) {\n if (eachView.inElseMode) {\n eachView._domrange.removeMember(0);\n eachView.inElseMode = false;\n }\n\n var range = Blaze._materializeView(newItemView, eachView);\n eachView._domrange.addMember(range, index);\n } else {\n eachView.initialSubviews.splice(index, 0, newItemView);\n }\n });\n },\n removedAt: function (id, item, index) {\n Tracker.nonreactive(function () {\n eachView.numItems--;\n if (eachView.expandedValueDep) {\n eachView.expandedValueDep.changed();\n } else if (eachView._domrange) {\n eachView._domrange.removeMember(index);\n if (eachView.elseFunc && eachView.numItems === 0) {\n eachView.inElseMode = true;\n eachView._domrange.addMember(\n Blaze._materializeView(\n Blaze.View('each_else',eachView.elseFunc),\n eachView), 0);\n }\n } else {\n eachView.initialSubviews.splice(index, 1);\n }\n });\n },\n changedAt: function (id, newItem, oldItem, index) {\n Tracker.nonreactive(function () {\n if (eachView.expandedValueDep) {\n eachView.expandedValueDep.changed();\n } else {\n var itemView;\n if (eachView._domrange) {\n itemView = eachView._domrange.getMember(index).view;\n } else {\n itemView = eachView.initialSubviews[index];\n }\n itemView.dataVar.set(newItem);\n }\n });\n },\n movedTo: function (id, item, fromIndex, toIndex) {\n Tracker.nonreactive(function () {\n if (eachView.expandedValueDep) {\n eachView.expandedValueDep.changed();\n } else if (eachView._domrange) {\n eachView._domrange.moveMember(fromIndex, toIndex);\n } else {\n var subviews = eachView.initialSubviews;\n var itemView = subviews[fromIndex];\n subviews.splice(fromIndex, 1);\n subviews.splice(toIndex, 0, itemView);\n }\n });\n }\n });\n\n if (eachView.elseFunc && eachView.numItems === 0) {\n eachView.inElseMode = true;\n eachView.initialSubviews[0] =\n Blaze.View('each_else', eachView.elseFunc);\n }\n });\n\n eachView.onViewDestroyed(function () {\n if (eachView.stopHandle)\n eachView.stopHandle.stop();\n });\n\n return eachView;\n};\n\nBlaze._TemplateWith = function (arg, contentFunc) {\n var w;\n\n var argFunc = arg;\n if (typeof arg !== 'function') {\n argFunc = function () {\n return arg;\n };\n }\n\n // This is a little messy. When we compile `{{> Template.contentBlock}}`, we\n // wrap it in Blaze._InOuterTemplateScope in order to skip the intermediate\n // parent Views in the current template. However, when there's an argument\n // (`{{> Template.contentBlock arg}}`), the argument needs to be evaluated\n // in the original scope. There's no good order to nest\n // Blaze._InOuterTemplateScope and Spacebars.TemplateWith to achieve this,\n // so we wrap argFunc to run it in the \"original parentView\" of the\n // Blaze._InOuterTemplateScope.\n //\n // To make this better, reconsider _InOuterTemplateScope as a primitive.\n // Longer term, evaluate expressions in the proper lexical scope.\n var wrappedArgFunc = function () {\n var viewToEvaluateArg = null;\n if (w.parentView && w.parentView.name === 'InOuterTemplateScope') {\n viewToEvaluateArg = w.parentView.originalParentView;\n }\n if (viewToEvaluateArg) {\n return Blaze._withCurrentView(viewToEvaluateArg, argFunc);\n } else {\n return argFunc();\n }\n };\n\n var wrappedContentFunc = function () {\n var content = contentFunc.call(this);\n\n // Since we are generating the Blaze._TemplateWith view for the\n // user, set the flag on the child view. If `content` is a template,\n // construct the View so that we can set the flag.\n if (content instanceof Blaze.Template) {\n content = content.constructView();\n }\n if (content instanceof Blaze.View) {\n content._hasGeneratedParent = true;\n }\n\n return content;\n };\n\n w = Blaze.With(wrappedArgFunc, wrappedContentFunc);\n w.__isTemplateWith = true;\n return w;\n};\n\nBlaze._InOuterTemplateScope = function (templateView, contentFunc) {\n var view = Blaze.View('InOuterTemplateScope', contentFunc);\n var parentView = templateView.parentView;\n\n // Hack so that if you call `{{> foo bar}}` and it expands into\n // `{{#with bar}}{{> foo}}{{/with}}`, and then `foo` is a template\n // that inserts `{{> Template.contentBlock}}`, the data context for\n // `Template.contentBlock` is not `bar` but the one enclosing that.\n if (parentView.__isTemplateWith)\n parentView = parentView.parentView;\n\n view.onViewCreated(function () {\n this.originalParentView = this.parentView;\n this.parentView = parentView;\n });\n return view;\n};\n\n// XXX COMPAT WITH 0.9.0\nBlaze.InOuterTemplateScope = Blaze._InOuterTemplateScope;\n","Blaze._globalHelpers = {};\n\n// Documented as Template.registerHelper.\n// This definition also provides back-compat for `UI.registerHelper`.\nBlaze.registerHelper = function (name, func) {\n Blaze._globalHelpers[name] = func;\n};\n\nvar bindIfIsFunction = function (x, target) {\n if (typeof x !== 'function')\n return x;\n return _.bind(x, target);\n};\n\n// If `x` is a function, binds the value of `this` for that function\n// to the current data context.\nvar bindDataContext = function (x) {\n if (typeof x === 'function') {\n return function () {\n var data = Blaze.getData();\n if (data == null)\n data = {};\n return x.apply(data, arguments);\n };\n }\n return x;\n};\n\nBlaze._OLDSTYLE_HELPER = {};\n\nvar getTemplateHelper = Blaze._getTemplateHelper = function (template, name) {\n // XXX COMPAT WITH 0.9.3\n var isKnownOldStyleHelper = false;\n\n if (template.__helpers.has(name)) {\n var helper = template.__helpers.get(name);\n if (helper === Blaze._OLDSTYLE_HELPER) {\n isKnownOldStyleHelper = true;\n } else {\n return helper;\n }\n }\n\n // old-style helper\n if (name in template) {\n // Only warn once per helper\n if (! isKnownOldStyleHelper) {\n template.__helpers.set(name, Blaze._OLDSTYLE_HELPER);\n if (! template._NOWARN_OLDSTYLE_HELPERS) {\n Blaze._warn('Assigning helper with `' + template.viewName + '.' +\n name + ' = ...` is deprecated. Use `' + template.viewName +\n '.helpers(...)` instead.');\n }\n }\n return template[name];\n }\n\n return null;\n};\n\nvar wrapHelper = function (f, templateFunc) {\n if (typeof f !== \"function\") {\n return f;\n }\n\n return function () {\n var self = this;\n var args = arguments;\n\n return Blaze.Template._withTemplateInstanceFunc(templateFunc, function () {\n return Blaze._wrapCatchingExceptions(f, 'template helper').apply(self, args);\n });\n };\n};\n\n// Looks up a name, like \"foo\" or \"..\", as a helper of the\n// current template; a global helper; the name of a template;\n// or a property of the data context. Called on the View of\n// a template (i.e. a View with a `.template` property,\n// where the helpers are). Used for the first name in a\n// \"path\" in a template tag, like \"foo\" in `{{foo.bar}}` or\n// \"..\" in `{{frobulate ../blah}}`.\n//\n// Returns a function, a non-function value, or null. If\n// a function is found, it is bound appropriately.\n//\n// NOTE: This function must not establish any reactive\n// dependencies itself. If there is any reactivity in the\n// value, lookup should return a function.\nBlaze.View.prototype.lookup = function (name, _options) {\n var template = this.template;\n var lookupTemplate = _options && _options.template;\n var helper;\n var boundTmplInstance;\n\n if (this.templateInstance) {\n boundTmplInstance = _.bind(this.templateInstance, this);\n }\n\n if (/^\\./.test(name)) {\n // starts with a dot. must be a series of dots which maps to an\n // ancestor of the appropriate height.\n if (!/^(\\.)+$/.test(name))\n throw new Error(\"id starting with dot must be a series of dots\");\n\n return Blaze._parentData(name.length - 1, true /*_functionWrapped*/);\n\n } else if (template &&\n ((helper = getTemplateHelper(template, name)) != null)) {\n return wrapHelper(bindDataContext(helper), boundTmplInstance);\n } else if (lookupTemplate && (name in Blaze.Template) &&\n (Blaze.Template[name] instanceof Blaze.Template)) {\n return Blaze.Template[name];\n } else if (Blaze._globalHelpers[name] != null) {\n return wrapHelper(bindDataContext(Blaze._globalHelpers[name]),\n boundTmplInstance);\n } else {\n return function () {\n var isCalledAsFunction = (arguments.length > 0);\n var data = Blaze.getData();\n if (lookupTemplate && ! (data && data[name])) {\n throw new Error(\"No such template: \" + name);\n }\n if (isCalledAsFunction && ! (data && data[name])) {\n throw new Error(\"No such function: \" + name);\n }\n if (! data)\n return null;\n var x = data[name];\n if (typeof x !== 'function') {\n if (isCalledAsFunction) {\n throw new Error(\"Can't call non-function: \" + x);\n }\n return x;\n }\n return x.apply(data, arguments);\n };\n }\n return null;\n};\n\n// Implement Spacebars' {{../..}}.\n// @param height {Number} The number of '..'s\nBlaze._parentData = function (height, _functionWrapped) {\n // If height is null or undefined, we default to 1, the first parent.\n if (height == null) {\n height = 1;\n }\n var theWith = Blaze.getView('with');\n for (var i = 0; (i < height) && theWith; i++) {\n theWith = Blaze.getView(theWith, 'with');\n }\n\n if (! theWith)\n return null;\n if (_functionWrapped)\n return function () { return theWith.dataVar.get(); };\n return theWith.dataVar.get();\n};\n\n\nBlaze.View.prototype.lookupTemplate = function (name) {\n return this.lookup(name, {template:true});\n};\n","// [new] Blaze.Template([viewName], renderFunction)\n//\n// `Blaze.Template` is the class of templates, like `Template.foo` in\n// Meteor, which is `instanceof Template`.\n//\n// `viewKind` is a string that looks like \"Template.foo\" for templates\n// defined by the compiler.\n\n/**\n * @class\n * @summary Constructor for a Template, which is used to construct Views with particular name and content.\n * @locus Client\n * @param {String} [viewName] Optional. A name for Views constructed by this Template. See [`view.name`](#view_name).\n * @param {Function} renderFunction A function that returns [*renderable content*](#renderable_content). This function is used as the `renderFunction` for Views constructed by this Template.\n */\nBlaze.Template = function (viewName, renderFunction) {\n if (! (this instanceof Blaze.Template))\n // called without `new`\n return new Blaze.Template(viewName, renderFunction);\n\n if (typeof viewName === 'function') {\n // omitted \"viewName\" argument\n renderFunction = viewName;\n viewName = '';\n }\n if (typeof viewName !== 'string')\n throw new Error(\"viewName must be a String (or omitted)\");\n if (typeof renderFunction !== 'function')\n throw new Error(\"renderFunction must be a function\");\n\n this.viewName = viewName;\n this.renderFunction = renderFunction;\n\n this.__helpers = new HelperMap;\n this.__eventMaps = [];\n\n this._callbacks = {\n created: [],\n rendered: [],\n destroyed: []\n };\n};\nvar Template = Blaze.Template;\n\nvar HelperMap = function () {};\nHelperMap.prototype.get = function (name) {\n return this[' '+name];\n};\nHelperMap.prototype.set = function (name, helper) {\n this[' '+name] = helper;\n};\nHelperMap.prototype.has = function (name) {\n return (' '+name) in this;\n};\n\n/**\n * @summary Returns true if `value` is a template object like `Template.myTemplate`.\n * @locus Client\n * @param {Any} value The value to test.\n */\nBlaze.isTemplate = function (t) {\n return (t instanceof Blaze.Template);\n};\n\n/**\n * @name onCreated\n * @instance\n * @memberOf Template\n * @summary Register a function to be called when an instance of this template is created.\n * @param {Function} callback A function to be added as a callback.\n * @locus Client\n */\nTemplate.prototype.onCreated = function (cb) {\n this._callbacks.created.push(cb);\n};\n\n/**\n * @name onRendered\n * @instance\n * @memberOf Template\n * @summary Register a function to be called when an instance of this template is inserted into the DOM.\n * @param {Function} callback A function to be added as a callback.\n * @locus Client\n */\nTemplate.prototype.onRendered = function (cb) {\n this._callbacks.rendered.push(cb);\n};\n\n/**\n * @name onDestroyed\n * @instance\n * @memberOf Template\n * @summary Register a function to be called when an instance of this template is removed from the DOM and destroyed.\n * @param {Function} callback A function to be added as a callback.\n * @locus Client\n */\nTemplate.prototype.onDestroyed = function (cb) {\n this._callbacks.destroyed.push(cb);\n};\n\nTemplate.prototype._getCallbacks = function (which) {\n var self = this;\n var callbacks = self[which] ? [self[which]] : [];\n // Fire all callbacks added with the new API (Template.onRendered())\n // as well as the old-style callback (e.g. Template.rendered) for\n // backwards-compatibility.\n callbacks = callbacks.concat(self._callbacks[which]);\n return callbacks;\n};\n\nvar fireCallbacks = function (callbacks, template) {\n Template._withTemplateInstanceFunc(\n function () { return template; },\n function () {\n for (var i = 0, N = callbacks.length; i < N; i++) {\n callbacks[i].call(template);\n }\n });\n};\n\nTemplate.prototype.constructView = function (contentFunc, elseFunc) {\n var self = this;\n var view = Blaze.View(self.viewName, self.renderFunction);\n view.template = self;\n\n view.templateContentBlock = (\n contentFunc ? new Template('(contentBlock)', contentFunc) : null);\n view.templateElseBlock = (\n elseFunc ? new Template('(elseBlock)', elseFunc) : null);\n\n if (self.__eventMaps || typeof self.events === 'object') {\n view._onViewRendered(function () {\n if (view.renderCount !== 1)\n return;\n\n if (! self.__eventMaps.length && typeof self.events === \"object\") {\n // Provide limited back-compat support for `.events = {...}`\n // syntax. Pass `template.events` to the original `.events(...)`\n // function. This code must run only once per template, in\n // order to not bind the handlers more than once, which is\n // ensured by the fact that we only do this when `__eventMaps`\n // is falsy, and we cause it to be set now.\n Template.prototype.events.call(self, self.events);\n }\n\n _.each(self.__eventMaps, function (m) {\n Blaze._addEventMap(view, m, view);\n });\n });\n }\n\n view._templateInstance = new Blaze.TemplateInstance(view);\n view.templateInstance = function () {\n // Update data, firstNode, and lastNode, and return the TemplateInstance\n // object.\n var inst = view._templateInstance;\n\n /**\n * @instance\n * @memberOf Blaze.TemplateInstance\n * @name data\n * @summary The data context of this instance's latest invocation.\n * @locus Client\n */\n inst.data = Blaze.getData(view);\n\n if (view._domrange && !view.isDestroyed) {\n inst.firstNode = view._domrange.firstNode();\n inst.lastNode = view._domrange.lastNode();\n } else {\n // on 'created' or 'destroyed' callbacks we don't have a DomRange\n inst.firstNode = null;\n inst.lastNode = null;\n }\n\n return inst;\n };\n\n /**\n * @name created\n * @instance\n * @memberOf Template\n * @summary Provide a callback when an instance of a template is created.\n * @locus Client\n * @deprecated in 1.1\n */\n // To avoid situations when new callbacks are added in between view\n // instantiation and event being fired, decide on all callbacks to fire\n // immediately and then fire them on the event.\n var createdCallbacks = self._getCallbacks('created');\n view.onViewCreated(function () {\n fireCallbacks(createdCallbacks, view.templateInstance());\n });\n\n /**\n * @name rendered\n * @instance\n * @memberOf Template\n * @summary Provide a callback when an instance of a template is rendered.\n * @locus Client\n * @deprecated in 1.1\n */\n var renderedCallbacks = self._getCallbacks('rendered');\n view.onViewReady(function () {\n fireCallbacks(renderedCallbacks, view.templateInstance());\n });\n\n /**\n * @name destroyed\n * @instance\n * @memberOf Template\n * @summary Provide a callback when an instance of a template is destroyed.\n * @locus Client\n * @deprecated in 1.1\n */\n var destroyedCallbacks = self._getCallbacks('destroyed');\n view.onViewDestroyed(function () {\n fireCallbacks(destroyedCallbacks, view.templateInstance());\n });\n\n return view;\n};\n\n/**\n * @class\n * @summary The class for template instances\n * @param {Blaze.View} view\n * @instanceName template\n */\nBlaze.TemplateInstance = function (view) {\n if (! (this instanceof Blaze.TemplateInstance))\n // called without `new`\n return new Blaze.TemplateInstance(view);\n\n if (! (view instanceof Blaze.View))\n throw new Error(\"View required\");\n\n view._templateInstance = this;\n\n /**\n * @name view\n * @memberOf Blaze.TemplateInstance\n * @instance\n * @summary The [View](#blaze_view) object for this invocation of the template.\n * @locus Client\n * @type {Blaze.View}\n */\n this.view = view;\n this.data = null;\n\n /**\n * @name firstNode\n * @memberOf Blaze.TemplateInstance\n * @instance\n * @summary The first top-level DOM node in this template instance.\n * @locus Client\n * @type {DOMNode}\n */\n this.firstNode = null;\n\n /**\n * @name lastNode\n * @memberOf Blaze.TemplateInstance\n * @instance\n * @summary The last top-level DOM node in this template instance.\n * @locus Client\n * @type {DOMNode}\n */\n this.lastNode = null;\n\n // This dependency is used to identify state transitions in\n // _subscriptionHandles which could cause the result of\n // TemplateInstance#subscriptionsReady to change. Basically this is triggered\n // whenever a new subscription handle is added or when a subscription handle\n // is removed and they are not ready.\n this._allSubsReadyDep = new Tracker.Dependency();\n this._allSubsReady = false;\n\n this._subscriptionHandles = {};\n};\n\n/**\n * @summary Find all elements matching `selector` in this template instance, and return them as a JQuery object.\n * @locus Client\n * @param {String} selector The CSS selector to match, scoped to the template contents.\n * @returns {DOMNode[]}\n */\nBlaze.TemplateInstance.prototype.$ = function (selector) {\n var view = this.view;\n if (! view._domrange)\n throw new Error(\"Can't use $ on template instance with no DOM\");\n return view._domrange.$(selector);\n};\n\n/**\n * @summary Find all elements matching `selector` in this template instance.\n * @locus Client\n * @param {String} selector The CSS selector to match, scoped to the template contents.\n * @returns {DOMElement[]}\n */\nBlaze.TemplateInstance.prototype.findAll = function (selector) {\n return Array.prototype.slice.call(this.$(selector));\n};\n\n/**\n * @summary Find one element matching `selector` in this template instance.\n * @locus Client\n * @param {String} selector The CSS selector to match, scoped to the template contents.\n * @returns {DOMElement}\n */\nBlaze.TemplateInstance.prototype.find = function (selector) {\n var result = this.$(selector);\n return result[0] || null;\n};\n\n/**\n * @summary A version of [Tracker.autorun](#tracker_autorun) that is stopped when the template is destroyed.\n * @locus Client\n * @param {Function} runFunc The function to run. It receives one argument: a Tracker.Computation object.\n */\nBlaze.TemplateInstance.prototype.autorun = function (f) {\n return this.view.autorun(f);\n};\n\n/**\n * @summary A version of [Meteor.subscribe](#meteor_subscribe) that is stopped\n * when the template is destroyed.\n * @return {SubscriptionHandle} The subscription handle to the newly made\n * subscription. Call `handle.stop()` to manually stop the subscription, or\n * `handle.ready()` to find out if this particular subscription has loaded all\n * of its inital data.\n * @locus Client\n * @param {String} name Name of the subscription. Matches the name of the\n * server's `publish()` call.\n * @param {Any} [arg1,arg2...] Optional arguments passed to publisher function\n * on server.\n * @param {Function|Object} [callbacks] Optional. May include `onStop` and\n * `onReady` callbacks. If a function is passed instead of an object, it is\n * interpreted as an `onReady` callback.\n */\nBlaze.TemplateInstance.prototype.subscribe = function (/* arguments */) {\n var self = this;\n\n var subHandles = self._subscriptionHandles;\n var args = _.toArray(arguments);\n\n // Duplicate logic from Meteor.subscribe\n var callbacks = {};\n if (args.length) {\n var lastParam = _.last(args);\n if (_.isFunction(lastParam)) {\n callbacks.onReady = args.pop();\n } else if (lastParam &&\n // XXX COMPAT WITH 1.0.3.1 onError used to exist, but now we use\n // onStop with an error callback instead.\n _.any([lastParam.onReady, lastParam.onError, lastParam.onStop],\n _.isFunction)) {\n callbacks = args.pop();\n }\n }\n\n var subHandle;\n var oldStopped = callbacks.onStop;\n callbacks.onStop = function (error) {\n // When the subscription is stopped, remove it from the set of tracked\n // subscriptions to avoid this list growing without bound\n delete subHandles[subHandle.subscriptionId];\n\n // Removing a subscription can only change the result of subscriptionsReady\n // if we are not ready (that subscription could be the one blocking us being\n // ready).\n if (! self._allSubsReady) {\n self._allSubsReadyDep.changed();\n }\n\n if (oldStopped) {\n oldStopped(error);\n }\n };\n args.push(callbacks);\n\n subHandle = self.view.subscribe.call(self.view, args);\n\n if (! _.has(subHandles, subHandle.subscriptionId)) {\n subHandles[subHandle.subscriptionId] = subHandle;\n\n // Adding a new subscription will always cause us to transition from ready\n // to not ready, but if we are already not ready then this can't make us\n // ready.\n if (self._allSubsReady) {\n self._allSubsReadyDep.changed();\n }\n }\n\n return subHandle;\n};\n\n/**\n * @summary A reactive function that returns true when all of the subscriptions\n * called with [this.subscribe](#TemplateInstance-subscribe) are ready.\n * @return {Boolean} True if all subscriptions on this template instance are\n * ready.\n */\nBlaze.TemplateInstance.prototype.subscriptionsReady = function () {\n this._allSubsReadyDep.depend();\n\n this._allSubsReady = _.all(this._subscriptionHandles, function (handle) {\n return handle.ready();\n });\n\n return this._allSubsReady;\n};\n\n/**\n * @summary Specify template helpers available to this template.\n * @locus Client\n * @param {Object} helpers Dictionary of helper functions by name.\n */\nTemplate.prototype.helpers = function (dict) {\n for (var k in dict)\n this.__helpers.set(k, dict[k]);\n};\n\n// Kind of like Blaze.currentView but for the template instance.\n// This is a function, not a value -- so that not all helpers\n// are implicitly dependent on the current template instance's `data` property,\n// which would make them dependenct on the data context of the template\n// inclusion.\nTemplate._currentTemplateInstanceFunc = null;\n\nTemplate._withTemplateInstanceFunc = function (templateInstanceFunc, func) {\n if (typeof func !== 'function')\n throw new Error(\"Expected function, got: \" + func);\n var oldTmplInstanceFunc = Template._currentTemplateInstanceFunc;\n try {\n Template._currentTemplateInstanceFunc = templateInstanceFunc;\n return func();\n } finally {\n Template._currentTemplateInstanceFunc = oldTmplInstanceFunc;\n }\n};\n\n/**\n * @summary Specify event handlers for this template.\n * @locus Client\n * @param {EventMap} eventMap Event handlers to associate with this template.\n */\nTemplate.prototype.events = function (eventMap) {\n var template = this;\n var eventMap2 = {};\n for (var k in eventMap) {\n eventMap2[k] = (function (k, v) {\n return function (event/*, ...*/) {\n var view = this; // passed by EventAugmenter\n var data = Blaze.getData(event.currentTarget);\n if (data == null)\n data = {};\n var args = Array.prototype.slice.call(arguments);\n var tmplInstanceFunc = _.bind(view.templateInstance, view);\n args.splice(1, 0, tmplInstanceFunc());\n\n return Template._withTemplateInstanceFunc(tmplInstanceFunc, function () {\n return v.apply(data, args);\n });\n };\n })(k, eventMap[k]);\n }\n\n template.__eventMaps.push(eventMap2);\n};\n\n/**\n * @function\n * @name instance\n * @memberOf Template\n * @summary The [template instance](#template_inst) corresponding to the current template helper, event handler, callback, or autorun. If there isn't one, `null`.\n * @locus Client\n * @returns {Blaze.TemplateInstance}\n */\nTemplate.instance = function () {\n return Template._currentTemplateInstanceFunc\n && Template._currentTemplateInstanceFunc();\n};\n\n// Note: Template.currentData() is documented to take zero arguments,\n// while Blaze.getData takes up to one.\n\n/**\n * @summary\n *\n * - Inside an `onCreated`, `onRendered`, or `onDestroyed` callback, returns\n * the data context of the template.\n * - Inside an event handler, returns the data context of the template on which\n * this event handler was defined.\n * - Inside a helper, returns the data context of the DOM node where the helper\n * was used.\n *\n * Establishes a reactive dependency on the result.\n * @locus Client\n * @function\n */\nTemplate.currentData = Blaze.getData;\n\n/**\n * @summary Accesses other data contexts that enclose the current data context.\n * @locus Client\n * @function\n * @param {Integer} [numLevels] The number of levels beyond the current data context to look. Defaults to 1.\n */\nTemplate.parentData = Blaze._parentData;\n\n/**\n * @summary Defines a [helper function](#template_helpers) which can be used from all templates.\n * @locus Client\n * @function\n * @param {String} name The name of the helper function you are defining.\n * @param {Function} function The helper function itself.\n */\nTemplate.registerHelper = Blaze.registerHelper;\n","UI = Blaze;\n\nBlaze.ReactiveVar = ReactiveVar;\nUI._templateInstance = Blaze.Template.instance;\n\nHandlebars = {};\nHandlebars.registerHelper = Blaze.registerHelper;\n\nHandlebars._escape = Blaze._escape;\n\n// Return these from {{...}} helpers to achieve the same as returning\n// strings from {{{...}}} helpers\nHandlebars.SafeString = function(string) {\n this.string = string;\n};\nHandlebars.SafeString.prototype.toString = function() {\n return this.string.toString();\n};\n"]}