Spade

Mini Shell

Directory:~$ /home/lmsyaran/public_html/joomla4/
Upload File

[Home] [System Details] [Kill Me]
Current File:~$ /home/lmsyaran/public_html/joomla4/compat.tar

LICENSE000064400000042630151157166200005562 0ustar00GNU GENERAL PUBLIC
LICENSE
				Version 2, June 1991

 Copyright (C) 1989, 1991 Free Software Foundation, Inc.
 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

				Preamble

  The licenses for most software are designed to take away your
freedom to share and change it.  By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users.  This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it.  (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.)  You can apply it to
your programs, too.

  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.

  To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.

  For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have.  You must make sure that they, too, receive or can get the
source code.  And you must show them these terms so they know their
rights.

  We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.

  Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software.  If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.

  Finally, any free program is threatened constantly by software
patents.  We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary.  To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at
all.

  The precise terms and conditions for copying, distribution and
modification follow.

			GNU GENERAL PUBLIC LICENSE
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License.  The "Program",
below,
refers to any such program or work, and a "work based on the
Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language.  (Hereinafter, translation is included without limitation in
the term "modification".)  Each licensee is addressed as
"you".

Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope.  The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.

  1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.

You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.

  2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:

	a) You must cause the modified files to carry prominent notices
	stating that you changed the files and the date of any change.

	b) You must cause any work that you distribute or publish, that in
	whole or in part contains or is derived from the Program or any
	part thereof, to be licensed as a whole at no charge to all third
	parties under the terms of this License.

	c) If the modified program normally reads commands interactively
	when run, you must cause it, when started running for such
	interactive use in the most ordinary way, to print or display an
	announcement including an appropriate copyright notice and a
	notice that there is no warranty (or else, saying that you provide
	a warranty) and that users may redistribute the program under
	these conditions, and telling the user how to view a copy of this
	License.  (Exception: if the Program itself is interactive but
	does not normally print such an announcement, your work based on
	the Program is not required to print an announcement.)

These requirements apply to the modified work as a whole.  If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works.  But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.

Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.

In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.

  3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:

	a) Accompany it with the complete corresponding machine-readable
	source code, which must be distributed under the terms of Sections
	1 and 2 above on a medium customarily used for software interchange; or,

	b) Accompany it with a written offer, valid for at least three
	years, to give any third party, for a charge no more than your
	cost of physically performing source distribution, a complete
	machine-readable copy of the corresponding source code, to be
	distributed under the terms of Sections 1 and 2 above on a medium
	customarily used for software interchange; or,

	c) Accompany it with the information you received as to the offer
	to distribute corresponding source code.  (This alternative is
	allowed only for noncommercial distribution and only if you
	received the program in object code or executable form with such
	an offer, in accord with Subsection b above.)

The source code for a work means the preferred form of the work for
making modifications to it.  For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable.  However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.

If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.

  4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License.  Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.

  5. You are not required to accept this License, since you have not
signed it.  However, nothing else grants you permission to modify or
distribute the Program or its derivative works.  These actions are
prohibited by law if you do not accept this License.  Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.

  6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions.  You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.

  7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all.  For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.

If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.

It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices.  Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.

This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.

  8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded.  In such case, this License incorporates
the limitation as if written in the body of this License.

  9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time.  Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

Each version is given a distinguishing version number.  If the Program
specifies a version number of this License which applies to it and
"any
later version", you have the option of following the terms and
conditions
either of that version or of any later version published by the Free
Software Foundation.  If the Program does not specify a version number of
this License, you may choose any version ever published by the Free
Software
Foundation.

  10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission.  For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this.  Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.

				NO WARRANTY

  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.

  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.

			 END OF TERMS AND CONDITIONS

		How to Apply These Terms to Your New Programs

  If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.

  To do so, attach the following notices to the program.  It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is
found.

	<one line to give the program's name and a brief idea of what it
does.>
	Copyright (C) <year>  <name of author>

	This program is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation; either version 2 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA


Also add information on how to contact you by electronic and paper mail.

If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:

	Gnomovision version 69, Copyright (C) year name of author
	Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show
w'.
	This is free software, and you are welcome to redistribute it
	under certain conditions; type `show c' for details.

The hypothetical commands `show w' and `show c' should show the
appropriate
parts of the General Public License.  Of course, the commands you use may
be called something other than `show w' and `show c'; they could
even be
mouse-clicks or menu items--whatever suits your program.

You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program,
if
necessary.  Here is a sample; alter the names:

  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
  `Gnomovision' (which makes passes at compilers) written by James
Hacker.

  <signature of Ty Coon>, 1 April 1989
  Ty Coon, President of Vice

This General Public License does not permit incorporating your program into
proprietary programs.  If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library.  If this is what you want to do, use the GNU Library General
Public License instead of this License.
src/CallbackFilterIterator.php000064400000004314151157166200012426
0ustar00<?php
/**
 * Part of the Joomla Framework Compat Package
 *
 * @copyright  Copyright (C) 2005 - 2014 Open Source Matters, Inc. All
rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE
 */

/**
 * CallbackFilterIterator using the callback to determine which items are
accepted or rejected.
 *
 * @link   http://php.net/manual/en/class.callbackfilteriterator.php
 * @since  1.2.0
 */
class CallbackFilterIterator extends \FilterIterator
{
	/**
	 * The callback to check value.
	 *
	 * @var    callable
	 *
	 * @since  1.2.0
	 */
	protected $callback = null;

	/**
	 * Creates a filtered iterator using the callback to determine
	 * which items are accepted or rejected.
	 *
	 * @param   \Iterator  $iterator  The iterator to be filtered.
	 * @param   callable   $callback  The callback, which should return TRUE
to accept the current item
	 *                                or FALSE otherwise. May be any valid
callable value.
	 *                                The callback should accept up to three
arguments: the current item,
	 *                                the current key and the iterator,
respectively.
	 *                                ``` php
	 *                                function my_callback($current, $key,
$iterator)
	 *                                ```
	 *
	 * @throws  InvalidArgumentException
	 *
	 * @since   1.2.0
	 */
	public function __construct(\Iterator $iterator, $callback)
	{
		if (!is_callable($callback))
		{
			throw new \InvalidArgumentException("Argument 2 of
CallbackFilterIterator should be callable.");
		}

		$this->callback = $callback;

		parent::__construct($iterator);
	}

	/**
	 * This method calls the callback with the current value, current key and
the inner iterator.
	 * The callback is expected to return TRUE if the current item is to be
accepted, or FALSE otherwise.
	 *
	 * @link    http://www.php.net/manual/en/callbackfilteriterator.accept.php
	 *
	 * @return  boolean  True if the current element is acceptable, otherwise
false.
	 *
	 * @since   1.2.0
	 */
	public function accept()
	{
		$inner = $this->getInnerIterator();

		return call_user_func_array(
			$this->callback,
			array(
				$inner->current(),
				$inner->key(),
				$inner
			)
		);
	}
}
src/JsonSerializable.php000064400000001251151157166200011307
0ustar00<?php
/**
 * Part of the Joomla Framework Compat Package
 *
 * @copyright  Copyright (C) 2005 - 2013 Open Source Matters, Inc. All
rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE
 */

/**
 * JsonSerializable interface. This file provides backwards compatibility
to PHP 5.3 and ensures
 * the interface is present in systems where JSON related code was removed.
 *
 * @link   http://www.php.net/manual/en/jsonserializable.jsonserialize.php
 * @since  1.0
 */
interface JsonSerializable
{
	/**
	 * Return data which should be serialized by json_encode().
	 *
	 * @return  mixed
	 *
	 * @since   1.0
	 */
	public function jsonSerialize();
}
greensock.js000064400000332035151160675320007076 0ustar00/*
 * VERSION: 1.19.0
 * DATE: 2016-07-14
 * UPDATES AND DOCS AT: http://greensock.com
 *
 * Includes all of the following: TweenLite, TweenMax, TimelineLite,
TimelineMax, EasePack, CSSPlugin, RoundPropsPlugin, BezierPlugin,
AttrPlugin, DirectionalRotationPlugin
 *
 * @license Copyright (c) 2008-2016, GreenSock. All rights reserved.
 * This work is subject to the terms at
http://greensock.com/standard-license or for
 * Club GreenSock members, the software agreement that was issued with your
membership.
 *
 * @author: Jack Doyle, jack@greensock.com
 */
var _gsScope="undefined"!=typeof
module&&module.exports&&"undefined"!=typeof
global?global:this||window;(_gsScope._gsQueue||(_gsScope._gsQueue=[])).push(function(){"use
strict";_gsScope._gsDefine("TweenMax",["core.Animation","core.SimpleTimeline","TweenLite"],function(a,b,c){var
d=function(a){var b,c=[],d=a.length;for(b=0;b!==d;c.push(a[b++]));return
c},e=function(a,b,c){var d,e,f=a.cycle;for(d in
f)e=f[d],a[d]="function"==typeof e?e(c,b[c]):e[c%e.length];delete
a.cycle},f=function(a,b,d){c.call(this,a,b,d),this._cycle=0,this._yoyo=this.vars.yoyo===!0,this._repeat=this.vars.repeat||0,this._repeatDelay=this.vars.repeatDelay||0,this._dirty=!0,this.render=f.prototype.render},g=1e-10,h=c._internals,i=h.isSelector,j=h.isArray,k=f.prototype=c.to({},.1,{}),l=[];f.version="1.19.0",k.constructor=f,k.kill()._gc=!1,f.killTweensOf=f.killDelayedCallsTo=c.killTweensOf,f.getTweensOf=c.getTweensOf,f.lagSmoothing=c.lagSmoothing,f.ticker=c.ticker,f.render=c.render,k.invalidate=function(){return
this._yoyo=this.vars.yoyo===!0,this._repeat=this.vars.repeat||0,this._repeatDelay=this.vars.repeatDelay||0,this._uncache(!0),c.prototype.invalidate.call(this)},k.updateTo=function(a,b){var
d,e=this.ratio,f=this.vars.immediateRender||a.immediateRender;b&&this._startTime<this._timeline._time&&(this._startTime=this._timeline._time,this._uncache(!1),this._gc?this._enabled(!0,!1):this._timeline.insert(this,this._startTime-this._delay));for(d
in
a)this.vars[d]=a[d];if(this._initted||f)if(b)this._initted=!1,f&&this.render(0,!0,!0);else
if(this._gc&&this._enabled(!0,!1),this._notifyPluginsOfEnabled&&this._firstPT&&c._onPluginEvent("_onDisable",this),this._time/this._duration>.998){var
g=this._totalTime;this.render(0,!0,!1),this._initted=!1,this.render(g,!0,!1)}else
if(this._initted=!1,this._init(),this._time>0||f)for(var
h,i=1/(1-e),j=this._firstPT;j;)h=j.s+j.c,j.c*=i,j.s=h-j.c,j=j._next;return
this},k.render=function(a,b,c){this._initted||0===this._duration&&this.vars.repeat&&this.invalidate();var
d,e,f,i,j,k,l,m,n=this._dirty?this.totalDuration():this._totalDuration,o=this._time,p=this._totalTime,q=this._cycle,r=this._duration,s=this._rawPrevTime;if(a>=n-1e-7?(this._totalTime=n,this._cycle=this._repeat,this._yoyo&&0!==(1&this._cycle)?(this._time=0,this.ratio=this._ease._calcEnd?this._ease.getRatio(0):0):(this._time=r,this.ratio=this._ease._calcEnd?this._ease.getRatio(1):1),this._reversed||(d=!0,e="onComplete",c=c||this._timeline.autoRemoveChildren),0===r&&(this._initted||!this.vars.lazy||c)&&(this._startTime===this._timeline._duration&&(a=0),(0>s||0>=a&&a>=-1e-7||s===g&&"isPause"!==this.data)&&s!==a&&(c=!0,s>g&&(e="onReverseComplete")),this._rawPrevTime=m=!b||a||s===a?a:g)):1e-7>a?(this._totalTime=this._time=this._cycle=0,this.ratio=this._ease._calcEnd?this._ease.getRatio(0):0,(0!==p||0===r&&s>0)&&(e="onReverseComplete",d=this._reversed),0>a&&(this._active=!1,0===r&&(this._initted||!this.vars.lazy||c)&&(s>=0&&(c=!0),this._rawPrevTime=m=!b||a||s===a?a:g)),this._initted||(c=!0)):(this._totalTime=this._time=a,0!==this._repeat&&(i=r+this._repeatDelay,this._cycle=this._totalTime/i>>0,0!==this._cycle&&this._cycle===this._totalTime/i&&a>=p&&this._cycle--,this._time=this._totalTime-this._cycle*i,this._yoyo&&0!==(1&this._cycle)&&(this._time=r-this._time),this._time>r?this._time=r:this._time<0&&(this._time=0)),this._easeType?(j=this._time/r,k=this._easeType,l=this._easePower,(1===k||3===k&&j>=.5)&&(j=1-j),3===k&&(j*=2),1===l?j*=j:2===l?j*=j*j:3===l?j*=j*j*j:4===l&&(j*=j*j*j*j),1===k?this.ratio=1-j:2===k?this.ratio=j:this._time/r<.5?this.ratio=j/2:this.ratio=1-j/2):this.ratio=this._ease.getRatio(this._time/r)),o===this._time&&!c&&q===this._cycle)return
void(p!==this._totalTime&&this._onUpdate&&(b||this._callback("onUpdate")));if(!this._initted){if(this._init(),!this._initted||this._gc)return;if(!c&&this._firstPT&&(this.vars.lazy!==!1&&this._duration||this.vars.lazy&&!this._duration))return
this._time=o,this._totalTime=p,this._rawPrevTime=s,this._cycle=q,h.lazyTweens.push(this),void(this._lazy=[a,b]);this._time&&!d?this.ratio=this._ease.getRatio(this._time/r):d&&this._ease._calcEnd&&(this.ratio=this._ease.getRatio(0===this._time?0:1))}for(this._lazy!==!1&&(this._lazy=!1),this._active||!this._paused&&this._time!==o&&a>=0&&(this._active=!0),0===p&&(2===this._initted&&a>0&&this._init(),this._startAt&&(a>=0?this._startAt.render(a,b,c):e||(e="_dummyGS")),this.vars.onStart&&(0!==this._totalTime||0===r)&&(b||this._callback("onStart"))),f=this._firstPT;f;)f.f?f.t[f.p](f.c*this.ratio+f.s):f.t[f.p]=f.c*this.ratio+f.s,f=f._next;this._onUpdate&&(0>a&&this._startAt&&this._startTime&&this._startAt.render(a,b,c),b||(this._totalTime!==p||e)&&this._callback("onUpdate")),this._cycle!==q&&(b||this._gc||this.vars.onRepeat&&this._callback("onRepeat")),e&&(!this._gc||c)&&(0>a&&this._startAt&&!this._onUpdate&&this._startTime&&this._startAt.render(a,b,c),d&&(this._timeline.autoRemoveChildren&&this._enabled(!1,!1),this._active=!1),!b&&this.vars[e]&&this._callback(e),0===r&&this._rawPrevTime===g&&m!==g&&(this._rawPrevTime=0))},f.to=function(a,b,c){return
new f(a,b,c)},f.from=function(a,b,c){return
c.runBackwards=!0,c.immediateRender=0!=c.immediateRender,new
f(a,b,c)},f.fromTo=function(a,b,c,d){return
d.startAt=c,d.immediateRender=0!=d.immediateRender&&0!=c.immediateRender,new
f(a,b,d)},f.staggerTo=f.allTo=function(a,b,g,h,k,m,n){h=h||0;var
o,p,q,r,s=0,t=[],u=function(){g.onComplete&&g.onComplete.apply(g.onCompleteScope||this,arguments),k.apply(n||g.callbackScope||this,m||l)},v=g.cycle,w=g.startAt&&g.startAt.cycle;for(j(a)||("string"==typeof
a&&(a=c.selector(a)||a),i(a)&&(a=d(a))),a=a||[],0>h&&(a=d(a),a.reverse(),h*=-1),o=a.length-1,q=0;o>=q;q++){p={};for(r
in
g)p[r]=g[r];if(v&&(e(p,a,q),null!=p.duration&&(b=p.duration,delete
p.duration)),w){w=p.startAt={};for(r in
g.startAt)w[r]=g.startAt[r];e(p.startAt,a,q)}p.delay=s+(p.delay||0),q===o&&k&&(p.onComplete=u),t[q]=new
f(a[q],b,p),s+=h}return
t},f.staggerFrom=f.allFrom=function(a,b,c,d,e,g,h){return
c.runBackwards=!0,c.immediateRender=0!=c.immediateRender,f.staggerTo(a,b,c,d,e,g,h)},f.staggerFromTo=f.allFromTo=function(a,b,c,d,e,g,h,i){return
d.startAt=c,d.immediateRender=0!=d.immediateRender&&0!=c.immediateRender,f.staggerTo(a,b,d,e,g,h,i)},f.delayedCall=function(a,b,c,d,e){return
new
f(b,0,{delay:a,onComplete:b,onCompleteParams:c,callbackScope:d,onReverseComplete:b,onReverseCompleteParams:c,immediateRender:!1,useFrames:e,overwrite:0})},f.set=function(a,b){return
new f(a,0,b)},f.isTweening=function(a){return
c.getTweensOf(a,!0).length>0};var m=function(a,b){for(var
d=[],e=0,f=a._first;f;)f instanceof
c?d[e++]=f:(b&&(d[e++]=f),d=d.concat(m(f,b)),e=d.length),f=f._next;return
d},n=f.getAllTweens=function(b){return
m(a._rootTimeline,b).concat(m(a._rootFramesTimeline,b))};f.killAll=function(a,c,d,e){null==c&&(c=!0),null==d&&(d=!0);var
f,g,h,i=n(0!=e),j=i.length,k=c&&d&&e;for(h=0;j>h;h++)g=i[h],(k||g
instanceof
b||(f=g.target===g.vars.onComplete)&&d||c&&!f)&&(a?g.totalTime(g._reversed?0:g.totalDuration()):g._enabled(!1,!1))},f.killChildTweensOf=function(a,b){if(null!=a){var
e,g,k,l,m,n=h.tweenLookup;if("string"==typeof
a&&(a=c.selector(a)||a),i(a)&&(a=d(a)),j(a))for(l=a.length;--l>-1;)f.killChildTweensOf(a[l],b);else{e=[];for(k
in
n)for(g=n[k].target.parentNode;g;)g===a&&(e=e.concat(n[k].tweens)),g=g.parentNode;for(m=e.length,l=0;m>l;l++)b&&e[l].totalTime(e[l].totalDuration()),e[l]._enabled(!1,!1)}}};var
o=function(a,c,d,e){c=c!==!1,d=d!==!1,e=e!==!1;for(var
f,g,h=n(e),i=c&&d&&e,j=h.length;--j>-1;)g=h[j],(i||g
instanceof
b||(f=g.target===g.vars.onComplete)&&d||c&&!f)&&g.paused(a)};return
f.pauseAll=function(a,b,c){o(!0,a,b,c)},f.resumeAll=function(a,b,c){o(!1,a,b,c)},f.globalTimeScale=function(b){var
d=a._rootTimeline,e=c.ticker.time;return
arguments.length?(b=b||g,d._startTime=e-(e-d._startTime)*d._timeScale/b,d=a._rootFramesTimeline,e=c.ticker.frame,d._startTime=e-(e-d._startTime)*d._timeScale/b,d._timeScale=a._rootTimeline._timeScale=b,b):d._timeScale},k.progress=function(a,b){return
arguments.length?this.totalTime(this.duration()*(this._yoyo&&0!==(1&this._cycle)?1-a:a)+this._cycle*(this._duration+this._repeatDelay),b):this._time/this.duration()},k.totalProgress=function(a,b){return
arguments.length?this.totalTime(this.totalDuration()*a,b):this._totalTime/this.totalDuration()},k.time=function(a,b){return
arguments.length?(this._dirty&&this.totalDuration(),a>this._duration&&(a=this._duration),this._yoyo&&0!==(1&this._cycle)?a=this._duration-a+this._cycle*(this._duration+this._repeatDelay):0!==this._repeat&&(a+=this._cycle*(this._duration+this._repeatDelay)),this.totalTime(a,b)):this._time},k.duration=function(b){return
arguments.length?a.prototype.duration.call(this,b):this._duration},k.totalDuration=function(a){return
arguments.length?-1===this._repeat?this:this.duration((a-this._repeat*this._repeatDelay)/(this._repeat+1)):(this._dirty&&(this._totalDuration=-1===this._repeat?999999999999:this._duration*(this._repeat+1)+this._repeatDelay*this._repeat,this._dirty=!1),this._totalDuration)},k.repeat=function(a){return
arguments.length?(this._repeat=a,this._uncache(!0)):this._repeat},k.repeatDelay=function(a){return
arguments.length?(this._repeatDelay=a,this._uncache(!0)):this._repeatDelay},k.yoyo=function(a){return
arguments.length?(this._yoyo=a,this):this._yoyo},f},!0),_gsScope._gsDefine("TimelineLite",["core.Animation","core.SimpleTimeline","TweenLite"],function(a,b,c){var
d=function(a){b.call(this,a),this._labels={},this.autoRemoveChildren=this.vars.autoRemoveChildren===!0,this.smoothChildTiming=this.vars.smoothChildTiming===!0,this._sortChildren=!0,this._onUpdate=this.vars.onUpdate;var
c,d,e=this.vars;for(d in
e)c=e[d],i(c)&&-1!==c.join("").indexOf("{self}")&&(e[d]=this._swapSelfInParams(c));i(e.tweens)&&this.add(e.tweens,0,e.align,e.stagger)},e=1e-10,f=c._internals,g=d._internals={},h=f.isSelector,i=f.isArray,j=f.lazyTweens,k=f.lazyRender,l=_gsScope._gsDefine.globals,m=function(a){var
b,c={};for(b in a)c[b]=a[b];return c},n=function(a,b,c){var
d,e,f=a.cycle;for(d in f)e=f[d],a[d]="function"==typeof
e?e.call(b[c],c):e[c%e.length];delete
a.cycle},o=g.pauseCallback=function(){},p=function(a){var
b,c=[],d=a.length;for(b=0;b!==d;c.push(a[b++]));return c},q=d.prototype=new
b;return
d.version="1.19.0",q.constructor=d,q.kill()._gc=q._forcingPlayhead=q._hasPause=!1,q.to=function(a,b,d,e){var
f=d.repeat&&l.TweenMax||c;return b?this.add(new
f(a,b,d),e):this.set(a,d,e)},q.from=function(a,b,d,e){return
this.add((d.repeat&&l.TweenMax||c).from(a,b,d),e)},q.fromTo=function(a,b,d,e,f){var
g=e.repeat&&l.TweenMax||c;return
b?this.add(g.fromTo(a,b,d,e),f):this.set(a,e,f)},q.staggerTo=function(a,b,e,f,g,i,j,k){var
l,o,q=new
d({onComplete:i,onCompleteParams:j,callbackScope:k,smoothChildTiming:this.smoothChildTiming}),r=e.cycle;for("string"==typeof
a&&(a=c.selector(a)||a),a=a||[],h(a)&&(a=p(a)),f=f||0,0>f&&(a=p(a),a.reverse(),f*=-1),o=0;o<a.length;o++)l=m(e),l.startAt&&(l.startAt=m(l.startAt),l.startAt.cycle&&n(l.startAt,a,o)),r&&(n(l,a,o),null!=l.duration&&(b=l.duration,delete
l.duration)),q.to(a[o],b,l,o*f);return
this.add(q,g)},q.staggerFrom=function(a,b,c,d,e,f,g,h){return
c.immediateRender=0!=c.immediateRender,c.runBackwards=!0,this.staggerTo(a,b,c,d,e,f,g,h)},q.staggerFromTo=function(a,b,c,d,e,f,g,h,i){return
d.startAt=c,d.immediateRender=0!=d.immediateRender&&0!=c.immediateRender,this.staggerTo(a,b,d,e,f,g,h,i)},q.call=function(a,b,d,e){return
this.add(c.delayedCall(0,a,b,d),e)},q.set=function(a,b,d){return
d=this._parseTimeOrLabel(d,0,!0),null==b.immediateRender&&(b.immediateRender=d===this._time&&!this._paused),this.add(new
c(a,0,b),d)},d.exportRoot=function(a,b){a=a||{},null==a.smoothChildTiming&&(a.smoothChildTiming=!0);var
e,f,g=new
d(a),h=g._timeline;for(null==b&&(b=!0),h._remove(g,!0),g._startTime=0,g._rawPrevTime=g._time=g._totalTime=h._time,e=h._first;e;)f=e._next,b&&e
instanceof
c&&e.target===e.vars.onComplete||g.add(e,e._startTime-e._delay),e=f;return
h.add(g,0),g},q.add=function(e,f,g,h){var
j,k,l,m,n,o;if("number"!=typeof
f&&(f=this._parseTimeOrLabel(f,0,!0,e)),!(e instanceof a)){if(e
instanceof
Array||e&&e.push&&i(e)){for(g=g||"normal",h=h||0,j=f,k=e.length,l=0;k>l;l++)i(m=e[l])&&(m=new
d({tweens:m})),this.add(m,j),"string"!=typeof
m&&"function"!=typeof
m&&("sequence"===g?j=m._startTime+m.totalDuration()/m._timeScale:"start"===g&&(m._startTime-=m.delay())),j+=h;return
this._uncache(!0)}if("string"==typeof e)return
this.addLabel(e,f);if("function"!=typeof e)throw"Cannot add
"+e+" into the timeline; it is not a tween, timeline, function,
or
string.";e=c.delayedCall(0,e)}if(b.prototype.add.call(this,e,f),(this._gc||this._time===this._duration)&&!this._paused&&this._duration<this.duration())for(n=this,o=n.rawTime()>e._startTime;n._timeline;)o&&n._timeline.smoothChildTiming?n.totalTime(n._totalTime,!0):n._gc&&n._enabled(!0,!1),n=n._timeline;return
this},q.remove=function(b){if(b instanceof a){this._remove(b,!1);var
c=b._timeline=b.vars.useFrames?a._rootFramesTimeline:a._rootTimeline;return
b._startTime=(b._paused?b._pauseTime:c._time)-(b._reversed?b.totalDuration()-b._totalTime:b._totalTime)/b._timeScale,this}if(b
instanceof Array||b&&b.push&&i(b)){for(var
d=b.length;--d>-1;)this.remove(b[d]);return
this}return"string"==typeof
b?this.removeLabel(b):this.kill(null,b)},q._remove=function(a,c){b.prototype._remove.call(this,a,c);var
d=this._last;return
d?this._time>d._startTime+d._totalDuration/d._timeScale&&(this._time=this.duration(),this._totalTime=this._totalDuration):this._time=this._totalTime=this._duration=this._totalDuration=0,this},q.append=function(a,b){return
this.add(a,this._parseTimeOrLabel(null,b,!0,a))},q.insert=q.insertMultiple=function(a,b,c,d){return
this.add(a,b||0,c,d)},q.appendMultiple=function(a,b,c,d){return
this.add(a,this._parseTimeOrLabel(null,b,!0,a),c,d)},q.addLabel=function(a,b){return
this._labels[a]=this._parseTimeOrLabel(b),this},q.addPause=function(a,b,d,e){var
f=c.delayedCall(0,o,d,e||this);return
f.vars.onComplete=f.vars.onReverseComplete=b,f.data="isPause",this._hasPause=!0,this.add(f,a)},q.removeLabel=function(a){return
delete this._labels[a],this},q.getLabelTime=function(a){return
null!=this._labels[a]?this._labels[a]:-1},q._parseTimeOrLabel=function(b,c,d,e){var
f;if(e instanceof a&&e.timeline===this)this.remove(e);else
if(e&&(e instanceof
Array||e.push&&i(e)))for(f=e.length;--f>-1;)e[f]instanceof
a&&e[f].timeline===this&&this.remove(e[f]);if("string"==typeof
c)return this._parseTimeOrLabel(c,d&&"number"==typeof
b&&null==this._labels[c]?b-this.duration():0,d);if(c=c||0,"string"!=typeof
b||!isNaN(b)&&null==this._labels[b])null==b&&(b=this.duration());else{if(f=b.indexOf("="),-1===f)return
null==this._labels[b]?d?this._labels[b]=this.duration()+c:c:this._labels[b]+c;c=parseInt(b.charAt(f-1)+"1",10)*Number(b.substr(f+1)),b=f>1?this._parseTimeOrLabel(b.substr(0,f-1),0,d):this.duration()}return
Number(b)+c},q.seek=function(a,b){return
this.totalTime("number"==typeof
a?a:this._parseTimeOrLabel(a),b!==!1)},q.stop=function(){return
this.paused(!0)},q.gotoAndPlay=function(a,b){return
this.play(a,b)},q.gotoAndStop=function(a,b){return
this.pause(a,b)},q.render=function(a,b,c){this._gc&&this._enabled(!0,!1);var
d,f,g,h,i,l,m,n=this._dirty?this.totalDuration():this._totalDuration,o=this._time,p=this._startTime,q=this._timeScale,r=this._paused;if(a>=n-1e-7)this._totalTime=this._time=n,this._reversed||this._hasPausedChild()||(f=!0,h="onComplete",i=!!this._timeline.autoRemoveChildren,0===this._duration&&(0>=a&&a>=-1e-7||this._rawPrevTime<0||this._rawPrevTime===e)&&this._rawPrevTime!==a&&this._first&&(i=!0,this._rawPrevTime>e&&(h="onReverseComplete"))),this._rawPrevTime=this._duration||!b||a||this._rawPrevTime===a?a:e,a=n+1e-4;else
if(1e-7>a)if(this._totalTime=this._time=0,(0!==o||0===this._duration&&this._rawPrevTime!==e&&(this._rawPrevTime>0||0>a&&this._rawPrevTime>=0))&&(h="onReverseComplete",f=this._reversed),0>a)this._active=!1,this._timeline.autoRemoveChildren&&this._reversed?(i=f=!0,h="onReverseComplete"):this._rawPrevTime>=0&&this._first&&(i=!0),this._rawPrevTime=a;else{if(this._rawPrevTime=this._duration||!b||a||this._rawPrevTime===a?a:e,0===a&&f)for(d=this._first;d&&0===d._startTime;)d._duration||(f=!1),d=d._next;a=0,this._initted||(i=!0)}else{if(this._hasPause&&!this._forcingPlayhead&&!b){if(a>=o)for(d=this._first;d&&d._startTime<=a&&!l;)d._duration||"isPause"!==d.data||d.ratio||0===d._startTime&&0===this._rawPrevTime||(l=d),d=d._next;else
for(d=this._last;d&&d._startTime>=a&&!l;)d._duration||"isPause"===d.data&&d._rawPrevTime>0&&(l=d),d=d._prev;l&&(this._time=a=l._startTime,this._totalTime=a+this._cycle*(this._totalDuration+this._repeatDelay))}this._totalTime=this._time=this._rawPrevTime=a}if(this._time!==o&&this._first||c||i||l){if(this._initted||(this._initted=!0),this._active||!this._paused&&this._time!==o&&a>0&&(this._active=!0),0===o&&this.vars.onStart&&(0===this._time&&this._duration||b||this._callback("onStart")),m=this._time,m>=o)for(d=this._first;d&&(g=d._next,m===this._time&&(!this._paused||r));)(d._active||d._startTime<=m&&!d._paused&&!d._gc)&&(l===d&&this.pause(),d._reversed?d.render((d._dirty?d.totalDuration():d._totalDuration)-(a-d._startTime)*d._timeScale,b,c):d.render((a-d._startTime)*d._timeScale,b,c)),d=g;else
for(d=this._last;d&&(g=d._prev,m===this._time&&(!this._paused||r));){if(d._active||d._startTime<=o&&!d._paused&&!d._gc){if(l===d){for(l=d._prev;l&&l.endTime()>this._time;)l.render(l._reversed?l.totalDuration()-(a-l._startTime)*l._timeScale:(a-l._startTime)*l._timeScale,b,c),l=l._prev;l=null,this.pause()}d._reversed?d.render((d._dirty?d.totalDuration():d._totalDuration)-(a-d._startTime)*d._timeScale,b,c):d.render((a-d._startTime)*d._timeScale,b,c)}d=g}this._onUpdate&&(b||(j.length&&k(),this._callback("onUpdate"))),h&&(this._gc||(p===this._startTime||q!==this._timeScale)&&(0===this._time||n>=this.totalDuration())&&(f&&(j.length&&k(),this._timeline.autoRemoveChildren&&this._enabled(!1,!1),this._active=!1),!b&&this.vars[h]&&this._callback(h)))}},q._hasPausedChild=function(){for(var
a=this._first;a;){if(a._paused||a instanceof
d&&a._hasPausedChild())return!0;a=a._next}return!1},q.getChildren=function(a,b,d,e){e=e||-9999999999;for(var
f=[],g=this._first,h=0;g;)g._startTime<e||(g instanceof
c?b!==!1&&(f[h++]=g):(d!==!1&&(f[h++]=g),a!==!1&&(f=f.concat(g.getChildren(!0,b,d)),h=f.length))),g=g._next;return
f},q.getTweensOf=function(a,b){var
d,e,f=this._gc,g=[],h=0;for(f&&this._enabled(!0,!0),d=c.getTweensOf(a),e=d.length;--e>-1;)(d[e].timeline===this||b&&this._contains(d[e]))&&(g[h++]=d[e]);return
f&&this._enabled(!1,!0),g},q.recent=function(){return
this._recent},q._contains=function(a){for(var
b=a.timeline;b;){if(b===this)return!0;b=b.timeline}return!1},q.shiftChildren=function(a,b,c){c=c||0;for(var
d,e=this._first,f=this._labels;e;)e._startTime>=c&&(e._startTime+=a),e=e._next;if(b)for(d
in f)f[d]>=c&&(f[d]+=a);return
this._uncache(!0)},q._kill=function(a,b){if(!a&&!b)return
this._enabled(!1,!1);for(var
c=b?this.getTweensOf(b):this.getChildren(!0,!0,!1),d=c.length,e=!1;--d>-1;)c[d]._kill(a,b)&&(e=!0);return
e},q.clear=function(a){var
b=this.getChildren(!1,!0,!0),c=b.length;for(this._time=this._totalTime=0;--c>-1;)b[c]._enabled(!1,!1);return
a!==!1&&(this._labels={}),this._uncache(!0)},q.invalidate=function(){for(var
b=this._first;b;)b.invalidate(),b=b._next;return
a.prototype.invalidate.call(this)},q._enabled=function(a,c){if(a===this._gc)for(var
d=this._first;d;)d._enabled(a,!0),d=d._next;return
b.prototype._enabled.call(this,a,c)},q.totalTime=function(b,c,d){this._forcingPlayhead=!0;var
e=a.prototype.totalTime.apply(this,arguments);return
this._forcingPlayhead=!1,e},q.duration=function(a){return
arguments.length?(0!==this.duration()&&0!==a&&this.timeScale(this._duration/a),this):(this._dirty&&this.totalDuration(),this._duration)},q.totalDuration=function(a){if(!arguments.length){if(this._dirty){for(var
b,c,d=0,e=this._last,f=999999999999;e;)b=e._prev,e._dirty&&e.totalDuration(),e._startTime>f&&this._sortChildren&&!e._paused?this.add(e,e._startTime-e._delay):f=e._startTime,e._startTime<0&&!e._paused&&(d-=e._startTime,this._timeline.smoothChildTiming&&(this._startTime+=e._startTime/this._timeScale),this.shiftChildren(-e._startTime,!1,-9999999999),f=0),c=e._startTime+e._totalDuration/e._timeScale,c>d&&(d=c),e=b;this._duration=this._totalDuration=d,this._dirty=!1}return
this._totalDuration}return
a&&this.totalDuration()?this.timeScale(this._totalDuration/a):this},q.paused=function(b){if(!b)for(var
c=this._first,d=this._time;c;)c._startTime===d&&"isPause"===c.data&&(c._rawPrevTime=0),c=c._next;return
a.prototype.paused.apply(this,arguments)},q.usesFrames=function(){for(var
b=this._timeline;b._timeline;)b=b._timeline;return
b===a._rootFramesTimeline},q.rawTime=function(){return
this._paused?this._totalTime:(this._timeline.rawTime()-this._startTime)*this._timeScale},d},!0),_gsScope._gsDefine("TimelineMax",["TimelineLite","TweenLite","easing.Ease"],function(a,b,c){var
d=function(b){a.call(this,b),this._repeat=this.vars.repeat||0,this._repeatDelay=this.vars.repeatDelay||0,this._cycle=0,this._yoyo=this.vars.yoyo===!0,this._dirty=!0},e=1e-10,f=b._internals,g=f.lazyTweens,h=f.lazyRender,i=_gsScope._gsDefine.globals,j=new
c(null,null,1,0),k=d.prototype=new a;return
k.constructor=d,k.kill()._gc=!1,d.version="1.19.0",k.invalidate=function(){return
this._yoyo=this.vars.yoyo===!0,this._repeat=this.vars.repeat||0,this._repeatDelay=this.vars.repeatDelay||0,this._uncache(!0),a.prototype.invalidate.call(this)},k.addCallback=function(a,c,d,e){return
this.add(b.delayedCall(0,a,d,e),c)},k.removeCallback=function(a,b){if(a)if(null==b)this._kill(null,a);else
for(var
c=this.getTweensOf(a,!1),d=c.length,e=this._parseTimeOrLabel(b);--d>-1;)c[d]._startTime===e&&c[d]._enabled(!1,!1);return
this},k.removePause=function(b){return
this.removeCallback(a._internals.pauseCallback,b)},k.tweenTo=function(a,c){c=c||{};var
d,e,f,g={ease:j,useFrames:this.usesFrames(),immediateRender:!1},h=c.repeat&&i.TweenMax||b;for(e
in c)g[e]=c[e];return
g.time=this._parseTimeOrLabel(a),d=Math.abs(Number(g.time)-this._time)/this._timeScale||.001,f=new
h(this,d,g),g.onStart=function(){f.target.paused(!0),f.vars.time!==f.target.time()&&d===f.duration()&&f.duration(Math.abs(f.vars.time-f.target.time())/f.target._timeScale),c.onStart&&f._callback("onStart")},f},k.tweenFromTo=function(a,b,c){c=c||{},a=this._parseTimeOrLabel(a),c.startAt={onComplete:this.seek,onCompleteParams:[a],callbackScope:this},c.immediateRender=c.immediateRender!==!1;var
d=this.tweenTo(b,c);return
d.duration(Math.abs(d.vars.time-a)/this._timeScale||.001)},k.render=function(a,b,c){this._gc&&this._enabled(!0,!1);var
d,f,i,j,k,l,m,n,o=this._dirty?this.totalDuration():this._totalDuration,p=this._duration,q=this._time,r=this._totalTime,s=this._startTime,t=this._timeScale,u=this._rawPrevTime,v=this._paused,w=this._cycle;if(a>=o-1e-7)this._locked||(this._totalTime=o,this._cycle=this._repeat),this._reversed||this._hasPausedChild()||(f=!0,j="onComplete",k=!!this._timeline.autoRemoveChildren,0===this._duration&&(0>=a&&a>=-1e-7||0>u||u===e)&&u!==a&&this._first&&(k=!0,u>e&&(j="onReverseComplete"))),this._rawPrevTime=this._duration||!b||a||this._rawPrevTime===a?a:e,this._yoyo&&0!==(1&this._cycle)?this._time=a=0:(this._time=p,a=p+1e-4);else
if(1e-7>a)if(this._locked||(this._totalTime=this._cycle=0),this._time=0,(0!==q||0===p&&u!==e&&(u>0||0>a&&u>=0)&&!this._locked)&&(j="onReverseComplete",f=this._reversed),0>a)this._active=!1,this._timeline.autoRemoveChildren&&this._reversed?(k=f=!0,j="onReverseComplete"):u>=0&&this._first&&(k=!0),this._rawPrevTime=a;else{if(this._rawPrevTime=p||!b||a||this._rawPrevTime===a?a:e,0===a&&f)for(d=this._first;d&&0===d._startTime;)d._duration||(f=!1),d=d._next;a=0,this._initted||(k=!0)}else
if(0===p&&0>u&&(k=!0),this._time=this._rawPrevTime=a,this._locked||(this._totalTime=a,0!==this._repeat&&(l=p+this._repeatDelay,this._cycle=this._totalTime/l>>0,0!==this._cycle&&this._cycle===this._totalTime/l&&a>=r&&this._cycle--,this._time=this._totalTime-this._cycle*l,this._yoyo&&0!==(1&this._cycle)&&(this._time=p-this._time),this._time>p?(this._time=p,a=p+1e-4):this._time<0?this._time=a=0:a=this._time)),this._hasPause&&!this._forcingPlayhead&&!b){if(a=this._time,a>=q)for(d=this._first;d&&d._startTime<=a&&!m;)d._duration||"isPause"!==d.data||d.ratio||0===d._startTime&&0===this._rawPrevTime||(m=d),d=d._next;else
for(d=this._last;d&&d._startTime>=a&&!m;)d._duration||"isPause"===d.data&&d._rawPrevTime>0&&(m=d),d=d._prev;m&&(this._time=a=m._startTime,this._totalTime=a+this._cycle*(this._totalDuration+this._repeatDelay))}if(this._cycle!==w&&!this._locked){var
x=this._yoyo&&0!==(1&w),y=x===(this._yoyo&&0!==(1&this._cycle)),z=this._totalTime,A=this._cycle,B=this._rawPrevTime,C=this._time;if(this._totalTime=w*p,this._cycle<w?x=!x:this._totalTime+=p,this._time=q,this._rawPrevTime=0===p?u-1e-4:u,this._cycle=w,this._locked=!0,q=x?0:p,this.render(q,b,0===p),b||this._gc||this.vars.onRepeat&&this._callback("onRepeat"),q!==this._time)return;if(y&&(q=x?p+1e-4:-1e-4,this.render(q,!0,!1)),this._locked=!1,this._paused&&!v)return;this._time=C,this._totalTime=z,this._cycle=A,this._rawPrevTime=B}if(!(this._time!==q&&this._first||c||k||m))return
void(r!==this._totalTime&&this._onUpdate&&(b||this._callback("onUpdate")));if(this._initted||(this._initted=!0),this._active||!this._paused&&this._totalTime!==r&&a>0&&(this._active=!0),0===r&&this.vars.onStart&&(0===this._totalTime&&this._totalDuration||b||this._callback("onStart")),n=this._time,n>=q)for(d=this._first;d&&(i=d._next,n===this._time&&(!this._paused||v));)(d._active||d._startTime<=this._time&&!d._paused&&!d._gc)&&(m===d&&this.pause(),d._reversed?d.render((d._dirty?d.totalDuration():d._totalDuration)-(a-d._startTime)*d._timeScale,b,c):d.render((a-d._startTime)*d._timeScale,b,c)),d=i;else
for(d=this._last;d&&(i=d._prev,n===this._time&&(!this._paused||v));){if(d._active||d._startTime<=q&&!d._paused&&!d._gc){if(m===d){for(m=d._prev;m&&m.endTime()>this._time;)m.render(m._reversed?m.totalDuration()-(a-m._startTime)*m._timeScale:(a-m._startTime)*m._timeScale,b,c),m=m._prev;m=null,this.pause()}d._reversed?d.render((d._dirty?d.totalDuration():d._totalDuration)-(a-d._startTime)*d._timeScale,b,c):d.render((a-d._startTime)*d._timeScale,b,c)}d=i}this._onUpdate&&(b||(g.length&&h(),this._callback("onUpdate"))),j&&(this._locked||this._gc||(s===this._startTime||t!==this._timeScale)&&(0===this._time||o>=this.totalDuration())&&(f&&(g.length&&h(),this._timeline.autoRemoveChildren&&this._enabled(!1,!1),this._active=!1),!b&&this.vars[j]&&this._callback(j)))},k.getActive=function(a,b,c){null==a&&(a=!0),null==b&&(b=!0),null==c&&(c=!1);var
d,e,f=[],g=this.getChildren(a,b,c),h=0,i=g.length;for(d=0;i>d;d++)e=g[d],e.isActive()&&(f[h++]=e);return
f},k.getLabelAfter=function(a){a||0!==a&&(a=this._time);var
b,c=this.getLabelsArray(),d=c.length;for(b=0;d>b;b++)if(c[b].time>a)return
c[b].name;return
null},k.getLabelBefore=function(a){null==a&&(a=this._time);for(var
b=this.getLabelsArray(),c=b.length;--c>-1;)if(b[c].time<a)return
b[c].name;return null},k.getLabelsArray=function(){var a,b=[],c=0;for(a in
this._labels)b[c++]={time:this._labels[a],name:a};return
b.sort(function(a,b){return
a.time-b.time}),b},k.progress=function(a,b){return
arguments.length?this.totalTime(this.duration()*(this._yoyo&&0!==(1&this._cycle)?1-a:a)+this._cycle*(this._duration+this._repeatDelay),b):this._time/this.duration()},k.totalProgress=function(a,b){return
arguments.length?this.totalTime(this.totalDuration()*a,b):this._totalTime/this.totalDuration()},k.totalDuration=function(b){return
arguments.length?-1!==this._repeat&&b?this.timeScale(this.totalDuration()/b):this:(this._dirty&&(a.prototype.totalDuration.call(this),this._totalDuration=-1===this._repeat?999999999999:this._duration*(this._repeat+1)+this._repeatDelay*this._repeat),this._totalDuration)},k.time=function(a,b){return
arguments.length?(this._dirty&&this.totalDuration(),a>this._duration&&(a=this._duration),this._yoyo&&0!==(1&this._cycle)?a=this._duration-a+this._cycle*(this._duration+this._repeatDelay):0!==this._repeat&&(a+=this._cycle*(this._duration+this._repeatDelay)),this.totalTime(a,b)):this._time},k.repeat=function(a){return
arguments.length?(this._repeat=a,this._uncache(!0)):this._repeat},k.repeatDelay=function(a){return
arguments.length?(this._repeatDelay=a,this._uncache(!0)):this._repeatDelay},k.yoyo=function(a){return
arguments.length?(this._yoyo=a,this):this._yoyo},k.currentLabel=function(a){return
arguments.length?this.seek(a,!0):this.getLabelBefore(this._time+1e-8)},d},!0),function(){var
a=180/Math.PI,b=[],c=[],d=[],e={},f=_gsScope._gsDefine.globals,g=function(a,b,c,d){c===d&&(c=d-(d-b)/1e6),a===b&&(b=a+(c-a)/1e6),this.a=a,this.b=b,this.c=c,this.d=d,this.da=d-a,this.ca=c-a,this.ba=b-a},h=",x,y,z,left,top,right,bottom,marginTop,marginLeft,marginRight,marginBottom,paddingLeft,paddingTop,paddingRight,paddingBottom,backgroundPosition,backgroundPosition_y,",i=function(a,b,c,d){var
e={a:a},f={},g={},h={c:d},i=(a+b)/2,j=(b+c)/2,k=(c+d)/2,l=(i+j)/2,m=(j+k)/2,n=(m-l)/8;return
e.b=i+(a-i)/4,f.b=l+n,e.c=f.a=(e.b+f.b)/2,f.c=g.a=(l+m)/2,g.b=m-n,h.b=k+(d-k)/4,g.c=h.a=(g.b+h.b)/2,[e,f,g,h]},j=function(a,e,f,g,h){var
j,k,l,m,n,o,p,q,r,s,t,u,v,w=a.length-1,x=0,y=a[0].a;for(j=0;w>j;j++)n=a[x],k=n.a,l=n.d,m=a[x+1].d,h?(t=b[j],u=c[j],v=(u+t)*e*.25/(g?.5:d[j]||.5),o=l-(l-k)*(g?.5*e:0!==t?v/t:0),p=l+(m-l)*(g?.5*e:0!==u?v/u:0),q=l-(o+((p-o)*(3*t/(t+u)+.5)/4||0))):(o=l-(l-k)*e*.5,p=l+(m-l)*e*.5,q=l-(o+p)/2),o+=q,p+=q,n.c=r=o,0!==j?n.b=y:n.b=y=n.a+.6*(n.c-n.a),n.da=l-k,n.ca=r-k,n.ba=y-k,f?(s=i(k,y,r,l),a.splice(x,1,s[0],s[1],s[2],s[3]),x+=4):x++,y=p;n=a[x],n.b=y,n.c=y+.4*(n.d-y),n.da=n.d-n.a,n.ca=n.c-n.a,n.ba=y-n.a,f&&(s=i(n.a,y,n.c,n.d),a.splice(x,1,s[0],s[1],s[2],s[3]))},k=function(a,d,e,f){var
h,i,j,k,l,m,n=[];if(f)for(a=[f].concat(a),i=a.length;--i>-1;)"string"==typeof(m=a[i][d])&&"="===m.charAt(1)&&(a[i][d]=f[d]+Number(m.charAt(0)+m.substr(2)));if(h=a.length-2,0>h)return
n[0]=new
g(a[0][d],0,0,a[-1>h?0:1][d]),n;for(i=0;h>i;i++)j=a[i][d],k=a[i+1][d],n[i]=new
g(j,0,0,k),e&&(l=a[i+2][d],b[i]=(b[i]||0)+(k-j)*(k-j),c[i]=(c[i]||0)+(l-k)*(l-k));return
n[i]=new g(a[i][d],0,0,a[i+1][d]),n},l=function(a,f,g,i,l,m){var
n,o,p,q,r,s,t,u,v={},w=[],x=m||a[0];l="string"==typeof
l?","+l+",":h,null==f&&(f=1);for(o in
a[0])w.push(o);if(a.length>1){for(u=a[a.length-1],t=!0,n=w.length;--n>-1;)if(o=w[n],Math.abs(x[o]-u[o])>.05){t=!1;break}t&&(a=a.concat(),m&&a.unshift(m),a.push(a[1]),m=a[a.length-3])}for(b.length=c.length=d.length=0,n=w.length;--n>-1;)o=w[n],e[o]=-1!==l.indexOf(","+o+","),v[o]=k(a,o,e[o],m);for(n=b.length;--n>-1;)b[n]=Math.sqrt(b[n]),c[n]=Math.sqrt(c[n]);if(!i){for(n=w.length;--n>-1;)if(e[o])for(p=v[w[n]],s=p.length-1,q=0;s>q;q++)r=p[q+1].da/c[q]+p[q].da/b[q]||0,d[q]=(d[q]||0)+r*r;for(n=d.length;--n>-1;)d[n]=Math.sqrt(d[n])}for(n=w.length,q=g?4:1;--n>-1;)o=w[n],p=v[o],j(p,f,g,i,e[o]),t&&(p.splice(0,q),p.splice(p.length-q,q));return
v},m=function(a,b,c){b=b||"soft";var
d,e,f,h,i,j,k,l,m,n,o,p={},q="cubic"===b?3:2,r="soft"===b,s=[];if(r&&c&&(a=[c].concat(a)),null==a||a.length<q+1)throw"invalid
Bezier data";for(m in
a[0])s.push(m);for(j=s.length;--j>-1;){for(m=s[j],p[m]=i=[],n=0,l=a.length,k=0;l>k;k++)d=null==c?a[k][m]:"string"==typeof(o=a[k][m])&&"="===o.charAt(1)?c[m]+Number(o.charAt(0)+o.substr(2)):Number(o),r&&k>1&&l-1>k&&(i[n++]=(d+i[n-2])/2),i[n++]=d;for(l=n-q+1,n=0,k=0;l>k;k+=q)d=i[k],e=i[k+1],f=i[k+2],h=2===q?0:i[k+3],i[n++]=o=3===q?new
g(d,e,f,h):new g(d,(2*e+d)/3,(2*e+f)/3,f);i.length=n}return
p},n=function(a,b,c){for(var
d,e,f,g,h,i,j,k,l,m,n,o=1/c,p=a.length;--p>-1;)for(m=a[p],f=m.a,g=m.d-f,h=m.c-f,i=m.b-f,d=e=0,k=1;c>=k;k++)j=o*k,l=1-j,d=e-(e=(j*j*g+3*l*(j*h+l*i))*j),n=p*c+k-1,b[n]=(b[n]||0)+d*d},o=function(a,b){b=b>>0||6;var
c,d,e,f,g=[],h=[],i=0,j=0,k=b-1,l=[],m=[];for(c in
a)n(a[c],g,b);for(e=g.length,d=0;e>d;d++)i+=Math.sqrt(g[d]),f=d%b,m[f]=i,f===k&&(j+=i,f=d/b>>0,l[f]=m,h[f]=j,i=0,m=[]);return{length:j,lengths:h,
segments:l}},p=_gsScope._gsDefine.plugin({propName:"bezier",priority:-1,version:"1.3.7",API:2,global:!0,init:function(a,b,c){this._target=a,b
instanceof
Array&&(b={values:b}),this._func={},this._mod={},this._props=[],this._timeRes=null==b.timeResolution?6:parseInt(b.timeResolution,10);var
d,e,f,g,h,i=b.values||[],j={},k=i[0],n=b.autoRotate||c.vars.orientToBezier;this._autoRotate=n?n
instanceof
Array?n:[["x","y","rotation",n===!0?0:Number(n)||0]]:null;for(d
in
k)this._props.push(d);for(f=this._props.length;--f>-1;)d=this._props[f],this._overwriteProps.push(d),e=this._func[d]="function"==typeof
a[d],j[d]=e?a[d.indexOf("set")||"function"!=typeof
a["get"+d.substr(3)]?d:"get"+d.substr(3)]():parseFloat(a[d]),h||j[d]!==i[0][d]&&(h=j);if(this._beziers="cubic"!==b.type&&"quadratic"!==b.type&&"soft"!==b.type?l(i,isNaN(b.curviness)?1:b.curviness,!1,"thruBasic"===b.type,b.correlate,h):m(i,b.type,j),this._segCount=this._beziers[d].length,this._timeRes){var
p=o(this._beziers,this._timeRes);this._length=p.length,this._lengths=p.lengths,this._segments=p.segments,this._l1=this._li=this._s1=this._si=0,this._l2=this._lengths[0],this._curSeg=this._segments[0],this._s2=this._curSeg[0],this._prec=1/this._curSeg.length}if(n=this._autoRotate)for(this._initialRotations=[],n[0]instanceof
Array||(this._autoRotate=n=[n]),f=n.length;--f>-1;){for(g=0;3>g;g++)d=n[f][g],this._func[d]="function"==typeof
a[d]?a[d.indexOf("set")||"function"!=typeof
a["get"+d.substr(3)]?d:"get"+d.substr(3)]:!1;d=n[f][2],this._initialRotations[f]=(this._func[d]?this._func[d].call(this._target):this._target[d])||0,this._overwriteProps.push(d)}return
this._startRatio=c.vars.runBackwards?1:0,!0},set:function(b){var
c,d,e,f,g,h,i,j,k,l,m=this._segCount,n=this._func,o=this._target,p=b!==this._startRatio;if(this._timeRes){if(k=this._lengths,l=this._curSeg,b*=this._length,e=this._li,b>this._l2&&m-1>e){for(j=m-1;j>e&&(this._l2=k[++e])<=b;);this._l1=k[e-1],this._li=e,this._curSeg=l=this._segments[e],this._s2=l[this._s1=this._si=0]}else
if(b<this._l1&&e>0){for(;e>0&&(this._l1=k[--e])>=b;);0===e&&b<this._l1?this._l1=0:e++,this._l2=k[e],this._li=e,this._curSeg=l=this._segments[e],this._s1=l[(this._si=l.length-1)-1]||0,this._s2=l[this._si]}if(c=e,b-=this._l1,e=this._si,b>this._s2&&e<l.length-1){for(j=l.length-1;j>e&&(this._s2=l[++e])<=b;);this._s1=l[e-1],this._si=e}else
if(b<this._s1&&e>0){for(;e>0&&(this._s1=l[--e])>=b;);0===e&&b<this._s1?this._s1=0:e++,this._s2=l[e],this._si=e}h=(e+(b-this._s1)/(this._s2-this._s1))*this._prec||0}else
c=0>b?0:b>=1?m-1:m*b>>0,h=(b-c*(1/m))*m;for(d=1-h,e=this._props.length;--e>-1;)f=this._props[e],g=this._beziers[f][c],i=(h*h*g.da+3*d*(h*g.ca+d*g.ba))*h+g.a,this._mod[f]&&(i=this._mod[f](i,o)),n[f]?o[f](i):o[f]=i;if(this._autoRotate){var
q,r,s,t,u,v,w,x=this._autoRotate;for(e=x.length;--e>-1;)f=x[e][2],v=x[e][3]||0,w=x[e][4]===!0?1:a,g=this._beziers[x[e][0]],q=this._beziers[x[e][1]],g&&q&&(g=g[c],q=q[c],r=g.a+(g.b-g.a)*h,t=g.b+(g.c-g.b)*h,r+=(t-r)*h,t+=(g.c+(g.d-g.c)*h-t)*h,s=q.a+(q.b-q.a)*h,u=q.b+(q.c-q.b)*h,s+=(u-s)*h,u+=(q.c+(q.d-q.c)*h-u)*h,i=p?Math.atan2(u-s,t-r)*w+v:this._initialRotations[e],this._mod[f]&&(i=this._mod[f](i,o)),n[f]?o[f](i):o[f]=i)}}}),q=p.prototype;p.bezierThrough=l,p.cubicToQuadratic=i,p._autoCSS=!0,p.quadraticToCubic=function(a,b,c){return
new g(a,(2*b+a)/3,(2*b+c)/3,c)},p._cssRegister=function(){var
a=f.CSSPlugin;if(a){var
b=a._internals,c=b._parseToProxy,d=b._setPluginRatio,e=b.CSSPropTween;b._registerComplexSpecialProp("bezier",{parser:function(a,b,f,g,h,i){b
instanceof Array&&(b={values:b}),i=new p;var
j,k,l,m=b.values,n=m.length-1,o=[],q={};if(0>n)return
h;for(j=0;n>=j;j++)l=c(a,m[j],g,h,i,n!==j),o[j]=l.end;for(k in
b)q[k]=b[k];return q.values=o,h=new
e(a,"bezier",0,0,l.pt,2),h.data=l,h.plugin=i,h.setRatio=d,0===q.autoRotate&&(q.autoRotate=!0),!q.autoRotate||q.autoRotate
instanceof
Array||(j=q.autoRotate===!0?0:Number(q.autoRotate),q.autoRotate=null!=l.end.left?[["left","top","rotation",j,!1]]:null!=l.end.x?[["x","y","rotation",j,!1]]:!1),q.autoRotate&&(g._transform||g._enableTransforms(!1),l.autoRotate=g._target._gsTransform,l.proxy.rotation=l.autoRotate.rotation||0,g._overwriteProps.push("rotation")),i._onInitTween(l.proxy,q,g._tween),h}})}},q._mod=function(a){for(var
b,c=this._overwriteProps,d=c.length;--d>-1;)b=a[c[d]],b&&"function"==typeof
b&&(this._mod[c[d]]=b)},q._kill=function(a){var
b,c,d=this._props;for(b in this._beziers)if(b in a)for(delete
this._beziers[b],delete
this._func[b],c=d.length;--c>-1;)d[c]===b&&d.splice(c,1);if(d=this._autoRotate)for(c=d.length;--c>-1;)a[d[c][2]]&&d.splice(c,1);return
this._super._kill.call(this,a)}}(),_gsScope._gsDefine("plugins.CSSPlugin",["plugins.TweenPlugin","TweenLite"],function(a,b){var
c,d,e,f,g=function(){a.call(this,"css"),this._overwriteProps.length=0,this.setRatio=g.prototype.setRatio},h=_gsScope._gsDefine.globals,i={},j=g.prototype=new
a("css");j.constructor=g,g.version="1.19.0",g.API=2,g.defaultTransformPerspective=0,g.defaultSkewType="compensated",g.defaultSmoothOrigin=!0,j="px",g.suffixMap={top:j,right:j,bottom:j,left:j,width:j,height:j,fontSize:j,padding:j,margin:j,perspective:j,lineHeight:""};var
k,l,m,n,o,p,q,r,s=/(?:\-|\.|\b)(\d|\.|e\-)+/g,t=/(?:\d|\-\d|\.\d|\-\.\d|\+=\d|\-=\d|\+=.\d|\-=\.\d)+/g,u=/(?:\+=|\-=|\-|\b)[\d\-\.]+[a-zA-Z0-9]*(?:%|\b)/gi,v=/(?![+-]?\d*\.?\d+|[+-]|e[+-]\d+)[^0-9]/g,w=/(?:\d|\-|\+|=|#|\.)*/g,x=/opacity
*= *([^)]*)/i,y=/opacity:([^;]*)/i,z=/alpha\(opacity
*=.+?\)/i,A=/^(rgb|hsl)/,B=/([A-Z])/g,C=/-([a-z])/gi,D=/(^(?:url\(\"|url\())|(?:(\"\))$|\)$)/gi,E=function(a,b){return
b.toUpperCase()},F=/(?:Left|Right|Width)/i,G=/(M11|M12|M21|M22)=[\d\-\.e]+/gi,H=/progid\:DXImageTransform\.Microsoft\.Matrix\(.+?\)/i,I=/,(?=[^\)]*(?:\(|$))/gi,J=/[\s,\(]/i,K=Math.PI/180,L=180/Math.PI,M={},N=document,O=function(a){return
N.createElementNS?N.createElementNS("http://www.w3.org/1999/xhtml",a):N.createElement(a)},P=O("div"),Q=O("img"),R=g._internals={_specialProps:i},S=navigator.userAgent,T=function(){var
a=S.indexOf("Android"),b=O("a");return
m=-1!==S.indexOf("Safari")&&-1===S.indexOf("Chrome")&&(-1===a||Number(S.substr(a+8,1))>3),o=m&&Number(S.substr(S.indexOf("Version/")+8,1))<6,n=-1!==S.indexOf("Firefox"),(/MSIE
([0-9]{1,}[\.0-9]{0,})/.exec(S)||/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(S))&&(p=parseFloat(RegExp.$1)),b?(b.style.cssText="top:1px;opacity:.55;",/^0.55/.test(b.style.opacity)):!1}(),U=function(a){return
x.test("string"==typeof
a?a:(a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100:1},V=function(a){window.console&&console.log(a)},W="",X="",Y=function(a,b){b=b||P;var
c,d,e=b.style;if(void 0!==e[a])return
a;for(a=a.charAt(0).toUpperCase()+a.substr(1),c=["O","Moz","ms","Ms","Webkit"],d=5;--d>-1&&void
0===e[c[d]+a];);return
d>=0?(X=3===d?"ms":c[d],W="-"+X.toLowerCase()+"-",X+a):null},Z=N.defaultView?N.defaultView.getComputedStyle:function(){},$=g.getStyle=function(a,b,c,d,e){var
f;return
T||"opacity"!==b?(!d&&a.style[b]?f=a.style[b]:(c=c||Z(a))?f=c[b]||c.getPropertyValue(b)||c.getPropertyValue(b.replace(B,"-$1").toLowerCase()):a.currentStyle&&(f=a.currentStyle[b]),null==e||f&&"none"!==f&&"auto"!==f&&"auto
auto"!==f?f:e):U(a)},_=R.convertToPixels=function(a,c,d,e,f){if("px"===e||!e)return
d;if("auto"===e||!d)return 0;var
h,i,j,k=F.test(c),l=a,m=P.style,n=0>d,o=1===d;if(n&&(d=-d),o&&(d*=100),"%"===e&&-1!==c.indexOf("border"))h=d/100*(k?a.clientWidth:a.clientHeight);else{if(m.cssText="border:0
solid
red;position:"+$(a,"position")+";line-height:0;","%"!==e&&l.appendChild&&"v"!==e.charAt(0)&&"rem"!==e)m[k?"borderLeftWidth":"borderTopWidth"]=d+e;else{if(l=a.parentNode||N.body,i=l._gsCache,j=b.ticker.frame,i&&k&&i.time===j)return
i.width*d/100;m[k?"width":"height"]=d+e}l.appendChild(P),h=parseFloat(P[k?"offsetWidth":"offsetHeight"]),l.removeChild(P),k&&"%"===e&&g.cacheWidths!==!1&&(i=l._gsCache=l._gsCache||{},i.time=j,i.width=h/d*100),0!==h||f||(h=_(a,c,d,e,!0))}return
o&&(h/=100),n?-h:h},aa=R.calculateOffset=function(a,b,c){if("absolute"!==$(a,"position",c))return
0;var
d="left"===b?"Left":"Top",e=$(a,"margin"+d,c);return
a["offset"+d]-(_(a,b,parseFloat(e),e.replace(w,""))||0)},ba=function(a,b){var
c,d,e,f={};if(b=b||Z(a,null))if(c=b.length)for(;--c>-1;)e=b[c],(-1===e.indexOf("-transform")||Ca===e)&&(f[e.replace(C,E)]=b.getPropertyValue(e));else
for(c in
b)(-1===c.indexOf("Transform")||Ba===c)&&(f[c]=b[c]);else
if(b=a.currentStyle||a.style)for(c in b)"string"==typeof
c&&void 0===f[c]&&(f[c.replace(C,E)]=b[c]);return
T||(f.opacity=U(a)),d=Pa(a,b,!1),f.rotation=d.rotation,f.skewX=d.skewX,f.scaleX=d.scaleX,f.scaleY=d.scaleY,f.x=d.x,f.y=d.y,Ea&&(f.z=d.z,f.rotationX=d.rotationX,f.rotationY=d.rotationY,f.scaleZ=d.scaleZ),f.filters&&delete
f.filters,f},ca=function(a,b,c,d,e){var f,g,h,i={},j=a.style;for(g in
c)"cssText"!==g&&"length"!==g&&isNaN(g)&&(b[g]!==(f=c[g])||e&&e[g])&&-1===g.indexOf("Origin")&&("number"==typeof
f||"string"==typeof
f)&&(i[g]="auto"!==f||"left"!==g&&"top"!==g?""!==f&&"auto"!==f&&"none"!==f||"string"!=typeof
b[g]||""===b[g].replace(v,"")?f:0:aa(a,g),void
0!==j[g]&&(h=new ra(j,g,j[g],h)));if(d)for(g in
d)"className"!==g&&(i[g]=d[g]);return{difs:i,firstMPT:h}},da={width:["Left","Right"],height:["Top","Bottom"]},ea=["marginLeft","marginRight","marginTop","marginBottom"],fa=function(a,b,c){if("svg"===(a.nodeName+"").toLowerCase())return(c||Z(a))[b]||0;if(a.getBBox&&Ma(a))return
a.getBBox()[b]||0;var
d=parseFloat("width"===b?a.offsetWidth:a.offsetHeight),e=da[b],f=e.length;for(c=c||Z(a,null);--f>-1;)d-=parseFloat($(a,"padding"+e[f],c,!0))||0,d-=parseFloat($(a,"border"+e[f]+"Width",c,!0))||0;return
d},ga=function(a,b){if("contain"===a||"auto"===a||"auto
auto"===a)return a+"
";(null==a||""===a)&&(a="0 0");var
c,d=a.split("
"),e=-1!==a.indexOf("left")?"0%":-1!==a.indexOf("right")?"100%":d[0],f=-1!==a.indexOf("top")?"0%":-1!==a.indexOf("bottom")?"100%":d[1];if(d.length>3&&!b){for(d=a.split(",
").join(",").split(","),a=[],c=0;c<d.length;c++)a.push(ga(d[c]));return
a.join(",")}return
null==f?f="center"===e?"50%":"0":"center"===f&&(f="50%"),("center"===e||isNaN(parseFloat(e))&&-1===(e+"").indexOf("="))&&(e="50%"),a=e+"
"+f+(d.length>2?"
"+d[2]:""),b&&(b.oxp=-1!==e.indexOf("%"),b.oyp=-1!==f.indexOf("%"),b.oxr="="===e.charAt(1),b.oyr="="===f.charAt(1),b.ox=parseFloat(e.replace(v,"")),b.oy=parseFloat(f.replace(v,"")),b.v=a),b||a},ha=function(a,b){return"function"==typeof
a&&(a=a(r,q)),"string"==typeof
a&&"="===a.charAt(1)?parseInt(a.charAt(0)+"1",10)*parseFloat(a.substr(2)):parseFloat(a)-parseFloat(b)||0},ia=function(a,b){return"function"==typeof
a&&(a=a(r,q)),null==a?b:"string"==typeof
a&&"="===a.charAt(1)?parseInt(a.charAt(0)+"1",10)*parseFloat(a.substr(2))+b:parseFloat(a)||0},ja=function(a,b,c,d){var
e,f,g,h,i,j=1e-6;return"function"==typeof
a&&(a=a(r,q)),null==a?h=b:"number"==typeof
a?h=a:(e=360,f=a.split("_"),i="="===a.charAt(1),g=(i?parseInt(a.charAt(0)+"1",10)*parseFloat(f[0].substr(2)):parseFloat(f[0]))*(-1===a.indexOf("rad")?1:L)-(i?0:b),f.length&&(d&&(d[c]=b+g),-1!==a.indexOf("short")&&(g%=e,g!==g%(e/2)&&(g=0>g?g+e:g-e)),-1!==a.indexOf("_cw")&&0>g?g=(g+9999999999*e)%e-(g/e|0)*e:-1!==a.indexOf("ccw")&&g>0&&(g=(g-9999999999*e)%e-(g/e|0)*e)),h=b+g),j>h&&h>-j&&(h=0),h},ka={aqua:[0,255,255],lime:[0,255,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,255],navy:[0,0,128],white:[255,255,255],fuchsia:[255,0,255],olive:[128,128,0],yellow:[255,255,0],orange:[255,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[255,0,0],pink:[255,192,203],cyan:[0,255,255],transparent:[255,255,255,0]},la=function(a,b,c){return
a=0>a?a+1:a>1?a-1:a,255*(1>6*a?b+(c-b)*a*6:.5>a?c:2>3*a?b+(c-b)*(2/3-a)*6:b)+.5|0},ma=g.parseColor=function(a,b){var
c,d,e,f,g,h,i,j,k,l,m;if(a)if("number"==typeof
a)c=[a>>16,a>>8&255,255&a];else{if(","===a.charAt(a.length-1)&&(a=a.substr(0,a.length-1)),ka[a])c=ka[a];else
if("#"===a.charAt(0))4===a.length&&(d=a.charAt(1),e=a.charAt(2),f=a.charAt(3),a="#"+d+d+e+e+f+f),a=parseInt(a.substr(1),16),c=[a>>16,a>>8&255,255&a];else
if("hsl"===a.substr(0,3))if(c=m=a.match(s),b){if(-1!==a.indexOf("="))return
a.match(t)}else
g=Number(c[0])%360/360,h=Number(c[1])/100,i=Number(c[2])/100,e=.5>=i?i*(h+1):i+h-i*h,d=2*i-e,c.length>3&&(c[3]=Number(a[3])),c[0]=la(g+1/3,d,e),c[1]=la(g,d,e),c[2]=la(g-1/3,d,e);else
c=a.match(s)||ka.transparent;c[0]=Number(c[0]),c[1]=Number(c[1]),c[2]=Number(c[2]),c.length>3&&(c[3]=Number(c[3]))}else
c=ka.black;return
b&&!m&&(d=c[0]/255,e=c[1]/255,f=c[2]/255,j=Math.max(d,e,f),k=Math.min(d,e,f),i=(j+k)/2,j===k?g=h=0:(l=j-k,h=i>.5?l/(2-j-k):l/(j+k),g=j===d?(e-f)/l+(f>e?6:0):j===e?(f-d)/l+2:(d-e)/l+4,g*=60),c[0]=g+.5|0,c[1]=100*h+.5|0,c[2]=100*i+.5|0),c},na=function(a,b){var
c,d,e,f=a.match(oa)||[],g=0,h=f.length?"":a;for(c=0;c<f.length;c++)d=f[c],e=a.substr(g,a.indexOf(d,g)-g),g+=e.length+d.length,d=ma(d,b),3===d.length&&d.push(1),h+=e+(b?"hsla("+d[0]+","+d[1]+"%,"+d[2]+"%,"+d[3]:"rgba("+d.join(","))+")";return
h+a.substr(g)},oa="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3}){1,2}\\b";for(j
in ka)oa+="|"+j+"\\b";oa=new
RegExp(oa+")","gi"),g.colorStringFilter=function(a){var
b,c=a[0]+a[1];oa.test(c)&&(b=-1!==c.indexOf("hsl(")||-1!==c.indexOf("hsla("),a[0]=na(a[0],b),a[1]=na(a[1],b)),oa.lastIndex=0},b.defaultStringFilter||(b.defaultStringFilter=g.colorStringFilter);var
pa=function(a,b,c,d){if(null==a)return function(a){return a};var
e,f=b?(a.match(oa)||[""])[0]:"",g=a.split(f).join("").match(u)||[],h=a.substr(0,a.indexOf(g[0])),i=")"===a.charAt(a.length-1)?")":"",j=-1!==a.indexOf("
")?"
":",",k=g.length,l=k>0?g[0].replace(s,""):"";return
k?e=b?function(a){var b,m,n,o;if("number"==typeof a)a+=l;else
if(d&&I.test(a)){for(o=a.replace(I,"|").split("|"),n=0;n<o.length;n++)o[n]=e(o[n]);return
o.join(",")}if(b=(a.match(oa)||[f])[0],m=a.split(b).join("").match(u)||[],n=m.length,k>n--)for(;++n<k;)m[n]=c?m[(n-1)/2|0]:g[n];return
h+m.join(j)+j+b+i+(-1!==a.indexOf("inset")?"
inset":"")}:function(a){var
b,f,m;if("number"==typeof a)a+=l;else
if(d&&I.test(a)){for(f=a.replace(I,"|").split("|"),m=0;m<f.length;m++)f[m]=e(f[m]);return
f.join(",")}if(b=a.match(u)||[],m=b.length,k>m--)for(;++m<k;)b[m]=c?b[(m-1)/2|0]:g[m];return
h+b.join(j)+i}:function(a){return a}},qa=function(a){return
a=a.split(","),function(b,c,d,e,f,g,h){var
i,j=(c+"").split("
");for(h={},i=0;4>i;i++)h[a[i]]=j[i]=j[i]||j[(i-1)/2>>0];return
e.parse(b,h,f,g)}},ra=(R._setPluginRatio=function(a){this.plugin.setRatio(a);for(var
b,c,d,e,f,g=this.data,h=g.proxy,i=g.firstMPT,j=1e-6;i;)b=h[i.v],i.r?b=Math.round(b):j>b&&b>-j&&(b=0),i.t[i.p]=b,i=i._next;if(g.autoRotate&&(g.autoRotate.rotation=g.mod?g.mod(h.rotation,this.t):h.rotation),1===a||0===a)for(i=g.firstMPT,f=1===a?"e":"b";i;){if(c=i.t,c.type){if(1===c.type){for(e=c.xs0+c.s+c.xs1,d=1;d<c.l;d++)e+=c["xn"+d]+c["xs"+(d+1)];c[f]=e}}else
c[f]=c.s+c.xs0;i=i._next}},function(a,b,c,d,e){this.t=a,this.p=b,this.v=c,this.r=e,d&&(d._prev=this,this._next=d)}),sa=(R._parseToProxy=function(a,b,c,d,e,f){var
g,h,i,j,k,l=d,m={},n={},o=c._transform,p=M;for(c._transform=null,M=b,d=k=c.parse(a,b,d,e),M=p,f&&(c._transform=o,l&&(l._prev=null,l._prev&&(l._prev._next=null)));d&&d!==l;){if(d.type<=1&&(h=d.p,n[h]=d.s+d.c,m[h]=d.s,f||(j=new
ra(d,"s",h,j,d.r),d.c=0),1===d.type))for(g=d.l;--g>0;)i="xn"+g,h=d.p+"_"+i,n[h]=d.data[i],m[h]=d[i],f||(j=new
ra(d,i,h,j,d.rxp[i]));d=d._next}return{proxy:m,end:n,firstMPT:j,pt:k}},R.CSSPropTween=function(a,b,d,e,g,h,i,j,k,l,m){this.t=a,this.p=b,this.s=d,this.c=e,this.n=i||b,a
instanceof
sa||f.push(this.n),this.r=j,this.type=h||0,k&&(this.pr=k,c=!0),this.b=void
0===l?d:l,this.e=void
0===m?d+e:m,g&&(this._next=g,g._prev=this)}),ta=function(a,b,c,d,e,f){var
g=new sa(a,b,c,d-c,e,-1,f);return
g.b=c,g.e=g.xs0=d,g},ua=g.parseComplex=function(a,b,c,d,e,f,h,i,j,l){c=c||f||"","function"==typeof
d&&(d=d(r,q)),h=new
sa(a,b,0,0,h,l?2:1,null,!1,i,c,d),d+="",e&&oa.test(d+c)&&(d=[c,d],g.colorStringFilter(d),c=d[0],d=d[1]);var
m,n,o,p,u,v,w,x,y,z,A,B,C,D=c.split(",
").join(",").split(" "),E=d.split(",
").join(",").split("
"),F=D.length,G=k!==!1;for((-1!==d.indexOf(",")||-1!==c.indexOf(","))&&(D=D.join("
").replace(I,", ").split(" "),E=E.join("
").replace(I,", ").split("
"),F=D.length),F!==E.length&&(D=(f||"").split("
"),F=D.length),h.plugin=j,h.setRatio=l,oa.lastIndex=0,m=0;F>m;m++)if(p=D[m],u=E[m],x=parseFloat(p),x||0===x)h.appendXtra("",x,ha(u,x),u.replace(t,""),G&&-1!==u.indexOf("px"),!0);else
if(e&&oa.test(p))B=u.indexOf(")")+1,B=")"+(B?u.substr(B):""),C=-1!==u.indexOf("hsl")&&T,p=ma(p,C),u=ma(u,C),y=p.length+u.length>6,y&&!T&&0===u[3]?(h["xs"+h.l]+=h.l?"
transparent":"transparent",h.e=h.e.split(E[m]).join("transparent")):(T||(y=!1),C?h.appendXtra(y?"hsla(":"hsl(",p[0],ha(u[0],p[0]),",",!1,!0).appendXtra("",p[1],ha(u[1],p[1]),"%,",!1).appendXtra("",p[2],ha(u[2],p[2]),y?"%,":"%"+B,!1):h.appendXtra(y?"rgba(":"rgb(",p[0],u[0]-p[0],",",!0,!0).appendXtra("",p[1],u[1]-p[1],",",!0).appendXtra("",p[2],u[2]-p[2],y?",":B,!0),y&&(p=p.length<4?1:p[3],h.appendXtra("",p,(u.length<4?1:u[3])-p,B,!1))),oa.lastIndex=0;else
if(v=p.match(s)){if(w=u.match(t),!w||w.length!==v.length)return
h;for(o=0,n=0;n<v.length;n++)A=v[n],z=p.indexOf(A,o),h.appendXtra(p.substr(o,z-o),Number(A),ha(w[n],A),"",G&&"px"===p.substr(z+A.length,2),0===n),o=z+A.length;h["xs"+h.l]+=p.substr(o)}else
h["xs"+h.l]+=h.l||h["xs"+h.l]?"
"+u:u;if(-1!==d.indexOf("=")&&h.data){for(B=h.xs0+h.data.s,m=1;m<h.l;m++)B+=h["xs"+m]+h.data["xn"+m];h.e=B+h["xs"+m]}return
h.l||(h.type=-1,h.xs0=h.e),h.xfirst||h},va=9;for(j=sa.prototype,j.l=j.pr=0;--va>0;)j["xn"+va]=0,j["xs"+va]="";j.xs0="",j._next=j._prev=j.xfirst=j.data=j.plugin=j.setRatio=j.rxp=null,j.appendXtra=function(a,b,c,d,e,f){var
g=this,h=g.l;return
g["xs"+h]+=f&&(h||g["xs"+h])?"
"+a:a||"",c||0===h||g.plugin?(g.l++,g.type=g.setRatio?2:1,g["xs"+g.l]=d||"",h>0?(g.data["xn"+h]=b+c,g.rxp["xn"+h]=e,g["xn"+h]=b,g.plugin||(g.xfirst=new
sa(g,"xn"+h,b,c,g.xfirst||g,0,g.n,e,g.pr),g.xfirst.xs0=0),g):(g.data={s:b+c},g.rxp={},g.s=b,g.c=c,g.r=e,g)):(g["xs"+h]+=b+(d||""),g)};var
wa=function(a,b){b=b||{},this.p=b.prefix?Y(a)||a:a,i[a]=i[this.p]=this,this.format=b.formatter||pa(b.defaultValue,b.color,b.collapsible,b.multi),b.parser&&(this.parse=b.parser),this.clrs=b.color,this.multi=b.multi,this.keyword=b.keyword,this.dflt=b.defaultValue,this.pr=b.priority||0},xa=R._registerComplexSpecialProp=function(a,b,c){"object"!=typeof
b&&(b={parser:c});var
d,e,f=a.split(","),g=b.defaultValue;for(c=c||[g],d=0;d<f.length;d++)b.prefix=0===d&&b.prefix,b.defaultValue=c[d]||g,e=new
wa(f[d],b)},ya=R._registerPluginProp=function(a){if(!i[a]){var
b=a.charAt(0).toUpperCase()+a.substr(1)+"Plugin";xa(a,{parser:function(a,c,d,e,f,g,j){var
k=h.com.greensock.plugins[b];return
k?(k._cssRegister(),i[d].parse(a,c,d,e,f,g,j)):(V("Error:
"+b+" js file not
loaded."),f)}})}};j=wa.prototype,j.parseComplex=function(a,b,c,d,e,f){var
g,h,i,j,k,l,m=this.keyword;if(this.multi&&(I.test(c)||I.test(b)?(h=b.replace(I,"|").split("|"),i=c.replace(I,"|").split("|")):m&&(h=[b],i=[c])),i){for(j=i.length>h.length?i.length:h.length,g=0;j>g;g++)b=h[g]=h[g]||this.dflt,c=i[g]=i[g]||this.dflt,m&&(k=b.indexOf(m),l=c.indexOf(m),k!==l&&(-1===l?h[g]=h[g].split(m).join(""):-1===k&&(h[g]+="
"+m)));b=h.join(", "),c=i.join(", ")}return
ua(a,this.p,b,c,this.clrs,this.dflt,d,this.pr,e,f)},j.parse=function(a,b,c,d,f,g,h){return
this.parseComplex(a.style,this.format($(a,this.p,e,!1,this.dflt)),this.format(b),f,g)},g.registerSpecialProp=function(a,b,c){xa(a,{parser:function(a,d,e,f,g,h,i){var
j=new sa(a,e,0,0,g,2,e,!1,c);return
j.plugin=h,j.setRatio=b(a,d,f._tween,e),j},priority:c})},g.useSVGTransformAttr=m||n;var
za,Aa="scaleX,scaleY,scaleZ,x,y,z,skewX,skewY,rotation,rotationX,rotationY,perspective,xPercent,yPercent".split(","),Ba=Y("transform"),Ca=W+"transform",Da=Y("transformOrigin"),Ea=null!==Y("perspective"),Fa=R.Transform=function(){this.perspective=parseFloat(g.defaultTransformPerspective)||0,this.force3D=g.defaultForce3D!==!1&&Ea?g.defaultForce3D||"auto":!1},Ga=window.SVGElement,Ha=function(a,b,c){var
d,e=N.createElementNS("http://www.w3.org/2000/svg",a),f=/([a-z])([A-Z])/g;for(d
in
c)e.setAttributeNS(null,d.replace(f,"$1-$2").toLowerCase(),c[d]);return
b.appendChild(e),e},Ia=N.documentElement,Ja=function(){var
a,b,c,d=p||/Android/i.test(S)&&!window.chrome;return
N.createElementNS&&!d&&(a=Ha("svg",Ia),b=Ha("rect",a,{width:100,height:50,x:100}),c=b.getBoundingClientRect().width,b.style[Da]="50%
50%",b.style[Ba]="scaleX(0.5)",d=c===b.getBoundingClientRect().width&&!(n&&Ea),Ia.removeChild(a)),d}(),Ka=function(a,b,c,d,e,f){var
h,i,j,k,l,m,n,o,p,q,r,s,t,u,v=a._gsTransform,w=Oa(a,!0);v&&(t=v.xOrigin,u=v.yOrigin),(!d||(h=d.split("
")).length<2)&&(n=a.getBBox(),b=ga(b).split("
"),h=[(-1!==b[0].indexOf("%")?parseFloat(b[0])/100*n.width:parseFloat(b[0]))+n.x,(-1!==b[1].indexOf("%")?parseFloat(b[1])/100*n.height:parseFloat(b[1]))+n.y]),c.xOrigin=k=parseFloat(h[0]),c.yOrigin=l=parseFloat(h[1]),d&&w!==Na&&(m=w[0],n=w[1],o=w[2],p=w[3],q=w[4],r=w[5],s=m*p-n*o,i=k*(p/s)+l*(-o/s)+(o*r-p*q)/s,j=k*(-n/s)+l*(m/s)-(m*r-n*q)/s,k=c.xOrigin=h[0]=i,l=c.yOrigin=h[1]=j),v&&(f&&(c.xOffset=v.xOffset,c.yOffset=v.yOffset,v=c),e||e!==!1&&g.defaultSmoothOrigin!==!1?(i=k-t,j=l-u,v.xOffset+=i*w[0]+j*w[2]-i,v.yOffset+=i*w[1]+j*w[3]-j):v.xOffset=v.yOffset=0),f||a.setAttribute("data-svg-origin",h.join("
"))},La=function(a){try{return
a.getBBox()}catch(a){}},Ma=function(a){return!!(Ga&&a.getBBox&&a.getCTM&&La(a)&&(!a.parentNode||a.parentNode.getBBox&&a.parentNode.getCTM))},Na=[1,0,0,1,0,0],Oa=function(a,b){var
c,d,e,f,g,h,i=a._gsTransform||new
Fa,j=1e5,k=a.style;if(Ba?d=$(a,Ca,null,!0):a.currentStyle&&(d=a.currentStyle.filter.match(G),d=d&&4===d.length?[d[0].substr(4),Number(d[2].substr(4)),Number(d[1].substr(4)),d[3].substr(4),i.x||0,i.y||0].join(","):""),c=!d||"none"===d||"matrix(1,
0, 0, 1, 0,
0)"===d,c&&Ba&&((h="none"===Z(a).display)||!a.parentNode)&&(h&&(f=k.display,k.display="block"),a.parentNode||(g=1,Ia.appendChild(a)),d=$(a,Ca,null,!0),c=!d||"none"===d||"matrix(1,
0, 0, 1, 0,
0)"===d,f?k.display=f:h&&Ta(k,"display"),g&&Ia.removeChild(a)),(i.svg||a.getBBox&&Ma(a))&&(c&&-1!==(k[Ba]+"").indexOf("matrix")&&(d=k[Ba],c=0),e=a.getAttribute("transform"),c&&e&&(-1!==e.indexOf("matrix")?(d=e,c=0):-1!==e.indexOf("translate")&&(d="matrix(1,0,0,1,"+e.match(/(?:\-|\b)[\d\-\.e]+\b/gi).join(",")+")",c=0))),c)return
Na;for(e=(d||"").match(s)||[],va=e.length;--va>-1;)f=Number(e[va]),e[va]=(g=f-(f|=0))?(g*j+(0>g?-.5:.5)|0)/j+f:f;return
b&&e.length>6?[e[0],e[1],e[4],e[5],e[12],e[13]]:e},Pa=R.getTransform=function(a,c,d,e){if(a._gsTransform&&d&&!e)return
a._gsTransform;var f,h,i,j,k,l,m=d?a._gsTransform||new Fa:new
Fa,n=m.scaleX<0,o=2e-5,p=1e5,q=Ea?parseFloat($(a,Da,c,!1,"0 0
0").split("
")[2])||m.zOrigin||0:0,r=parseFloat(g.defaultTransformPerspective)||0;if(m.svg=!(!a.getBBox||!Ma(a)),m.svg&&(Ka(a,$(a,Da,c,!1,"50%
50%")+"",m,a.getAttribute("data-svg-origin")),za=g.useSVGTransformAttr||Ja),f=Oa(a),f!==Na){if(16===f.length){var
s,t,u,v,w,x=f[0],y=f[1],z=f[2],A=f[3],B=f[4],C=f[5],D=f[6],E=f[7],F=f[8],G=f[9],H=f[10],I=f[12],J=f[13],K=f[14],M=f[11],N=Math.atan2(D,H);m.zOrigin&&(K=-m.zOrigin,I=F*K-f[12],J=G*K-f[13],K=H*K+m.zOrigin-f[14]),m.rotationX=N*L,N&&(v=Math.cos(-N),w=Math.sin(-N),s=B*v+F*w,t=C*v+G*w,u=D*v+H*w,F=B*-w+F*v,G=C*-w+G*v,H=D*-w+H*v,M=E*-w+M*v,B=s,C=t,D=u),N=Math.atan2(-z,H),m.rotationY=N*L,N&&(v=Math.cos(-N),w=Math.sin(-N),s=x*v-F*w,t=y*v-G*w,u=z*v-H*w,G=y*w+G*v,H=z*w+H*v,M=A*w+M*v,x=s,y=t,z=u),N=Math.atan2(y,x),m.rotation=N*L,N&&(v=Math.cos(-N),w=Math.sin(-N),x=x*v+B*w,t=y*v+C*w,C=y*-w+C*v,D=z*-w+D*v,y=t),m.rotationX&&Math.abs(m.rotationX)+Math.abs(m.rotation)>359.9&&(m.rotationX=m.rotation=0,m.rotationY=180-m.rotationY),m.scaleX=(Math.sqrt(x*x+y*y)*p+.5|0)/p,m.scaleY=(Math.sqrt(C*C+G*G)*p+.5|0)/p,m.scaleZ=(Math.sqrt(D*D+H*H)*p+.5|0)/p,m.rotationX||m.rotationY?m.skewX=0:(m.skewX=B||C?Math.atan2(B,C)*L+m.rotation:m.skewX||0,Math.abs(m.skewX)>90&&Math.abs(m.skewX)<270&&(n?(m.scaleX*=-1,m.skewX+=m.rotation<=0?180:-180,m.rotation+=m.rotation<=0?180:-180):(m.scaleY*=-1,m.skewX+=m.skewX<=0?180:-180))),m.perspective=M?1/(0>M?-M:M):0,m.x=I,m.y=J,m.z=K,m.svg&&(m.x-=m.xOrigin-(m.xOrigin*x-m.yOrigin*B),m.y-=m.yOrigin-(m.yOrigin*y-m.xOrigin*C))}else
if(!Ea||e||!f.length||m.x!==f[4]||m.y!==f[5]||!m.rotationX&&!m.rotationY){var
O=f.length>=6,P=O?f[0]:1,Q=f[1]||0,R=f[2]||0,S=O?f[3]:1;m.x=f[4]||0,m.y=f[5]||0,i=Math.sqrt(P*P+Q*Q),j=Math.sqrt(S*S+R*R),k=P||Q?Math.atan2(Q,P)*L:m.rotation||0,l=R||S?Math.atan2(R,S)*L+k:m.skewX||0,Math.abs(l)>90&&Math.abs(l)<270&&(n?(i*=-1,l+=0>=k?180:-180,k+=0>=k?180:-180):(j*=-1,l+=0>=l?180:-180)),m.scaleX=i,m.scaleY=j,m.rotation=k,m.skewX=l,Ea&&(m.rotationX=m.rotationY=m.z=0,m.perspective=r,m.scaleZ=1),m.svg&&(m.x-=m.xOrigin-(m.xOrigin*P+m.yOrigin*R),m.y-=m.yOrigin-(m.xOrigin*Q+m.yOrigin*S))}m.zOrigin=q;for(h
in m)m[h]<o&&m[h]>-o&&(m[h]=0)}return
d&&(a._gsTransform=m,m.svg&&(za&&a.style[Ba]?b.delayedCall(.001,function(){Ta(a.style,Ba)}):!za&&a.getAttribute("transform")&&b.delayedCall(.001,function(){a.removeAttribute("transform")}))),m},Qa=function(a){var
b,c,d=this.data,e=-d.rotation*K,f=e+d.skewX*K,g=1e5,h=(Math.cos(e)*d.scaleX*g|0)/g,i=(Math.sin(e)*d.scaleX*g|0)/g,j=(Math.sin(f)*-d.scaleY*g|0)/g,k=(Math.cos(f)*d.scaleY*g|0)/g,l=this.t.style,m=this.t.currentStyle;if(m){c=i,i=-j,j=-c,b=m.filter,l.filter="";var
n,o,q=this.t.offsetWidth,r=this.t.offsetHeight,s="absolute"!==m.position,t="progid:DXImageTransform.Microsoft.Matrix(M11="+h+",
M12="+i+", M21="+j+",
M22="+k,u=d.x+q*d.xPercent/100,v=d.y+r*d.yPercent/100;if(null!=d.ox&&(n=(d.oxp?q*d.ox*.01:d.ox)-q/2,o=(d.oyp?r*d.oy*.01:d.oy)-r/2,u+=n-(n*h+o*i),v+=o-(n*j+o*k)),s?(n=q/2,o=r/2,t+=",
Dx="+(n-(n*h+o*i)+u)+",
Dy="+(o-(n*j+o*k)+v)+")"):t+=", sizingMethod='auto
expand')",-1!==b.indexOf("DXImageTransform.Microsoft.Matrix(")?l.filter=b.replace(H,t):l.filter=t+"
"+b,(0===a||1===a)&&1===h&&0===i&&0===j&&1===k&&(s&&-1===t.indexOf("Dx=0,
Dy=0")||x.test(b)&&100!==parseFloat(RegExp.$1)||-1===b.indexOf(b.indexOf("Alpha"))&&l.removeAttribute("filter")),!s){var
y,z,A,B=8>p?1:-1;for(n=d.ieOffsetX||0,o=d.ieOffsetY||0,d.ieOffsetX=Math.round((q-((0>h?-h:h)*q+(0>i?-i:i)*r))/2+u),d.ieOffsetY=Math.round((r-((0>k?-k:k)*r+(0>j?-j:j)*q))/2+v),va=0;4>va;va++)z=ea[va],y=m[z],c=-1!==y.indexOf("px")?parseFloat(y):_(this.t,z,parseFloat(y),y.replace(w,""))||0,A=c!==d[z]?2>va?-d.ieOffsetX:-d.ieOffsetY:2>va?n-d.ieOffsetX:o-d.ieOffsetY,l[z]=(d[z]=Math.round(c-A*(0===va||2===va?1:B)))+"px"}}},Ra=R.set3DTransformRatio=R.setTransformRatio=function(a){var
b,c,d,e,f,g,h,i,j,k,l,m,o,p,q,r,s,t,u,v,w,x,y,z=this.data,A=this.t.style,B=z.rotation,C=z.rotationX,D=z.rotationY,E=z.scaleX,F=z.scaleY,G=z.scaleZ,H=z.x,I=z.y,J=z.z,L=z.svg,M=z.perspective,N=z.force3D;if(((1===a||0===a)&&"auto"===N&&(this.tween._totalTime===this.tween._totalDuration||!this.tween._totalTime)||!N)&&!J&&!M&&!D&&!C&&1===G||za&&L||!Ea)return
void(B||z.skewX||L?(B*=K,x=z.skewX*K,y=1e5,b=Math.cos(B)*E,e=Math.sin(B)*E,c=Math.sin(B-x)*-F,f=Math.cos(B-x)*F,x&&"simple"===z.skewType&&(s=Math.tan(x-z.skewY*K),s=Math.sqrt(1+s*s),c*=s,f*=s,z.skewY&&(s=Math.tan(z.skewY*K),s=Math.sqrt(1+s*s),b*=s,e*=s)),L&&(H+=z.xOrigin-(z.xOrigin*b+z.yOrigin*c)+z.xOffset,I+=z.yOrigin-(z.xOrigin*e+z.yOrigin*f)+z.yOffset,za&&(z.xPercent||z.yPercent)&&(p=this.t.getBBox(),H+=.01*z.xPercent*p.width,I+=.01*z.yPercent*p.height),p=1e-6,p>H&&H>-p&&(H=0),p>I&&I>-p&&(I=0)),u=(b*y|0)/y+","+(e*y|0)/y+","+(c*y|0)/y+","+(f*y|0)/y+","+H+","+I+")",L&&za?this.t.setAttribute("transform","matrix("+u):A[Ba]=(z.xPercent||z.yPercent?"translate("+z.xPercent+"%,"+z.yPercent+"%)
matrix(":"matrix(")+u):A[Ba]=(z.xPercent||z.yPercent?"translate("+z.xPercent+"%,"+z.yPercent+"%)
matrix(":"matrix(")+E+",0,0,"+F+","+H+","+I+")");if(n&&(p=1e-4,p>E&&E>-p&&(E=G=2e-5),p>F&&F>-p&&(F=G=2e-5),!M||z.z||z.rotationX||z.rotationY||(M=0)),B||z.skewX)B*=K,q=b=Math.cos(B),r=e=Math.sin(B),z.skewX&&(B-=z.skewX*K,q=Math.cos(B),r=Math.sin(B),"simple"===z.skewType&&(s=Math.tan((z.skewX-z.skewY)*K),s=Math.sqrt(1+s*s),q*=s,r*=s,z.skewY&&(s=Math.tan(z.skewY*K),s=Math.sqrt(1+s*s),b*=s,e*=s))),c=-r,f=q;else{if(!(D||C||1!==G||M||L))return
void(A[Ba]=(z.xPercent||z.yPercent?"translate("+z.xPercent+"%,"+z.yPercent+"%)
translate3d(":"translate3d(")+H+"px,"+I+"px,"+J+"px)"+(1!==E||1!==F?"
scale("+E+","+F+")":""));b=f=1,c=e=0}j=1,d=g=h=i=k=l=0,m=M?-1/M:0,o=z.zOrigin,p=1e-6,v=",",w="0",B=D*K,B&&(q=Math.cos(B),r=Math.sin(B),h=-r,k=m*-r,d=b*r,g=e*r,j=q,m*=q,b*=q,e*=q),B=C*K,B&&(q=Math.cos(B),r=Math.sin(B),s=c*q+d*r,t=f*q+g*r,i=j*r,l=m*r,d=c*-r+d*q,g=f*-r+g*q,j*=q,m*=q,c=s,f=t),1!==G&&(d*=G,g*=G,j*=G,m*=G),1!==F&&(c*=F,f*=F,i*=F,l*=F),1!==E&&(b*=E,e*=E,h*=E,k*=E),(o||L)&&(o&&(H+=d*-o,I+=g*-o,J+=j*-o+o),L&&(H+=z.xOrigin-(z.xOrigin*b+z.yOrigin*c)+z.xOffset,I+=z.yOrigin-(z.xOrigin*e+z.yOrigin*f)+z.yOffset),p>H&&H>-p&&(H=w),p>I&&I>-p&&(I=w),p>J&&J>-p&&(J=0)),u=z.xPercent||z.yPercent?"translate("+z.xPercent+"%,"+z.yPercent+"%)
matrix3d(":"matrix3d(",u+=(p>b&&b>-p?w:b)+v+(p>e&&e>-p?w:e)+v+(p>h&&h>-p?w:h),u+=v+(p>k&&k>-p?w:k)+v+(p>c&&c>-p?w:c)+v+(p>f&&f>-p?w:f),C||D||1!==G?(u+=v+(p>i&&i>-p?w:i)+v+(p>l&&l>-p?w:l)+v+(p>d&&d>-p?w:d),u+=v+(p>g&&g>-p?w:g)+v+(p>j&&j>-p?w:j)+v+(p>m&&m>-p?w:m)+v):u+=",0,0,0,0,1,0,",u+=H+v+I+v+J+v+(M?1+-J/M:1)+")",A[Ba]=u};j=Fa.prototype,j.x=j.y=j.z=j.skewX=j.skewY=j.rotation=j.rotationX=j.rotationY=j.zOrigin=j.xPercent=j.yPercent=j.xOffset=j.yOffset=0,j.scaleX=j.scaleY=j.scaleZ=1,xa("transform,scale,scaleX,scaleY,scaleZ,x,y,z,rotation,rotationX,rotationY,rotationZ,skewX,skewY,shortRotation,shortRotationX,shortRotationY,shortRotationZ,transformOrigin,svgOrigin,transformPerspective,directionalRotation,parseTransform,force3D,skewType,xPercent,yPercent,smoothOrigin",{parser:function(a,b,c,d,f,h,i){if(d._lastParsedTransform===i)return
f;d._lastParsedTransform=i;var j;"function"==typeof
i[c]&&(j=i[c],i[c]=b);var
k,l,m,n,o,p,s,t,u,v=a._gsTransform,w=a.style,x=1e-6,y=Aa.length,z=i,A={},B="transformOrigin",C=Pa(a,e,!0,z.parseTransform),D=z.transform&&("function"==typeof
z.transform?z.transform(r,q):z.transform);if(d._transform=C,D&&"string"==typeof
D&&Ba)l=P.style,l[Ba]=D,l.display="block",l.position="absolute",N.body.appendChild(P),k=Pa(P,null,!1),C.svg&&(p=C.xOrigin,s=C.yOrigin,k.x-=C.xOffset,k.y-=C.yOffset,(z.transformOrigin||z.svgOrigin)&&(D={},Ka(a,ga(z.transformOrigin),D,z.svgOrigin,z.smoothOrigin,!0),p=D.xOrigin,s=D.yOrigin,k.x-=D.xOffset-C.xOffset,k.y-=D.yOffset-C.yOffset),(p||s)&&(t=Oa(P,!0),k.x-=p-(p*t[0]+s*t[2]),k.y-=s-(p*t[1]+s*t[3]))),N.body.removeChild(P),k.perspective||(k.perspective=C.perspective),null!=z.xPercent&&(k.xPercent=ia(z.xPercent,C.xPercent)),null!=z.yPercent&&(k.yPercent=ia(z.yPercent,C.yPercent));else
if("object"==typeof
z){if(k={scaleX:ia(null!=z.scaleX?z.scaleX:z.scale,C.scaleX),scaleY:ia(null!=z.scaleY?z.scaleY:z.scale,C.scaleY),scaleZ:ia(z.scaleZ,C.scaleZ),x:ia(z.x,C.x),y:ia(z.y,C.y),z:ia(z.z,C.z),xPercent:ia(z.xPercent,C.xPercent),yPercent:ia(z.yPercent,C.yPercent),perspective:ia(z.transformPerspective,C.perspective)},o=z.directionalRotation,null!=o)if("object"==typeof
o)for(l in o)z[l]=o[l];else z.rotation=o;"string"==typeof
z.x&&-1!==z.x.indexOf("%")&&(k.x=0,k.xPercent=ia(z.x,C.xPercent)),"string"==typeof
z.y&&-1!==z.y.indexOf("%")&&(k.y=0,k.yPercent=ia(z.y,C.yPercent)),k.rotation=ja("rotation"in
z?z.rotation:"shortRotation"in
z?z.shortRotation+"_short":"rotationZ"in
z?z.rotationZ:C.rotation-C.skewY,C.rotation-C.skewY,"rotation",A),Ea&&(k.rotationX=ja("rotationX"in
z?z.rotationX:"shortRotationX"in
z?z.shortRotationX+"_short":C.rotationX||0,C.rotationX,"rotationX",A),k.rotationY=ja("rotationY"in
z?z.rotationY:"shortRotationY"in
z?z.shortRotationY+"_short":C.rotationY||0,C.rotationY,"rotationY",A)),k.skewX=ja(z.skewX,C.skewX-C.skewY),(k.skewY=ja(z.skewY,C.skewY))&&(k.skewX+=k.skewY,k.rotation+=k.skewY)}for(Ea&&null!=z.force3D&&(C.force3D=z.force3D,n=!0),C.skewType=z.skewType||C.skewType||g.defaultSkewType,m=C.force3D||C.z||C.rotationX||C.rotationY||k.z||k.rotationX||k.rotationY||k.perspective,m||null==z.scale||(k.scaleZ=1);--y>-1;)u=Aa[y],D=k[u]-C[u],(D>x||-x>D||null!=z[u]||null!=M[u])&&(n=!0,
f=new sa(C,u,C[u],D,f),u in
A&&(f.e=A[u]),f.xs0=0,f.plugin=h,d._overwriteProps.push(f.n));return
D=z.transformOrigin,C.svg&&(D||z.svgOrigin)&&(p=C.xOffset,s=C.yOffset,Ka(a,ga(D),k,z.svgOrigin,z.smoothOrigin),f=ta(C,"xOrigin",(v?C:k).xOrigin,k.xOrigin,f,B),f=ta(C,"yOrigin",(v?C:k).yOrigin,k.yOrigin,f,B),(p!==C.xOffset||s!==C.yOffset)&&(f=ta(C,"xOffset",v?p:C.xOffset,C.xOffset,f,B),f=ta(C,"yOffset",v?s:C.yOffset,C.yOffset,f,B)),D=za?null:"0px
0px"),(D||Ea&&m&&C.zOrigin)&&(Ba?(n=!0,u=Da,D=(D||$(a,u,e,!1,"50%
50%"))+"",f=new
sa(w,u,0,0,f,-1,B),f.b=w[u],f.plugin=h,Ea?(l=C.zOrigin,D=D.split("
"),C.zOrigin=(D.length>2&&(0===l||"0px"!==D[2])?parseFloat(D[2]):l)||0,f.xs0=f.e=D[0]+"
"+(D[1]||"50%")+" 0px",f=new
sa(C,"zOrigin",0,0,f,-1,f.n),f.b=l,f.xs0=f.e=C.zOrigin):f.xs0=f.e=D):ga(D+"",C)),n&&(d._transformType=C.svg&&za||!m&&3!==this._transformType?2:3),j&&(i[c]=j),f},prefix:!0}),xa("boxShadow",{defaultValue:"0px
0px 0px 0px
#999",prefix:!0,color:!0,multi:!0,keyword:"inset"}),xa("borderRadius",{defaultValue:"0px",parser:function(a,b,c,f,g,h){b=this.format(b);var
i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y=["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"],z=a.style;for(q=parseFloat(a.offsetWidth),r=parseFloat(a.offsetHeight),i=b.split("
"),j=0;j<y.length;j++)this.p.indexOf("border")&&(y[j]=Y(y[j])),m=l=$(a,y[j],e,!1,"0px"),-1!==m.indexOf("
")&&(l=m.split("
"),m=l[0],l=l[1]),n=k=i[j],o=parseFloat(m),t=m.substr((o+"").length),u="="===n.charAt(1),u?(p=parseInt(n.charAt(0)+"1",10),n=n.substr(2),p*=parseFloat(n),s=n.substr((p+"").length-(0>p?1:0))||""):(p=parseFloat(n),s=n.substr((p+"").length)),""===s&&(s=d[c]||t),s!==t&&(v=_(a,"borderLeft",o,t),w=_(a,"borderTop",o,t),"%"===s?(m=v/q*100+"%",l=w/r*100+"%"):"em"===s?(x=_(a,"borderLeft",1,"em"),m=v/x+"em",l=w/x+"em"):(m=v+"px",l=w+"px"),u&&(n=parseFloat(m)+p+s,k=parseFloat(l)+p+s)),g=ua(z,y[j],m+"
"+l,n+" "+k,!1,"0px",g);return
g},prefix:!0,formatter:pa("0px 0px 0px
0px",!1,!0)}),xa("borderBottomLeftRadius,borderBottomRightRadius,borderTopLeftRadius,borderTopRightRadius",{defaultValue:"0px",parser:function(a,b,c,d,f,g){return
ua(a.style,c,this.format($(a,c,e,!1,"0px
0px")),this.format(b),!1,"0px",f)},prefix:!0,formatter:pa("0px
0px",!1,!0)}),xa("backgroundPosition",{defaultValue:"0
0",parser:function(a,b,c,d,f,g){var
h,i,j,k,l,m,n="background-position",o=e||Z(a,null),q=this.format((o?p?o.getPropertyValue(n+"-x")+"
"+o.getPropertyValue(n+"-y"):o.getPropertyValue(n):a.currentStyle.backgroundPositionX+"
"+a.currentStyle.backgroundPositionY)||"0
0"),r=this.format(b);if(-1!==q.indexOf("%")!=(-1!==r.indexOf("%"))&&r.split(",").length<2&&(m=$(a,"backgroundImage").replace(D,""),m&&"none"!==m)){for(h=q.split("
"),i=r.split("
"),Q.setAttribute("src",m),j=2;--j>-1;)q=h[j],k=-1!==q.indexOf("%"),k!==(-1!==i[j].indexOf("%"))&&(l=0===j?a.offsetWidth-Q.width:a.offsetHeight-Q.height,h[j]=k?parseFloat(q)/100*l+"px":parseFloat(q)/l*100+"%");q=h.join("
")}return
this.parseComplex(a.style,q,r,f,g)},formatter:ga}),xa("backgroundSize",{defaultValue:"0
0",formatter:function(a){return
a+="",ga(-1===a.indexOf(" ")?a+"
"+a:a)}}),xa("perspective",{defaultValue:"0px",prefix:!0}),xa("perspectiveOrigin",{defaultValue:"50%
50%",prefix:!0}),xa("transformStyle",{prefix:!0}),xa("backfaceVisibility",{prefix:!0}),xa("userSelect",{prefix:!0}),xa("margin",{parser:qa("marginTop,marginRight,marginBottom,marginLeft")}),xa("padding",{parser:qa("paddingTop,paddingRight,paddingBottom,paddingLeft")}),xa("clip",{defaultValue:"rect(0px,0px,0px,0px)",parser:function(a,b,c,d,f,g){var
h,i,j;return 9>p?(i=a.currentStyle,j=8>p?"
":",",h="rect("+i.clipTop+j+i.clipRight+j+i.clipBottom+j+i.clipLeft+")",b=this.format(b).split(",").join(j)):(h=this.format($(a,this.p,e,!1,this.dflt)),b=this.format(b)),this.parseComplex(a.style,h,b,f,g)}}),xa("textShadow",{defaultValue:"0px
0px 0px
#999",color:!0,multi:!0}),xa("autoRound,strictUnits",{parser:function(a,b,c,d,e){return
e}}),xa("border",{defaultValue:"0px solid
#000",parser:function(a,b,c,d,f,g){var
h=$(a,"borderTopWidth",e,!1,"0px"),i=this.format(b).split("
"),j=i[0].replace(w,"");return"px"!==j&&(h=parseFloat(h)/_(a,"borderTopWidth",1,j)+j),this.parseComplex(a.style,this.format(h+"
"+$(a,"borderTopStyle",e,!1,"solid")+"
"+$(a,"borderTopColor",e,!1,"#000")),i.join("
"),f,g)},color:!0,formatter:function(a){var b=a.split("
");return b[0]+" "+(b[1]||"solid")+"
"+(a.match(oa)||["#000"])[0]}}),xa("borderWidth",{parser:qa("borderTopWidth,borderRightWidth,borderBottomWidth,borderLeftWidth")}),xa("float,cssFloat,styleFloat",{parser:function(a,b,c,d,e,f){var
g=a.style,h="cssFloat"in
g?"cssFloat":"styleFloat";return new
sa(g,h,0,0,e,-1,c,!1,0,g[h],b)}});var Sa=function(a){var
b,c=this.t,d=c.filter||$(this.data,"filter")||"",e=this.s+this.c*a|0;100===e&&(-1===d.indexOf("atrix(")&&-1===d.indexOf("radient(")&&-1===d.indexOf("oader(")?(c.removeAttribute("filter"),b=!$(this.data,"filter")):(c.filter=d.replace(z,""),b=!0)),b||(this.xn1&&(c.filter=d=d||"alpha(opacity="+e+")"),-1===d.indexOf("pacity")?0===e&&this.xn1||(c.filter=d+"
alpha(opacity="+e+")"):c.filter=d.replace(x,"opacity="+e))};xa("opacity,alpha,autoAlpha",{defaultValue:"1",parser:function(a,b,c,d,f,g){var
h=parseFloat($(a,"opacity",e,!1,"1")),i=a.style,j="autoAlpha"===c;return"string"==typeof
b&&"="===b.charAt(1)&&(b=("-"===b.charAt(0)?-1:1)*parseFloat(b.substr(2))+h),j&&1===h&&"hidden"===$(a,"visibility",e)&&0!==b&&(h=0),T?f=new
sa(i,"opacity",h,b-h,f):(f=new
sa(i,"opacity",100*h,100*(b-h),f),f.xn1=j?1:0,i.zoom=1,f.type=2,f.b="alpha(opacity="+f.s+")",f.e="alpha(opacity="+(f.s+f.c)+")",f.data=a,f.plugin=g,f.setRatio=Sa),j&&(f=new
sa(i,"visibility",0,0,f,-1,null,!1,0,0!==h?"inherit":"hidden",0===b?"hidden":"inherit"),f.xs0="inherit",d._overwriteProps.push(f.n),d._overwriteProps.push(c)),f}});var
Ta=function(a,b){b&&(a.removeProperty?(("ms"===b.substr(0,2)||"webkit"===b.substr(0,6))&&(b="-"+b),a.removeProperty(b.replace(B,"-$1").toLowerCase())):a.removeAttribute(b))},Ua=function(a){if(this.t._gsClassPT=this,1===a||0===a){this.t.setAttribute("class",0===a?this.b:this.e);for(var
b=this.data,c=this.t.style;b;)b.v?c[b.p]=b.v:Ta(c,b.p),b=b._next;1===a&&this.t._gsClassPT===this&&(this.t._gsClassPT=null)}else
this.t.getAttribute("class")!==this.e&&this.t.setAttribute("class",this.e)};xa("className",{parser:function(a,b,d,f,g,h,i){var
j,k,l,m,n,o=a.getAttribute("class")||"",p=a.style.cssText;if(g=f._classNamePT=new
sa(a,d,0,0,g,2),g.setRatio=Ua,g.pr=-11,c=!0,g.b=o,k=ba(a,e),l=a._gsClassPT){for(m={},n=l.data;n;)m[n.p]=1,n=n._next;l.setRatio(1)}return
a._gsClassPT=g,g.e="="!==b.charAt(1)?b:o.replace(new
RegExp("(?:\\s|^)"+b.substr(2)+"(?![\\w-])"),"")+("+"===b.charAt(0)?"
"+b.substr(2):""),a.setAttribute("class",g.e),j=ca(a,k,ba(a),i,m),a.setAttribute("class",o),g.data=j.firstMPT,a.style.cssText=p,g=g.xfirst=f.parse(a,j.difs,g,h)}});var
Va=function(a){if((1===a||0===a)&&this.data._totalTime===this.data._totalDuration&&"isFromStart"!==this.data.data){var
b,c,d,e,f,g=this.t.style,h=i.transform.parse;if("all"===this.e)g.cssText="",e=!0;else
for(b=this.e.split("
").join("").split(","),d=b.length;--d>-1;)c=b[d],i[c]&&(i[c].parse===h?e=!0:c="transformOrigin"===c?Da:i[c].p),Ta(g,c);e&&(Ta(g,Ba),f=this.t._gsTransform,f&&(f.svg&&(this.t.removeAttribute("data-svg-origin"),this.t.removeAttribute("transform")),delete
this.t._gsTransform))}};for(xa("clearProps",{parser:function(a,b,d,e,f){return
f=new
sa(a,d,0,0,f,2),f.setRatio=Va,f.e=b,f.pr=-10,f.data=e._tween,c=!0,f}}),j="bezier,throwProps,physicsProps,physics2D".split(","),va=j.length;va--;)ya(j[va]);j=g.prototype,j._firstPT=j._lastParsedTransform=j._transform=null,j._onInitTween=function(a,b,h,j){if(!a.nodeType)return!1;this._target=q=a,this._tween=h,this._vars=b,r=j,k=b.autoRound,c=!1,d=b.suffixMap||g.suffixMap,e=Z(a,""),f=this._overwriteProps;var
n,p,s,t,u,v,w,x,z,A=a.style;if(l&&""===A.zIndex&&(n=$(a,"zIndex",e),("auto"===n||""===n)&&this._addLazySet(A,"zIndex",0)),"string"==typeof
b&&(t=A.cssText,n=ba(a,e),A.cssText=t+";"+b,n=ca(a,n,ba(a)).difs,!T&&y.test(b)&&(n.opacity=parseFloat(RegExp.$1)),b=n,A.cssText=t),b.className?this._firstPT=p=i.className.parse(a,b.className,"className",this,null,null,b):this._firstPT=p=this.parse(a,b,null),this._transformType){for(z=3===this._transformType,Ba?m&&(l=!0,""===A.zIndex&&(w=$(a,"zIndex",e),("auto"===w||""===w)&&this._addLazySet(A,"zIndex",0)),o&&this._addLazySet(A,"WebkitBackfaceVisibility",this._vars.WebkitBackfaceVisibility||(z?"visible":"hidden"))):A.zoom=1,s=p;s&&s._next;)s=s._next;x=new
sa(a,"transform",0,0,null,2),this._linkCSSP(x,null,s),x.setRatio=Ba?Ra:Qa,x.data=this._transform||Pa(a,e,!0),x.tween=h,x.pr=-1,f.pop()}if(c){for(;p;){for(v=p._next,s=t;s&&s.pr>p.pr;)s=s._next;(p._prev=s?s._prev:u)?p._prev._next=p:t=p,(p._next=s)?s._prev=p:u=p,p=v}this._firstPT=t}return!0},j.parse=function(a,b,c,f){var
g,h,j,l,m,n,o,p,s,t,u=a.style;for(g in
b)n=b[g],"function"==typeof
n&&(n=n(r,q)),h=i[g],h?c=h.parse(a,n,g,this,c,f,b):(m=$(a,g,e)+"",s="string"==typeof
n,"color"===g||"fill"===g||"stroke"===g||-1!==g.indexOf("Color")||s&&A.test(n)?(s||(n=ma(n),n=(n.length>3?"rgba(":"rgb(")+n.join(",")+")"),c=ua(u,g,m,n,!0,"transparent",c,0,f)):s&&J.test(n)?c=ua(u,g,m,n,!0,null,c,0,f):(j=parseFloat(m),o=j||0===j?m.substr((j+"").length):"",(""===m||"auto"===m)&&("width"===g||"height"===g?(j=fa(a,g,e),o="px"):"left"===g||"top"===g?(j=aa(a,g,e),o="px"):(j="opacity"!==g?0:1,o="")),t=s&&"="===n.charAt(1),t?(l=parseInt(n.charAt(0)+"1",10),n=n.substr(2),l*=parseFloat(n),p=n.replace(w,"")):(l=parseFloat(n),p=s?n.replace(w,""):""),""===p&&(p=g
in
d?d[g]:o),n=l||0===l?(t?l+j:l)+p:b[g],o!==p&&""!==p&&(l||0===l)&&j&&(j=_(a,g,j,o),"%"===p?(j/=_(a,g,100,"%")/100,b.strictUnits!==!0&&(m=j+"%")):"em"===p||"rem"===p||"vw"===p||"vh"===p?j/=_(a,g,1,p):"px"!==p&&(l=_(a,g,l,p),p="px"),t&&(l||0===l)&&(n=l+j+p)),t&&(l+=j),!j&&0!==j||!l&&0!==l?void
0!==u[g]&&(n||n+""!="NaN"&&null!=n)?(c=new
sa(u,g,l||j||0,0,c,-1,g,!1,0,m,n),c.xs0="none"!==n||"display"!==g&&-1===g.indexOf("Style")?n:m):V("invalid
"+g+" tween value: "+b[g]):(c=new
sa(u,g,j,l-j,c,0,g,k!==!1&&("px"===p||"zIndex"===g),0,m,n),c.xs0=p))),f&&c&&!c.plugin&&(c.plugin=f);return
c},j.setRatio=function(a){var
b,c,d,e=this._firstPT,f=1e-6;if(1!==a||this._tween._time!==this._tween._duration&&0!==this._tween._time)if(a||this._tween._time!==this._tween._duration&&0!==this._tween._time||this._tween._rawPrevTime===-1e-6)for(;e;){if(b=e.c*a+e.s,e.r?b=Math.round(b):f>b&&b>-f&&(b=0),e.type)if(1===e.type)if(d=e.l,2===d)e.t[e.p]=e.xs0+b+e.xs1+e.xn1+e.xs2;else
if(3===d)e.t[e.p]=e.xs0+b+e.xs1+e.xn1+e.xs2+e.xn2+e.xs3;else
if(4===d)e.t[e.p]=e.xs0+b+e.xs1+e.xn1+e.xs2+e.xn2+e.xs3+e.xn3+e.xs4;else
if(5===d)e.t[e.p]=e.xs0+b+e.xs1+e.xn1+e.xs2+e.xn2+e.xs3+e.xn3+e.xs4+e.xn4+e.xs5;else{for(c=e.xs0+b+e.xs1,d=1;d<e.l;d++)c+=e["xn"+d]+e["xs"+(d+1)];e.t[e.p]=c}else-1===e.type?e.t[e.p]=e.xs0:e.setRatio&&e.setRatio(a);else
e.t[e.p]=b+e.xs0;e=e._next}else
for(;e;)2!==e.type?e.t[e.p]=e.b:e.setRatio(a),e=e._next;else
for(;e;){if(2!==e.type)if(e.r&&-1!==e.type)if(b=Math.round(e.s+e.c),e.type){if(1===e.type){for(d=e.l,c=e.xs0+b+e.xs1,d=1;d<e.l;d++)c+=e["xn"+d]+e["xs"+(d+1)];e.t[e.p]=c}}else
e.t[e.p]=b+e.xs0;else e.t[e.p]=e.e;else
e.setRatio(a);e=e._next}},j._enableTransforms=function(a){this._transform=this._transform||Pa(this._target,e,!0),this._transformType=this._transform.svg&&za||!a&&3!==this._transformType?2:3};var
Wa=function(a){this.t[this.p]=this.e,this.data._linkCSSP(this,this._next,null,!0)};j._addLazySet=function(a,b,c){var
d=this._firstPT=new
sa(a,b,0,0,this._firstPT,2);d.e=c,d.setRatio=Wa,d.data=this},j._linkCSSP=function(a,b,c,d){return
a&&(b&&(b._prev=a),a._next&&(a._next._prev=a._prev),a._prev?a._prev._next=a._next:this._firstPT===a&&(this._firstPT=a._next,d=!0),c?c._next=a:d||null!==this._firstPT||(this._firstPT=a),a._next=b,a._prev=c),a},j._mod=function(a){for(var
b=this._firstPT;b;)"function"==typeof
a[b.p]&&a[b.p]===Math.round&&(b.r=1),b=b._next},j._kill=function(b){var
c,d,e,f=b;if(b.autoAlpha||b.alpha){f={};for(d in
b)f[d]=b[d];f.opacity=1,f.autoAlpha&&(f.visibility=1)}for(b.className&&(c=this._classNamePT)&&(e=c.xfirst,e&&e._prev?this._linkCSSP(e._prev,c._next,e._prev._prev):e===this._firstPT&&(this._firstPT=c._next),c._next&&this._linkCSSP(c._next,c._next._next,e._prev),this._classNamePT=null),c=this._firstPT;c;)c.plugin&&c.plugin!==d&&c.plugin._kill&&(c.plugin._kill(b),d=c.plugin),c=c._next;return
a.prototype._kill.call(this,f)};var Xa=function(a,b,c){var
d,e,f,g;if(a.slice)for(e=a.length;--e>-1;)Xa(a[e],b,c);else
for(d=a.childNodes,e=d.length;--e>-1;)f=d[e],g=f.type,f.style&&(b.push(ba(f)),c&&c.push(f)),1!==g&&9!==g&&11!==g||!f.childNodes.length||Xa(f,b,c)};return
g.cascadeTo=function(a,c,d){var
e,f,g,h,i=b.to(a,c,d),j=[i],k=[],l=[],m=[],n=b._internals.reservedProps;for(a=i._targets||i.target,Xa(a,k,m),i.render(c,!0,!0),Xa(a,l),i.render(0,!0,!0),i._enabled(!0),e=m.length;--e>-1;)if(f=ca(m[e],k[e],l[e]),f.firstMPT){f=f.difs;for(g
in d)n[g]&&(f[g]=d[g]);h={};for(g in
f)h[g]=k[e][g];j.push(b.fromTo(m[e],c,h,f))}return
j},a.activate([g]),g},!0),function(){var
a=_gsScope._gsDefine.plugin({propName:"roundProps",version:"1.6.0",priority:-1,API:2,init:function(a,b,c){return
this._tween=c,!0}}),b=function(a){for(;a;)a.f||a.blob||(a.m=Math.round),a=a._next},c=a.prototype;c._onInitAllProps=function(){for(var
a,c,d,e=this._tween,f=e.vars.roundProps.join?e.vars.roundProps:e.vars.roundProps.split(","),g=f.length,h={},i=e._propLookup.roundProps;--g>-1;)h[f[g]]=Math.round;for(g=f.length;--g>-1;)for(a=f[g],c=e._firstPT;c;)d=c._next,c.pg?c.t._mod(h):c.n===a&&(2===c.f&&c.t?b(c.t._firstPT):(this._add(c.t,a,c.s,c.c),d&&(d._prev=c._prev),c._prev?c._prev._next=d:e._firstPT===c&&(e._firstPT=d),c._next=c._prev=null,e._propLookup[a]=i)),c=d;return!1},c._add=function(a,b,c,d){this._addTween(a,b,c,c+d,b,Math.round),this._overwriteProps.push(b)}}(),function(){_gsScope._gsDefine.plugin({propName:"attr",API:2,version:"0.6.0",init:function(a,b,c,d){var
e,f;if("function"!=typeof a.setAttribute)return!1;for(e in
b)f=b[e],"function"==typeof
f&&(f=f(d,a)),this._addTween(a,"setAttribute",a.getAttribute(e)+"",f+"",e,!1,e),this._overwriteProps.push(e);return!0}})}(),_gsScope._gsDefine.plugin({propName:"directionalRotation",version:"0.3.0",API:2,init:function(a,b,c,d){"object"!=typeof
b&&(b={rotation:b}),this.finals={};var
e,f,g,h,i,j,k=b.useRadians===!0?2*Math.PI:360,l=1e-6;for(e in
b)"useRadians"!==e&&(h=b[e],"function"==typeof
h&&(h=h(d,a)),j=(h+"").split("_"),f=j[0],g=parseFloat("function"!=typeof
a[e]?a[e]:a[e.indexOf("set")||"function"!=typeof
a["get"+e.substr(3)]?e:"get"+e.substr(3)]()),h=this.finals[e]="string"==typeof
f&&"="===f.charAt(1)?g+parseInt(f.charAt(0)+"1",10)*Number(f.substr(2)):Number(f)||0,i=h-g,j.length&&(f=j.join("_"),-1!==f.indexOf("short")&&(i%=k,i!==i%(k/2)&&(i=0>i?i+k:i-k)),-1!==f.indexOf("_cw")&&0>i?i=(i+9999999999*k)%k-(i/k|0)*k:-1!==f.indexOf("ccw")&&i>0&&(i=(i-9999999999*k)%k-(i/k|0)*k)),(i>l||-l>i)&&(this._addTween(a,e,g,g+i,e),this._overwriteProps.push(e)));return!0},set:function(a){var
b;if(1!==a)this._super.setRatio.call(this,a);else
for(b=this._firstPT;b;)b.f?b.t[b.p](this.finals[b.p]):b.t[b.p]=this.finals[b.p],b=b._next}})._autoCSS=!0,_gsScope._gsDefine("easing.Back",["easing.Ease"],function(a){var
b,c,d,e=_gsScope.GreenSockGlobals||_gsScope,f=e.com.greensock,g=2*Math.PI,h=Math.PI/2,i=f._class,j=function(b,c){var
d=i("easing."+b,function(){},!0),e=d.prototype=new a;return
e.constructor=d,e.getRatio=c,d},k=a.register||function(){},l=function(a,b,c,d,e){var
f=i("easing."+a,{easeOut:new b,easeIn:new c,easeInOut:new
d},!0);return
k(f,a),f},m=function(a,b,c){this.t=a,this.v=b,c&&(this.next=c,c.prev=this,this.c=c.v-b,this.gap=c.t-a)},n=function(b,c){var
d=i("easing."+b,function(a){this._p1=a||0===a?a:1.70158,this._p2=1.525*this._p1},!0),e=d.prototype=new
a;return e.constructor=d,e.getRatio=c,e.config=function(a){return new
d(a)},d},o=l("Back",n("BackOut",function(a){return(a-=1)*a*((this._p1+1)*a+this._p1)+1}),n("BackIn",function(a){return
a*a*((this._p1+1)*a-this._p1)}),n("BackInOut",function(a){return(a*=2)<1?.5*a*a*((this._p2+1)*a-this._p2):.5*((a-=2)*a*((this._p2+1)*a+this._p2)+2)})),p=i("easing.SlowMo",function(a,b,c){b=b||0===b?b:.7,null==a?a=.7:a>1&&(a=1),this._p=1!==a?b:0,this._p1=(1-a)/2,this._p2=a,this._p3=this._p1+this._p2,this._calcEnd=c===!0},!0),q=p.prototype=new
a;return q.constructor=p,q.getRatio=function(a){var
b=a+(.5-a)*this._p;return
a<this._p1?this._calcEnd?1-(a=1-a/this._p1)*a:b-(a=1-a/this._p1)*a*a*a*b:a>this._p3?this._calcEnd?1-(a=(a-this._p3)/this._p1)*a:b+(a-b)*(a=(a-this._p3)/this._p1)*a*a*a:this._calcEnd?1:b},p.ease=new
p(.7,.7),q.config=p.config=function(a,b,c){return new
p(a,b,c)},b=i("easing.SteppedEase",function(a){a=a||1,this._p1=1/a,this._p2=a+1},!0),q=b.prototype=new
a,q.constructor=b,q.getRatio=function(a){return
0>a?a=0:a>=1&&(a=.999999999),(this._p2*a>>0)*this._p1},q.config=b.config=function(a){return
new b(a)},c=i("easing.RoughEase",function(b){b=b||{};for(var
c,d,e,f,g,h,i=b.taper||"none",j=[],k=0,l=0|(b.points||20),n=l,o=b.randomize!==!1,p=b.clamp===!0,q=b.template
instanceof a?b.template:null,r="number"==typeof
b.strength?.4*b.strength:.4;--n>-1;)c=o?Math.random():1/l*n,d=q?q.getRatio(c):c,"none"===i?e=r:"out"===i?(f=1-c,e=f*f*r):"in"===i?e=c*c*r:.5>c?(f=2*c,e=f*f*.5*r):(f=2*(1-c),e=f*f*.5*r),o?d+=Math.random()*e-.5*e:n%2?d+=.5*e:d-=.5*e,p&&(d>1?d=1:0>d&&(d=0)),j[k++]={x:c,y:d};for(j.sort(function(a,b){return
a.x-b.x}),h=new m(1,1,null),n=l;--n>-1;)g=j[n],h=new
m(g.x,g.y,h);this._prev=new m(0,0,0!==h.t?h:h.next)},!0),q=c.prototype=new
a,q.constructor=c,q.getRatio=function(a){var
b=this._prev;if(a>b.t){for(;b.next&&a>=b.t;)b=b.next;b=b.prev}else
for(;b.prev&&a<=b.t;)b=b.prev;return
this._prev=b,b.v+(a-b.t)/b.gap*b.c},q.config=function(a){return new
c(a)},c.ease=new
c,l("Bounce",j("BounceOut",function(a){return
1/2.75>a?7.5625*a*a:2/2.75>a?7.5625*(a-=1.5/2.75)*a+.75:2.5/2.75>a?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375}),j("BounceIn",function(a){return(a=1-a)<1/2.75?1-7.5625*a*a:2/2.75>a?1-(7.5625*(a-=1.5/2.75)*a+.75):2.5/2.75>a?1-(7.5625*(a-=2.25/2.75)*a+.9375):1-(7.5625*(a-=2.625/2.75)*a+.984375)}),j("BounceInOut",function(a){var
b=.5>a;return
a=b?1-2*a:2*a-1,a=1/2.75>a?7.5625*a*a:2/2.75>a?7.5625*(a-=1.5/2.75)*a+.75:2.5/2.75>a?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375,b?.5*(1-a):.5*a+.5})),l("Circ",j("CircOut",function(a){return
Math.sqrt(1-(a-=1)*a)}),j("CircIn",function(a){return-(Math.sqrt(1-a*a)-1)}),j("CircInOut",function(a){return(a*=2)<1?-.5*(Math.sqrt(1-a*a)-1):.5*(Math.sqrt(1-(a-=2)*a)+1)})),d=function(b,c,d){var
e=i("easing."+b,function(a,b){this._p1=a>=1?a:1,this._p2=(b||d)/(1>a?a:1),this._p3=this._p2/g*(Math.asin(1/this._p1)||0),this._p2=g/this._p2},!0),f=e.prototype=new
a;return f.constructor=e,f.getRatio=c,f.config=function(a,b){return new
e(a,b)},e},l("Elastic",d("ElasticOut",function(a){return
this._p1*Math.pow(2,-10*a)*Math.sin((a-this._p3)*this._p2)+1},.3),d("ElasticIn",function(a){return-(this._p1*Math.pow(2,10*(a-=1))*Math.sin((a-this._p3)*this._p2))},.3),d("ElasticInOut",function(a){return(a*=2)<1?-.5*(this._p1*Math.pow(2,10*(a-=1))*Math.sin((a-this._p3)*this._p2)):this._p1*Math.pow(2,-10*(a-=1))*Math.sin((a-this._p3)*this._p2)*.5+1},.45)),l("Expo",j("ExpoOut",function(a){return
1-Math.pow(2,-10*a)}),j("ExpoIn",function(a){return
Math.pow(2,10*(a-1))-.001}),j("ExpoInOut",function(a){return(a*=2)<1?.5*Math.pow(2,10*(a-1)):.5*(2-Math.pow(2,-10*(a-1)))})),l("Sine",j("SineOut",function(a){return
Math.sin(a*h)}),j("SineIn",function(a){return-Math.cos(a*h)+1}),j("SineInOut",function(a){return-.5*(Math.cos(Math.PI*a)-1)})),i("easing.EaseLookup",{find:function(b){return
a.map[b]}},!0),k(e.SlowMo,"SlowMo","ease,"),k(c,"RoughEase","ease,"),k(b,"SteppedEase","ease,"),o},!0)}),_gsScope._gsDefine&&_gsScope._gsQueue.pop()(),function(a,b){"use
strict";var
c={},d=a.GreenSockGlobals=a.GreenSockGlobals||a;if(!d.TweenLite){var
e,f,g,h,i,j=function(a){var
b,c=a.split("."),e=d;for(b=0;b<c.length;b++)e[c[b]]=e=e[c[b]]||{};return
e},k=j("com.greensock"),l=1e-10,m=function(a){var
b,c=[],d=a.length;for(b=0;b!==d;c.push(a[b++]));return
c},n=function(){},o=function(){var
a=Object.prototype.toString,b=a.call([]);return function(c){return
null!=c&&(c instanceof Array||"object"==typeof
c&&!!c.push&&a.call(c)===b)}}(),p={},q=function(e,f,g,h){this.sc=p[e]?p[e].sc:[],p[e]=this,this.gsClass=null,this.func=g;var
i=[];this.check=function(k){for(var
l,m,n,o,r,s=f.length,t=s;--s>-1;)(l=p[f[s]]||new
q(f[s],[])).gsClass?(i[s]=l.gsClass,t--):k&&l.sc.push(this);if(0===t&&g){if(m=("com.greensock."+e).split("."),n=m.pop(),o=j(m.join("."))[n]=this.gsClass=g.apply(g,i),h)if(d[n]=c[n]=o,r="undefined"!=typeof
module&&module.exports,!r&&"function"==typeof
define&&define.amd)define((a.GreenSockAMDPath?a.GreenSockAMDPath+"/":"")+e.split(".").pop(),[],function(){return
o});else if(r)if(e===b){module.exports=c[b]=o;for(s in c)o[s]=c[s]}else
c[b]&&(c[b][n]=o);for(s=0;s<this.sc.length;s++)this.sc[s].check()}},this.check(!0)},r=a._gsDefine=function(a,b,c,d){return
new q(a,b,c,d)},s=k._class=function(a,b,c){return
b=b||function(){},r(a,[],function(){return b},c),b};r.globals=d;var
t=[0,0,1,1],u=s("easing.Ease",function(a,b,c,d){this._func=a,this._type=c||0,this._power=d||0,this._params=b?t.concat(b):t},!0),v=u.map={},w=u.register=function(a,b,c,d){for(var
e,f,g,h,i=b.split(","),j=i.length,l=(c||"easeIn,easeOut,easeInOut").split(",");--j>-1;)for(f=i[j],e=d?s("easing."+f,null,!0):k.easing[f]||{},g=l.length;--g>-1;)h=l[g],v[f+"."+h]=v[h+f]=e[h]=a.getRatio?a:a[h]||new
a};for(g=u.prototype,g._calcEnd=!1,g.getRatio=function(a){if(this._func)return
this._params[0]=a,this._func.apply(null,this._params);var
b=this._type,c=this._power,d=1===b?1-a:2===b?a:.5>a?2*a:2*(1-a);return
1===c?d*=d:2===c?d*=d*d:3===c?d*=d*d*d:4===c&&(d*=d*d*d*d),1===b?1-d:2===b?d:.5>a?d/2:1-d/2},e=["Linear","Quad","Cubic","Quart","Quint,Strong"],f=e.length;--f>-1;)g=e[f]+",Power"+f,w(new
u(null,null,1,f),g,"easeOut",!0),w(new
u(null,null,2,f),g,"easeIn"+(0===f?",easeNone":"")),w(new
u(null,null,3,f),g,"easeInOut");v.linear=k.easing.Linear.easeIn,v.swing=k.easing.Quad.easeInOut;var
x=s("events.EventDispatcher",function(a){this._listeners={},this._eventTarget=a||this});g=x.prototype,g.addEventListener=function(a,b,c,d,e){e=e||0;var
f,g,j=this._listeners[a],k=0;for(this!==h||i||h.wake(),null==j&&(this._listeners[a]=j=[]),g=j.length;--g>-1;)f=j[g],f.c===b&&f.s===c?j.splice(g,1):0===k&&f.pr<e&&(k=g+1);j.splice(k,0,{c:b,s:c,up:d,pr:e})},g.removeEventListener=function(a,b){var
c,d=this._listeners[a];if(d)for(c=d.length;--c>-1;)if(d[c].c===b)return
void d.splice(c,1)},g.dispatchEvent=function(a){var
b,c,d,e=this._listeners[a];if(e)for(b=e.length,b>1&&(e=e.slice(0)),c=this._eventTarget;--b>-1;)d=e[b],d&&(d.up?d.c.call(d.s||c,{type:a,target:c}):d.c.call(d.s||c))};var
y=a.requestAnimationFrame,z=a.cancelAnimationFrame,A=Date.now||function(){return(new
Date).getTime()},B=A();for(e=["ms","moz","webkit","o"],f=e.length;--f>-1&&!y;)y=a[e[f]+"RequestAnimationFrame"],z=a[e[f]+"CancelAnimationFrame"]||a[e[f]+"CancelRequestAnimationFrame"];s("Ticker",function(a,b){var
c,d,e,f,g,j=this,k=A(),m=b!==!1&&y?"auto":!1,o=500,p=33,q="tick",r=function(a){var
b,h,i=A()-B;i>o&&(k+=i-p),B+=i,j.time=(B-k)/1e3,b=j.time-g,(!c||b>0||a===!0)&&(j.frame++,g+=b+(b>=f?.004:f-b),h=!0),a!==!0&&(e=d(r)),h&&j.dispatchEvent(q)};x.call(j),j.time=j.frame=0,j.tick=function(){r(!0)},j.lagSmoothing=function(a,b){o=a||1/l,p=Math.min(b,o,0)},j.sleep=function(){null!=e&&(m&&z?z(e):clearTimeout(e),d=n,e=null,j===h&&(i=!1))},j.wake=function(a){null!==e?j.sleep():a?k+=-B+(B=A()):j.frame>10&&(B=A()-o+5),d=0===c?n:m&&y?y:function(a){return
setTimeout(a,1e3*(g-j.time)+1|0)},j===h&&(i=!0),r(2)},j.fps=function(a){return
arguments.length?(c=a,f=1/(c||60),g=this.time+f,void
j.wake()):c},j.useRAF=function(a){return
arguments.length?(j.sleep(),m=a,void
j.fps(c)):m},j.fps(a),setTimeout(function(){"auto"===m&&j.frame<5&&"hidden"!==document.visibilityState&&j.useRAF(!1)},1500)}),g=k.Ticker.prototype=new
k.events.EventDispatcher,g.constructor=k.Ticker;var
C=s("core.Animation",function(a,b){if(this.vars=b=b||{},this._duration=this._totalDuration=a||0,this._delay=Number(b.delay)||0,this._timeScale=1,this._active=b.immediateRender===!0,this.data=b.data,this._reversed=b.reversed===!0,V){i||h.wake();var
c=this.vars.useFrames?U:V;c.add(this,c._time),this.vars.paused&&this.paused(!0)}});h=C.ticker=new
k.Ticker,g=C.prototype,g._dirty=g._gc=g._initted=g._paused=!1,g._totalTime=g._time=0,g._rawPrevTime=-1,g._next=g._last=g._onUpdate=g._timeline=g.timeline=null,g._paused=!1;var
D=function(){i&&A()-B>2e3&&h.wake(),setTimeout(D,2e3)};D(),g.play=function(a,b){return
null!=a&&this.seek(a,b),this.reversed(!1).paused(!1)},g.pause=function(a,b){return
null!=a&&this.seek(a,b),this.paused(!0)},g.resume=function(a,b){return
null!=a&&this.seek(a,b),this.paused(!1)},g.seek=function(a,b){return
this.totalTime(Number(a),b!==!1)},g.restart=function(a,b){return
this.reversed(!1).paused(!1).totalTime(a?-this._delay:0,b!==!1,!0)},g.reverse=function(a,b){return
null!=a&&this.seek(a||this.totalDuration(),b),this.reversed(!0).paused(!1)},g.render=function(a,b,c){},g.invalidate=function(){return
this._time=this._totalTime=0,this._initted=this._gc=!1,this._rawPrevTime=-1,(this._gc||!this.timeline)&&this._enabled(!0),this},g.isActive=function(){var
a,b=this._timeline,c=this._startTime;return!b||!this._gc&&!this._paused&&b.isActive()&&(a=b.rawTime())>=c&&a<c+this.totalDuration()/this._timeScale},g._enabled=function(a,b){return
i||h.wake(),this._gc=!a,this._active=this.isActive(),b!==!0&&(a&&!this.timeline?this._timeline.add(this,this._startTime-this._delay):!a&&this.timeline&&this._timeline._remove(this,!0)),!1},g._kill=function(a,b){return
this._enabled(!1,!1)},g.kill=function(a,b){return
this._kill(a,b),this},g._uncache=function(a){for(var
b=a?this:this.timeline;b;)b._dirty=!0,b=b.timeline;return
this},g._swapSelfInParams=function(a){for(var
b=a.length,c=a.concat();--b>-1;)"{self}"===a[b]&&(c[b]=this);return
c},g._callback=function(a){var
b=this.vars,c=b[a],d=b[a+"Params"],e=b[a+"Scope"]||b.callbackScope||this,f=d?d.length:0;switch(f){case
0:c.call(e);break;case 1:c.call(e,d[0]);break;case
2:c.call(e,d[0],d[1]);break;default:c.apply(e,d)}},g.eventCallback=function(a,b,c,d){if("on"===(a||"").substr(0,2)){var
e=this.vars;if(1===arguments.length)return e[a];null==b?delete
e[a]:(e[a]=b,e[a+"Params"]=o(c)&&-1!==c.join("").indexOf("{self}")?this._swapSelfInParams(c):c,e[a+"Scope"]=d),"onUpdate"===a&&(this._onUpdate=b)}return
this},g.delay=function(a){return
arguments.length?(this._timeline.smoothChildTiming&&this.startTime(this._startTime+a-this._delay),this._delay=a,this):this._delay},g.duration=function(a){return
arguments.length?(this._duration=this._totalDuration=a,this._uncache(!0),this._timeline.smoothChildTiming&&this._time>0&&this._time<this._duration&&0!==a&&this.totalTime(this._totalTime*(a/this._duration),!0),this):(this._dirty=!1,this._duration)},g.totalDuration=function(a){return
this._dirty=!1,arguments.length?this.duration(a):this._totalDuration},g.time=function(a,b){return
arguments.length?(this._dirty&&this.totalDuration(),this.totalTime(a>this._duration?this._duration:a,b)):this._time},g.totalTime=function(a,b,c){if(i||h.wake(),!arguments.length)return
this._totalTime;if(this._timeline){if(0>a&&!c&&(a+=this.totalDuration()),this._timeline.smoothChildTiming){this._dirty&&this.totalDuration();var
d=this._totalDuration,e=this._timeline;if(a>d&&!c&&(a=d),this._startTime=(this._paused?this._pauseTime:e._time)-(this._reversed?d-a:a)/this._timeScale,e._dirty||this._uncache(!1),e._timeline)for(;e._timeline;)e._timeline._time!==(e._startTime+e._totalTime)/e._timeScale&&e.totalTime(e._totalTime,!0),e=e._timeline}this._gc&&this._enabled(!0,!1),(this._totalTime!==a||0===this._duration)&&(I.length&&X(),this.render(a,b,!1),I.length&&X())}return
this},g.progress=g.totalProgress=function(a,b){var c=this.duration();return
arguments.length?this.totalTime(c*a,b):c?this._time/c:this.ratio},g.startTime=function(a){return
arguments.length?(a!==this._startTime&&(this._startTime=a,this.timeline&&this.timeline._sortChildren&&this.timeline.add(this,a-this._delay)),this):this._startTime},g.endTime=function(a){return
this._startTime+(0!=a?this.totalDuration():this.duration())/this._timeScale},g.timeScale=function(a){if(!arguments.length)return
this._timeScale;if(a=a||l,this._timeline&&this._timeline.smoothChildTiming){var
b=this._pauseTime,c=b||0===b?b:this._timeline.totalTime();this._startTime=c-(c-this._startTime)*this._timeScale/a}return
this._timeScale=a,this._uncache(!1)},g.reversed=function(a){return
arguments.length?(a!=this._reversed&&(this._reversed=a,this.totalTime(this._timeline&&!this._timeline.smoothChildTiming?this.totalDuration()-this._totalTime:this._totalTime,!0)),this):this._reversed},g.paused=function(a){if(!arguments.length)return
this._paused;var b,c,d=this._timeline;return
a!=this._paused&&d&&(i||a||h.wake(),b=d.rawTime(),c=b-this._pauseTime,!a&&d.smoothChildTiming&&(this._startTime+=c,this._uncache(!1)),this._pauseTime=a?b:null,this._paused=a,this._active=this.isActive(),!a&&0!==c&&this._initted&&this.duration()&&(b=d.smoothChildTiming?this._totalTime:(b-this._startTime)/this._timeScale,this.render(b,b===this._totalTime,!0))),this._gc&&!a&&this._enabled(!0,!1),this};var
E=s("core.SimpleTimeline",function(a){C.call(this,0,a),this.autoRemoveChildren=this.smoothChildTiming=!0});g=E.prototype=new
C,g.constructor=E,g.kill()._gc=!1,g._first=g._last=g._recent=null,g._sortChildren=!1,g.add=g.insert=function(a,b,c,d){var
e,f;if(a._startTime=Number(b||0)+a._delay,a._paused&&this!==a._timeline&&(a._pauseTime=a._startTime+(this.rawTime()-a._startTime)/a._timeScale),a.timeline&&a.timeline._remove(a,!0),a.timeline=a._timeline=this,a._gc&&a._enabled(!0,!0),e=this._last,this._sortChildren)for(f=a._startTime;e&&e._startTime>f;)e=e._prev;return
e?(a._next=e._next,e._next=a):(a._next=this._first,this._first=a),a._next?a._next._prev=a:this._last=a,a._prev=e,this._recent=a,this._timeline&&this._uncache(!0),this},g._remove=function(a,b){return
a.timeline===this&&(b||a._enabled(!1,!0),a._prev?a._prev._next=a._next:this._first===a&&(this._first=a._next),a._next?a._next._prev=a._prev:this._last===a&&(this._last=a._prev),a._next=a._prev=a.timeline=null,a===this._recent&&(this._recent=this._last),this._timeline&&this._uncache(!0)),this},g.render=function(a,b,c){var
d,e=this._first;for(this._totalTime=this._time=this._rawPrevTime=a;e;)d=e._next,(e._active||a>=e._startTime&&!e._paused)&&(e._reversed?e.render((e._dirty?e.totalDuration():e._totalDuration)-(a-e._startTime)*e._timeScale,b,c):e.render((a-e._startTime)*e._timeScale,b,c)),e=d},g.rawTime=function(){return
i||h.wake(),this._totalTime};var
F=s("TweenLite",function(b,c,d){if(C.call(this,c,d),this.render=F.prototype.render,null==b)throw"Cannot
tween a null target.";this.target=b="string"!=typeof
b?b:F.selector(b)||b;var
e,f,g,h=b.jquery||b.length&&b!==a&&b[0]&&(b[0]===a||b[0].nodeType&&b[0].style&&!b.nodeType),i=this.vars.overwrite;if(this._overwrite=i=null==i?T[F.defaultOverwrite]:"number"==typeof
i?i>>0:T[i],(h||b instanceof
Array||b.push&&o(b))&&"number"!=typeof
b[0])for(this._targets=g=m(b),this._propLookup=[],this._siblings=[],e=0;e<g.length;e++)f=g[e],f?"string"!=typeof
f?f.length&&f!==a&&f[0]&&(f[0]===a||f[0].nodeType&&f[0].style&&!f.nodeType)?(g.splice(e--,1),this._targets=g=g.concat(m(f))):(this._siblings[e]=Y(f,this,!1),1===i&&this._siblings[e].length>1&&$(f,this,null,1,this._siblings[e])):(f=g[e--]=F.selector(f),"string"==typeof
f&&g.splice(e+1,1)):g.splice(e--,1);else
this._propLookup={},this._siblings=Y(b,this,!1),1===i&&this._siblings.length>1&&$(b,this,null,1,this._siblings);(this.vars.immediateRender||0===c&&0===this._delay&&this.vars.immediateRender!==!1)&&(this._time=-l,this.render(Math.min(0,-this._delay)))},!0),G=function(b){return
b&&b.length&&b!==a&&b[0]&&(b[0]===a||b[0].nodeType&&b[0].style&&!b.nodeType);
},H=function(a,b){var c,d={};for(c in a)S[c]||c in
b&&"transform"!==c&&"x"!==c&&"y"!==c&&"width"!==c&&"height"!==c&&"className"!==c&&"border"!==c||!(!P[c]||P[c]&&P[c]._autoCSS)||(d[c]=a[c],delete
a[c]);a.css=d};g=F.prototype=new
C,g.constructor=F,g.kill()._gc=!1,g.ratio=0,g._firstPT=g._targets=g._overwrittenProps=g._startAt=null,g._notifyPluginsOfEnabled=g._lazy=!1,F.version="1.19.0",F.defaultEase=g._ease=new
u(null,null,1,1),F.defaultOverwrite="auto",F.ticker=h,F.autoSleep=120,F.lagSmoothing=function(a,b){h.lagSmoothing(a,b)},F.selector=a.$||a.jQuery||function(b){var
c=a.$||a.jQuery;return c?(F.selector=c,c(b)):"undefined"==typeof
document?b:document.querySelectorAll?document.querySelectorAll(b):document.getElementById("#"===b.charAt(0)?b.substr(1):b)};var
I=[],J={},K=/(?:(-|-=|\+=)?\d*\.?\d*(?:e[\-+]?\d+)?)[0-9]/gi,L=function(a){for(var
b,c=this._firstPT,d=1e-6;c;)b=c.blob?a?this.join(""):this.start:c.c*a+c.s,c.m?b=c.m(b,this._target||c.t):d>b&&b>-d&&(b=0),c.f?c.fp?c.t[c.p](c.fp,b):c.t[c.p](b):c.t[c.p]=b,c=c._next},M=function(a,b,c,d){var
e,f,g,h,i,j,k,l=[a,b],m=0,n="",o=0;for(l.start=a,c&&(c(l),a=l[0],b=l[1]),l.length=0,e=a.match(K)||[],f=b.match(K)||[],d&&(d._next=null,d.blob=1,l._firstPT=l._applyPT=d),i=f.length,h=0;i>h;h++)k=f[h],j=b.substr(m,b.indexOf(k,m)-m),n+=j||!h?j:",",m+=j.length,o?o=(o+1)%5:"rgba("===j.substr(-5)&&(o=1),k===e[h]||e.length<=h?n+=k:(n&&(l.push(n),n=""),g=parseFloat(e[h]),l.push(g),l._firstPT={_next:l._firstPT,t:l,p:l.length-1,s:g,c:("="===k.charAt(1)?parseInt(k.charAt(0)+"1",10)*parseFloat(k.substr(2)):parseFloat(k)-g)||0,f:0,m:o&&4>o?Math.round:0}),m+=k.length;return
n+=b.substr(m),n&&l.push(n),l.setRatio=L,l},N=function(a,b,c,d,e,f,g,h,i){"function"==typeof
d&&(d=d(i||0,a));var j,k,l="get"===c?a[b]:c,m=typeof
a[b],n="string"==typeof
d&&"="===d.charAt(1),o={t:a,p:b,s:l,f:"function"===m,pg:0,n:e||b,m:f?"function"==typeof
f?f:Math.round:0,pr:0,c:n?parseInt(d.charAt(0)+"1",10)*parseFloat(d.substr(2)):parseFloat(d)-l||0};return"number"!==m&&("function"===m&&"get"===c&&(k=b.indexOf("set")||"function"!=typeof
a["get"+b.substr(3)]?b:"get"+b.substr(3),o.s=l=g?a[k](g):a[k]()),"string"==typeof
l&&(g||isNaN(l))?(o.fp=g,j=M(l,d,h||F.defaultStringFilter,o),o={t:j,p:"setRatio",s:0,c:1,f:2,pg:0,n:e||b,pr:0,m:0}):n||(o.s=parseFloat(l),o.c=parseFloat(d)-o.s||0)),o.c?((o._next=this._firstPT)&&(o._next._prev=o),this._firstPT=o,o):void
0},O=F._internals={isArray:o,isSelector:G,lazyTweens:I,blobDif:M},P=F._plugins={},Q=O.tweenLookup={},R=0,S=O.reservedProps={ease:1,delay:1,overwrite:1,onComplete:1,onCompleteParams:1,onCompleteScope:1,useFrames:1,runBackwards:1,startAt:1,onUpdate:1,onUpdateParams:1,onUpdateScope:1,onStart:1,onStartParams:1,onStartScope:1,onReverseComplete:1,onReverseCompleteParams:1,onReverseCompleteScope:1,onRepeat:1,onRepeatParams:1,onRepeatScope:1,easeParams:1,yoyo:1,immediateRender:1,repeat:1,repeatDelay:1,data:1,paused:1,reversed:1,autoCSS:1,lazy:1,onOverwrite:1,callbackScope:1,stringFilter:1,id:1},T={none:0,all:1,auto:2,concurrent:3,allOnStart:4,preexisting:5,"true":1,"false":0},U=C._rootFramesTimeline=new
E,V=C._rootTimeline=new E,W=30,X=O.lazyRender=function(){var
a,b=I.length;for(J={};--b>-1;)a=I[b],a&&a._lazy!==!1&&(a.render(a._lazy[0],a._lazy[1],!0),a._lazy=!1);I.length=0};V._startTime=h.time,U._startTime=h.frame,V._active=U._active=!0,setTimeout(X,1),C._updateRoot=F.render=function(){var
a,b,c;if(I.length&&X(),V.render((h.time-V._startTime)*V._timeScale,!1,!1),U.render((h.frame-U._startTime)*U._timeScale,!1,!1),I.length&&X(),h.frame>=W){W=h.frame+(parseInt(F.autoSleep,10)||120);for(c
in
Q){for(b=Q[c].tweens,a=b.length;--a>-1;)b[a]._gc&&b.splice(a,1);0===b.length&&delete
Q[c]}if(c=V._first,(!c||c._paused)&&F.autoSleep&&!U._first&&1===h._listeners.tick.length){for(;c&&c._paused;)c=c._next;c||h.sleep()}}},h.addEventListener("tick",C._updateRoot);var
Y=function(a,b,c){var
d,e,f=a._gsTweenID;if(Q[f||(a._gsTweenID=f="t"+R++)]||(Q[f]={target:a,tweens:[]}),b&&(d=Q[f].tweens,d[e=d.length]=b,c))for(;--e>-1;)d[e]===b&&d.splice(e,1);return
Q[f].tweens},Z=function(a,b,c,d){var e,f,g=a.vars.onOverwrite;return
g&&(e=g(a,b,c,d)),g=F.onOverwrite,g&&(f=g(a,b,c,d)),e!==!1&&f!==!1},$=function(a,b,c,d,e){var
f,g,h,i;if(1===d||d>=4){for(i=e.length,f=0;i>f;f++)if((h=e[f])!==b)h._gc||h._kill(null,a,b)&&(g=!0);else
if(5===d)break;return g}var
j,k=b._startTime+l,m=[],n=0,o=0===b._duration;for(f=e.length;--f>-1;)(h=e[f])===b||h._gc||h._paused||(h._timeline!==b._timeline?(j=j||_(b,0,o),0===_(h,j,o)&&(m[n++]=h)):h._startTime<=k&&h._startTime+h.totalDuration()/h._timeScale>k&&((o||!h._initted)&&k-h._startTime<=2e-10||(m[n++]=h)));for(f=n;--f>-1;)if(h=m[f],2===d&&h._kill(c,a,b)&&(g=!0),2!==d||!h._firstPT&&h._initted){if(2!==d&&!Z(h,b))continue;h._enabled(!1,!1)&&(g=!0)}return
g},_=function(a,b,c){for(var
d=a._timeline,e=d._timeScale,f=a._startTime;d._timeline;){if(f+=d._startTime,e*=d._timeScale,d._paused)return-100;d=d._timeline}return
f/=e,f>b?f-b:c&&f===b||!a._initted&&2*l>f-b?l:(f+=a.totalDuration()/a._timeScale/e)>b+l?0:f-b-l};g._init=function(){var
a,b,c,d,e,f,g=this.vars,h=this._overwrittenProps,i=this._duration,j=!!g.immediateRender,k=g.ease;if(g.startAt){this._startAt&&(this._startAt.render(-1,!0),this._startAt.kill()),e={};for(d
in
g.startAt)e[d]=g.startAt[d];if(e.overwrite=!1,e.immediateRender=!0,e.lazy=j&&g.lazy!==!1,e.startAt=e.delay=null,this._startAt=F.to(this.target,0,e),j)if(this._time>0)this._startAt=null;else
if(0!==i)return}else
if(g.runBackwards&&0!==i)if(this._startAt)this._startAt.render(-1,!0),this._startAt.kill(),this._startAt=null;else{0!==this._time&&(j=!1),c={};for(d
in
g)S[d]&&"autoCSS"!==d||(c[d]=g[d]);if(c.overwrite=0,c.data="isFromStart",c.lazy=j&&g.lazy!==!1,c.immediateRender=j,this._startAt=F.to(this.target,0,c),j){if(0===this._time)return}else
this._startAt._init(),this._startAt._enabled(!1),this.vars.immediateRender&&(this._startAt=null)}if(this._ease=k=k?k
instanceof u?k:"function"==typeof k?new
u(k,g.easeParams):v[k]||F.defaultEase:F.defaultEase,g.easeParams instanceof
Array&&k.config&&(this._ease=k.config.apply(k,g.easeParams)),this._easeType=this._ease._type,this._easePower=this._ease._power,this._firstPT=null,this._targets)for(f=this._targets.length,a=0;f>a;a++)this._initProps(this._targets[a],this._propLookup[a]={},this._siblings[a],h?h[a]:null,a)&&(b=!0);else
b=this._initProps(this.target,this._propLookup,this._siblings,h,0);if(b&&F._onPluginEvent("_onInitAllProps",this),h&&(this._firstPT||"function"!=typeof
this.target&&this._enabled(!1,!1)),g.runBackwards)for(c=this._firstPT;c;)c.s+=c.c,c.c=-c.c,c=c._next;this._onUpdate=g.onUpdate,this._initted=!0},g._initProps=function(b,c,d,e,f){var
g,h,i,j,k,l;if(null==b)return!1;J[b._gsTweenID]&&X(),this.vars.css||b.style&&b!==a&&b.nodeType&&P.css&&this.vars.autoCSS!==!1&&H(this.vars,b);for(g
in this.vars)if(l=this.vars[g],S[g])l&&(l instanceof
Array||l.push&&o(l))&&-1!==l.join("").indexOf("{self}")&&(this.vars[g]=l=this._swapSelfInParams(l,this));else
if(P[g]&&(j=new
P[g])._onInitTween(b,this.vars[g],this,f)){for(this._firstPT=k={_next:this._firstPT,t:j,p:"setRatio",s:0,c:1,f:1,n:g,pg:1,pr:j._priority,m:0},h=j._overwriteProps.length;--h>-1;)c[j._overwriteProps[h]]=this._firstPT;(j._priority||j._onInitAllProps)&&(i=!0),(j._onDisable||j._onEnable)&&(this._notifyPluginsOfEnabled=!0),k._next&&(k._next._prev=k)}else
c[g]=N.call(this,b,g,"get",l,g,0,null,this.vars.stringFilter,f);return
e&&this._kill(e,b)?this._initProps(b,c,d,e,f):this._overwrite>1&&this._firstPT&&d.length>1&&$(b,this,c,this._overwrite,d)?(this._kill(c,b),this._initProps(b,c,d,e,f)):(this._firstPT&&(this.vars.lazy!==!1&&this._duration||this.vars.lazy&&!this._duration)&&(J[b._gsTweenID]=!0),i)},g.render=function(a,b,c){var
d,e,f,g,h=this._time,i=this._duration,j=this._rawPrevTime;if(a>=i-1e-7)this._totalTime=this._time=i,this.ratio=this._ease._calcEnd?this._ease.getRatio(1):1,this._reversed||(d=!0,e="onComplete",c=c||this._timeline.autoRemoveChildren),0===i&&(this._initted||!this.vars.lazy||c)&&(this._startTime===this._timeline._duration&&(a=0),(0>j||0>=a&&a>=-1e-7||j===l&&"isPause"!==this.data)&&j!==a&&(c=!0,j>l&&(e="onReverseComplete")),this._rawPrevTime=g=!b||a||j===a?a:l);else
if(1e-7>a)this._totalTime=this._time=0,this.ratio=this._ease._calcEnd?this._ease.getRatio(0):0,(0!==h||0===i&&j>0)&&(e="onReverseComplete",d=this._reversed),0>a&&(this._active=!1,0===i&&(this._initted||!this.vars.lazy||c)&&(j>=0&&(j!==l||"isPause"!==this.data)&&(c=!0),this._rawPrevTime=g=!b||a||j===a?a:l)),this._initted||(c=!0);else
if(this._totalTime=this._time=a,this._easeType){var
k=a/i,m=this._easeType,n=this._easePower;(1===m||3===m&&k>=.5)&&(k=1-k),3===m&&(k*=2),1===n?k*=k:2===n?k*=k*k:3===n?k*=k*k*k:4===n&&(k*=k*k*k*k),1===m?this.ratio=1-k:2===m?this.ratio=k:.5>a/i?this.ratio=k/2:this.ratio=1-k/2}else
this.ratio=this._ease.getRatio(a/i);if(this._time!==h||c){if(!this._initted){if(this._init(),!this._initted||this._gc)return;if(!c&&this._firstPT&&(this.vars.lazy!==!1&&this._duration||this.vars.lazy&&!this._duration))return
this._time=this._totalTime=h,this._rawPrevTime=j,I.push(this),void(this._lazy=[a,b]);this._time&&!d?this.ratio=this._ease.getRatio(this._time/i):d&&this._ease._calcEnd&&(this.ratio=this._ease.getRatio(0===this._time?0:1))}for(this._lazy!==!1&&(this._lazy=!1),this._active||!this._paused&&this._time!==h&&a>=0&&(this._active=!0),0===h&&(this._startAt&&(a>=0?this._startAt.render(a,b,c):e||(e="_dummyGS")),this.vars.onStart&&(0!==this._time||0===i)&&(b||this._callback("onStart"))),f=this._firstPT;f;)f.f?f.t[f.p](f.c*this.ratio+f.s):f.t[f.p]=f.c*this.ratio+f.s,f=f._next;this._onUpdate&&(0>a&&this._startAt&&a!==-1e-4&&this._startAt.render(a,b,c),b||(this._time!==h||d||c)&&this._callback("onUpdate")),e&&(!this._gc||c)&&(0>a&&this._startAt&&!this._onUpdate&&a!==-1e-4&&this._startAt.render(a,b,c),d&&(this._timeline.autoRemoveChildren&&this._enabled(!1,!1),this._active=!1),!b&&this.vars[e]&&this._callback(e),0===i&&this._rawPrevTime===l&&g!==l&&(this._rawPrevTime=0))}},g._kill=function(a,b,c){if("all"===a&&(a=null),null==a&&(null==b||b===this.target))return
this._lazy=!1,this._enabled(!1,!1);b="string"!=typeof
b?b||this._targets||this.target:F.selector(b)||b;var
d,e,f,g,h,i,j,k,l,m=c&&this._time&&c._startTime===this._startTime&&this._timeline===c._timeline;if((o(b)||G(b))&&"number"!=typeof
b[0])for(d=b.length;--d>-1;)this._kill(a,b[d],c)&&(i=!0);else{if(this._targets){for(d=this._targets.length;--d>-1;)if(b===this._targets[d]){h=this._propLookup[d]||{},this._overwrittenProps=this._overwrittenProps||[],e=this._overwrittenProps[d]=a?this._overwrittenProps[d]||{}:"all";break}}else{if(b!==this.target)return!1;h=this._propLookup,e=this._overwrittenProps=a?this._overwrittenProps||{}:"all"}if(h){if(j=a||h,k=a!==e&&"all"!==e&&a!==h&&("object"!=typeof
a||!a._tempKill),c&&(F.onOverwrite||this.vars.onOverwrite)){for(f
in
j)h[f]&&(l||(l=[]),l.push(f));if((l||!a)&&!Z(this,c,b,l))return!1}for(f
in
j)(g=h[f])&&(m&&(g.f?g.t[g.p](g.s):g.t[g.p]=g.s,i=!0),g.pg&&g.t._kill(j)&&(i=!0),g.pg&&0!==g.t._overwriteProps.length||(g._prev?g._prev._next=g._next:g===this._firstPT&&(this._firstPT=g._next),g._next&&(g._next._prev=g._prev),g._next=g._prev=null),delete
h[f]),k&&(e[f]=1);!this._firstPT&&this._initted&&this._enabled(!1,!1)}}return
i},g.invalidate=function(){return
this._notifyPluginsOfEnabled&&F._onPluginEvent("_onDisable",this),this._firstPT=this._overwrittenProps=this._startAt=this._onUpdate=null,this._notifyPluginsOfEnabled=this._active=this._lazy=!1,this._propLookup=this._targets?{}:[],C.prototype.invalidate.call(this),this.vars.immediateRender&&(this._time=-l,this.render(Math.min(0,-this._delay))),this},g._enabled=function(a,b){if(i||h.wake(),a&&this._gc){var
c,d=this._targets;if(d)for(c=d.length;--c>-1;)this._siblings[c]=Y(d[c],this,!0);else
this._siblings=Y(this.target,this,!0)}return
C.prototype._enabled.call(this,a,b),this._notifyPluginsOfEnabled&&this._firstPT?F._onPluginEvent(a?"_onEnable":"_onDisable",this):!1},F.to=function(a,b,c){return
new F(a,b,c)},F.from=function(a,b,c){return
c.runBackwards=!0,c.immediateRender=0!=c.immediateRender,new
F(a,b,c)},F.fromTo=function(a,b,c,d){return
d.startAt=c,d.immediateRender=0!=d.immediateRender&&0!=c.immediateRender,new
F(a,b,d)},F.delayedCall=function(a,b,c,d,e){return new
F(b,0,{delay:a,onComplete:b,onCompleteParams:c,callbackScope:d,onReverseComplete:b,onReverseCompleteParams:c,immediateRender:!1,lazy:!1,useFrames:e,overwrite:0})},F.set=function(a,b){return
new
F(a,0,b)},F.getTweensOf=function(a,b){if(null==a)return[];a="string"!=typeof
a?a:F.selector(a)||a;var
c,d,e,f;if((o(a)||G(a))&&"number"!=typeof
a[0]){for(c=a.length,d=[];--c>-1;)d=d.concat(F.getTweensOf(a[c],b));for(c=d.length;--c>-1;)for(f=d[c],e=c;--e>-1;)f===d[e]&&d.splice(c,1)}else
for(d=Y(a).concat(),c=d.length;--c>-1;)(d[c]._gc||b&&!d[c].isActive())&&d.splice(c,1);return
d},F.killTweensOf=F.killDelayedCallsTo=function(a,b,c){"object"==typeof
b&&(c=b,b=!1);for(var
d=F.getTweensOf(a,b),e=d.length;--e>-1;)d[e]._kill(c,a)};var
aa=s("plugins.TweenPlugin",function(a,b){this._overwriteProps=(a||"").split(","),this._propName=this._overwriteProps[0],this._priority=b||0,this._super=aa.prototype},!0);if(g=aa.prototype,aa.version="1.19.0",aa.API=2,g._firstPT=null,g._addTween=N,g.setRatio=L,g._kill=function(a){var
b,c=this._overwriteProps,d=this._firstPT;if(null!=a[this._propName])this._overwriteProps=[];else
for(b=c.length;--b>-1;)null!=a[c[b]]&&c.splice(b,1);for(;d;)null!=a[d.n]&&(d._next&&(d._next._prev=d._prev),d._prev?(d._prev._next=d._next,d._prev=null):this._firstPT===d&&(this._firstPT=d._next)),d=d._next;return!1},g._mod=g._roundProps=function(a){for(var
b,c=this._firstPT;c;)b=a[this._propName]||null!=c.n&&a[c.n.split(this._propName+"_").join("")],b&&"function"==typeof
b&&(2===c.f?c.t._applyPT.m=b:c.m=b),c=c._next},F._onPluginEvent=function(a,b){var
c,d,e,f,g,h=b._firstPT;if("_onInitAllProps"===a){for(;h;){for(g=h._next,d=e;d&&d.pr>h.pr;)d=d._next;(h._prev=d?d._prev:f)?h._prev._next=h:e=h,(h._next=d)?d._prev=h:f=h,h=g}h=b._firstPT=e}for(;h;)h.pg&&"function"==typeof
h.t[a]&&h.t[a]()&&(c=!0),h=h._next;return
c},aa.activate=function(a){for(var
b=a.length;--b>-1;)a[b].API===aa.API&&(P[(new
a[b])._propName]=a[b]);return!0},r.plugin=function(a){if(!(a&&a.propName&&a.init&&a.API))throw"illegal
plugin definition.";var
b,c=a.propName,d=a.priority||0,e=a.overwriteProps,f={init:"_onInitTween",set:"setRatio",kill:"_kill",round:"_mod",mod:"_mod",initAll:"_onInitAllProps"},g=s("plugins."+c.charAt(0).toUpperCase()+c.substr(1)+"Plugin",function(){aa.call(this,c,d),this._overwriteProps=e||[]},a.global===!0),h=g.prototype=new
aa(c);h.constructor=g,g.API=a.API;for(b in f)"function"==typeof
a[b]&&(h[f[b]]=a[b]);return
g.version=a.version,aa.activate([g]),g},e=a._gsQueue){for(f=0;f<e.length;f++)e[f]();for(g
in p)p[g].func||a.console.log("GSAP encountered missing dependency:
"+g)}i=!1}}("undefined"!=typeof
module&&module.exports&&"undefined"!=typeof
global?global:this||window,"TweenMax");index.html000064400000000037151160675320006547
0ustar00<!DOCTYPE html><title></title>
libraries/coomla/html/index.html000064400000000037151160675320012741
0ustar00<!DOCTYPE html><title></title>
libraries/coomla/html/parameter/element/calendar.php000064400000003141151160675320016636
0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  HTML
 *
 * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

/**
 * Renders a calendar element
 *
 * @package     Joomla.Platform
 * @subpackage  Parameter
 * @since       11.1
 * @deprecated  Use JFormFieldCalendar instead.
 */
class JElementCalendar extends JElement
{
	/**
	 * Element name
	 *
	 * @var   string
	 * @deprecated    12.1
	 * @since  11.1
	 */
	protected $_name = 'Calendar';

	/**
	 * Fetch a calendar element
	 *
	 * @param   string       $name          Element name
	 * @param   string       $value         Element value
	 * @param   JXMLElement  &$node         JXMLElement node object
containing the settings for the element
	 * @param   string       $control_name  Control name
	 *
	 * @return  string   HTML string for a calendar
	 *
	 * @deprecated  12.1
	 * @see    JFormFieldCalendar
	 * @since  11.1
	 */
	public function fetchElement($name, $value, &$node, $control_name)
	{
		// Deprecation warning.
		JLog::add('JElementCalendar::fetchElement() is deprecated.',
JLog::WARNING, 'deprecated');

		// Load the calendar behavior
		JHtml::_('behavior.calendar');

		$format = ($node->attributes('format') ?
$node->attributes('format') : '%Y-%m-%d');
		$class = $node->attributes('class') ?
$node->attributes('class') : 'inputbox';
		$id = $control_name . $name;
		$name = $control_name . '[' . $name . ']';

		return JHtml::_('calendar', $value, $name, $id, $format,
array('class' => $class));
	}
}
libraries/coomla/html/parameter/element/category.php000064400000003366151160675320016713
0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  HTML
 *
 * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

/**
 * Renders a category element
 *
 * @package     Joomla.Platform
 * @subpackage  Parameter
 * @since       11.1
 * @deprecated  Use JFormFieldCategory instead.
 */
class JElementCategory extends JElement
{
	/**
	 * Element name
	 *
	 * @var    string
	 */
	protected $_name = 'Category';

	/**
	 * Fetch the element
	 *
	 * @param   string       $name          Element name
	 * @param   string       $value         Element value
	 * @param   JXMLElement  &$node         JXMLElement node object
containing the settings for the element
	 * @param   string       $control_name  Control name
	 *
	 * @return  string
	 *
	 * @since   11.1
	 * @deprecated    12.1
	 */
	public function fetchElement($name, $value, &$node, $control_name)
	{
		// Deprecation warning.
		JLog::add('JElementCategory::fetchElement() is deprecated.',
JLog::WARNING, 'deprecated');

		$db = JFactory::getDbo();

		$extension = $node->attributes('extension');
		$class = $node->attributes('class');
		$filter = explode(',',
$node->attributes('filter'));

		if (!isset($extension))
		{
			// Alias for extension
			$extension = $node->attributes('scope');
			if (!isset($extension))
			{
				$extension = 'com_content';
			}
		}

		if (!$class)
		{
			$class = "inputbox";
		}

		if (count($filter) < 1)
		{
			$filter = null;
		}

		return JHtml::_(
			'list.category',
			$control_name . '[' . $name . ']',
			$extension,
			$extension . '.view',
			$filter,
			(int) $value,
			$class,
			null,
			1,
			$control_name . $name
		);
	}
}
libraries/coomla/html/parameter/element/componentlayouts.php000064400000005366151160675320020523
0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  HTML
 *
 * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

require_once dirname(__FILE__) . '/list.php';

/**
 * Parameter to display a list of the layouts for a component view from the
extension or default template overrides.
 *
 * @package     Joomla.Platform
 * @subpackage  Parameter
 * @see         JFormFieldComponentLayout
 * @note        When replacing take note that JFormFieldComponentLayout
does not end in s.
 * @since       11.1
 * @deprecated  Use JFormFieldComponentLayouts instead
 */
class JElementComponentLayouts extends JElementList
{
	/**
	 * @var    string
	 */
	protected $_name = 'ComponentLayouts';

	/**
	 * Get the options for the list.
	 *
	 * @param   JXMLElement  &$node  JXMLElement node object containing
the settings for the element
	 *
	 * @return  array
	 *
	 * @since   11.1
	 *
	 * @deprecated  12.1
	 * @see         JFormFieldComponentLayout
	 */
	protected function _getOptions(&$node)
	{
		// Deprecation warning.
		JLog::add('JElementComponentLayouts::_getOptions() is
deprecated.', JLog::WARNING, 'deprecated');

		$options = array();
		$path1 = null;
		$path2 = null;

		// Load template entries for each menuid
		$db = JFactory::getDBO();
		$query = 'SELECT template' . ' FROM
#__template_styles' . ' WHERE client_id = 0 AND home = 1';
		$db->setQuery($query);
		$template = $db->loadResult();

		if ($view = $node->attributes('view') && $extn =
$node->attributes('extension'))
		{
			$view = preg_replace('#\W#', '', $view);
			$extn = preg_replace('#\W#', '', $extn);
			$path1 = JPATH_SITE . '/components/' . $extn .
'/views/' . $view . '/tmpl';
			$path2 = JPATH_SITE . '/templates/' . $template .
'/html/' . $extn . '/' . $view;
			$options[] = JHtml::_('select.option', '',
JText::_('JOPTION_USE_MENU_REQUEST_SETTING'));
		}

		if ($path1 && $path2)
		{
			jimport('joomla.filesystem.file');
			$path1 = JPath::clean($path1);
			$path2 = JPath::clean($path2);

			$files = JFolder::files($path1, '^[^_]*\.php$');
			foreach ($files as $file)
			{
				$options[] = JHtml::_('select.option',
JFile::stripExt($file));
			}

			if (is_dir($path2) && $files = JFolder::files($path2,
'^[^_]*\.php$'))
			{
				$options[] = JHtml::_('select.optgroup',
JText::_('JOPTION_FROM_DEFAULT_TEMPLATE'));
				foreach ($files as $file)
				{
					$options[] = JHtml::_('select.option',
JFile::stripExt($file));
				}
				$options[] = JHtml::_('select.optgroup',
JText::_('JOPTION_FROM_DEFAULT_TEMPLATE'));
			}
		}

		// Merge any additional options in the XML definition.
		$options = array_merge(parent::_getOptions($node), $options);

		return $options;
	}
}
libraries/coomla/html/parameter/element/contentlanguages.php000064400000003356151160675320020436
0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  HTML
 *
 * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

require_once dirname(__FILE__) . '/list.php';

/**
 * Renders a select list of Asset Groups
 *
 * @package     Joomla.Platform
 * @subpackage  Parameter
 * @since       11.1
 * @deprecated  Use JFormFieldContentLanguage instead.
 * @note        Be careful in replacing to note that
JFormFieldConentLanguage does not end in s.
 */
class JElementContentLanguages extends JElementList
{
	/**
	 * Element name
	 *
	 * @var    string
	 */
	protected $_name = 'ContentLanguages';

	/**
	 * Get the options for the element
	 *
	 * @param   JXMLElement  &$node  JXMLElement node object containing
the settings for the element
	 *
	 * @return  array
	 *
	 * @since   11.1
	 *
	 * @deprecated    12.1  Use JFormFieldContentLanguage::getOptions instead
	 */
	protected function _getOptions(&$node)
	{
		// Deprecation warning.
		JLog::add('JElementContentLanguages::_getOptions() is
deprecated.', JLog::WARNING, 'deprecated');

		$db = JFactory::getDbo();
		$query = $db->getQuery(true);

		$query->select('a.lang_code AS value, a.title AS text,
a.title_native');
		$query->from('#__languages AS a');
		$query->where('a.published >= 0');
		$query->order('a.title');

		// Get the options.
		$db->setQuery($query);
		$options = $db->loadObjectList();

		// Check for a database error.
		if ($db->getErrorNum())
		{
			JError::raiseWarning(500, $db->getErrorMsg());
		}

		// Merge any additional options in the XML definition.
		$options = array_merge(parent::_getOptions($node), $options);

		return $options;
	}
}
libraries/coomla/html/parameter/element/editors.php000064400000003424151160675320016542
0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  HTML
 *
 * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

/**
 * Renders a editors element
 *
 * @package     Joomla.Platform
 * @subpackage  Parameter
 * @since       11.1
 * @deprecated  Use JFormFieldEditors instead
 */
class JElementEditors extends JElement
{
	/**
	 * Element name
	 *
	 * @var    string
	 */
	protected $_name = 'Editors';

	/**
	 * Fetch an editor element
	 *
	 * @param   string       $name          Element name
	 * @param   string       $value         Element value
	 * @param   JXMLElement  &$node         JXMLElement node object
containing the settings for the element
	 * @param   string       $control_name  Control name
	 *
	 * @return  string
	 *
	 * @deprecated    12.1
	 * @see           JFormFieldEditors::getOptions
	 * @since   11.1
	 */
	public function fetchElement($name, $value, &$node, $control_name)
	{
		// Deprecation warning.
		JLog::add('JElementEditor::fetchElement is deprecated.',
JLog::WARNING, 'deprecated');

		$db = JFactory::getDbo();
		$user = JFactory::getUser();

		// compile list of the editors
		$query = 'SELECT element AS value, name AS text' . ' FROM
#__extensions' . ' WHERE folder = "editors"' .
' AND type = "plugin"'
			. ' AND enabled = 1' . ' ORDER BY ordering, name';
		$db->setQuery($query);
		$editors = $db->loadObjectList();

		array_unshift($editors, JHtml::_('select.option', '',
JText::_('JOPTION_SELECT_EDITOR')));

		return JHtml::_(
			'select.genericlist',
			$editors,
			$control_name . '[' . $name . ']',
			array('id' => $control_name . $name, 'list.attr'
=> 'class="inputbox"', 'list.select' =>
$value)
		);
	}
}
libraries/coomla/html/parameter/element/filelist.php000064400000004414151160675320016704
0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  HTML
 *
 * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

/**
 * Renders a filelist element
 *
 * @package     Joomla.Platform
 * @subpackage  Parameter
 * @since       11.1
 * @deprecated  use JFormFieldFileList instead
 */
class JElementFilelist extends JElement
{
	/**
	 * Element name
	 *
	 * @var    string
	 */
	protected $_name = 'Filelist';

	/**
	 * Fetch a filelist element
	 *
	 * @param   string       $name          Element name
	 * @param   string       $value         Element value
	 * @param   JXMLElement  &$node         JXMLElement node object
containing the settings for the element
	 * @param   string       $control_name  Control name
	 *
	 * @return  string
	 *
	 * @deprecated    12.1   Use JFormFieldFileList::getOptions instead
	 * @since   11.1
	 */
	public function fetchElement($name, $value, &$node, $control_name)
	{
		// Deprecation warning.
		JLog::add('JElementFileList::fetchElement() is deprecated.',
JLog::WARNING, 'deprecated');

		jimport('joomla.filesystem.folder');
		jimport('joomla.filesystem.file');

		// path to images directory
		$path = JPATH_ROOT . '/' .
$node->attributes('directory');
		$filter = $node->attributes('filter');
		$exclude = $node->attributes('exclude');
		$stripExt = $node->attributes('stripext');
		$files = JFolder::files($path, $filter);

		$options = array();

		if (!$node->attributes('hide_none'))
		{
			$options[] = JHtml::_('select.option', '-1',
JText::_('JOPTION_DO_NOT_USE'));
		}

		if (!$node->attributes('hide_default'))
		{
			$options[] = JHtml::_('select.option', '',
JText::_('JOPTION_USE_DEFAULT'));
		}

		if (is_array($files))
		{
			foreach ($files as $file)
			{
				if ($exclude)
				{
					if (preg_match(chr(1) . $exclude . chr(1), $file))
					{
						continue;
					}
				}
				if ($stripExt)
				{
					$file = JFile::stripExt($file);
				}
				$options[] = JHtml::_('select.option', $file, $file);
			}
		}

		return JHtml::_(
			'select.genericlist',
			$options,
			$control_name . '[' . $name . ']',
			array('id' => 'param' . $name,
'list.attr' => 'class="inputbox"',
'list.select' => $value)
		);
	}
}
libraries/coomla/html/parameter/element/folderlist.php000064400000004177151160675320017246
0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  HTML
 *
 * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

/**
 * Renders a filelist element
 *
 * @package     Joomla.Platform
 * @subpackage  Parameter
 * @since       11.1
 * @deprecated  12.1 Use JFormFieldFolderList instead.
 */
class JElementFolderlist extends JElement
{
	/**
	 * Element name
	 *
	 * @var    string
	 */
	protected $_name = 'Folderlist';

	/**
	 * Fetch a folderlist element
	 *
	 * @param   string       $name          Element name
	 * @param   string       $value         Element value
	 * @param   JXMLElement  &$node         JXMLElement node object
containing the settings for the element
	 * @param   string       $control_name  Control name
	 *
	 * @return  string
	 *
	 * @deprecated    12.1  Use JFormFieldFolderlist::getOptions instead.
	 * @since   11.1
	 */
	public function fetchElement($name, $value, &$node, $control_name)
	{
		// Deprecation warning.
		JLog::add('JElementFolderList::fetchElement() is deprecated.',
JLog::WARNING, 'deprecated');

		jimport('joomla.filesystem.folder');

		// Initialise variables.
		$path = JPATH_ROOT . '/' .
$node->attributes('directory');
		$filter = $node->attributes('filter');
		$exclude = $node->attributes('exclude');
		$folders = JFolder::folders($path, $filter);

		$options = array();
		foreach ($folders as $folder)
		{
			if ($exclude)
			{
				if (preg_match(chr(1) . $exclude . chr(1), $folder))
				{
					continue;
				}
			}
			$options[] = JHtml::_('select.option', $folder, $folder);
		}

		if (!$node->attributes('hide_none'))
		{
			array_unshift($options, JHtml::_('select.option',
'-1', JText::_('JOPTION_DO_NOT_USE')));
		}

		if (!$node->attributes('hide_default'))
		{
			array_unshift($options, JHtml::_('select.option',
'', JText::_('JOPTION_USE_DEFAULT')));
		}

		return JHtml::_(
			'select.genericlist',
			$options,
			$control_name . '[' . $name . ']',
			array('id' => 'param' . $name,
'list.attr' => 'class="inputbox"',
'list.select' => $value)
		);
	}
}
libraries/coomla/html/parameter/element/helpsites.php000064400000003363151160675320017073
0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  HTML
 *
 * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

/**
 * Renders a helpsites element
 *
 * @package     Joomla.Platform
 * @subpackage  Parameter
 * @since       11.1
 * @deprecated  Use JFormFieldHelpsite instead
 * @note        When updating note that JformFieldHelpsite does not end in
s.
 */
class JElementHelpsites extends JElement
{
	/**
	 * Element name
	 *
	 * @var    string
	 */
	protected $_name = 'Helpsites';

	/**
	 * Fetch a help sites list
	 *
	 * @param   string       $name          Element name
	 * @param   string       $value         Element value
	 * @param   JXMLElement  &$node         JXMLElement node object
containing the settings for the element
	 * @param   string       $control_name  Control name
	 *
	 * @return  string
	 *
	 * @deprecated    12.1   Use jFormFieldHelpSites::getOptions instead
	 * @since   11.1
	 */
	public function fetchElement($name, $value, &$node, $control_name)
	{
		// Deprecation warning.
		JLog::add('JElementHelpsites::fetchElement is deprecated.',
JLog::WARNING, 'deprecated');

		jimport('joomla.language.help');

		// Get Joomla version.
		$version = new JVersion;
		$jver = explode('.', $version->getShortVersion());

		$helpsites = JHelp::createSiteList(JPATH_ADMINISTRATOR .
'/help/helpsites.xml', $value);
		array_unshift($helpsites, JHtml::_('select.option',
'', JText::_('local')));

		return JHtml::_(
			'select.genericlist',
			$helpsites,
			$control_name . '[' . $name . ']',
			array('id' => $control_name . $name, 'list.attr'
=> 'class="inputbox"', 'list.select' =>
$value)
		);
	}
}
libraries/coomla/html/parameter/element/hidden.php000064400000004056151160675320016326
0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  HTML
 *
 * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

/**
 * Renders a hidden element
 *
 * @package     Joomla.Platform
 * @subpackage  Parameter
 * @since       11.1
 * @deprecated  12.1     Use JFormFieldHidden instead.
 */
class JElementHidden extends JElement
{
	/**
	 * Element name
	 *
	 * @var    string
	 * @since  11.1
	 */
	protected $_name = 'Hidden';

	/**
	 * Fetch a hidden element
	 *
	 * @param   string       $name          Element name
	 * @param   string       $value         Element value
	 * @param   JXMLElement  &$node         JXMLElement node object
containing the settings for the element
	 * @param   string       $control_name  Control name
	 *
	 * @return  string
	 *
	 * @since   11.1
	 * @deprecated    12.1
	 */
	public function fetchElement($name, $value, &$node, $control_name)
	{
		// Deprecation warning.
		JLog::add('JElementHidden::fetchElement() is deprecated.',
JLog::WARNING, 'deprecated');

		$class = ($node->attributes('class') ?
'class="' . $node->attributes('class') .
'"' : 'class="text_area"');

		return '<input type="hidden" name="' .
$control_name . '[' . $name . ']" id="' .
$control_name . $name . '" value="' . $value .
'" ' . $class
			. ' />';
	}

	/**
	 * Fetch tooltip for a hidden element
	 *

	 * @param   string       $label         Element label
	 * @param   string       $description   Element description (which renders
as a tool tip)
	 * @param   JXMLElement  &$xmlElement   Element object
	 * @param   string       $control_name  Control name
	 * @param   string       $name          Element name
	 *
	 * @return  string
	 *
	 * @deprecated    12.1
	 * @since   11.1
	 */
	public function fetchTooltip($label, $description, &$xmlElement,
$control_name = '', $name = '')
	{
		// Deprecation warning.
		JLog::add('JElementHidden::fetchTooltip() is deprecated.',
JLog::WARNING, 'deprecated');

		return false;
	}
}
libraries/coomla/html/parameter/element/imagelist.php000064400000002577151160675320017057
0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  HTML
 *
 * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

/**
 * Renders a imagelist element
 *
 * @package     Joomla.Platform
 * @subpackage  Parameter
 * @since       11.1
 * @deprecated  12.1   Use JFormFieldImageList instead.
 */
class JElementImageList extends JElement
{
	/**
	 * Element name
	 *
	 * @var    string
	 */
	protected $_name = 'ImageList';

	/**
	 * Fetch imagelist element
	 *
	 * @param   string       $name          Element name
	 * @param   string       $value         Element value
	 * @param   JXMLElement  &$node         JXMLElement node object
containing the settings for the element
	 * @param   string       $control_name  Control name
	 *
	 * @return  string
	 *
	 * @deprecated    12.1   Use JFormFieldImageLst instead.
	 * @since   11.1
	 */
	public function fetchElement($name, $value, &$node, $control_name)
	{
		// Deprecation warning.
		JLog::add('JElementImageList::fetchElement() is deprecated.',
JLog::WARNING, 'deprecated');

		$filter = '\.png$|\.gif$|\.jpg$|\.bmp$|\.ico$';
		$node->addAttribute('filter', $filter);

		$parameter = $this->_parent->loadElement('filelist');

		return $parameter->fetchElement($name, $value, $node, $control_name);
	}
}
libraries/coomla/html/parameter/element/index.html000064400000000037151160675320016352
0ustar00<!DOCTYPE html><title></title>
libraries/coomla/html/parameter/element/languages.php000064400000003364151160675320017042
0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  HTML
 *
 * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

/**
 * Renders a languages element
 *
 * @package     Joomla.Platform
 * @subpackage  Parameter
 * @since       11.1
 * @deprecated  12.1   Use JFormFieldLanguage instead
 * @note        In updating please noe that JFormFieldLanguage does not end
in s.
 */
class JElementLanguages extends JElement
{
	/**
	 * Element name
	 *
	 * @var    string
	 */
	protected $_name = 'Languages';

	/**
	 * Fetch the language list element
	 *
	 * @param   string       $name          Element name
	 * @param   string       $value         Element value
	 * @param   JXMLElement  &$node         JXMLElement node object
containing the settings for the element
	 * @param   string       $control_name  Control name
	 *
	 * @return  string
	 *
	 * @deprecated    12.1   Use JFormFieldLanguage
	 * @note    When updating note that JFormFieldLanguage has no s.
	 * @since   11.1
	 */
	public function fetchElement($name, $value, &$node, $control_name)
	{
		// Deprecation warning.
		JLog::add('JElementLanguages::fetchElement() is deprecated.',
JLog::WARNING, 'deprecated');

		$client = $node->attributes('client');

		$languages = JLanguageHelper::createLanguageList($value,
constant('JPATH_' . strtoupper($client)), true);
		array_unshift($languages, JHtml::_('select.option',
'', JText::_('JOPTION_SELECT_LANGUAGE')));

		return JHtml::_(
			'select.genericlist',
			$languages,
			$control_name . '[' . $name . ']',
			array('id' => $control_name . $name, 'list.attr'
=> 'class="inputbox"', 'list.select' =>
$value)
		);
	}
}
libraries/coomla/html/parameter/element/list.php000064400000004325151160675320016045
0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  HTML
 *
 * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

/**
 * Renders a list element
 *
 * @package     Joomla.Platform
 * @subpackage  Parameter
 * @since       11.1
 * @deprecated  Use JFormFieldList instead
 */
class JElementList extends JElement
{
	/**
	 * Element type
	 *
	 * @var    string
	 */
	protected $_name = 'List';

	/**
	 * Get the options for the element
	 *
	 * @param   JXMLElement  &$node  JXMLElement node object containing
the settings for the element
	 *
	 * @return  array
	 *
	 * @since   11.1
	 *
	 * @deprecated  12.1  Use JFormFieldList::getOptions Instead
	 */
	protected function _getOptions(&$node)
	{
		// Deprecation warning.
		JLog::add('JElementList::getOptions() is deprecated.',
JLog::WARNING, 'deprecated');

		$options = array();
		foreach ($node->children() as $option)
		{
			$val = $option->attributes('value');
			$text = $option->data();
			$options[] = JHtml::_('select.option', $val, JText::_($text));
		}
		return $options;
	}

	/**
	 * Fetch the HTML code for the parameter element.
	 *
	 * @param   string             $name          The field name.
	 * @param   mixed              $value         The value of the field.
	 * @param   JSimpleXMLElement  &$node         The current
JSimpleXMLElement node.
	 * @param   string             $control_name  The name of the HTML
control.
	 *
	 * @return  string
	 *
	 * @deprecated    12.1
	 * @since   11.1
	 */
	public function fetchElement($name, $value, &$node, $control_name)
	{
		$ctrl = $control_name . '[' . $name . ']';
		$attribs = ' ';

		if ($v = $node->attributes('size'))
		{
			$attribs .= 'size="' . $v . '"';
		}
		if ($v = $node->attributes('class'))
		{
			$attribs .= 'class="' . $v . '"';
		}
		else
		{
			$attribs .= 'class="inputbox"';
		}
		if ($m = $node->attributes('multiple'))
		{
			$attribs .= 'multiple="multiple"';
			$ctrl .= '[]';
		}

		return JHtml::_(
			'select.genericlist',
			$this->_getOptions($node),
			$ctrl,
			array('id' => $control_name . $name, 'list.attr'
=> $attribs, 'list.select' => $value)
		);
	}
}
libraries/coomla/html/parameter/element/menu.php000064400000003230151160675320016030
0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  HTML
 *
 * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

/**
 * Renders a menu element
 *
 * @package     Joomla.Platform
 * @subpackage  Parameter
 * @since       11.1
 * @deprecated  Use JFormMenu instead
 */
class JElementMenu extends JElement
{
	/**
	 * Element name
	 *
	 * @var    string
	 */
	protected $_name = 'Menu';

	/**
	 * Fetch a html for a list of menus
	 *
	 * @param   string       $name          Element name
	 * @param   string       $value         Element value
	 * @param   JXMLElement  &$node         JXMLElement node object
containing the settings for the element
	 * @param   string       $control_name  Control name
	 *
	 * @return  string
	 *
	 * @deprecated    12.1  Use JFormFieldMenu::getOptions instead
	 * @since   11.1
	 */
	public function fetchElement($name, $value, &$node, $control_name)
	{
		// Deprecation warning.
		JLog::add('JElementMenu::fetchElement() is deprecated.',
JLog::WARNING, 'deprecated');

		require_once JPATH_ADMINISTRATOR .
'/components/com_menus/helpers/menus.php';
		$menuTypes = MenusHelper::getMenuTypes();

		foreach ($menuTypes as $menutype)
		{
			$options[] = JHtml::_('select.option', $menutype, $menutype);
		}
		array_unshift($options, JHtml::_('select.option', '',
JText::_('JOPTION_SELECT_MENU')));

		return JHtml::_(
			'select.genericlist',
			$options,
			$control_name . '[' . $name . ']',
			array('id' => $control_name . $name, 'list.attr'
=> 'class="inputbox"', 'list.select' =>
$value)
		);
	}
}
libraries/coomla/html/parameter/element/menuitem.php000064400000010040151160675320016704
0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  HTML
 *
 * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

/**
 * Renders a menu item element
 *
 * @package     Joomla.Platform
 * @subpackage  Parameter
 * @since       11.1
 * @deprecated  Use JformFieldMenuItem instead
 */
class JElementMenuItem extends JElement
{
	/**
	 * Element name
	 *
	 * @var    string
	 */
	protected $_name = 'MenuItem';

	/**
	 * Fetch menu item element HTML
	 *
	 * @param   string       $name          Element name
	 * @param   string       $value         Element value
	 * @param   JXMLElement  &$node         JXMLElement node object
containing the settings for the element
	 * @param   string       $control_name  Control name
	 *
	 * @return  string
	 *
	 * @deprecated    12.1  useJFormFieldMenuItem::getGroups
	 * @since   11.1
	 *
	 */
	public function fetchElement($name, $value, &$node, $control_name)
	{
		// Deprecation warning.
		JLog::add('JElementMenuitem::fetchElement() is deprecated.',
JLog::WARNING, 'deprecated');

		$db = JFactory::getDbo();

		$menuType = $this->_parent->get('menu_type');
		if (!empty($menuType))
		{
			$where = ' WHERE menutype = ' . $db->Quote($menuType);
		}
		else
		{
			$where = ' WHERE 1';
		}

		// Load the list of menu types
		// TODO: move query to model
		$query = 'SELECT menutype, title' . ' FROM
#__menu_types' . ' ORDER BY title';
		$db->setQuery($query);
		$menuTypes = $db->loadObjectList();

		if ($state = $node->attributes('state'))
		{
			$where .= ' AND published = ' . (int) $state;
		}

		// load the list of menu items
		// TODO: move query to model
		$query = 'SELECT id, parent_id, title, menutype, type' . '
FROM #__menu' . $where . ' ORDER BY menutype, parent_id,
ordering';

		$db->setQuery($query);
		$menuItems = $db->loadObjectList();

		// Establish the hierarchy of the menu
		// TODO: use node model
		$children = array();

		if ($menuItems)
		{
			// First pass - collect children
			foreach ($menuItems as $v)
			{
				$pt = $v->parent_id;
				$list = @$children[$pt] ? $children[$pt] : array();
				array_push($list, $v);
				$children[$pt] = $list;
			}
		}

		// Second pass - get an indent list of the items
		$list = JHtml::_('menu.treerecurse', 0, '', array(),
$children, 9999, 0, 0);

		// Assemble into menutype groups
		$n = count($list);
		$groupedList = array();
		foreach ($list as $k => $v)
		{
			$groupedList[$v->menutype][] = &$list[$k];
		}

		// Assemble menu items to the array
		$options = array();
		$options[] = JHtml::_('select.option', '',
JText::_('JOPTION_SELECT_MENU_ITEM'));

		foreach ($menuTypes as $type)
		{
			if ($menuType == '')
			{
				$options[] = JHtml::_('select.option', '0',
'&#160;', 'value', 'text', true);
				$options[] = JHtml::_('select.option', $type->menutype,
$type->title . ' - ' . JText::_('JGLOBAL_TOP'),
'value', 'text', true);
			}
			if (isset($groupedList[$type->menutype]))
			{
				$n = count($groupedList[$type->menutype]);
				for ($i = 0; $i < $n; $i++)
				{
					$item = &$groupedList[$type->menutype][$i];

					// If menutype is changed but item is not saved yet, use the new type
in the list
					if (JRequest::getString('option', '',
'get') == 'com_menus')
					{
						$currentItemArray = JRequest::getVar('cid', array(0),
'', 'array');
						$currentItemId = (int) $currentItemArray[0];
						$currentItemType = JRequest::getString('type',
$item->type, 'get');
						if ($currentItemId == $item->id && $currentItemType !=
$item->type)
						{
							$item->type = $currentItemType;
						}
					}

					$disable = strpos($node->attributes('disable'),
$item->type) !== false ? true : false;
					$options[] = JHtml::_('select.option', $item->id,
'&#160;&#160;&#160;' . $item->treename,
'value', 'text', $disable);

				}
			}
		}

		return JHtml::_(
			'select.genericlist',
			$options,
			$control_name . '[' . $name . ']',
			array('id' => $control_name . $name, 'list.attr'
=> 'class="inputbox"', 'list.select' =>
$value)
		);
	}
}
libraries/coomla/html/parameter/element/modulelayouts.php000064400000005275151160675320020005
0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  HTML
 *
 * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

require_once dirname(__FILE__) . '/list.php';

/**
 * Parameter to display a list of the layouts for a module from the module
or default template overrides.
 *
 * @package     Joomla.Platform
 * @subpackage  Parameter
 * @note        Note that JFormFieldModuleLayout does not end in s.
 * @since       11.1
 * @deprecated  Use JFormFieldModuleLayout instead
 */
class JElementModuleLayouts extends JElementList
{
	/**
	 * @var		string
	 */
	protected $_name = 'ModuleLayouts';

	/**
	 * Get the options for the list.
	 *
	 * @param   JXMLElement  &$node  JXMLElement node object containing
the settings for the element
	 *
	 * @return  string
	 *
	 * @deprecated    12.1   Use JFormFieldModuleLayouts::getInput instead.
	 * @since   11.1
	 */
	protected function _getOptions(&$node)
	{
		// Deprecation warning.
		JLog::add('JElementModuleLayouts::_getOptions() is
deprecated.', JLog::WARNING, 'deprecated');

		$clientId = ($v = $node->attributes('client_id')) ? $v : 0;

		$options = array();
		$path1 = null;
		$path2 = null;

		// Load template entries for each menuid
		$db = JFactory::getDBO();
		$query = $db->getQuery(true);
		$query->select('template');
		$query->from('#__template_styles');
		$query->where('client_id = ' . (int) $clientId);
		$query->where('home = 1');
		$db->setQuery($query);
		$template = $db->loadResult();

		if ($module = $node->attributes('module'))
		{
			$base = ($clientId == 1) ? JPATH_ADMINISTRATOR : JPATH_SITE;
			$module = preg_replace('#\W#', '', $module);
			$path1 = $base . '/modules/' . $module . '/tmpl';
			$path2 = $base . '/templates/' . $template .
'/html/' . $module;
			$options[] = JHTML::_('select.option', '',
'');
		}

		if ($path1 && $path2)
		{
			jimport('joomla.filesystem.file');
			$path1 = JPath::clean($path1);
			$path2 = JPath::clean($path2);

			$files = JFolder::files($path1, '^[^_]*\.php$');
			foreach ($files as $file)
			{
				$options[] = JHTML::_('select.option',
JFile::stripExt($file));
			}

			if (is_dir($path2) && $files = JFolder::files($path2,
'^[^_]*\.php$'))
			{
				$options[] = JHTML::_('select.optgroup',
JText::_('JOPTION_FROM_DEFAULT'));
				foreach ($files as $file)
				{
					$options[] = JHTML::_('select.option',
JFile::stripExt($file));
				}
				$options[] = JHTML::_('select.optgroup',
JText::_('JOPTION_FROM_DEFAULT'));
			}
		}

		// Merge any additional options in the XML definition.
		$options = array_merge(parent::_getOptions($node), $options);

		return $options;
	}
}
libraries/coomla/html/parameter/element/password.php000064400000003045151160675320016732
0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  HTML
 *
 * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

/**
 * Renders a password element
 *
 * @package     Joomla.Platform
 * @subpackage  Parameter
 * @since       11.1
 * @deprecated  12.1  Use JFormFieldPassword instead.
 */
class JElementPassword extends JElement
{
	/**
	 * Element name
	 *
	 * @var    string
	 */
	protected $_name = 'Password';

	/**
	 * Fetch a html for a password element
	 *
	 * @param   string       $name          Element name
	 * @param   string       $value         Element value
	 * @param   JXMLElement  &$node         JXMLElement node object
containing the settings for the element
	 * @param   string       $control_name  Control name
	 *
	 * @return  string
	 *
	 * @deprecated    12.1  Use JFormFieldPasssword::getInput instead.
	 * @since   11.1
	 */
	public function fetchElement($name, $value, &$node, $control_name)
	{
		// Deprecation warning.
		JLog::add('JElementPassword::fetchElement() is deprecated.',
JLog::WARNING, 'deprecated');

		$size = ($node->attributes('size') ? 'size="'
. $node->attributes('size') . '"' :
'');
		$class = ($node->attributes('class') ?
'class="' . $node->attributes('class') .
'"' : 'class="text_area"');

		return '<input type="password" name="' .
$control_name . '[' . $name . ']" id="' .
$control_name . $name . '" value="' . $value .
'" '
			. $class . ' ' . $size . ' />';
	}
}
libraries/coomla/html/parameter/element/radio.php000064400000003022151160675320016161
0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  HTML
 *
 * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

/**
 * Renders a radio element
 *
 * @package     Joomla.Platform
 * @subpackage  Parameter
 * @since       11.1
 * @deprecated  12.1    Use JFormFieldRadio instead
 */
class JElementRadio extends JElement
{
	/**
	 * Element name
	 *
	 * @var    string
	 */
	protected $_name = 'Radio';

	/**
	 * Fetch a html for a radio button
	 *
	 * @param   string       $name          Element name
	 * @param   string       $value         Element value
	 * @param   JXMLElement  &$node         JXMLElement node object
containing the settings for the element
	 * @param   string       $control_name  Control name
	 *
	 * @return  string
	 *
	 * @deprecated    12.1  Use JFormFieldRadio::getInput and
JFormFieldRadio::getOptions indsead.
	 * @since   11.1
	 */
	public function fetchElement($name, $value, &$node, $control_name)
	{
		// Deprecation warning.
		JLog::add('JElementRadio::fetchElement() is deprecated.',
JLog::WARNING, 'deprecated');

		$options = array();
		foreach ($node->children() as $option)
		{
			$val = $option->attributes('value');
			$text = $option->data();
			$options[] = JHtml::_('select.option', $val, $text);
		}

		return JHtml::_('select.radiolist', $options, '' .
$control_name . '[' . $name . ']', '',
'value', 'text', $value, $control_name . $name, true);
	}
}
libraries/coomla/html/parameter/element/spacer.php000064400000003464151160675320016352
0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  HTML
 *
 * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

/**
 * Renders a spacer element
 *
 * @package     Joomla.Platform
 * @subpackage  Parameter
 * @since       11.1
 * @deprecated  12.1   Use JFormFormFieldSpacer instead
 */
class JElementSpacer extends JElement
{
	/**
	 * Element name
	 *
	 * @var    string
	 */
	protected $_name = 'Spacer';

	/**
	 * Fetch tooltip for a radio button
	 *
	 * @param   string       $label         Element label
	 * @param   string       $description   Element description for tool tip
	 * @param   JXMLElement  &$node         JXMLElement node object
containing the settings for the element
	 * @param   string       $control_name  Control name
	 * @param   string       $name          The name.
	 *
	 * @return  string
	 *
	 * @deprecated    12.1
	 * @since   11.1
	 */
	public function fetchTooltip($label, $description, &$node,
$control_name = '', $name = '')
	{
		return '&#160;';
	}

	/**
	 * Fetch HTML for a radio button
	 *
	 * @param   string       $name          Element name
	 * @param   string       $value         Element value
	 * @param   JXMLElement  &$node         JXMLElement node object
containing the settings for the element
	 * @param   string       $control_name  Control name
	 *
	 * @return  string
	 *
	 * @deprecated    12.1  Use JFormFieldSpacer::getInput instead.
	 * @since   11.1
	 */
	public function fetchElement($name, $value, &$node, $control_name)
	{
		// Deprecation warning.
		JLog::add('JElementSpcer::fetchElements() is deprecated.',
JLog::WARNING, 'deprecated');

		if ($value)
		{
			return JText::_($value);
		}
		else
		{
			return ' ';
		}
	}
}
libraries/coomla/html/parameter/element/sql.php000064400000003465151160675320015675
0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  HTML
 *
 * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

/**
 * Renders a SQL element
 *
 * @package     Joomla.Platform
 * @subpackage  Parameter
 * @since       11.1
 * @deprecated  12.1    Use JFormFieldSQL Instead.
 */
class JElementSQL extends JElement
{
	/**
	 * Element name
	 *
	 * @var    string
	 */
	protected $_name = 'SQL';

	/**
	 * Fetch the sql element
	 *
	 * @param   string       $name          Element name
	 * @param   string       $value         Element value
	 * @param   JXMLElement  &$node         JXMLElement node object
containing the settings for the element
	 * @param   string       $control_name  Control name
	 *
	 * @return  string
	 *
	 * @deprecated  12.1
	 * @since   11.1
	 */
	public function fetchElement($name, $value, &$node, $control_name)
	{
		// Deprecation warning.
		JLog::add('JElementSQL::getOptions is deprecated.',
JLog::WARNING, 'deprecated');

		$db = JFactory::getDbo();
		$db->setQuery($node->attributes('query'));
		$key = ($node->attributes('key_field') ?
$node->attributes('key_field') : 'value');
		$val = ($node->attributes('value_field') ?
$node->attributes('value_field') : $name);

		$options = $db->loadObjectlist();

		// Check for an error.
		if ($db->getErrorNum())
		{
			JError::raiseWarning(500, $db->getErrorMsg());
			return false;
		}

		if (!$options)
		{
			$options = array();
		}

		return JHtml::_(
			'select.genericlist',
			$options,
			$control_name . '[' . $name . ']',
			array(
				'id' => $control_name . $name,
				'list.attr' => 'class="inputbox"',
				'list.select' => $value,
				'option.key' => $key,
				'option.text' => $val
			)
		);
	}
}
libraries/coomla/html/parameter/element/templatestyle.php000064400000004517151160675320017771
0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  HTML
 *
 * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

/**
 * Renders a list of template styles.
 *
 * @package     Joomla.Platform
 * @subpackage  Parameter
 * @since       11.1
 * @deprecated  12.1  Use JFormFieldTemplateStyle instead
 */
class JElementTemplateStyle extends JElement
{
	/**
	 * Element name
	 *
	 * @var    string
	 */
	protected $_name = 'TemplateStyle';

	/**
	 * Fetch the template style element
	 *
	 * @param   string       $name          Element name
	 * @param   string       $value         Element value
	 * @param   JXMLElement  &$node         JXMLElement node object
containing the settings for the element
	 * @param   string       $control_name  Control name
	 *
	 * @return  string
	 *
	 * @deprecated  12.1  Use JFormFieldTemplateStyle::getGroups  Instead
	 * @since   11.1
	 */
	public function fetchElement($name, $value, &$node, $control_name)
	{
		// Deprecation warning.
		JLog::add('JElementTemplateStyle::_fetchElement() is
deprecated.', JLog::WARNING, 'deprecated');

		$db = JFactory::getDBO();

		$query = 'SELECT * FROM #__template_styles ' . 'WHERE
client_id = 0 ' . 'AND home = 0';
		$db->setQuery($query);
		$data = $db->loadObjectList();

		$default = JHtml::_('select.option', 0,
JText::_('JOPTION_USE_DEFAULT'), 'id',
'description');
		array_unshift($data, $default);

		$selected = $this->_getSelected();
		$html = JHTML::_('select.genericlist', $data, $control_name .
'[' . $name . ']', 'class="inputbox"
size="6"', 'id', 'description',
$selected);

		return $html;
	}

	/**
	 * Get the selected template style.
	 *
	 * @return  integer  The template style id.
	 *
	 * @since   11.1
	 * @deprecated    12.1  Use jFormFieldTemplateStyle instead.
	 */
	protected function _getSelected()
	{
		// Deprecation warning.
		JLog::add('JElementTemplateStyle::_getSelected() is
deprecated.', JLog::WARNING, 'deprecated');

		$id = JRequest::getVar('cid', 0);
		$db = JFactory::getDBO();
		$query = $db->getQuery(true);
		$query->select($query->qn('template_style_id'))->from($query->qn('#__menu'))->where($query->qn('id')
. ' = ' . (int) $id[0]);
		$db->setQuery($query);
		$result = $db->loadResult();
		return $result;
	}
}
libraries/coomla/html/parameter/element/text.php000064400000003222151160675320016051
0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  HTML
 *
 * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

/**
 * Renders a text element
 *
 * @package     Joomla.Platform
 * @subpackage  Parameter
 * @since       11.1
 * @deprecated  12.1   Use JFormFormFieldText instead
 */
class JElementText extends JElement
{
	/**
	 * Element name
	 *
	 * @var    string
	 */
	protected $_name = 'Text';

	/**
	 * Fetch the text field element
	 *
	 * @param   string       $name          Element name
	 * @param   string       $value         Element value
	 * @param   JXMLElement  &$node         JXMLElement node object
containing the settings for the element
	 * @param   string       $control_name  Control name
	 *
	 * @return  string
	 *
	 * @deprecated  12.1  Use JFormFieldText::getInput instead.
	 * @since   11.1
	 */
	public function fetchElement($name, $value, &$node, $control_name)
	{
		// Deprecation warning.
		JLog::add('JElementText::_fetchElement() is deprecated.',
JLog::WARNING, 'deprecated');

		$size = ($node->attributes('size') ? 'size="'
. $node->attributes('size') . '"' :
'');
		$class = ($node->attributes('class') ?
'class="' . $node->attributes('class') .
'"' : 'class="text_area"');

		// Required to avoid a cycle of encoding &

		$value = htmlspecialchars(htmlspecialchars_decode($value, ENT_QUOTES),
ENT_QUOTES, 'UTF-8');

		return '<input type="text" name="' .
$control_name . '[' . $name . ']" id="' .
$control_name . $name . '" value="' . $value .
'" ' . $class
			. ' ' . $size . ' />';
	}
}
libraries/coomla/html/parameter/element/textarea.php000064400000003167151160675320016712
0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  HTML
 *
 * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

/**
 * Renders a textarea element
 *
 * @package     Joomla.Platform
 * @subpackage  Parameter
 * @since       11.1
 * @deprecated  12.1   Use JFormFieldTextArea instead
 */
class JElementTextarea extends JElement
{
	/**
	 * Element name
	 *
	 * @var    string
	 */
	protected $_name = 'Textarea';

	/**
	 * Fetch the element
	 *
	 * @param   string       $name          Element name
	 * @param   string       $value         Element value
	 * @param   JXMLElement  &$node         JXMLElement node object
containing the settings for the element
	 * @param   string       $control_name  Control name
	 *
	 * @return  string
	 *
	 * @deprecated  12.1  Use JFormFieldTextArea::getInput
	 * @since   11.1
	 */
	public function fetchElement($name, $value, &$node, $control_name)
	{
		// Deprecation warning.
		JLog::add('JElementTextArea::_fetchElement() is deprecated.',
JLog::WARNING, 'deprecated');

		$rows = $node->attributes('rows');
		$cols = $node->attributes('cols');
		$class = ($node->attributes('class') ?
'class="' . $node->attributes('class') .
'"' : 'class="text_area"');
		// Convert <br /> tags so they are not visible when editing
		$value = str_replace('<br />', "\n", $value);

		return '<textarea name="' . $control_name .
'[' . $name . ']" cols="' . $cols .
'" rows="' . $rows . '" ' . $class .
' id="' . $control_name
			. $name . '" >' . $value .
'</textarea>';
	}
}
libraries/coomla/html/parameter/element/timezones.php000064400000012062151160675320017104
0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  HTML
 *
 * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

/**
 * Renders a timezones element
 *
 * @package     Joomla.Platform
 * @subpackage  Parameter
 * @since       11.1
 * @deprecated  12.1   Use JFormFieldTimeZone instead.
 * @note        In updating note that JFormFieldTimeZone does not end in s.
 */
class JElementTimezones extends JElement
{
	/**
	 * Element name
	 *
	 * @var   string
	 */
	protected $_name = 'Timezones';

	/**
	 * Fetch the timezones element
	 *
	 * @param   string       $name          Element name
	 * @param   string       $value         Element value
	 * @param   JXMLElement  &$node         JXMLElement node object
containing the settings for the element
	 * @param   string       $control_name  Control name
	 *
	 * @return  string
	 *
	 * @deprecated    12.1  Use JFormFieldTimeZone::getGroups instead.
	 * @note    In updating note that JFormFieldTimeZone does not have an s at
the end.
	 * @since   11.1
	 */
	public function fetchElement($name, $value, &$node, $control_name)
	{
		// Deprecation warning.
		JLog::add('JElementTimeZones::_fetchElement() is deprecated.',
JLog::WARNING, 'deprecated');

		if (!strlen($value))
		{
			$conf = JFactory::getConfig();
			$value = $conf->get('offset');
		}

		// LOCALE SETTINGS
		$timezones = array(JHtml::_('select.option', -12,
JText::_('UTC__12_00__INTERNATIONAL_DATE_LINE_WEST')),
			JHtml::_('select.option', -11,
JText::_('UTC__11_00__MIDWAY_ISLAND__SAMOA')),
			JHtml::_('select.option', -10,
JText::_('UTC__10_00__HAWAII')),
			JHtml::_('select.option', -9.5,
JText::_('UTC__09_30__TAIOHAE__MARQUESAS_ISLANDS')),
			JHtml::_('select.option', -9,
JText::_('UTC__09_00__ALASKA')),
			JHtml::_('select.option', -8,
JText::_('UTC__08_00__PACIFIC_TIME__US__AMP__CANADA_')),
			JHtml::_('select.option', -7,
JText::_('UTC__07_00__MOUNTAIN_TIME__US__AMP__CANADA_')),
			JHtml::_('select.option', -6,
JText::_('UTC__06_00__CENTRAL_TIME__US__AMP__CANADA___MEXICO_CITY')),
			JHtml::_('select.option', -5,
JText::_('UTC__05_00__EASTERN_TIME__US__AMP__CANADA___BOGOTA__LIMA')),
			JHtml::_('select.option', -4,
JText::_('UTC__04_00__ATLANTIC_TIME__CANADA___CARACAS__LA_PAZ')),
			JHtml::_('select.option', -4.5,
JText::_('UTC__04_30__VENEZUELA')),
			JHtml::_('select.option', -3.5,
JText::_('UTC__03_30__ST__JOHN_S__NEWFOUNDLAND__LABRADOR')),
			JHtml::_('select.option', -3,
JText::_('UTC__03_00__BRAZIL__BUENOS_AIRES__GEORGETOWN')),
			JHtml::_('select.option', -2,
JText::_('UTC__02_00__MID_ATLANTIC')),
			JHtml::_('select.option', -1,
JText::_('UTC__01_00__AZORES__CAPE_VERDE_ISLANDS')),
			JHtml::_('select.option', 0,
JText::_('UTC_00_00__WESTERN_EUROPE_TIME__LONDON__LISBON__CASABLANCA')),
			JHtml::_('select.option', 1,
JText::_('UTC__01_00__AMSTERDAM__BERLIN__BRUSSELS__COPENHAGEN__MADRID__PARIS')),
			JHtml::_('select.option', 2,
JText::_('UTC__02_00__ISTANBUL__JERUSALEM__KALININGRAD__SOUTH_AFRICA')),
			JHtml::_('select.option', 3,
JText::_('UTC__03_00__BAGHDAD__RIYADH__MOSCOW__ST__PETERSBURG')),
			JHtml::_('select.option', 3.5,
JText::_('UTC__03_30__TEHRAN')),
			JHtml::_('select.option', 4,
JText::_('UTC__04_00__ABU_DHABI__MUSCAT__BAKU__TBILISI')),
			JHtml::_('select.option', 4.5,
JText::_('UTC__04_30__KABUL')),
			JHtml::_('select.option', 5,
JText::_('UTC__05_00__EKATERINBURG__ISLAMABAD__KARACHI__TASHKENT')),
			JHtml::_('select.option', 5.5,
JText::_('UTC__05_30__BOMBAY__CALCUTTA__MADRAS__NEW_DELHI__COLOMBO')),
			JHtml::_('select.option', 5.75,
JText::_('UTC__05_45__KATHMANDU')),
JHtml::_('select.option', 6,
JText::_('UTC__06_00__ALMATY__DHAKA')),
			JHtml::_('select.option', 6.5,
JText::_('UTC__06_30__YAGOON')),
			JHtml::_('select.option', 7,
JText::_('UTC__07_00__BANGKOK__HANOI__JAKARTA__PHNOM_PENH')),
			JHtml::_('select.option', 8,
JText::_('UTC__08_00__BEIJING__PERTH__SINGAPORE__HONG_KONG')),
			JHtml::_('select.option', 8.75,
JText::_('UTC__08_00__WESTERN_AUSTRALIA')),
			JHtml::_('select.option', 9,
JText::_('UTC__09_00__TOKYO__SEOUL__OSAKA__SAPPORO__YAKUTSK')),
			JHtml::_('select.option', 9.5,
JText::_('UTC__09_30__ADELAIDE__DARWIN__YAKUTSK')),
			JHtml::_('select.option', 10,
JText::_('UTC__10_00__EASTERN_AUSTRALIA__GUAM__VLADIVOSTOK')),
			JHtml::_('select.option', 10.5,
JText::_('UTC__10_30__LORD_HOWE_ISLAND__AUSTRALIA_')),
			JHtml::_('select.option', 11,
JText::_('UTC__11_00__MAGADAN__SOLOMON_ISLANDS__NEW_CALEDONIA')),
			JHtml::_('select.option', 11.5,
JText::_('UTC__11_30__NORFOLK_ISLAND')),
			JHtml::_('select.option', 12,
JText::_('UTC__12_00__AUCKLAND__WELLINGTON__FIJI__KAMCHATKA')),
			JHtml::_('select.option', 12.75,
JText::_('UTC__12_45__CHATHAM_ISLAND')),
JHtml::_('select.option', 13,
JText::_('UTC__13_00__TONGA')),
			JHtml::_('select.option', 14,
JText::_('UTC__14_00__KIRIBATI')));

		return JHtml::_(
			'select.genericlist',
			$timezones,
			$control_name . '[' . $name . ']',
			array('id' => $control_name . $name, 'list.attr'
=> 'class="inputbox"', 'list.select' =>
$value)
		);
	}
}
libraries/coomla/html/parameter/element/usergroup.php000064400000003366151160675320017131
0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  HTML
 *
 * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

/**
 * Renders a editors element
 *
 * @package     Joomla.Platform
 * @subpackage  Parameter
 * @since       11.1
 * @deprecated  12.1  Use JFormFieldUserGroup instead.
 */
class JElementUserGroup extends JElement
{
	/**
	 * Element name
	 *
	 * @var    string
	 */
	protected $_name = 'UserGroup';

	/**
	 * Fetch the timezones element
	 *
	 * @param   string       $name          Element name
	 * @param   string       $value         Element value
	 * @param   JXMLElement  &$node         JXMLElement node object
containing the settings for the element
	 * @param   string       $control_name  Control name
	 *
	 * @return  string
	 *
	 * @deprecated  12.1  Use JFormFieldUserGroup::getInput instead.
	 * @since   11.1
	 */
	public function fetchElement($name, $value, &$node, $control_name)
	{
		// Deprecation warning.
		JLog::add('JElementUserGroup::_fetchElement() is deprecated.',
JLog::WARNING, 'deprecated');

		$ctrl = $control_name . '[' . $name . ']';
		$attribs = ' ';

		if ($v = $node->attributes('size'))
		{
			$attribs .= 'size="' . $v . '"';
		}
		if ($v = $node->attributes('class'))
		{
			$attribs .= 'class="' . $v . '"';
		}
		else
		{
			$attribs .= 'class="inputbox"';
		}
		if ($m = $node->attributes('multiple'))
		{
			$attribs .= 'multiple="multiple"';
			$ctrl .= '[]';
			//$value		= implode('|',)
		}
		//array_unshift($editors, JHtml::_('select.option', 
'', '- '. JText::_('SELECT_EDITOR') .'
-'));

		return JHtml::_('access.usergroup', $ctrl, $value, $attribs,
false);
	}
}
libraries/coomla/html/parameter/element.php000064400000007531151160675320015074
0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  HTML
 *
 * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

/**
 * Parameter base class
 *
 * The JElement is the base class for all JElement types
 *
 * @package     Joomla.Platform
 * @subpackage  Parameter
 * @since       11.1
 * @deprecated  12.1    Use JFormField instead
 */
class JElement extends JObject
{
	/**
	 * Element name
	 *
	 * This has to be set in the final
	 * renderer classes.
	 *
	 * @var    string
	 * @since  11.1
	 */
	protected $_name = null;

	/**
	 * Reference to the object that instantiated the element
	 *
	 * @var    object
	 * @since  11.1
	 */
	protected $_parent = null;

	/**
	 * Constructor
	 *
	 * @param   string  $parent  Element parent
	 *
	 * @since   11.1
	 */
	public function __construct($parent = null)
	{
		// Deprecation warning.
		JLog::add('JElement::__construct is deprecated.',
JLog::WARNING, 'deprecated');

		$this->_parent = $parent;
	}

	/**
	 * Get the element name
	 *
	 * @return  string  type of the parameter
	 *
	 * @since   11.1
	 * @deprecated    12.1
	 */
	public function getName()
	{
		// Deprecation warning.
		JLog::add('Jelement::getName is deprecated.', JLog::WARNING,
'deprecated');

		return $this->_name;
	}

	/**
	 * Method to render an xml element
	 *
	 * @param   string  &$xmlElement   Name of the element
	 * @param   string  $value         Value of the element
	 * @param   string  $control_name  Name of the control
	 *
	 * @return  array  Attributes of an element
	 *
	 * @deprecated    12.1
	 * @since   11.1
	 */
	public function render(&$xmlElement, $value, $control_name =
'params')
	{
		// Deprecation warning.
		JLog::add('JElement::render is deprecated.', JLog::WARNING,
'deprecated');

		$name = $xmlElement->attributes('name');
		$label = $xmlElement->attributes('label');
		$descr = $xmlElement->attributes('description');

		//make sure we have a valid label
		$label = $label ? $label : $name;
		$result[0] = $this->fetchTooltip($label, $descr, $xmlElement,
$control_name, $name);
		$result[1] = $this->fetchElement($name, $value, $xmlElement,
$control_name);
		$result[2] = $descr;
		$result[3] = $label;
		$result[4] = $value;
		$result[5] = $name;

		return $result;
	}

	/**
	 * Method to get a tool tip from an XML element
	 *
	 * @param   string       $label         Label attribute for the element
	 * @param   string       $description   Description attribute for the
element
	 * @param   JXMLElement  &$xmlElement   The element object
	 * @param   string       $control_name  Control name
	 * @param   string       $name          Name attribut
	 *
	 * @return  string
	 *
	 * @deprecated  12.1
	 * @since   11.1
	 */
	public function fetchTooltip($label, $description, &$xmlElement,
$control_name = '', $name = '')
	{
		// Deprecation warning.
		JLog::add('JElement::fetchTooltip is deprecated.',
JLog::WARNING, 'deprecated');

		$output = '<label id="' . $control_name . $name .
'-lbl" for="' . $control_name . $name .
'"';
		if ($description)
		{
			$output .= ' class="hasTip" title="' .
JText::_($label) . '::' . JText::_($description) .
'">';
		}
		else
		{
			$output .= '>';
		}
		$output .= JText::_($label) . '</label>';

		return $output;
	}

	/**
	 * Fetch an element
	 *
	 * @param   string       $name          Name attribute of the element
	 * @param   string       $value         Value attribute of the element
	 * @param   JXMLElement  &$xmlElement   Element object
	 * @param   string       $control_name  Control name of the element
	 *
	 * @return  void
	 *
	 * @deprecated    12.1
	 * @since   11.1
	 */
	public function fetchElement($name, $value, &$xmlElement,
$control_name)
	{
		// Deprecation warning.
		JLog::add('JElement::fetchElement is deprecated.',
JLog::WARNING, 'deprecated');

	}
}
libraries/coomla/html/parameter/index.html000064400000000037151160675320014721
0ustar00<!DOCTYPE html><title></title>
libraries/coomla/html/parameter.php000064400000030254151160675320013441
0ustar00<?php
/**
 * mod_vertical_menu - Vertical Menu
 *
 * @author    Balint Polgarfi
 * @copyright 2014-2019 Offlajn.com
 * @license   https://gnu.org/licenses/gpl-2.0.html
 * @link      https://offlajn.com
 */
?><?php
/*-------------------------------------------------------------------------
# plg_offlajnjoomla3compat - Offlajn Joomla 3 Compatibility
# -------------------------------------------------------------------------
# @ author    Jeno Kovacs
# @ copyright Copyright (C) 2014 Offlajn.com  All Rights Reserved.
# @ license   http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# @ website   http://www.offlajn.com
-------------------------------------------------------------------------*/
?><?php
/**
 * @package     Joomla.Platform
 * @subpackage  HTML
 *
 * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

// Register the element class with the loader.
JLoader::register('JElement', dirname(__FILE__) .
'/parameter/element.php');

/**
 * Parameter handler
 *
 * @package     Joomla.Platform
 * @subpackage  Parameter
 * @since       11.1
 * @deprecated  12.1  Use JForm instead
 */
class OfflajnBaseJParameter extends JRegistry
{
	/**
	 * @var    string  The raw params string
	 * @since  11.1
	 */
	protected $_raw = null;

	/**
	 * @var    object  The XML params element
	 * @since  11.1
	 */
	protected $_xml = null;

	/**
	 * @var    array  Loaded elements
	 * @since  11.1
	 */
	protected $_elements = array();

	/**
	 * @var    array  Directories, where element types can be stored
	 * @since  11.1
	 */
	protected $_elementPath = array();

	/**
	 * Constructor
	 *
	 * @param   string  $data  The raw parms text.
	 * @param   string  $path  Path to the XML setup file.
	 *
	 * @deprecated  12.1
	 * @since   11.1
	 */
	public function __construct($data = '', $path = '')
	{
		// Deprecation warning.
		JLog::add('JParameter::__construct is deprecated.',
JLog::WARNING, 'deprecated');

		parent::__construct('_default');

		// Set base path.
		$this->_elementPath[] = dirname(__FILE__) .
'/parameter/element';

		if ($data = trim($data))
		{
			if (strpos($data, '{') === 0)
			{
				$this->loadString($data);
			}
			else
			{
				$this->loadINI($data);
			}
		}

		if ($path)
		{
			$this->loadSetupFile($path);
		}

		$this->_raw = $data;
	}

	/**
	 * Sets a default value if not alreay assigned.
	 *
	 * @param   string  $key      The name of the parameter.
	 * @param   string  $default  An optional value for the parameter.
	 * @param   string  $group    An optional group for the parameter.
	 *
	 * @return  string  The value set, or the default if the value was not
previously set (or null).
	 *
	 * @deprecated  12.1
	 * @since   11.1
	 */
	public function def($key, $default = '', $group =
'_default')
	{
		// Deprecation warning.
		JLog::add('JParameter::def is deprecated.', JLog::WARNING,
'deprecated');

		$value = $this->get($key, (string) $default, $group);

		return $this->set($key, $value);
	}

	/**
	 * Sets the XML object from custom XML files.
	 *
	 * @param   JSimpleXMLElement  &$xml  An XML object.
	 *
	 * @return  void
	 *
	 * @deprecated  12.1
	 * @since   11.1
	 */
	public function setXML(&$xml)
	{

		// Deprecation warning.
		JLog::add('JParameter::setXML is deprecated.', JLog::WARNING,
'deprecated');

		if (is_object($xml))
		{
      $attrs = $xml->attributes();
			if (isset($attrs['group']) && $group =
$attrs['group'])
			{
				$this->_xml[$group] = $xml;
			}
			else
			{
				$this->_xml['_default'] = $xml;
			}

			if (isset($attrs['addpath']) && $dir =
$attrs['addpath'])
			{
				$this->addElementPath(JPATH_ROOT . str_replace('/',
DIRECTORY_SEPARATOR, $dir));
			}
		}
	}

	/**
	 * Bind data to the parameter.
	 *
	 * @param   mixed   $data   An array or object.
	 * @param   string  $group  An optional group that the data should bind
to. The default group is used if not supplied.
	 *
	 * @return  boolean  True if the data was successfully bound, false
otherwise.
	 *
	 * @deprecated  12.1
	 * @since   11.1
	 */
	public function bind($data, $group = '_default')
	{
		// Deprecation warning.
		JLog::add('JParameter::bind is deprecated.', JLog::WARNING,
'deprecated');

		if (is_array($data))
		{

			return $this->loadArray($data);
		}
		elseif (is_object($data))
		{
			return $this->loadObject($data);
		}
		else
		{
			return $this->loadString($data);
		}
	}

	/**
	 * Render the form control.
	 *
	 * @param   string  $name   An optional name of the HTML form control. The
default is 'params' if not supplied.
	 * @param   string  $group  An optional group to render.  The default
group is used if not supplied.
	 *
	 * @return  string  HTML
	 *
	 * @deprecated  12.1
	 * @since   11.1
	 */
	public function render($name = 'params', $group =
'_default')
	{
		// Deprecation warning.
		JLog::add('JParameter::render is deprecated.', JLog::WARNING,
'deprecated');

		if (!isset($this->_xml[$group]))
		{
			return false;
		}

		$params = $this->getParams($name, $group);
		$html = array();

    $attrs = $this->_xml[$group]->attributes();
		if ($description = $attrs['description'])
		{
			// Add the params description to the display
			$desc = JText::_($description);
			$html[] = '<p class="paramrow_desc">' . $desc
. '</p>';
		}

		foreach ($params as $param)
		{
			if ($param[0])
			{
				$html[] = $param[0];
				$html[] = $param[1];
			}
			else
			{
				$html[] = $param[1];
			}
		}

		if (count($params) < 1)
		{
			$html[] = "<p class=\"noparams\">" .
JText::_('JLIB_HTML_NO_PARAMETERS_FOR_THIS_ITEM') .
"</p>";
		}

		return implode(PHP_EOL, $html);
	}

	/**
	 * Render all parameters to an array.
	 *
	 * @param   string  $name   An optional name of the HTML form control. The
default is 'params' if not supplied.
	 * @param   string  $group  An optional group to render.  The default
group is used if not supplied.
	 *
	 * @return  array
	 *
	 * @deprecated  12.1
	 * @since   11.1
	 */
	public function renderToArray($name = 'params', $group =
'_default')
	{

		// Deprecation warning.
		JLog::add('JParameter::renderToArray is deprecated.',
JLog::WARNING, 'deprecated');

		if (!isset($this->_xml[$group]))
		{
			return false;
		}
		$results = array();
		foreach ($this->_xml[$group]->children() as $param)
		{
			$result = $this->getParam($param, $name, $group);
			$results[$result[5]] = $result;
		}
		return $results;
	}

	/**
	 * Return the number of parameters in a group.
	 *
	 * @param   string  $group  An optional group. The default group is used
if not supplied.
	 *
	 * @return  mixed  False if no params exist or integer number of
parameters that exist.
	 *
	 * @deprecated  12.1
	 * @since   11.1
	 */
	public function getNumParams($group = '_default')
	{
		// Deprecation warning.
		JLog::add('JParameter::getNumParams is deprecated.',
JLog::WARNING, 'deprecated');

		if (!isset($this->_xml[$group]) ||
!count($this->_xml[$group]->children()))
		{
			return false;
		}
		else
		{
			return count($this->_xml[$group]->children());
		}
	}

	/**
	 * Get the number of params in each group.
	 *
	 * @return  array  Array of all group names as key and parameters count as
value.
	 *
	 * @deprecated  12.1
	 * @since   11.1
	 */
	public function getGroups()
	{
		// Deprecation warning.
		JLog::add('JParameter::getGroups is deprecated.',
JLog::WARNING, 'deprecated');

		if (!is_array($this->_xml))
		{

			return false;
		}

		$results = array();
		foreach ($this->_xml as $name => $group)
		{
			$results[$name] = $this->getNumParams($name);
		}
		return $results;
	}

	/**
	 * Render all parameters.
	 *
	 * @param   string  $name   An optional name of the HTML form control. The
default is 'params' if not supplied.
	 * @param   string  $group  An optional group to render.  The default
group is used if not supplied.
	 *
	 * @return  array  An array of all parameters, each as array of the label,
the form element and the tooltip.
	 *
	 * @deprecated  12.1
	 * @since   11.1
	 */
	public function getParams($name = 'params', $group =
'_default')
	{

		// Deprecation warning.
		JLog::add('JParameter::getParams is deprecated.',
JLog::WARNING, 'deprecated');

		if (!isset($this->_xml[$group]))
		{

			return false;
		}

		$results = array();
		foreach ($this->_xml[$group]->children() as $param)
		{
			$results[] = $this->getParam($param, $name, $group);
		}
		return $results;
	}

	/**
	 * Render a parameter type.
	 *
	 * @param   object  &$node         A parameter XML element.
	 * @param   string  $control_name  An optional name of the HTML form
control. The default is 'params' if not supplied.
	 * @param   string  $group         An optional group to render.  The
default group is used if not supplied.
	 *
	 * @return  array  Any array of the label, the form element and the
tooltip.
	 *
	 * @deprecated  12.1
	 * @since   11.1
	 */
	public function getParam(&$node, $control_name = 'params',
$group = '_default')
	{
		// Deprecation warning.
		JLog::add('JParameter::__construct is deprecated.',
JLog::WARNING, 'deprecated');

		// Get the type of the parameter.
    $attrs = $node->attributes();
		$type = $attrs['type'];

		$element = $this->loadElement($type);

		// Check for an error.
		if ($element === false)
		{
			$result = array();
			$result[0] = $attrs['name'];
			$result[1] = JText::_('Element not defined for type') . '
= ' . $type;
			$result[5] = $result[0];
			return $result;
		}
    if(!isset($attrs['name'])) $attrs['name'] =
'';
    if(!isset($attrs['default'])) $attrs['default'] =
'';
		// Get value.
		$value = $this->get($attrs['name'],
$attrs['default'], $group);

		return $element->render($node, $value, $control_name);
	}

	/**
	 * Loads an XML setup file and parses it.
	 *
	 * @param   string  $path  A path to the XML setup file.
	 *
	 * @return  object
	 *
	 * @deprecated  12.1
	 * @since   11.1
	 */
	public function loadSetupFile($path)
	{
		$result = false;

		if ($path)
		{
      $xml = new JSimpleXML();

			if ($xml->loadFile($path))
			{
				if ($params = $xml->document->params)
				{
					foreach ($params as $param)
					{
						$this->setXML($param);
						$result = true;
					}
				}
			}
		}
		else
		{
			$result = true;
		}

		return $result;
	}

	/**
	 * Loads an element type.
	 *
	 * @param   string   $type  The element type.
	 * @param   boolean  $new   False (default) to reuse parameter elements;
true to load the parameter element type again.
	 *
	 * @return  object
	 *
	 * @deprecated  12.1
	 * @since   11.1
	 */
	public function loadElement($type, $new = false)
	{
		$signature = md5($type);

		if ((isset($this->_elements[$signature]) &&
!($this->_elements[$signature] instanceof __PHP_Incomplete_Class))
&& $new === false)
		{
			return $this->_elements[$signature];
		}

		$elementClass = 'JElement' . $type;
		if (!class_exists($elementClass))
		{
			if (isset($this->_elementPath))
			{
				$dirs = $this->_elementPath;
			}
			else
			{
				$dirs = array();
			}

			$file = JFilterInput::getInstance()->clean(str_replace('_',
DIRECTORY_SEPARATOR, $type) . '.php', 'path');

			jimport('joomla.filesystem.path');
			if ($elementFile = JPath::find($dirs, $file))
			{
				include_once $elementFile;
			}
			else
			{
				$false = false;
				return $false;
			}
		}

		if (!class_exists($elementClass))
		{
			$false = false;
			return $false;
		}

		$this->_elements[$signature] = new $elementClass($this);

		return $this->_elements[$signature];
	}

	/**
	 * Add a directory where JParameter should search for element types.
	 *
	 * You may either pass a string or an array of directories.
	 *
	 * JParameter will be searching for a element type in the same
	 * order you added them. If the parameter type cannot be found in
	 * the custom folders, it will look in
	 * JParameter/types.
	 *
	 * @param   mixed  $path  Directory (string) or directories (array) to
search.
	 *
	 * @return  void
	 *
	 * @deprecated  12.1
	 * @since   11.1
	 */
	public function addElementPath($path)
	{
		// Just force path to array.
		settype($path, 'array');

		// Loop through the path directories.
		foreach ($path as $dir)
		{
			// No surrounding spaces allowed!
			$dir = trim($dir);

			// Add trailing separators as needed.
			if (substr($dir, -1) != DIRECTORY_SEPARATOR)
			{
				// Directory
				$dir .= DIRECTORY_SEPARATOR;
			}

			// Add to the top of the search dirs.
			array_unshift($this->_elementPath, $dir);
		}
	}
}
libraries/coomla/index.html000064400000000037151160675320011775
0ustar00<!DOCTYPE html><title></title>
libraries/coomla/utilities/index.html000064400000000037151160675320014010
0ustar00<!DOCTYPE html><title></title>
libraries/coomla/utilities/simplexml.php000064400000052737151160675320014554
0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  Utilities
 *
 * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

/**
 * SimpleXML implementation.
 *
 * The XML Parser extension (expat) is required to use JSimpleXML.
 *
 * The class provides a pure PHP4 implementation of the PHP5
 * interface SimpleXML. As with PHP5's SimpleXML it is what it says:
 * simple. Nevertheless, it is an easy way to deal with XML data,
 * especially for read only access.
 *
 * Because it's not possible to use the PHP5 ArrayIterator interface
 * with PHP4 there are some differences between this implementation
 * and that of PHP5:
 *
 * 		The access to the root node has to be explicit in
 * 		JSimpleXML, not implicit as with PHP5. Write
 * 		$xml->document->node instead of $xml->node
 * 		You cannot access CDATA using array syntax. Use the method data()
instead
 * 		You cannot access attributes directly with array syntax. Use
attributes()
 * 		to read them.
 * 		Comments are ignored.
 * 		Last and least, this is not as fast as PHP5 SimpleXML--it is pure
PHP4.
 *
 * Example:
 * <code>
 * :simple.xml:
 * <?xml version="1.0" encoding="utf-8"
standalone="yes"?>
 * <document>
 *   <node>
 *	<child gender="m">Tom Foo</child>
 *	<child gender="f">Tamara Bar</child>
 *   <node>
 * </document>
 *
 * ---
 *
 * // read and write a document
 * $xml = new JSimpleXML;
 * $xml->loadFile('simple.xml');
 * print $xml->document->toString();
 *
 * // access a given node's CDATA
 * print $xml->root->node->child[0]->data(); // Tom Foo
 *
 * // access attributes
 * $attr = $xml->root->node->child[1]->attributes();
 * print $attr['gender']; // f
 *
 * // access children
 * foreach($xml->root->node->children() as $child) {
 *   print $child->data();
 * }
 * </code>
 *
 * Note: JSimpleXML cannot be used to access sophisticated XML doctypes
 * using datatype ANY (e.g. XHTML). With a DOM implementation you can
 * handle this.
 *
 * @package     Joomla.Platform
 * @subpackage  Utilities
 * @see         http://www.php.net/manual/en/book.simplexml.php
 * @since       11.1
 * @deprecated  12.1  Use SimpleXML instead
 */
if(!class_exists('JSimpleXML')){
class JSimpleXML extends JObject
{
	/**
	 * The XML parser
	 *
	 * @var     resource
	 * @since   11.1
	 */
	private $_parser = null;

	/**
	 * Document element
	 *
	 * @var     object
	 * @since   11.1
	 */
	public $document = null;

	/**
	 * Current object depth
	 *
	 * @var      array
	 * @since   11.1
	 */
	private $_stack = array();

	/**
	 * Constructor.
	 *
	 * @param   array  $options  Options
	 *
	 * @deprecated    12.1   Use SimpleXML instead.
	 * @see           http://www.php.net/manual/en/book.simplexml.php
	 * @since    11.1
	 */
	public function __construct($options = null)
	{
		// Deprecation warning.
		JLog::add('JSimpleXML::__construct() is deprecated.',
JLog::WARNING, 'deprecated');

		if (! function_exists('xml_parser_create'))
		{
			// TODO throw warning
			return false;
		}

		// Create the parser resource and make sure both versions of PHP
autodetect the format.
		$this->_parser = xml_parser_create('');

		// Check parser resource
		xml_set_object($this->_parser, $this);
		xml_parser_set_option($this->_parser, XML_OPTION_CASE_FOLDING, 0);
		if (is_array($options))
		{
			foreach ($options as $option => $value)
			{
				xml_parser_set_option($this->_parser, $option, $value);
			}
		}

		// Set the handlers
		xml_set_element_handler($this->_parser, '_startElement',
'_endElement');
		xml_set_character_data_handler($this->_parser,
'_characterData');
	}

	/**
	 * Interprets a string of XML into an object
	 *
	 * This function will take the well-formed XML string data and return an
object of class
	 * JSimpleXMLElement with properties containing the data held within the
XML document.
	 * If any errors occur, it returns FALSE.
	 *
	 * @param   string  $string     Well-formed XML string data
	 * @param   string  $classname  currently ignored
	 *
	 * @return  object  JSimpleXMLElement
	 *
	 * @since   11.1
	 *
	 * @deprecated    12.1  Use simpleXML_load_string
	 * @see          
http://www.php.net/manual/en/function.simplexml-load-string.php
	 */
	public function loadString($string, $classname = null)
	{
		// Deprecation warning.
		JLog::add('JSimpleXML::loadString() is deprecated.',
JLog::WARNING, 'deprecated');

		$this->_parse($string);

		return true;
	}

	/**
	 * Interprets an XML file into an object
	 *
	 * This function will convert the well-formed XML document in the file
specified by filename
	 * to an object  of class JSimpleXMLElement. If any errors occur during
file access or
	 * interpretation, the function returns FALSE.
	 *
	 * @param   string  $path       Path to XML file containing a well-formed
XML document
	 * @param   string  $classname  currently ignored
	 *
	 * @return  boolean  True if successful, false if file empty
	 *
	 * @deprecated     12.1  Use simplexml_load_file instead
	 * @see           
http://www.php.net/manual/en/function.simplexml-load-file.php
	 * @since   11.1
	 */
	public function loadFile($path, $classname = null)
	{
		// Deprecation warning.
		JLog::add('JSimpleXML::loadfile() is deprecated.',
JLog::WARNING, 'deprecated');

		//Check to see of the path exists
		if (!file_exists($path))
		{

			return false;
		}

		//Get the XML document loaded into a variable
		$xml = trim(file_get_contents($path));
		if ($xml == '')
		{
			return false;
		}
		else
		{
			$this->_parse($xml);

			return true;
		}
	}

	/**
	 * Get a JSimpleXMLElement object from a DOM node.
	 *
	 * This function takes a node of a DOM  document and makes it into a
JSimpleXML node.
	 * This new object can then be used as a native JSimpleXML element. If any
errors occur,
	 * it returns FALSE.
	 *
	 * @param   string  $node       DOM  document
	 * @param   string  $classname  currently ignored
	 *
	 * @return  mixed  JSimpleXMLElement or false if any errors occur
	 *
	 * @deprecated    12.1    use simplexml_import_dom instead.
	 * @see          
http://www.php.net/manual/en/function.simplexml-import-dom.php
	 * @since   11.1
	 */
	public function importDOM($node, $classname = null)
	{
		// Deprecation warning.
		JLog::add('JSimpleXML::importDOM() is deprecated.',
JLog::WARNING, 'deprecated');

		return false;
	}

	/**
	 * Get the parser
	 *
	 * @return  resource  XML parser resource handle
	 *
	 * @deprecated    12.1   Use SimpleXMLElement
	 * @see           http://www.php.net/manual/en/class.simplexmlelement.php
	 * @since   11.1
	 */
	public function getParser()
	{
		// Deprecation warning.
		JLog::add('JSimpleXML::getParser() is deprecated.',
JLog::WARNING, 'deprecated');

		return $this->_parser;
	}

	/**
	 * Set the parser
	 *
	 * @param   resource  $parser  XML parser resource handle.
	 *
	 * @return  void
	 *
	 * @deprecated    12.1  Use SimpleXML
	 * @see     http://www.php.net/manual/en/class.simplexml.php
	 * @since   11.1
	 */
	public function setParser($parser)
	{
		// Deprecation warning.
		JLog::add('JSimpleXML::setParser() is deprecated.',
JLog::WARNING, 'deprecated');

		$this->_parser = $parser;
	}

	/**
	 * Start parsing an XML document
	 *
	 * Parses an XML document. The handlers for the configured events are
called as many times as necessary.
	 *
	 * @param   string  $data  data to parse
	 *
	 * @return  void
	 *
	 * @deprecated    12.1
	 * @see     http://www.php.net/manual/en/class.simplexml.php
	 * @since   11.1
	 */
	protected function _parse($data = '')
	{
		// Deprecation warning.
		JLog::add('JSimpleXML::_parse() is deprecated.', JLog::WARNING,
'deprecated');

		//Error handling
		if (!xml_parse($this->_parser, $data))
		{
			$this->_handleError(
				xml_get_error_code($this->_parser),
xml_get_current_line_number($this->_parser),
				xml_get_current_column_number($this->_parser)
			);
		}

		//Free the parser
		xml_parser_free($this->_parser);
	}

	/**
	 * Handles an XML parsing error
	 *
	 * @param   integer  $code  XML Error Code.
	 * @param   integer  $line  Line on which the error happened.
	 * @param   integer  $col   Column on which the error happened.
	 *
	 * @return  void
	 *
	 * @deprecated  12.1
	 * @since   11.1
	 *
	 * @deprecated   12.1   Use PHP Exception
	 */
	protected function _handleError($code, $line, $col)
	{
		// Deprecation warning.
		JLog::add('JSimpleXML::_handleError() is deprecated.',
JLog::WARNING, 'deprecated');

		JError::raiseWarning('SOME_ERROR_CODE', 'XML Parsing Error
at ' . $line . ':' . $col . '. Error ' . $code .
': ' . xml_error_string($code));

	}

	/**
	 * Gets the reference to the current direct parent
	 *
	 * @return  object
	 *
	 * @since   11.1
	 *
	 * @deprecated   12.1
	 */
	protected function _getStackLocation()
	{
		// Deprecation warning.
		JLog::add('JSimpleXML::_getStackLocation() is deprecated.',
JLog::WARNING, 'deprecated');

		$return = '';
		foreach ($this->_stack as $stack)
		{
			$return .= $stack . '->';
		}

		return rtrim($return, '->');
	}

	/**
	 * Handler function for the start of a tag
	 *
	 * @param   resource  $parser  The XML parser.
	 * @param   string    $name    The name of the element.
	 * @param   array     $attrs   A key-value array (optional) of the
attributes for the element.
	 *
	 * @return  void
	 *
	 * @since   11.1
	 *
	 * @deprecated  12.1
	 */
	protected function _startElement($parser, $name, $attrs = array())
	{
		// Deprecation warning.
		JLog::add('JSimpleXML::startElement() is deprecated.',
JLog::WARNING, 'deprecated');

		//  Check to see if tag is root-level
		$count = count($this->_stack);
		if ($count == 0)
		{
			// If so, set the document as the current tag
			$classname = get_class($this) . 'Element';
			$this->document = new $classname($name, $attrs);

			// And start out the stack with the document tag
			$this->_stack = array('document');
		}
		// If it isn't root level, use the stack to find the parent
		else
		{
			// Get the name which points to the current direct parent, relative to
$this
			$parent = $this->_getStackLocation();

			// Add the child
			eval('$this->' . $parent . '->addChild($name,
$attrs, ' . $count . ');');

			// Update the stack
			eval('$this->_stack[] =
$name.\'[\'.(count($this->' . $parent . '->'
. $name . ') - 1).\']\';');
		}
	}

	/**
	 * Handler function for the end of a tag
	 *
	 * @param   resource  $parser  The XML parser.
	 * @param   string    $name    The name of the element.
	 *
	 * @return  void
	 *
	 * @deprecated  12.1
	 * @since   11.1
	 */
	protected function _endElement($parser, $name)
	{
		// Deprecation warning.
		JLog::add('JSimpleXML::endElement() is deprecated.',
JLog::WARNING, 'deprecated');

		//Update stack by removing the end value from it as the parent
		array_pop($this->_stack);
	}

	/**
	 * Handler function for the character data within a tag
	 *
	 * @param   resource  $parser  The XML parser.
	 * @param   string    $data    The CDATA for the element.
	 *
	 * @return  void
	 *
	 * @deprecated  12.1
	 * @since   11.1
	 */
	protected function _characterData($parser, $data)
	{
		// Deprecation warning.
		JLog::add('JSimpleXML::_characterData() is deprecated.',
JLog::WARNING, 'deprecated');

		// Get the reference to the current parent object
		$tag = $this->_getStackLocation();

		// Assign data to it
		eval('$this->' . $tag . '->_data .= $data;');
	}
}

/**
 * SimpleXML Element
 *
 * This object stores all of the direct children of itself in the $children
array.
 * They are also stored by type as arrays. So, if, for example, this tag
had 2 <font>
 * tags as children, there would be a class member called $font created as
an array.
 * $font[0] would be the first font tag, and $font[1] would be the second.
 *
 * To loop through all of the direct children of this object, the $children
member
 *  should be used.
 *
 * To loop through all of the direct children of a specific tag for this
object, it
 * is probably easier to use the arrays of the specific tag names, as
explained above.
 *
 * @package     Joomla.Platform
 * @subpackage  Utilities
 * @see         http://www.php.net/manual/en/class.simplexmlelement.php
 * @since       11.1
 * @deprecated  12.1   Use SimpleXMLElement instead
 */
class JSimpleXMLElement extends JObject
{
	/**
	 * Array with the attributes of this XML element
	 *
	 * @var array
	 * @since   11.1
	 */
	public $_attributes = array();

	/**
	 * The name of the element
	 *
	 * @var     string
	 * @since   11.1
	 */
	public $_name = '';

	/**
	 * The data the element contains
	 *
	 * @var     string
	 * @since   11.1
	 */
	public $_data = '';

	/**
	 * Array of references to the objects of all direct children of this XML
object
	 *
	 * @var     array
	 * @since   11.1
	 */
	public $_children = array();

	/**
	 * The level of this XML element
	 *
	 * @var     int
	 * @since   11.1
	 */
	public $_level = 0;

	/**
	 * Constructor, sets up all the default values
	 *
	 * @param   string   $name   The name of the element.
	 * @param   array    $attrs  A key-value array (optional) of the
attributes for the element.
	 * @param   integer  $level  The level (optional) of the element.
	 *
	 * @deprecated  12.1 Use SimpleXMLElement
	 * @since   11.1
	 */
	public function __construct($name, $attrs = array(), $level = 0)
	{
		// Deprecation warning.
		JLog::add('JSimpleXMLElement::__construct() is deprecated.',
JLog::WARNING, 'deprecated');

		//Make the keys of the attr array lower case, and store the value
		$this->_attributes = array_change_key_case($attrs, CASE_LOWER);

		//Make the name lower case and store the value
		$this->_name = strtolower($name);

		//Set the level
		$this->_level = $level;
	}

	/**
	 * Get the name of the element
	 *
	 * @return  string
	 *
	 * @deprecated   12.1
	 * @since   11.1
	 */

	public function name()
	{
		// Deprecation warning.
		JLog::add('JSimpleXMLElement::name() is deprecated.',
JLog::WARNING, 'deprecated');

		return $this->_name;
	}

	/**
	 * Get the an attribute of the element
	 *
	 * @param   string  $attribute  The name of the attribute
	 *
	 * @return  mixed   If an attribute is given will return the attribute if
it exist.
	 *                  If no attribute is given will return the complete
attributes array
	 *
	 * @deprecated  12.1
	 * @since   11.1
	 */
	public function attributes($attribute = null)
	{
		// Deprecation warning.
		JLog::add('JSimpleXMLElement::attributes() is deprecated.',
JLog::WARNING, 'deprecated');

		if (!isset($attribute))
		{
			return $this->_attributes;
		}

		return isset($this->_attributes[$attribute]) ?
$this->_attributes[$attribute] : null;
	}

	/**
	 * Get the data of the element
	 *
	 * @return  string
	 *
	 * @deprecated   12.1  Use SimpleXMLElement
	 * @since   11.1
	 */

	public function data()
	{
		// Deprecation warning.
		JLog::add('JSimpleXMLElement::data() is deprecated.',
JLog::WARNING, 'deprecated');

		return $this->_data;
	}

	/**
	 * Set the data of the element
	 *
	 * @param   string  $data  The CDATA for the element.
	 *
	 * @return  string
	 *
	 * @deprecated  12.1  Use SimpleXMLElement
	 * @since   11.1
	 */

	public function setData($data)
	{
		// Deprecation warning.
		JLog::add('JSimpleXMLElement::data() is deprecated.',
JLog::WARNING, 'deprecated');

		$this->_data = $data;
	}

	/**
	 * Get the children of the element
	 *
	 * @return  array
	 *
	 * @deprecated   12.1
	 * @since   11.1
	 */

	public function children()
	{
		// Deprecation warning.
		JLog::add('JSimpleXMLElement::children() is deprecated.',
JLog::WARNING, 'deprecated');

		return $this->_children;
	}

	/**
	 * Get the level of the element
	 *
	 * @return       integer
	 *
	 * @since   11.1
	 * @deprecated   12.1
	 */
	public function level()
	{
		// Deprecation warning.
		JLog::add('JSimpleXMLElement::level() is deprecated.',
JLog::WARNING, 'deprecated');

		return $this->_level;
	}

	/**
	 * Adds an attribute to the element
	 *
	 * @param   string  $name   The key
	 * @param   array   $value  The value for the key
	 *
	 * @return  void
	 *
	 * @deprecated  12.1
	 * @since   11.1
	 */
	public function addAttribute($name, $value)
	{
		// Deprecation warning.
		JLog::add('JSimpleXMLElement::addAttribute() is deprecated.',
JLog::WARNING, 'deprecated');

		// Add the attribute to the element, override if it already exists
		$this->_attributes[$name] = $value;
	}

	/**
	 * Removes an attribute from the element
	 *
	 * @param   string  $name  The name of the attribute.
	 *
	 * @return  void
	 *
	 * @deprecated  12.1
	 * @since   11.1
	 */
	public function removeAttribute($name)
	{
		// Deprecation warning.
		JLog::add('JSimpleXMLElement::removeAttribute() is
deprecated.', JLog::WARNING, 'deprecated');

		unset($this->_attributes[$name]);
	}

	/**
	 * Adds a direct child to the element
	 *
	 * @param   string   $name   The name of the element.
	 * @param   array    $attrs  An key-value array of the element attributes.
	 * @param   integer  $level  The level of the element (optional).
	 *
	 * @return  JSimpleXMLElement  The added child object
	 *
	 * @deprecated   12.1
	 * @since   11.1
	 */
	public function addChild($name, $attrs = array(), $level = null)
	{
		// Deprecation warning.
		JLog::add('JSimpleXMLElement::addChild() is deprecated.',
JLog::WARNING, 'deprecated');

		//If there is no array already set for the tag name being added,
		//create an empty array for it
		if (!isset($this->$name))
		{
			$this->$name = array();
		}

		// set the level if not already specified
		if ($level == null)
		{
			$level = ($this->_level + 1);
		}

		//Create the child object itself
		$classname = get_class($this);
		$child = new $classname($name, $attrs, $level);

		//Add the reference of it to the end of an array member named for the
elements name
		$this->{$name}[] = &$child;

		//Add the reference to the children array member
		$this->_children[] = &$child;

		//return the new child
		return $child;
	}

	/**
	 * Remove the child node.
	 *
	 * @param   JSimpleXmlElement  &$child  The child element to remove.
	 *
	 * @return  void
	 *
	 * @since   11.1
	 * @deprecated  12.1
	 */
	public function removeChild(&$child)
	{
		// Deprecation warning.
		JLog::add('JSimpleXMLElement::removeChild() is deprecated.',
JLog::WARNING, 'deprecated');

		$name = $child->name();
		for ($i = 0, $n = count($this->_children); $i < $n; $i++)
		{
			if ($this->_children[$i] == $child)
			{
				unset($this->_children[$i]);
			}
		}
		for ($i = 0, $n = count($this->{$name}); $i < $n; $i++)
		{
			if ($this->{$name}[$i] == $child)
			{
				unset($this->{$name}[$i]);
			}
		}
		$this->_children = array_values($this->_children);
		$this->{$name} = array_values($this->{$name});
		unset($child);
	}

	/**
	 * Get an element in the document by / separated path
	 *
	 * @param   string  $path  The / separated path to the element
	 *
	 * @return  object  JSimpleXMLElement
	 *
	 * @deprecated   12.1
	 * @since   11.1
	 */
	public function getElementByPath($path)
	{
		// Deprecation warning.
		JLog::add('JSimpleXMLElement::getElementByPath() is
deprecated.', JLog::WARNING, 'deprecated');

		$tmp	= &$this;
		$parts	= explode('/', trim($path, '/'));

		foreach ($parts as $node)
		{
			$found = false;
			foreach ($tmp->_children as $child)
			{
				if (strtoupper($child->_name) == strtoupper($node))
				{
					$tmp = &$child;
					$found = true;
					break;
				}
			}
			if (!$found)
			{
				break;
			}
		}

		if ($found)
		{
			return $tmp;
		}

		return false;
	}

	/**
	 * Traverses the tree calling the $callback(JSimpleXMLElement
	 * $this, mixed $args=array()) function with each JSimpleXMLElement.
	 *
	 * @param   string  $callback  Function name
	 * @param   array   $args      The arguments (optional) for the function
callback.
	 *
	 * @return  void
	 *
	 * @deprecated  12.1
	 * @since   11.1
	 */
	public function map($callback, $args = array())
	{
		// Deprecation warning.
		JLog::add('JSimpleXMLElement::map) is deprecated.',
JLog::WARNING, 'deprecated');

		$callback($this, $args);
		// Map to all children
		if ($n = count($this->_children))
		{
			for ($i = 0; $i < $n; $i++)
			{
				$this->_children[$i]->map($callback, $args);
			}
		}
	}

	/**
	 * Return a well-formed XML string based on SimpleXML element
	 *
	 * @param   boolean  $whitespace  True if whitespace should be prepended
to the string
	 *
	 * @return  string
	 *
	 * @deprecated   12.1
	 * @since   11.1
	 */
	public function toString($whitespace = true)
	{
		// Deprecation warning.
		JLog::add('JSimpleXMLElement::toString() is deprecated.',
JLog::WARNING, 'deprecated');

		// Start a new line, indent by the number indicated in $this->level,
add a <, and add the name of the tag
		if ($whitespace)
		{
			$out = "\n" . str_repeat("\t", $this->_level) .
'<' . $this->_name;
		}
		else
		{
			$out = '<' . $this->_name;
		}

		// For each attribute, add attr="value"
		foreach ($this->_attributes as $attr => $value)
		{
			$out .= ' ' . $attr . '="' .
htmlspecialchars($value, ENT_COMPAT, 'UTF-8') .
'"';
		}

		// If there are no children and it contains no data, end it off with a
/>
		if (empty($this->_children) && empty($this->_data))
		{
			$out .= " />";
		}
		// Otherwise...
		else
		{
			// If there are children
			if (!empty($this->_children))
			{
				// Close off the start tag
				$out .= '>';

				// For each child, call the asXML function (this will ensure that all
children are added recursively)
				foreach ($this->_children as $child)
				{
					$out .= $child->toString($whitespace);
				}

				// Add the newline and indentation to go along with the close tag
				if ($whitespace)
				{
					$out .= "\n" . str_repeat("\t", $this->_level);
				}
			}
			// If there is data, close off the start tag and add the data
			elseif (!empty($this->_data))
				$out .= '>' . htmlspecialchars($this->_data,
ENT_COMPAT, 'UTF-8');

			// Add the end tag
			$out .= '</' . $this->_name . '>';
		}

		//Return the final output
		return $out;
	}
}
}libraries/coomla/utilities/xmlelement.php000064400000006757151160675320014715
0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  Utilities
 *
 * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

/**
 * Wrapper class for php SimpleXMLElement.
 *
 * @package     Joomla.Platform
 * @subpackage  Utilities
 * @since       11.1
 * @deprecated  13.3 Use SimpleXMLElement instead.
 */
class JXMLElement extends SimpleXMLElement
{
	/**
	 * Get the name of the element.
	 *
	 * @return  string
	 *
	 * @since   11.1
	 * @deprecated 13.3  Use SimpleXMLElement::getName() instead.
	 */
	public function name()
	{
		JLog::add('JXMLElement::name() is deprecated, use
SimpleXMLElement::getName() instead.', JLog::WARNING,
'deprecated');
		return (string) $this->getName();
	}

	/**
	 * Legacy method to get the element data.
	 *
	 * @return  string
	 *
	 * @deprecated  12.1
	 * @since   11.1
	 */
	public function data()
	{
		// Deprecation warning.
		JLog::add('JXMLElement::data() is deprecated.', JLog::WARNING,
'deprecated');

		return (string) $this;
	}

	/**
	 * Legacy method gets an elements attribute by name.
	 *
	 * @param   string  $name  Attribute to get
	 *
	 * @return  string
	 *
	 * @since   11.1
	 *
	 * @deprecated    12.1
	 * @see           SimpleXMLElement::attributes
	 */
	public function getAttribute($name)
	{
		// Deprecation warning.
		JLog::add('JXMLelement::getAttributes() is deprecated.',
JLog::WARNING, 'deprecated');

		return (string) $this->attributes()->$name;
	}

	/**
	 * Return a well-formed XML string based on SimpleXML element
	 *
	 * @param   boolean  $compressed  Should we use indentation and newlines ?
	 * @param   integer  $indent      Indention level.
	 * @param   integer  $level       The level within the document which
informs the indentation.
	 *
	 * @return  string
	 *
	 * @since   11.1
	 * @deprecated 13.3  Use SimpleXMLElement::asXML() instead.
	 */
	public function asFormattedXML($compressed = false, $indent =
"\t", $level = 0)
	{
		JLog::add('JXMLElement::asFormattedXML() is deprecated, use
SimpleXMLElement::asXML() instead.', JLog::WARNING,
'deprecated');
		$out = '';

		// Start a new line, indent by the number indicated in $level
		$out .= ($compressed) ? '' : "\n" .
str_repeat($indent, $level);

		// Add a <, and add the name of the tag
		$out .= '<' . $this->getName();

		// For each attribute, add attr="value"
		foreach ($this->attributes() as $attr)
		{
			$out .= ' ' . $attr->getName() . '="' .
htmlspecialchars((string) $attr, ENT_COMPAT, 'UTF-8') .
'"';
		}

		// If there are no children and it contains no data, end it off with a
/>
		if (!count($this->children()) && !(string) $this)
		{
			$out .= " />";
		}
		else
		{
			// If there are children
			if (count($this->children()))
			{
				// Close off the start tag
				$out .= '>';

				$level++;

				// For each child, call the asFormattedXML function (this will ensure
that all children are added recursively)
				foreach ($this->children() as $child)
				{
					$out .= $child->asFormattedXML($compressed, $indent, $level);
				}

				$level--;

				// Add the newline and indentation to go along with the close tag
				$out .= ($compressed) ? '' : "\n" .
str_repeat($indent, $level);

			}
			elseif ((string) $this)
			{
				// If there is data, close off the start tag and add the data
				$out .= '>' . htmlspecialchars((string) $this, ENT_COMPAT,
'UTF-8');
			}

			// Add the end tag
			$out .= '</' . $this->getName() . '>';
		}

		return $out;
	}
}
libraries/html5/Data.php000064400000012460151160675320011144
0ustar00<?php
/**
 * mod_vertical_menu - Vertical Menu
 *
 * @author    Balint Polgarfi
 * @copyright 2014-2019 Offlajn.com
 * @license   https://gnu.org/licenses/gpl-2.0.html
 * @link      https://offlajn.com
 */
?><?php
/*-------------------------------------------------------------------------
# plg_offlajnjoomla3compat - Offlajn Joomla 3 Compatibility
# -------------------------------------------------------------------------
# @ author    Jeno Kovacs
# @ copyright Copyright (C) 2014 Offlajn.com  All Rights Reserved.
# @ license   http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# @ website   http://www.offlajn.com
-------------------------------------------------------------------------*/
?><?php
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

// warning: this file is encoded in UTF-8!

class HTML5_Data
{

    // at some point this should be moved to a .ser file. Another
    // possible optimization is to give UTF-8 bytes, not Unicode
    // codepoints
    protected static $realCodepointTable = array(
        0x0D => 0x000A, // LINE FEED (LF)
        0x80 => 0x20AC, // EURO SIGN ('€')
        0x81 => 0xFFFD, // REPLACEMENT CHARACTER
        0x82 => 0x201A, // SINGLE LOW-9 QUOTATION MARK ('‚')
        0x83 => 0x0192, // LATIN SMALL LETTER F WITH HOOK
('ƒ')
        0x84 => 0x201E, // DOUBLE LOW-9 QUOTATION MARK ('„')
        0x85 => 0x2026, // HORIZONTAL ELLIPSIS ('…')
        0x86 => 0x2020, // DAGGER ('†')
        0x87 => 0x2021, // DOUBLE DAGGER ('‡')
        0x88 => 0x02C6, // MODIFIER LETTER CIRCUMFLEX ACCENT
('ˆ')
        0x89 => 0x2030, // PER MILLE SIGN ('‰')
        0x8A => 0x0160, // LATIN CAPITAL LETTER S WITH CARON
('Š')
        0x8B => 0x2039, // SINGLE LEFT-POINTING ANGLE QUOTATION MARK
('‹')
        0x8C => 0x0152, // LATIN CAPITAL LIGATURE OE ('Œ')
        0x8D => 0xFFFD, // REPLACEMENT CHARACTER
        0x8E => 0x017D, // LATIN CAPITAL LETTER Z WITH CARON
('Ž')
        0x8F => 0xFFFD, // REPLACEMENT CHARACTER
        0x90 => 0xFFFD, // REPLACEMENT CHARACTER
        0x91 => 0x2018, // LEFT SINGLE QUOTATION MARK ('‘')
        0x92 => 0x2019, // RIGHT SINGLE QUOTATION MARK ('’')
        0x93 => 0x201C, // LEFT DOUBLE QUOTATION MARK ('“')
        0x94 => 0x201D, // RIGHT DOUBLE QUOTATION MARK ('”')
        0x95 => 0x2022, // BULLET ('•')
        0x96 => 0x2013, // EN DASH ('–')
        0x97 => 0x2014, // EM DASH ('—')
        0x98 => 0x02DC, // SMALL TILDE ('˜')
        0x99 => 0x2122, // TRADE MARK SIGN ('™')
        0x9A => 0x0161, // LATIN SMALL LETTER S WITH CARON
('š')
        0x9B => 0x203A, // SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
('›')
        0x9C => 0x0153, // LATIN SMALL LIGATURE OE ('œ')
        0x9D => 0xFFFD, // REPLACEMENT CHARACTER
        0x9E => 0x017E, // LATIN SMALL LETTER Z WITH CARON
('ž')
        0x9F => 0x0178, // LATIN CAPITAL LETTER Y WITH DIAERESIS
('Ÿ')
    );

    protected static $namedCharacterReferences;

    protected static $namedCharacterReferenceMaxLength;

    /**
     * Returns the "real" Unicode codepoint of a malformed
character
     * reference.
     */
    public static function getRealCodepoint($ref) {
        if (!isset(self::$realCodepointTable[$ref])) return false;
        else return self::$realCodepointTable[$ref];
    }

    public static function getNamedCharacterReferences() {
        if (!self::$namedCharacterReferences) {
            self::$namedCharacterReferences = unserialize(
                file_get_contents(dirname(__FILE__) .
'/named-character-references.ser'));
        }
        return self::$namedCharacterReferences;
    }

    public static function getNamedCharacterReferenceMaxLength() {
        if (!self::$namedCharacterReferenceMaxLength) {
            $namedCharacterReferences =
self::getNamedCharacterReferences();
            $lengths = array_map('strlen',
array_keys($namedCharacterReferences));
            self::$namedCharacterReferenceMaxLength = max($lengths);
        }
        return self::$namedCharacterReferenceMaxLength;
    }


    /**
     * Converts a Unicode codepoint to sequence of UTF-8 bytes.
     * @note Shamelessly stolen from HTML Purifier, which is also
     *       shamelessly stolen from Feyd (which is in public domain).
     */
    public static function utf8chr($code) {
        if($code > 0x10FFFF or $code < 0x0 or
          ($code >= 0xD800 and $code <= 0xDFFF) ) {
            // bits are set outside the "valid" range as defined
            // by UNICODE 4.1.0
            return "\xEF\xBF\xBD";
        }

        $x = $y = $z = $w = 0;
        if ($code < 0x80) {
            // regular ASCII character
            $x = $code;
        } else {
            // set up bits for UTF-8
            $x = ($code & 0x3F) | 0x80;
            if ($code < 0x800) {
               $y = (($code & 0x7FF) >> 6) | 0xC0;
            } else {
                $y = (($code & 0xFC0) >> 6) | 0x80;
                if($code < 0x10000) {
                    $z = (($code >> 12) & 0x0F) | 0xE0;
                } else {
                    $z = (($code >> 12) & 0x3F) | 0x80;
                    $w = (($code >> 18) & 0x07) | 0xF0;
                }
            }
        }
        // set up the actual character
        $ret = '';
        if($w) $ret .= chr($w);
        if($z) $ret .= chr($z);
        if($y) $ret .= chr($y);
        $ret .= chr($x);

        return $ret;
    }

}
libraries/html5/index.html000064400000000047151160675320011555
0ustar00<html><head></head><body></body></html>libraries/html5/InputStream.php000064400000025432151160675320012551
0ustar00<?php
/**
 * mod_vertical_menu - Vertical Menu
 *
 * @author    Balint Polgarfi
 * @copyright 2014-2019 Offlajn.com
 * @license   https://gnu.org/licenses/gpl-2.0.html
 * @link      https://offlajn.com
 */
?><?php
/*-------------------------------------------------------------------------
# plg_offlajnjoomla3compat - Offlajn Joomla 3 Compatibility
# -------------------------------------------------------------------------
# @ author    Jeno Kovacs
# @ copyright Copyright (C) 2014 Offlajn.com  All Rights Reserved.
# @ license   http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# @ website   http://www.offlajn.com
-------------------------------------------------------------------------*/
?><?php
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
/*

Copyright 2009 Geoffrey Sneddon <http://gsnedders.com/>

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction,
including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

*/

// Some conventions:
// /* */ indicates verbatim text from the HTML 5 specification
// // indicates regular comments

class HTML5_InputStream {
    /**
     * The string data we're parsing.
     */
    private $data;

    /**
     * The current integer byte position we are in $data
     */
    private $char;

    /**
     * Length of $data; when $char === $data, we are at the end-of-file.
     */
    private $EOF;

    /**
     * Parse errors.
     */
    public $errors = array();

    /**
     * @param $data Data to parse
     */
    public function __construct($data) {

        /* Given an encoding, the bytes in the input stream must be
        converted to Unicode characters for the tokeniser, as
        described by the rules for that encoding, except that the
        leading U+FEFF BYTE ORDER MARK character, if any, must not
        be stripped by the encoding layer (it is stripped by the rule
below).

        Bytes or sequences of bytes in the original byte stream that
        could not be converted to Unicode characters must be converted
        to U+FFFD REPLACEMENT CHARACTER code points. */

        // XXX currently assuming input data is UTF-8; once we
        // build encoding detection this will no longer be the case
        //
        // We previously had an mbstring implementation here, but that
        // implementation is heavily non-conforming, so it's been
        // omitted.
        if (extension_loaded('iconv')) {
            // non-conforming
            $data = @iconv('UTF-8', 'UTF-8//IGNORE',
$data);
        } else {
            // we can make a conforming native implementation
            throw new Exception('Not implemented, please install
mbstring or iconv');
        }

        /* One leading U+FEFF BYTE ORDER MARK character must be
        ignored if any are present. */
        if (substr($data, 0, 3) === "\xEF\xBB\xBF") {
            $data = substr($data, 3);
        }

        /* All U+0000 NULL characters in the input must be replaced
        by U+FFFD REPLACEMENT CHARACTERs. Any occurrences of such
        characters is a parse error. */
        for ($i = 0, $count = substr_count($data, "\0"); $i <
$count; $i++) {
            $this->errors[] = array(
                'type' => HTML5_Tokenizer::PARSEERROR,
                'data' => 'null-character'
            );
        }
        /* U+000D CARRIAGE RETURN (CR) characters and U+000A LINE FEED
        (LF) characters are treated specially. Any CR characters
        that are followed by LF characters must be removed, and any
        CR characters not followed by LF characters must be converted
        to LF characters. Thus, newlines in HTML DOMs are represented
        by LF characters, and there are never any CR characters in the
        input to the tokenization stage. */
        $data = str_replace(
            array(
                "\0",
                "\r\n",
                "\r"
            ),
            array(
                "\xEF\xBF\xBD",
                "\n",
                "\n"
            ),
            $data
        );

        /* Any occurrences of any characters in the ranges U+0001 to
        U+0008, U+000B,  U+000E to U+001F,  U+007F  to U+009F,
        U+D800 to U+DFFF , U+FDD0 to U+FDEF, and
        characters U+FFFE, U+FFFF, U+1FFFE, U+1FFFF, U+2FFFE, U+2FFFF,
        U+3FFFE, U+3FFFF, U+4FFFE, U+4FFFF, U+5FFFE, U+5FFFF, U+6FFFE,
        U+6FFFF, U+7FFFE, U+7FFFF, U+8FFFE, U+8FFFF, U+9FFFE, U+9FFFF,
        U+AFFFE, U+AFFFF, U+BFFFE, U+BFFFF, U+CFFFE, U+CFFFF, U+DFFFE,
        U+DFFFF, U+EFFFE, U+EFFFF, U+FFFFE, U+FFFFF, U+10FFFE, and
        U+10FFFF are parse errors. (These are all control characters
        or permanently undefined Unicode characters.) */
        // Check PCRE is loaded.
        if (extension_loaded('pcre')) {
            $count = preg_match_all(
                '/(?:
                    [\x01-\x08\x0B\x0E-\x1F\x7F] # U+0001 to U+0008,
U+000B,  U+000E to U+001F and U+007F
                |
                    \xC2[\x80-\x9F] # U+0080 to U+009F
                |
                   
\xED(?:\xA0[\x80-\xFF]|[\xA1-\xBE][\x00-\xFF]|\xBF[\x00-\xBF]) # U+D800 to
U+DFFFF
                |
                    \xEF\xB7[\x90-\xAF] # U+FDD0 to U+FDEF
                |
                    \xEF\xBF[\xBE\xBF] # U+FFFE and U+FFFF
                |
                    [\xF0-\xF4][\x8F-\xBF]\xBF[\xBE\xBF] # U+nFFFE and
U+nFFFF (1 <= n <= 10_{16})
                )/x',
                $data,
                $matches
            );
            for ($i = 0; $i < $count; $i++) {
                $this->errors[] = array(
                    'type' => HTML5_Tokenizer::PARSEERROR,
                    'data' => 'invalid-codepoint'
                );
            }
        } else {
            // XXX: Need non-PCRE impl, probably using substr_count
        }

        $this->data = $data;
        $this->char = 0;
        $this->EOF  = strlen($data);
    }

    /**
     * Returns the current line that the tokenizer is at.
     */
    public function getCurrentLine() {
        // Check the string isn't empty
        if($this->EOF) {
            // Add one to $this->char because we want the number for the
next
            // byte to be processed.
            return substr_count($this->data, "\n", 0,
min($this->char, $this->EOF)) + 1;
        } else {
            // If the string is empty, we are on the first line (sorta).
            return 1;
        }
    }

    /**
     * Returns the current column of the current line that the tokenizer is
at.
     */
    public function getColumnOffset() {
        // strrpos is weird, and the offset needs to be negative for what
we
        // want (i.e., the last \n before $this->char). This needs to
not have
        // one (to make it point to the next character, the one we want the
        // position of) added to it because strrpos's behaviour
includes the
        // final offset byte.
        $lastLine = strrpos($this->data, "\n", $this->char
- 1 - strlen($this->data));

        // However, for here we want the length up until the next byte to
be
        // processed, so add one to the current byte ($this->char).
        if($lastLine !== false) {
            $findLengthOf = substr($this->data, $lastLine + 1,
$this->char - 1 - $lastLine);
        } else {
            $findLengthOf = substr($this->data, 0, $this->char);
        }

        // Get the length for the string we need.
        if(extension_loaded('iconv')) {
            return iconv_strlen($findLengthOf, 'utf-8');
        } elseif(extension_loaded('mbstring')) {
            return mb_strlen($findLengthOf, 'utf-8');
        } elseif(extension_loaded('xml')) {
            return strlen(utf8_decode($findLengthOf));
        } else {
            $count = count_chars($findLengthOf);
            // 0x80 = 0x7F - 0 + 1 (one added to get inclusive range)
            // 0x33 = 0xF4 - 0x2C + 1 (one added to get inclusive range)
            return array_sum(array_slice($count, 0, 0x80)) +
                   array_sum(array_slice($count, 0xC2, 0x33));
        }
    }

    /**
     * Retrieve the currently consume character.
     * @note This performs bounds checking
     */
    public function char() {
        return ($this->char++ < $this->EOF)
            ? $this->data[$this->char - 1]
            : false;
    }

    /**
     * Get all characters until EOF.
     * @note This performs bounds checking
     */
    public function remainingChars() {
        if($this->char < $this->EOF) {
            $data = substr($this->data, $this->char);
            $this->char = $this->EOF;
            return $data;
        } else {
            return false;
        }
    }

    /**
     * Matches as far as possible until we reach a certain set of bytes
     * and returns the matched substring.
     * @param $bytes Bytes to match.
     */
    public function charsUntil($bytes, $max = null) {
        if ($this->char < $this->EOF) {
            if ($max === 0 || $max) {
                $len = strcspn($this->data, $bytes, $this->char,
$max);
            } else {
                $len = strcspn($this->data, $bytes, $this->char);
            }
            $string = (string) substr($this->data, $this->char,
$len);
            $this->char += $len;
            return $string;
        } else {
            return false;
        }
    }

    /**
     * Matches as far as possible with a certain set of bytes
     * and returns the matched substring.
     * @param $bytes Bytes to match.
     */
    public function charsWhile($bytes, $max = null) {
        if ($this->char < $this->EOF) {
            if ($max === 0 || $max) {
                $len = strspn($this->data, $bytes, $this->char,
$max);
            } else {
                $len = strspn($this->data, $bytes, $this->char);
            }
            $string = (string) substr($this->data, $this->char,
$len);
            $this->char += $len;
            return $string;
        } else {
            return false;
        }
    }

    /**
     * Unconsume one character.
     */
    public function unget() {
        if ($this->char <= $this->EOF) {
            $this->char--;
        }
    }
}
libraries/html5/named-character-references.ser000064400000132313151160675320015432
0ustar00a:2137:{s:6:"AElig;";i:198;s:5:"AElig";i:198;s:4:"AMP;";i:38;s:3:"AMP";i:38;s:7:"Aacute;";i:193;s:6:"Aacute";i:193;s:7:"Abreve;";i:258;s:6:"Acirc;";i:194;s:5:"Acirc";i:194;s:4:"Acy;";i:1040;s:4:"Afr;";i:120068;s:7:"Agrave;";i:192;s:6:"Agrave";i:192;s:6:"Alpha;";i:913;s:6:"Amacr;";i:256;s:4:"And;";i:10835;s:6:"Aogon;";i:260;s:5:"Aopf;";i:120120;s:14:"ApplyFunction;";i:8289;s:6:"Aring;";i:197;s:5:"Aring";i:197;s:5:"Ascr;";i:119964;s:7:"Assign;";i:8788;s:7:"Atilde;";i:195;s:6:"Atilde";i:195;s:5:"Auml;";i:196;s:4:"Auml";i:196;s:10:"Backslash;";i:8726;s:5:"Barv;";i:10983;s:7:"Barwed;";i:8966;s:4:"Bcy;";i:1041;s:8:"Because;";i:8757;s:11:"Bernoullis;";i:8492;s:5:"Beta;";i:914;s:4:"Bfr;";i:120069;s:5:"Bopf;";i:120121;s:6:"Breve;";i:728;s:5:"Bscr;";i:8492;s:7:"Bumpeq;";i:8782;s:5:"CHcy;";i:1063;s:5:"COPY;";i:169;s:4:"COPY";i:169;s:7:"Cacute;";i:262;s:4:"Cap;";i:8914;s:21:"CapitalDifferentialD;";i:8517;s:8:"Cayleys;";i:8493;s:7:"Ccaron;";i:268;s:7:"Ccedil;";i:199;s:6:"Ccedil";i:199;s:6:"Ccirc;";i:264;s:8:"Cconint;";i:8752;s:5:"Cdot;";i:266;s:8:"Cedilla;";i:184;s:10:"CenterDot;";i:183;s:4:"Cfr;";i:8493;s:4:"Chi;";i:935;s:10:"CircleDot;";i:8857;s:12:"CircleMinus;";i:8854;s:11:"CirclePlus;";i:8853;s:12:"CircleTimes;";i:8855;s:25:"ClockwiseContourIntegral;";i:8754;s:22:"CloseCurlyDoubleQuote;";i:8221;s:16:"CloseCurlyQuote;";i:8217;s:6:"Colon;";i:8759;s:7:"Colone;";i:10868;s:10:"Congruent;";i:8801;s:7:"Conint;";i:8751;s:16:"ContourIntegral;";i:8750;s:5:"Copf;";i:8450;s:10:"Coproduct;";i:8720;s:32:"CounterClockwiseContourIntegral;";i:8755;s:6:"Cross;";i:10799;s:5:"Cscr;";i:119966;s:4:"Cup;";i:8915;s:7:"CupCap;";i:8781;s:3:"DD;";i:8517;s:9:"DDotrahd;";i:10513;s:5:"DJcy;";i:1026;s:5:"DScy;";i:1029;s:5:"DZcy;";i:1039;s:7:"Dagger;";i:8225;s:5:"Darr;";i:8609;s:6:"Dashv;";i:10980;s:7:"Dcaron;";i:270;s:4:"Dcy;";i:1044;s:4:"Del;";i:8711;s:6:"Delta;";i:916;s:4:"Dfr;";i:120071;s:17:"DiacriticalAcute;";i:180;s:15:"DiacriticalDot;";i:729;s:23:"DiacriticalDoubleAcute;";i:733;s:17:"DiacriticalGrave;";i:96;s:17:"DiacriticalTilde;";i:732;s:8:"Diamond;";i:8900;s:14:"DifferentialD;";i:8518;s:5:"Dopf;";i:120123;s:4:"Dot;";i:168;s:7:"DotDot;";i:8412;s:9:"DotEqual;";i:8784;s:22:"DoubleContourIntegral;";i:8751;s:10:"DoubleDot;";i:168;s:16:"DoubleDownArrow;";i:8659;s:16:"DoubleLeftArrow;";i:8656;s:21:"DoubleLeftRightArrow;";i:8660;s:14:"DoubleLeftTee;";i:10980;s:20:"DoubleLongLeftArrow;";i:10232;s:25:"DoubleLongLeftRightArrow;";i:10234;s:21:"DoubleLongRightArrow;";i:10233;s:17:"DoubleRightArrow;";i:8658;s:15:"DoubleRightTee;";i:8872;s:14:"DoubleUpArrow;";i:8657;s:18:"DoubleUpDownArrow;";i:8661;s:18:"DoubleVerticalBar;";i:8741;s:10:"DownArrow;";i:8595;s:13:"DownArrowBar;";i:10515;s:17:"DownArrowUpArrow;";i:8693;s:10:"DownBreve;";i:785;s:20:"DownLeftRightVector;";i:10576;s:18:"DownLeftTeeVector;";i:10590;s:15:"DownLeftVector;";i:8637;s:18:"DownLeftVectorBar;";i:10582;s:19:"DownRightTeeVector;";i:10591;s:16:"DownRightVector;";i:8641;s:19:"DownRightVectorBar;";i:10583;s:8:"DownTee;";i:8868;s:13:"DownTeeArrow;";i:8615;s:10:"Downarrow;";i:8659;s:5:"Dscr;";i:119967;s:7:"Dstrok;";i:272;s:4:"ENG;";i:330;s:4:"ETH;";i:208;s:3:"ETH";i:208;s:7:"Eacute;";i:201;s:6:"Eacute";i:201;s:7:"Ecaron;";i:282;s:6:"Ecirc;";i:202;s:5:"Ecirc";i:202;s:4:"Ecy;";i:1069;s:5:"Edot;";i:278;s:4:"Efr;";i:120072;s:7:"Egrave;";i:200;s:6:"Egrave";i:200;s:8:"Element;";i:8712;s:6:"Emacr;";i:274;s:17:"EmptySmallSquare;";i:9723;s:21:"EmptyVerySmallSquare;";i:9643;s:6:"Eogon;";i:280;s:5:"Eopf;";i:120124;s:8:"Epsilon;";i:917;s:6:"Equal;";i:10869;s:11:"EqualTilde;";i:8770;s:12:"Equilibrium;";i:8652;s:5:"Escr;";i:8496;s:5:"Esim;";i:10867;s:4:"Eta;";i:919;s:5:"Euml;";i:203;s:4:"Euml";i:203;s:7:"Exists;";i:8707;s:13:"ExponentialE;";i:8519;s:4:"Fcy;";i:1060;s:4:"Ffr;";i:120073;s:18:"FilledSmallSquare;";i:9724;s:22:"FilledVerySmallSquare;";i:9642;s:5:"Fopf;";i:120125;s:7:"ForAll;";i:8704;s:11:"Fouriertrf;";i:8497;s:5:"Fscr;";i:8497;s:5:"GJcy;";i:1027;s:3:"GT;";i:62;s:2:"GT";i:62;s:6:"Gamma;";i:915;s:7:"Gammad;";i:988;s:7:"Gbreve;";i:286;s:7:"Gcedil;";i:290;s:6:"Gcirc;";i:284;s:4:"Gcy;";i:1043;s:5:"Gdot;";i:288;s:4:"Gfr;";i:120074;s:3:"Gg;";i:8921;s:5:"Gopf;";i:120126;s:13:"GreaterEqual;";i:8805;s:17:"GreaterEqualLess;";i:8923;s:17:"GreaterFullEqual;";i:8807;s:15:"GreaterGreater;";i:10914;s:12:"GreaterLess;";i:8823;s:18:"GreaterSlantEqual;";i:10878;s:13:"GreaterTilde;";i:8819;s:5:"Gscr;";i:119970;s:3:"Gt;";i:8811;s:7:"HARDcy;";i:1066;s:6:"Hacek;";i:711;s:4:"Hat;";i:94;s:6:"Hcirc;";i:292;s:4:"Hfr;";i:8460;s:13:"HilbertSpace;";i:8459;s:5:"Hopf;";i:8461;s:15:"HorizontalLine;";i:9472;s:5:"Hscr;";i:8459;s:7:"Hstrok;";i:294;s:13:"HumpDownHump;";i:8782;s:10:"HumpEqual;";i:8783;s:5:"IEcy;";i:1045;s:6:"IJlig;";i:306;s:5:"IOcy;";i:1025;s:7:"Iacute;";i:205;s:6:"Iacute";i:205;s:6:"Icirc;";i:206;s:5:"Icirc";i:206;s:4:"Icy;";i:1048;s:5:"Idot;";i:304;s:4:"Ifr;";i:8465;s:7:"Igrave;";i:204;s:6:"Igrave";i:204;s:3:"Im;";i:8465;s:6:"Imacr;";i:298;s:11:"ImaginaryI;";i:8520;s:8:"Implies;";i:8658;s:4:"Int;";i:8748;s:9:"Integral;";i:8747;s:13:"Intersection;";i:8898;s:15:"InvisibleComma;";i:8291;s:15:"InvisibleTimes;";i:8290;s:6:"Iogon;";i:302;s:5:"Iopf;";i:120128;s:5:"Iota;";i:921;s:5:"Iscr;";i:8464;s:7:"Itilde;";i:296;s:6:"Iukcy;";i:1030;s:5:"Iuml;";i:207;s:4:"Iuml";i:207;s:6:"Jcirc;";i:308;s:4:"Jcy;";i:1049;s:4:"Jfr;";i:120077;s:5:"Jopf;";i:120129;s:5:"Jscr;";i:119973;s:7:"Jsercy;";i:1032;s:6:"Jukcy;";i:1028;s:5:"KHcy;";i:1061;s:5:"KJcy;";i:1036;s:6:"Kappa;";i:922;s:7:"Kcedil;";i:310;s:4:"Kcy;";i:1050;s:4:"Kfr;";i:120078;s:5:"Kopf;";i:120130;s:5:"Kscr;";i:119974;s:5:"LJcy;";i:1033;s:3:"LT;";i:60;s:2:"LT";i:60;s:7:"Lacute;";i:313;s:7:"Lambda;";i:923;s:5:"Lang;";i:10218;s:11:"Laplacetrf;";i:8466;s:5:"Larr;";i:8606;s:7:"Lcaron;";i:317;s:7:"Lcedil;";i:315;s:4:"Lcy;";i:1051;s:17:"LeftAngleBracket;";i:10216;s:10:"LeftArrow;";i:8592;s:13:"LeftArrowBar;";i:8676;s:20:"LeftArrowRightArrow;";i:8646;s:12:"LeftCeiling;";i:8968;s:18:"LeftDoubleBracket;";i:10214;s:18:"LeftDownTeeVector;";i:10593;s:15:"LeftDownVector;";i:8643;s:18:"LeftDownVectorBar;";i:10585;s:10:"LeftFloor;";i:8970;s:15:"LeftRightArrow;";i:8596;s:16:"LeftRightVector;";i:10574;s:8:"LeftTee;";i:8867;s:13:"LeftTeeArrow;";i:8612;s:14:"LeftTeeVector;";i:10586;s:13:"LeftTriangle;";i:8882;s:16:"LeftTriangleBar;";i:10703;s:18:"LeftTriangleEqual;";i:8884;s:17:"LeftUpDownVector;";i:10577;s:16:"LeftUpTeeVector;";i:10592;s:13:"LeftUpVector;";i:8639;s:16:"LeftUpVectorBar;";i:10584;s:11:"LeftVector;";i:8636;s:14:"LeftVectorBar;";i:10578;s:10:"Leftarrow;";i:8656;s:15:"Leftrightarrow;";i:8660;s:17:"LessEqualGreater;";i:8922;s:14:"LessFullEqual;";i:8806;s:12:"LessGreater;";i:8822;s:9:"LessLess;";i:10913;s:15:"LessSlantEqual;";i:10877;s:10:"LessTilde;";i:8818;s:4:"Lfr;";i:120079;s:3:"Ll;";i:8920;s:11:"Lleftarrow;";i:8666;s:7:"Lmidot;";i:319;s:14:"LongLeftArrow;";i:10229;s:19:"LongLeftRightArrow;";i:10231;s:15:"LongRightArrow;";i:10230;s:14:"Longleftarrow;";i:10232;s:19:"Longleftrightarrow;";i:10234;s:15:"Longrightarrow;";i:10233;s:5:"Lopf;";i:120131;s:15:"LowerLeftArrow;";i:8601;s:16:"LowerRightArrow;";i:8600;s:5:"Lscr;";i:8466;s:4:"Lsh;";i:8624;s:7:"Lstrok;";i:321;s:3:"Lt;";i:8810;s:4:"Map;";i:10501;s:4:"Mcy;";i:1052;s:12:"MediumSpace;";i:8287;s:10:"Mellintrf;";i:8499;s:4:"Mfr;";i:120080;s:10:"MinusPlus;";i:8723;s:5:"Mopf;";i:120132;s:5:"Mscr;";i:8499;s:3:"Mu;";i:924;s:5:"NJcy;";i:1034;s:7:"Nacute;";i:323;s:7:"Ncaron;";i:327;s:7:"Ncedil;";i:325;s:4:"Ncy;";i:1053;s:20:"NegativeMediumSpace;";i:8203;s:19:"NegativeThickSpace;";i:8203;s:18:"NegativeThinSpace;";i:8203;s:22:"NegativeVeryThinSpace;";i:8203;s:21:"NestedGreaterGreater;";i:8811;s:15:"NestedLessLess;";i:8810;s:8:"NewLine;";i:10;s:4:"Nfr;";i:120081;s:8:"NoBreak;";i:8288;s:17:"NonBreakingSpace;";i:160;s:5:"Nopf;";i:8469;s:4:"Not;";i:10988;s:13:"NotCongruent;";i:8802;s:10:"NotCupCap;";i:8813;s:21:"NotDoubleVerticalBar;";i:8742;s:11:"NotElement;";i:8713;s:9:"NotEqual;";i:8800;s:10:"NotExists;";i:8708;s:11:"NotGreater;";i:8815;s:16:"NotGreaterEqual;";i:8817;s:15:"NotGreaterLess;";i:8825;s:16:"NotGreaterTilde;";i:8821;s:16:"NotLeftTriangle;";i:8938;s:21:"NotLeftTriangleEqual;";i:8940;s:8:"NotLess;";i:8814;s:13:"NotLessEqual;";i:8816;s:15:"NotLessGreater;";i:8824;s:13:"NotLessTilde;";i:8820;s:12:"NotPrecedes;";i:8832;s:22:"NotPrecedesSlantEqual;";i:8928;s:18:"NotReverseElement;";i:8716;s:17:"NotRightTriangle;";i:8939;s:22:"NotRightTriangleEqual;";i:8941;s:21:"NotSquareSubsetEqual;";i:8930;s:23:"NotSquareSupersetEqual;";i:8931;s:15:"NotSubsetEqual;";i:8840;s:12:"NotSucceeds;";i:8833;s:22:"NotSucceedsSlantEqual;";i:8929;s:17:"NotSupersetEqual;";i:8841;s:9:"NotTilde;";i:8769;s:14:"NotTildeEqual;";i:8772;s:18:"NotTildeFullEqual;";i:8775;s:14:"NotTildeTilde;";i:8777;s:15:"NotVerticalBar;";i:8740;s:5:"Nscr;";i:119977;s:7:"Ntilde;";i:209;s:6:"Ntilde";i:209;s:3:"Nu;";i:925;s:6:"OElig;";i:338;s:7:"Oacute;";i:211;s:6:"Oacute";i:211;s:6:"Ocirc;";i:212;s:5:"Ocirc";i:212;s:4:"Ocy;";i:1054;s:7:"Odblac;";i:336;s:4:"Ofr;";i:120082;s:7:"Ograve;";i:210;s:6:"Ograve";i:210;s:6:"Omacr;";i:332;s:6:"Omega;";i:937;s:8:"Omicron;";i:927;s:5:"Oopf;";i:120134;s:21:"OpenCurlyDoubleQuote;";i:8220;s:15:"OpenCurlyQuote;";i:8216;s:3:"Or;";i:10836;s:5:"Oscr;";i:119978;s:7:"Oslash;";i:216;s:6:"Oslash";i:216;s:7:"Otilde;";i:213;s:6:"Otilde";i:213;s:7:"Otimes;";i:10807;s:5:"Ouml;";i:214;s:4:"Ouml";i:214;s:8:"OverBar;";i:175;s:10:"OverBrace;";i:9182;s:12:"OverBracket;";i:9140;s:16:"OverParenthesis;";i:9180;s:9:"PartialD;";i:8706;s:4:"Pcy;";i:1055;s:4:"Pfr;";i:120083;s:4:"Phi;";i:934;s:3:"Pi;";i:928;s:10:"PlusMinus;";i:177;s:14:"Poincareplane;";i:8460;s:5:"Popf;";i:8473;s:3:"Pr;";i:10939;s:9:"Precedes;";i:8826;s:14:"PrecedesEqual;";i:10927;s:19:"PrecedesSlantEqual;";i:8828;s:14:"PrecedesTilde;";i:8830;s:6:"Prime;";i:8243;s:8:"Product;";i:8719;s:11:"Proportion;";i:8759;s:13:"Proportional;";i:8733;s:5:"Pscr;";i:119979;s:4:"Psi;";i:936;s:5:"QUOT;";i:34;s:4:"QUOT";i:34;s:4:"Qfr;";i:120084;s:5:"Qopf;";i:8474;s:5:"Qscr;";i:119980;s:6:"RBarr;";i:10512;s:4:"REG;";i:174;s:3:"REG";i:174;s:7:"Racute;";i:340;s:5:"Rang;";i:10219;s:5:"Rarr;";i:8608;s:7:"Rarrtl;";i:10518;s:7:"Rcaron;";i:344;s:7:"Rcedil;";i:342;s:4:"Rcy;";i:1056;s:3:"Re;";i:8476;s:15:"ReverseElement;";i:8715;s:19:"ReverseEquilibrium;";i:8651;s:21:"ReverseUpEquilibrium;";i:10607;s:4:"Rfr;";i:8476;s:4:"Rho;";i:929;s:18:"RightAngleBracket;";i:10217;s:11:"RightArrow;";i:8594;s:14:"RightArrowBar;";i:8677;s:20:"RightArrowLeftArrow;";i:8644;s:13:"RightCeiling;";i:8969;s:19:"RightDoubleBracket;";i:10215;s:19:"RightDownTeeVector;";i:10589;s:16:"RightDownVector;";i:8642;s:19:"RightDownVectorBar;";i:10581;s:11:"RightFloor;";i:8971;s:9:"RightTee;";i:8866;s:14:"RightTeeArrow;";i:8614;s:15:"RightTeeVector;";i:10587;s:14:"RightTriangle;";i:8883;s:17:"RightTriangleBar;";i:10704;s:19:"RightTriangleEqual;";i:8885;s:18:"RightUpDownVector;";i:10575;s:17:"RightUpTeeVector;";i:10588;s:14:"RightUpVector;";i:8638;s:17:"RightUpVectorBar;";i:10580;s:12:"RightVector;";i:8640;s:15:"RightVectorBar;";i:10579;s:11:"Rightarrow;";i:8658;s:5:"Ropf;";i:8477;s:13:"RoundImplies;";i:10608;s:12:"Rrightarrow;";i:8667;s:5:"Rscr;";i:8475;s:4:"Rsh;";i:8625;s:12:"RuleDelayed;";i:10740;s:7:"SHCHcy;";i:1065;s:5:"SHcy;";i:1064;s:7:"SOFTcy;";i:1068;s:7:"Sacute;";i:346;s:3:"Sc;";i:10940;s:7:"Scaron;";i:352;s:7:"Scedil;";i:350;s:6:"Scirc;";i:348;s:4:"Scy;";i:1057;s:4:"Sfr;";i:120086;s:15:"ShortDownArrow;";i:8595;s:15:"ShortLeftArrow;";i:8592;s:16:"ShortRightArrow;";i:8594;s:13:"ShortUpArrow;";i:8593;s:6:"Sigma;";i:931;s:12:"SmallCircle;";i:8728;s:5:"Sopf;";i:120138;s:5:"Sqrt;";i:8730;s:7:"Square;";i:9633;s:19:"SquareIntersection;";i:8851;s:13:"SquareSubset;";i:8847;s:18:"SquareSubsetEqual;";i:8849;s:15:"SquareSuperset;";i:8848;s:20:"SquareSupersetEqual;";i:8850;s:12:"SquareUnion;";i:8852;s:5:"Sscr;";i:119982;s:5:"Star;";i:8902;s:4:"Sub;";i:8912;s:7:"Subset;";i:8912;s:12:"SubsetEqual;";i:8838;s:9:"Succeeds;";i:8827;s:14:"SucceedsEqual;";i:10928;s:19:"SucceedsSlantEqual;";i:8829;s:14:"SucceedsTilde;";i:8831;s:9:"SuchThat;";i:8715;s:4:"Sum;";i:8721;s:4:"Sup;";i:8913;s:9:"Superset;";i:8835;s:14:"SupersetEqual;";i:8839;s:7:"Supset;";i:8913;s:6:"THORN;";i:222;s:5:"THORN";i:222;s:6:"TRADE;";i:8482;s:6:"TSHcy;";i:1035;s:5:"TScy;";i:1062;s:4:"Tab;";i:9;s:4:"Tau;";i:932;s:7:"Tcaron;";i:356;s:7:"Tcedil;";i:354;s:4:"Tcy;";i:1058;s:4:"Tfr;";i:120087;s:10:"Therefore;";i:8756;s:6:"Theta;";i:920;s:10:"ThinSpace;";i:8201;s:6:"Tilde;";i:8764;s:11:"TildeEqual;";i:8771;s:15:"TildeFullEqual;";i:8773;s:11:"TildeTilde;";i:8776;s:5:"Topf;";i:120139;s:10:"TripleDot;";i:8411;s:5:"Tscr;";i:119983;s:7:"Tstrok;";i:358;s:7:"Uacute;";i:218;s:6:"Uacute";i:218;s:5:"Uarr;";i:8607;s:9:"Uarrocir;";i:10569;s:6:"Ubrcy;";i:1038;s:7:"Ubreve;";i:364;s:6:"Ucirc;";i:219;s:5:"Ucirc";i:219;s:4:"Ucy;";i:1059;s:7:"Udblac;";i:368;s:4:"Ufr;";i:120088;s:7:"Ugrave;";i:217;s:6:"Ugrave";i:217;s:6:"Umacr;";i:362;s:9:"UnderBar;";i:818;s:11:"UnderBrace;";i:9183;s:13:"UnderBracket;";i:9141;s:17:"UnderParenthesis;";i:9181;s:6:"Union;";i:8899;s:10:"UnionPlus;";i:8846;s:6:"Uogon;";i:370;s:5:"Uopf;";i:120140;s:8:"UpArrow;";i:8593;s:11:"UpArrowBar;";i:10514;s:17:"UpArrowDownArrow;";i:8645;s:12:"UpDownArrow;";i:8597;s:14:"UpEquilibrium;";i:10606;s:6:"UpTee;";i:8869;s:11:"UpTeeArrow;";i:8613;s:8:"Uparrow;";i:8657;s:12:"Updownarrow;";i:8661;s:15:"UpperLeftArrow;";i:8598;s:16:"UpperRightArrow;";i:8599;s:5:"Upsi;";i:978;s:8:"Upsilon;";i:933;s:6:"Uring;";i:366;s:5:"Uscr;";i:119984;s:7:"Utilde;";i:360;s:5:"Uuml;";i:220;s:4:"Uuml";i:220;s:6:"VDash;";i:8875;s:5:"Vbar;";i:10987;s:4:"Vcy;";i:1042;s:6:"Vdash;";i:8873;s:7:"Vdashl;";i:10982;s:4:"Vee;";i:8897;s:7:"Verbar;";i:8214;s:5:"Vert;";i:8214;s:12:"VerticalBar;";i:8739;s:13:"VerticalLine;";i:124;s:18:"VerticalSeparator;";i:10072;s:14:"VerticalTilde;";i:8768;s:14:"VeryThinSpace;";i:8202;s:4:"Vfr;";i:120089;s:5:"Vopf;";i:120141;s:5:"Vscr;";i:119985;s:7:"Vvdash;";i:8874;s:6:"Wcirc;";i:372;s:6:"Wedge;";i:8896;s:4:"Wfr;";i:120090;s:5:"Wopf;";i:120142;s:5:"Wscr;";i:119986;s:4:"Xfr;";i:120091;s:3:"Xi;";i:926;s:5:"Xopf;";i:120143;s:5:"Xscr;";i:119987;s:5:"YAcy;";i:1071;s:5:"YIcy;";i:1031;s:5:"YUcy;";i:1070;s:7:"Yacute;";i:221;s:6:"Yacute";i:221;s:6:"Ycirc;";i:374;s:4:"Ycy;";i:1067;s:4:"Yfr;";i:120092;s:5:"Yopf;";i:120144;s:5:"Yscr;";i:119988;s:5:"Yuml;";i:376;s:5:"ZHcy;";i:1046;s:7:"Zacute;";i:377;s:7:"Zcaron;";i:381;s:4:"Zcy;";i:1047;s:5:"Zdot;";i:379;s:15:"ZeroWidthSpace;";i:8203;s:5:"Zeta;";i:918;s:4:"Zfr;";i:8488;s:5:"Zopf;";i:8484;s:5:"Zscr;";i:119989;s:7:"aacute;";i:225;s:6:"aacute";i:225;s:7:"abreve;";i:259;s:3:"ac;";i:8766;s:4:"acd;";i:8767;s:6:"acirc;";i:226;s:5:"acirc";i:226;s:6:"acute;";i:180;s:5:"acute";i:180;s:4:"acy;";i:1072;s:6:"aelig;";i:230;s:5:"aelig";i:230;s:3:"af;";i:8289;s:4:"afr;";i:120094;s:7:"agrave;";i:224;s:6:"agrave";i:224;s:8:"alefsym;";i:8501;s:6:"aleph;";i:8501;s:6:"alpha;";i:945;s:6:"amacr;";i:257;s:6:"amalg;";i:10815;s:4:"amp;";i:38;s:3:"amp";i:38;s:4:"and;";i:8743;s:7:"andand;";i:10837;s:5:"andd;";i:10844;s:9:"andslope;";i:10840;s:5:"andv;";i:10842;s:4:"ang;";i:8736;s:5:"ange;";i:10660;s:6:"angle;";i:8736;s:7:"angmsd;";i:8737;s:9:"angmsdaa;";i:10664;s:9:"angmsdab;";i:10665;s:9:"angmsdac;";i:10666;s:9:"angmsdad;";i:10667;s:9:"angmsdae;";i:10668;s:9:"angmsdaf;";i:10669;s:9:"angmsdag;";i:10670;s:9:"angmsdah;";i:10671;s:6:"angrt;";i:8735;s:8:"angrtvb;";i:8894;s:9:"angrtvbd;";i:10653;s:7:"angsph;";i:8738;s:6:"angst;";i:8491;s:8:"angzarr;";i:9084;s:6:"aogon;";i:261;s:5:"aopf;";i:120146;s:3:"ap;";i:8776;s:4:"apE;";i:10864;s:7:"apacir;";i:10863;s:4:"ape;";i:8778;s:5:"apid;";i:8779;s:5:"apos;";i:39;s:7:"approx;";i:8776;s:9:"approxeq;";i:8778;s:6:"aring;";i:229;s:5:"aring";i:229;s:5:"ascr;";i:119990;s:4:"ast;";i:42;s:6:"asymp;";i:8776;s:8:"asympeq;";i:8781;s:7:"atilde;";i:227;s:6:"atilde";i:227;s:5:"auml;";i:228;s:4:"auml";i:228;s:9:"awconint;";i:8755;s:6:"awint;";i:10769;s:5:"bNot;";i:10989;s:9:"backcong;";i:8780;s:12:"backepsilon;";i:1014;s:10:"backprime;";i:8245;s:8:"backsim;";i:8765;s:10:"backsimeq;";i:8909;s:7:"barvee;";i:8893;s:7:"barwed;";i:8965;s:9:"barwedge;";i:8965;s:5:"bbrk;";i:9141;s:9:"bbrktbrk;";i:9142;s:6:"bcong;";i:8780;s:4:"bcy;";i:1073;s:6:"bdquo;";i:8222;s:7:"becaus;";i:8757;s:8:"because;";i:8757;s:8:"bemptyv;";i:10672;s:6:"bepsi;";i:1014;s:7:"bernou;";i:8492;s:5:"beta;";i:946;s:5:"beth;";i:8502;s:8:"between;";i:8812;s:4:"bfr;";i:120095;s:7:"bigcap;";i:8898;s:8:"bigcirc;";i:9711;s:7:"bigcup;";i:8899;s:8:"bigodot;";i:10752;s:9:"bigoplus;";i:10753;s:10:"bigotimes;";i:10754;s:9:"bigsqcup;";i:10758;s:8:"bigstar;";i:9733;s:16:"bigtriangledown;";i:9661;s:14:"bigtriangleup;";i:9651;s:9:"biguplus;";i:10756;s:7:"bigvee;";i:8897;s:9:"bigwedge;";i:8896;s:7:"bkarow;";i:10509;s:13:"blacklozenge;";i:10731;s:12:"blacksquare;";i:9642;s:14:"blacktriangle;";i:9652;s:18:"blacktriangledown;";i:9662;s:18:"blacktriangleleft;";i:9666;s:19:"blacktriangleright;";i:9656;s:6:"blank;";i:9251;s:6:"blk12;";i:9618;s:6:"blk14;";i:9617;s:6:"blk34;";i:9619;s:6:"block;";i:9608;s:5:"bnot;";i:8976;s:5:"bopf;";i:120147;s:4:"bot;";i:8869;s:7:"bottom;";i:8869;s:7:"bowtie;";i:8904;s:6:"boxDL;";i:9559;s:6:"boxDR;";i:9556;s:6:"boxDl;";i:9558;s:6:"boxDr;";i:9555;s:5:"boxH;";i:9552;s:6:"boxHD;";i:9574;s:6:"boxHU;";i:9577;s:6:"boxHd;";i:9572;s:6:"boxHu;";i:9575;s:6:"boxUL;";i:9565;s:6:"boxUR;";i:9562;s:6:"boxUl;";i:9564;s:6:"boxUr;";i:9561;s:5:"boxV;";i:9553;s:6:"boxVH;";i:9580;s:6:"boxVL;";i:9571;s:6:"boxVR;";i:9568;s:6:"boxVh;";i:9579;s:6:"boxVl;";i:9570;s:6:"boxVr;";i:9567;s:7:"boxbox;";i:10697;s:6:"boxdL;";i:9557;s:6:"boxdR;";i:9554;s:6:"boxdl;";i:9488;s:6:"boxdr;";i:9484;s:5:"boxh;";i:9472;s:6:"boxhD;";i:9573;s:6:"boxhU;";i:9576;s:6:"boxhd;";i:9516;s:6:"boxhu;";i:9524;s:9:"boxminus;";i:8863;s:8:"boxplus;";i:8862;s:9:"boxtimes;";i:8864;s:6:"boxuL;";i:9563;s:6:"boxuR;";i:9560;s:6:"boxul;";i:9496;s:6:"boxur;";i:9492;s:5:"boxv;";i:9474;s:6:"boxvH;";i:9578;s:6:"boxvL;";i:9569;s:6:"boxvR;";i:9566;s:6:"boxvh;";i:9532;s:6:"boxvl;";i:9508;s:6:"boxvr;";i:9500;s:7:"bprime;";i:8245;s:6:"breve;";i:728;s:7:"brvbar;";i:166;s:6:"brvbar";i:166;s:5:"bscr;";i:119991;s:6:"bsemi;";i:8271;s:5:"bsim;";i:8765;s:6:"bsime;";i:8909;s:5:"bsol;";i:92;s:6:"bsolb;";i:10693;s:5:"bull;";i:8226;s:7:"bullet;";i:8226;s:5:"bump;";i:8782;s:6:"bumpE;";i:10926;s:6:"bumpe;";i:8783;s:7:"bumpeq;";i:8783;s:7:"cacute;";i:263;s:4:"cap;";i:8745;s:7:"capand;";i:10820;s:9:"capbrcup;";i:10825;s:7:"capcap;";i:10827;s:7:"capcup;";i:10823;s:7:"capdot;";i:10816;s:6:"caret;";i:8257;s:6:"caron;";i:711;s:6:"ccaps;";i:10829;s:7:"ccaron;";i:269;s:7:"ccedil;";i:231;s:6:"ccedil";i:231;s:6:"ccirc;";i:265;s:6:"ccups;";i:10828;s:8:"ccupssm;";i:10832;s:5:"cdot;";i:267;s:6:"cedil;";i:184;s:5:"cedil";i:184;s:8:"cemptyv;";i:10674;s:5:"cent;";i:162;s:4:"cent";i:162;s:10:"centerdot;";i:183;s:4:"cfr;";i:120096;s:5:"chcy;";i:1095;s:6:"check;";i:10003;s:10:"checkmark;";i:10003;s:4:"chi;";i:967;s:4:"cir;";i:9675;s:5:"cirE;";i:10691;s:5:"circ;";i:710;s:7:"circeq;";i:8791;s:16:"circlearrowleft;";i:8634;s:17:"circlearrowright;";i:8635;s:9:"circledR;";i:174;s:9:"circledS;";i:9416;s:11:"circledast;";i:8859;s:12:"circledcirc;";i:8858;s:12:"circleddash;";i:8861;s:5:"cire;";i:8791;s:9:"cirfnint;";i:10768;s:7:"cirmid;";i:10991;s:8:"cirscir;";i:10690;s:6:"clubs;";i:9827;s:9:"clubsuit;";i:9827;s:6:"colon;";i:58;s:7:"colone;";i:8788;s:8:"coloneq;";i:8788;s:6:"comma;";i:44;s:7:"commat;";i:64;s:5:"comp;";i:8705;s:7:"compfn;";i:8728;s:11:"complement;";i:8705;s:10:"complexes;";i:8450;s:5:"cong;";i:8773;s:8:"congdot;";i:10861;s:7:"conint;";i:8750;s:5:"copf;";i:120148;s:7:"coprod;";i:8720;s:5:"copy;";i:169;s:4:"copy";i:169;s:7:"copysr;";i:8471;s:6:"crarr;";i:8629;s:6:"cross;";i:10007;s:5:"cscr;";i:119992;s:5:"csub;";i:10959;s:6:"csube;";i:10961;s:5:"csup;";i:10960;s:6:"csupe;";i:10962;s:6:"ctdot;";i:8943;s:8:"cudarrl;";i:10552;s:8:"cudarrr;";i:10549;s:6:"cuepr;";i:8926;s:6:"cuesc;";i:8927;s:7:"cularr;";i:8630;s:8:"cularrp;";i:10557;s:4:"cup;";i:8746;s:9:"cupbrcap;";i:10824;s:7:"cupcap;";i:10822;s:7:"cupcup;";i:10826;s:7:"cupdot;";i:8845;s:6:"cupor;";i:10821;s:7:"curarr;";i:8631;s:8:"curarrm;";i:10556;s:12:"curlyeqprec;";i:8926;s:12:"curlyeqsucc;";i:8927;s:9:"curlyvee;";i:8910;s:11:"curlywedge;";i:8911;s:7:"curren;";i:164;s:6:"curren";i:164;s:15:"curvearrowleft;";i:8630;s:16:"curvearrowright;";i:8631;s:6:"cuvee;";i:8910;s:6:"cuwed;";i:8911;s:9:"cwconint;";i:8754;s:6:"cwint;";i:8753;s:7:"cylcty;";i:9005;s:5:"dArr;";i:8659;s:5:"dHar;";i:10597;s:7:"dagger;";i:8224;s:7:"daleth;";i:8504;s:5:"darr;";i:8595;s:5:"dash;";i:8208;s:6:"dashv;";i:8867;s:8:"dbkarow;";i:10511;s:6:"dblac;";i:733;s:7:"dcaron;";i:271;s:4:"dcy;";i:1076;s:3:"dd;";i:8518;s:8:"ddagger;";i:8225;s:6:"ddarr;";i:8650;s:8:"ddotseq;";i:10871;s:4:"deg;";i:176;s:3:"deg";i:176;s:6:"delta;";i:948;s:8:"demptyv;";i:10673;s:7:"dfisht;";i:10623;s:4:"dfr;";i:120097;s:6:"dharl;";i:8643;s:6:"dharr;";i:8642;s:5:"diam;";i:8900;s:8:"diamond;";i:8900;s:12:"diamondsuit;";i:9830;s:6:"diams;";i:9830;s:4:"die;";i:168;s:8:"digamma;";i:989;s:6:"disin;";i:8946;s:4:"div;";i:247;s:7:"divide;";i:247;s:6:"divide";i:247;s:14:"divideontimes;";i:8903;s:7:"divonx;";i:8903;s:5:"djcy;";i:1106;s:7:"dlcorn;";i:8990;s:7:"dlcrop;";i:8973;s:7:"dollar;";i:36;s:5:"dopf;";i:120149;s:4:"dot;";i:729;s:6:"doteq;";i:8784;s:9:"doteqdot;";i:8785;s:9:"dotminus;";i:8760;s:8:"dotplus;";i:8724;s:10:"dotsquare;";i:8865;s:15:"doublebarwedge;";i:8966;s:10:"downarrow;";i:8595;s:15:"downdownarrows;";i:8650;s:16:"downharpoonleft;";i:8643;s:17:"downharpoonright;";i:8642;s:9:"drbkarow;";i:10512;s:7:"drcorn;";i:8991;s:7:"drcrop;";i:8972;s:5:"dscr;";i:119993;s:5:"dscy;";i:1109;s:5:"dsol;";i:10742;s:7:"dstrok;";i:273;s:6:"dtdot;";i:8945;s:5:"dtri;";i:9663;s:6:"dtrif;";i:9662;s:6:"duarr;";i:8693;s:6:"duhar;";i:10607;s:8:"dwangle;";i:10662;s:5:"dzcy;";i:1119;s:9:"dzigrarr;";i:10239;s:6:"eDDot;";i:10871;s:5:"eDot;";i:8785;s:7:"eacute;";i:233;s:6:"eacute";i:233;s:7:"easter;";i:10862;s:7:"ecaron;";i:283;s:5:"ecir;";i:8790;s:6:"ecirc;";i:234;s:5:"ecirc";i:234;s:7:"ecolon;";i:8789;s:4:"ecy;";i:1101;s:5:"edot;";i:279;s:3:"ee;";i:8519;s:6:"efDot;";i:8786;s:4:"efr;";i:120098;s:3:"eg;";i:10906;s:7:"egrave;";i:232;s:6:"egrave";i:232;s:4:"egs;";i:10902;s:7:"egsdot;";i:10904;s:3:"el;";i:10905;s:9:"elinters;";i:9191;s:4:"ell;";i:8467;s:4:"els;";i:10901;s:7:"elsdot;";i:10903;s:6:"emacr;";i:275;s:6:"empty;";i:8709;s:9:"emptyset;";i:8709;s:7:"emptyv;";i:8709;s:7:"emsp13;";i:8196;s:7:"emsp14;";i:8197;s:5:"emsp;";i:8195;s:4:"eng;";i:331;s:5:"ensp;";i:8194;s:6:"eogon;";i:281;s:5:"eopf;";i:120150;s:5:"epar;";i:8917;s:7:"eparsl;";i:10723;s:6:"eplus;";i:10865;s:5:"epsi;";i:1013;s:8:"epsilon;";i:949;s:6:"epsiv;";i:949;s:7:"eqcirc;";i:8790;s:8:"eqcolon;";i:8789;s:6:"eqsim;";i:8770;s:11:"eqslantgtr;";i:10902;s:12:"eqslantless;";i:10901;s:7:"equals;";i:61;s:7:"equest;";i:8799;s:6:"equiv;";i:8801;s:8:"equivDD;";i:10872;s:9:"eqvparsl;";i:10725;s:6:"erDot;";i:8787;s:6:"erarr;";i:10609;s:5:"escr;";i:8495;s:6:"esdot;";i:8784;s:5:"esim;";i:8770;s:4:"eta;";i:951;s:4:"eth;";i:240;s:3:"eth";i:240;s:5:"euml;";i:235;s:4:"euml";i:235;s:5:"euro;";i:8364;s:5:"excl;";i:33;s:6:"exist;";i:8707;s:12:"expectation;";i:8496;s:13:"exponentiale;";i:8519;s:14:"fallingdotseq;";i:8786;s:4:"fcy;";i:1092;s:7:"female;";i:9792;s:7:"ffilig;";i:64259;s:6:"fflig;";i:64256;s:7:"ffllig;";i:64260;s:4:"ffr;";i:120099;s:6:"filig;";i:64257;s:5:"flat;";i:9837;s:6:"fllig;";i:64258;s:6:"fltns;";i:9649;s:5:"fnof;";i:402;s:5:"fopf;";i:120151;s:7:"forall;";i:8704;s:5:"fork;";i:8916;s:6:"forkv;";i:10969;s:9:"fpartint;";i:10765;s:7:"frac12;";i:189;s:6:"frac12";i:189;s:7:"frac13;";i:8531;s:7:"frac14;";i:188;s:6:"frac14";i:188;s:7:"frac15;";i:8533;s:7:"frac16;";i:8537;s:7:"frac18;";i:8539;s:7:"frac23;";i:8532;s:7:"frac25;";i:8534;s:7:"frac34;";i:190;s:6:"frac34";i:190;s:7:"frac35;";i:8535;s:7:"frac38;";i:8540;s:7:"frac45;";i:8536;s:7:"frac56;";i:8538;s:7:"frac58;";i:8541;s:7:"frac78;";i:8542;s:6:"frasl;";i:8260;s:6:"frown;";i:8994;s:5:"fscr;";i:119995;s:3:"gE;";i:8807;s:4:"gEl;";i:10892;s:7:"gacute;";i:501;s:6:"gamma;";i:947;s:7:"gammad;";i:989;s:4:"gap;";i:10886;s:7:"gbreve;";i:287;s:6:"gcirc;";i:285;s:4:"gcy;";i:1075;s:5:"gdot;";i:289;s:3:"ge;";i:8805;s:4:"gel;";i:8923;s:4:"geq;";i:8805;s:5:"geqq;";i:8807;s:9:"geqslant;";i:10878;s:4:"ges;";i:10878;s:6:"gescc;";i:10921;s:7:"gesdot;";i:10880;s:8:"gesdoto;";i:10882;s:9:"gesdotol;";i:10884;s:7:"gesles;";i:10900;s:4:"gfr;";i:120100;s:3:"gg;";i:8811;s:4:"ggg;";i:8921;s:6:"gimel;";i:8503;s:5:"gjcy;";i:1107;s:3:"gl;";i:8823;s:4:"glE;";i:10898;s:4:"gla;";i:10917;s:4:"glj;";i:10916;s:4:"gnE;";i:8809;s:5:"gnap;";i:10890;s:9:"gnapprox;";i:10890;s:4:"gne;";i:10888;s:5:"gneq;";i:10888;s:6:"gneqq;";i:8809;s:6:"gnsim;";i:8935;s:5:"gopf;";i:120152;s:6:"grave;";i:96;s:5:"gscr;";i:8458;s:5:"gsim;";i:8819;s:6:"gsime;";i:10894;s:6:"gsiml;";i:10896;s:3:"gt;";i:62;s:2:"gt";i:62;s:5:"gtcc;";i:10919;s:6:"gtcir;";i:10874;s:6:"gtdot;";i:8919;s:7:"gtlPar;";i:10645;s:8:"gtquest;";i:10876;s:10:"gtrapprox;";i:10886;s:7:"gtrarr;";i:10616;s:7:"gtrdot;";i:8919;s:10:"gtreqless;";i:8923;s:11:"gtreqqless;";i:10892;s:8:"gtrless;";i:8823;s:7:"gtrsim;";i:8819;s:5:"hArr;";i:8660;s:7:"hairsp;";i:8202;s:5:"half;";i:189;s:7:"hamilt;";i:8459;s:7:"hardcy;";i:1098;s:5:"harr;";i:8596;s:8:"harrcir;";i:10568;s:6:"harrw;";i:8621;s:5:"hbar;";i:8463;s:6:"hcirc;";i:293;s:7:"hearts;";i:9829;s:10:"heartsuit;";i:9829;s:7:"hellip;";i:8230;s:7:"hercon;";i:8889;s:4:"hfr;";i:120101;s:9:"hksearow;";i:10533;s:9:"hkswarow;";i:10534;s:6:"hoarr;";i:8703;s:7:"homtht;";i:8763;s:14:"hookleftarrow;";i:8617;s:15:"hookrightarrow;";i:8618;s:5:"hopf;";i:120153;s:7:"horbar;";i:8213;s:5:"hscr;";i:119997;s:7:"hslash;";i:8463;s:7:"hstrok;";i:295;s:7:"hybull;";i:8259;s:7:"hyphen;";i:8208;s:7:"iacute;";i:237;s:6:"iacute";i:237;s:3:"ic;";i:8291;s:6:"icirc;";i:238;s:5:"icirc";i:238;s:4:"icy;";i:1080;s:5:"iecy;";i:1077;s:6:"iexcl;";i:161;s:5:"iexcl";i:161;s:4:"iff;";i:8660;s:4:"ifr;";i:120102;s:7:"igrave;";i:236;s:6:"igrave";i:236;s:3:"ii;";i:8520;s:7:"iiiint;";i:10764;s:6:"iiint;";i:8749;s:7:"iinfin;";i:10716;s:6:"iiota;";i:8489;s:6:"ijlig;";i:307;s:6:"imacr;";i:299;s:6:"image;";i:8465;s:9:"imagline;";i:8464;s:9:"imagpart;";i:8465;s:6:"imath;";i:305;s:5:"imof;";i:8887;s:6:"imped;";i:437;s:3:"in;";i:8712;s:7:"incare;";i:8453;s:6:"infin;";i:8734;s:9:"infintie;";i:10717;s:7:"inodot;";i:305;s:4:"int;";i:8747;s:7:"intcal;";i:8890;s:9:"integers;";i:8484;s:9:"intercal;";i:8890;s:9:"intlarhk;";i:10775;s:8:"intprod;";i:10812;s:5:"iocy;";i:1105;s:6:"iogon;";i:303;s:5:"iopf;";i:120154;s:5:"iota;";i:953;s:6:"iprod;";i:10812;s:7:"iquest;";i:191;s:6:"iquest";i:191;s:5:"iscr;";i:119998;s:5:"isin;";i:8712;s:6:"isinE;";i:8953;s:8:"isindot;";i:8949;s:6:"isins;";i:8948;s:7:"isinsv;";i:8947;s:6:"isinv;";i:8712;s:3:"it;";i:8290;s:7:"itilde;";i:297;s:6:"iukcy;";i:1110;s:5:"iuml;";i:239;s:4:"iuml";i:239;s:6:"jcirc;";i:309;s:4:"jcy;";i:1081;s:4:"jfr;";i:120103;s:6:"jmath;";i:567;s:5:"jopf;";i:120155;s:5:"jscr;";i:119999;s:7:"jsercy;";i:1112;s:6:"jukcy;";i:1108;s:6:"kappa;";i:954;s:7:"kappav;";i:1008;s:7:"kcedil;";i:311;s:4:"kcy;";i:1082;s:4:"kfr;";i:120104;s:7:"kgreen;";i:312;s:5:"khcy;";i:1093;s:5:"kjcy;";i:1116;s:5:"kopf;";i:120156;s:5:"kscr;";i:120000;s:6:"lAarr;";i:8666;s:5:"lArr;";i:8656;s:7:"lAtail;";i:10523;s:6:"lBarr;";i:10510;s:3:"lE;";i:8806;s:4:"lEg;";i:10891;s:5:"lHar;";i:10594;s:7:"lacute;";i:314;s:9:"laemptyv;";i:10676;s:7:"lagran;";i:8466;s:7:"lambda;";i:955;s:5:"lang;";i:10216;s:6:"langd;";i:10641;s:7:"langle;";i:10216;s:4:"lap;";i:10885;s:6:"laquo;";i:171;s:5:"laquo";i:171;s:5:"larr;";i:8592;s:6:"larrb;";i:8676;s:8:"larrbfs;";i:10527;s:7:"larrfs;";i:10525;s:7:"larrhk;";i:8617;s:7:"larrlp;";i:8619;s:7:"larrpl;";i:10553;s:8:"larrsim;";i:10611;s:7:"larrtl;";i:8610;s:4:"lat;";i:10923;s:7:"latail;";i:10521;s:5:"late;";i:10925;s:6:"lbarr;";i:10508;s:6:"lbbrk;";i:10098;s:7:"lbrace;";i:123;s:7:"lbrack;";i:91;s:6:"lbrke;";i:10635;s:8:"lbrksld;";i:10639;s:8:"lbrkslu;";i:10637;s:7:"lcaron;";i:318;s:7:"lcedil;";i:316;s:6:"lceil;";i:8968;s:5:"lcub;";i:123;s:4:"lcy;";i:1083;s:5:"ldca;";i:10550;s:6:"ldquo;";i:8220;s:7:"ldquor;";i:8222;s:8:"ldrdhar;";i:10599;s:9:"ldrushar;";i:10571;s:5:"ldsh;";i:8626;s:3:"le;";i:8804;s:10:"leftarrow;";i:8592;s:14:"leftarrowtail;";i:8610;s:16:"leftharpoondown;";i:8637;s:14:"leftharpoonup;";i:8636;s:15:"leftleftarrows;";i:8647;s:15:"leftrightarrow;";i:8596;s:16:"leftrightarrows;";i:8646;s:18:"leftrightharpoons;";i:8651;s:20:"leftrightsquigarrow;";i:8621;s:15:"leftthreetimes;";i:8907;s:4:"leg;";i:8922;s:4:"leq;";i:8804;s:5:"leqq;";i:8806;s:9:"leqslant;";i:10877;s:4:"les;";i:10877;s:6:"lescc;";i:10920;s:7:"lesdot;";i:10879;s:8:"lesdoto;";i:10881;s:9:"lesdotor;";i:10883;s:7:"lesges;";i:10899;s:11:"lessapprox;";i:10885;s:8:"lessdot;";i:8918;s:10:"lesseqgtr;";i:8922;s:11:"lesseqqgtr;";i:10891;s:8:"lessgtr;";i:8822;s:8:"lesssim;";i:8818;s:7:"lfisht;";i:10620;s:7:"lfloor;";i:8970;s:4:"lfr;";i:120105;s:3:"lg;";i:8822;s:4:"lgE;";i:10897;s:6:"lhard;";i:8637;s:6:"lharu;";i:8636;s:7:"lharul;";i:10602;s:6:"lhblk;";i:9604;s:5:"ljcy;";i:1113;s:3:"ll;";i:8810;s:6:"llarr;";i:8647;s:9:"llcorner;";i:8990;s:7:"llhard;";i:10603;s:6:"lltri;";i:9722;s:7:"lmidot;";i:320;s:7:"lmoust;";i:9136;s:11:"lmoustache;";i:9136;s:4:"lnE;";i:8808;s:5:"lnap;";i:10889;s:9:"lnapprox;";i:10889;s:4:"lne;";i:10887;s:5:"lneq;";i:10887;s:6:"lneqq;";i:8808;s:6:"lnsim;";i:8934;s:6:"loang;";i:10220;s:6:"loarr;";i:8701;s:6:"lobrk;";i:10214;s:14:"longleftarrow;";i:10229;s:19:"longleftrightarrow;";i:10231;s:11:"longmapsto;";i:10236;s:15:"longrightarrow;";i:10230;s:14:"looparrowleft;";i:8619;s:15:"looparrowright;";i:8620;s:6:"lopar;";i:10629;s:5:"lopf;";i:120157;s:7:"loplus;";i:10797;s:8:"lotimes;";i:10804;s:7:"lowast;";i:8727;s:7:"lowbar;";i:95;s:4:"loz;";i:9674;s:8:"lozenge;";i:9674;s:5:"lozf;";i:10731;s:5:"lpar;";i:40;s:7:"lparlt;";i:10643;s:6:"lrarr;";i:8646;s:9:"lrcorner;";i:8991;s:6:"lrhar;";i:8651;s:7:"lrhard;";i:10605;s:4:"lrm;";i:8206;s:6:"lrtri;";i:8895;s:7:"lsaquo;";i:8249;s:5:"lscr;";i:120001;s:4:"lsh;";i:8624;s:5:"lsim;";i:8818;s:6:"lsime;";i:10893;s:6:"lsimg;";i:10895;s:5:"lsqb;";i:91;s:6:"lsquo;";i:8216;s:7:"lsquor;";i:8218;s:7:"lstrok;";i:322;s:3:"lt;";i:60;s:2:"lt";i:60;s:5:"ltcc;";i:10918;s:6:"ltcir;";i:10873;s:6:"ltdot;";i:8918;s:7:"lthree;";i:8907;s:7:"ltimes;";i:8905;s:7:"ltlarr;";i:10614;s:8:"ltquest;";i:10875;s:7:"ltrPar;";i:10646;s:5:"ltri;";i:9667;s:6:"ltrie;";i:8884;s:6:"ltrif;";i:9666;s:9:"lurdshar;";i:10570;s:8:"luruhar;";i:10598;s:6:"mDDot;";i:8762;s:5:"macr;";i:175;s:4:"macr";i:175;s:5:"male;";i:9794;s:5:"malt;";i:10016;s:8:"maltese;";i:10016;s:4:"map;";i:8614;s:7:"mapsto;";i:8614;s:11:"mapstodown;";i:8615;s:11:"mapstoleft;";i:8612;s:9:"mapstoup;";i:8613;s:7:"marker;";i:9646;s:7:"mcomma;";i:10793;s:4:"mcy;";i:1084;s:6:"mdash;";i:8212;s:14:"measuredangle;";i:8737;s:4:"mfr;";i:120106;s:4:"mho;";i:8487;s:6:"micro;";i:181;s:5:"micro";i:181;s:4:"mid;";i:8739;s:7:"midast;";i:42;s:7:"midcir;";i:10992;s:7:"middot;";i:183;s:6:"middot";i:183;s:6:"minus;";i:8722;s:7:"minusb;";i:8863;s:7:"minusd;";i:8760;s:8:"minusdu;";i:10794;s:5:"mlcp;";i:10971;s:5:"mldr;";i:8230;s:7:"mnplus;";i:8723;s:7:"models;";i:8871;s:5:"mopf;";i:120158;s:3:"mp;";i:8723;s:5:"mscr;";i:120002;s:7:"mstpos;";i:8766;s:3:"mu;";i:956;s:9:"multimap;";i:8888;s:6:"mumap;";i:8888;s:11:"nLeftarrow;";i:8653;s:16:"nLeftrightarrow;";i:8654;s:12:"nRightarrow;";i:8655;s:7:"nVDash;";i:8879;s:7:"nVdash;";i:8878;s:6:"nabla;";i:8711;s:7:"nacute;";i:324;s:4:"nap;";i:8777;s:6:"napos;";i:329;s:8:"napprox;";i:8777;s:6:"natur;";i:9838;s:8:"natural;";i:9838;s:9:"naturals;";i:8469;s:5:"nbsp;";i:160;s:4:"nbsp";i:160;s:5:"ncap;";i:10819;s:7:"ncaron;";i:328;s:7:"ncedil;";i:326;s:6:"ncong;";i:8775;s:5:"ncup;";i:10818;s:4:"ncy;";i:1085;s:6:"ndash;";i:8211;s:3:"ne;";i:8800;s:6:"neArr;";i:8663;s:7:"nearhk;";i:10532;s:6:"nearr;";i:8599;s:8:"nearrow;";i:8599;s:7:"nequiv;";i:8802;s:7:"nesear;";i:10536;s:7:"nexist;";i:8708;s:8:"nexists;";i:8708;s:4:"nfr;";i:120107;s:4:"nge;";i:8817;s:5:"ngeq;";i:8817;s:6:"ngsim;";i:8821;s:4:"ngt;";i:8815;s:5:"ngtr;";i:8815;s:6:"nhArr;";i:8654;s:6:"nharr;";i:8622;s:6:"nhpar;";i:10994;s:3:"ni;";i:8715;s:4:"nis;";i:8956;s:5:"nisd;";i:8954;s:4:"niv;";i:8715;s:5:"njcy;";i:1114;s:6:"nlArr;";i:8653;s:6:"nlarr;";i:8602;s:5:"nldr;";i:8229;s:4:"nle;";i:8816;s:11:"nleftarrow;";i:8602;s:16:"nleftrightarrow;";i:8622;s:5:"nleq;";i:8816;s:6:"nless;";i:8814;s:6:"nlsim;";i:8820;s:4:"nlt;";i:8814;s:6:"nltri;";i:8938;s:7:"nltrie;";i:8940;s:5:"nmid;";i:8740;s:5:"nopf;";i:120159;s:4:"not;";i:172;s:3:"not";i:172;s:6:"notin;";i:8713;s:8:"notinva;";i:8713;s:8:"notinvb;";i:8951;s:8:"notinvc;";i:8950;s:6:"notni;";i:8716;s:8:"notniva;";i:8716;s:8:"notnivb;";i:8958;s:8:"notnivc;";i:8957;s:5:"npar;";i:8742;s:10:"nparallel;";i:8742;s:8:"npolint;";i:10772;s:4:"npr;";i:8832;s:7:"nprcue;";i:8928;s:6:"nprec;";i:8832;s:6:"nrArr;";i:8655;s:6:"nrarr;";i:8603;s:12:"nrightarrow;";i:8603;s:6:"nrtri;";i:8939;s:7:"nrtrie;";i:8941;s:4:"nsc;";i:8833;s:7:"nsccue;";i:8929;s:5:"nscr;";i:120003;s:10:"nshortmid;";i:8740;s:15:"nshortparallel;";i:8742;s:5:"nsim;";i:8769;s:6:"nsime;";i:8772;s:7:"nsimeq;";i:8772;s:6:"nsmid;";i:8740;s:6:"nspar;";i:8742;s:8:"nsqsube;";i:8930;s:8:"nsqsupe;";i:8931;s:5:"nsub;";i:8836;s:6:"nsube;";i:8840;s:10:"nsubseteq;";i:8840;s:6:"nsucc;";i:8833;s:5:"nsup;";i:8837;s:6:"nsupe;";i:8841;s:10:"nsupseteq;";i:8841;s:5:"ntgl;";i:8825;s:7:"ntilde;";i:241;s:6:"ntilde";i:241;s:5:"ntlg;";i:8824;s:14:"ntriangleleft;";i:8938;s:16:"ntrianglelefteq;";i:8940;s:15:"ntriangleright;";i:8939;s:17:"ntrianglerighteq;";i:8941;s:3:"nu;";i:957;s:4:"num;";i:35;s:7:"numero;";i:8470;s:6:"numsp;";i:8199;s:7:"nvDash;";i:8877;s:7:"nvHarr;";i:10500;s:7:"nvdash;";i:8876;s:8:"nvinfin;";i:10718;s:7:"nvlArr;";i:10498;s:7:"nvrArr;";i:10499;s:6:"nwArr;";i:8662;s:7:"nwarhk;";i:10531;s:6:"nwarr;";i:8598;s:8:"nwarrow;";i:8598;s:7:"nwnear;";i:10535;s:3:"oS;";i:9416;s:7:"oacute;";i:243;s:6:"oacute";i:243;s:5:"oast;";i:8859;s:5:"ocir;";i:8858;s:6:"ocirc;";i:244;s:5:"ocirc";i:244;s:4:"ocy;";i:1086;s:6:"odash;";i:8861;s:7:"odblac;";i:337;s:5:"odiv;";i:10808;s:5:"odot;";i:8857;s:7:"odsold;";i:10684;s:6:"oelig;";i:339;s:6:"ofcir;";i:10687;s:4:"ofr;";i:120108;s:5:"ogon;";i:731;s:7:"ograve;";i:242;s:6:"ograve";i:242;s:4:"ogt;";i:10689;s:6:"ohbar;";i:10677;s:4:"ohm;";i:8486;s:5:"oint;";i:8750;s:6:"olarr;";i:8634;s:6:"olcir;";i:10686;s:8:"olcross;";i:10683;s:6:"oline;";i:8254;s:4:"olt;";i:10688;s:6:"omacr;";i:333;s:6:"omega;";i:969;s:8:"omicron;";i:959;s:5:"omid;";i:10678;s:7:"ominus;";i:8854;s:5:"oopf;";i:120160;s:5:"opar;";i:10679;s:6:"operp;";i:10681;s:6:"oplus;";i:8853;s:3:"or;";i:8744;s:6:"orarr;";i:8635;s:4:"ord;";i:10845;s:6:"order;";i:8500;s:8:"orderof;";i:8500;s:5:"ordf;";i:170;s:4:"ordf";i:170;s:5:"ordm;";i:186;s:4:"ordm";i:186;s:7:"origof;";i:8886;s:5:"oror;";i:10838;s:8:"orslope;";i:10839;s:4:"orv;";i:10843;s:5:"oscr;";i:8500;s:7:"oslash;";i:248;s:6:"oslash";i:248;s:5:"osol;";i:8856;s:7:"otilde;";i:245;s:6:"otilde";i:245;s:7:"otimes;";i:8855;s:9:"otimesas;";i:10806;s:5:"ouml;";i:246;s:4:"ouml";i:246;s:6:"ovbar;";i:9021;s:4:"par;";i:8741;s:5:"para;";i:182;s:4:"para";i:182;s:9:"parallel;";i:8741;s:7:"parsim;";i:10995;s:6:"parsl;";i:11005;s:5:"part;";i:8706;s:4:"pcy;";i:1087;s:7:"percnt;";i:37;s:7:"period;";i:46;s:7:"permil;";i:8240;s:5:"perp;";i:8869;s:8:"pertenk;";i:8241;s:4:"pfr;";i:120109;s:4:"phi;";i:966;s:5:"phiv;";i:966;s:7:"phmmat;";i:8499;s:6:"phone;";i:9742;s:3:"pi;";i:960;s:10:"pitchfork;";i:8916;s:4:"piv;";i:982;s:7:"planck;";i:8463;s:8:"planckh;";i:8462;s:7:"plankv;";i:8463;s:5:"plus;";i:43;s:9:"plusacir;";i:10787;s:6:"plusb;";i:8862;s:8:"pluscir;";i:10786;s:7:"plusdo;";i:8724;s:7:"plusdu;";i:10789;s:6:"pluse;";i:10866;s:7:"plusmn;";i:177;s:6:"plusmn";i:177;s:8:"plussim;";i:10790;s:8:"plustwo;";i:10791;s:3:"pm;";i:177;s:9:"pointint;";i:10773;s:5:"popf;";i:120161;s:6:"pound;";i:163;s:5:"pound";i:163;s:3:"pr;";i:8826;s:4:"prE;";i:10931;s:5:"prap;";i:10935;s:6:"prcue;";i:8828;s:4:"pre;";i:10927;s:5:"prec;";i:8826;s:11:"precapprox;";i:10935;s:12:"preccurlyeq;";i:8828;s:7:"preceq;";i:10927;s:12:"precnapprox;";i:10937;s:9:"precneqq;";i:10933;s:9:"precnsim;";i:8936;s:8:"precsim;";i:8830;s:6:"prime;";i:8242;s:7:"primes;";i:8473;s:5:"prnE;";i:10933;s:6:"prnap;";i:10937;s:7:"prnsim;";i:8936;s:5:"prod;";i:8719;s:9:"profalar;";i:9006;s:9:"profline;";i:8978;s:9:"profsurf;";i:8979;s:5:"prop;";i:8733;s:7:"propto;";i:8733;s:6:"prsim;";i:8830;s:7:"prurel;";i:8880;s:5:"pscr;";i:120005;s:4:"psi;";i:968;s:7:"puncsp;";i:8200;s:4:"qfr;";i:120110;s:5:"qint;";i:10764;s:5:"qopf;";i:120162;s:7:"qprime;";i:8279;s:5:"qscr;";i:120006;s:12:"quaternions;";i:8461;s:8:"quatint;";i:10774;s:6:"quest;";i:63;s:8:"questeq;";i:8799;s:5:"quot;";i:34;s:4:"quot";i:34;s:6:"rAarr;";i:8667;s:5:"rArr;";i:8658;s:7:"rAtail;";i:10524;s:6:"rBarr;";i:10511;s:5:"rHar;";i:10596;s:5:"race;";i:10714;s:7:"racute;";i:341;s:6:"radic;";i:8730;s:9:"raemptyv;";i:10675;s:5:"rang;";i:10217;s:6:"rangd;";i:10642;s:6:"range;";i:10661;s:7:"rangle;";i:10217;s:6:"raquo;";i:187;s:5:"raquo";i:187;s:5:"rarr;";i:8594;s:7:"rarrap;";i:10613;s:6:"rarrb;";i:8677;s:8:"rarrbfs;";i:10528;s:6:"rarrc;";i:10547;s:7:"rarrfs;";i:10526;s:7:"rarrhk;";i:8618;s:7:"rarrlp;";i:8620;s:7:"rarrpl;";i:10565;s:8:"rarrsim;";i:10612;s:7:"rarrtl;";i:8611;s:6:"rarrw;";i:8605;s:7:"ratail;";i:10522;s:6:"ratio;";i:8758;s:10:"rationals;";i:8474;s:6:"rbarr;";i:10509;s:6:"rbbrk;";i:10099;s:7:"rbrace;";i:125;s:7:"rbrack;";i:93;s:6:"rbrke;";i:10636;s:8:"rbrksld;";i:10638;s:8:"rbrkslu;";i:10640;s:7:"rcaron;";i:345;s:7:"rcedil;";i:343;s:6:"rceil;";i:8969;s:5:"rcub;";i:125;s:4:"rcy;";i:1088;s:5:"rdca;";i:10551;s:8:"rdldhar;";i:10601;s:6:"rdquo;";i:8221;s:7:"rdquor;";i:8221;s:5:"rdsh;";i:8627;s:5:"real;";i:8476;s:8:"realine;";i:8475;s:9:"realpart;";i:8476;s:6:"reals;";i:8477;s:5:"rect;";i:9645;s:4:"reg;";i:174;s:3:"reg";i:174;s:7:"rfisht;";i:10621;s:7:"rfloor;";i:8971;s:4:"rfr;";i:120111;s:6:"rhard;";i:8641;s:6:"rharu;";i:8640;s:7:"rharul;";i:10604;s:4:"rho;";i:961;s:5:"rhov;";i:1009;s:11:"rightarrow;";i:8594;s:15:"rightarrowtail;";i:8611;s:17:"rightharpoondown;";i:8641;s:15:"rightharpoonup;";i:8640;s:16:"rightleftarrows;";i:8644;s:18:"rightleftharpoons;";i:8652;s:17:"rightrightarrows;";i:8649;s:16:"rightsquigarrow;";i:8605;s:16:"rightthreetimes;";i:8908;s:5:"ring;";i:730;s:13:"risingdotseq;";i:8787;s:6:"rlarr;";i:8644;s:6:"rlhar;";i:8652;s:4:"rlm;";i:8207;s:7:"rmoust;";i:9137;s:11:"rmoustache;";i:9137;s:6:"rnmid;";i:10990;s:6:"roang;";i:10221;s:6:"roarr;";i:8702;s:6:"robrk;";i:10215;s:6:"ropar;";i:10630;s:5:"ropf;";i:120163;s:7:"roplus;";i:10798;s:8:"rotimes;";i:10805;s:5:"rpar;";i:41;s:7:"rpargt;";i:10644;s:9:"rppolint;";i:10770;s:6:"rrarr;";i:8649;s:7:"rsaquo;";i:8250;s:5:"rscr;";i:120007;s:4:"rsh;";i:8625;s:5:"rsqb;";i:93;s:6:"rsquo;";i:8217;s:7:"rsquor;";i:8217;s:7:"rthree;";i:8908;s:7:"rtimes;";i:8906;s:5:"rtri;";i:9657;s:6:"rtrie;";i:8885;s:6:"rtrif;";i:9656;s:9:"rtriltri;";i:10702;s:8:"ruluhar;";i:10600;s:3:"rx;";i:8478;s:7:"sacute;";i:347;s:6:"sbquo;";i:8218;s:3:"sc;";i:8827;s:4:"scE;";i:10932;s:5:"scap;";i:10936;s:7:"scaron;";i:353;s:6:"sccue;";i:8829;s:4:"sce;";i:10928;s:7:"scedil;";i:351;s:6:"scirc;";i:349;s:5:"scnE;";i:10934;s:6:"scnap;";i:10938;s:7:"scnsim;";i:8937;s:9:"scpolint;";i:10771;s:6:"scsim;";i:8831;s:4:"scy;";i:1089;s:5:"sdot;";i:8901;s:6:"sdotb;";i:8865;s:6:"sdote;";i:10854;s:6:"seArr;";i:8664;s:7:"searhk;";i:10533;s:6:"searr;";i:8600;s:8:"searrow;";i:8600;s:5:"sect;";i:167;s:4:"sect";i:167;s:5:"semi;";i:59;s:7:"seswar;";i:10537;s:9:"setminus;";i:8726;s:6:"setmn;";i:8726;s:5:"sext;";i:10038;s:4:"sfr;";i:120112;s:7:"sfrown;";i:8994;s:6:"sharp;";i:9839;s:7:"shchcy;";i:1097;s:5:"shcy;";i:1096;s:9:"shortmid;";i:8739;s:14:"shortparallel;";i:8741;s:4:"shy;";i:173;s:3:"shy";i:173;s:6:"sigma;";i:963;s:7:"sigmaf;";i:962;s:7:"sigmav;";i:962;s:4:"sim;";i:8764;s:7:"simdot;";i:10858;s:5:"sime;";i:8771;s:6:"simeq;";i:8771;s:5:"simg;";i:10910;s:6:"simgE;";i:10912;s:5:"siml;";i:10909;s:6:"simlE;";i:10911;s:6:"simne;";i:8774;s:8:"simplus;";i:10788;s:8:"simrarr;";i:10610;s:6:"slarr;";i:8592;s:14:"smallsetminus;";i:8726;s:7:"smashp;";i:10803;s:9:"smeparsl;";i:10724;s:5:"smid;";i:8739;s:6:"smile;";i:8995;s:4:"smt;";i:10922;s:5:"smte;";i:10924;s:7:"softcy;";i:1100;s:4:"sol;";i:47;s:5:"solb;";i:10692;s:7:"solbar;";i:9023;s:5:"sopf;";i:120164;s:7:"spades;";i:9824;s:10:"spadesuit;";i:9824;s:5:"spar;";i:8741;s:6:"sqcap;";i:8851;s:6:"sqcup;";i:8852;s:6:"sqsub;";i:8847;s:7:"sqsube;";i:8849;s:9:"sqsubset;";i:8847;s:11:"sqsubseteq;";i:8849;s:6:"sqsup;";i:8848;s:7:"sqsupe;";i:8850;s:9:"sqsupset;";i:8848;s:11:"sqsupseteq;";i:8850;s:4:"squ;";i:9633;s:7:"square;";i:9633;s:7:"squarf;";i:9642;s:5:"squf;";i:9642;s:6:"srarr;";i:8594;s:5:"sscr;";i:120008;s:7:"ssetmn;";i:8726;s:7:"ssmile;";i:8995;s:7:"sstarf;";i:8902;s:5:"star;";i:9734;s:6:"starf;";i:9733;s:16:"straightepsilon;";i:1013;s:12:"straightphi;";i:981;s:6:"strns;";i:175;s:4:"sub;";i:8834;s:5:"subE;";i:10949;s:7:"subdot;";i:10941;s:5:"sube;";i:8838;s:8:"subedot;";i:10947;s:8:"submult;";i:10945;s:6:"subnE;";i:10955;s:6:"subne;";i:8842;s:8:"subplus;";i:10943;s:8:"subrarr;";i:10617;s:7:"subset;";i:8834;s:9:"subseteq;";i:8838;s:10:"subseteqq;";i:10949;s:10:"subsetneq;";i:8842;s:11:"subsetneqq;";i:10955;s:7:"subsim;";i:10951;s:7:"subsub;";i:10965;s:7:"subsup;";i:10963;s:5:"succ;";i:8827;s:11:"succapprox;";i:10936;s:12:"succcurlyeq;";i:8829;s:7:"succeq;";i:10928;s:12:"succnapprox;";i:10938;s:9:"succneqq;";i:10934;s:9:"succnsim;";i:8937;s:8:"succsim;";i:8831;s:4:"sum;";i:8721;s:5:"sung;";i:9834;s:5:"sup1;";i:185;s:4:"sup1";i:185;s:5:"sup2;";i:178;s:4:"sup2";i:178;s:5:"sup3;";i:179;s:4:"sup3";i:179;s:4:"sup;";i:8835;s:5:"supE;";i:10950;s:7:"supdot;";i:10942;s:8:"supdsub;";i:10968;s:5:"supe;";i:8839;s:8:"supedot;";i:10948;s:8:"suphsub;";i:10967;s:8:"suplarr;";i:10619;s:8:"supmult;";i:10946;s:6:"supnE;";i:10956;s:6:"supne;";i:8843;s:8:"supplus;";i:10944;s:7:"supset;";i:8835;s:9:"supseteq;";i:8839;s:10:"supseteqq;";i:10950;s:10:"supsetneq;";i:8843;s:11:"supsetneqq;";i:10956;s:7:"supsim;";i:10952;s:7:"supsub;";i:10964;s:7:"supsup;";i:10966;s:6:"swArr;";i:8665;s:7:"swarhk;";i:10534;s:6:"swarr;";i:8601;s:8:"swarrow;";i:8601;s:7:"swnwar;";i:10538;s:6:"szlig;";i:223;s:5:"szlig";i:223;s:7:"target;";i:8982;s:4:"tau;";i:964;s:5:"tbrk;";i:9140;s:7:"tcaron;";i:357;s:7:"tcedil;";i:355;s:4:"tcy;";i:1090;s:5:"tdot;";i:8411;s:7:"telrec;";i:8981;s:4:"tfr;";i:120113;s:7:"there4;";i:8756;s:10:"therefore;";i:8756;s:6:"theta;";i:952;s:9:"thetasym;";i:977;s:7:"thetav;";i:977;s:12:"thickapprox;";i:8776;s:9:"thicksim;";i:8764;s:7:"thinsp;";i:8201;s:6:"thkap;";i:8776;s:7:"thksim;";i:8764;s:6:"thorn;";i:254;s:5:"thorn";i:254;s:6:"tilde;";i:732;s:6:"times;";i:215;s:5:"times";i:215;s:7:"timesb;";i:8864;s:9:"timesbar;";i:10801;s:7:"timesd;";i:10800;s:5:"tint;";i:8749;s:5:"toea;";i:10536;s:4:"top;";i:8868;s:7:"topbot;";i:9014;s:7:"topcir;";i:10993;s:5:"topf;";i:120165;s:8:"topfork;";i:10970;s:5:"tosa;";i:10537;s:7:"tprime;";i:8244;s:6:"trade;";i:8482;s:9:"triangle;";i:9653;s:13:"triangledown;";i:9663;s:13:"triangleleft;";i:9667;s:15:"trianglelefteq;";i:8884;s:10:"triangleq;";i:8796;s:14:"triangleright;";i:9657;s:16:"trianglerighteq;";i:8885;s:7:"tridot;";i:9708;s:5:"trie;";i:8796;s:9:"triminus;";i:10810;s:8:"triplus;";i:10809;s:6:"trisb;";i:10701;s:8:"tritime;";i:10811;s:9:"trpezium;";i:9186;s:5:"tscr;";i:120009;s:5:"tscy;";i:1094;s:6:"tshcy;";i:1115;s:7:"tstrok;";i:359;s:6:"twixt;";i:8812;s:17:"twoheadleftarrow;";i:8606;s:18:"twoheadrightarrow;";i:8608;s:5:"uArr;";i:8657;s:5:"uHar;";i:10595;s:7:"uacute;";i:250;s:6:"uacute";i:250;s:5:"uarr;";i:8593;s:6:"ubrcy;";i:1118;s:7:"ubreve;";i:365;s:6:"ucirc;";i:251;s:5:"ucirc";i:251;s:4:"ucy;";i:1091;s:6:"udarr;";i:8645;s:7:"udblac;";i:369;s:6:"udhar;";i:10606;s:7:"ufisht;";i:10622;s:4:"ufr;";i:120114;s:7:"ugrave;";i:249;s:6:"ugrave";i:249;s:6:"uharl;";i:8639;s:6:"uharr;";i:8638;s:6:"uhblk;";i:9600;s:7:"ulcorn;";i:8988;s:9:"ulcorner;";i:8988;s:7:"ulcrop;";i:8975;s:6:"ultri;";i:9720;s:6:"umacr;";i:363;s:4:"uml;";i:168;s:3:"uml";i:168;s:6:"uogon;";i:371;s:5:"uopf;";i:120166;s:8:"uparrow;";i:8593;s:12:"updownarrow;";i:8597;s:14:"upharpoonleft;";i:8639;s:15:"upharpoonright;";i:8638;s:6:"uplus;";i:8846;s:5:"upsi;";i:965;s:6:"upsih;";i:978;s:8:"upsilon;";i:965;s:11:"upuparrows;";i:8648;s:7:"urcorn;";i:8989;s:9:"urcorner;";i:8989;s:7:"urcrop;";i:8974;s:6:"uring;";i:367;s:6:"urtri;";i:9721;s:5:"uscr;";i:120010;s:6:"utdot;";i:8944;s:7:"utilde;";i:361;s:5:"utri;";i:9653;s:6:"utrif;";i:9652;s:6:"uuarr;";i:8648;s:5:"uuml;";i:252;s:4:"uuml";i:252;s:8:"uwangle;";i:10663;s:5:"vArr;";i:8661;s:5:"vBar;";i:10984;s:6:"vBarv;";i:10985;s:6:"vDash;";i:8872;s:7:"vangrt;";i:10652;s:11:"varepsilon;";i:949;s:9:"varkappa;";i:1008;s:11:"varnothing;";i:8709;s:7:"varphi;";i:966;s:6:"varpi;";i:982;s:10:"varpropto;";i:8733;s:5:"varr;";i:8597;s:7:"varrho;";i:1009;s:9:"varsigma;";i:962;s:9:"vartheta;";i:977;s:16:"vartriangleleft;";i:8882;s:17:"vartriangleright;";i:8883;s:4:"vcy;";i:1074;s:6:"vdash;";i:8866;s:4:"vee;";i:8744;s:7:"veebar;";i:8891;s:6:"veeeq;";i:8794;s:7:"vellip;";i:8942;s:7:"verbar;";i:124;s:5:"vert;";i:124;s:4:"vfr;";i:120115;s:6:"vltri;";i:8882;s:5:"vopf;";i:120167;s:6:"vprop;";i:8733;s:6:"vrtri;";i:8883;s:5:"vscr;";i:120011;s:8:"vzigzag;";i:10650;s:6:"wcirc;";i:373;s:7:"wedbar;";i:10847;s:6:"wedge;";i:8743;s:7:"wedgeq;";i:8793;s:7:"weierp;";i:8472;s:4:"wfr;";i:120116;s:5:"wopf;";i:120168;s:3:"wp;";i:8472;s:3:"wr;";i:8768;s:7:"wreath;";i:8768;s:5:"wscr;";i:120012;s:5:"xcap;";i:8898;s:6:"xcirc;";i:9711;s:5:"xcup;";i:8899;s:6:"xdtri;";i:9661;s:4:"xfr;";i:120117;s:6:"xhArr;";i:10234;s:6:"xharr;";i:10231;s:3:"xi;";i:958;s:6:"xlArr;";i:10232;s:6:"xlarr;";i:10229;s:5:"xmap;";i:10236;s:5:"xnis;";i:8955;s:6:"xodot;";i:10752;s:5:"xopf;";i:120169;s:7:"xoplus;";i:10753;s:7:"xotime;";i:10754;s:6:"xrArr;";i:10233;s:6:"xrarr;";i:10230;s:5:"xscr;";i:120013;s:7:"xsqcup;";i:10758;s:7:"xuplus;";i:10756;s:6:"xutri;";i:9651;s:5:"xvee;";i:8897;s:7:"xwedge;";i:8896;s:7:"yacute;";i:253;s:6:"yacute";i:253;s:5:"yacy;";i:1103;s:6:"ycirc;";i:375;s:4:"ycy;";i:1099;s:4:"yen;";i:165;s:3:"yen";i:165;s:4:"yfr;";i:120118;s:5:"yicy;";i:1111;s:5:"yopf;";i:120170;s:5:"yscr;";i:120014;s:5:"yucy;";i:1102;s:5:"yuml;";i:255;s:4:"yuml";i:255;s:7:"zacute;";i:378;s:7:"zcaron;";i:382;s:4:"zcy;";i:1079;s:5:"zdot;";i:380;s:7:"zeetrf;";i:8488;s:5:"zeta;";i:950;s:4:"zfr;";i:120119;s:5:"zhcy;";i:1078;s:8:"zigrarr;";i:8669;s:5:"zopf;";i:120171;s:5:"zscr;";i:120015;s:4:"zwj;";i:8205;s:5:"zwnj;";i:8204;}libraries/html5/parser.php000064400000003604151160675320011567
0ustar00<?php
/**
 * mod_vertical_menu - Vertical Menu
 *
 * @author    Balint Polgarfi
 * @copyright 2014-2019 Offlajn.com
 * @license   https://gnu.org/licenses/gpl-2.0.html
 * @link      https://offlajn.com
 */
?><?php
/*-------------------------------------------------------------------------
# plg_offlajnjoomla3compat - Offlajn Joomla 3 Compatibility
# -------------------------------------------------------------------------
# @ author    Jeno Kovacs
# @ copyright Copyright (C) 2014 Offlajn.com  All Rights Reserved.
# @ license   http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# @ website   http://www.offlajn.com
-------------------------------------------------------------------------*/
?><?php
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

require_once dirname(__FILE__) . '/Data.php';
require_once dirname(__FILE__) . '/InputStream.php';
require_once dirname(__FILE__) . '/TreeBuilder.php';
require_once dirname(__FILE__) . '/Tokenizer.php';

/**
 * Outwards facing interface for HTML5.
 */
class HTML5_Parser
{
    /**
     * Parses a full HTML document.
     * @param $text HTML text to parse
     * @param $builder Custom builder implementation
     * @return Parsed HTML as DOMDocument
     */
    static public function parse($text, $builder = null) {
        $tokenizer = new HTML5_Tokenizer($text, $builder);
        $tokenizer->parse();
        return $tokenizer->save();
    }
    /**
     * Parses an HTML fragment.
     * @param $text HTML text to parse
     * @param $context String name of context element to pretend parsing is
in.
     * @param $builder Custom builder implementation
     * @return Parsed HTML as DOMDocument
     */
    static public function parseFragment($text, $context = null, $builder =
null) {
        $tokenizer = new HTML5_Tokenizer($text, $builder);
        $tokenizer->parseFragment($context);
        return $tokenizer->save();
    }
}
libraries/html5/Tokenizer.php000064400000326361151160675320012255
0ustar00<?php
/**
 * mod_vertical_menu - Vertical Menu
 *
 * @author    Balint Polgarfi
 * @copyright 2014-2019 Offlajn.com
 * @license   https://gnu.org/licenses/gpl-2.0.html
 * @link      https://offlajn.com
 */
?><?php
/*-------------------------------------------------------------------------
# plg_offlajnjoomla3compat - Offlajn Joomla 3 Compatibility
# -------------------------------------------------------------------------
# @ author    Jeno Kovacs
# @ copyright Copyright (C) 2014 Offlajn.com  All Rights Reserved.
# @ license   http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# @ website   http://www.offlajn.com
-------------------------------------------------------------------------*/
?><?php
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
/*

Copyright 2007 Jeroen van der Meer <http://jero.net/>
Copyright 2008 Edward Z. Yang <http://htmlpurifier.org/>
Copyright 2009 Geoffrey Sneddon <http://gsnedders.com/>

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction,
including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

*/

// Some conventions:
// /* */ indicates verbatim text from the HTML 5 specification
// // indicates regular comments

// all flags are in hyphenated form

class HTML5_Tokenizer {
    /**
     * Points to an InputStream object.
     */
    protected $stream;

    /**
     * Tree builder that the tokenizer emits token to.
     */
    private $tree;

    /**
     * Current content model we are parsing as.
     */
    protected $content_model;

    /**
     * Current token that is being built, but not yet emitted. Also
     * is the last token emitted, if applicable.
     */
    protected $token;

    // These are constants describing the content model
    const PCDATA    = 0;
    const RCDATA    = 1;
    const CDATA     = 2;
    const PLAINTEXT = 3;

    // These are constants describing tokens
    // XXX should probably be moved somewhere else, probably the
    // HTML5 class.
    const DOCTYPE        = 0;
    const STARTTAG       = 1;
    const ENDTAG         = 2;
    const COMMENT        = 3;
    const CHARACTER      = 4;
    const SPACECHARACTER = 5;
    const EOF            = 6;
    const PARSEERROR     = 7;

    // These are constants representing bunches of characters.
    const ALPHA       =
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
    const UPPER_ALPHA = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
    const LOWER_ALPHA = 'abcdefghijklmnopqrstuvwxyz';
    const DIGIT       = '0123456789';
    const HEX         = '0123456789ABCDEFabcdef';
    const WHITESPACE  = "\t\n\x0c ";

    /**
     * @param $data Data to parse
     */
    public function __construct($data, $builder = null) {
        $this->stream = new HTML5_InputStream($data);
        if (!$builder) $this->tree = new HTML5_TreeBuilder;
        $this->content_model = self::PCDATA;
    }

    public function parseFragment($context = null) {
        $this->tree->setupContext($context);
        if ($this->tree->content_model) {
            $this->content_model = $this->tree->content_model;
            $this->tree->content_model = null;
        }
        $this->parse();
    }

    // XXX maybe convert this into an iterator? regardless, this function
    // and the save function should go into a Parser facade of some sort
    /**
     * Performs the actual parsing of the document.
     */
    public function parse() {
        // Current state
        $state = 'data';
        // This is used to avoid having to have look-behind in the data
state.
        $lastFourChars = '';
        /**
         * Escape flag as specified by the HTML5 specification: "used
to
         * control the behavior of the tokeniser. It is either true or
         * false, and initially must be set to the false state."
         */
        $escape = false;
        //echo "\n\n";
        while($state !== null) {
            
            /*echo $state . ' ';
            switch ($this->content_model) {
                case self::PCDATA: echo 'PCDATA'; break;
                case self::RCDATA: echo 'RCDATA'; break;
                case self::CDATA: echo 'CDATA'; break;
                case self::PLAINTEXT: echo 'PLAINTEXT'; break;
            }
            if ($escape) echo " escape";
            echo "\n";*/
            
            switch($state) {
                case 'data':

                    /* Consume the next input character */
                    $char = $this->stream->char();
                    $lastFourChars .= $char;
                    if (strlen($lastFourChars) > 4) $lastFourChars =
substr($lastFourChars, -4);

                    // see below for meaning
                    $hyp_cond = 
                        !$escape &&
                        (
                            $this->content_model === self::RCDATA ||
                            $this->content_model === self::CDATA
                        );
                    $amp_cond =
                        !$escape &&
                        (
                            $this->content_model === self::PCDATA ||
                            $this->content_model === self::RCDATA
                        );
                    $lt_cond =
                        $this->content_model === self::PCDATA ||
                        (
                            (
                                $this->content_model === self::RCDATA ||
                                $this->content_model === self::CDATA
                             ) &&
                             !$escape
                        );
                    $gt_cond = 
                        $escape &&
                        (
                            $this->content_model === self::RCDATA ||
                            $this->content_model === self::CDATA
                        );

                    if($char === '&' && $amp_cond) {
                        /* U+0026 AMPERSAND (&)
                        When the content model flag is set to one of the
PCDATA or RCDATA
                        states and the escape flag is false: switch to the
                        character reference data state. Otherwise: treat it
as per
                        the "anything else" entry below. */
                        $state = 'characterReferenceData';

                    } elseif(
                        $char === '-' &&
                        $hyp_cond &&
                        $lastFourChars === '<!--'
                    ) {
                        /*
                        U+002D HYPHEN-MINUS (-)
                        If the content model flag is set to either the
RCDATA state or
                        the CDATA state, and the escape flag is false, and
there are at
                        least three characters before this one in the input
stream, and the
                        last four characters in the input stream, including
this one, are
                        U+003C LESS-THAN SIGN, U+0021 EXCLAMATION MARK,
U+002D HYPHEN-MINUS,
                        and U+002D HYPHEN-MINUS ("<!--"), then
set the escape flag to true. */
                        $escape = true;

                        /* In any case, emit the input character as a
character token. Stay
                        in the data state. */
                        $this->emitToken(array(
                            'type' => self::CHARACTER,
                            'data' => '-'
                        ));
                        // We do the "any case" part as part of
"anything else".

                    /* U+003C LESS-THAN SIGN (<) */
                    } elseif($char === '<' &&
$lt_cond) {
                        /* When the content model flag is set to the PCDATA
state: switch
                        to the tag open state.

                        When the content model flag is set to either the
RCDATA state or
                        the CDATA state and the escape flag is false:
switch to the tag
                        open state.

                        Otherwise: treat it as per the "anything
else" entry below. */
                        $state = 'tagOpen';

                    /* U+003E GREATER-THAN SIGN (>) */
                    } elseif(
                        $char === '>' &&
                        $gt_cond &&
                        substr($lastFourChars, 1) === '-->'
                    ) {
                        /* If the content model flag is set to either the
RCDATA state or
                        the CDATA state, and the escape flag is true, and
the last three
                        characters in the input stream including this one
are U+002D
                        HYPHEN-MINUS, U+002D HYPHEN-MINUS, U+003E
GREATER-THAN SIGN ("-->"),
                        set the escape flag to false. */
                        $escape = false;

                        /* In any case, emit the input character as a
character token.
                        Stay in the data state. */
                        $this->emitToken(array(
                            'type' => self::CHARACTER,
                            'data' => '>'
                        ));
                        // We do the "any case" part as part of
"anything else".

                    } elseif($char === false) {
                        /* EOF
                        Emit an end-of-file token. */
                        $state = null;
                        $this->tree->emitToken(array(
                            'type' => self::EOF
                        ));
                    
                    } elseif($char === "\t" || $char ===
"\n" || $char === "\x0c" || $char === ' ') {
                        // Directly after emitting a token you switch back
to the "data
                        // state". At that point spaceCharacters are
important so they are
                        // emitted separately.
                        $chars =
$this->stream->charsWhile(self::WHITESPACE);
                        $this->emitToken(array(
                            'type' => self::SPACECHARACTER,
                            'data' => $char . $chars
                        ));
                        $lastFourChars .= $chars;
                        if (strlen($lastFourChars) > 4) $lastFourChars =
substr($lastFourChars, -4);

                    } else {
                        /* Anything else
                        THIS IS AN OPTIMIZATION: Get as many character that
                        otherwise would also be treated as a character
token and emit it
                        as a single character token. Stay in the data
state. */
                        
                        $mask = '';
                        if ($hyp_cond) $mask .= '-';
                        if ($amp_cond) $mask .= '&';
                        if ($lt_cond)  $mask .= '<';
                        if ($gt_cond)  $mask .= '>';

                        if ($mask === '') {
                            $chars = $this->stream->remainingChars();
                        } else {
                            $chars =
$this->stream->charsUntil($mask);
                        }

                        $this->emitToken(array(
                            'type' => self::CHARACTER,
                            'data' => $char . $chars
                        ));

                        $lastFourChars .= $chars;
                        if (strlen($lastFourChars) > 4) $lastFourChars =
substr($lastFourChars, -4);

                        $state = 'data';
                    }
                break;

                case 'characterReferenceData':
                    /* (This cannot happen if the content model flag
                    is set to the CDATA state.) */

                    /* Attempt to consume a character reference, with no
                    additional allowed character. */
                    $entity = $this->consumeCharacterReference();

                    /* If nothing is returned, emit a U+0026 AMPERSAND
                    character token. Otherwise, emit the character token
that
                    was returned. */
                    // This is all done when consuming the character
reference.
                    $this->emitToken(array(
                        'type' => self::CHARACTER,
                        'data' => $entity
                    ));

                    /* Finally, switch to the data state. */
                    $state = 'data';
                break;

                case 'tagOpen':
                    $char = $this->stream->char();

                    switch($this->content_model) {
                        case self::RCDATA:
                        case self::CDATA:
                            /* Consume the next input character. If it is a
                            U+002F SOLIDUS (/) character, switch to the
close
                            tag open state. Otherwise, emit a U+003C
LESS-THAN
                            SIGN character token and reconsume the current
input
                            character in the data state. */
                            // We consumed above.

                            if($char === '/') {
                                $state = 'closeTagOpen';

                            } else {
                                $this->emitToken(array(
                                    'type' => self::CHARACTER,
                                    'data' => '<'
                                ));

                                $this->stream->unget();

                                $state = 'data';
                            }
                        break;

                        case self::PCDATA:
                            /* If the content model flag is set to the
PCDATA state
                            Consume the next input character: */
                            // We consumed above.

                            if($char === '!') {
                                /* U+0021 EXCLAMATION MARK (!)
                                Switch to the markup declaration open
state. */
                                $state = 'markupDeclarationOpen';

                            } elseif($char === '/') {
                                /* U+002F SOLIDUS (/)
                                Switch to the close tag open state. */
                                $state = 'closeTagOpen';

                            } elseif('A' <= $char &&
$char <= 'Z') {
                                /* U+0041 LATIN LETTER A through to U+005A
LATIN LETTER Z
                                Create a new start tag token, set its tag
name to the lowercase
                                version of the input character (add 0x0020
to the character's code
                                point), then switch to the tag name state.
(Don't emit the token
                                yet; further details will be filled in
before it is emitted.) */
                                $this->token = array(
                                    'name'  =>
strtolower($char),
                                    'type'  => self::STARTTAG,
                                    'attr'  => array()
                                );

                                $state = 'tagName';

                            } elseif('a' <= $char &&
$char <= 'z') {
                                /* U+0061 LATIN SMALL LETTER A through to
U+007A LATIN SMALL LETTER Z
                                Create a new start tag token, set its tag
name to the input
                                character, then switch to the tag name
state. (Don't emit
                                the token yet; further details will be
filled in before it
                                is emitted.) */
                                $this->token = array(
                                    'name'  => $char,
                                    'type'  => self::STARTTAG,
                                    'attr'  => array()
                                );

                                $state = 'tagName';

                            } elseif($char === '>') {
                                /* U+003E GREATER-THAN SIGN (>)
                                Parse error. Emit a U+003C LESS-THAN SIGN
character token and a
                                U+003E GREATER-THAN SIGN character token.
Switch to the data state. */
                                $this->emitToken(array(
                                    'type' =>
self::PARSEERROR,
                                    'data' =>
'expected-tag-name-but-got-right-bracket'
                                ));
                                $this->emitToken(array(
                                    'type' => self::CHARACTER,
                                    'data' =>
'<>'
                                ));

                                $state = 'data';

                            } elseif($char === '?') {
                                /* U+003F QUESTION MARK (?)
                                Parse error. Switch to the bogus comment
state. */
                                $this->emitToken(array(
                                    'type' =>
self::PARSEERROR,
                                    'data' =>
'expected-tag-name-but-got-question-mark'
                                ));
                                $this->token = array(
                                    'data' => '?',
                                    'type' => self::COMMENT
                                );
                                $state = 'bogusComment';

                            } else {
                                /* Anything else
                                Parse error. Emit a U+003C LESS-THAN SIGN
character token and
                                reconsume the current input character in
the data state. */
                                $this->emitToken(array(
                                    'type' =>
self::PARSEERROR,
                                    'data' =>
'expected-tag-name'
                                ));
                                $this->emitToken(array(
                                    'type' => self::CHARACTER,
                                    'data' => '<'
                                ));

                                $state = 'data';
                                $this->stream->unget();
                            }
                        break;
                    }
                break;

                case 'closeTagOpen':
                    if (
                        $this->content_model === self::RCDATA ||
                        $this->content_model === self::CDATA
                    ) {
                        /* If the content model flag is set to the RCDATA
or CDATA
                        states... */
                        $name =
strtolower($this->stream->charsWhile(self::ALPHA));
                        $following = $this->stream->char();
                        $this->stream->unget();
                        if (
                            !$this->token ||
                            $this->token['name'] !== $name ||
                            $this->token['name'] === $name
&& !in_array($following, array("\x09", "\x0A",
"\x0C", "\x20", "\x3E", "\x2F",
false))
                        ) {
                            /* if no start tag token has ever been emitted
by this instance
                            of the tokenizer (fragment case), or, if the
next few
                            characters do not match the tag name of the
last start tag
                            token emitted (compared in an ASCII
case-insensitive manner),
                            or if they do but they are not immediately
followed by one of
                            the following characters:

                                * U+0009 CHARACTER TABULATION
                                * U+000A LINE FEED (LF)
                                * U+000C FORM FEED (FF)
                                * U+0020 SPACE
                                * U+003E GREATER-THAN SIGN (>)
                                * U+002F SOLIDUS (/)
                                * EOF

                            ...then emit a U+003C LESS-THAN SIGN character
token, a
                            U+002F SOLIDUS character token, and switch to
the data
                            state to process the next input character. */
                            // XXX: Probably ought to replace in_array with
$following === x ||...

                            // We also need to emit $name now we've
consumed that, as we
                            // know it'll just be emitted as a
character token.
                            $this->emitToken(array(
                                'type' => self::CHARACTER,
                                'data' => '</' .
$name
                            ));

                            $state = 'data';
                        } else {
                            // This matches what would happen if we
actually did the
                            // otherwise below (but we can't because
we've consumed too
                            // much).

                            // Start the end tag token with the name we
already have.
                            $this->token = array(
                                'name'  => $name,
                                'type'  => self::ENDTAG
                            );

                            // Change to tag name state.
                            $state = 'tagName';
                        }
                    } elseif ($this->content_model === self::PCDATA) {
                        /* Otherwise, if the content model flag is set to
the PCDATA
                        state [...]: */
                        $char = $this->stream->char();

                        if ('A' <= $char && $char
<= 'Z') {
                            /* U+0041 LATIN LETTER A through to U+005A
LATIN LETTER Z
                            Create a new end tag token, set its tag name to
the lowercase version
                            of the input character (add 0x0020 to the
character's code point), then
                            switch to the tag name state. (Don't emit
the token yet; further details
                            will be filled in before it is emitted.) */
                            $this->token = array(
                                'name'  => strtolower($char),
                                'type'  => self::ENDTAG
                            );

                            $state = 'tagName';

                        } elseif ('a' <= $char &&
$char <= 'z') {
                            /* U+0061 LATIN SMALL LETTER A through to
U+007A LATIN SMALL LETTER Z
                            Create a new end tag token, set its tag name to
the
                            input character, then switch to the tag name
state.
                            (Don't emit the token yet; further details
will be
                            filled in before it is emitted.) */
                            $this->token = array(
                                'name'  => $char,
                                'type'  => self::ENDTAG
                            );

                            $state = 'tagName';

                        } elseif($char === '>') {
                            /* U+003E GREATER-THAN SIGN (>)
                            Parse error. Switch to the data state. */
                            $this->emitToken(array(
                                'type' => self::PARSEERROR,
                                'data' =>
'expected-closing-tag-but-got-right-bracket'
                            ));
                            $state = 'data';

                        } elseif($char === false) {
                            /* EOF
                            Parse error. Emit a U+003C LESS-THAN SIGN
character token and a U+002F
                            SOLIDUS character token. Reconsume the EOF
character in the data state. */
                            $this->emitToken(array(
                                'type' => self::PARSEERROR,
                                'data' =>
'expected-closing-tag-but-got-eof'
                            ));
                            $this->emitToken(array(
                                'type' => self::CHARACTER,
                                'data' => '</'
                            ));

                            $this->stream->unget();
                            $state = 'data';

                        } else {
                            /* Parse error. Switch to the bogus comment
state. */
                            $this->emitToken(array(
                                'type' => self::PARSEERROR,
                                'data' =>
'expected-closing-tag-but-got-char'
                            ));
                            $this->token = array(
                                'data' => $char,
                                'type' => self::COMMENT
                            );
                            $state = 'bogusComment';
                        }
                    }
                break;

                case 'tagName':
                    /* Consume the next input character: */
                    $char = $this->stream->char();

                    if($char === "\t" || $char === "\n"
|| $char === "\x0c" || $char === ' ') {
                        /* U+0009 CHARACTER TABULATION
                        U+000A LINE FEED (LF)
                        U+000C FORM FEED (FF)
                        U+0020 SPACE
                        Switch to the before attribute name state. */
                        $state = 'beforeAttributeName';

                    } elseif($char === '/') {
                        /* U+002F SOLIDUS (/)
                        Switch to the self-closing start tag state. */
                        $state = 'selfClosingStartTag';

                    } elseif($char === '>') {
                        /* U+003E GREATER-THAN SIGN (>)
                        Emit the current tag token. Switch to the data
state. */
                        $this->emitToken($this->token);
                        $state = 'data';

                    } elseif('A' <= $char && $char
<= 'Z') {
                        /* U+0041 LATIN CAPITAL LETTER A through to U+005A
LATIN CAPITAL LETTER Z
                        Append the lowercase version of the current input
                        character (add 0x0020 to the character's code
point) to
                        the current tag token's tag name. Stay in the
tag name state. */
                        $chars =
$this->stream->charsWhile(self::UPPER_ALPHA);

                        $this->token['name'] .=
strtolower($char . $chars);
                        $state = 'tagName';

                    } elseif($char === false) {
                        /* EOF
                        Parse error. Emit the current tag token. Reconsume
the EOF
                        character in the data state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'eof-in-tag-name'
                        ));
                        $this->emitToken($this->token);

                        $this->stream->unget();
                        $state = 'data';

                    } else {
                        /* Anything else
                        Append the current input character to the current
tag token's tag name.
                        Stay in the tag name state. */
                        $chars =
$this->stream->charsUntil("\t\n\x0C />" .
self::UPPER_ALPHA);

                        $this->token['name'] .= $char .
$chars;
                        $state = 'tagName';
                    }
                break;

                case 'beforeAttributeName':
                    /* Consume the next input character: */
                    $char = $this->stream->char();

                    // this conditional is optimized, check bottom
                    if($char === "\t" || $char === "\n"
|| $char === "\x0c" || $char === ' ') {
                        /* U+0009 CHARACTER TABULATION
                        U+000A LINE FEED (LF)
                        U+000C FORM FEED (FF)
                        U+0020 SPACE
                        Stay in the before attribute name state. */
                        $state = 'beforeAttributeName';

                    } elseif($char === '/') {
                        /* U+002F SOLIDUS (/)
                        Switch to the self-closing start tag state. */
                        $state = 'selfClosingStartTag';

                    } elseif($char === '>') {
                        /* U+003E GREATER-THAN SIGN (>)
                        Emit the current tag token. Switch to the data
state. */
                        $this->emitToken($this->token);
                        $state = 'data';

                    } elseif('A' <= $char && $char
<= 'Z') {
                        /* U+0041 LATIN CAPITAL LETTER A through to U+005A
LATIN CAPITAL LETTER Z
                        Start a new attribute in the current tag token. Set
that
                        attribute's name to the lowercase version of
the current
                        input character (add 0x0020 to the character's
code
                        point), and its value to the empty string. Switch
to the
                        attribute name state.*/
                        $this->token['attr'][] = array(
                            'name'  => strtolower($char),
                            'value' => ''
                        );

                        $state = 'attributeName';

                    } elseif($char === false) {
                        /* EOF
                        Parse error. Emit the current tag token. Reconsume
the EOF
                        character in the data state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'expected-attribute-name-but-got-eof'
                        ));
                        $this->emitToken($this->token);

                        $this->stream->unget();
                        $state = 'data';

                    } else {
                        /* U+0022 QUOTATION MARK (")
                           U+0027 APOSTROPHE (')
                           U+003D EQUALS SIGN (=)
                        Parse error. Treat it as per the "anything
else" entry
                        below. */
                        if($char === '"' || $char ===
"'" || $char === '=') {
                            $this->emitToken(array(
                                'type' => self::PARSEERROR,
                                'data' =>
'invalid-character-in-attribute-name'
                            ));
                        }

                        /* Anything else
                        Start a new attribute in the current tag token. Set
that attribute's
                        name to the current input character, and its value
to the empty string.
                        Switch to the attribute name state. */
                        $this->token['attr'][] = array(
                            'name'  => $char,
                            'value' => ''
                        );

                        $state = 'attributeName';
                    }
                break;

                case 'attributeName':
                    // Consume the next input character:
                    $char = $this->stream->char();

                    // this conditional is optimized, check bottom
                    if($char === "\t" || $char === "\n"
|| $char === "\x0c" || $char === ' ') {
                        /* U+0009 CHARACTER TABULATION
                        U+000A LINE FEED (LF)
                        U+000C FORM FEED (FF)
                        U+0020 SPACE
                        Switch to the after attribute name state. */
                        $state = 'afterAttributeName';

                    } elseif($char === '/') {
                        /* U+002F SOLIDUS (/)
                        Switch to the self-closing start tag state. */
                        $state = 'selfClosingStartTag';

                    } elseif($char === '=') {
                        /* U+003D EQUALS SIGN (=)
                        Switch to the before attribute value state. */
                        $state = 'beforeAttributeValue';

                    } elseif($char === '>') {
                        /* U+003E GREATER-THAN SIGN (>)
                        Emit the current tag token. Switch to the data
state. */
                        $this->emitToken($this->token);
                        $state = 'data';

                    } elseif('A' <= $char && $char
<= 'Z') {
                        /* U+0041 LATIN CAPITAL LETTER A through to U+005A
LATIN CAPITAL LETTER Z
                        Append the lowercase version of the current input
                        character (add 0x0020 to the character's code
point) to
                        the current attribute's name. Stay in the
attribute name
                        state. */
                        $chars =
$this->stream->charsWhile(self::UPPER_ALPHA);

                        $last = count($this->token['attr']) -
1;
                       
$this->token['attr'][$last]['name'] .=
strtolower($char . $chars);

                        $state = 'attributeName';

                    } elseif($char === false) {
                        /* EOF
                        Parse error. Emit the current tag token. Reconsume
the EOF
                        character in the data state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'eof-in-attribute-name'
                        ));
                        $this->emitToken($this->token);

                        $this->stream->unget();
                        $state = 'data';

                    } else {
                        /* U+0022 QUOTATION MARK (")
                           U+0027 APOSTROPHE (')
                        Parse error. Treat it as per the "anything
else"
                        entry below. */
                        if($char === '"' || $char ===
"'") {
                            $this->emitToken(array(
                                'type' => self::PARSEERROR,
                                'data' =>
'invalid-character-in-attribute-name'
                            ));
                        }

                        /* Anything else
                        Append the current input character to the current
attribute's name.
                        Stay in the attribute name state. */
                        $chars =
$this->stream->charsUntil("\t\n\x0C /=>\"'" .
self::UPPER_ALPHA);

                        $last = count($this->token['attr']) -
1;
                       
$this->token['attr'][$last]['name'] .= $char .
$chars;

                        $state = 'attributeName';
                    }

                    /* When the user agent leaves the attribute name state
                    (and before emitting the tag token, if appropriate),
the
                    complete attribute's name must be compared to the
other
                    attributes on the same token; if there is already an
                    attribute on the token with the exact same name, then
this
                    is a parse error and the new attribute must be dropped,
along
                    with the value that gets associated with it (if any).
*/
                    // this might be implemented in the emitToken method
                break;

                case 'afterAttributeName':
                    // Consume the next input character:
                    $char = $this->stream->char();

                    // this is an optimized conditional, check the bottom
                    if($char === "\t" || $char === "\n"
|| $char === "\x0c" || $char === ' ') {
                        /* U+0009 CHARACTER TABULATION
                        U+000A LINE FEED (LF)
                        U+000C FORM FEED (FF)
                        U+0020 SPACE
                        Stay in the after attribute name state. */
                        $state = 'afterAttributeName';

                    } elseif($char === '/') {
                        /* U+002F SOLIDUS (/)
                        Switch to the self-closing start tag state. */
                        $state = 'selfClosingStartTag';

                    } elseif($char === '=') {
                        /* U+003D EQUALS SIGN (=)
                        Switch to the before attribute value state. */
                        $state = 'beforeAttributeValue';

                    } elseif($char === '>') {
                        /* U+003E GREATER-THAN SIGN (>)
                        Emit the current tag token. Switch to the data
state. */
                        $this->emitToken($this->token);
                        $state = 'data';

                    } elseif('A' <= $char && $char
<= 'Z') {
                        /* U+0041 LATIN CAPITAL LETTER A through to U+005A
LATIN CAPITAL LETTER Z
                        Start a new attribute in the current tag token. Set
that
                        attribute's name to the lowercase version of
the current
                        input character (add 0x0020 to the character's
code
                        point), and its value to the empty string. Switch
to the
                        attribute name state. */
                        $this->token['attr'][] = array(
                            'name'  => strtolower($char),
                            'value' => ''
                        );

                        $state = 'attributeName';

                    } elseif($char === false) {
                        /* EOF
                        Parse error. Emit the current tag token. Reconsume
the EOF
                        character in the data state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'expected-end-of-tag-but-got-eof'
                        ));
                        $this->emitToken($this->token);

                        $this->stream->unget();
                        $state = 'data';

                    } else {
                        /* U+0022 QUOTATION MARK (")
                           U+0027 APOSTROPHE (')
                        Parse error. Treat it as per the "anything
else"
                        entry below. */
                        if($char === '"' || $char ===
"'") {
                            $this->emitToken(array(
                                'type' => self::PARSEERROR,
                                'data' =>
'invalid-character-after-attribute-name'
                            ));
                        }

                        /* Anything else
                        Start a new attribute in the current tag token. Set
that attribute's
                        name to the current input character, and its value
to the empty string.
                        Switch to the attribute name state. */
                        $this->token['attr'][] = array(
                            'name'  => $char,
                            'value' => ''
                        );

                        $state = 'attributeName';
                    }
                break;

                case 'beforeAttributeValue':
                    // Consume the next input character:
                    $char = $this->stream->char();

                    // this is an optimized conditional
                    if($char === "\t" || $char === "\n"
|| $char === "\x0c" || $char === ' ') {
                        /* U+0009 CHARACTER TABULATION
                        U+000A LINE FEED (LF)
                        U+000C FORM FEED (FF)
                        U+0020 SPACE
                        Stay in the before attribute value state. */
                        $state = 'beforeAttributeValue';

                    } elseif($char === '"') {
                        /* U+0022 QUOTATION MARK (")
                        Switch to the attribute value (double-quoted)
state. */
                        $state = 'attributeValueDoubleQuoted';

                    } elseif($char === '&') {
                        /* U+0026 AMPERSAND (&)
                        Switch to the attribute value (unquoted) state and
reconsume
                        this input character. */
                        $this->stream->unget();
                        $state = 'attributeValueUnquoted';

                    } elseif($char === '\'') {
                        /* U+0027 APOSTROPHE (')
                        Switch to the attribute value (single-quoted)
state. */
                        $state = 'attributeValueSingleQuoted';

                    } elseif($char === '>') {
                        /* U+003E GREATER-THAN SIGN (>)
                        Parse error. Emit the current tag token. Switch to
the data state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'expected-attribute-value-but-got-right-bracket'
                        ));
                        $this->emitToken($this->token);
                        $state = 'data';

                    } elseif($char === false) {
                        /* EOF
                        Parse error. Emit the current tag token. Reconsume
                        the character in the data state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'expected-attribute-value-but-got-eof'
                        ));
                        $this->emitToken($this->token);
                        $this->stream->unget();
                        $state = 'data';

                    } else {
                        /* U+003D EQUALS SIGN (=)
                        Parse error. Treat it as per the "anything
else" entry below. */
                        if($char === '=') {
                            $this->emitToken(array(
                                'type' => self::PARSEERROR,
                                'data' =>
'equals-in-unquoted-attribute-value'
                            ));
                        }

                        /* Anything else
                        Append the current input character to the current
attribute's value.
                        Switch to the attribute value (unquoted) state. */
                        $last = count($this->token['attr']) -
1;
                       
$this->token['attr'][$last]['value'] .= $char;

                        $state = 'attributeValueUnquoted';
                    }
                break;

                case 'attributeValueDoubleQuoted':
                    // Consume the next input character:
                    $char = $this->stream->char();

                    if($char === '"') {
                        /* U+0022 QUOTATION MARK (")
                        Switch to the after attribute value (quoted) state.
*/
                        $state = 'afterAttributeValueQuoted';

                    } elseif($char === '&') {
                        /* U+0026 AMPERSAND (&)
                        Switch to the character reference in attribute
value
                        state, with the additional allowed character
                        being U+0022 QUOTATION MARK ("). */
                       
$this->characterReferenceInAttributeValue('"');

                    } elseif($char === false) {
                        /* EOF
                        Parse error. Emit the current tag token. Reconsume
the character
                        in the data state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'eof-in-attribute-value-double-quote'
                        ));
                        $this->emitToken($this->token);

                        $this->stream->unget();
                        $state = 'data';

                    } else {
                        /* Anything else
                        Append the current input character to the current
attribute's value.
                        Stay in the attribute value (double-quoted) state.
*/
                        $chars =
$this->stream->charsUntil('"&');

                        $last = count($this->token['attr']) -
1;
                       
$this->token['attr'][$last]['value'] .= $char .
$chars;

                        $state = 'attributeValueDoubleQuoted';
                    }
                break;

                case 'attributeValueSingleQuoted':
                    // Consume the next input character:
                    $char = $this->stream->char();

                    if($char === "'") {
                        /* U+0022 QUOTATION MARK (')
                        Switch to the after attribute value state. */
                        $state = 'afterAttributeValueQuoted';

                    } elseif($char === '&') {
                        /* U+0026 AMPERSAND (&)
                        Switch to the entity in attribute value state. */
                       
$this->characterReferenceInAttributeValue("'");

                    } elseif($char === false) {
                        /* EOF
                        Parse error. Emit the current tag token. Reconsume
the character
                        in the data state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'eof-in-attribute-value-single-quote'
                        ));
                        $this->emitToken($this->token);

                        $this->stream->unget();
                        $state = 'data';

                    } else {
                        /* Anything else
                        Append the current input character to the current
attribute's value.
                        Stay in the attribute value (single-quoted) state.
*/
                        $chars =
$this->stream->charsUntil("'&");

                        $last = count($this->token['attr']) -
1;
                       
$this->token['attr'][$last]['value'] .= $char .
$chars;

                        $state = 'attributeValueSingleQuoted';
                    }
                break;

                case 'attributeValueUnquoted':
                    // Consume the next input character:
                    $char = $this->stream->char();

                    if($char === "\t" || $char === "\n"
|| $char === "\x0c" || $char === ' ') {
                        /* U+0009 CHARACTER TABULATION
                        U+000A LINE FEED (LF)
                        U+000C FORM FEED (FF)
                        U+0020 SPACE
                        Switch to the before attribute name state. */
                        $state = 'beforeAttributeName';

                    } elseif($char === '&') {
                        /* U+0026 AMPERSAND (&)
                        Switch to the entity in attribute value state. */
                        $this->characterReferenceInAttributeValue();

                    } elseif($char === '>') {
                        /* U+003E GREATER-THAN SIGN (>)
                        Emit the current tag token. Switch to the data
state. */
                        $this->emitToken($this->token);
                        $state = 'data';

                    } elseif ($char === false) {
                        /* EOF
                        Parse error. Emit the current tag token. Reconsume
                        the character in the data state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'eof-in-attribute-value-no-quotes'
                        ));
                        $this->emitToken($this->token);
                        $this->stream->unget();
                        $state = 'data';

                    } else {
                        /* U+0022 QUOTATION MARK (")
                           U+0027 APOSTROPHE (')
                           U+003D EQUALS SIGN (=)
                        Parse error. Treat it as per the "anything
else"
                        entry below. */
                        if($char === '"' || $char ===
"'" || $char === '=') {
                            $this->emitToken(array(
                                'type' => self::PARSEERROR,
                                'data' =>
'unexpected-character-in-unquoted-attribute-value'
                            ));
                        }

                        /* Anything else
                        Append the current input character to the current
attribute's value.
                        Stay in the attribute value (unquoted) state. */
                        $chars =
$this->stream->charsUntil("\t\n\x0c
&>\"'=");

                        $last = count($this->token['attr']) -
1;
                       
$this->token['attr'][$last]['value'] .= $char .
$chars;

                        $state = 'attributeValueUnquoted';
                    }
                break;

                case 'afterAttributeValueQuoted':
                    /* Consume the next input character: */
                    $char = $this->stream->char();

                    if($char === "\t" || $char === "\n"
|| $char === "\x0c" || $char === ' ') {
                        /* U+0009 CHARACTER TABULATION
                           U+000A LINE FEED (LF)
                           U+000C FORM FEED (FF)
                           U+0020 SPACE
                        Switch to the before attribute name state. */
                        $state = 'beforeAttributeName';

                    } elseif ($char === '/') {
                        /* U+002F SOLIDUS (/)
                        Switch to the self-closing start tag state. */
                        $state = 'selfClosingStartTag';

                    } elseif ($char === '>') {
                        /* U+003E GREATER-THAN SIGN (>)
                        Emit the current tag token. Switch to the data
state. */
                        $this->emitToken($this->token);
                        $state = 'data';

                    } elseif ($char === false) {
                        /* EOF
                        Parse error. Emit the current tag token. Reconsume
the EOF
                        character in the data state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'unexpected-EOF-after-attribute-value'
                        ));
                        $this->emitToken($this->token);
                        $this->stream->unget();
                        $state = 'data';

                    } else {
                        /* Anything else
                        Parse error. Reconsume the character in the before
attribute
                        name state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'unexpected-character-after-attribute-value'
                        ));
                        $this->stream->unget();
                        $state = 'beforeAttributeName';
                    }
                break;

                case 'selfClosingStartTag':
                    /* Consume the next input character: */
                    $char = $this->stream->char();

                    if ($char === '>') {
                        /* U+003E GREATER-THAN SIGN (>)
                        Set the self-closing flag of the current tag token.
                        Emit the current tag token. Switch to the data
state. */
                        // not sure if this is the name we want
                        $this->token['self-closing'] = true;
                        /* When an end tag token is emitted with its
self-closing flag set,
                        that is a parse error. */
                        if ($this->token['type'] ===
self::ENDTAG) {
                            $this->emitToken(array(
                                'type' => self::PARSEERROR,
                                'data' =>
'self-closing-end-tag'
                            ));
                        }
                        $this->emitToken($this->token);
                        $state = 'data';

                    } elseif ($char === false) {
                        /* EOF
                        Parse error. Emit the current tag token. Reconsume
the
                        EOF character in the data state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'unexpected-eof-after-self-closing'
                        ));
                        $this->emitToken($this->token);
                        $this->stream->unget();
                        $state = 'data';

                    } else {
                        /* Anything else
                        Parse error. Reconsume the character in the before
attribute name state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'unexpected-character-after-self-closing'
                        ));
                        $this->stream->unget();
                        $state = 'beforeAttributeName';
                    }
                break;

                case 'bogusComment':
                    /* (This can only happen if the content model flag is
set to the PCDATA state.) */
                    /* Consume every character up to the first U+003E
GREATER-THAN SIGN
                    character (>) or the end of the file (EOF),
whichever comes first. Emit
                    a comment token whose data is the concatenation of all
the characters
                    starting from and including the character that caused
the state machine
                    to switch into the bogus comment state, up to and
including the last
                    consumed character before the U+003E character, if any,
or up to the
                    end of the file otherwise. (If the comment was started
by the end of
                    the file (EOF), the token is empty.) */
                    $this->token['data'] .= (string)
$this->stream->charsUntil('>');
                    $this->stream->char();

                    $this->emitToken($this->token);

                    /* Switch to the data state. */
                    $state = 'data';
                break;

                case 'markupDeclarationOpen':
                    // Consume for below
                    $hyphens =
$this->stream->charsWhile('-', 2);
                    if ($hyphens === '-') {
                        $this->stream->unget();
                    }
                    if ($hyphens !== '--') {
                        $alpha =
$this->stream->charsWhile(self::ALPHA, 7);
                    }

                    /* If the next two characters are both U+002D
HYPHEN-MINUS (-)
                    characters, consume those two characters, create a
comment token whose
                    data is the empty string, and switch to the comment
state. */
                    if($hyphens === '--') {
                        $state = 'commentStart';
                        $this->token = array(
                            'data' => '',
                            'type' => self::COMMENT
                        );

                    /* Otherwise if the next seven characters are a
case-insensitive match
                    for the word "DOCTYPE", then consume those
characters and switch to the
                    DOCTYPE state. */
                    } elseif(strtoupper($alpha) === 'DOCTYPE') {
                        $state = 'doctype';

                    // XXX not implemented
                    /* Otherwise, if the insertion mode is "in foreign
content"
                    and the current node is not an element in the HTML
namespace
                    and the next seven characters are an ASCII
case-sensitive
                    match for the string "[CDATA[" (the five
uppercase letters
                    "CDATA" with a U+005B LEFT SQUARE BRACKET
character before
                    and after), then consume those characters and switch to
the
                    CDATA section state (which is unrelated to the content
model
                    flag's CDATA state). */

                    /* Otherwise, is is a parse error. Switch to the bogus
comment state.
                    The next character that is consumed, if any, is the
first character
                    that will be in the comment. */
                    } else {
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'expected-dashes-or-doctype'
                        ));
                        $this->token = array(
                            'data' => (string) $alpha,
                            'type' => self::COMMENT
                        );
                        $state = 'bogusComment';
                    }
                break;

                case 'commentStart':
                    /* Consume the next input character: */
                    $char = $this->stream->char();

                    if ($char === '-') {
                        /* U+002D HYPHEN-MINUS (-)
                        Switch to the comment start dash state. */
                        $state = 'commentStartDash';
                    } elseif ($char === '>') {
                        /* U+003E GREATER-THAN SIGN (>)
                        Parse error. Emit the comment token. Switch to the
                        data state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'incorrect-comment'
                        ));
                        $this->emitToken($this->token);
                        $state = 'data';
                    } elseif ($char === false) {
                        /* EOF
                        Parse error. Emit the comment token. Reconsume the
                        EOF character in the data state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'eof-in-comment'
                        ));
                        $this->emitToken($this->token);
                        $this->stream->unget();
                        $state = 'data';
                    } else {
                        /* Anything else
                        Append the input character to the comment
token's
                        data. Switch to the comment state. */
                        $this->token['data'] .= $char;
                        $state = 'comment';
                    }
                break;

                case 'commentStartDash':
                    /* Consume the next input character: */
                    $char = $this->stream->char();
                    if ($char === '-') {
                        /* U+002D HYPHEN-MINUS (-)
                        Switch to the comment end state */
                        $state = 'commentEnd';
                    } elseif ($char === '>') {
                        /* U+003E GREATER-THAN SIGN (>)
                        Parse error. Emit the comment token. Switch to the
                        data state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'incorrect-comment'
                        ));
                        $this->emitToken($this->token);
                        $state = 'data';
                    } elseif ($char === false) {
                        /* Parse error. Emit the comment token. Reconsume
the
                        EOF character in the data state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'eof-in-comment'
                        ));
                        $this->emitToken($this->token);
                        $this->stream->unget();
                        $state = 'data';
                    } else {
                        $this->token['data'] .= '-'
. $char;
                        $state = 'comment';
                    }
                break;

                case 'comment':
                    /* Consume the next input character: */
                    $char = $this->stream->char();

                    if($char === '-') {
                        /* U+002D HYPHEN-MINUS (-)
                        Switch to the comment end dash state */
                        $state = 'commentEndDash';

                    } elseif($char === false) {
                        /* EOF
                        Parse error. Emit the comment token. Reconsume the
EOF character
                        in the data state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'eof-in-comment'
                        ));
                        $this->emitToken($this->token);
                        $this->stream->unget();
                        $state = 'data';

                    } else {
                        /* Anything else
                        Append the input character to the comment
token's data. Stay in
                        the comment state. */
                        $chars =
$this->stream->charsUntil('-');

                        $this->token['data'] .= $char .
$chars;
                    }
                break;

                case 'commentEndDash':
                    /* Consume the next input character: */
                    $char = $this->stream->char();

                    if($char === '-') {
                        /* U+002D HYPHEN-MINUS (-)
                        Switch to the comment end state  */
                        $state = 'commentEnd';

                    } elseif($char === false) {
                        /* EOF
                        Parse error. Emit the comment token. Reconsume the
EOF character
                        in the data state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'eof-in-comment-end-dash'
                        ));
                        $this->emitToken($this->token);
                        $this->stream->unget();
                        $state = 'data';

                    } else {
                        /* Anything else
                        Append a U+002D HYPHEN-MINUS (-) character and the
input
                        character to the comment token's data. Switch
to the comment state. */
                        $this->token['data'] .=
'-'.$char;
                        $state = 'comment';
                    }
                break;

                case 'commentEnd':
                    /* Consume the next input character: */
                    $char = $this->stream->char();

                    if($char === '>') {
                        /* U+003E GREATER-THAN SIGN (>)
                        Emit the comment token. Switch to the data state.
*/
                        $this->emitToken($this->token);
                        $state = 'data';

                    } elseif($char === '-') {
                        /* U+002D HYPHEN-MINUS (-)
                        Parse error. Append a U+002D HYPHEN-MINUS (-)
character
                        to the comment token's data. Stay in the
comment end
                        state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'unexpected-dash-after-double-dash-in-comment'
                        ));
                        $this->token['data'] .= '-';

                    } elseif($char === false) {
                        /* EOF
                        Parse error. Emit the comment token. Reconsume the
                        EOF character in the data state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'eof-in-comment-double-dash'
                        ));
                        $this->emitToken($this->token);
                        $this->stream->unget();
                        $state = 'data';

                    } else {
                        /* Anything else
                        Parse error. Append two U+002D HYPHEN-MINUS (-)
                        characters and the input character to the comment
token's
                        data. Switch to the comment state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'unexpected-char-in-comment'
                        ));
                        $this->token['data'] .=
'--'.$char;
                        $state = 'comment';
                    }
                break;

                case 'doctype':
                    /* Consume the next input character: */
                    $char = $this->stream->char();

                    if($char === "\t" || $char === "\n"
|| $char === "\x0c" || $char === ' ') {
                        /* U+0009 CHARACTER TABULATION
                           U+000A LINE FEED (LF)
                           U+000C FORM FEED (FF)
                           U+0020 SPACE
                        Switch to the before DOCTYPE name state. */
                        $state = 'beforeDoctypeName';

                    } else {
                        /* Anything else
                        Parse error. Reconsume the current character in the
                        before DOCTYPE name state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'need-space-after-doctype'
                        ));
                        $this->stream->unget();
                        $state = 'beforeDoctypeName';
                    }
                break;

                case 'beforeDoctypeName':
                    /* Consume the next input character: */
                    $char = $this->stream->char();

                    if($char === "\t" || $char === "\n"
|| $char === "\x0c" || $char === ' ') {
                        /* U+0009 CHARACTER TABULATION
                           U+000A LINE FEED (LF)
                           U+000C FORM FEED (FF)
                           U+0020 SPACE
                        Stay in the before DOCTYPE name state. */

                    } elseif($char === '>') {
                        /* U+003E GREATER-THAN SIGN (>)
                        Parse error. Create a new DOCTYPE token. Set its
                        force-quirks flag to on. Emit the token. Switch to
the
                        data state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'expected-doctype-name-but-got-right-bracket'
                        ));
                        $this->emitToken(array(
                            'name' => '',
                            'type' => self::DOCTYPE,
                            'force-quirks' => true,
                            'error' => true
                        ));

                        $state = 'data';

                    } elseif('A' <= $char && $char
<= 'Z') {
                        /* U+0041 LATIN CAPITAL LETTER A through to U+005A
LATIN CAPITAL LETTER Z
                        Create a new DOCTYPE token. Set the token's
name to the
                        lowercase version of the input character (add
0x0020 to
                        the character's code point). Switch to the
DOCTYPE name
                        state. */
                        $this->token = array(
                            'name' => strtolower($char),
                            'type' => self::DOCTYPE,
                            'error' => true
                        );

                        $state = 'doctypeName';

                    } elseif($char === false) {
                        /* EOF
                        Parse error. Create a new DOCTYPE token. Set its
                        force-quirks flag to on. Emit the token. Reconsume
the
                        EOF character in the data state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'expected-doctype-name-but-got-eof'
                        ));
                        $this->emitToken(array(
                            'name' => '',
                            'type' => self::DOCTYPE,
                            'force-quirks' => true,
                            'error' => true
                        ));

                        $this->stream->unget();
                        $state = 'data';

                    } else {
                        /* Anything else
                        Create a new DOCTYPE token. Set the token's
name to the
                        current input character. Switch to the DOCTYPE name
state. */
                        $this->token = array(
                            'name' => $char,
                            'type' => self::DOCTYPE,
                            'error' => true
                        );

                        $state = 'doctypeName';
                    }
                break;

                case 'doctypeName':
                    /* Consume the next input character: */
                    $char = $this->stream->char();

                    if($char === "\t" || $char === "\n"
|| $char === "\x0c" || $char === ' ') {
                        /* U+0009 CHARACTER TABULATION
                           U+000A LINE FEED (LF)
                           U+000C FORM FEED (FF)
                           U+0020 SPACE
                        Switch to the after DOCTYPE name state. */
                        $state = 'afterDoctypeName';

                    } elseif($char === '>') {
                        /* U+003E GREATER-THAN SIGN (>)
                        Emit the current DOCTYPE token. Switch to the data
state. */
                        $this->emitToken($this->token);
                        $state = 'data';

                    } elseif('A' <= $char && $char
<= 'Z') {
                        /* U+0041 LATIN CAPITAL LETTER A through to U+005A
LATIN CAPITAL LETTER Z
                        Append the lowercase version of the input character
                        (add 0x0020 to the character's code point) to
the current
                        DOCTYPE token's name. Stay in the DOCTYPE name
state. */
                        $this->token['name'] .=
strtolower($char);

                    } elseif($char === false) {
                        /* EOF
                        Parse error. Set the DOCTYPE token's
force-quirks flag
                        to on. Emit that DOCTYPE token. Reconsume the EOF
                        character in the data state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'eof-in-doctype-name'
                        ));
                        $this->token['force-quirks'] = true;
                        $this->emitToken($this->token);
                        $this->stream->unget();
                        $state = 'data';

                    } else {
                        /* Anything else
                        Append the current input character to the current
                        DOCTYPE token's name. Stay in the DOCTYPE name
state. */
                        $this->token['name'] .= $char;
                    }

                    // XXX this is probably some sort of quirks mode
designation,
                    // check tree-builder to be sure. In general
'error' needs
                    // to be specc'ified, this probably means removing
it at the end
                    $this->token['error'] =
($this->token['name'] === 'HTML')
                        ? false
                        : true;
                break;

                case 'afterDoctypeName':
                    /* Consume the next input character: */
                    $char = $this->stream->char();

                    if($char === "\t" || $char === "\n"
|| $char === "\x0c" || $char === ' ') {
                        /* U+0009 CHARACTER TABULATION
                           U+000A LINE FEED (LF)
                           U+000C FORM FEED (FF)
                           U+0020 SPACE
                        Stay in the after DOCTYPE name state. */

                    } elseif($char === '>') {
                        /* U+003E GREATER-THAN SIGN (>)
                        Emit the current DOCTYPE token. Switch to the data
state. */
                        $this->emitToken($this->token);
                        $state = 'data';

                    } elseif($char === false) {
                        /* EOF
                        Parse error. Set the DOCTYPE token's
force-quirks flag
                        to on. Emit that DOCTYPE token. Reconsume the EOF
                        character in the data state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'eof-in-doctype'
                        ));
                        $this->token['force-quirks'] = true;
                        $this->emitToken($this->token);
                        $this->stream->unget();
                        $state = 'data';

                    } else {
                        /* Anything else */

                        $nextSix = strtoupper($char .
$this->stream->charsWhile(self::ALPHA, 5));
                        if ($nextSix === 'PUBLIC') {
                            /* If the next six characters are an ASCII
                            case-insensitive match for the word
"PUBLIC", then
                            consume those characters and switch to the
before
                            DOCTYPE public identifier state. */
                            $state =
'beforeDoctypePublicIdentifier';

                        } elseif ($nextSix === 'SYSTEM') {
                            /* Otherwise, if the next six characters are an
ASCII
                            case-insensitive match for the word
"SYSTEM", then
                            consume those characters and switch to the
before
                            DOCTYPE system identifier state. */
                            $state =
'beforeDoctypeSystemIdentifier';

                        } else {
                            /* Otherwise, this is the parse error. Set the
DOCTYPE
                            token's force-quirks flag to on. Switch to
the bogus
                            DOCTYPE state. */
                            $this->emitToken(array(
                                'type' => self::PARSEERROR,
                                'data' =>
'expected-space-or-right-bracket-in-doctype'
                            ));
                            $this->token['force-quirks'] =
true;
                            $this->token['error'] = true;
                            $state = 'bogusDoctype';
                        }
                    }
                break;

                case 'beforeDoctypePublicIdentifier':
                    /* Consume the next input character: */
                    $char = $this->stream->char();

                    if($char === "\t" || $char === "\n"
|| $char === "\x0c" || $char === ' ') {
                        /* U+0009 CHARACTER TABULATION
                           U+000A LINE FEED (LF)
                           U+000C FORM FEED (FF)
                           U+0020 SPACE
                        Stay in the before DOCTYPE public identifier state.
*/
                    } elseif ($char === '"') {
                        /* U+0022 QUOTATION MARK (")
                        Set the DOCTYPE token's public identifier to
the empty
                        string (not missing), then switch to the DOCTYPE
public
                        identifier (double-quoted) state. */
                        $this->token['public'] = '';
                        $state =
'doctypePublicIdentifierDoubleQuoted';
                    } elseif ($char === "'") {
                        /* U+0027 APOSTROPHE (')
                        Set the DOCTYPE token's public identifier to
the empty
                        string (not missing), then switch to the DOCTYPE
public
                        identifier (single-quoted) state. */
                        $this->token['public'] = '';
                        $state =
'doctypePublicIdentifierSingleQuoted';
                    } elseif ($char === '>') {
                        /* Parse error. Set the DOCTYPE token's
force-quirks flag
                        to on. Emit that DOCTYPE token. Switch to the data
state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'unexpected-end-of-doctype'
                        ));
                        $this->token['force-quirks'] = true;
                        $this->emitToken($this->token);
                        $state = 'data';
                    } elseif ($char === false) {
                        /* Parse error. Set the DOCTYPE token's
force-quirks
                        flag to on. Emit that DOCTYPE token. Reconsume the
EOF
                        character in the data state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'eof-in-doctype'
                        ));
                        $this->token['force-quirks'] = true;
                        $this->emitToken($this->token);
                        $this->stream->unget();
                        $state = 'data';
                    } else {
                        /* Parse error. Set the DOCTYPE token's
force-quirks flag
                        to on. Switch to the bogus DOCTYPE state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'unexpected-char-in-doctype'
                        ));
                        $this->token['force-quirks'] = true;
                        $state = 'bogusDoctype';
                    }
                break;

                case 'doctypePublicIdentifierDoubleQuoted':
                    /* Consume the next input character: */
                    $char = $this->stream->char();

                    if ($char === '"') {
                        /* U+0022 QUOTATION MARK (")
                        Switch to the after DOCTYPE public identifier
state. */
                        $state = 'afterDoctypePublicIdentifier';
                    } elseif ($char === '>') {
                        /* U+003E GREATER-THAN SIGN (>)
                        Parse error. Set the DOCTYPE token's
force-quirks flag
                        to on. Emit that DOCTYPE token. Switch to the data
state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'unexpected-end-of-doctype'
                        ));
                        $this->token['force-quirks'] = true;
                        $this->emitToken($this->token);
                        $state = 'data';
                    } elseif ($char === false) {
                        /* EOF
                        Parse error. Set the DOCTYPE token's
force-quirks flag
                        to on. Emit that DOCTYPE token. Reconsume the EOF
                        character in the data state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'eof-in-doctype'
                        ));
                        $this->token['force-quirks'] = true;
                        $this->emitToken($this->token);
                        $this->stream->unget();
                        $state = 'data';
                    } else {
                        /* Anything else
                        Append the current input character to the current
                        DOCTYPE token's public identifier. Stay in the
DOCTYPE
                        public identifier (double-quoted) state. */
                        $this->token['public'] .= $char;
                    }
                break;

                case 'doctypePublicIdentifierSingleQuoted':
                    /* Consume the next input character: */
                    $char = $this->stream->char();

                    if ($char === "'") {
                        /* U+0027 APOSTROPHE (')
                        Switch to the after DOCTYPE public identifier
state. */
                        $state = 'afterDoctypePublicIdentifier';
                    } elseif ($char === '>') {
                        /* U+003E GREATER-THAN SIGN (>)
                        Parse error. Set the DOCTYPE token's
force-quirks flag
                        to on. Emit that DOCTYPE token. Switch to the data
state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'unexpected-end-of-doctype'
                        ));
                        $this->token['force-quirks'] = true;
                        $this->emitToken($this->token);
                        $state = 'data';
                    } elseif ($char === false) {
                        /* EOF
                        Parse error. Set the DOCTYPE token's
force-quirks flag
                        to on. Emit that DOCTYPE token. Reconsume the EOF
                        character in the data state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'eof-in-doctype'
                        ));
                        $this->token['force-quirks'] = true;
                        $this->emitToken($this->token);
                        $this->stream->unget();
                        $state = 'data';
                    } else {
                        /* Anything else
                        Append the current input character to the current
                        DOCTYPE token's public identifier. Stay in the
DOCTYPE
                        public identifier (double-quoted) state. */
                        $this->token['public'] .= $char;
                    }
                break;

                case 'afterDoctypePublicIdentifier':
                    /* Consume the next input character: */
                    $char = $this->stream->char();

                    if($char === "\t" || $char === "\n"
|| $char === "\x0c" || $char === ' ') {
                        /* U+0009 CHARACTER TABULATION
                           U+000A LINE FEED (LF)
                           U+000C FORM FEED (FF)
                           U+0020 SPACE
                        Stay in the after DOCTYPE public identifier state.
*/
                    } elseif ($char === '"') {
                        /* U+0022 QUOTATION MARK (")
                        Set the DOCTYPE token's system identifier to
the
                        empty string (not missing), then switch to the
DOCTYPE
                        system identifier (double-quoted) state. */
                        $this->token['system'] = '';
                        $state =
'doctypeSystemIdentifierDoubleQuoted';
                    } elseif ($char === "'") {
                        /* U+0027 APOSTROPHE (')
                        Set the DOCTYPE token's system identifier to
the
                        empty string (not missing), then switch to the
DOCTYPE
                        system identifier (single-quoted) state. */
                        $this->token['system'] = '';
                        $state =
'doctypeSystemIdentifierSingleQuoted';
                    } elseif ($char === '>') {
                        /* U+003E GREATER-THAN SIGN (>)
                        Emit the current DOCTYPE token. Switch to the data
state. */
                        $this->emitToken($this->token);
                        $state = 'data';
                    } elseif ($char === false) {
                        /* Parse error. Set the DOCTYPE token's
force-quirks
                        flag to on. Emit that DOCTYPE token. Reconsume the
EOF
                        character in the data state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'eof-in-doctype'
                        ));
                        $this->token['force-quirks'] = true;
                        $this->emitToken($this->token);
                        $this->stream->unget();
                        $state = 'data';
                    } else {
                        /* Anything else
                        Parse error. Set the DOCTYPE token's
force-quirks flag
                        to on. Switch to the bogus DOCTYPE state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'unexpected-char-in-doctype'
                        ));
                        $this->token['force-quirks'] = true;
                        $state = 'bogusDoctype';
                    }
                break;

                case 'beforeDoctypeSystemIdentifier':
                    /* Consume the next input character: */
                    $char = $this->stream->char();

                    if($char === "\t" || $char === "\n"
|| $char === "\x0c" || $char === ' ') {
                        /* U+0009 CHARACTER TABULATION
                           U+000A LINE FEED (LF)
                           U+000C FORM FEED (FF)
                           U+0020 SPACE
                        Stay in the before DOCTYPE system identifier state.
*/
                    } elseif ($char === '"') {
                        /* U+0022 QUOTATION MARK (")
                        Set the DOCTYPE token's system identifier to
the empty
                        string (not missing), then switch to the DOCTYPE
system
                        identifier (double-quoted) state. */
                        $this->token['system'] = '';
                        $state =
'doctypeSystemIdentifierDoubleQuoted';
                    } elseif ($char === "'") {
                        /* U+0027 APOSTROPHE (')
                        Set the DOCTYPE token's system identifier to
the empty
                        string (not missing), then switch to the DOCTYPE
system
                        identifier (single-quoted) state. */
                        $this->token['system'] = '';
                        $state =
'doctypeSystemIdentifierSingleQuoted';
                    } elseif ($char === '>') {
                        /* Parse error. Set the DOCTYPE token's
force-quirks flag
                        to on. Emit that DOCTYPE token. Switch to the data
state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'unexpected-char-in-doctype'
                        ));
                        $this->token['force-quirks'] = true;
                        $this->emitToken($this->token);
                        $state = 'data';
                    } elseif ($char === false) {
                        /* Parse error. Set the DOCTYPE token's
force-quirks
                        flag to on. Emit that DOCTYPE token. Reconsume the
EOF
                        character in the data state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'eof-in-doctype'
                        ));
                        $this->token['force-quirks'] = true;
                        $this->emitToken($this->token);
                        $this->stream->unget();
                        $state = 'data';
                    } else {
                        /* Parse error. Set the DOCTYPE token's
force-quirks flag
                        to on. Switch to the bogus DOCTYPE state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'unexpected-char-in-doctype'
                        ));
                        $this->token['force-quirks'] = true;
                        $state = 'bogusDoctype';
                    }
                break;

                case 'doctypeSystemIdentifierDoubleQuoted':
                    /* Consume the next input character: */
                    $char = $this->stream->char();

                    if ($char === '"') {
                        /* U+0022 QUOTATION MARK (")
                        Switch to the after DOCTYPE system identifier
state. */
                        $state = 'afterDoctypeSystemIdentifier';
                    } elseif ($char === '>') {
                        /* U+003E GREATER-THAN SIGN (>)
                        Parse error. Set the DOCTYPE token's
force-quirks flag
                        to on. Emit that DOCTYPE token. Switch to the data
state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'unexpected-end-of-doctype'
                        ));
                        $this->token['force-quirks'] = true;
                        $this->emitToken($this->token);
                        $state = 'data';
                    } elseif ($char === false) {
                        /* EOF
                        Parse error. Set the DOCTYPE token's
force-quirks flag
                        to on. Emit that DOCTYPE token. Reconsume the EOF
                        character in the data state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'eof-in-doctype'
                        ));
                        $this->token['force-quirks'] = true;
                        $this->emitToken($this->token);
                        $this->stream->unget();
                        $state = 'data';
                    } else {
                        /* Anything else
                        Append the current input character to the current
                        DOCTYPE token's system identifier. Stay in the
DOCTYPE
                        system identifier (double-quoted) state. */
                        $this->token['system'] .= $char;
                    }
                break;

                case 'doctypeSystemIdentifierSingleQuoted':
                    /* Consume the next input character: */
                    $char = $this->stream->char();

                    if ($char === "'") {
                        /* U+0027 APOSTROPHE (')
                        Switch to the after DOCTYPE system identifier
state. */
                        $state = 'afterDoctypeSystemIdentifier';
                    } elseif ($char === '>') {
                        /* U+003E GREATER-THAN SIGN (>)
                        Parse error. Set the DOCTYPE token's
force-quirks flag
                        to on. Emit that DOCTYPE token. Switch to the data
state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'unexpected-end-of-doctype'
                        ));
                        $this->token['force-quirks'] = true;
                        $this->emitToken($this->token);
                        $state = 'data';
                    } elseif ($char === false) {
                        /* EOF
                        Parse error. Set the DOCTYPE token's
force-quirks flag
                        to on. Emit that DOCTYPE token. Reconsume the EOF
                        character in the data state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'eof-in-doctype'
                        ));
                        $this->token['force-quirks'] = true;
                        $this->emitToken($this->token);
                        $this->stream->unget();
                        $state = 'data';
                    } else {
                        /* Anything else
                        Append the current input character to the current
                        DOCTYPE token's system identifier. Stay in the
DOCTYPE
                        system identifier (double-quoted) state. */
                        $this->token['system'] .= $char;
                    }
                break;

                case 'afterDoctypeSystemIdentifier':
                    /* Consume the next input character: */
                    $char = $this->stream->char();

                    if($char === "\t" || $char === "\n"
|| $char === "\x0c" || $char === ' ') {
                        /* U+0009 CHARACTER TABULATION
                           U+000A LINE FEED (LF)
                           U+000C FORM FEED (FF)
                           U+0020 SPACE
                        Stay in the after DOCTYPE system identifier state.
*/
                    } elseif ($char === '>') {
                        /* U+003E GREATER-THAN SIGN (>)
                        Emit the current DOCTYPE token. Switch to the data
state. */
                        $this->emitToken($this->token);
                        $state = 'data';
                    } elseif ($char === false) {
                        /* Parse error. Set the DOCTYPE token's
force-quirks
                        flag to on. Emit that DOCTYPE token. Reconsume the
EOF
                        character in the data state. */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'eof-in-doctype'
                        ));
                        $this->token['force-quirks'] = true;
                        $this->emitToken($this->token);
                        $this->stream->unget();
                        $state = 'data';
                    } else {
                        /* Anything else
                        Parse error. Switch to the bogus DOCTYPE state.
                        (This does not set the DOCTYPE token's
force-quirks
                        flag to on.) */
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'unexpected-char-in-doctype'
                        ));
                        $state = 'bogusDoctype';
                    }
                break;

                case 'bogusDoctype':
                    /* Consume the next input character: */
                    $char = $this->stream->char();

                    if ($char === '>') {
                        /* U+003E GREATER-THAN SIGN (>)
                        Emit the DOCTYPE token. Switch to the data state.
*/
                        $this->emitToken($this->token);
                        $state = 'data';

                    } elseif($char === false) {
                        /* EOF
                        Emit the DOCTYPE token. Reconsume the EOF character
in
                        the data state. */
                        $this->emitToken($this->token);
                        $this->stream->unget();
                        $state = 'data';

                    } else {
                        /* Anything else
                        Stay in the bogus DOCTYPE state. */
                    }
                break;

                // case 'cdataSection':

            }
        }
    }

    /**
     * Returns a serialized representation of the tree.
     */
    public function save() {
        return $this->tree->save();
    }

    /**
     * Returns the input stream.
     */
    public function stream() {
        return $this->stream;
    }

    private function consumeCharacterReference($allowed = false, $inattr =
false) {
        // This goes quite far against spec, and is far closer to the
Python
        // impl., mainly because we don't do the large unconsuming the
spec
        // requires.

        // All consumed characters.
        $chars = $this->stream->char();

        /* This section defines how to consume a character
        reference. This definition is used when parsing character
        references in text and in attributes.

        The behavior depends on the identity of the next character
        (the one immediately after the U+0026 AMPERSAND character): */

        if (
            $chars[0] === "\x09" ||
            $chars[0] === "\x0A" ||
            $chars[0] === "\x0C" ||
            $chars[0] === "\x20" ||
            $chars[0] === '<' ||
            $chars[0] === '&' ||
            $chars === false ||
            $chars[0] === $allowed
        ) {
            /* U+0009 CHARACTER TABULATION
               U+000A LINE FEED (LF)
               U+000C FORM FEED (FF)
               U+0020 SPACE
               U+003C LESS-THAN SIGN
               U+0026 AMPERSAND
               EOF
               The additional allowed character, if there is one
            Not a character reference. No characters are consumed,
            and nothing is returned. (This is not an error, either.) */
            // We already consumed, so unconsume.
            $this->stream->unget();
            return '&';
        } elseif ($chars[0] === '#') {
            /* Consume the U+0023 NUMBER SIGN. */
            // Um, yeah, we already did that.
            /* The behavior further depends on the character after
            the U+0023 NUMBER SIGN: */
            $chars .= $this->stream->char();
            if (isset($chars[1]) && ($chars[1] === 'x' ||
$chars[1] === 'X')) {
                /* U+0078 LATIN SMALL LETTER X
                   U+0058 LATIN CAPITAL LETTER X */
                /* Consume the X. */
                // Um, yeah, we already did that.
                /* Follow the steps below, but using the range of
                characters U+0030 DIGIT ZERO through to U+0039 DIGIT
                NINE, U+0061 LATIN SMALL LETTER A through to U+0066
                LATIN SMALL LETTER F, and U+0041 LATIN CAPITAL LETTER
                A, through to U+0046 LATIN CAPITAL LETTER F (in other
                words, 0123456789, ABCDEF, abcdef). */
                $char_class = self::HEX;
                /* When it comes to interpreting the
                number, interpret it as a hexadecimal number. */
                $hex = true;
            } else {
                /* Anything else */
                // Unconsume because we shouldn't have consumed this.
                $chars = $chars[0];
                $this->stream->unget();
                /* Follow the steps below, but using the range of
                characters U+0030 DIGIT ZERO through to U+0039 DIGIT
                NINE (i.e. just 0123456789). */
                $char_class = self::DIGIT;
                /* When it comes to interpreting the number,
                interpret it as a decimal number. */
                $hex = false;
            }

            /* Consume as many characters as match the range of characters
given above. */
            $consumed = $this->stream->charsWhile($char_class);
            if ($consumed === '' || $consumed === false) {
                /* If no characters match the range, then don't
consume
                any characters (and unconsume the U+0023 NUMBER SIGN
                character and, if appropriate, the X character). This
                is a parse error; nothing is returned. */
                $this->emitToken(array(
                    'type' => self::PARSEERROR,
                    'data' =>
'expected-numeric-entity'
                ));
                return '&' . $chars;
            } else {
                /* Otherwise, if the next character is a U+003B SEMICOLON,
                consume that too. If it isn't, there is a parse error.
*/
                if ($this->stream->char() !== ';') {
                    $this->stream->unget();
                    $this->emitToken(array(
                        'type' => self::PARSEERROR,
                        'data' =>
'numeric-entity-without-semicolon'
                    ));
                }

                /* If one or more characters match the range, then take
                them all and interpret the string of characters as a number
                (either hexadecimal or decimal as appropriate). */
                $codepoint = $hex ? hexdec($consumed) : (int) $consumed;

                /* If that number is one of the numbers in the first column
                of the following table, then this is a parse error. Find
the
                row with that number in the first column, and return a
                character token for the Unicode character given in the
                second column of that row. */
                $new_codepoint = HTML5_Data::getRealCodepoint($codepoint);
                if ($new_codepoint) {
                    $this->emitToken(array(
                        'type' => self::PARSEERROR,
                        'data' =>
'illegal-windows-1252-entity'
                    ));
                    $codepoint = $new_codepoint;
                } else {
                    /* Otherwise, if the number is in the range 0x0000 to
0x0008,
                    U+000B,  U+000E to 0x001F,  0x007F  to 0x009F, 0xD800
to 0xDFFF ,
                    0xFDD0 to 0xFDEF, or is one of 0xFFFE, 0xFFFF, 0x1FFFE,
0x1FFFF,
                    0x2FFFE, 0x2FFFF, 0x3FFFE, 0x3FFFF, 0x4FFFE, 0x4FFFF,
0x5FFFE,
                    0x5FFFF, 0x6FFFE, 0x6FFFF, 0x7FFFE, 0x7FFFF, 0x8FFFE,
0x8FFFF,
                    0x9FFFE, 0x9FFFF, 0xAFFFE, 0xAFFFF, 0xBFFFE, 0xBFFFF,
0xCFFFE,
                    0xCFFFF, 0xDFFFE, 0xDFFFF, 0xEFFFE, 0xEFFFF, 0xFFFFE,
0xFFFFF,
                    0x10FFFE, or 0x10FFFF, or is higher than 0x10FFFF, then
this
                    is a parse error; return a character token for the
U+FFFD
                    REPLACEMENT CHARACTER character instead. */
                    // && has higher precedence than ||
                    if (
                        $codepoint >= 0x0000 && $codepoint <=
0x0008 ||
                        $codepoint === 0x000B ||
                        $codepoint >= 0x000E && $codepoint <=
0x001F ||
                        $codepoint >= 0x007F && $codepoint <=
0x009F ||
                        $codepoint >= 0xD800 && $codepoint <=
0xDFFF ||
                        $codepoint >= 0xFDD0 && $codepoint <=
0xFDEF ||
                        ($codepoint & 0xFFFE) === 0xFFFE ||
                        $codepoint > 0x10FFFF
                    ) {
                        $this->emitToken(array(
                            'type' => self::PARSEERROR,
                            'data' =>
'illegal-codepoint-for-numeric-entity'
                        ));
                        $codepoint = 0xFFFD;
                    }
                }

                /* Otherwise, return a character token for the Unicode
                character whose code point is that number. */
                return HTML5_Data::utf8chr($codepoint);
            }

        } else {
            /* Anything else */

            /* Consume the maximum number of characters possible,
            with the consumed characters matching one of the
            identifiers in the first column of the named character
            references table (in a case-sensitive manner). */

            // we will implement this by matching the longest
            // alphanumeric + semicolon string, and then working
            // our way backwards
            $chars .= $this->stream->charsWhile(self::DIGIT .
self::ALPHA . ';',
HTML5_Data::getNamedCharacterReferenceMaxLength() - 1);
            $len = strlen($chars);

            $refs = HTML5_Data::getNamedCharacterReferences();
            $codepoint = false;
            for($c = $len; $c > 0; $c--) {
                $id = substr($chars, 0, $c);
                if(isset($refs[$id])) {
                    $codepoint = $refs[$id];
                    break;
                }
            }

            /* If no match can be made, then this is a parse error.
            No characters are consumed, and nothing is returned. */
            if (!$codepoint) {
                $this->emitToken(array(
                    'type' => self::PARSEERROR,
                    'data' =>
'expected-named-entity'
                ));
                return '&' . $chars;
            }

            /* If the last character matched is not a U+003B SEMICOLON
            (;), there is a parse error. */
            $semicolon = true;
            if (substr($id, -1) !== ';') {
                $this->emitToken(array(
                    'type' => self::PARSEERROR,
                    'data' =>
'named-entity-without-semicolon'
                ));
                $semicolon = false;
            }


            /* If the character reference is being consumed as part of
            an attribute, and the last character matched is not a
            U+003B SEMICOLON (;), and the next character is in the
            range U+0030 DIGIT ZERO to U+0039 DIGIT NINE, U+0041
            LATIN CAPITAL LETTER A to U+005A LATIN CAPITAL LETTER Z,
            or U+0061 LATIN SMALL LETTER A to U+007A LATIN SMALL LETTER Z,
            then, for historical reasons, all the characters that were
            matched after the U+0026 AMPERSAND (&) must be unconsumed,
            and nothing is returned. */
            if (
                $inattr && !$semicolon &&
                strspn(substr($chars, $c, 1), self::ALPHA . self::DIGIT)
            ) {
                return '&' . $chars;
            }

            /* Otherwise, return a character token for the character
            corresponding to the character reference name (as given
            by the second column of the named character references table).
*/
            return HTML5_Data::utf8chr($codepoint) . substr($chars, $c);
        }
    }

    private function characterReferenceInAttributeValue($allowed = false) {
        /* Attempt to consume a character reference. */
        $entity = $this->consumeCharacterReference($allowed, true);

        /* If nothing is returned, append a U+0026 AMPERSAND
        character to the current attribute's value.

        Otherwise, append the returned character token to the
        current attribute's value. */
        $char = (!$entity)
            ? '&'
            : $entity;

        $last = count($this->token['attr']) - 1;
        $this->token['attr'][$last]['value'] .=
$char;

        /* Finally, switch back to the attribute value state that you
        were in when were switched into this state. */
    }

    /**
     * Emits a token, passing it on to the tree builder.
     */
    protected function emitToken($token, $checkStream = true) {
        if ($checkStream) {
            // Emit errors from input stream.
            while ($this->stream->errors) {
               
$this->emitToken(array_shift($this->stream->errors), false);
            }
        }

        // the current structure of attributes is not a terribly good one
        $this->tree->emitToken($token);

        if(is_int($this->tree->content_model)) {
            $this->content_model = $this->tree->content_model;
            $this->tree->content_model = null;

        } elseif($token['type'] === self::ENDTAG) {
            $this->content_model = self::PCDATA;
        }
    }
}

libraries/html5/TreeBuilder.php000064400000507206151160675320012510
0ustar00<?php
/**
 * mod_vertical_menu - Vertical Menu
 *
 * @author    Balint Polgarfi
 * @copyright 2014-2019 Offlajn.com
 * @license   https://gnu.org/licenses/gpl-2.0.html
 * @link      https://offlajn.com
 */
?><?php
/*-------------------------------------------------------------------------
# plg_offlajnjoomla3compat - Offlajn Joomla 3 Compatibility
# -------------------------------------------------------------------------
# @ author    Jeno Kovacs
# @ copyright Copyright (C) 2014 Offlajn.com  All Rights Reserved.
# @ license   http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# @ website   http://www.offlajn.com
-------------------------------------------------------------------------*/
?><?php
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
/*

Copyright 2007 Jeroen van der Meer <http://jero.net/>
Copyright 2009 Edward Z. Yang <edwardzyang@thewritingpot.com>

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction,
including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

*/

// Tags for FIX ME!!!: (in order of priority)
//      XXX - should be fixed NAO!
//      XERROR - with regards to parse errors
//      XSCRIPT - with regards to scripting mode
//      XENCODING - with regards to encoding (for reparsing tests)

class HTML5_TreeBuilder {
    public $stack = array();
    public $content_model;

    private $mode;
    private $original_mode;
    private $secondary_mode;
    private $dom;
    // Whether or not normal insertion of nodes should actually foster
    // parent (used in one case in spec)
    private $foster_parent = false;
    private $a_formatting  = array();

    private $head_pointer = null;
    private $form_pointer = null;

    private $flag_frameset_ok = true;
    private $flag_force_quirks = false;
    private $ignored = false;
    private $quirks_mode = null;
    // this gets to 2 when we want to ignore the next lf character, and
    // is decrement at the beginning of each processed token (this way,
    // code can check for (bool)$ignore_lf_token, but it phases out
    // appropriately)
    private $ignore_lf_token = 0;
    private $fragment = false;
    private $root;

    private $scoping =
array('applet','button','caption','html','marquee','object','table','td','th',
'svg:foreignObject');
    private $formatting =
array('a','b','big','code','em','font','i','nobr','s','small','strike','strong','tt','u');
    private $special =
array('address','area','article','aside','base','basefont','bgsound',
   
'blockquote','body','br','center','col','colgroup','command','dd','details','dialog','dir','div','dl',
   
'dt','embed','fieldset','figure','footer','form','frame','frameset','h1','h2','h3','h4','h5',
   
'h6','head','header','hgroup','hr','iframe','img','input','isindex','li','link',
   
'listing','menu','meta','nav','noembed','noframes','noscript','ol',
   
'p','param','plaintext','pre','script','select','spacer','style',
   
'tbody','textarea','tfoot','thead','title','tr','ul','wbr');

    // Tree construction modes
    const INITIAL           = 0;
    const BEFORE_HTML       = 1;
    const BEFORE_HEAD       = 2;
    const IN_HEAD           = 3;
    const IN_HEAD_NOSCRIPT  = 4;
    const AFTER_HEAD        = 5;
    const IN_BODY           = 6;
    const IN_CDATA_RCDATA   = 7;
    const IN_TABLE          = 8;
    const IN_CAPTION        = 9;
    const IN_COLUMN_GROUP   = 10;
    const IN_TABLE_BODY     = 11;
    const IN_ROW            = 12;
    const IN_CELL           = 13;
    const IN_SELECT         = 14;
    const IN_SELECT_IN_TABLE= 15;
    const IN_FOREIGN_CONTENT= 16;
    const AFTER_BODY        = 17;
    const IN_FRAMESET       = 18;
    const AFTER_FRAMESET    = 19;
    const AFTER_AFTER_BODY  = 20;
    const AFTER_AFTER_FRAMESET = 21;

    /**
     * Converts a magic number to a readable name. Use for debugging.
     */
    private function strConst($number) {
        static $lookup;
        if (!$lookup) {
            $r = new ReflectionClass('HTML5_TreeBuilder');
            $lookup = array_flip($r->getConstants());
        }
        return $lookup[$number];
    }

    // The different types of elements.
    const SPECIAL    = 100;
    const SCOPING    = 101;
    const FORMATTING = 102;
    const PHRASING   = 103;

    // Quirks modes in $quirks_mode
    const NO_QUIRKS             = 200;
    const QUIRKS_MODE           = 201;
    const LIMITED_QUIRKS_MODE   = 202;

    // Marker to be placed in $a_formatting
    const MARKER     = 300;

    // Namespaces for foreign content
    const NS_HTML   = null; // to prevent DOM from requiring NS on
everything
    const NS_MATHML = 'http://www.w3.org/1998/Math/MathML';
    const NS_SVG    = 'http://www.w3.org/2000/svg';
    const NS_XLINK  = 'http://www.w3.org/1999/xlink';
    const NS_XML    = 'http://www.w3.org/XML/1998/namespace';
    const NS_XMLNS  = 'http://www.w3.org/2000/xmlns/';

    public function __construct() {
        $this->mode = self::INITIAL;
        $this->dom = new DOMDocument;

        $this->dom->encoding = 'UTF-8';
        $this->dom->preserveWhiteSpace = true;
        $this->dom->substituteEntities = true;
        $this->dom->strictErrorChecking = false;
    }

    // Process tag tokens
    public function emitToken($token, $mode = null) {
        // XXX: ignore parse errors... why are we emitting them, again?
        if ($token['type'] === HTML5_Tokenizer::PARSEERROR)
return;
        if ($mode === null) $mode = $this->mode;

        /*
        $backtrace = debug_backtrace();
        if ($backtrace[1]['class'] !==
'HTML5_TreeBuilder') echo "--\n";
        echo $this->strConst($mode);
        if ($this->original_mode) echo " (originally
".$this->strConst($this->original_mode).")";
        echo "\n  ";
        token_dump($token);
        $this->printStack();
        $this->printActiveFormattingElements();
        if ($this->foster_parent) echo "  -> this is a foster
parent mode\n";
        */

        if ($this->ignore_lf_token) $this->ignore_lf_token--;
        $this->ignored = false;
        // indenting is a little wonky, this can be changed later on
        switch ($mode) {

    case self::INITIAL:

        /* A character token that is one of U+0009 CHARACTER TABULATION,
         * U+000A LINE FEED (LF), U+000C FORM FEED (FF),  or U+0020 SPACE
*/
        if ($token['type'] === HTML5_Tokenizer::SPACECHARACTER) {
            /* Ignore the token. */
            $this->ignored = true;
        } elseif ($token['type'] === HTML5_Tokenizer::DOCTYPE) {
            if (
                $token['name'] !== 'html' ||
!empty($token['public']) ||
                !empty($token['system']) || $token !==
'about:legacy-compat'
            ) {
                /* If the DOCTYPE token's name is not a case-sensitive
match
                 * for the string "html", or if the token's
public identifier
                 * is not missing, or if the token's system identifier
is
                 * neither missing nor a case-sensitive match for the
string
                 * "about:legacy-compat", then there is a parse
error (this
                 * is the DOCTYPE parse error). */
                // DOCTYPE parse error
            }
            /* Append a DocumentType node to the Document node, with the
name
             * attribute set to the name given in the DOCTYPE token, or the
             * empty string if the name was missing; the publicId attribute
             * set to the public identifier given in the DOCTYPE token, or
             * the empty string if the public identifier was missing; the
             * systemId attribute set to the system identifier given in the
             * DOCTYPE token, or the empty string if the system identifier
             * was missing; and the other attributes specific to
             * DocumentType objects set to null and empty lists as
             * appropriate. Associate the DocumentType node with the
             * Document object so that it is returned as the value of the
             * doctype attribute of the Document object. */
            if (!isset($token['public']))
$token['public'] = null;
            if (!isset($token['system']))
$token['system'] = null;
            // Yes this is hacky. I'm kind of annoyed that I
can't appendChild
            // a doctype to DOMDocument. Maybe I haven't chanted the
right
            // syllables.
            $impl = new DOMImplementation();
            // This call can fail for particularly pathological cases
(namely,
            // the qualifiedName parameter ($token['name']) could
be missing.
            if ($token['name']) {
                $doctype =
$impl->createDocumentType($token['name'],
$token['public'], $token['system']);
                $this->dom->appendChild($doctype);
            } else {
                // It looks like libxml's not actually *able* to
express this case.
                // So... don't.
                $this->dom->emptyDoctype = true;
            }
            $public = is_null($token['public']) ? false :
strtolower($token['public']);
            $system = is_null($token['system']) ? false :
strtolower($token['system']);
            $publicStartsWithForQuirks = array(
             "+//silmaril//dtd html pro v0r11 19970101//",
             "-//advasoft ltd//dtd html 3.0 aswedit +
extensions//",
             "-//as//dtd html 3.0 aswedit + extensions//",
             "-//ietf//dtd html 2.0 level 1//",
             "-//ietf//dtd html 2.0 level 2//",
             "-//ietf//dtd html 2.0 strict level 1//",
             "-//ietf//dtd html 2.0 strict level 2//",
             "-//ietf//dtd html 2.0 strict//",
             "-//ietf//dtd html 2.0//",
             "-//ietf//dtd html 2.1e//",
             "-//ietf//dtd html 3.0//",
             "-//ietf//dtd html 3.2 final//",
             "-//ietf//dtd html 3.2//",
             "-//ietf//dtd html 3//",
             "-//ietf//dtd html level 0//",
             "-//ietf//dtd html level 1//",
             "-//ietf//dtd html level 2//",
             "-//ietf//dtd html level 3//",
             "-//ietf//dtd html strict level 0//",
             "-//ietf//dtd html strict level 1//",
             "-//ietf//dtd html strict level 2//",
             "-//ietf//dtd html strict level 3//",
             "-//ietf//dtd html strict//",
             "-//ietf//dtd html//",
             "-//metrius//dtd metrius presentational//",
             "-//microsoft//dtd internet explorer 2.0 html
strict//",
             "-//microsoft//dtd internet explorer 2.0 html//",
             "-//microsoft//dtd internet explorer 2.0 tables//",
             "-//microsoft//dtd internet explorer 3.0 html
strict//",
             "-//microsoft//dtd internet explorer 3.0 html//",
             "-//microsoft//dtd internet explorer 3.0 tables//",
             "-//netscape comm. corp.//dtd html//",
             "-//netscape comm. corp.//dtd strict html//",
             "-//o'reilly and associates//dtd html 2.0//",
             "-//o'reilly and associates//dtd html extended
1.0//",
             "-//o'reilly and associates//dtd html extended
relaxed 1.0//",
             "-//spyglass//dtd html 2.0 extended//",
             "-//sq//dtd html 2.0 hotmetal + extensions//",
             "-//sun microsystems corp.//dtd hotjava html//",
             "-//sun microsystems corp.//dtd hotjava strict
html//",
             "-//w3c//dtd html 3 1995-03-24//",
             "-//w3c//dtd html 3.2 draft//",
             "-//w3c//dtd html 3.2 final//",
             "-//w3c//dtd html 3.2//",
             "-//w3c//dtd html 3.2s draft//",
             "-//w3c//dtd html 4.0 frameset//",
             "-//w3c//dtd html 4.0 transitional//",
             "-//w3c//dtd html experimental 19960712//",
             "-//w3c//dtd html experimental 970421//",
             "-//w3c//dtd w3 html//",
             "-//w3o//dtd w3 html 3.0//",
             "-//webtechs//dtd mozilla html 2.0//",
             "-//webtechs//dtd mozilla html//",
            );
            $publicSetToForQuirks = array(
             "-//w3o//dtd w3 html strict 3.0//",
             "-/w3c/dtd html 4.0 transitional/en",
             "html",
            );
            $publicStartsWithAndSystemForQuirks = array(
             "-//w3c//dtd html 4.01 frameset//",
             "-//w3c//dtd html 4.01 transitional//",
            );
            $publicStartsWithForLimitedQuirks = array(
             "-//w3c//dtd xhtml 1.0 frameset//",
             "-//w3c//dtd xhtml 1.0 transitional//",
            );
            $publicStartsWithAndSystemForLimitedQuirks = array(
             "-//w3c//dtd html 4.01 frameset//",
             "-//w3c//dtd html 4.01 transitional//",
            );
            // first, do easy checks
            if (
                !empty($token['force-quirks']) ||
                strtolower($token['name']) !== 'html'
            ) {
                $this->quirks_mode = self::QUIRKS_MODE;
            } else {
                do {
                    if ($system) {
                        foreach ($publicStartsWithAndSystemForQuirks as $x)
{
                            if (strncmp($public, $x, strlen($x)) === 0) {
                                $this->quirks_mode = self::QUIRKS_MODE;
                                break;
                            }
                        }
                        if (!is_null($this->quirks_mode)) break;
                        foreach ($publicStartsWithAndSystemForLimitedQuirks
as $x) {
                            if (strncmp($public, $x, strlen($x)) === 0) {
                                $this->quirks_mode =
self::LIMITED_QUIRKS_MODE;
                                break;
                            }
                        }
                        if (!is_null($this->quirks_mode)) break;
                    }
                    foreach ($publicSetToForQuirks as $x) {
                        if ($public === $x) {
                            $this->quirks_mode = self::QUIRKS_MODE;
                            break;
                        }
                    }
                    if (!is_null($this->quirks_mode)) break;
                    foreach ($publicStartsWithForLimitedQuirks as $x) {
                        if (strncmp($public, $x, strlen($x)) === 0) {
                            $this->quirks_mode =
self::LIMITED_QUIRKS_MODE;
                        }
                    }
                    if (!is_null($this->quirks_mode)) break;
                    if ($system ===
"http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd") {
                        $this->quirks_mode = self::QUIRKS_MODE;
                        break;
                    }
                    foreach ($publicStartsWithForQuirks as $x) {
                        if (strncmp($public, $x, strlen($x)) === 0) {
                            $this->quirks_mode = self::QUIRKS_MODE;
                            break;
                        }
                    }
                    if (is_null($this->quirks_mode)) {
                        $this->quirks_mode = self::NO_QUIRKS;
                    }
                } while (false);
            }
            $this->mode = self::BEFORE_HTML;
        } else {
            // parse error
            /* Switch the insertion mode to "before html", then
reprocess the
             * current token. */
            $this->mode = self::BEFORE_HTML;
            $this->quirks_mode = self::QUIRKS_MODE;
            $this->emitToken($token);
        }
        break;

    case self::BEFORE_HTML:

        /* A DOCTYPE token */
        if($token['type'] === HTML5_Tokenizer::DOCTYPE) {
            // Parse error. Ignore the token.
            $this->ignored = true;

        /* A comment token */
        } elseif($token['type'] === HTML5_Tokenizer::COMMENT) {
            /* Append a Comment node to the Document object with the data
            attribute set to the data given in the comment token. */
            $comment =
$this->dom->createComment($token['data']);
            $this->dom->appendChild($comment);

        /* A character token that is one of one of U+0009 CHARACTER
TABULATION,
        U+000A LINE FEED (LF), U+000B LINE TABULATION, U+000C FORM FEED
(FF),
        or U+0020 SPACE */
        } elseif($token['type'] ===
HTML5_Tokenizer::SPACECHARACTER) {
            /* Ignore the token. */
            $this->ignored = true;

        /* A start tag whose tag name is "html" */
        } elseif($token['type'] === HTML5_Tokenizer::STARTTAG
&& $token['name'] == 'html') {
            /* Create an element for the token in the HTML namespace.
Append it 
             * to the Document  object. Put this element in the stack of
open 
             * elements. */
            $html = $this->insertElement($token, false);
            $this->dom->appendChild($html);
            $this->stack[] = $html;

            $this->mode = self::BEFORE_HEAD;

        } else {
            /* Create an html element. Append it to the Document object.
Put
             * this element in the stack of open elements. */
            $html = $this->dom->createElementNS(self::NS_HTML,
'html');
            $this->dom->appendChild($html);
            $this->stack[] = $html;

            /* Switch the insertion mode to "before head", then
reprocess the
             * current token. */
            $this->mode = self::BEFORE_HEAD;
            $this->emitToken($token);
        }
        break;

    case self::BEFORE_HEAD:

        /* A character token that is one of one of U+0009 CHARACTER
TABULATION,
        U+000A LINE FEED (LF), U+000B LINE TABULATION, U+000C FORM FEED
(FF),
        or U+0020 SPACE */
        if($token['type'] === HTML5_Tokenizer::SPACECHARACTER) {
            /* Ignore the token. */
            $this->ignored = true;

        /* A comment token */
        } elseif($token['type'] === HTML5_Tokenizer::COMMENT) {
            /* Append a Comment node to the current node with the data
attribute
            set to the data given in the comment token. */
            $this->insertComment($token['data']);

        /* A DOCTYPE token */
        } elseif($token['type'] === HTML5_Tokenizer::DOCTYPE) {
            /* Parse error. Ignore the token */
            $this->ignored = true;
            // parse error

        /* A start tag token with the tag name "html" */
        } elseif($token['type'] === HTML5_Tokenizer::STARTTAG
&& $token['name'] === 'html') {
            /* Process the token using the rules for the "in
body"
             * insertion mode. */
            $this->processWithRulesFor($token, self::IN_BODY);

        /* A start tag token with the tag name "head" */
        } elseif($token['type'] === HTML5_Tokenizer::STARTTAG
&& $token['name'] === 'head') {
            /* Insert an HTML element for the token. */
            $element = $this->insertElement($token);

            /* Set the head element pointer to this new element node. */
            $this->head_pointer = $element;

            /* Change the insertion mode to "in head". */
            $this->mode = self::IN_HEAD;

        /* An end tag whose tag name is one of: "head",
"body", "html", "br" */
        } elseif(
            $token['type'] === HTML5_Tokenizer::ENDTAG &&
(
                $token['name'] === 'head' ||
$token['name'] === 'body' ||
                $token['name'] === 'html' ||
$token['name'] === 'br'
        )) {
            /* Act as if a start tag token with the tag name
"head" and no
             * attributes had been seen, then reprocess the current token.
*/
            $this->emitToken(array(
                'name' => 'head',
                'type' => HTML5_Tokenizer::STARTTAG,
                'attr' => array()
            ));
            $this->emitToken($token);

        /* Any other end tag */
        } elseif($token['type'] === HTML5_Tokenizer::ENDTAG) {
            /* Parse error. Ignore the token. */
            $this->ignored = true;

        } else {
            /* Act as if a start tag token with the tag name
"head" and no
             * attributes had been seen, then reprocess the current token.
             * Note: This will result in an empty head element being
             * generated, with the current token being reprocessed in the
             * "after head" insertion mode. */
            $this->emitToken(array(
                'name' => 'head',
                'type' => HTML5_Tokenizer::STARTTAG,
                'attr' => array()
            ));
            $this->emitToken($token);
        }
        break;

    case self::IN_HEAD:

        /* A character token that is one of one of U+0009 CHARACTER
TABULATION,
        U+000A LINE FEED (LF), U+000B LINE TABULATION, U+000C FORM FEED
(FF),
        or U+0020 SPACE. */
        if($token['type'] === HTML5_Tokenizer::SPACECHARACTER) {
            /* Insert the character into the current node. */
            $this->insertText($token['data']);

        /* A comment token */
        } elseif($token['type'] === HTML5_Tokenizer::COMMENT) {
            /* Append a Comment node to the current node with the data
attribute
            set to the data given in the comment token. */
            $this->insertComment($token['data']);

        /* A DOCTYPE token */
        } elseif($token['type'] === HTML5_Tokenizer::DOCTYPE) {
            /* Parse error. Ignore the token. */
            $this->ignored = true;
            // parse error

        /* A start tag whose tag name is "html" */
        } elseif($token['type'] === HTML5_Tokenizer::STARTTAG
&&
        $token['name'] === 'html') {
            $this->processWithRulesFor($token, self::IN_BODY);

        /* A start tag whose tag name is one of: "base",
"command", "link" */
        } elseif($token['type'] === HTML5_Tokenizer::STARTTAG
&&
        ($token['name'] === 'base' ||
$token['name'] === 'command' ||
        $token['name'] === 'link')) {
            /* Insert an HTML element for the token. Immediately pop the
             * current node off the stack of open elements. */
            $this->insertElement($token);
            array_pop($this->stack);

            // YYY: Acknowledge the token's self-closing flag, if it
is set.

        /* A start tag whose tag name is "meta" */
        } elseif($token['type'] === HTML5_Tokenizer::STARTTAG
&& $token['name'] === 'meta') {
            /* Insert an HTML element for the token. Immediately pop the
             * current node off the stack of open elements. */
            $this->insertElement($token);
            array_pop($this->stack);

            // XERROR: Acknowledge the token's self-closing flag, if
it is set.

            // XENCODING: If the element has a charset attribute, and its
value is a
            // supported encoding, and the confidence is currently
tentative,
            // then change the encoding to the encoding given by the value
of
            // the charset attribute.
            //
            // Otherwise, if the element has a content attribute, and
applying
            // the algorithm for extracting an encoding from a Content-Type
to
            // its value returns a supported encoding encoding, and the
            // confidence is currently tentative, then change the encoding
to
            // the encoding encoding.

        /* A start tag with the tag name "title" */
        } elseif($token['type'] === HTML5_Tokenizer::STARTTAG
&& $token['name'] === 'title') {
            $this->insertRCDATAElement($token);

        /* A start tag whose tag name is "noscript", if the
scripting flag is enabled, or
         * A start tag whose tag name is one of: "noframes",
"style" */
        } elseif($token['type'] === HTML5_Tokenizer::STARTTAG
&&
        ($token['name'] === 'noscript' ||
$token['name'] === 'noframes' ||
$token['name'] === 'style')) {
            // XSCRIPT: Scripting flag not respected
            $this->insertCDATAElement($token);

        // XSCRIPT: Scripting flag disable not implemented

        /* A start tag with the tag name "script" */
        } elseif($token['type'] === HTML5_Tokenizer::STARTTAG
&& $token['name'] === 'script') {
            /* 1. Create an element for the token in the HTML namespace. */
            $node = $this->insertElement($token, false);

            /* 2. Mark the element as being "parser-inserted" */
            // Uhhh... XSCRIPT

            /* 3. If the parser was originally created for the HTML
             * fragment parsing algorithm, then mark the script element as 
             * "already executed". (fragment case) */
            // ditto... XSCRIPT

            /* 4. Append the new element to the current node  and push it
onto 
             * the stack of open elements.  */
            end($this->stack)->appendChild($node);
            $this->stack[] = $node;
            // I guess we could squash these together

            /* 6. Let the original insertion mode be the current insertion
mode. */
            $this->original_mode = $this->mode;
            /* 7. Switch the insertion mode to "in CDATA/RCDATA"
*/
            $this->mode = self::IN_CDATA_RCDATA;
            /* 5. Switch the tokeniser's content model flag to the
CDATA state. */
            $this->content_model = HTML5_Tokenizer::CDATA;

        /* An end tag with the tag name "head" */
        } elseif($token['type'] === HTML5_Tokenizer::ENDTAG
&& $token['name'] === 'head') {
            /* Pop the current node (which will be the head element) off
the stack of open elements. */
            array_pop($this->stack);

            /* Change the insertion mode to "after head". */
            $this->mode = self::AFTER_HEAD;

        // Slight logic inversion here to minimize duplication
        /* A start tag with the tag name "head". */
        /* An end tag whose tag name is not one of: "body",
"html", "br" */
        } elseif(($token['type'] === HTML5_Tokenizer::STARTTAG
&& $token['name'] === 'head') ||
        ($token['type'] === HTML5_Tokenizer::ENDTAG &&
$token['name'] !== 'html' &&
        $token['name'] !== 'body' &&
$token['name'] !== 'br')) {
            // Parse error. Ignore the token.
            $this->ignored = true;

        /* Anything else */
        } else {
            /* Act as if an end tag token with the tag name
"head" had been
             * seen, and reprocess the current token. */
            $this->emitToken(array(
                'name' => 'head',
                'type' => HTML5_Tokenizer::ENDTAG
            ));

            /* Then, reprocess the current token. */
            $this->emitToken($token);
        }
        break;

    case self::IN_HEAD_NOSCRIPT:
        if ($token['type'] === HTML5_Tokenizer::DOCTYPE) {
            // parse error
        } elseif ($token['type'] === HTML5_Tokenizer::STARTTAG
&& $token['name'] === 'html') {
            $this->processWithRulesFor($token, self::IN_BODY);
        } elseif ($token['type'] === HTML5_Tokenizer::ENDTAG
&& $token['name'] === 'noscript') {
            /* Pop the current node (which will be a noscript element) from
the
             * stack of open elements; the new current node will be a head
             * element. */
            array_pop($this->stack);
            $this->mode = self::IN_HEAD;
        } elseif (
            ($token['type'] === HTML5_Tokenizer::SPACECHARACTER)
||
            ($token['type'] === HTML5_Tokenizer::COMMENT) ||
            ($token['type'] === HTML5_Tokenizer::STARTTAG
&& (
                $token['name'] === 'link' ||
$token['name'] === 'meta' ||
                $token['name'] === 'noframes' ||
$token['name'] === 'style'))) {
            $this->processWithRulesFor($token, self::IN_HEAD);
        // inverted logic
        } elseif (
            ($token['type'] === HTML5_Tokenizer::STARTTAG
&& (
                $token['name'] === 'head' ||
$token['name'] === 'noscript')) ||
            ($token['type'] === HTML5_Tokenizer::ENDTAG
&&
                $token['name'] !== 'br')) {
            // parse error
        } else {
            // parse error
            $this->emitToken(array(
                'type' => HTML5_Tokenizer::ENDTAG,
                'name' => 'noscript',
            ));
            $this->emitToken($token);
        }
        break;

    case self::AFTER_HEAD:
        /* Handle the token as follows: */

        /* A character token that is one of one of U+0009 CHARACTER
TABULATION,
        U+000A LINE FEED (LF), U+000B LINE TABULATION, U+000C FORM FEED
(FF),
        or U+0020 SPACE */
        if($token['type'] === HTML5_Tokenizer::SPACECHARACTER) {
            /* Append the character to the current node. */
            $this->insertText($token['data']);

        /* A comment token */
        } elseif($token['type'] === HTML5_Tokenizer::COMMENT) {
            /* Append a Comment node to the current node with the data
attribute
            set to the data given in the comment token. */
            $this->insertComment($token['data']);

        } elseif ($token['type'] === HTML5_Tokenizer::DOCTYPE) {
            // parse error

        } elseif ($token['type'] === HTML5_Tokenizer::STARTTAG
&& $token['name'] === 'html') {
            $this->processWithRulesFor($token, self::IN_BODY);

        /* A start tag token with the tag name "body" */
        } elseif($token['type'] === HTML5_Tokenizer::STARTTAG
&& $token['name'] === 'body') {
            $this->insertElement($token);

            /* Set the frameset-ok flag to "not ok". */
            $this->flag_frameset_ok = false;

            /* Change the insertion mode to "in body". */
            $this->mode = self::IN_BODY;

        /* A start tag token with the tag name "frameset" */
        } elseif($token['type'] === HTML5_Tokenizer::STARTTAG
&& $token['name'] === 'frameset') {
            /* Insert a frameset element for the token. */
            $this->insertElement($token);

            /* Change the insertion mode to "in frameset". */
            $this->mode = self::IN_FRAMESET;

        /* A start tag token whose tag name is one of: "base",
"link", "meta",
        "script", "style", "title" */
        } elseif($token['type'] === HTML5_Tokenizer::STARTTAG
&& in_array($token['name'],
        array('base', 'link', 'meta',
'noframes', 'script', 'style',
'title'))) {
            // parse error
            /* Push the node pointed to by the head element pointer onto
the
             * stack of open elements. */
            $this->stack[] = $this->head_pointer;
            $this->processWithRulesFor($token, self::IN_HEAD);
            array_splice($this->stack,
array_search($this->head_pointer, $this->stack, true), 1);

        // inversion of specification
        } elseif(
        ($token['type'] === HTML5_Tokenizer::STARTTAG &&
$token['name'] === 'head') ||
        ($token['type'] === HTML5_Tokenizer::ENDTAG &&
            $token['name'] !== 'body' &&
$token['name'] !== 'html' &&
            $token['name'] !== 'br')) {
            // parse error

        /* Anything else */
        } else {
            $this->emitToken(array(
                'name' => 'body',
                'type' => HTML5_Tokenizer::STARTTAG,
                'attr' => array()
            ));
            $this->flag_frameset_ok = true;
            $this->emitToken($token);
        }
        break;

    case self::IN_BODY:
        /* Handle the token as follows: */

        switch($token['type']) {
            /* A character token */
            case HTML5_Tokenizer::CHARACTER:
            case HTML5_Tokenizer::SPACECHARACTER:
                /* Reconstruct the active formatting elements, if any. */
                $this->reconstructActiveFormattingElements();

                /* Append the token's character to the current node.
*/
                $this->insertText($token['data']);

                /* If the token is not one of U+0009 CHARACTER TABULATION,
                 * U+000A LINE FEED (LF), U+000C FORM FEED (FF),  or U+0020
                 * SPACE, then set the frameset-ok flag to "not
ok". */
                // i.e., if any of the characters is not whitespace
                if (strlen($token['data']) !==
strspn($token['data'], HTML5_Tokenizer::WHITESPACE)) {
                    $this->flag_frameset_ok = false;
                }
            break;

            /* A comment token */
            case HTML5_Tokenizer::COMMENT:
                /* Append a Comment node to the current node with the data
                attribute set to the data given in the comment token. */
                $this->insertComment($token['data']);
            break;

            case HTML5_Tokenizer::DOCTYPE:
                // parse error
            break;

            case HTML5_Tokenizer::STARTTAG:
            switch($token['name']) {
                case 'html':
                    // parse error
                    /* For each attribute on the token, check to see if the
                     * attribute is already present on the top element of
the
                     * stack of open elements. If it is not, add the
attribute
                     * and its corresponding value to that element. */
                    foreach($token['attr'] as $attr) {
                       
if(!$this->stack[0]->hasAttribute($attr['name'])) {
                           
$this->stack[0]->setAttribute($attr['name'],
$attr['value']);
                        }
                    }
                break;

                case 'base': case 'command': case
'link': case 'meta': case 'noframes':
                case 'script': case 'style': case
'title':
                    /* Process the token as if the insertion mode had been
"in
                    head". */
                    $this->processWithRulesFor($token, self::IN_HEAD);
                break;

                /* A start tag token with the tag name "body" */
                case 'body':
                    /* Parse error. If the second element on the stack of
open
                    elements is not a body element, or, if the stack of
open
                    elements has only one node on it, then ignore the
token.
                    (fragment case) */
                    if(count($this->stack) === 1 ||
$this->stack[1]->tagName !== 'body') {
                        $this->ignored = true;
                        // Ignore

                    /* Otherwise, for each attribute on the token, check to
see
                    if the attribute is already present on the body element
(the
                    second element)    on the stack of open elements. If it
is not,
                    add the attribute and its corresponding value to that
                    element. */
                    } else {
                        foreach($token['attr'] as $attr) {
                           
if(!$this->stack[1]->hasAttribute($attr['name'])) {
                               
$this->stack[1]->setAttribute($attr['name'],
$attr['value']);
                            }
                        }
                    }
                break;

                case 'frameset':
                    // parse error
                    /* If the second element on the stack of open elements
is
                     * not a body element, or, if the stack of open
elements
                     * has only one node on it, then ignore the token.
                     * (fragment case) */
                    if(count($this->stack) === 1 ||
$this->stack[1]->tagName !== 'body') {
                        $this->ignored = true;
                        // Ignore
                    } elseif (!$this->flag_frameset_ok) {
                        $this->ignored = true;
                        // Ignore
                    } else {
                        /* 1. Remove the second element on the stack of
open 
                         * elements from its parent node, if it has one. 
*/
                        if($this->stack[1]->parentNode) {
                           
$this->stack[1]->parentNode->removeChild($this->stack[1]);
                        }

                        /* 2. Pop all the nodes from the bottom of the
stack of 
                         * open elements, from the current node up to the
root 
                         * html element. */
                        array_splice($this->stack, 1);

                        $this->insertElement($token);
                        $this->mode = self::IN_FRAMESET;
                    }
                break;

                // in spec, there is a diversion here

                case 'address': case 'article': case
'aside': case 'blockquote':
                case 'center': case 'datagrid': case
'details': case 'dialog': case 'dir':
                case 'div': case 'dl': case
'fieldset': case 'figure': case 'footer':
                case 'header': case 'hgroup': case
'menu': case 'nav':
                case 'ol': case 'p': case
'section': case 'ul':
                    /* If the stack of open elements has a p element in
scope,
                    then act as if an end tag with the tag name p had been
                    seen. */
                    if($this->elementInScope('p')) {
                        $this->emitToken(array(
                            'name' => 'p',
                            'type' => HTML5_Tokenizer::ENDTAG
                        ));
                    }

                    /* Insert an HTML element for the token. */
                    $this->insertElement($token);
                break;

                /* A start tag whose tag name is one of: "h1",
"h2", "h3", "h4",
                "h5", "h6" */
                case 'h1': case 'h2': case
'h3': case 'h4': case 'h5': case
'h6':
                    /* If the stack of open elements has a p  element in
scope,
                    then act as if an end tag with the tag name p had been
seen. */
                    if($this->elementInScope('p')) {
                        $this->emitToken(array(
                            'name' => 'p',
                            'type' => HTML5_Tokenizer::ENDTAG
                        ));
                    }

                    /* If the current node is an element whose tag name is
one
                     * of "h1", "h2", "h3",
"h4", "h5", or "h6", then this is a
                     * parse error; pop the current node off the stack of
open
                     * elements. */
                    $peek = array_pop($this->stack);
                    if (in_array($peek->tagName, array("h1",
"h2", "h3", "h4", "h5",
"h6"))) {
                        // parse error
                    } else {
                        $this->stack[] = $peek;
                    }

                    /* Insert an HTML element for the token. */
                    $this->insertElement($token);
                break;

                case 'pre': case 'listing':
                    /* If the stack of open elements has a p  element in
scope,
                    then act as if an end tag with the tag name p had been
seen. */
                    if($this->elementInScope('p')) {
                        $this->emitToken(array(
                            'name' => 'p',
                            'type' => HTML5_Tokenizer::ENDTAG
                        ));
                    }
                    $this->insertElement($token);
                    /* If the next token is a U+000A LINE FEED (LF)
character
                     * token, then ignore that token and move on to the
next
                     * one. (Newlines at the start of pre blocks are
ignored as
                     * an authoring convenience.) */
                    $this->ignore_lf_token = 2;
                    $this->flag_frameset_ok = false;
                break;

                /* A start tag whose tag name is "form" */
                case 'form':
                    /* If the form element pointer is not null, ignore the
                    token with a parse error. */
                    if($this->form_pointer !== null) {
                        $this->ignored = true;
                        // Ignore.

                    /* Otherwise: */
                    } else {
                        /* If the stack of open elements has a p element in
                        scope, then act as if an end tag with the tag name
p
                        had been seen. */
                        if($this->elementInScope('p')) {
                            $this->emitToken(array(
                                'name' => 'p',
                                'type' =>
HTML5_Tokenizer::ENDTAG
                            ));
                        }

                        /* Insert an HTML element for the token, and set
the
                        form element pointer to point to the element
created. */
                        $element = $this->insertElement($token);
                        $this->form_pointer = $element;
                    }
                break;

                // condensed specification
                case 'li': case 'dd': case
'dt':
                    /* 1. Set the frameset-ok flag to "not ok".
*/
                    $this->flag_frameset_ok = false;

                    $stack_length = count($this->stack) - 1;
                    for($n = $stack_length; 0 <= $n; $n--) {
                        /* 2. Initialise node to be the current node (the
                        bottommost node of the stack). */
                        $stop = false;
                        $node = $this->stack[$n];
                        $cat  = $this->getElementCategory($node);

                        // for case 'li':
                        /* 3. If node is an li element, then act as if an
end
                         * tag with the tag name "li" had been
seen, then jump
                         * to the last step.  */
                        // for case 'dd': case 'dt':
                        /* If node is a dd or dt element, then act as if an
end
                         * tag with the same tag name as node had been
seen, then
                         * jump to the last step. */
                        if(($token['name'] === 'li'
&& $node->tagName === 'li') ||
                        ($token['name'] !== 'li'
&& ($node->tagName === 'dd' || $node->tagName ===
'dt'))) { // limited conditional
                            $this->emitToken(array(
                                'type' =>
HTML5_Tokenizer::ENDTAG,
                                'name' => $node->tagName,
                            ));
                            break;
                        }

                        /* 4. If node is not in the formatting category,
and is
                        not    in the phrasing category, and is not an
address,
                        div or p element, then stop this algorithm. */
                        if($cat !== self::FORMATTING && $cat !==
self::PHRASING &&
                        $node->tagName !== 'address'
&& $node->tagName !== 'div' &&
                        $node->tagName !== 'p') {
                            break;
                        }

                        /* 5. Otherwise, set node to the previous entry in
the
                         * stack of open elements and return to step 2. */
                    }

                    /* 6. This is the last step. */

                    /* If the stack of open elements has a p  element in
scope,
                    then act as if an end tag with the tag name p had been
                    seen. */
                    if($this->elementInScope('p')) {
                        $this->emitToken(array(
                            'name' => 'p',
                            'type' => HTML5_Tokenizer::ENDTAG
                        ));
                    }

                    /* Finally, insert an HTML element with the same tag
                    name as the    token's. */
                    $this->insertElement($token);
                break;

                /* A start tag token whose tag name is
"plaintext" */
                case 'plaintext':
                    /* If the stack of open elements has a p  element in
scope,
                    then act as if an end tag with the tag name p had been
                    seen. */
                    if($this->elementInScope('p')) {
                        $this->emitToken(array(
                            'name' => 'p',
                            'type' => HTML5_Tokenizer::ENDTAG
                        ));
                    }

                    /* Insert an HTML element for the token. */
                    $this->insertElement($token);

                    $this->content_model = HTML5_Tokenizer::PLAINTEXT;
                break;

                // more diversions

                /* A start tag whose tag name is "a" */
                case 'a':
                    /* If the list of active formatting elements contains
                    an element whose tag name is "a" between the
end of the
                    list and the last marker on the list (or the start of
                    the list if there is no marker on the list), then this
                    is a parse error; act as if an end tag with the tag
name
                    "a" had been seen, then remove that element
from the list
                    of active formatting elements and the stack of open
                    elements if the end tag didn't already remove it
(it
                    might not have if the element is not in table scope).
*/
                    $leng = count($this->a_formatting);

                    for($n = $leng - 1; $n >= 0; $n--) {
                        if($this->a_formatting[$n] === self::MARKER) {
                            break;

                        } elseif($this->a_formatting[$n]->tagName ===
'a') {
                            $a = $this->a_formatting[$n];
                            $this->emitToken(array(
                                'name' => 'a',
                                'type' =>
HTML5_Tokenizer::ENDTAG
                            ));
                            if (in_array($a, $this->a_formatting)) {
                                $a_i = array_search($a,
$this->a_formatting, true);
                                if($a_i !== false)
array_splice($this->a_formatting, $a_i, 1);
                            }
                            if (in_array($a, $this->stack)) {
                                $a_i = array_search($a, $this->stack,
true);
                                if ($a_i !== false)
array_splice($this->stack, $a_i, 1);
                            }
                            break;
                        }
                    }

                    /* Reconstruct the active formatting elements, if any.
*/
                    $this->reconstructActiveFormattingElements();

                    /* Insert an HTML element for the token. */
                    $el = $this->insertElement($token);

                    /* Add that element to the list of active formatting
                    elements. */
                    $this->a_formatting[] = $el;
                break;

                case 'b': case 'big': case
'code': case 'em': case 'font': case
'i':
                case 's': case 'small': case
'strike':
                case 'strong': case 'tt': case
'u':
                    /* Reconstruct the active formatting elements, if any.
*/
                    $this->reconstructActiveFormattingElements();

                    /* Insert an HTML element for the token. */
                    $el = $this->insertElement($token);

                    /* Add that element to the list of active formatting
                    elements. */
                    $this->a_formatting[] = $el;
                break;

                case 'nobr':
                    /* Reconstruct the active formatting elements, if any.
*/
                    $this->reconstructActiveFormattingElements();

                    /* If the stack of open elements has a nobr element in
                     * scope, then this is a parse error; act as if an end
tag
                     * with the tag name "nobr" had been seen,
then once again
                     * reconstruct the active formatting elements, if any.
*/
                    if ($this->elementInScope('nobr')) {
                        $this->emitToken(array(
                            'name' => 'nobr',
                            'type' => HTML5_Tokenizer::ENDTAG,
                        ));
                        $this->reconstructActiveFormattingElements();
                    }

                    /* Insert an HTML element for the token. */
                    $el = $this->insertElement($token);

                    /* Add that element to the list of active formatting
                    elements. */
                    $this->a_formatting[] = $el;
                break;

                // another diversion

                /* A start tag token whose tag name is "button"
*/
                case 'button':
                    /* If the stack of open elements has a button element
in scope,
                    then this is a parse error; act as if an end tag with
the tag
                    name "button" had been seen, then reprocess
the token. (We don't
                    do that. Unnecessary.) (I hope you're right! --
ezyang) */
                    if($this->elementInScope('button')) {
                        $this->emitToken(array(
                            'name' => 'button',
                            'type' => HTML5_Tokenizer::ENDTAG
                        ));
                    }

                    /* Reconstruct the active formatting elements, if any.
*/
                    $this->reconstructActiveFormattingElements();

                    /* Insert an HTML element for the token. */
                    $this->insertElement($token);

                    /* Insert a marker at the end of the list of active
                    formatting elements. */
                    $this->a_formatting[] = self::MARKER;

                    $this->flag_frameset_ok = false;
                break;

                case 'applet': case 'marquee': case
'object':
                    /* Reconstruct the active formatting elements, if any.
*/
                    $this->reconstructActiveFormattingElements();

                    /* Insert an HTML element for the token. */
                    $this->insertElement($token);

                    /* Insert a marker at the end of the list of active
                    formatting elements. */
                    $this->a_formatting[] = self::MARKER;

                    $this->flag_frameset_ok = false;
                break;

                // spec diversion

                /* A start tag whose tag name is "table" */
                case 'table':
                    /* If the stack of open elements has a p element in
scope,
                    then act as if an end tag with the tag name p had been
seen. */
                    if($this->quirks_mode !== self::QUIRKS_MODE
&&
                    $this->elementInScope('p')) {
                        $this->emitToken(array(
                            'name' => 'p',
                            'type' => HTML5_Tokenizer::ENDTAG
                        ));
                    }

                    /* Insert an HTML element for the token. */
                    $this->insertElement($token);

                    $this->flag_frameset_ok = false;

                    /* Change the insertion mode to "in table".
*/
                    $this->mode = self::IN_TABLE;
                break;

                /* A start tag whose tag name is one of: "area",
"basefont",
                "bgsound", "br", "embed",
"img", "param", "spacer", "wbr" */
                case 'area': case 'basefont': case
'bgsound': case 'br':
                case 'embed': case 'img': case
'input': case 'keygen': case 'spacer':
                case 'wbr':
                    /* Reconstruct the active formatting elements, if any.
*/
                    $this->reconstructActiveFormattingElements();

                    /* Insert an HTML element for the token. */
                    $this->insertElement($token);

                    /* Immediately pop the current node off the stack of
open elements. */
                    array_pop($this->stack);

                    // YYY: Acknowledge the token's self-closing flag,
if it is set.

                    $this->flag_frameset_ok = false;
                break;

                case 'param': case 'source':
                    /* Insert an HTML element for the token. */
                    $this->insertElement($token);

                    /* Immediately pop the current node off the stack of
open elements. */
                    array_pop($this->stack);

                    // YYY: Acknowledge the token's self-closing flag,
if it is set.
                break;

                /* A start tag whose tag name is "hr" */
                case 'hr':
                    /* If the stack of open elements has a p element in
scope,
                    then act as if an end tag with the tag name p had been
seen. */
                    if($this->elementInScope('p')) {
                        $this->emitToken(array(
                            'name' => 'p',
                            'type' => HTML5_Tokenizer::ENDTAG
                        ));
                    }

                    /* Insert an HTML element for the token. */
                    $this->insertElement($token);

                    /* Immediately pop the current node off the stack of
open elements. */
                    array_pop($this->stack);

                    // YYY: Acknowledge the token's self-closing flag,
if it is set.

                    $this->flag_frameset_ok = false;
                break;

                /* A start tag whose tag name is "image" */
                case 'image':
                    /* Parse error. Change the token's tag name to
"img" and
                    reprocess it. (Don't ask.) */
                    $token['name'] = 'img';
                    $this->emitToken($token);
                break;

                /* A start tag whose tag name is "isindex" */
                case 'isindex':
                    /* Parse error. */

                    /* If the form element pointer is not null,
                    then ignore the token. */
                    if($this->form_pointer === null) {
                        /* Act as if a start tag token with the tag name
"form" had
                        been seen. */
                        /* If the token has an attribute called
"action", set
                         * the action attribute on the resulting form
                         * element to the value of the "action"
attribute of
                         * the token. */
                        $attr = array();
                        $action = $this->getAttr($token,
'action');
                        if ($action !== false) {
                            $attr[] = array('name' =>
'action', 'value' => $action);
                        }
                        $this->emitToken(array(
                            'name' => 'form',
                            'type' =>
HTML5_Tokenizer::STARTTAG,
                            'attr' => $attr
                        ));

                        /* Act as if a start tag token with the tag name
"hr" had
                        been seen. */
                        $this->emitToken(array(
                            'name' => 'hr',
                            'type' =>
HTML5_Tokenizer::STARTTAG,
                            'attr' => array()
                        ));

                        /* Act as if a start tag token with the tag name
"p" had
                        been seen. */
                        $this->emitToken(array(
                            'name' => 'p',
                            'type' =>
HTML5_Tokenizer::STARTTAG,
                            'attr' => array()
                        ));

                        /* Act as if a start tag token with the tag name
"label"
                        had been seen. */
                        $this->emitToken(array(
                            'name' => 'label',
                            'type' =>
HTML5_Tokenizer::STARTTAG,
                            'attr' => array()
                        ));

                        /* Act as if a stream of character tokens had been
seen. */
                        $prompt = $this->getAttr($token,
'prompt');
                        if ($prompt === false) {
                            $prompt = 'This is a searchable index.
'.
                            'Insert your search keywords here: ';
                        }
                        $this->emitToken(array(
                            'data' => $prompt,
                            'type' =>
HTML5_Tokenizer::CHARACTER,
                        ));

                        /* Act as if a start tag token with the tag name
"input"
                        had been seen, with all the attributes from the
"isindex"
                        token, except with the "name" attribute
set to the value
                        "isindex" (ignoring any explicit
"name" attribute). */
                        $attr = array();
                        foreach ($token['attr'] as $keypair) {
                            if ($keypair['name'] ===
'name' || $keypair['name'] === 'action' ||
                                $keypair['name'] ===
'prompt') continue;
                            $attr[] = $keypair;
                        }
                        $attr[] = array('name' =>
'name', 'value' => 'isindex');

                        $this->emitToken(array(
                            'name' => 'input',
                            'type' =>
HTML5_Tokenizer::STARTTAG,
                            'attr' => $attr
                        ));

                        /* Act as if an end tag token with the tag name
"label"
                        had been seen. */
                        $this->emitToken(array(
                            'name' => 'label',
                            'type' => HTML5_Tokenizer::ENDTAG
                        ));

                        /* Act as if an end tag token with the tag name
"p" had
                        been seen. */
                        $this->emitToken(array(
                            'name' => 'p',
                            'type' => HTML5_Tokenizer::ENDTAG
                        ));

                        /* Act as if a start tag token with the tag name
"hr" had
                        been seen. */
                        $this->emitToken(array(
                            'name' => 'hr',
                            'type' =>
HTML5_Tokenizer::STARTTAG
                        ));

                        /* Act as if an end tag token with the tag name
"form" had
                        been seen. */
                        $this->emitToken(array(
                            'name' => 'form',
                            'type' => HTML5_Tokenizer::ENDTAG
                        ));
                    } else {
                        $this->ignored = true;
                    }
                break;

                /* A start tag whose tag name is "textarea" */
                case 'textarea':
                    $this->insertElement($token);

                    /* If the next token is a U+000A LINE FEED (LF)
                     * character token, then ignore that token and move on
to
                     * the next one. (Newlines at the start of textarea
                     * elements are ignored as an authoring convenience.)
                     * need flag, see also <pre> */
                    $this->ignore_lf_token = 2;

                    $this->original_mode = $this->mode;
                    $this->flag_frameset_ok = false;
                    $this->mode = self::IN_CDATA_RCDATA;

                    /* Switch the tokeniser's content model flag to
the
                    RCDATA state. */
                    $this->content_model = HTML5_Tokenizer::RCDATA;
                break;

                /* A start tag token whose tag name is "xmp" */
                case 'xmp':
                    /* Reconstruct the active formatting elements, if any.
*/
                    $this->reconstructActiveFormattingElements();

                    $this->flag_frameset_ok = false;

                    $this->insertCDATAElement($token);
                break;

                case 'iframe':
                    $this->flag_frameset_ok = false;
                    $this->insertCDATAElement($token);
                break;

                case 'noembed': case 'noscript':
                    // XSCRIPT: should check scripting flag
                    $this->insertCDATAElement($token);
                break;

                /* A start tag whose tag name is "select" */
                case 'select':
                    /* Reconstruct the active formatting elements, if any.
*/
                    $this->reconstructActiveFormattingElements();

                    /* Insert an HTML element for the token. */
                    $this->insertElement($token);

                    $this->flag_frameset_ok = false;

                    /* If the insertion mode is one of in table",
"in caption",
                     * "in column group", "in table
body", "in row", or "in
                     * cell", then switch the insertion mode to
"in select in
                     * table". Otherwise, switch the insertion mode 
to "in
                     * select". */
                    if (
                        $this->mode === self::IN_TABLE || $this->mode
=== self::IN_CAPTION ||
                        $this->mode === self::IN_COLUMN_GROUP ||
$this->mode ==+self::IN_TABLE_BODY ||
                        $this->mode === self::IN_ROW || $this->mode
=== self::IN_CELL
                    ) {
                        $this->mode = self::IN_SELECT_IN_TABLE;
                    } else {
                        $this->mode = self::IN_SELECT;
                    }
                break;

                case 'option': case 'optgroup':
                    if ($this->elementInScope('option')) {
                        $this->emitToken(array(
                            'name' => 'option',
                            'type' => HTML5_Tokenizer::ENDTAG,
                        ));
                    }
                    $this->reconstructActiveFormattingElements();
                    $this->insertElement($token);
                break;

                case 'rp': case 'rt':
                    /* If the stack of open elements has a ruby element in
scope, then generate
                     * implied end tags. If the current node is not then a
ruby element, this is
                     * a parse error; pop all the nodes from the current
node up to the node
                     * immediately before the bottommost ruby element on
the stack of open elements.
                     */
                    if ($this->elementInScope('ruby')) {
                        $this->generateImpliedEndTags();
                    }
                    $peek = false;
                    do {
                        if ($peek) {
                            // parse error
                        }
                        $peek = array_pop($this->stack);
                    } while ($peek->tagName !== 'ruby');
                    $this->stack[] = $peek; // we popped one too many
                    $this->insertElement($token);
                break;

                // spec diversion

                case 'math':
                    $this->reconstructActiveFormattingElements();
                    $token = $this->adjustMathMLAttributes($token);
                    $token = $this->adjustForeignAttributes($token);
                    $this->insertForeignElement($token,
self::NS_MATHML);
                    if (isset($token['self-closing'])) {
                        // XERROR: acknowledge the token's
self-closing flag
                        array_pop($this->stack);
                    }
                    if ($this->mode !== self::IN_FOREIGN_CONTENT) {
                        $this->secondary_mode = $this->mode;
                        $this->mode = self::IN_FOREIGN_CONTENT;
                    }
                break;

                case 'svg':
                    $this->reconstructActiveFormattingElements();
                    $token = $this->adjustSVGAttributes($token);
                    $token = $this->adjustForeignAttributes($token);
                    $this->insertForeignElement($token, self::NS_SVG);
                    if (isset($token['self-closing'])) {
                        // XERROR: acknowledge the token's
self-closing flag
                        array_pop($this->stack);
                    }
                    if ($this->mode !== self::IN_FOREIGN_CONTENT) {
                        $this->secondary_mode = $this->mode;
                        $this->mode = self::IN_FOREIGN_CONTENT;
                    }
                break;

                case 'caption': case 'col': case
'colgroup': case 'frame': case 'head':
                case 'tbody': case 'td': case
'tfoot': case 'th': case 'thead': case
'tr':
                    // parse error
                break;

                /* A start tag token not covered by the previous entries */
                default:
                    /* Reconstruct the active formatting elements, if any.
*/
                    $this->reconstructActiveFormattingElements();

                    $this->insertElement($token);
                    /* This element will be a phrasing  element. */
                break;
            }
            break;

            case HTML5_Tokenizer::ENDTAG:
            switch($token['name']) {
                /* An end tag with the tag name "body" */
                case 'body':
                    /* If the second element in the stack of open elements
is
                    not a body element, this is a parse error. Ignore the
token.
                    (innerHTML case) */
                    if(count($this->stack) < 2 ||
$this->stack[1]->tagName !== 'body') {
                        $this->ignored = true;

                    /* Otherwise, if there is a node in the stack of open
                     * elements that is not either a dd element, a dt
                     * element, an li element, an optgroup element, an
                     * option element, a p element, an rp element, an rt
                     * element, a tbody element, a td element, a tfoot
                     * element, a th element, a thead element, a tr
element,
                     * the body element, or the html element, then this is
a
                     * parse error. */
                    } else {
                        // XERROR: implement this check for parse error
                    }

                    /* Change the insertion mode to "after body".
*/
                    $this->mode = self::AFTER_BODY;
                break;

                /* An end tag with the tag name "html" */
                case 'html':
                    /* Act as if an end tag with tag name "body"
had been seen,
                    then, if that token wasn't ignored, reprocess the
current
                    token. */
                    $this->emitToken(array(
                        'name' => 'body',
                        'type' => HTML5_Tokenizer::ENDTAG
                    ));

                    if (!$this->ignored) $this->emitToken($token);
                break;

                case 'address': case 'article': case
'aside': case 'blockquote':
                case 'center': case 'datagrid': case
'details': case 'dir':
                case 'div': case 'dl': case
'fieldset': case 'figure': case 'footer':
                case 'header': case 'hgroup': case
'listing': case 'menu':
                case 'nav': case 'ol': case
'pre': case 'section': case 'ul':
                    /* If the stack of open elements has an element in
scope
                    with the same tag name as that of the token, then
generate
                    implied end tags. */
                    if($this->elementInScope($token['name']))
{
                        $this->generateImpliedEndTags();

                        /* Now, if the current node is not an element with
                        the same tag name as that of the token, then this
                        is a parse error. */
                        // XERROR: implement parse error logic

                        /* If the stack of open elements has an element in
                        scope with the same tag name as that of the token,
                        then pop elements from this stack until an element
                        with that tag name has been popped from the stack.
*/
                        do {
                            $node = array_pop($this->stack);
                        } while ($node->tagName !==
$token['name']);
                    } else {
                        // parse error
                    }
                break;

                /* An end tag whose tag name is "form" */
                case 'form':
                    /* Let node be the element that the form element
pointer is set to. */
                    $node = $this->form_pointer;
                    /* Set the form element pointer  to null. */
                    $this->form_pointer = null;
                    /* If node is null or the stack of open elements does
not 
                        * have node in scope, then this is a parse error;
ignore the token. */
                    if ($node === null || !in_array($node,
$this->stack)) {
                        // parse error
                        $this->ignored = true;
                    } else {
                        /* 1. Generate implied end tags. */
                        $this->generateImpliedEndTags();
                        /* 2. If the current node is not node, then this is
a parse error.  */
                        if (end($this->stack) !== $node) {
                            // parse error
                        }
                        /* 3. Remove node from the stack of open elements.
*/
                        array_splice($this->stack, array_search($node,
$this->stack, true), 1);
                    }

                break;

                /* An end tag whose tag name is "p" */
                case 'p':
                    /* If the stack of open elements has a p element in
scope,
                    then generate implied end tags, except for p elements.
*/
                    if($this->elementInScope('p')) {
                        /* Generate implied end tags, except for elements
with
                         * the same tag name as the token. */
                       
$this->generateImpliedEndTags(array('p'));

                        /* If the current node is not a p element, then
this is
                        a parse error. */
                        // XERROR: implement

                        /* Pop elements from the stack of open elements 
until
                         * an element with the same tag name as the token
has
                         * been popped from the stack. */
                        do {
                            $node = array_pop($this->stack);
                        } while ($node->tagName !== 'p');

                    } else {
                        // parse error
                        $this->emitToken(array(
                            'name' => 'p',
                            'type' =>
HTML5_Tokenizer::STARTTAG,
                        ));
                        $this->emitToken($token);
                    }
                break;

                /* An end tag whose tag name is "dd",
"dt", or "li" */
                case 'dd': case 'dt': case
'li':
                    if($this->elementInScope($token['name']))
{
                       
$this->generateImpliedEndTags(array($token['name']));

                        /* If the current node is not an element with the
same
                        tag name as the token, then this is a parse error.
*/
                        // XERROR: implement parse error

                        /* Pop elements from the stack of open elements 
until
                         * an element with the same tag name as the token
has
                         * been popped from the stack. */
                        do {
                            $node = array_pop($this->stack);
                        } while ($node->tagName !==
$token['name']);

                    } else {
                        // parse error
                    }
                break;

                /* An end tag whose tag name is one of: "h1",
"h2", "h3", "h4",
                "h5", "h6" */
                case 'h1': case 'h2': case
'h3': case 'h4': case 'h5': case
'h6':
                    $elements = array('h1', 'h2',
'h3', 'h4', 'h5', 'h6');

                    /* If the stack of open elements has in scope an
element whose
                    tag name is one of "h1", "h2",
"h3", "h4", "h5", or "h6", then
                    generate implied end tags. */
                    if($this->elementInScope($elements)) {
                        $this->generateImpliedEndTags();

                        /* Now, if the current node is not an element with
the same
                        tag name as that of the token, then this is a parse
error. */
                        // XERROR: implement parse error

                        /* If the stack of open elements has in scope an
element
                        whose tag name is one of "h1",
"h2", "h3", "h4", "h5", or
                        "h6", then pop elements from the stack
until an element
                        with one of those tag names has been popped from
the stack. */
                        do {
                            $node = array_pop($this->stack);
                        } while (!in_array($node->tagName, $elements));
                    } else {
                        // parse error
                    }
                break;

                /* An end tag whose tag name is one of: "a",
"b", "big", "em",
                "font", "i", "nobr",
"s", "small", "strike", "strong",
"tt", "u" */
                case 'a': case 'b': case
'big': case 'code': case 'em': case
'font':
                case 'i': case 'nobr': case
's': case 'small': case 'strike':
                case 'strong': case 'tt': case
'u':
                    // XERROR: generally speaking this needs parse error
logic
                    /* 1. Let the formatting element be the last element in
                    the list of active formatting elements that:
                        * is between the end of the list and the last scope
                        marker in the list, if any, or the start of the
list
                        otherwise, and
                        * has the same tag name as the token.
                    */
                    while(true) {
                        for($a = count($this->a_formatting) - 1; $a
>= 0; $a--) {
                            if($this->a_formatting[$a] === self::MARKER)
{
                                break;

                            } elseif($this->a_formatting[$a]->tagName
=== $token['name']) {
                                $formatting_element =
$this->a_formatting[$a];
                                $in_stack = in_array($formatting_element,
$this->stack, true);
                                $fe_af_pos = $a;
                                break;
                            }
                        }

                        /* If there is no such node, or, if that node is
                        also in the stack of open elements but the element
                        is not in scope, then this is a parse error. Abort
                        these steps. The token is ignored. */
                        if(!isset($formatting_element) || ($in_stack
&&
                       
!$this->elementInScope($token['name']))) {
                            $this->ignored = true;
                            break;

                        /* Otherwise, if there is such a node, but that
node
                        is not in the stack of open elements, then this is
a
                        parse error; remove the element from the list, and
                        abort these steps. */
                        } elseif(isset($formatting_element) &&
!$in_stack) {
                            unset($this->a_formatting[$fe_af_pos]);
                            $this->a_formatting =
array_merge($this->a_formatting);
                            break;
                        }

                        /* Otherwise, there is a formatting element and
that
                         * element is in the stack and is in scope. If the
                         * element is not the current node, this is a parse
                         * error. In any case, proceed with the algorithm
as
                         * written in the following steps. */
                        // XERROR: implement me

                        /* 2. Let the furthest block be the topmost node in
the
                        stack of open elements that is lower in the stack
                        than the formatting element, and is not an element
in
                        the phrasing or formatting categories. There might
                        not be one. */
                        $fe_s_pos = array_search($formatting_element,
$this->stack, true);
                        $length = count($this->stack);

                        for($s = $fe_s_pos + 1; $s < $length; $s++) {
                            $category =
$this->getElementCategory($this->stack[$s]);

                            if($category !== self::PHRASING &&
$category !== self::FORMATTING) {
                                $furthest_block = $this->stack[$s];
                                break;
                            }
                        }

                        /* 3. If there is no furthest block, then the UA
must
                        skip the subsequent steps and instead just pop all
                        the nodes from the bottom of the stack of open
                        elements, from the current node up to the
formatting
                        element, and remove the formatting element from the
                        list of active formatting elements. */
                        if(!isset($furthest_block)) {
                            for($n = $length - 1; $n >= $fe_s_pos; $n--)
{
                                array_pop($this->stack);
                            }

                            unset($this->a_formatting[$fe_af_pos]);
                            $this->a_formatting =
array_merge($this->a_formatting);
                            break;
                        }

                        /* 4. Let the common ancestor be the element
                        immediately above the formatting element in the
stack
                        of open elements. */
                        $common_ancestor = $this->stack[$fe_s_pos - 1];

                        /* 5. Let a bookmark note the position of the
                        formatting element in the list of active formatting
                        elements relative to the elements on either side
                        of it in the list. */
                        $bookmark = $fe_af_pos;

                        /* 6. Let node and last node  be the furthest
block.
                        Follow these steps: */
                        $node = $furthest_block;
                        $last_node = $furthest_block;

                        while(true) {
                            for($n = array_search($node, $this->stack,
true) - 1; $n >= 0; $n--) {
                                /* 6.1 Let node be the element immediately
                                prior to node in the stack of open
elements. */
                                $node = $this->stack[$n];

                                /* 6.2 If node is not in the list of active
                                formatting elements, then remove node from
                                the stack of open elements and then go back
                                to step 1. */
                                if(!in_array($node, $this->a_formatting,
true)) {
                                    array_splice($this->stack, $n, 1);

                                } else {
                                    break;
                                }
                            }

                            /* 6.3 Otherwise, if node is the formatting
                            element, then go to the next step in the
overall
                            algorithm. */
                            if($node === $formatting_element) {
                                break;

                            /* 6.4 Otherwise, if last node is the furthest
                            block, then move the aforementioned bookmark to
                            be immediately after the node in the list of
                            active formatting elements. */
                            } elseif($last_node === $furthest_block) {
                                $bookmark = array_search($node,
$this->a_formatting, true) + 1;
                            }

                            /* 6.5 Create an element for the token for
which
                             * the element node was created, replace the
entry
                             * for node in the list of active formatting
                             * elements with an entry for the new element,
                             * replace the entry for node in the stack of
open
                             * elements with an entry for the new element,
and
                             * let node be the new element. */
                            // we don't know what the token is anymore
                            $clone = $node->cloneNode();
                            $a_pos = array_search($node,
$this->a_formatting, true);
                            $s_pos = array_search($node, $this->stack,
true);
                            $this->a_formatting[$a_pos] = $clone;
                            $this->stack[$s_pos] = $clone;
                            $node = $clone;

                            /* 6.6 Insert last node into node, first
removing
                            it from its previous parent node if any. */
                            if($last_node->parentNode !== null) {
                               
$last_node->parentNode->removeChild($last_node);
                            }

                            $node->appendChild($last_node);

                            /* 6.7 Let last node be node. */
                            $last_node = $node;

                            /* 6.8 Return to step 1 of this inner set of
steps. */
                        }

                        /* 7. If the common ancestor node is a table,
tbody,
                         * tfoot, thead, or tr element, then, foster parent
                         * whatever last node ended up being in the
previous
                         * step, first removing it from its previous parent
                         * node if any. */
                        if ($last_node->parentNode) { // common step
                           
$last_node->parentNode->removeChild($last_node);
                        }
                        if (in_array($common_ancestor->tagName,
array('table', 'tbody', 'tfoot',
'thead', 'tr'))) {
                            $this->fosterParent($last_node);
                        /* Otherwise, append whatever last node  ended up
being
                         * in the previous step to the common ancestor
node,
                         * first removing it from its previous parent node
if
                         * any. */
                        } else {
                            $common_ancestor->appendChild($last_node);
                        }

                        /* 8. Create an element for the token for which the
                         * formatting element was created. */
                        $clone = $formatting_element->cloneNode();

                        /* 9. Take all of the child nodes of the furthest
                        block and append them to the element created in the
                        last step. */
                        while($furthest_block->hasChildNodes()) {
                            $child = $furthest_block->firstChild;
                            $furthest_block->removeChild($child);
                            $clone->appendChild($child);
                        }

                        /* 10. Append that clone to the furthest block. */
                        $furthest_block->appendChild($clone);

                        /* 11. Remove the formatting element from the list
                        of active formatting elements, and insert the new
element
                        into the list of active formatting elements at the
                        position of the aforementioned bookmark. */
                        $fe_af_pos = array_search($formatting_element,
$this->a_formatting, true);
                        array_splice($this->a_formatting, $fe_af_pos,
1);

                        $af_part1 = array_slice($this->a_formatting, 0,
$bookmark - 1);
                        $af_part2 = array_slice($this->a_formatting,
$bookmark);
                        $this->a_formatting = array_merge($af_part1,
array($clone), $af_part2);

                        /* 12. Remove the formatting element from the stack
                        of open elements, and insert the new element into
the stack
                        of open elements immediately below the position of
the
                        furthest block in that stack. */
                        $fe_s_pos = array_search($formatting_element,
$this->stack, true);
                        array_splice($this->stack, $fe_s_pos, 1);

                        $fb_s_pos = array_search($furthest_block,
$this->stack, true);
                        $s_part1 = array_slice($this->stack, 0,
$fb_s_pos + 1);
                        $s_part2 = array_slice($this->stack, $fb_s_pos +
1);
                        $this->stack = array_merge($s_part1,
array($clone), $s_part2);

                        /* 13. Jump back to step 1 in this series of steps.
*/
                        unset($formatting_element, $fe_af_pos, $fe_s_pos,
$furthest_block);
                    }
                break;

                case 'applet': case 'button': case
'marquee': case 'object':
                    /* If the stack of open elements has an element in
scope whose
                    tag name matches the tag name of the token, then
generate implied
                    tags. */
                    if($this->elementInScope($token['name']))
{
                        $this->generateImpliedEndTags();

                        /* Now, if the current node is not an element with
the same
                        tag name as the token, then this is a parse error.
*/
                        // XERROR: implement logic

                        /* Pop elements from the stack of open elements 
until
                         * an element with the same tag name as the token
has
                         * been popped from the stack. */
                        do {
                            $node = array_pop($this->stack);
                        } while ($node->tagName !==
$token['name']);

                        /* Clear the list of active formatting elements up
to the
                         * last marker. */
                        $keys = array_keys($this->a_formatting,
self::MARKER, true);
                        $marker = end($keys);

                        for($n = count($this->a_formatting) - 1; $n >
$marker; $n--) {
                            array_pop($this->a_formatting);
                        }
                    } else {
                        // parse error
                    }
                break;

                case 'br':
                    // Parse error
                    $this->emitToken(array(
                        'name' => 'br',
                        'type' => HTML5_Tokenizer::STARTTAG,
                    ));
                break;

                /* An end tag token not covered by the previous entries */
                default:
                    for($n = count($this->stack) - 1; $n >= 0; $n--)
{
                        /* Initialise node to be the current node (the
bottommost
                        node of the stack). */
                        $node = $this->stack[$n];

                        /* If node has the same tag name as the end tag
token,
                        then: */
                        if($token['name'] === $node->tagName)
{
                            /* Generate implied end tags. */
                            $this->generateImpliedEndTags();

                            /* If the tag name of the end tag token does
not
                            match the tag name of the current node, this is
a
                            parse error. */
                            // XERROR: implement this

                            /* Pop all the nodes from the current node up
to
                            node, including node, then stop these steps. */
                            // XSKETCHY
                            do {
                                $pop = array_pop($this->stack);
                            } while ($pop !== $node);
                            break;

                        } else {
                            $category =
$this->getElementCategory($node);

                            if($category !== self::FORMATTING &&
$category !== self::PHRASING) {
                                /* Otherwise, if node is in neither the
formatting
                                category nor the phrasing category, then
this is a
                                parse error. Stop this algorithm. The end
tag token
                                is ignored. */
                                $this->ignored = true;
                                break;
                                // parse error
                            }
                        }
                        /* Set node to the previous entry in the stack of
open elements. Loop. */
                    }
                break;
            }
            break;
        }
        break;

    case self::IN_CDATA_RCDATA:
        if (
            $token['type'] === HTML5_Tokenizer::CHARACTER ||
            $token['type'] === HTML5_Tokenizer::SPACECHARACTER
        ) {
            $this->insertText($token['data']);
        } elseif ($token['type'] === HTML5_Tokenizer::EOF) {
            // parse error
            /* If the current node is a script  element, mark the script
             * element as "already executed". */
            // probably not necessary
            array_pop($this->stack);
            $this->mode = $this->original_mode;
            $this->emitToken($token);
        } elseif ($token['type'] === HTML5_Tokenizer::ENDTAG
&& $token['name'] === 'script') {
            array_pop($this->stack);
            $this->mode = $this->original_mode;
            // we're ignoring all of the execution stuff
        } elseif ($token['type'] === HTML5_Tokenizer::ENDTAG) {
            array_pop($this->stack);
            $this->mode = $this->original_mode;
        }
    break;

    case self::IN_TABLE:
        $clear = array('html', 'table');

        /* A character token that is one of one of U+0009 CHARACTER
TABULATION,
        U+000A LINE FEED (LF), U+000B LINE TABULATION, U+000C FORM FEED
(FF),
        or U+0020 SPACE */
        if($token['type'] === HTML5_Tokenizer::SPACECHARACTER
&&
        /* If the current table is tainted, then act as described in
         * the "anything else" entry below. */
        // Note: hsivonen has a test that fails due to this line
        // because he wants to convince Hixie not to do taint
        !$this->currentTableIsTainted()) {
            /* Append the character to the current node. */
            $this->insertText($token['data']);

        /* A comment token */
        } elseif($token['type'] === HTML5_Tokenizer::COMMENT) {
            /* Append a Comment node to the current node with the data
            attribute set to the data given in the comment token. */
            $this->insertComment($token['data']);

        } elseif($token['type'] === HTML5_Tokenizer::DOCTYPE) {
            // parse error

        /* A start tag whose tag name is "caption" */
        } elseif($token['type'] === HTML5_Tokenizer::STARTTAG
&&
        $token['name'] === 'caption') {
            /* Clear the stack back to a table context. */
            $this->clearStackToTableContext($clear);

            /* Insert a marker at the end of the list of active
            formatting elements. */
            $this->a_formatting[] = self::MARKER;

            /* Insert an HTML element for the token, then switch the
            insertion mode to "in caption". */
            $this->insertElement($token);
            $this->mode = self::IN_CAPTION;

        /* A start tag whose tag name is "colgroup" */
        } elseif($token['type'] === HTML5_Tokenizer::STARTTAG
&&
        $token['name'] === 'colgroup') {
            /* Clear the stack back to a table context. */
            $this->clearStackToTableContext($clear);

            /* Insert an HTML element for the token, then switch the
            insertion mode to "in column group". */
            $this->insertElement($token);
            $this->mode = self::IN_COLUMN_GROUP;

        /* A start tag whose tag name is "col" */
        } elseif($token['type'] === HTML5_Tokenizer::STARTTAG
&&
        $token['name'] === 'col') {
            $this->emitToken(array(
                'name' => 'colgroup',
                'type' => HTML5_Tokenizer::STARTTAG,
                'attr' => array()
            ));

            $this->emitToken($token);

        /* A start tag whose tag name is one of: "tbody",
"tfoot", "thead" */
        } elseif($token['type'] === HTML5_Tokenizer::STARTTAG
&& in_array($token['name'],
        array('tbody', 'tfoot', 'thead'))) {
            /* Clear the stack back to a table context. */
            $this->clearStackToTableContext($clear);

            /* Insert an HTML element for the token, then switch the
insertion
            mode to "in table body". */
            $this->insertElement($token);
            $this->mode = self::IN_TABLE_BODY;

        /* A start tag whose tag name is one of: "td",
"th", "tr" */
        } elseif($token['type'] === HTML5_Tokenizer::STARTTAG
&&
        in_array($token['name'], array('td',
'th', 'tr'))) {
            /* Act as if a start tag token with the tag name
"tbody" had been
            seen, then reprocess the current token. */
            $this->emitToken(array(
                'name' => 'tbody',
                'type' => HTML5_Tokenizer::STARTTAG,
                'attr' => array()
            ));

            $this->emitToken($token);

        /* A start tag whose tag name is "table" */
        } elseif($token['type'] === HTML5_Tokenizer::STARTTAG
&&
        $token['name'] === 'table') {
            /* Parse error. Act as if an end tag token with the tag name
"table"
            had been seen, then, if that token wasn't ignored,
reprocess the
            current token. */
            $this->emitToken(array(
                'name' => 'table',
                'type' => HTML5_Tokenizer::ENDTAG
            ));

            if (!$this->ignored) $this->emitToken($token);

        /* An end tag whose tag name is "table" */
        } elseif($token['type'] === HTML5_Tokenizer::ENDTAG
&&
        $token['name'] === 'table') {
            /* If the stack of open elements does not have an element in
table
            scope with the same tag name as the token, this is a parse
error.
            Ignore the token. (fragment case) */
            if(!$this->elementInScope($token['name'], true)) {
                $this->ignored = true;

            /* Otherwise: */
            } else {
                do {
                    $node = array_pop($this->stack);
                } while ($node->tagName !== 'table');

                /* Reset the insertion mode appropriately. */
                $this->resetInsertionMode();
            }

        /* An end tag whose tag name is one of: "body",
"caption", "col",
        "colgroup", "html", "tbody",
"td", "tfoot", "th", "thead",
"tr" */
        } elseif($token['type'] === HTML5_Tokenizer::ENDTAG
&& in_array($token['name'],
        array('body', 'caption', 'col',
'colgroup', 'html', 'tbody', 'td',
        'tfoot', 'th', 'thead',
'tr'))) {
            // Parse error. Ignore the token.

        } elseif($token['type'] === HTML5_Tokenizer::STARTTAG
&&
        ($token['name'] === 'style' ||
$token['name'] === 'script')) {
            $this->processWithRulesFor($token, self::IN_HEAD);

        } elseif ($token['type'] === HTML5_Tokenizer::STARTTAG
&& $token['name'] === 'input' &&
        // assignment is intentional
        /* If the token does not have an attribute with the name
"type", or
         * if it does, but that attribute's value is not an ASCII
         * case-insensitive match for the string "hidden", then:
act as
         * described in the "anything else" entry below. */
        ($type = $this->getAttr($token, 'type')) &&
strtolower($type) === 'hidden') {
            // I.e., if its an input with the type attribute ==
'hidden'
            /* Otherwise */
            // parse error
            $this->insertElement($token);
            array_pop($this->stack);
        } elseif ($token['type'] === HTML5_Tokenizer::EOF) {
            /* If the current node is not the root html element, then this
is a parse error. */
            if (end($this->stack)->tagName !== 'html') {
                // Note: It can only be the current node in the fragment
case.
                // parse error
            }
            /* Stop parsing. */
        /* Anything else */
        } else {
            /* Parse error. Process the token as if the insertion mode was
"in
            body", with the following exception: */

            $old = $this->foster_parent;
            $this->foster_parent = true;
            $this->processWithRulesFor($token, self::IN_BODY);
            $this->foster_parent = $old;
        }
    break;

    case self::IN_CAPTION:
        /* An end tag whose tag name is "caption" */
        if($token['type'] === HTML5_Tokenizer::ENDTAG &&
$token['name'] === 'caption') {
            /* If the stack of open elements does not have an element in
table
            scope with the same tag name as the token, this is a parse
error.
            Ignore the token. (fragment case) */
            if(!$this->elementInScope($token['name'], true)) {
                $this->ignored = true;
                // Ignore

            /* Otherwise: */
            } else {
                /* Generate implied end tags. */
                $this->generateImpliedEndTags();

                /* Now, if the current node is not a caption element, then
this
                is a parse error. */
                // XERROR: implement

                /* Pop elements from this stack until a caption element has
                been popped from the stack. */
                do {
                    $node = array_pop($this->stack);
                } while ($node->tagName !== 'caption');

                /* Clear the list of active formatting elements up to the
last
                marker. */
               
$this->clearTheActiveFormattingElementsUpToTheLastMarker();

                /* Switch the insertion mode to "in table". */
                $this->mode = self::IN_TABLE;
            }

        /* A start tag whose tag name is one of: "caption",
"col", "colgroup",
        "tbody", "td", "tfoot",
"th", "thead", "tr", or an end tag whose tag
        name is "table" */
        } elseif(($token['type'] === HTML5_Tokenizer::STARTTAG
&& in_array($token['name'],
        array('caption', 'col', 'colgroup',
'tbody', 'td', 'tfoot', 'th',
        'thead', 'tr'))) || ($token['type']
=== HTML5_Tokenizer::ENDTAG &&
        $token['name'] === 'table')) {
            /* Parse error. Act as if an end tag with the tag name
"caption"
            had been seen, then, if that token wasn't ignored,
reprocess the
            current token. */
            $this->emitToken(array(
                'name' => 'caption',
                'type' => HTML5_Tokenizer::ENDTAG
            ));

            if (!$this->ignored) $this->emitToken($token);

        /* An end tag whose tag name is one of: "body",
"col", "colgroup",
        "html", "tbody", "td",
"tfoot", "th", "thead", "tr" */
        } elseif($token['type'] === HTML5_Tokenizer::ENDTAG
&& in_array($token['name'],
        array('body', 'col', 'colgroup',
'html', 'tbody', 'tfoot', 'th',
        'thead', 'tr'))) {
            // Parse error. Ignore the token.
            $this->ignored = true;

        /* Anything else */
        } else {
            /* Process the token as if the insertion mode was "in
body". */
            $this->processWithRulesFor($token, self::IN_BODY);
        }
    break;

    case self::IN_COLUMN_GROUP:
        /* A character token that is one of one of U+0009 CHARACTER
TABULATION,
        U+000A LINE FEED (LF), U+000B LINE TABULATION, U+000C FORM FEED
(FF),
        or U+0020 SPACE */
        if($token['type'] === HTML5_Tokenizer::SPACECHARACTER) {
            /* Append the character to the current node. */
            $this->insertText($token['data']);

        /* A comment token */
        } elseif($token['type'] === HTML5_Tokenizer::COMMENT) {
            /* Append a Comment node to the current node with the data
            attribute set to the data given in the comment token. */
            $this->insertToken($token['data']);

        } elseif($token['type'] === HTML5_Tokenizer::DOCTYPE) {
            // parse error

        } elseif($token['type'] === HTML5_Tokenizer::STARTTAG
&& $token['name'] === 'html') {
            $this->processWithRulesFor($token, self::IN_BODY);

        /* A start tag whose tag name is "col" */
        } elseif($token['type'] === HTML5_Tokenizer::STARTTAG
&& $token['name'] === 'col') {
            /* Insert a col element for the token. Immediately pop the
current
            node off the stack of open elements. */
            $this->insertElement($token);
            array_pop($this->stack);
            // XERROR: Acknowledge the token's self-closing flag, if
it is set.

        /* An end tag whose tag name is "colgroup" */
        } elseif($token['type'] === HTML5_Tokenizer::ENDTAG
&&
        $token['name'] === 'colgroup') {
            /* If the current node is the root html element, then this is a
            parse error, ignore the token. (fragment case) */
            if(end($this->stack)->tagName === 'html') {
                $this->ignored = true;

            /* Otherwise, pop the current node (which will be a colgroup
            element) from the stack of open elements. Switch the insertion
            mode to "in table". */
            } else {
                array_pop($this->stack);
                $this->mode = self::IN_TABLE;
            }

        /* An end tag whose tag name is "col" */
        } elseif($token['type'] === HTML5_Tokenizer::ENDTAG
&& $token['name'] === 'col') {
            /* Parse error. Ignore the token. */
            $this->ignored = true;

        /* An end-of-file token */
        /* If the current node is the root html  element */
        } elseif($token['type'] === HTML5_Tokenizer::EOF
&& end($this->stack)->tagName === 'html') {
            /* Stop parsing */

        /* Anything else */
        } else {
            /* Act as if an end tag with the tag name "colgroup"
had been seen,
            and then, if that token wasn't ignored, reprocess the
current token. */
            $this->emitToken(array(
                'name' => 'colgroup',
                'type' => HTML5_Tokenizer::ENDTAG
            ));

            if (!$this->ignored) $this->emitToken($token);
        }
    break;

    case self::IN_TABLE_BODY:
        $clear = array('tbody', 'tfoot',
'thead', 'html');

        /* A start tag whose tag name is "tr" */
        if($token['type'] === HTML5_Tokenizer::STARTTAG
&& $token['name'] === 'tr') {
            /* Clear the stack back to a table body context. */
            $this->clearStackToTableContext($clear);

            /* Insert a tr element for the token, then switch the insertion
            mode to "in row". */
            $this->insertElement($token);
            $this->mode = self::IN_ROW;

        /* A start tag whose tag name is one of: "th",
"td" */
        } elseif($token['type'] === HTML5_Tokenizer::STARTTAG
&&
        ($token['name'] === 'th' ||   
$token['name'] === 'td')) {
            /* Parse error. Act as if a start tag with the tag name
"tr" had
            been seen, then reprocess the current token. */
            $this->emitToken(array(
                'name' => 'tr',
                'type' => HTML5_Tokenizer::STARTTAG,
                'attr' => array()
            ));

            $this->emitToken($token);

        /* An end tag whose tag name is one of: "tbody",
"tfoot", "thead" */
        } elseif($token['type'] === HTML5_Tokenizer::ENDTAG
&&
        in_array($token['name'], array('tbody',
'tfoot', 'thead'))) {
            /* If the stack of open elements does not have an element in
table
            scope with the same tag name as the token, this is a parse
error.
            Ignore the token. */
            if(!$this->elementInScope($token['name'], true)) {
                // Parse error
                $this->ignored = true;

            /* Otherwise: */
            } else {
                /* Clear the stack back to a table body context. */
                $this->clearStackToTableContext($clear);

                /* Pop the current node from the stack of open elements.
Switch
                the insertion mode to "in table". */
                array_pop($this->stack);
                $this->mode = self::IN_TABLE;
            }

        /* A start tag whose tag name is one of: "caption",
"col", "colgroup",
        "tbody", "tfoot", "thead", or an end
tag whose tag name is "table" */
        } elseif(($token['type'] === HTML5_Tokenizer::STARTTAG
&& in_array($token['name'],
        array('caption', 'col', 'colgroup',
'tbody', 'tfoot', 'thead'))) ||
        ($token['type'] === HTML5_Tokenizer::ENDTAG &&
$token['name'] === 'table')) {
            /* If the stack of open elements does not have a tbody, thead,
or
            tfoot element in table scope, this is a parse error. Ignore the
            token. (fragment case) */
            if(!$this->elementInScope(array('tbody',
'thead', 'tfoot'), true)) {
                // parse error
                $this->ignored = true;

            /* Otherwise: */
            } else {
                /* Clear the stack back to a table body context. */
                $this->clearStackToTableContext($clear);

                /* Act as if an end tag with the same tag name as the
current
                node ("tbody", "tfoot", or
"thead") had been seen, then
                reprocess the current token. */
                $this->emitToken(array(
                    'name' =>
end($this->stack)->tagName,
                    'type' => HTML5_Tokenizer::ENDTAG
                ));

                $this->emitToken($token);
            }

        /* An end tag whose tag name is one of: "body",
"caption", "col",
        "colgroup", "html", "td",
"th", "tr" */
        } elseif($token['type'] === HTML5_Tokenizer::ENDTAG
&& in_array($token['name'],
        array('body', 'caption', 'col',
'colgroup', 'html', 'td', 'th',
'tr'))) {
            /* Parse error. Ignore the token. */
            $this->ignored = true;

        /* Anything else */
        } else {
            /* Process the token as if the insertion mode was "in
table". */
            $this->processWithRulesFor($token, self::IN_TABLE);
        }
    break;

    case self::IN_ROW:
        $clear = array('tr', 'html');

        /* A start tag whose tag name is one of: "th",
"td" */
        if($token['type'] === HTML5_Tokenizer::STARTTAG
&&
        ($token['name'] === 'th' ||
$token['name'] === 'td')) {
            /* Clear the stack back to a table row context. */
            $this->clearStackToTableContext($clear);

            /* Insert an HTML element for the token, then switch the
insertion
            mode to "in cell". */
            $this->insertElement($token);
            $this->mode = self::IN_CELL;

            /* Insert a marker at the end of the list of active formatting
            elements. */
            $this->a_formatting[] = self::MARKER;

        /* An end tag whose tag name is "tr" */
        } elseif($token['type'] === HTML5_Tokenizer::ENDTAG
&& $token['name'] === 'tr') {
            /* If the stack of open elements does not have an element in
table
            scope with the same tag name as the token, this is a parse
error.
            Ignore the token. (fragment case) */
            if(!$this->elementInScope($token['name'], true)) {
                // Ignore.
                $this->ignored = true;

            /* Otherwise: */
            } else {
                /* Clear the stack back to a table row context. */
                $this->clearStackToTableContext($clear);

                /* Pop the current node (which will be a tr element) from
the
                stack of open elements. Switch the insertion mode to
"in table
                body". */
                array_pop($this->stack);
                $this->mode = self::IN_TABLE_BODY;
            }

        /* A start tag whose tag name is one of: "caption",
"col", "colgroup",
        "tbody", "tfoot", "thead",
"tr" or an end tag whose tag name is "table" */
        } elseif(($token['type'] === HTML5_Tokenizer::STARTTAG
&& in_array($token['name'],
        array('caption', 'col', 'colgroup',
'tbody', 'tfoot', 'thead', 'tr')))
||
        ($token['type'] === HTML5_Tokenizer::ENDTAG &&
$token['name'] === 'table')) {
            /* Act as if an end tag with the tag name "tr" had
been seen, then,
            if that token wasn't ignored, reprocess the current token.
*/
            $this->emitToken(array(
                'name' => 'tr',
                'type' => HTML5_Tokenizer::ENDTAG
            ));
            if (!$this->ignored) $this->emitToken($token);

        /* An end tag whose tag name is one of: "tbody",
"tfoot", "thead" */
        } elseif($token['type'] === HTML5_Tokenizer::ENDTAG
&&
        in_array($token['name'], array('tbody',
'tfoot', 'thead'))) {
            /* If the stack of open elements does not have an element in
table
            scope with the same tag name as the token, this is a parse
error.
            Ignore the token. */
            if(!$this->elementInScope($token['name'], true)) {
                $this->ignored = true;

            /* Otherwise: */
            } else {
                /* Otherwise, act as if an end tag with the tag name
"tr" had
                been seen, then reprocess the current token. */
                $this->emitToken(array(
                    'name' => 'tr',
                    'type' => HTML5_Tokenizer::ENDTAG
                ));

                $this->emitToken($token);
            }

        /* An end tag whose tag name is one of: "body",
"caption", "col",
        "colgroup", "html", "td",
"th" */
        } elseif($token['type'] === HTML5_Tokenizer::ENDTAG
&& in_array($token['name'],
        array('body', 'caption', 'col',
'colgroup', 'html', 'td', 'th'))) {
            /* Parse error. Ignore the token. */
            $this->ignored = true;

        /* Anything else */
        } else {
            /* Process the token as if the insertion mode was "in
table". */
            $this->processWithRulesFor($token, self::IN_TABLE);
        }
    break;

    case self::IN_CELL:
        /* An end tag whose tag name is one of: "td",
"th" */
        if($token['type'] === HTML5_Tokenizer::ENDTAG &&
        ($token['name'] === 'td' ||
$token['name'] === 'th')) {
            /* If the stack of open elements does not have an element in
table
            scope with the same tag name as that of the token, then this is
a
            parse error and the token must be ignored. */
            if(!$this->elementInScope($token['name'], true)) {
                $this->ignored = true;

            /* Otherwise: */
            } else {
                /* Generate implied end tags, except for elements with the
same
                tag name as the token. */
               
$this->generateImpliedEndTags(array($token['name']));

                /* Now, if the current node is not an element with the same
tag
                name as the token, then this is a parse error. */
                // XERROR: Implement parse error code

                /* Pop elements from this stack until an element with the
same
                tag name as the token has been popped from the stack. */
                do {
                    $node = array_pop($this->stack);
                } while ($node->tagName !== $token['name']);

                /* Clear the list of active formatting elements up to the
last
                marker. */
               
$this->clearTheActiveFormattingElementsUpToTheLastMarker();

                /* Switch the insertion mode to "in row". (The
current node
                will be a tr element at this point.) */
                $this->mode = self::IN_ROW;
            }

        /* A start tag whose tag name is one of: "caption",
"col", "colgroup",
        "tbody", "td", "tfoot",
"th", "thead", "tr" */
        } elseif($token['type'] === HTML5_Tokenizer::STARTTAG
&& in_array($token['name'],
        array('caption', 'col', 'colgroup',
'tbody', 'td', 'tfoot', 'th',
        'thead', 'tr'))) {
            /* If the stack of open elements does not have a td or th
element
            in table scope, then this is a parse error; ignore the token.
            (fragment case) */
            if(!$this->elementInScope(array('td',
'th'), true)) {
                // parse error
                $this->ignored = true;

            /* Otherwise, close the cell (see below) and reprocess the
current
            token. */
            } else {
                $this->closeCell();
                $this->emitToken($token);
            }

        /* An end tag whose tag name is one of: "body",
"caption", "col",
        "colgroup", "html" */
        } elseif($token['type'] === HTML5_Tokenizer::ENDTAG
&& in_array($token['name'],
        array('body', 'caption', 'col',
'colgroup', 'html'))) {
            /* Parse error. Ignore the token. */
            $this->ignored = true;

        /* An end tag whose tag name is one of: "table",
"tbody", "tfoot",
        "thead", "tr" */
        } elseif($token['type'] === HTML5_Tokenizer::ENDTAG
&& in_array($token['name'],
        array('table', 'tbody', 'tfoot',
'thead', 'tr'))) {
            /* If the stack of open elements does not have a td or th
element
            in table scope, then this is a parse error; ignore the token.
            (innerHTML case) */
            if(!$this->elementInScope(array('td',
'th'), true)) {
                // Parse error
                $this->ignored = true;

            /* Otherwise, close the cell (see below) and reprocess the
current
            token. */
            } else {
                $this->closeCell();
                $this->emitToken($token);
            }

        /* Anything else */
        } else {
            /* Process the token as if the insertion mode was "in
body". */
            $this->processWithRulesFor($token, self::IN_BODY);
        }
    break;

    case self::IN_SELECT:
        /* Handle the token as follows: */

        /* A character token */
        if(
            $token['type'] === HTML5_Tokenizer::CHARACTER ||
            $token['type'] === HTML5_Tokenizer::SPACECHARACTER
        ) {
            /* Append the token's character to the current node. */
            $this->insertText($token['data']);

        /* A comment token */
        } elseif($token['type'] === HTML5_Tokenizer::COMMENT) {
            /* Append a Comment node to the current node with the data
            attribute set to the data given in the comment token. */
            $this->insertComment($token['data']);

        } elseif($token['type'] === HTML5_Tokenizer::DOCTYPE) {
            // parse error

        } elseif($token['type'] === HTML5_Tokenizer::STARTTAG
&& $token['name'] === 'html') {
            $this->processWithRulesFor($token, self::INBODY);

        /* A start tag token whose tag name is "option" */
        } elseif($token['type'] === HTML5_Tokenizer::STARTTAG
&&
        $token['name'] === 'option') {
            /* If the current node is an option element, act as if an end
tag
            with the tag name "option" had been seen. */
            if(end($this->stack)->tagName === 'option') {
                $this->emitToken(array(
                    'name' => 'option',
                    'type' => HTML5_Tokenizer::ENDTAG
                ));
            }

            /* Insert an HTML element for the token. */
            $this->insertElement($token);

        /* A start tag token whose tag name is "optgroup" */
        } elseif($token['type'] === HTML5_Tokenizer::STARTTAG
&&
        $token['name'] === 'optgroup') {
            /* If the current node is an option element, act as if an end
tag
            with the tag name "option" had been seen. */
            if(end($this->stack)->tagName === 'option') {
                $this->emitToken(array(
                    'name' => 'option',
                    'type' => HTML5_Tokenizer::ENDTAG
                ));
            }

            /* If the current node is an optgroup element, act as if an end
tag
            with the tag name "optgroup" had been seen. */
            if(end($this->stack)->tagName === 'optgroup') {
                $this->emitToken(array(
                    'name' => 'optgroup',
                    'type' => HTML5_Tokenizer::ENDTAG
                ));
            }

            /* Insert an HTML element for the token. */
            $this->insertElement($token);

        /* An end tag token whose tag name is "optgroup" */
        } elseif($token['type'] === HTML5_Tokenizer::ENDTAG
&&
        $token['name'] === 'optgroup') {
            /* First, if the current node is an option element, and the
node
            immediately before it in the stack of open elements is an
optgroup
            element, then act as if an end tag with the tag name
"option" had
            been seen. */
            $elements_in_stack = count($this->stack);

            if($this->stack[$elements_in_stack - 1]->tagName ===
'option' &&
            $this->stack[$elements_in_stack - 2]->tagName ===
'optgroup') {
                $this->emitToken(array(
                    'name' => 'option',
                    'type' => HTML5_Tokenizer::ENDTAG
                ));
            }

            /* If the current node is an optgroup element, then pop that
node
            from the stack of open elements. Otherwise, this is a parse
error,
            ignore the token. */
            if(end($this->stack)->tagName === 'optgroup') {
                array_pop($this->stack);
            } else {
                // parse error
                $this->ignored = true;
            }

        /* An end tag token whose tag name is "option" */
        } elseif($token['type'] === HTML5_Tokenizer::ENDTAG
&&
        $token['name'] === 'option') {
            /* If the current node is an option element, then pop that node
            from the stack of open elements. Otherwise, this is a parse
error,
            ignore the token. */
            if(end($this->stack)->tagName === 'option') {
                array_pop($this->stack);
            } else {
                // parse error
                $this->ignored = true;
            }

        /* An end tag whose tag name is "select" */
        } elseif($token['type'] === HTML5_Tokenizer::ENDTAG
&&
        $token['name'] === 'select') {
            /* If the stack of open elements does not have an element in
table
            scope with the same tag name as the token, this is a parse
error.
            Ignore the token. (fragment case) */
            if(!$this->elementInScope($token['name'], true)) {
                $this->ignored = true;
                // parse error

            /* Otherwise: */
            } else {
                /* Pop elements from the stack of open elements until a
select
                element has been popped from the stack. */
                do {
                    $node = array_pop($this->stack);
                } while ($node->tagName !== 'select');

                /* Reset the insertion mode appropriately. */
                $this->resetInsertionMode();
            }

        /* A start tag whose tag name is "select" */
        } elseif($token['type'] === HTML5_Tokenizer::STARTTAG
&& $token['name'] === 'select') {
            /* Parse error. Act as if the token had been an end tag with
the
            tag name "select" instead. */
            $this->emitToken(array(
                'name' => 'select',
                'type' => HTML5_Tokenizer::ENDTAG
            ));

        } elseif($token['type'] === HTML5_Tokenizer::STARTTAG
&&
        ($token['name'] === 'input' ||
$token['name'] === 'textarea')) {
            // parse error
            $this->emitToken(array(
                'name' => 'select',
                'type' => HTML5_Tokenizer::ENDTAG
            ));
            $this->emitToken($token);

        } elseif($token['type'] === HTML5_Tokenizer::STARTTAG
&& $token['name'] === 'script') {
            $this->processWithRulesFor($token, self::IN_HEAD);

        } elseif($token['type'] === HTML5_Tokenizer::EOF) {
            // XERROR: If the current node is not the root html element,
then this is a parse error.
            /* Stop parsing */

        /* Anything else */
        } else {
            /* Parse error. Ignore the token. */
            $this->ignored = true;
        }
    break;

    case self::IN_SELECT_IN_TABLE:

        if($token['type'] === HTML5_Tokenizer::STARTTAG
&&
        in_array($token['name'], array('caption',
'table', 'tbody',
        'tfoot', 'thead', 'tr',
'td', 'th'))) {
            // parse error
            $this->emitToken(array(
                'name' => 'select',
                'type' => HTML5_Tokenizer::ENDTAG,
            ));
            $this->emitToken($token);

        /* An end tag whose tag name is one of: "caption",
"table", "tbody",
        "tfoot", "thead", "tr",
"td", "th" */
        } elseif($token['type'] === HTML5_Tokenizer::ENDTAG
&&
        in_array($token['name'], array('caption',
'table', 'tbody', 'tfoot', 'thead',
'tr', 'td', 'th')))  {
            /* Parse error. */
            // parse error

            /* If the stack of open elements has an element in table scope
with
            the same tag name as that of the token, then act as if an end
tag
            with the tag name "select" had been seen, and
reprocess the token.
            Otherwise, ignore the token. */
            if($this->elementInScope($token['name'], true)) {
                $this->emitToken(array(
                    'name' => 'select',
                    'type' => HTML5_Tokenizer::ENDTAG
                ));

                $this->emitToken($token);
            } else {
                $this->ignored = true;
            }
        } else {
            $this->processWithRulesFor($token, self::IN_SELECT);
        }
    break;

    case self::IN_FOREIGN_CONTENT:
        if ($token['type'] === HTML5_Tokenizer::CHARACTER ||
        $token['type'] === HTML5_Tokenizer::SPACECHARACTER) {
            $this->insertText($token['data']);
        } elseif ($token['type'] === HTML5_Tokenizer::COMMENT) {
            $this->insertComment($token['data']);
        } elseif ($token['type'] === HTML5_Tokenizer::DOCTYPE) {
            // XERROR: parse error
        } elseif ($token['type'] === HTML5_Tokenizer::ENDTAG
&&
        $token['name'] === 'script' &&
end($this->stack)->tagName === 'script' &&
        end($this->stack)->namespaceURI === self::NS_SVG) {
            array_pop($this->stack);
            // a bunch of script running mumbo jumbo
        } elseif (
            ($token['type'] === HTML5_Tokenizer::STARTTAG
&&
                ((
                    $token['name'] !== 'mglyph'
&&
                    $token['name'] !== 'malignmark'
&&
                    end($this->stack)->namespaceURI ===
self::NS_MATHML &&
                    in_array(end($this->stack)->tagName,
array('mi', 'mo', 'mn', 'ms',
'mtext'))
                ) ||
                (
                    $token['name'] === 'svg' &&
                    end($this->stack)->namespaceURI ===
self::NS_MATHML &&
                    end($this->stack)->tagName ===
'annotation-xml'
                ) ||
                (
                    end($this->stack)->namespaceURI === self::NS_SVG
&&
                    in_array(end($this->stack)->tagName,
array('foreignObject', 'desc', 'title'))
                ) ||
                (
                    // XSKETCHY
                    end($this->stack)->namespaceURI === self::NS_HTML
                ))
            ) || $token['type'] === HTML5_Tokenizer::ENDTAG
        ) {
            $this->processWithRulesFor($token,
$this->secondary_mode);
            /* If, after doing so, the insertion mode is still "in
foreign 
             * content", but there is no element in scope that has a
namespace 
             * other than the HTML namespace, switch the insertion mode to
the 
             * secondary insertion mode. */
            if ($this->mode === self::IN_FOREIGN_CONTENT) {
                $found = false;
                // this basically duplicates elementInScope()
                for ($i = count($this->stack) - 1; $i >= 0; $i--) {
                    $node = $this->stack[$i];
                    if ($node->namespaceURI !== self::NS_HTML) {
                        $found = true;
                        break;
                    } elseif (in_array($node->tagName,
array('table', 'html',
                    'applet', 'caption',
'td', 'th', 'button', 'marquee',
                    'object')) || ($node->tagName ===
'foreignObject' &&
                    $node->namespaceURI === self::NS_SVG)) {
                        break;
                    }
                }
                if (!$found) {
                    $this->mode = $this->secondary_mode;
                }
            }
        } elseif ($token['type'] === HTML5_Tokenizer::EOF || (
        $token['type'] === HTML5_Tokenizer::STARTTAG &&
        (in_array($token['name'], array('b',
"big", "blockquote", "body", "br", 
        "center", "code", "dd",
"div", "dl", "dt", "em",
"embed", "h1", "h2", 
        "h3", "h4", "h5", "h6",
"head", "hr", "i", "img",
"li", "listing", 
        "menu", "meta", "nobr",
"ol", "p", "pre", "ruby",
"s",  "small", 
        "span", "strong", "strike", 
"sub", "sup", "table", "tt",
"u", "ul", 
        "var")) || ($token['name'] === 'font'
&& ($this->getAttr($token, 'color') ||
        $this->getAttr($token, 'face') ||
$this->getAttr($token, 'size')))))) {
            // XERROR: parse error
            do {
                $node = array_pop($this->stack);
            } while ($node->namespaceURI !== self::NS_HTML);
            $this->stack[] = $node;
            $this->mode = $this->secondary_mode;
            $this->emitToken($token);
        } elseif ($token['type'] === HTML5_Tokenizer::STARTTAG) {
            static $svg_lookup = array(
                'altglyph' => 'altGlyph',
                'altglyphdef' => 'altGlyphDef',
                'altglyphitem' => 'altGlyphItem',
                'animatecolor' => 'animateColor',
                'animatemotion' => 'animateMotion',
                'animatetransform' =>
'animateTransform',
                'clippath' => 'clipPath',
                'feblend' => 'feBlend',
                'fecolormatrix' => 'feColorMatrix',
                'fecomponenttransfer' =>
'feComponentTransfer',
                'fecomposite' => 'feComposite',
                'feconvolvematrix' =>
'feConvolveMatrix',
                'fediffuselighting' =>
'feDiffuseLighting',
                'fedisplacementmap' =>
'feDisplacementMap',
                'fedistantlight' =>
'feDistantLight',
                'feflood' => 'feFlood',
                'fefunca' => 'feFuncA',
                'fefuncb' => 'feFuncB',
                'fefuncg' => 'feFuncG',
                'fefuncr' => 'feFuncR',
                'fegaussianblur' =>
'feGaussianBlur',
                'feimage' => 'feImage',
                'femerge' => 'feMerge',
                'femergenode' => 'feMergeNode',
                'femorphology' => 'feMorphology',
                'feoffset' => 'feOffset',
                'fepointlight' => 'fePointLight',
                'fespecularlighting' =>
'feSpecularLighting',
                'fespotlight' => 'feSpotLight',
                'fetile' => 'feTile',
                'feturbulence' => 'feTurbulence',
                'foreignobject' => 'foreignObject',
                'glyphref' => 'glyphRef',
                'lineargradient' =>
'linearGradient',
                'radialgradient' =>
'radialGradient',
                'textpath' => 'textPath',
            );
            $current = end($this->stack);
            if ($current->namespaceURI === self::NS_MATHML) {
                $token = $this->adjustMathMLAttributes($token);
            }
            if ($current->namespaceURI === self::NS_SVG &&
            isset($svg_lookup[$token['name']])) {
                $token['name'] =
$svg_lookup[$token['name']];
            }
            if ($current->namespaceURI === self::NS_SVG) {
                $token = $this->adjustSVGAttributes($token);
            }
            $token = $this->adjustForeignAttributes($token);
            $this->insertForeignElement($token,
$current->namespaceURI);
            if (isset($token['self-closing'])) {
                array_pop($this->stack);
                // XERROR: acknowledge self-closing flag
            }
        }
    break;

    case self::AFTER_BODY:
        /* Handle the token as follows: */

        /* A character token that is one of one of U+0009 CHARACTER
TABULATION,
        U+000A LINE FEED (LF), U+000B LINE TABULATION, U+000C FORM FEED
(FF),
        or U+0020 SPACE */
        if($token['type'] === HTML5_Tokenizer::SPACECHARACTER) {
            /* Process the token as it would be processed if the insertion
mode
            was "in body". */
            $this->processWithRulesFor($token, self::IN_BODY);

        /* A comment token */
        } elseif($token['type'] === HTML5_Tokenizer::COMMENT) {
            /* Append a Comment node to the first element in the stack of
open
            elements (the html element), with the data attribute set to the
            data given in the comment token. */
            $comment =
$this->dom->createComment($token['data']);
            $this->stack[0]->appendChild($comment);

        } elseif($token['type'] === HTML5_Tokenizer::DOCTYPE) {
            // parse error

        } elseif($token['type'] === HTML5_Tokenizer::STARTTAG
&& $token['name'] === 'html') {
            $this->processWithRulesFor($token, self::IN_BODY);

        /* An end tag with the tag name "html" */
        } elseif($token['type'] === HTML5_Tokenizer::ENDTAG
&& $token['name'] === 'html') {
            /*     If the parser was originally created as part of the HTML
             *     fragment parsing algorithm, this is a parse error;
ignore
             *     the token. (fragment case) */
            $this->ignored = true;
            // XERROR: implement this

            $this->mode = self::AFTER_AFTER_BODY;

        } elseif($token['type'] === HTML5_Tokenizer::EOF) {
            /* Stop parsing */

        /* Anything else */
        } else {
            /* Parse error. Set the insertion mode to "in body"
and reprocess
            the token. */
            $this->mode = self::IN_BODY;
            $this->emitToken($token);
        }
    break;

    case self::IN_FRAMESET:
        /* Handle the token as follows: */

        /* A character token that is one of one of U+0009 CHARACTER
TABULATION,
        U+000A LINE FEED (LF), U+000B LINE TABULATION, U+000C FORM FEED
(FF),
        U+000D CARRIAGE RETURN (CR), or U+0020 SPACE */
        if($token['type'] === HTML5_Tokenizer::SPACECHARACTER) {
            /* Append the character to the current node. */
            $this->insertText($token['data']);

        /* A comment token */
        } elseif($token['type'] === HTML5_Tokenizer::COMMENT) {
            /* Append a Comment node to the current node with the data
            attribute set to the data given in the comment token. */
            $this->insertComment($token['data']);

        } elseif($token['type'] === HTML5_Tokenizer::DOCTYPE) {
            // parse error

        /* A start tag with the tag name "frameset" */
        } elseif($token['type'] === HTML5_Tokenizer::STARTTAG
&&
        $token['name'] === 'frameset') {
            $this->insertElement($token);

        /* An end tag with the tag name "frameset" */
        } elseif($token['type'] === HTML5_Tokenizer::ENDTAG
&&
        $token['name'] === 'frameset') {
            /* If the current node is the root html element, then this is a
            parse error; ignore the token. (fragment case) */
            if(end($this->stack)->tagName === 'html') {
                $this->ignored = true;
                // Parse error

            } else {
                /* Otherwise, pop the current node from the stack of open
                elements. */
                array_pop($this->stack);

                /* If the parser was not originally created as part of the
HTML 
                 * fragment parsing algorithm  (fragment case), and the
current 
                 * node is no longer a frameset element, then switch the 
                 * insertion mode to "after frameset". */
                $this->mode = self::AFTER_FRAMESET;
            }

        /* A start tag with the tag name "frame" */
        } elseif($token['type'] === HTML5_Tokenizer::STARTTAG
&&
        $token['name'] === 'frame') {
            /* Insert an HTML element for the token. */
            $this->insertElement($token);

            /* Immediately pop the current node off the stack of open
elements. */
            array_pop($this->stack);

            // XERROR: Acknowledge the token's self-closing flag, if
it is set.

        /* A start tag with the tag name "noframes" */
        } elseif($token['type'] === HTML5_Tokenizer::STARTTAG
&&
        $token['name'] === 'noframes') {
            /* Process the token using the rules for the "in
head" insertion mode. */
            $this->processwithRulesFor($token, self::IN_HEAD);

        } elseif($token['type'] === HTML5_Tokenizer::EOF) {
            // XERROR: If the current node is not the root html element,
then this is a parse error.
            /* Stop parsing */
        /* Anything else */
        } else {
            /* Parse error. Ignore the token. */
            $this->ignored = true;
        }
    break;

    case self::AFTER_FRAMESET:
        /* Handle the token as follows: */

        /* A character token that is one of one of U+0009 CHARACTER
TABULATION,
        U+000A LINE FEED (LF), U+000B LINE TABULATION, U+000C FORM FEED
(FF),
        U+000D CARRIAGE RETURN (CR), or U+0020 SPACE */
        if($token['type'] === HTML5_Tokenizer::SPACECHARACTER) {
            /* Append the character to the current node. */
            $this->insertText($token['data']);

        /* A comment token */
        } elseif($token['type'] === HTML5_Tokenizer::COMMENT) {
            /* Append a Comment node to the current node with the data
            attribute set to the data given in the comment token. */
            $this->insertComment($token['data']);

        } elseif($token['type'] === HTML5_Tokenizer::DOCTYPE) {
            // parse error

        } elseif($token['type'] === HTML5_Tokenizer::STARTTAG
&& $token['name'] === 'html') {
            $this->processWithRulesFor($token, self::IN_BODY);

        /* An end tag with the tag name "html" */
        } elseif($token['type'] === HTML5_Tokenizer::ENDTAG
&&
        $token['name'] === 'html') {
            $this->mode = self::AFTER_AFTER_FRAMESET;

        /* A start tag with the tag name "noframes" */
        } elseif($token['type'] === HTML5_Tokenizer::STARTTAG
&&
        $token['name'] === 'noframes') {
            $this->processWithRulesFor($token, self::IN_HEAD);

        } elseif($token['type'] === HTML5_Tokenizer::EOF) {
            /* Stop parsing */

        /* Anything else */
        } else {
            /* Parse error. Ignore the token. */
            $this->ignored = true;
        }
    break;

    case self::AFTER_AFTER_BODY:
        /* A comment token */
        if($token['type'] === HTML5_Tokenizer::COMMENT) {
            /* Append a Comment node to the Document object with the data
            attribute set to the data given in the comment token. */
            $comment =
$this->dom->createComment($token['data']);
            $this->dom->appendChild($comment);

        } elseif($token['type'] === HTML5_Tokenizer::DOCTYPE ||
        $token['type'] === HTML5_Tokenizer::SPACECHARACTER ||
        ($token['type'] === HTML5_Tokenizer::STARTTAG &&
$token['name'] === 'html')) {
            $this->processWithRulesFor($token, self::IN_BODY);

        /* An end-of-file token */
        } elseif($token['type'] === HTML5_Tokenizer::EOF) {
            /* OMG DONE!! */
        } else {
            // parse error
            $this->mode = self::IN_BODY;
            $this->emitToken($token);
        }
    break;

    case self::AFTER_AFTER_FRAMESET:
        /* A comment token */
        if($token['type'] === HTML5_Tokenizer::COMMENT) {
            /* Append a Comment node to the Document object with the data
            attribute set to the data given in the comment token. */
            $comment =
$this->dom->createComment($token['data']);
            $this->dom->appendChild($comment);

        } elseif($token['type'] === HTML5_Tokenizer::DOCTYPE ||
        $token['type'] === HTML5_Tokenizer::SPACECHARACTER ||
        ($token['type'] === HTML5_Tokenizer::STARTTAG &&
$token['name'] === 'html')) {
            $this->processWithRulesFor($token, self::IN_BODY);

        /* An end-of-file token */
        } elseif($token['type'] === HTML5_Tokenizer::EOF) {
            /* OMG DONE!! */
        } elseif($token['type'] === HTML5_Tokenizer::STARTTAG
&& $token['name'] === 'nofrmaes') {
            $this->processWithRulesFor($token, self::IN_HEAD);
        } else {
            // parse error
        }
    break;
    }
        // end funky indenting
        }

    private function insertElement($token, $append = true) {
        $el = $this->dom->createElementNS(self::NS_HTML,
$token['name']);

        if (!empty($token['attr'])) {
            foreach($token['attr'] as $attr) {
                if(!$el->hasAttribute($attr['name'])) {
                    $el->setAttribute($attr['name'],
$attr['value']);
                }
            }
        }
        if ($append) {
            $this->appendToRealParent($el);
            $this->stack[] = $el;
        }

        return $el;
    }

    private function insertText($data) {
        if ($data === '') return;
        if ($this->ignore_lf_token) {
            if ($data[0] === "\n") {
                $data = substr($data, 1);
                if ($data === false) return;
            }
        }
        $text = $this->dom->createTextNode($data);
        $this->appendToRealParent($text);
    }

    private function insertComment($data) {
        $comment = $this->dom->createComment($data);
        $this->appendToRealParent($comment);
    }

    private function appendToRealParent($node) {
        // this is only for the foster_parent case
        /* If the current node is a table, tbody, tfoot, thead, or tr
        element, then, whenever a node would be inserted into the current
        node, it must instead be inserted into the foster parent element.
*/
        if(!$this->foster_parent ||
!in_array(end($this->stack)->tagName,
        array('table', 'tbody', 'tfoot',
'thead', 'tr'))) {
            end($this->stack)->appendChild($node);
        } else {
            $this->fosterParent($node);
        }
    }

    private function elementInScope($el, $table = false) {
        if(is_array($el)) {
            foreach($el as $element) {
                if($this->elementInScope($element, $table)) {
                    return true;
                }
            }

            return false;
        }

        $leng = count($this->stack);

        for($n = 0; $n < $leng; $n++) {
            /* 1. Initialise node to be the current node (the bottommost
node of
            the stack). */
            $node = $this->stack[$leng - 1 - $n];

            if($node->tagName === $el) {
                /* 2. If node is the target node, terminate in a match
state. */
                return true;

            // these are the common states for "in scope" and
"in table scope"
            } elseif($node->tagName === 'table' ||
$node->tagName === 'html') {
                return false;

            // these are only valid for "in scope"
            } elseif(!$table &&
            (in_array($node->tagName, array('applet',
'caption', 'td',
                'th', 'button', 'marquee',
'object')) ||
                $node->tagName === 'foreignObject' &&
$node->namespaceURI === self::NS_SVG)) {
                return false;
            }

            /* Otherwise, set node to the previous entry in the stack of
open
            elements and return to step 2. (This will never fail, since the
loop
            will always terminate in the previous step if the top of the
stack
            is reached.) */
        }
    }

    private function reconstructActiveFormattingElements() {
        /* 1. If there are no entries in the list of active formatting
elements,
        then there is nothing to reconstruct; stop this algorithm. */
        $formatting_elements = count($this->a_formatting);

        if($formatting_elements === 0) {
            return false;
        }

        /* 3. Let entry be the last (most recently added) element in the
list
        of active formatting elements. */
        $entry = end($this->a_formatting);

        /* 2. If the last (most recently added) entry in the list of active
        formatting elements is a marker, or if it is an element that is in
the
        stack of open elements, then there is nothing to reconstruct; stop
this
        algorithm. */
        if($entry === self::MARKER || in_array($entry, $this->stack,
true)) {
            return false;
        }

        for($a = $formatting_elements - 1; $a >= 0; true) {
            /* 4. If there are no entries before entry in the list of
active
            formatting elements, then jump to step 8. */
            if($a === 0) {
                $step_seven = false;
                break;
            }

            /* 5. Let entry be the entry one earlier than entry in the list
of
            active formatting elements. */
            $a--;
            $entry = $this->a_formatting[$a];

            /* 6. If entry is neither a marker nor an element that is also
in
            thetack of open elements, go to step 4. */
            if($entry === self::MARKER || in_array($entry, $this->stack,
true)) {
                break;
            }
        }

        while(true) {
            /* 7. Let entry be the element one later than entry in the list
of
            active formatting elements. */
            if(isset($step_seven) && $step_seven === true) {
                $a++;
                $entry = $this->a_formatting[$a];
            }

            /* 8. Perform a shallow clone of the element entry to obtain
clone. */
            $clone = $entry->cloneNode();

            /* 9. Append clone to the current node and push it onto the
stack
            of open elements  so that it is the new current node. */
            $this->appendToRealParent($clone);
            $this->stack[] = $clone;

            /* 10. Replace the entry for entry in the list with an entry
for
            clone. */
            $this->a_formatting[$a] = $clone;

            /* 11. If the entry for clone in the list of active formatting
            elements is not the last entry in the list, return to step 7.
*/
            if(end($this->a_formatting) !== $clone) {
                $step_seven = true;
            } else {
                break;
            }
        }
    }

    private function clearTheActiveFormattingElementsUpToTheLastMarker() {
        /* When the steps below require the UA to clear the list of active
        formatting elements up to the last marker, the UA must perform the
        following steps: */

        while(true) {
            /* 1. Let entry be the last (most recently added) entry in the
list
            of active formatting elements. */
            $entry = end($this->a_formatting);

            /* 2. Remove entry from the list of active formatting elements.
*/
            array_pop($this->a_formatting);

            /* 3. If entry was a marker, then stop the algorithm at this
point.
            The list has been cleared up to the last marker. */
            if($entry === self::MARKER) {
                break;
            }
        }
    }

    private function generateImpliedEndTags($exclude = array()) {
        /* When the steps below require the UA to generate implied end
tags,
        then, if the current node is a dd element, a dt element, an li
element,
        a p element, a td element, a th  element, or a tr element, the UA
must
        act as if an end tag with the respective tag name had been seen and
        then generate implied end tags again. */
        $node = end($this->stack);
        $elements = array_diff(array('dd', 'dt',
'li', 'p', 'td', 'th',
'tr'), $exclude);

        while(in_array(end($this->stack)->tagName, $elements)) {
            array_pop($this->stack);
        }
    }

    private function getElementCategory($node) {
        if (!is_object($node)) debug_print_backtrace();
        $name = $node->tagName;
        if(in_array($name, $this->special))
            return self::SPECIAL;

        elseif(in_array($name, $this->scoping))
            return self::SCOPING;

        elseif(in_array($name, $this->formatting))
            return self::FORMATTING;

        else
            return self::PHRASING;
    }

    private function clearStackToTableContext($elements) {
        /* When the steps above require the UA to clear the stack back to a
        table context, it means that the UA must, while the current node is
not
        a table element or an html element, pop elements from the stack of
open
        elements. */
        while(true) {
            $name = end($this->stack)->tagName;

            if(in_array($name, $elements)) {
                break;
            } else {
                array_pop($this->stack);
            }
        }
    }

    private function resetInsertionMode($context = null) {
        /* 1. Let last be false. */
        $last = false;
        $leng = count($this->stack);

        for($n = $leng - 1; $n >= 0; $n--) {
            /* 2. Let node be the last node in the stack of open elements.
*/
            $node = $this->stack[$n];

            /* 3. If node is the first node in the stack of open elements,
then 
             * set last to true and set node to the context  element.
(fragment 
             * case) */
            if($this->stack[0]->isSameNode($node)) {
                $last = true;
                $node = $context;
            }

            /* 4. If node is a select element, then switch the insertion
mode to
            "in select" and abort these steps. (fragment case) */
            if($node->tagName === 'select') {
                $this->mode = self::IN_SELECT;
                break;

            /* 5. If node is a td or th element, then switch the insertion
mode
            to "in cell" and abort these steps. */
            } elseif($node->tagName === 'td' ||
$node->nodeName === 'th') {
                $this->mode = self::IN_CELL;
                break;

            /* 6. If node is a tr element, then switch the insertion mode
to
            "in    row" and abort these steps. */
            } elseif($node->tagName === 'tr') {
                $this->mode = self::IN_ROW;
                break;

            /* 7. If node is a tbody, thead, or tfoot element, then switch
the
            insertion mode to "in table body" and abort these
steps. */
            } elseif(in_array($node->tagName, array('tbody',
'thead', 'tfoot'))) {
                $this->mode = self::IN_TABLE_BODY;
                break;

            /* 8. If node is a caption element, then switch the insertion
mode
            to "in caption" and abort these steps. */
            } elseif($node->tagName === 'caption') {
                $this->mode = self::IN_CAPTION;
                break;

            /* 9. If node is a colgroup element, then switch the insertion
mode
            to "in column group" and abort these steps.
(innerHTML case) */
            } elseif($node->tagName === 'colgroup') {
                $this->mode = self::IN_COLUMN_GROUP;
                break;

            /* 10. If node is a table element, then switch the insertion
mode
            to "in table" and abort these steps. */
            } elseif($node->tagName === 'table') {
                $this->mode = self::IN_TABLE;
                break;

            /* 11. If node is an element from the MathML namespace or the
SVG 
             * namespace, then switch the insertion mode to "in
foreign 
             * content", let the secondary insertion mode be "in
body", and 
             * abort these steps. */
            } elseif($node->namespaceURI === self::NS_SVG ||
            $node->namespaceURI === self::NS_MATHML) {
                $this->mode = self::IN_FOREIGN_CONTENT;
                $this->secondary_mode = self::IN_BODY;
                break;

            /* 12. If node is a head element, then switch the insertion
mode
            to "in body" ("in body"! not "in
head"!) and abort these steps.
            (fragment case) */
            } elseif($node->tagName === 'head') {
                $this->mode = self::IN_BODY;
                break;

            /* 13. If node is a body element, then switch the insertion
mode to
            "in body" and abort these steps. */
            } elseif($node->tagName === 'body') {
                $this->mode = self::IN_BODY;
                break;

            /* 14. If node is a frameset element, then switch the insertion
            mode to "in frameset" and abort these steps.
(fragment case) */
            } elseif($node->tagName === 'frameset') {
                $this->mode = self::IN_FRAMESET;
                break;

            /* 15. If node is an html element, then: if the head element
            pointer is null, switch the insertion mode to "before
head",
            otherwise, switch the insertion mode to "after head".
In either
            case, abort these steps. (fragment case) */
            } elseif($node->tagName === 'html') {
                $this->mode = ($this->head_pointer === null)
                    ? self::BEFORE_HEAD
                    : self::AFTER_HEAD;

                break;

            /* 16. If last is true, then set the insertion mode to "in
body"
            and    abort these steps. (fragment case) */
            } elseif($last) {
                $this->mode = self::IN_BODY;
                break;
            }
        }
    }

    private function closeCell() {
        /* If the stack of open elements has a td or th element in table
scope,
        then act as if an end tag token with that tag name had been seen.
*/
        foreach(array('td', 'th') as $cell) {
            if($this->elementInScope($cell, true)) {
                $this->emitToken(array(
                    'name' => $cell,
                    'type' => HTML5_Tokenizer::ENDTAG
                ));

                break;
            }
        }
    }

    private function processWithRulesFor($token, $mode) {
        /* "using the rules for the m insertion mode", where m is
one of these
         * modes, the user agent must use the rules described under the m
         * insertion mode's section, but must leave the insertion mode
         * unchanged unless the rules in m themselves switch the insertion
mode
         * to a new value. */
        return $this->emitToken($token, $mode);
    }

    private function insertCDATAElement($token) {
        $this->insertElement($token);
        $this->original_mode = $this->mode;
        $this->mode = self::IN_CDATA_RCDATA;
        $this->content_model = HTML5_Tokenizer::CDATA;
    }

    private function insertRCDATAElement($token) {
        $this->insertElement($token);
        $this->original_mode = $this->mode;
        $this->mode = self::IN_CDATA_RCDATA;
        $this->content_model = HTML5_Tokenizer::RCDATA;
    }

    private function getAttr($token, $key) {
        if (!isset($token['attr'])) return false;
        $ret = false;
        foreach ($token['attr'] as $keypair) {
            if ($keypair['name'] === $key) $ret =
$keypair['value'];
        }
        return $ret;
    }

    private function getCurrentTable() {
        /* The current table is the last table  element in the stack of
open 
         * elements, if there is one. If there is no table element in the
stack 
         * of open elements (fragment case), then the current table is the 
         * first element in the stack of open elements (the html element).
*/
        for ($i = count($this->stack) - 1; $i >= 0; $i--) {
            if ($this->stack[$i]->tagName === 'table') {
                return $this->stack[$i];
            }
        }
        return $this->stack[0];
    }

    private function getFosterParent() {
        /* The foster parent element is the parent element of the last
        table element in the stack of open elements, if there is a
        table element and it has such a parent element. If there is no
        table element in the stack of open elements (innerHTML case),
        then the foster parent element is the first element in the
        stack of open elements (the html  element). Otherwise, if there
        is a table element in the stack of open elements, but the last
        table element in the stack of open elements has no parent, or
        its parent node is not an element, then the foster parent
        element is the element before the last table element in the
        stack of open elements. */
        for($n = count($this->stack) - 1; $n >= 0; $n--) {
            if($this->stack[$n]->tagName === 'table') {
                $table = $this->stack[$n];
                break;
            }
        }

        if(isset($table) && $table->parentNode !== null) {
            return $table->parentNode;

        } elseif(!isset($table)) {
            return $this->stack[0];

        } elseif(isset($table) && ($table->parentNode === null
||
        $table->parentNode->nodeType !== XML_ELEMENT_NODE)) {
            return $this->stack[$n - 1];
        }
    }

    public function fosterParent($node) {
        $foster_parent = $this->getFosterParent();
        $table = $this->getCurrentTable(); // almost equivalent to last
table element, except it can be html
        /* When a node node is to be foster parented, the node node  must
be 
         * inserted into the foster parent element, and the current table
must 
         * be marked as tainted. (Once the current table has been tainted, 
         * whitespace characters are inserted into the foster parent
element 
         * instead of the current node.) */
        $table->tainted = true;
        /* If the foster parent element is the parent element of the last
table 
         * element in the stack of open elements, then node must be
inserted 
         * immediately before the last table element in the stack of open 
         * elements in the foster parent element; otherwise, node must be 
         * appended to the foster parent element. */
        if ($table->tagName === 'table' &&
$table->parentNode->isSameNode($foster_parent)) {
            $foster_parent->insertBefore($node, $table);
        } else {
            $foster_parent->appendChild($node);
        }
    }

    /**
     * For debugging, prints the stack
     */
    private function printStack() {
        $names = array();
        foreach ($this->stack as $i => $element) {
            $names[] = $element->tagName;
        }
        echo "  -> stack [" . implode(', ', $names)
. "]\n";
    }

    /**
     * For debugging, prints active formatting elements
     */
    private function printActiveFormattingElements() {
        if (!$this->a_formatting) return;
        $names = array();
        foreach ($this->a_formatting as $node) {
            if ($node === self::MARKER) $names[] = 'MARKER';
            else $names[] = $node->tagName;
        }
        echo "  -> active formatting [" . implode(',
', $names) . "]\n";
    }

    public function currentTableIsTainted() {
        return !empty($this->getCurrentTable()->tainted);
    }

    /**
     * Sets up the tree constructor for building a fragment.
     */
    public function setupContext($context = null) {
        $this->fragment = true;
        if ($context) {
            $context = $this->dom->createElementNS(self::NS_HTML,
$context);
            /* 4.1. Set the HTML parser's tokenization  stage's
content model
             * flag according to the context element, as follows: */
            switch ($context->tagName) {
            case 'title': case 'textarea':
                $this->content_model = HTML5_Tokenizer::RCDATA;
                break;
            case 'style': case 'script': case
'xmp': case 'iframe':
            case 'noembed': case 'noframes':
                $this->content_model = HTML5_Tokenizer::CDATA;
                break;
            case 'noscript':
                // XSCRIPT: assuming scripting is enabled
                $this->content_model = HTML5_Tokenizer::CDATA;
                break;
            case 'plaintext':
                $this->content_model = HTML5_Tokenizer::PLAINTEXT;
                break;
            }
            /* 4.2. Let root be a new html element with no attributes. */
            $root = $this->dom->createElementNS(self::NS_HTML,
'html');
            $this->root = $root;
            /* 4.3 Append the element root to the Document node created
above. */
            $this->dom->appendChild($root);
            /* 4.4 Set up the parser's stack of open elements so that
it 
             * contains just the single element root. */
            $this->stack = array($root);
            /* 4.5 Reset the parser's insertion mode appropriately. */
            $this->resetInsertionMode($context);
            /* 4.6 Set the parser's form element pointer  to the
nearest node 
             * to the context element that is a form element (going
straight up 
             * the ancestor chain, and including the element itself, if it
is a 
             * form element), or, if there is no such form element, to
null. */
            $node = $context;
            do {
                if ($node->tagName === 'form') {
                    $this->form_pointer = $node;
                    break;
                }
            } while ($node = $node->parentNode);
        }
    }

    public function adjustMathMLAttributes($token) {
        foreach ($token['attr'] as &$kp) {
            if ($kp['name'] === 'definitionurl') {
                $kp['name'] = 'definitionURL';
            }
        }
        return $token;
    }

    public function adjustSVGAttributes($token) {
        static $lookup = array(
            'attributename' => 'attributeName',
            'attributetype' => 'attributeType',
            'basefrequency' => 'baseFrequency',
            'baseprofile' => 'baseProfile',
            'calcmode' => 'calcMode',
            'clippathunits' => 'clipPathUnits',
            'contentscripttype' =>
'contentScriptType',
            'contentstyletype' =>
'contentStyleType',
            'diffuseconstant' => 'diffuseConstant',
            'edgemode' => 'edgeMode',
            'externalresourcesrequired' =>
'externalResourcesRequired',
            'filterres' => 'filterRes',
            'filterunits' => 'filterUnits',
            'glyphref' => 'glyphRef',
            'gradienttransform' =>
'gradientTransform',
            'gradientunits' => 'gradientUnits',
            'kernelmatrix' => 'kernelMatrix',
            'kernelunitlength' =>
'kernelUnitLength',
            'keypoints' => 'keyPoints',
            'keysplines' => 'keySplines',
            'keytimes' => 'keyTimes',
            'lengthadjust' => 'lengthAdjust',
            'limitingconeangle' =>
'limitingConeAngle',
            'markerheight' => 'markerHeight',
            'markerunits' => 'markerUnits',
            'markerwidth' => 'markerWidth',
            'maskcontentunits' =>
'maskContentUnits',
            'maskunits' => 'maskUnits',
            'numoctaves' => 'numOctaves',
            'pathlength' => 'pathLength',
            'patterncontentunits' =>
'patternContentUnits',
            'patterntransform' =>
'patternTransform',
            'patternunits' => 'patternUnits',
            'pointsatx' => 'pointsAtX',
            'pointsaty' => 'pointsAtY',
            'pointsatz' => 'pointsAtZ',
            'preservealpha' => 'preserveAlpha',
            'preserveaspectratio' =>
'preserveAspectRatio',
            'primitiveunits' => 'primitiveUnits',
            'refx' => 'refX',
            'refy' => 'refY',
            'repeatcount' => 'repeatCount',
            'repeatdur' => 'repeatDur',
            'requiredextensions' =>
'requiredExtensions',
            'requiredfeatures' =>
'requiredFeatures',
            'specularconstant' =>
'specularConstant',
            'specularexponent' =>
'specularExponent',
            'spreadmethod' => 'spreadMethod',
            'startoffset' => 'startOffset',
            'stddeviation' => 'stdDeviation',
            'stitchtiles' => 'stitchTiles',
            'surfacescale' => 'surfaceScale',
            'systemlanguage' => 'systemLanguage',
            'tablevalues' => 'tableValues',
            'targetx' => 'targetX',
            'targety' => 'targetY',
            'textlength' => 'textLength',
            'viewbox' => 'viewBox',
            'viewtarget' => 'viewTarget',
            'xchannelselector' =>
'xChannelSelector',
            'ychannelselector' =>
'yChannelSelector',
            'zoomandpan' => 'zoomAndPan',
        );
        foreach ($token['attr'] as &$kp) {
            if (isset($lookup[$kp['name']])) {
                $kp['name'] = $lookup[$kp['name']];
            }
        }
        return $token;
    }

    public function adjustForeignAttributes($token) {
        static $lookup = array(
            'xlink:actuate' => array('xlink',
'actuate', self::NS_XLINK),
            'xlink:arcrole' => array('xlink',
'arcrole', self::NS_XLINK),
            'xlink:href' => array('xlink',
'href', self::NS_XLINK),
            'xlink:role' => array('xlink',
'role', self::NS_XLINK),
            'xlink:show' => array('xlink',
'show', self::NS_XLINK),
            'xlink:title' => array('xlink',
'title', self::NS_XLINK),
            'xlink:type' => array('xlink',
'type', self::NS_XLINK),
            'xml:base' => array('xml',
'base', self::NS_XML),
            'xml:lang' => array('xml',
'lang', self::NS_XML),
            'xml:space' => array('xml',
'space', self::NS_XML),
            'xmlns' => array(null, 'xmlns',
self::NS_XMLNS),
            'xmlns:xlink' => array('xmlns',
'xlink', self::NS_XMLNS),
        );
        foreach ($token['attr'] as &$kp) {
            if (isset($lookup[$kp['name']])) {
                $kp['name'] = $lookup[$kp['name']];
            }
        }
        return $token;
    }

    public function insertForeignElement($token, $namespaceURI) {
        $el = $this->dom->createElementNS($namespaceURI,
$token['name']);
        if (!empty($token['attr'])) {
            foreach ($token['attr'] as $kp) {
                $attr = $kp['name'];
                if (is_array($attr)) {
                    $ns = $attr[2];
                    $attr = $attr[1];
                } else {
                    $ns = self::NS_HTML;
                }
                if (!$el->hasAttributeNS($ns, $attr)) {
                    // XSKETCHY: work around godawful libxml bug
                    if ($ns === self::NS_XLINK) {
                        $el->setAttribute('xlink:'.$attr,
$kp['value']);
                    } elseif ($ns === self::NS_HTML) {
                        // Another godawful libxml bug
                        $el->setAttribute($attr,
$kp['value']);
                    } else {
                        $el->setAttributeNS($ns, $attr,
$kp['value']);
                    }
                }
            }
        }
        $this->appendToRealParent($el);
        $this->stack[] = $el;
        // XERROR: see below
        /* If the newly created element has an xmlns attribute in the XMLNS

         * namespace  whose value is not exactly the same as the
element's 
         * namespace, that is a parse error. Similarly, if the newly
created 
         * element has an xmlns:xlink attribute in the XMLNS namespace
whose 
         * value is not the XLink Namespace, that is a parse error. */
    }

    public function save() {
        $this->dom->normalize();
        if (!$this->fragment) {
            return $this->dom;
        } else {
            if ($this->root) {
                return $this->root->childNodes;
            } else {
                return $this->dom->childNodes;
            }
        }
    }
}

libraries/index.html000064400000000037151160675320010523
0ustar00<!DOCTYPE html><title></title>