ÿþ  /   /       T   h   i   s       c   o   d   e       i   m   p   l   e   m   e   n   t   s       t   h   e       `   -   s   M   O   D   U   L   A   R   I   Z   E   `       s   e   t   t   i   n   g   s       b   y       t   a   k   i   n   g       t   h   e       g   e   n   e   r   a   t   e   d   
   /   /       J   S       p   r   o   g   r   a   m       c   o   d   e       (   I   N   N   E   R   _   J   S   _   C   O   D   E   )       a   n   d       w   r   a   p   p   i   n   g       i   t       i   n       a       f   a   c   t   o   r   y       f   u   n   c   t   i   o   n   .   
   
   /   /       S   i   n   g   l   e       t   h   r   e   a   d   e   d       M   I   N   I   M   A   L   _   R   U   N   T   I   M   E       p   r   o   g   r   a   m   s       d   o       n   o   t       n   e   e   d       a   c   c   e   s   s       t   o   
   /   /       d   o   c   u   m   e   n   t   .   c   u   r   r   e   n   t   S   c   r   i   p   t   ,       s   o       a       s   i   m   p   l   e       e   x   p   o   r   t       d   e   c   l   a   r   a   t   i   o   n       i   s       e   n   o   u   g   h   .   
   v   a   r       c   r   e   a   t   e   M   o   d   u   l   e       =       (   (   )       =   >       {   
           /   /       W   h   e   n       M   O   D   U   L   A   R   I   Z   E       t   h   i   s       J   S       m   a   y       b   e       e   x   e   c   u   t   e   d       l   a   t   e   r   ,   
           /   /       a   f   t   e   r       d   o   c   u   m   e   n   t   .   c   u   r   r   e   n   t   S   c   r   i   p   t       i   s       g   o   n   e   ,       s   o       w   e       s   a   v   e       i   t   .   
           /   /       I   n       E   X   P   O   R   T   _   E   S   6       m   o   d   e       w   e       c   a   n       j   u   s   t       u   s   e       '   i   m   p   o   r   t   .   m   e   t   a   .   u   r   l   '   .   
           v   a   r       _   s   c   r   i   p   t   N   a   m   e       =       t   y   p   e   o   f       d   o   c   u   m   e   n   t       !   =       '   u   n   d   e   f   i   n   e   d   '       ?       d   o   c   u   m   e   n   t   .   c   u   r   r   e   n   t   S   c   r   i   p   t   ?   .   s   r   c       :       u   n   d   e   f   i   n   e   d   ;   
           r   e   t   u   r   n       a   s   y   n   c       f   u   n   c   t   i   o   n   (   m   o   d   u   l   e   A   r   g       =       {   }   )       {   
                   v   a   r       m   o   d   u   l   e   R   t   n   ;   
   
   /   /       i   n   c   l   u   d   e   :       s   h   e   l   l   .   j   s   
   /   /       T   h   e       M   o   d   u   l   e       o   b   j   e   c   t   :       O   u   r       i   n   t   e   r   f   a   c   e       t   o       t   h   e       o   u   t   s   i   d   e       w   o   r   l   d   .       W   e       i   m   p   o   r   t   
   /   /       a   n   d       e   x   p   o   r   t       v   a   l   u   e   s       o   n       i   t   .       T   h   e   r   e       a   r   e       v   a   r   i   o   u   s       w   a   y   s       M   o   d   u   l   e       c   a   n       b   e       u   s   e   d   :   
   /   /       1   .       N   o   t       d   e   f   i   n   e   d   .       W   e       c   r   e   a   t   e       i   t       h   e   r   e   
   /   /       2   .       A       f   u   n   c   t   i   o   n       p   a   r   a   m   e   t   e   r   ,       f   u   n   c   t   i   o   n   (   m   o   d   u   l   e   A   r   g   )       =   >       P   r   o   m   i   s   e   <   M   o   d   u   l   e   >   
   /   /       3   .       p   r   e   -   r   u   n       a   p   p   e   n   d   e   d       i   t   ,       v   a   r       M   o   d   u   l   e       =       {   }   ;       .   .   g   e   n   e   r   a   t   e   d       c   o   d   e   .   .   
   /   /       4   .       E   x   t   e   r   n   a   l       s   c   r   i   p   t       t   a   g       d   e   f   i   n   e   s       v   a   r       M   o   d   u   l   e   .   
   /   /       W   e       n   e   e   d       t   o       c   h   e   c   k       i   f       M   o   d   u   l   e       a   l   r   e   a   d   y       e   x   i   s   t   s       (   e   .   g   .       c   a   s   e       3       a   b   o   v   e   )   .   
   /   /       S   u   b   s   t   i   t   u   t   i   o   n       w   i   l   l       b   e       r   e   p   l   a   c   e   d       w   i   t   h       a   c   t   u   a   l       c   o   d   e       o   n       l   a   t   e   r       s   t   a   g   e       o   f       t   h   e       b   u   i   l   d   ,   
   /   /       t   h   i   s       w   a   y       C   l   o   s   u   r   e       C   o   m   p   i   l   e   r       w   i   l   l       n   o   t       m   a   n   g   l   e       i   t       (   e   .   g   .       c   a   s   e       4   .       a   b   o   v   e   )   .   
   /   /       N   o   t   e       t   h   a   t       i   f       y   o   u       w   a   n   t       t   o       r   u   n       c   l   o   s   u   r   e   ,       a   n   d       a   l   s   o       t   o       u   s   e       M   o   d   u   l   e   
   /   /       a   f   t   e   r       t   h   e       g   e   n   e   r   a   t   e   d       c   o   d   e   ,       y   o   u       w   i   l   l       n   e   e   d       t   o       d   e   f   i   n   e               v   a   r       M   o   d   u   l   e       =       {   }   ;   
   /   /       b   e   f   o   r   e       t   h   e       c   o   d   e   .       T   h   e   n       t   h   a   t       o   b   j   e   c   t       w   i   l   l       b   e       u   s   e   d       i   n       t   h   e       c   o   d   e   ,       a   n   d       y   o   u   
   /   /       c   a   n       c   o   n   t   i   n   u   e       t   o       u   s   e       M   o   d   u   l   e       a   f   t   e   r   w   a   r   d   s       a   s       w   e   l   l   .   
   v   a   r       M   o   d   u   l   e       =       m   o   d   u   l   e   A   r   g   ;   
   
   /   /       D   e   t   e   r   m   i   n   e       t   h   e       r   u   n   t   i   m   e       e   n   v   i   r   o   n   m   e   n   t       w   e       a   r   e       i   n   .       Y   o   u       c   a   n       c   u   s   t   o   m   i   z   e       t   h   i   s       b   y   
   /   /       s   e   t   t   i   n   g       t   h   e       E   N   V   I   R   O   N   M   E   N   T       s   e   t   t   i   n   g       a   t       c   o   m   p   i   l   e       t   i   m   e       (   s   e   e       s   e   t   t   i   n   g   s   .   j   s   )   .   
   /   /       A   t   t   e   m   p   t       t   o       a   u   t   o   -   d   e   t   e   c   t       t   h   e       e   n   v   i   r   o   n   m   e   n   t   
   v   a   r       E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   W   E   B       =       t   y   p   e   o   f       w   i   n   d   o   w       =   =       "   o   b   j   e   c   t   "   ;   
   
   v   a   r       E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   W   O   R   K   E   R       =       t   y   p   e   o   f       W   o   r   k   e   r   G   l   o   b   a   l   S   c   o   p   e       !   =       "   u   n   d   e   f   i   n   e   d   "   ;   
   
   /   /       N   .   b   .       E   l   e   c   t   r   o   n   .   j   s       e   n   v   i   r   o   n   m   e   n   t       i   s       s   i   m   u   l   t   a   n   e   o   u   s   l   y       a       N   O   D   E   -   e   n   v   i   r   o   n   m   e   n   t   ,       b   u   t   
   /   /       a   l   s   o       a       w   e   b       e   n   v   i   r   o   n   m   e   n   t   .   
   v   a   r       E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   N   O   D   E       =       t   y   p   e   o   f       p   r   o   c   e   s   s       =   =       "   o   b   j   e   c   t   "       &   &       p   r   o   c   e   s   s   .   v   e   r   s   i   o   n   s   ?   .   n   o   d   e       &   &       p   r   o   c   e   s   s   .   t   y   p   e       !   =       "   r   e   n   d   e   r   e   r   "   ;   
   
   v   a   r       E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   S   H   E   L   L       =       !   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   W   E   B       &   &       !   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   N   O   D   E       &   &       !   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   W   O   R   K   E   R   ;   
   
   /   /       T   h   r   e   e       c   o   n   f   i   g   u   r   a   t   i   o   n   s       w   e       c   a   n       b   e       r   u   n   n   i   n   g       i   n   :   
   /   /       1   )       W   e       c   o   u   l   d       b   e       t   h   e       a   p   p   l   i   c   a   t   i   o   n       m   a   i   n   (   )       t   h   r   e   a   d       r   u   n   n   i   n   g       i   n       t   h   e       m   a   i   n       J   S       U   I       t   h   r   e   a   d   .       (   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   W   O   R   K   E   R       =   =       f   a   l   s   e       a   n   d       E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   P   T   H   R   E   A   D       =   =       f   a   l   s   e   )   
   /   /       2   )       W   e       c   o   u   l   d       b   e       t   h   e       a   p   p   l   i   c   a   t   i   o   n       m   a   i   n   (   )       t   h   r   e   a   d       p   r   o   x   i   e   d       t   o       w   o   r   k   e   r   .       (   w   i   t   h       E   m   s   c   r   i   p   t   e   n       -   s   P   R   O   X   Y   _   T   O   _   W   O   R   K   E   R   )       (   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   W   O   R   K   E   R       =   =       t   r   u   e   ,       E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   P   T   H   R   E   A   D       =   =       f   a   l   s   e   )   
   /   /       3   )       W   e       c   o   u   l   d       b   e       a   n       a   p   p   l   i   c   a   t   i   o   n       p   t   h   r   e   a   d       r   u   n   n   i   n   g       i   n       a       w   o   r   k   e   r   .       (   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   W   O   R   K   E   R       =   =       t   r   u   e       a   n   d       E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   P   T   H   R   E   A   D       =   =       t   r   u   e   )   
   /   /       T   h   e       w   a   y       w   e       s   i   g   n   a   l       t   o       a       w   o   r   k   e   r       t   h   a   t       i   t       i   s       h   o   s   t   i   n   g       a       p   t   h   r   e   a   d       i   s       t   o       c   o   n   s   t   r   u   c   t   
   /   /       i   t       w   i   t   h       a       s   p   e   c   i   f   i   c       n   a   m   e   .   
   v   a   r       E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   P   T   H   R   E   A   D       =       E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   W   O   R   K   E   R       &   &       s   e   l   f   .   n   a   m   e   ?   .   s   t   a   r   t   s   W   i   t   h   (   "   e   m   -   p   t   h   r   e   a   d   "   )   ;   
   
   i   f       (   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   P   T   H   R   E   A   D   )       {   
           a   s   s   e   r   t   (   !   g   l   o   b   a   l   T   h   i   s   .   m   o   d   u   l   e   L   o   a   d   e   d   ,       "   m   o   d   u   l   e       s   h   o   u   l   d       o   n   l   y       b   e       l   o   a   d   e   d       o   n   c   e       o   n       e   a   c   h       p   t   h   r   e   a   d       w   o   r   k   e   r   "   )   ;   
           g   l   o   b   a   l   T   h   i   s   .   m   o   d   u   l   e   L   o   a   d   e   d       =       t   r   u   e   ;   
   }   
   
   /   /       -   -   p   r   e   -   j   s   e   s       a   r   e       e   m   i   t   t   e   d       a   f   t   e   r       t   h   e       M   o   d   u   l   e       i   n   t   e   g   r   a   t   i   o   n       c   o   d   e   ,       s   o       t   h   a   t       t   h   e   y       c   a   n   
   /   /       r   e   f   e   r       t   o       M   o   d   u   l   e       (   i   f       t   h   e   y       c   h   o   o   s   e   ;       t   h   e   y       c   a   n       a   l   s   o       d   e   f   i   n   e       M   o   d   u   l   e   )   
   v   a   r       a   r   g   u   m   e   n   t   s   _       =       [   ]   ;   
   
   v   a   r       t   h   i   s   P   r   o   g   r   a   m       =       "   .   /   t   h   i   s   .   p   r   o   g   r   a   m   "   ;   
   
   v   a   r       q   u   i   t   _       =       (   s   t   a   t   u   s   ,       t   o   T   h   r   o   w   )       =   >       {   
           t   h   r   o   w       t   o   T   h   r   o   w   ;   
   }   ;   
   
   i   f       (   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   W   O   R   K   E   R   )       {   
           _   s   c   r   i   p   t   N   a   m   e       =       s   e   l   f   .   l   o   c   a   t   i   o   n   .   h   r   e   f   ;   
   }   
   
   /   /       `   /   `       s   h   o   u   l   d       b   e       p   r   e   s   e   n   t       a   t       t   h   e       e   n   d       i   f       `   s   c   r   i   p   t   D   i   r   e   c   t   o   r   y   `       i   s       n   o   t       e   m   p   t   y   
   v   a   r       s   c   r   i   p   t   D   i   r   e   c   t   o   r   y       =       "   "   ;   
   
   f   u   n   c   t   i   o   n       l   o   c   a   t   e   F   i   l   e   (   p   a   t   h   )       {   
           i   f       (   M   o   d   u   l   e   [   "   l   o   c   a   t   e   F   i   l   e   "   ]   )       {   
                   r   e   t   u   r   n       M   o   d   u   l   e   [   "   l   o   c   a   t   e   F   i   l   e   "   ]   (   p   a   t   h   ,       s   c   r   i   p   t   D   i   r   e   c   t   o   r   y   )   ;   
           }   
           r   e   t   u   r   n       s   c   r   i   p   t   D   i   r   e   c   t   o   r   y       +       p   a   t   h   ;   
   }   
   
   /   /       H   o   o   k   s       t   h   a   t       a   r   e       i   m   p   l   e   m   e   n   t   e   d       d   i   f   f   e   r   e   n   t   l   y       i   n       d   i   f   f   e   r   e   n   t       r   u   n   t   i   m   e       e   n   v   i   r   o   n   m   e   n   t   s   .   
   v   a   r       r   e   a   d   A   s   y   n   c   ,       r   e   a   d   B   i   n   a   r   y   ;   
   
   i   f       (   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   S   H   E   L   L   )       {   
           c   o   n   s   t       i   s   N   o   d   e       =       t   y   p   e   o   f       p   r   o   c   e   s   s       =   =       "   o   b   j   e   c   t   "       &   &       p   r   o   c   e   s   s   .   v   e   r   s   i   o   n   s   ?   .   n   o   d   e       &   &       p   r   o   c   e   s   s   .   t   y   p   e       !   =       "   r   e   n   d   e   r   e   r   "   ;   
           i   f       (   i   s   N   o   d   e       |   |       t   y   p   e   o   f       w   i   n   d   o   w       =   =       "   o   b   j   e   c   t   "       |   |       t   y   p   e   o   f       W   o   r   k   e   r   G   l   o   b   a   l   S   c   o   p   e       !   =       "   u   n   d   e   f   i   n   e   d   "   )       t   h   r   o   w       n   e   w       E   r   r   o   r   (   "   n   o   t       c   o   m   p   i   l   e   d       f   o   r       t   h   i   s       e   n   v   i   r   o   n   m   e   n   t       (   d   i   d       y   o   u       b   u   i   l   d       t   o       H   T   M   L       a   n   d       t   r   y       t   o       r   u   n       i   t       n   o   t       o   n       t   h   e       w   e   b   ,       o   r       s   e   t       E   N   V   I   R   O   N   M   E   N   T       t   o       s   o   m   e   t   h   i   n   g       -       l   i   k   e       n   o   d   e       -       a   n   d       r   u   n       i   t       s   o   m   e   p   l   a   c   e       e   l   s   e       -       l   i   k   e       o   n       t   h   e       w   e   b   ?   )   "   )   ;   
   }       e   l   s   e       /   /       N   o   t   e       t   h   a   t       t   h   i   s       i   n   c   l   u   d   e   s       N   o   d   e   .   j   s       w   o   r   k   e   r   s       w   h   e   n       r   e   l   e   v   a   n   t       (   p   t   h   r   e   a   d   s       i   s       e   n   a   b   l   e   d   )   .   
   /   /       N   o   d   e   .   j   s       w   o   r   k   e   r   s       a   r   e       d   e   t   e   c   t   e   d       a   s       a       c   o   m   b   i   n   a   t   i   o   n       o   f       E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   W   O   R   K   E   R       a   n   d   
   /   /       E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   N   O   D   E   .   
   i   f       (   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   W   E   B       |   |       E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   W   O   R   K   E   R   )       {   
           t   r   y       {   
                   s   c   r   i   p   t   D   i   r   e   c   t   o   r   y       =       n   e   w       U   R   L   (   "   .   "   ,       _   s   c   r   i   p   t   N   a   m   e   )   .   h   r   e   f   ;   
           }       c   a   t   c   h       {   }   
           i   f       (   !   (   t   y   p   e   o   f       w   i   n   d   o   w       =   =       "   o   b   j   e   c   t   "       |   |       t   y   p   e   o   f       W   o   r   k   e   r   G   l   o   b   a   l   S   c   o   p   e       !   =       "   u   n   d   e   f   i   n   e   d   "   )   )       t   h   r   o   w       n   e   w       E   r   r   o   r   (   "   n   o   t       c   o   m   p   i   l   e   d       f   o   r       t   h   i   s       e   n   v   i   r   o   n   m   e   n   t       (   d   i   d       y   o   u       b   u   i   l   d       t   o       H   T   M   L       a   n   d       t   r   y       t   o       r   u   n       i   t       n   o   t       o   n       t   h   e       w   e   b   ,       o   r       s   e   t       E   N   V   I   R   O   N   M   E   N   T       t   o       s   o   m   e   t   h   i   n   g       -       l   i   k   e       n   o   d   e       -       a   n   d       r   u   n       i   t       s   o   m   e   p   l   a   c   e       e   l   s   e       -       l   i   k   e       o   n       t   h   e       w   e   b   ?   )   "   )   ;   
           {   
                   /   /       i   n   c   l   u   d   e   :       w   e   b   _   o   r   _   w   o   r   k   e   r   _   s   h   e   l   l   _   r   e   a   d   .   j   s   
                   i   f       (   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   W   O   R   K   E   R   )       {   
                           r   e   a   d   B   i   n   a   r   y       =       u   r   l       =   >       {   
                                   v   a   r       x   h   r       =       n   e   w       X   M   L   H   t   t   p   R   e   q   u   e   s   t   ;   
                                   x   h   r   .   o   p   e   n   (   "   G   E   T   "   ,       u   r   l   ,       f   a   l   s   e   )   ;   
                                   x   h   r   .   r   e   s   p   o   n   s   e   T   y   p   e       =       "   a   r   r   a   y   b   u   f   f   e   r   "   ;   
                                   x   h   r   .   s   e   n   d   (   n   u   l   l   )   ;   
                                   r   e   t   u   r   n       n   e   w       U   i   n   t   8   A   r   r   a   y   (   /   *   *       @   t   y   p   e   {   !   A   r   r   a   y   B   u   f   f   e   r   }       *   /       (   x   h   r   .   r   e   s   p   o   n   s   e   )   )   ;   
                           }   ;   
                   }   
                   r   e   a   d   A   s   y   n   c       =       a   s   y   n   c       u   r   l       =   >       {   
                           a   s   s   e   r   t   (   !   i   s   F   i   l   e   U   R   I   (   u   r   l   )   ,       "   r   e   a   d   A   s   y   n   c       d   o   e   s       n   o   t       w   o   r   k       w   i   t   h       f   i   l   e   :   /   /       U   R   L   s   "   )   ;   
                           v   a   r       r   e   s   p   o   n   s   e       =       a   w   a   i   t       f   e   t   c   h   (   u   r   l   ,       {   
                                   c   r   e   d   e   n   t   i   a   l   s   :       "   s   a   m   e   -   o   r   i   g   i   n   "   
                           }   )   ;   
                           i   f       (   r   e   s   p   o   n   s   e   .   o   k   )       {   
                                   r   e   t   u   r   n       r   e   s   p   o   n   s   e   .   a   r   r   a   y   B   u   f   f   e   r   (   )   ;   
                           }   
                           t   h   r   o   w       n   e   w       E   r   r   o   r   (   r   e   s   p   o   n   s   e   .   s   t   a   t   u   s       +       "       :       "       +       r   e   s   p   o   n   s   e   .   u   r   l   )   ;   
                   }   ;   
           }   
   }       e   l   s   e       {   
           t   h   r   o   w       n   e   w       E   r   r   o   r   (   "   e   n   v   i   r   o   n   m   e   n   t       d   e   t   e   c   t   i   o   n       e   r   r   o   r   "   )   ;   
   }   
   
   v   a   r       o   u   t       =       c   o   n   s   o   l   e   .   l   o   g   .   b   i   n   d   (   c   o   n   s   o   l   e   )   ;   
   
   v   a   r       e   r   r       =       c   o   n   s   o   l   e   .   e   r   r   o   r   .   b   i   n   d   (   c   o   n   s   o   l   e   )   ;   
   
   v   a   r       I   D   B   F   S       =       "   I   D   B   F   S       i   s       n   o       l   o   n   g   e   r       i   n   c   l   u   d   e   d       b   y       d   e   f   a   u   l   t   ;       b   u   i   l   d       w   i   t   h       -   l   i   d   b   f   s   .   j   s   "   ;   
   
   v   a   r       P   R   O   X   Y   F   S       =       "   P   R   O   X   Y   F   S       i   s       n   o       l   o   n   g   e   r       i   n   c   l   u   d   e   d       b   y       d   e   f   a   u   l   t   ;       b   u   i   l   d       w   i   t   h       -   l   p   r   o   x   y   f   s   .   j   s   "   ;   
   
   v   a   r       W   O   R   K   E   R   F   S       =       "   W   O   R   K   E   R   F   S       i   s       n   o       l   o   n   g   e   r       i   n   c   l   u   d   e   d       b   y       d   e   f   a   u   l   t   ;       b   u   i   l   d       w   i   t   h       -   l   w   o   r   k   e   r   f   s   .   j   s   "   ;   
   
   v   a   r       F   E   T   C   H   F   S       =       "   F   E   T   C   H   F   S       i   s       n   o       l   o   n   g   e   r       i   n   c   l   u   d   e   d       b   y       d   e   f   a   u   l   t   ;       b   u   i   l   d       w   i   t   h       -   l   f   e   t   c   h   f   s   .   j   s   "   ;   
   
   v   a   r       I   C   A   S   E   F   S       =       "   I   C   A   S   E   F   S       i   s       n   o       l   o   n   g   e   r       i   n   c   l   u   d   e   d       b   y       d   e   f   a   u   l   t   ;       b   u   i   l   d       w   i   t   h       -   l   i   c   a   s   e   f   s   .   j   s   "   ;   
   
   v   a   r       J   S   F   I   L   E   F   S       =       "   J   S   F   I   L   E   F   S       i   s       n   o       l   o   n   g   e   r       i   n   c   l   u   d   e   d       b   y       d   e   f   a   u   l   t   ;       b   u   i   l   d       w   i   t   h       -   l   j   s   f   i   l   e   f   s   .   j   s   "   ;   
   
   v   a   r       O   P   F   S       =       "   O   P   F   S       i   s       n   o       l   o   n   g   e   r       i   n   c   l   u   d   e   d       b   y       d   e   f   a   u   l   t   ;       b   u   i   l   d       w   i   t   h       -   l   o   p   f   s   .   j   s   "   ;   
   
   v   a   r       N   O   D   E   F   S       =       "   N   O   D   E   F   S       i   s       n   o       l   o   n   g   e   r       i   n   c   l   u   d   e   d       b   y       d   e   f   a   u   l   t   ;       b   u   i   l   d       w   i   t   h       -   l   n   o   d   e   f   s   .   j   s   "   ;   
   
   /   /       p   e   r   f   o   r   m       a   s   s   e   r   t   i   o   n   s       i   n       s   h   e   l   l   .   j   s       a   f   t   e   r       w   e       s   e   t       u   p       o   u   t   (   )       a   n   d       e   r   r   (   )   ,       a   s       o   t   h   e   r   w   i   s   e   
   /   /       i   f       a   n       a   s   s   e   r   t   i   o   n       f   a   i   l   s       i   t       c   a   n   n   o   t       p   r   i   n   t       t   h   e       m   e   s   s   a   g   e   
   a   s   s   e   r   t   (   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   W   E   B       |   |       E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   W   O   R   K   E   R       |   |       E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   N   O   D   E   ,       "   P   t   h   r   e   a   d   s       d   o       n   o   t       w   o   r   k       i   n       t   h   i   s       e   n   v   i   r   o   n   m   e   n   t       y   e   t       (   n   e   e   d       W   e   b       W   o   r   k   e   r   s   ,       o   r       a   n       a   l   t   e   r   n   a   t   i   v   e       t   o       t   h   e   m   )   "   )   ;   
   
   a   s   s   e   r   t   (   !   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   N   O   D   E   ,       "   n   o   d   e       e   n   v   i   r   o   n   m   e   n   t       d   e   t   e   c   t   e   d       b   u   t       n   o   t       e   n   a   b   l   e   d       a   t       b   u   i   l   d       t   i   m   e   .           A   d   d       `   n   o   d   e   `       t   o       `   -   s   E   N   V   I   R   O   N   M   E   N   T   `       t   o       e   n   a   b   l   e   .   "   )   ;   
   
   a   s   s   e   r   t   (   !   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   S   H   E   L   L   ,       "   s   h   e   l   l       e   n   v   i   r   o   n   m   e   n   t       d   e   t   e   c   t   e   d       b   u   t       n   o   t       e   n   a   b   l   e   d       a   t       b   u   i   l   d       t   i   m   e   .           A   d   d       `   s   h   e   l   l   `       t   o       `   -   s   E   N   V   I   R   O   N   M   E   N   T   `       t   o       e   n   a   b   l   e   .   "   )   ;   
   
   /   /       e   n   d       i   n   c   l   u   d   e   :       s   h   e   l   l   .   j   s   
   /   /       i   n   c   l   u   d   e   :       p   r   e   a   m   b   l   e   .   j   s   
   /   /       =   =   =       P   r   e   a   m   b   l   e       l   i   b   r   a   r   y       s   t   u   f   f       =   =   =   
   /   /       D   o   c   u   m   e   n   t   a   t   i   o   n       f   o   r       t   h   e       p   u   b   l   i   c       A   P   I   s       d   e   f   i   n   e   d       i   n       t   h   i   s       f   i   l   e       m   u   s   t       b   e       u   p   d   a   t   e   d       i   n   :   
   /   /                   s   i   t   e   /   s   o   u   r   c   e   /   d   o   c   s   /   a   p   i   _   r   e   f   e   r   e   n   c   e   /   p   r   e   a   m   b   l   e   .   j   s   .   r   s   t   
   /   /       A       p   r   e   b   u   i   l   t       l   o   c   a   l       v   e   r   s   i   o   n       o   f       t   h   e       d   o   c   u   m   e   n   t   a   t   i   o   n       i   s       a   v   a   i   l   a   b   l   e       a   t   :   
   /   /                   s   i   t   e   /   b   u   i   l   d   /   t   e   x   t   /   d   o   c   s   /   a   p   i   _   r   e   f   e   r   e   n   c   e   /   p   r   e   a   m   b   l   e   .   j   s   .   t   x   t   
   /   /       Y   o   u       c   a   n       a   l   s   o       b   u   i   l   d       d   o   c   s       l   o   c   a   l   l   y       a   s       H   T   M   L       o   r       o   t   h   e   r       f   o   r   m   a   t   s       i   n       s   i   t   e   /   
   /   /       A   n       o   n   l   i   n   e       H   T   M   L       v   e   r   s   i   o   n       (   w   h   i   c   h       m   a   y       b   e       o   f       a       d   i   f   f   e   r   e   n   t       v   e   r   s   i   o   n       o   f       E   m   s   c   r   i   p   t   e   n   )   
   /   /                   i   s       u   p       a   t       h   t   t   p   :   /   /   k   r   i   p   k   e   n   .   g   i   t   h   u   b   .   i   o   /   e   m   s   c   r   i   p   t   e   n   -   s   i   t   e   /   d   o   c   s   /   a   p   i   _   r   e   f   e   r   e   n   c   e   /   p   r   e   a   m   b   l   e   .   j   s   .   h   t   m   l   
   v   a   r       w   a   s   m   B   i   n   a   r   y   ;   
   
   i   f       (   t   y   p   e   o   f       W   e   b   A   s   s   e   m   b   l   y       !   =       "   o   b   j   e   c   t   "   )       {   
           e   r   r   (   "   n   o       n   a   t   i   v   e       w   a   s   m       s   u   p   p   o   r   t       d   e   t   e   c   t   e   d   "   )   ;   
   }   
   
   /   /       W   a   s   m       g   l   o   b   a   l   s   
   /   /       F   o   r       s   e   n   d   i   n   g       t   o       w   o   r   k   e   r   s   .   
   v   a   r       w   a   s   m   M   o   d   u   l   e   ;   
   
   /   /   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   
   /   /       R   u   n   t   i   m   e       e   s   s   e   n   t   i   a   l   s   
   /   /   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   
   /   /       w   h   e   t   h   e   r       w   e       a   r   e       q   u   i   t   t   i   n   g       t   h   e       a   p   p   l   i   c   a   t   i   o   n   .       n   o       c   o   d   e       s   h   o   u   l   d       r   u   n       a   f   t   e   r       t   h   i   s   .   
   /   /       s   e   t       i   n       e   x   i   t   (   )       a   n   d       a   b   o   r   t   (   )   
   v   a   r       A   B   O   R   T       =       f   a   l   s   e   ;   
   
   /   /       s   e   t       b   y       e   x   i   t   (   )       a   n   d       a   b   o   r   t   (   )   .           P   a   s   s   e   d       t   o       '   o   n   E   x   i   t   '       h   a   n   d   l   e   r   .   
   /   /       N   O   T   E   :       T   h   i   s       i   s       a   l   s   o       u   s   e   d       a   s       t   h   e       p   r   o   c   e   s   s       r   e   t   u   r   n       c   o   d   e       c   o   d   e       i   n       s   h   e   l   l       e   n   v   i   r   o   n   m   e   n   t   s   
   /   /       b   u   t       o   n   l   y       w   h   e   n       n   o   E   x   i   t   R   u   n   t   i   m   e       i   s       f   a   l   s   e   .   
   v   a   r       E   X   I   T   S   T   A   T   U   S   ;   
   
   /   /       I   n       S   T   R   I   C   T       m   o   d   e   ,       w   e       o   n   l   y       d   e   f   i   n   e       a   s   s   e   r   t   (   )       w   h   e   n       A   S   S   E   R   T   I   O   N   S       i   s       s   e   t   .           i   .   e   .       w   e   
   /   /       d   o   n   '   t       d   e   f   i   n   e       i   t       a   t       a   l   l       i   n       r   e   l   e   a   s   e       m   o   d   e   s   .           T   h   i   s       m   a   t   c   h   e   s       t   h   e       b   e   h   a   v   i   o   u   r       o   f   
   /   /       M   I   N   I   M   A   L   _   R   U   N   T   I   M   E   .   
   /   /       T   O   D   O   (   s   b   c   )   :       M   a   k   e       t   h   i   s       t   h   e       d   e   f   a   u   l   t       e   v   e   n       w   i   t   h   o   u   t       S   T   R   I   C   T       e   n   a   b   l   e   d   .   
   /   *   *       @   t   y   p   e       {   f   u   n   c   t   i   o   n   (   *   ,       s   t   r   i   n   g   =   )   }       *   /       f   u   n   c   t   i   o   n       a   s   s   e   r   t   (   c   o   n   d   i   t   i   o   n   ,       t   e   x   t   )       {   
           i   f       (   !   c   o   n   d   i   t   i   o   n   )       {   
                   a   b   o   r   t   (   "   A   s   s   e   r   t   i   o   n       f   a   i   l   e   d   "       +       (   t   e   x   t       ?       "   :       "       +       t   e   x   t       :       "   "   )   )   ;   
           }   
   }   
   
   /   /       W   e       u   s   e   d       t   o       i   n   c   l   u   d   e       m   a   l   l   o   c   /   f   r   e   e       b   y       d   e   f   a   u   l   t       i   n       t   h   e       p   a   s   t   .       S   h   o   w       a       h   e   l   p   f   u   l       e   r   r   o   r       i   n   
   /   /       b   u   i   l   d   s       w   i   t   h       a   s   s   e   r   t   i   o   n   s   .   
   /   *   *   
       *       I   n   d   i   c   a   t   e   s       w   h   e   t   h   e   r       f   i   l   e   n   a   m   e       i   s       d   e   l   i   v   e   r   e   d       v   i   a       f   i   l   e       p   r   o   t   o   c   o   l       (   a   s       o   p   p   o   s   e   d       t   o       h   t   t   p   /   h   t   t   p   s   )   
       *       @   n   o   i   n   l   i   n   e   
       *   /       v   a   r       i   s   F   i   l   e   U   R   I       =       f   i   l   e   n   a   m   e       =   >       f   i   l   e   n   a   m   e   .   s   t   a   r   t   s   W   i   t   h   (   "   f   i   l   e   :   /   /   "   )   ;   
   
   /   /       i   n   c   l   u   d   e   :       r   u   n   t   i   m   e   _   c   o   m   m   o   n   .   j   s   
   /   /       i   n   c   l   u   d   e   :       r   u   n   t   i   m   e   _   s   t   a   c   k   _   c   h   e   c   k   .   j   s   
   /   /       I   n   i   t   i   a   l   i   z   e   s       t   h   e       s   t   a   c   k       c   o   o   k   i   e   .       C   a   l   l   e   d       a   t       t   h   e       s   t   a   r   t   u   p       o   f       m   a   i   n       a   n   d       a   t       t   h   e       s   t   a   r   t   u   p       o   f       e   a   c   h       t   h   r   e   a   d       i   n       p   t   h   r   e   a   d   s       m   o   d   e   .   
   f   u   n   c   t   i   o   n       w   r   i   t   e   S   t   a   c   k   C   o   o   k   i   e   (   )       {   
           v   a   r       m   a   x       =       _   e   m   s   c   r   i   p   t   e   n   _   s   t   a   c   k   _   g   e   t   _   e   n   d   (   )   ;   
           a   s   s   e   r   t   (   (   m   a   x       &       3   )       =   =       0   )   ;   
           /   /       I   f       t   h   e       s   t   a   c   k       e   n   d   s       a   t       a   d   d   r   e   s   s       z   e   r   o       w   e       w   r   i   t   e       o   u   r       c   o   o   k   i   e   s       4       b   y   t   e   s       i   n   t   o       t   h   e   
           /   /       s   t   a   c   k   .           T   h   i   s       p   r   e   v   e   n   t   s       i   n   t   e   r   f   e   r   e   n   c   e       w   i   t   h       S   A   F   E   _   H   E   A   P       a   n   d       A   S   A   N       w   h   i   c   h       a   l   s   o   
           /   /       m   o   n   i   t   o   r       w   r   i   t   e   s       t   o       a   d   d   r   e   s   s       z   e   r   o   .   
           i   f       (   m   a   x       =   =       0   )       {   
                   m   a   x       +   =       4   ;   
           }   
           /   /       T   h   e       s   t   a   c   k       g   r   o   w       d   o   w   n   w   a   r   d   s       t   o   w   a   r   d   s       _   e   m   s   c   r   i   p   t   e   n   _   s   t   a   c   k   _   g   e   t   _   e   n   d   .   
           /   /       W   e       w   r   i   t   e       c   o   o   k   i   e   s       t   o       t   h   e       f   i   n   a   l       t   w   o       w   o   r   d   s       i   n       t   h   e       s   t   a   c   k       a   n   d       d   e   t   e   c   t       i   f       t   h   e   y       a   r   e   
           /   /       e   v   e   r       o   v   e   r   w   r   i   t   t   e   n   .   
           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   m   a   x   )       >   >       2   )   ]       =       3   4   8   2   1   2   2   3   ;   
           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   (   m   a   x   )       +       (   4   )   )       >   >       2   )   ]       =       2   3   1   0   7   2   1   0   2   2   ;   
           /   /       A   l   s   o       t   e   s   t       t   h   e       g   l   o   b   a   l       a   d   d   r   e   s   s       0       f   o   r       i   n   t   e   g   r   i   t   y   .   
           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   0   )       >   >       2   )   ]       =       1   6   6   8   5   0   9   0   2   9   ;   
   }   
   
   f   u   n   c   t   i   o   n       c   h   e   c   k   S   t   a   c   k   C   o   o   k   i   e   (   )       {   
           i   f       (   A   B   O   R   T   )       r   e   t   u   r   n   ;   
           v   a   r       m   a   x       =       _   e   m   s   c   r   i   p   t   e   n   _   s   t   a   c   k   _   g   e   t   _   e   n   d   (   )   ;   
           /   /       S   e   e       w   r   i   t   e   S   t   a   c   k   C   o   o   k   i   e   (   )   .   
           i   f       (   m   a   x       =   =       0   )       {   
                   m   a   x       +   =       4   ;   
           }   
           v   a   r       c   o   o   k   i   e   1       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   m   a   x   )       >   >       2   )   ]   ;   
           v   a   r       c   o   o   k   i   e   2       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   (   m   a   x   )       +       (   4   )   )       >   >       2   )   ]   ;   
           i   f       (   c   o   o   k   i   e   1       !   =       3   4   8   2   1   2   2   3       |   |       c   o   o   k   i   e   2       !   =       2   3   1   0   7   2   1   0   2   2   )       {   
                   a   b   o   r   t   (   `   S   t   a   c   k       o   v   e   r   f   l   o   w   !       S   t   a   c   k       c   o   o   k   i   e       h   a   s       b   e   e   n       o   v   e   r   w   r   i   t   t   e   n       a   t       $   {   p   t   r   T   o   S   t   r   i   n   g   (   m   a   x   )   }   ,       e   x   p   e   c   t   e   d       h   e   x       d   w   o   r   d   s       0   x   8   9   B   A   C   D   F   E       a   n   d       0   x   2   1   3   5   4   6   7   ,       b   u   t       r   e   c   e   i   v   e   d       $   {   p   t   r   T   o   S   t   r   i   n   g   (   c   o   o   k   i   e   2   )   }       $   {   p   t   r   T   o   S   t   r   i   n   g   (   c   o   o   k   i   e   1   )   }   `   )   ;   
           }   
           /   /       A   l   s   o       t   e   s   t       t   h   e       g   l   o   b   a   l       a   d   d   r   e   s   s       0       f   o   r       i   n   t   e   g   r   i   t   y   .   
           i   f       (   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   0   )       >   >       2   )   ]       !   =       1   6   6   8   5   0   9   0   2   9   )       {   
                   a   b   o   r   t   (   "   R   u   n   t   i   m   e       e   r   r   o   r   :       T   h   e       a   p   p   l   i   c   a   t   i   o   n       h   a   s       c   o   r   r   u   p   t   e   d       i   t   s       h   e   a   p       m   e   m   o   r   y       a   r   e   a       (   a   d   d   r   e   s   s       z   e   r   o   )   !   "   )   ;   
           }   
   }   
   
   /   /       e   n   d       i   n   c   l   u   d   e   :       r   u   n   t   i   m   e   _   s   t   a   c   k   _   c   h   e   c   k   .   j   s   
   /   /       i   n   c   l   u   d   e   :       r   u   n   t   i   m   e   _   e   x   c   e   p   t   i   o   n   s   .   j   s   
   /   /       e   n   d       i   n   c   l   u   d   e   :       r   u   n   t   i   m   e   _   e   x   c   e   p   t   i   o   n   s   .   j   s   
   /   /       i   n   c   l   u   d   e   :       r   u   n   t   i   m   e   _   d   e   b   u   g   .   j   s   
   v   a   r       r   u   n   t   i   m   e   D   e   b   u   g       =       t   r   u   e   ;   
   
   /   /       S   w   i   t   c   h       t   o       f   a   l   s   e       a   t       r   u   n   t   i   m   e       t   o       d   i   s   a   b   l   e       l   o   g   g   i   n   g       a   t       t   h   e       r   i   g   h   t       t   i   m   e   s   
   /   /       U   s   e   d       b   y       X   X   X   X   X   _   D   E   B   U   G       s   e   t   t   i   n   g   s       t   o       o   u   t   p   u   t       d   e   b   u   g       m   e   s   s   a   g   e   s   .   
   f   u   n   c   t   i   o   n       d   b   g   (   .   .   .   a   r   g   s   )       {   
           i   f       (   !   r   u   n   t   i   m   e   D   e   b   u   g       &   &       t   y   p   e   o   f       r   u   n   t   i   m   e   D   e   b   u   g       !   =       "   u   n   d   e   f   i   n   e   d   "   )       r   e   t   u   r   n   ;   
           /   /       T   O   D   O   (   s   b   c   )   :       M   a   k   e       t   h   i   s       c   o   n   f   i   g   u   r   a   b   l   e       s   o   m   e   h   o   w   .           I   t   s       n   o   t       a   l   w   a   y   s       c   o   n   v   e   n   i   e   n   t       f   o   r   
           /   /       l   o   g   g   i   n   g       t   o       s   h   o   w       u   p       a   s       w   a   r   n   i   n   g   s   .   
           c   o   n   s   o   l   e   .   w   a   r   n   (   .   .   .   a   r   g   s   )   ;   
   }   
   
   /   /       E   n   d   i   a   n   n   e   s   s       c   h   e   c   k   
   (   (   )       =   >       {   
           v   a   r       h   1   6       =       n   e   w       I   n   t   1   6   A   r   r   a   y   (   1   )   ;   
           v   a   r       h   8       =       n   e   w       I   n   t   8   A   r   r   a   y   (   h   1   6   .   b   u   f   f   e   r   )   ;   
           h   1   6   [   0   ]       =       2   5   4   5   9   ;   
           i   f       (   h   8   [   0   ]       !   =   =       1   1   5       |   |       h   8   [   1   ]       !   =   =       9   9   )       t   h   r   o   w       "   R   u   n   t   i   m   e       e   r   r   o   r   :       e   x   p   e   c   t   e   d       t   h   e       s   y   s   t   e   m       t   o       b   e       l   i   t   t   l   e   -   e   n   d   i   a   n   !       (   R   u   n       w   i   t   h       -   s   S   U   P   P   O   R   T   _   B   I   G   _   E   N   D   I   A   N       t   o       b   y   p   a   s   s   )   "   ;   
   }   )   (   )   ;   
   
   f   u   n   c   t   i   o   n       c   o   n   s   u   m   e   d   M   o   d   u   l   e   P   r   o   p   (   p   r   o   p   )       {   
           i   f       (   !   O   b   j   e   c   t   .   g   e   t   O   w   n   P   r   o   p   e   r   t   y   D   e   s   c   r   i   p   t   o   r   (   M   o   d   u   l   e   ,       p   r   o   p   )   )       {   
                   O   b   j   e   c   t   .   d   e   f   i   n   e   P   r   o   p   e   r   t   y   (   M   o   d   u   l   e   ,       p   r   o   p   ,       {   
                           c   o   n   f   i   g   u   r   a   b   l   e   :       t   r   u   e   ,   
                           s   e   t   (   )       {   
                                   a   b   o   r   t   (   `   A   t   t   e   m   p   t       t   o       s   e   t       \   `   M   o   d   u   l   e   .   $   {   p   r   o   p   }   \   `       a   f   t   e   r       i   t       h   a   s       a   l   r   e   a   d   y       b   e   e   n       p   r   o   c   e   s   s   e   d   .           T   h   i   s       c   a   n       h   a   p   p   e   n   ,       f   o   r       e   x   a   m   p   l   e   ,       w   h   e   n       c   o   d   e       i   s       i   n   j   e   c   t   e   d       v   i   a       '   -   -   p   o   s   t   -   j   s   '       r   a   t   h   e   r       t   h   a   n       '   -   -   p   r   e   -   j   s   '   `   )   ;   
                           }   
                   }   )   ;   
           }   
   }   
   
   f   u   n   c   t   i   o   n       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   n   a   m   e   )       {   
           r   e   t   u   r   n       (   )       =   >       a   s   s   e   r   t   (   f   a   l   s   e   ,       `   c   a   l   l       t   o       '   $   {   n   a   m   e   }   '       v   i   a       r   e   f   e   r   e   n   c   e       t   a   k   e   n       b   e   f   o   r   e       W   a   s   m       m   o   d   u   l   e       i   n   i   t   i   a   l   i   z   a   t   i   o   n   `   )   ;   
   }   
   
   f   u   n   c   t   i   o   n       i   g   n   o   r   e   d   M   o   d   u   l   e   P   r   o   p   (   p   r   o   p   )       {   
           i   f       (   O   b   j   e   c   t   .   g   e   t   O   w   n   P   r   o   p   e   r   t   y   D   e   s   c   r   i   p   t   o   r   (   M   o   d   u   l   e   ,       p   r   o   p   )   )       {   
                   a   b   o   r   t   (   `   \   `   M   o   d   u   l   e   .   $   {   p   r   o   p   }   \   `       w   a   s       s   u   p   p   l   i   e   d       b   u   t       \   `   $   {   p   r   o   p   }   \   `       n   o   t       i   n   c   l   u   d   e   d       i   n       I   N   C   O   M   I   N   G   _   M   O   D   U   L   E   _   J   S   _   A   P   I   `   )   ;   
           }   
   }   
   
   /   /       f   o   r   c   i   n   g       t   h   e       f   i   l   e   s   y   s   t   e   m       e   x   p   o   r   t   s       a       f   e   w       t   h   i   n   g   s       b   y       d   e   f   a   u   l   t   
   f   u   n   c   t   i   o   n       i   s   E   x   p   o   r   t   e   d   B   y   F   o   r   c   e   F   i   l   e   s   y   s   t   e   m   (   n   a   m   e   )       {   
           r   e   t   u   r   n       n   a   m   e       =   =   =       "   F   S   _   c   r   e   a   t   e   P   a   t   h   "       |   |       n   a   m   e       =   =   =       "   F   S   _   c   r   e   a   t   e   D   a   t   a   F   i   l   e   "       |   |       n   a   m   e       =   =   =       "   F   S   _   c   r   e   a   t   e   P   r   e   l   o   a   d   e   d   F   i   l   e   "       |   |       n   a   m   e       =   =   =       "   F   S   _   u   n   l   i   n   k   "       |   |       n   a   m   e       =   =   =       "   a   d   d   R   u   n   D   e   p   e   n   d   e   n   c   y   "       |   |       n   a   m   e       =   =   =       "   r   e   m   o   v   e   R   u   n   D   e   p   e   n   d   e   n   c   y   "   ;   
   }   
   
   /   *   *   
       *       I   n   t   e   r   c   e   p   t       a   c   c   e   s   s       t   o       a       g   l   o   b   a   l       s   y   m   b   o   l   .           T   h   i   s       e   n   a   b   l   e   s       u   s       t   o       g   i   v   e       i   n   f   o   r   m   a   t   i   v   e   
       *       w   a   r   n   i   n   g   s   /   e   r   r   o   r   s       w   h   e   n       f   o   l   k   s       a   t   t   e   m   p   t       t   o       u   s   e       s   y   m   b   o   l   s       t   h   e   y       d   i   d       n   o   t       i   n   c   l   u   d   e       i   n   
       *       t   h   e   i   r       b   u   i   l   d   ,       o   r       n   o       s   y   m   b   o   l   s       t   h   a   t       n   o       l   o   n   g   e   r       e   x   i   s   t   .   
       *   /       f   u   n   c   t   i   o   n       h   o   o   k   G   l   o   b   a   l   S   y   m   b   o   l   A   c   c   e   s   s   (   s   y   m   ,       f   u   n   c   )       {   }   
   
   f   u   n   c   t   i   o   n       m   i   s   s   i   n   g   G   l   o   b   a   l   (   s   y   m   ,       m   s   g   )       {   
           h   o   o   k   G   l   o   b   a   l   S   y   m   b   o   l   A   c   c   e   s   s   (   s   y   m   ,       (   )       =   >       {   
                   w   a   r   n   O   n   c   e   (   `   \   `   $   {   s   y   m   }   \   `       i   s       n   o   t       l   o   n   g   e   r       d   e   f   i   n   e   d       b   y       e   m   s   c   r   i   p   t   e   n   .       $   {   m   s   g   }   `   )   ;   
           }   )   ;   
   }   
   
   m   i   s   s   i   n   g   G   l   o   b   a   l   (   "   b   u   f   f   e   r   "   ,       "   P   l   e   a   s   e       u   s   e       H   E   A   P   8   .   b   u   f   f   e   r       o   r       w   a   s   m   M   e   m   o   r   y   .   b   u   f   f   e   r   "   )   ;   
   
   m   i   s   s   i   n   g   G   l   o   b   a   l   (   "   a   s   m   "   ,       "   P   l   e   a   s   e       u   s   e       w   a   s   m   E   x   p   o   r   t   s       i   n   s   t   e   a   d   "   )   ;   
   
   f   u   n   c   t   i   o   n       m   i   s   s   i   n   g   L   i   b   r   a   r   y   S   y   m   b   o   l   (   s   y   m   )       {   
           h   o   o   k   G   l   o   b   a   l   S   y   m   b   o   l   A   c   c   e   s   s   (   s   y   m   ,       (   )       =   >       {   
                   /   /       C   a   n   '   t       `   a   b   o   r   t   (   )   `       h   e   r   e       b   e   c   a   u   s   e       i   t       w   o   u   l   d       b   r   e   a   k       c   o   d   e       t   h   a   t       d   o   e   s       r   u   n   t   i   m   e   
                   /   /       c   h   e   c   k   s   .           e   .   g   .       `   i   f       (   t   y   p   e   o   f       S   D   L       =   =   =       '   u   n   d   e   f   i   n   e   d   '   )   `   .   
                   v   a   r       m   s   g       =       `   \   `   $   {   s   y   m   }   \   `       i   s       a       l   i   b   r   a   r   y       s   y   m   b   o   l       a   n   d       n   o   t       i   n   c   l   u   d   e   d       b   y       d   e   f   a   u   l   t   ;       a   d   d       i   t       t   o       y   o   u   r       l   i   b   r   a   r   y   .   j   s       _   _   d   e   p   s       o   r       t   o       D   E   F   A   U   L   T   _   L   I   B   R   A   R   Y   _   F   U   N   C   S   _   T   O   _   I   N   C   L   U   D   E       o   n       t   h   e       c   o   m   m   a   n   d       l   i   n   e   `   ;   
                   /   /       D   E   F   A   U   L   T   _   L   I   B   R   A   R   Y   _   F   U   N   C   S   _   T   O   _   I   N   C   L   U   D   E       r   e   q   u   i   r   e   s       t   h   e       n   a   m   e       a   s       i   t       a   p   p   e   a   r   s       i   n   
                   /   /       l   i   b   r   a   r   y   .   j   s   ,       w   h   i   c   h       m   e   a   n   s       $   n   a   m   e       f   o   r       a       J   S       n   a   m   e       w   i   t   h       n   o       p   r   e   f   i   x   ,       o   r       n   a   m   e   
                   /   /       f   o   r       a       J   S       n   a   m   e       l   i   k   e       _   n   a   m   e   .   
                   v   a   r       l   i   b   r   a   r   y   S   y   m   b   o   l       =       s   y   m   ;   
                   i   f       (   !   l   i   b   r   a   r   y   S   y   m   b   o   l   .   s   t   a   r   t   s   W   i   t   h   (   "   _   "   )   )       {   
                           l   i   b   r   a   r   y   S   y   m   b   o   l       =       "   $   "       +       s   y   m   ;   
                   }   
                   m   s   g       +   =       `       (   e   .   g   .       -   s   D   E   F   A   U   L   T   _   L   I   B   R   A   R   Y   _   F   U   N   C   S   _   T   O   _   I   N   C   L   U   D   E   =   '   $   {   l   i   b   r   a   r   y   S   y   m   b   o   l   }   '   )   `   ;   
                   i   f       (   i   s   E   x   p   o   r   t   e   d   B   y   F   o   r   c   e   F   i   l   e   s   y   s   t   e   m   (   s   y   m   )   )       {   
                           m   s   g       +   =       "   .       A   l   t   e   r   n   a   t   i   v   e   l   y   ,       f   o   r   c   i   n   g       f   i   l   e   s   y   s   t   e   m       s   u   p   p   o   r   t       (   -   s   F   O   R   C   E   _   F   I   L   E   S   Y   S   T   E   M   )       c   a   n       e   x   p   o   r   t       t   h   i   s       f   o   r       y   o   u   "   ;   
                   }   
                   w   a   r   n   O   n   c   e   (   m   s   g   )   ;   
           }   )   ;   
           /   /       A   n   y       s   y   m   b   o   l       t   h   a   t       i   s       n   o   t       i   n   c   l   u   d   e   d       f   r   o   m       t   h   e       J   S       l   i   b   r   a   r   y       i   s       a   l   s   o       (   b   y       d   e   f   i   n   i   t   i   o   n   )   
           /   /       n   o   t       e   x   p   o   r   t   e   d       o   n       t   h   e       M   o   d   u   l   e       o   b   j   e   c   t   .   
           u   n   e   x   p   o   r   t   e   d   R   u   n   t   i   m   e   S   y   m   b   o   l   (   s   y   m   )   ;   
   }   
   
   f   u   n   c   t   i   o   n       u   n   e   x   p   o   r   t   e   d   R   u   n   t   i   m   e   S   y   m   b   o   l   (   s   y   m   )       {   
           i   f       (   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   P   T   H   R   E   A   D   )       {   
                   r   e   t   u   r   n   ;   
           }   
           i   f       (   !   O   b   j   e   c   t   .   g   e   t   O   w   n   P   r   o   p   e   r   t   y   D   e   s   c   r   i   p   t   o   r   (   M   o   d   u   l   e   ,       s   y   m   )   )       {   
                   O   b   j   e   c   t   .   d   e   f   i   n   e   P   r   o   p   e   r   t   y   (   M   o   d   u   l   e   ,       s   y   m   ,       {   
                           c   o   n   f   i   g   u   r   a   b   l   e   :       t   r   u   e   ,   
                           g   e   t   (   )       {   
                                   v   a   r       m   s   g       =       `   '   $   {   s   y   m   }   '       w   a   s       n   o   t       e   x   p   o   r   t   e   d   .       a   d   d       i   t       t   o       E   X   P   O   R   T   E   D   _   R   U   N   T   I   M   E   _   M   E   T   H   O   D   S       (   s   e   e       t   h   e       E   m   s   c   r   i   p   t   e   n       F   A   Q   )   `   ;   
                                   i   f       (   i   s   E   x   p   o   r   t   e   d   B   y   F   o   r   c   e   F   i   l   e   s   y   s   t   e   m   (   s   y   m   )   )       {   
                                           m   s   g       +   =       "   .       A   l   t   e   r   n   a   t   i   v   e   l   y   ,       f   o   r   c   i   n   g       f   i   l   e   s   y   s   t   e   m       s   u   p   p   o   r   t       (   -   s   F   O   R   C   E   _   F   I   L   E   S   Y   S   T   E   M   )       c   a   n       e   x   p   o   r   t       t   h   i   s       f   o   r       y   o   u   "   ;   
                                   }   
                                   a   b   o   r   t   (   m   s   g   )   ;   
                           }   
                   }   )   ;   
           }   
   }   
   
   /   *   *   
       *       O   v   e   r   r   i   d   e       `   e   r   r   `   /   `   o   u   t   `   /   `   d   b   g   `       t   o       r   e   p   o   r   t       t   h   r   e   a   d       /       w   o   r   k   e   r       i   n   f   o   r   m   a   t   i   o   n   
       *   /       f   u   n   c   t   i   o   n       i   n   i   t   W   o   r   k   e   r   L   o   g   g   i   n   g   (   )       {   
           f   u   n   c   t   i   o   n       g   e   t   L   o   g   P   r   e   f   i   x   (   )       {   
                   v   a   r       t       =       0   ;   
                   i   f       (   r   u   n   t   i   m   e   I   n   i   t   i   a   l   i   z   e   d       &   &       t   y   p   e   o   f       _   p   t   h   r   e   a   d   _   s   e   l   f       !   =       "   u   n   d   e   f   i   n   e   d   "   )       {   
                           t       =       _   p   t   h   r   e   a   d   _   s   e   l   f   (   )   ;   
                   }   
                   r   e   t   u   r   n       `   w   :   $   {   w   o   r   k   e   r   I   D   }   ,   t   :   $   {   p   t   r   T   o   S   t   r   i   n   g   (   t   )   }   :   `   ;   
           }   
           /   /       P   r   e   f   i   x       a   l   l       d   b   g   (   )       m   e   s   s   a   g   e   s       w   i   t   h       t   h   e       c   a   l   l   i   n   g       t   h   r   e   a   d       i   n   f   o   .   
           v   a   r       o   r   i   g   D   b   g       =       d   b   g   ;   
           d   b   g       =       (   .   .   .   a   r   g   s   )       =   >       o   r   i   g   D   b   g   (   g   e   t   L   o   g   P   r   e   f   i   x   (   )   ,       .   .   .   a   r   g   s   )   ;   
   }   
   
   i   n   i   t   W   o   r   k   e   r   L   o   g   g   i   n   g   (   )   ;   
   
   /   /       e   n   d       i   n   c   l   u   d   e   :       r   u   n   t   i   m   e   _   d   e   b   u   g   .   j   s   
   /   /       i   n   c   l   u   d   e   :       g   r   o   w   a   b   l   e   H   e   a   p   .   j   s   
   /   /       S   u   p   p   o   r   t       f   o   r       g   r   o   w   a   b   l   e       h   e   a   p       +       p   t   h   r   e   a   d   s   ,       w   h   e   r   e       t   h   e       b   u   f   f   e   r       m   a   y       c   h   a   n   g   e   ,       s   o       J   S       v   i   e   w   s   
   /   /       m   u   s   t       b   e       u   p   d   a   t   e   d   .   
   f   u   n   c   t   i   o   n       g   r   o   w   M   e   m   V   i   e   w   s   (   )       {   
           /   /       `   u   p   d   a   t   e   M   e   m   o   r   y   V   i   e   w   s   `       u   p   d   a   t   e   s       a   l   l       t   h   e       v   i   e   w   s       s   i   m   u   l   t   a   n   e   o   u   s   l   y   ,       s   o       i   t   '   s       e   n   o   u   g   h       t   o       c   h   e   c   k       a   n   y       o   f       t   h   e   m   .   
           i   f       (   w   a   s   m   M   e   m   o   r   y   .   b   u   f   f   e   r       !   =       H   E   A   P   8   .   b   u   f   f   e   r   )       {   
                   u   p   d   a   t   e   M   e   m   o   r   y   V   i   e   w   s   (   )   ;   
           }   
   }   
   
   /   /       e   n   d       i   n   c   l   u   d   e   :       g   r   o   w   a   b   l   e   H   e   a   p   .   j   s   
   v   a   r       r   e   a   d   y   P   r   o   m   i   s   e   R   e   s   o   l   v   e   ,       r   e   a   d   y   P   r   o   m   i   s   e   R   e   j   e   c   t   ;   
   
   v   a   r       w   a   s   m   M   o   d   u   l   e   R   e   c   e   i   v   e   d   ;   
   
   /   /       i   n   c   l   u   d   e   :       r   u   n   t   i   m   e   _   p   t   h   r   e   a   d   .   j   s   
   /   /       P   t   h   r   e   a   d       W   e   b       W   o   r   k   e   r       h   a   n   d   l   i   n   g       c   o   d   e   .   
   /   /       T   h   i   s       c   o   d   e       r   u   n   s       o   n   l   y       o   n       p   t   h   r   e   a   d       w   e   b       w   o   r   k   e   r   s       a   n   d       h   a   n   d   l   e   s       p   t   h   r   e   a   d       s   e   t   u   p   
   /   /       a   n   d       c   o   m   m   u   n   i   c   a   t   i   o   n       w   i   t   h       t   h   e       m   a   i   n       t   h   r   e   a   d       v   i   a       p   o   s   t   M   e   s   s   a   g   e   .   
   /   /       U   n   i   q   u   e       I   D       o   f       t   h   e       c   u   r   r   e   n   t       p   t   h   r   e   a   d       w   o   r   k   e   r       (   z   e   r   o       o   n       n   o   n   -   p   t   h   r   e   a   d   -   w   o   r   k   e   r   s   
   /   /       i   n   c   l   u   d   i   n   g       t   h   e       m   a   i   n       t   h   r   e   a   d   )   .   
   v   a   r       w   o   r   k   e   r   I   D       =       0   ;   
   
   i   f       (   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   P   T   H   R   E   A   D   )       {   
           /   /       T   h   r   e   a   d   -   l   o   c   a   l       g   u   a   r   d       v   a   r   i   a   b   l   e       f   o   r       o   n   e   -   t   i   m   e       i   n   i   t       o   f       t   h   e       J   S       s   t   a   t   e   
           v   a   r       i   n   i   t   i   a   l   i   z   e   d   J   S       =       f   a   l   s   e   ;   
           /   /       T   u   r   n       u   n   h   a   n   d   l   e   d       r   e   j   e   c   t   e   d       p   r   o   m   i   s   e   s       i   n   t   o       e   r   r   o   r   s       s   o       t   h   a   t       t   h   e       m   a   i   n       t   h   r   e   a   d       w   i   l   l       b   e   
           /   /       n   o   t   i   f   i   e   d       a   b   o   u   t       t   h   e   m   .   
           s   e   l   f   .   o   n   u   n   h   a   n   d   l   e   d   r   e   j   e   c   t   i   o   n       =       e       =   >       {   
                   t   h   r   o   w       e   .   r   e   a   s   o   n       |   |       e   ;   
           }   ;   
           f   u   n   c   t   i   o   n       h   a   n   d   l   e   M   e   s   s   a   g   e   (   e   )       {   
                   t   r   y       {   
                           v   a   r       m   s   g   D   a   t   a       =       e   [   "   d   a   t   a   "   ]   ;   
                           /   /   d   b   g   (   '   m   s   g   D   a   t   a   :       '       +       O   b   j   e   c   t   .   k   e   y   s   (   m   s   g   D   a   t   a   )   )   ;   
                           v   a   r       c   m   d       =       m   s   g   D   a   t   a   .   c   m   d   ;   
                           i   f       (   c   m   d       =   =   =       "   l   o   a   d   "   )       {   
                                   /   /       P   r   e   l   o   a   d       c   o   m   m   a   n   d       t   h   a   t       i   s       c   a   l   l   e   d       o   n   c   e       p   e   r       w   o   r   k   e   r       t   o       p   a   r   s   e       a   n   d       l   o   a   d       t   h   e       E   m   s   c   r   i   p   t   e   n       c   o   d   e   .   
                                   w   o   r   k   e   r   I   D       =       m   s   g   D   a   t   a   .   w   o   r   k   e   r   I   D   ;   
                                   /   /       U   n   t   i   l       w   e       i   n   i   t   i   a   l   i   z   e       t   h   e       r   u   n   t   i   m   e   ,       q   u   e   u   e       u   p       a   n   y       f   u   r   t   h   e   r       i   n   c   o   m   i   n   g       m   e   s   s   a   g   e   s   .   
                                   l   e   t       m   e   s   s   a   g   e   Q   u   e   u   e       =       [   ]   ;   
                                   s   e   l   f   .   o   n   m   e   s   s   a   g   e       =       e       =   >       m   e   s   s   a   g   e   Q   u   e   u   e   .   p   u   s   h   (   e   )   ;   
                                   /   /       A   n   d       a   d   d       a       c   a   l   l   b   a   c   k       f   o   r       w   h   e   n       t   h   e       r   u   n   t   i   m   e       i   s       i   n   i   t   i   a   l   i   z   e   d   .   
                                   s   e   l   f   .   s   t   a   r   t   W   o   r   k   e   r       =       i   n   s   t   a   n   c   e       =   >       {   
                                           /   /       N   o   t   i   f   y       t   h   e       m   a   i   n       t   h   r   e   a   d       t   h   a   t       t   h   i   s       t   h   r   e   a   d       h   a   s       l   o   a   d   e   d   .   
                                           p   o   s   t   M   e   s   s   a   g   e   (   {   
                                                   c   m   d   :       "   l   o   a   d   e   d   "   
                                           }   )   ;   
                                           /   /       P   r   o   c   e   s   s       a   n   y       m   e   s   s   a   g   e   s       t   h   a   t       w   e   r   e       q   u   e   u   e   d       b   e   f   o   r   e       t   h   e       t   h   r   e   a   d       w   a   s       r   e   a   d   y   .   
                                           f   o   r       (   l   e   t       m   s   g       o   f       m   e   s   s   a   g   e   Q   u   e   u   e   )       {   
                                                   h   a   n   d   l   e   M   e   s   s   a   g   e   (   m   s   g   )   ;   
                                           }   
                                           /   /       R   e   s   t   o   r   e       t   h   e       r   e   a   l       m   e   s   s   a   g   e       h   a   n   d   l   e   r   .   
                                           s   e   l   f   .   o   n   m   e   s   s   a   g   e       =       h   a   n   d   l   e   M   e   s   s   a   g   e   ;   
                                   }   ;   
                                   /   /       U   s   e       `   c   o   n   s   t   `       h   e   r   e       t   o       e   n   s   u   r   e       t   h   a   t       t   h   e       v   a   r   i   a   b   l   e       i   s       s   c   o   p   e   d       o   n   l   y       t   o   
                                   /   /       t   h   a   t       i   t   e   r   a   t   i   o   n   ,       a   l   l   o   w   i   n   g       s   a   f   e       r   e   f   e   r   e   n   c   e       f   r   o   m       a       c   l   o   s   u   r   e   .   
                                   f   o   r       (   c   o   n   s   t       h   a   n   d   l   e   r       o   f       m   s   g   D   a   t   a   .   h   a   n   d   l   e   r   s   )       {   
                                           /   /       T   h   e       t   h   e       m   a   i   n       m   o   d   u   l   e       h   a   s       a       h   a   n   d   l   e   r       f   o   r       a       c   e   r   t   a   i   n       e   v   e   n   ,       b   u   t       n   o   
                                           /   /       h   a   n   d   l   e   r       e   x   i   s   t   s       o   n       t   h   e       p   t   h   r   e   a   d       w   o   r   k   e   r   ,       t   h   e   n       p   r   o   x   y       t   h   a   t       h   a   n   d   l   e   r   
                                           /   /       b   a   c   k       t   o       t   h   e       m   a   i   n       t   h   r   e   a   d   .   
                                           i   f       (   !   M   o   d   u   l   e   [   h   a   n   d   l   e   r   ]       |   |       M   o   d   u   l   e   [   h   a   n   d   l   e   r   ]   .   p   r   o   x   y   )       {   
                                                   M   o   d   u   l   e   [   h   a   n   d   l   e   r   ]       =       (   .   .   .   a   r   g   s   )       =   >       {   
                                                           p   o   s   t   M   e   s   s   a   g   e   (   {   
                                                                   c   m   d   :       "   c   a   l   l   H   a   n   d   l   e   r   "   ,   
                                                                   h   a   n   d   l   e   r   ,   
                                                                   a   r   g   s   
                                                           }   )   ;   
                                                   }   ;   
                                                   /   /       R   e   b   i   n   d       t   h   e       o   u   t       /       e   r   r       h   a   n   d   l   e   r   s       i   f       n   e   e   d   e   d   
                                                   i   f       (   h   a   n   d   l   e   r       =   =       "   p   r   i   n   t   "   )       o   u   t       =       M   o   d   u   l   e   [   h   a   n   d   l   e   r   ]   ;   
                                                   i   f       (   h   a   n   d   l   e   r       =   =       "   p   r   i   n   t   E   r   r   "   )       e   r   r       =       M   o   d   u   l   e   [   h   a   n   d   l   e   r   ]   ;   
                                           }   
                                   }   
                                   w   a   s   m   M   e   m   o   r   y       =       m   s   g   D   a   t   a   .   w   a   s   m   M   e   m   o   r   y   ;   
                                   u   p   d   a   t   e   M   e   m   o   r   y   V   i   e   w   s   (   )   ;   
                                   w   a   s   m   M   o   d   u   l   e   R   e   c   e   i   v   e   d   (   m   s   g   D   a   t   a   .   w   a   s   m   M   o   d   u   l   e   )   ;   
                           }       e   l   s   e       i   f       (   c   m   d       =   =   =       "   r   u   n   "   )       {   
                                   a   s   s   e   r   t   (   m   s   g   D   a   t   a   .   p   t   h   r   e   a   d   _   p   t   r   )   ;   
                                   /   /       C   a   l   l       i   n   s   i   d   e       J   S       m   o   d   u   l   e       t   o       s   e   t       u   p       t   h   e       s   t   a   c   k       f   r   a   m   e       f   o   r       t   h   i   s       p   t   h   r   e   a   d       i   n       J   S       m   o   d   u   l   e       s   c   o   p   e   .   
                                   /   /       T   h   i   s       n   e   e   d   s       t   o       b   e       t   h   e       f   i   r   s   t       t   h   i   n   g       t   h   a   t       w   e       d   o   ,       a   s       w   e       c   a   n   n   o   t       c   a   l   l       t   o       a   n   y       C   /   C   +   +       f   u   n   c   t   i   o   n   s   
                                   /   /       u   n   t   i   l       t   h   e       t   h   r   e   a   d       s   t   a   c   k       i   s       i   n   i   t   i   a   l   i   z   e   d   .   
                                   e   s   t   a   b   l   i   s   h   S   t   a   c   k   S   p   a   c   e   (   m   s   g   D   a   t   a   .   p   t   h   r   e   a   d   _   p   t   r   )   ;   
                                   /   /       P   a   s   s       t   h   e       t   h   r   e   a   d       a   d   d   r   e   s   s       t   o       w   a   s   m       t   o       s   t   o   r   e       i   t       f   o   r       f   a   s   t       a   c   c   e   s   s   .   
                                   _   _   e   m   s   c   r   i   p   t   e   n   _   t   h   r   e   a   d   _   i   n   i   t   (   m   s   g   D   a   t   a   .   p   t   h   r   e   a   d   _   p   t   r   ,       /   *   i   s   _   m   a   i   n   =   *   /       0   ,       /   *   i   s   _   r   u   n   t   i   m   e   =   *   /       0   ,       /   *   c   a   n   _   b   l   o   c   k   =   *   /       1   ,       0   ,       0   )   ;   
                                   P   T   h   r   e   a   d   .   t   h   r   e   a   d   I   n   i   t   T   L   S   (   )   ;   
                                   /   /       A   w   a   i   t       m   a   i   l   b   o   x       n   o   t   i   f   i   c   a   t   i   o   n   s       w   i   t   h       `   A   t   o   m   i   c   s   .   w   a   i   t   A   s   y   n   c   `       s   o       w   e       c   a   n       s   t   a   r   t   
                                   /   /       u   s   i   n   g       t   h   e       f   a   s   t       `   A   t   o   m   i   c   s   .   n   o   t   i   f   y   `       n   o   t   i   f   i   c   a   t   i   o   n       p   a   t   h   .   
                                   _   _   e   m   s   c   r   i   p   t   e   n   _   t   h   r   e   a   d   _   m   a   i   l   b   o   x   _   a   w   a   i   t   (   m   s   g   D   a   t   a   .   p   t   h   r   e   a   d   _   p   t   r   )   ;   
                                   i   f       (   !   i   n   i   t   i   a   l   i   z   e   d   J   S   )       {   
                                           /   /       E   m   b   i   n   d       m   u   s   t       i   n   i   t   i   a   l   i   z   e       i   t   s   e   l   f       o   n       a   l   l       t   h   r   e   a   d   s   ,       a   s       i   t       g   e   n   e   r   a   t   e   s       s   u   p   p   o   r   t       J   S   .   
                                           /   /       W   e       o   n   l   y       d   o       t   h   i   s       o   n   c   e       p   e   r       w   o   r   k   e   r       s   i   n   c   e       t   h   e   y       g   e   t       r   e   u   s   e   d   
                                           _   _   e   m   b   i   n   d   _   i   n   i   t   i   a   l   i   z   e   _   b   i   n   d   i   n   g   s   (   )   ;   
                                           i   n   i   t   i   a   l   i   z   e   d   J   S       =       t   r   u   e   ;   
                                   }   
                                   t   r   y       {   
                                           i   n   v   o   k   e   E   n   t   r   y   P   o   i   n   t   (   m   s   g   D   a   t   a   .   s   t   a   r   t   _   r   o   u   t   i   n   e   ,       m   s   g   D   a   t   a   .   a   r   g   )   ;   
                                   }       c   a   t   c   h       (   e   x   )       {   
                                           i   f       (   e   x       !   =       "   u   n   w   i   n   d   "   )       {   
                                                   /   /       T   h   e       p   t   h   r   e   a   d       "   c   r   a   s   h   e   d   "   .           D   o       n   o   t       c   a   l   l       `   _   e   m   s   c   r   i   p   t   e   n   _   t   h   r   e   a   d   _   e   x   i   t   `       (   w   h   i   c   h   
                                                   /   /       w   o   u   l   d       m   a   k   e       t   h   i   s       t   h   r   e   a   d       j   o   i   n   a   b   l   e   )   .           I   n   s   t   e   a   d   ,       r   e   -   t   h   r   o   w       t   h   e       e   x   c   e   p   t   i   o   n   
                                                   /   /       a   n   d       l   e   t       t   h   e       t   o   p       l   e   v   e   l       h   a   n   d   l   e   r       p   r   o   p   a   g   a   t   e       i   t       b   a   c   k       t   o       t   h   e       m   a   i   n       t   h   r   e   a   d   .   
                                                   t   h   r   o   w       e   x   ;   
                                           }   
                                   }   
                           }       e   l   s   e       i   f       (   m   s   g   D   a   t   a   .   t   a   r   g   e   t       =   =   =       "   s   e   t   i   m   m   e   d   i   a   t   e   "   )       {   }       e   l   s   e       i   f       (   c   m   d       =   =   =       "   c   h   e   c   k   M   a   i   l   b   o   x   "   )       {   
                                   i   f       (   i   n   i   t   i   a   l   i   z   e   d   J   S   )       {   
                                           c   h   e   c   k   M   a   i   l   b   o   x   (   )   ;   
                                   }   
                           }       e   l   s   e       i   f       (   c   m   d   )       {   
                                   /   /       T   h   e       r   e   c   e   i   v   e   d       m   e   s   s   a   g   e       l   o   o   k   s       l   i   k   e       s   o   m   e   t   h   i   n   g       t   h   a   t       s   h   o   u   l   d       b   e       h   a   n   d   l   e   d       b   y       t   h   i   s       m   e   s   s   a   g   e   
                                   /   /       h   a   n   d   l   e   r   ,       (   s   i   n   c   e       t   h   e   r   e       i   s       a       c   m   d       f   i   e   l   d       p   r   e   s   e   n   t   )   ,       b   u   t       i   s       n   o   t       o   n   e       o   f       t   h   e   
                                   /   /       r   e   c   o   g   n   i   z   e   d       c   o   m   m   a   n   d   s   :   
                                   e   r   r   (   `   w   o   r   k   e   r   :       r   e   c   e   i   v   e   d       u   n   k   n   o   w   n       c   o   m   m   a   n   d       $   {   c   m   d   }   `   )   ;   
                                   e   r   r   (   m   s   g   D   a   t   a   )   ;   
                           }   
                   }       c   a   t   c   h       (   e   x   )       {   
                           e   r   r   (   `   w   o   r   k   e   r   :       o   n   m   e   s   s   a   g   e   (   )       c   a   p   t   u   r   e   d       a   n       u   n   c   a   u   g   h   t       e   x   c   e   p   t   i   o   n   :       $   {   e   x   }   `   )   ;   
                           i   f       (   e   x   ?   .   s   t   a   c   k   )       e   r   r   (   e   x   .   s   t   a   c   k   )   ;   
                           _   _   e   m   s   c   r   i   p   t   e   n   _   t   h   r   e   a   d   _   c   r   a   s   h   e   d   (   )   ;   
                           t   h   r   o   w       e   x   ;   
                   }   
           }   
           s   e   l   f   .   o   n   m   e   s   s   a   g   e       =       h   a   n   d   l   e   M   e   s   s   a   g   e   ;   
   }   
   
   /   /       E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   P   T   H   R   E   A   D   
   /   /       e   n   d       i   n   c   l   u   d   e   :       r   u   n   t   i   m   e   _   p   t   h   r   e   a   d   .   j   s   
   /   /       M   e   m   o   r   y       m   a   n   a   g   e   m   e   n   t   
   v   a   r       w   a   s   m   M   e   m   o   r   y   ;   
   
   v   a   r       /   *   *       @   t   y   p   e       {   !   I   n   t   8   A   r   r   a   y   }       *   /       H   E   A   P   8   ,       /   *   *       @   t   y   p   e       {   !   U   i   n   t   8   A   r   r   a   y   }       *   /       H   E   A   P   U   8   ,       /   *   *       @   t   y   p   e       {   !   I   n   t   1   6   A   r   r   a   y   }       *   /       H   E   A   P   1   6   ,       /   *   *       @   t   y   p   e       {   !   U   i   n   t   1   6   A   r   r   a   y   }       *   /       H   E   A   P   U   1   6   ,       /   *   *       @   t   y   p   e       {   !   I   n   t   3   2   A   r   r   a   y   }       *   /       H   E   A   P   3   2   ,       /   *   *       @   t   y   p   e       {   !   U   i   n   t   3   2   A   r   r   a   y   }       *   /       H   E   A   P   U   3   2   ,       /   *   *       @   t   y   p   e       {   !   F   l   o   a   t   3   2   A   r   r   a   y   }       *   /       H   E   A   P   F   3   2   ,       /   *   *       @   t   y   p   e       {   !   F   l   o   a   t   6   4   A   r   r   a   y   }       *   /       H   E   A   P   F   6   4   ;   
   
   /   /       B   i   g   I   n   t   6   4   A   r   r   a   y       t   y   p   e       i   s       n   o   t       c   o   r   r   e   c   t   l   y       d   e   f   i   n   e   d       i   n       c   l   o   s   u   r   e   
   v   a   r       /   *   *       n   o   t   -   @   t   y   p   e       {   !   B   i   g   I   n   t   6   4   A   r   r   a   y   }       *   /       H   E   A   P   6   4   ,       /   *       B   i   g   U   i   n   t   6   4   A   r   r   a   y       t   y   p   e       i   s       n   o   t       c   o   r   r   e   c   t   l   y       d   e   f   i   n   e   d       i   n       c   l   o   s   u   r   e   
   /   *   *       n   o   t   -   @   t   y   p   e       {   !   B   i   g   U   i   n   t   6   4   A   r   r   a   y   }       *   /       H   E   A   P   U   6   4   ;   
   
   v   a   r       r   u   n   t   i   m   e   I   n   i   t   i   a   l   i   z   e   d       =       f   a   l   s   e   ;   
   
   f   u   n   c   t   i   o   n       u   p   d   a   t   e   M   e   m   o   r   y   V   i   e   w   s   (   )       {   
           v   a   r       b       =       w   a   s   m   M   e   m   o   r   y   .   b   u   f   f   e   r   ;   
           H   E   A   P   8       =       n   e   w       I   n   t   8   A   r   r   a   y   (   b   )   ;   
           H   E   A   P   1   6       =       n   e   w       I   n   t   1   6   A   r   r   a   y   (   b   )   ;   
           H   E   A   P   U   8       =       n   e   w       U   i   n   t   8   A   r   r   a   y   (   b   )   ;   
           H   E   A   P   U   1   6       =       n   e   w       U   i   n   t   1   6   A   r   r   a   y   (   b   )   ;   
           H   E   A   P   3   2       =       n   e   w       I   n   t   3   2   A   r   r   a   y   (   b   )   ;   
           H   E   A   P   U   3   2       =       n   e   w       U   i   n   t   3   2   A   r   r   a   y   (   b   )   ;   
           H   E   A   P   F   3   2       =       n   e   w       F   l   o   a   t   3   2   A   r   r   a   y   (   b   )   ;   
           H   E   A   P   F   6   4       =       n   e   w       F   l   o   a   t   6   4   A   r   r   a   y   (   b   )   ;   
           H   E   A   P   6   4       =       n   e   w       B   i   g   I   n   t   6   4   A   r   r   a   y   (   b   )   ;   
           H   E   A   P   U   6   4       =       n   e   w       B   i   g   U   i   n   t   6   4   A   r   r   a   y   (   b   )   ;   
   }   
   
   /   /       I   n       n   o   n   -   s   t   a   n   d   a   l   o   n   e   /   n   o   r   m   a   l       m   o   d   e   ,       w   e       c   r   e   a   t   e       t   h   e       m   e   m   o   r   y       h   e   r   e   .   
   /   /       i   n   c   l   u   d   e   :       r   u   n   t   i   m   e   _   i   n   i   t   _   m   e   m   o   r   y   .   j   s   
   /   /       C   r   e   a   t   e       t   h   e       w   a   s   m       m   e   m   o   r   y   .       (   N   o   t   e   :       t   h   i   s       o   n   l   y       a   p   p   l   i   e   s       i   f       I   M   P   O   R   T   E   D   _   M   E   M   O   R   Y       i   s       d   e   f   i   n   e   d   )   
   /   /       c   h   e   c   k       f   o   r       f   u   l   l       e   n   g   i   n   e       s   u   p   p   o   r   t       (   u   s   e       s   t   r   i   n   g       '   s   u   b   a   r   r   a   y   '       t   o       a   v   o   i   d       c   l   o   s   u   r   e       c   o   m   p   i   l   e   r       c   o   n   f   u   s   i   o   n   )   
   f   u   n   c   t   i   o   n       i   n   i   t   M   e   m   o   r   y   (   )       {   
           i   f       (   (   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   P   T   H   R   E   A   D   )   )       {   
                   r   e   t   u   r   n   ;   
           }   
           i   f       (   M   o   d   u   l   e   [   "   w   a   s   m   M   e   m   o   r   y   "   ]   )       {   
                   w   a   s   m   M   e   m   o   r   y       =       M   o   d   u   l   e   [   "   w   a   s   m   M   e   m   o   r   y   "   ]   ;   
           }       e   l   s   e       {   
                   v   a   r       I   N   I   T   I   A   L   _   M   E   M   O   R   Y       =       M   o   d   u   l   e   [   "   I   N   I   T   I   A   L   _   M   E   M   O   R   Y   "   ]       |   |       1   6   7   7   7   2   1   6   ;   
                   a   s   s   e   r   t   (   I   N   I   T   I   A   L   _   M   E   M   O   R   Y       >   =       6   5   5   3   6   ,       "   I   N   I   T   I   A   L   _   M   E   M   O   R   Y       s   h   o   u   l   d       b   e       l   a   r   g   e   r       t   h   a   n       S   T   A   C   K   _   S   I   Z   E   ,       w   a   s       "       +       I   N   I   T   I   A   L   _   M   E   M   O   R   Y       +       "   !       (   S   T   A   C   K   _   S   I   Z   E   =   "       +       6   5   5   3   6       +       "   )   "   )   ;   
                   /   *   *       @   s   u   p   p   r   e   s   s       {   c   h   e   c   k   T   y   p   e   s   }       *   /       w   a   s   m   M   e   m   o   r   y       =       n   e   w       W   e   b   A   s   s   e   m   b   l   y   .   M   e   m   o   r   y   (   {   
                           "   i   n   i   t   i   a   l   "   :       I   N   I   T   I   A   L   _   M   E   M   O   R   Y       /       6   5   5   3   6   ,   
                           /   /       I   n       t   h   e   o   r   y       w   e       s   h   o   u   l   d       n   o   t       n   e   e   d       t   o       e   m   i   t       t   h   e       m   a   x   i   m   u   m       i   f       w   e       w   a   n   t       "   u   n   l   i   m   i   t   e   d   "   
                           /   /       o   r       4   G   B       o   f       m   e   m   o   r   y   ,       b   u   t       V   M   s       e   r   r   o   r       o   n       t   h   a   t       a   t   m   ,       s   e   e   
                           /   /       h   t   t   p   s   :   /   /   g   i   t   h   u   b   .   c   o   m   /   e   m   s   c   r   i   p   t   e   n   -   c   o   r   e   /   e   m   s   c   r   i   p   t   e   n   /   i   s   s   u   e   s   /   1   4   1   3   0   
                           /   /       A   n   d       i   n       t   h   e       p   t   h   r   e   a   d   s       c   a   s   e       w   e       d   e   f   i   n   i   t   e   l   y       n   e   e   d       t   o       e   m   i   t       a       m   a   x   i   m   u   m   .       S   o   
                           /   /       a   l   w   a   y   s       e   m   i   t       o   n   e   .   
                           "   m   a   x   i   m   u   m   "   :       3   2   7   6   8   ,   
                           "   s   h   a   r   e   d   "   :       t   r   u   e   
                   }   )   ;   
           }   
           u   p   d   a   t   e   M   e   m   o   r   y   V   i   e   w   s   (   )   ;   
   }   
   
   /   /       e   n   d       i   n   c   l   u   d   e   :       r   u   n   t   i   m   e   _   i   n   i   t   _   m   e   m   o   r   y   .   j   s   
   /   /       i   n   c   l   u   d   e   :       m   e   m   o   r   y   p   r   o   f   i   l   e   r   .   j   s   
   /   /       e   n   d       i   n   c   l   u   d   e   :       m   e   m   o   r   y   p   r   o   f   i   l   e   r   .   j   s   
   /   /       e   n   d       i   n   c   l   u   d   e   :       r   u   n   t   i   m   e   _   c   o   m   m   o   n   .   j   s   
   a   s   s   e   r   t   (   t   y   p   e   o   f       I   n   t   3   2   A   r   r   a   y       !   =       "   u   n   d   e   f   i   n   e   d   "       &   &       t   y   p   e   o   f       F   l   o   a   t   6   4   A   r   r   a   y       !   =   =       "   u   n   d   e   f   i   n   e   d   "       &   &       I   n   t   3   2   A   r   r   a   y   .   p   r   o   t   o   t   y   p   e   .   s   u   b   a   r   r   a   y       !   =       u   n   d   e   f   i   n   e   d       &   &       I   n   t   3   2   A   r   r   a   y   .   p   r   o   t   o   t   y   p   e   .   s   e   t       !   =       u   n   d   e   f   i   n   e   d   ,       "   J   S       e   n   g   i   n   e       d   o   e   s       n   o   t       p   r   o   v   i   d   e       f   u   l   l       t   y   p   e   d       a   r   r   a   y       s   u   p   p   o   r   t   "   )   ;   
   
   f   u   n   c   t   i   o   n       p   r   e   R   u   n   (   )       {   
           a   s   s   e   r   t   (   !   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   P   T   H   R   E   A   D   )   ;   
           /   /       P   T   h   r   e   a   d   s       r   e   u   s   e       t   h   e       r   u   n   t   i   m   e       f   r   o   m       t   h   e       m   a   i   n       t   h   r   e   a   d   .   
           i   f       (   M   o   d   u   l   e   [   "   p   r   e   R   u   n   "   ]   )       {   
                   i   f       (   t   y   p   e   o   f       M   o   d   u   l   e   [   "   p   r   e   R   u   n   "   ]       =   =       "   f   u   n   c   t   i   o   n   "   )       M   o   d   u   l   e   [   "   p   r   e   R   u   n   "   ]       =       [       M   o   d   u   l   e   [   "   p   r   e   R   u   n   "   ]       ]   ;   
                   w   h   i   l   e       (   M   o   d   u   l   e   [   "   p   r   e   R   u   n   "   ]   .   l   e   n   g   t   h   )       {   
                           a   d   d   O   n   P   r   e   R   u   n   (   M   o   d   u   l   e   [   "   p   r   e   R   u   n   "   ]   .   s   h   i   f   t   (   )   )   ;   
                   }   
           }   
           c   o   n   s   u   m   e   d   M   o   d   u   l   e   P   r   o   p   (   "   p   r   e   R   u   n   "   )   ;   
           /   /       B   e   g   i   n       A   T   P   R   E   R   U   N   S       h   o   o   k   s   
           c   a   l   l   R   u   n   t   i   m   e   C   a   l   l   b   a   c   k   s   (   o   n   P   r   e   R   u   n   s   )   ;   
   }   
   
   f   u   n   c   t   i   o   n       i   n   i   t   R   u   n   t   i   m   e   (   )       {   
           a   s   s   e   r   t   (   !   r   u   n   t   i   m   e   I   n   i   t   i   a   l   i   z   e   d   )   ;   
           r   u   n   t   i   m   e   I   n   i   t   i   a   l   i   z   e   d       =       t   r   u   e   ;   
           i   f       (   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   P   T   H   R   E   A   D   )       r   e   t   u   r   n       s   t   a   r   t   W   o   r   k   e   r   (   M   o   d   u   l   e   )   ;   
           c   h   e   c   k   S   t   a   c   k   C   o   o   k   i   e   (   )   ;   
           /   /       N   o       A   T   I   N   I   T   S       h   o   o   k   s   
           w   a   s   m   E   x   p   o   r   t   s   [   "   _   _   w   a   s   m   _   c   a   l   l   _   c   t   o   r   s   "   ]   (   )   ;   
   }   
   
   f   u   n   c   t   i   o   n       p   r   e   M   a   i   n   (   )       {   
           c   h   e   c   k   S   t   a   c   k   C   o   o   k   i   e   (   )   ;   
   }   
   
   f   u   n   c   t   i   o   n       p   o   s   t   R   u   n   (   )       {   
           c   h   e   c   k   S   t   a   c   k   C   o   o   k   i   e   (   )   ;   
           i   f       (   (   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   P   T   H   R   E   A   D   )   )       {   
                   r   e   t   u   r   n   ;   
           }   
           /   /       P   T   h   r   e   a   d   s       r   e   u   s   e       t   h   e       r   u   n   t   i   m   e       f   r   o   m       t   h   e       m   a   i   n       t   h   r   e   a   d   .   
           i   f       (   M   o   d   u   l   e   [   "   p   o   s   t   R   u   n   "   ]   )       {   
                   i   f       (   t   y   p   e   o   f       M   o   d   u   l   e   [   "   p   o   s   t   R   u   n   "   ]       =   =       "   f   u   n   c   t   i   o   n   "   )       M   o   d   u   l   e   [   "   p   o   s   t   R   u   n   "   ]       =       [       M   o   d   u   l   e   [   "   p   o   s   t   R   u   n   "   ]       ]   ;   
                   w   h   i   l   e       (   M   o   d   u   l   e   [   "   p   o   s   t   R   u   n   "   ]   .   l   e   n   g   t   h   )       {   
                           a   d   d   O   n   P   o   s   t   R   u   n   (   M   o   d   u   l   e   [   "   p   o   s   t   R   u   n   "   ]   .   s   h   i   f   t   (   )   )   ;   
                   }   
           }   
           c   o   n   s   u   m   e   d   M   o   d   u   l   e   P   r   o   p   (   "   p   o   s   t   R   u   n   "   )   ;   
           /   /       B   e   g   i   n       A   T   P   O   S   T   R   U   N   S       h   o   o   k   s   
           c   a   l   l   R   u   n   t   i   m   e   C   a   l   l   b   a   c   k   s   (   o   n   P   o   s   t   R   u   n   s   )   ;   
   }   
   
   /   /       A       c   o   u   n   t   e   r       o   f       d   e   p   e   n   d   e   n   c   i   e   s       f   o   r       c   a   l   l   i   n   g       r   u   n   (   )   .       I   f       w   e       n   e   e   d       t   o   
   /   /       d   o       a   s   y   n   c   h   r   o   n   o   u   s       w   o   r   k       b   e   f   o   r   e       r   u   n   n   i   n   g   ,       i   n   c   r   e   m   e   n   t       t   h   i   s       a   n   d   
   /   /       d   e   c   r   e   m   e   n   t       i   t   .       I   n   c   r   e   m   e   n   t   i   n   g       m   u   s   t       h   a   p   p   e   n       i   n       a       p   l   a   c   e       l   i   k   e   
   /   /       M   o   d   u   l   e   .   p   r   e   R   u   n       (   u   s   e   d       b   y       e   m   c   c       t   o       a   d   d       f   i   l   e       p   r   e   l   o   a   d   i   n   g   )   .   
   /   /       N   o   t   e       t   h   a   t       y   o   u       c   a   n       a   d   d       d   e   p   e   n   d   e   n   c   i   e   s       i   n       p   r   e   R   u   n   ,       e   v   e   n       t   h   o   u   g   h   
   /   /       i   t       h   a   p   p   e   n   s       r   i   g   h   t       b   e   f   o   r   e       r   u   n       -       r   u   n       w   i   l   l       b   e       p   o   s   t   p   o   n   e   d       u   n   t   i   l   
   /   /       t   h   e       d   e   p   e   n   d   e   n   c   i   e   s       a   r   e       m   e   t   .   
   v   a   r       r   u   n   D   e   p   e   n   d   e   n   c   i   e   s       =       0   ;   
   
   v   a   r       d   e   p   e   n   d   e   n   c   i   e   s   F   u   l   f   i   l   l   e   d       =       n   u   l   l   ;   
   
   /   /       o   v   e   r   r   i   d   d   e   n       t   o       t   a   k   e       d   i   f   f   e   r   e   n   t       a   c   t   i   o   n   s       w   h   e   n       a   l   l       r   u   n       d   e   p   e   n   d   e   n   c   i   e   s       a   r   e       f   u   l   f   i   l   l   e   d   
   v   a   r       r   u   n   D   e   p   e   n   d   e   n   c   y   T   r   a   c   k   i   n   g       =       {   }   ;   
   
   v   a   r       r   u   n   D   e   p   e   n   d   e   n   c   y   W   a   t   c   h   e   r       =       n   u   l   l   ;   
   
   f   u   n   c   t   i   o   n       a   d   d   R   u   n   D   e   p   e   n   d   e   n   c   y   (   i   d   )       {   
           r   u   n   D   e   p   e   n   d   e   n   c   i   e   s   +   +   ;   
           M   o   d   u   l   e   [   "   m   o   n   i   t   o   r   R   u   n   D   e   p   e   n   d   e   n   c   i   e   s   "   ]   ?   .   (   r   u   n   D   e   p   e   n   d   e   n   c   i   e   s   )   ;   
           i   f       (   i   d   )       {   
                   a   s   s   e   r   t   (   !   r   u   n   D   e   p   e   n   d   e   n   c   y   T   r   a   c   k   i   n   g   [   i   d   ]   )   ;   
                   r   u   n   D   e   p   e   n   d   e   n   c   y   T   r   a   c   k   i   n   g   [   i   d   ]       =       1   ;   
                   i   f       (   r   u   n   D   e   p   e   n   d   e   n   c   y   W   a   t   c   h   e   r       =   =   =       n   u   l   l       &   &       t   y   p   e   o   f       s   e   t   I   n   t   e   r   v   a   l       !   =       "   u   n   d   e   f   i   n   e   d   "   )       {   
                           /   /       C   h   e   c   k       f   o   r       m   i   s   s   i   n   g       d   e   p   e   n   d   e   n   c   i   e   s       e   v   e   r   y       f   e   w       s   e   c   o   n   d   s   
                           r   u   n   D   e   p   e   n   d   e   n   c   y   W   a   t   c   h   e   r       =       s   e   t   I   n   t   e   r   v   a   l   (   (   )       =   >       {   
                                   i   f       (   A   B   O   R   T   )       {   
                                           c   l   e   a   r   I   n   t   e   r   v   a   l   (   r   u   n   D   e   p   e   n   d   e   n   c   y   W   a   t   c   h   e   r   )   ;   
                                           r   u   n   D   e   p   e   n   d   e   n   c   y   W   a   t   c   h   e   r       =       n   u   l   l   ;   
                                           r   e   t   u   r   n   ;   
                                   }   
                                   v   a   r       s   h   o   w   n       =       f   a   l   s   e   ;   
                                   f   o   r       (   v   a   r       d   e   p       i   n       r   u   n   D   e   p   e   n   d   e   n   c   y   T   r   a   c   k   i   n   g   )       {   
                                           i   f       (   !   s   h   o   w   n   )       {   
                                                   s   h   o   w   n       =       t   r   u   e   ;   
                                                   e   r   r   (   "   s   t   i   l   l       w   a   i   t   i   n   g       o   n       r   u   n       d   e   p   e   n   d   e   n   c   i   e   s   :   "   )   ;   
                                           }   
                                           e   r   r   (   `   d   e   p   e   n   d   e   n   c   y   :       $   {   d   e   p   }   `   )   ;   
                                   }   
                                   i   f       (   s   h   o   w   n   )       {   
                                           e   r   r   (   "   (   e   n   d       o   f       l   i   s   t   )   "   )   ;   
                                   }   
                           }   ,       1   e   4   )   ;   
                   }   
           }       e   l   s   e       {   
                   e   r   r   (   "   w   a   r   n   i   n   g   :       r   u   n       d   e   p   e   n   d   e   n   c   y       a   d   d   e   d       w   i   t   h   o   u   t       I   D   "   )   ;   
           }   
   }   
   
   f   u   n   c   t   i   o   n       r   e   m   o   v   e   R   u   n   D   e   p   e   n   d   e   n   c   y   (   i   d   )       {   
           r   u   n   D   e   p   e   n   d   e   n   c   i   e   s   -   -   ;   
           M   o   d   u   l   e   [   "   m   o   n   i   t   o   r   R   u   n   D   e   p   e   n   d   e   n   c   i   e   s   "   ]   ?   .   (   r   u   n   D   e   p   e   n   d   e   n   c   i   e   s   )   ;   
           i   f       (   i   d   )       {   
                   a   s   s   e   r   t   (   r   u   n   D   e   p   e   n   d   e   n   c   y   T   r   a   c   k   i   n   g   [   i   d   ]   )   ;   
                   d   e   l   e   t   e       r   u   n   D   e   p   e   n   d   e   n   c   y   T   r   a   c   k   i   n   g   [   i   d   ]   ;   
           }       e   l   s   e       {   
                   e   r   r   (   "   w   a   r   n   i   n   g   :       r   u   n       d   e   p   e   n   d   e   n   c   y       r   e   m   o   v   e   d       w   i   t   h   o   u   t       I   D   "   )   ;   
           }   
           i   f       (   r   u   n   D   e   p   e   n   d   e   n   c   i   e   s       =   =       0   )       {   
                   i   f       (   r   u   n   D   e   p   e   n   d   e   n   c   y   W   a   t   c   h   e   r       !   =   =       n   u   l   l   )       {   
                           c   l   e   a   r   I   n   t   e   r   v   a   l   (   r   u   n   D   e   p   e   n   d   e   n   c   y   W   a   t   c   h   e   r   )   ;   
                           r   u   n   D   e   p   e   n   d   e   n   c   y   W   a   t   c   h   e   r       =       n   u   l   l   ;   
                   }   
                   i   f       (   d   e   p   e   n   d   e   n   c   i   e   s   F   u   l   f   i   l   l   e   d   )       {   
                           v   a   r       c   a   l   l   b   a   c   k       =       d   e   p   e   n   d   e   n   c   i   e   s   F   u   l   f   i   l   l   e   d   ;   
                           d   e   p   e   n   d   e   n   c   i   e   s   F   u   l   f   i   l   l   e   d       =       n   u   l   l   ;   
                           c   a   l   l   b   a   c   k   (   )   ;   
                   }   
           }   
   }   
   
   /   *   *       @   p   a   r   a   m       {   s   t   r   i   n   g   |   n   u   m   b   e   r   =   }       w   h   a   t       *   /       f   u   n   c   t   i   o   n       a   b   o   r   t   (   w   h   a   t   )       {   
           M   o   d   u   l   e   [   "   o   n   A   b   o   r   t   "   ]   ?   .   (   w   h   a   t   )   ;   
           w   h   a   t       =       "   A   b   o   r   t   e   d   (   "       +       w   h   a   t       +       "   )   "   ;   
           /   /       T   O   D   O   (   s   b   c   )   :       S   h   o   u   l   d       w   e       r   e   m   o   v   e       p   r   i   n   t   i   n   g       a   n   d       l   e   a   v   e       i   t       u   p       t   o       w   h   o   e   v   e   r   
           /   /       c   a   t   c   h   e   s       t   h   e       e   x   c   e   p   t   i   o   n   ?   
           e   r   r   (   w   h   a   t   )   ;   
           A   B   O   R   T       =       t   r   u   e   ;   
           /   /       U   s   e       a       w   a   s   m       r   u   n   t   i   m   e       e   r   r   o   r   ,       b   e   c   a   u   s   e       a       J   S       e   r   r   o   r       m   i   g   h   t       b   e       s   e   e   n       a   s       a       f   o   r   e   i   g   n   
           /   /       e   x   c   e   p   t   i   o   n   ,       w   h   i   c   h       m   e   a   n   s       w   e   '   d       r   u   n       d   e   s   t   r   u   c   t   o   r   s       o   n       i   t   .       W   e       n   e   e   d       t   h   e       e   r   r   o   r       t   o   
           /   /       s   i   m   p   l   y       m   a   k   e       t   h   e       p   r   o   g   r   a   m       s   t   o   p   .   
           /   /       F   I   X   M   E       T   h   i   s       a   p   p   r   o   a   c   h       d   o   e   s       n   o   t       w   o   r   k       i   n       W   a   s   m       E   H       b   e   c   a   u   s   e       i   t       c   u   r   r   e   n   t   l   y       d   o   e   s       n   o   t       a   s   s   u   m   e   
           /   /       a   l   l       R   u   n   t   i   m   e   E   r   r   o   r   s       a   r   e       f   r   o   m       t   r   a   p   s   ;       i   t       d   e   c   i   d   e   s       w   h   e   t   h   e   r       a       R   u   n   t   i   m   e   E   r   r   o   r       i   s       f   r   o   m   
           /   /       a       t   r   a   p       o   r       n   o   t       b   a   s   e   d       o   n       a       h   i   d   d   e   n       f   i   e   l   d       w   i   t   h   i   n       t   h   e       o   b   j   e   c   t   .       S   o       a   t       t   h   e       m   o   m   e   n   t   
           /   /       w   e       d   o   n   '   t       h   a   v   e       a       w   a   y       o   f       t   h   r   o   w   i   n   g       a       w   a   s   m       t   r   a   p       f   r   o   m       J   S   .       T   O   D   O       M   a   k   e       a       J   S       A   P   I       t   h   a   t   
           /   /       a   l   l   o   w   s       t   h   i   s       i   n       t   h   e       w   a   s   m       s   p   e   c   .   
           /   /       S   u   p   p   r   e   s   s       c   l   o   s   u   r   e       c   o   m   p   i   l   e   r       w   a   r   n   i   n   g       h   e   r   e   .       C   l   o   s   u   r   e       c   o   m   p   i   l   e   r   '   s       b   u   i   l   t   i   n       e   x   t   e   r   n   
           /   /       d   e   f   i   n   i   t   i   o   n       f   o   r       W   e   b   A   s   s   e   m   b   l   y   .   R   u   n   t   i   m   e   E   r   r   o   r       c   l   a   i   m   s       i   t       t   a   k   e   s       n   o       a   r   g   u   m   e   n   t   s       e   v   e   n   
           /   /       t   h   o   u   g   h       i   t       c   a   n   .   
           /   /       T   O   D   O   (   h   t   t   p   s   :   /   /   g   i   t   h   u   b   .   c   o   m   /   g   o   o   g   l   e   /   c   l   o   s   u   r   e   -   c   o   m   p   i   l   e   r   /   p   u   l   l   /   3   9   1   3   )   :       R   e   m   o   v   e       i   f   /   w   h   e   n       u   p   s   t   r   e   a   m       c   l   o   s   u   r   e       g   e   t   s       f   i   x   e   d   .   
           /   *   *       @   s   u   p   p   r   e   s   s       {   c   h   e   c   k   T   y   p   e   s   }       *   /       v   a   r       e       =       n   e   w       W   e   b   A   s   s   e   m   b   l   y   .   R   u   n   t   i   m   e   E   r   r   o   r   (   w   h   a   t   )   ;   
           r   e   a   d   y   P   r   o   m   i   s   e   R   e   j   e   c   t   ?   .   (   e   )   ;   
           /   /       T   h   r   o   w       t   h   e       e   r   r   o   r       w   h   e   t   h   e   r       o   r       n   o   t       M   O   D   U   L   A   R   I   Z   E       i   s       s   e   t       b   e   c   a   u   s   e       a   b   o   r   t       i   s       u   s   e   d   
           /   /       i   n       c   o   d   e       p   a   t   h   s       a   p   a   r   t       f   r   o   m       i   n   s   t   a   n   t   i   a   t   i   o   n       w   h   e   r   e       a   n       e   x   c   e   p   t   i   o   n       i   s       e   x   p   e   c   t   e   d   
           /   /       t   o       b   e       t   h   r   o   w   n       w   h   e   n       a   b   o   r   t       i   s       c   a   l   l   e   d   .   
           t   h   r   o   w       e   ;   
   }   
   
   f   u   n   c   t   i   o   n       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   n   a   m   e   ,       n   a   r   g   s   )       {   
           r   e   t   u   r   n       (   .   .   .   a   r   g   s   )       =   >       {   
                   a   s   s   e   r   t   (   r   u   n   t   i   m   e   I   n   i   t   i   a   l   i   z   e   d   ,       `   n   a   t   i   v   e       f   u   n   c   t   i   o   n       \   `   $   {   n   a   m   e   }   \   `       c   a   l   l   e   d       b   e   f   o   r   e       r   u   n   t   i   m   e       i   n   i   t   i   a   l   i   z   a   t   i   o   n   `   )   ;   
                   v   a   r       f       =       w   a   s   m   E   x   p   o   r   t   s   [   n   a   m   e   ]   ;   
                   a   s   s   e   r   t   (   f   ,       `   e   x   p   o   r   t   e   d       n   a   t   i   v   e       f   u   n   c   t   i   o   n       \   `   $   {   n   a   m   e   }   \   `       n   o   t       f   o   u   n   d   `   )   ;   
                   /   /       O   n   l   y       a   s   s   e   r   t       f   o   r       t   o   o       m   a   n   y       a   r   g   u   m   e   n   t   s   .       T   o   o       f   e   w       c   a   n       b   e       v   a   l   i   d       s   i   n   c   e       t   h   e       m   i   s   s   i   n   g       a   r   g   u   m   e   n   t   s       w   i   l   l       b   e       z   e   r   o       f   i   l   l   e   d   .   
                   a   s   s   e   r   t   (   a   r   g   s   .   l   e   n   g   t   h       <   =       n   a   r   g   s   ,       `   n   a   t   i   v   e       f   u   n   c   t   i   o   n       \   `   $   {   n   a   m   e   }   \   `       c   a   l   l   e   d       w   i   t   h       $   {   a   r   g   s   .   l   e   n   g   t   h   }       a   r   g   s       b   u   t       e   x   p   e   c   t   s       $   {   n   a   r   g   s   }   `   )   ;   
                   r   e   t   u   r   n       f   (   .   .   .   a   r   g   s   )   ;   
           }   ;   
   }   
   
   v   a   r       w   a   s   m   B   i   n   a   r   y   F   i   l   e   ;   
   
   f   u   n   c   t   i   o   n       f   i   n   d   W   a   s   m   B   i   n   a   r   y   (   )       {   
           r   e   t   u   r   n       l   o   c   a   t   e   F   i   l   e   (   "   p   r   o   j   e   c   t   m   -   v   .   0   2   1   -   t   h   r   e   a   d   .   w   a   s   m   "   )   ;   
   }   
   
   f   u   n   c   t   i   o   n       g   e   t   B   i   n   a   r   y   S   y   n   c   (   f   i   l   e   )       {   
           i   f       (   f   i   l   e       =   =       w   a   s   m   B   i   n   a   r   y   F   i   l   e       &   &       w   a   s   m   B   i   n   a   r   y   )       {   
                   r   e   t   u   r   n       n   e   w       U   i   n   t   8   A   r   r   a   y   (   w   a   s   m   B   i   n   a   r   y   )   ;   
           }   
           i   f       (   r   e   a   d   B   i   n   a   r   y   )       {   
                   r   e   t   u   r   n       r   e   a   d   B   i   n   a   r   y   (   f   i   l   e   )   ;   
           }   
           t   h   r   o   w       "   b   o   t   h       a   s   y   n   c       a   n   d       s   y   n   c       f   e   t   c   h   i   n   g       o   f       t   h   e       w   a   s   m       f   a   i   l   e   d   "   ;   
   }   
   
   a   s   y   n   c       f   u   n   c   t   i   o   n       g   e   t   W   a   s   m   B   i   n   a   r   y   (   b   i   n   a   r   y   F   i   l   e   )       {   
           /   /       I   f       w   e       d   o   n   '   t       h   a   v   e       t   h   e       b   i   n   a   r   y       y   e   t   ,       l   o   a   d       i   t       a   s   y   n   c   h   r   o   n   o   u   s   l   y       u   s   i   n   g       r   e   a   d   A   s   y   n   c   .   
           i   f       (   !   w   a   s   m   B   i   n   a   r   y   )       {   
                   /   /       F   e   t   c   h       t   h   e       b   i   n   a   r   y       u   s   i   n   g       r   e   a   d   A   s   y   n   c   
                   t   r   y       {   
                           v   a   r       r   e   s   p   o   n   s   e       =       a   w   a   i   t       r   e   a   d   A   s   y   n   c   (   b   i   n   a   r   y   F   i   l   e   )   ;   
                           r   e   t   u   r   n       n   e   w       U   i   n   t   8   A   r   r   a   y   (   r   e   s   p   o   n   s   e   )   ;   
                   }       c   a   t   c   h       {   }   
           }   
           /   /       O   t   h   e   r   w   i   s   e   ,       g   e   t   B   i   n   a   r   y   S   y   n   c       s   h   o   u   l   d       b   e       a   b   l   e       t   o       g   e   t       i   t       s   y   n   c   h   r   o   n   o   u   s   l   y   
           r   e   t   u   r   n       g   e   t   B   i   n   a   r   y   S   y   n   c   (   b   i   n   a   r   y   F   i   l   e   )   ;   
   }   
   
   a   s   y   n   c       f   u   n   c   t   i   o   n       i   n   s   t   a   n   t   i   a   t   e   A   r   r   a   y   B   u   f   f   e   r   (   b   i   n   a   r   y   F   i   l   e   ,       i   m   p   o   r   t   s   )       {   
           t   r   y       {   
                   v   a   r       b   i   n   a   r   y       =       a   w   a   i   t       g   e   t   W   a   s   m   B   i   n   a   r   y   (   b   i   n   a   r   y   F   i   l   e   )   ;   
                   v   a   r       i   n   s   t   a   n   c   e       =       a   w   a   i   t       W   e   b   A   s   s   e   m   b   l   y   .   i   n   s   t   a   n   t   i   a   t   e   (   b   i   n   a   r   y   ,       i   m   p   o   r   t   s   )   ;   
                   r   e   t   u   r   n       i   n   s   t   a   n   c   e   ;   
           }       c   a   t   c   h       (   r   e   a   s   o   n   )       {   
                   e   r   r   (   `   f   a   i   l   e   d       t   o       a   s   y   n   c   h   r   o   n   o   u   s   l   y       p   r   e   p   a   r   e       w   a   s   m   :       $   {   r   e   a   s   o   n   }   `   )   ;   
                   /   /       W   a   r   n       o   n       s   o   m   e       c   o   m   m   o   n       p   r   o   b   l   e   m   s   .   
                   i   f       (   i   s   F   i   l   e   U   R   I   (   w   a   s   m   B   i   n   a   r   y   F   i   l   e   )   )       {   
                           e   r   r   (   `   w   a   r   n   i   n   g   :       L   o   a   d   i   n   g       f   r   o   m       a       f   i   l   e       U   R   I       (   $   {   w   a   s   m   B   i   n   a   r   y   F   i   l   e   }   )       i   s       n   o   t       s   u   p   p   o   r   t   e   d       i   n       m   o   s   t       b   r   o   w   s   e   r   s   .       S   e   e       h   t   t   p   s   :   /   /   e   m   s   c   r   i   p   t   e   n   .   o   r   g   /   d   o   c   s   /   g   e   t   t   i   n   g   _   s   t   a   r   t   e   d   /   F   A   Q   .   h   t   m   l   #   h   o   w   -   d   o   -   i   -   r   u   n   -   a   -   l   o   c   a   l   -   w   e   b   s   e   r   v   e   r   -   f   o   r   -   t   e   s   t   i   n   g   -   w   h   y   -   d   o   e   s   -   m   y   -   p   r   o   g   r   a   m   -   s   t   a   l   l   -   i   n   -   d   o   w   n   l   o   a   d   i   n   g   -   o   r   -   p   r   e   p   a   r   i   n   g   `   )   ;   
                   }   
                   a   b   o   r   t   (   r   e   a   s   o   n   )   ;   
           }   
   }   
   
   a   s   y   n   c       f   u   n   c   t   i   o   n       i   n   s   t   a   n   t   i   a   t   e   A   s   y   n   c   (   b   i   n   a   r   y   ,       b   i   n   a   r   y   F   i   l   e   ,       i   m   p   o   r   t   s   )       {   
           i   f       (   !   b   i   n   a   r   y       &   &       t   y   p   e   o   f       W   e   b   A   s   s   e   m   b   l   y   .   i   n   s   t   a   n   t   i   a   t   e   S   t   r   e   a   m   i   n   g       =   =       "   f   u   n   c   t   i   o   n   "   )       {   
                   t   r   y       {   
                           v   a   r       r   e   s   p   o   n   s   e       =       f   e   t   c   h   (   b   i   n   a   r   y   F   i   l   e   ,       {   
                                   c   r   e   d   e   n   t   i   a   l   s   :       "   s   a   m   e   -   o   r   i   g   i   n   "   
                           }   )   ;   
                           v   a   r       i   n   s   t   a   n   t   i   a   t   i   o   n   R   e   s   u   l   t       =       a   w   a   i   t       W   e   b   A   s   s   e   m   b   l   y   .   i   n   s   t   a   n   t   i   a   t   e   S   t   r   e   a   m   i   n   g   (   r   e   s   p   o   n   s   e   ,       i   m   p   o   r   t   s   )   ;   
                           r   e   t   u   r   n       i   n   s   t   a   n   t   i   a   t   i   o   n   R   e   s   u   l   t   ;   
                   }       c   a   t   c   h       (   r   e   a   s   o   n   )       {   
                           /   /       W   e       e   x   p   e   c   t       t   h   e       m   o   s   t       c   o   m   m   o   n       f   a   i   l   u   r   e       c   a   u   s   e       t   o       b   e       a       b   a   d       M   I   M   E       t   y   p   e       f   o   r       t   h   e       b   i   n   a   r   y   ,   
                           /   /       i   n       w   h   i   c   h       c   a   s   e       f   a   l   l   i   n   g       b   a   c   k       t   o       A   r   r   a   y   B   u   f   f   e   r       i   n   s   t   a   n   t   i   a   t   i   o   n       s   h   o   u   l   d       w   o   r   k   .   
                           e   r   r   (   `   w   a   s   m       s   t   r   e   a   m   i   n   g       c   o   m   p   i   l   e       f   a   i   l   e   d   :       $   {   r   e   a   s   o   n   }   `   )   ;   
                           e   r   r   (   "   f   a   l   l   i   n   g       b   a   c   k       t   o       A   r   r   a   y   B   u   f   f   e   r       i   n   s   t   a   n   t   i   a   t   i   o   n   "   )   ;   
                   }   
           }   
           r   e   t   u   r   n       i   n   s   t   a   n   t   i   a   t   e   A   r   r   a   y   B   u   f   f   e   r   (   b   i   n   a   r   y   F   i   l   e   ,       i   m   p   o   r   t   s   )   ;   
   }   
   
   f   u   n   c   t   i   o   n       g   e   t   W   a   s   m   I   m   p   o   r   t   s   (   )       {   
           a   s   s   i   g   n   W   a   s   m   I   m   p   o   r   t   s   (   )   ;   
           /   /       p   r   e   p   a   r   e       i   m   p   o   r   t   s   
           r   e   t   u   r   n       {   
                   "   e   n   v   "   :       w   a   s   m   I   m   p   o   r   t   s   ,   
                   "   w   a   s   i   _   s   n   a   p   s   h   o   t   _   p   r   e   v   i   e   w   1   "   :       w   a   s   m   I   m   p   o   r   t   s   
           }   ;   
   }   
   
   /   /       C   r   e   a   t   e       t   h   e       w   a   s   m       i   n   s   t   a   n   c   e   .   
   /   /       R   e   c   e   i   v   e   s       t   h   e       w   a   s   m       i   m   p   o   r   t   s   ,       r   e   t   u   r   n   s       t   h   e       e   x   p   o   r   t   s   .   
   a   s   y   n   c       f   u   n   c   t   i   o   n       c   r   e   a   t   e   W   a   s   m   (   )       {   
           /   /       L   o   a   d       t   h   e       w   a   s   m       m   o   d   u   l   e       a   n   d       c   r   e   a   t   e       a   n       i   n   s   t   a   n   c   e       o   f       u   s   i   n   g       n   a   t   i   v   e       s   u   p   p   o   r   t       i   n       t   h   e       J   S       e   n   g   i   n   e   .   
           /   /       h   a   n   d   l   e       a       g   e   n   e   r   a   t   e   d       w   a   s   m       i   n   s   t   a   n   c   e   ,       r   e   c   e   i   v   i   n   g       i   t   s       e   x   p   o   r   t   s       a   n   d   
           /   /       p   e   r   f   o   r   m   i   n   g       o   t   h   e   r       n   e   c   e   s   s   a   r   y       s   e   t   u   p   
           /   *   *       @   p   a   r   a   m       {   W   e   b   A   s   s   e   m   b   l   y   .   M   o   d   u   l   e   =   }       m   o   d   u   l   e   *   /       f   u   n   c   t   i   o   n       r   e   c   e   i   v   e   I   n   s   t   a   n   c   e   (   i   n   s   t   a   n   c   e   ,       m   o   d   u   l   e   )       {   
                   w   a   s   m   E   x   p   o   r   t   s       =       i   n   s   t   a   n   c   e   .   e   x   p   o   r   t   s   ;   
                   r   e   g   i   s   t   e   r   T   L   S   I   n   i   t   (   w   a   s   m   E   x   p   o   r   t   s   [   "   _   e   m   s   c   r   i   p   t   e   n   _   t   l   s   _   i   n   i   t   "   ]   )   ;   
                   w   a   s   m   T   a   b   l   e       =       w   a   s   m   E   x   p   o   r   t   s   [   "   _   _   i   n   d   i   r   e   c   t   _   f   u   n   c   t   i   o   n   _   t   a   b   l   e   "   ]   ;   
                   a   s   s   e   r   t   (   w   a   s   m   T   a   b   l   e   ,       "   t   a   b   l   e       n   o   t       f   o   u   n   d       i   n       w   a   s   m       e   x   p   o   r   t   s   "   )   ;   
                   /   /       W   e       n   o   w       h   a   v   e       t   h   e       W   a   s   m       m   o   d   u   l   e       l   o   a   d   e   d       u   p   ,       k   e   e   p       a       r   e   f   e   r   e   n   c   e       t   o       t   h   e       c   o   m   p   i   l   e   d       m   o   d   u   l   e       s   o       w   e       c   a   n       p   o   s   t       i   t       t   o       t   h   e       w   o   r   k   e   r   s   .   
                   w   a   s   m   M   o   d   u   l   e       =       m   o   d   u   l   e   ;   
                   a   s   s   i   g   n   W   a   s   m   E   x   p   o   r   t   s   (   w   a   s   m   E   x   p   o   r   t   s   )   ;   
                   r   e   m   o   v   e   R   u   n   D   e   p   e   n   d   e   n   c   y   (   "   w   a   s   m   -   i   n   s   t   a   n   t   i   a   t   e   "   )   ;   
                   r   e   t   u   r   n       w   a   s   m   E   x   p   o   r   t   s   ;   
           }   
           /   /       w   a   i   t       f   o   r       t   h   e       p   t   h   r   e   a   d       p   o   o   l       (   i   f       a   n   y   )   
           a   d   d   R   u   n   D   e   p   e   n   d   e   n   c   y   (   "   w   a   s   m   -   i   n   s   t   a   n   t   i   a   t   e   "   )   ;   
           /   /       P   r   e   f   e   r       s   t   r   e   a   m   i   n   g       i   n   s   t   a   n   t   i   a   t   i   o   n       i   f       a   v   a   i   l   a   b   l   e   .   
           /   /       A   s   y   n   c       c   o   m   p   i   l   a   t   i   o   n       c   a   n       b   e       c   o   n   f   u   s   i   n   g       w   h   e   n       a   n       e   r   r   o   r       o   n       t   h   e       p   a   g   e       o   v   e   r   w   r   i   t   e   s       M   o   d   u   l   e   
           /   /       (   f   o   r       e   x   a   m   p   l   e   ,       i   f       t   h   e       o   r   d   e   r       o   f       e   l   e   m   e   n   t   s       i   s       w   r   o   n   g   ,       a   n   d       t   h   e       o   n   e       d   e   f   i   n   i   n   g       M   o   d   u   l   e       i   s   
           /   /       l   a   t   e   r   )   ,       s   o       w   e       s   a   v   e       M   o   d   u   l   e       a   n   d       c   h   e   c   k       i   t       l   a   t   e   r   .   
           v   a   r       t   r   u   e   M   o   d   u   l   e       =       M   o   d   u   l   e   ;   
           f   u   n   c   t   i   o   n       r   e   c   e   i   v   e   I   n   s   t   a   n   t   i   a   t   i   o   n   R   e   s   u   l   t   (   r   e   s   u   l   t   )       {   
                   /   /       '   r   e   s   u   l   t   '       i   s       a       R   e   s   u   l   t   O   b   j   e   c   t       o   b   j   e   c   t       w   h   i   c   h       h   a   s       b   o   t   h       t   h   e       m   o   d   u   l   e       a   n   d       i   n   s   t   a   n   c   e   .   
                   /   /       r   e   c   e   i   v   e   I   n   s   t   a   n   c   e   (   )       w   i   l   l       s   w   a   p       i   n       t   h   e       e   x   p   o   r   t   s       (   t   o       M   o   d   u   l   e   .   a   s   m   )       s   o       t   h   e   y       c   a   n       b   e       c   a   l   l   e   d   
                   a   s   s   e   r   t   (   M   o   d   u   l   e       =   =   =       t   r   u   e   M   o   d   u   l   e   ,       "   t   h   e       M   o   d   u   l   e       o   b   j   e   c   t       s   h   o   u   l   d       n   o   t       b   e       r   e   p   l   a   c   e   d       d   u   r   i   n   g       a   s   y   n   c       c   o   m   p   i   l   a   t   i   o   n       -       p   e   r   h   a   p   s       t   h   e       o   r   d   e   r       o   f       H   T   M   L       e   l   e   m   e   n   t   s       i   s       w   r   o   n   g   ?   "   )   ;   
                   t   r   u   e   M   o   d   u   l   e       =       n   u   l   l   ;   
                   r   e   t   u   r   n       r   e   c   e   i   v   e   I   n   s   t   a   n   c   e   (   r   e   s   u   l   t   [   "   i   n   s   t   a   n   c   e   "   ]   ,       r   e   s   u   l   t   [   "   m   o   d   u   l   e   "   ]   )   ;   
           }   
           v   a   r       i   n   f   o       =       g   e   t   W   a   s   m   I   m   p   o   r   t   s   (   )   ;   
           /   /       U   s   e   r       s   h   e   l   l       p   a   g   e   s       c   a   n       w   r   i   t   e       t   h   e   i   r       o   w   n       M   o   d   u   l   e   .   i   n   s   t   a   n   t   i   a   t   e   W   a   s   m       =       f   u   n   c   t   i   o   n   (   i   m   p   o   r   t   s   ,       s   u   c   c   e   s   s   C   a   l   l   b   a   c   k   )       c   a   l   l   b   a   c   k   
           /   /       t   o       m   a   n   u   a   l   l   y       i   n   s   t   a   n   t   i   a   t   e       t   h   e       W   a   s   m       m   o   d   u   l   e       t   h   e   m   s   e   l   v   e   s   .       T   h   i   s       a   l   l   o   w   s       p   a   g   e   s       t   o   
           /   /       r   u   n       t   h   e       i   n   s   t   a   n   t   i   a   t   i   o   n       p   a   r   a   l   l   e   l       t   o       a   n   y       o   t   h   e   r       a   s   y   n   c       s   t   a   r   t   u   p       a   c   t   i   o   n   s       t   h   e   y       a   r   e   
           /   /       p   e   r   f   o   r   m   i   n   g   .   
           /   /       A   l   s   o       p   t   h   r   e   a   d   s       a   n   d       w   a   s   m       w   o   r   k   e   r   s       i   n   i   t   i   a   l   i   z   e       t   h   e       w   a   s   m       i   n   s   t   a   n   c   e       t   h   r   o   u   g   h       t   h   i   s   
           /   /       p   a   t   h   .   
           i   f       (   M   o   d   u   l   e   [   "   i   n   s   t   a   n   t   i   a   t   e   W   a   s   m   "   ]   )       {   
                   r   e   t   u   r   n       n   e   w       P   r   o   m   i   s   e   (   (   r   e   s   o   l   v   e   ,       r   e   j   e   c   t   )       =   >       {   
                           t   r   y       {   
                                   M   o   d   u   l   e   [   "   i   n   s   t   a   n   t   i   a   t   e   W   a   s   m   "   ]   (   i   n   f   o   ,       (   m   o   d   ,       i   n   s   t   )       =   >       {   
                                           r   e   s   o   l   v   e   (   r   e   c   e   i   v   e   I   n   s   t   a   n   c   e   (   m   o   d   ,       i   n   s   t   )   )   ;   
                                   }   )   ;   
                           }       c   a   t   c   h       (   e   )       {   
                                   e   r   r   (   `   M   o   d   u   l   e   .   i   n   s   t   a   n   t   i   a   t   e   W   a   s   m       c   a   l   l   b   a   c   k       f   a   i   l   e   d       w   i   t   h       e   r   r   o   r   :       $   {   e   }   `   )   ;   
                                   r   e   j   e   c   t   (   e   )   ;   
                           }   
                   }   )   ;   
           }   
           i   f       (   (   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   P   T   H   R   E   A   D   )   )       {   
                   r   e   t   u   r   n       n   e   w       P   r   o   m   i   s   e   (   r   e   s   o   l   v   e       =   >       {   
                           w   a   s   m   M   o   d   u   l   e   R   e   c   e   i   v   e   d       =       m   o   d   u   l   e       =   >       {   
                                   /   /       I   n   s   t   a   n   t   i   a   t   e       f   r   o   m       t   h   e       m   o   d   u   l   e       p   o   s   t   e   d       f   r   o   m       t   h   e       m   a   i   n       t   h   r   e   a   d   .   
                                   /   /       W   e       c   a   n       j   u   s   t       u   s   e       s   y   n   c       i   n   s   t   a   n   t   i   a   t   i   o   n       i   n       t   h   e       w   o   r   k   e   r   .   
                                   v   a   r       i   n   s   t   a   n   c   e       =       n   e   w       W   e   b   A   s   s   e   m   b   l   y   .   I   n   s   t   a   n   c   e   (   m   o   d   u   l   e   ,       g   e   t   W   a   s   m   I   m   p   o   r   t   s   (   )   )   ;   
                                   r   e   s   o   l   v   e   (   r   e   c   e   i   v   e   I   n   s   t   a   n   c   e   (   i   n   s   t   a   n   c   e   ,       m   o   d   u   l   e   )   )   ;   
                           }   ;   
                   }   )   ;   
           }   
           w   a   s   m   B   i   n   a   r   y   F   i   l   e       ?   ?   =       f   i   n   d   W   a   s   m   B   i   n   a   r   y   (   )   ;   
           v   a   r       r   e   s   u   l   t       =       a   w   a   i   t       i   n   s   t   a   n   t   i   a   t   e   A   s   y   n   c   (   w   a   s   m   B   i   n   a   r   y   ,       w   a   s   m   B   i   n   a   r   y   F   i   l   e   ,       i   n   f   o   )   ;   
           v   a   r       e   x   p   o   r   t   s       =       r   e   c   e   i   v   e   I   n   s   t   a   n   t   i   a   t   i   o   n   R   e   s   u   l   t   (   r   e   s   u   l   t   )   ;   
           r   e   t   u   r   n       e   x   p   o   r   t   s   ;   
   }   
   
   /   /       e   n   d       i   n   c   l   u   d   e   :       p   r   e   a   m   b   l   e   .   j   s   
   /   /       B   e   g   i   n       J   S       l   i   b   r   a   r   y       c   o   d   e   
   c   l   a   s   s       E   x   i   t   S   t   a   t   u   s       {   
           n   a   m   e   =   "   E   x   i   t   S   t   a   t   u   s   "   ;   
           c   o   n   s   t   r   u   c   t   o   r   (   s   t   a   t   u   s   )       {   
                   t   h   i   s   .   m   e   s   s   a   g   e       =       `   P   r   o   g   r   a   m       t   e   r   m   i   n   a   t   e   d       w   i   t   h       e   x   i   t   (   $   {   s   t   a   t   u   s   }   )   `   ;   
                   t   h   i   s   .   s   t   a   t   u   s       =       s   t   a   t   u   s   ;   
           }   
   }   
   
   v   a   r       t   e   r   m   i   n   a   t   e   W   o   r   k   e   r       =       w   o   r   k   e   r       =   >       {   
           w   o   r   k   e   r   .   t   e   r   m   i   n   a   t   e   (   )   ;   
           /   /       t   e   r   m   i   n   a   t   e   (   )       c   a   n       b   e       a   s   y   n   c   h   r   o   n   o   u   s   ,       s   o       i   n       t   h   e   o   r   y       t   h   e       w   o   r   k   e   r       c   a   n       c   o   n   t   i   n   u   e   
           /   /       t   o       r   u   n       f   o   r       s   o   m   e       a   m   o   u   n   t       o   f       t   i   m   e       a   f   t   e   r       t   e   r   m   i   n   a   t   i   o   n   .           H   o   w   e   v   e   r       f   r   o   m       o   u   r       P   O   V   
           /   /       t   h   e       w   o   r   k   e   r       n   o   w       d   e   a   d       a   n   d       w   e       d   o   n   '   t       w   a   n   t       t   o       h   e   a   r       f   r   o   m       i   t       a   g   a   i   n   ,       s   o       w   e       s   t   u   b   
           /   /       o   u   t       i   t   s       m   e   s   s   a   g   e       h   a   n   d   l   e   r       h   e   r   e   .           T   h   i   s       a   v   o   i   d   s       h   a   v   i   n   g       t   o       c   h   e   c   k       i   n       e   a   c   h       o   f   
           /   /       t   h   e       o   n   m   e   s   s   a   g   e       h   a   n   d   l   e   r   s       i   f       t   h   e       m   e   s   s   a   g   e       w   a   s       c   o   m   i   n   g       f   r   o   m       v   a   l   i   d       w   o   r   k   e   r   .   
           w   o   r   k   e   r   .   o   n   m   e   s   s   a   g   e       =       e       =   >       {   
                   v   a   r       c   m   d       =       e   [   "   d   a   t   a   "   ]   .   c   m   d   ;   
                   e   r   r   (   `   r   e   c   e   i   v   e   d       "   $   {   c   m   d   }   "       c   o   m   m   a   n   d       f   r   o   m       t   e   r   m   i   n   a   t   e   d       w   o   r   k   e   r   :       $   {   w   o   r   k   e   r   .   w   o   r   k   e   r   I   D   }   `   )   ;   
           }   ;   
   }   ;   
   
   v   a   r       c   l   e   a   n   u   p   T   h   r   e   a   d       =       p   t   h   r   e   a   d   _   p   t   r       =   >       {   
           a   s   s   e   r   t   (   !   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   P   T   H   R   E   A   D   ,       "   I   n   t   e   r   n   a   l       E   r   r   o   r   !       c   l   e   a   n   u   p   T   h   r   e   a   d   (   )       c   a   n       o   n   l   y       e   v   e   r       b   e       c   a   l   l   e   d       f   r   o   m       m   a   i   n       a   p   p   l   i   c   a   t   i   o   n       t   h   r   e   a   d   !   "   )   ;   
           a   s   s   e   r   t   (   p   t   h   r   e   a   d   _   p   t   r   ,       "   I   n   t   e   r   n   a   l       E   r   r   o   r   !       N   u   l   l       p   t   h   r   e   a   d   _   p   t   r       i   n       c   l   e   a   n   u   p   T   h   r   e   a   d   !   "   )   ;   
           v   a   r       w   o   r   k   e   r       =       P   T   h   r   e   a   d   .   p   t   h   r   e   a   d   s   [   p   t   h   r   e   a   d   _   p   t   r   ]   ;   
           a   s   s   e   r   t   (   w   o   r   k   e   r   )   ;   
           P   T   h   r   e   a   d   .   r   e   t   u   r   n   W   o   r   k   e   r   T   o   P   o   o   l   (   w   o   r   k   e   r   )   ;   
   }   ;   
   
   v   a   r       c   a   l   l   R   u   n   t   i   m   e   C   a   l   l   b   a   c   k   s       =       c   a   l   l   b   a   c   k   s       =   >       {   
           w   h   i   l   e       (   c   a   l   l   b   a   c   k   s   .   l   e   n   g   t   h       >       0   )       {   
                   /   /       P   a   s   s       t   h   e       m   o   d   u   l   e       a   s       t   h   e       f   i   r   s   t       a   r   g   u   m   e   n   t   .   
                   c   a   l   l   b   a   c   k   s   .   s   h   i   f   t   (   )   (   M   o   d   u   l   e   )   ;   
           }   
   }   ;   
   
   v   a   r       o   n   P   r   e   R   u   n   s       =       [   ]   ;   
   
   v   a   r       a   d   d   O   n   P   r   e   R   u   n       =       c   b       =   >       o   n   P   r   e   R   u   n   s   .   p   u   s   h   (   c   b   )   ;   
   
   v   a   r       s   p   a   w   n   T   h   r   e   a   d       =       t   h   r   e   a   d   P   a   r   a   m   s       =   >       {   
           a   s   s   e   r   t   (   !   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   P   T   H   R   E   A   D   ,       "   I   n   t   e   r   n   a   l       E   r   r   o   r   !       s   p   a   w   n   T   h   r   e   a   d   (   )       c   a   n       o   n   l   y       e   v   e   r       b   e       c   a   l   l   e   d       f   r   o   m       m   a   i   n       a   p   p   l   i   c   a   t   i   o   n       t   h   r   e   a   d   !   "   )   ;   
           a   s   s   e   r   t   (   t   h   r   e   a   d   P   a   r   a   m   s   .   p   t   h   r   e   a   d   _   p   t   r   ,       "   I   n   t   e   r   n   a   l       e   r   r   o   r   ,       n   o       p   t   h   r   e   a   d       p   t   r   !   "   )   ;   
           v   a   r       w   o   r   k   e   r       =       P   T   h   r   e   a   d   .   g   e   t   N   e   w   W   o   r   k   e   r   (   )   ;   
           i   f       (   !   w   o   r   k   e   r   )       {   
                   /   /       N   o       a   v   a   i   l   a   b   l   e       w   o   r   k   e   r   s       i   n       t   h   e       P   T   h   r   e   a   d       p   o   o   l   .   
                   r   e   t   u   r   n       6   ;   
           }   
           a   s   s   e   r   t   (   !   w   o   r   k   e   r   .   p   t   h   r   e   a   d   _   p   t   r   ,       "   I   n   t   e   r   n   a   l       e   r   r   o   r   !   "   )   ;   
           P   T   h   r   e   a   d   .   r   u   n   n   i   n   g   W   o   r   k   e   r   s   .   p   u   s   h   (   w   o   r   k   e   r   )   ;   
           /   /       A   d   d       t   o       p   t   h   r   e   a   d   s       m   a   p   
           P   T   h   r   e   a   d   .   p   t   h   r   e   a   d   s   [   t   h   r   e   a   d   P   a   r   a   m   s   .   p   t   h   r   e   a   d   _   p   t   r   ]       =       w   o   r   k   e   r   ;   
           w   o   r   k   e   r   .   p   t   h   r   e   a   d   _   p   t   r       =       t   h   r   e   a   d   P   a   r   a   m   s   .   p   t   h   r   e   a   d   _   p   t   r   ;   
           v   a   r       m   s   g       =       {   
                   c   m   d   :       "   r   u   n   "   ,   
                   s   t   a   r   t   _   r   o   u   t   i   n   e   :       t   h   r   e   a   d   P   a   r   a   m   s   .   s   t   a   r   t   R   o   u   t   i   n   e   ,   
                   a   r   g   :       t   h   r   e   a   d   P   a   r   a   m   s   .   a   r   g   ,   
                   p   t   h   r   e   a   d   _   p   t   r   :       t   h   r   e   a   d   P   a   r   a   m   s   .   p   t   h   r   e   a   d   _   p   t   r   
           }   ;   
           /   /       A   s   k       t   h   e       w   o   r   k   e   r       t   o       s   t   a   r   t       e   x   e   c   u   t   i   n   g       i   t   s       p   t   h   r   e   a   d       e   n   t   r   y       p   o   i   n   t       f   u   n   c   t   i   o   n   .   
           w   o   r   k   e   r   .   p   o   s   t   M   e   s   s   a   g   e   (   m   s   g   ,       t   h   r   e   a   d   P   a   r   a   m   s   .   t   r   a   n   s   f   e   r   L   i   s   t   )   ;   
           r   e   t   u   r   n       0   ;   
   }   ;   
   
   v   a   r       r   u   n   t   i   m   e   K   e   e   p   a   l   i   v   e   C   o   u   n   t   e   r       =       0   ;   
   
   v   a   r       k   e   e   p   R   u   n   t   i   m   e   A   l   i   v   e       =       (   )       =   >       n   o   E   x   i   t   R   u   n   t   i   m   e       |   |       r   u   n   t   i   m   e   K   e   e   p   a   l   i   v   e   C   o   u   n   t   e   r       >       0   ;   
   
   v   a   r       s   t   a   c   k   S   a   v   e       =       (   )       =   >       _   e   m   s   c   r   i   p   t   e   n   _   s   t   a   c   k   _   g   e   t   _   c   u   r   r   e   n   t   (   )   ;   
   
   v   a   r       s   t   a   c   k   R   e   s   t   o   r   e       =       v   a   l       =   >       _   _   e   m   s   c   r   i   p   t   e   n   _   s   t   a   c   k   _   r   e   s   t   o   r   e   (   v   a   l   )   ;   
   
   v   a   r       s   t   a   c   k   A   l   l   o   c       =       s   z       =   >       _   _   e   m   s   c   r   i   p   t   e   n   _   s   t   a   c   k   _   a   l   l   o   c   (   s   z   )   ;   
   
   /   *   *       @   t   y   p   e   {   f   u   n   c   t   i   o   n   (   n   u   m   b   e   r   ,       (   n   u   m   b   e   r   |   b   o   o   l   e   a   n   )   ,       .   .   .   n   u   m   b   e   r   )   }       *   /       v   a   r       p   r   o   x   y   T   o   M   a   i   n   T   h   r   e   a   d       =       (   f   u   n   c   I   n   d   e   x   ,       e   m   A   s   m   A   d   d   r   ,       s   y   n   c   ,       .   .   .   c   a   l   l   A   r   g   s   )       =   >       {   
           /   /       E   M   _   A   S   M       p   r   o   x   y   i   n   g       i   s       d   o   n   e       b   y       p   a   s   s   i   n   g       a       p   o   i   n   t   e   r       t   o       t   h   e       a   d   d   r   e   s   s       o   f       t   h   e       E   M   _   A   S   M   
           /   /       c   o   n   t   e   n   t       a   s       `   e   m   A   s   m   A   d   d   r   `   .           J   S       l   i   b   r   a   r   y       p   r   o   x   y   i   n   g       i   s       d   o   n   e       b   y       p   a   s   s   i   n   g       a   n       i   n   d   e   x   
           /   /       i   n   t   o       `   p   r   o   x   i   e   d   J   S   C   a   l   l   A   r   g   s   `       a   s       `   f   u   n   c   I   n   d   e   x   `   .       I   f       `   e   m   A   s   m   A   d   d   r   `       i   s       n   o   n   -   z   e   r   o       t   h   e   n   
           /   /       `   f   u   n   c   I   n   d   e   x   `       w   i   l   l       b   e       i   g   n   o   r   e   d   .   
           /   /       A   d   d   i   t   i   o   n   a   l       a   r   g   u   m   e   n   t   s       a   r   e       p   a   s   s   e   d       a   f   t   e   r       t   h   e       f   i   r   s   t       t   h   r   e   e       a   r   e       t   h   e       a   c   t   u   a   l   
           /   /       f   u   n   c   t   i   o   n       a   r   g   u   m   e   n   t   s   .   
           /   /       T   h   e       s   e   r   i   a   l   i   z   a   t   i   o   n       b   u   f   f   e   r       c   o   n   t   a   i   n   s       t   h   e       n   u   m   b   e   r       o   f       c   a   l   l       p   a   r   a   m   s   ,       a   n   d       t   h   e   n   
           /   /       a   l   l       t   h   e       a   r   g   s       h   e   r   e   .   
           /   /       W   e       a   l   s   o       p   a   s   s       '   s   y   n   c   '       t   o       C       s   e   p   a   r   a   t   e   l   y   ,       s   i   n   c   e       C       n   e   e   d   s       t   o       l   o   o   k       a   t       i   t   .   
           /   /       A   l   l   o   c   a   t   e       a       b   u   f   f   e   r   ,       w   h   i   c   h       w   i   l   l       b   e       c   o   p   i   e   d       b   y       t   h   e       C       c   o   d   e   .   
           /   /       F   i   r   s   t       p   a   s   s   e   d       p   a   r   a   m   e   t   e   r       s   p   e   c   i   f   i   e   s       t   h   e       n   u   m   b   e   r       o   f       a   r   g   u   m   e   n   t   s       t   o       t   h   e       f   u   n   c   t   i   o   n   .   
           /   /       W   h   e   n       B   i   g   I   n   t       s   u   p   p   o   r   t       i   s       e   n   a   b   l   e   d   ,       w   e       m   u   s   t       h   a   n   d   l   e       t   y   p   e   s       i   n       a       m   o   r   e       c   o   m   p   l   e   x   
           /   /       w   a   y   ,       d   e   t   e   c   t   i   n   g       a   t       r   u   n   t   i   m   e       i   f       a       v   a   l   u   e       i   s       a       B   i   g   I   n   t       o   r       n   o   t       (   a   s       w   e       h   a   v   e       n   o   
           /   /       t   y   p   e       i   n   f   o       h   e   r   e   )   .       T   o       d   o       t   h   a   t   ,       a   d   d       a       "   p   r   e   f   i   x   "       b   e   f   o   r   e       e   a   c   h       v   a   l   u   e       t   h   a   t   
           /   /       i   n   d   i   c   a   t   e   s       i   f       i   t       i   s       a       B   i   g   I   n   t   ,       w   h   i   c   h       e   f   f   e   c   t   i   v   e   l   y       d   o   u   b   l   e   s       t   h   e       n   u   m   b   e   r       o   f   
           /   /       v   a   l   u   e   s       w   e       s   e   r   i   a   l   i   z   e       f   o   r       p   r   o   x   y   i   n   g   .       T   O   D   O   :       p   a   c   k       t   h   i   s   ?   
           v   a   r       s   e   r   i   a   l   i   z   e   d   N   u   m   C   a   l   l   A   r   g   s       =       c   a   l   l   A   r   g   s   .   l   e   n   g   t   h       *       2   ;   
           v   a   r       s   p       =       s   t   a   c   k   S   a   v   e   (   )   ;   
           v   a   r       a   r   g   s       =       s   t   a   c   k   A   l   l   o   c   (   s   e   r   i   a   l   i   z   e   d   N   u   m   C   a   l   l   A   r   g   s       *       8   )   ;   
           v   a   r       b       =       (   (   a   r   g   s   )       >   >       3   )   ;   
           f   o   r       (   v   a   r       i       =       0   ;       i       <       c   a   l   l   A   r   g   s   .   l   e   n   g   t   h   ;       i   +   +   )       {   
                   v   a   r       a   r   g       =       c   a   l   l   A   r   g   s   [   i   ]   ;   
                   i   f       (   t   y   p   e   o   f       a   r   g       =   =       "   b   i   g   i   n   t   "   )       {   
                           /   /       T   h   e       p   r   e   f   i   x       i   s       n   o   n   -   z   e   r   o       t   o       i   n   d   i   c   a   t   e       a       b   i   g   i   n   t   .   
                           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   6   4   )   [   b       +       2       *       i   ]       =       1   n   ;   
                           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   6   4   )   [   b       +       2       *       i       +       1   ]       =       a   r   g   ;   
                   }       e   l   s   e       {   
                           /   /       T   h   e       p   r   e   f   i   x       i   s       z   e   r   o       t   o       i   n   d   i   c   a   t   e       a       J   S       N   u   m   b   e   r   .   
                           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   6   4   )   [   b       +       2       *       i   ]       =       0   n   ;   
                           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   F   6   4   )   [   b       +       2       *       i       +       1   ]       =       a   r   g   ;   
                   }   
           }   
           v   a   r       r   t   n       =       _   _   e   m   s   c   r   i   p   t   e   n   _   r   u   n   _   o   n   _   m   a   i   n   _   t   h   r   e   a   d   _   j   s   (   f   u   n   c   I   n   d   e   x   ,       e   m   A   s   m   A   d   d   r   ,       s   e   r   i   a   l   i   z   e   d   N   u   m   C   a   l   l   A   r   g   s   ,       a   r   g   s   ,       s   y   n   c   )   ;   
           s   t   a   c   k   R   e   s   t   o   r   e   (   s   p   )   ;   
           r   e   t   u   r   n       r   t   n   ;   
   }   ;   
   
   f   u   n   c   t   i   o   n       _   p   r   o   c   _   e   x   i   t   (   c   o   d   e   )       {   
           i   f       (   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   P   T   H   R   E   A   D   )       r   e   t   u   r   n       p   r   o   x   y   T   o   M   a   i   n   T   h   r   e   a   d   (   0   ,       0   ,       1   ,       c   o   d   e   )   ;   
           E   X   I   T   S   T   A   T   U   S       =       c   o   d   e   ;   
           i   f       (   !   k   e   e   p   R   u   n   t   i   m   e   A   l   i   v   e   (   )   )       {   
                   P   T   h   r   e   a   d   .   t   e   r   m   i   n   a   t   e   A   l   l   T   h   r   e   a   d   s   (   )   ;   
                   M   o   d   u   l   e   [   "   o   n   E   x   i   t   "   ]   ?   .   (   c   o   d   e   )   ;   
                   A   B   O   R   T       =       t   r   u   e   ;   
           }   
           q   u   i   t   _   (   c   o   d   e   ,       n   e   w       E   x   i   t   S   t   a   t   u   s   (   c   o   d   e   )   )   ;   
   }   
   
   f   u   n   c   t   i   o   n       e   x   i   t   O   n   M   a   i   n   T   h   r   e   a   d   (   r   e   t   u   r   n   C   o   d   e   )       {   
           i   f       (   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   P   T   H   R   E   A   D   )       r   e   t   u   r   n       p   r   o   x   y   T   o   M   a   i   n   T   h   r   e   a   d   (   1   ,       0   ,       0   ,       r   e   t   u   r   n   C   o   d   e   )   ;   
           _   e   x   i   t   (   r   e   t   u   r   n   C   o   d   e   )   ;   
   }   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       /   *   *       @   p   a   r   a   m       {   b   o   o   l   e   a   n   |   n   u   m   b   e   r   =   }       i   m   p   l   i   c   i   t       *   /       v   a   r       e   x   i   t   J   S       =       (   s   t   a   t   u   s   ,       i   m   p   l   i   c   i   t   )       =   >       {   
           E   X   I   T   S   T   A   T   U   S       =       s   t   a   t   u   s   ;   
           c   h   e   c   k   U   n   f   l   u   s   h   e   d   C   o   n   t   e   n   t   (   )   ;   
           i   f       (   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   P   T   H   R   E   A   D   )       {   
                   /   /       i   m   p   l   i   c   i   t       e   x   i   t       c   a   n       n   e   v   e   r       h   a   p   p   e   n       o   n       a       p   t   h   r   e   a   d   
                   a   s   s   e   r   t   (   !   i   m   p   l   i   c   i   t   )   ;   
                   /   /       W   h   e   n       r   u   n   n   i   n   g       i   n       a       p   t   h   r   e   a   d       w   e       p   r   o   p   a   g   a   t   e       t   h   e       e   x   i   t       b   a   c   k       t   o       t   h   e       m   a   i   n       t   h   r   e   a   d   
                   /   /       w   h   e   r   e       i   t       c   a   n       d   e   c   i   d   e       i   f       t   h   e       w   h   o   l   e       p   r   o   c   e   s   s       s   h   o   u   l   d       b   e       s   h   u   t       d   o   w   n       o   r       n   o   t   .   
                   /   /       T   h   e       p   t   h   r   e   a   d       m   a   y       h   a   v   e       d   e   c   i   d   e   d       n   o   t       t   o       e   x   i   t       i   t   s       o   w   n       r   u   n   t   i   m   e   ,       f   o   r       e   x   a   m   p   l   e   
                   /   /       b   e   c   a   u   s   e       i   t       r   u   n   s       a       m   a   i   n       l   o   o   p   ,       b   u   t       t   h   a   t       d   o   e   s   n   '   t       a   f   f   e   c   t       t   h   e       m   a   i   n       t   h   r   e   a   d   .   
                   e   x   i   t   O   n   M   a   i   n   T   h   r   e   a   d   (   s   t   a   t   u   s   )   ;   
                   t   h   r   o   w       "   u   n   w   i   n   d   "   ;   
           }   
           /   /       i   f       e   x   i   t   (   )       w   a   s       c   a   l   l   e   d       e   x   p   l   i   c   i   t   l   y   ,       w   a   r   n       t   h   e       u   s   e   r       i   f       t   h   e       r   u   n   t   i   m   e       i   s   n   '   t       a   c   t   u   a   l   l   y       b   e   i   n   g       s   h   u   t       d   o   w   n   
           i   f       (   k   e   e   p   R   u   n   t   i   m   e   A   l   i   v   e   (   )       &   &       !   i   m   p   l   i   c   i   t   )       {   
                   v   a   r       m   s   g       =       `   p   r   o   g   r   a   m       e   x   i   t   e   d       (   w   i   t   h       s   t   a   t   u   s   :       $   {   s   t   a   t   u   s   }   )   ,       b   u   t       k   e   e   p   R   u   n   t   i   m   e   A   l   i   v   e   (   )       i   s       s   e   t       (   c   o   u   n   t   e   r   =   $   {   r   u   n   t   i   m   e   K   e   e   p   a   l   i   v   e   C   o   u   n   t   e   r   }   )       d   u   e       t   o       a   n       a   s   y   n   c       o   p   e   r   a   t   i   o   n   ,       s   o       h   a   l   t   i   n   g       e   x   e   c   u   t   i   o   n       b   u   t       n   o   t       e   x   i   t   i   n   g       t   h   e       r   u   n   t   i   m   e       o   r       p   r   e   v   e   n   t   i   n   g       f   u   r   t   h   e   r       a   s   y   n   c       e   x   e   c   u   t   i   o   n       (   y   o   u       c   a   n       u   s   e       e   m   s   c   r   i   p   t   e   n   _   f   o   r   c   e   _   e   x   i   t   ,       i   f       y   o   u       w   a   n   t       t   o       f   o   r   c   e       a       t   r   u   e       s   h   u   t   d   o   w   n   )   `   ;   
                   r   e   a   d   y   P   r   o   m   i   s   e   R   e   j   e   c   t   ?   .   (   m   s   g   )   ;   
                   e   r   r   (   m   s   g   )   ;   
           }   
           _   p   r   o   c   _   e   x   i   t   (   s   t   a   t   u   s   )   ;   
   }   ;   
   
   v   a   r       _   e   x   i   t       =       e   x   i   t   J   S   ;   
   
   v   a   r       p   t   r   T   o   S   t   r   i   n   g       =       p   t   r       =   >       {   
           a   s   s   e   r   t   (   t   y   p   e   o   f       p   t   r       =   =   =       "   n   u   m   b   e   r   "   )   ;   
           /   /       W   i   t   h       C   A   N   _   A   D   D   R   E   S   S   _   2   G   B       o   r       M   E   M   O   R   Y   6   4   ,       p   o   i   n   t   e   r   s       a   r   e       a   l   r   e   a   d   y       u   n   s   i   g   n   e   d   .   
           p   t   r       >   >   >   =       0   ;   
           r   e   t   u   r   n       "   0   x   "       +       p   t   r   .   t   o   S   t   r   i   n   g   (   1   6   )   .   p   a   d   S   t   a   r   t   (   8   ,       "   0   "   )   ;   
   }   ;   
   
   v   a   r       P   T   h   r   e   a   d       =       {   
           u   n   u   s   e   d   W   o   r   k   e   r   s   :       [   ]   ,   
           r   u   n   n   i   n   g   W   o   r   k   e   r   s   :       [   ]   ,   
           t   l   s   I   n   i   t   F   u   n   c   t   i   o   n   s   :       [   ]   ,   
           p   t   h   r   e   a   d   s   :       {   }   ,   
           n   e   x   t   W   o   r   k   e   r   I   D   :       1   ,   
           i   n   i   t   (   )       {   
                   i   f       (   (   !   (   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   P   T   H   R   E   A   D   )   )   )       {   
                           P   T   h   r   e   a   d   .   i   n   i   t   M   a   i   n   T   h   r   e   a   d   (   )   ;   
                   }   
           }   ,   
           i   n   i   t   M   a   i   n   T   h   r   e   a   d   (   )       {   
                   /   /       M   I   N   I   M   A   L   _   R   U   N   T   I   M   E       t   a   k   e   s       c   a   r   e       o   f       c   a   l   l   i   n   g       l   o   a   d   W   a   s   m   M   o   d   u   l   e   T   o   A   l   l   W   o   r   k   e   r   s   
                   /   /       i   n       p   o   s   t   a   m   b   l   e   _   m   i   n   i   m   a   l   .   j   s   
                   a   d   d   O   n   P   r   e   R   u   n   (   (   )       =   >       {   
                           a   d   d   R   u   n   D   e   p   e   n   d   e   n   c   y   (   "   l   o   a   d   i   n   g   -   w   o   r   k   e   r   s   "   )   ;   
                           P   T   h   r   e   a   d   .   l   o   a   d   W   a   s   m   M   o   d   u   l   e   T   o   A   l   l   W   o   r   k   e   r   s   (   (   )       =   >       r   e   m   o   v   e   R   u   n   D   e   p   e   n   d   e   n   c   y   (   "   l   o   a   d   i   n   g   -   w   o   r   k   e   r   s   "   )   )   ;   
                   }   )   ;   
           }   ,   
           t   e   r   m   i   n   a   t   e   A   l   l   T   h   r   e   a   d   s   :       (   )       =   >       {   
                   a   s   s   e   r   t   (   !   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   P   T   H   R   E   A   D   ,       "   I   n   t   e   r   n   a   l       E   r   r   o   r   !       t   e   r   m   i   n   a   t   e   A   l   l   T   h   r   e   a   d   s   (   )       c   a   n       o   n   l   y       e   v   e   r       b   e       c   a   l   l   e   d       f   r   o   m       m   a   i   n       a   p   p   l   i   c   a   t   i   o   n       t   h   r   e   a   d   !   "   )   ;   
                   /   /       A   t   t   e   m   p   t       t   o       k   i   l   l       a   l   l       w   o   r   k   e   r   s   .           S   a   d   l   y       (   a   t       l   e   a   s   t       o   n       t   h   e       w   e   b   )       t   h   e   r   e       i   s       n   o   
                   /   /       w   a   y       t   o       t   e   r   m   i   n   a   t   e       a       w   o   r   k   e   r       s   y   n   c   h   r   o   n   o   u   s   l   y   ,       o   r       t   o       b   e       n   o   t   i   f   i   e   d       w   h   e   n       a   
                   /   /       w   o   r   k   e   r       i   n       a   c   t   u   a   l   l   y       t   e   r   m   i   n   a   t   e   d   .           T   h   i   s       m   e   a   n   s       t   h   e   r   e       i   s       s   o   m   e       r   i   s   k       t   h   a   t   
                   /   /       p   t   h   r   e   a   d   s       w   i   l   l       c   o   n   t   i   n   u   e       t   o       b   e       e   x   e   c   u   t   i   n   g       a   f   t   e   r       `   w   o   r   k   e   r   .   t   e   r   m   i   n   a   t   e   `       h   a   s   
                   /   /       r   e   t   u   r   n   e   d   .           F   o   r       t   h   i   s       r   e   a   s   o   n   ,       w   e       d   o   n   '   t       c   a   l   l       `   r   e   t   u   r   n   W   o   r   k   e   r   T   o   P   o   o   l   `       h   e   r   e       o   r   
                   /   /       f   r   e   e       t   h   e       u   n   d   e   r   l   y   i   n   g       p   t   h   r   e   a   d       d   a   t   a       s   t   r   u   c   t   u   r   e   s   .   
                   f   o   r       (   v   a   r       w   o   r   k   e   r       o   f       P   T   h   r   e   a   d   .   r   u   n   n   i   n   g   W   o   r   k   e   r   s   )       {   
                           t   e   r   m   i   n   a   t   e   W   o   r   k   e   r   (   w   o   r   k   e   r   )   ;   
                   }   
                   f   o   r       (   v   a   r       w   o   r   k   e   r       o   f       P   T   h   r   e   a   d   .   u   n   u   s   e   d   W   o   r   k   e   r   s   )       {   
                           t   e   r   m   i   n   a   t   e   W   o   r   k   e   r   (   w   o   r   k   e   r   )   ;   
                   }   
                   P   T   h   r   e   a   d   .   u   n   u   s   e   d   W   o   r   k   e   r   s       =       [   ]   ;   
                   P   T   h   r   e   a   d   .   r   u   n   n   i   n   g   W   o   r   k   e   r   s       =       [   ]   ;   
                   P   T   h   r   e   a   d   .   p   t   h   r   e   a   d   s       =       {   }   ;   
           }   ,   
           r   e   t   u   r   n   W   o   r   k   e   r   T   o   P   o   o   l   :       w   o   r   k   e   r       =   >       {   
                   /   /       W   e       d   o   n   '   t       w   a   n   t       t   o       r   u   n       m   a   i   n       t   h   r   e   a   d       q   u   e   u   e   d       c   a   l   l   s       h   e   r   e   ,       s   i   n   c   e       w   e       a   r   e       d   o   i   n   g   
                   /   /       s   o   m   e       o   p   e   r   a   t   i   o   n   s       t   h   a   t       l   e   a   v   e       t   h   e       w   o   r   k   e   r       q   u   e   u   e       i   n       a   n       i   n   v   a   l   i   d       s   t   a   t   e       u   n   t   i   l   
                   /   /       w   e       a   r   e       c   o   m   p   l   e   t   e   l   y       d   o   n   e       (   i   t       w   o   u   l   d       b   e       b   a   d       i   f       f   r   e   e   (   )       e   n   d   s       u   p       c   a   l   l   i   n   g       a   
                   /   /       q   u   e   u   e   d       p   t   h   r   e   a   d   _   c   r   e   a   t   e       w   h   i   c   h       l   o   o   k   s       a   t       t   h   e       g   l   o   b   a   l       d   a   t   a       s   t   r   u   c   t   u   r   e   s       w   e       a   r   e   
                   /   /       m   o   d   i   f   y   i   n   g   )   .       T   o       a   c   h   i   e   v   e       t   h   a   t   ,       d   e   f   e   r       t   h   e       f   r   e   e   (   )       t   i   l       t   h   e       v   e   r   y       e   n   d   ,       w   h   e   n   
                   /   /       w   e       a   r   e       a   l   l       d   o   n   e   .   
                   v   a   r       p   t   h   r   e   a   d   _   p   t   r       =       w   o   r   k   e   r   .   p   t   h   r   e   a   d   _   p   t   r   ;   
                   d   e   l   e   t   e       P   T   h   r   e   a   d   .   p   t   h   r   e   a   d   s   [   p   t   h   r   e   a   d   _   p   t   r   ]   ;   
                   /   /       N   o   t   e   :       w   o   r   k   e   r       i   s       i   n   t   e   n   t   i   o   n   a   l   l   y       n   o   t       t   e   r   m   i   n   a   t   e   d       s   o       t   h   e       p   o   o   l       c   a   n   
                   /   /       d   y   n   a   m   i   c   a   l   l   y       g   r   o   w   .   
                   P   T   h   r   e   a   d   .   u   n   u   s   e   d   W   o   r   k   e   r   s   .   p   u   s   h   (   w   o   r   k   e   r   )   ;   
                   P   T   h   r   e   a   d   .   r   u   n   n   i   n   g   W   o   r   k   e   r   s   .   s   p   l   i   c   e   (   P   T   h   r   e   a   d   .   r   u   n   n   i   n   g   W   o   r   k   e   r   s   .   i   n   d   e   x   O   f   (   w   o   r   k   e   r   )   ,       1   )   ;   
                   /   /       N   o   t       a       r   u   n   n   i   n   g       W   o   r   k   e   r       a   n   y   m   o   r   e   
                   /   /       D   e   t   a   c   h       t   h   e       w   o   r   k   e   r       f   r   o   m       t   h   e       p   t   h   r   e   a   d       o   b   j   e   c   t   ,       a   n   d       r   e   t   u   r   n       i   t       t   o       t   h   e   
                   /   /       w   o   r   k   e   r       p   o   o   l       a   s       a   n       u   n   u   s   e   d       w   o   r   k   e   r   .   
                   w   o   r   k   e   r   .   p   t   h   r   e   a   d   _   p   t   r       =       0   ;   
                   /   /       F   i   n   a   l   l   y   ,       f   r   e   e       t   h   e       u   n   d   e   r   l   y   i   n   g       (   a   n   d       n   o   w   -   u   n   u   s   e   d   )       p   t   h   r   e   a   d       s   t   r   u   c   t   u   r   e       i   n   
                   /   /       l   i   n   e   a   r       m   e   m   o   r   y   .   
                   _   _   e   m   s   c   r   i   p   t   e   n   _   t   h   r   e   a   d   _   f   r   e   e   _   d   a   t   a   (   p   t   h   r   e   a   d   _   p   t   r   )   ;   
           }   ,   
           t   h   r   e   a   d   I   n   i   t   T   L   S   (   )       {   
                   /   /       C   a   l   l       t   h   r   e   a   d       i   n   i   t       f   u   n   c   t   i   o   n   s       (   t   h   e   s   e       a   r   e       t   h   e       _   e   m   s   c   r   i   p   t   e   n   _   t   l   s   _   i   n   i   t       f   o   r       e   a   c   h   
                   /   /       m   o   d   u   l   e       l   o   a   d   e   d   .   
                   P   T   h   r   e   a   d   .   t   l   s   I   n   i   t   F   u   n   c   t   i   o   n   s   .   f   o   r   E   a   c   h   (   f       =   >       f   (   )   )   ;   
           }   ,   
           l   o   a   d   W   a   s   m   M   o   d   u   l   e   T   o   W   o   r   k   e   r   :       w   o   r   k   e   r       =   >       n   e   w       P   r   o   m   i   s   e   (   o   n   F   i   n   i   s   h   e   d   L   o   a   d   i   n   g       =   >       {   
                   w   o   r   k   e   r   .   o   n   m   e   s   s   a   g   e       =       e       =   >       {   
                           v   a   r       d       =       e   [   "   d   a   t   a   "   ]   ;   
                           v   a   r       c   m   d       =       d   .   c   m   d   ;   
                           /   /       I   f       t   h   i   s       m   e   s   s   a   g   e       i   s       i   n   t   e   n   d   e   d       t   o       a       r   e   c   i   p   i   e   n   t       t   h   a   t       i   s       n   o   t       t   h   e       m   a   i   n   
                           /   /       t   h   r   e   a   d   ,       f   o   r   w   a   r   d       i   t       t   o       t   h   e       t   a   r   g   e   t       t   h   r   e   a   d   .   
                           i   f       (   d   .   t   a   r   g   e   t   T   h   r   e   a   d       &   &       d   .   t   a   r   g   e   t   T   h   r   e   a   d       !   =       _   p   t   h   r   e   a   d   _   s   e   l   f   (   )   )       {   
                                   v   a   r       t   a   r   g   e   t   W   o   r   k   e   r       =       P   T   h   r   e   a   d   .   p   t   h   r   e   a   d   s   [   d   .   t   a   r   g   e   t   T   h   r   e   a   d   ]   ;   
                                   i   f       (   t   a   r   g   e   t   W   o   r   k   e   r   )       {   
                                           t   a   r   g   e   t   W   o   r   k   e   r   .   p   o   s   t   M   e   s   s   a   g   e   (   d   ,       d   .   t   r   a   n   s   f   e   r   L   i   s   t   )   ;   
                                   }       e   l   s   e       {   
                                           e   r   r   (   `   I   n   t   e   r   n   a   l       e   r   r   o   r   !       W   o   r   k   e   r       s   e   n   t       a       m   e   s   s   a   g   e       "   $   {   c   m   d   }   "       t   o       t   a   r   g   e   t       p   t   h   r   e   a   d       $   {   d   .   t   a   r   g   e   t   T   h   r   e   a   d   }   ,       b   u   t       t   h   a   t       t   h   r   e   a   d       n   o       l   o   n   g   e   r       e   x   i   s   t   s   !   `   )   ;   
                                   }   
                                   r   e   t   u   r   n   ;   
                           }   
                           i   f       (   c   m   d       =   =   =       "   c   h   e   c   k   M   a   i   l   b   o   x   "   )       {   
                                   c   h   e   c   k   M   a   i   l   b   o   x   (   )   ;   
                           }       e   l   s   e       i   f       (   c   m   d       =   =   =       "   s   p   a   w   n   T   h   r   e   a   d   "   )       {   
                                   s   p   a   w   n   T   h   r   e   a   d   (   d   )   ;   
                           }       e   l   s   e       i   f       (   c   m   d       =   =   =       "   c   l   e   a   n   u   p   T   h   r   e   a   d   "   )       {   
                                   c   l   e   a   n   u   p   T   h   r   e   a   d   (   d   .   t   h   r   e   a   d   )   ;   
                           }       e   l   s   e       i   f       (   c   m   d       =   =   =       "   l   o   a   d   e   d   "   )       {   
                                   w   o   r   k   e   r   .   l   o   a   d   e   d       =       t   r   u   e   ;   
                                   o   n   F   i   n   i   s   h   e   d   L   o   a   d   i   n   g   (   w   o   r   k   e   r   )   ;   
                           }       e   l   s   e       i   f       (   d   .   t   a   r   g   e   t       =   =   =       "   s   e   t   i   m   m   e   d   i   a   t   e   "   )       {   
                                   /   /       W   o   r   k   e   r       w   a   n   t   s       t   o       p   o   s   t   M   e   s   s   a   g   e   (   )       t   o       i   t   s   e   l   f       t   o       i   m   p   l   e   m   e   n   t       s   e   t   I   m   m   e   d   i   a   t   e   (   )   
                                   /   /       e   m   u   l   a   t   i   o   n   .   
                                   w   o   r   k   e   r   .   p   o   s   t   M   e   s   s   a   g   e   (   d   )   ;   
                           }       e   l   s   e       i   f       (   c   m   d       =   =   =       "   c   a   l   l   H   a   n   d   l   e   r   "   )       {   
                                   M   o   d   u   l   e   [   d   .   h   a   n   d   l   e   r   ]   (   .   .   .   d   .   a   r   g   s   )   ;   
                           }       e   l   s   e       i   f       (   c   m   d   )       {   
                                   /   /       T   h   e       r   e   c   e   i   v   e   d       m   e   s   s   a   g   e       l   o   o   k   s       l   i   k   e       s   o   m   e   t   h   i   n   g       t   h   a   t       s   h   o   u   l   d       b   e       h   a   n   d   l   e   d       b   y       t   h   i   s       m   e   s   s   a   g   e   
                                   /   /       h   a   n   d   l   e   r   ,       (   s   i   n   c   e       t   h   e   r   e       i   s       a       e   .   d   a   t   a   .   c   m   d       f   i   e   l   d       p   r   e   s   e   n   t   )   ,       b   u   t       i   s       n   o   t       o   n   e       o   f       t   h   e   
                                   /   /       r   e   c   o   g   n   i   z   e   d       c   o   m   m   a   n   d   s   :   
                                   e   r   r   (   `   w   o   r   k   e   r       s   e   n   t       a   n       u   n   k   n   o   w   n       c   o   m   m   a   n   d       $   {   c   m   d   }   `   )   ;   
                           }   
                   }   ;   
                   w   o   r   k   e   r   .   o   n   e   r   r   o   r       =       e       =   >       {   
                           v   a   r       m   e   s   s   a   g   e       =       "   w   o   r   k   e   r       s   e   n   t       a   n       e   r   r   o   r   !   "   ;   
                           i   f       (   w   o   r   k   e   r   .   p   t   h   r   e   a   d   _   p   t   r   )       {   
                                   m   e   s   s   a   g   e       =       `   P   t   h   r   e   a   d       $   {   p   t   r   T   o   S   t   r   i   n   g   (   w   o   r   k   e   r   .   p   t   h   r   e   a   d   _   p   t   r   )   }       s   e   n   t       a   n       e   r   r   o   r   !   `   ;   
                           }   
                           e   r   r   (   `   $   {   m   e   s   s   a   g   e   }       $   {   e   .   f   i   l   e   n   a   m   e   }   :   $   {   e   .   l   i   n   e   n   o   }   :       $   {   e   .   m   e   s   s   a   g   e   }   `   )   ;   
                           t   h   r   o   w       e   ;   
                   }   ;   
                   a   s   s   e   r   t   (   w   a   s   m   M   e   m   o   r   y       i   n   s   t   a   n   c   e   o   f       W   e   b   A   s   s   e   m   b   l   y   .   M   e   m   o   r   y   ,       "   W   e   b   A   s   s   e   m   b   l   y       m   e   m   o   r   y       s   h   o   u   l   d       h   a   v   e       b   e   e   n       l   o   a   d   e   d       b   y       n   o   w   !   "   )   ;   
                   a   s   s   e   r   t   (   w   a   s   m   M   o   d   u   l   e       i   n   s   t   a   n   c   e   o   f       W   e   b   A   s   s   e   m   b   l   y   .   M   o   d   u   l   e   ,       "   W   e   b   A   s   s   e   m   b   l   y       M   o   d   u   l   e       s   h   o   u   l   d       h   a   v   e       b   e   e   n       l   o   a   d   e   d       b   y       n   o   w   !   "   )   ;   
                   /   /       W   h   e   n       r   u   n   n   i   n   g       o   n       a       p   t   h   r   e   a   d   ,       n   o   n   e       o   f       t   h   e       i   n   c   o   m   i   n   g       p   a   r   a   m   e   t   e   r   s       o   n       t   h   e       m   o   d   u   l   e   
                   /   /       o   b   j   e   c   t       a   r   e       p   r   e   s   e   n   t   .       P   r   o   x   y       k   n   o   w   n       h   a   n   d   l   e   r   s       b   a   c   k       t   o       t   h   e       m   a   i   n       t   h   r   e   a   d       i   f       s   p   e   c   i   f   i   e   d   .   
                   v   a   r       h   a   n   d   l   e   r   s       =       [   ]   ;   
                   v   a   r       k   n   o   w   n   H   a   n   d   l   e   r   s       =       [       "   o   n   E   x   i   t   "   ,       "   o   n   A   b   o   r   t   "   ,       "   p   r   i   n   t   "   ,       "   p   r   i   n   t   E   r   r   "       ]   ;   
                   f   o   r       (   v   a   r       h   a   n   d   l   e   r       o   f       k   n   o   w   n   H   a   n   d   l   e   r   s   )       {   
                           i   f       (   M   o   d   u   l   e   .   p   r   o   p   e   r   t   y   I   s   E   n   u   m   e   r   a   b   l   e   (   h   a   n   d   l   e   r   )   )       {   
                                   h   a   n   d   l   e   r   s   .   p   u   s   h   (   h   a   n   d   l   e   r   )   ;   
                           }   
                   }   
                   /   /       A   s   k       t   h   e       n   e   w       w   o   r   k   e   r       t   o       l   o   a   d       u   p       t   h   e       E   m   s   c   r   i   p   t   e   n   -   c   o   m   p   i   l   e   d       p   a   g   e   .       T   h   i   s       i   s       a       h   e   a   v   y       o   p   e   r   a   t   i   o   n   .   
                   w   o   r   k   e   r   .   p   o   s   t   M   e   s   s   a   g   e   (   {   
                           c   m   d   :       "   l   o   a   d   "   ,   
                           h   a   n   d   l   e   r   s   ,   
                           w   a   s   m   M   e   m   o   r   y   ,   
                           w   a   s   m   M   o   d   u   l   e   ,   
                           "   w   o   r   k   e   r   I   D   "   :       w   o   r   k   e   r   .   w   o   r   k   e   r   I   D   
                   }   )   ;   
           }   )   ,   
           l   o   a   d   W   a   s   m   M   o   d   u   l   e   T   o   A   l   l   W   o   r   k   e   r   s   (   o   n   M   a   y   b   e   R   e   a   d   y   )       {   
                   o   n   M   a   y   b   e   R   e   a   d   y   (   )   ;   
           }   ,   
           a   l   l   o   c   a   t   e   U   n   u   s   e   d   W   o   r   k   e   r   (   )       {   
                   v   a   r       w   o   r   k   e   r   ;   
                   v   a   r       p   t   h   r   e   a   d   M   a   i   n   J   s       =       _   s   c   r   i   p   t   N   a   m   e   ;   
                   /   /       W   e       c   a   n   '   t       u   s   e       m   a   k   e   M   o   d   u   l   e   R   e   c   e   i   v   e   W   i   t   h   V   a   r       h   e   r   e       s   i   n   c   e       w   e       w   a   n   t       t   o       a   l   s   o   
                   /   /       c   a   l   l       U   R   L   .   c   r   e   a   t   e   O   b   j   e   c   t   U   R   L       o   n       t   h   e       m   a   i   n   S   c   r   i   p   t   U   r   l   O   r   B   l   o   b   .   
                   i   f       (   M   o   d   u   l   e   [   "   m   a   i   n   S   c   r   i   p   t   U   r   l   O   r   B   l   o   b   "   ]   )       {   
                           p   t   h   r   e   a   d   M   a   i   n   J   s       =       M   o   d   u   l   e   [   "   m   a   i   n   S   c   r   i   p   t   U   r   l   O   r   B   l   o   b   "   ]   ;   
                           i   f       (   t   y   p   e   o   f       p   t   h   r   e   a   d   M   a   i   n   J   s       !   =       "   s   t   r   i   n   g   "   )       {   
                                   p   t   h   r   e   a   d   M   a   i   n   J   s       =       U   R   L   .   c   r   e   a   t   e   O   b   j   e   c   t   U   R   L   (   p   t   h   r   e   a   d   M   a   i   n   J   s   )   ;   
                           }   
                   }   
                   w   o   r   k   e   r       =       n   e   w       W   o   r   k   e   r   (   p   t   h   r   e   a   d   M   a   i   n   J   s   ,       {   
                           /   /       T   h   i   s       i   s       t   h   e       w   a   y       t   h   a   t       w   e       s   i   g   n   a   l       t   o       t   h   e       W   e   b       W   o   r   k   e   r       t   h   a   t       i   t       i   s       h   o   s   t   i   n   g   
                           /   /       a       p   t   h   r   e   a   d   .   
                           "   n   a   m   e   "   :       "   e   m   -   p   t   h   r   e   a   d   -   "       +       P   T   h   r   e   a   d   .   n   e   x   t   W   o   r   k   e   r   I   D   
                   }   )   ;   
                   w   o   r   k   e   r   .   w   o   r   k   e   r   I   D       =       P   T   h   r   e   a   d   .   n   e   x   t   W   o   r   k   e   r   I   D   +   +   ;   
                   P   T   h   r   e   a   d   .   u   n   u   s   e   d   W   o   r   k   e   r   s   .   p   u   s   h   (   w   o   r   k   e   r   )   ;   
           }   ,   
           g   e   t   N   e   w   W   o   r   k   e   r   (   )       {   
                   i   f       (   P   T   h   r   e   a   d   .   u   n   u   s   e   d   W   o   r   k   e   r   s   .   l   e   n   g   t   h       =   =       0   )       {   
                           /   /       P   T   H   R   E   A   D   _   P   O   O   L   _   S   I   Z   E   _   S   T   R   I   C   T       s   h   o   u   l   d       s   h   o   w       a       w   a   r   n   i   n   g       a   n   d   ,       i   f       s   e   t       t   o       l   e   v   e   l       `   2   `   ,       r   e   t   u   r   n       f   r   o   m       t   h   e       f   u   n   c   t   i   o   n   .   
                           /   /       H   o   w   e   v   e   r   ,       i   f       w   e   '   r   e       i   n       N   o   d   e   .   j   s   ,       t   h   e   n       w   e       c   a   n       c   r   e   a   t   e       n   e   w       w   o   r   k   e   r   s       o   n       t   h   e       f   l   y       a   n   d       P   T   H   R   E   A   D   _   P   O   O   L   _   S   I   Z   E   _   S   T   R   I   C   T   
                           /   /       s   h   o   u   l   d       b   e       i   g   n   o   r   e   d       a   l   t   o   g   e   t   h   e   r   .   
                           e   r   r   (   "   T   r   i   e   d       t   o       s   p   a   w   n       a       n   e   w       t   h   r   e   a   d   ,       b   u   t       t   h   e       t   h   r   e   a   d       p   o   o   l       i   s       e   x   h   a   u   s   t   e   d   .   \   n   "       +       "   T   h   i   s       m   i   g   h   t       r   e   s   u   l   t       i   n       a       d   e   a   d   l   o   c   k       u   n   l   e   s   s       s   o   m   e       t   h   r   e   a   d   s       e   v   e   n   t   u   a   l   l   y       e   x   i   t       o   r       t   h   e       c   o   d   e       e   x   p   l   i   c   i   t   l   y       b   r   e   a   k   s       o   u   t       t   o       t   h   e       e   v   e   n   t       l   o   o   p   .   \   n   "       +       "   I   f       y   o   u       w   a   n   t       t   o       i   n   c   r   e   a   s   e       t   h   e       p   o   o   l       s   i   z   e   ,       u   s   e       s   e   t   t   i   n   g       `   -   s   P   T   H   R   E   A   D   _   P   O   O   L   _   S   I   Z   E   =   .   .   .   `   .   "       +       "   \   n   I   f       y   o   u       w   a   n   t       t   o       t   h   r   o   w       a   n       e   x   p   l   i   c   i   t       e   r   r   o   r       i   n   s   t   e   a   d       o   f       t   h   e       r   i   s   k       o   f       d   e   a   d   l   o   c   k   i   n   g       i   n       t   h   o   s   e       c   a   s   e   s   ,       u   s   e       s   e   t   t   i   n   g       `   -   s   P   T   H   R   E   A   D   _   P   O   O   L   _   S   I   Z   E   _   S   T   R   I   C   T   =   2   `   .   "   )   ;   
                           P   T   h   r   e   a   d   .   a   l   l   o   c   a   t   e   U   n   u   s   e   d   W   o   r   k   e   r   (   )   ;   
                           P   T   h   r   e   a   d   .   l   o   a   d   W   a   s   m   M   o   d   u   l   e   T   o   W   o   r   k   e   r   (   P   T   h   r   e   a   d   .   u   n   u   s   e   d   W   o   r   k   e   r   s   [   0   ]   )   ;   
                   }   
                   r   e   t   u   r   n       P   T   h   r   e   a   d   .   u   n   u   s   e   d   W   o   r   k   e   r   s   .   p   o   p   (   )   ;   
           }   
   }   ;   
   
   v   a   r       o   n   P   o   s   t   R   u   n   s       =       [   ]   ;   
   
   v   a   r       a   d   d   O   n   P   o   s   t   R   u   n       =       c   b       =   >       o   n   P   o   s   t   R   u   n   s   .   p   u   s   h   (   c   b   )   ;   
   
   f   u   n   c   t   i   o   n       e   s   t   a   b   l   i   s   h   S   t   a   c   k   S   p   a   c   e   (   p   t   h   r   e   a   d   _   p   t   r   )       {   
           v   a   r       s   t   a   c   k   H   i   g   h       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   (   p   t   h   r   e   a   d   _   p   t   r   )       +       (   5   2   )   )       >   >       2   )   ]   ;   
           v   a   r       s   t   a   c   k   S   i   z   e       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   (   p   t   h   r   e   a   d   _   p   t   r   )       +       (   5   6   )   )       >   >       2   )   ]   ;   
           v   a   r       s   t   a   c   k   L   o   w       =       s   t   a   c   k   H   i   g   h       -       s   t   a   c   k   S   i   z   e   ;   
           a   s   s   e   r   t   (   s   t   a   c   k   H   i   g   h       !   =       0   )   ;   
           a   s   s   e   r   t   (   s   t   a   c   k   L   o   w       !   =       0   )   ;   
           a   s   s   e   r   t   (   s   t   a   c   k   H   i   g   h       >       s   t   a   c   k   L   o   w   ,       "   s   t   a   c   k   H   i   g   h       m   u   s   t       b   e       h   i   g   h   e   r       t   h   e   n       s   t   a   c   k   L   o   w   "   )   ;   
           /   /       S   e   t       s   t   a   c   k       l   i   m   i   t   s       u   s   e   d       b   y       `   e   m   s   c   r   i   p   t   e   n   /   s   t   a   c   k   .   h   `       f   u   n   c   t   i   o   n   .           T   h   e   s   e       l   i   m   i   t   s       a   r   e   
           /   /       c   a   c   h   e   d       i   n       w   a   s   m   -   s   i   d   e       g   l   o   b   a   l   s       t   o       m   a   k   e       c   h   e   c   k   s       a   s       f   a   s   t       a   s       p   o   s   s   i   b   l   e   .   
           _   e   m   s   c   r   i   p   t   e   n   _   s   t   a   c   k   _   s   e   t   _   l   i   m   i   t   s   (   s   t   a   c   k   H   i   g   h   ,       s   t   a   c   k   L   o   w   )   ;   
           /   /       C   a   l   l       i   n   s   i   d   e       w   a   s   m       m   o   d   u   l   e       t   o       s   e   t       u   p       t   h   e       s   t   a   c   k       f   r   a   m   e       f   o   r       t   h   i   s       p   t   h   r   e   a   d       i   n       w   a   s   m       m   o   d   u   l   e       s   c   o   p   e   
           s   t   a   c   k   R   e   s   t   o   r   e   (   s   t   a   c   k   H   i   g   h   )   ;   
           /   /       W   r   i   t   e       t   h   e       s   t   a   c   k       c   o   o   k   i   e       l   a   s   t   ,       a   f   t   e   r       w   e       h   a   v   e       s   e   t       u   p       t   h   e       p   r   o   p   e   r       b   o   u   n   d   s       a   n   d   
           /   /       c   u   r   r   e   n   t       p   o   s   i   t   i   o   n       o   f       t   h   e       s   t   a   c   k   .   
           w   r   i   t   e   S   t   a   c   k   C   o   o   k   i   e   (   )   ;   
   }   
   
   /   *   *   
                       *       @   p   a   r   a   m       {   n   u   m   b   e   r   }       p   t   r   
                       *       @   p   a   r   a   m       {   s   t   r   i   n   g   }       t   y   p   e   
                       *   /       f   u   n   c   t   i   o   n       g   e   t   V   a   l   u   e   (   p   t   r   ,       t   y   p   e       =       "   i   8   "   )       {   
           i   f       (   t   y   p   e   .   e   n   d   s   W   i   t   h   (   "   *   "   )   )       t   y   p   e       =       "   *   "   ;   
           s   w   i   t   c   h       (   t   y   p   e   )       {   
               c   a   s   e       "   i   1   "   :   
                   r   e   t   u   r   n       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   8   )   [   p   t   r   ]   ;   
   
               c   a   s   e       "   i   8   "   :   
                   r   e   t   u   r   n       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   8   )   [   p   t   r   ]   ;   
   
               c   a   s   e       "   i   1   6   "   :   
                   r   e   t   u   r   n       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   1   6   )   [   (   (   p   t   r   )       >   >       1   )   ]   ;   
   
               c   a   s   e       "   i   3   2   "   :   
                   r   e   t   u   r   n       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   p   t   r   )       >   >       2   )   ]   ;   
   
               c   a   s   e       "   i   6   4   "   :   
                   r   e   t   u   r   n       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   6   4   )   [   (   (   p   t   r   )       >   >       3   )   ]   ;   
   
               c   a   s   e       "   f   l   o   a   t   "   :   
                   r   e   t   u   r   n       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   F   3   2   )   [   (   (   p   t   r   )       >   >       2   )   ]   ;   
   
               c   a   s   e       "   d   o   u   b   l   e   "   :   
                   r   e   t   u   r   n       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   F   6   4   )   [   (   (   p   t   r   )       >   >       3   )   ]   ;   
   
               c   a   s   e       "   *   "   :   
                   r   e   t   u   r   n       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   p   t   r   )       >   >       2   )   ]   ;   
   
               d   e   f   a   u   l   t   :   
                   a   b   o   r   t   (   `   i   n   v   a   l   i   d       t   y   p   e       f   o   r       g   e   t   V   a   l   u   e   :       $   {   t   y   p   e   }   `   )   ;   
           }   
   }   
   
   v   a   r       w   a   s   m   T   a   b   l   e   M   i   r   r   o   r       =       [   ]   ;   
   
   /   *   *       @   t   y   p   e       {   W   e   b   A   s   s   e   m   b   l   y   .   T   a   b   l   e   }       *   /       v   a   r       w   a   s   m   T   a   b   l   e   ;   
   
   v   a   r       g   e   t   W   a   s   m   T   a   b   l   e   E   n   t   r   y       =       f   u   n   c   P   t   r       =   >       {   
           v   a   r       f   u   n   c       =       w   a   s   m   T   a   b   l   e   M   i   r   r   o   r   [   f   u   n   c   P   t   r   ]   ;   
           i   f       (   !   f   u   n   c   )       {   
                   /   *   *       @   s   u   p   p   r   e   s   s       {   c   h   e   c   k   T   y   p   e   s   }       *   /       w   a   s   m   T   a   b   l   e   M   i   r   r   o   r   [   f   u   n   c   P   t   r   ]       =       f   u   n   c       =       w   a   s   m   T   a   b   l   e   .   g   e   t   (   f   u   n   c   P   t   r   )   ;   
           }   
           /   *   *       @   s   u   p   p   r   e   s   s       {   c   h   e   c   k   T   y   p   e   s   }       *   /       a   s   s   e   r   t   (   w   a   s   m   T   a   b   l   e   .   g   e   t   (   f   u   n   c   P   t   r   )       =   =       f   u   n   c   ,       "   J   a   v   a   S   c   r   i   p   t   -   s   i   d   e       W   a   s   m       f   u   n   c   t   i   o   n       t   a   b   l   e       m   i   r   r   o   r       i   s       o   u   t       o   f       d   a   t   e   !   "   )   ;   
           r   e   t   u   r   n       f   u   n   c   ;   
   }   ;   
   
   v   a   r       i   n   v   o   k   e   E   n   t   r   y   P   o   i   n   t       =       (   p   t   r   ,       a   r   g   )       =   >       {   
           /   /       A   n       o   l   d       t   h   r   e   a   d       o   n       t   h   i   s       w   o   r   k   e   r       m   a   y       h   a   v   e       b   e   e   n       c   a   n   c   e   l   e   d       w   i   t   h   o   u   t       r   e   t   u   r   n   i   n   g       t   h   e   
           /   /       `   r   u   n   t   i   m   e   K   e   e   p   a   l   i   v   e   C   o   u   n   t   e   r   `       t   o       z   e   r   o   .       R   e   s   e   t       i   t       n   o   w       s   o       t   h   e       n   e   w       t   h   r   e   a   d       w   o   n   '   t   
           /   /       b   e       a   f   f   e   c   t   e   d   .   
           r   u   n   t   i   m   e   K   e   e   p   a   l   i   v   e   C   o   u   n   t   e   r       =       0   ;   
           /   /       S   a   m   e       f   o   r       n   o   E   x   i   t   R   u   n   t   i   m   e   .           T   h   e       d   e   f   a   u   l   t       f   o   r       p   t   h   r   e   a   d   s       s   h   o   u   l   d       a   l   w   a   y   s       b   e       f   a   l   s   e   
           /   /       o   t   h   e   r   w   i   s   e       p   t   h   r   e   a   d   s       w   o   u   l   d       n   e   v   e   r       c   o   m   p   l   e   t   e       a   n   d       a   t   t   e   m   p   t   s       t   o       p   t   h   r   e   a   d   _   j   o   i   n       t   o   
           /   /       t   h   e   m       w   o   u   l   d       b   l   o   c   k       f   o   r   e   v   e   r   .   
           /   /       p   t   h   r   e   a   d   s       c   a   n       s   t   i   l   l       c   h   o   o   s   e       t   o       s   e   t       `   n   o   E   x   i   t   R   u   n   t   i   m   e   `       e   x   p   l   i   c   i   t   l   y   ,       o   r   
           /   /       c   a   l   l       e   m   s   c   r   i   p   t   e   n   _   u   n   w   i   n   d   _   t   o   _   j   s   _   e   v   e   n   t   _   l   o   o   p       t   o       e   x   t   e   n   d       t   h   e   i   r       l   i   f   e   t   i   m   e       b   e   y   o   n   d   
           /   /       t   h   e   i   r       m   a   i   n       f   u   n   c   t   i   o   n   .           S   e   e       c   o   m   m   e   n   t       i   n       s   r   c   /   r   u   n   t   i   m   e   _   p   t   h   r   e   a   d   .   j   s       f   o   r       m   o   r   e   .   
           n   o   E   x   i   t   R   u   n   t   i   m   e       =       0   ;   
           /   /       p   t   h   r   e   a   d       e   n   t   r   y       p   o   i   n   t   s       a   r   e       a   l   w   a   y   s       o   f       s   i   g   n   a   t   u   r   e       '   v   o   i   d       *   T   h   r   e   a   d   M   a   i   n   (   v   o   i   d       *   a   r   g   )   '   
           /   /       N   a   t   i   v   e       c   o   d   e   b   a   s   e   s       s   o   m   e   t   i   m   e   s       s   p   a   w   n       t   h   r   e   a   d   s       w   i   t   h       o   t   h   e   r       t   h   r   e   a   d       e   n   t   r   y       p   o   i   n   t   
           /   /       s   i   g   n   a   t   u   r   e   s   ,       s   u   c   h       a   s       v   o   i   d       T   h   r   e   a   d   M   a   i   n   (   v   o   i   d       *   a   r   g   )   ,       v   o   i   d       *   T   h   r   e   a   d   M   a   i   n   (   )   ,       o   r   
           /   /       v   o   i   d       T   h   r   e   a   d   M   a   i   n   (   )   .           T   h   a   t       i   s       n   o   t       a   c   c   e   p   t   a   b   l   e       p   e   r       C   /   C   +   +       s   p   e   c   i   f   i   c   a   t   i   o   n   ,       b   u   t   
           /   /       x   8   6       c   o   m   p   i   l   e   r       A   B   I       e   x   t   e   n   s   i   o   n   s       e   n   a   b   l   e       t   h   a   t       t   o       w   o   r   k   .       I   f       y   o   u       f   i   n   d       t   h   e   
           /   /       f   o   l   l   o   w   i   n   g       l   i   n   e       t   o       c   r   a   s   h   ,       e   i   t   h   e   r       c   h   a   n   g   e       t   h   e       s   i   g   n   a   t   u   r   e       t   o       "   p   r   o   p   e   r   "       v   o   i   d   
           /   /       *   T   h   r   e   a   d   M   a   i   n   (   v   o   i   d       *   a   r   g   )       f   o   r   m   ,       o   r       t   r   y       l   i   n   k   i   n   g       w   i   t   h       t   h   e       E   m   s   c   r   i   p   t   e   n       l   i   n   k   e   r   
           /   /       f   l   a   g       -   s   E   M   U   L   A   T   E   _   F   U   N   C   T   I   O   N   _   P   O   I   N   T   E   R   _   C   A   S   T   S       t   o       a   d   d       i   n       e   m   u   l   a   t   i   o   n       f   o   r       t   h   i   s       x   8   6   
           /   /       A   B   I       e   x   t   e   n   s   i   o   n   .   
           v   a   r       r   e   s   u   l   t       =       g   e   t   W   a   s   m   T   a   b   l   e   E   n   t   r   y   (   p   t   r   )   (   a   r   g   )   ;   
           c   h   e   c   k   S   t   a   c   k   C   o   o   k   i   e   (   )   ;   
           f   u   n   c   t   i   o   n       f   i   n   i   s   h   (   r   e   s   u   l   t   )       {   
                   i   f       (   k   e   e   p   R   u   n   t   i   m   e   A   l   i   v   e   (   )   )       {   
                           E   X   I   T   S   T   A   T   U   S       =       r   e   s   u   l   t   ;   
                   }       e   l   s   e       {   
                           _   _   e   m   s   c   r   i   p   t   e   n   _   t   h   r   e   a   d   _   e   x   i   t   (   r   e   s   u   l   t   )   ;   
                   }   
           }   
           f   i   n   i   s   h   (   r   e   s   u   l   t   )   ;   
   }   ;   
   
   v   a   r       n   o   E   x   i   t   R   u   n   t   i   m   e       =       t   r   u   e   ;   
   
   v   a   r       r   e   g   i   s   t   e   r   T   L   S   I   n   i   t       =       t   l   s   I   n   i   t   F   u   n   c       =   >       P   T   h   r   e   a   d   .   t   l   s   I   n   i   t   F   u   n   c   t   i   o   n   s   .   p   u   s   h   (   t   l   s   I   n   i   t   F   u   n   c   )   ;   
   
   /   *   *   
                       *       @   p   a   r   a   m       {   n   u   m   b   e   r   }       p   t   r   
                       *       @   p   a   r   a   m       {   n   u   m   b   e   r   }       v   a   l   u   e   
                       *       @   p   a   r   a   m       {   s   t   r   i   n   g   }       t   y   p   e   
                       *   /       f   u   n   c   t   i   o   n       s   e   t   V   a   l   u   e   (   p   t   r   ,       v   a   l   u   e   ,       t   y   p   e       =       "   i   8   "   )       {   
           i   f       (   t   y   p   e   .   e   n   d   s   W   i   t   h   (   "   *   "   )   )       t   y   p   e       =       "   *   "   ;   
           s   w   i   t   c   h       (   t   y   p   e   )       {   
               c   a   s   e       "   i   1   "   :   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   8   )   [   p   t   r   ]       =       v   a   l   u   e   ;   
                   b   r   e   a   k   ;   
   
               c   a   s   e       "   i   8   "   :   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   8   )   [   p   t   r   ]       =       v   a   l   u   e   ;   
                   b   r   e   a   k   ;   
   
               c   a   s   e       "   i   1   6   "   :   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   1   6   )   [   (   (   p   t   r   )       >   >       1   )   ]       =       v   a   l   u   e   ;   
                   b   r   e   a   k   ;   
   
               c   a   s   e       "   i   3   2   "   :   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   p   t   r   )       >   >       2   )   ]       =       v   a   l   u   e   ;   
                   b   r   e   a   k   ;   
   
               c   a   s   e       "   i   6   4   "   :   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   6   4   )   [   (   (   p   t   r   )       >   >       3   )   ]       =       B   i   g   I   n   t   (   v   a   l   u   e   )   ;   
                   b   r   e   a   k   ;   
   
               c   a   s   e       "   f   l   o   a   t   "   :   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   F   3   2   )   [   (   (   p   t   r   )       >   >       2   )   ]       =       v   a   l   u   e   ;   
                   b   r   e   a   k   ;   
   
               c   a   s   e       "   d   o   u   b   l   e   "   :   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   F   6   4   )   [   (   (   p   t   r   )       >   >       3   )   ]       =       v   a   l   u   e   ;   
                   b   r   e   a   k   ;   
   
               c   a   s   e       "   *   "   :   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   p   t   r   )       >   >       2   )   ]       =       v   a   l   u   e   ;   
                   b   r   e   a   k   ;   
   
               d   e   f   a   u   l   t   :   
                   a   b   o   r   t   (   `   i   n   v   a   l   i   d       t   y   p   e       f   o   r       s   e   t   V   a   l   u   e   :       $   {   t   y   p   e   }   `   )   ;   
           }   
   }   
   
   v   a   r       w   a   r   n   O   n   c   e       =       t   e   x   t       =   >       {   
           w   a   r   n   O   n   c   e   .   s   h   o   w   n       |   |   =       {   }   ;   
           i   f       (   !   w   a   r   n   O   n   c   e   .   s   h   o   w   n   [   t   e   x   t   ]   )       {   
                   w   a   r   n   O   n   c   e   .   s   h   o   w   n   [   t   e   x   t   ]       =       1   ;   
                   e   r   r   (   t   e   x   t   )   ;   
           }   
   }   ;   
   
   v   a   r       U   T   F   8   D   e   c   o   d   e   r       =       t   y   p   e   o   f       T   e   x   t   D   e   c   o   d   e   r       !   =       "   u   n   d   e   f   i   n   e   d   "       ?       n   e   w       T   e   x   t   D   e   c   o   d   e   r       :       u   n   d   e   f   i   n   e   d   ;   
   
   v   a   r       f   i   n   d   S   t   r   i   n   g   E   n   d       =       (   h   e   a   p   O   r   A   r   r   a   y   ,       i   d   x   ,       m   a   x   B   y   t   e   s   T   o   R   e   a   d   ,       i   g   n   o   r   e   N   u   l   )       =   >       {   
           v   a   r       m   a   x   I   d   x       =       i   d   x       +       m   a   x   B   y   t   e   s   T   o   R   e   a   d   ;   
           i   f       (   i   g   n   o   r   e   N   u   l   )       r   e   t   u   r   n       m   a   x   I   d   x   ;   
           /   /       T   e   x   t   D   e   c   o   d   e   r       n   e   e   d   s       t   o       k   n   o   w       t   h   e       b   y   t   e       l   e   n   g   t   h       i   n       a   d   v   a   n   c   e   ,       i   t       d   o   e   s   n   '   t       s   t   o   p       o   n   
           /   /       n   u   l   l       t   e   r   m   i   n   a   t   o   r       b   y       i   t   s   e   l   f   .   
           /   /       A   s       a       t   i   n   y       c   o   d   e       s   a   v   e       t   r   i   c   k   ,       c   o   m   p   a   r   e       i   d   x       a   g   a   i   n   s   t       m   a   x   I   d   x       u   s   i   n   g       a       n   e   g   a   t   i   o   n   ,   
           /   /       s   o       t   h   a   t       m   a   x   B   y   t   e   s   T   o   R   e   a   d   =   u   n   d   e   f   i   n   e   d   /   N   a   N       m   e   a   n   s       I   n   f   i   n   i   t   y   .   
           w   h   i   l   e       (   h   e   a   p   O   r   A   r   r   a   y   [   i   d   x   ]       &   &       !   (   i   d   x       >   =       m   a   x   I   d   x   )   )       +   +   i   d   x   ;   
           r   e   t   u   r   n       i   d   x   ;   
   }   ;   
   
   /   *   *   
                       *       G   i   v   e   n       a       p   o   i   n   t   e   r       '   i   d   x   '       t   o       a       n   u   l   l   -   t   e   r   m   i   n   a   t   e   d       U   T   F   8   -   e   n   c   o   d   e   d       s   t   r   i   n   g       i   n       t   h   e       g   i   v   e   n   
                       *       a   r   r   a   y       t   h   a   t       c   o   n   t   a   i   n   s       u   i   n   t   8       v   a   l   u   e   s   ,       r   e   t   u   r   n   s       a       c   o   p   y       o   f       t   h   a   t       s   t   r   i   n   g       a   s       a   
                       *       J   a   v   a   s   c   r   i   p   t       S   t   r   i   n   g       o   b   j   e   c   t   .   
                       *       h   e   a   p   O   r   A   r   r   a   y       i   s       e   i   t   h   e   r       a       r   e   g   u   l   a   r       a   r   r   a   y   ,       o   r       a       J   a   v   a   S   c   r   i   p   t       t   y   p   e   d       a   r   r   a   y       v   i   e   w   .   
                       *       @   p   a   r   a   m       {   n   u   m   b   e   r   =   }       i   d   x   
                       *       @   p   a   r   a   m       {   n   u   m   b   e   r   =   }       m   a   x   B   y   t   e   s   T   o   R   e   a   d   
                       *       @   p   a   r   a   m       {   b   o   o   l   e   a   n   =   }       i   g   n   o   r   e   N   u   l       -       I   f       t   r   u   e   ,       t   h   e       f   u   n   c   t   i   o   n       w   i   l   l       n   o   t       s   t   o   p       o   n       a       N   U   L       c   h   a   r   a   c   t   e   r   .   
                       *       @   r   e   t   u   r   n       {   s   t   r   i   n   g   }   
                       *   /       v   a   r       U   T   F   8   A   r   r   a   y   T   o   S   t   r   i   n   g       =       (   h   e   a   p   O   r   A   r   r   a   y   ,       i   d   x       =       0   ,       m   a   x   B   y   t   e   s   T   o   R   e   a   d   ,       i   g   n   o   r   e   N   u   l   )       =   >       {   
           v   a   r       e   n   d   P   t   r       =       f   i   n   d   S   t   r   i   n   g   E   n   d   (   h   e   a   p   O   r   A   r   r   a   y   ,       i   d   x   ,       m   a   x   B   y   t   e   s   T   o   R   e   a   d   ,       i   g   n   o   r   e   N   u   l   )   ;   
           /   /       W   h   e   n       u   s   i   n   g       c   o   n   d   i   t   i   o   n   a   l       T   e   x   t   D   e   c   o   d   e   r   ,       s   k   i   p       i   t       f   o   r       s   h   o   r   t       s   t   r   i   n   g   s       a   s       t   h   e       o   v   e   r   h   e   a   d       o   f       t   h   e       n   a   t   i   v   e       c   a   l   l       i   s       n   o   t       w   o   r   t   h       i   t   .   
           i   f       (   e   n   d   P   t   r       -       i   d   x       >       1   6       &   &       h   e   a   p   O   r   A   r   r   a   y   .   b   u   f   f   e   r       &   &       U   T   F   8   D   e   c   o   d   e   r   )       {   
                   r   e   t   u   r   n       U   T   F   8   D   e   c   o   d   e   r   .   d   e   c   o   d   e   (   h   e   a   p   O   r   A   r   r   a   y   .   b   u   f   f   e   r       i   n   s   t   a   n   c   e   o   f       A   r   r   a   y   B   u   f   f   e   r       ?       h   e   a   p   O   r   A   r   r   a   y   .   s   u   b   a   r   r   a   y   (   i   d   x   ,       e   n   d   P   t   r   )       :       h   e   a   p   O   r   A   r   r   a   y   .   s   l   i   c   e   (   i   d   x   ,       e   n   d   P   t   r   )   )   ;   
           }   
           v   a   r       s   t   r       =       "   "   ;   
           /   /       I   f       b   u   i   l   d   i   n   g       w   i   t   h       T   e   x   t   D   e   c   o   d   e   r   ,       w   e       h   a   v   e       a   l   r   e   a   d   y       c   o   m   p   u   t   e   d       t   h   e       s   t   r   i   n   g       l   e   n   g   t   h   
           /   /       a   b   o   v   e   ,       s   o       t   e   s   t       l   o   o   p       e   n   d       c   o   n   d   i   t   i   o   n       a   g   a   i   n   s   t       t   h   a   t   
           w   h   i   l   e       (   i   d   x       <       e   n   d   P   t   r   )       {   
                   /   /       F   o   r       U   T   F   8       b   y   t   e       s   t   r   u   c   t   u   r   e   ,       s   e   e   :   
                   /   /       h   t   t   p   :   /   /   e   n   .   w   i   k   i   p   e   d   i   a   .   o   r   g   /   w   i   k   i   /   U   T   F   -   8   #   D   e   s   c   r   i   p   t   i   o   n   
                   /   /       h   t   t   p   s   :   /   /   w   w   w   .   i   e   t   f   .   o   r   g   /   r   f   c   /   r   f   c   2   2   7   9   .   t   x   t   
                   /   /       h   t   t   p   s   :   /   /   t   o   o   l   s   .   i   e   t   f   .   o   r   g   /   h   t   m   l   /   r   f   c   3   6   2   9   
                   v   a   r       u   0       =       h   e   a   p   O   r   A   r   r   a   y   [   i   d   x   +   +   ]   ;   
                   i   f       (   !   (   u   0       &       1   2   8   )   )       {   
                           s   t   r       +   =       S   t   r   i   n   g   .   f   r   o   m   C   h   a   r   C   o   d   e   (   u   0   )   ;   
                           c   o   n   t   i   n   u   e   ;   
                   }   
                   v   a   r       u   1       =       h   e   a   p   O   r   A   r   r   a   y   [   i   d   x   +   +   ]       &       6   3   ;   
                   i   f       (   (   u   0       &       2   2   4   )       =   =       1   9   2   )       {   
                           s   t   r       +   =       S   t   r   i   n   g   .   f   r   o   m   C   h   a   r   C   o   d   e   (   (   (   u   0       &       3   1   )       <   <       6   )       |       u   1   )   ;   
                           c   o   n   t   i   n   u   e   ;   
                   }   
                   v   a   r       u   2       =       h   e   a   p   O   r   A   r   r   a   y   [   i   d   x   +   +   ]       &       6   3   ;   
                   i   f       (   (   u   0       &       2   4   0   )       =   =       2   2   4   )       {   
                           u   0       =       (   (   u   0       &       1   5   )       <   <       1   2   )       |       (   u   1       <   <       6   )       |       u   2   ;   
                   }       e   l   s   e       {   
                           i   f       (   (   u   0       &       2   4   8   )       !   =       2   4   0   )       w   a   r   n   O   n   c   e   (   "   I   n   v   a   l   i   d       U   T   F   -   8       l   e   a   d   i   n   g       b   y   t   e       "       +       p   t   r   T   o   S   t   r   i   n   g   (   u   0   )       +       "       e   n   c   o   u   n   t   e   r   e   d       w   h   e   n       d   e   s   e   r   i   a   l   i   z   i   n   g       a       U   T   F   -   8       s   t   r   i   n   g       i   n       w   a   s   m       m   e   m   o   r   y       t   o       a       J   S       s   t   r   i   n   g   !   "   )   ;   
                           u   0       =       (   (   u   0       &       7   )       <   <       1   8   )       |       (   u   1       <   <       1   2   )       |       (   u   2       <   <       6   )       |       (   h   e   a   p   O   r   A   r   r   a   y   [   i   d   x   +   +   ]       &       6   3   )   ;   
                   }   
                   i   f       (   u   0       <       6   5   5   3   6   )       {   
                           s   t   r       +   =       S   t   r   i   n   g   .   f   r   o   m   C   h   a   r   C   o   d   e   (   u   0   )   ;   
                   }       e   l   s   e       {   
                           v   a   r       c   h       =       u   0       -       6   5   5   3   6   ;   
                           s   t   r       +   =       S   t   r   i   n   g   .   f   r   o   m   C   h   a   r   C   o   d   e   (   5   5   2   9   6       |       (   c   h       >   >       1   0   )   ,       5   6   3   2   0       |       (   c   h       &       1   0   2   3   )   )   ;   
                   }   
           }   
           r   e   t   u   r   n       s   t   r   ;   
   }   ;   
   
   /   *   *   
                       *       G   i   v   e   n       a       p   o   i   n   t   e   r       '   p   t   r   '       t   o       a       n   u   l   l   -   t   e   r   m   i   n   a   t   e   d       U   T   F   8   -   e   n   c   o   d   e   d       s   t   r   i   n   g       i   n       t   h   e   
                       *       e   m   s   c   r   i   p   t   e   n       H   E   A   P   ,       r   e   t   u   r   n   s       a       c   o   p   y       o   f       t   h   a   t       s   t   r   i   n   g       a   s       a       J   a   v   a   s   c   r   i   p   t       S   t   r   i   n   g       o   b   j   e   c   t   .   
                       *   
                       *       @   p   a   r   a   m       {   n   u   m   b   e   r   }       p   t   r   
                       *       @   p   a   r   a   m       {   n   u   m   b   e   r   =   }       m   a   x   B   y   t   e   s   T   o   R   e   a   d       -       A   n       o   p   t   i   o   n   a   l       l   e   n   g   t   h       t   h   a   t       s   p   e   c   i   f   i   e   s       t   h   e   
                       *               m   a   x   i   m   u   m       n   u   m   b   e   r       o   f       b   y   t   e   s       t   o       r   e   a   d   .       Y   o   u       c   a   n       o   m   i   t       t   h   i   s       p   a   r   a   m   e   t   e   r       t   o       s   c   a   n       t   h   e   
                       *               s   t   r   i   n   g       u   n   t   i   l       t   h   e       f   i   r   s   t       0       b   y   t   e   .       I   f       m   a   x   B   y   t   e   s   T   o   R   e   a   d       i   s       p   a   s   s   e   d   ,       a   n   d       t   h   e       s   t   r   i   n   g   
                       *               a   t       [   p   t   r   ,       p   t   r   +   m   a   x   B   y   t   e   s   T   o   R   e   a   d   r   [       c   o   n   t   a   i   n   s       a       n   u   l   l       b   y   t   e       i   n       t   h   e       m   i   d   d   l   e   ,       t   h   e   n       t   h   e   
                       *               s   t   r   i   n   g       w   i   l   l       c   u   t       s   h   o   r   t       a   t       t   h   a   t       b   y   t   e       i   n   d   e   x   .   
                       *       @   p   a   r   a   m       {   b   o   o   l   e   a   n   =   }       i   g   n   o   r   e   N   u   l       -       I   f       t   r   u   e   ,       t   h   e       f   u   n   c   t   i   o   n       w   i   l   l       n   o   t       s   t   o   p       o   n       a       N   U   L       c   h   a   r   a   c   t   e   r   .   
                       *       @   r   e   t   u   r   n       {   s   t   r   i   n   g   }   
                       *   /       v   a   r       U   T   F   8   T   o   S   t   r   i   n   g       =       (   p   t   r   ,       m   a   x   B   y   t   e   s   T   o   R   e   a   d   ,       i   g   n   o   r   e   N   u   l   )       =   >       {   
           a   s   s   e   r   t   (   t   y   p   e   o   f       p   t   r       =   =       "   n   u   m   b   e   r   "   ,       `   U   T   F   8   T   o   S   t   r   i   n   g       e   x   p   e   c   t   s       a       n   u   m   b   e   r       (   g   o   t       $   {   t   y   p   e   o   f       p   t   r   }   )   `   )   ;   
           r   e   t   u   r   n       p   t   r       ?       U   T   F   8   A   r   r   a   y   T   o   S   t   r   i   n   g   (   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   8   )   ,       p   t   r   ,       m   a   x   B   y   t   e   s   T   o   R   e   a   d   ,       i   g   n   o   r   e   N   u   l   )       :       "   "   ;   
   }   ;   
   
   v   a   r       _   _   _   a   s   s   e   r   t   _   f   a   i   l       =       (   c   o   n   d   i   t   i   o   n   ,       f   i   l   e   n   a   m   e   ,       l   i   n   e   ,       f   u   n   c   )       =   >       a   b   o   r   t   (   `   A   s   s   e   r   t   i   o   n       f   a   i   l   e   d   :       $   {   U   T   F   8   T   o   S   t   r   i   n   g   (   c   o   n   d   i   t   i   o   n   )   }   ,       a   t   :       `       +       [       f   i   l   e   n   a   m   e       ?       U   T   F   8   T   o   S   t   r   i   n   g   (   f   i   l   e   n   a   m   e   )       :       "   u   n   k   n   o   w   n       f   i   l   e   n   a   m   e   "   ,       l   i   n   e   ,       f   u   n   c       ?       U   T   F   8   T   o   S   t   r   i   n   g   (   f   u   n   c   )       :       "   u   n   k   n   o   w   n       f   u   n   c   t   i   o   n   "       ]   )   ;   
   
   v   a   r       e   x   c   e   p   t   i   o   n   C   a   u   g   h   t       =       [   ]   ;   
   
   v   a   r       u   n   c   a   u   g   h   t   E   x   c   e   p   t   i   o   n   C   o   u   n   t       =       0   ;   
   
   v   a   r       _   _   _   c   x   a   _   b   e   g   i   n   _   c   a   t   c   h       =       p   t   r       =   >       {   
           v   a   r       i   n   f   o       =       n   e   w       E   x   c   e   p   t   i   o   n   I   n   f   o   (   p   t   r   )   ;   
           i   f       (   !   i   n   f   o   .   g   e   t   _   c   a   u   g   h   t   (   )   )       {   
                   i   n   f   o   .   s   e   t   _   c   a   u   g   h   t   (   t   r   u   e   )   ;   
                   u   n   c   a   u   g   h   t   E   x   c   e   p   t   i   o   n   C   o   u   n   t   -   -   ;   
           }   
           i   n   f   o   .   s   e   t   _   r   e   t   h   r   o   w   n   (   f   a   l   s   e   )   ;   
           e   x   c   e   p   t   i   o   n   C   a   u   g   h   t   .   p   u   s   h   (   i   n   f   o   )   ;   
           _   _   _   c   x   a   _   i   n   c   r   e   m   e   n   t   _   e   x   c   e   p   t   i   o   n   _   r   e   f   c   o   u   n   t   (   p   t   r   )   ;   
           r   e   t   u   r   n       _   _   _   c   x   a   _   g   e   t   _   e   x   c   e   p   t   i   o   n   _   p   t   r   (   p   t   r   )   ;   
   }   ;   
   
   v   a   r       e   x   c   e   p   t   i   o   n   L   a   s   t       =       0   ;   
   
   v   a   r       _   _   _   c   x   a   _   e   n   d   _   c   a   t   c   h       =       (   )       =   >       {   
           /   /       C   l   e   a   r       s   t   a   t   e       f   l   a   g   .   
           _   s   e   t   T   h   r   e   w   (   0   ,       0   )   ;   
           a   s   s   e   r   t   (   e   x   c   e   p   t   i   o   n   C   a   u   g   h   t   .   l   e   n   g   t   h       >       0   )   ;   
           /   /       C   a   l   l       d   e   s   t   r   u   c   t   o   r       i   f       o   n   e       i   s       r   e   g   i   s   t   e   r   e   d       t   h   e   n       c   l   e   a   r       i   t   .   
           v   a   r       i   n   f   o       =       e   x   c   e   p   t   i   o   n   C   a   u   g   h   t   .   p   o   p   (   )   ;   
           _   _   _   c   x   a   _   d   e   c   r   e   m   e   n   t   _   e   x   c   e   p   t   i   o   n   _   r   e   f   c   o   u   n   t   (   i   n   f   o   .   e   x   c   P   t   r   )   ;   
           e   x   c   e   p   t   i   o   n   L   a   s   t       =       0   ;   
   }   ;   
   
   c   l   a   s   s       E   x   c   e   p   t   i   o   n   I   n   f   o       {   
           /   /       e   x   c   P   t   r       -       T   h   r   o   w   n       o   b   j   e   c   t       p   o   i   n   t   e   r       t   o       w   r   a   p   .       M   e   t   a   d   a   t   a       p   o   i   n   t   e   r       i   s       c   a   l   c   u   l   a   t   e   d       f   r   o   m       i   t   .   
           c   o   n   s   t   r   u   c   t   o   r   (   e   x   c   P   t   r   )       {   
                   t   h   i   s   .   e   x   c   P   t   r       =       e   x   c   P   t   r   ;   
                   t   h   i   s   .   p   t   r       =       e   x   c   P   t   r       -       2   4   ;   
           }   
           s   e   t   _   t   y   p   e   (   t   y   p   e   )       {   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   (   t   h   i   s   .   p   t   r   )       +       (   4   )   )       >   >       2   )   ]       =       t   y   p   e   ;   
           }   
           g   e   t   _   t   y   p   e   (   )       {   
                   r   e   t   u   r   n       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   (   t   h   i   s   .   p   t   r   )       +       (   4   )   )       >   >       2   )   ]   ;   
           }   
           s   e   t   _   d   e   s   t   r   u   c   t   o   r   (   d   e   s   t   r   u   c   t   o   r   )       {   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   (   t   h   i   s   .   p   t   r   )       +       (   8   )   )       >   >       2   )   ]       =       d   e   s   t   r   u   c   t   o   r   ;   
           }   
           g   e   t   _   d   e   s   t   r   u   c   t   o   r   (   )       {   
                   r   e   t   u   r   n       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   (   t   h   i   s   .   p   t   r   )       +       (   8   )   )       >   >       2   )   ]   ;   
           }   
           s   e   t   _   c   a   u   g   h   t   (   c   a   u   g   h   t   )       {   
                   c   a   u   g   h   t       =       c   a   u   g   h   t       ?       1       :       0   ;   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   8   )   [   (   t   h   i   s   .   p   t   r   )       +       (   1   2   )   ]       =       c   a   u   g   h   t   ;   
           }   
           g   e   t   _   c   a   u   g   h   t   (   )       {   
                   r   e   t   u   r   n       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   8   )   [   (   t   h   i   s   .   p   t   r   )       +       (   1   2   )   ]       !   =       0   ;   
           }   
           s   e   t   _   r   e   t   h   r   o   w   n   (   r   e   t   h   r   o   w   n   )       {   
                   r   e   t   h   r   o   w   n       =       r   e   t   h   r   o   w   n       ?       1       :       0   ;   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   8   )   [   (   t   h   i   s   .   p   t   r   )       +       (   1   3   )   ]       =       r   e   t   h   r   o   w   n   ;   
           }   
           g   e   t   _   r   e   t   h   r   o   w   n   (   )       {   
                   r   e   t   u   r   n       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   8   )   [   (   t   h   i   s   .   p   t   r   )       +       (   1   3   )   ]       !   =       0   ;   
           }   
           /   /       I   n   i   t   i   a   l   i   z   e       n   a   t   i   v   e       s   t   r   u   c   t   u   r   e       f   i   e   l   d   s   .       S   h   o   u   l   d       b   e       c   a   l   l   e   d       o   n   c   e       a   f   t   e   r       a   l   l   o   c   a   t   e   d   .   
           i   n   i   t   (   t   y   p   e   ,       d   e   s   t   r   u   c   t   o   r   )       {   
                   t   h   i   s   .   s   e   t   _   a   d   j   u   s   t   e   d   _   p   t   r   (   0   )   ;   
                   t   h   i   s   .   s   e   t   _   t   y   p   e   (   t   y   p   e   )   ;   
                   t   h   i   s   .   s   e   t   _   d   e   s   t   r   u   c   t   o   r   (   d   e   s   t   r   u   c   t   o   r   )   ;   
           }   
           s   e   t   _   a   d   j   u   s   t   e   d   _   p   t   r   (   a   d   j   u   s   t   e   d   P   t   r   )       {   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   (   t   h   i   s   .   p   t   r   )       +       (   1   6   )   )       >   >       2   )   ]       =       a   d   j   u   s   t   e   d   P   t   r   ;   
           }   
           g   e   t   _   a   d   j   u   s   t   e   d   _   p   t   r   (   )       {   
                   r   e   t   u   r   n       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   (   t   h   i   s   .   p   t   r   )       +       (   1   6   )   )       >   >       2   )   ]   ;   
           }   
   }   
   
   v   a   r       s   e   t   T   e   m   p   R   e   t   0       =       v   a   l       =   >       _   _   e   m   s   c   r   i   p   t   e   n   _   t   e   m   p   r   e   t   _   s   e   t   (   v   a   l   )   ;   
   
   v   a   r       f   i   n   d   M   a   t   c   h   i   n   g   C   a   t   c   h       =       a   r   g   s       =   >       {   
           v   a   r       t   h   r   o   w   n       =       e   x   c   e   p   t   i   o   n   L   a   s   t   ;   
           i   f       (   !   t   h   r   o   w   n   )       {   
                   /   /       j   u   s   t       p   a   s   s       t   h   r   o   u   g   h       t   h   e       n   u   l   l       p   t   r   
                   s   e   t   T   e   m   p   R   e   t   0   (   0   )   ;   
                   r   e   t   u   r   n       0   ;   
           }   
           v   a   r       i   n   f   o       =       n   e   w       E   x   c   e   p   t   i   o   n   I   n   f   o   (   t   h   r   o   w   n   )   ;   
           i   n   f   o   .   s   e   t   _   a   d   j   u   s   t   e   d   _   p   t   r   (   t   h   r   o   w   n   )   ;   
           v   a   r       t   h   r   o   w   n   T   y   p   e       =       i   n   f   o   .   g   e   t   _   t   y   p   e   (   )   ;   
           i   f       (   !   t   h   r   o   w   n   T   y   p   e   )       {   
                   /   /       j   u   s   t       p   a   s   s       t   h   r   o   u   g   h       t   h   e       t   h   r   o   w   n       p   t   r   
                   s   e   t   T   e   m   p   R   e   t   0   (   0   )   ;   
                   r   e   t   u   r   n       t   h   r   o   w   n   ;   
           }   
           /   /       c   a   n   _   c   a   t   c   h       r   e   c   e   i   v   e   s       a       *   *   ,       a   d   d       i   n   d   i   r   e   c   t   i   o   n   
           /   /       T   h   e       d   i   f   f   e   r   e   n   t       c   a   t   c   h       b   l   o   c   k   s       a   r   e       d   e   n   o   t   e   d       b   y       d   i   f   f   e   r   e   n   t       t   y   p   e   s   .   
           /   /       D   u   e       t   o       i   n   h   e   r   i   t   a   n   c   e   ,       t   h   o   s   e       t   y   p   e   s       m   a   y       n   o   t       p   r   e   c   i   s   e   l   y       m   a   t   c   h       t   h   e   
           /   /       t   y   p   e       o   f       t   h   e       t   h   r   o   w   n       o   b   j   e   c   t   .       F   i   n   d       o   n   e       w   h   i   c   h       m   a   t   c   h   e   s   ,       a   n   d   
           /   /       r   e   t   u   r   n       t   h   e       t   y   p   e       o   f       t   h   e       c   a   t   c   h       b   l   o   c   k       w   h   i   c   h       s   h   o   u   l   d       b   e       c   a   l   l   e   d   .   
           f   o   r       (   v   a   r       c   a   u   g   h   t   T   y   p   e       o   f       a   r   g   s   )       {   
                   i   f       (   c   a   u   g   h   t   T   y   p   e       =   =   =       0       |   |       c   a   u   g   h   t   T   y   p   e       =   =   =       t   h   r   o   w   n   T   y   p   e   )       {   
                           /   /       C   a   t   c   h       a   l   l       c   l   a   u   s   e       m   a   t   c   h   e   d       o   r       e   x   a   c   t   l   y       t   h   e       s   a   m   e       t   y   p   e       i   s       c   a   u   g   h   t   
                           b   r   e   a   k   ;   
                   }   
                   v   a   r       a   d   j   u   s   t   e   d   _   p   t   r   _   a   d   d   r       =       i   n   f   o   .   p   t   r       +       1   6   ;   
                   i   f       (   _   _   _   c   x   a   _   c   a   n   _   c   a   t   c   h   (   c   a   u   g   h   t   T   y   p   e   ,       t   h   r   o   w   n   T   y   p   e   ,       a   d   j   u   s   t   e   d   _   p   t   r   _   a   d   d   r   )   )       {   
                           s   e   t   T   e   m   p   R   e   t   0   (   c   a   u   g   h   t   T   y   p   e   )   ;   
                           r   e   t   u   r   n       t   h   r   o   w   n   ;   
                   }   
           }   
           s   e   t   T   e   m   p   R   e   t   0   (   t   h   r   o   w   n   T   y   p   e   )   ;   
           r   e   t   u   r   n       t   h   r   o   w   n   ;   
   }   ;   
   
   v   a   r       _   _   _   c   x   a   _   f   i   n   d   _   m   a   t   c   h   i   n   g   _   c   a   t   c   h   _   2       =       (   )       =   >       f   i   n   d   M   a   t   c   h   i   n   g   C   a   t   c   h   (   [   ]   )   ;   
   
   v   a   r       _   _   _   c   x   a   _   f   i   n   d   _   m   a   t   c   h   i   n   g   _   c   a   t   c   h   _   3       =       a   r   g   0       =   >       f   i   n   d   M   a   t   c   h   i   n   g   C   a   t   c   h   (   [       a   r   g   0       ]   )   ;   
   
   v   a   r       _   _   _   c   x   a   _   f   i   n   d   _   m   a   t   c   h   i   n   g   _   c   a   t   c   h   _   4       =       (   a   r   g   0   ,       a   r   g   1   )       =   >       f   i   n   d   M   a   t   c   h   i   n   g   C   a   t   c   h   (   [       a   r   g   0   ,       a   r   g   1       ]   )   ;   
   
   v   a   r       _   _   _   c   x   a   _   f   i   n   d   _   m   a   t   c   h   i   n   g   _   c   a   t   c   h   _   5       =       (   a   r   g   0   ,       a   r   g   1   ,       a   r   g   2   )       =   >       f   i   n   d   M   a   t   c   h   i   n   g   C   a   t   c   h   (   [       a   r   g   0   ,       a   r   g   1   ,       a   r   g   2       ]   )   ;   
   
   v   a   r       _   _   _   c   x   a   _   r   e   t   h   r   o   w       =       (   )       =   >       {   
           v   a   r       i   n   f   o       =       e   x   c   e   p   t   i   o   n   C   a   u   g   h   t   .   p   o   p   (   )   ;   
           i   f       (   !   i   n   f   o   )       {   
                   a   b   o   r   t   (   "   n   o       e   x   c   e   p   t   i   o   n       t   o       t   h   r   o   w   "   )   ;   
           }   
           v   a   r       p   t   r       =       i   n   f   o   .   e   x   c   P   t   r   ;   
           i   f       (   !   i   n   f   o   .   g   e   t   _   r   e   t   h   r   o   w   n   (   )   )       {   
                   /   /       O   n   l   y       p   o   p       i   f       t   h   e       c   o   r   r   e   s   p   o   n   d   i   n   g       p   u   s   h       w   a   s       t   h   r   o   u   g   h       r   e   t   h   r   o   w   _   p   r   i   m   a   r   y   _   e   x   c   e   p   t   i   o   n   
                   e   x   c   e   p   t   i   o   n   C   a   u   g   h   t   .   p   u   s   h   (   i   n   f   o   )   ;   
                   i   n   f   o   .   s   e   t   _   r   e   t   h   r   o   w   n   (   t   r   u   e   )   ;   
                   i   n   f   o   .   s   e   t   _   c   a   u   g   h   t   (   f   a   l   s   e   )   ;   
                   u   n   c   a   u   g   h   t   E   x   c   e   p   t   i   o   n   C   o   u   n   t   +   +   ;   
           }   
           e   x   c   e   p   t   i   o   n   L   a   s   t       =       p   t   r   ;   
           a   s   s   e   r   t   (   f   a   l   s   e   ,       "   E   x   c   e   p   t   i   o   n       t   h   r   o   w   n   ,       b   u   t       e   x   c   e   p   t   i   o   n       c   a   t   c   h   i   n   g       i   s       n   o   t       e   n   a   b   l   e   d   .       C   o   m   p   i   l   e       w   i   t   h       -   s   N   O   _   D   I   S   A   B   L   E   _   E   X   C   E   P   T   I   O   N   _   C   A   T   C   H   I   N   G       o   r       -   s   E   X   C   E   P   T   I   O   N   _   C   A   T   C   H   I   N   G   _   A   L   L   O   W   E   D   =   [   .   .   ]       t   o       c   a   t   c   h   .   "   )   ;   
   }   ;   
   
   v   a   r       _   _   _   c   x   a   _   t   h   r   o   w       =       (   p   t   r   ,       t   y   p   e   ,       d   e   s   t   r   u   c   t   o   r   )       =   >       {   
           v   a   r       i   n   f   o       =       n   e   w       E   x   c   e   p   t   i   o   n   I   n   f   o   (   p   t   r   )   ;   
           /   /       I   n   i   t   i   a   l   i   z   e       E   x   c   e   p   t   i   o   n   I   n   f   o       c   o   n   t   e   n   t       a   f   t   e   r       i   t       w   a   s       a   l   l   o   c   a   t   e   d       i   n       _   _   c   x   a   _   a   l   l   o   c   a   t   e   _   e   x   c   e   p   t   i   o   n   .   
           i   n   f   o   .   i   n   i   t   (   t   y   p   e   ,       d   e   s   t   r   u   c   t   o   r   )   ;   
           e   x   c   e   p   t   i   o   n   L   a   s   t       =       p   t   r   ;   
           u   n   c   a   u   g   h   t   E   x   c   e   p   t   i   o   n   C   o   u   n   t   +   +   ;   
           a   s   s   e   r   t   (   f   a   l   s   e   ,       "   E   x   c   e   p   t   i   o   n       t   h   r   o   w   n   ,       b   u   t       e   x   c   e   p   t   i   o   n       c   a   t   c   h   i   n   g       i   s       n   o   t       e   n   a   b   l   e   d   .       C   o   m   p   i   l   e       w   i   t   h       -   s   N   O   _   D   I   S   A   B   L   E   _   E   X   C   E   P   T   I   O   N   _   C   A   T   C   H   I   N   G       o   r       -   s   E   X   C   E   P   T   I   O   N   _   C   A   T   C   H   I   N   G   _   A   L   L   O   W   E   D   =   [   .   .   ]       t   o       c   a   t   c   h   .   "   )   ;   
   }   ;   
   
   v   a   r       _   _   _   r   e   s   u   m   e   E   x   c   e   p   t   i   o   n       =       p   t   r       =   >       {   
           i   f       (   !   e   x   c   e   p   t   i   o   n   L   a   s   t   )       {   
                   e   x   c   e   p   t   i   o   n   L   a   s   t       =       p   t   r   ;   
           }   
           a   s   s   e   r   t   (   f   a   l   s   e   ,       "   E   x   c   e   p   t   i   o   n       t   h   r   o   w   n   ,       b   u   t       e   x   c   e   p   t   i   o   n       c   a   t   c   h   i   n   g       i   s       n   o   t       e   n   a   b   l   e   d   .       C   o   m   p   i   l   e       w   i   t   h       -   s   N   O   _   D   I   S   A   B   L   E   _   E   X   C   E   P   T   I   O   N   _   C   A   T   C   H   I   N   G       o   r       -   s   E   X   C   E   P   T   I   O   N   _   C   A   T   C   H   I   N   G   _   A   L   L   O   W   E   D   =   [   .   .   ]       t   o       c   a   t   c   h   .   "   )   ;   
   }   ;   
   
   v   a   r       _   _   a   b   o   r   t   _   j   s       =       (   )       =   >       a   b   o   r   t   (   "   n   a   t   i   v   e       c   o   d   e       c   a   l   l   e   d       a   b   o   r   t   (   )   "   )   ;   
   
   v   a   r       A   s   c   i   i   T   o   S   t   r   i   n   g       =       p   t   r       =   >       {   
           v   a   r       s   t   r       =       "   "   ;   
           w   h   i   l   e       (   1   )       {   
                   v   a   r       c   h       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   8   )   [   p   t   r   +   +   ]   ;   
                   i   f       (   !   c   h   )       r   e   t   u   r   n       s   t   r   ;   
                   s   t   r       +   =       S   t   r   i   n   g   .   f   r   o   m   C   h   a   r   C   o   d   e   (   c   h   )   ;   
           }   
   }   ;   
   
   v   a   r       a   w   a   i   t   i   n   g   D   e   p   e   n   d   e   n   c   i   e   s       =       {   }   ;   
   
   v   a   r       r   e   g   i   s   t   e   r   e   d   T   y   p   e   s       =       {   }   ;   
   
   v   a   r       t   y   p   e   D   e   p   e   n   d   e   n   c   i   e   s       =       {   }   ;   
   
   v   a   r       B   i   n   d   i   n   g   E   r   r   o   r       =       c   l   a   s   s       B   i   n   d   i   n   g   E   r   r   o   r       e   x   t   e   n   d   s       E   r   r   o   r       {   
           c   o   n   s   t   r   u   c   t   o   r   (   m   e   s   s   a   g   e   )       {   
                   s   u   p   e   r   (   m   e   s   s   a   g   e   )   ;   
                   t   h   i   s   .   n   a   m   e       =       "   B   i   n   d   i   n   g   E   r   r   o   r   "   ;   
           }   
   }   ;   
   
   v   a   r       t   h   r   o   w   B   i   n   d   i   n   g   E   r   r   o   r       =       m   e   s   s   a   g   e       =   >       {   
           t   h   r   o   w       n   e   w       B   i   n   d   i   n   g   E   r   r   o   r   (   m   e   s   s   a   g   e   )   ;   
   }   ;   
   
   /   *   *       @   p   a   r   a   m       {   O   b   j   e   c   t   =   }       o   p   t   i   o   n   s       *   /       f   u   n   c   t   i   o   n       s   h   a   r   e   d   R   e   g   i   s   t   e   r   T   y   p   e   (   r   a   w   T   y   p   e   ,       r   e   g   i   s   t   e   r   e   d   I   n   s   t   a   n   c   e   ,       o   p   t   i   o   n   s       =       {   }   )       {   
           v   a   r       n   a   m   e       =       r   e   g   i   s   t   e   r   e   d   I   n   s   t   a   n   c   e   .   n   a   m   e   ;   
           i   f       (   !   r   a   w   T   y   p   e   )       {   
                   t   h   r   o   w   B   i   n   d   i   n   g   E   r   r   o   r   (   `   t   y   p   e       "   $   {   n   a   m   e   }   "       m   u   s   t       h   a   v   e       a       p   o   s   i   t   i   v   e       i   n   t   e   g   e   r       t   y   p   e   i   d       p   o   i   n   t   e   r   `   )   ;   
           }   
           i   f       (   r   e   g   i   s   t   e   r   e   d   T   y   p   e   s   .   h   a   s   O   w   n   P   r   o   p   e   r   t   y   (   r   a   w   T   y   p   e   )   )       {   
                   i   f       (   o   p   t   i   o   n   s   .   i   g   n   o   r   e   D   u   p   l   i   c   a   t   e   R   e   g   i   s   t   r   a   t   i   o   n   s   )       {   
                           r   e   t   u   r   n   ;   
                   }       e   l   s   e       {   
                           t   h   r   o   w   B   i   n   d   i   n   g   E   r   r   o   r   (   `   C   a   n   n   o   t       r   e   g   i   s   t   e   r       t   y   p   e       '   $   {   n   a   m   e   }   '       t   w   i   c   e   `   )   ;   
                   }   
           }   
           r   e   g   i   s   t   e   r   e   d   T   y   p   e   s   [   r   a   w   T   y   p   e   ]       =       r   e   g   i   s   t   e   r   e   d   I   n   s   t   a   n   c   e   ;   
           d   e   l   e   t   e       t   y   p   e   D   e   p   e   n   d   e   n   c   i   e   s   [   r   a   w   T   y   p   e   ]   ;   
           i   f       (   a   w   a   i   t   i   n   g   D   e   p   e   n   d   e   n   c   i   e   s   .   h   a   s   O   w   n   P   r   o   p   e   r   t   y   (   r   a   w   T   y   p   e   )   )       {   
                   v   a   r       c   a   l   l   b   a   c   k   s       =       a   w   a   i   t   i   n   g   D   e   p   e   n   d   e   n   c   i   e   s   [   r   a   w   T   y   p   e   ]   ;   
                   d   e   l   e   t   e       a   w   a   i   t   i   n   g   D   e   p   e   n   d   e   n   c   i   e   s   [   r   a   w   T   y   p   e   ]   ;   
                   c   a   l   l   b   a   c   k   s   .   f   o   r   E   a   c   h   (   c   b       =   >       c   b   (   )   )   ;   
           }   
   }   
   
   /   *   *       @   p   a   r   a   m       {   O   b   j   e   c   t   =   }       o   p   t   i   o   n   s       *   /       f   u   n   c   t   i   o   n       r   e   g   i   s   t   e   r   T   y   p   e   (   r   a   w   T   y   p   e   ,       r   e   g   i   s   t   e   r   e   d   I   n   s   t   a   n   c   e   ,       o   p   t   i   o   n   s       =       {   }   )       {   
           r   e   t   u   r   n       s   h   a   r   e   d   R   e   g   i   s   t   e   r   T   y   p   e   (   r   a   w   T   y   p   e   ,       r   e   g   i   s   t   e   r   e   d   I   n   s   t   a   n   c   e   ,       o   p   t   i   o   n   s   )   ;   
   }   
   
   v   a   r       i   n   t   e   g   e   r   R   e   a   d   V   a   l   u   e   F   r   o   m   P   o   i   n   t   e   r       =       (   n   a   m   e   ,       w   i   d   t   h   ,       s   i   g   n   e   d   )       =   >       {   
           /   /       i   n   t   e   g   e   r   s       a   r   e       q   u   i   t   e       c   o   m   m   o   n   ,       s   o       g   e   n   e   r   a   t   e       v   e   r   y       s   p   e   c   i   a   l   i   z   e   d       f   u   n   c   t   i   o   n   s   
           s   w   i   t   c   h       (   w   i   d   t   h   )       {   
               c   a   s   e       1   :   
                   r   e   t   u   r   n       s   i   g   n   e   d       ?       p   o   i   n   t   e   r       =   >       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   8   )   [   p   o   i   n   t   e   r   ]       :       p   o   i   n   t   e   r       =   >       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       
                   H   E   A   P   U   8   )   [   p   o   i   n   t   e   r   ]   ;   
   
               c   a   s   e       2   :   
                   r   e   t   u   r   n       s   i   g   n   e   d       ?       p   o   i   n   t   e   r       =   >       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   1   6   )   [   (   (   p   o   i   n   t   e   r   )       >   >       1   )   ]       :       p   o   i   n   t   e   r       =   >       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       
                   H   E   A   P   U   1   6   )   [   (   (   p   o   i   n   t   e   r   )       >   >       1   )   ]   ;   
   
               c   a   s   e       4   :   
                   r   e   t   u   r   n       s   i   g   n   e   d       ?       p   o   i   n   t   e   r       =   >       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   p   o   i   n   t   e   r   )       >   >       2   )   ]       :       p   o   i   n   t   e   r       =   >       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       
                   H   E   A   P   U   3   2   )   [   (   (   p   o   i   n   t   e   r   )       >   >       2   )   ]   ;   
   
               c   a   s   e       8   :   
                   r   e   t   u   r   n       s   i   g   n   e   d       ?       p   o   i   n   t   e   r       =   >       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   6   4   )   [   (   (   p   o   i   n   t   e   r   )       >   >       3   )   ]       :       p   o   i   n   t   e   r       =   >       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       
                   H   E   A   P   U   6   4   )   [   (   (   p   o   i   n   t   e   r   )       >   >       3   )   ]   ;   
   
               d   e   f   a   u   l   t   :   
                   t   h   r   o   w       n   e   w       T   y   p   e   E   r   r   o   r   (   `   i   n   v   a   l   i   d       i   n   t   e   g   e   r       w   i   d   t   h       (   $   {   w   i   d   t   h   }   )   :       $   {   n   a   m   e   }   `   )   ;   
           }   
   }   ;   
   
   v   a   r       e   m   b   i   n   d   R   e   p   r       =       v       =   >       {   
           i   f       (   v       =   =   =       n   u   l   l   )       {   
                   r   e   t   u   r   n       "   n   u   l   l   "   ;   
           }   
           v   a   r       t       =       t   y   p   e   o   f       v   ;   
           i   f       (   t       =   =   =       "   o   b   j   e   c   t   "       |   |       t       =   =   =       "   a   r   r   a   y   "       |   |       t       =   =   =       "   f   u   n   c   t   i   o   n   "   )       {   
                   r   e   t   u   r   n       v   .   t   o   S   t   r   i   n   g   (   )   ;   
           }       e   l   s   e       {   
                   r   e   t   u   r   n       "   "       +       v   ;   
           }   
   }   ;   
   
   v   a   r       a   s   s   e   r   t   I   n   t   e   g   e   r   R   a   n   g   e       =       (   t   y   p   e   N   a   m   e   ,       v   a   l   u   e   ,       m   i   n   R   a   n   g   e   ,       m   a   x   R   a   n   g   e   )       =   >       {   
           i   f       (   v   a   l   u   e       <       m   i   n   R   a   n   g   e       |   |       v   a   l   u   e       >       m   a   x   R   a   n   g   e   )       {   
                   t   h   r   o   w       n   e   w       T   y   p   e   E   r   r   o   r   (   `   P   a   s   s   i   n   g       a       n   u   m   b   e   r       "   $   {   e   m   b   i   n   d   R   e   p   r   (   v   a   l   u   e   )   }   "       f   r   o   m       J   S       s   i   d   e       t   o       C   /   C   +   +       s   i   d   e       t   o       a   n       a   r   g   u   m   e   n   t       o   f       t   y   p   e       "   $   {   t   y   p   e   N   a   m   e   }   "   ,       w   h   i   c   h       i   s       o   u   t   s   i   d   e       t   h   e       v   a   l   i   d       r   a   n   g   e       [   $   {   m   i   n   R   a   n   g   e   }   ,       $   {   m   a   x   R   a   n   g   e   }   ]   !   `   )   ;   
           }   
   }   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   g   l   o   b   a   l   T   h   i   s   }       *   /       v   a   r       _   _   e   m   b   i   n   d   _   r   e   g   i   s   t   e   r   _   b   i   g   i   n   t       =       (   p   r   i   m   i   t   i   v   e   T   y   p   e   ,       n   a   m   e   ,       s   i   z   e   ,       m   i   n   R   a   n   g   e   ,       m   a   x   R   a   n   g   e   )       =   >       {   
           n   a   m   e       =       A   s   c   i   i   T   o   S   t   r   i   n   g   (   n   a   m   e   )   ;   
           c   o   n   s   t       i   s   U   n   s   i   g   n   e   d   T   y   p   e       =       m   i   n   R   a   n   g   e       =   =   =       0   n   ;   
           l   e   t       f   r   o   m   W   i   r   e   T   y   p   e       =       v   a   l   u   e       =   >       v   a   l   u   e   ;   
           i   f       (   i   s   U   n   s   i   g   n   e   d   T   y   p   e   )       {   
                   /   /       u   i   n   t   6   4       g   e   t       c   o   n   v   e   r   t   e   d       t   o       i   n   t   6   4       i   n       A   B   I   ,       f   i   x       t   h   e   m       u   p       l   i   k   e       w   e       d   o       f   o   r       3   2   -   b   i   t       i   n   t   e   g   e   r   s   .   
                   c   o   n   s   t       b   i   t   S   i   z   e       =       s   i   z   e       *       8   ;   
                   f   r   o   m   W   i   r   e   T   y   p   e       =       v   a   l   u   e       =   >       B   i   g   I   n   t   .   a   s   U   i   n   t   N   (   b   i   t   S   i   z   e   ,       v   a   l   u   e   )   ;   
                   m   a   x   R   a   n   g   e       =       f   r   o   m   W   i   r   e   T   y   p   e   (   m   a   x   R   a   n   g   e   )   ;   
           }   
           r   e   g   i   s   t   e   r   T   y   p   e   (   p   r   i   m   i   t   i   v   e   T   y   p   e   ,       {   
                   n   a   m   e   ,   
                   "   f   r   o   m   W   i   r   e   T   y   p   e   "   :       f   r   o   m   W   i   r   e   T   y   p   e   ,   
                   "   t   o   W   i   r   e   T   y   p   e   "   :       (   d   e   s   t   r   u   c   t   o   r   s   ,       v   a   l   u   e   )       =   >       {   
                           i   f       (   t   y   p   e   o   f       v   a   l   u   e       =   =       "   n   u   m   b   e   r   "   )       {   
                                   v   a   l   u   e       =       B   i   g   I   n   t   (   v   a   l   u   e   )   ;   
                           }       e   l   s   e       i   f       (   t   y   p   e   o   f       v   a   l   u   e       !   =       "   b   i   g   i   n   t   "   )       {   
                                   t   h   r   o   w       n   e   w       T   y   p   e   E   r   r   o   r   (   `   C   a   n   n   o   t       c   o   n   v   e   r   t       "   $   {   e   m   b   i   n   d   R   e   p   r   (   v   a   l   u   e   )   }   "       t   o       $   {   t   h   i   s   .   n   a   m   e   }   `   )   ;   
                           }   
                           a   s   s   e   r   t   I   n   t   e   g   e   r   R   a   n   g   e   (   n   a   m   e   ,       v   a   l   u   e   ,       m   i   n   R   a   n   g   e   ,       m   a   x   R   a   n   g   e   )   ;   
                           r   e   t   u   r   n       v   a   l   u   e   ;   
                   }   ,   
                   "   r   e   a   d   V   a   l   u   e   F   r   o   m   P   o   i   n   t   e   r   "   :       i   n   t   e   g   e   r   R   e   a   d   V   a   l   u   e   F   r   o   m   P   o   i   n   t   e   r   (   n   a   m   e   ,       s   i   z   e   ,       !   i   s   U   n   s   i   g   n   e   d   T   y   p   e   )   ,   
                   d   e   s   t   r   u   c   t   o   r   F   u   n   c   t   i   o   n   :       n   u   l   l   
           }   )   ;   
   }   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   g   l   o   b   a   l   T   h   i   s   }       *   /       v   a   r       _   _   e   m   b   i   n   d   _   r   e   g   i   s   t   e   r   _   b   o   o   l       =       (   r   a   w   T   y   p   e   ,       n   a   m   e   ,       t   r   u   e   V   a   l   u   e   ,       f   a   l   s   e   V   a   l   u   e   )       =   >       {   
           n   a   m   e       =       A   s   c   i   i   T   o   S   t   r   i   n   g   (   n   a   m   e   )   ;   
           r   e   g   i   s   t   e   r   T   y   p   e   (   r   a   w   T   y   p   e   ,       {   
                   n   a   m   e   ,   
                   "   f   r   o   m   W   i   r   e   T   y   p   e   "   :       f   u   n   c   t   i   o   n   (   w   t   )       {   
                           /   /       a   m   b   i   g   u   o   u   s       e   m   s   c   r   i   p   t   e   n       A   B   I   :       s   o   m   e   t   i   m   e   s       r   e   t   u   r   n       v   a   l   u   e   s       a   r   e   
                           /   /       t   r   u   e       o   r       f   a   l   s   e   ,       a   n   d       s   o   m   e   t   i   m   e   s       i   n   t   e   g   e   r   s       (   0       o   r       1   )   
                           r   e   t   u   r   n       !   !   w   t   ;   
                   }   ,   
                   "   t   o   W   i   r   e   T   y   p   e   "   :       f   u   n   c   t   i   o   n   (   d   e   s   t   r   u   c   t   o   r   s   ,       o   )       {   
                           r   e   t   u   r   n       o       ?       t   r   u   e   V   a   l   u   e       :       f   a   l   s   e   V   a   l   u   e   ;   
                   }   ,   
                   "   r   e   a   d   V   a   l   u   e   F   r   o   m   P   o   i   n   t   e   r   "   :       f   u   n   c   t   i   o   n   (   p   o   i   n   t   e   r   )       {   
                           r   e   t   u   r   n       t   h   i   s   [   "   f   r   o   m   W   i   r   e   T   y   p   e   "   ]   (   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   8   )   [   p   o   i   n   t   e   r   ]   )   ;   
                   }   ,   
                   d   e   s   t   r   u   c   t   o   r   F   u   n   c   t   i   o   n   :       n   u   l   l   
           }   )   ;   
   }   ;   
   
   v   a   r       e   m   v   a   l   _   f   r   e   e   l   i   s   t       =       [   ]   ;   
   
   v   a   r       e   m   v   a   l   _   h   a   n   d   l   e   s       =       [       0   ,       1   ,       ,       1   ,       n   u   l   l   ,       1   ,       t   r   u   e   ,       1   ,       f   a   l   s   e   ,       1       ]   ;   
   
   v   a   r       _   _   e   m   v   a   l   _   d   e   c   r   e   f       =       h   a   n   d   l   e       =   >       {   
           i   f       (   h   a   n   d   l   e       >       9       &   &       0       =   =   =       -   -   e   m   v   a   l   _   h   a   n   d   l   e   s   [   h   a   n   d   l   e       +       1   ]   )       {   
                   a   s   s   e   r   t   (   e   m   v   a   l   _   h   a   n   d   l   e   s   [   h   a   n   d   l   e   ]       !   =   =       u   n   d   e   f   i   n   e   d   ,       `   D   e   c   r   e   f       f   o   r       u   n   a   l   l   o   c   a   t   e   d       h   a   n   d   l   e   .   `   )   ;   
                   e   m   v   a   l   _   h   a   n   d   l   e   s   [   h   a   n   d   l   e   ]       =       u   n   d   e   f   i   n   e   d   ;   
                   e   m   v   a   l   _   f   r   e   e   l   i   s   t   .   p   u   s   h   (   h   a   n   d   l   e   )   ;   
           }   
   }   ;   
   
   v   a   r       E   m   v   a   l       =       {   
           t   o   V   a   l   u   e   :       h   a   n   d   l   e       =   >       {   
                   i   f       (   !   h   a   n   d   l   e   )       {   
                           t   h   r   o   w   B   i   n   d   i   n   g   E   r   r   o   r   (   `   C   a   n   n   o   t       u   s   e       d   e   l   e   t   e   d       v   a   l   .       h   a   n   d   l   e       =       $   {   h   a   n   d   l   e   }   `   )   ;   
                   }   
                   /   /       h   a   n   d   l   e       2       i   s       s   u   p   p   o   s   e   d       t   o       b   e       `   u   n   d   e   f   i   n   e   d   `   .   
                   a   s   s   e   r   t   (   h   a   n   d   l   e       =   =   =       2       |   |       e   m   v   a   l   _   h   a   n   d   l   e   s   [   h   a   n   d   l   e   ]       !   =   =       u   n   d   e   f   i   n   e   d       &   &       h   a   n   d   l   e       %       2       =   =   =       0   ,       `   i   n   v   a   l   i   d       h   a   n   d   l   e   :       $   {   h   a   n   d   l   e   }   `   )   ;   
                   r   e   t   u   r   n       e   m   v   a   l   _   h   a   n   d   l   e   s   [   h   a   n   d   l   e   ]   ;   
           }   ,   
           t   o   H   a   n   d   l   e   :       v   a   l   u   e       =   >       {   
                   s   w   i   t   c   h       (   v   a   l   u   e   )       {   
                       c   a   s   e       u   n   d   e   f   i   n   e   d   :   
                           r   e   t   u   r   n       2   ;   
   
                       c   a   s   e       n   u   l   l   :   
                           r   e   t   u   r   n       4   ;   
   
                       c   a   s   e       t   r   u   e   :   
                           r   e   t   u   r   n       6   ;   
   
                       c   a   s   e       f   a   l   s   e   :   
                           r   e   t   u   r   n       8   ;   
   
                       d   e   f   a   u   l   t   :   
                           {   
                                   c   o   n   s   t       h   a   n   d   l   e       =       e   m   v   a   l   _   f   r   e   e   l   i   s   t   .   p   o   p   (   )       |   |       e   m   v   a   l   _   h   a   n   d   l   e   s   .   l   e   n   g   t   h   ;   
                                   e   m   v   a   l   _   h   a   n   d   l   e   s   [   h   a   n   d   l   e   ]       =       v   a   l   u   e   ;   
                                   e   m   v   a   l   _   h   a   n   d   l   e   s   [   h   a   n   d   l   e       +       1   ]       =       1   ;   
                                   r   e   t   u   r   n       h   a   n   d   l   e   ;   
                           }   
                   }   
           }   
   }   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   g   l   o   b   a   l   T   h   i   s   }       *   /       f   u   n   c   t   i   o   n       r   e   a   d   P   o   i   n   t   e   r   (   p   o   i   n   t   e   r   )       {   
           r   e   t   u   r   n       t   h   i   s   [   "   f   r   o   m   W   i   r   e   T   y   p   e   "   ]   (   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   p   o   i   n   t   e   r   )       >   >       2   )   ]   )   ;   
   }   
   
   v   a   r       E   m   V   a   l   T   y   p   e       =       {   
           n   a   m   e   :       "   e   m   s   c   r   i   p   t   e   n   :   :   v   a   l   "   ,   
           "   f   r   o   m   W   i   r   e   T   y   p   e   "   :       h   a   n   d   l   e       =   >       {   
                   v   a   r       r   v       =       E   m   v   a   l   .   t   o   V   a   l   u   e   (   h   a   n   d   l   e   )   ;   
                   _   _   e   m   v   a   l   _   d   e   c   r   e   f   (   h   a   n   d   l   e   )   ;   
                   r   e   t   u   r   n       r   v   ;   
           }   ,   
           "   t   o   W   i   r   e   T   y   p   e   "   :       (   d   e   s   t   r   u   c   t   o   r   s   ,       v   a   l   u   e   )       =   >       E   m   v   a   l   .   t   o   H   a   n   d   l   e   (   v   a   l   u   e   )   ,   
           "   r   e   a   d   V   a   l   u   e   F   r   o   m   P   o   i   n   t   e   r   "   :       r   e   a   d   P   o   i   n   t   e   r   ,   
           d   e   s   t   r   u   c   t   o   r   F   u   n   c   t   i   o   n   :       n   u   l   l   
   }   ;   
   
   v   a   r       _   _   e   m   b   i   n   d   _   r   e   g   i   s   t   e   r   _   e   m   v   a   l       =       r   a   w   T   y   p   e       =   >       r   e   g   i   s   t   e   r   T   y   p   e   (   r   a   w   T   y   p   e   ,       E   m   V   a   l   T   y   p   e   )   ;   
   
   v   a   r       f   l   o   a   t   R   e   a   d   V   a   l   u   e   F   r   o   m   P   o   i   n   t   e   r       =       (   n   a   m   e   ,       w   i   d   t   h   )       =   >       {   
           s   w   i   t   c   h       (   w   i   d   t   h   )       {   
               c   a   s   e       4   :   
                   r   e   t   u   r   n       f   u   n   c   t   i   o   n   (   p   o   i   n   t   e   r   )       {   
                           r   e   t   u   r   n       t   h   i   s   [   "   f   r   o   m   W   i   r   e   T   y   p   e   "   ]   (   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   F   3   2   )   [   (   (   p   o   i   n   t   e   r   )       >   >       2   )   ]   )   ;   
                   }   ;   
   
               c   a   s   e       8   :   
                   r   e   t   u   r   n       f   u   n   c   t   i   o   n   (   p   o   i   n   t   e   r   )       {   
                           r   e   t   u   r   n       t   h   i   s   [   "   f   r   o   m   W   i   r   e   T   y   p   e   "   ]   (   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   F   6   4   )   [   (   (   p   o   i   n   t   e   r   )       >   >       3   )   ]   )   ;   
                   }   ;   
   
               d   e   f   a   u   l   t   :   
                   t   h   r   o   w       n   e   w       T   y   p   e   E   r   r   o   r   (   `   i   n   v   a   l   i   d       f   l   o   a   t       w   i   d   t   h       (   $   {   w   i   d   t   h   }   )   :       $   {   n   a   m   e   }   `   )   ;   
           }   
   }   ;   
   
   v   a   r       _   _   e   m   b   i   n   d   _   r   e   g   i   s   t   e   r   _   f   l   o   a   t       =       (   r   a   w   T   y   p   e   ,       n   a   m   e   ,       s   i   z   e   )       =   >       {   
           n   a   m   e       =       A   s   c   i   i   T   o   S   t   r   i   n   g   (   n   a   m   e   )   ;   
           r   e   g   i   s   t   e   r   T   y   p   e   (   r   a   w   T   y   p   e   ,       {   
                   n   a   m   e   ,   
                   "   f   r   o   m   W   i   r   e   T   y   p   e   "   :       v   a   l   u   e       =   >       v   a   l   u   e   ,   
                   "   t   o   W   i   r   e   T   y   p   e   "   :       (   d   e   s   t   r   u   c   t   o   r   s   ,       v   a   l   u   e   )       =   >       {   
                           i   f       (   t   y   p   e   o   f       v   a   l   u   e       !   =       "   n   u   m   b   e   r   "       &   &       t   y   p   e   o   f       v   a   l   u   e       !   =       "   b   o   o   l   e   a   n   "   )       {   
                                   t   h   r   o   w       n   e   w       T   y   p   e   E   r   r   o   r   (   `   C   a   n   n   o   t       c   o   n   v   e   r   t       $   {   e   m   b   i   n   d   R   e   p   r   (   v   a   l   u   e   )   }       t   o       $   {   t   h   i   s   .   n   a   m   e   }   `   )   ;   
                           }   
                           /   /       T   h   e       V   M       w   i   l   l       p   e   r   f   o   r   m       J   S       t   o       W   a   s   m       v   a   l   u   e       c   o   n   v   e   r   s   i   o   n   ,       a   c   c   o   r   d   i   n   g       t   o       t   h   e       s   p   e   c   :   
                           /   /       h   t   t   p   s   :   /   /   w   w   w   .   w   3   .   o   r   g   /   T   R   /   w   a   s   m   -   j   s   -   a   p   i   -   1   /   #   t   o   w   e   b   a   s   s   e   m   b   l   y   v   a   l   u   e   
                           r   e   t   u   r   n       v   a   l   u   e   ;   
                   }   ,   
                   "   r   e   a   d   V   a   l   u   e   F   r   o   m   P   o   i   n   t   e   r   "   :       f   l   o   a   t   R   e   a   d   V   a   l   u   e   F   r   o   m   P   o   i   n   t   e   r   (   n   a   m   e   ,       s   i   z   e   )   ,   
                   d   e   s   t   r   u   c   t   o   r   F   u   n   c   t   i   o   n   :       n   u   l   l   
           }   )   ;   
   }   ;   
   
   v   a   r       c   r   e   a   t   e   N   a   m   e   d   F   u   n   c   t   i   o   n       =       (   n   a   m   e   ,       f   u   n   c   )       =   >       O   b   j   e   c   t   .   d   e   f   i   n   e   P   r   o   p   e   r   t   y   (   f   u   n   c   ,       "   n   a   m   e   "   ,       {   
           v   a   l   u   e   :       n   a   m   e   
   }   )   ;   
   
   v   a   r       r   u   n   D   e   s   t   r   u   c   t   o   r   s       =       d   e   s   t   r   u   c   t   o   r   s       =   >       {   
           w   h   i   l   e       (   d   e   s   t   r   u   c   t   o   r   s   .   l   e   n   g   t   h   )       {   
                   v   a   r       p   t   r       =       d   e   s   t   r   u   c   t   o   r   s   .   p   o   p   (   )   ;   
                   v   a   r       d   e   l       =       d   e   s   t   r   u   c   t   o   r   s   .   p   o   p   (   )   ;   
                   d   e   l   (   p   t   r   )   ;   
           }   
   }   ;   
   
   f   u   n   c   t   i   o   n       u   s   e   s   D   e   s   t   r   u   c   t   o   r   S   t   a   c   k   (   a   r   g   T   y   p   e   s   )       {   
           /   /       S   k   i   p       r   e   t   u   r   n       v   a   l   u   e       a   t       i   n   d   e   x       0       -       i   t   '   s       n   o   t       d   e   l   e   t   e   d       h   e   r   e   .   
           f   o   r       (   v   a   r       i       =       1   ;       i       <       a   r   g   T   y   p   e   s   .   l   e   n   g   t   h   ;       +   +   i   )       {   
                   /   /       T   h   e       t   y   p   e       d   o   e   s       n   o   t       d   e   f   i   n   e       a       d   e   s   t   r   u   c   t   o   r       f   u   n   c   t   i   o   n       -       m   u   s   t       u   s   e       d   y   n   a   m   i   c       s   t   a   c   k   
                   i   f       (   a   r   g   T   y   p   e   s   [   i   ]       !   =   =       n   u   l   l       &   &       a   r   g   T   y   p   e   s   [   i   ]   .   d   e   s   t   r   u   c   t   o   r   F   u   n   c   t   i   o   n       =   =   =       u   n   d   e   f   i   n   e   d   )       {   
                           r   e   t   u   r   n       t   r   u   e   ;   
                   }   
           }   
           r   e   t   u   r   n       f   a   l   s   e   ;   
   }   
   
   f   u   n   c   t   i   o   n       c   h   e   c   k   A   r   g   C   o   u   n   t   (   n   u   m   A   r   g   s   ,       m   i   n   A   r   g   s   ,       m   a   x   A   r   g   s   ,       h   u   m   a   n   N   a   m   e   ,       t   h   r   o   w   B   i   n   d   i   n   g   E   r   r   o   r   )       {   
           i   f       (   n   u   m   A   r   g   s       <       m   i   n   A   r   g   s       |   |       n   u   m   A   r   g   s       >       m   a   x   A   r   g   s   )       {   
                   v   a   r       a   r   g   C   o   u   n   t   M   e   s   s   a   g   e       =       m   i   n   A   r   g   s       =   =       m   a   x   A   r   g   s       ?       m   i   n   A   r   g   s       :       `   $   {   m   i   n   A   r   g   s   }       t   o       $   {   m   a   x   A   r   g   s   }   `   ;   
                   t   h   r   o   w   B   i   n   d   i   n   g   E   r   r   o   r   (   `   f   u   n   c   t   i   o   n       $   {   h   u   m   a   n   N   a   m   e   }       c   a   l   l   e   d       w   i   t   h       $   {   n   u   m   A   r   g   s   }       a   r   g   u   m   e   n   t   s   ,       e   x   p   e   c   t   e   d       $   {   a   r   g   C   o   u   n   t   M   e   s   s   a   g   e   }   `   )   ;   
           }   
   }   
   
   f   u   n   c   t   i   o   n       c   r   e   a   t   e   J   s   I   n   v   o   k   e   r   (   a   r   g   T   y   p   e   s   ,       i   s   C   l   a   s   s   M   e   t   h   o   d   F   u   n   c   ,       r   e   t   u   r   n   s   ,       i   s   A   s   y   n   c   )       {   
           v   a   r       n   e   e   d   s   D   e   s   t   r   u   c   t   o   r   S   t   a   c   k       =       u   s   e   s   D   e   s   t   r   u   c   t   o   r   S   t   a   c   k   (   a   r   g   T   y   p   e   s   )   ;   
           v   a   r       a   r   g   C   o   u   n   t       =       a   r   g   T   y   p   e   s   .   l   e   n   g   t   h       -       2   ;   
           v   a   r       a   r   g   s   L   i   s   t       =       [   ]   ;   
           v   a   r       a   r   g   s   L   i   s   t   W   i   r   e   d       =       [       "   f   n   "       ]   ;   
           i   f       (   i   s   C   l   a   s   s   M   e   t   h   o   d   F   u   n   c   )       {   
                   a   r   g   s   L   i   s   t   W   i   r   e   d   .   p   u   s   h   (   "   t   h   i   s   W   i   r   e   d   "   )   ;   
           }   
           f   o   r       (   v   a   r       i       =       0   ;       i       <       a   r   g   C   o   u   n   t   ;       +   +   i   )       {   
                   a   r   g   s   L   i   s   t   .   p   u   s   h   (   `   a   r   g   $   {   i   }   `   )   ;   
                   a   r   g   s   L   i   s   t   W   i   r   e   d   .   p   u   s   h   (   `   a   r   g   $   {   i   }   W   i   r   e   d   `   )   ;   
           }   
           a   r   g   s   L   i   s   t       =       a   r   g   s   L   i   s   t   .   j   o   i   n   (   "   ,   "   )   ;   
           a   r   g   s   L   i   s   t   W   i   r   e   d       =       a   r   g   s   L   i   s   t   W   i   r   e   d   .   j   o   i   n   (   "   ,   "   )   ;   
           v   a   r       i   n   v   o   k   e   r   F   n   B   o   d   y       =       `   r   e   t   u   r   n       f   u   n   c   t   i   o   n       (   $   {   a   r   g   s   L   i   s   t   }   )       {   \   n   `   ;   
           i   n   v   o   k   e   r   F   n   B   o   d   y       +   =       "   c   h   e   c   k   A   r   g   C   o   u   n   t   (   a   r   g   u   m   e   n   t   s   .   l   e   n   g   t   h   ,       m   i   n   A   r   g   s   ,       m   a   x   A   r   g   s   ,       h   u   m   a   n   N   a   m   e   ,       t   h   r   o   w   B   i   n   d   i   n   g   E   r   r   o   r   )   ;   \   n   "   ;   
           i   f       (   n   e   e   d   s   D   e   s   t   r   u   c   t   o   r   S   t   a   c   k   )       {   
                   i   n   v   o   k   e   r   F   n   B   o   d   y       +   =       "   v   a   r       d   e   s   t   r   u   c   t   o   r   s       =       [   ]   ;   \   n   "   ;   
           }   
           v   a   r       d   t   o   r   S   t   a   c   k       =       n   e   e   d   s   D   e   s   t   r   u   c   t   o   r   S   t   a   c   k       ?       "   d   e   s   t   r   u   c   t   o   r   s   "       :       "   n   u   l   l   "   ;   
           v   a   r       a   r   g   s   1       =       [       "   h   u   m   a   n   N   a   m   e   "   ,       "   t   h   r   o   w   B   i   n   d   i   n   g   E   r   r   o   r   "   ,       "   i   n   v   o   k   e   r   "   ,       "   f   n   "   ,       "   r   u   n   D   e   s   t   r   u   c   t   o   r   s   "   ,       "   r   e   t   T   y   p   e   "   ,       "   c   l   a   s   s   P   a   r   a   m   "       ]   ;   
           i   f       (   i   s   C   l   a   s   s   M   e   t   h   o   d   F   u   n   c   )       {   
                   i   n   v   o   k   e   r   F   n   B   o   d   y       +   =       `   v   a   r       t   h   i   s   W   i   r   e   d       =       c   l   a   s   s   P   a   r   a   m   [   '   t   o   W   i   r   e   T   y   p   e   '   ]   (   $   {   d   t   o   r   S   t   a   c   k   }   ,       t   h   i   s   )   ;   \   n   `   ;   
           }   
           f   o   r       (   v   a   r       i       =       0   ;       i       <       a   r   g   C   o   u   n   t   ;       +   +   i   )       {   
                   i   n   v   o   k   e   r   F   n   B   o   d   y       +   =       `   v   a   r       a   r   g   $   {   i   }   W   i   r   e   d       =       a   r   g   T   y   p   e   $   {   i   }   [   '   t   o   W   i   r   e   T   y   p   e   '   ]   (   $   {   d   t   o   r   S   t   a   c   k   }   ,       a   r   g   $   {   i   }   )   ;   \   n   `   ;   
                   a   r   g   s   1   .   p   u   s   h   (   `   a   r   g   T   y   p   e   $   {   i   }   `   )   ;   
           }   
           i   n   v   o   k   e   r   F   n   B   o   d   y       +   =       (   r   e   t   u   r   n   s       |   |       i   s   A   s   y   n   c       ?       "   v   a   r       r   v       =       "       :       "   "   )       +       `   i   n   v   o   k   e   r   (   $   {   a   r   g   s   L   i   s   t   W   i   r   e   d   }   )   ;   \   n   `   ;   
           v   a   r       r   e   t   u   r   n   V   a   l       =       r   e   t   u   r   n   s       ?       "   r   v   "       :       "   "   ;   
           i   f       (   n   e   e   d   s   D   e   s   t   r   u   c   t   o   r   S   t   a   c   k   )       {   
                   i   n   v   o   k   e   r   F   n   B   o   d   y       +   =       "   r   u   n   D   e   s   t   r   u   c   t   o   r   s   (   d   e   s   t   r   u   c   t   o   r   s   )   ;   \   n   "   ;   
           }       e   l   s   e       {   
                   f   o   r       (   v   a   r       i       =       i   s   C   l   a   s   s   M   e   t   h   o   d   F   u   n   c       ?       1       :       2   ;       i       <       a   r   g   T   y   p   e   s   .   l   e   n   g   t   h   ;       +   +   i   )       {   
                           /   /       S   k   i   p       r   e   t   u   r   n       v   a   l   u   e       a   t       i   n   d   e   x       0       -       i   t   '   s       n   o   t       d   e   l   e   t   e   d       h   e   r   e   .       A   l   s   o       s   k   i   p       c   l   a   s   s       t   y   p   e       i   f       n   o   t       a       m   e   t   h   o   d   .   
                           v   a   r       p   a   r   a   m   N   a   m   e       =       (   i       =   =   =       1       ?       "   t   h   i   s   W   i   r   e   d   "       :       (   "   a   r   g   "       +       (   i       -       2   )       +       "   W   i   r   e   d   "   )   )   ;   
                           i   f       (   a   r   g   T   y   p   e   s   [   i   ]   .   d   e   s   t   r   u   c   t   o   r   F   u   n   c   t   i   o   n       !   =   =       n   u   l   l   )       {   
                                   i   n   v   o   k   e   r   F   n   B   o   d   y       +   =       `   $   {   p   a   r   a   m   N   a   m   e   }   _   d   t   o   r   (   $   {   p   a   r   a   m   N   a   m   e   }   )   ;   \   n   `   ;   
                                   a   r   g   s   1   .   p   u   s   h   (   `   $   {   p   a   r   a   m   N   a   m   e   }   _   d   t   o   r   `   )   ;   
                           }   
                   }   
           }   
           i   f       (   r   e   t   u   r   n   s   )       {   
                   i   n   v   o   k   e   r   F   n   B   o   d   y       +   =       "   v   a   r       r   e   t       =       r   e   t   T   y   p   e   [   '   f   r   o   m   W   i   r   e   T   y   p   e   '   ]   (   r   v   )   ;   \   n   "       +       "   r   e   t   u   r   n       r   e   t   ;   \   n   "   ;   
           }       e   l   s   e       {   }   
           i   n   v   o   k   e   r   F   n   B   o   d   y       +   =       "   }   \   n   "   ;   
           a   r   g   s   1   .   p   u   s   h   (   "   c   h   e   c   k   A   r   g   C   o   u   n   t   "   ,       "   m   i   n   A   r   g   s   "   ,       "   m   a   x   A   r   g   s   "   )   ;   
           i   n   v   o   k   e   r   F   n   B   o   d   y       =       `   i   f       (   a   r   g   u   m   e   n   t   s   .   l   e   n   g   t   h       !   =   =       $   {   a   r   g   s   1   .   l   e   n   g   t   h   }   )   {       t   h   r   o   w       n   e   w       E   r   r   o   r   (   h   u   m   a   n   N   a   m   e       +       "   E   x   p   e   c   t   e   d       $   {   a   r   g   s   1   .   l   e   n   g   t   h   }       c   l   o   s   u   r   e       a   r   g   u   m   e   n   t   s       "       +       a   r   g   u   m   e   n   t   s   .   l   e   n   g   t   h       +       "       g   i   v   e   n   .   "   )   ;       }   \   n   $   {   i   n   v   o   k   e   r   F   n   B   o   d   y   }   `   ;   
           r   e   t   u   r   n       [       a   r   g   s   1   ,       i   n   v   o   k   e   r   F   n   B   o   d   y       ]   ;   
   }   
   
   f   u   n   c   t   i   o   n       g   e   t   R   e   q   u   i   r   e   d   A   r   g   C   o   u   n   t   (   a   r   g   T   y   p   e   s   )       {   
           v   a   r       r   e   q   u   i   r   e   d   A   r   g   C   o   u   n   t       =       a   r   g   T   y   p   e   s   .   l   e   n   g   t   h       -       2   ;   
           f   o   r       (   v   a   r       i       =       a   r   g   T   y   p   e   s   .   l   e   n   g   t   h       -       1   ;       i       >   =       2   ;       -   -   i   )       {   
                   i   f       (   !   a   r   g   T   y   p   e   s   [   i   ]   .   o   p   t   i   o   n   a   l   )       {   
                           b   r   e   a   k   ;   
                   }   
                   r   e   q   u   i   r   e   d   A   r   g   C   o   u   n   t   -   -   ;   
           }   
           r   e   t   u   r   n       r   e   q   u   i   r   e   d   A   r   g   C   o   u   n   t   ;   
   }   
   
   f   u   n   c   t   i   o   n       c   r   a   f   t   I   n   v   o   k   e   r   F   u   n   c   t   i   o   n   (   h   u   m   a   n   N   a   m   e   ,       a   r   g   T   y   p   e   s   ,       c   l   a   s   s   T   y   p   e   ,       c   p   p   I   n   v   o   k   e   r   F   u   n   c   ,       c   p   p   T   a   r   g   e   t   F   u   n   c   ,       /   *   *       b   o   o   l   e   a   n   =       *   /       i   s   A   s   y   n   c   )       {   
           /   /       h   u   m   a   n   N   a   m   e   :       a       h   u   m   a   n   -   r   e   a   d   a   b   l   e       s   t   r   i   n   g       n   a   m   e       f   o   r       t   h   e       f   u   n   c   t   i   o   n       t   o       b   e       g   e   n   e   r   a   t   e   d   .   
           /   /       a   r   g   T   y   p   e   s   :       A   n       a   r   r   a   y       t   h   a   t       c   o   n   t   a   i   n   s       t   h   e       e   m   b   i   n   d       t   y   p   e       o   b   j   e   c   t   s       f   o   r       a   l   l       t   y   p   e   s       i   n       t   h   e       f   u   n   c   t   i   o   n       s   i   g   n   a   t   u   r   e   .   
           /   /                   a   r   g   T   y   p   e   s   [   0   ]       i   s       t   h   e       t   y   p   e       o   b   j   e   c   t       f   o   r       t   h   e       f   u   n   c   t   i   o   n       r   e   t   u   r   n       v   a   l   u   e   .   
           /   /                   a   r   g   T   y   p   e   s   [   1   ]       i   s       t   h   e       t   y   p   e       o   b   j   e   c   t       f   o   r       f   u   n   c   t   i   o   n       t   h   i   s       o   b   j   e   c   t   /   c   l   a   s   s       t   y   p   e   ,       o   r       n   u   l   l       i   f       n   o   t       c   r   a   f   t   i   n   g       a   n       i   n   v   o   k   e   r       f   o   r       a       c   l   a   s   s       m   e   t   h   o   d   .   
           /   /                   a   r   g   T   y   p   e   s   [   2   .   .   .   ]       a   r   e       t   h   e       a   c   t   u   a   l       f   u   n   c   t   i   o   n       p   a   r   a   m   e   t   e   r   s   .   
           /   /       c   l   a   s   s   T   y   p   e   :       T   h   e       e   m   b   i   n   d       t   y   p   e       o   b   j   e   c   t       f   o   r       t   h   e       c   l   a   s   s       t   o       b   e       b   o   u   n   d   ,       o   r       n   u   l   l       i   f       t   h   i   s       i   s       n   o   t       a       m   e   t   h   o   d       o   f       a       c   l   a   s   s   .   
           /   /       c   p   p   I   n   v   o   k   e   r   F   u   n   c   :       J   S       F   u   n   c   t   i   o   n       o   b   j   e   c   t       t   o       t   h   e       C   +   +   -   s   i   d   e       f   u   n   c   t   i   o   n       t   h   a   t       i   n   t   e   r   o   p   s       i   n   t   o       C   +   +       c   o   d   e   .   
           /   /       c   p   p   T   a   r   g   e   t   F   u   n   c   :       F   u   n   c   t   i   o   n       p   o   i   n   t   e   r       (   a   n       i   n   t   e   g   e   r       t   o       F   U   N   C   T   I   O   N   _   T   A   B   L   E   )       t   o       t   h   e       t   a   r   g   e   t       C   +   +       f   u   n   c   t   i   o   n       t   h   e       c   p   p   I   n   v   o   k   e   r   F   u   n   c       w   i   l   l       e   n   d       u   p       c   a   l   l   i   n   g   .   
           /   /       i   s   A   s   y   n   c   :       O   p   t   i   o   n   a   l   .       I   f       t   r   u   e   ,       r   e   t   u   r   n   s       a   n       a   s   y   n   c       f   u   n   c   t   i   o   n   .       A   s   y   n   c       b   i   n   d   i   n   g   s       a   r   e       o   n   l   y       s   u   p   p   o   r   t   e   d       w   i   t   h       J   S   P   I   .   
           v   a   r       a   r   g   C   o   u   n   t       =       a   r   g   T   y   p   e   s   .   l   e   n   g   t   h   ;   
           i   f       (   a   r   g   C   o   u   n   t       <       2   )       {   
                   t   h   r   o   w   B   i   n   d   i   n   g   E   r   r   o   r   (   "   a   r   g   T   y   p   e   s       a   r   r   a   y       s   i   z   e       m   i   s   m   a   t   c   h   !       M   u   s   t       a   t       l   e   a   s   t       g   e   t       r   e   t   u   r   n       v   a   l   u   e       a   n   d       '   t   h   i   s   '       t   y   p   e   s   !   "   )   ;   
           }   
           a   s   s   e   r   t   (   !   i   s   A   s   y   n   c   ,       "   A   s   y   n   c       b   i   n   d   i   n   g   s       a   r   e       o   n   l   y       s   u   p   p   o   r   t   e   d       w   i   t   h       J   S   P   I   .   "   )   ;   
           v   a   r       i   s   C   l   a   s   s   M   e   t   h   o   d   F   u   n   c       =       (   a   r   g   T   y   p   e   s   [   1   ]       !   =   =       n   u   l   l       &   &       c   l   a   s   s   T   y   p   e       !   =   =       n   u   l   l   )   ;   
           /   /       F   r   e   e       f   u   n   c   t   i   o   n   s       w   i   t   h       s   i   g   n   a   t   u   r   e       "   v   o   i   d       f   u   n   c   t   i   o   n   (   )   "       d   o       n   o   t       n   e   e   d       a   n       i   n   v   o   k   e   r       t   h   a   t       m   a   r   s   h   a   l   l   s       b   e   t   w   e   e   n       w   i   r   e       t   y   p   e   s   .   
           /   /       T   O   D   O   :       T   h   i   s       o   m   i   t   s       a   r   g   u   m   e   n   t       c   o   u   n   t       c   h   e   c   k       -       e   n   a   b   l   e       o   n   l   y       a   t       -   O   3       o   r       s   i   m   i   l   a   r   .   
           /   /                   i   f       (   E   N   A   B   L   E   _   U   N   S   A   F   E   _   O   P   T   S       &   &       a   r   g   C   o   u   n   t       =   =       2       &   &       a   r   g   T   y   p   e   s   [   0   ]   .   n   a   m   e       =   =       "   v   o   i   d   "       &   &       !   i   s   C   l   a   s   s   M   e   t   h   o   d   F   u   n   c   )       {   
           /   /                               r   e   t   u   r   n       F   U   N   C   T   I   O   N   _   T   A   B   L   E   [   f   n   ]   ;   
           /   /                   }   
           /   /       D   e   t   e   r   m   i   n   e       i   f       w   e       n   e   e   d       t   o       u   s   e       a       d   y   n   a   m   i   c       s   t   a   c   k       t   o       s   t   o   r   e       t   h   e       d   e   s   t   r   u   c   t   o   r   s       f   o   r       t   h   e       f   u   n   c   t   i   o   n       p   a   r   a   m   e   t   e   r   s   .   
           /   /       T   O   D   O   :       R   e   m   o   v   e       t   h   i   s       c   o   m   p   l   e   t   e   l   y       o   n   c   e       a   l   l       f   u   n   c   t   i   o   n       i   n   v   o   k   e   r   s       a   r   e       b   e   i   n   g       d   y   n   a   m   i   c   a   l   l   y       g   e   n   e   r   a   t   e   d   .   
           v   a   r       n   e   e   d   s   D   e   s   t   r   u   c   t   o   r   S   t   a   c   k       =       u   s   e   s   D   e   s   t   r   u   c   t   o   r   S   t   a   c   k   (   a   r   g   T   y   p   e   s   )   ;   
           v   a   r       r   e   t   u   r   n   s       =       (   a   r   g   T   y   p   e   s   [   0   ]   .   n   a   m   e       !   =   =       "   v   o   i   d   "   )   ;   
           v   a   r       e   x   p   e   c   t   e   d   A   r   g   C   o   u   n   t       =       a   r   g   C   o   u   n   t       -       2   ;   
           v   a   r       m   i   n   A   r   g   s       =       g   e   t   R   e   q   u   i   r   e   d   A   r   g   C   o   u   n   t   (   a   r   g   T   y   p   e   s   )   ;   
           /   /       B   u   i   l   l   d       t   h   e       a   r   g   u   m   e   n   t   s       t   h   a   t       w   i   l   l       b   e       p   a   s   s   e   d       i   n   t   o       t   h   e       c   l   o   s   u   r   e       a   r   o   u   n   d       t   h   e       i   n   v   o   k   e   r   
           /   /       f   u   n   c   t   i   o   n   .   
           v   a   r       c   l   o   s   u   r   e   A   r   g   s       =       [       h   u   m   a   n   N   a   m   e   ,       t   h   r   o   w   B   i   n   d   i   n   g   E   r   r   o   r   ,       c   p   p   I   n   v   o   k   e   r   F   u   n   c   ,       c   p   p   T   a   r   g   e   t   F   u   n   c   ,       r   u   n   D   e   s   t   r   u   c   t   o   r   s   ,       a   r   g   T   y   p   e   s   [   0   ]   ,       a   r   g   T   y   p   e   s   [   1   ]       ]   ;   
           f   o   r       (   v   a   r       i       =       0   ;       i       <       a   r   g   C   o   u   n   t       -       2   ;       +   +   i   )       {   
                   c   l   o   s   u   r   e   A   r   g   s   .   p   u   s   h   (   a   r   g   T   y   p   e   s   [   i       +       2   ]   )   ;   
           }   
           i   f       (   !   n   e   e   d   s   D   e   s   t   r   u   c   t   o   r   S   t   a   c   k   )       {   
                   /   /       S   k   i   p       r   e   t   u   r   n       v   a   l   u   e       a   t       i   n   d   e   x       0       -       i   t   '   s       n   o   t       d   e   l   e   t   e   d       h   e   r   e   .       A   l   s   o       s   k   i   p       c   l   a   s   s       t   y   p   e       i   f       n   o   t       a       m   e   t   h   o   d   .   
                   f   o   r       (   v   a   r       i       =       i   s   C   l   a   s   s   M   e   t   h   o   d   F   u   n   c       ?       1       :       2   ;       i       <       a   r   g   T   y   p   e   s   .   l   e   n   g   t   h   ;       +   +   i   )       {   
                           i   f       (   a   r   g   T   y   p   e   s   [   i   ]   .   d   e   s   t   r   u   c   t   o   r   F   u   n   c   t   i   o   n       !   =   =       n   u   l   l   )       {   
                                   c   l   o   s   u   r   e   A   r   g   s   .   p   u   s   h   (   a   r   g   T   y   p   e   s   [   i   ]   .   d   e   s   t   r   u   c   t   o   r   F   u   n   c   t   i   o   n   )   ;   
                           }   
                   }   
           }   
           c   l   o   s   u   r   e   A   r   g   s   .   p   u   s   h   (   c   h   e   c   k   A   r   g   C   o   u   n   t   ,       m   i   n   A   r   g   s   ,       e   x   p   e   c   t   e   d   A   r   g   C   o   u   n   t   )   ;   
           l   e   t       [   a   r   g   s   ,       i   n   v   o   k   e   r   F   n   B   o   d   y   ]       =       c   r   e   a   t   e   J   s   I   n   v   o   k   e   r   (   a   r   g   T   y   p   e   s   ,       i   s   C   l   a   s   s   M   e   t   h   o   d   F   u   n   c   ,       r   e   t   u   r   n   s   ,       i   s   A   s   y   n   c   )   ;   
           v   a   r       i   n   v   o   k   e   r   F   n       =       n   e   w       F   u   n   c   t   i   o   n   (   .   .   .   a   r   g   s   ,       i   n   v   o   k   e   r   F   n   B   o   d   y   )   (   .   .   .   c   l   o   s   u   r   e   A   r   g   s   )   ;   
           r   e   t   u   r   n       c   r   e   a   t   e   N   a   m   e   d   F   u   n   c   t   i   o   n   (   h   u   m   a   n   N   a   m   e   ,       i   n   v   o   k   e   r   F   n   )   ;   
   }   
   
   v   a   r       e   n   s   u   r   e   O   v   e   r   l   o   a   d   T   a   b   l   e       =       (   p   r   o   t   o   ,       m   e   t   h   o   d   N   a   m   e   ,       h   u   m   a   n   N   a   m   e   )       =   >       {   
           i   f       (   u   n   d   e   f   i   n   e   d       =   =   =       p   r   o   t   o   [   m   e   t   h   o   d   N   a   m   e   ]   .   o   v   e   r   l   o   a   d   T   a   b   l   e   )       {   
                   v   a   r       p   r   e   v   F   u   n   c       =       p   r   o   t   o   [   m   e   t   h   o   d   N   a   m   e   ]   ;   
                   /   /       I   n   j   e   c   t       a   n       o   v   e   r   l   o   a   d       r   e   s   o   l   v   e   r       f   u   n   c   t   i   o   n       t   h   a   t       r   o   u   t   e   s       t   o       t   h   e       a   p   p   r   o   p   r   i   a   t   e       o   v   e   r   l   o   a   d       b   a   s   e   d       o   n       t   h   e       n   u   m   b   e   r       o   f       a   r   g   u   m   e   n   t   s   .   
                   p   r   o   t   o   [   m   e   t   h   o   d   N   a   m   e   ]       =       f   u   n   c   t   i   o   n   (   .   .   .   a   r   g   s   )       {   
                           /   /       T   O   D   O       T   h   i   s       c   h   e   c   k       c   a   n       b   e       r   e   m   o   v   e   d       i   n       -   O   3       l   e   v   e   l       "   u   n   s   a   f   e   "       o   p   t   i   m   i   z   a   t   i   o   n   s   .   
                           i   f       (   !   p   r   o   t   o   [   m   e   t   h   o   d   N   a   m   e   ]   .   o   v   e   r   l   o   a   d   T   a   b   l   e   .   h   a   s   O   w   n   P   r   o   p   e   r   t   y   (   a   r   g   s   .   l   e   n   g   t   h   )   )       {   
                                   t   h   r   o   w   B   i   n   d   i   n   g   E   r   r   o   r   (   `   F   u   n   c   t   i   o   n       '   $   {   h   u   m   a   n   N   a   m   e   }   '       c   a   l   l   e   d       w   i   t   h       a   n       i   n   v   a   l   i   d       n   u   m   b   e   r       o   f       a   r   g   u   m   e   n   t   s       (   $   {   a   r   g   s   .   l   e   n   g   t   h   }   )       -       e   x   p   e   c   t   s       o   n   e       o   f       (   $   {   p   r   o   t   o   [   m   e   t   h   o   d   N   a   m   e   ]   .   o   v   e   r   l   o   a   d   T   a   b   l   e   }   )   !   `   )   ;   
                           }   
                           r   e   t   u   r   n       p   r   o   t   o   [   m   e   t   h   o   d   N   a   m   e   ]   .   o   v   e   r   l   o   a   d   T   a   b   l   e   [   a   r   g   s   .   l   e   n   g   t   h   ]   .   a   p   p   l   y   (   t   h   i   s   ,       a   r   g   s   )   ;   
                   }   ;   
                   /   /       M   o   v   e       t   h   e       p   r   e   v   i   o   u   s       f   u   n   c   t   i   o   n       i   n   t   o       t   h   e       o   v   e   r   l   o   a   d       t   a   b   l   e   .   
                   p   r   o   t   o   [   m   e   t   h   o   d   N   a   m   e   ]   .   o   v   e   r   l   o   a   d   T   a   b   l   e       =       [   ]   ;   
                   p   r   o   t   o   [   m   e   t   h   o   d   N   a   m   e   ]   .   o   v   e   r   l   o   a   d   T   a   b   l   e   [   p   r   e   v   F   u   n   c   .   a   r   g   C   o   u   n   t   ]       =       p   r   e   v   F   u   n   c   ;   
           }   
   }   ;   
   
   /   *   *       @   p   a   r   a   m       {   n   u   m   b   e   r   =   }       n   u   m   A   r   g   u   m   e   n   t   s       *   /       v   a   r       e   x   p   o   s   e   P   u   b   l   i   c   S   y   m   b   o   l       =       (   n   a   m   e   ,       v   a   l   u   e   ,       n   u   m   A   r   g   u   m   e   n   t   s   )       =   >       {   
           i   f       (   M   o   d   u   l   e   .   h   a   s   O   w   n   P   r   o   p   e   r   t   y   (   n   a   m   e   )   )       {   
                   i   f       (   u   n   d   e   f   i   n   e   d       =   =   =       n   u   m   A   r   g   u   m   e   n   t   s       |   |       (   u   n   d   e   f   i   n   e   d       !   =   =       M   o   d   u   l   e   [   n   a   m   e   ]   .   o   v   e   r   l   o   a   d   T   a   b   l   e       &   &       u   n   d   e   f   i   n   e   d       !   =   =       M   o   d   u   l   e   [   n   a   m   e   ]   .   o   v   e   r   l   o   a   d   T   a   b   l   e   [   n   u   m   A   r   g   u   m   e   n   t   s   ]   )   )       {   
                           t   h   r   o   w   B   i   n   d   i   n   g   E   r   r   o   r   (   `   C   a   n   n   o   t       r   e   g   i   s   t   e   r       p   u   b   l   i   c       n   a   m   e       '   $   {   n   a   m   e   }   '       t   w   i   c   e   `   )   ;   
                   }   
                   /   /       W   e       a   r   e       e   x   p   o   s   i   n   g       a       f   u   n   c   t   i   o   n       w   i   t   h       t   h   e       s   a   m   e       n   a   m   e       a   s       a   n       e   x   i   s   t   i   n   g       f   u   n   c   t   i   o   n   .       C   r   e   a   t   e       a   n       o   v   e   r   l   o   a   d       t   a   b   l   e       a   n   d       a       f   u   n   c   t   i   o   n       s   e   l   e   c   t   o   r   
                   /   /       t   h   a   t       r   o   u   t   e   s       b   e   t   w   e   e   n       t   h   e       t   w   o   .   
                   e   n   s   u   r   e   O   v   e   r   l   o   a   d   T   a   b   l   e   (   M   o   d   u   l   e   ,       n   a   m   e   ,       n   a   m   e   )   ;   
                   i   f       (   M   o   d   u   l   e   [   n   a   m   e   ]   .   o   v   e   r   l   o   a   d   T   a   b   l   e   .   h   a   s   O   w   n   P   r   o   p   e   r   t   y   (   n   u   m   A   r   g   u   m   e   n   t   s   )   )       {   
                           t   h   r   o   w   B   i   n   d   i   n   g   E   r   r   o   r   (   `   C   a   n   n   o   t       r   e   g   i   s   t   e   r       m   u   l   t   i   p   l   e       o   v   e   r   l   o   a   d   s       o   f       a       f   u   n   c   t   i   o   n       w   i   t   h       t   h   e       s   a   m   e       n   u   m   b   e   r       o   f       a   r   g   u   m   e   n   t   s       (   $   {   n   u   m   A   r   g   u   m   e   n   t   s   }   )   !   `   )   ;   
                   }   
                   /   /       A   d   d       t   h   e       n   e   w       f   u   n   c   t   i   o   n       i   n   t   o       t   h   e       o   v   e   r   l   o   a   d       t   a   b   l   e   .   
                   M   o   d   u   l   e   [   n   a   m   e   ]   .   o   v   e   r   l   o   a   d   T   a   b   l   e   [   n   u   m   A   r   g   u   m   e   n   t   s   ]       =       v   a   l   u   e   ;   
           }       e   l   s   e       {   
                   M   o   d   u   l   e   [   n   a   m   e   ]       =       v   a   l   u   e   ;   
                   M   o   d   u   l   e   [   n   a   m   e   ]   .   a   r   g   C   o   u   n   t       =       n   u   m   A   r   g   u   m   e   n   t   s   ;   
           }   
   }   ;   
   
   v   a   r       h   e   a   p   3   2   V   e   c   t   o   r   T   o   A   r   r   a   y       =       (   c   o   u   n   t   ,       f   i   r   s   t   E   l   e   m   e   n   t   )       =   >       {   
           v   a   r       a   r   r   a   y       =       [   ]   ;   
           f   o   r       (   v   a   r       i       =       0   ;       i       <       c   o   u   n   t   ;       i   +   +   )       {   
                   /   /       T   O   D   O   (   h   t   t   p   s   :   /   /   g   i   t   h   u   b   .   c   o   m   /   e   m   s   c   r   i   p   t   e   n   -   c   o   r   e   /   e   m   s   c   r   i   p   t   e   n   /   i   s   s   u   e   s   /   1   7   3   1   0   )   :   
                   /   /       F   i   n   d       a       w   a   y       t   o       h   o   i   s   t       t   h   e       `   >   >       2   `       o   r       `   >   >       3   `       o   u   t       o   f       t   h   i   s       l   o   o   p   .   
                   a   r   r   a   y   .   p   u   s   h   (   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   (   f   i   r   s   t   E   l   e   m   e   n   t   )       +       (   i       *       4   )   )       >   >       2   )   ]   )   ;   
           }   
           r   e   t   u   r   n       a   r   r   a   y   ;   
   }   ;   
   
   v   a   r       I   n   t   e   r   n   a   l   E   r   r   o   r       =       c   l   a   s   s       I   n   t   e   r   n   a   l   E   r   r   o   r       e   x   t   e   n   d   s       E   r   r   o   r       {   
           c   o   n   s   t   r   u   c   t   o   r   (   m   e   s   s   a   g   e   )       {   
                   s   u   p   e   r   (   m   e   s   s   a   g   e   )   ;   
                   t   h   i   s   .   n   a   m   e       =       "   I   n   t   e   r   n   a   l   E   r   r   o   r   "   ;   
           }   
   }   ;   
   
   v   a   r       t   h   r   o   w   I   n   t   e   r   n   a   l   E   r   r   o   r       =       m   e   s   s   a   g   e       =   >       {   
           t   h   r   o   w       n   e   w       I   n   t   e   r   n   a   l   E   r   r   o   r   (   m   e   s   s   a   g   e   )   ;   
   }   ;   
   
   /   *   *       @   p   a   r   a   m       {   n   u   m   b   e   r   =   }       n   u   m   A   r   g   u   m   e   n   t   s       *   /       v   a   r       r   e   p   l   a   c   e   P   u   b   l   i   c   S   y   m   b   o   l       =       (   n   a   m   e   ,       v   a   l   u   e   ,       n   u   m   A   r   g   u   m   e   n   t   s   )       =   >       {   
           i   f       (   !   M   o   d   u   l   e   .   h   a   s   O   w   n   P   r   o   p   e   r   t   y   (   n   a   m   e   )   )       {   
                   t   h   r   o   w   I   n   t   e   r   n   a   l   E   r   r   o   r   (   "   R   e   p   l   a   c   i   n   g       n   o   n   e   x   i   s   t   e   n   t       p   u   b   l   i   c       s   y   m   b   o   l   "   )   ;   
           }   
           /   /       I   f       t   h   e   r   e   '   s       a   n       o   v   e   r   l   o   a   d       t   a   b   l   e       f   o   r       t   h   i   s       s   y   m   b   o   l   ,       r   e   p   l   a   c   e       t   h   e       s   y   m   b   o   l       i   n       t   h   e       o   v   e   r   l   o   a   d       t   a   b   l   e       i   n   s   t   e   a   d   .   
           i   f       (   u   n   d   e   f   i   n   e   d       !   =   =       M   o   d   u   l   e   [   n   a   m   e   ]   .   o   v   e   r   l   o   a   d   T   a   b   l   e       &   &       u   n   d   e   f   i   n   e   d       !   =   =       n   u   m   A   r   g   u   m   e   n   t   s   )       {   
                   M   o   d   u   l   e   [   n   a   m   e   ]   .   o   v   e   r   l   o   a   d   T   a   b   l   e   [   n   u   m   A   r   g   u   m   e   n   t   s   ]       =       v   a   l   u   e   ;   
           }       e   l   s   e       {   
                   M   o   d   u   l   e   [   n   a   m   e   ]       =       v   a   l   u   e   ;   
                   M   o   d   u   l   e   [   n   a   m   e   ]   .   a   r   g   C   o   u   n   t       =       n   u   m   A   r   g   u   m   e   n   t   s   ;   
           }   
   }   ;   
   
   v   a   r       e   m   b   i   n   d   _   _   r   e   q   u   i   r   e   F   u   n   c   t   i   o   n       =       (   s   i   g   n   a   t   u   r   e   ,       r   a   w   F   u   n   c   t   i   o   n   ,       i   s   A   s   y   n   c       =       f   a   l   s   e   )       =   >       {   
           a   s   s   e   r   t   (   !   i   s   A   s   y   n   c   ,       "   A   s   y   n   c       b   i   n   d   i   n   g   s       a   r   e       o   n   l   y       s   u   p   p   o   r   t   e   d       w   i   t   h       J   S   P   I   .   "   )   ;   
           s   i   g   n   a   t   u   r   e       =       A   s   c   i   i   T   o   S   t   r   i   n   g   (   s   i   g   n   a   t   u   r   e   )   ;   
           f   u   n   c   t   i   o   n       m   a   k   e   D   y   n   C   a   l   l   e   r   (   )       {   
                   v   a   r       r   t   n       =       g   e   t   W   a   s   m   T   a   b   l   e   E   n   t   r   y   (   r   a   w   F   u   n   c   t   i   o   n   )   ;   
                   r   e   t   u   r   n       r   t   n   ;   
           }   
           v   a   r       f   p       =       m   a   k   e   D   y   n   C   a   l   l   e   r   (   )   ;   
           i   f       (   t   y   p   e   o   f       f   p       !   =       "   f   u   n   c   t   i   o   n   "   )       {   
                   t   h   r   o   w   B   i   n   d   i   n   g   E   r   r   o   r   (   `   u   n   k   n   o   w   n       f   u   n   c   t   i   o   n       p   o   i   n   t   e   r       w   i   t   h       s   i   g   n   a   t   u   r   e       $   {   s   i   g   n   a   t   u   r   e   }   :       $   {   r   a   w   F   u   n   c   t   i   o   n   }   `   )   ;   
           }   
           r   e   t   u   r   n       f   p   ;   
   }   ;   
   
   c   l   a   s   s       U   n   b   o   u   n   d   T   y   p   e   E   r   r   o   r       e   x   t   e   n   d   s       E   r   r   o   r       {   }   
   
   v   a   r       g   e   t   T   y   p   e   N   a   m   e       =       t   y   p   e       =   >       {   
           v   a   r       p   t   r       =       _   _   _   g   e   t   T   y   p   e   N   a   m   e   (   t   y   p   e   )   ;   
           v   a   r       r   v       =       A   s   c   i   i   T   o   S   t   r   i   n   g   (   p   t   r   )   ;   
           _   f   r   e   e   (   p   t   r   )   ;   
           r   e   t   u   r   n       r   v   ;   
   }   ;   
   
   v   a   r       t   h   r   o   w   U   n   b   o   u   n   d   T   y   p   e   E   r   r   o   r       =       (   m   e   s   s   a   g   e   ,       t   y   p   e   s   )       =   >       {   
           v   a   r       u   n   b   o   u   n   d   T   y   p   e   s       =       [   ]   ;   
           v   a   r       s   e   e   n       =       {   }   ;   
           f   u   n   c   t   i   o   n       v   i   s   i   t   (   t   y   p   e   )       {   
                   i   f       (   s   e   e   n   [   t   y   p   e   ]   )       {   
                           r   e   t   u   r   n   ;   
                   }   
                   i   f       (   r   e   g   i   s   t   e   r   e   d   T   y   p   e   s   [   t   y   p   e   ]   )       {   
                           r   e   t   u   r   n   ;   
                   }   
                   i   f       (   t   y   p   e   D   e   p   e   n   d   e   n   c   i   e   s   [   t   y   p   e   ]   )       {   
                           t   y   p   e   D   e   p   e   n   d   e   n   c   i   e   s   [   t   y   p   e   ]   .   f   o   r   E   a   c   h   (   v   i   s   i   t   )   ;   
                           r   e   t   u   r   n   ;   
                   }   
                   u   n   b   o   u   n   d   T   y   p   e   s   .   p   u   s   h   (   t   y   p   e   )   ;   
                   s   e   e   n   [   t   y   p   e   ]       =       t   r   u   e   ;   
           }   
           t   y   p   e   s   .   f   o   r   E   a   c   h   (   v   i   s   i   t   )   ;   
           t   h   r   o   w       n   e   w       U   n   b   o   u   n   d   T   y   p   e   E   r   r   o   r   (   `   $   {   m   e   s   s   a   g   e   }   :       `       +       u   n   b   o   u   n   d   T   y   p   e   s   .   m   a   p   (   g   e   t   T   y   p   e   N   a   m   e   )   .   j   o   i   n   (   [       "   ,       "       ]   )   )   ;   
   }   ;   
   
   v   a   r       w   h   e   n   D   e   p   e   n   d   e   n   t   T   y   p   e   s   A   r   e   R   e   s   o   l   v   e   d       =       (   m   y   T   y   p   e   s   ,       d   e   p   e   n   d   e   n   t   T   y   p   e   s   ,       g   e   t   T   y   p   e   C   o   n   v   e   r   t   e   r   s   )       =   >       {   
           m   y   T   y   p   e   s   .   f   o   r   E   a   c   h   (   t   y   p   e       =   >       t   y   p   e   D   e   p   e   n   d   e   n   c   i   e   s   [   t   y   p   e   ]       =       d   e   p   e   n   d   e   n   t   T   y   p   e   s   )   ;   
           f   u   n   c   t   i   o   n       o   n   C   o   m   p   l   e   t   e   (   t   y   p   e   C   o   n   v   e   r   t   e   r   s   )       {   
                   v   a   r       m   y   T   y   p   e   C   o   n   v   e   r   t   e   r   s       =       g   e   t   T   y   p   e   C   o   n   v   e   r   t   e   r   s   (   t   y   p   e   C   o   n   v   e   r   t   e   r   s   )   ;   
                   i   f       (   m   y   T   y   p   e   C   o   n   v   e   r   t   e   r   s   .   l   e   n   g   t   h       !   =   =       m   y   T   y   p   e   s   .   l   e   n   g   t   h   )       {   
                           t   h   r   o   w   I   n   t   e   r   n   a   l   E   r   r   o   r   (   "   M   i   s   m   a   t   c   h   e   d       t   y   p   e       c   o   n   v   e   r   t   e   r       c   o   u   n   t   "   )   ;   
                   }   
                   f   o   r       (   v   a   r       i       =       0   ;       i       <       m   y   T   y   p   e   s   .   l   e   n   g   t   h   ;       +   +   i   )       {   
                           r   e   g   i   s   t   e   r   T   y   p   e   (   m   y   T   y   p   e   s   [   i   ]   ,       m   y   T   y   p   e   C   o   n   v   e   r   t   e   r   s   [   i   ]   )   ;   
                   }   
           }   
           v   a   r       t   y   p   e   C   o   n   v   e   r   t   e   r   s       =       n   e   w       A   r   r   a   y   (   d   e   p   e   n   d   e   n   t   T   y   p   e   s   .   l   e   n   g   t   h   )   ;   
           v   a   r       u   n   r   e   g   i   s   t   e   r   e   d   T   y   p   e   s       =       [   ]   ;   
           v   a   r       r   e   g   i   s   t   e   r   e   d       =       0   ;   
           d   e   p   e   n   d   e   n   t   T   y   p   e   s   .   f   o   r   E   a   c   h   (   (   d   t   ,       i   )       =   >       {   
                   i   f       (   r   e   g   i   s   t   e   r   e   d   T   y   p   e   s   .   h   a   s   O   w   n   P   r   o   p   e   r   t   y   (   d   t   )   )       {   
                           t   y   p   e   C   o   n   v   e   r   t   e   r   s   [   i   ]       =       r   e   g   i   s   t   e   r   e   d   T   y   p   e   s   [   d   t   ]   ;   
                   }       e   l   s   e       {   
                           u   n   r   e   g   i   s   t   e   r   e   d   T   y   p   e   s   .   p   u   s   h   (   d   t   )   ;   
                           i   f       (   !   a   w   a   i   t   i   n   g   D   e   p   e   n   d   e   n   c   i   e   s   .   h   a   s   O   w   n   P   r   o   p   e   r   t   y   (   d   t   )   )       {   
                                   a   w   a   i   t   i   n   g   D   e   p   e   n   d   e   n   c   i   e   s   [   d   t   ]       =       [   ]   ;   
                           }   
                           a   w   a   i   t   i   n   g   D   e   p   e   n   d   e   n   c   i   e   s   [   d   t   ]   .   p   u   s   h   (   (   )       =   >       {   
                                   t   y   p   e   C   o   n   v   e   r   t   e   r   s   [   i   ]       =       r   e   g   i   s   t   e   r   e   d   T   y   p   e   s   [   d   t   ]   ;   
                                   +   +   r   e   g   i   s   t   e   r   e   d   ;   
                                   i   f       (   r   e   g   i   s   t   e   r   e   d       =   =   =       u   n   r   e   g   i   s   t   e   r   e   d   T   y   p   e   s   .   l   e   n   g   t   h   )       {   
                                           o   n   C   o   m   p   l   e   t   e   (   t   y   p   e   C   o   n   v   e   r   t   e   r   s   )   ;   
                                   }   
                           }   )   ;   
                   }   
           }   )   ;   
           i   f       (   0       =   =   =       u   n   r   e   g   i   s   t   e   r   e   d   T   y   p   e   s   .   l   e   n   g   t   h   )       {   
                   o   n   C   o   m   p   l   e   t   e   (   t   y   p   e   C   o   n   v   e   r   t   e   r   s   )   ;   
           }   
   }   ;   
   
   v   a   r       g   e   t   F   u   n   c   t   i   o   n   N   a   m   e       =       s   i   g   n   a   t   u   r   e       =   >       {   
           s   i   g   n   a   t   u   r   e       =       s   i   g   n   a   t   u   r   e   .   t   r   i   m   (   )   ;   
           c   o   n   s   t       a   r   g   s   I   n   d   e   x       =       s   i   g   n   a   t   u   r   e   .   i   n   d   e   x   O   f   (   "   (   "   )   ;   
           i   f       (   a   r   g   s   I   n   d   e   x       =   =   =       -   1   )       r   e   t   u   r   n       s   i   g   n   a   t   u   r   e   ;   
           a   s   s   e   r   t   (   s   i   g   n   a   t   u   r   e   .   e   n   d   s   W   i   t   h   (   "   )   "   )   ,       "   P   a   r   e   n   t   h   e   s   e   s       f   o   r       a   r   g   u   m   e   n   t       n   a   m   e   s       s   h   o   u   l   d       m   a   t   c   h   .   "   )   ;   
           r   e   t   u   r   n       s   i   g   n   a   t   u   r   e   .   s   l   i   c   e   (   0   ,       a   r   g   s   I   n   d   e   x   )   ;   
   }   ;   
   
   v   a   r       _   _   e   m   b   i   n   d   _   r   e   g   i   s   t   e   r   _   f   u   n   c   t   i   o   n       =       (   n   a   m   e   ,       a   r   g   C   o   u   n   t   ,       r   a   w   A   r   g   T   y   p   e   s   A   d   d   r   ,       s   i   g   n   a   t   u   r   e   ,       r   a   w   I   n   v   o   k   e   r   ,       f   n   ,       i   s   A   s   y   n   c   ,       i   s   N   o   n   n   u   l   l   R   e   t   u   r   n   )       =   >       {   
           v   a   r       a   r   g   T   y   p   e   s       =       h   e   a   p   3   2   V   e   c   t   o   r   T   o   A   r   r   a   y   (   a   r   g   C   o   u   n   t   ,       r   a   w   A   r   g   T   y   p   e   s   A   d   d   r   )   ;   
           n   a   m   e       =       A   s   c   i   i   T   o   S   t   r   i   n   g   (   n   a   m   e   )   ;   
           n   a   m   e       =       g   e   t   F   u   n   c   t   i   o   n   N   a   m   e   (   n   a   m   e   )   ;   
           r   a   w   I   n   v   o   k   e   r       =       e   m   b   i   n   d   _   _   r   e   q   u   i   r   e   F   u   n   c   t   i   o   n   (   s   i   g   n   a   t   u   r   e   ,       r   a   w   I   n   v   o   k   e   r   ,       i   s   A   s   y   n   c   )   ;   
           e   x   p   o   s   e   P   u   b   l   i   c   S   y   m   b   o   l   (   n   a   m   e   ,       f   u   n   c   t   i   o   n   (   )       {   
                   t   h   r   o   w   U   n   b   o   u   n   d   T   y   p   e   E   r   r   o   r   (   `   C   a   n   n   o   t       c   a   l   l       $   {   n   a   m   e   }       d   u   e       t   o       u   n   b   o   u   n   d       t   y   p   e   s   `   ,       a   r   g   T   y   p   e   s   )   ;   
           }   ,       a   r   g   C   o   u   n   t       -       1   )   ;   
           w   h   e   n   D   e   p   e   n   d   e   n   t   T   y   p   e   s   A   r   e   R   e   s   o   l   v   e   d   (   [   ]   ,       a   r   g   T   y   p   e   s   ,       a   r   g   T   y   p   e   s       =   >       {   
                   v   a   r       i   n   v   o   k   e   r   A   r   g   s   A   r   r   a   y       =       [       a   r   g   T   y   p   e   s   [   0   ]   ,       n   u   l   l       ]   .   c   o   n   c   a   t   (   a   r   g   T   y   p   e   s   .   s   l   i   c   e   (   1   )   )   ;   
                   r   e   p   l   a   c   e   P   u   b   l   i   c   S   y   m   b   o   l   (   n   a   m   e   ,       c   r   a   f   t   I   n   v   o   k   e   r   F   u   n   c   t   i   o   n   (   n   a   m   e   ,       i   n   v   o   k   e   r   A   r   g   s   A   r   r   a   y   ,       n   u   l   l   ,       r   a   w   I   n   v   o   k   e   r   ,       f   n   ,       i   s   A   s   y   n   c   )   ,       a   r   g   C   o   u   n   t       -       1   )   ;   
                   r   e   t   u   r   n       [   ]   ;   
           }   )   ;   
   }   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   g   l   o   b   a   l   T   h   i   s   }       *   /       v   a   r       _   _   e   m   b   i   n   d   _   r   e   g   i   s   t   e   r   _   i   n   t   e   g   e   r       =       (   p   r   i   m   i   t   i   v   e   T   y   p   e   ,       n   a   m   e   ,       s   i   z   e   ,       m   i   n   R   a   n   g   e   ,       m   a   x   R   a   n   g   e   )       =   >       {   
           n   a   m   e       =       A   s   c   i   i   T   o   S   t   r   i   n   g   (   n   a   m   e   )   ;   
           c   o   n   s   t       i   s   U   n   s   i   g   n   e   d   T   y   p   e       =       m   i   n   R   a   n   g   e       =   =   =       0   ;   
           l   e   t       f   r   o   m   W   i   r   e   T   y   p   e       =       v   a   l   u   e       =   >       v   a   l   u   e   ;   
           i   f       (   i   s   U   n   s   i   g   n   e   d   T   y   p   e   )       {   
                   v   a   r       b   i   t   s   h   i   f   t       =       3   2       -       8       *       s   i   z   e   ;   
                   f   r   o   m   W   i   r   e   T   y   p   e       =       v   a   l   u   e       =   >       (   v   a   l   u   e       <   <       b   i   t   s   h   i   f   t   )       >   >   >       b   i   t   s   h   i   f   t   ;   
                   m   a   x   R   a   n   g   e       =       f   r   o   m   W   i   r   e   T   y   p   e   (   m   a   x   R   a   n   g   e   )   ;   
           }   
           r   e   g   i   s   t   e   r   T   y   p   e   (   p   r   i   m   i   t   i   v   e   T   y   p   e   ,       {   
                   n   a   m   e   ,   
                   "   f   r   o   m   W   i   r   e   T   y   p   e   "   :       f   r   o   m   W   i   r   e   T   y   p   e   ,   
                   "   t   o   W   i   r   e   T   y   p   e   "   :       (   d   e   s   t   r   u   c   t   o   r   s   ,       v   a   l   u   e   )       =   >       {   
                           i   f       (   t   y   p   e   o   f       v   a   l   u   e       !   =       "   n   u   m   b   e   r   "       &   &       t   y   p   e   o   f       v   a   l   u   e       !   =       "   b   o   o   l   e   a   n   "   )       {   
                                   t   h   r   o   w       n   e   w       T   y   p   e   E   r   r   o   r   (   `   C   a   n   n   o   t       c   o   n   v   e   r   t       "   $   {   e   m   b   i   n   d   R   e   p   r   (   v   a   l   u   e   )   }   "       t   o       $   {   n   a   m   e   }   `   )   ;   
                           }   
                           a   s   s   e   r   t   I   n   t   e   g   e   r   R   a   n   g   e   (   n   a   m   e   ,       v   a   l   u   e   ,       m   i   n   R   a   n   g   e   ,       m   a   x   R   a   n   g   e   )   ;   
                           /   /       T   h   e       V   M       w   i   l   l       p   e   r   f   o   r   m       J   S       t   o       W   a   s   m       v   a   l   u   e       c   o   n   v   e   r   s   i   o   n   ,       a   c   c   o   r   d   i   n   g       t   o       t   h   e       s   p   e   c   :   
                           /   /       h   t   t   p   s   :   /   /   w   w   w   .   w   3   .   o   r   g   /   T   R   /   w   a   s   m   -   j   s   -   a   p   i   -   1   /   #   t   o   w   e   b   a   s   s   e   m   b   l   y   v   a   l   u   e   
                           r   e   t   u   r   n       v   a   l   u   e   ;   
                   }   ,   
                   "   r   e   a   d   V   a   l   u   e   F   r   o   m   P   o   i   n   t   e   r   "   :       i   n   t   e   g   e   r   R   e   a   d   V   a   l   u   e   F   r   o   m   P   o   i   n   t   e   r   (   n   a   m   e   ,       s   i   z   e   ,       m   i   n   R   a   n   g   e       !   =   =       0   )   ,   
                   d   e   s   t   r   u   c   t   o   r   F   u   n   c   t   i   o   n   :       n   u   l   l   
           }   )   ;   
   }   ;   
   
   v   a   r       _   _   e   m   b   i   n   d   _   r   e   g   i   s   t   e   r   _   m   e   m   o   r   y   _   v   i   e   w       =       (   r   a   w   T   y   p   e   ,       d   a   t   a   T   y   p   e   I   n   d   e   x   ,       n   a   m   e   )       =   >       {   
           v   a   r       t   y   p   e   M   a   p   p   i   n   g       =       [       I   n   t   8   A   r   r   a   y   ,       U   i   n   t   8   A   r   r   a   y   ,       I   n   t   1   6   A   r   r   a   y   ,       U   i   n   t   1   6   A   r   r   a   y   ,       I   n   t   3   2   A   r   r   a   y   ,       U   i   n   t   3   2   A   r   r   a   y   ,       F   l   o   a   t   3   2   A   r   r   a   y   ,       F   l   o   a   t   6   4   A   r   r   a   y   ,       B   i   g   I   n   t   6   4   A   r   r   a   y   ,       B   i   g   U   i   n   t   6   4   A   r   r   a   y       ]   ;   
           v   a   r       T   A       =       t   y   p   e   M   a   p   p   i   n   g   [   d   a   t   a   T   y   p   e   I   n   d   e   x   ]   ;   
           f   u   n   c   t   i   o   n       d   e   c   o   d   e   M   e   m   o   r   y   V   i   e   w   (   h   a   n   d   l   e   )       {   
                   v   a   r       s   i   z   e       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   h   a   n   d   l   e   )       >   >       2   )   ]   ;   
                   v   a   r       d   a   t   a       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   (   h   a   n   d   l   e   )       +       (   4   )   )       >   >       2   )   ]   ;   
                   r   e   t   u   r   n       n   e   w       T   A   (   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   8   )   .   b   u   f   f   e   r   ,       d   a   t   a   ,       s   i   z   e   )   ;   
           }   
           n   a   m   e       =       A   s   c   i   i   T   o   S   t   r   i   n   g   (   n   a   m   e   )   ;   
           r   e   g   i   s   t   e   r   T   y   p   e   (   r   a   w   T   y   p   e   ,       {   
                   n   a   m   e   ,   
                   "   f   r   o   m   W   i   r   e   T   y   p   e   "   :       d   e   c   o   d   e   M   e   m   o   r   y   V   i   e   w   ,   
                   "   r   e   a   d   V   a   l   u   e   F   r   o   m   P   o   i   n   t   e   r   "   :       d   e   c   o   d   e   M   e   m   o   r   y   V   i   e   w   
           }   ,       {   
                   i   g   n   o   r   e   D   u   p   l   i   c   a   t   e   R   e   g   i   s   t   r   a   t   i   o   n   s   :       t   r   u   e   
           }   )   ;   
   }   ;   
   
   v   a   r       s   t   r   i   n   g   T   o   U   T   F   8   A   r   r   a   y       =       (   s   t   r   ,       h   e   a   p   ,       o   u   t   I   d   x   ,       m   a   x   B   y   t   e   s   T   o   W   r   i   t   e   )       =   >       {   
           a   s   s   e   r   t   (   t   y   p   e   o   f       s   t   r       =   =   =       "   s   t   r   i   n   g   "   ,       `   s   t   r   i   n   g   T   o   U   T   F   8   A   r   r   a   y       e   x   p   e   c   t   s       a       s   t   r   i   n   g       (   g   o   t       $   {   t   y   p   e   o   f       s   t   r   }   )   `   )   ;   
           /   /       P   a   r   a   m   e   t   e   r       m   a   x   B   y   t   e   s   T   o   W   r   i   t   e       i   s       n   o   t       o   p   t   i   o   n   a   l   .       N   e   g   a   t   i   v   e       v   a   l   u   e   s   ,       0   ,       n   u   l   l   ,   
           /   /       u   n   d   e   f   i   n   e   d       a   n   d       f   a   l   s   e       e   a   c   h       d   o   n   '   t       w   r   i   t   e       o   u   t       a   n   y       b   y   t   e   s   .   
           i   f       (   !   (   m   a   x   B   y   t   e   s   T   o   W   r   i   t   e       >       0   )   )       r   e   t   u   r   n       0   ;   
           v   a   r       s   t   a   r   t   I   d   x       =       o   u   t   I   d   x   ;   
           v   a   r       e   n   d   I   d   x       =       o   u   t   I   d   x       +       m   a   x   B   y   t   e   s   T   o   W   r   i   t   e       -       1   ;   
           /   /       -   1       f   o   r       s   t   r   i   n   g       n   u   l   l       t   e   r   m   i   n   a   t   o   r   .   
           f   o   r       (   v   a   r       i       =       0   ;       i       <       s   t   r   .   l   e   n   g   t   h   ;       +   +   i   )       {   
                   /   /       F   o   r       U   T   F   8       b   y   t   e       s   t   r   u   c   t   u   r   e   ,       s   e   e       h   t   t   p   :   /   /   e   n   .   w   i   k   i   p   e   d   i   a   .   o   r   g   /   w   i   k   i   /   U   T   F   -   8   #   D   e   s   c   r   i   p   t   i   o   n   
                   /   /       a   n   d       h   t   t   p   s   :   /   /   w   w   w   .   i   e   t   f   .   o   r   g   /   r   f   c   /   r   f   c   2   2   7   9   .   t   x   t   
                   /   /       a   n   d       h   t   t   p   s   :   /   /   t   o   o   l   s   .   i   e   t   f   .   o   r   g   /   h   t   m   l   /   r   f   c   3   6   2   9   
                   v   a   r       u       =       s   t   r   .   c   o   d   e   P   o   i   n   t   A   t   (   i   )   ;   
                   i   f       (   u       <   =       1   2   7   )       {   
                           i   f       (   o   u   t   I   d   x       >   =       e   n   d   I   d   x   )       b   r   e   a   k   ;   
                           h   e   a   p   [   o   u   t   I   d   x   +   +   ]       =       u   ;   
                   }       e   l   s   e       i   f       (   u       <   =       2   0   4   7   )       {   
                           i   f       (   o   u   t   I   d   x       +       1       >   =       e   n   d   I   d   x   )       b   r   e   a   k   ;   
                           h   e   a   p   [   o   u   t   I   d   x   +   +   ]       =       1   9   2       |       (   u       >   >       6   )   ;   
                           h   e   a   p   [   o   u   t   I   d   x   +   +   ]       =       1   2   8       |       (   u       &       6   3   )   ;   
                   }       e   l   s   e       i   f       (   u       <   =       6   5   5   3   5   )       {   
                           i   f       (   o   u   t   I   d   x       +       2       >   =       e   n   d   I   d   x   )       b   r   e   a   k   ;   
                           h   e   a   p   [   o   u   t   I   d   x   +   +   ]       =       2   2   4       |       (   u       >   >       1   2   )   ;   
                           h   e   a   p   [   o   u   t   I   d   x   +   +   ]       =       1   2   8       |       (   (   u       >   >       6   )       &       6   3   )   ;   
                           h   e   a   p   [   o   u   t   I   d   x   +   +   ]       =       1   2   8       |       (   u       &       6   3   )   ;   
                   }       e   l   s   e       {   
                           i   f       (   o   u   t   I   d   x       +       3       >   =       e   n   d   I   d   x   )       b   r   e   a   k   ;   
                           i   f       (   u       >       1   1   1   4   1   1   1   )       w   a   r   n   O   n   c   e   (   "   I   n   v   a   l   i   d       U   n   i   c   o   d   e       c   o   d   e       p   o   i   n   t       "       +       p   t   r   T   o   S   t   r   i   n   g   (   u   )       +       "       e   n   c   o   u   n   t   e   r   e   d       w   h   e   n       s   e   r   i   a   l   i   z   i   n   g       a       J   S       s   t   r   i   n   g       t   o       a       U   T   F   -   8       s   t   r   i   n   g       i   n       w   a   s   m       m   e   m   o   r   y   !       (   V   a   l   i   d       u   n   i   c   o   d   e       c   o   d   e       p   o   i   n   t   s       s   h   o   u   l   d       b   e       i   n       r   a   n   g   e       0   -   0   x   1   0   F   F   F   F   )   .   "   )   ;   
                           h   e   a   p   [   o   u   t   I   d   x   +   +   ]       =       2   4   0       |       (   u       >   >       1   8   )   ;   
                           h   e   a   p   [   o   u   t   I   d   x   +   +   ]       =       1   2   8       |       (   (   u       >   >       1   2   )       &       6   3   )   ;   
                           h   e   a   p   [   o   u   t   I   d   x   +   +   ]       =       1   2   8       |       (   (   u       >   >       6   )       &       6   3   )   ;   
                           h   e   a   p   [   o   u   t   I   d   x   +   +   ]       =       1   2   8       |       (   u       &       6   3   )   ;   
                           /   /       G   o   t   c   h   a   :       i   f       c   o   d   e   P   o   i   n   t       i   s       o   v   e   r       0   x   F   F   F   F   ,       i   t       i   s       r   e   p   r   e   s   e   n   t   e   d       a   s       a       s   u   r   r   o   g   a   t   e       p   a   i   r       i   n       U   T   F   -   1   6   .   
                           /   /       W   e       n   e   e   d       t   o       m   a   n   u   a   l   l   y       s   k   i   p       o   v   e   r       t   h   e       s   e   c   o   n   d       c   o   d   e       u   n   i   t       f   o   r       c   o   r   r   e   c   t       i   t   e   r   a   t   i   o   n   .   
                           i   +   +   ;   
                   }   
           }   
           /   /       N   u   l   l   -   t   e   r   m   i   n   a   t   e       t   h   e       p   o   i   n   t   e   r       t   o       t   h   e       b   u   f   f   e   r   .   
           h   e   a   p   [   o   u   t   I   d   x   ]       =       0   ;   
           r   e   t   u   r   n       o   u   t   I   d   x       -       s   t   a   r   t   I   d   x   ;   
   }   ;   
   
   v   a   r       s   t   r   i   n   g   T   o   U   T   F   8       =       (   s   t   r   ,       o   u   t   P   t   r   ,       m   a   x   B   y   t   e   s   T   o   W   r   i   t   e   )       =   >       {   
           a   s   s   e   r   t   (   t   y   p   e   o   f       m   a   x   B   y   t   e   s   T   o   W   r   i   t   e       =   =       "   n   u   m   b   e   r   "   ,       "   s   t   r   i   n   g   T   o   U   T   F   8   (   s   t   r   ,       o   u   t   P   t   r   ,       m   a   x   B   y   t   e   s   T   o   W   r   i   t   e   )       i   s       m   i   s   s   i   n   g       t   h   e       t   h   i   r   d       p   a   r   a   m   e   t   e   r       t   h   a   t       s   p   e   c   i   f   i   e   s       t   h   e       l   e   n   g   t   h       o   f       t   h   e       o   u   t   p   u   t       b   u   f   f   e   r   !   "   )   ;   
           r   e   t   u   r   n       s   t   r   i   n   g   T   o   U   T   F   8   A   r   r   a   y   (   s   t   r   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   8   )   ,       o   u   t   P   t   r   ,       m   a   x   B   y   t   e   s   T   o   W   r   i   t   e   )   ;   
   }   ;   
   
   v   a   r       l   e   n   g   t   h   B   y   t   e   s   U   T   F   8       =       s   t   r       =   >       {   
           v   a   r       l   e   n       =       0   ;   
           f   o   r       (   v   a   r       i       =       0   ;       i       <       s   t   r   .   l   e   n   g   t   h   ;       +   +   i   )       {   
                   /   /       G   o   t   c   h   a   :       c   h   a   r   C   o   d   e   A   t       r   e   t   u   r   n   s       a       1   6   -   b   i   t       w   o   r   d       t   h   a   t       i   s       a       U   T   F   -   1   6       e   n   c   o   d   e   d       c   o   d   e   
                   /   /       u   n   i   t   ,       n   o   t       a       U   n   i   c   o   d   e       c   o   d   e       p   o   i   n   t       o   f       t   h   e       c   h   a   r   a   c   t   e   r   !       S   o       d   e   c   o   d   e   
                   /   /       U   T   F   1   6   -   >   U   T   F   3   2   -   >   U   T   F   8   .   
                   /   /       S   e   e       h   t   t   p   :   /   /   u   n   i   c   o   d   e   .   o   r   g   /   f   a   q   /   u   t   f   _   b   o   m   .   h   t   m   l   #   u   t   f   1   6   -   3   
                   v   a   r       c       =       s   t   r   .   c   h   a   r   C   o   d   e   A   t   (   i   )   ;   
                   /   /       p   o   s   s   i   b   l   y       a       l   e   a   d       s   u   r   r   o   g   a   t   e   
                   i   f       (   c       <   =       1   2   7   )       {   
                           l   e   n   +   +   ;   
                   }       e   l   s   e       i   f       (   c       <   =       2   0   4   7   )       {   
                           l   e   n       +   =       2   ;   
                   }       e   l   s   e       i   f       (   c       >   =       5   5   2   9   6       &   &       c       <   =       5   7   3   4   3   )       {   
                           l   e   n       +   =       4   ;   
                           +   +   i   ;   
                   }       e   l   s   e       {   
                           l   e   n       +   =       3   ;   
                   }   
           }   
           r   e   t   u   r   n       l   e   n   ;   
   }   ;   
   
   v   a   r       _   _   e   m   b   i   n   d   _   r   e   g   i   s   t   e   r   _   s   t   d   _   s   t   r   i   n   g       =       (   r   a   w   T   y   p   e   ,       n   a   m   e   )       =   >       {   
           n   a   m   e       =       A   s   c   i   i   T   o   S   t   r   i   n   g   (   n   a   m   e   )   ;   
           v   a   r       s   t   d   S   t   r   i   n   g   I   s   U   T   F   8       =       t   r   u   e   ;   
           r   e   g   i   s   t   e   r   T   y   p   e   (   r   a   w   T   y   p   e   ,       {   
                   n   a   m   e   ,   
                   /   /       F   o   r       s   o   m   e       m   e   t   h   o   d       n   a   m   e   s       w   e       u   s   e       s   t   r   i   n   g       k   e   y   s       h   e   r   e       s   i   n   c   e       t   h   e   y       a   r   e       p   a   r   t       o   f   
                   /   /       t   h   e       p   u   b   l   i   c   /   e   x   t   e   r   n   a   l       A   P   I       a   n   d   /   o   r       u   s   e   d       b   y       t   h   e       r   u   n   t   i   m   e   -   g   e   n   e   r   a   t   e   d       c   o   d   e   .   
                   "   f   r   o   m   W   i   r   e   T   y   p   e   "   (   v   a   l   u   e   )       {   
                           v   a   r       l   e   n   g   t   h       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   v   a   l   u   e   )       >   >       2   )   ]   ;   
                           v   a   r       p   a   y   l   o   a   d       =       v   a   l   u   e       +       4   ;   
                           v   a   r       s   t   r   ;   
                           i   f       (   s   t   d   S   t   r   i   n   g   I   s   U   T   F   8   )       {   
                                   s   t   r       =       U   T   F   8   T   o   S   t   r   i   n   g   (   p   a   y   l   o   a   d   ,       l   e   n   g   t   h   ,       t   r   u   e   )   ;   
                           }       e   l   s   e       {   
                                   s   t   r       =       "   "   ;   
                                   f   o   r       (   v   a   r       i       =       0   ;       i       <       l   e   n   g   t   h   ;       +   +   i   )       {   
                                           s   t   r       +   =       S   t   r   i   n   g   .   f   r   o   m   C   h   a   r   C   o   d   e   (   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   8   )   [   p   a   y   l   o   a   d       +       i   ]   )   ;   
                                   }   
                           }   
                           _   f   r   e   e   (   v   a   l   u   e   )   ;   
                           r   e   t   u   r   n       s   t   r   ;   
                   }   ,   
                   "   t   o   W   i   r   e   T   y   p   e   "   (   d   e   s   t   r   u   c   t   o   r   s   ,       v   a   l   u   e   )       {   
                           i   f       (   v   a   l   u   e       i   n   s   t   a   n   c   e   o   f       A   r   r   a   y   B   u   f   f   e   r   )       {   
                                   v   a   l   u   e       =       n   e   w       U   i   n   t   8   A   r   r   a   y   (   v   a   l   u   e   )   ;   
                           }   
                           v   a   r       l   e   n   g   t   h   ;   
                           v   a   r       v   a   l   u   e   I   s   O   f   T   y   p   e   S   t   r   i   n   g       =       (   t   y   p   e   o   f       v   a   l   u   e       =   =       "   s   t   r   i   n   g   "   )   ;   
                           /   /       W   e       a   c   c   e   p   t       `   s   t   r   i   n   g   `       o   r       a   r   r   a   y       v   i   e   w   s       w   i   t   h       s   i   n   g   l   e       b   y   t   e       e   l   e   m   e   n   t   s   
                           i   f       (   !   (   v   a   l   u   e   I   s   O   f   T   y   p   e   S   t   r   i   n   g       |   |       (   A   r   r   a   y   B   u   f   f   e   r   .   i   s   V   i   e   w   (   v   a   l   u   e   )       &   &       v   a   l   u   e   .   B   Y   T   E   S   _   P   E   R   _   E   L   E   M   E   N   T       =   =       1   )   )   )       {   
                                   t   h   r   o   w   B   i   n   d   i   n   g   E   r   r   o   r   (   "   C   a   n   n   o   t       p   a   s   s       n   o   n   -   s   t   r   i   n   g       t   o       s   t   d   :   :   s   t   r   i   n   g   "   )   ;   
                           }   
                           i   f       (   s   t   d   S   t   r   i   n   g   I   s   U   T   F   8       &   &       v   a   l   u   e   I   s   O   f   T   y   p   e   S   t   r   i   n   g   )       {   
                                   l   e   n   g   t   h       =       l   e   n   g   t   h   B   y   t   e   s   U   T   F   8   (   v   a   l   u   e   )   ;   
                           }       e   l   s   e       {   
                                   l   e   n   g   t   h       =       v   a   l   u   e   .   l   e   n   g   t   h   ;   
                           }   
                           /   /       a   s   s   u   m   e   s       P   O   I   N   T   E   R   _   S   I   Z   E       a   l   i   g   n   m   e   n   t   
                           v   a   r       b   a   s   e       =       _   m   a   l   l   o   c   (   4       +       l   e   n   g   t   h       +       1   )   ;   
                           v   a   r       p   t   r       =       b   a   s   e       +       4   ;   
                           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   b   a   s   e   )       >   >       2   )   ]       =       l   e   n   g   t   h   ;   
                           i   f       (   v   a   l   u   e   I   s   O   f   T   y   p   e   S   t   r   i   n   g   )       {   
                                   i   f       (   s   t   d   S   t   r   i   n   g   I   s   U   T   F   8   )       {   
                                           s   t   r   i   n   g   T   o   U   T   F   8   (   v   a   l   u   e   ,       p   t   r   ,       l   e   n   g   t   h       +       1   )   ;   
                                   }       e   l   s   e       {   
                                           f   o   r       (   v   a   r       i       =       0   ;       i       <       l   e   n   g   t   h   ;       +   +   i   )       {   
                                                   v   a   r       c   h   a   r   C   o   d   e       =       v   a   l   u   e   .   c   h   a   r   C   o   d   e   A   t   (   i   )   ;   
                                                   i   f       (   c   h   a   r   C   o   d   e       >       2   5   5   )       {   
                                                           _   f   r   e   e   (   b   a   s   e   )   ;   
                                                           t   h   r   o   w   B   i   n   d   i   n   g   E   r   r   o   r   (   "   S   t   r   i   n   g       h   a   s       U   T   F   -   1   6       c   o   d   e       u   n   i   t   s       t   h   a   t       d   o       n   o   t       f   i   t       i   n       8       b   i   t   s   "   )   ;   
                                                   }   
                                                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   8   )   [   p   t   r       +       i   ]       =       c   h   a   r   C   o   d   e   ;   
                                           }   
                                   }   
                           }       e   l   s   e       {   
                                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   8   )   .   s   e   t   (   v   a   l   u   e   ,       p   t   r   )   ;   
                           }   
                           i   f       (   d   e   s   t   r   u   c   t   o   r   s       !   =   =       n   u   l   l   )       {   
                                   d   e   s   t   r   u   c   t   o   r   s   .   p   u   s   h   (   _   f   r   e   e   ,       b   a   s   e   )   ;   
                           }   
                           r   e   t   u   r   n       b   a   s   e   ;   
                   }   ,   
                   "   r   e   a   d   V   a   l   u   e   F   r   o   m   P   o   i   n   t   e   r   "   :       r   e   a   d   P   o   i   n   t   e   r   ,   
                   d   e   s   t   r   u   c   t   o   r   F   u   n   c   t   i   o   n   (   p   t   r   )       {   
                           _   f   r   e   e   (   p   t   r   )   ;   
                   }   
           }   )   ;   
   }   ;   
   
   v   a   r       U   T   F   1   6   D   e   c   o   d   e   r       =       t   y   p   e   o   f       T   e   x   t   D   e   c   o   d   e   r       !   =       "   u   n   d   e   f   i   n   e   d   "       ?       n   e   w       T   e   x   t   D   e   c   o   d   e   r   (   "   u   t   f   -   1   6   l   e   "   )       :       u   n   d   e   f   i   n   e   d   ;   
   
   v   a   r       U   T   F   1   6   T   o   S   t   r   i   n   g       =       (   p   t   r   ,       m   a   x   B   y   t   e   s   T   o   R   e   a   d   ,       i   g   n   o   r   e   N   u   l   )       =   >       {   
           a   s   s   e   r   t   (   p   t   r       %       2       =   =       0   ,       "   P   o   i   n   t   e   r       p   a   s   s   e   d       t   o       U   T   F   1   6   T   o   S   t   r   i   n   g       m   u   s   t       b   e       a   l   i   g   n   e   d       t   o       t   w   o       b   y   t   e   s   !   "   )   ;   
           v   a   r       i   d   x       =       (   (   p   t   r   )       >   >       1   )   ;   
           v   a   r       e   n   d   I   d   x       =       f   i   n   d   S   t   r   i   n   g   E   n   d   (   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   1   6   )   ,       i   d   x   ,       m   a   x   B   y   t   e   s   T   o   R   e   a   d       /       2   ,       i   g   n   o   r   e   N   u   l   )   ;   
           /   /       W   h   e   n       u   s   i   n   g       c   o   n   d   i   t   i   o   n   a   l       T   e   x   t   D   e   c   o   d   e   r   ,       s   k   i   p       i   t       f   o   r       s   h   o   r   t       s   t   r   i   n   g   s       a   s       t   h   e       o   v   e   r   h   e   a   d       o   f       t   h   e       n   a   t   i   v   e       c   a   l   l       i   s       n   o   t       w   o   r   t   h       i   t   .   
           i   f       (   e   n   d   I   d   x       -       i   d   x       >       1   6       &   &       U   T   F   1   6   D   e   c   o   d   e   r   )       r   e   t   u   r   n       U   T   F   1   6   D   e   c   o   d   e   r   .   d   e   c   o   d   e   (   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       
           H   E   A   P   U   1   6   )   .   b   u   f   f   e   r       i   n   s   t   a   n   c   e   o   f       A   r   r   a   y   B   u   f   f   e   r       ?       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   1   6   )   .   s   u   b   a   r   r   a   y   (   i   d   x   ,       e   n   d   I   d   x   )       :       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       
           H   E   A   P   U   1   6   )   .   s   l   i   c   e   (   i   d   x   ,       e   n   d   I   d   x   )   )   ;   
           /   /       F   a   l   l   b   a   c   k   :       d   e   c   o   d   e       w   i   t   h   o   u   t       U   T   F   1   6   D   e   c   o   d   e   r   
           v   a   r       s   t   r       =       "   "   ;   
           /   /       I   f       m   a   x   B   y   t   e   s   T   o   R   e   a   d       i   s       n   o   t       p   a   s   s   e   d       e   x   p   l   i   c   i   t   l   y   ,       i   t       w   i   l   l       b   e       u   n   d   e   f   i   n   e   d   ,       a   n   d       t   h   e   
           /   /       f   o   r   -   l   o   o   p   '   s       c   o   n   d   i   t   i   o   n       w   i   l   l       a   l   w   a   y   s       e   v   a   l   u   a   t   e       t   o       t   r   u   e   .       T   h   e       l   o   o   p       i   s       t   h   e   n   
           /   /       t   e   r   m   i   n   a   t   e   d       o   n       t   h   e       f   i   r   s   t       n   u   l   l       c   h   a   r   .   
           f   o   r       (   v   a   r       i       =       i   d   x   ;       /   /       I   f       b   u   i   l   d   i   n   g       w   i   t   h       T   e   x   t   D   e   c   o   d   e   r   ,       w   e       h   a   v   e       a   l   r   e   a   d   y       c   o   m   p   u   t   e   d       t   h   e       s   t   r   i   n   g       l   e   n   g   t   h   
           /   /       a   b   o   v   e   ,       s   o       t   e   s   t       l   o   o   p       e   n   d       c   o   n   d   i   t   i   o   n       a   g   a   i   n   s   t       t   h   a   t   
           i       <       e   n   d   I   d   x   ;       +   +   i   )       {   
                   v   a   r       c   o   d   e   U   n   i   t       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   1   6   )   [   i   ]   ;   
                   /   /       f   r   o   m   C   h   a   r   C   o   d   e       c   o   n   s   t   r   u   c   t   s       a       c   h   a   r   a   c   t   e   r       f   r   o   m       a       U   T   F   -   1   6       c   o   d   e       u   n   i   t   ,       s   o       w   e       c   a   n   
                   /   /       p   a   s   s       t   h   e       U   T   F   1   6       s   t   r   i   n   g       r   i   g   h   t       t   h   r   o   u   g   h   .   
                   s   t   r       +   =       S   t   r   i   n   g   .   f   r   o   m   C   h   a   r   C   o   d   e   (   c   o   d   e   U   n   i   t   )   ;   
           }   
           r   e   t   u   r   n       s   t   r   ;   
   }   ;   
   
   v   a   r       s   t   r   i   n   g   T   o   U   T   F   1   6       =       (   s   t   r   ,       o   u   t   P   t   r   ,       m   a   x   B   y   t   e   s   T   o   W   r   i   t   e   )       =   >       {   
           a   s   s   e   r   t   (   o   u   t   P   t   r       %       2       =   =       0   ,       "   P   o   i   n   t   e   r       p   a   s   s   e   d       t   o       s   t   r   i   n   g   T   o   U   T   F   1   6       m   u   s   t       b   e       a   l   i   g   n   e   d       t   o       t   w   o       b   y   t   e   s   !   "   )   ;   
           a   s   s   e   r   t   (   t   y   p   e   o   f       m   a   x   B   y   t   e   s   T   o   W   r   i   t   e       =   =       "   n   u   m   b   e   r   "   ,       "   s   t   r   i   n   g   T   o   U   T   F   1   6   (   s   t   r   ,       o   u   t   P   t   r   ,       m   a   x   B   y   t   e   s   T   o   W   r   i   t   e   )       i   s       m   i   s   s   i   n   g       t   h   e       t   h   i   r   d       p   a   r   a   m   e   t   e   r       t   h   a   t       s   p   e   c   i   f   i   e   s       t   h   e       l   e   n   g   t   h       o   f       t   h   e       o   u   t   p   u   t       b   u   f   f   e   r   !   "   )   ;   
           /   /       B   a   c   k   w   a   r   d   s       c   o   m   p   a   t   i   b   i   l   i   t   y   :       i   f       m   a   x       b   y   t   e   s       i   s       n   o   t       s   p   e   c   i   f   i   e   d   ,       a   s   s   u   m   e       u   n   s   a   f   e       u   n   b   o   u   n   d   e   d       w   r   i   t   e       i   s       a   l   l   o   w   e   d   .   
           m   a   x   B   y   t   e   s   T   o   W   r   i   t   e       ?   ?   =       2   1   4   7   4   8   3   6   4   7   ;   
           i   f       (   m   a   x   B   y   t   e   s   T   o   W   r   i   t   e       <       2   )       r   e   t   u   r   n       0   ;   
           m   a   x   B   y   t   e   s   T   o   W   r   i   t   e       -   =       2   ;   
           /   /       N   u   l   l       t   e   r   m   i   n   a   t   o   r   .   
           v   a   r       s   t   a   r   t   P   t   r       =       o   u   t   P   t   r   ;   
           v   a   r       n   u   m   C   h   a   r   s   T   o   W   r   i   t   e       =       (   m   a   x   B   y   t   e   s   T   o   W   r   i   t   e       <       s   t   r   .   l   e   n   g   t   h       *       2   )       ?       (   m   a   x   B   y   t   e   s   T   o   W   r   i   t   e       /       2   )       :       s   t   r   .   l   e   n   g   t   h   ;   
           f   o   r       (   v   a   r       i       =       0   ;       i       <       n   u   m   C   h   a   r   s   T   o   W   r   i   t   e   ;       +   +   i   )       {   
                   /   /       c   h   a   r   C   o   d   e   A   t       r   e   t   u   r   n   s       a       U   T   F   -   1   6       e   n   c   o   d   e   d       c   o   d   e       u   n   i   t   ,       s   o       i   t       c   a   n       b   e       d   i   r   e   c   t   l   y       w   r   i   t   t   e   n       t   o       t   h   e       H   E   A   P   .   
                   v   a   r       c   o   d   e   U   n   i   t       =       s   t   r   .   c   h   a   r   C   o   d   e   A   t   (   i   )   ;   
                   /   /       p   o   s   s   i   b   l   y       a       l   e   a   d       s   u   r   r   o   g   a   t   e   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   1   6   )   [   (   (   o   u   t   P   t   r   )       >   >       1   )   ]       =       c   o   d   e   U   n   i   t   ;   
                   o   u   t   P   t   r       +   =       2   ;   
           }   
           /   /       N   u   l   l   -   t   e   r   m   i   n   a   t   e       t   h   e       p   o   i   n   t   e   r       t   o       t   h   e       H   E   A   P   .   
           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   1   6   )   [   (   (   o   u   t   P   t   r   )       >   >       1   )   ]       =       0   ;   
           r   e   t   u   r   n       o   u   t   P   t   r       -       s   t   a   r   t   P   t   r   ;   
   }   ;   
   
   v   a   r       l   e   n   g   t   h   B   y   t   e   s   U   T   F   1   6       =       s   t   r       =   >       s   t   r   .   l   e   n   g   t   h       *       2   ;   
   
   v   a   r       U   T   F   3   2   T   o   S   t   r   i   n   g       =       (   p   t   r   ,       m   a   x   B   y   t   e   s   T   o   R   e   a   d   ,       i   g   n   o   r   e   N   u   l   )       =   >       {   
           a   s   s   e   r   t   (   p   t   r       %       4       =   =       0   ,       "   P   o   i   n   t   e   r       p   a   s   s   e   d       t   o       U   T   F   3   2   T   o   S   t   r   i   n   g       m   u   s   t       b   e       a   l   i   g   n   e   d       t   o       f   o   u   r       b   y   t   e   s   !   "   )   ;   
           v   a   r       s   t   r       =       "   "   ;   
           v   a   r       s   t   a   r   t   I   d   x       =       (   (   p   t   r   )       >   >       2   )   ;   
           /   /       I   f       m   a   x   B   y   t   e   s   T   o   R   e   a   d       i   s       n   o   t       p   a   s   s   e   d       e   x   p   l   i   c   i   t   l   y   ,       i   t       w   i   l   l       b   e       u   n   d   e   f   i   n   e   d   ,       a   n   d       t   h   i   s   
           /   /       w   i   l   l       a   l   w   a   y   s       e   v   a   l   u   a   t   e       t   o       t   r   u   e   .       T   h   i   s       s   a   v   e   s       o   n       c   o   d   e       s   i   z   e   .   
           f   o   r       (   v   a   r       i       =       0   ;       !   (   i       >   =       m   a   x   B   y   t   e   s   T   o   R   e   a   d       /       4   )   ;       i   +   +   )       {   
                   v   a   r       u   t   f   3   2       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   s   t   a   r   t   I   d   x       +       i   ]   ;   
                   i   f       (   !   u   t   f   3   2       &   &       !   i   g   n   o   r   e   N   u   l   )       b   r   e   a   k   ;   
                   s   t   r       +   =       S   t   r   i   n   g   .   f   r   o   m   C   o   d   e   P   o   i   n   t   (   u   t   f   3   2   )   ;   
           }   
           r   e   t   u   r   n       s   t   r   ;   
   }   ;   
   
   v   a   r       s   t   r   i   n   g   T   o   U   T   F   3   2       =       (   s   t   r   ,       o   u   t   P   t   r   ,       m   a   x   B   y   t   e   s   T   o   W   r   i   t   e   )       =   >       {   
           a   s   s   e   r   t   (   o   u   t   P   t   r       %       4       =   =       0   ,       "   P   o   i   n   t   e   r       p   a   s   s   e   d       t   o       s   t   r   i   n   g   T   o   U   T   F   3   2       m   u   s   t       b   e       a   l   i   g   n   e   d       t   o       f   o   u   r       b   y   t   e   s   !   "   )   ;   
           a   s   s   e   r   t   (   t   y   p   e   o   f       m   a   x   B   y   t   e   s   T   o   W   r   i   t   e       =   =       "   n   u   m   b   e   r   "   ,       "   s   t   r   i   n   g   T   o   U   T   F   3   2   (   s   t   r   ,       o   u   t   P   t   r   ,       m   a   x   B   y   t   e   s   T   o   W   r   i   t   e   )       i   s       m   i   s   s   i   n   g       t   h   e       t   h   i   r   d       p   a   r   a   m   e   t   e   r       t   h   a   t       s   p   e   c   i   f   i   e   s       t   h   e       l   e   n   g   t   h       o   f       t   h   e       o   u   t   p   u   t       b   u   f   f   e   r   !   "   )   ;   
           /   /       B   a   c   k   w   a   r   d   s       c   o   m   p   a   t   i   b   i   l   i   t   y   :       i   f       m   a   x       b   y   t   e   s       i   s       n   o   t       s   p   e   c   i   f   i   e   d   ,       a   s   s   u   m   e       u   n   s   a   f   e       u   n   b   o   u   n   d   e   d       w   r   i   t   e       i   s       a   l   l   o   w   e   d   .   
           m   a   x   B   y   t   e   s   T   o   W   r   i   t   e       ?   ?   =       2   1   4   7   4   8   3   6   4   7   ;   
           i   f       (   m   a   x   B   y   t   e   s   T   o   W   r   i   t   e       <       4   )       r   e   t   u   r   n       0   ;   
           v   a   r       s   t   a   r   t   P   t   r       =       o   u   t   P   t   r   ;   
           v   a   r       e   n   d   P   t   r       =       s   t   a   r   t   P   t   r       +       m   a   x   B   y   t   e   s   T   o   W   r   i   t   e       -       4   ;   
           f   o   r       (   v   a   r       i       =       0   ;       i       <       s   t   r   .   l   e   n   g   t   h   ;       +   +   i   )       {   
                   v   a   r       c   o   d   e   P   o   i   n   t       =       s   t   r   .   c   o   d   e   P   o   i   n   t   A   t   (   i   )   ;   
                   /   /       G   o   t   c   h   a   :       i   f       c   o   d   e   P   o   i   n   t       i   s       o   v   e   r       0   x   F   F   F   F   ,       i   t       i   s       r   e   p   r   e   s   e   n   t   e   d       a   s       a       s   u   r   r   o   g   a   t   e       p   a   i   r       i   n       U   T   F   -   1   6   .   
                   /   /       W   e       n   e   e   d       t   o       m   a   n   u   a   l   l   y       s   k   i   p       o   v   e   r       t   h   e       s   e   c   o   n   d       c   o   d   e       u   n   i   t       f   o   r       c   o   r   r   e   c   t       i   t   e   r   a   t   i   o   n   .   
                   i   f       (   c   o   d   e   P   o   i   n   t       >       6   5   5   3   5   )       {   
                           i   +   +   ;   
                   }   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   o   u   t   P   t   r   )       >   >       2   )   ]       =       c   o   d   e   P   o   i   n   t   ;   
                   o   u   t   P   t   r       +   =       4   ;   
                   i   f       (   o   u   t   P   t   r       +       4       >       e   n   d   P   t   r   )       b   r   e   a   k   ;   
           }   
           /   /       N   u   l   l   -   t   e   r   m   i   n   a   t   e       t   h   e       p   o   i   n   t   e   r       t   o       t   h   e       H   E   A   P   .   
           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   o   u   t   P   t   r   )       >   >       2   )   ]       =       0   ;   
           r   e   t   u   r   n       o   u   t   P   t   r       -       s   t   a   r   t   P   t   r   ;   
   }   ;   
   
   v   a   r       l   e   n   g   t   h   B   y   t   e   s   U   T   F   3   2       =       s   t   r       =   >       {   
           v   a   r       l   e   n       =       0   ;   
           f   o   r       (   v   a   r       i       =       0   ;       i       <       s   t   r   .   l   e   n   g   t   h   ;       +   +   i   )       {   
                   v   a   r       c   o   d   e   P   o   i   n   t       =       s   t   r   .   c   o   d   e   P   o   i   n   t   A   t   (   i   )   ;   
                   /   /       G   o   t   c   h   a   :       i   f       c   o   d   e   P   o   i   n   t       i   s       o   v   e   r       0   x   F   F   F   F   ,       i   t       i   s       r   e   p   r   e   s   e   n   t   e   d       a   s       a       s   u   r   r   o   g   a   t   e       p   a   i   r       i   n       U   T   F   -   1   6   .   
                   /   /       W   e       n   e   e   d       t   o       m   a   n   u   a   l   l   y       s   k   i   p       o   v   e   r       t   h   e       s   e   c   o   n   d       c   o   d   e       u   n   i   t       f   o   r       c   o   r   r   e   c   t       i   t   e   r   a   t   i   o   n   .   
                   i   f       (   c   o   d   e   P   o   i   n   t       >       6   5   5   3   5   )       {   
                           i   +   +   ;   
                   }   
                   l   e   n       +   =       4   ;   
           }   
           r   e   t   u   r   n       l   e   n   ;   
   }   ;   
   
   v   a   r       _   _   e   m   b   i   n   d   _   r   e   g   i   s   t   e   r   _   s   t   d   _   w   s   t   r   i   n   g       =       (   r   a   w   T   y   p   e   ,       c   h   a   r   S   i   z   e   ,       n   a   m   e   )       =   >       {   
           n   a   m   e       =       A   s   c   i   i   T   o   S   t   r   i   n   g   (   n   a   m   e   )   ;   
           v   a   r       d   e   c   o   d   e   S   t   r   i   n   g   ,       e   n   c   o   d   e   S   t   r   i   n   g   ,       l   e   n   g   t   h   B   y   t   e   s   U   T   F   ;   
           i   f       (   c   h   a   r   S   i   z   e       =   =   =       2   )       {   
                   d   e   c   o   d   e   S   t   r   i   n   g       =       U   T   F   1   6   T   o   S   t   r   i   n   g   ;   
                   e   n   c   o   d   e   S   t   r   i   n   g       =       s   t   r   i   n   g   T   o   U   T   F   1   6   ;   
                   l   e   n   g   t   h   B   y   t   e   s   U   T   F       =       l   e   n   g   t   h   B   y   t   e   s   U   T   F   1   6   ;   
           }       e   l   s   e       {   
                   a   s   s   e   r   t   (   c   h   a   r   S   i   z   e       =   =   =       4   ,       "   o   n   l   y       2   -   b   y   t   e       a   n   d       4   -   b   y   t   e       s   t   r   i   n   g   s       a   r   e       c   u   r   r   e   n   t   l   y       s   u   p   p   o   r   t   e   d   "   )   ;   
                   d   e   c   o   d   e   S   t   r   i   n   g       =       U   T   F   3   2   T   o   S   t   r   i   n   g   ;   
                   e   n   c   o   d   e   S   t   r   i   n   g       =       s   t   r   i   n   g   T   o   U   T   F   3   2   ;   
                   l   e   n   g   t   h   B   y   t   e   s   U   T   F       =       l   e   n   g   t   h   B   y   t   e   s   U   T   F   3   2   ;   
           }   
           r   e   g   i   s   t   e   r   T   y   p   e   (   r   a   w   T   y   p   e   ,       {   
                   n   a   m   e   ,   
                   "   f   r   o   m   W   i   r   e   T   y   p   e   "   :       v   a   l   u   e       =   >       {   
                           /   /       C   o   d   e       m   o   s   t   l   y       t   a   k   e   n       f   r   o   m       _   e   m   b   i   n   d   _   r   e   g   i   s   t   e   r   _   s   t   d   _   s   t   r   i   n   g       f   r   o   m   W   i   r   e   T   y   p   e   
                           v   a   r       l   e   n   g   t   h       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   v   a   l   u   e   )       >   >       2   )   ]   ;   
                           v   a   r       s   t   r       =       d   e   c   o   d   e   S   t   r   i   n   g   (   v   a   l   u   e       +       4   ,       l   e   n   g   t   h       *       c   h   a   r   S   i   z   e   ,       t   r   u   e   )   ;   
                           _   f   r   e   e   (   v   a   l   u   e   )   ;   
                           r   e   t   u   r   n       s   t   r   ;   
                   }   ,   
                   "   t   o   W   i   r   e   T   y   p   e   "   :       (   d   e   s   t   r   u   c   t   o   r   s   ,       v   a   l   u   e   )       =   >       {   
                           i   f       (   !   (   t   y   p   e   o   f       v   a   l   u   e       =   =       "   s   t   r   i   n   g   "   )   )       {   
                                   t   h   r   o   w   B   i   n   d   i   n   g   E   r   r   o   r   (   `   C   a   n   n   o   t       p   a   s   s       n   o   n   -   s   t   r   i   n   g       t   o       C   +   +       s   t   r   i   n   g       t   y   p   e       $   {   n   a   m   e   }   `   )   ;   
                           }   
                           /   /       a   s   s   u   m   e   s       P   O   I   N   T   E   R   _   S   I   Z   E       a   l   i   g   n   m   e   n   t   
                           v   a   r       l   e   n   g   t   h       =       l   e   n   g   t   h   B   y   t   e   s   U   T   F   (   v   a   l   u   e   )   ;   
                           v   a   r       p   t   r       =       _   m   a   l   l   o   c   (   4       +       l   e   n   g   t   h       +       c   h   a   r   S   i   z   e   )   ;   
                           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   p   t   r   )       >   >       2   )   ]       =       l   e   n   g   t   h       /       c   h   a   r   S   i   z   e   ;   
                           e   n   c   o   d   e   S   t   r   i   n   g   (   v   a   l   u   e   ,       p   t   r       +       4   ,       l   e   n   g   t   h       +       c   h   a   r   S   i   z   e   )   ;   
                           i   f       (   d   e   s   t   r   u   c   t   o   r   s       !   =   =       n   u   l   l   )       {   
                                   d   e   s   t   r   u   c   t   o   r   s   .   p   u   s   h   (   _   f   r   e   e   ,       p   t   r   )   ;   
                           }   
                           r   e   t   u   r   n       p   t   r   ;   
                   }   ,   
                   "   r   e   a   d   V   a   l   u   e   F   r   o   m   P   o   i   n   t   e   r   "   :       r   e   a   d   P   o   i   n   t   e   r   ,   
                   d   e   s   t   r   u   c   t   o   r   F   u   n   c   t   i   o   n   (   p   t   r   )       {   
                           _   f   r   e   e   (   p   t   r   )   ;   
                   }   
           }   )   ;   
   }   ;   
   
   v   a   r       _   _   e   m   b   i   n   d   _   r   e   g   i   s   t   e   r   _   v   o   i   d       =       (   r   a   w   T   y   p   e   ,       n   a   m   e   )       =   >       {   
           n   a   m   e       =       A   s   c   i   i   T   o   S   t   r   i   n   g   (   n   a   m   e   )   ;   
           r   e   g   i   s   t   e   r   T   y   p   e   (   r   a   w   T   y   p   e   ,       {   
                   i   s   V   o   i   d   :       t   r   u   e   ,   
                   /   /       v   o   i   d       r   e   t   u   r   n       v   a   l   u   e   s       c   a   n       b   e       o   p   t   i   m   i   z   e   d       o   u   t       s   o   m   e   t   i   m   e   s   
                   n   a   m   e   ,   
                   "   f   r   o   m   W   i   r   e   T   y   p   e   "   :       (   )       =   >       u   n   d   e   f   i   n   e   d   ,   
                   /   /       T   O   D   O   :       a   s   s   e   r   t       i   f       a   n   y   t   h   i   n   g       e   l   s   e       i   s       g   i   v   e   n   ?   
                   "   t   o   W   i   r   e   T   y   p   e   "   :       (   d   e   s   t   r   u   c   t   o   r   s   ,       o   )       =   >       u   n   d   e   f   i   n   e   d   
           }   )   ;   
   }   ;   
   
   v   a   r       _   _   e   m   s   c   r   i   p   t   e   n   _   i   n   i   t   _   m   a   i   n   _   t   h   r   e   a   d   _   j   s       =       t   b       =   >       {   
           /   /       P   a   s   s       t   h   e       t   h   r   e   a   d       a   d   d   r   e   s   s       t   o       t   h   e       n   a   t   i   v   e       c   o   d   e       w   h   e   r   e       t   h   e   y       s   t   o   r   e   d       i   n       w   a   s   m   
           /   /       g   l   o   b   a   l   s       w   h   i   c   h       a   c   t       a   s       a       f   o   r   m       o   f       T   L   S   .       G   l   o   b   a   l       c   o   n   s   t   r   u   c   t   o   r   s       t   r   y   i   n   g   
           /   /       t   o       a   c   c   e   s   s       t   h   i   s       v   a   l   u   e       w   i   l   l       r   e   a   d       t   h   e       w   r   o   n   g       v   a   l   u   e   ,       b   u   t       t   h   a   t       i   s       U   B       a   n   y   w   a   y   .   
           _   _   e   m   s   c   r   i   p   t   e   n   _   t   h   r   e   a   d   _   i   n   i   t   (   t   b   ,       /   *   i   s   _   m   a   i   n   =   *   /       !   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   W   O   R   K   E   R   ,       /   *   i   s   _   r   u   n   t   i   m   e   =   *   /       1   ,       /   *   c   a   n   _   b   l   o   c   k   =   *   /       !   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   W   E   B   ,       /   *   d   e   f   a   u   l   t   _   s   t   a   c   k   s   i   z   e   =   *   /       6   5   5   3   6   ,       /   *   s   t   a   r   t   _   p   r   o   f   i   l   i   n   g   =   *   /       f   a   l   s   e   )   ;   
           P   T   h   r   e   a   d   .   t   h   r   e   a   d   I   n   i   t   T   L   S   (   )   ;   
   }   ;   
   
   v   a   r       h   a   n   d   l   e   E   x   c   e   p   t   i   o   n       =       e       =   >       {   
           /   /       C   e   r   t   a   i   n       e   x   c   e   p   t   i   o   n       t   y   p   e   s       w   e       d   o       n   o   t       t   r   e   a   t       a   s       e   r   r   o   r   s       s   i   n   c   e       t   h   e   y       a   r   e       u   s   e   d       f   o   r   
           /   /       i   n   t   e   r   n   a   l       c   o   n   t   r   o   l       f   l   o   w   .   
           /   /       1   .       E   x   i   t   S   t   a   t   u   s   ,       w   h   i   c   h       i   s       t   h   r   o   w   n       b   y       e   x   i   t   (   )   
           /   /       2   .       "   u   n   w   i   n   d   "   ,       w   h   i   c   h       i   s       t   h   r   o   w   n       b   y       e   m   s   c   r   i   p   t   e   n   _   u   n   w   i   n   d   _   t   o   _   j   s   _   e   v   e   n   t   _   l   o   o   p   (   )       a   n   d       o   t   h   e   r   s   
           /   /                   t   h   a   t       w   i   s   h       t   o       r   e   t   u   r   n       t   o       J   S       e   v   e   n   t       l   o   o   p   .   
           i   f       (   e       i   n   s   t   a   n   c   e   o   f       E   x   i   t   S   t   a   t   u   s       |   |       e       =   =       "   u   n   w   i   n   d   "   )       {   
                   r   e   t   u   r   n       E   X   I   T   S   T   A   T   U   S   ;   
           }   
           c   h   e   c   k   S   t   a   c   k   C   o   o   k   i   e   (   )   ;   
           i   f       (   e       i   n   s   t   a   n   c   e   o   f       W   e   b   A   s   s   e   m   b   l   y   .   R   u   n   t   i   m   e   E   r   r   o   r   )       {   
                   i   f       (   _   e   m   s   c   r   i   p   t   e   n   _   s   t   a   c   k   _   g   e   t   _   c   u   r   r   e   n   t   (   )       <   =       0   )       {   
                           e   r   r   (   "   S   t   a   c   k       o   v   e   r   f   l   o   w       d   e   t   e   c   t   e   d   .           Y   o   u       c   a   n       t   r   y       i   n   c   r   e   a   s   i   n   g       -   s   S   T   A   C   K   _   S   I   Z   E       (   c   u   r   r   e   n   t   l   y       s   e   t       t   o       6   5   5   3   6   )   "   )   ;   
                   }   
           }   
           q   u   i   t   _   (   1   ,       e   )   ;   
   }   ;   
   
   v   a   r       m   a   y   b   e   E   x   i   t       =       (   )       =   >       {   
           i   f       (   !   k   e   e   p   R   u   n   t   i   m   e   A   l   i   v   e   (   )   )       {   
                   t   r   y       {   
                           i   f       (   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   P   T   H   R   E   A   D   )       _   _   e   m   s   c   r   i   p   t   e   n   _   t   h   r   e   a   d   _   e   x   i   t   (   E   X   I   T   S   T   A   T   U   S   )   ;       e   l   s   e       _   e   x   i   t   (   E   X   I   T   S   T   A   T   U   S   )   ;   
                   }       c   a   t   c   h       (   e   )       {   
                           h   a   n   d   l   e   E   x   c   e   p   t   i   o   n   (   e   )   ;   
                   }   
           }   
   }   ;   
   
   v   a   r       c   a   l   l   U   s   e   r   C   a   l   l   b   a   c   k       =       f   u   n   c       =   >       {   
           i   f       (   A   B   O   R   T   )       {   
                   e   r   r   (   "   u   s   e   r       c   a   l   l   b   a   c   k       t   r   i   g   g   e   r   e   d       a   f   t   e   r       r   u   n   t   i   m   e       e   x   i   t   e   d       o   r       a   p   p   l   i   c   a   t   i   o   n       a   b   o   r   t   e   d   .           I   g   n   o   r   i   n   g   .   "   )   ;   
                   r   e   t   u   r   n   ;   
           }   
           t   r   y       {   
                   f   u   n   c   (   )   ;   
                   m   a   y   b   e   E   x   i   t   (   )   ;   
           }       c   a   t   c   h       (   e   )       {   
                   h   a   n   d   l   e   E   x   c   e   p   t   i   o   n   (   e   )   ;   
           }   
   }   ;   
   
   v   a   r       _   _   e   m   s   c   r   i   p   t   e   n   _   t   h   r   e   a   d   _   m   a   i   l   b   o   x   _   a   w   a   i   t       =       p   t   h   r   e   a   d   _   p   t   r       =   >       {   
           i   f       (   t   y   p   e   o   f       A   t   o   m   i   c   s   .   w   a   i   t   A   s   y   n   c       =   =   =       "   f   u   n   c   t   i   o   n   "   )       {   
                   /   /       W   a   i   t       o   n       t   h   e       p   t   h   r   e   a   d   '   s       i   n   i   t   i   a   l       s   e   l   f   -   p   o   i   n   t   e   r       f   i   e   l   d       b   e   c   a   u   s   e       i   t       i   s       e   a   s   y       a   n   d   
                   /   /       s   a   f   e       t   o       a   c   c   e   s   s       f   r   o   m       s   e   n   d   i   n   g       t   h   r   e   a   d   s       t   h   a   t       n   e   e   d       t   o       n   o   t   i   f   y       t   h   e       w   a   i   t   i   n   g   
                   /   /       t   h   r   e   a   d   .   
                   /   /       T   O   D   O   :       H   o   w       t   o       m   a   k   e       t   h   i   s       w   o   r   k       w   i   t   h       w   a   s   m   6   4   ?   
                   v   a   r       w   a   i   t       =       A   t   o   m   i   c   s   .   w   a   i   t   A   s   y   n   c   (   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   ,       (   (   p   t   h   r   e   a   d   _   p   t   r   )       >   >       2   )   ,       p   t   h   r   e   a   d   _   p   t   r   )   ;   
                   a   s   s   e   r   t   (   w   a   i   t   .   a   s   y   n   c   )   ;   
                   w   a   i   t   .   v   a   l   u   e   .   t   h   e   n   (   c   h   e   c   k   M   a   i   l   b   o   x   )   ;   
                   v   a   r       w   a   i   t   i   n   g   A   s   y   n   c       =       p   t   h   r   e   a   d   _   p   t   r       +       1   2   8   ;   
                   A   t   o   m   i   c   s   .   s   t   o   r   e   (   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   ,       (   (   w   a   i   t   i   n   g   A   s   y   n   c   )       >   >       2   )   ,       1   )   ;   
           }   
   }   ;   
   
   v   a   r       c   h   e   c   k   M   a   i   l   b   o   x       =       (   )       =   >       {   
           /   /       O   n   l   y       c   h   e   c   k       t   h   e       m   a   i   l   b   o   x       i   f       w   e       h   a   v   e       a       l   i   v   e       p   t   h   r   e   a   d       r   u   n   t   i   m   e   .       W   e       i   m   p   l   e   m   e   n   t   
           /   /       p   t   h   r   e   a   d   _   s   e   l   f       t   o       r   e   t   u   r   n       0       i   f       t   h   e   r   e       i   s       n   o       l   i   v   e       r   u   n   t   i   m   e   .   
           v   a   r       p   t   h   r   e   a   d   _   p   t   r       =       _   p   t   h   r   e   a   d   _   s   e   l   f   (   )   ;   
           i   f       (   p   t   h   r   e   a   d   _   p   t   r   )       {   
                   /   /       I   f       w   e       a   r   e       u   s   i   n   g       A   t   o   m   i   c   s   .   w   a   i   t   A   s   y   n   c       a   s       o   u   r       n   o   t   i   f   i   c   a   t   i   o   n       m   e   c   h   a   n   i   s   m   ,       w   a   i   t   
                   /   /       f   o   r       a       n   o   t   i   f   i   c   a   t   i   o   n       b   e   f   o   r   e       p   r   o   c   e   s   s   i   n   g       t   h   e       m   a   i   l   b   o   x       t   o       a   v   o   i   d       m   i   s   s   i   n   g       a   n   y   
                   /   /       w   o   r   k       t   h   a   t       c   o   u   l   d       o   t   h   e   r   w   i   s   e       a   r   r   i   v   e       a   f   t   e   r       w   e   '   v   e       f   i   n   i   s   h   e   d       p   r   o   c   e   s   s   i   n   g       t   h   e   
                   /   /       m   a   i   l   b   o   x       a   n   d       b   e   f   o   r   e       w   e   '   r   e       r   e   a   d   y       f   o   r       t   h   e       n   e   x   t       n   o   t   i   f   i   c   a   t   i   o   n   .   
                   _   _   e   m   s   c   r   i   p   t   e   n   _   t   h   r   e   a   d   _   m   a   i   l   b   o   x   _   a   w   a   i   t   (   p   t   h   r   e   a   d   _   p   t   r   )   ;   
                   c   a   l   l   U   s   e   r   C   a   l   l   b   a   c   k   (   _   _   e   m   s   c   r   i   p   t   e   n   _   c   h   e   c   k   _   m   a   i   l   b   o   x   )   ;   
           }   
   }   ;   
   
   v   a   r       _   _   e   m   s   c   r   i   p   t   e   n   _   n   o   t   i   f   y   _   m   a   i   l   b   o   x   _   p   o   s   t   m   e   s   s   a   g   e       =       (   t   a   r   g   e   t   T   h   r   e   a   d   ,       c   u   r   r   T   h   r   e   a   d   I   d   )       =   >       {   
           i   f       (   t   a   r   g   e   t   T   h   r   e   a   d       =   =       c   u   r   r   T   h   r   e   a   d   I   d   )       {   
                   s   e   t   T   i   m   e   o   u   t   (   c   h   e   c   k   M   a   i   l   b   o   x   )   ;   
           }       e   l   s   e       i   f       (   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   P   T   H   R   E   A   D   )       {   
                   p   o   s   t   M   e   s   s   a   g   e   (   {   
                           t   a   r   g   e   t   T   h   r   e   a   d   ,   
                           c   m   d   :       "   c   h   e   c   k   M   a   i   l   b   o   x   "   
                   }   )   ;   
           }       e   l   s   e       {   
                   v   a   r       w   o   r   k   e   r       =       P   T   h   r   e   a   d   .   p   t   h   r   e   a   d   s   [   t   a   r   g   e   t   T   h   r   e   a   d   ]   ;   
                   i   f       (   !   w   o   r   k   e   r   )       {   
                           e   r   r   (   `   C   a   n   n   o   t       s   e   n   d       m   e   s   s   a   g   e       t   o       t   h   r   e   a   d       w   i   t   h       I   D       $   {   t   a   r   g   e   t   T   h   r   e   a   d   }   ,       u   n   k   n   o   w   n       t   h   r   e   a   d       I   D   !   `   )   ;   
                           r   e   t   u   r   n   ;   
                   }   
                   w   o   r   k   e   r   .   p   o   s   t   M   e   s   s   a   g   e   (   {   
                           c   m   d   :       "   c   h   e   c   k   M   a   i   l   b   o   x   "   
                   }   )   ;   
           }   
   }   ;   
   
   v   a   r       p   r   o   x   i   e   d   J   S   C   a   l   l   A   r   g   s       =       [   ]   ;   
   
   v   a   r       _   _   e   m   s   c   r   i   p   t   e   n   _   r   e   c   e   i   v   e   _   o   n   _   m   a   i   n   _   t   h   r   e   a   d   _   j   s       =       (   f   u   n   c   I   n   d   e   x   ,       e   m   A   s   m   A   d   d   r   ,       c   a   l   l   i   n   g   T   h   r   e   a   d   ,       n   u   m   C   a   l   l   A   r   g   s   ,       a   r   g   s   )       =   >       {   
           /   /       S   o   m   e   t   i   m   e   s       w   e       n   e   e   d       t   o       b   a   c   k   p   r   o   x   y       e   v   e   n   t   s       t   o       t   h   e       c   a   l   l   i   n   g       t   h   r   e   a   d       (   e   .   g   .   
           /   /       H   T   M   L   5       D   O   M       e   v   e   n   t   s       h   a   n   d   l   e   r   s       s   u   c   h       a   s   
           /   /       e   m   s   c   r   i   p   t   e   n   _   s   e   t   _   m   o   u   s   e   m   o   v   e   _   c   a   l   l   b   a   c   k   (   )   )   ,       s   o       k   e   e   p       t   r   a   c   k       i   n       a       g   l   o   b   a   l   l   y   
           /   /       a   c   c   e   s   s   i   b   l   e       v   a   r   i   a   b   l   e       a   b   o   u   t       t   h   e       t   h   r   e   a   d       t   h   a   t       i   n   i   t   i   a   t   e   d       t   h   e       p   r   o   x   y   i   n   g   .   
           n   u   m   C   a   l   l   A   r   g   s       /   =       2   ;   
           p   r   o   x   i   e   d   J   S   C   a   l   l   A   r   g   s   .   l   e   n   g   t   h       =       n   u   m   C   a   l   l   A   r   g   s   ;   
           v   a   r       b       =       (   (   a   r   g   s   )       >   >       3   )   ;   
           f   o   r       (   v   a   r       i       =       0   ;       i       <       n   u   m   C   a   l   l   A   r   g   s   ;       i   +   +   )       {   
                   i   f       (   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   6   4   )   [   b       +       2       *       i   ]   )       {   
                           /   /       I   t   '   s       a       B   i   g   I   n   t   .   
                           p   r   o   x   i   e   d   J   S   C   a   l   l   A   r   g   s   [   i   ]       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   6   4   )   [   b       +       2       *       i       +       1   ]   ;   
                   }       e   l   s   e       {   
                           /   /       I   t   '   s       a       N   u   m   b   e   r   .   
                           p   r   o   x   i   e   d   J   S   C   a   l   l   A   r   g   s   [   i   ]       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   F   6   4   )   [   b       +       2       *       i       +       1   ]   ;   
                   }   
           }   
           /   /       P   r   o   x   i   e   d       J   S       l   i   b   r   a   r   y       f   u   n   c   s       u   s   e       f   u   n   c   I   n   d   e   x       a   n   d       E   M   _   A   S   M       f   u   n   c   t   i   o   n   s       u   s   e       e   m   A   s   m   A   d   d   r   
           v   a   r       f   u   n   c       =       e   m   A   s   m   A   d   d   r       ?       A   S   M   _   C   O   N   S   T   S   [   e   m   A   s   m   A   d   d   r   ]       :       p   r   o   x   i   e   d   F   u   n   c   t   i   o   n   T   a   b   l   e   [   f   u   n   c   I   n   d   e   x   ]   ;   
           a   s   s   e   r   t   (   !   (   f   u   n   c   I   n   d   e   x       &   &       e   m   A   s   m   A   d   d   r   )   )   ;   
           a   s   s   e   r   t   (   f   u   n   c   .   l   e   n   g   t   h       =   =       n   u   m   C   a   l   l   A   r   g   s   ,       "   C   a   l   l       a   r   g   s       m   i   s   m   a   t   c   h       i   n       _   e   m   s   c   r   i   p   t   e   n   _   r   e   c   e   i   v   e   _   o   n   _   m   a   i   n   _   t   h   r   e   a   d   _   j   s   "   )   ;   
           P   T   h   r   e   a   d   .   c   u   r   r   e   n   t   P   r   o   x   i   e   d   O   p   e   r   a   t   i   o   n   C   a   l   l   e   r   T   h   r   e   a   d       =       c   a   l   l   i   n   g   T   h   r   e   a   d   ;   
           v   a   r       r   t   n       =       f   u   n   c   (   .   .   .   p   r   o   x   i   e   d   J   S   C   a   l   l   A   r   g   s   )   ;   
           P   T   h   r   e   a   d   .   c   u   r   r   e   n   t   P   r   o   x   i   e   d   O   p   e   r   a   t   i   o   n   C   a   l   l   e   r   T   h   r   e   a   d       =       0   ;   
           /   /       P   r   o   x   i   e   d       f   u   n   c   t   i   o   n   s       c   a   n       r   e   t   u   r   n       a   n   y       t   y   p   e       e   x   c   e   p   t       b   i   g   i   n   t   .           A   l   l       o   t   h   e   r       t   y   p   e   s   
           /   /       c   o   o   e   r   c   e       t   o       f   6   4   /   d   o   u   b   l   e       (   t   h   e       r   e   t   u   r   n       t   y   p   e       o   f       t   h   i   s       f   u   n   c   t   i   o   n       i   n       C   )       b   u   t       n   o   t   
           /   /       b   i   g   i   n   t   .   
           a   s   s   e   r   t   (   t   y   p   e   o   f       r   t   n       !   =       "   b   i   g   i   n   t   "   )   ;   
           r   e   t   u   r   n       r   t   n   ;   
   }   ;   
   
   v   a   r       _   _   e   m   s   c   r   i   p   t   e   n   _   t   h   r   e   a   d   _   c   l   e   a   n   u   p       =       t   h   r   e   a   d       =   >       {   
           /   /       C   a   l   l   e   d       w   h   e   n       a       t   h   r   e   a   d       n   e   e   d   s       t   o       b   e       c   l   e   a   n   e   d       u   p       s   o       i   t       c   a   n       b   e       r   e   u   s   e   d   .   
           /   /       A       t   h   r   e   a   d       i   s       c   o   n   s   i   d   e   r   e   d       r   e   u   s   a   b   l   e       w   h   e   n       i   t       e   i   t   h   e   r       r   e   t   u   r   n   s       f   r   o   m       i   t   s   
           /   /       e   n   t   r   y       p   o   i   n   t   ,       c   a   l   l   s       p   t   h   r   e   a   d   _   e   x   i   t   ,       o   r       a   c   t   s       u   p   o   n       a       c   a   n   c   e   l   l   a   t   i   o   n   .   
           /   /       D   e   t   a   c   h   e   d       t   h   r   e   a   d   s       a   r   e       r   e   s   p   o   n   s   i   b   l   e       f   o   r       c   a   l   l   i   n   g       t   h   i   s       t   h   e   m   s   e   l   v   e   s   ,   
           /   /       o   t   h   e   r   w   i   s   e       p   t   h   r   e   a   d   _   j   o   i   n       i   s       r   e   s   p   o   n   s   i   b   l   e       f   o   r       c   a   l   l   i   n   g       t   h   i   s   .   
           i   f       (   !   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   P   T   H   R   E   A   D   )       c   l   e   a   n   u   p   T   h   r   e   a   d   (   t   h   r   e   a   d   )   ;       e   l   s   e       p   o   s   t   M   e   s   s   a   g   e   (   {   
                   c   m   d   :       "   c   l   e   a   n   u   p   T   h   r   e   a   d   "   ,   
                   t   h   r   e   a   d   
           }   )   ;   
   }   ;   
   
   v   a   r       _   _   e   m   s   c   r   i   p   t   e   n   _   t   h   r   e   a   d   _   s   e   t   _   s   t   r   o   n   g   r   e   f       =       t   h   r   e   a   d       =   >       {   }   ;   
   
   v   a   r       r   e   q   u   i   r   e   R   e   g   i   s   t   e   r   e   d   T   y   p   e       =       (   r   a   w   T   y   p   e   ,       h   u   m   a   n   N   a   m   e   )       =   >       {   
           v   a   r       i   m   p   l       =       r   e   g   i   s   t   e   r   e   d   T   y   p   e   s   [   r   a   w   T   y   p   e   ]   ;   
           i   f       (   u   n   d   e   f   i   n   e   d       =   =   =       i   m   p   l   )       {   
                   t   h   r   o   w   B   i   n   d   i   n   g   E   r   r   o   r   (   `   $   {   h   u   m   a   n   N   a   m   e   }       h   a   s       u   n   k   n   o   w   n       t   y   p   e       $   {   g   e   t   T   y   p   e   N   a   m   e   (   r   a   w   T   y   p   e   )   }   `   )   ;   
           }   
           r   e   t   u   r   n       i   m   p   l   ;   
   }   ;   
   
   v   a   r       e   m   v   a   l   _   r   e   t   u   r   n   V   a   l   u   e       =       (   r   e   t   u   r   n   T   y   p   e   ,       d   e   s   t   r   u   c   t   o   r   s   R   e   f   ,       h   a   n   d   l   e   )       =   >       {   
           v   a   r       d   e   s   t   r   u   c   t   o   r   s       =       [   ]   ;   
           v   a   r       r   e   s   u   l   t       =       r   e   t   u   r   n   T   y   p   e   [   "   t   o   W   i   r   e   T   y   p   e   "   ]   (   d   e   s   t   r   u   c   t   o   r   s   ,       h   a   n   d   l   e   )   ;   
           i   f       (   d   e   s   t   r   u   c   t   o   r   s   .   l   e   n   g   t   h   )       {   
                   /   /       v   o   i   d   ,       p   r   i   m   i   t   i   v   e   s       a   n   d       a   n   y       o   t   h   e   r       t   y   p   e   s       w   /   o       d   e   s   t   r   u   c   t   o   r   s       d   o   n   '   t       n   e   e   d       t   o       a   l   l   o   c   a   t   e       a       h   a   n   d   l   e   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   d   e   s   t   r   u   c   t   o   r   s   R   e   f   )       >   >       2   )   ]       =       E   m   v   a   l   .   t   o   H   a   n   d   l   e   (   d   e   s   t   r   u   c   t   o   r   s   )   ;   
           }   
           r   e   t   u   r   n       r   e   s   u   l   t   ;   
   }   ;   
   
   v   a   r       _   _   e   m   v   a   l   _   a   s       =       (   h   a   n   d   l   e   ,       r   e   t   u   r   n   T   y   p   e   ,       d   e   s   t   r   u   c   t   o   r   s   R   e   f   )       =   >       {   
           h   a   n   d   l   e       =       E   m   v   a   l   .   t   o   V   a   l   u   e   (   h   a   n   d   l   e   )   ;   
           r   e   t   u   r   n   T   y   p   e       =       r   e   q   u   i   r   e   R   e   g   i   s   t   e   r   e   d   T   y   p   e   (   r   e   t   u   r   n   T   y   p   e   ,       "   e   m   v   a   l   :   :   a   s   "   )   ;   
           r   e   t   u   r   n       e   m   v   a   l   _   r   e   t   u   r   n   V   a   l   u   e   (   r   e   t   u   r   n   T   y   p   e   ,       d   e   s   t   r   u   c   t   o   r   s   R   e   f   ,       h   a   n   d   l   e   )   ;   
   }   ;   
   
   v   a   r       _   _   e   m   v   a   l   _   g   e   t   _   p   r   o   p   e   r   t   y       =       (   h   a   n   d   l   e   ,       k   e   y   )       =   >       {   
           h   a   n   d   l   e       =       E   m   v   a   l   .   t   o   V   a   l   u   e   (   h   a   n   d   l   e   )   ;   
           k   e   y       =       E   m   v   a   l   .   t   o   V   a   l   u   e   (   k   e   y   )   ;   
           r   e   t   u   r   n       E   m   v   a   l   .   t   o   H   a   n   d   l   e   (   h   a   n   d   l   e   [   k   e   y   ]   )   ;   
   }   ;   
   
   v   a   r       e   m   v   a   l   _   s   y   m   b   o   l   s       =       {   }   ;   
   
   v   a   r       g   e   t   S   t   r   i   n   g   O   r   S   y   m   b   o   l       =       a   d   d   r   e   s   s       =   >       {   
           v   a   r       s   y   m   b   o   l       =       e   m   v   a   l   _   s   y   m   b   o   l   s   [   a   d   d   r   e   s   s   ]   ;   
           i   f       (   s   y   m   b   o   l       =   =   =       u   n   d   e   f   i   n   e   d   )       {   
                   r   e   t   u   r   n       A   s   c   i   i   T   o   S   t   r   i   n   g   (   a   d   d   r   e   s   s   )   ;   
           }   
           r   e   t   u   r   n       s   y   m   b   o   l   ;   
   }   ;   
   
   v   a   r       _   _   e   m   v   a   l   _   n   e   w   _   c   s   t   r   i   n   g       =       v       =   >       E   m   v   a   l   .   t   o   H   a   n   d   l   e   (   g   e   t   S   t   r   i   n   g   O   r   S   y   m   b   o   l   (   v   )   )   ;   
   
   v   a   r       _   _   e   m   v   a   l   _   r   u   n   _   d   e   s   t   r   u   c   t   o   r   s       =       h   a   n   d   l   e       =   >       {   
           v   a   r       d   e   s   t   r   u   c   t   o   r   s       =       E   m   v   a   l   .   t   o   V   a   l   u   e   (   h   a   n   d   l   e   )   ;   
           r   u   n   D   e   s   t   r   u   c   t   o   r   s   (   d   e   s   t   r   u   c   t   o   r   s   )   ;   
           _   _   e   m   v   a   l   _   d   e   c   r   e   f   (   h   a   n   d   l   e   )   ;   
   }   ;   
   
   v   a   r       _   _   e   m   v   a   l   _   t   a   k   e   _   v   a   l   u   e       =       (   t   y   p   e   ,       a   r   g   )       =   >       {   
           t   y   p   e       =       r   e   q   u   i   r   e   R   e   g   i   s   t   e   r   e   d   T   y   p   e   (   t   y   p   e   ,       "   _   e   m   v   a   l   _   t   a   k   e   _   v   a   l   u   e   "   )   ;   
           v   a   r       v       =       t   y   p   e   [   "   r   e   a   d   V   a   l   u   e   F   r   o   m   P   o   i   n   t   e   r   "   ]   (   a   r   g   )   ;   
           r   e   t   u   r   n       E   m   v   a   l   .   t   o   H   a   n   d   l   e   (   v   )   ;   
   }   ;   
   
   v   a   r       _   _   t   z   s   e   t   _   j   s       =       (   t   i   m   e   z   o   n   e   ,       d   a   y   l   i   g   h   t   ,       s   t   d   _   n   a   m   e   ,       d   s   t   _   n   a   m   e   )       =   >       {   
           /   /       T   O   D   O   :       U   s   e       (   m   a   l   l   e   a   b   l   e   )       e   n   v   i   r   o   n   m   e   n   t       v   a   r   i   a   b   l   e   s       i   n   s   t   e   a   d       o   f       s   y   s   t   e   m       s   e   t   t   i   n   g   s   .   
           v   a   r       c   u   r   r   e   n   t   Y   e   a   r       =       (   n   e   w       D   a   t   e   )   .   g   e   t   F   u   l   l   Y   e   a   r   (   )   ;   
           v   a   r       w   i   n   t   e   r       =       n   e   w       D   a   t   e   (   c   u   r   r   e   n   t   Y   e   a   r   ,       0   ,       1   )   ;   
           v   a   r       s   u   m   m   e   r       =       n   e   w       D   a   t   e   (   c   u   r   r   e   n   t   Y   e   a   r   ,       6   ,       1   )   ;   
           v   a   r       w   i   n   t   e   r   O   f   f   s   e   t       =       w   i   n   t   e   r   .   g   e   t   T   i   m   e   z   o   n   e   O   f   f   s   e   t   (   )   ;   
           v   a   r       s   u   m   m   e   r   O   f   f   s   e   t       =       s   u   m   m   e   r   .   g   e   t   T   i   m   e   z   o   n   e   O   f   f   s   e   t   (   )   ;   
           /   /       L   o   c   a   l       s   t   a   n   d   a   r   d       t   i   m   e   z   o   n   e       o   f   f   s   e   t   .       L   o   c   a   l       s   t   a   n   d   a   r   d       t   i   m   e       i   s       n   o   t       a   d   j   u   s   t   e   d       f   o   r   
           /   /       d   a   y   l   i   g   h   t       s   a   v   i   n   g   s   .           T   h   i   s       c   o   d   e       u   s   e   s       t   h   e       f   a   c   t       t   h   a   t       g   e   t   T   i   m   e   z   o   n   e   O   f   f   s   e   t       r   e   t   u   r   n   s   
           /   /       a       g   r   e   a   t   e   r       v   a   l   u   e       d   u   r   i   n   g       S   t   a   n   d   a   r   d       T   i   m   e       v   e   r   s   u   s       D   a   y   l   i   g   h   t       S   a   v   i   n   g       T   i   m   e       (   D   S   T   )   .   
           /   /       T   h   u   s       i   t       d   e   t   e   r   m   i   n   e   s       t   h   e       e   x   p   e   c   t   e   d       o   u   t   p   u   t       d   u   r   i   n   g       S   t   a   n   d   a   r   d       T   i   m   e   ,       a   n   d       i   t   
           /   /       c   o   m   p   a   r   e   s       w   h   e   t   h   e   r       t   h   e       o   u   t   p   u   t       o   f       t   h   e       g   i   v   e   n       d   a   t   e       t   h   e       s   a   m   e       (   S   t   a   n   d   a   r   d   )       o   r       l   e   s   s   
           /   /       (   D   S   T   )   .   
           v   a   r       s   t   d   T   i   m   e   z   o   n   e   O   f   f   s   e   t       =       M   a   t   h   .   m   a   x   (   w   i   n   t   e   r   O   f   f   s   e   t   ,       s   u   m   m   e   r   O   f   f   s   e   t   )   ;   
           /   /       t   i   m   e   z   o   n   e       i   s       s   p   e   c   i   f   i   e   d       a   s       s   e   c   o   n   d   s       w   e   s   t       o   f       U   T   C       (   "   T   h   e       e   x   t   e   r   n   a   l       v   a   r   i   a   b   l   e   
           /   /       `   t   i   m   e   z   o   n   e   `       s   h   a   l   l       b   e       s   e   t       t   o       t   h   e       d   i   f   f   e   r   e   n   c   e   ,       i   n       s   e   c   o   n   d   s   ,       b   e   t   w   e   e   n   
           /   /       C   o   o   r   d   i   n   a   t   e   d       U   n   i   v   e   r   s   a   l       T   i   m   e       (   U   T   C   )       a   n   d       l   o   c   a   l       s   t   a   n   d   a   r   d       t   i   m   e   .   "   )   ,       t   h   e       s   a   m   e   
           /   /       a   s       r   e   t   u   r   n   e   d       b   y       s   t   d   T   i   m   e   z   o   n   e   O   f   f   s   e   t   .   
           /   /       S   e   e       h   t   t   p   :   /   /   p   u   b   s   .   o   p   e   n   g   r   o   u   p   .   o   r   g   /   o   n   l   i   n   e   p   u   b   s   /   0   0   9   6   9   5   3   9   9   /   f   u   n   c   t   i   o   n   s   /   t   z   s   e   t   .   h   t   m   l   
           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   t   i   m   e   z   o   n   e   )       >   >       2   )   ]       =       s   t   d   T   i   m   e   z   o   n   e   O   f   f   s   e   t       *       6   0   ;   
           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   d   a   y   l   i   g   h   t   )       >   >       2   )   ]       =       N   u   m   b   e   r   (   w   i   n   t   e   r   O   f   f   s   e   t       !   =       s   u   m   m   e   r   O   f   f   s   e   t   )   ;   
           v   a   r       e   x   t   r   a   c   t   Z   o   n   e       =       t   i   m   e   z   o   n   e   O   f   f   s   e   t       =   >       {   
                   /   /       W   h   y       i   n   v   e   r   s   e       s   i   g   n   ?   
                   /   /       R   e   a   d       h   e   r   e       h   t   t   p   s   :   /   /   d   e   v   e   l   o   p   e   r   .   m   o   z   i   l   l   a   .   o   r   g   /   e   n   -   U   S   /   d   o   c   s   /   W   e   b   /   J   a   v   a   S   c   r   i   p   t   /   R   e   f   e   r   e   n   c   e   /   G   l   o   b   a   l   _   O   b   j   e   c   t   s   /   D   a   t   e   /   g   e   t   T   i   m   e   z   o   n   e   O   f   f   s   e   t   
                   v   a   r       s   i   g   n       =       t   i   m   e   z   o   n   e   O   f   f   s   e   t       >   =       0       ?       "   -   "       :       "   +   "   ;   
                   v   a   r       a   b   s   O   f   f   s   e   t       =       M   a   t   h   .   a   b   s   (   t   i   m   e   z   o   n   e   O   f   f   s   e   t   )   ;   
                   v   a   r       h   o   u   r   s       =       S   t   r   i   n   g   (   M   a   t   h   .   f   l   o   o   r   (   a   b   s   O   f   f   s   e   t       /       6   0   )   )   .   p   a   d   S   t   a   r   t   (   2   ,       "   0   "   )   ;   
                   v   a   r       m   i   n   u   t   e   s       =       S   t   r   i   n   g   (   a   b   s   O   f   f   s   e   t       %       6   0   )   .   p   a   d   S   t   a   r   t   (   2   ,       "   0   "   )   ;   
                   r   e   t   u   r   n       `   U   T   C   $   {   s   i   g   n   }   $   {   h   o   u   r   s   }   $   {   m   i   n   u   t   e   s   }   `   ;   
           }   ;   
           v   a   r       w   i   n   t   e   r   N   a   m   e       =       e   x   t   r   a   c   t   Z   o   n   e   (   w   i   n   t   e   r   O   f   f   s   e   t   )   ;   
           v   a   r       s   u   m   m   e   r   N   a   m   e       =       e   x   t   r   a   c   t   Z   o   n   e   (   s   u   m   m   e   r   O   f   f   s   e   t   )   ;   
           a   s   s   e   r   t   (   w   i   n   t   e   r   N   a   m   e   )   ;   
           a   s   s   e   r   t   (   s   u   m   m   e   r   N   a   m   e   )   ;   
           a   s   s   e   r   t   (   l   e   n   g   t   h   B   y   t   e   s   U   T   F   8   (   w   i   n   t   e   r   N   a   m   e   )       <   =       1   6   ,       `   t   i   m   e   z   o   n   e       n   a   m   e       t   r   u   n   c   a   t   e   d       t   o       f   i   t       i   n       T   Z   N   A   M   E   _   M   A   X       (   $   {   w   i   n   t   e   r   N   a   m   e   }   )   `   )   ;   
           a   s   s   e   r   t   (   l   e   n   g   t   h   B   y   t   e   s   U   T   F   8   (   s   u   m   m   e   r   N   a   m   e   )       <   =       1   6   ,       `   t   i   m   e   z   o   n   e       n   a   m   e       t   r   u   n   c   a   t   e   d       t   o       f   i   t       i   n       T   Z   N   A   M   E   _   M   A   X       (   $   {   s   u   m   m   e   r   N   a   m   e   }   )   `   )   ;   
           i   f       (   s   u   m   m   e   r   O   f   f   s   e   t       <       w   i   n   t   e   r   O   f   f   s   e   t   )       {   
                   /   /       N   o   r   t   h   e   r   n       h   e   m   i   s   p   h   e   r   e   
                   s   t   r   i   n   g   T   o   U   T   F   8   (   w   i   n   t   e   r   N   a   m   e   ,       s   t   d   _   n   a   m   e   ,       1   7   )   ;   
                   s   t   r   i   n   g   T   o   U   T   F   8   (   s   u   m   m   e   r   N   a   m   e   ,       d   s   t   _   n   a   m   e   ,       1   7   )   ;   
           }       e   l   s   e       {   
                   s   t   r   i   n   g   T   o   U   T   F   8   (   w   i   n   t   e   r   N   a   m   e   ,       d   s   t   _   n   a   m   e   ,       1   7   )   ;   
                   s   t   r   i   n   g   T   o   U   T   F   8   (   s   u   m   m   e   r   N   a   m   e   ,       s   t   d   _   n   a   m   e   ,       1   7   )   ;   
           }   
   }   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   c   o   p   y   _   p   r   e   l   o   a   d   e   d   _   f   i   l   e   _   d   a   t   a       =       (   i   n   d   e   x   ,       b   u   f   f   e   r   )       =   >       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   8   )   .   s   e   t   (   w   a   s   m   F   S   P   r   e   l   o   a   d   e   d   F   i   l   e   s   [   i   n   d   e   x   ]   .   f   i   l   e   D   a   t   a   ,       b   u   f   f   e   r   )   ;   
   
   v   a   r       w   a   s   m   F   S   P   r   e   l   o   a   d   e   d   D   i   r   s       =       [   ]   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   g   e   t   _   n   u   m   _   p   r   e   l   o   a   d   e   d   _   d   i   r   s       =       (   )       =   >       w   a   s   m   F   S   P   r   e   l   o   a   d   e   d   D   i   r   s   .   l   e   n   g   t   h   ;   
   
   v   a   r       w   a   s   m   F   S   P   r   e   l   o   a   d   e   d   F   i   l   e   s       =       [   ]   ;   
   
   v   a   r       w   a   s   m   F   S   P   r   e   l   o   a   d   i   n   g   F   l   u   s   h   e   d       =       f   a   l   s   e   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   g   e   t   _   n   u   m   _   p   r   e   l   o   a   d   e   d   _   f   i   l   e   s       =       (   )       =   >       {   
           /   /       W   h   e   n       t   h   i   s       m   e   t   h   o   d       i   s       c   a   l   l   e   d       f   r   o   m       W   a   s   m   F   S       i   t       m   e   a   n   s       t   h   a   t       w   e       a   r   e       a   b   o   u   t       t   o   
           /   /       f   l   u   s   h       a   l   l       t   h   e       p   r   e   l   o   a   d   e   d       d   a   t   a   ,       s   o       m   a   r   k       t   h   a   t   .       (   T   h   e   r   e       i   s       n   o       c   a   l   l       t   h   a   t   
           /   /       o   c   c   u   r   s       a   t       t   h   e       e   n   d       o   f       t   h   a   t       f   l   u   s   h   i   n   g   ,       w   h   i   c   h       w   o   u   l   d       b   e       m   o   r   e       n   a   t   u   r   a   l   ,       b   u   t       i   t   
           /   /       i   s       f   i   n   e       t   o       m   a   r   k       t   h   e       f   l   u   s   h   i   n   g       h   e   r   e       a   s       d   u   r   i   n   g       t   h   e       f   l   u   s   h   i   n   g       i   t   s   e   l   f       n   o       u   s   e   r   
           /   /       c   o   d   e       c   a   n       r   u   n   ,       s   o       n   o   t   h   i   n   g       w   i   l   l       c   h   e   c   k       w   h   e   t   h   e   r       w   e       h   a   v   e       f   l   u   s   h   e   d       o   r       n   o   t   .   )   
           w   a   s   m   F   S   P   r   e   l   o   a   d   i   n   g   F   l   u   s   h   e   d       =       t   r   u   e   ;   
           r   e   t   u   r   n       w   a   s   m   F   S   P   r   e   l   o   a   d   e   d   F   i   l   e   s   .   l   e   n   g   t   h   ;   
   }   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   g   e   t   _   p   r   e   l   o   a   d   e   d   _   c   h   i   l   d   _   p   a   t   h       =       (   i   n   d   e   x   ,       c   h   i   l   d   N   a   m   e   B   u   f   f   e   r   )       =   >       {   
           v   a   r       s       =       w   a   s   m   F   S   P   r   e   l   o   a   d   e   d   D   i   r   s   [   i   n   d   e   x   ]   .   c   h   i   l   d   N   a   m   e   ;   
           v   a   r       l   e   n       =       l   e   n   g   t   h   B   y   t   e   s   U   T   F   8   (   s   )       +       1   ;   
           s   t   r   i   n   g   T   o   U   T   F   8   (   s   ,       c   h   i   l   d   N   a   m   e   B   u   f   f   e   r   ,       l   e   n   )   ;   
   }   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   g   e   t   _   p   r   e   l   o   a   d   e   d   _   f   i   l   e   _   m   o   d   e       =       i   n   d   e   x       =   >       w   a   s   m   F   S   P   r   e   l   o   a   d   e   d   F   i   l   e   s   [   i   n   d   e   x   ]   .   m   o   d   e   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   g   e   t   _   p   r   e   l   o   a   d   e   d   _   f   i   l   e   _   s   i   z   e       =       i   n   d   e   x       =   >       w   a   s   m   F   S   P   r   e   l   o   a   d   e   d   F   i   l   e   s   [   i   n   d   e   x   ]   .   f   i   l   e   D   a   t   a   .   l   e   n   g   t   h   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   g   e   t   _   p   r   e   l   o   a   d   e   d   _   p   a   r   e   n   t   _   p   a   t   h       =       (   i   n   d   e   x   ,       p   a   r   e   n   t   P   a   t   h   B   u   f   f   e   r   )       =   >       {   
           v   a   r       s       =       w   a   s   m   F   S   P   r   e   l   o   a   d   e   d   D   i   r   s   [   i   n   d   e   x   ]   .   p   a   r   e   n   t   P   a   t   h   ;   
           v   a   r       l   e   n       =       l   e   n   g   t   h   B   y   t   e   s   U   T   F   8   (   s   )       +       1   ;   
           s   t   r   i   n   g   T   o   U   T   F   8   (   s   ,       p   a   r   e   n   t   P   a   t   h   B   u   f   f   e   r   ,       l   e   n   )   ;   
   }   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   g   e   t   _   p   r   e   l   o   a   d   e   d   _   p   a   t   h   _   n   a   m   e       =       (   i   n   d   e   x   ,       f   i   l   e   N   a   m   e   B   u   f   f   e   r   )       =   >       {   
           v   a   r       s       =       w   a   s   m   F   S   P   r   e   l   o   a   d   e   d   F   i   l   e   s   [   i   n   d   e   x   ]   .   p   a   t   h   N   a   m   e   ;   
           v   a   r       l   e   n       =       l   e   n   g   t   h   B   y   t   e   s   U   T   F   8   (   s   )       +       1   ;   
           s   t   r   i   n   g   T   o   U   T   F   8   (   s   ,       f   i   l   e   N   a   m   e   B   u   f   f   e   r   ,       l   e   n   )   ;   
   }   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   j   s   i   m   p   l   _   a   l   l   o   c   _   f   i   l   e       =       (   b   a   c   k   e   n   d   ,       f   i   l   e   )       =   >       {   
           a   s   s   e   r   t   (   w   a   s   m   F   S   $   b   a   c   k   e   n   d   s   [   b   a   c   k   e   n   d   ]   )   ;   
           r   e   t   u   r   n       w   a   s   m   F   S   $   b   a   c   k   e   n   d   s   [   b   a   c   k   e   n   d   ]   .   a   l   l   o   c   F   i   l   e   (   f   i   l   e   )   ;   
   }   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   j   s   i   m   p   l   _   f   r   e   e   _   f   i   l   e       =       (   b   a   c   k   e   n   d   ,       f   i   l   e   )       =   >       {   
           a   s   s   e   r   t   (   w   a   s   m   F   S   $   b   a   c   k   e   n   d   s   [   b   a   c   k   e   n   d   ]   )   ;   
           r   e   t   u   r   n       w   a   s   m   F   S   $   b   a   c   k   e   n   d   s   [   b   a   c   k   e   n   d   ]   .   f   r   e   e   F   i   l   e   (   f   i   l   e   )   ;   
   }   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   j   s   i   m   p   l   _   g   e   t   _   s   i   z   e       =       (   b   a   c   k   e   n   d   ,       f   i   l   e   )       =   >       {   
           a   s   s   e   r   t   (   w   a   s   m   F   S   $   b   a   c   k   e   n   d   s   [   b   a   c   k   e   n   d   ]   )   ;   
           r   e   t   u   r   n       w   a   s   m   F   S   $   b   a   c   k   e   n   d   s   [   b   a   c   k   e   n   d   ]   .   g   e   t   S   i   z   e   (   f   i   l   e   )   ;   
   }   ;   
   
   v   a   r       I   N   T   5   3   _   M   A   X       =       9   0   0   7   1   9   9   2   5   4   7   4   0   9   9   2   ;   
   
   v   a   r       I   N   T   5   3   _   M   I   N       =       -   9   0   0   7   1   9   9   2   5   4   7   4   0   9   9   2   ;   
   
   v   a   r       b   i   g   i   n   t   T   o   I   5   3   C   h   e   c   k   e   d       =       n   u   m       =   >       (   n   u   m       <       I   N   T   5   3   _   M   I   N       |   |       n   u   m       >       I   N   T   5   3   _   M   A   X   )       ?       N   a   N       :       N   u   m   b   e   r   (   n   u   m   )   ;   
   
   f   u   n   c   t   i   o   n       _   _   w   a   s   m   f   s   _   j   s   i   m   p   l   _   r   e   a   d   (   b   a   c   k   e   n   d   ,       f   i   l   e   ,       b   u   f   f   e   r   ,       l   e   n   g   t   h   ,       o   f   f   s   e   t   )       {   
           o   f   f   s   e   t       =       b   i   g   i   n   t   T   o   I   5   3   C   h   e   c   k   e   d   (   o   f   f   s   e   t   )   ;   
           a   s   s   e   r   t   (   w   a   s   m   F   S   $   b   a   c   k   e   n   d   s   [   b   a   c   k   e   n   d   ]   )   ;   
           i   f       (   !   w   a   s   m   F   S   $   b   a   c   k   e   n   d   s   [   b   a   c   k   e   n   d   ]   .   r   e   a   d   )       {   
                   r   e   t   u   r   n       -   2   8   ;   
           }   
           r   e   t   u   r   n       w   a   s   m   F   S   $   b   a   c   k   e   n   d   s   [   b   a   c   k   e   n   d   ]   .   r   e   a   d   (   f   i   l   e   ,       b   u   f   f   e   r   ,       l   e   n   g   t   h   ,       o   f   f   s   e   t   )   ;   
   }   
   
   f   u   n   c   t   i   o   n       _   _   w   a   s   m   f   s   _   j   s   i   m   p   l   _   s   e   t   _   s   i   z   e   (   b   a   c   k   e   n   d   ,       f   i   l   e   ,       s   i   z   e   )       {   
           s   i   z   e       =       b   i   g   i   n   t   T   o   I   5   3   C   h   e   c   k   e   d   (   s   i   z   e   )   ;   
           a   s   s   e   r   t   (   w   a   s   m   F   S   $   b   a   c   k   e   n   d   s   [   b   a   c   k   e   n   d   ]   )   ;   
           r   e   t   u   r   n       w   a   s   m   F   S   $   b   a   c   k   e   n   d   s   [   b   a   c   k   e   n   d   ]   .   s   e   t   S   i   z   e   (   f   i   l   e   ,       s   i   z   e   )   ;   
   }   
   
   f   u   n   c   t   i   o   n       _   _   w   a   s   m   f   s   _   j   s   i   m   p   l   _   w   r   i   t   e   (   b   a   c   k   e   n   d   ,       f   i   l   e   ,       b   u   f   f   e   r   ,       l   e   n   g   t   h   ,       o   f   f   s   e   t   )       {   
           o   f   f   s   e   t       =       b   i   g   i   n   t   T   o   I   5   3   C   h   e   c   k   e   d   (   o   f   f   s   e   t   )   ;   
           a   s   s   e   r   t   (   w   a   s   m   F   S   $   b   a   c   k   e   n   d   s   [   b   a   c   k   e   n   d   ]   )   ;   
           i   f       (   !   w   a   s   m   F   S   $   b   a   c   k   e   n   d   s   [   b   a   c   k   e   n   d   ]   .   w   r   i   t   e   )       {   
                   r   e   t   u   r   n       -   2   8   ;   
           }   
           r   e   t   u   r   n       w   a   s   m   F   S   $   b   a   c   k   e   n   d   s   [   b   a   c   k   e   n   d   ]   .   w   r   i   t   e   (   f   i   l   e   ,       b   u   f   f   e   r   ,       l   e   n   g   t   h   ,       o   f   f   s   e   t   )   ;   
   }   
   
   v   a   r       F   S   _   s   t   d   i   n   _   g   e   t   C   h   a   r   _   b   u   f   f   e   r       =       [   ]   ;   
   
   /   *   *       @   t   y   p   e       {   f   u   n   c   t   i   o   n   (   s   t   r   i   n   g   ,       b   o   o   l   e   a   n   =   ,       n   u   m   b   e   r   =   )   }       *   /       v   a   r       i   n   t   A   r   r   a   y   F   r   o   m   S   t   r   i   n   g       =       (   s   t   r   i   n   g   y   ,       d   o   n   t   A   d   d   N   u   l   l   ,       l   e   n   g   t   h   )       =   >       {   
           v   a   r       l   e   n       =       l   e   n   g   t   h       >       0       ?       l   e   n   g   t   h       :       l   e   n   g   t   h   B   y   t   e   s   U   T   F   8   (   s   t   r   i   n   g   y   )       +       1   ;   
           v   a   r       u   8   a   r   r   a   y       =       n   e   w       A   r   r   a   y   (   l   e   n   )   ;   
           v   a   r       n   u   m   B   y   t   e   s   W   r   i   t   t   e   n       =       s   t   r   i   n   g   T   o   U   T   F   8   A   r   r   a   y   (   s   t   r   i   n   g   y   ,       u   8   a   r   r   a   y   ,       0   ,       u   8   a   r   r   a   y   .   l   e   n   g   t   h   )   ;   
           i   f       (   d   o   n   t   A   d   d   N   u   l   l   )       u   8   a   r   r   a   y   .   l   e   n   g   t   h       =       n   u   m   B   y   t   e   s   W   r   i   t   t   e   n   ;   
           r   e   t   u   r   n       u   8   a   r   r   a   y   ;   
   }   ;   
   
   v   a   r       F   S   _   s   t   d   i   n   _   g   e   t   C   h   a   r       =       (   )       =   >       {   
           i   f       (   !   F   S   _   s   t   d   i   n   _   g   e   t   C   h   a   r   _   b   u   f   f   e   r   .   l   e   n   g   t   h   )       {   
                   v   a   r       r   e   s   u   l   t       =       n   u   l   l   ;   
                   i   f       (   t   y   p   e   o   f       w   i   n   d   o   w       !   =       "   u   n   d   e   f   i   n   e   d   "       &   &       t   y   p   e   o   f       w   i   n   d   o   w   .   p   r   o   m   p   t       =   =       "   f   u   n   c   t   i   o   n   "   )       {   
                           /   /       B   r   o   w   s   e   r   .   
                           r   e   s   u   l   t       =       w   i   n   d   o   w   .   p   r   o   m   p   t   (   "   I   n   p   u   t   :       "   )   ;   
                           /   /       r   e   t   u   r   n   s       n   u   l   l       o   n       c   a   n   c   e   l   
                           i   f       (   r   e   s   u   l   t       !   =   =       n   u   l   l   )       {   
                                   r   e   s   u   l   t       +   =       "   \   n   "   ;   
                           }   
                   }       e   l   s   e       {   }   
                   i   f       (   !   r   e   s   u   l   t   )       {   
                           r   e   t   u   r   n       n   u   l   l   ;   
                   }   
                   F   S   _   s   t   d   i   n   _   g   e   t   C   h   a   r   _   b   u   f   f   e   r       =       i   n   t   A   r   r   a   y   F   r   o   m   S   t   r   i   n   g   (   r   e   s   u   l   t   ,       t   r   u   e   )   ;   
           }   
           r   e   t   u   r   n       F   S   _   s   t   d   i   n   _   g   e   t   C   h   a   r   _   b   u   f   f   e   r   .   s   h   i   f   t   (   )   ;   
   }   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   s   t   d   i   n   _   g   e   t   _   c   h   a   r       =       (   )       =   >       {   
           /   /       R   e   t   u   r   n       t   h   e       r   e   a   d       c   h   a   r   a   c   t   e   r   ,       o   r       -   1       t   o       i   n   d   i   c   a   t   e       E   O   F   .   
           v   a   r       c       =       F   S   _   s   t   d   i   n   _   g   e   t   C   h   a   r   (   )   ;   
           i   f       (   t   y   p   e   o   f       c       =   =   =       "   n   u   m   b   e   r   "   )       {   
                   r   e   t   u   r   n       c   ;   
           }   
           r   e   t   u   r   n       -   1   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   e   t   _   n   o   w       =       (   )       =   >       p   e   r   f   o   r   m   a   n   c   e   .   t   i   m   e   O   r   i   g   i   n       +       p   e   r   f   o   r   m   a   n   c   e   .   n   o   w   (   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   d   a   t   e   _   n   o   w       =       (   )       =   >       D   a   t   e   .   n   o   w   (   )   ;   
   
   v   a   r       n   o   w   I   s   M   o   n   o   t   o   n   i   c       =       1   ;   
   
   v   a   r       c   h   e   c   k   W   a   s   i   C   l   o   c   k       =       c   l   o   c   k   _   i   d       =   >       c   l   o   c   k   _   i   d       >   =       0       &   &       c   l   o   c   k   _   i   d       <   =       3   ;   
   
   f   u   n   c   t   i   o   n       _   c   l   o   c   k   _   t   i   m   e   _   g   e   t   (   c   l   k   _   i   d   ,       i   g   n   o   r   e   d   _   p   r   e   c   i   s   i   o   n   ,       p   t   i   m   e   )       {   
           i   g   n   o   r   e   d   _   p   r   e   c   i   s   i   o   n       =       b   i   g   i   n   t   T   o   I   5   3   C   h   e   c   k   e   d   (   i   g   n   o   r   e   d   _   p   r   e   c   i   s   i   o   n   )   ;   
           i   f       (   !   c   h   e   c   k   W   a   s   i   C   l   o   c   k   (   c   l   k   _   i   d   )   )       {   
                   r   e   t   u   r   n       2   8   ;   
           }   
           v   a   r       n   o   w   ;   
           /   /       a   l   l       w   a   s   i       c   l   o   c   k   s       b   u   t       r   e   a   l   t   i   m   e       a   r   e       m   o   n   o   t   o   n   i   c   
           i   f       (   c   l   k   _   i   d       =   =   =       0   )       {   
                   n   o   w       =       _   e   m   s   c   r   i   p   t   e   n   _   d   a   t   e   _   n   o   w   (   )   ;   
           }       e   l   s   e       i   f       (   n   o   w   I   s   M   o   n   o   t   o   n   i   c   )       {   
                   n   o   w       =       _   e   m   s   c   r   i   p   t   e   n   _   g   e   t   _   n   o   w   (   )   ;   
           }       e   l   s   e       {   
                   r   e   t   u   r   n       5   2   ;   
           }   
           /   /       "   n   o   w   "       i   s       i   n       m   s   ,       a   n   d       w   a   s   i       t   i   m   e   s       a   r   e       i   n       n   s   .   
           v   a   r       n   s   e   c       =       M   a   t   h   .   r   o   u   n   d   (   n   o   w       *       1   e   3       *       1   e   3   )   ;   
           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   6   4   )   [   (   (   p   t   i   m   e   )       >   >       3   )   ]       =       B   i   g   I   n   t   (   n   s   e   c   )   ;   
           r   e   t   u   r   n       0   ;   
   }   
   
   v   a   r       r   u   n   t   i   m   e   K   e   e   p   a   l   i   v   e   P   u   s   h       =       (   )       =   >       {   
           r   u   n   t   i   m   e   K   e   e   p   a   l   i   v   e   C   o   u   n   t   e   r       +   =       1   ;   
   }   ;   
   
   v   a   r       r   u   n   t   i   m   e   K   e   e   p   a   l   i   v   e   P   o   p       =       (   )       =   >       {   
           a   s   s   e   r   t   (   r   u   n   t   i   m   e   K   e   e   p   a   l   i   v   e   C   o   u   n   t   e   r       >       0   )   ;   
           r   u   n   t   i   m   e   K   e   e   p   a   l   i   v   e   C   o   u   n   t   e   r       -   =       1   ;   
   }   ;   
   
   /   *   *       @   p   a   r   a   m       {   n   u   m   b   e   r   =   }       t   i   m   e   o   u   t       *   /       v   a   r       s   a   f   e   S   e   t   T   i   m   e   o   u   t       =       (   f   u   n   c   ,       t   i   m   e   o   u   t   )       =   >       {   
           r   u   n   t   i   m   e   K   e   e   p   a   l   i   v   e   P   u   s   h   (   )   ;   
           r   e   t   u   r   n       s   e   t   T   i   m   e   o   u   t   (   (   )       =   >       {   
                   r   u   n   t   i   m   e   K   e   e   p   a   l   i   v   e   P   o   p   (   )   ;   
                   c   a   l   l   U   s   e   r   C   a   l   l   b   a   c   k   (   f   u   n   c   )   ;   
           }   ,       t   i   m   e   o   u   t   )   ;   
   }   ;   
   
   v   a   r       p   r   e   l   o   a   d   P   l   u   g   i   n   s       =       [   ]   ;   
   
   v   a   r       B   r   o   w   s   e   r       =       {   
           u   s   e   W   e   b   G   L   :       f   a   l   s   e   ,   
           i   s   F   u   l   l   s   c   r   e   e   n   :       f   a   l   s   e   ,   
           p   o   i   n   t   e   r   L   o   c   k   :       f   a   l   s   e   ,   
           m   o   d   u   l   e   C   o   n   t   e   x   t   C   r   e   a   t   e   d   C   a   l   l   b   a   c   k   s   :       [   ]   ,   
           w   o   r   k   e   r   s   :       [   ]   ,   
           p   r   e   l   o   a   d   e   d   I   m   a   g   e   s   :       {   }   ,   
           p   r   e   l   o   a   d   e   d   A   u   d   i   o   s   :       {   }   ,   
           g   e   t   C   a   n   v   a   s   :       (   )       =   >       M   o   d   u   l   e   [   "   c   a   n   v   a   s   "   ]   ,   
           i   n   i   t   (   )       {   
                   i   f       (   B   r   o   w   s   e   r   .   i   n   i   t   t   e   d   )       r   e   t   u   r   n   ;   
                   B   r   o   w   s   e   r   .   i   n   i   t   t   e   d       =       t   r   u   e   ;   
                   /   /       S   u   p   p   o   r   t       f   o   r       p   l   u   g   i   n   s       t   h   a   t       c   a   n       p   r   o   c   e   s   s       p   r   e   l   o   a   d   e   d       f   i   l   e   s   .       Y   o   u       c   a   n       a   d   d       m   o   r   e       o   f       t   h   e   s   e       t   o   
                   /   /       y   o   u   r       a   p   p       b   y       c   r   e   a   t   i   n   g       a   n   d       a   p   p   e   n   d   i   n   g       t   o       p   r   e   l   o   a   d   P   l   u   g   i   n   s   .   
                   /   /       E   a   c   h       p   l   u   g   i   n       i   s       a   s   k   e   d       i   f       i   t       c   a   n       h   a   n   d   l   e       a       f   i   l   e       b   a   s   e   d       o   n       t   h   e       f   i   l   e   '   s       n   a   m   e   .       I   f       i   t       c   a   n   ,   
                   /   /       i   t       i   s       g   i   v   e   n       t   h   e       f   i   l   e   '   s       r   a   w       d   a   t   a   .       W   h   e   n       i   t       i   s       d   o   n   e   ,       i   t       c   a   l   l   s       a       c   a   l   l   b   a   c   k       w   i   t   h       t   h   e       f   i   l   e   '   s   
                   /   /       (   p   o   s   s   i   b   l   y       m   o   d   i   f   i   e   d   )       d   a   t   a   .       F   o   r       e   x   a   m   p   l   e   ,       a       p   l   u   g   i   n       m   i   g   h   t       d   e   c   o   m   p   r   e   s   s       a       f   i   l   e   ,       o   r       i   t   
                   /   /       m   i   g   h   t       c   r   e   a   t   e       s   o   m   e       s   i   d   e       d   a   t   a       s   t   r   u   c   t   u   r   e       f   o   r       u   s   e       l   a   t   e   r       (   l   i   k   e       a   n       I   m   a   g   e       e   l   e   m   e   n   t   ,       e   t   c   .   )   .   
                   v   a   r       i   m   a   g   e   P   l   u   g   i   n       =       {   }   ;   
                   i   m   a   g   e   P   l   u   g   i   n   [   "   c   a   n   H   a   n   d   l   e   "   ]       =       f   u   n   c   t   i   o   n       i   m   a   g   e   P   l   u   g   i   n   _   c   a   n   H   a   n   d   l   e   (   n   a   m   e   )       {   
                           r   e   t   u   r   n       !   M   o   d   u   l   e   [   "   n   o   I   m   a   g   e   D   e   c   o   d   i   n   g   "   ]       &   &       /   \   .   (   j   p   g   |   j   p   e   g   |   p   n   g   |   b   m   p   |   w   e   b   p   )   $   /   i   .   t   e   s   t   (   n   a   m   e   )   ;   
                   }   ;   
                   i   m   a   g   e   P   l   u   g   i   n   [   "   h   a   n   d   l   e   "   ]       =       f   u   n   c   t   i   o   n       i   m   a   g   e   P   l   u   g   i   n   _   h   a   n   d   l   e   (   b   y   t   e   A   r   r   a   y   ,       n   a   m   e   ,       o   n   l   o   a   d   ,       o   n   e   r   r   o   r   )       {   
                           v   a   r       b       =       n   e   w       B   l   o   b   (   [       b   y   t   e   A   r   r   a   y       ]   ,       {   
                                   t   y   p   e   :       B   r   o   w   s   e   r   .   g   e   t   M   i   m   e   t   y   p   e   (   n   a   m   e   )   
                           }   )   ;   
                           i   f       (   b   .   s   i   z   e       !   =   =       b   y   t   e   A   r   r   a   y   .   l   e   n   g   t   h   )       {   
                                   /   /       S   a   f   a   r   i       b   u   g       #   1   1   8   6   3   0   
                                   /   /       S   a   f   a   r   i   '   s       B   l   o   b       c   a   n       o   n   l   y       t   a   k   e       a   n       A   r   r   a   y   B   u   f   f   e   r   
                                   b       =       n   e   w       B   l   o   b   (   [       (   n   e   w       U   i   n   t   8   A   r   r   a   y   (   b   y   t   e   A   r   r   a   y   )   )   .   b   u   f   f   e   r       ]   ,       {   
                                           t   y   p   e   :       B   r   o   w   s   e   r   .   g   e   t   M   i   m   e   t   y   p   e   (   n   a   m   e   )   
                                   }   )   ;   
                           }   
                           v   a   r       u   r   l       =       U   R   L   .   c   r   e   a   t   e   O   b   j   e   c   t   U   R   L   (   b   )   ;   
                           a   s   s   e   r   t   (   t   y   p   e   o   f       u   r   l       =   =       "   s   t   r   i   n   g   "   ,       "   c   r   e   a   t   e   O   b   j   e   c   t   U   R   L       m   u   s   t       r   e   t   u   r   n       a       u   r   l       a   s       a       s   t   r   i   n   g   "   )   ;   
                           v   a   r       i   m   g       =       n   e   w       I   m   a   g   e   ;   
                           i   m   g   .   o   n   l   o   a   d       =       (   )       =   >       {   
                                   a   s   s   e   r   t   (   i   m   g   .   c   o   m   p   l   e   t   e   ,       `   I   m   a   g   e       $   {   n   a   m   e   }       c   o   u   l   d       n   o   t       b   e       d   e   c   o   d   e   d   `   )   ;   
                                   v   a   r       c   a   n   v   a   s       =       /   *   *       @   t   y   p   e       {   !   H   T   M   L   C   a   n   v   a   s   E   l   e   m   e   n   t   }       *   /       (   d   o   c   u   m   e   n   t   .   c   r   e   a   t   e   E   l   e   m   e   n   t   (   "   c   a   n   v   a   s   "   )   )   ;   
                                   c   a   n   v   a   s   .   w   i   d   t   h       =       i   m   g   .   w   i   d   t   h   ;   
                                   c   a   n   v   a   s   .   h   e   i   g   h   t       =       i   m   g   .   h   e   i   g   h   t   ;   
                                   v   a   r       c   t   x       =       c   a   n   v   a   s   .   g   e   t   C   o   n   t   e   x   t   (   "   2   d   "   )   ;   
                                   c   t   x   .   d   r   a   w   I   m   a   g   e   (   i   m   g   ,       0   ,       0   )   ;   
                                   B   r   o   w   s   e   r   .   p   r   e   l   o   a   d   e   d   I   m   a   g   e   s   [   n   a   m   e   ]       =       c   a   n   v   a   s   ;   
                                   U   R   L   .   r   e   v   o   k   e   O   b   j   e   c   t   U   R   L   (   u   r   l   )   ;   
                                   o   n   l   o   a   d   ?   .   (   b   y   t   e   A   r   r   a   y   )   ;   
                           }   ;   
                           i   m   g   .   o   n   e   r   r   o   r       =       e   v   e   n   t       =   >       {   
                                   e   r   r   (   `   I   m   a   g   e       $   {   u   r   l   }       c   o   u   l   d       n   o   t       b   e       d   e   c   o   d   e   d   `   )   ;   
                                   o   n   e   r   r   o   r   ?   .   (   )   ;   
                           }   ;   
                           i   m   g   .   s   r   c       =       u   r   l   ;   
                   }   ;   
                   p   r   e   l   o   a   d   P   l   u   g   i   n   s   .   p   u   s   h   (   i   m   a   g   e   P   l   u   g   i   n   )   ;   
                   v   a   r       a   u   d   i   o   P   l   u   g   i   n       =       {   }   ;   
                   a   u   d   i   o   P   l   u   g   i   n   [   "   c   a   n   H   a   n   d   l   e   "   ]       =       f   u   n   c   t   i   o   n       a   u   d   i   o   P   l   u   g   i   n   _   c   a   n   H   a   n   d   l   e   (   n   a   m   e   )       {   
                           r   e   t   u   r   n       !   M   o   d   u   l   e   [   "   n   o   A   u   d   i   o   D   e   c   o   d   i   n   g   "   ]       &   &       n   a   m   e   .   s   l   i   c   e   (   -   4   )       i   n       {   
                                   "   .   o   g   g   "   :       1   ,   
                                   "   .   w   a   v   "   :       1   ,   
                                   "   .   m   p   3   "   :       1   
                           }   ;   
                   }   ;   
                   a   u   d   i   o   P   l   u   g   i   n   [   "   h   a   n   d   l   e   "   ]       =       f   u   n   c   t   i   o   n       a   u   d   i   o   P   l   u   g   i   n   _   h   a   n   d   l   e   (   b   y   t   e   A   r   r   a   y   ,       n   a   m   e   ,       o   n   l   o   a   d   ,       o   n   e   r   r   o   r   )       {   
                           v   a   r       d   o   n   e       =       f   a   l   s   e   ;   
                           f   u   n   c   t   i   o   n       f   i   n   i   s   h   (   a   u   d   i   o   )       {   
                                   i   f       (   d   o   n   e   )       r   e   t   u   r   n   ;   
                                   d   o   n   e       =       t   r   u   e   ;   
                                   B   r   o   w   s   e   r   .   p   r   e   l   o   a   d   e   d   A   u   d   i   o   s   [   n   a   m   e   ]       =       a   u   d   i   o   ;   
                                   o   n   l   o   a   d   ?   .   (   b   y   t   e   A   r   r   a   y   )   ;   
                           }   
                           f   u   n   c   t   i   o   n       f   a   i   l   (   )       {   
                                   i   f       (   d   o   n   e   )       r   e   t   u   r   n   ;   
                                   d   o   n   e       =       t   r   u   e   ;   
                                   B   r   o   w   s   e   r   .   p   r   e   l   o   a   d   e   d   A   u   d   i   o   s   [   n   a   m   e   ]       =       n   e   w       A   u   d   i   o   ;   
                                   /   /       e   m   p   t   y       s   h   i   m   
                                   o   n   e   r   r   o   r   ?   .   (   )   ;   
                           }   
                           v   a   r       b       =       n   e   w       B   l   o   b   (   [       b   y   t   e   A   r   r   a   y       ]   ,       {   
                                   t   y   p   e   :       B   r   o   w   s   e   r   .   g   e   t   M   i   m   e   t   y   p   e   (   n   a   m   e   )   
                           }   )   ;   
                           v   a   r       u   r   l       =       U   R   L   .   c   r   e   a   t   e   O   b   j   e   c   t   U   R   L   (   b   )   ;   
                           /   /       X   X   X       w   e       n   e   v   e   r       r   e   v   o   k   e       t   h   i   s   !   
                           a   s   s   e   r   t   (   t   y   p   e   o   f       u   r   l       =   =       "   s   t   r   i   n   g   "   ,       "   c   r   e   a   t   e   O   b   j   e   c   t   U   R   L       m   u   s   t       r   e   t   u   r   n       a       u   r   l       a   s       a       s   t   r   i   n   g   "   )   ;   
                           v   a   r       a   u   d   i   o       =       n   e   w       A   u   d   i   o   ;   
                           a   u   d   i   o   .   a   d   d   E   v   e   n   t   L   i   s   t   e   n   e   r   (   "   c   a   n   p   l   a   y   t   h   r   o   u   g   h   "   ,       (   )       =   >       f   i   n   i   s   h   (   a   u   d   i   o   )   ,       f   a   l   s   e   )   ;   
                           /   /       u   s   e       a   d   d   E   v   e   n   t   L   i   s   t   e   n   e   r       d   u   e       t   o       c   h   r   o   m   i   u   m       b   u   g       1   2   4   9   2   6   
                           a   u   d   i   o   .   o   n   e   r   r   o   r       =       f   u   n   c   t   i   o   n       a   u   d   i   o   _   o   n   e   r   r   o   r   (   e   v   e   n   t   )       {   
                                   i   f       (   d   o   n   e   )       r   e   t   u   r   n   ;   
                                   e   r   r   (   `   w   a   r   n   i   n   g   :       b   r   o   w   s   e   r       c   o   u   l   d       n   o   t       f   u   l   l   y       d   e   c   o   d   e       a   u   d   i   o       $   {   n   a   m   e   }   ,       t   r   y   i   n   g       s   l   o   w   e   r       b   a   s   e   6   4       a   p   p   r   o   a   c   h   `   )   ;   
                                   f   u   n   c   t   i   o   n       e   n   c   o   d   e   6   4   (   d   a   t   a   )       {   
                                           v   a   r       B   A   S   E       =       "   A   B   C   D   E   F   G   H   I   J   K   L   M   N   O   P   Q   R   S   T   U   V   W   X   Y   Z   a   b   c   d   e   f   g   h   i   j   k   l   m   n   o   p   q   r   s   t   u   v   w   x   y   z   0   1   2   3   4   5   6   7   8   9   +   /   "   ;   
                                           v   a   r       P   A   D       =       "   =   "   ;   
                                           v   a   r       r   e   t       =       "   "   ;   
                                           v   a   r       l   e   f   t   c   h   a   r       =       0   ;   
                                           v   a   r       l   e   f   t   b   i   t   s       =       0   ;   
                                           f   o   r       (   v   a   r       i       =       0   ;       i       <       d   a   t   a   .   l   e   n   g   t   h   ;       i   +   +   )       {   
                                                   l   e   f   t   c   h   a   r       =       (   l   e   f   t   c   h   a   r       <   <       8   )       |       d   a   t   a   [   i   ]   ;   
                                                   l   e   f   t   b   i   t   s       +   =       8   ;   
                                                   w   h   i   l   e       (   l   e   f   t   b   i   t   s       >   =       6   )       {   
                                                           v   a   r       c   u   r   r       =       (   l   e   f   t   c   h   a   r       >   >       (   l   e   f   t   b   i   t   s       -       6   )   )       &       6   3   ;   
                                                           l   e   f   t   b   i   t   s       -   =       6   ;   
                                                           r   e   t       +   =       B   A   S   E   [   c   u   r   r   ]   ;   
                                                   }   
                                           }   
                                           i   f       (   l   e   f   t   b   i   t   s       =   =       2   )       {   
                                                   r   e   t       +   =       B   A   S   E   [   (   l   e   f   t   c   h   a   r       &       3   )       <   <       4   ]   ;   
                                                   r   e   t       +   =       P   A   D       +       P   A   D   ;   
                                           }       e   l   s   e       i   f       (   l   e   f   t   b   i   t   s       =   =       4   )       {   
                                                   r   e   t       +   =       B   A   S   E   [   (   l   e   f   t   c   h   a   r       &       1   5   )       <   <       2   ]   ;   
                                                   r   e   t       +   =       P   A   D   ;   
                                           }   
                                           r   e   t   u   r   n       r   e   t   ;   
                                   }   
                                   a   u   d   i   o   .   s   r   c       =       "   d   a   t   a   :   a   u   d   i   o   /   x   -   "       +       n   a   m   e   .   s   l   i   c   e   (   -   3   )       +       "   ;   b   a   s   e   6   4   ,   "       +       e   n   c   o   d   e   6   4   (   b   y   t   e   A   r   r   a   y   )   ;   
                                   f   i   n   i   s   h   (   a   u   d   i   o   )   ;   
                           }   ;   
                           a   u   d   i   o   .   s   r   c       =       u   r   l   ;   
                           /   /       w   o   r   k   a   r   o   u   n   d       f   o   r       c   h   r   o   m   e       b   u   g       1   2   4   9   2   6       -       w   e       d   o       n   o   t       a   l   w   a   y   s       g   e   t       o   n   c   a   n   p   l   a   y   t   h   r   o   u   g   h       o   r       o   n   e   r   r   o   r   
                           s   a   f   e   S   e   t   T   i   m   e   o   u   t   (   (   )       =   >       {   
                                   f   i   n   i   s   h   (   a   u   d   i   o   )   ;   
                           }   ,       1   e   4   )   ;   
                   }   ;   
                   p   r   e   l   o   a   d   P   l   u   g   i   n   s   .   p   u   s   h   (   a   u   d   i   o   P   l   u   g   i   n   )   ;   
                   /   /       C   a   n   v   a   s       e   v   e   n   t       s   e   t   u   p   
                   f   u   n   c   t   i   o   n       p   o   i   n   t   e   r   L   o   c   k   C   h   a   n   g   e   (   )       {   
                           v   a   r       c   a   n   v   a   s       =       B   r   o   w   s   e   r   .   g   e   t   C   a   n   v   a   s   (   )   ;   
                           B   r   o   w   s   e   r   .   p   o   i   n   t   e   r   L   o   c   k       =       d   o   c   u   m   e   n   t   [   "   p   o   i   n   t   e   r   L   o   c   k   E   l   e   m   e   n   t   "   ]       =   =   =       c   a   n   v   a   s       |   |       d   o   c   u   m   e   n   t   [   "   m   o   z   P   o   i   n   t   e   r   L   o   c   k   E   l   e   m   e   n   t   "   ]       =   =   =       c   a   n   v   a   s       |   |       d   o   c   u   m   e   n   t   [   "   w   e   b   k   i   t   P   o   i   n   t   e   r   L   o   c   k   E   l   e   m   e   n   t   "   ]       =   =   =       c   a   n   v   a   s       |   |       d   o   c   u   m   e   n   t   [   "   m   s   P   o   i   n   t   e   r   L   o   c   k   E   l   e   m   e   n   t   "   ]       =   =   =       c   a   n   v   a   s   ;   
                   }   
                   v   a   r       c   a   n   v   a   s       =       B   r   o   w   s   e   r   .   g   e   t   C   a   n   v   a   s   (   )   ;   
                   i   f       (   c   a   n   v   a   s   )       {   
                           /   /       f   o   r   c   e   d       a   s   p   e   c   t       r   a   t   i   o       c   a   n       b   e       e   n   a   b   l   e   d       b   y       d   e   f   i   n   i   n   g       '   f   o   r   c   e   d   A   s   p   e   c   t   R   a   t   i   o   '       o   n       M   o   d   u   l   e   
                           /   /       M   o   d   u   l   e   [   '   f   o   r   c   e   d   A   s   p   e   c   t   R   a   t   i   o   '   ]       =       4       /       3   ;   
                           c   a   n   v   a   s   .   r   e   q   u   e   s   t   P   o   i   n   t   e   r   L   o   c   k       =       c   a   n   v   a   s   [   "   r   e   q   u   e   s   t   P   o   i   n   t   e   r   L   o   c   k   "   ]       |   |       c   a   n   v   a   s   [   "   m   o   z   R   e   q   u   e   s   t   P   o   i   n   t   e   r   L   o   c   k   "   ]       |   |       c   a   n   v   a   s   [   "   w   e   b   k   i   t   R   e   q   u   e   s   t   P   o   i   n   t   e   r   L   o   c   k   "   ]       |   |       c   a   n   v   a   s   [   "   m   s   R   e   q   u   e   s   t   P   o   i   n   t   e   r   L   o   c   k   "   ]       |   |       (   (   )       =   >       {   }   )   ;   
                           c   a   n   v   a   s   .   e   x   i   t   P   o   i   n   t   e   r   L   o   c   k       =       d   o   c   u   m   e   n   t   [   "   e   x   i   t   P   o   i   n   t   e   r   L   o   c   k   "   ]       |   |       d   o   c   u   m   e   n   t   [   "   m   o   z   E   x   i   t   P   o   i   n   t   e   r   L   o   c   k   "   ]       |   |       d   o   c   u   m   e   n   t   [   "   w   e   b   k   i   t   E   x   i   t   P   o   i   n   t   e   r   L   o   c   k   "   ]       |   |       d   o   c   u   m   e   n   t   [   "   m   s   E   x   i   t   P   o   i   n   t   e   r   L   o   c   k   "   ]       |   |       (   (   )       =   >       {   }   )   ;   
                           /   /       n   o   -   o   p       i   f       f   u   n   c   t   i   o   n       d   o   e   s       n   o   t       e   x   i   s   t   
                           c   a   n   v   a   s   .   e   x   i   t   P   o   i   n   t   e   r   L   o   c   k       =       c   a   n   v   a   s   .   e   x   i   t   P   o   i   n   t   e   r   L   o   c   k   .   b   i   n   d   (   d   o   c   u   m   e   n   t   )   ;   
                           d   o   c   u   m   e   n   t   .   a   d   d   E   v   e   n   t   L   i   s   t   e   n   e   r   (   "   p   o   i   n   t   e   r   l   o   c   k   c   h   a   n   g   e   "   ,       p   o   i   n   t   e   r   L   o   c   k   C   h   a   n   g   e   ,       f   a   l   s   e   )   ;   
                           d   o   c   u   m   e   n   t   .   a   d   d   E   v   e   n   t   L   i   s   t   e   n   e   r   (   "   m   o   z   p   o   i   n   t   e   r   l   o   c   k   c   h   a   n   g   e   "   ,       p   o   i   n   t   e   r   L   o   c   k   C   h   a   n   g   e   ,       f   a   l   s   e   )   ;   
                           d   o   c   u   m   e   n   t   .   a   d   d   E   v   e   n   t   L   i   s   t   e   n   e   r   (   "   w   e   b   k   i   t   p   o   i   n   t   e   r   l   o   c   k   c   h   a   n   g   e   "   ,       p   o   i   n   t   e   r   L   o   c   k   C   h   a   n   g   e   ,       f   a   l   s   e   )   ;   
                           d   o   c   u   m   e   n   t   .   a   d   d   E   v   e   n   t   L   i   s   t   e   n   e   r   (   "   m   s   p   o   i   n   t   e   r   l   o   c   k   c   h   a   n   g   e   "   ,       p   o   i   n   t   e   r   L   o   c   k   C   h   a   n   g   e   ,       f   a   l   s   e   )   ;   
                           i   f       (   M   o   d   u   l   e   [   "   e   l   e   m   e   n   t   P   o   i   n   t   e   r   L   o   c   k   "   ]   )       {   
                                   c   a   n   v   a   s   .   a   d   d   E   v   e   n   t   L   i   s   t   e   n   e   r   (   "   c   l   i   c   k   "   ,       e   v       =   >       {   
                                           i   f       (   !   B   r   o   w   s   e   r   .   p   o   i   n   t   e   r   L   o   c   k       &   &       B   r   o   w   s   e   r   .   g   e   t   C   a   n   v   a   s   (   )   .   r   e   q   u   e   s   t   P   o   i   n   t   e   r   L   o   c   k   )       {   
                                                   B   r   o   w   s   e   r   .   g   e   t   C   a   n   v   a   s   (   )   .   r   e   q   u   e   s   t   P   o   i   n   t   e   r   L   o   c   k   (   )   ;   
                                                   e   v   .   p   r   e   v   e   n   t   D   e   f   a   u   l   t   (   )   ;   
                                           }   
                                   }   ,       f   a   l   s   e   )   ;   
                           }   
                   }   
           }   ,   
           c   r   e   a   t   e   C   o   n   t   e   x   t   (   /   *   *       @   t   y   p   e       {   H   T   M   L   C   a   n   v   a   s   E   l   e   m   e   n   t   }       *   /       c   a   n   v   a   s   ,       u   s   e   W   e   b   G   L   ,       s   e   t   I   n   M   o   d   u   l   e   ,       w   e   b   G   L   C   o   n   t   e   x   t   A   t   t   r   i   b   u   t   e   s   )       {   
                   i   f       (   u   s   e   W   e   b   G   L       &   &       M   o   d   u   l   e   [   "   c   t   x   "   ]       &   &       c   a   n   v   a   s       =   =       B   r   o   w   s   e   r   .   g   e   t   C   a   n   v   a   s   (   )   )       r   e   t   u   r   n       M   o   d   u   l   e   [   "   c   t   x   "   ]   ;   
                   /   /       n   o       n   e   e   d       t   o       r   e   c   r   e   a   t   e       G   L       c   o   n   t   e   x   t       i   f       i   t   '   s       a   l   r   e   a   d   y       b   e   e   n       c   r   e   a   t   e   d       f   o   r       t   h   i   s       c   a   n   v   a   s   .   
                   v   a   r       c   t   x   ;   
                   v   a   r       c   o   n   t   e   x   t   H   a   n   d   l   e   ;   
                   i   f       (   u   s   e   W   e   b   G   L   )       {   
                           /   /       F   o   r       G   L   E   S   2   /   d   e   s   k   t   o   p       G   L       c   o   m   p   a   t   i   b   i   l   i   t   y   ,       a   d   j   u   s   t       a       f   e   w       d   e   f   a   u   l   t   s       t   o       b   e       d   i   f   f   e   r   e   n   t       t   o       W   e   b   G   L       d   e   f   a   u   l   t   s   ,       s   o       t   h   a   t       t   h   e   y       a   l   i   g   n       b   e   t   t   e   r       w   i   t   h       t   h   e       d   e   s   k   t   o   p       d   e   f   a   u   l   t   s   .   
                           v   a   r       c   o   n   t   e   x   t   A   t   t   r   i   b   u   t   e   s       =       {   
                                   a   n   t   i   a   l   i   a   s   :       f   a   l   s   e   ,   
                                   a   l   p   h   a   :       f   a   l   s   e   ,   
                                   m   a   j   o   r   V   e   r   s   i   o   n   :       2   
                           }   ;   
                           i   f       (   w   e   b   G   L   C   o   n   t   e   x   t   A   t   t   r   i   b   u   t   e   s   )       {   
                                   f   o   r       (   v   a   r       a   t   t   r   i   b   u   t   e       i   n       w   e   b   G   L   C   o   n   t   e   x   t   A   t   t   r   i   b   u   t   e   s   )       {   
                                           c   o   n   t   e   x   t   A   t   t   r   i   b   u   t   e   s   [   a   t   t   r   i   b   u   t   e   ]       =       w   e   b   G   L   C   o   n   t   e   x   t   A   t   t   r   i   b   u   t   e   s   [   a   t   t   r   i   b   u   t   e   ]   ;   
                                   }   
                           }   
                           /   /       T   h   i   s       c   h   e   c   k       o   f       e   x   i   s   t   e   n   c   e       o   f       G   L       i   s       h   e   r   e       t   o       s   a   t   i   s   f   y       C   l   o   s   u   r   e       c   o   m   p   i   l   e   r   ,       w   h   i   c   h       y   e   l   l   s       i   f       v   a   r   i   a   b   l   e       G   L       i   s       r   e   f   e   r   e   n   c   e   d       b   e   l   o   w       b   u   t       G   L       o   b   j   e   c   t       i   s       n   o   t   
                           /   /       a   c   t   u   a   l   l   y       c   o   m   p   i   l   e   d       i   n       b   e   c   a   u   s   e       a   p   p   l   i   c   a   t   i   o   n       i   s       n   o   t       d   o   i   n   g       a   n   y       G   L       o   p   e   r   a   t   i   o   n   s   .       T   O   D   O   :       I   d   e   a   l   l   y       i   f       G   L       i   s       n   o   t       b   e   i   n   g       u   s   e   d   ,       t   h   i   s       f   u   n   c   t   i   o   n   
                           /   /       B   r   o   w   s   e   r   .   c   r   e   a   t   e   C   o   n   t   e   x   t   (   )       s   h   o   u   l   d       n   o   t       e   v   e   n       b   e       e   m   i   t   t   e   d   .   
                           i   f       (   t   y   p   e   o   f       G   L       !   =       "   u   n   d   e   f   i   n   e   d   "   )       {   
                                   c   o   n   t   e   x   t   H   a   n   d   l   e       =       G   L   .   c   r   e   a   t   e   C   o   n   t   e   x   t   (   c   a   n   v   a   s   ,       c   o   n   t   e   x   t   A   t   t   r   i   b   u   t   e   s   )   ;   
                                   i   f       (   c   o   n   t   e   x   t   H   a   n   d   l   e   )       {   
                                           c   t   x       =       G   L   .   g   e   t   C   o   n   t   e   x   t   (   c   o   n   t   e   x   t   H   a   n   d   l   e   )   .   G   L   c   t   x   ;   
                                   }   
                           }   
                   }       e   l   s   e       {   
                           c   t   x       =       c   a   n   v   a   s   .   g   e   t   C   o   n   t   e   x   t   (   "   2   d   "   )   ;   
                   }   
                   i   f       (   !   c   t   x   )       r   e   t   u   r   n       n   u   l   l   ;   
                   i   f       (   s   e   t   I   n   M   o   d   u   l   e   )       {   
                           i   f       (   !   u   s   e   W   e   b   G   L   )       a   s   s   e   r   t   (   t   y   p   e   o   f       G   L   c   t   x       =   =       "   u   n   d   e   f   i   n   e   d   "   ,       "   c   a   n   n   o   t       s   e   t       i   n       m   o   d   u   l   e       i   f       G   L   c   t   x       i   s       u   s   e   d   ,       b   u   t       w   e       a   r   e       a       n   o   n   -   G   L       c   o   n   t   e   x   t       t   h   a   t       w   o   u   l   d       r   e   p   l   a   c   e       i   t   "   )   ;   
                           M   o   d   u   l   e   [   "   c   t   x   "   ]       =       c   t   x   ;   
                           i   f       (   u   s   e   W   e   b   G   L   )       G   L   .   m   a   k   e   C   o   n   t   e   x   t   C   u   r   r   e   n   t   (   c   o   n   t   e   x   t   H   a   n   d   l   e   )   ;   
                           B   r   o   w   s   e   r   .   u   s   e   W   e   b   G   L       =       u   s   e   W   e   b   G   L   ;   
                           B   r   o   w   s   e   r   .   m   o   d   u   l   e   C   o   n   t   e   x   t   C   r   e   a   t   e   d   C   a   l   l   b   a   c   k   s   .   f   o   r   E   a   c   h   (   c   a   l   l   b   a   c   k       =   >       c   a   l   l   b   a   c   k   (   )   )   ;   
                           B   r   o   w   s   e   r   .   i   n   i   t   (   )   ;   
                   }   
                   r   e   t   u   r   n       c   t   x   ;   
           }   ,   
           f   u   l   l   s   c   r   e   e   n   H   a   n   d   l   e   r   s   I   n   s   t   a   l   l   e   d   :       f   a   l   s   e   ,   
           l   o   c   k   P   o   i   n   t   e   r   :       u   n   d   e   f   i   n   e   d   ,   
           r   e   s   i   z   e   C   a   n   v   a   s   :       u   n   d   e   f   i   n   e   d   ,   
           r   e   q   u   e   s   t   F   u   l   l   s   c   r   e   e   n   (   l   o   c   k   P   o   i   n   t   e   r   ,       r   e   s   i   z   e   C   a   n   v   a   s   )       {   
                   B   r   o   w   s   e   r   .   l   o   c   k   P   o   i   n   t   e   r       =       l   o   c   k   P   o   i   n   t   e   r   ;   
                   B   r   o   w   s   e   r   .   r   e   s   i   z   e   C   a   n   v   a   s       =       r   e   s   i   z   e   C   a   n   v   a   s   ;   
                   i   f       (   t   y   p   e   o   f       B   r   o   w   s   e   r   .   l   o   c   k   P   o   i   n   t   e   r       =   =       "   u   n   d   e   f   i   n   e   d   "   )       B   r   o   w   s   e   r   .   l   o   c   k   P   o   i   n   t   e   r       =       t   r   u   e   ;   
                   i   f       (   t   y   p   e   o   f       B   r   o   w   s   e   r   .   r   e   s   i   z   e   C   a   n   v   a   s       =   =       "   u   n   d   e   f   i   n   e   d   "   )       B   r   o   w   s   e   r   .   r   e   s   i   z   e   C   a   n   v   a   s       =       f   a   l   s   e   ;   
                   v   a   r       c   a   n   v   a   s       =       B   r   o   w   s   e   r   .   g   e   t   C   a   n   v   a   s   (   )   ;   
                   f   u   n   c   t   i   o   n       f   u   l   l   s   c   r   e   e   n   C   h   a   n   g   e   (   )       {   
                           B   r   o   w   s   e   r   .   i   s   F   u   l   l   s   c   r   e   e   n       =       f   a   l   s   e   ;   
                           v   a   r       c   a   n   v   a   s   C   o   n   t   a   i   n   e   r       =       c   a   n   v   a   s   .   p   a   r   e   n   t   N   o   d   e   ;   
                           i   f       (   (   d   o   c   u   m   e   n   t   [   "   f   u   l   l   s   c   r   e   e   n   E   l   e   m   e   n   t   "   ]       |   |       d   o   c   u   m   e   n   t   [   "   m   o   z   F   u   l   l   S   c   r   e   e   n   E   l   e   m   e   n   t   "   ]       |   |       d   o   c   u   m   e   n   t   [   "   m   s   F   u   l   l   s   c   r   e   e   n   E   l   e   m   e   n   t   "   ]       |   |       d   o   c   u   m   e   n   t   [   "   w   e   b   k   i   t   F   u   l   l   s   c   r   e   e   n   E   l   e   m   e   n   t   "   ]       |   |       d   o   c   u   m   e   n   t   [   "   w   e   b   k   i   t   C   u   r   r   e   n   t   F   u   l   l   S   c   r   e   e   n   E   l   e   m   e   n   t   "   ]   )       =   =   =       c   a   n   v   a   s   C   o   n   t   a   i   n   e   r   )       {   
                                   c   a   n   v   a   s   .   e   x   i   t   F   u   l   l   s   c   r   e   e   n       =       B   r   o   w   s   e   r   .   e   x   i   t   F   u   l   l   s   c   r   e   e   n   ;   
                                   i   f       (   B   r   o   w   s   e   r   .   l   o   c   k   P   o   i   n   t   e   r   )       c   a   n   v   a   s   .   r   e   q   u   e   s   t   P   o   i   n   t   e   r   L   o   c   k   (   )   ;   
                                   B   r   o   w   s   e   r   .   i   s   F   u   l   l   s   c   r   e   e   n       =       t   r   u   e   ;   
                                   i   f       (   B   r   o   w   s   e   r   .   r   e   s   i   z   e   C   a   n   v   a   s   )       {   
                                           B   r   o   w   s   e   r   .   s   e   t   F   u   l   l   s   c   r   e   e   n   C   a   n   v   a   s   S   i   z   e   (   )   ;   
                                   }       e   l   s   e       {   
                                           B   r   o   w   s   e   r   .   u   p   d   a   t   e   C   a   n   v   a   s   D   i   m   e   n   s   i   o   n   s   (   c   a   n   v   a   s   )   ;   
                                   }   
                           }       e   l   s   e       {   
                                   /   /       r   e   m   o   v   e       t   h   e       f   u   l   l       s   c   r   e   e   n       s   p   e   c   i   f   i   c       p   a   r   e   n   t       o   f       t   h   e       c   a   n   v   a   s       a   g   a   i   n       t   o       r   e   s   t   o   r   e       t   h   e       H   T   M   L       s   t   r   u   c   t   u   r   e       f   r   o   m       b   e   f   o   r   e       g   o   i   n   g       f   u   l   l       s   c   r   e   e   n   
                                   c   a   n   v   a   s   C   o   n   t   a   i   n   e   r   .   p   a   r   e   n   t   N   o   d   e   .   i   n   s   e   r   t   B   e   f   o   r   e   (   c   a   n   v   a   s   ,       c   a   n   v   a   s   C   o   n   t   a   i   n   e   r   )   ;   
                                   c   a   n   v   a   s   C   o   n   t   a   i   n   e   r   .   p   a   r   e   n   t   N   o   d   e   .   r   e   m   o   v   e   C   h   i   l   d   (   c   a   n   v   a   s   C   o   n   t   a   i   n   e   r   )   ;   
                                   i   f       (   B   r   o   w   s   e   r   .   r   e   s   i   z   e   C   a   n   v   a   s   )       {   
                                           B   r   o   w   s   e   r   .   s   e   t   W   i   n   d   o   w   e   d   C   a   n   v   a   s   S   i   z   e   (   )   ;   
                                   }       e   l   s   e       {   
                                           B   r   o   w   s   e   r   .   u   p   d   a   t   e   C   a   n   v   a   s   D   i   m   e   n   s   i   o   n   s   (   c   a   n   v   a   s   )   ;   
                                   }   
                           }   
                           M   o   d   u   l   e   [   "   o   n   F   u   l   l   S   c   r   e   e   n   "   ]   ?   .   (   B   r   o   w   s   e   r   .   i   s   F   u   l   l   s   c   r   e   e   n   )   ;   
                           M   o   d   u   l   e   [   "   o   n   F   u   l   l   s   c   r   e   e   n   "   ]   ?   .   (   B   r   o   w   s   e   r   .   i   s   F   u   l   l   s   c   r   e   e   n   )   ;   
                   }   
                   i   f       (   !   B   r   o   w   s   e   r   .   f   u   l   l   s   c   r   e   e   n   H   a   n   d   l   e   r   s   I   n   s   t   a   l   l   e   d   )       {   
                           B   r   o   w   s   e   r   .   f   u   l   l   s   c   r   e   e   n   H   a   n   d   l   e   r   s   I   n   s   t   a   l   l   e   d       =       t   r   u   e   ;   
                           d   o   c   u   m   e   n   t   .   a   d   d   E   v   e   n   t   L   i   s   t   e   n   e   r   (   "   f   u   l   l   s   c   r   e   e   n   c   h   a   n   g   e   "   ,       f   u   l   l   s   c   r   e   e   n   C   h   a   n   g   e   ,       f   a   l   s   e   )   ;   
                           d   o   c   u   m   e   n   t   .   a   d   d   E   v   e   n   t   L   i   s   t   e   n   e   r   (   "   m   o   z   f   u   l   l   s   c   r   e   e   n   c   h   a   n   g   e   "   ,       f   u   l   l   s   c   r   e   e   n   C   h   a   n   g   e   ,       f   a   l   s   e   )   ;   
                           d   o   c   u   m   e   n   t   .   a   d   d   E   v   e   n   t   L   i   s   t   e   n   e   r   (   "   w   e   b   k   i   t   f   u   l   l   s   c   r   e   e   n   c   h   a   n   g   e   "   ,       f   u   l   l   s   c   r   e   e   n   C   h   a   n   g   e   ,       f   a   l   s   e   )   ;   
                           d   o   c   u   m   e   n   t   .   a   d   d   E   v   e   n   t   L   i   s   t   e   n   e   r   (   "   M   S   F   u   l   l   s   c   r   e   e   n   C   h   a   n   g   e   "   ,       f   u   l   l   s   c   r   e   e   n   C   h   a   n   g   e   ,       f   a   l   s   e   )   ;   
                   }   
                   /   /       c   r   e   a   t   e       a       n   e   w       p   a   r   e   n   t       t   o       e   n   s   u   r   e       t   h   e       c   a   n   v   a   s       h   a   s       n   o       s   i   b   l   i   n   g   s   .       t   h   i   s       a   l   l   o   w   s       b   r   o   w   s   e   r   s       t   o       o   p   t   i   m   i   z   e       f   u   l   l       s   c   r   e   e   n       p   e   r   f   o   r   m   a   n   c   e       w   h   e   n       i   t   s       p   a   r   e   n   t       i   s       t   h   e       f   u   l   l       s   c   r   e   e   n       r   o   o   t   
                   v   a   r       c   a   n   v   a   s   C   o   n   t   a   i   n   e   r       =       d   o   c   u   m   e   n   t   .   c   r   e   a   t   e   E   l   e   m   e   n   t   (   "   d   i   v   "   )   ;   
                   c   a   n   v   a   s   .   p   a   r   e   n   t   N   o   d   e   .   i   n   s   e   r   t   B   e   f   o   r   e   (   c   a   n   v   a   s   C   o   n   t   a   i   n   e   r   ,       c   a   n   v   a   s   )   ;   
                   c   a   n   v   a   s   C   o   n   t   a   i   n   e   r   .   a   p   p   e   n   d   C   h   i   l   d   (   c   a   n   v   a   s   )   ;   
                   /   /       u   s   e       p   a   r   e   n   t       o   f       c   a   n   v   a   s       a   s       f   u   l   l       s   c   r   e   e   n       r   o   o   t       t   o       a   l   l   o   w       a   s   p   e   c   t       r   a   t   i   o       c   o   r   r   e   c   t   i   o   n       (   F   i   r   e   f   o   x       s   t   r   e   t   c   h   e   s       t   h   e       r   o   o   t       t   o       s   c   r   e   e   n       s   i   z   e   )   
                   c   a   n   v   a   s   C   o   n   t   a   i   n   e   r   .   r   e   q   u   e   s   t   F   u   l   l   s   c   r   e   e   n       =       c   a   n   v   a   s   C   o   n   t   a   i   n   e   r   [   "   r   e   q   u   e   s   t   F   u   l   l   s   c   r   e   e   n   "   ]       |   |       c   a   n   v   a   s   C   o   n   t   a   i   n   e   r   [   "   m   o   z   R   e   q   u   e   s   t   F   u   l   l   S   c   r   e   e   n   "   ]       |   |       c   a   n   v   a   s   C   o   n   t   a   i   n   e   r   [   "   m   s   R   e   q   u   e   s   t   F   u   l   l   s   c   r   e   e   n   "   ]       |   |       (   c   a   n   v   a   s   C   o   n   t   a   i   n   e   r   [   "   w   e   b   k   i   t   R   e   q   u   e   s   t   F   u   l   l   s   c   r   e   e   n   "   ]       ?       (   )       =   >       c   a   n   v   a   s   C   o   n   t   a   i   n   e   r   [   "   w   e   b   k   i   t   R   e   q   u   e   s   t   F   u   l   l   s   c   r   e   e   n   "   ]   (   E   l   e   m   e   n   t   [   "   A   L   L   O   W   _   K   E   Y   B   O   A   R   D   _   I   N   P   U   T   "   ]   )       :       n   u   l   l   )       |   |       (   c   a   n   v   a   s   C   o   n   t   a   i   n   e   r   [   "   w   e   b   k   i   t   R   e   q   u   e   s   t   F   u   l   l   S   c   r   e   e   n   "   ]       ?       (   )       =   >       c   a   n   v   a   s   C   o   n   t   a   i   n   e   r   [   "   w   e   b   k   i   t   R   e   q   u   e   s   t   F   u   l   l   S   c   r   e   e   n   "   ]   (   E   l   e   m   e   n   t   [   "   A   L   L   O   W   _   K   E   Y   B   O   A   R   D   _   I   N   P   U   T   "   ]   )       :       n   u   l   l   )   ;   
                   c   a   n   v   a   s   C   o   n   t   a   i   n   e   r   .   r   e   q   u   e   s   t   F   u   l   l   s   c   r   e   e   n   (   )   ;   
           }   ,   
           r   e   q   u   e   s   t   F   u   l   l   S   c   r   e   e   n   (   )       {   
                   a   b   o   r   t   (   "   M   o   d   u   l   e   .   r   e   q   u   e   s   t   F   u   l   l   S   c   r   e   e   n       h   a   s       b   e   e   n       r   e   p   l   a   c   e   d       b   y       M   o   d   u   l   e   .   r   e   q   u   e   s   t   F   u   l   l   s   c   r   e   e   n       (   w   i   t   h   o   u   t       a       c   a   p   i   t   a   l       S   )   "   )   ;   
           }   ,   
           e   x   i   t   F   u   l   l   s   c   r   e   e   n   (   )       {   
                   /   /       T   h   i   s       i   s       w   o   r   k   a   r   o   u   n   d       f   o   r       c   h   r   o   m   e   .       T   r   y   i   n   g       t   o       e   x   i   t       f   r   o   m       f   u   l   l   s   c   r   e   e   n   
                   /   /       n   o   t       i   n       f   u   l   l   s   c   r   e   e   n       s   t   a   t   e       w   i   l   l       c   a   u   s   e       "   T   y   p   e   E   r   r   o   r   :       D   o   c   u   m   e   n   t       n   o   t       a   c   t   i   v   e   "   
                   /   /       i   n       c   h   r   o   m   e   .       S   e   e       h   t   t   p   s   :   /   /   g   i   t   h   u   b   .   c   o   m   /   e   m   s   c   r   i   p   t   e   n   -   c   o   r   e   /   e   m   s   c   r   i   p   t   e   n   /   p   u   l   l   /   8   2   3   6   
                   i   f       (   !   B   r   o   w   s   e   r   .   i   s   F   u   l   l   s   c   r   e   e   n   )       {   
                           r   e   t   u   r   n       f   a   l   s   e   ;   
                   }   
                   v   a   r       C   F   S       =       d   o   c   u   m   e   n   t   [   "   e   x   i   t   F   u   l   l   s   c   r   e   e   n   "   ]       |   |       d   o   c   u   m   e   n   t   [   "   c   a   n   c   e   l   F   u   l   l   S   c   r   e   e   n   "   ]       |   |       d   o   c   u   m   e   n   t   [   "   m   o   z   C   a   n   c   e   l   F   u   l   l   S   c   r   e   e   n   "   ]       |   |       d   o   c   u   m   e   n   t   [   "   m   s   E   x   i   t   F   u   l   l   s   c   r   e   e   n   "   ]       |   |       d   o   c   u   m   e   n   t   [   "   w   e   b   k   i   t   C   a   n   c   e   l   F   u   l   l   S   c   r   e   e   n   "   ]       |   |       (   (   )       =   >       {   }   )   ;   
                   C   F   S   .   a   p   p   l   y   (   d   o   c   u   m   e   n   t   ,       [   ]   )   ;   
                   r   e   t   u   r   n       t   r   u   e   ;   
           }   ,   
           s   a   f   e   S   e   t   T   i   m   e   o   u   t   (   f   u   n   c   ,       t   i   m   e   o   u   t   )       {   
                   /   /       L   e   g   a   c   y       f   u   n   c   t   i   o   n   ,       t   h   i   s       i   s       u   s   e   d       b   y       t   h   e       S   D   L   2       p   o   r   t       s   o       w   e       n   e   e   d       t   o       k   e   e   p       i   t   
                   /   /       a   r   o   u   n   d       a   t       l   e   a   s   t       u   n   t   i   l       t   h   a   t       i   s       u   p   d   a   t   e   d   .   
                   /   /       S   e   e       h   t   t   p   s   :   /   /   g   i   t   h   u   b   .   c   o   m   /   l   i   b   s   d   l   -   o   r   g   /   S   D   L   /   p   u   l   l   /   6   3   0   4   
                   r   e   t   u   r   n       s   a   f   e   S   e   t   T   i   m   e   o   u   t   (   f   u   n   c   ,       t   i   m   e   o   u   t   )   ;   
           }   ,   
           g   e   t   M   i   m   e   t   y   p   e   (   n   a   m   e   )       {   
                   r   e   t   u   r   n       {   
                           "   j   p   g   "   :       "   i   m   a   g   e   /   j   p   e   g   "   ,   
                           "   j   p   e   g   "   :       "   i   m   a   g   e   /   j   p   e   g   "   ,   
                           "   p   n   g   "   :       "   i   m   a   g   e   /   p   n   g   "   ,   
                           "   b   m   p   "   :       "   i   m   a   g   e   /   b   m   p   "   ,   
                           "   o   g   g   "   :       "   a   u   d   i   o   /   o   g   g   "   ,   
                           "   w   a   v   "   :       "   a   u   d   i   o   /   w   a   v   "   ,   
                           "   m   p   3   "   :       "   a   u   d   i   o   /   m   p   e   g   "   
                   }   [   n   a   m   e   .   s   l   i   c   e   (   n   a   m   e   .   l   a   s   t   I   n   d   e   x   O   f   (   "   .   "   )       +       1   )   ]   ;   
           }   ,   
           g   e   t   U   s   e   r   M   e   d   i   a   (   f   u   n   c   )       {   
                   w   i   n   d   o   w   .   g   e   t   U   s   e   r   M   e   d   i   a       |   |   =       n   a   v   i   g   a   t   o   r   [   "   g   e   t   U   s   e   r   M   e   d   i   a   "   ]       |   |       n   a   v   i   g   a   t   o   r   [   "   m   o   z   G   e   t   U   s   e   r   M   e   d   i   a   "   ]   ;   
                   w   i   n   d   o   w   .   g   e   t   U   s   e   r   M   e   d   i   a   (   f   u   n   c   )   ;   
           }   ,   
           g   e   t   M   o   v   e   m   e   n   t   X   (   e   v   e   n   t   )       {   
                   r   e   t   u   r   n       e   v   e   n   t   [   "   m   o   v   e   m   e   n   t   X   "   ]       |   |       e   v   e   n   t   [   "   m   o   z   M   o   v   e   m   e   n   t   X   "   ]       |   |       e   v   e   n   t   [   "   w   e   b   k   i   t   M   o   v   e   m   e   n   t   X   "   ]       |   |       0   ;   
           }   ,   
           g   e   t   M   o   v   e   m   e   n   t   Y   (   e   v   e   n   t   )       {   
                   r   e   t   u   r   n       e   v   e   n   t   [   "   m   o   v   e   m   e   n   t   Y   "   ]       |   |       e   v   e   n   t   [   "   m   o   z   M   o   v   e   m   e   n   t   Y   "   ]       |   |       e   v   e   n   t   [   "   w   e   b   k   i   t   M   o   v   e   m   e   n   t   Y   "   ]       |   |       0   ;   
           }   ,   
           g   e   t   M   o   u   s   e   W   h   e   e   l   D   e   l   t   a   (   e   v   e   n   t   )       {   
                   v   a   r       d   e   l   t   a       =       0   ;   
                   s   w   i   t   c   h       (   e   v   e   n   t   .   t   y   p   e   )       {   
                       c   a   s   e       "   D   O   M   M   o   u   s   e   S   c   r   o   l   l   "   :   
                           /   /       3       l   i   n   e   s       m   a   k   e       u   p       a       s   t   e   p   
                           d   e   l   t   a       =       e   v   e   n   t   .   d   e   t   a   i   l       /       3   ;   
                           b   r   e   a   k   ;   
   
                       c   a   s   e       "   m   o   u   s   e   w   h   e   e   l   "   :   
                           /   /       1   2   0       u   n   i   t   s       m   a   k   e       u   p       a       s   t   e   p   
                           d   e   l   t   a       =       e   v   e   n   t   .   w   h   e   e   l   D   e   l   t   a       /       1   2   0   ;   
                           b   r   e   a   k   ;   
   
                       c   a   s   e       "   w   h   e   e   l   "   :   
                           d   e   l   t   a       =       e   v   e   n   t   .   d   e   l   t   a   Y   ;   
                           s   w   i   t   c   h       (   e   v   e   n   t   .   d   e   l   t   a   M   o   d   e   )       {   
                               c   a   s   e       0   :   
                                   /   /       D   O   M   _   D   E   L   T   A   _   P   I   X   E   L   :       1   0   0       p   i   x   e   l   s       m   a   k   e       u   p       a       s   t   e   p   
                                   d   e   l   t   a       /   =       1   0   0   ;   
                                   b   r   e   a   k   ;   
   
                               c   a   s   e       1   :   
                                   /   /       D   O   M   _   D   E   L   T   A   _   L   I   N   E   :       3       l   i   n   e   s       m   a   k   e       u   p       a       s   t   e   p   
                                   d   e   l   t   a       /   =       3   ;   
                                   b   r   e   a   k   ;   
   
                               c   a   s   e       2   :   
                                   /   /       D   O   M   _   D   E   L   T   A   _   P   A   G   E   :       A       p   a   g   e       m   a   k   e   s       u   p       8   0       s   t   e   p   s   
                                   d   e   l   t   a       *   =       8   0   ;   
                                   b   r   e   a   k   ;   
   
                               d   e   f   a   u   l   t   :   
                                   t   h   r   o   w       "   u   n   r   e   c   o   g   n   i   z   e   d       m   o   u   s   e       w   h   e   e   l       d   e   l   t   a       m   o   d   e   :       "       +       e   v   e   n   t   .   d   e   l   t   a   M   o   d   e   ;   
                           }   
                           b   r   e   a   k   ;   
   
                       d   e   f   a   u   l   t   :   
                           t   h   r   o   w       "   u   n   r   e   c   o   g   n   i   z   e   d       m   o   u   s   e       w   h   e   e   l       e   v   e   n   t   :       "       +       e   v   e   n   t   .   t   y   p   e   ;   
                   }   
                   r   e   t   u   r   n       d   e   l   t   a   ;   
           }   ,   
           m   o   u   s   e   X   :       0   ,   
           m   o   u   s   e   Y   :       0   ,   
           m   o   u   s   e   M   o   v   e   m   e   n   t   X   :       0   ,   
           m   o   u   s   e   M   o   v   e   m   e   n   t   Y   :       0   ,   
           t   o   u   c   h   e   s   :       {   }   ,   
           l   a   s   t   T   o   u   c   h   e   s   :       {   }   ,   
           c   a   l   c   u   l   a   t   e   M   o   u   s   e   C   o   o   r   d   s   (   p   a   g   e   X   ,       p   a   g   e   Y   )       {   
                   /   /       C   a   l   c   u   l   a   t   e       t   h   e       m   o   v   e   m   e   n   t       b   a   s   e   d       o   n       t   h   e       c   h   a   n   g   e   s   
                   /   /       i   n       t   h   e       c   o   o   r   d   i   n   a   t   e   s   .   
                   v   a   r       c   a   n   v   a   s       =       B   r   o   w   s   e   r   .   g   e   t   C   a   n   v   a   s   (   )   ;   
                   v   a   r       r   e   c   t       =       c   a   n   v   a   s   .   g   e   t   B   o   u   n   d   i   n   g   C   l   i   e   n   t   R   e   c   t   (   )   ;   
                   /   /       N   e   i   t   h   e   r       .   s   c   r   o   l   l   X       o   r       .   p   a   g   e   X   O   f   f   s   e   t       a   r   e       d   e   f   i   n   e   d       i   n       a       s   p   e   c   ,       b   u   t   
                   /   /       w   e       p   r   e   f   e   r       .   s   c   r   o   l   l   X       b   e   c   a   u   s   e       i   t       i   s       c   u   r   r   e   n   t   l   y       i   n       a       s   p   e   c       d   r   a   f   t   .   
                   /   /       (   s   e   e   :       h   t   t   p   :   /   /   w   w   w   .   w   3   .   o   r   g   /   T   R   /   2   0   1   3   /   W   D   -   c   s   s   o   m   -   v   i   e   w   -   2   0   1   3   1   2   1   7   /   )   
                   v   a   r       s   c   r   o   l   l   X       =       (   (   t   y   p   e   o   f       w   i   n   d   o   w   .   s   c   r   o   l   l   X       !   =       "   u   n   d   e   f   i   n   e   d   "   )       ?       w   i   n   d   o   w   .   s   c   r   o   l   l   X       :       w   i   n   d   o   w   .   p   a   g   e   X   O   f   f   s   e   t   )   ;   
                   v   a   r       s   c   r   o   l   l   Y       =       (   (   t   y   p   e   o   f       w   i   n   d   o   w   .   s   c   r   o   l   l   Y       !   =       "   u   n   d   e   f   i   n   e   d   "   )       ?       w   i   n   d   o   w   .   s   c   r   o   l   l   Y       :       w   i   n   d   o   w   .   p   a   g   e   Y   O   f   f   s   e   t   )   ;   
                   /   /       I   f       t   h   i   s       a   s   s   e   r   t       l   a   n   d   s   ,       i   t   '   s       l   i   k   e   l   y       b   e   c   a   u   s   e       t   h   e       b   r   o   w   s   e   r       d   o   e   s   n   '   t       s   u   p   p   o   r   t       s   c   r   o   l   l   X       o   r       p   a   g   e   X   O   f   f   s   e   t   
                   /   /       a   n   d       w   e       h   a   v   e       n   o       v   i   a   b   l   e       f   a   l   l   b   a   c   k   .   
                   a   s   s   e   r   t   (   (   t   y   p   e   o   f       s   c   r   o   l   l   X       !   =       "   u   n   d   e   f   i   n   e   d   "   )       &   &       (   t   y   p   e   o   f       s   c   r   o   l   l   Y       !   =       "   u   n   d   e   f   i   n   e   d   "   )   ,       "   U   n   a   b   l   e       t   o       r   e   t   r   i   e   v   e       s   c   r   o   l   l       p   o   s   i   t   i   o   n   ,       m   o   u   s   e       p   o   s   i   t   i   o   n   s       l   i   k   e   l   y       b   r   o   k   e   n   .   "   )   ;   
                   v   a   r       a   d   j   u   s   t   e   d   X       =       p   a   g   e   X       -       (   s   c   r   o   l   l   X       +       r   e   c   t   .   l   e   f   t   )   ;   
                   v   a   r       a   d   j   u   s   t   e   d   Y       =       p   a   g   e   Y       -       (   s   c   r   o   l   l   Y       +       r   e   c   t   .   t   o   p   )   ;   
                   /   /       t   h   e       c   a   n   v   a   s       m   i   g   h   t       b   e       C   S   S   -   s   c   a   l   e   d       c   o   m   p   a   r   e   d       t   o       i   t   s       b   a   c   k   b   u   f   f   e   r   ;   
                   /   /       S   D   L   -   u   s   i   n   g       c   o   n   t   e   n   t       w   i   l   l       w   a   n   t       m   o   u   s   e       c   o   o   r   d   i   n   a   t   e   s       i   n       t   e   r   m   s   
                   /   /       o   f       b   a   c   k   b   u   f   f   e   r       u   n   i   t   s   .   
                   a   d   j   u   s   t   e   d   X       =       a   d   j   u   s   t   e   d   X       *       (   c   a   n   v   a   s   .   w   i   d   t   h       /       r   e   c   t   .   w   i   d   t   h   )   ;   
                   a   d   j   u   s   t   e   d   Y       =       a   d   j   u   s   t   e   d   Y       *       (   c   a   n   v   a   s   .   h   e   i   g   h   t       /       r   e   c   t   .   h   e   i   g   h   t   )   ;   
                   r   e   t   u   r   n       {   
                           x   :       a   d   j   u   s   t   e   d   X   ,   
                           y   :       a   d   j   u   s   t   e   d   Y   
                   }   ;   
           }   ,   
           s   e   t   M   o   u   s   e   C   o   o   r   d   s   (   p   a   g   e   X   ,       p   a   g   e   Y   )       {   
                   c   o   n   s   t       {   x   ,       y   }       =       B   r   o   w   s   e   r   .   c   a   l   c   u   l   a   t   e   M   o   u   s   e   C   o   o   r   d   s   (   p   a   g   e   X   ,       p   a   g   e   Y   )   ;   
                   B   r   o   w   s   e   r   .   m   o   u   s   e   M   o   v   e   m   e   n   t   X       =       x       -       B   r   o   w   s   e   r   .   m   o   u   s   e   X   ;   
                   B   r   o   w   s   e   r   .   m   o   u   s   e   M   o   v   e   m   e   n   t   Y       =       y       -       B   r   o   w   s   e   r   .   m   o   u   s   e   Y   ;   
                   B   r   o   w   s   e   r   .   m   o   u   s   e   X       =       x   ;   
                   B   r   o   w   s   e   r   .   m   o   u   s   e   Y       =       y   ;   
           }   ,   
           c   a   l   c   u   l   a   t   e   M   o   u   s   e   E   v   e   n   t   (   e   v   e   n   t   )       {   
                   /   /       e   v   e   n   t       s   h   o   u   l   d       b   e       m   o   u   s   e   m   o   v   e   ,       m   o   u   s   e   d   o   w   n       o   r       m   o   u   s   e   u   p   
                   i   f       (   B   r   o   w   s   e   r   .   p   o   i   n   t   e   r   L   o   c   k   )       {   
                           /   /       W   h   e   n       t   h   e       p   o   i   n   t   e   r       i   s       l   o   c   k   e   d   ,       c   a   l   c   u   l   a   t   e       t   h   e       c   o   o   r   d   i   n   a   t   e   s   
                           /   /       b   a   s   e   d       o   n       t   h   e       m   o   v   e   m   e   n   t       o   f       t   h   e       m   o   u   s   e   .   
                           /   /       W   o   r   k   a   r   o   u   n   d       f   o   r       F   i   r   e   f   o   x       b   u   g       7   6   4   4   9   8   
                           i   f       (   e   v   e   n   t   .   t   y   p   e       !   =       "   m   o   u   s   e   m   o   v   e   "       &   &       (   "   m   o   z   M   o   v   e   m   e   n   t   X   "       i   n       e   v   e   n   t   )   )       {   
                                   B   r   o   w   s   e   r   .   m   o   u   s   e   M   o   v   e   m   e   n   t   X       =       B   r   o   w   s   e   r   .   m   o   u   s   e   M   o   v   e   m   e   n   t   Y       =       0   ;   
                           }       e   l   s   e       {   
                                   B   r   o   w   s   e   r   .   m   o   u   s   e   M   o   v   e   m   e   n   t   X       =       B   r   o   w   s   e   r   .   g   e   t   M   o   v   e   m   e   n   t   X   (   e   v   e   n   t   )   ;   
                                   B   r   o   w   s   e   r   .   m   o   u   s   e   M   o   v   e   m   e   n   t   Y       =       B   r   o   w   s   e   r   .   g   e   t   M   o   v   e   m   e   n   t   Y   (   e   v   e   n   t   )   ;   
                           }   
                           /   /       a   d   d       t   h   e       m   o   u   s   e       d   e   l   t   a       t   o       t   h   e       c   u   r   r   e   n   t       a   b   s   o   l   u   t   e       m   o   u   s   e       p   o   s   i   t   i   o   n   
                           B   r   o   w   s   e   r   .   m   o   u   s   e   X       +   =       B   r   o   w   s   e   r   .   m   o   u   s   e   M   o   v   e   m   e   n   t   X   ;   
                           B   r   o   w   s   e   r   .   m   o   u   s   e   Y       +   =       B   r   o   w   s   e   r   .   m   o   u   s   e   M   o   v   e   m   e   n   t   Y   ;   
                   }       e   l   s   e       {   
                           i   f       (   e   v   e   n   t   .   t   y   p   e       =   =   =       "   t   o   u   c   h   s   t   a   r   t   "       |   |       e   v   e   n   t   .   t   y   p   e       =   =   =       "   t   o   u   c   h   e   n   d   "       |   |       e   v   e   n   t   .   t   y   p   e       =   =   =       "   t   o   u   c   h   m   o   v   e   "   )       {   
                                   v   a   r       t   o   u   c   h       =       e   v   e   n   t   .   t   o   u   c   h   ;   
                                   i   f       (   t   o   u   c   h       =   =   =       u   n   d   e   f   i   n   e   d   )       {   
                                           r   e   t   u   r   n   ;   
                                   }   
                                   v   a   r       c   o   o   r   d   s       =       B   r   o   w   s   e   r   .   c   a   l   c   u   l   a   t   e   M   o   u   s   e   C   o   o   r   d   s   (   t   o   u   c   h   .   p   a   g   e   X   ,       t   o   u   c   h   .   p   a   g   e   Y   )   ;   
                                   i   f       (   e   v   e   n   t   .   t   y   p   e       =   =   =       "   t   o   u   c   h   s   t   a   r   t   "   )       {   
                                           B   r   o   w   s   e   r   .   l   a   s   t   T   o   u   c   h   e   s   [   t   o   u   c   h   .   i   d   e   n   t   i   f   i   e   r   ]       =       c   o   o   r   d   s   ;   
                                           B   r   o   w   s   e   r   .   t   o   u   c   h   e   s   [   t   o   u   c   h   .   i   d   e   n   t   i   f   i   e   r   ]       =       c   o   o   r   d   s   ;   
                                   }       e   l   s   e       i   f       (   e   v   e   n   t   .   t   y   p   e       =   =   =       "   t   o   u   c   h   e   n   d   "       |   |       e   v   e   n   t   .   t   y   p   e       =   =   =       "   t   o   u   c   h   m   o   v   e   "   )       {   
                                           v   a   r       l   a   s   t       =       B   r   o   w   s   e   r   .   t   o   u   c   h   e   s   [   t   o   u   c   h   .   i   d   e   n   t   i   f   i   e   r   ]   ;   
                                           l   a   s   t       |   |   =       c   o   o   r   d   s   ;   
                                           B   r   o   w   s   e   r   .   l   a   s   t   T   o   u   c   h   e   s   [   t   o   u   c   h   .   i   d   e   n   t   i   f   i   e   r   ]       =       l   a   s   t   ;   
                                           B   r   o   w   s   e   r   .   t   o   u   c   h   e   s   [   t   o   u   c   h   .   i   d   e   n   t   i   f   i   e   r   ]       =       c   o   o   r   d   s   ;   
                                   }   
                                   r   e   t   u   r   n   ;   
                           }   
                           B   r   o   w   s   e   r   .   s   e   t   M   o   u   s   e   C   o   o   r   d   s   (   e   v   e   n   t   .   p   a   g   e   X   ,       e   v   e   n   t   .   p   a   g   e   Y   )   ;   
                   }   
           }   ,   
           r   e   s   i   z   e   L   i   s   t   e   n   e   r   s   :       [   ]   ,   
           u   p   d   a   t   e   R   e   s   i   z   e   L   i   s   t   e   n   e   r   s   (   )       {   
                   v   a   r       c   a   n   v   a   s       =       B   r   o   w   s   e   r   .   g   e   t   C   a   n   v   a   s   (   )   ;   
                   B   r   o   w   s   e   r   .   r   e   s   i   z   e   L   i   s   t   e   n   e   r   s   .   f   o   r   E   a   c   h   (   l   i   s   t   e   n   e   r       =   >       l   i   s   t   e   n   e   r   (   c   a   n   v   a   s   .   w   i   d   t   h   ,       c   a   n   v   a   s   .   h   e   i   g   h   t   )   )   ;   
           }   ,   
           s   e   t   C   a   n   v   a   s   S   i   z   e   (   w   i   d   t   h   ,       h   e   i   g   h   t   ,       n   o   U   p   d   a   t   e   s   )       {   
                   v   a   r       c   a   n   v   a   s       =       B   r   o   w   s   e   r   .   g   e   t   C   a   n   v   a   s   (   )   ;   
                   B   r   o   w   s   e   r   .   u   p   d   a   t   e   C   a   n   v   a   s   D   i   m   e   n   s   i   o   n   s   (   c   a   n   v   a   s   ,       w   i   d   t   h   ,       h   e   i   g   h   t   )   ;   
                   i   f       (   !   n   o   U   p   d   a   t   e   s   )       B   r   o   w   s   e   r   .   u   p   d   a   t   e   R   e   s   i   z   e   L   i   s   t   e   n   e   r   s   (   )   ;   
           }   ,   
           w   i   n   d   o   w   e   d   W   i   d   t   h   :       0   ,   
           w   i   n   d   o   w   e   d   H   e   i   g   h   t   :       0   ,   
           s   e   t   F   u   l   l   s   c   r   e   e   n   C   a   n   v   a   s   S   i   z   e   (   )       {   
                   /   /       c   h   e   c   k       i   f       S   D   L       i   s       a   v   a   i   l   a   b   l   e   
                   i   f       (   t   y   p   e   o   f       S   D   L       !   =       "   u   n   d   e   f   i   n   e   d   "   )       {   
                           v   a   r       f   l   a   g   s       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   S   D   L   .   s   c   r   e   e   n   )       >   >       2   )   ]   ;   
                           f   l   a   g   s       =       f   l   a   g   s       |       8   3   8   8   6   0   8   ;   
                           /   /       s   e   t       S   D   L   _   F   U   L   L   S   C   R   E   E   N       f   l   a   g   
                           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   S   D   L   .   s   c   r   e   e   n   )       >   >       2   )   ]       =       f   l   a   g   s   ;   
                   }   
                   B   r   o   w   s   e   r   .   u   p   d   a   t   e   C   a   n   v   a   s   D   i   m   e   n   s   i   o   n   s   (   B   r   o   w   s   e   r   .   g   e   t   C   a   n   v   a   s   (   )   )   ;   
                   B   r   o   w   s   e   r   .   u   p   d   a   t   e   R   e   s   i   z   e   L   i   s   t   e   n   e   r   s   (   )   ;   
           }   ,   
           s   e   t   W   i   n   d   o   w   e   d   C   a   n   v   a   s   S   i   z   e   (   )       {   
                   /   /       c   h   e   c   k       i   f       S   D   L       i   s       a   v   a   i   l   a   b   l   e   
                   i   f       (   t   y   p   e   o   f       S   D   L       !   =       "   u   n   d   e   f   i   n   e   d   "   )       {   
                           v   a   r       f   l   a   g   s       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   S   D   L   .   s   c   r   e   e   n   )       >   >       2   )   ]   ;   
                           f   l   a   g   s       =       f   l   a   g   s       &       ~   8   3   8   8   6   0   8   ;   
                           /   /       c   l   e   a   r       S   D   L   _   F   U   L   L   S   C   R   E   E   N       f   l   a   g   
                           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   S   D   L   .   s   c   r   e   e   n   )       >   >       2   )   ]       =       f   l   a   g   s   ;   
                   }   
                   B   r   o   w   s   e   r   .   u   p   d   a   t   e   C   a   n   v   a   s   D   i   m   e   n   s   i   o   n   s   (   B   r   o   w   s   e   r   .   g   e   t   C   a   n   v   a   s   (   )   )   ;   
                   B   r   o   w   s   e   r   .   u   p   d   a   t   e   R   e   s   i   z   e   L   i   s   t   e   n   e   r   s   (   )   ;   
           }   ,   
           u   p   d   a   t   e   C   a   n   v   a   s   D   i   m   e   n   s   i   o   n   s   (   c   a   n   v   a   s   ,       w   N   a   t   i   v   e   ,       h   N   a   t   i   v   e   )       {   
                   i   f       (   w   N   a   t   i   v   e       &   &       h   N   a   t   i   v   e   )       {   
                           c   a   n   v   a   s   .   w   i   d   t   h   N   a   t   i   v   e       =       w   N   a   t   i   v   e   ;   
                           c   a   n   v   a   s   .   h   e   i   g   h   t   N   a   t   i   v   e       =       h   N   a   t   i   v   e   ;   
                   }       e   l   s   e       {   
                           w   N   a   t   i   v   e       =       c   a   n   v   a   s   .   w   i   d   t   h   N   a   t   i   v   e   ;   
                           h   N   a   t   i   v   e       =       c   a   n   v   a   s   .   h   e   i   g   h   t   N   a   t   i   v   e   ;   
                   }   
                   v   a   r       w       =       w   N   a   t   i   v   e   ;   
                   v   a   r       h       =       h   N   a   t   i   v   e   ;   
                   i   f       (   M   o   d   u   l   e   [   "   f   o   r   c   e   d   A   s   p   e   c   t   R   a   t   i   o   "   ]       >       0   )       {   
                           i   f       (   w       /       h       <       M   o   d   u   l   e   [   "   f   o   r   c   e   d   A   s   p   e   c   t   R   a   t   i   o   "   ]   )       {   
                                   w       =       M   a   t   h   .   r   o   u   n   d   (   h       *       M   o   d   u   l   e   [   "   f   o   r   c   e   d   A   s   p   e   c   t   R   a   t   i   o   "   ]   )   ;   
                           }       e   l   s   e       {   
                                   h       =       M   a   t   h   .   r   o   u   n   d   (   w       /       M   o   d   u   l   e   [   "   f   o   r   c   e   d   A   s   p   e   c   t   R   a   t   i   o   "   ]   )   ;   
                           }   
                   }   
                   i   f       (   (   (   d   o   c   u   m   e   n   t   [   "   f   u   l   l   s   c   r   e   e   n   E   l   e   m   e   n   t   "   ]       |   |       d   o   c   u   m   e   n   t   [   "   m   o   z   F   u   l   l   S   c   r   e   e   n   E   l   e   m   e   n   t   "   ]       |   |       d   o   c   u   m   e   n   t   [   "   m   s   F   u   l   l   s   c   r   e   e   n   E   l   e   m   e   n   t   "   ]       |   |       d   o   c   u   m   e   n   t   [   "   w   e   b   k   i   t   F   u   l   l   s   c   r   e   e   n   E   l   e   m   e   n   t   "   ]       |   |       d   o   c   u   m   e   n   t   [   "   w   e   b   k   i   t   C   u   r   r   e   n   t   F   u   l   l   S   c   r   e   e   n   E   l   e   m   e   n   t   "   ]   )       =   =   =       c   a   n   v   a   s   .   p   a   r   e   n   t   N   o   d   e   )       &   &       (   t   y   p   e   o   f       s   c   r   e   e   n       !   =       "   u   n   d   e   f   i   n   e   d   "   )   )       {   
                           v   a   r       f   a   c   t   o   r       =       M   a   t   h   .   m   i   n   (   s   c   r   e   e   n   .   w   i   d   t   h       /       w   ,       s   c   r   e   e   n   .   h   e   i   g   h   t       /       h   )   ;   
                           w       =       M   a   t   h   .   r   o   u   n   d   (   w       *       f   a   c   t   o   r   )   ;   
                           h       =       M   a   t   h   .   r   o   u   n   d   (   h       *       f   a   c   t   o   r   )   ;   
                   }   
                   i   f       (   B   r   o   w   s   e   r   .   r   e   s   i   z   e   C   a   n   v   a   s   )       {   
                           i   f       (   c   a   n   v   a   s   .   w   i   d   t   h       !   =       w   )       c   a   n   v   a   s   .   w   i   d   t   h       =       w   ;   
                           i   f       (   c   a   n   v   a   s   .   h   e   i   g   h   t       !   =       h   )       c   a   n   v   a   s   .   h   e   i   g   h   t       =       h   ;   
                           i   f       (   t   y   p   e   o   f       c   a   n   v   a   s   .   s   t   y   l   e       !   =       "   u   n   d   e   f   i   n   e   d   "   )       {   
                                   c   a   n   v   a   s   .   s   t   y   l   e   .   r   e   m   o   v   e   P   r   o   p   e   r   t   y   (   "   w   i   d   t   h   "   )   ;   
                                   c   a   n   v   a   s   .   s   t   y   l   e   .   r   e   m   o   v   e   P   r   o   p   e   r   t   y   (   "   h   e   i   g   h   t   "   )   ;   
                           }   
                   }       e   l   s   e       {   
                           i   f       (   c   a   n   v   a   s   .   w   i   d   t   h       !   =       w   N   a   t   i   v   e   )       c   a   n   v   a   s   .   w   i   d   t   h       =       w   N   a   t   i   v   e   ;   
                           i   f       (   c   a   n   v   a   s   .   h   e   i   g   h   t       !   =       h   N   a   t   i   v   e   )       c   a   n   v   a   s   .   h   e   i   g   h   t       =       h   N   a   t   i   v   e   ;   
                           i   f       (   t   y   p   e   o   f       c   a   n   v   a   s   .   s   t   y   l   e       !   =       "   u   n   d   e   f   i   n   e   d   "   )       {   
                                   i   f       (   w       !   =       w   N   a   t   i   v   e       |   |       h       !   =       h   N   a   t   i   v   e   )       {   
                                           c   a   n   v   a   s   .   s   t   y   l   e   .   s   e   t   P   r   o   p   e   r   t   y   (   "   w   i   d   t   h   "   ,       w       +       "   p   x   "   ,       "   i   m   p   o   r   t   a   n   t   "   )   ;   
                                           c   a   n   v   a   s   .   s   t   y   l   e   .   s   e   t   P   r   o   p   e   r   t   y   (   "   h   e   i   g   h   t   "   ,       h       +       "   p   x   "   ,       "   i   m   p   o   r   t   a   n   t   "   )   ;   
                                   }       e   l   s   e       {   
                                           c   a   n   v   a   s   .   s   t   y   l   e   .   r   e   m   o   v   e   P   r   o   p   e   r   t   y   (   "   w   i   d   t   h   "   )   ;   
                                           c   a   n   v   a   s   .   s   t   y   l   e   .   r   e   m   o   v   e   P   r   o   p   e   r   t   y   (   "   h   e   i   g   h   t   "   )   ;   
                                   }   
                           }   
                   }   
           }   
   }   ;   
   
   v   a   r       E   G   L       =       {   
           e   r   r   o   r   C   o   d   e   :       1   2   2   8   8   ,   
           d   e   f   a   u   l   t   D   i   s   p   l   a   y   I   n   i   t   i   a   l   i   z   e   d   :       f   a   l   s   e   ,   
           c   u   r   r   e   n   t   C   o   n   t   e   x   t   :       0   ,   
           c   u   r   r   e   n   t   R   e   a   d   S   u   r   f   a   c   e   :       0   ,   
           c   u   r   r   e   n   t   D   r   a   w   S   u   r   f   a   c   e   :       0   ,   
           c   o   n   t   e   x   t   A   t   t   r   i   b   u   t   e   s   :       {   
                   a   l   p   h   a   :       f   a   l   s   e   ,   
                   d   e   p   t   h   :       f   a   l   s   e   ,   
                   s   t   e   n   c   i   l   :       f   a   l   s   e   ,   
                   a   n   t   i   a   l   i   a   s   :       f   a   l   s   e   
           }   ,   
           s   t   r   i   n   g   C   a   c   h   e   :       {   }   ,   
           s   e   t   E   r   r   o   r   C   o   d   e   (   c   o   d   e   )       {   
                   E   G   L   .   e   r   r   o   r   C   o   d   e       =       c   o   d   e   ;   
           }   ,   
           c   h   o   o   s   e   C   o   n   f   i   g   (   d   i   s   p   l   a   y   ,       a   t   t   r   i   b   L   i   s   t   ,       c   o   n   f   i   g   ,       c   o   n   f   i   g   _   s   i   z   e   ,       n   u   m   C   o   n   f   i   g   s   )       {   
                   i   f       (   d   i   s   p   l   a   y       !   =       6   2   e   3   )       {   
                           E   G   L   .   s   e   t   E   r   r   o   r   C   o   d   e   (   1   2   2   9   6   )   ;   
                           r   e   t   u   r   n       0   ;   
                   }   
                   i   f       (   a   t   t   r   i   b   L   i   s   t   )       {   
                           /   /       r   e   a   d       a   t   t   r   i   b   L   i   s   t       i   f       i   t       i   s       n   o   n   -   n   u   l   l   
                           f   o   r       (   ;   ;   )       {   
                                   v   a   r       p   a   r   a   m       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   a   t   t   r   i   b   L   i   s   t   )       >   >       2   )   ]   ;   
                                   i   f       (   p   a   r   a   m       =   =       1   2   3   2   1   )       {   
                                           v   a   r       a   l   p   h   a   S   i   z   e       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   (   a   t   t   r   i   b   L   i   s   t   )       +       (   4   )   )       >   >       2   )   ]   ;   
                                           E   G   L   .   c   o   n   t   e   x   t   A   t   t   r   i   b   u   t   e   s   .   a   l   p   h   a       =       (   a   l   p   h   a   S   i   z   e       >       0   )   ;   
                                   }       e   l   s   e       i   f       (   p   a   r   a   m       =   =       1   2   3   2   5   )       {   
                                           v   a   r       d   e   p   t   h   S   i   z   e       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   (   a   t   t   r   i   b   L   i   s   t   )       +       (   4   )   )       >   >       2   )   ]   ;   
                                           E   G   L   .   c   o   n   t   e   x   t   A   t   t   r   i   b   u   t   e   s   .   d   e   p   t   h       =       (   d   e   p   t   h   S   i   z   e       >       0   )   ;   
                                   }       e   l   s   e       i   f       (   p   a   r   a   m       =   =       1   2   3   2   6   )       {   
                                           v   a   r       s   t   e   n   c   i   l   S   i   z   e       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   (   a   t   t   r   i   b   L   i   s   t   )       +       (   4   )   )       >   >       2   )   ]   ;   
                                           E   G   L   .   c   o   n   t   e   x   t   A   t   t   r   i   b   u   t   e   s   .   s   t   e   n   c   i   l       =       (   s   t   e   n   c   i   l   S   i   z   e       >       0   )   ;   
                                   }       e   l   s   e       i   f       (   p   a   r   a   m       =   =       1   2   3   3   7   )       {   
                                           v   a   r       s   a   m   p   l   e   s       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   (   a   t   t   r   i   b   L   i   s   t   )       +       (   4   )   )       >   >       2   )   ]   ;   
                                           E   G   L   .   c   o   n   t   e   x   t   A   t   t   r   i   b   u   t   e   s   .   a   n   t   i   a   l   i   a   s       =       (   s   a   m   p   l   e   s       >       0   )   ;   
                                   }       e   l   s   e       i   f       (   p   a   r   a   m       =   =       1   2   3   3   8   )       {   
                                           v   a   r       s   a   m   p   l   e   s       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   (   a   t   t   r   i   b   L   i   s   t   )       +       (   4   )   )       >   >       2   )   ]   ;   
                                           E   G   L   .   c   o   n   t   e   x   t   A   t   t   r   i   b   u   t   e   s   .   a   n   t   i   a   l   i   a   s       =       (   s   a   m   p   l   e   s       =   =       1   )   ;   
                                   }       e   l   s   e       i   f       (   p   a   r   a   m       =   =       1   2   5   4   4   )       {   
                                           v   a   r       r   e   q   u   e   s   t   e   d   P   r   i   o   r   i   t   y       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   (   a   t   t   r   i   b   L   i   s   t   )       +       (   4   )   )       >   >       2   )   ]   ;   
                                           E   G   L   .   c   o   n   t   e   x   t   A   t   t   r   i   b   u   t   e   s   .   l   o   w   L   a   t   e   n   c   y       =       (   r   e   q   u   e   s   t   e   d   P   r   i   o   r   i   t   y       !   =       1   2   5   4   7   )   ;   
                                   }       e   l   s   e       i   f       (   p   a   r   a   m       =   =       1   2   3   4   4   )       {   
                                           b   r   e   a   k   ;   
                                   }   
                                   a   t   t   r   i   b   L   i   s   t       +   =       8   ;   
                           }   
                   }   
                   i   f       (   (   !   c   o   n   f   i   g       |   |       !   c   o   n   f   i   g   _   s   i   z   e   )       &   &       !   n   u   m   C   o   n   f   i   g   s   )       {   
                           E   G   L   .   s   e   t   E   r   r   o   r   C   o   d   e   (   1   2   3   0   0   )   ;   
                           r   e   t   u   r   n       0   ;   
                   }   
                   i   f       (   n   u   m   C   o   n   f   i   g   s   )       {   
                           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   n   u   m   C   o   n   f   i   g   s   )       >   >       2   )   ]       =       1   ;   
                   }   
                   i   f       (   c   o   n   f   i   g       &   &       c   o   n   f   i   g   _   s   i   z   e       >       0   )       {   
                           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   c   o   n   f   i   g   )       >   >       2   )   ]       =       6   2   0   0   2   ;   
                   }   
                   E   G   L   .   s   e   t   E   r   r   o   r   C   o   d   e   (   1   2   2   8   8   )   ;   
                   r   e   t   u   r   n       1   ;   
           }   
   }   ;   
   
   f   u   n   c   t   i   o   n       _   e   g   l   B   i   n   d   A   P   I   (   a   p   i   )       {   
           i   f       (   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   P   T   H   R   E   A   D   )       r   e   t   u   r   n       p   r   o   x   y   T   o   M   a   i   n   T   h   r   e   a   d   (   2   ,       0   ,       1   ,       a   p   i   )   ;   
           i   f       (   a   p   i       =   =       1   2   4   4   8   )       {   
                   E   G   L   .   s   e   t   E   r   r   o   r   C   o   d   e   (   1   2   2   8   8   )   ;   
                   r   e   t   u   r   n       1   ;   
           }   
           /   /       i   f       (   a   p   i       =   =       0   x   3   0   A   1       /   *       E   G   L   _   O   P   E   N   V   G   _   A   P   I       *   /       |   |       a   p   i       =   =       0   x   3   0   A   2       /   *       E   G   L   _   O   P   E   N   G   L   _   A   P   I       *   /   )       {   
           E   G   L   .   s   e   t   E   r   r   o   r   C   o   d   e   (   1   2   3   0   0   )   ;   
           r   e   t   u   r   n       0   ;   
   }   
   
   f   u   n   c   t   i   o   n       _   e   g   l   C   h   o   o   s   e   C   o   n   f   i   g   (   d   i   s   p   l   a   y   ,       a   t   t   r   i   b   _   l   i   s   t   ,       c   o   n   f   i   g   s   ,       c   o   n   f   i   g   _   s   i   z   e   ,       n   u   m   C   o   n   f   i   g   s   )       {   
           i   f       (   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   P   T   H   R   E   A   D   )       r   e   t   u   r   n       p   r   o   x   y   T   o   M   a   i   n   T   h   r   e   a   d   (   3   ,       0   ,       1   ,       d   i   s   p   l   a   y   ,       a   t   t   r   i   b   _   l   i   s   t   ,       c   o   n   f   i   g   s   ,       c   o   n   f   i   g   _   s   i   z   e   ,       n   u   m   C   o   n   f   i   g   s   )   ;   
           r   e   t   u   r   n       E   G   L   .   c   h   o   o   s   e   C   o   n   f   i   g   (   d   i   s   p   l   a   y   ,       a   t   t   r   i   b   _   l   i   s   t   ,       c   o   n   f   i   g   s   ,       c   o   n   f   i   g   _   s   i   z   e   ,       n   u   m   C   o   n   f   i   g   s   )   ;   
   }   
   
   v   a   r       G   L   c   t   x   ;   
   
   v   a   r       w   e   b   g   l   _   e   n   a   b   l   e   _   W   E   B   G   L   _   d   r   a   w   _   i   n   s   t   a   n   c   e   d   _   b   a   s   e   _   v   e   r   t   e   x   _   b   a   s   e   _   i   n   s   t   a   n   c   e       =       c   t   x       =   >       /   /       C   l   o   s   u   r   e       i   s       e   x   p   e   c   t   e   d       t   o       b   e       a   l   l   o   w   e   d       t   o       m   i   n   i   f   y       t   h   e       '   .   d   i   b   v   b   i   '       p   r   o   p   e   r   t   y   ,       s   o       n   o   t       a   c   c   e   s   s   i   n   g       i   t       q   u   o   t   e   d   .   
   !   !   (   c   t   x   .   d   i   b   v   b   i       =       c   t   x   .   g   e   t   E   x   t   e   n   s   i   o   n   (   "   W   E   B   G   L   _   d   r   a   w   _   i   n   s   t   a   n   c   e   d   _   b   a   s   e   _   v   e   r   t   e   x   _   b   a   s   e   _   i   n   s   t   a   n   c   e   "   )   )   ;   
   
   v   a   r       w   e   b   g   l   _   e   n   a   b   l   e   _   W   E   B   G   L   _   m   u   l   t   i   _   d   r   a   w   _   i   n   s   t   a   n   c   e   d   _   b   a   s   e   _   v   e   r   t   e   x   _   b   a   s   e   _   i   n   s   t   a   n   c   e       =       c   t   x       =   >       !   !   (   c   t   x   .   m   d   i   b   v   b   i       =       c   t   x   .   g   e   t   E   x   t   e   n   s   i   o   n   (   "   W   E   B   G   L   _   m   u   l   t   i   _   d   r   a   w   _   i   n   s   t   a   n   c   e   d   _   b   a   s   e   _   v   e   r   t   e   x   _   b   a   s   e   _   i   n   s   t   a   n   c   e   "   )   )   ;   
   
   v   a   r       w   e   b   g   l   _   e   n   a   b   l   e   _   E   X   T   _   p   o   l   y   g   o   n   _   o   f   f   s   e   t   _   c   l   a   m   p       =       c   t   x       =   >       !   !   (   c   t   x   .   e   x   t   P   o   l   y   g   o   n   O   f   f   s   e   t   C   l   a   m   p       =       c   t   x   .   g   e   t   E   x   t   e   n   s   i   o   n   (   "   E   X   T   _   p   o   l   y   g   o   n   _   o   f   f   s   e   t   _   c   l   a   m   p   "   )   )   ;   
   
   v   a   r       w   e   b   g   l   _   e   n   a   b   l   e   _   E   X   T   _   c   l   i   p   _   c   o   n   t   r   o   l       =       c   t   x       =   >       !   !   (   c   t   x   .   e   x   t   C   l   i   p   C   o   n   t   r   o   l       =       c   t   x   .   g   e   t   E   x   t   e   n   s   i   o   n   (   "   E   X   T   _   c   l   i   p   _   c   o   n   t   r   o   l   "   )   )   ;   
   
   v   a   r       w   e   b   g   l   _   e   n   a   b   l   e   _   W   E   B   G   L   _   p   o   l   y   g   o   n   _   m   o   d   e       =       c   t   x       =   >       !   !   (   c   t   x   .   w   e   b   g   l   P   o   l   y   g   o   n   M   o   d   e       =       c   t   x   .   g   e   t   E   x   t   e   n   s   i   o   n   (   "   W   E   B   G   L   _   p   o   l   y   g   o   n   _   m   o   d   e   "   )   )   ;   
   
   v   a   r       w   e   b   g   l   _   e   n   a   b   l   e   _   W   E   B   G   L   _   m   u   l   t   i   _   d   r   a   w       =       c   t   x       =   >       /   /       C   l   o   s   u   r   e       i   s       e   x   p   e   c   t   e   d       t   o       b   e       a   l   l   o   w   e   d       t   o       m   i   n   i   f   y       t   h   e       '   .   m   u   l   t   i   D   r   a   w   W   e   b   g   l   '       p   r   o   p   e   r   t   y   ,       s   o       n   o   t       a   c   c   e   s   s   i   n   g       i   t       q   u   o   t   e   d   .   
   !   !   (   c   t   x   .   m   u   l   t   i   D   r   a   w   W   e   b   g   l       =       c   t   x   .   g   e   t   E   x   t   e   n   s   i   o   n   (   "   W   E   B   G   L   _   m   u   l   t   i   _   d   r   a   w   "   )   )   ;   
   
   v   a   r       g   e   t   E   m   s   c   r   i   p   t   e   n   S   u   p   p   o   r   t   e   d   E   x   t   e   n   s   i   o   n   s       =       c   t   x       =   >       {   
           /   /       R   e   s   t   r   i   c   t       t   h   e       l   i   s   t       o   f       a   d   v   e   r   t   i   s   e   d       e   x   t   e   n   s   i   o   n   s       t   o       t   h   o   s   e       t   h   a   t       w   e       a   c   t   u   a   l   l   y   
           /   /       s   u   p   p   o   r   t   .   
           v   a   r       s   u   p   p   o   r   t   e   d   E   x   t   e   n   s   i   o   n   s       =       [       /   /       W   e   b   G   L       2       e   x   t   e   n   s   i   o   n   s   
           "   E   X   T   _   c   o   l   o   r   _   b   u   f   f   e   r   _   f   l   o   a   t   "   ,       "   E   X   T   _   c   o   n   s   e   r   v   a   t   i   v   e   _   d   e   p   t   h   "   ,       "   E   X   T   _   d   i   s   j   o   i   n   t   _   t   i   m   e   r   _   q   u   e   r   y   _   w   e   b   g   l   2   "   ,       "   E   X   T   _   t   e   x   t   u   r   e   _   n   o   r   m   1   6   "   ,       "   N   V   _   s   h   a   d   e   r   _   n   o   p   e   r   s   p   e   c   t   i   v   e   _   i   n   t   e   r   p   o   l   a   t   i   o   n   "   ,       "   W   E   B   G   L   _   c   l   i   p   _   c   u   l   l   _   d   i   s   t   a   n   c   e   "   ,       /   /       W   e   b   G   L       1       a   n   d       W   e   b   G   L       2       e   x   t   e   n   s   i   o   n   s   
           "   E   X   T   _   c   l   i   p   _   c   o   n   t   r   o   l   "   ,       "   E   X   T   _   c   o   l   o   r   _   b   u   f   f   e   r   _   h   a   l   f   _   f   l   o   a   t   "   ,       "   E   X   T   _   d   e   p   t   h   _   c   l   a   m   p   "   ,       "   E   X   T   _   f   l   o   a   t   _   b   l   e   n   d   "   ,       "   E   X   T   _   p   o   l   y   g   o   n   _   o   f   f   s   e   t   _   c   l   a   m   p   "   ,       "   E   X   T   _   t   e   x   t   u   r   e   _   c   o   m   p   r   e   s   s   i   o   n   _   b   p   t   c   "   ,       "   E   X   T   _   t   e   x   t   u   r   e   _   c   o   m   p   r   e   s   s   i   o   n   _   r   g   t   c   "   ,       "   E   X   T   _   t   e   x   t   u   r   e   _   f   i   l   t   e   r   _   a   n   i   s   o   t   r   o   p   i   c   "   ,       "   K   H   R   _   p   a   r   a   l   l   e   l   _   s   h   a   d   e   r   _   c   o   m   p   i   l   e   "   ,       "   O   E   S   _   t   e   x   t   u   r   e   _   f   l   o   a   t   _   l   i   n   e   a   r   "   ,       "   W   E   B   G   L   _   b   l   e   n   d   _   f   u   n   c   _   e   x   t   e   n   d   e   d   "   ,       "   W   E   B   G   L   _   c   o   m   p   r   e   s   s   e   d   _   t   e   x   t   u   r   e   _   a   s   t   c   "   ,       "   W   E   B   G   L   _   c   o   m   p   r   e   s   s   e   d   _   t   e   x   t   u   r   e   _   e   t   c   "   ,       "   W   E   B   G   L   _   c   o   m   p   r   e   s   s   e   d   _   t   e   x   t   u   r   e   _   e   t   c   1   "   ,       "   W   E   B   G   L   _   c   o   m   p   r   e   s   s   e   d   _   t   e   x   t   u   r   e   _   s   3   t   c   "   ,       "   W   E   B   G   L   _   c   o   m   p   r   e   s   s   e   d   _   t   e   x   t   u   r   e   _   s   3   t   c   _   s   r   g   b   "   ,       "   W   E   B   G   L   _   d   e   b   u   g   _   r   e   n   d   e   r   e   r   _   i   n   f   o   "   ,       "   W   E   B   G   L   _   d   e   b   u   g   _   s   h   a   d   e   r   s   "   ,       "   W   E   B   G   L   _   l   o   s   e   _   c   o   n   t   e   x   t   "   ,       "   W   E   B   G   L   _   m   u   l   t   i   _   d   r   a   w   "   ,       "   W   E   B   G   L   _   p   o   l   y   g   o   n   _   m   o   d   e   "       ]   ;   
           /   /       .   g   e   t   S   u   p   p   o   r   t   e   d   E   x   t   e   n   s   i   o   n   s   (   )       c   a   n       r   e   t   u   r   n       n   u   l   l       i   f       c   o   n   t   e   x   t       i   s       l   o   s   t   ,       s   o       c   o   e   r   c   e       t   o       e   m   p   t   y       a   r   r   a   y   .   
           r   e   t   u   r   n       (   c   t   x   .   g   e   t   S   u   p   p   o   r   t   e   d   E   x   t   e   n   s   i   o   n   s   (   )       |   |       [   ]   )   .   f   i   l   t   e   r   (   e   x   t       =   >       s   u   p   p   o   r   t   e   d   E   x   t   e   n   s   i   o   n   s   .   i   n   c   l   u   d   e   s   (   e   x   t   )   )   ;   
   }   ;   
   
   v   a   r       r   e   g   i   s   t   e   r   P   r   e   M   a   i   n   L   o   o   p       =       f       =   >       {   
           /   /       D   o   e   s       n   o   t   h   i   n   g       u   n   l   e   s   s       $   M   a   i   n   L   o   o   p       i   s       i   n   c   l   u   d   e   d   /   u   s   e   d   .   
           t   y   p   e   o   f       M   a   i   n   L   o   o   p       !   =       "   u   n   d   e   f   i   n   e   d   "       &   &       M   a   i   n   L   o   o   p   .   p   r   e   M   a   i   n   L   o   o   p   .   p   u   s   h   (   f   )   ;   
   }   ;   
   
   v   a   r       G   L       =       {   
           c   o   u   n   t   e   r   :       1   ,   
           b   u   f   f   e   r   s   :       [   ]   ,   
           m   a   p   p   e   d   B   u   f   f   e   r   s   :       {   }   ,   
           p   r   o   g   r   a   m   s   :       [   ]   ,   
           f   r   a   m   e   b   u   f   f   e   r   s   :       [   ]   ,   
           r   e   n   d   e   r   b   u   f   f   e   r   s   :       [   ]   ,   
           t   e   x   t   u   r   e   s   :       [   ]   ,   
           s   h   a   d   e   r   s   :       [   ]   ,   
           v   a   o   s   :       [   ]   ,   
           c   o   n   t   e   x   t   s   :       {   }   ,   
           o   f   f   s   c   r   e   e   n   C   a   n   v   a   s   e   s   :       {   }   ,   
           q   u   e   r   i   e   s   :       [   ]   ,   
           s   a   m   p   l   e   r   s   :       [   ]   ,   
           t   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   s   :       [   ]   ,   
           s   y   n   c   s   :       [   ]   ,   
           b   y   t   e   S   i   z   e   B   y   T   y   p   e   R   o   o   t   :       5   1   2   0   ,   
           b   y   t   e   S   i   z   e   B   y   T   y   p   e   :       [       1   ,       1   ,       2   ,       2   ,       4   ,       4   ,       4   ,       2   ,       3   ,       4   ,       8       ]   ,   
           s   t   r   i   n   g   C   a   c   h   e   :       {   }   ,   
           s   t   r   i   n   g   i   C   a   c   h   e   :       {   }   ,   
           u   n   p   a   c   k   A   l   i   g   n   m   e   n   t   :       4   ,   
           u   n   p   a   c   k   R   o   w   L   e   n   g   t   h   :       0   ,   
           r   e   c   o   r   d   E   r   r   o   r   :       e   r   r   o   r   C   o   d   e       =   >       {   
                   i   f       (   !   G   L   .   l   a   s   t   E   r   r   o   r   )       {   
                           G   L   .   l   a   s   t   E   r   r   o   r       =       e   r   r   o   r   C   o   d   e   ;   
                   }   
           }   ,   
           g   e   t   N   e   w   I   d   :       t   a   b   l   e       =   >       {   
                   v   a   r       r   e   t       =       G   L   .   c   o   u   n   t   e   r   +   +   ;   
                   f   o   r       (   v   a   r       i       =       t   a   b   l   e   .   l   e   n   g   t   h   ;       i       <       r   e   t   ;       i   +   +   )       {   
                           t   a   b   l   e   [   i   ]       =       n   u   l   l   ;   
                   }   
                   /   /       S   k   i   p       o   v   e   r       a   n   y       n   o   n   -   n   u   l   l       e   l   e   m   e   n   t   s       t   h   a   t       m   i   g   h   t       h   a   v   e       b   e   e   n       c   r   e   a   t   e   d       b   y   
                   /   /       g   l   B   i   n   d   B   u   f   f   e   r   .   
                   w   h   i   l   e       (   t   a   b   l   e   [   r   e   t   ]   )       {   
                           r   e   t       =       G   L   .   c   o   u   n   t   e   r   +   +   ;   
                   }   
                   r   e   t   u   r   n       r   e   t   ;   
           }   ,   
           g   e   n   O   b   j   e   c   t   :       (   n   ,       b   u   f   f   e   r   s   ,       c   r   e   a   t   e   F   u   n   c   t   i   o   n   ,       o   b   j   e   c   t   T   a   b   l   e   )       =   >       {   
                   f   o   r       (   v   a   r       i       =       0   ;       i       <       n   ;       i   +   +   )       {   
                           v   a   r       b   u   f   f   e   r       =       G   L   c   t   x   [   c   r   e   a   t   e   F   u   n   c   t   i   o   n   ]   (   )   ;   
                           v   a   r       i   d       =       b   u   f   f   e   r       &   &       G   L   .   g   e   t   N   e   w   I   d   (   o   b   j   e   c   t   T   a   b   l   e   )   ;   
                           i   f       (   b   u   f   f   e   r   )       {   
                                   b   u   f   f   e   r   .   n   a   m   e       =       i   d   ;   
                                   o   b   j   e   c   t   T   a   b   l   e   [   i   d   ]       =       b   u   f   f   e   r   ;   
                           }       e   l   s   e       {   
                                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   2   )   ;   
                           }   
                           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   (   b   u   f   f   e   r   s   )       +       (   i       *       4   )   )       >   >       2   )   ]       =       i   d   ;   
                   }   
           }   ,   
           M   A   X   _   T   E   M   P   _   B   U   F   F   E   R   _   S   I   Z   E   :       2   0   9   7   1   5   2   ,   
           n   u   m   T   e   m   p   V   e   r   t   e   x   B   u   f   f   e   r   s   P   e   r   S   i   z   e   :       6   4   ,   
           l   o   g   2   c   e   i   l   L   o   o   k   u   p   :       i       =   >       3   2       -       M   a   t   h   .   c   l   z   3   2   (   i       =   =   =       0       ?       0       :       i       -       1   )   ,   
           g   e   n   e   r   a   t   e   T   e   m   p   B   u   f   f   e   r   s   :       (   q   u   a   d   s   ,       c   o   n   t   e   x   t   )       =   >       {   
                   v   a   r       l   a   r   g   e   s   t   I   n   d   e   x       =       G   L   .   l   o   g   2   c   e   i   l   L   o   o   k   u   p   (   G   L   .   M   A   X   _   T   E   M   P   _   B   U   F   F   E   R   _   S   I   Z   E   )   ;   
                   c   o   n   t   e   x   t   .   t   e   m   p   V   e   r   t   e   x   B   u   f   f   e   r   C   o   u   n   t   e   r   s   1       =       [   ]   ;   
                   c   o   n   t   e   x   t   .   t   e   m   p   V   e   r   t   e   x   B   u   f   f   e   r   C   o   u   n   t   e   r   s   2       =       [   ]   ;   
                   c   o   n   t   e   x   t   .   t   e   m   p   V   e   r   t   e   x   B   u   f   f   e   r   C   o   u   n   t   e   r   s   1   .   l   e   n   g   t   h       =       c   o   n   t   e   x   t   .   t   e   m   p   V   e   r   t   e   x   B   u   f   f   e   r   C   o   u   n   t   e   r   s   2   .   l   e   n   g   t   h       =       l   a   r   g   e   s   t   I   n   d   e   x       +       1   ;   
                   c   o   n   t   e   x   t   .   t   e   m   p   V   e   r   t   e   x   B   u   f   f   e   r   s   1       =       [   ]   ;   
                   c   o   n   t   e   x   t   .   t   e   m   p   V   e   r   t   e   x   B   u   f   f   e   r   s   2       =       [   ]   ;   
                   c   o   n   t   e   x   t   .   t   e   m   p   V   e   r   t   e   x   B   u   f   f   e   r   s   1   .   l   e   n   g   t   h       =       c   o   n   t   e   x   t   .   t   e   m   p   V   e   r   t   e   x   B   u   f   f   e   r   s   2   .   l   e   n   g   t   h       =       l   a   r   g   e   s   t   I   n   d   e   x       +       1   ;   
                   c   o   n   t   e   x   t   .   t   e   m   p   I   n   d   e   x   B   u   f   f   e   r   s       =       [   ]   ;   
                   c   o   n   t   e   x   t   .   t   e   m   p   I   n   d   e   x   B   u   f   f   e   r   s   .   l   e   n   g   t   h       =       l   a   r   g   e   s   t   I   n   d   e   x       +       1   ;   
                   f   o   r       (   v   a   r       i       =       0   ;       i       <   =       l   a   r   g   e   s   t   I   n   d   e   x   ;       +   +   i   )       {   
                           c   o   n   t   e   x   t   .   t   e   m   p   I   n   d   e   x   B   u   f   f   e   r   s   [   i   ]       =       n   u   l   l   ;   
                           /   /       C   r   e   a   t   e   d       o   n   -   d   e   m   a   n   d   
                           c   o   n   t   e   x   t   .   t   e   m   p   V   e   r   t   e   x   B   u   f   f   e   r   C   o   u   n   t   e   r   s   1   [   i   ]       =       c   o   n   t   e   x   t   .   t   e   m   p   V   e   r   t   e   x   B   u   f   f   e   r   C   o   u   n   t   e   r   s   2   [   i   ]       =       0   ;   
                           v   a   r       r   i   n   g   b   u   f   f   e   r   L   e   n   g   t   h       =       G   L   .   n   u   m   T   e   m   p   V   e   r   t   e   x   B   u   f   f   e   r   s   P   e   r   S   i   z   e   ;   
                           c   o   n   t   e   x   t   .   t   e   m   p   V   e   r   t   e   x   B   u   f   f   e   r   s   1   [   i   ]       =       [   ]   ;   
                           c   o   n   t   e   x   t   .   t   e   m   p   V   e   r   t   e   x   B   u   f   f   e   r   s   2   [   i   ]       =       [   ]   ;   
                           v   a   r       r   i   n   g   b   u   f   f   e   r   1       =       c   o   n   t   e   x   t   .   t   e   m   p   V   e   r   t   e   x   B   u   f   f   e   r   s   1   [   i   ]   ;   
                           v   a   r       r   i   n   g   b   u   f   f   e   r   2       =       c   o   n   t   e   x   t   .   t   e   m   p   V   e   r   t   e   x   B   u   f   f   e   r   s   2   [   i   ]   ;   
                           r   i   n   g   b   u   f   f   e   r   1   .   l   e   n   g   t   h       =       r   i   n   g   b   u   f   f   e   r   2   .   l   e   n   g   t   h       =       r   i   n   g   b   u   f   f   e   r   L   e   n   g   t   h   ;   
                           f   o   r       (   v   a   r       j       =       0   ;       j       <       r   i   n   g   b   u   f   f   e   r   L   e   n   g   t   h   ;       +   +   j   )       {   
                                   r   i   n   g   b   u   f   f   e   r   1   [   j   ]       =       r   i   n   g   b   u   f   f   e   r   2   [   j   ]       =       n   u   l   l   ;   
                           }   
                   }   
                   i   f       (   q   u   a   d   s   )       {   
                           /   /       G   L   _   Q   U   A   D       i   n   d   e   x   e   s       c   a   n       b   e       p   r   e   c   a   l   c   u   l   a   t   e   d   
                           c   o   n   t   e   x   t   .   t   e   m   p   Q   u   a   d   I   n   d   e   x   B   u   f   f   e   r       =       G   L   c   t   x   .   c   r   e   a   t   e   B   u   f   f   e   r   (   )   ;   
                           c   o   n   t   e   x   t   .   G   L   c   t   x   .   b   i   n   d   B   u   f   f   e   r   (   3   4   9   6   3   ,       c   o   n   t   e   x   t   .   t   e   m   p   Q   u   a   d   I   n   d   e   x   B   u   f   f   e   r   )   ;   
                           v   a   r       n   u   m   I   n   d   e   x   e   s       =       G   L   .   M   A   X   _   T   E   M   P   _   B   U   F   F   E   R   _   S   I   Z   E       >   >       1   ;   
                           v   a   r       q   u   a   d   I   n   d   e   x   e   s       =       n   e   w       U   i   n   t   1   6   A   r   r   a   y   (   n   u   m   I   n   d   e   x   e   s   )   ;   
                           v   a   r       i       =       0   ,       v       =       0   ;   
                           w   h   i   l   e       (   1   )       {   
                                   q   u   a   d   I   n   d   e   x   e   s   [   i   +   +   ]       =       v   ;   
                                   i   f       (   i       >   =       n   u   m   I   n   d   e   x   e   s   )       b   r   e   a   k   ;   
                                   q   u   a   d   I   n   d   e   x   e   s   [   i   +   +   ]       =       v       +       1   ;   
                                   i   f       (   i       >   =       n   u   m   I   n   d   e   x   e   s   )       b   r   e   a   k   ;   
                                   q   u   a   d   I   n   d   e   x   e   s   [   i   +   +   ]       =       v       +       2   ;   
                                   i   f       (   i       >   =       n   u   m   I   n   d   e   x   e   s   )       b   r   e   a   k   ;   
                                   q   u   a   d   I   n   d   e   x   e   s   [   i   +   +   ]       =       v   ;   
                                   i   f       (   i       >   =       n   u   m   I   n   d   e   x   e   s   )       b   r   e   a   k   ;   
                                   q   u   a   d   I   n   d   e   x   e   s   [   i   +   +   ]       =       v       +       2   ;   
                                   i   f       (   i       >   =       n   u   m   I   n   d   e   x   e   s   )       b   r   e   a   k   ;   
                                   q   u   a   d   I   n   d   e   x   e   s   [   i   +   +   ]       =       v       +       3   ;   
                                   i   f       (   i       >   =       n   u   m   I   n   d   e   x   e   s   )       b   r   e   a   k   ;   
                                   v       +   =       4   ;   
                           }   
                           c   o   n   t   e   x   t   .   G   L   c   t   x   .   b   u   f   f   e   r   D   a   t   a   (   3   4   9   6   3   ,       q   u   a   d   I   n   d   e   x   e   s   ,       3   5   0   4   4   )   ;   
                           c   o   n   t   e   x   t   .   G   L   c   t   x   .   b   i   n   d   B   u   f   f   e   r   (   3   4   9   6   3   ,       n   u   l   l   )   ;   
                   }   
           }   ,   
           g   e   t   T   e   m   p   V   e   r   t   e   x   B   u   f   f   e   r   :       s   i   z   e   B   y   t   e   s       =   >       {   
                   v   a   r       i   d   x       =       G   L   .   l   o   g   2   c   e   i   l   L   o   o   k   u   p   (   s   i   z   e   B   y   t   e   s   )   ;   
                   v   a   r       r   i   n   g   b   u   f   f   e   r       =       G   L   .   c   u   r   r   e   n   t   C   o   n   t   e   x   t   .   t   e   m   p   V   e   r   t   e   x   B   u   f   f   e   r   s   1   [   i   d   x   ]   ;   
                   v   a   r       n   e   x   t   F   r   e   e   B   u   f   f   e   r   I   n   d   e   x       =       G   L   .   c   u   r   r   e   n   t   C   o   n   t   e   x   t   .   t   e   m   p   V   e   r   t   e   x   B   u   f   f   e   r   C   o   u   n   t   e   r   s   1   [   i   d   x   ]   ;   
                   G   L   .   c   u   r   r   e   n   t   C   o   n   t   e   x   t   .   t   e   m   p   V   e   r   t   e   x   B   u   f   f   e   r   C   o   u   n   t   e   r   s   1   [   i   d   x   ]       =       (   G   L   .   c   u   r   r   e   n   t   C   o   n   t   e   x   t   .   t   e   m   p   V   e   r   t   e   x   B   u   f   f   e   r   C   o   u   n   t   e   r   s   1   [   i   d   x   ]       +       1   )       &       (   G   L   .   n   u   m   T   e   m   p   V   e   r   t   e   x   B   u   f   f   e   r   s   P   e   r   S   i   z   e       -       1   )   ;   
                   v   a   r       v   b   o       =       r   i   n   g   b   u   f   f   e   r   [   n   e   x   t   F   r   e   e   B   u   f   f   e   r   I   n   d   e   x   ]   ;   
                   i   f       (   v   b   o   )       {   
                           r   e   t   u   r   n       v   b   o   ;   
                   }   
                   v   a   r       p   r   e   v   V   B   O       =       G   L   c   t   x   .   g   e   t   P   a   r   a   m   e   t   e   r   (   3   4   9   6   4   )   ;   
                   r   i   n   g   b   u   f   f   e   r   [   n   e   x   t   F   r   e   e   B   u   f   f   e   r   I   n   d   e   x   ]       =       G   L   c   t   x   .   c   r   e   a   t   e   B   u   f   f   e   r   (   )   ;   
                   G   L   c   t   x   .   b   i   n   d   B   u   f   f   e   r   (   3   4   9   6   2   ,       r   i   n   g   b   u   f   f   e   r   [   n   e   x   t   F   r   e   e   B   u   f   f   e   r   I   n   d   e   x   ]   )   ;   
                   G   L   c   t   x   .   b   u   f   f   e   r   D   a   t   a   (   3   4   9   6   2   ,       1       <   <       i   d   x   ,       3   5   0   4   8   )   ;   
                   G   L   c   t   x   .   b   i   n   d   B   u   f   f   e   r   (   3   4   9   6   2   ,       p   r   e   v   V   B   O   )   ;   
                   r   e   t   u   r   n       r   i   n   g   b   u   f   f   e   r   [   n   e   x   t   F   r   e   e   B   u   f   f   e   r   I   n   d   e   x   ]   ;   
           }   ,   
           g   e   t   T   e   m   p   I   n   d   e   x   B   u   f   f   e   r   :       s   i   z   e   B   y   t   e   s       =   >       {   
                   v   a   r       i   d   x       =       G   L   .   l   o   g   2   c   e   i   l   L   o   o   k   u   p   (   s   i   z   e   B   y   t   e   s   )   ;   
                   v   a   r       i   b   o       =       G   L   .   c   u   r   r   e   n   t   C   o   n   t   e   x   t   .   t   e   m   p   I   n   d   e   x   B   u   f   f   e   r   s   [   i   d   x   ]   ;   
                   i   f       (   i   b   o   )       {   
                           r   e   t   u   r   n       i   b   o   ;   
                   }   
                   v   a   r       p   r   e   v   I   B   O       =       G   L   c   t   x   .   g   e   t   P   a   r   a   m   e   t   e   r   (   3   4   9   6   5   )   ;   
                   G   L   .   c   u   r   r   e   n   t   C   o   n   t   e   x   t   .   t   e   m   p   I   n   d   e   x   B   u   f   f   e   r   s   [   i   d   x   ]       =       G   L   c   t   x   .   c   r   e   a   t   e   B   u   f   f   e   r   (   )   ;   
                   G   L   c   t   x   .   b   i   n   d   B   u   f   f   e   r   (   3   4   9   6   3   ,       G   L   .   c   u   r   r   e   n   t   C   o   n   t   e   x   t   .   t   e   m   p   I   n   d   e   x   B   u   f   f   e   r   s   [   i   d   x   ]   )   ;   
                   G   L   c   t   x   .   b   u   f   f   e   r   D   a   t   a   (   3   4   9   6   3   ,       1       <   <       i   d   x   ,       3   5   0   4   8   )   ;   
                   G   L   c   t   x   .   b   i   n   d   B   u   f   f   e   r   (   3   4   9   6   3   ,       p   r   e   v   I   B   O   )   ;   
                   r   e   t   u   r   n       G   L   .   c   u   r   r   e   n   t   C   o   n   t   e   x   t   .   t   e   m   p   I   n   d   e   x   B   u   f   f   e   r   s   [   i   d   x   ]   ;   
           }   ,   
           n   e   w   R   e   n   d   e   r   i   n   g   F   r   a   m   e   S   t   a   r   t   e   d   :       (   )       =   >       {   
                   i   f       (   !   G   L   .   c   u   r   r   e   n   t   C   o   n   t   e   x   t   )       {   
                           r   e   t   u   r   n   ;   
                   }   
                   v   a   r       v   b       =       G   L   .   c   u   r   r   e   n   t   C   o   n   t   e   x   t   .   t   e   m   p   V   e   r   t   e   x   B   u   f   f   e   r   s   1   ;   
                   G   L   .   c   u   r   r   e   n   t   C   o   n   t   e   x   t   .   t   e   m   p   V   e   r   t   e   x   B   u   f   f   e   r   s   1       =       G   L   .   c   u   r   r   e   n   t   C   o   n   t   e   x   t   .   t   e   m   p   V   e   r   t   e   x   B   u   f   f   e   r   s   2   ;   
                   G   L   .   c   u   r   r   e   n   t   C   o   n   t   e   x   t   .   t   e   m   p   V   e   r   t   e   x   B   u   f   f   e   r   s   2       =       v   b   ;   
                   v   b       =       G   L   .   c   u   r   r   e   n   t   C   o   n   t   e   x   t   .   t   e   m   p   V   e   r   t   e   x   B   u   f   f   e   r   C   o   u   n   t   e   r   s   1   ;   
                   G   L   .   c   u   r   r   e   n   t   C   o   n   t   e   x   t   .   t   e   m   p   V   e   r   t   e   x   B   u   f   f   e   r   C   o   u   n   t   e   r   s   1       =       G   L   .   c   u   r   r   e   n   t   C   o   n   t   e   x   t   .   t   e   m   p   V   e   r   t   e   x   B   u   f   f   e   r   C   o   u   n   t   e   r   s   2   ;   
                   G   L   .   c   u   r   r   e   n   t   C   o   n   t   e   x   t   .   t   e   m   p   V   e   r   t   e   x   B   u   f   f   e   r   C   o   u   n   t   e   r   s   2       =       v   b   ;   
                   v   a   r       l   a   r   g   e   s   t   I   n   d   e   x       =       G   L   .   l   o   g   2   c   e   i   l   L   o   o   k   u   p   (   G   L   .   M   A   X   _   T   E   M   P   _   B   U   F   F   E   R   _   S   I   Z   E   )   ;   
                   f   o   r       (   v   a   r       i       =       0   ;       i       <   =       l   a   r   g   e   s   t   I   n   d   e   x   ;       +   +   i   )       {   
                           G   L   .   c   u   r   r   e   n   t   C   o   n   t   e   x   t   .   t   e   m   p   V   e   r   t   e   x   B   u   f   f   e   r   C   o   u   n   t   e   r   s   1   [   i   ]       =       0   ;   
                   }   
           }   ,   
           g   e   t   S   o   u   r   c   e   :       (   s   h   a   d   e   r   ,       c   o   u   n   t   ,       s   t   r   i   n   g   ,       l   e   n   g   t   h   )       =   >       {   
                   v   a   r       s   o   u   r   c   e       =       "   "   ;   
                   f   o   r       (   v   a   r       i       =       0   ;       i       <       c   o   u   n   t   ;       +   +   i   )       {   
                           v   a   r       l   e   n       =       l   e   n   g   t   h       ?       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   (   l   e   n   g   t   h   )       +       (   i       *       4   )   )       >   >       2   )   ]       :       u   n   d   e   f   i   n   e   d   ;   
                           s   o   u   r   c   e       +   =       U   T   F   8   T   o   S   t   r   i   n   g   (   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   (   s   t   r   i   n   g   )       +       (   i       *       4   )   )       >   >       2   )   ]   ,       l   e   n   )   ;   
                   }   
                   r   e   t   u   r   n       s   o   u   r   c   e   ;   
           }   ,   
           c   a   l   c   B   u   f   L   e   n   g   t   h   :       (   s   i   z   e   ,       t   y   p   e   ,       s   t   r   i   d   e   ,       c   o   u   n   t   )       =   >       {   
                   i   f       (   s   t   r   i   d   e       >       0   )       {   
                           r   e   t   u   r   n       c   o   u   n   t       *       s   t   r   i   d   e   ;   
                   }   
                   v   a   r       t   y   p   e   S   i   z   e       =       G   L   .   b   y   t   e   S   i   z   e   B   y   T   y   p   e   [   t   y   p   e       -       G   L   .   b   y   t   e   S   i   z   e   B   y   T   y   p   e   R   o   o   t   ]   ;   
                   r   e   t   u   r   n       s   i   z   e       *       t   y   p   e   S   i   z   e       *       c   o   u   n   t   ;   
           }   ,   
           u   s   e   d   T   e   m   p   B   u   f   f   e   r   s   :       [   ]   ,   
           p   r   e   D   r   a   w   H   a   n   d   l   e   C   l   i   e   n   t   V   e   r   t   e   x   A   t   t   r   i   b   B   i   n   d   i   n   g   s   :       c   o   u   n   t       =   >       {   
                   G   L   .   r   e   s   e   t   B   u   f   f   e   r   B   i   n   d   i   n   g       =       f   a   l   s   e   ;   
                   /   /       T   O   D   O   :       i   n   i   t   i   a   l       p   a   s   s       t   o       d   e   t   e   c   t       r   a   n   g   e   s       w   e       n   e   e   d       t   o       u   p   l   o   a   d   ,       m   i   g   h   t       n   o   t       n   e   e   d   
                   /   /       a   n       u   p   l   o   a   d       p   e   r       a   t   t   r   i   b   
                   f   o   r       (   v   a   r       i       =       0   ;       i       <       G   L   .   c   u   r   r   e   n   t   C   o   n   t   e   x   t   .   m   a   x   V   e   r   t   e   x   A   t   t   r   i   b   s   ;       +   +   i   )       {   
                           v   a   r       c   b       =       G   L   .   c   u   r   r   e   n   t   C   o   n   t   e   x   t   .   c   l   i   e   n   t   B   u   f   f   e   r   s   [   i   ]   ;   
                           i   f       (   !   c   b   .   c   l   i   e   n   t   s   i   d   e       |   |       !   c   b   .   e   n   a   b   l   e   d   )       c   o   n   t   i   n   u   e   ;   
                           G   L   .   r   e   s   e   t   B   u   f   f   e   r   B   i   n   d   i   n   g       =       t   r   u   e   ;   
                           v   a   r       s   i   z   e       =       G   L   .   c   a   l   c   B   u   f   L   e   n   g   t   h   (   c   b   .   s   i   z   e   ,       c   b   .   t   y   p   e   ,       c   b   .   s   t   r   i   d   e   ,       c   o   u   n   t   )   ;   
                           v   a   r       b   u   f       =       G   L   .   g   e   t   T   e   m   p   V   e   r   t   e   x   B   u   f   f   e   r   (   s   i   z   e   )   ;   
                           G   L   c   t   x   .   b   i   n   d   B   u   f   f   e   r   (   3   4   9   6   2   ,       b   u   f   )   ;   
                           G   L   c   t   x   .   b   u   f   f   e   r   S   u   b   D   a   t   a   (   3   4   9   6   2   ,       0   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   8   )   .   s   u   b   a   r   r   a   y   (   c   b   .   p   t   r   ,       c   b   .   p   t   r       +       s   i   z   e   )   )   ;   
                           c   b   .   v   e   r   t   e   x   A   t   t   r   i   b   P   o   i   n   t   e   r   A   d   a   p   t   o   r   .   c   a   l   l   (   G   L   c   t   x   ,       i   ,       c   b   .   s   i   z   e   ,       c   b   .   t   y   p   e   ,       c   b   .   n   o   r   m   a   l   i   z   e   d   ,       c   b   .   s   t   r   i   d   e   ,       0   )   ;   
                   }   
           }   ,   
           p   o   s   t   D   r   a   w   H   a   n   d   l   e   C   l   i   e   n   t   V   e   r   t   e   x   A   t   t   r   i   b   B   i   n   d   i   n   g   s   :       (   )       =   >       {   
                   i   f       (   G   L   .   r   e   s   e   t   B   u   f   f   e   r   B   i   n   d   i   n   g   )       {   
                           G   L   c   t   x   .   b   i   n   d   B   u   f   f   e   r   (   3   4   9   6   2   ,       G   L   .   b   u   f   f   e   r   s   [   G   L   c   t   x   .   c   u   r   r   e   n   t   A   r   r   a   y   B   u   f   f   e   r   B   i   n   d   i   n   g   ]   )   ;   
                   }   
           }   ,   
           c   r   e   a   t   e   C   o   n   t   e   x   t   :       (   /   *   *       @   t   y   p   e       {   H   T   M   L   C   a   n   v   a   s   E   l   e   m   e   n   t   }       *   /       c   a   n   v   a   s   ,       w   e   b   G   L   C   o   n   t   e   x   t   A   t   t   r   i   b   u   t   e   s   )       =   >       {   
                   /   /       B   U   G   :       W   o   r   k   a   r   o   u   n   d       S   a   f   a   r   i       W   e   b   G   L       i   s   s   u   e   :       A   f   t   e   r       s   u   c   c   e   s   s   f   u   l   l   y       a   c   q   u   i   r   i   n   g       W   e   b   G   L   
                   /   /       c   o   n   t   e   x   t       o   n       a       c   a   n   v   a   s   ,       c   a   l   l   i   n   g       .   g   e   t   C   o   n   t   e   x   t   (   )       w   i   l   l       a   l   w   a   y   s       r   e   t   u   r   n       t   h   a   t   
                   /   /       c   o   n   t   e   x   t       i   n   d   e   p   e   n   d   e   n   t       o   f       w   h   i   c   h       '   w   e   b   g   l   '       o   r       '   w   e   b   g   l   2   '   
                   /   /       c   o   n   t   e   x   t       v   e   r   s   i   o   n       w   a   s       p   a   s   s   e   d   .       S   e   e   :   
                   /   /               h   t   t   p   s   :   /   /   b   u   g   s   .   w   e   b   k   i   t   .   o   r   g   /   s   h   o   w   _   b   u   g   .   c   g   i   ?   i   d   =   2   2   2   7   5   8   
                   /   /       a   n   d   :   
                   /   /               h   t   t   p   s   :   /   /   g   i   t   h   u   b   .   c   o   m   /   e   m   s   c   r   i   p   t   e   n   -   c   o   r   e   /   e   m   s   c   r   i   p   t   e   n   /   i   s   s   u   e   s   /   1   3   2   9   5   .   
                   /   /       T   O   D   O   :       O   n   c   e       t   h   e       b   u   g       i   s       f   i   x   e   d       a   n   d       s   h   i   p   p   e   d       i   n       S   a   f   a   r   i   ,       a   d   j   u   s   t       t   h   e       S   a   f   a   r   i   
                   /   /       v   e   r   s   i   o   n       f   i   e   l   d       i   n       a   b   o   v   e       c   h   e   c   k   .   
                   i   f       (   !   c   a   n   v   a   s   .   g   e   t   C   o   n   t   e   x   t   S   a   f   a   r   i   W   e   b   G   L   2   F   i   x   e   d   )       {   
                           c   a   n   v   a   s   .   g   e   t   C   o   n   t   e   x   t   S   a   f   a   r   i   W   e   b   G   L   2   F   i   x   e   d       =       c   a   n   v   a   s   .   g   e   t   C   o   n   t   e   x   t   ;   
                           /   *   *       @   t   y   p   e       {   f   u   n   c   t   i   o   n   (   t   h   i   s   :   H   T   M   L   C   a   n   v   a   s   E   l   e   m   e   n   t   ,       s   t   r   i   n   g   ,       (   O   b   j   e   c   t   |   n   u   l   l   )   =   )   :       (   O   b   j   e   c   t   |   n   u   l   l   )   }       *   /       f   u   n   c   t   i   o   n       f   i   x   e   d   G   e   t   C   o   n   t   e   x   t   (   v   e   r   ,       a   t   t   r   s   )       {   
                                   v   a   r       g   l       =       c   a   n   v   a   s   .   g   e   t   C   o   n   t   e   x   t   S   a   f   a   r   i   W   e   b   G   L   2   F   i   x   e   d   (   v   e   r   ,       a   t   t   r   s   )   ;   
                                   r   e   t   u   r   n       (   (   v   e   r       =   =       "   w   e   b   g   l   "   )       =   =       (   g   l       i   n   s   t   a   n   c   e   o   f       W   e   b   G   L   R   e   n   d   e   r   i   n   g   C   o   n   t   e   x   t   )   )       ?       g   l       :       n   u   l   l   ;   
                           }   
                           c   a   n   v   a   s   .   g   e   t   C   o   n   t   e   x   t       =       f   i   x   e   d   G   e   t   C   o   n   t   e   x   t   ;   
                   }   
                   v   a   r       c   t   x       =       c   a   n   v   a   s   .   g   e   t   C   o   n   t   e   x   t   (   "   w   e   b   g   l   2   "   ,       w   e   b   G   L   C   o   n   t   e   x   t   A   t   t   r   i   b   u   t   e   s   )   ;   
                   i   f       (   !   c   t   x   )       r   e   t   u   r   n       0   ;   
                   v   a   r       h   a   n   d   l   e       =       G   L   .   r   e   g   i   s   t   e   r   C   o   n   t   e   x   t   (   c   t   x   ,       w   e   b   G   L   C   o   n   t   e   x   t   A   t   t   r   i   b   u   t   e   s   )   ;   
                   r   e   t   u   r   n       h   a   n   d   l   e   ;   
           }   ,   
           r   e   g   i   s   t   e   r   C   o   n   t   e   x   t   :       (   c   t   x   ,       w   e   b   G   L   C   o   n   t   e   x   t   A   t   t   r   i   b   u   t   e   s   )       =   >       {   
                   /   /       w   i   t   h       p   t   h   r   e   a   d   s       a       c   o   n   t   e   x   t       i   s       a       l   o   c   a   t   i   o   n       i   n       m   e   m   o   r   y       w   i   t   h       s   o   m   e       s   y   n   c   h   r   o   n   i   z   e   d   
                   /   /       d   a   t   a       b   e   t   w   e   e   n       t   h   r   e   a   d   s   
                   v   a   r       h   a   n   d   l   e       =       _   m   a   l   l   o   c   (   8   )   ;   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   (   h   a   n   d   l   e   )       +       (   4   )   )       >   >       2   )   ]       =       _   p   t   h   r   e   a   d   _   s   e   l   f   (   )   ;   
                   /   /       t   h   e       t   h   r   e   a   d       p   o   i   n   t   e   r       o   f       t   h   e       t   h   r   e   a   d       t   h   a   t       o   w   n   s       t   h   e       c   o   n   t   r   o   l       o   f       t   h   e       c   o   n   t   e   x   t   
                   v   a   r       c   o   n   t   e   x   t       =       {   
                           h   a   n   d   l   e   ,   
                           a   t   t   r   i   b   u   t   e   s   :       w   e   b   G   L   C   o   n   t   e   x   t   A   t   t   r   i   b   u   t   e   s   ,   
                           v   e   r   s   i   o   n   :       w   e   b   G   L   C   o   n   t   e   x   t   A   t   t   r   i   b   u   t   e   s   .   m   a   j   o   r   V   e   r   s   i   o   n   ,   
                           G   L   c   t   x   :       c   t   x   
                   }   ;   
                   /   /       S   t   o   r   e       t   h   e       c   r   e   a   t   e   d       c   o   n   t   e   x   t       o   b   j   e   c   t       s   o       t   h   a   t       w   e       c   a   n       a   c   c   e   s   s       t   h   e       c   o   n   t   e   x   t   
                   /   /       g   i   v   e   n       a       c   a   n   v   a   s       w   i   t   h   o   u   t       h   a   v   i   n   g       t   o       p   a   s   s       t   h   e       p   a   r   a   m   e   t   e   r   s       a   g   a   i   n   .   
                   i   f       (   c   t   x   .   c   a   n   v   a   s   )       c   t   x   .   c   a   n   v   a   s   .   G   L   c   t   x   O   b   j   e   c   t       =       c   o   n   t   e   x   t   ;   
                   G   L   .   c   o   n   t   e   x   t   s   [   h   a   n   d   l   e   ]       =       c   o   n   t   e   x   t   ;   
                   i   f       (   t   y   p   e   o   f       w   e   b   G   L   C   o   n   t   e   x   t   A   t   t   r   i   b   u   t   e   s   .   e   n   a   b   l   e   E   x   t   e   n   s   i   o   n   s   B   y   D   e   f   a   u   l   t       =   =       "   u   n   d   e   f   i   n   e   d   "       |   |       w   e   b   G   L   C   o   n   t   e   x   t   A   t   t   r   i   b   u   t   e   s   .   e   n   a   b   l   e   E   x   t   e   n   s   i   o   n   s   B   y   D   e   f   a   u   l   t   )       {   
                           G   L   .   i   n   i   t   E   x   t   e   n   s   i   o   n   s   (   c   o   n   t   e   x   t   )   ;   
                   }   
                   c   o   n   t   e   x   t   .   m   a   x   V   e   r   t   e   x   A   t   t   r   i   b   s       =       c   o   n   t   e   x   t   .   G   L   c   t   x   .   g   e   t   P   a   r   a   m   e   t   e   r   (   3   4   9   2   1   )   ;   
                   c   o   n   t   e   x   t   .   c   l   i   e   n   t   B   u   f   f   e   r   s       =       [   ]   ;   
                   f   o   r       (   v   a   r       i       =       0   ;       i       <       c   o   n   t   e   x   t   .   m   a   x   V   e   r   t   e   x   A   t   t   r   i   b   s   ;       i   +   +   )       {   
                           c   o   n   t   e   x   t   .   c   l   i   e   n   t   B   u   f   f   e   r   s   [   i   ]       =       {   
                                   e   n   a   b   l   e   d   :       f   a   l   s   e   ,   
                                   c   l   i   e   n   t   s   i   d   e   :       f   a   l   s   e   ,   
                                   s   i   z   e   :       0   ,   
                                   t   y   p   e   :       0   ,   
                                   n   o   r   m   a   l   i   z   e   d   :       0   ,   
                                   s   t   r   i   d   e   :       0   ,   
                                   p   t   r   :       0   ,   
                                   v   e   r   t   e   x   A   t   t   r   i   b   P   o   i   n   t   e   r   A   d   a   p   t   o   r   :       n   u   l   l   
                           }   ;   
                   }   
                   G   L   .   g   e   n   e   r   a   t   e   T   e   m   p   B   u   f   f   e   r   s   (   f   a   l   s   e   ,       c   o   n   t   e   x   t   )   ;   
                   r   e   t   u   r   n       h   a   n   d   l   e   ;   
           }   ,   
           m   a   k   e   C   o   n   t   e   x   t   C   u   r   r   e   n   t   :       c   o   n   t   e   x   t   H   a   n   d   l   e       =   >       {   
                   /   /       A   c   t   i   v   e       E   m   s   c   r   i   p   t   e   n       G   L       l   a   y   e   r       c   o   n   t   e   x   t       o   b   j   e   c   t   .   
                   G   L   .   c   u   r   r   e   n   t   C   o   n   t   e   x   t       =       G   L   .   c   o   n   t   e   x   t   s   [   c   o   n   t   e   x   t   H   a   n   d   l   e   ]   ;   
                   /   /       A   c   t   i   v   e       W   e   b   G   L       c   o   n   t   e   x   t       o   b   j   e   c   t   .   
                   M   o   d   u   l   e   [   "   c   t   x   "   ]       =       G   L   c   t   x       =       G   L   .   c   u   r   r   e   n   t   C   o   n   t   e   x   t   ?   .   G   L   c   t   x   ;   
                   r   e   t   u   r   n       !   (   c   o   n   t   e   x   t   H   a   n   d   l   e       &   &       !   G   L   c   t   x   )   ;   
           }   ,   
           g   e   t   C   o   n   t   e   x   t   :       c   o   n   t   e   x   t   H   a   n   d   l   e       =   >       G   L   .   c   o   n   t   e   x   t   s   [   c   o   n   t   e   x   t   H   a   n   d   l   e   ]   ,   
           d   e   l   e   t   e   C   o   n   t   e   x   t   :       c   o   n   t   e   x   t   H   a   n   d   l   e       =   >       {   
                   i   f       (   G   L   .   c   u   r   r   e   n   t   C   o   n   t   e   x   t       =   =   =       G   L   .   c   o   n   t   e   x   t   s   [   c   o   n   t   e   x   t   H   a   n   d   l   e   ]   )       {   
                           G   L   .   c   u   r   r   e   n   t   C   o   n   t   e   x   t       =       n   u   l   l   ;   
                   }   
                   i   f       (   t   y   p   e   o   f       J   S   E   v   e   n   t   s       =   =       "   o   b   j   e   c   t   "   )       {   
                           /   /       R   e   l   e   a   s   e       a   l   l       J   S       e   v   e   n   t       h   a   n   d   l   e   r   s       o   n       t   h   e       D   O   M       e   l   e   m   e   n   t       t   h   a   t       t   h   e       G   L       c   o   n   t   e   x   t       i   s   
                           /   /       a   s   s   o   c   i   a   t   e   d       w   i   t   h       s   i   n   c   e       t   h   e       c   o   n   t   e   x   t       i   s       n   o   w       d   e   l   e   t   e   d   .   
                           J   S   E   v   e   n   t   s   .   r   e   m   o   v   e   A   l   l   H   a   n   d   l   e   r   s   O   n   T   a   r   g   e   t   (   G   L   .   c   o   n   t   e   x   t   s   [   c   o   n   t   e   x   t   H   a   n   d   l   e   ]   .   G   L   c   t   x   .   c   a   n   v   a   s   )   ;   
                   }   
                   /   /       M   a   k   e       s   u   r   e       t   h   e       c   a   n   v   a   s       o   b   j   e   c   t       n   o       l   o   n   g   e   r       r   e   f   e   r   s       t   o       t   h   e       c   o   n   t   e   x   t       o   b   j   e   c   t       s   o   
                   /   /       t   h   e   r   e       a   r   e       n   o       G   C       s   u   r   p   r   i   s   e   s   .   
                   i   f       (   G   L   .   c   o   n   t   e   x   t   s   [   c   o   n   t   e   x   t   H   a   n   d   l   e   ]   ?   .   G   L   c   t   x   .   c   a   n   v   a   s   )       {   
                           G   L   .   c   o   n   t   e   x   t   s   [   c   o   n   t   e   x   t   H   a   n   d   l   e   ]   .   G   L   c   t   x   .   c   a   n   v   a   s   .   G   L   c   t   x   O   b   j   e   c   t       =       u   n   d   e   f   i   n   e   d   ;   
                   }   
                   _   f   r   e   e   (   G   L   .   c   o   n   t   e   x   t   s   [   c   o   n   t   e   x   t   H   a   n   d   l   e   ]   .   h   a   n   d   l   e   )   ;   
                   G   L   .   c   o   n   t   e   x   t   s   [   c   o   n   t   e   x   t   H   a   n   d   l   e   ]       =       n   u   l   l   ;   
           }   ,   
           i   n   i   t   E   x   t   e   n   s   i   o   n   s   :       c   o   n   t   e   x   t       =   >       {   
                   /   /       I   f       t   h   i   s       f   u   n   c   t   i   o   n       i   s       c   a   l   l   e   d       w   i   t   h   o   u   t       a       s   p   e   c   i   f   i   c       c   o   n   t   e   x   t       o   b   j   e   c   t   ,       i   n   i   t       t   h   e   
                   /   /       e   x   t   e   n   s   i   o   n   s       o   f       t   h   e       c   u   r   r   e   n   t   l   y       a   c   t   i   v   e       c   o   n   t   e   x   t   .   
                   c   o   n   t   e   x   t       |   |   =       G   L   .   c   u   r   r   e   n   t   C   o   n   t   e   x   t   ;   
                   i   f       (   c   o   n   t   e   x   t   .   i   n   i   t   E   x   t   e   n   s   i   o   n   s   D   o   n   e   )       r   e   t   u   r   n   ;   
                   c   o   n   t   e   x   t   .   i   n   i   t   E   x   t   e   n   s   i   o   n   s   D   o   n   e       =       t   r   u   e   ;   
                   v   a   r       G   L   c   t   x       =       c   o   n   t   e   x   t   .   G   L   c   t   x   ;   
                   /   /       D   e   t   e   c   t       t   h   e       p   r   e   s   e   n   c   e       o   f       a       f   e   w       e   x   t   e   n   s   i   o   n   s       m   a   n   u   a   l   l   y   ,       c   t   i   o   n       G   L       i   n   t   e   r   o   p   
                   /   /       l   a   y   e   r       i   t   s   e   l   f       w   i   l   l       n   e   e   d       t   o       k   n   o   w       i   f       t   h   e   y       e   x   i   s   t   .   
                   /   /       E   x   t   e   n   s   i   o   n   s       t   h   a   t       a   r   e       a   v   a   i   l   a   b   l   e       i   n       b   o   t   h       W   e   b   G   L       1       a   n   d       W   e   b   G   L       2   
                   w   e   b   g   l   _   e   n   a   b   l   e   _   W   E   B   G   L   _   m   u   l   t   i   _   d   r   a   w   (   G   L   c   t   x   )   ;   
                   w   e   b   g   l   _   e   n   a   b   l   e   _   E   X   T   _   p   o   l   y   g   o   n   _   o   f   f   s   e   t   _   c   l   a   m   p   (   G   L   c   t   x   )   ;   
                   w   e   b   g   l   _   e   n   a   b   l   e   _   E   X   T   _   c   l   i   p   _   c   o   n   t   r   o   l   (   G   L   c   t   x   )   ;   
                   w   e   b   g   l   _   e   n   a   b   l   e   _   W   E   B   G   L   _   p   o   l   y   g   o   n   _   m   o   d   e   (   G   L   c   t   x   )   ;   
                   /   /       E   x   t   e   n   s   i   o   n   s       t   h   a   t       a   r   e       a   v   a   i   l   a   b   l   e       f   r   o   m       W   e   b   G   L       >   =       2       (   n   o   -   o   p       i   f       c   a   l   l   e   d       o   n       a       W   e   b   G   L       1       c   o   n   t   e   x   t       a   c   t   i   v   e   )   
                   w   e   b   g   l   _   e   n   a   b   l   e   _   W   E   B   G   L   _   d   r   a   w   _   i   n   s   t   a   n   c   e   d   _   b   a   s   e   _   v   e   r   t   e   x   _   b   a   s   e   _   i   n   s   t   a   n   c   e   (   G   L   c   t   x   )   ;   
                   w   e   b   g   l   _   e   n   a   b   l   e   _   W   E   B   G   L   _   m   u   l   t   i   _   d   r   a   w   _   i   n   s   t   a   n   c   e   d   _   b   a   s   e   _   v   e   r   t   e   x   _   b   a   s   e   _   i   n   s   t   a   n   c   e   (   G   L   c   t   x   )   ;   
                   /   /       O   n       W   e   b   G   L       2   ,       E   X   T   _   d   i   s   j   o   i   n   t   _   t   i   m   e   r   _   q   u   e   r   y       i   s       r   e   p   l   a   c   e   d       w   i   t   h       a   n       a   l   t   e   r   n   a   t   i   v   e   
                   /   /       t   h   a   t   '   s       b   a   s   e   d       o   n       c   o   r   e       A   P   I   s   ,       a   n   d       e   x   p   o   s   e   s       o   n   l   y       t   h   e       q   u   e   r   y   C   o   u   n   t   e   r   E   X   T   (   )   
                   /   /       e   n   t   r   y   p   o   i   n   t   .   
                   i   f       (   c   o   n   t   e   x   t   .   v   e   r   s   i   o   n       >   =       2   )       {   
                           G   L   c   t   x   .   d   i   s   j   o   i   n   t   T   i   m   e   r   Q   u   e   r   y   E   x   t       =       G   L   c   t   x   .   g   e   t   E   x   t   e   n   s   i   o   n   (   "   E   X   T   _   d   i   s   j   o   i   n   t   _   t   i   m   e   r   _   q   u   e   r   y   _   w   e   b   g   l   2   "   )   ;   
                   }   
                   /   /       H   o   w   e   v   e   r   ,       F   i   r   e   f   o   x       e   x   p   o   s   e   s       t   h   e       W   e   b   G   L       1       v   e   r   s   i   o   n       o   n       W   e   b   G   L       2       a   s       w   e   l   l       a   n   d   
                   /   /       t   h   u   s       w   e       l   o   o   k       f   o   r       t   h   e       W   e   b   G   L       1       v   e   r   s   i   o   n       a   g   a   i   n       i   f       t   h   e       W   e   b   G   L       2       v   e   r   s   i   o   n   
                   /   /       i   s   n   '   t       p   r   e   s   e   n   t   .       h   t   t   p   s   :   /   /   b   u   g   z   i   l   l   a   .   m   o   z   i   l   l   a   .   o   r   g   /   s   h   o   w   _   b   u   g   .   c   g   i   ?   i   d   =   1   3   2   8   8   8   2   
                   i   f       (   c   o   n   t   e   x   t   .   v   e   r   s   i   o   n       <       2       |   |       !   G   L   c   t   x   .   d   i   s   j   o   i   n   t   T   i   m   e   r   Q   u   e   r   y   E   x   t   )       {   
                           G   L   c   t   x   .   d   i   s   j   o   i   n   t   T   i   m   e   r   Q   u   e   r   y   E   x   t       =       G   L   c   t   x   .   g   e   t   E   x   t   e   n   s   i   o   n   (   "   E   X   T   _   d   i   s   j   o   i   n   t   _   t   i   m   e   r   _   q   u   e   r   y   "   )   ;   
                   }   
                   g   e   t   E   m   s   c   r   i   p   t   e   n   S   u   p   p   o   r   t   e   d   E   x   t   e   n   s   i   o   n   s   (   G   L   c   t   x   )   .   f   o   r   E   a   c   h   (   e   x   t       =   >       {   
                           /   /       W   E   B   G   L   _   l   o   s   e   _   c   o   n   t   e   x   t   ,       W   E   B   G   L   _   d   e   b   u   g   _   r   e   n   d   e   r   e   r   _   i   n   f   o       a   n   d       W   E   B   G   L   _   d   e   b   u   g   _   s   h   a   d   e   r   s   
                           /   /       a   r   e       n   o   t       e   n   a   b   l   e   d       b   y       d   e   f   a   u   l   t   .   
                           i   f       (   !   e   x   t   .   i   n   c   l   u   d   e   s   (   "   l   o   s   e   _   c   o   n   t   e   x   t   "   )       &   &       !   e   x   t   .   i   n   c   l   u   d   e   s   (   "   d   e   b   u   g   "   )   )       {   
                                   /   /       C   a   l   l       .   g   e   t   E   x   t   e   n   s   i   o   n   (   )       t   o       e   n   a   b   l   e       t   h   a   t       e   x   t   e   n   s   i   o   n       p   e   r   m   a   n   e   n   t   l   y   .   
                                   G   L   c   t   x   .   g   e   t   E   x   t   e   n   s   i   o   n   (   e   x   t   )   ;   
                           }   
                   }   )   ;   
           }   
   }   ;   
   
   f   u   n   c   t   i   o   n       _   e   g   l   C   r   e   a   t   e   C   o   n   t   e   x   t   (   d   i   s   p   l   a   y   ,       c   o   n   f   i   g   ,       h   m   m   ,       c   o   n   t   e   x   t   A   t   t   r   i   b   s   )       {   
           i   f       (   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   P   T   H   R   E   A   D   )       r   e   t   u   r   n       p   r   o   x   y   T   o   M   a   i   n   T   h   r   e   a   d   (   4   ,       0   ,       1   ,       d   i   s   p   l   a   y   ,       c   o   n   f   i   g   ,       h   m   m   ,       c   o   n   t   e   x   t   A   t   t   r   i   b   s   )   ;   
           i   f       (   d   i   s   p   l   a   y       !   =       6   2   e   3   )       {   
                   E   G   L   .   s   e   t   E   r   r   o   r   C   o   d   e   (   1   2   2   9   6   )   ;   
                   r   e   t   u   r   n       0   ;   
           }   
           /   /       E   G   L       1   .   4       s   p   e   c       s   a   y   s       d   e   f   a   u   l   t       E   G   L   _   C   O   N   T   E   X   T   _   C   L   I   E   N   T   _   V   E   R   S   I   O   N       i   s       G   L   E   S   1   ,       b   u   t       t   h   i   s       i   s       n   o   t       s   u   p   p   o   r   t   e   d       b   y       E   m   s   c   r   i   p   t   e   n   .   
           /   /       S   o       u   s   e   r       m   u   s   t       p   a   s   s       E   G   L   _   C   O   N   T   E   X   T   _   C   L   I   E   N   T   _   V   E   R   S   I   O   N       =   =       2       t   o       i   n   i   t   i   a   l   i   z   e       E   G   L   .   
           v   a   r       g   l   e   s   C   o   n   t   e   x   t   V   e   r   s   i   o   n       =       1   ;   
           f   o   r       (   ;   ;   )       {   
                   v   a   r       p   a   r   a   m       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   c   o   n   t   e   x   t   A   t   t   r   i   b   s   )       >   >       2   )   ]   ;   
                   i   f       (   p   a   r   a   m       =   =       1   2   4   4   0   )       {   
                           g   l   e   s   C   o   n   t   e   x   t   V   e   r   s   i   o   n       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   (   c   o   n   t   e   x   t   A   t   t   r   i   b   s   )       +       (   4   )   )       >   >       2   )   ]   ;   
                   }       e   l   s   e       i   f       (   p   a   r   a   m       =   =       1   2   3   4   4   )       {   
                           b   r   e   a   k   ;   
                   }       e   l   s   e       {   
                           /   *       E   G   L   1   .   4       s   p   e   c   i   f   i   e   s       o   n   l   y       E   G   L   _   C   O   N   T   E   X   T   _   C   L   I   E   N   T   _   V   E   R   S   I   O   N       a   s       s   u   p   p   o   r   t   e   d       a   t   t   r   i   b   u   t   e       *   /       E   G   L   .   s   e   t   E   r   r   o   r   C   o   d   e   (   1   2   2   9   2   )   ;   
                           r   e   t   u   r   n       0   ;   
                   }   
                   c   o   n   t   e   x   t   A   t   t   r   i   b   s       +   =       8   ;   
           }   
           i   f       (   g   l   e   s   C   o   n   t   e   x   t   V   e   r   s   i   o   n       <       2       |   |       g   l   e   s   C   o   n   t   e   x   t   V   e   r   s   i   o   n       >       3   )       {   
                   E   G   L   .   s   e   t   E   r   r   o   r   C   o   d   e   (   1   2   2   9   3   )   ;   
                   r   e   t   u   r   n       0   ;   
           }   
           E   G   L   .   c   o   n   t   e   x   t   A   t   t   r   i   b   u   t   e   s   .   m   a   j   o   r   V   e   r   s   i   o   n       =       g   l   e   s   C   o   n   t   e   x   t   V   e   r   s   i   o   n       -       1   ;   
           /   /       W   e   b   G   L       1       i   s       G   L   E   S       2   ,       W   e   b   G   L   2       i   s       G   L   E   S   3   
           E   G   L   .   c   o   n   t   e   x   t   A   t   t   r   i   b   u   t   e   s   .   m   i   n   o   r   V   e   r   s   i   o   n       =       0   ;   
           E   G   L   .   c   o   n   t   e   x   t       =       G   L   .   c   r   e   a   t   e   C   o   n   t   e   x   t   (   B   r   o   w   s   e   r   .   g   e   t   C   a   n   v   a   s   (   )   ,       E   G   L   .   c   o   n   t   e   x   t   A   t   t   r   i   b   u   t   e   s   )   ;   
           i   f       (   E   G   L   .   c   o   n   t   e   x   t       !   =       0   )       {   
                   E   G   L   .   s   e   t   E   r   r   o   r   C   o   d   e   (   1   2   2   8   8   )   ;   
                   /   /       R   u   n       c   a   l   l   b   a   c   k   s       s   o       t   h   a   t       G   L       e   m   u   l   a   t   i   o   n       w   o   r   k   s   
                   G   L   .   m   a   k   e   C   o   n   t   e   x   t   C   u   r   r   e   n   t   (   E   G   L   .   c   o   n   t   e   x   t   )   ;   
                   B   r   o   w   s   e   r   .   u   s   e   W   e   b   G   L       =       t   r   u   e   ;   
                   B   r   o   w   s   e   r   .   m   o   d   u   l   e   C   o   n   t   e   x   t   C   r   e   a   t   e   d   C   a   l   l   b   a   c   k   s   .   f   o   r   E   a   c   h   (   c   a   l   l   b   a   c   k       =   >       c   a   l   l   b   a   c   k   (   )   )   ;   
                   /   /       N   o   t   e   :       T   h   i   s       f   u   n   c   t   i   o   n       o   n   l   y       c   r   e   a   t   e   s       a       c   o   n   t   e   x   t   ,       b   u   t       i   t       s   h   a   l   l       n   o   t       m   a   k   e       i   t       a   c   t   i   v   e   .   
                   G   L   .   m   a   k   e   C   o   n   t   e   x   t   C   u   r   r   e   n   t   (   n   u   l   l   )   ;   
                   r   e   t   u   r   n       6   2   0   0   4   ;   
           }       e   l   s   e       {   
                   E   G   L   .   s   e   t   E   r   r   o   r   C   o   d   e   (   1   2   2   9   7   )   ;   
                   /   /       B   y       t   h   e       E   G   L       1   .   4       s   p   e   c   ,       a   n       i   m   p   l   e   m   e   n   t   a   t   i   o   n       t   h   a   t       d   o   e   s       n   o   t       s   u   p   p   o   r   t       G   L   E   S   2       (   W   e   b   G   L       i   n       t   h   i   s       c   a   s   e   )   ,       t   h   i   s       e   r   r   o   r       c   o   d   e       i   s       s   e   t   .   
                   r   e   t   u   r   n       0   ;   
           }   
   }   
   
   f   u   n   c   t   i   o   n       _   e   g   l   C   r   e   a   t   e   W   i   n   d   o   w   S   u   r   f   a   c   e   (   d   i   s   p   l   a   y   ,       c   o   n   f   i   g   ,       w   i   n   ,       a   t   t   r   i   b   _   l   i   s   t   )       {   
           i   f       (   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   P   T   H   R   E   A   D   )       r   e   t   u   r   n       p   r   o   x   y   T   o   M   a   i   n   T   h   r   e   a   d   (   5   ,       0   ,       1   ,       d   i   s   p   l   a   y   ,       c   o   n   f   i   g   ,       w   i   n   ,       a   t   t   r   i   b   _   l   i   s   t   )   ;   
           i   f       (   d   i   s   p   l   a   y       !   =       6   2   e   3   )       {   
                   E   G   L   .   s   e   t   E   r   r   o   r   C   o   d   e   (   1   2   2   9   6   )   ;   
                   r   e   t   u   r   n       0   ;   
           }   
           i   f       (   c   o   n   f   i   g       !   =       6   2   0   0   2   )       {   
                   E   G   L   .   s   e   t   E   r   r   o   r   C   o   d   e   (   1   2   2   9   3   )   ;   
                   r   e   t   u   r   n       0   ;   
           }   
           /   /       T   O   D   O   :       E   x   a   m   i   n   e       a   t   t   r   i   b   _   l   i   s   t   !       P   a   r   a   m   e   t   e   r   s       t   h   a   t       c   a   n       b   e       p   r   e   s   e   n   t       t   h   e   r   e       a   r   e   :   
           /   /       -       E   G   L   _   R   E   N   D   E   R   _   B   U   F   F   E   R       (   m   u   s   t       b   e       E   G   L   _   B   A   C   K   _   B   U   F   F   E   R   )   
           /   /       -       E   G   L   _   V   G   _   C   O   L   O   R   S   P   A   C   E       (   c   a   n   '   t       b   e       s   e   t   )   
           /   /       -       E   G   L   _   V   G   _   A   L   P   H   A   _   F   O   R   M   A   T       (   c   a   n   '   t       b   e       s   e   t   )   
           E   G   L   .   s   e   t   E   r   r   o   r   C   o   d   e   (   1   2   2   8   8   )   ;   
           r   e   t   u   r   n       6   2   0   0   6   ;   
   }   
   
   f   u   n   c   t   i   o   n       _   e   g   l   G   e   t   C   o   n   f   i   g   A   t   t   r   i   b   (   d   i   s   p   l   a   y   ,       c   o   n   f   i   g   ,       a   t   t   r   i   b   u   t   e   ,       v   a   l   u   e   )       {   
           i   f       (   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   P   T   H   R   E   A   D   )       r   e   t   u   r   n       p   r   o   x   y   T   o   M   a   i   n   T   h   r   e   a   d   (   6   ,       0   ,       1   ,       d   i   s   p   l   a   y   ,       c   o   n   f   i   g   ,       a   t   t   r   i   b   u   t   e   ,       v   a   l   u   e   )   ;   
           i   f       (   d   i   s   p   l   a   y       !   =       6   2   e   3   )       {   
                   E   G   L   .   s   e   t   E   r   r   o   r   C   o   d   e   (   1   2   2   9   6   )   ;   
                   r   e   t   u   r   n       0   ;   
           }   
           i   f       (   c   o   n   f   i   g       !   =       6   2   0   0   2   )       {   
                   E   G   L   .   s   e   t   E   r   r   o   r   C   o   d   e   (   1   2   2   9   3   )   ;   
                   r   e   t   u   r   n       0   ;   
           }   
           i   f       (   !   v   a   l   u   e   )       {   
                   E   G   L   .   s   e   t   E   r   r   o   r   C   o   d   e   (   1   2   3   0   0   )   ;   
                   r   e   t   u   r   n       0   ;   
           }   
           E   G   L   .   s   e   t   E   r   r   o   r   C   o   d   e   (   1   2   2   8   8   )   ;   
           s   w   i   t   c   h       (   a   t   t   r   i   b   u   t   e   )       {   
               c   a   s   e       1   2   3   2   0   :   
                   /   /       E   G   L   _   B   U   F   F   E   R   _   S   I   Z   E   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   v   a   l   u   e   )       >   >       2   )   ]       =       E   G   L   .   c   o   n   t   e   x   t   A   t   t   r   i   b   u   t   e   s   .   a   l   p   h   a       ?       3   2       :       2   4   ;   
                   r   e   t   u   r   n       1   ;   
   
               c   a   s   e       1   2   3   2   1   :   
                   /   /       E   G   L   _   A   L   P   H   A   _   S   I   Z   E   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   v   a   l   u   e   )       >   >       2   )   ]       =       E   G   L   .   c   o   n   t   e   x   t   A   t   t   r   i   b   u   t   e   s   .   a   l   p   h   a       ?       8       :       0   ;   
                   r   e   t   u   r   n       1   ;   
   
               c   a   s   e       1   2   3   2   2   :   
                   /   /       E   G   L   _   B   L   U   E   _   S   I   Z   E   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   v   a   l   u   e   )       >   >       2   )   ]       =       8   ;   
                   r   e   t   u   r   n       1   ;   
   
               c   a   s   e       1   2   3   2   3   :   
                   /   /       E   G   L   _   G   R   E   E   N   _   S   I   Z   E   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   v   a   l   u   e   )       >   >       2   )   ]       =       8   ;   
                   r   e   t   u   r   n       1   ;   
   
               c   a   s   e       1   2   3   2   4   :   
                   /   /       E   G   L   _   R   E   D   _   S   I   Z   E   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   v   a   l   u   e   )       >   >       2   )   ]       =       8   ;   
                   r   e   t   u   r   n       1   ;   
   
               c   a   s   e       1   2   3   2   5   :   
                   /   /       E   G   L   _   D   E   P   T   H   _   S   I   Z   E   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   v   a   l   u   e   )       >   >       2   )   ]       =       E   G   L   .   c   o   n   t   e   x   t   A   t   t   r   i   b   u   t   e   s   .   d   e   p   t   h       ?       2   4       :       0   ;   
                   r   e   t   u   r   n       1   ;   
   
               c   a   s   e       1   2   3   2   6   :   
                   /   /       E   G   L   _   S   T   E   N   C   I   L   _   S   I   Z   E   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   v   a   l   u   e   )       >   >       2   )   ]       =       E   G   L   .   c   o   n   t   e   x   t   A   t   t   r   i   b   u   t   e   s   .   s   t   e   n   c   i   l       ?       8       :       0   ;   
                   r   e   t   u   r   n       1   ;   
   
               c   a   s   e       1   2   3   2   7   :   
                   /   /       E   G   L   _   C   O   N   F   I   G   _   C   A   V   E   A   T   
                   /   /       W   e       c   a   n       r   e   t   u   r   n       h   e   r   e       o   n   e       o   f       E   G   L   _   N   O   N   E       (   0   x   3   0   3   8   )   ,       E   G   L   _   S   L   O   W   _   C   O   N   F   I   G       (   0   x   3   0   5   0   )       o   r       E   G   L   _   N   O   N   _   C   O   N   F   O   R   M   A   N   T   _   C   O   N   F   I   G       (   0   x   3   0   5   1   )   .   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   v   a   l   u   e   )       >   >       2   )   ]       =       1   2   3   4   4   ;   
                   r   e   t   u   r   n       1   ;   
   
               c   a   s   e       1   2   3   2   8   :   
                   /   /       E   G   L   _   C   O   N   F   I   G   _   I   D   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   v   a   l   u   e   )       >   >       2   )   ]       =       6   2   0   0   2   ;   
                   r   e   t   u   r   n       1   ;   
   
               c   a   s   e       1   2   3   2   9   :   
                   /   /       E   G   L   _   L   E   V   E   L   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   v   a   l   u   e   )       >   >       2   )   ]       =       0   ;   
                   r   e   t   u   r   n       1   ;   
   
               c   a   s   e       1   2   3   3   0   :   
                   /   /       E   G   L   _   M   A   X   _   P   B   U   F   F   E   R   _   H   E   I   G   H   T   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   v   a   l   u   e   )       >   >       2   )   ]       =       4   0   9   6   ;   
                   r   e   t   u   r   n       1   ;   
   
               c   a   s   e       1   2   3   3   1   :   
                   /   /       E   G   L   _   M   A   X   _   P   B   U   F   F   E   R   _   P   I   X   E   L   S   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   v   a   l   u   e   )       >   >       2   )   ]       =       1   6   7   7   7   2   1   6   ;   
                   r   e   t   u   r   n       1   ;   
   
               c   a   s   e       1   2   3   3   2   :   
                   /   /       E   G   L   _   M   A   X   _   P   B   U   F   F   E   R   _   W   I   D   T   H   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   v   a   l   u   e   )       >   >       2   )   ]       =       4   0   9   6   ;   
                   r   e   t   u   r   n       1   ;   
   
               c   a   s   e       1   2   3   3   3   :   
                   /   /       E   G   L   _   N   A   T   I   V   E   _   R   E   N   D   E   R   A   B   L   E   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   v   a   l   u   e   )       >   >       2   )   ]       =       0   ;   
                   r   e   t   u   r   n       1   ;   
   
               c   a   s   e       1   2   3   3   4   :   
                   /   /       E   G   L   _   N   A   T   I   V   E   _   V   I   S   U   A   L   _   I   D   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   v   a   l   u   e   )       >   >       2   )   ]       =       0   ;   
                   r   e   t   u   r   n       1   ;   
   
               c   a   s   e       1   2   3   3   5   :   
                   /   /       E   G   L   _   N   A   T   I   V   E   _   V   I   S   U   A   L   _   T   Y   P   E   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   v   a   l   u   e   )       >   >       2   )   ]       =       1   2   3   4   4   ;   
                   r   e   t   u   r   n       1   ;   
   
               c   a   s   e       1   2   3   3   7   :   
                   /   /       E   G   L   _   S   A   M   P   L   E   S   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   v   a   l   u   e   )       >   >       2   )   ]       =       E   G   L   .   c   o   n   t   e   x   t   A   t   t   r   i   b   u   t   e   s   .   a   n   t   i   a   l   i   a   s       ?       4       :       0   ;   
                   r   e   t   u   r   n       1   ;   
   
               c   a   s   e       1   2   3   3   8   :   
                   /   /       E   G   L   _   S   A   M   P   L   E   _   B   U   F   F   E   R   S   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   v   a   l   u   e   )       >   >       2   )   ]       =       E   G   L   .   c   o   n   t   e   x   t   A   t   t   r   i   b   u   t   e   s   .   a   n   t   i   a   l   i   a   s       ?       1       :       0   ;   
                   r   e   t   u   r   n       1   ;   
   
               c   a   s   e       1   2   3   3   9   :   
                   /   /       E   G   L   _   S   U   R   F   A   C   E   _   T   Y   P   E   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   v   a   l   u   e   )       >   >       2   )   ]       =       4   ;   
                   r   e   t   u   r   n       1   ;   
   
               c   a   s   e       1   2   3   4   0   :   
                   /   /       E   G   L   _   T   R   A   N   S   P   A   R   E   N   T   _   T   Y   P   E   
                   /   /       I   f       t   h   i   s       r   e   t   u   r   n   s       E   G   L   _   T   R   A   N   S   P   A   R   E   N   T   _   R   G   B       (   0   x   3   0   5   2   )   ,       t   r   a   n   s   p   a   r   e   n   c   y       i   s       u   s   e   d       t   h   r   o   u   g   h       c   o   l   o   r   -   k   e   y   i   n   g   .       N   o       s   u   c   h       t   h   i   n   g       a   p   p   l   i   e   s       t   o       E   m   s   c   r   i   p   t   e   n       c   a   n   v   a   s   .   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   v   a   l   u   e   )       >   >       2   )   ]       =       1   2   3   4   4   ;   
                   r   e   t   u   r   n       1   ;   
   
               c   a   s   e       1   2   3   4   1   :   
               /   /       E   G   L   _   T   R   A   N   S   P   A   R   E   N   T   _   B   L   U   E   _   V   A   L   U   E   
                   c   a   s   e       1   2   3   4   2   :   
               /   /       E   G   L   _   T   R   A   N   S   P   A   R   E   N   T   _   G   R   E   E   N   _   V   A   L   U   E   
                   c   a   s   e       1   2   3   4   3   :   
                   /   /       E   G   L   _   T   R   A   N   S   P   A   R   E   N   T   _   R   E   D   _   V   A   L   U   E   
                   /   /       "   I   f       E   G   L   _   T   R   A   N   S   P   A   R   E   N   T   _   T   Y   P   E       i   s       E   G   L   _   N   O   N   E   ,       t   h   e   n       t   h   e       v   a   l   u   e   s       f   o   r       E   G   L   _   T   R   A   N   S   P   A   R   E   N   T   _   R   E   D   _   V   A   L   U   E   ,       E   G   L   _   T   R   A   N   S   P   A   R   E   N   T   _   G   R   E   E   N   _   V   A   L   U   E   ,       a   n   d       E   G   L   _   T   R   A   N   S   P   A   R   E   N   T   _   B   L   U   E   _   V   A   L   U   E       a   r   e       u   n   d   e   f   i   n   e   d   .   "   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   v   a   l   u   e   )       >   >       2   )   ]       =       -   1   ;   
                   r   e   t   u   r   n       1   ;   
   
               c   a   s   e       1   2   3   4   5   :   
               /   /       E   G   L   _   B   I   N   D   _   T   O   _   T   E   X   T   U   R   E   _   R   G   B   
                   c   a   s   e       1   2   3   4   6   :   
                   /   /       E   G   L   _   B   I   N   D   _   T   O   _   T   E   X   T   U   R   E   _   R   G   B   A   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   v   a   l   u   e   )       >   >       2   )   ]       =       0   ;   
                   r   e   t   u   r   n       1   ;   
   
               c   a   s   e       1   2   3   4   7   :   
                   /   /       E   G   L   _   M   I   N   _   S   W   A   P   _   I   N   T   E   R   V   A   L   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   v   a   l   u   e   )       >   >       2   )   ]       =       0   ;   
                   r   e   t   u   r   n       1   ;   
   
               c   a   s   e       1   2   3   4   8   :   
                   /   /       E   G   L   _   M   A   X   _   S   W   A   P   _   I   N   T   E   R   V   A   L   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   v   a   l   u   e   )       >   >       2   )   ]       =       1   ;   
                   r   e   t   u   r   n       1   ;   
   
               c   a   s   e       1   2   3   4   9   :   
               /   /       E   G   L   _   L   U   M   I   N   A   N   C   E   _   S   I   Z   E   
                   c   a   s   e       1   2   3   5   0   :   
                   /   /       E   G   L   _   A   L   P   H   A   _   M   A   S   K   _   S   I   Z   E   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   v   a   l   u   e   )       >   >       2   )   ]       =       0   ;   
                   r   e   t   u   r   n       1   ;   
   
               c   a   s   e       1   2   3   5   1   :   
                   /   /       E   G   L   _   C   O   L   O   R   _   B   U   F   F   E   R   _   T   Y   P   E   
                   /   /       E   G   L       h   a   s       t   w   o       t   y   p   e   s       o   f       b   u   f   f   e   r   s   :       E   G   L   _   R   G   B   _   B   U   F   F   E   R       a   n   d       E   G   L   _   L   U   M   I   N   A   N   C   E   _   B   U   F   F   E   R   .   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   v   a   l   u   e   )       >   >       2   )   ]       =       1   2   4   3   0   ;   
                   r   e   t   u   r   n       1   ;   
   
               c   a   s   e       1   2   3   5   2   :   
                   /   /       E   G   L   _   R   E   N   D   E   R   A   B   L   E   _   T   Y   P   E   
                   /   /       A       b   i   t       c   o   m   b   i   n   a   t   i   o   n       o   f       E   G   L   _   O   P   E   N   G   L   _   E   S   _   B   I   T   ,   E   G   L   _   O   P   E   N   V   G   _   B   I   T   ,   E   G   L   _   O   P   E   N   G   L   _   E   S   2   _   B   I   T       a   n   d       E   G   L   _   O   P   E   N   G   L   _   B   I   T   .   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   v   a   l   u   e   )       >   >       2   )   ]       =       4   ;   
                   r   e   t   u   r   n       1   ;   
   
               c   a   s   e       1   2   3   5   4   :   
                   /   /       E   G   L   _   C   O   N   F   O   R   M   A   N   T   
                   /   /       "   E   G   L   _   C   O   N   F   O   R   M   A   N   T       i   s       a       m   a   s   k       i   n   d   i   c   a   t   i   n   g       i   f       a       c   l   i   e   n   t       A   P   I       c   o   n   t   e   x   t       c   r   e   a   t   e   d       w   i   t   h       r   e   s   p   e   c   t       t   o       t   h   e       c   o   r   r   e   s   p   o   n   d   i   n   g       E   G   L   C   o   n   f   i   g       w   i   l   l       p   a   s   s       t   h   e       r   e   q   u   i   r   e   d       c   o   n   f   o   r   m   a   n   c   e       t   e   s   t   s       f   o   r       t   h   a   t       A   P   I   .   "   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   v   a   l   u   e   )       >   >       2   )   ]       =       0   ;   
                   r   e   t   u   r   n       1   ;   
   
               d   e   f   a   u   l   t   :   
                   E   G   L   .   s   e   t   E   r   r   o   r   C   o   d   e   (   1   2   2   9   2   )   ;   
                   r   e   t   u   r   n       0   ;   
           }   
   }   
   
   f   u   n   c   t   i   o   n       _   e   g   l   G   e   t   D   i   s   p   l   a   y   (   n   a   t   i   v   e   D   i   s   p   l   a   y   T   y   p   e   )       {   
           i   f       (   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   P   T   H   R   E   A   D   )       r   e   t   u   r   n       p   r   o   x   y   T   o   M   a   i   n   T   h   r   e   a   d   (   7   ,       0   ,       1   ,       n   a   t   i   v   e   D   i   s   p   l   a   y   T   y   p   e   )   ;   
           E   G   L   .   s   e   t   E   r   r   o   r   C   o   d   e   (   1   2   2   8   8   )   ;   
           /   /       E   m   s   c   r   i   p   t   e   n       E   G   L       i   m   p   l   e   m   e   n   t   a   t   i   o   n       "   e   m   u   l   a   t   e   s   "       X   1   1   ,       a   n   d       e   g   l   G   e   t   D   i   s   p   l   a   y       i   s   
           /   /       e   x   p   e   c   t   e   d       t   o       a   c   c   e   p   t   /   r   e   c   e   i   v   e       a       p   o   i   n   t   e   r       t   o       a   n       X   1   1       D   i   s   p   l   a   y       o   b   j   e   c   t       (   o   r   
           /   /       E   G   L   _   D   E   F   A   U   L   T   _   D   I   S   P   L   A   Y   )   .   
           i   f       (   n   a   t   i   v   e   D   i   s   p   l   a   y   T   y   p   e       !   =       0       &   &       n   a   t   i   v   e   D   i   s   p   l   a   y   T   y   p   e       !   =       1   )       {   
                   r   e   t   u   r   n       0   ;   
           }   
           r   e   t   u   r   n       6   2   e   3   ;   
   }   
   
   f   u   n   c   t   i   o   n       _   e   g   l   I   n   i   t   i   a   l   i   z   e   (   d   i   s   p   l   a   y   ,       m   a   j   o   r   V   e   r   s   i   o   n   ,       m   i   n   o   r   V   e   r   s   i   o   n   )       {   
           i   f       (   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   P   T   H   R   E   A   D   )       r   e   t   u   r   n       p   r   o   x   y   T   o   M   a   i   n   T   h   r   e   a   d   (   8   ,       0   ,       1   ,       d   i   s   p   l   a   y   ,       m   a   j   o   r   V   e   r   s   i   o   n   ,       m   i   n   o   r   V   e   r   s   i   o   n   )   ;   
           i   f       (   d   i   s   p   l   a   y       !   =       6   2   e   3   )       {   
                   E   G   L   .   s   e   t   E   r   r   o   r   C   o   d   e   (   1   2   2   9   6   )   ;   
                   r   e   t   u   r   n       0   ;   
           }   
           i   f       (   m   a   j   o   r   V   e   r   s   i   o   n   )       {   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   m   a   j   o   r   V   e   r   s   i   o   n   )       >   >       2   )   ]       =       1   ;   
           }   
           i   f       (   m   i   n   o   r   V   e   r   s   i   o   n   )       {   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   m   i   n   o   r   V   e   r   s   i   o   n   )       >   >       2   )   ]       =       4   ;   
           }   
           E   G   L   .   d   e   f   a   u   l   t   D   i   s   p   l   a   y   I   n   i   t   i   a   l   i   z   e   d       =       t   r   u   e   ;   
           E   G   L   .   s   e   t   E   r   r   o   r   C   o   d   e   (   1   2   2   8   8   )   ;   
           r   e   t   u   r   n       1   ;   
   }   
   
   f   u   n   c   t   i   o   n       _   e   g   l   M   a   k   e   C   u   r   r   e   n   t   (   d   i   s   p   l   a   y   ,       d   r   a   w   ,       r   e   a   d   ,       c   o   n   t   e   x   t   )       {   
           i   f       (   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   P   T   H   R   E   A   D   )       r   e   t   u   r   n       p   r   o   x   y   T   o   M   a   i   n   T   h   r   e   a   d   (   9   ,       0   ,       1   ,       d   i   s   p   l   a   y   ,       d   r   a   w   ,       r   e   a   d   ,       c   o   n   t   e   x   t   )   ;   
           i   f       (   d   i   s   p   l   a   y       !   =       6   2   e   3   )       {   
                   E   G   L   .   s   e   t   E   r   r   o   r   C   o   d   e   (   1   2   2   9   6   )   ;   
                   r   e   t   u   r   n       0   ;   
           }   
           /   /   \   t   o   d   o       A   n       E   G   L   _   N   O   T   _   I   N   I   T   I   A   L   I   Z   E   D       e   r   r   o   r       i   s       g   e   n   e   r   a   t   e   d       i   f       E   G   L       i   s       n   o   t       i   n   i   t   i   a   l   i   z   e   d       f   o   r       d   p   y   .   
           i   f       (   c   o   n   t   e   x   t       !   =       0       &   &       c   o   n   t   e   x   t       !   =       6   2   0   0   4   )       {   
                   E   G   L   .   s   e   t   E   r   r   o   r   C   o   d   e   (   1   2   2   9   4   )   ;   
                   r   e   t   u   r   n       0   ;   
           }   
           i   f       (   (   r   e   a   d       !   =       0       &   &       r   e   a   d       !   =       6   2   0   0   6   )       |   |       (   d   r   a   w       !   =       0       &   &       d   r   a   w       !   =       6   2   0   0   6   )   )       {   
                   E   G   L   .   s   e   t   E   r   r   o   r   C   o   d   e   (   1   2   3   0   1   )   ;   
                   r   e   t   u   r   n       0   ;   
           }   
           G   L   .   m   a   k   e   C   o   n   t   e   x   t   C   u   r   r   e   n   t   (   c   o   n   t   e   x   t       ?       E   G   L   .   c   o   n   t   e   x   t       :       n   u   l   l   )   ;   
           E   G   L   .   c   u   r   r   e   n   t   C   o   n   t   e   x   t       =       c   o   n   t   e   x   t   ;   
           E   G   L   .   c   u   r   r   e   n   t   D   r   a   w   S   u   r   f   a   c   e       =       d   r   a   w   ;   
           E   G   L   .   c   u   r   r   e   n   t   R   e   a   d   S   u   r   f   a   c   e       =       r   e   a   d   ;   
           E   G   L   .   s   e   t   E   r   r   o   r   C   o   d   e   (   1   2   2   8   8   )   ;   
           r   e   t   u   r   n       1   ;   
   }   
   
   f   u   n   c   t   i   o   n       _   e   g   l   S   w   a   p   B   u   f   f   e   r   s   (   d   p   y   ,       s   u   r   f   a   c   e   )       {   
           i   f       (   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   P   T   H   R   E   A   D   )       r   e   t   u   r   n       p   r   o   x   y   T   o   M   a   i   n   T   h   r   e   a   d   (   1   0   ,       0   ,       1   ,       d   p   y   ,       s   u   r   f   a   c   e   )   ;   
           i   f       (   !   E   G   L   .   d   e   f   a   u   l   t   D   i   s   p   l   a   y   I   n   i   t   i   a   l   i   z   e   d   )       {   
                   E   G   L   .   s   e   t   E   r   r   o   r   C   o   d   e   (   1   2   2   8   9   )   ;   
           }       e   l   s   e       i   f       (   !   G   L   c   t   x   )       {   
                   E   G   L   .   s   e   t   E   r   r   o   r   C   o   d   e   (   1   2   2   9   0   )   ;   
           }       e   l   s   e       i   f       (   G   L   c   t   x   .   i   s   C   o   n   t   e   x   t   L   o   s   t   (   )   )       {   
                   E   G   L   .   s   e   t   E   r   r   o   r   C   o   d   e   (   1   2   3   0   2   )   ;   
           }       e   l   s   e       {   
                   /   /       A   c   c   o   r   d   i   n   g       t   o       d   o   c   u   m   e   n   t   a   t   i   o   n       t   h   i   s       d   o   e   s       a   n       i   m   p   l   i   c   i   t       f   l   u   s   h   .   
                   /   /       D   u   e       t   o       d   i   s   c   u   s   s   i   o   n       a   t       h   t   t   p   s   :   /   /   g   i   t   h   u   b   .   c   o   m   /   e   m   s   c   r   i   p   t   e   n   -   c   o   r   e   /   e   m   s   c   r   i   p   t   e   n   /   p   u   l   l   /   1   8   7   1   
                   /   /       t   h   e       f   l   u   s   h       w   a   s       r   e   m   o   v   e   d       s   i   n   c   e       t   h   i   s       _   m   a   y   _       r   e   s   u   l   t       i   n       s   l   o   w   i   n   g       c   o   d   e       d   o   w   n   .   
                   /   /   _   g   l   F   l   u   s   h   (   )   ;   
                   E   G   L   .   s   e   t   E   r   r   o   r   C   o   d   e   (   1   2   2   8   8   )   ;   
                   r   e   t   u   r   n       1   ;   
           }   
           r   e   t   u   r   n       0   ;   
   }   
   
   v   a   r       r   e   a   d   E   m   A   s   m   A   r   g   s   A   r   r   a   y       =       [   ]   ;   
   
   v   a   r       r   e   a   d   E   m   A   s   m   A   r   g   s       =       (   s   i   g   P   t   r   ,       b   u   f   )       =   >       {   
           /   /       N   o   b   o   d   y       s   h   o   u   l   d       h   a   v   e       m   u   t   a   t   e   d       _   r   e   a   d   E   m   A   s   m   A   r   g   s   A   r   r   a   y       u   n   d   e   r   n   e   a   t   h       u   s       t   o       b   e       s   o   m   e   t   h   i   n   g       e   l   s   e       t   h   a   n       a   n       a   r   r   a   y   .   
           a   s   s   e   r   t   (   A   r   r   a   y   .   i   s   A   r   r   a   y   (   r   e   a   d   E   m   A   s   m   A   r   g   s   A   r   r   a   y   )   )   ;   
           /   /       T   h   e       i   n   p   u   t       b   u   f   f   e   r       i   s       a   l   l   o   c   a   t   e   d       o   n       t   h   e       s   t   a   c   k   ,       s   o       i   t       m   u   s   t       b   e       s   t   a   c   k   -   a   l   i   g   n   e   d   .   
           a   s   s   e   r   t   (   b   u   f       %       1   6       =   =       0   )   ;   
           r   e   a   d   E   m   A   s   m   A   r   g   s   A   r   r   a   y   .   l   e   n   g   t   h       =       0   ;   
           v   a   r       c   h   ;   
           /   /       M   o   s   t       a   r   g   u   m   e   n   t   s       a   r   e       i   3   2   s   ,       s   o       s   h   i   f   t       t   h   e       b   u   f   f   e   r       p   o   i   n   t   e   r       s   o       i   t       i   s       a       p   l   a   i   n   
           /   /       i   n   d   e   x       i   n   t   o       H   E   A   P   3   2   .   
           w   h   i   l   e       (   c   h       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   8   )   [   s   i   g   P   t   r   +   +   ]   )       {   
                   v   a   r       c   h   r       =       S   t   r   i   n   g   .   f   r   o   m   C   h   a   r   C   o   d   e   (   c   h   )   ;   
                   v   a   r       v   a   l   i   d   C   h   a   r   s       =       [       "   d   "   ,       "   f   "   ,       "   i   "   ,       "   p   "       ]   ;   
                   /   /       I   n       W   A   S   M   _   B   I   G   I   N   T       m   o   d   e       w   e       s   u   p   p   o   r   t       p   a   s   s   i   n   g       i   6   4       v   a   l   u   e   s       a   s       b   i   g   i   n   t   .   
                   v   a   l   i   d   C   h   a   r   s   .   p   u   s   h   (   "   j   "   )   ;   
                   a   s   s   e   r   t   (   v   a   l   i   d   C   h   a   r   s   .   i   n   c   l   u   d   e   s   (   c   h   r   )   ,       `   I   n   v   a   l   i   d       c   h   a   r   a   c   t   e   r       $   {   c   h   }   (   "   $   {   c   h   r   }   "   )       i   n       r   e   a   d   E   m   A   s   m   A   r   g   s   !       U   s   e       o   n   l   y       [   $   {   v   a   l   i   d   C   h   a   r   s   }   ]   ,       a   n   d       d   o       n   o   t       s   p   e   c   i   f   y       "   v   "       f   o   r       v   o   i   d       r   e   t   u   r   n       a   r   g   u   m   e   n   t   .   `   )   ;   
                   /   /       F   l   o   a   t   s       a   r   e       a   l   w   a   y   s       p   a   s   s   e   d       a   s       d   o   u   b   l   e   s   ,       s   o       a   l   l       t   y   p   e   s       e   x   c   e   p   t       f   o   r       '   i   '   
                   /   /       a   r   e       8       b   y   t   e   s       a   n   d       r   e   q   u   i   r   e       a   l   i   g   n   m   e   n   t   .   
                   v   a   r       w   i   d   e       =       (   c   h       !   =       1   0   5   )   ;   
                   w   i   d   e       &   =       (   c   h       !   =       1   1   2   )   ;   
                   b   u   f       +   =       w   i   d   e       &   &       (   b   u   f       %       8   )       ?       4       :       0   ;   
                   r   e   a   d   E   m   A   s   m   A   r   g   s   A   r   r   a   y   .   p   u   s   h   (   /   /       S   p   e   c   i   a   l       c   a   s   e       f   o   r       p   o   i   n   t   e   r   s       u   n   d   e   r       w   a   s   m   6   4       o   r       C   A   N   _   A   D   D   R   E   S   S   _   2   G   B       m   o   d   e   .   
                   c   h       =   =       1   1   2       ?       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   b   u   f   )       >   >       2   )   ]       :       c   h       =   =       1   0   6       ?       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       
                   H   E   A   P   6   4   )   [   (   (   b   u   f   )       >   >       3   )   ]       :       c   h       =   =       1   0   5       ?       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   b   u   f   )       >   >       2   )   ]       :       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       
                   H   E   A   P   F   6   4   )   [   (   (   b   u   f   )       >   >       3   )   ]   )   ;   
                   b   u   f       +   =       w   i   d   e       ?       8       :       4   ;   
           }   
           r   e   t   u   r   n       r   e   a   d   E   m   A   s   m   A   r   g   s   A   r   r   a   y   ;   
   }   ;   
   
   v   a   r       r   u   n   E   m   A   s   m   F   u   n   c   t   i   o   n       =       (   c   o   d   e   ,       s   i   g   P   t   r   ,       a   r   g   b   u   f   )       =   >       {   
           v   a   r       a   r   g   s       =       r   e   a   d   E   m   A   s   m   A   r   g   s   (   s   i   g   P   t   r   ,       a   r   g   b   u   f   )   ;   
           a   s   s   e   r   t   (   A   S   M   _   C   O   N   S   T   S   .   h   a   s   O   w   n   P   r   o   p   e   r   t   y   (   c   o   d   e   )   ,       `   N   o       E   M   _   A   S   M       c   o   n   s   t   a   n   t       f   o   u   n   d       a   t       a   d   d   r   e   s   s       $   {   c   o   d   e   }   .           T   h   e       l   o   a   d   e   d       W   e   b   A   s   s   e   m   b   l   y       f   i   l   e       i   s       l   i   k   e   l   y       o   u   t       o   f       s   y   n   c       w   i   t   h       t   h   e       g   e   n   e   r   a   t   e   d       J   a   v   a   S   c   r   i   p   t   .   `   )   ;   
           r   e   t   u   r   n       A   S   M   _   C   O   N   S   T   S   [   c   o   d   e   ]   (   .   .   .   a   r   g   s   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   a   s   m   _   c   o   n   s   t   _   i   n   t       =       (   c   o   d   e   ,       s   i   g   P   t   r   ,       a   r   g   b   u   f   )       =   >       r   u   n   E   m   A   s   m   F   u   n   c   t   i   o   n   (   c   o   d   e   ,       s   i   g   P   t   r   ,       a   r   g   b   u   f   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   a   s   m   _   c   o   n   s   t   _   p   t   r       =       (   c   o   d   e   ,       s   i   g   P   t   r   ,       a   r   g   b   u   f   )       =   >       r   u   n   E   m   A   s   m   F   u   n   c   t   i   o   n   (   c   o   d   e   ,       s   i   g   P   t   r   ,       a   r   g   b   u   f   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   c   h   e   c   k   _   b   l   o   c   k   i   n   g   _   a   l   l   o   w   e   d       =       (   )       =   >       {   
           i   f       (   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   W   O   R   K   E   R   )       r   e   t   u   r   n   ;   
           /   /       B   l   o   c   k   i   n   g       i   n       a       w   o   r   k   e   r   /   p   t   h   r   e   a   d       i   s       f   i   n   e   .   
           w   a   r   n   O   n   c   e   (   "   B   l   o   c   k   i   n   g       o   n       t   h   e       m   a   i   n       t   h   r   e   a   d       i   s       v   e   r   y       d   a   n   g   e   r   o   u   s   ,       s   e   e       h   t   t   p   s   :   /   /   e   m   s   c   r   i   p   t   e   n   .   o   r   g   /   d   o   c   s   /   p   o   r   t   i   n   g   /   p   t   h   r   e   a   d   s   .   h   t   m   l   #   b   l   o   c   k   i   n   g   -   o   n   -   t   h   e   -   m   a   i   n   -   b   r   o   w   s   e   r   -   t   h   r   e   a   d   "   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   e   r   r       =       s   t   r       =   >       e   r   r   (   U   T   F   8   T   o   S   t   r   i   n   g   (   s   t   r   )   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   e   x   i   t   _   w   i   t   h   _   l   i   v   e   _   r   u   n   t   i   m   e       =       (   )       =   >       {   
           r   u   n   t   i   m   e   K   e   e   p   a   l   i   v   e   P   u   s   h   (   )   ;   
           t   h   r   o   w       "   u   n   w   i   n   d   "   ;   
   }   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   A   c   t   i   v   e   T   e   x   t   u   r   e       =       x   0       =   >       G   L   c   t   x   .   a   c   t   i   v   e   T   e   x   t   u   r   e   (   x   0   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   A   c   t   i   v   e   T   e   x   t   u   r   e       =       _   g   l   A   c   t   i   v   e   T   e   x   t   u   r   e   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   A   t   t   a   c   h   S   h   a   d   e   r       =       (   p   r   o   g   r   a   m   ,       s   h   a   d   e   r   )       =   >       {   
           G   L   c   t   x   .   a   t   t   a   c   h   S   h   a   d   e   r   (   G   L   .   p   r   o   g   r   a   m   s   [   p   r   o   g   r   a   m   ]   ,       G   L   .   s   h   a   d   e   r   s   [   s   h   a   d   e   r   ]   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   A   t   t   a   c   h   S   h   a   d   e   r       =       _   g   l   A   t   t   a   c   h   S   h   a   d   e   r   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   B   e   g   i   n   Q   u   e   r   y       =       (   t   a   r   g   e   t   ,       i   d   )       =   >       {   
           G   L   c   t   x   .   b   e   g   i   n   Q   u   e   r   y   (   t   a   r   g   e   t   ,       G   L   .   q   u   e   r   i   e   s   [   i   d   ]   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   e   g   i   n   Q   u   e   r   y       =       _   g   l   B   e   g   i   n   Q   u   e   r   y   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   B   e   g   i   n   Q   u   e   r   y   E   X   T       =       (   t   a   r   g   e   t   ,       i   d   )       =   >       {   
           G   L   c   t   x   .   d   i   s   j   o   i   n   t   T   i   m   e   r   Q   u   e   r   y   E   x   t   [   "   b   e   g   i   n   Q   u   e   r   y   E   X   T   "   ]   (   t   a   r   g   e   t   ,       G   L   .   q   u   e   r   i   e   s   [   i   d   ]   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   e   g   i   n   Q   u   e   r   y   E   X   T       =       _   g   l   B   e   g   i   n   Q   u   e   r   y   E   X   T   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   B   e   g   i   n   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k       =       x   0       =   >       G   L   c   t   x   .   b   e   g   i   n   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   (   x   0   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   e   g   i   n   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k       =       _   g   l   B   e   g   i   n   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   B   i   n   d   A   t   t   r   i   b   L   o   c   a   t   i   o   n       =       (   p   r   o   g   r   a   m   ,       i   n   d   e   x   ,       n   a   m   e   )       =   >       {   
           G   L   c   t   x   .   b   i   n   d   A   t   t   r   i   b   L   o   c   a   t   i   o   n   (   G   L   .   p   r   o   g   r   a   m   s   [   p   r   o   g   r   a   m   ]   ,       i   n   d   e   x   ,       U   T   F   8   T   o   S   t   r   i   n   g   (   n   a   m   e   )   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   i   n   d   A   t   t   r   i   b   L   o   c   a   t   i   o   n       =       _   g   l   B   i   n   d   A   t   t   r   i   b   L   o   c   a   t   i   o   n   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   B   i   n   d   B   u   f   f   e   r       =       (   t   a   r   g   e   t   ,       b   u   f   f   e   r   )       =   >       {   
           /   /       C   a   l   l   i   n   g       g   l   B   i   n   d   B   u   f   f   e   r       w   i   t   h       a   n       u   n   k   n   o   w   n       b   u   f   f   e   r       w   i   l   l       i   m   p   l   i   c   i   t   l   y       c   r   e   a   t   e       a   
           /   /       n   e   w       o   n   e   .           H   e   r   e       w   e       b   y   p   a   s   s       `   G   L   .   c   o   u   n   t   e   r   `       a   n   d       d   i   r   e   c   t   l   y       u   s   i   n   g       t   h   e       I   D       p   a   s   s   e   d   
           /   /       i   n   .   
           i   f       (   b   u   f   f   e   r       &   &       !   G   L   .   b   u   f   f   e   r   s   [   b   u   f   f   e   r   ]   )       {   
                   v   a   r       b       =       G   L   c   t   x   .   c   r   e   a   t   e   B   u   f   f   e   r   (   )   ;   
                   b   .   n   a   m   e       =       b   u   f   f   e   r   ;   
                   G   L   .   b   u   f   f   e   r   s   [   b   u   f   f   e   r   ]       =       b   ;   
           }   
           i   f       (   t   a   r   g   e   t       =   =       3   4   9   6   2   )       {   
                   G   L   c   t   x   .   c   u   r   r   e   n   t   A   r   r   a   y   B   u   f   f   e   r   B   i   n   d   i   n   g       =       b   u   f   f   e   r   ;   
           }       e   l   s   e       i   f       (   t   a   r   g   e   t       =   =       3   4   9   6   3   )       {   
                   G   L   c   t   x   .   c   u   r   r   e   n   t   E   l   e   m   e   n   t   A   r   r   a   y   B   u   f   f   e   r   B   i   n   d   i   n   g       =       b   u   f   f   e   r   ;   
           }   
           i   f       (   t   a   r   g   e   t       =   =       3   5   0   5   1   )       {   
                   /   /       I   n       W   e   b   G   L       2       g   l   R   e   a   d   P   i   x   e   l   s       e   n   t   r   y       p   o   i   n   t   ,       w   e       n   e   e   d       t   o       u   s   e       a       d   i   f   f   e   r   e   n   t       W   e   b   G   L       2   
                   /   /       A   P   I       f   u   n   c   t   i   o   n       c   a   l   l       w   h   e   n       a       b   u   f   f   e   r       i   s       b   o   u   n   d       t   o   
                   /   /       G   L   _   P   I   X   E   L   _   P   A   C   K   _   B   U   F   F   E   R   _   B   I   N   D   I   N   G       p   o   i   n   t   ,       s   o       m   u   s   t       k   e   e   p       t   r   a   c   k       w   h   e   t   h   e   r       t   h   a   t   
                   /   /       b   i   n   d   i   n   g       p   o   i   n   t       i   s       n   o   n   -   n   u   l   l       t   o       k   n   o   w       w   h   a   t       i   s       t   h   e       p   r   o   p   e   r       A   P   I       f   u   n   c   t   i   o   n       t   o   
                   /   /       c   a   l   l   .   
                   G   L   c   t   x   .   c   u   r   r   e   n   t   P   i   x   e   l   P   a   c   k   B   u   f   f   e   r   B   i   n   d   i   n   g       =       b   u   f   f   e   r   ;   
           }       e   l   s   e       i   f       (   t   a   r   g   e   t       =   =       3   5   0   5   2   )       {   
                   /   /       I   n       W   e   b   G   L       2       g   l   (   C   o   m   p   r   e   s   s   e   d   )   T   e   x   (   S   u   b   )   I   m   a   g   e   [   2   3   ]   D       e   n   t   r   y       p   o   i   n   t   s   ,       w   e       n   e   e   d       t   o   
                   /   /       u   s   e       a       d   i   f   f   e   r   e   n   t       W   e   b   G   L       2       A   P   I       f   u   n   c   t   i   o   n       c   a   l   l       w   h   e   n       a       b   u   f   f   e   r       i   s       b   o   u   n   d       t   o   
                   /   /       G   L   _   P   I   X   E   L   _   U   N   P   A   C   K   _   B   U   F   F   E   R   _   B   I   N   D   I   N   G       p   o   i   n   t   ,       s   o       m   u   s   t       k   e   e   p       t   r   a   c   k       w   h   e   t   h   e   r       t   h   a   t   
                   /   /       b   i   n   d   i   n   g       p   o   i   n   t       i   s       n   o   n   -   n   u   l   l       t   o       k   n   o   w       w   h   a   t       i   s       t   h   e       p   r   o   p   e   r       A   P   I       f   u   n   c   t   i   o   n       t   o   
                   /   /       c   a   l   l   .   
                   G   L   c   t   x   .   c   u   r   r   e   n   t   P   i   x   e   l   U   n   p   a   c   k   B   u   f   f   e   r   B   i   n   d   i   n   g       =       b   u   f   f   e   r   ;   
           }   
           G   L   c   t   x   .   b   i   n   d   B   u   f   f   e   r   (   t   a   r   g   e   t   ,       G   L   .   b   u   f   f   e   r   s   [   b   u   f   f   e   r   ]   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   i   n   d   B   u   f   f   e   r       =       _   g   l   B   i   n   d   B   u   f   f   e   r   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   B   i   n   d   B   u   f   f   e   r   B   a   s   e       =       (   t   a   r   g   e   t   ,       i   n   d   e   x   ,       b   u   f   f   e   r   )       =   >       {   
           G   L   c   t   x   .   b   i   n   d   B   u   f   f   e   r   B   a   s   e   (   t   a   r   g   e   t   ,       i   n   d   e   x   ,       G   L   .   b   u   f   f   e   r   s   [   b   u   f   f   e   r   ]   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   i   n   d   B   u   f   f   e   r   B   a   s   e       =       _   g   l   B   i   n   d   B   u   f   f   e   r   B   a   s   e   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   B   i   n   d   B   u   f   f   e   r   R   a   n   g   e       =       (   t   a   r   g   e   t   ,       i   n   d   e   x   ,       b   u   f   f   e   r   ,       o   f   f   s   e   t   ,       p   t   r   s   i   z   e   )       =   >       {   
           G   L   c   t   x   .   b   i   n   d   B   u   f   f   e   r   R   a   n   g   e   (   t   a   r   g   e   t   ,       i   n   d   e   x   ,       G   L   .   b   u   f   f   e   r   s   [   b   u   f   f   e   r   ]   ,       o   f   f   s   e   t   ,       p   t   r   s   i   z   e   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   i   n   d   B   u   f   f   e   r   R   a   n   g   e       =       _   g   l   B   i   n   d   B   u   f   f   e   r   R   a   n   g   e   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   B   i   n   d   F   r   a   m   e   b   u   f   f   e   r       =       (   t   a   r   g   e   t   ,       f   r   a   m   e   b   u   f   f   e   r   )       =   >       {   
           G   L   c   t   x   .   b   i   n   d   F   r   a   m   e   b   u   f   f   e   r   (   t   a   r   g   e   t   ,       G   L   .   f   r   a   m   e   b   u   f   f   e   r   s   [   f   r   a   m   e   b   u   f   f   e   r   ]   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   i   n   d   F   r   a   m   e   b   u   f   f   e   r       =       _   g   l   B   i   n   d   F   r   a   m   e   b   u   f   f   e   r   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   B   i   n   d   R   e   n   d   e   r   b   u   f   f   e   r       =       (   t   a   r   g   e   t   ,       r   e   n   d   e   r   b   u   f   f   e   r   )       =   >       {   
           G   L   c   t   x   .   b   i   n   d   R   e   n   d   e   r   b   u   f   f   e   r   (   t   a   r   g   e   t   ,       G   L   .   r   e   n   d   e   r   b   u   f   f   e   r   s   [   r   e   n   d   e   r   b   u   f   f   e   r   ]   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   i   n   d   R   e   n   d   e   r   b   u   f   f   e   r       =       _   g   l   B   i   n   d   R   e   n   d   e   r   b   u   f   f   e   r   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   B   i   n   d   S   a   m   p   l   e   r       =       (   u   n   i   t   ,       s   a   m   p   l   e   r   )       =   >       {   
           G   L   c   t   x   .   b   i   n   d   S   a   m   p   l   e   r   (   u   n   i   t   ,       G   L   .   s   a   m   p   l   e   r   s   [   s   a   m   p   l   e   r   ]   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   i   n   d   S   a   m   p   l   e   r       =       _   g   l   B   i   n   d   S   a   m   p   l   e   r   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   B   i   n   d   T   e   x   t   u   r   e       =       (   t   a   r   g   e   t   ,       t   e   x   t   u   r   e   )       =   >       {   
           G   L   c   t   x   .   b   i   n   d   T   e   x   t   u   r   e   (   t   a   r   g   e   t   ,       G   L   .   t   e   x   t   u   r   e   s   [   t   e   x   t   u   r   e   ]   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   i   n   d   T   e   x   t   u   r   e       =       _   g   l   B   i   n   d   T   e   x   t   u   r   e   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   B   i   n   d   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k       =       (   t   a   r   g   e   t   ,       i   d   )       =   >       {   
           G   L   c   t   x   .   b   i   n   d   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   (   t   a   r   g   e   t   ,       G   L   .   t   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   s   [   i   d   ]   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   i   n   d   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k       =       _   g   l   B   i   n   d   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   B   i   n   d   V   e   r   t   e   x   A   r   r   a   y       =       v   a   o       =   >       {   
           G   L   c   t   x   .   b   i   n   d   V   e   r   t   e   x   A   r   r   a   y   (   G   L   .   v   a   o   s   [   v   a   o   ]   )   ;   
           v   a   r       i   b   o       =       G   L   c   t   x   .   g   e   t   P   a   r   a   m   e   t   e   r   (   3   4   9   6   5   )   ;   
           G   L   c   t   x   .   c   u   r   r   e   n   t   E   l   e   m   e   n   t   A   r   r   a   y   B   u   f   f   e   r   B   i   n   d   i   n   g       =       i   b   o       ?       (   i   b   o   .   n   a   m   e       |       0   )       :       0   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   i   n   d   V   e   r   t   e   x   A   r   r   a   y       =       _   g   l   B   i   n   d   V   e   r   t   e   x   A   r   r   a   y   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   B   i   n   d   V   e   r   t   e   x   A   r   r   a   y   O   E   S       =       _   g   l   B   i   n   d   V   e   r   t   e   x   A   r   r   a   y   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   i   n   d   V   e   r   t   e   x   A   r   r   a   y   O   E   S       =       _   g   l   B   i   n   d   V   e   r   t   e   x   A   r   r   a   y   O   E   S   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   B   l   e   n   d   C   o   l   o   r       =       (   x   0   ,       x   1   ,       x   2   ,       x   3   )       =   >       G   L   c   t   x   .   b   l   e   n   d   C   o   l   o   r   (   x   0   ,       x   1   ,       x   2   ,       x   3   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   l   e   n   d   C   o   l   o   r       =       _   g   l   B   l   e   n   d   C   o   l   o   r   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   B   l   e   n   d   E   q   u   a   t   i   o   n       =       x   0       =   >       G   L   c   t   x   .   b   l   e   n   d   E   q   u   a   t   i   o   n   (   x   0   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   l   e   n   d   E   q   u   a   t   i   o   n       =       _   g   l   B   l   e   n   d   E   q   u   a   t   i   o   n   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   B   l   e   n   d   E   q   u   a   t   i   o   n   S   e   p   a   r   a   t   e       =       (   x   0   ,       x   1   )       =   >       G   L   c   t   x   .   b   l   e   n   d   E   q   u   a   t   i   o   n   S   e   p   a   r   a   t   e   (   x   0   ,       x   1   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   l   e   n   d   E   q   u   a   t   i   o   n   S   e   p   a   r   a   t   e       =       _   g   l   B   l   e   n   d   E   q   u   a   t   i   o   n   S   e   p   a   r   a   t   e   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   B   l   e   n   d   F   u   n   c       =       (   x   0   ,       x   1   )       =   >       G   L   c   t   x   .   b   l   e   n   d   F   u   n   c   (   x   0   ,       x   1   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   l   e   n   d   F   u   n   c       =       _   g   l   B   l   e   n   d   F   u   n   c   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   B   l   e   n   d   F   u   n   c   S   e   p   a   r   a   t   e       =       (   x   0   ,       x   1   ,       x   2   ,       x   3   )       =   >       G   L   c   t   x   .   b   l   e   n   d   F   u   n   c   S   e   p   a   r   a   t   e   (   x   0   ,       x   1   ,       x   2   ,       x   3   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   l   e   n   d   F   u   n   c   S   e   p   a   r   a   t   e       =       _   g   l   B   l   e   n   d   F   u   n   c   S   e   p   a   r   a   t   e   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   B   l   i   t   F   r   a   m   e   b   u   f   f   e   r       =       (   x   0   ,       x   1   ,       x   2   ,       x   3   ,       x   4   ,       x   5   ,       x   6   ,       x   7   ,       x   8   ,       x   9   )       =   >       G   L   c   t   x   .   b   l   i   t   F   r   a   m   e   b   u   f   f   e   r   (   x   0   ,       x   1   ,       x   2   ,       x   3   ,       x   4   ,       x   5   ,       x   6   ,       x   7   ,       x   8   ,       x   9   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   l   i   t   F   r   a   m   e   b   u   f   f   e   r       =       _   g   l   B   l   i   t   F   r   a   m   e   b   u   f   f   e   r   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   B   u   f   f   e   r   D   a   t   a       =       (   t   a   r   g   e   t   ,       s   i   z   e   ,       d   a   t   a   ,       u   s   a   g   e   )       =   >       {   
           i   f       (   t   r   u   e   )       {   
                   /   /       I   f       s   i   z   e       i   s       z   e   r   o   ,       W   e   b   G   L       w   o   u   l   d       i   n   t   e   r   p   r   e   t       u   p   l   o   a   d   i   n   g       t   h   e       w   h   o   l   e       i   n   p   u   t   
                   /   /       a   r   r   a   y   b   u   f   f   e   r       (   s   t   a   r   t   i   n   g       f   r   o   m       g   i   v   e   n       o   f   f   s   e   t   )   ,       w   h   i   c   h       w   o   u   l   d       n   o   t       m   a   k   e       s   e   n   s   e       i   n   
                   /   /       W   e   b   A   s   s   e   m   b   l   y   ,       s   o       a   v   o   i   d       u   p   l   o   a   d   i   n   g       i   f       s   i   z   e       i   s       z   e   r   o   .       H   o   w   e   v   e   r       w   e       m   u   s   t       s   t   i   l   l   
                   /   /       c   a   l   l       b   u   f   f   e   r   D   a   t   a       t   o       e   s   t   a   b   l   i   s   h       a       b   a   c   k   i   n   g       s   t   o   r   a   g   e       o   f       z   e   r   o       b   y   t   e   s   .   
                   i   f       (   d   a   t   a       &   &       s   i   z   e   )       {   
                           G   L   c   t   x   .   b   u   f   f   e   r   D   a   t   a   (   t   a   r   g   e   t   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   8   )   ,       u   s   a   g   e   ,       d   a   t   a   ,       s   i   z   e   )   ;   
                   }       e   l   s   e       {   
                           G   L   c   t   x   .   b   u   f   f   e   r   D   a   t   a   (   t   a   r   g   e   t   ,       s   i   z   e   ,       u   s   a   g   e   )   ;   
                   }   
                   r   e   t   u   r   n   ;   
           }   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   u   f   f   e   r   D   a   t   a       =       _   g   l   B   u   f   f   e   r   D   a   t   a   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   B   u   f   f   e   r   S   u   b   D   a   t   a       =       (   t   a   r   g   e   t   ,       o   f   f   s   e   t   ,       s   i   z   e   ,       d   a   t   a   )       =   >       {   
           i   f       (   t   r   u   e   )       {   
                   s   i   z   e       &   &       G   L   c   t   x   .   b   u   f   f   e   r   S   u   b   D   a   t   a   (   t   a   r   g   e   t   ,       o   f   f   s   e   t   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   8   )   ,       d   a   t   a   ,       s   i   z   e   )   ;   
                   r   e   t   u   r   n   ;   
           }   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   u   f   f   e   r   S   u   b   D   a   t   a       =       _   g   l   B   u   f   f   e   r   S   u   b   D   a   t   a   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   C   h   e   c   k   F   r   a   m   e   b   u   f   f   e   r   S   t   a   t   u   s       =       x   0       =   >       G   L   c   t   x   .   c   h   e   c   k   F   r   a   m   e   b   u   f   f   e   r   S   t   a   t   u   s   (   x   0   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   h   e   c   k   F   r   a   m   e   b   u   f   f   e   r   S   t   a   t   u   s       =       _   g   l   C   h   e   c   k   F   r   a   m   e   b   u   f   f   e   r   S   t   a   t   u   s   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   C   l   e   a   r       =       x   0       =   >       G   L   c   t   x   .   c   l   e   a   r   (   x   0   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   l   e   a   r       =       _   g   l   C   l   e   a   r   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   C   l   e   a   r   B   u   f   f   e   r   f   i       =       (   x   0   ,       x   1   ,       x   2   ,       x   3   )       =   >       G   L   c   t   x   .   c   l   e   a   r   B   u   f   f   e   r   f   i   (   x   0   ,       x   1   ,       x   2   ,       x   3   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   l   e   a   r   B   u   f   f   e   r   f   i       =       _   g   l   C   l   e   a   r   B   u   f   f   e   r   f   i   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   C   l   e   a   r   B   u   f   f   e   r   f   v       =       (   b   u   f   f   e   r   ,       d   r   a   w   b   u   f   f   e   r   ,       v   a   l   u   e   )       =   >       {   
           G   L   c   t   x   .   c   l   e   a   r   B   u   f   f   e   r   f   v   (   b   u   f   f   e   r   ,       d   r   a   w   b   u   f   f   e   r   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   F   3   2   )   ,       (   (   v   a   l   u   e   )       >   >       2   )   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   l   e   a   r   B   u   f   f   e   r   f   v       =       _   g   l   C   l   e   a   r   B   u   f   f   e   r   f   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   C   l   e   a   r   B   u   f   f   e   r   i   v       =       (   b   u   f   f   e   r   ,       d   r   a   w   b   u   f   f   e   r   ,       v   a   l   u   e   )       =   >       {   
           G   L   c   t   x   .   c   l   e   a   r   B   u   f   f   e   r   i   v   (   b   u   f   f   e   r   ,       d   r   a   w   b   u   f   f   e   r   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   ,       (   (   v   a   l   u   e   )       >   >       2   )   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   l   e   a   r   B   u   f   f   e   r   i   v       =       _   g   l   C   l   e   a   r   B   u   f   f   e   r   i   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   C   l   e   a   r   B   u   f   f   e   r   u   i   v       =       (   b   u   f   f   e   r   ,       d   r   a   w   b   u   f   f   e   r   ,       v   a   l   u   e   )       =   >       {   
           G   L   c   t   x   .   c   l   e   a   r   B   u   f   f   e   r   u   i   v   (   b   u   f   f   e   r   ,       d   r   a   w   b   u   f   f   e   r   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   ,       (   (   v   a   l   u   e   )       >   >       2   )   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   l   e   a   r   B   u   f   f   e   r   u   i   v       =       _   g   l   C   l   e   a   r   B   u   f   f   e   r   u   i   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   C   l   e   a   r   C   o   l   o   r       =       (   x   0   ,       x   1   ,       x   2   ,       x   3   )       =   >       G   L   c   t   x   .   c   l   e   a   r   C   o   l   o   r   (   x   0   ,       x   1   ,       x   2   ,       x   3   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   l   e   a   r   C   o   l   o   r       =       _   g   l   C   l   e   a   r   C   o   l   o   r   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   C   l   e   a   r   D   e   p   t   h   f       =       x   0       =   >       G   L   c   t   x   .   c   l   e   a   r   D   e   p   t   h   (   x   0   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   l   e   a   r   D   e   p   t   h   f       =       _   g   l   C   l   e   a   r   D   e   p   t   h   f   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   C   l   e   a   r   S   t   e   n   c   i   l       =       x   0       =   >       G   L   c   t   x   .   c   l   e   a   r   S   t   e   n   c   i   l   (   x   0   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   l   e   a   r   S   t   e   n   c   i   l       =       _   g   l   C   l   e   a   r   S   t   e   n   c   i   l   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   C   l   i   e   n   t   W   a   i   t   S   y   n   c       =       (   s   y   n   c   ,       f   l   a   g   s   ,       t   i   m   e   o   u   t   )       =   >       {   
           /   /       W   e   b   G   L   2       v   s       G   L   E   S   3       d   i   f   f   e   r   e   n   c   e   s   :       i   n       G   L   E   S   3   ,       t   h   e       t   i   m   e   o   u   t       p   a   r   a   m   e   t   e   r       i   s       a       u   i   n   t   6   4   ,       w   h   e   r   e       0   x   F   F   F   F   F   F   F   F   F   F   F   F   F   F   F   F   U   L   L       m   e   a   n   s       G   L   _   T   I   M   E   O   U   T   _   I   G   N   O   R   E   D   .   
           /   /       I   n       J   S   ,       t   h   e   r   e   '   s       n   o       6   4   -   b   i   t       v   a   l   u   e       t   y   p   e   s   ,       s   o       i   n   s   t   e   a   d       t   i   m   e   o   u   t       i   s       t   a   k   e   n       t   o       b   e       s   i   g   n   e   d   ,       a   n   d       G   L   _   T   I   M   E   O   U   T   _   I   G   N   O   R   E   D       i   s       g   i   v   e   n       v   a   l   u   e       -   1   .   
           /   /       I   n   h   e   r   e   n   t   l   y       t   h   e       v   a   l   u   e       a   c   c   e   p   t   e   d       i   n       t   h   e       t   i   m   e   o   u   t       i   s       l   o   s   s   y   ,       a   n   d       c   a   n   '   t       t   a   k   e       i   n       a   r   b   i   t   r   a   r   y       u   6   4       b   i   t       p   a   t   t   e   r   n       (   b   u   t       m   o   s   t       l   i   k   e   l   y       d   o   e   s   n   '   t       m   a   t   t   e   r   )   
           /   /       S   e   e       h   t   t   p   s   :   /   /   w   w   w   .   k   h   r   o   n   o   s   .   o   r   g   /   r   e   g   i   s   t   r   y   /   w   e   b   g   l   /   s   p   e   c   s   /   l   a   t   e   s   t   /   2   .   0   /   #   5   .   1   5   
           t   i   m   e   o   u   t       =       N   u   m   b   e   r   (   t   i   m   e   o   u   t   )   ;   
           r   e   t   u   r   n       G   L   c   t   x   .   c   l   i   e   n   t   W   a   i   t   S   y   n   c   (   G   L   .   s   y   n   c   s   [   s   y   n   c   ]   ,       f   l   a   g   s   ,       t   i   m   e   o   u   t   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   l   i   e   n   t   W   a   i   t   S   y   n   c       =       _   g   l   C   l   i   e   n   t   W   a   i   t   S   y   n   c   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   C   l   i   p   C   o   n   t   r   o   l   E   X   T       =       (   o   r   i   g   i   n   ,       d   e   p   t   h   )       =   >       {   
           G   L   c   t   x   .   e   x   t   C   l   i   p   C   o   n   t   r   o   l   [   "   c   l   i   p   C   o   n   t   r   o   l   E   X   T   "   ]   (   o   r   i   g   i   n   ,       d   e   p   t   h   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   l   i   p   C   o   n   t   r   o   l   E   X   T       =       _   g   l   C   l   i   p   C   o   n   t   r   o   l   E   X   T   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   C   o   l   o   r   M   a   s   k       =       (   r   e   d   ,       g   r   e   e   n   ,       b   l   u   e   ,       a   l   p   h   a   )       =   >       {   
           G   L   c   t   x   .   c   o   l   o   r   M   a   s   k   (   !   !   r   e   d   ,       !   !   g   r   e   e   n   ,       !   !   b   l   u   e   ,       !   !   a   l   p   h   a   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   o   l   o   r   M   a   s   k       =       _   g   l   C   o   l   o   r   M   a   s   k   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   C   o   m   p   i   l   e   S   h   a   d   e   r       =       s   h   a   d   e   r       =   >       {   
           G   L   c   t   x   .   c   o   m   p   i   l   e   S   h   a   d   e   r   (   G   L   .   s   h   a   d   e   r   s   [   s   h   a   d   e   r   ]   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   o   m   p   i   l   e   S   h   a   d   e   r       =       _   g   l   C   o   m   p   i   l   e   S   h   a   d   e   r   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   C   o   m   p   r   e   s   s   e   d   T   e   x   I   m   a   g   e   2   D       =       (   t   a   r   g   e   t   ,       l   e   v   e   l   ,       i   n   t   e   r   n   a   l   F   o   r   m   a   t   ,       w   i   d   t   h   ,       h   e   i   g   h   t   ,       b   o   r   d   e   r   ,       i   m   a   g   e   S   i   z   e   ,       d   a   t   a   )       =   >       {   
           /   /       `   d   a   t   a   `       m   a   y       b   e       n   u   l   l       h   e   r   e   ,       w   h   i   c   h       m   e   a   n   s       "   a   l   l   o   c   a   t   e       u   n   i   n   i   i   t   a   l   i   z   e   d       s   p   a   c   e       b   u   t   
           /   /       d   o   n   '   t       u   p   l   o   a   d   "       i   n       G   L   E   S       p   a   r   l   a   n   c   e   ,       b   u   t       `   c   o   m   p   r   e   s   s   e   d   T   e   x   I   m   a   g   e   2   D   `       r   e   q   u   i   r   e   s       t   h   e   
           /   /       f   i   n   a   l       d   a   t   a       p   a   r   a   m   e   t   e   r   ,       s   o       w   e       s   i   m   p   l   y       p   a   s   s       a       h   e   a   p       v   i   e   w       s   t   a   r   t   i   n   g       a   t       z   e   r   o   
           /   /       e   f   f   e   c   t   i   v   e   l   y       u   p   l   o   a   d   i   n   g       w   h   a   t   e   v   e   r       h   a   p   p   e   n   s       t   o       b   e       n   e   a   r       a   d   d   r   e   s   s       z   e   r   o   .           S   e   e   
           /   /       h   t   t   p   s   :   /   /   g   i   t   h   u   b   .   c   o   m   /   e   m   s   c   r   i   p   t   e   n   -   c   o   r   e   /   e   m   s   c   r   i   p   t   e   n   /   i   s   s   u   e   s   /   1   9   3   0   0   .   
           i   f       (   t   r   u   e   )       {   
                   i   f       (   G   L   c   t   x   .   c   u   r   r   e   n   t   P   i   x   e   l   U   n   p   a   c   k   B   u   f   f   e   r   B   i   n   d   i   n   g       |   |       !   i   m   a   g   e   S   i   z   e   )       {   
                           G   L   c   t   x   .   c   o   m   p   r   e   s   s   e   d   T   e   x   I   m   a   g   e   2   D   (   t   a   r   g   e   t   ,       l   e   v   e   l   ,       i   n   t   e   r   n   a   l   F   o   r   m   a   t   ,       w   i   d   t   h   ,       h   e   i   g   h   t   ,       b   o   r   d   e   r   ,       i   m   a   g   e   S   i   z   e   ,       d   a   t   a   )   ;   
                           r   e   t   u   r   n   ;   
                   }   
                   G   L   c   t   x   .   c   o   m   p   r   e   s   s   e   d   T   e   x   I   m   a   g   e   2   D   (   t   a   r   g   e   t   ,       l   e   v   e   l   ,       i   n   t   e   r   n   a   l   F   o   r   m   a   t   ,       w   i   d   t   h   ,       h   e   i   g   h   t   ,       b   o   r   d   e   r   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       
                   H   E   A   P   U   8   )   ,       d   a   t   a   ,       i   m   a   g   e   S   i   z   e   )   ;   
                   r   e   t   u   r   n   ;   
           }   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   o   m   p   r   e   s   s   e   d   T   e   x   I   m   a   g   e   2   D       =       _   g   l   C   o   m   p   r   e   s   s   e   d   T   e   x   I   m   a   g   e   2   D   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   C   o   m   p   r   e   s   s   e   d   T   e   x   I   m   a   g   e   3   D       =       (   t   a   r   g   e   t   ,       l   e   v   e   l   ,       i   n   t   e   r   n   a   l   F   o   r   m   a   t   ,       w   i   d   t   h   ,       h   e   i   g   h   t   ,       d   e   p   t   h   ,       b   o   r   d   e   r   ,       i   m   a   g   e   S   i   z   e   ,       d   a   t   a   )       =   >       {   
           i   f       (   G   L   c   t   x   .   c   u   r   r   e   n   t   P   i   x   e   l   U   n   p   a   c   k   B   u   f   f   e   r   B   i   n   d   i   n   g   )       {   
                   G   L   c   t   x   .   c   o   m   p   r   e   s   s   e   d   T   e   x   I   m   a   g   e   3   D   (   t   a   r   g   e   t   ,       l   e   v   e   l   ,       i   n   t   e   r   n   a   l   F   o   r   m   a   t   ,       w   i   d   t   h   ,       h   e   i   g   h   t   ,       d   e   p   t   h   ,       b   o   r   d   e   r   ,       i   m   a   g   e   S   i   z   e   ,       d   a   t   a   )   ;   
           }       e   l   s   e       {   
                   G   L   c   t   x   .   c   o   m   p   r   e   s   s   e   d   T   e   x   I   m   a   g   e   3   D   (   t   a   r   g   e   t   ,       l   e   v   e   l   ,       i   n   t   e   r   n   a   l   F   o   r   m   a   t   ,       w   i   d   t   h   ,       h   e   i   g   h   t   ,       d   e   p   t   h   ,       b   o   r   d   e   r   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       
                   H   E   A   P   U   8   )   ,       d   a   t   a   ,       i   m   a   g   e   S   i   z   e   )   ;   
           }   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   o   m   p   r   e   s   s   e   d   T   e   x   I   m   a   g   e   3   D       =       _   g   l   C   o   m   p   r   e   s   s   e   d   T   e   x   I   m   a   g   e   3   D   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   C   o   m   p   r   e   s   s   e   d   T   e   x   S   u   b   I   m   a   g   e   2   D       =       (   t   a   r   g   e   t   ,       l   e   v   e   l   ,       x   o   f   f   s   e   t   ,       y   o   f   f   s   e   t   ,       w   i   d   t   h   ,       h   e   i   g   h   t   ,       f   o   r   m   a   t   ,       i   m   a   g   e   S   i   z   e   ,       d   a   t   a   )       =   >       {   
           i   f       (   t   r   u   e   )       {   
                   i   f       (   G   L   c   t   x   .   c   u   r   r   e   n   t   P   i   x   e   l   U   n   p   a   c   k   B   u   f   f   e   r   B   i   n   d   i   n   g       |   |       !   i   m   a   g   e   S   i   z   e   )       {   
                           G   L   c   t   x   .   c   o   m   p   r   e   s   s   e   d   T   e   x   S   u   b   I   m   a   g   e   2   D   (   t   a   r   g   e   t   ,       l   e   v   e   l   ,       x   o   f   f   s   e   t   ,       y   o   f   f   s   e   t   ,       w   i   d   t   h   ,       h   e   i   g   h   t   ,       f   o   r   m   a   t   ,       i   m   a   g   e   S   i   z   e   ,       d   a   t   a   )   ;   
                           r   e   t   u   r   n   ;   
                   }   
                   G   L   c   t   x   .   c   o   m   p   r   e   s   s   e   d   T   e   x   S   u   b   I   m   a   g   e   2   D   (   t   a   r   g   e   t   ,       l   e   v   e   l   ,       x   o   f   f   s   e   t   ,       y   o   f   f   s   e   t   ,       w   i   d   t   h   ,       h   e   i   g   h   t   ,       f   o   r   m   a   t   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       
                   H   E   A   P   U   8   )   ,       d   a   t   a   ,       i   m   a   g   e   S   i   z   e   )   ;   
                   r   e   t   u   r   n   ;   
           }   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   o   m   p   r   e   s   s   e   d   T   e   x   S   u   b   I   m   a   g   e   2   D       =       _   g   l   C   o   m   p   r   e   s   s   e   d   T   e   x   S   u   b   I   m   a   g   e   2   D   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   C   o   m   p   r   e   s   s   e   d   T   e   x   S   u   b   I   m   a   g   e   3   D       =       (   t   a   r   g   e   t   ,       l   e   v   e   l   ,       x   o   f   f   s   e   t   ,       y   o   f   f   s   e   t   ,       z   o   f   f   s   e   t   ,       w   i   d   t   h   ,       h   e   i   g   h   t   ,       d   e   p   t   h   ,       f   o   r   m   a   t   ,       i   m   a   g   e   S   i   z   e   ,       d   a   t   a   )       =   >       {   
           i   f       (   G   L   c   t   x   .   c   u   r   r   e   n   t   P   i   x   e   l   U   n   p   a   c   k   B   u   f   f   e   r   B   i   n   d   i   n   g   )       {   
                   G   L   c   t   x   .   c   o   m   p   r   e   s   s   e   d   T   e   x   S   u   b   I   m   a   g   e   3   D   (   t   a   r   g   e   t   ,       l   e   v   e   l   ,       x   o   f   f   s   e   t   ,       y   o   f   f   s   e   t   ,       z   o   f   f   s   e   t   ,       w   i   d   t   h   ,       h   e   i   g   h   t   ,       d   e   p   t   h   ,       f   o   r   m   a   t   ,       i   m   a   g   e   S   i   z   e   ,       d   a   t   a   )   ;   
           }       e   l   s   e       {   
                   G   L   c   t   x   .   c   o   m   p   r   e   s   s   e   d   T   e   x   S   u   b   I   m   a   g   e   3   D   (   t   a   r   g   e   t   ,       l   e   v   e   l   ,       x   o   f   f   s   e   t   ,       y   o   f   f   s   e   t   ,       z   o   f   f   s   e   t   ,       w   i   d   t   h   ,       h   e   i   g   h   t   ,       d   e   p   t   h   ,       f   o   r   m   a   t   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       
                   H   E   A   P   U   8   )   ,       d   a   t   a   ,       i   m   a   g   e   S   i   z   e   )   ;   
           }   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   o   m   p   r   e   s   s   e   d   T   e   x   S   u   b   I   m   a   g   e   3   D       =       _   g   l   C   o   m   p   r   e   s   s   e   d   T   e   x   S   u   b   I   m   a   g   e   3   D   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   C   o   p   y   B   u   f   f   e   r   S   u   b   D   a   t   a       =       (   x   0   ,       x   1   ,       x   2   ,       x   3   ,       x   4   )       =   >       G   L   c   t   x   .   c   o   p   y   B   u   f   f   e   r   S   u   b   D   a   t   a   (   x   0   ,       x   1   ,       x   2   ,       x   3   ,       x   4   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   o   p   y   B   u   f   f   e   r   S   u   b   D   a   t   a       =       _   g   l   C   o   p   y   B   u   f   f   e   r   S   u   b   D   a   t   a   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   C   o   p   y   T   e   x   I   m   a   g   e   2   D       =       (   x   0   ,       x   1   ,       x   2   ,       x   3   ,       x   4   ,       x   5   ,       x   6   ,       x   7   )       =   >       G   L   c   t   x   .   c   o   p   y   T   e   x   I   m   a   g   e   2   D   (   x   0   ,       x   1   ,       x   2   ,       x   3   ,       x   4   ,       x   5   ,       x   6   ,       x   7   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   o   p   y   T   e   x   I   m   a   g   e   2   D       =       _   g   l   C   o   p   y   T   e   x   I   m   a   g   e   2   D   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   C   o   p   y   T   e   x   S   u   b   I   m   a   g   e   2   D       =       (   x   0   ,       x   1   ,       x   2   ,       x   3   ,       x   4   ,       x   5   ,       x   6   ,       x   7   )       =   >       G   L   c   t   x   .   c   o   p   y   T   e   x   S   u   b   I   m   a   g   e   2   D   (   x   0   ,       x   1   ,       x   2   ,       x   3   ,       x   4   ,       x   5   ,       x   6   ,       x   7   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   o   p   y   T   e   x   S   u   b   I   m   a   g   e   2   D       =       _   g   l   C   o   p   y   T   e   x   S   u   b   I   m   a   g   e   2   D   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   C   o   p   y   T   e   x   S   u   b   I   m   a   g   e   3   D       =       (   x   0   ,       x   1   ,       x   2   ,       x   3   ,       x   4   ,       x   5   ,       x   6   ,       x   7   ,       x   8   )       =   >       G   L   c   t   x   .   c   o   p   y   T   e   x   S   u   b   I   m   a   g   e   3   D   (   x   0   ,       x   1   ,       x   2   ,       x   3   ,       x   4   ,       x   5   ,       x   6   ,       x   7   ,       x   8   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   o   p   y   T   e   x   S   u   b   I   m   a   g   e   3   D       =       _   g   l   C   o   p   y   T   e   x   S   u   b   I   m   a   g   e   3   D   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   C   r   e   a   t   e   P   r   o   g   r   a   m       =       (   )       =   >       {   
           v   a   r       i   d       =       G   L   .   g   e   t   N   e   w   I   d   (   G   L   .   p   r   o   g   r   a   m   s   )   ;   
           v   a   r       p   r   o   g   r   a   m       =       G   L   c   t   x   .   c   r   e   a   t   e   P   r   o   g   r   a   m   (   )   ;   
           /   /       S   t   o   r   e       a   d   d   i   t   i   o   n   a   l       i   n   f   o   r   m   a   t   i   o   n       n   e   e   d   e   d       f   o   r       e   a   c   h       s   h   a   d   e   r       p   r   o   g   r   a   m   :   
           p   r   o   g   r   a   m   .   n   a   m   e       =       i   d   ;   
           /   /       L   a   z   y       c   a   c   h   e       r   e   s   u   l   t   s       o   f   
           /   /       g   l   G   e   t   P   r   o   g   r   a   m   i   v   (   G   L   _   A   C   T   I   V   E   _   U   N   I   F   O   R   M   _   M   A   X   _   L   E   N   G   T   H   /   G   L   _   A   C   T   I   V   E   _   A   T   T   R   I   B   U   T   E   _   M   A   X   _   L   E   N   G   T   H   /   G   L   _   A   C   T   I   V   E   _   U   N   I   F   O   R   M   _   B   L   O   C   K   _   M   A   X   _   N   A   M   E   _   L   E   N   G   T   H   )   
           p   r   o   g   r   a   m   .   m   a   x   U   n   i   f   o   r   m   L   e   n   g   t   h       =       p   r   o   g   r   a   m   .   m   a   x   A   t   t   r   i   b   u   t   e   L   e   n   g   t   h       =       p   r   o   g   r   a   m   .   m   a   x   U   n   i   f   o   r   m   B   l   o   c   k   N   a   m   e   L   e   n   g   t   h       =       0   ;   
           p   r   o   g   r   a   m   .   u   n   i   f   o   r   m   I   d   C   o   u   n   t   e   r       =       1   ;   
           G   L   .   p   r   o   g   r   a   m   s   [   i   d   ]       =       p   r   o   g   r   a   m   ;   
           r   e   t   u   r   n       i   d   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   r   e   a   t   e   P   r   o   g   r   a   m       =       _   g   l   C   r   e   a   t   e   P   r   o   g   r   a   m   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   C   r   e   a   t   e   S   h   a   d   e   r       =       s   h   a   d   e   r   T   y   p   e       =   >       {   
           v   a   r       i   d       =       G   L   .   g   e   t   N   e   w   I   d   (   G   L   .   s   h   a   d   e   r   s   )   ;   
           G   L   .   s   h   a   d   e   r   s   [   i   d   ]       =       G   L   c   t   x   .   c   r   e   a   t   e   S   h   a   d   e   r   (   s   h   a   d   e   r   T   y   p   e   )   ;   
           r   e   t   u   r   n       i   d   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   r   e   a   t   e   S   h   a   d   e   r       =       _   g   l   C   r   e   a   t   e   S   h   a   d   e   r   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   C   u   l   l   F   a   c   e       =       x   0       =   >       G   L   c   t   x   .   c   u   l   l   F   a   c   e   (   x   0   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   u   l   l   F   a   c   e       =       _   g   l   C   u   l   l   F   a   c   e   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   D   e   l   e   t   e   B   u   f   f   e   r   s       =       (   n   ,       b   u   f   f   e   r   s   )       =   >       {   
           f   o   r       (   v   a   r       i       =       0   ;       i       <       n   ;       i   +   +   )       {   
                   v   a   r       i   d       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   (   b   u   f   f   e   r   s   )       +       (   i       *       4   )   )       >   >       2   )   ]   ;   
                   v   a   r       b   u   f   f   e   r       =       G   L   .   b   u   f   f   e   r   s   [   i   d   ]   ;   
                   /   /       F   r   o   m       s   p   e   c   :       "   g   l   D   e   l   e   t   e   B   u   f   f   e   r   s       s   i   l   e   n   t   l   y       i   g   n   o   r   e   s       0   '   s       a   n   d       n   a   m   e   s       t   h   a   t       d   o       n   o   t   
                   /   /       c   o   r   r   e   s   p   o   n   d       t   o       e   x   i   s   t   i   n   g       b   u   f   f   e   r       o   b   j   e   c   t   s   .   "   
                   i   f       (   !   b   u   f   f   e   r   )       c   o   n   t   i   n   u   e   ;   
                   G   L   c   t   x   .   d   e   l   e   t   e   B   u   f   f   e   r   (   b   u   f   f   e   r   )   ;   
                   b   u   f   f   e   r   .   n   a   m   e       =       0   ;   
                   G   L   .   b   u   f   f   e   r   s   [   i   d   ]       =       n   u   l   l   ;   
                   i   f       (   i   d       =   =       G   L   c   t   x   .   c   u   r   r   e   n   t   A   r   r   a   y   B   u   f   f   e   r   B   i   n   d   i   n   g   )       G   L   c   t   x   .   c   u   r   r   e   n   t   A   r   r   a   y   B   u   f   f   e   r   B   i   n   d   i   n   g       =       0   ;   
                   i   f       (   i   d       =   =       G   L   c   t   x   .   c   u   r   r   e   n   t   E   l   e   m   e   n   t   A   r   r   a   y   B   u   f   f   e   r   B   i   n   d   i   n   g   )       G   L   c   t   x   .   c   u   r   r   e   n   t   E   l   e   m   e   n   t   A   r   r   a   y   B   u   f   f   e   r   B   i   n   d   i   n   g       =       0   ;   
                   i   f       (   i   d       =   =       G   L   c   t   x   .   c   u   r   r   e   n   t   P   i   x   e   l   P   a   c   k   B   u   f   f   e   r   B   i   n   d   i   n   g   )       G   L   c   t   x   .   c   u   r   r   e   n   t   P   i   x   e   l   P   a   c   k   B   u   f   f   e   r   B   i   n   d   i   n   g       =       0   ;   
                   i   f       (   i   d       =   =       G   L   c   t   x   .   c   u   r   r   e   n   t   P   i   x   e   l   U   n   p   a   c   k   B   u   f   f   e   r   B   i   n   d   i   n   g   )       G   L   c   t   x   .   c   u   r   r   e   n   t   P   i   x   e   l   U   n   p   a   c   k   B   u   f   f   e   r   B   i   n   d   i   n   g       =       0   ;   
           }   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   l   e   t   e   B   u   f   f   e   r   s       =       _   g   l   D   e   l   e   t   e   B   u   f   f   e   r   s   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   D   e   l   e   t   e   F   r   a   m   e   b   u   f   f   e   r   s       =       (   n   ,       f   r   a   m   e   b   u   f   f   e   r   s   )       =   >       {   
           f   o   r       (   v   a   r       i       =       0   ;       i       <       n   ;       +   +   i   )       {   
                   v   a   r       i   d       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   (   f   r   a   m   e   b   u   f   f   e   r   s   )       +       (   i       *       4   )   )       >   >       2   )   ]   ;   
                   v   a   r       f   r   a   m   e   b   u   f   f   e   r       =       G   L   .   f   r   a   m   e   b   u   f   f   e   r   s   [   i   d   ]   ;   
                   i   f       (   !   f   r   a   m   e   b   u   f   f   e   r   )       c   o   n   t   i   n   u   e   ;   
                   /   /       G   L       s   p   e   c   :       "   g   l   D   e   l   e   t   e   F   r   a   m   e   b   u   f   f   e   r   s       s   i   l   e   n   t   l   y       i   g   n   o   r   e   s       0   s       a   n   d       n   a   m   e   s       t   h   a   t       d   o       n   o   t       c   o   r   r   e   s   p   o   n   d       t   o       e   x   i   s   t   i   n   g       f   r   a   m   e   b   u   f   f   e   r       o   b   j   e   c   t   s   "   .   
                   G   L   c   t   x   .   d   e   l   e   t   e   F   r   a   m   e   b   u   f   f   e   r   (   f   r   a   m   e   b   u   f   f   e   r   )   ;   
                   f   r   a   m   e   b   u   f   f   e   r   .   n   a   m   e       =       0   ;   
                   G   L   .   f   r   a   m   e   b   u   f   f   e   r   s   [   i   d   ]       =       n   u   l   l   ;   
           }   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   l   e   t   e   F   r   a   m   e   b   u   f   f   e   r   s       =       _   g   l   D   e   l   e   t   e   F   r   a   m   e   b   u   f   f   e   r   s   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   D   e   l   e   t   e   P   r   o   g   r   a   m       =       i   d       =   >       {   
           i   f       (   !   i   d   )       r   e   t   u   r   n   ;   
           v   a   r       p   r   o   g   r   a   m       =       G   L   .   p   r   o   g   r   a   m   s   [   i   d   ]   ;   
           i   f       (   !   p   r   o   g   r   a   m   )       {   
                   /   /       g   l   D   e   l   e   t   e   P   r   o   g   r   a   m       a   c   t   u   a   l   l   y       s   i   g   n   a   l   s       a   n       e   r   r   o   r       w   h   e   n       d   e   l   e   t   i   n   g       a       n   o   n   e   x   i   s   t   i   n   g   
                   /   /       o   b   j   e   c   t   ,       u   n   l   i   k   e       s   o   m   e       o   t   h   e   r       G   L       d   e   l   e   t   e       f   u   n   c   t   i   o   n   s   .   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   1   )   ;   
                   r   e   t   u   r   n   ;   
           }   
           G   L   c   t   x   .   d   e   l   e   t   e   P   r   o   g   r   a   m   (   p   r   o   g   r   a   m   )   ;   
           p   r   o   g   r   a   m   .   n   a   m   e       =       0   ;   
           G   L   .   p   r   o   g   r   a   m   s   [   i   d   ]       =       n   u   l   l   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   l   e   t   e   P   r   o   g   r   a   m       =       _   g   l   D   e   l   e   t   e   P   r   o   g   r   a   m   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   D   e   l   e   t   e   Q   u   e   r   i   e   s       =       (   n   ,       i   d   s   )       =   >       {   
           f   o   r       (   v   a   r       i       =       0   ;       i       <       n   ;       i   +   +   )       {   
                   v   a   r       i   d       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   (   i   d   s   )       +       (   i       *       4   )   )       >   >       2   )   ]   ;   
                   v   a   r       q   u   e   r   y       =       G   L   .   q   u   e   r   i   e   s   [   i   d   ]   ;   
                   i   f       (   !   q   u   e   r   y   )       c   o   n   t   i   n   u   e   ;   
                   /   /       G   L       s   p   e   c   :       "   u   n   u   s   e   d       n   a   m   e   s       i   n       i   d   s       a   r   e       i   g   n   o   r   e   d   ,       a   s       i   s       t   h   e       n   a   m   e       z   e   r   o   .   "   
                   G   L   c   t   x   .   d   e   l   e   t   e   Q   u   e   r   y   (   q   u   e   r   y   )   ;   
                   G   L   .   q   u   e   r   i   e   s   [   i   d   ]       =       n   u   l   l   ;   
           }   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   l   e   t   e   Q   u   e   r   i   e   s       =       _   g   l   D   e   l   e   t   e   Q   u   e   r   i   e   s   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   D   e   l   e   t   e   Q   u   e   r   i   e   s   E   X   T       =       (   n   ,       i   d   s   )       =   >       {   
           f   o   r       (   v   a   r       i       =       0   ;       i       <       n   ;       i   +   +   )       {   
                   v   a   r       i   d       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   (   i   d   s   )       +       (   i       *       4   )   )       >   >       2   )   ]   ;   
                   v   a   r       q   u   e   r   y       =       G   L   .   q   u   e   r   i   e   s   [   i   d   ]   ;   
                   i   f       (   !   q   u   e   r   y   )       c   o   n   t   i   n   u   e   ;   
                   /   /       G   L       s   p   e   c   :       "   u   n   u   s   e   d       n   a   m   e   s       i   n       i   d   s       a   r   e       i   g   n   o   r   e   d   ,       a   s       i   s       t   h   e       n   a   m   e       z   e   r   o   .   "   
                   G   L   c   t   x   .   d   i   s   j   o   i   n   t   T   i   m   e   r   Q   u   e   r   y   E   x   t   [   "   d   e   l   e   t   e   Q   u   e   r   y   E   X   T   "   ]   (   q   u   e   r   y   )   ;   
                   G   L   .   q   u   e   r   i   e   s   [   i   d   ]       =       n   u   l   l   ;   
           }   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   l   e   t   e   Q   u   e   r   i   e   s   E   X   T       =       _   g   l   D   e   l   e   t   e   Q   u   e   r   i   e   s   E   X   T   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   D   e   l   e   t   e   R   e   n   d   e   r   b   u   f   f   e   r   s       =       (   n   ,       r   e   n   d   e   r   b   u   f   f   e   r   s   )       =   >       {   
           f   o   r       (   v   a   r       i       =       0   ;       i       <       n   ;       i   +   +   )       {   
                   v   a   r       i   d       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   (   r   e   n   d   e   r   b   u   f   f   e   r   s   )       +       (   i       *       4   )   )       >   >       2   )   ]   ;   
                   v   a   r       r   e   n   d   e   r   b   u   f   f   e   r       =       G   L   .   r   e   n   d   e   r   b   u   f   f   e   r   s   [   i   d   ]   ;   
                   i   f       (   !   r   e   n   d   e   r   b   u   f   f   e   r   )       c   o   n   t   i   n   u   e   ;   
                   /   /       G   L       s   p   e   c   :       "   g   l   D   e   l   e   t   e   R   e   n   d   e   r   b   u   f   f   e   r   s       s   i   l   e   n   t   l   y       i   g   n   o   r   e   s       0   s       a   n   d       n   a   m   e   s       t   h   a   t       d   o       n   o   t       c   o   r   r   e   s   p   o   n   d       t   o       e   x   i   s   t   i   n   g       r   e   n   d   e   r   b   u   f   f   e   r       o   b   j   e   c   t   s   "   .   
                   G   L   c   t   x   .   d   e   l   e   t   e   R   e   n   d   e   r   b   u   f   f   e   r   (   r   e   n   d   e   r   b   u   f   f   e   r   )   ;   
                   r   e   n   d   e   r   b   u   f   f   e   r   .   n   a   m   e       =       0   ;   
                   G   L   .   r   e   n   d   e   r   b   u   f   f   e   r   s   [   i   d   ]       =       n   u   l   l   ;   
           }   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   l   e   t   e   R   e   n   d   e   r   b   u   f   f   e   r   s       =       _   g   l   D   e   l   e   t   e   R   e   n   d   e   r   b   u   f   f   e   r   s   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   D   e   l   e   t   e   S   a   m   p   l   e   r   s       =       (   n   ,       s   a   m   p   l   e   r   s   )       =   >       {   
           f   o   r       (   v   a   r       i       =       0   ;       i       <       n   ;       i   +   +   )       {   
                   v   a   r       i   d       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   (   s   a   m   p   l   e   r   s   )       +       (   i       *       4   )   )       >   >       2   )   ]   ;   
                   v   a   r       s   a   m   p   l   e   r       =       G   L   .   s   a   m   p   l   e   r   s   [   i   d   ]   ;   
                   i   f       (   !   s   a   m   p   l   e   r   )       c   o   n   t   i   n   u   e   ;   
                   G   L   c   t   x   .   d   e   l   e   t   e   S   a   m   p   l   e   r   (   s   a   m   p   l   e   r   )   ;   
                   s   a   m   p   l   e   r   .   n   a   m   e       =       0   ;   
                   G   L   .   s   a   m   p   l   e   r   s   [   i   d   ]       =       n   u   l   l   ;   
           }   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   l   e   t   e   S   a   m   p   l   e   r   s       =       _   g   l   D   e   l   e   t   e   S   a   m   p   l   e   r   s   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   D   e   l   e   t   e   S   h   a   d   e   r       =       i   d       =   >       {   
           i   f       (   !   i   d   )       r   e   t   u   r   n   ;   
           v   a   r       s   h   a   d   e   r       =       G   L   .   s   h   a   d   e   r   s   [   i   d   ]   ;   
           i   f       (   !   s   h   a   d   e   r   )       {   
                   /   /       g   l   D   e   l   e   t   e   S   h   a   d   e   r       a   c   t   u   a   l   l   y       s   i   g   n   a   l   s       a   n       e   r   r   o   r       w   h   e   n       d   e   l   e   t   i   n   g       a       n   o   n   e   x   i   s   t   i   n   g   
                   /   /       o   b   j   e   c   t   ,       u   n   l   i   k   e       s   o   m   e       o   t   h   e   r       G   L       d   e   l   e   t   e       f   u   n   c   t   i   o   n   s   .   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   1   )   ;   
                   r   e   t   u   r   n   ;   
           }   
           G   L   c   t   x   .   d   e   l   e   t   e   S   h   a   d   e   r   (   s   h   a   d   e   r   )   ;   
           G   L   .   s   h   a   d   e   r   s   [   i   d   ]       =       n   u   l   l   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   l   e   t   e   S   h   a   d   e   r       =       _   g   l   D   e   l   e   t   e   S   h   a   d   e   r   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   D   e   l   e   t   e   S   y   n   c       =       i   d       =   >       {   
           i   f       (   !   i   d   )       r   e   t   u   r   n   ;   
           v   a   r       s   y   n   c       =       G   L   .   s   y   n   c   s   [   i   d   ]   ;   
           i   f       (   !   s   y   n   c   )       {   
                   /   /       g   l   D   e   l   e   t   e   S   y   n   c       s   i   g   n   a   l   s       a   n       e   r   r   o   r       w   h   e   n       d   e   l   e   t   i   n   g       a       n   o   n   e   x   i   s   t   i   n   g       o   b   j   e   c   t   ,       u   n   l   i   k   e       s   o   m   e       o   t   h   e   r       G   L       d   e   l   e   t   e       f   u   n   c   t   i   o   n   s   .   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   1   )   ;   
                   r   e   t   u   r   n   ;   
           }   
           G   L   c   t   x   .   d   e   l   e   t   e   S   y   n   c   (   s   y   n   c   )   ;   
           s   y   n   c   .   n   a   m   e       =       0   ;   
           G   L   .   s   y   n   c   s   [   i   d   ]       =       n   u   l   l   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   l   e   t   e   S   y   n   c       =       _   g   l   D   e   l   e   t   e   S   y   n   c   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   D   e   l   e   t   e   T   e   x   t   u   r   e   s       =       (   n   ,       t   e   x   t   u   r   e   s   )       =   >       {   
           f   o   r       (   v   a   r       i       =       0   ;       i       <       n   ;       i   +   +   )       {   
                   v   a   r       i   d       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   (   t   e   x   t   u   r   e   s   )       +       (   i       *       4   )   )       >   >       2   )   ]   ;   
                   v   a   r       t   e   x   t   u   r   e       =       G   L   .   t   e   x   t   u   r   e   s   [   i   d   ]   ;   
                   /   /       G   L       s   p   e   c   :       "   g   l   D   e   l   e   t   e   T   e   x   t   u   r   e   s       s   i   l   e   n   t   l   y       i   g   n   o   r   e   s       0   s       a   n   d       n   a   m   e   s       t   h   a   t       d   o       n   o   t   
                   /   /       c   o   r   r   e   s   p   o   n   d       t   o       e   x   i   s   t   i   n   g       t   e   x   t   u   r   e   s   "   .   
                   i   f       (   !   t   e   x   t   u   r   e   )       c   o   n   t   i   n   u   e   ;   
                   G   L   c   t   x   .   d   e   l   e   t   e   T   e   x   t   u   r   e   (   t   e   x   t   u   r   e   )   ;   
                   t   e   x   t   u   r   e   .   n   a   m   e       =       0   ;   
                   G   L   .   t   e   x   t   u   r   e   s   [   i   d   ]       =       n   u   l   l   ;   
           }   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   l   e   t   e   T   e   x   t   u   r   e   s       =       _   g   l   D   e   l   e   t   e   T   e   x   t   u   r   e   s   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   D   e   l   e   t   e   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   s       =       (   n   ,       i   d   s   )       =   >       {   
           f   o   r       (   v   a   r       i       =       0   ;       i       <       n   ;       i   +   +   )       {   
                   v   a   r       i   d       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   (   i   d   s   )       +       (   i       *       4   )   )       >   >       2   )   ]   ;   
                   v   a   r       t   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k       =       G   L   .   t   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   s   [   i   d   ]   ;   
                   i   f       (   !   t   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   )       c   o   n   t   i   n   u   e   ;   
                   /   /       G   L       s   p   e   c   :       "   u   n   u   s   e   d       n   a   m   e   s       i   n       i   d   s       a   r   e       i   g   n   o   r   e   d   ,       a   s       i   s       t   h   e       n   a   m   e       z   e   r   o   .   "   
                   G   L   c   t   x   .   d   e   l   e   t   e   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   (   t   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   )   ;   
                   t   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   .   n   a   m   e       =       0   ;   
                   G   L   .   t   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   s   [   i   d   ]       =       n   u   l   l   ;   
           }   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   l   e   t   e   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   s       =       _   g   l   D   e   l   e   t   e   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   s   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   D   e   l   e   t   e   V   e   r   t   e   x   A   r   r   a   y   s       =       (   n   ,       v   a   o   s   )       =   >       {   
           f   o   r       (   v   a   r       i       =       0   ;       i       <       n   ;       i   +   +   )       {   
                   v   a   r       i   d       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   (   v   a   o   s   )       +       (   i       *       4   )   )       >   >       2   )   ]   ;   
                   G   L   c   t   x   .   d   e   l   e   t   e   V   e   r   t   e   x   A   r   r   a   y   (   G   L   .   v   a   o   s   [   i   d   ]   )   ;   
                   G   L   .   v   a   o   s   [   i   d   ]       =       n   u   l   l   ;   
           }   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   l   e   t   e   V   e   r   t   e   x   A   r   r   a   y   s       =       _   g   l   D   e   l   e   t   e   V   e   r   t   e   x   A   r   r   a   y   s   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   D   e   l   e   t   e   V   e   r   t   e   x   A   r   r   a   y   s   O   E   S       =       _   g   l   D   e   l   e   t   e   V   e   r   t   e   x   A   r   r   a   y   s   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   l   e   t   e   V   e   r   t   e   x   A   r   r   a   y   s   O   E   S       =       _   g   l   D   e   l   e   t   e   V   e   r   t   e   x   A   r   r   a   y   s   O   E   S   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   D   e   p   t   h   F   u   n   c       =       x   0       =   >       G   L   c   t   x   .   d   e   p   t   h   F   u   n   c   (   x   0   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   p   t   h   F   u   n   c       =       _   g   l   D   e   p   t   h   F   u   n   c   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   D   e   p   t   h   M   a   s   k       =       f   l   a   g       =   >       {   
           G   L   c   t   x   .   d   e   p   t   h   M   a   s   k   (   !   !   f   l   a   g   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   p   t   h   M   a   s   k       =       _   g   l   D   e   p   t   h   M   a   s   k   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   D   e   p   t   h   R   a   n   g   e   f       =       (   x   0   ,       x   1   )       =   >       G   L   c   t   x   .   d   e   p   t   h   R   a   n   g   e   (   x   0   ,       x   1   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   p   t   h   R   a   n   g   e   f       =       _   g   l   D   e   p   t   h   R   a   n   g   e   f   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   D   e   t   a   c   h   S   h   a   d   e   r       =       (   p   r   o   g   r   a   m   ,       s   h   a   d   e   r   )       =   >       {   
           G   L   c   t   x   .   d   e   t   a   c   h   S   h   a   d   e   r   (   G   L   .   p   r   o   g   r   a   m   s   [   p   r   o   g   r   a   m   ]   ,       G   L   .   s   h   a   d   e   r   s   [   s   h   a   d   e   r   ]   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   t   a   c   h   S   h   a   d   e   r       =       _   g   l   D   e   t   a   c   h   S   h   a   d   e   r   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   D   i   s   a   b   l   e       =       x   0       =   >       G   L   c   t   x   .   d   i   s   a   b   l   e   (   x   0   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   i   s   a   b   l   e       =       _   g   l   D   i   s   a   b   l   e   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   D   i   s   a   b   l   e   V   e   r   t   e   x   A   t   t   r   i   b   A   r   r   a   y       =       i   n   d   e   x       =   >       {   
           v   a   r       c   b       =       G   L   .   c   u   r   r   e   n   t   C   o   n   t   e   x   t   .   c   l   i   e   n   t   B   u   f   f   e   r   s   [   i   n   d   e   x   ]   ;   
           c   b   .   e   n   a   b   l   e   d       =       f   a   l   s   e   ;   
           G   L   c   t   x   .   d   i   s   a   b   l   e   V   e   r   t   e   x   A   t   t   r   i   b   A   r   r   a   y   (   i   n   d   e   x   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   i   s   a   b   l   e   V   e   r   t   e   x   A   t   t   r   i   b   A   r   r   a   y       =       _   g   l   D   i   s   a   b   l   e   V   e   r   t   e   x   A   t   t   r   i   b   A   r   r   a   y   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   D   r   a   w   A   r   r   a   y   s       =       (   m   o   d   e   ,       f   i   r   s   t   ,       c   o   u   n   t   )       =   >       {   
           /   /       b   i   n   d       a   n   y       c   l   i   e   n   t   -   s   i   d   e       b   u   f   f   e   r   s   
           G   L   .   p   r   e   D   r   a   w   H   a   n   d   l   e   C   l   i   e   n   t   V   e   r   t   e   x   A   t   t   r   i   b   B   i   n   d   i   n   g   s   (   f   i   r   s   t       +       c   o   u   n   t   )   ;   
           G   L   c   t   x   .   d   r   a   w   A   r   r   a   y   s   (   m   o   d   e   ,       f   i   r   s   t   ,       c   o   u   n   t   )   ;   
           G   L   .   p   o   s   t   D   r   a   w   H   a   n   d   l   e   C   l   i   e   n   t   V   e   r   t   e   x   A   t   t   r   i   b   B   i   n   d   i   n   g   s   (   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   A   r   r   a   y   s       =       _   g   l   D   r   a   w   A   r   r   a   y   s   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   D   r   a   w   A   r   r   a   y   s   I   n   s   t   a   n   c   e   d       =       (   m   o   d   e   ,       f   i   r   s   t   ,       c   o   u   n   t   ,       p   r   i   m   c   o   u   n   t   )       =   >       {   
           G   L   c   t   x   .   d   r   a   w   A   r   r   a   y   s   I   n   s   t   a   n   c   e   d   (   m   o   d   e   ,       f   i   r   s   t   ,       c   o   u   n   t   ,       p   r   i   m   c   o   u   n   t   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   A   r   r   a   y   s   I   n   s   t   a   n   c   e   d       =       _   g   l   D   r   a   w   A   r   r   a   y   s   I   n   s   t   a   n   c   e   d   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   D   r   a   w   A   r   r   a   y   s   I   n   s   t   a   n   c   e   d   A   N   G   L   E       =       _   g   l   D   r   a   w   A   r   r   a   y   s   I   n   s   t   a   n   c   e   d   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   A   r   r   a   y   s   I   n   s   t   a   n   c   e   d   A   N   G   L   E       =       _   g   l   D   r   a   w   A   r   r   a   y   s   I   n   s   t   a   n   c   e   d   A   N   G   L   E   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   D   r   a   w   A   r   r   a   y   s   I   n   s   t   a   n   c   e   d   A   R   B       =       _   g   l   D   r   a   w   A   r   r   a   y   s   I   n   s   t   a   n   c   e   d   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   A   r   r   a   y   s   I   n   s   t   a   n   c   e   d   A   R   B       =       _   g   l   D   r   a   w   A   r   r   a   y   s   I   n   s   t   a   n   c   e   d   A   R   B   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   D   r   a   w   A   r   r   a   y   s   I   n   s   t   a   n   c   e   d   E   X   T       =       _   g   l   D   r   a   w   A   r   r   a   y   s   I   n   s   t   a   n   c   e   d   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   A   r   r   a   y   s   I   n   s   t   a   n   c   e   d   E   X   T       =       _   g   l   D   r   a   w   A   r   r   a   y   s   I   n   s   t   a   n   c   e   d   E   X   T   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   D   r   a   w   A   r   r   a   y   s   I   n   s   t   a   n   c   e   d   N   V       =       _   g   l   D   r   a   w   A   r   r   a   y   s   I   n   s   t   a   n   c   e   d   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   A   r   r   a   y   s   I   n   s   t   a   n   c   e   d   N   V       =       _   g   l   D   r   a   w   A   r   r   a   y   s   I   n   s   t   a   n   c   e   d   N   V   ;   
   
   v   a   r       t   e   m   p   F   i   x   e   d   L   e   n   g   t   h   A   r   r   a   y       =       [   ]   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   D   r   a   w   B   u   f   f   e   r   s       =       (   n   ,       b   u   f   s   )       =   >       {   
           v   a   r       b   u   f   A   r   r   a   y       =       t   e   m   p   F   i   x   e   d   L   e   n   g   t   h   A   r   r   a   y   [   n   ]   ;   
           f   o   r       (   v   a   r       i       =       0   ;       i       <       n   ;       i   +   +   )       {   
                   b   u   f   A   r   r   a   y   [   i   ]       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   (   b   u   f   s   )       +       (   i       *       4   )   )       >   >       2   )   ]   ;   
           }   
           G   L   c   t   x   .   d   r   a   w   B   u   f   f   e   r   s   (   b   u   f   A   r   r   a   y   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   B   u   f   f   e   r   s       =       _   g   l   D   r   a   w   B   u   f   f   e   r   s   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   D   r   a   w   B   u   f   f   e   r   s   E   X   T       =       _   g   l   D   r   a   w   B   u   f   f   e   r   s   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   B   u   f   f   e   r   s   E   X   T       =       _   g   l   D   r   a   w   B   u   f   f   e   r   s   E   X   T   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   D   r   a   w   B   u   f   f   e   r   s   W   E   B   G   L       =       _   g   l   D   r   a   w   B   u   f   f   e   r   s   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   B   u   f   f   e   r   s   W   E   B   G   L       =       _   g   l   D   r   a   w   B   u   f   f   e   r   s   W   E   B   G   L   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   D   r   a   w   E   l   e   m   e   n   t   s       =       (   m   o   d   e   ,       c   o   u   n   t   ,       t   y   p   e   ,       i   n   d   i   c   e   s   )       =   >       {   
           v   a   r       b   u   f   ;   
           v   a   r       v   e   r   t   e   x   e   s       =       0   ;   
           i   f       (   !   G   L   c   t   x   .   c   u   r   r   e   n   t   E   l   e   m   e   n   t   A   r   r   a   y   B   u   f   f   e   r   B   i   n   d   i   n   g   )       {   
                   v   a   r       s   i   z   e       =       G   L   .   c   a   l   c   B   u   f   L   e   n   g   t   h   (   1   ,       t   y   p   e   ,       0   ,       c   o   u   n   t   )   ;   
                   b   u   f       =       G   L   .   g   e   t   T   e   m   p   I   n   d   e   x   B   u   f   f   e   r   (   s   i   z   e   )   ;   
                   G   L   c   t   x   .   b   i   n   d   B   u   f   f   e   r   (   3   4   9   6   3   ,       b   u   f   )   ;   
                   G   L   c   t   x   .   b   u   f   f   e   r   S   u   b   D   a   t   a   (   3   4   9   6   3   ,       0   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   8   )   .   s   u   b   a   r   r   a   y   (   i   n   d   i   c   e   s   ,       i   n   d   i   c   e   s       +       s   i   z   e   )   )   ;   
                   /   /       C   a   l   c   u   l   a   t   i   n   g       v   e   r   t   e   x       c   o   u   n   t       i   f       s   h   a   d   e   r   '   s       a   t   t   r   i   b   u   t   e       d   a   t   a       i   s       o   n       c   l   i   e   n   t       s   i   d   e   
                   i   f       (   c   o   u   n   t       >       0   )       {   
                           f   o   r       (   v   a   r       i       =       0   ;       i       <       G   L   .   c   u   r   r   e   n   t   C   o   n   t   e   x   t   .   m   a   x   V   e   r   t   e   x   A   t   t   r   i   b   s   ;       +   +   i   )       {   
                                   v   a   r       c   b       =       G   L   .   c   u   r   r   e   n   t   C   o   n   t   e   x   t   .   c   l   i   e   n   t   B   u   f   f   e   r   s   [   i   ]   ;   
                                   i   f       (   c   b   .   c   l   i   e   n   t   s   i   d   e       &   &       c   b   .   e   n   a   b   l   e   d   )       {   
                                           l   e   t       a   r   r   a   y   C   l   a   s   s   ;   
                                           s   w   i   t   c   h       (   t   y   p   e   )       {   
                                               c   a   s   e       5   1   2   1   :   
                                                   a   r   r   a   y   C   l   a   s   s       =       U   i   n   t   8   A   r   r   a   y   ;   
                                                   b   r   e   a   k   ;   
   
                                               c   a   s   e       5   1   2   3   :   
                                                   a   r   r   a   y   C   l   a   s   s       =       U   i   n   t   1   6   A   r   r   a   y   ;   
                                                   b   r   e   a   k   ;   
   
                                               c   a   s   e       5   1   2   5   :   
                                                   a   r   r   a   y   C   l   a   s   s       =       U   i   n   t   3   2   A   r   r   a   y   ;   
                                                   b   r   e   a   k   ;   
   
                                               d   e   f   a   u   l   t   :   
                                                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   2   )   ;   
                                                   r   e   t   u   r   n   ;   
                                           }   
                                           v   e   r   t   e   x   e   s       =       n   e   w       a   r   r   a   y   C   l   a   s   s   (   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   8   )   .   b   u   f   f   e   r   ,       i   n   d   i   c   e   s   ,       c   o   u   n   t   )   .   r   e   d   u   c   e   (   (   m   a   x   ,       c   u   r   r   e   n   t   )       =   >       M   a   t   h   .   m   a   x   (   m   a   x   ,       c   u   r   r   e   n   t   )   )       +       1   ;   
                                           b   r   e   a   k   ;   
                                   }   
                           }   
                   }   
                   /   /       t   h   e       i   n   d   e   x       i   s       n   o   w       0   
                   i   n   d   i   c   e   s       =       0   ;   
           }   
           /   /       b   i   n   d       a   n   y       c   l   i   e   n   t   -   s   i   d   e       b   u   f   f   e   r   s   
           G   L   .   p   r   e   D   r   a   w   H   a   n   d   l   e   C   l   i   e   n   t   V   e   r   t   e   x   A   t   t   r   i   b   B   i   n   d   i   n   g   s   (   v   e   r   t   e   x   e   s   )   ;   
           G   L   c   t   x   .   d   r   a   w   E   l   e   m   e   n   t   s   (   m   o   d   e   ,       c   o   u   n   t   ,       t   y   p   e   ,       i   n   d   i   c   e   s   )   ;   
           G   L   .   p   o   s   t   D   r   a   w   H   a   n   d   l   e   C   l   i   e   n   t   V   e   r   t   e   x   A   t   t   r   i   b   B   i   n   d   i   n   g   s   (   c   o   u   n   t   )   ;   
           i   f       (   !   G   L   c   t   x   .   c   u   r   r   e   n   t   E   l   e   m   e   n   t   A   r   r   a   y   B   u   f   f   e   r   B   i   n   d   i   n   g   )       {   
                   G   L   c   t   x   .   b   i   n   d   B   u   f   f   e   r   (   3   4   9   6   3   ,       n   u   l   l   )   ;   
           }   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   E   l   e   m   e   n   t   s       =       _   g   l   D   r   a   w   E   l   e   m   e   n   t   s   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   D   r   a   w   E   l   e   m   e   n   t   s   I   n   s   t   a   n   c   e   d       =       (   m   o   d   e   ,       c   o   u   n   t   ,       t   y   p   e   ,       i   n   d   i   c   e   s   ,       p   r   i   m   c   o   u   n   t   )       =   >       {   
           G   L   c   t   x   .   d   r   a   w   E   l   e   m   e   n   t   s   I   n   s   t   a   n   c   e   d   (   m   o   d   e   ,       c   o   u   n   t   ,       t   y   p   e   ,       i   n   d   i   c   e   s   ,       p   r   i   m   c   o   u   n   t   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   E   l   e   m   e   n   t   s   I   n   s   t   a   n   c   e   d       =       _   g   l   D   r   a   w   E   l   e   m   e   n   t   s   I   n   s   t   a   n   c   e   d   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   D   r   a   w   E   l   e   m   e   n   t   s   I   n   s   t   a   n   c   e   d   A   N   G   L   E       =       _   g   l   D   r   a   w   E   l   e   m   e   n   t   s   I   n   s   t   a   n   c   e   d   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   E   l   e   m   e   n   t   s   I   n   s   t   a   n   c   e   d   A   N   G   L   E       =       _   g   l   D   r   a   w   E   l   e   m   e   n   t   s   I   n   s   t   a   n   c   e   d   A   N   G   L   E   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   D   r   a   w   E   l   e   m   e   n   t   s   I   n   s   t   a   n   c   e   d   A   R   B       =       _   g   l   D   r   a   w   E   l   e   m   e   n   t   s   I   n   s   t   a   n   c   e   d   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   E   l   e   m   e   n   t   s   I   n   s   t   a   n   c   e   d   A   R   B       =       _   g   l   D   r   a   w   E   l   e   m   e   n   t   s   I   n   s   t   a   n   c   e   d   A   R   B   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   D   r   a   w   E   l   e   m   e   n   t   s   I   n   s   t   a   n   c   e   d   E   X   T       =       _   g   l   D   r   a   w   E   l   e   m   e   n   t   s   I   n   s   t   a   n   c   e   d   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   E   l   e   m   e   n   t   s   I   n   s   t   a   n   c   e   d   E   X   T       =       _   g   l   D   r   a   w   E   l   e   m   e   n   t   s   I   n   s   t   a   n   c   e   d   E   X   T   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   D   r   a   w   E   l   e   m   e   n   t   s   I   n   s   t   a   n   c   e   d   N   V       =       _   g   l   D   r   a   w   E   l   e   m   e   n   t   s   I   n   s   t   a   n   c   e   d   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   E   l   e   m   e   n   t   s   I   n   s   t   a   n   c   e   d   N   V       =       _   g   l   D   r   a   w   E   l   e   m   e   n   t   s   I   n   s   t   a   n   c   e   d   N   V   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   D   r   a   w   R   a   n   g   e   E   l   e   m   e   n   t   s       =       (   m   o   d   e   ,       s   t   a   r   t   ,       e   n   d   ,       c   o   u   n   t   ,       t   y   p   e   ,       i   n   d   i   c   e   s   )       =   >       {   
           /   /       T   O   D   O   :       T   h   i   s       s   h   o   u   l   d       b   e       a       t   r   i   v   i   a   l       p   a   s   s   -   t   h   o   u   g   h       f   u   n   c   t   i   o   n       r   e   g   i   s   t   e   r   e   d       a   t       t   h   e       b   o   t   t   o   m       o   f       t   h   i   s       p   a   g   e       a   s   
           /   /       g   l   F   u   n   c   s   [   6   ]   [   1   ]       +   =       '       d   r   a   w   R   a   n   g   e   E   l   e   m   e   n   t   s   '   ;   
           /   /       b   u   t       d   u   e       t   o       h   t   t   p   s   :   /   /   b   u   g   z   i   l   l   a   .   m   o   z   i   l   l   a   .   o   r   g   /   s   h   o   w   _   b   u   g   .   c   g   i   ?   i   d   =   1   2   0   2   4   2   7   ,   
           /   /       w   e       w   o   r   k       a   r   o   u   n   d       b   y       i   g   n   o   r   i   n   g       t   h   e       r   a   n   g   e   .   
           _   g   l   D   r   a   w   E   l   e   m   e   n   t   s   (   m   o   d   e   ,       c   o   u   n   t   ,       t   y   p   e   ,       i   n   d   i   c   e   s   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   R   a   n   g   e   E   l   e   m   e   n   t   s       =       _   g   l   D   r   a   w   R   a   n   g   e   E   l   e   m   e   n   t   s   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   E   n   a   b   l   e       =       x   0       =   >       G   L   c   t   x   .   e   n   a   b   l   e   (   x   0   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   E   n   a   b   l   e       =       _   g   l   E   n   a   b   l   e   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   E   n   a   b   l   e   V   e   r   t   e   x   A   t   t   r   i   b   A   r   r   a   y       =       i   n   d   e   x       =   >       {   
           v   a   r       c   b       =       G   L   .   c   u   r   r   e   n   t   C   o   n   t   e   x   t   .   c   l   i   e   n   t   B   u   f   f   e   r   s   [   i   n   d   e   x   ]   ;   
           c   b   .   e   n   a   b   l   e   d       =       t   r   u   e   ;   
           G   L   c   t   x   .   e   n   a   b   l   e   V   e   r   t   e   x   A   t   t   r   i   b   A   r   r   a   y   (   i   n   d   e   x   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   E   n   a   b   l   e   V   e   r   t   e   x   A   t   t   r   i   b   A   r   r   a   y       =       _   g   l   E   n   a   b   l   e   V   e   r   t   e   x   A   t   t   r   i   b   A   r   r   a   y   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   E   n   d   Q   u   e   r   y       =       x   0       =   >       G   L   c   t   x   .   e   n   d   Q   u   e   r   y   (   x   0   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   E   n   d   Q   u   e   r   y       =       _   g   l   E   n   d   Q   u   e   r   y   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   E   n   d   Q   u   e   r   y   E   X   T       =       t   a   r   g   e   t       =   >       {   
           G   L   c   t   x   .   d   i   s   j   o   i   n   t   T   i   m   e   r   Q   u   e   r   y   E   x   t   [   "   e   n   d   Q   u   e   r   y   E   X   T   "   ]   (   t   a   r   g   e   t   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   E   n   d   Q   u   e   r   y   E   X   T       =       _   g   l   E   n   d   Q   u   e   r   y   E   X   T   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   E   n   d   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k       =       (   )       =   >       G   L   c   t   x   .   e   n   d   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   (   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   E   n   d   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k       =       _   g   l   E   n   d   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   F   e   n   c   e   S   y   n   c       =       (   c   o   n   d   i   t   i   o   n   ,       f   l   a   g   s   )       =   >       {   
           v   a   r       s   y   n   c       =       G   L   c   t   x   .   f   e   n   c   e   S   y   n   c   (   c   o   n   d   i   t   i   o   n   ,       f   l   a   g   s   )   ;   
           i   f       (   s   y   n   c   )       {   
                   v   a   r       i   d       =       G   L   .   g   e   t   N   e   w   I   d   (   G   L   .   s   y   n   c   s   )   ;   
                   s   y   n   c   .   n   a   m   e       =       i   d   ;   
                   G   L   .   s   y   n   c   s   [   i   d   ]       =       s   y   n   c   ;   
                   r   e   t   u   r   n       i   d   ;   
           }   
           r   e   t   u   r   n       0   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   F   e   n   c   e   S   y   n   c       =       _   g   l   F   e   n   c   e   S   y   n   c   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   F   i   n   i   s   h       =       (   )       =   >       G   L   c   t   x   .   f   i   n   i   s   h   (   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   F   i   n   i   s   h       =       _   g   l   F   i   n   i   s   h   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   F   l   u   s   h       =       (   )       =   >       G   L   c   t   x   .   f   l   u   s   h   (   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   F   l   u   s   h       =       _   g   l   F   l   u   s   h   ;   
   
   v   a   r       e   m   s   c   r   i   p   t   e   n   W   e   b   G   L   G   e   t   B   u   f   f   e   r   B   i   n   d   i   n   g       =       t   a   r   g   e   t       =   >       {   
           s   w   i   t   c   h       (   t   a   r   g   e   t   )       {   
               c   a   s   e       3   4   9   6   2   :   
                   t   a   r   g   e   t       =       3   4   9   6   4   ;   
                   b   r   e   a   k   ;   
   
               c   a   s   e       3   4   9   6   3   :   
                   t   a   r   g   e   t       =       3   4   9   6   5   ;   
                   b   r   e   a   k   ;   
   
               c   a   s   e       3   5   0   5   1   :   
                   t   a   r   g   e   t       =       3   5   0   5   3   ;   
                   b   r   e   a   k   ;   
   
               c   a   s   e       3   5   0   5   2   :   
                   t   a   r   g   e   t       =       3   5   0   5   5   ;   
                   b   r   e   a   k   ;   
   
               c   a   s   e       3   5   9   8   2   :   
                   t   a   r   g   e   t       =       3   5   9   8   3   ;   
                   b   r   e   a   k   ;   
   
               c   a   s   e       3   6   6   6   2   :   
                   t   a   r   g   e   t       =       3   6   6   6   2   ;   
                   b   r   e   a   k   ;   
   
               c   a   s   e       3   6   6   6   3   :   
                   t   a   r   g   e   t       =       3   6   6   6   3   ;   
                   b   r   e   a   k   ;   
   
               c   a   s   e       3   5   3   4   5   :   
                   t   a   r   g   e   t       =       3   5   3   6   8   ;   
                   b   r   e   a   k   ;   
           }   
           v   a   r       b   u   f   f   e   r       =       G   L   c   t   x   .   g   e   t   P   a   r   a   m   e   t   e   r   (   t   a   r   g   e   t   )   ;   
           i   f       (   b   u   f   f   e   r   )       r   e   t   u   r   n       b   u   f   f   e   r   .   n   a   m   e       |       0   ;       e   l   s   e       r   e   t   u   r   n       0   ;   
   }   ;   
   
   v   a   r       e   m   s   c   r   i   p   t   e   n   W   e   b   G   L   V   a   l   i   d   a   t   e   M   a   p   B   u   f   f   e   r   T   a   r   g   e   t       =       t   a   r   g   e   t       =   >       {   
           s   w   i   t   c   h       (   t   a   r   g   e   t   )       {   
               c   a   s   e       3   4   9   6   2   :   
               /   /       G   L   _   A   R   R   A   Y   _   B   U   F   F   E   R   
                   c   a   s   e       3   4   9   6   3   :   
               /   /       G   L   _   E   L   E   M   E   N   T   _   A   R   R   A   Y   _   B   U   F   F   E   R   
                   c   a   s   e       3   6   6   6   2   :   
               /   /       G   L   _   C   O   P   Y   _   R   E   A   D   _   B   U   F   F   E   R   
                   c   a   s   e       3   6   6   6   3   :   
               /   /       G   L   _   C   O   P   Y   _   W   R   I   T   E   _   B   U   F   F   E   R   
                   c   a   s   e       3   5   0   5   1   :   
               /   /       G   L   _   P   I   X   E   L   _   P   A   C   K   _   B   U   F   F   E   R   
                   c   a   s   e       3   5   0   5   2   :   
               /   /       G   L   _   P   I   X   E   L   _   U   N   P   A   C   K   _   B   U   F   F   E   R   
                   c   a   s   e       3   5   8   8   2   :   
               /   /       G   L   _   T   E   X   T   U   R   E   _   B   U   F   F   E   R   
                   c   a   s   e       3   5   9   8   2   :   
               /   /       G   L   _   T   R   A   N   S   F   O   R   M   _   F   E   E   D   B   A   C   K   _   B   U   F   F   E   R   
                   c   a   s   e       3   5   3   4   5   :   
                   /   /       G   L   _   U   N   I   F   O   R   M   _   B   U   F   F   E   R   
                   r   e   t   u   r   n       t   r   u   e   ;   
   
               d   e   f   a   u   l   t   :   
                   r   e   t   u   r   n       f   a   l   s   e   ;   
           }   
   }   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   F   l   u   s   h   M   a   p   p   e   d   B   u   f   f   e   r   R   a   n   g   e       =       (   t   a   r   g   e   t   ,       o   f   f   s   e   t   ,       l   e   n   g   t   h   )       =   >       {   
           i   f       (   !   e   m   s   c   r   i   p   t   e   n   W   e   b   G   L   V   a   l   i   d   a   t   e   M   a   p   B   u   f   f   e   r   T   a   r   g   e   t   (   t   a   r   g   e   t   )   )       {   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   0   )   ;   
                   e   r   r   (   "   G   L   _   I   N   V   A   L   I   D   _   E   N   U   M       i   n       g   l   F   l   u   s   h   M   a   p   p   e   d   B   u   f   f   e   r   R   a   n   g   e   "   )   ;   
                   r   e   t   u   r   n   ;   
           }   
           v   a   r       m   a   p   p   i   n   g       =       G   L   .   m   a   p   p   e   d   B   u   f   f   e   r   s   [   e   m   s   c   r   i   p   t   e   n   W   e   b   G   L   G   e   t   B   u   f   f   e   r   B   i   n   d   i   n   g   (   t   a   r   g   e   t   )   ]   ;   
           i   f       (   !   m   a   p   p   i   n   g   )       {   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   2   )   ;   
                   e   r   r   (   "   b   u   f   f   e   r       w   a   s       n   e   v   e   r       m   a   p   p   e   d       i   n       g   l   F   l   u   s   h   M   a   p   p   e   d   B   u   f   f   e   r   R   a   n   g   e   "   )   ;   
                   r   e   t   u   r   n   ;   
           }   
           i   f       (   !   (   m   a   p   p   i   n   g   .   a   c   c   e   s   s       &       1   6   )   )       {   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   2   )   ;   
                   e   r   r   (   "   b   u   f   f   e   r       w   a   s       n   o   t       m   a   p   p   e   d       w   i   t   h       G   L   _   M   A   P   _   F   L   U   S   H   _   E   X   P   L   I   C   I   T   _   B   I   T       i   n       g   l   F   l   u   s   h   M   a   p   p   e   d   B   u   f   f   e   r   R   a   n   g   e   "   )   ;   
                   r   e   t   u   r   n   ;   
           }   
           i   f       (   o   f   f   s   e   t       <       0       |   |       l   e   n   g   t   h       <       0       |   |       o   f   f   s   e   t       +       l   e   n   g   t   h       >       m   a   p   p   i   n   g   .   l   e   n   g   t   h   )       {   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   1   )   ;   
                   e   r   r   (   "   i   n   v   a   l   i   d       r   a   n   g   e       i   n       g   l   F   l   u   s   h   M   a   p   p   e   d   B   u   f   f   e   r   R   a   n   g   e   "   )   ;   
                   r   e   t   u   r   n   ;   
           }   
           G   L   c   t   x   .   b   u   f   f   e   r   S   u   b   D   a   t   a   (   t   a   r   g   e   t   ,       m   a   p   p   i   n   g   .   o   f   f   s   e   t   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   8   )   .   s   u   b   a   r   r   a   y   (   m   a   p   p   i   n   g   .   m   e   m       +       o   f   f   s   e   t   ,       m   a   p   p   i   n   g   .   m   e   m       +       o   f   f   s   e   t       +       l   e   n   g   t   h   )   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   F   l   u   s   h   M   a   p   p   e   d   B   u   f   f   e   r   R   a   n   g   e       =       _   g   l   F   l   u   s   h   M   a   p   p   e   d   B   u   f   f   e   r   R   a   n   g   e   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   F   r   a   m   e   b   u   f   f   e   r   R   e   n   d   e   r   b   u   f   f   e   r       =       (   t   a   r   g   e   t   ,       a   t   t   a   c   h   m   e   n   t   ,       r   e   n   d   e   r   b   u   f   f   e   r   t   a   r   g   e   t   ,       r   e   n   d   e   r   b   u   f   f   e   r   )       =   >       {   
           G   L   c   t   x   .   f   r   a   m   e   b   u   f   f   e   r   R   e   n   d   e   r   b   u   f   f   e   r   (   t   a   r   g   e   t   ,       a   t   t   a   c   h   m   e   n   t   ,       r   e   n   d   e   r   b   u   f   f   e   r   t   a   r   g   e   t   ,       G   L   .   r   e   n   d   e   r   b   u   f   f   e   r   s   [   r   e   n   d   e   r   b   u   f   f   e   r   ]   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   F   r   a   m   e   b   u   f   f   e   r   R   e   n   d   e   r   b   u   f   f   e   r       =       _   g   l   F   r   a   m   e   b   u   f   f   e   r   R   e   n   d   e   r   b   u   f   f   e   r   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   F   r   a   m   e   b   u   f   f   e   r   T   e   x   t   u   r   e   2   D       =       (   t   a   r   g   e   t   ,       a   t   t   a   c   h   m   e   n   t   ,       t   e   x   t   a   r   g   e   t   ,       t   e   x   t   u   r   e   ,       l   e   v   e   l   )       =   >       {   
           G   L   c   t   x   .   f   r   a   m   e   b   u   f   f   e   r   T   e   x   t   u   r   e   2   D   (   t   a   r   g   e   t   ,       a   t   t   a   c   h   m   e   n   t   ,       t   e   x   t   a   r   g   e   t   ,       G   L   .   t   e   x   t   u   r   e   s   [   t   e   x   t   u   r   e   ]   ,       l   e   v   e   l   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   F   r   a   m   e   b   u   f   f   e   r   T   e   x   t   u   r   e   2   D       =       _   g   l   F   r   a   m   e   b   u   f   f   e   r   T   e   x   t   u   r   e   2   D   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   F   r   a   m   e   b   u   f   f   e   r   T   e   x   t   u   r   e   L   a   y   e   r       =       (   t   a   r   g   e   t   ,       a   t   t   a   c   h   m   e   n   t   ,       t   e   x   t   u   r   e   ,       l   e   v   e   l   ,       l   a   y   e   r   )       =   >       {   
           G   L   c   t   x   .   f   r   a   m   e   b   u   f   f   e   r   T   e   x   t   u   r   e   L   a   y   e   r   (   t   a   r   g   e   t   ,       a   t   t   a   c   h   m   e   n   t   ,       G   L   .   t   e   x   t   u   r   e   s   [   t   e   x   t   u   r   e   ]   ,       l   e   v   e   l   ,       l   a   y   e   r   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   F   r   a   m   e   b   u   f   f   e   r   T   e   x   t   u   r   e   L   a   y   e   r       =       _   g   l   F   r   a   m   e   b   u   f   f   e   r   T   e   x   t   u   r   e   L   a   y   e   r   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   F   r   o   n   t   F   a   c   e       =       x   0       =   >       G   L   c   t   x   .   f   r   o   n   t   F   a   c   e   (   x   0   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   F   r   o   n   t   F   a   c   e       =       _   g   l   F   r   o   n   t   F   a   c   e   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   n   B   u   f   f   e   r   s       =       (   n   ,       b   u   f   f   e   r   s   )       =   >       {   
           G   L   .   g   e   n   O   b   j   e   c   t   (   n   ,       b   u   f   f   e   r   s   ,       "   c   r   e   a   t   e   B   u   f   f   e   r   "   ,       G   L   .   b   u   f   f   e   r   s   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   n   B   u   f   f   e   r   s       =       _   g   l   G   e   n   B   u   f   f   e   r   s   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   n   F   r   a   m   e   b   u   f   f   e   r   s       =       (   n   ,       i   d   s   )       =   >       {   
           G   L   .   g   e   n   O   b   j   e   c   t   (   n   ,       i   d   s   ,       "   c   r   e   a   t   e   F   r   a   m   e   b   u   f   f   e   r   "   ,       G   L   .   f   r   a   m   e   b   u   f   f   e   r   s   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   n   F   r   a   m   e   b   u   f   f   e   r   s       =       _   g   l   G   e   n   F   r   a   m   e   b   u   f   f   e   r   s   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   n   Q   u   e   r   i   e   s       =       (   n   ,       i   d   s   )       =   >       {   
           G   L   .   g   e   n   O   b   j   e   c   t   (   n   ,       i   d   s   ,       "   c   r   e   a   t   e   Q   u   e   r   y   "   ,       G   L   .   q   u   e   r   i   e   s   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   n   Q   u   e   r   i   e   s       =       _   g   l   G   e   n   Q   u   e   r   i   e   s   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   n   Q   u   e   r   i   e   s   E   X   T       =       (   n   ,       i   d   s   )       =   >       {   
           f   o   r       (   v   a   r       i       =       0   ;       i       <       n   ;       i   +   +   )       {   
                   v   a   r       q   u   e   r   y       =       G   L   c   t   x   .   d   i   s   j   o   i   n   t   T   i   m   e   r   Q   u   e   r   y   E   x   t   [   "   c   r   e   a   t   e   Q   u   e   r   y   E   X   T   "   ]   (   )   ;   
                   i   f       (   !   q   u   e   r   y   )       {   
                           G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   2   )   ;   
                           w   h   i   l   e       (   i       <       n   )       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   (   i   d   s   )       +       (   i   +   +       *       4   )   )       >   >       2   )   ]       =       0   ;   
                           r   e   t   u   r   n   ;   
                   }   
                   v   a   r       i   d       =       G   L   .   g   e   t   N   e   w   I   d   (   G   L   .   q   u   e   r   i   e   s   )   ;   
                   q   u   e   r   y   .   n   a   m   e       =       i   d   ;   
                   G   L   .   q   u   e   r   i   e   s   [   i   d   ]       =       q   u   e   r   y   ;   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   (   i   d   s   )       +       (   i       *       4   )   )       >   >       2   )   ]       =       i   d   ;   
           }   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   n   Q   u   e   r   i   e   s   E   X   T       =       _   g   l   G   e   n   Q   u   e   r   i   e   s   E   X   T   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   n   R   e   n   d   e   r   b   u   f   f   e   r   s       =       (   n   ,       r   e   n   d   e   r   b   u   f   f   e   r   s   )       =   >       {   
           G   L   .   g   e   n   O   b   j   e   c   t   (   n   ,       r   e   n   d   e   r   b   u   f   f   e   r   s   ,       "   c   r   e   a   t   e   R   e   n   d   e   r   b   u   f   f   e   r   "   ,       G   L   .   r   e   n   d   e   r   b   u   f   f   e   r   s   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   n   R   e   n   d   e   r   b   u   f   f   e   r   s       =       _   g   l   G   e   n   R   e   n   d   e   r   b   u   f   f   e   r   s   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   n   S   a   m   p   l   e   r   s       =       (   n   ,       s   a   m   p   l   e   r   s   )       =   >       {   
           G   L   .   g   e   n   O   b   j   e   c   t   (   n   ,       s   a   m   p   l   e   r   s   ,       "   c   r   e   a   t   e   S   a   m   p   l   e   r   "   ,       G   L   .   s   a   m   p   l   e   r   s   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   n   S   a   m   p   l   e   r   s       =       _   g   l   G   e   n   S   a   m   p   l   e   r   s   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   n   T   e   x   t   u   r   e   s       =       (   n   ,       t   e   x   t   u   r   e   s   )       =   >       {   
           G   L   .   g   e   n   O   b   j   e   c   t   (   n   ,       t   e   x   t   u   r   e   s   ,       "   c   r   e   a   t   e   T   e   x   t   u   r   e   "   ,       G   L   .   t   e   x   t   u   r   e   s   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   n   T   e   x   t   u   r   e   s       =       _   g   l   G   e   n   T   e   x   t   u   r   e   s   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   n   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   s       =       (   n   ,       i   d   s   )       =   >       {   
           G   L   .   g   e   n   O   b   j   e   c   t   (   n   ,       i   d   s   ,       "   c   r   e   a   t   e   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   "   ,       G   L   .   t   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   s   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   n   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   s       =       _   g   l   G   e   n   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   s   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   n   V   e   r   t   e   x   A   r   r   a   y   s       =       (   n   ,       a   r   r   a   y   s   )       =   >       {   
           G   L   .   g   e   n   O   b   j   e   c   t   (   n   ,       a   r   r   a   y   s   ,       "   c   r   e   a   t   e   V   e   r   t   e   x   A   r   r   a   y   "   ,       G   L   .   v   a   o   s   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   n   V   e   r   t   e   x   A   r   r   a   y   s       =       _   g   l   G   e   n   V   e   r   t   e   x   A   r   r   a   y   s   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   n   V   e   r   t   e   x   A   r   r   a   y   s   O   E   S       =       _   g   l   G   e   n   V   e   r   t   e   x   A   r   r   a   y   s   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   n   V   e   r   t   e   x   A   r   r   a   y   s   O   E   S       =       _   g   l   G   e   n   V   e   r   t   e   x   A   r   r   a   y   s   O   E   S   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   n   e   r   a   t   e   M   i   p   m   a   p       =       x   0       =   >       G   L   c   t   x   .   g   e   n   e   r   a   t   e   M   i   p   m   a   p   (   x   0   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   n   e   r   a   t   e   M   i   p   m   a   p       =       _   g   l   G   e   n   e   r   a   t   e   M   i   p   m   a   p   ;   
   
   v   a   r       _   _   g   l   G   e   t   A   c   t   i   v   e   A   t   t   r   i   b   O   r   U   n   i   f   o   r   m       =       (   f   u   n   c   N   a   m   e   ,       p   r   o   g   r   a   m   ,       i   n   d   e   x   ,       b   u   f   S   i   z   e   ,       l   e   n   g   t   h   ,       s   i   z   e   ,       t   y   p   e   ,       n   a   m   e   )       =   >       {   
           p   r   o   g   r   a   m       =       G   L   .   p   r   o   g   r   a   m   s   [   p   r   o   g   r   a   m   ]   ;   
           v   a   r       i   n   f   o       =       G   L   c   t   x   [   f   u   n   c   N   a   m   e   ]   (   p   r   o   g   r   a   m   ,       i   n   d   e   x   )   ;   
           i   f       (   i   n   f   o   )       {   
                   /   /       I   f       a   n       e   r   r   o   r       o   c   c   u   r   s   ,       n   o   t   h   i   n   g       w   i   l   l       b   e       w   r   i   t   t   e   n       t   o       l   e   n   g   t   h   ,       s   i   z   e       a   n   d       t   y   p   e       a   n   d       n   a   m   e   .   
                   v   a   r       n   u   m   B   y   t   e   s   W   r   i   t   t   e   n   E   x   c   l   N   u   l   l       =       n   a   m   e       &   &       s   t   r   i   n   g   T   o   U   T   F   8   (   i   n   f   o   .   n   a   m   e   ,       n   a   m   e   ,       b   u   f   S   i   z   e   )   ;   
                   i   f       (   l   e   n   g   t   h   )       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   l   e   n   g   t   h   )       >   >       2   )   ]       =       n   u   m   B   y   t   e   s   W   r   i   t   t   e   n   E   x   c   l   N   u   l   l   ;   
                   i   f       (   s   i   z   e   )       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   s   i   z   e   )       >   >       2   )   ]       =       i   n   f   o   .   s   i   z   e   ;   
                   i   f       (   t   y   p   e   )       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   t   y   p   e   )       >   >       2   )   ]       =       i   n   f   o   .   t   y   p   e   ;   
           }   
   }   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   A   c   t   i   v   e   A   t   t   r   i   b       =       (   p   r   o   g   r   a   m   ,       i   n   d   e   x   ,       b   u   f   S   i   z   e   ,       l   e   n   g   t   h   ,       s   i   z   e   ,       t   y   p   e   ,       n   a   m   e   )       =   >       _   _   g   l   G   e   t   A   c   t   i   v   e   A   t   t   r   i   b   O   r   U   n   i   f   o   r   m   (   "   g   e   t   A   c   t   i   v   e   A   t   t   r   i   b   "   ,       p   r   o   g   r   a   m   ,       i   n   d   e   x   ,       b   u   f   S   i   z   e   ,       l   e   n   g   t   h   ,       s   i   z   e   ,       t   y   p   e   ,       n   a   m   e   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   A   c   t   i   v   e   A   t   t   r   i   b       =       _   g   l   G   e   t   A   c   t   i   v   e   A   t   t   r   i   b   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   A   c   t   i   v   e   U   n   i   f   o   r   m       =       (   p   r   o   g   r   a   m   ,       i   n   d   e   x   ,       b   u   f   S   i   z   e   ,       l   e   n   g   t   h   ,       s   i   z   e   ,       t   y   p   e   ,       n   a   m   e   )       =   >       _   _   g   l   G   e   t   A   c   t   i   v   e   A   t   t   r   i   b   O   r   U   n   i   f   o   r   m   (   "   g   e   t   A   c   t   i   v   e   U   n   i   f   o   r   m   "   ,       p   r   o   g   r   a   m   ,       i   n   d   e   x   ,       b   u   f   S   i   z   e   ,       l   e   n   g   t   h   ,       s   i   z   e   ,       t   y   p   e   ,       n   a   m   e   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   A   c   t   i   v   e   U   n   i   f   o   r   m       =       _   g   l   G   e   t   A   c   t   i   v   e   U   n   i   f   o   r   m   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   A   c   t   i   v   e   U   n   i   f   o   r   m   B   l   o   c   k   N   a   m   e       =       (   p   r   o   g   r   a   m   ,       u   n   i   f   o   r   m   B   l   o   c   k   I   n   d   e   x   ,       b   u   f   S   i   z   e   ,       l   e   n   g   t   h   ,       u   n   i   f   o   r   m   B   l   o   c   k   N   a   m   e   )       =   >       {   
           p   r   o   g   r   a   m       =       G   L   .   p   r   o   g   r   a   m   s   [   p   r   o   g   r   a   m   ]   ;   
           v   a   r       r   e   s   u   l   t       =       G   L   c   t   x   .   g   e   t   A   c   t   i   v   e   U   n   i   f   o   r   m   B   l   o   c   k   N   a   m   e   (   p   r   o   g   r   a   m   ,       u   n   i   f   o   r   m   B   l   o   c   k   I   n   d   e   x   )   ;   
           i   f       (   !   r   e   s   u   l   t   )       r   e   t   u   r   n   ;   
           /   /       I   f       a   n       e   r   r   o   r       o   c   c   u   r   s   ,       n   o   t   h   i   n   g       w   i   l   l       b   e       w   r   i   t   t   e   n       t   o       u   n   i   f   o   r   m   B   l   o   c   k   N   a   m   e       o   r       l   e   n   g   t   h   .   
           i   f       (   u   n   i   f   o   r   m   B   l   o   c   k   N   a   m   e       &   &       b   u   f   S   i   z   e       >       0   )       {   
                   v   a   r       n   u   m   B   y   t   e   s   W   r   i   t   t   e   n   E   x   c   l   N   u   l   l       =       s   t   r   i   n   g   T   o   U   T   F   8   (   r   e   s   u   l   t   ,       u   n   i   f   o   r   m   B   l   o   c   k   N   a   m   e   ,       b   u   f   S   i   z   e   )   ;   
                   i   f       (   l   e   n   g   t   h   )       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   l   e   n   g   t   h   )       >   >       2   )   ]       =       n   u   m   B   y   t   e   s   W   r   i   t   t   e   n   E   x   c   l   N   u   l   l   ;   
           }       e   l   s   e       {   
                   i   f       (   l   e   n   g   t   h   )       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   l   e   n   g   t   h   )       >   >       2   )   ]       =       0   ;   
           }   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   A   c   t   i   v   e   U   n   i   f   o   r   m   B   l   o   c   k   N   a   m   e       =       _   g   l   G   e   t   A   c   t   i   v   e   U   n   i   f   o   r   m   B   l   o   c   k   N   a   m   e   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   A   c   t   i   v   e   U   n   i   f   o   r   m   B   l   o   c   k   i   v       =       (   p   r   o   g   r   a   m   ,       u   n   i   f   o   r   m   B   l   o   c   k   I   n   d   e   x   ,       p   n   a   m   e   ,       p   a   r   a   m   s   )       =   >       {   
           i   f       (   !   p   a   r   a   m   s   )       {   
                   /   /       G   L   E   S   2       s   p   e   c   i   f   i   c   a   t   i   o   n       d   o   e   s       n   o   t       s   p   e   c   i   f   y       h   o   w       t   o       b   e   h   a   v   e       i   f       p   a   r   a   m   s       i   s       a       n   u   l   l       p   o   i   n   t   e   r   .       S   i   n   c   e       c   a   l   l   i   n   g       t   h   i   s       f   u   n   c   t   i   o   n       d   o   e   s       n   o   t       m   a   k   e       s   e   n   s   e   
                   /   /       i   f       p   a   r   a   m   s       =   =       n   u   l   l   ,       i   s   s   u   e       a       G   L       e   r   r   o   r       t   o       n   o   t   i   f   y       u   s   e   r       a   b   o   u   t       i   t   .   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   1   )   ;   
                   r   e   t   u   r   n   ;   
           }   
           p   r   o   g   r   a   m       =       G   L   .   p   r   o   g   r   a   m   s   [   p   r   o   g   r   a   m   ]   ;   
           i   f       (   p   n   a   m   e       =   =       3   5   3   9   3   )       {   
                   v   a   r       n   a   m   e       =       G   L   c   t   x   .   g   e   t   A   c   t   i   v   e   U   n   i   f   o   r   m   B   l   o   c   k   N   a   m   e   (   p   r   o   g   r   a   m   ,       u   n   i   f   o   r   m   B   l   o   c   k   I   n   d   e   x   )   ;   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   p   a   r   a   m   s   )       >   >       2   )   ]       =       n   a   m   e   .   l   e   n   g   t   h       +       1   ;   
                   r   e   t   u   r   n   ;   
           }   
           v   a   r       r   e   s   u   l   t       =       G   L   c   t   x   .   g   e   t   A   c   t   i   v   e   U   n   i   f   o   r   m   B   l   o   c   k   P   a   r   a   m   e   t   e   r   (   p   r   o   g   r   a   m   ,       u   n   i   f   o   r   m   B   l   o   c   k   I   n   d   e   x   ,       p   n   a   m   e   )   ;   
           i   f       (   r   e   s   u   l   t       =   =   =       n   u   l   l   )       r   e   t   u   r   n   ;   
           /   /       I   f       a   n       e   r   r   o   r       o   c   c   u   r   s   ,       n   o   t   h   i   n   g       s   h   o   u   l   d       b   e       w   r   i   t   t   e   n       t   o       p   a   r   a   m   s   .   
           i   f       (   p   n   a   m   e       =   =       3   5   3   9   5   )       {   
                   f   o   r       (   v   a   r       i       =       0   ;       i       <       r   e   s   u   l   t   .   l   e   n   g   t   h   ;       i   +   +   )       {   
                           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   (   p   a   r   a   m   s   )       +       (   i       *       4   )   )       >   >       2   )   ]       =       r   e   s   u   l   t   [   i   ]   ;   
                   }   
           }       e   l   s   e       {   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   p   a   r   a   m   s   )       >   >       2   )   ]       =       r   e   s   u   l   t   ;   
           }   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   A   c   t   i   v   e   U   n   i   f   o   r   m   B   l   o   c   k   i   v       =       _   g   l   G   e   t   A   c   t   i   v   e   U   n   i   f   o   r   m   B   l   o   c   k   i   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   A   c   t   i   v   e   U   n   i   f   o   r   m   s   i   v       =       (   p   r   o   g   r   a   m   ,       u   n   i   f   o   r   m   C   o   u   n   t   ,       u   n   i   f   o   r   m   I   n   d   i   c   e   s   ,       p   n   a   m   e   ,       p   a   r   a   m   s   )       =   >       {   
           i   f       (   !   p   a   r   a   m   s   )       {   
                   /   /       G   L   E   S   2       s   p   e   c   i   f   i   c   a   t   i   o   n       d   o   e   s       n   o   t       s   p   e   c   i   f   y       h   o   w       t   o       b   e   h   a   v   e       i   f       p   a   r   a   m   s       i   s       a       n   u   l   l       p   o   i   n   t   e   r   .       S   i   n   c   e       c   a   l   l   i   n   g       t   h   i   s       f   u   n   c   t   i   o   n       d   o   e   s       n   o   t       m   a   k   e       s   e   n   s   e   
                   /   /       i   f       p   a   r   a   m   s       =   =       n   u   l   l   ,       i   s   s   u   e       a       G   L       e   r   r   o   r       t   o       n   o   t   i   f   y       u   s   e   r       a   b   o   u   t       i   t   .   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   1   )   ;   
                   r   e   t   u   r   n   ;   
           }   
           i   f       (   u   n   i   f   o   r   m   C   o   u   n   t       >       0       &   &       u   n   i   f   o   r   m   I   n   d   i   c   e   s       =   =       0   )       {   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   1   )   ;   
                   r   e   t   u   r   n   ;   
           }   
           p   r   o   g   r   a   m       =       G   L   .   p   r   o   g   r   a   m   s   [   p   r   o   g   r   a   m   ]   ;   
           v   a   r       i   d   s       =       [   ]   ;   
           f   o   r       (   v   a   r       i       =       0   ;       i       <       u   n   i   f   o   r   m   C   o   u   n   t   ;       i   +   +   )       {   
                   i   d   s   .   p   u   s   h   (   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   (   u   n   i   f   o   r   m   I   n   d   i   c   e   s   )       +       (   i       *       4   )   )       >   >       2   )   ]   )   ;   
           }   
           v   a   r       r   e   s   u   l   t       =       G   L   c   t   x   .   g   e   t   A   c   t   i   v   e   U   n   i   f   o   r   m   s   (   p   r   o   g   r   a   m   ,       i   d   s   ,       p   n   a   m   e   )   ;   
           i   f       (   !   r   e   s   u   l   t   )       r   e   t   u   r   n   ;   
           /   /       G   L       s   p   e   c   :       I   f       a   n       e   r   r   o   r       i   s       g   e   n   e   r   a   t   e   d   ,       n   o   t   h   i   n   g       i   s       w   r   i   t   t   e   n       o   u   t       t   o       p   a   r   a   m   s   .   
           v   a   r       l   e   n       =       r   e   s   u   l   t   .   l   e   n   g   t   h   ;   
           f   o   r       (   v   a   r       i       =       0   ;       i       <       l   e   n   ;       i   +   +   )       {   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   (   p   a   r   a   m   s   )       +       (   i       *       4   )   )       >   >       2   )   ]       =       r   e   s   u   l   t   [   i   ]   ;   
           }   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   A   c   t   i   v   e   U   n   i   f   o   r   m   s   i   v       =       _   g   l   G   e   t   A   c   t   i   v   e   U   n   i   f   o   r   m   s   i   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   A   t   t   a   c   h   e   d   S   h   a   d   e   r   s       =       (   p   r   o   g   r   a   m   ,       m   a   x   C   o   u   n   t   ,       c   o   u   n   t   ,       s   h   a   d   e   r   s   )       =   >       {   
           v   a   r       r   e   s   u   l   t       =       G   L   c   t   x   .   g   e   t   A   t   t   a   c   h   e   d   S   h   a   d   e   r   s   (   G   L   .   p   r   o   g   r   a   m   s   [   p   r   o   g   r   a   m   ]   )   ;   
           v   a   r       l   e   n       =       r   e   s   u   l   t   .   l   e   n   g   t   h   ;   
           i   f       (   l   e   n       >       m   a   x   C   o   u   n   t   )       {   
                   l   e   n       =       m   a   x   C   o   u   n   t   ;   
           }   
           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   c   o   u   n   t   )       >   >       2   )   ]       =       l   e   n   ;   
           f   o   r       (   v   a   r       i       =       0   ;       i       <       l   e   n   ;       +   +   i   )       {   
                   v   a   r       i   d       =       G   L   .   s   h   a   d   e   r   s   .   i   n   d   e   x   O   f   (   r   e   s   u   l   t   [   i   ]   )   ;   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   (   s   h   a   d   e   r   s   )       +       (   i       *       4   )   )       >   >       2   )   ]       =       i   d   ;   
           }   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   A   t   t   a   c   h   e   d   S   h   a   d   e   r   s       =       _   g   l   G   e   t   A   t   t   a   c   h   e   d   S   h   a   d   e   r   s   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   A   t   t   r   i   b   L   o   c   a   t   i   o   n       =       (   p   r   o   g   r   a   m   ,       n   a   m   e   )       =   >       G   L   c   t   x   .   g   e   t   A   t   t   r   i   b   L   o   c   a   t   i   o   n   (   G   L   .   p   r   o   g   r   a   m   s   [   p   r   o   g   r   a   m   ]   ,       U   T   F   8   T   o   S   t   r   i   n   g   (   n   a   m   e   )   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   A   t   t   r   i   b   L   o   c   a   t   i   o   n       =       _   g   l   G   e   t   A   t   t   r   i   b   L   o   c   a   t   i   o   n   ;   
   
   v   a   r       r   e   a   d   I   5   3   F   r   o   m   I   6   4       =       p   t   r       =   >       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   p   t   r   )       >   >       2   )   ]       +       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       
   H   E   A   P   3   2   )   [   (   (   (   p   t   r   )       +       (   4   )   )       >   >       2   )   ]       *       4   2   9   4   9   6   7   2   9   6   ;   
   
   v   a   r       r   e   a   d   I   5   3   F   r   o   m   U   6   4       =       p   t   r       =   >       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   p   t   r   )       >   >       2   )   ]       +       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       
   H   E   A   P   U   3   2   )   [   (   (   (   p   t   r   )       +       (   4   )   )       >   >       2   )   ]       *       4   2   9   4   9   6   7   2   9   6   ;   
   
   v   a   r       w   r   i   t   e   I   5   3   T   o   I   6   4       =       (   p   t   r   ,       n   u   m   )       =   >       {   
           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   p   t   r   )       >   >       2   )   ]       =       n   u   m   ;   
           v   a   r       l   o   w   e   r       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   p   t   r   )       >   >       2   )   ]   ;   
           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   (   p   t   r   )       +       (   4   )   )       >   >       2   )   ]       =       (   n   u   m       -       l   o   w   e   r   )       /       4   2   9   4   9   6   7   2   9   6   ;   
           v   a   r       d   e   s   e   r   i   a   l   i   z   e   d       =       (   n   u   m       >   =       0   )       ?       r   e   a   d   I   5   3   F   r   o   m   U   6   4   (   p   t   r   )       :       r   e   a   d   I   5   3   F   r   o   m   I   6   4   (   p   t   r   )   ;   
           v   a   r       o   f   f   s   e   t       =       (   (   p   t   r   )       >   >       2   )   ;   
           i   f       (   d   e   s   e   r   i   a   l   i   z   e   d       !   =       n   u   m   )       w   a   r   n   O   n   c   e   (   `   w   r   i   t   e   I   5   3   T   o   I   6   4   (   )       o   u   t       o   f       r   a   n   g   e   :       s   e   r   i   a   l   i   z   e   d       J   S       N   u   m   b   e   r       $   {   n   u   m   }       t   o       W   a   s   m       h   e   a   p       a   s       b   y   t   e   s       l   o   =   $   {   p   t   r   T   o   S   t   r   i   n   g   (   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       
           H   E   A   P   U   3   2   )   [   o   f   f   s   e   t   ]   )   }   ,       h   i   =   $   {   p   t   r   T   o   S   t   r   i   n   g   (   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   o   f   f   s   e   t       +       1   ]   )   }   ,       w   h   i   c   h       d   e   s   e   r   i   a   l   i   z   e   s       b   a   c   k       t   o       $   {   d   e   s   e   r   i   a   l   i   z   e   d   }       i   n   s   t   e   a   d   !   `   )   ;   
   }   ;   
   
   v   a   r       w   e   b   g   l   G   e   t   E   x   t   e   n   s   i   o   n   s       =       (   )       =   >       {   
           v   a   r       e   x   t   s       =       g   e   t   E   m   s   c   r   i   p   t   e   n   S   u   p   p   o   r   t   e   d   E   x   t   e   n   s   i   o   n   s   (   G   L   c   t   x   )   ;   
           e   x   t   s       =       e   x   t   s   .   c   o   n   c   a   t   (   e   x   t   s   .   m   a   p   (   e       =   >       "   G   L   _   "       +       e   )   )   ;   
           r   e   t   u   r   n       e   x   t   s   ;   
   }   ;   
   
   v   a   r       e   m   s   c   r   i   p   t   e   n   W   e   b   G   L   G   e   t       =       (   n   a   m   e   _   ,       p   ,       t   y   p   e   )       =   >       {   
           /   /       G   u   a   r   d       a   g   a   i   n   s   t       u   s   e   r       p   a   s   s   i   n   g       a       n   u   l   l       p   o   i   n   t   e   r   .   
           /   /       N   o   t   e       t   h   a   t       G   L   E   S   2       s   p   e   c       d   o   e   s       n   o   t       s   a   y       a   n   y   t   h   i   n   g       a   b   o   u   t       h   o   w       p   a   s   s   i   n   g       a       n   u   l   l   
           /   /       p   o   i   n   t   e   r       s   h   o   u   l   d       b   e       t   r   e   a   t   e   d   .           T   e   s   t   i   n   g       o   n       d   e   s   k   t   o   p       c   o   r   e       G   L       3   ,       t   h   e       a   p   p   l   i   c   a   t   i   o   n   
           /   /       c   r   a   s   h   e   s       o   n       g   l   G   e   t   I   n   t   e   g   e   r   v       t   o       a       n   u   l   l       p   o   i   n   t   e   r   ,       b   u   t       b   e   t   t   e   r       t   o       r   e   p   o   r   t       a   n       e   r   r   o   r   
           /   /       i   n   s   t   e   a   d       o   f       d   o   i   n   g       a   n   y   t   h   i   n   g       r   a   n   d   o   m   .   
           i   f       (   !   p   )       {   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   1   )   ;   
                   r   e   t   u   r   n   ;   
           }   
           v   a   r       r   e   t       =       u   n   d   e   f   i   n   e   d   ;   
           s   w   i   t   c   h       (   n   a   m   e   _   )       {   
               /   /       H   a   n   d   l   e       a       f   e   w       t   r   i   v   i   a   l       G   L   E   S       v   a   l   u   e   s   
                   c   a   s   e       3   6   3   4   6   :   
                   /   /       G   L   _   S   H   A   D   E   R   _   C   O   M   P   I   L   E   R   
                   r   e   t       =       1   ;   
                   b   r   e   a   k   ;   
   
               c   a   s   e       3   6   3   4   4   :   
                   /   /       G   L   _   S   H   A   D   E   R   _   B   I   N   A   R   Y   _   F   O   R   M   A   T   S   
                   i   f       (   t   y   p   e       !   =       0       &   &       t   y   p   e       !   =       1   )       {   
                           G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   0   )   ;   
                   }   
                   /   /       D   o       n   o   t       w   r   i   t   e       a   n   y   t   h   i   n   g       t   o       t   h   e       o   u   t       p   o   i   n   t   e   r   ,       s   i   n   c   e       n   o       b   i   n   a   r   y       f   o   r   m   a   t   s       a   r   e   
                   /   /       s   u   p   p   o   r   t   e   d   .   
                   r   e   t   u   r   n   ;   
   
               c   a   s   e       3   4   8   1   4   :   
               /   /       G   L   _   N   U   M   _   P   R   O   G   R   A   M   _   B   I   N   A   R   Y   _   F   O   R   M   A   T   S   
                   c   a   s   e       3   6   3   4   5   :   
                   /   /       G   L   _   N   U   M   _   S   H   A   D   E   R   _   B   I   N   A   R   Y   _   F   O   R   M   A   T   S   
                   r   e   t       =       0   ;   
                   b   r   e   a   k   ;   
   
               c   a   s   e       3   4   4   6   6   :   
                   /   /       G   L   _   N   U   M   _   C   O   M   P   R   E   S   S   E   D   _   T   E   X   T   U   R   E   _   F   O   R   M   A   T   S   
                   /   /       W   e   b   G   L       d   o   e   s   n   '   t       h   a   v   e       G   L   _   N   U   M   _   C   O   M   P   R   E   S   S   E   D   _   T   E   X   T   U   R   E   _   F   O   R   M   A   T   S       (   i   t   '   s       o   b   s   o   l   e   t   e   
                   /   /       s   i   n   c   e       G   L   _   C   O   M   P   R   E   S   S   E   D   _   T   E   X   T   U   R   E   _   F   O   R   M   A   T   S       r   e   t   u   r   n   s       a       J   S       a   r   r   a   y       t   h   a   t       c   a   n       b   e   
                   /   /       q   u   e   r   i   e   d       f   o   r       l   e   n   g   t   h   )   ,       s   o       i   m   p   l   e   m   e   n   t       i   t       o   u   r   s   e   l   v   e   s       t   o       a   l   l   o   w       C   +   +       G   L   E   S   2   
                   /   /       c   o   d   e       g   e   t       t   h   e       l   e   n   g   t   h   .   
                   v   a   r       f   o   r   m   a   t   s       =       G   L   c   t   x   .   g   e   t   P   a   r   a   m   e   t   e   r   (   3   4   4   6   7   )   ;   
                   r   e   t       =       f   o   r   m   a   t   s       ?       f   o   r   m   a   t   s   .   l   e   n   g   t   h       :       0   ;   
                   b   r   e   a   k   ;   
   
               c   a   s   e       3   3   3   0   9   :   
                   /   /       G   L   _   N   U   M   _   E   X   T   E   N   S   I   O   N   S   
                   i   f       (   G   L   .   c   u   r   r   e   n   t   C   o   n   t   e   x   t   .   v   e   r   s   i   o   n       <       2   )       {   
                           /   /       C   a   l   l   i   n   g       G   L   E   S   3   /   W   e   b   G   L   2       f   u   n   c   t   i   o   n       w   i   t   h       a       G   L   E   S   2   /   W   e   b   G   L   1       c   o   n   t   e   x   t   
                           G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   2   )   ;   
                           r   e   t   u   r   n   ;   
                   }   
                   r   e   t       =       w   e   b   g   l   G   e   t   E   x   t   e   n   s   i   o   n   s   (   )   .   l   e   n   g   t   h   ;   
                   b   r   e   a   k   ;   
   
               c   a   s   e       3   3   3   0   7   :   
               /   /       G   L   _   M   A   J   O   R   _   V   E   R   S   I   O   N   
                   c   a   s   e       3   3   3   0   8   :   
                   /   /       G   L   _   M   I   N   O   R   _   V   E   R   S   I   O   N   
                   i   f       (   G   L   .   c   u   r   r   e   n   t   C   o   n   t   e   x   t   .   v   e   r   s   i   o   n       <       2   )       {   
                           G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   0   )   ;   
                           /   /       G   L   _   I   N   V   A   L   I   D   _   E   N   U   M   
                           r   e   t   u   r   n   ;   
                   }   
                   r   e   t       =       n   a   m   e   _       =   =       3   3   3   0   7       ?       3       :       0   ;   
                   /   /       r   e   t   u   r   n       v   e   r   s   i   o   n       3   .   0   
                   b   r   e   a   k   ;   
           }   
           i   f       (   r   e   t       =   =   =       u   n   d   e   f   i   n   e   d   )       {   
                   v   a   r       r   e   s   u   l   t       =       G   L   c   t   x   .   g   e   t   P   a   r   a   m   e   t   e   r   (   n   a   m   e   _   )   ;   
                   s   w   i   t   c   h       (   t   y   p   e   o   f       r   e   s   u   l   t   )       {   
                       c   a   s   e       "   n   u   m   b   e   r   "   :   
                           r   e   t       =       r   e   s   u   l   t   ;   
                           b   r   e   a   k   ;   
   
                       c   a   s   e       "   b   o   o   l   e   a   n   "   :   
                           r   e   t       =       r   e   s   u   l   t       ?       1       :       0   ;   
                           b   r   e   a   k   ;   
   
                       c   a   s   e       "   s   t   r   i   n   g   "   :   
                           G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   0   )   ;   
                           /   /       G   L   _   I   N   V   A   L   I   D   _   E   N   U   M   
                           r   e   t   u   r   n   ;   
   
                       c   a   s   e       "   o   b   j   e   c   t   "   :   
                           i   f       (   r   e   s   u   l   t       =   =   =       n   u   l   l   )       {   
                                   /   /       n   u   l   l       i   s       a       v   a   l   i   d       r   e   s   u   l   t       f   o   r       s   o   m   e       (   e   .   g   .   ,       w   h   i   c   h       b   u   f   f   e   r       i   s       b   o   u   n   d       -   
                                   /   /       p   e   r   h   a   p   s       n   o   t   h   i   n   g       i   s       b   o   u   n   d   )   ,       b   u   t       o   t   h   e   r   w   i   s   e       c   a   n       m   e   a   n       a   n       i   n   v   a   l   i   d   
                                   /   /       n   a   m   e   _   ,       w   h   i   c   h       w   e       n   e   e   d       t   o       r   e   p   o   r   t       a   s       a   n       e   r   r   o   r   
                                   s   w   i   t   c   h       (   n   a   m   e   _   )       {   
                                       c   a   s   e       3   4   9   6   4   :   
                                       /   /       A   R   R   A   Y   _   B   U   F   F   E   R   _   B   I   N   D   I   N   G   
                                           c   a   s   e       3   5   7   2   5   :   
                                       /   /       C   U   R   R   E   N   T   _   P   R   O   G   R   A   M   
                                           c   a   s   e       3   4   9   6   5   :   
                                       /   /       E   L   E   M   E   N   T   _   A   R   R   A   Y   _   B   U   F   F   E   R   _   B   I   N   D   I   N   G   
                                           c   a   s   e       3   6   0   0   6   :   
                                       /   /       F   R   A   M   E   B   U   F   F   E   R   _   B   I   N   D   I   N   G       o   r       D   R   A   W   _   F   R   A   M   E   B   U   F   F   E   R   _   B   I   N   D   I   N   G   
                                           c   a   s   e       3   6   0   0   7   :   
                                       /   /       R   E   N   D   E   R   B   U   F   F   E   R   _   B   I   N   D   I   N   G   
                                           c   a   s   e       3   2   8   7   3   :   
                                       /   /       T   E   X   T   U   R   E   _   B   I   N   D   I   N   G   _   2   D   
                                           c   a   s   e       3   4   2   2   9   :   
                                       /   /       W   e   b   G   L       2       G   L   _   V   E   R   T   E   X   _   A   R   R   A   Y   _   B   I   N   D   I   N   G   ,       o   r       W   e   b   G   L       1       e   x   t   e   n   s   i   o   n       O   E   S   _   v   e   r   t   e   x   _   a   r   r   a   y   _   o   b   j   e   c   t       G   L   _   V   E   R   T   E   X   _   A   R   R   A   Y   _   B   I   N   D   I   N   G   _   O   E   S   
                                           c   a   s   e       3   6   6   6   2   :   
                                       /   /       C   O   P   Y   _   R   E   A   D   _   B   U   F   F   E   R   _   B   I   N   D   I   N   G       o   r       C   O   P   Y   _   R   E   A   D   _   B   U   F   F   E   R   
                                           c   a   s   e       3   6   6   6   3   :   
                                       /   /       C   O   P   Y   _   W   R   I   T   E   _   B   U   F   F   E   R   _   B   I   N   D   I   N   G       o   r       C   O   P   Y   _   W   R   I   T   E   _   B   U   F   F   E   R   
                                           c   a   s   e       3   5   0   5   3   :   
                                       /   /       P   I   X   E   L   _   P   A   C   K   _   B   U   F   F   E   R   _   B   I   N   D   I   N   G   
                                           c   a   s   e       3   5   0   5   5   :   
                                       /   /       P   I   X   E   L   _   U   N   P   A   C   K   _   B   U   F   F   E   R   _   B   I   N   D   I   N   G   
                                           c   a   s   e       3   6   0   1   0   :   
                                       /   /       R   E   A   D   _   F   R   A   M   E   B   U   F   F   E   R   _   B   I   N   D   I   N   G   
                                           c   a   s   e       3   5   0   9   7   :   
                                       /   /       S   A   M   P   L   E   R   _   B   I   N   D   I   N   G   
                                           c   a   s   e       3   5   8   6   9   :   
                                       /   /       T   E   X   T   U   R   E   _   B   I   N   D   I   N   G   _   2   D   _   A   R   R   A   Y   
                                           c   a   s   e       3   2   8   7   4   :   
                                       /   /       T   E   X   T   U   R   E   _   B   I   N   D   I   N   G   _   3   D   
                                           c   a   s   e       3   6   3   8   9   :   
                                       /   /       T   R   A   N   S   F   O   R   M   _   F   E   E   D   B   A   C   K   _   B   I   N   D   I   N   G   
                                           c   a   s   e       3   5   9   8   3   :   
                                       /   /       T   R   A   N   S   F   O   R   M   _   F   E   E   D   B   A   C   K   _   B   U   F   F   E   R   _   B   I   N   D   I   N   G   
                                           c   a   s   e       3   5   3   6   8   :   
                                       /   /       U   N   I   F   O   R   M   _   B   U   F   F   E   R   _   B   I   N   D   I   N   G   
                                           c   a   s   e       3   4   0   6   8   :   
                                           {   
                                                   /   /       T   E   X   T   U   R   E   _   B   I   N   D   I   N   G   _   C   U   B   E   _   M   A   P   
                                                   r   e   t       =       0   ;   
                                                   b   r   e   a   k   ;   
                                           }   
   
                                       d   e   f   a   u   l   t   :   
                                           {   
                                                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   0   )   ;   
                                                   /   /       G   L   _   I   N   V   A   L   I   D   _   E   N   U   M   
                                                   r   e   t   u   r   n   ;   
                                           }   
                                   }   
                           }       e   l   s   e       i   f       (   r   e   s   u   l   t       i   n   s   t   a   n   c   e   o   f       F   l   o   a   t   3   2   A   r   r   a   y       |   |       r   e   s   u   l   t       i   n   s   t   a   n   c   e   o   f       U   i   n   t   3   2   A   r   r   a   y       |   |       r   e   s   u   l   t       i   n   s   t   a   n   c   e   o   f       I   n   t   3   2   A   r   r   a   y       |   |       r   e   s   u   l   t       i   n   s   t   a   n   c   e   o   f       A   r   r   a   y   )       {   
                                   f   o   r       (   v   a   r       i       =       0   ;       i       <       r   e   s   u   l   t   .   l   e   n   g   t   h   ;       +   +   i   )       {   
                                           s   w   i   t   c   h       (   t   y   p   e   )       {   
                                               c   a   s   e       0   :   
                                                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   (   p   )       +       (   i       *       4   )   )       >   >       2   )   ]       =       r   e   s   u   l   t   [   i   ]   ;   
                                                   b   r   e   a   k   ;   
   
                                               c   a   s   e       2   :   
                                                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   F   3   2   )   [   (   (   (   p   )       +       (   i       *       4   )   )       >   >       2   )   ]       =       r   e   s   u   l   t   [   i   ]   ;   
                                                   b   r   e   a   k   ;   
   
                                               c   a   s   e       4   :   
                                                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   8   )   [   (   p   )       +       (   i   )   ]       =       r   e   s   u   l   t   [   i   ]       ?       1       :       0   ;   
                                                   b   r   e   a   k   ;   
                                           }   
                                   }   
                                   r   e   t   u   r   n   ;   
                           }       e   l   s   e       {   
                                   t   r   y       {   
                                           r   e   t       =       r   e   s   u   l   t   .   n   a   m   e       |       0   ;   
                                   }       c   a   t   c   h       (   e   )       {   
                                           G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   0   )   ;   
                                           /   /       G   L   _   I   N   V   A   L   I   D   _   E   N   U   M   
                                           e   r   r   (   `   G   L   _   I   N   V   A   L   I   D   _   E   N   U   M       i   n       g   l   G   e   t   $   {   t   y   p   e   }   v   :       U   n   k   n   o   w   n       o   b   j   e   c   t       r   e   t   u   r   n   e   d       f   r   o   m       W   e   b   G   L       g   e   t   P   a   r   a   m   e   t   e   r   (   $   {   n   a   m   e   _   }   )   !       (   e   r   r   o   r   :       $   {   e   }   )   `   )   ;   
                                           r   e   t   u   r   n   ;   
                                   }   
                           }   
                           b   r   e   a   k   ;   
   
                       d   e   f   a   u   l   t   :   
                           G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   0   )   ;   
                           /   /       G   L   _   I   N   V   A   L   I   D   _   E   N   U   M   
                           e   r   r   (   `   G   L   _   I   N   V   A   L   I   D   _   E   N   U   M       i   n       g   l   G   e   t   $   {   t   y   p   e   }   v   :       N   a   t   i   v   e       c   o   d   e       c   a   l   l   i   n   g       g   l   G   e   t   $   {   t   y   p   e   }   v   (   $   {   n   a   m   e   _   }   )       a   n   d       i   t       r   e   t   u   r   n   s       $   {   r   e   s   u   l   t   }       o   f       t   y   p   e       $   {   t   y   p   e   o   f       (   r   e   s   u   l   t   )   }   !   `   )   ;   
                           r   e   t   u   r   n   ;   
                   }   
           }   
           s   w   i   t   c   h       (   t   y   p   e   )       {   
               c   a   s   e       1   :   
                   w   r   i   t   e   I   5   3   T   o   I   6   4   (   p   ,       r   e   t   )   ;   
                   b   r   e   a   k   ;   
   
               c   a   s   e       0   :   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   p   )       >   >       2   )   ]       =       r   e   t   ;   
                   b   r   e   a   k   ;   
   
               c   a   s   e       2   :   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   F   3   2   )   [   (   (   p   )       >   >       2   )   ]       =       r   e   t   ;   
                   b   r   e   a   k   ;   
   
               c   a   s   e       4   :   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   8   )   [   p   ]       =       r   e   t       ?       1       :       0   ;   
                   b   r   e   a   k   ;   
           }   
   }   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   B   o   o   l   e   a   n   v       =       (   n   a   m   e   _   ,       p   )       =   >       e   m   s   c   r   i   p   t   e   n   W   e   b   G   L   G   e   t   (   n   a   m   e   _   ,       p   ,       4   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   B   o   o   l   e   a   n   v       =       _   g   l   G   e   t   B   o   o   l   e   a   n   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   B   u   f   f   e   r   P   a   r   a   m   e   t   e   r   i   6   4   v       =       (   t   a   r   g   e   t   ,       v   a   l   u   e   ,       d   a   t   a   )       =   >       {   
           i   f       (   !   d   a   t   a   )       {   
                   /   /       G   L   E   S   2       s   p   e   c   i   f   i   c   a   t   i   o   n       d   o   e   s       n   o   t       s   p   e   c   i   f   y       h   o   w       t   o       b   e   h   a   v   e       i   f       d   a   t   a       i   s       a       n   u   l   l       p   o   i   n   t   e   r   .       S   i   n   c   e       c   a   l   l   i   n   g       t   h   i   s       f   u   n   c   t   i   o   n       d   o   e   s       n   o   t       m   a   k   e       s   e   n   s   e   
                   /   /       i   f       d   a   t   a       =   =       n   u   l   l   ,       i   s   s   u   e       a       G   L       e   r   r   o   r       t   o       n   o   t   i   f   y       u   s   e   r       a   b   o   u   t       i   t   .   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   1   )   ;   
                   r   e   t   u   r   n   ;   
           }   
           w   r   i   t   e   I   5   3   T   o   I   6   4   (   d   a   t   a   ,       G   L   c   t   x   .   g   e   t   B   u   f   f   e   r   P   a   r   a   m   e   t   e   r   (   t   a   r   g   e   t   ,       v   a   l   u   e   )   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   B   u   f   f   e   r   P   a   r   a   m   e   t   e   r   i   6   4   v       =       _   g   l   G   e   t   B   u   f   f   e   r   P   a   r   a   m   e   t   e   r   i   6   4   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   B   u   f   f   e   r   P   a   r   a   m   e   t   e   r   i   v       =       (   t   a   r   g   e   t   ,       v   a   l   u   e   ,       d   a   t   a   )       =   >       {   
           i   f       (   !   d   a   t   a   )       {   
                   /   /       G   L   E   S   2       s   p   e   c   i   f   i   c   a   t   i   o   n       d   o   e   s       n   o   t       s   p   e   c   i   f   y       h   o   w       t   o       b   e   h   a   v   e       i   f       d   a   t   a       i   s       a       n   u   l   l   
                   /   /       p   o   i   n   t   e   r   .       S   i   n   c   e       c   a   l   l   i   n   g       t   h   i   s       f   u   n   c   t   i   o   n       d   o   e   s       n   o   t       m   a   k   e       s   e   n   s   e       i   f       d   a   t   a       =   =   
                   /   /       n   u   l   l   ,       i   s   s   u   e       a       G   L       e   r   r   o   r       t   o       n   o   t   i   f   y       u   s   e   r       a   b   o   u   t       i   t   .   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   1   )   ;   
                   r   e   t   u   r   n   ;   
           }   
           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   d   a   t   a   )       >   >       2   )   ]       =       G   L   c   t   x   .   g   e   t   B   u   f   f   e   r   P   a   r   a   m   e   t   e   r   (   t   a   r   g   e   t   ,       v   a   l   u   e   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   B   u   f   f   e   r   P   a   r   a   m   e   t   e   r   i   v       =       _   g   l   G   e   t   B   u   f   f   e   r   P   a   r   a   m   e   t   e   r   i   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   B   u   f   f   e   r   P   o   i   n   t   e   r   v       =       (   t   a   r   g   e   t   ,       p   n   a   m   e   ,       p   a   r   a   m   s   )       =   >       {   
           i   f       (   p   n   a   m   e       =   =       3   5   0   0   5   )       {   
                   v   a   r       p   t   r       =       0   ;   
                   v   a   r       m   a   p   p   e   d   B   u   f   f   e   r       =       G   L   .   m   a   p   p   e   d   B   u   f   f   e   r   s   [   e   m   s   c   r   i   p   t   e   n   W   e   b   G   L   G   e   t   B   u   f   f   e   r   B   i   n   d   i   n   g   (   t   a   r   g   e   t   )   ]   ;   
                   i   f       (   m   a   p   p   e   d   B   u   f   f   e   r   )       {   
                           p   t   r       =       m   a   p   p   e   d   B   u   f   f   e   r   .   m   e   m   ;   
                   }   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   p   a   r   a   m   s   )       >   >       2   )   ]       =       p   t   r   ;   
           }       e   l   s   e       {   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   0   )   ;   
                   e   r   r   (   "   G   L   _   I   N   V   A   L   I   D   _   E   N   U   M       i   n       g   l   G   e   t   B   u   f   f   e   r   P   o   i   n   t   e   r   v   "   )   ;   
           }   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   B   u   f   f   e   r   P   o   i   n   t   e   r   v       =       _   g   l   G   e   t   B   u   f   f   e   r   P   o   i   n   t   e   r   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   E   r   r   o   r       =       (   )       =   >       {   
           v   a   r       e   r   r   o   r       =       G   L   c   t   x   .   g   e   t   E   r   r   o   r   (   )       |   |       G   L   .   l   a   s   t   E   r   r   o   r   ;   
           G   L   .   l   a   s   t   E   r   r   o   r       =       0   ;   
           r   e   t   u   r   n       e   r   r   o   r   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   E   r   r   o   r       =       _   g   l   G   e   t   E   r   r   o   r   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   F   l   o   a   t   v       =       (   n   a   m   e   _   ,       p   )       =   >       e   m   s   c   r   i   p   t   e   n   W   e   b   G   L   G   e   t   (   n   a   m   e   _   ,       p   ,       2   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   F   l   o   a   t   v       =       _   g   l   G   e   t   F   l   o   a   t   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   F   r   a   g   D   a   t   a   L   o   c   a   t   i   o   n       =       (   p   r   o   g   r   a   m   ,       n   a   m   e   )       =   >       G   L   c   t   x   .   g   e   t   F   r   a   g   D   a   t   a   L   o   c   a   t   i   o   n   (   G   L   .   p   r   o   g   r   a   m   s   [   p   r   o   g   r   a   m   ]   ,       U   T   F   8   T   o   S   t   r   i   n   g   (   n   a   m   e   )   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   F   r   a   g   D   a   t   a   L   o   c   a   t   i   o   n       =       _   g   l   G   e   t   F   r   a   g   D   a   t   a   L   o   c   a   t   i   o   n   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   F   r   a   m   e   b   u   f   f   e   r   A   t   t   a   c   h   m   e   n   t   P   a   r   a   m   e   t   e   r   i   v       =       (   t   a   r   g   e   t   ,       a   t   t   a   c   h   m   e   n   t   ,       p   n   a   m   e   ,       p   a   r   a   m   s   )       =   >       {   
           v   a   r       r   e   s   u   l   t       =       G   L   c   t   x   .   g   e   t   F   r   a   m   e   b   u   f   f   e   r   A   t   t   a   c   h   m   e   n   t   P   a   r   a   m   e   t   e   r   (   t   a   r   g   e   t   ,       a   t   t   a   c   h   m   e   n   t   ,       p   n   a   m   e   )   ;   
           i   f       (   r   e   s   u   l   t       i   n   s   t   a   n   c   e   o   f       W   e   b   G   L   R   e   n   d   e   r   b   u   f   f   e   r       |   |       r   e   s   u   l   t       i   n   s   t   a   n   c   e   o   f       W   e   b   G   L   T   e   x   t   u   r   e   )       {   
                   r   e   s   u   l   t       =       r   e   s   u   l   t   .   n   a   m   e       |       0   ;   
           }   
           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   p   a   r   a   m   s   )       >   >       2   )   ]       =       r   e   s   u   l   t   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   F   r   a   m   e   b   u   f   f   e   r   A   t   t   a   c   h   m   e   n   t   P   a   r   a   m   e   t   e   r   i   v       =       _   g   l   G   e   t   F   r   a   m   e   b   u   f   f   e   r   A   t   t   a   c   h   m   e   n   t   P   a   r   a   m   e   t   e   r   i   v   ;   
   
   v   a   r       e   m   s   c   r   i   p   t   e   n   W   e   b   G   L   G   e   t   I   n   d   e   x   e   d       =       (   t   a   r   g   e   t   ,       i   n   d   e   x   ,       d   a   t   a   ,       t   y   p   e   )       =   >       {   
           i   f       (   !   d   a   t   a   )       {   
                   /   /       G   L   E   S   2       s   p   e   c   i   f   i   c   a   t   i   o   n       d   o   e   s       n   o   t       s   p   e   c   i   f   y       h   o   w       t   o       b   e   h   a   v   e       i   f       d   a   t   a       i   s       a       n   u   l   l       p   o   i   n   t   e   r   .       S   i   n   c   e       c   a   l   l   i   n   g       t   h   i   s       f   u   n   c   t   i   o   n       d   o   e   s       n   o   t       m   a   k   e       s   e   n   s   e   
                   /   /       i   f       d   a   t   a       =   =       n   u   l   l   ,       i   s   s   u   e       a       G   L       e   r   r   o   r       t   o       n   o   t   i   f   y       u   s   e   r       a   b   o   u   t       i   t   .   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   1   )   ;   
                   r   e   t   u   r   n   ;   
           }   
           v   a   r       r   e   s   u   l   t       =       G   L   c   t   x   .   g   e   t   I   n   d   e   x   e   d   P   a   r   a   m   e   t   e   r   (   t   a   r   g   e   t   ,       i   n   d   e   x   )   ;   
           v   a   r       r   e   t   ;   
           s   w   i   t   c   h       (   t   y   p   e   o   f       r   e   s   u   l   t   )       {   
               c   a   s   e       "   b   o   o   l   e   a   n   "   :   
                   r   e   t       =       r   e   s   u   l   t       ?       1       :       0   ;   
                   b   r   e   a   k   ;   
   
               c   a   s   e       "   n   u   m   b   e   r   "   :   
                   r   e   t       =       r   e   s   u   l   t   ;   
                   b   r   e   a   k   ;   
   
               c   a   s   e       "   o   b   j   e   c   t   "   :   
                   i   f       (   r   e   s   u   l   t       =   =   =       n   u   l   l   )       {   
                           s   w   i   t   c   h       (   t   a   r   g   e   t   )       {   
                               c   a   s   e       3   5   9   8   3   :   
                               /   /       T   R   A   N   S   F   O   R   M   _   F   E   E   D   B   A   C   K   _   B   U   F   F   E   R   _   B   I   N   D   I   N   G   
                                   c   a   s   e       3   5   3   6   8   :   
                                   /   /       U   N   I   F   O   R   M   _   B   U   F   F   E   R   _   B   I   N   D   I   N   G   
                                   r   e   t       =       0   ;   
                                   b   r   e   a   k   ;   
   
                               d   e   f   a   u   l   t   :   
                                   {   
                                           G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   0   )   ;   
                                           /   /       G   L   _   I   N   V   A   L   I   D   _   E   N   U   M   
                                           r   e   t   u   r   n   ;   
                                   }   
                           }   
                   }       e   l   s   e       i   f       (   r   e   s   u   l   t       i   n   s   t   a   n   c   e   o   f       W   e   b   G   L   B   u   f   f   e   r   )       {   
                           r   e   t       =       r   e   s   u   l   t   .   n   a   m   e       |       0   ;   
                   }       e   l   s   e       {   
                           G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   0   )   ;   
                           /   /       G   L   _   I   N   V   A   L   I   D   _   E   N   U   M   
                           r   e   t   u   r   n   ;   
                   }   
                   b   r   e   a   k   ;   
   
               d   e   f   a   u   l   t   :   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   0   )   ;   
                   /   /       G   L   _   I   N   V   A   L   I   D   _   E   N   U   M   
                   r   e   t   u   r   n   ;   
           }   
           s   w   i   t   c   h       (   t   y   p   e   )       {   
               c   a   s   e       1   :   
                   w   r   i   t   e   I   5   3   T   o   I   6   4   (   d   a   t   a   ,       r   e   t   )   ;   
                   b   r   e   a   k   ;   
   
               c   a   s   e       0   :   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   d   a   t   a   )       >   >       2   )   ]       =       r   e   t   ;   
                   b   r   e   a   k   ;   
   
               c   a   s   e       2   :   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   F   3   2   )   [   (   (   d   a   t   a   )       >   >       2   )   ]       =       r   e   t   ;   
                   b   r   e   a   k   ;   
   
               c   a   s   e       4   :   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   8   )   [   d   a   t   a   ]       =       r   e   t       ?       1       :       0   ;   
                   b   r   e   a   k   ;   
   
               d   e   f   a   u   l   t   :   
                   t   h   r   o   w       "   i   n   t   e   r   n   a   l       e   m   s   c   r   i   p   t   e   n   W   e   b   G   L   G   e   t   I   n   d   e   x   e   d   (   )       e   r   r   o   r   ,       b   a   d       t   y   p   e   :       "       +       t   y   p   e   ;   
           }   
   }   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   I   n   t   e   g   e   r   6   4   i   _   v       =       (   t   a   r   g   e   t   ,       i   n   d   e   x   ,       d   a   t   a   )       =   >       e   m   s   c   r   i   p   t   e   n   W   e   b   G   L   G   e   t   I   n   d   e   x   e   d   (   t   a   r   g   e   t   ,       i   n   d   e   x   ,       d   a   t   a   ,       1   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   I   n   t   e   g   e   r   6   4   i   _   v       =       _   g   l   G   e   t   I   n   t   e   g   e   r   6   4   i   _   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   I   n   t   e   g   e   r   6   4   v       =       (   n   a   m   e   _   ,       p   )       =   >       {   
           e   m   s   c   r   i   p   t   e   n   W   e   b   G   L   G   e   t   (   n   a   m   e   _   ,       p   ,       1   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   I   n   t   e   g   e   r   6   4   v       =       _   g   l   G   e   t   I   n   t   e   g   e   r   6   4   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   I   n   t   e   g   e   r   i   _   v       =       (   t   a   r   g   e   t   ,       i   n   d   e   x   ,       d   a   t   a   )       =   >       e   m   s   c   r   i   p   t   e   n   W   e   b   G   L   G   e   t   I   n   d   e   x   e   d   (   t   a   r   g   e   t   ,       i   n   d   e   x   ,       d   a   t   a   ,       0   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   I   n   t   e   g   e   r   i   _   v       =       _   g   l   G   e   t   I   n   t   e   g   e   r   i   _   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   I   n   t   e   g   e   r   v       =       (   n   a   m   e   _   ,       p   )       =   >       e   m   s   c   r   i   p   t   e   n   W   e   b   G   L   G   e   t   (   n   a   m   e   _   ,       p   ,       0   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   I   n   t   e   g   e   r   v       =       _   g   l   G   e   t   I   n   t   e   g   e   r   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   I   n   t   e   r   n   a   l   f   o   r   m   a   t   i   v       =       (   t   a   r   g   e   t   ,       i   n   t   e   r   n   a   l   f   o   r   m   a   t   ,       p   n   a   m   e   ,       b   u   f   S   i   z   e   ,       p   a   r   a   m   s   )       =   >       {   
           i   f       (   b   u   f   S   i   z   e       <       0   )       {   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   1   )   ;   
                   r   e   t   u   r   n   ;   
           }   
           i   f       (   !   p   a   r   a   m   s   )       {   
                   /   /       G   L   E   S   3       s   p   e   c   i   f   i   c   a   t   i   o   n       d   o   e   s       n   o   t       s   p   e   c   i   f   y       h   o   w       t   o       b   e   h   a   v   e       i   f       v   a   l   u   e   s       i   s       a       n   u   l   l       p   o   i   n   t   e   r   .       S   i   n   c   e       c   a   l   l   i   n   g       t   h   i   s       f   u   n   c   t   i   o   n       d   o   e   s       n   o   t       m   a   k   e       s   e   n   s   e   
                   /   /       i   f       v   a   l   u   e   s       =   =       n   u   l   l   ,       i   s   s   u   e       a       G   L       e   r   r   o   r       t   o       n   o   t   i   f   y       u   s   e   r       a   b   o   u   t       i   t   .   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   1   )   ;   
                   r   e   t   u   r   n   ;   
           }   
           v   a   r       r   e   t       =       G   L   c   t   x   .   g   e   t   I   n   t   e   r   n   a   l   f   o   r   m   a   t   P   a   r   a   m   e   t   e   r   (   t   a   r   g   e   t   ,       i   n   t   e   r   n   a   l   f   o   r   m   a   t   ,       p   n   a   m   e   )   ;   
           i   f       (   r   e   t       =   =   =       n   u   l   l   )       r   e   t   u   r   n   ;   
           f   o   r       (   v   a   r       i       =       0   ;       i       <       r   e   t   .   l   e   n   g   t   h       &   &       i       <       b   u   f   S   i   z   e   ;       +   +   i   )       {   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   (   p   a   r   a   m   s   )       +       (   i       *       4   )   )       >   >       2   )   ]       =       r   e   t   [   i   ]   ;   
           }   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   I   n   t   e   r   n   a   l   f   o   r   m   a   t   i   v       =       _   g   l   G   e   t   I   n   t   e   r   n   a   l   f   o   r   m   a   t   i   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   P   r   o   g   r   a   m   B   i   n   a   r   y       =       (   p   r   o   g   r   a   m   ,       b   u   f   S   i   z   e   ,       l   e   n   g   t   h   ,       b   i   n   a   r   y   F   o   r   m   a   t   ,       b   i   n   a   r   y   )       =   >       {   
           G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   2   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   P   r   o   g   r   a   m   B   i   n   a   r   y       =       _   g   l   G   e   t   P   r   o   g   r   a   m   B   i   n   a   r   y   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   P   r   o   g   r   a   m   I   n   f   o   L   o   g       =       (   p   r   o   g   r   a   m   ,       m   a   x   L   e   n   g   t   h   ,       l   e   n   g   t   h   ,       i   n   f   o   L   o   g   )       =   >       {   
           v   a   r       l   o   g       =       G   L   c   t   x   .   g   e   t   P   r   o   g   r   a   m   I   n   f   o   L   o   g   (   G   L   .   p   r   o   g   r   a   m   s   [   p   r   o   g   r   a   m   ]   )   ;   
           i   f       (   l   o   g       =   =   =       n   u   l   l   )       l   o   g       =       "   (   u   n   k   n   o   w   n       e   r   r   o   r   )   "   ;   
           v   a   r       n   u   m   B   y   t   e   s   W   r   i   t   t   e   n   E   x   c   l   N   u   l   l       =       (   m   a   x   L   e   n   g   t   h       >       0       &   &       i   n   f   o   L   o   g   )       ?       s   t   r   i   n   g   T   o   U   T   F   8   (   l   o   g   ,       i   n   f   o   L   o   g   ,       m   a   x   L   e   n   g   t   h   )       :       0   ;   
           i   f       (   l   e   n   g   t   h   )       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   l   e   n   g   t   h   )       >   >       2   )   ]       =       n   u   m   B   y   t   e   s   W   r   i   t   t   e   n   E   x   c   l   N   u   l   l   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   P   r   o   g   r   a   m   I   n   f   o   L   o   g       =       _   g   l   G   e   t   P   r   o   g   r   a   m   I   n   f   o   L   o   g   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   P   r   o   g   r   a   m   i   v       =       (   p   r   o   g   r   a   m   ,       p   n   a   m   e   ,       p   )       =   >       {   
           i   f       (   !   p   )       {   
                   /   /       G   L   E   S   2       s   p   e   c   i   f   i   c   a   t   i   o   n       d   o   e   s       n   o   t       s   p   e   c   i   f   y       h   o   w       t   o       b   e   h   a   v   e       i   f       p       i   s       a       n   u   l   l   
                   /   /       p   o   i   n   t   e   r   .       S   i   n   c   e       c   a   l   l   i   n   g       t   h   i   s       f   u   n   c   t   i   o   n       d   o   e   s       n   o   t       m   a   k   e       s   e   n   s   e       i   f       p       =   =       n   u   l   l   ,   
                   /   /       i   s   s   u   e       a       G   L       e   r   r   o   r       t   o       n   o   t   i   f   y       u   s   e   r       a   b   o   u   t       i   t   .   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   1   )   ;   
                   r   e   t   u   r   n   ;   
           }   
           i   f       (   p   r   o   g   r   a   m       >   =       G   L   .   c   o   u   n   t   e   r   )       {   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   1   )   ;   
                   r   e   t   u   r   n   ;   
           }   
           p   r   o   g   r   a   m       =       G   L   .   p   r   o   g   r   a   m   s   [   p   r   o   g   r   a   m   ]   ;   
           i   f       (   p   n   a   m   e       =   =       3   5   7   1   6   )       {   
                   /   /       G   L   _   I   N   F   O   _   L   O   G   _   L   E   N   G   T   H   
                   v   a   r       l   o   g       =       G   L   c   t   x   .   g   e   t   P   r   o   g   r   a   m   I   n   f   o   L   o   g   (   p   r   o   g   r   a   m   )   ;   
                   i   f       (   l   o   g       =   =   =       n   u   l   l   )       l   o   g       =       "   (   u   n   k   n   o   w   n       e   r   r   o   r   )   "   ;   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   p   )       >   >       2   )   ]       =       l   o   g   .   l   e   n   g   t   h       +       1   ;   
           }       e   l   s   e       i   f       (   p   n   a   m   e       =   =       3   5   7   1   9   )       {   
                   i   f       (   !   p   r   o   g   r   a   m   .   m   a   x   U   n   i   f   o   r   m   L   e   n   g   t   h   )       {   
                           v   a   r       n   u   m   A   c   t   i   v   e   U   n   i   f   o   r   m   s       =       G   L   c   t   x   .   g   e   t   P   r   o   g   r   a   m   P   a   r   a   m   e   t   e   r   (   p   r   o   g   r   a   m   ,       3   5   7   1   8   )   ;   
                           f   o   r       (   v   a   r       i       =       0   ;       i       <       n   u   m   A   c   t   i   v   e   U   n   i   f   o   r   m   s   ;       +   +   i   )       {   
                                   p   r   o   g   r   a   m   .   m   a   x   U   n   i   f   o   r   m   L   e   n   g   t   h       =       M   a   t   h   .   m   a   x   (   p   r   o   g   r   a   m   .   m   a   x   U   n   i   f   o   r   m   L   e   n   g   t   h   ,       G   L   c   t   x   .   g   e   t   A   c   t   i   v   e   U   n   i   f   o   r   m   (   p   r   o   g   r   a   m   ,       i   )   .   n   a   m   e   .   l   e   n   g   t   h       +       1   )   ;   
                           }   
                   }   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   p   )       >   >       2   )   ]       =       p   r   o   g   r   a   m   .   m   a   x   U   n   i   f   o   r   m   L   e   n   g   t   h   ;   
           }       e   l   s   e       i   f       (   p   n   a   m   e       =   =       3   5   7   2   2   )       {   
                   i   f       (   !   p   r   o   g   r   a   m   .   m   a   x   A   t   t   r   i   b   u   t   e   L   e   n   g   t   h   )       {   
                           v   a   r       n   u   m   A   c   t   i   v   e   A   t   t   r   i   b   u   t   e   s       =       G   L   c   t   x   .   g   e   t   P   r   o   g   r   a   m   P   a   r   a   m   e   t   e   r   (   p   r   o   g   r   a   m   ,       3   5   7   2   1   )   ;   
                           f   o   r       (   v   a   r       i       =       0   ;       i       <       n   u   m   A   c   t   i   v   e   A   t   t   r   i   b   u   t   e   s   ;       +   +   i   )       {   
                                   p   r   o   g   r   a   m   .   m   a   x   A   t   t   r   i   b   u   t   e   L   e   n   g   t   h       =       M   a   t   h   .   m   a   x   (   p   r   o   g   r   a   m   .   m   a   x   A   t   t   r   i   b   u   t   e   L   e   n   g   t   h   ,       G   L   c   t   x   .   g   e   t   A   c   t   i   v   e   A   t   t   r   i   b   (   p   r   o   g   r   a   m   ,       i   )   .   n   a   m   e   .   l   e   n   g   t   h       +       1   )   ;   
                           }   
                   }   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   p   )       >   >       2   )   ]       =       p   r   o   g   r   a   m   .   m   a   x   A   t   t   r   i   b   u   t   e   L   e   n   g   t   h   ;   
           }       e   l   s   e       i   f       (   p   n   a   m   e       =   =       3   5   3   8   1   )       {   
                   i   f       (   !   p   r   o   g   r   a   m   .   m   a   x   U   n   i   f   o   r   m   B   l   o   c   k   N   a   m   e   L   e   n   g   t   h   )       {   
                           v   a   r       n   u   m   A   c   t   i   v   e   U   n   i   f   o   r   m   B   l   o   c   k   s       =       G   L   c   t   x   .   g   e   t   P   r   o   g   r   a   m   P   a   r   a   m   e   t   e   r   (   p   r   o   g   r   a   m   ,       3   5   3   8   2   )   ;   
                           f   o   r       (   v   a   r       i       =       0   ;       i       <       n   u   m   A   c   t   i   v   e   U   n   i   f   o   r   m   B   l   o   c   k   s   ;       +   +   i   )       {   
                                   p   r   o   g   r   a   m   .   m   a   x   U   n   i   f   o   r   m   B   l   o   c   k   N   a   m   e   L   e   n   g   t   h       =       M   a   t   h   .   m   a   x   (   p   r   o   g   r   a   m   .   m   a   x   U   n   i   f   o   r   m   B   l   o   c   k   N   a   m   e   L   e   n   g   t   h   ,       G   L   c   t   x   .   g   e   t   A   c   t   i   v   e   U   n   i   f   o   r   m   B   l   o   c   k   N   a   m   e   (   p   r   o   g   r   a   m   ,       i   )   .   l   e   n   g   t   h       +       1   )   ;   
                           }   
                   }   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   p   )       >   >       2   )   ]       =       p   r   o   g   r   a   m   .   m   a   x   U   n   i   f   o   r   m   B   l   o   c   k   N   a   m   e   L   e   n   g   t   h   ;   
           }       e   l   s   e       {   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   p   )       >   >       2   )   ]       =       G   L   c   t   x   .   g   e   t   P   r   o   g   r   a   m   P   a   r   a   m   e   t   e   r   (   p   r   o   g   r   a   m   ,       p   n   a   m   e   )   ;   
           }   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   P   r   o   g   r   a   m   i   v       =       _   g   l   G   e   t   P   r   o   g   r   a   m   i   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   Q   u   e   r   y   O   b   j   e   c   t   i   6   4   v   E   X   T       =       (   i   d   ,       p   n   a   m   e   ,       p   a   r   a   m   s   )       =   >       {   
           i   f       (   !   p   a   r   a   m   s   )       {   
                   /   /       G   L   E   S   2       s   p   e   c   i   f   i   c   a   t   i   o   n       d   o   e   s       n   o   t       s   p   e   c   i   f   y       h   o   w       t   o       b   e   h   a   v   e       i   f       p   a   r   a   m   s       i   s       a       n   u   l   l       p   o   i   n   t   e   r   .       S   i   n   c   e       c   a   l   l   i   n   g       t   h   i   s       f   u   n   c   t   i   o   n       d   o   e   s       n   o   t       m   a   k   e       s   e   n   s   e   
                   /   /       i   f       p       =   =       n   u   l   l   ,       i   s   s   u   e       a       G   L       e   r   r   o   r       t   o       n   o   t   i   f   y       u   s   e   r       a   b   o   u   t       i   t   .   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   1   )   ;   
                   r   e   t   u   r   n   ;   
           }   
           v   a   r       q   u   e   r   y       =       G   L   .   q   u   e   r   i   e   s   [   i   d   ]   ;   
           v   a   r       p   a   r   a   m   ;   
           i   f       (   G   L   .   c   u   r   r   e   n   t   C   o   n   t   e   x   t   .   v   e   r   s   i   o   n       <       2   )       {   
                   p   a   r   a   m       =       G   L   c   t   x   .   d   i   s   j   o   i   n   t   T   i   m   e   r   Q   u   e   r   y   E   x   t   [   "   g   e   t   Q   u   e   r   y   O   b   j   e   c   t   E   X   T   "   ]   (   q   u   e   r   y   ,       p   n   a   m   e   )   ;   
           }       e   l   s   e       {   
                   p   a   r   a   m       =       G   L   c   t   x   .   g   e   t   Q   u   e   r   y   P   a   r   a   m   e   t   e   r   (   q   u   e   r   y   ,       p   n   a   m   e   )   ;   
           }   
           v   a   r       r   e   t   ;   
           i   f       (   t   y   p   e   o   f       p   a   r   a   m       =   =       "   b   o   o   l   e   a   n   "   )       {   
                   r   e   t       =       p   a   r   a   m       ?       1       :       0   ;   
           }       e   l   s   e       {   
                   r   e   t       =       p   a   r   a   m   ;   
           }   
           w   r   i   t   e   I   5   3   T   o   I   6   4   (   p   a   r   a   m   s   ,       r   e   t   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   Q   u   e   r   y   O   b   j   e   c   t   i   6   4   v   E   X   T       =       _   g   l   G   e   t   Q   u   e   r   y   O   b   j   e   c   t   i   6   4   v   E   X   T   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   Q   u   e   r   y   O   b   j   e   c   t   i   v   E   X   T       =       (   i   d   ,       p   n   a   m   e   ,       p   a   r   a   m   s   )       =   >       {   
           i   f       (   !   p   a   r   a   m   s   )       {   
                   /   /       G   L   E   S   2       s   p   e   c   i   f   i   c   a   t   i   o   n       d   o   e   s       n   o   t       s   p   e   c   i   f   y       h   o   w       t   o       b   e   h   a   v   e       i   f       p   a   r   a   m   s       i   s       a       n   u   l   l       p   o   i   n   t   e   r   .       S   i   n   c   e       c   a   l   l   i   n   g       t   h   i   s       f   u   n   c   t   i   o   n       d   o   e   s       n   o   t       m   a   k   e       s   e   n   s   e   
                   /   /       i   f       p       =   =       n   u   l   l   ,       i   s   s   u   e       a       G   L       e   r   r   o   r       t   o       n   o   t   i   f   y       u   s   e   r       a   b   o   u   t       i   t   .   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   1   )   ;   
                   r   e   t   u   r   n   ;   
           }   
           v   a   r       q   u   e   r   y       =       G   L   .   q   u   e   r   i   e   s   [   i   d   ]   ;   
           v   a   r       p   a   r   a   m       =       G   L   c   t   x   .   d   i   s   j   o   i   n   t   T   i   m   e   r   Q   u   e   r   y   E   x   t   [   "   g   e   t   Q   u   e   r   y   O   b   j   e   c   t   E   X   T   "   ]   (   q   u   e   r   y   ,       p   n   a   m   e   )   ;   
           v   a   r       r   e   t   ;   
           i   f       (   t   y   p   e   o   f       p   a   r   a   m       =   =       "   b   o   o   l   e   a   n   "   )       {   
                   r   e   t       =       p   a   r   a   m       ?       1       :       0   ;   
           }       e   l   s   e       {   
                   r   e   t       =       p   a   r   a   m   ;   
           }   
           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   p   a   r   a   m   s   )       >   >       2   )   ]       =       r   e   t   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   Q   u   e   r   y   O   b   j   e   c   t   i   v   E   X   T       =       _   g   l   G   e   t   Q   u   e   r   y   O   b   j   e   c   t   i   v   E   X   T   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   Q   u   e   r   y   O   b   j   e   c   t   u   i   6   4   v   E   X   T       =       _   g   l   G   e   t   Q   u   e   r   y   O   b   j   e   c   t   i   6   4   v   E   X   T   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   Q   u   e   r   y   O   b   j   e   c   t   u   i   6   4   v   E   X   T       =       _   g   l   G   e   t   Q   u   e   r   y   O   b   j   e   c   t   u   i   6   4   v   E   X   T   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   Q   u   e   r   y   O   b   j   e   c   t   u   i   v       =       (   i   d   ,       p   n   a   m   e   ,       p   a   r   a   m   s   )       =   >       {   
           i   f       (   !   p   a   r   a   m   s   )       {   
                   /   /       G   L   E   S   2       s   p   e   c   i   f   i   c   a   t   i   o   n       d   o   e   s       n   o   t       s   p   e   c   i   f   y       h   o   w       t   o       b   e   h   a   v   e       i   f       p   a   r   a   m   s       i   s       a       n   u   l   l       p   o   i   n   t   e   r   .       S   i   n   c   e       c   a   l   l   i   n   g       t   h   i   s       f   u   n   c   t   i   o   n       d   o   e   s       n   o   t       m   a   k   e       s   e   n   s   e   
                   /   /       i   f       p       =   =       n   u   l   l   ,       i   s   s   u   e       a       G   L       e   r   r   o   r       t   o       n   o   t   i   f   y       u   s   e   r       a   b   o   u   t       i   t   .   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   1   )   ;   
                   r   e   t   u   r   n   ;   
           }   
           v   a   r       q   u   e   r   y       =       G   L   .   q   u   e   r   i   e   s   [   i   d   ]   ;   
           v   a   r       p   a   r   a   m       =       G   L   c   t   x   .   g   e   t   Q   u   e   r   y   P   a   r   a   m   e   t   e   r   (   q   u   e   r   y   ,       p   n   a   m   e   )   ;   
           v   a   r       r   e   t   ;   
           i   f       (   t   y   p   e   o   f       p   a   r   a   m       =   =       "   b   o   o   l   e   a   n   "   )       {   
                   r   e   t       =       p   a   r   a   m       ?       1       :       0   ;   
           }       e   l   s   e       {   
                   r   e   t       =       p   a   r   a   m   ;   
           }   
           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   p   a   r   a   m   s   )       >   >       2   )   ]       =       r   e   t   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   Q   u   e   r   y   O   b   j   e   c   t   u   i   v       =       _   g   l   G   e   t   Q   u   e   r   y   O   b   j   e   c   t   u   i   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   Q   u   e   r   y   O   b   j   e   c   t   u   i   v   E   X   T       =       _   g   l   G   e   t   Q   u   e   r   y   O   b   j   e   c   t   i   v   E   X   T   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   Q   u   e   r   y   O   b   j   e   c   t   u   i   v   E   X   T       =       _   g   l   G   e   t   Q   u   e   r   y   O   b   j   e   c   t   u   i   v   E   X   T   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   Q   u   e   r   y   i   v       =       (   t   a   r   g   e   t   ,       p   n   a   m   e   ,       p   a   r   a   m   s   )       =   >       {   
           i   f       (   !   p   a   r   a   m   s   )       {   
                   /   /       G   L   E   S   2       s   p   e   c   i   f   i   c   a   t   i   o   n       d   o   e   s       n   o   t       s   p   e   c   i   f   y       h   o   w       t   o       b   e   h   a   v   e       i   f       p   a   r   a   m   s       i   s       a       n   u   l   l       p   o   i   n   t   e   r   .       S   i   n   c   e       c   a   l   l   i   n   g       t   h   i   s       f   u   n   c   t   i   o   n       d   o   e   s       n   o   t       m   a   k   e       s   e   n   s   e   
                   /   /       i   f       p       =   =       n   u   l   l   ,       i   s   s   u   e       a       G   L       e   r   r   o   r       t   o       n   o   t   i   f   y       u   s   e   r       a   b   o   u   t       i   t   .   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   1   )   ;   
                   r   e   t   u   r   n   ;   
           }   
           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   p   a   r   a   m   s   )       >   >       2   )   ]       =       G   L   c   t   x   .   g   e   t   Q   u   e   r   y   (   t   a   r   g   e   t   ,       p   n   a   m   e   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   Q   u   e   r   y   i   v       =       _   g   l   G   e   t   Q   u   e   r   y   i   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   Q   u   e   r   y   i   v   E   X   T       =       (   t   a   r   g   e   t   ,       p   n   a   m   e   ,       p   a   r   a   m   s   )       =   >       {   
           i   f       (   !   p   a   r   a   m   s   )       {   
                   /   /       G   L   E   S   2       s   p   e   c   i   f   i   c   a   t   i   o   n       d   o   e   s       n   o   t       s   p   e   c   i   f   y       h   o   w       t   o       b   e   h   a   v   e       i   f       p   a   r   a   m   s       i   s       a       n   u   l   l       p   o   i   n   t   e   r   .       S   i   n   c   e       c   a   l   l   i   n   g       t   h   i   s       f   u   n   c   t   i   o   n       d   o   e   s       n   o   t       m   a   k   e       s   e   n   s   e   
                   /   /       i   f       p       =   =       n   u   l   l   ,       i   s   s   u   e       a       G   L       e   r   r   o   r       t   o       n   o   t   i   f   y       u   s   e   r       a   b   o   u   t       i   t   .   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   1   )   ;   
                   r   e   t   u   r   n   ;   
           }   
           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   p   a   r   a   m   s   )       >   >       2   )   ]       =       G   L   c   t   x   .   d   i   s   j   o   i   n   t   T   i   m   e   r   Q   u   e   r   y   E   x   t   [   "   g   e   t   Q   u   e   r   y   E   X   T   "   ]   (   t   a   r   g   e   t   ,       p   n   a   m   e   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   Q   u   e   r   y   i   v   E   X   T       =       _   g   l   G   e   t   Q   u   e   r   y   i   v   E   X   T   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   R   e   n   d   e   r   b   u   f   f   e   r   P   a   r   a   m   e   t   e   r   i   v       =       (   t   a   r   g   e   t   ,       p   n   a   m   e   ,       p   a   r   a   m   s   )       =   >       {   
           i   f       (   !   p   a   r   a   m   s   )       {   
                   /   /       G   L   E   S   2       s   p   e   c   i   f   i   c   a   t   i   o   n       d   o   e   s       n   o   t       s   p   e   c   i   f   y       h   o   w       t   o       b   e   h   a   v   e       i   f       p   a   r   a   m   s       i   s       a       n   u   l   l       p   o   i   n   t   e   r   .       S   i   n   c   e       c   a   l   l   i   n   g       t   h   i   s       f   u   n   c   t   i   o   n       d   o   e   s       n   o   t       m   a   k   e       s   e   n   s   e   
                   /   /       i   f       p   a   r   a   m   s       =   =       n   u   l   l   ,       i   s   s   u   e       a       G   L       e   r   r   o   r       t   o       n   o   t   i   f   y       u   s   e   r       a   b   o   u   t       i   t   .   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   1   )   ;   
                   r   e   t   u   r   n   ;   
           }   
           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   p   a   r   a   m   s   )       >   >       2   )   ]       =       G   L   c   t   x   .   g   e   t   R   e   n   d   e   r   b   u   f   f   e   r   P   a   r   a   m   e   t   e   r   (   t   a   r   g   e   t   ,       p   n   a   m   e   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   R   e   n   d   e   r   b   u   f   f   e   r   P   a   r   a   m   e   t   e   r   i   v       =       _   g   l   G   e   t   R   e   n   d   e   r   b   u   f   f   e   r   P   a   r   a   m   e   t   e   r   i   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   S   a   m   p   l   e   r   P   a   r   a   m   e   t   e   r   f   v       =       (   s   a   m   p   l   e   r   ,       p   n   a   m   e   ,       p   a   r   a   m   s   )       =   >       {   
           i   f       (   !   p   a   r   a   m   s   )       {   
                   /   /       G   L   E   S   3       s   p   e   c   i   f   i   c   a   t   i   o   n       d   o   e   s       n   o   t       s   p   e   c   i   f   y       h   o   w       t   o       b   e   h   a   v   e       i   f       p   a   r   a   m   s       i   s       a       n   u   l   l       p   o   i   n   t   e   r   .       S   i   n   c   e       c   a   l   l   i   n   g       t   h   i   s       f   u   n   c   t   i   o   n       d   o   e   s       n   o   t       m   a   k   e       s   e   n   s   e   
                   /   /       i   f       p       =   =       n   u   l   l   ,       i   s   s   u   e       a       G   L       e   r   r   o   r       t   o       n   o   t   i   f   y       u   s   e   r       a   b   o   u   t       i   t   .   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   1   )   ;   
                   r   e   t   u   r   n   ;   
           }   
           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   F   3   2   )   [   (   (   p   a   r   a   m   s   )       >   >       2   )   ]       =       G   L   c   t   x   .   g   e   t   S   a   m   p   l   e   r   P   a   r   a   m   e   t   e   r   (   G   L   .   s   a   m   p   l   e   r   s   [   s   a   m   p   l   e   r   ]   ,       p   n   a   m   e   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   S   a   m   p   l   e   r   P   a   r   a   m   e   t   e   r   f   v       =       _   g   l   G   e   t   S   a   m   p   l   e   r   P   a   r   a   m   e   t   e   r   f   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   S   a   m   p   l   e   r   P   a   r   a   m   e   t   e   r   i   v       =       (   s   a   m   p   l   e   r   ,       p   n   a   m   e   ,       p   a   r   a   m   s   )       =   >       {   
           i   f       (   !   p   a   r   a   m   s   )       {   
                   /   /       G   L   E   S   3       s   p   e   c   i   f   i   c   a   t   i   o   n       d   o   e   s       n   o   t       s   p   e   c   i   f   y       h   o   w       t   o       b   e   h   a   v   e       i   f       p   a   r   a   m   s       i   s       a       n   u   l   l       p   o   i   n   t   e   r   .       S   i   n   c   e       c   a   l   l   i   n   g       t   h   i   s       f   u   n   c   t   i   o   n       d   o   e   s       n   o   t       m   a   k   e       s   e   n   s   e   
                   /   /       i   f       p       =   =       n   u   l   l   ,       i   s   s   u   e       a       G   L       e   r   r   o   r       t   o       n   o   t   i   f   y       u   s   e   r       a   b   o   u   t       i   t   .   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   1   )   ;   
                   r   e   t   u   r   n   ;   
           }   
           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   p   a   r   a   m   s   )       >   >       2   )   ]       =       G   L   c   t   x   .   g   e   t   S   a   m   p   l   e   r   P   a   r   a   m   e   t   e   r   (   G   L   .   s   a   m   p   l   e   r   s   [   s   a   m   p   l   e   r   ]   ,       p   n   a   m   e   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   S   a   m   p   l   e   r   P   a   r   a   m   e   t   e   r   i   v       =       _   g   l   G   e   t   S   a   m   p   l   e   r   P   a   r   a   m   e   t   e   r   i   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   S   h   a   d   e   r   I   n   f   o   L   o   g       =       (   s   h   a   d   e   r   ,       m   a   x   L   e   n   g   t   h   ,       l   e   n   g   t   h   ,       i   n   f   o   L   o   g   )       =   >       {   
           v   a   r       l   o   g       =       G   L   c   t   x   .   g   e   t   S   h   a   d   e   r   I   n   f   o   L   o   g   (   G   L   .   s   h   a   d   e   r   s   [   s   h   a   d   e   r   ]   )   ;   
           i   f       (   l   o   g       =   =   =       n   u   l   l   )       l   o   g       =       "   (   u   n   k   n   o   w   n       e   r   r   o   r   )   "   ;   
           v   a   r       n   u   m   B   y   t   e   s   W   r   i   t   t   e   n   E   x   c   l   N   u   l   l       =       (   m   a   x   L   e   n   g   t   h       >       0       &   &       i   n   f   o   L   o   g   )       ?       s   t   r   i   n   g   T   o   U   T   F   8   (   l   o   g   ,       i   n   f   o   L   o   g   ,       m   a   x   L   e   n   g   t   h   )       :       0   ;   
           i   f       (   l   e   n   g   t   h   )       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   l   e   n   g   t   h   )       >   >       2   )   ]       =       n   u   m   B   y   t   e   s   W   r   i   t   t   e   n   E   x   c   l   N   u   l   l   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   S   h   a   d   e   r   I   n   f   o   L   o   g       =       _   g   l   G   e   t   S   h   a   d   e   r   I   n   f   o   L   o   g   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   S   h   a   d   e   r   P   r   e   c   i   s   i   o   n   F   o   r   m   a   t       =       (   s   h   a   d   e   r   T   y   p   e   ,       p   r   e   c   i   s   i   o   n   T   y   p   e   ,       r   a   n   g   e   ,       p   r   e   c   i   s   i   o   n   )       =   >       {   
           v   a   r       r   e   s   u   l   t       =       G   L   c   t   x   .   g   e   t   S   h   a   d   e   r   P   r   e   c   i   s   i   o   n   F   o   r   m   a   t   (   s   h   a   d   e   r   T   y   p   e   ,       p   r   e   c   i   s   i   o   n   T   y   p   e   )   ;   
           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   r   a   n   g   e   )       >   >       2   )   ]       =       r   e   s   u   l   t   .   r   a   n   g   e   M   i   n   ;   
           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   (   r   a   n   g   e   )       +       (   4   )   )       >   >       2   )   ]       =       r   e   s   u   l   t   .   r   a   n   g   e   M   a   x   ;   
           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   p   r   e   c   i   s   i   o   n   )       >   >       2   )   ]       =       r   e   s   u   l   t   .   p   r   e   c   i   s   i   o   n   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   S   h   a   d   e   r   P   r   e   c   i   s   i   o   n   F   o   r   m   a   t       =       _   g   l   G   e   t   S   h   a   d   e   r   P   r   e   c   i   s   i   o   n   F   o   r   m   a   t   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   S   h   a   d   e   r   S   o   u   r   c   e       =       (   s   h   a   d   e   r   ,       b   u   f   S   i   z   e   ,       l   e   n   g   t   h   ,       s   o   u   r   c   e   )       =   >       {   
           v   a   r       r   e   s   u   l   t       =       G   L   c   t   x   .   g   e   t   S   h   a   d   e   r   S   o   u   r   c   e   (   G   L   .   s   h   a   d   e   r   s   [   s   h   a   d   e   r   ]   )   ;   
           i   f       (   !   r   e   s   u   l   t   )       r   e   t   u   r   n   ;   
           /   /       I   f       a   n       e   r   r   o   r       o   c   c   u   r   s   ,       n   o   t   h   i   n   g       w   i   l   l       b   e       w   r   i   t   t   e   n       t   o       l   e   n   g   t   h       o   r       s   o   u   r   c   e   .   
           v   a   r       n   u   m   B   y   t   e   s   W   r   i   t   t   e   n   E   x   c   l   N   u   l   l       =       (   b   u   f   S   i   z   e       >       0       &   &       s   o   u   r   c   e   )       ?       s   t   r   i   n   g   T   o   U   T   F   8   (   r   e   s   u   l   t   ,       s   o   u   r   c   e   ,       b   u   f   S   i   z   e   )       :       0   ;   
           i   f       (   l   e   n   g   t   h   )       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   l   e   n   g   t   h   )       >   >       2   )   ]       =       n   u   m   B   y   t   e   s   W   r   i   t   t   e   n   E   x   c   l   N   u   l   l   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   S   h   a   d   e   r   S   o   u   r   c   e       =       _   g   l   G   e   t   S   h   a   d   e   r   S   o   u   r   c   e   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   S   h   a   d   e   r   i   v       =       (   s   h   a   d   e   r   ,       p   n   a   m   e   ,       p   )       =   >       {   
           i   f       (   !   p   )       {   
                   /   /       G   L   E   S   2       s   p   e   c   i   f   i   c   a   t   i   o   n       d   o   e   s       n   o   t       s   p   e   c   i   f   y       h   o   w       t   o       b   e   h   a   v   e       i   f       p       i   s       a       n   u   l   l   
                   /   /       p   o   i   n   t   e   r   .       S   i   n   c   e       c   a   l   l   i   n   g       t   h   i   s       f   u   n   c   t   i   o   n       d   o   e   s       n   o   t       m   a   k   e       s   e   n   s   e       i   f       p       =   =       n   u   l   l   ,   
                   /   /       i   s   s   u   e       a       G   L       e   r   r   o   r       t   o       n   o   t   i   f   y       u   s   e   r       a   b   o   u   t       i   t   .   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   1   )   ;   
                   r   e   t   u   r   n   ;   
           }   
           i   f       (   p   n   a   m   e       =   =       3   5   7   1   6   )       {   
                   /   /       G   L   _   I   N   F   O   _   L   O   G   _   L   E   N   G   T   H   
                   v   a   r       l   o   g       =       G   L   c   t   x   .   g   e   t   S   h   a   d   e   r   I   n   f   o   L   o   g   (   G   L   .   s   h   a   d   e   r   s   [   s   h   a   d   e   r   ]   )   ;   
                   i   f       (   l   o   g       =   =   =       n   u   l   l   )       l   o   g       =       "   (   u   n   k   n   o   w   n       e   r   r   o   r   )   "   ;   
                   /   /       T   h   e       G   L   E   S   2       s   p   e   c   i   f   i   c   a   t   i   o   n       s   a   y   s       t   h   a   t       i   f       t   h   e       s   h   a   d   e   r       h   a   s       a   n       e   m   p   t   y       i   n   f   o       l   o   g   ,   
                   /   /       a       v   a   l   u   e       o   f       0       i   s       r   e   t   u   r   n   e   d   .       O   t   h   e   r   w   i   s   e       t   h   e       l   o   g       h   a   s       a       n   u   l   l       c   h   a   r       a   p   p   e   n   d   e   d   .   
                   /   /       (   A   n       e   m   p   t   y       s   t   r   i   n   g       i   s       f   a   l   s   e   y   ,       s   o       w   e       c   a   n       j   u   s   t       c   h   e   c   k       t   h   a   t       i   n   s   t   e   a   d       o   f   
                   /   /       l   o   o   k   i   n   g       a   t       l   o   g   .   l   e   n   g   t   h   .   )   
                   v   a   r       l   o   g   L   e   n   g   t   h       =       l   o   g       ?       l   o   g   .   l   e   n   g   t   h       +       1       :       0   ;   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   p   )       >   >       2   )   ]       =       l   o   g   L   e   n   g   t   h   ;   
           }       e   l   s   e       i   f       (   p   n   a   m   e       =   =       3   5   7   2   0   )       {   
                   /   /       G   L   _   S   H   A   D   E   R   _   S   O   U   R   C   E   _   L   E   N   G   T   H   
                   v   a   r       s   o   u   r   c   e       =       G   L   c   t   x   .   g   e   t   S   h   a   d   e   r   S   o   u   r   c   e   (   G   L   .   s   h   a   d   e   r   s   [   s   h   a   d   e   r   ]   )   ;   
                   /   /       s   o   u   r   c   e       m   a   y       b   e       a       n   u   l   l   ,       o   r       t   h   e       e   m   p   t   y       s   t   r   i   n   g   ,       b   o   t   h       o   f       w   h   i   c   h       a   r   e       f   a   l   s   e   y   
                   /   /       v   a   l   u   e   s       t   h   a   t       w   e       r   e   p   o   r   t       a       0       l   e   n   g   t   h       f   o   r   .   
                   v   a   r       s   o   u   r   c   e   L   e   n   g   t   h       =       s   o   u   r   c   e       ?       s   o   u   r   c   e   .   l   e   n   g   t   h       +       1       :       0   ;   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   p   )       >   >       2   )   ]       =       s   o   u   r   c   e   L   e   n   g   t   h   ;   
           }       e   l   s   e       {   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   p   )       >   >       2   )   ]       =       G   L   c   t   x   .   g   e   t   S   h   a   d   e   r   P   a   r   a   m   e   t   e   r   (   G   L   .   s   h   a   d   e   r   s   [   s   h   a   d   e   r   ]   ,       p   n   a   m   e   )   ;   
           }   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   S   h   a   d   e   r   i   v       =       _   g   l   G   e   t   S   h   a   d   e   r   i   v   ;   
   
   v   a   r       s   t   r   i   n   g   T   o   N   e   w   U   T   F   8       =       s   t   r       =   >       {   
           v   a   r       s   i   z   e       =       l   e   n   g   t   h   B   y   t   e   s   U   T   F   8   (   s   t   r   )       +       1   ;   
           v   a   r       r   e   t       =       _   m   a   l   l   o   c   (   s   i   z   e   )   ;   
           i   f       (   r   e   t   )       s   t   r   i   n   g   T   o   U   T   F   8   (   s   t   r   ,       r   e   t   ,       s   i   z   e   )   ;   
           r   e   t   u   r   n       r   e   t   ;   
   }   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   S   t   r   i   n   g       =       n   a   m   e   _       =   >       {   
           v   a   r       r   e   t       =       G   L   .   s   t   r   i   n   g   C   a   c   h   e   [   n   a   m   e   _   ]   ;   
           i   f       (   !   r   e   t   )       {   
                   s   w   i   t   c   h       (   n   a   m   e   _   )       {   
                       c   a   s   e       7   9   3   9   :   
                           r   e   t       =       s   t   r   i   n   g   T   o   N   e   w   U   T   F   8   (   w   e   b   g   l   G   e   t   E   x   t   e   n   s   i   o   n   s   (   )   .   j   o   i   n   (   "       "   )   )   ;   
                           b   r   e   a   k   ;   
   
                       c   a   s   e       7   9   3   6   :   
                       c   a   s   e       7   9   3   7   :   
                       c   a   s   e       3   7   4   4   5   :   
                       c   a   s   e       3   7   4   4   6   :   
                           v   a   r       s       =       G   L   c   t   x   .   g   e   t   P   a   r   a   m   e   t   e   r   (   n   a   m   e   _   )   ;   
                           i   f       (   !   s   )       {   
                                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   0   )   ;   
                           }   
                           r   e   t       =       s       ?       s   t   r   i   n   g   T   o   N   e   w   U   T   F   8   (   s   )       :       0   ;   
                           b   r   e   a   k   ;   
   
                       c   a   s   e       7   9   3   8   :   
                           v   a   r       w   e   b   G   L   V   e   r   s   i   o   n       =       G   L   c   t   x   .   g   e   t   P   a   r   a   m   e   t   e   r   (   7   9   3   8   )   ;   
                           /   /       r   e   t   u   r   n       G   L   E   S       v   e   r   s   i   o   n       s   t   r   i   n   g       c   o   r   r   e   s   p   o   n   d   i   n   g       t   o       t   h   e       v   e   r   s   i   o   n       o   f       t   h   e       W   e   b   G   L       c   o   n   t   e   x   t   
                           v   a   r       g   l   V   e   r   s   i   o   n       =       `   O   p   e   n   G   L       E   S       2   .   0       (   $   {   w   e   b   G   L   V   e   r   s   i   o   n   }   )   `   ;   
                           i   f       (   t   r   u   e   )       g   l   V   e   r   s   i   o   n       =       `   O   p   e   n   G   L       E   S       3   .   0       (   $   {   w   e   b   G   L   V   e   r   s   i   o   n   }   )   `   ;   
                           r   e   t       =       s   t   r   i   n   g   T   o   N   e   w   U   T   F   8   (   g   l   V   e   r   s   i   o   n   )   ;   
                           b   r   e   a   k   ;   
   
                       c   a   s   e       3   5   7   2   4   :   
                           v   a   r       g   l   s   l   V   e   r   s   i   o   n       =       G   L   c   t   x   .   g   e   t   P   a   r   a   m   e   t   e   r   (   3   5   7   2   4   )   ;   
                           /   /       e   x   t   r   a   c   t       t   h   e       v   e   r   s   i   o   n       n   u   m   b   e   r       '   N   .   M   '       f   r   o   m       t   h   e       s   t   r   i   n   g       '   W   e   b   G   L       G   L   S   L       E   S       N   .   M       .   .   .   '   
                           v   a   r       v   e   r   _   r   e       =       /   ^   W   e   b   G   L       G   L   S   L       E   S       (   [   0   -   9   ]   \   .   [   0   -   9   ]   [   0   -   9   ]   ?   )   (   ?   :   $   |       .   *   )   /   ;   
                           v   a   r       v   e   r   _   n   u   m       =       g   l   s   l   V   e   r   s   i   o   n   .   m   a   t   c   h   (   v   e   r   _   r   e   )   ;   
                           i   f       (   v   e   r   _   n   u   m       !   =   =       n   u   l   l   )       {   
                                   i   f       (   v   e   r   _   n   u   m   [   1   ]   .   l   e   n   g   t   h       =   =       3   )       v   e   r   _   n   u   m   [   1   ]       =       v   e   r   _   n   u   m   [   1   ]       +       "   0   "   ;   
                                   /   /       e   n   s   u   r   e       m   i   n   o   r       v   e   r   s   i   o   n       h   a   s       2       d   i   g   i   t   s   
                                   g   l   s   l   V   e   r   s   i   o   n       =       `   O   p   e   n   G   L       E   S       G   L   S   L       E   S       $   {   v   e   r   _   n   u   m   [   1   ]   }       (   $   {   g   l   s   l   V   e   r   s   i   o   n   }   )   `   ;   
                           }   
                           r   e   t       =       s   t   r   i   n   g   T   o   N   e   w   U   T   F   8   (   g   l   s   l   V   e   r   s   i   o   n   )   ;   
                           b   r   e   a   k   ;   
   
                       d   e   f   a   u   l   t   :   
                           G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   0   )   ;   
                   }   
                   G   L   .   s   t   r   i   n   g   C   a   c   h   e   [   n   a   m   e   _   ]       =       r   e   t   ;   
           }   
           r   e   t   u   r   n       r   e   t   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   S   t   r   i   n   g       =       _   g   l   G   e   t   S   t   r   i   n   g   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   S   t   r   i   n   g   i       =       (   n   a   m   e   ,       i   n   d   e   x   )       =   >       {   
           i   f       (   G   L   .   c   u   r   r   e   n   t   C   o   n   t   e   x   t   .   v   e   r   s   i   o   n       <       2   )       {   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   2   )   ;   
                   /   /       C   a   l   l   i   n   g       G   L   E   S   3   /   W   e   b   G   L   2       f   u   n   c   t   i   o   n       w   i   t   h       a       G   L   E   S   2   /   W   e   b   G   L   1       c   o   n   t   e   x   t   
                   r   e   t   u   r   n       0   ;   
           }   
           v   a   r       s   t   r   i   n   g   i   C   a   c   h   e       =       G   L   .   s   t   r   i   n   g   i   C   a   c   h   e   [   n   a   m   e   ]   ;   
           i   f       (   s   t   r   i   n   g   i   C   a   c   h   e   )       {   
                   i   f       (   i   n   d   e   x       <       0       |   |       i   n   d   e   x       >   =       s   t   r   i   n   g   i   C   a   c   h   e   .   l   e   n   g   t   h   )       {   
                           G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   1   )   ;   
                           r   e   t   u   r   n       0   ;   
                   }   
                   r   e   t   u   r   n       s   t   r   i   n   g   i   C   a   c   h   e   [   i   n   d   e   x   ]   ;   
           }   
           s   w   i   t   c   h       (   n   a   m   e   )       {   
               c   a   s   e       7   9   3   9   :   
                   v   a   r       e   x   t   s       =       w   e   b   g   l   G   e   t   E   x   t   e   n   s   i   o   n   s   (   )   .   m   a   p   (   s   t   r   i   n   g   T   o   N   e   w   U   T   F   8   )   ;   
                   s   t   r   i   n   g   i   C   a   c   h   e       =       G   L   .   s   t   r   i   n   g   i   C   a   c   h   e   [   n   a   m   e   ]       =       e   x   t   s   ;   
                   i   f       (   i   n   d   e   x       <       0       |   |       i   n   d   e   x       >   =       s   t   r   i   n   g   i   C   a   c   h   e   .   l   e   n   g   t   h   )       {   
                           G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   1   )   ;   
                           r   e   t   u   r   n       0   ;   
                   }   
                   r   e   t   u   r   n       s   t   r   i   n   g   i   C   a   c   h   e   [   i   n   d   e   x   ]   ;   
   
               d   e   f   a   u   l   t   :   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   0   )   ;   
                   r   e   t   u   r   n       0   ;   
           }   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   S   t   r   i   n   g   i       =       _   g   l   G   e   t   S   t   r   i   n   g   i   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   S   y   n   c   i   v       =       (   s   y   n   c   ,       p   n   a   m   e   ,       b   u   f   S   i   z   e   ,       l   e   n   g   t   h   ,       v   a   l   u   e   s   )       =   >       {   
           i   f       (   b   u   f   S   i   z   e       <       0   )       {   
                   /   /       G   L   E   S   3       s   p   e   c   i   f   i   c   a   t   i   o   n       d   o   e   s       n   o   t       s   p   e   c   i   f   y       h   o   w       t   o       b   e   h   a   v   e       i   f       b   u   f   S   i   z   e       <       0   ,       h   o   w   e   v   e   r       i   n       t   h   e       s   p   e   c       w   o   r   d   i   n   g       f   o   r       g   l   G   e   t   I   n   t   e   r   n   a   l   f   o   r   m   a   t   i   v   ,       i   t       d   o   e   s       s   a   y       t   h   a   t       G   L   _   I   N   V   A   L   I   D   _   V   A   L   U   E       s   h   o   u   l   d       b   e       r   a   i   s   e   d   ,   
                   /   /       s   o       r   a   i   s   e       G   L   _   I   N   V   A   L   I   D   _   V   A   L   U   E       h   e   r   e       a   s       w   e   l   l   .   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   1   )   ;   
                   r   e   t   u   r   n   ;   
           }   
           i   f       (   !   v   a   l   u   e   s   )       {   
                   /   /       G   L   E   S   3       s   p   e   c   i   f   i   c   a   t   i   o   n       d   o   e   s       n   o   t       s   p   e   c   i   f   y       h   o   w       t   o       b   e   h   a   v   e       i   f       v   a   l   u   e   s       i   s       a       n   u   l   l       p   o   i   n   t   e   r   .       S   i   n   c   e       c   a   l   l   i   n   g       t   h   i   s       f   u   n   c   t   i   o   n       d   o   e   s       n   o   t       m   a   k   e       s   e   n   s   e   
                   /   /       i   f       v   a   l   u   e   s       =   =       n   u   l   l   ,       i   s   s   u   e       a       G   L       e   r   r   o   r       t   o       n   o   t   i   f   y       u   s   e   r       a   b   o   u   t       i   t   .   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   1   )   ;   
                   r   e   t   u   r   n   ;   
           }   
           v   a   r       r   e   t       =       G   L   c   t   x   .   g   e   t   S   y   n   c   P   a   r   a   m   e   t   e   r   (   G   L   .   s   y   n   c   s   [   s   y   n   c   ]   ,       p   n   a   m   e   )   ;   
           i   f       (   r   e   t       !   =   =       n   u   l   l   )       {   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   v   a   l   u   e   s   )       >   >       2   )   ]       =       r   e   t   ;   
                   i   f       (   l   e   n   g   t   h   )       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   l   e   n   g   t   h   )       >   >       2   )   ]       =       1   ;   
           }   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   S   y   n   c   i   v       =       _   g   l   G   e   t   S   y   n   c   i   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   T   e   x   P   a   r   a   m   e   t   e   r   f   v       =       (   t   a   r   g   e   t   ,       p   n   a   m   e   ,       p   a   r   a   m   s   )       =   >       {   
           i   f       (   !   p   a   r   a   m   s   )       {   
                   /   /       G   L   E   S   2       s   p   e   c   i   f   i   c   a   t   i   o   n       d   o   e   s       n   o   t       s   p   e   c   i   f   y       h   o   w       t   o       b   e   h   a   v   e       i   f       p   a   r   a   m   s       i   s       a       n   u   l   l   
                   /   /       p   o   i   n   t   e   r   .       S   i   n   c   e       c   a   l   l   i   n   g       t   h   i   s       f   u   n   c   t   i   o   n       d   o   e   s       n   o   t       m   a   k   e       s   e   n   s   e       i   f       p       =   =       n   u   l   l   ,   
                   /   /       i   s   s   u   e       a       G   L       e   r   r   o   r       t   o       n   o   t   i   f   y       u   s   e   r       a   b   o   u   t       i   t   .   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   1   )   ;   
                   r   e   t   u   r   n   ;   
           }   
           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   F   3   2   )   [   (   (   p   a   r   a   m   s   )       >   >       2   )   ]       =       G   L   c   t   x   .   g   e   t   T   e   x   P   a   r   a   m   e   t   e   r   (   t   a   r   g   e   t   ,       p   n   a   m   e   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   T   e   x   P   a   r   a   m   e   t   e   r   f   v       =       _   g   l   G   e   t   T   e   x   P   a   r   a   m   e   t   e   r   f   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   T   e   x   P   a   r   a   m   e   t   e   r   i   v       =       (   t   a   r   g   e   t   ,       p   n   a   m   e   ,       p   a   r   a   m   s   )       =   >       {   
           i   f       (   !   p   a   r   a   m   s   )       {   
                   /   /       G   L   E   S   2       s   p   e   c   i   f   i   c   a   t   i   o   n       d   o   e   s       n   o   t       s   p   e   c   i   f   y       h   o   w       t   o       b   e   h   a   v   e       i   f       p   a   r   a   m   s       i   s       a       n   u   l   l   
                   /   /       p   o   i   n   t   e   r   .       S   i   n   c   e       c   a   l   l   i   n   g       t   h   i   s       f   u   n   c   t   i   o   n       d   o   e   s       n   o   t       m   a   k   e       s   e   n   s   e       i   f       p       =   =       n   u   l   l   ,   
                   /   /       i   s   s   u   e       a       G   L       e   r   r   o   r       t   o       n   o   t   i   f   y       u   s   e   r       a   b   o   u   t       i   t   .   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   1   )   ;   
                   r   e   t   u   r   n   ;   
           }   
           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   p   a   r   a   m   s   )       >   >       2   )   ]       =       G   L   c   t   x   .   g   e   t   T   e   x   P   a   r   a   m   e   t   e   r   (   t   a   r   g   e   t   ,       p   n   a   m   e   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   T   e   x   P   a   r   a   m   e   t   e   r   i   v       =       _   g   l   G   e   t   T   e   x   P   a   r   a   m   e   t   e   r   i   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   V   a   r   y   i   n   g       =       (   p   r   o   g   r   a   m   ,       i   n   d   e   x   ,       b   u   f   S   i   z   e   ,       l   e   n   g   t   h   ,       s   i   z   e   ,       t   y   p   e   ,       n   a   m   e   )       =   >       {   
           p   r   o   g   r   a   m       =       G   L   .   p   r   o   g   r   a   m   s   [   p   r   o   g   r   a   m   ]   ;   
           v   a   r       i   n   f   o       =       G   L   c   t   x   .   g   e   t   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   V   a   r   y   i   n   g   (   p   r   o   g   r   a   m   ,       i   n   d   e   x   )   ;   
           i   f       (   !   i   n   f   o   )       r   e   t   u   r   n   ;   
           /   /       I   f       a   n       e   r   r   o   r       o   c   c   u   r   r   e   d   ,       t   h   e       r   e   t   u   r   n       p   a   r   a   m   e   t   e   r   s       l   e   n   g   t   h   ,       s   i   z   e   ,       t   y   p   e       a   n   d       n   a   m   e       w   i   l   l       b   e       u   n   m   o   d   i   f   i   e   d   .   
           i   f       (   n   a   m   e       &   &       b   u   f   S   i   z   e       >       0   )       {   
                   v   a   r       n   u   m   B   y   t   e   s   W   r   i   t   t   e   n   E   x   c   l   N   u   l   l       =       s   t   r   i   n   g   T   o   U   T   F   8   (   i   n   f   o   .   n   a   m   e   ,       n   a   m   e   ,       b   u   f   S   i   z   e   )   ;   
                   i   f       (   l   e   n   g   t   h   )       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   l   e   n   g   t   h   )       >   >       2   )   ]       =       n   u   m   B   y   t   e   s   W   r   i   t   t   e   n   E   x   c   l   N   u   l   l   ;   
           }       e   l   s   e       {   
                   i   f       (   l   e   n   g   t   h   )       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   l   e   n   g   t   h   )       >   >       2   )   ]       =       0   ;   
           }   
           i   f       (   s   i   z   e   )       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   s   i   z   e   )       >   >       2   )   ]       =       i   n   f   o   .   s   i   z   e   ;   
           i   f       (   t   y   p   e   )       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   t   y   p   e   )       >   >       2   )   ]       =       i   n   f   o   .   t   y   p   e   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   V   a   r   y   i   n   g       =       _   g   l   G   e   t   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   V   a   r   y   i   n   g   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   U   n   i   f   o   r   m   B   l   o   c   k   I   n   d   e   x       =       (   p   r   o   g   r   a   m   ,       u   n   i   f   o   r   m   B   l   o   c   k   N   a   m   e   )       =   >       G   L   c   t   x   .   g   e   t   U   n   i   f   o   r   m   B   l   o   c   k   I   n   d   e   x   (   G   L   .   p   r   o   g   r   a   m   s   [   p   r   o   g   r   a   m   ]   ,       U   T   F   8   T   o   S   t   r   i   n   g   (   u   n   i   f   o   r   m   B   l   o   c   k   N   a   m   e   )   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   U   n   i   f   o   r   m   B   l   o   c   k   I   n   d   e   x       =       _   g   l   G   e   t   U   n   i   f   o   r   m   B   l   o   c   k   I   n   d   e   x   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   U   n   i   f   o   r   m   I   n   d   i   c   e   s       =       (   p   r   o   g   r   a   m   ,       u   n   i   f   o   r   m   C   o   u   n   t   ,       u   n   i   f   o   r   m   N   a   m   e   s   ,       u   n   i   f   o   r   m   I   n   d   i   c   e   s   )       =   >       {   
           i   f       (   !   u   n   i   f   o   r   m   I   n   d   i   c   e   s   )       {   
                   /   /       G   L   E   S   2       s   p   e   c   i   f   i   c   a   t   i   o   n       d   o   e   s       n   o   t       s   p   e   c   i   f   y       h   o   w       t   o       b   e   h   a   v   e       i   f       u   n   i   f   o   r   m   I   n   d   i   c   e   s       i   s       a       n   u   l   l       p   o   i   n   t   e   r   .       S   i   n   c   e       c   a   l   l   i   n   g       t   h   i   s       f   u   n   c   t   i   o   n       d   o   e   s       n   o   t       m   a   k   e       s   e   n   s   e   
                   /   /       i   f       u   n   i   f   o   r   m   I   n   d   i   c   e   s       =   =       n   u   l   l   ,       i   s   s   u   e       a       G   L       e   r   r   o   r       t   o       n   o   t   i   f   y       u   s   e   r       a   b   o   u   t       i   t   .   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   1   )   ;   
                   r   e   t   u   r   n   ;   
           }   
           i   f       (   u   n   i   f   o   r   m   C   o   u   n   t       >       0       &   &       (   u   n   i   f   o   r   m   N   a   m   e   s       =   =       0       |   |       u   n   i   f   o   r   m   I   n   d   i   c   e   s       =   =       0   )   )       {   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   1   )   ;   
                   r   e   t   u   r   n   ;   
           }   
           p   r   o   g   r   a   m       =       G   L   .   p   r   o   g   r   a   m   s   [   p   r   o   g   r   a   m   ]   ;   
           v   a   r       n   a   m   e   s       =       [   ]   ;   
           f   o   r       (   v   a   r       i       =       0   ;       i       <       u   n   i   f   o   r   m   C   o   u   n   t   ;       i   +   +   )       n   a   m   e   s   .   p   u   s   h   (   U   T   F   8   T   o   S   t   r   i   n   g   (   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       
           H   E   A   P   3   2   )   [   (   (   (   u   n   i   f   o   r   m   N   a   m   e   s   )       +       (   i       *       4   )   )       >   >       2   )   ]   )   )   ;   
           v   a   r       r   e   s   u   l   t       =       G   L   c   t   x   .   g   e   t   U   n   i   f   o   r   m   I   n   d   i   c   e   s   (   p   r   o   g   r   a   m   ,       n   a   m   e   s   )   ;   
           i   f       (   !   r   e   s   u   l   t   )       r   e   t   u   r   n   ;   
           /   /       G   L       s   p   e   c   :       I   f       a   n       e   r   r   o   r       i   s       g   e   n   e   r   a   t   e   d   ,       n   o   t   h   i   n   g       i   s       w   r   i   t   t   e   n       o   u   t       t   o       u   n   i   f   o   r   m   I   n   d   i   c   e   s   .   
           v   a   r       l   e   n       =       r   e   s   u   l   t   .   l   e   n   g   t   h   ;   
           f   o   r       (   v   a   r       i       =       0   ;       i       <       l   e   n   ;       i   +   +   )       {   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   (   u   n   i   f   o   r   m   I   n   d   i   c   e   s   )       +       (   i       *       4   )   )       >   >       2   )   ]       =       r   e   s   u   l   t   [   i   ]   ;   
           }   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   U   n   i   f   o   r   m   I   n   d   i   c   e   s       =       _   g   l   G   e   t   U   n   i   f   o   r   m   I   n   d   i   c   e   s   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   c   h   e   c   k   T   y   p   e   s   }       *   /       v   a   r       j   s   t   o   i   _   q       =       s   t   r       =   >       p   a   r   s   e   I   n   t   (   s   t   r   )   ;   
   
   /   *   *       @   n   o   i   n   l   i   n   e       *   /       v   a   r       w   e   b   g   l   G   e   t   L   e   f   t   B   r   a   c   e   P   o   s       =       n   a   m   e       =   >       n   a   m   e   .   s   l   i   c   e   (   -   1   )       =   =       "   ]   "       &   &       n   a   m   e   .   l   a   s   t   I   n   d   e   x   O   f   (   "   [   "   )   ;   
   
   v   a   r       w   e   b   g   l   P   r   e   p   a   r   e   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   s   B   e   f   o   r   e   F   i   r   s   t   U   s   e       =       p   r   o   g   r   a   m       =   >       {   
           v   a   r       u   n   i   f   o   r   m   L   o   c   s   B   y   I   d       =       p   r   o   g   r   a   m   .   u   n   i   f   o   r   m   L   o   c   s   B   y   I   d   ,       /   /       M   a   p   s       G   L   u   i   n   t       -   >       W   e   b   G   L   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   
           u   n   i   f   o   r   m   S   i   z   e   A   n   d   I   d   s   B   y   N   a   m   e       =       p   r   o   g   r   a   m   .   u   n   i   f   o   r   m   S   i   z   e   A   n   d   I   d   s   B   y   N   a   m   e   ,       /   /       M   a   p   s       n   a   m   e       -   >       [   u   n   i   f   o   r   m       a   r   r   a   y       l   e   n   g   t   h   ,       G   L   u   i   n   t   ]   
           i   ,       j   ;   
           /   /       O   n       t   h   e       f   i   r   s   t       t   i   m   e       i   n   v   o   c   a   t   i   o   n       o   f       g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n       o   n       t   h   i   s       s   h   a   d   e   r       p   r   o   g   r   a   m   :   
           /   /       i   n   i   t   i   a   l   i   z   e       c   a   c   h   e       d   a   t   a       s   t   r   u   c   t   u   r   e   s       a   n   d       d   i   s   c   o   v   e   r       w   h   i   c   h       u   n   i   f   o   r   m   s       a   r   e       a   r   r   a   y   s   .   
           i   f       (   !   u   n   i   f   o   r   m   L   o   c   s   B   y   I   d   )       {   
                   /   /       m   a   p   s       G   L   i   n   t       i   n   t   e   g   e   r       l   o   c   a   t   i   o   n   s       t   o       W   e   b   G   L   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   s   
                   p   r   o   g   r   a   m   .   u   n   i   f   o   r   m   L   o   c   s   B   y   I   d       =       u   n   i   f   o   r   m   L   o   c   s   B   y   I   d       =       {   }   ;   
                   /   /       m   a   p   s       i   n   t   e   g   e   r       l   o   c   a   t   i   o   n   s       b   a   c   k       t   o       u   n   i   f   o   r   m       n   a   m   e       s   t   r   i   n   g   s   ,       s   o       t   h   a   t       w   e       c   a   n       l   a   z   i   l   y       f   e   t   c   h       u   n   i   f   o   r   m       a   r   r   a   y       l   o   c   a   t   i   o   n   s   
                   p   r   o   g   r   a   m   .   u   n   i   f   o   r   m   A   r   r   a   y   N   a   m   e   s   B   y   I   d       =       {   }   ;   
                   v   a   r       n   u   m   A   c   t   i   v   e   U   n   i   f   o   r   m   s       =       G   L   c   t   x   .   g   e   t   P   r   o   g   r   a   m   P   a   r   a   m   e   t   e   r   (   p   r   o   g   r   a   m   ,       3   5   7   1   8   )   ;   
                   f   o   r       (   i       =       0   ;       i       <       n   u   m   A   c   t   i   v   e   U   n   i   f   o   r   m   s   ;       +   +   i   )       {   
                           v   a   r       u       =       G   L   c   t   x   .   g   e   t   A   c   t   i   v   e   U   n   i   f   o   r   m   (   p   r   o   g   r   a   m   ,       i   )   ;   
                           v   a   r       n   m       =       u   .   n   a   m   e   ;   
                           v   a   r       s   z       =       u   .   s   i   z   e   ;   
                           v   a   r       l   b       =       w   e   b   g   l   G   e   t   L   e   f   t   B   r   a   c   e   P   o   s   (   n   m   )   ;   
                           v   a   r       a   r   r   a   y   N   a   m   e       =       l   b       >       0       ?       n   m   .   s   l   i   c   e   (   0   ,       l   b   )       :       n   m   ;   
                           /   /       A   s   s   i   g   n       a       n   e   w       l   o   c   a   t   i   o   n   .   
                           v   a   r       i   d       =       p   r   o   g   r   a   m   .   u   n   i   f   o   r   m   I   d   C   o   u   n   t   e   r   ;   
                           p   r   o   g   r   a   m   .   u   n   i   f   o   r   m   I   d   C   o   u   n   t   e   r       +   =       s   z   ;   
                           /   /       E   a   g   e   r   l   y       g   e   t       t   h   e       l   o   c   a   t   i   o   n       o   f       t   h   e       u   n   i   f   o   r   m   A   r   r   a   y   [   0   ]       b   a   s   e       e   l   e   m   e   n   t   .   
                           /   /       T   h   e       r   e   m   a   i   n   i   n   g       i   n   d   i   c   e   s       >   0       w   i   l   l       b   e       l   e   f   t       f   o   r       l   a   z   y       e   v   a   l   u   a   t   i   o   n       t   o   
                           /   /       i   m   p   r   o   v   e       p   e   r   f   o   r   m   a   n   c   e   .       T   h   o   s   e       m   a   y       n   e   v   e   r       b   e       n   e   e   d   e   d       t   o       f   e   t   c   h   ,       i   f       t   h   e   
                           /   /       a   p   p   l   i   c   a   t   i   o   n       f   i   l   l   s       a   r   r   a   y   s       a   l   w   a   y   s       i   n       f   u   l   l       s   t   a   r   t   i   n   g       f   r   o   m       t   h   e       f   i   r   s   t   
                           /   /       e   l   e   m   e   n   t       o   f       t   h   e       a   r   r   a   y   .   
                           u   n   i   f   o   r   m   S   i   z   e   A   n   d   I   d   s   B   y   N   a   m   e   [   a   r   r   a   y   N   a   m   e   ]       =       [       s   z   ,       i   d       ]   ;   
                           /   /       S   t   o   r   e       p   l   a   c   e   h   o   l   d   e   r       i   n   t   e   g   e   r   s       i   n       p   l   a   c   e       t   h   a   t       h   i   g   h   l   i   g   h   t       t   h   a   t       t   h   e   s   e   
                           /   /       >   0       i   n   d   e   x       l   o   c   a   t   i   o   n   s       a   r   e       a   r   r   a   y       i   n   d   i   c   e   s       p   e   n   d   i   n   g       p   o   p   u   l   a   t   i   o   n   .   
                           f   o   r       (   j       =       0   ;       j       <       s   z   ;       +   +   j   )       {   
                                   u   n   i   f   o   r   m   L   o   c   s   B   y   I   d   [   i   d   ]       =       j   ;   
                                   p   r   o   g   r   a   m   .   u   n   i   f   o   r   m   A   r   r   a   y   N   a   m   e   s   B   y   I   d   [   i   d   +   +   ]       =       a   r   r   a   y   N   a   m   e   ;   
                           }   
                   }   
           }   
   }   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n       =       (   p   r   o   g   r   a   m   ,       n   a   m   e   )       =   >       {   
           n   a   m   e       =       U   T   F   8   T   o   S   t   r   i   n   g   (   n   a   m   e   )   ;   
           i   f       (   p   r   o   g   r   a   m       =       G   L   .   p   r   o   g   r   a   m   s   [   p   r   o   g   r   a   m   ]   )       {   
                   w   e   b   g   l   P   r   e   p   a   r   e   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   s   B   e   f   o   r   e   F   i   r   s   t   U   s   e   (   p   r   o   g   r   a   m   )   ;   
                   v   a   r       u   n   i   f   o   r   m   L   o   c   s   B   y   I   d       =       p   r   o   g   r   a   m   .   u   n   i   f   o   r   m   L   o   c   s   B   y   I   d   ;   
                   /   /       M   a   p   s       G   L   u   i   n   t       -   >       W   e   b   G   L   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   
                   v   a   r       a   r   r   a   y   I   n   d   e   x       =       0   ;   
                   v   a   r       u   n   i   f   o   r   m   B   a   s   e   N   a   m   e       =       n   a   m   e   ;   
                   /   /       I   n   v   a   r   i   a   n   t   :       w   h   e   n       p   o   p   u   l   a   t   i   n   g       i   n   t   e   g   e   r       I   D   s       f   o   r       u   n   i   f   o   r   m       l   o   c   a   t   i   o   n   s   ,       w   e       m   u   s   t   
                   /   /       m   a   i   n   t   a   i   n       t   h   e       p   r   e   c   o   n   d   i   t   i   o   n       t   h   a   t       a   r   r   a   y   s       r   e   s   i   d   e       i   n       c   o   n   t   i   g   u   o   u   s       a   d   d   r   e   s   s   e   s   ,   
                   /   /       i   .   e   .       f   o   r       a       '   v   e   c   4       c   o   l   o   r   s   [   1   0   ]   ;   '   ,       c   o   l   o   r   s   [   4   ]       m   u   s   t       b   e       a   t       l   o   c   a   t   i   o   n   
                   /   /       c   o   l   o   r   s   [   0   ]   +   4   .           H   o   w   e   v   e   r   ,       u   s   e   r       m   i   g   h   t       c   a   l   l       g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   (   p   r   o   g   r   a   m   ,   
                   /   /       "   c   o   l   o   r   s   "   )       f   o   r       a   n       a   r   r   a   y   ,       s   o       w   e       c   a   n   n   o   t       d   i   s   c   o   v   e   r       b   a   s   e   d       o   n       t   h   e       u   s   e   r       i   n   p   u   t   
                   /   /       a   r   g   u   m   e   n   t   s       w   h   e   t   h   e   r       t   h   e       u   n   i   f   o   r   m       w   e       a   r   e       d   e   a   l   i   n   g       w   i   t   h       i   s       a   n       a   r   r   a   y   .       T   h   e       o   n   l   y   
                   /   /       w   a   y       t   o       d   i   s   c   o   v   e   r       w   h   i   c   h       u   n   i   f   o   r   m   s       a   r   e       a   r   r   a   y   s       i   s       t   o       e   n   u   m   e   r   a   t   e       o   v   e   r       a   l   l       t   h   e   
                   /   /       a   c   t   i   v   e       u   n   i   f   o   r   m   s       i   n       t   h   e       p   r   o   g   r   a   m   .   
                   v   a   r       l   e   f   t   B   r   a   c   e       =       w   e   b   g   l   G   e   t   L   e   f   t   B   r   a   c   e   P   o   s   (   n   a   m   e   )   ;   
                   /   /       I   f       u   s   e   r       p   a   s   s   e   d       a   n       a   r   r   a   y       a   c   c   e   s   s   o   r       "   [   i   n   d   e   x   ]   "   ,       p   a   r   s   e       t   h   e       a   r   r   a   y       i   n   d   e   x       o   f   f       t   h   e       a   c   c   e   s   s   o   r   .   
                   i   f       (   l   e   f   t   B   r   a   c   e       >       0   )       {   
                           a   r   r   a   y   I   n   d   e   x       =       j   s   t   o   i   _   q   (   n   a   m   e   .   s   l   i   c   e   (   l   e   f   t   B   r   a   c   e       +       1   )   )       >   >   >       0   ;   
                           /   /       "   i   n   d   e   x   ]   "   ,       c   o   e   r   c   e       p   a   r   s   e   I   n   t   (   '   ]   '   )       w   i   t   h       >   >   >   0       t   o       t   r   e   a   t       "   f   o   o   [   ]   "       a   s       "   f   o   o   [   0   ]   "       a   n   d       f   o   o   [   -   1   ]       a   s       u   n   s   i   g   n   e   d       o   u   t   -   o   f   -   b   o   u   n   d   s   .   
                           u   n   i   f   o   r   m   B   a   s   e   N   a   m   e       =       n   a   m   e   .   s   l   i   c   e   (   0   ,       l   e   f   t   B   r   a   c   e   )   ;   
                   }   
                   /   /       H   a   v   e       w   e       c   a   c   h   e   d       t   h   e       l   o   c   a   t   i   o   n       o   f       t   h   i   s       u   n   i   f   o   r   m       b   e   f   o   r   e   ?   
                   /   /       A       p   a   i   r       [   a   r   r   a   y       l   e   n   g   t   h   ,       G   L   i   n   t       o   f       t   h   e       u   n   i   f   o   r   m       l   o   c   a   t   i   o   n   ]   
                   v   a   r       s   i   z   e   A   n   d   I   d       =       p   r   o   g   r   a   m   .   u   n   i   f   o   r   m   S   i   z   e   A   n   d   I   d   s   B   y   N   a   m   e   [   u   n   i   f   o   r   m   B   a   s   e   N   a   m   e   ]   ;   
                   /   /       I   f       a   n       u   n   i   f   o   r   m       w   i   t   h       t   h   i   s       n   a   m   e       e   x   i   s   t   s   ,       a   n   d       i   f       i   t   s       i   n   d   e   x       i   s       w   i   t   h   i   n       t   h   e   
                   /   /       a   r   r   a   y       l   i   m   i   t   s       (   i   f       i   t   '   s       e   v   e   n       a   n       a   r   r   a   y   )   ,       q   u   e   r   y       t   h   e       W   e   b   G   L   l   o   c   a   t   i   o   n   ,       o   r   
                   /   /       r   e   t   u   r   n       a   n       e   x   i   s   t   i   n   g       c   a   c   h   e   d       l   o   c   a   t   i   o   n   .   
                   i   f       (   s   i   z   e   A   n   d   I   d       &   &       a   r   r   a   y   I   n   d   e   x       <       s   i   z   e   A   n   d   I   d   [   0   ]   )       {   
                           a   r   r   a   y   I   n   d   e   x       +   =       s   i   z   e   A   n   d   I   d   [   1   ]   ;   
                           /   /       A   d   d       t   h   e       b   a   s   e       l   o   c   a   t   i   o   n       o   f       t   h   e       u   n   i   f   o   r   m       t   o       t   h   e       a   r   r   a   y       i   n   d   e   x       o   f   f   s   e   t   .   
                           i   f       (   (   u   n   i   f   o   r   m   L   o   c   s   B   y   I   d   [   a   r   r   a   y   I   n   d   e   x   ]       =       u   n   i   f   o   r   m   L   o   c   s   B   y   I   d   [   a   r   r   a   y   I   n   d   e   x   ]       |   |       G   L   c   t   x   .   g   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   (   p   r   o   g   r   a   m   ,       n   a   m   e   )   )   )       {   
                                   r   e   t   u   r   n       a   r   r   a   y   I   n   d   e   x   ;   
                           }   
                   }   
           }       e   l   s   e       {   
                   /   /       N   .   b   .       w   e       a   r   e       c   u   r   r   e   n   t   l   y       u   n   a   b   l   e       t   o       d   i   s   t   i   n   g   u   i   s   h       b   e   t   w   e   e   n       G   L       p   r   o   g   r   a   m       I   D   s       t   h   a   t   
                   /   /       n   e   v   e   r       e   x   i   s   t   e   d       v   s       G   L       p   r   o   g   r   a   m       I   D   s       t   h   a   t       h   a   v   e       b   e   e   n       d   e   l   e   t   e   d   ,       s   o       r   e   p   o   r   t   
                   /   /       G   L   _   I   N   V   A   L   I   D   _   V   A   L   U   E       i   n       b   o   t   h       c   a   s   e   s   .   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   1   )   ;   
           }   
           r   e   t   u   r   n       -   1   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n       =       _   g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   ;   
   
   v   a   r       w   e   b   g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n       =       l   o   c   a   t   i   o   n       =   >       {   
           v   a   r       p       =       G   L   c   t   x   .   c   u   r   r   e   n   t   P   r   o   g   r   a   m   ;   
           i   f       (   p   )       {   
                   v   a   r       w   e   b   g   l   L   o   c       =       p   .   u   n   i   f   o   r   m   L   o   c   s   B   y   I   d   [   l   o   c   a   t   i   o   n   ]   ;   
                   /   /       p   .   u   n   i   f   o   r   m   L   o   c   s   B   y   I   d   [   l   o   c   a   t   i   o   n   ]       s   t   o   r   e   s       e   i   t   h   e   r       a   n       i   n   t   e   g   e   r   ,       o   r       a   
                   /   /       W   e   b   G   L   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   .   
                   /   /       I   f       a   n       i   n   t   e   g   e   r   ,       w   e       h   a   v   e       n   o   t       y   e   t       b   o   u   n   d       t   h   e       l   o   c   a   t   i   o   n   ,       s   o       d   o       i   t       n   o   w   .       T   h   e   
                   /   /       i   n   t   e   g   e   r       v   a   l   u   e       s   p   e   c   i   f   i   e   s       t   h   e       a   r   r   a   y       i   n   d   e   x       w   e       s   h   o   u   l   d       b   i   n   d       t   o   .   
                   i   f       (   t   y   p   e   o   f       w   e   b   g   l   L   o   c       =   =       "   n   u   m   b   e   r   "   )       {   
                           p   .   u   n   i   f   o   r   m   L   o   c   s   B   y   I   d   [   l   o   c   a   t   i   o   n   ]       =       w   e   b   g   l   L   o   c       =       G   L   c   t   x   .   g   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   (   p   ,       p   .   u   n   i   f   o   r   m   A   r   r   a   y   N   a   m   e   s   B   y   I   d   [   l   o   c   a   t   i   o   n   ]       +       (   w   e   b   g   l   L   o   c       >       0       ?       `   [   $   {   w   e   b   g   l   L   o   c   }   ]   `       :       "   "   )   )   ;   
                   }   
                   /   /       E   l   s   e       a   n       a   l   r   e   a   d   y       c   a   c   h   e   d       W   e   b   G   L   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   ,       r   e   t   u   r   n       i   t   .   
                   r   e   t   u   r   n       w   e   b   g   l   L   o   c   ;   
           }       e   l   s   e       {   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   2   )   ;   
           }   
   }   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s   {   c   h   e   c   k   T   y   p   e   s   }       *   /       v   a   r       e   m   s   c   r   i   p   t   e   n   W   e   b   G   L   G   e   t   U   n   i   f   o   r   m       =       (   p   r   o   g   r   a   m   ,       l   o   c   a   t   i   o   n   ,       p   a   r   a   m   s   ,       t   y   p   e   )       =   >       {   
           i   f       (   !   p   a   r   a   m   s   )       {   
                   /   /       G   L   E   S   2       s   p   e   c   i   f   i   c   a   t   i   o   n       d   o   e   s       n   o   t       s   p   e   c   i   f   y       h   o   w       t   o       b   e   h   a   v   e       i   f       p   a   r   a   m   s       i   s       a       n   u   l   l   
                   /   /       p   o   i   n   t   e   r   .       S   i   n   c   e       c   a   l   l   i   n   g       t   h   i   s       f   u   n   c   t   i   o   n       d   o   e   s       n   o   t       m   a   k   e       s   e   n   s   e       i   f       p   a   r   a   m   s       =   =   
                   /   /       n   u   l   l   ,       i   s   s   u   e       a       G   L       e   r   r   o   r       t   o       n   o   t   i   f   y       u   s   e   r       a   b   o   u   t       i   t   .   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   1   )   ;   
                   r   e   t   u   r   n   ;   
           }   
           p   r   o   g   r   a   m       =       G   L   .   p   r   o   g   r   a   m   s   [   p   r   o   g   r   a   m   ]   ;   
           w   e   b   g   l   P   r   e   p   a   r   e   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   s   B   e   f   o   r   e   F   i   r   s   t   U   s   e   (   p   r   o   g   r   a   m   )   ;   
           v   a   r       d   a   t   a       =       G   L   c   t   x   .   g   e   t   U   n   i   f   o   r   m   (   p   r   o   g   r   a   m   ,       w   e   b   g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   (   l   o   c   a   t   i   o   n   )   )   ;   
           i   f       (   t   y   p   e   o   f       d   a   t   a       =   =       "   n   u   m   b   e   r   "       |   |       t   y   p   e   o   f       d   a   t   a       =   =       "   b   o   o   l   e   a   n   "   )       {   
                   s   w   i   t   c   h       (   t   y   p   e   )       {   
                       c   a   s   e       0   :   
                           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   p   a   r   a   m   s   )       >   >       2   )   ]       =       d   a   t   a   ;   
                           b   r   e   a   k   ;   
   
                       c   a   s   e       2   :   
                           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   F   3   2   )   [   (   (   p   a   r   a   m   s   )       >   >       2   )   ]       =       d   a   t   a   ;   
                           b   r   e   a   k   ;   
                   }   
           }       e   l   s   e       {   
                   f   o   r       (   v   a   r       i       =       0   ;       i       <       d   a   t   a   .   l   e   n   g   t   h   ;       i   +   +   )       {   
                           s   w   i   t   c   h       (   t   y   p   e   )       {   
                               c   a   s   e       0   :   
                                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   (   p   a   r   a   m   s   )       +       (   i       *       4   )   )       >   >       2   )   ]       =       d   a   t   a   [   i   ]   ;   
                                   b   r   e   a   k   ;   
   
                               c   a   s   e       2   :   
                                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   F   3   2   )   [   (   (   (   p   a   r   a   m   s   )       +       (   i       *       4   )   )       >   >       2   )   ]       =       d   a   t   a   [   i   ]   ;   
                                   b   r   e   a   k   ;   
                           }   
                   }   
           }   
   }   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   U   n   i   f   o   r   m   f   v       =       (   p   r   o   g   r   a   m   ,       l   o   c   a   t   i   o   n   ,       p   a   r   a   m   s   )       =   >       {   
           e   m   s   c   r   i   p   t   e   n   W   e   b   G   L   G   e   t   U   n   i   f   o   r   m   (   p   r   o   g   r   a   m   ,       l   o   c   a   t   i   o   n   ,       p   a   r   a   m   s   ,       2   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   U   n   i   f   o   r   m   f   v       =       _   g   l   G   e   t   U   n   i   f   o   r   m   f   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   U   n   i   f   o   r   m   i   v       =       (   p   r   o   g   r   a   m   ,       l   o   c   a   t   i   o   n   ,       p   a   r   a   m   s   )       =   >       {   
           e   m   s   c   r   i   p   t   e   n   W   e   b   G   L   G   e   t   U   n   i   f   o   r   m   (   p   r   o   g   r   a   m   ,       l   o   c   a   t   i   o   n   ,       p   a   r   a   m   s   ,       0   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   U   n   i   f   o   r   m   i   v       =       _   g   l   G   e   t   U   n   i   f   o   r   m   i   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   U   n   i   f   o   r   m   u   i   v       =       (   p   r   o   g   r   a   m   ,       l   o   c   a   t   i   o   n   ,       p   a   r   a   m   s   )       =   >       e   m   s   c   r   i   p   t   e   n   W   e   b   G   L   G   e   t   U   n   i   f   o   r   m   (   p   r   o   g   r   a   m   ,       l   o   c   a   t   i   o   n   ,       p   a   r   a   m   s   ,       0   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   U   n   i   f   o   r   m   u   i   v       =       _   g   l   G   e   t   U   n   i   f   o   r   m   u   i   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s   {   c   h   e   c   k   T   y   p   e   s   }       *   /       v   a   r       e   m   s   c   r   i   p   t   e   n   W   e   b   G   L   G   e   t   V   e   r   t   e   x   A   t   t   r   i   b       =       (   i   n   d   e   x   ,       p   n   a   m   e   ,       p   a   r   a   m   s   ,       t   y   p   e   )       =   >       {   
           i   f       (   !   p   a   r   a   m   s   )       {   
                   /   /       G   L   E   S   2       s   p   e   c   i   f   i   c   a   t   i   o   n       d   o   e   s       n   o   t       s   p   e   c   i   f   y       h   o   w       t   o       b   e   h   a   v   e       i   f       p   a   r   a   m   s       i   s       a       n   u   l   l   
                   /   /       p   o   i   n   t   e   r   .       S   i   n   c   e       c   a   l   l   i   n   g       t   h   i   s       f   u   n   c   t   i   o   n       d   o   e   s       n   o   t       m   a   k   e       s   e   n   s   e       i   f       p   a   r   a   m   s       =   =   
                   /   /       n   u   l   l   ,       i   s   s   u   e       a       G   L       e   r   r   o   r       t   o       n   o   t   i   f   y       u   s   e   r       a   b   o   u   t       i   t   .   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   1   )   ;   
                   r   e   t   u   r   n   ;   
           }   
           i   f       (   G   L   .   c   u   r   r   e   n   t   C   o   n   t   e   x   t   .   c   l   i   e   n   t   B   u   f   f   e   r   s   [   i   n   d   e   x   ]   .   e   n   a   b   l   e   d   )       {   
                   e   r   r   (   "   g   l   G   e   t   V   e   r   t   e   x   A   t   t   r   i   b   *   v       o   n       c   l   i   e   n   t   -   s   i   d   e       a   r   r   a   y   :       n   o   t       s   u   p   p   o   r   t   e   d   ,       b   a   d       d   a   t   a       r   e   t   u   r   n   e   d   "   )   ;   
           }   
           v   a   r       d   a   t   a       =       G   L   c   t   x   .   g   e   t   V   e   r   t   e   x   A   t   t   r   i   b   (   i   n   d   e   x   ,       p   n   a   m   e   )   ;   
           i   f       (   p   n   a   m   e       =   =       3   4   9   7   5   )       {   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   p   a   r   a   m   s   )       >   >       2   )   ]       =       d   a   t   a       &   &       d   a   t   a   [   "   n   a   m   e   "   ]   ;   
           }       e   l   s   e       i   f       (   t   y   p   e   o   f       d   a   t   a       =   =       "   n   u   m   b   e   r   "       |   |       t   y   p   e   o   f       d   a   t   a       =   =       "   b   o   o   l   e   a   n   "   )       {   
                   s   w   i   t   c   h       (   t   y   p   e   )       {   
                       c   a   s   e       0   :   
                           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   p   a   r   a   m   s   )       >   >       2   )   ]       =       d   a   t   a   ;   
                           b   r   e   a   k   ;   
   
                       c   a   s   e       2   :   
                           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   F   3   2   )   [   (   (   p   a   r   a   m   s   )       >   >       2   )   ]       =       d   a   t   a   ;   
                           b   r   e   a   k   ;   
   
                       c   a   s   e       5   :   
                           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   p   a   r   a   m   s   )       >   >       2   )   ]       =       M   a   t   h   .   f   r   o   u   n   d   (   d   a   t   a   )   ;   
                           b   r   e   a   k   ;   
                   }   
           }       e   l   s   e       {   
                   f   o   r       (   v   a   r       i       =       0   ;       i       <       d   a   t   a   .   l   e   n   g   t   h   ;       i   +   +   )       {   
                           s   w   i   t   c   h       (   t   y   p   e   )       {   
                               c   a   s   e       0   :   
                                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   (   p   a   r   a   m   s   )       +       (   i       *       4   )   )       >   >       2   )   ]       =       d   a   t   a   [   i   ]   ;   
                                   b   r   e   a   k   ;   
   
                               c   a   s   e       2   :   
                                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   F   3   2   )   [   (   (   (   p   a   r   a   m   s   )       +       (   i       *       4   )   )       >   >       2   )   ]       =       d   a   t   a   [   i   ]   ;   
                                   b   r   e   a   k   ;   
   
                               c   a   s   e       5   :   
                                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   (   p   a   r   a   m   s   )       +       (   i       *       4   )   )       >   >       2   )   ]       =       M   a   t   h   .   f   r   o   u   n   d   (   d   a   t   a   [   i   ]   )   ;   
                                   b   r   e   a   k   ;   
                           }   
                   }   
           }   
   }   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   V   e   r   t   e   x   A   t   t   r   i   b   I   i   v       =       (   i   n   d   e   x   ,       p   n   a   m   e   ,       p   a   r   a   m   s   )       =   >       {   
           /   /       N   .   B   .       T   h   i   s       f   u   n   c   t   i   o   n       m   a   y       o   n   l   y       b   e       c   a   l   l   e   d       i   f       t   h   e       v   e   r   t   e   x       a   t   t   r   i   b   u   t   e       w   a   s       s   p   e   c   i   f   i   e   d       u   s   i   n   g       t   h   e       f   u   n   c   t   i   o   n       g   l   V   e   r   t   e   x   A   t   t   r   i   b   I   4   i   v   (   )   ,   
           /   /       o   t   h   e   r   w   i   s   e       t   h   e       r   e   s   u   l   t   s       a   r   e       u   n   d   e   f   i   n   e   d   .       (   G   L   E   S   3       s   p   e   c       6   .   1   .   1   2   )   
           e   m   s   c   r   i   p   t   e   n   W   e   b   G   L   G   e   t   V   e   r   t   e   x   A   t   t   r   i   b   (   i   n   d   e   x   ,       p   n   a   m   e   ,       p   a   r   a   m   s   ,       0   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   V   e   r   t   e   x   A   t   t   r   i   b   I   i   v       =       _   g   l   G   e   t   V   e   r   t   e   x   A   t   t   r   i   b   I   i   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   V   e   r   t   e   x   A   t   t   r   i   b   I   u   i   v       =       _   g   l   G   e   t   V   e   r   t   e   x   A   t   t   r   i   b   I   i   v   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   V   e   r   t   e   x   A   t   t   r   i   b   I   u   i   v       =       _   g   l   G   e   t   V   e   r   t   e   x   A   t   t   r   i   b   I   u   i   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   V   e   r   t   e   x   A   t   t   r   i   b   P   o   i   n   t   e   r   v       =       (   i   n   d   e   x   ,       p   n   a   m   e   ,       p   o   i   n   t   e   r   )       =   >       {   
           i   f       (   !   p   o   i   n   t   e   r   )       {   
                   /   /       G   L   E   S   2       s   p   e   c   i   f   i   c   a   t   i   o   n       d   o   e   s       n   o   t       s   p   e   c   i   f   y       h   o   w       t   o       b   e   h   a   v   e       i   f       p   o   i   n   t   e   r       i   s       a       n   u   l   l   
                   /   /       p   o   i   n   t   e   r   .       S   i   n   c   e       c   a   l   l   i   n   g       t   h   i   s       f   u   n   c   t   i   o   n       d   o   e   s       n   o   t       m   a   k   e       s   e   n   s   e       i   f       p   o   i   n   t   e   r       =   =   
                   /   /       n   u   l   l   ,       i   s   s   u   e       a       G   L       e   r   r   o   r       t   o       n   o   t   i   f   y       u   s   e   r       a   b   o   u   t       i   t   .   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   1   )   ;   
                   r   e   t   u   r   n   ;   
           }   
           i   f       (   G   L   .   c   u   r   r   e   n   t   C   o   n   t   e   x   t   .   c   l   i   e   n   t   B   u   f   f   e   r   s   [   i   n   d   e   x   ]   .   e   n   a   b   l   e   d   )       {   
                   e   r   r   (   "   g   l   G   e   t   V   e   r   t   e   x   A   t   t   r   i   b   P   o   i   n   t   e   r       o   n       c   l   i   e   n   t   -   s   i   d   e       a   r   r   a   y   :       n   o   t       s   u   p   p   o   r   t   e   d   ,       b   a   d       d   a   t   a       r   e   t   u   r   n   e   d   "   )   ;   
           }   
           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   p   o   i   n   t   e   r   )       >   >       2   )   ]       =       G   L   c   t   x   .   g   e   t   V   e   r   t   e   x   A   t   t   r   i   b   O   f   f   s   e   t   (   i   n   d   e   x   ,       p   n   a   m   e   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   V   e   r   t   e   x   A   t   t   r   i   b   P   o   i   n   t   e   r   v       =       _   g   l   G   e   t   V   e   r   t   e   x   A   t   t   r   i   b   P   o   i   n   t   e   r   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   V   e   r   t   e   x   A   t   t   r   i   b   f   v       =       (   i   n   d   e   x   ,       p   n   a   m   e   ,       p   a   r   a   m   s   )       =   >       {   
           /   /       N   .   B   .       T   h   i   s       f   u   n   c   t   i   o   n       m   a   y       o   n   l   y       b   e       c   a   l   l   e   d       i   f       t   h   e       v   e   r   t   e   x       a   t   t   r   i   b   u   t   e       w   a   s   
           /   /       s   p   e   c   i   f   i   e   d       u   s   i   n   g       t   h   e       f   u   n   c   t   i   o   n       g   l   V   e   r   t   e   x   A   t   t   r   i   b   *   f   (   )   ,       o   t   h   e   r   w   i   s   e       t   h   e       r   e   s   u   l   t   s   
           /   /       a   r   e       u   n   d   e   f   i   n   e   d   .       (   G   L   E   S   3       s   p   e   c       6   .   1   .   1   2   )   
           e   m   s   c   r   i   p   t   e   n   W   e   b   G   L   G   e   t   V   e   r   t   e   x   A   t   t   r   i   b   (   i   n   d   e   x   ,       p   n   a   m   e   ,       p   a   r   a   m   s   ,       2   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   V   e   r   t   e   x   A   t   t   r   i   b   f   v       =       _   g   l   G   e   t   V   e   r   t   e   x   A   t   t   r   i   b   f   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   G   e   t   V   e   r   t   e   x   A   t   t   r   i   b   i   v       =       (   i   n   d   e   x   ,       p   n   a   m   e   ,       p   a   r   a   m   s   )       =   >       {   
           /   /       N   .   B   .       T   h   i   s       f   u   n   c   t   i   o   n       m   a   y       o   n   l   y       b   e       c   a   l   l   e   d       i   f       t   h   e       v   e   r   t   e   x       a   t   t   r   i   b   u   t   e       w   a   s   
           /   /       s   p   e   c   i   f   i   e   d       u   s   i   n   g       t   h   e       f   u   n   c   t   i   o   n       g   l   V   e   r   t   e   x   A   t   t   r   i   b   *   f   (   )   ,       o   t   h   e   r   w   i   s   e       t   h   e       r   e   s   u   l   t   s   
           /   /       a   r   e       u   n   d   e   f   i   n   e   d   .       (   G   L   E   S   3       s   p   e   c       6   .   1   .   1   2   )   
           e   m   s   c   r   i   p   t   e   n   W   e   b   G   L   G   e   t   V   e   r   t   e   x   A   t   t   r   i   b   (   i   n   d   e   x   ,       p   n   a   m   e   ,       p   a   r   a   m   s   ,       5   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   V   e   r   t   e   x   A   t   t   r   i   b   i   v       =       _   g   l   G   e   t   V   e   r   t   e   x   A   t   t   r   i   b   i   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   H   i   n   t       =       (   x   0   ,       x   1   )       =   >       G   L   c   t   x   .   h   i   n   t   (   x   0   ,       x   1   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   H   i   n   t       =       _   g   l   H   i   n   t   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   I   n   v   a   l   i   d   a   t   e   F   r   a   m   e   b   u   f   f   e   r       =       (   t   a   r   g   e   t   ,       n   u   m   A   t   t   a   c   h   m   e   n   t   s   ,       a   t   t   a   c   h   m   e   n   t   s   )       =   >       {   
           v   a   r       l   i   s   t       =       t   e   m   p   F   i   x   e   d   L   e   n   g   t   h   A   r   r   a   y   [   n   u   m   A   t   t   a   c   h   m   e   n   t   s   ]   ;   
           f   o   r       (   v   a   r       i       =       0   ;       i       <       n   u   m   A   t   t   a   c   h   m   e   n   t   s   ;       i   +   +   )       {   
                   l   i   s   t   [   i   ]       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   (   a   t   t   a   c   h   m   e   n   t   s   )       +       (   i       *       4   )   )       >   >       2   )   ]   ;   
           }   
           G   L   c   t   x   .   i   n   v   a   l   i   d   a   t   e   F   r   a   m   e   b   u   f   f   e   r   (   t   a   r   g   e   t   ,       l   i   s   t   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   I   n   v   a   l   i   d   a   t   e   F   r   a   m   e   b   u   f   f   e   r       =       _   g   l   I   n   v   a   l   i   d   a   t   e   F   r   a   m   e   b   u   f   f   e   r   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   I   n   v   a   l   i   d   a   t   e   S   u   b   F   r   a   m   e   b   u   f   f   e   r       =       (   t   a   r   g   e   t   ,       n   u   m   A   t   t   a   c   h   m   e   n   t   s   ,       a   t   t   a   c   h   m   e   n   t   s   ,       x   ,       y   ,       w   i   d   t   h   ,       h   e   i   g   h   t   )       =   >       {   
           v   a   r       l   i   s   t       =       t   e   m   p   F   i   x   e   d   L   e   n   g   t   h   A   r   r   a   y   [   n   u   m   A   t   t   a   c   h   m   e   n   t   s   ]   ;   
           f   o   r       (   v   a   r       i       =       0   ;       i       <       n   u   m   A   t   t   a   c   h   m   e   n   t   s   ;       i   +   +   )       {   
                   l   i   s   t   [   i   ]       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   (   a   t   t   a   c   h   m   e   n   t   s   )       +       (   i       *       4   )   )       >   >       2   )   ]   ;   
           }   
           G   L   c   t   x   .   i   n   v   a   l   i   d   a   t   e   S   u   b   F   r   a   m   e   b   u   f   f   e   r   (   t   a   r   g   e   t   ,       l   i   s   t   ,       x   ,       y   ,       w   i   d   t   h   ,       h   e   i   g   h   t   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   I   n   v   a   l   i   d   a   t   e   S   u   b   F   r   a   m   e   b   u   f   f   e   r       =       _   g   l   I   n   v   a   l   i   d   a   t   e   S   u   b   F   r   a   m   e   b   u   f   f   e   r   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   I   s   B   u   f   f   e   r       =       b   u   f   f   e   r       =   >       {   
           v   a   r       b       =       G   L   .   b   u   f   f   e   r   s   [   b   u   f   f   e   r   ]   ;   
           i   f       (   !   b   )       r   e   t   u   r   n       0   ;   
           r   e   t   u   r   n       G   L   c   t   x   .   i   s   B   u   f   f   e   r   (   b   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   I   s   B   u   f   f   e   r       =       _   g   l   I   s   B   u   f   f   e   r   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   I   s   E   n   a   b   l   e   d       =       x   0       =   >       G   L   c   t   x   .   i   s   E   n   a   b   l   e   d   (   x   0   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   I   s   E   n   a   b   l   e   d       =       _   g   l   I   s   E   n   a   b   l   e   d   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   I   s   F   r   a   m   e   b   u   f   f   e   r       =       f   r   a   m   e   b   u   f   f   e   r       =   >       {   
           v   a   r       f   b       =       G   L   .   f   r   a   m   e   b   u   f   f   e   r   s   [   f   r   a   m   e   b   u   f   f   e   r   ]   ;   
           i   f       (   !   f   b   )       r   e   t   u   r   n       0   ;   
           r   e   t   u   r   n       G   L   c   t   x   .   i   s   F   r   a   m   e   b   u   f   f   e   r   (   f   b   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   I   s   F   r   a   m   e   b   u   f   f   e   r       =       _   g   l   I   s   F   r   a   m   e   b   u   f   f   e   r   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   I   s   P   r   o   g   r   a   m       =       p   r   o   g   r   a   m       =   >       {   
           p   r   o   g   r   a   m       =       G   L   .   p   r   o   g   r   a   m   s   [   p   r   o   g   r   a   m   ]   ;   
           i   f       (   !   p   r   o   g   r   a   m   )       r   e   t   u   r   n       0   ;   
           r   e   t   u   r   n       G   L   c   t   x   .   i   s   P   r   o   g   r   a   m   (   p   r   o   g   r   a   m   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   I   s   P   r   o   g   r   a   m       =       _   g   l   I   s   P   r   o   g   r   a   m   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   I   s   Q   u   e   r   y       =       i   d       =   >       {   
           v   a   r       q   u   e   r   y       =       G   L   .   q   u   e   r   i   e   s   [   i   d   ]   ;   
           i   f       (   !   q   u   e   r   y   )       r   e   t   u   r   n       0   ;   
           r   e   t   u   r   n       G   L   c   t   x   .   i   s   Q   u   e   r   y   (   q   u   e   r   y   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   I   s   Q   u   e   r   y       =       _   g   l   I   s   Q   u   e   r   y   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   I   s   Q   u   e   r   y   E   X   T       =       i   d       =   >       {   
           v   a   r       q   u   e   r   y       =       G   L   .   q   u   e   r   i   e   s   [   i   d   ]   ;   
           i   f       (   !   q   u   e   r   y   )       r   e   t   u   r   n       0   ;   
           r   e   t   u   r   n       G   L   c   t   x   .   d   i   s   j   o   i   n   t   T   i   m   e   r   Q   u   e   r   y   E   x   t   [   "   i   s   Q   u   e   r   y   E   X   T   "   ]   (   q   u   e   r   y   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   I   s   Q   u   e   r   y   E   X   T       =       _   g   l   I   s   Q   u   e   r   y   E   X   T   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   I   s   R   e   n   d   e   r   b   u   f   f   e   r       =       r   e   n   d   e   r   b   u   f   f   e   r       =   >       {   
           v   a   r       r   b       =       G   L   .   r   e   n   d   e   r   b   u   f   f   e   r   s   [   r   e   n   d   e   r   b   u   f   f   e   r   ]   ;   
           i   f       (   !   r   b   )       r   e   t   u   r   n       0   ;   
           r   e   t   u   r   n       G   L   c   t   x   .   i   s   R   e   n   d   e   r   b   u   f   f   e   r   (   r   b   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   I   s   R   e   n   d   e   r   b   u   f   f   e   r       =       _   g   l   I   s   R   e   n   d   e   r   b   u   f   f   e   r   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   I   s   S   a   m   p   l   e   r       =       i   d       =   >       {   
           v   a   r       s   a   m   p   l   e   r       =       G   L   .   s   a   m   p   l   e   r   s   [   i   d   ]   ;   
           i   f       (   !   s   a   m   p   l   e   r   )       r   e   t   u   r   n       0   ;   
           r   e   t   u   r   n       G   L   c   t   x   .   i   s   S   a   m   p   l   e   r   (   s   a   m   p   l   e   r   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   I   s   S   a   m   p   l   e   r       =       _   g   l   I   s   S   a   m   p   l   e   r   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   I   s   S   h   a   d   e   r       =       s   h   a   d   e   r       =   >       {   
           v   a   r       s       =       G   L   .   s   h   a   d   e   r   s   [   s   h   a   d   e   r   ]   ;   
           i   f       (   !   s   )       r   e   t   u   r   n       0   ;   
           r   e   t   u   r   n       G   L   c   t   x   .   i   s   S   h   a   d   e   r   (   s   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   I   s   S   h   a   d   e   r       =       _   g   l   I   s   S   h   a   d   e   r   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   I   s   S   y   n   c       =       s   y   n   c       =   >       G   L   c   t   x   .   i   s   S   y   n   c   (   G   L   .   s   y   n   c   s   [   s   y   n   c   ]   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   I   s   S   y   n   c       =       _   g   l   I   s   S   y   n   c   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   I   s   T   e   x   t   u   r   e       =       i   d       =   >       {   
           v   a   r       t   e   x   t   u   r   e       =       G   L   .   t   e   x   t   u   r   e   s   [   i   d   ]   ;   
           i   f       (   !   t   e   x   t   u   r   e   )       r   e   t   u   r   n       0   ;   
           r   e   t   u   r   n       G   L   c   t   x   .   i   s   T   e   x   t   u   r   e   (   t   e   x   t   u   r   e   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   I   s   T   e   x   t   u   r   e       =       _   g   l   I   s   T   e   x   t   u   r   e   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   I   s   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k       =       i   d       =   >       G   L   c   t   x   .   i   s   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   (   G   L   .   t   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   s   [   i   d   ]   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   I   s   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k       =       _   g   l   I   s   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   I   s   V   e   r   t   e   x   A   r   r   a   y       =       a   r   r   a   y       =   >       {   
           v   a   r       v   a   o       =       G   L   .   v   a   o   s   [   a   r   r   a   y   ]   ;   
           i   f       (   !   v   a   o   )       r   e   t   u   r   n       0   ;   
           r   e   t   u   r   n       G   L   c   t   x   .   i   s   V   e   r   t   e   x   A   r   r   a   y   (   v   a   o   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   I   s   V   e   r   t   e   x   A   r   r   a   y       =       _   g   l   I   s   V   e   r   t   e   x   A   r   r   a   y   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   I   s   V   e   r   t   e   x   A   r   r   a   y   O   E   S       =       _   g   l   I   s   V   e   r   t   e   x   A   r   r   a   y   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   I   s   V   e   r   t   e   x   A   r   r   a   y   O   E   S       =       _   g   l   I   s   V   e   r   t   e   x   A   r   r   a   y   O   E   S   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   L   i   n   e   W   i   d   t   h       =       x   0       =   >       G   L   c   t   x   .   l   i   n   e   W   i   d   t   h   (   x   0   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   L   i   n   e   W   i   d   t   h       =       _   g   l   L   i   n   e   W   i   d   t   h   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   L   i   n   k   P   r   o   g   r   a   m       =       p   r   o   g   r   a   m       =   >       {   
           p   r   o   g   r   a   m       =       G   L   .   p   r   o   g   r   a   m   s   [   p   r   o   g   r   a   m   ]   ;   
           G   L   c   t   x   .   l   i   n   k   P   r   o   g   r   a   m   (   p   r   o   g   r   a   m   )   ;   
           /   /       I   n   v   a   l   i   d   a   t   e       e   a   r   l   i   e   r       c   o   m   p   u   t   e   d       u   n   i   f   o   r   m   -   >   I   D       m   a   p   p   i   n   g   s   ,       t   h   o   s   e       h   a   v   e       n   o   w       b   e   c   o   m   e       s   t   a   l   e   
           p   r   o   g   r   a   m   .   u   n   i   f   o   r   m   L   o   c   s   B   y   I   d       =       0   ;   
           /   /       M   a   r   k       a   s       n   u   l   l   -   l   i   k   e       s   o       t   h   a   t       g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   (   )       k   n   o   w   s       t   o       p   o   p   u   l   a   t   e       t   h   i   s       a   g   a   i   n   .   
           p   r   o   g   r   a   m   .   u   n   i   f   o   r   m   S   i   z   e   A   n   d   I   d   s   B   y   N   a   m   e       =       {   }   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   L   i   n   k   P   r   o   g   r   a   m       =       _   g   l   L   i   n   k   P   r   o   g   r   a   m   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   M   a   p   B   u   f   f   e   r   R   a   n   g   e       =       (   t   a   r   g   e   t   ,       o   f   f   s   e   t   ,       l   e   n   g   t   h   ,       a   c   c   e   s   s   )       =   >       {   
           i   f       (   (   a   c   c   e   s   s       &       (   1       |       3   2   )   )       !   =       0   )       {   
                   e   r   r   (   "   g   l   M   a   p   B   u   f   f   e   r   R   a   n   g   e       a   c   c   e   s   s       d   o   e   s       n   o   t       s   u   p   p   o   r   t       M   A   P   _   R   E   A   D       o   r       M   A   P   _   U   N   S   Y   N   C   H   R   O   N   I   Z   E   D   "   )   ;   
                   r   e   t   u   r   n       0   ;   
           }   
           i   f       (   (   a   c   c   e   s   s       &       2   )       =   =       0   )       {   
                   e   r   r   (   "   g   l   M   a   p   B   u   f   f   e   r   R   a   n   g   e       a   c   c   e   s   s       m   u   s   t       i   n   c   l   u   d   e       M   A   P   _   W   R   I   T   E   "   )   ;   
                   r   e   t   u   r   n       0   ;   
           }   
           i   f       (   (   a   c   c   e   s   s       &       (   4       |       8   )   )       =   =       0   )       {   
                   e   r   r   (   "   g   l   M   a   p   B   u   f   f   e   r   R   a   n   g   e       a   c   c   e   s   s       m   u   s   t       i   n   c   l   u   d   e       I   N   V   A   L   I   D   A   T   E   _   B   U   F   F   E   R       o   r       I   N   V   A   L   I   D   A   T   E   _   R   A   N   G   E   "   )   ;   
                   r   e   t   u   r   n       0   ;   
           }   
           i   f       (   !   e   m   s   c   r   i   p   t   e   n   W   e   b   G   L   V   a   l   i   d   a   t   e   M   a   p   B   u   f   f   e   r   T   a   r   g   e   t   (   t   a   r   g   e   t   )   )       {   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   0   )   ;   
                   e   r   r   (   "   G   L   _   I   N   V   A   L   I   D   _   E   N   U   M       i   n       g   l   M   a   p   B   u   f   f   e   r   R   a   n   g   e   "   )   ;   
                   r   e   t   u   r   n       0   ;   
           }   
           v   a   r       m   e   m       =       _   m   a   l   l   o   c   (   l   e   n   g   t   h   )   ,       b   i   n   d   i   n   g       =       e   m   s   c   r   i   p   t   e   n   W   e   b   G   L   G   e   t   B   u   f   f   e   r   B   i   n   d   i   n   g   (   t   a   r   g   e   t   )   ;   
           i   f       (   !   m   e   m   )       r   e   t   u   r   n       0   ;   
           b   i   n   d   i   n   g       =       G   L   .   m   a   p   p   e   d   B   u   f   f   e   r   s   [   b   i   n   d   i   n   g   ]       ?   ?   =       {   }   ;   
           b   i   n   d   i   n   g   .   o   f   f   s   e   t       =       o   f   f   s   e   t   ;   
           b   i   n   d   i   n   g   .   l   e   n   g   t   h       =       l   e   n   g   t   h   ;   
           b   i   n   d   i   n   g   .   m   e   m       =       m   e   m   ;   
           b   i   n   d   i   n   g   .   a   c   c   e   s   s       =       a   c   c   e   s   s   ;   
           r   e   t   u   r   n       m   e   m   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   M   a   p   B   u   f   f   e   r   R   a   n   g   e       =       _   g   l   M   a   p   B   u   f   f   e   r   R   a   n   g   e   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   P   a   u   s   e   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k       =       (   )       =   >       G   L   c   t   x   .   p   a   u   s   e   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   (   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   P   a   u   s   e   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k       =       _   g   l   P   a   u   s   e   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   P   i   x   e   l   S   t   o   r   e   i       =       (   p   n   a   m   e   ,       p   a   r   a   m   )       =   >       {   
           i   f       (   p   n   a   m   e       =   =       3   3   1   7   )       {   
                   G   L   .   u   n   p   a   c   k   A   l   i   g   n   m   e   n   t       =       p   a   r   a   m   ;   
           }       e   l   s   e       i   f       (   p   n   a   m   e       =   =       3   3   1   4   )       {   
                   G   L   .   u   n   p   a   c   k   R   o   w   L   e   n   g   t   h       =       p   a   r   a   m   ;   
           }   
           G   L   c   t   x   .   p   i   x   e   l   S   t   o   r   e   i   (   p   n   a   m   e   ,       p   a   r   a   m   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   P   i   x   e   l   S   t   o   r   e   i       =       _   g   l   P   i   x   e   l   S   t   o   r   e   i   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   P   o   l   y   g   o   n   M   o   d   e   W   E   B   G   L       =       (   f   a   c   e   ,       m   o   d   e   )       =   >       {   
           G   L   c   t   x   .   w   e   b   g   l   P   o   l   y   g   o   n   M   o   d   e   [   "   p   o   l   y   g   o   n   M   o   d   e   W   E   B   G   L   "   ]   (   f   a   c   e   ,       m   o   d   e   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   P   o   l   y   g   o   n   M   o   d   e   W   E   B   G   L       =       _   g   l   P   o   l   y   g   o   n   M   o   d   e   W   E   B   G   L   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   P   o   l   y   g   o   n   O   f   f   s   e   t       =       (   x   0   ,       x   1   )       =   >       G   L   c   t   x   .   p   o   l   y   g   o   n   O   f   f   s   e   t   (   x   0   ,       x   1   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   P   o   l   y   g   o   n   O   f   f   s   e   t       =       _   g   l   P   o   l   y   g   o   n   O   f   f   s   e   t   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   P   o   l   y   g   o   n   O   f   f   s   e   t   C   l   a   m   p   E   X   T       =       (   f   a   c   t   o   r   ,       u   n   i   t   s   ,       c   l   a   m   p   )       =   >       {   
           G   L   c   t   x   .   e   x   t   P   o   l   y   g   o   n   O   f   f   s   e   t   C   l   a   m   p   [   "   p   o   l   y   g   o   n   O   f   f   s   e   t   C   l   a   m   p   E   X   T   "   ]   (   f   a   c   t   o   r   ,       u   n   i   t   s   ,       c   l   a   m   p   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   P   o   l   y   g   o   n   O   f   f   s   e   t   C   l   a   m   p   E   X   T       =       _   g   l   P   o   l   y   g   o   n   O   f   f   s   e   t   C   l   a   m   p   E   X   T   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   P   r   o   g   r   a   m   B   i   n   a   r   y       =       (   p   r   o   g   r   a   m   ,       b   i   n   a   r   y   F   o   r   m   a   t   ,       b   i   n   a   r   y   ,       l   e   n   g   t   h   )       =   >       {   
           G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   0   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   P   r   o   g   r   a   m   B   i   n   a   r   y       =       _   g   l   P   r   o   g   r   a   m   B   i   n   a   r   y   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   P   r   o   g   r   a   m   P   a   r   a   m   e   t   e   r   i       =       (   p   r   o   g   r   a   m   ,       p   n   a   m   e   ,       v   a   l   u   e   )       =   >       {   
           G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   0   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   P   r   o   g   r   a   m   P   a   r   a   m   e   t   e   r   i       =       _   g   l   P   r   o   g   r   a   m   P   a   r   a   m   e   t   e   r   i   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   Q   u   e   r   y   C   o   u   n   t   e   r   E   X   T       =       (   i   d   ,       t   a   r   g   e   t   )       =   >       {   
           G   L   c   t   x   .   d   i   s   j   o   i   n   t   T   i   m   e   r   Q   u   e   r   y   E   x   t   [   "   q   u   e   r   y   C   o   u   n   t   e   r   E   X   T   "   ]   (   G   L   .   q   u   e   r   i   e   s   [   i   d   ]   ,       t   a   r   g   e   t   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   Q   u   e   r   y   C   o   u   n   t   e   r   E   X   T       =       _   g   l   Q   u   e   r   y   C   o   u   n   t   e   r   E   X   T   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   R   e   a   d   B   u   f   f   e   r       =       x   0       =   >       G   L   c   t   x   .   r   e   a   d   B   u   f   f   e   r   (   x   0   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   R   e   a   d   B   u   f   f   e   r       =       _   g   l   R   e   a   d   B   u   f   f   e   r   ;   
   
   v   a   r       h   e   a   p   O   b   j   e   c   t   F   o   r   W   e   b   G   L   T   y   p   e       =       t   y   p   e       =   >       {   
           /   /       M   i   c   r   o   -   o   p   t   i   m   i   z   a   t   i   o   n       f   o   r       s   i   z   e   :       S   u   b   t   r   a   c   t       l   o   w   e   s   t       G   L       e   n   u   m       n   u   m   b   e   r       (   0   x   1   4   0   0   /   *       G   L   _   B   Y   T   E       *   /   )       f   r   o   m       t   y   p   e       t   o       c   o   m   p   a   r   e   
           /   /       s   m   a   l   l   e   r       v   a   l   u   e   s       f   o   r       t   h   e       h   e   a   p   ,       f   o   r       s   h   o   r   t   e   r       g   e   n   e   r   a   t   e   d       c   o   d   e       s   i   z   e   .   
           /   /       A   l   s   o       t   h   e       t   y   p   e       H   E   A   P   U   1   6       i   s       n   o   t       t   e   s   t   e   d       f   o   r       e   x   p   l   i   c   i   t   l   y   ,       b   u   t       a   n   y       u   n   r   e   c   o   g   n   i   z   e   d       t   y   p   e       w   i   l   l       r   e   t   u   r   n       o   u   t       H   E   A   P   U   1   6   .   
           /   /       (   s   i   n   c   e       m   o   s   t       t   y   p   e   s       a   r   e       H   E   A   P   U   1   6   )   
           t   y   p   e       -   =       5   1   2   0   ;   
           i   f       (   t   y   p   e       =   =       0   )       r   e   t   u   r   n       g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   8   ;   
           i   f       (   t   y   p   e       =   =       1   )       r   e   t   u   r   n       g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   8   ;   
           i   f       (   t   y   p   e       =   =       2   )       r   e   t   u   r   n       g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   1   6   ;   
           i   f       (   t   y   p   e       =   =       4   )       r   e   t   u   r   n       g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   ;   
           i   f       (   t   y   p   e       =   =       6   )       r   e   t   u   r   n       g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   F   3   2   ;   
           i   f       (   t   y   p   e       =   =       5       |   |       t   y   p   e       =   =       2   8   9   2   2       |   |       t   y   p   e       =   =       2   8   5   2   0       |   |       t   y   p   e       =   =       3   0   7   7   9       |   |       t   y   p   e       =   =       3   0   7   8   2   )       r   e   t   u   r   n       g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       
           H   E   A   P   U   3   2   ;   
           r   e   t   u   r   n       g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   1   6   ;   
   }   ;   
   
   v   a   r       t   o   T   y   p   e   d   A   r   r   a   y   I   n   d   e   x       =       (   p   o   i   n   t   e   r   ,       h   e   a   p   )       =   >       p   o   i   n   t   e   r       >   >   >       (   3   1       -       M   a   t   h   .   c   l   z   3   2   (   h   e   a   p   .   B   Y   T   E   S   _   P   E   R   _   E   L   E   M   E   N   T   )   )   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   R   e   a   d   P   i   x   e   l   s       =       (   x   ,       y   ,       w   i   d   t   h   ,       h   e   i   g   h   t   ,       f   o   r   m   a   t   ,       t   y   p   e   ,       p   i   x   e   l   s   )       =   >       {   
           i   f       (   t   r   u   e   )       {   
                   i   f       (   G   L   c   t   x   .   c   u   r   r   e   n   t   P   i   x   e   l   P   a   c   k   B   u   f   f   e   r   B   i   n   d   i   n   g   )       {   
                           G   L   c   t   x   .   r   e   a   d   P   i   x   e   l   s   (   x   ,       y   ,       w   i   d   t   h   ,       h   e   i   g   h   t   ,       f   o   r   m   a   t   ,       t   y   p   e   ,       p   i   x   e   l   s   )   ;   
                           r   e   t   u   r   n   ;   
                   }   
                   v   a   r       h   e   a   p       =       h   e   a   p   O   b   j   e   c   t   F   o   r   W   e   b   G   L   T   y   p   e   (   t   y   p   e   )   ;   
                   v   a   r       t   a   r   g   e   t       =       t   o   T   y   p   e   d   A   r   r   a   y   I   n   d   e   x   (   p   i   x   e   l   s   ,       h   e   a   p   )   ;   
                   G   L   c   t   x   .   r   e   a   d   P   i   x   e   l   s   (   x   ,       y   ,       w   i   d   t   h   ,       h   e   i   g   h   t   ,       f   o   r   m   a   t   ,       t   y   p   e   ,       h   e   a   p   ,       t   a   r   g   e   t   )   ;   
                   r   e   t   u   r   n   ;   
           }   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   R   e   a   d   P   i   x   e   l   s       =       _   g   l   R   e   a   d   P   i   x   e   l   s   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   R   e   l   e   a   s   e   S   h   a   d   e   r   C   o   m   p   i   l   e   r       =       (   )       =   >       {   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   R   e   l   e   a   s   e   S   h   a   d   e   r   C   o   m   p   i   l   e   r       =       _   g   l   R   e   l   e   a   s   e   S   h   a   d   e   r   C   o   m   p   i   l   e   r   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   R   e   n   d   e   r   b   u   f   f   e   r   S   t   o   r   a   g   e       =       (   x   0   ,       x   1   ,       x   2   ,       x   3   )       =   >       G   L   c   t   x   .   r   e   n   d   e   r   b   u   f   f   e   r   S   t   o   r   a   g   e   (   x   0   ,       x   1   ,       x   2   ,       x   3   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   R   e   n   d   e   r   b   u   f   f   e   r   S   t   o   r   a   g   e       =       _   g   l   R   e   n   d   e   r   b   u   f   f   e   r   S   t   o   r   a   g   e   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   R   e   n   d   e   r   b   u   f   f   e   r   S   t   o   r   a   g   e   M   u   l   t   i   s   a   m   p   l   e       =       (   x   0   ,       x   1   ,       x   2   ,       x   3   ,       x   4   )       =   >       G   L   c   t   x   .   r   e   n   d   e   r   b   u   f   f   e   r   S   t   o   r   a   g   e   M   u   l   t   i   s   a   m   p   l   e   (   x   0   ,       x   1   ,       x   2   ,       x   3   ,       x   4   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   R   e   n   d   e   r   b   u   f   f   e   r   S   t   o   r   a   g   e   M   u   l   t   i   s   a   m   p   l   e       =       _   g   l   R   e   n   d   e   r   b   u   f   f   e   r   S   t   o   r   a   g   e   M   u   l   t   i   s   a   m   p   l   e   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   R   e   s   u   m   e   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k       =       (   )       =   >       G   L   c   t   x   .   r   e   s   u   m   e   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   (   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   R   e   s   u   m   e   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k       =       _   g   l   R   e   s   u   m   e   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   S   a   m   p   l   e   C   o   v   e   r   a   g   e       =       (   v   a   l   u   e   ,       i   n   v   e   r   t   )       =   >       {   
           G   L   c   t   x   .   s   a   m   p   l   e   C   o   v   e   r   a   g   e   (   v   a   l   u   e   ,       !   !   i   n   v   e   r   t   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   S   a   m   p   l   e   C   o   v   e   r   a   g   e       =       _   g   l   S   a   m   p   l   e   C   o   v   e   r   a   g   e   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   S   a   m   p   l   e   r   P   a   r   a   m   e   t   e   r   f       =       (   s   a   m   p   l   e   r   ,       p   n   a   m   e   ,       p   a   r   a   m   )       =   >       {   
           G   L   c   t   x   .   s   a   m   p   l   e   r   P   a   r   a   m   e   t   e   r   f   (   G   L   .   s   a   m   p   l   e   r   s   [   s   a   m   p   l   e   r   ]   ,       p   n   a   m   e   ,       p   a   r   a   m   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   S   a   m   p   l   e   r   P   a   r   a   m   e   t   e   r   f       =       _   g   l   S   a   m   p   l   e   r   P   a   r   a   m   e   t   e   r   f   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   S   a   m   p   l   e   r   P   a   r   a   m   e   t   e   r   f   v       =       (   s   a   m   p   l   e   r   ,       p   n   a   m   e   ,       p   a   r   a   m   s   )       =   >       {   
           v   a   r       p   a   r   a   m       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   F   3   2   )   [   (   (   p   a   r   a   m   s   )       >   >       2   )   ]   ;   
           G   L   c   t   x   .   s   a   m   p   l   e   r   P   a   r   a   m   e   t   e   r   f   (   G   L   .   s   a   m   p   l   e   r   s   [   s   a   m   p   l   e   r   ]   ,       p   n   a   m   e   ,       p   a   r   a   m   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   S   a   m   p   l   e   r   P   a   r   a   m   e   t   e   r   f   v       =       _   g   l   S   a   m   p   l   e   r   P   a   r   a   m   e   t   e   r   f   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   S   a   m   p   l   e   r   P   a   r   a   m   e   t   e   r   i       =       (   s   a   m   p   l   e   r   ,       p   n   a   m   e   ,       p   a   r   a   m   )       =   >       {   
           G   L   c   t   x   .   s   a   m   p   l   e   r   P   a   r   a   m   e   t   e   r   i   (   G   L   .   s   a   m   p   l   e   r   s   [   s   a   m   p   l   e   r   ]   ,       p   n   a   m   e   ,       p   a   r   a   m   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   S   a   m   p   l   e   r   P   a   r   a   m   e   t   e   r   i       =       _   g   l   S   a   m   p   l   e   r   P   a   r   a   m   e   t   e   r   i   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   S   a   m   p   l   e   r   P   a   r   a   m   e   t   e   r   i   v       =       (   s   a   m   p   l   e   r   ,       p   n   a   m   e   ,       p   a   r   a   m   s   )       =   >       {   
           v   a   r       p   a   r   a   m       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   p   a   r   a   m   s   )       >   >       2   )   ]   ;   
           G   L   c   t   x   .   s   a   m   p   l   e   r   P   a   r   a   m   e   t   e   r   i   (   G   L   .   s   a   m   p   l   e   r   s   [   s   a   m   p   l   e   r   ]   ,       p   n   a   m   e   ,       p   a   r   a   m   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   S   a   m   p   l   e   r   P   a   r   a   m   e   t   e   r   i   v       =       _   g   l   S   a   m   p   l   e   r   P   a   r   a   m   e   t   e   r   i   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   S   c   i   s   s   o   r       =       (   x   0   ,       x   1   ,       x   2   ,       x   3   )       =   >       G   L   c   t   x   .   s   c   i   s   s   o   r   (   x   0   ,       x   1   ,       x   2   ,       x   3   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   S   c   i   s   s   o   r       =       _   g   l   S   c   i   s   s   o   r   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   S   h   a   d   e   r   B   i   n   a   r   y       =       (   c   o   u   n   t   ,       s   h   a   d   e   r   s   ,       b   i   n   a   r   y   f   o   r   m   a   t   ,       b   i   n   a   r   y   ,       l   e   n   g   t   h   )       =   >       {   
           G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   0   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   S   h   a   d   e   r   B   i   n   a   r   y       =       _   g   l   S   h   a   d   e   r   B   i   n   a   r   y   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   S   h   a   d   e   r   S   o   u   r   c   e       =       (   s   h   a   d   e   r   ,       c   o   u   n   t   ,       s   t   r   i   n   g   ,       l   e   n   g   t   h   )       =   >       {   
           v   a   r       s   o   u   r   c   e       =       G   L   .   g   e   t   S   o   u   r   c   e   (   s   h   a   d   e   r   ,       c   o   u   n   t   ,       s   t   r   i   n   g   ,       l   e   n   g   t   h   )   ;   
           G   L   c   t   x   .   s   h   a   d   e   r   S   o   u   r   c   e   (   G   L   .   s   h   a   d   e   r   s   [   s   h   a   d   e   r   ]   ,       s   o   u   r   c   e   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   S   h   a   d   e   r   S   o   u   r   c   e       =       _   g   l   S   h   a   d   e   r   S   o   u   r   c   e   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   S   t   e   n   c   i   l   F   u   n   c       =       (   x   0   ,       x   1   ,       x   2   )       =   >       G   L   c   t   x   .   s   t   e   n   c   i   l   F   u   n   c   (   x   0   ,       x   1   ,       x   2   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   S   t   e   n   c   i   l   F   u   n   c       =       _   g   l   S   t   e   n   c   i   l   F   u   n   c   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   S   t   e   n   c   i   l   F   u   n   c   S   e   p   a   r   a   t   e       =       (   x   0   ,       x   1   ,       x   2   ,       x   3   )       =   >       G   L   c   t   x   .   s   t   e   n   c   i   l   F   u   n   c   S   e   p   a   r   a   t   e   (   x   0   ,       x   1   ,       x   2   ,       x   3   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   S   t   e   n   c   i   l   F   u   n   c   S   e   p   a   r   a   t   e       =       _   g   l   S   t   e   n   c   i   l   F   u   n   c   S   e   p   a   r   a   t   e   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   S   t   e   n   c   i   l   M   a   s   k       =       x   0       =   >       G   L   c   t   x   .   s   t   e   n   c   i   l   M   a   s   k   (   x   0   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   S   t   e   n   c   i   l   M   a   s   k       =       _   g   l   S   t   e   n   c   i   l   M   a   s   k   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   S   t   e   n   c   i   l   M   a   s   k   S   e   p   a   r   a   t   e       =       (   x   0   ,       x   1   )       =   >       G   L   c   t   x   .   s   t   e   n   c   i   l   M   a   s   k   S   e   p   a   r   a   t   e   (   x   0   ,       x   1   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   S   t   e   n   c   i   l   M   a   s   k   S   e   p   a   r   a   t   e       =       _   g   l   S   t   e   n   c   i   l   M   a   s   k   S   e   p   a   r   a   t   e   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   S   t   e   n   c   i   l   O   p       =       (   x   0   ,       x   1   ,       x   2   )       =   >       G   L   c   t   x   .   s   t   e   n   c   i   l   O   p   (   x   0   ,       x   1   ,       x   2   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   S   t   e   n   c   i   l   O   p       =       _   g   l   S   t   e   n   c   i   l   O   p   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   S   t   e   n   c   i   l   O   p   S   e   p   a   r   a   t   e       =       (   x   0   ,       x   1   ,       x   2   ,       x   3   )       =   >       G   L   c   t   x   .   s   t   e   n   c   i   l   O   p   S   e   p   a   r   a   t   e   (   x   0   ,       x   1   ,       x   2   ,       x   3   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   S   t   e   n   c   i   l   O   p   S   e   p   a   r   a   t   e       =       _   g   l   S   t   e   n   c   i   l   O   p   S   e   p   a   r   a   t   e   ;   
   
   v   a   r       c   o   m   p   u   t   e   U   n   p   a   c   k   A   l   i   g   n   e   d   I   m   a   g   e   S   i   z   e       =       (   w   i   d   t   h   ,       h   e   i   g   h   t   ,       s   i   z   e   P   e   r   P   i   x   e   l   )       =   >       {   
           f   u   n   c   t   i   o   n       r   o   u   n   d   e   d   T   o   N   e   x   t   M   u   l   t   i   p   l   e   O   f   (   x   ,       y   )       {   
                   r   e   t   u   r   n       (   x       +       y       -       1   )       &       -   y   ;   
           }   
           v   a   r       p   l   a   i   n   R   o   w   S   i   z   e       =       (   G   L   .   u   n   p   a   c   k   R   o   w   L   e   n   g   t   h       |   |       w   i   d   t   h   )       *       s   i   z   e   P   e   r   P   i   x   e   l   ;   
           v   a   r       a   l   i   g   n   e   d   R   o   w   S   i   z   e       =       r   o   u   n   d   e   d   T   o   N   e   x   t   M   u   l   t   i   p   l   e   O   f   (   p   l   a   i   n   R   o   w   S   i   z   e   ,       G   L   .   u   n   p   a   c   k   A   l   i   g   n   m   e   n   t   )   ;   
           r   e   t   u   r   n       h   e   i   g   h   t       *       a   l   i   g   n   e   d   R   o   w   S   i   z   e   ;   
   }   ;   
   
   v   a   r       c   o   l   o   r   C   h   a   n   n   e   l   s   I   n   G   l   T   e   x   t   u   r   e   F   o   r   m   a   t       =       f   o   r   m   a   t       =   >       {   
           /   /       M   i   c   r   o   -   o   p   t   i   m   i   z   a   t   i   o   n   s       f   o   r       s   i   z   e   :       m   a   p       f   o   r   m   a   t       t   o       s   i   z   e       b   y       s   u   b   t   r   a   c   t   i   n   g       s   m   a   l   l   e   s   t   
           /   /       e   n   u   m       v   a   l   u   e       (   0   x   1   9   0   2   )       f   r   o   m       a   l   l       v   a   l   u   e   s       f   i   r   s   t   .           A   l   s   o       o   m   i   t       t   h   e       m   o   s   t       c   o   m   m   o   n   
           /   /       s   i   z   e       v   a   l   u   e       (   1   )       f   r   o   m       t   h   e       l   i   s   t   ,       w   h   i   c   h       i   s       a   s   s   u   m   e   d       b   y       f   o   r   m   a   t   s       n   o   t       o   n       t   h   e   
           /   /       l   i   s   t   .   
           v   a   r       c   o   l   o   r   C   h   a   n   n   e   l   s       =       {   
                   /   /       0   x   1   9   0   2       /   *       G   L   _   D   E   P   T   H   _   C   O   M   P   O   N   E   N   T       *   /       -       0   x   1   9   0   2   :       1   ,   
                   /   /       0   x   1   9   0   6       /   *       G   L   _   A   L   P   H   A       *   /       -       0   x   1   9   0   2   :       1   ,   
                   5   :       3   ,   
                   6   :       4   ,   
                   /   /       0   x   1   9   0   9       /   *       G   L   _   L   U   M   I   N   A   N   C   E       *   /       -       0   x   1   9   0   2   :       1   ,   
                   8   :       2   ,   
                   2   9   5   0   2   :       3   ,   
                   2   9   5   0   4   :       4   ,   
                   /   /       0   x   1   9   0   3       /   *       G   L   _   R   E   D       *   /       -       0   x   1   9   0   2   :       1   ,   
                   2   6   9   1   7   :       2   ,   
                   2   6   9   1   8   :       2   ,   
                   /   /       0   x   8   D   9   4       /   *       G   L   _   R   E   D   _   I   N   T   E   G   E   R       *   /       -       0   x   1   9   0   2   :       1   ,   
                   2   9   8   4   6   :       3   ,   
                   2   9   8   4   7   :       4   
           }   ;   
           r   e   t   u   r   n       c   o   l   o   r   C   h   a   n   n   e   l   s   [   f   o   r   m   a   t       -       6   4   0   2   ]       |   |       1   ;   
   }   ;   
   
   v   a   r       e   m   s   c   r   i   p   t   e   n   W   e   b   G   L   G   e   t   T   e   x   P   i   x   e   l   D   a   t   a       =       (   t   y   p   e   ,       f   o   r   m   a   t   ,       w   i   d   t   h   ,       h   e   i   g   h   t   ,       p   i   x   e   l   s   ,       i   n   t   e   r   n   a   l   F   o   r   m   a   t   )       =   >       {   
           v   a   r       h   e   a   p       =       h   e   a   p   O   b   j   e   c   t   F   o   r   W   e   b   G   L   T   y   p   e   (   t   y   p   e   )   ;   
           v   a   r       s   i   z   e   P   e   r   P   i   x   e   l       =       c   o   l   o   r   C   h   a   n   n   e   l   s   I   n   G   l   T   e   x   t   u   r   e   F   o   r   m   a   t   (   f   o   r   m   a   t   )       *       h   e   a   p   .   B   Y   T   E   S   _   P   E   R   _   E   L   E   M   E   N   T   ;   
           v   a   r       b   y   t   e   s       =       c   o   m   p   u   t   e   U   n   p   a   c   k   A   l   i   g   n   e   d   I   m   a   g   e   S   i   z   e   (   w   i   d   t   h   ,       h   e   i   g   h   t   ,       s   i   z   e   P   e   r   P   i   x   e   l   )   ;   
           r   e   t   u   r   n       h   e   a   p   .   s   u   b   a   r   r   a   y   (   t   o   T   y   p   e   d   A   r   r   a   y   I   n   d   e   x   (   p   i   x   e   l   s   ,       h   e   a   p   )   ,       t   o   T   y   p   e   d   A   r   r   a   y   I   n   d   e   x   (   p   i   x   e   l   s       +       b   y   t   e   s   ,       h   e   a   p   )   )   ;   
   }   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   T   e   x   I   m   a   g   e   2   D       =       (   t   a   r   g   e   t   ,       l   e   v   e   l   ,       i   n   t   e   r   n   a   l   F   o   r   m   a   t   ,       w   i   d   t   h   ,       h   e   i   g   h   t   ,       b   o   r   d   e   r   ,       f   o   r   m   a   t   ,       t   y   p   e   ,       p   i   x   e   l   s   )       =   >       {   
           i   f       (   t   r   u   e   )       {   
                   i   f       (   G   L   c   t   x   .   c   u   r   r   e   n   t   P   i   x   e   l   U   n   p   a   c   k   B   u   f   f   e   r   B   i   n   d   i   n   g   )       {   
                           G   L   c   t   x   .   t   e   x   I   m   a   g   e   2   D   (   t   a   r   g   e   t   ,       l   e   v   e   l   ,       i   n   t   e   r   n   a   l   F   o   r   m   a   t   ,       w   i   d   t   h   ,       h   e   i   g   h   t   ,       b   o   r   d   e   r   ,       f   o   r   m   a   t   ,       t   y   p   e   ,       p   i   x   e   l   s   )   ;   
                           r   e   t   u   r   n   ;   
                   }   
                   i   f       (   p   i   x   e   l   s   )       {   
                           v   a   r       h   e   a   p       =       h   e   a   p   O   b   j   e   c   t   F   o   r   W   e   b   G   L   T   y   p   e   (   t   y   p   e   )   ;   
                           v   a   r       i   n   d   e   x       =       t   o   T   y   p   e   d   A   r   r   a   y   I   n   d   e   x   (   p   i   x   e   l   s   ,       h   e   a   p   )   ;   
                           G   L   c   t   x   .   t   e   x   I   m   a   g   e   2   D   (   t   a   r   g   e   t   ,       l   e   v   e   l   ,       i   n   t   e   r   n   a   l   F   o   r   m   a   t   ,       w   i   d   t   h   ,       h   e   i   g   h   t   ,       b   o   r   d   e   r   ,       f   o   r   m   a   t   ,       t   y   p   e   ,       h   e   a   p   ,       i   n   d   e   x   )   ;   
                           r   e   t   u   r   n   ;   
                   }   
           }   
           v   a   r       p   i   x   e   l   D   a   t   a       =       p   i   x   e   l   s       ?       e   m   s   c   r   i   p   t   e   n   W   e   b   G   L   G   e   t   T   e   x   P   i   x   e   l   D   a   t   a   (   t   y   p   e   ,       f   o   r   m   a   t   ,       w   i   d   t   h   ,       h   e   i   g   h   t   ,       p   i   x   e   l   s   ,       i   n   t   e   r   n   a   l   F   o   r   m   a   t   )       :       n   u   l   l   ;   
           G   L   c   t   x   .   t   e   x   I   m   a   g   e   2   D   (   t   a   r   g   e   t   ,       l   e   v   e   l   ,       i   n   t   e   r   n   a   l   F   o   r   m   a   t   ,       w   i   d   t   h   ,       h   e   i   g   h   t   ,       b   o   r   d   e   r   ,       f   o   r   m   a   t   ,       t   y   p   e   ,       p   i   x   e   l   D   a   t   a   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   T   e   x   I   m   a   g   e   2   D       =       _   g   l   T   e   x   I   m   a   g   e   2   D   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   T   e   x   I   m   a   g   e   3   D       =       (   t   a   r   g   e   t   ,       l   e   v   e   l   ,       i   n   t   e   r   n   a   l   F   o   r   m   a   t   ,       w   i   d   t   h   ,       h   e   i   g   h   t   ,       d   e   p   t   h   ,       b   o   r   d   e   r   ,       f   o   r   m   a   t   ,       t   y   p   e   ,       p   i   x   e   l   s   )       =   >       {   
           i   f       (   G   L   c   t   x   .   c   u   r   r   e   n   t   P   i   x   e   l   U   n   p   a   c   k   B   u   f   f   e   r   B   i   n   d   i   n   g   )       {   
                   G   L   c   t   x   .   t   e   x   I   m   a   g   e   3   D   (   t   a   r   g   e   t   ,       l   e   v   e   l   ,       i   n   t   e   r   n   a   l   F   o   r   m   a   t   ,       w   i   d   t   h   ,       h   e   i   g   h   t   ,       d   e   p   t   h   ,       b   o   r   d   e   r   ,       f   o   r   m   a   t   ,       t   y   p   e   ,       p   i   x   e   l   s   )   ;   
           }       e   l   s   e       i   f       (   p   i   x   e   l   s   )       {   
                   v   a   r       h   e   a   p       =       h   e   a   p   O   b   j   e   c   t   F   o   r   W   e   b   G   L   T   y   p   e   (   t   y   p   e   )   ;   
                   G   L   c   t   x   .   t   e   x   I   m   a   g   e   3   D   (   t   a   r   g   e   t   ,       l   e   v   e   l   ,       i   n   t   e   r   n   a   l   F   o   r   m   a   t   ,       w   i   d   t   h   ,       h   e   i   g   h   t   ,       d   e   p   t   h   ,       b   o   r   d   e   r   ,       f   o   r   m   a   t   ,       t   y   p   e   ,       h   e   a   p   ,       t   o   T   y   p   e   d   A   r   r   a   y   I   n   d   e   x   (   p   i   x   e   l   s   ,       h   e   a   p   )   )   ;   
           }       e   l   s   e       {   
                   G   L   c   t   x   .   t   e   x   I   m   a   g   e   3   D   (   t   a   r   g   e   t   ,       l   e   v   e   l   ,       i   n   t   e   r   n   a   l   F   o   r   m   a   t   ,       w   i   d   t   h   ,       h   e   i   g   h   t   ,       d   e   p   t   h   ,       b   o   r   d   e   r   ,       f   o   r   m   a   t   ,       t   y   p   e   ,       n   u   l   l   )   ;   
           }   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   T   e   x   I   m   a   g   e   3   D       =       _   g   l   T   e   x   I   m   a   g   e   3   D   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   T   e   x   P   a   r   a   m   e   t   e   r   f       =       (   x   0   ,       x   1   ,       x   2   )       =   >       G   L   c   t   x   .   t   e   x   P   a   r   a   m   e   t   e   r   f   (   x   0   ,       x   1   ,       x   2   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   T   e   x   P   a   r   a   m   e   t   e   r   f       =       _   g   l   T   e   x   P   a   r   a   m   e   t   e   r   f   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   T   e   x   P   a   r   a   m   e   t   e   r   f   v       =       (   t   a   r   g   e   t   ,       p   n   a   m   e   ,       p   a   r   a   m   s   )       =   >       {   
           v   a   r       p   a   r   a   m       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   F   3   2   )   [   (   (   p   a   r   a   m   s   )       >   >       2   )   ]   ;   
           G   L   c   t   x   .   t   e   x   P   a   r   a   m   e   t   e   r   f   (   t   a   r   g   e   t   ,       p   n   a   m   e   ,       p   a   r   a   m   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   T   e   x   P   a   r   a   m   e   t   e   r   f   v       =       _   g   l   T   e   x   P   a   r   a   m   e   t   e   r   f   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   T   e   x   P   a   r   a   m   e   t   e   r   i       =       (   x   0   ,       x   1   ,       x   2   )       =   >       G   L   c   t   x   .   t   e   x   P   a   r   a   m   e   t   e   r   i   (   x   0   ,       x   1   ,       x   2   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   T   e   x   P   a   r   a   m   e   t   e   r   i       =       _   g   l   T   e   x   P   a   r   a   m   e   t   e   r   i   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   T   e   x   P   a   r   a   m   e   t   e   r   i   v       =       (   t   a   r   g   e   t   ,       p   n   a   m   e   ,       p   a   r   a   m   s   )       =   >       {   
           v   a   r       p   a   r   a   m       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   p   a   r   a   m   s   )       >   >       2   )   ]   ;   
           G   L   c   t   x   .   t   e   x   P   a   r   a   m   e   t   e   r   i   (   t   a   r   g   e   t   ,       p   n   a   m   e   ,       p   a   r   a   m   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   T   e   x   P   a   r   a   m   e   t   e   r   i   v       =       _   g   l   T   e   x   P   a   r   a   m   e   t   e   r   i   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   T   e   x   S   t   o   r   a   g   e   2   D       =       (   x   0   ,       x   1   ,       x   2   ,       x   3   ,       x   4   )       =   >       G   L   c   t   x   .   t   e   x   S   t   o   r   a   g   e   2   D   (   x   0   ,       x   1   ,       x   2   ,       x   3   ,       x   4   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   T   e   x   S   t   o   r   a   g   e   2   D       =       _   g   l   T   e   x   S   t   o   r   a   g   e   2   D   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   T   e   x   S   t   o   r   a   g   e   3   D       =       (   x   0   ,       x   1   ,       x   2   ,       x   3   ,       x   4   ,       x   5   )       =   >       G   L   c   t   x   .   t   e   x   S   t   o   r   a   g   e   3   D   (   x   0   ,       x   1   ,       x   2   ,       x   3   ,       x   4   ,       x   5   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   T   e   x   S   t   o   r   a   g   e   3   D       =       _   g   l   T   e   x   S   t   o   r   a   g   e   3   D   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   T   e   x   S   u   b   I   m   a   g   e   2   D       =       (   t   a   r   g   e   t   ,       l   e   v   e   l   ,       x   o   f   f   s   e   t   ,       y   o   f   f   s   e   t   ,       w   i   d   t   h   ,       h   e   i   g   h   t   ,       f   o   r   m   a   t   ,       t   y   p   e   ,       p   i   x   e   l   s   )       =   >       {   
           i   f       (   t   r   u   e   )       {   
                   i   f       (   G   L   c   t   x   .   c   u   r   r   e   n   t   P   i   x   e   l   U   n   p   a   c   k   B   u   f   f   e   r   B   i   n   d   i   n   g   )       {   
                           G   L   c   t   x   .   t   e   x   S   u   b   I   m   a   g   e   2   D   (   t   a   r   g   e   t   ,       l   e   v   e   l   ,       x   o   f   f   s   e   t   ,       y   o   f   f   s   e   t   ,       w   i   d   t   h   ,       h   e   i   g   h   t   ,       f   o   r   m   a   t   ,       t   y   p   e   ,       p   i   x   e   l   s   )   ;   
                           r   e   t   u   r   n   ;   
                   }   
                   i   f       (   p   i   x   e   l   s   )       {   
                           v   a   r       h   e   a   p       =       h   e   a   p   O   b   j   e   c   t   F   o   r   W   e   b   G   L   T   y   p   e   (   t   y   p   e   )   ;   
                           G   L   c   t   x   .   t   e   x   S   u   b   I   m   a   g   e   2   D   (   t   a   r   g   e   t   ,       l   e   v   e   l   ,       x   o   f   f   s   e   t   ,       y   o   f   f   s   e   t   ,       w   i   d   t   h   ,       h   e   i   g   h   t   ,       f   o   r   m   a   t   ,       t   y   p   e   ,       h   e   a   p   ,       t   o   T   y   p   e   d   A   r   r   a   y   I   n   d   e   x   (   p   i   x   e   l   s   ,       h   e   a   p   )   )   ;   
                           r   e   t   u   r   n   ;   
                   }   
           }   
           v   a   r       p   i   x   e   l   D   a   t   a       =       p   i   x   e   l   s       ?       e   m   s   c   r   i   p   t   e   n   W   e   b   G   L   G   e   t   T   e   x   P   i   x   e   l   D   a   t   a   (   t   y   p   e   ,       f   o   r   m   a   t   ,       w   i   d   t   h   ,       h   e   i   g   h   t   ,       p   i   x   e   l   s   ,       0   )       :       n   u   l   l   ;   
           G   L   c   t   x   .   t   e   x   S   u   b   I   m   a   g   e   2   D   (   t   a   r   g   e   t   ,       l   e   v   e   l   ,       x   o   f   f   s   e   t   ,       y   o   f   f   s   e   t   ,       w   i   d   t   h   ,       h   e   i   g   h   t   ,       f   o   r   m   a   t   ,       t   y   p   e   ,       p   i   x   e   l   D   a   t   a   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   T   e   x   S   u   b   I   m   a   g   e   2   D       =       _   g   l   T   e   x   S   u   b   I   m   a   g   e   2   D   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   T   e   x   S   u   b   I   m   a   g   e   3   D       =       (   t   a   r   g   e   t   ,       l   e   v   e   l   ,       x   o   f   f   s   e   t   ,       y   o   f   f   s   e   t   ,       z   o   f   f   s   e   t   ,       w   i   d   t   h   ,       h   e   i   g   h   t   ,       d   e   p   t   h   ,       f   o   r   m   a   t   ,       t   y   p   e   ,       p   i   x   e   l   s   )       =   >       {   
           i   f       (   G   L   c   t   x   .   c   u   r   r   e   n   t   P   i   x   e   l   U   n   p   a   c   k   B   u   f   f   e   r   B   i   n   d   i   n   g   )       {   
                   G   L   c   t   x   .   t   e   x   S   u   b   I   m   a   g   e   3   D   (   t   a   r   g   e   t   ,       l   e   v   e   l   ,       x   o   f   f   s   e   t   ,       y   o   f   f   s   e   t   ,       z   o   f   f   s   e   t   ,       w   i   d   t   h   ,       h   e   i   g   h   t   ,       d   e   p   t   h   ,       f   o   r   m   a   t   ,       t   y   p   e   ,       p   i   x   e   l   s   )   ;   
           }       e   l   s   e       i   f       (   p   i   x   e   l   s   )       {   
                   v   a   r       h   e   a   p       =       h   e   a   p   O   b   j   e   c   t   F   o   r   W   e   b   G   L   T   y   p   e   (   t   y   p   e   )   ;   
                   G   L   c   t   x   .   t   e   x   S   u   b   I   m   a   g   e   3   D   (   t   a   r   g   e   t   ,       l   e   v   e   l   ,       x   o   f   f   s   e   t   ,       y   o   f   f   s   e   t   ,       z   o   f   f   s   e   t   ,       w   i   d   t   h   ,       h   e   i   g   h   t   ,       d   e   p   t   h   ,       f   o   r   m   a   t   ,       t   y   p   e   ,       h   e   a   p   ,       t   o   T   y   p   e   d   A   r   r   a   y   I   n   d   e   x   (   p   i   x   e   l   s   ,       h   e   a   p   )   )   ;   
           }       e   l   s   e       {   
                   G   L   c   t   x   .   t   e   x   S   u   b   I   m   a   g   e   3   D   (   t   a   r   g   e   t   ,       l   e   v   e   l   ,       x   o   f   f   s   e   t   ,       y   o   f   f   s   e   t   ,       z   o   f   f   s   e   t   ,       w   i   d   t   h   ,       h   e   i   g   h   t   ,       d   e   p   t   h   ,       f   o   r   m   a   t   ,       t   y   p   e   ,       n   u   l   l   )   ;   
           }   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   T   e   x   S   u   b   I   m   a   g   e   3   D       =       _   g   l   T   e   x   S   u   b   I   m   a   g   e   3   D   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   V   a   r   y   i   n   g   s       =       (   p   r   o   g   r   a   m   ,       c   o   u   n   t   ,       v   a   r   y   i   n   g   s   ,       b   u   f   f   e   r   M   o   d   e   )       =   >       {   
           p   r   o   g   r   a   m       =       G   L   .   p   r   o   g   r   a   m   s   [   p   r   o   g   r   a   m   ]   ;   
           v   a   r       v   a   r   s       =       [   ]   ;   
           f   o   r       (   v   a   r       i       =       0   ;       i       <       c   o   u   n   t   ;       i   +   +   )       v   a   r   s   .   p   u   s   h   (   U   T   F   8   T   o   S   t   r   i   n   g   (   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   (   (   (   v   a   r   y   i   n   g   s   )       +       (   i       *       4   )   )       >   >       2   )   ]   )   )   ;   
           G   L   c   t   x   .   t   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   V   a   r   y   i   n   g   s   (   p   r   o   g   r   a   m   ,       v   a   r   s   ,       b   u   f   f   e   r   M   o   d   e   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   V   a   r   y   i   n   g   s       =       _   g   l   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   V   a   r   y   i   n   g   s   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   U   n   i   f   o   r   m   1   f       =       (   l   o   c   a   t   i   o   n   ,       v   0   )       =   >       {   
           G   L   c   t   x   .   u   n   i   f   o   r   m   1   f   (   w   e   b   g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   (   l   o   c   a   t   i   o   n   )   ,       v   0   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   1   f       =       _   g   l   U   n   i   f   o   r   m   1   f   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   U   n   i   f   o   r   m   1   f   v       =       (   l   o   c   a   t   i   o   n   ,       c   o   u   n   t   ,       v   a   l   u   e   )       =   >       {   
           c   o   u   n   t       &   &       G   L   c   t   x   .   u   n   i   f   o   r   m   1   f   v   (   w   e   b   g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   (   l   o   c   a   t   i   o   n   )   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   F   3   2   )   ,       (   (   v   a   l   u   e   )       >   >       2   )   ,       c   o   u   n   t   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   1   f   v       =       _   g   l   U   n   i   f   o   r   m   1   f   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   U   n   i   f   o   r   m   1   i       =       (   l   o   c   a   t   i   o   n   ,       v   0   )       =   >       {   
           G   L   c   t   x   .   u   n   i   f   o   r   m   1   i   (   w   e   b   g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   (   l   o   c   a   t   i   o   n   )   ,       v   0   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   1   i       =       _   g   l   U   n   i   f   o   r   m   1   i   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   U   n   i   f   o   r   m   1   i   v       =       (   l   o   c   a   t   i   o   n   ,       c   o   u   n   t   ,       v   a   l   u   e   )       =   >       {   
           c   o   u   n   t       &   &       G   L   c   t   x   .   u   n   i   f   o   r   m   1   i   v   (   w   e   b   g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   (   l   o   c   a   t   i   o   n   )   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   ,       (   (   v   a   l   u   e   )       >   >       2   )   ,       c   o   u   n   t   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   1   i   v       =       _   g   l   U   n   i   f   o   r   m   1   i   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   U   n   i   f   o   r   m   1   u   i       =       (   l   o   c   a   t   i   o   n   ,       v   0   )       =   >       {   
           G   L   c   t   x   .   u   n   i   f   o   r   m   1   u   i   (   w   e   b   g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   (   l   o   c   a   t   i   o   n   )   ,       v   0   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   1   u   i       =       _   g   l   U   n   i   f   o   r   m   1   u   i   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   U   n   i   f   o   r   m   1   u   i   v       =       (   l   o   c   a   t   i   o   n   ,       c   o   u   n   t   ,       v   a   l   u   e   )       =   >       {   
           c   o   u   n   t       &   &       G   L   c   t   x   .   u   n   i   f   o   r   m   1   u   i   v   (   w   e   b   g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   (   l   o   c   a   t   i   o   n   )   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   ,       (   (   v   a   l   u   e   )       >   >       2   )   ,       c   o   u   n   t   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   1   u   i   v       =       _   g   l   U   n   i   f   o   r   m   1   u   i   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   U   n   i   f   o   r   m   2   f       =       (   l   o   c   a   t   i   o   n   ,       v   0   ,       v   1   )       =   >       {   
           G   L   c   t   x   .   u   n   i   f   o   r   m   2   f   (   w   e   b   g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   (   l   o   c   a   t   i   o   n   )   ,       v   0   ,       v   1   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   2   f       =       _   g   l   U   n   i   f   o   r   m   2   f   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   U   n   i   f   o   r   m   2   f   v       =       (   l   o   c   a   t   i   o   n   ,       c   o   u   n   t   ,       v   a   l   u   e   )       =   >       {   
           c   o   u   n   t       &   &       G   L   c   t   x   .   u   n   i   f   o   r   m   2   f   v   (   w   e   b   g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   (   l   o   c   a   t   i   o   n   )   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   F   3   2   )   ,       (   (   v   a   l   u   e   )       >   >       2   )   ,       c   o   u   n   t       *       2   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   2   f   v       =       _   g   l   U   n   i   f   o   r   m   2   f   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   U   n   i   f   o   r   m   2   i       =       (   l   o   c   a   t   i   o   n   ,       v   0   ,       v   1   )       =   >       {   
           G   L   c   t   x   .   u   n   i   f   o   r   m   2   i   (   w   e   b   g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   (   l   o   c   a   t   i   o   n   )   ,       v   0   ,       v   1   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   2   i       =       _   g   l   U   n   i   f   o   r   m   2   i   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   U   n   i   f   o   r   m   2   i   v       =       (   l   o   c   a   t   i   o   n   ,       c   o   u   n   t   ,       v   a   l   u   e   )       =   >       {   
           c   o   u   n   t       &   &       G   L   c   t   x   .   u   n   i   f   o   r   m   2   i   v   (   w   e   b   g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   (   l   o   c   a   t   i   o   n   )   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   ,       (   (   v   a   l   u   e   )       >   >       2   )   ,       c   o   u   n   t       *       2   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   2   i   v       =       _   g   l   U   n   i   f   o   r   m   2   i   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   U   n   i   f   o   r   m   2   u   i       =       (   l   o   c   a   t   i   o   n   ,       v   0   ,       v   1   )       =   >       {   
           G   L   c   t   x   .   u   n   i   f   o   r   m   2   u   i   (   w   e   b   g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   (   l   o   c   a   t   i   o   n   )   ,       v   0   ,       v   1   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   2   u   i       =       _   g   l   U   n   i   f   o   r   m   2   u   i   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   U   n   i   f   o   r   m   2   u   i   v       =       (   l   o   c   a   t   i   o   n   ,       c   o   u   n   t   ,       v   a   l   u   e   )       =   >       {   
           c   o   u   n   t       &   &       G   L   c   t   x   .   u   n   i   f   o   r   m   2   u   i   v   (   w   e   b   g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   (   l   o   c   a   t   i   o   n   )   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   ,       (   (   v   a   l   u   e   )       >   >       2   )   ,       c   o   u   n   t       *       2   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   2   u   i   v       =       _   g   l   U   n   i   f   o   r   m   2   u   i   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   U   n   i   f   o   r   m   3   f       =       (   l   o   c   a   t   i   o   n   ,       v   0   ,       v   1   ,       v   2   )       =   >       {   
           G   L   c   t   x   .   u   n   i   f   o   r   m   3   f   (   w   e   b   g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   (   l   o   c   a   t   i   o   n   )   ,       v   0   ,       v   1   ,       v   2   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   3   f       =       _   g   l   U   n   i   f   o   r   m   3   f   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   U   n   i   f   o   r   m   3   f   v       =       (   l   o   c   a   t   i   o   n   ,       c   o   u   n   t   ,       v   a   l   u   e   )       =   >       {   
           c   o   u   n   t       &   &       G   L   c   t   x   .   u   n   i   f   o   r   m   3   f   v   (   w   e   b   g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   (   l   o   c   a   t   i   o   n   )   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   F   3   2   )   ,       (   (   v   a   l   u   e   )       >   >       2   )   ,       c   o   u   n   t       *       3   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   3   f   v       =       _   g   l   U   n   i   f   o   r   m   3   f   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   U   n   i   f   o   r   m   3   i       =       (   l   o   c   a   t   i   o   n   ,       v   0   ,       v   1   ,       v   2   )       =   >       {   
           G   L   c   t   x   .   u   n   i   f   o   r   m   3   i   (   w   e   b   g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   (   l   o   c   a   t   i   o   n   )   ,       v   0   ,       v   1   ,       v   2   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   3   i       =       _   g   l   U   n   i   f   o   r   m   3   i   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   U   n   i   f   o   r   m   3   i   v       =       (   l   o   c   a   t   i   o   n   ,       c   o   u   n   t   ,       v   a   l   u   e   )       =   >       {   
           c   o   u   n   t       &   &       G   L   c   t   x   .   u   n   i   f   o   r   m   3   i   v   (   w   e   b   g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   (   l   o   c   a   t   i   o   n   )   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   ,       (   (   v   a   l   u   e   )       >   >       2   )   ,       c   o   u   n   t       *       3   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   3   i   v       =       _   g   l   U   n   i   f   o   r   m   3   i   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   U   n   i   f   o   r   m   3   u   i       =       (   l   o   c   a   t   i   o   n   ,       v   0   ,       v   1   ,       v   2   )       =   >       {   
           G   L   c   t   x   .   u   n   i   f   o   r   m   3   u   i   (   w   e   b   g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   (   l   o   c   a   t   i   o   n   )   ,       v   0   ,       v   1   ,       v   2   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   3   u   i       =       _   g   l   U   n   i   f   o   r   m   3   u   i   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   U   n   i   f   o   r   m   3   u   i   v       =       (   l   o   c   a   t   i   o   n   ,       c   o   u   n   t   ,       v   a   l   u   e   )       =   >       {   
           c   o   u   n   t       &   &       G   L   c   t   x   .   u   n   i   f   o   r   m   3   u   i   v   (   w   e   b   g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   (   l   o   c   a   t   i   o   n   )   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   ,       (   (   v   a   l   u   e   )       >   >       2   )   ,       c   o   u   n   t       *       3   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   3   u   i   v       =       _   g   l   U   n   i   f   o   r   m   3   u   i   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   U   n   i   f   o   r   m   4   f       =       (   l   o   c   a   t   i   o   n   ,       v   0   ,       v   1   ,       v   2   ,       v   3   )       =   >       {   
           G   L   c   t   x   .   u   n   i   f   o   r   m   4   f   (   w   e   b   g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   (   l   o   c   a   t   i   o   n   )   ,       v   0   ,       v   1   ,       v   2   ,       v   3   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   4   f       =       _   g   l   U   n   i   f   o   r   m   4   f   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   U   n   i   f   o   r   m   4   f   v       =       (   l   o   c   a   t   i   o   n   ,       c   o   u   n   t   ,       v   a   l   u   e   )       =   >       {   
           c   o   u   n   t       &   &       G   L   c   t   x   .   u   n   i   f   o   r   m   4   f   v   (   w   e   b   g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   (   l   o   c   a   t   i   o   n   )   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   F   3   2   )   ,       (   (   v   a   l   u   e   )       >   >       2   )   ,       c   o   u   n   t       *       4   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   4   f   v       =       _   g   l   U   n   i   f   o   r   m   4   f   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   U   n   i   f   o   r   m   4   i       =       (   l   o   c   a   t   i   o   n   ,       v   0   ,       v   1   ,       v   2   ,       v   3   )       =   >       {   
           G   L   c   t   x   .   u   n   i   f   o   r   m   4   i   (   w   e   b   g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   (   l   o   c   a   t   i   o   n   )   ,       v   0   ,       v   1   ,       v   2   ,       v   3   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   4   i       =       _   g   l   U   n   i   f   o   r   m   4   i   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   U   n   i   f   o   r   m   4   i   v       =       (   l   o   c   a   t   i   o   n   ,       c   o   u   n   t   ,       v   a   l   u   e   )       =   >       {   
           c   o   u   n   t       &   &       G   L   c   t   x   .   u   n   i   f   o   r   m   4   i   v   (   w   e   b   g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   (   l   o   c   a   t   i   o   n   )   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   ,       (   (   v   a   l   u   e   )       >   >       2   )   ,       c   o   u   n   t       *       4   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   4   i   v       =       _   g   l   U   n   i   f   o   r   m   4   i   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   U   n   i   f   o   r   m   4   u   i       =       (   l   o   c   a   t   i   o   n   ,       v   0   ,       v   1   ,       v   2   ,       v   3   )       =   >       {   
           G   L   c   t   x   .   u   n   i   f   o   r   m   4   u   i   (   w   e   b   g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   (   l   o   c   a   t   i   o   n   )   ,       v   0   ,       v   1   ,       v   2   ,       v   3   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   4   u   i       =       _   g   l   U   n   i   f   o   r   m   4   u   i   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   U   n   i   f   o   r   m   4   u   i   v       =       (   l   o   c   a   t   i   o   n   ,       c   o   u   n   t   ,       v   a   l   u   e   )       =   >       {   
           c   o   u   n   t       &   &       G   L   c   t   x   .   u   n   i   f   o   r   m   4   u   i   v   (   w   e   b   g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   (   l   o   c   a   t   i   o   n   )   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   ,       (   (   v   a   l   u   e   )       >   >       2   )   ,       c   o   u   n   t       *       4   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   4   u   i   v       =       _   g   l   U   n   i   f   o   r   m   4   u   i   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   U   n   i   f   o   r   m   B   l   o   c   k   B   i   n   d   i   n   g       =       (   p   r   o   g   r   a   m   ,       u   n   i   f   o   r   m   B   l   o   c   k   I   n   d   e   x   ,       u   n   i   f   o   r   m   B   l   o   c   k   B   i   n   d   i   n   g   )       =   >       {   
           p   r   o   g   r   a   m       =       G   L   .   p   r   o   g   r   a   m   s   [   p   r   o   g   r   a   m   ]   ;   
           G   L   c   t   x   .   u   n   i   f   o   r   m   B   l   o   c   k   B   i   n   d   i   n   g   (   p   r   o   g   r   a   m   ,       u   n   i   f   o   r   m   B   l   o   c   k   I   n   d   e   x   ,       u   n   i   f   o   r   m   B   l   o   c   k   B   i   n   d   i   n   g   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   B   l   o   c   k   B   i   n   d   i   n   g       =       _   g   l   U   n   i   f   o   r   m   B   l   o   c   k   B   i   n   d   i   n   g   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   2   f   v       =       (   l   o   c   a   t   i   o   n   ,       c   o   u   n   t   ,       t   r   a   n   s   p   o   s   e   ,       v   a   l   u   e   )       =   >       {   
           c   o   u   n   t       &   &       G   L   c   t   x   .   u   n   i   f   o   r   m   M   a   t   r   i   x   2   f   v   (   w   e   b   g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   (   l   o   c   a   t   i   o   n   )   ,       !   !   t   r   a   n   s   p   o   s   e   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       
           H   E   A   P   F   3   2   )   ,       (   (   v   a   l   u   e   )       >   >       2   )   ,       c   o   u   n   t       *       4   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   2   f   v       =       _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   2   f   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   2   x   3   f   v       =       (   l   o   c   a   t   i   o   n   ,       c   o   u   n   t   ,       t   r   a   n   s   p   o   s   e   ,       v   a   l   u   e   )       =   >       {   
           c   o   u   n   t       &   &       G   L   c   t   x   .   u   n   i   f   o   r   m   M   a   t   r   i   x   2   x   3   f   v   (   w   e   b   g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   (   l   o   c   a   t   i   o   n   )   ,       !   !   t   r   a   n   s   p   o   s   e   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       
           H   E   A   P   F   3   2   )   ,       (   (   v   a   l   u   e   )       >   >       2   )   ,       c   o   u   n   t       *       6   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   2   x   3   f   v       =       _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   2   x   3   f   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   2   x   4   f   v       =       (   l   o   c   a   t   i   o   n   ,       c   o   u   n   t   ,       t   r   a   n   s   p   o   s   e   ,       v   a   l   u   e   )       =   >       {   
           c   o   u   n   t       &   &       G   L   c   t   x   .   u   n   i   f   o   r   m   M   a   t   r   i   x   2   x   4   f   v   (   w   e   b   g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   (   l   o   c   a   t   i   o   n   )   ,       !   !   t   r   a   n   s   p   o   s   e   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       
           H   E   A   P   F   3   2   )   ,       (   (   v   a   l   u   e   )       >   >       2   )   ,       c   o   u   n   t       *       8   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   2   x   4   f   v       =       _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   2   x   4   f   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   3   f   v       =       (   l   o   c   a   t   i   o   n   ,       c   o   u   n   t   ,       t   r   a   n   s   p   o   s   e   ,       v   a   l   u   e   )       =   >       {   
           c   o   u   n   t       &   &       G   L   c   t   x   .   u   n   i   f   o   r   m   M   a   t   r   i   x   3   f   v   (   w   e   b   g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   (   l   o   c   a   t   i   o   n   )   ,       !   !   t   r   a   n   s   p   o   s   e   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       
           H   E   A   P   F   3   2   )   ,       (   (   v   a   l   u   e   )       >   >       2   )   ,       c   o   u   n   t       *       9   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   3   f   v       =       _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   3   f   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   3   x   2   f   v       =       (   l   o   c   a   t   i   o   n   ,       c   o   u   n   t   ,       t   r   a   n   s   p   o   s   e   ,       v   a   l   u   e   )       =   >       {   
           c   o   u   n   t       &   &       G   L   c   t   x   .   u   n   i   f   o   r   m   M   a   t   r   i   x   3   x   2   f   v   (   w   e   b   g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   (   l   o   c   a   t   i   o   n   )   ,       !   !   t   r   a   n   s   p   o   s   e   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       
           H   E   A   P   F   3   2   )   ,       (   (   v   a   l   u   e   )       >   >       2   )   ,       c   o   u   n   t       *       6   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   3   x   2   f   v       =       _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   3   x   2   f   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   3   x   4   f   v       =       (   l   o   c   a   t   i   o   n   ,       c   o   u   n   t   ,       t   r   a   n   s   p   o   s   e   ,       v   a   l   u   e   )       =   >       {   
           c   o   u   n   t       &   &       G   L   c   t   x   .   u   n   i   f   o   r   m   M   a   t   r   i   x   3   x   4   f   v   (   w   e   b   g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   (   l   o   c   a   t   i   o   n   )   ,       !   !   t   r   a   n   s   p   o   s   e   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       
           H   E   A   P   F   3   2   )   ,       (   (   v   a   l   u   e   )       >   >       2   )   ,       c   o   u   n   t       *       1   2   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   3   x   4   f   v       =       _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   3   x   4   f   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   4   f   v       =       (   l   o   c   a   t   i   o   n   ,       c   o   u   n   t   ,       t   r   a   n   s   p   o   s   e   ,       v   a   l   u   e   )       =   >       {   
           c   o   u   n   t       &   &       G   L   c   t   x   .   u   n   i   f   o   r   m   M   a   t   r   i   x   4   f   v   (   w   e   b   g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   (   l   o   c   a   t   i   o   n   )   ,       !   !   t   r   a   n   s   p   o   s   e   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       
           H   E   A   P   F   3   2   )   ,       (   (   v   a   l   u   e   )       >   >       2   )   ,       c   o   u   n   t       *       1   6   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   4   f   v       =       _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   4   f   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   4   x   2   f   v       =       (   l   o   c   a   t   i   o   n   ,       c   o   u   n   t   ,       t   r   a   n   s   p   o   s   e   ,       v   a   l   u   e   )       =   >       {   
           c   o   u   n   t       &   &       G   L   c   t   x   .   u   n   i   f   o   r   m   M   a   t   r   i   x   4   x   2   f   v   (   w   e   b   g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   (   l   o   c   a   t   i   o   n   )   ,       !   !   t   r   a   n   s   p   o   s   e   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       
           H   E   A   P   F   3   2   )   ,       (   (   v   a   l   u   e   )       >   >       2   )   ,       c   o   u   n   t       *       8   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   4   x   2   f   v       =       _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   4   x   2   f   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   4   x   3   f   v       =       (   l   o   c   a   t   i   o   n   ,       c   o   u   n   t   ,       t   r   a   n   s   p   o   s   e   ,       v   a   l   u   e   )       =   >       {   
           c   o   u   n   t       &   &       G   L   c   t   x   .   u   n   i   f   o   r   m   M   a   t   r   i   x   4   x   3   f   v   (   w   e   b   g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   (   l   o   c   a   t   i   o   n   )   ,       !   !   t   r   a   n   s   p   o   s   e   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       
           H   E   A   P   F   3   2   )   ,       (   (   v   a   l   u   e   )       >   >       2   )   ,       c   o   u   n   t       *       1   2   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   4   x   3   f   v       =       _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   4   x   3   f   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   U   n   m   a   p   B   u   f   f   e   r       =       t   a   r   g   e   t       =   >       {   
           i   f       (   !   e   m   s   c   r   i   p   t   e   n   W   e   b   G   L   V   a   l   i   d   a   t   e   M   a   p   B   u   f   f   e   r   T   a   r   g   e   t   (   t   a   r   g   e   t   )   )       {   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   0   )   ;   
                   e   r   r   (   "   G   L   _   I   N   V   A   L   I   D   _   E   N   U   M       i   n       g   l   U   n   m   a   p   B   u   f   f   e   r   "   )   ;   
                   r   e   t   u   r   n       0   ;   
           }   
           v   a   r       b   u   f   f   e   r       =       e   m   s   c   r   i   p   t   e   n   W   e   b   G   L   G   e   t   B   u   f   f   e   r   B   i   n   d   i   n   g   (   t   a   r   g   e   t   )   ;   
           v   a   r       m   a   p   p   i   n   g       =       G   L   .   m   a   p   p   e   d   B   u   f   f   e   r   s   [   b   u   f   f   e   r   ]   ;   
           i   f       (   !   m   a   p   p   i   n   g       |   |       !   m   a   p   p   i   n   g   .   m   e   m   )       {   
                   G   L   .   r   e   c   o   r   d   E   r   r   o   r   (   1   2   8   2   )   ;   
                   e   r   r   (   "   b   u   f   f   e   r       w   a   s       n   e   v   e   r       m   a   p   p   e   d       i   n       g   l   U   n   m   a   p   B   u   f   f   e   r   "   )   ;   
                   r   e   t   u   r   n       0   ;   
           }   
           i   f       (   !   (   m   a   p   p   i   n   g   .   a   c   c   e   s   s       &       1   6   )   )       {   
                   /   *       G   L   _   M   A   P   _   F   L   U   S   H   _   E   X   P   L   I   C   I   T   _   B   I   T       *   /       i   f       (   t   r   u   e   )       {   
                           G   L   c   t   x   .   b   u   f   f   e   r   S   u   b   D   a   t   a   (   t   a   r   g   e   t   ,       m   a   p   p   i   n   g   .   o   f   f   s   e   t   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   8   )   ,       m   a   p   p   i   n   g   .   m   e   m   ,       m   a   p   p   i   n   g   .   l   e   n   g   t   h   )   ;   
                   }       e   l   s   e       G   L   c   t   x   .   b   u   f   f   e   r   S   u   b   D   a   t   a   (   t   a   r   g   e   t   ,       m   a   p   p   i   n   g   .   o   f   f   s   e   t   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   8   )   .   s   u   b   a   r   r   a   y   (   m   a   p   p   i   n   g   .   m   e   m   ,       m   a   p   p   i   n   g   .   m   e   m       +       m   a   p   p   i   n   g   .   l   e   n   g   t   h   )   )   ;   
           }   
           _   f   r   e   e   (   m   a   p   p   i   n   g   .   m   e   m   )   ;   
           m   a   p   p   i   n   g   .   m   e   m       =       0   ;   
           r   e   t   u   r   n       1   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   m   a   p   B   u   f   f   e   r       =       _   g   l   U   n   m   a   p   B   u   f   f   e   r   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   U   s   e   P   r   o   g   r   a   m       =       p   r   o   g   r   a   m       =   >       {   
           p   r   o   g   r   a   m       =       G   L   .   p   r   o   g   r   a   m   s   [   p   r   o   g   r   a   m   ]   ;   
           G   L   c   t   x   .   u   s   e   P   r   o   g   r   a   m   (   p   r   o   g   r   a   m   )   ;   
           /   /       R   e   c   o   r   d       t   h   e       c   u   r   r   e   n   t   l   y       a   c   t   i   v   e       p   r   o   g   r   a   m       s   o       t   h   a   t       w   e       c   a   n       a   c   c   e   s   s       t   h   e       u   n   i   f   o   r   m   
           /   /       m   a   p   p   i   n   g       t   a   b   l   e       o   f       t   h   a   t       p   r   o   g   r   a   m   .   
           G   L   c   t   x   .   c   u   r   r   e   n   t   P   r   o   g   r   a   m       =       p   r   o   g   r   a   m   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   s   e   P   r   o   g   r   a   m       =       _   g   l   U   s   e   P   r   o   g   r   a   m   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   V   a   l   i   d   a   t   e   P   r   o   g   r   a   m       =       p   r   o   g   r   a   m       =   >       {   
           G   L   c   t   x   .   v   a   l   i   d   a   t   e   P   r   o   g   r   a   m   (   G   L   .   p   r   o   g   r   a   m   s   [   p   r   o   g   r   a   m   ]   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   V   a   l   i   d   a   t   e   P   r   o   g   r   a   m       =       _   g   l   V   a   l   i   d   a   t   e   P   r   o   g   r   a   m   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   1   f       =       (   x   0   ,       x   1   )       =   >       G   L   c   t   x   .   v   e   r   t   e   x   A   t   t   r   i   b   1   f   (   x   0   ,       x   1   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   1   f       =       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   1   f   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   1   f   v       =       (   i   n   d   e   x   ,       v   )       =   >       {   
           G   L   c   t   x   .   v   e   r   t   e   x   A   t   t   r   i   b   1   f   (   i   n   d   e   x   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   F   3   2   )   [   v       >   >       2   ]   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   1   f   v       =       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   1   f   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   2   f       =       (   x   0   ,       x   1   ,       x   2   )       =   >       G   L   c   t   x   .   v   e   r   t   e   x   A   t   t   r   i   b   2   f   (   x   0   ,       x   1   ,       x   2   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   2   f       =       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   2   f   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   2   f   v       =       (   i   n   d   e   x   ,       v   )       =   >       {   
           G   L   c   t   x   .   v   e   r   t   e   x   A   t   t   r   i   b   2   f   (   i   n   d   e   x   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   F   3   2   )   [   v       >   >       2   ]   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       
           H   E   A   P   F   3   2   )   [   v       +       4       >   >       2   ]   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   2   f   v       =       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   2   f   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   3   f       =       (   x   0   ,       x   1   ,       x   2   ,       x   3   )       =   >       G   L   c   t   x   .   v   e   r   t   e   x   A   t   t   r   i   b   3   f   (   x   0   ,       x   1   ,       x   2   ,       x   3   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   3   f       =       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   3   f   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   3   f   v       =       (   i   n   d   e   x   ,       v   )       =   >       {   
           G   L   c   t   x   .   v   e   r   t   e   x   A   t   t   r   i   b   3   f   (   i   n   d   e   x   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   F   3   2   )   [   v       >   >       2   ]   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       
           H   E   A   P   F   3   2   )   [   v       +       4       >   >       2   ]   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   F   3   2   )   [   v       +       8       >   >       2   ]   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   3   f   v       =       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   3   f   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   4   f       =       (   x   0   ,       x   1   ,       x   2   ,       x   3   ,       x   4   )       =   >       G   L   c   t   x   .   v   e   r   t   e   x   A   t   t   r   i   b   4   f   (   x   0   ,       x   1   ,       x   2   ,       x   3   ,       x   4   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   4   f       =       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   4   f   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   4   f   v       =       (   i   n   d   e   x   ,       v   )       =   >       {   
           G   L   c   t   x   .   v   e   r   t   e   x   A   t   t   r   i   b   4   f   (   i   n   d   e   x   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   F   3   2   )   [   v       >   >       2   ]   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       
           H   E   A   P   F   3   2   )   [   v       +       4       >   >       2   ]   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   F   3   2   )   [   v       +       8       >   >       2   ]   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   F   3   2   )   [   v       +       1   2       >   >       2   ]   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   4   f   v       =       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   4   f   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   D   i   v   i   s   o   r       =       (   i   n   d   e   x   ,       d   i   v   i   s   o   r   )       =   >       {   
           G   L   c   t   x   .   v   e   r   t   e   x   A   t   t   r   i   b   D   i   v   i   s   o   r   (   i   n   d   e   x   ,       d   i   v   i   s   o   r   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   D   i   v   i   s   o   r       =       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   D   i   v   i   s   o   r   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   D   i   v   i   s   o   r   A   N   G   L   E       =       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   D   i   v   i   s   o   r   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   D   i   v   i   s   o   r   A   N   G   L   E       =       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   D   i   v   i   s   o   r   A   N   G   L   E   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   D   i   v   i   s   o   r   A   R   B       =       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   D   i   v   i   s   o   r   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   D   i   v   i   s   o   r   A   R   B       =       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   D   i   v   i   s   o   r   A   R   B   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   D   i   v   i   s   o   r   E   X   T       =       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   D   i   v   i   s   o   r   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   D   i   v   i   s   o   r   E   X   T       =       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   D   i   v   i   s   o   r   E   X   T   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   D   i   v   i   s   o   r   N   V       =       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   D   i   v   i   s   o   r   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   D   i   v   i   s   o   r   N   V       =       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   D   i   v   i   s   o   r   N   V   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   I   4   i       =       (   x   0   ,       x   1   ,       x   2   ,       x   3   ,       x   4   )       =   >       G   L   c   t   x   .   v   e   r   t   e   x   A   t   t   r   i   b   I   4   i   (   x   0   ,       x   1   ,       x   2   ,       x   3   ,       x   4   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   I   4   i       =       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   I   4   i   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   I   4   i   v       =       (   i   n   d   e   x   ,       v   )       =   >       {   
           G   L   c   t   x   .   v   e   r   t   e   x   A   t   t   r   i   b   I   4   i   (   i   n   d   e   x   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   v       >   >       2   ]   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       
           H   E   A   P   3   2   )   [   v       +       4       >   >       2   ]   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   v       +       8       >   >       2   ]   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   v       +       1   2       >   >       2   ]   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   I   4   i   v       =       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   I   4   i   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   I   4   u   i       =       (   x   0   ,       x   1   ,       x   2   ,       x   3   ,       x   4   )       =   >       G   L   c   t   x   .   v   e   r   t   e   x   A   t   t   r   i   b   I   4   u   i   (   x   0   ,       x   1   ,       x   2   ,       x   3   ,       x   4   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   I   4   u   i       =       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   I   4   u   i   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   I   4   u   i   v       =       (   i   n   d   e   x   ,       v   )       =   >       {   
           G   L   c   t   x   .   v   e   r   t   e   x   A   t   t   r   i   b   I   4   u   i   (   i   n   d   e   x   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   v       >   >       2   ]   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       
           H   E   A   P   U   3   2   )   [   v       +       4       >   >       2   ]   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   v       +       8       >   >       2   ]   ,       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   v       +       1   2       >   >       2   ]   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   I   4   u   i   v       =       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   I   4   u   i   v   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   I   P   o   i   n   t   e   r       =       (   i   n   d   e   x   ,       s   i   z   e   ,       t   y   p   e   ,       s   t   r   i   d   e   ,       p   t   r   )       =   >       {   
           v   a   r       c   b       =       G   L   .   c   u   r   r   e   n   t   C   o   n   t   e   x   t   .   c   l   i   e   n   t   B   u   f   f   e   r   s   [   i   n   d   e   x   ]   ;   
           i   f       (   !   G   L   c   t   x   .   c   u   r   r   e   n   t   A   r   r   a   y   B   u   f   f   e   r   B   i   n   d   i   n   g   )       {   
                   c   b   .   s   i   z   e       =       s   i   z   e   ;   
                   c   b   .   t   y   p   e       =       t   y   p   e   ;   
                   c   b   .   n   o   r   m   a   l   i   z   e   d       =       f   a   l   s   e   ;   
                   c   b   .   s   t   r   i   d   e       =       s   t   r   i   d   e   ;   
                   c   b   .   p   t   r       =       p   t   r   ;   
                   c   b   .   c   l   i   e   n   t   s   i   d   e       =       t   r   u   e   ;   
                   c   b   .   v   e   r   t   e   x   A   t   t   r   i   b   P   o   i   n   t   e   r   A   d   a   p   t   o   r       =       f   u   n   c   t   i   o   n   (   i   n   d   e   x   ,       s   i   z   e   ,       t   y   p   e   ,       n   o   r   m   a   l   i   z   e   d   ,       s   t   r   i   d   e   ,       p   t   r   )       {   
                           t   h   i   s   .   v   e   r   t   e   x   A   t   t   r   i   b   I   P   o   i   n   t   e   r   (   i   n   d   e   x   ,       s   i   z   e   ,       t   y   p   e   ,       s   t   r   i   d   e   ,       p   t   r   )   ;   
                   }   ;   
                   r   e   t   u   r   n   ;   
           }   
           c   b   .   c   l   i   e   n   t   s   i   d   e       =       f   a   l   s   e   ;   
           G   L   c   t   x   .   v   e   r   t   e   x   A   t   t   r   i   b   I   P   o   i   n   t   e   r   (   i   n   d   e   x   ,       s   i   z   e   ,       t   y   p   e   ,       s   t   r   i   d   e   ,       p   t   r   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   I   P   o   i   n   t   e   r       =       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   I   P   o   i   n   t   e   r   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   P   o   i   n   t   e   r       =       (   i   n   d   e   x   ,       s   i   z   e   ,       t   y   p   e   ,       n   o   r   m   a   l   i   z   e   d   ,       s   t   r   i   d   e   ,       p   t   r   )       =   >       {   
           v   a   r       c   b       =       G   L   .   c   u   r   r   e   n   t   C   o   n   t   e   x   t   .   c   l   i   e   n   t   B   u   f   f   e   r   s   [   i   n   d   e   x   ]   ;   
           i   f       (   !   G   L   c   t   x   .   c   u   r   r   e   n   t   A   r   r   a   y   B   u   f   f   e   r   B   i   n   d   i   n   g   )       {   
                   c   b   .   s   i   z   e       =       s   i   z   e   ;   
                   c   b   .   t   y   p   e       =       t   y   p   e   ;   
                   c   b   .   n   o   r   m   a   l   i   z   e   d       =       n   o   r   m   a   l   i   z   e   d   ;   
                   c   b   .   s   t   r   i   d   e       =       s   t   r   i   d   e   ;   
                   c   b   .   p   t   r       =       p   t   r   ;   
                   c   b   .   c   l   i   e   n   t   s   i   d   e       =       t   r   u   e   ;   
                   c   b   .   v   e   r   t   e   x   A   t   t   r   i   b   P   o   i   n   t   e   r   A   d   a   p   t   o   r       =       f   u   n   c   t   i   o   n   (   i   n   d   e   x   ,       s   i   z   e   ,       t   y   p   e   ,       n   o   r   m   a   l   i   z   e   d   ,       s   t   r   i   d   e   ,       p   t   r   )       {   
                           t   h   i   s   .   v   e   r   t   e   x   A   t   t   r   i   b   P   o   i   n   t   e   r   (   i   n   d   e   x   ,       s   i   z   e   ,       t   y   p   e   ,       n   o   r   m   a   l   i   z   e   d   ,       s   t   r   i   d   e   ,       p   t   r   )   ;   
                   }   ;   
                   r   e   t   u   r   n   ;   
           }   
           c   b   .   c   l   i   e   n   t   s   i   d   e       =       f   a   l   s   e   ;   
           G   L   c   t   x   .   v   e   r   t   e   x   A   t   t   r   i   b   P   o   i   n   t   e   r   (   i   n   d   e   x   ,       s   i   z   e   ,       t   y   p   e   ,       !   !   n   o   r   m   a   l   i   z   e   d   ,       s   t   r   i   d   e   ,       p   t   r   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   P   o   i   n   t   e   r       =       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   P   o   i   n   t   e   r   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   V   i   e   w   p   o   r   t       =       (   x   0   ,       x   1   ,       x   2   ,       x   3   )       =   >       G   L   c   t   x   .   v   i   e   w   p   o   r   t   (   x   0   ,       x   1   ,       x   2   ,       x   3   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   V   i   e   w   p   o   r   t       =       _   g   l   V   i   e   w   p   o   r   t   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   g   l   W   a   i   t   S   y   n   c       =       (   s   y   n   c   ,       f   l   a   g   s   ,       t   i   m   e   o   u   t   )       =   >       {   
           /   /       S   e   e       W   e   b   G   L   2       v   s       G   L   E   S   3       d   i   f   f   e   r   e   n   c   e       o   n       G   L   _   T   I   M   E   O   U   T   _   I   G   N   O   R   E   D       a   b   o   v   e       (   h   t   t   p   s   :   /   /   w   w   w   .   k   h   r   o   n   o   s   .   o   r   g   /   r   e   g   i   s   t   r   y   /   w   e   b   g   l   /   s   p   e   c   s   /   l   a   t   e   s   t   /   2   .   0   /   #   5   .   1   5   )   
           t   i   m   e   o   u   t       =       N   u   m   b   e   r   (   t   i   m   e   o   u   t   )   ;   
           G   L   c   t   x   .   w   a   i   t   S   y   n   c   (   G   L   .   s   y   n   c   s   [   s   y   n   c   ]   ,       f   l   a   g   s   ,       t   i   m   e   o   u   t   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   g   l   W   a   i   t   S   y   n   c       =       _   g   l   W   a   i   t   S   y   n   c   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   o   u   t       =       s   t   r       =   >       o   u   t   (   U   T   F   8   T   o   S   t   r   i   n   g   (   s   t   r   )   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   r   a   n   d   o   m       =       (   )       =   >       M   a   t   h   .   r   a   n   d   o   m   (   )   ;   
   
   v   a   r       g   e   t   H   e   a   p   M   a   x       =       (   )       =   >       /   /       S   t   a   y       o   n   e       W   a   s   m       p   a   g   e       s   h   o   r   t       o   f       4   G   B   :       w   h   i   l   e       e   .   g   .       C   h   r   o   m   e       i   s       a   b   l   e       t   o       a   l   l   o   c   a   t   e   
   /   /       f   u   l   l       4   G   B       W   a   s   m       m   e   m   o   r   i   e   s   ,       t   h   e       s   i   z   e       w   i   l   l       w   r   a   p       b   a   c   k       t   o       0       b   y   t   e   s       i   n       W   a   s   m       s   i   d   e   
   /   /       f   o   r       a   n   y       c   o   d   e       t   h   a   t       d   e   a   l   s       w   i   t   h       h   e   a   p       s   i   z   e   s   ,       w   h   i   c   h       w   o   u   l   d       r   e   q   u   i   r   e       s   p   e   c   i   a   l   
   /   /       c   a   s   i   n   g       a   l   l       h   e   a   p       s   i   z   e       r   e   l   a   t   e   d       c   o   d   e       t   o       t   r   e   a   t       0       s   p   e   c   i   a   l   l   y   .   
   2   1   4   7   4   8   3   6   4   8   ;   
   
   v   a   r       a   l   i   g   n   M   e   m   o   r   y       =       (   s   i   z   e   ,       a   l   i   g   n   m   e   n   t   )       =   >       {   
           a   s   s   e   r   t   (   a   l   i   g   n   m   e   n   t   ,       "   a   l   i   g   n   m   e   n   t       a   r   g   u   m   e   n   t       i   s       r   e   q   u   i   r   e   d   "   )   ;   
           r   e   t   u   r   n       M   a   t   h   .   c   e   i   l   (   s   i   z   e       /       a   l   i   g   n   m   e   n   t   )       *       a   l   i   g   n   m   e   n   t   ;   
   }   ;   
   
   v   a   r       g   r   o   w   M   e   m   o   r   y       =       s   i   z   e       =   >       {   
           v   a   r       o   l   d   H   e   a   p   S   i   z   e       =       w   a   s   m   M   e   m   o   r   y   .   b   u   f   f   e   r   .   b   y   t   e   L   e   n   g   t   h   ;   
           v   a   r       p   a   g   e   s       =       (   (   s   i   z   e       -       o   l   d   H   e   a   p   S   i   z   e       +       6   5   5   3   5   )       /       6   5   5   3   6   )       |       0   ;   
           t   r   y       {   
                   /   /       r   o   u   n   d       s   i   z   e       g   r   o   w       r   e   q   u   e   s   t       u   p       t   o       w   a   s   m       p   a   g   e       s   i   z   e       (   f   i   x   e   d       6   4   K   B       p   e   r       s   p   e   c   )   
                   w   a   s   m   M   e   m   o   r   y   .   g   r   o   w   (   p   a   g   e   s   )   ;   
                   /   /       .   g   r   o   w   (   )       t   a   k   e   s       a       d   e   l   t   a       c   o   m   p   a   r   e   d       t   o       t   h   e       p   r   e   v   i   o   u   s       s   i   z   e   
                   u   p   d   a   t   e   M   e   m   o   r   y   V   i   e   w   s   (   )   ;   
                   r   e   t   u   r   n       1   ;   
           }       c   a   t   c   h       (   e   )       {   
                   e   r   r   (   `   g   r   o   w   M   e   m   o   r   y   :       A   t   t   e   m   p   t   e   d       t   o       g   r   o   w       h   e   a   p       f   r   o   m       $   {   o   l   d   H   e   a   p   S   i   z   e   }       b   y   t   e   s       t   o       $   {   s   i   z   e   }       b   y   t   e   s   ,       b   u   t       g   o   t       e   r   r   o   r   :       $   {   e   }   `   )   ;   
           }   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   r   e   s   i   z   e   _   h   e   a   p       =       r   e   q   u   e   s   t   e   d   S   i   z   e       =   >       {   
           v   a   r       o   l   d   S   i   z   e       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   8   )   .   l   e   n   g   t   h   ;   
           /   /       W   i   t   h       C   A   N   _   A   D   D   R   E   S   S   _   2   G   B       o   r       M   E   M   O   R   Y   6   4   ,       p   o   i   n   t   e   r   s       a   r   e       a   l   r   e   a   d   y       u   n   s   i   g   n   e   d   .   
           r   e   q   u   e   s   t   e   d   S   i   z   e       >   >   >   =       0   ;   
           /   /       W   i   t   h       m   u   l   t   i   t   h   r   e   a   d   e   d       b   u   i   l   d   s   ,       r   a   c   e   s       c   a   n       h   a   p   p   e   n       (   a   n   o   t   h   e   r       t   h   r   e   a   d       m   i   g   h   t       i   n   c   r   e   a   s   e       t   h   e       s   i   z   e   
           /   /       i   n       b   e   t   w   e   e   n   )   ,       s   o       r   e   t   u   r   n       a       f   a   i   l   u   r   e   ,       a   n   d       l   e   t       t   h   e       c   a   l   l   e   r       r   e   t   r   y   .   
           i   f       (   r   e   q   u   e   s   t   e   d   S   i   z   e       <   =       o   l   d   S   i   z   e   )       {   
                   r   e   t   u   r   n       f   a   l   s   e   ;   
           }   
           /   /       M   e   m   o   r   y       r   e   s   i   z   e       r   u   l   e   s   :   
           /   /       1   .           A   l   w   a   y   s       i   n   c   r   e   a   s   e       h   e   a   p       s   i   z   e       t   o       a   t       l   e   a   s   t       t   h   e       r   e   q   u   e   s   t   e   d       s   i   z   e   ,       r   o   u   n   d   e   d       u   p   
           /   /                       t   o       n   e   x   t       p   a   g   e       m   u   l   t   i   p   l   e   .   
           /   /       2   a   .       I   f       M   E   M   O   R   Y   _   G   R   O   W   T   H   _   L   I   N   E   A   R   _   S   T   E   P       =   =       -   1   ,       e   x   c   e   s   s   i   v   e   l   y       r   e   s   i   z   e       t   h   e       h   e   a   p   
           /   /                       g   e   o   m   e   t   r   i   c   a   l   l   y   :       i   n   c   r   e   a   s   e       t   h   e       h   e   a   p       s   i   z   e       a   c   c   o   r   d   i   n   g       t   o   
           /   /                       M   E   M   O   R   Y   _   G   R   O   W   T   H   _   G   E   O   M   E   T   R   I   C   _   S   T   E   P       f   a   c   t   o   r       (   d   e   f   a   u   l   t       +   2   0   %   )   ,       A   t       m   o   s   t   
           /   /                       o   v   e   r   r   e   s   e   r   v   e       b   y       M   E   M   O   R   Y   _   G   R   O   W   T   H   _   G   E   O   M   E   T   R   I   C   _   C   A   P       b   y   t   e   s       (   d   e   f   a   u   l   t       9   6   M   B   )   .   
           /   /       2   b   .       I   f       M   E   M   O   R   Y   _   G   R   O   W   T   H   _   L   I   N   E   A   R   _   S   T   E   P       !   =       -   1   ,       e   x   c   e   s   s   i   v   e   l   y       r   e   s   i   z   e       t   h   e       h   e   a   p   
           /   /                       l   i   n   e   a   r   l   y   :       i   n   c   r   e   a   s   e       t   h   e       h   e   a   p       s   i   z   e       b   y       a   t       l   e   a   s   t   
           /   /                       M   E   M   O   R   Y   _   G   R   O   W   T   H   _   L   I   N   E   A   R   _   S   T   E   P       b   y   t   e   s   .   
           /   /       3   .           M   a   x       s   i   z   e       f   o   r       t   h   e       h   e   a   p       i   s       c   a   p   p   e   d       a   t       2   0   4   8   M   B   -   W   A   S   M   _   P   A   G   E   _   S   I   Z   E   ,       o   r       b   y   
           /   /                       M   A   X   I   M   U   M   _   M   E   M   O   R   Y   ,       o   r       b   y       A   S   A   N       l   i   m   i   t   ,       d   e   p   e   n   d   i   n   g       o   n       w   h   i   c   h       i   s       s   m   a   l   l   e   s   t   
           /   /       4   .           I   f       w   e       w   e   r   e       u   n   a   b   l   e       t   o       a   l   l   o   c   a   t   e       a   s       m   u   c   h       m   e   m   o   r   y   ,       i   t       m   a   y       b   e       d   u   e       t   o   
           /   /                       o   v   e   r   -   e   a   g   e   r       d   e   c   i   s   i   o   n       t   o       e   x   c   e   s   s   i   v   e   l   y       r   e   s   e   r   v   e       d   u   e       t   o       (   3   )       a   b   o   v   e   .   
           /   /                       H   e   n   c   e       i   f       a   n       a   l   l   o   c   a   t   i   o   n       f   a   i   l   s   ,       c   u   t       d   o   w   n       o   n       t   h   e       a   m   o   u   n   t       o   f       e   x   c   e   s   s   
           /   /                       g   r   o   w   t   h   ,       i   n       a   n       a   t   t   e   m   p   t       t   o       s   u   c   c   e   e   d       t   o       p   e   r   f   o   r   m       a       s   m   a   l   l   e   r       a   l   l   o   c   a   t   i   o   n   .   
           /   /       A       l   i   m   i   t       i   s       s   e   t       f   o   r       h   o   w       m   u   c   h       w   e       c   a   n       g   r   o   w   .       W   e       s   h   o   u   l   d       n   o   t       e   x   c   e   e   d       t   h   a   t   
           /   /       (   t   h   e       w   a   s   m       b   i   n   a   r   y       s   p   e   c   i   f   i   e   s       i   t   ,       s   o       i   f       w   e       t   r   i   e   d   ,       w   e   '   d       f   a   i   l       a   n   y   h   o   w   )   .   
           v   a   r       m   a   x   H   e   a   p   S   i   z   e       =       g   e   t   H   e   a   p   M   a   x   (   )   ;   
           i   f       (   r   e   q   u   e   s   t   e   d   S   i   z   e       >       m   a   x   H   e   a   p   S   i   z   e   )       {   
                   e   r   r   (   `   C   a   n   n   o   t       e   n   l   a   r   g   e       m   e   m   o   r   y   ,       r   e   q   u   e   s   t   e   d       $   {   r   e   q   u   e   s   t   e   d   S   i   z   e   }       b   y   t   e   s   ,       b   u   t       t   h   e       l   i   m   i   t       i   s       $   {   m   a   x   H   e   a   p   S   i   z   e   }       b   y   t   e   s   !   `   )   ;   
                   r   e   t   u   r   n       f   a   l   s   e   ;   
           }   
           /   /       L   o   o   p       t   h   r   o   u   g   h       p   o   t   e   n   t   i   a   l       h   e   a   p       s   i   z   e       i   n   c   r   e   a   s   e   s   .       I   f       w   e       a   t   t   e   m   p   t       a       t   o   o       e   a   g   e   r   
           /   /       r   e   s   e   r   v   a   t   i   o   n       t   h   a   t       f   a   i   l   s   ,       c   u   t       d   o   w   n       o   n       t   h   e       a   t   t   e   m   p   t   e   d       s   i   z   e       a   n   d       r   e   s   e   r   v   e       a   
           /   /       s   m   a   l   l   e   r       b   u   m   p       i   n   s   t   e   a   d   .       (   m   a   x       3       t   i   m   e   s   ,       c   h   o   s   e   n       s   o   m   e   w   h   a   t       a   r   b   i   t   r   a   r   i   l   y   )   
           f   o   r       (   v   a   r       c   u   t   D   o   w   n       =       1   ;       c   u   t   D   o   w   n       <   =       4   ;       c   u   t   D   o   w   n       *   =       2   )       {   
                   v   a   r       o   v   e   r   G   r   o   w   n   H   e   a   p   S   i   z   e       =       o   l   d   S   i   z   e       *       (   1       +       .   2       /       c   u   t   D   o   w   n   )   ;   
                   /   /       e   n   s   u   r   e       g   e   o   m   e   t   r   i   c       g   r   o   w   t   h   
                   /   /       b   u   t       l   i   m   i   t       o   v   e   r   r   e   s   e   r   v   i   n   g       (   d   e   f   a   u   l   t       t   o       c   a   p   p   i   n   g       a   t       +   9   6   M   B       o   v   e   r   g   r   o   w   t   h       a   t       m   o   s   t   )   
                   o   v   e   r   G   r   o   w   n   H   e   a   p   S   i   z   e       =       M   a   t   h   .   m   i   n   (   o   v   e   r   G   r   o   w   n   H   e   a   p   S   i   z   e   ,       r   e   q   u   e   s   t   e   d   S   i   z   e       +       1   0   0   6   6   3   2   9   6   )   ;   
                   v   a   r       n   e   w   S   i   z   e       =       M   a   t   h   .   m   i   n   (   m   a   x   H   e   a   p   S   i   z   e   ,       a   l   i   g   n   M   e   m   o   r   y   (   M   a   t   h   .   m   a   x   (   r   e   q   u   e   s   t   e   d   S   i   z   e   ,       o   v   e   r   G   r   o   w   n   H   e   a   p   S   i   z   e   )   ,       6   5   5   3   6   )   )   ;   
                   v   a   r       r   e   p   l   a   c   e   m   e   n   t       =       g   r   o   w   M   e   m   o   r   y   (   n   e   w   S   i   z   e   )   ;   
                   i   f       (   r   e   p   l   a   c   e   m   e   n   t   )       {   
                           r   e   t   u   r   n       t   r   u   e   ;   
                   }   
           }   
           e   r   r   (   `   F   a   i   l   e   d       t   o       g   r   o   w       t   h   e       h   e   a   p       f   r   o   m       $   {   o   l   d   S   i   z   e   }       b   y   t   e   s       t   o       $   {   n   e   w   S   i   z   e   }       b   y   t   e   s   ,       n   o   t       e   n   o   u   g   h       m   e   m   o   r   y   !   `   )   ;   
           r   e   t   u   r   n       f   a   l   s   e   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   s   e   t   _   m   a   i   n   _   l   o   o   p   _   t   i   m   i   n   g       =       (   m   o   d   e   ,       v   a   l   u   e   )       =   >       {   
           M   a   i   n   L   o   o   p   .   t   i   m   i   n   g   M   o   d   e       =       m   o   d   e   ;   
           M   a   i   n   L   o   o   p   .   t   i   m   i   n   g   V   a   l   u   e       =       v   a   l   u   e   ;   
           i   f       (   !   M   a   i   n   L   o   o   p   .   f   u   n   c   )       {   
                   e   r   r   (   "   e   m   s   c   r   i   p   t   e   n   _   s   e   t   _   m   a   i   n   _   l   o   o   p   _   t   i   m   i   n   g   :       C   a   n   n   o   t       s   e   t       t   i   m   i   n   g       m   o   d   e       f   o   r       m   a   i   n       l   o   o   p       s   i   n   c   e       a       m   a   i   n       l   o   o   p       d   o   e   s       n   o   t       e   x   i   s   t   !       C   a   l   l       e   m   s   c   r   i   p   t   e   n   _   s   e   t   _   m   a   i   n   _   l   o   o   p       f   i   r   s   t       t   o       s   e   t       o   n   e       u   p   .   "   )   ;   
                   r   e   t   u   r   n       1   ;   
           }   
           i   f       (   !   M   a   i   n   L   o   o   p   .   r   u   n   n   i   n   g   )       {   
                   r   u   n   t   i   m   e   K   e   e   p   a   l   i   v   e   P   u   s   h   (   )   ;   
                   M   a   i   n   L   o   o   p   .   r   u   n   n   i   n   g       =       t   r   u   e   ;   
           }   
           i   f       (   m   o   d   e       =   =       0   )       {   
                   M   a   i   n   L   o   o   p   .   s   c   h   e   d   u   l   e   r       =       f   u   n   c   t   i   o   n       M   a   i   n   L   o   o   p   _   s   c   h   e   d   u   l   e   r   _   s   e   t   T   i   m   e   o   u   t   (   )       {   
                           v   a   r       t   i   m   e   U   n   t   i   l   N   e   x   t   T   i   c   k       =       M   a   t   h   .   m   a   x   (   0   ,       M   a   i   n   L   o   o   p   .   t   i   c   k   S   t   a   r   t   T   i   m   e       +       v   a   l   u   e       -       _   e   m   s   c   r   i   p   t   e   n   _   g   e   t   _   n   o   w   (   )   )       |       0   ;   
                           s   e   t   T   i   m   e   o   u   t   (   M   a   i   n   L   o   o   p   .   r   u   n   n   e   r   ,       t   i   m   e   U   n   t   i   l   N   e   x   t   T   i   c   k   )   ;   
                   }   ;   
                   M   a   i   n   L   o   o   p   .   m   e   t   h   o   d       =       "   t   i   m   e   o   u   t   "   ;   
           }       e   l   s   e       i   f       (   m   o   d   e       =   =       1   )       {   
                   M   a   i   n   L   o   o   p   .   s   c   h   e   d   u   l   e   r       =       f   u   n   c   t   i   o   n       M   a   i   n   L   o   o   p   _   s   c   h   e   d   u   l   e   r   _   r   A   F   (   )       {   
                           M   a   i   n   L   o   o   p   .   r   e   q   u   e   s   t   A   n   i   m   a   t   i   o   n   F   r   a   m   e   (   M   a   i   n   L   o   o   p   .   r   u   n   n   e   r   )   ;   
                   }   ;   
                   M   a   i   n   L   o   o   p   .   m   e   t   h   o   d       =       "   r   A   F   "   ;   
           }       e   l   s   e       i   f       (   m   o   d   e       =   =       2   )       {   
                   i   f       (   t   y   p   e   o   f       M   a   i   n   L   o   o   p   .   s   e   t   I   m   m   e   d   i   a   t   e       =   =       "   u   n   d   e   f   i   n   e   d   "   )       {   
                           i   f       (   t   y   p   e   o   f       s   e   t   I   m   m   e   d   i   a   t   e       =   =       "   u   n   d   e   f   i   n   e   d   "   )       {   
                                   /   /       E   m   u   l   a   t   e       s   e   t   I   m   m   e   d   i   a   t   e   .       (   n   o   t   e   :       n   o   t       a       c   o   m   p   l   e   t   e       p   o   l   y   f   i   l   l   ,       w   e       d   o   n   '   t       e   m   u   l   a   t   e       c   l   e   a   r   I   m   m   e   d   i   a   t   e   (   )       t   o       k   e   e   p       c   o   d   e       s   i   z   e       t   o       m   i   n   i   m   u   m   ,       s   i   n   c   e       n   o   t       n   e   e   d   e   d   )   
                                   v   a   r       s   e   t   I   m   m   e   d   i   a   t   e   s       =       [   ]   ;   
                                   v   a   r       e   m   s   c   r   i   p   t   e   n   M   a   i   n   L   o   o   p   M   e   s   s   a   g   e   I   d       =       "   s   e   t   i   m   m   e   d   i   a   t   e   "   ;   
                                   /   *   *       @   p   a   r   a   m       {   E   v   e   n   t   }       e   v   e   n   t       *   /       v   a   r       M   a   i   n   L   o   o   p   _   s   e   t   I   m   m   e   d   i   a   t   e   _   m   e   s   s   a   g   e   H   a   n   d   l   e   r       =       e   v   e   n   t       =   >       {   
                                           /   /       W   h   e   n       c   a   l   l   e   d       i   n       c   u   r   r   e   n   t       t   h   r   e   a   d       o   r       W   o   r   k   e   r   ,       t   h   e       m   a   i   n       l   o   o   p       I   D       i   s       s   t   r   u   c   t   u   r   e   d       s   l   i   g   h   t   l   y       d   i   f   f   e   r   e   n   t       t   o       a   c   c   o   m   m   o   d   a   t   e       f   o   r       -   -   p   r   o   x   y   -   t   o   -   w   o   r   k   e   r       r   u   n   t   i   m   e       l   i   s   t   e   n   i   n   g       t   o       W   o   r   k   e   r       e   v   e   n   t   s   ,   
                                           /   /       s   o       c   h   e   c   k       f   o   r       b   o   t   h       c   a   s   e   s   .   
                                           i   f       (   e   v   e   n   t   .   d   a   t   a       =   =   =       e   m   s   c   r   i   p   t   e   n   M   a   i   n   L   o   o   p   M   e   s   s   a   g   e   I   d       |   |       e   v   e   n   t   .   d   a   t   a   .   t   a   r   g   e   t       =   =   =       e   m   s   c   r   i   p   t   e   n   M   a   i   n   L   o   o   p   M   e   s   s   a   g   e   I   d   )       {   
                                                   e   v   e   n   t   .   s   t   o   p   P   r   o   p   a   g   a   t   i   o   n   (   )   ;   
                                                   s   e   t   I   m   m   e   d   i   a   t   e   s   .   s   h   i   f   t   (   )   (   )   ;   
                                           }   
                                   }   ;   
                                   a   d   d   E   v   e   n   t   L   i   s   t   e   n   e   r   (   "   m   e   s   s   a   g   e   "   ,       M   a   i   n   L   o   o   p   _   s   e   t   I   m   m   e   d   i   a   t   e   _   m   e   s   s   a   g   e   H   a   n   d   l   e   r   ,       t   r   u   e   )   ;   
                                   M   a   i   n   L   o   o   p   .   s   e   t   I   m   m   e   d   i   a   t   e       =       /   *   *       @   t   y   p   e   {   f   u   n   c   t   i   o   n   (   f   u   n   c   t   i   o   n   (   )   :       ?   ,       .   .   .   ?   )   :       n   u   m   b   e   r   }       *   /       (   f   u   n   c       =   >       {   
                                           s   e   t   I   m   m   e   d   i   a   t   e   s   .   p   u   s   h   (   f   u   n   c   )   ;   
                                           i   f       (   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   W   O   R   K   E   R   )       {   
                                                   M   o   d   u   l   e   [   "   s   e   t   I   m   m   e   d   i   a   t   e   s   "   ]       ?   ?   =       [   ]   ;   
                                                   M   o   d   u   l   e   [   "   s   e   t   I   m   m   e   d   i   a   t   e   s   "   ]   .   p   u   s   h   (   f   u   n   c   )   ;   
                                                   p   o   s   t   M   e   s   s   a   g   e   (   {   
                                                           t   a   r   g   e   t   :       e   m   s   c   r   i   p   t   e   n   M   a   i   n   L   o   o   p   M   e   s   s   a   g   e   I   d   
                                                   }   )   ;   
                                           }       e   l   s   e       p   o   s   t   M   e   s   s   a   g   e   (   e   m   s   c   r   i   p   t   e   n   M   a   i   n   L   o   o   p   M   e   s   s   a   g   e   I   d   ,       "   *   "   )   ;   
                                   }   )   ;   
                           }       e   l   s   e       {   
                                   M   a   i   n   L   o   o   p   .   s   e   t   I   m   m   e   d   i   a   t   e       =       s   e   t   I   m   m   e   d   i   a   t   e   ;   
                           }   
                   }   
                   M   a   i   n   L   o   o   p   .   s   c   h   e   d   u   l   e   r       =       f   u   n   c   t   i   o   n       M   a   i   n   L   o   o   p   _   s   c   h   e   d   u   l   e   r   _   s   e   t   I   m   m   e   d   i   a   t   e   (   )       {   
                           M   a   i   n   L   o   o   p   .   s   e   t   I   m   m   e   d   i   a   t   e   (   M   a   i   n   L   o   o   p   .   r   u   n   n   e   r   )   ;   
                   }   ;   
                   M   a   i   n   L   o   o   p   .   m   e   t   h   o   d       =       "   i   m   m   e   d   i   a   t   e   "   ;   
           }   
           r   e   t   u   r   n       0   ;   
   }   ;   
   
   v   a   r       M   a   i   n   L   o   o   p       =       {   
           r   u   n   n   i   n   g   :       f   a   l   s   e   ,   
           s   c   h   e   d   u   l   e   r   :       n   u   l   l   ,   
           m   e   t   h   o   d   :       "   "   ,   
           c   u   r   r   e   n   t   l   y   R   u   n   n   i   n   g   M   a   i   n   l   o   o   p   :       0   ,   
           f   u   n   c   :       n   u   l   l   ,   
           a   r   g   :       0   ,   
           t   i   m   i   n   g   M   o   d   e   :       0   ,   
           t   i   m   i   n   g   V   a   l   u   e   :       0   ,   
           c   u   r   r   e   n   t   F   r   a   m   e   N   u   m   b   e   r   :       0   ,   
           q   u   e   u   e   :       [   ]   ,   
           p   r   e   M   a   i   n   L   o   o   p   :       [   ]   ,   
           p   o   s   t   M   a   i   n   L   o   o   p   :       [   ]   ,   
           p   a   u   s   e   (   )       {   
                   M   a   i   n   L   o   o   p   .   s   c   h   e   d   u   l   e   r       =       n   u   l   l   ;   
                   /   /       I   n   c   r   e   m   e   n   t   i   n   g       t   h   i   s       s   i   g   n   a   l   s       t   h   e       p   r   e   v   i   o   u   s       m   a   i   n       l   o   o   p       t   h   a   t       i   t   '   s       n   o   w       b   e   c   o   m   e       o   l   d   ,       a   n   d       i   t       m   u   s   t       r   e   t   u   r   n   .   
                   M   a   i   n   L   o   o   p   .   c   u   r   r   e   n   t   l   y   R   u   n   n   i   n   g   M   a   i   n   l   o   o   p   +   +   ;   
           }   ,   
           r   e   s   u   m   e   (   )       {   
                   M   a   i   n   L   o   o   p   .   c   u   r   r   e   n   t   l   y   R   u   n   n   i   n   g   M   a   i   n   l   o   o   p   +   +   ;   
                   v   a   r       t   i   m   i   n   g   M   o   d   e       =       M   a   i   n   L   o   o   p   .   t   i   m   i   n   g   M   o   d   e   ;   
                   v   a   r       t   i   m   i   n   g   V   a   l   u   e       =       M   a   i   n   L   o   o   p   .   t   i   m   i   n   g   V   a   l   u   e   ;   
                   v   a   r       f   u   n   c       =       M   a   i   n   L   o   o   p   .   f   u   n   c   ;   
                   M   a   i   n   L   o   o   p   .   f   u   n   c       =       n   u   l   l   ;   
                   /   /       d   o       n   o   t       s   e   t       t   i   m   i   n   g       a   n   d       c   a   l   l       s   c   h   e   d   u   l   e   r   ,       w   e       w   i   l   l       d   o       i   t       o   n       t   h   e       n   e   x   t       l   i   n   e   s   
                   s   e   t   M   a   i   n   L   o   o   p   (   f   u   n   c   ,       0   ,       f   a   l   s   e   ,       M   a   i   n   L   o   o   p   .   a   r   g   ,       t   r   u   e   )   ;   
                   _   e   m   s   c   r   i   p   t   e   n   _   s   e   t   _   m   a   i   n   _   l   o   o   p   _   t   i   m   i   n   g   (   t   i   m   i   n   g   M   o   d   e   ,       t   i   m   i   n   g   V   a   l   u   e   )   ;   
                   M   a   i   n   L   o   o   p   .   s   c   h   e   d   u   l   e   r   (   )   ;   
           }   ,   
           u   p   d   a   t   e   S   t   a   t   u   s   (   )       {   
                   i   f       (   M   o   d   u   l   e   [   "   s   e   t   S   t   a   t   u   s   "   ]   )       {   
                           v   a   r       m   e   s   s   a   g   e       =       M   o   d   u   l   e   [   "   s   t   a   t   u   s   M   e   s   s   a   g   e   "   ]       |   |       "   P   l   e   a   s   e       w   a   i   t   .   .   .   "   ;   
                           v   a   r       r   e   m   a   i   n   i   n   g       =       M   a   i   n   L   o   o   p   .   r   e   m   a   i   n   i   n   g   B   l   o   c   k   e   r   s       ?   ?       0   ;   
                           v   a   r       e   x   p   e   c   t   e   d       =       M   a   i   n   L   o   o   p   .   e   x   p   e   c   t   e   d   B   l   o   c   k   e   r   s       ?   ?       0   ;   
                           i   f       (   r   e   m   a   i   n   i   n   g   )       {   
                                   i   f       (   r   e   m   a   i   n   i   n   g       <       e   x   p   e   c   t   e   d   )       {   
                                           M   o   d   u   l   e   [   "   s   e   t   S   t   a   t   u   s   "   ]   (   `   {   m   e   s   s   a   g   e   }       (   {   e   x   p   e   c   t   e   d       -       r   e   m   a   i   n   i   n   g   }   /   {   e   x   p   e   c   t   e   d   }   )   `   )   ;   
                                   }       e   l   s   e       {   
                                           M   o   d   u   l   e   [   "   s   e   t   S   t   a   t   u   s   "   ]   (   m   e   s   s   a   g   e   )   ;   
                                   }   
                           }       e   l   s   e       {   
                                   M   o   d   u   l   e   [   "   s   e   t   S   t   a   t   u   s   "   ]   (   "   "   )   ;   
                           }   
                   }   
           }   ,   
           i   n   i   t   (   )       {   
                   M   o   d   u   l   e   [   "   p   r   e   M   a   i   n   L   o   o   p   "   ]       &   &       M   a   i   n   L   o   o   p   .   p   r   e   M   a   i   n   L   o   o   p   .   p   u   s   h   (   M   o   d   u   l   e   [   "   p   r   e   M   a   i   n   L   o   o   p   "   ]   )   ;   
                   M   o   d   u   l   e   [   "   p   o   s   t   M   a   i   n   L   o   o   p   "   ]       &   &       M   a   i   n   L   o   o   p   .   p   o   s   t   M   a   i   n   L   o   o   p   .   p   u   s   h   (   M   o   d   u   l   e   [   "   p   o   s   t   M   a   i   n   L   o   o   p   "   ]   )   ;   
           }   ,   
           r   u   n   I   t   e   r   (   f   u   n   c   )       {   
                   i   f       (   A   B   O   R   T   )       r   e   t   u   r   n   ;   
                   f   o   r       (   v   a   r       p   r   e       o   f       M   a   i   n   L   o   o   p   .   p   r   e   M   a   i   n   L   o   o   p   )       {   
                           i   f       (   p   r   e   (   )       =   =   =       f   a   l   s   e   )       {   
                                   r   e   t   u   r   n   ;   
                           }   
                   }   
                   c   a   l   l   U   s   e   r   C   a   l   l   b   a   c   k   (   f   u   n   c   )   ;   
                   f   o   r       (   v   a   r       p   o   s   t       o   f       M   a   i   n   L   o   o   p   .   p   o   s   t   M   a   i   n   L   o   o   p   )       {   
                           p   o   s   t   (   )   ;   
                   }   
                   c   h   e   c   k   S   t   a   c   k   C   o   o   k   i   e   (   )   ;   
           }   ,   
           n   e   x   t   R   A   F   :       0   ,   
           f   a   k   e   R   e   q   u   e   s   t   A   n   i   m   a   t   i   o   n   F   r   a   m   e   (   f   u   n   c   )       {   
                   /   /       t   r   y       t   o       k   e   e   p       6   0   f   p   s       b   e   t   w   e   e   n       c   a   l   l   s       t   o       h   e   r   e   
                   v   a   r       n   o   w       =       D   a   t   e   .   n   o   w   (   )   ;   
                   i   f       (   M   a   i   n   L   o   o   p   .   n   e   x   t   R   A   F       =   =   =       0   )       {   
                           M   a   i   n   L   o   o   p   .   n   e   x   t   R   A   F       =       n   o   w       +       1   e   3       /       6   0   ;   
                   }       e   l   s   e       {   
                           w   h   i   l   e       (   n   o   w       +       2       >   =       M   a   i   n   L   o   o   p   .   n   e   x   t   R   A   F   )       {   
                                   /   /       f   u   d   g   e       a       l   i   t   t   l   e   ,       t   o       a   v   o   i   d       t   i   m   e   r       j   i   t   t   e   r       c   a   u   s   i   n   g       u   s       t   o       d   o       l   o   t   s       o   f       d   e   l   a   y   :   0   
                                   M   a   i   n   L   o   o   p   .   n   e   x   t   R   A   F       +   =       1   e   3       /       6   0   ;   
                           }   
                   }   
                   v   a   r       d   e   l   a   y       =       M   a   t   h   .   m   a   x   (   M   a   i   n   L   o   o   p   .   n   e   x   t   R   A   F       -       n   o   w   ,       0   )   ;   
                   s   e   t   T   i   m   e   o   u   t   (   f   u   n   c   ,       d   e   l   a   y   )   ;   
           }   ,   
           r   e   q   u   e   s   t   A   n   i   m   a   t   i   o   n   F   r   a   m   e   (   f   u   n   c   )       {   
                   i   f       (   t   y   p   e   o   f       r   e   q   u   e   s   t   A   n   i   m   a   t   i   o   n   F   r   a   m   e       =   =       "   f   u   n   c   t   i   o   n   "   )       {   
                           r   e   q   u   e   s   t   A   n   i   m   a   t   i   o   n   F   r   a   m   e   (   f   u   n   c   )   ;   
                           r   e   t   u   r   n   ;   
                   }   
                   v   a   r       R   A   F       =       M   a   i   n   L   o   o   p   .   f   a   k   e   R   e   q   u   e   s   t   A   n   i   m   a   t   i   o   n   F   r   a   m   e   ;   
                   R   A   F   (   f   u   n   c   )   ;   
           }   
   }   ;   
   
   /   *   *   
                       *       @   p   a   r   a   m       {   n   u   m   b   e   r   =   }       a   r   g   
                       *       @   p   a   r   a   m       {   b   o   o   l   e   a   n   =   }       n   o   S   e   t   T   i   m   i   n   g   
                       *   /       v   a   r       s   e   t   M   a   i   n   L   o   o   p       =       (   i   t   e   r   F   u   n   c   ,       f   p   s   ,       s   i   m   u   l   a   t   e   I   n   f   i   n   i   t   e   L   o   o   p   ,       a   r   g   ,       n   o   S   e   t   T   i   m   i   n   g   )       =   >       {   
           a   s   s   e   r   t   (   !   M   a   i   n   L   o   o   p   .   f   u   n   c   ,       "   e   m   s   c   r   i   p   t   e   n   _   s   e   t   _   m   a   i   n   _   l   o   o   p   :       t   h   e   r   e       c   a   n       o   n   l   y       b   e       o   n   e       m   a   i   n       l   o   o   p       f   u   n   c   t   i   o   n       a   t       o   n   c   e   :       c   a   l   l       e   m   s   c   r   i   p   t   e   n   _   c   a   n   c   e   l   _   m   a   i   n   _   l   o   o   p       t   o       c   a   n   c   e   l       t   h   e       p   r   e   v   i   o   u   s       o   n   e       b   e   f   o   r   e       s   e   t   t   i   n   g       a       n   e   w       o   n   e       w   i   t   h       d   i   f   f   e   r   e   n   t       p   a   r   a   m   e   t   e   r   s   .   "   )   ;   
           M   a   i   n   L   o   o   p   .   f   u   n   c       =       i   t   e   r   F   u   n   c   ;   
           M   a   i   n   L   o   o   p   .   a   r   g       =       a   r   g   ;   
           v   a   r       t   h   i   s   M   a   i   n   L   o   o   p   I   d       =       M   a   i   n   L   o   o   p   .   c   u   r   r   e   n   t   l   y   R   u   n   n   i   n   g   M   a   i   n   l   o   o   p   ;   
           f   u   n   c   t   i   o   n       c   h   e   c   k   I   s   R   u   n   n   i   n   g   (   )       {   
                   i   f       (   t   h   i   s   M   a   i   n   L   o   o   p   I   d       <       M   a   i   n   L   o   o   p   .   c   u   r   r   e   n   t   l   y   R   u   n   n   i   n   g   M   a   i   n   l   o   o   p   )       {   
                           r   u   n   t   i   m   e   K   e   e   p   a   l   i   v   e   P   o   p   (   )   ;   
                           m   a   y   b   e   E   x   i   t   (   )   ;   
                           r   e   t   u   r   n       f   a   l   s   e   ;   
                   }   
                   r   e   t   u   r   n       t   r   u   e   ;   
           }   
           /   /       W   e       c   r   e   a   t   e       t   h   e       l   o   o   p       r   u   n   n   e   r       h   e   r   e       b   u   t       i   t       i   s       n   o   t       a   c   t   u   a   l   l   y       r   u   n   n   i   n   g       u   n   t   i   l   
           /   /       _   e   m   s   c   r   i   p   t   e   n   _   s   e   t   _   m   a   i   n   _   l   o   o   p   _   t   i   m   i   n   g       i   s       c   a   l   l   e   d       (   w   h   i   c   h       m   i   g   h   t       h   a   p   p   e   n       a   
           /   /       l   a   t   e   r       t   i   m   e   )   .           T   h   i   s       m   e   m   b   e   r       s   i   g   n   i   f   i   e   s       t   h   a   t       t   h   e       c   u   r   r   e   n   t       r   u   n   n   e   r       h   a   s       n   o   t   
           /   /       y   e   t       b   e   e   n       s   t   a   r   t   e   d       s   o       t   h   a   t       w   e       c   a   n       c   a   l   l       r   u   n   t   i   m   e   K   e   e   p   a   l   i   v   e   P   u   s   h       w   h   e   n       i   t   
           /   /       g   e   t   s       i   t       t   i   m   i   n   g       s   e   t       f   o   r       t   h   e       f   i   r   s   t       t   i   m   e   .   
           M   a   i   n   L   o   o   p   .   r   u   n   n   i   n   g       =       f   a   l   s   e   ;   
           M   a   i   n   L   o   o   p   .   r   u   n   n   e   r       =       f   u   n   c   t   i   o   n       M   a   i   n   L   o   o   p   _   r   u   n   n   e   r   (   )       {   
                   i   f       (   A   B   O   R   T   )       r   e   t   u   r   n   ;   
                   i   f       (   M   a   i   n   L   o   o   p   .   q   u   e   u   e   .   l   e   n   g   t   h       >       0   )       {   
                           v   a   r       s   t   a   r   t       =       D   a   t   e   .   n   o   w   (   )   ;   
                           v   a   r       b   l   o   c   k   e   r       =       M   a   i   n   L   o   o   p   .   q   u   e   u   e   .   s   h   i   f   t   (   )   ;   
                           b   l   o   c   k   e   r   .   f   u   n   c   (   b   l   o   c   k   e   r   .   a   r   g   )   ;   
                           i   f       (   M   a   i   n   L   o   o   p   .   r   e   m   a   i   n   i   n   g   B   l   o   c   k   e   r   s   )       {   
                                   v   a   r       r   e   m   a   i   n   i   n   g       =       M   a   i   n   L   o   o   p   .   r   e   m   a   i   n   i   n   g   B   l   o   c   k   e   r   s   ;   
                                   v   a   r       n   e   x   t       =       r   e   m   a   i   n   i   n   g       %       1       =   =       0       ?       r   e   m   a   i   n   i   n   g       -       1       :       M   a   t   h   .   f   l   o   o   r   (   r   e   m   a   i   n   i   n   g   )   ;   
                                   i   f       (   b   l   o   c   k   e   r   .   c   o   u   n   t   e   d   )       {   
                                           M   a   i   n   L   o   o   p   .   r   e   m   a   i   n   i   n   g   B   l   o   c   k   e   r   s       =       n   e   x   t   ;   
                                   }       e   l   s   e       {   
                                           /   /       n   o   t       c   o   u   n   t   e   d   ,       b   u   t       m   o   v   e       t   h   e       p   r   o   g   r   e   s   s       a   l   o   n   g       a       t   i   n   y       b   i   t   
                                           n   e   x   t       =       n   e   x   t       +       .   5   ;   
                                           /   /       d   o       n   o   t       s   t   e   a   l       a   l   l       t   h   e       n   e   x   t       o   n   e   '   s       p   r   o   g   r   e   s   s   
                                           M   a   i   n   L   o   o   p   .   r   e   m   a   i   n   i   n   g   B   l   o   c   k   e   r   s       =       (   8       *       r   e   m   a   i   n   i   n   g       +       n   e   x   t   )       /       9   ;   
                                   }   
                           }   
                           M   a   i   n   L   o   o   p   .   u   p   d   a   t   e   S   t   a   t   u   s   (   )   ;   
                           /   /       c   a   t   c   h   e   s       p   a   u   s   e   /   r   e   s   u   m   e       m   a   i   n       l   o   o   p       f   r   o   m       b   l   o   c   k   e   r       e   x   e   c   u   t   i   o   n   
                           i   f       (   !   c   h   e   c   k   I   s   R   u   n   n   i   n   g   (   )   )       r   e   t   u   r   n   ;   
                           s   e   t   T   i   m   e   o   u   t   (   M   a   i   n   L   o   o   p   .   r   u   n   n   e   r   ,       0   )   ;   
                           r   e   t   u   r   n   ;   
                   }   
                   /   /       c   a   t   c   h       p   a   u   s   e   s       f   r   o   m       n   o   n   -   m   a   i   n       l   o   o   p       s   o   u   r   c   e   s   
                   i   f       (   !   c   h   e   c   k   I   s   R   u   n   n   i   n   g   (   )   )       r   e   t   u   r   n   ;   
                   /   /       I   m   p   l   e   m   e   n   t       v   e   r   y       b   a   s   i   c       s   w   a   p       i   n   t   e   r   v   a   l       c   o   n   t   r   o   l   
                   M   a   i   n   L   o   o   p   .   c   u   r   r   e   n   t   F   r   a   m   e   N   u   m   b   e   r       =       M   a   i   n   L   o   o   p   .   c   u   r   r   e   n   t   F   r   a   m   e   N   u   m   b   e   r       +       1       |       0   ;   
                   i   f       (   M   a   i   n   L   o   o   p   .   t   i   m   i   n   g   M   o   d   e       =   =       1       &   &       M   a   i   n   L   o   o   p   .   t   i   m   i   n   g   V   a   l   u   e       >       1       &   &       M   a   i   n   L   o   o   p   .   c   u   r   r   e   n   t   F   r   a   m   e   N   u   m   b   e   r       %       M   a   i   n   L   o   o   p   .   t   i   m   i   n   g   V   a   l   u   e       !   =       0   )       {   
                           /   /       N   o   t       t   h   e       s   c   h   e   d   u   l   e   d       t   i   m   e       t   o       r   e   n   d   e   r       t   h   i   s       f   r   a   m   e       -       s   k   i   p   .   
                           M   a   i   n   L   o   o   p   .   s   c   h   e   d   u   l   e   r   (   )   ;   
                           r   e   t   u   r   n   ;   
                   }       e   l   s   e       i   f       (   M   a   i   n   L   o   o   p   .   t   i   m   i   n   g   M   o   d   e       =   =       0   )       {   
                           M   a   i   n   L   o   o   p   .   t   i   c   k   S   t   a   r   t   T   i   m   e       =       _   e   m   s   c   r   i   p   t   e   n   _   g   e   t   _   n   o   w   (   )   ;   
                   }   
                   i   f       (   M   a   i   n   L   o   o   p   .   m   e   t   h   o   d       =   =   =       "   t   i   m   e   o   u   t   "       &   &       M   o   d   u   l   e   [   "   c   t   x   "   ]   )       {   
                           w   a   r   n   O   n   c   e   (   "   L   o   o   k   s       l   i   k   e       y   o   u       a   r   e       r   e   n   d   e   r   i   n   g       w   i   t   h   o   u   t       u   s   i   n   g       r   e   q   u   e   s   t   A   n   i   m   a   t   i   o   n   F   r   a   m   e       f   o   r       t   h   e       m   a   i   n       l   o   o   p   .       Y   o   u       s   h   o   u   l   d       u   s   e       0       f   o   r       t   h   e       f   r   a   m   e       r   a   t   e       i   n       e   m   s   c   r   i   p   t   e   n   _   s   e   t   _   m   a   i   n   _   l   o   o   p       i   n       o   r   d   e   r       t   o       u   s   e       r   e   q   u   e   s   t   A   n   i   m   a   t   i   o   n   F   r   a   m   e   ,       a   s       t   h   a   t       c   a   n       g   r   e   a   t   l   y       i   m   p   r   o   v   e       y   o   u   r       f   r   a   m   e       r   a   t   e   s   !   "   )   ;   
                           M   a   i   n   L   o   o   p   .   m   e   t   h   o   d       =       "   "   ;   
                   }   
                   M   a   i   n   L   o   o   p   .   r   u   n   I   t   e   r   (   i   t   e   r   F   u   n   c   )   ;   
                   /   /       c   a   t   c   h       p   a   u   s   e   s       f   r   o   m       t   h   e       m   a   i   n       l   o   o   p       i   t   s   e   l   f   
                   i   f       (   !   c   h   e   c   k   I   s   R   u   n   n   i   n   g   (   )   )       r   e   t   u   r   n   ;   
                   M   a   i   n   L   o   o   p   .   s   c   h   e   d   u   l   e   r   (   )   ;   
           }   ;   
           i   f       (   !   n   o   S   e   t   T   i   m   i   n   g   )       {   
                   i   f       (   f   p   s       >       0   )       {   
                           _   e   m   s   c   r   i   p   t   e   n   _   s   e   t   _   m   a   i   n   _   l   o   o   p   _   t   i   m   i   n   g   (   0   ,       1   e   3       /       f   p   s   )   ;   
                   }       e   l   s   e       {   
                           /   /       D   o       r   A   F       b   y       r   e   n   d   e   r   i   n   g       e   a   c   h       f   r   a   m   e       (   n   o       d   e   c   i   m   a   t   i   n   g   )   
                           _   e   m   s   c   r   i   p   t   e   n   _   s   e   t   _   m   a   i   n   _   l   o   o   p   _   t   i   m   i   n   g   (   1   ,       1   )   ;   
                   }   
                   M   a   i   n   L   o   o   p   .   s   c   h   e   d   u   l   e   r   (   )   ;   
           }   
           i   f       (   s   i   m   u   l   a   t   e   I   n   f   i   n   i   t   e   L   o   o   p   )       {   
                   t   h   r   o   w       "   u   n   w   i   n   d   "   ;   
           }   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   s   e   t   _   m   a   i   n   _   l   o   o   p       =       (   f   u   n   c   ,       f   p   s   ,       s   i   m   u   l   a   t   e   I   n   f   i   n   i   t   e   L   o   o   p   )       =   >       {   
           v   a   r       i   t   e   r   F   u   n   c       =       g   e   t   W   a   s   m   T   a   b   l   e   E   n   t   r   y   (   f   u   n   c   )   ;   
           s   e   t   M   a   i   n   L   o   o   p   (   i   t   e   r   F   u   n   c   ,       f   p   s   ,       s   i   m   u   l   a   t   e   I   n   f   i   n   i   t   e   L   o   o   p   )   ;   
   }   ;   
   
   v   a   r       w   e   b   g   l   P   o   w   e   r   P   r   e   f   e   r   e   n   c   e   s       =       [       "   d   e   f   a   u   l   t   "   ,       "   l   o   w   -   p   o   w   e   r   "   ,       "   h   i   g   h   -   p   e   r   f   o   r   m   a   n   c   e   "       ]   ;   
   
   v   a   r       m   a   y   b   e   C   S   t   r   i   n   g   T   o   J   s   S   t   r   i   n   g       =       c   S   t   r   i   n   g       =   >       c   S   t   r   i   n   g       >       2       ?       U   T   F   8   T   o   S   t   r   i   n   g   (   c   S   t   r   i   n   g   )       :       c   S   t   r   i   n   g   ;   
   
   /   *   *       @   t   y   p   e       {   O   b   j   e   c   t   }       *   /       v   a   r       s   p   e   c   i   a   l   H   T   M   L   T   a   r   g   e   t   s       =       [       0   ,       t   y   p   e   o   f       d   o   c   u   m   e   n   t       !   =       "   u   n   d   e   f   i   n   e   d   "       ?       d   o   c   u   m   e   n   t       :       0   ,       t   y   p   e   o   f       w   i   n   d   o   w       !   =       "   u   n   d   e   f   i   n   e   d   "       ?       w   i   n   d   o   w       :       0       ]   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       f   i   n   d   E   v   e   n   t   T   a   r   g   e   t       =       t   a   r   g   e   t       =   >       {   
           t   a   r   g   e   t       =       m   a   y   b   e   C   S   t   r   i   n   g   T   o   J   s   S   t   r   i   n   g   (   t   a   r   g   e   t   )   ;   
           v   a   r       d   o   m   E   l   e   m   e   n   t       =       s   p   e   c   i   a   l   H   T   M   L   T   a   r   g   e   t   s   [   t   a   r   g   e   t   ]       |   |       (   t   y   p   e   o   f       d   o   c   u   m   e   n   t       !   =       "   u   n   d   e   f   i   n   e   d   "       ?       d   o   c   u   m   e   n   t   .   q   u   e   r   y   S   e   l   e   c   t   o   r   (   t   a   r   g   e   t   )       :       n   u   l   l   )   ;   
           r   e   t   u   r   n       d   o   m   E   l   e   m   e   n   t   ;   
   }   ;   
   
   v   a   r       f   i   n   d   C   a   n   v   a   s   E   v   e   n   t   T   a   r   g   e   t       =       f   i   n   d   E   v   e   n   t   T   a   r   g   e   t   ;   
   
   /   *   *       @   s   u   p   p   r   e   s   s       {   d   u   p   l   i   c   a   t   e       }       *   /       v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   w   e   b   g   l   _   d   o   _   c   r   e   a   t   e   _   c   o   n   t   e   x   t       =       (   t   a   r   g   e   t   ,       a   t   t   r   i   b   u   t   e   s   )       =   >       {   
           a   s   s   e   r   t   (   a   t   t   r   i   b   u   t   e   s   )   ;   
           v   a   r       a   t   t   r   3   2       =       (   (   a   t   t   r   i   b   u   t   e   s   )       >   >       2   )   ;   
           v   a   r       p   o   w   e   r   P   r   e   f   e   r   e   n   c   e       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   a   t   t   r   3   2       +       (   8       >   >       2   )   ]   ;   
           v   a   r       c   o   n   t   e   x   t   A   t   t   r   i   b   u   t   e   s       =       {   
                   "   a   l   p   h   a   "   :       !   !   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   8   )   [   a   t   t   r   i   b   u   t   e   s       +       0   ]   ,   
                   "   d   e   p   t   h   "   :       !   !   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   8   )   [   a   t   t   r   i   b   u   t   e   s       +       1   ]   ,   
                   "   s   t   e   n   c   i   l   "   :       !   !   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   8   )   [   a   t   t   r   i   b   u   t   e   s       +       2   ]   ,   
                   "   a   n   t   i   a   l   i   a   s   "   :       !   !   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   8   )   [   a   t   t   r   i   b   u   t   e   s       +       3   ]   ,   
                   "   p   r   e   m   u   l   t   i   p   l   i   e   d   A   l   p   h   a   "   :       !   !   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   8   )   [   a   t   t   r   i   b   u   t   e   s       +       4   ]   ,   
                   "   p   r   e   s   e   r   v   e   D   r   a   w   i   n   g   B   u   f   f   e   r   "   :       !   !   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   8   )   [   a   t   t   r   i   b   u   t   e   s       +       5   ]   ,   
                   "   p   o   w   e   r   P   r   e   f   e   r   e   n   c   e   "   :       w   e   b   g   l   P   o   w   e   r   P   r   e   f   e   r   e   n   c   e   s   [   p   o   w   e   r   P   r   e   f   e   r   e   n   c   e   ]   ,   
                   "   f   a   i   l   I   f   M   a   j   o   r   P   e   r   f   o   r   m   a   n   c   e   C   a   v   e   a   t   "   :       !   !   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   8   )   [   a   t   t   r   i   b   u   t   e   s       +       1   2   ]   ,   
                   /   /       T   h   e       f   o   l   l   o   w   i   n   g       a   r   e       n   o   t       p   r   e   d   e   f   i   n   e   d       W   e   b   G   L       c   o   n   t   e   x   t       a   t   t   r   i   b   u   t   e   s       i   n       t   h   e       W   e   b   G   L       s   p   e   c   i   f   i   c   a   t   i   o   n   ,       s   o       t   h   e       p   r   o   p   e   r   t   y       n   a   m   e   s       c   a   n       b   e       m   i   n   i   f   i   e   d       b   y       C   l   o   s   u   r   e   .   
                   m   a   j   o   r   V   e   r   s   i   o   n   :       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   a   t   t   r   3   2       +       (   1   6       >   >       2   )   ]   ,   
                   m   i   n   o   r   V   e   r   s   i   o   n   :       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   a   t   t   r   3   2       +       (   2   0       >   >       2   )   ]   ,   
                   e   n   a   b   l   e   E   x   t   e   n   s   i   o   n   s   B   y   D   e   f   a   u   l   t   :       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   8   )   [   a   t   t   r   i   b   u   t   e   s       +       2   4   ]   ,   
                   e   x   p   l   i   c   i   t   S   w   a   p   C   o   n   t   r   o   l   :       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   8   )   [   a   t   t   r   i   b   u   t   e   s       +       2   5   ]   ,   
                   p   r   o   x   y   C   o   n   t   e   x   t   T   o   M   a   i   n   T   h   r   e   a   d   :       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   3   2   )   [   a   t   t   r   3   2       +       (   2   8       >   >       2   )   ]   ,   
                   r   e   n   d   e   r   V   i   a   O   f   f   s   c   r   e   e   n   B   a   c   k   B   u   f   f   e   r   :       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   8   )   [   a   t   t   r   i   b   u   t   e   s       +       3   2   ]   
           }   ;   
           /   /           T   O   D   O   :       M   a   k   e       t   h   e   s   e       i   n   t   o       h   a   r   d       e   r   r   o   r   s       a   t       s   o   m   e       p   o   i   n   t       i   n       t   h   e       f   u   t   u   r   e   
           i   f       (   c   o   n   t   e   x   t   A   t   t   r   i   b   u   t   e   s   .   m   a   j   o   r   V   e   r   s   i   o   n       !   =   =       1       &   &       c   o   n   t   e   x   t   A   t   t   r   i   b   u   t   e   s   .   m   a   j   o   r   V   e   r   s   i   o   n       !   =   =       2   )       {   
                   e   r   r   (   `   I   n   v   a   l   i   d       W   e   b   G   L       v   e   r   s   i   o   n       r   e   q   u   e   s   t   e   d   :       $   {   c   o   n   t   e   x   t   A   t   t   r   i   b   u   t   e   s   .   m   a   j   o   r   V   e   r   s   i   o   n   }   `   )   ;   
           }   
           i   f       (   c   o   n   t   e   x   t   A   t   t   r   i   b   u   t   e   s   .   m   a   j   o   r   V   e   r   s   i   o   n       !   =   =       2   )       {   
                   e   r   r   (   "   W   e   b   G   L       1       r   e   q   u   e   s   t   e   d       b   u   t       o   n   l   y       W   e   b   G   L       2       i   s       s   u   p   p   o   r   t   e   d       (   M   I   N   _   W   E   B   G   L   _   V   E   R   S   I   O   N       i   s       2   )   "   )   ;   
           }   
           v   a   r       c   a   n   v   a   s       =       f   i   n   d   C   a   n   v   a   s   E   v   e   n   t   T   a   r   g   e   t   (   t   a   r   g   e   t   )   ;   
           i   f       (   !   c   a   n   v   a   s   )       {   
                   r   e   t   u   r   n       0   ;   
           }   
           i   f       (   c   o   n   t   e   x   t   A   t   t   r   i   b   u   t   e   s   .   e   x   p   l   i   c   i   t   S   w   a   p   C   o   n   t   r   o   l   )       {   
                   r   e   t   u   r   n       0   ;   
           }   
           v   a   r       c   o   n   t   e   x   t   H   a   n   d   l   e       =       G   L   .   c   r   e   a   t   e   C   o   n   t   e   x   t   (   c   a   n   v   a   s   ,       c   o   n   t   e   x   t   A   t   t   r   i   b   u   t   e   s   )   ;   
           r   e   t   u   r   n       c   o   n   t   e   x   t   H   a   n   d   l   e   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   w   e   b   g   l   _   c   r   e   a   t   e   _   c   o   n   t   e   x   t       =       _   e   m   s   c   r   i   p   t   e   n   _   w   e   b   g   l   _   d   o   _   c   r   e   a   t   e   _   c   o   n   t   e   x   t   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   w   e   b   g   l   _   d   e   s   t   r   o   y   _   c   o   n   t   e   x   t       =       c   o   n   t   e   x   t   H   a   n   d   l   e       =   >       {   
           i   f       (   G   L   .   c   u   r   r   e   n   t   C   o   n   t   e   x   t       =   =       c   o   n   t   e   x   t   H   a   n   d   l   e   )       G   L   .   c   u   r   r   e   n   t   C   o   n   t   e   x   t       =       0   ;   
           G   L   .   d   e   l   e   t   e   C   o   n   t   e   x   t   (   c   o   n   t   e   x   t   H   a   n   d   l   e   )   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   w   e   b   g   l   _   e   n   a   b   l   e   _   e   x   t   e   n   s   i   o   n       =       (   c   o   n   t   e   x   t   H   a   n   d   l   e   ,       e   x   t   e   n   s   i   o   n   )       =   >       {   
           v   a   r       c   o   n   t   e   x   t       =       G   L   .   g   e   t   C   o   n   t   e   x   t   (   c   o   n   t   e   x   t   H   a   n   d   l   e   )   ;   
           v   a   r       e   x   t   S   t   r   i   n   g       =       U   T   F   8   T   o   S   t   r   i   n   g   (   e   x   t   e   n   s   i   o   n   )   ;   
           i   f       (   e   x   t   S   t   r   i   n   g   .   s   t   a   r   t   s   W   i   t   h   (   "   G   L   _   "   )   )       e   x   t   S   t   r   i   n   g       =       e   x   t   S   t   r   i   n   g   .   s   l   i   c   e   (   3   )   ;   
           /   /       A   l   l   o   w       e   n   a   b   l   i   n   g       e   x   t   e   n   s   i   o   n   s       b   o   t   h       w   i   t   h       "   G   L   _   "       p   r   e   f   i   x       a   n   d       w   i   t   h   o   u   t   .   
           /   /       S   w   i   t   c   h   -   b   o   a   r   d       t   h   a   t       p   u   l   l   s       i   n       c   o   d   e       f   o   r       a   l   l       G   L       e   x   t   e   n   s   i   o   n   s   ,       e   v   e   n       i   f       t   h   o   s   e       a   r   e       n   o   t       u   s   e   d       :   /   
           /   /       B   u   i   l   d       w   i   t   h       -   s   G   L   _   S   U   P   P   O   R   T   _   S   I   M   P   L   E   _   E   N   A   B   L   E   _   E   X   T   E   N   S   I   O   N   S   =   0       t   o       a   v   o   i   d       t   h   i   s   .   
           i   f       (   e   x   t   S   t   r   i   n   g       =   =       "   W   E   B   G   L   _   d   r   a   w   _   i   n   s   t   a   n   c   e   d   _   b   a   s   e   _   v   e   r   t   e   x   _   b   a   s   e   _   i   n   s   t   a   n   c   e   "   )       w   e   b   g   l   _   e   n   a   b   l   e   _   W   E   B   G   L   _   d   r   a   w   _   i   n   s   t   a   n   c   e   d   _   b   a   s   e   _   v   e   r   t   e   x   _   b   a   s   e   _   i   n   s   t   a   n   c   e   (   G   L   c   t   x   )   ;   
           i   f       (   e   x   t   S   t   r   i   n   g       =   =       "   W   E   B   G   L   _   m   u   l   t   i   _   d   r   a   w   _   i   n   s   t   a   n   c   e   d   _   b   a   s   e   _   v   e   r   t   e   x   _   b   a   s   e   _   i   n   s   t   a   n   c   e   "   )       w   e   b   g   l   _   e   n   a   b   l   e   _   W   E   B   G   L   _   m   u   l   t   i   _   d   r   a   w   _   i   n   s   t   a   n   c   e   d   _   b   a   s   e   _   v   e   r   t   e   x   _   b   a   s   e   _   i   n   s   t   a   n   c   e   (   G   L   c   t   x   )   ;   
           i   f       (   e   x   t   S   t   r   i   n   g       =   =       "   W   E   B   G   L   _   m   u   l   t   i   _   d   r   a   w   "   )       w   e   b   g   l   _   e   n   a   b   l   e   _   W   E   B   G   L   _   m   u   l   t   i   _   d   r   a   w   (   G   L   c   t   x   )   ;   
           i   f       (   e   x   t   S   t   r   i   n   g       =   =       "   E   X   T   _   p   o   l   y   g   o   n   _   o   f   f   s   e   t   _   c   l   a   m   p   "   )       w   e   b   g   l   _   e   n   a   b   l   e   _   E   X   T   _   p   o   l   y   g   o   n   _   o   f   f   s   e   t   _   c   l   a   m   p   (   G   L   c   t   x   )   ;   
           i   f       (   e   x   t   S   t   r   i   n   g       =   =       "   E   X   T   _   c   l   i   p   _   c   o   n   t   r   o   l   "   )       w   e   b   g   l   _   e   n   a   b   l   e   _   E   X   T   _   c   l   i   p   _   c   o   n   t   r   o   l   (   G   L   c   t   x   )   ;   
           i   f       (   e   x   t   S   t   r   i   n   g       =   =       "   W   E   B   G   L   _   p   o   l   y   g   o   n   _   m   o   d   e   "   )       w   e   b   g   l   _   e   n   a   b   l   e   _   W   E   B   G   L   _   p   o   l   y   g   o   n   _   m   o   d   e   (   G   L   c   t   x   )   ;   
           v   a   r       e   x   t       =       c   o   n   t   e   x   t   .   G   L   c   t   x   .   g   e   t   E   x   t   e   n   s   i   o   n   (   e   x   t   S   t   r   i   n   g   )   ;   
           r   e   t   u   r   n       !   !   e   x   t   ;   
   }   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   w   e   b   g   l   _   m   a   k   e   _   c   o   n   t   e   x   t   _   c   u   r   r   e   n   t       =       c   o   n   t   e   x   t   H   a   n   d   l   e       =   >       {   
           v   a   r       s   u   c   c   e   s   s       =       G   L   .   m   a   k   e   C   o   n   t   e   x   t   C   u   r   r   e   n   t   (   c   o   n   t   e   x   t   H   a   n   d   l   e   )   ;   
           r   e   t   u   r   n       s   u   c   c   e   s   s       ?       0       :       -   5   ;   
   }   ;   
   
   v   a   r       E   N   V       =       {   }   ;   
   
   v   a   r       g   e   t   E   x   e   c   u   t   a   b   l   e   N   a   m   e       =       (   )       =   >       t   h   i   s   P   r   o   g   r   a   m       |   |       "   .   /   t   h   i   s   .   p   r   o   g   r   a   m   "   ;   
   
   v   a   r       g   e   t   E   n   v   S   t   r   i   n   g   s       =       (   )       =   >       {   
           i   f       (   !   g   e   t   E   n   v   S   t   r   i   n   g   s   .   s   t   r   i   n   g   s   )       {   
                   /   /       D   e   f   a   u   l   t       v   a   l   u   e   s   .   
                   /   /       B   r   o   w   s   e   r       l   a   n   g   u   a   g   e       d   e   t   e   c   t   i   o   n       #   8   7   5   1   
                   v   a   r       l   a   n   g       =       (   (   t   y   p   e   o   f       n   a   v   i   g   a   t   o   r       =   =       "   o   b   j   e   c   t   "       &   &       n   a   v   i   g   a   t   o   r   .   l   a   n   g   u   a   g   e   )       |   |       "   C   "   )   .   r   e   p   l   a   c   e   (   "   -   "   ,       "   _   "   )       +       "   .   U   T   F   -   8   "   ;   
                   v   a   r       e   n   v       =       {   
                           "   U   S   E   R   "   :       "   w   e   b   _   u   s   e   r   "   ,   
                           "   L   O   G   N   A   M   E   "   :       "   w   e   b   _   u   s   e   r   "   ,   
                           "   P   A   T   H   "   :       "   /   "   ,   
                           "   P   W   D   "   :       "   /   "   ,   
                           "   H   O   M   E   "   :       "   /   h   o   m   e   /   w   e   b   _   u   s   e   r   "   ,   
                           "   L   A   N   G   "   :       l   a   n   g   ,   
                           "   _   "   :       g   e   t   E   x   e   c   u   t   a   b   l   e   N   a   m   e   (   )   
                   }   ;   
                   /   /       A   p   p   l   y       t   h   e       u   s   e   r   -   p   r   o   v   i   d   e   d       v   a   l   u   e   s   ,       i   f       a   n   y   .   
                   f   o   r       (   v   a   r       x       i   n       E   N   V   )       {   
                           /   /       x       i   s       a       k   e   y       i   n       E   N   V   ;       i   f       E   N   V   [   x   ]       i   s       u   n   d   e   f   i   n   e   d   ,       t   h   a   t       m   e   a   n   s       i   t       w   a   s   
                           /   /       e   x   p   l   i   c   i   t   l   y       s   e   t       t   o       b   e       s   o   .       W   e       a   l   l   o   w       u   s   e   r       c   o   d   e       t   o       d   o       t   h   a   t       t   o   
                           /   /       f   o   r   c   e       v   a   r   i   a   b   l   e   s       w   i   t   h       d   e   f   a   u   l   t       v   a   l   u   e   s       t   o       r   e   m   a   i   n       u   n   s   e   t   .   
                           i   f       (   E   N   V   [   x   ]       =   =   =       u   n   d   e   f   i   n   e   d   )       d   e   l   e   t   e       e   n   v   [   x   ]   ;       e   l   s   e       e   n   v   [   x   ]       =       E   N   V   [   x   ]   ;   
                   }   
                   v   a   r       s   t   r   i   n   g   s       =       [   ]   ;   
                   f   o   r       (   v   a   r       x       i   n       e   n   v   )       {   
                           s   t   r   i   n   g   s   .   p   u   s   h   (   `   $   {   x   }   =   $   {   e   n   v   [   x   ]   }   `   )   ;   
                   }   
                   g   e   t   E   n   v   S   t   r   i   n   g   s   .   s   t   r   i   n   g   s       =       s   t   r   i   n   g   s   ;   
           }   
           r   e   t   u   r   n       g   e   t   E   n   v   S   t   r   i   n   g   s   .   s   t   r   i   n   g   s   ;   
   }   ;   
   
   f   u   n   c   t   i   o   n       _   e   n   v   i   r   o   n   _   g   e   t   (   _   _   e   n   v   i   r   o   n   ,       e   n   v   i   r   o   n   _   b   u   f   )       {   
           i   f       (   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   P   T   H   R   E   A   D   )       r   e   t   u   r   n       p   r   o   x   y   T   o   M   a   i   n   T   h   r   e   a   d   (   1   1   ,       0   ,       1   ,       _   _   e   n   v   i   r   o   n   ,       e   n   v   i   r   o   n   _   b   u   f   )   ;   
           v   a   r       b   u   f   S   i   z   e       =       0   ;   
           v   a   r       e   n   v   p       =       0   ;   
           f   o   r       (   v   a   r       s   t   r   i   n   g       o   f       g   e   t   E   n   v   S   t   r   i   n   g   s   (   )   )       {   
                   v   a   r       p   t   r       =       e   n   v   i   r   o   n   _   b   u   f       +       b   u   f   S   i   z   e   ;   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   (   _   _   e   n   v   i   r   o   n   )       +       (   e   n   v   p   )   )       >   >       2   )   ]       =       p   t   r   ;   
                   b   u   f   S   i   z   e       +   =       s   t   r   i   n   g   T   o   U   T   F   8   (   s   t   r   i   n   g   ,       p   t   r   ,       I   n   f   i   n   i   t   y   )       +       1   ;   
                   e   n   v   p       +   =       4   ;   
           }   
           r   e   t   u   r   n       0   ;   
   }   
   
   f   u   n   c   t   i   o   n       _   e   n   v   i   r   o   n   _   s   i   z   e   s   _   g   e   t   (   p   e   n   v   i   r   o   n   _   c   o   u   n   t   ,       p   e   n   v   i   r   o   n   _   b   u   f   _   s   i   z   e   )       {   
           i   f       (   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   P   T   H   R   E   A   D   )       r   e   t   u   r   n       p   r   o   x   y   T   o   M   a   i   n   T   h   r   e   a   d   (   1   2   ,       0   ,       1   ,       p   e   n   v   i   r   o   n   _   c   o   u   n   t   ,       p   e   n   v   i   r   o   n   _   b   u   f   _   s   i   z   e   )   ;   
           v   a   r       s   t   r   i   n   g   s       =       g   e   t   E   n   v   S   t   r   i   n   g   s   (   )   ;   
           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   p   e   n   v   i   r   o   n   _   c   o   u   n   t   )       >   >       2   )   ]       =       s   t   r   i   n   g   s   .   l   e   n   g   t   h   ;   
           v   a   r       b   u   f   S   i   z   e       =       0   ;   
           f   o   r       (   v   a   r       s   t   r   i   n   g       o   f       s   t   r   i   n   g   s   )       {   
                   b   u   f   S   i   z   e       +   =       l   e   n   g   t   h   B   y   t   e   s   U   T   F   8   (   s   t   r   i   n   g   )       +       1   ;   
           }   
           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   p   e   n   v   i   r   o   n   _   b   u   f   _   s   i   z   e   )       >   >       2   )   ]       =       b   u   f   S   i   z   e   ;   
           r   e   t   u   r   n       0   ;   
   }   
   
   v   a   r       _   l   l   v   m   _   e   h   _   t   y   p   e   i   d   _   f   o   r       =       t   y   p   e       =   >       t   y   p   e   ;   
   
   v   a   r       i   n   i   t   R   a   n   d   o   m   F   i   l   l       =       (   )       =   >       v   i   e   w       =   >       v   i   e   w   .   s   e   t   (   c   r   y   p   t   o   .   g   e   t   R   a   n   d   o   m   V   a   l   u   e   s   (   n   e   w       U   i   n   t   8   A   r   r   a   y   (   v   i   e   w   .   b   y   t   e   L   e   n   g   t   h   )   )   )   ;   
   
   v   a   r       r   a   n   d   o   m   F   i   l   l       =       v   i   e   w       =   >       {   
           /   /       L   a   z   i   l   y       i   n   i   t       o   n       t   h   e       f   i   r   s   t       i   n   v   o   c   a   t   i   o   n   .   
           (   r   a   n   d   o   m   F   i   l   l       =       i   n   i   t   R   a   n   d   o   m   F   i   l   l   (   )   )   (   v   i   e   w   )   ;   
   }   ;   
   
   v   a   r       _   r   a   n   d   o   m   _   g   e   t       =       (   b   u   f   f   e   r   ,       s   i   z   e   )       =   >       {   
           r   a   n   d   o   m   F   i   l   l   (   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   8   )   .   s   u   b   a   r   r   a   y   (   b   u   f   f   e   r   ,       b   u   f   f   e   r       +       s   i   z   e   )   )   ;   
           r   e   t   u   r   n       0   ;   
   }   ;   
   
   v   a   r       M   E   M   F   S       =       {   
           c   r   e   a   t   e   B   a   c   k   e   n   d   (   o   p   t   s   )       {   
                   r   e   t   u   r   n       _   w   a   s   m   f   s   _   c   r   e   a   t   e   _   m   e   m   o   r   y   _   b   a   c   k   e   n   d   (   )   ;   
           }   
   }   ;   
   
   v   a   r       P   A   T   H       =       {   
           i   s   A   b   s   :       p   a   t   h       =   >       p   a   t   h   .   c   h   a   r   A   t   (   0   )       =   =   =       "   /   "   ,   
           s   p   l   i   t   P   a   t   h   :       f   i   l   e   n   a   m   e       =   >       {   
                   v   a   r       s   p   l   i   t   P   a   t   h   R   e       =       /   ^   (   \   /   ?   |   )   (   [   \   s   \   S   ]   *   ?   )   (   (   ?   :   \   .   {   1   ,   2   }   |   [   ^   \   /   ]   +   ?   |   )   (   \   .   [   ^   .   \   /   ]   *   |   )   )   (   ?   :   [   \   /   ]   *   )   $   /   ;   
                   r   e   t   u   r   n       s   p   l   i   t   P   a   t   h   R   e   .   e   x   e   c   (   f   i   l   e   n   a   m   e   )   .   s   l   i   c   e   (   1   )   ;   
           }   ,   
           n   o   r   m   a   l   i   z   e   A   r   r   a   y   :       (   p   a   r   t   s   ,       a   l   l   o   w   A   b   o   v   e   R   o   o   t   )       =   >       {   
                   /   /       i   f       t   h   e       p   a   t   h       t   r   i   e   s       t   o       g   o       a   b   o   v   e       t   h   e       r   o   o   t   ,       `   u   p   `       e   n   d   s       u   p       >       0   
                   v   a   r       u   p       =       0   ;   
                   f   o   r       (   v   a   r       i       =       p   a   r   t   s   .   l   e   n   g   t   h       -       1   ;       i       >   =       0   ;       i   -   -   )       {   
                           v   a   r       l   a   s   t       =       p   a   r   t   s   [   i   ]   ;   
                           i   f       (   l   a   s   t       =   =   =       "   .   "   )       {   
                                   p   a   r   t   s   .   s   p   l   i   c   e   (   i   ,       1   )   ;   
                           }       e   l   s   e       i   f       (   l   a   s   t       =   =   =       "   .   .   "   )       {   
                                   p   a   r   t   s   .   s   p   l   i   c   e   (   i   ,       1   )   ;   
                                   u   p   +   +   ;   
                           }       e   l   s   e       i   f       (   u   p   )       {   
                                   p   a   r   t   s   .   s   p   l   i   c   e   (   i   ,       1   )   ;   
                                   u   p   -   -   ;   
                           }   
                   }   
                   /   /       i   f       t   h   e       p   a   t   h       i   s       a   l   l   o   w   e   d       t   o       g   o       a   b   o   v   e       t   h   e       r   o   o   t   ,       r   e   s   t   o   r   e       l   e   a   d   i   n   g       .   .   s   
                   i   f       (   a   l   l   o   w   A   b   o   v   e   R   o   o   t   )       {   
                           f   o   r       (   ;   u   p   ;       u   p   -   -   )       {   
                                   p   a   r   t   s   .   u   n   s   h   i   f   t   (   "   .   .   "   )   ;   
                           }   
                   }   
                   r   e   t   u   r   n       p   a   r   t   s   ;   
           }   ,   
           n   o   r   m   a   l   i   z   e   :       p   a   t   h       =   >       {   
                   v   a   r       i   s   A   b   s   o   l   u   t   e       =       P   A   T   H   .   i   s   A   b   s   (   p   a   t   h   )   ,       t   r   a   i   l   i   n   g   S   l   a   s   h       =       p   a   t   h   .   s   l   i   c   e   (   -   1   )       =   =   =       "   /   "   ;   
                   /   /       N   o   r   m   a   l   i   z   e       t   h   e       p   a   t   h   
                   p   a   t   h       =       P   A   T   H   .   n   o   r   m   a   l   i   z   e   A   r   r   a   y   (   p   a   t   h   .   s   p   l   i   t   (   "   /   "   )   .   f   i   l   t   e   r   (   p       =   >       !   !   p   )   ,       !   i   s   A   b   s   o   l   u   t   e   )   .   j   o   i   n   (   "   /   "   )   ;   
                   i   f       (   !   p   a   t   h       &   &       !   i   s   A   b   s   o   l   u   t   e   )       {   
                           p   a   t   h       =       "   .   "   ;   
                   }   
                   i   f       (   p   a   t   h       &   &       t   r   a   i   l   i   n   g   S   l   a   s   h   )       {   
                           p   a   t   h       +   =       "   /   "   ;   
                   }   
                   r   e   t   u   r   n       (   i   s   A   b   s   o   l   u   t   e       ?       "   /   "       :       "   "   )       +       p   a   t   h   ;   
           }   ,   
           d   i   r   n   a   m   e   :       p   a   t   h       =   >       {   
                   v   a   r       r   e   s   u   l   t       =       P   A   T   H   .   s   p   l   i   t   P   a   t   h   (   p   a   t   h   )   ,       r   o   o   t       =       r   e   s   u   l   t   [   0   ]   ,       d   i   r       =       r   e   s   u   l   t   [   1   ]   ;   
                   i   f       (   !   r   o   o   t       &   &       !   d   i   r   )       {   
                           /   /       N   o       d   i   r   n   a   m   e       w   h   a   t   s   o   e   v   e   r   
                           r   e   t   u   r   n       "   .   "   ;   
                   }   
                   i   f       (   d   i   r   )       {   
                           /   /       I   t       h   a   s       a       d   i   r   n   a   m   e   ,       s   t   r   i   p       t   r   a   i   l   i   n   g       s   l   a   s   h   
                           d   i   r       =       d   i   r   .   s   l   i   c   e   (   0   ,       -   1   )   ;   
                   }   
                   r   e   t   u   r   n       r   o   o   t       +       d   i   r   ;   
           }   ,   
           b   a   s   e   n   a   m   e   :       p   a   t   h       =   >       p   a   t   h       &   &       p   a   t   h   .   m   a   t   c   h   (   /   (   [   ^   \   /   ]   +   |   \   /   )   \   /   *   $   /   )   [   1   ]   ,   
           j   o   i   n   :       (   .   .   .   p   a   t   h   s   )       =   >       P   A   T   H   .   n   o   r   m   a   l   i   z   e   (   p   a   t   h   s   .   j   o   i   n   (   "   /   "   )   )   ,   
           j   o   i   n   2   :       (   l   ,       r   )       =   >       P   A   T   H   .   n   o   r   m   a   l   i   z   e   (   l       +       "   /   "       +       r   )   
   }   ;   
   
   v   a   r       s   t   r   i   n   g   T   o   U   T   F   8   O   n   S   t   a   c   k       =       s   t   r       =   >       {   
           v   a   r       s   i   z   e       =       l   e   n   g   t   h   B   y   t   e   s   U   T   F   8   (   s   t   r   )       +       1   ;   
           v   a   r       r   e   t       =       s   t   a   c   k   A   l   l   o   c   (   s   i   z   e   )   ;   
           s   t   r   i   n   g   T   o   U   T   F   8   (   s   t   r   ,       r   e   t   ,       s   i   z   e   )   ;   
           r   e   t   u   r   n       r   e   t   ;   
   }   ;   
   
   v   a   r       w   i   t   h   S   t   a   c   k   S   a   v   e       =       f       =   >       {   
           v   a   r       s   t   a   c   k       =       s   t   a   c   k   S   a   v   e   (   )   ;   
           v   a   r       r   e   t       =       f   (   )   ;   
           s   t   a   c   k   R   e   s   t   o   r   e   (   s   t   a   c   k   )   ;   
           r   e   t   u   r   n       r   e   t   ;   
   }   ;   
   
   v   a   r       F   S   _   m   k   n   o   d       =       (   p   a   t   h   ,       m   o   d   e   ,       d   e   v   )       =   >       F   S   .   h   a   n   d   l   e   E   r   r   o   r   (   w   i   t   h   S   t   a   c   k   S   a   v   e   (   (   )       =   >       {   
           v   a   r       p   a   t   h   B   u   f   f   e   r       =       s   t   r   i   n   g   T   o   U   T   F   8   O   n   S   t   a   c   k   (   p   a   t   h   )   ;   
           r   e   t   u   r   n       _   _   w   a   s   m   f   s   _   m   k   n   o   d   (   p   a   t   h   B   u   f   f   e   r   ,       m   o   d   e   ,       d   e   v   )   ;   
   }   )   )   ;   
   
   v   a   r       F   S   _   c   r   e   a   t   e       =       (   p   a   t   h   ,       m   o   d   e       =       4   3   8   )       =   >       {   
           m   o   d   e       &   =       4   0   9   5   ;   
           m   o   d   e       |   =       3   2   7   6   8   ;   
           r   e   t   u   r   n       F   S   _   m   k   n   o   d   (   p   a   t   h   ,       m   o   d   e   ,       0   )   ;   
   }   ;   
   
   v   a   r       F   S   _   w   r   i   t   e   F   i   l   e       =       (   p   a   t   h   ,       d   a   t   a   )       =   >       {   
           v   a   r       s   p       =       s   t   a   c   k   S   a   v   e   (   )   ;   
           v   a   r       p   a   t   h   B   u   f   f   e   r       =       s   t   r   i   n   g   T   o   U   T   F   8   O   n   S   t   a   c   k   (   p   a   t   h   )   ;   
           v   a   r       l   e   n       =       t   y   p   e   o   f       d   a   t   a       =   =       "   s   t   r   i   n   g   "       ?       l   e   n   g   t   h   B   y   t   e   s   U   T   F   8   (   d   a   t   a   )       +       1       :       d   a   t   a   .   l   e   n   g   t   h   ;   
           v   a   r       d   a   t   a   B   u   f   f   e   r       =       _   m   a   l   l   o   c   (   l   e   n   )   ;   
           a   s   s   e   r   t   (   d   a   t   a   B   u   f   f   e   r   )   ;   
           i   f       (   t   y   p   e   o   f       d   a   t   a       =   =       "   s   t   r   i   n   g   "   )       {   
                   l   e   n       =       s   t   r   i   n   g   T   o   U   T   F   8   (   d   a   t   a   ,       d   a   t   a   B   u   f   f   e   r   ,       l   e   n   )   ;   
           }       e   l   s   e       {   
                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   8   )   .   s   e   t   (   d   a   t   a   ,       d   a   t   a   B   u   f   f   e   r   )   ;   
           }   
           v   a   r       r   e   t       =       _   _   w   a   s   m   f   s   _   w   r   i   t   e   _   f   i   l   e   (   p   a   t   h   B   u   f   f   e   r   ,       d   a   t   a   B   u   f   f   e   r   ,       l   e   n   )   ;   
           _   f   r   e   e   (   d   a   t   a   B   u   f   f   e   r   )   ;   
           s   t   a   c   k   R   e   s   t   o   r   e   (   s   p   )   ;   
           r   e   t   u   r   n       r   e   t   ;   
   }   ;   
   
   v   a   r       F   S   _   c   r   e   a   t   e   D   a   t   a   F   i   l   e       =       (   p   a   r   e   n   t   ,       n   a   m   e   ,       f   i   l   e   D   a   t   a   ,       c   a   n   R   e   a   d   ,       c   a   n   W   r   i   t   e   ,       c   a   n   O   w   n   )       =   >       {   
           v   a   r       p   a   t   h   N   a   m   e       =       n   a   m   e       ?       p   a   r   e   n   t       +       "   /   "       +       n   a   m   e       :       p   a   r   e   n   t   ;   
           v   a   r       m   o   d   e       =       F   S   _   g   e   t   M   o   d   e   (   c   a   n   R   e   a   d   ,       c   a   n   W   r   i   t   e   )   ;   
           i   f       (   !   w   a   s   m   F   S   P   r   e   l   o   a   d   i   n   g   F   l   u   s   h   e   d   )       {   
                   /   /       W   a   s   m   F   S       c   o   d   e       i   n       t   h   e       w   a   s   m       i   s       n   o   t       r   e   a   d   y       t   o       b   e       c   a   l   l   e   d       y   e   t   .       C   a   c   h   e       t   h   e   
                   /   /       f   i   l   e   s       w   e       w   a   n   t       t   o       c   r   e   a   t   e       h   e   r   e       i   n       J   S   ,       a   n   d       W   a   s   m   F   S       w   i   l   l       r   e   a   d       t   h   e   m   
                   /   /       l   a   t   e   r   .   
                   w   a   s   m   F   S   P   r   e   l   o   a   d   e   d   F   i   l   e   s   .   p   u   s   h   (   {   
                           p   a   t   h   N   a   m   e   ,   
                           f   i   l   e   D   a   t   a   ,   
                           m   o   d   e   
                   }   )   ;   
           }       e   l   s   e       {   
                   /   /       W   a   s   m   F   S       i   s       a   l   r   e   a   d   y       r   u   n   n   i   n   g   ,       s   o       c   r   e   a   t   e       t   h   e       f   i   l   e       n   o   r   m   a   l   l   y   .   
                   F   S   _   c   r   e   a   t   e   (   p   a   t   h   N   a   m   e   ,       m   o   d   e   )   ;   
                   F   S   _   w   r   i   t   e   F   i   l   e   (   p   a   t   h   N   a   m   e   ,       f   i   l   e   D   a   t   a   )   ;   
           }   
   }   ;   
   
   v   a   r       a   s   y   n   c   L   o   a   d       =       a   s   y   n   c       u   r   l       =   >       {   
           v   a   r       a   r   r   a   y   B   u   f   f   e   r       =       a   w   a   i   t       r   e   a   d   A   s   y   n   c   (   u   r   l   )   ;   
           a   s   s   e   r   t   (   a   r   r   a   y   B   u   f   f   e   r   ,       `   L   o   a   d   i   n   g       d   a   t   a       f   i   l   e       "   $   {   u   r   l   }   "       f   a   i   l   e   d       (   n   o       a   r   r   a   y   B   u   f   f   e   r   )   .   `   )   ;   
           r   e   t   u   r   n       n   e   w       U   i   n   t   8   A   r   r   a   y   (   a   r   r   a   y   B   u   f   f   e   r   )   ;   
   }   ;   
   
   v   a   r       P   A   T   H   _   F   S       =       {   
           r   e   s   o   l   v   e   :       (   .   .   .   a   r   g   s   )       =   >       {   
                   v   a   r       r   e   s   o   l   v   e   d   P   a   t   h       =       "   "   ,       r   e   s   o   l   v   e   d   A   b   s   o   l   u   t   e       =       f   a   l   s   e   ;   
                   f   o   r       (   v   a   r       i       =       a   r   g   s   .   l   e   n   g   t   h       -       1   ;       i       >   =       -   1       &   &       !   r   e   s   o   l   v   e   d   A   b   s   o   l   u   t   e   ;       i   -   -   )       {   
                           v   a   r       p   a   t   h       =       (   i       >   =       0   )       ?       a   r   g   s   [   i   ]       :       F   S   .   c   w   d   (   )   ;   
                           /   /       S   k   i   p       e   m   p   t   y       a   n   d       i   n   v   a   l   i   d       e   n   t   r   i   e   s   
                           i   f       (   t   y   p   e   o   f       p   a   t   h       !   =       "   s   t   r   i   n   g   "   )       {   
                                   t   h   r   o   w       n   e   w       T   y   p   e   E   r   r   o   r   (   "   A   r   g   u   m   e   n   t   s       t   o       p   a   t   h   .   r   e   s   o   l   v   e       m   u   s   t       b   e       s   t   r   i   n   g   s   "   )   ;   
                           }       e   l   s   e       i   f       (   !   p   a   t   h   )       {   
                                   r   e   t   u   r   n       "   "   ;   
                           }   
                           r   e   s   o   l   v   e   d   P   a   t   h       =       p   a   t   h       +       "   /   "       +       r   e   s   o   l   v   e   d   P   a   t   h   ;   
                           r   e   s   o   l   v   e   d   A   b   s   o   l   u   t   e       =       P   A   T   H   .   i   s   A   b   s   (   p   a   t   h   )   ;   
                   }   
                   /   /       A   t       t   h   i   s       p   o   i   n   t       t   h   e       p   a   t   h       s   h   o   u   l   d       b   e       r   e   s   o   l   v   e   d       t   o       a       f   u   l   l       a   b   s   o   l   u   t   e       p   a   t   h   ,       b   u   t   
                   /   /       h   a   n   d   l   e       r   e   l   a   t   i   v   e       p   a   t   h   s       t   o       b   e       s   a   f   e       (   m   i   g   h   t       h   a   p   p   e   n       w   h   e   n       p   r   o   c   e   s   s   .   c   w   d   (   )       f   a   i   l   s   )   
                   r   e   s   o   l   v   e   d   P   a   t   h       =       P   A   T   H   .   n   o   r   m   a   l   i   z   e   A   r   r   a   y   (   r   e   s   o   l   v   e   d   P   a   t   h   .   s   p   l   i   t   (   "   /   "   )   .   f   i   l   t   e   r   (   p       =   >       !   !   p   )   ,       !   r   e   s   o   l   v   e   d   A   b   s   o   l   u   t   e   )   .   j   o   i   n   (   "   /   "   )   ;   
                   r   e   t   u   r   n       (   (   r   e   s   o   l   v   e   d   A   b   s   o   l   u   t   e       ?       "   /   "       :       "   "   )       +       r   e   s   o   l   v   e   d   P   a   t   h   )       |   |       "   .   "   ;   
           }   ,   
           r   e   l   a   t   i   v   e   :       (   f   r   o   m   ,       t   o   )       =   >       {   
                   f   r   o   m       =       P   A   T   H   _   F   S   .   r   e   s   o   l   v   e   (   f   r   o   m   )   .   s   l   i   c   e   (   1   )   ;   
                   t   o       =       P   A   T   H   _   F   S   .   r   e   s   o   l   v   e   (   t   o   )   .   s   l   i   c   e   (   1   )   ;   
                   f   u   n   c   t   i   o   n       t   r   i   m   (   a   r   r   )       {   
                           v   a   r       s   t   a   r   t       =       0   ;   
                           f   o   r       (   ;   s   t   a   r   t       <       a   r   r   .   l   e   n   g   t   h   ;       s   t   a   r   t   +   +   )       {   
                                   i   f       (   a   r   r   [   s   t   a   r   t   ]       !   =   =       "   "   )       b   r   e   a   k   ;   
                           }   
                           v   a   r       e   n   d       =       a   r   r   .   l   e   n   g   t   h       -       1   ;   
                           f   o   r       (   ;   e   n   d       >   =       0   ;       e   n   d   -   -   )       {   
                                   i   f       (   a   r   r   [   e   n   d   ]       !   =   =       "   "   )       b   r   e   a   k   ;   
                           }   
                           i   f       (   s   t   a   r   t       >       e   n   d   )       r   e   t   u   r   n       [   ]   ;   
                           r   e   t   u   r   n       a   r   r   .   s   l   i   c   e   (   s   t   a   r   t   ,       e   n   d       -       s   t   a   r   t       +       1   )   ;   
                   }   
                   v   a   r       f   r   o   m   P   a   r   t   s       =       t   r   i   m   (   f   r   o   m   .   s   p   l   i   t   (   "   /   "   )   )   ;   
                   v   a   r       t   o   P   a   r   t   s       =       t   r   i   m   (   t   o   .   s   p   l   i   t   (   "   /   "   )   )   ;   
                   v   a   r       l   e   n   g   t   h       =       M   a   t   h   .   m   i   n   (   f   r   o   m   P   a   r   t   s   .   l   e   n   g   t   h   ,       t   o   P   a   r   t   s   .   l   e   n   g   t   h   )   ;   
                   v   a   r       s   a   m   e   P   a   r   t   s   L   e   n   g   t   h       =       l   e   n   g   t   h   ;   
                   f   o   r       (   v   a   r       i       =       0   ;       i       <       l   e   n   g   t   h   ;       i   +   +   )       {   
                           i   f       (   f   r   o   m   P   a   r   t   s   [   i   ]       !   =   =       t   o   P   a   r   t   s   [   i   ]   )       {   
                                   s   a   m   e   P   a   r   t   s   L   e   n   g   t   h       =       i   ;   
                                   b   r   e   a   k   ;   
                           }   
                   }   
                   v   a   r       o   u   t   p   u   t   P   a   r   t   s       =       [   ]   ;   
                   f   o   r       (   v   a   r       i       =       s   a   m   e   P   a   r   t   s   L   e   n   g   t   h   ;       i       <       f   r   o   m   P   a   r   t   s   .   l   e   n   g   t   h   ;       i   +   +   )       {   
                           o   u   t   p   u   t   P   a   r   t   s   .   p   u   s   h   (   "   .   .   "   )   ;   
                   }   
                   o   u   t   p   u   t   P   a   r   t   s       =       o   u   t   p   u   t   P   a   r   t   s   .   c   o   n   c   a   t   (   t   o   P   a   r   t   s   .   s   l   i   c   e   (   s   a   m   e   P   a   r   t   s   L   e   n   g   t   h   )   )   ;   
                   r   e   t   u   r   n       o   u   t   p   u   t   P   a   r   t   s   .   j   o   i   n   (   "   /   "   )   ;   
           }   
   }   ;   
   
   v   a   r       g   e   t   U   n   i   q   u   e   R   u   n   D   e   p   e   n   d   e   n   c   y       =       i   d       =   >       {   
           v   a   r       o   r   i   g       =       i   d   ;   
           w   h   i   l   e       (   1   )       {   
                   i   f       (   !   r   u   n   D   e   p   e   n   d   e   n   c   y   T   r   a   c   k   i   n   g   [   i   d   ]   )       r   e   t   u   r   n       i   d   ;   
                   i   d       =       o   r   i   g       +       M   a   t   h   .   r   a   n   d   o   m   (   )   ;   
           }   
   }   ;   
   
   v   a   r       F   S   _   h   a   n   d   l   e   d   B   y   P   r   e   l   o   a   d   P   l   u   g   i   n       =       (   b   y   t   e   A   r   r   a   y   ,       f   u   l   l   n   a   m   e   ,       f   i   n   i   s   h   ,       o   n   e   r   r   o   r   )       =   >       {   
           /   /       E   n   s   u   r   e       p   l   u   g   i   n   s       a   r   e       r   e   a   d   y   .   
           i   f       (   t   y   p   e   o   f       B   r   o   w   s   e   r       !   =       "   u   n   d   e   f   i   n   e   d   "   )       B   r   o   w   s   e   r   .   i   n   i   t   (   )   ;   
           v   a   r       h   a   n   d   l   e   d       =       f   a   l   s   e   ;   
           p   r   e   l   o   a   d   P   l   u   g   i   n   s   .   f   o   r   E   a   c   h   (   p   l   u   g   i   n       =   >       {   
                   i   f       (   h   a   n   d   l   e   d   )       r   e   t   u   r   n   ;   
                   i   f       (   p   l   u   g   i   n   [   "   c   a   n   H   a   n   d   l   e   "   ]   (   f   u   l   l   n   a   m   e   )   )       {   
                           p   l   u   g   i   n   [   "   h   a   n   d   l   e   "   ]   (   b   y   t   e   A   r   r   a   y   ,       f   u   l   l   n   a   m   e   ,       f   i   n   i   s   h   ,       o   n   e   r   r   o   r   )   ;   
                           h   a   n   d   l   e   d       =       t   r   u   e   ;   
                   }   
           }   )   ;   
           r   e   t   u   r   n       h   a   n   d   l   e   d   ;   
   }   ;   
   
   v   a   r       F   S   _   c   r   e   a   t   e   P   r   e   l   o   a   d   e   d   F   i   l   e       =       (   p   a   r   e   n   t   ,       n   a   m   e   ,       u   r   l   ,       c   a   n   R   e   a   d   ,       c   a   n   W   r   i   t   e   ,       o   n   l   o   a   d   ,       o   n   e   r   r   o   r   ,       d   o   n   t   C   r   e   a   t   e   F   i   l   e   ,       c   a   n   O   w   n   ,       p   r   e   F   i   n   i   s   h   )       =   >       {   
           /   /       T   O   D   O       w   e       s   h   o   u   l   d       a   l   l   o   w       p   e   o   p   l   e       t   o       j   u   s   t       p   a   s   s       i   n       a       c   o   m   p   l   e   t   e       f   i   l   e   n   a   m   e       i   n   s   t   e   a   d   
           /   /       o   f       p   a   r   e   n   t       a   n   d       n   a   m   e       b   e   i   n   g       t   h   a   t       w   e       j   u   s   t       j   o   i   n       t   h   e   m       a   n   y   w   a   y   s   
           v   a   r       f   u   l   l   n   a   m   e       =       n   a   m   e       ?       P   A   T   H   _   F   S   .   r   e   s   o   l   v   e   (   P   A   T   H   .   j   o   i   n   2   (   p   a   r   e   n   t   ,       n   a   m   e   )   )       :       p   a   r   e   n   t   ;   
           v   a   r       d   e   p       =       g   e   t   U   n   i   q   u   e   R   u   n   D   e   p   e   n   d   e   n   c   y   (   `   c   p       $   {   f   u   l   l   n   a   m   e   }   `   )   ;   
           /   /       m   i   g   h   t       h   a   v   e       s   e   v   e   r   a   l       a   c   t   i   v   e       r   e   q   u   e   s   t   s       f   o   r       t   h   e       s   a   m   e       f   u   l   l   n   a   m   e   
           f   u   n   c   t   i   o   n       p   r   o   c   e   s   s   D   a   t   a   (   b   y   t   e   A   r   r   a   y   )       {   
                   f   u   n   c   t   i   o   n       f   i   n   i   s   h   (   b   y   t   e   A   r   r   a   y   )       {   
                           p   r   e   F   i   n   i   s   h   ?   .   (   )   ;   
                           i   f       (   !   d   o   n   t   C   r   e   a   t   e   F   i   l   e   )       {   
                                   F   S   _   c   r   e   a   t   e   D   a   t   a   F   i   l   e   (   p   a   r   e   n   t   ,       n   a   m   e   ,       b   y   t   e   A   r   r   a   y   ,       c   a   n   R   e   a   d   ,       c   a   n   W   r   i   t   e   ,       c   a   n   O   w   n   )   ;   
                           }   
                           o   n   l   o   a   d   ?   .   (   )   ;   
                           r   e   m   o   v   e   R   u   n   D   e   p   e   n   d   e   n   c   y   (   d   e   p   )   ;   
                   }   
                   i   f       (   F   S   _   h   a   n   d   l   e   d   B   y   P   r   e   l   o   a   d   P   l   u   g   i   n   (   b   y   t   e   A   r   r   a   y   ,       f   u   l   l   n   a   m   e   ,       f   i   n   i   s   h   ,       (   )       =   >       {   
                           o   n   e   r   r   o   r   ?   .   (   )   ;   
                           r   e   m   o   v   e   R   u   n   D   e   p   e   n   d   e   n   c   y   (   d   e   p   )   ;   
                   }   )   )       {   
                           r   e   t   u   r   n   ;   
                   }   
                   f   i   n   i   s   h   (   b   y   t   e   A   r   r   a   y   )   ;   
           }   
           a   d   d   R   u   n   D   e   p   e   n   d   e   n   c   y   (   d   e   p   )   ;   
           i   f       (   t   y   p   e   o   f       u   r   l       =   =       "   s   t   r   i   n   g   "   )       {   
                   a   s   y   n   c   L   o   a   d   (   u   r   l   )   .   t   h   e   n   (   p   r   o   c   e   s   s   D   a   t   a   ,       o   n   e   r   r   o   r   )   ;   
           }       e   l   s   e       {   
                   p   r   o   c   e   s   s   D   a   t   a   (   u   r   l   )   ;   
           }   
   }   ;   
   
   v   a   r       F   S   _   g   e   t   M   o   d   e       =       (   c   a   n   R   e   a   d   ,       c   a   n   W   r   i   t   e   )       =   >       {   
           v   a   r       m   o   d   e       =       0   ;   
           i   f       (   c   a   n   R   e   a   d   )       m   o   d   e       |   =       2   9   2       |       7   3   ;   
           i   f       (   c   a   n   W   r   i   t   e   )       m   o   d   e       |   =       1   4   6   ;   
           r   e   t   u   r   n       m   o   d   e   ;   
   }   ;   
   
   v   a   r       F   S   _   m   o   d   e   S   t   r   i   n   g   T   o   F   l   a   g   s       =       s   t   r       =   >       {   
           v   a   r       f   l   a   g   M   o   d   e   s       =       {   
                   "   r   "   :       0   ,   
                   "   r   +   "   :       2   ,   
                   "   w   "   :       5   1   2       |       6   4       |       1   ,   
                   "   w   +   "   :       5   1   2       |       6   4       |       2   ,   
                   "   a   "   :       1   0   2   4       |       6   4       |       1   ,   
                   "   a   +   "   :       1   0   2   4       |       6   4       |       2   
           }   ;   
           v   a   r       f   l   a   g   s       =       f   l   a   g   M   o   d   e   s   [   s   t   r   ]   ;   
           i   f       (   t   y   p   e   o   f       f   l   a   g   s       =   =       "   u   n   d   e   f   i   n   e   d   "   )       {   
                   t   h   r   o   w       n   e   w       E   r   r   o   r   (   `   U   n   k   n   o   w   n       f   i   l   e       o   p   e   n       m   o   d   e   :       $   {   s   t   r   }   `   )   ;   
           }   
           r   e   t   u   r   n       f   l   a   g   s   ;   
   }   ;   
   
   v   a   r       F   S   _   m   k   d   i   r       =       (   p   a   t   h   ,       m   o   d   e       =       5   1   1   )       =   >       F   S   .   h   a   n   d   l   e   E   r   r   o   r   (   w   i   t   h   S   t   a   c   k   S   a   v   e   (   (   )       =   >       {   
           v   a   r       b   u   f   f   e   r       =       s   t   r   i   n   g   T   o   U   T   F   8   O   n   S   t   a   c   k   (   p   a   t   h   )   ;   
           r   e   t   u   r   n       _   _   w   a   s   m   f   s   _   m   k   d   i   r   (   b   u   f   f   e   r   ,       m   o   d   e   )   ;   
   }   )   )   ;   
   
   /   *   *   
                       *       @   p   a   r   a   m       {   n   u   m   b   e   r   =   }       m   o   d   e       O   p   t   i   o   n   a   l   l   y   ,       t   h   e       m   o   d   e       t   o       c   r   e   a   t   e       i   n   .       U   s   e   s       m   k   d   i   r   '   s   
                       *                                                                                               d   e   f   a   u   l   t       i   f       n   o   t       s   e   t   .   
                       *   /       v   a   r       F   S   _   m   k   d   i   r   T   r   e   e       =       (   p   a   t   h   ,       m   o   d   e   )       =   >       {   
           v   a   r       d   i   r   s       =       p   a   t   h   .   s   p   l   i   t   (   "   /   "   )   ;   
           v   a   r       d       =       "   "   ;   
           f   o   r       (   v   a   r       d   i   r       o   f       d   i   r   s   )       {   
                   i   f       (   !   d   i   r   )       c   o   n   t   i   n   u   e   ;   
                   i   f       (   d       |   |       P   A   T   H   .   i   s   A   b   s   (   p   a   t   h   )   )       d       +   =       "   /   "   ;   
                   d       +   =       d   i   r   ;   
                   t   r   y       {   
                           F   S   _   m   k   d   i   r   (   d   ,       m   o   d   e   )   ;   
                   }       c   a   t   c   h       (   e   )       {   
                           i   f       (   e   .   e   r   r   n   o       !   =       2   0   )       t   h   r   o   w       e   ;   
                   }   
           }   
   }   ;   
   
   v   a   r       F   S   _   u   n   l   i   n   k       =       p   a   t   h       =   >       w   i   t   h   S   t   a   c   k   S   a   v   e   (   (   )       =   >       {   
           v   a   r       b   u   f   f   e   r       =       s   t   r   i   n   g   T   o   U   T   F   8   O   n   S   t   a   c   k   (   p   a   t   h   )   ;   
           r   e   t   u   r   n       _   _   w   a   s   m   f   s   _   u   n   l   i   n   k   (   b   u   f   f   e   r   )   ;   
   }   )   ;   
   
   v   a   r       w   a   s   m   F   S   $   b   a   c   k   e   n   d   s       =       {   }   ;   
   
   v   a   r       w   a   s   m   F   S   D   e   v   i   c   e   s       =       {   }   ;   
   
   v   a   r       w   a   s   m   F   S   D   e   v   i   c   e   S   t   r   e   a   m   s       =       {   }   ;   
   
   v   a   r       F   S       =       {   
           E   r   r   n   o   E   r   r   o   r   :       c   l   a   s   s       e   x   t   e   n   d   s       E   r   r   o   r       {   
                   n   a   m   e   =   "   E   r   r   n   o   E   r   r   o   r   "   ;   
                   m   e   s   s   a   g   e   =   "   F   S       e   r   r   o   r   "   ;   
                   c   o   n   s   t   r   u   c   t   o   r   (   c   o   d   e   )       {   
                           s   u   p   e   r   (   )   ;   
                           t   h   i   s   .   e   r   r   n   o       =       c   o   d   e   ;   
                   }   
           }   ,   
           h   a   n   d   l   e   E   r   r   o   r   (   r   e   t   u   r   n   V   a   l   u   e   )       {   
                   /   /       A   s   s   u   m   e       e   r   r   o   r   s       c   o   r   r   e   s   p   o   n   d       t   o       n   e   g   a   t   i   v   e       r   e   t   u   r   n   V   a   l   u   e   s   
                   /   /       s   i   n   c   e       s   o   m   e       f   u   n   c   t   i   o   n   s       l   i   k   e       _   w   a   s   m   f   s   _   o   p   e   n   (   )       r   e   t   u   r   n       p   o   s   i   t   i   v   e   
                   /   /       n   u   m   b   e   r   s       o   n       s   u   c   c   e   s   s       (   s   o   m   e       c   a   l   l   e   r   s       o   f       t   h   i   s       f   u   n   c   t   i   o   n       m   a   y       n   e   e   d       t   o       n   e   g   a   t   e       t   h   e       p   a   r   a   m   e   t   e   r   )   .   
                   i   f       (   r   e   t   u   r   n   V   a   l   u   e       <       0   )       {   
                           t   h   r   o   w       n   e   w       F   S   .   E   r   r   n   o   E   r   r   o   r   (   -   r   e   t   u   r   n   V   a   l   u   e   )   ;   
                   }   
                   r   e   t   u   r   n       r   e   t   u   r   n   V   a   l   u   e   ;   
           }   ,   
           c   r   e   a   t   e   D   a   t   a   F   i   l   e   (   p   a   r   e   n   t   ,       n   a   m   e   ,       f   i   l   e   D   a   t   a   ,       c   a   n   R   e   a   d   ,       c   a   n   W   r   i   t   e   ,       c   a   n   O   w   n   )       {   
                   F   S   _   c   r   e   a   t   e   D   a   t   a   F   i   l   e   (   p   a   r   e   n   t   ,       n   a   m   e   ,       f   i   l   e   D   a   t   a   ,       c   a   n   R   e   a   d   ,       c   a   n   W   r   i   t   e   ,       c   a   n   O   w   n   )   ;   
           }   ,   
           c   r   e   a   t   e   P   a   t   h   (   p   a   r   e   n   t   ,       p   a   t   h   ,       c   a   n   R   e   a   d   ,       c   a   n   W   r   i   t   e   )       {   
                   /   /       C   a   c   h   e       f   i   l   e       p   a   t   h       d   i   r   e   c   t   o   r   y       n   a   m   e   s   .   
                   v   a   r       p   a   r   t   s       =       p   a   t   h   .   s   p   l   i   t   (   "   /   "   )   .   r   e   v   e   r   s   e   (   )   ;   
                   w   h   i   l   e       (   p   a   r   t   s   .   l   e   n   g   t   h   )       {   
                           v   a   r       p   a   r   t       =       p   a   r   t   s   .   p   o   p   (   )   ;   
                           i   f       (   !   p   a   r   t   )       c   o   n   t   i   n   u   e   ;   
                           v   a   r       c   u   r   r   e   n   t       =       P   A   T   H   .   j   o   i   n   2   (   p   a   r   e   n   t   ,       p   a   r   t   )   ;   
                           i   f       (   !   w   a   s   m   F   S   P   r   e   l   o   a   d   i   n   g   F   l   u   s   h   e   d   )       {   
                                   w   a   s   m   F   S   P   r   e   l   o   a   d   e   d   D   i   r   s   .   p   u   s   h   (   {   
                                           p   a   r   e   n   t   P   a   t   h   :       p   a   r   e   n   t   ,   
                                           c   h   i   l   d   N   a   m   e   :       p   a   r   t   
                                   }   )   ;   
                           }       e   l   s   e       {   
                                   t   r   y       {   
                                           F   S   .   m   k   d   i   r   (   c   u   r   r   e   n   t   )   ;   
                                   }       c   a   t   c   h       (   e   )       {   
                                           i   f       (   e   .   e   r   r   n   o       !   =       2   0   )       t   h   r   o   w       e   ;   
                                   }   
                           }   
                           p   a   r   e   n   t       =       c   u   r   r   e   n   t   ;   
                   }   
                   r   e   t   u   r   n       c   u   r   r   e   n   t   ;   
           }   ,   
           c   r   e   a   t   e   P   r   e   l   o   a   d   e   d   F   i   l   e   (   p   a   r   e   n   t   ,       n   a   m   e   ,       u   r   l   ,       c   a   n   R   e   a   d   ,       c   a   n   W   r   i   t   e   ,       o   n   l   o   a   d   ,       o   n   e   r   r   o   r   ,       d   o   n   t   C   r   e   a   t   e   F   i   l   e   ,       c   a   n   O   w   n   ,       p   r   e   F   i   n   i   s   h   )       {   
                   r   e   t   u   r   n       F   S   _   c   r   e   a   t   e   P   r   e   l   o   a   d   e   d   F   i   l   e   (   p   a   r   e   n   t   ,       n   a   m   e   ,       u   r   l   ,       c   a   n   R   e   a   d   ,       c   a   n   W   r   i   t   e   ,       o   n   l   o   a   d   ,       o   n   e   r   r   o   r   ,       d   o   n   t   C   r   e   a   t   e   F   i   l   e   ,       c   a   n   O   w   n   ,       p   r   e   F   i   n   i   s   h   )   ;   
           }   ,   
           r   e   a   d   F   i   l   e   (   p   a   t   h   ,       o   p   t   s       =       {   }   )       {   
                   o   p   t   s   .   e   n   c   o   d   i   n   g       =       o   p   t   s   .   e   n   c   o   d   i   n   g       |   |       "   b   i   n   a   r   y   "   ;   
                   i   f       (   o   p   t   s   .   e   n   c   o   d   i   n   g       !   =   =       "   u   t   f   8   "       &   &       o   p   t   s   .   e   n   c   o   d   i   n   g       !   =   =       "   b   i   n   a   r   y   "   )       {   
                           t   h   r   o   w       n   e   w       E   r   r   o   r   (   `   I   n   v   a   l   i   d       e   n   c   o   d   i   n   g       t   y   p   e       "   $   {   o   p   t   s   .   e   n   c   o   d   i   n   g   }   "   `   )   ;   
                   }   
                   v   a   r       b   u   f   ,       l   e   n   g   t   h   ;   
                   /   /       C   o   p   y       t   h   e       f   i   l   e       i   n   t   o       a       J   S       b   u   f   f   e   r       o   n       t   h   e       h   e   a   p   .   
                   w   i   t   h   S   t   a   c   k   S   a   v   e   (   (   )       =   >       {   
                           v   a   r       b   u   f   P   t   r       =       s   t   a   c   k   A   l   l   o   c   (   4   )   ;   
                           v   a   r       s   i   z   e   P   t   r       =       s   t   a   c   k   A   l   l   o   c   (   4   )   ;   
                           F   S   .   h   a   n   d   l   e   E   r   r   o   r   (   -   _   _   w   a   s   m   f   s   _   r   e   a   d   _   f   i   l   e   (   s   t   r   i   n   g   T   o   U   T   F   8   O   n   S   t   a   c   k   (   p   a   t   h   )   ,       b   u   f   P   t   r   ,       s   i   z   e   P   t   r   )   )   ;   
                           b   u   f       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   b   u   f   P   t   r   )       >   >       2   )   ]   ;   
                           l   e   n   g   t   h       =       r   e   a   d   I   5   3   F   r   o   m   I   6   4   (   s   i   z   e   P   t   r   )   ;   
                   }   )   ;   
                   /   /       D   e   f   a   u   l   t       r   e   t   u   r   n       t   y   p   e       i   s       b   i   n   a   r   y   .   
                   /   /       T   h   e       b   u   f   f   e   r       c   o   n   t   e   n   t   s       e   x   i   s   t       8       b   y   t   e   s       a   f   t   e   r       t   h   e       r   e   t   u   r   n   e   d       p   o   i   n   t   e   r   .   
                   r   e   t   u   r   n       o   p   t   s   .   e   n   c   o   d   i   n   g       =   =   =       "   u   t   f   8   "       ?       U   T   F   8   T   o   S   t   r   i   n   g   (   b   u   f   ,       l   e   n   g   t   h   )       :       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   8   )   .   s   l   i   c   e   (   b   u   f   ,       b   u   f       +       l   e   n   g   t   h   )   ;   
           }   ,   
           c   w   d   :       (   )       =   >       U   T   F   8   T   o   S   t   r   i   n   g   (   _   _   w   a   s   m   f   s   _   g   e   t   _   c   w   d   (   )   )   ,   
           a   n   a   l   y   z   e   P   a   t   h   (   p   a   t   h   )       {   
                   /   /       T   O   D   O   :       C   o   n   s   i   d   e   r       s   i   m   p   l   i   f   y   i   n   g       t   h   i   s       A   P   I   ,       w   h   i   c   h       f   o   r       n   o   w       m   a   t   c   h   e   s       t   h   e       J   S       F   S   .   
                   v   a   r       e   x   i   s   t   s       =       !   !   F   S   .   f   i   n   d   O   b   j   e   c   t   (   p   a   t   h   )   ;   
                   r   e   t   u   r   n       {   
                           e   x   i   s   t   s   ,   
                           o   b   j   e   c   t   :       {   
                                   c   o   n   t   e   n   t   s   :       e   x   i   s   t   s       ?       F   S   .   r   e   a   d   F   i   l   e   (   p   a   t   h   )       :       n   u   l   l   
                           }   
                   }   ;   
           }   ,   
           m   k   d   i   r   :       (   p   a   t   h   ,       m   o   d   e   )       =   >       F   S   _   m   k   d   i   r   (   p   a   t   h   ,       m   o   d   e   )   ,   
           m   k   d   i   r   T   r   e   e   :       (   p   a   t   h   ,       m   o   d   e   )       =   >       F   S   _   m   k   d   i   r   T   r   e   e   (   p   a   t   h   ,       m   o   d   e   )   ,   
           r   m   d   i   r   :       p   a   t   h       =   >       F   S   .   h   a   n   d   l   e   E   r   r   o   r   (   w   i   t   h   S   t   a   c   k   S   a   v   e   (   (   )       =   >       _   _   w   a   s   m   f   s   _   r   m   d   i   r   (   s   t   r   i   n   g   T   o   U   T   F   8   O   n   S   t   a   c   k   (   p   a   t   h   )   )   )   )   ,   
           o   p   e   n   :       (   p   a   t   h   ,       f   l   a   g   s   ,       m   o   d   e       =       4   3   8   )       =   >       w   i   t   h   S   t   a   c   k   S   a   v   e   (   (   )       =   >       {   
                   f   l   a   g   s       =       t   y   p   e   o   f       f   l   a   g   s       =   =       "   s   t   r   i   n   g   "       ?       F   S   _   m   o   d   e   S   t   r   i   n   g   T   o   F   l   a   g   s   (   f   l   a   g   s   )       :       f   l   a   g   s   ;   
                   v   a   r       b   u   f   f   e   r       =       s   t   r   i   n   g   T   o   U   T   F   8   O   n   S   t   a   c   k   (   p   a   t   h   )   ;   
                   v   a   r       f   d       =       F   S   .   h   a   n   d   l   e   E   r   r   o   r   (   _   _   w   a   s   m   f   s   _   o   p   e   n   (   b   u   f   f   e   r   ,       f   l   a   g   s   ,       m   o   d   e   )   )   ;   
                   r   e   t   u   r   n       {   
                           f   d   
                   }   ;   
           }   )   ,   
           c   r   e   a   t   e   :       (   p   a   t   h   ,       m   o   d   e   )       =   >       F   S   _   c   r   e   a   t   e   (   p   a   t   h   ,       m   o   d   e   )   ,   
           c   l   o   s   e   :       s   t   r   e   a   m       =   >       F   S   .   h   a   n   d   l   e   E   r   r   o   r   (   -   _   _   w   a   s   m   f   s   _   c   l   o   s   e   (   s   t   r   e   a   m   .   f   d   )   )   ,   
           u   n   l   i   n   k   :       p   a   t   h       =   >       F   S   _   u   n   l   i   n   k   (   p   a   t   h   )   ,   
           c   h   d   i   r   :       p   a   t   h       =   >       w   i   t   h   S   t   a   c   k   S   a   v   e   (   (   )       =   >       _   _   w   a   s   m   f   s   _   c   h   d   i   r   (   s   t   r   i   n   g   T   o   U   T   F   8   O   n   S   t   a   c   k   (   p   a   t   h   )   )   )   ,   
           r   e   a   d   (   s   t   r   e   a   m   ,       b   u   f   f   e   r   ,       o   f   f   s   e   t   ,       l   e   n   g   t   h   ,       p   o   s   i   t   i   o   n   )       {   
                   v   a   r       s   e   e   k   i   n   g       =       t   y   p   e   o   f       p   o   s   i   t   i   o   n       !   =       "   u   n   d   e   f   i   n   e   d   "   ;   
                   v   a   r       d   a   t   a   B   u   f   f   e   r       =       _   m   a   l   l   o   c   (   l   e   n   g   t   h   )   ;   
                   v   a   r       b   y   t   e   s   R   e   a   d   ;   
                   i   f       (   s   e   e   k   i   n   g   )       {   
                           b   y   t   e   s   R   e   a   d       =       _   _   w   a   s   m   f   s   _   p   r   e   a   d   (   s   t   r   e   a   m   .   f   d   ,       d   a   t   a   B   u   f   f   e   r   ,       l   e   n   g   t   h   ,       B   i   g   I   n   t   (   p   o   s   i   t   i   o   n   )   )   ;   
                   }       e   l   s   e       {   
                           b   y   t   e   s   R   e   a   d       =       _   _   w   a   s   m   f   s   _   r   e   a   d   (   s   t   r   e   a   m   .   f   d   ,       d   a   t   a   B   u   f   f   e   r   ,       l   e   n   g   t   h   )   ;   
                   }   
                   i   f       (   b   y   t   e   s   R   e   a   d       >       0   )       {   
                           b   u   f   f   e   r   .   s   e   t   (   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   8   )   .   s   u   b   a   r   r   a   y   (   d   a   t   a   B   u   f   f   e   r   ,       d   a   t   a   B   u   f   f   e   r       +       b   y   t   e   s   R   e   a   d   )   ,       o   f   f   s   e   t   )   ;   
                   }   
                   _   f   r   e   e   (   d   a   t   a   B   u   f   f   e   r   )   ;   
                   r   e   t   u   r   n       F   S   .   h   a   n   d   l   e   E   r   r   o   r   (   b   y   t   e   s   R   e   a   d   )   ;   
           }   ,   
           w   r   i   t   e   (   s   t   r   e   a   m   ,       b   u   f   f   e   r   ,       o   f   f   s   e   t   ,       l   e   n   g   t   h   ,       p   o   s   i   t   i   o   n   ,       c   a   n   O   w   n   )       {   
                   v   a   r       s   e   e   k   i   n   g       =       t   y   p   e   o   f       p   o   s   i   t   i   o   n       !   =       "   u   n   d   e   f   i   n   e   d   "   ;   
                   v   a   r       d   a   t   a   B   u   f   f   e   r       =       _   m   a   l   l   o   c   (   l   e   n   g   t   h   )   ;   
                   f   o   r       (   v   a   r       i       =       0   ;       i       <       l   e   n   g   t   h   ;       i   +   +   )       {   
                           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   8   )   [   (   d   a   t   a   B   u   f   f   e   r   )       +       (   i   )   ]       =       b   u   f   f   e   r   [   o   f   f   s   e   t       +       i   ]   ;   
                   }   
                   v   a   r       b   y   t   e   s   R   e   a   d   ;   
                   i   f       (   s   e   e   k   i   n   g   )       {   
                           b   y   t   e   s   R   e   a   d       =       _   _   w   a   s   m   f   s   _   p   w   r   i   t   e   (   s   t   r   e   a   m   .   f   d   ,       d   a   t   a   B   u   f   f   e   r   ,       l   e   n   g   t   h   ,       B   i   g   I   n   t   (   p   o   s   i   t   i   o   n   )   )   ;   
                   }       e   l   s   e       {   
                           b   y   t   e   s   R   e   a   d       =       _   _   w   a   s   m   f   s   _   w   r   i   t   e   (   s   t   r   e   a   m   .   f   d   ,       d   a   t   a   B   u   f   f   e   r   ,       l   e   n   g   t   h   )   ;   
                   }   
                   _   f   r   e   e   (   d   a   t   a   B   u   f   f   e   r   )   ;   
                   r   e   t   u   r   n       F   S   .   h   a   n   d   l   e   E   r   r   o   r   (   b   y   t   e   s   R   e   a   d   )   ;   
           }   ,   
           w   r   i   t   e   F   i   l   e   :       (   p   a   t   h   ,       d   a   t   a   )       =   >       F   S   _   w   r   i   t   e   F   i   l   e   (   p   a   t   h   ,       d   a   t   a   )   ,   
           m   m   a   p   :       (   s   t   r   e   a   m   ,       l   e   n   g   t   h   ,       o   f   f   s   e   t   ,       p   r   o   t   ,       f   l   a   g   s   )       =   >       {   
                   v   a   r       b   u   f       =       F   S   .   h   a   n   d   l   e   E   r   r   o   r   (   _   _   w   a   s   m   f   s   _   m   m   a   p   (   l   e   n   g   t   h   ,       p   r   o   t   ,       f   l   a   g   s   ,       s   t   r   e   a   m   .   f   d   ,       B   i   g   I   n   t   (   o   f   f   s   e   t   )   )   )   ;   
                   r   e   t   u   r   n       {   
                           p   t   r   :       b   u   f   ,   
                           a   l   l   o   c   a   t   e   d   :       t   r   u   e   
                   }   ;   
           }   ,   
           m   s   y   n   c   :       (   s   t   r   e   a   m   ,       b   u   f   f   e   r   P   t   r   ,       o   f   f   s   e   t   ,       l   e   n   g   t   h   ,       m   m   a   p   F   l   a   g   s   )       =   >       {   
                   a   s   s   e   r   t   (   o   f   f   s   e   t       =   =   =       0   )   ;   
                   /   /       T   O   D   O   :       a   s   s   e   r   t       t   h   a   t       s   t   r   e   a   m       h   a   s       t   h   e       f   d       c   o   r   r   e   s   p   o   n   d   i   n   g       t   o       t   h   e       m   a   p   p   e   d       b   u   f   f   e   r       (   b   u   f   f   e   r   P   t   r   )   .   
                   r   e   t   u   r   n       F   S   .   h   a   n   d   l   e   E   r   r   o   r   (   _   _   w   a   s   m   f   s   _   m   s   y   n   c   (   b   u   f   f   e   r   P   t   r   ,       l   e   n   g   t   h   ,       m   m   a   p   F   l   a   g   s   )   )   ;   
           }   ,   
           m   u   n   m   a   p   :       (   a   d   d   r   ,       l   e   n   g   t   h   )       =   >       (   F   S   .   h   a   n   d   l   e   E   r   r   o   r   (   _   _   w   a   s   m   f   s   _   m   u   n   m   a   p   (   a   d   d   r   ,       l   e   n   g   t   h   )   )   )   ,   
           s   y   m   l   i   n   k   :       (   t   a   r   g   e   t   ,       l   i   n   k   p   a   t   h   )       =   >       w   i   t   h   S   t   a   c   k   S   a   v   e   (   (   )       =   >       (   _   _   w   a   s   m   f   s   _   s   y   m   l   i   n   k   (   s   t   r   i   n   g   T   o   U   T   F   8   O   n   S   t   a   c   k   (   t   a   r   g   e   t   )   ,       s   t   r   i   n   g   T   o   U   T   F   8   O   n   S   t   a   c   k   (   l   i   n   k   p   a   t   h   )   )   )   )   ,   
           r   e   a   d   l   i   n   k   (   p   a   t   h   )       {   
                   r   e   t   u   r   n       w   i   t   h   S   t   a   c   k   S   a   v   e   (   (   )       =   >       {   
                           v   a   r       b   u   f   P   t   r       =       s   t   a   c   k   A   l   l   o   c   (   4   )   ;   
                           F   S   .   h   a   n   d   l   e   E   r   r   o   r   (   _   _   w   a   s   m   f   s   _   r   e   a   d   l   i   n   k   (   s   t   r   i   n   g   T   o   U   T   F   8   O   n   S   t   a   c   k   (   p   a   t   h   )   ,       b   u   f   P   t   r   )   )   ;   
                           v   a   r       r   e   a   d   B   u   f   f   e   r       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   b   u   f   P   t   r   )       >   >       2   )   ]   ;   
                           r   e   t   u   r   n       U   T   F   8   T   o   S   t   r   i   n   g   (   r   e   a   d   B   u   f   f   e   r   )   ;   
                   }   )   ;   
           }   ,   
           s   t   a   t   B   u   f   T   o   O   b   j   e   c   t   (   s   t   a   t   B   u   f   )       {   
                   /   /       i   5   3   /   u   5   3       a   r   e       e   n   o   u   g   h       f   o   r       t   i   m   e   s       a   n   d       i   n   o       i   n       p   r   a   c   t   i   c   e   .   
                   r   e   t   u   r   n       {   
                           d   e   v   :       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   s   t   a   t   B   u   f   )       >   >       2   )   ]   ,   
                           m   o   d   e   :       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   (   s   t   a   t   B   u   f   )       +       (   4   )   )       >   >       2   )   ]   ,   
                           n   l   i   n   k   :       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   (   s   t   a   t   B   u   f   )       +       (   8   )   )       >   >       2   )   ]   ,   
                           u   i   d   :       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   (   s   t   a   t   B   u   f   )       +       (   1   2   )   )       >   >       2   )   ]   ,   
                           g   i   d   :       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   (   s   t   a   t   B   u   f   )       +       (   1   6   )   )       >   >       2   )   ]   ,   
                           r   d   e   v   :       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   (   s   t   a   t   B   u   f   )       +       (   2   0   )   )       >   >       2   )   ]   ,   
                           s   i   z   e   :       r   e   a   d   I   5   3   F   r   o   m   I   6   4   (   (   s   t   a   t   B   u   f   )       +       (   2   4   )   )   ,   
                           b   l   k   s   i   z   e   :       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   (   s   t   a   t   B   u   f   )       +       (   3   2   )   )       >   >       2   )   ]   ,   
                           b   l   o   c   k   s   :       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   U   3   2   )   [   (   (   (   s   t   a   t   B   u   f   )       +       (   3   6   )   )       >   >       2   )   ]   ,   
                           a   t   i   m   e   :       r   e   a   d   I   5   3   F   r   o   m   I   6   4   (   (   s   t   a   t   B   u   f   )       +       (   4   0   )   )   ,   
                           m   t   i   m   e   :       r   e   a   d   I   5   3   F   r   o   m   I   6   4   (   (   s   t   a   t   B   u   f   )       +       (   5   6   )   )   ,   
                           c   t   i   m   e   :       r   e   a   d   I   5   3   F   r   o   m   I   6   4   (   (   s   t   a   t   B   u   f   )       +       (   7   2   )   )   ,   
                           i   n   o   :       r   e   a   d   I   5   3   F   r   o   m   U   6   4   (   (   s   t   a   t   B   u   f   )       +       (   8   8   )   )   
                   }   ;   
           }   ,   
           s   t   a   t   (   p   a   t   h   )       {   
                   r   e   t   u   r   n       w   i   t   h   S   t   a   c   k   S   a   v   e   (   (   )       =   >       {   
                           v   a   r       s   t   a   t   B   u   f       =       s   t   a   c   k   A   l   l   o   c   (   9   6   )   ;   
                           F   S   .   h   a   n   d   l   e   E   r   r   o   r   (   _   _   w   a   s   m   f   s   _   s   t   a   t   (   s   t   r   i   n   g   T   o   U   T   F   8   O   n   S   t   a   c   k   (   p   a   t   h   )   ,       s   t   a   t   B   u   f   )   )   ;   
                           r   e   t   u   r   n       F   S   .   s   t   a   t   B   u   f   T   o   O   b   j   e   c   t   (   s   t   a   t   B   u   f   )   ;   
                   }   )   ;   
           }   ,   
           l   s   t   a   t   (   p   a   t   h   )       {   
                   r   e   t   u   r   n       w   i   t   h   S   t   a   c   k   S   a   v   e   (   (   )       =   >       {   
                           v   a   r       s   t   a   t   B   u   f       =       s   t   a   c   k   A   l   l   o   c   (   9   6   )   ;   
                           F   S   .   h   a   n   d   l   e   E   r   r   o   r   (   _   _   w   a   s   m   f   s   _   l   s   t   a   t   (   s   t   r   i   n   g   T   o   U   T   F   8   O   n   S   t   a   c   k   (   p   a   t   h   )   ,       s   t   a   t   B   u   f   )   )   ;   
                           r   e   t   u   r   n       F   S   .   s   t   a   t   B   u   f   T   o   O   b   j   e   c   t   (   s   t   a   t   B   u   f   )   ;   
                   }   )   ;   
           }   ,   
           c   h   m   o   d   (   p   a   t   h   ,       m   o   d   e   )       {   
                   r   e   t   u   r   n       F   S   .   h   a   n   d   l   e   E   r   r   o   r   (   w   i   t   h   S   t   a   c   k   S   a   v   e   (   (   )       =   >       {   
                           v   a   r       b   u   f   f   e   r       =       s   t   r   i   n   g   T   o   U   T   F   8   O   n   S   t   a   c   k   (   p   a   t   h   )   ;   
                           r   e   t   u   r   n       _   _   w   a   s   m   f   s   _   c   h   m   o   d   (   b   u   f   f   e   r   ,       m   o   d   e   )   ;   
                   }   )   )   ;   
           }   ,   
           l   c   h   m   o   d   (   p   a   t   h   ,       m   o   d   e   )       {   
                   r   e   t   u   r   n       F   S   .   h   a   n   d   l   e   E   r   r   o   r   (   w   i   t   h   S   t   a   c   k   S   a   v   e   (   (   )       =   >       {   
                           v   a   r       b   u   f   f   e   r       =       s   t   r   i   n   g   T   o   U   T   F   8   O   n   S   t   a   c   k   (   p   a   t   h   )   ;   
                           r   e   t   u   r   n       _   _   w   a   s   m   f   s   _   l   c   h   m   o   d   (   b   u   f   f   e   r   ,       m   o   d   e   )   ;   
                   }   )   )   ;   
           }   ,   
           f   c   h   m   o   d   (   f   d   ,       m   o   d   e   )       {   
                   r   e   t   u   r   n       F   S   .   h   a   n   d   l   e   E   r   r   o   r   (   _   _   w   a   s   m   f   s   _   f   c   h   m   o   d   (   f   d   ,       m   o   d   e   )   )   ;   
           }   ,   
           u   t   i   m   e   :       (   p   a   t   h   ,       a   t   i   m   e   ,       m   t   i   m   e   )       =   >       (   F   S   .   h   a   n   d   l   e   E   r   r   o   r   (   w   i   t   h   S   t   a   c   k   S   a   v   e   (   (   )       =   >       (   _   _   w   a   s   m   f   s   _   u   t   i   m   e   (   s   t   r   i   n   g   T   o   U   T   F   8   O   n   S   t   a   c   k   (   p   a   t   h   )   ,       a   t   i   m   e   ,       m   t   i   m   e   )   )   )   )   )   ,   
           t   r   u   n   c   a   t   e   (   p   a   t   h   ,       l   e   n   )       {   
                   r   e   t   u   r   n       F   S   .   h   a   n   d   l   e   E   r   r   o   r   (   w   i   t   h   S   t   a   c   k   S   a   v   e   (   (   )       =   >       (   _   _   w   a   s   m   f   s   _   t   r   u   n   c   a   t   e   (   s   t   r   i   n   g   T   o   U   T   F   8   O   n   S   t   a   c   k   (   p   a   t   h   )   ,       B   i   g   I   n   t   (   l   e   n   )   )   )   )   )   ;   
           }   ,   
           f   t   r   u   n   c   a   t   e   (   f   d   ,       l   e   n   )       {   
                   r   e   t   u   r   n       F   S   .   h   a   n   d   l   e   E   r   r   o   r   (   _   _   w   a   s   m   f   s   _   f   t   r   u   n   c   a   t   e   (   f   d   ,       B   i   g   I   n   t   (   l   e   n   )   )   )   ;   
           }   ,   
           f   i   n   d   O   b   j   e   c   t   (   p   a   t   h   )       {   
                   v   a   r       r   e   s   u   l   t       =       w   i   t   h   S   t   a   c   k   S   a   v   e   (   (   )       =   >       _   _   w   a   s   m   f   s   _   i   d   e   n   t   i   f   y   (   s   t   r   i   n   g   T   o   U   T   F   8   O   n   S   t   a   c   k   (   p   a   t   h   )   )   )   ;   
                   i   f       (   r   e   s   u   l   t       =   =       4   4   )       {   
                           r   e   t   u   r   n       n   u   l   l   ;   
                   }   
                   r   e   t   u   r   n       {   
                           i   s   F   o   l   d   e   r   :       r   e   s   u   l   t       =   =       3   1   ,   
                           i   s   D   e   v   i   c   e   :       f   a   l   s   e   
                   }   ;   
           }   ,   
           r   e   a   d   d   i   r   :       p   a   t   h       =   >       w   i   t   h   S   t   a   c   k   S   a   v   e   (   (   )       =   >       {   
                   v   a   r       p   a   t   h   B   u   f   f   e   r       =       s   t   r   i   n   g   T   o   U   T   F   8   O   n   S   t   a   c   k   (   p   a   t   h   )   ;   
                   v   a   r       e   n   t   r   i   e   s       =       [   ]   ;   
                   v   a   r       s   t   a   t   e       =       _   _   w   a   s   m   f   s   _   r   e   a   d   d   i   r   _   s   t   a   r   t   (   p   a   t   h   B   u   f   f   e   r   )   ;   
                   i   f       (   !   s   t   a   t   e   )       {   
                           /   /       T   O   D   O   :       T   h   e       o   l   d       F   S       t   h   r   e   w       a   n       E   r   r   n   o   E   r   r   o   r       h   e   r   e   .   
                           t   h   r   o   w       n   e   w       E   r   r   o   r   (   "   N   o       s   u   c   h       d   i   r   e   c   t   o   r   y   "   )   ;   
                   }   
                   v   a   r       e   n   t   r   y   ;   
                   w   h   i   l   e       (   e   n   t   r   y       =       _   _   w   a   s   m   f   s   _   r   e   a   d   d   i   r   _   g   e   t   (   s   t   a   t   e   )   )       {   
                           e   n   t   r   i   e   s   .   p   u   s   h   (   U   T   F   8   T   o   S   t   r   i   n   g   (   e   n   t   r   y   )   )   ;   
                   }   
                   _   _   w   a   s   m   f   s   _   r   e   a   d   d   i   r   _   f   i   n   i   s   h   (   s   t   a   t   e   )   ;   
                   r   e   t   u   r   n       e   n   t   r   i   e   s   ;   
           }   )   ,   
           m   o   u   n   t   :       (   t   y   p   e   ,       o   p   t   s   ,       m   o   u   n   t   p   o   i   n   t   )       =   >       {   
                   i   f       (   t   y   p   e   o   f       t   y   p   e       =   =       "   s   t   r   i   n   g   "   )       {   
                           /   /       T   h   e       f   i   l   e   s   y   s   t   e   m       w   a   s       n   o   t       i   n   c   l   u   d   e   d   ,       a   n   d       i   n   s   t   e   a   d       w   e       h   a   v   e       a   n       e   r   r   o   r   
                           /   /       m   e   s   s   a   g   e       s   t   o   r   e   d       i   n       t   h   e       v   a   r   i   a   b   l   e   .   
                           t   h   r   o   w       t   y   p   e   ;   
                   }   
                   v   a   r       b   a   c   k   e   n   d   P   o   i   n   t   e   r       =       t   y   p   e   .   c   r   e   a   t   e   B   a   c   k   e   n   d   (   o   p   t   s   )   ;   
                   r   e   t   u   r   n       F   S   .   h   a   n   d   l   e   E   r   r   o   r   (   w   i   t   h   S   t   a   c   k   S   a   v   e   (   (   )       =   >       _   _   w   a   s   m   f   s   _   m   o   u   n   t   (   s   t   r   i   n   g   T   o   U   T   F   8   O   n   S   t   a   c   k   (   m   o   u   n   t   p   o   i   n   t   )   ,       b   a   c   k   e   n   d   P   o   i   n   t   e   r   )   )   )   ;   
           }   ,   
           u   n   m   o   u   n   t   :       m   o   u   n   t   p   o   i   n   t       =   >       (   F   S   .   h   a   n   d   l   e   E   r   r   o   r   (   w   i   t   h   S   t   a   c   k   S   a   v   e   (   (   )       =   >       _   w   a   s   m   f   s   _   u   n   m   o   u   n   t   (   s   t   r   i   n   g   T   o   U   T   F   8   O   n   S   t   a   c   k   (   m   o   u   n   t   p   o   i   n   t   )   )   )   )   )   ,   
           m   k   n   o   d   :       (   p   a   t   h   ,       m   o   d   e   ,       d   e   v   )       =   >       F   S   _   m   k   n   o   d   (   p   a   t   h   ,       m   o   d   e   ,       d   e   v   )   ,   
           m   a   k   e   d   e   v   :       (   m   a   ,       m   i   )       =   >       (   (   m   a   )       <   <       8       |       (   m   i   )   )   ,   
           r   e   g   i   s   t   e   r   D   e   v   i   c   e   (   d   e   v   ,       o   p   s   )       {   
                   v   a   r       b   a   c   k   e   n   d   P   o   i   n   t   e   r       =       _   w   a   s   m   f   s   _   c   r   e   a   t   e   _   j   s   i   m   p   l   _   b   a   c   k   e   n   d   (   )   ;   
                   v   a   r       d   e   f   i   n   e   d   O   p   s       =       {   
                           u   s   e   r   R   e   a   d   :       o   p   s   .   r   e   a   d   ,   
                           u   s   e   r   W   r   i   t   e   :       o   p   s   .   w   r   i   t   e   ,   
                           a   l   l   o   c   F   i   l   e   :       f   i   l   e       =   >       {   
                                   w   a   s   m   F   S   D   e   v   i   c   e   S   t   r   e   a   m   s   [   f   i   l   e   ]       =       {   }   ;   
                           }   ,   
                           f   r   e   e   F   i   l   e   :       f   i   l   e       =   >       {   
                                   w   a   s   m   F   S   D   e   v   i   c   e   S   t   r   e   a   m   s   [   f   i   l   e   ]       =       u   n   d   e   f   i   n   e   d   ;   
                           }   ,   
                           g   e   t   S   i   z   e   :       f   i   l   e       =   >       {   }   ,   
                           /   /       D   e   v   i   c   e   s       c   a   n   n   o   t       b   e       r   e   s   i   z   e   d   .   
                           s   e   t   S   i   z   e   :       (   f   i   l   e   ,       s   i   z   e   )       =   >       0   ,   
                           r   e   a   d   :       (   f   i   l   e   ,       b   u   f   f   e   r   ,       l   e   n   g   t   h   ,       o   f   f   s   e   t   )       =   >       {   
                                   v   a   r       b   u   f   f   e   r   A   r   r   a   y       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   8   )   .   s   u   b   a   r   r   a   y   (   b   u   f   f   e   r   ,       b   u   f   f   e   r       +       l   e   n   g   t   h   )   ;   
                                   t   r   y       {   
                                           v   a   r       b   y   t   e   s   R   e   a   d       =       d   e   f   i   n   e   d   O   p   s   .   u   s   e   r   R   e   a   d   (   w   a   s   m   F   S   D   e   v   i   c   e   S   t   r   e   a   m   s   [   f   i   l   e   ]   ,       b   u   f   f   e   r   A   r   r   a   y   ,       0   ,       l   e   n   g   t   h   ,       o   f   f   s   e   t   )   ;   
                                   }       c   a   t   c   h       (   e   )       {   
                                           r   e   t   u   r   n       -   e   .   e   r   r   n   o   ;   
                                   }   
                                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   8   )   .   s   e   t   (   b   u   f   f   e   r   A   r   r   a   y   ,       b   u   f   f   e   r   )   ;   
                                   r   e   t   u   r   n       b   y   t   e   s   R   e   a   d   ;   
                           }   ,   
                           w   r   i   t   e   :       (   f   i   l   e   ,       b   u   f   f   e   r   ,       l   e   n   g   t   h   ,       o   f   f   s   e   t   )       =   >       {   
                                   v   a   r       b   u   f   f   e   r   A   r   r   a   y       =       (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   8   )   .   s   u   b   a   r   r   a   y   (   b   u   f   f   e   r   ,       b   u   f   f   e   r       +       l   e   n   g   t   h   )   ;   
                                   t   r   y       {   
                                           v   a   r       b   y   t   e   s   W   r   i   t   t   e   n       =       d   e   f   i   n   e   d   O   p   s   .   u   s   e   r   W   r   i   t   e   (   w   a   s   m   F   S   D   e   v   i   c   e   S   t   r   e   a   m   s   [   f   i   l   e   ]   ,       b   u   f   f   e   r   A   r   r   a   y   ,       0   ,       l   e   n   g   t   h   ,       o   f   f   s   e   t   )   ;   
                                   }       c   a   t   c   h       (   e   )       {   
                                           r   e   t   u   r   n       -   e   .   e   r   r   n   o   ;   
                                   }   
                                   (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   8   )   .   s   e   t   (   b   u   f   f   e   r   A   r   r   a   y   ,       b   u   f   f   e   r   )   ;   
                                   r   e   t   u   r   n       b   y   t   e   s   W   r   i   t   t   e   n   ;   
                           }   
                   }   ;   
                   w   a   s   m   F   S   $   b   a   c   k   e   n   d   s   [   b   a   c   k   e   n   d   P   o   i   n   t   e   r   ]       =       d   e   f   i   n   e   d   O   p   s   ;   
                   w   a   s   m   F   S   D   e   v   i   c   e   s   [   d   e   v   ]       =       b   a   c   k   e   n   d   P   o   i   n   t   e   r   ;   
           }   ,   
           c   r   e   a   t   e   D   e   v   i   c   e   (   p   a   r   e   n   t   ,       n   a   m   e   ,       i   n   p   u   t   ,       o   u   t   p   u   t   )       {   
                   i   f       (   t   y   p   e   o   f       p   a   r   e   n   t       !   =       "   s   t   r   i   n   g   "   )       {   
                           /   /       T   h   e       o   l   d       A   P   I       a   l   l   o   w   e   d       p   a   r   e   n   t   s       t   o       b   e       o   b   j   e   c   t   s   ,       w   h   i   c   h       d   o       n   o   t       e   x   i   s   t       i   n       W   a   s   m   F   S   .   
                           t   h   r   o   w       n   e   w       E   r   r   o   r   (   "   O   n   l   y       s   t   r   i   n   g       p   a   t   h   s       a   r   e       a   c   c   e   p   t   e   d   "   )   ;   
                   }   
                   v   a   r       p   a   t   h       =       P   A   T   H   .   j   o   i   n   2   (   p   a   r   e   n   t   ,       n   a   m   e   )   ;   
                   v   a   r       m   o   d   e       =       F   S   _   g   e   t   M   o   d   e   (   !   !   i   n   p   u   t   ,       !   !   o   u   t   p   u   t   )   ;   
                   F   S   .   c   r   e   a   t   e   D   e   v   i   c   e   .   m   a   j   o   r       ?   ?   =       6   4   ;   
                   v   a   r       d   e   v       =       F   S   .   m   a   k   e   d   e   v   (   F   S   .   c   r   e   a   t   e   D   e   v   i   c   e   .   m   a   j   o   r   +   +   ,       0   )   ;   
                   /   /       C   r   e   a   t   e       a       f   a   k   e       d   e   v   i   c   e       w   i   t   h       a       s   e   t       o   f       s   t   r   e   a   m       o   p   s       t   o       e   m   u   l   a   t   e   
                   /   /       t   h   e       o   l   d       A   P   I   '   s       c   r   e   a   t   e   D   e   v   i   c   e   (   )   .   
                   F   S   .   r   e   g   i   s   t   e   r   D   e   v   i   c   e   (   d   e   v   ,       {   
                           r   e   a   d   (   s   t   r   e   a   m   ,       b   u   f   f   e   r   ,       o   f   f   s   e   t   ,       l   e   n   g   t   h   ,       p   o   s   )       {   
                                   v   a   r       b   y   t   e   s   R   e   a   d       =       0   ;   
                                   f   o   r       (   v   a   r       i       =       0   ;       i       <       l   e   n   g   t   h   ;       i   +   +   )       {   
                                           v   a   r       r   e   s   u   l   t   ;   
                                           t   r   y       {   
                                                   r   e   s   u   l   t       =       i   n   p   u   t   (   )   ;   
                                           }       c   a   t   c   h       (   e   )       {   
                                                   t   h   r   o   w       n   e   w       F   S   .   E   r   r   n   o   E   r   r   o   r   (   2   9   )   ;   
                                           }   
                                           i   f       (   r   e   s   u   l   t       =   =   =       u   n   d   e   f   i   n   e   d       &   &       b   y   t   e   s   R   e   a   d       =   =   =       0   )       {   
                                                   t   h   r   o   w       n   e   w       F   S   .   E   r   r   n   o   E   r   r   o   r   (   6   )   ;   
                                           }   
                                           i   f       (   r   e   s   u   l   t       =   =   =       n   u   l   l       |   |       r   e   s   u   l   t       =   =   =       u   n   d   e   f   i   n   e   d   )       b   r   e   a   k   ;   
                                           b   y   t   e   s   R   e   a   d   +   +   ;   
                                           b   u   f   f   e   r   [   o   f   f   s   e   t       +       i   ]       =       r   e   s   u   l   t   ;   
                                   }   
                                   r   e   t   u   r   n       b   y   t   e   s   R   e   a   d   ;   
                           }   ,   
                           w   r   i   t   e   (   s   t   r   e   a   m   ,       b   u   f   f   e   r   ,       o   f   f   s   e   t   ,       l   e   n   g   t   h   ,       p   o   s   )       {   
                                   f   o   r       (   v   a   r       i       =       0   ;       i       <       l   e   n   g   t   h   ;       i   +   +   )       {   
                                           t   r   y       {   
                                                   o   u   t   p   u   t   (   b   u   f   f   e   r   [   o   f   f   s   e   t       +       i   ]   )   ;   
                                           }       c   a   t   c   h       (   e   )       {   
                                                   t   h   r   o   w       n   e   w       F   S   .   E   r   r   n   o   E   r   r   o   r   (   2   9   )   ;   
                                           }   
                                   }   
                                   r   e   t   u   r   n       i   ;   
                           }   
                   }   )   ;   
                   r   e   t   u   r   n       F   S   .   m   k   d   e   v   (   p   a   t   h   ,       m   o   d   e   ,       d   e   v   )   ;   
           }   ,   
           m   k   d   e   v   (   p   a   t   h   ,       m   o   d   e   ,       d   e   v   )       {   
                   i   f       (   t   y   p   e   o   f       d   e   v       =   =   =       "   u   n   d   e   f   i   n   e   d   "   )       {   
                           d   e   v       =       m   o   d   e   ;   
                           m   o   d   e       =       4   3   8   ;   
                   }   
                   v   a   r       d   e   v   i   c   e   B   a   c   k   e   n   d       =       w   a   s   m   F   S   D   e   v   i   c   e   s   [   d   e   v   ]   ;   
                   i   f       (   !   d   e   v   i   c   e   B   a   c   k   e   n   d   )       {   
                           t   h   r   o   w       n   e   w       E   r   r   o   r   (   "   I   n   v   a   l   i   d       d   e   v   i   c   e       I   D   .   "   )   ;   
                   }   
                   r   e   t   u   r   n       F   S   .   h   a   n   d   l   e   E   r   r   o   r   (   w   i   t   h   S   t   a   c   k   S   a   v   e   (   (   )       =   >       (   _   w   a   s   m   f   s   _   c   r   e   a   t   e   _   f   i   l   e   (   s   t   r   i   n   g   T   o   U   T   F   8   O   n   S   t   a   c   k   (   p   a   t   h   )   ,       m   o   d   e   ,       d   e   v   i   c   e   B   a   c   k   e   n   d   )   )   )   )   ;   
           }   ,   
           r   e   n   a   m   e   (   o   l   d   P   a   t   h   ,       n   e   w   P   a   t   h   )       {   
                   r   e   t   u   r   n       F   S   .   h   a   n   d   l   e   E   r   r   o   r   (   w   i   t   h   S   t   a   c   k   S   a   v   e   (   (   )       =   >       {   
                           v   a   r       o   l   d   P   a   t   h   B   u   f   f   e   r       =       s   t   r   i   n   g   T   o   U   T   F   8   O   n   S   t   a   c   k   (   o   l   d   P   a   t   h   )   ;   
                           v   a   r       n   e   w   P   a   t   h   B   u   f   f   e   r       =       s   t   r   i   n   g   T   o   U   T   F   8   O   n   S   t   a   c   k   (   n   e   w   P   a   t   h   )   ;   
                           r   e   t   u   r   n       _   _   w   a   s   m   f   s   _   r   e   n   a   m   e   (   o   l   d   P   a   t   h   B   u   f   f   e   r   ,       n   e   w   P   a   t   h   B   u   f   f   e   r   )   ;   
                   }   )   )   ;   
           }   ,   
           l   l   s   e   e   k   (   s   t   r   e   a   m   ,       o   f   f   s   e   t   ,       w   h   e   n   c   e   )       {   
                   r   e   t   u   r   n       F   S   .   h   a   n   d   l   e   E   r   r   o   r   (   _   _   w   a   s   m   f   s   _   l   l   s   e   e   k   (   s   t   r   e   a   m   .   f   d   ,       B   i   g   I   n   t   (   o   f   f   s   e   t   )   ,       w   h   e   n   c   e   )   )   ;   
           }   
   }   ;   
   
   v   a   r       g   e   t   C   F   u   n   c       =       i   d   e   n   t       =   >       {   
           v   a   r       f   u   n   c       =       M   o   d   u   l   e   [   "   _   "       +       i   d   e   n   t   ]   ;   
           /   /       c   l   o   s   u   r   e       e   x   p   o   r   t   e   d       f   u   n   c   t   i   o   n   
           a   s   s   e   r   t   (   f   u   n   c   ,       "   C   a   n   n   o   t       c   a   l   l       u   n   k   n   o   w   n       f   u   n   c   t   i   o   n       "       +       i   d   e   n   t       +       "   ,       m   a   k   e       s   u   r   e       i   t       i   s       e   x   p   o   r   t   e   d   "   )   ;   
           r   e   t   u   r   n       f   u   n   c   ;   
   }   ;   
   
   v   a   r       w   r   i   t   e   A   r   r   a   y   T   o   M   e   m   o   r   y       =       (   a   r   r   a   y   ,       b   u   f   f   e   r   )       =   >       {   
           a   s   s   e   r   t   (   a   r   r   a   y   .   l   e   n   g   t   h       >   =       0   ,       "   w   r   i   t   e   A   r   r   a   y   T   o   M   e   m   o   r   y       a   r   r   a   y       m   u   s   t       h   a   v   e       a       l   e   n   g   t   h       (   s   h   o   u   l   d       b   e       a   n       a   r   r   a   y       o   r       t   y   p   e   d       a   r   r   a   y   )   "   )   ;   
           (   g   r   o   w   M   e   m   V   i   e   w   s   (   )   ,       H   E   A   P   8   )   .   s   e   t   (   a   r   r   a   y   ,       b   u   f   f   e   r   )   ;   
   }   ;   
   
   /   *   *   
                       *       @   p   a   r   a   m       {   s   t   r   i   n   g   |   n   u   l   l   =   }       r   e   t   u   r   n   T   y   p   e   
                       *       @   p   a   r   a   m       {   A   r   r   a   y   =   }       a   r   g   T   y   p   e   s   
                       *       @   p   a   r   a   m       {   A   r   g   u   m   e   n   t   s   |   A   r   r   a   y   =   }       a   r   g   s   
                       *       @   p   a   r   a   m       {   O   b   j   e   c   t   =   }       o   p   t   s   
                       *   /       v   a   r       c   c   a   l   l       =       (   i   d   e   n   t   ,       r   e   t   u   r   n   T   y   p   e   ,       a   r   g   T   y   p   e   s   ,       a   r   g   s   ,       o   p   t   s   )       =   >       {   
           /   /       F   o   r       f   a   s   t       l   o   o   k   u   p       o   f       c   o   n   v   e   r   s   i   o   n       f   u   n   c   t   i   o   n   s   
           v   a   r       t   o   C       =       {   
                   "   s   t   r   i   n   g   "   :       s   t   r       =   >       {   
                           v   a   r       r   e   t       =       0   ;   
                           i   f       (   s   t   r       !   =   =       n   u   l   l       &   &       s   t   r       !   =   =       u   n   d   e   f   i   n   e   d       &   &       s   t   r       !   =   =       0   )       {   
                                   /   /       n   u   l   l       s   t   r   i   n   g   
                                   r   e   t       =       s   t   r   i   n   g   T   o   U   T   F   8   O   n   S   t   a   c   k   (   s   t   r   )   ;   
                           }   
                           r   e   t   u   r   n       r   e   t   ;   
                   }   ,   
                   "   a   r   r   a   y   "   :       a   r   r       =   >       {   
                           v   a   r       r   e   t       =       s   t   a   c   k   A   l   l   o   c   (   a   r   r   .   l   e   n   g   t   h   )   ;   
                           w   r   i   t   e   A   r   r   a   y   T   o   M   e   m   o   r   y   (   a   r   r   ,       r   e   t   )   ;   
                           r   e   t   u   r   n       r   e   t   ;   
                   }   
           }   ;   
           f   u   n   c   t   i   o   n       c   o   n   v   e   r   t   R   e   t   u   r   n   V   a   l   u   e   (   r   e   t   )       {   
                   i   f       (   r   e   t   u   r   n   T   y   p   e       =   =   =       "   s   t   r   i   n   g   "   )       {   
                           r   e   t   u   r   n       U   T   F   8   T   o   S   t   r   i   n   g   (   r   e   t   )   ;   
                   }   
                   i   f       (   r   e   t   u   r   n   T   y   p   e       =   =   =       "   b   o   o   l   e   a   n   "   )       r   e   t   u   r   n       B   o   o   l   e   a   n   (   r   e   t   )   ;   
                   r   e   t   u   r   n       r   e   t   ;   
           }   
           v   a   r       f   u   n   c       =       g   e   t   C   F   u   n   c   (   i   d   e   n   t   )   ;   
           v   a   r       c   A   r   g   s       =       [   ]   ;   
           v   a   r       s   t   a   c   k       =       0   ;   
           a   s   s   e   r   t   (   r   e   t   u   r   n   T   y   p   e       !   =   =       "   a   r   r   a   y   "   ,       '   R   e   t   u   r   n       t   y   p   e       s   h   o   u   l   d       n   o   t       b   e       "   a   r   r   a   y   "   .   '   )   ;   
           i   f       (   a   r   g   s   )       {   
                   f   o   r       (   v   a   r       i       =       0   ;       i       <       a   r   g   s   .   l   e   n   g   t   h   ;       i   +   +   )       {   
                           v   a   r       c   o   n   v   e   r   t   e   r       =       t   o   C   [   a   r   g   T   y   p   e   s   [   i   ]   ]   ;   
                           i   f       (   c   o   n   v   e   r   t   e   r   )       {   
                                   i   f       (   s   t   a   c   k       =   =   =       0   )       s   t   a   c   k       =       s   t   a   c   k   S   a   v   e   (   )   ;   
                                   c   A   r   g   s   [   i   ]       =       c   o   n   v   e   r   t   e   r   (   a   r   g   s   [   i   ]   )   ;   
                           }       e   l   s   e       {   
                                   c   A   r   g   s   [   i   ]       =       a   r   g   s   [   i   ]   ;   
                           }   
                   }   
           }   
           v   a   r       r   e   t       =       f   u   n   c   (   .   .   .   c   A   r   g   s   )   ;   
           f   u   n   c   t   i   o   n       o   n   D   o   n   e   (   r   e   t   )       {   
                   i   f       (   s   t   a   c   k       !   =   =       0   )       s   t   a   c   k   R   e   s   t   o   r   e   (   s   t   a   c   k   )   ;   
                   r   e   t   u   r   n       c   o   n   v   e   r   t   R   e   t   u   r   n   V   a   l   u   e   (   r   e   t   )   ;   
           }   
           r   e   t       =       o   n   D   o   n   e   (   r   e   t   )   ;   
           r   e   t   u   r   n       r   e   t   ;   
   }   ;   
   
   v   a   r       F   S   _   c   r   e   a   t   e   P   a   t   h       =       F   S   .   c   r   e   a   t   e   P   a   t   h   ;   
   
   P   T   h   r   e   a   d   .   i   n   i   t   (   )   ;   
   
   a   s   s   e   r   t   (   e   m   v   a   l   _   h   a   n   d   l   e   s   .   l   e   n   g   t   h       =   =   =       5       *       2   )   ;   
   
   /   /       S   i   g   n   a   l       G   L       r   e   n   d   e   r   i   n   g       l   a   y   e   r       t   h   a   t       p   r   o   c   e   s   s   i   n   g       o   f       a       n   e   w       f   r   a   m   e       i   s       a   b   o   u   t       t   o   
   /   /       s   t   a   r   t   .       T   h   i   s       h   e   l   p   s       i   t       o   p   t   i   m   i   z   e       V   B   O       d   o   u   b   l   e   -   b   u   f   f   e   r   i   n   g       a   n   d       r   e   d   u   c   e       G   P   U       s   t   a   l   l   s   .   
   r   e   g   i   s   t   e   r   P   r   e   M   a   i   n   L   o   o   p   (   (   )       =   >       G   L   .   n   e   w   R   e   n   d   e   r   i   n   g   F   r   a   m   e   S   t   a   r   t   e   d   (   )   )   ;   
   
   f   o   r       (   l   e   t       i       =       0   ;       i       <       3   2   ;       +   +   i   )       t   e   m   p   F   i   x   e   d   L   e   n   g   t   h   A   r   r   a   y   .   p   u   s   h   (   n   e   w       A   r   r   a   y   (   i   )   )   ;   
   
   M   o   d   u   l   e   [   "   r   e   q   u   e   s   t   A   n   i   m   a   t   i   o   n   F   r   a   m   e   "   ]       =       M   a   i   n   L   o   o   p   .   r   e   q   u   e   s   t   A   n   i   m   a   t   i   o   n   F   r   a   m   e   ;   
   
   M   o   d   u   l   e   [   "   p   a   u   s   e   M   a   i   n   L   o   o   p   "   ]       =       M   a   i   n   L   o   o   p   .   p   a   u   s   e   ;   
   
   M   o   d   u   l   e   [   "   r   e   s   u   m   e   M   a   i   n   L   o   o   p   "   ]       =       M   a   i   n   L   o   o   p   .   r   e   s   u   m   e   ;   
   
   M   a   i   n   L   o   o   p   .   i   n   i   t   (   )   ;   
   
   /   /       E   n   d       J   S       l   i   b   r   a   r   y       c   o   d   e   
   /   /       i   n   c   l   u   d   e   :       p   o   s   t   l   i   b   r   a   r   y   .   j   s   
   /   /       T   h   i   s       f   i   l   e       i   s       i   n   c   l   u   d   e   d       a   f   t   e   r       t   h   e       a   u   t   o   m   a   t   i   c   a   l   l   y   -   g   e   n   e   r   a   t   e   d       J   S       l   i   b   r   a   r   y       c   o   d   e   
   /   /       b   u   t       b   e   f   o   r   e       t   h   e       w   a   s   m       m   o   d   u   l   e       i   s       c   r   e   a   t   e   d   .   
   {   
           /   /       W   i   t   h       W   A   S   M   _   E   S   M   _   I   N   T   E   G   R   A   T   I   O   N       t   h   i   s       h   a   s       t   o       h   a   p   p   e   n       a   t       t   h   e       t   o   p       l   e   v   e   l       a   n   d       n   o   t   
           /   /       d   e   l   a   y   e   d       u   n   t   i   l       p   r   o   c   e   s   s   M   o   d   u   l   e   A   r   g   s   .   
           i   n   i   t   M   e   m   o   r   y   (   )   ;   
           /   /       B   e   g   i   n       A   T   M   O   D   U   L   E   S       h   o   o   k   s   
           i   f       (   M   o   d   u   l   e   [   "   n   o   E   x   i   t   R   u   n   t   i   m   e   "   ]   )       n   o   E   x   i   t   R   u   n   t   i   m   e       =       M   o   d   u   l   e   [   "   n   o   E   x   i   t   R   u   n   t   i   m   e   "   ]   ;   
           i   f       (   M   o   d   u   l   e   [   "   p   r   e   l   o   a   d   P   l   u   g   i   n   s   "   ]   )       p   r   e   l   o   a   d   P   l   u   g   i   n   s       =       M   o   d   u   l   e   [   "   p   r   e   l   o   a   d   P   l   u   g   i   n   s   "   ]   ;   
           i   f       (   M   o   d   u   l   e   [   "   p   r   i   n   t   "   ]   )       o   u   t       =       M   o   d   u   l   e   [   "   p   r   i   n   t   "   ]   ;   
           i   f       (   M   o   d   u   l   e   [   "   p   r   i   n   t   E   r   r   "   ]   )       e   r   r       =       M   o   d   u   l   e   [   "   p   r   i   n   t   E   r   r   "   ]   ;   
           i   f       (   M   o   d   u   l   e   [   "   w   a   s   m   B   i   n   a   r   y   "   ]   )       w   a   s   m   B   i   n   a   r   y       =       M   o   d   u   l   e   [   "   w   a   s   m   B   i   n   a   r   y   "   ]   ;   
           /   /       E   n   d       A   T   M   O   D   U   L   E   S       h   o   o   k   s   
           c   h   e   c   k   I   n   c   o   m   i   n   g   M   o   d   u   l   e   A   P   I   (   )   ;   
           i   f       (   M   o   d   u   l   e   [   "   a   r   g   u   m   e   n   t   s   "   ]   )       a   r   g   u   m   e   n   t   s   _       =       M   o   d   u   l   e   [   "   a   r   g   u   m   e   n   t   s   "   ]   ;   
           i   f       (   M   o   d   u   l   e   [   "   t   h   i   s   P   r   o   g   r   a   m   "   ]   )       t   h   i   s   P   r   o   g   r   a   m       =       M   o   d   u   l   e   [   "   t   h   i   s   P   r   o   g   r   a   m   "   ]   ;   
           /   /       A   s   s   e   r   t   i   o   n   s       o   n       r   e   m   o   v   e   d       i   n   c   o   m   i   n   g       M   o   d   u   l   e       J   S       A   P   I   s   .   
           a   s   s   e   r   t   (   t   y   p   e   o   f       M   o   d   u   l   e   [   "   m   e   m   o   r   y   I   n   i   t   i   a   l   i   z   e   r   P   r   e   f   i   x   U   R   L   "   ]       =   =       "   u   n   d   e   f   i   n   e   d   "   ,       "   M   o   d   u   l   e   .   m   e   m   o   r   y   I   n   i   t   i   a   l   i   z   e   r   P   r   e   f   i   x   U   R   L       o   p   t   i   o   n       w   a   s       r   e   m   o   v   e   d   ,       u   s   e       M   o   d   u   l   e   .   l   o   c   a   t   e   F   i   l   e       i   n   s   t   e   a   d   "   )   ;   
           a   s   s   e   r   t   (   t   y   p   e   o   f       M   o   d   u   l   e   [   "   p   t   h   r   e   a   d   M   a   i   n   P   r   e   f   i   x   U   R   L   "   ]       =   =       "   u   n   d   e   f   i   n   e   d   "   ,       "   M   o   d   u   l   e   .   p   t   h   r   e   a   d   M   a   i   n   P   r   e   f   i   x   U   R   L       o   p   t   i   o   n       w   a   s       r   e   m   o   v   e   d   ,       u   s   e       M   o   d   u   l   e   .   l   o   c   a   t   e   F   i   l   e       i   n   s   t   e   a   d   "   )   ;   
           a   s   s   e   r   t   (   t   y   p   e   o   f       M   o   d   u   l   e   [   "   c   d   I   n   i   t   i   a   l   i   z   e   r   P   r   e   f   i   x   U   R   L   "   ]       =   =       "   u   n   d   e   f   i   n   e   d   "   ,       "   M   o   d   u   l   e   .   c   d   I   n   i   t   i   a   l   i   z   e   r   P   r   e   f   i   x   U   R   L       o   p   t   i   o   n       w   a   s       r   e   m   o   v   e   d   ,       u   s   e       M   o   d   u   l   e   .   l   o   c   a   t   e   F   i   l   e       i   n   s   t   e   a   d   "   )   ;   
           a   s   s   e   r   t   (   t   y   p   e   o   f       M   o   d   u   l   e   [   "   f   i   l   e   P   a   c   k   a   g   e   P   r   e   f   i   x   U   R   L   "   ]       =   =       "   u   n   d   e   f   i   n   e   d   "   ,       "   M   o   d   u   l   e   .   f   i   l   e   P   a   c   k   a   g   e   P   r   e   f   i   x   U   R   L       o   p   t   i   o   n       w   a   s       r   e   m   o   v   e   d   ,       u   s   e       M   o   d   u   l   e   .   l   o   c   a   t   e   F   i   l   e       i   n   s   t   e   a   d   "   )   ;   
           a   s   s   e   r   t   (   t   y   p   e   o   f       M   o   d   u   l   e   [   "   r   e   a   d   "   ]       =   =       "   u   n   d   e   f   i   n   e   d   "   ,       "   M   o   d   u   l   e   .   r   e   a   d       o   p   t   i   o   n       w   a   s       r   e   m   o   v   e   d   "   )   ;   
           a   s   s   e   r   t   (   t   y   p   e   o   f       M   o   d   u   l   e   [   "   r   e   a   d   A   s   y   n   c   "   ]       =   =       "   u   n   d   e   f   i   n   e   d   "   ,       "   M   o   d   u   l   e   .   r   e   a   d   A   s   y   n   c       o   p   t   i   o   n       w   a   s       r   e   m   o   v   e   d       (   m   o   d   i   f   y       r   e   a   d   A   s   y   n   c       i   n       J   S   )   "   )   ;   
           a   s   s   e   r   t   (   t   y   p   e   o   f       M   o   d   u   l   e   [   "   r   e   a   d   B   i   n   a   r   y   "   ]       =   =       "   u   n   d   e   f   i   n   e   d   "   ,       "   M   o   d   u   l   e   .   r   e   a   d   B   i   n   a   r   y       o   p   t   i   o   n       w   a   s       r   e   m   o   v   e   d       (   m   o   d   i   f   y       r   e   a   d   B   i   n   a   r   y       i   n       J   S   )   "   )   ;   
           a   s   s   e   r   t   (   t   y   p   e   o   f       M   o   d   u   l   e   [   "   s   e   t   W   i   n   d   o   w   T   i   t   l   e   "   ]       =   =       "   u   n   d   e   f   i   n   e   d   "   ,       "   M   o   d   u   l   e   .   s   e   t   W   i   n   d   o   w   T   i   t   l   e       o   p   t   i   o   n       w   a   s       r   e   m   o   v   e   d       (   m   o   d   i   f   y       e   m   s   c   r   i   p   t   e   n   _   s   e   t   _   w   i   n   d   o   w   _   t   i   t   l   e       i   n       J   S   )   "   )   ;   
           a   s   s   e   r   t   (   t   y   p   e   o   f       M   o   d   u   l   e   [   "   T   O   T   A   L   _   M   E   M   O   R   Y   "   ]       =   =       "   u   n   d   e   f   i   n   e   d   "   ,       "   M   o   d   u   l   e   .   T   O   T   A   L   _   M   E   M   O   R   Y       h   a   s       b   e   e   n       r   e   n   a   m   e   d       M   o   d   u   l   e   .   I   N   I   T   I   A   L   _   M   E   M   O   R   Y   "   )   ;   
           a   s   s   e   r   t   (   t   y   p   e   o   f       M   o   d   u   l   e   [   "   E   N   V   I   R   O   N   M   E   N   T   "   ]       =   =       "   u   n   d   e   f   i   n   e   d   "   ,       "   M   o   d   u   l   e   .   E   N   V   I   R   O   N   M   E   N   T       h   a   s       b   e   e   n       d   e   p   r   e   c   a   t   e   d   .       T   o       f   o   r   c   e       t   h   e       e   n   v   i   r   o   n   m   e   n   t   ,       u   s   e       t   h   e       E   N   V   I   R   O   N   M   E   N   T       c   o   m   p   i   l   e   -   t   i   m   e       o   p   t   i   o   n       (   f   o   r       e   x   a   m   p   l   e   ,       -   s   E   N   V   I   R   O   N   M   E   N   T   =   w   e   b       o   r       -   s   E   N   V   I   R   O   N   M   E   N   T   =   n   o   d   e   )   "   )   ;   
           a   s   s   e   r   t   (   t   y   p   e   o   f       M   o   d   u   l   e   [   "   S   T   A   C   K   _   S   I   Z   E   "   ]       =   =       "   u   n   d   e   f   i   n   e   d   "   ,       "   S   T   A   C   K   _   S   I   Z   E       c   a   n       n   o       l   o   n   g   e   r       b   e       s   e   t       a   t       r   u   n   t   i   m   e   .           U   s   e       -   s   S   T   A   C   K   _   S   I   Z   E       a   t       l   i   n   k       t   i   m   e   "   )   ;   
   }   
   
   /   /       B   e   g   i   n       r   u   n   t   i   m   e       e   x   p   o   r   t   s   
   M   o   d   u   l   e   [   "   a   d   d   R   u   n   D   e   p   e   n   d   e   n   c   y   "   ]       =       a   d   d   R   u   n   D   e   p   e   n   d   e   n   c   y   ;   
   
   M   o   d   u   l   e   [   "   r   e   m   o   v   e   R   u   n   D   e   p   e   n   d   e   n   c   y   "   ]       =       r   e   m   o   v   e   R   u   n   D   e   p   e   n   d   e   n   c   y   ;   
   
   M   o   d   u   l   e   [   "   c   c   a   l   l   "   ]       =       c   c   a   l   l   ;   
   
   M   o   d   u   l   e   [   "   F   S   _   c   r   e   a   t   e   P   r   e   l   o   a   d   e   d   F   i   l   e   "   ]       =       F   S   _   c   r   e   a   t   e   P   r   e   l   o   a   d   e   d   F   i   l   e   ;   
   
   M   o   d   u   l   e   [   "   F   S   _   u   n   l   i   n   k   "   ]       =       F   S   _   u   n   l   i   n   k   ;   
   
   M   o   d   u   l   e   [   "   F   S   _   c   r   e   a   t   e   P   a   t   h   "   ]       =       F   S   _   c   r   e   a   t   e   P   a   t   h   ;   
   
   M   o   d   u   l   e   [   "   F   S   _   c   r   e   a   t   e   D   a   t   a   F   i   l   e   "   ]       =       F   S   _   c   r   e   a   t   e   D   a   t   a   F   i   l   e   ;   
   
   v   a   r       m   i   s   s   i   n   g   L   i   b   r   a   r   y   S   y   m   b   o   l   s       =       [       "   w   r   i   t   e   I   5   3   T   o   I   6   4   C   l   a   m   p   e   d   "   ,       "   w   r   i   t   e   I   5   3   T   o   I   6   4   S   i   g   n   a   l   i   n   g   "   ,       "   w   r   i   t   e   I   5   3   T   o   U   6   4   C   l   a   m   p   e   d   "   ,       "   w   r   i   t   e   I   5   3   T   o   U   6   4   S   i   g   n   a   l   i   n   g   "   ,       "   c   o   n   v   e   r   t   I   3   2   P   a   i   r   T   o   I   5   3   "   ,       "   c   o   n   v   e   r   t   I   3   2   P   a   i   r   T   o   I   5   3   C   h   e   c   k   e   d   "   ,       "   c   o   n   v   e   r   t   U   3   2   P   a   i   r   T   o   I   5   3   "   ,       "   g   e   t   T   e   m   p   R   e   t   0   "   ,       "   z   e   r   o   M   e   m   o   r   y   "   ,       "   s   t   r   E   r   r   o   r   "   ,       "   i   n   e   t   P   t   o   n   4   "   ,       "   i   n   e   t   N   t   o   p   4   "   ,       "   i   n   e   t   P   t   o   n   6   "   ,       "   i   n   e   t   N   t   o   p   6   "   ,       "   r   e   a   d   S   o   c   k   a   d   d   r   "   ,       "   w   r   i   t   e   S   o   c   k   a   d   d   r   "   ,       "   r   u   n   M   a   i   n   T   h   r   e   a   d   E   m   A   s   m   "   ,       "   a   u   t   o   R   e   s   u   m   e   A   u   d   i   o   C   o   n   t   e   x   t   "   ,       "   g   e   t   D   y   n   C   a   l   l   e   r   "   ,       "   d   y   n   C   a   l   l   "   ,       "   a   s   m   j   s   M   a   n   g   l   e   "   ,       "   m   m   a   p   A   l   l   o   c   "   ,       "   H   a   n   d   l   e   A   l   l   o   c   a   t   o   r   "   ,       "   g   e   t   N   a   t   i   v   e   T   y   p   e   S   i   z   e   "   ,       "   a   d   d   O   n   I   n   i   t   "   ,       "   a   d   d   O   n   P   o   s   t   C   t   o   r   "   ,       "   a   d   d   O   n   P   r   e   M   a   i   n   "   ,       "   a   d   d   O   n   E   x   i   t   "   ,       "   S   T   A   C   K   _   S   I   Z   E   "   ,       "   S   T   A   C   K   _   A   L   I   G   N   "   ,       "   P   O   I   N   T   E   R   _   S   I   Z   E   "   ,       "   A   S   S   E   R   T   I   O   N   S   "   ,       "   c   w   r   a   p   "   ,       "   u   l   e   b   1   2   8   E   n   c   o   d   e   "   ,       "   s   i   g   T   o   W   a   s   m   T   y   p   e   s   "   ,       "   g   e   n   e   r   a   t   e   F   u   n   c   T   y   p   e   "   ,       "   c   o   n   v   e   r   t   J   s   F   u   n   c   t   i   o   n   T   o   W   a   s   m   "   ,       "   g   e   t   E   m   p   t   y   T   a   b   l   e   S   l   o   t   "   ,       "   u   p   d   a   t   e   T   a   b   l   e   M   a   p   "   ,       "   g   e   t   F   u   n   c   t   i   o   n   A   d   d   r   e   s   s   "   ,       "   a   d   d   F   u   n   c   t   i   o   n   "   ,       "   r   e   m   o   v   e   F   u   n   c   t   i   o   n   "   ,       "   i   n   t   A   r   r   a   y   T   o   S   t   r   i   n   g   "   ,       "   s   t   r   i   n   g   T   o   A   s   c   i   i   "   ,       "   r   e   g   i   s   t   e   r   K   e   y   E   v   e   n   t   C   a   l   l   b   a   c   k   "   ,       "   g   e   t   B   o   u   n   d   i   n   g   C   l   i   e   n   t   R   e   c   t   "   ,       "   f   i   l   l   M   o   u   s   e   E   v   e   n   t   D   a   t   a   "   ,       "   r   e   g   i   s   t   e   r   M   o   u   s   e   E   v   e   n   t   C   a   l   l   b   a   c   k   "   ,       "   r   e   g   i   s   t   e   r   W   h   e   e   l   E   v   e   n   t   C   a   l   l   b   a   c   k   "   ,       "   r   e   g   i   s   t   e   r   U   i   E   v   e   n   t   C   a   l   l   b   a   c   k   "   ,       "   r   e   g   i   s   t   e   r   F   o   c   u   s   E   v   e   n   t   C   a   l   l   b   a   c   k   "   ,       "   f   i   l   l   D   e   v   i   c   e   O   r   i   e   n   t   a   t   i   o   n   E   v   e   n   t   D   a   t   a   "   ,       "   r   e   g   i   s   t   e   r   D   e   v   i   c   e   O   r   i   e   n   t   a   t   i   o   n   E   v   e   n   t   C   a   l   l   b   a   c   k   "   ,       "   f   i   l   l   D   e   v   i   c   e   M   o   t   i   o   n   E   v   e   n   t   D   a   t   a   "   ,       "   r   e   g   i   s   t   e   r   D   e   v   i   c   e   M   o   t   i   o   n   E   v   e   n   t   C   a   l   l   b   a   c   k   "   ,       "   s   c   r   e   e   n   O   r   i   e   n   t   a   t   i   o   n   "   ,       "   f   i   l   l   O   r   i   e   n   t   a   t   i   o   n   C   h   a   n   g   e   E   v   e   n   t   D   a   t   a   "   ,       "   r   e   g   i   s   t   e   r   O   r   i   e   n   t   a   t   i   o   n   C   h   a   n   g   e   E   v   e   n   t   C   a   l   l   b   a   c   k   "   ,       "   f   i   l   l   F   u   l   l   s   c   r   e   e   n   C   h   a   n   g   e   E   v   e   n   t   D   a   t   a   "   ,       "   r   e   g   i   s   t   e   r   F   u   l   l   s   c   r   e   e   n   C   h   a   n   g   e   E   v   e   n   t   C   a   l   l   b   a   c   k   "   ,       "   J   S   E   v   e   n   t   s   _   r   e   q   u   e   s   t   F   u   l   l   s   c   r   e   e   n   "   ,       "   J   S   E   v   e   n   t   s   _   r   e   s   i   z   e   C   a   n   v   a   s   F   o   r   F   u   l   l   s   c   r   e   e   n   "   ,       "   r   e   g   i   s   t   e   r   R   e   s   t   o   r   e   O   l   d   S   t   y   l   e   "   ,       "   h   i   d   e   E   v   e   r   y   t   h   i   n   g   E   x   c   e   p   t   G   i   v   e   n   E   l   e   m   e   n   t   "   ,       "   r   e   s   t   o   r   e   H   i   d   d   e   n   E   l   e   m   e   n   t   s   "   ,       "   s   e   t   L   e   t   t   e   r   b   o   x   "   ,       "   s   o   f   t   F   u   l   l   s   c   r   e   e   n   R   e   s   i   z   e   W   e   b   G   L   R   e   n   d   e   r   T   a   r   g   e   t   "   ,       "   d   o   R   e   q   u   e   s   t   F   u   l   l   s   c   r   e   e   n   "   ,       "   f   i   l   l   P   o   i   n   t   e   r   l   o   c   k   C   h   a   n   g   e   E   v   e   n   t   D   a   t   a   "   ,       "   r   e   g   i   s   t   e   r   P   o   i   n   t   e   r   l   o   c   k   C   h   a   n   g   e   E   v   e   n   t   C   a   l   l   b   a   c   k   "   ,       "   r   e   g   i   s   t   e   r   P   o   i   n   t   e   r   l   o   c   k   E   r   r   o   r   E   v   e   n   t   C   a   l   l   b   a   c   k   "   ,       "   r   e   q   u   e   s   t   P   o   i   n   t   e   r   L   o   c   k   "   ,       "   f   i   l   l   V   i   s   i   b   i   l   i   t   y   C   h   a   n   g   e   E   v   e   n   t   D   a   t   a   "   ,       "   r   e   g   i   s   t   e   r   V   i   s   i   b   i   l   i   t   y   C   h   a   n   g   e   E   v   e   n   t   C   a   l   l   b   a   c   k   "   ,       "   r   e   g   i   s   t   e   r   T   o   u   c   h   E   v   e   n   t   C   a   l   l   b   a   c   k   "   ,       "   f   i   l   l   G   a   m   e   p   a   d   E   v   e   n   t   D   a   t   a   "   ,       "   r   e   g   i   s   t   e   r   G   a   m   e   p   a   d   E   v   e   n   t   C   a   l   l   b   a   c   k   "   ,       "   r   e   g   i   s   t   e   r   B   e   f   o   r   e   U   n   l   o   a   d   E   v   e   n   t   C   a   l   l   b   a   c   k   "   ,       "   f   i   l   l   B   a   t   t   e   r   y   E   v   e   n   t   D   a   t   a   "   ,       "   b   a   t   t   e   r   y   "   ,       "   r   e   g   i   s   t   e   r   B   a   t   t   e   r   y   E   v   e   n   t   C   a   l   l   b   a   c   k   "   ,       "   s   e   t   C   a   n   v   a   s   E   l   e   m   e   n   t   S   i   z   e   C   a   l   l   i   n   g   T   h   r   e   a   d   "   ,       "   s   e   t   C   a   n   v   a   s   E   l   e   m   e   n   t   S   i   z   e   M   a   i   n   T   h   r   e   a   d   "   ,       "   s   e   t   C   a   n   v   a   s   E   l   e   m   e   n   t   S   i   z   e   "   ,       "   g   e   t   C   a   n   v   a   s   S   i   z   e   C   a   l   l   i   n   g   T   h   r   e   a   d   "   ,       "   g   e   t   C   a   n   v   a   s   S   i   z   e   M   a   i   n   T   h   r   e   a   d   "   ,       "   g   e   t   C   a   n   v   a   s   E   l   e   m   e   n   t   S   i   z   e   "   ,       "   j   s   S   t   a   c   k   T   r   a   c   e   "   ,       "   g   e   t   C   a   l   l   s   t   a   c   k   "   ,       "   c   o   n   v   e   r   t   P   C   t   o   S   o   u   r   c   e   L   o   c   a   t   i   o   n   "   ,       "   f   l   u   s   h   _   N   O   _   F   I   L   E   S   Y   S   T   E   M   "   ,       "   w   a   s   i   R   i   g   h   t   s   T   o   M   u   s   l   O   F   l   a   g   s   "   ,       "   w   a   s   i   O   F   l   a   g   s   T   o   M   u   s   l   O   F   l   a   g   s   "   ,       "   s   e   t   I   m   m   e   d   i   a   t   e   W   r   a   p   p   e   d   "   ,       "   s   a   f   e   R   e   q   u   e   s   t   A   n   i   m   a   t   i   o   n   F   r   a   m   e   "   ,       "   c   l   e   a   r   I   m   m   e   d   i   a   t   e   W   r   a   p   p   e   d   "   ,       "   r   e   g   i   s   t   e   r   P   o   s   t   M   a   i   n   L   o   o   p   "   ,       "   g   e   t   P   r   o   m   i   s   e   "   ,       "   m   a   k   e   P   r   o   m   i   s   e   "   ,       "   i   d   s   T   o   P   r   o   m   i   s   e   s   "   ,       "   m   a   k   e   P   r   o   m   i   s   e   C   a   l   l   b   a   c   k   "   ,       "   B   r   o   w   s   e   r   _   a   s   y   n   c   P   r   e   p   a   r   e   D   a   t   a   C   o   u   n   t   e   r   "   ,       "   i   s   L   e   a   p   Y   e   a   r   "   ,       "   y   d   a   y   F   r   o   m   D   a   t   e   "   ,       "   a   r   r   a   y   S   u   m   "   ,       "   a   d   d   D   a   y   s   "   ,       "   w   a   s   m   f   s   N   o   d   e   C   o   n   v   e   r   t   N   o   d   e   C   o   d   e   "   ,       "   w   a   s   m   f   s   T   r   y   "   ,       "   w   a   s   m   f   s   N   o   d   e   F   i   x   S   t   a   t   "   ,       "   w   a   s   m   f   s   N   o   d   e   L   s   t   a   t   "   ,       "   w   a   s   m   f   s   N   o   d   e   F   s   t   a   t   "   ,       "   w   a   s   m   f   s   O   P   F   S   P   r   o   x   y   F   i   n   i   s   h   "   ,       "   w   a   s   m   f   s   O   P   F   S   G   e   t   O   r   C   r   e   a   t   e   F   i   l   e   "   ,       "   w   a   s   m   f   s   O   P   F   S   G   e   t   O   r   C   r   e   a   t   e   D   i   r   "   ,       "   w   r   i   t   e   G   L   A   r   r   a   y   "   ,       "   e   m   s   c   r   i   p   t   e   n   _   w   e   b   g   l   _   d   e   s   t   r   o   y   _   c   o   n   t   e   x   t   _   b   e   f   o   r   e   _   o   n   _   c   a   l   l   i   n   g   _   t   h   r   e   a   d   "   ,       "   r   e   g   i   s   t   e   r   W   e   b   G   l   E   v   e   n   t   C   a   l   l   b   a   c   k   "   ,       "   r   u   n   A   n   d   A   b   o   r   t   I   f   E   r   r   o   r   "   ,       "   A   L   L   O   C   _   N   O   R   M   A   L   "   ,       "   A   L   L   O   C   _   S   T   A   C   K   "   ,       "   a   l   l   o   c   a   t   e   "   ,       "   w   r   i   t   e   S   t   r   i   n   g   T   o   M   e   m   o   r   y   "   ,       "   w   r   i   t   e   A   s   c   i   i   T   o   M   e   m   o   r   y   "   ,       "   d   e   m   a   n   g   l   e   "   ,       "   s   t   a   c   k   T   r   a   c   e   "   ,       "   g   e   t   F   u   n   c   t   i   o   n   A   r   g   s   N   a   m   e   "   ,       "   c   r   e   a   t   e   J   s   I   n   v   o   k   e   r   S   i   g   n   a   t   u   r   e   "   ,       "   P   u   r   e   V   i   r   t   u   a   l   E   r   r   o   r   "   ,       "   g   e   t   B   a   s   e   s   t   P   o   i   n   t   e   r   "   ,       "   r   e   g   i   s   t   e   r   I   n   h   e   r   i   t   e   d   I   n   s   t   a   n   c   e   "   ,       "   u   n   r   e   g   i   s   t   e   r   I   n   h   e   r   i   t   e   d   I   n   s   t   a   n   c   e   "   ,       "   g   e   t   I   n   h   e   r   i   t   e   d   I   n   s   t   a   n   c   e   "   ,       "   g   e   t   I   n   h   e   r   i   t   e   d   I   n   s   t   a   n   c   e   C   o   u   n   t   "   ,       "   g   e   t   L   i   v   e   I   n   h   e   r   i   t   e   d   I   n   s   t   a   n   c   e   s   "   ,       "   e   n   u   m   R   e   a   d   V   a   l   u   e   F   r   o   m   P   o   i   n   t   e   r   "   ,       "   g   e   n   e   r   i   c   P   o   i   n   t   e   r   T   o   W   i   r   e   T   y   p   e   "   ,       "   c   o   n   s   t   N   o   S   m   a   r   t   P   t   r   R   a   w   P   o   i   n   t   e   r   T   o   W   i   r   e   T   y   p   e   "   ,       "   n   o   n   C   o   n   s   t   N   o   S   m   a   r   t   P   t   r   R   a   w   P   o   i   n   t   e   r   T   o   W   i   r   e   T   y   p   e   "   ,       "   i   n   i   t   _   R   e   g   i   s   t   e   r   e   d   P   o   i   n   t   e   r   "   ,       "   R   e   g   i   s   t   e   r   e   d   P   o   i   n   t   e   r   "   ,       "   R   e   g   i   s   t   e   r   e   d   P   o   i   n   t   e   r   _   f   r   o   m   W   i   r   e   T   y   p   e   "   ,       "   r   u   n   D   e   s   t   r   u   c   t   o   r   "   ,       "   r   e   l   e   a   s   e   C   l   a   s   s   H   a   n   d   l   e   "   ,       "   d   e   t   a   c   h   F   i   n   a   l   i   z   e   r   "   ,       "   a   t   t   a   c   h   F   i   n   a   l   i   z   e   r   "   ,       "   m   a   k   e   C   l   a   s   s   H   a   n   d   l   e   "   ,       "   i   n   i   t   _   C   l   a   s   s   H   a   n   d   l   e   "   ,       "   C   l   a   s   s   H   a   n   d   l   e   "   ,       "   t   h   r   o   w   I   n   s   t   a   n   c   e   A   l   r   e   a   d   y   D   e   l   e   t   e   d   "   ,       "   f   l   u   s   h   P   e   n   d   i   n   g   D   e   l   e   t   e   s   "   ,       "   s   e   t   D   e   l   a   y   F   u   n   c   t   i   o   n   "   ,       "   R   e   g   i   s   t   e   r   e   d   C   l   a   s   s   "   ,       "   s   h   a   l   l   o   w   C   o   p   y   I   n   t   e   r   n   a   l   P   o   i   n   t   e   r   "   ,       "   d   o   w   n   c   a   s   t   P   o   i   n   t   e   r   "   ,       "   u   p   c   a   s   t   P   o   i   n   t   e   r   "   ,       "   v   a   l   i   d   a   t   e   T   h   i   s   "   ,       "   c   h   a   r   _   0   "   ,       "   c   h   a   r   _   9   "   ,       "   m   a   k   e   L   e   g   a   l   F   u   n   c   t   i   o   n   N   a   m   e   "   ,       "   c   o   u   n   t   _   e   m   v   a   l   _   h   a   n   d   l   e   s   "   ,       "   e   m   v   a   l   _   g   e   t   _   g   l   o   b   a   l   "   ,       "   e   m   v   a   l   _   l   o   o   k   u   p   T   y   p   e   s   "   ,       "   e   m   v   a   l   _   a   d   d   M   e   t   h   o   d   C   a   l   l   e   r   "       ]   ;   
   
   m   i   s   s   i   n   g   L   i   b   r   a   r   y   S   y   m   b   o   l   s   .   f   o   r   E   a   c   h   (   m   i   s   s   i   n   g   L   i   b   r   a   r   y   S   y   m   b   o   l   )   ;   
   
   v   a   r       u   n   e   x   p   o   r   t   e   d   S   y   m   b   o   l   s       =       [       "   r   u   n   "   ,       "   o   u   t   "   ,       "   e   r   r   "   ,       "   c   a   l   l   M   a   i   n   "   ,       "   a   b   o   r   t   "   ,       "   w   a   s   m   M   e   m   o   r   y   "   ,       "   w   a   s   m   E   x   p   o   r   t   s   "   ,       "   H   E   A   P   F   3   2   "   ,       "   H   E   A   P   F   6   4   "   ,       "   H   E   A   P   8   "   ,       "   H   E   A   P   U   8   "   ,       "   H   E   A   P   1   6   "   ,       "   H   E   A   P   U   1   6   "   ,       "   H   E   A   P   3   2   "   ,       "   H   E   A   P   U   3   2   "   ,       "   H   E   A   P   6   4   "   ,       "   H   E   A   P   U   6   4   "   ,       "   w   r   i   t   e   S   t   a   c   k   C   o   o   k   i   e   "   ,       "   c   h   e   c   k   S   t   a   c   k   C   o   o   k   i   e   "   ,       "   w   r   i   t   e   I   5   3   T   o   I   6   4   "   ,       "   r   e   a   d   I   5   3   F   r   o   m   I   6   4   "   ,       "   r   e   a   d   I   5   3   F   r   o   m   U   6   4   "   ,       "   I   N   T   5   3   _   M   A   X   "   ,       "   I   N   T   5   3   _   M   I   N   "   ,       "   b   i   g   i   n   t   T   o   I   5   3   C   h   e   c   k   e   d   "   ,       "   s   t   a   c   k   S   a   v   e   "   ,       "   s   t   a   c   k   R   e   s   t   o   r   e   "   ,       "   s   t   a   c   k   A   l   l   o   c   "   ,       "   s   e   t   T   e   m   p   R   e   t   0   "   ,       "   p   t   r   T   o   S   t   r   i   n   g   "   ,       "   e   x   i   t   J   S   "   ,       "   g   e   t   H   e   a   p   M   a   x   "   ,       "   g   r   o   w   M   e   m   o   r   y   "   ,       "   E   N   V   "   ,       "   w   i   t   h   S   t   a   c   k   S   a   v   e   "   ,       "   E   R   R   N   O   _   C   O   D   E   S   "   ,       "   D   N   S   "   ,       "   P   r   o   t   o   c   o   l   s   "   ,       "   S   o   c   k   e   t   s   "   ,       "   t   i   m   e   r   s   "   ,       "   w   a   r   n   O   n   c   e   "   ,       "   r   e   a   d   E   m   A   s   m   A   r   g   s   A   r   r   a   y   "   ,       "   r   e   a   d   E   m   A   s   m   A   r   g   s   "   ,       "   r   u   n   E   m   A   s   m   F   u   n   c   t   i   o   n   "   ,       "   j   s   t   o   i   _   q   "   ,       "   g   e   t   E   x   e   c   u   t   a   b   l   e   N   a   m   e   "   ,       "   h   a   n   d   l   e   E   x   c   e   p   t   i   o   n   "   ,       "   k   e   e   p   R   u   n   t   i   m   e   A   l   i   v   e   "   ,       "   r   u   n   t   i   m   e   K   e   e   p   a   l   i   v   e   P   u   s   h   "   ,       "   r   u   n   t   i   m   e   K   e   e   p   a   l   i   v   e   P   o   p   "   ,       "   c   a   l   l   U   s   e   r   C   a   l   l   b   a   c   k   "   ,       "   m   a   y   b   e   E   x   i   t   "   ,       "   a   s   y   n   c   L   o   a   d   "   ,       "   a   l   i   g   n   M   e   m   o   r   y   "   ,       "   w   a   s   m   T   a   b   l   e   "   ,       "   g   e   t   U   n   i   q   u   e   R   u   n   D   e   p   e   n   d   e   n   c   y   "   ,       "   n   o   E   x   i   t   R   u   n   t   i   m   e   "   ,       "   a   d   d   O   n   P   r   e   R   u   n   "   ,       "   a   d   d   O   n   P   o   s   t   R   u   n   "   ,       "   f   r   e   e   T   a   b   l   e   I   n   d   e   x   e   s   "   ,       "   f   u   n   c   t   i   o   n   s   I   n   T   a   b   l   e   M   a   p   "   ,       "   s   e   t   V   a   l   u   e   "   ,       "   g   e   t   V   a   l   u   e   "   ,       "   P   A   T   H   "   ,       "   P   A   T   H   _   F   S   "   ,       "   U   T   F   8   D   e   c   o   d   e   r   "   ,       "   U   T   F   8   A   r   r   a   y   T   o   S   t   r   i   n   g   "   ,       "   U   T   F   8   T   o   S   t   r   i   n   g   "   ,       "   s   t   r   i   n   g   T   o   U   T   F   8   A   r   r   a   y   "   ,       "   s   t   r   i   n   g   T   o   U   T   F   8   "   ,       "   l   e   n   g   t   h   B   y   t   e   s   U   T   F   8   "   ,       "   i   n   t   A   r   r   a   y   F   r   o   m   S   t   r   i   n   g   "   ,       "   A   s   c   i   i   T   o   S   t   r   i   n   g   "   ,       "   U   T   F   1   6   D   e   c   o   d   e   r   "   ,       "   U   T   F   1   6   T   o   S   t   r   i   n   g   "   ,       "   s   t   r   i   n   g   T   o   U   T   F   1   6   "   ,       "   l   e   n   g   t   h   B   y   t   e   s   U   T   F   1   6   "   ,       "   U   T   F   3   2   T   o   S   t   r   i   n   g   "   ,       "   s   t   r   i   n   g   T   o   U   T   F   3   2   "   ,       "   l   e   n   g   t   h   B   y   t   e   s   U   T   F   3   2   "   ,       "   s   t   r   i   n   g   T   o   N   e   w   U   T   F   8   "   ,       "   s   t   r   i   n   g   T   o   U   T   F   8   O   n   S   t   a   c   k   "   ,       "   w   r   i   t   e   A   r   r   a   y   T   o   M   e   m   o   r   y   "   ,       "   J   S   E   v   e   n   t   s   "   ,       "   s   p   e   c   i   a   l   H   T   M   L   T   a   r   g   e   t   s   "   ,       "   m   a   y   b   e   C   S   t   r   i   n   g   T   o   J   s   S   t   r   i   n   g   "   ,       "   f   i   n   d   E   v   e   n   t   T   a   r   g   e   t   "   ,       "   f   i   n   d   C   a   n   v   a   s   E   v   e   n   t   T   a   r   g   e   t   "   ,       "   c   u   r   r   e   n   t   F   u   l   l   s   c   r   e   e   n   S   t   r   a   t   e   g   y   "   ,       "   r   e   s   t   o   r   e   O   l   d   W   i   n   d   o   w   e   d   S   t   y   l   e   "   ,       "   U   N   W   I   N   D   _   C   A   C   H   E   "   ,       "   E   x   i   t   S   t   a   t   u   s   "   ,       "   g   e   t   E   n   v   S   t   r   i   n   g   s   "   ,       "   c   h   e   c   k   W   a   s   i   C   l   o   c   k   "   ,       "   i   n   i   t   R   a   n   d   o   m   F   i   l   l   "   ,       "   r   a   n   d   o   m   F   i   l   l   "   ,       "   s   a   f   e   S   e   t   T   i   m   e   o   u   t   "   ,       "   e   m   S   e   t   I   m   m   e   d   i   a   t   e   "   ,       "   e   m   C   l   e   a   r   I   m   m   e   d   i   a   t   e   _   d   e   p   s   "   ,       "   e   m   C   l   e   a   r   I   m   m   e   d   i   a   t   e   "   ,       "   r   e   g   i   s   t   e   r   P   r   e   M   a   i   n   L   o   o   p   "   ,       "   p   r   o   m   i   s   e   M   a   p   "   ,       "   u   n   c   a   u   g   h   t   E   x   c   e   p   t   i   o   n   C   o   u   n   t   "   ,       "   e   x   c   e   p   t   i   o   n   L   a   s   t   "   ,       "   e   x   c   e   p   t   i   o   n   C   a   u   g   h   t   "   ,       "   E   x   c   e   p   t   i   o   n   I   n   f   o   "   ,       "   f   i   n   d   M   a   t   c   h   i   n   g   C   a   t   c   h   "   ,       "   B   r   o   w   s   e   r   "   ,       "   r   e   q   u   e   s   t   F   u   l   l   s   c   r   e   e   n   "   ,       "   r   e   q   u   e   s   t   F   u   l   l   S   c   r   e   e   n   "   ,       "   s   e   t   C   a   n   v   a   s   S   i   z   e   "   ,       "   g   e   t   U   s   e   r   M   e   d   i   a   "   ,       "   c   r   e   a   t   e   C   o   n   t   e   x   t   "   ,       "   g   e   t   P   r   e   l   o   a   d   e   d   I   m   a   g   e   D   a   t   a   _   _   d   a   t   a   "   ,       "   w   g   e   t   "   ,       "   M   O   N   T   H   _   D   A   Y   S   _   R   E   G   U   L   A   R   "   ,       "   M   O   N   T   H   _   D   A   Y   S   _   L   E   A   P   "   ,       "   M   O   N   T   H   _   D   A   Y   S   _   R   E   G   U   L   A   R   _   C   U   M   U   L   A   T   I   V   E   "   ,       "   M   O   N   T   H   _   D   A   Y   S   _   L   E   A   P   _   C   U   M   U   L   A   T   I   V   E   "   ,       "   p   r   e   l   o   a   d   P   l   u   g   i   n   s   "   ,       "   F   S   _   m   o   d   e   S   t   r   i   n   g   T   o   F   l   a   g   s   "   ,       "   F   S   _   g   e   t   M   o   d   e   "   ,       "   F   S   _   s   t   d   i   n   _   g   e   t   C   h   a   r   _   b   u   f   f   e   r   "   ,       "   F   S   _   s   t   d   i   n   _   g   e   t   C   h   a   r   "   ,       "   F   S   _   c   r   e   a   t   e   D   e   v   i   c   e   "   ,       "   F   S   _   r   e   a   d   F   i   l   e   "   ,       "   M   E   M   F   S   "   ,       "   w   a   s   m   F   S   P   r   e   l   o   a   d   e   d   F   i   l   e   s   "   ,       "   w   a   s   m   F   S   P   r   e   l   o   a   d   e   d   D   i   r   s   "   ,       "   w   a   s   m   F   S   P   r   e   l   o   a   d   i   n   g   F   l   u   s   h   e   d   "   ,       "   w   a   s   m   F   S   D   e   v   i   c   e   s   "   ,       "   w   a   s   m   F   S   D   e   v   i   c   e   S   t   r   e   a   m   s   "   ,       "   F   S   "   ,       "   F   S   _   m   k   n   o   d   "   ,       "   F   S   _   c   r   e   a   t   e   "   ,       "   F   S   _   w   r   i   t   e   F   i   l   e   "   ,       "   F   S   _   m   k   d   i   r   "   ,       "   F   S   _   m   k   d   i   r   T   r   e   e   "   ,       "   w   a   s   m   F   S   $   J   S   M   e   m   o   r   y   F   i   l   e   s   "   ,       "   w   a   s   m   F   S   $   b   a   c   k   e   n   d   s   "   ,       "   w   a   s   m   F   S   $   J   S   M   e   m   o   r   y   R   a   n   g   e   s   "   ,       "   w   a   s   m   f   s   N   o   d   e   I   s   W   i   n   d   o   w   s   "   ,       "   w   a   s   m   f   s   O   P   F   S   D   i   r   e   c   t   o   r   y   H   a   n   d   l   e   s   "   ,       "   w   a   s   m   f   s   O   P   F   S   F   i   l   e   H   a   n   d   l   e   s   "   ,       "   w   a   s   m   f   s   O   P   F   S   A   c   c   e   s   s   H   a   n   d   l   e   s   "   ,       "   w   a   s   m   f   s   O   P   F   S   B   l   o   b   s   "   ,       "   t   e   m   p   F   i   x   e   d   L   e   n   g   t   h   A   r   r   a   y   "   ,       "   m   i   n   i   T   e   m   p   W   e   b   G   L   F   l   o   a   t   B   u   f   f   e   r   s   "   ,       "   m   i   n   i   T   e   m   p   W   e   b   G   L   I   n   t   B   u   f   f   e   r   s   "   ,       "   h   e   a   p   O   b   j   e   c   t   F   o   r   W   e   b   G   L   T   y   p   e   "   ,       "   t   o   T   y   p   e   d   A   r   r   a   y   I   n   d   e   x   "   ,       "   w   e   b   g   l   _   e   n   a   b   l   e   _   W   E   B   G   L   _   m   u   l   t   i   _   d   r   a   w   "   ,       "   w   e   b   g   l   _   e   n   a   b   l   e   _   E   X   T   _   p   o   l   y   g   o   n   _   o   f   f   s   e   t   _   c   l   a   m   p   "   ,       "   w   e   b   g   l   _   e   n   a   b   l   e   _   E   X   T   _   c   l   i   p   _   c   o   n   t   r   o   l   "   ,       "   w   e   b   g   l   _   e   n   a   b   l   e   _   W   E   B   G   L   _   p   o   l   y   g   o   n   _   m   o   d   e   "   ,       "   G   L   "   ,       "   e   m   s   c   r   i   p   t   e   n   W   e   b   G   L   G   e   t   "   ,       "   c   o   m   p   u   t   e   U   n   p   a   c   k   A   l   i   g   n   e   d   I   m   a   g   e   S   i   z   e   "   ,       "   c   o   l   o   r   C   h   a   n   n   e   l   s   I   n   G   l   T   e   x   t   u   r   e   F   o   r   m   a   t   "   ,       "   e   m   s   c   r   i   p   t   e   n   W   e   b   G   L   G   e   t   T   e   x   P   i   x   e   l   D   a   t   a   "   ,       "   e   m   s   c   r   i   p   t   e   n   W   e   b   G   L   G   e   t   U   n   i   f   o   r   m   "   ,       "   w   e   b   g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   "   ,       "   w   e   b   g   l   P   r   e   p   a   r   e   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   s   B   e   f   o   r   e   F   i   r   s   t   U   s   e   "   ,       "   w   e   b   g   l   G   e   t   L   e   f   t   B   r   a   c   e   P   o   s   "   ,       "   e   m   s   c   r   i   p   t   e   n   W   e   b   G   L   G   e   t   V   e   r   t   e   x   A   t   t   r   i   b   "   ,       "   _   _   g   l   G   e   t   A   c   t   i   v   e   A   t   t   r   i   b   O   r   U   n   i   f   o   r   m   "   ,       "   e   m   s   c   r   i   p   t   e   n   W   e   b   G   L   G   e   t   B   u   f   f   e   r   B   i   n   d   i   n   g   "   ,       "   e   m   s   c   r   i   p   t   e   n   W   e   b   G   L   V   a   l   i   d   a   t   e   M   a   p   B   u   f   f   e   r   T   a   r   g   e   t   "   ,       "   A   L   "   ,       "   G   L   U   T   "   ,       "   E   G   L   "   ,       "   G   L   E   W   "   ,       "   I   D   B   S   t   o   r   e   "   ,       "   S   D   L   "   ,       "   S   D   L   _   g   f   x   "   ,       "   e   m   s   c   r   i   p   t   e   n   W   e   b   G   L   G   e   t   I   n   d   e   x   e   d   "   ,       "   w   e   b   g   l   _   e   n   a   b   l   e   _   W   E   B   G   L   _   d   r   a   w   _   i   n   s   t   a   n   c   e   d   _   b   a   s   e   _   v   e   r   t   e   x   _   b   a   s   e   _   i   n   s   t   a   n   c   e   "   ,       "   w   e   b   g   l   _   e   n   a   b   l   e   _   W   E   B   G   L   _   m   u   l   t   i   _   d   r   a   w   _   i   n   s   t   a   n   c   e   d   _   b   a   s   e   _   v   e   r   t   e   x   _   b   a   s   e   _   i   n   s   t   a   n   c   e   "   ,       "   a   l   l   o   c   a   t   e   U   T   F   8   "   ,       "   a   l   l   o   c   a   t   e   U   T   F   8   O   n   S   t   a   c   k   "   ,       "   p   r   i   n   t   "   ,       "   p   r   i   n   t   E   r   r   "   ,       "   j   s   t   o   i   _   s   "   ,       "   P   T   h   r   e   a   d   "   ,       "   t   e   r   m   i   n   a   t   e   W   o   r   k   e   r   "   ,       "   c   l   e   a   n   u   p   T   h   r   e   a   d   "   ,       "   r   e   g   i   s   t   e   r   T   L   S   I   n   i   t   "   ,       "   s   p   a   w   n   T   h   r   e   a   d   "   ,       "   e   x   i   t   O   n   M   a   i   n   T   h   r   e   a   d   "   ,       "   p   r   o   x   y   T   o   M   a   i   n   T   h   r   e   a   d   "   ,       "   p   r   o   x   i   e   d   J   S   C   a   l   l   A   r   g   s   "   ,       "   i   n   v   o   k   e   E   n   t   r   y   P   o   i   n   t   "   ,       "   c   h   e   c   k   M   a   i   l   b   o   x   "   ,       "   I   n   t   e   r   n   a   l   E   r   r   o   r   "   ,       "   B   i   n   d   i   n   g   E   r   r   o   r   "   ,       "   t   h   r   o   w   I   n   t   e   r   n   a   l   E   r   r   o   r   "   ,       "   t   h   r   o   w   B   i   n   d   i   n   g   E   r   r   o   r   "   ,       "   r   e   g   i   s   t   e   r   e   d   T   y   p   e   s   "   ,       "   a   w   a   i   t   i   n   g   D   e   p   e   n   d   e   n   c   i   e   s   "   ,       "   t   y   p   e   D   e   p   e   n   d   e   n   c   i   e   s   "   ,       "   t   u   p   l   e   R   e   g   i   s   t   r   a   t   i   o   n   s   "   ,       "   s   t   r   u   c   t   R   e   g   i   s   t   r   a   t   i   o   n   s   "   ,       "   s   h   a   r   e   d   R   e   g   i   s   t   e   r   T   y   p   e   "   ,       "   w   h   e   n   D   e   p   e   n   d   e   n   t   T   y   p   e   s   A   r   e   R   e   s   o   l   v   e   d   "   ,       "   g   e   t   T   y   p   e   N   a   m   e   "   ,       "   g   e   t   F   u   n   c   t   i   o   n   N   a   m   e   "   ,       "   h   e   a   p   3   2   V   e   c   t   o   r   T   o   A   r   r   a   y   "   ,       "   r   e   q   u   i   r   e   R   e   g   i   s   t   e   r   e   d   T   y   p   e   "   ,       "   u   s   e   s   D   e   s   t   r   u   c   t   o   r   S   t   a   c   k   "   ,       "   c   h   e   c   k   A   r   g   C   o   u   n   t   "   ,       "   g   e   t   R   e   q   u   i   r   e   d   A   r   g   C   o   u   n   t   "   ,       "   c   r   e   a   t   e   J   s   I   n   v   o   k   e   r   "   ,       "   U   n   b   o   u   n   d   T   y   p   e   E   r   r   o   r   "   ,       "   E   m   V   a   l   T   y   p   e   "   ,       "   E   m   V   a   l   O   p   t   i   o   n   a   l   T   y   p   e   "   ,       "   t   h   r   o   w   U   n   b   o   u   n   d   T   y   p   e   E   r   r   o   r   "   ,       "   e   n   s   u   r   e   O   v   e   r   l   o   a   d   T   a   b   l   e   "   ,       "   e   x   p   o   s   e   P   u   b   l   i   c   S   y   m   b   o   l   "   ,       "   r   e   p   l   a   c   e   P   u   b   l   i   c   S   y   m   b   o   l   "   ,       "   c   r   e   a   t   e   N   a   m   e   d   F   u   n   c   t   i   o   n   "   ,       "   e   m   b   i   n   d   R   e   p   r   "   ,       "   r   e   g   i   s   t   e   r   e   d   I   n   s   t   a   n   c   e   s   "   ,       "   r   e   g   i   s   t   e   r   e   d   P   o   i   n   t   e   r   s   "   ,       "   r   e   g   i   s   t   e   r   T   y   p   e   "   ,       "   i   n   t   e   g   e   r   R   e   a   d   V   a   l   u   e   F   r   o   m   P   o   i   n   t   e   r   "   ,       "   f   l   o   a   t   R   e   a   d   V   a   l   u   e   F   r   o   m   P   o   i   n   t   e   r   "   ,       "   a   s   s   e   r   t   I   n   t   e   g   e   r   R   a   n   g   e   "   ,       "   r   e   a   d   P   o   i   n   t   e   r   "   ,       "   r   u   n   D   e   s   t   r   u   c   t   o   r   s   "   ,       "   c   r   a   f   t   I   n   v   o   k   e   r   F   u   n   c   t   i   o   n   "   ,       "   e   m   b   i   n   d   _   _   r   e   q   u   i   r   e   F   u   n   c   t   i   o   n   "   ,       "   f   i   n   a   l   i   z   a   t   i   o   n   R   e   g   i   s   t   r   y   "   ,       "   d   e   t   a   c   h   F   i   n   a   l   i   z   e   r   _   d   e   p   s   "   ,       "   d   e   l   e   t   i   o   n   Q   u   e   u   e   "   ,       "   d   e   l   a   y   F   u   n   c   t   i   o   n   "   ,       "   e   m   v   a   l   _   f   r   e   e   l   i   s   t   "   ,       "   e   m   v   a   l   _   h   a   n   d   l   e   s   "   ,       "   e   m   v   a   l   _   s   y   m   b   o   l   s   "   ,       "   g   e   t   S   t   r   i   n   g   O   r   S   y   m   b   o   l   "   ,       "   E   m   v   a   l   "   ,       "   e   m   v   a   l   _   r   e   t   u   r   n   V   a   l   u   e   "   ,       "   e   m   v   a   l   _   m   e   t   h   o   d   C   a   l   l   e   r   s   "       ]   ;   
   
   u   n   e   x   p   o   r   t   e   d   S   y   m   b   o   l   s   .   f   o   r   E   a   c   h   (   u   n   e   x   p   o   r   t   e   d   R   u   n   t   i   m   e   S   y   m   b   o   l   )   ;   
   
   /   /       E   n   d       r   u   n   t   i   m   e       e   x   p   o   r   t   s   
   /   /       B   e   g   i   n       J   S       l   i   b   r   a   r   y       e   x   p   o   r   t   s   
   /   /       E   n   d       J   S       l   i   b   r   a   r   y       e   x   p   o   r   t   s   
   /   /       e   n   d       i   n   c   l   u   d   e   :       p   o   s   t   l   i   b   r   a   r   y   .   j   s   
   /   /       p   r   o   x   i   e   d   F   u   n   c   t   i   o   n   T   a   b   l   e       s   p   e   c   i   f   i   e   s       t   h   e       l   i   s   t       o   f       f   u   n   c   t   i   o   n   s       t   h   a   t       c   a   n       b   e       c   a   l   l   e   d   
   /   /       e   i   t   h   e   r       s   y   n   c   h   r   o   n   o   u   s   l   y       o   r       a   s   y   n   c   h   r   o   n   o   u   s   l   y       f   r   o   m       o   t   h   e   r       t   h   r   e   a   d   s       i   n       p   o   s   t   M   e   s   s   a   g   e   (   )   d   
   /   /       o   r       i   n   t   e   r   n   a   l   l   y       q   u   e   u   e   d       e   v   e   n   t   s   .       T   h   i   s       w   a   y       a       p   t   h   r   e   a   d       i   n       a       W   o   r   k   e   r       c   a   n       s   y   n   c   h   r   o   n   o   u   s   l   y   
   /   /       a   c   c   e   s   s       e   .   g   .       t   h   e       D   O   M       o   n       t   h   e       m   a   i   n       t   h   r   e   a   d   .   
   v   a   r       p   r   o   x   i   e   d   F   u   n   c   t   i   o   n   T   a   b   l   e       =       [       _   p   r   o   c   _   e   x   i   t   ,       e   x   i   t   O   n   M   a   i   n   T   h   r   e   a   d   ,       _   e   g   l   B   i   n   d   A   P   I   ,       _   e   g   l   C   h   o   o   s   e   C   o   n   f   i   g   ,       _   e   g   l   C   r   e   a   t   e   C   o   n   t   e   x   t   ,       _   e   g   l   C   r   e   a   t   e   W   i   n   d   o   w   S   u   r   f   a   c   e   ,       _   e   g   l   G   e   t   C   o   n   f   i   g   A   t   t   r   i   b   ,       _   e   g   l   G   e   t   D   i   s   p   l   a   y   ,       _   e   g   l   I   n   i   t   i   a   l   i   z   e   ,       _   e   g   l   M   a   k   e   C   u   r   r   e   n   t   ,       _   e   g   l   S   w   a   p   B   u   f   f   e   r   s   ,       _   e   n   v   i   r   o   n   _   g   e   t   ,       _   e   n   v   i   r   o   n   _   s   i   z   e   s   _   g   e   t       ]   ;   
   
   f   u   n   c   t   i   o   n       c   h   e   c   k   I   n   c   o   m   i   n   g   M   o   d   u   l   e   A   P   I   (   )       {   
           i   g   n   o   r   e   d   M   o   d   u   l   e   P   r   o   p   (   "   f   e   t   c   h   S   e   t   t   i   n   g   s   "   )   ;   
   }   
   
   v   a   r       A   S   M   _   C   O   N   S   T   S       =       {   
           3   7   4   6   5   1   :       (   )       =   >       {   
                   c   o   n   s   t       w   o   r   k   l   e   t   N   o   d   e       =       w   i   n   d   o   w   .   p   r   o   j   e   c   t   M   W   o   r   k   l   e   t   N   o   d   e   _   G   l   o   b   a   l   _   C   p   p   ;   
                   i   f       (   w   o   r   k   l   e   t   N   o   d   e   )       {   
                           w   o   r   k   l   e   t   N   o   d   e   .   p   o   r   t   .   p   o   s   t   M   e   s   s   a   g   e   (   {   
                                   t   y   p   e   :       "   s   t   o   p   P   l   a   y   b   a   c   k   "   
                           }   )   ;   
                   }   
           }   ,   
           3   7   4   7   9   1   :       (   )       =   >       {   
                   c   o   n   s   t       r   a   n   d   I   n   d   e   x       =       M   a   t   h   .   f   l   o   o   r   (   M   a   t   h   .   r   a   n   d   o   m   (   )       *       1   0   0   )   ;   
                   v   a   r       j   s   S   t   r   i   n   g       =       "   /   p   r   e   s   e   t   s   /   p   r   e   s   e   t   _   "       +       r   a   n   d   I   n   d   e   x       +       "   .   m   i   l   k   "   ;   
                   v   a   r       l   e   n   g   t   h   B   y   t   e   s       =       l   e   n   g   t   h   B   y   t   e   s   U   T   F   8   (   j   s   S   t   r   i   n   g   )       +       1   ;   
                   r   e   t   u   r   n       s   t   r   i   n   g   T   o   N   e   w   U   T   F   8   (   j   s   S   t   r   i   n   g   )   ;   
           }   ,   
           3   7   4   9   7   8   :       (   )       =   >       {   
                   F   S   .   m   k   d   i   r   (   "   /   p   r   e   s   e   t   s   "   )   ;   
                   F   S   .   m   k   d   i   r   (   "   /   t   e   x   t   u   r   e   s   "   )   ;   
                   F   S   .   m   k   d   i   r   (   "   /   s   n   d   "   )   ;   
                   d   o   c   u   m   e   n   t   .   q   u   e   r   y   S   e   l   e   c   t   o   r   (   "   #   s   c   a   n   v   a   s   "   )   .   h   e   i   g   h   t       =       w   i   n   d   o   w   .   i   n   n   e   r   H   e   i   g   h   t   ;   
                   d   o   c   u   m   e   n   t   .   q   u   e   r   y   S   e   l   e   c   t   o   r   (   "   #   s   c   a   n   v   a   s   "   )   .   w   i   d   t   h       =       w   i   n   d   o   w   .   i   n   n   e   r   H   e   i   g   h   t   ;   
                   d   o   c   u   m   e   n   t   .   q   u   e   r   y   S   e   l   e   c   t   o   r   (   "   #   m   c   a   n   v   a   s   "   )   .   h   e   i   g   h   t       =       w   i   n   d   o   w   .   i   n   n   e   r   H   e   i   g   h   t   ;   
                   d   o   c   u   m   e   n   t   .   q   u   e   r   y   S   e   l   e   c   t   o   r   (   "   #   m   c   a   n   v   a   s   "   )   .   w   i   d   t   h       =       w   i   n   d   o   w   .   i   n   n   e   r   H   e   i   g   h   t   ;   
                   v   a   r       $   s   n   g   s       =       [   ]   ;   
                   v   a   r       $   s   h   d   s       =       [   ]   ;   
                   v   a   r       $   t   e   x   s       =       [   ]   ;   
                   f   u   n   c   t   i   o   n       t   e   x   t   u   r   e   s   (   x   m   l   )       {   
                           c   o   n   s   t       n   p   a   r   s   e   r       =       n   e   w       D   O   M   P   a   r   s   e   r   ;   
                           c   o   n   s   t       h   t   m   l   D   o   c   s       =       n   p   a   r   s   e   r   .   p   a   r   s   e   F   r   o   m   S   t   r   i   n   g   (   x   m   l   .   r   e   s   p   o   n   s   e   T   e   x   t   ,       "   t   e   x   t   /   h   t   m   l   "   )   ;   
                           c   o   n   s   t       p   r   e   L   i   s   t       =       h   t   m   l   D   o   c   s   .   g   e   t   E   l   e   m   e   n   t   s   B   y   T   a   g   N   a   m   e   (   "   p   r   e   "   )   [   0   ]   .   g   e   t   E   l   e   m   e   n   t   s   B   y   T   a   g   N   a   m   e   (   "   a   "   )   ;   
                           $   t   e   x   s   [   0   ]       =       p   r   e   L   i   s   t   .   l   e   n   g   t   h   ;   
                           c   o   n   s   o   l   e   .   l   o   g   (   "   s   c   a   n   n   e   d   :       "       +       $   t   e   x   s   [   0   ]       +       "       t   e   x   t   u   r   e   s   .   "   )   ;   
                           f   o   r       (   v   a   r       i       =       5   ;       i       <       p   r   e   L   i   s   t   .   l   e   n   g   t   h   ;       i   +   +   )       {   
                                   v   a   r       t   x   x   t       =       p   r   e   L   i   s   t   [   i   ]   .   h   r   e   f   ;   
                                   l   e   t       c   u   r   r   e   n   t   O   r   i   g   i   n       =       w   i   n   d   o   w   .   l   o   c   a   t   i   o   n   .   o   r   i   g   i   n   ;   
                                   l   e   t       p   a   t   h   N   a   m   e       =       c   u   r   r   e   n   t   O   r   i   g   i   n       +       "   /   t   e   x   t   u   r   e   s   "   ;   
                                   l   e   t       l   a   s   t   S   l   a   s   h   I   n   d   e   x       =       p   a   t   h   N   a   m   e   .   l   a   s   t   I   n   d   e   x   O   f   (   "   /   "   )   ;   
                                   l   e   t       b   a   s   e   P   a   t   h       =       p   a   t   h   N   a   m   e   .   s   u   b   s   t   r   i   n   g   (   0   ,       l   a   s   t   S   l   a   s   h   I   n   d   e   x   )   ;   
                                   t   x   x   t       =       t   x   x   t   .   r   e   p   l   a   c   e   (   c   u   r   r   e   n   t   O   r   i   g   i   n   ,       "   "   )   ;   
                                   $   t   e   x   s   [   i   ]       =       b   a   s   e   P   a   t   h       +       "   /   t   e   x   t   u   r   e   s   "       +       t   x   x   t   ;   
                                   c   o   n   s   o   l   e   .   l   o   g   (   "   $   t   e   x   s   [   "       +       i       +       "   ]   :       "   ,       $   t   e   x   s   [   i   ]   )   ;   
                                   c   o   n   s   t       f   f       =       n   e   w       X   M   L   H   t   t   p   R   e   q   u   e   s   t   ;   
                                   f   f   .   o   p   e   n   (   "   G   E   T   "   ,       $   t   e   x   s   [   i   ]   ,       t   r   u   e   )   ;   
                                   f   f   .   r   e   s   p   o   n   s   e   T   y   p   e       =       "   a   r   r   a   y   b   u   f   f   e   r   "   ;   
                                   d   o   c   u   m   e   n   t   .   q   u   e   r   y   S   e   l   e   c   t   o   r   (   "   #   s   t   a   t   "   )   .   i   n   n   e   r   H   T   M   L       =       "   D   o   w   n   l   o   a   d   i   n   g       T   e   x   t   u   r   e   "   ;   
                                   d   o   c   u   m   e   n   t   .   q   u   e   r   y   S   e   l   e   c   t   o   r   (   "   #   s   t   a   t   "   )   .   s   t   y   l   e   .   b   a   c   k   g   r   o   u   n   d   C   o   l   o   r       =       "   y   e   l   l   o   w   "   ;   
                                   f   f   .   a   d   d   E   v   e   n   t   L   i   s   t   e   n   e   r   (   "   l   o   a   d   "   ,       f   u   n   c   t   i   o   n   (   )       {   
                                           l   e   t       s   a   r   r   a   y   B   u   f   f   e   r       =       f   f   .   r   e   s   p   o   n   s   e   ;   
                                           i   f       (   s   a   r   r   a   y   B   u   f   f   e   r   )       {   
                                                   l   e   t       s   f   i   l       =       n   e   w       U   i   n   t   8   C   l   a   m   p   e   d   A   r   r   a   y   (   s   a   r   r   a   y   B   u   f   f   e   r   )   ;   
                                                   F   S   .   w   r   i   t   e   F   i   l   e   (   "   /   t   e   x   t   u   r   e   s   /   "       +       t   x   x   t   ,       s   f   i   l   )   ;   
                                                   c   o   n   s   o   l   e   .   l   o   g   (   "   g   o   t       t   e   x   t   u   r   e   :       "       +       t   x   x   t       +       "       /       "       +       $   t   e   x   s   [   i   ]   )   ;   
                                                   s   e   t   T   i   m   e   o   u   t   (   f   u   n   c   t   i   o   n   (   )       {   
                                                           d   o   c   u   m   e   n   t   .   q   u   e   r   y   S   e   l   e   c   t   o   r   (   "   #   s   t   a   t   "   )   .   i   n   n   e   r   H   T   M   L       =       "   D   o   w   n   l   o   a   d   e   d       T   e   x   t   u   r   e   "   ;   
                                                           d   o   c   u   m   e   n   t   .   q   u   e   r   y   S   e   l   e   c   t   o   r   (   "   #   s   t   a   t   "   )   .   s   t   y   l   e   .   b   a   c   k   g   r   o   u   n   d   C   o   l   o   r       =       "   b   l   u   e   "   ;   
                                                   }   ,       5   0   0   )   ;   
                                           }   
                                   }   )   ;   
                                   f   f   .   s   e   n   d   (   n   u   l   l   )   ;   
                           }   
                   }   
                   f   u   n   c   t   i   o   n       s   c   a   n   T   e   x   t   u   r   e   s   (   )       {   
                           c   o   n   s   t       n   x   h   t   t   p       =       n   e   w       X   M   L   H   t   t   p   R   e   q   u   e   s   t   ;   
                           n   x   h   t   t   p   .   o   n   r   e   a   d   y   s   t   a   t   e   c   h   a   n   g   e       =       f   u   n   c   t   i   o   n   (   )       {   
                                   i   f       (   t   h   i   s   .   r   e   a   d   y   S   t   a   t   e       =   =       4       &   &       t   h   i   s   .   s   t   a   t   u   s       =   =       2   0   0   )       {   
                                           c   o   n   s   o   l   e   .   l   o   g   (   "   s   c   a   n   n   i   n   g       t   e   x   t   u   r   e   s   .   "   )   ;   
                                           t   e   x   t   u   r   e   s   (   t   h   i   s   )   ;   
                                   }   
                           }   ;   
                           n   x   h   t   t   p   .   o   p   e   n   (   "   G   E   T   "   ,       "   t   e   x   t   u   r   e   s   /   "   ,       t   r   u   e   )   ;   
                           n   x   h   t   t   p   .   s   e   n   d   (   )   ;   
                   }   
                   f   u   n   c   t   i   o   n       s   h   d   s   (   x   m   l   )       {   
                           c   o   n   s   t       n   p   a   r   s   e   r       =       n   e   w       D   O   M   P   a   r   s   e   r   ;   
                           c   o   n   s   t       h   t   m   l   D   o   c   s       =       n   p   a   r   s   e   r   .   p   a   r   s   e   F   r   o   m   S   t   r   i   n   g   (   x   m   l   .   r   e   s   p   o   n   s   e   T   e   x   t   ,       "   t   e   x   t   /   h   t   m   l   "   )   ;   
                           c   o   n   s   t       p   r   e   L   i   s   t       =       h   t   m   l   D   o   c   s   .   g   e   t   E   l   e   m   e   n   t   s   B   y   T   a   g   N   a   m   e   (   "   p   r   e   "   )   [   0   ]   .   g   e   t   E   l   e   m   e   n   t   s   B   y   T   a   g   N   a   m   e   (   "   a   "   )   ;   
                           $   s   h   d   s   [   0   ]       =       p   r   e   L   i   s   t   .   l   e   n   g   t   h   ;   
                           f   o   r       (   v   a   r       i       =       1   ;       i       <       p   r   e   L   i   s   t   .   l   e   n   g   t   h   ;       i   +   +   )       {   
                                   v   a   r       t   x   x   t       =       p   r   e   L   i   s   t   [   i   ]   .   h   r   e   f   ;   
                                   l   e   t       p   a   t   h   N   a   m   e       =       "   h   t   t   p   s   :   /   /   g   l   s   l   .   1   i   n   k   .   u   s   /   m   i   l   k   "   ;   
                                   l   e   t       c   u   r   r   e   n   t   O   r   i   g   i   n       =       w   i   n   d   o   w   .   l   o   c   a   t   i   o   n   .   o   r   i   g   i   n   ;   
                                   l   e   t       l   a   s   t   S   l   a   s   h   I   n   d   e   x       =       p   a   t   h   N   a   m   e   .   l   a   s   t   I   n   d   e   x   O   f   (   "   /   "   )   ;   
                                   l   e   t       b   a   s   e   P   a   t   h       =       p   a   t   h   N   a   m   e   .   s   u   b   s   t   r   i   n   g   (   0   ,       l   a   s   t   S   l   a   s   h   I   n   d   e   x   )   ;   
                                   t   x   x   t       =       t   x   x   t   .   r   e   p   l   a   c   e   (   c   u   r   r   e   n   t   O   r   i   g   i   n   ,       "   "   )   ;   
                                   $   s   h   d   s   [   i   ]       =       b   a   s   e   P   a   t   h       +       "   /   m   i   l   k   "       +       t   x   x   t   ;   
                           }   
                           c   o   n   s   o   l   e   .   l   o   g   (   "   S   c   a   n   n   e   d       "       +       $   s   h   d   s   [   0   ]       +       "       S   h   a   d   e   r   s   .   "   )   ;   
                           s   e   t   T   i   m   e   o   u   t   (   f   u   n   c   t   i   o   n   (   )       {   
                                   g   e   t   S   h   a   d   e   r   s   (   )   ;   
                           }   ,       2   5   0   0   )   ;   
                   }   
                   f   u   n   c   t   i   o   n       s   c   a   n   S   h   a   d   e   r   s   (   )       {   
                           c   o   n   s   t       n   x   h   t   t   p       =       n   e   w       X   M   L   H   t   t   p   R   e   q   u   e   s   t   ;   
                           n   x   h   t   t   p   .   o   n   r   e   a   d   y   s   t   a   t   e   c   h   a   n   g   e       =       f   u   n   c   t   i   o   n   (   )       {   
                                   i   f       (   t   h   i   s   .   r   e   a   d   y   S   t   a   t   e       =   =       4       &   &       t   h   i   s   .   s   t   a   t   u   s       =   =       2   0   0   )       {   
                                           s   h   d   s   (   t   h   i   s   )   ;   
                                   }   
                           }   ;   
                           n   x   h   t   t   p   .   o   p   e   n   (   "   G   E   T   "   ,       "   h   t   t   p   s   :   /   /   g   l   s   l   .   1   i   n   k   .   u   s   /   m   i   l   k   /   "   ,       t   r   u   e   )   ;   
                           n   x   h   t   t   p   .   s   e   n   d   (   )   ;   
                   }   
                   f   u   n   c   t   i   o   n       s   n   g   s   (   x   m   l   )       {   
                           c   o   n   s   t       n   p   a   r   s   e   r       =       n   e   w       D   O   M   P   a   r   s   e   r   ;   
                           c   o   n   s   t       h   t   m   l   D   o   c   s       =       n   p   a   r   s   e   r   .   p   a   r   s   e   F   r   o   m   S   t   r   i   n   g   (   x   m   l   .   r   e   s   p   o   n   s   e   T   e   x   t   ,       "   t   e   x   t   /   h   t   m   l   "   )   ;   
                           c   o   n   s   t       p   r   e   L   i   s   t       =       h   t   m   l   D   o   c   s   .   g   e   t   E   l   e   m   e   n   t   s   B   y   T   a   g   N   a   m   e   (   "   p   r   e   "   )   [   0   ]   .   g   e   t   E   l   e   m   e   n   t   s   B   y   T   a   g   N   a   m   e   (   "   a   "   )   ;   
                           $   s   n   g   s   [   0   ]       =       p   r   e   L   i   s   t   .   l   e   n   g   t   h   ;   
                           f   o   r       (   v   a   r       i       =       1   ;       i       <       p   r   e   L   i   s   t   .   l   e   n   g   t   h   ;       i   +   +   )       {   
                                   v   a   r       t   x   x   t       =       p   r   e   L   i   s   t   [   i   ]   .   h   r   e   f   ;   
                                   l   e   t       p   a   t   h   N   a   m   e       =       w   i   n   d   o   w   .   l   o   c   a   t   i   o   n   .   p   a   t   h   n   a   m   e   ;   
                                   l   e   t       c   u   r   r   e   n   t   O   r   i   g   i   n       =       w   i   n   d   o   w   .   l   o   c   a   t   i   o   n   .   o   r   i   g   i   n   ;   
                                   l   e   t       l   a   s   t   S   l   a   s   h   I   n   d   e   x       =       p   a   t   h   N   a   m   e   .   l   a   s   t   I   n   d   e   x   O   f   (   "   /   "   )   ;   
                                   l   e   t       b   a   s   e   P   a   t   h       =       p   a   t   h   N   a   m   e   .   s   u   b   s   t   r   i   n   g   (   0   ,       l   a   s   t   S   l   a   s   h   I   n   d   e   x       +       1   )   ;   
                                   t   x   x   t       =       t   x   x   t   .   r   e   p   l   a   c   e   (   c   u   r   r   e   n   t   O   r   i   g   i   n   ,       "   "   )   ;   
                                   $   s   n   g   s   [   i   ]       =       b   a   s   e   P   a   t   h       +       "   s   o   n   g   s   "       +       t   x   x   t   ;   
                           }   
                   }   
                   f   u   n   c   t   i   o   n       s   c   a   n   S   o   n   g   s   (   )       {   
                           c   o   n   s   t       n   x   h   t   t   p       =       n   e   w       X   M   L   H   t   t   p   R   e   q   u   e   s   t   ;   
                           n   x   h   t   t   p   .   o   n   r   e   a   d   y   s   t   a   t   e   c   h   a   n   g   e       =       f   u   n   c   t   i   o   n   (   )       {   
                                   i   f       (   t   h   i   s   .   r   e   a   d   y   S   t   a   t   e       =   =       4       &   &       t   h   i   s   .   s   t   a   t   u   s       =   =       2   0   0   )       {   
                                           s   n   g   s   (   t   h   i   s   )   ;   
                                   }   
                           }   ;   
                           n   x   h   t   t   p   .   o   p   e   n   (   "   G   E   T   "   ,       "   s   o   n   g   s   /   "   ,       t   r   u   e   )   ;   
                           n   x   h   t   t   p   .   s   e   n   d   (   )   ;   
                   }   
                   v   a   r       l   a   s   t   S   o   n   g   F   i   l   e   N   a   m   e       =       "   "   ;   
                   c   o   n   s   t       f   l   l       =       n   e   w       B   r   o   a   d   c   a   s   t   C   h   a   n   n   e   l   (   "   f   i   l   e   "   )   ;   
                   f   l   l   .   a   d   d   E   v   e   n   t   L   i   s   t   e   n   e   r   (   "   m   e   s   s   a   g   e   "   ,       e   a       =   >       {   
                           c   o   n   s   t       u   n   i   q   u   e   F   i   l   e   N   a   m   e       =       `   /   s   n   d   /   s   o   n   g   _   $   {   D   a   t   e   .   n   o   w   (   )   }   .   w   a   v   `   ;   
                           c   o   n   s   o   l   e   .   l   o   g   (   `   J   S       E   v   e   n   t   :       R   e   c   e   i   v   e   d       n   e   w       s   o   n   g   .       W   r   i   t   i   n   g       t   o       u   n   i   q   u   e       p   a   t   h   :       $   {   u   n   i   q   u   e   F   i   l   e   N   a   m   e   }   `   )   ;   
                           c   o   n   s   t       f   i   l   l       =       n   e   w       U   i   n   t   8   A   r   r   a   y   (   e   a   .   d   a   t   a   .   d   a   t   a   )   ;   
                           F   S   .   w   r   i   t   e   F   i   l   e   (   u   n   i   q   u   e   F   i   l   e   N   a   m   e   ,       f   i   l   l   )   ;   
                           i   f       (   l   a   s   t   S   o   n   g   F   i   l   e   N   a   m   e       &   &       F   S   .   a   n   a   l   y   z   e   P   a   t   h   (   l   a   s   t   S   o   n   g   F   i   l   e   N   a   m   e   )   .   e   x   i   s   t   s   )       {   
                                   F   S   .   u   n   l   i   n   k   (   l   a   s   t   S   o   n   g   F   i   l   e   N   a   m   e   )   ;   
                                   c   o   n   s   o   l   e   .   l   o   g   (   `   J   S       E   v   e   n   t   :       C   l   e   a   n   e   d       u   p       p   r   e   v   i   o   u   s       s   o   n   g       f   i   l   e   :       $   {   l   a   s   t   S   o   n   g   F   i   l   e   N   a   m   e   }   `   )   ;   
                           }   
                           l   a   s   t   S   o   n   g   F   i   l   e   N   a   m   e       =       u   n   i   q   u   e   F   i   l   e   N   a   m   e   ;   
                           s   e   t   T   i   m   e   o   u   t   (   f   u   n   c   t   i   o   n   (   )       {   
                                   M   o   d   u   l   e   .   c   c   a   l   l   (   "   p   l   "   ,       n   u   l   l   ,       [       "   s   t   r   i   n   g   "       ]   ,       [       u   n   i   q   u   e   F   i   l   e   N   a   m   e       ]   )   ;   
                                   c   o   n   s   t       s   h   u   t   D   o   w   n       =       n   e   w       B   r   o   a   d   c   a   s   t   C   h   a   n   n   e   l   (   "   s   h   u   t   D   o   w   n   "   )   ;   
                                   s   h   u   t   D   o   w   n   .   p   o   s   t   M   e   s   s   a   g   e   (   {   
                                           d   a   t   a   :       2   2   2   
                                   }   )   ;   
                           }   ,       2   5   0   )   ;   
                   }   )   ;   
                   f   u   n   c   t   i   o   n       g   e   t   S   h   a   d   e   r   (   p   t   h   ,       f   n   a   m   e   )       {   
                           c   o   n   s   t       f   f       =       n   e   w       X   M   L   H   t   t   p   R   e   q   u   e   s   t   ;   
                           f   f   .   o   p   e   n   (   "   G   E   T   "   ,       p   t   h   ,       t   r   u   e   )   ;   
                           f   f   .   r   e   s   p   o   n   s   e   T   y   p   e       =       "   a   r   r   a   y   b   u   f   f   e   r   "   ;   
                           d   o   c   u   m   e   n   t   .   q   u   e   r   y   S   e   l   e   c   t   o   r   (   "   #   s   t   a   t   "   )   .   i   n   n   e   r   H   T   M   L       =       "   D   o   w   n   l   o   a   d   i   n   g       S   h   a   d   e   r   "   ;   
                           d   o   c   u   m   e   n   t   .   q   u   e   r   y   S   e   l   e   c   t   o   r   (   "   #   s   t   a   t   "   )   .   s   t   y   l   e   .   b   a   c   k   g   r   o   u   n   d   C   o   l   o   r       =       "   y   e   l   l   o   w   "   ;   
                           f   f   .   a   d   d   E   v   e   n   t   L   i   s   t   e   n   e   r   (   "   l   o   a   d   "   ,       f   u   n   c   t   i   o   n   (   )       {   
                                   l   e   t       s   a   r   r   a   y   B   u   f   f   e   r       =       f   f   .   r   e   s   p   o   n   s   e   ;   
                                   i   f       (   s   a   r   r   a   y   B   u   f   f   e   r   )       {   
                                           l   e   t       s   f   i   l       =       n   e   w       U   i   n   t   8   C   l   a   m   p   e   d   A   r   r   a   y   (   s   a   r   r   a   y   B   u   f   f   e   r   )   ;   
                                           F   S   .   w   r   i   t   e   F   i   l   e   (   f   n   a   m   e   ,       s   f   i   l   )   ;   
                                           c   o   n   s   o   l   e   .   l   o   g   (   "   g   o   t       p   r   e   s   e   t   :       "       +       f   n   a   m   e   )   ;   
                                           d   o   c   u   m   e   n   t   .   q   u   e   r   y   S   e   l   e   c   t   o   r   (   "   #   s   t   a   t   "   )   .   i   n   n   e   r   H   T   M   L       =       "   D   o   w   n   l   o   a   d   e   d       S   h   a   d   e   r   "   ;   
                                           d   o   c   u   m   e   n   t   .   q   u   e   r   y   S   e   l   e   c   t   o   r   (   "   #   s   t   a   t   "   )   .   s   t   y   l   e   .   b   a   c   k   g   r   o   u   n   d   C   o   l   o   r       =       "   b   l   u   e   "   ;   
                                           c   o   n   s   t       p   r   e   s   e   t   F   i   l   e   N   a   m   e   T   o   L   o   a   d       =       f   n   a   m   e   ;   
                                           c   o   n   s   o   l   e   .   l   o   g   (   "   J   S   :       A   t   t   e   m   p   t   i   n   g       t   o       l   o   a   d       p   r   e   -   d   o   w   n   l   o   a   d   e   d   :       "       +       p   r   e   s   e   t   F   i   l   e   N   a   m   e   T   o   L   o   a   d   )   ;   
                                           t   r   y       {   
                                                   c   o   n   s   t       c   o   n   t   e   n   t       =       F   S   .   r   e   a   d   F   i   l   e   (   p   r   e   s   e   t   F   i   l   e   N   a   m   e   T   o   L   o   a   d   ,       {   
                                                           e   n   c   o   d   i   n   g   :       "   u   t   f   8   "   
                                                   }   )   ;   
                                                   c   o   n   s   o   l   e   .   l   o   g   (   "   J   S   :       C   o   n   t   e   n   t       o   f       "       +       p   r   e   s   e   t   F   i   l   e   N   a   m   e   T   o   L   o   a   d       +       "       (   f   i   r   s   t       2   0   0       c   h   a   r   s   )   :   "   ,       c   o   n   t   e   n   t   .   s   u   b   s   t   r   i   n   g   (   0   ,       2   0   0   )   )   ;   
                                                   i   f       (   c   o   n   t   e   n   t   .   l   e   n   g   t   h       =   =   =       0   )       {   
                                                           c   o   n   s   o   l   e   .   e   r   r   o   r   (   "   J   S   :       F   i   l   e       "       +       p   r   e   s   e   t   F   i   l   e   N   a   m   e   T   o   L   o   a   d       +       "       i   s       E   M   P   T   Y   !   "   )   ;   
                                                   }   
                                           }       c   a   t   c   h       (   e   )       {   
                                                   c   o   n   s   o   l   e   .   e   r   r   o   r   (   "   J   S   :       F   a   i   l   e   d       t   o       r   e   a   d       f   i   l   e       "       +       p   r   e   s   e   t   F   i   l   e   N   a   m   e   T   o   L   o   a   d       +       "       f   r   o   m       F   S   :   "   ,       e   )   ;   
                                                   r   e   t   u   r   n   ;   
                                           }   
                                   }   
                           }   )   ;   
                           f   f   .   s   e   n   d   (   n   u   l   l   )   ;   
                   }   
                   f   u   n   c   t   i   o   n       s   n   d   (   )       {   
                           l   e   t       r   a   n   d   S   o   n   g       =       M   a   t   h   .   f   l   o   o   r   (   (   $   s   n   g   s   [   0   ]       -       5   )       *       M   a   t   h   .   r   a   n   d   o   m   (   )   )   ;   
                           l   e   t       s   o   n   g   S   r   c       =       $   s   n   g   s   [   r   a   n   d   S   o   n   g       +       5   ]   ;   
                           c   o   n   s   o   l   e   .   l   o   g   (   "   S   o   n   g   :       "   ,       s   o   n   g   S   r   c   )   ;   
                           d   o   c   u   m   e   n   t   .   q   u   e   r   y   S   e   l   e   c   t   o   r   (   "   #   t   r   a   c   k   "   )   .   s   r   c       =       s   o   n   g   S   r   c   ;   
                           c   o   n   s   t       s   n   g       =       n   e   w       B   r   o   a   d   c   a   s   t   C   h   a   n   n   e   l   (   "   s   n   g   "   )   ;   
                           s   n   g   .   p   o   s   t   M   e   s   s   a   g   e   (   {   
                                   d   a   t   a   :       s   o   n   g   S   r   c   
                           }   )   ;   
                   }   
                   d   o   c   u   m   e   n   t   .   q   u   e   r   y   S   e   l   e   c   t   o   r   (   "   #   m   u   s   i   c   B   t   n   "   )   .   a   d   d   E   v   e   n   t   L   i   s   t   e   n   e   r   (   "   c   l   i   c   k   "   ,       f   u   n   c   t   i   o   n   (   )       {   
                           w   i   n   d   o   w   .   o   p   e   n   (   "   .   /   f   l   a   c   "   )   ;   
                           s   e   t   T   i   m   e   o   u   t   (   f   u   n   c   t   i   o   n   (   )       {   
                                   s   n   d   (   )   ;   
                           }   ,       1   5   5   0   )   ;   
                   }   )   ;   
                   d   o   c   u   m   e   n   t   .   q   u   e   r   y   S   e   l   e   c   t   o   r   (   "   #   m   i   l   k   B   t   n   "   )   .   a   d   d   E   v   e   n   t   L   i   s   t   e   n   e   r   (   "   c   l   i   c   k   "   ,       f   u   n   c   t   i   o   n   (   )       {   
                           M   o   d   u   l   e   .   g   e   t   C   u   s   t   o   m   S   h   a   d   e   r   (   )   ;   
                   }   )   ;   
                   d   o   c   u   m   e   n   t   .   q   u   e   r   y   S   e   l   e   c   t   o   r   (   "   #   c   r   e   a   t   e   S   p   r   i   t   e   B   t   n   "   )   .   a   d   d   E   v   e   n   t   L   i   s   t   e   n   e   r   (   "   c   l   i   c   k   "   ,       f   u   n   c   t   i   o   n   (   )       {   
                           M   o   d   u   l   e   .   c   r   e   a   t   e   S   p   r   i   t   e   (   )   ;   
                   }   )   ;   
                   f   u   n   c   t   i   o   n       g   e   t   S   h   a   d   e   r   s   (   )       {   
                           f   o   r       (   v   a   r       i       =       0   ;       i       <       1   0   0   ;       i   +   +   )       {   
                                   v   a   r       r   a   n   d   S   h   d       =       M   a   t   h   .   f   l   o   o   r   (   (   $   s   h   d   s   [   0   ]       -       5   )       *       M   a   t   h   .   r   a   n   d   o   m   (   )   )   ;   
                                   v   a   r       m   i   l   k   S   r   c       =       $   s   h   d   s   [   r   a   n   d   S   h   d       +       5   ]   ;   
                                   d   o   c   u   m   e   n   t   .   q   u   e   r   y   S   e   l   e   c   t   o   r   (   "   #   m   i   l   k   P   a   t   h   "   )   .   i   n   n   e   r   H   T   M   L       =       m   i   l   k   S   r   c   ;   
                                   M   o   d   u   l   e   .   g   e   t   S   h   a   d   e   r   (   i   )   ;   
                                   c   o   n   s   o   l   e   .   l   o   g   (   "   G   o   t       "       +       "   /   p   r   e   s   e   t   s   /   p   r   e   s   e   t   _   "       +       i       +       "   .   m   i   l   k       f   r   o   m       "       +       m   i   l   k   S   r   c       +       "   .   "   )   ;   
                           }   
                           M   o   d   u   l   e   .   a   d   d   P   a   t   h   (   )   ;   
                           s   e   t   T   i   m   e   o   u   t   (   f   u   n   c   t   i   o   n   (   )       {   
                                   M   o   d   u   l   e   .   s   t   a   r   t   R   e   n   d   e   r   (   w   i   n   d   o   w   .   i   n   n   e   r   H   e   i   g   h   t   )   ;   
                           }   ,       1   e   3   )   ;   
                   }   
                   v   a   r       p   t   h       =       d   o   c   u   m   e   n   t   .   q   u   e   r   y   S   e   l   e   c   t   o   r   (   "   #   m   i   l   k   P   a   t   h   "   )   .   i   n   n   e   r   H   T   M   L   ;   
                   s   c   a   n   T   e   x   t   u   r   e   s   (   )   ;   
                   s   c   a   n   S   o   n   g   s   (   )   ;   
                   s   c   a   n   S   h   a   d   e   r   s   (   )   ;   
                   d   o   c   u   m   e   n   t   .   q   u   e   r   y   S   e   l   e   c   t   o   r   (   "   #   m   e   s   h   S   i   z   e   "   )   .   a   d   d   E   v   e   n   t   L   i   s   t   e   n   e   r   (   "   c   h   a   n   g   e   "   ,       e   v   e   n   t       =   >       {   
                           l   e   t       m   e   s   h   V   a   l   u   e       =       e   v   e   n   t   .   t   a   r   g   e   t   .   v   a   l   u   e   ;   
                           l   e   t       v   a   l   u   e   s       =       m   e   s   h   V   a   l   u   e   .   s   p   l   i   t   (   "   ,   "   )   .   m   a   p   (   N   u   m   b   e   r   )   ;   
                           c   o   n   s   o   l   e   .   l   o   g   (   "   S   e   t   t   i   n   g       M   e   s   h   :   "   ,       v   a   l   u   e   s   [   0   ]   ,       v   a   l   u   e   s   [   1   ]   )   ;   
                           M   o   d   u   l   e   .   s   e   t   M   e   s   h   (   v   a   l   u   e   s   [   0   ]   ,       v   a   l   u   e   s   [   1   ]   )   ;   
                   }   )   ;   
           }   
   }   ;   
   
   f   u   n   c   t   i   o   n       j   s   _   f   e   e   d   _   s   t   r   e   a   m   _   d   a   t   a   _   t   o   _   p   r   o   j   e   c   t   m   (   p   m   _   h   a   n   d   l   e   ,       b   u   f   f   e   r   _   s   i   z   e   )       {   
           c   o   n   s   t       a   n   a   l   y   s   e   r       =       w   i   n   d   o   w   .   p   r   o   j   e   c   t   M   S   t   r   e   a   m   A   n   a   l   y   s   e   r   ;   
           c   o   n   s   t       p   c   m   B   u   f   f   e   r       =       w   i   n   d   o   w   .   p   r   o   j   e   c   t   M   S   t   r   e   a   m   B   u   f   f   e   r   ;   
           i   f       (   !   a   n   a   l   y   s   e   r       |   |       !   p   c   m   B   u   f   f   e   r       |   |       p   c   m   B   u   f   f   e   r   .   l   e   n   g   t   h       !   =   =       b   u   f   f   e   r   _   s   i   z   e   )       {   
                   r   e   t   u   r   n   ;   
           }   
           a   n   a   l   y   s   e   r   .   g   e   t   F   l   o   a   t   T   i   m   e   D   o   m   a   i   n   D   a   t   a   (   p   c   m   B   u   f   f   e   r   )   ;   
           M   o   d   u   l   e   .   p   r   o   j   e   c   t   m   _   p   c   m   _   a   d   d   _   f   l   o   a   t   (   p   m   _   h   a   n   d   l   e   ,       p   c   m   B   u   f   f   e   r   ,       p   c   m   B   u   f   f   e   r   .   l   e   n   g   t   h   ,       1   )   ;   
   }   
   
   f   u   n   c   t   i   o   n       j   s   _   i   n   i   t   i   a   l   i   z   e   _   s   t   r   e   a   m   _   a   n   a   l   y   s   e   r   (   )       {   
           c   o   n   s   t       a   u   d   i   o   C   o   n   t   e   x   t       =       w   i   n   d   o   w   .   p   r   o   j   e   c   t   M   A   u   d   i   o   C   o   n   t   e   x   t   _   G   l   o   b   a   l   _   C   p   p   ;   
           c   o   n   s   t       a   u   d   i   o   E   l   e   m   e   n   t       =       d   o   c   u   m   e   n   t   .   g   e   t   E   l   e   m   e   n   t   B   y   I   d   (   "   a   u   d   i   o   -   s   t   r   e   a   m   -   e   l   e   m   e   n   t   "   )   ;   
           i   f       (   !   a   u   d   i   o   C   o   n   t   e   x   t       |   |       !   a   u   d   i   o   E   l   e   m   e   n   t   )       {   
                   c   o   n   s   o   l   e   .   e   r   r   o   r   (   "   J   S       S   t   r   e   a   m       I   n   i   t   :       A   u   d   i   o   C   o   n   t   e   x   t       o   r       a   u   d   i   o       e   l   e   m   e   n   t       n   o   t       f   o   u   n   d   .   "   )   ;   
                   r   e   t   u   r   n   ;   
           }   
           c   o   n   s   t       a   n   a   l   y   s   e   r       =       a   u   d   i   o   C   o   n   t   e   x   t   .   c   r   e   a   t   e   A   n   a   l   y   s   e   r   (   )   ;   
           a   n   a   l   y   s   e   r   .   f   f   t   S   i   z   e       =       2   0   4   8   ;   
           c   o   n   s   t       s   o   u   r   c   e       =       a   u   d   i   o   C   o   n   t   e   x   t   .   c   r   e   a   t   e   M   e   d   i   a   E   l   e   m   e   n   t   S   o   u   r   c   e   (   a   u   d   i   o   E   l   e   m   e   n   t   )   ;   
           s   o   u   r   c   e   .   c   o   n   n   e   c   t   (   a   n   a   l   y   s   e   r   )   ;   
           a   n   a   l   y   s   e   r   .   c   o   n   n   e   c   t   (   a   u   d   i   o   C   o   n   t   e   x   t   .   d   e   s   t   i   n   a   t   i   o   n   )   ;   
           w   i   n   d   o   w   .   p   r   o   j   e   c   t   M   S   t   r   e   a   m   A   n   a   l   y   s   e   r       =       a   n   a   l   y   s   e   r   ;   
           w   i   n   d   o   w   .   p   r   o   j   e   c   t   M   S   t   r   e   a   m   B   u   f   f   e   r       =       n   e   w       F   l   o   a   t   3   2   A   r   r   a   y   (   a   n   a   l   y   s   e   r   .   f   f   t   S   i   z   e   )   ;   
           c   o   n   s   o   l   e   .   l   o   g   (   "   J   S       S   t   r   e   a   m       I   n   i   t   :       M   e   d   i   a       e   l   e   m   e   n   t       a   n   d       a   n   a   l   y   s   e   r       c   o   n   n   e   c   t   e   d   .   "   )   ;   
   }   
   
   f   u   n   c   t   i   o   n       j   s   _   i   n   i   t   i   a   l   i   z   e   _   w   o   r   k   l   e   t   _   s   y   s   t   e   m   _   o   n   c   e   (   p   m   _   h   a   n   d   l   e   _   f   o   r   _   a   d   d   p   c   m   )       {   
           i   f       (   w   i   n   d   o   w   .   p   r   o   j   e   c   t   M   A   u   d   i   o   C   o   n   t   e   x   t   _   G   l   o   b   a   l   _   C   p   p   )       {   
                   r   e   t   u   r   n   ;   
           }   
           t   r   y       {   
                   c   o   n   s   t       a   u   d   i   o   C   o   n   t   e   x   t       =       n   e   w       (   w   i   n   d   o   w   .   A   u   d   i   o   C   o   n   t   e   x   t       |   |       w   i   n   d   o   w   .   w   e   b   k   i   t   A   u   d   i   o   C   o   n   t   e   x   t   )   ;   
                   w   i   n   d   o   w   .   p   r   o   j   e   c   t   M   A   u   d   i   o   C   o   n   t   e   x   t   _   G   l   o   b   a   l   _   C   p   p       =       a   u   d   i   o   C   o   n   t   e   x   t   ;   
                   c   o   n   s   o   l   e   .   l   o   g   (   "   J   S       A   u   d   i   o       I   n   i   t   :       W   e   b       A   u   d   i   o       c   o   n   t   e   x   t       c   r   e   a   t   e   d   .   "   )   ;   
                   (   a   s   y   n   c       (   )       =   >       {   
                           a   w   a   i   t       a   u   d   i   o   C   o   n   t   e   x   t   .   a   u   d   i   o   W   o   r   k   l   e   t   .   a   d   d   M   o   d   u   l   e   (   "   p   r   o   j   e   c   t   m   _   a   u   d   i   o   _   p   r   o   c   e   s   s   o   r   .   j   s   "   )   ;   
                           c   o   n   s   t       w   o   r   k   l   e   t   N   o   d   e       =       n   e   w       A   u   d   i   o   W   o   r   k   l   e   t   N   o   d   e   (   a   u   d   i   o   C   o   n   t   e   x   t   ,       "   p   r   o   j   e   c   t   m   -   a   u   d   i   o   -   p   r   o   c   e   s   s   o   r   "   )   ;   
                           w   i   n   d   o   w   .   p   r   o   j   e   c   t   M   W   o   r   k   l   e   t   N   o   d   e   _   G   l   o   b   a   l   _   C   p   p       =       w   o   r   k   l   e   t   N   o   d   e   ;   
                           w   o   r   k   l   e   t   N   o   d   e   .   p   o   r   t   .   o   n   m   e   s   s   a   g   e       =       e   v   e   n   t       =   >       {   
                                   i   f       (   e   v   e   n   t   .   d   a   t   a   .   t   y   p   e       =   =   =       "   p   c   m   D   a   t   a   "       &   &       M   o   d   u   l   e   .   p   r   o   j   e   c   t   m   _   p   c   m   _   a   d   d   _   f   l   o   a   t   )       {   
                                           M   o   d   u   l   e   .   p   r   o   j   e   c   t   m   _   p   c   m   _   a   d   d   _   f   l   o   a   t   (   p   m   _   h   a   n   d   l   e   _   f   o   r   _   a   d   d   p   c   m   ,       e   v   e   n   t   .   d   a   t   a   .   a   u   d   i   o   D   a   t   a   ,       e   v   e   n   t   .   d   a   t   a   .   s   a   m   p   l   e   s   P   e   r   C   h   a   n   n   e   l   ,       e   v   e   n   t   .   d   a   t   a   .   c   h   a   n   n   e   l   s   F   o   r   P   M   )   ;   
                                   }   
                           }   ;   
                           w   o   r   k   l   e   t   N   o   d   e   .   c   o   n   n   e   c   t   (   a   u   d   i   o   C   o   n   t   e   x   t   .   d   e   s   t   i   n   a   t   i   o   n   )   ;   
                           c   o   n   s   o   l   e   .   l   o   g   (   "   J   S       A   u   d   i   o       I   n   i   t   :       A   u   d   i   o   W   o   r   k   l   e   t   N   o   d   e       c   r   e   a   t   e   d       a   n   d       c   o   n   n   e   c   t   e   d       p   e   r   m   a   n   e   n   t   l   y   .   "   )   ;   
                   }   )   (   )   ;   
           }       c   a   t   c   h       (   e   )       {   
                   c   o   n   s   o   l   e   .   e   r   r   o   r   (   "   J   S       A   u   d   i   o       I   n   i   t   :       F   a   i   l   e   d       t   o       i   n   i   t   i   a   l   i   z   e       w   o   r   k   l   e   t       s   y   s   t   e   m   :   "   ,       e   )   ;   
           }   
           r   e   t   u   r   n   ;   
   }   
   
   f   u   n   c   t   i   o   n       j   s   _   l   o   a   d   _   s   o   n   g   _   i   n   t   o   _   w   o   r   k   l   e   t   (   p   a   t   h   _   i   n   _   v   f   s   ,       l   o   o   p   ,       s   t   a   r   t   _   p   l   a   y   i   n   g   )       {   
           c   o   n   s   t       f   i   l   e   P   a   t   h       =       U   T   F   8   T   o   S   t   r   i   n   g   (   p   a   t   h   _   i   n   _   v   f   s   )   ;   
           c   o   n   s   t       a   u   d   i   o   C   o   n   t   e   x   t       =       w   i   n   d   o   w   .   p   r   o   j   e   c   t   M   A   u   d   i   o   C   o   n   t   e   x   t   _   G   l   o   b   a   l   _   C   p   p   ;   
           c   o   n   s   t       w   o   r   k   l   e   t   N   o   d   e       =       w   i   n   d   o   w   .   p   r   o   j   e   c   t   M   W   o   r   k   l   e   t   N   o   d   e   _   G   l   o   b   a   l   _   C   p   p   ;   
           i   f       (   !   a   u   d   i   o   C   o   n   t   e   x   t       |   |       !   w   o   r   k   l   e   t   N   o   d   e   )       {   
                   r   e   t   u   r   n   ;   
           }   
           a   s   y   n   c       f   u   n   c   t   i   o   n       d   e   c   o   d   e   A   n   d   S   e   n   d   (   )       {   
                   t   r   y       {   
                           c   o   n   s   t       f   i   l   e   D   a   t   a   U   i   n   t   8   A   r   r   a   y       =       F   S   .   r   e   a   d   F   i   l   e   (   f   i   l   e   P   a   t   h   )   ;   
                           c   o   n   s   o   l   e   .   l   o   g   (   `   J   S       L   o   a   d       S   o   n   g   :       R   e   a   d       $   {   f   i   l   e   D   a   t   a   U   i   n   t   8   A   r   r   a   y   .   l   e   n   g   t   h   }       b   y   t   e   s       f   r   o   m       $   {   f   i   l   e   P   a   t   h   }   .   `   )   ;   
                           i   f       (   f   i   l   e   D   a   t   a   U   i   n   t   8   A   r   r   a   y   .   l   e   n   g   t   h       =   =   =       0   )       {   
                                   r   e   t   u   r   n   ;   
                           }   
                           c   o   n   s   t       a   u   d   i   o   D   a   t   a   A   r   r   a   y   B   u   f   f   e   r       =       f   i   l   e   D   a   t   a   U   i   n   t   8   A   r   r   a   y   .   b   u   f   f   e   r   .   s   l   i   c   e   (   f   i   l   e   D   a   t   a   U   i   n   t   8   A   r   r   a   y   .   b   y   t   e   O   f   f   s   e   t   ,       f   i   l   e   D   a   t   a   U   i   n   t   8   A   r   r   a   y   .   b   y   t   e   O   f   f   s   e   t       +       f   i   l   e   D   a   t   a   U   i   n   t   8   A   r   r   a   y   .   b   y   t   e   L   e   n   g   t   h   )   ;   
                           i   f       (   a   u   d   i   o   C   o   n   t   e   x   t   .   s   t   a   t   e       =   =   =       "   s   u   s   p   e   n   d   e   d   "   )       {   
                                   a   w   a   i   t       a   u   d   i   o   C   o   n   t   e   x   t   .   r   e   s   u   m   e   (   )   ;   
                           }   
                           c   o   n   s   t       d   e   c   o   d   e   d   B   u   f   f   e   r       =       a   w   a   i   t       a   u   d   i   o   C   o   n   t   e   x   t   .   d   e   c   o   d   e   A   u   d   i   o   D   a   t   a   (   a   u   d   i   o   D   a   t   a   A   r   r   a   y   B   u   f   f   e   r   )   ;   
                           c   o   n   s   o   l   e   .   l   o   g   (   `   J   S       L   o   a   d       S   o   n   g   :       D   e   c   o   d   e   d       b   u   f   f   e   r   .       D   u   r   a   t   i   o   n   :       $   {   d   e   c   o   d   e   d   B   u   f   f   e   r   .   d   u   r   a   t   i   o   n   .   t   o   F   i   x   e   d   (   2   )   }   s   .       S   e   n   d   i   n   g       t   o       w   o   r   k   l   e   t   .   `   )   ;   
                           c   o   n   s   t       r   a   w   C   h   a   n   n   e   l   D   a   t   a       =       A   r   r   a   y   .   f   r   o   m   (   {   
                                   l   e   n   g   t   h   :       d   e   c   o   d   e   d   B   u   f   f   e   r   .   n   u   m   b   e   r   O   f   C   h   a   n   n   e   l   s   
                           }   ,       (   _   ,       i   )       =   >       d   e   c   o   d   e   d   B   u   f   f   e   r   .   g   e   t   C   h   a   n   n   e   l   D   a   t   a   (   i   )   )   ;   
                           w   o   r   k   l   e   t   N   o   d   e   .   p   o   r   t   .   p   o   s   t   M   e   s   s   a   g   e   (   {   
                                   t   y   p   e   :       "   l   o   a   d   W   a   v   D   a   t   a   "   ,   
                                   c   h   a   n   n   e   l   D   a   t   a   :       r   a   w   C   h   a   n   n   e   l   D   a   t   a   ,   
                                   s   a   m   p   l   e   R   a   t   e   :       d   e   c   o   d   e   d   B   u   f   f   e   r   .   s   a   m   p   l   e   R   a   t   e   ,   
                                   l   o   o   p   ,   
                                   s   t   a   r   t   P   l   a   y   i   n   g   :       s   t   a   r   t   _   p   l   a   y   i   n   g   
                           }   )   ;   
                   }       c   a   t   c   h       (   e   )       {   
                           c   o   n   s   o   l   e   .   e   r   r   o   r   (   "   J   S       L   o   a   d       S   o   n   g   :       E   r   r   o   r       d   u   r   i   n   g       d   e   c   o   d   e       a   n   d       s   e   n   d   :   "   ,       e   )   ;   
                   }   
           }   
           d   e   c   o   d   e   A   n   d   S   e   n   d   (   )   ;   
           r   e   t   u   r   n   ;   
   }   
   
   f   u   n   c   t   i   o   n       g   e   t   C   u   s   t   o   m   S   h   a   d   e   r   (   )       {   
           v   a   r       p   t   h       =       d   o   c   u   m   e   n   t   .   q   u   e   r   y   S   e   l   e   c   t   o   r   (   "   #   m   i   l   k   P   a   t   h   2   "   )   .   i   n   n   e   r   H   T   M   L   ;   
           c   o   n   s   o   l   e   .   l   o   g   (   "   G   e   t   t   i   n   g       p   r   e   s   e   t   :       "       +       p   t   h   )   ;   
           c   o   n   s   t       f   f       =       n   e   w       X   M   L   H   t   t   p   R   e   q   u   e   s   t   ;   
           f   f   .   o   p   e   n   (   "   G   E   T   "   ,       p   t   h   ,       t   r   u   e   )   ;   
           f   f   .   r   e   s   p   o   n   s   e   T   y   p   e       =       "   a   r   r   a   y   b   u   f   f   e   r   "   ;   
           d   o   c   u   m   e   n   t   .   q   u   e   r   y   S   e   l   e   c   t   o   r   (   "   #   s   t   a   t   "   )   .   i   n   n   e   r   H   T   M   L       =       "   D   o   w   n   l   o   a   d   i   n   g       S   h   a   d   e   r   "   ;   
           d   o   c   u   m   e   n   t   .   q   u   e   r   y   S   e   l   e   c   t   o   r   (   "   #   s   t   a   t   "   )   .   s   t   y   l   e   .   b   a   c   k   g   r   o   u   n   d   C   o   l   o   r       =       "   y   e   l   l   o   w   "   ;   
           f   f   .   a   d   d   E   v   e   n   t   L   i   s   t   e   n   e   r   (   "   l   o   a   d   "   ,       f   u   n   c   t   i   o   n   (   )       {   
                   l   e   t       s   a   r   r   a   y   B   u   f   f   e   r       =       f   f   .   r   e   s   p   o   n   s   e   ;   
                   i   f       (   s   a   r   r   a   y   B   u   f   f   e   r   )       {   
                           l   e   t       s   f   i   l       =       n   e   w       U   i   n   t   8   C   l   a   m   p   e   d   A   r   r   a   y   (   s   a   r   r   a   y   B   u   f   f   e   r   )   ;   
                           F   S   .   w   r   i   t   e   F   i   l   e   (   "   /   p   r   e   s   e   t   s   /   p   r   e   s   e   t   _   c   u   s   t   o   m   .   m   i   l   k   "   ,       s   f   i   l   )   ;   
                           s   e   t   T   i   m   e   o   u   t   (   f   u   n   c   t   i   o   n   (   )       {   
                                   M   o   d   u   l   e   .   l   o   a   d   P   r   e   s   e   t   F   i   l   e   (   "   /   p   r   e   s   e   t   s   /   p   r   e   s   e   t   _   c   u   s   t   o   m   .   m   i   l   k   "   )   ;   
                                   d   o   c   u   m   e   n   t   .   q   u   e   r   y   S   e   l   e   c   t   o   r   (   "   #   s   t   a   t   "   )   .   i   n   n   e   r   H   T   M   L       =       "   D   o   w   n   l   o   a   d   e   d       S   h   a   d   e   r   "   ;   
                                   d   o   c   u   m   e   n   t   .   q   u   e   r   y   S   e   l   e   c   t   o   r   (   "   #   s   t   a   t   "   )   .   s   t   y   l   e   .   b   a   c   k   g   r   o   u   n   d   C   o   l   o   r       =       "   b   l   u   e   "   ;   
                           }   ,       2   0   )   ;   
                   }   
           }   )   ;   
           f   f   .   s   e   n   d   (   n   u   l   l   )   ;   
           r   e   t   u   r   n   ;   
   }   
   
   f   u   n   c   t   i   o   n       g   e   t   S   h   a   d   e   r   (   n   u   m   )       {   
           v   a   r       p   t   h       =       d   o   c   u   m   e   n   t   .   q   u   e   r   y   S   e   l   e   c   t   o   r   (   "   #   m   i   l   k   P   a   t   h   "   )   .   i   n   n   e   r   H   T   M   L   ;   
           c   o   n   s   o   l   e   .   l   o   g   (   "   G   e   t   t   i   n   g       p   r   e   s   e   t   :       "       +       p   t   h   )   ;   
           c   o   n   s   t       f   f       =       n   e   w       X   M   L   H   t   t   p   R   e   q   u   e   s   t   ;   
           f   f   .   o   p   e   n   (   "   G   E   T   "   ,       p   t   h   ,       t   r   u   e   )   ;   
           f   f   .   r   e   s   p   o   n   s   e   T   y   p   e       =       "   a   r   r   a   y   b   u   f   f   e   r   "   ;   
           d   o   c   u   m   e   n   t   .   q   u   e   r   y   S   e   l   e   c   t   o   r   (   "   #   s   t   a   t   "   )   .   i   n   n   e   r   H   T   M   L       =       "   D   o   w   n   l   o   a   d   i   n   g       S   h   a   d   e   r   "   ;   
           d   o   c   u   m   e   n   t   .   q   u   e   r   y   S   e   l   e   c   t   o   r   (   "   #   s   t   a   t   "   )   .   s   t   y   l   e   .   b   a   c   k   g   r   o   u   n   d   C   o   l   o   r       =       "   y   e   l   l   o   w   "   ;   
           f   f   .   a   d   d   E   v   e   n   t   L   i   s   t   e   n   e   r   (   "   l   o   a   d   "   ,       f   u   n   c   t   i   o   n   (   )       {   
                   l   e   t       s   a   r   r   a   y   B   u   f   f   e   r       =       f   f   .   r   e   s   p   o   n   s   e   ;   
                   i   f       (   s   a   r   r   a   y   B   u   f   f   e   r   )       {   
                           l   e   t       s   f   i   l       =       n   e   w       U   i   n   t   8   C   l   a   m   p   e   d   A   r   r   a   y   (   s   a   r   r   a   y   B   u   f   f   e   r   )   ;   
                           F   S   .   w   r   i   t   e   F   i   l   e   (   "   /   p   r   e   s   e   t   s   /   p   r   e   s   e   t   _   "       +       n   u   m       +       "   .   m   i   l   k   "   ,       s   f   i   l   )   ;   
                           s   e   t   T   i   m   e   o   u   t   (   f   u   n   c   t   i   o   n   (   )       {   
                                   d   o   c   u   m   e   n   t   .   q   u   e   r   y   S   e   l   e   c   t   o   r   (   "   #   s   t   a   t   "   )   .   i   n   n   e   r   H   T   M   L       =       "   D   o   w   n   l   o   a   d   e   d       S   h   a   d   e   r   "   ;   
                                   d   o   c   u   m   e   n   t   .   q   u   e   r   y   S   e   l   e   c   t   o   r   (   "   #   s   t   a   t   "   )   .   s   t   y   l   e   .   b   a   c   k   g   r   o   u   n   d   C   o   l   o   r       =       "   b   l   u   e   "   ;   
                           }   ,       2   0   )   ;   
                   }   
           }   )   ;   
           f   f   .   s   e   n   d   (   n   u   l   l   )   ;   
           r   e   t   u   r   n   ;   
   }   
   
   /   /       I   m   p   o   r   t   s       f   r   o   m       t   h   e       W   a   s   m       b   i   n   a   r   y   .   
   v   a   r       _   p   l       =       M   o   d   u   l   e   [   "   _   p   l   "   ]       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   p   l   "   )   ;   
   
   v   a   r       _   s   e   t   _   a   u   d   i   o   _   s   o   u   r   c   e   _   t   o   _   s   t   r   e   a   m       =       M   o   d   u   l   e   [   "   _   s   e   t   _   a   u   d   i   o   _   s   o   u   r   c   e   _   t   o   _   s   t   r   e   a   m   "   ]       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   s   e   t   _   a   u   d   i   o   _   s   o   u   r   c   e   _   t   o   _   s   t   r   e   a   m   "   )   ;   
   
   v   a   r       _   s   t   o   p   _   w   o   r   k   l   e   t   _   p   l   a   y   b   a   c   k       =       M   o   d   u   l   e   [   "   _   s   t   o   p   _   w   o   r   k   l   e   t   _   p   l   a   y   b   a   c   k   "   ]       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   s   t   o   p   _   w   o   r   k   l   e   t   _   p   l   a   y   b   a   c   k   "   )   ;   
   
   v   a   r       _   a   d   d   _   a   u   d   i   o   _   d   a   t   a       =       M   o   d   u   l   e   [   "   _   a   d   d   _   a   u   d   i   o   _   d   a   t   a   "   ]       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   a   d   d   _   a   u   d   i   o   _   d   a   t   a   "   )   ;   
   
   v   a   r       _   p   t   h   r   e   a   d   _   s   e   l   f       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   p   t   h   r   e   a   d   _   s   e   l   f   "   )   ;   
   
   v   a   r       _   m   a   i   n       =       M   o   d   u   l   e   [   "   _   m   a   i   n   "   ]       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   m   a   i   n   "   )   ;   
   
   v   a   r       _   _   _   g   e   t   T   y   p   e   N   a   m   e       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   _   g   e   t   T   y   p   e   N   a   m   e   "   )   ;   
   
   v   a   r       _   _   e   m   b   i   n   d   _   i   n   i   t   i   a   l   i   z   e   _   b   i   n   d   i   n   g   s       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   e   m   b   i   n   d   _   i   n   i   t   i   a   l   i   z   e   _   b   i   n   d   i   n   g   s   "   )   ;   
   
   v   a   r       _   f   r   e   e       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   f   r   e   e   "   )   ;   
   
   v   a   r       _   m   a   l   l   o   c       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   m   a   l   l   o   c   "   )   ;   
   
   v   a   r       _   _   e   m   s   c   r   i   p   t   e   n   _   t   l   s   _   i   n   i   t       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   e   m   s   c   r   i   p   t   e   n   _   t   l   s   _   i   n   i   t   "   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   b   u   i   l   t   i   n   _   m   e   m   a   l   i   g   n       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   e   m   s   c   r   i   p   t   e   n   _   b   u   i   l   t   i   n   _   m   e   m   a   l   i   g   n   "   )   ;   
   
   v   a   r       _   _   e   m   s   c   r   i   p   t   e   n   _   t   h   r   e   a   d   _   i   n   i   t       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   e   m   s   c   r   i   p   t   e   n   _   t   h   r   e   a   d   _   i   n   i   t   "   )   ;   
   
   v   a   r       _   _   e   m   s   c   r   i   p   t   e   n   _   t   h   r   e   a   d   _   c   r   a   s   h   e   d       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   e   m   s   c   r   i   p   t   e   n   _   t   h   r   e   a   d   _   c   r   a   s   h   e   d   "   )   ;   
   
   v   a   r       _   f   f   l   u   s   h       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   f   f   l   u   s   h   "   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   s   t   a   c   k   _   g   e   t   _   b   a   s   e       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   e   m   s   c   r   i   p   t   e   n   _   s   t   a   c   k   _   g   e   t   _   b   a   s   e   "   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   s   t   a   c   k   _   g   e   t   _   e   n   d       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   e   m   s   c   r   i   p   t   e   n   _   s   t   a   c   k   _   g   e   t   _   e   n   d   "   )   ;   
   
   v   a   r       _   _   e   m   s   c   r   i   p   t   e   n   _   r   u   n   _   o   n   _   m   a   i   n   _   t   h   r   e   a   d   _   j   s       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   e   m   s   c   r   i   p   t   e   n   _   r   u   n   _   o   n   _   m   a   i   n   _   t   h   r   e   a   d   _   j   s   "   )   ;   
   
   v   a   r       _   _   e   m   s   c   r   i   p   t   e   n   _   t   h   r   e   a   d   _   f   r   e   e   _   d   a   t   a       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   e   m   s   c   r   i   p   t   e   n   _   t   h   r   e   a   d   _   f   r   e   e   _   d   a   t   a   "   )   ;   
   
   v   a   r       _   _   e   m   s   c   r   i   p   t   e   n   _   t   h   r   e   a   d   _   e   x   i   t       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   e   m   s   c   r   i   p   t   e   n   _   t   h   r   e   a   d   _   e   x   i   t   "   )   ;   
   
   v   a   r       _   _   e   m   s   c   r   i   p   t   e   n   _   c   h   e   c   k   _   m   a   i   l   b   o   x       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   e   m   s   c   r   i   p   t   e   n   _   c   h   e   c   k   _   m   a   i   l   b   o   x   "   )   ;   
   
   v   a   r       _   s   e   t   T   h   r   e   w       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   s   e   t   T   h   r   e   w   "   )   ;   
   
   v   a   r       _   _   e   m   s   c   r   i   p   t   e   n   _   t   e   m   p   r   e   t   _   s   e   t       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   e   m   s   c   r   i   p   t   e   n   _   t   e   m   p   r   e   t   _   s   e   t   "   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   s   t   a   c   k   _   i   n   i   t       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   e   m   s   c   r   i   p   t   e   n   _   s   t   a   c   k   _   i   n   i   t   "   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   s   t   a   c   k   _   s   e   t   _   l   i   m   i   t   s       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   e   m   s   c   r   i   p   t   e   n   _   s   t   a   c   k   _   s   e   t   _   l   i   m   i   t   s   "   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   s   t   a   c   k   _   g   e   t   _   f   r   e   e       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   e   m   s   c   r   i   p   t   e   n   _   s   t   a   c   k   _   g   e   t   _   f   r   e   e   "   )   ;   
   
   v   a   r       _   _   e   m   s   c   r   i   p   t   e   n   _   s   t   a   c   k   _   r   e   s   t   o   r   e       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   e   m   s   c   r   i   p   t   e   n   _   s   t   a   c   k   _   r   e   s   t   o   r   e   "   )   ;   
   
   v   a   r       _   _   e   m   s   c   r   i   p   t   e   n   _   s   t   a   c   k   _   a   l   l   o   c       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   e   m   s   c   r   i   p   t   e   n   _   s   t   a   c   k   _   a   l   l   o   c   "   )   ;   
   
   v   a   r       _   e   m   s   c   r   i   p   t   e   n   _   s   t   a   c   k   _   g   e   t   _   c   u   r   r   e   n   t       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   e   m   s   c   r   i   p   t   e   n   _   s   t   a   c   k   _   g   e   t   _   c   u   r   r   e   n   t   "   )   ;   
   
   v   a   r       _   _   _   c   x   a   _   d   e   c   r   e   m   e   n   t   _   e   x   c   e   p   t   i   o   n   _   r   e   f   c   o   u   n   t       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   _   c   x   a   _   d   e   c   r   e   m   e   n   t   _   e   x   c   e   p   t   i   o   n   _   r   e   f   c   o   u   n   t   "   )   ;   
   
   v   a   r       _   _   _   c   x   a   _   i   n   c   r   e   m   e   n   t   _   e   x   c   e   p   t   i   o   n   _   r   e   f   c   o   u   n   t       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   _   c   x   a   _   i   n   c   r   e   m   e   n   t   _   e   x   c   e   p   t   i   o   n   _   r   e   f   c   o   u   n   t   "   )   ;   
   
   v   a   r       _   _   _   c   x   a   _   c   a   n   _   c   a   t   c   h       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   _   c   x   a   _   c   a   n   _   c   a   t   c   h   "   )   ;   
   
   v   a   r       _   _   _   c   x   a   _   g   e   t   _   e   x   c   e   p   t   i   o   n   _   p   t   r       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   _   c   x   a   _   g   e   t   _   e   x   c   e   p   t   i   o   n   _   p   t   r   "   )   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   r   e   a   d   _   f   i   l   e       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   w   a   s   m   f   s   _   r   e   a   d   _   f   i   l   e   "   )   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   w   r   i   t   e   _   f   i   l   e       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   w   a   s   m   f   s   _   w   r   i   t   e   _   f   i   l   e   "   )   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   m   k   d   i   r       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   w   a   s   m   f   s   _   m   k   d   i   r   "   )   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   r   m   d   i   r       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   w   a   s   m   f   s   _   r   m   d   i   r   "   )   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   o   p   e   n       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   w   a   s   m   f   s   _   o   p   e   n   "   )   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   m   k   n   o   d       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   w   a   s   m   f   s   _   m   k   n   o   d   "   )   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   u   n   l   i   n   k       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   w   a   s   m   f   s   _   u   n   l   i   n   k   "   )   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   c   h   d   i   r       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   w   a   s   m   f   s   _   c   h   d   i   r   "   )   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   s   y   m   l   i   n   k       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   w   a   s   m   f   s   _   s   y   m   l   i   n   k   "   )   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   r   e   a   d   l   i   n   k       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   w   a   s   m   f   s   _   r   e   a   d   l   i   n   k   "   )   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   w   r   i   t   e       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   w   a   s   m   f   s   _   w   r   i   t   e   "   )   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   p   w   r   i   t   e       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   w   a   s   m   f   s   _   p   w   r   i   t   e   "   )   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   c   h   m   o   d       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   w   a   s   m   f   s   _   c   h   m   o   d   "   )   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   f   c   h   m   o   d       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   w   a   s   m   f   s   _   f   c   h   m   o   d   "   )   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   l   c   h   m   o   d       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   w   a   s   m   f   s   _   l   c   h   m   o   d   "   )   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   l   l   s   e   e   k       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   w   a   s   m   f   s   _   l   l   s   e   e   k   "   )   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   r   e   n   a   m   e       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   w   a   s   m   f   s   _   r   e   n   a   m   e   "   )   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   r   e   a   d       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   w   a   s   m   f   s   _   r   e   a   d   "   )   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   p   r   e   a   d       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   w   a   s   m   f   s   _   p   r   e   a   d   "   )   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   t   r   u   n   c   a   t   e       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   w   a   s   m   f   s   _   t   r   u   n   c   a   t   e   "   )   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   f   t   r   u   n   c   a   t   e       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   w   a   s   m   f   s   _   f   t   r   u   n   c   a   t   e   "   )   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   c   l   o   s   e       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   w   a   s   m   f   s   _   c   l   o   s   e   "   )   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   m   m   a   p       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   w   a   s   m   f   s   _   m   m   a   p   "   )   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   m   s   y   n   c       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   w   a   s   m   f   s   _   m   s   y   n   c   "   )   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   m   u   n   m   a   p       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   w   a   s   m   f   s   _   m   u   n   m   a   p   "   )   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   u   t   i   m   e       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   w   a   s   m   f   s   _   u   t   i   m   e   "   )   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   s   t   a   t       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   w   a   s   m   f   s   _   s   t   a   t   "   )   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   l   s   t   a   t       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   w   a   s   m   f   s   _   l   s   t   a   t   "   )   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   m   o   u   n   t       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   w   a   s   m   f   s   _   m   o   u   n   t   "   )   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   i   d   e   n   t   i   f   y       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   w   a   s   m   f   s   _   i   d   e   n   t   i   f   y   "   )   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   r   e   a   d   d   i   r   _   s   t   a   r   t       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   w   a   s   m   f   s   _   r   e   a   d   d   i   r   _   s   t   a   r   t   "   )   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   r   e   a   d   d   i   r   _   g   e   t       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   w   a   s   m   f   s   _   r   e   a   d   d   i   r   _   g   e   t   "   )   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   r   e   a   d   d   i   r   _   f   i   n   i   s   h       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   w   a   s   m   f   s   _   r   e   a   d   d   i   r   _   f   i   n   i   s   h   "   )   ;   
   
   v   a   r       _   _   w   a   s   m   f   s   _   g   e   t   _   c   w   d       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   _   w   a   s   m   f   s   _   g   e   t   _   c   w   d   "   )   ;   
   
   v   a   r       _   w   a   s   m   f   s   _   c   r   e   a   t   e   _   j   s   i   m   p   l   _   b   a   c   k   e   n   d       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   w   a   s   m   f   s   _   c   r   e   a   t   e   _   j   s   i   m   p   l   _   b   a   c   k   e   n   d   "   )   ;   
   
   v   a   r       _   w   a   s   m   f   s   _   c   r   e   a   t   e   _   m   e   m   o   r   y   _   b   a   c   k   e   n   d       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   w   a   s   m   f   s   _   c   r   e   a   t   e   _   m   e   m   o   r   y   _   b   a   c   k   e   n   d   "   )   ;   
   
   v   a   r       _   w   a   s   m   f   s   _   c   r   e   a   t   e   _   f   i   l   e       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   w   a   s   m   f   s   _   c   r   e   a   t   e   _   f   i   l   e   "   )   ;   
   
   v   a   r       _   w   a   s   m   f   s   _   u   n   m   o   u   n   t       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   w   a   s   m   f   s   _   u   n   m   o   u   n   t   "   )   ;   
   
   v   a   r       _   w   a   s   m   f   s   _   f   l   u   s   h       =       m   a   k   e   I   n   v   a   l   i   d   E   a   r   l   y   A   c   c   e   s   s   (   "   _   w   a   s   m   f   s   _   f   l   u   s   h   "   )   ;   
   
   f   u   n   c   t   i   o   n       a   s   s   i   g   n   W   a   s   m   E   x   p   o   r   t   s   (   w   a   s   m   E   x   p   o   r   t   s   )       {   
           M   o   d   u   l   e   [   "   _   p   l   "   ]       =       _   p   l       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   p   l   "   ,       1   )   ;   
           M   o   d   u   l   e   [   "   _   s   e   t   _   a   u   d   i   o   _   s   o   u   r   c   e   _   t   o   _   s   t   r   e   a   m   "   ]       =       _   s   e   t   _   a   u   d   i   o   _   s   o   u   r   c   e   _   t   o   _   s   t   r   e   a   m       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   s   e   t   _   a   u   d   i   o   _   s   o   u   r   c   e   _   t   o   _   s   t   r   e   a   m   "   ,       1   )   ;   
           M   o   d   u   l   e   [   "   _   s   t   o   p   _   w   o   r   k   l   e   t   _   p   l   a   y   b   a   c   k   "   ]       =       _   s   t   o   p   _   w   o   r   k   l   e   t   _   p   l   a   y   b   a   c   k       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   s   t   o   p   _   w   o   r   k   l   e   t   _   p   l   a   y   b   a   c   k   "   ,       0   )   ;   
           M   o   d   u   l   e   [   "   _   a   d   d   _   a   u   d   i   o   _   d   a   t   a   "   ]       =       _   a   d   d   _   a   u   d   i   o   _   d   a   t   a       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   a   d   d   _   a   u   d   i   o   _   d   a   t   a   "   ,       2   )   ;   
           _   p   t   h   r   e   a   d   _   s   e   l   f       =       w   a   s   m   E   x   p   o   r   t   s   [   "   p   t   h   r   e   a   d   _   s   e   l   f   "   ]   ;   
           M   o   d   u   l   e   [   "   _   m   a   i   n   "   ]       =       _   m   a   i   n       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   m   a   i   n   "   ,       2   )   ;   
           _   _   _   g   e   t   T   y   p   e   N   a   m   e       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   _   g   e   t   T   y   p   e   N   a   m   e   "   ,       1   )   ;   
           _   _   e   m   b   i   n   d   _   i   n   i   t   i   a   l   i   z   e   _   b   i   n   d   i   n   g   s       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   e   m   b   i   n   d   _   i   n   i   t   i   a   l   i   z   e   _   b   i   n   d   i   n   g   s   "   ,       0   )   ;   
           _   f   r   e   e       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   f   r   e   e   "   ,       1   )   ;   
           _   m   a   l   l   o   c       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   m   a   l   l   o   c   "   ,       1   )   ;   
           _   _   e   m   s   c   r   i   p   t   e   n   _   t   l   s   _   i   n   i   t       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   e   m   s   c   r   i   p   t   e   n   _   t   l   s   _   i   n   i   t   "   ,       0   )   ;   
           _   e   m   s   c   r   i   p   t   e   n   _   b   u   i   l   t   i   n   _   m   e   m   a   l   i   g   n       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   e   m   s   c   r   i   p   t   e   n   _   b   u   i   l   t   i   n   _   m   e   m   a   l   i   g   n   "   ,       2   )   ;   
           _   _   e   m   s   c   r   i   p   t   e   n   _   t   h   r   e   a   d   _   i   n   i   t       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   e   m   s   c   r   i   p   t   e   n   _   t   h   r   e   a   d   _   i   n   i   t   "   ,       6   )   ;   
           _   _   e   m   s   c   r   i   p   t   e   n   _   t   h   r   e   a   d   _   c   r   a   s   h   e   d       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   e   m   s   c   r   i   p   t   e   n   _   t   h   r   e   a   d   _   c   r   a   s   h   e   d   "   ,       0   )   ;   
           _   f   f   l   u   s   h       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   f   f   l   u   s   h   "   ,       1   )   ;   
           _   e   m   s   c   r   i   p   t   e   n   _   s   t   a   c   k   _   g   e   t   _   b   a   s   e       =       w   a   s   m   E   x   p   o   r   t   s   [   "   e   m   s   c   r   i   p   t   e   n   _   s   t   a   c   k   _   g   e   t   _   b   a   s   e   "   ]   ;   
           _   e   m   s   c   r   i   p   t   e   n   _   s   t   a   c   k   _   g   e   t   _   e   n   d       =       w   a   s   m   E   x   p   o   r   t   s   [   "   e   m   s   c   r   i   p   t   e   n   _   s   t   a   c   k   _   g   e   t   _   e   n   d   "   ]   ;   
           _   _   e   m   s   c   r   i   p   t   e   n   _   r   u   n   _   o   n   _   m   a   i   n   _   t   h   r   e   a   d   _   j   s       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   e   m   s   c   r   i   p   t   e   n   _   r   u   n   _   o   n   _   m   a   i   n   _   t   h   r   e   a   d   _   j   s   "   ,       5   )   ;   
           _   _   e   m   s   c   r   i   p   t   e   n   _   t   h   r   e   a   d   _   f   r   e   e   _   d   a   t   a       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   e   m   s   c   r   i   p   t   e   n   _   t   h   r   e   a   d   _   f   r   e   e   _   d   a   t   a   "   ,       1   )   ;   
           _   _   e   m   s   c   r   i   p   t   e   n   _   t   h   r   e   a   d   _   e   x   i   t       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   e   m   s   c   r   i   p   t   e   n   _   t   h   r   e   a   d   _   e   x   i   t   "   ,       1   )   ;   
           _   _   e   m   s   c   r   i   p   t   e   n   _   c   h   e   c   k   _   m   a   i   l   b   o   x       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   e   m   s   c   r   i   p   t   e   n   _   c   h   e   c   k   _   m   a   i   l   b   o   x   "   ,       0   )   ;   
           _   s   e   t   T   h   r   e   w       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   s   e   t   T   h   r   e   w   "   ,       2   )   ;   
           _   _   e   m   s   c   r   i   p   t   e   n   _   t   e   m   p   r   e   t   _   s   e   t       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   e   m   s   c   r   i   p   t   e   n   _   t   e   m   p   r   e   t   _   s   e   t   "   ,       1   )   ;   
           _   e   m   s   c   r   i   p   t   e   n   _   s   t   a   c   k   _   i   n   i   t       =       w   a   s   m   E   x   p   o   r   t   s   [   "   e   m   s   c   r   i   p   t   e   n   _   s   t   a   c   k   _   i   n   i   t   "   ]   ;   
           _   e   m   s   c   r   i   p   t   e   n   _   s   t   a   c   k   _   s   e   t   _   l   i   m   i   t   s       =       w   a   s   m   E   x   p   o   r   t   s   [   "   e   m   s   c   r   i   p   t   e   n   _   s   t   a   c   k   _   s   e   t   _   l   i   m   i   t   s   "   ]   ;   
           _   e   m   s   c   r   i   p   t   e   n   _   s   t   a   c   k   _   g   e   t   _   f   r   e   e       =       w   a   s   m   E   x   p   o   r   t   s   [   "   e   m   s   c   r   i   p   t   e   n   _   s   t   a   c   k   _   g   e   t   _   f   r   e   e   "   ]   ;   
           _   _   e   m   s   c   r   i   p   t   e   n   _   s   t   a   c   k   _   r   e   s   t   o   r   e       =       w   a   s   m   E   x   p   o   r   t   s   [   "   _   e   m   s   c   r   i   p   t   e   n   _   s   t   a   c   k   _   r   e   s   t   o   r   e   "   ]   ;   
           _   _   e   m   s   c   r   i   p   t   e   n   _   s   t   a   c   k   _   a   l   l   o   c       =       w   a   s   m   E   x   p   o   r   t   s   [   "   _   e   m   s   c   r   i   p   t   e   n   _   s   t   a   c   k   _   a   l   l   o   c   "   ]   ;   
           _   e   m   s   c   r   i   p   t   e   n   _   s   t   a   c   k   _   g   e   t   _   c   u   r   r   e   n   t       =       w   a   s   m   E   x   p   o   r   t   s   [   "   e   m   s   c   r   i   p   t   e   n   _   s   t   a   c   k   _   g   e   t   _   c   u   r   r   e   n   t   "   ]   ;   
           _   _   _   c   x   a   _   d   e   c   r   e   m   e   n   t   _   e   x   c   e   p   t   i   o   n   _   r   e   f   c   o   u   n   t       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   _   c   x   a   _   d   e   c   r   e   m   e   n   t   _   e   x   c   e   p   t   i   o   n   _   r   e   f   c   o   u   n   t   "   ,       1   )   ;   
           _   _   _   c   x   a   _   i   n   c   r   e   m   e   n   t   _   e   x   c   e   p   t   i   o   n   _   r   e   f   c   o   u   n   t       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   _   c   x   a   _   i   n   c   r   e   m   e   n   t   _   e   x   c   e   p   t   i   o   n   _   r   e   f   c   o   u   n   t   "   ,       1   )   ;   
           _   _   _   c   x   a   _   c   a   n   _   c   a   t   c   h       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   _   c   x   a   _   c   a   n   _   c   a   t   c   h   "   ,       3   )   ;   
           _   _   _   c   x   a   _   g   e   t   _   e   x   c   e   p   t   i   o   n   _   p   t   r       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   _   c   x   a   _   g   e   t   _   e   x   c   e   p   t   i   o   n   _   p   t   r   "   ,       1   )   ;   
           _   _   w   a   s   m   f   s   _   r   e   a   d   _   f   i   l   e       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   w   a   s   m   f   s   _   r   e   a   d   _   f   i   l   e   "   ,       3   )   ;   
           _   _   w   a   s   m   f   s   _   w   r   i   t   e   _   f   i   l   e       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   w   a   s   m   f   s   _   w   r   i   t   e   _   f   i   l   e   "   ,       3   )   ;   
           _   _   w   a   s   m   f   s   _   m   k   d   i   r       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   w   a   s   m   f   s   _   m   k   d   i   r   "   ,       2   )   ;   
           _   _   w   a   s   m   f   s   _   r   m   d   i   r       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   w   a   s   m   f   s   _   r   m   d   i   r   "   ,       1   )   ;   
           _   _   w   a   s   m   f   s   _   o   p   e   n       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   w   a   s   m   f   s   _   o   p   e   n   "   ,       3   )   ;   
           _   _   w   a   s   m   f   s   _   m   k   n   o   d       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   w   a   s   m   f   s   _   m   k   n   o   d   "   ,       3   )   ;   
           _   _   w   a   s   m   f   s   _   u   n   l   i   n   k       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   w   a   s   m   f   s   _   u   n   l   i   n   k   "   ,       1   )   ;   
           _   _   w   a   s   m   f   s   _   c   h   d   i   r       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   w   a   s   m   f   s   _   c   h   d   i   r   "   ,       1   )   ;   
           _   _   w   a   s   m   f   s   _   s   y   m   l   i   n   k       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   w   a   s   m   f   s   _   s   y   m   l   i   n   k   "   ,       2   )   ;   
           _   _   w   a   s   m   f   s   _   r   e   a   d   l   i   n   k       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   w   a   s   m   f   s   _   r   e   a   d   l   i   n   k   "   ,       2   )   ;   
           _   _   w   a   s   m   f   s   _   w   r   i   t   e       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   w   a   s   m   f   s   _   w   r   i   t   e   "   ,       3   )   ;   
           _   _   w   a   s   m   f   s   _   p   w   r   i   t   e       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   w   a   s   m   f   s   _   p   w   r   i   t   e   "   ,       4   )   ;   
           _   _   w   a   s   m   f   s   _   c   h   m   o   d       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   w   a   s   m   f   s   _   c   h   m   o   d   "   ,       2   )   ;   
           _   _   w   a   s   m   f   s   _   f   c   h   m   o   d       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   w   a   s   m   f   s   _   f   c   h   m   o   d   "   ,       2   )   ;   
           _   _   w   a   s   m   f   s   _   l   c   h   m   o   d       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   w   a   s   m   f   s   _   l   c   h   m   o   d   "   ,       2   )   ;   
           _   _   w   a   s   m   f   s   _   l   l   s   e   e   k       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   w   a   s   m   f   s   _   l   l   s   e   e   k   "   ,       3   )   ;   
           _   _   w   a   s   m   f   s   _   r   e   n   a   m   e       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   w   a   s   m   f   s   _   r   e   n   a   m   e   "   ,       2   )   ;   
           _   _   w   a   s   m   f   s   _   r   e   a   d       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   w   a   s   m   f   s   _   r   e   a   d   "   ,       3   )   ;   
           _   _   w   a   s   m   f   s   _   p   r   e   a   d       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   w   a   s   m   f   s   _   p   r   e   a   d   "   ,       4   )   ;   
           _   _   w   a   s   m   f   s   _   t   r   u   n   c   a   t   e       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   w   a   s   m   f   s   _   t   r   u   n   c   a   t   e   "   ,       2   )   ;   
           _   _   w   a   s   m   f   s   _   f   t   r   u   n   c   a   t   e       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   w   a   s   m   f   s   _   f   t   r   u   n   c   a   t   e   "   ,       2   )   ;   
           _   _   w   a   s   m   f   s   _   c   l   o   s   e       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   w   a   s   m   f   s   _   c   l   o   s   e   "   ,       1   )   ;   
           _   _   w   a   s   m   f   s   _   m   m   a   p       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   w   a   s   m   f   s   _   m   m   a   p   "   ,       5   )   ;   
           _   _   w   a   s   m   f   s   _   m   s   y   n   c       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   w   a   s   m   f   s   _   m   s   y   n   c   "   ,       3   )   ;   
           _   _   w   a   s   m   f   s   _   m   u   n   m   a   p       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   w   a   s   m   f   s   _   m   u   n   m   a   p   "   ,       2   )   ;   
           _   _   w   a   s   m   f   s   _   u   t   i   m   e       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   w   a   s   m   f   s   _   u   t   i   m   e   "   ,       3   )   ;   
           _   _   w   a   s   m   f   s   _   s   t   a   t       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   w   a   s   m   f   s   _   s   t   a   t   "   ,       2   )   ;   
           _   _   w   a   s   m   f   s   _   l   s   t   a   t       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   w   a   s   m   f   s   _   l   s   t   a   t   "   ,       2   )   ;   
           _   _   w   a   s   m   f   s   _   m   o   u   n   t       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   w   a   s   m   f   s   _   m   o   u   n   t   "   ,       2   )   ;   
           _   _   w   a   s   m   f   s   _   i   d   e   n   t   i   f   y       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   w   a   s   m   f   s   _   i   d   e   n   t   i   f   y   "   ,       1   )   ;   
           _   _   w   a   s   m   f   s   _   r   e   a   d   d   i   r   _   s   t   a   r   t       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   w   a   s   m   f   s   _   r   e   a   d   d   i   r   _   s   t   a   r   t   "   ,       1   )   ;   
           _   _   w   a   s   m   f   s   _   r   e   a   d   d   i   r   _   g   e   t       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   w   a   s   m   f   s   _   r   e   a   d   d   i   r   _   g   e   t   "   ,       1   )   ;   
           _   _   w   a   s   m   f   s   _   r   e   a   d   d   i   r   _   f   i   n   i   s   h       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   w   a   s   m   f   s   _   r   e   a   d   d   i   r   _   f   i   n   i   s   h   "   ,       1   )   ;   
           _   _   w   a   s   m   f   s   _   g   e   t   _   c   w   d       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   _   w   a   s   m   f   s   _   g   e   t   _   c   w   d   "   ,       0   )   ;   
           _   w   a   s   m   f   s   _   c   r   e   a   t   e   _   j   s   i   m   p   l   _   b   a   c   k   e   n   d       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   w   a   s   m   f   s   _   c   r   e   a   t   e   _   j   s   i   m   p   l   _   b   a   c   k   e   n   d   "   ,       0   )   ;   
           _   w   a   s   m   f   s   _   c   r   e   a   t   e   _   m   e   m   o   r   y   _   b   a   c   k   e   n   d       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   w   a   s   m   f   s   _   c   r   e   a   t   e   _   m   e   m   o   r   y   _   b   a   c   k   e   n   d   "   ,       0   )   ;   
           _   w   a   s   m   f   s   _   c   r   e   a   t   e   _   f   i   l   e       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   w   a   s   m   f   s   _   c   r   e   a   t   e   _   f   i   l   e   "   ,       3   )   ;   
           _   w   a   s   m   f   s   _   u   n   m   o   u   n   t       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   w   a   s   m   f   s   _   u   n   m   o   u   n   t   "   ,       1   )   ;   
           _   w   a   s   m   f   s   _   f   l   u   s   h       =       c   r   e   a   t   e   E   x   p   o   r   t   W   r   a   p   p   e   r   (   "   w   a   s   m   f   s   _   f   l   u   s   h   "   ,       0   )   ;   
   }   
   
   v   a   r       w   a   s   m   I   m   p   o   r   t   s   ;   
   
   f   u   n   c   t   i   o   n       a   s   s   i   g   n   W   a   s   m   I   m   p   o   r   t   s   (   )       {   
           w   a   s   m   I   m   p   o   r   t   s       =       {   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   _   a   s   s   e   r   t   _   f   a   i   l   :       _   _   _   a   s   s   e   r   t   _   f   a   i   l   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   _   c   x   a   _   b   e   g   i   n   _   c   a   t   c   h   :       _   _   _   c   x   a   _   b   e   g   i   n   _   c   a   t   c   h   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   _   c   x   a   _   e   n   d   _   c   a   t   c   h   :       _   _   _   c   x   a   _   e   n   d   _   c   a   t   c   h   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   _   c   x   a   _   f   i   n   d   _   m   a   t   c   h   i   n   g   _   c   a   t   c   h   _   2   :       _   _   _   c   x   a   _   f   i   n   d   _   m   a   t   c   h   i   n   g   _   c   a   t   c   h   _   2   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   _   c   x   a   _   f   i   n   d   _   m   a   t   c   h   i   n   g   _   c   a   t   c   h   _   3   :       _   _   _   c   x   a   _   f   i   n   d   _   m   a   t   c   h   i   n   g   _   c   a   t   c   h   _   3   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   _   c   x   a   _   f   i   n   d   _   m   a   t   c   h   i   n   g   _   c   a   t   c   h   _   4   :       _   _   _   c   x   a   _   f   i   n   d   _   m   a   t   c   h   i   n   g   _   c   a   t   c   h   _   4   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   _   c   x   a   _   f   i   n   d   _   m   a   t   c   h   i   n   g   _   c   a   t   c   h   _   5   :       _   _   _   c   x   a   _   f   i   n   d   _   m   a   t   c   h   i   n   g   _   c   a   t   c   h   _   5   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   _   c   x   a   _   r   e   t   h   r   o   w   :       _   _   _   c   x   a   _   r   e   t   h   r   o   w   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   _   c   x   a   _   t   h   r   o   w   :       _   _   _   c   x   a   _   t   h   r   o   w   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   _   r   e   s   u   m   e   E   x   c   e   p   t   i   o   n   :       _   _   _   r   e   s   u   m   e   E   x   c   e   p   t   i   o   n   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   a   b   o   r   t   _   j   s   :       _   _   a   b   o   r   t   _   j   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   e   m   b   i   n   d   _   r   e   g   i   s   t   e   r   _   b   i   g   i   n   t   :       _   _   e   m   b   i   n   d   _   r   e   g   i   s   t   e   r   _   b   i   g   i   n   t   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   e   m   b   i   n   d   _   r   e   g   i   s   t   e   r   _   b   o   o   l   :       _   _   e   m   b   i   n   d   _   r   e   g   i   s   t   e   r   _   b   o   o   l   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   e   m   b   i   n   d   _   r   e   g   i   s   t   e   r   _   e   m   v   a   l   :       _   _   e   m   b   i   n   d   _   r   e   g   i   s   t   e   r   _   e   m   v   a   l   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   e   m   b   i   n   d   _   r   e   g   i   s   t   e   r   _   f   l   o   a   t   :       _   _   e   m   b   i   n   d   _   r   e   g   i   s   t   e   r   _   f   l   o   a   t   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   e   m   b   i   n   d   _   r   e   g   i   s   t   e   r   _   f   u   n   c   t   i   o   n   :       _   _   e   m   b   i   n   d   _   r   e   g   i   s   t   e   r   _   f   u   n   c   t   i   o   n   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   e   m   b   i   n   d   _   r   e   g   i   s   t   e   r   _   i   n   t   e   g   e   r   :       _   _   e   m   b   i   n   d   _   r   e   g   i   s   t   e   r   _   i   n   t   e   g   e   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   e   m   b   i   n   d   _   r   e   g   i   s   t   e   r   _   m   e   m   o   r   y   _   v   i   e   w   :       _   _   e   m   b   i   n   d   _   r   e   g   i   s   t   e   r   _   m   e   m   o   r   y   _   v   i   e   w   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   e   m   b   i   n   d   _   r   e   g   i   s   t   e   r   _   s   t   d   _   s   t   r   i   n   g   :       _   _   e   m   b   i   n   d   _   r   e   g   i   s   t   e   r   _   s   t   d   _   s   t   r   i   n   g   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   e   m   b   i   n   d   _   r   e   g   i   s   t   e   r   _   s   t   d   _   w   s   t   r   i   n   g   :       _   _   e   m   b   i   n   d   _   r   e   g   i   s   t   e   r   _   s   t   d   _   w   s   t   r   i   n   g   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   e   m   b   i   n   d   _   r   e   g   i   s   t   e   r   _   v   o   i   d   :       _   _   e   m   b   i   n   d   _   r   e   g   i   s   t   e   r   _   v   o   i   d   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   e   m   s   c   r   i   p   t   e   n   _   i   n   i   t   _   m   a   i   n   _   t   h   r   e   a   d   _   j   s   :       _   _   e   m   s   c   r   i   p   t   e   n   _   i   n   i   t   _   m   a   i   n   _   t   h   r   e   a   d   _   j   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   e   m   s   c   r   i   p   t   e   n   _   n   o   t   i   f   y   _   m   a   i   l   b   o   x   _   p   o   s   t   m   e   s   s   a   g   e   :       _   _   e   m   s   c   r   i   p   t   e   n   _   n   o   t   i   f   y   _   m   a   i   l   b   o   x   _   p   o   s   t   m   e   s   s   a   g   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   e   m   s   c   r   i   p   t   e   n   _   r   e   c   e   i   v   e   _   o   n   _   m   a   i   n   _   t   h   r   e   a   d   _   j   s   :       _   _   e   m   s   c   r   i   p   t   e   n   _   r   e   c   e   i   v   e   _   o   n   _   m   a   i   n   _   t   h   r   e   a   d   _   j   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   e   m   s   c   r   i   p   t   e   n   _   t   h   r   e   a   d   _   c   l   e   a   n   u   p   :       _   _   e   m   s   c   r   i   p   t   e   n   _   t   h   r   e   a   d   _   c   l   e   a   n   u   p   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   e   m   s   c   r   i   p   t   e   n   _   t   h   r   e   a   d   _   m   a   i   l   b   o   x   _   a   w   a   i   t   :       _   _   e   m   s   c   r   i   p   t   e   n   _   t   h   r   e   a   d   _   m   a   i   l   b   o   x   _   a   w   a   i   t   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   e   m   s   c   r   i   p   t   e   n   _   t   h   r   e   a   d   _   s   e   t   _   s   t   r   o   n   g   r   e   f   :       _   _   e   m   s   c   r   i   p   t   e   n   _   t   h   r   e   a   d   _   s   e   t   _   s   t   r   o   n   g   r   e   f   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   e   m   v   a   l   _   a   s   :       _   _   e   m   v   a   l   _   a   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   e   m   v   a   l   _   d   e   c   r   e   f   :       _   _   e   m   v   a   l   _   d   e   c   r   e   f   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   e   m   v   a   l   _   g   e   t   _   p   r   o   p   e   r   t   y   :       _   _   e   m   v   a   l   _   g   e   t   _   p   r   o   p   e   r   t   y   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   e   m   v   a   l   _   n   e   w   _   c   s   t   r   i   n   g   :       _   _   e   m   v   a   l   _   n   e   w   _   c   s   t   r   i   n   g   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   e   m   v   a   l   _   r   u   n   _   d   e   s   t   r   u   c   t   o   r   s   :       _   _   e   m   v   a   l   _   r   u   n   _   d   e   s   t   r   u   c   t   o   r   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   e   m   v   a   l   _   t   a   k   e   _   v   a   l   u   e   :       _   _   e   m   v   a   l   _   t   a   k   e   _   v   a   l   u   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   t   z   s   e   t   _   j   s   :       _   _   t   z   s   e   t   _   j   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   w   a   s   m   f   s   _   c   o   p   y   _   p   r   e   l   o   a   d   e   d   _   f   i   l   e   _   d   a   t   a   :       _   _   w   a   s   m   f   s   _   c   o   p   y   _   p   r   e   l   o   a   d   e   d   _   f   i   l   e   _   d   a   t   a   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   w   a   s   m   f   s   _   g   e   t   _   n   u   m   _   p   r   e   l   o   a   d   e   d   _   d   i   r   s   :       _   _   w   a   s   m   f   s   _   g   e   t   _   n   u   m   _   p   r   e   l   o   a   d   e   d   _   d   i   r   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   w   a   s   m   f   s   _   g   e   t   _   n   u   m   _   p   r   e   l   o   a   d   e   d   _   f   i   l   e   s   :       _   _   w   a   s   m   f   s   _   g   e   t   _   n   u   m   _   p   r   e   l   o   a   d   e   d   _   f   i   l   e   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   w   a   s   m   f   s   _   g   e   t   _   p   r   e   l   o   a   d   e   d   _   c   h   i   l   d   _   p   a   t   h   :       _   _   w   a   s   m   f   s   _   g   e   t   _   p   r   e   l   o   a   d   e   d   _   c   h   i   l   d   _   p   a   t   h   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   w   a   s   m   f   s   _   g   e   t   _   p   r   e   l   o   a   d   e   d   _   f   i   l   e   _   m   o   d   e   :       _   _   w   a   s   m   f   s   _   g   e   t   _   p   r   e   l   o   a   d   e   d   _   f   i   l   e   _   m   o   d   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   w   a   s   m   f   s   _   g   e   t   _   p   r   e   l   o   a   d   e   d   _   f   i   l   e   _   s   i   z   e   :       _   _   w   a   s   m   f   s   _   g   e   t   _   p   r   e   l   o   a   d   e   d   _   f   i   l   e   _   s   i   z   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   w   a   s   m   f   s   _   g   e   t   _   p   r   e   l   o   a   d   e   d   _   p   a   r   e   n   t   _   p   a   t   h   :       _   _   w   a   s   m   f   s   _   g   e   t   _   p   r   e   l   o   a   d   e   d   _   p   a   r   e   n   t   _   p   a   t   h   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   w   a   s   m   f   s   _   g   e   t   _   p   r   e   l   o   a   d   e   d   _   p   a   t   h   _   n   a   m   e   :       _   _   w   a   s   m   f   s   _   g   e   t   _   p   r   e   l   o   a   d   e   d   _   p   a   t   h   _   n   a   m   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   w   a   s   m   f   s   _   j   s   i   m   p   l   _   a   l   l   o   c   _   f   i   l   e   :       _   _   w   a   s   m   f   s   _   j   s   i   m   p   l   _   a   l   l   o   c   _   f   i   l   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   w   a   s   m   f   s   _   j   s   i   m   p   l   _   f   r   e   e   _   f   i   l   e   :       _   _   w   a   s   m   f   s   _   j   s   i   m   p   l   _   f   r   e   e   _   f   i   l   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   w   a   s   m   f   s   _   j   s   i   m   p   l   _   g   e   t   _   s   i   z   e   :       _   _   w   a   s   m   f   s   _   j   s   i   m   p   l   _   g   e   t   _   s   i   z   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   w   a   s   m   f   s   _   j   s   i   m   p   l   _   r   e   a   d   :       _   _   w   a   s   m   f   s   _   j   s   i   m   p   l   _   r   e   a   d   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   w   a   s   m   f   s   _   j   s   i   m   p   l   _   s   e   t   _   s   i   z   e   :       _   _   w   a   s   m   f   s   _   j   s   i   m   p   l   _   s   e   t   _   s   i   z   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   w   a   s   m   f   s   _   j   s   i   m   p   l   _   w   r   i   t   e   :       _   _   w   a   s   m   f   s   _   j   s   i   m   p   l   _   w   r   i   t   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       _   w   a   s   m   f   s   _   s   t   d   i   n   _   g   e   t   _   c   h   a   r   :       _   _   w   a   s   m   f   s   _   s   t   d   i   n   _   g   e   t   _   c   h   a   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       c   l   o   c   k   _   t   i   m   e   _   g   e   t   :       _   c   l   o   c   k   _   t   i   m   e   _   g   e   t   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   g   l   B   i   n   d   A   P   I   :       _   e   g   l   B   i   n   d   A   P   I   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   g   l   C   h   o   o   s   e   C   o   n   f   i   g   :       _   e   g   l   C   h   o   o   s   e   C   o   n   f   i   g   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   g   l   C   r   e   a   t   e   C   o   n   t   e   x   t   :       _   e   g   l   C   r   e   a   t   e   C   o   n   t   e   x   t   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   g   l   C   r   e   a   t   e   W   i   n   d   o   w   S   u   r   f   a   c   e   :       _   e   g   l   C   r   e   a   t   e   W   i   n   d   o   w   S   u   r   f   a   c   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   g   l   G   e   t   C   o   n   f   i   g   A   t   t   r   i   b   :       _   e   g   l   G   e   t   C   o   n   f   i   g   A   t   t   r   i   b   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   g   l   G   e   t   D   i   s   p   l   a   y   :       _   e   g   l   G   e   t   D   i   s   p   l   a   y   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   g   l   I   n   i   t   i   a   l   i   z   e   :       _   e   g   l   I   n   i   t   i   a   l   i   z   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   g   l   M   a   k   e   C   u   r   r   e   n   t   :       _   e   g   l   M   a   k   e   C   u   r   r   e   n   t   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   g   l   S   w   a   p   B   u   f   f   e   r   s   :       _   e   g   l   S   w   a   p   B   u   f   f   e   r   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   a   s   m   _   c   o   n   s   t   _   i   n   t   :       _   e   m   s   c   r   i   p   t   e   n   _   a   s   m   _   c   o   n   s   t   _   i   n   t   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   a   s   m   _   c   o   n   s   t   _   p   t   r   :       _   e   m   s   c   r   i   p   t   e   n   _   a   s   m   _   c   o   n   s   t   _   p   t   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   c   h   e   c   k   _   b   l   o   c   k   i   n   g   _   a   l   l   o   w   e   d   :       _   e   m   s   c   r   i   p   t   e   n   _   c   h   e   c   k   _   b   l   o   c   k   i   n   g   _   a   l   l   o   w   e   d   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   d   a   t   e   _   n   o   w   :       _   e   m   s   c   r   i   p   t   e   n   _   d   a   t   e   _   n   o   w   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   e   r   r   :       _   e   m   s   c   r   i   p   t   e   n   _   e   r   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   e   x   i   t   _   w   i   t   h   _   l   i   v   e   _   r   u   n   t   i   m   e   :       _   e   m   s   c   r   i   p   t   e   n   _   e   x   i   t   _   w   i   t   h   _   l   i   v   e   _   r   u   n   t   i   m   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   e   t   _   n   o   w   :       _   e   m   s   c   r   i   p   t   e   n   _   g   e   t   _   n   o   w   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   A   c   t   i   v   e   T   e   x   t   u   r   e   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   A   c   t   i   v   e   T   e   x   t   u   r   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   A   t   t   a   c   h   S   h   a   d   e   r   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   A   t   t   a   c   h   S   h   a   d   e   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   B   e   g   i   n   Q   u   e   r   y   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   e   g   i   n   Q   u   e   r   y   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   B   e   g   i   n   Q   u   e   r   y   E   X   T   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   e   g   i   n   Q   u   e   r   y   E   X   T   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   B   e   g   i   n   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   e   g   i   n   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   B   i   n   d   A   t   t   r   i   b   L   o   c   a   t   i   o   n   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   i   n   d   A   t   t   r   i   b   L   o   c   a   t   i   o   n   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   B   i   n   d   B   u   f   f   e   r   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   i   n   d   B   u   f   f   e   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   B   i   n   d   B   u   f   f   e   r   B   a   s   e   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   i   n   d   B   u   f   f   e   r   B   a   s   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   B   i   n   d   B   u   f   f   e   r   R   a   n   g   e   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   i   n   d   B   u   f   f   e   r   R   a   n   g   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   B   i   n   d   F   r   a   m   e   b   u   f   f   e   r   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   i   n   d   F   r   a   m   e   b   u   f   f   e   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   B   i   n   d   R   e   n   d   e   r   b   u   f   f   e   r   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   i   n   d   R   e   n   d   e   r   b   u   f   f   e   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   B   i   n   d   S   a   m   p   l   e   r   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   i   n   d   S   a   m   p   l   e   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   B   i   n   d   T   e   x   t   u   r   e   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   i   n   d   T   e   x   t   u   r   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   B   i   n   d   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   i   n   d   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   B   i   n   d   V   e   r   t   e   x   A   r   r   a   y   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   i   n   d   V   e   r   t   e   x   A   r   r   a   y   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   B   i   n   d   V   e   r   t   e   x   A   r   r   a   y   O   E   S   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   i   n   d   V   e   r   t   e   x   A   r   r   a   y   O   E   S   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   B   l   e   n   d   C   o   l   o   r   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   l   e   n   d   C   o   l   o   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   B   l   e   n   d   E   q   u   a   t   i   o   n   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   l   e   n   d   E   q   u   a   t   i   o   n   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   B   l   e   n   d   E   q   u   a   t   i   o   n   S   e   p   a   r   a   t   e   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   l   e   n   d   E   q   u   a   t   i   o   n   S   e   p   a   r   a   t   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   B   l   e   n   d   F   u   n   c   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   l   e   n   d   F   u   n   c   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   B   l   e   n   d   F   u   n   c   S   e   p   a   r   a   t   e   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   l   e   n   d   F   u   n   c   S   e   p   a   r   a   t   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   B   l   i   t   F   r   a   m   e   b   u   f   f   e   r   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   l   i   t   F   r   a   m   e   b   u   f   f   e   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   B   u   f   f   e   r   D   a   t   a   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   u   f   f   e   r   D   a   t   a   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   B   u   f   f   e   r   S   u   b   D   a   t   a   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   B   u   f   f   e   r   S   u   b   D   a   t   a   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   C   h   e   c   k   F   r   a   m   e   b   u   f   f   e   r   S   t   a   t   u   s   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   h   e   c   k   F   r   a   m   e   b   u   f   f   e   r   S   t   a   t   u   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   C   l   e   a   r   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   l   e   a   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   C   l   e   a   r   B   u   f   f   e   r   f   i   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   l   e   a   r   B   u   f   f   e   r   f   i   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   C   l   e   a   r   B   u   f   f   e   r   f   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   l   e   a   r   B   u   f   f   e   r   f   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   C   l   e   a   r   B   u   f   f   e   r   i   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   l   e   a   r   B   u   f   f   e   r   i   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   C   l   e   a   r   B   u   f   f   e   r   u   i   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   l   e   a   r   B   u   f   f   e   r   u   i   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   C   l   e   a   r   C   o   l   o   r   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   l   e   a   r   C   o   l   o   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   C   l   e   a   r   D   e   p   t   h   f   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   l   e   a   r   D   e   p   t   h   f   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   C   l   e   a   r   S   t   e   n   c   i   l   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   l   e   a   r   S   t   e   n   c   i   l   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   C   l   i   e   n   t   W   a   i   t   S   y   n   c   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   l   i   e   n   t   W   a   i   t   S   y   n   c   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   C   l   i   p   C   o   n   t   r   o   l   E   X   T   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   l   i   p   C   o   n   t   r   o   l   E   X   T   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   C   o   l   o   r   M   a   s   k   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   o   l   o   r   M   a   s   k   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   C   o   m   p   i   l   e   S   h   a   d   e   r   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   o   m   p   i   l   e   S   h   a   d   e   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   C   o   m   p   r   e   s   s   e   d   T   e   x   I   m   a   g   e   2   D   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   o   m   p   r   e   s   s   e   d   T   e   x   I   m   a   g   e   2   D   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   C   o   m   p   r   e   s   s   e   d   T   e   x   I   m   a   g   e   3   D   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   o   m   p   r   e   s   s   e   d   T   e   x   I   m   a   g   e   3   D   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   C   o   m   p   r   e   s   s   e   d   T   e   x   S   u   b   I   m   a   g   e   2   D   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   o   m   p   r   e   s   s   e   d   T   e   x   S   u   b   I   m   a   g   e   2   D   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   C   o   m   p   r   e   s   s   e   d   T   e   x   S   u   b   I   m   a   g   e   3   D   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   o   m   p   r   e   s   s   e   d   T   e   x   S   u   b   I   m   a   g   e   3   D   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   C   o   p   y   B   u   f   f   e   r   S   u   b   D   a   t   a   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   o   p   y   B   u   f   f   e   r   S   u   b   D   a   t   a   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   C   o   p   y   T   e   x   I   m   a   g   e   2   D   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   o   p   y   T   e   x   I   m   a   g   e   2   D   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   C   o   p   y   T   e   x   S   u   b   I   m   a   g   e   2   D   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   o   p   y   T   e   x   S   u   b   I   m   a   g   e   2   D   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   C   o   p   y   T   e   x   S   u   b   I   m   a   g   e   3   D   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   o   p   y   T   e   x   S   u   b   I   m   a   g   e   3   D   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   C   r   e   a   t   e   P   r   o   g   r   a   m   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   r   e   a   t   e   P   r   o   g   r   a   m   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   C   r   e   a   t   e   S   h   a   d   e   r   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   r   e   a   t   e   S   h   a   d   e   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   C   u   l   l   F   a   c   e   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   C   u   l   l   F   a   c   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   l   e   t   e   B   u   f   f   e   r   s   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   l   e   t   e   B   u   f   f   e   r   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   l   e   t   e   F   r   a   m   e   b   u   f   f   e   r   s   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   l   e   t   e   F   r   a   m   e   b   u   f   f   e   r   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   l   e   t   e   P   r   o   g   r   a   m   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   l   e   t   e   P   r   o   g   r   a   m   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   l   e   t   e   Q   u   e   r   i   e   s   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   l   e   t   e   Q   u   e   r   i   e   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   l   e   t   e   Q   u   e   r   i   e   s   E   X   T   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   l   e   t   e   Q   u   e   r   i   e   s   E   X   T   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   l   e   t   e   R   e   n   d   e   r   b   u   f   f   e   r   s   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   l   e   t   e   R   e   n   d   e   r   b   u   f   f   e   r   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   l   e   t   e   S   a   m   p   l   e   r   s   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   l   e   t   e   S   a   m   p   l   e   r   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   l   e   t   e   S   h   a   d   e   r   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   l   e   t   e   S   h   a   d   e   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   l   e   t   e   S   y   n   c   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   l   e   t   e   S   y   n   c   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   l   e   t   e   T   e   x   t   u   r   e   s   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   l   e   t   e   T   e   x   t   u   r   e   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   l   e   t   e   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   s   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   l   e   t   e   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   l   e   t   e   V   e   r   t   e   x   A   r   r   a   y   s   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   l   e   t   e   V   e   r   t   e   x   A   r   r   a   y   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   l   e   t   e   V   e   r   t   e   x   A   r   r   a   y   s   O   E   S   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   l   e   t   e   V   e   r   t   e   x   A   r   r   a   y   s   O   E   S   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   p   t   h   F   u   n   c   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   p   t   h   F   u   n   c   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   p   t   h   M   a   s   k   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   p   t   h   M   a   s   k   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   p   t   h   R   a   n   g   e   f   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   p   t   h   R   a   n   g   e   f   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   t   a   c   h   S   h   a   d   e   r   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   e   t   a   c   h   S   h   a   d   e   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   D   i   s   a   b   l   e   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   i   s   a   b   l   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   D   i   s   a   b   l   e   V   e   r   t   e   x   A   t   t   r   i   b   A   r   r   a   y   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   i   s   a   b   l   e   V   e   r   t   e   x   A   t   t   r   i   b   A   r   r   a   y   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   A   r   r   a   y   s   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   A   r   r   a   y   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   A   r   r   a   y   s   I   n   s   t   a   n   c   e   d   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   A   r   r   a   y   s   I   n   s   t   a   n   c   e   d   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   A   r   r   a   y   s   I   n   s   t   a   n   c   e   d   A   N   G   L   E   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   A   r   r   a   y   s   I   n   s   t   a   n   c   e   d   A   N   G   L   E   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   A   r   r   a   y   s   I   n   s   t   a   n   c   e   d   A   R   B   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   A   r   r   a   y   s   I   n   s   t   a   n   c   e   d   A   R   B   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   A   r   r   a   y   s   I   n   s   t   a   n   c   e   d   E   X   T   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   A   r   r   a   y   s   I   n   s   t   a   n   c   e   d   E   X   T   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   A   r   r   a   y   s   I   n   s   t   a   n   c   e   d   N   V   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   A   r   r   a   y   s   I   n   s   t   a   n   c   e   d   N   V   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   B   u   f   f   e   r   s   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   B   u   f   f   e   r   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   B   u   f   f   e   r   s   E   X   T   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   B   u   f   f   e   r   s   E   X   T   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   B   u   f   f   e   r   s   W   E   B   G   L   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   B   u   f   f   e   r   s   W   E   B   G   L   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   E   l   e   m   e   n   t   s   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   E   l   e   m   e   n   t   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   E   l   e   m   e   n   t   s   I   n   s   t   a   n   c   e   d   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   E   l   e   m   e   n   t   s   I   n   s   t   a   n   c   e   d   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   E   l   e   m   e   n   t   s   I   n   s   t   a   n   c   e   d   A   N   G   L   E   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   E   l   e   m   e   n   t   s   I   n   s   t   a   n   c   e   d   A   N   G   L   E   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   E   l   e   m   e   n   t   s   I   n   s   t   a   n   c   e   d   A   R   B   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   E   l   e   m   e   n   t   s   I   n   s   t   a   n   c   e   d   A   R   B   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   E   l   e   m   e   n   t   s   I   n   s   t   a   n   c   e   d   E   X   T   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   E   l   e   m   e   n   t   s   I   n   s   t   a   n   c   e   d   E   X   T   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   E   l   e   m   e   n   t   s   I   n   s   t   a   n   c   e   d   N   V   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   E   l   e   m   e   n   t   s   I   n   s   t   a   n   c   e   d   N   V   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   R   a   n   g   e   E   l   e   m   e   n   t   s   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   D   r   a   w   R   a   n   g   e   E   l   e   m   e   n   t   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   E   n   a   b   l   e   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   E   n   a   b   l   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   E   n   a   b   l   e   V   e   r   t   e   x   A   t   t   r   i   b   A   r   r   a   y   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   E   n   a   b   l   e   V   e   r   t   e   x   A   t   t   r   i   b   A   r   r   a   y   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   E   n   d   Q   u   e   r   y   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   E   n   d   Q   u   e   r   y   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   E   n   d   Q   u   e   r   y   E   X   T   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   E   n   d   Q   u   e   r   y   E   X   T   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   E   n   d   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   E   n   d   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   F   e   n   c   e   S   y   n   c   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   F   e   n   c   e   S   y   n   c   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   F   i   n   i   s   h   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   F   i   n   i   s   h   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   F   l   u   s   h   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   F   l   u   s   h   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   F   l   u   s   h   M   a   p   p   e   d   B   u   f   f   e   r   R   a   n   g   e   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   F   l   u   s   h   M   a   p   p   e   d   B   u   f   f   e   r   R   a   n   g   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   F   r   a   m   e   b   u   f   f   e   r   R   e   n   d   e   r   b   u   f   f   e   r   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   F   r   a   m   e   b   u   f   f   e   r   R   e   n   d   e   r   b   u   f   f   e   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   F   r   a   m   e   b   u   f   f   e   r   T   e   x   t   u   r   e   2   D   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   F   r   a   m   e   b   u   f   f   e   r   T   e   x   t   u   r   e   2   D   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   F   r   a   m   e   b   u   f   f   e   r   T   e   x   t   u   r   e   L   a   y   e   r   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   F   r   a   m   e   b   u   f   f   e   r   T   e   x   t   u   r   e   L   a   y   e   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   F   r   o   n   t   F   a   c   e   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   F   r   o   n   t   F   a   c   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   n   B   u   f   f   e   r   s   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   n   B   u   f   f   e   r   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   n   F   r   a   m   e   b   u   f   f   e   r   s   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   n   F   r   a   m   e   b   u   f   f   e   r   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   n   Q   u   e   r   i   e   s   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   n   Q   u   e   r   i   e   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   n   Q   u   e   r   i   e   s   E   X   T   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   n   Q   u   e   r   i   e   s   E   X   T   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   n   R   e   n   d   e   r   b   u   f   f   e   r   s   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   n   R   e   n   d   e   r   b   u   f   f   e   r   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   n   S   a   m   p   l   e   r   s   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   n   S   a   m   p   l   e   r   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   n   T   e   x   t   u   r   e   s   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   n   T   e   x   t   u   r   e   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   n   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   s   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   n   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   n   V   e   r   t   e   x   A   r   r   a   y   s   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   n   V   e   r   t   e   x   A   r   r   a   y   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   n   V   e   r   t   e   x   A   r   r   a   y   s   O   E   S   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   n   V   e   r   t   e   x   A   r   r   a   y   s   O   E   S   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   n   e   r   a   t   e   M   i   p   m   a   p   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   n   e   r   a   t   e   M   i   p   m   a   p   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   A   c   t   i   v   e   A   t   t   r   i   b   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   A   c   t   i   v   e   A   t   t   r   i   b   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   A   c   t   i   v   e   U   n   i   f   o   r   m   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   A   c   t   i   v   e   U   n   i   f   o   r   m   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   A   c   t   i   v   e   U   n   i   f   o   r   m   B   l   o   c   k   N   a   m   e   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   A   c   t   i   v   e   U   n   i   f   o   r   m   B   l   o   c   k   N   a   m   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   A   c   t   i   v   e   U   n   i   f   o   r   m   B   l   o   c   k   i   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   A   c   t   i   v   e   U   n   i   f   o   r   m   B   l   o   c   k   i   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   A   c   t   i   v   e   U   n   i   f   o   r   m   s   i   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   A   c   t   i   v   e   U   n   i   f   o   r   m   s   i   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   A   t   t   a   c   h   e   d   S   h   a   d   e   r   s   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   A   t   t   a   c   h   e   d   S   h   a   d   e   r   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   A   t   t   r   i   b   L   o   c   a   t   i   o   n   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   A   t   t   r   i   b   L   o   c   a   t   i   o   n   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   B   o   o   l   e   a   n   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   B   o   o   l   e   a   n   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   B   u   f   f   e   r   P   a   r   a   m   e   t   e   r   i   6   4   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   B   u   f   f   e   r   P   a   r   a   m   e   t   e   r   i   6   4   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   B   u   f   f   e   r   P   a   r   a   m   e   t   e   r   i   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   B   u   f   f   e   r   P   a   r   a   m   e   t   e   r   i   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   B   u   f   f   e   r   P   o   i   n   t   e   r   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   B   u   f   f   e   r   P   o   i   n   t   e   r   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   E   r   r   o   r   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   E   r   r   o   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   F   l   o   a   t   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   F   l   o   a   t   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   F   r   a   g   D   a   t   a   L   o   c   a   t   i   o   n   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   F   r   a   g   D   a   t   a   L   o   c   a   t   i   o   n   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   F   r   a   m   e   b   u   f   f   e   r   A   t   t   a   c   h   m   e   n   t   P   a   r   a   m   e   t   e   r   i   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   F   r   a   m   e   b   u   f   f   e   r   A   t   t   a   c   h   m   e   n   t   P   a   r   a   m   e   t   e   r   i   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   I   n   t   e   g   e   r   6   4   i   _   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   I   n   t   e   g   e   r   6   4   i   _   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   I   n   t   e   g   e   r   6   4   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   I   n   t   e   g   e   r   6   4   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   I   n   t   e   g   e   r   i   _   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   I   n   t   e   g   e   r   i   _   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   I   n   t   e   g   e   r   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   I   n   t   e   g   e   r   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   I   n   t   e   r   n   a   l   f   o   r   m   a   t   i   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   I   n   t   e   r   n   a   l   f   o   r   m   a   t   i   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   P   r   o   g   r   a   m   B   i   n   a   r   y   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   P   r   o   g   r   a   m   B   i   n   a   r   y   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   P   r   o   g   r   a   m   I   n   f   o   L   o   g   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   P   r   o   g   r   a   m   I   n   f   o   L   o   g   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   P   r   o   g   r   a   m   i   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   P   r   o   g   r   a   m   i   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   Q   u   e   r   y   O   b   j   e   c   t   i   6   4   v   E   X   T   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   Q   u   e   r   y   O   b   j   e   c   t   i   6   4   v   E   X   T   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   Q   u   e   r   y   O   b   j   e   c   t   i   v   E   X   T   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   Q   u   e   r   y   O   b   j   e   c   t   i   v   E   X   T   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   Q   u   e   r   y   O   b   j   e   c   t   u   i   6   4   v   E   X   T   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   Q   u   e   r   y   O   b   j   e   c   t   u   i   6   4   v   E   X   T   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   Q   u   e   r   y   O   b   j   e   c   t   u   i   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   Q   u   e   r   y   O   b   j   e   c   t   u   i   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   Q   u   e   r   y   O   b   j   e   c   t   u   i   v   E   X   T   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   Q   u   e   r   y   O   b   j   e   c   t   u   i   v   E   X   T   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   Q   u   e   r   y   i   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   Q   u   e   r   y   i   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   Q   u   e   r   y   i   v   E   X   T   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   Q   u   e   r   y   i   v   E   X   T   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   R   e   n   d   e   r   b   u   f   f   e   r   P   a   r   a   m   e   t   e   r   i   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   R   e   n   d   e   r   b   u   f   f   e   r   P   a   r   a   m   e   t   e   r   i   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   S   a   m   p   l   e   r   P   a   r   a   m   e   t   e   r   f   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   S   a   m   p   l   e   r   P   a   r   a   m   e   t   e   r   f   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   S   a   m   p   l   e   r   P   a   r   a   m   e   t   e   r   i   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   S   a   m   p   l   e   r   P   a   r   a   m   e   t   e   r   i   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   S   h   a   d   e   r   I   n   f   o   L   o   g   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   S   h   a   d   e   r   I   n   f   o   L   o   g   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   S   h   a   d   e   r   P   r   e   c   i   s   i   o   n   F   o   r   m   a   t   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   S   h   a   d   e   r   P   r   e   c   i   s   i   o   n   F   o   r   m   a   t   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   S   h   a   d   e   r   S   o   u   r   c   e   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   S   h   a   d   e   r   S   o   u   r   c   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   S   h   a   d   e   r   i   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   S   h   a   d   e   r   i   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   S   t   r   i   n   g   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   S   t   r   i   n   g   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   S   t   r   i   n   g   i   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   S   t   r   i   n   g   i   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   S   y   n   c   i   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   S   y   n   c   i   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   T   e   x   P   a   r   a   m   e   t   e   r   f   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   T   e   x   P   a   r   a   m   e   t   e   r   f   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   T   e   x   P   a   r   a   m   e   t   e   r   i   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   T   e   x   P   a   r   a   m   e   t   e   r   i   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   V   a   r   y   i   n   g   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   V   a   r   y   i   n   g   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   U   n   i   f   o   r   m   B   l   o   c   k   I   n   d   e   x   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   U   n   i   f   o   r   m   B   l   o   c   k   I   n   d   e   x   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   U   n   i   f   o   r   m   I   n   d   i   c   e   s   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   U   n   i   f   o   r   m   I   n   d   i   c   e   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   U   n   i   f   o   r   m   f   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   U   n   i   f   o   r   m   f   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   U   n   i   f   o   r   m   i   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   U   n   i   f   o   r   m   i   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   U   n   i   f   o   r   m   u   i   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   U   n   i   f   o   r   m   u   i   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   V   e   r   t   e   x   A   t   t   r   i   b   I   i   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   V   e   r   t   e   x   A   t   t   r   i   b   I   i   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   V   e   r   t   e   x   A   t   t   r   i   b   I   u   i   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   V   e   r   t   e   x   A   t   t   r   i   b   I   u   i   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   V   e   r   t   e   x   A   t   t   r   i   b   P   o   i   n   t   e   r   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   V   e   r   t   e   x   A   t   t   r   i   b   P   o   i   n   t   e   r   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   V   e   r   t   e   x   A   t   t   r   i   b   f   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   V   e   r   t   e   x   A   t   t   r   i   b   f   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   V   e   r   t   e   x   A   t   t   r   i   b   i   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   G   e   t   V   e   r   t   e   x   A   t   t   r   i   b   i   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   H   i   n   t   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   H   i   n   t   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   I   n   v   a   l   i   d   a   t   e   F   r   a   m   e   b   u   f   f   e   r   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   I   n   v   a   l   i   d   a   t   e   F   r   a   m   e   b   u   f   f   e   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   I   n   v   a   l   i   d   a   t   e   S   u   b   F   r   a   m   e   b   u   f   f   e   r   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   I   n   v   a   l   i   d   a   t   e   S   u   b   F   r   a   m   e   b   u   f   f   e   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   I   s   B   u   f   f   e   r   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   I   s   B   u   f   f   e   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   I   s   E   n   a   b   l   e   d   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   I   s   E   n   a   b   l   e   d   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   I   s   F   r   a   m   e   b   u   f   f   e   r   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   I   s   F   r   a   m   e   b   u   f   f   e   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   I   s   P   r   o   g   r   a   m   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   I   s   P   r   o   g   r   a   m   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   I   s   Q   u   e   r   y   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   I   s   Q   u   e   r   y   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   I   s   Q   u   e   r   y   E   X   T   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   I   s   Q   u   e   r   y   E   X   T   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   I   s   R   e   n   d   e   r   b   u   f   f   e   r   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   I   s   R   e   n   d   e   r   b   u   f   f   e   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   I   s   S   a   m   p   l   e   r   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   I   s   S   a   m   p   l   e   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   I   s   S   h   a   d   e   r   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   I   s   S   h   a   d   e   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   I   s   S   y   n   c   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   I   s   S   y   n   c   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   I   s   T   e   x   t   u   r   e   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   I   s   T   e   x   t   u   r   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   I   s   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   I   s   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   I   s   V   e   r   t   e   x   A   r   r   a   y   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   I   s   V   e   r   t   e   x   A   r   r   a   y   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   I   s   V   e   r   t   e   x   A   r   r   a   y   O   E   S   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   I   s   V   e   r   t   e   x   A   r   r   a   y   O   E   S   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   L   i   n   e   W   i   d   t   h   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   L   i   n   e   W   i   d   t   h   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   L   i   n   k   P   r   o   g   r   a   m   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   L   i   n   k   P   r   o   g   r   a   m   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   M   a   p   B   u   f   f   e   r   R   a   n   g   e   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   M   a   p   B   u   f   f   e   r   R   a   n   g   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   P   a   u   s   e   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   P   a   u   s   e   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   P   i   x   e   l   S   t   o   r   e   i   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   P   i   x   e   l   S   t   o   r   e   i   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   P   o   l   y   g   o   n   M   o   d   e   W   E   B   G   L   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   P   o   l   y   g   o   n   M   o   d   e   W   E   B   G   L   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   P   o   l   y   g   o   n   O   f   f   s   e   t   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   P   o   l   y   g   o   n   O   f   f   s   e   t   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   P   o   l   y   g   o   n   O   f   f   s   e   t   C   l   a   m   p   E   X   T   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   P   o   l   y   g   o   n   O   f   f   s   e   t   C   l   a   m   p   E   X   T   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   P   r   o   g   r   a   m   B   i   n   a   r   y   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   P   r   o   g   r   a   m   B   i   n   a   r   y   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   P   r   o   g   r   a   m   P   a   r   a   m   e   t   e   r   i   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   P   r   o   g   r   a   m   P   a   r   a   m   e   t   e   r   i   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   Q   u   e   r   y   C   o   u   n   t   e   r   E   X   T   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   Q   u   e   r   y   C   o   u   n   t   e   r   E   X   T   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   R   e   a   d   B   u   f   f   e   r   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   R   e   a   d   B   u   f   f   e   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   R   e   a   d   P   i   x   e   l   s   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   R   e   a   d   P   i   x   e   l   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   R   e   l   e   a   s   e   S   h   a   d   e   r   C   o   m   p   i   l   e   r   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   R   e   l   e   a   s   e   S   h   a   d   e   r   C   o   m   p   i   l   e   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   R   e   n   d   e   r   b   u   f   f   e   r   S   t   o   r   a   g   e   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   R   e   n   d   e   r   b   u   f   f   e   r   S   t   o   r   a   g   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   R   e   n   d   e   r   b   u   f   f   e   r   S   t   o   r   a   g   e   M   u   l   t   i   s   a   m   p   l   e   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   R   e   n   d   e   r   b   u   f   f   e   r   S   t   o   r   a   g   e   M   u   l   t   i   s   a   m   p   l   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   R   e   s   u   m   e   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   R   e   s   u   m   e   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   S   a   m   p   l   e   C   o   v   e   r   a   g   e   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   S   a   m   p   l   e   C   o   v   e   r   a   g   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   S   a   m   p   l   e   r   P   a   r   a   m   e   t   e   r   f   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   S   a   m   p   l   e   r   P   a   r   a   m   e   t   e   r   f   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   S   a   m   p   l   e   r   P   a   r   a   m   e   t   e   r   f   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   S   a   m   p   l   e   r   P   a   r   a   m   e   t   e   r   f   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   S   a   m   p   l   e   r   P   a   r   a   m   e   t   e   r   i   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   S   a   m   p   l   e   r   P   a   r   a   m   e   t   e   r   i   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   S   a   m   p   l   e   r   P   a   r   a   m   e   t   e   r   i   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   S   a   m   p   l   e   r   P   a   r   a   m   e   t   e   r   i   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   S   c   i   s   s   o   r   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   S   c   i   s   s   o   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   S   h   a   d   e   r   B   i   n   a   r   y   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   S   h   a   d   e   r   B   i   n   a   r   y   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   S   h   a   d   e   r   S   o   u   r   c   e   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   S   h   a   d   e   r   S   o   u   r   c   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   S   t   e   n   c   i   l   F   u   n   c   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   S   t   e   n   c   i   l   F   u   n   c   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   S   t   e   n   c   i   l   F   u   n   c   S   e   p   a   r   a   t   e   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   S   t   e   n   c   i   l   F   u   n   c   S   e   p   a   r   a   t   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   S   t   e   n   c   i   l   M   a   s   k   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   S   t   e   n   c   i   l   M   a   s   k   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   S   t   e   n   c   i   l   M   a   s   k   S   e   p   a   r   a   t   e   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   S   t   e   n   c   i   l   M   a   s   k   S   e   p   a   r   a   t   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   S   t   e   n   c   i   l   O   p   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   S   t   e   n   c   i   l   O   p   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   S   t   e   n   c   i   l   O   p   S   e   p   a   r   a   t   e   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   S   t   e   n   c   i   l   O   p   S   e   p   a   r   a   t   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   T   e   x   I   m   a   g   e   2   D   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   T   e   x   I   m   a   g   e   2   D   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   T   e   x   I   m   a   g   e   3   D   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   T   e   x   I   m   a   g   e   3   D   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   T   e   x   P   a   r   a   m   e   t   e   r   f   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   T   e   x   P   a   r   a   m   e   t   e   r   f   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   T   e   x   P   a   r   a   m   e   t   e   r   f   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   T   e   x   P   a   r   a   m   e   t   e   r   f   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   T   e   x   P   a   r   a   m   e   t   e   r   i   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   T   e   x   P   a   r   a   m   e   t   e   r   i   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   T   e   x   P   a   r   a   m   e   t   e   r   i   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   T   e   x   P   a   r   a   m   e   t   e   r   i   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   T   e   x   S   t   o   r   a   g   e   2   D   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   T   e   x   S   t   o   r   a   g   e   2   D   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   T   e   x   S   t   o   r   a   g   e   3   D   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   T   e   x   S   t   o   r   a   g   e   3   D   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   T   e   x   S   u   b   I   m   a   g   e   2   D   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   T   e   x   S   u   b   I   m   a   g   e   2   D   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   T   e   x   S   u   b   I   m   a   g   e   3   D   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   T   e   x   S   u   b   I   m   a   g   e   3   D   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   V   a   r   y   i   n   g   s   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   T   r   a   n   s   f   o   r   m   F   e   e   d   b   a   c   k   V   a   r   y   i   n   g   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   1   f   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   1   f   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   1   f   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   1   f   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   1   i   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   1   i   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   1   i   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   1   i   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   1   u   i   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   1   u   i   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   1   u   i   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   1   u   i   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   2   f   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   2   f   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   2   f   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   2   f   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   2   i   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   2   i   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   2   i   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   2   i   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   2   u   i   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   2   u   i   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   2   u   i   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   2   u   i   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   3   f   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   3   f   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   3   f   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   3   f   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   3   i   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   3   i   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   3   i   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   3   i   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   3   u   i   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   3   u   i   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   3   u   i   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   3   u   i   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   4   f   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   4   f   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   4   f   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   4   f   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   4   i   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   4   i   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   4   i   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   4   i   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   4   u   i   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   4   u   i   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   4   u   i   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   4   u   i   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   B   l   o   c   k   B   i   n   d   i   n   g   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   B   l   o   c   k   B   i   n   d   i   n   g   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   2   f   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   2   f   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   2   x   3   f   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   2   x   3   f   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   2   x   4   f   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   2   x   4   f   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   3   f   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   3   f   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   3   x   2   f   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   3   x   2   f   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   3   x   4   f   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   3   x   4   f   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   4   f   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   4   f   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   4   x   2   f   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   4   x   2   f   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   4   x   3   f   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   4   x   3   f   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   m   a   p   B   u   f   f   e   r   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   n   m   a   p   B   u   f   f   e   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   U   s   e   P   r   o   g   r   a   m   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   U   s   e   P   r   o   g   r   a   m   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   V   a   l   i   d   a   t   e   P   r   o   g   r   a   m   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   V   a   l   i   d   a   t   e   P   r   o   g   r   a   m   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   1   f   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   1   f   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   1   f   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   1   f   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   2   f   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   2   f   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   2   f   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   2   f   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   3   f   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   3   f   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   3   f   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   3   f   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   4   f   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   4   f   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   4   f   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   4   f   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   D   i   v   i   s   o   r   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   D   i   v   i   s   o   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   D   i   v   i   s   o   r   A   N   G   L   E   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   D   i   v   i   s   o   r   A   N   G   L   E   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   D   i   v   i   s   o   r   A   R   B   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   D   i   v   i   s   o   r   A   R   B   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   D   i   v   i   s   o   r   E   X   T   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   D   i   v   i   s   o   r   E   X   T   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   D   i   v   i   s   o   r   N   V   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   D   i   v   i   s   o   r   N   V   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   I   4   i   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   I   4   i   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   I   4   i   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   I   4   i   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   I   4   u   i   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   I   4   u   i   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   I   4   u   i   v   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   I   4   u   i   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   I   P   o   i   n   t   e   r   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   I   P   o   i   n   t   e   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   P   o   i   n   t   e   r   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   P   o   i   n   t   e   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   V   i   e   w   p   o   r   t   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   V   i   e   w   p   o   r   t   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   g   l   W   a   i   t   S   y   n   c   :       _   e   m   s   c   r   i   p   t   e   n   _   g   l   W   a   i   t   S   y   n   c   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   o   u   t   :       _   e   m   s   c   r   i   p   t   e   n   _   o   u   t   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   r   a   n   d   o   m   :       _   e   m   s   c   r   i   p   t   e   n   _   r   a   n   d   o   m   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   r   e   s   i   z   e   _   h   e   a   p   :       _   e   m   s   c   r   i   p   t   e   n   _   r   e   s   i   z   e   _   h   e   a   p   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   s   e   t   _   m   a   i   n   _   l   o   o   p   :       _   e   m   s   c   r   i   p   t   e   n   _   s   e   t   _   m   a   i   n   _   l   o   o   p   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   s   e   t   _   m   a   i   n   _   l   o   o   p   _   t   i   m   i   n   g   :       _   e   m   s   c   r   i   p   t   e   n   _   s   e   t   _   m   a   i   n   _   l   o   o   p   _   t   i   m   i   n   g   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   w   e   b   g   l   _   c   r   e   a   t   e   _   c   o   n   t   e   x   t   :       _   e   m   s   c   r   i   p   t   e   n   _   w   e   b   g   l   _   c   r   e   a   t   e   _   c   o   n   t   e   x   t   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   w   e   b   g   l   _   d   e   s   t   r   o   y   _   c   o   n   t   e   x   t   :       _   e   m   s   c   r   i   p   t   e   n   _   w   e   b   g   l   _   d   e   s   t   r   o   y   _   c   o   n   t   e   x   t   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   w   e   b   g   l   _   e   n   a   b   l   e   _   e   x   t   e   n   s   i   o   n   :       _   e   m   s   c   r   i   p   t   e   n   _   w   e   b   g   l   _   e   n   a   b   l   e   _   e   x   t   e   n   s   i   o   n   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   m   s   c   r   i   p   t   e   n   _   w   e   b   g   l   _   m   a   k   e   _   c   o   n   t   e   x   t   _   c   u   r   r   e   n   t   :       _   e   m   s   c   r   i   p   t   e   n   _   w   e   b   g   l   _   m   a   k   e   _   c   o   n   t   e   x   t   _   c   u   r   r   e   n   t   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   n   v   i   r   o   n   _   g   e   t   :       _   e   n   v   i   r   o   n   _   g   e   t   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   n   v   i   r   o   n   _   s   i   z   e   s   _   g   e   t   :       _   e   n   v   i   r   o   n   _   s   i   z   e   s   _   g   e   t   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       e   x   i   t   :       _   e   x   i   t   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   e   t   C   u   s   t   o   m   S   h   a   d   e   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   e   t   S   h   a   d   e   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   A   c   t   i   v   e   T   e   x   t   u   r   e   :       _   g   l   A   c   t   i   v   e   T   e   x   t   u   r   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   A   t   t   a   c   h   S   h   a   d   e   r   :       _   g   l   A   t   t   a   c   h   S   h   a   d   e   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   B   i   n   d   B   u   f   f   e   r   :       _   g   l   B   i   n   d   B   u   f   f   e   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   B   i   n   d   F   r   a   m   e   b   u   f   f   e   r   :       _   g   l   B   i   n   d   F   r   a   m   e   b   u   f   f   e   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   B   i   n   d   S   a   m   p   l   e   r   :       _   g   l   B   i   n   d   S   a   m   p   l   e   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   B   i   n   d   T   e   x   t   u   r   e   :       _   g   l   B   i   n   d   T   e   x   t   u   r   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   B   i   n   d   V   e   r   t   e   x   A   r   r   a   y   :       _   g   l   B   i   n   d   V   e   r   t   e   x   A   r   r   a   y   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   B   l   e   n   d   F   u   n   c   :       _   g   l   B   l   e   n   d   F   u   n   c   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   B   u   f   f   e   r   D   a   t   a   :       _   g   l   B   u   f   f   e   r   D   a   t   a   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   B   u   f   f   e   r   S   u   b   D   a   t   a   :       _   g   l   B   u   f   f   e   r   S   u   b   D   a   t   a   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   C   l   e   a   r   :       _   g   l   C   l   e   a   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   C   o   m   p   i   l   e   S   h   a   d   e   r   :       _   g   l   C   o   m   p   i   l   e   S   h   a   d   e   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   C   o   m   p   r   e   s   s   e   d   T   e   x   I   m   a   g   e   2   D   :       _   g   l   C   o   m   p   r   e   s   s   e   d   T   e   x   I   m   a   g   e   2   D   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   C   o   p   y   T   e   x   S   u   b   I   m   a   g   e   2   D   :       _   g   l   C   o   p   y   T   e   x   S   u   b   I   m   a   g   e   2   D   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   C   r   e   a   t   e   P   r   o   g   r   a   m   :       _   g   l   C   r   e   a   t   e   P   r   o   g   r   a   m   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   C   r   e   a   t   e   S   h   a   d   e   r   :       _   g   l   C   r   e   a   t   e   S   h   a   d   e   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   C   u   l   l   F   a   c   e   :       _   g   l   C   u   l   l   F   a   c   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   D   e   l   e   t   e   B   u   f   f   e   r   s   :       _   g   l   D   e   l   e   t   e   B   u   f   f   e   r   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   D   e   l   e   t   e   F   r   a   m   e   b   u   f   f   e   r   s   :       _   g   l   D   e   l   e   t   e   F   r   a   m   e   b   u   f   f   e   r   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   D   e   l   e   t   e   P   r   o   g   r   a   m   :       _   g   l   D   e   l   e   t   e   P   r   o   g   r   a   m   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   D   e   l   e   t   e   S   a   m   p   l   e   r   s   :       _   g   l   D   e   l   e   t   e   S   a   m   p   l   e   r   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   D   e   l   e   t   e   S   h   a   d   e   r   :       _   g   l   D   e   l   e   t   e   S   h   a   d   e   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   D   e   l   e   t   e   T   e   x   t   u   r   e   s   :       _   g   l   D   e   l   e   t   e   T   e   x   t   u   r   e   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   D   e   l   e   t   e   V   e   r   t   e   x   A   r   r   a   y   s   :       _   g   l   D   e   l   e   t   e   V   e   r   t   e   x   A   r   r   a   y   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   D   e   t   a   c   h   S   h   a   d   e   r   :       _   g   l   D   e   t   a   c   h   S   h   a   d   e   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   D   i   s   a   b   l   e   :       _   g   l   D   i   s   a   b   l   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   D   i   s   a   b   l   e   V   e   r   t   e   x   A   t   t   r   i   b   A   r   r   a   y   :       _   g   l   D   i   s   a   b   l   e   V   e   r   t   e   x   A   t   t   r   i   b   A   r   r   a   y   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   D   r   a   w   A   r   r   a   y   s   :       _   g   l   D   r   a   w   A   r   r   a   y   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   D   r   a   w   B   u   f   f   e   r   s   :       _   g   l   D   r   a   w   B   u   f   f   e   r   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   D   r   a   w   E   l   e   m   e   n   t   s   :       _   g   l   D   r   a   w   E   l   e   m   e   n   t   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   E   n   a   b   l   e   :       _   g   l   E   n   a   b   l   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   E   n   a   b   l   e   V   e   r   t   e   x   A   t   t   r   i   b   A   r   r   a   y   :       _   g   l   E   n   a   b   l   e   V   e   r   t   e   x   A   t   t   r   i   b   A   r   r   a   y   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   F   r   a   m   e   b   u   f   f   e   r   T   e   x   t   u   r   e   2   D   :       _   g   l   F   r   a   m   e   b   u   f   f   e   r   T   e   x   t   u   r   e   2   D   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   F   r   o   n   t   F   a   c   e   :       _   g   l   F   r   o   n   t   F   a   c   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   G   e   n   B   u   f   f   e   r   s   :       _   g   l   G   e   n   B   u   f   f   e   r   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   G   e   n   F   r   a   m   e   b   u   f   f   e   r   s   :       _   g   l   G   e   n   F   r   a   m   e   b   u   f   f   e   r   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   G   e   n   S   a   m   p   l   e   r   s   :       _   g   l   G   e   n   S   a   m   p   l   e   r   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   G   e   n   T   e   x   t   u   r   e   s   :       _   g   l   G   e   n   T   e   x   t   u   r   e   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   G   e   n   V   e   r   t   e   x   A   r   r   a   y   s   :       _   g   l   G   e   n   V   e   r   t   e   x   A   r   r   a   y   s   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   G   e   t   E   r   r   o   r   :       _   g   l   G   e   t   E   r   r   o   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   G   e   t   I   n   t   e   g   e   r   v   :       _   g   l   G   e   t   I   n   t   e   g   e   r   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   G   e   t   P   r   o   g   r   a   m   I   n   f   o   L   o   g   :       _   g   l   G   e   t   P   r   o   g   r   a   m   I   n   f   o   L   o   g   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   G   e   t   P   r   o   g   r   a   m   i   v   :       _   g   l   G   e   t   P   r   o   g   r   a   m   i   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   G   e   t   S   h   a   d   e   r   I   n   f   o   L   o   g   :       _   g   l   G   e   t   S   h   a   d   e   r   I   n   f   o   L   o   g   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   G   e   t   S   h   a   d   e   r   i   v   :       _   g   l   G   e   t   S   h   a   d   e   r   i   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   G   e   t   S   t   r   i   n   g   :       _   g   l   G   e   t   S   t   r   i   n   g   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   :       _   g   l   G   e   t   U   n   i   f   o   r   m   L   o   c   a   t   i   o   n   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   H   i   n   t   :       _   g   l   H   i   n   t   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   L   i   n   e   W   i   d   t   h   :       _   g   l   L   i   n   e   W   i   d   t   h   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   L   i   n   k   P   r   o   g   r   a   m   :       _   g   l   L   i   n   k   P   r   o   g   r   a   m   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   P   i   x   e   l   S   t   o   r   e   i   :       _   g   l   P   i   x   e   l   S   t   o   r   e   i   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   S   a   m   p   l   e   r   P   a   r   a   m   e   t   e   r   i   :       _   g   l   S   a   m   p   l   e   r   P   a   r   a   m   e   t   e   r   i   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   S   c   i   s   s   o   r   :       _   g   l   S   c   i   s   s   o   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   S   h   a   d   e   r   S   o   u   r   c   e   :       _   g   l   S   h   a   d   e   r   S   o   u   r   c   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   T   e   x   I   m   a   g   e   2   D   :       _   g   l   T   e   x   I   m   a   g   e   2   D   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   T   e   x   I   m   a   g   e   3   D   :       _   g   l   T   e   x   I   m   a   g   e   3   D   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   T   e   x   P   a   r   a   m   e   t   e   r   i   :       _   g   l   T   e   x   P   a   r   a   m   e   t   e   r   i   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   U   n   i   f   o   r   m   1   f   v   :       _   g   l   U   n   i   f   o   r   m   1   f   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   U   n   i   f   o   r   m   1   i   v   :       _   g   l   U   n   i   f   o   r   m   1   i   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   U   n   i   f   o   r   m   2   f   v   :       _   g   l   U   n   i   f   o   r   m   2   f   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   U   n   i   f   o   r   m   2   i   v   :       _   g   l   U   n   i   f   o   r   m   2   i   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   U   n   i   f   o   r   m   3   f   v   :       _   g   l   U   n   i   f   o   r   m   3   f   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   U   n   i   f   o   r   m   4   f   v   :       _   g   l   U   n   i   f   o   r   m   4   f   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   U   n   i   f   o   r   m   4   i   v   :       _   g   l   U   n   i   f   o   r   m   4   i   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   3   x   4   f   v   :       _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   3   x   4   f   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   4   f   v   :       _   g   l   U   n   i   f   o   r   m   M   a   t   r   i   x   4   f   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   U   s   e   P   r   o   g   r   a   m   :       _   g   l   U   s   e   P   r   o   g   r   a   m   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   V   e   r   t   e   x   A   t   t   r   i   b   4   f   :       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   4   f   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   V   e   r   t   e   x   A   t   t   r   i   b   I   P   o   i   n   t   e   r   :       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   I   P   o   i   n   t   e   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   V   e   r   t   e   x   A   t   t   r   i   b   P   o   i   n   t   e   r   :       _   g   l   V   e   r   t   e   x   A   t   t   r   i   b   P   o   i   n   t   e   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       g   l   V   i   e   w   p   o   r   t   :       _   g   l   V   i   e   w   p   o   r   t   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       i   n   v   o   k   e   _   d   i   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       i   n   v   o   k   e   _   d   i   d   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       i   n   v   o   k   e   _   f   i   i   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       i   n   v   o   k   e   _   f   i   i   f   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       i   n   v   o   k   e   _   i   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       i   n   v   o   k   e   _   i   i   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       i   n   v   o   k   e   _   i   i   d   d   d   d   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       i   n   v   o   k   e   _   i   i   f   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       i   n   v   o   k   e   _   i   i   i   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       i   n   v   o   k   e   _   i   i   i   d   d   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       i   n   v   o   k   e   _   i   i   i   i   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       i   n   v   o   k   e   _   i   i   i   i   i   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       i   n   v   o   k   e   _   i   i   i   i   i   i   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       i   n   v   o   k   e   _   i   i   i   i   i   i   i   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       i   n   v   o   k   e   _   i   i   i   i   i   i   i   i   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       i   n   v   o   k   e   _   v   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       i   n   v   o   k   e   _   v   f   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       i   n   v   o   k   e   _   v   i   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       i   n   v   o   k   e   _   v   i   f   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       i   n   v   o   k   e   _   v   i   f   f   f   f   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       i   n   v   o   k   e   _   v   i   i   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       i   n   v   o   k   e   _   v   i   i   f   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       i   n   v   o   k   e   _   v   i   i   i   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       i   n   v   o   k   e   _   v   i   i   i   i   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       i   n   v   o   k   e   _   v   i   i   i   i   i   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       i   n   v   o   k   e   _   v   i   i   i   i   i   i   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       i   n   v   o   k   e   _   v   i   i   i   i   i   i   i   i   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       i   n   v   o   k   e   _   v   i   i   i   i   i   i   i   i   i   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       i   n   v   o   k   e   _   v   i   i   i   i   i   i   i   i   i   i   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       j   s   _   f   e   e   d   _   s   t   r   e   a   m   _   d   a   t   a   _   t   o   _   p   r   o   j   e   c   t   m   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       j   s   _   i   n   i   t   i   a   l   i   z   e   _   s   t   r   e   a   m   _   a   n   a   l   y   s   e   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       j   s   _   i   n   i   t   i   a   l   i   z   e   _   w   o   r   k   l   e   t   _   s   y   s   t   e   m   _   o   n   c   e   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       j   s   _   l   o   a   d   _   s   o   n   g   _   i   n   t   o   _   w   o   r   k   l   e   t   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       l   l   v   m   _   e   h   _   t   y   p   e   i   d   _   f   o   r   :       _   l   l   v   m   _   e   h   _   t   y   p   e   i   d   _   f   o   r   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       m   e   m   o   r   y   :       w   a   s   m   M   e   m   o   r   y   ,   
                   /   *   *       @   e   x   p   o   r   t       *   /       r   a   n   d   o   m   _   g   e   t   :       _   r   a   n   d   o   m   _   g   e   t   
           }   ;   
   }   
   
   v   a   r       w   a   s   m   E   x   p   o   r   t   s       =       a   w   a   i   t       c   r   e   a   t   e   W   a   s   m   (   )   ;   
   
   f   u   n   c   t   i   o   n       i   n   v   o   k   e   _   i   i   (   i   n   d   e   x   ,       a   1   )       {   
           v   a   r       s   p       =       s   t   a   c   k   S   a   v   e   (   )   ;   
           t   r   y       {   
                   r   e   t   u   r   n       g   e   t   W   a   s   m   T   a   b   l   e   E   n   t   r   y   (   i   n   d   e   x   )   (   a   1   )   ;   
           }       c   a   t   c   h       (   e   )       {   
                   s   t   a   c   k   R   e   s   t   o   r   e   (   s   p   )   ;   
                   i   f       (   e       !   =   =       e       +       0   )       t   h   r   o   w       e   ;   
                   _   s   e   t   T   h   r   e   w   (   1   ,       0   )   ;   
           }   
   }   
   
   f   u   n   c   t   i   o   n       i   n   v   o   k   e   _   v   i   (   i   n   d   e   x   ,       a   1   )       {   
           v   a   r       s   p       =       s   t   a   c   k   S   a   v   e   (   )   ;   
           t   r   y       {   
                   g   e   t   W   a   s   m   T   a   b   l   e   E   n   t   r   y   (   i   n   d   e   x   )   (   a   1   )   ;   
           }       c   a   t   c   h       (   e   )       {   
                   s   t   a   c   k   R   e   s   t   o   r   e   (   s   p   )   ;   
                   i   f       (   e       !   =   =       e       +       0   )       t   h   r   o   w       e   ;   
                   _   s   e   t   T   h   r   e   w   (   1   ,       0   )   ;   
           }   
   }   
   
   f   u   n   c   t   i   o   n       i   n   v   o   k   e   _   v   i   i   (   i   n   d   e   x   ,       a   1   ,       a   2   )       {   
           v   a   r       s   p       =       s   t   a   c   k   S   a   v   e   (   )   ;   
           t   r   y       {   
                   g   e   t   W   a   s   m   T   a   b   l   e   E   n   t   r   y   (   i   n   d   e   x   )   (   a   1   ,       a   2   )   ;   
           }       c   a   t   c   h       (   e   )       {   
                   s   t   a   c   k   R   e   s   t   o   r   e   (   s   p   )   ;   
                   i   f       (   e       !   =   =       e       +       0   )       t   h   r   o   w       e   ;   
                   _   s   e   t   T   h   r   e   w   (   1   ,       0   )   ;   
           }   
   }   
   
   f   u   n   c   t   i   o   n       i   n   v   o   k   e   _   v   i   f   (   i   n   d   e   x   ,       a   1   ,       a   2   )       {   
           v   a   r       s   p       =       s   t   a   c   k   S   a   v   e   (   )   ;   
           t   r   y       {   
                   g   e   t   W   a   s   m   T   a   b   l   e   E   n   t   r   y   (   i   n   d   e   x   )   (   a   1   ,       a   2   )   ;   
           }       c   a   t   c   h       (   e   )       {   
                   s   t   a   c   k   R   e   s   t   o   r   e   (   s   p   )   ;   
                   i   f       (   e       !   =   =       e       +       0   )       t   h   r   o   w       e   ;   
                   _   s   e   t   T   h   r   e   w   (   1   ,       0   )   ;   
           }   
   }   
   
   f   u   n   c   t   i   o   n       i   n   v   o   k   e   _   v   (   i   n   d   e   x   )       {   
           v   a   r       s   p       =       s   t   a   c   k   S   a   v   e   (   )   ;   
           t   r   y       {   
                   g   e   t   W   a   s   m   T   a   b   l   e   E   n   t   r   y   (   i   n   d   e   x   )   (   )   ;   
           }       c   a   t   c   h       (   e   )       {   
                   s   t   a   c   k   R   e   s   t   o   r   e   (   s   p   )   ;   
                   i   f       (   e       !   =   =       e       +       0   )       t   h   r   o   w       e   ;   
                   _   s   e   t   T   h   r   e   w   (   1   ,       0   )   ;   
           }   
   }   
   
   f   u   n   c   t   i   o   n       i   n   v   o   k   e   _   i   i   i   (   i   n   d   e   x   ,       a   1   ,       a   2   )       {   
           v   a   r       s   p       =       s   t   a   c   k   S   a   v   e   (   )   ;   
           t   r   y       {   
                   r   e   t   u   r   n       g   e   t   W   a   s   m   T   a   b   l   e   E   n   t   r   y   (   i   n   d   e   x   )   (   a   1   ,       a   2   )   ;   
           }       c   a   t   c   h       (   e   )       {   
                   s   t   a   c   k   R   e   s   t   o   r   e   (   s   p   )   ;   
                   i   f       (   e       !   =   =       e       +       0   )       t   h   r   o   w       e   ;   
                   _   s   e   t   T   h   r   e   w   (   1   ,       0   )   ;   
           }   
   }   
   
   f   u   n   c   t   i   o   n       i   n   v   o   k   e   _   i   i   d   d   d   d   (   i   n   d   e   x   ,       a   1   ,       a   2   ,       a   3   ,       a   4   ,       a   5   )       {   
           v   a   r       s   p       =       s   t   a   c   k   S   a   v   e   (   )   ;   
           t   r   y       {   
                   r   e   t   u   r   n       g   e   t   W   a   s   m   T   a   b   l   e   E   n   t   r   y   (   i   n   d   e   x   )   (   a   1   ,       a   2   ,       a   3   ,       a   4   ,       a   5   )   ;   
           }       c   a   t   c   h       (   e   )       {   
                   s   t   a   c   k   R   e   s   t   o   r   e   (   s   p   )   ;   
                   i   f       (   e       !   =   =       e       +       0   )       t   h   r   o   w       e   ;   
                   _   s   e   t   T   h   r   e   w   (   1   ,       0   )   ;   
           }   
   }   
   
   f   u   n   c   t   i   o   n       i   n   v   o   k   e   _   v   i   i   i   i   i   i   (   i   n   d   e   x   ,       a   1   ,       a   2   ,       a   3   ,       a   4   ,       a   5   ,       a   6   )       {   
           v   a   r       s   p       =       s   t   a   c   k   S   a   v   e   (   )   ;   
           t   r   y       {   
                   g   e   t   W   a   s   m   T   a   b   l   e   E   n   t   r   y   (   i   n   d   e   x   )   (   a   1   ,       a   2   ,       a   3   ,       a   4   ,       a   5   ,       a   6   )   ;   
           }       c   a   t   c   h       (   e   )       {   
                   s   t   a   c   k   R   e   s   t   o   r   e   (   s   p   )   ;   
                   i   f       (   e       !   =   =       e       +       0   )       t   h   r   o   w       e   ;   
                   _   s   e   t   T   h   r   e   w   (   1   ,       0   )   ;   
           }   
   }   
   
   f   u   n   c   t   i   o   n       i   n   v   o   k   e   _   v   i   i   i   i   (   i   n   d   e   x   ,       a   1   ,       a   2   ,       a   3   ,       a   4   )       {   
           v   a   r       s   p       =       s   t   a   c   k   S   a   v   e   (   )   ;   
           t   r   y       {   
                   g   e   t   W   a   s   m   T   a   b   l   e   E   n   t   r   y   (   i   n   d   e   x   )   (   a   1   ,       a   2   ,       a   3   ,       a   4   )   ;   
           }       c   a   t   c   h       (   e   )       {   
                   s   t   a   c   k   R   e   s   t   o   r   e   (   s   p   )   ;   
                   i   f       (   e       !   =   =       e       +       0   )       t   h   r   o   w       e   ;   
                   _   s   e   t   T   h   r   e   w   (   1   ,       0   )   ;   
           }   
   }   
   
   f   u   n   c   t   i   o   n       i   n   v   o   k   e   _   i   i   i   i   (   i   n   d   e   x   ,       a   1   ,       a   2   ,       a   3   )       {   
           v   a   r       s   p       =       s   t   a   c   k   S   a   v   e   (   )   ;   
           t   r   y       {   
                   r   e   t   u   r   n       g   e   t   W   a   s   m   T   a   b   l   e   E   n   t   r   y   (   i   n   d   e   x   )   (   a   1   ,       a   2   ,       a   3   )   ;   
           }       c   a   t   c   h       (   e   )       {   
                   s   t   a   c   k   R   e   s   t   o   r   e   (   s   p   )   ;   
                   i   f       (   e       !   =   =       e       +       0   )       t   h   r   o   w       e   ;   
                   _   s   e   t   T   h   r   e   w   (   1   ,       0   )   ;   
           }   
   }   
   
   f   u   n   c   t   i   o   n       i   n   v   o   k   e   _   v   i   i   i   i   i   i   i   i   (   i   n   d   e   x   ,       a   1   ,       a   2   ,       a   3   ,       a   4   ,       a   5   ,       a   6   ,       a   7   ,       a   8   )       {   
           v   a   r       s   p       =       s   t   a   c   k   S   a   v   e   (   )   ;   
           t   r   y       {   
                   g   e   t   W   a   s   m   T   a   b   l   e   E   n   t   r   y   (   i   n   d   e   x   )   (   a   1   ,       a   2   ,       a   3   ,       a   4   ,       a   5   ,       a   6   ,       a   7   ,       a   8   )   ;   
           }       c   a   t   c   h       (   e   )       {   
                   s   t   a   c   k   R   e   s   t   o   r   e   (   s   p   )   ;   
                   i   f       (   e       !   =   =       e       +       0   )       t   h   r   o   w       e   ;   
                   _   s   e   t   T   h   r   e   w   (   1   ,       0   )   ;   
           }   
   }   
   
   f   u   n   c   t   i   o   n       i   n   v   o   k   e   _   v   i   i   i   i   i   i   i   i   i   (   i   n   d   e   x   ,       a   1   ,       a   2   ,       a   3   ,       a   4   ,       a   5   ,       a   6   ,       a   7   ,       a   8   ,       a   9   )       {   
           v   a   r       s   p       =       s   t   a   c   k   S   a   v   e   (   )   ;   
           t   r   y       {   
                   g   e   t   W   a   s   m   T   a   b   l   e   E   n   t   r   y   (   i   n   d   e   x   )   (   a   1   ,       a   2   ,       a   3   ,       a   4   ,       a   5   ,       a   6   ,       a   7   ,       a   8   ,       a   9   )   ;   
           }       c   a   t   c   h       (   e   )       {   
                   s   t   a   c   k   R   e   s   t   o   r   e   (   s   p   )   ;   
                   i   f       (   e       !   =   =       e       +       0   )       t   h   r   o   w       e   ;   
                   _   s   e   t   T   h   r   e   w   (   1   ,       0   )   ;   
           }   
   }   
   
   f   u   n   c   t   i   o   n       i   n   v   o   k   e   _   v   i   i   i   i   i   i   i   i   i   i   (   i   n   d   e   x   ,       a   1   ,       a   2   ,       a   3   ,       a   4   ,       a   5   ,       a   6   ,       a   7   ,       a   8   ,       a   9   ,       a   1   0   )       {   
           v   a   r       s   p       =       s   t   a   c   k   S   a   v   e   (   )   ;   
           t   r   y       {   
                   g   e   t   W   a   s   m   T   a   b   l   e   E   n   t   r   y   (   i   n   d   e   x   )   (   a   1   ,       a   2   ,       a   3   ,       a   4   ,       a   5   ,       a   6   ,       a   7   ,       a   8   ,       a   9   ,       a   1   0   )   ;   
           }       c   a   t   c   h       (   e   )       {   
                   s   t   a   c   k   R   e   s   t   o   r   e   (   s   p   )   ;   
                   i   f       (   e       !   =   =       e       +       0   )       t   h   r   o   w       e   ;   
                   _   s   e   t   T   h   r   e   w   (   1   ,       0   )   ;   
           }   
   }   
   
   f   u   n   c   t   i   o   n       i   n   v   o   k   e   _   i   i   i   i   i   i   i   i   (   i   n   d   e   x   ,       a   1   ,       a   2   ,       a   3   ,       a   4   ,       a   5   ,       a   6   ,       a   7   )       {   
           v   a   r       s   p       =       s   t   a   c   k   S   a   v   e   (   )   ;   
           t   r   y       {   
                   r   e   t   u   r   n       g   e   t   W   a   s   m   T   a   b   l   e   E   n   t   r   y   (   i   n   d   e   x   )   (   a   1   ,       a   2   ,       a   3   ,       a   4   ,       a   5   ,       a   6   ,       a   7   )   ;   
           }       c   a   t   c   h       (   e   )       {   
                   s   t   a   c   k   R   e   s   t   o   r   e   (   s   p   )   ;   
                   i   f       (   e       !   =   =       e       +       0   )       t   h   r   o   w       e   ;   
                   _   s   e   t   T   h   r   e   w   (   1   ,       0   )   ;   
           }   
   }   
   
   f   u   n   c   t   i   o   n       i   n   v   o   k   e   _   v   i   i   i   (   i   n   d   e   x   ,       a   1   ,       a   2   ,       a   3   )       {   
           v   a   r       s   p       =       s   t   a   c   k   S   a   v   e   (   )   ;   
           t   r   y       {   
                   g   e   t   W   a   s   m   T   a   b   l   e   E   n   t   r   y   (   i   n   d   e   x   )   (   a   1   ,       a   2   ,       a   3   )   ;   
           }       c   a   t   c   h       (   e   )       {   
                   s   t   a   c   k   R   e   s   t   o   r   e   (   s   p   )   ;   
                   i   f       (   e       !   =   =       e       +       0   )       t   h   r   o   w       e   ;   
                   _   s   e   t   T   h   r   e   w   (   1   ,       0   )   ;   
           }   
   }   
   
   f   u   n   c   t   i   o   n       i   n   v   o   k   e   _   i   i   i   i   i   i   (   i   n   d   e   x   ,       a   1   ,       a   2   ,       a   3   ,       a   4   ,       a   5   )       {   
           v   a   r       s   p       =       s   t   a   c   k   S   a   v   e   (   )   ;   
           t   r   y       {   
                   r   e   t   u   r   n       g   e   t   W   a   s   m   T   a   b   l   e   E   n   t   r   y   (   i   n   d   e   x   )   (   a   1   ,       a   2   ,       a   3   ,       a   4   ,       a   5   )   ;   
           }       c   a   t   c   h       (   e   )       {   
                   s   t   a   c   k   R   e   s   t   o   r   e   (   s   p   )   ;   
                   i   f       (   e       !   =   =       e       +       0   )       t   h   r   o   w       e   ;   
                   _   s   e   t   T   h   r   e   w   (   1   ,       0   )   ;   
           }   
   }   
   
   f   u   n   c   t   i   o   n       i   n   v   o   k   e   _   i   i   i   i   i   (   i   n   d   e   x   ,       a   1   ,       a   2   ,       a   3   ,       a   4   )       {   
           v   a   r       s   p       =       s   t   a   c   k   S   a   v   e   (   )   ;   
           t   r   y       {   
                   r   e   t   u   r   n       g   e   t   W   a   s   m   T   a   b   l   e   E   n   t   r   y   (   i   n   d   e   x   )   (   a   1   ,       a   2   ,       a   3   ,       a   4   )   ;   
           }       c   a   t   c   h       (   e   )       {   
                   s   t   a   c   k   R   e   s   t   o   r   e   (   s   p   )   ;   
                   i   f       (   e       !   =   =       e       +       0   )       t   h   r   o   w       e   ;   
                   _   s   e   t   T   h   r   e   w   (   1   ,       0   )   ;   
           }   
   }   
   
   f   u   n   c   t   i   o   n       i   n   v   o   k   e   _   i   i   i   i   i   i   i   (   i   n   d   e   x   ,       a   1   ,       a   2   ,       a   3   ,       a   4   ,       a   5   ,       a   6   )       {   
           v   a   r       s   p       =       s   t   a   c   k   S   a   v   e   (   )   ;   
           t   r   y       {   
                   r   e   t   u   r   n       g   e   t   W   a   s   m   T   a   b   l   e   E   n   t   r   y   (   i   n   d   e   x   )   (   a   1   ,       a   2   ,       a   3   ,       a   4   ,       a   5   ,       a   6   )   ;   
           }       c   a   t   c   h       (   e   )       {   
                   s   t   a   c   k   R   e   s   t   o   r   e   (   s   p   )   ;   
                   i   f       (   e       !   =   =       e       +       0   )       t   h   r   o   w       e   ;   
                   _   s   e   t   T   h   r   e   w   (   1   ,       0   )   ;   
           }   
   }   
   
   f   u   n   c   t   i   o   n       i   n   v   o   k   e   _   v   i   i   i   i   i   (   i   n   d   e   x   ,       a   1   ,       a   2   ,       a   3   ,       a   4   ,       a   5   )       {   
           v   a   r       s   p       =       s   t   a   c   k   S   a   v   e   (   )   ;   
           t   r   y       {   
                   g   e   t   W   a   s   m   T   a   b   l   e   E   n   t   r   y   (   i   n   d   e   x   )   (   a   1   ,       a   2   ,       a   3   ,       a   4   ,       a   5   )   ;   
           }       c   a   t   c   h       (   e   )       {   
                   s   t   a   c   k   R   e   s   t   o   r   e   (   s   p   )   ;   
                   i   f       (   e       !   =   =       e       +       0   )       t   h   r   o   w       e   ;   
                   _   s   e   t   T   h   r   e   w   (   1   ,       0   )   ;   
           }   
   }   
   
   f   u   n   c   t   i   o   n       i   n   v   o   k   e   _   f   i   i   (   i   n   d   e   x   ,       a   1   ,       a   2   )       {   
           v   a   r       s   p       =       s   t   a   c   k   S   a   v   e   (   )   ;   
           t   r   y       {   
                   r   e   t   u   r   n       g   e   t   W   a   s   m   T   a   b   l   e   E   n   t   r   y   (   i   n   d   e   x   )   (   a   1   ,       a   2   )   ;   
           }       c   a   t   c   h       (   e   )       {   
                   s   t   a   c   k   R   e   s   t   o   r   e   (   s   p   )   ;   
                   i   f       (   e       !   =   =       e       +       0   )       t   h   r   o   w       e   ;   
                   _   s   e   t   T   h   r   e   w   (   1   ,       0   )   ;   
           }   
   }   
   
   f   u   n   c   t   i   o   n       i   n   v   o   k   e   _   f   i   i   f   (   i   n   d   e   x   ,       a   1   ,       a   2   ,       a   3   )       {   
           v   a   r       s   p       =       s   t   a   c   k   S   a   v   e   (   )   ;   
           t   r   y       {   
                   r   e   t   u   r   n       g   e   t   W   a   s   m   T   a   b   l   e   E   n   t   r   y   (   i   n   d   e   x   )   (   a   1   ,       a   2   ,       a   3   )   ;   
           }       c   a   t   c   h       (   e   )       {   
                   s   t   a   c   k   R   e   s   t   o   r   e   (   s   p   )   ;   
                   i   f       (   e       !   =   =       e       +       0   )       t   h   r   o   w       e   ;   
                   _   s   e   t   T   h   r   e   w   (   1   ,       0   )   ;   
           }   
   }   
   
   f   u   n   c   t   i   o   n       i   n   v   o   k   e   _   i   (   i   n   d   e   x   )       {   
           v   a   r       s   p       =       s   t   a   c   k   S   a   v   e   (   )   ;   
           t   r   y       {   
                   r   e   t   u   r   n       g   e   t   W   a   s   m   T   a   b   l   e   E   n   t   r   y   (   i   n   d   e   x   )   (   )   ;   
           }       c   a   t   c   h       (   e   )       {   
                   s   t   a   c   k   R   e   s   t   o   r   e   (   s   p   )   ;   
                   i   f       (   e       !   =   =       e       +       0   )       t   h   r   o   w       e   ;   
                   _   s   e   t   T   h   r   e   w   (   1   ,       0   )   ;   
           }   
   }   
   
   f   u   n   c   t   i   o   n       i   n   v   o   k   e   _   i   i   f   (   i   n   d   e   x   ,       a   1   ,       a   2   )       {   
           v   a   r       s   p       =       s   t   a   c   k   S   a   v   e   (   )   ;   
           t   r   y       {   
                   r   e   t   u   r   n       g   e   t   W   a   s   m   T   a   b   l   e   E   n   t   r   y   (   i   n   d   e   x   )   (   a   1   ,       a   2   )   ;   
           }       c   a   t   c   h       (   e   )       {   
                   s   t   a   c   k   R   e   s   t   o   r   e   (   s   p   )   ;   
                   i   f       (   e       !   =   =       e       +       0   )       t   h   r   o   w       e   ;   
                   _   s   e   t   T   h   r   e   w   (   1   ,       0   )   ;   
           }   
   }   
   
   f   u   n   c   t   i   o   n       i   n   v   o   k   e   _   v   i   i   f   (   i   n   d   e   x   ,       a   1   ,       a   2   ,       a   3   )       {   
           v   a   r       s   p       =       s   t   a   c   k   S   a   v   e   (   )   ;   
           t   r   y       {   
                   g   e   t   W   a   s   m   T   a   b   l   e   E   n   t   r   y   (   i   n   d   e   x   )   (   a   1   ,       a   2   ,       a   3   )   ;   
           }       c   a   t   c   h       (   e   )       {   
                   s   t   a   c   k   R   e   s   t   o   r   e   (   s   p   )   ;   
                   i   f       (   e       !   =   =       e       +       0   )       t   h   r   o   w       e   ;   
                   _   s   e   t   T   h   r   e   w   (   1   ,       0   )   ;   
           }   
   }   
   
   f   u   n   c   t   i   o   n       i   n   v   o   k   e   _   v   i   f   f   f   f   (   i   n   d   e   x   ,       a   1   ,       a   2   ,       a   3   ,       a   4   ,       a   5   )       {   
           v   a   r       s   p       =       s   t   a   c   k   S   a   v   e   (   )   ;   
           t   r   y       {   
                   g   e   t   W   a   s   m   T   a   b   l   e   E   n   t   r   y   (   i   n   d   e   x   )   (   a   1   ,       a   2   ,       a   3   ,       a   4   ,       a   5   )   ;   
           }       c   a   t   c   h       (   e   )       {   
                   s   t   a   c   k   R   e   s   t   o   r   e   (   s   p   )   ;   
                   i   f       (   e       !   =   =       e       +       0   )       t   h   r   o   w       e   ;   
                   _   s   e   t   T   h   r   e   w   (   1   ,       0   )   ;   
           }   
   }   
   
   f   u   n   c   t   i   o   n       i   n   v   o   k   e   _   v   f   (   i   n   d   e   x   ,       a   1   )       {   
           v   a   r       s   p       =       s   t   a   c   k   S   a   v   e   (   )   ;   
           t   r   y       {   
                   g   e   t   W   a   s   m   T   a   b   l   e   E   n   t   r   y   (   i   n   d   e   x   )   (   a   1   )   ;   
           }       c   a   t   c   h       (   e   )       {   
                   s   t   a   c   k   R   e   s   t   o   r   e   (   s   p   )   ;   
                   i   f       (   e       !   =   =       e       +       0   )       t   h   r   o   w       e   ;   
                   _   s   e   t   T   h   r   e   w   (   1   ,       0   )   ;   
           }   
   }   
   
   f   u   n   c   t   i   o   n       i   n   v   o   k   e   _   d   i   (   i   n   d   e   x   ,       a   1   )       {   
           v   a   r       s   p       =       s   t   a   c   k   S   a   v   e   (   )   ;   
           t   r   y       {   
                   r   e   t   u   r   n       g   e   t   W   a   s   m   T   a   b   l   e   E   n   t   r   y   (   i   n   d   e   x   )   (   a   1   )   ;   
           }       c   a   t   c   h       (   e   )       {   
                   s   t   a   c   k   R   e   s   t   o   r   e   (   s   p   )   ;   
                   i   f       (   e       !   =   =       e       +       0   )       t   h   r   o   w       e   ;   
                   _   s   e   t   T   h   r   e   w   (   1   ,       0   )   ;   
           }   
   }   
   
   f   u   n   c   t   i   o   n       i   n   v   o   k   e   _   d   i   d   (   i   n   d   e   x   ,       a   1   ,       a   2   )       {   
           v   a   r       s   p       =       s   t   a   c   k   S   a   v   e   (   )   ;   
           t   r   y       {   
                   r   e   t   u   r   n       g   e   t   W   a   s   m   T   a   b   l   e   E   n   t   r   y   (   i   n   d   e   x   )   (   a   1   ,       a   2   )   ;   
           }       c   a   t   c   h       (   e   )       {   
                   s   t   a   c   k   R   e   s   t   o   r   e   (   s   p   )   ;   
                   i   f       (   e       !   =   =       e       +       0   )       t   h   r   o   w       e   ;   
                   _   s   e   t   T   h   r   e   w   (   1   ,       0   )   ;   
           }   
   }   
   
   f   u   n   c   t   i   o   n       i   n   v   o   k   e   _   i   i   i   d   d   (   i   n   d   e   x   ,       a   1   ,       a   2   ,       a   3   ,       a   4   )       {   
           v   a   r       s   p       =       s   t   a   c   k   S   a   v   e   (   )   ;   
           t   r   y       {   
                   r   e   t   u   r   n       g   e   t   W   a   s   m   T   a   b   l   e   E   n   t   r   y   (   i   n   d   e   x   )   (   a   1   ,       a   2   ,       a   3   ,       a   4   )   ;   
           }       c   a   t   c   h       (   e   )       {   
                   s   t   a   c   k   R   e   s   t   o   r   e   (   s   p   )   ;   
                   i   f       (   e       !   =   =       e       +       0   )       t   h   r   o   w       e   ;   
                   _   s   e   t   T   h   r   e   w   (   1   ,       0   )   ;   
           }   
   }   
   
   /   /       i   n   c   l   u   d   e   :       p   o   s   t   a   m   b   l   e   .   j   s   
   /   /       =   =   =       A   u   t   o   -   g   e   n   e   r   a   t   e   d       p   o   s   t   a   m   b   l   e       s   e   t   u   p       e   n   t   r   y       s   t   u   f   f       =   =   =   
   v   a   r       c   a   l   l   e   d   R   u   n   ;   
   
   f   u   n   c   t   i   o   n       c   a   l   l   M   a   i   n   (   )       {   
           a   s   s   e   r   t   (   r   u   n   D   e   p   e   n   d   e   n   c   i   e   s       =   =       0   ,       '   c   a   n   n   o   t       c   a   l   l       m   a   i   n       w   h   e   n       a   s   y   n   c       d   e   p   e   n   d   e   n   c   i   e   s       r   e   m   a   i   n   !       (   l   i   s   t   e   n       o   n       M   o   d   u   l   e   [   "   o   n   R   u   n   t   i   m   e   I   n   i   t   i   a   l   i   z   e   d   "   ]   )   '   )   ;   
           a   s   s   e   r   t   (   t   y   p   e   o   f       o   n   P   r   e   R   u   n   s       =   =   =       "   u   n   d   e   f   i   n   e   d   "       |   |       o   n   P   r   e   R   u   n   s   .   l   e   n   g   t   h       =   =       0   ,       "   c   a   n   n   o   t       c   a   l   l       m   a   i   n       w   h   e   n       p   r   e   R   u   n       f   u   n   c   t   i   o   n   s       r   e   m   a   i   n       t   o       b   e       c   a   l   l   e   d   "   )   ;   
           v   a   r       e   n   t   r   y   F   u   n   c   t   i   o   n       =       _   m   a   i   n   ;   
           v   a   r       a   r   g   c       =       0   ;   
           v   a   r       a   r   g   v       =       0   ;   
           t   r   y       {   
                   v   a   r       r   e   t       =       e   n   t   r   y   F   u   n   c   t   i   o   n   (   a   r   g   c   ,       a   r   g   v   )   ;   
                   /   /       i   f       w   e   '   r   e       n   o   t       r   u   n   n   i   n   g       a   n       e   v   e   n   t   e   d       m   a   i   n       l   o   o   p   ,       i   t   '   s       t   i   m   e       t   o       e   x   i   t   
                   e   x   i   t   J   S   (   r   e   t   ,       /   *       i   m   p   l   i   c   i   t       =       *   /       t   r   u   e   )   ;   
                   r   e   t   u   r   n       r   e   t   ;   
           }       c   a   t   c   h       (   e   )       {   
                   r   e   t   u   r   n       h   a   n   d   l   e   E   x   c   e   p   t   i   o   n   (   e   )   ;   
           }   
   }   
   
   f   u   n   c   t   i   o   n       s   t   a   c   k   C   h   e   c   k   I   n   i   t   (   )       {   
           /   /       T   h   i   s       i   s       n   o   r   m   a   l   l   y       c   a   l   l   e   d       a   u   t   o   m   a   t   i   c   a   l   l   y       d   u   r   i   n   g       _   _   w   a   s   m   _   c   a   l   l   _   c   t   o   r   s       b   u   t       n   e   e   d       t   o   
           /   /       g   e   t       t   h   e   s   e       v   a   l   u   e   s       b   e   f   o   r   e       e   v   e   n       r   u   n   n   i   n   g       a   n   y       o   f       t   h   e       c   t   o   r   s       s   o       w   e       c   a   l   l       i   t       r   e   d   u   n   d   a   n   t   l   y   
           /   /       h   e   r   e   .   
           /   /       S   e   e       $   e   s   t   a   b   l   i   s   h   S   t   a   c   k   S   p   a   c   e       f   o   r       t   h   e       e   q   u   i   v   a   l   e   n   t       c   o   d   e       t   h   a   t       r   u   n   s       o   n       a       t   h   r   e   a   d   
           a   s   s   e   r   t   (   !   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   P   T   H   R   E   A   D   )   ;   
           _   e   m   s   c   r   i   p   t   e   n   _   s   t   a   c   k   _   i   n   i   t   (   )   ;   
           /   /       T   O   D   O   (   s   b   c   )   :       M   o   v   e       w   r   i   t   e   S   t   a   c   k   C   o   o   k   i   e       t   o       n   a   t   i   v   e       t   o       t   o       a   v   o   i   d       t   h   i   s   .   
           w   r   i   t   e   S   t   a   c   k   C   o   o   k   i   e   (   )   ;   
   }   
   
   f   u   n   c   t   i   o   n       r   u   n   (   )       {   
           i   f       (   r   u   n   D   e   p   e   n   d   e   n   c   i   e   s       >       0   )       {   
                   d   e   p   e   n   d   e   n   c   i   e   s   F   u   l   f   i   l   l   e   d       =       r   u   n   ;   
                   r   e   t   u   r   n   ;   
           }   
           i   f       (   (   E   N   V   I   R   O   N   M   E   N   T   _   I   S   _   P   T   H   R   E   A   D   )   )       {   
                   r   e   a   d   y   P   r   o   m   i   s   e   R   e   s   o   l   v   e   ?   .   (   M   o   d   u   l   e   )   ;   
                   i   n   i   t   R   u   n   t   i   m   e   (   )   ;   
                   r   e   t   u   r   n   ;   
           }   
           s   t   a   c   k   C   h   e   c   k   I   n   i   t   (   )   ;   
           p   r   e   R   u   n   (   )   ;   
           /   /       a       p   r   e   R   u   n       a   d   d   e   d       a       d   e   p   e   n   d   e   n   c   y   ,       r   u   n       w   i   l   l       b   e       c   a   l   l   e   d       l   a   t   e   r   
           i   f       (   r   u   n   D   e   p   e   n   d   e   n   c   i   e   s       >       0   )       {   
                   d   e   p   e   n   d   e   n   c   i   e   s   F   u   l   f   i   l   l   e   d       =       r   u   n   ;   
                   r   e   t   u   r   n   ;   
           }   
           f   u   n   c   t   i   o   n       d   o   R   u   n   (   )       {   
                   /   /       r   u   n       m   a   y       h   a   v   e       j   u   s   t       b   e   e   n       c   a   l   l   e   d       t   h   r   o   u   g   h       d   e   p   e   n   d   e   n   c   i   e   s       b   e   i   n   g       f   u   l   f   i   l   l   e   d       j   u   s   t       i   n       t   h   i   s       v   e   r   y       f   r   a   m   e   ,   
                   /   /       o   r       w   h   i   l   e       t   h   e       a   s   y   n   c       s   e   t   S   t   a   t   u   s       t   i   m   e       b   e   l   o   w       w   a   s       h   a   p   p   e   n   i   n   g   
                   a   s   s   e   r   t   (   !   c   a   l   l   e   d   R   u   n   )   ;   
                   c   a   l   l   e   d   R   u   n       =       t   r   u   e   ;   
                   M   o   d   u   l   e   [   "   c   a   l   l   e   d   R   u   n   "   ]       =       t   r   u   e   ;   
                   i   f       (   A   B   O   R   T   )       r   e   t   u   r   n   ;   
                   i   n   i   t   R   u   n   t   i   m   e   (   )   ;   
                   p   r   e   M   a   i   n   (   )   ;   
                   r   e   a   d   y   P   r   o   m   i   s   e   R   e   s   o   l   v   e   ?   .   (   M   o   d   u   l   e   )   ;   
                   M   o   d   u   l   e   [   "   o   n   R   u   n   t   i   m   e   I   n   i   t   i   a   l   i   z   e   d   "   ]   ?   .   (   )   ;   
                   c   o   n   s   u   m   e   d   M   o   d   u   l   e   P   r   o   p   (   "   o   n   R   u   n   t   i   m   e   I   n   i   t   i   a   l   i   z   e   d   "   )   ;   
                   v   a   r       n   o   I   n   i   t   i   a   l   R   u   n       =       M   o   d   u   l   e   [   "   n   o   I   n   i   t   i   a   l   R   u   n   "   ]       |   |       f   a   l   s   e   ;   
                   i   f       (   !   n   o   I   n   i   t   i   a   l   R   u   n   )       c   a   l   l   M   a   i   n   (   )   ;   
                   p   o   s   t   R   u   n   (   )   ;   
           }   
           i   f       (   M   o   d   u   l   e   [   "   s   e   t   S   t   a   t   u   s   "   ]   )       {   
                   M   o   d   u   l   e   [   "   s   e   t   S   t   a   t   u   s   "   ]   (   "   R   u   n   n   i   n   g   .   .   .   "   )   ;   
                   s   e   t   T   i   m   e   o   u   t   (   (   )       =   >       {   
                           s   e   t   T   i   m   e   o   u   t   (   (   )       =   >       M   o   d   u   l   e   [   "   s   e   t   S   t   a   t   u   s   "   ]   (   "   "   )   ,       1   )   ;   
                           d   o   R   u   n   (   )   ;   
                   }   ,       1   )   ;   
           }       e   l   s   e       {   
                   d   o   R   u   n   (   )   ;   
           }   
           c   h   e   c   k   S   t   a   c   k   C   o   o   k   i   e   (   )   ;   
   }   
   
   f   u   n   c   t   i   o   n       c   h   e   c   k   U   n   f   l   u   s   h   e   d   C   o   n   t   e   n   t   (   )       {   
           /   /       C   o   m   p   i   l   e   r       s   e   t   t   i   n   g   s       d   o       n   o   t       a   l   l   o   w       e   x   i   t   i   n   g       t   h   e       r   u   n   t   i   m   e   ,       s   o       f   l   u   s   h   i   n   g   
           /   /       t   h   e       s   t   r   e   a   m   s       i   s       n   o   t       p   o   s   s   i   b   l   e   .       b   u   t       i   n       A   S   S   E   R   T   I   O   N   S       m   o   d   e       w   e       c   h   e   c   k   
           /   /       i   f       t   h   e   r   e       w   a   s       s   o   m   e   t   h   i   n   g       t   o       f   l   u   s   h   ,       a   n   d       i   f       s   o       t   e   l   l       t   h   e       u   s   e   r       t   h   e   y   
           /   /       s   h   o   u   l   d       r   e   q   u   e   s   t       t   h   a   t       t   h   e       r   u   n   t   i   m   e       b   e       e   x   i   t   a   b   l   e   .   
           /   /       N   o   r   m   a   l   l   y       w   e       w   o   u   l   d       n   o   t       e   v   e   n       i   n   c   l   u   d   e       f   l   u   s   h   (   )       a   t       a   l   l   ,       b   u   t       i   n       A   S   S   E   R   T   I   O   N   S   
           /   /       b   u   i   l   d   s       w   e       d   o       s   o       j   u   s   t       f   o   r       t   h   i   s       c   h   e   c   k   ,       a   n   d       h   e   r   e       w   e       s   e   e       i   f       t   h   e   r   e       i   s       a   n   y   
           /   /       c   o   n   t   e   n   t       t   o       f   l   u   s   h   ,       t   h   a   t       i   s   ,       w   e       c   h   e   c   k       i   f       t   h   e   r   e       w   o   u   l   d       h   a   v   e       b   e   e   n   
           /   /       s   o   m   e   t   h   i   n   g       a       n   o   n   -   A   S   S   E   R   T   I   O   N   S       b   u   i   l   d       w   o   u   l   d       h   a   v   e       n   o   t       s   e   e   n   .   
           /   /       H   o   w       w   e       f   l   u   s   h       t   h   e       s   t   r   e   a   m   s       d   e   p   e   n   d   s       o   n       w   h   e   t   h   e   r       w   e       a   r   e       i   n       S   Y   S   C   A   L   L   S   _   R   E   Q   U   I   R   E   _   F   I   L   E   S   Y   S   T   E   M   =   0   
           /   /       m   o   d   e       (   w   h   i   c   h       h   a   s       i   t   s       o   w   n       s   p   e   c   i   a   l       f   u   n   c   t   i   o   n       f   o   r       t   h   i   s   ;       o   t   h   e   r   w   i   s   e   ,       a   l   l   
           /   /       t   h   e       c   o   d   e       i   s       i   n   s   i   d   e       l   i   b   c   )   
           v   a   r       o   l   d   O   u   t       =       o   u   t   ;   
           v   a   r       o   l   d   E   r   r       =       e   r   r   ;   
           v   a   r       h   a   s       =       f   a   l   s   e   ;   
           o   u   t       =       e   r   r       =       x       =   >       {   
                   h   a   s       =       t   r   u   e   ;   
           }   ;   
           t   r   y       {   
                   /   /       i   t       d   o   e   s   n   '   t       m   a   t   t   e   r       i   f       i   t       f   a   i   l   s   
                   /   /       I   n       W   a   s   m   F   S       w   e       m   u   s   t       a   l   s   o       f   l   u   s   h       t   h   e       W   a   s   m   F   S       i   n   t   e   r   n   a   l       b   u   f   f   e   r   s   ,       f   o   r       t   h   i   s       c   h   e   c   k   
                   /   /       t   o       w   o   r   k   .   
                   _   w   a   s   m   f   s   _   f   l   u   s   h   (   )   ;   
           }       c   a   t   c   h       (   e   )       {   }   
           o   u   t       =       o   l   d   O   u   t   ;   
           e   r   r       =       o   l   d   E   r   r   ;   
           i   f       (   h   a   s   )       {   
                   w   a   r   n   O   n   c   e   (   "   s   t   d   i   o       s   t   r   e   a   m   s       h   a   d       c   o   n   t   e   n   t       i   n       t   h   e   m       t   h   a   t       w   a   s       n   o   t       f   l   u   s   h   e   d   .       y   o   u       s   h   o   u   l   d       s   e   t       E   X   I   T   _   R   U   N   T   I   M   E       t   o       1       (   s   e   e       t   h   e       E   m   s   c   r   i   p   t   e   n       F   A   Q   )   ,       o   r       m   a   k   e       s   u   r   e       t   o       e   m   i   t       a       n   e   w   l   i   n   e       w   h   e   n       y   o   u       p   r   i   n   t   f       e   t   c   .   "   )   ;   
                   w   a   r   n   O   n   c   e   (   "   (   t   h   i   s       m   a   y       a   l   s   o       b   e       d   u   e       t   o       n   o   t       i   n   c   l   u   d   i   n   g       f   u   l   l       f   i   l   e   s   y   s   t   e   m       s   u   p   p   o   r   t       -       t   r   y       b   u   i   l   d   i   n   g       w   i   t   h       -   s   F   O   R   C   E   _   F   I   L   E   S   Y   S   T   E   M   )   "   )   ;   
           }   
   }   
   
   f   u   n   c   t   i   o   n       p   r   e   I   n   i   t   (   )       {   
           i   f       (   M   o   d   u   l   e   [   "   p   r   e   I   n   i   t   "   ]   )       {   
                   i   f       (   t   y   p   e   o   f       M   o   d   u   l   e   [   "   p   r   e   I   n   i   t   "   ]       =   =       "   f   u   n   c   t   i   o   n   "   )       M   o   d   u   l   e   [   "   p   r   e   I   n   i   t   "   ]       =       [       M   o   d   u   l   e   [   "   p   r   e   I   n   i   t   "   ]       ]   ;   
                   w   h   i   l   e       (   M   o   d   u   l   e   [   "   p   r   e   I   n   i   t   "   ]   .   l   e   n   g   t   h       >       0   )       {   
                           M   o   d   u   l   e   [   "   p   r   e   I   n   i   t   "   ]   .   s   h   i   f   t   (   )   (   )   ;   
                   }   
           }   
           c   o   n   s   u   m   e   d   M   o   d   u   l   e   P   r   o   p   (   "   p   r   e   I   n   i   t   "   )   ;   
   }   
   
   p   r   e   I   n   i   t   (   )   ;   
   
   r   u   n   (   )   ;   
   
   /   /       e   n   d       i   n   c   l   u   d   e   :       p   o   s   t   a   m   b   l   e   .   j   s   
   /   /       i   n   c   l   u   d   e   :       p   o   s   t   a   m   b   l   e   _   m   o   d   u   l   a   r   i   z   e   .   j   s   
   /   /       I   n       M   O   D   U   L   A   R   I   Z   E       m   o   d   e       w   e       w   r   a   p       t   h   e       g   e   n   e   r   a   t   e   d       c   o   d   e       i   n       a       f   a   c   t   o   r   y       f   u   n   c   t   i   o   n   
   /   /       a   n   d       r   e   t   u   r   n       e   i   t   h   e   r       t   h   e       M   o   d   u   l   e       i   t   s   e   l   f   ,       o   r       a       p   r   o   m   i   s   e       o   f       t   h   e       m   o   d   u   l   e   .   
   /   /       W   e       a   s   s   i   g   n       t   o       t   h   e       `   m   o   d   u   l   e   R   t   n   `       g   l   o   b   a   l       h   e   r   e       a   n   d       c   o   n   f   i   g   u   r   e       c   l   o   s   u   r   e       t   o       s   e   e   
   /   /       t   h   i   s       a   s       a   n   d       e   x   t   e   r   n       s   o       i   t       w   o   n   '   t       g   e   t       m   i   n   i   f   i   e   d   .   
   i   f       (   r   u   n   t   i   m   e   I   n   i   t   i   a   l   i   z   e   d   )       {   
           m   o   d   u   l   e   R   t   n       =       M   o   d   u   l   e   ;   
   }       e   l   s   e       {   
           /   /       S   e   t       u   p       t   h   e       p   r   o   m   i   s   e       t   h   a   t       i   n   d   i   c   a   t   e   s       t   h   e       M   o   d   u   l   e       i   s       i   n   i   t   i   a   l   i   z   e   d   
           m   o   d   u   l   e   R   t   n       =       n   e   w       P   r   o   m   i   s   e   (   (   r   e   s   o   l   v   e   ,       r   e   j   e   c   t   )       =   >       {   
                   r   e   a   d   y   P   r   o   m   i   s   e   R   e   s   o   l   v   e       =       r   e   s   o   l   v   e   ;   
                   r   e   a   d   y   P   r   o   m   i   s   e   R   e   j   e   c   t       =       r   e   j   e   c   t   ;   
           }   )   ;   
   }   
   
   /   /       A   s   s   e   r   t   i   o   n       f   o   r       a   t   t   e   m   p   t   i   n   g       t   o       a   c   c   e   s   s       m   o   d   u   l   e       p   r   o   p   e   r   t   i   e   s       o   n       t   h   e       i   n   c   o   m   i   n   g   
   /   /       m   o   d   u   l   e   A   r   g   .           I   n       t   h   e       p   a   s   t       w   e       u   s   e   d       t   h   i   s       o   b   j   e   c   t       a   s       t   h   e       p   r   o   t   o   t   y   p   e       o   f       t   h   e       m   o   d   u   l   e   
   /   /       a   n   d       a   s   s   i   g   n   e   d       p   r   o   p   e   r   t   i   e   s       t   o       i   t   ,       b   u   t       n   o   w       w   e       r   e   t   u   r   n       a       d   i   s   t   i   n   c   t       o   b   j   e   c   t   .           T   h   i   s   
   /   /       k   e   e   p   s       t   h   e       i   n   s   t   a   n   c   e       p   r   i   v   a   t   e       u   n   t   i   l       i   t       i   s       r   e   a   d   y       (   i   .   e       t   h   e       p   r   o   m   i   s   e       h   a   s       b   e   e   n   
   /   /       r   e   s   o   l   v   e   d   )   .   
   f   o   r       (   c   o   n   s   t       p   r   o   p       o   f       O   b   j   e   c   t   .   k   e   y   s   (   M   o   d   u   l   e   )   )       {   
           i   f       (   !   (   p   r   o   p       i   n       m   o   d   u   l   e   A   r   g   )   )       {   
                   O   b   j   e   c   t   .   d   e   f   i   n   e   P   r   o   p   e   r   t   y   (   m   o   d   u   l   e   A   r   g   ,       p   r   o   p   ,       {   
                           c   o   n   f   i   g   u   r   a   b   l   e   :       t   r   u   e   ,   
                           g   e   t   (   )       {   
                                   a   b   o   r   t   (   `   A   c   c   e   s   s       t   o       m   o   d   u   l   e       p   r   o   p   e   r   t   y       (   '   $   {   p   r   o   p   }   '   )       i   s       n   o       l   o   n   g   e   r       p   o   s   s   i   b   l   e       v   i   a       t   h   e       m   o   d   u   l   e       c   o   n   s   t   r   u   c   t   o   r       a   r   g   u   m   e   n   t   ;       I   n   s   t   e   a   d   ,       u   s   e       t   h   e       r   e   s   u   l   t       o   f       t   h   e       m   o   d   u   l   e       c   o   n   s   t   r   u   c   t   o   r   .   `   )   ;   
                           }   
                   }   )   ;   
           }   
   }   
   
   
                   r   e   t   u   r   n       m   o   d   u   l   e   R   t   n   ;   
           }   ;   
   }   )   (   )   ;   
   
   /   /       E   x   p   o   r   t       u   s   i   n   g       a       U   M   D       s   t   y   l   e       e   x   p   o   r   t   ,       o   r       E   S   6       e   x   p   o   r   t   s       i   f       s   e   l   e   c   t   e   d   
   i   f       (   t   y   p   e   o   f       e   x   p   o   r   t   s       =   =   =       '   o   b   j   e   c   t   '       &   &       t   y   p   e   o   f       m   o   d   u   l   e       =   =   =       '   o   b   j   e   c   t   '   )       {   
           m   o   d   u   l   e   .   e   x   p   o   r   t   s       =       c   r   e   a   t   e   M   o   d   u   l   e   ;   
           /   /       T   h   i   s       d   e   f   a   u   l   t       e   x   p   o   r   t       l   o   o   k   s       r   e   d   u   n   d   a   n   t   ,       b   u   t       i   t       a   l   l   o   w   s       T   S       t   o       i   m   p   o   r   t       t   h   i   s   
           /   /       c   o   m   m   o   n   j   s       s   t   y   l   e       m   o   d   u   l   e   .   
           m   o   d   u   l   e   .   e   x   p   o   r   t   s   .   d   e   f   a   u   l   t       =       c   r   e   a   t   e   M   o   d   u   l   e   ;   
   }       e   l   s   e       i   f       (   t   y   p   e   o   f       d   e   f   i   n   e       =   =   =       '   f   u   n   c   t   i   o   n   '       &   &       d   e   f   i   n   e   [   '   a   m   d   '   ]   )   
           d   e   f   i   n   e   (   [   ]   ,       (   )       =   >       c   r   e   a   t   e   M   o   d   u   l   e   )   ;   
   
   /   /       C   r   e   a   t   e       c   o   d   e       f   o   r       d   e   t   e   c   t   i   n   g       i   f       w   e       a   r   e       r   u   n   n   i   n   g       i   n       a       p   t   h   r   e   a   d   .   
   /   /       N   o   r   m   a   l   l   y       t   h   i   s       d   e   t   e   c   t   i   o   n       i   s       d   o   n   e       w   h   e   n       t   h   e       m   o   d   u   l   e       i   s       i   t   s   e   l   f       r   u   n       b   u   t   
   /   /       w   h   e   n       r   u   n   n   i   n   g       i   n       M   O   D   U   L   A   R   I   Z   E       m   o   d   e       w   e       n   e   e   d       u   s   e       t   h   i   s       t   o       k   n   o   w       i   f       w   e       s   h   o   u   l   d   
   /   /       r   u   n       t   h   e       m   o   d   u   l   e       c   o   n   s   t   r   u   c   t   o   r       o   n       s   t   a   r   t   u   p       (   t   r   u   e       o   n   l   y       f   o   r       p   t   h   r   e   a   d   s   )   .   
   v   a   r       i   s   P   t   h   r   e   a   d       =       g   l   o   b   a   l   T   h   i   s   .   s   e   l   f   ?   .   n   a   m   e   ?   .   s   t   a   r   t   s   W   i   t   h   (   '   e   m   -   p   t   h   r   e   a   d   '   )   ;   
   
   i   s   P   t   h   r   e   a   d       &   &       c   r   e   a   t   e   M   o   d   u   l   e   (   )   ;   
   
   