xie

package module
v0.0.0-...-ec28996 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2022 License: MIT Imports: 31 Imported by: 1

README

谢语言(Xielang)

 

介绍

 

谢语言(英文名称为:Xielang,官网 xie.topget.org)是一门开源、免费的解释型编程语言(也称作脚本语言),最大的特色包括:跨平台;跨语言(目前支持Go语言、JavaScript语言等,即将支持Java语言)可嵌入(即可在这些语言中调用);结合了汇编语言和高级语言的优点;支持全中文编程(包括提示信息),语法简单易懂;单文件无依赖;可编译成单独可执行文件发布等。

谢语言支持各种基本的语法元素和结构,包括变量、条件分支、循环、函数、递归函数调用、多线程等,支持作为嵌入型语言在不同语言中调用,也支持独立运行(单文件的可执行程序),还支持作为后台微服务运行。同时,谢语言也提供一个命令行交互式编程环境,可用于一般的测试。

谢语言的Go语言版本,单文件即可执行,包含了脚本执行功能(无需安装其他依赖环境)、交互式命令行环境和微服务器模式,支持图形界面编程(仅需附加一个动态链接库文件)。

谢语言的JavaScript版本(官网xie.topget.org),使用时仅需在网页中引用两个JavaScript文件,即可使用谢语言的功能,并且可以与JavaScript良好互通,充分发挥JavaScript中既有功能以及丰富的第三方库的优势。

 

语言特点

 

谢语言特点比较鲜明:

  • 语法形式追求极简,类似命令行(Shell脚本),以追求解析的速度;
  • 语法接近于汇编语言,包括一些语言的基础设施(例如堆栈等)和语法结构(条件分支与无条件跳转指令等);
  • 提供很多封装好的、功能丰富的内置指令,因而又使得语言接近于高级语言;
  • 支持自定义函数;
  • 支持动态加载函数;
  • 支持动态加载模块代码并执行;
  • 支持并发编程;
  • 支持地址引用,类似指针但受一定的保护;
  • 支持编译成单独的可执行文件以便发布或者代码保护;
  • 由于极简的语法结构和超轻量级的脚本运行引擎,因此可以很方便地移植到任意语言中,目前支持的Go、Java、JavaScript就是三种特点很不相同的语言,但都可以轻松实现谢语言的支持;

下面是谢语言常见的欢迎程序代码:

输出行 `欢迎来到谢语言的世界!`

命令行上用下面的命令执行后可得结果如下:

D:\tmp>xie 欢迎.谢
欢迎来到谢语言的世界!

D:\tmp>


 

下面是常见用于性能测试的斐波那契数列生成代码(斐波那契.谢),使用了递归函数调用:

入栈 整数 35

调用 :斐波那契

输出行 $出栈

终止

:斐波那契
    声明变量 $数字1
 
    出栈 $数字1

    小于 $入栈 $数字1 #i2
  
    是则 $出栈 :标号1

    :否则
        减一 $数字1
        入栈 整数 $数字1
        调用 :斐波那契


        减一 $数字1
        入栈 整数 $数字1
        调用 :斐波那契

        加 $入栈

        返回

    :标号1
        入栈 $数字1
        返回



将计算出斐波那契数列第35位数字,如下所示:

D:\tmp>xie 斐波那契.谢
9227465

D:\tmp>

 

语言设计构思

 

谢语言的出现,最初是因为希望有一个能够嵌入在各种语言(初期考虑的语言主要是Go、Java、JavaScript、C/C++、C#、Switch等)内的轻量级脚本语言,能够支持在后端微服务中热加载修改的代码,要求语言的语法简单而又速度相对较快,但是能够充分发挥宿主语言的丰富库函数优势。后来逐渐发现谢语言也具备可以成为一门全栈语言的潜力,希望它最终能够达到。另外,考虑到目前还没有一个开源免费并支持全栈编程的全中文编程语言,也希望谢语言能够作为填补空缺的一员。(* 多说一句,编程中完全不用到英文是不太可能的,希望尽量减少英文不好开发者的难度吧。为满足喜欢输入方便的开发者,谢语言也同时支持英语编程。)

借鉴汇编语言的思路,谢语言引入了堆栈等概念,也因此在某些功能的实现上会比一般的高级语言显得复杂一些,但从速度上(包括语法解析的速度)考虑,还是值得的。但要求开发者对堆栈等概念做一些简单的了解。

设计的原则包括:

  • 尽量减少语法分析的成本,因此拒绝复杂的语法结构,基本都以单行指令为主,只有多行字符串会占超过一行;
  • 不做标准库,只做内置指令集,保证语言短小精悍,功能能够支持一般而言80%以上的开发需求(其余功能可以从源码自行扩充);
  • 在精简指令集基础上,支持函数和外部函数,支持外部模块的引入,以保证功能扩充的可能性;
  • 要支持并发编程;
  • 面向对象编程属于较低的优先级,甚至可以不实现;

谢语言还在积极开发中,欢迎提出各种建议。

 

安装教程

 

  1. 直接在官网下载最新的谢语言可执行文件或压缩包,然后将其放在某个目录下,最好在系统路径之内,如果下载的是压缩包则先将其解压。然后即可使用;
  2. 谢语言代码执行的一般方法是在命令行执行(确保谢语言的主程序在路径中,否则需要加上路径):
xie hello.xie
  1. 谢语言的代码文件一般以“.xie”或“.谢”作为扩展名,但这并不是强制的。注意,由于操作系统的限制,扩展名前的“.”只能是英文的小数点;
  2. 谢语言的代码文件内部都是纯文本的格式,并且要求使用UTF-8编码;另外,为便于跨平台使用,不建议使用BOM头;
  3. 安装后可以使用下述命令行验证是否安装成功,并且路径设置正常:
xie -example hello.xie

如果看到类似下面的输出,说明安装成功,并且开发环境准备就绪。

D:\tmpx>xie -example hello.xie
Hello world!

D:\tmpx>

  1. 直接不带任何参数运行谢语言主程序,将会进入谢语言的交互式命令行环境,在这里可以直接输入一行一行的命令,然后可以立即得到反馈结果:
C:\Users\Administrator# xie
> version
> pln $pop
0.0.1
>       

交互式命令行程序可以用于快速测试一些语句,或进行简单的编程获取结果。

  1. 另外,可以用-version参数查看当前谢语言的版本号:
D:\tmpx>xie -version
谢语言 版本0.0.1

D:\tmpx>

在交互式命令行环境中,可以用version指令查看版本:

> version $pln
0.2.3
> 

 

代码编辑器

 

  1. 谢语言的代码编辑器推荐Visual Studio Code或Notepad 3,都是免费的编辑器;也可以使用任何支持UTF-8编码的文本编辑器;
  2. 语法高亮方案建议选择Shell Script(Shell脚本即可),也可以选用Go、C语言等的语法高亮方案,目前还没有专属的;
  3. 谢语言内置命令行形式的行编辑器,简单的代码也可以用它编写;

 

关于中文编程和英语编程

 

  1. 谢语言支持全中文编程,包括关键字、命令(指令)、函数、变量、标号等均可以使用中文,前面的例子中已经有所演示;
  2. 为输入方便,谢语言也支持英文编程,所有内置函数同时具有中文和英文两种写法,由开发者自行选择使用哪个,具体参考相关文档;
  3. 代码文件名一般来说,中文代码使用“.谢”作为扩展名,英文代码使用“.xie”作为扩展名;
  4. 下面的讲解与示例中,为了简洁起见,一般使用英文方式;
  5. 前例中的斐波那契数列代码,如果用英文编写,将是类似这样的(fib.xie):
push int 35
call :fib
pln $pop

exit

:fib
    var $n1
 
    pop $n1

    < $push $n1 #i2

    if $pop :label1

    :else
        dec $n1
        push int $n1
        call :fib

        dec $n1
        push int $n1
        call :fib

        add $push

        ret

    :label1
        push $n1
        ret


本例子代码是fib.xie

 

运行和查看例子代码

 

谢语言提供各种例子代码,可以在命令行中加上-example参数直接运行,例如上述斐波那契数列代码中文版就可以直接用下面的命令行运行:

xie -example 斐波那契.谢

运行后结果类似:


D:\tmpx>xie -example 斐波那契.谢
9227465

D:\tmpx>

如果需要查看例子代码,可以再加上-view参数,就可以看到:

D:\tmpx>xie -example -view 斐波那契.谢
入栈 整数 35

调用 :斐波那契

输出行 $出栈

……此处省略中间部分

    :标号1
        入栈 $数字1     
        返回



D:\tmpx>

当然,也可以用“>”等转向符将其输出到其他文件中:

xie -example -view 斐波那契.谢 > d:\test\new.xie

因此,如果我们后面说道:“请参看例子代码test1.xie”,那么就意味着可以通过

xie -example -view test1.xie

这样的命令行来参看所述的例子代码。

 

快速入门及语言要点

 

- 基本语法

 

  • 作为一门脚本语言,我们设计的初衷是尽可能降低解析语法的开销,因此谢语言选用了类似命令行的语法:一般命令(或者也称作指令或语句)都是一行,单条指令中的元素之间用空格作为分隔,第一个元素叫做指令名,后面的都叫做指令参数。也就是说,每条指令都由一个指令名和若干个指令参数组成,当然,有些指令也可以没有任何参数。例如:
  assign $a "abc"

其中的assign是指令名,后面的$a和"abc"都是指令参数。本条指令将把字符串"abc"赋值给变量a(注意不包括引号)。

 

  • 唯一不是一行的情况是多行字符串,谢语言中用成对的反引号字符“`”来包起多行字符串(实际上也可以包起非多行的字符串,会在一定的情况下有用),例如:
  assign $a `abc
  123`
这将把变量a赋值为多行字符串"abc\n123";

&nbsp;
  • 命令头尾的空白都将被忽略,因此可以使用适当的缩进来提高代码的可读性。如果参数等值中含有不想省略的空格字符,需要用双引号或反引号括起整个字符串;
  • 所有代码中的指令名、变量、字符串、标号等都是大小写敏感的,也就是说如果仅有大小写不同的两个变量名,将被认为指的是不同的变量。

 

- 代码注释

 

谢语言中仅支持行注释,可以用“//”或“#”来引导注释,支持“#”是为了在文本编辑器中选用“Shell脚本”的语法高亮方案时,可以使用Ctrl+/组合键来切换改行是否注释。

 

- 变量声明(定义)

 

谢语言使用var命令(中文命令为“声明变量”)进行变量声明:

var $a

这将定义一个名字为a的变量,谢语言中,变量名前都要加“$”字符以示区别。定义变量时可以加第二个参数指定变量类型,此时其中的值为该类型的空值;不指定类型时,变量默认为nil(无类型的空值)如下所示:

  C:\Users\Administrator# xie
  > var $a
  > pln $a
  <nil>
  >        

注意,pln命令类似于一般语言中的println函数,会将后面的变量和数值一个个输出到命令行,末尾再输出一个换行符。可以看到变量a中的值确实是nil。

 

如果变量未定义就使用,会显示“未定义”字样,例如,下面的代码:

  pln "a:" $a

  var $a

  pln "a:" $a

运行后会显示如下结果:

  a: 未定义
  a: <nil>

因为第一次输出时,变量a尚未被定义。

 

- 数值与类型

 

  • 谢语言中,常用的基本类型包括:bool/布尔、int/整数、float/浮点数(即小数)、str/字符串,其中整数和浮点数均为64位,还有byte/字节、rune/如痕(用于Unicode字符)。复杂类型在后面再介绍。使用plo命令,可以看到某个变量的类型和数值:
  C:\Users\Administrator# xie
  > var $a float
  > plo $a
  (float64)0
  > 

可以看出,变量a被定义为float64即64位浮点数,并初始化为值0。

谢语言中的变量的类型可以任意改变,意味着谢语言是一门“弱类型”的语言,而不像Go、C、Java等“强类型”的语言那样,变量一旦声明后只能改变数值而不能改变类型。

 

- 给变量赋值

 

谢语言中给变量赋值用的是assign/=/赋值(即选用assign、=或中文“赋值”都可以表示这条命令,后面都会用类似的写法)命令:

  assign $a 123

这条命令将把变量a赋值为123,注意,这是字符串“123”,而不是数字123,因为谢语言中默认数值都是字符串类型。

 

- 指定赋值的类型

 

如果想把变量a赋值为一个整数,可以选用下面两种方法之一:

  assign $a #i123
  assign $a int 123

第一种方法是谢语言中对数值指定类型的方法,在数值前加上“#”号开头带一个指定的英语字母,可以限定数值的类型,对于基本类型,“#i”表示整数,“#f”表示浮点数,“#b”表示布尔数值(后跟true或false),“#s”表示字符串,“#y”表示字节,“#r”表示如痕。

 

第二种方法是在数值前再加一个指定数据类型的参数,可以是“int”、“float”、“bool”、“str”、“byte”、“rune”等,分别对应中文的“整数”、“小数”、“布尔”、“字符串”、“字节”、“如痕”。

看下下面的输出,可以看到两种方法得到的结果是一样的:

  D:\tmpx# xie
  > assign $a #i123
  > plo $a
  (int)123
  > assign $a int 123
  > plo $a
  (int)123
  > 赋值 $变量1 整数 123
  > 输出值类型 $变量1     
  (int)123
  >      

 

- 字符串赋值

 

由于谢语言使用空格作为命令与参数之间的分隔符,因此带有空格的字符串必须做特殊处理,使用双引号或反引号括起来(不含空格的字符串可以不括起来直接使用),反引号还可以括起多行字符串(含有换行符“\n”的字符串),双引号中可以带有\n、\t等转义字符,反引号中则不进行转义。另外,由于使用了反引号,谢语言代码中不应出现其他用途的反引号,如果遇上确需使用的地方,需要用全局变量backQuoteG或者转义字符“\u0096”来代替。

 

- 各种赋值示例

 

  assign $s abc
  plo $s

  assign $s "abc 123"
  plo $s

  assign $s `abc 123
  and this`
  plo $s

  assign $b int 3
  plo $b

  assign $b #i3
  plo $b

  assign $b #f3
  plo $b


本段例子代码(assign.xie)执行后的结果是:

  (string)abc
  (string)abc 123
  (string)abc 123
  and this
  (int)3
  (int)3
  (float64)3

 

- 用var指令的时候赋值

var指令在指定类型后面,也可以带有初始化赋值的数据,例如:


var $a int 10

var $b string "abc非常好"

 

- 堆栈

 

堆栈是各种语言都会用到的数据结构,当然除了汇编语言外,一般都是“暗中”使用。但谢语言中将堆栈放开了使用,这有利于程序的性能,以及开发者灵活地操控。当然,对于对编程底层不是很了解的开发者来说,需要有一个适应的过程,容易犯错导致程序运行出乎意料。但熟悉之后,会发现这是一个很有力、很高效的编程基础设施。

 

堆栈实质上是一个“后进先出”的队列,我们一般将其形象地想象为一个竖立的箱子,一般的操作包括“入栈”(英语为push,将一个数值压入堆栈,即放在堆栈的顶部)、“出栈”(英语为pop,将一个数值弹出堆栈,即从堆栈顶部取出一个数值)和“看栈”(英语为peek,即取到堆栈顶部的第一个数值,但并不做出栈操作,并不改变堆栈内容)。

 

形象化地,我们有时候将入栈操作也称为“压入堆栈”,将出栈操作称为“弹出堆栈”、“弹出栈顶数值”,将看栈操作称为“查看栈顶”等。如果后面说道“弹栈值”,是指做了出栈(弹栈)操作后得到的值。另外,堆栈内的数值有可能被称为“元素”。

 

堆栈在各种数值转移、计算、函数调用等场景中都发挥着重要的作用,谢语言中将其放在了明面上,给开发者提供一种高效的工具。

 

- 基本的堆栈操作

 

下面的代码(stack.xie)演示了堆栈的各种基本操作,代码中也写有详细的注释说明每条语句的作用,我们后面将大量使用这种方式来做代码示例和语法与指令讲解:



  // 将整数2压入堆栈
  push #i2

  // 弹出栈顶数值到变量a中
  pop $a

  // 输出变量a的内容
  plo $a

  // 将整数3压入堆栈
  push #i3

  // 将小数2.7压入堆栈,此时栈内从下而上包含两个元素:整数的3和浮点数2.8
  push #f2.8

  // 查看栈顶元素并将其赋值给变量b
  peek $b

  // 输出变量b的内容
  plo $b

  // 弹出栈顶元素到变量c中
  pop $c

  // 输出变量b的内容
  plo $c

  // 中文的堆栈操作
  // 压入一个布尔数值true
  入栈 #btrue

  看栈 $变量1

  输出值类型 $变量1

  出栈 $变量2

  输出值类型 $变量2

运行这段代码将输出:

  (int)2
  (float64)2.8
  (float64)2.8
  (bool)true
  (bool)true

可以根据代码中的注释,详细观察堆栈操作的结果与预期的是否一致。

 

- 与堆栈有关的特殊变量

 

谢语言中,有几个与堆栈操作有关特殊变量,属于系统预定义的变量,可以随时使用以便于一些灵活的数值操作。它们是“$push”、“$pop”和“$peek”,分别表示入栈值、出栈值、看栈值。下面是它们的使用例子(stackVar.xie):

  // 将字符串压入堆栈
  push "我们高兴!"

  // 弹出栈顶数值,并输出
  // 注意弹出的数值如果不赋值给变量将丢失
  plo $pop

  // 将整数18入栈
  push #i18

  // 将出栈的数值赋值给变量a
  assign $a $pop

  // 输出变量a
  plo $a

  // 将浮点数3.14入栈
  push #f3.14

  // 将栈顶值赋值给变量a
  // 此时堆栈内该数值仍将继续存在
  assign $a $peek

  // 再次输出变量a
  plo $a


  // 用assign语句将整数18入栈
  // $push变量表示将后面的数值压栈
  assign $push #i3

  // 输出栈顶元素
  plo $peek

本段代码运行的结果是:

  (string)我们高兴!
  (int)18
  (float64)3.14
  (int)3

 

- 常见运算

 

先看看这个加法的例子(add.xie)

// 将整数2入栈
push #i2

// 将整数5入栈
push #i5

// 将栈顶两个数值取出相加后结果压入栈中
// 此处使用了预定义全局变量$push
// 此时栈中应仅有一个数值(整数5)
add $push

// 输出栈顶数值(同时该数值被弹出)
plo $pop

// 将浮点数1.5与2.6相加后压栈
add $push #f1.5 #f2.6

// 弹栈输出
plo $pop

// 将两个字符串相加(连接)后赋值给变量c
add $c `abc` `123 456` 

// 输出变量c
plo $c

// 将变量c中的数值压栈
push $c

// 将字符串“9.18”压栈
push "9.18"

// 将栈顶两个字符串相加后赋值给变量d
add $d

// 输出变量d
plo $d

// 将整数18与190相加后,压入栈中
// 表示入栈操作
add $push #i18 #i190

// 弹栈输出
plo $pop

谢语言中,加法运算指令是add/+/加,如果不带任何参数,add指令将把堆栈顶端的两个数值取出来后相加,然后结果存入全局变量$tmp。如果带有两个参数,则将这两个参数(可以是变量)值进行相加操作后将结果存入$tmp。如果带有1个或3个参数,则第一个参数是将要放置结果的变量,结果将放于这个变量中。我们使用了预置全局变量$push表示将结果压栈。这段代码的运行结果是:

  (int)7
  (float64)4.1
  (string)abc123 456
  (string)abc123 4569.18
  (int)208

 

其他类似的运算指令还有sub/-/减、mul/*/乘、div///除、mod/%/取模等,用法类似。这些都属于二元运算指令,即参与运算的数值是两个。二元运算的两个数值必须是同一类型的。如果是不同类型,例如整数和浮点数相加,则需要先进行类型转换。

 

- 数值类型转换

 

谢语言中,使用convert指令来转换数值类型,至少需要两个参数,第一个参数是数值或变量,第二个参数是字符串,指定需要转换成为的数据类型,如果有参数有三个,那么第一个参数必须是一个变量,convert指令将会把转换后的结果存入该变量,否则会存入$tmp。convert指令的使用示例(convert.xie)如下:

// 将整数15赋值给变量a
assign $a #i15

// 此时如果执行指令 add $a #f3.6
// 将会出现运行时错误
// 应为加法运算的两个数值类型不一致
// 一个是整数,一个是浮点数

// 输出变两个的数据类型和数值进行查看
// pl指令相当于其他语言中的printf函数,后面再多输出一个换行符\n
pl `a(%T)=%v` $a $a

// 将变量a转换为浮点数类型
// 结果将压入栈中
convert $push $a float

// 输出栈顶值(不弹栈)的类型和数值查看
pl `a(%T)=%v` $peek $peek

// 将栈顶值与浮点数3.6相加后压栈
add $push $pop #f3.6

// 输出栈顶值查看类型和结果
// 注意第一个参数使用$peek是为了不弹栈
// 以保证第二个参数$pop操作时还能取到该值
pl "result=(%T)%v" $peek $pop

代码中解释很详细,运行结果如下:

  a(int)=15
  a(float64)=15
  result=(float64)18.6

 

- 指令的结果参数

 

谢语言中大多数指令会产生一个或多个结果值(类似于其他语言中的函数会有返回值),谢语言中指令的返回值多数情况下是一个(函数的返回值视情况会有0个、1个或多个)。

因此,很多指令需要的一个用于指定接收指令执行结果的参数,我们将其称作结果参数。结果参数一般都是一个变量,因此也称作结果变量。结果变量可以是$push(表示将结果压入堆栈中)、$drop(表示将结果丢弃)等预置全局变量。结果变量有时可以省略,此时表示将结果存入全局变量$tmp中(等同于$tmp)。但当指令的参数个数可变时,结果参数不可省略,以免产生混淆。因此,为清晰起见,一般情况下建议尽量显式使用结果参数。

例如toUpper指令被用于将字符串转换为大写,toUpper "abc" 会将大写的ABC存入$tmp中, 而 toUpper $result "abc" 则会将ABC赋值给变量result。

另外,如果指令应返回结果,则文档中当不提结果参数时,“第一个参数”一般指的是除结果参数外的第一个参数,余者类推。

对于带有可选个数参数的指令,则一般第一个参数必须是结果变量,不可省略,这样最后才可以接可选的n个参数,否则容易产生混淆。例如getWeb指令,一个典型用法(参看httpClient.xie)是:


getWeb $resultT "http://127.0.0.1:80/xms/xmsApi" -method=POST -encoding=UTF-8 -timeout=15 -headers=`{"Content-Type": "application/json"}` $mapT

因为后面的参数除了URL是必须的外,其他都是可选的,不能确定有几个参数,因此只能把结果变量放在第一个,以便存放获取到的HTTP响应的内容。

 

- pl指令

 

上例中用到的pl指令,类似于一般语言中的printf函数,可以用占位符来控制输出的字符串内容。参数中第一个是格式字符串,可以含有%d、%f、%s、%v等占位符表示不同的数值输出形式,具体请参考Go语言等的参考文档。pln、plo、pl等指令在调试中经常会使用到,需要熟悉。

 

- 内置全局变量

 

我们前面已经接触到了一些谢语言中常用的内置全局变量,例如$push,$pop,$peek等,这里再列出所有的全局变量作为参考。

  • $tmp 表示内置全局变量tmp,例如 add #i1 #i2,将把整数1加2的结果存入$tmp中,我们也可以像普通变量一样使用$tmp。注意:tmp中存储的值我们在后面常简称做tmp值或者直接称作$tmp
  • $push 表示压栈,例如 add $push #i1 #i2,将把整数1加2的结果压栈
  • $pop 表示弹栈,例如 add $push $pop #i3,将把弹栈值加上整数3,然后结果压栈
  • $peek 表示看栈(不弹栈) ,用法类似$pop
  • $pln 表示输出,例如:md5 $pln abc,将把字符串abc的MD5编码输出到命令行(类似于println函数的方式,结尾会输出一个回车符)
  • $drop 表示丢弃,例如:removeFile $drop "c:\temp\tmp.txt",将删除相应文件后,将执行结果丢弃
  • $undefined 表示未定义的变量值
  • $debug 表示获取当前的调试信息
  • $argsG 一般是命令行参数,字符串列表类型
  • $inputG 一般是外部传入虚拟机的参数,可以是任意类型
  • $paraMapG 一般在HTTP请求响应模块中,表示请求参数(包括URL参数即GET/QUERY参数和POST参数)
  • $requestG 一般在HTTP请求响应模块中,表示请求对象
  • $responseG 一般在HTTP请求响应模块中,表示响应对象
  • $backQuoteG 表示反引号字符
  • $newLineG 表示回车换行字符
  • $scriptPathG 表示当前执行的脚本所在路径
  • $guiG GUI编程中的全局引用对象

 

- 复杂表达式分解

 

谢语言中,由于采用接近汇编语言的快捷语法,因此在一般计算上或许要稍微复杂一些,一般的建议多步运算表达式采用分解后逐个进行的方式。例如,一个3+(9*1.5)/1.7的算式,需要用下面的代码(expression.xie)实现:

// 计算3+(9*1.5)/1.7

// 将浮点数9压栈
push #f9

// 将浮点数1.5压栈
push #f1.5

// 将栈顶两元素弹出相乘后结果存入预设全局变量tmp
mul

// 将tmp中的值和浮点数1.7相除后再次存入tmp
div $tmp #f1.7

// 将浮点数3和tmp中值相加后存入$tmp
add #f3 $tmp

// 输出结果
pl "3+(9*1.5)/1.7=%v" $tmp

运行结果如下:

  3+(9*1.5)/1.7=10.941176470588236

可以看出,分解表达式的方法代码量比一般的高级语言多一些,但带来的好处是速度更快,因为省去了各种解析表达式的开销。

 

- 复杂表达式运算

 

谢语言中,也可以进行复杂的表达式计算,这要用到eval指令,参看下面的代码(eval.xie):

// 给变量a赋值为整数12
assign $a #i12

// 计算表达式 a+(a+12+26) 的值,结果存入tmp
// 注意,表达式元素之间必须以空格分隔开
// 一般的表达式都存在空格,因此需要用反引号或双引号括起来
eval "$a + ( $a + #i12 + #i26 )"

// 输出tmp值查看
pln $tmp

// 将变量b赋值为整数-9
assign $b #i-9

// 计算顺序括号优先,无括号时严格按照从左到右(注意不是乘除比加减优先等)
// 表达式中的值与运算符之间必须有空格分隔
// 结果值放入变量r
// 本例要计算的表达式的数学表达是 a+((a-12.0)*abs(b)),其中abs表示取绝对值
// 注意由于计算顺序问题,数学表达中需要把a-12.0加上括号以保证计算顺序一致
// 如果括号里的内容以一个问号“?”开始,那么后面可以是一条指令
// 该指令必须通过$tmp变量返回一个结果值继续参加表达式的运算,这样可以使得表达式中实现基本运算符之外的运算功能,例如转换数值类型等。
eval $r `$a + ( $a - (?convert $tmp #f12.0 int) * (? abs $b) )`

// 输出变量r的值查看
pln $r

// 判断表达式 !((a-b)<10) 的计算结果值是否为布尔值true,是则跳转到标号next1处
// ifEval指令后第一个参数必须是一个字符串类型的数值或变量,表示要计算的表达式
// 第二个参数时满足条件后要跳转到的标号
ifEval `! (($a - $b) < #i10)` :next1

pln 条件不满足
exit

:next1
pln 条件满足

需要特别注意的是,谢语言中的表达式中,运算符是没有优先级之分的,因此一个表达式中是严格按照从左到右的顺序执行运算的,唯一的例外是括号,用圆括号可以改变运算的优先级,括号里的部分将被优先计算。另外,表达式中的值与运算符之间必须有空格分隔。也因为一般的表达式都存在空格,因此需要用反引号或双引号括起来。

另外,如果括号里的内容以一个问号“?”开始,那么后面可以是一条指令,该指令必须通过$tmp变量返回一个结果值以便继续参加表达式的运算,这样可以使得表达式中实现基本运算符之外的运算功能,例如转换数值类型等。

ifEval指令是专门配合表达式计算使用的条件跳转指令,它后面必须跟一个字符串类型的表达式,其计算结果必须是一个布尔类型的值,ifEval指令将根据其结果,确定是否要跳转到指定的行号。ifEval指令,简化了一般的if和ifNot质量较为复杂的条件处理语法结构。

由于谢语言中表达式计算相对效率较低,因此对于需要反复高速计算或处理的场景,建议还是使用分解的方式更高效。

运行后的效果:

62
12
条件满足

 

- 复杂表达式做参数

 

谢语言中,表达式可以运用在指令的参数中,此时需要以英文问号“?”字符开头,例如(exprInParam.xie):

assign $a "abc"

// 表达式做参数
// 注意“?”后面再加双引号或反引号括起表达式
pl "[%v] test params: %v" ?"(?nowStr)" $a

将输出:

[2022-05-17 14:30:59] test params: abc

其中,pl指令的第二个参数即是以问号开头的表达式,而这个表达式用(?...)的方式又运行了获取当前时间字符串的指令nowStr。注意,表达式内的指令,一定要保证将结果值存入全局变量$tmp(不可省略结果参数的指令,要确保结果参数是$tmp)。

 

- 快速表达式

谢语言中还支持一种快速表达式,见下例(quickEval.xie):

// 本例展示快速表达式
// 注意快速表达式中目前不支持内嵌指令或函数(如需使用,请用普通/复杂表达式)

// 将变量a赋值为浮点数15.2
= $a #f15.2

// 计算 -5.1*2.8+(23+(a-6.9))/3.3
// quickEval指令用于计算一个用字符串表示的快速表达式的值
quickEval `-#f5.1*#f2.8+(#f23+ ($a -#f6.9)) /#f3.3 `

pln $tmp

// 计算 3+(16-2)/3%2 并输出结果
quickEval $pln `#i3 + (#i16 -#i2) / #i3 % #i2`

= $s1 "abc 12\n3 \u0022大家好\u0022"

// 计算字符串的相加(即连接)结果
quickEval $pln `" -- " + $s1 + "--"`

// 将变量b赋值为整数18
assign $b #i18

// if指令后也可以接快速表达式表示判断条件
// 快速表达式做参数时,以@符号开始,一般后面用反引号括起来,因为常有空格
// if语句后快速表达式也可以不带@符号,直接是一个字符串,会自动判断
if @`$b > #i12` +1 +2
    fatalf "$a > #i12"

    fatalf "$a <= #i12"

条件判断指令if中,可以直接带字符串类型的快速表达式,方便代码书写。

 

- 标号

 

谢语言中,可以在任意代码行的前一行添加标号,主要用于各种循环和条件分支等跳转场景。设置标号必须单独占一行,并以冒号“:”字符开头。

  :lable1
  pln 123

 

- 代码缩进

 

谢语言中,每行代码的头尾空白将被忽略,因此可以适当采用代码的逐级缩进来增加代码的可读性。

  :lable1
      pln 123

 

- goto语句

 

goto语句在一般的高级语言中并不推荐使用,但对于具备一定经验的开发者来说,反而有可能是提高效率的手段。谢语言中提供了goto/转到指令(为保持和汇编语言的一定关联,也可写作jmp),可以用于实现代码执行中无条件跳转到某个标号处的功能。例如(goto.xie):

  pln start...

  push #f1.8

  goto :label1

  pop $c

  pln `c =` $c

  :label1
      pln "label1 =" $peek

由于无条件跳转的关系,这段代码中的goto语句与标号:lable1之间的代码将不被执行,最后输出结果是:

  start...
  label1 = 1.8

另外,goto语句中的,可以使用“+1”、“-3”这种伪标号,表示跳转到当前指令的后一条指令或前三条指令(注意:注释和标号等不是有效指令的行将被忽略而不被计算在内):

  pln abc
  goto +2

  // 下面两条指令将被跳过
  pln 123
  pass 

  pln "这句将被执行"

 

- 一般循环结构

 

循环结构是一般计算机语言中必然会有的基本语法结构。谢语言中,一般使用各种跳转语句来实现循环结构。goto语句是其中的一种方法,最常见的是实现无限循环。

  // 将字符串压栈
  push "欢迎"

  // 设定标号loop1
  :loop1
      // 输出栈顶值
      pln $peek

      // 休眠2.5秒
      sleep #f2.5

  // 跳转到标号loop1处继续往下执行
  goto :loop1    

sleep指令的作用是休眠指定的秒数。本例(for1.xie)运行的结果是将每隔2.5秒输出一下“欢迎”两个字,直到按Ctrl-C等方法来终止程序的运行。

 

- 条件分支

 

谢语言中的条件分支支持一般是由比较判断指令和条件跳转指令结合来实现的。直接看下面的例子(if.xie):

// 给变量i赋值整数11
assign $i #i11

// 比较变量i是否大于整数10
// 结果放入变量a中
> $a $i #i10

// 判断$a是否为布尔值true
// 如果是则跳转到标号label2
if $a :label2
  // 否则执行下面的语句
  pln "else branch"

//终止程序执行
exit

// 标号label2
:label2
  // 输出“if branch”
  pln "if branch"

  // 将变量b赋值为整数8
  assign $b #i8

  // 比较变量b是否小于或等于变量i
  // 由于省略了结果变量,结果将被放入$tmp中
  <= $b $i

  // 是(tmp值是true)则跳转到标号label3
  ifNot $tmp :label3
      // 否则输出
      pln "label3 else"
  // 终止代码执行
  exit

  // 标号label3
  :label3
      // 输出“label3 if”
      pln "label3 if"

其中,出现了两个比较指令:“>”和“<=”,这些比较指令所带参数都和二元运算指令类似,可以从堆栈中取两个值做比较,也可以对后面所带的两个参数进行比较,当然还可以带一个参数(放在第一个)表示将结果赋值给某个变量,否则会将结果存入$tmp。比较指令返回的结果都是布尔值true或者false。

 

而条件跳转指令if和ifNot可以带1或2个参数,最后一个参数都是符合条件要跳转到的标号,如果还有第一个参数则表明要判断的变量或数值(必须是布尔值),没有的话则从堆栈取数进行判断:if指令是true则跳转,ifNot是false则跳转。

 

这段代码的运行结果是:

  if branch
  label3 else

注意观察条件分支的流转是否符合预期。

比较指令主要包括:==(等于)、!=(不等于)、>、<、>=、<=等。

 

- else分支

 

if、ifNot等条件分支指令其实还支持第三个参数,即else分支。该参数也是一个标号,表示条件不满足时要走的分支。直接看下面的例子(else.xie):

> #i3 #i2

if $tmp :label1 :else1

:label1
    pln label1

    goto :next1

:else1
   pln else1 

:next1

> $push #f1.5 #f3.6
if $pop :label2 :else2

:label2
    pln label2

    exit

:else2
   pln else2



运行输出结果为:

label1
else2

注意其中是否走了else分支。

也注意,使用else的情况下,结果参数不可省略。

 

- 非标号/伪标号跳转

在无条件跳转指令goto和条件跳转指令if、ifNot、ifEval等语句中,不一定非要用标号表示跳转目的地,也可以使用类似“+1”,“+3”这种伪标号,表示跳转到当前指令的后一条指令或前三条指令等。注意,注释和标号等不是有效指令的行将被忽略而不被计算在内。我们来看下面的例子(quickIf.xie):

// 本例演示了在if和goto等指令中使用“+1”、“+3”等“伪标号”进行跳转的方法
// +1是指跳转到当前指令的下一条指令,+3指跳转到当前指令后面的第3条指令,以此类推
// 可以用“-1”代替当前指令的上一条指令,“-5”表示当前指令上面的第5条指令等
// 注意,这里的指令都是指有效指令,注释、标号等将被忽略(即不被算入)

// 将变量a赋值为字符串abc
assign $a "abc"

// 获取该字符串的长度,结果放入变量lenT中
len $lenT $a

// 判断lenT是否小于5,结果放入变量rsb中
< $rsb $lenT #i5

// 如果rsb值为布尔值true,则跳转到下一条指令执行
// 否则跳转到下面第三条指令执行
if $rsb +1 +3
    pln "<5"

    // 无条件跳转到下面第二条指令
    goto +2

    pln ">5"

pln a = $a

可以看出,直接使用伪标号跳转写法更简洁。不过也有不便之处,例如else分支如果用标号可能更方便,因为if分支如果要增减语句的话,else分支用数字就需要经常变化,容易遗漏出错。因此,可以结合标号与伪标号来使用跳转。

 

- for循环

 

有了条件分支结构,就可以实现标准的for循环,这是一个可以具有终止条件的循环语法结构。

// 实现类似 for i = 0; i < 5; i ++ 的标准三段for循环结构

// 将变量i赋值为整数0
assign $i #i0

// 标号loop1
:loop1

  // 将i的值加上整数10
  // 结果存入tmp
  add $i #i10

  // 输出变量i中数值,和tmp值
  pln $i ":"  $tmp

  // 将变量i的值加1
  inc $i

  // 判断变量i中的数值是否小于整数5
  < $i #i5

  // 是则跳转到标号loop1(继续循环)
  if $tmp :loop1

// 否则执行下面的语句
// 也就是跳出了loop1的循环结构
// 输出字符串“end”
pln end

上面的例子代码(for.xie)实现了一个经典的三段for循环结构。其中用到了inc指令,作用是将变量值加1,如果不带参数则会弹栈值加1,结果都将压栈。inc指令实现了一般语言中 i++ 的效果。本段代码执行的结果是:

  0 : 10
  1 : 11
  2 : 12
  3 : 13
  4 : 14
  end

与inc指令对应的是dec指令,会将对应值减1。

 

- 利用for指令进行for循环

 

谢语言也提供了for指令来进行常规的for循环,结合表达式可以实现灵活的循环控制,参看下面的例子(for3.xie):

  // 第一个循环开始
  // 将变量i赋值为整数0
  assign $i #i0

  // 赋值用于循环终止条件判断的变量cond
  // 赋值为布尔值true,以便第一次循环条件判断为true从而开始循环
  // 否则一次都不会执行
  assign $cond #btrue

  // 循环执行标号label1处的代码(即循环体)
  // 直至变量cond的值为布尔值false
  // 循环体中应该用continue指令继续循环或break中断循环
  for $cond :label1

  // 第二个循环开始
  // 将变量j赋值为浮点数0
  assign $j #f0.0

  // 循环执行label2处代码
  // 表达式是判断变量j小于2.8则执行label2处代码
  for ?`($j < #f2.8)` :label2

  // 循环结束输出
  pln "for end"

  // 终止程序运行,否则将继续往下执行
  exit

  :label1
      // 输出变量i的值作参考
      pl i=%v $i

      // 将变量i的值加1
      inc $i

      // 判断变量i的值是否小于整数5
      // 结果放入变量cond
      < $cond $i #i5

      // 继续执行循环(会再次判断for指令中的条件)
      continue

  :label2
      // 输出变量j的值作参考
      pl j=%v $j

      // 将变量j的值加上0.3,结果仍放回变量j中
      add $j $j #f0.3

      // 继续执行循环(会再次判断for指令中的条件)
      continue

for指令后面的第一个参数是循环条件,满足条件(即值为布尔值true)才会进行循环;第二个参数是一个标号,表示循环体代码开始的位置。循环体代码中应该用continue指令继续循环或break中断循环,exit也是可以的。代码中演示了两个for循环,第一个for循环的循环条件是一个放在一个变量中的,第二个这直接用一个表达式来表示,每次循环都会重新计算这个表达式。运行结果如下:

i=0
i=1
i=2
i=3
i=4
j=0
j=0.3
j=0.6
j=0.8999999999999999
j=1.2
j=1.5
j=1.8
j=2.1
j=2.4
j=2.6999999999999997
for end

其中有些小数位数长是因为计算机浮点数计算误差导致的,与循环无关,我们将在后面介绍如何消除这种问题。

 

- 用range指令进行简单数据的遍历

 

对于整数、字符串和一些简单的数组(后面会详细说明),可以用range指令对其进行遍历,即循环执行一定次数,每次循环体内可以获得遍历序号和遍历值进行相应操作,参看下面的代码(range.xie):

  // 循环遍历整数5,每次执行标号label1处的循环体代码
  // 将循环5次,遍历值分别是0,1,2,3,4
  // 相当于其他语言中的 for i := 1, i < 5; i ++……
  range #i5 :label1

  // 第一个循环结束
  pln "end for1"

  // 跳转到标号next1处
  goto :next1

  :label1
      // 从栈中分别弹出遍历序和遍历值
      assign $i $pop
      assign $v $pop

      // 输出供参考
      pl "i: %v, v: %v" $i $v

      // 继续循环遍历
      continue

  :next1

  // 进行第二个循环
  range "abc123" :label2

  // 第二个循环结束
  pln "end for2"

  // 退出程序执行
  exit

  :label2
      // 从栈中分别弹出遍历序和遍历值
      assign $i $pop
      assign $v $pop

      // 输出供参考
      pl "i: %v, v: %v" $i $v

      // 继续循环遍历
      continue

执行结果是:

i: 0, v: 0
i: 1, v: 1
i: 2, v: 2
i: 3, v: 3
i: 4, v: 4
end for1
i: 0, v: a
i: 1, v: b
i: 2, v: c
i: 3, v: 1
i: 4, v: 2
i: 5, v: 3
end for2

注意遍历整数和字符串的区别。

最新版的谢语言中,range指令也支持切片(数组)和映射(字典)的遍历。

 

- 函数调用

 

谢语言中的函数调用分为快速函数调用、一般函数调用和封装函数调用,先介绍一般函数调用,一般函数调用的标准结构如下(func.xie):

// 将变量s赋值为一个多行字符串
assign $s ` ab c123 天然
森林 `

// 输出变量s中的值
// plv会用内部表达形式输出后面变量中的值
// 例如会将其中的换行符等转义
plv $s

// 将变量s中的值压栈
push $s

// 调用函数func1
// 即跳转到标号func1处
// 而ret命令将返回到call语句的下一行有效代码处
call :func1

// 弹栈到变量s中
pop $s

// 再次输出变量s中的值
plv $s

// 终止代码执行
exit

// 标号func1
// 也是函数的入口
// 一般称作函数func1
:func1
  // 弹栈到变量v中
  pop $v

  // 将变量v中字符串做trim操作
  // 即去掉首尾的空白字符
  // 结果压入栈中
  trim $push $v

  // 函数返回
  // 从相应call指令的下一条指令开始继续执行
  ret


上面代码中,plv指令会输出后面值的内部形式,主要为了调试时便于看出其中值的类型。call标号加ret指令是谢语言实现函数的基本方法,call语句将保存当前程序所处的代码位置,然后调用指定标号处的代码,直至ret语句时将返回到call时代码位置的下一条指令继续执行。这就实现了一个基本函数调用的逻辑。

 

如果要给函数传递参数,则一般通过堆栈来进行。同样地,函数返回值也通过堆栈来传递。trim指令实际上是对后面的变量进行去字符串首尾空白的操作,然后通过预置全局变量$push进行压栈操作。

 

- 全局变量和局部变量

 

一般函数中会具有自己的局部变量空间,在函数中定义的变量(使用var指令),只能在函数内部使用,函数返回后将不复存在。而对变量值取值使用的情况,函数会先从局部变量寻找,如果有则使用之,如果没有该名字的变量则会到上一级函数(如果有的话,因为函数可以层层嵌套)中寻找,直至寻找到全局变量为止仍未找到才会返回“未定义”。对变量进行赋值操作的情况(对变量),如果在进入函数前没有定义过,则也会层层向上寻找,如果全没有找到,则会在本函数的空间内创建一个新的局部变量。如果要在函数中创建全局变量,则需要使用global指令。global指令与var指令用法一致,唯一的区别就是global指令将声明一个全局变量。看下面的例子(local.xie)来了解全局变量和局部变量的使用:

  // 给全局变量a和b赋值为浮点数
  assign $a #f1.6
  assign $b #f2.8

  // 调用函数func1
  call :func1

  // 输出调用函数后a、b、c、d四个变量的值
  pln $a $b $c $d

  // 退出程序执行
  exit

  // 函数func1
  :func1
      // 输出进入函数时a、b、c、d四个变量的值
      pln $a $b $c $d

      // 将变量a与0.9相加后将结果再放入变量a中
      add $a $a #f0.9

      // 声明一个局部变量b(与全局变量b是两个变量)
      var $b

      // 给局部变量b赋值为整数9
      assign $b #i9

      // 将局部变量b中的值加1
      inc $b

      // 将变量c赋值为字符串
      = $c `abc`

      // 声明一个全局变量d
      global $d

      // 给变量d赋值为布尔值true
      = $d #btrue

      // 退出函数时输出a、b、c、d四个变量的值
      pln $a $b $c $d

      ret

注意其中的“=”是assign指令的另一种简便写法,另外assign指令前如果没有用global或var指令生命变量,相当于先用var命令声明一个变量然后给其赋值。这段代码的运行结果是:

  1.6 2.8 未定义 未定义
  2.5 10 abc true
  2.5 2.8 未定义 true

注意其中4个变量a、b、c、d的区别,可以看出:变量a是在主代码中定义的全局变量,在函数func1中对其进行了计算(将a与0.9相加后的结果又放入a中)后,最后出了函数体之后的输出仍然是计算后的值,说明函数中操作的是全局变量;变量b则是在函数中定义了一个同名的局部变量,因此在函数中虽然有所变化,但退出函数后其值会变回原来的值,其实是局部变量b已经被销毁,此时的b是全局变量b;变量c完全是函数内的局部变量,因此入函数前和出了函数后都是“未定义”;变量c则是在函数中用global指令新建的全局变量,因此退出函数后任然有效。

 

- 快速函数

 

快速函数与一般函数的区别是:快速函数不会有自己的独立变量空间。快速函数与主函数(指不属于任何函数的代码所处的环境)共享同一个变量空间,在其中定义和使用的变量都将是全局变量。使用快速函数的好处是,速度比一般函数更快,因为减少了分配函数局部空间的开销。对一些实现简单功能的函数来说,有时候这是很好的选择。

快速函数类似call与ret的配对指令,使用fastCall与fastRet两个指令来控制函数调用与返回。下面是例子(fastCall.xie):

  // 将两个整数压栈
  push #i108
  push #i16

  // 快速调用函数func1
  // 而fastRet命令将返回到fastCall语句的下一行有效代码处
  fastCall :func1

  // 输出弹栈值(为函数func1压栈的返回结果)
  plv $pop

  // 终止代码执行
  exit

  // 函数func1
  // 功能是将两个数相加
  :func1
      // 弹栈两个数值
      pop $v2
      pop $v1

      // 将两个数值相加后压栈
      add $push $v1 $v2

      // 函数返回
      // 从相应fastCall指令的下一条指令开始继续执行
      fastRet

运行结果为:

124

 

- 取变量引用及取引用对应的变量实际值

 

这里的“引用”可以理解成一般语言中的取变量地址的操作。使用引用的目的是为了直接修改其中的值,尤其是对一些复杂数据类型来说。这里先给出一个对基础数据类型的取引用与解引用操作的例子(ref.xie):

// 给全局变量a和b赋值为浮点数
assign $a #f16

// 获取变量a的引用并入栈
ref $push $a

// 调用函数func1
call :func1

// 输出调用函数func1后的变量a值
plo $a

// 退出程序执行
exit

// 函数func1
:func1

    // 出栈到变量p
    pop $p

    // 输出变量p
    plo $p

    // 将引用变量p中的对应的数值放入变量v中
    unref $v $p

    // 输出变量v
    plo $v

    // 将引用变量p中的值重新置为整数9
    assignRef $p #i9

    // 函数返回
    ret

代码中有详细的注释,运行结果为:

  (*interface {})0xc00014e150
  (float64)16
  (int)9

其中,ref指令用于取变量的引用,unref指令用于获取引用变量指向的值(解引用),assignRef指令则直接将引用变量指向的值赋以新值。可以看出,使用变量引用,成功将全局变量中的数值进行了改变。

 

- 复杂数据类型-列表

 

列表在其他语言中有时候也称作“数组”、“切片”等。在谢语言中,列表可以理解为可变长的数组,其中可以存放任意类型的值。列表的操作包括创建、增加项、删除项、切片(截取其中一部分)、合并(与其他列表合并)、遍历(逐个对列表中所有的数据项进行操作)等。下面的代码演示了这些操作的方法(list.xie):

// 定义一个列表变量list1
var $list1 list

// 查看列表对象,此时应为空的列表
plo $list1

// 给列表list1中添加一项整数8
addItem $list1 #i8

// 给列表list1中添加一项浮点数12.7
addItem $list1 #f12.7

// 再次查看列表list1中内容,此时应有两项
plo $list1

// 用赋值的方法直接将一个数组赋值给列表变量list2
// #号后带大写的L表示后接JSON格式表达的数组
assign $list2 #L`["abc", 2, 1.3, true]`

// 输出list2进行查看
plo $list2

// 查看list2的长度(即其中元素的个数)
len $list2

pln length= $tmp

// 获取列表list1中序号为0的项(列表序号从零开始,即第1项)
// 结果将入栈
getItem $push $list1 #i0

// 获取list2中的序号为1的项,结果放入变量a中
getItem $a $list2 #i1

// 将变量a转换为整数(原来是浮点数)并存回a中
convert $a $a int

// 查看变量a中的值
plo $a

// 将弹栈值(此时栈顶值是列表list1中序号为0的项)与变量a相加
// 结果压栈
add $push $pop $a

// 查看弹栈值
plo $pop

// 将列表list1与列表list2进行合并
// 结果放入新的列表变量list3中
// 注意,如果没有指定结果参数(省略第一个,此时应共有2个参数),将把结果存回list1
// 相当于把list1加上了list2中所有的项
addItems $list3 $list1 $list2

// 查看列表list3的内容
plo $list3

// 将list3进行切片,截取序号1(包含)至序号5(不包含)之间的项
// 形成一个新的列表,放入变量list4中
slice $list4 $list3 #i1 #i5

// 查看列表list3的内容
plo $list4

// 循环遍历列表list4中所有的项,对其调用标号range1开始的代码块
// 该代码块必须使用continue指令继续循环遍历
// 或者break指令跳出循环遍历
// 遍历完毕或者break跳出遍历后,代码将继续从rangeList指令的下一条指令继续执行
// 遍历每项时,rangeList会先将当前遍历项和当前序号值(从0开始)先后压栈
rangeList $list4 :range1

// 删除list4中序号为2的项(此时该项为整数2)
deleteItem $list4 #i2

// 再次删除list4中序号为2的项(此时该项为浮点数1.3)
deleteItem $list4 #i2

// 修改list4中序号为1的项为字符串“烙红尘”
setItem $list4 #i1 烙红尘

// 再次删除list4中序号为0的项(此时该项为浮点数12.7)
deleteItem $list4 #i0

// 再次查看列表list4的内容
// 此时应只剩1项字符串“烙红尘”
plo $list4

// 结束程序的运行
exit

// 标号range1的代码段,用于遍历列表list4
:range1
    // 弹栈获得遍历序号值放入变量i中
    pop $i

    // 弹栈获得遍历项放入变量v中
    pop $v

    // 判断i值是否小于3,结果压栈
    < $i #i3

    // 如果是则跳转到next1(继续执行遍历代码)
    if $tmp :next1

        // 否则跳出循环遍历
        break

    // 标号next1
    :next1

    // 输出提示信息
    pl `第%v项是%v` $i $v

    // 继续循环遍历,如欲跳出循环遍历,可以使用break指令
    continue

代码中有详细注释,运行的结果是:

  ([]interface {})[]
  ([]interface {})[8 12.7]
  ([]interface {})[abc 2 1.3 true]
  length= 4
  (int)2
  (int)10
  ([]interface {})[8 12.7 abc 2 1.3 true]
  ([]interface {})[12.7 abc 2 1.3]
  第0项是12.7
  第1项是abc
  第2项是2
  ([]interface {})[烙红尘]

谢语言还有其他类型的列表,包括字节列表(byteList)和如痕列表(runeList)等,用法类似。

 

- 复杂数据类型-映射

 

映射在其他语言中也称作字典、哈希表等,其中存储的是一对对“键(key)”与“值(value)”,也称为键值对(key-value pair)。谢语言中运用映射各种基本操作的例子如下(map.xie):

// 定义一个映射变量map1
var $map1 map

// 查看映射对象,此时应为空的映射
plo $map1

// 给映射map1中添加一个键值对 “"Name": "李白"”
// setItem也可用于修改
setMapItem $map1 Name "李白"

// 再给映射map1中添加一个键值对 “"Age": 23”
// 此处23为整数
setMapItem $map1 Age #i23

// 再次查看映射map1中内容,此时应有两个键值对
plo $map1

// 用赋值的方法直接将一个数组赋值给映射变量map2
// #号后带大写的M表示后接JSON格式表达的映射
assign $map2 #M`{"日期": "2022年4月23日","气温": 23.3, "空气质量": "良"}`

// 输出map2进行查看
plo $map2

// 查看map2的长度(即其中元素的个数)
len $map2

pln length= $tmp

// 获取映射map1中键名为“Name”的项
// 结果入栈
getMapItem $push $map1 Name

// 获取map2中的键名为“空气质量”的项,结果放入变量a中
getMapItem $a $map2 空气质量

// 将弹栈值(此时栈顶值是映射map1中键名为“Name”的项)与变量a相加
// 结果压栈
add $push $pop $a

// 查看弹栈值
plo $pop

// 循环遍映射map2中所有的项,对其调用标号range1开始的代码块
// 该代码块必须使用continue指令继续循环遍历
// 或者break指令跳出循环遍历
// 遍历完毕或者break跳出遍历后,代码将继续从rangeMap指令的下一条指令继续执行
// 遍历每项时,rangeMap会先将当前键值和当前键名先后压栈
rangeMap $map2 :range1

// 删除map2中键名为“气温”的项(此时该项为浮点数23.3)
deleteMapItem $map2 "气温"

// 再次查看映射map2的内容
plo $map2

// 结束程序的运行
exit

// 标号range1的代码段,用于遍历映射
:range1
    // 弹栈获得遍历序号值放入变量i中
    pop $k

    // 弹栈获得遍历项放入变量v中
    pop $v

    // 输出提示信息
    pl `键名为 %v 项的键值是 %v` $k $v

    // 继续循环遍历,如欲跳出循环遍历,可以使用break指令
    continue

其中详细介绍了映射类型的主要操作,代码的运行结果是:

(map[string]interface {})map[]
(map[string]interface {})map[Age:23 Name:李白]
(map[string]interface {})map[日期:2022年4月23日 气温:23.3 空气质量:良]
length= 3
(string)李白良
键名为 日期 项的键值是 2022年4月23日
键名为 气温 项的键值是 23.3
键名为 空气质量 项的键值是 良
(map[string]interface {})map[日期:2022年4月23日 空气质量:良]

 

- 嵌套的复杂数据结构及JSON编码

 

谢语言中,复杂数据结构也是可以嵌套的,例如列表中的数据项可以是一个映射或列表,映射中的键值也可以是列表或映射。看下面的例子(toJson.xie):

var $map1 map

setMapItem $map1 "姓名" 张三

setMapItem $map1 "年龄" #i39

var $map2 map

setMapItem $map2 "姓名" 张胜利

setMapItem $map2 "年龄" #i5

var $list1 list

addItem $list1 $map2

setMapItem $map1 "子女" $list1

plo $map1

toJson $push $map1 -indent -sort

pln $pop

例子中建议了一个简单的父子关系的数据结构,父亲张三,孩子张胜利,父亲这个数据对象本身是用映射来表示的,而其子女是用列表来表示,列表中的数据项——他的孩子张胜利本身又是用一个映射来表示的。另外,为了展示更清楚,我们使用了toJson指令,这个指令可以将数据结构转换为JSON格式的字符串,第一个参数是结果放入的变量,这里用内置变量$push表示将结果压栈。目前,toJson函数支持两个可选参数,-indent表示将JSON字符串用缩进的方式表达,-sort表示将映射内的键值对按键名排序。代码运行结果如下:

(map[string]interface {})map[姓名:张三 子女:[map[姓名:张胜利 年龄:5]] 年龄:39]
{
  "姓名": "张三",
  "子女": [
  {
    "姓名": "张胜利",
    "年龄": 5
  }
],
  "年龄": 39
}

注意对比谢语言对该数据的表达形式与JSON形式的区别。

 

- JSON解码

 

我们对JSON编码的反操作就是将JSON格式的字符串转换为内部的数据。这可以通过定义参数时加上“#L”或“#M”形式来进行,也可以通过fromJson指令来执行。使用“#L”或“#M”的方式我们前面已经介绍过了,这里是使用fromJson关键字的例子,我们就直接用上面生成的JSON来反向操作试一下(fromJson.xie):

// 将变量s赋值为一个多行字符串
// 即所需解码的JSON文本
assign $s `
{
  "姓名": "张三",
  "子女": [
  {
    "姓名": "张胜利",
    "年龄": 5
  }
],
  "年龄": 39
}
`

// 用fromJson指令将s中的文本解码到变量map1中
fromJson $map1 $s

// 获取map1的数据类型
// 可用于以后根据不同类型进行不同处理
// 结果入栈
typeOf $push $map1

// 输出类型名称
pln 类型是: $pop

// 输出map1的内容
plo $map1

// 获取map1中的键名为子女的项
// 结果放入变量list1中
getMapItem $list1 $map1 子女

// 获取list1中序号为0的项
// 结果放入变量map2中
getItem $map2 $list1 #i0

// 获取map2中键名为姓名的项
// 结果压栈
getMapItem $push $map2 姓名

// 输出弹栈值
pln 姓名: $pop


运行后得到:

类型是: map[string]interface {}
(map[string]interface {})map[姓名:张三 子女:[map[姓名:张胜利 年龄:5]] 年龄:39]
姓名: 张胜利

注意,typeOf指令可用于获取任意变量的数据类型名称,这在很多需要根据类型进行处理的场景下非常有用。typeOf获取到的值类型与宿主语言Go语言的一致,可参考Go语言的文档。

 

- 加载外部模块

 

谢语言可以动态加载外部的代码文件并执行,这是一个很方便也很重要的功能。一般来说,我们可以把一些常用的、复用程度高的功能写成快速函数或一般函数放在单独的谢语言源代码文件中,然后在需要使用的代码中动态加载它们并使用其中的函数。可以构建自己的公共代码库,或者形成功能模块。

下面的例子演示的是在一个代码文件中先后载入两个外部模块文件并调用其中的函数。

首先编写1个模块文件module1.xie,其中包含两个快速函数add1和sub1,功能很简单,就是两个数进行相加和相减。

注意,由于快速函数与主函数共享全局变量空间,为避免冲突,建议变量名以大写的“L”结尾,以示只用于局部。另外还建议全局变量以大写的“G”结尾,一般的局部变量以大写的“T”结尾。这些不是强制要求,但也许能够起到一些避免混乱的效果。

:add1
    pop $v2L
    pop $v1L

    add $push $v1L $v2L

    fastRet

:sub1
    pop $v2L
    pop $v1L

    sub $push $v1L $v2L
    
    fastRet

然后再编写第二个模块文件module2.xie,其中包含一个普通函数mul1,作用是两个数相乘。

:mul1
    pop $v2L
    pop $v1L

    mul $push $v1L $v2L

    ret


最后编写动态加载上面两个模块的例子代码(loadModule.xie):

// 载入第1个代码文件module1.xie并压栈
loadText $push `scripts/module1.xie`

// 输出代码文件内容查看
pln 加载的代码: "\n" $peek "\n"

// 弹栈加载代码
// 并将结果值返回,成功将返回加载代码的第1行行号(注意是字符串类型)
// 失败将返回TXERROR:开头的错误信息
loadCode $push $pop

// 查看加载结果
plo $pop

// 压栈两个整数
push #i11
push #i12

// 调用module1.xie文件中定义的快速函数add1
fastCall :add1

// 查看函数返回结果(不弹栈)
plo $peek

// 再压入一个整数5
push #i5

// 调用module1.xie文件中定义的快速函数sub1
fastCall :sub1

// 查看函数返回结果(不弹栈)
plo $peek

// 载入第2个代码文件module2.xie并置于变量code1中
loadText $code1 `scripts/module2.xie`

// 加载code1中的代码
// 由于不需要loadCode指令返回的行号,因此用$drop变量将其丢弃
loadCode $drop $code1

// 再入栈一个整数99
// 此时栈中还有一个整数18
push #i99

// 调用module2.xie文件中定义的一般函数mul1
call :mul1

// 查看函数返回结果(弹栈)
plo $pop

// 退出程序执行
// 注意:如果不加exit指令,程序会继续向下执行module1.xie和module2.xie中的代码
exit

代码中的重点是loadText指令和loadCode指令。loadText从指定路径读取纯文本格式的模块代码文件内容。loadCode文件则从字符串变量中读取代码并加载到当前代码的后面,如果成功,会返回这段代码的起始位置(注意是字符串格式),有些情况下会用到这个返回值。对于以函数为主的模块,在动态加载包含这些函数的文件后,就可以用call或fastCall指令来调用相应的函数了。

代码运行的结果是:

加载的代码: 
 :add1
    pop $v2L
    pop $v1L

    add $push $v1L $v2L

    fastRet

:sub1
    pop $v2L
    pop $v1L

    sub $push $v1L $v2L

    fastRet

(string)17
(int)23
(int)18
(int)1782

 

- 封装函数调用

 

封装函数与一般函数与快速函数的区别是:封装函数直接采用源代码形式调用,实际上会新启动一个谢语言虚拟机去执行函数代码,封闭性更好(相当于沙盒执行),也更灵活,参数和返回值通过堆栈传递;缺点是性能稍慢(因为要启动虚拟机并解析代码)。下面是封装函数调用的例子(callFunc.xie):

# 压栈准备传入的两个函数参数
push #f1.6
push #f2.3

# callFunc指令将代码块看做封装函数进行调用
# 第1个参数表示函数需要的参数,如果函数无须参数,第一个参数可以省略
callFunc 2 `
    # 依次弹栈两个参数,特别注意,这里弹出的顺序不是逆序,而是与压栈顺序相同
    pop $arg1
    pop $arg2

    # 输出两个参数检查
    pln arg1= $arg1
    pln arg2= $arg2

    // 将两个参数相加,结果压栈
    add $push $arg1 $arg2

    // 输出栈顶值检查
    pln $peek

    # 需要在全局变量outG中返回函数返回值(压栈的)的个数(字符串形式)
    # 这里只有1个压栈值需要返回,即两个数相加的结果
    assign $outG 1
`

# 输出函数返回值(弹栈值)
# 注意如果有多个返回值,也是按封装函数入栈顺序出栈的,不是顺序
pln 函数返回值: $pop

代码中,封装函数直接用反引号扩起了多行的代码。callFunc指定需要一个参数指定要压入新虚拟机作为调用函数的参数,注意顺序不是逆序而是顺序压入栈中的。如果没有参数则可以省略这个参数。第二个参数是字符串类型的变量或值,这里传入了一个多行字符串,既是这个封装函数的代码,封装函数如果要返回值,需要在全局变量outG中返回一个字符串类型的数字,表示返回值的个数,这些返回值是以压栈的形式返回的,注意也是按封装函数入栈顺序返回而不是逆序。

注意,封装函数是以字符串形式的代码加载并执行的,这意味着封装函数也可以动态加载,例如从文件中读取代码后执行,这带来了很大的灵活性。另外,封装函数在单独的虚拟机中运行,和主函数的变量和堆栈空间都不冲突,因此可以编写更通用的函数。

上面代码的执行结果是:

arg1= 1.6
arg2= 2.3
3.9
函数返回值: 3.9

 

- 引用与解引用

谢语言中支持对变量取引用和对引用解引用以取值,具体用法参看下面并发函数的例子。

 

- 并发函数

 

谢语言中的并发是用类似于封装函数的并发函数来实现的。下面是并发函数调用的例子(goFunc.xie):

// 给变量a赋值浮点数3.6
// 变量a将在线程中运行的并发函数中被修改
assign $a #f3.6

// 输出当前变量a的值作参考
pln a= $a

// 获取变量a的引用,结果入栈
// 将被传入并发函数中以修改a中的值
ref $push $a

// 再入栈一个准备传入并发函数中的值
push `前缀`

// 调用并发函数
// 第一个参数表示需要压入并发函数所使用的堆栈中的值的数量
// 如果不需要传递参数,第一个参数可以省略
// 第二个参数是字符串形式的并发函数代码
goFunc 2 `
    // 弹栈两个传入的参数,注意也不是逆序弹出的而是顺序弹出的
    pop $arg1
    pop $arg2

    // 查看两个参数值
    pln arg1= $arg1
    pln arg2= $arg2

    // 解引用第一个参数(即主函数中的变量a的应用)
    unref $aNew $arg1

    // 输出变量a的值以供参考
    pln 外部的变量a的值为 $aNew

    // 无限循环演示不停输出时间
    // loop1是用于循环的标号
    :loop1
        // 输出sub和变量arg2中的值
        pln sub $arg2

        // 获取当前时间并存入tmp
        now

        // 将弹栈值(当前时间)赋值给变量arg1指向的变量
        // assignRef的第一个参数必须是一个引用
        assignRef $arg1 $tmp

        // 休眠2秒
        sleep #f2

        // 跳转到标号loop1(实现无限循环)
        goto :loop1
`

// 主线程中输出变量a的值
// 此时刚开始启动并发函数,变量a中的值有可能还未改变
pln main $a

// 注意,这里的标号loop1虽然与并发函数中的同名,但由于运行在不同的虚拟机中,因此不会冲突,可以看做是两个标号
:loop1

    // 休眠1秒
    sleep #f1.0

    // 输出变量a中的值查看
    // 每隔一秒应该会变成新的时间
    pln a= $a

    // 跳转到标号loop1(实现无限循环)
    goto :loop1

代码中有详细的注释,主线程中启动了一个子线程,也就是调用了并发函数,看看运行效果:

a= 3.6
main 3.6
arg1= 0xc00017e350   
arg2= 前缀
外部的变量a的值为 3.6
sub 前缀
a= 2022-04-28 14:58:50.6204045 +0800 CST m=+0.014610101
sub 前缀
a= 2022-04-28 14:58:52.6308323 +0800 CST m=+2.025024001
a= 2022-04-28 14:58:52.6308323 +0800 CST m=+2.025024001
sub 前缀
a= 2022-04-28 14:58:54.6329674 +0800 CST m=+4.027145301
a= 2022-04-28 14:58:54.6329674 +0800 CST m=+4.027145301
sub 前缀
a= 2022-04-28 14:58:56.636559 +0800 CST m=+6.030723101
a= 2022-04-28 14:58:56.636559 +0800 CST m=+6.030723101
sub 前缀
a= 2022-04-28 14:58:58.6391475 +0800 CST m=+8.033297801
a= 2022-04-28 14:58:58.6391475 +0800 CST m=+8.033297801
exit status 0xc000013a

仔细观察程序的输出,可以看出并发函数中的输出每两秒1次,主线程中的输出每2秒一次,变量a中的值确实从最初的浮点数3.6到后来被并发函数变成了当前时间。

这个例子中也演示了对变量取引用与对引用解引用后取变量值的方法。

 

- 用线程锁处理并发共享冲突

 

谢语言中,对于同时运行的几个线程间共享某个变量,对其进行读取和修改时可能产生的并发冲突问题,可以使用线程锁来控制解决。参看下面的例子(lock.xie):

// 给变量a赋值整数0
// 变量a将在线程中运行的并发函数中被修改
assign $a #i0

// 创建一个线程锁对象放入变量lock1中
// 指令new用于创建谢语言中一些基础数据类型或宿主语言支持的对象
// 除结果变量外第一个参数为字符串类型的对象名称
new $lock1 lock

// 定义一个并发函数体func1(用字符串形式定义)
// 并发函数使用新的虚拟机运行,因此其中的变量名称不会与主程序冲突
// 双方只能通过堆栈进行交互,例如可以传入某变量的引用
// 以便在并发函数中对其进行修改
assign $func1 `
    // 弹栈两个传入的参数,注意不是逆序弹出的而是顺序弹出的
    pop $arg1
    pop $arg2

    // 创建一个循环变量i并赋以初值0
    assign $i #i0

    // 无限循环演示不停将外部传入的变量a值加1
    // loop1是用于循环的标号
    :loop1
        // 调用传入的线程锁变量的加锁方法(lock)
        // 此处变量arg2即为外部压栈传入的线程锁对象
        // 由于lock方法没有有意义的返回值,因此用内置变量drop将其丢弃
        method $drop $arg2 lock

        // 解引用变量a的引用,以便取得a中当前的值
        unref $aNew $arg1
    
        // 将其加1,结果放入变量result中
        add $result $aNew #i1

        // 将变量arg1指向的变量(即a)中的值赋为result中的值
        // assignRef的第一个参数必须是一个引用
        assignRef $arg1 $result

        // 调用线程锁的unlock方法将其解锁,以便其他线程可以访问
        method $drop $arg2 unlock

        // 循环变量加1
        inc $i

        // 判断循环变量i的值是否大于或等于5000
        // 即循环5000次
        // 判断结果值(布尔类型)放入变量r中
        >= $r $i #i5000        


        // 如果r值为真(true),则转到标号beforeReturn处
        if $r :beforeReturn

        // 跳转到标号loop1(实现无限循环)
        goto :loop1

    :beforeReturn
        // pass指令不进行任何操作,由于标号处必须至少有一条指令
        // 因此放置一条pass指令,实际上beforeReturn这里作用是结束线程的运行
        // 因为没有后续指令了
        pass
`

// 获取变量a的引用,结果入栈
// 将被传入并发函数中以修改a中的值
ref $push $a

// 再入栈线程锁对象,以便线程中用于控制并发冲突
push $lock1

// 调用并发函数
// 第一个参数表示需要压入并发函数所使用的堆栈中的值的数量(可以是用字符串表示的数字)
// 如果不需要传递参数,第一个参数可以省略
// 第二个参数是字符串形式的并发函数代码
goFunc 2 $func1

// 再启动一个相同的线程
ref $push $a
push $lock1
goFunc 2 $func1

// 主线程中输出变量a的值
// 此时刚开始启动并发函数,变量a中的值有可能还未改变
pln main $a

// 注意,这里的标号loop1虽然与并发函数中的同名,但由于运行在不同的虚拟机中,因此不会冲突,可以看做是两个标号
:loop1

    // 休眠1秒
    sleep #f1.0

    // 输出变量a中的值查看
    // 每隔一秒应该会变成新的时间
    pln main a= $a

    // 跳转到标号loop1(实现无限循环)
    goto :loop1

method指令用于调用对象的某个方法,这里是调用了线程锁的lock和unlock方法。method指令可以简写为mt。

如果没有对线程锁对象加锁、解锁的操作(可以注释上其中method $drop $arg2 lock与unlock这两条语句尝试),程序运行的结果将是不确定的数字,每次都有可能结果不同,这是因为两个线程各自存取变量a中的值产生的冲突所致。例如,当第一个线程取到了a的值为10,在将其加1但还没有来得及把值(11)赋回给a的时候,第二个线程获取了当时的a值10,也将其加1后赋回给a,然后线程1再把11赋给a,这样虽然两个线程各执行了一个a=a+1的操作,但其实效果相当于只执行了1次。这样,最后程序结果应该是a的值小于理论值10000。

加上线程锁后,结果每次都将是准确的10000,如下所示。

main 0
main a= 10000
main a= 10000
main a= 10000
main a= 10000
main a= 10000

 

- 对象机制

 

谢语言提供一个通用的可扩展的对象机制,来提供集成宿主语言基本能力和库函数优势的方法,对象可以自行编写,可以使用宿主语言也可以使用谢语言本身编写(建设中),同时,谢语言也已经提供了一些内置的对象供直接使用。

下面是使用内部对象string的一个例子(object.xie),这个对象非常简单,仅仅封装了一个字符串,但提供了一些成员方法来对其进行操作。

注意,谢语言的对象一般包含本体值(例如string对象就是其包含的字符串)及可以调用的成员方法,还可能包含成员变量。

// 新建一个string对象,赋以初值字符串“abc 123”,放入变量s中
newObj $s string `abc 123`

// 获取对象本体值,结果压栈
getObjValue $push $s

// 将弹栈值加上字符串“天气很好”,结果存入tmp
add $pop "天气很好"

// 输出tmp值供参考
pln $tmp

// 设置变量s中string对象的本体值为字符串“very”
setObjValue $s "very"

// 输出对象值供参考
pln $s

// 调用该对象的add方法,并传入参数字符串“ nice”
// 该方法将把该string对象的本体值加上传入的字符串
callObj $s add " nice"

// 再次输出对象值供参考
pln $s

// 调用该对象的trimSet方法,并传入参数字符串“ve”
// 该方法将把该string对象的本体值去掉头尾的字符v和e
// 直至头尾不是这两个字符任意之一
callObj $s trimSet "ve"

// 再次输出对象值供参考
pln $s


代码运行的结果是:

abc 123天气很好
very
very nice
ry nic

 

- 快速/宿主对象机制

 

谢语言也提供另一个new指令来实现快速的对象机制,也可以提供集成宿主语言基本能力和库函数优势的方法,对象使用上更简单。下面是一个例子(stringBuffer.xie),封装了一般语言中的可动态增长的字符串的功能。

// strBuf即Go语言中的strings.Builder
// 是一个可以动态向其中添加字符串的缓冲区
// 最后可以一次性获取所有写入的字符串为一个大字符串
new $bufT strBuf

// 调用bufT的append方法往其中写入字符串abc
// method(可以简写为mt)指令是调用对象的某个方法
// append/writeString/write方法实际上是一样的,都是向其中追加写入字符串
// 结果参数是$drop,因为一般用不到
method $drop $bufT append abc


// 使用双引号括起的字符串中间的转义符会被转义
method $drop $bufT writeString "\n"

mt $drop $bufT write 123

// 使用反引号括起的字符串中的转义符不会被转义
mt $drop $bufT append `\n`

// 用两种方式输出bufT中的内容供参考

// 调用bufT的str方法(也可以写作string、getStr等)获取其中的字符串
mt $rsT $bufT str

plo $rsT

// 直接用表达式来输出
pln ?`(?mt $tmp $bufT str)`


运行输出:

(string)abc
123\n
abc
123\n

 

- 时间处理

 

谢语言中的时间处理的主要方式,直接参看下面的代码(time.xie):

// 将变量t1赋值为当前时间
// #t后带空字符串或now都表示当前时间值
assign $t1 #t

// 输出t1中的值查看
plo $t1

// 用字符串表示时间
// “=”是指令assign的简写写法
= $t2 #t`2022-08-06 11:22:00`

pln t2= $t2

// 简化的字符串表示形式
= $t3 #t`20220807112200`

pl t3=%v $t3

// 带毫秒时间的表示方法
= $t4 #t`2022-08-06 11:22:00.019`

pl t4=%v $t4

// 时间的加减操作
// 与时间的计算,如果有数字参与运算(除了除法之外),一般都是以毫秒为单位
pl t2-3000毫秒=%v ?`$t2 - 3000`

pl t2+50000毫秒=%v ?`$t2 + 50000`

pl 当前时间+50000毫秒=%v ?`(?now) + 50000`

pl t3-t2=%v(毫秒) ?`$t3 - $t2`

// 注意,如果不用括号,表达式计算将严格从左到右,没有运算符的优先级
pl t3-t2=%v(小时) ?`$t3 - $t2 / #i1000 / #i60 / #i60`

// 时间的比较
pl `t2 < t3 ? %v` ?`$t2 < $t3`

pl `t2 >= t3 ? %v` ?`$t2 >= $t3`

pl `t4 == t3 ? %v` ?`$t4 == $t3`

pl `t1 != t3 ? %v` ?`$t1 != $t3`

// 用convert指令转换时间
convert $tr `2021-08-06 11:22:00` time

pln tr= $tr

// 用convert指令将时间转换为普通字符串
convert $s1 $tr str

pln s1= $s1

// 用convert指令将时间转换为特定格式的时间字符串
convert $s2 $tr timeStr `2006/01/02_15.04.05`

pln s2= $s2

// 用convert指令将时间转换为UNIX时间戳格式
convert $s3 $tr tick

pln s3= $s3

// 用convert指令将UNIX格式时间戳转换为时间
convert $t5 `1628220120000` time

pln t5= $t5

// UTC相关
// 用convert指令转换时间为UTC时区
convert $trUTC `2021-08-06 11:22:00` time -global

pln trUTC= $trUTC

nowUTC $t6

pln t6= $t6

timeToLocal $t7 $t6

pln t7= $t7

timeToGlobal $t8 $t7

pln t8= $t8

// 用var指令也可以定义一个时间类型变量
// 默认值是当前时间
var $t9 time

// 调用时间类型变量的addDate方法将其加上1个月
// 三个参数分别表示要加的年、月、日,可以是负数
// 结果还放回t9
mt $t9 $t9 addDate 0 1 0

// 调用时间类型变量的format函数将其格式化为字符串
// 格式参数参考[这里](https://pkg.go.dev/time#pkg-constants)
mt $result $t9 format "20060102"

// 应输出 t9: 20220825
pl "t9: %v" $result


运行后输出为:

(time.Time)2022-07-25 09:22:03.918723645 +0800 CST m=+0.014649799
t2= 2022-08-06 11:22:00 +0800 CST
t3=2022-08-07 11:22:00 +0800 CST
t4=2022-08-06 11:22:00.019 +0800 CST
t2-3000毫秒=2022-08-06 11:21:57 +0800 CST
t2+50000毫秒=2022-08-06 11:22:50 +0800 CST
当前时间+50000毫秒=2022-07-25 09:22:53.919167824 +0800 CST m=+50.015093974
t3-t2=86400000(毫秒)
t3-t2=24(小时)
t2 < t3 ? true
t2 >= t3 ? false
t4 == t3 ? false
t1 != t3 ? true
tr= 2021-08-06 11:22:00 +0800 CST
s1= 2021-08-06 11:22:00 +0800 CST
s2= 2021/08/06_11.22.00
s3= 1628220120000
t5= 2021-08-06 11:22:00 +0800 CST
trUTC= 2021-08-06 11:22:00 +0000 UTC
t6= 2022-07-25 01:22:03.919574126 +0000 UTC
t7= 2022-07-25 09:22:03.919574126 +0800 CST
t8= 2022-07-25 01:22:03.919574126 +0000 UTC
t9: 20220825

 

- 错误处理

 

谢语言使用一个简化的错误处理模式,参看下面的代码(onError.xie):



// 设置错误处理代码块为标号handler1处开始的代码块
// onError指令后如果不带参数,表示清空错误处理代码块
onError :handler1

// 故意计算1除以0的结果,将产生运行时异常
div #i1 #i0

// 此处代码正常情况应执行不到
// 但错误处理代码块将演示如何返回此处继续执行
:next1

// 输出一个提示信息
pln 计算完毕(错误处理完毕)

// 退出程序
exit

// 错误处理代码块
:handler1
    // 发生异常时,谢语言将会依次入栈出错时详细代码运行栈信息、错误提示信息和出错代码的行号
    // 错误处理代码块应该将这几个值弹栈后处理(或丢弃),注意顺序
    pop $lastLine
    pop $errMsg
    pop $detailG

    // 输出错误信息
    pl "代码运行到第%v行时发现错误:%v,详细信息:%v" $lastLine $errMsg $detailG

    // 跳转到指定代码位置继续执行
    goto :next1

关键点是使用onError指令,它带有一个参数,一般是如果代码运行发生异常时将要跳转到的错误处理代码块的标号。onError指令既是指定代码运行错误时,用于处理错误的代码块。这样,如果代码运行发生任何运行时错误,谢语言将会依次将出错时详细代码运行栈信息、错误提示信息和出错代码的行号压入堆栈,然后从该标号处开始执行。错误处理代码块一般需要先将几个压栈值出栈(注意要反序),然后进行相应的错误处理,最后可以选择跳转到指定位置执行,或者终止程序运行等操作。还有一种常用的处理方式是跳转到出错行号的下一个行号处继续执行。

本段代码的运行结果是:

代码运行到第1行时发现错误:runtime error: integer divide by zero
计算完毕(错误处理完毕)

 

- 关系数据库访问

 

谢语言主程序支持常见的关系型数据库的访问与操作,直接参看下面访问SQLite3数据库的代码例子(sqlite.xie):

// 判断是否存在该库(SQLite库是放在单一的文件中的)
// 注意请确保c:\tmp文件夹已存在
// 结果放入变量b中
fileExists $b `c:\tmpx\test.db`

// 如果否则跳到下一步继续执行
// 如果存在则删除该文件
// removeFile指令的运行结果将被丢弃(因为使用了内置全局变量drop)
ifNot $b :next
	removeFile $drop `c:\tmpx\test.db`

:next1
// 创建新库
// dbConnect用于连接数据库
// 除结果参数外第一个参数是数据库驱动名称,支持sqlite3、mysql、godror(即Oracle)、mssql(即MS SQLServer)等
// 第二个参数是连接字符串,类似 server=129.0.3.99;port=1433;portNumber=1433;user id=sa;password=pass123;database=hr 或 user/pass@129.0.9.11:1521/testdb 等
// SQLite3的驱动将基于文件创建或连接数据库
// 所以第二个参数直接给出数据库文件路径即可
dbConnect $db "sqlite3" `c:\tmpx\test.db`

// 判断创建(或连接)数据库是否失败
// rs中是布尔类型表示变量db是否是错误对象
// 如果是错误对象,errMsg中将是错误原因描述字符串
isErr $rs $db $errMsg

// 如果为否则继续执行,否则输出错误信息并退出
ifNot $rs :next2
	pl "创建数据库文件时发生错误:%v" $errMsg
	exit

:next2

// 将变量sqlStmt中放入要执行的建表SQL语句
assign $sqlStmt = `create table TEST (ID integer not null primary key, CODE text);`

// 执行SQL语句,dbExec用于执行insert、delete、update等SQL语句
dbExec $rs $db $sqlStmt

// 判断是否SQL执行出错,方式与前面连接数据库时类似
isErr $errStatus $rs $errMsg

ifNot $errStatus :next3
	pl "执行SQL语句建表时发生错误:%v" $errMsg

	// 出现错误时,因为数据库连接已打开,因此需要关闭
	dbClose $drop $db

	exit

:next3

// 进行循环,在库中插入5条记录
// i是循环变量
assign $i #i0

:loop1
assign $sql `insert into TEST(ID, CODE) values(?, ?)`

// genRandomStr指令用于产生随机字符串
genRandomStr $str1

dbExec $rs $db $sql $i $str1

isErr $errStatus $rs $errMsg

ifNot $errStatus :next4
	pl "执行SQL语句新增记录时发生错误:%v" $errMsg
	dbClose $drop $db

	exit

:next4
inc $i
< $i #i5
if $tmp :loop1

// 进行数据库查询,验证查看刚刚新增的记录
assign $sql `select ID, CODE from TEST`

// dbQuery指令用于执行一条查询(select)语句
// 结果将是一个数组,数组中每一项代表查询结果集中的一条记录
// 每条记录是一个映射,键名对应于数据库中的字段名,键值是相应的字段值,但均转换成字符串类型
dbQuery $rs $db $sql

// dbClose指令用于关闭数据库连接
dbClose $drop $db

pln $rs

// 用toJson指令将结果集转换为JSON格式以便输出查看
toJson $jsonStr $rs -indent -sort

pln $jsonStr


执行结果是(确保c:\tmpx目录已经存在):

[map[CODE:YRKOEt ID:0] map[CODE:moODkc ID:1] map[CODE:we7Ey9 ID:2] map[CODE:fF7dRd ID:3] map[CODE:9X6KAu ID:4]]
[
  {
    "CODE": "YRKOEt",
    "ID": "0"
  },
  {
    "CODE": "moODkc",
    "ID": "1"
  },
  {
    "CODE": "we7Ey9",
    "ID": "2"
  },
  {
    "CODE": "fF7dRd",
    "ID": "3"
  },
  {
    "CODE": "9X6KAu",
    "ID": "4"
  }
]

可以看到,数据库中被新增了5条记录,并查询成功。

 

- 微服务/应用服务器

 

谢语言主程序自带一个服务器模式,支持一个轻量级的WEB/应用/API三合一服务器。可以用下面的命令行启动:

D:\tmp>xie -server -dir=scripts
[2022/04/30 17:18:11] 谢语言微服务框架 版本0.0.6 -port=:80 -sslPort=:443 -dir=scripts -webDir=scripts -certDir=.
[2022/04/30 17:18:11] 在端口:443上启动https服务...
在端口:80上启动http服务 ...
[2022/04/30 17:18:11] 启动https服务失败:open server.crt: The system cannot find the file specified.

可以看到,谢语言的服务器模式可以用-server参数启动,并可以用-port参数指定HTTP服务端口(注意加冒号),用-sslPort指定SSL端口,-certDir用于指定SSL服务的证书文件目录(应为server.crt和server.key两个文件),用-dir指定服务的根目录,-webDir用于指定静态页面和资源的WEB服务。这些参数均有默认值,不输入任何参数可以看到。

输出信息中的错误是因为没有提供SSL整数,SSL服务将启动不了,加上证书就可以了。

此时,用浏览器访问本机的http://127.0.0.1:80就可以访问一个谢语言编写的网页服务了。

假设在指定的目录下包含xmsIndex.xie、xmsTmpl.html、xmsApi.xie三个文件,可以展示出谢语言建立的应用服务器支持的各种模式。

首先浏览器访问 http://127.0.0.1/xmsTmpl.html ,这将是访问一般的WEB服务,因为WEB目录默认与服务器根目录相同,所以将展示根目录下的xmsTmpl.html这个静态文件,也就是一个例子网页。

截图 截图

可以看到,该网页文件中文字“请按按钮”后的“{{text1}}”标记,这是我们后面展示动态网页功能时所需要替换的标记。xmsTmpl.html文件的内容如下:

<html>
<body>
    <script>
        function test() {
            let xhr = new XMLHttpRequest();

            xhr.open('POST', 'http://127.0.0.1:80/xms/xmsApi', true);

            xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")

            xhr.onload = function(){
                alert(xhr.responseText);
            }

            xhr.send("param1=abc&param2=123");
        }
    </script>

    <div>
        <span>请按按钮{{text1}}:</span><button onclick="javascript:test();">按钮1</button>
    </div>

</body>
</html>

然后我们尝试进行动态网页输出,也就是类似PHP、ASP或其他类似的架构支持的后台动态渲染网页的方式。访问 http://127.0.0.1/xms/xmsIndex ,URL中加上xms路径,这是一个虚拟路径,表示服务器将去根目录下寻找xmsIndex.xie文件来执行,该代码将输出网页内容。我们来看下xmsIndex.xie文件的内部。

// 设定默认的全局返回值变量outG为字符串TX_END_RESPONSE_XT
// 默认谢语言服务器如果收到处理请求的函数返回结果是TX_END_RESPONSE_XT
// 将会终止处理,否则将把返回值作为字符串输出到网页上
assign $outG "TX_END_RESPONSE_XT"

// 获得相应的网页模板
// joinPath指令将把多个文件路径合并成一个完整的文件路径
// 第一个参数表示结果将要放入的变量,这里的$push表示压栈
// basePathG是内置全局变量,表示服务的根目录
joinPath $push $basePathG `xmsTmpl.html`

pln $basePathG
pln $peek

// 将该文件作为文本字符串载入,结果压栈
loadText $push $pop

// 替换其中的{{text1}}标记为字母A
strReplace $push $pop "{{text1}}" "A"

// 将弹栈值写网页输出
// responseG也是内置的全局变量,表示要写入的网页输出对象
writeResp $responseG $pop

// 终止请求响应处理微服务
exit

谢语言服务器模式中,每一个http请求都将单开一个虚拟机进行处理,可以看做一个微服务的概念。例子中的微服务仅仅是将载入的网页模板中的指定标记替换掉然后输出到网页,虽然简单,但已经展现出了动态网页的基本原理,即能够在输出网页前进行必要的、可控的渲染。

我们访问 http://127.0.0.1/xms/xmsIndex 这个网址(或者叫URL路径),将会看到如下结果:

截图 截图

可以发现原来的标记确实被替换成了大写的字母A,验证了动态网页的效果。

再看上面的网页模板文件xmsTmpl.html,其中的按钮点击后将执行JavaScript函数test,其中进行了一个AJAX请求,然后将请求的结果用alert函数输出出来。这是一个典型的客户端访问后台API服务的例子,我们来看看如何实现这个后台API服务。下面是也在服务器根目录下的xmsApi.xie文件中的内容:

// 获取当前时间放入变量t
nowStr $t

// 输出参考信息
// 其中reqNameG是内置全局变量,表示服务名,也就是访问URL中最后的部分
// argsG也是全局变量,表示HTTP请求包含的URL参数或Form参数(可以是GET请求或POST请求中的)
pl `[%v] %v args: %v` $t $reqNameG $argsG

// 设置输出响应头信息(JSON格式)
setRespHeader $responseG "Content-Type" "text/json; charset=utf-8"

// 写响应状态为整数200(HTTP_OK),表示是成功的请求响应
writeRespHeader $responseG #i200

// 用spr指令拼装响应字符串
spr $push "请求是:%v,参数是:%v" $reqNameG $argsG

// 用genJsonResp生成封装的JSON响应,也可以自行输出其他格式的字符串
genJsonResp $push $requestG "success" $pop

// 将响应字符串写输出(到网页)
writeResp $responseG $pop

// 结束处理函数,并返回TX_END_RESPONSE_XT以终止响应流的继续输出
exit TX_END_RESPONSE_XT

这样,我们如果点击网页中的按钮1,会得到如下的alert弹框:

截图 截图

这是因为网页xmsTmpl.html中,通过AJAX访问了 http://127.0.0.1:80/xms/xmsApi 这个服务,而我们的谢语言服务器会寻找到xmsApi.xie(自动加上了.xie文件名后缀)并执行,因此会输出我们希望的内容。

至此,一个麻雀虽小五脏俱全的WEB/应用/API多合一服务器的例子就完整展现出来了,已经足够一般小型的应用服务,并且基本无外部依赖,部署也很方便,只需一个主程序以及拷贝相应目录即可。

 

- 网络(HTTP)客户端

 

用谢语言实现一个网络客户端也非常容易,以上面的网络服务端为例,访问这些服务的客户端代码(httpClient.xie)如下:

// getWeb指令可以用于各种基于HTTP的网络请求,
// 此处是获取某URL处的网页内容
// 第一个参数pageT用于存放访问的结果内容
// -timeout参数用于指定超时时间,单位是秒
getWeb $pageT "http://127.0.0.1/xms/xmsIndex" -timeout=15

// 输出获取到的内容参考
pln $pageT

// 定义一个映射类型的变量mapT
// 用于存放准备POST的参数
var $mapT map

// 设置示例的POST参数
setMapItem $mapT param1 value1
setMapItem $mapT param2 value2

// 输出映射内容参考
pln $mapT

// 以POST的方式来访问WEB API
// getWeb指令除了第一个参数必须是返回结果的变量,
// 第二个参数是访问的URL,其他所有参数都是可选的
// method还可以是GET等
// encoding用于指定返回信息的编码形式,例如GB2312、GBK、UTF-8等
// headers是一个JSON格式的字符串,表示需要加上的自定义的请求头内容键值对
// 参数中可以有一个映射类型的变量或值,表示需要POST到服务器的参数
getWeb $resultT "http://127.0.0.1:80/xms/xmsApi" -method=POST -encoding=UTF-8 -timeout=15 -headers=`{"Content-Type": "application/json"}` $mapT

// 查看结果
pln $resultT


示例中演示了直接获取网页和用POST形式访问API服务的方法,运行效果如下:

<html>
<body>
    <script>
        function test() {
            let xhr = new XMLHttpRequest();

            xhr.open('POST', 'http://127.0.0.1:80/xms/xmsApi', true);

            xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")

            xhr.onload = function(){
                alert(xhr.responseText);
            }

            xhr.send("param1=abc&param2=123");
        }
    </script>

    <div>
        <span>请按按钮A:</span><button onclick="javascript:test();">按钮1</button>
    </div>

</body>
</html>
map[param1:value1 param2:value2]
{"Status":"success","Value":"请求是:xmsApi,参数是:map[param1:value1 param2:value2]"}

可以看到,程序顺利获得到了所需的服务器响应。

 

- 手动编写Api服务器

 

谢语言也支持自己手动编写各种基于HTTP的服务器,下面是一个API服务器的例子(apiServer.xie):

// 新建一个路由处理器
newMux $muxT

// 设置处理路由“/test”的处理函数
// 第4个参数是字符串类型的处理函数代码
// 将以新的虚拟机运行
// 虚拟机内将默认有4个全局变量:
// requestG 表示http请求对象
// responseG 表示http响应对象
// paraMapG 表示http请求传入的query参数或post参数
// inputG 是调用setMuxHandler指令传入的第3个参数的值
setMuxHandler $muxT "/test" #i123 `

// 输出参考信息
pln "/test" $paraMapG

// 拼装输出的信息字符串
// spr类似于其他语言中的sprintf函数
spr $strT "[%v] 请求名: test,请求参数: %v,inputG:%v" ?(?nowStr) $paraMapG $inputG

// 设置输出的http响应头中的键值对
setRespHeader $responseG "Content-Type" "text/json; charset=utf-8"

// 设置输出http响应的状态值为200(表示成功,即HTTP_OK)
writeRespHeader $responseG 200

// 准备一个映射对象用于拼装返回结果的JSON字符串
var $resMapT map

setMapItem $resMapT "Status" "success"
setMapItem $resMapT "Value" $strT

toJson $jsonStrT $resMapT

// 写http响应内容,即前面拼装并转换的变量jsonStrT中的JSON字符串
writeResp $responseG $jsonStrT

// 设置函数返回值为TX_END_RESPONSE_XT
// 此时响应将中止输出,否则将会把该返回值输出到响应中
assign $outG  "TX_END_RESPONSE_XT"

`

pln 启动服务器……

// 在端口8080上启动http服务器
// 指定路由处理器为muxT
// 结果放入变量resultT中
// 由于startHttpServer如果执行成功是阻塞的
// 因此resultT只有失败或被Ctrl-C中断时才会有值
startHttpServer $resultT ":8080" $muxT


运行后,用浏览器访问下面的网址进行测试:

http://127.0.0.1:8080/test?param1=abc&param2=123

可以看到网页中会显示类似下面的JSON格式的输出:

{
  "Status": "success",
  "Value": "[2022-05-17 15:11:57] 请求名: test,请求参数: map[param1:abc param2:123],inputG:123"
}

当然,一般API服务都是用编程的形式而非浏览器访问,用浏览器比较适合做简单的测试。

 

- 静态WEB服务器

 

谢语言实现静态WEB服务器则更为简单,见下例(webServer.xie):

// 新建一个路由处理器
newMux $muxT

// 设置处理路由“/static/”后的URL为静态资源服务
// 第3个参数是对应的本地文件路径
// 例如:访问 http://127.0.0.1:8080/static/basic.xie
// 而当前目录是c:\tmp,那么实际上将获得c:\scripts\basic.xie
setMuxStaticDir $muxT "/static/" "./scripts" 

pln 启动服务器……

// 在端口8080上启动http服务器
// 指定路由处理器为muxT
// 结果放入变量resultT中
// 由于startHttpServer如果执行成功是阻塞的
// 因此resultT只有失败或被Ctrl-C中断时才会有值
startHttpServer $resultT ":8080" $muxT

运行后,访问http://127.0.0.1:8080/static/basic.xie,将获得类似下面的结果:

// 本例演示做简单的加法操作

// 将变量x赋值为浮点数1.8
assign $x #f1.8

// 将变量x中的值加上浮点数2
// 结果压入堆栈
add $push $x #f2

// 将堆栈顶部的值弹出到变量y
pop $y

// 将变量x与变量y中的值相加,结果压栈
add $push $x $y

// 弹出栈顶值并将其输出查看
// pln指令相当于其他语言中的println函数
pln $pop

实际上读取了当前目录的scripts子目录下的basic.xie文件展示。

 

- 动态网页服务器

 

如果想要实现动态网页服务器,类似PHP、JSP、ASP等,可以参考之前的微服务/应用服务器和手动编写API服务器等例子,很容易实现。

 

- 博客系统

 

谢语言内置已经具备能力实现一个简单的博客系统。博客系统对比一般的网站服务器,主要需要增加下面几个功能:

  • 支持注册、登录与鉴权
  • 支持编辑文章
  • 支持将特定格式的文章渲染成网页以便展示

下面我们就举例说明谢语言实现一个最简单博客系统的方法。

首先,我们先建立一个登录服务(登录页面此处略去,有了登录服务接口,登录网页很容易就可以实现)。登录服务的目的是在用户成功登录以后获取一个令牌(token),此后在需要令牌鉴权的时候(例如编辑文章)会需要将该令牌传入。例子如下:

goto :main

:fail1

    spr $tmps "empty %v" $fail1Reason

    genResp $result $requestG "fail" $tmps

    writeResp $responseG $result

    exit

:fail2

    spr $tmps "require SSL"

    genResp $result $requestG "fail" $tmps

    writeResp $responseG $result

    exit

:fail3

    spr $tmps "%v" $fail1Reason

    genResp $result $requestG "fail" $tmps

    writeResp $responseG $result

    exit

:handler1
    pop $lastLine
    pop $errMsg
    pop $detail

    pl "代码运行到第%v行时发现错误:%v(%v)" $lastLine $errMsg $detail

    spr $failMsg "internal error(line %v): %v(%v)" $lastLine $errMsg $detail

    genResp $result $requestG "fail" $failMsg

    writeResp $responseG $result

    exit

:main

onError :handler1

= $outG "TX_END_RESPONSE_XT"

setRespHeader $responseG "Content-Type" "text/json; charset=utf-8"

writeRespHeader $responseG #i200

pl "[%v] %v params: %v" ?(?nowStr) $reqNameG $paraMapG

mb $urlT $requestG URL

# pl urlT:%#v $urlT

mb $schemeT $requestG Scheme

# pln schemeT $schemeT

mb $protoT $requestG Proto

# pln protoT $protoT

mb $tlsT $requestG TLS

isNil $tlsT

if $tmp :fail2

# plv $requestG

getMapItem $appCode $paraMapG app

# plv $appCode

= $fail1Reason appCode

if ?`($appCode == $undefined)` :fail1

getMapItem $user $paraMapG u

= $fail1Reason user

if ?`(?isUndef $push $user)` :fail1

getMapItem $password $paraMapG p ""

= $fail1Reason password

if ?`($password == "")` :fail1

= $fail1Reason "password not match"

// 此处控制密码的校验
if ?`($password != "abc123")` :fail3

getMapItem $secret $paraMapG secret ""
# pln ?`("-secret=" + $secret)`

genToken $result $appCode $user admin ?`(? ifThenElse (? == $secret "") "" ("-secret=" + $secret))`

genResp $result $requestG "success" $result debug ?`(? ifThenElse (? == $secret "") "" ("-secret=" + $secret))`

writeResp $responseG $result

exit

获取令牌的方法如下(为了安全起见,代码限制了必须用https访问,另外参数最好使用POST方式传递,这里为了演示方便,采用了GET方式):

https://auth.example.com/xms/xlogin?app=app1&u=userName&p=password&secret=sdf789

其中,app是应用名称,可以自己设定,u是用户名,p是密码,secret是令牌加密秘钥(可以省略)。返回信息类似下面:

{
  "Status": "success",
  "Value": "9DCA7F736D56758385877E8A6E628D92727F848B7D81534E4B554F614943595E56635867",
  "debug": ""
}

Value字段中是后面可用的令牌。

然后,我们来架设博客服务。以Linux服务器为例,假定我们在/mnt/xms实现我们的博客服务,我们以下面的命令启动谢语言服务器:

xie -server -port=:80 -sslPort=:443 -dir=/mnt/xms -webDir=/mnt/web -certDir=/mnt/cert -verbose

此时/mnt/web下为我们的静态网页文件,/mnt/xms下为我们的动态网页文件,SSL证书放在/mnt/cert(因为server.crt和server.key两个文件)。一个特殊的约定是,/mnt/xms目录下的doxc.xie文件默认为博客处理的代码文件,访问http://blog.example.com/xc/test这样的请求时,将被交给doxc.xie来处理。因此我们根据自己需要修改该文件即可,一个典型例子如下:

// 设置默认返回值为TX_END_RESPONSE_XT以避免多余的网页输出
= $outG "TX_END_RESPONSE_XT"

pl "[%v] %v params: %v" ?(?nowStr) $reqNameG $paraMapG

// 设定错误和提示页面的HTML,其中的TX_main_XT等标记将被替换为有意义的内容
= $infoTmpl `
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title></title>
</head>
<body>
    <div style="text-align: center;">
        <div id="main" style="witdth: 60%; margin-top: 3.0em; font-weight: bold; font-size: 2.0em; color: TX_mainColor_XT;">
            TX_main_XT
        </div>
        <div id="info" style="witdth: 90%; margin-top: 3.0em; font-size: 1.5em;">
            TX_info_XT
        </div>
    </div>
</body>
</html>
`

// 下面放置一些快速调用的函数,因此直接跳转到main标号执行主程序代码
goto :main

// 用于输出错误提示页面的函数
:fatalReturn

    strReplace $result $infoTmpl TX_info_XT $pop

    strReplace $result $result TX_main_XT $pop

    strReplace $result $result TX_mainColor_XT "#FF1111"

    writeResp $responseG $result

    exit

    fastRet

// 用于输出信息提示页面的函数
:infoReturn

    strReplace $result $infoTmpl TX_info_XT $pop

    strReplace $result $result TX_main_XT $pop

    strReplace $result $result TX_mainColor_XT "#32CD32"

    writeResp $responseG $result

    exit

    fastRet

// 主函数代码入口
:main

// 新建一个字符串缓冲区(即可变长字符串)用于输出调试信息
new $debuf strBuf

// reqNameG预设全局变量中存放的是请求路由
// 例如,访问http://example.com/xms/h/test/a1
// 则reqNameG为h/test/a1
// 将其分割为h和test/a1两段
strSplit $listT $reqNameG "/" 2

// 加入调试信息
mt $drop $debuf append $listT

// 获取子请求的第一部分(本例中为h)
getItem $subReqT $listT 0

// 获取子请求的第二部分(本例中为test/a1)
getItem $subReqArgsT $listT 1

pln subReqT: `'` $subReqT `'`

// 如果子请求(第一部分)为edit则表示编辑该页面
ifEval `$subReqT == "edit"` +1 :next1
    # fastCall :infoReturn $subReqT $basePathG
    # exit

    setRespHeader $responseG "Content-Type" "text/html; charset=utf-8"

    writeRespHeader $responseG #i200

    // 检查token
    getMapItem $tokenT $paraMapG txtoken

    checkToken $r0 $tokenT -sercret=sdf789

    isErrX $r1 $r0 $msgT

    if $r1 +1 +2
        fastCall :fatalReturn 鉴权失败 $msgT
    
    pln token: $r0

    strSplit $list1T $r0 "|"

    getItem $userNameT $list1T 1

    // 只允许用户名为admin的用户操作
    == $userNameT "admin"

    if $tmp :inext2
        fastCall :fatalReturn 鉴权失败 用户不存在

    // 获取文件绝对路径
    :inext2
    strTrim $relDirT $subReqArgsT

    joinPath $absPathT $basePathG wk $relDirT

    pln absPathT: $absPathT

    // 获取post参数ta1,如果存在则表示是保存

    getMapItem $ta1T $paraMapG ta1

    isUndef $push $ta1T

    if $pop :inext4 
        // 保存文件

        extractFileDir $push $absPathT

        ensureMakeDirs $push $pop

        isErrX $errT $pop $msgT

        if $errT +1 +2
            fastCall :fatalReturn 创建目录失败 $msgT

        saveText $push $ta1T  $absPathT

        isErrX $errT $pop $msgT

        if $errT +1 +2
            fastCall :fatalReturn 保存文件失败 $msgT

    // 读取原有文件并展示
    :inext4
    ifFileExists $b1 $absPathT

    = $fcT ""

    ifNot $b1 +2
        loadText $fcT $absPathT

    // 编辑页面模板
    = $editTmplT `
    <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title></title>
<script type="text/javascript" src="/js/jquery.min.js"></script>
<script>
	$().ready(function() {
        $("textarea").on(
            'keydown',
            function(e) {
                if (e.keyCode == 9) {
                    e.preventDefault();
                    var indent = "\t";
                    var start = this.selectionStart;
                    var end = this.selectionEnd;
                    var selected = window.getSelection().toString();
                    selected = indent + selected.replace(/\n/g, '\n' + indent);
                    this.value = this.value.substring(0, start) + selected
                            + this.value.substring(end);
                    this.setSelectionRange(start + indent.length, start
                            + selected.length);
                }
            });
	});
</script>
</head>
<body>
<div id="div1" style="text-align: center; width: 100%; height: 100%;">
    <div style="width: 60%; margin: 0 auto; font-weight: bold; font-size: 2.0em;">
        <p>TX_filePath_XT</p>
    </div>
    <form method="POST">
        <div id="main" style="width: 80%; margin: 0 auto; height: 100%;">
            <textarea id="ta1" name="ta1" style="width: 100%; height: 30em; font-size: 1.5em;">TX_textAreaValue_XT</textarea>
        </div>
        <div style="width: 60%; margin: 0 auto; font-weight: bold; font-size: 2.0em;">
            <button type="submit">保存</button>
        </div>
    </form>
</div>
</body>
</html>
    `

    htmlEncode $rs1 $fcT

    strReplace $rs2 $editTmplT TX_textAreaValue_XT $rs1
    strReplace $rs2 $rs2 TX_filePath_XT $relDirT

    writeResp $responseG $rs2

    exit
    # fastCall :infoReturn $absPathT $fcT

:next1
# dumpf labels

// 如果子请求为h,则表示以网页形式输出页面
ifEval `$subReqT == "h"` +1 :next2

    setRespHeader $responseG "Content-Type" "text/html; charset=utf-8"

    writeRespHeader $responseG #i200

    // 获取文件绝对路径
    strTrim $relDirT $subReqArgsT

    joinPath $absPathT $basePathG wk $relDirT

    pln absPathT: $absPathT

    strEndsWith $b2T $absPathT ".html" ".htm"

    if $b2T :inext5
        + $absPathT $absPathT ".html"

    :inext5
    loadText $fcT $absPathT

    isErrX $errT $fcT $msgT

    if $errT +1 +2
        fastCall :fatalReturn 操作失败 $msgT

    writeResp $responseG $fcT
    exit

:next2

// 如果子请求为t,则表示以纯文本形式输出页面
ifEval `$subReqT == "t"` +1 :next3

    // 获取文件绝对路径
    strTrim $relDirT $subReqArgsT

    joinPath $absPathT $basePathG wk $relDirT

    pln absPathT: $absPathT

    loadText $fcT $absPathT

    isErrX $errT $fcT $msgT

    if $errT +1 +2
        fastCall :fatalReturn 操作失败 $msgT

    setRespHeader $responseG "Content-Type" "text/plain; charset=utf-8"

    writeRespHeader $responseG #i200

    writeResp $responseG $fcT
    exit

:next3

// 如果子请求为md,则表示以markdown形式渲染后输出页面
ifEval `$subReqT == "md"` +1 :next4

    // 获取文件绝对路径
    strTrim $relDirT $subReqArgsT

    joinPath $absPathT $basePathG wk $relDirT

    pln absPathT: $absPathT

    strEndsWith $b2T $absPathT ".md"

    if $b2T :inext3
        + $absPathT $absPathT ".md"

    :inext3
    loadText $fcT $absPathT

    isErrX $errT $fcT $msgT

    if $errT +1 +2
        fastCall :fatalReturn 操作失败 $msgT

    renderMarkdown $fcT $fcT

    setRespHeader $responseG "Content-Type" "text/html; charset=utf-8"

    writeRespHeader $responseG #i200

    writeResp $responseG $fcT
    exit

:next4

// 如果子请求为editxms,则表示以编辑谢语言代码
ifEval `$subReqT == "editxms"` +1 :next5

    setRespHeader $responseG "Content-Type" "text/html; charset=utf-8"

    writeRespHeader $responseG #i200

    // 检查token
    getMapItem $tokenT $paraMapG txtoken

    checkToken $r0 $tokenT

    isErrX $r1 $r0 $msgT

    if $r1 +1 +2
        fastCall :fatalReturn 鉴权失败 $msgT
    
    pln token: $r0

    strSplit $list1T $r0 "|"

    getItem $userNameT $list1T 1

    == $userNameT "admin"

    if $tmp :inext6
        fastCall :fatalReturn 鉴权失败 用户不存在

    // 获取文件绝对路径
    :inext6
    strTrim $relDirT $subReqArgsT

    joinPath $absPathT $basePathG x $relDirT

    pln absPathT: $absPathT

    // 获取post参数ta1,如果存在则表示是保存

    getMapItem $ta1T $paraMapG ta1

    isUndef $push $ta1T

    if $pop :inext7 
        // 保存文件

        extractFileDir $push $absPathT

        ensureMakeDirs $push $pop

        isErrX $errT $pop $msgT

        if $errT +1 +2
            fastCall :fatalReturn 创建目录失败 $msgT

        saveText $push $ta1T  $absPathT

        isErrX $errT $pop $msgT

        if $errT +1 +2
            fastCall :fatalReturn 保存文件失败 $msgT

    // 读取原有文件并展示
    :inext7
    ifFileExists $b1 $absPathT

    = $fcT ""

    ifNot $b1 +2
        loadText $fcT $absPathT

    = $editTmplT `
    <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title></title>
<script type="text/javascript" src="/js/jquery.min.js"></script>
<script>
	$().ready(function() {
        $("textarea").on(
            'keydown',
            function(e) {
                if (e.keyCode == 9) {
                    e.preventDefault();
                    var indent = "\t";
                    var start = this.selectionStart;
                    var end = this.selectionEnd;
                    var selected = window.getSelection().toString();
                    selected = indent + selected.replace(/\n/g, '\n' + indent);
                    this.value = this.value.substring(0, start) + selected
                            + this.value.substring(end);
                    this.setSelectionRange(start + indent.length, start
                            + selected.length);
                }
            });
	});
</script>
</head>
<body>
<div id="div1" style="text-align: center; width: 100%; height: 100%;">
    <div style="width: 60%; margin: 0 auto; font-weight: bold; font-size: 2.0em;">
        <p>TX_filePath_XT</p>
    </div>
    <form method="POST">
        <div id="main" style="width: 80%; margin: 0 auto; height: 100%;">
            <textarea id="ta1" name="ta1" style="width: 100%; height: 30em; font-size: 1.5em;">TX_textAreaValue_XT</textarea>
        </div>
        <div style="width: 60%; margin: 0 auto; font-weight: bold; font-size: 2.0em;">
            <button type="submit">保存</button>
        </div>
    </form>
</div>
</body>
</html>
    `

    htmlEncode $rs1 $fcT

    strReplace $rs2 $editTmplT TX_textAreaValue_XT $rs1
    strReplace $rs2 $rs2 TX_filePath_XT $relDirT

    writeResp $responseG $rs2

    exit
 
:next5

# push 测试
# push 详细信息

fastCall :infoReturn 未知请求 $subReqT

exit

运行后,先登录xlogin网页获得token,然后访问类似(域名替换成自己的) http://blog.example.com/xc/edit/abc.md (注意要带上URL参数txtoken=自己刚刚登录获得的token),即可编辑Markdown格式的文件内容,位置在服务器/mnt/xms/wk目录下的abd.md文件。编辑后保存。然后访问 http://blog.example.com/xc/md/abc 即可访问渲染后的网页,同理 http://blog.example.com/xc/t/abc 可访问纯文本格式的abc.txt文件, http://blog.example.com/xc/h/abc 可访问网页格式的abc.html文件。 http://blog.example.com/xc/editxms/abc.xie 则是编辑一个谢语言代码文件,该文件保存后位于/mnt/xms/x目录下,之后可以用 http://blog.example.com/xms/x/abc 来访问该服务。一个例子文件如下,

= $outG "TX_END_RESPONSE_XT"

setRespHeader $responseG "Content-Type" "text/json; charset=utf-8"

writeRespHeader $responseG #i200

pl "[%v] %v params: %v" ?(?nowStr) $reqNameG $paraMapG

genResp $rs $requestG success test

writeResp $responseG $rs

exit

还可以进一步扩展功能,但一个简单的博客系统或者叫CMS(内容管理系统)已经搭建成了。

 

- 嵌套运行谢语言代码

 

谢语言中也可以另起一个虚拟机执行一段谢语言代码(即嵌套执行),某些情况下,这会是个很方便的功能。示例如下(runCode.xie):

// 设定传入参数inputT,在虚拟机中通过全局变量inputG访问
assign $inputT #L`[{"name": "tom", "age": 25}, 15]`

// 用runCode指令运行代码
// 代码将在新的虚拟机中执行
// 除结果参数(不可省略)外,第一个参数是字符串类型的代码(必选,后面参数都是可选)
// 第二个参数为任意类型的传入虚拟机的参数(虚拟机内通过inputG全局变量来获取该参数)
// 再后面的参数可以是一个字符串数组类型的变量或者多个字符串类型的变量,虚拟机内通过argsG(字符串数组)来对其进行访问
runCode $result `

// 输出inputG供参考
pln "inputG=" $inputG

// 获取inputG中的第二项(序号为1,值为数字15)
getItem $item2 $inputG 1

plo $item2

// 由于数字可能被JSON解析为浮点数,因此将其转换为整数
toInt $item2 $item2

// 从argsG中获取第一项(序号为0)
getItem $v3 $argsG 0

// 由于argsG中每一项都是字符串,因此将其转换为整数
toInt $v3 $v3

// 从argsG中获取第二项(序号为1)
getItem $v4 $argsG 1

toInt $v4 $v4

// 定义一个变量a并赋值为整数6
assign $a #i6

// 用eval指令计算几个数相加的值,结果入栈
// 由于虚拟机已经用了反引号括起代码
// 因此可以用双引号括起表达式以免冲突
eval "$a + $item2 + $v3 + $v4"

// 设置虚拟机的返回值
assign $outG $tmp

` $inputT 22 9

// 最后结果应为52
pln result= $result

需要注意的是输入参数和输出参数的运用方法,以及在嵌入代码中尽量避免使用反引号。

运行结果如下:

inputG= [map[age:25 name:tom] 15]
(float64)15
result= 52

 

图形界面(GUI)编程

谢语言支持方便的图形界面编程,通过 Sciter 等第三方库实现,Windows下只需要一个动态链接库文件(sciter.dll),Linux下的配置请参考这里。通过下面基本说明和几个例子可以快速了解掌握。

 

谢语言GUI编程的基础

谢语言主要通过第三方图形界面库Sciter来支持跨平台的GUI编程。以Windows系统下为例,除谢语言主程序文件外,只需要一个动态链接库文件(sciter.dll),即可完美支持图形界面编程。Sciter使用标准的HTML、CSS以及类似JavaScript的TiScript脚本语言,来实现图形界面的展示和操控,谢语言则负责后台逻辑的处理,两者之间可以互通,谢语言通过特定的接口方式可以调用TiScript中的函数传递数据并进行操作,反之亦然,TiScript也可以调用谢语言中的特定函数。基本熟悉网页编程的开发者都可以很方便地上手。

谢语言使用GUI功能时,均需使用initGui命令来初始化环境,如果此时系统中没有Sciter的动态链接库文件,将会自动下载到主程序相同的路径下(也可以自行在谢语言官网下载后放到该位置)。谢语言中还有一个预置全局变量$guiG,用于作为调用GUI功能的接口对象。

下面我们通过一些例子逐步说明谢语言中GUI编程的方法。

 

- 简单的计算器

我们直接通过一个代码例子(calculator.xie)来了解:

// $guiG是预置的全局变量,作为GUI编程的接口对象
// 一般的图形界面操作,都通过调用该对象的各种方法来实现
// 所有GUI程序,都应该先调用guiG变量的init方法来进行图形界面环境的初始化
// 此时,如果在Windows下,如果系统中没有安装图形界面库,
// init方法将自动下载所需的动态链接库文件到主程序路径下
// 然后再进行环境初始化
mt $rs $guiG init

// 定义用于界面展示的HTML网页代码,放在htmlT变量中
// HTML和CSS代码都是标准的,脚本语言是TiScript,类似JavaScript
// 本例中定义了一个文本输入框用于输入表达式算式
// 以及“计算”和“关闭”两个按钮
// 并定义了两个按钮对应的处理脚本函数
// “确定”按钮将调用TiScript的eval函数来进行表达式计算
// 然后将计算结果传递给谢语言代码(通过调用谢语言预定义的delegateDo函数)
// “关闭”按钮将关闭整个窗口
assign $htmlT `
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>计算器</title>
</head>
<body>
	<div style="margin-top: 10px; margin-bottom: 10px;">
		<span>请输入算式:</span>
	</div>
	<div style="margin-top: 10px; margin-bottom: 10px;">
		<input id="mainInputID" type=text />
	</div>
	<div>
		<button id="btnCal">计算</button>
		<button id="btnClose">关闭</button>
	</div>

    <script type="text/tiscript">
        $(#btnCal).on("click", function() {
			var result = eval($(#mainInputID).value);

			view.delegateDo(String.printf("%v", result));

            $(#mainInputID).value = result;
        });
 
        $(#btnClose).on("click", function() {
            view.close();
        });
 
    </script>
</body>
</html>
`

// 调用guiG的newWindow方法创建一个窗口
// newWindow方法需要有三个参数,第一个是窗口标题
// 第二个是字符串形式的值用于指定窗口大小,空字符串表示按默认区域
// 如果使用类似“[200,300,600,400]”的字符串,则表明窗口位于屏幕坐标(200,300)处,宽高位600*400
// 第三个参数为用于界面展示的字符串
// 结果放入变量windowT中,这是一个特殊类型的对象(后面暂称为window对象)
// 后面我们还将调用该对象的一些方法进行进一步的界面控制
mt $windowT $guiG newWindow 计算器 "" $htmlT

plo $windowT

// 用new指令创建一个快速代理函数(quickDelegate)对象dele1
// 谢语言中quickDelegate是最常用的代理函数对象
// 它创建时需要指定一个快速函数,本例中通过标号deleFast1指明
// 这样,当Sciter的网页中调用view对象的delegateDo函数时
// 就将调用deleFast1标号处的快速函数代码
new $dele1 quickDelegate :deleFast1

// 调用window对象的setDelegate方法将其接口代理指定为dele1
mt $rs $windowT setDelegate $dele1

// 调用window对象的show方法,此时才会真正显示界面窗口
// 并开始响应用户的操作
mt $rs $windowT show

plo $rs

// 退出程序
exit

// 用于界面事件处理的快速函数
// 约定该函数必须通过堆栈获取一个参数,并返回一个参数
// 参数均为字符串类型
// 如果传递复杂数据,常见的方法是传递JSON字符串
// 此处该函数仅仅是将输入参数输出
:deleFast1

    pop $inputT

    pl "计算结果为:%v" $inputT

    // 函数返回前必须要压栈一个输出参数
    // 此处因为实际上无需返回参数,因此随便压入一个无用的数值
    push $inputT

    fastRet
    

代码展示了如何用谢语言实现一个简单的图形界面计算器,代码中有详细的解释,可以仔细阅读理解。TiScript整体接近于包含JQuery的JavaScript但略有不同(例如DOM对象的id可以不带引号括起等),具体的用法,可以去Sciter网站或者从谢语言官网下载“Windows版界面工具包”,其中含有详细的帮助文档;也可以通过看我们的示例快速了解。

代码运行后,将得到类似下面的界面:

截图 截图

在输入框中输入算式,然后点击“计算”按钮,框中就会计算出结果,并且后台也得到了计算结果并将其输出。点击“关闭”按钮则窗口将关闭并执行后续代码(此例中是用exit指令退出了程序运行)。

 

- Linux系统中运行图形计算器代码

谢语言的图形界面编程支持跨平台,上例中的图形界面计算器代码,无需改动就可以在Linux下运行,下面以Ubuntu为例进行说明:

  • 首先在谢语言官网下载Ubuntu下的谢语言压缩包(xie.tar.gz),解压后获得谢语言主程序xie,将其权限设置为可执行后将其放置在某个执行路径(PATH变量指明的)中;
  • 如果Ubuntu还没有安装GTK3图形环境,则通过 apt install libgtk-3-dev 命令安装该依赖项;
  • 此时应该可以运行谢语言主程序,可通过 xie -version 命令查看版本号,并验证谢语言已可顺利运行;
  • 到Sciter官网下载4.4.6.6版本的SDK压缩包,或在谢语言官网页面下载“界面工具包”中也有,解压后,将其中bin.lnx\x64中的所有文件复制出来拷贝到某个目录下,例如放到/tools目录下;
  • 然后进入到/tools目录下依次执行下面的命令:
    export LIBRARY_PATH=$PWD
    echo $PWD >> libsciter.conf
    sudo cp libsciter.conf /etc/ld.so.conf.d/
    sudo ldconfig
    ldconfig -p | grep sciter
    

至此,谢语言语言所需的图形界面环境已经配置好,可以用下面的命令行:

xie -example calculator.xie

即可运行在线的计算器例子程序。运行效果类似下图:

截图 截图

注意,如果中文显示有问题,请自行搜索如何在Ubuntu系统下安装中文字体,也有可能是环境变量LANG等的设置问题(应为en_US.UTF-8)。

如果按上述步骤仍然无法运行,请确保Linux系统安装好了X11图形界面环境。另外,如果在云服务器或者虚拟机上运行,客户端如果在Windows上,建议在Windows下安装Xming,并运行起来,然后使用支持X11 Forwarding的SSH客户端(如Terminus或Bitvise SSH Client,两者均免费),并打开X11 Forwarding选项后,即可在Windows下运行Gox图形界面程序了,没有什么多余的配置,非常简单。也可以使用内置支持X11的终端软件(如WindTerm等)。

 

- Windows编译不带命令行窗口的谢语言主程序

用谢语言在Windows系统下进行图形界面编程时,如果程序运行时不希望显示命令窗口(CMD),可以在编译谢语言源码(Go语言版)时加上-ldflags="-H windowsgui"的编译参数即可。

如果谢语言主程序是加了-ldflags="-H windowsgui"的编译参数编译出来的,则通过其编译谢语言代码后的可执行程序,也将没有命令行窗口,结合GUI编程,完全可以制作出标准的图形界面程序。如何编译谢语言代码,可以参见后面文档中说明。

 

- 制作一个登录框

本例继续介绍GUI编程,将实现一个常见的登录框,包含用户名和密码的输入框以及登录和关闭按钮,之间参看下面的代码(loginDialog.xie):

// 初始化GUI环境
mt $rs $guiG init

// 设定界面的HTML
// 其中的moveToCenter函数,用于将窗口移动到屏幕正中并调整大小
// 所有在TiScript与谢语言互通的函数都必须和moveToCenter函数这样
// 接收一个字符串类型的输入参数,并输出一个字符串类型的输出参数
// 如果想传递多于一个的数据,可以用JSON进行数据的封装
// moveToCenter函数就接收一个包含两个参数(宽与高)的JSON字符串
// 并输出一个表示屏幕宽高的字符串
assign $htmlT `
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>请登录……</title>
</head>
<body >
	<div style="margin-top: 10px; margin-bottom: 10px;">
		<span>请输入用户名和密码登录……</span>
	</div>
	<div style="margin-top: 10px; margin-bottom: 10px;">
		<label for="userNameID" >用户名: </label><input id="userNameID" type=text />
	</div>
	<div style="margin-top: 10px; margin-bottom: 10px;">
		<label for="userNameID" >密码: </label><input id="passwordID" type=password />
	</div>
	<div>
		<button id="btnLoginID">登录</button>
		<button id="btnClose">关闭</button>
	</div>

    <script type="text/tiscript">
        function moveToCenter(jsonA) {
            var (w, h) = view.screenBox(#frame, #dimension);

            var obj = JSON.parse(jsonA);

            var w1n = obj.Width;
            var h1n = obj.Height;

            view.move((w-w1n)/2, (h-h1n)/2, w1n, h1n);

            return String.printf("%v|%v", w, h);
        }

        $(#btnLoginID).on("click", function() {
			var userNameT = $(#userNameID).value.trim();
			var passwordT = $(#passwordID).value.trim();

			view.delegateDo(JSON.stringify({"userName": userNameT, "password": passwordT}));
			//view.close();
        });
 
        $(#btnClose).on("click", function() {
            view.close();
        });
    </script>
</body>
</html>
`

// 新建窗口,第二个参数传入了JSON格式的表示左、上、宽、高的窗口位置与大小的字符串
// 但实际上由于下面调用了TiScript中的moveToCenter函数,因此将会使这里定义的宽和高无效
mt $windowT $guiG newWindow 测试 `[300,200,600,400]` $htmlT

// 调用前面HTML代码中TiScript脚本内定义的moveToCenter函数,并传入表示宽与高的JSON字符串
mt $rs $windowT call moveToCenter `{"Width":800, "Height":600}`

// 输出moveToCenter函数的返回值
plo $rs

// 创建并设定与界面之间的快速代理对象
new $dele1 quickDelegate :deleFast1
mt $rs $windowT setDelegate $dele1

// 运行图形界面
mt $rs $windowT show

plo $rs

exit

// 快速代理对象的代码
:deleFast1

    pop $inputT

    pl "inputT: %v" $inputT

    push "output1"

    fastRet

运行效果如下图所示:

截图 截图

可以看出,moveToCenter函数返回的是一个非JSON格式的字符串,表示屏幕的宽与高的像素数,而点击登录按钮后,接口代理函数deleFast1将输出一个JSON格式的包含输入的用户名和密码的字符串,可以用于后续处理。

 

编译运行谢语言代码

谢语言支持简单的编译运行,但仅相当于将主程序和代码打包成一个可执行文件,方便分发并起到简单加密代码的作用。例如要编译一个名为hello.xie的文件,用下面的命令:

xie -compile hello.xie -output=hello.exe

执行后将在当前目录下生成hello.exe的可执行文件(Linux类似),如果不指定output参数,则默认生成可执行文件名为output.exe。

如果谢语言主程序是加了-ldflags="-H windowsgui"的编译参数编译出来的,则通过其编译后的可执行程序,也将没有命令行窗口,结合GUI编程,完全可以制作出标准的图形界面程序。

 

内置命令/指令/函数参考

目前暂时请参看代码中的InstrNameSet数据结构的代码注释,后面文档会慢慢补齐。

 

内置对象参考

目前暂时请参看代码中的各个Xie...对象(如XieString)的代码内文档说明。

 

杂项说明

 

 

- 指令的参数

谢语言中的指令,可以没有任何参数(0个参数),即不需要输出也不需要输入参数,例如pass。也有可能只有一个结果参数,例如getNowStr,此时可以省略结果参数以表示将结果压栈。当然,也有可能既有结果参数,也有其他一个或多个输入参数。当输入参数是可变个数的时候,结果参数是不可省略的。输入参数固定的情况下,一般结果参数也可以省略来表示压栈。一般情况下,为了避免混淆,对于有结果参数的指令,建议总是写上结果参数。

 

- 行末注释

谢语言中的注释是不支持行内注释的,只能单独写在一行中。但在参数个数固定的指令中,如果显式写出了结果参数,此时可以利用该指令将忽略后面的其他参数的特性,来写上该行的注释。

 

- 自动执行

谢语言中主程序运行时,如果不指定要执行的脚本文件,同时当前目录下含有名字类似auto*.xie(例如auto.xie、auto01.xie等)的脚本文件时,将按文件名顺序依次执行这些脚本文件。这在分发程序时会比较有用,使用者可以直接鼠标双击谢语言主程序即可执行开发者编写的脚本,只要这些脚本与谢语言主程序在相同目录下并符合上述命名规则。

 

 

性能方面的考虑

谢语言的目标是使用简单的语法结构减少脚本语言的语法解析开销以便提升速度,并且通过广泛使用内置指令避免使用速度很慢的反射。具体速度评估可以参考例子代码中的斐波那契数列产生的两个例子(递归方式fix.xie和循环方式fibFlat.xie)。

 

嵌入式使用谢语言(以虚拟机的方式在其他语言中调用)
  • 在Go语言(Golang)中如何嵌入:请参看cmd/xie目录下的main.go,这是谢语言的主程序,里面既是以嵌入式的方法创建谢语言虚拟机并执行代码的。

 

扩展谢语言

扩展谢语言一般来说有两个方法:

  • 增加内置指令:请fork本库,参考xie.go中的源代码,参看各个指令的写法编写自己的新指令,然后编译出可执行代码即可。

  • 增加内置对象:请fork本库,参考xie.go中的源代码,各个Xie...对象(如XieString)的代码内文档说明,重点是实现XieObject接口,然后编译出可执行代码即可。

 

编译谢语言
  • 在Linux下如果出现类似“package gl was not found in the pkg-config search path.”的错误:请执行 apt install libgl1-mesa-dev 命令安装依赖库。

  • 出现类似“github.com/AllenDang/imgui-go@v1.12.1: replacement directory ../../../../../github.com/AllenDang/imgui-go does not exist”的错误:由于Linux下使用github.com/AllenDang/imgui-go在Github上的库有小问题,因此需要本地git clone该库,并在作少许修改后使用(Windows下无需改动)。

  • 在Linux下如果出现类似“/usr/include/x86_64-linux-gnu/bits/stdio2.h:34:43: note: ‘__builtin___sprintf_chk’ output between 6 and 15 bytes into a destination of size 8”的错误:删除本地github.com/AllenDang/imgui-go库中的implot_demo.cpp文件,或将其重命名为非程序文件,例如mv implot_demo.cpp implot_demo.cpp.bac,然后在编译即可。

 

代码示例

注:更多示例请参考cmd/xie/scripts目录

 

参与贡献者
  1. TopXeQ
  2. Topget
  3. 陆满庭

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConstMapG map[string]interface{} = map[string]interface{}{
	"timeFormat":        "2006-01-02 15:04:05",
	"timeFormatCompact": "20060102150405",
}

var TimeFormat = "2006-01-02 15:04:05" var TimeFormatMS = "2006-01-02 15:04:05.000" var TimeFormatMSCompact = "20060102150405.000" var TimeFormatCompact = "20060102150405" var TimeFormatCompact2 = "2006/01/02 15:04:05" var TimeFormatDateCompact = "20060102"

View Source
var InstrNameSet map[string]int = map[string]int{}/* 473 elements not displayed */
View Source
var OperatorPriorityMap map[string]int = map[string]int{
	"||": 20,
	"&&": 25,

	"|": 30,
	"^": 33,
	"&": 35,

	"==": 40,
	"!=": 40,
	"<>": 40,

	">":  50,
	"<":  50,
	">=": 50,
	"<=": 50,

	">>": 60,
	"<<": 60,

	"+": 70,
	"-": 70,

	"*": 80,
	"/": 80,
	"%": 80,

	"1!": 99,
	"++": 99,
	"--": 99,
	"1+": 99,
	"1-": 99,
	"1&": 99,
	"1*": 99,
	"1^": 99,
}
View Source
var ResourceG map[string]string = map[string]string{
	"js/test.js": `
	function len(objA) {
		if (!objA) {
			return 0
		}
	
		if (objA instanceof Array) {
			return objA.length;
		}
	
		if (typeof(objA) == "string") {
			return objA.length;
		}
	
		if (typeof(objA) == "object") {
			return Object.keys(objA).length;
		}
		
		var l = objA.length;
	
		if (!l) {
			return 0;
		}
	
		return l;
	}

	`,
	"js/codemirror/mode/go/go.js": `
	// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: https://codemirror.net/LICENSE

(function(mod) {
  if (typeof exports == "object" && typeof module == "object") // CommonJS
    mod(require("../../lib/codemirror"));
  else if (typeof define == "function" && define.amd) // AMD
    define(["../../lib/codemirror"], mod);
  else // Plain browser env
    mod(CodeMirror);
})(function(CodeMirror) {
"use strict";

CodeMirror.defineMode("go", function(config) {
  var indentUnit = config.indentUnit;

  var keywords = {
    "break":true, "case":true, "chan":true, "const":true, "continue":true,
    "default":true, "defer":true, "else":true, "fallthrough":true, "for":true,
    "func":true, "go":true, "goto":true, "if":true, "import":true,
    "interface":true, "map":true, "package":true, "range":true, "return":true,
    "select":true, "struct":true, "switch":true, "type":true, "var":true,
    "bool":true, "byte":true, "complex64":true, "complex128":true,
    "float32":true, "float64":true, "int8":true, "int16":true, "int32":true,
    "int64":true, "string":true, "uint8":true, "uint16":true, "uint32":true,
    "uint64":true, "int":true, "uint":true, "uintptr":true, "error": true,
    "rune":true
  };

  var atoms = {
    "true":true, "false":true, "iota":true, "nil":true, "append":true,
    "cap":true, "close":true, "complex":true, "copy":true, "delete":true, "imag":true,
    "len":true, "make":true, "new":true, "panic":true, "print":true,
    "println":true, "real":true, "recover":true
  };

  var isOperatorChar = /[+\-*&^%:=<>!|\/]/;

  var curPunc;

  function tokenBase(stream, state) {
    var ch = stream.next();
    if (ch == '"' || ch == "'" || ch == "~~~") {
      state.tokenize = tokenString(ch);
      return state.tokenize(stream, state);
    }
    if (/[\d\.]/.test(ch)) {
      if (ch == ".") {
        stream.match(/^[0-9]+([eE][\-+]?[0-9]+)?/);
      } else if (ch == "0") {
        stream.match(/^[xX][0-9a-fA-F]+/) || stream.match(/^0[0-7]+/);
      } else {
        stream.match(/^[0-9]*\.?[0-9]*([eE][\-+]?[0-9]+)?/);
      }
      return "number";
    }
    if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
      curPunc = ch;
      return null;
    }
    if (ch == "/") {
      if (stream.eat("*")) {
        state.tokenize = tokenComment;
        return tokenComment(stream, state);
      }
      if (stream.eat("/")) {
        stream.skipToEnd();
        return "comment";
      }
    }
    if (isOperatorChar.test(ch)) {
      stream.eatWhile(isOperatorChar);
      return "operator";
    }
    stream.eatWhile(/[\w\$_\xa1-\uffff]/);
    var cur = stream.current();
    if (keywords.propertyIsEnumerable(cur)) {
      if (cur == "case" || cur == "default") curPunc = "case";
      return "keyword";
    }
    if (atoms.propertyIsEnumerable(cur)) return "atom";
    return "variable";
  }

  function tokenString(quote) {
    return function(stream, state) {
      var escaped = false, next, end = false;
      while ((next = stream.next()) != null) {
        if (next == quote && !escaped) {end = true; break;}
        escaped = !escaped && quote != "~~~" && next == "\\";
      }
      if (end || !(escaped || quote == "~~~"))
        state.tokenize = tokenBase;
      return "string";
    };
  }

  function tokenComment(stream, state) {
    var maybeEnd = false, ch;
    while (ch = stream.next()) {
      if (ch == "/" && maybeEnd) {
        state.tokenize = tokenBase;
        break;
      }
      maybeEnd = (ch == "*");
    }
    return "comment";
  }

  function Context(indented, column, type, align, prev) {
    this.indented = indented;
    this.column = column;
    this.type = type;
    this.align = align;
    this.prev = prev;
  }
  function pushContext(state, col, type) {
    return state.context = new Context(state.indented, col, type, null, state.context);
  }
  function popContext(state) {
    if (!state.context.prev) return;
    var t = state.context.type;
    if (t == ")" || t == "]" || t == "}")
      state.indented = state.context.indented;
    return state.context = state.context.prev;
  }

  // Interface

  return {
    startState: function(basecolumn) {
      return {
        tokenize: null,
        context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
        indented: 0,
        startOfLine: true
      };
    },

    token: function(stream, state) {
      var ctx = state.context;
      if (stream.sol()) {
        if (ctx.align == null) ctx.align = false;
        state.indented = stream.indentation();
        state.startOfLine = true;
        if (ctx.type == "case") ctx.type = "}";
      }
      if (stream.eatSpace()) return null;
      curPunc = null;
      var style = (state.tokenize || tokenBase)(stream, state);
      if (style == "comment") return style;
      if (ctx.align == null) ctx.align = true;

      if (curPunc == "{") pushContext(state, stream.column(), "}");
      else if (curPunc == "[") pushContext(state, stream.column(), "]");
      else if (curPunc == "(") pushContext(state, stream.column(), ")");
      else if (curPunc == "case") ctx.type = "case";
      else if (curPunc == "}" && ctx.type == "}") popContext(state);
      else if (curPunc == ctx.type) popContext(state);
      state.startOfLine = false;
      return style;
    },

    indent: function(state, textAfter) {
      if (state.tokenize != tokenBase && state.tokenize != null) return CodeMirror.Pass;
      var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
      if (ctx.type == "case" && /^(?:case|default)\b/.test(textAfter)) {
        state.context.type = "}";
        return ctx.indented;
      }
      var closing = firstChar == ctx.type;
      if (ctx.align) return ctx.column + (closing ? 0 : 1);
      else return ctx.indented + (closing ? 0 : indentUnit);
    },

    electricChars: "{}):",
    closeBrackets: "()[]{}''\"\"~~~~~~",
    fold: "brace",
    blockCommentStart: "/*",
    blockCommentEnd: "*/",
    lineComment: "//"
  };
});

CodeMirror.defineMIME("text/x-go", "go");

});

	`,
	"js/codemirror.js": `
	// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: https://codemirror.net/LICENSE

// This is CodeMirror (https://codemirror.net), a code editor
// implemented in JavaScript on top of the browser's DOM.
//
// You can find some technical background for some of the code below
// at http://marijnhaverbeke.nl/blog/#cm-internals .

(function (global, factory) {
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  typeof define === 'function' && define.amd ? define(factory) :
  (global = global || self, global.CodeMirror = factory());
}(this, (function () { 'use strict';

  // Kludges for bugs and behavior differences that can't be feature
  // detected are enabled based on userAgent etc sniffing.
  var userAgent = navigator.userAgent;
  var platform = navigator.platform;

  var gecko = /gecko\/\d/i.test(userAgent);
  var ie_upto10 = /MSIE \d/.test(userAgent);
  var ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(userAgent);
  var edge = /Edge\/(\d+)/.exec(userAgent);
  var ie = ie_upto10 || ie_11up || edge;
  var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : +(edge || ie_11up)[1]);
  var webkit = !edge && /WebKit\//.test(userAgent);
  var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(userAgent);
  var chrome = !edge && /Chrome\//.test(userAgent);
  var presto = /Opera\//.test(userAgent);
  var safari = /Apple Computer/.test(navigator.vendor);
  var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent);
  var phantom = /PhantomJS/.test(userAgent);

  var ios = safari && (/Mobile\/\w+/.test(userAgent) || navigator.maxTouchPoints > 2);
  var android = /Android/.test(userAgent);
  // This is woefully incomplete. Suggestions for alternative methods welcome.
  var mobile = ios || android || /webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent);
  var mac = ios || /Mac/.test(platform);
  var chromeOS = /\bCrOS\b/.test(userAgent);
  var windows = /win/i.test(platform);

  var presto_version = presto && userAgent.match(/Version\/(\d*\.\d*)/);
  if (presto_version) { presto_version = Number(presto_version[1]); }
  if (presto_version && presto_version >= 15) { presto = false; webkit = true; }
  // Some browsers use the wrong event properties to signal cmd/ctrl on OS X
  var flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11));
  var captureRightClick = gecko || (ie && ie_version >= 9);

  function classTest(cls) { return new RegExp("(^|\\s)" + cls + "(?:$|\\s)\\s*") }

  var rmClass = function(node, cls) {
    var current = node.className;
    var match = classTest(cls).exec(current);
    if (match) {
      var after = current.slice(match.index + match[0].length);
      node.className = current.slice(0, match.index) + (after ? match[1] + after : "");
    }
  };

  function removeChildren(e) {
    for (var count = e.childNodes.length; count > 0; --count)
      { e.removeChild(e.firstChild); }
    return e
  }

  function removeChildrenAndAdd(parent, e) {
    return removeChildren(parent).appendChild(e)
  }

  function elt(tag, content, className, style) {
    var e = document.createElement(tag);
    if (className) { e.className = className; }
    if (style) { e.style.cssText = style; }
    if (typeof content == "string") { e.appendChild(document.createTextNode(content)); }
    else if (content) { for (var i = 0; i < content.length; ++i) { e.appendChild(content[i]); } }
    return e
  }
  // wrapper for elt, which removes the elt from the accessibility tree
  function eltP(tag, content, className, style) {
    var e = elt(tag, content, className, style);
    e.setAttribute("role", "presentation");
    return e
  }

  var range;
  if (document.createRange) { range = function(node, start, end, endNode) {
    var r = document.createRange();
    r.setEnd(endNode || node, end);
    r.setStart(node, start);
    return r
  }; }
  else { range = function(node, start, end) {
    var r = document.body.createTextRange();
    try { r.moveToElementText(node.parentNode); }
    catch(e) { return r }
    r.collapse(true);
    r.moveEnd("character", end);
    r.moveStart("character", start);
    return r
  }; }

  function contains(parent, child) {
    if (child.nodeType == 3) // Android browser always returns false when child is a textnode
      { child = child.parentNode; }
    if (parent.contains)
      { return parent.contains(child) }
    do {
      if (child.nodeType == 11) { child = child.host; }
      if (child == parent) { return true }
    } while (child = child.parentNode)
  }

  function activeElt() {
    // IE and Edge may throw an "Unspecified Error" when accessing document.activeElement.
    // IE < 10 will throw when accessed while the page is loading or in an iframe.
    // IE > 9 and Edge will throw when accessed in an iframe if document.body is unavailable.
    var activeElement;
    try {
      activeElement = document.activeElement;
    } catch(e) {
      activeElement = document.body || null;
    }
    while (activeElement && activeElement.shadowRoot && activeElement.shadowRoot.activeElement)
      { activeElement = activeElement.shadowRoot.activeElement; }
    return activeElement
  }

  function addClass(node, cls) {
    var current = node.className;
    if (!classTest(cls).test(current)) { node.className += (current ? " " : "") + cls; }
  }
  function joinClasses(a, b) {
    var as = a.split(" ");
    for (var i = 0; i < as.length; i++)
      { if (as[i] && !classTest(as[i]).test(b)) { b += " " + as[i]; } }
    return b
  }

  var selectInput = function(node) { node.select(); };
  if (ios) // Mobile Safari apparently has a bug where select() is broken.
    { selectInput = function(node) { node.selectionStart = 0; node.selectionEnd = node.value.length; }; }
  else if (ie) // Suppress mysterious IE10 errors
    { selectInput = function(node) { try { node.select(); } catch(_e) {} }; }

  function bind(f) {
    var args = Array.prototype.slice.call(arguments, 1);
    return function(){return f.apply(null, args)}
  }

  function copyObj(obj, target, overwrite) {
    if (!target) { target = {}; }
    for (var prop in obj)
      { if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop)))
        { target[prop] = obj[prop]; } }
    return target
  }

  // Counts the column offset in a string, taking tabs into account.
  // Used mostly to find indentation.
  function countColumn(string, end, tabSize, startIndex, startValue) {
    if (end == null) {
      end = string.search(/[^\s\u00a0]/);
      if (end == -1) { end = string.length; }
    }
    for (var i = startIndex || 0, n = startValue || 0;;) {
      var nextTab = string.indexOf("\t", i);
      if (nextTab < 0 || nextTab >= end)
        { return n + (end - i) }
      n += nextTab - i;
      n += tabSize - (n % tabSize);
      i = nextTab + 1;
    }
  }

  var Delayed = function() {
    this.id = null;
    this.f = null;
    this.time = 0;
    this.handler = bind(this.onTimeout, this);
  };
  Delayed.prototype.onTimeout = function (self) {
    self.id = 0;
    if (self.time <= +new Date) {
      self.f();
    } else {
      setTimeout(self.handler, self.time - +new Date);
    }
  };
  Delayed.prototype.set = function (ms, f) {
    this.f = f;
    var time = +new Date + ms;
    if (!this.id || time < this.time) {
      clearTimeout(this.id);
      this.id = setTimeout(this.handler, ms);
      this.time = time;
    }
  };

  function indexOf(array, elt) {
    for (var i = 0; i < array.length; ++i)
      { if (array[i] == elt) { return i } }
    return -1
  }

  // Number of pixels added to scroller and sizer to hide scrollbar
  var scrollerGap = 50;

  // Returned or thrown by various protocols to signal 'I'm not
  // handling this'.
  var Pass = {toString: function(){return "CodeMirror.Pass"}};

  // Reused option objects for setSelection & friends
  var sel_dontScroll = {scroll: false}, sel_mouse = {origin: "*mouse"}, sel_move = {origin: "+move"};

  // The inverse of countColumn -- find the offset that corresponds to
  // a particular column.
  function findColumn(string, goal, tabSize) {
    for (var pos = 0, col = 0;;) {
      var nextTab = string.indexOf("\t", pos);
      if (nextTab == -1) { nextTab = string.length; }
      var skipped = nextTab - pos;
      if (nextTab == string.length || col + skipped >= goal)
        { return pos + Math.min(skipped, goal - col) }
      col += nextTab - pos;
      col += tabSize - (col % tabSize);
      pos = nextTab + 1;
      if (col >= goal) { return pos }
    }
  }

  var spaceStrs = [""];
  function spaceStr(n) {
    while (spaceStrs.length <= n)
      { spaceStrs.push(lst(spaceStrs) + " "); }
    return spaceStrs[n]
  }

  function lst(arr) { return arr[arr.length-1] }

  function map(array, f) {
    var out = [];
    for (var i = 0; i < array.length; i++) { out[i] = f(array[i], i); }
    return out
  }

  function insertSorted(array, value, score) {
    var pos = 0, priority = score(value);
    while (pos < array.length && score(array[pos]) <= priority) { pos++; }
    array.splice(pos, 0, value);
  }

  function nothing() {}

  function createObj(base, props) {
    var inst;
    if (Object.create) {
      inst = Object.create(base);
    } else {
      nothing.prototype = base;
      inst = new nothing();
    }
    if (props) { copyObj(props, inst); }
    return inst
  }

  var nonASCIISingleCaseWordChar = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;
  function isWordCharBasic(ch) {
    return /\w/.test(ch) || ch > "\x80" &&
      (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch))
  }
  function isWordChar(ch, helper) {
    if (!helper) { return isWordCharBasic(ch) }
    if (helper.source.indexOf("\\w") > -1 && isWordCharBasic(ch)) { return true }
    return helper.test(ch)
  }

  function isEmpty(obj) {
    for (var n in obj) { if (obj.hasOwnProperty(n) && obj[n]) { return false } }
    return true
  }

  // Extending unicode characters. A series of a non-extending char +
  // any number of extending chars is treated as a single unit as far
  // as editing and measuring is concerned. This is not fully correct,
  // since some scripts/fonts/browsers also treat other configurations
  // of code points as a group.
  var extendingChars = /[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;
  function isExtendingChar(ch) { return ch.charCodeAt(0) >= 768 && extendingChars.test(ch) }

  // Returns a number from the range [~~~0~~~; ~~~str.length~~~] unless ~~~pos~~~ is outside that range.
  function skipExtendingChars(str, pos, dir) {
    while ((dir < 0 ? pos > 0 : pos < str.length) && isExtendingChar(str.charAt(pos))) { pos += dir; }
    return pos
  }

  // Returns the value from the range [~~~from~~~; ~~~to~~~] that satisfies
  // ~~~pred~~~ and is closest to ~~~from~~~. Assumes that at least ~~~to~~~
  // satisfies ~~~pred~~~. Supports ~~~from~~~ being greater than ~~~to~~~.
  function findFirst(pred, from, to) {
    // At any point we are certain ~~~to~~~ satisfies ~~~pred~~~, don't know
    // whether ~~~from~~~ does.
    var dir = from > to ? -1 : 1;
    for (;;) {
      if (from == to) { return from }
      var midF = (from + to) / 2, mid = dir < 0 ? Math.ceil(midF) : Math.floor(midF);
      if (mid == from) { return pred(mid) ? from : to }
      if (pred(mid)) { to = mid; }
      else { from = mid + dir; }
    }
  }

  // BIDI HELPERS

  function iterateBidiSections(order, from, to, f) {
    if (!order) { return f(from, to, "ltr", 0) }
    var found = false;
    for (var i = 0; i < order.length; ++i) {
      var part = order[i];
      if (part.from < to && part.to > from || from == to && part.to == from) {
        f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? "rtl" : "ltr", i);
        found = true;
      }
    }
    if (!found) { f(from, to, "ltr"); }
  }

  var bidiOther = null;
  function getBidiPartAt(order, ch, sticky) {
    var found;
    bidiOther = null;
    for (var i = 0; i < order.length; ++i) {
      var cur = order[i];
      if (cur.from < ch && cur.to > ch) { return i }
      if (cur.to == ch) {
        if (cur.from != cur.to && sticky == "before") { found = i; }
        else { bidiOther = i; }
      }
      if (cur.from == ch) {
        if (cur.from != cur.to && sticky != "before") { found = i; }
        else { bidiOther = i; }
      }
    }
    return found != null ? found : bidiOther
  }

  // Bidirectional ordering algorithm
  // See http://unicode.org/reports/tr9/tr9-13.html for the algorithm
  // that this (partially) implements.

  // One-char codes used for character types:
  // L (L):   Left-to-Right
  // R (R):   Right-to-Left
  // r (AL):  Right-to-Left Arabic
  // 1 (EN):  European Number
  // + (ES):  European Number Separator
  // % (ET):  European Number Terminator
  // n (AN):  Arabic Number
  // , (CS):  Common Number Separator
  // m (NSM): Non-Spacing Mark
  // b (BN):  Boundary Neutral
  // s (B):   Paragraph Separator
  // t (S):   Segment Separator
  // w (WS):  Whitespace
  // N (ON):  Other Neutrals

  // Returns null if characters are ordered as they appear
  // (left-to-right), or an array of sections ({from, to, level}
  // objects) in the order in which they occur visually.
  var bidiOrdering = (function() {
    // Character types for codepoints 0 to 0xff
    var lowTypes = "bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN";
    // Character types for codepoints 0x600 to 0x6f9
    var arabicTypes = "nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";
    function charType(code) {
      if (code <= 0xf7) { return lowTypes.charAt(code) }
      else if (0x590 <= code && code <= 0x5f4) { return "R" }
      else if (0x600 <= code && code <= 0x6f9) { return arabicTypes.charAt(code - 0x600) }
      else if (0x6ee <= code && code <= 0x8ac) { return "r" }
      else if (0x2000 <= code && code <= 0x200b) { return "w" }
      else if (code == 0x200c) { return "b" }
      else { return "L" }
    }

    var bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
    var isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/;

    function BidiSpan(level, from, to) {
      this.level = level;
      this.from = from; this.to = to;
    }

    return function(str, direction) {
      var outerType = direction == "ltr" ? "L" : "R";

      if (str.length == 0 || direction == "ltr" && !bidiRE.test(str)) { return false }
      var len = str.length, types = [];
      for (var i = 0; i < len; ++i)
        { types.push(charType(str.charCodeAt(i))); }

      // W1. Examine each non-spacing mark (NSM) in the level run, and
      // change the type of the NSM to the type of the previous
      // character. If the NSM is at the start of the level run, it will
      // get the type of sor.
      for (var i$1 = 0, prev = outerType; i$1 < len; ++i$1) {
        var type = types[i$1];
        if (type == "m") { types[i$1] = prev; }
        else { prev = type; }
      }

      // W2. Search backwards from each instance of a European number
      // until the first strong type (R, L, AL, or sor) is found. If an
      // AL is found, change the type of the European number to Arabic
      // number.
      // W3. Change all ALs to R.
      for (var i$2 = 0, cur = outerType; i$2 < len; ++i$2) {
        var type$1 = types[i$2];
        if (type$1 == "1" && cur == "r") { types[i$2] = "n"; }
        else if (isStrong.test(type$1)) { cur = type$1; if (type$1 == "r") { types[i$2] = "R"; } }
      }

      // W4. A single European separator between two European numbers
      // changes to a European number. A single common separator between
      // two numbers of the same type changes to that type.
      for (var i$3 = 1, prev$1 = types[0]; i$3 < len - 1; ++i$3) {
        var type$2 = types[i$3];
        if (type$2 == "+" && prev$1 == "1" && types[i$3+1] == "1") { types[i$3] = "1"; }
        else if (type$2 == "," && prev$1 == types[i$3+1] &&
                 (prev$1 == "1" || prev$1 == "n")) { types[i$3] = prev$1; }
        prev$1 = type$2;
      }

      // W5. A sequence of European terminators adjacent to European
      // numbers changes to all European numbers.
      // W6. Otherwise, separators and terminators change to Other
      // Neutral.
      for (var i$4 = 0; i$4 < len; ++i$4) {
        var type$3 = types[i$4];
        if (type$3 == ",") { types[i$4] = "N"; }
        else if (type$3 == "%") {
          var end = (void 0);
          for (end = i$4 + 1; end < len && types[end] == "%"; ++end) {}
          var replace = (i$4 && types[i$4-1] == "!") || (end < len && types[end] == "1") ? "1" : "N";
          for (var j = i$4; j < end; ++j) { types[j] = replace; }
          i$4 = end - 1;
        }
      }

      // W7. Search backwards from each instance of a European number
      // until the first strong type (R, L, or sor) is found. If an L is
      // found, then change the type of the European number to L.
      for (var i$5 = 0, cur$1 = outerType; i$5 < len; ++i$5) {
        var type$4 = types[i$5];
        if (cur$1 == "L" && type$4 == "1") { types[i$5] = "L"; }
        else if (isStrong.test(type$4)) { cur$1 = type$4; }
      }

      // N1. A sequence of neutrals takes the direction of the
      // surrounding strong text if the text on both sides has the same
      // direction. European and Arabic numbers act as if they were R in
      // terms of their influence on neutrals. Start-of-level-run (sor)
      // and end-of-level-run (eor) are used at level run boundaries.
      // N2. Any remaining neutrals take the embedding direction.
      for (var i$6 = 0; i$6 < len; ++i$6) {
        if (isNeutral.test(types[i$6])) {
          var end$1 = (void 0);
          for (end$1 = i$6 + 1; end$1 < len && isNeutral.test(types[end$1]); ++end$1) {}
          var before = (i$6 ? types[i$6-1] : outerType) == "L";
          var after = (end$1 < len ? types[end$1] : outerType) == "L";
          var replace$1 = before == after ? (before ? "L" : "R") : outerType;
          for (var j$1 = i$6; j$1 < end$1; ++j$1) { types[j$1] = replace$1; }
          i$6 = end$1 - 1;
        }
      }

      // Here we depart from the documented algorithm, in order to avoid
      // building up an actual levels array. Since there are only three
      // levels (0, 1, 2) in an implementation that doesn't take
      // explicit embedding into account, we can build up the order on
      // the fly, without following the level-based algorithm.
      var order = [], m;
      for (var i$7 = 0; i$7 < len;) {
        if (countsAsLeft.test(types[i$7])) {
          var start = i$7;
          for (++i$7; i$7 < len && countsAsLeft.test(types[i$7]); ++i$7) {}
          order.push(new BidiSpan(0, start, i$7));
        } else {
          var pos = i$7, at = order.length, isRTL = direction == "rtl" ? 1 : 0;
          for (++i$7; i$7 < len && types[i$7] != "L"; ++i$7) {}
          for (var j$2 = pos; j$2 < i$7;) {
            if (countsAsNum.test(types[j$2])) {
              if (pos < j$2) { order.splice(at, 0, new BidiSpan(1, pos, j$2)); at += isRTL; }
              var nstart = j$2;
              for (++j$2; j$2 < i$7 && countsAsNum.test(types[j$2]); ++j$2) {}
              order.splice(at, 0, new BidiSpan(2, nstart, j$2));
              at += isRTL;
              pos = j$2;
            } else { ++j$2; }
          }
          if (pos < i$7) { order.splice(at, 0, new BidiSpan(1, pos, i$7)); }
        }
      }
      if (direction == "ltr") {
        if (order[0].level == 1 && (m = str.match(/^\s+/))) {
          order[0].from = m[0].length;
          order.unshift(new BidiSpan(0, 0, m[0].length));
        }
        if (lst(order).level == 1 && (m = str.match(/\s+$/))) {
          lst(order).to -= m[0].length;
          order.push(new BidiSpan(0, len - m[0].length, len));
        }
      }

      return direction == "rtl" ? order.reverse() : order
    }
  })();

  // Get the bidi ordering for the given line (and cache it). Returns
  // false for lines that are fully left-to-right, and an array of
  // BidiSpan objects otherwise.
  function getOrder(line, direction) {
    var order = line.order;
    if (order == null) { order = line.order = bidiOrdering(line.text, direction); }
    return order
  }

  // EVENT HANDLING

  // Lightweight event framework. on/off also work on DOM nodes,
  // registering native DOM handlers.

  var noHandlers = [];

  var on = function(emitter, type, f) {
    if (emitter.addEventListener) {
      emitter.addEventListener(type, f, false);
    } else if (emitter.attachEvent) {
      emitter.attachEvent("on" + type, f);
    } else {
      var map = emitter._handlers || (emitter._handlers = {});
      map[type] = (map[type] || noHandlers).concat(f);
    }
  };

  function getHandlers(emitter, type) {
    return emitter._handlers && emitter._handlers[type] || noHandlers
  }

  function off(emitter, type, f) {
    if (emitter.removeEventListener) {
      emitter.removeEventListener(type, f, false);
    } else if (emitter.detachEvent) {
      emitter.detachEvent("on" + type, f);
    } else {
      var map = emitter._handlers, arr = map && map[type];
      if (arr) {
        var index = indexOf(arr, f);
        if (index > -1)
          { map[type] = arr.slice(0, index).concat(arr.slice(index + 1)); }
      }
    }
  }

  function signal(emitter, type /*, values...*/) {
    var handlers = getHandlers(emitter, type);
    if (!handlers.length) { return }
    var args = Array.prototype.slice.call(arguments, 2);
    for (var i = 0; i < handlers.length; ++i) { handlers[i].apply(null, args); }
  }

  // The DOM events that CodeMirror handles can be overridden by
  // registering a (non-DOM) handler on the editor for the event name,
  // and preventDefault-ing the event in that handler.
  function signalDOMEvent(cm, e, override) {
    if (typeof e == "string")
      { e = {type: e, preventDefault: function() { this.defaultPrevented = true; }}; }
    signal(cm, override || e.type, cm, e);
    return e_defaultPrevented(e) || e.codemirrorIgnore
  }

  function signalCursorActivity(cm) {
    var arr = cm._handlers && cm._handlers.cursorActivity;
    if (!arr) { return }
    var set = cm.curOp.cursorActivityHandlers || (cm.curOp.cursorActivityHandlers = []);
    for (var i = 0; i < arr.length; ++i) { if (indexOf(set, arr[i]) == -1)
      { set.push(arr[i]); } }
  }

  function hasHandler(emitter, type) {
    return getHandlers(emitter, type).length > 0
  }

  // Add on and off methods to a constructor's prototype, to make
  // registering events on such objects more convenient.
  function eventMixin(ctor) {
    ctor.prototype.on = function(type, f) {on(this, type, f);};
    ctor.prototype.off = function(type, f) {off(this, type, f);};
  }

  // Due to the fact that we still support jurassic IE versions, some
  // compatibility wrappers are needed.

  function e_preventDefault(e) {
    if (e.preventDefault) { e.preventDefault(); }
    else { e.returnValue = false; }
  }
  function e_stopPropagation(e) {
    if (e.stopPropagation) { e.stopPropagation(); }
    else { e.cancelBubble = true; }
  }
  function e_defaultPrevented(e) {
    return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false
  }
  function e_stop(e) {e_preventDefault(e); e_stopPropagation(e);}

  function e_target(e) {return e.target || e.srcElement}
  function e_button(e) {
    var b = e.which;
    if (b == null) {
      if (e.button & 1) { b = 1; }
      else if (e.button & 2) { b = 3; }
      else if (e.button & 4) { b = 2; }
    }
    if (mac && e.ctrlKey && b == 1) { b = 3; }
    return b
  }

  // Detect drag-and-drop
  var dragAndDrop = function() {
    // There is *some* kind of drag-and-drop support in IE6-8, but I
    // couldn't get it to work yet.
    if (ie && ie_version < 9) { return false }
    var div = elt('div');
    return "draggable" in div || "dragDrop" in div
  }();

  var zwspSupported;
  function zeroWidthElement(measure) {
    if (zwspSupported == null) {
      var test = elt("span", "\u200b");
      removeChildrenAndAdd(measure, elt("span", [test, document.createTextNode("x")]));
      if (measure.firstChild.offsetHeight != 0)
        { zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8); }
    }
    var node = zwspSupported ? elt("span", "\u200b") :
      elt("span", "\u00a0", null, "display: inline-block; width: 1px; margin-right: -1px");
    node.setAttribute("cm-text", "");
    return node
  }

  // Feature-detect IE's crummy client rect reporting for bidi text
  var badBidiRects;
  function hasBadBidiRects(measure) {
    if (badBidiRects != null) { return badBidiRects }
    var txt = removeChildrenAndAdd(measure, document.createTextNode("A\u062eA"));
    var r0 = range(txt, 0, 1).getBoundingClientRect();
    var r1 = range(txt, 1, 2).getBoundingClientRect();
    removeChildren(measure);
    if (!r0 || r0.left == r0.right) { return false } // Safari returns null in some cases (#2780)
    return badBidiRects = (r1.right - r0.right < 3)
  }

  // See if "".split is the broken IE version, if so, provide an
  // alternative way to split lines.
  var splitLinesAuto = "\n\nb".split(/\n/).length != 3 ? function (string) {
    var pos = 0, result = [], l = string.length;
    while (pos <= l) {
      var nl = string.indexOf("\n", pos);
      if (nl == -1) { nl = string.length; }
      var line = string.slice(pos, string.charAt(nl - 1) == "\r" ? nl - 1 : nl);
      var rt = line.indexOf("\r");
      if (rt != -1) {
        result.push(line.slice(0, rt));
        pos += rt + 1;
      } else {
        result.push(line);
        pos = nl + 1;
      }
    }
    return result
  } : function (string) { return string.split(/\r\n?|\n/); };

  var hasSelection = window.getSelection ? function (te) {
    try { return te.selectionStart != te.selectionEnd }
    catch(e) { return false }
  } : function (te) {
    var range;
    try {range = te.ownerDocument.selection.createRange();}
    catch(e) {}
    if (!range || range.parentElement() != te) { return false }
    return range.compareEndPoints("StartToEnd", range) != 0
  };

  var hasCopyEvent = (function () {
    var e = elt("div");
    if ("oncopy" in e) { return true }
    e.setAttribute("oncopy", "return;");
    return typeof e.oncopy == "function"
  })();

  var badZoomedRects = null;
  function hasBadZoomedRects(measure) {
    if (badZoomedRects != null) { return badZoomedRects }
    var node = removeChildrenAndAdd(measure, elt("span", "x"));
    var normal = node.getBoundingClientRect();
    var fromRange = range(node, 0, 1).getBoundingClientRect();
    return badZoomedRects = Math.abs(normal.left - fromRange.left) > 1
  }

  // Known modes, by name and by MIME
  var modes = {}, mimeModes = {};

  // Extra arguments are stored as the mode's dependencies, which is
  // used by (legacy) mechanisms like loadmode.js to automatically
  // load a mode. (Preferred mechanism is the require/define calls.)
  function defineMode(name, mode) {
    if (arguments.length > 2)
      { mode.dependencies = Array.prototype.slice.call(arguments, 2); }
    modes[name] = mode;
  }

  function defineMIME(mime, spec) {
    mimeModes[mime] = spec;
  }

  // Given a MIME type, a {name, ...options} config object, or a name
  // string, return a mode config object.
  function resolveMode(spec) {
    if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) {
      spec = mimeModes[spec];
    } else if (spec && typeof spec.name == "string" && mimeModes.hasOwnProperty(spec.name)) {
      var found = mimeModes[spec.name];
      if (typeof found == "string") { found = {name: found}; }
      spec = createObj(found, spec);
      spec.name = found.name;
    } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec)) {
      return resolveMode("application/xml")
    } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+json$/.test(spec)) {
      return resolveMode("application/json")
    }
    if (typeof spec == "string") { return {name: spec} }
    else { return spec || {name: "null"} }
  }

  // Given a mode spec (anything that resolveMode accepts), find and
  // initialize an actual mode object.
  function getMode(options, spec) {
    spec = resolveMode(spec);
    var mfactory = modes[spec.name];
    if (!mfactory) { return getMode(options, "text/plain") }
    var modeObj = mfactory(options, spec);
    if (modeExtensions.hasOwnProperty(spec.name)) {
      var exts = modeExtensions[spec.name];
      for (var prop in exts) {
        if (!exts.hasOwnProperty(prop)) { continue }
        if (modeObj.hasOwnProperty(prop)) { modeObj["_" + prop] = modeObj[prop]; }
        modeObj[prop] = exts[prop];
      }
    }
    modeObj.name = spec.name;
    if (spec.helperType) { modeObj.helperType = spec.helperType; }
    if (spec.modeProps) { for (var prop$1 in spec.modeProps)
      { modeObj[prop$1] = spec.modeProps[prop$1]; } }

    return modeObj
  }

  // This can be used to attach properties to mode objects from
  // outside the actual mode definition.
  var modeExtensions = {};
  function extendMode(mode, properties) {
    var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {});
    copyObj(properties, exts);
  }

  function copyState(mode, state) {
    if (state === true) { return state }
    if (mode.copyState) { return mode.copyState(state) }
    var nstate = {};
    for (var n in state) {
      var val = state[n];
      if (val instanceof Array) { val = val.concat([]); }
      nstate[n] = val;
    }
    return nstate
  }

  // Given a mode and a state (for that mode), find the inner mode and
  // state at the position that the state refers to.
  function innerMode(mode, state) {
    var info;
    while (mode.innerMode) {
      info = mode.innerMode(state);
      if (!info || info.mode == mode) { break }
      state = info.state;
      mode = info.mode;
    }
    return info || {mode: mode, state: state}
  }

  function startState(mode, a1, a2) {
    return mode.startState ? mode.startState(a1, a2) : true
  }

  // STRING STREAM

  // Fed to the mode parsers, provides helper functions to make
  // parsers more succinct.

  var StringStream = function(string, tabSize, lineOracle) {
    this.pos = this.start = 0;
    this.string = string;
    this.tabSize = tabSize || 8;
    this.lastColumnPos = this.lastColumnValue = 0;
    this.lineStart = 0;
    this.lineOracle = lineOracle;
  };

  StringStream.prototype.eol = function () {return this.pos >= this.string.length};
  StringStream.prototype.sol = function () {return this.pos == this.lineStart};
  StringStream.prototype.peek = function () {return this.string.charAt(this.pos) || undefined};
  StringStream.prototype.next = function () {
    if (this.pos < this.string.length)
      { return this.string.charAt(this.pos++) }
  };
  StringStream.prototype.eat = function (match) {
    var ch = this.string.charAt(this.pos);
    var ok;
    if (typeof match == "string") { ok = ch == match; }
    else { ok = ch && (match.test ? match.test(ch) : match(ch)); }
    if (ok) {++this.pos; return ch}
  };
  StringStream.prototype.eatWhile = function (match) {
    var start = this.pos;
    while (this.eat(match)){}
    return this.pos > start
  };
  StringStream.prototype.eatSpace = function () {
    var start = this.pos;
    while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) { ++this.pos; }
    return this.pos > start
  };
  StringStream.prototype.skipToEnd = function () {this.pos = this.string.length;};
  StringStream.prototype.skipTo = function (ch) {
    var found = this.string.indexOf(ch, this.pos);
    if (found > -1) {this.pos = found; return true}
  };
  StringStream.prototype.backUp = function (n) {this.pos -= n;};
  StringStream.prototype.column = function () {
    if (this.lastColumnPos < this.start) {
      this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue);
      this.lastColumnPos = this.start;
    }
    return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
  };
  StringStream.prototype.indentation = function () {
    return countColumn(this.string, null, this.tabSize) -
      (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
  };
  StringStream.prototype.match = function (pattern, consume, caseInsensitive) {
    if (typeof pattern == "string") {
      var cased = function (str) { return caseInsensitive ? str.toLowerCase() : str; };
      var substr = this.string.substr(this.pos, pattern.length);
      if (cased(substr) == cased(pattern)) {
        if (consume !== false) { this.pos += pattern.length; }
        return true
      }
    } else {
      var match = this.string.slice(this.pos).match(pattern);
      if (match && match.index > 0) { return null }
      if (match && consume !== false) { this.pos += match[0].length; }
      return match
    }
  };
  StringStream.prototype.current = function (){return this.string.slice(this.start, this.pos)};
  StringStream.prototype.hideFirstChars = function (n, inner) {
    this.lineStart += n;
    try { return inner() }
    finally { this.lineStart -= n; }
  };
  StringStream.prototype.lookAhead = function (n) {
    var oracle = this.lineOracle;
    return oracle && oracle.lookAhead(n)
  };
  StringStream.prototype.baseToken = function () {
    var oracle = this.lineOracle;
    return oracle && oracle.baseToken(this.pos)
  };

  // Find the line object corresponding to the given line number.
  function getLine(doc, n) {
    n -= doc.first;
    if (n < 0 || n >= doc.size) { throw new Error("There is no line " + (n + doc.first) + " in the document.") }
    var chunk = doc;
    while (!chunk.lines) {
      for (var i = 0;; ++i) {
        var child = chunk.children[i], sz = child.chunkSize();
        if (n < sz) { chunk = child; break }
        n -= sz;
      }
    }
    return chunk.lines[n]
  }

  // Get the part of a document between two positions, as an array of
  // strings.
  function getBetween(doc, start, end) {
    var out = [], n = start.line;
    doc.iter(start.line, end.line + 1, function (line) {
      var text = line.text;
      if (n == end.line) { text = text.slice(0, end.ch); }
      if (n == start.line) { text = text.slice(start.ch); }
      out.push(text);
      ++n;
    });
    return out
  }
  // Get the lines between from and to, as array of strings.
  function getLines(doc, from, to) {
    var out = [];
    doc.iter(from, to, function (line) { out.push(line.text); }); // iter aborts when callback returns truthy value
    return out
  }

  // Update the height of a line, propagating the height change
  // upwards to parent nodes.
  function updateLineHeight(line, height) {
    var diff = height - line.height;
    if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }
  }

  // Given a line object, find its line number by walking up through
  // its parent links.
  function lineNo(line) {
    if (line.parent == null) { return null }
    var cur = line.parent, no = indexOf(cur.lines, line);
    for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {
      for (var i = 0;; ++i) {
        if (chunk.children[i] == cur) { break }
        no += chunk.children[i].chunkSize();
      }
    }
    return no + cur.first
  }

  // Find the line at the given vertical position, using the height
  // information in the document tree.
  function lineAtHeight(chunk, h) {
    var n = chunk.first;
    outer: do {
      for (var i$1 = 0; i$1 < chunk.children.length; ++i$1) {
        var child = chunk.children[i$1], ch = child.height;
        if (h < ch) { chunk = child; continue outer }
        h -= ch;
        n += child.chunkSize();
      }
      return n
    } while (!chunk.lines)
    var i = 0;
    for (; i < chunk.lines.length; ++i) {
      var line = chunk.lines[i], lh = line.height;
      if (h < lh) { break }
      h -= lh;
    }
    return n + i
  }

  function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size}

  function lineNumberFor(options, i) {
    return String(options.lineNumberFormatter(i + options.firstLineNumber))
  }

  // A Pos instance represents a position within the text.
  function Pos(line, ch, sticky) {
    if ( sticky === void 0 ) sticky = null;

    if (!(this instanceof Pos)) { return new Pos(line, ch, sticky) }
    this.line = line;
    this.ch = ch;
    this.sticky = sticky;
  }

  // Compare two positions, return 0 if they are the same, a negative
  // number when a is less, and a positive number otherwise.
  function cmp(a, b) { return a.line - b.line || a.ch - b.ch }

  function equalCursorPos(a, b) { return a.sticky == b.sticky && cmp(a, b) == 0 }

  function copyPos(x) {return Pos(x.line, x.ch)}
  function maxPos(a, b) { return cmp(a, b) < 0 ? b : a }
  function minPos(a, b) { return cmp(a, b) < 0 ? a : b }

  // Most of the external API clips given positions to make sure they
  // actually exist within the document.
  function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1))}
  function clipPos(doc, pos) {
    if (pos.line < doc.first) { return Pos(doc.first, 0) }
    var last = doc.first + doc.size - 1;
    if (pos.line > last) { return Pos(last, getLine(doc, last).text.length) }
    return clipToLen(pos, getLine(doc, pos.line).text.length)
  }
  function clipToLen(pos, linelen) {
    var ch = pos.ch;
    if (ch == null || ch > linelen) { return Pos(pos.line, linelen) }
    else if (ch < 0) { return Pos(pos.line, 0) }
    else { return pos }
  }
  function clipPosArray(doc, array) {
    var out = [];
    for (var i = 0; i < array.length; i++) { out[i] = clipPos(doc, array[i]); }
    return out
  }

  var SavedContext = function(state, lookAhead) {
    this.state = state;
    this.lookAhead = lookAhead;
  };

  var Context = function(doc, state, line, lookAhead) {
    this.state = state;
    this.doc = doc;
    this.line = line;
    this.maxLookAhead = lookAhead || 0;
    this.baseTokens = null;
    this.baseTokenPos = 1;
  };

  Context.prototype.lookAhead = function (n) {
    var line = this.doc.getLine(this.line + n);
    if (line != null && n > this.maxLookAhead) { this.maxLookAhead = n; }
    return line
  };

  Context.prototype.baseToken = function (n) {
    if (!this.baseTokens) { return null }
    while (this.baseTokens[this.baseTokenPos] <= n)
      { this.baseTokenPos += 2; }
    var type = this.baseTokens[this.baseTokenPos + 1];
    return {type: type && type.replace(/( |^)overlay .*/, ""),
            size: this.baseTokens[this.baseTokenPos] - n}
  };

  Context.prototype.nextLine = function () {
    this.line++;
    if (this.maxLookAhead > 0) { this.maxLookAhead--; }
  };

  Context.fromSaved = function (doc, saved, line) {
    if (saved instanceof SavedContext)
      { return new Context(doc, copyState(doc.mode, saved.state), line, saved.lookAhead) }
    else
      { return new Context(doc, copyState(doc.mode, saved), line) }
  };

  Context.prototype.save = function (copy) {
    var state = copy !== false ? copyState(this.doc.mode, this.state) : this.state;
    return this.maxLookAhead > 0 ? new SavedContext(state, this.maxLookAhead) : state
  };


  // Compute a style array (an array starting with a mode generation
  // -- for invalidation -- followed by pairs of end positions and
  // style strings), which is used to highlight the tokens on the
  // line.
  function highlightLine(cm, line, context, forceToEnd) {
    // A styles array always starts with a number identifying the
    // mode/overlays that it is based on (for easy invalidation).
    var st = [cm.state.modeGen], lineClasses = {};
    // Compute the base array of styles
    runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },
            lineClasses, forceToEnd);
    var state = context.state;

    // Run overlays, adjust style array.
    var loop = function ( o ) {
      context.baseTokens = st;
      var overlay = cm.state.overlays[o], i = 1, at = 0;
      context.state = true;
      runMode(cm, line.text, overlay.mode, context, function (end, style) {
        var start = i;
        // Ensure there's a token end at the current position, and that i points at it
        while (at < end) {
          var i_end = st[i];
          if (i_end > end)
            { st.splice(i, 1, end, st[i+1], i_end); }
          i += 2;
          at = Math.min(end, i_end);
        }
        if (!style) { return }
        if (overlay.opaque) {
          st.splice(start, i - start, end, "overlay " + style);
          i = start + 2;
        } else {
          for (; start < i; start += 2) {
            var cur = st[start+1];
            st[start+1] = (cur ? cur + " " : "") + "overlay " + style;
          }
        }
      }, lineClasses);
      context.state = state;
      context.baseTokens = null;
      context.baseTokenPos = 1;
    };

    for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );

    return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}
  }

  function getLineStyles(cm, line, updateFrontier) {
    if (!line.styles || line.styles[0] != cm.state.modeGen) {
      var context = getContextBefore(cm, lineNo(line));
      var resetState = line.text.length > cm.options.maxHighlightLength && copyState(cm.doc.mode, context.state);
      var result = highlightLine(cm, line, context);
      if (resetState) { context.state = resetState; }
      line.stateAfter = context.save(!resetState);
      line.styles = result.styles;
      if (result.classes) { line.styleClasses = result.classes; }
      else if (line.styleClasses) { line.styleClasses = null; }
      if (updateFrontier === cm.doc.highlightFrontier)
        { cm.doc.modeFrontier = Math.max(cm.doc.modeFrontier, ++cm.doc.highlightFrontier); }
    }
    return line.styles
  }

  function getContextBefore(cm, n, precise) {
    var doc = cm.doc, display = cm.display;
    if (!doc.mode.startState) { return new Context(doc, true, n) }
    var start = findStartLine(cm, n, precise);
    var saved = start > doc.first && getLine(doc, start - 1).stateAfter;
    var context = saved ? Context.fromSaved(doc, saved, start) : new Context(doc, startState(doc.mode), start);

    doc.iter(start, n, function (line) {
      processLine(cm, line.text, context);
      var pos = context.line;
      line.stateAfter = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo ? context.save() : null;
      context.nextLine();
    });
    if (precise) { doc.modeFrontier = context.line; }
    return context
  }

  // Lightweight form of highlight -- proceed over this line and
  // update state, but don't save a style array. Used for lines that
  // aren't currently visible.
  function processLine(cm, text, context, startAt) {
    var mode = cm.doc.mode;
    var stream = new StringStream(text, cm.options.tabSize, context);
    stream.start = stream.pos = startAt || 0;
    if (text == "") { callBlankLine(mode, context.state); }
    while (!stream.eol()) {
      readToken(mode, stream, context.state);
      stream.start = stream.pos;
    }
  }

  function callBlankLine(mode, state) {
    if (mode.blankLine) { return mode.blankLine(state) }
    if (!mode.innerMode) { return }
    var inner = innerMode(mode, state);
    if (inner.mode.blankLine) { return inner.mode.blankLine(inner.state) }
  }

  function readToken(mode, stream, state, inner) {
    for (var i = 0; i < 10; i++) {
      if (inner) { inner[0] = innerMode(mode, state).mode; }
      var style = mode.token(stream, state);
      if (stream.pos > stream.start) { return style }
    }
    throw new Error("Mode " + mode.name + " failed to advance stream.")
  }

  var Token = function(stream, type, state) {
    this.start = stream.start; this.end = stream.pos;
    this.string = stream.current();
    this.type = type || null;
    this.state = state;
  };

  // Utility for getTokenAt and getLineTokens
  function takeToken(cm, pos, precise, asArray) {
    var doc = cm.doc, mode = doc.mode, style;
    pos = clipPos(doc, pos);
    var line = getLine(doc, pos.line), context = getContextBefore(cm, pos.line, precise);
    var stream = new StringStream(line.text, cm.options.tabSize, context), tokens;
    if (asArray) { tokens = []; }
    while ((asArray || stream.pos < pos.ch) && !stream.eol()) {
      stream.start = stream.pos;
      style = readToken(mode, stream, context.state);
      if (asArray) { tokens.push(new Token(stream, style, copyState(doc.mode, context.state))); }
    }
    return asArray ? tokens : new Token(stream, style, context.state)
  }

  function extractLineClasses(type, output) {
    if (type) { for (;;) {
      var lineClass = type.match(/(?:^|\s+)line-(background-)?(\S+)/);
      if (!lineClass) { break }
      type = type.slice(0, lineClass.index) + type.slice(lineClass.index + lineClass[0].length);
      var prop = lineClass[1] ? "bgClass" : "textClass";
      if (output[prop] == null)
        { output[prop] = lineClass[2]; }
      else if (!(new RegExp("(?:^|\\s)" + lineClass[2] + "(?:$|\\s)")).test(output[prop]))
        { output[prop] += " " + lineClass[2]; }
    } }
    return type
  }

  // Run the given mode's parser over a line, calling f for each token.
  function runMode(cm, text, mode, context, f, lineClasses, forceToEnd) {
    var flattenSpans = mode.flattenSpans;
    if (flattenSpans == null) { flattenSpans = cm.options.flattenSpans; }
    var curStart = 0, curStyle = null;
    var stream = new StringStream(text, cm.options.tabSize, context), style;
    var inner = cm.options.addModeClass && [null];
    if (text == "") { extractLineClasses(callBlankLine(mode, context.state), lineClasses); }
    while (!stream.eol()) {
      if (stream.pos > cm.options.maxHighlightLength) {
        flattenSpans = false;
        if (forceToEnd) { processLine(cm, text, context, stream.pos); }
        stream.pos = text.length;
        style = null;
      } else {
        style = extractLineClasses(readToken(mode, stream, context.state, inner), lineClasses);
      }
      if (inner) {
        var mName = inner[0].name;
        if (mName) { style = "m-" + (style ? mName + " " + style : mName); }
      }
      if (!flattenSpans || curStyle != style) {
        while (curStart < stream.start) {
          curStart = Math.min(stream.start, curStart + 5000);
          f(curStart, curStyle);
        }
        curStyle = style;
      }
      stream.start = stream.pos;
    }
    while (curStart < stream.pos) {
      // Webkit seems to refuse to render text nodes longer than 57444
      // characters, and returns inaccurate measurements in nodes
      // starting around 5000 chars.
      var pos = Math.min(stream.pos, curStart + 5000);
      f(pos, curStyle);
      curStart = pos;
    }
  }

  // Finds the line to start with when starting a parse. Tries to
  // find a line with a stateAfter, so that it can start with a
  // valid state. If that fails, it returns the line with the
  // smallest indentation, which tends to need the least context to
  // parse correctly.
  function findStartLine(cm, n, precise) {
    var minindent, minline, doc = cm.doc;
    var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);
    for (var search = n; search > lim; --search) {
      if (search <= doc.first) { return doc.first }
      var line = getLine(doc, search - 1), after = line.stateAfter;
      if (after && (!precise || search + (after instanceof SavedContext ? after.lookAhead : 0) <= doc.modeFrontier))
        { return search }
      var indented = countColumn(line.text, null, cm.options.tabSize);
      if (minline == null || minindent > indented) {
        minline = search - 1;
        minindent = indented;
      }
    }
    return minline
  }

  function retreatFrontier(doc, n) {
    doc.modeFrontier = Math.min(doc.modeFrontier, n);
    if (doc.highlightFrontier < n - 10) { return }
    var start = doc.first;
    for (var line = n - 1; line > start; line--) {
      var saved = getLine(doc, line).stateAfter;
      // change is on 3
      // state on line 1 looked ahead 2 -- so saw 3
      // test 1 + 2 < 3 should cover this
      if (saved && (!(saved instanceof SavedContext) || line + saved.lookAhead < n)) {
        start = line + 1;
        break
      }
    }
    doc.highlightFrontier = Math.min(doc.highlightFrontier, start);
  }

  // Optimize some code when these features are not used.
  var sawReadOnlySpans = false, sawCollapsedSpans = false;

  function seeReadOnlySpans() {
    sawReadOnlySpans = true;
  }

  function seeCollapsedSpans() {
    sawCollapsedSpans = true;
  }

  // TEXTMARKER SPANS

  function MarkedSpan(marker, from, to) {
    this.marker = marker;
    this.from = from; this.to = to;
  }

  // Search an array of spans for a span matching the given marker.
  function getMarkedSpanFor(spans, marker) {
    if (spans) { for (var i = 0; i < spans.length; ++i) {
      var span = spans[i];
      if (span.marker == marker) { return span }
    } }
  }

  // Remove a span from an array, returning undefined if no spans are
  // left (we don't store arrays for lines without spans).
  function removeMarkedSpan(spans, span) {
    var r;
    for (var i = 0; i < spans.length; ++i)
      { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }
    return r
  }

  // Add a span to a line.
  function addMarkedSpan(line, span, op) {
    var inThisOp = op && window.WeakSet && (op.markedSpans || (op.markedSpans = new WeakSet));
    if (inThisOp && inThisOp.has(line.markedSpans)) {
      line.markedSpans.push(span);
    } else {
      line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];
      if (inThisOp) { inThisOp.add(line.markedSpans); }
    }
    span.marker.attachLine(line);
  }

  // Used for the algorithm that adjusts markers for a change in the
  // document. These functions cut an array of spans at a given
  // character position, returning an array of remaining chunks (or
  // undefined if nothing remains).
  function markedSpansBefore(old, startCh, isInsert) {
    var nw;
    if (old) { for (var i = 0; i < old.length; ++i) {
      var span = old[i], marker = span.marker;
      var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh);
      if (startsBefore || span.from == startCh && marker.type == "bookmark" && (!isInsert || !span.marker.insertLeft)) {
        var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh)
        ;(nw || (nw = [])).push(new MarkedSpan(marker, span.from, endsAfter ? null : span.to));
      }
    } }
    return nw
  }
  function markedSpansAfter(old, endCh, isInsert) {
    var nw;
    if (old) { for (var i = 0; i < old.length; ++i) {
      var span = old[i], marker = span.marker;
      var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh);
      if (endsAfter || span.from == endCh && marker.type == "bookmark" && (!isInsert || span.marker.insertLeft)) {
        var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh)
        ;(nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh,
                                              span.to == null ? null : span.to - endCh));
      }
    } }
    return nw
  }

  // Given a change object, compute the new set of marker spans that
  // cover the line in which the change took place. Removes spans
  // entirely within the change, reconnects spans belonging to the
  // same marker that appear on both sides of the change, and cuts off
  // spans partially within the change. Returns an array of span
  // arrays with one element for each line in (after) the change.
  function stretchSpansOverChange(doc, change) {
    if (change.full) { return null }
    var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;
    var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;
    if (!oldFirst && !oldLast) { return null }

    var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0;
    // Get the spans that 'stick out' on both sides
    var first = markedSpansBefore(oldFirst, startCh, isInsert);
    var last = markedSpansAfter(oldLast, endCh, isInsert);

    // Next, merge those two ends
    var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);
    if (first) {
      // Fix up .to properties of first
      for (var i = 0; i < first.length; ++i) {
        var span = first[i];
        if (span.to == null) {
          var found = getMarkedSpanFor(last, span.marker);
          if (!found) { span.to = startCh; }
          else if (sameLine) { span.to = found.to == null ? null : found.to + offset; }
        }
      }
    }
    if (last) {
      // Fix up .from in last (or move them into first in case of sameLine)
      for (var i$1 = 0; i$1 < last.length; ++i$1) {
        var span$1 = last[i$1];
        if (span$1.to != null) { span$1.to += offset; }
        if (span$1.from == null) {
          var found$1 = getMarkedSpanFor(first, span$1.marker);
          if (!found$1) {
            span$1.from = offset;
            if (sameLine) { (first || (first = [])).push(span$1); }
          }
        } else {
          span$1.from += offset;
          if (sameLine) { (first || (first = [])).push(span$1); }
        }
      }
    }
    // Make sure we didn't create any zero-length spans
    if (first) { first = clearEmptySpans(first); }
    if (last && last != first) { last = clearEmptySpans(last); }

    var newMarkers = [first];
    if (!sameLine) {
      // Fill gap with whole-line-spans
      var gap = change.text.length - 2, gapMarkers;
      if (gap > 0 && first)
        { for (var i$2 = 0; i$2 < first.length; ++i$2)
          { if (first[i$2].to == null)
            { (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)); } } }
      for (var i$3 = 0; i$3 < gap; ++i$3)
        { newMarkers.push(gapMarkers); }
      newMarkers.push(last);
    }
    return newMarkers
  }

  // Remove spans that are empty and don't have a clearWhenEmpty
  // option of false.
  function clearEmptySpans(spans) {
    for (var i = 0; i < spans.length; ++i) {
      var span = spans[i];
      if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false)
        { spans.splice(i--, 1); }
    }
    if (!spans.length) { return null }
    return spans
  }

  // Used to 'clip' out readOnly ranges when making a change.
  function removeReadOnlyRanges(doc, from, to) {
    var markers = null;
    doc.iter(from.line, to.line + 1, function (line) {
      if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {
        var mark = line.markedSpans[i].marker;
        if (mark.readOnly && (!markers || indexOf(markers, mark) == -1))
          { (markers || (markers = [])).push(mark); }
      } }
    });
    if (!markers) { return null }
    var parts = [{from: from, to: to}];
    for (var i = 0; i < markers.length; ++i) {
      var mk = markers[i], m = mk.find(0);
      for (var j = 0; j < parts.length; ++j) {
        var p = parts[j];
        if (cmp(p.to, m.from) < 0 || cmp(p.from, m.to) > 0) { continue }
        var newParts = [j, 1], dfrom = cmp(p.from, m.from), dto = cmp(p.to, m.to);
        if (dfrom < 0 || !mk.inclusiveLeft && !dfrom)
          { newParts.push({from: p.from, to: m.from}); }
        if (dto > 0 || !mk.inclusiveRight && !dto)
          { newParts.push({from: m.to, to: p.to}); }
        parts.splice.apply(parts, newParts);
        j += newParts.length - 3;
      }
    }
    return parts
  }

  // Connect or disconnect spans from a line.
  function detachMarkedSpans(line) {
    var spans = line.markedSpans;
    if (!spans) { return }
    for (var i = 0; i < spans.length; ++i)
      { spans[i].marker.detachLine(line); }
    line.markedSpans = null;
  }
  function attachMarkedSpans(line, spans) {
    if (!spans) { return }
    for (var i = 0; i < spans.length; ++i)
      { spans[i].marker.attachLine(line); }
    line.markedSpans = spans;
  }

  // Helpers used when computing which overlapping collapsed span
  // counts as the larger one.
  function extraLeft(marker) { return marker.inclusiveLeft ? -1 : 0 }
  function extraRight(marker) { return marker.inclusiveRight ? 1 : 0 }

  // Returns a number indicating which of two overlapping collapsed
  // spans is larger (and thus includes the other). Falls back to
  // comparing ids when the spans cover exactly the same range.
  function compareCollapsedMarkers(a, b) {
    var lenDiff = a.lines.length - b.lines.length;
    if (lenDiff != 0) { return lenDiff }
    var aPos = a.find(), bPos = b.find();
    var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b);
    if (fromCmp) { return -fromCmp }
    var toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b);
    if (toCmp) { return toCmp }
    return b.id - a.id
  }

  // Find out whether a line ends or starts in a collapsed span. If
  // so, return the marker for that span.
  function collapsedSpanAtSide(line, start) {
    var sps = sawCollapsedSpans && line.markedSpans, found;
    if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {
      sp = sps[i];
      if (sp.marker.collapsed && (start ? sp.from : sp.to) == null &&
          (!found || compareCollapsedMarkers(found, sp.marker) < 0))
        { found = sp.marker; }
    } }
    return found
  }
  function collapsedSpanAtStart(line) { return collapsedSpanAtSide(line, true) }
  function collapsedSpanAtEnd(line) { return collapsedSpanAtSide(line, false) }

  function collapsedSpanAround(line, ch) {
    var sps = sawCollapsedSpans && line.markedSpans, found;
    if (sps) { for (var i = 0; i < sps.length; ++i) {
      var sp = sps[i];
      if (sp.marker.collapsed && (sp.from == null || sp.from < ch) && (sp.to == null || sp.to > ch) &&
          (!found || compareCollapsedMarkers(found, sp.marker) < 0)) { found = sp.marker; }
    } }
    return found
  }

  // Test whether there exists a collapsed span that partially
  // overlaps (covers the start or end, but not both) of a new span.
  // Such overlap is not allowed.
  function conflictingCollapsedRange(doc, lineNo, from, to, marker) {
    var line = getLine(doc, lineNo);
    var sps = sawCollapsedSpans && line.markedSpans;
    if (sps) { for (var i = 0; i < sps.length; ++i) {
      var sp = sps[i];
      if (!sp.marker.collapsed) { continue }
      var found = sp.marker.find(0);
      var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker);
      var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker);
      if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) { continue }
      if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) ||
          fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0))
        { return true }
    } }
  }

  // A visual line is a line as drawn on the screen. Folding, for
  // example, can cause multiple logical lines to appear on the same
  // visual line. This finds the start of the visual line that the
  // given line is part of (usually that is the line itself).
  function visualLine(line) {
    var merged;
    while (merged = collapsedSpanAtStart(line))
      { line = merged.find(-1, true).line; }
    return line
  }

  function visualLineEnd(line) {
    var merged;
    while (merged = collapsedSpanAtEnd(line))
      { line = merged.find(1, true).line; }
    return line
  }

  // Returns an array of logical lines that continue the visual line
  // started by the argument, or undefined if there are no such lines.
  function visualLineContinued(line) {
    var merged, lines;
    while (merged = collapsedSpanAtEnd(line)) {
      line = merged.find(1, true).line
      ;(lines || (lines = [])).push(line);
    }
    return lines
  }

  // Get the line number of the start of the visual line that the
  // given line number is part of.
  function visualLineNo(doc, lineN) {
    var line = getLine(doc, lineN), vis = visualLine(line);
    if (line == vis) { return lineN }
    return lineNo(vis)
  }

  // Get the line number of the start of the next visual line after
  // the given line.
  function visualLineEndNo(doc, lineN) {
    if (lineN > doc.lastLine()) { return lineN }
    var line = getLine(doc, lineN), merged;
    if (!lineIsHidden(doc, line)) { return lineN }
    while (merged = collapsedSpanAtEnd(line))
      { line = merged.find(1, true).line; }
    return lineNo(line) + 1
  }

  // Compute whether a line is hidden. Lines count as hidden when they
  // are part of a visual line that starts with another line, or when
  // they are entirely covered by collapsed, non-widget span.
  function lineIsHidden(doc, line) {
    var sps = sawCollapsedSpans && line.markedSpans;
    if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {
      sp = sps[i];
      if (!sp.marker.collapsed) { continue }
      if (sp.from == null) { return true }
      if (sp.marker.widgetNode) { continue }
      if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp))
        { return true }
    } }
  }
  function lineIsHiddenInner(doc, line, span) {
    if (span.to == null) {
      var end = span.marker.find(1, true);
      return lineIsHiddenInner(doc, end.line, getMarkedSpanFor(end.line.markedSpans, span.marker))
    }
    if (span.marker.inclusiveRight && span.to == line.text.length)
      { return true }
    for (var sp = (void 0), i = 0; i < line.markedSpans.length; ++i) {
      sp = line.markedSpans[i];
      if (sp.marker.collapsed && !sp.marker.widgetNode && sp.from == span.to &&
          (sp.to == null || sp.to != span.from) &&
          (sp.marker.inclusiveLeft || span.marker.inclusiveRight) &&
          lineIsHiddenInner(doc, line, sp)) { return true }
    }
  }

  // Find the height above the given line.
  function heightAtLine(lineObj) {
    lineObj = visualLine(lineObj);

    var h = 0, chunk = lineObj.parent;
    for (var i = 0; i < chunk.lines.length; ++i) {
      var line = chunk.lines[i];
      if (line == lineObj) { break }
      else { h += line.height; }
    }
    for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {
      for (var i$1 = 0; i$1 < p.children.length; ++i$1) {
        var cur = p.children[i$1];
        if (cur == chunk) { break }
        else { h += cur.height; }
      }
    }
    return h
  }

  // Compute the character length of a line, taking into account
  // collapsed ranges (see markText) that might hide parts, and join
  // other lines onto it.
  function lineLength(line) {
    if (line.height == 0) { return 0 }
    var len = line.text.length, merged, cur = line;
    while (merged = collapsedSpanAtStart(cur)) {
      var found = merged.find(0, true);
      cur = found.from.line;
      len += found.from.ch - found.to.ch;
    }
    cur = line;
    while (merged = collapsedSpanAtEnd(cur)) {
      var found$1 = merged.find(0, true);
      len -= cur.text.length - found$1.from.ch;
      cur = found$1.to.line;
      len += cur.text.length - found$1.to.ch;
    }
    return len
  }

  // Find the longest line in the document.
  function findMaxLine(cm) {
    var d = cm.display, doc = cm.doc;
    d.maxLine = getLine(doc, doc.first);
    d.maxLineLength = lineLength(d.maxLine);
    d.maxLineChanged = true;
    doc.iter(function (line) {
      var len = lineLength(line);
      if (len > d.maxLineLength) {
        d.maxLineLength = len;
        d.maxLine = line;
      }
    });
  }

  // LINE DATA STRUCTURE

  // Line objects. These hold state related to a line, including
  // highlighting info (the styles array).
  var Line = function(text, markedSpans, estimateHeight) {
    this.text = text;
    attachMarkedSpans(this, markedSpans);
    this.height = estimateHeight ? estimateHeight(this) : 1;
  };

  Line.prototype.lineNo = function () { return lineNo(this) };
  eventMixin(Line);

  // Change the content (text, markers) of a line. Automatically
  // invalidates cached information and tries to re-estimate the
  // line's height.
  function updateLine(line, text, markedSpans, estimateHeight) {
    line.text = text;
    if (line.stateAfter) { line.stateAfter = null; }
    if (line.styles) { line.styles = null; }
    if (line.order != null) { line.order = null; }
    detachMarkedSpans(line);
    attachMarkedSpans(line, markedSpans);
    var estHeight = estimateHeight ? estimateHeight(line) : 1;
    if (estHeight != line.height) { updateLineHeight(line, estHeight); }
  }

  // Detach a line from the document tree and its markers.
  function cleanUpLine(line) {
    line.parent = null;
    detachMarkedSpans(line);
  }

  // Convert a style as returned by a mode (either null, or a string
  // containing one or more styles) to a CSS style. This is cached,
  // and also looks for line-wide styles.
  var styleToClassCache = {}, styleToClassCacheWithMode = {};
  function interpretTokenStyle(style, options) {
    if (!style || /^\s*$/.test(style)) { return null }
    var cache = options.addModeClass ? styleToClassCacheWithMode : styleToClassCache;
    return cache[style] ||
      (cache[style] = style.replace(/\S+/g, "cm-$&"))
  }

  // Render the DOM representation of the text of a line. Also builds
  // up a 'line map', which points at the DOM nodes that represent
  // specific stretches of text, and is used by the measuring code.
  // The returned object contains the DOM node, this map, and
  // information about line-wide styles that were set by the mode.
  function buildLineContent(cm, lineView) {
    // The padding-right forces the element to have a 'border', which
    // is needed on Webkit to be able to get line-level bounding
    // rectangles for it (in measureChar).
    var content = eltP("span", null, null, webkit ? "padding-right: .1px" : null);
    var builder = {pre: eltP("pre", [content], "CodeMirror-line"), content: content,
                   col: 0, pos: 0, cm: cm,
                   trailingSpace: false,
                   splitSpaces: cm.getOption("lineWrapping")};
    lineView.measure = {};

    // Iterate over the logical lines that make up this visual line.
    for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {
      var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);
      builder.pos = 0;
      builder.addToken = buildToken;
      // Optionally wire in some hacks into the token-rendering
      // algorithm, to deal with browser quirks.
      if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))
        { builder.addToken = buildTokenBadBidi(builder.addToken, order); }
      builder.map = [];
      var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);
      insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));
      if (line.styleClasses) {
        if (line.styleClasses.bgClass)
          { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || ""); }
        if (line.styleClasses.textClass)
          { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || ""); }
      }

      // Ensure at least a single node is present, for measuring.
      if (builder.map.length == 0)
        { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }

      // Store the map and a cache object for the current logical line
      if (i == 0) {
        lineView.measure.map = builder.map;
        lineView.measure.cache = {};
      } else {
  (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)
        ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});
      }
    }

    // See issue #2901
    if (webkit) {
      var last = builder.content.lastChild;
      if (/\bcm-tab\b/.test(last.className) || (last.querySelector && last.querySelector(".cm-tab")))
        { builder.content.className = "cm-tab-wrap-hack"; }
    }

    signal(cm, "renderLine", cm, lineView.line, builder.pre);
    if (builder.pre.className)
      { builder.textClass = joinClasses(builder.pre.className, builder.textClass || ""); }

    return builder
  }

  function defaultSpecialCharPlaceholder(ch) {
    var token = elt("span", "\u2022", "cm-invalidchar");
    token.title = "\\u" + ch.charCodeAt(0).toString(16);
    token.setAttribute("aria-label", token.title);
    return token
  }

  // Build up the DOM representation for a single token, and add it to
  // the line map. Takes care to render special characters separately.
  function buildToken(builder, text, style, startStyle, endStyle, css, attributes) {
    if (!text) { return }
    var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;
    var special = builder.cm.state.specialChars, mustWrap = false;
    var content;
    if (!special.test(text)) {
      builder.col += text.length;
      content = document.createTextNode(displayText);
      builder.map.push(builder.pos, builder.pos + text.length, content);
      if (ie && ie_version < 9) { mustWrap = true; }
      builder.pos += text.length;
    } else {
      content = document.createDocumentFragment();
      var pos = 0;
      while (true) {
        special.lastIndex = pos;
        var m = special.exec(text);
        var skipped = m ? m.index - pos : text.length - pos;
        if (skipped) {
          var txt = document.createTextNode(displayText.slice(pos, pos + skipped));
          if (ie && ie_version < 9) { content.appendChild(elt("span", [txt])); }
          else { content.appendChild(txt); }
          builder.map.push(builder.pos, builder.pos + skipped, txt);
          builder.col += skipped;
          builder.pos += skipped;
        }
        if (!m) { break }
        pos += skipped + 1;
        var txt$1 = (void 0);
        if (m[0] == "\t") {
          var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;
          txt$1 = content.appendChild(elt("span", spaceStr(tabWidth), "cm-tab"));
          txt$1.setAttribute("role", "presentation");
          txt$1.setAttribute("cm-text", "\t");
          builder.col += tabWidth;
        } else if (m[0] == "\r" || m[0] == "\n") {
          txt$1 = content.appendChild(elt("span", m[0] == "\r" ? "\u240d" : "\u2424", "cm-invalidchar"));
          txt$1.setAttribute("cm-text", m[0]);
          builder.col += 1;
        } else {
          txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);
          txt$1.setAttribute("cm-text", m[0]);
          if (ie && ie_version < 9) { content.appendChild(elt("span", [txt$1])); }
          else { content.appendChild(txt$1); }
          builder.col += 1;
        }
        builder.map.push(builder.pos, builder.pos + 1, txt$1);
        builder.pos++;
      }
    }
    builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;
    if (style || startStyle || endStyle || mustWrap || css || attributes) {
      var fullStyle = style || "";
      if (startStyle) { fullStyle += startStyle; }
      if (endStyle) { fullStyle += endStyle; }
      var token = elt("span", [content], fullStyle, css);
      if (attributes) {
        for (var attr in attributes) { if (attributes.hasOwnProperty(attr) && attr != "style" && attr != "class")
          { token.setAttribute(attr, attributes[attr]); } }
      }
      return builder.content.appendChild(token)
    }
    builder.content.appendChild(content);
  }

  // Change some spaces to NBSP to prevent the browser from collapsing
  // trailing spaces at the end of a line when rendering text (issue #1362).
  function splitSpaces(text, trailingBefore) {
    if (text.length > 1 && !/  /.test(text)) { return text }
    var spaceBefore = trailingBefore, result = "";
    for (var i = 0; i < text.length; i++) {
      var ch = text.charAt(i);
      if (ch == " " && spaceBefore && (i == text.length - 1 || text.charCodeAt(i + 1) == 32))
        { ch = "\u00a0"; }
      result += ch;
      spaceBefore = ch == " ";
    }
    return result
  }

  // Work around nonsense dimensions being reported for stretches of
  // right-to-left text.
  function buildTokenBadBidi(inner, order) {
    return function (builder, text, style, startStyle, endStyle, css, attributes) {
      style = style ? style + " cm-force-border" : "cm-force-border";
      var start = builder.pos, end = start + text.length;
      for (;;) {
        // Find the part that overlaps with the start of this text
        var part = (void 0);
        for (var i = 0; i < order.length; i++) {
          part = order[i];
          if (part.to > start && part.from <= start) { break }
        }
        if (part.to >= end) { return inner(builder, text, style, startStyle, endStyle, css, attributes) }
        inner(builder, text.slice(0, part.to - start), style, startStyle, null, css, attributes);
        startStyle = null;
        text = text.slice(part.to - start);
        start = part.to;
      }
    }
  }

  function buildCollapsedSpan(builder, size, marker, ignoreWidget) {
    var widget = !ignoreWidget && marker.widgetNode;
    if (widget) { builder.map.push(builder.pos, builder.pos + size, widget); }
    if (!ignoreWidget && builder.cm.display.input.needsContentAttribute) {
      if (!widget)
        { widget = builder.content.appendChild(document.createElement("span")); }
      widget.setAttribute("cm-marker", marker.id);
    }
    if (widget) {
      builder.cm.display.input.setUneditable(widget);
      builder.content.appendChild(widget);
    }
    builder.pos += size;
    builder.trailingSpace = false;
  }

  // Outputs a number of spans to make up a line, taking highlighting
  // and marked text into account.
  function insertLineContent(line, builder, styles) {
    var spans = line.markedSpans, allText = line.text, at = 0;
    if (!spans) {
      for (var i$1 = 1; i$1 < styles.length; i$1+=2)
        { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }
      return
    }

    var len = allText.length, pos = 0, i = 1, text = "", style, css;
    var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, collapsed, attributes;
    for (;;) {
      if (nextChange == pos) { // Update current marker set
        spanStyle = spanEndStyle = spanStartStyle = css = "";
        attributes = null;
        collapsed = null; nextChange = Infinity;
        var foundBookmarks = [], endStyles = (void 0);
        for (var j = 0; j < spans.length; ++j) {
          var sp = spans[j], m = sp.marker;
          if (m.type == "bookmark" && sp.from == pos && m.widgetNode) {
            foundBookmarks.push(m);
          } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {
            if (sp.to != null && sp.to != pos && nextChange > sp.to) {
              nextChange = sp.to;
              spanEndStyle = "";
            }
            if (m.className) { spanStyle += " " + m.className; }
            if (m.css) { css = (css ? css + ";" : "") + m.css; }
            if (m.startStyle && sp.from == pos) { spanStartStyle += " " + m.startStyle; }
            if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }
            // support for the old title property
            // https://github.com/codemirror/CodeMirror/pull/5673
            if (m.title) { (attributes || (attributes = {})).title = m.title; }
            if (m.attributes) {
              for (var attr in m.attributes)
                { (attributes || (attributes = {}))[attr] = m.attributes[attr]; }
            }
            if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))
              { collapsed = sp; }
          } else if (sp.from > pos && nextChange > sp.from) {
            nextChange = sp.from;
          }
        }
        if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)
          { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += " " + endStyles[j$1]; } } }

        if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)
          { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }
        if (collapsed && (collapsed.from || 0) == pos) {
          buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,
                             collapsed.marker, collapsed.from == null);
          if (collapsed.to == null) { return }
          if (collapsed.to == pos) { collapsed = false; }
        }
      }
      if (pos >= len) { break }

      var upto = Math.min(len, nextChange);
      while (true) {
        if (text) {
          var end = pos + text.length;
          if (!collapsed) {
            var tokenText = end > upto ? text.slice(0, upto - pos) : text;
            builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,
                             spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : "", css, attributes);
          }
          if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}
          pos = end;
          spanStartStyle = "";
        }
        text = allText.slice(at, at = styles[i++]);
        style = interpretTokenStyle(styles[i++], builder.cm.options);
      }
    }
  }


  // These objects are used to represent the visible (currently drawn)
  // part of the document. A LineView may correspond to multiple
  // logical lines, if those are connected by collapsed ranges.
  function LineView(doc, line, lineN) {
    // The starting line
    this.line = line;
    // Continuing lines, if any
    this.rest = visualLineContinued(line);
    // Number of logical lines in this visual line
    this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;
    this.node = this.text = null;
    this.hidden = lineIsHidden(doc, line);
  }

  // Create a range of LineView objects for the given lines.
  function buildViewArray(cm, from, to) {
    var array = [], nextPos;
    for (var pos = from; pos < to; pos = nextPos) {
      var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);
      nextPos = pos + view.size;
      array.push(view);
    }
    return array
  }

  var operationGroup = null;

  function pushOperation(op) {
    if (operationGroup) {
      operationGroup.ops.push(op);
    } else {
      op.ownsGroup = operationGroup = {
        ops: [op],
        delayedCallbacks: []
      };
    }
  }

  function fireCallbacksForOps(group) {
    // Calls delayed callbacks and cursorActivity handlers until no
    // new ones appear
    var callbacks = group.delayedCallbacks, i = 0;
    do {
      for (; i < callbacks.length; i++)
        { callbacks[i].call(null); }
      for (var j = 0; j < group.ops.length; j++) {
        var op = group.ops[j];
        if (op.cursorActivityHandlers)
          { while (op.cursorActivityCalled < op.cursorActivityHandlers.length)
            { op.cursorActivityHandlers[op.cursorActivityCalled++].call(null, op.cm); } }
      }
    } while (i < callbacks.length)
  }

  function finishOperation(op, endCb) {
    var group = op.ownsGroup;
    if (!group) { return }

    try { fireCallbacksForOps(group); }
    finally {
      operationGroup = null;
      endCb(group);
    }
  }

  var orphanDelayedCallbacks = null;

  // Often, we want to signal events at a point where we are in the
  // middle of some work, but don't want the handler to start calling
  // other methods on the editor, which might be in an inconsistent
  // state or simply not expect any other events to happen.
  // signalLater looks whether there are any handlers, and schedules
  // them to be executed when the last operation ends, or, if no
  // operation is active, when a timeout fires.
  function signalLater(emitter, type /*, values...*/) {
    var arr = getHandlers(emitter, type);
    if (!arr.length) { return }
    var args = Array.prototype.slice.call(arguments, 2), list;
    if (operationGroup) {
      list = operationGroup.delayedCallbacks;
    } else if (orphanDelayedCallbacks) {
      list = orphanDelayedCallbacks;
    } else {
      list = orphanDelayedCallbacks = [];
      setTimeout(fireOrphanDelayed, 0);
    }
    var loop = function ( i ) {
      list.push(function () { return arr[i].apply(null, args); });
    };

    for (var i = 0; i < arr.length; ++i)
      loop( i );
  }

  function fireOrphanDelayed() {
    var delayed = orphanDelayedCallbacks;
    orphanDelayedCallbacks = null;
    for (var i = 0; i < delayed.length; ++i) { delayed[i](); }
  }

  // When an aspect of a line changes, a string is added to
  // lineView.changes. This updates the relevant part of the line's
  // DOM structure.
  function updateLineForChanges(cm, lineView, lineN, dims) {
    for (var j = 0; j < lineView.changes.length; j++) {
      var type = lineView.changes[j];
      if (type == "text") { updateLineText(cm, lineView); }
      else if (type == "gutter") { updateLineGutter(cm, lineView, lineN, dims); }
      else if (type == "class") { updateLineClasses(cm, lineView); }
      else if (type == "widget") { updateLineWidgets(cm, lineView, dims); }
    }
    lineView.changes = null;
  }

  // Lines with gutter elements, widgets or a background class need to
  // be wrapped, and have the extra elements added to the wrapper div
  function ensureLineWrapped(lineView) {
    if (lineView.node == lineView.text) {
      lineView.node = elt("div", null, null, "position: relative");
      if (lineView.text.parentNode)
        { lineView.text.parentNode.replaceChild(lineView.node, lineView.text); }
      lineView.node.appendChild(lineView.text);
      if (ie && ie_version < 8) { lineView.node.style.zIndex = 2; }
    }
    return lineView.node
  }

  function updateLineBackground(cm, lineView) {
    var cls = lineView.bgClass ? lineView.bgClass + " " + (lineView.line.bgClass || "") : lineView.line.bgClass;
    if (cls) { cls += " CodeMirror-linebackground"; }
    if (lineView.background) {
      if (cls) { lineView.background.className = cls; }
      else { lineView.background.parentNode.removeChild(lineView.background); lineView.background = null; }
    } else if (cls) {
      var wrap = ensureLineWrapped(lineView);
      lineView.background = wrap.insertBefore(elt("div", null, cls), wrap.firstChild);
      cm.display.input.setUneditable(lineView.background);
    }
  }

  // Wrapper around buildLineContent which will reuse the structure
  // in display.externalMeasured when possible.
  function getLineContent(cm, lineView) {
    var ext = cm.display.externalMeasured;
    if (ext && ext.line == lineView.line) {
      cm.display.externalMeasured = null;
      lineView.measure = ext.measure;
      return ext.built
    }
    return buildLineContent(cm, lineView)
  }

  // Redraw the line's text. Interacts with the background and text
  // classes because the mode may output tokens that influence these
  // classes.
  function updateLineText(cm, lineView) {
    var cls = lineView.text.className;
    var built = getLineContent(cm, lineView);
    if (lineView.text == lineView.node) { lineView.node = built.pre; }
    lineView.text.parentNode.replaceChild(built.pre, lineView.text);
    lineView.text = built.pre;
    if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {
      lineView.bgClass = built.bgClass;
      lineView.textClass = built.textClass;
      updateLineClasses(cm, lineView);
    } else if (cls) {
      lineView.text.className = cls;
    }
  }

  function updateLineClasses(cm, lineView) {
    updateLineBackground(cm, lineView);
    if (lineView.line.wrapClass)
      { ensureLineWrapped(lineView).className = lineView.line.wrapClass; }
    else if (lineView.node != lineView.text)
      { lineView.node.className = ""; }
    var textClass = lineView.textClass ? lineView.textClass + " " + (lineView.line.textClass || "") : lineView.line.textClass;
    lineView.text.className = textClass || "";
  }

  function updateLineGutter(cm, lineView, lineN, dims) {
    if (lineView.gutter) {
      lineView.node.removeChild(lineView.gutter);
      lineView.gutter = null;
    }
    if (lineView.gutterBackground) {
      lineView.node.removeChild(lineView.gutterBackground);
      lineView.gutterBackground = null;
    }
    if (lineView.line.gutterClass) {
      var wrap = ensureLineWrapped(lineView);
      lineView.gutterBackground = elt("div", null, "CodeMirror-gutter-background " + lineView.line.gutterClass,
                                      ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px; width: " + (dims.gutterTotalWidth) + "px"));
      cm.display.input.setUneditable(lineView.gutterBackground);
      wrap.insertBefore(lineView.gutterBackground, lineView.text);
    }
    var markers = lineView.line.gutterMarkers;
    if (cm.options.lineNumbers || markers) {
      var wrap$1 = ensureLineWrapped(lineView);
      var gutterWrap = lineView.gutter = elt("div", null, "CodeMirror-gutter-wrapper", ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px"));
      gutterWrap.setAttribute("aria-hidden", "true");
      cm.display.input.setUneditable(gutterWrap);
      wrap$1.insertBefore(gutterWrap, lineView.text);
      if (lineView.line.gutterClass)
        { gutterWrap.className += " " + lineView.line.gutterClass; }
      if (cm.options.lineNumbers && (!markers || !markers["CodeMirror-linenumbers"]))
        { lineView.lineNumber = gutterWrap.appendChild(
          elt("div", lineNumberFor(cm.options, lineN),
              "CodeMirror-linenumber CodeMirror-gutter-elt",
              ("left: " + (dims.gutterLeft["CodeMirror-linenumbers"]) + "px; width: " + (cm.display.lineNumInnerWidth) + "px"))); }
      if (markers) { for (var k = 0; k < cm.display.gutterSpecs.length; ++k) {
        var id = cm.display.gutterSpecs[k].className, found = markers.hasOwnProperty(id) && markers[id];
        if (found)
          { gutterWrap.appendChild(elt("div", [found], "CodeMirror-gutter-elt",
                                     ("left: " + (dims.gutterLeft[id]) + "px; width: " + (dims.gutterWidth[id]) + "px"))); }
      } }
    }
  }

  function updateLineWidgets(cm, lineView, dims) {
    if (lineView.alignable) { lineView.alignable = null; }
    var isWidget = classTest("CodeMirror-linewidget");
    for (var node = lineView.node.firstChild, next = (void 0); node; node = next) {
      next = node.nextSibling;
      if (isWidget.test(node.className)) { lineView.node.removeChild(node); }
    }
    insertLineWidgets(cm, lineView, dims);
  }

  // Build a line's DOM representation from scratch
  function buildLineElement(cm, lineView, lineN, dims) {
    var built = getLineContent(cm, lineView);
    lineView.text = lineView.node = built.pre;
    if (built.bgClass) { lineView.bgClass = built.bgClass; }
    if (built.textClass) { lineView.textClass = built.textClass; }

    updateLineClasses(cm, lineView);
    updateLineGutter(cm, lineView, lineN, dims);
    insertLineWidgets(cm, lineView, dims);
    return lineView.node
  }

  // A lineView may contain multiple logical lines (when merged by
  // collapsed spans). The widgets for all of them need to be drawn.
  function insertLineWidgets(cm, lineView, dims) {
    insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);
    if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)
      { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }
  }

  function insertLineWidgetsFor(cm, line, lineView, dims, allowAbove) {
    if (!line.widgets) { return }
    var wrap = ensureLineWrapped(lineView);
    for (var i = 0, ws = line.widgets; i < ws.length; ++i) {
      var widget = ws[i], node = elt("div", [widget.node], "CodeMirror-linewidget" + (widget.className ? " " + widget.className : ""));
      if (!widget.handleMouseEvents) { node.setAttribute("cm-ignore-events", "true"); }
      positionLineWidget(widget, node, lineView, dims);
      cm.display.input.setUneditable(node);
      if (allowAbove && widget.above)
        { wrap.insertBefore(node, lineView.gutter || lineView.text); }
      else
        { wrap.appendChild(node); }
      signalLater(widget, "redraw");
    }
  }

  function positionLineWidget(widget, node, lineView, dims) {
    if (widget.noHScroll) {
  (lineView.alignable || (lineView.alignable = [])).push(node);
      var width = dims.wrapperWidth;
      node.style.left = dims.fixedPos + "px";
      if (!widget.coverGutter) {
        width -= dims.gutterTotalWidth;
        node.style.paddingLeft = dims.gutterTotalWidth + "px";
      }
      node.style.width = width + "px";
    }
    if (widget.coverGutter) {
      node.style.zIndex = 5;
      node.style.position = "relative";
      if (!widget.noHScroll) { node.style.marginLeft = -dims.gutterTotalWidth + "px"; }
    }
  }

  function widgetHeight(widget) {
    if (widget.height != null) { return widget.height }
    var cm = widget.doc.cm;
    if (!cm) { return 0 }
    if (!contains(document.body, widget.node)) {
      var parentStyle = "position: relative;";
      if (widget.coverGutter)
        { parentStyle += "margin-left: -" + cm.display.gutters.offsetWidth + "px;"; }
      if (widget.noHScroll)
        { parentStyle += "width: " + cm.display.wrapper.clientWidth + "px;"; }
      removeChildrenAndAdd(cm.display.measure, elt("div", [widget.node], null, parentStyle));
    }
    return widget.height = widget.node.parentNode.offsetHeight
  }

  // Return true when the given mouse event happened in a widget
  function eventInWidget(display, e) {
    for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {
      if (!n || (n.nodeType == 1 && n.getAttribute("cm-ignore-events") == "true") ||
          (n.parentNode == display.sizer && n != display.mover))
        { return true }
    }
  }

  // POSITION MEASUREMENT

  function paddingTop(display) {return display.lineSpace.offsetTop}
  function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight}
  function paddingH(display) {
    if (display.cachedPaddingH) { return display.cachedPaddingH }
    var e = removeChildrenAndAdd(display.measure, elt("pre", "x", "CodeMirror-line-like"));
    var style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle;
    var data = {left: parseInt(style.paddingLeft), right: parseInt(style.paddingRight)};
    if (!isNaN(data.left) && !isNaN(data.right)) { display.cachedPaddingH = data; }
    return data
  }

  function scrollGap(cm) { return scrollerGap - cm.display.nativeBarWidth }
  function displayWidth(cm) {
    return cm.display.scroller.clientWidth - scrollGap(cm) - cm.display.barWidth
  }
  function displayHeight(cm) {
    return cm.display.scroller.clientHeight - scrollGap(cm) - cm.display.barHeight
  }

  // Ensure the lineView.wrapping.heights array is populated. This is
  // an array of bottom offsets for the lines that make up a drawn
  // line. When lineWrapping is on, there might be more than one
  // height.
  function ensureLineHeights(cm, lineView, rect) {
    var wrapping = cm.options.lineWrapping;
    var curWidth = wrapping && displayWidth(cm);
    if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {
      var heights = lineView.measure.heights = [];
      if (wrapping) {
        lineView.measure.width = curWidth;
        var rects = lineView.text.firstChild.getClientRects();
        for (var i = 0; i < rects.length - 1; i++) {
          var cur = rects[i], next = rects[i + 1];
          if (Math.abs(cur.bottom - next.bottom) > 2)
            { heights.push((cur.bottom + next.top) / 2 - rect.top); }
        }
      }
      heights.push(rect.bottom - rect.top);
    }
  }

  // Find a line map (mapping character offsets to text nodes) and a
  // measurement cache for the given line number. (A line view might
  // contain multiple lines when collapsed ranges are present.)
  function mapFromLineView(lineView, line, lineN) {
    if (lineView.line == line)
      { return {map: lineView.measure.map, cache: lineView.measure.cache} }
    for (var i = 0; i < lineView.rest.length; i++)
      { if (lineView.rest[i] == line)
        { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }
    for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)
      { if (lineNo(lineView.rest[i$1]) > lineN)
        { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }
  }

  // Render a line into the hidden node display.externalMeasured. Used
  // when measurement is needed for a line that's not in the viewport.
  function updateExternalMeasurement(cm, line) {
    line = visualLine(line);
    var lineN = lineNo(line);
    var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);
    view.lineN = lineN;
    var built = view.built = buildLineContent(cm, view);
    view.text = built.pre;
    removeChildrenAndAdd(cm.display.lineMeasure, built.pre);
    return view
  }

  // Get a {top, bottom, left, right} box (in line-local coordinates)
  // for a given character.
  function measureChar(cm, line, ch, bias) {
    return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias)
  }

  // Find a line view that corresponds to the given line number.
  function findViewForLine(cm, lineN) {
    if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)
      { return cm.display.view[findViewIndex(cm, lineN)] }
    var ext = cm.display.externalMeasured;
    if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)
      { return ext }
  }

  // Measurement can be split in two steps, the set-up work that
  // applies to the whole line, and the measurement of the actual
  // character. Functions like coordsChar, that need to do a lot of
  // measurements in a row, can thus ensure that the set-up work is
  // only done once.
  function prepareMeasureForLine(cm, line) {
    var lineN = lineNo(line);
    var view = findViewForLine(cm, lineN);
    if (view && !view.text) {
      view = null;
    } else if (view && view.changes) {
      updateLineForChanges(cm, view, lineN, getDimensions(cm));
      cm.curOp.forceUpdate = true;
    }
    if (!view)
      { view = updateExternalMeasurement(cm, line); }

    var info = mapFromLineView(view, line, lineN);
    return {
      line: line, view: view, rect: null,
      map: info.map, cache: info.cache, before: info.before,
      hasHeights: false
    }
  }

  // Given a prepared measurement object, measures the position of an
  // actual character (or fetches it from the cache).
  function measureCharPrepared(cm, prepared, ch, bias, varHeight) {
    if (prepared.before) { ch = -1; }
    var key = ch + (bias || ""), found;
    if (prepared.cache.hasOwnProperty(key)) {
      found = prepared.cache[key];
    } else {
      if (!prepared.rect)
        { prepared.rect = prepared.view.text.getBoundingClientRect(); }
      if (!prepared.hasHeights) {
        ensureLineHeights(cm, prepared.view, prepared.rect);
        prepared.hasHeights = true;
      }
      found = measureCharInner(cm, prepared, ch, bias);
      if (!found.bogus) { prepared.cache[key] = found; }
    }
    return {left: found.left, right: found.right,
            top: varHeight ? found.rtop : found.top,
            bottom: varHeight ? found.rbottom : found.bottom}
  }

  var nullRect = {left: 0, right: 0, top: 0, bottom: 0};

  function nodeAndOffsetInLineMap(map, ch, bias) {
    var node, start, end, collapse, mStart, mEnd;
    // First, search the line map for the text node corresponding to,
    // or closest to, the target character.
    for (var i = 0; i < map.length; i += 3) {
      mStart = map[i];
      mEnd = map[i + 1];
      if (ch < mStart) {
        start = 0; end = 1;
        collapse = "left";
      } else if (ch < mEnd) {
        start = ch - mStart;
        end = start + 1;
      } else if (i == map.length - 3 || ch == mEnd && map[i + 3] > ch) {
        end = mEnd - mStart;
        start = end - 1;
        if (ch >= mEnd) { collapse = "right"; }
      }
      if (start != null) {
        node = map[i + 2];
        if (mStart == mEnd && bias == (node.insertLeft ? "left" : "right"))
          { collapse = bias; }
        if (bias == "left" && start == 0)
          { while (i && map[i - 2] == map[i - 3] && map[i - 1].insertLeft) {
            node = map[(i -= 3) + 2];
            collapse = "left";
          } }
        if (bias == "right" && start == mEnd - mStart)
          { while (i < map.length - 3 && map[i + 3] == map[i + 4] && !map[i + 5].insertLeft) {
            node = map[(i += 3) + 2];
            collapse = "right";
          } }
        break
      }
    }
    return {node: node, start: start, end: end, collapse: collapse, coverStart: mStart, coverEnd: mEnd}
  }

  function getUsefulRect(rects, bias) {
    var rect = nullRect;
    if (bias == "left") { for (var i = 0; i < rects.length; i++) {
      if ((rect = rects[i]).left != rect.right) { break }
    } } else { for (var i$1 = rects.length - 1; i$1 >= 0; i$1--) {
      if ((rect = rects[i$1]).left != rect.right) { break }
    } }
    return rect
  }

  function measureCharInner(cm, prepared, ch, bias) {
    var place = nodeAndOffsetInLineMap(prepared.map, ch, bias);
    var node = place.node, start = place.start, end = place.end, collapse = place.collapse;

    var rect;
    if (node.nodeType == 3) { // If it is a text node, use a range to retrieve the coordinates.
      for (var i$1 = 0; i$1 < 4; i$1++) { // Retry a maximum of 4 times when nonsense rectangles are returned
        while (start && isExtendingChar(prepared.line.text.charAt(place.coverStart + start))) { --start; }
        while (place.coverStart + end < place.coverEnd && isExtendingChar(prepared.line.text.charAt(place.coverStart + end))) { ++end; }
        if (ie && ie_version < 9 && start == 0 && end == place.coverEnd - place.coverStart)
          { rect = node.parentNode.getBoundingClientRect(); }
        else
          { rect = getUsefulRect(range(node, start, end).getClientRects(), bias); }
        if (rect.left || rect.right || start == 0) { break }
        end = start;
        start = start - 1;
        collapse = "right";
      }
      if (ie && ie_version < 11) { rect = maybeUpdateRectForZooming(cm.display.measure, rect); }
    } else { // If it is a widget, simply get the box for the whole widget.
      if (start > 0) { collapse = bias = "right"; }
      var rects;
      if (cm.options.lineWrapping && (rects = node.getClientRects()).length > 1)
        { rect = rects[bias == "right" ? rects.length - 1 : 0]; }
      else
        { rect = node.getBoundingClientRect(); }
    }
    if (ie && ie_version < 9 && !start && (!rect || !rect.left && !rect.right)) {
      var rSpan = node.parentNode.getClientRects()[0];
      if (rSpan)
        { rect = {left: rSpan.left, right: rSpan.left + charWidth(cm.display), top: rSpan.top, bottom: rSpan.bottom}; }
      else
        { rect = nullRect; }
    }

    var rtop = rect.top - prepared.rect.top, rbot = rect.bottom - prepared.rect.top;
    var mid = (rtop + rbot) / 2;
    var heights = prepared.view.measure.heights;
    var i = 0;
    for (; i < heights.length - 1; i++)
      { if (mid < heights[i]) { break } }
    var top = i ? heights[i - 1] : 0, bot = heights[i];
    var result = {left: (collapse == "right" ? rect.right : rect.left) - prepared.rect.left,
                  right: (collapse == "left" ? rect.left : rect.right) - prepared.rect.left,
                  top: top, bottom: bot};
    if (!rect.left && !rect.right) { result.bogus = true; }
    if (!cm.options.singleCursorHeightPerLine) { result.rtop = rtop; result.rbottom = rbot; }

    return result
  }

  // Work around problem with bounding client rects on ranges being
  // returned incorrectly when zoomed on IE10 and below.
  function maybeUpdateRectForZooming(measure, rect) {
    if (!window.screen || screen.logicalXDPI == null ||
        screen.logicalXDPI == screen.deviceXDPI || !hasBadZoomedRects(measure))
      { return rect }
    var scaleX = screen.logicalXDPI / screen.deviceXDPI;
    var scaleY = screen.logicalYDPI / screen.deviceYDPI;
    return {left: rect.left * scaleX, right: rect.right * scaleX,
            top: rect.top * scaleY, bottom: rect.bottom * scaleY}
  }

  function clearLineMeasurementCacheFor(lineView) {
    if (lineView.measure) {
      lineView.measure.cache = {};
      lineView.measure.heights = null;
      if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)
        { lineView.measure.caches[i] = {}; } }
    }
  }

  function clearLineMeasurementCache(cm) {
    cm.display.externalMeasure = null;
    removeChildren(cm.display.lineMeasure);
    for (var i = 0; i < cm.display.view.length; i++)
      { clearLineMeasurementCacheFor(cm.display.view[i]); }
  }

  function clearCaches(cm) {
    clearLineMeasurementCache(cm);
    cm.display.cachedCharWidth = cm.display.cachedTextHeight = cm.display.cachedPaddingH = null;
    if (!cm.options.lineWrapping) { cm.display.maxLineChanged = true; }
    cm.display.lineNumChars = null;
  }

  function pageScrollX() {
    // Work around https://bugs.chromium.org/p/chromium/issues/detail?id=489206
    // which causes page_Offset and bounding client rects to use
    // different reference viewports and invalidate our calculations.
    if (chrome && android) { return -(document.body.getBoundingClientRect().left - parseInt(getComputedStyle(document.body).marginLeft)) }
    return window.pageXOffset || (document.documentElement || document.body).scrollLeft
  }
  function pageScrollY() {
    if (chrome && android) { return -(document.body.getBoundingClientRect().top - parseInt(getComputedStyle(document.body).marginTop)) }
    return window.pageYOffset || (document.documentElement || document.body).scrollTop
  }

  function widgetTopHeight(lineObj) {
    var height = 0;
    if (lineObj.widgets) { for (var i = 0; i < lineObj.widgets.length; ++i) { if (lineObj.widgets[i].above)
      { height += widgetHeight(lineObj.widgets[i]); } } }
    return height
  }

  // Converts a {top, bottom, left, right} box from line-local
  // coordinates into another coordinate system. Context may be one of
  // "line", "div" (display.lineDiv), "local"./null (editor), "window",
  // or "page".
  function intoCoordSystem(cm, lineObj, rect, context, includeWidgets) {
    if (!includeWidgets) {
      var height = widgetTopHeight(lineObj);
      rect.top += height; rect.bottom += height;
    }
    if (context == "line") { return rect }
    if (!context) { context = "local"; }
    var yOff = heightAtLine(lineObj);
    if (context == "local") { yOff += paddingTop(cm.display); }
    else { yOff -= cm.display.viewOffset; }
    if (context == "page" || context == "window") {
      var lOff = cm.display.lineSpace.getBoundingClientRect();
      yOff += lOff.top + (context == "window" ? 0 : pageScrollY());
      var xOff = lOff.left + (context == "window" ? 0 : pageScrollX());
      rect.left += xOff; rect.right += xOff;
    }
    rect.top += yOff; rect.bottom += yOff;
    return rect
  }

  // Coverts a box from "div" coords to another coordinate system.
  // Context may be "window", "page", "div", or "local"./null.
  function fromCoordSystem(cm, coords, context) {
    if (context == "div") { return coords }
    var left = coords.left, top = coords.top;
    // First move into "page" coordinate system
    if (context == "page") {
      left -= pageScrollX();
      top -= pageScrollY();
    } else if (context == "local" || !context) {
      var localBox = cm.display.sizer.getBoundingClientRect();
      left += localBox.left;
      top += localBox.top;
    }

    var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();
    return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}
  }

  function charCoords(cm, pos, context, lineObj, bias) {
    if (!lineObj) { lineObj = getLine(cm.doc, pos.line); }
    return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), context)
  }

  // Returns a box for a given cursor position, which may have an
  // 'other' property containing the position of the secondary cursor
  // on a bidi boundary.
  // A cursor Pos(line, char, "before") is on the same visual line as ~~~char - 1~~~
  // and after ~~~char - 1~~~ in writing order of ~~~char - 1~~~
  // A cursor Pos(line, char, "after") is on the same visual line as ~~~char~~~
  // and before ~~~char~~~ in writing order of ~~~char~~~
  // Examples (upper-case letters are RTL, lower-case are LTR):
  //     Pos(0, 1, ...)
  //     before   after
  // ab     a|b     a|b
  // aB     a|B     aB|
  // Ab     |Ab     A|b
  // AB     B|A     B|A
  // Every position after the last character on a line is considered to stick
  // to the last character on the line.
  function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {
    lineObj = lineObj || getLine(cm.doc, pos.line);
    if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }
    function get(ch, right) {
      var m = measureCharPrepared(cm, preparedMeasure, ch, right ? "right" : "left", varHeight);
      if (right) { m.left = m.right; } else { m.right = m.left; }
      return intoCoordSystem(cm, lineObj, m, context)
    }
    var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;
    if (ch >= lineObj.text.length) {
      ch = lineObj.text.length;
      sticky = "before";
    } else if (ch <= 0) {
      ch = 0;
      sticky = "after";
    }
    if (!order) { return get(sticky == "before" ? ch - 1 : ch, sticky == "before") }

    function getBidi(ch, partPos, invert) {
      var part = order[partPos], right = part.level == 1;
      return get(invert ? ch - 1 : ch, right != invert)
    }
    var partPos = getBidiPartAt(order, ch, sticky);
    var other = bidiOther;
    var val = getBidi(ch, partPos, sticky == "before");
    if (other != null) { val.other = getBidi(ch, other, sticky != "before"); }
    return val
  }

  // Used to cheaply estimate the coordinates for a position. Used for
  // intermediate scroll updates.
  function estimateCoords(cm, pos) {
    var left = 0;
    pos = clipPos(cm.doc, pos);
    if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch; }
    var lineObj = getLine(cm.doc, pos.line);
    var top = heightAtLine(lineObj) + paddingTop(cm.display);
    return {left: left, right: left, top: top, bottom: top + lineObj.height}
  }

  // Positions returned by coordsChar contain some extra information.
  // xRel is the relative x position of the input coordinates compared
  // to the found position (so xRel > 0 means the coordinates are to
  // the right of the character position, for example). When outside
  // is true, that means the coordinates lie outside the line's
  // vertical range.
  function PosWithInfo(line, ch, sticky, outside, xRel) {
    var pos = Pos(line, ch, sticky);
    pos.xRel = xRel;
    if (outside) { pos.outside = outside; }
    return pos
  }

  // Compute the character position closest to the given coordinates.
  // Input must be lineSpace-local ("div" coordinate system).
  function coordsChar(cm, x, y) {
    var doc = cm.doc;
    y += cm.display.viewOffset;
    if (y < 0) { return PosWithInfo(doc.first, 0, null, -1, -1) }
    var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;
    if (lineN > last)
      { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1) }
    if (x < 0) { x = 0; }

    var lineObj = getLine(doc, lineN);
    for (;;) {
      var found = coordsCharInner(cm, lineObj, lineN, x, y);
      var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0));
      if (!collapsed) { return found }
      var rangeEnd = collapsed.find(1);
      if (rangeEnd.line == lineN) { return rangeEnd }
      lineObj = getLine(doc, lineN = rangeEnd.line);
    }
  }

  function wrappedLineExtent(cm, lineObj, preparedMeasure, y) {
    y -= widgetTopHeight(lineObj);
    var end = lineObj.text.length;
    var begin = findFirst(function (ch) { return measureCharPrepared(cm, preparedMeasure, ch - 1).bottom <= y; }, end, 0);
    end = findFirst(function (ch) { return measureCharPrepared(cm, preparedMeasure, ch).top > y; }, begin, end);
    return {begin: begin, end: end}
  }

  function wrappedLineExtentChar(cm, lineObj, preparedMeasure, target) {
    if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }
    var targetTop = intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, target), "line").top;
    return wrappedLineExtent(cm, lineObj, preparedMeasure, targetTop)
  }

  // Returns true if the given side of a box is after the given
  // coordinates, in top-to-bottom, left-to-right order.
  function boxIsAfter(box, x, y, left) {
    return box.bottom <= y ? false : box.top > y ? true : (left ? box.left : box.right) > x
  }

  function coordsCharInner(cm, lineObj, lineNo, x, y) {
    // Move y into line-local coordinate space
    y -= heightAtLine(lineObj);
    var preparedMeasure = prepareMeasureForLine(cm, lineObj);
    // When directly calling ~~~measureCharPrepared~~~, we have to adjust
    // for the widgets at this line.
    var widgetHeight = widgetTopHeight(lineObj);
    var begin = 0, end = lineObj.text.length, ltr = true;

    var order = getOrder(lineObj, cm.doc.direction);
    // If the line isn't plain left-to-right text, first figure out
    // which bidi section the coordinates fall into.
    if (order) {
      var part = (cm.options.lineWrapping ? coordsBidiPartWrapped : coordsBidiPart)
                   (cm, lineObj, lineNo, preparedMeasure, order, x, y);
      ltr = part.level != 1;
      // The awkward -1 offsets are needed because findFirst (called
      // on these below) will treat its first bound as inclusive,
      // second as exclusive, but we want to actually address the
      // characters in the part's range
      begin = ltr ? part.from : part.to - 1;
      end = ltr ? part.to : part.from - 1;
    }

    // A binary search to find the first character whose bounding box
    // starts after the coordinates. If we run across any whose box wrap
    // the coordinates, store that.
    var chAround = null, boxAround = null;
    var ch = findFirst(function (ch) {
      var box = measureCharPrepared(cm, preparedMeasure, ch);
      box.top += widgetHeight; box.bottom += widgetHeight;
      if (!boxIsAfter(box, x, y, false)) { return false }
      if (box.top <= y && box.left <= x) {
        chAround = ch;
        boxAround = box;
      }
      return true
    }, begin, end);

    var baseX, sticky, outside = false;
    // If a box around the coordinates was found, use that
    if (boxAround) {
      // Distinguish coordinates nearer to the left or right side of the box
      var atLeft = x - boxAround.left < boxAround.right - x, atStart = atLeft == ltr;
      ch = chAround + (atStart ? 0 : 1);
      sticky = atStart ? "after" : "before";
      baseX = atLeft ? boxAround.left : boxAround.right;
    } else {
      // (Adjust for extended bound, if necessary.)
      if (!ltr && (ch == end || ch == begin)) { ch++; }
      // To determine which side to associate with, get the box to the
      // left of the character and compare it's vertical position to the
      // coordinates
      sticky = ch == 0 ? "after" : ch == lineObj.text.length ? "before" :
        (measureCharPrepared(cm, preparedMeasure, ch - (ltr ? 1 : 0)).bottom + widgetHeight <= y) == ltr ?
        "after" : "before";
      // Now get accurate coordinates for this place, in order to get a
      // base X position
      var coords = cursorCoords(cm, Pos(lineNo, ch, sticky), "line", lineObj, preparedMeasure);
      baseX = coords.left;
      outside = y < coords.top ? -1 : y >= coords.bottom ? 1 : 0;
    }

    ch = skipExtendingChars(lineObj.text, ch, 1);
    return PosWithInfo(lineNo, ch, sticky, outside, x - baseX)
  }

  function coordsBidiPart(cm, lineObj, lineNo, preparedMeasure, order, x, y) {
    // Bidi parts are sorted left-to-right, and in a non-line-wrapping
    // situation, we can take this ordering to correspond to the visual
    // ordering. This finds the first part whose end is after the given
    // coordinates.
    var index = findFirst(function (i) {
      var part = order[i], ltr = part.level != 1;
      return boxIsAfter(cursorCoords(cm, Pos(lineNo, ltr ? part.to : part.from, ltr ? "before" : "after"),
                                     "line", lineObj, preparedMeasure), x, y, true)
    }, 0, order.length - 1);
    var part = order[index];
    // If this isn't the first part, the part's start is also after
    // the coordinates, and the coordinates aren't on the same line as
    // that start, move one part back.
    if (index > 0) {
      var ltr = part.level != 1;
      var start = cursorCoords(cm, Pos(lineNo, ltr ? part.from : part.to, ltr ? "after" : "before"),
                               "line", lineObj, preparedMeasure);
      if (boxIsAfter(start, x, y, true) && start.top > y)
        { part = order[index - 1]; }
    }
    return part
  }

  function coordsBidiPartWrapped(cm, lineObj, _lineNo, preparedMeasure, order, x, y) {
    // In a wrapped line, rtl text on wrapping boundaries can do things
    // that don't correspond to the ordering in our ~~~order~~~ array at
    // all, so a binary search doesn't work, and we want to return a
    // part that only spans one line so that the binary search in
    // coordsCharInner is safe. As such, we first find the extent of the
    // wrapped line, and then do a flat search in which we discard any
    // spans that aren't on the line.
    var ref = wrappedLineExtent(cm, lineObj, preparedMeasure, y);
    var begin = ref.begin;
    var end = ref.end;
    if (/\s/.test(lineObj.text.charAt(end - 1))) { end--; }
    var part = null, closestDist = null;
    for (var i = 0; i < order.length; i++) {
      var p = order[i];
      if (p.from >= end || p.to <= begin) { continue }
      var ltr = p.level != 1;
      var endX = measureCharPrepared(cm, preparedMeasure, ltr ? Math.min(end, p.to) - 1 : Math.max(begin, p.from)).right;
      // Weigh against spans ending before this, so that they are only
      // picked if nothing ends after
      var dist = endX < x ? x - endX + 1e9 : endX - x;
      if (!part || closestDist > dist) {
        part = p;
        closestDist = dist;
      }
    }
    if (!part) { part = order[order.length - 1]; }
    // Clip the part to the wrapped line.
    if (part.from < begin) { part = {from: begin, to: part.to, level: part.level}; }
    if (part.to > end) { part = {from: part.from, to: end, level: part.level}; }
    return part
  }

  var measureText;
  // Compute the default text height.
  function textHeight(display) {
    if (display.cachedTextHeight != null) { return display.cachedTextHeight }
    if (measureText == null) {
      measureText = elt("pre", null, "CodeMirror-line-like");
      // Measure a bunch of lines, for browsers that compute
      // fractional heights.
      for (var i = 0; i < 49; ++i) {
        measureText.appendChild(document.createTextNode("x"));
        measureText.appendChild(elt("br"));
      }
      measureText.appendChild(document.createTextNode("x"));
    }
    removeChildrenAndAdd(display.measure, measureText);
    var height = measureText.offsetHeight / 50;
    if (height > 3) { display.cachedTextHeight = height; }
    removeChildren(display.measure);
    return height || 1
  }

  // Compute the default character width.
  function charWidth(display) {
    if (display.cachedCharWidth != null) { return display.cachedCharWidth }
    var anchor = elt("span", "xxxxxxxxxx");
    var pre = elt("pre", [anchor], "CodeMirror-line-like");
    removeChildrenAndAdd(display.measure, pre);
    var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;
    if (width > 2) { display.cachedCharWidth = width; }
    return width || 10
  }

  // Do a bulk-read of the DOM positions and sizes needed to draw the
  // view, so that we don't interleave reading and writing to the DOM.
  function getDimensions(cm) {
    var d = cm.display, left = {}, width = {};
    var gutterLeft = d.gutters.clientLeft;
    for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {
      var id = cm.display.gutterSpecs[i].className;
      left[id] = n.offsetLeft + n.clientLeft + gutterLeft;
      width[id] = n.clientWidth;
    }
    return {fixedPos: compensateForHScroll(d),
            gutterTotalWidth: d.gutters.offsetWidth,
            gutterLeft: left,
            gutterWidth: width,
            wrapperWidth: d.wrapper.clientWidth}
  }

  // Computes display.scroller.scrollLeft + display.gutters.offsetWidth,
  // but using getBoundingClientRect to get a sub-pixel-accurate
  // result.
  function compensateForHScroll(display) {
    return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left
  }

  // Returns a function that estimates the height of a line, to use as
  // first approximation until the line becomes visible (and is thus
  // properly measurable).
  function estimateHeight(cm) {
    var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;
    var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);
    return function (line) {
      if (lineIsHidden(cm.doc, line)) { return 0 }

      var widgetsHeight = 0;
      if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {
        if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }
      } }

      if (wrapping)
        { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }
      else
        { return widgetsHeight + th }
    }
  }

  function estimateLineHeights(cm) {
    var doc = cm.doc, est = estimateHeight(cm);
    doc.iter(function (line) {
      var estHeight = est(line);
      if (estHeight != line.height) { updateLineHeight(line, estHeight); }
    });
  }

  // Given a mouse event, find the corresponding position. If liberal
  // is false, it checks whether a gutter or scrollbar was clicked,
  // and returns null if it was. forRect is used by rectangular
  // selections, and tries to estimate a character position even for
  // coordinates beyond the right of the text.
  function posFromMouse(cm, e, liberal, forRect) {
    var display = cm.display;
    if (!liberal && e_target(e).getAttribute("cm-not-content") == "true") { return null }

    var x, y, space = display.lineSpace.getBoundingClientRect();
    // Fails unpredictably on IE[67] when mouse is dragged around quickly.
    try { x = e.clientX - space.left; y = e.clientY - space.top; }
    catch (e$1) { return null }
    var coords = coordsChar(cm, x, y), line;
    if (forRect && coords.xRel > 0 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {
      var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;
      coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));
    }
    return coords
  }

  // Find the view element corresponding to a given line. Return null
  // when the line isn't visible.
  function findViewIndex(cm, n) {
    if (n >= cm.display.viewTo) { return null }
    n -= cm.display.viewFrom;
    if (n < 0) { return null }
    var view = cm.display.view;
    for (var i = 0; i < view.length; i++) {
      n -= view[i].size;
      if (n < 0) { return i }
    }
  }

  // Updates the display.view data structure for a given change to the
  // document. From and to are in pre-change coordinates. Lendiff is
  // the amount of lines added or subtracted by the change. This is
  // used for changes that span multiple lines, or change the way
  // lines are divided into visual lines. regLineChange (below)
  // registers single-line changes.
  function regChange(cm, from, to, lendiff) {
    if (from == null) { from = cm.doc.first; }
    if (to == null) { to = cm.doc.first + cm.doc.size; }
    if (!lendiff) { lendiff = 0; }

    var display = cm.display;
    if (lendiff && to < display.viewTo &&
        (display.updateLineNumbers == null || display.updateLineNumbers > from))
      { display.updateLineNumbers = from; }

    cm.curOp.viewChanged = true;

    if (from >= display.viewTo) { // Change after
      if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)
        { resetView(cm); }
    } else if (to <= display.viewFrom) { // Change before
      if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {
        resetView(cm);
      } else {
        display.viewFrom += lendiff;
        display.viewTo += lendiff;
      }
    } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap
      resetView(cm);
    } else if (from <= display.viewFrom) { // Top overlap
      var cut = viewCuttingPoint(cm, to, to + lendiff, 1);
      if (cut) {
        display.view = display.view.slice(cut.index);
        display.viewFrom = cut.lineN;
        display.viewTo += lendiff;
      } else {
        resetView(cm);
      }
    } else if (to >= display.viewTo) { // Bottom overlap
      var cut$1 = viewCuttingPoint(cm, from, from, -1);
      if (cut$1) {
        display.view = display.view.slice(0, cut$1.index);
        display.viewTo = cut$1.lineN;
      } else {
        resetView(cm);
      }
    } else { // Gap in the middle
      var cutTop = viewCuttingPoint(cm, from, from, -1);
      var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);
      if (cutTop && cutBot) {
        display.view = display.view.slice(0, cutTop.index)
          .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))
          .concat(display.view.slice(cutBot.index));
        display.viewTo += lendiff;
      } else {
        resetView(cm);
      }
    }

    var ext = display.externalMeasured;
    if (ext) {
      if (to < ext.lineN)
        { ext.lineN += lendiff; }
      else if (from < ext.lineN + ext.size)
        { display.externalMeasured = null; }
    }
  }

  // Register a change to a single line. Type must be one of "text",
  // "gutter", "class", "widget"
  function regLineChange(cm, line, type) {
    cm.curOp.viewChanged = true;
    var display = cm.display, ext = cm.display.externalMeasured;
    if (ext && line >= ext.lineN && line < ext.lineN + ext.size)
      { display.externalMeasured = null; }

    if (line < display.viewFrom || line >= display.viewTo) { return }
    var lineView = display.view[findViewIndex(cm, line)];
    if (lineView.node == null) { return }
    var arr = lineView.changes || (lineView.changes = []);
    if (indexOf(arr, type) == -1) { arr.push(type); }
  }

  // Clear the view.
  function resetView(cm) {
    cm.display.viewFrom = cm.display.viewTo = cm.doc.first;
    cm.display.view = [];
    cm.display.viewOffset = 0;
  }

  function viewCuttingPoint(cm, oldN, newN, dir) {
    var index = findViewIndex(cm, oldN), diff, view = cm.display.view;
    if (!sawCollapsedSpans || newN == cm.doc.first + cm.doc.size)
      { return {index: index, lineN: newN} }
    var n = cm.display.viewFrom;
    for (var i = 0; i < index; i++)
      { n += view[i].size; }
    if (n != oldN) {
      if (dir > 0) {
        if (index == view.length - 1) { return null }
        diff = (n + view[index].size) - oldN;
        index++;
      } else {
        diff = n - oldN;
      }
      oldN += diff; newN += diff;
    }
    while (visualLineNo(cm.doc, newN) != newN) {
      if (index == (dir < 0 ? 0 : view.length - 1)) { return null }
      newN += dir * view[index - (dir < 0 ? 1 : 0)].size;
      index += dir;
    }
    return {index: index, lineN: newN}
  }

  // Force the view to cover a given range, adding empty view element
  // or clipping off existing ones as needed.
  function adjustView(cm, from, to) {
    var display = cm.display, view = display.view;
    if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {
      display.view = buildViewArray(cm, from, to);
      display.viewFrom = from;
    } else {
      if (display.viewFrom > from)
        { display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view); }
      else if (display.viewFrom < from)
        { display.view = display.view.slice(findViewIndex(cm, from)); }
      display.viewFrom = from;
      if (display.viewTo < to)
        { display.view = display.view.concat(buildViewArray(cm, display.viewTo, to)); }
      else if (display.viewTo > to)
        { display.view = display.view.slice(0, findViewIndex(cm, to)); }
    }
    display.viewTo = to;
  }

  // Count the number of lines in the view whose DOM representation is
  // out of date (or nonexistent).
  function countDirtyView(cm) {
    var view = cm.display.view, dirty = 0;
    for (var i = 0; i < view.length; i++) {
      var lineView = view[i];
      if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty; }
    }
    return dirty
  }

  function updateSelection(cm) {
    cm.display.input.showSelection(cm.display.input.prepareSelection());
  }

  function prepareSelection(cm, primary) {
    if ( primary === void 0 ) primary = true;

    var doc = cm.doc, result = {};
    var curFragment = result.cursors = document.createDocumentFragment();
    var selFragment = result.selection = document.createDocumentFragment();

    for (var i = 0; i < doc.sel.ranges.length; i++) {
      if (!primary && i == doc.sel.primIndex) { continue }
      var range = doc.sel.ranges[i];
      if (range.from().line >= cm.display.viewTo || range.to().line < cm.display.viewFrom) { continue }
      var collapsed = range.empty();
      if (collapsed || cm.options.showCursorWhenSelecting)
        { drawSelectionCursor(cm, range.head, curFragment); }
      if (!collapsed)
        { drawSelectionRange(cm, range, selFragment); }
    }
    return result
  }

  // Draws a cursor for the given range
  function drawSelectionCursor(cm, head, output) {
    var pos = cursorCoords(cm, head, "div", null, null, !cm.options.singleCursorHeightPerLine);

    var cursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor"));
    cursor.style.left = pos.left + "px";
    cursor.style.top = pos.top + "px";
    cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px";

    if (pos.other) {
      // Secondary cursor, shown when on a 'jump' in bi-directional text
      var otherCursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor"));
      otherCursor.style.display = "";
      otherCursor.style.left = pos.other.left + "px";
      otherCursor.style.top = pos.other.top + "px";
      otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + "px";
    }
  }

  function cmpCoords(a, b) { return a.top - b.top || a.left - b.left }

  // Draws the given range as a highlighted selection
  function drawSelectionRange(cm, range, output) {
    var display = cm.display, doc = cm.doc;
    var fragment = document.createDocumentFragment();
    var padding = paddingH(cm.display), leftSide = padding.left;
    var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;
    var docLTR = doc.direction == "ltr";

    function add(left, top, width, bottom) {
      if (top < 0) { top = 0; }
      top = Math.round(top);
      bottom = Math.round(bottom);
      fragment.appendChild(elt("div", null, "CodeMirror-selected", ("position: absolute; left: " + left + "px;\n                             top: " + top + "px; width: " + (width == null ? rightSide - left : width) + "px;\n                             height: " + (bottom - top) + "px")));
    }

    function drawForLine(line, fromArg, toArg) {
      var lineObj = getLine(doc, line);
      var lineLen = lineObj.text.length;
      var start, end;
      function coords(ch, bias) {
        return charCoords(cm, Pos(line, ch), "div", lineObj, bias)
      }

      function wrapX(pos, dir, side) {
        var extent = wrappedLineExtentChar(cm, lineObj, null, pos);
        var prop = (dir == "ltr") == (side == "after") ? "left" : "right";
        var ch = side == "after" ? extent.begin : extent.end - (/\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);
        return coords(ch, prop)[prop]
      }

      var order = getOrder(lineObj, doc.direction);
      iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {
        var ltr = dir == "ltr";
        var fromPos = coords(from, ltr ? "left" : "right");
        var toPos = coords(to - 1, ltr ? "right" : "left");

        var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;
        var first = i == 0, last = !order || i == order.length - 1;
        if (toPos.top - fromPos.top <= 3) { // Single line
          var openLeft = (docLTR ? openStart : openEnd) && first;
          var openRight = (docLTR ? openEnd : openStart) && last;
          var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;
          var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;
          add(left, fromPos.top, right - left, fromPos.bottom);
        } else { // Multiple lines
          var topLeft, topRight, botLeft, botRight;
          if (ltr) {
            topLeft = docLTR && openStart && first ? leftSide : fromPos.left;
            topRight = docLTR ? rightSide : wrapX(from, dir, "before");
            botLeft = docLTR ? leftSide : wrapX(to, dir, "after");
            botRight = docLTR && openEnd && last ? rightSide : toPos.right;
          } else {
            topLeft = !docLTR ? leftSide : wrapX(from, dir, "before");
            topRight = !docLTR && openStart && first ? rightSide : fromPos.right;
            botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;
            botRight = !docLTR ? rightSide : wrapX(to, dir, "after");
          }
          add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);
          if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }
          add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);
        }

        if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }
        if (cmpCoords(toPos, start) < 0) { start = toPos; }
        if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }
        if (cmpCoords(toPos, end) < 0) { end = toPos; }
      });
      return {start: start, end: end}
    }

    var sFrom = range.from(), sTo = range.to();
    if (sFrom.line == sTo.line) {
      drawForLine(sFrom.line, sFrom.ch, sTo.ch);
    } else {
      var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);
      var singleVLine = visualLine(fromLine) == visualLine(toLine);
      var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;
      var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;
      if (singleVLine) {
        if (leftEnd.top < rightStart.top - 2) {
          add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);
          add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);
        } else {
          add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);
        }
      }
      if (leftEnd.bottom < rightStart.top)
        { add(leftSide, leftEnd.bottom, null, rightStart.top); }
    }

    output.appendChild(fragment);
  }

  // Cursor-blinking
  function restartBlink(cm) {
    if (!cm.state.focused) { return }
    var display = cm.display;
    clearInterval(display.blinker);
    var on = true;
    display.cursorDiv.style.visibility = "";
    if (cm.options.cursorBlinkRate > 0)
      { display.blinker = setInterval(function () {
        if (!cm.hasFocus()) { onBlur(cm); }
        display.cursorDiv.style.visibility = (on = !on) ? "" : "hidden";
      }, cm.options.cursorBlinkRate); }
    else if (cm.options.cursorBlinkRate < 0)
      { display.cursorDiv.style.visibility = "hidden"; }
  }

  function ensureFocus(cm) {
    if (!cm.hasFocus()) {
      cm.display.input.focus();
      if (!cm.state.focused) { onFocus(cm); }
    }
  }

  function delayBlurEvent(cm) {
    cm.state.delayingBlurEvent = true;
    setTimeout(function () { if (cm.state.delayingBlurEvent) {
      cm.state.delayingBlurEvent = false;
      if (cm.state.focused) { onBlur(cm); }
    } }, 100);
  }

  function onFocus(cm, e) {
    if (cm.state.delayingBlurEvent && !cm.state.draggingText) { cm.state.delayingBlurEvent = false; }

    if (cm.options.readOnly == "nocursor") { return }
    if (!cm.state.focused) {
      signal(cm, "focus", cm, e);
      cm.state.focused = true;
      addClass(cm.display.wrapper, "CodeMirror-focused");
      // This test prevents this from firing when a context
      // menu is closed (since the input reset would kill the
      // select-all detection hack)
      if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) {
        cm.display.input.reset();
        if (webkit) { setTimeout(function () { return cm.display.input.reset(true); }, 20); } // Issue #1730
      }
      cm.display.input.receivedFocus();
    }
    restartBlink(cm);
  }
  function onBlur(cm, e) {
    if (cm.state.delayingBlurEvent) { return }

    if (cm.state.focused) {
      signal(cm, "blur", cm, e);
      cm.state.focused = false;
      rmClass(cm.display.wrapper, "CodeMirror-focused");
    }
    clearInterval(cm.display.blinker);
    setTimeout(function () { if (!cm.state.focused) { cm.display.shift = false; } }, 150);
  }

  // Read the actual heights of the rendered lines, and update their
  // stored heights to match.
  function updateHeightsInViewport(cm) {
    var display = cm.display;
    var prevBottom = display.lineDiv.offsetTop;
    for (var i = 0; i < display.view.length; i++) {
      var cur = display.view[i], wrapping = cm.options.lineWrapping;
      var height = (void 0), width = 0;
      if (cur.hidden) { continue }
      if (ie && ie_version < 8) {
        var bot = cur.node.offsetTop + cur.node.offsetHeight;
        height = bot - prevBottom;
        prevBottom = bot;
      } else {
        var box = cur.node.getBoundingClientRect();
        height = box.bottom - box.top;
        // Check that lines don't extend past the right of the current
        // editor width
        if (!wrapping && cur.text.firstChild)
          { width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1; }
      }
      var diff = cur.line.height - height;
      if (diff > .005 || diff < -.005) {
        updateLineHeight(cur.line, height);
        updateWidgetHeight(cur.line);
        if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)
          { updateWidgetHeight(cur.rest[j]); } }
      }
      if (width > cm.display.sizerWidth) {
        var chWidth = Math.ceil(width / charWidth(cm.display));
        if (chWidth > cm.display.maxLineLength) {
          cm.display.maxLineLength = chWidth;
          cm.display.maxLine = cur.line;
          cm.display.maxLineChanged = true;
        }
      }
    }
  }

  // Read and store the height of line widgets associated with the
  // given line.
  function updateWidgetHeight(line) {
    if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {
      var w = line.widgets[i], parent = w.node.parentNode;
      if (parent) { w.height = parent.offsetHeight; }
    } }
  }

  // Compute the lines that are visible in a given viewport (defaults
  // the the current scroll position). viewport may contain top,
  // height, and ensure (see op.scrollToPos) properties.
  function visibleLines(display, doc, viewport) {
    var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;
    top = Math.floor(top - paddingTop(display));
    var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;

    var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);
    // Ensure is a {from: {line, ch}, to: {line, ch}} object, and
    // forces those lines into the viewport (if possible).
    if (viewport && viewport.ensure) {
      var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;
      if (ensureFrom < from) {
        from = ensureFrom;
        to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);
      } else if (Math.min(ensureTo, doc.lastLine()) >= to) {
        from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);
        to = ensureTo;
      }
    }
    return {from: from, to: Math.max(to, from + 1)}
  }

  // SCROLLING THINGS INTO VIEW

  // If an editor sits on the top or bottom of the window, partially
  // scrolled out of view, this ensures that the cursor is visible.
  function maybeScrollWindow(cm, rect) {
    if (signalDOMEvent(cm, "scrollCursorIntoView")) { return }

    var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null;
    if (rect.top + box.top < 0) { doScroll = true; }
    else if (rect.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) { doScroll = false; }
    if (doScroll != null && !phantom) {
      var scrollNode = elt("div", "\u200b", null, ("position: absolute;\n                         top: " + (rect.top - display.viewOffset - paddingTop(cm.display)) + "px;\n                         height: " + (rect.bottom - rect.top + scrollGap(cm) + display.barHeight) + "px;\n                         left: " + (rect.left) + "px; width: " + (Math.max(2, rect.right - rect.left)) + "px;"));
      cm.display.lineSpace.appendChild(scrollNode);
      scrollNode.scrollIntoView(doScroll);
      cm.display.lineSpace.removeChild(scrollNode);
    }
  }

  // Scroll a given position into view (immediately), verifying that
  // it actually became visible (as line heights are accurately
  // measured, the position of something may 'drift' during drawing).
  function scrollPosIntoView(cm, pos, end, margin) {
    if (margin == null) { margin = 0; }
    var rect;
    if (!cm.options.lineWrapping && pos == end) {
      // Set pos and end to the cursor positions around the character pos sticks to
      // If pos.sticky == "before", that is around pos.ch - 1, otherwise around pos.ch
      // If pos == Pos(_, 0, "before"), pos and end are unchanged
      end = pos.sticky == "before" ? Pos(pos.line, pos.ch + 1, "before") : pos;
      pos = pos.ch ? Pos(pos.line, pos.sticky == "before" ? pos.ch - 1 : pos.ch, "after") : pos;
    }
    for (var limit = 0; limit < 5; limit++) {
      var changed = false;
      var coords = cursorCoords(cm, pos);
      var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);
      rect = {left: Math.min(coords.left, endCoords.left),
              top: Math.min(coords.top, endCoords.top) - margin,
              right: Math.max(coords.left, endCoords.left),
              bottom: Math.max(coords.bottom, endCoords.bottom) + margin};
      var scrollPos = calculateScrollPos(cm, rect);
      var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;
      if (scrollPos.scrollTop != null) {
        updateScrollTop(cm, scrollPos.scrollTop);
        if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }
      }
      if (scrollPos.scrollLeft != null) {
        setScrollLeft(cm, scrollPos.scrollLeft);
        if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }
      }
      if (!changed) { break }
    }
    return rect
  }

  // Scroll a given set of coordinates into view (immediately).
  function scrollIntoView(cm, rect) {
    var scrollPos = calculateScrollPos(cm, rect);
    if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop); }
    if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }
  }

  // Calculate a new scroll position needed to scroll the given
  // rectangle into view. Returns an object with scrollTop and
  // scrollLeft properties. When these are undefined, the
  // vertical/horizontal position does not need to be adjusted.
  function calculateScrollPos(cm, rect) {
    var display = cm.display, snapMargin = textHeight(cm.display);
    if (rect.top < 0) { rect.top = 0; }
    var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;
    var screen = displayHeight(cm), result = {};
    if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }
    var docBottom = cm.doc.height + paddingVert(display);
    var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;
    if (rect.top < screentop) {
      result.scrollTop = atTop ? 0 : rect.top;
    } else if (rect.bottom > screentop + screen) {
      var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);
      if (newTop != screentop) { result.scrollTop = newTop; }
    }

    var gutterSpace = cm.options.fixedGutter ? 0 : display.gutters.offsetWidth;
    var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft - gutterSpace;
    var screenw = displayWidth(cm) - display.gutters.offsetWidth;
    var tooWide = rect.right - rect.left > screenw;
    if (tooWide) { rect.right = rect.left + screenw; }
    if (rect.left < 10)
      { result.scrollLeft = 0; }
    else if (rect.left < screenleft)
      { result.scrollLeft = Math.max(0, rect.left + gutterSpace - (tooWide ? 0 : 10)); }
    else if (rect.right > screenw + screenleft - 3)
      { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }
    return result
  }

  // Store a relative adjustment to the scroll position in the current
  // operation (to be applied when the operation finishes).
  function addToScrollTop(cm, top) {
    if (top == null) { return }
    resolveScrollToPos(cm);
    cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;
  }

  // Make sure that at the end of the operation the current cursor is
  // shown.
  function ensureCursorVisible(cm) {
    resolveScrollToPos(cm);
    var cur = cm.getCursor();
    cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};
  }

  function scrollToCoords(cm, x, y) {
    if (x != null || y != null) { resolveScrollToPos(cm); }
    if (x != null) { cm.curOp.scrollLeft = x; }
    if (y != null) { cm.curOp.scrollTop = y; }
  }

  function scrollToRange(cm, range) {
    resolveScrollToPos(cm);
    cm.curOp.scrollToPos = range;
  }

  // When an operation has its scrollToPos property set, and another
  // scroll action is applied before the end of the operation, this
  // 'simulates' scrolling that position into view in a cheap way, so
  // that the effect of intermediate scroll commands is not ignored.
  function resolveScrollToPos(cm) {
    var range = cm.curOp.scrollToPos;
    if (range) {
      cm.curOp.scrollToPos = null;
      var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to);
      scrollToCoordsRange(cm, from, to, range.margin);
    }
  }

  function scrollToCoordsRange(cm, from, to, margin) {
    var sPos = calculateScrollPos(cm, {
      left: Math.min(from.left, to.left),
      top: Math.min(from.top, to.top) - margin,
      right: Math.max(from.right, to.right),
      bottom: Math.max(from.bottom, to.bottom) + margin
    });
    scrollToCoords(cm, sPos.scrollLeft, sPos.scrollTop);
  }

  // Sync the scrollable area and scrollbars, ensure the viewport
  // covers the visible area.
  function updateScrollTop(cm, val) {
    if (Math.abs(cm.doc.scrollTop - val) < 2) { return }
    if (!gecko) { updateDisplaySimple(cm, {top: val}); }
    setScrollTop(cm, val, true);
    if (gecko) { updateDisplaySimple(cm); }
    startWorker(cm, 100);
  }

  function setScrollTop(cm, val, forceScroll) {
    val = Math.max(0, Math.min(cm.display.scroller.scrollHeight - cm.display.scroller.clientHeight, val));
    if (cm.display.scroller.scrollTop == val && !forceScroll) { return }
    cm.doc.scrollTop = val;
    cm.display.scrollbars.setScrollTop(val);
    if (cm.display.scroller.scrollTop != val) { cm.display.scroller.scrollTop = val; }
  }

  // Sync scroller and scrollbar, ensure the gutter elements are
  // aligned.
  function setScrollLeft(cm, val, isScroller, forceScroll) {
    val = Math.max(0, Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth));
    if ((isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) && !forceScroll) { return }
    cm.doc.scrollLeft = val;
    alignHorizontally(cm);
    if (cm.display.scroller.scrollLeft != val) { cm.display.scroller.scrollLeft = val; }
    cm.display.scrollbars.setScrollLeft(val);
  }

  // SCROLLBARS

  // Prepare DOM reads needed to update the scrollbars. Done in one
  // shot to minimize update/measure roundtrips.
  function measureForScrollbars(cm) {
    var d = cm.display, gutterW = d.gutters.offsetWidth;
    var docH = Math.round(cm.doc.height + paddingVert(cm.display));
    return {
      clientHeight: d.scroller.clientHeight,
      viewHeight: d.wrapper.clientHeight,
      scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,
      viewWidth: d.wrapper.clientWidth,
      barLeft: cm.options.fixedGutter ? gutterW : 0,
      docHeight: docH,
      scrollHeight: docH + scrollGap(cm) + d.barHeight,
      nativeBarWidth: d.nativeBarWidth,
      gutterWidth: gutterW
    }
  }

  var NativeScrollbars = function(place, scroll, cm) {
    this.cm = cm;
    var vert = this.vert = elt("div", [elt("div", null, null, "min-width: 1px")], "CodeMirror-vscrollbar");
    var horiz = this.horiz = elt("div", [elt("div", null, null, "height: 100%; min-height: 1px")], "CodeMirror-hscrollbar");
    vert.tabIndex = horiz.tabIndex = -1;
    place(vert); place(horiz);

    on(vert, "scroll", function () {
      if (vert.clientHeight) { scroll(vert.scrollTop, "vertical"); }
    });
    on(horiz, "scroll", function () {
      if (horiz.clientWidth) { scroll(horiz.scrollLeft, "horizontal"); }
    });

    this.checkedZeroWidth = false;
    // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).
    if (ie && ie_version < 8) { this.horiz.style.minHeight = this.vert.style.minWidth = "18px"; }
  };

  NativeScrollbars.prototype.update = function (measure) {
    var needsH = measure.scrollWidth > measure.clientWidth + 1;
    var needsV = measure.scrollHeight > measure.clientHeight + 1;
    var sWidth = measure.nativeBarWidth;

    if (needsV) {
      this.vert.style.display = "block";
      this.vert.style.bottom = needsH ? sWidth + "px" : "0";
      var totalHeight = measure.viewHeight - (needsH ? sWidth : 0);
      // A bug in IE8 can cause this value to be negative, so guard it.
      this.vert.firstChild.style.height =
        Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + "px";
    } else {
      this.vert.style.display = "";
      this.vert.firstChild.style.height = "0";
    }

    if (needsH) {
      this.horiz.style.display = "block";
      this.horiz.style.right = needsV ? sWidth + "px" : "0";
      this.horiz.style.left = measure.barLeft + "px";
      var totalWidth = measure.viewWidth - measure.barLeft - (needsV ? sWidth : 0);
      this.horiz.firstChild.style.width =
        Math.max(0, measure.scrollWidth - measure.clientWidth + totalWidth) + "px";
    } else {
      this.horiz.style.display = "";
      this.horiz.firstChild.style.width = "0";
    }

    if (!this.checkedZeroWidth && measure.clientHeight > 0) {
      if (sWidth == 0) { this.zeroWidthHack(); }
      this.checkedZeroWidth = true;
    }

    return {right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0}
  };

  NativeScrollbars.prototype.setScrollLeft = function (pos) {
    if (this.horiz.scrollLeft != pos) { this.horiz.scrollLeft = pos; }
    if (this.disableHoriz) { this.enableZeroWidthBar(this.horiz, this.disableHoriz, "horiz"); }
  };

  NativeScrollbars.prototype.setScrollTop = function (pos) {
    if (this.vert.scrollTop != pos) { this.vert.scrollTop = pos; }
    if (this.disableVert) { this.enableZeroWidthBar(this.vert, this.disableVert, "vert"); }
  };

  NativeScrollbars.prototype.zeroWidthHack = function () {
    var w = mac && !mac_geMountainLion ? "12px" : "18px";
    this.horiz.style.height = this.vert.style.width = w;
    this.horiz.style.pointerEvents = this.vert.style.pointerEvents = "none";
    this.disableHoriz = new Delayed;
    this.disableVert = new Delayed;
  };

  NativeScrollbars.prototype.enableZeroWidthBar = function (bar, delay, type) {
    bar.style.pointerEvents = "auto";
    function maybeDisable() {
      // To find out whether the scrollbar is still visible, we
      // check whether the element under the pixel in the bottom
      // right corner of the scrollbar box is the scrollbar box
      // itself (when the bar is still visible) or its filler child
      // (when the bar is hidden). If it is still visible, we keep
      // it enabled, if it's hidden, we disable pointer events.
      var box = bar.getBoundingClientRect();
      var elt = type == "vert" ? document.elementFromPoint(box.right - 1, (box.top + box.bottom) / 2)
          : document.elementFromPoint((box.right + box.left) / 2, box.bottom - 1);
      if (elt != bar) { bar.style.pointerEvents = "none"; }
      else { delay.set(1000, maybeDisable); }
    }
    delay.set(1000, maybeDisable);
  };

  NativeScrollbars.prototype.clear = function () {
    var parent = this.horiz.parentNode;
    parent.removeChild(this.horiz);
    parent.removeChild(this.vert);
  };

  var NullScrollbars = function () {};

  NullScrollbars.prototype.update = function () { return {bottom: 0, right: 0} };
  NullScrollbars.prototype.setScrollLeft = function () {};
  NullScrollbars.prototype.setScrollTop = function () {};
  NullScrollbars.prototype.clear = function () {};

  function updateScrollbars(cm, measure) {
    if (!measure) { measure = measureForScrollbars(cm); }
    var startWidth = cm.display.barWidth, startHeight = cm.display.barHeight;
    updateScrollbarsInner(cm, measure);
    for (var i = 0; i < 4 && startWidth != cm.display.barWidth || startHeight != cm.display.barHeight; i++) {
      if (startWidth != cm.display.barWidth && cm.options.lineWrapping)
        { updateHeightsInViewport(cm); }
      updateScrollbarsInner(cm, measureForScrollbars(cm));
      startWidth = cm.display.barWidth; startHeight = cm.display.barHeight;
    }
  }

  // Re-synchronize the fake scrollbars with the actual size of the
  // content.
  function updateScrollbarsInner(cm, measure) {
    var d = cm.display;
    var sizes = d.scrollbars.update(measure);

    d.sizer.style.paddingRight = (d.barWidth = sizes.right) + "px";
    d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + "px";
    d.heightForcer.style.borderBottom = sizes.bottom + "px solid transparent";

    if (sizes.right && sizes.bottom) {
      d.scrollbarFiller.style.display = "block";
      d.scrollbarFiller.style.height = sizes.bottom + "px";
      d.scrollbarFiller.style.width = sizes.right + "px";
    } else { d.scrollbarFiller.style.display = ""; }
    if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {
      d.gutterFiller.style.display = "block";
      d.gutterFiller.style.height = sizes.bottom + "px";
      d.gutterFiller.style.width = measure.gutterWidth + "px";
    } else { d.gutterFiller.style.display = ""; }
  }

  var scrollbarModel = {"native": NativeScrollbars, "null": NullScrollbars};

  function initScrollbars(cm) {
    if (cm.display.scrollbars) {
      cm.display.scrollbars.clear();
      if (cm.display.scrollbars.addClass)
        { rmClass(cm.display.wrapper, cm.display.scrollbars.addClass); }
    }

    cm.display.scrollbars = new scrollbarModel[cm.options.scrollbarStyle](function (node) {
      cm.display.wrapper.insertBefore(node, cm.display.scrollbarFiller);
      // Prevent clicks in the scrollbars from killing focus
      on(node, "mousedown", function () {
        if (cm.state.focused) { setTimeout(function () { return cm.display.input.focus(); }, 0); }
      });
      node.setAttribute("cm-not-content", "true");
    }, function (pos, axis) {
      if (axis == "horizontal") { setScrollLeft(cm, pos); }
      else { updateScrollTop(cm, pos); }
    }, cm);
    if (cm.display.scrollbars.addClass)
      { addClass(cm.display.wrapper, cm.display.scrollbars.addClass); }
  }

  // Operations are used to wrap a series of changes to the editor
  // state in such a way that each change won't have to update the
  // cursor and display (which would be awkward, slow, and
  // error-prone). Instead, display updates are batched and then all
  // combined and executed at once.

  var nextOpId = 0;
  // Start a new operation.
  function startOperation(cm) {
    cm.curOp = {
      cm: cm,
      viewChanged: false,      // Flag that indicates that lines might need to be redrawn
      startHeight: cm.doc.height, // Used to detect need to update scrollbar
      forceUpdate: false,      // Used to force a redraw
      updateInput: 0,       // Whether to reset the input textarea
      typing: false,           // Whether this reset should be careful to leave existing text (for compositing)
      changeObjs: null,        // Accumulated changes, for firing change events
      cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on
      cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already
      selectionChanged: false, // Whether the selection needs to be redrawn
      updateMaxLine: false,    // Set when the widest line needs to be determined anew
      scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet
      scrollToPos: null,       // Used to scroll to a specific position
      focus: false,
      id: ++nextOpId,          // Unique ID
      markArrays: null         // Used by addMarkedSpan
    };
    pushOperation(cm.curOp);
  }

  // Finish an operation, updating the display and signalling delayed events
  function endOperation(cm) {
    var op = cm.curOp;
    if (op) { finishOperation(op, function (group) {
      for (var i = 0; i < group.ops.length; i++)
        { group.ops[i].cm.curOp = null; }
      endOperations(group);
    }); }
  }

  // The DOM updates done when an operation finishes are batched so
  // that the minimum number of relayouts are required.
  function endOperations(group) {
    var ops = group.ops;
    for (var i = 0; i < ops.length; i++) // Read DOM
      { endOperation_R1(ops[i]); }
    for (var i$1 = 0; i$1 < ops.length; i$1++) // Write DOM (maybe)
      { endOperation_W1(ops[i$1]); }
    for (var i$2 = 0; i$2 < ops.length; i$2++) // Read DOM
      { endOperation_R2(ops[i$2]); }
    for (var i$3 = 0; i$3 < ops.length; i$3++) // Write DOM (maybe)
      { endOperation_W2(ops[i$3]); }
    for (var i$4 = 0; i$4 < ops.length; i$4++) // Read DOM
      { endOperation_finish(ops[i$4]); }
  }

  function endOperation_R1(op) {
    var cm = op.cm, display = cm.display;
    maybeClipScrollbars(cm);
    if (op.updateMaxLine) { findMaxLine(cm); }

    op.mustUpdate = op.viewChanged || op.forceUpdate || op.scrollTop != null ||
      op.scrollToPos && (op.scrollToPos.from.line < display.viewFrom ||
                         op.scrollToPos.to.line >= display.viewTo) ||
      display.maxLineChanged && cm.options.lineWrapping;
    op.update = op.mustUpdate &&
      new DisplayUpdate(cm, op.mustUpdate && {top: op.scrollTop, ensure: op.scrollToPos}, op.forceUpdate);
  }

  function endOperation_W1(op) {
    op.updatedDisplay = op.mustUpdate && updateDisplayIfNeeded(op.cm, op.update);
  }

  function endOperation_R2(op) {
    var cm = op.cm, display = cm.display;
    if (op.updatedDisplay) { updateHeightsInViewport(cm); }

    op.barMeasure = measureForScrollbars(cm);

    // If the max line changed since it was last measured, measure it,
    // and ensure the document's width matches it.
    // updateDisplay_W2 will use these properties to do the actual resizing
    if (display.maxLineChanged && !cm.options.lineWrapping) {
      op.adjustWidthTo = measureChar(cm, display.maxLine, display.maxLine.text.length).left + 3;
      cm.display.sizerWidth = op.adjustWidthTo;
      op.barMeasure.scrollWidth =
        Math.max(display.scroller.clientWidth, display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm) + cm.display.barWidth);
      op.maxScrollLeft = Math.max(0, display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm));
    }

    if (op.updatedDisplay || op.selectionChanged)
      { op.preparedSelection = display.input.prepareSelection(); }
  }

  function endOperation_W2(op) {
    var cm = op.cm;

    if (op.adjustWidthTo != null) {
      cm.display.sizer.style.minWidth = op.adjustWidthTo + "px";
      if (op.maxScrollLeft < cm.doc.scrollLeft)
        { setScrollLeft(cm, Math.min(cm.display.scroller.scrollLeft, op.maxScrollLeft), true); }
      cm.display.maxLineChanged = false;
    }

    var takeFocus = op.focus && op.focus == activeElt();
    if (op.preparedSelection)
      { cm.display.input.showSelection(op.preparedSelection, takeFocus); }
    if (op.updatedDisplay || op.startHeight != cm.doc.height)
      { updateScrollbars(cm, op.barMeasure); }
    if (op.updatedDisplay)
      { setDocumentHeight(cm, op.barMeasure); }

    if (op.selectionChanged) { restartBlink(cm); }

    if (cm.state.focused && op.updateInput)
      { cm.display.input.reset(op.typing); }
    if (takeFocus) { ensureFocus(op.cm); }
  }

  function endOperation_finish(op) {
    var cm = op.cm, display = cm.display, doc = cm.doc;

    if (op.updatedDisplay) { postUpdateDisplay(cm, op.update); }

    // Abort mouse wheel delta measurement, when scrolling explicitly
    if (display.wheelStartX != null && (op.scrollTop != null || op.scrollLeft != null || op.scrollToPos))
      { display.wheelStartX = display.wheelStartY = null; }

    // Propagate the scroll position to the actual DOM scroller
    if (op.scrollTop != null) { setScrollTop(cm, op.scrollTop, op.forceScroll); }

    if (op.scrollLeft != null) { setScrollLeft(cm, op.scrollLeft, true, true); }
    // If we need to scroll a specific position into view, do so.
    if (op.scrollToPos) {
      var rect = scrollPosIntoView(cm, clipPos(doc, op.scrollToPos.from),
                                   clipPos(doc, op.scrollToPos.to), op.scrollToPos.margin);
      maybeScrollWindow(cm, rect);
    }

    // Fire events for markers that are hidden/unidden by editing or
    // undoing
    var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers;
    if (hidden) { for (var i = 0; i < hidden.length; ++i)
      { if (!hidden[i].lines.length) { signal(hidden[i], "hide"); } } }
    if (unhidden) { for (var i$1 = 0; i$1 < unhidden.length; ++i$1)
      { if (unhidden[i$1].lines.length) { signal(unhidden[i$1], "unhide"); } } }

    if (display.wrapper.offsetHeight)
      { doc.scrollTop = cm.display.scroller.scrollTop; }

    // Fire change events, and delayed event handlers
    if (op.changeObjs)
      { signal(cm, "changes", cm, op.changeObjs); }
    if (op.update)
      { op.update.finish(); }
  }

  // Run the given function in an operation
  function runInOp(cm, f) {
    if (cm.curOp) { return f() }
    startOperation(cm);
    try { return f() }
    finally { endOperation(cm); }
  }
  // Wraps a function in an operation. Returns the wrapped function.
  function operation(cm, f) {
    return function() {
      if (cm.curOp) { return f.apply(cm, arguments) }
      startOperation(cm);
      try { return f.apply(cm, arguments) }
      finally { endOperation(cm); }
    }
  }
  // Used to add methods to editor and doc instances, wrapping them in
  // operations.
  function methodOp(f) {
    return function() {
      if (this.curOp) { return f.apply(this, arguments) }
      startOperation(this);
      try { return f.apply(this, arguments) }
      finally { endOperation(this); }
    }
  }
  function docMethodOp(f) {
    return function() {
      var cm = this.cm;
      if (!cm || cm.curOp) { return f.apply(this, arguments) }
      startOperation(cm);
      try { return f.apply(this, arguments) }
      finally { endOperation(cm); }
    }
  }

  // HIGHLIGHT WORKER

  function startWorker(cm, time) {
    if (cm.doc.highlightFrontier < cm.display.viewTo)
      { cm.state.highlight.set(time, bind(highlightWorker, cm)); }
  }

  function highlightWorker(cm) {
    var doc = cm.doc;
    if (doc.highlightFrontier >= cm.display.viewTo) { return }
    var end = +new Date + cm.options.workTime;
    var context = getContextBefore(cm, doc.highlightFrontier);
    var changedLines = [];

    doc.iter(context.line, Math.min(doc.first + doc.size, cm.display.viewTo + 500), function (line) {
      if (context.line >= cm.display.viewFrom) { // Visible
        var oldStyles = line.styles;
        var resetState = line.text.length > cm.options.maxHighlightLength ? copyState(doc.mode, context.state) : null;
        var highlighted = highlightLine(cm, line, context, true);
        if (resetState) { context.state = resetState; }
        line.styles = highlighted.styles;
        var oldCls = line.styleClasses, newCls = highlighted.classes;
        if (newCls) { line.styleClasses = newCls; }
        else if (oldCls) { line.styleClasses = null; }
        var ischange = !oldStyles || oldStyles.length != line.styles.length ||
          oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass);
        for (var i = 0; !ischange && i < oldStyles.length; ++i) { ischange = oldStyles[i] != line.styles[i]; }
        if (ischange) { changedLines.push(context.line); }
        line.stateAfter = context.save();
        context.nextLine();
      } else {
        if (line.text.length <= cm.options.maxHighlightLength)
          { processLine(cm, line.text, context); }
        line.stateAfter = context.line % 5 == 0 ? context.save() : null;
        context.nextLine();
      }
      if (+new Date > end) {
        startWorker(cm, cm.options.workDelay);
        return true
      }
    });
    doc.highlightFrontier = context.line;
    doc.modeFrontier = Math.max(doc.modeFrontier, context.line);
    if (changedLines.length) { runInOp(cm, function () {
      for (var i = 0; i < changedLines.length; i++)
        { regLineChange(cm, changedLines[i], "text"); }
    }); }
  }

  // DISPLAY DRAWING

  var DisplayUpdate = function(cm, viewport, force) {
    var display = cm.display;

    this.viewport = viewport;
    // Store some values that we'll need later (but don't want to force a relayout for)
    this.visible = visibleLines(display, cm.doc, viewport);
    this.editorIsHidden = !display.wrapper.offsetWidth;
    this.wrapperHeight = display.wrapper.clientHeight;
    this.wrapperWidth = display.wrapper.clientWidth;
    this.oldDisplayWidth = displayWidth(cm);
    this.force = force;
    this.dims = getDimensions(cm);
    this.events = [];
  };

  DisplayUpdate.prototype.signal = function (emitter, type) {
    if (hasHandler(emitter, type))
      { this.events.push(arguments); }
  };
  DisplayUpdate.prototype.finish = function () {
    for (var i = 0; i < this.events.length; i++)
      { signal.apply(null, this.events[i]); }
  };

  function maybeClipScrollbars(cm) {
    var display = cm.display;
    if (!display.scrollbarsClipped && display.scroller.offsetWidth) {
      display.nativeBarWidth = display.scroller.offsetWidth - display.scroller.clientWidth;
      display.heightForcer.style.height = scrollGap(cm) + "px";
      display.sizer.style.marginBottom = -display.nativeBarWidth + "px";
      display.sizer.style.borderRightWidth = scrollGap(cm) + "px";
      display.scrollbarsClipped = true;
    }
  }

  function selectionSnapshot(cm) {
    if (cm.hasFocus()) { return null }
    var active = activeElt();
    if (!active || !contains(cm.display.lineDiv, active)) { return null }
    var result = {activeElt: active};
    if (window.getSelection) {
      var sel = window.getSelection();
      if (sel.anchorNode && sel.extend && contains(cm.display.lineDiv, sel.anchorNode)) {
        result.anchorNode = sel.anchorNode;
        result.anchorOffset = sel.anchorOffset;
        result.focusNode = sel.focusNode;
        result.focusOffset = sel.focusOffset;
      }
    }
    return result
  }

  function restoreSelection(snapshot) {
    if (!snapshot || !snapshot.activeElt || snapshot.activeElt == activeElt()) { return }
    snapshot.activeElt.focus();
    if (!/^(INPUT|TEXTAREA)$/.test(snapshot.activeElt.nodeName) &&
        snapshot.anchorNode && contains(document.body, snapshot.anchorNode) && contains(document.body, snapshot.focusNode)) {
      var sel = window.getSelection(), range = document.createRange();
      range.setEnd(snapshot.anchorNode, snapshot.anchorOffset);
      range.collapse(false);
      sel.removeAllRanges();
      sel.addRange(range);
      sel.extend(snapshot.focusNode, snapshot.focusOffset);
    }
  }

  // Does the actual updating of the line display. Bails out
  // (returning false) when there is nothing to be done and forced is
  // false.
  function updateDisplayIfNeeded(cm, update) {
    var display = cm.display, doc = cm.doc;

    if (update.editorIsHidden) {
      resetView(cm);
      return false
    }

    // Bail out if the visible area is already rendered and nothing changed.
    if (!update.force &&
        update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&
        (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&
        display.renderedView == display.view && countDirtyView(cm) == 0)
      { return false }

    if (maybeUpdateLineNumberWidth(cm)) {
      resetView(cm);
      update.dims = getDimensions(cm);
    }

    // Compute a suitable new viewport (from & to)
    var end = doc.first + doc.size;
    var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);
    var to = Math.min(end, update.visible.to + cm.options.viewportMargin);
    if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }
    if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }
    if (sawCollapsedSpans) {
      from = visualLineNo(cm.doc, from);
      to = visualLineEndNo(cm.doc, to);
    }

    var different = from != display.viewFrom || to != display.viewTo ||
      display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;
    adjustView(cm, from, to);

    display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));
    // Position the mover div to align with the current scroll position
    cm.display.mover.style.top = display.viewOffset + "px";

    var toUpdate = countDirtyView(cm);
    if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&
        (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))
      { return false }

    // For big changes, we hide the enclosing element during the
    // update, since that speeds up the operations on most browsers.
    var selSnapshot = selectionSnapshot(cm);
    if (toUpdate > 4) { display.lineDiv.style.display = "none"; }
    patchDisplay(cm, display.updateLineNumbers, update.dims);
    if (toUpdate > 4) { display.lineDiv.style.display = ""; }
    display.renderedView = display.view;
    // There might have been a widget with a focused element that got
    // hidden or updated, if so re-focus it.
    restoreSelection(selSnapshot);

    // Prevent selection and cursors from interfering with the scroll
    // width and height.
    removeChildren(display.cursorDiv);
    removeChildren(display.selectionDiv);
    display.gutters.style.height = display.sizer.style.minHeight = 0;

    if (different) {
      display.lastWrapHeight = update.wrapperHeight;
      display.lastWrapWidth = update.wrapperWidth;
      startWorker(cm, 400);
    }

    display.updateLineNumbers = null;

    return true
  }

  function postUpdateDisplay(cm, update) {
    var viewport = update.viewport;

    for (var first = true;; first = false) {
      if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) {
        // Clip forced viewport to actual scrollable area.
        if (viewport && viewport.top != null)
          { viewport = {top: Math.min(cm.doc.height + paddingVert(cm.display) - displayHeight(cm), viewport.top)}; }
        // Updated line heights might result in the drawn area not
        // actually covering the viewport. Keep looping until it does.
        update.visible = visibleLines(cm.display, cm.doc, viewport);
        if (update.visible.from >= cm.display.viewFrom && update.visible.to <= cm.display.viewTo)
          { break }
      } else if (first) {
        update.visible = visibleLines(cm.display, cm.doc, viewport);
      }
      if (!updateDisplayIfNeeded(cm, update)) { break }
      updateHeightsInViewport(cm);
      var barMeasure = measureForScrollbars(cm);
      updateSelection(cm);
      updateScrollbars(cm, barMeasure);
      setDocumentHeight(cm, barMeasure);
      update.force = false;
    }

    update.signal(cm, "update", cm);
    if (cm.display.viewFrom != cm.display.reportedViewFrom || cm.display.viewTo != cm.display.reportedViewTo) {
      update.signal(cm, "viewportChange", cm, cm.display.viewFrom, cm.display.viewTo);
      cm.display.reportedViewFrom = cm.display.viewFrom; cm.display.reportedViewTo = cm.display.viewTo;
    }
  }

  function updateDisplaySimple(cm, viewport) {
    var update = new DisplayUpdate(cm, viewport);
    if (updateDisplayIfNeeded(cm, update)) {
      updateHeightsInViewport(cm);
      postUpdateDisplay(cm, update);
      var barMeasure = measureForScrollbars(cm);
      updateSelection(cm);
      updateScrollbars(cm, barMeasure);
      setDocumentHeight(cm, barMeasure);
      update.finish();
    }
  }

  // Sync the actual display DOM structure with display.view, removing
  // nodes for lines that are no longer in view, and creating the ones
  // that are not there yet, and updating the ones that are out of
  // date.
  function patchDisplay(cm, updateNumbersFrom, dims) {
    var display = cm.display, lineNumbers = cm.options.lineNumbers;
    var container = display.lineDiv, cur = container.firstChild;

    function rm(node) {
      var next = node.nextSibling;
      // Works around a throw-scroll bug in OS X Webkit
      if (webkit && mac && cm.display.currentWheelTarget == node)
        { node.style.display = "none"; }
      else
        { node.parentNode.removeChild(node); }
      return next
    }

    var view = display.view, lineN = display.viewFrom;
    // Loop over the elements in the view, syncing cur (the DOM nodes
    // in display.lineDiv) with the view as we go.
    for (var i = 0; i < view.length; i++) {
      var lineView = view[i];
      if (lineView.hidden) ; else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet
        var node = buildLineElement(cm, lineView, lineN, dims);
        container.insertBefore(node, cur);
      } else { // Already drawn
        while (cur != lineView.node) { cur = rm(cur); }
        var updateNumber = lineNumbers && updateNumbersFrom != null &&
          updateNumbersFrom <= lineN && lineView.lineNumber;
        if (lineView.changes) {
          if (indexOf(lineView.changes, "gutter") > -1) { updateNumber = false; }
          updateLineForChanges(cm, lineView, lineN, dims);
        }
        if (updateNumber) {
          removeChildren(lineView.lineNumber);
          lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));
        }
        cur = lineView.node.nextSibling;
      }
      lineN += lineView.size;
    }
    while (cur) { cur = rm(cur); }
  }

  function updateGutterSpace(display) {
    var width = display.gutters.offsetWidth;
    display.sizer.style.marginLeft = width + "px";
    // Send an event to consumers responding to changes in gutter width.
    signalLater(display, "gutterChanged", display);
  }

  function setDocumentHeight(cm, measure) {
    cm.display.sizer.style.minHeight = measure.docHeight + "px";
    cm.display.heightForcer.style.top = measure.docHeight + "px";
    cm.display.gutters.style.height = (measure.docHeight + cm.display.barHeight + scrollGap(cm)) + "px";
  }

  // Re-align line numbers and gutter marks to compensate for
  // horizontal scrolling.
  function alignHorizontally(cm) {
    var display = cm.display, view = display.view;
    if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }
    var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;
    var gutterW = display.gutters.offsetWidth, left = comp + "px";
    for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {
      if (cm.options.fixedGutter) {
        if (view[i].gutter)
          { view[i].gutter.style.left = left; }
        if (view[i].gutterBackground)
          { view[i].gutterBackground.style.left = left; }
      }
      var align = view[i].alignable;
      if (align) { for (var j = 0; j < align.length; j++)
        { align[j].style.left = left; } }
    } }
    if (cm.options.fixedGutter)
      { display.gutters.style.left = (comp + gutterW) + "px"; }
  }

  // Used to ensure that the line number gutter is still the right
  // size for the current document size. Returns true when an update
  // is needed.
  function maybeUpdateLineNumberWidth(cm) {
    if (!cm.options.lineNumbers) { return false }
    var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;
    if (last.length != display.lineNumChars) {
      var test = display.measure.appendChild(elt("div", [elt("div", last)],
                                                 "CodeMirror-linenumber CodeMirror-gutter-elt"));
      var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;
      display.lineGutter.style.width = "";
      display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;
      display.lineNumWidth = display.lineNumInnerWidth + padding;
      display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;
      display.lineGutter.style.width = display.lineNumWidth + "px";
      updateGutterSpace(cm.display);
      return true
    }
    return false
  }

  function getGutters(gutters, lineNumbers) {
    var result = [], sawLineNumbers = false;
    for (var i = 0; i < gutters.length; i++) {
      var name = gutters[i], style = null;
      if (typeof name != "string") { style = name.style; name = name.className; }
      if (name == "CodeMirror-linenumbers") {
        if (!lineNumbers) { continue }
        else { sawLineNumbers = true; }
      }
      result.push({className: name, style: style});
    }
    if (lineNumbers && !sawLineNumbers) { result.push({className: "CodeMirror-linenumbers", style: null}); }
    return result
  }

  // Rebuild the gutter elements, ensure the margin to the left of the
  // code matches their width.
  function renderGutters(display) {
    var gutters = display.gutters, specs = display.gutterSpecs;
    removeChildren(gutters);
    display.lineGutter = null;
    for (var i = 0; i < specs.length; ++i) {
      var ref = specs[i];
      var className = ref.className;
      var style = ref.style;
      var gElt = gutters.appendChild(elt("div", null, "CodeMirror-gutter " + className));
      if (style) { gElt.style.cssText = style; }
      if (className == "CodeMirror-linenumbers") {
        display.lineGutter = gElt;
        gElt.style.width = (display.lineNumWidth || 1) + "px";
      }
    }
    gutters.style.display = specs.length ? "" : "none";
    updateGutterSpace(display);
  }

  function updateGutters(cm) {
    renderGutters(cm.display);
    regChange(cm);
    alignHorizontally(cm);
  }

  // The display handles the DOM integration, both for input reading
  // and content drawing. It holds references to DOM nodes and
  // display-related state.

  function Display(place, doc, input, options) {
    var d = this;
    this.input = input;

    // Covers bottom-right square when both scrollbars are present.
    d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler");
    d.scrollbarFiller.setAttribute("cm-not-content", "true");
    // Covers bottom of gutter when coverGutterNextToScrollbar is on
    // and h scrollbar is present.
    d.gutterFiller = elt("div", null, "CodeMirror-gutter-filler");
    d.gutterFiller.setAttribute("cm-not-content", "true");
    // Will contain the actual code, positioned to cover the viewport.
    d.lineDiv = eltP("div", null, "CodeMirror-code");
    // Elements are added to these to represent selection and cursors.
    d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1");
    d.cursorDiv = elt("div", null, "CodeMirror-cursors");
    // A visibility: hidden element used to find the size of things.
    d.measure = elt("div", null, "CodeMirror-measure");
    // When lines outside of the viewport are measured, they are drawn in this.
    d.lineMeasure = elt("div", null, "CodeMirror-measure");
    // Wraps everything that needs to exist inside the vertically-padded coordinate system
    d.lineSpace = eltP("div", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv],
                      null, "position: relative; outline: none");
    var lines = eltP("div", [d.lineSpace], "CodeMirror-lines");
    // Moved around its parent to cover visible view.
    d.mover = elt("div", [lines], null, "position: relative");
    // Set to the height of the document, allowing scrolling.
    d.sizer = elt("div", [d.mover], "CodeMirror-sizer");
    d.sizerWidth = null;
    // Behavior of elts with overflow: auto and padding is
    // inconsistent across browsers. This is used to ensure the
    // scrollable area is big enough.
    d.heightForcer = elt("div", null, null, "position: absolute; height: " + scrollerGap + "px; width: 1px;");
    // Will contain the gutters, if any.
    d.gutters = elt("div", null, "CodeMirror-gutters");
    d.lineGutter = null;
    // Actual scrollable element.
    d.scroller = elt("div", [d.sizer, d.heightForcer, d.gutters], "CodeMirror-scroll");
    d.scroller.setAttribute("tabIndex", "-1");
    // The element in which the editor lives.
    d.wrapper = elt("div", [d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror");

    // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported)
    if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; }
    if (!webkit && !(gecko && mobile)) { d.scroller.draggable = true; }

    if (place) {
      if (place.appendChild) { place.appendChild(d.wrapper); }
      else { place(d.wrapper); }
    }

    // Current rendered range (may be bigger than the view window).
    d.viewFrom = d.viewTo = doc.first;
    d.reportedViewFrom = d.reportedViewTo = doc.first;
    // Information about the rendered lines.
    d.view = [];
    d.renderedView = null;
    // Holds info about a single rendered line when it was rendered
    // for measurement, while not in view.
    d.externalMeasured = null;
    // Empty space (in pixels) above the view
    d.viewOffset = 0;
    d.lastWrapHeight = d.lastWrapWidth = 0;
    d.updateLineNumbers = null;

    d.nativeBarWidth = d.barHeight = d.barWidth = 0;
    d.scrollbarsClipped = false;

    // Used to only resize the line number gutter when necessary (when
    // the amount of lines crosses a boundary that makes its width change)
    d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null;
    // Set to true when a non-horizontal-scrolling line widget is
    // added. As an optimization, line widget aligning is skipped when
    // this is false.
    d.alignWidgets = false;

    d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;

    // Tracks the maximum line length so that the horizontal scrollbar
    // can be kept static when scrolling.
    d.maxLine = null;
    d.maxLineLength = 0;
    d.maxLineChanged = false;

    // Used for measuring wheel scrolling granularity
    d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null;

    // True when shift is held down.
    d.shift = false;

    // Used to track whether anything happened since the context menu
    // was opened.
    d.selForContextMenu = null;

    d.activeTouch = null;

    d.gutterSpecs = getGutters(options.gutters, options.lineNumbers);
    renderGutters(d);

    input.init(d);
  }

  // Since the delta values reported on mouse wheel events are
  // unstandardized between browsers and even browser versions, and
  // generally horribly unpredictable, this code starts by measuring
  // the scroll effect that the first few mouse wheel events have,
  // and, from that, detects the way it can convert deltas to pixel
  // offsets afterwards.
  //
  // The reason we want to know the amount a wheel event will scroll
  // is that it gives us a chance to update the display before the
  // actual scrolling happens, reducing flickering.

  var wheelSamples = 0, wheelPixelsPerUnit = null;
  // Fill in a browser-detected starting value on browsers where we
  // know one. These don't have to be accurate -- the result of them
  // being wrong would just be a slight flicker on the first wheel
  // scroll (if it is large enough).
  if (ie) { wheelPixelsPerUnit = -.53; }
  else if (gecko) { wheelPixelsPerUnit = 15; }
  else if (chrome) { wheelPixelsPerUnit = -.7; }
  else if (safari) { wheelPixelsPerUnit = -1/3; }

  function wheelEventDelta(e) {
    var dx = e.wheelDeltaX, dy = e.wheelDeltaY;
    if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) { dx = e.detail; }
    if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) { dy = e.detail; }
    else if (dy == null) { dy = e.wheelDelta; }
    return {x: dx, y: dy}
  }
  function wheelEventPixels(e) {
    var delta = wheelEventDelta(e);
    delta.x *= wheelPixelsPerUnit;
    delta.y *= wheelPixelsPerUnit;
    return delta
  }

  function onScrollWheel(cm, e) {
    var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y;

    var display = cm.display, scroll = display.scroller;
    // Quit if there's nothing to scroll here
    var canScrollX = scroll.scrollWidth > scroll.clientWidth;
    var canScrollY = scroll.scrollHeight > scroll.clientHeight;
    if (!(dx && canScrollX || dy && canScrollY)) { return }

    // Webkit browsers on OS X abort momentum scrolls when the target
    // of the scroll event is removed from the scrollable element.
    // This hack (see related code in patchDisplay) makes sure the
    // element is kept around.
    if (dy && mac && webkit) {
      outer: for (var cur = e.target, view = display.view; cur != scroll; cur = cur.parentNode) {
        for (var i = 0; i < view.length; i++) {
          if (view[i].node == cur) {
            cm.display.currentWheelTarget = cur;
            break outer
          }
        }
      }
    }

    // On some browsers, horizontal scrolling will cause redraws to
    // happen before the gutter has been realigned, causing it to
    // wriggle around in a most unseemly way. When we have an
    // estimated pixels/delta value, we just handle horizontal
    // scrolling entirely here. It'll be slightly off from native, but
    // better than glitching out.
    if (dx && !gecko && !presto && wheelPixelsPerUnit != null) {
      if (dy && canScrollY)
        { updateScrollTop(cm, Math.max(0, scroll.scrollTop + dy * wheelPixelsPerUnit)); }
      setScrollLeft(cm, Math.max(0, scroll.scrollLeft + dx * wheelPixelsPerUnit));
      // Only prevent default scrolling if vertical scrolling is
      // actually possible. Otherwise, it causes vertical scroll
      // jitter on OSX trackpads when deltaX is small and deltaY
      // is large (issue #3579)
      if (!dy || (dy && canScrollY))
        { e_preventDefault(e); }
      display.wheelStartX = null; // Abort measurement, if in progress
      return
    }

    // 'Project' the visible viewport to cover the area that is being
    // scrolled into view (if we know enough to estimate it).
    if (dy && wheelPixelsPerUnit != null) {
      var pixels = dy * wheelPixelsPerUnit;
      var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight;
      if (pixels < 0) { top = Math.max(0, top + pixels - 50); }
      else { bot = Math.min(cm.doc.height, bot + pixels + 50); }
      updateDisplaySimple(cm, {top: top, bottom: bot});
    }

    if (wheelSamples < 20) {
      if (display.wheelStartX == null) {
        display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop;
        display.wheelDX = dx; display.wheelDY = dy;
        setTimeout(function () {
          if (display.wheelStartX == null) { return }
          var movedX = scroll.scrollLeft - display.wheelStartX;
          var movedY = scroll.scrollTop - display.wheelStartY;
          var sample = (movedY && display.wheelDY && movedY / display.wheelDY) ||
            (movedX && display.wheelDX && movedX / display.wheelDX);
          display.wheelStartX = display.wheelStartY = null;
          if (!sample) { return }
          wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1);
          ++wheelSamples;
        }, 200);
      } else {
        display.wheelDX += dx; display.wheelDY += dy;
      }
    }
  }

  // Selection objects are immutable. A new one is created every time
  // the selection changes. A selection is one or more non-overlapping
  // (and non-touching) ranges, sorted, and an integer that indicates
  // which one is the primary selection (the one that's scrolled into
  // view, that getCursor returns, etc).
  var Selection = function(ranges, primIndex) {
    this.ranges = ranges;
    this.primIndex = primIndex;
  };

  Selection.prototype.primary = function () { return this.ranges[this.primIndex] };

  Selection.prototype.equals = function (other) {
    if (other == this) { return true }
    if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) { return false }
    for (var i = 0; i < this.ranges.length; i++) {
      var here = this.ranges[i], there = other.ranges[i];
      if (!equalCursorPos(here.anchor, there.anchor) || !equalCursorPos(here.head, there.head)) { return false }
    }
    return true
  };

  Selection.prototype.deepCopy = function () {
    var out = [];
    for (var i = 0; i < this.ranges.length; i++)
      { out[i] = new Range(copyPos(this.ranges[i].anchor), copyPos(this.ranges[i].head)); }
    return new Selection(out, this.primIndex)
  };

  Selection.prototype.somethingSelected = function () {
    for (var i = 0; i < this.ranges.length; i++)
      { if (!this.ranges[i].empty()) { return true } }
    return false
  };

  Selection.prototype.contains = function (pos, end) {
    if (!end) { end = pos; }
    for (var i = 0; i < this.ranges.length; i++) {
      var range = this.ranges[i];
      if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0)
        { return i }
    }
    return -1
  };

  var Range = function(anchor, head) {
    this.anchor = anchor; this.head = head;
  };

  Range.prototype.from = function () { return minPos(this.anchor, this.head) };
  Range.prototype.to = function () { return maxPos(this.anchor, this.head) };
  Range.prototype.empty = function () { return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch };

  // Take an unsorted, potentially overlapping set of ranges, and
  // build a selection out of it. 'Consumes' ranges array (modifying
  // it).
  function normalizeSelection(cm, ranges, primIndex) {
    var mayTouch = cm && cm.options.selectionsMayTouch;
    var prim = ranges[primIndex];
    ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });
    primIndex = indexOf(ranges, prim);
    for (var i = 1; i < ranges.length; i++) {
      var cur = ranges[i], prev = ranges[i - 1];
      var diff = cmp(prev.to(), cur.from());
      if (mayTouch && !cur.empty() ? diff > 0 : diff >= 0) {
        var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());
        var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;
        if (i <= primIndex) { --primIndex; }
        ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));
      }
    }
    return new Selection(ranges, primIndex)
  }

  function simpleSelection(anchor, head) {
    return new Selection([new Range(anchor, head || anchor)], 0)
  }

  // Compute the position of the end of a change (its 'to' property
  // refers to the pre-change end).
  function changeEnd(change) {
    if (!change.text) { return change.to }
    return Pos(change.from.line + change.text.length - 1,
               lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))
  }

  // Adjust a position to refer to the post-change position of the
  // same text, or the end of the change if the change covers it.
  function adjustForChange(pos, change) {
    if (cmp(pos, change.from) < 0) { return pos }
    if (cmp(pos, change.to) <= 0) { return changeEnd(change) }

    var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;
    if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }
    return Pos(line, ch)
  }

  function computeSelAfterChange(doc, change) {
    var out = [];
    for (var i = 0; i < doc.sel.ranges.length; i++) {
      var range = doc.sel.ranges[i];
      out.push(new Range(adjustForChange(range.anchor, change),
                         adjustForChange(range.head, change)));
    }
    return normalizeSelection(doc.cm, out, doc.sel.primIndex)
  }

  function offsetPos(pos, old, nw) {
    if (pos.line == old.line)
      { return Pos(nw.line, pos.ch - old.ch + nw.ch) }
    else
      { return Pos(nw.line + (pos.line - old.line), pos.ch) }
  }

  // Used by replaceSelections to allow moving the selection to the
  // start or around the replaced test. Hint may be "start" or "around".
  function computeReplacedSel(doc, changes, hint) {
    var out = [];
    var oldPrev = Pos(doc.first, 0), newPrev = oldPrev;
    for (var i = 0; i < changes.length; i++) {
      var change = changes[i];
      var from = offsetPos(change.from, oldPrev, newPrev);
      var to = offsetPos(changeEnd(change), oldPrev, newPrev);
      oldPrev = change.to;
      newPrev = to;
      if (hint == "around") {
        var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0;
        out[i] = new Range(inv ? to : from, inv ? from : to);
      } else {
        out[i] = new Range(from, from);
      }
    }
    return new Selection(out, doc.sel.primIndex)
  }

  // Used to get the editor into a consistent state again when options change.

  function loadMode(cm) {
    cm.doc.mode = getMode(cm.options, cm.doc.modeOption);
    resetModeState(cm);
  }

  function resetModeState(cm) {
    cm.doc.iter(function (line) {
      if (line.stateAfter) { line.stateAfter = null; }
      if (line.styles) { line.styles = null; }
    });
    cm.doc.modeFrontier = cm.doc.highlightFrontier = cm.doc.first;
    startWorker(cm, 100);
    cm.state.modeGen++;
    if (cm.curOp) { regChange(cm); }
  }

  // DOCUMENT DATA STRUCTURE

  // By default, updates that start and end at the beginning of a line
  // are treated specially, in order to make the association of line
  // widgets and marker elements with the text behave more intuitive.
  function isWholeLineUpdate(doc, change) {
    return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == "" &&
      (!doc.cm || doc.cm.options.wholeLineUpdateBefore)
  }

  // Perform a change on the document data structure.
  function updateDoc(doc, change, markedSpans, estimateHeight) {
    function spansFor(n) {return markedSpans ? markedSpans[n] : null}
    function update(line, text, spans) {
      updateLine(line, text, spans, estimateHeight);
      signalLater(line, "change", line, change);
    }
    function linesFor(start, end) {
      var result = [];
      for (var i = start; i < end; ++i)
        { result.push(new Line(text[i], spansFor(i), estimateHeight)); }
      return result
    }

    var from = change.from, to = change.to, text = change.text;
    var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);
    var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;

    // Adjust the line structure
    if (change.full) {
      doc.insert(0, linesFor(0, text.length));
      doc.remove(text.length, doc.size - text.length);
    } else if (isWholeLineUpdate(doc, change)) {
      // This is a whole-line replace. Treated specially to make
      // sure line objects move the way they are supposed to.
      var added = linesFor(0, text.length - 1);
      update(lastLine, lastLine.text, lastSpans);
      if (nlines) { doc.remove(from.line, nlines); }
      if (added.length) { doc.insert(from.line, added); }
    } else if (firstLine == lastLine) {
      if (text.length == 1) {
        update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);
      } else {
        var added$1 = linesFor(1, text.length - 1);
        added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));
        update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));
        doc.insert(from.line + 1, added$1);
      }
    } else if (text.length == 1) {
      update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));
      doc.remove(from.line + 1, nlines);
    } else {
      update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));
      update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);
      var added$2 = linesFor(1, text.length - 1);
      if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }
      doc.insert(from.line + 1, added$2);
    }

    signalLater(doc, "change", doc, change);
  }

  // Call f for all linked documents.
  function linkedDocs(doc, f, sharedHistOnly) {
    function propagate(doc, skip, sharedHist) {
      if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) {
        var rel = doc.linked[i];
        if (rel.doc == skip) { continue }
        var shared = sharedHist && rel.sharedHist;
        if (sharedHistOnly && !shared) { continue }
        f(rel.doc, shared);
        propagate(rel.doc, doc, shared);
      } }
    }
    propagate(doc, null, true);
  }

  // Attach a document to an editor.
  function attachDoc(cm, doc) {
    if (doc.cm) { throw new Error("This document is already in use.") }
    cm.doc = doc;
    doc.cm = cm;
    estimateLineHeights(cm);
    loadMode(cm);
    setDirectionClass(cm);
    cm.options.direction = doc.direction;
    if (!cm.options.lineWrapping) { findMaxLine(cm); }
    cm.options.mode = doc.modeOption;
    regChange(cm);
  }

  function setDirectionClass(cm) {
  (cm.doc.direction == "rtl" ? addClass : rmClass)(cm.display.lineDiv, "CodeMirror-rtl");
  }

  function directionChanged(cm) {
    runInOp(cm, function () {
      setDirectionClass(cm);
      regChange(cm);
    });
  }

  function History(prev) {
    // Arrays of change events and selections. Doing something adds an
    // event to done and clears undo. Undoing moves events from done
    // to undone, redoing moves them in the other direction.
    this.done = []; this.undone = [];
    this.undoDepth = prev ? prev.undoDepth : Infinity;
    // Used to track when changes can be merged into a single undo
    // event
    this.lastModTime = this.lastSelTime = 0;
    this.lastOp = this.lastSelOp = null;
    this.lastOrigin = this.lastSelOrigin = null;
    // Used by the isClean() method
    this.generation = this.maxGeneration = prev ? prev.maxGeneration : 1;
  }

  // Create a history change event from an updateDoc-style change
  // object.
  function historyChangeFromChange(doc, change) {
    var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};
    attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);
    linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);
    return histChange
  }

  // Pop all selection events off the end of a history array. Stop at
  // a change event.
  function clearSelectionEvents(array) {
    while (array.length) {
      var last = lst(array);
      if (last.ranges) { array.pop(); }
      else { break }
    }
  }

  // Find the top change event in the history. Pop off selection
  // events that are in the way.
  function lastChangeEvent(hist, force) {
    if (force) {
      clearSelectionEvents(hist.done);
      return lst(hist.done)
    } else if (hist.done.length && !lst(hist.done).ranges) {
      return lst(hist.done)
    } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {
      hist.done.pop();
      return lst(hist.done)
    }
  }

  // Register a change in the history. Merges changes that are within
  // a single operation, or are close together with an origin that
  // allows merging (starting with "+") into a single event.
  function addChangeToHistory(doc, change, selAfter, opId) {
    var hist = doc.history;
    hist.undone.length = 0;
    var time = +new Date, cur;
    var last;

    if ((hist.lastOp == opId ||
         hist.lastOrigin == change.origin && change.origin &&
         ((change.origin.charAt(0) == "+" && hist.lastModTime > time - (doc.cm ? doc.cm.options.historyEventDelay : 500)) ||
          change.origin.charAt(0) == "*")) &&
        (cur = lastChangeEvent(hist, hist.lastOp == opId))) {
      // Merge this change into the last event
      last = lst(cur.changes);
      if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {
        // Optimized case for simple insertion -- don't want to add
        // new changesets for every character typed
        last.to = changeEnd(change);
      } else {
        // Add new sub-event
        cur.changes.push(historyChangeFromChange(doc, change));
      }
    } else {
      // Can not be merged, start a new event.
      var before = lst(hist.done);
      if (!before || !before.ranges)
        { pushSelectionToHistory(doc.sel, hist.done); }
      cur = {changes: [historyChangeFromChange(doc, change)],
             generation: hist.generation};
      hist.done.push(cur);
      while (hist.done.length > hist.undoDepth) {
        hist.done.shift();
        if (!hist.done[0].ranges) { hist.done.shift(); }
      }
    }
    hist.done.push(selAfter);
    hist.generation = ++hist.maxGeneration;
    hist.lastModTime = hist.lastSelTime = time;
    hist.lastOp = hist.lastSelOp = opId;
    hist.lastOrigin = hist.lastSelOrigin = change.origin;

    if (!last) { signal(doc, "historyAdded"); }
  }

  function selectionEventCanBeMerged(doc, origin, prev, sel) {
    var ch = origin.charAt(0);
    return ch == "*" ||
      ch == "+" &&
      prev.ranges.length == sel.ranges.length &&
      prev.somethingSelected() == sel.somethingSelected() &&
      new Date - doc.history.lastSelTime <= (doc.cm ? doc.cm.options.historyEventDelay : 500)
  }

  // Called whenever the selection changes, sets the new selection as
  // the pending selection in the history, and pushes the old pending
  // selection into the 'done' array when it was significantly
  // different (in number of selected ranges, emptiness, or time).
  function addSelectionToHistory(doc, sel, opId, options) {
    var hist = doc.history, origin = options && options.origin;

    // A new event is started when the previous origin does not match
    // the current, or the origins don't allow matching. Origins
    // starting with * are always merged, those starting with + are
    // merged when similar and close together in time.
    if (opId == hist.lastSelOp ||
        (origin && hist.lastSelOrigin == origin &&
         (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||
          selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))
      { hist.done[hist.done.length - 1] = sel; }
    else
      { pushSelectionToHistory(sel, hist.done); }

    hist.lastSelTime = +new Date;
    hist.lastSelOrigin = origin;
    hist.lastSelOp = opId;
    if (options && options.clearRedo !== false)
      { clearSelectionEvents(hist.undone); }
  }

  function pushSelectionToHistory(sel, dest) {
    var top = lst(dest);
    if (!(top && top.ranges && top.equals(sel)))
      { dest.push(sel); }
  }

  // Used to store marked span information in the history.
  function attachLocalSpans(doc, change, from, to) {
    var existing = change["spans_" + doc.id], n = 0;
    doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {
      if (line.markedSpans)
        { (existing || (existing = change["spans_" + doc.id] = {}))[n] = line.markedSpans; }
      ++n;
    });
  }

  // When un/re-doing restores text containing marked spans, those
  // that have been explicitly cleared should not be restored.
  function removeClearedSpans(spans) {
    if (!spans) { return null }
    var out;
    for (var i = 0; i < spans.length; ++i) {
      if (spans[i].marker.explicitlyCleared) { if (!out) { out = spans.slice(0, i); } }
      else if (out) { out.push(spans[i]); }
    }
    return !out ? spans : out.length ? out : null
  }

  // Retrieve and filter the old marked spans stored in a change event.
  function getOldSpans(doc, change) {
    var found = change["spans_" + doc.id];
    if (!found) { return null }
    var nw = [];
    for (var i = 0; i < change.text.length; ++i)
      { nw.push(removeClearedSpans(found[i])); }
    return nw
  }

  // Used for un/re-doing changes from the history. Combines the
  // result of computing the existing spans with the set of spans that
  // existed in the history (so that deleting around a span and then
  // undoing brings back the span).
  function mergeOldSpans(doc, change) {
    var old = getOldSpans(doc, change);
    var stretched = stretchSpansOverChange(doc, change);
    if (!old) { return stretched }
    if (!stretched) { return old }

    for (var i = 0; i < old.length; ++i) {
      var oldCur = old[i], stretchCur = stretched[i];
      if (oldCur && stretchCur) {
        spans: for (var j = 0; j < stretchCur.length; ++j) {
          var span = stretchCur[j];
          for (var k = 0; k < oldCur.length; ++k)
            { if (oldCur[k].marker == span.marker) { continue spans } }
          oldCur.push(span);
        }
      } else if (stretchCur) {
        old[i] = stretchCur;
      }
    }
    return old
  }

  // Used both to provide a JSON-safe object in .getHistory, and, when
  // detaching a document, to split the history in two
  function copyHistoryArray(events, newGroup, instantiateSel) {
    var copy = [];
    for (var i = 0; i < events.length; ++i) {
      var event = events[i];
      if (event.ranges) {
        copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);
        continue
      }
      var changes = event.changes, newChanges = [];
      copy.push({changes: newChanges});
      for (var j = 0; j < changes.length; ++j) {
        var change = changes[j], m = (void 0);
        newChanges.push({from: change.from, to: change.to, text: change.text});
        if (newGroup) { for (var prop in change) { if (m = prop.match(/^spans_(\d+)$/)) {
          if (indexOf(newGroup, Number(m[1])) > -1) {
            lst(newChanges)[prop] = change[prop];
            delete change[prop];
          }
        } } }
      }
    }
    return copy
  }

  // The 'scroll' parameter given to many of these indicated whether
  // the new cursor position should be scrolled into view after
  // modifying the selection.

  // If shift is held or the extend flag is set, extends a range to
  // include a given position (and optionally a second position).
  // Otherwise, simply returns the range between the given positions.
  // Used for cursor motion and such.
  function extendRange(range, head, other, extend) {
    if (extend) {
      var anchor = range.anchor;
      if (other) {
        var posBefore = cmp(head, anchor) < 0;
        if (posBefore != (cmp(other, anchor) < 0)) {
          anchor = head;
          head = other;
        } else if (posBefore != (cmp(head, other) < 0)) {
          head = other;
        }
      }
      return new Range(anchor, head)
    } else {
      return new Range(other || head, head)
    }
  }

  // Extend the primary selection range, discard the rest.
  function extendSelection(doc, head, other, options, extend) {
    if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }
    setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);
  }

  // Extend all selections (pos is an array of selections with length
  // equal the number of selections)
  function extendSelections(doc, heads, options) {
    var out = [];
    var extend = doc.cm && (doc.cm.display.shift || doc.extend);
    for (var i = 0; i < doc.sel.ranges.length; i++)
      { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }
    var newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex);
    setSelection(doc, newSel, options);
  }

  // Updates a single range in the selection.
  function replaceOneSelection(doc, i, range, options) {
    var ranges = doc.sel.ranges.slice(0);
    ranges[i] = range;
    setSelection(doc, normalizeSelection(doc.cm, ranges, doc.sel.primIndex), options);
  }

  // Reset the selection to a single range.
  function setSimpleSelection(doc, anchor, head, options) {
    setSelection(doc, simpleSelection(anchor, head), options);
  }

  // Give beforeSelectionChange handlers a change to influence a
  // selection update.
  function filterSelectionChange(doc, sel, options) {
    var obj = {
      ranges: sel.ranges,
      update: function(ranges) {
        this.ranges = [];
        for (var i = 0; i < ranges.length; i++)
          { this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),
                                     clipPos(doc, ranges[i].head)); }
      },
      origin: options && options.origin
    };
    signal(doc, "beforeSelectionChange", doc, obj);
    if (doc.cm) { signal(doc.cm, "beforeSelectionChange", doc.cm, obj); }
    if (obj.ranges != sel.ranges) { return normalizeSelection(doc.cm, obj.ranges, obj.ranges.length - 1) }
    else { return sel }
  }

  function setSelectionReplaceHistory(doc, sel, options) {
    var done = doc.history.done, last = lst(done);
    if (last && last.ranges) {
      done[done.length - 1] = sel;
      setSelectionNoUndo(doc, sel, options);
    } else {
      setSelection(doc, sel, options);
    }
  }

  // Set a new selection.
  function setSelection(doc, sel, options) {
    setSelectionNoUndo(doc, sel, options);
    addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);
  }

  function setSelectionNoUndo(doc, sel, options) {
    if (hasHandler(doc, "beforeSelectionChange") || doc.cm && hasHandler(doc.cm, "beforeSelectionChange"))
      { sel = filterSelectionChange(doc, sel, options); }

    var bias = options && options.bias ||
      (cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1);
    setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true));

    if (!(options && options.scroll === false) && doc.cm && doc.cm.getOption("readOnly") != "nocursor")
      { ensureCursorVisible(doc.cm); }
  }

  function setSelectionInner(doc, sel) {
    if (sel.equals(doc.sel)) { return }

    doc.sel = sel;

    if (doc.cm) {
      doc.cm.curOp.updateInput = 1;
      doc.cm.curOp.selectionChanged = true;
      signalCursorActivity(doc.cm);
    }
    signalLater(doc, "cursorActivity", doc);
  }

  // Verify that the selection does not partially select any atomic
  // marked ranges.
  function reCheckSelection(doc) {
    setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false));
  }

  // Return a selection that does not partially select any atomic
  // ranges.
  function skipAtomicInSelection(doc, sel, bias, mayClear) {
    var out;
    for (var i = 0; i < sel.ranges.length; i++) {
      var range = sel.ranges[i];
      var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];
      var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);
      var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);
      if (out || newAnchor != range.anchor || newHead != range.head) {
        if (!out) { out = sel.ranges.slice(0, i); }
        out[i] = new Range(newAnchor, newHead);
      }
    }
    return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel
  }

  function skipAtomicInner(doc, pos, oldPos, dir, mayClear) {
    var line = getLine(doc, pos.line);
    if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {
      var sp = line.markedSpans[i], m = sp.marker;

      // Determine if we should prevent the cursor being placed to the left/right of an atomic marker
      // Historically this was determined using the inclusiveLeft/Right option, but the new way to control it
      // is with selectLeft/Right
      var preventCursorLeft = ("selectLeft" in m) ? !m.selectLeft : m.inclusiveLeft;
      var preventCursorRight = ("selectRight" in m) ? !m.selectRight : m.inclusiveRight;

      if ((sp.from == null || (preventCursorLeft ? sp.from <= pos.ch : sp.from < pos.ch)) &&
          (sp.to == null || (preventCursorRight ? sp.to >= pos.ch : sp.to > pos.ch))) {
        if (mayClear) {
          signal(m, "beforeCursorEnter");
          if (m.explicitlyCleared) {
            if (!line.markedSpans) { break }
            else {--i; continue}
          }
        }
        if (!m.atomic) { continue }

        if (oldPos) {
          var near = m.find(dir < 0 ? 1 : -1), diff = (void 0);
          if (dir < 0 ? preventCursorRight : preventCursorLeft)
            { near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null); }
          if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0))
            { return skipAtomicInner(doc, near, pos, dir, mayClear) }
        }

        var far = m.find(dir < 0 ? -1 : 1);
        if (dir < 0 ? preventCursorLeft : preventCursorRight)
          { far = movePos(doc, far, dir, far.line == pos.line ? line : null); }
        return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null
      }
    } }
    return pos
  }

  // Ensure a given position is not inside an atomic range.
  function skipAtomic(doc, pos, oldPos, bias, mayClear) {
    var dir = bias || 1;
    var found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) ||
        (!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) ||
        skipAtomicInner(doc, pos, oldPos, -dir, mayClear) ||
        (!mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true));
    if (!found) {
      doc.cantEdit = true;
      return Pos(doc.first, 0)
    }
    return found
  }

  function movePos(doc, pos, dir, line) {
    if (dir < 0 && pos.ch == 0) {
      if (pos.line > doc.first) { return clipPos(doc, Pos(pos.line - 1)) }
      else { return null }
    } else if (dir > 0 && pos.ch == (line || getLine(doc, pos.line)).text.length) {
      if (pos.line < doc.first + doc.size - 1) { return Pos(pos.line + 1, 0) }
      else { return null }
    } else {
      return new Pos(pos.line, pos.ch + dir)
    }
  }

  function selectAll(cm) {
    cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll);
  }

  // UPDATING

  // Allow "beforeChange" event handlers to influence a change
  function filterChange(doc, change, update) {
    var obj = {
      canceled: false,
      from: change.from,
      to: change.to,
      text: change.text,
      origin: change.origin,
      cancel: function () { return obj.canceled = true; }
    };
    if (update) { obj.update = function (from, to, text, origin) {
      if (from) { obj.from = clipPos(doc, from); }
      if (to) { obj.to = clipPos(doc, to); }
      if (text) { obj.text = text; }
      if (origin !== undefined) { obj.origin = origin; }
    }; }
    signal(doc, "beforeChange", doc, obj);
    if (doc.cm) { signal(doc.cm, "beforeChange", doc.cm, obj); }

    if (obj.canceled) {
      if (doc.cm) { doc.cm.curOp.updateInput = 2; }
      return null
    }
    return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}
  }

  // Apply a change to a document, and add it to the document's
  // history, and propagating it to all linked documents.
  function makeChange(doc, change, ignoreReadOnly) {
    if (doc.cm) {
      if (!doc.cm.curOp) { return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly) }
      if (doc.cm.state.suppressEdits) { return }
    }

    if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) {
      change = filterChange(doc, change, true);
      if (!change) { return }
    }

    // Possibly split or suppress the update based on the presence
    // of read-only spans in its range.
    var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);
    if (split) {
      for (var i = split.length - 1; i >= 0; --i)
        { makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [""] : change.text, origin: change.origin}); }
    } else {
      makeChangeInner(doc, change);
    }
  }

  function makeChangeInner(doc, change) {
    if (change.text.length == 1 && change.text[0] == "" && cmp(change.from, change.to) == 0) { return }
    var selAfter = computeSelAfterChange(doc, change);
    addChangeToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN);

    makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change));
    var rebased = [];

    linkedDocs(doc, function (doc, sharedHist) {
      if (!sharedHist && indexOf(rebased, doc.history) == -1) {
        rebaseHist(doc.history, change);
        rebased.push(doc.history);
      }
      makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change));
    });
  }

  // Revert a change stored in a document's history.
  function makeChangeFromHistory(doc, type, allowSelectionOnly) {
    var suppress = doc.cm && doc.cm.state.suppressEdits;
    if (suppress && !allowSelectionOnly) { return }

    var hist = doc.history, event, selAfter = doc.sel;
    var source = type == "undo" ? hist.done : hist.undone, dest = type == "undo" ? hist.undone : hist.done;

    // Verify that there is a useable event (so that ctrl-z won't
    // needlessly clear selection events)
    var i = 0;
    for (; i < source.length; i++) {
      event = source[i];
      if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges)
        { break }
    }
    if (i == source.length) { return }
    hist.lastOrigin = hist.lastSelOrigin = null;

    for (;;) {
      event = source.pop();
      if (event.ranges) {
        pushSelectionToHistory(event, dest);
        if (allowSelectionOnly && !event.equals(doc.sel)) {
          setSelection(doc, event, {clearRedo: false});
          return
        }
        selAfter = event;
      } else if (suppress) {
        source.push(event);
        return
      } else { break }
    }

    // Build up a reverse change object to add to the opposite history
    // stack (redo when undoing, and vice versa).
    var antiChanges = [];
    pushSelectionToHistory(selAfter, dest);
    dest.push({changes: antiChanges, generation: hist.generation});
    hist.generation = event.generation || ++hist.maxGeneration;

    var filter = hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange");

    var loop = function ( i ) {
      var change = event.changes[i];
      change.origin = type;
      if (filter && !filterChange(doc, change, false)) {
        source.length = 0;
        return {}
      }

      antiChanges.push(historyChangeFromChange(doc, change));

      var after = i ? computeSelAfterChange(doc, change) : lst(source);
      makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change));
      if (!i && doc.cm) { doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)}); }
      var rebased = [];

      // Propagate to the linked documents
      linkedDocs(doc, function (doc, sharedHist) {
        if (!sharedHist && indexOf(rebased, doc.history) == -1) {
          rebaseHist(doc.history, change);
          rebased.push(doc.history);
        }
        makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change));
      });
    };

    for (var i$1 = event.changes.length - 1; i$1 >= 0; --i$1) {
      var returned = loop( i$1 );

      if ( returned ) return returned.v;
    }
  }

  // Sub-views need their line numbers shifted when text is added
  // above or below them in the parent document.
  function shiftDoc(doc, distance) {
    if (distance == 0) { return }
    doc.first += distance;
    doc.sel = new Selection(map(doc.sel.ranges, function (range) { return new Range(
      Pos(range.anchor.line + distance, range.anchor.ch),
      Pos(range.head.line + distance, range.head.ch)
    ); }), doc.sel.primIndex);
    if (doc.cm) {
      regChange(doc.cm, doc.first, doc.first - distance, distance);
      for (var d = doc.cm.display, l = d.viewFrom; l < d.viewTo; l++)
        { regLineChange(doc.cm, l, "gutter"); }
    }
  }

  // More lower-level change function, handling only a single document
  // (not linked ones).
  function makeChangeSingleDoc(doc, change, selAfter, spans) {
    if (doc.cm && !doc.cm.curOp)
      { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }

    if (change.to.line < doc.first) {
      shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));
      return
    }
    if (change.from.line > doc.lastLine()) { return }

    // Clip the change to the size of this doc
    if (change.from.line < doc.first) {
      var shift = change.text.length - 1 - (doc.first - change.from.line);
      shiftDoc(doc, shift);
      change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),
                text: [lst(change.text)], origin: change.origin};
    }
    var last = doc.lastLine();
    if (change.to.line > last) {
      change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),
                text: [change.text[0]], origin: change.origin};
    }

    change.removed = getBetween(doc, change.from, change.to);

    if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }
    if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }
    else { updateDoc(doc, change, spans); }
    setSelectionNoUndo(doc, selAfter, sel_dontScroll);

    if (doc.cantEdit && skipAtomic(doc, Pos(doc.firstLine(), 0)))
      { doc.cantEdit = false; }
  }

  // Handle the interaction of a change to a document with the editor
  // that this document is part of.
  function makeChangeSingleDocInEditor(cm, change, spans) {
    var doc = cm.doc, display = cm.display, from = change.from, to = change.to;

    var recomputeMaxLength = false, checkWidthStart = from.line;
    if (!cm.options.lineWrapping) {
      checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));
      doc.iter(checkWidthStart, to.line + 1, function (line) {
        if (line == display.maxLine) {
          recomputeMaxLength = true;
          return true
        }
      });
    }

    if (doc.sel.contains(change.from, change.to) > -1)
      { signalCursorActivity(cm); }

    updateDoc(doc, change, spans, estimateHeight(cm));

    if (!cm.options.lineWrapping) {
      doc.iter(checkWidthStart, from.line + change.text.length, function (line) {
        var len = lineLength(line);
        if (len > display.maxLineLength) {
          display.maxLine = line;
          display.maxLineLength = len;
          display.maxLineChanged = true;
          recomputeMaxLength = false;
        }
      });
      if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }
    }

    retreatFrontier(doc, from.line);
    startWorker(cm, 400);

    var lendiff = change.text.length - (to.line - from.line) - 1;
    // Remember that these lines changed, for updating the display
    if (change.full)
      { regChange(cm); }
    else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))
      { regLineChange(cm, from.line, "text"); }
    else
      { regChange(cm, from.line, to.line + 1, lendiff); }

    var changesHandler = hasHandler(cm, "changes"), changeHandler = hasHandler(cm, "change");
    if (changeHandler || changesHandler) {
      var obj = {
        from: from, to: to,
        text: change.text,
        removed: change.removed,
        origin: change.origin
      };
      if (changeHandler) { signalLater(cm, "change", cm, obj); }
      if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }
    }
    cm.display.selForContextMenu = null;
  }

  function replaceRange(doc, code, from, to, origin) {
    var assign;

    if (!to) { to = from; }
    if (cmp(to, from) < 0) { (assign = [to, from], from = assign[0], to = assign[1]); }
    if (typeof code == "string") { code = doc.splitLines(code); }
    makeChange(doc, {from: from, to: to, text: code, origin: origin});
  }

  // Rebasing/resetting history to deal with externally-sourced changes

  function rebaseHistSelSingle(pos, from, to, diff) {
    if (to < pos.line) {
      pos.line += diff;
    } else if (from < pos.line) {
      pos.line = from;
      pos.ch = 0;
    }
  }

  // Tries to rebase an array of history events given a change in the
  // document. If the change touches the same lines as the event, the
  // event, and everything 'behind' it, is discarded. If the change is
  // before the event, the event's positions are updated. Uses a
  // copy-on-write scheme for the positions, to avoid having to
  // reallocate them all on every rebase, but also avoid problems with
  // shared position objects being unsafely updated.
  function rebaseHistArray(array, from, to, diff) {
    for (var i = 0; i < array.length; ++i) {
      var sub = array[i], ok = true;
      if (sub.ranges) {
        if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }
        for (var j = 0; j < sub.ranges.length; j++) {
          rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);
          rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);
        }
        continue
      }
      for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) {
        var cur = sub.changes[j$1];
        if (to < cur.from.line) {
          cur.from = Pos(cur.from.line + diff, cur.from.ch);
          cur.to = Pos(cur.to.line + diff, cur.to.ch);
        } else if (from <= cur.to.line) {
          ok = false;
          break
        }
      }
      if (!ok) {
        array.splice(0, i + 1);
        i = 0;
      }
    }
  }

  function rebaseHist(hist, change) {
    var from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1;
    rebaseHistArray(hist.done, from, to, diff);
    rebaseHistArray(hist.undone, from, to, diff);
  }

  // Utility for applying a change to a line by handle or number,
  // returning the number and optionally registering the line as
  // changed.
  function changeLine(doc, handle, changeType, op) {
    var no = handle, line = handle;
    if (typeof handle == "number") { line = getLine(doc, clipLine(doc, handle)); }
    else { no = lineNo(handle); }
    if (no == null) { return null }
    if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }
    return line
  }

  // The document is represented as a BTree consisting of leaves, with
  // chunk of lines in them, and branches, with up to ten leaves or
  // other branch nodes below them. The top node is always a branch
  // node, and is the document object itself (meaning it has
  // additional methods and properties).
  //
  // All nodes have parent links. The tree is used both to go from
  // line numbers to line objects, and to go from objects to numbers.
  // It also indexes by height, and is used to convert between height
  // and line object, and to find the total height of the document.
  //
  // See also http://marijnhaverbeke.nl/blog/codemirror-line-tree.html

  function LeafChunk(lines) {
    this.lines = lines;
    this.parent = null;
    var height = 0;
    for (var i = 0; i < lines.length; ++i) {
      lines[i].parent = this;
      height += lines[i].height;
    }
    this.height = height;
  }

  LeafChunk.prototype = {
    chunkSize: function() { return this.lines.length },

    // Remove the n lines at offset 'at'.
    removeInner: function(at, n) {
      for (var i = at, e = at + n; i < e; ++i) {
        var line = this.lines[i];
        this.height -= line.height;
        cleanUpLine(line);
        signalLater(line, "delete");
      }
      this.lines.splice(at, n);
    },

    // Helper used to collapse a small branch into a single leaf.
    collapse: function(lines) {
      lines.push.apply(lines, this.lines);
    },

    // Insert the given array of lines at offset 'at', count them as
    // having the given height.
    insertInner: function(at, lines, height) {
      this.height += height;
      this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at));
      for (var i = 0; i < lines.length; ++i) { lines[i].parent = this; }
    },

    // Used to iterate over a part of the tree.
    iterN: function(at, n, op) {
      for (var e = at + n; at < e; ++at)
        { if (op(this.lines[at])) { return true } }
    }
  };

  function BranchChunk(children) {
    this.children = children;
    var size = 0, height = 0;
    for (var i = 0; i < children.length; ++i) {
      var ch = children[i];
      size += ch.chunkSize(); height += ch.height;
      ch.parent = this;
    }
    this.size = size;
    this.height = height;
    this.parent = null;
  }

  BranchChunk.prototype = {
    chunkSize: function() { return this.size },

    removeInner: function(at, n) {
      this.size -= n;
      for (var i = 0; i < this.children.length; ++i) {
        var child = this.children[i], sz = child.chunkSize();
        if (at < sz) {
          var rm = Math.min(n, sz - at), oldHeight = child.height;
          child.removeInner(at, rm);
          this.height -= oldHeight - child.height;
          if (sz == rm) { this.children.splice(i--, 1); child.parent = null; }
          if ((n -= rm) == 0) { break }
          at = 0;
        } else { at -= sz; }
      }
      // If the result is smaller than 25 lines, ensure that it is a
      // single leaf node.
      if (this.size - n < 25 &&
          (this.children.length > 1 || !(this.children[0] instanceof LeafChunk))) {
        var lines = [];
        this.collapse(lines);
        this.children = [new LeafChunk(lines)];
        this.children[0].parent = this;
      }
    },

    collapse: function(lines) {
      for (var i = 0; i < this.children.length; ++i) { this.children[i].collapse(lines); }
    },

    insertInner: function(at, lines, height) {
      this.size += lines.length;
      this.height += height;
      for (var i = 0; i < this.children.length; ++i) {
        var child = this.children[i], sz = child.chunkSize();
        if (at <= sz) {
          child.insertInner(at, lines, height);
          if (child.lines && child.lines.length > 50) {
            // To avoid memory thrashing when child.lines is huge (e.g. first view of a large file), it's never spliced.
            // Instead, small slices are taken. They're taken in order because sequential memory accesses are fastest.
            var remaining = child.lines.length % 25 + 25;
            for (var pos = remaining; pos < child.lines.length;) {
              var leaf = new LeafChunk(child.lines.slice(pos, pos += 25));
              child.height -= leaf.height;
              this.children.splice(++i, 0, leaf);
              leaf.parent = this;
            }
            child.lines = child.lines.slice(0, remaining);
            this.maybeSpill();
          }
          break
        }
        at -= sz;
      }
    },

    // When a node has grown, check whether it should be split.
    maybeSpill: function() {
      if (this.children.length <= 10) { return }
      var me = this;
      do {
        var spilled = me.children.splice(me.children.length - 5, 5);
        var sibling = new BranchChunk(spilled);
        if (!me.parent) { // Become the parent node
          var copy = new BranchChunk(me.children);
          copy.parent = me;
          me.children = [copy, sibling];
          me = copy;
       } else {
          me.size -= sibling.size;
          me.height -= sibling.height;
          var myIndex = indexOf(me.parent.children, me);
          me.parent.children.splice(myIndex + 1, 0, sibling);
        }
        sibling.parent = me.parent;
      } while (me.children.length > 10)
      me.parent.maybeSpill();
    },

    iterN: function(at, n, op) {
      for (var i = 0; i < this.children.length; ++i) {
        var child = this.children[i], sz = child.chunkSize();
        if (at < sz) {
          var used = Math.min(n, sz - at);
          if (child.iterN(at, used, op)) { return true }
          if ((n -= used) == 0) { break }
          at = 0;
        } else { at -= sz; }
      }
    }
  };

  // Line widgets are block elements displayed above or below a line.

  var LineWidget = function(doc, node, options) {
    if (options) { for (var opt in options) { if (options.hasOwnProperty(opt))
      { this[opt] = options[opt]; } } }
    this.doc = doc;
    this.node = node;
  };

  LineWidget.prototype.clear = function () {
    var cm = this.doc.cm, ws = this.line.widgets, line = this.line, no = lineNo(line);
    if (no == null || !ws) { return }
    for (var i = 0; i < ws.length; ++i) { if (ws[i] == this) { ws.splice(i--, 1); } }
    if (!ws.length) { line.widgets = null; }
    var height = widgetHeight(this);
    updateLineHeight(line, Math.max(0, line.height - height));
    if (cm) {
      runInOp(cm, function () {
        adjustScrollWhenAboveVisible(cm, line, -height);
        regLineChange(cm, no, "widget");
      });
      signalLater(cm, "lineWidgetCleared", cm, this, no);
    }
  };

  LineWidget.prototype.changed = function () {
      var this$1 = this;

    var oldH = this.height, cm = this.doc.cm, line = this.line;
    this.height = null;
    var diff = widgetHeight(this) - oldH;
    if (!diff) { return }
    if (!lineIsHidden(this.doc, line)) { updateLineHeight(line, line.height + diff); }
    if (cm) {
      runInOp(cm, function () {
        cm.curOp.forceUpdate = true;
        adjustScrollWhenAboveVisible(cm, line, diff);
        signalLater(cm, "lineWidgetChanged", cm, this$1, lineNo(line));
      });
    }
  };
  eventMixin(LineWidget);

  function adjustScrollWhenAboveVisible(cm, line, diff) {
    if (heightAtLine(line) < ((cm.curOp && cm.curOp.scrollTop) || cm.doc.scrollTop))
      { addToScrollTop(cm, diff); }
  }

  function addLineWidget(doc, handle, node, options) {
    var widget = new LineWidget(doc, node, options);
    var cm = doc.cm;
    if (cm && widget.noHScroll) { cm.display.alignWidgets = true; }
    changeLine(doc, handle, "widget", function (line) {
      var widgets = line.widgets || (line.widgets = []);
      if (widget.insertAt == null) { widgets.push(widget); }
      else { widgets.splice(Math.min(widgets.length, Math.max(0, widget.insertAt)), 0, widget); }
      widget.line = line;
      if (cm && !lineIsHidden(doc, line)) {
        var aboveVisible = heightAtLine(line) < doc.scrollTop;
        updateLineHeight(line, line.height + widgetHeight(widget));
        if (aboveVisible) { addToScrollTop(cm, widget.height); }
        cm.curOp.forceUpdate = true;
      }
      return true
    });
    if (cm) { signalLater(cm, "lineWidgetAdded", cm, widget, typeof handle == "number" ? handle : lineNo(handle)); }
    return widget
  }

  // TEXTMARKERS

  // Created with markText and setBookmark methods. A TextMarker is a
  // handle that can be used to clear or find a marked position in the
  // document. Line objects hold arrays (markedSpans) containing
  // {from, to, marker} object pointing to such marker objects, and
  // indicating that such a marker is present on that line. Multiple
  // lines may point to the same marker when it spans across lines.
  // The spans will have null for their from/to properties when the
  // marker continues beyond the start/end of the line. Markers have
  // links back to the lines they currently touch.

  // Collapsed markers have unique ids, in order to be able to order
  // them, which is needed for uniquely determining an outer marker
  // when they overlap (they may nest, but not partially overlap).
  var nextMarkerId = 0;

  var TextMarker = function(doc, type) {
    this.lines = [];
    this.type = type;
    this.doc = doc;
    this.id = ++nextMarkerId;
  };

  // Clear the marker.
  TextMarker.prototype.clear = function () {
    if (this.explicitlyCleared) { return }
    var cm = this.doc.cm, withOp = cm && !cm.curOp;
    if (withOp) { startOperation(cm); }
    if (hasHandler(this, "clear")) {
      var found = this.find();
      if (found) { signalLater(this, "clear", found.from, found.to); }
    }
    var min = null, max = null;
    for (var i = 0; i < this.lines.length; ++i) {
      var line = this.lines[i];
      var span = getMarkedSpanFor(line.markedSpans, this);
      if (cm && !this.collapsed) { regLineChange(cm, lineNo(line), "text"); }
      else if (cm) {
        if (span.to != null) { max = lineNo(line); }
        if (span.from != null) { min = lineNo(line); }
      }
      line.markedSpans = removeMarkedSpan(line.markedSpans, span);
      if (span.from == null && this.collapsed && !lineIsHidden(this.doc, line) && cm)
        { updateLineHeight(line, textHeight(cm.display)); }
    }
    if (cm && this.collapsed && !cm.options.lineWrapping) { for (var i$1 = 0; i$1 < this.lines.length; ++i$1) {
      var visual = visualLine(this.lines[i$1]), len = lineLength(visual);
      if (len > cm.display.maxLineLength) {
        cm.display.maxLine = visual;
        cm.display.maxLineLength = len;
        cm.display.maxLineChanged = true;
      }
    } }

    if (min != null && cm && this.collapsed) { regChange(cm, min, max + 1); }
    this.lines.length = 0;
    this.explicitlyCleared = true;
    if (this.atomic && this.doc.cantEdit) {
      this.doc.cantEdit = false;
      if (cm) { reCheckSelection(cm.doc); }
    }
    if (cm) { signalLater(cm, "markerCleared", cm, this, min, max); }
    if (withOp) { endOperation(cm); }
    if (this.parent) { this.parent.clear(); }
  };

  // Find the position of the marker in the document. Returns a {from,
  // to} object by default. Side can be passed to get a specific side
  // -- 0 (both), -1 (left), or 1 (right). When lineObj is true, the
  // Pos objects returned contain a line object, rather than a line
  // number (used to prevent looking up the same line twice).
  TextMarker.prototype.find = function (side, lineObj) {
    if (side == null && this.type == "bookmark") { side = 1; }
    var from, to;
    for (var i = 0; i < this.lines.length; ++i) {
      var line = this.lines[i];
      var span = getMarkedSpanFor(line.markedSpans, this);
      if (span.from != null) {
        from = Pos(lineObj ? line : lineNo(line), span.from);
        if (side == -1) { return from }
      }
      if (span.to != null) {
        to = Pos(lineObj ? line : lineNo(line), span.to);
        if (side == 1) { return to }
      }
    }
    return from && {from: from, to: to}
  };

  // Signals that the marker's widget changed, and surrounding layout
  // should be recomputed.
  TextMarker.prototype.changed = function () {
      var this$1 = this;

    var pos = this.find(-1, true), widget = this, cm = this.doc.cm;
    if (!pos || !cm) { return }
    runInOp(cm, function () {
      var line = pos.line, lineN = lineNo(pos.line);
      var view = findViewForLine(cm, lineN);
      if (view) {
        clearLineMeasurementCacheFor(view);
        cm.curOp.selectionChanged = cm.curOp.forceUpdate = true;
      }
      cm.curOp.updateMaxLine = true;
      if (!lineIsHidden(widget.doc, line) && widget.height != null) {
        var oldHeight = widget.height;
        widget.height = null;
        var dHeight = widgetHeight(widget) - oldHeight;
        if (dHeight)
          { updateLineHeight(line, line.height + dHeight); }
      }
      signalLater(cm, "markerChanged", cm, this$1);
    });
  };

  TextMarker.prototype.attachLine = function (line) {
    if (!this.lines.length && this.doc.cm) {
      var op = this.doc.cm.curOp;
      if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1)
        { (op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this); }
    }
    this.lines.push(line);
  };

  TextMarker.prototype.detachLine = function (line) {
    this.lines.splice(indexOf(this.lines, line), 1);
    if (!this.lines.length && this.doc.cm) {
      var op = this.doc.cm.curOp
      ;(op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this);
    }
  };
  eventMixin(TextMarker);

  // Create a marker, wire it up to the right lines, and
  function markText(doc, from, to, options, type) {
    // Shared markers (across linked documents) are handled separately
    // (markTextShared will call out to this again, once per
    // document).
    if (options && options.shared) { return markTextShared(doc, from, to, options, type) }
    // Ensure we are in an operation.
    if (doc.cm && !doc.cm.curOp) { return operation(doc.cm, markText)(doc, from, to, options, type) }

    var marker = new TextMarker(doc, type), diff = cmp(from, to);
    if (options) { copyObj(options, marker, false); }
    // Don't connect empty markers unless clearWhenEmpty is false
    if (diff > 0 || diff == 0 && marker.clearWhenEmpty !== false)
      { return marker }
    if (marker.replacedWith) {
      // Showing up as a widget implies collapsed (widget replaces text)
      marker.collapsed = true;
      marker.widgetNode = eltP("span", [marker.replacedWith], "CodeMirror-widget");
      if (!options.handleMouseEvents) { marker.widgetNode.setAttribute("cm-ignore-events", "true"); }
      if (options.insertLeft) { marker.widgetNode.insertLeft = true; }
    }
    if (marker.collapsed) {
      if (conflictingCollapsedRange(doc, from.line, from, to, marker) ||
          from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker))
        { throw new Error("Inserting collapsed marker partially overlapping an existing one") }
      seeCollapsedSpans();
    }

    if (marker.addToHistory)
      { addChangeToHistory(doc, {from: from, to: to, origin: "markText"}, doc.sel, NaN); }

    var curLine = from.line, cm = doc.cm, updateMaxLine;
    doc.iter(curLine, to.line + 1, function (line) {
      if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(line) == cm.display.maxLine)
        { updateMaxLine = true; }
      if (marker.collapsed && curLine != from.line) { updateLineHeight(line, 0); }
      addMarkedSpan(line, new MarkedSpan(marker,
                                         curLine == from.line ? from.ch : null,
                                         curLine == to.line ? to.ch : null), doc.cm && doc.cm.curOp);
      ++curLine;
    });
    // lineIsHidden depends on the presence of the spans, so needs a second pass
    if (marker.collapsed) { doc.iter(from.line, to.line + 1, function (line) {
      if (lineIsHidden(doc, line)) { updateLineHeight(line, 0); }
    }); }

    if (marker.clearOnEnter) { on(marker, "beforeCursorEnter", function () { return marker.clear(); }); }

    if (marker.readOnly) {
      seeReadOnlySpans();
      if (doc.history.done.length || doc.history.undone.length)
        { doc.clearHistory(); }
    }
    if (marker.collapsed) {
      marker.id = ++nextMarkerId;
      marker.atomic = true;
    }
    if (cm) {
      // Sync editor state
      if (updateMaxLine) { cm.curOp.updateMaxLine = true; }
      if (marker.collapsed)
        { regChange(cm, from.line, to.line + 1); }
      else if (marker.className || marker.startStyle || marker.endStyle || marker.css ||
               marker.attributes || marker.title)
        { for (var i = from.line; i <= to.line; i++) { regLineChange(cm, i, "text"); } }
      if (marker.atomic) { reCheckSelection(cm.doc); }
      signalLater(cm, "markerAdded", cm, marker);
    }
    return marker
  }

  // SHARED TEXTMARKERS

  // A shared marker spans multiple linked documents. It is
  // implemented as a meta-marker-object controlling multiple normal
  // markers.
  var SharedTextMarker = function(markers, primary) {
    this.markers = markers;
    this.primary = primary;
    for (var i = 0; i < markers.length; ++i)
      { markers[i].parent = this; }
  };

  SharedTextMarker.prototype.clear = function () {
    if (this.explicitlyCleared) { return }
    this.explicitlyCleared = true;
    for (var i = 0; i < this.markers.length; ++i)
      { this.markers[i].clear(); }
    signalLater(this, "clear");
  };

  SharedTextMarker.prototype.find = function (side, lineObj) {
    return this.primary.find(side, lineObj)
  };
  eventMixin(SharedTextMarker);

  function markTextShared(doc, from, to, options, type) {
    options = copyObj(options);
    options.shared = false;
    var markers = [markText(doc, from, to, options, type)], primary = markers[0];
    var widget = options.widgetNode;
    linkedDocs(doc, function (doc) {
      if (widget) { options.widgetNode = widget.cloneNode(true); }
      markers.push(markText(doc, clipPos(doc, from), clipPos(doc, to), options, type));
      for (var i = 0; i < doc.linked.length; ++i)
        { if (doc.linked[i].isParent) { return } }
      primary = lst(markers);
    });
    return new SharedTextMarker(markers, primary)
  }

  function findSharedMarkers(doc) {
    return doc.findMarks(Pos(doc.first, 0), doc.clipPos(Pos(doc.lastLine())), function (m) { return m.parent; })
  }

  function copySharedMarkers(doc, markers) {
    for (var i = 0; i < markers.length; i++) {
      var marker = markers[i], pos = marker.find();
      var mFrom = doc.clipPos(pos.from), mTo = doc.clipPos(pos.to);
      if (cmp(mFrom, mTo)) {
        var subMark = markText(doc, mFrom, mTo, marker.primary, marker.primary.type);
        marker.markers.push(subMark);
        subMark.parent = marker;
      }
    }
  }

  function detachSharedMarkers(markers) {
    var loop = function ( i ) {
      var marker = markers[i], linked = [marker.primary.doc];
      linkedDocs(marker.primary.doc, function (d) { return linked.push(d); });
      for (var j = 0; j < marker.markers.length; j++) {
        var subMarker = marker.markers[j];
        if (indexOf(linked, subMarker.doc) == -1) {
          subMarker.parent = null;
          marker.markers.splice(j--, 1);
        }
      }
    };

    for (var i = 0; i < markers.length; i++) loop( i );
  }

  var nextDocId = 0;
  var Doc = function(text, mode, firstLine, lineSep, direction) {
    if (!(this instanceof Doc)) { return new Doc(text, mode, firstLine, lineSep, direction) }
    if (firstLine == null) { firstLine = 0; }

    BranchChunk.call(this, [new LeafChunk([new Line("", null)])]);
    this.first = firstLine;
    this.scrollTop = this.scrollLeft = 0;
    this.cantEdit = false;
    this.cleanGeneration = 1;
    this.modeFrontier = this.highlightFrontier = firstLine;
    var start = Pos(firstLine, 0);
    this.sel = simpleSelection(start);
    this.history = new History(null);
    this.id = ++nextDocId;
    this.modeOption = mode;
    this.lineSep = lineSep;
    this.direction = (direction == "rtl") ? "rtl" : "ltr";
    this.extend = false;

    if (typeof text == "string") { text = this.splitLines(text); }
    updateDoc(this, {from: start, to: start, text: text});
    setSelection(this, simpleSelection(start), sel_dontScroll);
  };

  Doc.prototype = createObj(BranchChunk.prototype, {
    constructor: Doc,
    // Iterate over the document. Supports two forms -- with only one
    // argument, it calls that for each line in the document. With
    // three, it iterates over the range given by the first two (with
    // the second being non-inclusive).
    iter: function(from, to, op) {
      if (op) { this.iterN(from - this.first, to - from, op); }
      else { this.iterN(this.first, this.first + this.size, from); }
    },

    // Non-public interface for adding and removing lines.
    insert: function(at, lines) {
      var height = 0;
      for (var i = 0; i < lines.length; ++i) { height += lines[i].height; }
      this.insertInner(at - this.first, lines, height);
    },
    remove: function(at, n) { this.removeInner(at - this.first, n); },

    // From here, the methods are part of the public interface. Most
    // are also available from CodeMirror (editor) instances.

    getValue: function(lineSep) {
      var lines = getLines(this, this.first, this.first + this.size);
      if (lineSep === false) { return lines }
      return lines.join(lineSep || this.lineSeparator())
    },
    setValue: docMethodOp(function(code) {
      var top = Pos(this.first, 0), last = this.first + this.size - 1;
      makeChange(this, {from: top, to: Pos(last, getLine(this, last).text.length),
                        text: this.splitLines(code), origin: "setValue", full: true}, true);
      if (this.cm) { scrollToCoords(this.cm, 0, 0); }
      setSelection(this, simpleSelection(top), sel_dontScroll);
    }),
    replaceRange: function(code, from, to, origin) {
      from = clipPos(this, from);
      to = to ? clipPos(this, to) : from;
      replaceRange(this, code, from, to, origin);
    },
    getRange: function(from, to, lineSep) {
      var lines = getBetween(this, clipPos(this, from), clipPos(this, to));
      if (lineSep === false) { return lines }
      if (lineSep === '') { return lines.join('') }
      return lines.join(lineSep || this.lineSeparator())
    },

    getLine: function(line) {var l = this.getLineHandle(line); return l && l.text},

    getLineHandle: function(line) {if (isLine(this, line)) { return getLine(this, line) }},
    getLineNumber: function(line) {return lineNo(line)},

    getLineHandleVisualStart: function(line) {
      if (typeof line == "number") { line = getLine(this, line); }
      return visualLine(line)
    },

    lineCount: function() {return this.size},
    firstLine: function() {return this.first},
    lastLine: function() {return this.first + this.size - 1},

    clipPos: function(pos) {return clipPos(this, pos)},

    getCursor: function(start) {
      var range = this.sel.primary(), pos;
      if (start == null || start == "head") { pos = range.head; }
      else if (start == "anchor") { pos = range.anchor; }
      else if (start == "end" || start == "to" || start === false) { pos = range.to(); }
      else { pos = range.from(); }
      return pos
    },
    listSelections: function() { return this.sel.ranges },
    somethingSelected: function() {return this.sel.somethingSelected()},

    setCursor: docMethodOp(function(line, ch, options) {
      setSimpleSelection(this, clipPos(this, typeof line == "number" ? Pos(line, ch || 0) : line), null, options);
    }),
    setSelection: docMethodOp(function(anchor, head, options) {
      setSimpleSelection(this, clipPos(this, anchor), clipPos(this, head || anchor), options);
    }),
    extendSelection: docMethodOp(function(head, other, options) {
      extendSelection(this, clipPos(this, head), other && clipPos(this, other), options);
    }),
    extendSelections: docMethodOp(function(heads, options) {
      extendSelections(this, clipPosArray(this, heads), options);
    }),
    extendSelectionsBy: docMethodOp(function(f, options) {
      var heads = map(this.sel.ranges, f);
      extendSelections(this, clipPosArray(this, heads), options);
    }),
    setSelections: docMethodOp(function(ranges, primary, options) {
      if (!ranges.length) { return }
      var out = [];
      for (var i = 0; i < ranges.length; i++)
        { out[i] = new Range(clipPos(this, ranges[i].anchor),
                           clipPos(this, ranges[i].head || ranges[i].anchor)); }
      if (primary == null) { primary = Math.min(ranges.length - 1, this.sel.primIndex); }
      setSelection(this, normalizeSelection(this.cm, out, primary), options);
    }),
    addSelection: docMethodOp(function(anchor, head, options) {
      var ranges = this.sel.ranges.slice(0);
      ranges.push(new Range(clipPos(this, anchor), clipPos(this, head || anchor)));
      setSelection(this, normalizeSelection(this.cm, ranges, ranges.length - 1), options);
    }),

    getSelection: function(lineSep) {
      var ranges = this.sel.ranges, lines;
      for (var i = 0; i < ranges.length; i++) {
        var sel = getBetween(this, ranges[i].from(), ranges[i].to());
        lines = lines ? lines.concat(sel) : sel;
      }
      if (lineSep === false) { return lines }
      else { return lines.join(lineSep || this.lineSeparator()) }
    },
    getSelections: function(lineSep) {
      var parts = [], ranges = this.sel.ranges;
      for (var i = 0; i < ranges.length; i++) {
        var sel = getBetween(this, ranges[i].from(), ranges[i].to());
        if (lineSep !== false) { sel = sel.join(lineSep || this.lineSeparator()); }
        parts[i] = sel;
      }
      return parts
    },
    replaceSelection: function(code, collapse, origin) {
      var dup = [];
      for (var i = 0; i < this.sel.ranges.length; i++)
        { dup[i] = code; }
      this.replaceSelections(dup, collapse, origin || "+input");
    },
    replaceSelections: docMethodOp(function(code, collapse, origin) {
      var changes = [], sel = this.sel;
      for (var i = 0; i < sel.ranges.length; i++) {
        var range = sel.ranges[i];
        changes[i] = {from: range.from(), to: range.to(), text: this.splitLines(code[i]), origin: origin};
      }
      var newSel = collapse && collapse != "end" && computeReplacedSel(this, changes, collapse);
      for (var i$1 = changes.length - 1; i$1 >= 0; i$1--)
        { makeChange(this, changes[i$1]); }
      if (newSel) { setSelectionReplaceHistory(this, newSel); }
      else if (this.cm) { ensureCursorVisible(this.cm); }
    }),
    undo: docMethodOp(function() {makeChangeFromHistory(this, "undo");}),
    redo: docMethodOp(function() {makeChangeFromHistory(this, "redo");}),
    undoSelection: docMethodOp(function() {makeChangeFromHistory(this, "undo", true);}),
    redoSelection: docMethodOp(function() {makeChangeFromHistory(this, "redo", true);}),

    setExtending: function(val) {this.extend = val;},
    getExtending: function() {return this.extend},

    historySize: function() {
      var hist = this.history, done = 0, undone = 0;
      for (var i = 0; i < hist.done.length; i++) { if (!hist.done[i].ranges) { ++done; } }
      for (var i$1 = 0; i$1 < hist.undone.length; i$1++) { if (!hist.undone[i$1].ranges) { ++undone; } }
      return {undo: done, redo: undone}
    },
    clearHistory: function() {
      var this$1 = this;

      this.history = new History(this.history);
      linkedDocs(this, function (doc) { return doc.history = this$1.history; }, true);
    },

    markClean: function() {
      this.cleanGeneration = this.changeGeneration(true);
    },
    changeGeneration: function(forceSplit) {
      if (forceSplit)
        { this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null; }
      return this.history.generation
    },
    isClean: function (gen) {
      return this.history.generation == (gen || this.cleanGeneration)
    },

    getHistory: function() {
      return {done: copyHistoryArray(this.history.done),
              undone: copyHistoryArray(this.history.undone)}
    },
    setHistory: function(histData) {
      var hist = this.history = new History(this.history);
      hist.done = copyHistoryArray(histData.done.slice(0), null, true);
      hist.undone = copyHistoryArray(histData.undone.slice(0), null, true);
    },

    setGutterMarker: docMethodOp(function(line, gutterID, value) {
      return changeLine(this, line, "gutter", function (line) {
        var markers = line.gutterMarkers || (line.gutterMarkers = {});
        markers[gutterID] = value;
        if (!value && isEmpty(markers)) { line.gutterMarkers = null; }
        return true
      })
    }),

    clearGutter: docMethodOp(function(gutterID) {
      var this$1 = this;

      this.iter(function (line) {
        if (line.gutterMarkers && line.gutterMarkers[gutterID]) {
          changeLine(this$1, line, "gutter", function () {
            line.gutterMarkers[gutterID] = null;
            if (isEmpty(line.gutterMarkers)) { line.gutterMarkers = null; }
            return true
          });
        }
      });
    }),

    lineInfo: function(line) {
      var n;
      if (typeof line == "number") {
        if (!isLine(this, line)) { return null }
        n = line;
        line = getLine(this, line);
        if (!line) { return null }
      } else {
        n = lineNo(line);
        if (n == null) { return null }
      }
      return {line: n, handle: line, text: line.text, gutterMarkers: line.gutterMarkers,
              textClass: line.textClass, bgClass: line.bgClass, wrapClass: line.wrapClass,
              widgets: line.widgets}
    },

    addLineClass: docMethodOp(function(handle, where, cls) {
      return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function (line) {
        var prop = where == "text" ? "textClass"
                 : where == "background" ? "bgClass"
                 : where == "gutter" ? "gutterClass" : "wrapClass";
        if (!line[prop]) { line[prop] = cls; }
        else if (classTest(cls).test(line[prop])) { return false }
        else { line[prop] += " " + cls; }
        return true
      })
    }),
    removeLineClass: docMethodOp(function(handle, where, cls) {
      return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function (line) {
        var prop = where == "text" ? "textClass"
                 : where == "background" ? "bgClass"
                 : where == "gutter" ? "gutterClass" : "wrapClass";
        var cur = line[prop];
        if (!cur) { return false }
        else if (cls == null) { line[prop] = null; }
        else {
          var found = cur.match(classTest(cls));
          if (!found) { return false }
          var end = found.index + found[0].length;
          line[prop] = cur.slice(0, found.index) + (!found.index || end == cur.length ? "" : " ") + cur.slice(end) || null;
        }
        return true
      })
    }),

    addLineWidget: docMethodOp(function(handle, node, options) {
      return addLineWidget(this, handle, node, options)
    }),
    removeLineWidget: function(widget) { widget.clear(); },

    markText: function(from, to, options) {
      return markText(this, clipPos(this, from), clipPos(this, to), options, options && options.type || "range")
    },
    setBookmark: function(pos, options) {
      var realOpts = {replacedWith: options && (options.nodeType == null ? options.widget : options),
                      insertLeft: options && options.insertLeft,
                      clearWhenEmpty: false, shared: options && options.shared,
                      handleMouseEvents: options && options.handleMouseEvents};
      pos = clipPos(this, pos);
      return markText(this, pos, pos, realOpts, "bookmark")
    },
    findMarksAt: function(pos) {
      pos = clipPos(this, pos);
      var markers = [], spans = getLine(this, pos.line).markedSpans;
      if (spans) { for (var i = 0; i < spans.length; ++i) {
        var span = spans[i];
        if ((span.from == null || span.from <= pos.ch) &&
            (span.to == null || span.to >= pos.ch))
          { markers.push(span.marker.parent || span.marker); }
      } }
      return markers
    },
    findMarks: function(from, to, filter) {
      from = clipPos(this, from); to = clipPos(this, to);
      var found = [], lineNo = from.line;
      this.iter(from.line, to.line + 1, function (line) {
        var spans = line.markedSpans;
        if (spans) { for (var i = 0; i < spans.length; i++) {
          var span = spans[i];
          if (!(span.to != null && lineNo == from.line && from.ch >= span.to ||
                span.from == null && lineNo != from.line ||
                span.from != null && lineNo == to.line && span.from >= to.ch) &&
              (!filter || filter(span.marker)))
            { found.push(span.marker.parent || span.marker); }
        } }
        ++lineNo;
      });
      return found
    },
    getAllMarks: function() {
      var markers = [];
      this.iter(function (line) {
        var sps = line.markedSpans;
        if (sps) { for (var i = 0; i < sps.length; ++i)
          { if (sps[i].from != null) { markers.push(sps[i].marker); } } }
      });
      return markers
    },

    posFromIndex: function(off) {
      var ch, lineNo = this.first, sepSize = this.lineSeparator().length;
      this.iter(function (line) {
        var sz = line.text.length + sepSize;
        if (sz > off) { ch = off; return true }
        off -= sz;
        ++lineNo;
      });
      return clipPos(this, Pos(lineNo, ch))
    },
    indexFromPos: function (coords) {
      coords = clipPos(this, coords);
      var index = coords.ch;
      if (coords.line < this.first || coords.ch < 0) { return 0 }
      var sepSize = this.lineSeparator().length;
      this.iter(this.first, coords.line, function (line) { // iter aborts when callback returns a truthy value
        index += line.text.length + sepSize;
      });
      return index
    },

    copy: function(copyHistory) {
      var doc = new Doc(getLines(this, this.first, this.first + this.size),
                        this.modeOption, this.first, this.lineSep, this.direction);
      doc.scrollTop = this.scrollTop; doc.scrollLeft = this.scrollLeft;
      doc.sel = this.sel;
      doc.extend = false;
      if (copyHistory) {
        doc.history.undoDepth = this.history.undoDepth;
        doc.setHistory(this.getHistory());
      }
      return doc
    },

    linkedDoc: function(options) {
      if (!options) { options = {}; }
      var from = this.first, to = this.first + this.size;
      if (options.from != null && options.from > from) { from = options.from; }
      if (options.to != null && options.to < to) { to = options.to; }
      var copy = new Doc(getLines(this, from, to), options.mode || this.modeOption, from, this.lineSep, this.direction);
      if (options.sharedHist) { copy.history = this.history
      ; }(this.linked || (this.linked = [])).push({doc: copy, sharedHist: options.sharedHist});
      copy.linked = [{doc: this, isParent: true, sharedHist: options.sharedHist}];
      copySharedMarkers(copy, findSharedMarkers(this));
      return copy
    },
    unlinkDoc: function(other) {
      if (other instanceof CodeMirror) { other = other.doc; }
      if (this.linked) { for (var i = 0; i < this.linked.length; ++i) {
        var link = this.linked[i];
        if (link.doc != other) { continue }
        this.linked.splice(i, 1);
        other.unlinkDoc(this);
        detachSharedMarkers(findSharedMarkers(this));
        break
      } }
      // If the histories were shared, split them again
      if (other.history == this.history) {
        var splitIds = [other.id];
        linkedDocs(other, function (doc) { return splitIds.push(doc.id); }, true);
        other.history = new History(null);
        other.history.done = copyHistoryArray(this.history.done, splitIds);
        other.history.undone = copyHistoryArray(this.history.undone, splitIds);
      }
    },
    iterLinkedDocs: function(f) {linkedDocs(this, f);},

    getMode: function() {return this.mode},
    getEditor: function() {return this.cm},

    splitLines: function(str) {
      if (this.lineSep) { return str.split(this.lineSep) }
      return splitLinesAuto(str)
    },
    lineSeparator: function() { return this.lineSep || "\n" },

    setDirection: docMethodOp(function (dir) {
      if (dir != "rtl") { dir = "ltr"; }
      if (dir == this.direction) { return }
      this.direction = dir;
      this.iter(function (line) { return line.order = null; });
      if (this.cm) { directionChanged(this.cm); }
    })
  });

  // Public alias.
  Doc.prototype.eachLine = Doc.prototype.iter;

  // Kludge to work around strange IE behavior where it'll sometimes
  // re-fire a series of drag-related events right after the drop (#1551)
  var lastDrop = 0;

  function onDrop(e) {
    var cm = this;
    clearDragCursor(cm);
    if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e))
      { return }
    e_preventDefault(e);
    if (ie) { lastDrop = +new Date; }
    var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files;
    if (!pos || cm.isReadOnly()) { return }
    // Might be a file drop, in which case we simply extract the text
    // and insert it.
    if (files && files.length && window.FileReader && window.File) {
      var n = files.length, text = Array(n), read = 0;
      var markAsReadAndPasteIfAllFilesAreRead = function () {
        if (++read == n) {
          operation(cm, function () {
            pos = clipPos(cm.doc, pos);
            var change = {from: pos, to: pos,
                          text: cm.doc.splitLines(
                              text.filter(function (t) { return t != null; }).join(cm.doc.lineSeparator())),
                          origin: "paste"};
            makeChange(cm.doc, change);
            setSelectionReplaceHistory(cm.doc, simpleSelection(clipPos(cm.doc, pos), clipPos(cm.doc, changeEnd(change))));
          })();
        }
      };
      var readTextFromFile = function (file, i) {
        if (cm.options.allowDropFileTypes &&
            indexOf(cm.options.allowDropFileTypes, file.type) == -1) {
          markAsReadAndPasteIfAllFilesAreRead();
          return
        }
        var reader = new FileReader;
        reader.onerror = function () { return markAsReadAndPasteIfAllFilesAreRead(); };
        reader.onload = function () {
          var content = reader.result;
          if (/[\x00-\x08\x0e-\x1f]{2}/.test(content)) {
            markAsReadAndPasteIfAllFilesAreRead();
            return
          }
          text[i] = content;
          markAsReadAndPasteIfAllFilesAreRead();
        };
        reader.readAsText(file);
      };
      for (var i = 0; i < files.length; i++) { readTextFromFile(files[i], i); }
    } else { // Normal drop
      // Don't do a replace if the drop happened inside of the selected text.
      if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) {
        cm.state.draggingText(e);
        // Ensure the editor is re-focused
        setTimeout(function () { return cm.display.input.focus(); }, 20);
        return
      }
      try {
        var text$1 = e.dataTransfer.getData("Text");
        if (text$1) {
          var selected;
          if (cm.state.draggingText && !cm.state.draggingText.copy)
            { selected = cm.listSelections(); }
          setSelectionNoUndo(cm.doc, simpleSelection(pos, pos));
          if (selected) { for (var i$1 = 0; i$1 < selected.length; ++i$1)
            { replaceRange(cm.doc, "", selected[i$1].anchor, selected[i$1].head, "drag"); } }
          cm.replaceSelection(text$1, "around", "paste");
          cm.display.input.focus();
        }
      }
      catch(e$1){}
    }
  }

  function onDragStart(cm, e) {
    if (ie && (!cm.state.draggingText || +new Date - lastDrop < 100)) { e_stop(e); return }
    if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) { return }

    e.dataTransfer.setData("Text", cm.getSelection());
    e.dataTransfer.effectAllowed = "copyMove";

    // Use dummy image instead of default browsers image.
    // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there.
    if (e.dataTransfer.setDragImage && !safari) {
      var img = elt("img", null, null, "position: fixed; left: 0; top: 0;");
      img.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
      if (presto) {
        img.width = img.height = 1;
        cm.display.wrapper.appendChild(img);
        // Force a relayout, or Opera won't use our image for some obscure reason
        img._top = img.offsetTop;
      }
      e.dataTransfer.setDragImage(img, 0, 0);
      if (presto) { img.parentNode.removeChild(img); }
    }
  }

  function onDragOver(cm, e) {
    var pos = posFromMouse(cm, e);
    if (!pos) { return }
    var frag = document.createDocumentFragment();
    drawSelectionCursor(cm, pos, frag);
    if (!cm.display.dragCursor) {
      cm.display.dragCursor = elt("div", null, "CodeMirror-cursors CodeMirror-dragcursors");
      cm.display.lineSpace.insertBefore(cm.display.dragCursor, cm.display.cursorDiv);
    }
    removeChildrenAndAdd(cm.display.dragCursor, frag);
  }

  function clearDragCursor(cm) {
    if (cm.display.dragCursor) {
      cm.display.lineSpace.removeChild(cm.display.dragCursor);
      cm.display.dragCursor = null;
    }
  }

  // These must be handled carefully, because naively registering a
  // handler for each editor will cause the editors to never be
  // garbage collected.

  function forEachCodeMirror(f) {
    if (!document.getElementsByClassName) { return }
    var byClass = document.getElementsByClassName("CodeMirror"), editors = [];
    for (var i = 0; i < byClass.length; i++) {
      var cm = byClass[i].CodeMirror;
      if (cm) { editors.push(cm); }
    }
    if (editors.length) { editors[0].operation(function () {
      for (var i = 0; i < editors.length; i++) { f(editors[i]); }
    }); }
  }

  var globalsRegistered = false;
  function ensureGlobalHandlers() {
    if (globalsRegistered) { return }
    registerGlobalHandlers();
    globalsRegistered = true;
  }
  function registerGlobalHandlers() {
    // When the window resizes, we need to refresh active editors.
    var resizeTimer;
    on(window, "resize", function () {
      if (resizeTimer == null) { resizeTimer = setTimeout(function () {
        resizeTimer = null;
        forEachCodeMirror(onResize);
      }, 100); }
    });
    // When the window loses focus, we want to show the editor as blurred
    on(window, "blur", function () { return forEachCodeMirror(onBlur); });
  }
  // Called when the window resizes
  function onResize(cm) {
    var d = cm.display;
    // Might be a text scaling operation, clear size caches.
    d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;
    d.scrollbarsClipped = false;
    cm.setSize();
  }

  var keyNames = {
    3: "Pause", 8: "Backspace", 9: "Tab", 13: "Enter", 16: "Shift", 17: "Ctrl", 18: "Alt",
    19: "Pause", 20: "CapsLock", 27: "Esc", 32: "Space", 33: "PageUp", 34: "PageDown", 35: "End",
    36: "Home", 37: "Left", 38: "Up", 39: "Right", 40: "Down", 44: "PrintScrn", 45: "Insert",
    46: "Delete", 59: ";", 61: "=", 91: "Mod", 92: "Mod", 93: "Mod",
    106: "*", 107: "=", 109: "-", 110: ".", 111: "/", 145: "ScrollLock",
    173: "-", 186: ";", 187: "=", 188: ",", 189: "-", 190: ".", 191: "/", 192: "~~~", 219: "[", 220: "\\",
    221: "]", 222: "'", 224: "Mod", 63232: "Up", 63233: "Down", 63234: "Left", 63235: "Right", 63272: "Delete",
    63273: "Home", 63275: "End", 63276: "PageUp", 63277: "PageDown", 63302: "Insert"
  };

  // Number keys
  for (var i = 0; i < 10; i++) { keyNames[i + 48] = keyNames[i + 96] = String(i); }
  // Alphabetic keys
  for (var i$1 = 65; i$1 <= 90; i$1++) { keyNames[i$1] = String.fromCharCode(i$1); }
  // Function keys
  for (var i$2 = 1; i$2 <= 12; i$2++) { keyNames[i$2 + 111] = keyNames[i$2 + 63235] = "F" + i$2; }

  var keyMap = {};

  keyMap.basic = {
    "Left": "goCharLeft", "Right": "goCharRight", "Up": "goLineUp", "Down": "goLineDown",
    "End": "goLineEnd", "Home": "goLineStartSmart", "PageUp": "goPageUp", "PageDown": "goPageDown",
    "Delete": "delCharAfter", "Backspace": "delCharBefore", "Shift-Backspace": "delCharBefore",
    "Tab": "defaultTab", "Shift-Tab": "indentAuto",
    "Enter": "newlineAndIndent", "Insert": "toggleOverwrite",
    "Esc": "singleSelection"
  };
  // Note that the save and find-related commands aren't defined by
  // default. User code or addons can define them. Unknown commands
  // are simply ignored.
  keyMap.pcDefault = {
    "Ctrl-A": "selectAll", "Ctrl-D": "deleteLine", "Ctrl-Z": "undo", "Shift-Ctrl-Z": "redo", "Ctrl-Y": "redo",
    "Ctrl-Home": "goDocStart", "Ctrl-End": "goDocEnd", "Ctrl-Up": "goLineUp", "Ctrl-Down": "goLineDown",
    "Ctrl-Left": "goGroupLeft", "Ctrl-Right": "goGroupRight", "Alt-Left": "goLineStart", "Alt-Right": "goLineEnd",
    "Ctrl-Backspace": "delGroupBefore", "Ctrl-Delete": "delGroupAfter", "Ctrl-S": "save", "Ctrl-F": "find",
    "Ctrl-G": "findNext", "Shift-Ctrl-G": "findPrev", "Shift-Ctrl-F": "replace", "Shift-Ctrl-R": "replaceAll",
    "Ctrl-[": "indentLess", "Ctrl-]": "indentMore",
    "Ctrl-U": "undoSelection", "Shift-Ctrl-U": "redoSelection", "Alt-U": "redoSelection",
    "fallthrough": "basic"
  };
  // Very basic readline/emacs-style bindings, which are standard on Mac.
  keyMap.emacsy = {
    "Ctrl-F": "goCharRight", "Ctrl-B": "goCharLeft", "Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown",
    "Ctrl-A": "goLineStart", "Ctrl-E": "goLineEnd", "Ctrl-V": "goPageDown", "Shift-Ctrl-V": "goPageUp",
    "Ctrl-D": "delCharAfter", "Ctrl-H": "delCharBefore", "Alt-Backspace": "delWordBefore", "Ctrl-K": "killLine",
    "Ctrl-T": "transposeChars", "Ctrl-O": "openLine"
  };
  keyMap.macDefault = {
    "Cmd-A": "selectAll", "Cmd-D": "deleteLine", "Cmd-Z": "undo", "Shift-Cmd-Z": "redo", "Cmd-Y": "redo",
    "Cmd-Home": "goDocStart", "Cmd-Up": "goDocStart", "Cmd-End": "goDocEnd", "Cmd-Down": "goDocEnd", "Alt-Left": "goGroupLeft",
    "Alt-Right": "goGroupRight", "Cmd-Left": "goLineLeft", "Cmd-Right": "goLineRight", "Alt-Backspace": "delGroupBefore",
    "Ctrl-Alt-Backspace": "delGroupAfter", "Alt-Delete": "delGroupAfter", "Cmd-S": "save", "Cmd-F": "find",
    "Cmd-G": "findNext", "Shift-Cmd-G": "findPrev", "Cmd-Alt-F": "replace", "Shift-Cmd-Alt-F": "replaceAll",
    "Cmd-[": "indentLess", "Cmd-]": "indentMore", "Cmd-Backspace": "delWrappedLineLeft", "Cmd-Delete": "delWrappedLineRight",
    "Cmd-U": "undoSelection", "Shift-Cmd-U": "redoSelection", "Ctrl-Up": "goDocStart", "Ctrl-Down": "goDocEnd",
    "fallthrough": ["basic", "emacsy"]
  };
  keyMap["default"] = mac ? keyMap.macDefault : keyMap.pcDefault;

  // KEYMAP DISPATCH

  function normalizeKeyName(name) {
    var parts = name.split(/-(?!$)/);
    name = parts[parts.length - 1];
    var alt, ctrl, shift, cmd;
    for (var i = 0; i < parts.length - 1; i++) {
      var mod = parts[i];
      if (/^(cmd|meta|m)$/i.test(mod)) { cmd = true; }
      else if (/^a(lt)?$/i.test(mod)) { alt = true; }
      else if (/^(c|ctrl|control)$/i.test(mod)) { ctrl = true; }
      else if (/^s(hift)?$/i.test(mod)) { shift = true; }
      else { throw new Error("Unrecognized modifier name: " + mod) }
    }
    if (alt) { name = "Alt-" + name; }
    if (ctrl) { name = "Ctrl-" + name; }
    if (cmd) { name = "Cmd-" + name; }
    if (shift) { name = "Shift-" + name; }
    return name
  }

  // This is a kludge to keep keymaps mostly working as raw objects
  // (backwards compatibility) while at the same time support features
  // like normalization and multi-stroke key bindings. It compiles a
  // new normalized keymap, and then updates the old object to reflect
  // this.
  function normalizeKeyMap(keymap) {
    var copy = {};
    for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) {
      var value = keymap[keyname];
      if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue }
      if (value == "...") { delete keymap[keyname]; continue }

      var keys = map(keyname.split(" "), normalizeKeyName);
      for (var i = 0; i < keys.length; i++) {
        var val = (void 0), name = (void 0);
        if (i == keys.length - 1) {
          name = keys.join(" ");
          val = value;
        } else {
          name = keys.slice(0, i + 1).join(" ");
          val = "...";
        }
        var prev = copy[name];
        if (!prev) { copy[name] = val; }
        else if (prev != val) { throw new Error("Inconsistent bindings for " + name) }
      }
      delete keymap[keyname];
    } }
    for (var prop in copy) { keymap[prop] = copy[prop]; }
    return keymap
  }

  function lookupKey(key, map, handle, context) {
    map = getKeyMap(map);
    var found = map.call ? map.call(key, context) : map[key];
    if (found === false) { return "nothing" }
    if (found === "...") { return "multi" }
    if (found != null && handle(found)) { return "handled" }

    if (map.fallthrough) {
      if (Object.prototype.toString.call(map.fallthrough) != "[object Array]")
        { return lookupKey(key, map.fallthrough, handle, context) }
      for (var i = 0; i < map.fallthrough.length; i++) {
        var result = lookupKey(key, map.fallthrough[i], handle, context);
        if (result) { return result }
      }
    }
  }

  // Modifier key presses don't count as 'real' key presses for the
  // purpose of keymap fallthrough.
  function isModifierKey(value) {
    var name = typeof value == "string" ? value : keyNames[value.keyCode];
    return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod"
  }

  function addModifierNames(name, event, noShift) {
    var base = name;
    if (event.altKey && base != "Alt") { name = "Alt-" + name; }
    if ((flipCtrlCmd ? event.metaKey : event.ctrlKey) && base != "Ctrl") { name = "Ctrl-" + name; }
    if ((flipCtrlCmd ? event.ctrlKey : event.metaKey) && base != "Mod") { name = "Cmd-" + name; }
    if (!noShift && event.shiftKey && base != "Shift") { name = "Shift-" + name; }
    return name
  }

  // Look up the name of a key as indicated by an event object.
  function keyName(event, noShift) {
    if (presto && event.keyCode == 34 && event["char"]) { return false }
    var name = keyNames[event.keyCode];
    if (name == null || event.altGraphKey) { return false }
    // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause,
    // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+)
    if (event.keyCode == 3 && event.code) { name = event.code; }
    return addModifierNames(name, event, noShift)
  }

  function getKeyMap(val) {
    return typeof val == "string" ? keyMap[val] : val
  }

  // Helper for deleting text near the selection(s), used to implement
  // backspace, delete, and similar functionality.
  function deleteNearSelection(cm, compute) {
    var ranges = cm.doc.sel.ranges, kill = [];
    // Build up a set of ranges to kill first, merging overlapping
    // ranges.
    for (var i = 0; i < ranges.length; i++) {
      var toKill = compute(ranges[i]);
      while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {
        var replaced = kill.pop();
        if (cmp(replaced.from, toKill.from) < 0) {
          toKill.from = replaced.from;
          break
        }
      }
      kill.push(toKill);
    }
    // Next, remove those actual ranges.
    runInOp(cm, function () {
      for (var i = kill.length - 1; i >= 0; i--)
        { replaceRange(cm.doc, "", kill[i].from, kill[i].to, "+delete"); }
      ensureCursorVisible(cm);
    });
  }

  function moveCharLogically(line, ch, dir) {
    var target = skipExtendingChars(line.text, ch + dir, dir);
    return target < 0 || target > line.text.length ? null : target
  }

  function moveLogically(line, start, dir) {
    var ch = moveCharLogically(line, start.ch, dir);
    return ch == null ? null : new Pos(start.line, ch, dir < 0 ? "after" : "before")
  }

  function endOfLine(visually, cm, lineObj, lineNo, dir) {
    if (visually) {
      if (cm.doc.direction == "rtl") { dir = -dir; }
      var order = getOrder(lineObj, cm.doc.direction);
      if (order) {
        var part = dir < 0 ? lst(order) : order[0];
        var moveInStorageOrder = (dir < 0) == (part.level == 1);
        var sticky = moveInStorageOrder ? "after" : "before";
        var ch;
        // With a wrapped rtl chunk (possibly spanning multiple bidi parts),
        // it could be that the last bidi part is not on the last visual line,
        // since visual lines contain content order-consecutive chunks.
        // Thus, in rtl, we are looking for the first (content-order) character
        // in the rtl chunk that is on the last line (that is, the same line
        // as the last (content-order) character).
        if (part.level > 0 || cm.doc.direction == "rtl") {
          var prep = prepareMeasureForLine(cm, lineObj);
          ch = dir < 0 ? lineObj.text.length - 1 : 0;
          var targetTop = measureCharPrepared(cm, prep, ch).top;
          ch = findFirst(function (ch) { return measureCharPrepared(cm, prep, ch).top == targetTop; }, (dir < 0) == (part.level == 1) ? part.from : part.to - 1, ch);
          if (sticky == "before") { ch = moveCharLogically(lineObj, ch, 1); }
        } else { ch = dir < 0 ? part.to : part.from; }
        return new Pos(lineNo, ch, sticky)
      }
    }
    return new Pos(lineNo, dir < 0 ? lineObj.text.length : 0, dir < 0 ? "before" : "after")
  }

  function moveVisually(cm, line, start, dir) {
    var bidi = getOrder(line, cm.doc.direction);
    if (!bidi) { return moveLogically(line, start, dir) }
    if (start.ch >= line.text.length) {
      start.ch = line.text.length;
      start.sticky = "before";
    } else if (start.ch <= 0) {
      start.ch = 0;
      start.sticky = "after";
    }
    var partPos = getBidiPartAt(bidi, start.ch, start.sticky), part = bidi[partPos];
    if (cm.doc.direction == "ltr" && part.level % 2 == 0 && (dir > 0 ? part.to > start.ch : part.from < start.ch)) {
      // Case 1: We move within an ltr part in an ltr editor. Even with wrapped lines,
      // nothing interesting happens.
      return moveLogically(line, start, dir)
    }

    var mv = function (pos, dir) { return moveCharLogically(line, pos instanceof Pos ? pos.ch : pos, dir); };
    var prep;
    var getWrappedLineExtent = function (ch) {
      if (!cm.options.lineWrapping) { return {begin: 0, end: line.text.length} }
      prep = prep || prepareMeasureForLine(cm, line);
      return wrappedLineExtentChar(cm, line, prep, ch)
    };
    var wrappedLineExtent = getWrappedLineExtent(start.sticky == "before" ? mv(start, -1) : start.ch);

    if (cm.doc.direction == "rtl" || part.level == 1) {
      var moveInStorageOrder = (part.level == 1) == (dir < 0);
      var ch = mv(start, moveInStorageOrder ? 1 : -1);
      if (ch != null && (!moveInStorageOrder ? ch >= part.from && ch >= wrappedLineExtent.begin : ch <= part.to && ch <= wrappedLineExtent.end)) {
        // Case 2: We move within an rtl part or in an rtl editor on the same visual line
        var sticky = moveInStorageOrder ? "before" : "after";
        return new Pos(start.line, ch, sticky)
      }
    }

    // Case 3: Could not move within this bidi part in this visual line, so leave
    // the current bidi part

    var searchInVisualLine = function (partPos, dir, wrappedLineExtent) {
      var getRes = function (ch, moveInStorageOrder) { return moveInStorageOrder
        ? new Pos(start.line, mv(ch, 1), "before")
        : new Pos(start.line, ch, "after"); };

      for (; partPos >= 0 && partPos < bidi.length; partPos += dir) {
        var part = bidi[partPos];
        var moveInStorageOrder = (dir > 0) == (part.level != 1);
        var ch = moveInStorageOrder ? wrappedLineExtent.begin : mv(wrappedLineExtent.end, -1);
        if (part.from <= ch && ch < part.to) { return getRes(ch, moveInStorageOrder) }
        ch = moveInStorageOrder ? part.from : mv(part.to, -1);
        if (wrappedLineExtent.begin <= ch && ch < wrappedLineExtent.end) { return getRes(ch, moveInStorageOrder) }
      }
    };

    // Case 3a: Look for other bidi parts on the same visual line
    var res = searchInVisualLine(partPos + dir, dir, wrappedLineExtent);
    if (res) { return res }

    // Case 3b: Look for other bidi parts on the next visual line
    var nextCh = dir > 0 ? wrappedLineExtent.end : mv(wrappedLineExtent.begin, -1);
    if (nextCh != null && !(dir > 0 && nextCh == line.text.length)) {
      res = searchInVisualLine(dir > 0 ? 0 : bidi.length - 1, dir, getWrappedLineExtent(nextCh));
      if (res) { return res }
    }

    // Case 4: Nowhere to move
    return null
  }

  // Commands are parameter-less actions that can be performed on an
  // editor, mostly used for keybindings.
  var commands = {
    selectAll: selectAll,
    singleSelection: function (cm) { return cm.setSelection(cm.getCursor("anchor"), cm.getCursor("head"), sel_dontScroll); },
    killLine: function (cm) { return deleteNearSelection(cm, function (range) {
      if (range.empty()) {
        var len = getLine(cm.doc, range.head.line).text.length;
        if (range.head.ch == len && range.head.line < cm.lastLine())
          { return {from: range.head, to: Pos(range.head.line + 1, 0)} }
        else
          { return {from: range.head, to: Pos(range.head.line, len)} }
      } else {
        return {from: range.from(), to: range.to()}
      }
    }); },
    deleteLine: function (cm) { return deleteNearSelection(cm, function (range) { return ({
      from: Pos(range.from().line, 0),
      to: clipPos(cm.doc, Pos(range.to().line + 1, 0))
    }); }); },
    delLineLeft: function (cm) { return deleteNearSelection(cm, function (range) { return ({
      from: Pos(range.from().line, 0), to: range.from()
    }); }); },
    delWrappedLineLeft: function (cm) { return deleteNearSelection(cm, function (range) {
      var top = cm.charCoords(range.head, "div").top + 5;
      var leftPos = cm.coordsChar({left: 0, top: top}, "div");
      return {from: leftPos, to: range.from()}
    }); },
    delWrappedLineRight: function (cm) { return deleteNearSelection(cm, function (range) {
      var top = cm.charCoords(range.head, "div").top + 5;
      var rightPos = cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div");
      return {from: range.from(), to: rightPos }
    }); },
    undo: function (cm) { return cm.undo(); },
    redo: function (cm) { return cm.redo(); },
    undoSelection: function (cm) { return cm.undoSelection(); },
    redoSelection: function (cm) { return cm.redoSelection(); },
    goDocStart: function (cm) { return cm.extendSelection(Pos(cm.firstLine(), 0)); },
    goDocEnd: function (cm) { return cm.extendSelection(Pos(cm.lastLine())); },
    goLineStart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStart(cm, range.head.line); },
      {origin: "+move", bias: 1}
    ); },
    goLineStartSmart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStartSmart(cm, range.head); },
      {origin: "+move", bias: 1}
    ); },
    goLineEnd: function (cm) { return cm.extendSelectionsBy(function (range) { return lineEnd(cm, range.head.line); },
      {origin: "+move", bias: -1}
    ); },
    goLineRight: function (cm) { return cm.extendSelectionsBy(function (range) {
      var top = cm.cursorCoords(range.head, "div").top + 5;
      return cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div")
    }, sel_move); },
    goLineLeft: function (cm) { return cm.extendSelectionsBy(function (range) {
      var top = cm.cursorCoords(range.head, "div").top + 5;
      return cm.coordsChar({left: 0, top: top}, "div")
    }, sel_move); },
    goLineLeftSmart: function (cm) { return cm.extendSelectionsBy(function (range) {
      var top = cm.cursorCoords(range.head, "div").top + 5;
      var pos = cm.coordsChar({left: 0, top: top}, "div");
      if (pos.ch < cm.getLine(pos.line).search(/\S/)) { return lineStartSmart(cm, range.head) }
      return pos
    }, sel_move); },
    goLineUp: function (cm) { return cm.moveV(-1, "line"); },
    goLineDown: function (cm) { return cm.moveV(1, "line"); },
    goPageUp: function (cm) { return cm.moveV(-1, "page"); },
    goPageDown: function (cm) { return cm.moveV(1, "page"); },
    goCharLeft: function (cm) { return cm.moveH(-1, "char"); },
    goCharRight: function (cm) { return cm.moveH(1, "char"); },
    goColumnLeft: function (cm) { return cm.moveH(-1, "column"); },
    goColumnRight: function (cm) { return cm.moveH(1, "column"); },
    goWordLeft: function (cm) { return cm.moveH(-1, "word"); },
    goGroupRight: function (cm) { return cm.moveH(1, "group"); },
    goGroupLeft: function (cm) { return cm.moveH(-1, "group"); },
    goWordRight: function (cm) { return cm.moveH(1, "word"); },
    delCharBefore: function (cm) { return cm.deleteH(-1, "codepoint"); },
    delCharAfter: function (cm) { return cm.deleteH(1, "char"); },
    delWordBefore: function (cm) { return cm.deleteH(-1, "word"); },
    delWordAfter: function (cm) { return cm.deleteH(1, "word"); },
    delGroupBefore: function (cm) { return cm.deleteH(-1, "group"); },
    delGroupAfter: function (cm) { return cm.deleteH(1, "group"); },
    indentAuto: function (cm) { return cm.indentSelection("smart"); },
    indentMore: function (cm) { return cm.indentSelection("add"); },
    indentLess: function (cm) { return cm.indentSelection("subtract"); },
    insertTab: function (cm) { return cm.replaceSelection("\t"); },
    insertSoftTab: function (cm) {
      var spaces = [], ranges = cm.listSelections(), tabSize = cm.options.tabSize;
      for (var i = 0; i < ranges.length; i++) {
        var pos = ranges[i].from();
        var col = countColumn(cm.getLine(pos.line), pos.ch, tabSize);
        spaces.push(spaceStr(tabSize - col % tabSize));
      }
      cm.replaceSelections(spaces);
    },
    defaultTab: function (cm) {
      if (cm.somethingSelected()) { cm.indentSelection("add"); }
      else { cm.execCommand("insertTab"); }
    },
    // Swap the two chars left and right of each selection's head.
    // Move cursor behind the two swapped characters afterwards.
    //
    // Doesn't consider line feeds a character.
    // Doesn't scan more than one line above to find a character.
    // Doesn't do anything on an empty line.
    // Doesn't do anything with non-empty selections.
    transposeChars: function (cm) { return runInOp(cm, function () {
      var ranges = cm.listSelections(), newSel = [];
      for (var i = 0; i < ranges.length; i++) {
        if (!ranges[i].empty()) { continue }
        var cur = ranges[i].head, line = getLine(cm.doc, cur.line).text;
        if (line) {
          if (cur.ch == line.length) { cur = new Pos(cur.line, cur.ch - 1); }
          if (cur.ch > 0) {
            cur = new Pos(cur.line, cur.ch + 1);
            cm.replaceRange(line.charAt(cur.ch - 1) + line.charAt(cur.ch - 2),
                            Pos(cur.line, cur.ch - 2), cur, "+transpose");
          } else if (cur.line > cm.doc.first) {
            var prev = getLine(cm.doc, cur.line - 1).text;
            if (prev) {
              cur = new Pos(cur.line, 1);
              cm.replaceRange(line.charAt(0) + cm.doc.lineSeparator() +
                              prev.charAt(prev.length - 1),
                              Pos(cur.line - 1, prev.length - 1), cur, "+transpose");
            }
          }
        }
        newSel.push(new Range(cur, cur));
      }
      cm.setSelections(newSel);
    }); },
    newlineAndIndent: function (cm) { return runInOp(cm, function () {
      var sels = cm.listSelections();
      for (var i = sels.length - 1; i >= 0; i--)
        { cm.replaceRange(cm.doc.lineSeparator(), sels[i].anchor, sels[i].head, "+input"); }
      sels = cm.listSelections();
      for (var i$1 = 0; i$1 < sels.length; i$1++)
        { cm.indentLine(sels[i$1].from().line, null, true); }
      ensureCursorVisible(cm);
    }); },
    openLine: function (cm) { return cm.replaceSelection("\n", "start"); },
    toggleOverwrite: function (cm) { return cm.toggleOverwrite(); }
  };


  function lineStart(cm, lineN) {
    var line = getLine(cm.doc, lineN);
    var visual = visualLine(line);
    if (visual != line) { lineN = lineNo(visual); }
    return endOfLine(true, cm, visual, lineN, 1)
  }
  function lineEnd(cm, lineN) {
    var line = getLine(cm.doc, lineN);
    var visual = visualLineEnd(line);
    if (visual != line) { lineN = lineNo(visual); }
    return endOfLine(true, cm, line, lineN, -1)
  }
  function lineStartSmart(cm, pos) {
    var start = lineStart(cm, pos.line);
    var line = getLine(cm.doc, start.line);
    var order = getOrder(line, cm.doc.direction);
    if (!order || order[0].level == 0) {
      var firstNonWS = Math.max(start.ch, line.text.search(/\S/));
      var inWS = pos.line == start.line && pos.ch <= firstNonWS && pos.ch;
      return Pos(start.line, inWS ? 0 : firstNonWS, start.sticky)
    }
    return start
  }

  // Run a handler that was bound to a key.
  function doHandleBinding(cm, bound, dropShift) {
    if (typeof bound == "string") {
      bound = commands[bound];
      if (!bound) { return false }
    }
    // Ensure previous input has been read, so that the handler sees a
    // consistent view of the document
    cm.display.input.ensurePolled();
    var prevShift = cm.display.shift, done = false;
    try {
      if (cm.isReadOnly()) { cm.state.suppressEdits = true; }
      if (dropShift) { cm.display.shift = false; }
      done = bound(cm) != Pass;
    } finally {
      cm.display.shift = prevShift;
      cm.state.suppressEdits = false;
    }
    return done
  }

  function lookupKeyForEditor(cm, name, handle) {
    for (var i = 0; i < cm.state.keyMaps.length; i++) {
      var result = lookupKey(name, cm.state.keyMaps[i], handle, cm);
      if (result) { return result }
    }
    return (cm.options.extraKeys && lookupKey(name, cm.options.extraKeys, handle, cm))
      || lookupKey(name, cm.options.keyMap, handle, cm)
  }

  // Note that, despite the name, this function is also used to check
  // for bound mouse clicks.

  var stopSeq = new Delayed;

  function dispatchKey(cm, name, e, handle) {
    var seq = cm.state.keySeq;
    if (seq) {
      if (isModifierKey(name)) { return "handled" }
      if (/\'$/.test(name))
        { cm.state.keySeq = null; }
      else
        { stopSeq.set(50, function () {
          if (cm.state.keySeq == seq) {
            cm.state.keySeq = null;
            cm.display.input.reset();
          }
        }); }
      if (dispatchKeyInner(cm, seq + " " + name, e, handle)) { return true }
    }
    return dispatchKeyInner(cm, name, e, handle)
  }

  function dispatchKeyInner(cm, name, e, handle) {
    var result = lookupKeyForEditor(cm, name, handle);

    if (result == "multi")
      { cm.state.keySeq = name; }
    if (result == "handled")
      { signalLater(cm, "keyHandled", cm, name, e); }

    if (result == "handled" || result == "multi") {
      e_preventDefault(e);
      restartBlink(cm);
    }

    return !!result
  }

  // Handle a key from the keydown event.
  function handleKeyBinding(cm, e) {
    var name = keyName(e, true);
    if (!name) { return false }

    if (e.shiftKey && !cm.state.keySeq) {
      // First try to resolve full name (including 'Shift-'). Failing
      // that, see if there is a cursor-motion command (starting with
      // 'go') bound to the keyname without 'Shift-'.
      return dispatchKey(cm, "Shift-" + name, e, function (b) { return doHandleBinding(cm, b, true); })
          || dispatchKey(cm, name, e, function (b) {
               if (typeof b == "string" ? /^go[A-Z]/.test(b) : b.motion)
                 { return doHandleBinding(cm, b) }
             })
    } else {
      return dispatchKey(cm, name, e, function (b) { return doHandleBinding(cm, b); })
    }
  }

  // Handle a key from the keypress event
  function handleCharBinding(cm, e, ch) {
    return dispatchKey(cm, "'" + ch + "'", e, function (b) { return doHandleBinding(cm, b, true); })
  }

  var lastStoppedKey = null;
  function onKeyDown(e) {
    var cm = this;
    if (e.target && e.target != cm.display.input.getField()) { return }
    cm.curOp.focus = activeElt();
    if (signalDOMEvent(cm, e)) { return }
    // IE does strange things with escape.
    if (ie && ie_version < 11 && e.keyCode == 27) { e.returnValue = false; }
    var code = e.keyCode;
    cm.display.shift = code == 16 || e.shiftKey;
    var handled = handleKeyBinding(cm, e);
    if (presto) {
      lastStoppedKey = handled ? code : null;
      // Opera has no cut event... we try to at least catch the key combo
      if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey))
        { cm.replaceSelection("", null, "cut"); }
    }
    if (gecko && !mac && !handled && code == 46 && e.shiftKey && !e.ctrlKey && document.execCommand)
      { document.execCommand("cut"); }

    // Turn mouse into crosshair when Alt is held on Mac.
    if (code == 18 && !/\bCodeMirror-crosshair\b/.test(cm.display.lineDiv.className))
      { showCrossHair(cm); }
  }

  function showCrossHair(cm) {
    var lineDiv = cm.display.lineDiv;
    addClass(lineDiv, "CodeMirror-crosshair");

    function up(e) {
      if (e.keyCode == 18 || !e.altKey) {
        rmClass(lineDiv, "CodeMirror-crosshair");
        off(document, "keyup", up);
        off(document, "mouseover", up);
      }
    }
    on(document, "keyup", up);
    on(document, "mouseover", up);
  }

  function onKeyUp(e) {
    if (e.keyCode == 16) { this.doc.sel.shift = false; }
    signalDOMEvent(this, e);
  }

  function onKeyPress(e) {
    var cm = this;
    if (e.target && e.target != cm.display.input.getField()) { return }
    if (eventInWidget(cm.display, e) || signalDOMEvent(cm, e) || e.ctrlKey && !e.altKey || mac && e.metaKey) { return }
    var keyCode = e.keyCode, charCode = e.charCode;
    if (presto && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return}
    if ((presto && (!e.which || e.which < 10)) && handleKeyBinding(cm, e)) { return }
    var ch = String.fromCharCode(charCode == null ? keyCode : charCode);
    // Some browsers fire keypress events for backspace
    if (ch == "\x08") { return }
    if (handleCharBinding(cm, e, ch)) { return }
    cm.display.input.onKeyPress(e);
  }

  var DOUBLECLICK_DELAY = 400;

  var PastClick = function(time, pos, button) {
    this.time = time;
    this.pos = pos;
    this.button = button;
  };

  PastClick.prototype.compare = function (time, pos, button) {
    return this.time + DOUBLECLICK_DELAY > time &&
      cmp(pos, this.pos) == 0 && button == this.button
  };

  var lastClick, lastDoubleClick;
  function clickRepeat(pos, button) {
    var now = +new Date;
    if (lastDoubleClick && lastDoubleClick.compare(now, pos, button)) {
      lastClick = lastDoubleClick = null;
      return "triple"
    } else if (lastClick && lastClick.compare(now, pos, button)) {
      lastDoubleClick = new PastClick(now, pos, button);
      lastClick = null;
      return "double"
    } else {
      lastClick = new PastClick(now, pos, button);
      lastDoubleClick = null;
      return "single"
    }
  }

  // A mouse down can be a single click, double click, triple click,
  // start of selection drag, start of text drag, new cursor
  // (ctrl-click), rectangle drag (alt-drag), or xwin
  // middle-click-paste. Or it might be a click on something we should
  // not interfere with, such as a scrollbar or widget.
  function onMouseDown(e) {
    var cm = this, display = cm.display;
    if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return }
    display.input.ensurePolled();
    display.shift = e.shiftKey;

    if (eventInWidget(display, e)) {
      if (!webkit) {
        // Briefly turn off draggability, to allow widgets to do
        // normal dragging things.
        display.scroller.draggable = false;
        setTimeout(function () { return display.scroller.draggable = true; }, 100);
      }
      return
    }
    if (clickInGutter(cm, e)) { return }
    var pos = posFromMouse(cm, e), button = e_button(e), repeat = pos ? clickRepeat(pos, button) : "single";
    window.focus();

    // #3261: make sure, that we're not starting a second selection
    if (button == 1 && cm.state.selectingText)
      { cm.state.selectingText(e); }

    if (pos && handleMappedButton(cm, button, pos, repeat, e)) { return }

    if (button == 1) {
      if (pos) { leftButtonDown(cm, pos, repeat, e); }
      else if (e_target(e) == display.scroller) { e_preventDefault(e); }
    } else if (button == 2) {
      if (pos) { extendSelection(cm.doc, pos); }
      setTimeout(function () { return display.input.focus(); }, 20);
    } else if (button == 3) {
      if (captureRightClick) { cm.display.input.onContextMenu(e); }
      else { delayBlurEvent(cm); }
    }
  }

  function handleMappedButton(cm, button, pos, repeat, event) {
    var name = "Click";
    if (repeat == "double") { name = "Double" + name; }
    else if (repeat == "triple") { name = "Triple" + name; }
    name = (button == 1 ? "Left" : button == 2 ? "Middle" : "Right") + name;

    return dispatchKey(cm,  addModifierNames(name, event), event, function (bound) {
      if (typeof bound == "string") { bound = commands[bound]; }
      if (!bound) { return false }
      var done = false;
      try {
        if (cm.isReadOnly()) { cm.state.suppressEdits = true; }
        done = bound(cm, pos) != Pass;
      } finally {
        cm.state.suppressEdits = false;
      }
      return done
    })
  }

  function configureMouse(cm, repeat, event) {
    var option = cm.getOption("configureMouse");
    var value = option ? option(cm, repeat, event) : {};
    if (value.unit == null) {
      var rect = chromeOS ? event.shiftKey && event.metaKey : event.altKey;
      value.unit = rect ? "rectangle" : repeat == "single" ? "char" : repeat == "double" ? "word" : "line";
    }
    if (value.extend == null || cm.doc.extend) { value.extend = cm.doc.extend || event.shiftKey; }
    if (value.addNew == null) { value.addNew = mac ? event.metaKey : event.ctrlKey; }
    if (value.moveOnDrag == null) { value.moveOnDrag = !(mac ? event.altKey : event.ctrlKey); }
    return value
  }

  function leftButtonDown(cm, pos, repeat, event) {
    if (ie) { setTimeout(bind(ensureFocus, cm), 0); }
    else { cm.curOp.focus = activeElt(); }

    var behavior = configureMouse(cm, repeat, event);

    var sel = cm.doc.sel, contained;
    if (cm.options.dragDrop && dragAndDrop && !cm.isReadOnly() &&
        repeat == "single" && (contained = sel.contains(pos)) > -1 &&
        (cmp((contained = sel.ranges[contained]).from(), pos) < 0 || pos.xRel > 0) &&
        (cmp(contained.to(), pos) > 0 || pos.xRel < 0))
      { leftButtonStartDrag(cm, event, pos, behavior); }
    else
      { leftButtonSelect(cm, event, pos, behavior); }
  }

  // Start a text drag. When it ends, see if any dragging actually
  // happen, and treat as a click if it didn't.
  function leftButtonStartDrag(cm, event, pos, behavior) {
    var display = cm.display, moved = false;
    var dragEnd = operation(cm, function (e) {
      if (webkit) { display.scroller.draggable = false; }
      cm.state.draggingText = false;
      if (cm.state.delayingBlurEvent) {
        if (cm.hasFocus()) { cm.state.delayingBlurEvent = false; }
        else { delayBlurEvent(cm); }
      }
      off(display.wrapper.ownerDocument, "mouseup", dragEnd);
      off(display.wrapper.ownerDocument, "mousemove", mouseMove);
      off(display.scroller, "dragstart", dragStart);
      off(display.scroller, "drop", dragEnd);
      if (!moved) {
        e_preventDefault(e);
        if (!behavior.addNew)
          { extendSelection(cm.doc, pos, null, null, behavior.extend); }
        // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)
        if ((webkit && !safari) || ie && ie_version == 9)
          { setTimeout(function () {display.wrapper.ownerDocument.body.focus({preventScroll: true}); display.input.focus();}, 20); }
        else
          { display.input.focus(); }
      }
    });
    var mouseMove = function(e2) {
      moved = moved || Math.abs(event.clientX - e2.clientX) + Math.abs(event.clientY - e2.clientY) >= 10;
    };
    var dragStart = function () { return moved = true; };
    // Let the drag handler handle this.
    if (webkit) { display.scroller.draggable = true; }
    cm.state.draggingText = dragEnd;
    dragEnd.copy = !behavior.moveOnDrag;
    on(display.wrapper.ownerDocument, "mouseup", dragEnd);
    on(display.wrapper.ownerDocument, "mousemove", mouseMove);
    on(display.scroller, "dragstart", dragStart);
    on(display.scroller, "drop", dragEnd);

    cm.state.delayingBlurEvent = true;
    setTimeout(function () { return display.input.focus(); }, 20);
    // IE's approach to draggable
    if (display.scroller.dragDrop) { display.scroller.dragDrop(); }
  }

  function rangeForUnit(cm, pos, unit) {
    if (unit == "char") { return new Range(pos, pos) }
    if (unit == "word") { return cm.findWordAt(pos) }
    if (unit == "line") { return new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0))) }
    var result = unit(cm, pos);
    return new Range(result.from, result.to)
  }

  // Normal selection, as opposed to text dragging.
  function leftButtonSelect(cm, event, start, behavior) {
    if (ie) { delayBlurEvent(cm); }
    var display = cm.display, doc = cm.doc;
    e_preventDefault(event);

    var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;
    if (behavior.addNew && !behavior.extend) {
      ourIndex = doc.sel.contains(start);
      if (ourIndex > -1)
        { ourRange = ranges[ourIndex]; }
      else
        { ourRange = new Range(start, start); }
    } else {
      ourRange = doc.sel.primary();
      ourIndex = doc.sel.primIndex;
    }

    if (behavior.unit == "rectangle") {
      if (!behavior.addNew) { ourRange = new Range(start, start); }
      start = posFromMouse(cm, event, true, true);
      ourIndex = -1;
    } else {
      var range = rangeForUnit(cm, start, behavior.unit);
      if (behavior.extend)
        { ourRange = extendRange(ourRange, range.anchor, range.head, behavior.extend); }
      else
        { ourRange = range; }
    }

    if (!behavior.addNew) {
      ourIndex = 0;
      setSelection(doc, new Selection([ourRange], 0), sel_mouse);
      startSel = doc.sel;
    } else if (ourIndex == -1) {
      ourIndex = ranges.length;
      setSelection(doc, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex),
                   {scroll: false, origin: "*mouse"});
    } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == "char" && !behavior.extend) {
      setSelection(doc, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),
                   {scroll: false, origin: "*mouse"});
      startSel = doc.sel;
    } else {
      replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);
    }

    var lastPos = start;
    function extendTo(pos) {
      if (cmp(lastPos, pos) == 0) { return }
      lastPos = pos;

      if (behavior.unit == "rectangle") {
        var ranges = [], tabSize = cm.options.tabSize;
        var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);
        var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);
        var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);
        for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));
             line <= end; line++) {
          var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);
          if (left == right)
            { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }
          else if (text.length > leftPos)
            { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }
        }
        if (!ranges.length) { ranges.push(new Range(start, start)); }
        setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),
                     {origin: "*mouse", scroll: false});
        cm.scrollIntoView(pos);
      } else {
        var oldRange = ourRange;
        var range = rangeForUnit(cm, pos, behavior.unit);
        var anchor = oldRange.anchor, head;
        if (cmp(range.anchor, anchor) > 0) {
          head = range.head;
          anchor = minPos(oldRange.from(), range.anchor);
        } else {
          head = range.anchor;
          anchor = maxPos(oldRange.to(), range.head);
        }
        var ranges$1 = startSel.ranges.slice(0);
        ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));
        setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse);
      }
    }

    var editorSize = display.wrapper.getBoundingClientRect();
    // Used to ensure timeout re-tries don't fire when another extend
    // happened in the meantime (clearTimeout isn't reliable -- at
    // least on Chrome, the timeouts still happen even when cleared,
    // if the clear happens after their scheduled firing time).
    var counter = 0;

    function extend(e) {
      var curCount = ++counter;
      var cur = posFromMouse(cm, e, true, behavior.unit == "rectangle");
      if (!cur) { return }
      if (cmp(cur, lastPos) != 0) {
        cm.curOp.focus = activeElt();
        extendTo(cur);
        var visible = visibleLines(display, doc);
        if (cur.line >= visible.to || cur.line < visible.from)
          { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }
      } else {
        var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;
        if (outside) { setTimeout(operation(cm, function () {
          if (counter != curCount) { return }
          display.scroller.scrollTop += outside;
          extend(e);
        }), 50); }
      }
    }

    function done(e) {
      cm.state.selectingText = false;
      counter = Infinity;
      // If e is null or undefined we interpret this as someone trying
      // to explicitly cancel the selection rather than the user
      // letting go of the mouse button.
      if (e) {
        e_preventDefault(e);
        display.input.focus();
      }
      off(display.wrapper.ownerDocument, "mousemove", move);
      off(display.wrapper.ownerDocument, "mouseup", up);
      doc.history.lastSelOrigin = null;
    }

    var move = operation(cm, function (e) {
      if (e.buttons === 0 || !e_button(e)) { done(e); }
      else { extend(e); }
    });
    var up = operation(cm, done);
    cm.state.selectingText = up;
    on(display.wrapper.ownerDocument, "mousemove", move);
    on(display.wrapper.ownerDocument, "mouseup", up);
  }

  // Used when mouse-selecting to adjust the anchor to the proper side
  // of a bidi jump depending on the visual position of the head.
  function bidiSimplify(cm, range) {
    var anchor = range.anchor;
    var head = range.head;
    var anchorLine = getLine(cm.doc, anchor.line);
    if (cmp(anchor, head) == 0 && anchor.sticky == head.sticky) { return range }
    var order = getOrder(anchorLine);
    if (!order) { return range }
    var index = getBidiPartAt(order, anchor.ch, anchor.sticky), part = order[index];
    if (part.from != anchor.ch && part.to != anchor.ch) { return range }
    var boundary = index + ((part.from == anchor.ch) == (part.level != 1) ? 0 : 1);
    if (boundary == 0 || boundary == order.length) { return range }

    // Compute the relative visual position of the head compared to the
    // anchor (<0 is to the left, >0 to the right)
    var leftSide;
    if (head.line != anchor.line) {
      leftSide = (head.line - anchor.line) * (cm.doc.direction == "ltr" ? 1 : -1) > 0;
    } else {
      var headIndex = getBidiPartAt(order, head.ch, head.sticky);
      var dir = headIndex - index || (head.ch - anchor.ch) * (part.level == 1 ? -1 : 1);
      if (headIndex == boundary - 1 || headIndex == boundary)
        { leftSide = dir < 0; }
      else
        { leftSide = dir > 0; }
    }

    var usePart = order[boundary + (leftSide ? -1 : 0)];
    var from = leftSide == (usePart.level == 1);
    var ch = from ? usePart.from : usePart.to, sticky = from ? "after" : "before";
    return anchor.ch == ch && anchor.sticky == sticky ? range : new Range(new Pos(anchor.line, ch, sticky), head)
  }


  // Determines whether an event happened in the gutter, and fires the
  // handlers for the corresponding event.
  function gutterEvent(cm, e, type, prevent) {
    var mX, mY;
    if (e.touches) {
      mX = e.touches[0].clientX;
      mY = e.touches[0].clientY;
    } else {
      try { mX = e.clientX; mY = e.clientY; }
      catch(e$1) { return false }
    }
    if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }
    if (prevent) { e_preventDefault(e); }

    var display = cm.display;
    var lineBox = display.lineDiv.getBoundingClientRect();

    if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }
    mY -= lineBox.top - display.viewOffset;

    for (var i = 0; i < cm.display.gutterSpecs.length; ++i) {
      var g = display.gutters.childNodes[i];
      if (g && g.getBoundingClientRect().right >= mX) {
        var line = lineAtHeight(cm.doc, mY);
        var gutter = cm.display.gutterSpecs[i];
        signal(cm, type, cm, line, gutter.className, e);
        return e_defaultPrevented(e)
      }
    }
  }

  function clickInGutter(cm, e) {
    return gutterEvent(cm, e, "gutterClick", true)
  }

  // CONTEXT MENU HANDLING

  // To make the context menu work, we need to briefly unhide the
  // textarea (making it as unobtrusive as possible) to let the
  // right-click take effect on it.
  function onContextMenu(cm, e) {
    if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) { return }
    if (signalDOMEvent(cm, e, "contextmenu")) { return }
    if (!captureRightClick) { cm.display.input.onContextMenu(e); }
  }

  function contextMenuInGutter(cm, e) {
    if (!hasHandler(cm, "gutterContextMenu")) { return false }
    return gutterEvent(cm, e, "gutterContextMenu", false)
  }

  function themeChanged(cm) {
    cm.display.wrapper.className = cm.display.wrapper.className.replace(/\s*cm-s-\S+/g, "") +
      cm.options.theme.replace(/(^|\s)\s*/g, " cm-s-");
    clearCaches(cm);
  }

  var Init = {toString: function(){return "CodeMirror.Init"}};

  var defaults = {};
  var optionHandlers = {};

  function defineOptions(CodeMirror) {
    var optionHandlers = CodeMirror.optionHandlers;

    function option(name, deflt, handle, notOnInit) {
      CodeMirror.defaults[name] = deflt;
      if (handle) { optionHandlers[name] =
        notOnInit ? function (cm, val, old) {if (old != Init) { handle(cm, val, old); }} : handle; }
    }

    CodeMirror.defineOption = option;

    // Passed to option handlers when there is no old value.
    CodeMirror.Init = Init;

    // These two are, on init, called from the constructor because they
    // have to be initialized before the editor can start at all.
    option("value", "", function (cm, val) { return cm.setValue(val); }, true);
    option("mode", null, function (cm, val) {
      cm.doc.modeOption = val;
      loadMode(cm);
    }, true);

    option("indentUnit", 2, loadMode, true);
    option("indentWithTabs", false);
    option("smartIndent", true);
    option("tabSize", 4, function (cm) {
      resetModeState(cm);
      clearCaches(cm);
      regChange(cm);
    }, true);

    option("lineSeparator", null, function (cm, val) {
      cm.doc.lineSep = val;
      if (!val) { return }
      var newBreaks = [], lineNo = cm.doc.first;
      cm.doc.iter(function (line) {
        for (var pos = 0;;) {
          var found = line.text.indexOf(val, pos);
          if (found == -1) { break }
          pos = found + val.length;
          newBreaks.push(Pos(lineNo, found));
        }
        lineNo++;
      });
      for (var i = newBreaks.length - 1; i >= 0; i--)
        { replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length)); }
    });
    option("specialChars", /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g, function (cm, val, old) {
      cm.state.specialChars = new RegExp(val.source + (val.test("\t") ? "" : "|\t"), "g");
      if (old != Init) { cm.refresh(); }
    });
    option("specialCharPlaceholder", defaultSpecialCharPlaceholder, function (cm) { return cm.refresh(); }, true);
    option("electricChars", true);
    option("inputStyle", mobile ? "contenteditable" : "textarea", function () {
      throw new Error("inputStyle can not (yet) be changed in a running editor") // FIXME
    }, true);
    option("spellcheck", false, function (cm, val) { return cm.getInputField().spellcheck = val; }, true);
    option("autocorrect", false, function (cm, val) { return cm.getInputField().autocorrect = val; }, true);
    option("autocapitalize", false, function (cm, val) { return cm.getInputField().autocapitalize = val; }, true);
    option("rtlMoveVisually", !windows);
    option("wholeLineUpdateBefore", true);

    option("theme", "default", function (cm) {
      themeChanged(cm);
      updateGutters(cm);
    }, true);
    option("keyMap", "default", function (cm, val, old) {
      var next = getKeyMap(val);
      var prev = old != Init && getKeyMap(old);
      if (prev && prev.detach) { prev.detach(cm, next); }
      if (next.attach) { next.attach(cm, prev || null); }
    });
    option("extraKeys", null);
    option("configureMouse", null);

    option("lineWrapping", false, wrappingChanged, true);
    option("gutters", [], function (cm, val) {
      cm.display.gutterSpecs = getGutters(val, cm.options.lineNumbers);
      updateGutters(cm);
    }, true);
    option("fixedGutter", true, function (cm, val) {
      cm.display.gutters.style.left = val ? compensateForHScroll(cm.display) + "px" : "0";
      cm.refresh();
    }, true);
    option("coverGutterNextToScrollbar", false, function (cm) { return updateScrollbars(cm); }, true);
    option("scrollbarStyle", "native", function (cm) {
      initScrollbars(cm);
      updateScrollbars(cm);
      cm.display.scrollbars.setScrollTop(cm.doc.scrollTop);
      cm.display.scrollbars.setScrollLeft(cm.doc.scrollLeft);
    }, true);
    option("lineNumbers", false, function (cm, val) {
      cm.display.gutterSpecs = getGutters(cm.options.gutters, val);
      updateGutters(cm);
    }, true);
    option("firstLineNumber", 1, updateGutters, true);
    option("lineNumberFormatter", function (integer) { return integer; }, updateGutters, true);
    option("showCursorWhenSelecting", false, updateSelection, true);

    option("resetSelectionOnContextMenu", true);
    option("lineWiseCopyCut", true);
    option("pasteLinesPerSelection", true);
    option("selectionsMayTouch", false);

    option("readOnly", false, function (cm, val) {
      if (val == "nocursor") {
        onBlur(cm);
        cm.display.input.blur();
      }
      cm.display.input.readOnlyChanged(val);
    });

    option("screenReaderLabel", null, function (cm, val) {
      val = (val === '') ? null : val;
      cm.display.input.screenReaderLabelChanged(val);
    });

    option("disableInput", false, function (cm, val) {if (!val) { cm.display.input.reset(); }}, true);
    option("dragDrop", true, dragDropChanged);
    option("allowDropFileTypes", null);

    option("cursorBlinkRate", 530);
    option("cursorScrollMargin", 0);
    option("cursorHeight", 1, updateSelection, true);
    option("singleCursorHeightPerLine", true, updateSelection, true);
    option("workTime", 100);
    option("workDelay", 100);
    option("flattenSpans", true, resetModeState, true);
    option("addModeClass", false, resetModeState, true);
    option("pollInterval", 100);
    option("undoDepth", 200, function (cm, val) { return cm.doc.history.undoDepth = val; });
    option("historyEventDelay", 1250);
    option("viewportMargin", 10, function (cm) { return cm.refresh(); }, true);
    option("maxHighlightLength", 10000, resetModeState, true);
    option("moveInputWithCursor", true, function (cm, val) {
      if (!val) { cm.display.input.resetPosition(); }
    });

    option("tabindex", null, function (cm, val) { return cm.display.input.getField().tabIndex = val || ""; });
    option("autofocus", null);
    option("direction", "ltr", function (cm, val) { return cm.doc.setDirection(val); }, true);
    option("phrases", null);
  }

  function dragDropChanged(cm, value, old) {
    var wasOn = old && old != Init;
    if (!value != !wasOn) {
      var funcs = cm.display.dragFunctions;
      var toggle = value ? on : off;
      toggle(cm.display.scroller, "dragstart", funcs.start);
      toggle(cm.display.scroller, "dragenter", funcs.enter);
      toggle(cm.display.scroller, "dragover", funcs.over);
      toggle(cm.display.scroller, "dragleave", funcs.leave);
      toggle(cm.display.scroller, "drop", funcs.drop);
    }
  }

  function wrappingChanged(cm) {
    if (cm.options.lineWrapping) {
      addClass(cm.display.wrapper, "CodeMirror-wrap");
      cm.display.sizer.style.minWidth = "";
      cm.display.sizerWidth = null;
    } else {
      rmClass(cm.display.wrapper, "CodeMirror-wrap");
      findMaxLine(cm);
    }
    estimateLineHeights(cm);
    regChange(cm);
    clearCaches(cm);
    setTimeout(function () { return updateScrollbars(cm); }, 100);
  }

  // A CodeMirror instance represents an editor. This is the object
  // that user code is usually dealing with.

  function CodeMirror(place, options) {
    var this$1 = this;

    if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }

    this.options = options = options ? copyObj(options) : {};
    // Determine effective options based on given values and defaults.
    copyObj(defaults, options, false);

    var doc = options.value;
    if (typeof doc == "string") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }
    else if (options.mode) { doc.modeOption = options.mode; }
    this.doc = doc;

    var input = new CodeMirror.inputStyles[options.inputStyle](this);
    var display = this.display = new Display(place, doc, input, options);
    display.wrapper.CodeMirror = this;
    themeChanged(this);
    if (options.lineWrapping)
      { this.display.wrapper.className += " CodeMirror-wrap"; }
    initScrollbars(this);

    this.state = {
      keyMaps: [],  // stores maps added by addKeyMap
      overlays: [], // highlighting overlays, as added by addOverlay
      modeGen: 0,   // bumped when mode/overlay changes, used to invalidate highlighting info
      overwrite: false,
      delayingBlurEvent: false,
      focused: false,
      suppressEdits: false, // used to disable editing during key handlers when in readOnly mode
      pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll
      selectingText: false,
      draggingText: false,
      highlight: new Delayed(), // stores highlight worker timeout
      keySeq: null,  // Unfinished key sequence
      specialChars: null
    };

    if (options.autofocus && !mobile) { display.input.focus(); }

    // Override magic textarea content restore that IE sometimes does
    // on our hidden textarea on reload
    if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }

    registerEventHandlers(this);
    ensureGlobalHandlers();

    startOperation(this);
    this.curOp.forceUpdate = true;
    attachDoc(this, doc);

    if ((options.autofocus && !mobile) || this.hasFocus())
      { setTimeout(function () {
        if (this$1.hasFocus() && !this$1.state.focused) { onFocus(this$1); }
      }, 20); }
    else
      { onBlur(this); }

    for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))
      { optionHandlers[opt](this, options[opt], Init); } }
    maybeUpdateLineNumberWidth(this);
    if (options.finishInit) { options.finishInit(this); }
    for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this); }
    endOperation(this);
    // Suppress optimizelegibility in Webkit, since it breaks text
    // measuring on line wrapping boundaries.
    if (webkit && options.lineWrapping &&
        getComputedStyle(display.lineDiv).textRendering == "optimizelegibility")
      { display.lineDiv.style.textRendering = "auto"; }
  }

  // The default configuration options.
  CodeMirror.defaults = defaults;
  // Functions to run when options are changed.
  CodeMirror.optionHandlers = optionHandlers;

  // Attach the necessary event handlers when initializing the editor
  function registerEventHandlers(cm) {
    var d = cm.display;
    on(d.scroller, "mousedown", operation(cm, onMouseDown));
    // Older IE's will not fire a second mousedown for a double click
    if (ie && ie_version < 11)
      { on(d.scroller, "dblclick", operation(cm, function (e) {
        if (signalDOMEvent(cm, e)) { return }
        var pos = posFromMouse(cm, e);
        if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) { return }
        e_preventDefault(e);
        var word = cm.findWordAt(pos);
        extendSelection(cm.doc, word.anchor, word.head);
      })); }
    else
      { on(d.scroller, "dblclick", function (e) { return signalDOMEvent(cm, e) || e_preventDefault(e); }); }
    // Some browsers fire contextmenu *after* opening the menu, at
    // which point we can't mess with it anymore. Context menu is
    // handled in onMouseDown for these browsers.
    on(d.scroller, "contextmenu", function (e) { return onContextMenu(cm, e); });
    on(d.input.getField(), "contextmenu", function (e) {
      if (!d.scroller.contains(e.target)) { onContextMenu(cm, e); }
    });

    // Used to suppress mouse event handling when a touch happens
    var touchFinished, prevTouch = {end: 0};
    function finishTouch() {
      if (d.activeTouch) {
        touchFinished = setTimeout(function () { return d.activeTouch = null; }, 1000);
        prevTouch = d.activeTouch;
        prevTouch.end = +new Date;
      }
    }
    function isMouseLikeTouchEvent(e) {
      if (e.touches.length != 1) { return false }
      var touch = e.touches[0];
      return touch.radiusX <= 1 && touch.radiusY <= 1
    }
    function farAway(touch, other) {
      if (other.left == null) { return true }
      var dx = other.left - touch.left, dy = other.top - touch.top;
      return dx * dx + dy * dy > 20 * 20
    }
    on(d.scroller, "touchstart", function (e) {
      if (!signalDOMEvent(cm, e) && !isMouseLikeTouchEvent(e) && !clickInGutter(cm, e)) {
        d.input.ensurePolled();
        clearTimeout(touchFinished);
        var now = +new Date;
        d.activeTouch = {start: now, moved: false,
                         prev: now - prevTouch.end <= 300 ? prevTouch : null};
        if (e.touches.length == 1) {
          d.activeTouch.left = e.touches[0].pageX;
          d.activeTouch.top = e.touches[0].pageY;
        }
      }
    });
    on(d.scroller, "touchmove", function () {
      if (d.activeTouch) { d.activeTouch.moved = true; }
    });
    on(d.scroller, "touchend", function (e) {
      var touch = d.activeTouch;
      if (touch && !eventInWidget(d, e) && touch.left != null &&
          !touch.moved && new Date - touch.start < 300) {
        var pos = cm.coordsChar(d.activeTouch, "page"), range;
        if (!touch.prev || farAway(touch, touch.prev)) // Single tap
          { range = new Range(pos, pos); }
        else if (!touch.prev.prev || farAway(touch, touch.prev.prev)) // Double tap
          { range = cm.findWordAt(pos); }
        else // Triple tap
          { range = new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0))); }
        cm.setSelection(range.anchor, range.head);
        cm.focus();
        e_preventDefault(e);
      }
      finishTouch();
    });
    on(d.scroller, "touchcancel", finishTouch);

    // Sync scrolling between fake scrollbars and real scrollable
    // area, ensure viewport is updated when scrolling.
    on(d.scroller, "scroll", function () {
      if (d.scroller.clientHeight) {
        updateScrollTop(cm, d.scroller.scrollTop);
        setScrollLeft(cm, d.scroller.scrollLeft, true);
        signal(cm, "scroll", cm);
      }
    });

    // Listen to wheel events in order to try and update the viewport on time.
    on(d.scroller, "mousewheel", function (e) { return onScrollWheel(cm, e); });
    on(d.scroller, "DOMMouseScroll", function (e) { return onScrollWheel(cm, e); });

    // Prevent wrapper from ever scrolling
    on(d.wrapper, "scroll", function () { return d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; });

    d.dragFunctions = {
      enter: function (e) {if (!signalDOMEvent(cm, e)) { e_stop(e); }},
      over: function (e) {if (!signalDOMEvent(cm, e)) { onDragOver(cm, e); e_stop(e); }},
      start: function (e) { return onDragStart(cm, e); },
      drop: operation(cm, onDrop),
      leave: function (e) {if (!signalDOMEvent(cm, e)) { clearDragCursor(cm); }}
    };

    var inp = d.input.getField();
    on(inp, "keyup", function (e) { return onKeyUp.call(cm, e); });
    on(inp, "keydown", operation(cm, onKeyDown));
    on(inp, "keypress", operation(cm, onKeyPress));
    on(inp, "focus", function (e) { return onFocus(cm, e); });
    on(inp, "blur", function (e) { return onBlur(cm, e); });
  }

  var initHooks = [];
  CodeMirror.defineInitHook = function (f) { return initHooks.push(f); };

  // Indent the given line. The how parameter can be "smart",
  // "add"/null, "subtract", or "prev". When aggressive is false
  // (typically set to true for forced single-line indents), empty
  // lines are not indented, and places where the mode returns Pass
  // are left alone.
  function indentLine(cm, n, how, aggressive) {
    var doc = cm.doc, state;
    if (how == null) { how = "add"; }
    if (how == "smart") {
      // Fall back to "prev" when the mode doesn't have an indentation
      // method.
      if (!doc.mode.indent) { how = "prev"; }
      else { state = getContextBefore(cm, n).state; }
    }

    var tabSize = cm.options.tabSize;
    var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);
    if (line.stateAfter) { line.stateAfter = null; }
    var curSpaceString = line.text.match(/^\s*/)[0], indentation;
    if (!aggressive && !/\S/.test(line.text)) {
      indentation = 0;
      how = "not";
    } else if (how == "smart") {
      indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);
      if (indentation == Pass || indentation > 150) {
        if (!aggressive) { return }
        how = "prev";
      }
    }
    if (how == "prev") {
      if (n > doc.first) { indentation = countColumn(getLine(doc, n-1).text, null, tabSize); }
      else { indentation = 0; }
    } else if (how == "add") {
      indentation = curSpace + cm.options.indentUnit;
    } else if (how == "subtract") {
      indentation = curSpace - cm.options.indentUnit;
    } else if (typeof how == "number") {
      indentation = curSpace + how;
    }
    indentation = Math.max(0, indentation);

    var indentString = "", pos = 0;
    if (cm.options.indentWithTabs)
      { for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += "\t";} }
    if (pos < indentation) { indentString += spaceStr(indentation - pos); }

    if (indentString != curSpaceString) {
      replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), "+input");
      line.stateAfter = null;
      return true
    } else {
      // Ensure that, if the cursor was in the whitespace at the start
      // of the line, it is moved to the end of that space.
      for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) {
        var range = doc.sel.ranges[i$1];
        if (range.head.line == n && range.head.ch < curSpaceString.length) {
          var pos$1 = Pos(n, curSpaceString.length);
          replaceOneSelection(doc, i$1, new Range(pos$1, pos$1));
          break
        }
      }
    }
  }

  // This will be set to a {lineWise: bool, text: [string]} object, so
  // that, when pasting, we know what kind of selections the copied
  // text was made out of.
  var lastCopied = null;

  function setLastCopied(newLastCopied) {
    lastCopied = newLastCopied;
  }

  function applyTextInput(cm, inserted, deleted, sel, origin) {
    var doc = cm.doc;
    cm.display.shift = false;
    if (!sel) { sel = doc.sel; }

    var recent = +new Date - 200;
    var paste = origin == "paste" || cm.state.pasteIncoming > recent;
    var textLines = splitLinesAuto(inserted), multiPaste = null;
    // When pasting N lines into N selections, insert one line per selection
    if (paste && sel.ranges.length > 1) {
      if (lastCopied && lastCopied.text.join("\n") == inserted) {
        if (sel.ranges.length % lastCopied.text.length == 0) {
          multiPaste = [];
          for (var i = 0; i < lastCopied.text.length; i++)
            { multiPaste.push(doc.splitLines(lastCopied.text[i])); }
        }
      } else if (textLines.length == sel.ranges.length && cm.options.pasteLinesPerSelection) {
        multiPaste = map(textLines, function (l) { return [l]; });
      }
    }

    var updateInput = cm.curOp.updateInput;
    // Normal behavior is to insert the new text into every selection
    for (var i$1 = sel.ranges.length - 1; i$1 >= 0; i$1--) {
      var range = sel.ranges[i$1];
      var from = range.from(), to = range.to();
      if (range.empty()) {
        if (deleted && deleted > 0) // Handle deletion
          { from = Pos(from.line, from.ch - deleted); }
        else if (cm.state.overwrite && !paste) // Handle overwrite
          { to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length)); }
        else if (paste && lastCopied && lastCopied.lineWise && lastCopied.text.join("\n") == textLines.join("\n"))
          { from = to = Pos(from.line, 0); }
      }
      var changeEvent = {from: from, to: to, text: multiPaste ? multiPaste[i$1 % multiPaste.length] : textLines,
                         origin: origin || (paste ? "paste" : cm.state.cutIncoming > recent ? "cut" : "+input")};
      makeChange(cm.doc, changeEvent);
      signalLater(cm, "inputRead", cm, changeEvent);
    }
    if (inserted && !paste)
      { triggerElectric(cm, inserted); }

    ensureCursorVisible(cm);
    if (cm.curOp.updateInput < 2) { cm.curOp.updateInput = updateInput; }
    cm.curOp.typing = true;
    cm.state.pasteIncoming = cm.state.cutIncoming = -1;
  }

  function handlePaste(e, cm) {
    var pasted = e.clipboardData && e.clipboardData.getData("Text");
    if (pasted) {
      e.preventDefault();
      if (!cm.isReadOnly() && !cm.options.disableInput)
        { runInOp(cm, function () { return applyTextInput(cm, pasted, 0, null, "paste"); }); }
      return true
    }
  }

  function triggerElectric(cm, inserted) {
    // When an 'electric' character is inserted, immediately trigger a reindent
    if (!cm.options.electricChars || !cm.options.smartIndent) { return }
    var sel = cm.doc.sel;

    for (var i = sel.ranges.length - 1; i >= 0; i--) {
      var range = sel.ranges[i];
      if (range.head.ch > 100 || (i && sel.ranges[i - 1].head.line == range.head.line)) { continue }
      var mode = cm.getModeAt(range.head);
      var indented = false;
      if (mode.electricChars) {
        for (var j = 0; j < mode.electricChars.length; j++)
          { if (inserted.indexOf(mode.electricChars.charAt(j)) > -1) {
            indented = indentLine(cm, range.head.line, "smart");
            break
          } }
      } else if (mode.electricInput) {
        if (mode.electricInput.test(getLine(cm.doc, range.head.line).text.slice(0, range.head.ch)))
          { indented = indentLine(cm, range.head.line, "smart"); }
      }
      if (indented) { signalLater(cm, "electricInput", cm, range.head.line); }
    }
  }

  function copyableRanges(cm) {
    var text = [], ranges = [];
    for (var i = 0; i < cm.doc.sel.ranges.length; i++) {
      var line = cm.doc.sel.ranges[i].head.line;
      var lineRange = {anchor: Pos(line, 0), head: Pos(line + 1, 0)};
      ranges.push(lineRange);
      text.push(cm.getRange(lineRange.anchor, lineRange.head));
    }
    return {text: text, ranges: ranges}
  }

  function disableBrowserMagic(field, spellcheck, autocorrect, autocapitalize) {
    field.setAttribute("autocorrect", autocorrect ? "" : "off");
    field.setAttribute("autocapitalize", autocapitalize ? "" : "off");
    field.setAttribute("spellcheck", !!spellcheck);
  }

  function hiddenTextarea() {
    var te = elt("textarea", null, null, "position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none");
    var div = elt("div", [te], null, "overflow: hidden; position: relative; width: 3px; height: 0px;");
    // The textarea is kept positioned near the cursor to prevent the
    // fact that it'll be scrolled into view on input from scrolling
    // our fake cursor out of view. On webkit, when wrap=off, paste is
    // very slow. So make the area wide instead.
    if (webkit) { te.style.width = "1000px"; }
    else { te.setAttribute("wrap", "off"); }
    // If border: 0; -- iOS fails to open keyboard (issue #1287)
    if (ios) { te.style.border = "1px solid black"; }
    disableBrowserMagic(te);
    return div
  }

  // The publicly visible API. Note that methodOp(f) means
  // 'wrap f in an operation, performed on its ~~~this~~~ parameter'.

  // This is not the complete set of editor methods. Most of the
  // methods defined on the Doc type are also injected into
  // CodeMirror.prototype, for backwards compatibility and
  // convenience.

  function addEditorMethods(CodeMirror) {
    var optionHandlers = CodeMirror.optionHandlers;

    var helpers = CodeMirror.helpers = {};

    CodeMirror.prototype = {
      constructor: CodeMirror,
      focus: function(){window.focus(); this.display.input.focus();},

      setOption: function(option, value) {
        var options = this.options, old = options[option];
        if (options[option] == value && option != "mode") { return }
        options[option] = value;
        if (optionHandlers.hasOwnProperty(option))
          { operation(this, optionHandlers[option])(this, value, old); }
        signal(this, "optionChange", this, option);
      },

      getOption: function(option) {return this.options[option]},
      getDoc: function() {return this.doc},

      addKeyMap: function(map, bottom) {
        this.state.keyMaps[bottom ? "push" : "unshift"](getKeyMap(map));
      },
      removeKeyMap: function(map) {
        var maps = this.state.keyMaps;
        for (var i = 0; i < maps.length; ++i)
          { if (maps[i] == map || maps[i].name == map) {
            maps.splice(i, 1);
            return true
          } }
      },

      addOverlay: methodOp(function(spec, options) {
        var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);
        if (mode.startState) { throw new Error("Overlays may not be stateful.") }
        insertSorted(this.state.overlays,
                     {mode: mode, modeSpec: spec, opaque: options && options.opaque,
                      priority: (options && options.priority) || 0},
                     function (overlay) { return overlay.priority; });
        this.state.modeGen++;
        regChange(this);
      }),
      removeOverlay: methodOp(function(spec) {
        var overlays = this.state.overlays;
        for (var i = 0; i < overlays.length; ++i) {
          var cur = overlays[i].modeSpec;
          if (cur == spec || typeof spec == "string" && cur.name == spec) {
            overlays.splice(i, 1);
            this.state.modeGen++;
            regChange(this);
            return
          }
        }
      }),

      indentLine: methodOp(function(n, dir, aggressive) {
        if (typeof dir != "string" && typeof dir != "number") {
          if (dir == null) { dir = this.options.smartIndent ? "smart" : "prev"; }
          else { dir = dir ? "add" : "subtract"; }
        }
        if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }
      }),
      indentSelection: methodOp(function(how) {
        var ranges = this.doc.sel.ranges, end = -1;
        for (var i = 0; i < ranges.length; i++) {
          var range = ranges[i];
          if (!range.empty()) {
            var from = range.from(), to = range.to();
            var start = Math.max(end, from.line);
            end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;
            for (var j = start; j < end; ++j)
              { indentLine(this, j, how); }
            var newRanges = this.doc.sel.ranges;
            if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)
              { replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }
          } else if (range.head.line > end) {
            indentLine(this, range.head.line, how, true);
            end = range.head.line;
            if (i == this.doc.sel.primIndex) { ensureCursorVisible(this); }
          }
        }
      }),

      // Fetch the parser token for a given character. Useful for hacks
      // that want to inspect the mode state (say, for completion).
      getTokenAt: function(pos, precise) {
        return takeToken(this, pos, precise)
      },

      getLineTokens: function(line, precise) {
        return takeToken(this, Pos(line), precise, true)
      },

      getTokenTypeAt: function(pos) {
        pos = clipPos(this.doc, pos);
        var styles = getLineStyles(this, getLine(this.doc, pos.line));
        var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;
        var type;
        if (ch == 0) { type = styles[2]; }
        else { for (;;) {
          var mid = (before + after) >> 1;
          if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }
          else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }
          else { type = styles[mid * 2 + 2]; break }
        } }
        var cut = type ? type.indexOf("overlay ") : -1;
        return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)
      },

      getModeAt: function(pos) {
        var mode = this.doc.mode;
        if (!mode.innerMode) { return mode }
        return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode
      },

      getHelper: function(pos, type) {
        return this.getHelpers(pos, type)[0]
      },

      getHelpers: function(pos, type) {
        var found = [];
        if (!helpers.hasOwnProperty(type)) { return found }
        var help = helpers[type], mode = this.getModeAt(pos);
        if (typeof mode[type] == "string") {
          if (help[mode[type]]) { found.push(help[mode[type]]); }
        } else if (mode[type]) {
          for (var i = 0; i < mode[type].length; i++) {
            var val = help[mode[type][i]];
            if (val) { found.push(val); }
          }
        } else if (mode.helperType && help[mode.helperType]) {
          found.push(help[mode.helperType]);
        } else if (help[mode.name]) {
          found.push(help[mode.name]);
        }
        for (var i$1 = 0; i$1 < help._global.length; i$1++) {
          var cur = help._global[i$1];
          if (cur.pred(mode, this) && indexOf(found, cur.val) == -1)
            { found.push(cur.val); }
        }
        return found
      },

      getStateAfter: function(line, precise) {
        var doc = this.doc;
        line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);
        return getContextBefore(this, line + 1, precise).state
      },

      cursorCoords: function(start, mode) {
        var pos, range = this.doc.sel.primary();
        if (start == null) { pos = range.head; }
        else if (typeof start == "object") { pos = clipPos(this.doc, start); }
        else { pos = start ? range.from() : range.to(); }
        return cursorCoords(this, pos, mode || "page")
      },

      charCoords: function(pos, mode) {
        return charCoords(this, clipPos(this.doc, pos), mode || "page")
      },

      coordsChar: function(coords, mode) {
        coords = fromCoordSystem(this, coords, mode || "page");
        return coordsChar(this, coords.left, coords.top)
      },

      lineAtHeight: function(height, mode) {
        height = fromCoordSystem(this, {top: height, left: 0}, mode || "page").top;
        return lineAtHeight(this.doc, height + this.display.viewOffset)
      },
      heightAtLine: function(line, mode, includeWidgets) {
        var end = false, lineObj;
        if (typeof line == "number") {
          var last = this.doc.first + this.doc.size - 1;
          if (line < this.doc.first) { line = this.doc.first; }
          else if (line > last) { line = last; end = true; }
          lineObj = getLine(this.doc, line);
        } else {
          lineObj = line;
        }
        return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || "page", includeWidgets || end).top +
          (end ? this.doc.height - heightAtLine(lineObj) : 0)
      },

      defaultTextHeight: function() { return textHeight(this.display) },
      defaultCharWidth: function() { return charWidth(this.display) },

      getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},

      addWidget: function(pos, node, scroll, vert, horiz) {
        var display = this.display;
        pos = cursorCoords(this, clipPos(this.doc, pos));
        var top = pos.bottom, left = pos.left;
        node.style.position = "absolute";
        node.setAttribute("cm-ignore-events", "true");
        this.display.input.setUneditable(node);
        display.sizer.appendChild(node);
        if (vert == "over") {
          top = pos.top;
        } else if (vert == "above" || vert == "near") {
          var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),
          hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);
          // Default to positioning above (if specified and possible); otherwise default to positioning below
          if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)
            { top = pos.top - node.offsetHeight; }
          else if (pos.bottom + node.offsetHeight <= vspace)
            { top = pos.bottom; }
          if (left + node.offsetWidth > hspace)
            { left = hspace - node.offsetWidth; }
        }
        node.style.top = top + "px";
        node.style.left = node.style.right = "";
        if (horiz == "right") {
          left = display.sizer.clientWidth - node.offsetWidth;
          node.style.right = "0px";
        } else {
          if (horiz == "left") { left = 0; }
          else if (horiz == "middle") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }
          node.style.left = left + "px";
        }
        if (scroll)
          { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }
      },

      triggerOnKeyDown: methodOp(onKeyDown),
      triggerOnKeyPress: methodOp(onKeyPress),
      triggerOnKeyUp: onKeyUp,
      triggerOnMouseDown: methodOp(onMouseDown),

      execCommand: function(cmd) {
        if (commands.hasOwnProperty(cmd))
          { return commands[cmd].call(null, this) }
      },

      triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),

      findPosH: function(from, amount, unit, visually) {
        var dir = 1;
        if (amount < 0) { dir = -1; amount = -amount; }
        var cur = clipPos(this.doc, from);
        for (var i = 0; i < amount; ++i) {
          cur = findPosH(this.doc, cur, dir, unit, visually);
          if (cur.hitSide) { break }
        }
        return cur
      },

      moveH: methodOp(function(dir, unit) {
        var this$1 = this;

        this.extendSelectionsBy(function (range) {
          if (this$1.display.shift || this$1.doc.extend || range.empty())
            { return findPosH(this$1.doc, range.head, dir, unit, this$1.options.rtlMoveVisually) }
          else
            { return dir < 0 ? range.from() : range.to() }
        }, sel_move);
      }),

      deleteH: methodOp(function(dir, unit) {
        var sel = this.doc.sel, doc = this.doc;
        if (sel.somethingSelected())
          { doc.replaceSelection("", null, "+delete"); }
        else
          { deleteNearSelection(this, function (range) {
            var other = findPosH(doc, range.head, dir, unit, false);
            return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other}
          }); }
      }),

      findPosV: function(from, amount, unit, goalColumn) {
        var dir = 1, x = goalColumn;
        if (amount < 0) { dir = -1; amount = -amount; }
        var cur = clipPos(this.doc, from);
        for (var i = 0; i < amount; ++i) {
          var coords = cursorCoords(this, cur, "div");
          if (x == null) { x = coords.left; }
          else { coords.left = x; }
          cur = findPosV(this, coords, dir, unit);
          if (cur.hitSide) { break }
        }
        return cur
      },

      moveV: methodOp(function(dir, unit) {
        var this$1 = this;

        var doc = this.doc, goals = [];
        var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();
        doc.extendSelectionsBy(function (range) {
          if (collapse)
            { return dir < 0 ? range.from() : range.to() }
          var headPos = cursorCoords(this$1, range.head, "div");
          if (range.goalColumn != null) { headPos.left = range.goalColumn; }
          goals.push(headPos.left);
          var pos = findPosV(this$1, headPos, dir, unit);
          if (unit == "page" && range == doc.sel.primary())
            { addToScrollTop(this$1, charCoords(this$1, pos, "div").top - headPos.top); }
          return pos
        }, sel_move);
        if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)
          { doc.sel.ranges[i].goalColumn = goals[i]; } }
      }),

      // Find the word at the given position (as returned by coordsChar).
      findWordAt: function(pos) {
        var doc = this.doc, line = getLine(doc, pos.line).text;
        var start = pos.ch, end = pos.ch;
        if (line) {
          var helper = this.getHelper(pos, "wordChars");
          if ((pos.sticky == "before" || end == line.length) && start) { --start; } else { ++end; }
          var startChar = line.charAt(start);
          var check = isWordChar(startChar, helper)
            ? function (ch) { return isWordChar(ch, helper); }
            : /\s/.test(startChar) ? function (ch) { return /\s/.test(ch); }
            : function (ch) { return (!/\s/.test(ch) && !isWordChar(ch)); };
          while (start > 0 && check(line.charAt(start - 1))) { --start; }
          while (end < line.length && check(line.charAt(end))) { ++end; }
        }
        return new Range(Pos(pos.line, start), Pos(pos.line, end))
      },

      toggleOverwrite: function(value) {
        if (value != null && value == this.state.overwrite) { return }
        if (this.state.overwrite = !this.state.overwrite)
          { addClass(this.display.cursorDiv, "CodeMirror-overwrite"); }
        else
          { rmClass(this.display.cursorDiv, "CodeMirror-overwrite"); }

        signal(this, "overwriteToggle", this, this.state.overwrite);
      },
      hasFocus: function() { return this.display.input.getField() == activeElt() },
      isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },

      scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),
      getScrollInfo: function() {
        var scroller = this.display.scroller;
        return {left: scroller.scrollLeft, top: scroller.scrollTop,
                height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,
                width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,
                clientHeight: displayHeight(this), clientWidth: displayWidth(this)}
      },

      scrollIntoView: methodOp(function(range, margin) {
        if (range == null) {
          range = {from: this.doc.sel.primary().head, to: null};
          if (margin == null) { margin = this.options.cursorScrollMargin; }
        } else if (typeof range == "number") {
          range = {from: Pos(range, 0), to: null};
        } else if (range.from == null) {
          range = {from: range, to: null};
        }
        if (!range.to) { range.to = range.from; }
        range.margin = margin || 0;

        if (range.from.line != null) {
          scrollToRange(this, range);
        } else {
          scrollToCoordsRange(this, range.from, range.to, range.margin);
        }
      }),

      setSize: methodOp(function(width, height) {
        var this$1 = this;

        var interpret = function (val) { return typeof val == "number" || /^\d+$/.test(String(val)) ? val + "px" : val; };
        if (width != null) { this.display.wrapper.style.width = interpret(width); }
        if (height != null) { this.display.wrapper.style.height = interpret(height); }
        if (this.options.lineWrapping) { clearLineMeasurementCache(this); }
        var lineNo = this.display.viewFrom;
        this.doc.iter(lineNo, this.display.viewTo, function (line) {
          if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)
            { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo, "widget"); break } } }
          ++lineNo;
        });
        this.curOp.forceUpdate = true;
        signal(this, "refresh", this);
      }),

      operation: function(f){return runInOp(this, f)},
      startOperation: function(){return startOperation(this)},
      endOperation: function(){return endOperation(this)},

      refresh: methodOp(function() {
        var oldHeight = this.display.cachedTextHeight;
        regChange(this);
        this.curOp.forceUpdate = true;
        clearCaches(this);
        scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);
        updateGutterSpace(this.display);
        if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5 || this.options.lineWrapping)
          { estimateLineHeights(this); }
        signal(this, "refresh", this);
      }),

      swapDoc: methodOp(function(doc) {
        var old = this.doc;
        old.cm = null;
        // Cancel the current text selection if any (#5821)
        if (this.state.selectingText) { this.state.selectingText(); }
        attachDoc(this, doc);
        clearCaches(this);
        this.display.input.reset();
        scrollToCoords(this, doc.scrollLeft, doc.scrollTop);
        this.curOp.forceScroll = true;
        signalLater(this, "swapDoc", this, old);
        return old
      }),

      phrase: function(phraseText) {
        var phrases = this.options.phrases;
        return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText
      },

      getInputField: function(){return this.display.input.getField()},
      getWrapperElement: function(){return this.display.wrapper},
      getScrollerElement: function(){return this.display.scroller},
      getGutterElement: function(){return this.display.gutters}
    };
    eventMixin(CodeMirror);

    CodeMirror.registerHelper = function(type, name, value) {
      if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }
      helpers[type][name] = value;
    };
    CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {
      CodeMirror.registerHelper(type, name, value);
      helpers[type]._global.push({pred: predicate, val: value});
    };
  }

  // Used for horizontal relative motion. Dir is -1 or 1 (left or
  // right), unit can be "codepoint", "char", "column" (like char, but
  // doesn't cross line boundaries), "word" (across next word), or
  // "group" (to the start of next group of word or
  // non-word-non-whitespace chars). The visually param controls
  // whether, in right-to-left text, direction 1 means to move towards
  // the next index in the string, or towards the character to the right
  // of the current position. The resulting position will have a
  // hitSide=true property if it reached the end of the document.
  function findPosH(doc, pos, dir, unit, visually) {
    var oldPos = pos;
    var origDir = dir;
    var lineObj = getLine(doc, pos.line);
    var lineDir = visually && doc.direction == "rtl" ? -dir : dir;
    function findNextLine() {
      var l = pos.line + lineDir;
      if (l < doc.first || l >= doc.first + doc.size) { return false }
      pos = new Pos(l, pos.ch, pos.sticky);
      return lineObj = getLine(doc, l)
    }
    function moveOnce(boundToLine) {
      var next;
      if (unit == "codepoint") {
        var ch = lineObj.text.charCodeAt(pos.ch + (dir > 0 ? 0 : -1));
        if (isNaN(ch)) {
          next = null;
        } else {
          var astral = dir > 0 ? ch >= 0xD800 && ch < 0xDC00 : ch >= 0xDC00 && ch < 0xDFFF;
          next = new Pos(pos.line, Math.max(0, Math.min(lineObj.text.length, pos.ch + dir * (astral ? 2 : 1))), -dir);
        }
      } else if (visually) {
        next = moveVisually(doc.cm, lineObj, pos, dir);
      } else {
        next = moveLogically(lineObj, pos, dir);
      }
      if (next == null) {
        if (!boundToLine && findNextLine())
          { pos = endOfLine(visually, doc.cm, lineObj, pos.line, lineDir); }
        else
          { return false }
      } else {
        pos = next;
      }
      return true
    }

    if (unit == "char" || unit == "codepoint") {
      moveOnce();
    } else if (unit == "column") {
      moveOnce(true);
    } else if (unit == "word" || unit == "group") {
      var sawType = null, group = unit == "group";
      var helper = doc.cm && doc.cm.getHelper(pos, "wordChars");
      for (var first = true;; first = false) {
        if (dir < 0 && !moveOnce(!first)) { break }
        var cur = lineObj.text.charAt(pos.ch) || "\n";
        var type = isWordChar(cur, helper) ? "w"
          : group && cur == "\n" ? "n"
          : !group || /\s/.test(cur) ? null
          : "p";
        if (group && !first && !type) { type = "s"; }
        if (sawType && sawType != type) {
          if (dir < 0) {dir = 1; moveOnce(); pos.sticky = "after";}
          break
        }

        if (type) { sawType = type; }
        if (dir > 0 && !moveOnce(!first)) { break }
      }
    }
    var result = skipAtomic(doc, pos, oldPos, origDir, true);
    if (equalCursorPos(oldPos, result)) { result.hitSide = true; }
    return result
  }

  // For relative vertical movement. Dir may be -1 or 1. Unit can be
  // "page" or "line". The resulting position will have a hitSide=true
  // property if it reached the end of the document.
  function findPosV(cm, pos, dir, unit) {
    var doc = cm.doc, x = pos.left, y;
    if (unit == "page") {
      var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);
      var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);
      y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;

    } else if (unit == "line") {
      y = dir > 0 ? pos.bottom + 3 : pos.top - 3;
    }
    var target;
    for (;;) {
      target = coordsChar(cm, x, y);
      if (!target.outside) { break }
      if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }
      y += dir * 5;
    }
    return target
  }

  // CONTENTEDITABLE INPUT STYLE

  var ContentEditableInput = function(cm) {
    this.cm = cm;
    this.lastAnchorNode = this.lastAnchorOffset = this.lastFocusNode = this.lastFocusOffset = null;
    this.polling = new Delayed();
    this.composing = null;
    this.gracePeriod = false;
    this.readDOMTimeout = null;
  };

  ContentEditableInput.prototype.init = function (display) {
      var this$1 = this;

    var input = this, cm = input.cm;
    var div = input.div = display.lineDiv;
    div.contentEditable = true;
    disableBrowserMagic(div, cm.options.spellcheck, cm.options.autocorrect, cm.options.autocapitalize);

    function belongsToInput(e) {
      for (var t = e.target; t; t = t.parentNode) {
        if (t == div) { return true }
        if (/\bCodeMirror-(?:line)?widget\b/.test(t.className)) { break }
      }
      return false
    }

    on(div, "paste", function (e) {
      if (!belongsToInput(e) || signalDOMEvent(cm, e) || handlePaste(e, cm)) { return }
      // IE doesn't fire input events, so we schedule a read for the pasted content in this way
      if (ie_version <= 11) { setTimeout(operation(cm, function () { return this$1.updateFromDOM(); }), 20); }
    });

    on(div, "compositionstart", function (e) {
      this$1.composing = {data: e.data, done: false};
    });
    on(div, "compositionupdate", function (e) {
      if (!this$1.composing) { this$1.composing = {data: e.data, done: false}; }
    });
    on(div, "compositionend", function (e) {
      if (this$1.composing) {
        if (e.data != this$1.composing.data) { this$1.readFromDOMSoon(); }
        this$1.composing.done = true;
      }
    });

    on(div, "touchstart", function () { return input.forceCompositionEnd(); });

    on(div, "input", function () {
      if (!this$1.composing) { this$1.readFromDOMSoon(); }
    });

    function onCopyCut(e) {
      if (!belongsToInput(e) || signalDOMEvent(cm, e)) { return }
      if (cm.somethingSelected()) {
        setLastCopied({lineWise: false, text: cm.getSelections()});
        if (e.type == "cut") { cm.replaceSelection("", null, "cut"); }
      } else if (!cm.options.lineWiseCopyCut) {
        return
      } else {
        var ranges = copyableRanges(cm);
        setLastCopied({lineWise: true, text: ranges.text});
        if (e.type == "cut") {
          cm.operation(function () {
            cm.setSelections(ranges.ranges, 0, sel_dontScroll);
            cm.replaceSelection("", null, "cut");
          });
        }
      }
      if (e.clipboardData) {
        e.clipboardData.clearData();
        var content = lastCopied.text.join("\n");
        // iOS exposes the clipboard API, but seems to discard content inserted into it
        e.clipboardData.setData("Text", content);
        if (e.clipboardData.getData("Text") == content) {
          e.preventDefault();
          return
        }
      }
      // Old-fashioned briefly-focus-a-textarea hack
      var kludge = hiddenTextarea(), te = kludge.firstChild;
      cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild);
      te.value = lastCopied.text.join("\n");
      var hadFocus = activeElt();
      selectInput(te);
      setTimeout(function () {
        cm.display.lineSpace.removeChild(kludge);
        hadFocus.focus();
        if (hadFocus == div) { input.showPrimarySelection(); }
      }, 50);
    }
    on(div, "copy", onCopyCut);
    on(div, "cut", onCopyCut);
  };

  ContentEditableInput.prototype.screenReaderLabelChanged = function (label) {
    // Label for screenreaders, accessibility
    if(label) {
      this.div.setAttribute('aria-label', label);
    } else {
      this.div.removeAttribute('aria-label');
    }
  };

  ContentEditableInput.prototype.prepareSelection = function () {
    var result = prepareSelection(this.cm, false);
    result.focus = activeElt() == this.div;
    return result
  };

  ContentEditableInput.prototype.showSelection = function (info, takeFocus) {
    if (!info || !this.cm.display.view.length) { return }
    if (info.focus || takeFocus) { this.showPrimarySelection(); }
    this.showMultipleSelections(info);
  };

  ContentEditableInput.prototype.getSelection = function () {
    return this.cm.display.wrapper.ownerDocument.getSelection()
  };

  ContentEditableInput.prototype.showPrimarySelection = function () {
    var sel = this.getSelection(), cm = this.cm, prim = cm.doc.sel.primary();
    var from = prim.from(), to = prim.to();

    if (cm.display.viewTo == cm.display.viewFrom || from.line >= cm.display.viewTo || to.line < cm.display.viewFrom) {
      sel.removeAllRanges();
      return
    }

    var curAnchor = domToPos(cm, sel.anchorNode, sel.anchorOffset);
    var curFocus = domToPos(cm, sel.focusNode, sel.focusOffset);
    if (curAnchor && !curAnchor.bad && curFocus && !curFocus.bad &&
        cmp(minPos(curAnchor, curFocus), from) == 0 &&
        cmp(maxPos(curAnchor, curFocus), to) == 0)
      { return }

    var view = cm.display.view;
    var start = (from.line >= cm.display.viewFrom && posToDOM(cm, from)) ||
        {node: view[0].measure.map[2], offset: 0};
    var end = to.line < cm.display.viewTo && posToDOM(cm, to);
    if (!end) {
      var measure = view[view.length - 1].measure;
      var map = measure.maps ? measure.maps[measure.maps.length - 1] : measure.map;
      end = {node: map[map.length - 1], offset: map[map.length - 2] - map[map.length - 3]};
    }

    if (!start || !end) {
      sel.removeAllRanges();
      return
    }

    var old = sel.rangeCount && sel.getRangeAt(0), rng;
    try { rng = range(start.node, start.offset, end.offset, end.node); }
    catch(e) {} // Our model of the DOM might be outdated, in which case the range we try to set can be impossible
    if (rng) {
      if (!gecko && cm.state.focused) {
        sel.collapse(start.node, start.offset);
        if (!rng.collapsed) {
          sel.removeAllRanges();
          sel.addRange(rng);
        }
      } else {
        sel.removeAllRanges();
        sel.addRange(rng);
      }
      if (old && sel.anchorNode == null) { sel.addRange(old); }
      else if (gecko) { this.startGracePeriod(); }
    }
    this.rememberSelection();
  };

  ContentEditableInput.prototype.startGracePeriod = function () {
      var this$1 = this;

    clearTimeout(this.gracePeriod);
    this.gracePeriod = setTimeout(function () {
      this$1.gracePeriod = false;
      if (this$1.selectionChanged())
        { this$1.cm.operation(function () { return this$1.cm.curOp.selectionChanged = true; }); }
    }, 20);
  };

  ContentEditableInput.prototype.showMultipleSelections = function (info) {
    removeChildrenAndAdd(this.cm.display.cursorDiv, info.cursors);
    removeChildrenAndAdd(this.cm.display.selectionDiv, info.selection);
  };

  ContentEditableInput.prototype.rememberSelection = function () {
    var sel = this.getSelection();
    this.lastAnchorNode = sel.anchorNode; this.lastAnchorOffset = sel.anchorOffset;
    this.lastFocusNode = sel.focusNode; this.lastFocusOffset = sel.focusOffset;
  };

  ContentEditableInput.prototype.selectionInEditor = function () {
    var sel = this.getSelection();
    if (!sel.rangeCount) { return false }
    var node = sel.getRangeAt(0).commonAncestorContainer;
    return contains(this.div, node)
  };

  ContentEditableInput.prototype.focus = function () {
    if (this.cm.options.readOnly != "nocursor") {
      if (!this.selectionInEditor() || activeElt() != this.div)
        { this.showSelection(this.prepareSelection(), true); }
      this.div.focus();
    }
  };
  ContentEditableInput.prototype.blur = function () { this.div.blur(); };
  ContentEditableInput.prototype.getField = function () { return this.div };

  ContentEditableInput.prototype.supportsTouch = function () { return true };

  ContentEditableInput.prototype.receivedFocus = function () {
    var input = this;
    if (this.selectionInEditor())
      { this.pollSelection(); }
    else
      { runInOp(this.cm, function () { return input.cm.curOp.selectionChanged = true; }); }

    function poll() {
      if (input.cm.state.focused) {
        input.pollSelection();
        input.polling.set(input.cm.options.pollInterval, poll);
      }
    }
    this.polling.set(this.cm.options.pollInterval, poll);
  };

  ContentEditableInput.prototype.selectionChanged = function () {
    var sel = this.getSelection();
    return sel.anchorNode != this.lastAnchorNode || sel.anchorOffset != this.lastAnchorOffset ||
      sel.focusNode != this.lastFocusNode || sel.focusOffset != this.lastFocusOffset
  };

  ContentEditableInput.prototype.pollSelection = function () {
    if (this.readDOMTimeout != null || this.gracePeriod || !this.selectionChanged()) { return }
    var sel = this.getSelection(), cm = this.cm;
    // On Android Chrome (version 56, at least), backspacing into an
    // uneditable block element will put the cursor in that element,
    // and then, because it's not editable, hide the virtual keyboard.
    // Because Android doesn't allow us to actually detect backspace
    // presses in a sane way, this code checks for when that happens
    // and simulates a backspace press in this case.
    if (android && chrome && this.cm.display.gutterSpecs.length && isInGutter(sel.anchorNode)) {
      this.cm.triggerOnKeyDown({type: "keydown", keyCode: 8, preventDefault: Math.abs});
      this.blur();
      this.focus();
      return
    }
    if (this.composing) { return }
    this.rememberSelection();
    var anchor = domToPos(cm, sel.anchorNode, sel.anchorOffset);
    var head = domToPos(cm, sel.focusNode, sel.focusOffset);
    if (anchor && head) { runInOp(cm, function () {
      setSelection(cm.doc, simpleSelection(anchor, head), sel_dontScroll);
      if (anchor.bad || head.bad) { cm.curOp.selectionChanged = true; }
    }); }
  };

  ContentEditableInput.prototype.pollContent = function () {
    if (this.readDOMTimeout != null) {
      clearTimeout(this.readDOMTimeout);
      this.readDOMTimeout = null;
    }

    var cm = this.cm, display = cm.display, sel = cm.doc.sel.primary();
    var from = sel.from(), to = sel.to();
    if (from.ch == 0 && from.line > cm.firstLine())
      { from = Pos(from.line - 1, getLine(cm.doc, from.line - 1).length); }
    if (to.ch == getLine(cm.doc, to.line).text.length && to.line < cm.lastLine())
      { to = Pos(to.line + 1, 0); }
    if (from.line < display.viewFrom || to.line > display.viewTo - 1) { return false }

    var fromIndex, fromLine, fromNode;
    if (from.line == display.viewFrom || (fromIndex = findViewIndex(cm, from.line)) == 0) {
      fromLine = lineNo(display.view[0].line);
      fromNode = display.view[0].node;
    } else {
      fromLine = lineNo(display.view[fromIndex].line);
      fromNode = display.view[fromIndex - 1].node.nextSibling;
    }
    var toIndex = findViewIndex(cm, to.line);
    var toLine, toNode;
    if (toIndex == display.view.length - 1) {
      toLine = display.viewTo - 1;
      toNode = display.lineDiv.lastChild;
    } else {
      toLine = lineNo(display.view[toIndex + 1].line) - 1;
      toNode = display.view[toIndex + 1].node.previousSibling;
    }

    if (!fromNode) { return false }
    var newText = cm.doc.splitLines(domTextBetween(cm, fromNode, toNode, fromLine, toLine));
    var oldText = getBetween(cm.doc, Pos(fromLine, 0), Pos(toLine, getLine(cm.doc, toLine).text.length));
    while (newText.length > 1 && oldText.length > 1) {
      if (lst(newText) == lst(oldText)) { newText.pop(); oldText.pop(); toLine--; }
      else if (newText[0] == oldText[0]) { newText.shift(); oldText.shift(); fromLine++; }
      else { break }
    }

    var cutFront = 0, cutEnd = 0;
    var newTop = newText[0], oldTop = oldText[0], maxCutFront = Math.min(newTop.length, oldTop.length);
    while (cutFront < maxCutFront && newTop.charCodeAt(cutFront) == oldTop.charCodeAt(cutFront))
      { ++cutFront; }
    var newBot = lst(newText), oldBot = lst(oldText);
    var maxCutEnd = Math.min(newBot.length - (newText.length == 1 ? cutFront : 0),
                             oldBot.length - (oldText.length == 1 ? cutFront : 0));
    while (cutEnd < maxCutEnd &&
           newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1))
      { ++cutEnd; }
    // Try to move start of change to start of selection if ambiguous
    if (newText.length == 1 && oldText.length == 1 && fromLine == from.line) {
      while (cutFront && cutFront > from.ch &&
             newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1)) {
        cutFront--;
        cutEnd++;
      }
    }

    newText[newText.length - 1] = newBot.slice(0, newBot.length - cutEnd).replace(/^\u200b+/, "");
    newText[0] = newText[0].slice(cutFront).replace(/\u200b+$/, "");

    var chFrom = Pos(fromLine, cutFront);
    var chTo = Pos(toLine, oldText.length ? lst(oldText).length - cutEnd : 0);
    if (newText.length > 1 || newText[0] || cmp(chFrom, chTo)) {
      replaceRange(cm.doc, newText, chFrom, chTo, "+input");
      return true
    }
  };

  ContentEditableInput.prototype.ensurePolled = function () {
    this.forceCompositionEnd();
  };
  ContentEditableInput.prototype.reset = function () {
    this.forceCompositionEnd();
  };
  ContentEditableInput.prototype.forceCompositionEnd = function () {
    if (!this.composing) { return }
    clearTimeout(this.readDOMTimeout);
    this.composing = null;
    this.updateFromDOM();
    this.div.blur();
    this.div.focus();
  };
  ContentEditableInput.prototype.readFromDOMSoon = function () {
      var this$1 = this;

    if (this.readDOMTimeout != null) { return }
    this.readDOMTimeout = setTimeout(function () {
      this$1.readDOMTimeout = null;
      if (this$1.composing) {
        if (this$1.composing.done) { this$1.composing = null; }
        else { return }
      }
      this$1.updateFromDOM();
    }, 80);
  };

  ContentEditableInput.prototype.updateFromDOM = function () {
      var this$1 = this;

    if (this.cm.isReadOnly() || !this.pollContent())
      { runInOp(this.cm, function () { return regChange(this$1.cm); }); }
  };

  ContentEditableInput.prototype.setUneditable = function (node) {
    node.contentEditable = "false";
  };

  ContentEditableInput.prototype.onKeyPress = function (e) {
    if (e.charCode == 0 || this.composing) { return }
    e.preventDefault();
    if (!this.cm.isReadOnly())
      { operation(this.cm, applyTextInput)(this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), 0); }
  };

  ContentEditableInput.prototype.readOnlyChanged = function (val) {
    this.div.contentEditable = String(val != "nocursor");
  };

  ContentEditableInput.prototype.onContextMenu = function () {};
  ContentEditableInput.prototype.resetPosition = function () {};

  ContentEditableInput.prototype.needsContentAttribute = true;

  function posToDOM(cm, pos) {
    var view = findViewForLine(cm, pos.line);
    if (!view || view.hidden) { return null }
    var line = getLine(cm.doc, pos.line);
    var info = mapFromLineView(view, line, pos.line);

    var order = getOrder(line, cm.doc.direction), side = "left";
    if (order) {
      var partPos = getBidiPartAt(order, pos.ch);
      side = partPos % 2 ? "right" : "left";
    }
    var result = nodeAndOffsetInLineMap(info.map, pos.ch, side);
    result.offset = result.collapse == "right" ? result.end : result.start;
    return result
  }

  function isInGutter(node) {
    for (var scan = node; scan; scan = scan.parentNode)
      { if (/CodeMirror-gutter-wrapper/.test(scan.className)) { return true } }
    return false
  }

  function badPos(pos, bad) { if (bad) { pos.bad = true; } return pos }

  function domTextBetween(cm, from, to, fromLine, toLine) {
    var text = "", closing = false, lineSep = cm.doc.lineSeparator(), extraLinebreak = false;
    function recognizeMarker(id) { return function (marker) { return marker.id == id; } }
    function close() {
      if (closing) {
        text += lineSep;
        if (extraLinebreak) { text += lineSep; }
        closing = extraLinebreak = false;
      }
    }
    function addText(str) {
      if (str) {
        close();
        text += str;
      }
    }
    function walk(node) {
      if (node.nodeType == 1) {
        var cmText = node.getAttribute("cm-text");
        if (cmText) {
          addText(cmText);
          return
        }
        var markerID = node.getAttribute("cm-marker"), range;
        if (markerID) {
          var found = cm.findMarks(Pos(fromLine, 0), Pos(toLine + 1, 0), recognizeMarker(+markerID));
          if (found.length && (range = found[0].find(0)))
            { addText(getBetween(cm.doc, range.from, range.to).join(lineSep)); }
          return
        }
        if (node.getAttribute("contenteditable") == "false") { return }
        var isBlock = /^(pre|div|p|li|table|br)$/i.test(node.nodeName);
        if (!/^br$/i.test(node.nodeName) && node.textContent.length == 0) { return }

        if (isBlock) { close(); }
        for (var i = 0; i < node.childNodes.length; i++)
          { walk(node.childNodes[i]); }

        if (/^(pre|p)$/i.test(node.nodeName)) { extraLinebreak = true; }
        if (isBlock) { closing = true; }
      } else if (node.nodeType == 3) {
        addText(node.nodeValue.replace(/\u200b/g, "").replace(/\u00a0/g, " "));
      }
    }
    for (;;) {
      walk(from);
      if (from == to) { break }
      from = from.nextSibling;
      extraLinebreak = false;
    }
    return text
  }

  function domToPos(cm, node, offset) {
    var lineNode;
    if (node == cm.display.lineDiv) {
      lineNode = cm.display.lineDiv.childNodes[offset];
      if (!lineNode) { return badPos(cm.clipPos(Pos(cm.display.viewTo - 1)), true) }
      node = null; offset = 0;
    } else {
      for (lineNode = node;; lineNode = lineNode.parentNode) {
        if (!lineNode || lineNode == cm.display.lineDiv) { return null }
        if (lineNode.parentNode && lineNode.parentNode == cm.display.lineDiv) { break }
      }
    }
    for (var i = 0; i < cm.display.view.length; i++) {
      var lineView = cm.display.view[i];
      if (lineView.node == lineNode)
        { return locateNodeInLineView(lineView, node, offset) }
    }
  }

  function locateNodeInLineView(lineView, node, offset) {
    var wrapper = lineView.text.firstChild, bad = false;
    if (!node || !contains(wrapper, node)) { return badPos(Pos(lineNo(lineView.line), 0), true) }
    if (node == wrapper) {
      bad = true;
      node = wrapper.childNodes[offset];
      offset = 0;
      if (!node) {
        var line = lineView.rest ? lst(lineView.rest) : lineView.line;
        return badPos(Pos(lineNo(line), line.text.length), bad)
      }
    }

    var textNode = node.nodeType == 3 ? node : null, topNode = node;
    if (!textNode && node.childNodes.length == 1 && node.firstChild.nodeType == 3) {
      textNode = node.firstChild;
      if (offset) { offset = textNode.nodeValue.length; }
    }
    while (topNode.parentNode != wrapper) { topNode = topNode.parentNode; }
    var measure = lineView.measure, maps = measure.maps;

    function find(textNode, topNode, offset) {
      for (var i = -1; i < (maps ? maps.length : 0); i++) {
        var map = i < 0 ? measure.map : maps[i];
        for (var j = 0; j < map.length; j += 3) {
          var curNode = map[j + 2];
          if (curNode == textNode || curNode == topNode) {
            var line = lineNo(i < 0 ? lineView.line : lineView.rest[i]);
            var ch = map[j] + offset;
            if (offset < 0 || curNode != textNode) { ch = map[j + (offset ? 1 : 0)]; }
            return Pos(line, ch)
          }
        }
      }
    }
    var found = find(textNode, topNode, offset);
    if (found) { return badPos(found, bad) }

    // FIXME this is all really shaky. might handle the few cases it needs to handle, but likely to cause problems
    for (var after = topNode.nextSibling, dist = textNode ? textNode.nodeValue.length - offset : 0; after; after = after.nextSibling) {
      found = find(after, after.firstChild, 0);
      if (found)
        { return badPos(Pos(found.line, found.ch - dist), bad) }
      else
        { dist += after.textContent.length; }
    }
    for (var before = topNode.previousSibling, dist$1 = offset; before; before = before.previousSibling) {
      found = find(before, before.firstChild, -1);
      if (found)
        { return badPos(Pos(found.line, found.ch + dist$1), bad) }
      else
        { dist$1 += before.textContent.length; }
    }
  }

  // TEXTAREA INPUT STYLE

  var TextareaInput = function(cm) {
    this.cm = cm;
    // See input.poll and input.reset
    this.prevInput = "";

    // Flag that indicates whether we expect input to appear real soon
    // now (after some event like 'keypress' or 'input') and are
    // polling intensively.
    this.pollingFast = false;
    // Self-resetting timeout for the poller
    this.polling = new Delayed();
    // Used to work around IE issue with selection being forgotten when focus moves away from textarea
    this.hasSelection = false;
    this.composing = null;
  };

  TextareaInput.prototype.init = function (display) {
      var this$1 = this;

    var input = this, cm = this.cm;
    this.createField(display);
    var te = this.textarea;

    display.wrapper.insertBefore(this.wrapper, display.wrapper.firstChild);

    // Needed to hide big blue blinking cursor on Mobile Safari (doesn't seem to work in iOS 8 anymore)
    if (ios) { te.style.width = "0px"; }

    on(te, "input", function () {
      if (ie && ie_version >= 9 && this$1.hasSelection) { this$1.hasSelection = null; }
      input.poll();
    });

    on(te, "paste", function (e) {
      if (signalDOMEvent(cm, e) || handlePaste(e, cm)) { return }

      cm.state.pasteIncoming = +new Date;
      input.fastPoll();
    });

    function prepareCopyCut(e) {
      if (signalDOMEvent(cm, e)) { return }
      if (cm.somethingSelected()) {
        setLastCopied({lineWise: false, text: cm.getSelections()});
      } else if (!cm.options.lineWiseCopyCut) {
        return
      } else {
        var ranges = copyableRanges(cm);
        setLastCopied({lineWise: true, text: ranges.text});
        if (e.type == "cut") {
          cm.setSelections(ranges.ranges, null, sel_dontScroll);
        } else {
          input.prevInput = "";
          te.value = ranges.text.join("\n");
          selectInput(te);
        }
      }
      if (e.type == "cut") { cm.state.cutIncoming = +new Date; }
    }
    on(te, "cut", prepareCopyCut);
    on(te, "copy", prepareCopyCut);

    on(display.scroller, "paste", function (e) {
      if (eventInWidget(display, e) || signalDOMEvent(cm, e)) { return }
      if (!te.dispatchEvent) {
        cm.state.pasteIncoming = +new Date;
        input.focus();
        return
      }

      // Pass the ~~~paste~~~ event to the textarea so it's handled by its event listener.
      var event = new Event("paste");
      event.clipboardData = e.clipboardData;
      te.dispatchEvent(event);
    });

    // Prevent normal selection in the editor (we handle our own)
    on(display.lineSpace, "selectstart", function (e) {
      if (!eventInWidget(display, e)) { e_preventDefault(e); }
    });

    on(te, "compositionstart", function () {
      var start = cm.getCursor("from");
      if (input.composing) { input.composing.range.clear(); }
      input.composing = {
        start: start,
        range: cm.markText(start, cm.getCursor("to"), {className: "CodeMirror-composing"})
      };
    });
    on(te, "compositionend", function () {
      if (input.composing) {
        input.poll();
        input.composing.range.clear();
        input.composing = null;
      }
    });
  };

  TextareaInput.prototype.createField = function (_display) {
    // Wraps and hides input textarea
    this.wrapper = hiddenTextarea();
    // The semihidden textarea that is focused when the editor is
    // focused, and receives input.
    this.textarea = this.wrapper.firstChild;
  };

  TextareaInput.prototype.screenReaderLabelChanged = function (label) {
    // Label for screenreaders, accessibility
    if(label) {
      this.textarea.setAttribute('aria-label', label);
    } else {
      this.textarea.removeAttribute('aria-label');
    }
  };

  TextareaInput.prototype.prepareSelection = function () {
    // Redraw the selection and/or cursor
    var cm = this.cm, display = cm.display, doc = cm.doc;
    var result = prepareSelection(cm);

    // Move the hidden textarea near the cursor to prevent scrolling artifacts
    if (cm.options.moveInputWithCursor) {
      var headPos = cursorCoords(cm, doc.sel.primary().head, "div");
      var wrapOff = display.wrapper.getBoundingClientRect(), lineOff = display.lineDiv.getBoundingClientRect();
      result.teTop = Math.max(0, Math.min(display.wrapper.clientHeight - 10,
                                          headPos.top + lineOff.top - wrapOff.top));
      result.teLeft = Math.max(0, Math.min(display.wrapper.clientWidth - 10,
                                           headPos.left + lineOff.left - wrapOff.left));
    }

    return result
  };

  TextareaInput.prototype.showSelection = function (drawn) {
    var cm = this.cm, display = cm.display;
    removeChildrenAndAdd(display.cursorDiv, drawn.cursors);
    removeChildrenAndAdd(display.selectionDiv, drawn.selection);
    if (drawn.teTop != null) {
      this.wrapper.style.top = drawn.teTop + "px";
      this.wrapper.style.left = drawn.teLeft + "px";
    }
  };

  // Reset the input to correspond to the selection (or to be empty,
  // when not typing and nothing is selected)
  TextareaInput.prototype.reset = function (typing) {
    if (this.contextMenuPending || this.composing) { return }
    var cm = this.cm;
    if (cm.somethingSelected()) {
      this.prevInput = "";
      var content = cm.getSelection();
      this.textarea.value = content;
      if (cm.state.focused) { selectInput(this.textarea); }
      if (ie && ie_version >= 9) { this.hasSelection = content; }
    } else if (!typing) {
      this.prevInput = this.textarea.value = "";
      if (ie && ie_version >= 9) { this.hasSelection = null; }
    }
  };

  TextareaInput.prototype.getField = function () { return this.textarea };

  TextareaInput.prototype.supportsTouch = function () { return false };

  TextareaInput.prototype.focus = function () {
    if (this.cm.options.readOnly != "nocursor" && (!mobile || activeElt() != this.textarea)) {
      try { this.textarea.focus(); }
      catch (e) {} // IE8 will throw if the textarea is display: none or not in DOM
    }
  };

  TextareaInput.prototype.blur = function () { this.textarea.blur(); };

  TextareaInput.prototype.resetPosition = function () {
    this.wrapper.style.top = this.wrapper.style.left = 0;
  };

  TextareaInput.prototype.receivedFocus = function () { this.slowPoll(); };

  // Poll for input changes, using the normal rate of polling. This
  // runs as long as the editor is focused.
  TextareaInput.prototype.slowPoll = function () {
      var this$1 = this;

    if (this.pollingFast) { return }
    this.polling.set(this.cm.options.pollInterval, function () {
      this$1.poll();
      if (this$1.cm.state.focused) { this$1.slowPoll(); }
    });
  };

  // When an event has just come in that is likely to add or change
  // something in the input textarea, we poll faster, to ensure that
  // the change appears on the screen quickly.
  TextareaInput.prototype.fastPoll = function () {
    var missed = false, input = this;
    input.pollingFast = true;
    function p() {
      var changed = input.poll();
      if (!changed && !missed) {missed = true; input.polling.set(60, p);}
      else {input.pollingFast = false; input.slowPoll();}
    }
    input.polling.set(20, p);
  };

  // Read input from the textarea, and update the document to match.
  // When something is selected, it is present in the textarea, and
  // selected (unless it is huge, in which case a placeholder is
  // used). When nothing is selected, the cursor sits after previously
  // seen text (can be empty), which is stored in prevInput (we must
  // not reset the textarea when typing, because that breaks IME).
  TextareaInput.prototype.poll = function () {
      var this$1 = this;

    var cm = this.cm, input = this.textarea, prevInput = this.prevInput;
    // Since this is called a *lot*, try to bail out as cheaply as
    // possible when it is clear that nothing happened. hasSelection
    // will be the case when there is a lot of text in the textarea,
    // in which case reading its value would be expensive.
    if (this.contextMenuPending || !cm.state.focused ||
        (hasSelection(input) && !prevInput && !this.composing) ||
        cm.isReadOnly() || cm.options.disableInput || cm.state.keySeq)
      { return false }

    var text = input.value;
    // If nothing changed, bail.
    if (text == prevInput && !cm.somethingSelected()) { return false }
    // Work around nonsensical selection resetting in IE9/10, and
    // inexplicable appearance of private area unicode characters on
    // some key combos in Mac (#2689).
    if (ie && ie_version >= 9 && this.hasSelection === text ||
        mac && /[\uf700-\uf7ff]/.test(text)) {
      cm.display.input.reset();
      return false
    }

    if (cm.doc.sel == cm.display.selForContextMenu) {
      var first = text.charCodeAt(0);
      if (first == 0x200b && !prevInput) { prevInput = "\u200b"; }
      if (first == 0x21da) { this.reset(); return this.cm.execCommand("undo") }
    }
    // Find the part of the input that is actually new
    var same = 0, l = Math.min(prevInput.length, text.length);
    while (same < l && prevInput.charCodeAt(same) == text.charCodeAt(same)) { ++same; }

    runInOp(cm, function () {
      applyTextInput(cm, text.slice(same), prevInput.length - same,
                     null, this$1.composing ? "*compose" : null);

      // Don't leave long text in the textarea, since it makes further polling slow
      if (text.length > 1000 || text.indexOf("\n") > -1) { input.value = this$1.prevInput = ""; }
      else { this$1.prevInput = text; }

      if (this$1.composing) {
        this$1.composing.range.clear();
        this$1.composing.range = cm.markText(this$1.composing.start, cm.getCursor("to"),
                                           {className: "CodeMirror-composing"});
      }
    });
    return true
  };

  TextareaInput.prototype.ensurePolled = function () {
    if (this.pollingFast && this.poll()) { this.pollingFast = false; }
  };

  TextareaInput.prototype.onKeyPress = function () {
    if (ie && ie_version >= 9) { this.hasSelection = null; }
    this.fastPoll();
  };

  TextareaInput.prototype.onContextMenu = function (e) {
    var input = this, cm = input.cm, display = cm.display, te = input.textarea;
    if (input.contextMenuPending) { input.contextMenuPending(); }
    var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop;
    if (!pos || presto) { return } // Opera is difficult.

    // Reset the current text selection only if the click is done outside of the selection
    // and 'resetSelectionOnContextMenu' option is true.
    var reset = cm.options.resetSelectionOnContextMenu;
    if (reset && cm.doc.sel.contains(pos) == -1)
      { operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll); }

    var oldCSS = te.style.cssText, oldWrapperCSS = input.wrapper.style.cssText;
    var wrapperBox = input.wrapper.offsetParent.getBoundingClientRect();
    input.wrapper.style.cssText = "position: static";
    te.style.cssText = "position: absolute; width: 30px; height: 30px;\n      top: " + (e.clientY - wrapperBox.top - 5) + "px; left: " + (e.clientX - wrapperBox.left - 5) + "px;\n      z-index: 1000; background: " + (ie ? "rgba(255, 255, 255, .05)" : "transparent") + ";\n      outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";
    var oldScrollY;
    if (webkit) { oldScrollY = window.scrollY; } // Work around Chrome issue (#2712)
    display.input.focus();
    if (webkit) { window.scrollTo(null, oldScrollY); }
    display.input.reset();
    // Adds "Select all" to context menu in FF
    if (!cm.somethingSelected()) { te.value = input.prevInput = " "; }
    input.contextMenuPending = rehide;
    display.selForContextMenu = cm.doc.sel;
    clearTimeout(display.detectingSelectAll);

    // Select-all will be greyed out if there's nothing to select, so
    // this adds a zero-width space so that we can later check whether
    // it got selected.
    function prepareSelectAllHack() {
      if (te.selectionStart != null) {
        var selected = cm.somethingSelected();
        var extval = "\u200b" + (selected ? te.value : "");
        te.value = "\u21da"; // Used to catch context-menu undo
        te.value = extval;
        input.prevInput = selected ? "" : "\u200b";
        te.selectionStart = 1; te.selectionEnd = extval.length;
        // Re-set this, in case some other handler touched the
        // selection in the meantime.
        display.selForContextMenu = cm.doc.sel;
      }
    }
    function rehide() {
      if (input.contextMenuPending != rehide) { return }
      input.contextMenuPending = false;
      input.wrapper.style.cssText = oldWrapperCSS;
      te.style.cssText = oldCSS;
      if (ie && ie_version < 9) { display.scrollbars.setScrollTop(display.scroller.scrollTop = scrollPos); }

      // Try to detect the user choosing select-all
      if (te.selectionStart != null) {
        if (!ie || (ie && ie_version < 9)) { prepareSelectAllHack(); }
        var i = 0, poll = function () {
          if (display.selForContextMenu == cm.doc.sel && te.selectionStart == 0 &&
              te.selectionEnd > 0 && input.prevInput == "\u200b") {
            operation(cm, selectAll)(cm);
          } else if (i++ < 10) {
            display.detectingSelectAll = setTimeout(poll, 500);
          } else {
            display.selForContextMenu = null;
            display.input.reset();
          }
        };
        display.detectingSelectAll = setTimeout(poll, 200);
      }
    }

    if (ie && ie_version >= 9) { prepareSelectAllHack(); }
    if (captureRightClick) {
      e_stop(e);
      var mouseup = function () {
        off(window, "mouseup", mouseup);
        setTimeout(rehide, 20);
      };
      on(window, "mouseup", mouseup);
    } else {
      setTimeout(rehide, 50);
    }
  };

  TextareaInput.prototype.readOnlyChanged = function (val) {
    if (!val) { this.reset(); }
    this.textarea.disabled = val == "nocursor";
    this.textarea.readOnly = !!val;
  };

  TextareaInput.prototype.setUneditable = function () {};

  TextareaInput.prototype.needsContentAttribute = false;

  function fromTextArea(textarea, options) {
    options = options ? copyObj(options) : {};
    options.value = textarea.value;
    if (!options.tabindex && textarea.tabIndex)
      { options.tabindex = textarea.tabIndex; }
    if (!options.placeholder && textarea.placeholder)
      { options.placeholder = textarea.placeholder; }
    // Set autofocus to true if this textarea is focused, or if it has
    // autofocus and no other element is focused.
    if (options.autofocus == null) {
      var hasFocus = activeElt();
      options.autofocus = hasFocus == textarea ||
        textarea.getAttribute("autofocus") != null && hasFocus == document.body;
    }

    function save() {textarea.value = cm.getValue();}

    var realSubmit;
    if (textarea.form) {
      on(textarea.form, "submit", save);
      // Deplorable hack to make the submit method do the right thing.
      if (!options.leaveSubmitMethodAlone) {
        var form = textarea.form;
        realSubmit = form.submit;
        try {
          var wrappedSubmit = form.submit = function () {
            save();
            form.submit = realSubmit;
            form.submit();
            form.submit = wrappedSubmit;
          };
        } catch(e) {}
      }
    }

    options.finishInit = function (cm) {
      cm.save = save;
      cm.getTextArea = function () { return textarea; };
      cm.toTextArea = function () {
        cm.toTextArea = isNaN; // Prevent this from being ran twice
        save();
        textarea.parentNode.removeChild(cm.getWrapperElement());
        textarea.style.display = "";
        if (textarea.form) {
          off(textarea.form, "submit", save);
          if (!options.leaveSubmitMethodAlone && typeof textarea.form.submit == "function")
            { textarea.form.submit = realSubmit; }
        }
      };
    };

    textarea.style.display = "none";
    var cm = CodeMirror(function (node) { return textarea.parentNode.insertBefore(node, textarea.nextSibling); },
      options);
    return cm
  }

  function addLegacyProps(CodeMirror) {
    CodeMirror.off = off;
    CodeMirror.on = on;
    CodeMirror.wheelEventPixels = wheelEventPixels;
    CodeMirror.Doc = Doc;
    CodeMirror.splitLines = splitLinesAuto;
    CodeMirror.countColumn = countColumn;
    CodeMirror.findColumn = findColumn;
    CodeMirror.isWordChar = isWordCharBasic;
    CodeMirror.Pass = Pass;
    CodeMirror.signal = signal;
    CodeMirror.Line = Line;
    CodeMirror.changeEnd = changeEnd;
    CodeMirror.scrollbarModel = scrollbarModel;
    CodeMirror.Pos = Pos;
    CodeMirror.cmpPos = cmp;
    CodeMirror.modes = modes;
    CodeMirror.mimeModes = mimeModes;
    CodeMirror.resolveMode = resolveMode;
    CodeMirror.getMode = getMode;
    CodeMirror.modeExtensions = modeExtensions;
    CodeMirror.extendMode = extendMode;
    CodeMirror.copyState = copyState;
    CodeMirror.startState = startState;
    CodeMirror.innerMode = innerMode;
    CodeMirror.commands = commands;
    CodeMirror.keyMap = keyMap;
    CodeMirror.keyName = keyName;
    CodeMirror.isModifierKey = isModifierKey;
    CodeMirror.lookupKey = lookupKey;
    CodeMirror.normalizeKeyMap = normalizeKeyMap;
    CodeMirror.StringStream = StringStream;
    CodeMirror.SharedTextMarker = SharedTextMarker;
    CodeMirror.TextMarker = TextMarker;
    CodeMirror.LineWidget = LineWidget;
    CodeMirror.e_preventDefault = e_preventDefault;
    CodeMirror.e_stopPropagation = e_stopPropagation;
    CodeMirror.e_stop = e_stop;
    CodeMirror.addClass = addClass;
    CodeMirror.contains = contains;
    CodeMirror.rmClass = rmClass;
    CodeMirror.keyNames = keyNames;
  }

  // EDITOR CONSTRUCTOR

  defineOptions(CodeMirror);

  addEditorMethods(CodeMirror);

  // Set up methods on CodeMirror's prototype to redirect to the editor's document.
  var dontDelegate = "iter insert remove copy getEditor constructor".split(" ");
  for (var prop in Doc.prototype) { if (Doc.prototype.hasOwnProperty(prop) && indexOf(dontDelegate, prop) < 0)
    { CodeMirror.prototype[prop] = (function(method) {
      return function() {return method.apply(this.doc, arguments)}
    })(Doc.prototype[prop]); } }

  eventMixin(Doc);
  CodeMirror.inputStyles = {"textarea": TextareaInput, "contenteditable": ContentEditableInput};

  // Extra arguments are stored as the mode's dependencies, which is
  // used by (legacy) mechanisms like loadmode.js to automatically
  // load a mode. (Preferred mechanism is the require/define calls.)
  CodeMirror.defineMode = function(name/*, mode, …*/) {
    if (!CodeMirror.defaults.mode && name != "null") { CodeMirror.defaults.mode = name; }
    defineMode.apply(this, arguments);
  };

  CodeMirror.defineMIME = defineMIME;

  // Minimal default mode.
  CodeMirror.defineMode("null", function () { return ({token: function (stream) { return stream.skipToEnd(); }}); });
  CodeMirror.defineMIME("text/plain", "null");

  // EXTENSIONS

  CodeMirror.defineExtension = function (name, func) {
    CodeMirror.prototype[name] = func;
  };
  CodeMirror.defineDocExtension = function (name, func) {
    Doc.prototype[name] = func;
  };

  CodeMirror.fromTextArea = fromTextArea;

  addLegacyProps(CodeMirror);

  CodeMirror.version = "5.62.2";

  return CodeMirror;

})));
	`,
	"css/codemirror.css": `
	/* BASICS */

.CodeMirror {
  /* Set height, width, borders, and global font properties here */
  font-family: monospace;
  height: 300px;
  color: black;
  direction: ltr;
}

/* PADDING */

.CodeMirror-lines {
  padding: 4px 0; /* Vertical padding around content */
}
.CodeMirror pre.CodeMirror-line,
.CodeMirror pre.CodeMirror-line-like {
  padding: 0 4px; /* Horizontal padding of content */
}

.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
  background-color: white; /* The little square between H and V scrollbars */
}

/* GUTTER */

.CodeMirror-gutters {
  border-right: 1px solid #ddd;
  background-color: #f7f7f7;
  white-space: nowrap;
}
.CodeMirror-linenumbers {}
.CodeMirror-linenumber {
  padding: 0 3px 0 5px;
  min-width: 20px;
  text-align: right;
  color: #999;
  white-space: nowrap;
}

.CodeMirror-guttermarker { color: black; }
.CodeMirror-guttermarker-subtle { color: #999; }

/* CURSOR */

.CodeMirror-cursor {
  border-left: 1px solid black;
  border-right: none;
  width: 0;
}
/* Shown when moving in bi-directional text */
.CodeMirror div.CodeMirror-secondarycursor {
  border-left: 1px solid silver;
}
.cm-fat-cursor .CodeMirror-cursor {
  width: auto;
  border: 0 !important;
  background: #7e7;
}
.cm-fat-cursor div.CodeMirror-cursors {
  z-index: 1;
}
.cm-fat-cursor-mark {
  background-color: rgba(20, 255, 20, 0.5);
  -webkit-animation: blink 1.06s steps(1) infinite;
  -moz-animation: blink 1.06s steps(1) infinite;
  animation: blink 1.06s steps(1) infinite;
}
.cm-animate-fat-cursor {
  width: auto;
  border: 0;
  -webkit-animation: blink 1.06s steps(1) infinite;
  -moz-animation: blink 1.06s steps(1) infinite;
  animation: blink 1.06s steps(1) infinite;
  background-color: #7e7;
}
@-moz-keyframes blink {
  0% {}
  50% { background-color: transparent; }
  100% {}
}
@-webkit-keyframes blink {
  0% {}
  50% { background-color: transparent; }
  100% {}
}
@keyframes blink {
  0% {}
  50% { background-color: transparent; }
  100% {}
}

/* Can style cursor different in overwrite (non-insert) mode */
.CodeMirror-overwrite .CodeMirror-cursor {}

.cm-tab { display: inline-block; text-decoration: inherit; }

.CodeMirror-rulers {
  position: absolute;
  left: 0; right: 0; top: -50px; bottom: 0;
  overflow: hidden;
}
.CodeMirror-ruler {
  border-left: 1px solid #ccc;
  top: 0; bottom: 0;
  position: absolute;
}

/* DEFAULT THEME */

.cm-s-default .cm-header {color: blue;}
.cm-s-default .cm-quote {color: #090;}
.cm-negative {color: #d44;}
.cm-positive {color: #292;}
.cm-header, .cm-strong {font-weight: bold;}
.cm-em {font-style: italic;}
.cm-link {text-decoration: underline;}
.cm-strikethrough {text-decoration: line-through;}

.cm-s-default .cm-keyword {color: #708;}
.cm-s-default .cm-atom {color: #219;}
.cm-s-default .cm-number {color: #164;}
.cm-s-default .cm-def {color: #00f;}
.cm-s-default .cm-variable,
.cm-s-default .cm-punctuation,
.cm-s-default .cm-property,
.cm-s-default .cm-operator {}
.cm-s-default .cm-variable-2 {color: #05a;}
.cm-s-default .cm-variable-3, .cm-s-default .cm-type {color: #085;}
.cm-s-default .cm-comment {color: #a50;}
.cm-s-default .cm-string {color: #a11;}
.cm-s-default .cm-string-2 {color: #f50;}
.cm-s-default .cm-meta {color: #555;}
.cm-s-default .cm-qualifier {color: #555;}
.cm-s-default .cm-builtin {color: #30a;}
.cm-s-default .cm-bracket {color: #997;}
.cm-s-default .cm-tag {color: #170;}
.cm-s-default .cm-attribute {color: #00c;}
.cm-s-default .cm-hr {color: #999;}
.cm-s-default .cm-link {color: #00c;}

.cm-s-default .cm-error {color: #f00;}
.cm-invalidchar {color: #f00;}

.CodeMirror-composing { border-bottom: 2px solid; }

/* Default styles for common addons */

div.CodeMirror span.CodeMirror-matchingbracket {color: #0b0;}
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;}
.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }
.CodeMirror-activeline-background {background: #e8f2ff;}

/* STOP */

/* The rest of this file contains styles related to the mechanics of
   the editor. You probably shouldn't touch them. */

.CodeMirror {
  position: relative;
  overflow: hidden;
  background: white;
}

.CodeMirror-scroll {
  overflow: scroll !important; /* Things will break if this is overridden */
  /* 50px is the magic margin used to hide the element's real scrollbars */
  /* See overflow: hidden in .CodeMirror */
  margin-bottom: -50px; margin-right: -50px;
  padding-bottom: 50px;
  height: 100%;
  outline: none; /* Prevent dragging from highlighting the element */
  position: relative;
}
.CodeMirror-sizer {
  position: relative;
  border-right: 50px solid transparent;
}

/* The fake, visible scrollbars. Used to force redraw during scrolling
   before actual scrolling happens, thus preventing shaking and
   flickering artifacts. */
.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
  position: absolute;
  z-index: 6;
  display: none;
  outline: none;
}
.CodeMirror-vscrollbar {
  right: 0; top: 0;
  overflow-x: hidden;
  overflow-y: scroll;
}
.CodeMirror-hscrollbar {
  bottom: 0; left: 0;
  overflow-y: hidden;
  overflow-x: scroll;
}
.CodeMirror-scrollbar-filler {
  right: 0; bottom: 0;
}
.CodeMirror-gutter-filler {
  left: 0; bottom: 0;
}

.CodeMirror-gutters {
  position: absolute; left: 0; top: 0;
  min-height: 100%;
  z-index: 3;
}
.CodeMirror-gutter {
  white-space: normal;
  height: 100%;
  display: inline-block;
  vertical-align: top;
  margin-bottom: -50px;
}
.CodeMirror-gutter-wrapper {
  position: absolute;
  z-index: 4;
  background: none !important;
  border: none !important;
}
.CodeMirror-gutter-background {
  position: absolute;
  top: 0; bottom: 0;
  z-index: 4;
}
.CodeMirror-gutter-elt {
  position: absolute;
  cursor: default;
  z-index: 4;
}
.CodeMirror-gutter-wrapper ::selection { background-color: transparent }
.CodeMirror-gutter-wrapper ::-moz-selection { background-color: transparent }

.CodeMirror-lines {
  cursor: text;
  min-height: 1px; /* prevents collapsing before first draw */
}
.CodeMirror pre.CodeMirror-line,
.CodeMirror pre.CodeMirror-line-like {
  /* Reset some styles that the rest of the page might have set */
  -moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;
  border-width: 0;
  background: transparent;
  font-family: inherit;
  font-size: inherit;
  margin: 0;
  white-space: pre;
  word-wrap: normal;
  line-height: inherit;
  color: inherit;
  z-index: 2;
  position: relative;
  overflow: visible;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-variant-ligatures: contextual;
  font-variant-ligatures: contextual;
}
.CodeMirror-wrap pre.CodeMirror-line,
.CodeMirror-wrap pre.CodeMirror-line-like {
  word-wrap: break-word;
  white-space: pre-wrap;
  word-break: normal;
}

.CodeMirror-linebackground {
  position: absolute;
  left: 0; right: 0; top: 0; bottom: 0;
  z-index: 0;
}

.CodeMirror-linewidget {
  position: relative;
  z-index: 2;
  padding: 0.1px; /* Force widget margins to stay inside of the container */
}

.CodeMirror-widget {}

.CodeMirror-rtl pre { direction: rtl; }

.CodeMirror-code {
  outline: none;
}

/* Force content-box sizing for the elements where we expect it */
.CodeMirror-scroll,
.CodeMirror-sizer,
.CodeMirror-gutter,
.CodeMirror-gutters,
.CodeMirror-linenumber {
  -moz-box-sizing: content-box;
  box-sizing: content-box;
}

.CodeMirror-measure {
  position: absolute;
  width: 100%;
  height: 0;
  overflow: hidden;
  visibility: hidden;
}

.CodeMirror-cursor {
  position: absolute;
  pointer-events: none;
}
.CodeMirror-measure pre { position: static; }

div.CodeMirror-cursors {
  visibility: hidden;
  position: relative;
  z-index: 3;
}
div.CodeMirror-dragcursors {
  visibility: visible;
}

.CodeMirror-focused div.CodeMirror-cursors {
  visibility: visible;
}

.CodeMirror-selected { background: #d9d9d9; }
.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
.CodeMirror-crosshair { cursor: crosshair; }
.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; }
.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; }

.cm-searching {
  background-color: #ffa;
  background-color: rgba(255, 255, 0, .4);
}

/* Used to force a border model for a node */
.cm-force-border { padding-right: .1px; }

@media print {
  /* Hide the cursor when printing */
  .CodeMirror div.CodeMirror-cursors {
    visibility: hidden;
  }
}

/* See issue #2901 */
.cm-tab-wrap-hack:after { content: ''; }

/* Help users use markselection to safely style text background */
span.CodeMirror-selectedtext { background: none; }

	`,
	"js/simple-copy.min.js": `
	/* simple-copy.js 0.5.3 | Copyright (c) 2021 Guilherme Nascimento (brcontainer@yahoo.com.br) | Released under the MIT license */
!function(e){"use strict";var t="undefined"!=typeof window?window:{},n=t.document||{},o=t.jQuery,r=n.implementation.createHTMLDocument("").body,i="data-simplecopy-",l="script,noscript,object,link,img,[simple-copy-ignore=true]";function c(e){return"true"!==e.hasAttribute("simple-copy-ignore")&&!e.offsetWidth&&!e.offsetHeight&&!e.getClientRects().length}function a(t,o,i,a,p){if("string"==typeof t)try{t=n.querySelector(t)}catch(e){return!1}if(!t||1!==t.nodeType)return!1;var f="object"==typeof t.form;if(i&&!f)return function(t){for(var n=t.getElementsByTagName("*"),o=[],i=n.length-1;i>=0;i--)c(u=n[i])&&(u.setAttribute("simple-copy-ignore","true"),o.push(u));for(r.innerHTML=t.innerHTML,i=o.length-1;i>=0;i--)o[i].removeAttribute("simple-copy-ignore");o=e;var a=r.querySelectorAll(l);for(i=a.length-1;i>=0;i--){var u;(u=a[i])&&u.parentNode&&u.parentNode.removeChild(u)}return s(r.textContent)}(t);var d=t.ownerDocument,m=d.defaultView.getSelection(),y=d.createRange(),g=!o&&!f,v=t.isContentEditable;if(m.removeAllRanges(),g&&(t.contentEditable=!a||"inherit"),f&&!a){if(o)return u(t);if("SELECT"===t.nodeName&&p){for(var h,b=0,C=[],x=t.options,T=x.length;b<T;b++)x[b].selected&&C.push(x[b].value);h=C.join(p)}else h=t.value;return s(h)}if(a?y.selectNode(t):y.selectNodeContents(t),m.addRange(y),!o){var E=d.execCommand("copy");return g&&(t.contentEditable=!!v||"inherit"),m.removeAllRanges(),t.blur(),E}}function u(e){e.focus(),e.select&&e.select()}function s(t){var o=n.scrollingElement||n.body,r=n.createElement("textarea"),i=o.scrollLeft,l=o.scrollTop;r.style.cssText="position:absolute;left:"+i+"px;top:"+l+"px;opacity:0",r.value=t,n.body.appendChild(r),u(r);var c=n.execCommand("copy");return n.body.removeChild(r),o.scrollLeft=i,o.scrollTop=l,o=r=e,c}function p(e,t,n){var o=e.getAttribute(i+t);return n?o:"true"===o}n.addEventListener("click",function(e){if(0===e.button){var t,o,i=e.target,l=p(i,"data",!0);if(l)r.innerHTML=l,a(r,!1,!0);else{if(!(o=p(i,"target",!0)))return;(t=n.querySelector(o))&&a(t,p(i,"select"),p(i,"text"),p(i,"node"),p(i,"multiple",!0))}}});var f={select:function(e,t){return a(e,!0,!1,(t=t||{}).node)},copy:function(e,t){return a(e,!1,(t=t||{}).text,t.node,t.multiple)},data:s};o&&o.extend&&(o.fn.simpleCopy=function(t){var n=this[0];n&&(t||(t={}),t.type===e&&(action="copy"),"copy"!==action&&"select"!==action||f[action](n,t))}),t.SimpleCopy=f}();


	`,
	"js/zepto.min.js": `/* Zepto v1.2.0 - zepto event ajax form ie - zeptojs.com/license */
	!function(t,e){"function"==typeof define&&define.amd?define(function(){return e(t)}):e(t)}(this,function(t){var e=function(){function $(t){return null==t?String(t):S[C.call(t)]||"object"}function F(t){return"function"==$(t)}function k(t){return null!=t&&t==t.window}function M(t){return null!=t&&t.nodeType==t.DOCUMENT_NODE}function R(t){return"object"==$(t)}function Z(t){return R(t)&&!k(t)&&Object.getPrototypeOf(t)==Object.prototype}function z(t){var e=!!t&&"length"in t&&t.length,n=r.type(t);return"function"!=n&&!k(t)&&("array"==n||0===e||"number"==typeof e&&e>0&&e-1 in t)}function q(t){return a.call(t,function(t){return null!=t})}function H(t){return t.length>0?r.fn.concat.apply([],t):t}function I(t){return t.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function V(t){return t in l?l[t]:l[t]=new RegExp("(^|\\s)"+t+"(\\s|$)")}function _(t,e){return"number"!=typeof e||h[I(t)]?e:e+"px"}function B(t){var e,n;return c[t]||(e=f.createElement(t),f.body.appendChild(e),n=getComputedStyle(e,"").getPropertyValue("display"),e.parentNode.removeChild(e),"none"==n&&(n="block"),c[t]=n),c[t]}function U(t){return"children"in t?u.call(t.children):r.map(t.childNodes,function(t){return 1==t.nodeType?t:void 0})}function X(t,e){var n,r=t?t.length:0;for(n=0;r>n;n++)this[n]=t[n];this.length=r,this.selector=e||""}function J(t,r,i){for(n in r)i&&(Z(r[n])||L(r[n]))?(Z(r[n])&&!Z(t[n])&&(t[n]={}),L(r[n])&&!L(t[n])&&(t[n]=[]),J(t[n],r[n],i)):r[n]!==e&&(t[n]=r[n])}function W(t,e){return null==e?r(t):r(t).filter(e)}function Y(t,e,n,r){return F(e)?e.call(t,n,r):e}function G(t,e,n){null==n?t.removeAttribute(e):t.setAttribute(e,n)}function K(t,n){var r=t.className||"",i=r&&r.baseVal!==e;return n===e?i?r.baseVal:r:void(i?r.baseVal=n:t.className=n)}function Q(t){try{return t?"true"==t||("false"==t?!1:"null"==t?null:+t+""==t?+t:/^[\[\{]/.test(t)?r.parseJSON(t):t):t}catch(e){return t}}function tt(t,e){e(t);for(var n=0,r=t.childNodes.length;r>n;n++)tt(t.childNodes[n],e)}var e,n,r,i,O,P,o=[],s=o.concat,a=o.filter,u=o.slice,f=t.document,c={},l={},h={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},p=/^\s*<(\w+|!)[^>]*>/,d=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,m=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,g=/^(?:body|html)$/i,v=/([A-Z])/g,y=["val","css","html","text","data","width","height","offset"],x=["after","prepend","before","append"],b=f.createElement("table"),E=f.createElement("tr"),j={tr:f.createElement("tbody"),tbody:b,thead:b,tfoot:b,td:E,th:E,"*":f.createElement("div")},w=/complete|loaded|interactive/,T=/^[\w-]*$/,S={},C=S.toString,N={},A=f.createElement("div"),D={tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},L=Array.isArray||function(t){return t instanceof Array};return N.matches=function(t,e){if(!e||!t||1!==t.nodeType)return!1;var n=t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.oMatchesSelector||t.matchesSelector;if(n)return n.call(t,e);var r,i=t.parentNode,o=!i;return o&&(i=A).appendChild(t),r=~N.qsa(i,e).indexOf(t),o&&A.removeChild(t),r},O=function(t){return t.replace(/-+(.)?/g,function(t,e){return e?e.toUpperCase():""})},P=function(t){return a.call(t,function(e,n){return t.indexOf(e)==n})},N.fragment=function(t,n,i){var o,s,a;return d.test(t)&&(o=r(f.createElement(RegExp.$1))),o||(t.replace&&(t=t.replace(m,"<$1></$2>")),n===e&&(n=p.test(t)&&RegExp.$1),n in j||(n="*"),a=j[n],a.innerHTML=""+t,o=r.each(u.call(a.childNodes),function(){a.removeChild(this)})),Z(i)&&(s=r(o),r.each(i,function(t,e){y.indexOf(t)>-1?s[t](e):s.attr(t,e)})),o},N.Z=function(t,e){return new X(t,e)},N.isZ=function(t){return t instanceof N.Z},N.init=function(t,n){var i;if(!t)return N.Z();if("string"==typeof t)if(t=t.trim(),"<"==t[0]&&p.test(t))i=N.fragment(t,RegExp.$1,n),t=null;else{if(n!==e)return r(n).find(t);i=N.qsa(f,t)}else{if(F(t))return r(f).ready(t);if(N.isZ(t))return t;if(L(t))i=q(t);else if(R(t))i=[t],t=null;else if(p.test(t))i=N.fragment(t.trim(),RegExp.$1,n),t=null;else{if(n!==e)return r(n).find(t);i=N.qsa(f,t)}}return N.Z(i,t)},r=function(t,e){return N.init(t,e)},r.extend=function(t){var e,n=u.call(arguments,1);return"boolean"==typeof t&&(e=t,t=n.shift()),n.forEach(function(n){J(t,n,e)}),t},N.qsa=function(t,e){var n,r="#"==e[0],i=!r&&"."==e[0],o=r||i?e.slice(1):e,s=T.test(o);return t.getElementById&&s&&r?(n=t.getElementById(o))?[n]:[]:1!==t.nodeType&&9!==t.nodeType&&11!==t.nodeType?[]:u.call(s&&!r&&t.getElementsByClassName?i?t.getElementsByClassName(o):t.getElementsByTagName(e):t.querySelectorAll(e))},r.contains=f.documentElement.contains?function(t,e){return t!==e&&t.contains(e)}:function(t,e){for(;e&&(e=e.parentNode);)if(e===t)return!0;return!1},r.type=$,r.isFunction=F,r.isWindow=k,r.isArray=L,r.isPlainObject=Z,r.isEmptyObject=function(t){var e;for(e in t)return!1;return!0},r.isNumeric=function(t){var e=Number(t),n=typeof t;return null!=t&&"boolean"!=n&&("string"!=n||t.length)&&!isNaN(e)&&isFinite(e)||!1},r.inArray=function(t,e,n){return o.indexOf.call(e,t,n)},r.camelCase=O,r.trim=function(t){return null==t?"":String.prototype.trim.call(t)},r.uuid=0,r.support={},r.expr={},r.noop=function(){},r.map=function(t,e){var n,i,o,r=[];if(z(t))for(i=0;i<t.length;i++)n=e(t[i],i),null!=n&&r.push(n);else for(o in t)n=e(t[o],o),null!=n&&r.push(n);return H(r)},r.each=function(t,e){var n,r;if(z(t)){for(n=0;n<t.length;n++)if(e.call(t[n],n,t[n])===!1)return t}else for(r in t)if(e.call(t[r],r,t[r])===!1)return t;return t},r.grep=function(t,e){return a.call(t,e)},t.JSON&&(r.parseJSON=JSON.parse),r.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(t,e){S["[object "+e+"]"]=e.toLowerCase()}),r.fn={constructor:N.Z,length:0,forEach:o.forEach,reduce:o.reduce,push:o.push,sort:o.sort,splice:o.splice,indexOf:o.indexOf,concat:function(){var t,e,n=[];for(t=0;t<arguments.length;t++)e=arguments[t],n[t]=N.isZ(e)?e.toArray():e;return s.apply(N.isZ(this)?this.toArray():this,n)},map:function(t){return r(r.map(this,function(e,n){return t.call(e,n,e)}))},slice:function(){return r(u.apply(this,arguments))},ready:function(t){return w.test(f.readyState)&&f.body?t(r):f.addEventListener("DOMContentLoaded",function(){t(r)},!1),this},get:function(t){return t===e?u.call(this):this[t>=0?t:t+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each(function(){null!=this.parentNode&&this.parentNode.removeChild(this)})},each:function(t){return o.every.call(this,function(e,n){return t.call(e,n,e)!==!1}),this},filter:function(t){return F(t)?this.not(this.not(t)):r(a.call(this,function(e){return N.matches(e,t)}))},add:function(t,e){return r(P(this.concat(r(t,e))))},is:function(t){return this.length>0&&N.matches(this[0],t)},not:function(t){var n=[];if(F(t)&&t.call!==e)this.each(function(e){t.call(this,e)||n.push(this)});else{var i="string"==typeof t?this.filter(t):z(t)&&F(t.item)?u.call(t):r(t);this.forEach(function(t){i.indexOf(t)<0&&n.push(t)})}return r(n)},has:function(t){return this.filter(function(){return R(t)?r.contains(this,t):r(this).find(t).size()})},eq:function(t){return-1===t?this.slice(t):this.slice(t,+t+1)},first:function(){var t=this[0];return t&&!R(t)?t:r(t)},last:function(){var t=this[this.length-1];return t&&!R(t)?t:r(t)},find:function(t){var e,n=this;return e=t?"object"==typeof t?r(t).filter(function(){var t=this;return o.some.call(n,function(e){return r.contains(e,t)})}):1==this.length?r(N.qsa(this[0],t)):this.map(function(){return N.qsa(this,t)}):r()},closest:function(t,e){var n=[],i="object"==typeof t&&r(t);return this.each(function(r,o){for(;o&&!(i?i.indexOf(o)>=0:N.matches(o,t));)o=o!==e&&!M(o)&&o.parentNode;o&&n.indexOf(o)<0&&n.push(o)}),r(n)},parents:function(t){for(var e=[],n=this;n.length>0;)n=r.map(n,function(t){return(t=t.parentNode)&&!M(t)&&e.indexOf(t)<0?(e.push(t),t):void 0});return W(e,t)},parent:function(t){return W(P(this.pluck("parentNode")),t)},children:function(t){return W(this.map(function(){return U(this)}),t)},contents:function(){return this.map(function(){return this.contentDocument||u.call(this.childNodes)})},siblings:function(t){return W(this.map(function(t,e){return a.call(U(e.parentNode),function(t){return t!==e})}),t)},empty:function(){return this.each(function(){this.innerHTML=""})},pluck:function(t){return r.map(this,function(e){return e[t]})},show:function(){return this.each(function(){"none"==this.style.display&&(this.style.display=""),"none"==getComputedStyle(this,"").getPropertyValue("display")&&(this.style.display=B(this.nodeName))})},replaceWith:function(t){return this.before(t).remove()},wrap:function(t){var e=F(t);if(this[0]&&!e)var n=r(t).get(0),i=n.parentNode||this.length>1;return this.each(function(o){r(this).wrapAll(e?t.call(this,o):i?n.cloneNode(!0):n)})},wrapAll:function(t){if(this[0]){r(this[0]).before(t=r(t));for(var e;(e=t.children()).length;)t=e.first();r(t).append(this)}return this},wrapInner:function(t){var e=F(t);return this.each(function(n){var i=r(this),o=i.contents(),s=e?t.call(this,n):t;o.length?o.wrapAll(s):i.append(s)})},unwrap:function(){return this.parent().each(function(){r(this).replaceWith(r(this).children())}),this},clone:function(){return this.map(function(){return this.cloneNode(!0)})},hide:function(){return this.css("display","none")},toggle:function(t){return this.each(function(){var n=r(this);(t===e?"none"==n.css("display"):t)?n.show():n.hide()})},prev:function(t){return r(this.pluck("previousElementSibling")).filter(t||"*")},next:function(t){return r(this.pluck("nextElementSibling")).filter(t||"*")},html:function(t){return 0 in arguments?this.each(function(e){var n=this.innerHTML;r(this).empty().append(Y(this,t,e,n))}):0 in this?this[0].innerHTML:null},text:function(t){return 0 in arguments?this.each(function(e){var n=Y(this,t,e,this.textContent);this.textContent=null==n?"":""+n}):0 in this?this.pluck("textContent").join(""):null},attr:function(t,r){var i;return"string"!=typeof t||1 in arguments?this.each(function(e){if(1===this.nodeType)if(R(t))for(n in t)G(this,n,t[n]);else G(this,t,Y(this,r,e,this.getAttribute(t)))}):0 in this&&1==this[0].nodeType&&null!=(i=this[0].getAttribute(t))?i:e},removeAttr:function(t){return this.each(function(){1===this.nodeType&&t.split(" ").forEach(function(t){G(this,t)},this)})},prop:function(t,e){return t=D[t]||t,1 in arguments?this.each(function(n){this[t]=Y(this,e,n,this[t])}):this[0]&&this[0][t]},removeProp:function(t){return t=D[t]||t,this.each(function(){delete this[t]})},data:function(t,n){var r="data-"+t.replace(v,"-$1").toLowerCase(),i=1 in arguments?this.attr(r,n):this.attr(r);return null!==i?Q(i):e},val:function(t){return 0 in arguments?(null==t&&(t=""),this.each(function(e){this.value=Y(this,t,e,this.value)})):this[0]&&(this[0].multiple?r(this[0]).find("option").filter(function(){return this.selected}).pluck("value"):this[0].value)},offset:function(e){if(e)return this.each(function(t){var n=r(this),i=Y(this,e,t,n.offset()),o=n.offsetParent().offset(),s={top:i.top-o.top,left:i.left-o.left};"static"==n.css("position")&&(s.position="relative"),n.css(s)});if(!this.length)return null;if(f.documentElement!==this[0]&&!r.contains(f.documentElement,this[0]))return{top:0,left:0};var n=this[0].getBoundingClientRect();return{left:n.left+t.pageXOffset,top:n.top+t.pageYOffset,width:Math.round(n.width),height:Math.round(n.height)}},css:function(t,e){if(arguments.length<2){var i=this[0];if("string"==typeof t){if(!i)return;return i.style[O(t)]||getComputedStyle(i,"").getPropertyValue(t)}if(L(t)){if(!i)return;var o={},s=getComputedStyle(i,"");return r.each(t,function(t,e){o[e]=i.style[O(e)]||s.getPropertyValue(e)}),o}}var a="";if("string"==$(t))e||0===e?a=I(t)+":"+_(t,e):this.each(function(){this.style.removeProperty(I(t))});else for(n in t)t[n]||0===t[n]?a+=I(n)+":"+_(n,t[n])+";":this.each(function(){this.style.removeProperty(I(n))});return this.each(function(){this.style.cssText+=";"+a})},index:function(t){return t?this.indexOf(r(t)[0]):this.parent().children().indexOf(this[0])},hasClass:function(t){return t?o.some.call(this,function(t){return this.test(K(t))},V(t)):!1},addClass:function(t){return t?this.each(function(e){if("className"in this){i=[];var n=K(this),o=Y(this,t,e,n);o.split(/\s+/g).forEach(function(t){r(this).hasClass(t)||i.push(t)},this),i.length&&K(this,n+(n?" ":"")+i.join(" "))}}):this},removeClass:function(t){return this.each(function(n){if("className"in this){if(t===e)return K(this,"");i=K(this),Y(this,t,n,i).split(/\s+/g).forEach(function(t){i=i.replace(V(t)," ")}),K(this,i.trim())}})},toggleClass:function(t,n){return t?this.each(function(i){var o=r(this),s=Y(this,t,i,K(this));s.split(/\s+/g).forEach(function(t){(n===e?!o.hasClass(t):n)?o.addClass(t):o.removeClass(t)})}):this},scrollTop:function(t){if(this.length){var n="scrollTop"in this[0];return t===e?n?this[0].scrollTop:this[0].pageYOffset:this.each(n?function(){this.scrollTop=t}:function(){this.scrollTo(this.scrollX,t)})}},scrollLeft:function(t){if(this.length){var n="scrollLeft"in this[0];return t===e?n?this[0].scrollLeft:this[0].pageXOffset:this.each(n?function(){this.scrollLeft=t}:function(){this.scrollTo(t,this.scrollY)})}},position:function(){if(this.length){var t=this[0],e=this.offsetParent(),n=this.offset(),i=g.test(e[0].nodeName)?{top:0,left:0}:e.offset();return n.top-=parseFloat(r(t).css("margin-top"))||0,n.left-=parseFloat(r(t).css("margin-left"))||0,i.top+=parseFloat(r(e[0]).css("border-top-width"))||0,i.left+=parseFloat(r(e[0]).css("border-left-width"))||0,{top:n.top-i.top,left:n.left-i.left}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent||f.body;t&&!g.test(t.nodeName)&&"static"==r(t).css("position");)t=t.offsetParent;return t})}},r.fn.detach=r.fn.remove,["width","height"].forEach(function(t){var n=t.replace(/./,function(t){return t[0].toUpperCase()});r.fn[t]=function(i){var o,s=this[0];return i===e?k(s)?s["inner"+n]:M(s)?s.documentElement["scroll"+n]:(o=this.offset())&&o[t]:this.each(function(e){s=r(this),s.css(t,Y(this,i,e,s[t]()))})}}),x.forEach(function(n,i){var o=i%2;r.fn[n]=function(){var n,a,s=r.map(arguments,function(t){var i=[];return n=$(t),"array"==n?(t.forEach(function(t){return t.nodeType!==e?i.push(t):r.zepto.isZ(t)?i=i.concat(t.get()):void(i=i.concat(N.fragment(t)))}),i):"object"==n||null==t?t:N.fragment(t)}),u=this.length>1;return s.length<1?this:this.each(function(e,n){a=o?n:n.parentNode,n=0==i?n.nextSibling:1==i?n.firstChild:2==i?n:null;var c=r.contains(f.documentElement,a);s.forEach(function(e){if(u)e=e.cloneNode(!0);else if(!a)return r(e).remove();a.insertBefore(e,n),c&&tt(e,function(e){if(!(null==e.nodeName||"SCRIPT"!==e.nodeName.toUpperCase()||e.type&&"text/javascript"!==e.type||e.src)){var n=e.ownerDocument?e.ownerDocument.defaultView:t;n.eval.call(n,e.innerHTML)}})})})},r.fn[o?n+"To":"insert"+(i?"Before":"After")]=function(t){return r(t)[n](this),this}}),N.Z.prototype=X.prototype=r.fn,N.uniq=P,N.deserializeValue=Q,r.zepto=N,r}();return t.Zepto=e,void 0===t.$&&(t.$=e),function(e){function h(t){return t._zid||(t._zid=n++)}function p(t,e,n,r){if(e=d(e),e.ns)var i=m(e.ns);return(a[h(t)]||[]).filter(function(t){return t&&(!e.e||t.e==e.e)&&(!e.ns||i.test(t.ns))&&(!n||h(t.fn)===h(n))&&(!r||t.sel==r)})}function d(t){var e=(""+t).split(".");return{e:e[0],ns:e.slice(1).sort().join(" ")}}function m(t){return new RegExp("(?:^| )"+t.replace(" "," .* ?")+"(?: |$)")}function g(t,e){return t.del&&!f&&t.e in c||!!e}function v(t){return l[t]||f&&c[t]||t}function y(t,n,i,o,s,u,f){var c=h(t),p=a[c]||(a[c]=[]);n.split(/\s/).forEach(function(n){if("ready"==n)return e(document).ready(i);var a=d(n);a.fn=i,a.sel=s,a.e in l&&(i=function(t){var n=t.relatedTarget;return!n||n!==this&&!e.contains(this,n)?a.fn.apply(this,arguments):void 0}),a.del=u;var c=u||i;a.proxy=function(e){if(e=T(e),!e.isImmediatePropagationStopped()){e.data=o;var n=c.apply(t,e._args==r?[e]:[e].concat(e._args));return n===!1&&(e.preventDefault(),e.stopPropagation()),n}},a.i=p.length,p.push(a),"addEventListener"in t&&t.addEventListener(v(a.e),a.proxy,g(a,f))})}function x(t,e,n,r,i){var o=h(t);(e||"").split(/\s/).forEach(function(e){p(t,e,n,r).forEach(function(e){delete a[o][e.i],"removeEventListener"in t&&t.removeEventListener(v(e.e),e.proxy,g(e,i))})})}function T(t,n){return(n||!t.isDefaultPrevented)&&(n||(n=t),e.each(w,function(e,r){var i=n[e];t[e]=function(){return this[r]=b,i&&i.apply(n,arguments)},t[r]=E}),t.timeStamp||(t.timeStamp=Date.now()),(n.defaultPrevented!==r?n.defaultPrevented:"returnValue"in n?n.returnValue===!1:n.getPreventDefault&&n.getPreventDefault())&&(t.isDefaultPrevented=b)),t}function S(t){var e,n={originalEvent:t};for(e in t)j.test(e)||t[e]===r||(n[e]=t[e]);return T(n,t)}var r,n=1,i=Array.prototype.slice,o=e.isFunction,s=function(t){return"string"==typeof t},a={},u={},f="onfocusin"in t,c={focus:"focusin",blur:"focusout"},l={mouseenter:"mouseover",mouseleave:"mouseout"};u.click=u.mousedown=u.mouseup=u.mousemove="MouseEvents",e.event={add:y,remove:x},e.proxy=function(t,n){var r=2 in arguments&&i.call(arguments,2);if(o(t)){var a=function(){return t.apply(n,r?r.concat(i.call(arguments)):arguments)};return a._zid=h(t),a}if(s(n))return r?(r.unshift(t[n],t),e.proxy.apply(null,r)):e.proxy(t[n],t);throw new TypeError("expected function")},e.fn.bind=function(t,e,n){return this.on(t,e,n)},e.fn.unbind=function(t,e){return this.off(t,e)},e.fn.one=function(t,e,n,r){return this.on(t,e,n,r,1)};var b=function(){return!0},E=function(){return!1},j=/^([A-Z]|returnValue$|layer[XY]$|webkitMovement[XY]$)/,w={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};e.fn.delegate=function(t,e,n){return this.on(e,t,n)},e.fn.undelegate=function(t,e,n){return this.off(e,t,n)},e.fn.live=function(t,n){return e(document.body).delegate(this.selector,t,n),this},e.fn.die=function(t,n){return e(document.body).undelegate(this.selector,t,n),this},e.fn.on=function(t,n,a,u,f){var c,l,h=this;return t&&!s(t)?(e.each(t,function(t,e){h.on(t,n,a,e,f)}),h):(s(n)||o(u)||u===!1||(u=a,a=n,n=r),(u===r||a===!1)&&(u=a,a=r),u===!1&&(u=E),h.each(function(r,o){f&&(c=function(t){return x(o,t.type,u),u.apply(this,arguments)}),n&&(l=function(t){var r,s=e(t.target).closest(n,o).get(0);return s&&s!==o?(r=e.extend(S(t),{currentTarget:s,liveFired:o}),(c||u).apply(s,[r].concat(i.call(arguments,1)))):void 0}),y(o,t,u,a,n,l||c)}))},e.fn.off=function(t,n,i){var a=this;return t&&!s(t)?(e.each(t,function(t,e){a.off(t,n,e)}),a):(s(n)||o(i)||i===!1||(i=n,n=r),i===!1&&(i=E),a.each(function(){x(this,t,i,n)}))},e.fn.trigger=function(t,n){return t=s(t)||e.isPlainObject(t)?e.Event(t):T(t),t._args=n,this.each(function(){t.type in c&&"function"==typeof this[t.type]?this[t.type]():"dispatchEvent"in this?this.dispatchEvent(t):e(this).triggerHandler(t,n)})},e.fn.triggerHandler=function(t,n){var r,i;return this.each(function(o,a){r=S(s(t)?e.Event(t):t),r._args=n,r.target=a,e.each(p(a,t.type||t),function(t,e){return i=e.proxy(r),r.isImmediatePropagationStopped()?!1:void 0})}),i},"focusin focusout focus blur load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach(function(t){e.fn[t]=function(e){return 0 in arguments?this.bind(t,e):this.trigger(t)}}),e.Event=function(t,e){s(t)||(e=t,t=e.type);var n=document.createEvent(u[t]||"Events"),r=!0;if(e)for(var i in e)"bubbles"==i?r=!!e[i]:n[i]=e[i];return n.initEvent(t,r,!0),T(n)}}(e),function(e){function p(t,n,r){var i=e.Event(n);return e(t).trigger(i,r),!i.isDefaultPrevented()}function d(t,e,n,i){return t.global?p(e||r,n,i):void 0}function m(t){t.global&&0===e.active++&&d(t,null,"ajaxStart")}function g(t){t.global&&!--e.active&&d(t,null,"ajaxStop")}function v(t,e){var n=e.context;return e.beforeSend.call(n,t,e)===!1||d(e,n,"ajaxBeforeSend",[t,e])===!1?!1:void d(e,n,"ajaxSend",[t,e])}function y(t,e,n,r){var i=n.context,o="success";n.success.call(i,t,o,e),r&&r.resolveWith(i,[t,o,e]),d(n,i,"ajaxSuccess",[e,n,t]),b(o,e,n)}function x(t,e,n,r,i){var o=r.context;r.error.call(o,n,e,t),i&&i.rejectWith(o,[n,e,t]),d(r,o,"ajaxError",[n,r,t||e]),b(e,n,r)}function b(t,e,n){var r=n.context;n.complete.call(r,e,t),d(n,r,"ajaxComplete",[e,n]),g(n)}function E(t,e,n){if(n.dataFilter==j)return t;var r=n.context;return n.dataFilter.call(r,t,e)}function j(){}function w(t){return t&&(t=t.split(";",2)[0]),t&&(t==c?"html":t==f?"json":a.test(t)?"script":u.test(t)&&"xml")||"text"}function T(t,e){return""==e?t:(t+"&"+e).replace(/[&?]{1,2}/,"?")}function S(t){t.processData&&t.data&&"string"!=e.type(t.data)&&(t.data=e.param(t.data,t.traditional)),!t.data||t.type&&"GET"!=t.type.toUpperCase()&&"jsonp"!=t.dataType||(t.url=T(t.url,t.data),t.data=void 0)}function C(t,n,r,i){return e.isFunction(n)&&(i=r,r=n,n=void 0),e.isFunction(r)||(i=r,r=void 0),{url:t,data:n,success:r,dataType:i}}function O(t,n,r,i){var o,s=e.isArray(n),a=e.isPlainObject(n);e.each(n,function(n,u){o=e.type(u),i&&(n=r?i:i+"["+(a||"object"==o||"array"==o?n:"")+"]"),!i&&s?t.add(u.name,u.value):"array"==o||!r&&"object"==o?O(t,u,r,n):t.add(n,u)})}var i,o,n=+new Date,r=t.document,s=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,a=/^(?:text|application)\/javascript/i,u=/^(?:text|application)\/xml/i,f="application/json",c="text/html",l=/^\s*$/,h=r.createElement("a");h.href=t.location.href,e.active=0,e.ajaxJSONP=function(i,o){if(!("type"in i))return e.ajax(i);var c,p,s=i.jsonpCallback,a=(e.isFunction(s)?s():s)||"Zepto"+n++,u=r.createElement("script"),f=t[a],l=function(t){e(u).triggerHandler("error",t||"abort")},h={abort:l};return o&&o.promise(h),e(u).on("load error",function(n,r){clearTimeout(p),e(u).off().remove(),"error"!=n.type&&c?y(c[0],h,i,o):x(null,r||"error",h,i,o),t[a]=f,c&&e.isFunction(f)&&f(c[0]),f=c=void 0}),v(h,i)===!1?(l("abort"),h):(t[a]=function(){c=arguments},u.src=i.url.replace(/\?(.+)=\?/,"?$1="+a),r.head.appendChild(u),i.timeout>0&&(p=setTimeout(function(){l("timeout")},i.timeout)),h)},e.ajaxSettings={type:"GET",beforeSend:j,success:j,error:j,complete:j,context:null,global:!0,xhr:function(){return new t.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript, application/x-javascript",json:f,xml:"application/xml, text/xml",html:c,text:"text/plain"},crossDomain:!1,timeout:0,processData:!0,cache:!0,dataFilter:j},e.ajax=function(n){var u,f,s=e.extend({},n||{}),a=e.Deferred&&e.Deferred();for(i in e.ajaxSettings)void 0===s[i]&&(s[i]=e.ajaxSettings[i]);m(s),s.crossDomain||(u=r.createElement("a"),u.href=s.url,u.href=u.href,s.crossDomain=h.protocol+"//"+h.host!=u.protocol+"//"+u.host),s.url||(s.url=t.location.toString()),(f=s.url.indexOf("#"))>-1&&(s.url=s.url.slice(0,f)),S(s);var c=s.dataType,p=/\?.+=\?/.test(s.url);if(p&&(c="jsonp"),s.cache!==!1&&(n&&n.cache===!0||"script"!=c&&"jsonp"!=c)||(s.url=T(s.url,"_="+Date.now())),"jsonp"==c)return p||(s.url=T(s.url,s.jsonp?s.jsonp+"=?":s.jsonp===!1?"":"callback=?")),e.ajaxJSONP(s,a);var P,d=s.accepts[c],g={},b=function(t,e){g[t.toLowerCase()]=[t,e]},C=/^([\w-]+:)\/\//.test(s.url)?RegExp.$1:t.location.protocol,N=s.xhr(),O=N.setRequestHeader;if(a&&a.promise(N),s.crossDomain||b("X-Requested-With","XMLHttpRequest"),b("Accept",d||"*/*"),(d=s.mimeType||d)&&(d.indexOf(",")>-1&&(d=d.split(",",2)[0]),N.overrideMimeType&&N.overrideMimeType(d)),(s.contentType||s.contentType!==!1&&s.data&&"GET"!=s.type.toUpperCase())&&b("Content-Type",s.contentType||"application/x-www-form-urlencoded"),s.headers)for(o in s.headers)b(o,s.headers[o]);if(N.setRequestHeader=b,N.onreadystatechange=function(){if(4==N.readyState){N.onreadystatechange=j,clearTimeout(P);var t,n=!1;if(N.status>=200&&N.status<300||304==N.status||0==N.status&&"file:"==C){if(c=c||w(s.mimeType||N.getResponseHeader("content-type")),"arraybuffer"==N.responseType||"blob"==N.responseType)t=N.response;else{t=N.responseText;try{t=E(t,c,s),"script"==c?(1,eval)(t):"xml"==c?t=N.responseXML:"json"==c&&(t=l.test(t)?null:e.parseJSON(t))}catch(r){n=r}if(n)return x(n,"parsererror",N,s,a)}y(t,N,s,a)}else x(N.statusText||null,N.status?"error":"abort",N,s,a)}},v(N,s)===!1)return N.abort(),x(null,"abort",N,s,a),N;var A="async"in s?s.async:!0;if(N.open(s.type,s.url,A,s.username,s.password),s.xhrFields)for(o in s.xhrFields)N[o]=s.xhrFields[o];for(o in g)O.apply(N,g[o]);return s.timeout>0&&(P=setTimeout(function(){N.onreadystatechange=j,N.abort(),x(null,"timeout",N,s,a)},s.timeout)),N.send(s.data?s.data:null),N},e.get=function(){return e.ajax(C.apply(null,arguments))},e.post=function(){var t=C.apply(null,arguments);return t.type="POST",e.ajax(t)},e.getJSON=function(){var t=C.apply(null,arguments);return t.dataType="json",e.ajax(t)},e.fn.load=function(t,n,r){if(!this.length)return this;var a,i=this,o=t.split(/\s/),u=C(t,n,r),f=u.success;return o.length>1&&(u.url=o[0],a=o[1]),u.success=function(t){i.html(a?e("<div>").html(t.replace(s,"")).find(a):t),f&&f.apply(i,arguments)},e.ajax(u),this};var N=encodeURIComponent;e.param=function(t,n){var r=[];return r.add=function(t,n){e.isFunction(n)&&(n=n()),null==n&&(n=""),this.push(N(t)+"="+N(n))},O(r,t,n),r.join("&").replace(/%20/g,"+")}}(e),function(t){t.fn.serializeArray=function(){var e,n,r=[],i=function(t){return t.forEach?t.forEach(i):void r.push({name:e,value:t})};return this[0]&&t.each(this[0].elements,function(r,o){n=o.type,e=o.name,e&&"fieldset"!=o.nodeName.toLowerCase()&&!o.disabled&&"submit"!=n&&"reset"!=n&&"button"!=n&&"file"!=n&&("radio"!=n&&"checkbox"!=n||o.checked)&&i(t(o).val())}),r},t.fn.serialize=function(){var t=[];return this.serializeArray().forEach(function(e){t.push(encodeURIComponent(e.name)+"="+encodeURIComponent(e.value))}),t.join("&")},t.fn.submit=function(e){if(0 in arguments)this.bind("submit",e);else if(this.length){var n=t.Event("submit");this.eq(0).trigger(n),n.isDefaultPrevented()||this.get(0).submit()}return this}}(e),function(){try{getComputedStyle(void 0)}catch(e){var n=getComputedStyle;t.getComputedStyle=function(t,e){try{return n(t,e)}catch(r){return null}}}}(),e});`,
	"css/notie.min.css": `.notie-container{font-size:1.6rem;height:auto;left:0;position:fixed;text-align:center;width:100%;z-index:2;box-sizing:border-box;-o-box-shadow:0 0 5px 0 rgba(0,0,0,.5);-ms-box-shadow:0 0 5px 0 rgba(0,0,0,.5);box-shadow:0 0 5px 0 rgba(0,0,0,.5)}@media screen and (max-width:900px){.notie-container{font-size:1.4rem}}@media screen and (max-width:750px){.notie-container{font-size:1.2rem}}@media screen and (max-width:400px){.notie-container{font-size:1rem}}.notie-background-success{background-color:#57bf57}.notie-background-warning{background-color:#d6a14d}.notie-background-error{background-color:#e1715b}.notie-background-info{background-color:#4d82d6}.notie-background-neutral{background-color:#a0a0a0}.notie-background-overlay{background-color:#fff}.notie-textbox{color:#fff;padding:20px}.notie-textbox-inner{margin:0 auto;max-width:900px}.notie-overlay{height:100%;left:0;opacity:0;position:fixed;top:0;width:100%;z-index:1}.notie-button{cursor:pointer}.notie-button,.notie-element{color:#fff;padding:10px}.notie-element-half{width:50%}.notie-element-half,.notie-element-third{display:inline-block;box-sizing:border-box}.notie-element-third{width:33.3333%}.notie-alert{cursor:pointer}.notie-input-field{background-color:#fff;border:0;font-family:inherit;font-size:inherit;outline:0;padding:10px;text-align:center;width:100%;box-sizing:border-box}.notie-select-choice-repeated{border-bottom:1px solid hsla(0,0%,100%,.2);box-sizing:border-box}.notie-date-selector-inner{margin:0 auto;max-width:900px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none}.notie-date-selector-inner [contenteditable],.notie-date-selector-inner [contenteditable]:focus{outline:0 solid transparent}.notie-date-selector-up{transform:rotate(180deg)}`,
	"js/notie.min.js":   `!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.notie=t():e.notie=t()}(this,function(){return function(e){function t(s){if(n[s])return n[s].exports;var a=n[s]={i:s,l:!1,exports:{}};return e[s].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,s){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:s})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=1)}([function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";(function(e){var n,s,a,i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(c,o){"object"===i(t)&&"object"===i(e)?e.exports=o():(s=[],n=o,a="function"==typeof n?n.apply(t,s):n,!(void 0!==a&&(e.exports=a)))}(void 0,function(){return function(e){function t(s){if(n[s])return n[s].exports;var a=n[s]={i:s,l:!1,exports:{}};return e[s].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,s){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:s})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){function s(e,t){var n={};for(var s in e)t.indexOf(s)>=0||Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=e[s]);return n}Object.defineProperty(t,"__esModule",{value:!0});var a="function"==typeof Symbol&&"symbol"===i(Symbol.iterator)?function(e){return"undefined"==typeof e?"undefined":i(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":"undefined"==typeof e?"undefined":i(e)},c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},o={top:"top",bottom:"bottom"},r={alertTime:3,dateMonths:["January","February","March","April","May","June","July","August","September","October","November","December"],overlayClickDismiss:!0,overlayOpacity:.75,transitionCurve:"ease",transitionDuration:.3,transitionSelector:"all",classes:{container:"notie-container",textbox:"notie-textbox",textboxInner:"notie-textbox-inner",button:"notie-button",element:"notie-element",elementHalf:"notie-element-half",elementThird:"notie-element-third",overlay:"notie-overlay",backgroundSuccess:"notie-background-success",backgroundWarning:"notie-background-warning",backgroundError:"notie-background-error",backgroundInfo:"notie-background-info",backgroundNeutral:"notie-background-neutral",backgroundOverlay:"notie-background-overlay",alert:"notie-alert",inputField:"notie-input-field",selectChoiceRepeated:"notie-select-choice-repeated",dateSelectorInner:"notie-date-selector-inner",dateSelectorUp:"notie-date-selector-up"},ids:{overlay:"notie-overlay"},positions:{alert:o.top,force:o.top,confirm:o.top,input:o.top,select:o.bottom,date:o.top}},l=t.setOptions=function(e){r=c({},r,e,{classes:c({},r.classes,e.classes),ids:c({},r.ids,e.ids),positions:c({},r.positions,e.positions)})},d=function(){return new Promise(function(e){return setTimeout(e,0)})},u=function(e){return new Promise(function(t){return setTimeout(t,1e3*e)})},p=function(){document.activeElement&&document.activeElement.blur()},f=function(){var e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0,n="x"===e?t:3&t|8;return n.toString(16)});return"notie-"+e},m={1:r.classes.backgroundSuccess,success:r.classes.backgroundSuccess,2:r.classes.backgroundWarning,warning:r.classes.backgroundWarning,3:r.classes.backgroundError,error:r.classes.backgroundError,4:r.classes.backgroundInfo,info:r.classes.backgroundInfo,5:r.classes.backgroundNeutral,neutral:r.classes.backgroundNeutral},v=function(){return r.transitionSelector+" "+r.transitionDuration+"s "+r.transitionCurve},b=function(e){return 13===e.keyCode},x=function(e){return 27===e.keyCode},y=function(e,t){e.classList.add(r.classes.container),e.style[t]="-10000px",document.body.appendChild(e),e.style[t]="-"+e.offsetHeight+"px",e.listener&&window.addEventListener("keydown",e.listener),d().then(function(){e.style.transition=v(),e.style[t]=0})},L=function(e,t){var n=document.getElementById(e);n&&(n.style[t]="-"+n.offsetHeight+"px",n.listener&&window.removeEventListener("keydown",n.listener),u(r.transitionDuration).then(function(){n.parentNode&&n.parentNode.removeChild(n)}))},g=function(e,t){var n=document.createElement("div");n.id=r.ids.overlay,n.classList.add(r.classes.overlay),n.classList.add(r.classes.backgroundOverlay),n.style.opacity=0,e&&r.overlayClickDismiss&&(n.onclick=function(){L(e.id,t),h()}),document.body.appendChild(n),d().then(function(){n.style.transition=v(),n.style.opacity=r.overlayOpacity})},h=function(){var e=document.getElementById(r.ids.overlay);e.style.opacity=0,u(r.transitionDuration).then(function(){e.parentNode&&e.parentNode.removeChild(e)})},k=t.hideAlerts=function(e){var t=document.getElementsByClassName(r.classes.alert);if(t.length){for(var n=0;n<t.length;n++){var s=t[n];L(s.id,s.position)}e&&u(r.transitionDuration).then(function(){return e()})}},C=t.alert=function(e){var t=e.type,n=void 0===t?4:t,s=e.text,a=e.time,i=void 0===a?r.alertTime:a,c=e.stay,o=void 0!==c&&c,l=e.position,d=void 0===l?r.positions.alert||d.top:l;p(),k();var v=document.createElement("div"),g=f();v.id=g,v.position=d,v.classList.add(r.classes.textbox),v.classList.add(m[n]),v.classList.add(r.classes.alert),v.innerHTML='<div class="'+r.classes.textboxInner+'">'+s+"</div>",v.onclick=function(){return L(g,d)},v.listener=function(e){(b(e)||x(e))&&k()},y(v,d),i&&i<1&&(i=1),!o&&i&&u(i).then(function(){return L(g,d)})},E=t.force=function(e,t){var n=e.type,s=void 0===n?5:n,a=e.text,i=e.buttonText,c=void 0===i?"OK":i,o=e.callback,l=e.position,d=void 0===l?r.positions.force||d.top:l;p(),k();var u=document.createElement("div"),v=f();u.id=v;var x=document.createElement("div");x.classList.add(r.classes.textbox),x.classList.add(r.classes.backgroundInfo),x.innerHTML='<div class="'+r.classes.textboxInner+'">'+a+"</div>";var C=document.createElement("div");C.classList.add(r.classes.button),C.classList.add(m[s]),C.innerHTML=c,C.onclick=function(){L(v,d),h(),o?o():t&&t()},u.appendChild(x),u.appendChild(C),u.listener=function(e){b(e)&&C.click()},y(u,d),g()},T=t.confirm=function(e,t,n){var s=e.text,a=e.submitText,i=void 0===a?"Yes":a,c=e.cancelText,o=void 0===c?"Cancel":c,l=e.submitCallback,d=e.cancelCallback,u=e.position,m=void 0===u?r.positions.confirm||m.top:u;p(),k();var v=document.createElement("div"),C=f();v.id=C;var E=document.createElement("div");E.classList.add(r.classes.textbox),E.classList.add(r.classes.backgroundInfo),E.innerHTML='<div class="'+r.classes.textboxInner+'">'+s+"</div>";var T=document.createElement("div");T.classList.add(r.classes.button),T.classList.add(r.classes.elementHalf),T.classList.add(r.classes.backgroundSuccess),T.innerHTML=i,T.onclick=function(){L(C,m),h(),l?l():t&&t()};var M=document.createElement("div");M.classList.add(r.classes.button),M.classList.add(r.classes.elementHalf),M.classList.add(r.classes.backgroundError),M.innerHTML=o,M.onclick=function(){L(C,m),h(),d?d():n&&n()},v.appendChild(E),v.appendChild(T),v.appendChild(M),v.listener=function(e){b(e)?T.click():x(e)&&M.click()},y(v,m),g(v,m)},M=function(e,t,n){var i=e.text,c=e.submitText,o=void 0===c?"Submit":c,l=e.cancelText,d=void 0===l?"Cancel":l,u=e.submitCallback,m=e.cancelCallback,v=e.position,C=void 0===v?r.positions.input||C.top:v,E=s(e,["text","submitText","cancelText","submitCallback","cancelCallback","position"]);p(),k();var T=document.createElement("div"),M=f();T.id=M;var H=document.createElement("div");H.classList.add(r.classes.textbox),H.classList.add(r.classes.backgroundInfo),H.innerHTML='<div class="'+r.classes.textboxInner+'">'+i+"</div>";var S=document.createElement("input");S.classList.add(r.classes.inputField),S.setAttribute("autocapitalize",E.autocapitalize||"none"),S.setAttribute("autocomplete",E.autocomplete||"off"),S.setAttribute("autocorrect",E.autocorrect||"off"),S.setAttribute("autofocus",E.autofocus||"true"),S.setAttribute("inputmode",E.inputmode||"verbatim"),S.setAttribute("max",E.max||""),S.setAttribute("maxlength",E.maxlength||""),S.setAttribute("min",E.min||""),S.setAttribute("minlength",E.minlength||""),S.setAttribute("placeholder",E.placeholder||""),S.setAttribute("spellcheck",E.spellcheck||"default"),S.setAttribute("step",E.step||"any"),S.setAttribute("type",E.type||"text"),S.value=E.value||"",E.allowed&&(S.oninput=function(){var e=void 0;if(Array.isArray(E.allowed)){for(var t="",n=E.allowed,s=0;s<n.length;s++)"an"===n[s]?t+="0-9a-zA-Z":"a"===n[s]?t+="a-zA-Z":"n"===n[s]&&(t+="0-9"),"s"===n[s]&&(t+=" ");e=new RegExp("[^"+t+"]","g")}else"object"===a(E.allowed)&&(e=E.allowed);S.value=S.value.replace(e,"")});var w=document.createElement("div");w.classList.add(r.classes.button),w.classList.add(r.classes.elementHalf),w.classList.add(r.classes.backgroundSuccess),w.innerHTML=o,w.onclick=function(){L(M,C),h(),u?u(S.value):t&&t(S.value)};var O=document.createElement("div");O.classList.add(r.classes.button),O.classList.add(r.classes.elementHalf),O.classList.add(r.classes.backgroundError),O.innerHTML=d,O.onclick=function(){L(M,C),h(),m?m(S.value):n&&n(S.value)},T.appendChild(H),T.appendChild(S),T.appendChild(w),T.appendChild(O),T.listener=function(e){b(e)?w.click():x(e)&&O.click()},y(T,C),S.focus(),g(T,C)};t.input=M;var H=t.select=function(e,t){var n=e.text,s=e.cancelText,a=void 0===s?"Cancel":s,i=e.cancelCallback,c=e.choices,o=e.position,l=void 0===o?r.positions.select||l.top:o;p(),k();var d=document.createElement("div"),u=f();d.id=u;var v=document.createElement("div");v.classList.add(r.classes.textbox),v.classList.add(r.classes.backgroundInfo),v.innerHTML='<div class="'+r.classes.textboxInner+'">'+n+"</div>",d.appendChild(v),c.forEach(function(e,t){var n=e.type,s=void 0===n?1:n,a=e.text,i=e.handler,o=document.createElement("div");o.classList.add(m[s]),o.classList.add(r.classes.button),o.classList.add(r.classes.selectChoice);var p=c[t+1];p&&!p.type&&(p.type=1),p&&p.type===s&&o.classList.add(r.classes.selectChoiceRepeated),o.innerHTML=a,o.onclick=function(){L(u,l),h(),i()},d.appendChild(o)});var b=document.createElement("div");b.classList.add(r.classes.backgroundNeutral),b.classList.add(r.classes.button),b.innerHTML=a,b.onclick=function(){L(u,l),h(),i?i():t&&t()},d.appendChild(b),d.listener=function(e){x(e)&&b.click()},y(d,l),g(d,l)},S=t.date=function(e,t,n){var s=e.value,a=void 0===s?new Date:s,i=e.submitText,c=void 0===i?"OK":i,o=e.cancelText,l=void 0===o?"Cancel":o,d=e.submitCallback,u=e.cancelCallback,m=e.position,v=void 0===m?r.positions.date||v.top:m;p(),k();var C="&#9662",E=document.createElement("div"),T=document.createElement("div"),M=document.createElement("div"),H=function(e){E.innerHTML=r.dateMonths[e.getMonth()],T.innerHTML=e.getDate(),M.innerHTML=e.getFullYear()},S=function(e){var t=new Date(a.getFullYear(),a.getMonth()+1,0).getDate(),n=e.target.textContent.replace(/^0+/,"").replace(/[^\d]/g,"").slice(0,2);Number(n)>t&&(n=t.toString()),e.target.textContent=n,Number(n)<1&&(n="1"),a.setDate(Number(n))},w=function(e){var t=e.target.textContent.replace(/^0+/,"").replace(/[^\d]/g,"").slice(0,4);e.target.textContent=t,a.setFullYear(Number(t))},O=function(e){H(a)},A=function(e){var t=new Date(a.getFullYear(),a.getMonth()+e+1,0).getDate();a.getDate()>t&&a.setDate(t),a.setMonth(a.getMonth()+e),H(a)},D=function(e){a.setDate(a.getDate()+e),H(a)},I=function(e){var t=a.getFullYear()+e;t<0?a.setFullYear(0):a.setFullYear(a.getFullYear()+e),H(a)},j=document.createElement("div"),N=f();j.id=N;var P=document.createElement("div");P.classList.add(r.classes.backgroundInfo);var F=document.createElement("div");F.classList.add(r.classes.dateSelectorInner);var Y=document.createElement("div");Y.classList.add(r.classes.button),Y.classList.add(r.classes.elementThird),Y.classList.add(r.classes.dateSelectorUp),Y.innerHTML=C;var _=document.createElement("div");_.classList.add(r.classes.button),_.classList.add(r.classes.elementThird),_.classList.add(r.classes.dateSelectorUp),_.innerHTML=C;var z=document.createElement("div");z.classList.add(r.classes.button),z.classList.add(r.classes.elementThird),z.classList.add(r.classes.dateSelectorUp),z.innerHTML=C,E.classList.add(r.classes.element),E.classList.add(r.classes.elementThird),E.innerHTML=r.dateMonths[a.getMonth()],T.classList.add(r.classes.element),T.classList.add(r.classes.elementThird),T.setAttribute("contentEditable",!0),T.addEventListener("input",S),T.addEventListener("blur",O),T.innerHTML=a.getDate(),M.classList.add(r.classes.element),M.classList.add(r.classes.elementThird),M.setAttribute("contentEditable",!0),M.addEventListener("input",w),M.addEventListener("blur",O),M.innerHTML=a.getFullYear();var U=document.createElement("div");U.classList.add(r.classes.button),U.classList.add(r.classes.elementThird),U.innerHTML=C;var B=document.createElement("div");B.classList.add(r.classes.button),B.classList.add(r.classes.elementThird),B.innerHTML=C;var J=document.createElement("div");J.classList.add(r.classes.button),J.classList.add(r.classes.elementThird),J.innerHTML=C,Y.onclick=function(){return A(1)},_.onclick=function(){return D(1)},z.onclick=function(){return I(1)},U.onclick=function(){return A(-1)},B.onclick=function(){return D(-1)},J.onclick=function(){return I(-1)};var R=document.createElement("div");R.classList.add(r.classes.button),R.classList.add(r.classes.elementHalf),R.classList.add(r.classes.backgroundSuccess),R.innerHTML=c,R.onclick=function(){L(N,v),h(),d?d(a):t&&t(a)};var W=document.createElement("div");W.classList.add(r.classes.button),W.classList.add(r.classes.elementHalf),W.classList.add(r.classes.backgroundError),W.innerHTML=l,W.onclick=function(){L(N,v),h(),u?u(a):n&&n(a)},F.appendChild(Y),F.appendChild(_),F.appendChild(z),F.appendChild(E),F.appendChild(T),F.appendChild(M),F.appendChild(U),F.appendChild(B),F.appendChild(J),P.appendChild(F),j.appendChild(P),j.appendChild(R),j.appendChild(W),j.listener=function(e){b(e)?R.click():x(e)&&W.click()},y(j,v),g(j,v)};t.default={alert:C,force:E,confirm:T,input:M,select:H,date:S,setOptions:l,hideAlerts:k}}])})}).call(t,n(0)(e))}])});`,
	"js/sweetalert2.all.min.js": `!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).Sweetalert2=t()}(this,function(){"use strict";var p={awaitingPromise:new WeakMap,promise:new WeakMap,innerParams:new WeakMap,domCache:new WeakMap};var e=e=>{var t={};for(const n in e)t[e[n]]="swal2-"+e[n];return t};const m=e(["container","shown","height-auto","iosfix","popup","modal","no-backdrop","no-transition","toast","toast-shown","show","hide","close","title","html-container","actions","confirm","deny","cancel","default-outline","footer","icon","icon-content","image","input","file","range","select","radio","checkbox","label","textarea","inputerror","input-label","validation-message","progress-steps","active-progress-step","progress-step","progress-step-line","loader","loading","styled","top","top-start","top-end","top-left","top-right","center","center-start","center-end","center-left","center-right","bottom","bottom-start","bottom-end","bottom-left","bottom-right","grow-row","grow-column","grow-fullscreen","rtl","timer-progress-bar","timer-progress-bar-container","scrollbar-measure","icon-success","icon-warning","icon-info","icon-question","icon-error","no-war"]),o=e(["success","warning","info","question","error"]),D="SweetAlert2:",q=e=>e.charAt(0).toUpperCase()+e.slice(1),r=e=>{console.warn("".concat(D," ").concat("object"==typeof e?e.join(" "):e))},l=e=>{console.error("".concat(D," ").concat(e))},V=[],N=(e,t)=>{e='"'.concat(e,'" is deprecated and will be removed in the next major release. Please use "').concat(t,'" instead.'),V.includes(e)||(V.push(e),r(e))},R=e=>"function"==typeof e?e():e,F=e=>e&&"function"==typeof e.toPromise,u=e=>F(e)?e.toPromise():Promise.resolve(e),U=e=>e&&Promise.resolve(e)===e;const g=()=>document.body.querySelector(".".concat(m.container)),W=e=>{var t=g();return t?t.querySelector(e):null},t=e=>W(".".concat(e)),h=()=>t(m.popup),z=()=>t(m.icon),K=()=>t(m.title),_=()=>t(m["html-container"]),Y=()=>t(m.image),Z=()=>t(m["progress-steps"]),X=()=>t(m["validation-message"]),f=()=>W(".".concat(m.actions," .").concat(m.confirm)),d=()=>W(".".concat(m.actions," .").concat(m.deny));const b=()=>W(".".concat(m.loader)),v=()=>W(".".concat(m.actions," .").concat(m.cancel)),$=()=>t(m.actions),J=()=>t(m.footer),G=()=>t(m["timer-progress-bar"]),Q=()=>t(m.close),ee=()=>{var e=Array.from(h().querySelectorAll('[tabindex]:not([tabindex="-1"]):not([tabindex="0"])')).sort((e,t)=>{e=parseInt(e.getAttribute("tabindex")),t=parseInt(t.getAttribute("tabindex"));return t<e?1:e<t?-1:0}),t=Array.from(h().querySelectorAll('\n  a[href],\n  area[href],\n  input:not([disabled]),\n  select:not([disabled]),\n  textarea:not([disabled]),\n  button:not([disabled]),\n  iframe,\n  object,\n  embed,\n  [tabindex="0"],\n  [contenteditable],\n  audio[controls],\n  video[controls],\n  summary\n')).filter(e=>"-1"!==e.getAttribute("tabindex"));return(t=>{var n=[];for(let e=0;e<t.length;e++)-1===n.indexOf(t[e])&&n.push(t[e]);return n})(e.concat(t)).filter(e=>x(e))},te=()=>i(document.body,m.shown)&&!i(document.body,m["toast-shown"])&&!i(document.body,m["no-backdrop"]),ne=()=>h()&&i(h(),m.toast);function oe(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];const n=G();x(n)&&(t&&(n.style.transition="none",n.style.width="100%"),setTimeout(()=>{n.style.transition="width ".concat(e/1e3,"s linear"),n.style.width="0%"},10))}const n={previousBodyPadding:null},y=(t,e)=>{t.textContent="",e&&(e=(new DOMParser).parseFromString(e,"text/html"),Array.from(e.querySelector("head").childNodes).forEach(e=>{t.appendChild(e)}),Array.from(e.querySelector("body").childNodes).forEach(e=>{t.appendChild(e)}))},i=(t,e)=>{if(!e)return!1;var n=e.split(/\s+/);for(let e=0;e<n.length;e++)if(!t.classList.contains(n[e]))return!1;return!0},ie=(t,n)=>{Array.from(t.classList).forEach(e=>{Object.values(m).includes(e)||Object.values(o).includes(e)||Object.values(n.showClass).includes(e)||t.classList.remove(e)})},w=(e,t,n)=>{if(ie(e,t),t.customClass&&t.customClass[n]){if("string"!=typeof t.customClass[n]&&!t.customClass[n].forEach)return r("Invalid type of customClass.".concat(n,'! Expected string or iterable object, got "').concat(typeof t.customClass[n],'"'));C(e,t.customClass[n])}},re=(e,t)=>{if(!t)return null;switch(t){case"select":case"textarea":case"file":return e.querySelector(".".concat(m.popup," > .").concat(m[t]));case"checkbox":return e.querySelector(".".concat(m.popup," > .").concat(m.checkbox," input"));case"radio":return e.querySelector(".".concat(m.popup," > .").concat(m.radio," input:checked"))||e.querySelector(".".concat(m.popup," > .").concat(m.radio," input:first-child"));case"range":return e.querySelector(".".concat(m.popup," > .").concat(m.range," input"));default:return e.querySelector(".".concat(m.popup," > .").concat(m.input))}},ae=e=>{var t;e.focus(),"file"!==e.type&&(t=e.value,e.value="",e.value=t)},se=(e,t,n)=>{e&&t&&(t="string"==typeof t?t.split(/\s+/).filter(Boolean):t).forEach(t=>{Array.isArray(e)?e.forEach(e=>{n?e.classList.add(t):e.classList.remove(t)}):n?e.classList.add(t):e.classList.remove(t)})},C=(e,t)=>{se(e,t,!0)},A=(e,t)=>{se(e,t,!1)},k=(e,t)=>{var n=Array.from(e.children);for(let e=0;e<n.length;e++){var o=n[e];if(o instanceof HTMLElement&&i(o,t))return o}},a=(e,t,n)=>{(n=n==="".concat(parseInt(n))?parseInt(n):n)||0===parseInt(n)?e.style[t]="number"==typeof n?"".concat(n,"px"):n:e.style.removeProperty(t)},B=function(e){e.style.display=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"flex"},P=e=>{e.style.display="none"},ce=(e,t,n,o)=>{e=e.querySelector(t);e&&(e.style[n]=o)},le=function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"flex";t?B(e,n):P(e)},x=e=>!(!e||!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)),ue=()=>!x(f())&&!x(d())&&!x(v()),de=e=>!!(e.scrollHeight>e.clientHeight),pe=e=>{var e=window.getComputedStyle(e),t=parseFloat(e.getPropertyValue("animation-duration")||"0"),e=parseFloat(e.getPropertyValue("transition-duration")||"0");return 0<t||0<e},me=100,E={},ge=()=>{E.previousActiveElement instanceof HTMLElement?(E.previousActiveElement.focus(),E.previousActiveElement=null):document.body&&document.body.focus()},he=o=>new Promise(e=>{if(!o)return e();var t=window.scrollX,n=window.scrollY;E.restoreFocusTimeout=setTimeout(()=>{ge(),e()},me),window.scrollTo(t,n)}),fe=()=>"undefined"==typeof window||"undefined"==typeof document,be='\n <div aria-labelledby="'.concat(m.title,'" aria-describedby="').concat(m["html-container"],'" class="').concat(m.popup,'" tabindex="-1">\n   <button type="button" class="').concat(m.close,'"></button>\n   <ul class="').concat(m["progress-steps"],'"></ul>\n   <div class="').concat(m.icon,'"></div>\n   <img class="').concat(m.image,'" />\n   <h2 class="').concat(m.title,'" id="').concat(m.title,'"></h2>\n   <div class="').concat(m["html-container"],'" id="').concat(m["html-container"],'"></div>\n   <input class="').concat(m.input,'" />\n   <input type="file" class="').concat(m.file,'" />\n   <div class="').concat(m.range,'">\n     <input type="range" />\n     <output></output>\n   </div>\n   <select class="').concat(m.select,'"></select>\n   <div class="').concat(m.radio,'"></div>\n   <label for="').concat(m.checkbox,'" class="').concat(m.checkbox,'">\n     <input type="checkbox" />\n     <span class="').concat(m.label,'"></span>\n   </label>\n   <textarea class="').concat(m.textarea,'"></textarea>\n   <div class="').concat(m["validation-message"],'" id="').concat(m["validation-message"],'"></div>\n   <div class="').concat(m.actions,'">\n     <div class="').concat(m.loader,'"></div>\n     <button type="button" class="').concat(m.confirm,'"></button>\n     <button type="button" class="').concat(m.deny,'"></button>\n     <button type="button" class="').concat(m.cancel,'"></button>\n   </div>\n   <div class="').concat(m.footer,'"></div>\n   <div class="').concat(m["timer-progress-bar-container"],'">\n     <div class="').concat(m["timer-progress-bar"],'"></div>\n   </div>\n </div>\n').replace(/(^|\n)\s*/g,""),ve=()=>{var e=g();return!!e&&(e.remove(),A([document.documentElement,document.body],[m["no-backdrop"],m["toast-shown"],m["has-column"]]),!0)},s=()=>{E.currentInstance.resetValidationMessage()},ye=()=>{var e=h(),t=k(e,m.input),n=k(e,m.file);const o=e.querySelector(".".concat(m.range," input")),i=e.querySelector(".".concat(m.range," output"));var r=k(e,m.select),a=e.querySelector(".".concat(m.checkbox," input")),e=k(e,m.textarea);t.oninput=s,n.onchange=s,r.onchange=s,a.onchange=s,e.oninput=s,o.oninput=()=>{s(),i.value=o.value},o.onchange=()=>{s(),i.value=o.value}},we=e=>"string"==typeof e?document.querySelector(e):e,Ce=e=>{var t=h();t.setAttribute("role",e.toast?"alert":"dialog"),t.setAttribute("aria-live",e.toast?"polite":"assertive"),e.toast||t.setAttribute("aria-modal","true")},Ae=e=>{"rtl"===window.getComputedStyle(e).direction&&C(g(),m.rtl)},ke=(e,t)=>{if(e instanceof HTMLElement)t.appendChild(e);else if("object"==typeof e){var n=e,o=t;if(n.jquery)Be(o,n);else y(o,n.toString())}else e&&y(t,e)},Be=(t,n)=>{if(t.textContent="",0 in n)for(let e=0;e in n;e++)t.appendChild(n[e].cloneNode(!0));else t.appendChild(n.cloneNode(!0))},Pe=(()=>{if(!fe()){var e=document.createElement("div"),t={WebkitAnimation:"webkitAnimationEnd",animation:"animationend"};for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&void 0!==e.style[n])return t[n]}return!1})(),xe=(e,t)=>{var n,o,i,r,a,s=$(),c=b();(t.showConfirmButton||t.showDenyButton||t.showCancelButton?B:P)(s),w(s,t,"actions"),s=s,n=c,o=t,i=f(),r=d(),a=v(),Ee(i,"confirm",o),Ee(r,"deny",o),Ee(a,"cancel",o),function(e,t,n,o){if(!o.buttonsStyling)return A([e,t,n],m.styled);C([e,t,n],m.styled),o.confirmButtonColor&&(e.style.backgroundColor=o.confirmButtonColor,C(e,m["default-outline"]));o.denyButtonColor&&(t.style.backgroundColor=o.denyButtonColor,C(t,m["default-outline"]));o.cancelButtonColor&&(n.style.backgroundColor=o.cancelButtonColor,C(n,m["default-outline"]))}(i,r,a,o),o.reverseButtons&&(o.toast?(s.insertBefore(a,i),s.insertBefore(r,i)):(s.insertBefore(a,n),s.insertBefore(r,n),s.insertBefore(i,n))),y(c,t.loaderHtml),w(c,t,"loader")};function Ee(e,t,n){le(e,n["show".concat(q(t),"Button")],"inline-block"),y(e,n["".concat(t,"ButtonText")]),e.setAttribute("aria-label",n["".concat(t,"ButtonAriaLabel")]),e.className=m[t],w(e,n,"".concat(t,"Button")),C(e,n["".concat(t,"ButtonClass")])}const Te=(e,t)=>{var n=Q();y(n,t.closeButtonHtml),w(n,t,"closeButton"),le(n,t.showCloseButton),n.setAttribute("aria-label",t.closeButtonAriaLabel)},Le=(e,t)=>{var n,o,i=g();i&&(o=i,"string"==typeof(n=t.backdrop)?o.style.background=n:n||C([document.documentElement,document.body],m["no-backdrop"]),o=i,(n=t.position)in m?C(o,m[n]):(r('The "position" parameter is not valid, defaulting to "center"'),C(o,m.center)),n=i,(o=t.grow)&&"string"==typeof o&&(o="grow-".concat(o))in m&&C(n,m[o]),w(i,t,"container"))};const Se=["input","file","range","select","radio","checkbox","textarea"],Oe=(e,a)=>{const s=h();var t,e=p.innerParams.get(e);const c=!e||a.input!==e.input;Se.forEach(e=>{var t=k(s,m[e]);{var n=e,o=a.inputAttributes,i=re(h(),n);if(i){Me(i);for(const r in o)i.setAttribute(r,o[r])}}t.className=m[e],c&&P(t)}),a.input&&(c&&(e=>{if(!T[e.input])return l('Unexpected type of input! Expected "text", "email", "password", "number", "tel", "select", "radio", "checkbox", "textarea", "file" or "url", got "'.concat(e.input,'"'));const t=Ie(e.input),n=T[e.input](t,e);B(t),setTimeout(()=>{ae(n)})})(a),e=a,t=Ie(e.input),"object"==typeof e.customClass&&C(t,e.customClass.input))},Me=t=>{for(let e=0;e<t.attributes.length;e++){var n=t.attributes[e].name;["type","value","style"].includes(n)||t.removeAttribute(n)}},je=(e,t)=>{e.placeholder&&!t.inputPlaceholder||(e.placeholder=t.inputPlaceholder)},He=(e,t,n)=>{var o,i;n.inputLabel&&(e.id=m.input,o=document.createElement("label"),i=m["input-label"],o.setAttribute("for",e.id),o.className=i,"object"==typeof n.customClass&&C(o,n.customClass.inputLabel),o.innerText=n.inputLabel,t.insertAdjacentElement("beforebegin",o))},Ie=e=>k(h(),m[e]||m.input),De=(e,t)=>{["string","number"].includes(typeof t)?e.value="".concat(t):U(t)||r('Unexpected type of inputValue! Expected "string", "number" or "Promise", got "'.concat(typeof t,'"'))},T={},qe=(T.text=T.email=T.password=T.number=T.tel=T.url=(e,t)=>(De(e,t.inputValue),He(e,e,t),je(e,t),e.type=t.input,e),T.file=(e,t)=>(He(e,e,t),je(e,t),e),T.range=(e,t)=>{var n=e.querySelector("input"),o=e.querySelector("output");return De(n,t.inputValue),n.type=t.input,De(o,t.inputValue),He(n,e,t),e},T.select=(e,t)=>{var n;return e.textContent="",t.inputPlaceholder&&(n=document.createElement("option"),y(n,t.inputPlaceholder),n.value="",n.disabled=!0,n.selected=!0,e.appendChild(n)),He(e,e,t),e},T.radio=e=>(e.textContent="",e),T.checkbox=(e,t)=>{var n=re(h(),"checkbox"),e=(n.value="1",n.id=m.checkbox,n.checked=Boolean(t.inputValue),e.querySelector("span"));return y(e,t.inputPlaceholder),n},T.textarea=(n,e)=>{De(n,e.inputValue),je(n,e),He(n,n,e);return setTimeout(()=>{if("MutationObserver"in window){const t=parseInt(window.getComputedStyle(h()).width);new MutationObserver(()=>{var e=n.offsetWidth+(e=n,parseInt(window.getComputedStyle(e).marginLeft)+parseInt(window.getComputedStyle(e).marginRight));e>t?h().style.width="".concat(e,"px"):h().style.width=null}).observe(n,{attributes:!0,attributeFilter:["style"]})}}),n},(e,t)=>{var n=_();w(n,t,"htmlContainer"),t.html?(ke(t.html,n),B(n,"block")):t.text?(n.textContent=t.text,B(n,"block")):P(n),Oe(e,t)}),Ve=(e,t)=>{var n=J();le(n,t.footer),t.footer&&ke(t.footer,n),w(n,t,"footer")},Ne=(e,t)=>{var e=p.innerParams.get(e),n=z();e&&t.icon===e.icon?(ze(n,t),Re(n,t)):t.icon||t.iconHtml?t.icon&&-1===Object.keys(o).indexOf(t.icon)?(l('Unknown icon! Expected "success", "error", "warning", "info" or "question", got "'.concat(t.icon,'"')),P(n)):(B(n),ze(n,t),Re(n,t),C(n,t.showClass.icon)):P(n)},Re=(e,t)=>{for(const n in o)t.icon!==n&&A(e,o[n]);C(e,o[t.icon]),Ke(e,t),Fe(),w(e,t,"icon")},Fe=()=>{var e=h(),t=window.getComputedStyle(e).getPropertyValue("background-color"),n=e.querySelectorAll("[class^=swal2-success-circular-line], .swal2-success-fix");for(let e=0;e<n.length;e++)n[e].style.backgroundColor=t},Ue='\n  <div class="swal2-success-circular-line-left"></div>\n  <span class="swal2-success-line-tip"></span> <span class="swal2-success-line-long"></span>\n  <div class="swal2-success-ring"></div> <div class="swal2-success-fix"></div>\n  <div class="swal2-success-circular-line-right"></div>\n',We='\n  <span class="swal2-x-mark">\n    <span class="swal2-x-mark-line-left"></span>\n    <span class="swal2-x-mark-line-right"></span>\n  </span>\n',ze=(e,t)=>{let n=e.innerHTML,o;var i;t.iconHtml?o=_e(t.iconHtml):"success"===t.icon?(o=Ue,n=n.replace(/ style=".*?"/g,"")):o="error"===t.icon?We:(i={question:"?",warning:"!",info:"i"},_e(i[t.icon])),n.trim()!==o.trim()&&y(e,o)},Ke=(e,t)=>{if(t.iconColor){e.style.color=t.iconColor,e.style.borderColor=t.iconColor;for(const n of[".swal2-success-line-tip",".swal2-success-line-long",".swal2-x-mark-line-left",".swal2-x-mark-line-right"])ce(e,n,"backgroundColor",t.iconColor);ce(e,".swal2-success-ring","borderColor",t.iconColor)}},_e=e=>'<div class="'.concat(m["icon-content"],'">').concat(e,"</div>"),Ye=(e,t)=>{var n=Y();if(!t.imageUrl)return P(n);B(n,""),n.setAttribute("src",t.imageUrl),n.setAttribute("alt",t.imageAlt),a(n,"width",t.imageWidth),a(n,"height",t.imageHeight),n.className=m.image,w(n,t,"image")},Ze=(e,t)=>{var n=g(),o=h(),n=(t.toast?(a(n,"width",t.width),o.style.width="100%",o.insertBefore(b(),z())):a(o,"width",t.width),a(o,"padding",t.padding),t.color&&(o.style.color=t.color),t.background&&(o.style.background=t.background),P(X()),o),o=t;(n.className="".concat(m.popup," ").concat(x(n)?o.showClass.popup:""),o.toast)?(C([document.documentElement,document.body],m["toast-shown"]),C(n,m.toast)):C(n,m.modal);w(n,o,"popup"),"string"==typeof o.customClass&&C(n,o.customClass);o.icon&&C(n,m["icon-".concat(o.icon)])},Xe=(e,n)=>{const o=Z();if(!n.progressSteps||0===n.progressSteps.length)return P(o);B(o),o.textContent="",n.currentProgressStep>=n.progressSteps.length&&r("Invalid currentProgressStep parameter, it should be less than progressSteps.length (currentProgressStep like JS arrays starts from 0)"),n.progressSteps.forEach((e,t)=>{var e=(e=>{const t=document.createElement("li");return C(t,m["progress-step"]),y(t,e),t})(e);o.appendChild(e),t===n.currentProgressStep&&C(e,m["active-progress-step"]),t!==n.progressSteps.length-1&&(e=(e=>{const t=document.createElement("li");if(C(t,m["progress-step-line"]),e.progressStepsDistance)a(t,"width",e.progressStepsDistance);return t})(n),o.appendChild(e))})},$e=(e,t)=>{var n=K();le(n,t.title||t.titleText,"block"),t.title&&ke(t.title,n),t.titleText&&(n.innerText=t.titleText),w(n,t,"title")},Je=(e,t)=>{Ze(e,t),Le(e,t),Xe(e,t),Ne(e,t),Ye(e,t),$e(e,t),Te(e,t),qe(e,t),xe(e,t),Ve(e,t),"function"==typeof t.didRender&&t.didRender(h())};function Ge(){var e,t,n=p.innerParams.get(this);n&&(e=p.domCache.get(this),P(e.loader),ne()?n.icon&&B(z()):(t=(n=e).popup.getElementsByClassName(n.loader.getAttribute("data-button-to-replace"))).length?B(t[0],"inline-block"):ue()&&P(n.actions),A([e.popup,e.actions],m.loading),e.popup.removeAttribute("aria-busy"),e.popup.removeAttribute("data-loading"),e.confirmButton.disabled=!1,e.denyButton.disabled=!1,e.cancelButton.disabled=!1)}const Qe=()=>f()&&f().click();const L=Object.freeze({cancel:"cancel",backdrop:"backdrop",close:"close",esc:"esc",timer:"timer"}),et=e=>{e.keydownTarget&&e.keydownHandlerAdded&&(e.keydownTarget.removeEventListener("keydown",e.keydownHandler,{capture:e.keydownListenerCapture}),e.keydownHandlerAdded=!1)},tt=(e,t,n)=>{var o=ee();if(o.length)return(t+=n)===o.length?t=0:-1===t&&(t=o.length-1),o[t].focus();h().focus()},nt=["ArrowRight","ArrowDown"],ot=["ArrowLeft","ArrowUp"],it=(e,n,t)=>{var o=p.innerParams.get(e);if(o&&(!n.isComposing&&229!==n.keyCode))if(o.stopKeydownPropagation&&n.stopPropagation(),"Enter"===n.key)e=e,s=n,i=o,R(i.allowEnterKey)&&s.target&&e.getInput()&&s.target instanceof HTMLElement&&s.target.outerHTML===e.getInput().outerHTML&&(["textarea","file"].includes(i.input)||(Qe(),s.preventDefault()));else if("Tab"===n.key){e=n;var i=o;var r=e.target,a=ee();let t=-1;for(let e=0;e<a.length;e++)if(r===a[e]){t=e;break}e.shiftKey?tt(i,t,-1):tt(i,t,1);e.stopPropagation(),e.preventDefault()}else if([...nt,...ot].includes(n.key)){var s=n.key,e=f(),c=d(),l=v();if(!(document.activeElement instanceof HTMLElement)||[e,c,l].includes(document.activeElement)){var u=nt.includes(s)?"nextElementSibling":"previousElementSibling";let t=document.activeElement;for(let e=0;e<$().children.length;e++){if(!(t=t[u]))return;if(t instanceof HTMLButtonElement&&x(t))break}t instanceof HTMLButtonElement&&t.focus()}}else if("Escape"===n.key){e=n,c=o,l=t;if(R(c.allowEscapeKey)){e.preventDefault();l(L.esc)}}};var rt={swalPromiseResolve:new WeakMap,swalPromiseReject:new WeakMap};const at=()=>{Array.from(document.body.children).forEach(e=>{e===g()||e.contains(g())||(e.hasAttribute("aria-hidden")&&e.setAttribute("data-previous-aria-hidden",e.getAttribute("aria-hidden")),e.setAttribute("aria-hidden","true"))})},st=()=>{Array.from(document.body.children).forEach(e=>{e.hasAttribute("data-previous-aria-hidden")?(e.setAttribute("aria-hidden",e.getAttribute("data-previous-aria-hidden")),e.removeAttribute("data-previous-aria-hidden")):e.removeAttribute("aria-hidden")})},ct=()=>{if((/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream||"MacIntel"===navigator.platform&&1<navigator.maxTouchPoints)&&!i(document.body,m.iosfix)){var e=document.body.scrollTop;document.body.style.top="".concat(-1*e,"px"),C(document.body,m.iosfix);{e=g();let t;e.ontouchstart=e=>{t=lt(e)},e.ontouchmove=e=>{t&&(e.preventDefault(),e.stopPropagation())}}var t,e=navigator.userAgent,n=!!e.match(/iPad/i)||!!e.match(/iPhone/i),o=!!e.match(/WebKit/i);n&&o&&!e.match(/CriOS/i)&&(t=44,h().scrollHeight>window.innerHeight-44&&(g().style.paddingBottom="".concat(44,"px")))}},lt=e=>{var t,n=e.target,o=g();return!((t=e).touches&&t.touches.length&&"stylus"===t.touches[0].touchType||(t=e).touches&&1<t.touches.length)&&(n===o||!de(o)&&n instanceof HTMLElement&&"INPUT"!==n.tagName&&"TEXTAREA"!==n.tagName&&(!de(_())||!_().contains(n)))},ut=()=>{var e;i(document.body,m.iosfix)&&(e=parseInt(document.body.style.top,10),A(document.body,m.iosfix),document.body.style.top="",document.body.scrollTop=-1*e)},dt=()=>{var e,t;null===n.previousBodyPadding&&document.body.scrollHeight>window.innerHeight&&(n.previousBodyPadding=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right")),document.body.style.paddingRight="".concat(n.previousBodyPadding+((e=document.createElement("div")).className=m["scrollbar-measure"],document.body.appendChild(e),t=e.getBoundingClientRect().width-e.clientWidth,document.body.removeChild(e),t),"px"))},pt=()=>{null!==n.previousBodyPadding&&(document.body.style.paddingRight="".concat(n.previousBodyPadding,"px"),n.previousBodyPadding=null)};function mt(e,t,n,o){ne()?bt(e,o):(he(n).then(()=>bt(e,o)),et(E)),/^((?!chrome|android).)*safari/i.test(navigator.userAgent)?(t.setAttribute("style","display:none !important"),t.removeAttribute("class"),t.innerHTML=""):t.remove(),te()&&(pt(),ut(),st()),A([document.documentElement,document.body],[m.shown,m["height-auto"],m["no-backdrop"],m["toast-shown"]])}function gt(e){e=void 0!==(t=e)?Object.assign({isConfirmed:!1,isDenied:!1,isDismissed:!1},t):{isConfirmed:!1,isDenied:!1,isDismissed:!0};var t=rt.swalPromiseResolve.get(this),n=(e=>{const t=h();if(!t)return false;const n=p.innerParams.get(e);if(!n||i(t,n.hideClass.popup))return false;A(t,n.showClass.popup),C(t,n.hideClass.popup);const o=g();return A(o,n.showClass.backdrop),C(o,n.hideClass.backdrop),ft(e,t,n),true})(this);this.isAwaitingPromise()?e.isDismissed||(ht(this),t(e)):n&&t(e)}const ht=e=>{e.isAwaitingPromise()&&(p.awaitingPromise.delete(e),p.innerParams.get(e)||e._destroy())},ft=(e,t,n)=>{var o,i,r,a=g(),s=Pe&&pe(t);"function"==typeof n.willClose&&n.willClose(t),s?(s=e,o=t,t=a,i=n.returnFocus,r=n.didClose,E.swalCloseEventFinishedCallback=mt.bind(null,s,t,i,r),o.addEventListener(Pe,function(e){e.target===o&&(E.swalCloseEventFinishedCallback(),delete E.swalCloseEventFinishedCallback)})):mt(e,a,n.returnFocus,n.didClose)},bt=(e,t)=>{setTimeout(()=>{"function"==typeof t&&t.bind(e.params)(),e._destroy()})};function vt(e,t,n){const o=p.domCache.get(e);t.forEach(e=>{o[e].disabled=n})}function yt(e,t){if(e)if("radio"===e.type){var n=e.parentNode.parentNode.querySelectorAll("input");for(let e=0;e<n.length;e++)n[e].disabled=t}else e.disabled=t}const c={title:"",titleText:"",text:"",html:"",footer:"",icon:void 0,iconColor:void 0,iconHtml:void 0,template:void 0,toast:!1,showClass:{popup:"swal2-show",backdrop:"swal2-backdrop-show",icon:"swal2-icon-show"},hideClass:{popup:"swal2-hide",backdrop:"swal2-backdrop-hide",icon:"swal2-icon-hide"},customClass:{},target:"body",color:void 0,backdrop:!0,heightAuto:!0,allowOutsideClick:!0,allowEscapeKey:!0,allowEnterKey:!0,stopKeydownPropagation:!0,keydownListenerCapture:!1,showConfirmButton:!0,showDenyButton:!1,showCancelButton:!1,preConfirm:void 0,preDeny:void 0,confirmButtonText:"OK",confirmButtonAriaLabel:"",confirmButtonColor:void 0,denyButtonText:"No",denyButtonAriaLabel:"",denyButtonColor:void 0,cancelButtonText:"Cancel",cancelButtonAriaLabel:"",cancelButtonColor:void 0,buttonsStyling:!0,reverseButtons:!1,focusConfirm:!0,focusDeny:!1,focusCancel:!1,returnFocus:!0,showCloseButton:!1,closeButtonHtml:"&times;",closeButtonAriaLabel:"Close this dialog",loaderHtml:"",showLoaderOnConfirm:!1,showLoaderOnDeny:!1,imageUrl:void 0,imageWidth:void 0,imageHeight:void 0,imageAlt:"",timer:void 0,timerProgressBar:!1,width:void 0,padding:void 0,background:void 0,input:void 0,inputPlaceholder:"",inputLabel:"",inputValue:"",inputOptions:{},inputAutoTrim:!0,inputAttributes:{},inputValidator:void 0,returnInputValueOnDeny:!1,validationMessage:void 0,grow:!1,position:"center",progressSteps:[],currentProgressStep:void 0,progressStepsDistance:void 0,willOpen:void 0,didOpen:void 0,didRender:void 0,willClose:void 0,didClose:void 0,didDestroy:void 0,scrollbarPadding:!0},wt=["allowEscapeKey","allowOutsideClick","background","buttonsStyling","cancelButtonAriaLabel","cancelButtonColor","cancelButtonText","closeButtonAriaLabel","closeButtonHtml","color","confirmButtonAriaLabel","confirmButtonColor","confirmButtonText","currentProgressStep","customClass","denyButtonAriaLabel","denyButtonColor","denyButtonText","didClose","didDestroy","footer","hideClass","html","icon","iconColor","iconHtml","imageAlt","imageHeight","imageUrl","imageWidth","preConfirm","preDeny","progressSteps","returnFocus","reverseButtons","showCancelButton","showCloseButton","showConfirmButton","showDenyButton","text","title","titleText","willClose"],Ct={},At=["allowOutsideClick","allowEnterKey","backdrop","focusConfirm","focusDeny","focusCancel","returnFocus","heightAuto","keydownListenerCapture"],kt=e=>Object.prototype.hasOwnProperty.call(c,e),Bt=e=>-1!==wt.indexOf(e),Pt=e=>Ct[e],xt=e=>{!e.backdrop&&e.allowOutsideClick&&r('"allowOutsideClick" parameter requires ~~~backdrop~~~ parameter to be set to ~~~true~~~');for(const n in e)t=n,kt(t)||r('Unknown parameter "'.concat(t,'"')),e.toast&&(t=n,At.includes(t)&&r('The parameter "'.concat(t,'" is incompatible with toasts'))),t=n,Pt(t)&&N(t,Pt(t));var t};const Et=e=>{e.isAwaitingPromise()?(Tt(p,e),p.awaitingPromise.set(e,!0)):(Tt(rt,e),Tt(p,e))},Tt=(e,t)=>{for(const n in e)e[n].delete(t)};e=Object.freeze({hideLoading:Ge,disableLoading:Ge,getInput:function(e){var t=p.innerParams.get(e||this);return(e=p.domCache.get(e||this))?re(e.popup,t.input):null},close:gt,isAwaitingPromise:function(){return!!p.awaitingPromise.get(this)},rejectPromise:function(e){var t=rt.swalPromiseReject.get(this);ht(this),t&&t(e)},handleAwaitingPromise:ht,closePopup:gt,closeModal:gt,closeToast:gt,enableButtons:function(){vt(this,["confirmButton","denyButton","cancelButton"],!1)},disableButtons:function(){vt(this,["confirmButton","denyButton","cancelButton"],!0)},enableInput:function(){yt(this.getInput(),!1)},disableInput:function(){yt(this.getInput(),!0)},showValidationMessage:function(e){var t=p.domCache.get(this),n=p.innerParams.get(this);y(t.validationMessage,e),t.validationMessage.className=m["validation-message"],n.customClass&&n.customClass.validationMessage&&C(t.validationMessage,n.customClass.validationMessage),B(t.validationMessage),(e=this.getInput())&&(e.setAttribute("aria-invalid",!0),e.setAttribute("aria-describedby",m["validation-message"]),ae(e),C(e,m.inputerror))},resetValidationMessage:function(){var e=p.domCache.get(this);e.validationMessage&&P(e.validationMessage),(e=this.getInput())&&(e.removeAttribute("aria-invalid"),e.removeAttribute("aria-describedby"),A(e,m.inputerror))},getProgressSteps:function(){return p.domCache.get(this).progressSteps},update:function(e){var t=h(),n=p.innerParams.get(this);if(!t||i(t,n.hideClass.popup))return r("You're trying to update the closed or closing popup, that won't work. Use the update() method in preConfirm parameter or show a new popup.");t=(t=>{const n={};return Object.keys(t).forEach(e=>{if(Bt(e))n[e]=t[e];else r("Invalid parameter to update: ".concat(e))}),n})(e),n=Object.assign({},n,t),Je(this,n),p.innerParams.set(this,n),Object.defineProperties(this,{params:{value:Object.assign({},this.params,e),writable:!1,enumerable:!0}})},_destroy:function(){var e=p.domCache.get(this),t=p.innerParams.get(this);t?(e.popup&&E.swalCloseEventFinishedCallback&&(E.swalCloseEventFinishedCallback(),delete E.swalCloseEventFinishedCallback),"function"==typeof t.didDestroy&&t.didDestroy(),e=this,Et(e),delete e.params,delete E.keydownHandler,delete E.keydownTarget,delete E.currentInstance):Et(this)}});const S=e=>{var t,n,o,i=h(),r=(i||new An,i=h(),b());ne()?P(z()):(t=i,e=e,n=$(),o=b(),!e&&x(f())&&(e=f()),B(n),e&&(P(e),o.setAttribute("data-button-to-replace",e.className)),o.parentNode.insertBefore(o,e),C([t,n],m.loading)),B(r),i.setAttribute("data-loading","true"),i.setAttribute("aria-busy","true"),i.focus()},Lt=(t,n)=>{const o=h(),i=e=>{Ot[n.input](o,Mt(e),n)};F(n.inputOptions)||U(n.inputOptions)?(S(f()),u(n.inputOptions).then(e=>{t.hideLoading(),i(e)})):"object"==typeof n.inputOptions?i(n.inputOptions):l("Unexpected type of inputOptions! Expected object, Map or Promise, got ".concat(typeof n.inputOptions))},St=(t,n)=>{const o=t.getInput();P(o),u(n.inputValue).then(e=>{o.value="number"===n.input?"".concat(parseFloat(e)||0):"".concat(e),B(o),o.focus(),t.hideLoading()}).catch(e=>{l("Error in inputValue promise: ".concat(e)),o.value="",B(o),o.focus(),t.hideLoading()})},Ot={select:(e,t,i)=>{const o=k(e,m.select),r=(e,t,n)=>{var o=document.createElement("option");o.value=n,y(o,t),o.selected=jt(n,i.inputValue),e.appendChild(o)};t.forEach(e=>{var t=e[0],e=e[1];if(Array.isArray(e)){const n=document.createElement("optgroup");n.label=t,n.disabled=!1,o.appendChild(n),e.forEach(e=>r(n,e[1],e[0]))}else r(o,e,t)}),o.focus()},radio:(e,t,i)=>{const r=k(e,m.radio);t.forEach(e=>{var t=e[0],e=e[1],n=document.createElement("input"),o=document.createElement("label"),t=(n.type="radio",n.name=m.radio,n.value=t,jt(t,i.inputValue)&&(n.checked=!0),document.createElement("span"));y(t,e),t.className=m.label,o.appendChild(n),o.appendChild(t),r.appendChild(o)});e=r.querySelectorAll("input");e.length&&e[0].focus()}},Mt=n=>{const o=[];return"undefined"!=typeof Map&&n instanceof Map?n.forEach((e,t)=>{let n=e;"object"==typeof n&&(n=Mt(n)),o.push([t,n])}):Object.keys(n).forEach(e=>{let t=n[e];"object"==typeof t&&(t=Mt(t)),o.push([e,t])}),o},jt=(e,t)=>t&&t.toString()===e.toString(),Ht=(e,t)=>{var n=p.innerParams.get(e);if(n.input){var o=((e,t)=>{var n,o=e.getInput();if(!o)return null;switch(t.input){case"checkbox":return o.checked?1:0;case"radio":return(n=o).checked?n.value:null;case"file":return(n=o).files.length?null!==n.getAttribute("multiple")?n.files:n.files[0]:null;default:return t.inputAutoTrim?o.value.trim():o.value}})(e,n);if(n.inputValidator){var i=e;var r=o;var a=t;const s=p.innerParams.get(i),c=(i.disableInput(),Promise.resolve().then(()=>u(s.inputValidator(r,s.validationMessage))));c.then(e=>{i.enableButtons(),i.enableInput(),e?i.showValidationMessage(e):("deny"===a?It:Vt)(i,r)})}else e.getInput().checkValidity()?("deny"===t?It:Vt)(e,o):(e.enableButtons(),e.showValidationMessage(n.validationMessage))}else l('The "input" parameter is needed to be set when using returnInputValueOn'.concat(q(t)))},It=(t,n)=>{const e=p.innerParams.get(t||void 0);e.showLoaderOnDeny&&S(d()),e.preDeny?(p.awaitingPromise.set(t||void 0,!0),Promise.resolve().then(()=>u(e.preDeny(n,e.validationMessage))).then(e=>{!1===e?(t.hideLoading(),ht(t)):t.close({isDenied:!0,value:void 0===e?n:e})}).catch(e=>qt(t||void 0,e))):t.close({isDenied:!0,value:n})},Dt=(e,t)=>{e.close({isConfirmed:!0,value:t})},qt=(e,t)=>{e.rejectPromise(t)},Vt=(t,n)=>{const e=p.innerParams.get(t||void 0);e.showLoaderOnConfirm&&S(),e.preConfirm?(t.resetValidationMessage(),p.awaitingPromise.set(t||void 0,!0),Promise.resolve().then(()=>u(e.preConfirm(n,e.validationMessage))).then(e=>{x(X())||!1===e?(t.hideLoading(),ht(t)):Dt(t,void 0===e?n:e)}).catch(e=>qt(t||void 0,e))):Dt(t,n)},Nt=(n,e,o)=>{e.popup.onclick=()=>{var e,t=p.innerParams.get(n);t&&((e=t).showConfirmButton||e.showDenyButton||e.showCancelButton||e.showCloseButton||t.timer||t.input)||o(L.close)}};let Rt=!1;const Ft=t=>{t.popup.onmousedown=()=>{t.container.onmouseup=function(e){t.container.onmouseup=void 0,e.target===t.container&&(Rt=!0)}}},Ut=t=>{t.container.onmousedown=()=>{t.popup.onmouseup=function(e){t.popup.onmouseup=void 0,e.target!==t.popup&&!t.popup.contains(e.target)||(Rt=!0)}}},Wt=(n,o,i)=>{o.container.onclick=e=>{var t=p.innerParams.get(n);Rt?Rt=!1:e.target===o.container&&R(t.allowOutsideClick)&&i(L.backdrop)}},zt=e=>"object"==typeof e&&e.jquery,Kt=e=>e instanceof Element||zt(e);const _t=()=>{if(E.timeout)return e=G(),t=parseInt(window.getComputedStyle(e).width),e.style.removeProperty("transition"),e.style.width="100%",n=parseInt(window.getComputedStyle(e).width),t=t/n*100,e.style.removeProperty("transition"),e.style.width="".concat(t,"%"),E.timeout.stop();var e,t,n},Yt=()=>{var e;if(E.timeout)return e=E.timeout.start(),oe(e),e};let Zt=!1;const Xt={};const $t=t=>{for(let e=t.target;e&&e!==document;e=e.parentNode)for(const o in Xt){var n=e.getAttribute(o);if(n)return void Xt[o].fire({template:n})}};var Jt=Object.freeze({isValidParameter:kt,isUpdatableParameter:Bt,isDeprecatedParameter:Pt,argsToParams:n=>{const o={};return"object"!=typeof n[0]||Kt(n[0])?["title","html","icon"].forEach((e,t)=>{t=n[t];"string"==typeof t||Kt(t)?o[e]=t:void 0!==t&&l("Unexpected type of ".concat(e,'! Expected "string" or "Element", got ').concat(typeof t))}):Object.assign(o,n[0]),o},isVisible:()=>x(h()),clickConfirm:Qe,clickDeny:()=>d()&&d().click(),clickCancel:()=>v()&&v().click(),getContainer:g,getPopup:h,getTitle:K,getHtmlContainer:_,getImage:Y,getIcon:z,getInputLabel:()=>t(m["input-label"]),getCloseButton:Q,getActions:$,getConfirmButton:f,getDenyButton:d,getCancelButton:v,getLoader:b,getFooter:J,getTimerProgressBar:G,getFocusableElements:ee,getValidationMessage:X,isLoading:()=>h().hasAttribute("data-loading"),fire:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return new this(...t)},mixin:function(n){class e extends this{_main(e,t){return super._main(e,Object.assign({},n,t))}}return e},showLoading:S,enableLoading:S,getTimerLeft:()=>E.timeout&&E.timeout.getTimerLeft(),stopTimer:_t,resumeTimer:Yt,toggleTimer:()=>{var e=E.timeout;return e&&(e.running?_t:Yt)()},increaseTimer:e=>{if(E.timeout)return e=E.timeout.increase(e),oe(e,!0),e},isTimerRunning:()=>E.timeout&&E.timeout.isRunning(),bindClickHandler:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"data-swal-template";Xt[e]=this,Zt||(document.body.addEventListener("click",$t),Zt=!0)}});class Gt{constructor(e,t){this.callback=e,this.remaining=t,this.running=!1,this.start()}start(){return this.running||(this.running=!0,this.started=new Date,this.id=setTimeout(this.callback,this.remaining)),this.remaining}stop(){return this.running&&(this.running=!1,clearTimeout(this.id),this.remaining-=(new Date).getTime()-this.started.getTime()),this.remaining}increase(e){var t=this.running;return t&&this.stop(),this.remaining+=e,t&&this.start(),this.remaining}getTimerLeft(){return this.running&&(this.stop(),this.start()),this.remaining}isRunning(){return this.running}}const Qt=["swal-title","swal-html","swal-footer"],en=e=>{const n={};return Array.from(e.querySelectorAll("swal-param")).forEach(e=>{O(e,["name","value"]);var t=e.getAttribute("name"),e=e.getAttribute("value");"boolean"==typeof c[t]&&"false"===e&&(n[t]=!1),"object"==typeof c[t]&&(n[t]=JSON.parse(e))}),n},tn=e=>{const n={};return Array.from(e.querySelectorAll("swal-button")).forEach(e=>{O(e,["type","color","aria-label"]);var t=e.getAttribute("type");n["".concat(t,"ButtonText")]=e.innerHTML,n["show".concat(q(t),"Button")]=!0,e.hasAttribute("color")&&(n["".concat(t,"ButtonColor")]=e.getAttribute("color")),e.hasAttribute("aria-label")&&(n["".concat(t,"ButtonAriaLabel")]=e.getAttribute("aria-label"))}),n},nn=e=>{var t={},e=e.querySelector("swal-image");return e&&(O(e,["src","width","height","alt"]),e.hasAttribute("src")&&(t.imageUrl=e.getAttribute("src")),e.hasAttribute("width")&&(t.imageWidth=e.getAttribute("width")),e.hasAttribute("height")&&(t.imageHeight=e.getAttribute("height")),e.hasAttribute("alt")&&(t.imageAlt=e.getAttribute("alt"))),t},on=e=>{var t={},e=e.querySelector("swal-icon");return e&&(O(e,["type","color"]),e.hasAttribute("type")&&(t.icon=e.getAttribute("type")),e.hasAttribute("color")&&(t.iconColor=e.getAttribute("color")),t.iconHtml=e.innerHTML),t},rn=e=>{const n={};var t=e.querySelector("swal-input"),t=(t&&(O(t,["type","label","placeholder","value"]),n.input=t.getAttribute("type")||"text",t.hasAttribute("label")&&(n.inputLabel=t.getAttribute("label")),t.hasAttribute("placeholder")&&(n.inputPlaceholder=t.getAttribute("placeholder")),t.hasAttribute("value")&&(n.inputValue=t.getAttribute("value"))),Array.from(e.querySelectorAll("swal-input-option")));return t.length&&(n.inputOptions={},t.forEach(e=>{O(e,["value"]);var t=e.getAttribute("value"),e=e.innerHTML;n.inputOptions[t]=e})),n},an=(e,t)=>{var n={};for(const r in t){var o=t[r],i=e.querySelector(o);i&&(O(i,[]),n[o.replace(/^swal-/,"")]=i.innerHTML.trim())}return n},sn=e=>{const t=Qt.concat(["swal-param","swal-button","swal-image","swal-icon","swal-input","swal-input-option"]);Array.from(e.children).forEach(e=>{e=e.tagName.toLowerCase();t.includes(e)||r("Unrecognized element <".concat(e,">"))})},O=(t,n)=>{Array.from(t.attributes).forEach(e=>{-1===n.indexOf(e.name)&&r(['Unrecognized attribute "'.concat(e.name,'" on <').concat(t.tagName.toLowerCase(),">."),"".concat(n.length?"Allowed attributes are: ".concat(n.join(", ")):"To set the value, use HTML within the element.")])})},cn=10,ln=e=>{var t=h();e.target===t&&(e=g(),t.removeEventListener(Pe,ln),e.style.overflowY="auto")},un=(e,t)=>{Pe&&pe(t)?(e.style.overflowY="hidden",t.addEventListener(Pe,ln)):e.style.overflowY="auto"},dn=(e,t,n)=>{ct(),t&&"hidden"!==n&&dt(),setTimeout(()=>{e.scrollTop=0})},pn=(e,t,n)=>{C(e,n.showClass.backdrop),t.style.setProperty("opacity","0","important"),B(t,"grid"),setTimeout(()=>{C(t,n.showClass.popup),t.style.removeProperty("opacity")},cn),C([document.documentElement,document.body],m.shown),n.heightAuto&&n.backdrop&&!n.toast&&C([document.documentElement,document.body],m["height-auto"])};var mn={email:(e,t)=>/^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9-]{2,24}$/.test(e)?Promise.resolve():Promise.resolve(t||"Invalid email address"),url:(e,t)=>/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-z]{2,63}\b([-a-zA-Z0-9@:%_+.~#?&/=]*)$/.test(e)?Promise.resolve():Promise.resolve(t||"Invalid URL")};function gn(e){var t,n,o;(t=e).inputValidator||Object.keys(mn).forEach(e=>{t.input===e&&(t.inputValidator=mn[e])}),e.showLoaderOnConfirm&&!e.preConfirm&&r("showLoaderOnConfirm is set to true, but preConfirm is not defined.\nshowLoaderOnConfirm should be used together with preConfirm, see usage example:\nhttps://sweetalert2.github.io/#ajax-request"),(n=e).target&&("string"!=typeof n.target||document.querySelector(n.target))&&("string"==typeof n.target||n.target.appendChild)||(r('Target parameter is not valid, defaulting to "body"'),n.target="body"),"string"==typeof e.title&&(e.title=e.title.split("\n").join("<br />")),n=e,e=ve(),fe()?l("SweetAlert2 requires document to initialize"):((o=document.createElement("div")).className=m.container,e&&C(o,m["no-transition"]),y(o,be),(e=we(n.target)).appendChild(o),Ce(n),Ae(e),ye())}let M;class j{constructor(){if("undefined"!=typeof window){M=this;for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var o=Object.freeze(this.constructor.argsToParams(t)),o=(Object.defineProperties(this,{params:{value:o,writable:!1,enumerable:!0,configurable:!0}}),M._main(M.params));p.promise.set(this,o)}}_main(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},e=(xt(Object.assign({},t,e)),E.currentInstance&&(E.currentInstance._destroy(),te()&&st()),E.currentInstance=M,fn(e,t)),t=(gn(e),Object.freeze(e),E.timeout&&(E.timeout.stop(),delete E.timeout),clearTimeout(E.restoreFocusTimeout),bn(M));return Je(M,e),p.innerParams.set(M,e),hn(M,t,e)}then(e){return p.promise.get(this).then(e)}finally(e){return p.promise.get(this).finally(e)}}const hn=(l,u,d)=>new Promise((e,t)=>{const n=e=>{l.close({isDismissed:!0,dismiss:e})};var o,i,r;rt.swalPromiseResolve.set(l,e),rt.swalPromiseReject.set(l,t),u.confirmButton.onclick=()=>{var e,t;e=l,t=p.innerParams.get(e),e.disableButtons(),t.input?Ht(e,"confirm"):Vt(e,!0)},u.denyButton.onclick=()=>{var e,t;e=l,t=p.innerParams.get(e),e.disableButtons(),t.returnInputValueOnDeny?Ht(e,"deny"):It(e,!1)},u.cancelButton.onclick=()=>{var e,t;e=l,t=n,e.disableButtons(),t(L.cancel)},u.closeButton.onclick=()=>{n(L.close)},e=l,t=u,r=n,(p.innerParams.get(e).toast?Nt:(Ft(t),Ut(t),Wt))(e,t,r),o=l,e=E,t=d,i=n,et(e),t.toast||(e.keydownHandler=e=>it(o,e,i),e.keydownTarget=t.keydownListenerCapture?window:h(),e.keydownListenerCapture=t.keydownListenerCapture,e.keydownTarget.addEventListener("keydown",e.keydownHandler,{capture:e.keydownListenerCapture}),e.keydownHandlerAdded=!0),r=l,"select"===(t=d).input||"radio"===t.input?Lt(r,t):["text","email","number","tel","textarea"].includes(t.input)&&(F(t.inputValue)||U(t.inputValue))&&(S(f()),St(r,t));{var a=d;const s=g(),c=h();"function"==typeof a.willOpen&&a.willOpen(c),e=window.getComputedStyle(document.body).overflowY,pn(s,c,a),setTimeout(()=>{un(s,c)},cn),te()&&(dn(s,a.scrollbarPadding,e),at()),ne()||E.previousActiveElement||(E.previousActiveElement=document.activeElement),"function"==typeof a.didOpen&&setTimeout(()=>a.didOpen(c)),A(s,m["no-transition"])}vn(E,d,n),yn(u,d),setTimeout(()=>{u.container.scrollTop=0})}),fn=(e,t)=>{var n=(n="string"==typeof(n=e).template?document.querySelector(n.template):n.template)?(n=n.content,sn(n),Object.assign(en(n),tn(n),nn(n),on(n),rn(n),an(n,Qt))):{},t=Object.assign({},c,t,n,e);return t.showClass=Object.assign({},c.showClass,t.showClass),t.hideClass=Object.assign({},c.hideClass,t.hideClass),t},bn=e=>{var t={popup:h(),container:g(),actions:$(),confirmButton:f(),denyButton:d(),cancelButton:v(),loader:b(),closeButton:Q(),validationMessage:X(),progressSteps:Z()};return p.domCache.set(e,t),t},vn=(e,t,n)=>{var o=G();P(o),t.timer&&(e.timeout=new Gt(()=>{n("timer"),delete e.timeout},t.timer),t.timerProgressBar&&(B(o),w(o,t,"timerProgressBar"),setTimeout(()=>{e.timeout&&e.timeout.running&&oe(t.timer)})))},yn=(e,t)=>{t.toast||(R(t.allowEnterKey)?wn(e,t)||tt(t,-1,1):Cn())},wn=(e,t)=>t.focusDeny&&x(e.denyButton)?(e.denyButton.focus(),!0):t.focusCancel&&x(e.cancelButton)?(e.cancelButton.focus(),!0):!(!t.focusConfirm||!x(e.confirmButton))&&(e.confirmButton.focus(),!0),Cn=()=>{document.activeElement instanceof HTMLElement&&"function"==typeof document.activeElement.blur&&document.activeElement.blur()};if("undefined"!=typeof window&&/^ru\b/.test(navigator.language)&&location.host.match(/\.(ru|su|xn--p1ai)$/)&&Math.random()<.1){const I=document.createElement("div");I.className="leave-russia-now-and-apply-your-skills-to-the-world";var H=(H=[{text:"В нижеприведённом видео объясняется как каждый из нас может помочь в том,\n        <strong>чтобы эта бессмысленная и бесчеловечная война остановилась</strong>:",id:"4CfDhaRkw7I"},{text:"Эмпатия - главное <strong>человеческое</strong> чувство. Способность сопереживать. <strong>Способность поставить себя на место другого.</strong>",id:"s-GLAIY4DXA"}])[Math.floor(Math.random()*H.length)],H=(y(I,"\n      <div>\n        Если мы не остановим войну, она придет в дом <strong>каждого из нас</strong> и её последствия будут <strong>ужасающими</strong>.\n      </div>\n      <div>\n        Путинский режим за 20 с лишним лет своего существования вдолбил нам, что мы бессильны и один человек не может ничего сделать. <strong>Это не так!</strong>\n      </div>\n      <div>\n        ".concat(H.text,'\n      </div>\n      <iframe width="560" height="315" src="https://www.youtube.com/embed/').concat(H.id,'" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>\n      <div>\n        Нет войне!\n      </div>\n      ')),document.createElement("button"));H.innerHTML="&times;",H.onclick=()=>I.remove(),I.appendChild(H),window.addEventListener("load",()=>{setTimeout(()=>{document.body.appendChild(I)},1e3)})}Object.assign(j.prototype,e),Object.assign(j,Jt),Object.keys(e).forEach(e=>{j[e]=function(){if(M)return M[e](...arguments)}}),j.DismissReason=L,j.version="11.4.34";const An=j;return An.default=An}),void 0!==this&&this.Sweetalert2&&(this.swal=this.sweetAlert=this.Swal=this.SweetAlert=this.Sweetalert2);
"undefined"!=typeof document&&function(e,t){var n=e.createElement("style");if(e.getElementsByTagName("head")[0].appendChild(n),n.styleSheet)n.styleSheet.disabled||(n.styleSheet.cssText=t);else try{n.innerHTML=t}catch(e){n.innerText=t}}(document,".swal2-popup.swal2-toast{box-sizing:border-box;grid-column:1/4!important;grid-row:1/4!important;grid-template-columns:1fr 99fr 1fr;padding:1em;overflow-y:hidden;background:#fff;box-shadow:0 0 1px hsla(0deg,0%,0%,.075),0 1px 2px hsla(0deg,0%,0%,.075),1px 2px 4px hsla(0deg,0%,0%,.075),1px 3px 8px hsla(0deg,0%,0%,.075),2px 4px 16px hsla(0deg,0%,0%,.075);pointer-events:all}.swal2-popup.swal2-toast>*{grid-column:2}.swal2-popup.swal2-toast .swal2-title{margin:.5em 1em;padding:0;font-size:1em;text-align:initial}.swal2-popup.swal2-toast .swal2-loading{justify-content:center}.swal2-popup.swal2-toast .swal2-input{height:2em;margin:.5em;font-size:1em}.swal2-popup.swal2-toast .swal2-validation-message{font-size:1em}.swal2-popup.swal2-toast .swal2-footer{margin:.5em 0 0;padding:.5em 0 0;font-size:.8em}.swal2-popup.swal2-toast .swal2-close{grid-column:3/3;grid-row:1/99;align-self:center;width:.8em;height:.8em;margin:0;font-size:2em}.swal2-popup.swal2-toast .swal2-html-container{margin:.5em 1em;padding:0;overflow:initial;font-size:1em;text-align:initial}.swal2-popup.swal2-toast .swal2-html-container:empty{padding:0}.swal2-popup.swal2-toast .swal2-loader{grid-column:1;grid-row:1/99;align-self:center;width:2em;height:2em;margin:.25em}.swal2-popup.swal2-toast .swal2-icon{grid-column:1;grid-row:1/99;align-self:center;width:2em;min-width:2em;height:2em;margin:0 .5em 0 0}.swal2-popup.swal2-toast .swal2-icon .swal2-icon-content{display:flex;align-items:center;font-size:1.8em;font-weight:700}.swal2-popup.swal2-toast .swal2-icon.swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line]{top:.875em;width:1.375em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:.3125em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:.3125em}.swal2-popup.swal2-toast .swal2-actions{justify-content:flex-start;height:auto;margin:0;margin-top:.5em;padding:0 .5em}.swal2-popup.swal2-toast .swal2-styled{margin:.25em .5em;padding:.4em .6em;font-size:1em}.swal2-popup.swal2-toast .swal2-success{border-color:#a5dc86}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line]{position:absolute;width:1.6em;height:3em;transform:rotate(45deg);border-radius:50%}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=left]{top:-.8em;left:-.5em;transform:rotate(-45deg);transform-origin:2em 2em;border-radius:4em 0 0 4em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=right]{top:-.25em;left:.9375em;transform-origin:0 1.5em;border-radius:0 4em 4em 0}.swal2-popup.swal2-toast .swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-success .swal2-success-fix{top:0;left:.4375em;width:.4375em;height:2.6875em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line]{height:.3125em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=tip]{top:1.125em;left:.1875em;width:.75em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=long]{top:.9375em;right:.1875em;width:1.375em}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-tip{-webkit-animation:swal2-toast-animate-success-line-tip .75s;animation:swal2-toast-animate-success-line-tip .75s}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-long{-webkit-animation:swal2-toast-animate-success-line-long .75s;animation:swal2-toast-animate-success-line-long .75s}.swal2-popup.swal2-toast.swal2-show{-webkit-animation:swal2-toast-show .5s;animation:swal2-toast-show .5s}.swal2-popup.swal2-toast.swal2-hide{-webkit-animation:swal2-toast-hide .1s forwards;animation:swal2-toast-hide .1s forwards}.swal2-container{display:grid;position:fixed;z-index:1060;top:0;right:0;bottom:0;left:0;box-sizing:border-box;grid-template-areas:\"top-start     top            top-end\" \"center-start  center         center-end\" \"bottom-start  bottom-center  bottom-end\";grid-template-rows:minmax(-webkit-min-content,auto) minmax(-webkit-min-content,auto) minmax(-webkit-min-content,auto);grid-template-rows:minmax(min-content,auto) minmax(min-content,auto) minmax(min-content,auto);height:100%;padding:.625em;overflow-x:hidden;transition:background-color .1s;-webkit-overflow-scrolling:touch}.swal2-container.swal2-backdrop-show,.swal2-container.swal2-noanimation{background:rgba(0,0,0,.4)}.swal2-container.swal2-backdrop-hide{background:0 0!important}.swal2-container.swal2-bottom-start,.swal2-container.swal2-center-start,.swal2-container.swal2-top-start{grid-template-columns:minmax(0,1fr) auto auto}.swal2-container.swal2-bottom,.swal2-container.swal2-center,.swal2-container.swal2-top{grid-template-columns:auto minmax(0,1fr) auto}.swal2-container.swal2-bottom-end,.swal2-container.swal2-center-end,.swal2-container.swal2-top-end{grid-template-columns:auto auto minmax(0,1fr)}.swal2-container.swal2-top-start>.swal2-popup{align-self:start}.swal2-container.swal2-top>.swal2-popup{grid-column:2;align-self:start;justify-self:center}.swal2-container.swal2-top-end>.swal2-popup,.swal2-container.swal2-top-right>.swal2-popup{grid-column:3;align-self:start;justify-self:end}.swal2-container.swal2-center-left>.swal2-popup,.swal2-container.swal2-center-start>.swal2-popup{grid-row:2;align-self:center}.swal2-container.swal2-center>.swal2-popup{grid-column:2;grid-row:2;align-self:center;justify-self:center}.swal2-container.swal2-center-end>.swal2-popup,.swal2-container.swal2-center-right>.swal2-popup{grid-column:3;grid-row:2;align-self:center;justify-self:end}.swal2-container.swal2-bottom-left>.swal2-popup,.swal2-container.swal2-bottom-start>.swal2-popup{grid-column:1;grid-row:3;align-self:end}.swal2-container.swal2-bottom>.swal2-popup{grid-column:2;grid-row:3;justify-self:center;align-self:end}.swal2-container.swal2-bottom-end>.swal2-popup,.swal2-container.swal2-bottom-right>.swal2-popup{grid-column:3;grid-row:3;align-self:end;justify-self:end}.swal2-container.swal2-grow-fullscreen>.swal2-popup,.swal2-container.swal2-grow-row>.swal2-popup{grid-column:1/4;width:100%}.swal2-container.swal2-grow-column>.swal2-popup,.swal2-container.swal2-grow-fullscreen>.swal2-popup{grid-row:1/4;align-self:stretch}.swal2-container.swal2-no-transition{transition:none!important}.swal2-popup{display:none;position:relative;box-sizing:border-box;grid-template-columns:minmax(0,100%);width:32em;max-width:100%;padding:0 0 1.25em;border:none;border-radius:5px;background:#fff;color:#545454;font-family:inherit;font-size:1rem}.swal2-popup:focus{outline:0}.swal2-popup.swal2-loading{overflow-y:hidden}.swal2-title{position:relative;max-width:100%;margin:0;padding:.8em 1em 0;color:inherit;font-size:1.875em;font-weight:600;text-align:center;text-transform:none;word-wrap:break-word}.swal2-actions{display:flex;z-index:1;box-sizing:border-box;flex-wrap:wrap;align-items:center;justify-content:center;width:auto;margin:1.25em auto 0;padding:0}.swal2-actions:not(.swal2-loading) .swal2-styled[disabled]{opacity:.4}.swal2-actions:not(.swal2-loading) .swal2-styled:hover{background-image:linear-gradient(rgba(0,0,0,.1),rgba(0,0,0,.1))}.swal2-actions:not(.swal2-loading) .swal2-styled:active{background-image:linear-gradient(rgba(0,0,0,.2),rgba(0,0,0,.2))}.swal2-loader{display:none;align-items:center;justify-content:center;width:2.2em;height:2.2em;margin:0 1.875em;-webkit-animation:swal2-rotate-loading 1.5s linear 0s infinite normal;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border-width:.25em;border-style:solid;border-radius:100%;border-color:#2778c4 transparent #2778c4 transparent}.swal2-styled{margin:.3125em;padding:.625em 1.1em;transition:box-shadow .1s;box-shadow:0 0 0 3px transparent;font-weight:500}.swal2-styled:not([disabled]){cursor:pointer}.swal2-styled.swal2-confirm{border:0;border-radius:.25em;background:initial;background-color:#7066e0;color:#fff;font-size:1em}.swal2-styled.swal2-confirm:focus{box-shadow:0 0 0 3px rgba(112,102,224,.5)}.swal2-styled.swal2-deny{border:0;border-radius:.25em;background:initial;background-color:#dc3741;color:#fff;font-size:1em}.swal2-styled.swal2-deny:focus{box-shadow:0 0 0 3px rgba(220,55,65,.5)}.swal2-styled.swal2-cancel{border:0;border-radius:.25em;background:initial;background-color:#6e7881;color:#fff;font-size:1em}.swal2-styled.swal2-cancel:focus{box-shadow:0 0 0 3px rgba(110,120,129,.5)}.swal2-styled.swal2-default-outline:focus{box-shadow:0 0 0 3px rgba(100,150,200,.5)}.swal2-styled:focus{outline:0}.swal2-styled::-moz-focus-inner{border:0}.swal2-footer{justify-content:center;margin:1em 0 0;padding:1em 1em 0;border-top:1px solid #eee;color:inherit;font-size:1em}.swal2-timer-progress-bar-container{position:absolute;right:0;bottom:0;left:0;grid-column:auto!important;overflow:hidden;border-bottom-right-radius:5px;border-bottom-left-radius:5px}.swal2-timer-progress-bar{width:100%;height:.25em;background:rgba(0,0,0,.2)}.swal2-image{max-width:100%;margin:2em auto 1em}.swal2-close{z-index:2;align-items:center;justify-content:center;width:1.2em;height:1.2em;margin-top:0;margin-right:0;margin-bottom:-1.2em;padding:0;overflow:hidden;transition:color .1s,box-shadow .1s;border:none;border-radius:5px;background:0 0;color:#ccc;font-family:serif;font-family:monospace;font-size:2.5em;cursor:pointer;justify-self:end}.swal2-close:hover{transform:none;background:0 0;color:#f27474}.swal2-close:focus{outline:0;box-shadow:inset 0 0 0 3px rgba(100,150,200,.5)}.swal2-close::-moz-focus-inner{border:0}.swal2-html-container{z-index:1;justify-content:center;margin:1em 1.6em .3em;padding:0;overflow:auto;color:inherit;font-size:1.125em;font-weight:400;line-height:normal;text-align:center;word-wrap:break-word;word-break:break-word}.swal2-checkbox,.swal2-file,.swal2-input,.swal2-radio,.swal2-select,.swal2-textarea{margin:1em 2em 3px}.swal2-file,.swal2-input,.swal2-textarea{box-sizing:border-box;width:auto;transition:border-color .1s,box-shadow .1s;border:1px solid #d9d9d9;border-radius:.1875em;background:0 0;box-shadow:inset 0 1px 1px rgba(0,0,0,.06),0 0 0 3px transparent;color:inherit;font-size:1.125em}.swal2-file.swal2-inputerror,.swal2-input.swal2-inputerror,.swal2-textarea.swal2-inputerror{border-color:#f27474!important;box-shadow:0 0 2px #f27474!important}.swal2-file:focus,.swal2-input:focus,.swal2-textarea:focus{border:1px solid #b4dbed;outline:0;box-shadow:inset 0 1px 1px rgba(0,0,0,.06),0 0 0 3px rgba(100,150,200,.5)}.swal2-file::-moz-placeholder,.swal2-input::-moz-placeholder,.swal2-textarea::-moz-placeholder{color:#ccc}.swal2-file::placeholder,.swal2-input::placeholder,.swal2-textarea::placeholder{color:#ccc}.swal2-range{margin:1em 2em 3px;background:#fff}.swal2-range input{width:80%}.swal2-range output{width:20%;color:inherit;font-weight:600;text-align:center}.swal2-range input,.swal2-range output{height:2.625em;padding:0;font-size:1.125em;line-height:2.625em}.swal2-input{height:2.625em;padding:0 .75em}.swal2-file{width:75%;margin-right:auto;margin-left:auto;background:0 0;font-size:1.125em}.swal2-textarea{height:6.75em;padding:.75em}.swal2-select{min-width:50%;max-width:100%;padding:.375em .625em;background:0 0;color:inherit;font-size:1.125em}.swal2-checkbox,.swal2-radio{align-items:center;justify-content:center;background:#fff;color:inherit}.swal2-checkbox label,.swal2-radio label{margin:0 .6em;font-size:1.125em}.swal2-checkbox input,.swal2-radio input{flex-shrink:0;margin:0 .4em}.swal2-input-label{display:flex;justify-content:center;margin:1em auto 0}.swal2-validation-message{align-items:center;justify-content:center;margin:1em 0 0;padding:.625em;overflow:hidden;background:#f0f0f0;color:#666;font-size:1em;font-weight:300}.swal2-validation-message::before{content:\"!\";display:inline-block;width:1.5em;min-width:1.5em;height:1.5em;margin:0 .625em;border-radius:50%;background-color:#f27474;color:#fff;font-weight:600;line-height:1.5em;text-align:center}.swal2-icon{position:relative;box-sizing:content-box;justify-content:center;width:5em;height:5em;margin:2.5em auto .6em;border:.25em solid transparent;border-radius:50%;border-color:#000;font-family:inherit;line-height:5em;cursor:default;-webkit-user-select:none;-moz-user-select:none;user-select:none}.swal2-icon .swal2-icon-content{display:flex;align-items:center;font-size:3.75em}.swal2-icon.swal2-error{border-color:#f27474;color:#f27474}.swal2-icon.swal2-error .swal2-x-mark{position:relative;flex-grow:1}.swal2-icon.swal2-error [class^=swal2-x-mark-line]{display:block;position:absolute;top:2.3125em;width:2.9375em;height:.3125em;border-radius:.125em;background-color:#f27474}.swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:1.0625em;transform:rotate(45deg)}.swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:1em;transform:rotate(-45deg)}.swal2-icon.swal2-error.swal2-icon-show{-webkit-animation:swal2-animate-error-icon .5s;animation:swal2-animate-error-icon .5s}.swal2-icon.swal2-error.swal2-icon-show .swal2-x-mark{-webkit-animation:swal2-animate-error-x-mark .5s;animation:swal2-animate-error-x-mark .5s}.swal2-icon.swal2-warning{border-color:#facea8;color:#f8bb86}.swal2-icon.swal2-warning.swal2-icon-show{-webkit-animation:swal2-animate-error-icon .5s;animation:swal2-animate-error-icon .5s}.swal2-icon.swal2-warning.swal2-icon-show .swal2-icon-content{-webkit-animation:swal2-animate-i-mark .5s;animation:swal2-animate-i-mark .5s}.swal2-icon.swal2-info{border-color:#9de0f6;color:#3fc3ee}.swal2-icon.swal2-info.swal2-icon-show{-webkit-animation:swal2-animate-error-icon .5s;animation:swal2-animate-error-icon .5s}.swal2-icon.swal2-info.swal2-icon-show .swal2-icon-content{-webkit-animation:swal2-animate-i-mark .8s;animation:swal2-animate-i-mark .8s}.swal2-icon.swal2-question{border-color:#c9dae1;color:#87adbd}.swal2-icon.swal2-question.swal2-icon-show{-webkit-animation:swal2-animate-error-icon .5s;animation:swal2-animate-error-icon .5s}.swal2-icon.swal2-question.swal2-icon-show .swal2-icon-content{-webkit-animation:swal2-animate-question-mark .8s;animation:swal2-animate-question-mark .8s}.swal2-icon.swal2-success{border-color:#a5dc86;color:#a5dc86}.swal2-icon.swal2-success [class^=swal2-success-circular-line]{position:absolute;width:3.75em;height:7.5em;transform:rotate(45deg);border-radius:50%}.swal2-icon.swal2-success [class^=swal2-success-circular-line][class$=left]{top:-.4375em;left:-2.0635em;transform:rotate(-45deg);transform-origin:3.75em 3.75em;border-radius:7.5em 0 0 7.5em}.swal2-icon.swal2-success [class^=swal2-success-circular-line][class$=right]{top:-.6875em;left:1.875em;transform:rotate(-45deg);transform-origin:0 3.75em;border-radius:0 7.5em 7.5em 0}.swal2-icon.swal2-success .swal2-success-ring{position:absolute;z-index:2;top:-.25em;left:-.25em;box-sizing:content-box;width:100%;height:100%;border:.25em solid rgba(165,220,134,.3);border-radius:50%}.swal2-icon.swal2-success .swal2-success-fix{position:absolute;z-index:1;top:.5em;left:1.625em;width:.4375em;height:5.625em;transform:rotate(-45deg)}.swal2-icon.swal2-success [class^=swal2-success-line]{display:block;position:absolute;z-index:2;height:.3125em;border-radius:.125em;background-color:#a5dc86}.swal2-icon.swal2-success [class^=swal2-success-line][class$=tip]{top:2.875em;left:.8125em;width:1.5625em;transform:rotate(45deg)}.swal2-icon.swal2-success [class^=swal2-success-line][class$=long]{top:2.375em;right:.5em;width:2.9375em;transform:rotate(-45deg)}.swal2-icon.swal2-success.swal2-icon-show .swal2-success-line-tip{-webkit-animation:swal2-animate-success-line-tip .75s;animation:swal2-animate-success-line-tip .75s}.swal2-icon.swal2-success.swal2-icon-show .swal2-success-line-long{-webkit-animation:swal2-animate-success-line-long .75s;animation:swal2-animate-success-line-long .75s}.swal2-icon.swal2-success.swal2-icon-show .swal2-success-circular-line-right{-webkit-animation:swal2-rotate-success-circular-line 4.25s ease-in;animation:swal2-rotate-success-circular-line 4.25s ease-in}.swal2-progress-steps{flex-wrap:wrap;align-items:center;max-width:100%;margin:1.25em auto;padding:0;background:0 0;font-weight:600}.swal2-progress-steps li{display:inline-block;position:relative}.swal2-progress-steps .swal2-progress-step{z-index:20;flex-shrink:0;width:2em;height:2em;border-radius:2em;background:#2778c4;color:#fff;line-height:2em;text-align:center}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step{background:#2778c4}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step{background:#add8e6;color:#fff}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step-line{background:#add8e6}.swal2-progress-steps .swal2-progress-step-line{z-index:10;flex-shrink:0;width:2.5em;height:.4em;margin:0 -1px;background:#2778c4}[class^=swal2]{-webkit-tap-highlight-color:transparent}.swal2-show{-webkit-animation:swal2-show .3s;animation:swal2-show .3s}.swal2-hide{-webkit-animation:swal2-hide .15s forwards;animation:swal2-hide .15s forwards}.swal2-noanimation{transition:none}.swal2-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}.swal2-rtl .swal2-close{margin-right:initial;margin-left:0}.swal2-rtl .swal2-timer-progress-bar{right:0;left:auto}.leave-russia-now-and-apply-your-skills-to-the-world{display:flex;position:fixed;z-index:1939;top:0;right:0;bottom:0;left:0;flex-direction:column;align-items:center;justify-content:center;padding:25px 0 20px;background:#20232a;color:#fff;text-align:center}.leave-russia-now-and-apply-your-skills-to-the-world div{max-width:560px;margin:10px;line-height:146%}.leave-russia-now-and-apply-your-skills-to-the-world iframe{max-width:100%;max-height:55.5555555556vmin;margin:16px auto}.leave-russia-now-and-apply-your-skills-to-the-world strong{border-bottom:2px dashed #fff}.leave-russia-now-and-apply-your-skills-to-the-world button{display:flex;position:fixed;z-index:1940;top:0;right:0;align-items:center;justify-content:center;width:48px;height:48px;margin-right:10px;margin-bottom:-10px;border:none;background:0 0;color:#aaa;font-size:48px;font-weight:700;cursor:pointer}.leave-russia-now-and-apply-your-skills-to-the-world button:hover{color:#fff}@-webkit-keyframes swal2-toast-show{0%{transform:translateY(-.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0)}}@keyframes swal2-toast-show{0%{transform:translateY(-.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0)}}@-webkit-keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@-webkit-keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@-webkit-keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}@keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}@-webkit-keyframes swal2-show{0%{transform:scale(.7)}45%{transform:scale(1.05)}80%{transform:scale(.95)}100%{transform:scale(1)}}@keyframes swal2-show{0%{transform:scale(.7)}45%{transform:scale(1.05)}80%{transform:scale(.95)}100%{transform:scale(1)}}@-webkit-keyframes swal2-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(.5);opacity:0}}@keyframes swal2-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(.5);opacity:0}}@-webkit-keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.8125em;width:1.5625em}}@keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.8125em;width:1.5625em}}@-webkit-keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@-webkit-keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@-webkit-keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(.4);opacity:0}50%{margin-top:1.625em;transform:scale(.4);opacity:0}80%{margin-top:-.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(.4);opacity:0}50%{margin-top:1.625em;transform:scale(.4);opacity:0}80%{margin-top:-.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@-webkit-keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0);opacity:1}}@keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0);opacity:1}}@-webkit-keyframes swal2-rotate-loading{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}@keyframes swal2-rotate-loading{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}@-webkit-keyframes swal2-animate-question-mark{0%{transform:rotateY(-360deg)}100%{transform:rotateY(0)}}@keyframes swal2-animate-question-mark{0%{transform:rotateY(-360deg)}100%{transform:rotateY(0)}}@-webkit-keyframes swal2-animate-i-mark{0%{transform:rotateZ(45deg);opacity:0}25%{transform:rotateZ(-25deg);opacity:.4}50%{transform:rotateZ(15deg);opacity:.8}75%{transform:rotateZ(-5deg);opacity:1}100%{transform:rotateX(0);opacity:1}}@keyframes swal2-animate-i-mark{0%{transform:rotateZ(45deg);opacity:0}25%{transform:rotateZ(-25deg);opacity:.4}50%{transform:rotateZ(15deg);opacity:.8}75%{transform:rotateZ(-5deg);opacity:1}100%{transform:rotateX(0);opacity:1}}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow:hidden}body.swal2-height-auto{height:auto!important}body.swal2-no-backdrop .swal2-container{background-color:transparent!important;pointer-events:none}body.swal2-no-backdrop .swal2-container .swal2-popup{pointer-events:all}body.swal2-no-backdrop .swal2-container .swal2-modal{box-shadow:0 0 10px rgba(0,0,0,.4)}@media print{body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow-y:scroll!important}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown)>[aria-hidden=true]{display:none}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown) .swal2-container{position:static!important}}body.swal2-toast-shown .swal2-container{box-sizing:border-box;width:360px;max-width:100%;background-color:transparent;pointer-events:none}body.swal2-toast-shown .swal2-container.swal2-top{top:0;right:auto;bottom:auto;left:50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-top-end,body.swal2-toast-shown .swal2-container.swal2-top-right{top:0;right:0;bottom:auto;left:auto}body.swal2-toast-shown .swal2-container.swal2-top-left,body.swal2-toast-shown .swal2-container.swal2-top-start{top:0;right:auto;bottom:auto;left:0}body.swal2-toast-shown .swal2-container.swal2-center-left,body.swal2-toast-shown .swal2-container.swal2-center-start{top:50%;right:auto;bottom:auto;left:0;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-center{top:50%;right:auto;bottom:auto;left:50%;transform:translate(-50%,-50%)}body.swal2-toast-shown .swal2-container.swal2-center-end,body.swal2-toast-shown .swal2-container.swal2-center-right{top:50%;right:0;bottom:auto;left:auto;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-left,body.swal2-toast-shown .swal2-container.swal2-bottom-start{top:auto;right:auto;bottom:0;left:0}body.swal2-toast-shown .swal2-container.swal2-bottom{top:auto;right:auto;bottom:0;left:50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-end,body.swal2-toast-shown .swal2-container.swal2-bottom-right{top:auto;right:0;bottom:0;left:auto}");`,
	"skin/xp/firebug.css": `
	/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
/* Loose */
/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
/*
.netInfoResponseHeadersTitle, netInfoResponseHeadersBody {
    display: none;
}
/**/

.obscured {
    left: -999999px !important;
}

/* IE6 need a separated rule, otherwise it will not recognize it */
.collapsed {
    display: none;
}

[collapsed="true"] {
    display: none;
}

#fbCSS {
    padding: 0 !important;
}

.cssPropDisable {
    float: left;
    display: block;
    width: 2em;
    cursor: default;
}

/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
/* panelBase */
/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/

/************************************************************************************************/

.infoTip {
    z-index: 2147483647;
    position: fixed;
    padding: 2px 3px;
    border: 1px solid #CBE087;
    background: LightYellow;
    font-family: Monaco, monospace;
    color: #000000;
    display: none;
    white-space: nowrap;
    pointer-events: none;
}

.infoTip[active="true"] {
    display: block;
}

.infoTipLoading {
    width: 16px;
    height: 16px;
    background: url(chrome://firebug/skin/loading_16.gif) no-repeat;
}

.infoTipImageBox {
	font-size: 11px;
    min-width: 100px;
    text-align: center;
}

.infoTipCaption {
	font-size: 11px;
    font: Monaco, monospace;
}

.infoTipLoading > .infoTipImage,
.infoTipLoading > .infoTipCaption {
    display: none;
}

/************************************************************************************************/

h1.groupHeader {
    padding: 2px 4px;
    margin: 0 0 4px 0;
    border-top: 1px solid #CCCCCC;
    border-bottom: 1px solid #CCCCCC;
    background: #eee url(group.gif) repeat-x;
    font-size: 11px;
    font-weight: bold;
    _position: relative;
}

/************************************************************************************************/

.inlineEditor,
.fixedWidthEditor {
    z-index: 2147483647;
    position: absolute;
    display: none;
}

.inlineEditor {
    margin-left: -6px;
    margin-top: -3px;
    /*
    _margin-left: -7px;
    _margin-top: -5px;
    /**/
}

.textEditorInner,
.fixedWidthEditor {
    margin: 0 0 0 0 !important;
    padding: 0;
    border: none !important;
    font: inherit;
    text-decoration: inherit;
    background-color: #FFFFFF;
}

.fixedWidthEditor {
    border-top: 1px solid #888888 !important;
    border-bottom: 1px solid #888888 !important;
}

.textEditorInner {
    position: relative;
    top: -7px;
    left: -5px;
    
    outline: none;
    resize: none;
    
    /*
    _border: 1px solid #999 !important;
    _padding: 1px !important;
    _filter:progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color="#55404040");
    /**/
}

.textEditorInner1 {
    padding-left: 11px;
    background: url(textEditorBorders.png) repeat-y;
    _background: url(textEditorBorders.gif) repeat-y;
    _overflow: hidden;
}

.textEditorInner2 {
    position: relative;
    padding-right: 2px;
    background: url(textEditorBorders.png) repeat-y 100% 0;
    _background: url(textEditorBorders.gif) repeat-y 100% 0;
    _position: fixed;
}

.textEditorTop1 {
    background: url(textEditorCorners.png) no-repeat 100% 0;
    margin-left: 11px;
    height: 10px;
    _background: url(textEditorCorners.gif) no-repeat 100% 0;
    _overflow: hidden;
}

.textEditorTop2 {
    position: relative;
    left: -11px;
    width: 11px;
    height: 10px;
    background: url(textEditorCorners.png) no-repeat;
    _background: url(textEditorCorners.gif) no-repeat;
}

.textEditorBottom1 {
    position: relative;
    background: url(textEditorCorners.png) no-repeat 100% 100%;
    margin-left: 11px;
    height: 12px;
    _background: url(textEditorCorners.gif) no-repeat 100% 100%;
}

.textEditorBottom2 {
    position: relative;
    left: -11px;
    width: 11px;
    height: 12px;
    background: url(textEditorCorners.png) no-repeat 0 100%;
    _background: url(textEditorCorners.gif) no-repeat 0 100%;
}


/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
/* CSS */
/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/

/* See license.txt for terms of usage */

.panelNode-css {
    overflow-x: hidden;
}

.cssSheet > .insertBefore {
    height: 1.5em;
}

.cssRule {
    position: relative;
    margin: 0;
    padding: 1em 0 0 6px;
    font-family: Monaco, monospace;
    color: #000000;
}

.cssRule:first-child {
    padding-top: 6px;
}

.cssElementRuleContainer {
    position: relative;
}

.cssHead {
    padding-right: 150px;
}

.cssProp {
    /*padding-left: 2em;*/
}

.cssPropName {
    color: DarkGreen;
}

.cssPropValue {
    margin-left: 8px;
    color: DarkBlue;
}

.cssOverridden span {
    text-decoration: line-through;
}

.cssInheritedRule {
}

.cssInheritLabel {
    margin-right: 0.5em;
    font-weight: bold;
}

.cssRule .objectLink-sourceLink {
    top: 0;
}

.cssProp.editGroup:hover {
    background: url(disable.png) no-repeat 2px 1px;
    _background: url(disable.gif) no-repeat 2px 1px;
}

.cssProp.editGroup.editing {
    background: none;
}

.cssProp.disabledStyle {
    background: url(disableHover.png) no-repeat 2px 1px;
    _background: url(disableHover.gif) no-repeat 2px 1px;
    opacity: 1;
    color: #CCCCCC;
}

.disabledStyle .cssPropName,
.disabledStyle .cssPropValue {
    color: #CCCCCC;
}

.cssPropValue.editing + .cssSemi,
.inlineExpander + .cssSemi {
    display: none;
}

.cssPropValue.editing {
    white-space: nowrap;
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

.stylePropName {
    font-weight: bold;
    padding: 0 4px 4px 4px;
    width: 50%;
}

.stylePropValue {
    width: 50%;
}
/*
.useA11y .a11yCSSView .focusRow:focus {
    outline: none;
    background-color: transparent
 }
 
 .useA11y .a11yCSSView .focusRow:focus .cssSelector, 
 .useA11y .a11yCSSView .focusRow:focus .cssPropName, 
 .useA11y .a11yCSSView .focusRow:focus .cssPropValue,
 .useA11y .a11yCSSView .computedStyleRow:focus, 
 .useA11y .a11yCSSView .groupHeader:focus {
    outline: 2px solid #FF9933;
    outline-offset: -2px;
    background-color: #FFFFD6;
 }
 
 .useA11y .a11yCSSView .groupHeader:focus {
    outline-offset: -2px;
 }
/**/


/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
/* Net */
/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/

/* See license.txt for terms of usage */

.panelNode-net {
    overflow-x: hidden;
}

.netTable {
    width: 100%;
}

/************************************************************************************************/

.hideCategory-undefined .category-undefined,
.hideCategory-html .category-html,
.hideCategory-css .category-css,
.hideCategory-js .category-js,
.hideCategory-image .category-image,
.hideCategory-xhr .category-xhr,
.hideCategory-flash .category-flash,
.hideCategory-txt .category-txt,
.hideCategory-bin .category-bin {
    display: none;
}

/************************************************************************************************/

.netHeadRow {
    background: url(chrome://firebug/skin/group.gif) repeat-x #FFFFFF;
}

.netHeadCol {
    border-bottom: 1px solid #CCCCCC;
    padding: 2px 4px 2px 18px;
    font-weight: bold;
}

.netHeadLabel {
    white-space: nowrap;
    overflow: hidden;
}

/************************************************************************************************/
/* Header for Net panel table */

.netHeaderRow {
    height: 16px;
}

.netHeaderCell {
    cursor: pointer;
    -moz-user-select: none;
    border-bottom: 1px solid #9C9C9C;
    padding: 0 !important;
    font-weight: bold;
    background: #BBBBBB url(chrome://firebug/skin/tableHeader.gif) repeat-x;
    white-space: nowrap;
}

.netHeaderRow > .netHeaderCell:first-child > .netHeaderCellBox {
    padding: 2px 14px 2px 18px;
}

.netHeaderCellBox {
    padding: 2px 14px 2px 10px;
    border-left: 1px solid #D9D9D9;
    border-right: 1px solid #9C9C9C;
}

.netHeaderCell:hover:active {
    background: #959595 url(chrome://firebug/skin/tableHeaderActive.gif) repeat-x;
}

.netHeaderSorted {
    background: #7D93B2 url(chrome://firebug/skin/tableHeaderSorted.gif) repeat-x;
}

.netHeaderSorted > .netHeaderCellBox {
    border-right-color: #6B7C93;
    background: url(chrome://firebug/skin/arrowDown.png) no-repeat right;
}

.netHeaderSorted.sortedAscending > .netHeaderCellBox {
    background-image: url(chrome://firebug/skin/arrowUp.png);
}

.netHeaderSorted:hover:active {
    background: #536B90 url(chrome://firebug/skin/tableHeaderSortedActive.gif) repeat-x;
}

/************************************************************************************************/
/* Breakpoints */

.panelNode-net .netRowHeader {
    display: block;
}

.netRowHeader {
    cursor: pointer;
    display: none;
    height: 15px;
    margin-right: 0 !important;
}

/* Display brekpoint disc */
.netRow .netRowHeader {
    background-position: 5px 1px;
}

.netRow[breakpoint="true"] .netRowHeader {
    background-image: url(chrome://firebug/skin/breakpoint.png);
}

.netRow[breakpoint="true"][disabledBreakpoint="true"] .netRowHeader {
    background-image: url(chrome://firebug/skin/breakpointDisabled.png);
}

.netRow.category-xhr:hover .netRowHeader {
    background-color: #F6F6F6;
}

#netBreakpointBar {
    max-width: 38px;
}

#netHrefCol > .netHeaderCellBox {
    border-left: 0px;
}

.netRow .netRowHeader {
    width: 3px;
}

.netInfoRow .netRowHeader {
    display: table-cell;
}

/************************************************************************************************/
/* Column visibility */

.netTable[hiddenCols~=netHrefCol] TD[id="netHrefCol"],
.netTable[hiddenCols~=netHrefCol] TD.netHrefCol,
.netTable[hiddenCols~=netStatusCol] TD[id="netStatusCol"],
.netTable[hiddenCols~=netStatusCol] TD.netStatusCol,
.netTable[hiddenCols~=netDomainCol] TD[id="netDomainCol"],
.netTable[hiddenCols~=netDomainCol] TD.netDomainCol,
.netTable[hiddenCols~=netSizeCol] TD[id="netSizeCol"],
.netTable[hiddenCols~=netSizeCol] TD.netSizeCol,
.netTable[hiddenCols~=netTimeCol] TD[id="netTimeCol"],
.netTable[hiddenCols~=netTimeCol] TD.netTimeCol {
    display: none;
}

/************************************************************************************************/

.netRow {
    background: LightYellow;
}

.netRow.loaded {
    background: #FFFFFF;
}

.netRow.loaded:hover {
    background: #EFEFEF;
}

.netCol {
    padding: 0;
    vertical-align: top;
    border-bottom: 1px solid #EFEFEF;
    white-space: nowrap;
    height: 17px;
}

.netLabel {
    width: 100%;
}

.netStatusCol {
    padding-left: 10px;
    color: rgb(128, 128, 128);
}

.responseError > .netStatusCol {
    color: red;
}

.netDomainCol {
    padding-left: 5px;
}

.netSizeCol {
    text-align: right;
    padding-right: 10px;
}

.netHrefLabel {
    -moz-box-sizing: padding-box;
    overflow: hidden;
    z-index: 10;
    position: absolute;
    padding-left: 18px;
    padding-top: 1px;
    max-width: 15%;
    font-weight: bold;
}

.netFullHrefLabel {
    display: none;
    -moz-user-select: none;
    padding-right: 10px;
    padding-bottom: 3px;
    max-width: 100%;
    background: #FFFFFF;
    z-index: 200;
}

.netHrefCol:hover > .netFullHrefLabel {
    display: block;
}

.netRow.loaded:hover .netCol > .netFullHrefLabel {
    background-color: #EFEFEF;
}

.useA11y .a11yShowFullLabel {
    display: block;
    background-image: none !important;
    border: 1px solid #CBE087;
    background-color: LightYellow;
    font-family: Monaco, monospace;
    color: #000000;
    font-size: 10px;
    z-index: 2147483647;
}

.netSizeLabel {
    padding-left: 6px;
}

.netStatusLabel,
.netDomainLabel,
.netSizeLabel,
.netBar {
    padding: 1px 0 2px 0 !important;
}

.responseError {
    color: red;
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

.hasHeaders .netHrefLabel:hover {
    cursor: pointer;
    color: blue;
    text-decoration: underline;
}

/************************************************************************************************/

.netLoadingIcon {
    position: absolute;
    border: 0;
    margin-left: 14px;
    width: 16px;
    height: 16px;
    background: transparent no-repeat 0 0;
    background-image: url(chrome://firebug/skin/loading_16.gif);
    display:inline-block;
}

.loaded .netLoadingIcon {
    display: none;
}

/************************************************************************************************/

.netBar, .netSummaryBar {
    position: relative;
    border-right: 50px solid transparent;
}

.netResolvingBar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: #FFFFFF url(chrome://firebug/skin/netBarResolving.gif) repeat-x;
    z-index:60;
}

.netConnectingBar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: #FFFFFF url(chrome://firebug/skin/netBarConnecting.gif) repeat-x;
    z-index:50;
}

.netBlockingBar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: #FFFFFF url(chrome://firebug/skin/netBarWaiting.gif) repeat-x;
    z-index:40;
}

.netSendingBar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: #FFFFFF url(chrome://firebug/skin/netBarSending.gif) repeat-x;
    z-index:30;
}

.netWaitingBar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: #FFFFFF url(chrome://firebug/skin/netBarResponded.gif) repeat-x;
    z-index:20;
    min-width: 1px;
}

.netReceivingBar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: #38D63B url(chrome://firebug/skin/netBarLoading.gif) repeat-x;
    z-index:10;
}

.netWindowLoadBar,
.netContentLoadBar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 1px;
    background-color: red;
    z-index: 70;
    opacity: 0.5;
    display: none;
    margin-bottom:-1px;
}

.netContentLoadBar {
    background-color: Blue;
}

.netTimeLabel {
    -moz-box-sizing: padding-box;
    position: absolute;
    top: 1px;
    left: 100%;
    padding-left: 6px;
    color: #444444;
    min-width: 16px;
}

/*
 * Timing info tip is reusing net timeline styles to display the same
 * colors for individual request phases. Notice that the info tip must
 * respect also loaded and fromCache styles that also modify the
 * actual color. These are used both on the same element in case
 * of the tooltip.
 */
.loaded .netReceivingBar,
.loaded.netReceivingBar {
    background: #B6B6B6 url(chrome://firebug/skin/netBarLoaded.gif) repeat-x;
    border-color: #B6B6B6;
}

.fromCache .netReceivingBar,
.fromCache.netReceivingBar {
    background: #D6D6D6 url(chrome://firebug/skin/netBarCached.gif) repeat-x;
    border-color: #D6D6D6;
}

.netSummaryRow .netTimeLabel,
.loaded .netTimeLabel {
    background: transparent;
}

/************************************************************************************************/
/* Time Info tip */

.timeInfoTip {
    width: 150px; 
    height: 40px
}

.timeInfoTipBar,
.timeInfoTipEventBar {
    position: relative;
    display: block;
    margin: 0;
    opacity: 1;
    height: 15px;
    width: 4px;
}

.timeInfoTipEventBar {
    width: 1px !important;
}

.timeInfoTipCell.startTime {
    padding-right: 8px;
}

.timeInfoTipCell.elapsedTime {
    text-align: right;
    padding-right: 8px;
}

/************************************************************************************************/
/* Size Info tip */

.sizeInfoLabelCol {
    font-weight: bold;
    padding-right: 10px;
    font-family: Lucida Grande, Tahoma, sans-serif;
    font-size: 11px;
}

.sizeInfoSizeCol {
    font-weight: bold;
}

.sizeInfoDetailCol {
    color: gray;
    text-align: right;
}

.sizeInfoDescCol {
    font-style: italic;
}

/************************************************************************************************/
/* Summary */

.netSummaryRow .netReceivingBar {
    background: #BBBBBB;
    border: none;
}

.netSummaryLabel {
    color: #222222;
}

.netSummaryRow {
    background: #BBBBBB !important;
    font-weight: bold;
}

.netSummaryRow .netBar {
    border-right-color: #BBBBBB;
}

.netSummaryRow > .netCol {
    border-top: 1px solid #999999;
    border-bottom: 2px solid;
    -moz-border-bottom-colors: #EFEFEF #999999;
    padding-top: 1px;
    padding-bottom: 2px;
}

.netSummaryRow > .netHrefCol:hover {
    background: transparent !important;
}

.netCountLabel {
    padding-left: 18px;
}

.netTotalSizeCol {
    text-align: right;
    padding-right: 10px;
}

.netTotalTimeCol {
    text-align: right;
}

.netCacheSizeLabel {
    position: absolute;
    z-index: 1000;
    left: 0;
    top: 0;
}

/************************************************************************************************/

.netLimitRow {
    background: rgb(255, 255, 225) !important;
    font-weight:normal;
    color: black;
    font-weight:normal;
}

.netLimitLabel {
    padding-left: 18px;
}

.netLimitRow > .netCol {
    border-bottom: 2px solid;
    -moz-border-bottom-colors: #EFEFEF #999999;
    vertical-align: middle !important;
    padding-top: 2px;
    padding-bottom: 2px;
}

.netLimitButton {
    font-size: 11px;
    padding-top: 1px;
    padding-bottom: 1px;
}

/************************************************************************************************/

.netInfoCol {
    border-top: 1px solid #EEEEEE;
    background: url(chrome://firebug/skin/group.gif) repeat-x #FFFFFF;
}

.netInfoBody {
    margin: 10px 0 4px 10px;
}

.netInfoTabs {
    position: relative;
    padding-left: 17px;
}

.netInfoTab {
    position: relative;
    top: -3px;
    margin-top: 10px;
    padding: 4px 6px;
    border: 1px solid transparent;
    border-bottom: none;
    _border: none;
    font-weight: bold;
    color: #565656;
    cursor: pointer;
}

/*.netInfoTab:hover {
    cursor: pointer;
}*/

/* replaced by .netInfoTabSelected for IE6 support
.netInfoTab[selected="true"] {
    cursor: default !important;
    border: 1px solid #D7D7D7 !important;
    border-bottom: none !important;
    -moz-border-radius: 4px 4px 0 0;
    background-color: #FFFFFF;
}
/**/
.netInfoTabSelected {
    cursor: default !important;
    border: 1px solid #D7D7D7 !important;
    border-bottom: none !important;
    -moz-border-radius: 4px 4px 0 0;
    -webkit-border-radius: 4px 4px 0 0;
    border-radius: 4px 4px 0 0;
    background-color: #FFFFFF;
}

.logRow-netInfo.error .netInfoTitle {
    color: red;
}

.logRow-netInfo.loading .netInfoResponseText {
    font-style: italic;
    color: #888888;
}

.loading .netInfoResponseHeadersTitle {
    display: none;
}

.netInfoResponseSizeLimit {
    font-family: Lucida Grande, Tahoma, sans-serif;
    padding-top: 10px;
    font-size: 11px;
}

.netInfoText {
    display: none;
    margin: 0;
    border: 1px solid #D7D7D7;
    border-right: none;
    padding: 8px;
    background-color: #FFFFFF;
    font-family: Monaco, monospace;
    white-space: pre-wrap;
    /*overflow-x: auto; HTML is damaged in case of big (2-3MB) responses */
}

/* replaced by .netInfoTextSelected for IE6 support 
.netInfoText[selected="true"] {
    display: block;
}
/**/
.netInfoTextSelected {
    display: block;
}

.netInfoParamName {
    padding-right: 10px;
    font-family: Lucida Grande, Tahoma, sans-serif;
    font-weight: bold;
    vertical-align: top;
    text-align: right;
    white-space: nowrap;
}

.netInfoPostText .netInfoParamName {
    width: 1px; /* Google Chrome need this otherwise the first column of 
                   the post variables table will be larger than expected */
}

.netInfoParamValue {
    width: 100%;
}

.netInfoHeadersText,
.netInfoPostText,
.netInfoPutText {
    padding-top: 0;
}

.netInfoHeadersGroup,
.netInfoPostParams,
.netInfoPostSource {
    margin-bottom: 4px;
    border-bottom: 1px solid #D7D7D7;
    padding-top: 8px;
    padding-bottom: 2px;
    font-family: Lucida Grande, Tahoma, sans-serif;
    font-weight: bold;
    color: #565656;
}

.netInfoPostParamsTable,
.netInfoPostPartsTable,
.netInfoPostJSONTable,
.netInfoPostXMLTable,
.netInfoPostSourceTable {
    margin-bottom: 10px;
    width: 100%;
}

.netInfoPostContentType {
    color: #bdbdbd;
    padding-left: 50px;
    font-weight: normal;
}

.netInfoHtmlPreview {
    border: 0;
    width: 100%;
    height:100%;
}

/************************************************************************************************/
/* Request & Response Headers */

.netHeadersViewSource {
    color: #bdbdbd;
    margin-left: 200px;
    font-weight: normal;
}

.netHeadersViewSource:hover {
    color: blue;
    cursor: pointer;
}

/************************************************************************************************/

.netActivationRow,
.netPageSeparatorRow {
    background: rgb(229, 229, 229) !important;
    font-weight: normal;
    color: black;
}

.netActivationLabel {
    background: url(chrome://firebug/skin/infoIcon.png) no-repeat 3px 2px;
    padding-left: 22px;
}

/************************************************************************************************/

.netPageSeparatorRow {
    height: 5px !important;
}

.netPageSeparatorLabel {
    padding-left: 22px;
    height: 5px !important;
}

.netPageRow {
    background-color: rgb(255, 255, 255);
}

.netPageRow:hover {
    background: #EFEFEF;
}

.netPageLabel {
    padding: 1px 0 2px 18px !important;
    font-weight: bold;
}

/************************************************************************************************/

.netActivationRow > .netCol {
    border-bottom: 2px solid;
    -moz-border-bottom-colors: #EFEFEF #999999;
    padding-top: 2px;
    padding-bottom: 3px;
}
/*
.useA11y .panelNode-net .a11yFocus:focus,
.useA11y .panelNode-net .focusRow:focus {
    outline-offset: -2px;
    background-color: #FFFFD6 !important;
}

.useA11y .panelNode-net .netHeaderCell:focus,
.useA11y .panelNode-net :focus .netHeaderCell,
.useA11y .panelNode-net :focus .netReceivingBar,
.useA11y .netSummaryRow :focus .netBar,
.useA11y .netSummaryRow:focus .netBar {
    background-color: #FFFFD6;
    background-image: none;
    border-color: #FFFFD6;
}
/**/

/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
/* Windows */
/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/


/************************************************************************************************/
/* Twisties */

.twisty,
.logRow-errorMessage > .hasTwisty > .errorTitle,
.logRow-log > .objectBox-array.hasTwisty,
.logRow-spy .spyHead .spyTitle,
.logGroup > .logRow,
.memberRow.hasChildren > .memberLabelCell > .memberLabel,
.hasHeaders .netHrefLabel,
.netPageRow > .netCol > .netPageTitle {
    background-image: url(tree_open.gif);
    background-repeat: no-repeat;
    background-position: 2px 2px;
    min-height: 12px;
}

.logRow-errorMessage > .hasTwisty.opened > .errorTitle,
.logRow-log > .objectBox-array.hasTwisty.opened,
.logRow-spy.opened .spyHead .spyTitle,
.logGroup.opened > .logRow,
.memberRow.hasChildren.opened > .memberLabelCell > .memberLabel,
.nodeBox.highlightOpen > .nodeLabel > .twisty,
.nodeBox.open > .nodeLabel > .twisty,
.netRow.opened > .netCol > .netHrefLabel,
.netPageRow.opened > .netCol > .netPageTitle {
    background-image: url(tree_close.gif);
}

.twisty {
    background-position: 4px 4px;
}



/************************************************************************************************/
/* Twisties IE6 */

/* IE6 has problems with > operator, and multiple classes */

* html .logRow-spy .spyHead .spyTitle,
* html .logGroup .logGroupLabel,
* html .hasChildren .memberLabelCell .memberLabel,
* html .hasHeaders .netHrefLabel {
    background-image: url(tree_open.gif);
    background-repeat: no-repeat;
    background-position: 2px 2px;
}

* html .opened .spyHead .spyTitle,
* html .opened .logGroupLabel, 
* html .opened .memberLabelCell .memberLabel {
    background-image: url(tree_close.gif);
    background-repeat: no-repeat;
    background-position: 2px 2px;
}



/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
/* Console */
/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/


/* See license.txt for terms of usage */

.panelNode-console {
    overflow-x: hidden;
}

.objectLink {
    text-decoration: none;
}

.objectLink:hover {
    cursor: pointer;
    text-decoration: underline;
}

.logRow {
    position: relative;
    margin: 0;
    border-bottom: 1px solid #D7D7D7;
    padding: 2px 4px 1px 6px;
    background-color: #FFFFFF;
    overflow: hidden !important; /* IE need this to avoid disappearing bug with collapsed logs */
}

.useA11y .logRow:focus {
    border-bottom: 1px solid #000000 !important;
    outline: none !important;
    background-color: #FFFFAD !important;
}

.useA11y .logRow:focus a.objectLink-sourceLink {
    background-color: #FFFFAD;
}

.useA11y .a11yFocus:focus, .useA11y .objectBox:focus {
    outline: 2px solid #FF9933;
    background-color: #FFFFAD;
}

.useA11y .objectBox-null:focus, .useA11y .objectBox-undefined:focus{
    background-color: #888888 !important;
}

.useA11y .logGroup.opened > .logRow {
    border-bottom: 1px solid #ffffff;
}

.logGroup {
    background: url(group.gif) repeat-x #FFFFFF;
    padding: 0 !important;
    border: none !important;
}

.logGroupBody {
    display: none;
    margin-left: 16px;
    border-left: 1px solid #D7D7D7;
    border-top: 1px solid #D7D7D7;
    background: #FFFFFF;
}

.logGroup > .logRow {
    background-color: transparent !important;
    font-weight: bold;
}

.logGroup.opened > .logRow {
    border-bottom: none;
}

.logGroup.opened > .logGroupBody {
    display: block;
}

/*****************************************************************************************/

.logRow-command > .objectBox-text {
    font-family: Monaco, monospace;
    color: #0000FF;
    white-space: pre-wrap;
}

.logRow-info,
.logRow-warn,
.logRow-error,
.logRow-assert,
.logRow-warningMessage,
.logRow-errorMessage {
    padding-left: 22px;
    background-repeat: no-repeat;
    background-position: 4px 2px;
}

.logRow-assert,
.logRow-warningMessage,
.logRow-errorMessage {
    padding-top: 0;
    padding-bottom: 0;
}

.logRow-info,
.logRow-info .objectLink-sourceLink {
    background-color: #FFFFFF;
}

.logRow-warn,
.logRow-warningMessage,
.logRow-warn .objectLink-sourceLink,
.logRow-warningMessage .objectLink-sourceLink {
    background-color: cyan;
}

.logRow-error,
.logRow-assert,
.logRow-errorMessage,
.logRow-error .objectLink-sourceLink,
.logRow-errorMessage .objectLink-sourceLink {
    background-color: LightYellow;
}

.logRow-error,
.logRow-assert,
.logRow-errorMessage {
    color: #FF0000;
}

.logRow-info {
    /*background-image: url(chrome://firebug/skin/infoIcon.png);*/
}

.logRow-warn,
.logRow-warningMessage {
    /*background-image: url(chrome://firebug/skin/warningIcon.png);*/
}

.logRow-error,
.logRow-assert,
.logRow-errorMessage {
    /*background-image: url(chrome://firebug/skin/errorIcon.png);*/
}

/*****************************************************************************************/

.objectBox-string,
.objectBox-text,
.objectBox-number,
.objectLink-element,
.objectLink-textNode,
.objectLink-function,
.objectBox-stackTrace,
.objectLink-profile {
    font-family: Monaco, monospace;
}

.objectBox-string,
.objectBox-text,
.objectLink-textNode {
    white-space: pre-wrap;
}

.objectBox-number,
.objectLink-styleRule,
.objectLink-element,
.objectLink-textNode {
    color: #000088;
}

.objectBox-string {
    color: #FF0000;
}

.objectLink-function,
.objectBox-stackTrace,
.objectLink-profile  {
    color: DarkGreen;
}

.objectBox-null,
.objectBox-undefined {
    padding: 0 2px;
    border: 1px solid #666666;
    background-color: #888888;
    color: #FFFFFF;
}

.objectBox-exception {
    padding: 0 2px 0 18px;
    /*background: url(chrome://firebug/skin/errorIcon-sm.png) no-repeat 0 0;*/
    color: red;
}

.objectLink-sourceLink {
    position: absolute;
    right: 4px;
    top: 2px;
    padding-left: 8px;
    font-family: Lucida Grande, sans-serif;
    font-weight: bold;
    color: #0000FF;
}

/************************************************************************************************/

.errorTitle {
    margin-top: 0px;
    margin-bottom: 1px;
    padding-top: 2px;
    padding-bottom: 2px;
}

.errorTrace {
    margin-left: 17px;
}

.errorSourceBox {
    margin: 2px 0;
}

.errorSource-none {
    display: none;
}

.errorSource-syntax > .errorBreak {
    visibility: hidden;
}

.errorSource {
    cursor: pointer;
    font-family: Monaco, monospace;
    color: DarkGreen;
}

.errorSource:hover {
    text-decoration: underline;
}

.errorBreak {
    cursor: pointer;
    display: none;
    margin: 0 6px 0 0;
    width: 13px;
    height: 14px;
    vertical-align: bottom;
    /*background: url(chrome://firebug/skin/breakpoint.png) no-repeat;*/
    opacity: 0.1;
}

.hasBreakSwitch .errorBreak {
    display: inline;
}

.breakForError .errorBreak {
    opacity: 1;
}

.assertDescription {
    margin: 0;
}

/************************************************************************************************/

.logRow-profile > .logRow > .objectBox-text {
    font-family: Lucida Grande, Tahoma, sans-serif;
    color: #000000;
}

.logRow-profile > .logRow > .objectBox-text:last-child {
    color: #555555;
    font-style: italic;
}

.logRow-profile.opened > .logRow {
    padding-bottom: 4px;
}

.profilerRunning > .logRow {
    /*background: transparent url(chrome://firebug/skin/loading_16.gif) no-repeat 2px 0 !important;*/
    padding-left: 22px !important;
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

.profileSizer {
    width:100%;
    overflow-x:auto;
    overflow-y: scroll;
}

.profileTable {
    border-bottom: 1px solid #D7D7D7;
    padding: 0 0 4px 0;
}

.profileTable tr[odd="1"] {
    background-color: #F5F5F5;
    vertical-align:middle;
}

.profileTable a {
    vertical-align:middle;
}

.profileTable td {
    padding: 1px 4px 0 4px;
}

.headerCell {
    cursor: pointer;
    -moz-user-select: none;
    border-bottom: 1px solid #9C9C9C;
    padding: 0 !important;
    font-weight: bold;
    /*background: #BBBBBB url(chrome://firebug/skin/tableHeader.gif) repeat-x;*/
}

.headerCellBox {
    padding: 2px 4px;
    border-left: 1px solid #D9D9D9;
    border-right: 1px solid #9C9C9C;
}

.headerCell:hover:active {
    /*background: #959595 url(chrome://firebug/skin/tableHeaderActive.gif) repeat-x;*/
}

.headerSorted {
    /*background: #7D93B2 url(chrome://firebug/skin/tableHeaderSorted.gif) repeat-x;*/
}

.headerSorted > .headerCellBox {
    border-right-color: #6B7C93;
    /*background: url(chrome://firebug/skin/arrowDown.png) no-repeat right;*/
}

.headerSorted.sortedAscending > .headerCellBox {
    /*background-image: url(chrome://firebug/skin/arrowUp.png);*/
}

.headerSorted:hover:active {
    /*background: #536B90 url(chrome://firebug/skin/tableHeaderSortedActive.gif) repeat-x;*/
}

.linkCell {
    text-align: right;
}

.linkCell > .objectLink-sourceLink {
    position: static;
}

/*****************************************************************************************/

.logRow-stackTrace {
    padding-top: 0;
    background: #f8f8f8;
}

.logRow-stackTrace > .objectBox-stackFrame {
    position: relative;
    padding-top: 2px;
}

/************************************************************************************************/

.objectLink-object {
    font-family: Lucida Grande, sans-serif;
    font-weight: bold;
    color: DarkGreen;
    white-space: pre-wrap;
}

/* xxxpedro reps object representation .................................... */
.objectProp-object {
    color: DarkGreen;
}

.objectProps {
    color: #000;
    font-weight: normal;
}

.objectPropName {
    /*font-style: italic;*/
    color: #777;
}

/*
.objectProps .objectProp-string,
.objectProps .objectProp-number,
.objectProps .objectProp-object
{
    font-style: italic;
}
/**/

.objectProps .objectProp-string
{
    /*font-family: Monaco, monospace;*/
    color: #f55;
}
.objectProps .objectProp-number
{
    /*font-family: Monaco, monospace;*/
    color: #55a;
}
.objectProps .objectProp-object
{
    /*font-family: Lucida Grande,sans-serif;*/
    color: #585;
}
/* xxxpedro reps object representation .................................... */

/************************************************************************************************/

.selectorTag,
.selectorId,
.selectorClass {
    font-family: Monaco, monospace;
    font-weight: normal;
}

.selectorTag {
    color: #0000FF;
}

.selectorId {
    color: DarkBlue;
}

.selectorClass {
    color: red;
}

.selectorHidden > .selectorTag {
    color: #5F82D9;
}

.selectorHidden > .selectorId {
    color: #888888;
}

.selectorHidden > .selectorClass {
    color: #D86060;
}

.selectorValue {
    font-family: Lucida Grande, sans-serif;
    font-style: italic;
    color: #555555;
}

/*****************************************************************************************/

.panelNode.searching .logRow {
    display: none;
}

.logRow.matched {
    display: block !important;
}

.logRow.matching {
    position: absolute;
    left: -1000px;
    top: -1000px;
    max-width: 0;
    max-height: 0;
    overflow: hidden;
}

/*****************************************************************************************/

.objectLeftBrace,
.objectRightBrace,
.objectEqual,
.objectComma,
.arrayLeftBracket,
.arrayRightBracket,
.arrayComma {
    font-family: Monaco, monospace;
}

.objectLeftBrace,
.objectRightBrace,
.arrayLeftBracket,
.arrayRightBracket {
    font-weight: bold;
}

.objectLeftBrace,
.arrayLeftBracket {
    margin-right: 4px;
}

.objectRightBrace,
.arrayRightBracket {
    margin-left: 4px;
}

/*****************************************************************************************/

.logRow-dir {
    padding: 0;
}

/************************************************************************************************/

/*
.logRow-errorMessage > .hasTwisty > .errorTitle,
.logRow-spy .spyHead .spyTitle,
.logGroup > .logRow 
*/
.logRow-errorMessage .hasTwisty .errorTitle,
.logRow-spy .spyHead .spyTitle,
.logGroup .logRow {
    cursor: pointer;
    padding-left: 18px;
    background-repeat: no-repeat;
    background-position: 3px 3px;
}

.logRow-errorMessage > .hasTwisty > .errorTitle {
    background-position: 2px 3px;
}

.logRow-errorMessage > .hasTwisty > .errorTitle:hover,
.logRow-spy .spyHead .spyTitle:hover,
.logGroup > .logRow:hover {
    text-decoration: underline;
}

/*****************************************************************************************/

.logRow-spy {
    padding: 0 !important;
}

.logRow-spy,
.logRow-spy .objectLink-sourceLink {
    background: url(group.gif) repeat-x #FFFFFF;
    padding-right: 4px;
    right: 0;
}

.logRow-spy.opened {
    padding-bottom: 4px;
    border-bottom: none;
}

.spyTitle {
    color: #000000;
    font-weight: bold;
    -moz-box-sizing: padding-box;
    overflow: hidden;
    z-index: 100;
    padding-left: 18px;
}

.spyCol {
    padding: 0;
    white-space: nowrap;
    height: 16px;
}

.spyTitleCol:hover > .objectLink-sourceLink,
.spyTitleCol:hover > .spyTime,
.spyTitleCol:hover > .spyStatus,
.spyTitleCol:hover > .spyTitle {
    display: none;
}

.spyFullTitle {
    display: none;
    -moz-user-select: none;
    max-width: 100%;
    background-color: Transparent;
}

.spyTitleCol:hover > .spyFullTitle {
    display: block;
}

.spyStatus {
    padding-left: 10px;
    color: rgb(128, 128, 128);
}

.spyTime {
    margin-left:4px;
    margin-right:4px;
    color: rgb(128, 128, 128);
}

.spyIcon {
    margin-right: 4px;
    margin-left: 4px;
    width: 16px;
    height: 16px;
    vertical-align: middle;
    background: transparent no-repeat 0 0;
    display: none;
}

.loading .spyHead .spyRow .spyIcon {
    background-image: url(loading_16.gif);
    display: block;
}

.logRow-spy.loaded:not(.error) .spyHead .spyRow .spyIcon {
    width: 0;
    margin: 0;
}

.logRow-spy.error .spyHead .spyRow .spyIcon {
    background-image: url(errorIcon-sm.png);
    display: block;
    background-position: 2px 2px;
}

.logRow-spy .spyHead .netInfoBody {
    display: none;
}

.logRow-spy.opened .spyHead .netInfoBody {
    margin-top: 10px;
    display: block;
}

.logRow-spy.error .spyTitle,
.logRow-spy.error .spyStatus,
.logRow-spy.error .spyTime {
    color: red;
}

.logRow-spy.loading .spyResponseText {
    font-style: italic;
    color: #888888;
}

/************************************************************************************************/

.caption {
    font-family: Lucida Grande, Tahoma, sans-serif;
    font-weight: bold;
    color:  #444444;
}

.warning {
    padding: 10px;
    font-family: Lucida Grande, Tahoma, sans-serif;
    font-weight: bold;
    color:  #888888;
}




/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
/* DOM */
/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/


/* See license.txt for terms of usage */

.panelNode-dom {
    overflow-x: hidden !important;
}

.domTable {
    font-size: 1em;
    width: 100%;
    table-layout: fixed;
    background: #fff;
}

.domTableIE {
    width: auto;
}

.memberLabelCell {
    padding: 2px 0 2px 0;
    vertical-align: top;
}

.memberValueCell {
    padding: 1px 0 1px 5px;
    display: block;
    overflow: hidden;
}

.memberLabel {
    display: block;
    cursor: default;
    -moz-user-select:  none;
    overflow: hidden;
    /*position: absolute;*/
    padding-left: 18px;
    /*max-width: 30%;*/
    /*white-space: nowrap;*/
    background-color: #FFFFFF;
    text-decoration: none;
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

.memberRow.hasChildren .memberLabelCell .memberLabel:hover {
    cursor: pointer;
    color: blue;
    text-decoration: underline;
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

.userLabel {
    color: #000000;
    font-weight: bold;
}

.userClassLabel {
    color: #E90000;
    font-weight: bold;
}

.userFunctionLabel {
    color: #025E2A;
    font-weight: bold;
}

.domLabel {
    color: #000000;
}

.domFunctionLabel {
    color: #025E2A;
}

.ordinalLabel {
    color: SlateBlue;
    font-weight: bold;
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
.scopesRow {
    padding: 2px 18px;
    background-color: LightYellow;
    border-bottom: 5px solid #BEBEBE;
    color: #666666;
}
.scopesLabel {
    background-color:  LightYellow;
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

.watchEditCell {
    padding: 2px 18px;
    background-color: LightYellow;
    border-bottom: 1px solid #BEBEBE;
    color: #666666;
}

.editor-watchNewRow,
.editor-memberRow {
    font-family: Monaco, monospace !important;
}

.editor-memberRow {
    padding: 1px 0 !important;
}

.editor-watchRow {
    padding-bottom: 0 !important;
}

.watchRow > .memberLabelCell {
    font-family: Monaco, monospace;
    padding-top: 1px;
    padding-bottom: 1px;
}

.watchRow > .memberLabelCell > .memberLabel {
    background-color: transparent;
}

.watchRow > .memberValueCell {
    padding-top: 2px;
    padding-bottom: 2px;
}

.watchRow > .memberLabelCell,
.watchRow > .memberValueCell {
    background-color: #F5F5F5;
    border-bottom: 1px solid #BEBEBE;
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

.watchToolbox {
    z-index: 2147483647;
    position: absolute;
    right: 0;
    padding: 1px 2px;
}


/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
/* FROM ORIGINAL FIREBUG */




/************************************************************************************************
 CSS Not organized
*************************************************************************************************/
#fbConsole {
    overflow-x: hidden !important;
}

#fbCSS {
    font: 1em Monaco, monospace;
    padding: 0 7px;
}

#fbstylesheetButtons select, #fbScriptButtons select {
    font: 11px Lucida Grande, Tahoma, sans-serif;
    margin-top: 1px;
    padding-left: 3px;
    background: #fafafa;
    border: 1px inset #fff;
    width: 220px;
    outline: none;
}

.Selector { margin-top:10px }
.CSSItem {margin-left: 4% }
.CSSText { padding-left:20px; }
.CSSProperty { color:#005500; }
.CSSValue { padding-left:5px; color:#000088; }


/************************************************************************************************
 Not organized
*************************************************************************************************/

#fbHTMLStatusBar {
    display: inline;
}

.fbToolbarButtons {
    display: none;
}

.fbStatusSeparator{
    display: block;
    float: left;
    padding-top: 4px;
}

#fbStatusBarBox {
    display: none;
}

#fbToolbarContent {
    display: block;
    position: absolute;
    _position: absolute;
    top: 0;
    padding-top: 4px;
    height: 23px;
    clip: rect(0, 2048px, 27px, 0);
}

.fbTabMenuTarget {
    display: none !important;
    float: left;
    width: 10px;
    height: 10px;
    margin-top: 6px;
    background: url(tabMenuTarget.png);   
}

.fbTabMenuTarget:hover {
    background: url(tabMenuTargetHover.png);   
}

.fbShadow {
    float: left;
    background: url(shadowAlpha.png) no-repeat bottom right !important;
    background: url(shadow2.gif) no-repeat bottom right;
    margin: 10px 0 0 10px !important;
    margin: 10px 0 0 5px;
}

.fbShadowContent {
    display: block;
    position: relative;
    background-color: #fff;
    border: 1px solid #a9a9a9;
    top: -6px;
    left: -6px;
}

.fbMenu {
    display: none;
    position: absolute;
    font-size: 11px;
    line-height: 13px;
    z-index: 2147483647;
}

.fbMenuContent {
    padding: 2px;
}

.fbMenuSeparator {
    display: block;
    position: relative;
    padding: 1px 18px 0;
    text-decoration: none;
    color: #000;
    cursor: default;    
    background: #ACA899;
    margin: 4px 0;
}

.fbMenuOption
{
    display: block;
    position: relative;
    padding: 2px 18px;
    text-decoration: none;
    color: #000;
    cursor: default;
}

.fbMenuOption:hover
{
    color: #fff;
    background: #316AC5;
}

.fbMenuGroup {
    background: transparent url(tabMenuPin.png) no-repeat right 0;
}

.fbMenuGroup:hover {
    background: #316AC5 url(tabMenuPin.png) no-repeat right -17px;
}

.fbMenuGroupSelected {
    color: #fff;
    background: #316AC5 url(tabMenuPin.png) no-repeat right -17px;
}

.fbMenuChecked  {
    background: transparent url(tabMenuCheckbox.png) no-repeat 4px 0;
}

.fbMenuChecked:hover {
    background: #316AC5 url(tabMenuCheckbox.png) no-repeat 4px -17px;
}

.fbMenuRadioSelected {
    background: transparent url(tabMenuRadio.png) no-repeat 4px 0;
}

.fbMenuRadioSelected:hover {
    background: #316AC5 url(tabMenuRadio.png) no-repeat 4px -17px;
}

.fbMenuShortcut {
    padding-right: 85px; 
}

.fbMenuShortcutKey {
    position: absolute;
    right: 0;
    top: 2px;
    width: 77px;
}

#fbFirebugMenu {
    top: 22px;
    left: 0;
}

.fbMenuDisabled {
    color: #ACA899 !important;
}

#fbFirebugSettingsMenu {
    left: 245px;
    top: 99px;
}

#fbConsoleMenu {
    top: 42px;
    left: 48px;
}

.fbIconButton {
    display: block;
}

.fbIconButton {
    display: block;
}

.fbIconButton {
    display: block;
    float: left;
    height: 20px;
    width: 20px;
    color: #000;
    margin-right: 2px;
    text-decoration: none;
    cursor: default;
}

.fbIconButton:hover {
    position: relative;
    top: -1px;
    left: -1px;
    margin-right: 0;
    _margin-right: 1px;
    color: #333;
    border: 1px solid #fff;
    border-bottom: 1px solid #bbb;
    border-right: 1px solid #bbb;
}

.fbIconPressed {
    position: relative;
    margin-right: 0;
    _margin-right: 1px;
    top: 0 !important;
    left: 0 !important;
    height: 19px;
    color: #333 !important;
    border: 1px solid #bbb !important;
    border-bottom: 1px solid #cfcfcf !important;
    border-right: 1px solid #ddd !important;
}



/************************************************************************************************
 Error Popup
*************************************************************************************************/
#fbErrorPopup {
    position: absolute;
    right: 0;
    bottom: 0;
    height: 19px;
    width: 75px;
    background: url(sprite.png) #f1f2ee 0 0;
    z-index: 999;
}

#fbErrorPopupContent {
    position: absolute;
    right: 0;
    top: 1px;
    height: 18px;
    width: 75px;
    _width: 74px;
    border-left: 1px solid #aca899;
}

#fbErrorIndicator {
    position: absolute;
    top: 2px;
    right: 5px;
}










.fbBtnInspectActive {
    background: #aaa;
    color: #fff !important;
}

/************************************************************************************************
 General
*************************************************************************************************/
.fbBody {
    margin: 0;
    padding: 0;
    overflow: hidden;
    
    font-family: Lucida Grande, Tahoma, sans-serif;
    font-size: 11px;
    background: #fff;
}

.clear {
    clear: both;
}

/************************************************************************************************
 Mini Chrome
*************************************************************************************************/
#fbMiniChrome {
    display: none;
    right: 0;
    height: 27px;
    background: url(sprite.png) #f1f2ee 0 0;
    margin-left: 1px;
}

#fbMiniContent {
    display: block;
    position: relative;
    left: -1px;
    right: 0;
    top: 1px;
    height: 25px;
    border-left: 1px solid #aca899;
}

#fbToolbarSearch {
    float: right;
    border: 1px solid #ccc;
    margin: 0 5px 0 0;
    background: #fff url(search.png) no-repeat 4px 2px !important;
    background: #fff url(search.gif) no-repeat 4px 2px;
    padding-left: 20px;    
    font-size: 11px;
}

#fbToolbarErrors {
    float: right;
    margin: 1px 4px 0 0;
    font-size: 11px;
}

#fbLeftToolbarErrors {
    float: left;
    margin: 7px 0px 0 5px;
    font-size: 11px;
}

.fbErrors {
    padding-left: 20px;
    height: 14px;
    background: url(errorIcon.png) no-repeat !important;
    background: url(errorIcon.gif) no-repeat;
    color: #f00;
    font-weight: bold;    
}

#fbMiniErrors {
    display: inline;
    display: none;
    float: right;
    margin: 5px 2px 0 5px;
}

#fbMiniIcon {
    float: right;
    margin: 3px 4px 0;
    height: 20px;
    width: 20px;
    float: right;    
    background: url(sprite.png) 0 -135px;
    cursor: pointer;
}


/************************************************************************************************
 Master Layout
*************************************************************************************************/
#fbChrome {
    font-family: Lucida Grande, Tahoma, sans-serif;
    font-size: 11px;
    position: absolute;
    _position: static;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    background: #fff;
    overflow: hidden;
}

#fbChrome > tbody > tr > td {
    padding: 0;
}

#fbTop {
    height: 49px;
}

#fbToolbar {
    background: url(sprite.png) #f1f2ee 0 0;
    height: 27px;
    font-size: 11px;
    line-height: 13px;
}

#fbPanelBarBox {
    background: url(sprite.png) #dbd9c9 0 -27px;
    height: 22px;
}

#fbContent {
    height: 100%;
    vertical-align: top;
}

#fbBottom {
    height: 18px;
    background: #fff;
}

/************************************************************************************************
 Sub-Layout 
*************************************************************************************************/

/* fbToolbar 
*************************************************************************************************/
#fbToolbarIcon {
    float: left;
    padding: 0 5px 0;
}

#fbToolbarIcon a {
    background: url(sprite.png) 0 -135px;
}

#fbToolbarButtons {
    padding: 0 2px 0 5px;
}

#fbToolbarButtons {
    padding: 0 2px 0 5px;
}
/*
#fbStatusBarBox a {
    text-decoration: none;
    display: block;
    float: left;
    color: #000;
    padding: 4px 5px;
    margin: 0 0 0 1px;
    cursor: default;
}

#fbStatusBarBox a:hover {
    color: #333;
    padding: 3px 4px;
    border: 1px solid #fff;
    border-bottom: 1px solid #bbb;
    border-right: 1px solid #bbb;
}
/**/

.fbButton {
    text-decoration: none;
    display: block;
    float: left;
    color: #000;
    padding: 4px 6px 4px 7px;
    cursor: default;
}

.fbButton:hover {
    color: #333;
    background: #f5f5ef url(buttonBg.png);
    padding: 3px 5px 3px 6px;
    border: 1px solid #fff;
    border-bottom: 1px solid #bbb;
    border-right: 1px solid #bbb;
}

.fbBtnPressed {
    background: #e3e3db url(buttonBgHover.png) !important;
    padding: 3px 4px 2px 6px !important;
    margin: 1px 0 0 1px !important;
    border: 1px solid #ACA899 !important;
    border-color: #ACA899 #ECEBE3 #ECEBE3 #ACA899 !important;
}

#fbStatusBarBox {
    top: 4px;
    cursor: default;    
}

.fbToolbarSeparator {
    overflow: hidden;
    border: 1px solid;
    border-color: transparent #fff transparent #777;
    _border-color: #eee #fff #eee #777;
    height: 7px;
    margin: 6px 3px;
    float: left;
}

.fbBtnSelected {
    font-weight: bold;
}

.fbStatusBar {
    color: #aca899;
}

.fbStatusBar a {
    text-decoration: none;
    color: black;
}

.fbStatusBar a:hover {
    color: blue;
    cursor: pointer;    
}


#fbWindowButtons {
    position: absolute;
    white-space: nowrap;
    right: 0;
    top: 0;
    height: 17px;
    width: 48px;
    padding: 5px;
    z-index: 6;
    background: url(sprite.png) #f1f2ee 0 0;
}

/* fbPanelBarBox
*************************************************************************************************/

#fbPanelBar1 {
    width: 1024px; /* fixed width to avoid tabs breaking line */
    z-index: 8;
    left: 0;
    white-space: nowrap;
    background: url(sprite.png) #dbd9c9 0 -27px;
    position: absolute;
    left: 4px;
}

#fbPanelBar2Box {
    background: url(sprite.png) #dbd9c9 0 -27px;
    position: absolute;
    height: 22px;
    width: 300px; /* fixed width to avoid tabs breaking line */
    z-index: 9;
    right: 0;
}

#fbPanelBar2 {
    position: absolute;
    width: 290px; /* fixed width to avoid tabs breaking line */
    height: 22px;
    padding-left: 4px;
}

/* body 
*************************************************************************************************/
.fbPanel {
    display: none;
}

#fbPanelBox1, #fbPanelBox2 {
    max-height: inherit;
    height: 100%;
    font-size: 1em;
}

#fbPanelBox2 {
    background: #fff;
}

#fbPanelBox2 {
    width: 300px;
    background: #fff;
}

#fbPanel2 {
    margin-left: 6px;
    background: #fff;
}

#fbLargeCommandLine {
    display: none;
    position: absolute;
    z-index: 9;
    top: 27px;
    right: 0;
    width: 294px;
    height: 201px;
    border-width: 0;
    margin: 0;
    padding: 2px 0 0 2px;
    resize: none;
    outline: none;
    font-size: 11px;
    overflow: auto;
    border-top: 1px solid #B9B7AF;
    _right: -1px;
    _border-left: 1px solid #fff;
}

#fbLargeCommandButtons {
    display: none;
    background: #ECE9D8;
    bottom: 0;
    right: 0;
    width: 294px;
    height: 21px;
    padding-top: 1px;
    position: fixed;
    border-top: 1px solid #ACA899;
    z-index: 9;
}

#fbSmallCommandLineIcon {
    background: url(down.png) no-repeat;
    position: absolute;
    right: 2px;
    bottom: 3px;
    
    z-index: 99;
}

#fbSmallCommandLineIcon:hover {
    background: url(downHover.png) no-repeat;
}

.hide {
    overflow: hidden !important;
    position: fixed !important;
    display: none !important;
    visibility: hidden !important;
}

/* fbBottom 
*************************************************************************************************/

#fbCommand {
    height: 18px;
}

#fbCommandBox {
    position: fixed;
    _position: absolute;
    width: 100%;
    height: 18px;
    bottom: 0;
    overflow: hidden;
    z-index: 9;
    background: #fff;
    border: 0;
    border-top: 1px solid #ccc;
}

#fbCommandIcon {
    position: absolute;
    color: #00f;
    top: 2px;
    left: 6px;
    display: inline;
    font: 11px Monaco, monospace;
    z-index: 10;
}

#fbCommandLine {
    position: absolute;
    width: 100%;
    top: 0;
    left: 0;
    border: 0;
    margin: 0;
    padding: 2px 0 2px 32px;
    font: 11px Monaco, monospace;
    z-index: 9;
    outline: none;
}

#fbLargeCommandLineIcon {
    background: url(up.png) no-repeat;
    position: absolute;
    right: 1px;
    bottom: 1px;
    z-index: 10;
}

#fbLargeCommandLineIcon:hover {
    background: url(upHover.png) no-repeat;
}

div.fbFitHeight {
    overflow: auto;
    position: relative;
}


/************************************************************************************************
 Layout Controls
*************************************************************************************************/

/* fbToolbar buttons 
*************************************************************************************************/
.fbSmallButton {
    overflow: hidden;
    width: 16px;
    height: 16px;
    display: block;
    text-decoration: none;
    cursor: default;
}

#fbWindowButtons .fbSmallButton {
    float: right;
}

#fbWindow_btClose {
    background: url(min.png);
}

#fbWindow_btClose:hover {
    background: url(minHover.png);
}

#fbWindow_btDetach {
    background: url(detach.png);
}

#fbWindow_btDetach:hover {
    background: url(detachHover.png);
}

#fbWindow_btDeactivate {
    background: url(off.png);
}

#fbWindow_btDeactivate:hover {
    background: url(offHover.png);
}


/* fbPanelBarBox tabs 
*************************************************************************************************/
.fbTab {
    text-decoration: none;
    display: none;
    float: left;
    width: auto;
    float: left;
    cursor: default;
    font-family: Lucida Grande, Tahoma, sans-serif;
    font-size: 11px;
    line-height: 13px;
    font-weight: bold;
    height: 22px;
    color: #565656;
}

.fbPanelBar span {
    /*display: block; TODO: safe to remove this? */
    float: left;
}

.fbPanelBar .fbTabL,.fbPanelBar .fbTabR {
    height: 22px;
    width: 8px;
}

.fbPanelBar .fbTabText {
    padding: 4px 1px 0;
}

a.fbTab:hover {
    background: url(sprite.png) 0 -73px;
}

a.fbTab:hover .fbTabL {
    background: url(sprite.png) -16px -96px;
}

a.fbTab:hover .fbTabR {
    background: url(sprite.png) -24px -96px;
}

.fbSelectedTab {
    background: url(sprite.png) #f1f2ee 0 -50px !important;
    color: #000;
}

.fbSelectedTab .fbTabL {
    background: url(sprite.png) 0 -96px !important;
}

.fbSelectedTab .fbTabR {
    background: url(sprite.png) -8px -96px !important;
}

/* splitters 
*************************************************************************************************/
#fbHSplitter {
    position: fixed;
    _position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 5px;
    overflow: hidden;
    cursor: n-resize !important;
    background: url(pixel_transparent.gif);
    z-index: 9;
}

#fbHSplitter.fbOnMovingHSplitter {
    height: 100%;
    z-index: 100;
}

.fbVSplitter {
    background: #ece9d8;
    color: #000;
    border: 1px solid #716f64;
    border-width: 0 1px;
    border-left-color: #aca899;
    width: 4px;
    cursor: e-resize;
    overflow: hidden;
    right: 294px;
    text-decoration: none;
    z-index: 10;
    position: absolute;
    height: 100%;
    top: 27px;
}

/************************************************************************************************/
div.lineNo {
    font: 1em/1.4545em Monaco, monospace;
    position: relative;
    float: left;
    top: 0;
    left: 0;
    margin: 0 5px 0 0;
    padding: 0 5px 0 10px;
    background: #eee;
    color: #888;
    border-right: 1px solid #ccc;
    text-align: right;
}

.sourceBox {
    position: absolute;
}

.sourceCode {
    font: 1em Monaco, monospace;
    overflow: hidden;
    white-space: pre;
    display: inline;
}

/************************************************************************************************/
.nodeControl {
    margin-top: 3px;
    margin-left: -14px;
    float: left;
    width: 9px;
    height: 9px;
    overflow: hidden;
    cursor: default;
    background: url(tree_open.gif);
    _float: none;
    _display: inline;
    _position: absolute;
}

div.nodeMaximized {
    background: url(tree_close.gif);
}

div.objectBox-element {
    padding: 1px 3px;
}
.objectBox-selector{
    cursor: default;
}

.selectedElement{
    background: highlight;
    /* background: url(roundCorner.svg); Opera */
    color: #fff !important;
}
.selectedElement span{
    color: #fff !important;
}

/* IE6 need this hack */
* html .selectedElement {
    position: relative;
}

/* Webkit CSS Hack - bug in "highlight" named color */ 
@media screen and (-webkit-min-device-pixel-ratio:0) {
    .selectedElement{
      background: #316AC5;
      color: #fff !important;
    }
}

/************************************************************************************************/
/************************************************************************************************/
.logRow * {
    font-size: 1em;
}

/* TODO: remove this? */
/* TODO: xxxpedro - IE need this in windowless mode (cnn.com) check if the issue is related to 
position. if so, override it at chrome.js initialization when creating the div */
.logRow {
    position: relative;
    border-bottom: 1px solid #D7D7D7;
    padding: 2px 4px 1px 6px;
    zbackground-color: #FFFFFF;
}
/**/

.logRow-command {
    font-family: Monaco, monospace;
    color: blue;
}

.objectBox-string,
.objectBox-text,
.objectBox-number,
.objectBox-function,
.objectLink-element,
.objectLink-textNode,
.objectLink-function,
.objectBox-stackTrace,
.objectLink-profile {
    font-family: Monaco, monospace;
}

.objectBox-null {
    padding: 0 2px;
    border: 1px solid #666666;
    background-color: #888888;
    color: #FFFFFF;
}

.objectBox-string {
    color: red;
    
    /* TODO: xxxpedro make long strings break line */
    /*white-space: pre; */ 
}

.objectBox-number {
    color: #000088;
}

.objectBox-function {
    color: DarkGreen;
}

.objectBox-object {
    color: DarkGreen;
    font-weight: bold;
    font-family: Lucida Grande, sans-serif;
}

.objectBox-array {
    color: #000;
}

/************************************************************************************************/
.logRow-info,.logRow-error,.logRow-warn {
    background: #fff no-repeat 2px 2px;
    padding-left: 20px;
    padding-bottom: 3px;
}

.logRow-info {
    background-image: url(infoIcon.png) !important;
    background-image: url(infoIcon.gif);
}

.logRow-warn {
    background-color: cyan;
    background-image: url(warningIcon.png) !important;
    background-image: url(warningIcon.gif);
}

.logRow-error {
    background-color: LightYellow;
    background-image: url(errorIcon.png) !important;
    background-image: url(errorIcon.gif);
    color: #f00;
}

.errorMessage {
    vertical-align: top;
    color: #f00;
}

.objectBox-sourceLink {
    position: absolute;
    right: 4px;
    top: 2px;
    padding-left: 8px;
    font-family: Lucida Grande, sans-serif;
    font-weight: bold;
    color: #0000FF;
}

/************************************************************************************************/
/*
//TODO: remove this when console2 is finished
*/
/*
.logRow-group {
    background: #EEEEEE;
    border-bottom: none;
}

.logGroup {
    background: #EEEEEE;
}

.logGroupBox {
    margin-left: 24px;
    border-top: 1px solid #D7D7D7;
    border-left: 1px solid #D7D7D7;
}/**/

/************************************************************************************************/
.selectorTag,.selectorId,.selectorClass {
    font-family: Monaco, monospace;
    font-weight: normal;
}

.selectorTag {
    color: #0000FF;
}

.selectorId {
    color: DarkBlue;
}

.selectorClass {
    color: red;
}

/************************************************************************************************/
.objectBox-element {
    font-family: Monaco, monospace;
    color: #000088;
}

.nodeChildren {
    padding-left: 26px;
}

.nodeTag {
    color: blue;
    cursor: pointer;
}

.nodeValue {
    color: #FF0000;
    font-weight: normal;
}

.nodeText,.nodeComment {
    margin: 0 2px;
    vertical-align: top;
}

.nodeText {
    color: #333333;
    font-family: Monaco, monospace;
}

.nodeComment {
    color: DarkGreen;
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

.nodeHidden, .nodeHidden * {
    color: #888888;
}

.nodeHidden .nodeTag {
    color: #5F82D9;
}

.nodeHidden .nodeValue {
    color: #D86060;
}

.selectedElement .nodeHidden, .selectedElement .nodeHidden * {
    color: SkyBlue !important;
}


/************************************************************************************************/
.log-object {
    /*
    _position: relative;
    _height: 100%;
    /**/
}

.property {
    position: relative;
    clear: both;
    height: 15px;
}

.propertyNameCell {
    vertical-align: top;
    float: left;
    width: 28%;
    position: absolute;
    left: 0;
    z-index: 0;
}

.propertyValueCell {
    float: right;
    width: 68%;
    background: #fff;
    position: absolute;
    padding-left: 5px;
    display: table-cell;
    right: 0;
    z-index: 1;
    /*
    _position: relative;
    /**/
}

.propertyName {
    font-weight: bold;
}

.FirebugPopup {
    height: 100% !important;
}

.FirebugPopup #fbWindowButtons {
    display: none !important;
}

.FirebugPopup #fbHSplitter {
    display: none !important;
}`,
	"skin/xp/firebug.html": `<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/DTD/strict.dtd">
	<html>
	<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8">
	<title>Firebug Lite</title>
	<!-- An empty script to avoid FOUC when loading the stylesheet -->
	<script type="text/javascript"></script>
	<style type="text/css" media="screen">@import "firebug.css";</style>
	<style>html,body{margin:0;padding:0;overflow:hidden;}</style>
	</head>
	<body class="fbBody">
	<table id="fbChrome" cellpadding="0" cellspacing="0" border="0">
	  <tbody>
		<tr>
		  <!-- Interface - Top Area -->
		  <td id="fbTop" colspan="2">
		  
			<!-- 
			<div>
			  --><!-- <span id="fbToolbarErrors" class="fbErrors">2 errors</span> --><!-- 
			  <input type="text" id="fbToolbarSearch" />
			</div>
			-->
				  
			<!-- Window Buttons -->
			<div id="fbWindowButtons">
			  <a id="fbWindow_btDeactivate" class="fbSmallButton fbHover" title="Deactivate Firebug for this web page">&nbsp;</a>
			  <a id="fbWindow_btDetach" class="fbSmallButton fbHover" title="Open Firebug in popup window">&nbsp;</a>
			  <a id="fbWindow_btClose" class="fbSmallButton fbHover" title="Minimize Firebug">&nbsp;</a>
			</div>
			
			<!-- Toolbar buttons and Status Bar -->
			<div id="fbToolbar">
			  <div id="fbToolbarContent">
			
			  <!-- Firebug Button -->
			  <span id="fbToolbarIcon">
				<a id="fbFirebugButton" class="fbIconButton" class="fbHover" target="_blank">&nbsp;</a>
			  </span>
			  
			  <!-- 
			  <span id="fbLeftToolbarErrors" class="fbErrors">2 errors</span>
			   -->
			   
			  <!-- Toolbar Buttons -->
			  <span id="fbToolbarButtons">
				<!-- Fixed Toolbar Buttons -->
				<span id="fbFixedButtons">
					<a id="fbChrome_btInspect" class="fbButton fbHover" title="Click an element in the page to inspect">Inspect</a>
				</span>
				
				<!-- Console Panel Toolbar Buttons -->
				<span id="fbConsoleButtons" class="fbToolbarButtons">
				  <a id="fbConsole_btClear" class="fbButton fbHover" title="Clear the console">Clear</a>
				</span>
				
				<!-- HTML Panel Toolbar Buttons -->
				<!-- 
				<span id="fbHTMLButtons" class="fbToolbarButtons">
				  <a id="fbHTML_btEdit" class="fbHover" title="Edit this HTML">Edit</a>
				</span>
				 -->
			  </span>
			  
			  <!-- Status Bar -->
			  <span id="fbStatusBarBox">
				<span class="fbToolbarSeparator"></span>
				<!-- HTML Panel Status Bar -->
				<!-- 
				<span id="fbHTMLStatusBar" class="fbStatusBar fbToolbarButtons">
				</span>
				 -->
			  </span>
			  
			  </div>
			  
			</div>
			
			<!-- PanelBars -->
			<div id="fbPanelBarBox">
			
			  <!-- Main PanelBar -->
			  <div id="fbPanelBar1" class="fbPanelBar">
				<a id="fbConsoleTab" class="fbTab fbHover">
					<span class="fbTabL"></span>
					<span class="fbTabText">Console</span>
					<span class="fbTabMenuTarget"></span>
					<span class="fbTabR"></span>
				</a>
				<a id="fbHTMLTab" class="fbTab fbHover">
					<span class="fbTabL"></span>
					<span class="fbTabText">HTML</span>
					<span class="fbTabR"></span>
				</a>
				<a class="fbTab fbHover">
					<span class="fbTabL"></span>
					<span class="fbTabText">CSS</span>
					<span class="fbTabR"></span>
				</a>
				<a class="fbTab fbHover">
					<span class="fbTabL"></span>
					<span class="fbTabText">Script</span>
					<span class="fbTabR"></span>
				</a>
				<a class="fbTab fbHover">
					<span class="fbTabL"></span>
					<span class="fbTabText">DOM</span>
					<span class="fbTabR"></span>
				</a>
			  </div>
	
			  <!-- Side PanelBars -->
			  <div id="fbPanelBar2Box" class="hide">
				<div id="fbPanelBar2" class="fbPanelBar">
				<!-- 
				  <a class="fbTab fbHover">
					<span class="fbTabL"></span>
					<span class="fbTabText">Style</span>
					<span class="fbTabR"></span>
				  </a>
				  <a class="fbTab fbHover">
					<span class="fbTabL"></span>
					<span class="fbTabText">Layout</span>
					<span class="fbTabR"></span>
				  </a>
				  <a class="fbTab fbHover">
					<span class="fbTabL"></span>
					<span class="fbTabText">DOM</span>
					<span class="fbTabR"></span>
				  </a>
			   -->
				</div>
			  </div>
			  
			</div>
			
			<!-- Horizontal Splitter -->
			<div id="fbHSplitter">&nbsp;</div>
			
		  </td>
		</tr>
		
		<!-- Interface - Main Area -->
		<tr id="fbContent">
		
		  <!-- Panels  -->
		  <td id="fbPanelBox1">
			<div id="fbPanel1" class="fbFitHeight">
			  <div id="fbConsole" class="fbPanel"></div>
			  <div id="fbHTML" class="fbPanel"></div>
			</div>
		  </td>
		  
		  <!-- Side Panel Box -->
		  <td id="fbPanelBox2" class="hide">
		  
			<!-- VerticalSplitter -->
			<div id="fbVSplitter" class="fbVSplitter">&nbsp;</div>
			
			<!-- Side Panels -->
			<div id="fbPanel2" class="fbFitHeight">
			
			  <!-- HTML Side Panels -->
			  <div id="fbHTML_Style" class="fbPanel"></div>
			  <div id="fbHTML_Layout" class="fbPanel"></div>
			  <div id="fbHTML_DOM" class="fbPanel"></div>
			  
			</div>
			
			<!-- Large Command Line -->
			<textarea id="fbLargeCommandLine" class="fbFitHeight"></textarea>
			
			<!-- Large Command Line Buttons -->
			<div id="fbLargeCommandButtons">
				<a id="fbCommand_btRun" class="fbButton fbHover">Run</a>
				<a id="fbCommand_btClear" class="fbButton fbHover">Clear</a>
				
				<a id="fbSmallCommandLineIcon" class="fbSmallButton fbHover"></a>
			</div>
			
		  </td>
		  
		</tr>
		
		<!-- Interface - Bottom Area -->
		<tr id="fbBottom" class="hide">
		
		  <!-- Command Line -->
		  <td id="fbCommand" colspan="2">
			<div id="fbCommandBox">
			  <div id="fbCommandIcon">&gt;&gt;&gt;</div>
			  <input id="fbCommandLine" name="fbCommandLine" type="text" />
			  <a id="fbLargeCommandLineIcon" class="fbSmallButton fbHover"></a>
			</div>
		  </td>
		  
		</tr>
		
	  </tbody>
	</table> 
	<span id="fbMiniChrome">
	  <span id="fbMiniContent">
		<span id="fbMiniIcon" title="Open Firebug Lite"></span>
		<span id="fbMiniErrors" class="fbErrors"><!-- 2 errors --></span>
	  </span>
	</span>
	<!-- 
	<div id="fbErrorPopup">
	  <div id="fbErrorPopupContent">
		<div id="fbErrorIndicator" class="fbErrors">2 errors</div>
	  </div>
	</div>
	 -->
	</body>
	</html>
	`,
	"js/firebug-lite.js": `
	(function(){
		/**************************************************************
		 *
		 *    Firebug Lite 1.4.0
		 * 
		 *      Copyright (c) 2007, Parakey Inc.
		 *      Released under BSD license.
		 *      More information: http://getfirebug.com/firebuglite
		 *  
		 **************************************************************/
		/*
		 * CSS selectors powered by:
		 * 
		 * Sizzle CSS Selector Engine - v1.0
		 *  Copyright 2009, The Dojo Foundation
		 *  Released under the MIT, BSD, and GPL Licenses.
		 *  More information: http://sizzlejs.com/
		 */
		var FBL={};
		(function(){var productionDir="http://getfirebug.com/releases/lite/";
		var bookmarkletVersion=4;
		var reNotWhitespace=/[^\s]/;
		var reSplitFile=/:\/{1,3}(.*?)\/([^\/]*?)\/?($|\?.*)/;
		this.reJavascript=/\s*javascript:\s*(.*)/;
		this.reChrome=/chrome:\/\/([^\/]*)\//;
		this.reFile=/file:\/\/([^\/]*)\//;
		var userAgent=navigator.userAgent.toLowerCase();
		this.isFirefox=/firefox/.test(userAgent);
		this.isOpera=/opera/.test(userAgent);
		this.isSafari=/webkit/.test(userAgent);
		this.isIE=/msie/.test(userAgent)&&!/opera/.test(userAgent);
		this.isIE6=/msie 6/i.test(navigator.appVersion);
		this.browserVersion=(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1];
		this.isIElt8=this.isIE&&(this.browserVersion-0<8);
		this.NS=null;
		this.pixelsPerInch=null;
		var namespaces=[];
		this.ns=function(fn){var ns={};
		namespaces.push(fn,ns);
		return ns
		};
		var FBTrace=null;
		this.initialize=function(){if(window.firebug&&firebug.firebuglite||window.console&&console.firebuglite){return
		}if(FBL.FBTrace){FBTrace=FBL.FBTrace
		}else{FBTrace=FBL.FBTrace={}
		}var isChromeContext=window.Firebug&&typeof window.Firebug.SharedEnv=="object";
		if(isChromeContext){sharedEnv=window.Firebug.SharedEnv;
		delete window.Firebug.SharedEnv;
		FBL.Env=sharedEnv;
		FBL.Env.isChromeContext=true;
		FBTrace.messageQueue=FBL.Env.traceMessageQueue
		}else{FBL.NS=document.documentElement.namespaceURI;
		FBL.Env.browser=window;
		FBL.Env.destroy=destroyEnvironment;
		if(document.documentElement.getAttribute("debug")=="true"){FBL.Env.Options.startOpened=true
		}findLocation();
		var prefs=FBL.Store.get("FirebugLite")||{};
		FBL.Env.DefaultOptions=FBL.Env.Options;
		FBL.Env.Options=FBL.extend(FBL.Env.Options,prefs.options||{});
		if(FBL.isFirefox&&typeof FBL.Env.browser.console=="object"&&FBL.Env.browser.console.firebug&&FBL.Env.Options.disableWhenFirebugActive){return
		}}if(FBL.Env.isDebugMode){FBL.Env.browser.FBL=FBL
		}this.isQuiksMode=FBL.Env.browser.document.compatMode=="BackCompat";
		this.isIEQuiksMode=this.isIE&&this.isQuiksMode;
		this.isIEStantandMode=this.isIE&&!this.isQuiksMode;
		this.noFixedPosition=this.isIE6||this.isIEQuiksMode;
		if(FBL.Env.Options.enableTrace){FBTrace.initialize()
		}if(FBTrace.DBG_INITIALIZE&&isChromeContext){FBTrace.sysout("FBL.initialize - persistent application","initialize chrome context")
		}if(FBTrace.DBG_INITIALIZE){FBTrace.sysout("FBL.initialize",namespaces.length/2+" namespaces BEGIN")
		}for(var i=0;
		i<namespaces.length;
		i+=2){var fn=namespaces[i];
		var ns=namespaces[i+1];
		fn.apply(ns)
		}if(FBTrace.DBG_INITIALIZE){FBTrace.sysout("FBL.initialize",namespaces.length/2+" namespaces END");
		FBTrace.sysout("FBL waitForDocument","waiting document load")
		}FBL.Ajax.initialize();
		FBL.Firebug.loadPrefs();
		if(FBL.Env.Options.enablePersistent){if(isChromeContext){FBL.FirebugChrome.clone(FBL.Env.FirebugChrome)
		}else{FBL.Env.FirebugChrome=FBL.FirebugChrome;
		FBL.Env.traceMessageQueue=FBTrace.messageQueue
		}}waitForDocument()
		};
		var waitForDocument=function waitForDocument(){var doc=FBL.Env.browser.document;
		var body=doc.getElementsByTagName("body")[0];
		if(body){calculatePixelsPerInch(doc,body);
		onDocumentLoad()
		}else{setTimeout(waitForDocument,50)
		}};
		var onDocumentLoad=function onDocumentLoad(){if(FBTrace.DBG_INITIALIZE){FBTrace.sysout("FBL onDocumentLoad","document loaded")
		}if(FBL.isIE6){fixIE6BackgroundImageCache()
		}if(FBL.Env.Options.enablePersistent&&FBL.Env.isChromeContext){FBL.Firebug.initialize();
		if(!FBL.Env.isDevelopmentMode){sharedEnv.destroy();
		sharedEnv=null
		}}else{FBL.FirebugChrome.create()
		}};
		var sharedEnv;
		this.Env={Options:{saveCookies:true,saveWindowPosition:false,saveCommandLineHistory:false,startOpened:false,startInNewWindow:false,showIconWhenHidden:true,overrideConsole:true,ignoreFirebugElements:true,disableWhenFirebugActive:true,disableXHRListener:false,disableResourceFetching:false,enableTrace:false,enablePersistent:false},Location:{sourceDir:null,baseDir:null,skinDir:null,skin:null,app:null},skin:"xp",useLocalSkin:false,isDevelopmentMode:false,isDebugMode:false,isChromeContext:false,browser:null,chrome:null};
		var destroyEnvironment=function destroyEnvironment(){setTimeout(function(){FBL=null
		},100)
		};
		var findLocation=function findLocation(){var reFirebugFile=/(firebug-lite(?:-\w+)?(?:\.js|\.jgz))(?:#(.+))?$/;
		var reGetFirebugSite=/(?:http|https):\/\/getfirebug.com\//;
		var isGetFirebugSite;
		var rePath=/^(.*\/)/;
		var reProtocol=/^\w+:\/\//;
		var path=null;
		var doc=document;
		var script=doc.getElementById("FirebugLite");
		var scriptSrc;
		var hasSrcAttribute=true;
		if(script){scriptSrc=script.src;
		file=reFirebugFile.exec(scriptSrc);
		var version=script.getAttribute("FirebugLite");
		var number=version?parseInt(version):0;
		if(!version||!number||number<bookmarkletVersion){FBL.Env.bookmarkletOutdated=true
		}}else{for(var i=0,s=doc.getElementsByTagName("script"),si;
		si=s[i];
		i++){var file=null;
		if(si.nodeName.toLowerCase()=="script"){if(file=reFirebugFile.exec(si.getAttribute("firebugSrc"))){scriptSrc=si.getAttribute("firebugSrc");
		hasSrcAttribute=false
		}else{if(file=reFirebugFile.exec(si.src)){scriptSrc=si.src
		}else{continue
		}}script=si;
		break
		}}}if(script){script.firebugIgnore=true
		}if(file){var fileName=file[1];
		var fileOptions=file[2];
		if(reProtocol.test(scriptSrc)){path=rePath.exec(scriptSrc)[1]
		}else{var r=rePath.exec(scriptSrc);
		var src=r?r[1]:scriptSrc;
		var backDir=/^((?:\.\.\/)+)(.*)/.exec(src);
		var reLastDir=/^(.*\/)[^\/]+\/$/;
		path=rePath.exec(location.href)[1];
		if(backDir){var j=backDir[1].length/3;
		var p;
		while(j-->0){path=reLastDir.exec(path)[1]
		}path+=backDir[2]
		}else{if(src.indexOf("/")!=-1){if(/^\.\/./.test(src)){path+=src.substring(2)
		}else{if(/^\/./.test(src)){var domain=/^(\w+:\/\/[^\/]+)/.exec(path);
		path=domain[1]+src
		}else{path+=src
		}}}}}}FBL.Env.isChromeExtension=script&&script.getAttribute("extension")=="Chrome";
		if(FBL.Env.isChromeExtension){path=productionDir;
		FBL.Env.bookmarkletOutdated=false;
		script={innerHTML:"{showIconWhenHidden:false}"}
		}isGetFirebugSite=reGetFirebugSite.test(path);
		if(isGetFirebugSite&&path.indexOf("/releases/lite/")==-1){path+="releases/lite/"+(fileName=="firebug-lite-beta.js"?"beta/":"latest/")
		}var m=path&&path.match(/([^\/]+)\/$/)||null;
		if(path&&m){var Env=FBL.Env;
		Env.useLocalSkin=path.indexOf(location.protocol+"//"+location.host+"/")==0&&!isGetFirebugSite;
		if(fileName=="firebug-lite-dev.js"){Env.isDevelopmentMode=true;
		Env.isDebugMode=true
		}else{if(fileName=="firebug-lite-debug.js"){Env.isDebugMode=true
		}}if(Env.browser.document.documentElement.getAttribute("debug")=="true"){Env.Options.startOpened=true
		}if(fileOptions){var options=fileOptions.split(",");
		for(var i=0,length=options.length;
		i<length;
		i++){var option=options[i];
		var name,value;
		if(option.indexOf("=")!=-1){var parts=option.split("=");
		name=parts[0];
		value=eval(unescape(parts[1]))
		}else{name=option;
		value=true
		}if(name=="debug"){Env.isDebugMode=!!value
		}else{if(name in Env.Options){Env.Options[name]=value
		}else{Env[name]=value
		}}}}if(hasSrcAttribute){var innerOptions=FBL.trim(script.innerHTML);
		if(innerOptions){var innerOptionsObject=eval("("+innerOptions+")");
		for(var name in innerOptionsObject){var value=innerOptionsObject[name];
		if(name=="debug"){Env.isDebugMode=!!value
		}else{if(name in Env.Options){Env.Options[name]=value
		}else{Env[name]=value
		}}}}}if(!Env.Options.saveCookies){FBL.Store.remove("FirebugLite")
		}if(Env.isDebugMode){Env.Options.startOpened=true;
		Env.Options.enableTrace=true;
		Env.Options.disableWhenFirebugActive=false
		}var loc=Env.Location;
		var isProductionRelease=path.indexOf(productionDir)!=-1;
		loc.sourceDir=path;
		loc.baseDir=path.substr(0,path.length-m[1].length-1);
		loc.skinDir=(isProductionRelease?path:loc.baseDir)+"skin/"+Env.skin+"/";
		loc.skin=loc.skinDir+"firebug.html";
		loc.app=path+fileName
		}else{throw new Error("Firebug Error: Library path not found")
		}};
		this.bind=function(){var args=cloneArray(arguments),fn=args.shift(),object=args.shift();
		return function(){return fn.apply(object,arrayInsert(cloneArray(args),0,arguments))
		}
		};
		this.bindFixed=function(){var args=cloneArray(arguments),fn=args.shift(),object=args.shift();
		return function(){return fn.apply(object,args)
		}
		};
		this.extend=function(l,r){var newOb={};
		for(var n in l){newOb[n]=l[n]
		}for(var n in r){newOb[n]=r[n]
		}return newOb
		};
		this.descend=function(prototypeParent,childProperties){function protoSetter(){}protoSetter.prototype=prototypeParent;
		var newOb=new protoSetter();
		for(var n in childProperties){newOb[n]=childProperties[n]
		}return newOb
		};
		this.append=function(l,r){for(var n in r){l[n]=r[n]
		}return l
		};
		this.keys=function(map){var keys=[];
		try{for(var name in map){keys.push(name)
		}}catch(exc){}return keys
		};
		this.values=function(map){var values=[];
		try{for(var name in map){try{values.push(map[name])
		}catch(exc){if(FBTrace.DBG_ERRORS){FBTrace.sysout("lib.values FAILED ",exc)
		}}}}catch(exc){if(FBTrace.DBG_ERRORS){FBTrace.sysout("lib.values FAILED ",exc)
		}}return values
		};
		this.remove=function(list,item){for(var i=0;
		i<list.length;
		++i){if(list[i]==item){list.splice(i,1);
		break
		}}};
		this.sliceArray=function(array,index){var slice=[];
		for(var i=index;
		i<array.length;
		++i){slice.push(array[i])
		}return slice
		};
		function cloneArray(array,fn){var newArray=[];
		if(fn){for(var i=0;
		i<array.length;
		++i){newArray.push(fn(array[i]))
		}}else{for(var i=0;
		i<array.length;
		++i){newArray.push(array[i])
		}}return newArray
		}function extendArray(array,array2){var newArray=[];
		newArray.push.apply(newArray,array);
		newArray.push.apply(newArray,array2);
		return newArray
		}this.extendArray=extendArray;
		this.cloneArray=cloneArray;
		function arrayInsert(array,index,other){for(var i=0;
		i<other.length;
		++i){array.splice(i+index,0,other[i])
		}return array
		}this.createStyleSheet=function(doc,url){var style=this.createElement("link");
		style.setAttribute("charset","utf-8");
		style.firebugIgnore=true;
		style.setAttribute("rel","stylesheet");
		style.setAttribute("type","text/css");
		style.setAttribute("href",url);
		return style
		};
		this.addStyleSheet=function(doc,style){var heads=doc.getElementsByTagName("head");
		if(heads.length){heads[0].appendChild(style)
		}else{doc.documentElement.appendChild(style)
		}};
		this.appendStylesheet=function(doc,uri){if(this.$(uri,doc)){return
		}var styleSheet=this.createStyleSheet(doc,uri);
		styleSheet.setAttribute("id",uri);
		this.addStyleSheet(doc,styleSheet)
		};
		this.addScript=function(doc,id,src){var element=doc.createElementNS("http://www.w3.org/1999/xhtml","html:script");
		element.setAttribute("type","text/javascript");
		element.setAttribute("id",id);
		if(!FBTrace.DBG_CONSOLE){FBL.unwrapObject(element).firebugIgnore=true
		}element.innerHTML=src;
		if(doc.documentElement){doc.documentElement.appendChild(element)
		}else{if(FBTrace.DBG_ERRORS){FBTrace.sysout("lib.addScript doc has no documentElement:",doc)
		}}return element
		};
		this.getStyle=this.isIE?function(el,name){return el.currentStyle[name]||el.style[name]||undefined
		}:function(el,name){return el.ownerDocument.defaultView.getComputedStyle(el,null)[name]||el.style[name]||undefined
		};
		var entityConversionLists=this.entityConversionLists={normal:{whitespace:{"\t":"\u200c\u2192","\n":"\u200c\u00b6","\r":"\u200c\u00ac"," ":"\u200c\u00b7"}},reverse:{whitespace:{"&Tab;":"\t","&NewLine;":"\n","\u200c\u2192":"\t","\u200c\u00b6":"\n","\u200c\u00ac":"\r","\u200c\u00b7":" "}}};
		var normal=entityConversionLists.normal,reverse=entityConversionLists.reverse;
		function addEntityMapToList(ccode,entity){var lists=Array.prototype.slice.call(arguments,2),len=lists.length,ch=String.fromCharCode(ccode);
		for(var i=0;
		i<len;
		i++){var list=lists[i];
		normal[list]=normal[list]||{};
		normal[list][ch]="&"+entity+";";
		reverse[list]=reverse[list]||{};
		reverse[list]["&"+entity+";"]=ch
		}}var e=addEntityMapToList,white="whitespace",text="text",attr="attributes",css="css",editor="editor";
		e(34,"quot",attr,css);
		e(38,"amp",attr,text,css);
		e(39,"apos",css);
		e(60,"lt",attr,text,css);
		e(62,"gt",attr,text,css);
		e(169,"copy",text,editor);
		e(174,"reg",text,editor);
		e(8482,"trade",text,editor);
		e(8210,"#8210",attr,text,editor);
		e(8211,"ndash",attr,text,editor);
		e(8212,"mdash",attr,text,editor);
		e(8213,"#8213",attr,text,editor);
		e(160,"nbsp",attr,text,white,editor);
		e(8194,"ensp",attr,text,white,editor);
		e(8195,"emsp",attr,text,white,editor);
		e(8201,"thinsp",attr,text,white,editor);
		e(8204,"zwnj",attr,text,white,editor);
		e(8205,"zwj",attr,text,white,editor);
		e(8206,"lrm",attr,text,white,editor);
		e(8207,"rlm",attr,text,white,editor);
		e(8203,"#8203",attr,text,white,editor);
		var entityConversionRegexes={normal:{},reverse:{}};
		var escapeEntitiesRegEx={normal:function(list){var chars=[];
		for(var ch in list){chars.push(ch)
		}return new RegExp("(["+chars.join("")+"])","gm")
		},reverse:function(list){var chars=[];
		for(var ch in list){chars.push(ch)
		}return new RegExp("("+chars.join("|")+")","gm")
		}};
		function getEscapeRegexp(direction,lists){var name="",re;
		var groups=[].concat(lists);
		for(i=0;
		i<groups.length;
		i++){name+=groups[i].group
		}re=entityConversionRegexes[direction][name];
		if(!re){var list={};
		if(groups.length>1){for(var i=0;
		i<groups.length;
		i++){var aList=entityConversionLists[direction][groups[i].group];
		for(var item in aList){list[item]=aList[item]
		}}}else{if(groups.length==1){list=entityConversionLists[direction][groups[0].group]
		}else{list={}
		}}re=entityConversionRegexes[direction][name]=escapeEntitiesRegEx[direction](list)
		}return re
		}function createSimpleEscape(name,direction){return function(value){var list=entityConversionLists[direction][name];
		return String(value).replace(getEscapeRegexp(direction,{group:name,list:list}),function(ch){return list[ch]
		})
		}
		}function escapeGroupsForEntities(str,lists){lists=[].concat(lists);
		var re=getEscapeRegexp("normal",lists),split=String(str).split(re),len=split.length,results=[],cur,r,i,ri=0,l,list,last="";
		if(!len){return[{str:String(str),group:"",name:""}]
		}for(i=0;
		i<len;
		i++){cur=split[i];
		if(cur==""){continue
		}for(l=0;
		l<lists.length;
		l++){list=lists[l];
		r=entityConversionLists.normal[list.group][cur];
		if(r){results[ri]={str:r,"class":list["class"],extra:list.extra[cur]?list["class"]+list.extra[cur]:""};
		break
		}}if(!r){results[ri]={str:cur,"class":"",extra:""}
		}ri++
		}return results
		}this.escapeGroupsForEntities=escapeGroupsForEntities;
		function unescapeEntities(str,lists){var re=getEscapeRegexp("reverse",lists),split=String(str).split(re),len=split.length,results=[],cur,r,i,ri=0,l,list;
		if(!len){return str
		}lists=[].concat(lists);
		for(i=0;
		i<len;
		i++){cur=split[i];
		if(cur==""){continue
		}for(l=0;
		l<lists.length;
		l++){list=lists[l];
		r=entityConversionLists.reverse[list.group][cur];
		if(r){results[ri]=r;
		break
		}}if(!r){results[ri]=cur
		}ri++
		}return results.join("")||""
		}var escapeForTextNode=this.escapeForTextNode=createSimpleEscape("text","normal");
		var escapeForHtmlEditor=this.escapeForHtmlEditor=createSimpleEscape("editor","normal");
		var escapeForElementAttribute=this.escapeForElementAttribute=createSimpleEscape("attributes","normal");
		var escapeForCss=this.escapeForCss=createSimpleEscape("css","normal");
		var escapeForSourceLine=this.escapeForSourceLine=createSimpleEscape("text","normal");
		var unescapeWhitespace=createSimpleEscape("whitespace","reverse");
		this.unescapeForTextNode=function(str){if(Firebug.showTextNodesWithWhitespace){str=unescapeWhitespace(str)
		}if(!Firebug.showTextNodesWithEntities){str=escapeForElementAttribute(str)
		}return str
		};
		this.escapeNewLines=function(value){return value.replace(/\r/g,"\\r").replace(/\n/g,"\\n")
		};
		this.stripNewLines=function(value){return typeof(value)=="string"?value.replace(/[\r\n]/g," "):value
		};
		this.escapeJS=function(value){return value.replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace('"','\\"',"g")
		};
		function escapeHTMLAttribute(value){function replaceChars(ch){switch(ch){case"&":return"&amp;";
		case"'":return apos;
		case'"':return quot
		}return"?"
		}var apos="&#39;",quot="&quot;",around='"';
		if(value.indexOf('"')==-1){quot='"';
		apos="'"
		}else{if(value.indexOf("'")==-1){quot='"';
		around="'"
		}}return around+(String(value).replace(/[&'"]/g,replaceChars))+around
		}function escapeHTML(value){function replaceChars(ch){switch(ch){case"<":return"&lt;";
		case">":return"&gt;";
		case"&":return"&amp;";
		case"'":return"&#39;";
		case'"':return"&quot;"
		}return"?"
		}return String(value).replace(/[<>&"']/g,replaceChars)
		}this.escapeHTML=escapeHTML;
		this.cropString=function(text,limit){text=text+"";
		if(!limit){var halfLimit=50
		}else{var halfLimit=limit/2
		}if(text.length>limit){return this.escapeNewLines(text.substr(0,halfLimit)+"..."+text.substr(text.length-halfLimit))
		}else{return this.escapeNewLines(text)
		}};
		this.isWhitespace=function(text){return !reNotWhitespace.exec(text)
		};
		this.splitLines=function(text){var reSplitLines2=/.*(:?\r\n|\n|\r)?/mg;
		var lines;
		if(text.match){lines=text.match(reSplitLines2)
		}else{var str=text+"";
		lines=str.match(reSplitLines2)
		}lines.pop();
		return lines
		};
		this.safeToString=function(ob){if(this.isIE){try{return ob+""
		}catch(E){FBTrace.sysout("Lib.safeToString() failed for ",ob);
		return""
		}}try{if(ob&&"toString" in ob&&typeof ob.toString=="function"){return ob.toString()
		}}catch(exc){return ob+""
		}};
		this.hasProperties=function(ob){try{for(var name in ob){return true
		}}catch(exc){}return false
		};
		var reTrim=/^\s+|\s+$/g;
		this.trim=function(s){return s.replace(reTrim,"")
		};
		this.emptyFn=function(){};
		this.isVisible=function(elt){return this.getStyle(elt,"visibility")!="hidden"&&(elt.offsetWidth>0||elt.offsetHeight>0||elt.tagName in invisibleTags||elt.namespaceURI=="http://www.w3.org/2000/svg"||elt.namespaceURI=="http://www.w3.org/1998/Math/MathML")
		};
		this.collapse=function(elt,collapsed){if(this.isIElt8){if(collapsed){this.setClass(elt,"collapsed")
		}else{this.removeClass(elt,"collapsed")
		}}else{elt.setAttribute("collapsed",collapsed?"true":"false")
		}};
		this.obscure=function(elt,obscured){if(obscured){this.setClass(elt,"obscured")
		}else{this.removeClass(elt,"obscured")
		}};
		this.hide=function(elt,hidden){elt.style.visibility=hidden?"hidden":"visible"
		};
		this.clearNode=function(node){var nodeName=" "+node.nodeName.toLowerCase()+" ";
		var ignoreTags=" table tbody thead tfoot th tr td ";
		if(this.isIE&&ignoreTags.indexOf(nodeName)!=-1){this.eraseNode(node)
		}else{node.innerHTML=""
		}};
		this.eraseNode=function(node){while(node.lastChild){node.removeChild(node.lastChild)
		}};
		this.iterateWindows=function(win,handler){if(!win||!win.document){return
		}handler(win);
		if(win==top||!win.frames){return
		}for(var i=0;
		i<win.frames.length;
		++i){var subWin=win.frames[i];
		if(subWin!=win){this.iterateWindows(subWin,handler)
		}}};
		this.getRootWindow=function(win){for(;
		win;
		win=win.parent){if(!win.parent||win==win.parent||!this.instanceOf(win.parent,"Window")){return win
		}}return null
		};
		this.getClientOffset=function(elt){var addOffset=function addOffset(elt,coords,view){var p=elt.offsetParent;
		var chrome=Firebug.chrome;
		if(elt.offsetLeft){coords.x+=elt.offsetLeft+chrome.getMeasurementInPixels(elt,"borderLeft")
		}if(elt.offsetTop){coords.y+=elt.offsetTop+chrome.getMeasurementInPixels(elt,"borderTop")
		}if(p){if(p.nodeType==1){addOffset(p,coords,view)
		}}else{var otherView=isIE?elt.ownerDocument.parentWindow:elt.ownerDocument.defaultView;
		if(!otherView.opener&&otherView.frameElement){addOffset(otherView.frameElement,coords,otherView)
		}}};
		var isIE=this.isIE;
		var coords={x:0,y:0};
		if(elt){var view=isIE?elt.ownerDocument.parentWindow:elt.ownerDocument.defaultView;
		addOffset(elt,coords,view)
		}return coords
		};
		this.getViewOffset=function(elt,singleFrame){function addOffset(elt,coords,view){var p=elt.offsetParent;
		coords.x+=elt.offsetLeft-(p?p.scrollLeft:0);
		coords.y+=elt.offsetTop-(p?p.scrollTop:0);
		if(p){if(p.nodeType==1){var parentStyle=view.getComputedStyle(p,"");
		if(parentStyle.position!="static"){coords.x+=parseInt(parentStyle.borderLeftWidth);
		coords.y+=parseInt(parentStyle.borderTopWidth);
		if(p.localName=="TABLE"){coords.x+=parseInt(parentStyle.paddingLeft);
		coords.y+=parseInt(parentStyle.paddingTop)
		}else{if(p.localName=="BODY"){var style=view.getComputedStyle(elt,"");
		coords.x+=parseInt(style.marginLeft);
		coords.y+=parseInt(style.marginTop)
		}}}else{if(p.localName=="BODY"){coords.x+=parseInt(parentStyle.borderLeftWidth);
		coords.y+=parseInt(parentStyle.borderTopWidth)
		}}var parent=elt.parentNode;
		while(p!=parent){coords.x-=parent.scrollLeft;
		coords.y-=parent.scrollTop;
		parent=parent.parentNode
		}addOffset(p,coords,view)
		}}else{if(elt.localName=="BODY"){var style=view.getComputedStyle(elt,"");
		coords.x+=parseInt(style.borderLeftWidth);
		coords.y+=parseInt(style.borderTopWidth);
		var htmlStyle=view.getComputedStyle(elt.parentNode,"");
		coords.x-=parseInt(htmlStyle.paddingLeft);
		coords.y-=parseInt(htmlStyle.paddingTop)
		}if(elt.scrollLeft){coords.x+=elt.scrollLeft
		}if(elt.scrollTop){coords.y+=elt.scrollTop
		}var win=elt.ownerDocument.defaultView;
		if(win&&(!singleFrame&&win.frameElement)){addOffset(win.frameElement,coords,win)
		}}}var coords={x:0,y:0};
		if(elt){addOffset(elt,coords,elt.ownerDocument.defaultView)
		}return coords
		};
		this.getLTRBWH=function(elt){var bcrect,dims={left:0,top:0,right:0,bottom:0,width:0,height:0};
		if(elt){bcrect=elt.getBoundingClientRect();
		dims.left=bcrect.left;
		dims.top=bcrect.top;
		dims.right=bcrect.right;
		dims.bottom=bcrect.bottom;
		if(bcrect.width){dims.width=bcrect.width;
		dims.height=bcrect.height
		}else{dims.width=dims.right-dims.left;
		dims.height=dims.bottom-dims.top
		}}return dims
		};
		this.applyBodyOffsets=function(elt,clientRect){var od=elt.ownerDocument;
		if(!od.body){return clientRect
		}var style=od.defaultView.getComputedStyle(od.body,null);
		var pos=style.getPropertyValue("position");
		if(pos==="absolute"||pos==="relative"){var borderLeft=parseInt(style.getPropertyValue("border-left-width").replace("px",""),10)||0;
		var borderTop=parseInt(style.getPropertyValue("border-top-width").replace("px",""),10)||0;
		var paddingLeft=parseInt(style.getPropertyValue("padding-left").replace("px",""),10)||0;
		var paddingTop=parseInt(style.getPropertyValue("padding-top").replace("px",""),10)||0;
		var marginLeft=parseInt(style.getPropertyValue("margin-left").replace("px",""),10)||0;
		var marginTop=parseInt(style.getPropertyValue("margin-top").replace("px",""),10)||0;
		var offsetX=borderLeft+paddingLeft+marginLeft;
		var offsetY=borderTop+paddingTop+marginTop;
		clientRect.left-=offsetX;
		clientRect.top-=offsetY;
		clientRect.right-=offsetX;
		clientRect.bottom-=offsetY
		}return clientRect
		};
		this.getOffsetSize=function(elt){return{width:elt.offsetWidth,height:elt.offsetHeight}
		};
		this.getOverflowParent=function(element){for(var scrollParent=element.parentNode;
		scrollParent;
		scrollParent=scrollParent.offsetParent){if(scrollParent.scrollHeight>scrollParent.offsetHeight){return scrollParent
		}}};
		this.isScrolledToBottom=function(element){var onBottom=(element.scrollTop+element.offsetHeight)==element.scrollHeight;
		if(FBTrace.DBG_CONSOLE){FBTrace.sysout("isScrolledToBottom offsetHeight: "+element.offsetHeight+" onBottom:"+onBottom)
		}return onBottom
		};
		this.scrollToBottom=function(element){element.scrollTop=element.scrollHeight;
		if(FBTrace.DBG_CONSOLE){FBTrace.sysout("scrollToBottom reset scrollTop "+element.scrollTop+" = "+element.scrollHeight);
		if(element.scrollHeight==element.offsetHeight){FBTrace.sysout("scrollToBottom attempt to scroll non-scrollable element "+element,element)
		}}return(element.scrollTop==element.scrollHeight)
		};
		this.move=function(element,x,y){element.style.left=x+"px";
		element.style.top=y+"px"
		};
		this.resize=function(element,w,h){element.style.width=w+"px";
		element.style.height=h+"px"
		};
		this.linesIntoCenterView=function(element,scrollBox){if(!scrollBox){scrollBox=this.getOverflowParent(element)
		}if(!scrollBox){return
		}var offset=this.getClientOffset(element);
		var topSpace=offset.y-scrollBox.scrollTop;
		var bottomSpace=(scrollBox.scrollTop+scrollBox.clientHeight)-(offset.y+element.offsetHeight);
		if(topSpace<0||bottomSpace<0){var split=(scrollBox.clientHeight/2);
		var centerY=offset.y-split;
		scrollBox.scrollTop=centerY;
		topSpace=split;
		bottomSpace=split-element.offsetHeight
		}return{before:Math.round((topSpace/element.offsetHeight)+0.5),after:Math.round((bottomSpace/element.offsetHeight)+0.5)}
		};
		this.scrollIntoCenterView=function(element,scrollBox,notX,notY){if(!element){return
		}if(!scrollBox){scrollBox=this.getOverflowParent(element)
		}if(!scrollBox){return
		}var offset=this.getClientOffset(element);
		if(!notY){var topSpace=offset.y-scrollBox.scrollTop;
		var bottomSpace=(scrollBox.scrollTop+scrollBox.clientHeight)-(offset.y+element.offsetHeight);
		if(topSpace<0||bottomSpace<0){var centerY=offset.y-(scrollBox.clientHeight/2);
		scrollBox.scrollTop=centerY
		}}if(!notX){var leftSpace=offset.x-scrollBox.scrollLeft;
		var rightSpace=(scrollBox.scrollLeft+scrollBox.clientWidth)-(offset.x+element.clientWidth);
		if(leftSpace<0||rightSpace<0){var centerX=offset.x-(scrollBox.clientWidth/2);
		scrollBox.scrollLeft=centerX
		}}if(FBTrace.DBG_SOURCEFILES){FBTrace.sysout("lib.scrollIntoCenterView ","Element:"+element.innerHTML)
		}};
		var cssKeywordMap=null;
		var cssPropNames=null;
		var cssColorNames=null;
		var imageRules=null;
		this.getCSSKeywordsByProperty=function(propName){if(!cssKeywordMap){cssKeywordMap={};
		for(var name in this.cssInfo){var list=[];
		var types=this.cssInfo[name];
		for(var i=0;
		i<types.length;
		++i){var keywords=this.cssKeywords[types[i]];
		if(keywords){list.push.apply(list,keywords)
		}}cssKeywordMap[name]=list
		}}return propName in cssKeywordMap?cssKeywordMap[propName]:[]
		};
		this.getCSSPropertyNames=function(){if(!cssPropNames){cssPropNames=[];
		for(var name in this.cssInfo){cssPropNames.push(name)
		}}return cssPropNames
		};
		this.isColorKeyword=function(keyword){if(keyword=="transparent"){return false
		}if(!cssColorNames){cssColorNames=[];
		var colors=this.cssKeywords.color;
		for(var i=0;
		i<colors.length;
		++i){cssColorNames.push(colors[i].toLowerCase())
		}var systemColors=this.cssKeywords.systemColor;
		for(var i=0;
		i<systemColors.length;
		++i){cssColorNames.push(systemColors[i].toLowerCase())
		}}return cssColorNames.indexOf?cssColorNames.indexOf(keyword.toLowerCase())!=-1:(" "+cssColorNames.join(" ")+" ").indexOf(" "+keyword.toLowerCase()+" ")!=-1
		};
		this.isImageRule=function(rule){if(!imageRules){imageRules=[];
		for(var i in this.cssInfo){var r=i.toLowerCase();
		var suffix="image";
		if(r.match(suffix+"$")==suffix||r=="background"){imageRules.push(r)
		}}}return imageRules.indexOf?imageRules.indexOf(rule.toLowerCase())!=-1:(" "+imageRules.join(" ")+" ").indexOf(" "+rule.toLowerCase()+" ")!=-1
		};
		this.copyTextStyles=function(fromNode,toNode,style){var view=this.isIE?fromNode.ownerDocument.parentWindow:fromNode.ownerDocument.defaultView;
		if(view){if(!style){style=this.isIE?fromNode.currentStyle:view.getComputedStyle(fromNode,"")
		}toNode.style.fontFamily=style.fontFamily;
		toNode.style.fontSize=style.fontSize;
		toNode.style.fontWeight=style.fontWeight;
		toNode.style.fontStyle=style.fontStyle;
		return style
		}};
		this.copyBoxStyles=function(fromNode,toNode,style){var view=this.isIE?fromNode.ownerDocument.parentWindow:fromNode.ownerDocument.defaultView;
		if(view){if(!style){style=this.isIE?fromNode.currentStyle:view.getComputedStyle(fromNode,"")
		}toNode.style.marginTop=style.marginTop;
		toNode.style.marginRight=style.marginRight;
		toNode.style.marginBottom=style.marginBottom;
		toNode.style.marginLeft=style.marginLeft;
		toNode.style.borderTopWidth=style.borderTopWidth;
		toNode.style.borderRightWidth=style.borderRightWidth;
		toNode.style.borderBottomWidth=style.borderBottomWidth;
		toNode.style.borderLeftWidth=style.borderLeftWidth;
		return style
		}};
		this.readBoxStyles=function(style){var styleNames={"margin-top":"marginTop","margin-right":"marginRight","margin-left":"marginLeft","margin-bottom":"marginBottom","border-top-width":"borderTop","border-right-width":"borderRight","border-left-width":"borderLeft","border-bottom-width":"borderBottom","padding-top":"paddingTop","padding-right":"paddingRight","padding-left":"paddingLeft","padding-bottom":"paddingBottom","z-index":"zIndex"};
		var styles={};
		for(var styleName in styleNames){styles[styleNames[styleName]]=parseInt(style.getPropertyCSSValue(styleName).cssText)||0
		}if(FBTrace.DBG_INSPECT){FBTrace.sysout("readBoxStyles ",styles)
		}return styles
		};
		this.getBoxFromStyles=function(style,element){var args=this.readBoxStyles(style);
		args.width=element.offsetWidth-(args.paddingLeft+args.paddingRight+args.borderLeft+args.borderRight);
		args.height=element.offsetHeight-(args.paddingTop+args.paddingBottom+args.borderTop+args.borderBottom);
		return args
		};
		this.getElementCSSSelector=function(element){var label=element.localName.toLowerCase();
		if(element.id){label+="#"+element.id
		}if(element.hasAttribute("class")){label+="."+element.getAttribute("class").split(" ")[0]
		}return label
		};
		this.getURLForStyleSheet=function(styleSheet){return(styleSheet.href?styleSheet.href:styleSheet.ownerNode.ownerDocument.URL)
		};
		this.getDocumentForStyleSheet=function(styleSheet){while(styleSheet.parentStyleSheet&&!styleSheet.ownerNode){styleSheet=styleSheet.parentStyleSheet
		}if(styleSheet.ownerNode){return styleSheet.ownerNode.ownerDocument
		}};
		this.getInstanceForStyleSheet=function(styleSheet,ownerDocument){if(FBL.isSystemStyleSheet(styleSheet)){return 0
		}if(FBTrace.DBG_CSS){FBTrace.sysout("getInstanceForStyleSheet: "+styleSheet.href+" "+styleSheet.media.mediaText+" "+(styleSheet.ownerNode&&FBL.getElementXPath(styleSheet.ownerNode)),ownerDocument)
		}ownerDocument=ownerDocument||FBL.getDocumentForStyleSheet(styleSheet);
		var ret=0,styleSheets=ownerDocument.styleSheets,href=styleSheet.href;
		for(var i=0;
		i<styleSheets.length;
		i++){var curSheet=styleSheets[i];
		if(FBTrace.DBG_CSS){FBTrace.sysout("getInstanceForStyleSheet: compare href "+i+" "+curSheet.href+" "+curSheet.media.mediaText+" "+(curSheet.ownerNode&&FBL.getElementXPath(curSheet.ownerNode)))
		}if(curSheet==styleSheet){break
		}if(curSheet.href==href){ret++
		}}return ret
		};
		var getElementType=this.getElementType=function(node){if(isElementXUL(node)){return"xul"
		}else{if(isElementSVG(node)){return"svg"
		}else{if(isElementMathML(node)){return"mathml"
		}else{if(isElementXHTML(node)){return"xhtml"
		}else{if(isElementHTML(node)){return"html"
		}}}}}};
		var getElementSimpleType=this.getElementSimpleType=function(node){if(isElementSVG(node)){return"svg"
		}else{if(isElementMathML(node)){return"mathml"
		}else{return"html"
		}}};
		var isElementHTML=this.isElementHTML=function(node){return node.nodeName==node.nodeName.toUpperCase()
		};
		var isElementXHTML=this.isElementXHTML=function(node){return node.nodeName==node.nodeName.toLowerCase()
		};
		var isElementMathML=this.isElementMathML=function(node){return node.namespaceURI=="http://www.w3.org/1998/Math/MathML"
		};
		var isElementSVG=this.isElementSVG=function(node){return node.namespaceURI=="http://www.w3.org/2000/svg"
		};
		var isElementXUL=this.isElementXUL=function(node){return node instanceof XULElement
		};
		this.isSelfClosing=function(element){if(isElementSVG(element)||isElementMathML(element)){return true
		}var tag=element.localName.toLowerCase();
		return(this.selfClosingTags.hasOwnProperty(tag))
		};
		this.getElementHTML=function(element){var self=this;
		function toHTML(elt){if(elt.nodeType==Node.ELEMENT_NODE){if(unwrapObject(elt).firebugIgnore){return
		}html.push("<",elt.nodeName.toLowerCase());
		for(var i=0;
		i<elt.attributes.length;
		++i){var attr=elt.attributes[i];
		if(attr.localName.indexOf("firebug-")==0){continue
		}if(attr.localName.indexOf("-moz-math")==0){continue
		}html.push(" ",attr.nodeName,'="',escapeForElementAttribute(attr.nodeValue),'"')
		}if(elt.firstChild){html.push(">");
		var pureText=true;
		for(var child=element.firstChild;
		child;
		child=child.nextSibling){pureText=pureText&&(child.nodeType==Node.TEXT_NODE)
		}if(pureText){html.push(escapeForHtmlEditor(elt.textContent))
		}else{for(var child=elt.firstChild;
		child;
		child=child.nextSibling){toHTML(child)
		}}html.push("</",elt.nodeName.toLowerCase(),">")
		}else{if(isElementSVG(elt)||isElementMathML(elt)){html.push("/>")
		}else{if(self.isSelfClosing(elt)){html.push((isElementXHTML(elt))?"/>":">")
		}else{html.push("></",elt.nodeName.toLowerCase(),">")
		}}}}else{if(elt.nodeType==Node.TEXT_NODE){html.push(escapeForTextNode(elt.textContent))
		}else{if(elt.nodeType==Node.CDATA_SECTION_NODE){html.push("<![CDATA[",elt.nodeValue,"]]>")
		}else{if(elt.nodeType==Node.COMMENT_NODE){html.push("<!--",elt.nodeValue,"-->")
		}}}}}var html=[];
		toHTML(element);
		return html.join("")
		};
		this.getElementXML=function(element){function toXML(elt){if(elt.nodeType==Node.ELEMENT_NODE){if(unwrapObject(elt).firebugIgnore){return
		}xml.push("<",elt.nodeName.toLowerCase());
		for(var i=0;
		i<elt.attributes.length;
		++i){var attr=elt.attributes[i];
		if(attr.localName.indexOf("firebug-")==0){continue
		}if(attr.localName.indexOf("-moz-math")==0){continue
		}xml.push(" ",attr.nodeName,'="',escapeForElementAttribute(attr.nodeValue),'"')
		}if(elt.firstChild){xml.push(">");
		for(var child=elt.firstChild;
		child;
		child=child.nextSibling){toXML(child)
		}xml.push("</",elt.nodeName.toLowerCase(),">")
		}else{xml.push("/>")
		}}else{if(elt.nodeType==Node.TEXT_NODE){xml.push(elt.nodeValue)
		}else{if(elt.nodeType==Node.CDATA_SECTION_NODE){xml.push("<![CDATA[",elt.nodeValue,"]]>")
		}else{if(elt.nodeType==Node.COMMENT_NODE){xml.push("<!--",elt.nodeValue,"-->")
		}}}}}var xml=[];
		toXML(element);
		return xml.join("")
		};
		this.hasClass=function(node,name){if(arguments.length==2){return(" "+node.className+" ").indexOf(" "+name+" ")!=-1
		}if(!node||node.nodeType!=1){return false
		}else{for(var i=1;
		i<arguments.length;
		++i){var name=arguments[i];
		var re=new RegExp("(^|\\s)"+name+"($|\\s)");
		if(!re.exec(node.className)){return false
		}}return true
		}};
		this.old_hasClass=function(node,name){if(!node||node.nodeType!=1){return false
		}else{for(var i=1;
		i<arguments.length;
		++i){var name=arguments[i];
		var re=new RegExp("(^|\\s)"+name+"($|\\s)");
		if(!re.exec(node.className)){return false
		}}return true
		}};
		this.setClass=function(node,name){if(node&&(" "+node.className+" ").indexOf(" "+name+" ")==-1){node.className+=" "+name
		}};
		this.getClassValue=function(node,name){var re=new RegExp(name+"-([^ ]+)");
		var m=re.exec(node.className);
		return m?m[1]:""
		};
		this.removeClass=function(node,name){if(node&&node.className){var index=node.className.indexOf(name);
		if(index>=0){var size=name.length;
		node.className=node.className.substr(0,index-1)+node.className.substr(index+size)
		}}};
		this.toggleClass=function(elt,name){if((" "+elt.className+" ").indexOf(" "+name+" ")!=-1){this.removeClass(elt,name)
		}else{this.setClass(elt,name)
		}};
		this.setClassTimed=function(elt,name,context,timeout){if(!timeout){timeout=1300
		}if(elt.__setClassTimeout){context.clearTimeout(elt.__setClassTimeout)
		}else{this.setClass(elt,name)
		}elt.__setClassTimeout=context.setTimeout(function(){delete elt.__setClassTimeout;
		FBL.removeClass(elt,name)
		},timeout)
		};
		this.cancelClassTimed=function(elt,name,context){if(elt.__setClassTimeout){FBL.removeClass(elt,name);
		context.clearTimeout(elt.__setClassTimeout);
		delete elt.__setClassTimeout
		}};
		this.$=function(id,doc){if(doc){return doc.getElementById(id)
		}else{return FBL.Firebug.chrome.document.getElementById(id)
		}};
		this.$$=function(selector,doc){if(doc||!FBL.Firebug.chrome){return FBL.Firebug.Selector(selector,doc)
		}else{return FBL.Firebug.Selector(selector,FBL.Firebug.chrome.document)
		}};
		this.getChildByClass=function(node){for(var i=1;
		i<arguments.length;
		++i){var className=arguments[i];
		var child=node.firstChild;
		node=null;
		for(;
		child;
		child=child.nextSibling){if(this.hasClass(child,className)){node=child;
		break
		}}}return node
		};
		this.getAncestorByClass=function(node,className){for(var parent=node;
		parent;
		parent=parent.parentNode){if(this.hasClass(parent,className)){return parent
		}}return null
		};
		this.getElementsByClass=function(node,className){var result=[];
		for(var child=node.firstChild;
		child;
		child=child.nextSibling){if(this.hasClass(child,className)){result.push(child)
		}}return result
		};
		this.getElementByClass=function(node,className){var args=cloneArray(arguments);
		args.splice(0,1);
		for(var child=node.firstChild;
		child;
		child=child.nextSibling){var args1=cloneArray(args);
		args1.unshift(child);
		if(FBL.hasClass.apply(null,args1)){return child
		}else{var found=FBL.getElementByClass.apply(null,args1);
		if(found){return found
		}}}return null
		};
		this.isAncestor=function(node,potentialAncestor){for(var parent=node;
		parent;
		parent=parent.parentNode){if(parent==potentialAncestor){return true
		}}return false
		};
		this.getNextElement=function(node){while(node&&node.nodeType!=1){node=node.nextSibling
		}return node
		};
		this.getPreviousElement=function(node){while(node&&node.nodeType!=1){node=node.previousSibling
		}return node
		};
		this.getBody=function(doc){if(doc.body){return doc.body
		}var body=doc.getElementsByTagName("body")[0];
		if(body){return body
		}return doc.firstChild
		};
		this.findNextDown=function(node,criteria){if(!node){return null
		}for(var child=node.firstChild;
		child;
		child=child.nextSibling){if(criteria(child)){return child
		}var next=this.findNextDown(child,criteria);
		if(next){return next
		}}};
		this.findPreviousUp=function(node,criteria){if(!node){return null
		}for(var child=node.lastChild;
		child;
		child=child.previousSibling){var next=this.findPreviousUp(child,criteria);
		if(next){return next
		}if(criteria(child)){return child
		}}};
		this.findNext=function(node,criteria,upOnly,maxRoot){if(!node){return null
		}if(!upOnly){var next=this.findNextDown(node,criteria);
		if(next){return next
		}}for(var sib=node.nextSibling;
		sib;
		sib=sib.nextSibling){if(criteria(sib)){return sib
		}var next=this.findNextDown(sib,criteria);
		if(next){return next
		}}if(node.parentNode&&node.parentNode!=maxRoot){return this.findNext(node.parentNode,criteria,true)
		}};
		this.findPrevious=function(node,criteria,downOnly,maxRoot){if(!node){return null
		}for(var sib=node.previousSibling;
		sib;
		sib=sib.previousSibling){var prev=this.findPreviousUp(sib,criteria);
		if(prev){return prev
		}if(criteria(sib)){return sib
		}}if(!downOnly){var next=this.findPreviousUp(node,criteria);
		if(next){return next
		}}if(node.parentNode&&node.parentNode!=maxRoot){if(criteria(node.parentNode)){return node.parentNode
		}return this.findPrevious(node.parentNode,criteria,true)
		}};
		this.getNextByClass=function(root,state){var iter=function iter(node){return node.nodeType==1&&FBL.hasClass(node,state)
		};
		return this.findNext(root,iter)
		};
		this.getPreviousByClass=function(root,state){var iter=function iter(node){return node.nodeType==1&&FBL.hasClass(node,state)
		};
		return this.findPrevious(root,iter)
		};
		this.isElement=function(o){try{return o&&this.instanceOf(o,"Element")
		}catch(ex){return false
		}};
		var appendFragment=null;
		this.appendInnerHTML=function(element,html,referenceElement){referenceElement=referenceElement||null;
		var doc=element.ownerDocument;
		if(doc.createRange){var range=doc.createRange();
		range.selectNodeContents(element);
		var fragment=range.createContextualFragment(html);
		var firstChild=fragment.firstChild;
		element.insertBefore(fragment,referenceElement)
		}else{if(!appendFragment||appendFragment.ownerDocument!=doc){appendFragment=doc.createDocumentFragment()
		}var div=doc.createElement("div");
		div.innerHTML=html;
		var firstChild=div.firstChild;
		while(div.firstChild){appendFragment.appendChild(div.firstChild)
		}element.insertBefore(appendFragment,referenceElement);
		div=null
		}return firstChild
		};
		this.createElement=function(tagName,properties){properties=properties||{};
		var doc=properties.document||FBL.Firebug.chrome.document;
		var element=doc.createElement(tagName);
		for(var name in properties){if(name!="document"){element[name]=properties[name]
		}}return element
		};
		this.createGlobalElement=function(tagName,properties){properties=properties||{};
		var doc=FBL.Env.browser.document;
		var element=this.NS&&doc.createElementNS?doc.createElementNS(FBL.NS,tagName):doc.createElement(tagName);
		for(var name in properties){var propname=name;
		if(FBL.isIE&&name=="class"){propname="className"
		}if(name!="document"){element.setAttribute(propname,properties[name])
		}}return element
		};
		this.safeGetWindowLocation=function(window){try{if(window){if(window.closed){return"(window.closed)"
		}if("location" in window){return window.location+""
		}else{return"(no window.location)"
		}}else{return"(no context.window)"
		}}catch(exc){if(FBTrace.DBG_WINDOWS||FBTrace.DBG_ERRORS){FBTrace.sysout("TabContext.getWindowLocation failed "+exc,exc)
		}FBTrace.sysout("TabContext.getWindowLocation failed window:",window);
		return"(getWindowLocation: "+exc+")"
		}};
		this.isLeftClick=function(event){return(this.isIE&&event.type!="click"&&event.type!="dblclick"?event.button==1:event.button==0)&&this.noKeyModifiers(event)
		};
		this.isMiddleClick=function(event){return(this.isIE&&event.type!="click"&&event.type!="dblclick"?event.button==4:event.button==1)&&this.noKeyModifiers(event)
		};
		this.isRightClick=function(event){return(this.isIE&&event.type!="click"&&event.type!="dblclick"?event.button==2:event.button==2)&&this.noKeyModifiers(event)
		};
		this.noKeyModifiers=function(event){return !event.ctrlKey&&!event.shiftKey&&!event.altKey&&!event.metaKey
		};
		this.isControlClick=function(event){return(this.isIE&&event.type!="click"&&event.type!="dblclick"?event.button==1:event.button==0)&&this.isControl(event)
		};
		this.isShiftClick=function(event){return(this.isIE&&event.type!="click"&&event.type!="dblclick"?event.button==1:event.button==0)&&this.isShift(event)
		};
		this.isControl=function(event){return(event.metaKey||event.ctrlKey)&&!event.shiftKey&&!event.altKey
		};
		this.isAlt=function(event){return event.altKey&&!event.ctrlKey&&!event.shiftKey&&!event.metaKey
		};
		this.isAltClick=function(event){return(this.isIE&&event.type!="click"&&event.type!="dblclick"?event.button==1:event.button==0)&&this.isAlt(event)
		};
		this.isControlShift=function(event){return(event.metaKey||event.ctrlKey)&&event.shiftKey&&!event.altKey
		};
		this.isShift=function(event){return event.shiftKey&&!event.metaKey&&!event.ctrlKey&&!event.altKey
		};
		this.addEvent=function(object,name,handler,useCapture){if(object.addEventListener){object.addEventListener(name,handler,useCapture)
		}else{object.attachEvent("on"+name,handler)
		}};
		this.removeEvent=function(object,name,handler,useCapture){try{if(object.removeEventListener){object.removeEventListener(name,handler,useCapture)
		}else{object.detachEvent("on"+name,handler)
		}}catch(e){if(FBTrace.DBG_ERRORS){FBTrace.sysout("FBL.removeEvent error: ",object,name)
		}}};
		this.cancelEvent=function(e,preventDefault){if(!e){return
		}if(preventDefault){if(e.preventDefault){e.preventDefault()
		}else{e.returnValue=false
		}}if(e.stopPropagation){e.stopPropagation()
		}else{e.cancelBubble=true
		}};
		this.addGlobalEvent=function(name,handler){var doc=this.Firebug.browser.document;
		var frames=this.Firebug.browser.window.frames;
		this.addEvent(doc,name,handler);
		if(this.Firebug.chrome.type=="popup"){this.addEvent(this.Firebug.chrome.document,name,handler)
		}for(var i=0,frame;
		frame=frames[i];
		i++){try{this.addEvent(frame.document,name,handler)
		}catch(E){}}};
		this.removeGlobalEvent=function(name,handler){var doc=this.Firebug.browser.document;
		var frames=this.Firebug.browser.window.frames;
		this.removeEvent(doc,name,handler);
		if(this.Firebug.chrome.type=="popup"){this.removeEvent(this.Firebug.chrome.document,name,handler)
		}for(var i=0,frame;
		frame=frames[i];
		i++){try{this.removeEvent(frame.document,name,handler)
		}catch(E){}}};
		this.dispatch=function(listeners,name,args){if(!listeners){return
		}try{if(typeof listeners.length!="undefined"){if(FBTrace.DBG_DISPATCH){FBTrace.sysout("FBL.dispatch",name+" to "+listeners.length+" listeners")
		}for(var i=0;
		i<listeners.length;
		++i){var listener=listeners[i];
		if(listener[name]){listener[name].apply(listener,args)
		}}}else{if(FBTrace.DBG_DISPATCH){FBTrace.sysout("FBL.dispatch",name+" to listeners of an object")
		}for(var prop in listeners){var listener=listeners[prop];
		if(listener[name]){listener[name].apply(listener,args)
		}}}}catch(exc){if(FBTrace.DBG_ERRORS){FBTrace.sysout(" Exception in lib.dispatch "+name,exc)
		}}};
		var disableTextSelectionHandler=function(event){FBL.cancelEvent(event,true);
		return false
		};
		this.disableTextSelection=function(e){if(typeof e.onselectstart!="undefined"){this.addEvent(e,"selectstart",disableTextSelectionHandler)
		}else{e.style.cssText="user-select: none; -khtml-user-select: none; -moz-user-select: none;";
		if(!this.isFirefox){this.addEvent(e,"mousedown",disableTextSelectionHandler)
		}}e.style.cursor="default"
		};
		this.restoreTextSelection=function(e){if(typeof e.onselectstart!="undefined"){this.removeEvent(e,"selectstart",disableTextSelectionHandler)
		}else{e.style.cssText="cursor: default;";
		if(!this.isFirefox){this.removeEvent(e,"mousedown",disableTextSelectionHandler)
		}}};
		var eventTypes={composition:["composition","compositionstart","compositionend"],contextmenu:["contextmenu"],drag:["dragenter","dragover","dragexit","dragdrop","draggesture"],focus:["focus","blur"],form:["submit","reset","change","select","input"],key:["keydown","keyup","keypress"],load:["load","beforeunload","unload","abort","error"],mouse:["mousedown","mouseup","click","dblclick","mouseover","mouseout","mousemove"],mutation:["DOMSubtreeModified","DOMNodeInserted","DOMNodeRemoved","DOMNodeRemovedFromDocument","DOMNodeInsertedIntoDocument","DOMAttrModified","DOMCharacterDataModified"],paint:["paint","resize","scroll"],scroll:["overflow","underflow","overflowchanged"],text:["text"],ui:["DOMActivate","DOMFocusIn","DOMFocusOut"],xul:["popupshowing","popupshown","popuphiding","popuphidden","close","command","broadcast","commandupdate"]};
		this.getEventFamily=function(eventType){if(!this.families){this.families={};
		for(var family in eventTypes){var types=eventTypes[family];
		for(var i=0;
		i<types.length;
		++i){this.families[types[i]]=family
		}}}return this.families[eventType]
		};
		this.getFileName=function(url){var split=this.splitURLBase(url);
		return split.name
		};
		this.splitURLBase=function(url){if(this.isDataURL(url)){return this.splitDataURL(url)
		}return this.splitURLTrue(url)
		};
		this.splitDataURL=function(url){var mark=url.indexOf(":",3);
		if(mark!=4){return false
		}var point=url.indexOf(",",mark+1);
		if(point<mark){return false
		}var props={encodedContent:url.substr(point+1)};
		var metadataBuffer=url.substr(mark+1,point);
		var metadata=metadataBuffer.split(";");
		for(var i=0;
		i<metadata.length;
		i++){var nv=metadata[i].split("=");
		if(nv.length==2){props[nv[0]]=nv[1]
		}}if(props.hasOwnProperty("fileName")){var caller_URL=decodeURIComponent(props.fileName);
		var caller_split=this.splitURLTrue(caller_URL);
		if(props.hasOwnProperty("baseLineNumber")){props.path=caller_split.path;
		props.line=props.baseLineNumber;
		var hint=decodeURIComponent(props.encodedContent.substr(0,200)).replace(/\s*$/,"");
		props.name="eval->"+hint
		}else{props.name=caller_split.name;
		props.path=caller_split.path
		}}else{if(!props.hasOwnProperty("path")){props.path="data:"
		}if(!props.hasOwnProperty("name")){props.name=decodeURIComponent(props.encodedContent.substr(0,200)).replace(/\s*$/,"")
		}}return props
		};
		this.splitURLTrue=function(url){var m=reSplitFile.exec(url);
		if(!m){return{name:url,path:url}
		}else{if(!m[2]){return{path:m[1],name:m[1]}
		}else{return{path:m[1],name:m[2]+m[3]}
		}}};
		this.getFileExtension=function(url){if(!url){return null
		}var queryString=url.indexOf("?");
		if(queryString!=-1){url=url.substr(0,queryString)
		}var lastDot=url.lastIndexOf(".");
		return url.substr(lastDot+1)
		};
		this.isSystemURL=function(url){if(!url){return true
		}if(url.length==0){return true
		}if(url[0]=="h"){return false
		}if(url.substr(0,9)=="resource:"){return true
		}else{if(url.substr(0,16)=="chrome://firebug"){return true
		}else{if(url=="XPCSafeJSObjectWrapper.cpp"){return true
		}else{if(url.substr(0,6)=="about:"){return true
		}else{if(url.indexOf("firebug-service.js")!=-1){return true
		}else{return false
		}}}}}};
		this.isSystemPage=function(win){try{var doc=win.document;
		if(!doc){return false
		}if((doc.styleSheets.length&&doc.styleSheets[0].href=="chrome://global/content/xml/XMLPrettyPrint.css")||(doc.styleSheets.length>1&&doc.styleSheets[1].href=="chrome://browser/skin/feeds/subscribe.css")){return true
		}return FBL.isSystemURL(win.location.href)
		}catch(exc){ERROR("tabWatcher.isSystemPage document not ready:"+exc);
		return false
		}};
		this.isSystemStyleSheet=function(sheet){var href=sheet&&sheet.href;
		return href&&FBL.isSystemURL(href)
		};
		this.getURIHost=function(uri){try{if(uri){return uri.host
		}else{return""
		}}catch(exc){return""
		}};
		this.isLocalURL=function(url){if(url.substr(0,5)=="file:"){return true
		}else{if(url.substr(0,8)=="wyciwyg:"){return true
		}else{return false
		}}};
		this.isDataURL=function(url){return(url&&url.substr(0,5)=="data:")
		};
		this.getLocalPath=function(url){if(this.isLocalURL(url)){var fileHandler=ioService.getProtocolHandler("file").QueryInterface(Ci.nsIFileProtocolHandler);
		var file=fileHandler.getFileFromURLSpec(url);
		return file.path
		}};
		this.getURLFromLocalFile=function(file){var fileHandler=ioService.getProtocolHandler("file").QueryInterface(Ci.nsIFileProtocolHandler);
		var URL=fileHandler.getURLSpecFromFile(file);
		return URL
		};
		this.getDataURLForContent=function(content,url){var uri="data:text/html;";
		uri+="fileName="+encodeURIComponent(url)+",";
		uri+=encodeURIComponent(content);
		return uri
		},this.getDomain=function(url){var m=/[^:]+:\/{1,3}([^\/]+)/.exec(url);
		return m?m[1]:""
		};
		this.getURLPath=function(url){var m=/[^:]+:\/{1,3}[^\/]+(\/.*?)$/.exec(url);
		return m?m[1]:""
		};
		this.getPrettyDomain=function(url){var m=/[^:]+:\/{1,3}(www\.)?([^\/]+)/.exec(url);
		return m?m[2]:""
		};
		this.absoluteURL=function(url,baseURL){return this.absoluteURLWithDots(url,baseURL).replace("/./","/","g")
		};
		this.absoluteURLWithDots=function(url,baseURL){if(url[0]=="?"){return baseURL+url
		}var reURL=/(([^:]+:)\/{1,2}[^\/]*)(.*?)$/;
		var m=reURL.exec(url);
		if(m){return url
		}var m=reURL.exec(baseURL);
		if(!m){return""
		}var head=m[1];
		var tail=m[3];
		if(url.substr(0,2)=="//"){return m[2]+url
		}else{if(url[0]=="/"){return head+url
		}else{if(tail[tail.length-1]=="/"){return baseURL+url
		}else{var parts=tail.split("/");
		return head+parts.slice(0,parts.length-1).join("/")+"/"+url
		}}}};
		this.normalizeURL=function(url){if(!url){return""
		}if(url.length<255){url=url.replace(/[^\/]+\/\.\.\//,"","g");
		url=url.replace(/#.*/,"");
		url=url.replace(/file:\/([^\/])/g,"file:///$1");
		if(url.indexOf("chrome:")==0){var m=reChromeCase.exec(url);
		if(m){url="chrome://"+m[1].toLowerCase()+"/"+m[2]
		}}}return url
		};
		this.denormalizeURL=function(url){return url.replace(/file:\/\/\//g,"file:/")
		};
		this.parseURLParams=function(url){var q=url?url.indexOf("?"):-1;
		if(q==-1){return[]
		}var search=url.substr(q+1);
		var h=search.lastIndexOf("#");
		if(h!=-1){search=search.substr(0,h)
		}if(!search){return[]
		}return this.parseURLEncodedText(search)
		};
		this.parseURLEncodedText=function(text){var maxValueLength=25000;
		var params=[];
		text=text.replace(/\+/g," ");
		var args=text.split("&");
		for(var i=0;
		i<args.length;
		++i){try{var parts=args[i].split("=");
		if(parts.length==2){if(parts[1].length>maxValueLength){parts[1]=this.$STR("LargeData")
		}params.push({name:decodeURIComponent(parts[0]),value:decodeURIComponent(parts[1])})
		}else{params.push({name:decodeURIComponent(parts[0]),value:""})
		}}catch(e){if(FBTrace.DBG_ERRORS){FBTrace.sysout("parseURLEncodedText EXCEPTION ",e);
		FBTrace.sysout("parseURLEncodedText EXCEPTION URI",args[i])
		}}}params.sort(function(a,b){return a.name<=b.name?-1:1
		});
		return params
		};
		this.parseURLParamsArray=function(url){var q=url?url.indexOf("?"):-1;
		if(q==-1){return[]
		}var search=url.substr(q+1);
		var h=search.lastIndexOf("#");
		if(h!=-1){search=search.substr(0,h)
		}if(!search){return[]
		}return this.parseURLEncodedTextArray(search)
		};
		this.parseURLEncodedTextArray=function(text){var maxValueLength=25000;
		var params=[];
		text=text.replace(/\+/g," ");
		var args=text.split("&");
		for(var i=0;
		i<args.length;
		++i){try{var parts=args[i].split("=");
		if(parts.length==2){if(parts[1].length>maxValueLength){parts[1]=this.$STR("LargeData")
		}params.push({name:decodeURIComponent(parts[0]),value:[decodeURIComponent(parts[1])]})
		}else{params.push({name:decodeURIComponent(parts[0]),value:[""]})
		}}catch(e){if(FBTrace.DBG_ERRORS){FBTrace.sysout("parseURLEncodedText EXCEPTION ",e);
		FBTrace.sysout("parseURLEncodedText EXCEPTION URI",args[i])
		}}}params.sort(function(a,b){return a.name<=b.name?-1:1
		});
		return params
		};
		this.reEncodeURL=function(file,text){var lines=text.split("\n");
		var params=this.parseURLEncodedText(lines[lines.length-1]);
		var args=[];
		for(var i=0;
		i<params.length;
		++i){args.push(encodeURIComponent(params[i].name)+"="+encodeURIComponent(params[i].value))
		}var url=file.href;
		url+=(url.indexOf("?")==-1?"?":"&")+args.join("&");
		return url
		};
		this.getResource=function(aURL){try{var channel=ioService.newChannel(aURL,null,null);
		var input=channel.open();
		return FBL.readFromStream(input)
		}catch(e){if(FBTrace.DBG_ERRORS){FBTrace.sysout("lib.getResource FAILS for "+aURL,e)
		}}};
		this.parseJSONString=function(jsonString,originURL){var regex=new RegExp(/^\/\*-secure-([\s\S]*)\*\/\s*$/);
		var matches=regex.exec(jsonString);
		if(matches){jsonString=matches[1];
		if(jsonString[0]=="\\"&&jsonString[1]=="n"){jsonString=jsonString.substr(2)
		}if(jsonString[jsonString.length-2]=="\\"&&jsonString[jsonString.length-1]=="n"){jsonString=jsonString.substr(0,jsonString.length-2)
		}}if(jsonString.indexOf("&&&START&&&")){regex=new RegExp(/&&&START&&& (.+) &&&END&&&/);
		matches=regex.exec(jsonString);
		if(matches){jsonString=matches[1]
		}}jsonString="("+jsonString+")";
		var jsonObject=null;
		try{jsonObject=Firebug.context.evaluate(jsonString,null,null,function(){return null
		})
		}catch(e){if(FBTrace.DBG_ERRORS||FBTrace.DBG_JSONVIEWER){FBTrace.sysout("jsonviewer.parseJSON EXCEPTION",e)
		}return null
		}return jsonObject
		};
		this.objectToString=function(object){try{return object+""
		}catch(exc){return null
		}};
		this.setSelectionRange=function(input,start,length){if(input.createTextRange){var range=input.createTextRange();
		range.moveStart("character",start);
		range.moveEnd("character",length-input.value.length);
		range.select()
		}else{if(input.setSelectionRange){input.setSelectionRange(start,length);
		input.focus()
		}}};
		this.getInputSelectionStart=function(input){if(document.selection){var range=input.ownerDocument.selection.createRange();
		var text=range.text;
		if(text){return input.value.indexOf(text)
		}else{range.moveStart("character",-input.value.length);
		return range.text.length
		}}else{if(typeof input.selectionStart!="undefined"){return input.selectionStart
		}}return 0
		};
		function onOperaTabBlur(e){if(this.lastKey==9){this.focus()
		}}function onOperaTabKeyDown(e){this.lastKey=e.keyCode
		}function onOperaTabFocus(e){this.lastKey=null
		}this.fixOperaTabKey=function(el){el.onfocus=onOperaTabFocus;
		el.onblur=onOperaTabBlur;
		el.onkeydown=onOperaTabKeyDown
		};
		this.Property=function(object,name){this.object=object;
		this.name=name;
		this.getObject=function(){return object[name]
		}
		};
		this.ErrorCopy=function(message){this.message=message
		};
		function EventCopy(event){for(var name in event){try{this[name]=event[name]
		}catch(exc){}}}this.EventCopy=EventCopy;
		var toString=Object.prototype.toString;
		var reFunction=/^\s*function(\s+[\w_$][\w\d_$]*)?\s*\(/;
		this.isArray=function(object){return toString.call(object)==="[object Array]"
		};
		this.isFunction=function(object){if(!object){return false
		}try{return toString.call(object)==="[object Function]"||this.isIE&&typeof object!="string"&&reFunction.test(""+object)
		}catch(E){FBTrace.sysout("Lib.isFunction() failed for ",object);
		return false
		}};
		this.instanceOf=function(object,className){if(!object||typeof object!="object"){return false
		}if(object.ownerDocument){var win=object.ownerDocument.defaultView||object.ownerDocument.parentWindow;
		if(className in win&&object instanceof win[className]){return true
		}}else{var win=Firebug.browser.window;
		if(className in win){return object instanceof win[className]
		}}var cache=instanceCheckMap[className];
		if(!cache){return false
		}for(var n in cache){var obj=cache[n];
		var type=typeof obj;
		obj=type=="object"?obj:[obj];
		for(var name in obj){if(!obj.hasOwnProperty(name)){continue
		}var value=obj[name];
		if(n=="property"&&!(value in object)||n=="method"&&!this.isFunction(object[value])||n=="value"&&(""+object[name]).toLowerCase()!=(""+value).toLowerCase()){return false
		}}}return true
		};
		var instanceCheckMap={Window:{property:["window","document"],method:"setTimeout"},Document:{property:["body","cookie"],method:"getElementById"},Node:{property:"ownerDocument",method:"appendChild"},Element:{property:"tagName",value:{nodeType:1}},Location:{property:["hostname","protocol"],method:"assign"},HTMLImageElement:{property:"useMap",value:{nodeType:1,tagName:"img"}},HTMLAnchorElement:{property:"hreflang",value:{nodeType:1,tagName:"a"}},HTMLInputElement:{property:"form",value:{nodeType:1,tagName:"input"}},HTMLButtonElement:{},HTMLFormElement:{method:"submit",value:{nodeType:1,tagName:"form"}},HTMLBodyElement:{},HTMLHtmlElement:{},CSSStyleRule:{property:["selectorText","style"]}};
		var domMemberMap2={};
		var domMemberMap2Sandbox=null;
		var getDomMemberMap2=function(name){if(!domMemberMap2Sandbox){var doc=Firebug.chrome.document;
		var frame=doc.createElement("iframe");
		frame.id="FirebugSandbox";
		frame.style.display="none";
		frame.src="about:blank";
		doc.body.appendChild(frame);
		domMemberMap2Sandbox=frame.window||frame.contentWindow
		}var props=[];
		var object=null;
		if(name=="Window"){object=domMemberMap2Sandbox.window
		}else{if(name=="Document"){object=domMemberMap2Sandbox.document
		}else{if(name=="HTMLScriptElement"){object=domMemberMap2Sandbox.document.createElement("script")
		}else{if(name=="HTMLAnchorElement"){object=domMemberMap2Sandbox.document.createElement("a")
		}else{if(name.indexOf("Element")!=-1){object=domMemberMap2Sandbox.document.createElement("div")
		}}}}}if(object){for(var n in object){props.push(n)
		}}return props;
		return extendArray(props,domMemberMap[name])
		};
		this.getDOMMembers=function(object){if(!domMemberCache){FBL.domMemberCache=domMemberCache={};
		for(var name in domMemberMap){var builtins=getDomMemberMap2(name);
		var cache=domMemberCache[name]={};
		for(var i=0;
		i<builtins.length;
		++i){cache[builtins[i]]=i
		}}}try{if(this.instanceOf(object,"Window")){return domMemberCache.Window
		}else{if(this.instanceOf(object,"Document")||this.instanceOf(object,"XMLDocument")){return domMemberCache.Document
		}else{if(this.instanceOf(object,"Location")){return domMemberCache.Location
		}else{if(this.instanceOf(object,"HTMLImageElement")){return domMemberCache.HTMLImageElement
		}else{if(this.instanceOf(object,"HTMLAnchorElement")){return domMemberCache.HTMLAnchorElement
		}else{if(this.instanceOf(object,"HTMLInputElement")){return domMemberCache.HTMLInputElement
		}else{if(this.instanceOf(object,"HTMLButtonElement")){return domMemberCache.HTMLButtonElement
		}else{if(this.instanceOf(object,"HTMLFormElement")){return domMemberCache.HTMLFormElement
		}else{if(this.instanceOf(object,"HTMLBodyElement")){return domMemberCache.HTMLBodyElement
		}else{if(this.instanceOf(object,"HTMLHtmlElement")){return domMemberCache.HTMLHtmlElement
		}else{if(this.instanceOf(object,"HTMLScriptElement")){return domMemberCache.HTMLScriptElement
		}else{if(this.instanceOf(object,"HTMLTableElement")){return domMemberCache.HTMLTableElement
		}else{if(this.instanceOf(object,"HTMLTableRowElement")){return domMemberCache.HTMLTableRowElement
		}else{if(this.instanceOf(object,"HTMLTableCellElement")){return domMemberCache.HTMLTableCellElement
		}else{if(this.instanceOf(object,"HTMLIFrameElement")){return domMemberCache.HTMLIFrameElement
		}else{if(this.instanceOf(object,"SVGSVGElement")){return domMemberCache.SVGSVGElement
		}else{if(this.instanceOf(object,"SVGElement")){return domMemberCache.SVGElement
		}else{if(this.instanceOf(object,"Element")){return domMemberCache.Element
		}else{if(this.instanceOf(object,"Text")||this.instanceOf(object,"CDATASection")){return domMemberCache.Text
		}else{if(this.instanceOf(object,"Attr")){return domMemberCache.Attr
		}else{if(this.instanceOf(object,"Node")){return domMemberCache.Node
		}else{if(this.instanceOf(object,"Event")||this.instanceOf(object,"EventCopy")){return domMemberCache.Event
		}else{return{}
		}}}}}}}}}}}}}}}}}}}}}}}catch(E){if(FBTrace.DBG_ERRORS){FBTrace.sysout("lib.getDOMMembers FAILED ",E)
		}return{}
		}};
		this.isDOMMember=function(object,propName){var members=this.getDOMMembers(object);
		return members&&propName in members
		};
		var domMemberCache=null;
		var domMemberMap={};
		domMemberMap.Window=["document","frameElement","innerWidth","innerHeight","outerWidth","outerHeight","screenX","screenY","pageXOffset","pageYOffset","scrollX","scrollY","scrollMaxX","scrollMaxY","status","defaultStatus","parent","opener","top","window","content","self","location","history","frames","navigator","screen","menubar","toolbar","locationbar","personalbar","statusbar","directories","scrollbars","fullScreen","netscape","java","console","Components","controllers","closed","crypto","pkcs11","name","property","length","sessionStorage","globalStorage","setTimeout","setInterval","clearTimeout","clearInterval","addEventListener","removeEventListener","dispatchEvent","getComputedStyle","captureEvents","releaseEvents","routeEvent","enableExternalCapture","disableExternalCapture","moveTo","moveBy","resizeTo","resizeBy","scroll","scrollTo","scrollBy","scrollByLines","scrollByPages","sizeToContent","setResizable","getSelection","open","openDialog","close","alert","confirm","prompt","dump","focus","blur","find","back","forward","home","stop","print","atob","btoa","updateCommands","XPCNativeWrapper","GeckoActiveXObject","applicationCache"];
		domMemberMap.Location=["href","protocol","host","hostname","port","pathname","search","hash","assign","reload","replace"];
		domMemberMap.Node=["id","className","nodeType","tagName","nodeName","localName","prefix","namespaceURI","nodeValue","ownerDocument","parentNode","offsetParent","nextSibling","previousSibling","firstChild","lastChild","childNodes","attributes","dir","baseURI","textContent","innerHTML","addEventListener","removeEventListener","dispatchEvent","cloneNode","appendChild","insertBefore","replaceChild","removeChild","compareDocumentPosition","hasAttributes","hasChildNodes","lookupNamespaceURI","lookupPrefix","normalize","isDefaultNamespace","isEqualNode","isSameNode","isSupported","getFeature","getUserData","setUserData"];
		domMemberMap.Document=extendArray(domMemberMap.Node,["documentElement","body","title","location","referrer","cookie","contentType","lastModified","characterSet","inputEncoding","xmlEncoding","xmlStandalone","xmlVersion","strictErrorChecking","documentURI","URL","defaultView","doctype","implementation","styleSheets","images","links","forms","anchors","embeds","plugins","applets","width","height","designMode","compatMode","async","preferredStylesheetSet","alinkColor","linkColor","vlinkColor","bgColor","fgColor","domain","addEventListener","removeEventListener","dispatchEvent","captureEvents","releaseEvents","routeEvent","clear","open","close","execCommand","execCommandShowHelp","getElementsByName","getSelection","queryCommandEnabled","queryCommandIndeterm","queryCommandState","queryCommandSupported","queryCommandText","queryCommandValue","write","writeln","adoptNode","appendChild","removeChild","renameNode","cloneNode","compareDocumentPosition","createAttribute","createAttributeNS","createCDATASection","createComment","createDocumentFragment","createElement","createElementNS","createEntityReference","createEvent","createExpression","createNSResolver","createNodeIterator","createProcessingInstruction","createRange","createTextNode","createTreeWalker","domConfig","evaluate","evaluateFIXptr","evaluateXPointer","getAnonymousElementByAttribute","getAnonymousNodes","addBinding","removeBinding","getBindingParent","getBoxObjectFor","setBoxObjectFor","getElementById","getElementsByTagName","getElementsByTagNameNS","hasAttributes","hasChildNodes","importNode","insertBefore","isDefaultNamespace","isEqualNode","isSameNode","isSupported","load","loadBindingDocument","lookupNamespaceURI","lookupPrefix","normalize","normalizeDocument","getFeature","getUserData","setUserData"]);
		domMemberMap.Element=extendArray(domMemberMap.Node,["clientWidth","clientHeight","offsetLeft","offsetTop","offsetWidth","offsetHeight","scrollLeft","scrollTop","scrollWidth","scrollHeight","style","tabIndex","title","lang","align","spellcheck","addEventListener","removeEventListener","dispatchEvent","focus","blur","cloneNode","appendChild","insertBefore","replaceChild","removeChild","compareDocumentPosition","getElementsByTagName","getElementsByTagNameNS","getAttribute","getAttributeNS","getAttributeNode","getAttributeNodeNS","setAttribute","setAttributeNS","setAttributeNode","setAttributeNodeNS","removeAttribute","removeAttributeNS","removeAttributeNode","hasAttribute","hasAttributeNS","hasAttributes","hasChildNodes","lookupNamespaceURI","lookupPrefix","normalize","isDefaultNamespace","isEqualNode","isSameNode","isSupported","getFeature","getUserData","setUserData"]);
		domMemberMap.SVGElement=extendArray(domMemberMap.Element,["x","y","width","height","rx","ry","transform","href","ownerSVGElement","viewportElement","farthestViewportElement","nearestViewportElement","getBBox","getCTM","getScreenCTM","getTransformToElement","getPresentationAttribute","preserveAspectRatio"]);
		domMemberMap.SVGSVGElement=extendArray(domMemberMap.Element,["x","y","width","height","rx","ry","transform","viewBox","viewport","currentView","useCurrentView","pixelUnitToMillimeterX","pixelUnitToMillimeterY","screenPixelToMillimeterX","screenPixelToMillimeterY","currentScale","currentTranslate","zoomAndPan","ownerSVGElement","viewportElement","farthestViewportElement","nearestViewportElement","contentScriptType","contentStyleType","getBBox","getCTM","getScreenCTM","getTransformToElement","getEnclosureList","getIntersectionList","getViewboxToViewportTransform","getPresentationAttribute","getElementById","checkEnclosure","checkIntersection","createSVGAngle","createSVGLength","createSVGMatrix","createSVGNumber","createSVGPoint","createSVGRect","createSVGString","createSVGTransform","createSVGTransformFromMatrix","deSelectAll","preserveAspectRatio","forceRedraw","suspendRedraw","unsuspendRedraw","unsuspendRedrawAll","getCurrentTime","setCurrentTime","animationsPaused","pauseAnimations","unpauseAnimations"]);
		domMemberMap.HTMLImageElement=extendArray(domMemberMap.Element,["src","naturalWidth","naturalHeight","width","height","x","y","name","alt","longDesc","lowsrc","border","complete","hspace","vspace","isMap","useMap"]);
		domMemberMap.HTMLAnchorElement=extendArray(domMemberMap.Element,["name","target","accessKey","href","protocol","host","hostname","port","pathname","search","hash","hreflang","coords","shape","text","type","rel","rev","charset"]);
		domMemberMap.HTMLIFrameElement=extendArray(domMemberMap.Element,["contentDocument","contentWindow","frameBorder","height","longDesc","marginHeight","marginWidth","name","scrolling","src","width"]);
		domMemberMap.HTMLTableElement=extendArray(domMemberMap.Element,["bgColor","border","caption","cellPadding","cellSpacing","frame","rows","rules","summary","tBodies","tFoot","tHead","width","createCaption","createTFoot","createTHead","deleteCaption","deleteRow","deleteTFoot","deleteTHead","insertRow"]);
		domMemberMap.HTMLTableRowElement=extendArray(domMemberMap.Element,["bgColor","cells","ch","chOff","rowIndex","sectionRowIndex","vAlign","deleteCell","insertCell"]);
		domMemberMap.HTMLTableCellElement=extendArray(domMemberMap.Element,["abbr","axis","bgColor","cellIndex","ch","chOff","colSpan","headers","height","noWrap","rowSpan","scope","vAlign","width"]);
		domMemberMap.HTMLScriptElement=extendArray(domMemberMap.Element,["src"]);
		domMemberMap.HTMLButtonElement=extendArray(domMemberMap.Element,["accessKey","disabled","form","name","type","value","click"]);
		domMemberMap.HTMLInputElement=extendArray(domMemberMap.Element,["type","value","checked","accept","accessKey","alt","controllers","defaultChecked","defaultValue","disabled","form","maxLength","name","readOnly","selectionEnd","selectionStart","size","src","textLength","useMap","click","select","setSelectionRange"]);
		domMemberMap.HTMLFormElement=extendArray(domMemberMap.Element,["acceptCharset","action","author","elements","encoding","enctype","entry_id","length","method","name","post","target","text","url","reset","submit"]);
		domMemberMap.HTMLBodyElement=extendArray(domMemberMap.Element,["aLink","background","bgColor","link","text","vLink"]);
		domMemberMap.HTMLHtmlElement=extendArray(domMemberMap.Element,["version"]);
		domMemberMap.Text=extendArray(domMemberMap.Node,["data","length","appendData","deleteData","insertData","replaceData","splitText","substringData"]);
		domMemberMap.Attr=extendArray(domMemberMap.Node,["name","value","specified","ownerElement"]);
		domMemberMap.Event=["type","target","currentTarget","originalTarget","explicitOriginalTarget","relatedTarget","rangeParent","rangeOffset","view","keyCode","charCode","screenX","screenY","clientX","clientY","layerX","layerY","pageX","pageY","detail","button","which","ctrlKey","shiftKey","altKey","metaKey","eventPhase","timeStamp","bubbles","cancelable","cancelBubble","isTrusted","isChar","getPreventDefault","initEvent","initMouseEvent","initKeyEvent","initUIEvent","preventBubble","preventCapture","preventDefault","stopPropagation"];
		this.domConstantMap={ELEMENT_NODE:1,ATTRIBUTE_NODE:1,TEXT_NODE:1,CDATA_SECTION_NODE:1,ENTITY_REFERENCE_NODE:1,ENTITY_NODE:1,PROCESSING_INSTRUCTION_NODE:1,COMMENT_NODE:1,DOCUMENT_NODE:1,DOCUMENT_TYPE_NODE:1,DOCUMENT_FRAGMENT_NODE:1,NOTATION_NODE:1,DOCUMENT_POSITION_DISCONNECTED:1,DOCUMENT_POSITION_PRECEDING:1,DOCUMENT_POSITION_FOLLOWING:1,DOCUMENT_POSITION_CONTAINS:1,DOCUMENT_POSITION_CONTAINED_BY:1,DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:1,UNKNOWN_RULE:1,STYLE_RULE:1,CHARSET_RULE:1,IMPORT_RULE:1,MEDIA_RULE:1,FONT_FACE_RULE:1,PAGE_RULE:1,CAPTURING_PHASE:1,AT_TARGET:1,BUBBLING_PHASE:1,SCROLL_PAGE_UP:1,SCROLL_PAGE_DOWN:1,MOUSEUP:1,MOUSEDOWN:1,MOUSEOVER:1,MOUSEOUT:1,MOUSEMOVE:1,MOUSEDRAG:1,CLICK:1,DBLCLICK:1,KEYDOWN:1,KEYUP:1,KEYPRESS:1,DRAGDROP:1,FOCUS:1,BLUR:1,SELECT:1,CHANGE:1,RESET:1,SUBMIT:1,SCROLL:1,LOAD:1,UNLOAD:1,XFER_DONE:1,ABORT:1,ERROR:1,LOCATE:1,MOVE:1,RESIZE:1,FORWARD:1,HELP:1,BACK:1,TEXT:1,ALT_MASK:1,CONTROL_MASK:1,SHIFT_MASK:1,META_MASK:1,DOM_VK_TAB:1,DOM_VK_PAGE_UP:1,DOM_VK_PAGE_DOWN:1,DOM_VK_UP:1,DOM_VK_DOWN:1,DOM_VK_LEFT:1,DOM_VK_RIGHT:1,DOM_VK_CANCEL:1,DOM_VK_HELP:1,DOM_VK_BACK_SPACE:1,DOM_VK_CLEAR:1,DOM_VK_RETURN:1,DOM_VK_ENTER:1,DOM_VK_SHIFT:1,DOM_VK_CONTROL:1,DOM_VK_ALT:1,DOM_VK_PAUSE:1,DOM_VK_CAPS_LOCK:1,DOM_VK_ESCAPE:1,DOM_VK_SPACE:1,DOM_VK_END:1,DOM_VK_HOME:1,DOM_VK_PRINTSCREEN:1,DOM_VK_INSERT:1,DOM_VK_DELETE:1,DOM_VK_0:1,DOM_VK_1:1,DOM_VK_2:1,DOM_VK_3:1,DOM_VK_4:1,DOM_VK_5:1,DOM_VK_6:1,DOM_VK_7:1,DOM_VK_8:1,DOM_VK_9:1,DOM_VK_SEMICOLON:1,DOM_VK_EQUALS:1,DOM_VK_A:1,DOM_VK_B:1,DOM_VK_C:1,DOM_VK_D:1,DOM_VK_E:1,DOM_VK_F:1,DOM_VK_G:1,DOM_VK_H:1,DOM_VK_I:1,DOM_VK_J:1,DOM_VK_K:1,DOM_VK_L:1,DOM_VK_M:1,DOM_VK_N:1,DOM_VK_O:1,DOM_VK_P:1,DOM_VK_Q:1,DOM_VK_R:1,DOM_VK_S:1,DOM_VK_T:1,DOM_VK_U:1,DOM_VK_V:1,DOM_VK_W:1,DOM_VK_X:1,DOM_VK_Y:1,DOM_VK_Z:1,DOM_VK_CONTEXT_MENU:1,DOM_VK_NUMPAD0:1,DOM_VK_NUMPAD1:1,DOM_VK_NUMPAD2:1,DOM_VK_NUMPAD3:1,DOM_VK_NUMPAD4:1,DOM_VK_NUMPAD5:1,DOM_VK_NUMPAD6:1,DOM_VK_NUMPAD7:1,DOM_VK_NUMPAD8:1,DOM_VK_NUMPAD9:1,DOM_VK_MULTIPLY:1,DOM_VK_ADD:1,DOM_VK_SEPARATOR:1,DOM_VK_SUBTRACT:1,DOM_VK_DECIMAL:1,DOM_VK_DIVIDE:1,DOM_VK_F1:1,DOM_VK_F2:1,DOM_VK_F3:1,DOM_VK_F4:1,DOM_VK_F5:1,DOM_VK_F6:1,DOM_VK_F7:1,DOM_VK_F8:1,DOM_VK_F9:1,DOM_VK_F10:1,DOM_VK_F11:1,DOM_VK_F12:1,DOM_VK_F13:1,DOM_VK_F14:1,DOM_VK_F15:1,DOM_VK_F16:1,DOM_VK_F17:1,DOM_VK_F18:1,DOM_VK_F19:1,DOM_VK_F20:1,DOM_VK_F21:1,DOM_VK_F22:1,DOM_VK_F23:1,DOM_VK_F24:1,DOM_VK_NUM_LOCK:1,DOM_VK_SCROLL_LOCK:1,DOM_VK_COMMA:1,DOM_VK_PERIOD:1,DOM_VK_SLASH:1,DOM_VK_BACK_QUOTE:1,DOM_VK_OPEN_BRACKET:1,DOM_VK_BACK_SLASH:1,DOM_VK_CLOSE_BRACKET:1,DOM_VK_QUOTE:1,DOM_VK_META:1,SVG_ZOOMANDPAN_DISABLE:1,SVG_ZOOMANDPAN_MAGNIFY:1,SVG_ZOOMANDPAN_UNKNOWN:1};
		this.cssInfo={background:["bgRepeat","bgAttachment","bgPosition","color","systemColor","none"],"background-attachment":["bgAttachment"],"background-color":["color","systemColor"],"background-image":["none"],"background-position":["bgPosition"],"background-repeat":["bgRepeat"],border:["borderStyle","thickness","color","systemColor","none"],"border-top":["borderStyle","borderCollapse","color","systemColor","none"],"border-right":["borderStyle","borderCollapse","color","systemColor","none"],"border-bottom":["borderStyle","borderCollapse","color","systemColor","none"],"border-left":["borderStyle","borderCollapse","color","systemColor","none"],"border-collapse":["borderCollapse"],"border-color":["color","systemColor"],"border-top-color":["color","systemColor"],"border-right-color":["color","systemColor"],"border-bottom-color":["color","systemColor"],"border-left-color":["color","systemColor"],"border-spacing":[],"border-style":["borderStyle"],"border-top-style":["borderStyle"],"border-right-style":["borderStyle"],"border-bottom-style":["borderStyle"],"border-left-style":["borderStyle"],"border-width":["thickness"],"border-top-width":["thickness"],"border-right-width":["thickness"],"border-bottom-width":["thickness"],"border-left-width":["thickness"],bottom:["auto"],"caption-side":["captionSide"],clear:["clear","none"],clip:["auto"],color:["color","systemColor"],content:["content"],"counter-increment":["none"],"counter-reset":["none"],cursor:["cursor","none"],direction:["direction"],display:["display","none"],"empty-cells":[],"float":["float","none"],font:["fontStyle","fontVariant","fontWeight","fontFamily"],"font-family":["fontFamily"],"font-size":["fontSize"],"font-size-adjust":[],"font-stretch":[],"font-style":["fontStyle"],"font-variant":["fontVariant"],"font-weight":["fontWeight"],height:["auto"],left:["auto"],"letter-spacing":[],"line-height":[],"list-style":["listStyleType","listStylePosition","none"],"list-style-image":["none"],"list-style-position":["listStylePosition"],"list-style-type":["listStyleType","none"],margin:[],"margin-top":[],"margin-right":[],"margin-bottom":[],"margin-left":[],"marker-offset":["auto"],"min-height":["none"],"max-height":["none"],"min-width":["none"],"max-width":["none"],outline:["borderStyle","color","systemColor","none"],"outline-color":["color","systemColor"],"outline-style":["borderStyle"],"outline-width":[],overflow:["overflow","auto"],"overflow-x":["overflow","auto"],"overflow-y":["overflow","auto"],padding:[],"padding-top":[],"padding-right":[],"padding-bottom":[],"padding-left":[],position:["position"],quotes:["none"],right:["auto"],"table-layout":["tableLayout","auto"],"text-align":["textAlign"],"text-decoration":["textDecoration","none"],"text-indent":[],"text-shadow":[],"text-transform":["textTransform","none"],top:["auto"],"unicode-bidi":[],"vertical-align":["verticalAlign"],"white-space":["whiteSpace"],width:["auto"],"word-spacing":[],"z-index":[],"-moz-appearance":["mozAppearance"],"-moz-border-radius":[],"-moz-border-radius-bottomleft":[],"-moz-border-radius-bottomright":[],"-moz-border-radius-topleft":[],"-moz-border-radius-topright":[],"-moz-border-top-colors":["color","systemColor"],"-moz-border-right-colors":["color","systemColor"],"-moz-border-bottom-colors":["color","systemColor"],"-moz-border-left-colors":["color","systemColor"],"-moz-box-align":["mozBoxAlign"],"-moz-box-direction":["mozBoxDirection"],"-moz-box-flex":[],"-moz-box-ordinal-group":[],"-moz-box-orient":["mozBoxOrient"],"-moz-box-pack":["mozBoxPack"],"-moz-box-sizing":["mozBoxSizing"],"-moz-opacity":[],"-moz-user-focus":["userFocus","none"],"-moz-user-input":["userInput"],"-moz-user-modify":[],"-moz-user-select":["userSelect","none"],"-moz-background-clip":[],"-moz-background-inline-policy":[],"-moz-background-origin":[],"-moz-binding":[],"-moz-column-count":[],"-moz-column-gap":[],"-moz-column-width":[],"-moz-image-region":[]};
		this.inheritedStyleNames={"border-collapse":1,"border-spacing":1,"border-style":1,"caption-side":1,color:1,cursor:1,direction:1,"empty-cells":1,font:1,"font-family":1,"font-size-adjust":1,"font-size":1,"font-style":1,"font-variant":1,"font-weight":1,"letter-spacing":1,"line-height":1,"list-style":1,"list-style-image":1,"list-style-position":1,"list-style-type":1,quotes:1,"text-align":1,"text-decoration":1,"text-indent":1,"text-shadow":1,"text-transform":1,"white-space":1,"word-spacing":1};
		this.cssKeywords={appearance:["button","button-small","checkbox","checkbox-container","checkbox-small","dialog","listbox","menuitem","menulist","menulist-button","menulist-textfield","menupopup","progressbar","radio","radio-container","radio-small","resizer","scrollbar","scrollbarbutton-down","scrollbarbutton-left","scrollbarbutton-right","scrollbarbutton-up","scrollbartrack-horizontal","scrollbartrack-vertical","separator","statusbar","tab","tab-left-edge","tabpanels","textfield","toolbar","toolbarbutton","toolbox","tooltip","treeheadercell","treeheadersortarrow","treeitem","treetwisty","treetwistyopen","treeview","window"],systemColor:["ActiveBorder","ActiveCaption","AppWorkspace","Background","ButtonFace","ButtonHighlight","ButtonShadow","ButtonText","CaptionText","GrayText","Highlight","HighlightText","InactiveBorder","InactiveCaption","InactiveCaptionText","InfoBackground","InfoText","Menu","MenuText","Scrollbar","ThreeDDarkShadow","ThreeDFace","ThreeDHighlight","ThreeDLightShadow","ThreeDShadow","Window","WindowFrame","WindowText","-moz-field","-moz-fieldtext","-moz-workspace","-moz-visitedhyperlinktext","-moz-use-text-color"],color:["AliceBlue","AntiqueWhite","Aqua","Aquamarine","Azure","Beige","Bisque","Black","BlanchedAlmond","Blue","BlueViolet","Brown","BurlyWood","CadetBlue","Chartreuse","Chocolate","Coral","CornflowerBlue","Cornsilk","Crimson","Cyan","DarkBlue","DarkCyan","DarkGoldenRod","DarkGray","DarkGreen","DarkKhaki","DarkMagenta","DarkOliveGreen","DarkOrange","DarkOrchid","DarkRed","DarkSalmon","DarkSeaGreen","DarkSlateBlue","DarkSlateGray","DarkTurquoise","DarkViolet","DeepPink","DarkSkyBlue","DimGray","DodgerBlue","Feldspar","FireBrick","FloralWhite","ForestGreen","Fuchsia","Gainsboro","GhostWhite","Gold","GoldenRod","Gray","Green","GreenYellow","HoneyDew","HotPink","IndianRed","Indigo","Ivory","Khaki","Lavender","LavenderBlush","LawnGreen","LemonChiffon","LightBlue","LightCoral","LightCyan","LightGoldenRodYellow","LightGrey","LightGreen","LightPink","LightSalmon","LightSeaGreen","LightSkyBlue","LightSlateBlue","LightSlateGray","LightSteelBlue","LightYellow","Lime","LimeGreen","Linen","Magenta","Maroon","MediumAquaMarine","MediumBlue","MediumOrchid","MediumPurple","MediumSeaGreen","MediumSlateBlue","MediumSpringGreen","MediumTurquoise","MediumVioletRed","MidnightBlue","MintCream","MistyRose","Moccasin","NavajoWhite","Navy","OldLace","Olive","OliveDrab","Orange","OrangeRed","Orchid","PaleGoldenRod","PaleGreen","PaleTurquoise","PaleVioletRed","PapayaWhip","PeachPuff","Peru","Pink","Plum","PowderBlue","Purple","Red","RosyBrown","RoyalBlue","SaddleBrown","Salmon","SandyBrown","SeaGreen","SeaShell","Sienna","Silver","SkyBlue","SlateBlue","SlateGray","Snow","SpringGreen","SteelBlue","Tan","Teal","Thistle","Tomato","Turquoise","Violet","VioletRed","Wheat","White","WhiteSmoke","Yellow","YellowGreen","transparent","invert"],auto:["auto"],none:["none"],captionSide:["top","bottom","left","right"],clear:["left","right","both"],cursor:["auto","cell","context-menu","crosshair","default","help","pointer","progress","move","e-resize","all-scroll","ne-resize","nw-resize","n-resize","se-resize","sw-resize","s-resize","w-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","col-resize","row-resize","text","vertical-text","wait","alias","copy","move","no-drop","not-allowed","-moz-alias","-moz-cell","-moz-copy","-moz-grab","-moz-grabbing","-moz-contextmenu","-moz-zoom-in","-moz-zoom-out","-moz-spinning"],direction:["ltr","rtl"],bgAttachment:["scroll","fixed"],bgPosition:["top","center","bottom","left","right"],bgRepeat:["repeat","repeat-x","repeat-y","no-repeat"],borderStyle:["hidden","dotted","dashed","solid","double","groove","ridge","inset","outset","-moz-bg-inset","-moz-bg-outset","-moz-bg-solid"],borderCollapse:["collapse","separate"],overflow:["visible","hidden","scroll","-moz-scrollbars-horizontal","-moz-scrollbars-none","-moz-scrollbars-vertical"],listStyleType:["disc","circle","square","decimal","decimal-leading-zero","lower-roman","upper-roman","lower-greek","lower-alpha","lower-latin","upper-alpha","upper-latin","hebrew","armenian","georgian","cjk-ideographic","hiragana","katakana","hiragana-iroha","katakana-iroha","inherit"],listStylePosition:["inside","outside"],content:["open-quote","close-quote","no-open-quote","no-close-quote","inherit"],fontStyle:["normal","italic","oblique","inherit"],fontVariant:["normal","small-caps","inherit"],fontWeight:["normal","bold","bolder","lighter","inherit"],fontSize:["xx-small","x-small","small","medium","large","x-large","xx-large","smaller","larger"],fontFamily:["Arial","Comic Sans MS","Georgia","Tahoma","Verdana","Times New Roman","Trebuchet MS","Lucida Grande","Helvetica","serif","sans-serif","cursive","fantasy","monospace","caption","icon","menu","message-box","small-caption","status-bar","inherit"],display:["block","inline","inline-block","list-item","marker","run-in","compact","table","inline-table","table-row-group","table-column","table-column-group","table-header-group","table-footer-group","table-row","table-cell","table-caption","-moz-box","-moz-compact","-moz-deck","-moz-grid","-moz-grid-group","-moz-grid-line","-moz-groupbox","-moz-inline-block","-moz-inline-box","-moz-inline-grid","-moz-inline-stack","-moz-inline-table","-moz-marker","-moz-popup","-moz-runin","-moz-stack"],position:["static","relative","absolute","fixed","inherit"],"float":["left","right"],textAlign:["left","right","center","justify"],tableLayout:["fixed"],textDecoration:["underline","overline","line-through","blink"],textTransform:["capitalize","lowercase","uppercase","inherit"],unicodeBidi:["normal","embed","bidi-override"],whiteSpace:["normal","pre","nowrap"],verticalAlign:["baseline","sub","super","top","text-top","middle","bottom","text-bottom","inherit"],thickness:["thin","medium","thick"],userFocus:["ignore","normal"],userInput:["disabled","enabled"],userSelect:["normal"],mozBoxSizing:["content-box","padding-box","border-box"],mozBoxAlign:["start","center","end","baseline","stretch"],mozBoxDirection:["normal","reverse"],mozBoxOrient:["horizontal","vertical"],mozBoxPack:["start","center","end"]};
		this.nonEditableTags={HTML:1,HEAD:1,html:1,head:1};
		this.innerEditableTags={BODY:1,body:1};
		this.selfClosingTags={meta:1,link:1,area:1,base:1,col:1,input:1,img:1,br:1,hr:1,param:1,embed:1};
		var invisibleTags=this.invisibleTags={HTML:1,HEAD:1,TITLE:1,META:1,LINK:1,STYLE:1,SCRIPT:1,NOSCRIPT:1,BR:1,PARAM:1,COL:1,html:1,head:1,title:1,meta:1,link:1,style:1,script:1,noscript:1,br:1,param:1,col:1};
		if(typeof KeyEvent=="undefined"){this.KeyEvent={DOM_VK_CANCEL:3,DOM_VK_HELP:6,DOM_VK_BACK_SPACE:8,DOM_VK_TAB:9,DOM_VK_CLEAR:12,DOM_VK_RETURN:13,DOM_VK_ENTER:14,DOM_VK_SHIFT:16,DOM_VK_CONTROL:17,DOM_VK_ALT:18,DOM_VK_PAUSE:19,DOM_VK_CAPS_LOCK:20,DOM_VK_ESCAPE:27,DOM_VK_SPACE:32,DOM_VK_PAGE_UP:33,DOM_VK_PAGE_DOWN:34,DOM_VK_END:35,DOM_VK_HOME:36,DOM_VK_LEFT:37,DOM_VK_UP:38,DOM_VK_RIGHT:39,DOM_VK_DOWN:40,DOM_VK_PRINTSCREEN:44,DOM_VK_INSERT:45,DOM_VK_DELETE:46,DOM_VK_0:48,DOM_VK_1:49,DOM_VK_2:50,DOM_VK_3:51,DOM_VK_4:52,DOM_VK_5:53,DOM_VK_6:54,DOM_VK_7:55,DOM_VK_8:56,DOM_VK_9:57,DOM_VK_SEMICOLON:59,DOM_VK_EQUALS:61,DOM_VK_A:65,DOM_VK_B:66,DOM_VK_C:67,DOM_VK_D:68,DOM_VK_E:69,DOM_VK_F:70,DOM_VK_G:71,DOM_VK_H:72,DOM_VK_I:73,DOM_VK_J:74,DOM_VK_K:75,DOM_VK_L:76,DOM_VK_M:77,DOM_VK_N:78,DOM_VK_O:79,DOM_VK_P:80,DOM_VK_Q:81,DOM_VK_R:82,DOM_VK_S:83,DOM_VK_T:84,DOM_VK_U:85,DOM_VK_V:86,DOM_VK_W:87,DOM_VK_X:88,DOM_VK_Y:89,DOM_VK_Z:90,DOM_VK_CONTEXT_MENU:93,DOM_VK_NUMPAD0:96,DOM_VK_NUMPAD1:97,DOM_VK_NUMPAD2:98,DOM_VK_NUMPAD3:99,DOM_VK_NUMPAD4:100,DOM_VK_NUMPAD5:101,DOM_VK_NUMPAD6:102,DOM_VK_NUMPAD7:103,DOM_VK_NUMPAD8:104,DOM_VK_NUMPAD9:105,DOM_VK_MULTIPLY:106,DOM_VK_ADD:107,DOM_VK_SEPARATOR:108,DOM_VK_SUBTRACT:109,DOM_VK_DECIMAL:110,DOM_VK_DIVIDE:111,DOM_VK_F1:112,DOM_VK_F2:113,DOM_VK_F3:114,DOM_VK_F4:115,DOM_VK_F5:116,DOM_VK_F6:117,DOM_VK_F7:118,DOM_VK_F8:119,DOM_VK_F9:120,DOM_VK_F10:121,DOM_VK_F11:122,DOM_VK_F12:123,DOM_VK_F13:124,DOM_VK_F14:125,DOM_VK_F15:126,DOM_VK_F16:127,DOM_VK_F17:128,DOM_VK_F18:129,DOM_VK_F19:130,DOM_VK_F20:131,DOM_VK_F21:132,DOM_VK_F22:133,DOM_VK_F23:134,DOM_VK_F24:135,DOM_VK_NUM_LOCK:144,DOM_VK_SCROLL_LOCK:145,DOM_VK_COMMA:188,DOM_VK_PERIOD:190,DOM_VK_SLASH:191,DOM_VK_BACK_QUOTE:192,DOM_VK_OPEN_BRACKET:219,DOM_VK_BACK_SLASH:220,DOM_VK_CLOSE_BRACKET:221,DOM_VK_QUOTE:222,DOM_VK_META:224}
		}this.Ajax={requests:[],transport:null,states:["Uninitialized","Loading","Loaded","Interactive","Complete"],initialize:function(){this.transport=FBL.getNativeXHRObject()
		},getXHRObject:function(){var xhrObj=false;
		try{xhrObj=new XMLHttpRequest()
		}catch(e){var progid=["MSXML2.XMLHTTP.5.0","MSXML2.XMLHTTP.4.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"];
		for(var i=0;
		i<progid.length;
		++i){try{xhrObj=new ActiveXObject(progid[i])
		}catch(e){continue
		}break
		}}finally{return xhrObj
		}},request:function(options){var o=FBL.extend({type:"get",async:true,dataType:"text",contentType:"application/x-www-form-urlencoded"},options||{});
		this.requests.push(o);
		var s=this.getState();
		if(s=="Uninitialized"||s=="Complete"||s=="Loaded"){this.sendRequest()
		}},serialize:function(data){var r=[""],rl=0;
		if(data){if(typeof data=="string"){r[rl++]=data
		}else{if(data.innerHTML&&data.elements){for(var i=0,el,l=(el=data.elements).length;
		i<l;
		i++){if(el[i].name){r[rl++]=encodeURIComponent(el[i].name);
		r[rl++]="=";
		r[rl++]=encodeURIComponent(el[i].value);
		r[rl++]="&"
		}}}else{for(var param in data){r[rl++]=encodeURIComponent(param);
		r[rl++]="=";
		r[rl++]=encodeURIComponent(data[param]);
		r[rl++]="&"
		}}}}return r.join("").replace(/&$/,"")
		},sendRequest:function(){var t=FBL.Ajax.transport,r=FBL.Ajax.requests.shift(),data;
		t.open(r.type,r.url,r.async);
		t.setRequestHeader("X-Requested-With","XMLHttpRequest");
		if(data=FBL.Ajax.serialize(r.data)){t.setRequestHeader("Content-Type",r.contentType)
		}t.onreadystatechange=function(){FBL.Ajax.onStateChange(r)
		};
		t.send(data)
		},onStateChange:function(options){var fn,o=options,t=this.transport;
		var state=this.getState(t);
		if(fn=o["on"+state]){fn(this.getResponse(o),o)
		}if(state=="Complete"){var success=t.status==200,response=this.getResponse(o);
		if(fn=o.onUpdate){fn(response,o)
		}if(fn=o["on"+(success?"Success":"Failure")]){fn(response,o)
		}t.onreadystatechange=FBL.emptyFn;
		if(this.requests.length>0){setTimeout(this.sendRequest,10)
		}}},getResponse:function(options){var t=this.transport,type=options.dataType;
		if(t.status!=200){return t.statusText
		}else{if(type=="text"){return t.responseText
		}else{if(type=="html"){return t.responseText
		}else{if(type=="xml"){return t.responseXML
		}else{if(type=="json"){return eval("("+t.responseText+")")
		}}}}}},getState:function(){return this.states[this.transport.readyState]
		}};
		this.createCookie=function(name,value,days){if("cookie" in document){if(days){var date=new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires="; expires="+date.toGMTString()
		}else{var expires=""
		}document.cookie=name+"="+value+expires+"; path=/"
		}};
		this.readCookie=function(name){if("cookie" in document){var nameEQ=name+"=";
		var ca=document.cookie.split(";");
		for(var i=0;
		i<ca.length;
		i++){var c=ca[i];
		while(c.charAt(0)==" "){c=c.substring(1,c.length)
		}if(c.indexOf(nameEQ)==0){return c.substring(nameEQ.length,c.length)
		}}}return null
		};
		this.removeCookie=function(name){this.createCookie(name,"",-1)
		};
		var fixIE6BackgroundImageCache=function(doc){doc=doc||document;
		try{doc.execCommand("BackgroundImageCache",false,true)
		}catch(E){}};
		var resetStyle="margin:0; padding:0; border:0; position:absolute; overflow:hidden; display:block;";
		var calculatePixelsPerInch=function calculatePixelsPerInch(doc,body){var inch=FBL.createGlobalElement("div");
		inch.style.cssText=resetStyle+"width:1in; height:1in; position:absolute; top:-1234px; left:-1234px;";
		body.appendChild(inch);
		FBL.pixelsPerInch={x:inch.offsetWidth,y:inch.offsetHeight};
		body.removeChild(inch)
		};
		this.SourceLink=function(url,line,type,object,instance){this.href=url;
		this.instance=instance;
		this.line=line;
		this.type=type;
		this.object=object
		};
		this.SourceLink.prototype={toString:function(){return this.href
		},toJSON:function(){return'{"href":"'+this.href+'", '+(this.line?('"line":'+this.line+","):"")+(this.type?(' "type":"'+this.type+'",'):"")+"}"
		}};
		this.SourceText=function(lines,owner){this.lines=lines;
		this.owner=owner
		};
		this.SourceText.getLineAsHTML=function(lineNo){return escapeForSourceLine(this.lines[lineNo-1])
		}
		}).apply(FBL);
		FBL.ns(function(){with(FBL){var oSTR={NoMembersWarning:"There are no properties to show for this object.",EmptyStyleSheet:"There are no rules in this stylesheet.",EmptyElementCSS:"This element has no style rules.",AccessRestricted:"Access to restricted URI denied.","net.label.Parameters":"Parameters","net.label.Source":"Source",URLParameters:"Params",EditStyle:"Edit Element Style...",NewRule:"New Rule...",NewProp:"New Property...",EditProp:'Edit "%s"',DeleteProp:'Delete "%s"',DisableProp:'Disable "%s"'};
		FBL.$STR=function(name){return oSTR.hasOwnProperty(name)?oSTR[name]:name
		};
		FBL.$STRF=function(name,args){if(!oSTR.hasOwnProperty(name)){return name
		}var format=oSTR[name];
		var objIndex=0;
		var parts=parseFormat(format);
		var trialIndex=objIndex;
		var objects=args;
		for(var i=0;
		i<parts.length;
		i++){var part=parts[i];
		if(part&&typeof(part)=="object"){if(++trialIndex>objects.length){format="";
		objIndex=-1;
		parts.length=0;
		break
		}}}var result=[];
		for(var i=0;
		i<parts.length;
		++i){var part=parts[i];
		if(part&&typeof(part)=="object"){result.push(""+args.shift())
		}else{result.push(part)
		}}return result.join("")
		};
		var parseFormat=function parseFormat(format){var parts=[];
		if(format.length<=0){return parts
		}var reg=/((^%|.%)(\d+)?(\.)([a-zA-Z]))|((^%|.%)([a-zA-Z]))/;
		for(var m=reg.exec(format);
		m;
		m=reg.exec(format)){if(m[0].substr(0,2)=="%%"){parts.push(format.substr(0,m.index));
		parts.push(m[0].substr(1))
		}else{var type=m[8]?m[8]:m[5];
		var precision=m[3]?parseInt(m[3]):(m[4]=="."?-1:0);
		var rep=null;
		switch(type){case"s":rep=FirebugReps.Text;
		break;
		case"f":case"i":case"d":rep=FirebugReps.Number;
		break;
		case"o":rep=null;
		break
		}parts.push(format.substr(0,m[0][0]=="%"?m.index:m.index+1));
		parts.push({rep:rep,precision:precision,type:("%"+type)})
		}format=format.substr(m.index+m[0].length)
		}parts.push(format);
		return parts
		}
		}});
		FBL.ns(function(){with(FBL){var modules=[];
		var panelTypes=[];
		var panelTypeMap={};
		var reps=[];
		var parentPanelMap={};
		FBL.Firebug={version:"Firebug Lite 1.4.0",revision:"$Revision$",modules:modules,panelTypes:panelTypes,panelTypeMap:panelTypeMap,reps:reps,initialize:function(){if(FBTrace.DBG_INITIALIZE){FBTrace.sysout("Firebug.initialize","initializing application")
		}Firebug.browser=new Context(Env.browser);
		Firebug.context=Firebug.browser;
		Firebug.loadPrefs();
		Firebug.context.persistedState.isOpen=false;
		cacheDocument();
		if(Firebug.Inspector&&Firebug.Inspector.create){Firebug.Inspector.create()
		}if(FBL.CssAnalyzer&&FBL.CssAnalyzer.processAllStyleSheets){FBL.CssAnalyzer.processAllStyleSheets(Firebug.browser.document)
		}FirebugChrome.initialize();
		dispatch(modules,"initialize",[]);
		if(Firebug.disableResourceFetching){Firebug.Console.logFormatted(['Some Firebug Lite features are not working because resource fetching is disabled. To enabled it set the Firebug Lite option "disableResourceFetching" to "false". More info at http://getfirebug.com/firebuglite#Options'],Firebug.context,"warn")
		}if(Env.onLoad){var onLoad=Env.onLoad;
		delete Env.onLoad;
		setTimeout(onLoad,200)
		}},shutdown:function(){if(Firebug.saveCookies){Firebug.savePrefs()
		}if(Firebug.Inspector){Firebug.Inspector.destroy()
		}dispatch(modules,"shutdown",[]);
		var chromeMap=FirebugChrome.chromeMap;
		for(var name in chromeMap){if(chromeMap.hasOwnProperty(name)){try{chromeMap[name].destroy()
		}catch(E){if(FBTrace.DBG_ERRORS){FBTrace.sysout("chrome.destroy() failed to: "+name)
		}}}}Firebug.Lite.Cache.Element.clear();
		Firebug.Lite.Cache.StyleSheet.clear();
		Firebug.browser=null;
		Firebug.context=null
		},registerModule:function(){modules.push.apply(modules,arguments);
		if(FBTrace.DBG_INITIALIZE){FBTrace.sysout("Firebug.registerModule")
		}},registerPanel:function(){panelTypes.push.apply(panelTypes,arguments);
		for(var i=0,panelType;
		panelType=arguments[i];
		++i){panelTypeMap[panelType.prototype.name]=arguments[i];
		if(panelType.prototype.parentPanel){parentPanelMap[panelType.prototype.parentPanel]=1
		}}if(FBTrace.DBG_INITIALIZE){for(var i=0;
		i<arguments.length;
		++i){FBTrace.sysout("Firebug.registerPanel",arguments[i].prototype.name)
		}}},registerRep:function(){reps.push.apply(reps,arguments)
		},unregisterRep:function(){for(var i=0;
		i<arguments.length;
		++i){remove(reps,arguments[i])
		}},setDefaultReps:function(funcRep,rep){FBL.defaultRep=rep;
		FBL.defaultFuncRep=funcRep
		},getRep:function(object){var type=typeof object;
		if(isIE&&isFunction(object)){type="function"
		}for(var i=0;
		i<reps.length;
		++i){var rep=reps[i];
		try{if(rep.supportsObject(object,type)){if(FBTrace.DBG_DOM){FBTrace.sysout("getRep type: "+type+" object: "+object,rep)
		}return rep
		}}catch(exc){if(FBTrace.DBG_ERRORS){FBTrace.sysout("firebug.getRep FAILS: ",exc.message||exc);
		FBTrace.sysout("firebug.getRep reps["+i+"/"+reps.length+"]: Rep="+reps[i].className)
		}}}return(type=="function")?defaultFuncRep:defaultRep
		},getRepObject:function(node){var target=null;
		for(var child=node;
		child;
		child=child.parentNode){if(hasClass(child,"repTarget")){target=child
		}if(child.repObject){if(!target&&hasClass(child,"repIgnore")){break
		}else{return child.repObject
		}}}},getRepNode:function(node){for(var child=node;
		child;
		child=child.parentNode){if(child.repObject){return child
		}}},getElementByRepObject:function(element,object){for(var child=element.firstChild;
		child;
		child=child.nextSibling){if(child.repObject==object){return child
		}}},getPref:function(name){return Firebug[name]
		},setPref:function(name,value){Firebug[name]=value;
		Firebug.savePrefs()
		},setPrefs:function(prefs){for(var name in prefs){if(prefs.hasOwnProperty(name)){Firebug[name]=prefs[name]
		}}Firebug.savePrefs()
		},restorePrefs:function(){var Options=Env.DefaultOptions;
		for(var name in Options){Firebug[name]=Options[name]
		}},loadPrefs:function(){this.restorePrefs();
		var prefs=Store.get("FirebugLite")||{};
		var options=prefs.options;
		var persistedState=prefs.persistedState||FBL.defaultPersistedState;
		for(var name in options){if(options.hasOwnProperty(name)){Firebug[name]=options[name]
		}}if(Firebug.context&&persistedState){Firebug.context.persistedState=persistedState
		}},savePrefs:function(){var prefs={options:{}};
		var EnvOptions=Env.Options;
		var options=prefs.options;
		for(var name in EnvOptions){if(EnvOptions.hasOwnProperty(name)){options[name]=Firebug[name]
		}}var persistedState=Firebug.context.persistedState;
		if(!persistedState){persistedState=Firebug.context.persistedState=FBL.defaultPersistedState
		}prefs.persistedState=persistedState;
		Store.set("FirebugLite",prefs)
		},erasePrefs:function(){Store.remove("FirebugLite");
		this.restorePrefs()
		}};
		Firebug.restorePrefs();
		window.Firebug=FBL.Firebug;
		if(!Env.Options.enablePersistent||Env.Options.enablePersistent&&Env.isChromeContext||Env.isDebugMode){Env.browser.window.Firebug=FBL.Firebug
		}FBL.cacheDocument=function cacheDocument(){var ElementCache=Firebug.Lite.Cache.Element;
		var els=Firebug.browser.document.getElementsByTagName("*");
		for(var i=0,l=els.length,el;
		i<l;
		i++){el=els[i];
		ElementCache(el)
		}};
		Firebug.Listener=function(){this.fbListeners=null
		};
		Firebug.Listener.prototype={addListener:function(listener){if(!this.fbListeners){this.fbListeners=[]
		}this.fbListeners.push(listener)
		},removeListener:function(listener){remove(this.fbListeners,listener)
		}};
		Firebug.Module=extend(new Firebug.Listener(),{initialize:function(){},shutdown:function(){},initContext:function(context){},reattachContext:function(browser,context){},destroyContext:function(context,persistedState){},showContext:function(browser,context){},loadedContext:function(context){},showPanel:function(browser,panel){},showSidePanel:function(browser,panel){},updateOption:function(name,value){},getObjectByURL:function(context,url){}});
		Firebug.Panel={name:"HelloWorld",title:"Hello World!",parentPanel:null,options:{hasCommandLine:false,hasStatusBar:false,hasToolButtons:false,isPreRendered:false,innerHTMLSync:false},tabNode:null,panelNode:null,sidePanelNode:null,statusBarNode:null,toolButtonsNode:null,panelBarNode:null,sidePanelBarBoxNode:null,sidePanelBarNode:null,sidePanelBar:null,searchable:false,editable:true,order:2147483647,statusSeparator:"<",create:function(context,doc){this.hasSidePanel=parentPanelMap.hasOwnProperty(this.name);
		this.panelBarNode=$("fbPanelBar1");
		this.sidePanelBarBoxNode=$("fbPanelBar2");
		if(this.hasSidePanel){this.sidePanelBar=extend({},PanelBar);
		this.sidePanelBar.create(this)
		}var options=this.options=extend(Firebug.Panel.options,this.options);
		var panelId="fb"+this.name;
		if(options.isPreRendered){this.panelNode=$(panelId);
		this.tabNode=$(panelId+"Tab");
		this.tabNode.style.display="block";
		if(options.hasToolButtons){this.toolButtonsNode=$(panelId+"Buttons")
		}if(options.hasStatusBar){this.statusBarBox=$("fbStatusBarBox");
		this.statusBarNode=$(panelId+"StatusBar")
		}}else{var containerSufix=this.parentPanel?"2":"1";
		var panelNode=this.panelNode=createElement("div",{id:panelId,className:"fbPanel"});
		$("fbPanel"+containerSufix).appendChild(panelNode);
		var tabHTML='<span class="fbTabL"></span><span class="fbTabText">'+this.title+'</span><span class="fbTabR"></span>';
		var tabNode=this.tabNode=createElement("a",{id:panelId+"Tab",className:"fbTab fbHover",innerHTML:tabHTML});
		if(isIE6){tabNode.href="javascript:void(0)"
		}var panelBarNode=this.parentPanel?Firebug.chrome.getPanel(this.parentPanel).sidePanelBarNode:this.panelBarNode;
		panelBarNode.appendChild(tabNode);
		tabNode.style.display="block";
		if(options.hasToolButtons){this.toolButtonsNode=createElement("span",{id:panelId+"Buttons",className:"fbToolbarButtons"});
		$("fbToolbarButtons").appendChild(this.toolButtonsNode)
		}if(options.hasStatusBar){this.statusBarBox=$("fbStatusBarBox");
		this.statusBarNode=createElement("span",{id:panelId+"StatusBar",className:"fbToolbarButtons fbStatusBar"});
		this.statusBarBox.appendChild(this.statusBarNode)
		}}this.containerNode=this.panelNode.parentNode;
		if(FBTrace.DBG_INITIALIZE){FBTrace.sysout("Firebug.Panel.create",this.name)
		}this.onContextMenu=bind(this.onContextMenu,this)
		},destroy:function(state){if(FBTrace.DBG_INITIALIZE){FBTrace.sysout("Firebug.Panel.destroy",this.name)
		}if(this.hasSidePanel){this.sidePanelBar.destroy();
		this.sidePanelBar=null
		}this.options=null;
		this.name=null;
		this.parentPanel=null;
		this.tabNode=null;
		this.panelNode=null;
		this.containerNode=null;
		this.toolButtonsNode=null;
		this.statusBarBox=null;
		this.statusBarNode=null
		},initialize:function(){if(FBTrace.DBG_INITIALIZE){FBTrace.sysout("Firebug.Panel.initialize",this.name)
		}if(this.hasSidePanel){this.sidePanelBar.initialize()
		}var options=this.options=extend(Firebug.Panel.options,this.options);
		var panelId="fb"+this.name;
		this.panelNode=$(panelId);
		this.tabNode=$(panelId+"Tab");
		this.tabNode.style.display="block";
		if(options.hasStatusBar){this.statusBarBox=$("fbStatusBarBox");
		this.statusBarNode=$(panelId+"StatusBar")
		}if(options.hasToolButtons){this.toolButtonsNode=$(panelId+"Buttons")
		}this.containerNode=this.panelNode.parentNode;
		this.containerNode.scrollTop=this.lastScrollTop;
		addEvent(this.containerNode,"contextmenu",this.onContextMenu);
		Firebug.chrome.currentPanel=Firebug.chrome.selectedPanel&&Firebug.chrome.selectedPanel.sidePanelBar?Firebug.chrome.selectedPanel.sidePanelBar.selectedPanel:Firebug.chrome.selectedPanel;
		Firebug.showInfoTips=true;
		if(Firebug.InfoTip){Firebug.InfoTip.initializeBrowser(Firebug.chrome)
		}},shutdown:function(){if(FBTrace.DBG_INITIALIZE){FBTrace.sysout("Firebug.Panel.shutdown",this.name)
		}if(Firebug.InfoTip){Firebug.InfoTip.uninitializeBrowser(Firebug.chrome)
		}if(Firebug.chrome.largeCommandLineVisible){Firebug.chrome.hideLargeCommandLine()
		}if(this.hasSidePanel){}this.lastScrollTop=this.containerNode.scrollTop;
		removeEvent(this.containerNode,"contextmenu",this.onContextMenu)
		},detach:function(oldChrome,newChrome){if(oldChrome&&oldChrome.selectedPanel&&oldChrome.selectedPanel.name==this.name){this.lastScrollTop=oldChrome.selectedPanel.containerNode.scrollTop
		}},reattach:function(doc){if(this.options.innerHTMLSync){this.synchronizeUI()
		}},synchronizeUI:function(){this.containerNode.scrollTop=this.lastScrollTop||0
		},show:function(state){var options=this.options;
		if(options.hasStatusBar){this.statusBarBox.style.display="inline";
		this.statusBarNode.style.display="inline"
		}if(options.hasToolButtons){this.toolButtonsNode.style.display="inline"
		}this.panelNode.style.display="block";
		this.visible=true;
		if(!this.parentPanel){Firebug.chrome.layout(this)
		}},hide:function(state){var options=this.options;
		if(options.hasStatusBar){this.statusBarBox.style.display="none";
		this.statusBarNode.style.display="none"
		}if(options.hasToolButtons){this.toolButtonsNode.style.display="none"
		}this.panelNode.style.display="none";
		this.visible=false
		},watchWindow:function(win){},unwatchWindow:function(win){},updateOption:function(name,value){},showToolbarButtons:function(buttonsId,show){try{if(!this.context.browser){if(FBTrace.DBG_ERRORS){FBTrace.sysout("firebug.Panel showToolbarButtons this.context has no browser, this:",this)
		}return
		}var buttons=this.context.browser.chrome.$(buttonsId);
		if(buttons){collapse(buttons,show?"false":"true")
		}}catch(exc){if(FBTrace.DBG_ERRORS){FBTrace.dumpProperties("firebug.Panel showToolbarButtons FAILS",exc);
		if(!this.context.browser){FBTrace.dumpStack("firebug.Panel showToolbarButtons no browser")
		}}}},supportsObject:function(object){return 0
		},hasObject:function(object){return false
		},select:function(object,forceUpdate){if(!object){object=this.getDefaultSelection(this.context)
		}if(FBTrace.DBG_PANELS){FBTrace.sysout("firebug.select "+this.name+" forceUpdate: "+forceUpdate+" "+object+((object==this.selection)?"==":"!=")+this.selection)
		}if(forceUpdate||object!=this.selection){this.selection=object;
		this.updateSelection(object)
		}},updateSelection:function(object){},markChange:function(skipSelf){if(this.dependents){if(skipSelf){for(var i=0;
		i<this.dependents.length;
		++i){var panelName=this.dependents[i];
		if(panelName!=this.name){this.context.invalidatePanels(panelName)
		}}}else{this.context.invalidatePanels.apply(this.context,this.dependents)
		}}},startInspecting:function(){},stopInspecting:function(object,cancelled){},search:function(text,reverse){},getSearchOptionsMenuItems:function(){return[Firebug.Search.searchOptionMenu("search.Case Sensitive","searchCaseSensitive")]
		},navigateToNextDocument:function(match,reverse){var self=this;
		function compare(a,b){var locA=self.getObjectDescription(a);
		var locB=self.getObjectDescription(b);
		if(locA.path>locB.path){return 1
		}if(locA.path<locB.path){return -1
		}if(locA.name>locB.name){return 1
		}if(locA.name<locB.name){return -1
		}return 0
		}var allLocs=this.getLocationList().sort(compare);
		for(var curPos=0;
		curPos<allLocs.length&&allLocs[curPos]!=this.location;
		curPos++){}function transformIndex(index){if(reverse){var intermediate=curPos-index-1;
		return(intermediate<0?allLocs.length:0)+intermediate
		}else{return(curPos+index+1)%allLocs.length
		}}for(var next=0;
		next<allLocs.length-1;
		next++){var object=allLocs[transformIndex(next)];
		if(match(object)){this.navigate(object);
		return object
		}}},getOptionsMenuItems:function(){return null
		},getContextMenuItems:function(object,target){return[]
		},getBreakOnMenuItems:function(){return[]
		},getEditor:function(target,value){},getDefaultSelection:function(){return null
		},browseObject:function(object){},getPopupObject:function(target){return Firebug.getRepObject(target)
		},getTooltipObject:function(target){return Firebug.getRepObject(target)
		},showInfoTip:function(infoTip,x,y){},getObjectPath:function(object){return null
		},getLocationList:function(){return null
		},getDefaultLocation:function(){return null
		},getObjectLocation:function(object){return""
		},getObjectDescription:function(object){var url=this.getObjectLocation(object);
		return FBL.splitURLBase(url)
		},highlight:function(show){var tab=this.getTab();
		if(!tab){return
		}if(show){tab.setAttribute("highlight","true")
		}else{tab.removeAttribute("highlight")
		}},getTab:function(){var chrome=Firebug.chrome;
		var tab=chrome.$("fbPanelBar2").getTab(this.name);
		if(!tab){tab=chrome.$("fbPanelBar1").getTab(this.name)
		}return tab
		},breakOnNext:function(armed){},shouldBreakOnNext:function(){return false
		},getBreakOnNextTooltip:function(enabled){return null
		},onContextMenu:function(event){if(!this.getContextMenuItems){return
		}cancelEvent(event,true);
		var target=event.target||event.srcElement;
		var menu=this.getContextMenuItems(this.selection,target);
		if(!menu){return
		}var contextMenu=new Menu({id:"fbPanelContextMenu",items:menu});
		contextMenu.show(event.clientX,event.clientY);
		return true
		}};
		Firebug.MeasureBox={startMeasuring:function(target){if(!this.measureBox){this.measureBox=target.ownerDocument.createElement("span");
		this.measureBox.className="measureBox"
		}copyTextStyles(target,this.measureBox);
		target.ownerDocument.body.appendChild(this.measureBox)
		},getMeasuringElement:function(){return this.measureBox
		},measureText:function(value){this.measureBox.innerHTML=value?escapeForSourceLine(value):"m";
		return{width:this.measureBox.offsetWidth,height:this.measureBox.offsetHeight-1}
		},measureInputText:function(value){value=value?escapeForTextNode(value):"m";
		if(!Firebug.showTextNodesWithWhitespace){value=value.replace(/\t/g,"mmmmmm").replace(/\ /g,"m")
		}this.measureBox.innerHTML=value;
		return{width:this.measureBox.offsetWidth,height:this.measureBox.offsetHeight-1}
		},getBox:function(target){var style=this.measureBox.ownerDocument.defaultView.getComputedStyle(this.measureBox,"");
		var box=getBoxFromStyles(style,this.measureBox);
		return box
		},stopMeasuring:function(){this.measureBox.parentNode.removeChild(this.measureBox)
		}};
		if(FBL.domplate){Firebug.Rep=domplate({className:"",inspectable:true,supportsObject:function(object,type){return false
		},inspectObject:function(object,context){Firebug.chrome.select(object)
		},browseObject:function(object,context){},persistObject:function(object,context){},getRealObject:function(object,context){return object
		},getTitle:function(object){var label=safeToString(object);
		var re=/\[object (.*?)\]/;
		var m=re.exec(label);
		if(m){return m[1]
		}else{if(isIE&&(label=="[object]"||typeof object=="object"&&typeof label=="undefined")){return"Object"
		}else{return label
		}}},getTooltip:function(object){return null
		},getContextMenuItems:function(object,target,context){return[]
		},STR:function(name){return $STR(name)
		},cropString:function(text){return cropString(text)
		},cropMultipleLines:function(text,limit){return cropMultipleLines(text,limit)
		},toLowerCase:function(text){return text?text.toLowerCase():text
		},plural:function(n){return n==1?"":"s"
		}})
		}}});
		FBL.ns(function(){with(FBL){FBL.Controller={controllers:null,controllerContext:null,initialize:function(context){this.controllers=[];
		this.controllerContext=context||Firebug.chrome
		},shutdown:function(){this.removeControllers()
		},addController:function(){for(var i=0,arg;
		arg=arguments[i];
		i++){if(typeof arg[0]=="string"){arg[0]=$$(arg[0],this.controllerContext)
		}var handler=arg[2];
		arg[2]=bind(handler,this);
		arg[3]=handler;
		this.controllers.push(arg);
		addEvent.apply(this,arg)
		}},removeController:function(){for(var i=0,arg;
		arg=arguments[i];
		i++){for(var j=0,c;
		c=this.controllers[j];
		j++){if(arg[0]==c[0]&&arg[1]==c[1]&&arg[2]==c[3]){removeEvent.apply(this,c)
		}}}},removeControllers:function(){for(var i=0,c;
		c=this.controllers[i];
		i++){removeEvent.apply(this,c)
		}}};
		FBL.PanelBar={panelMap:null,selectedPanel:null,parentPanelName:null,create:function(ownerPanel){this.panelMap={};
		this.ownerPanel=ownerPanel;
		if(ownerPanel){ownerPanel.sidePanelBarNode=createElement("span");
		ownerPanel.sidePanelBarNode.style.display="none";
		ownerPanel.sidePanelBarBoxNode.appendChild(ownerPanel.sidePanelBarNode)
		}var panels=Firebug.panelTypes;
		for(var i=0,p;
		p=panels[i];
		i++){if(!ownerPanel&&!p.prototype.parentPanel||ownerPanel&&p.prototype.parentPanel&&ownerPanel.name==p.prototype.parentPanel){this.addPanel(p.prototype.name)
		}}},destroy:function(){PanelBar.shutdown.call(this);
		for(var name in this.panelMap){this.removePanel(name);
		var panel=this.panelMap[name];
		panel.destroy();
		this.panelMap[name]=null;
		delete this.panelMap[name]
		}this.panelMap=null;
		this.ownerPanel=null
		},initialize:function(){if(this.ownerPanel){this.ownerPanel.sidePanelBarNode.style.display="inline"
		}for(var name in this.panelMap){(function(self,name){var onTabClick=function onTabClick(){self.selectPanel(name);
		return false
		};
		Firebug.chrome.addController([self.panelMap[name].tabNode,"mousedown",onTabClick])
		})(this,name)
		}},shutdown:function(){var selectedPanel=this.selectedPanel;
		if(selectedPanel){removeClass(selectedPanel.tabNode,"fbSelectedTab");
		selectedPanel.hide();
		selectedPanel.shutdown()
		}if(this.ownerPanel){this.ownerPanel.sidePanelBarNode.style.display="none"
		}this.selectedPanel=null
		},addPanel:function(panelName,parentPanel){var PanelType=Firebug.panelTypeMap[panelName];
		var panel=this.panelMap[panelName]=new PanelType();
		panel.create()
		},removePanel:function(panelName){var panel=this.panelMap[panelName];
		if(panel.hasOwnProperty(panelName)){panel.destroy()
		}},selectPanel:function(panelName){var selectedPanel=this.selectedPanel;
		var panel=this.panelMap[panelName];
		if(panel&&selectedPanel!=panel){if(selectedPanel){removeClass(selectedPanel.tabNode,"fbSelectedTab");
		selectedPanel.shutdown();
		selectedPanel.hide()
		}if(!panel.parentPanel){Firebug.context.persistedState.selectedPanelName=panelName
		}this.selectedPanel=panel;
		setClass(panel.tabNode,"fbSelectedTab");
		panel.show();
		panel.initialize()
		}},getPanel:function(panelName){var panel=this.panelMap[panelName];
		return panel
		}};
		FBL.Button=function(options){options=options||{};
		append(this,options);
		this.state="unpressed";
		this.display="unpressed";
		if(this.element){this.container=this.element.parentNode
		}else{this.shouldDestroy=true;
		this.container=this.owner.getPanel().toolButtonsNode;
		this.element=createElement("a",{className:this.baseClassName+" "+this.className+" fbHover",innerHTML:this.caption});
		if(this.title){this.element.title=this.title
		}this.container.appendChild(this.element)
		}};
		Button.prototype=extend(Controller,{type:"normal",caption:"caption",title:null,className:"",baseClassName:"fbButton",pressedClassName:"fbBtnPressed",element:null,container:null,owner:null,state:null,display:null,destroy:function(){this.shutdown();
		if(this.shouldDestroy){this.container.removeChild(this.element)
		}this.element=null;
		this.container=null;
		this.owner=null
		},initialize:function(){Controller.initialize.apply(this);
		var element=this.element;
		this.addController([element,"mousedown",this.handlePress]);
		if(this.type=="normal"){this.addController([element,"mouseup",this.handleUnpress],[element,"mouseout",this.handleUnpress],[element,"click",this.handleClick])
		}},shutdown:function(){Controller.shutdown.apply(this)
		},restore:function(){this.changeState("unpressed")
		},changeState:function(state){this.state=state;
		this.changeDisplay(state)
		},changeDisplay:function(display){if(display!=this.display){if(display=="pressed"){setClass(this.element,this.pressedClassName)
		}else{if(display=="unpressed"){removeClass(this.element,this.pressedClassName)
		}}this.display=display
		}},handlePress:function(event){cancelEvent(event,true);
		if(this.type=="normal"){this.changeDisplay("pressed");
		this.beforeClick=true
		}else{if(this.type=="toggle"){if(this.state=="pressed"){this.changeState("unpressed");
		if(this.onUnpress){this.onUnpress.apply(this.owner,arguments)
		}}else{this.changeState("pressed");
		if(this.onPress){this.onPress.apply(this.owner,arguments)
		}}if(this.onClick){this.onClick.apply(this.owner,arguments)
		}}}return false
		},handleUnpress:function(event){cancelEvent(event,true);
		if(this.beforeClick){this.changeDisplay("unpressed")
		}return false
		},handleClick:function(event){cancelEvent(event,true);
		if(this.type=="normal"){if(this.onClick){this.onClick.apply(this.owner)
		}this.changeState("unpressed")
		}this.beforeClick=false;
		return false
		}});
		FBL.IconButton=function(){Button.apply(this,arguments)
		};
		IconButton.prototype=extend(Button.prototype,{baseClassName:"fbIconButton",pressedClassName:"fbIconPressed"});
		var menuItemProps={"class":"$item.className",type:"$item.type",value:"$item.value",_command:"$item.command"};
		if(isIE6){menuItemProps.href="javascript:void(0)"
		}if(FBL.domplate){var MenuPlate=domplate(Firebug.Rep,{tag:DIV({"class":"fbMenu fbShadow"},DIV({"class":"fbMenuContent fbShadowContent"},FOR("item","$object.items|memberIterator",TAG("$item.tag",{item:"$item"})))),itemTag:A(menuItemProps,"$item.label"),checkBoxTag:A(extend(menuItemProps,{checked:"$item.checked"}),"$item.label"),radioButtonTag:A(extend(menuItemProps,{selected:"$item.selected"}),"$item.label"),groupTag:A(extend(menuItemProps,{child:"$item.child"}),"$item.label"),shortcutTag:A(menuItemProps,"$item.label",SPAN({"class":"fbMenuShortcutKey"},"$item.key")),separatorTag:SPAN({"class":"fbMenuSeparator"}),memberIterator:function(items){var result=[];
		for(var i=0,length=items.length;
		i<length;
		i++){var item=items[i];
		if(typeof item=="string"&&item.indexOf("-")==0){result.push({tag:this.separatorTag});
		continue
		}item=extend(item,{});
		item.type=item.type||"";
		item.value=item.value||"";
		var type=item.type;
		item.tag=this.itemTag;
		var className=item.className||"";
		className+="fbMenuOption fbHover ";
		if(type=="checkbox"){className+="fbMenuCheckBox ";
		item.tag=this.checkBoxTag
		}else{if(type=="radiobutton"){className+="fbMenuRadioButton ";
		item.tag=this.radioButtonTag
		}else{if(type=="group"){className+="fbMenuGroup ";
		item.tag=this.groupTag
		}else{if(type=="shortcut"){className+="fbMenuShortcut ";
		item.tag=this.shortcutTag
		}}}}if(item.checked){className+="fbMenuChecked "
		}else{if(item.selected){className+="fbMenuRadioSelected "
		}}if(item.disabled){className+="fbMenuDisabled "
		}item.className=className;
		item.label=$STR(item.label);
		result.push(item)
		}return result
		}})
		}FBL.Menu=function(options){if(!options.element){if(options.getItems){options.items=options.getItems()
		}options.element=MenuPlate.tag.append({object:options},getElementByClass(Firebug.chrome.document,"fbBody"),MenuPlate)
		}append(this,options);
		if(typeof this.element=="string"){this.id=this.element;
		this.element=$(this.id)
		}else{if(this.id){this.element.id=this.id
		}}this.element.firebugIgnore=true;
		this.elementStyle=this.element.style;
		this.isVisible=false;
		this.handleMouseDown=bind(this.handleMouseDown,this);
		this.handleMouseOver=bind(this.handleMouseOver,this);
		this.handleMouseOut=bind(this.handleMouseOut,this);
		this.handleWindowMouseDown=bind(this.handleWindowMouseDown,this)
		};
		var menuMap={};
		Menu.prototype=extend(Controller,{destroy:function(){this.hide();
		if(this.parentMenu){this.parentMenu.childMenu=null
		}this.element.parentNode.removeChild(this.element);
		this.element=null;
		this.elementStyle=null;
		this.parentMenu=null;
		this.parentTarget=null
		},initialize:function(){Controller.initialize.call(this);
		this.addController([this.element,"mousedown",this.handleMouseDown],[this.element,"mouseover",this.handleMouseOver])
		},shutdown:function(){Controller.shutdown.call(this)
		},show:function(x,y){this.initialize();
		if(this.isVisible){return
		}x=x||0;
		y=y||0;
		if(this.parentMenu){var oldChildMenu=this.parentMenu.childMenu;
		if(oldChildMenu&&oldChildMenu!=this){oldChildMenu.destroy()
		}this.parentMenu.childMenu=this
		}else{addEvent(Firebug.chrome.document,"mousedown",this.handleWindowMouseDown)
		}this.elementStyle.display="block";
		this.elementStyle.visibility="hidden";
		var size=Firebug.chrome.getSize();
		x=Math.min(x,size.width-this.element.clientWidth-10);
		x=Math.max(x,0);
		y=Math.min(y,size.height-this.element.clientHeight-10);
		y=Math.max(y,0);
		this.elementStyle.left=x+"px";
		this.elementStyle.top=y+"px";
		this.elementStyle.visibility="visible";
		this.isVisible=true;
		if(isFunction(this.onShow)){this.onShow.apply(this,arguments)
		}},hide:function(){this.clearHideTimeout();
		this.clearShowChildTimeout();
		if(!this.isVisible){return
		}this.elementStyle.display="none";
		if(this.childMenu){this.childMenu.destroy();
		this.childMenu=null
		}if(this.parentTarget){removeClass(this.parentTarget,"fbMenuGroupSelected")
		}this.isVisible=false;
		this.shutdown();
		if(isFunction(this.onHide)){this.onHide.apply(this,arguments)
		}},showChildMenu:function(target){var id=target.getAttribute("child");
		var parent=this;
		var target=target;
		this.showChildTimeout=Firebug.chrome.window.setTimeout(function(){var box=Firebug.chrome.getElementBox(target);
		var childMenuObject=menuMap.hasOwnProperty(id)?menuMap[id]:{element:$(id)};
		var childMenu=new Menu(extend(childMenuObject,{parentMenu:parent,parentTarget:target}));
		var offsetLeft=isIE6?-1:-6;
		childMenu.show(box.left+box.width+offsetLeft,box.top-6);
		setClass(target,"fbMenuGroupSelected")
		},350)
		},clearHideTimeout:function(){if(this.hideTimeout){Firebug.chrome.window.clearTimeout(this.hideTimeout);
		delete this.hideTimeout
		}},clearShowChildTimeout:function(){if(this.showChildTimeout){Firebug.chrome.window.clearTimeout(this.showChildTimeout);
		this.showChildTimeout=null
		}},handleMouseDown:function(event){cancelEvent(event,true);
		var topParent=this;
		while(topParent.parentMenu){topParent=topParent.parentMenu
		}var target=event.target||event.srcElement;
		target=getAncestorByClass(target,"fbMenuOption");
		if(!target||hasClass(target,"fbMenuGroup")){return false
		}if(target&&!hasClass(target,"fbMenuDisabled")){var type=target.getAttribute("type");
		if(type=="checkbox"){var checked=target.getAttribute("checked");
		var value=target.getAttribute("value");
		var wasChecked=hasClass(target,"fbMenuChecked");
		if(wasChecked){removeClass(target,"fbMenuChecked");
		target.setAttribute("checked","")
		}else{setClass(target,"fbMenuChecked");
		target.setAttribute("checked","true")
		}if(isFunction(this.onCheck)){this.onCheck.call(this,target,value,!wasChecked)
		}}if(type=="radiobutton"){var selectedRadios=getElementsByClass(target.parentNode,"fbMenuRadioSelected");
		var group=target.getAttribute("group");
		for(var i=0,length=selectedRadios.length;
		i<length;
		i++){radio=selectedRadios[i];
		if(radio.getAttribute("group")==group){removeClass(radio,"fbMenuRadioSelected");
		radio.setAttribute("selected","")
		}}setClass(target,"fbMenuRadioSelected");
		target.setAttribute("selected","true")
		}var handler=null;
		var cmd=target.command;
		if(isFunction(cmd)){handler=cmd
		}else{if(typeof cmd=="string"){handler=this[cmd]
		}}var closeMenu=true;
		if(handler){closeMenu=handler.call(this,target)!==false
		}if(closeMenu){topParent.hide()
		}}return false
		},handleWindowMouseDown:function(event){var target=event.target||event.srcElement;
		target=getAncestorByClass(target,"fbMenu");
		if(!target){removeEvent(Firebug.chrome.document,"mousedown",this.handleWindowMouseDown);
		this.hide()
		}},handleMouseOver:function(event){this.clearHideTimeout();
		this.clearShowChildTimeout();
		var target=event.target||event.srcElement;
		target=getAncestorByClass(target,"fbMenuOption");
		if(!target){return
		}var childMenu=this.childMenu;
		if(childMenu){removeClass(childMenu.parentTarget,"fbMenuGroupSelected");
		if(childMenu.parentTarget!=target&&childMenu.isVisible){childMenu.clearHideTimeout();
		childMenu.hideTimeout=Firebug.chrome.window.setTimeout(function(){childMenu.destroy()
		},300)
		}}if(hasClass(target,"fbMenuGroup")){this.showChildMenu(target)
		}}});
		append(Menu,{register:function(object){menuMap[object.id]=object
		},check:function(element){setClass(element,"fbMenuChecked");
		element.setAttribute("checked","true")
		},uncheck:function(element){removeClass(element,"fbMenuChecked");
		element.setAttribute("checked","")
		},disable:function(element){setClass(element,"fbMenuDisabled")
		},enable:function(element){removeClass(element,"fbMenuDisabled")
		}});
		function StatusBar(){}StatusBar.prototype=extend(Controller,{})
		}});
		FBL.ns(function(){with(FBL){var refreshDelay=300;
		var shouldFixElementFromPoint=isOpera||isSafari&&browserVersion<"532";
		var evalError="___firebug_evaluation_error___";
		var pixelsPerInch;
		var resetStyle="margin:0; padding:0; border:0; position:absolute; overflow:hidden; display:block;";
		var offscreenStyle=resetStyle+"top:-1234px; left:-1234px;";
		FBL.Context=function(win){this.window=win.window;
		this.document=win.document;
		this.browser=Env.browser;
		if(isIE&&!this.window.eval){this.window.execScript("null");
		if(!this.window.eval){throw new Error("Firebug Error: eval() method not found in this window")
		}}this.eval=this.window.eval("new Function('try{ return window.eval.apply(window,arguments) }catch(E){ E."+evalError+"=true; return E }')")
		};
		FBL.Context.prototype={browser:null,loaded:true,setTimeout:function(fn,delay){var win=this.window;
		if(win.setTimeout==this.setTimeout){throw new Error("setTimeout recursion")
		}var timeout=win.setTimeout.apply?win.setTimeout.apply(win,arguments):win.setTimeout(fn,delay);
		if(!this.timeouts){this.timeouts={}
		}this.timeouts[timeout]=1;
		return timeout
		},clearTimeout:function(timeout){clearTimeout(timeout);
		if(this.timeouts){delete this.timeouts[timeout]
		}},setInterval:function(fn,delay){var win=this.window;
		var timeout=win.setInterval.apply?win.setInterval.apply(win,arguments):win.setInterval(fn,delay);
		if(!this.intervals){this.intervals={}
		}this.intervals[timeout]=1;
		return timeout
		},clearInterval:function(timeout){clearInterval(timeout);
		if(this.intervals){delete this.intervals[timeout]
		}},invalidatePanels:function(){if(!this.invalidPanels){this.invalidPanels={}
		}for(var i=0;
		i<arguments.length;
		++i){var panelName=arguments[i];
		if(!Firebug.chrome||!Firebug.chrome.selectedPanel){return
		}var panel=Firebug.chrome.selectedPanel.sidePanelBar?Firebug.chrome.selectedPanel.sidePanelBar.getPanel(panelName,true):null;
		if(panel&&!panel.noRefresh){this.invalidPanels[panelName]=1
		}}if(this.refreshTimeout){this.clearTimeout(this.refreshTimeout);
		delete this.refreshTimeout
		}this.refreshTimeout=this.setTimeout(bindFixed(function(){var invalids=[];
		for(var panelName in this.invalidPanels){var panel=Firebug.chrome.selectedPanel.sidePanelBar?Firebug.chrome.selectedPanel.sidePanelBar.getPanel(panelName,true):null;
		if(panel){if(panel.visible&&!panel.editing){panel.refresh()
		}else{panel.needsRefresh=true
		}if(panel.editing){invalids.push(panelName)
		}}}delete this.invalidPanels;
		delete this.refreshTimeout;
		if(invalids.length){this.invalidatePanels.apply(this,invalids)
		}},this),refreshDelay)
		},evaluate:function(expr,context,api,errorHandler){context=context||"window";
		var isObjectLiteral=trim(expr).indexOf("{")==0,cmd,result;
		if(context=="window"){if(isObjectLiteral){cmd=api?"with("+api+"){ ("+expr+") }":"("+expr+")"
		}else{cmd=api?"with("+api+"){ "+expr+" }":expr
		}}else{cmd=api?"(function(arguments){ with("+api+"){ "+expr+" } }).call("+context+",undefined)":"(function(arguments){ "+expr+" }).call("+context+",undefined)"
		}result=this.eval(cmd);
		if(result&&result[evalError]){var msg=result.name?(result.name+": "):"";
		msg+=result.message||result;
		if(errorHandler){result=errorHandler(msg)
		}else{result=msg
		}}return result
		},getWindowSize:function(){var width=0,height=0,el;
		if(typeof this.window.innerWidth=="number"){width=this.window.innerWidth;
		height=this.window.innerHeight
		}else{if((el=this.document.documentElement)&&(el.clientHeight||el.clientWidth)){width=el.clientWidth;
		height=el.clientHeight
		}else{if((el=this.document.body)&&(el.clientHeight||el.clientWidth)){width=el.clientWidth;
		height=el.clientHeight
		}}}return{width:width,height:height}
		},getWindowScrollSize:function(){var width=0,height=0,el;
		if(!isIEQuiksMode&&(el=this.document.documentElement)&&(el.scrollHeight||el.scrollWidth)){width=el.scrollWidth;
		height=el.scrollHeight
		}if((el=this.document.body)&&(el.scrollHeight||el.scrollWidth)&&(el.scrollWidth>width||el.scrollHeight>height)){width=el.scrollWidth;
		height=el.scrollHeight
		}return{width:width,height:height}
		},getWindowScrollPosition:function(){var top=0,left=0,el;
		if(typeof this.window.pageYOffset=="number"){top=this.window.pageYOffset;
		left=this.window.pageXOffset
		}else{if((el=this.document.body)&&(el.scrollTop||el.scrollLeft)){top=el.scrollTop;
		left=el.scrollLeft
		}else{if((el=this.document.documentElement)&&(el.scrollTop||el.scrollLeft)){top=el.scrollTop;
		left=el.scrollLeft
		}}}return{top:top,left:left}
		},getElementFromPoint:function(x,y){if(shouldFixElementFromPoint){var scroll=this.getWindowScrollPosition();
		return this.document.elementFromPoint(x+scroll.left,y+scroll.top)
		}else{return this.document.elementFromPoint(x,y)
		}},getElementPosition:function(el){var left=0;
		var top=0;
		do{left+=el.offsetLeft;
		top+=el.offsetTop
		}while(el=el.offsetParent);
		return{left:left,top:top}
		},getElementBox:function(el){var result={};
		if(el.getBoundingClientRect){var rect=el.getBoundingClientRect();
		var offset=isIE?this.document.body.clientTop||this.document.documentElement.clientTop:0;
		var scroll=this.getWindowScrollPosition();
		result.top=Math.round(rect.top-offset+scroll.top);
		result.left=Math.round(rect.left-offset+scroll.left);
		result.height=Math.round(rect.bottom-rect.top);
		result.width=Math.round(rect.right-rect.left)
		}else{var position=this.getElementPosition(el);
		result.top=position.top;
		result.left=position.left;
		result.height=el.offsetHeight;
		result.width=el.offsetWidth
		}return result
		},getMeasurement:function(el,name){var result={value:0,unit:"px"};
		var cssValue=this.getStyle(el,name);
		if(!cssValue){return result
		}if(cssValue.toLowerCase()=="auto"){return result
		}var reMeasure=/(\d+\.?\d*)(.*)/;
		var m=cssValue.match(reMeasure);
		if(m){result.value=m[1]-0;
		result.unit=m[2].toLowerCase()
		}return result
		},getMeasurementInPixels:function(el,name){if(!el){return null
		}var m=this.getMeasurement(el,name);
		var value=m.value;
		var unit=m.unit;
		if(unit=="px"){return value
		}else{if(unit=="pt"){return this.pointsToPixels(name,value)
		}else{if(unit=="em"){return this.emToPixels(el,value)
		}else{if(unit=="%"){return this.percentToPixels(el,value)
		}else{if(unit=="ex"){return this.exToPixels(el,value)
		}}}}}},getMeasurementBox1:function(el,name){var sufixes=["Top","Left","Bottom","Right"];
		var result=[];
		for(var i=0,sufix;
		sufix=sufixes[i];
		i++){result[i]=Math.round(this.getMeasurementInPixels(el,name+sufix))
		}return{top:result[0],left:result[1],bottom:result[2],right:result[3]}
		},getMeasurementBox:function(el,name){var result=[];
		var sufixes=name=="border"?["TopWidth","LeftWidth","BottomWidth","RightWidth"]:["Top","Left","Bottom","Right"];
		if(isIE){var propName,cssValue;
		var autoMargin=null;
		for(var i=0,sufix;
		sufix=sufixes[i];
		i++){propName=name+sufix;
		cssValue=el.currentStyle[propName]||el.style[propName];
		if(cssValue=="auto"){if(!autoMargin){autoMargin=this.getCSSAutoMarginBox(el)
		}result[i]=autoMargin[sufix.toLowerCase()]
		}else{result[i]=this.getMeasurementInPixels(el,propName)
		}}}else{for(var i=0,sufix;
		sufix=sufixes[i];
		i++){result[i]=this.getMeasurementInPixels(el,name+sufix)
		}}return{top:result[0],left:result[1],bottom:result[2],right:result[3]}
		},getCSSAutoMarginBox:function(el){if(isIE&&" meta title input script link a ".indexOf(" "+el.nodeName.toLowerCase()+" ")!=-1){return{top:0,left:0,bottom:0,right:0}
		}if(isIE&&" h1 h2 h3 h4 h5 h6 h7 ul p ".indexOf(" "+el.nodeName.toLowerCase()+" ")==-1){return{top:0,left:0,bottom:0,right:0}
		}var offsetTop=0;
		if(false&&isIEStantandMode){var scrollSize=Firebug.browser.getWindowScrollSize();
		offsetTop=scrollSize.height
		}var box=this.document.createElement("div");
		box.style.cssText="margin:0; padding:1px; border: 0; visibility: hidden;";
		var clone=el.cloneNode(false);
		var text=this.document.createTextNode("&nbsp;");
		clone.appendChild(text);
		box.appendChild(clone);
		this.document.body.appendChild(box);
		var marginTop=clone.offsetTop-box.offsetTop-1;
		var marginBottom=box.offsetHeight-clone.offsetHeight-2-marginTop;
		var marginLeft=clone.offsetLeft-box.offsetLeft-1;
		var marginRight=box.offsetWidth-clone.offsetWidth-2-marginLeft;
		this.document.body.removeChild(box);
		return{top:marginTop+offsetTop,left:marginLeft,bottom:marginBottom-offsetTop,right:marginRight}
		},getFontSizeInPixels:function(el){var size=this.getMeasurement(el,"fontSize");
		if(size.unit=="px"){return size.value
		}var computeDirtyFontSize=function(el,calibration){var div=this.document.createElement("div");
		var divStyle=offscreenStyle;
		if(calibration){divStyle+=" font-size:"+calibration+"px;"
		}div.style.cssText=divStyle;
		div.innerHTML="A";
		el.appendChild(div);
		var value=div.offsetHeight;
		el.removeChild(div);
		return value
		};
		var rate=200/225;
		var value=computeDirtyFontSize(el);
		return value*rate
		},pointsToPixels:function(name,value,returnFloat){var axis=/Top$|Bottom$/.test(name)?"y":"x";
		var result=value*pixelsPerInch[axis]/72;
		return returnFloat?result:Math.round(result)
		},emToPixels:function(el,value){if(!el){return null
		}var fontSize=this.getFontSizeInPixels(el);
		return Math.round(value*fontSize)
		},exToPixels:function(el,value){if(!el){return null
		}var div=this.document.createElement("div");
		div.style.cssText=offscreenStyle+"width:"+value+"ex;";
		el.appendChild(div);
		var value=div.offsetWidth;
		el.removeChild(div);
		return value
		},percentToPixels:function(el,value){if(!el){return null
		}var div=this.document.createElement("div");
		div.style.cssText=offscreenStyle+"width:"+value+"%;";
		el.appendChild(div);
		var value=div.offsetWidth;
		el.removeChild(div);
		return value
		},getStyle:isIE?function(el,name){return el.currentStyle[name]||el.style[name]||undefined
		}:function(el,name){return this.document.defaultView.getComputedStyle(el,null)[name]||el.style[name]||undefined
		}}
		}});
		FBL.ns(function(){with(FBL){var WindowDefaultOptions={type:"frame",id:"FirebugUI"},commandLine,fbTop,fbContent,fbContentStyle,fbBottom,fbBtnInspect,fbToolbar,fbPanelBox1,fbPanelBox1Style,fbPanelBox2,fbPanelBox2Style,fbPanelBar2Box,fbPanelBar2BoxStyle,fbHSplitter,fbVSplitter,fbVSplitterStyle,fbPanel1,fbPanel1Style,fbPanel2,fbPanel2Style,fbConsole,fbConsoleStyle,fbHTML,fbCommandLine,fbLargeCommandLine,fbLargeCommandButtons,topHeight,topPartialHeight,chromeRedrawSkipRate=isIE?75:isOpera?80:75,lastSelectedPanelName,focusCommandLineState=0,lastFocusedPanelName,lastHSplitterMouseMove=0,onHSplitterMouseMoveBuffer=null,onHSplitterMouseMoveTimer=null,lastVSplitterMouseMove=0;
		FBL.defaultPersistedState={isOpen:false,height:300,sidePanelWidth:350,selectedPanelName:"Console",selectedHTMLElementId:null,htmlSelectionStack:[]};
		FBL.FirebugChrome={chromeMap:{},htmlSelectionStack:[],create:function(){if(FBTrace.DBG_INITIALIZE){FBTrace.sysout("FirebugChrome.create","creating chrome window")
		}createChromeWindow()
		},initialize:function(){if(FBTrace.DBG_INITIALIZE){FBTrace.sysout("FirebugChrome.initialize","initializing chrome window")
		}if(Env.chrome.type=="frame"||Env.chrome.type=="div"){ChromeMini.create(Env.chrome)
		}var chrome=Firebug.chrome=new Chrome(Env.chrome);
		FirebugChrome.chromeMap[chrome.type]=chrome;
		addGlobalEvent("keydown",onGlobalKeyDown);
		if(Env.Options.enablePersistent&&chrome.type=="popup"){var frame=FirebugChrome.chromeMap.frame;
		if(frame){frame.close()
		}chrome.initialize()
		}},clone:function(FBChrome){for(var name in FBChrome){var prop=FBChrome[name];
		if(FBChrome.hasOwnProperty(name)&&!isFunction(prop)){this[name]=prop
		}}}};
		var createChromeWindow=function(options){options=extend(WindowDefaultOptions,options||{});
		var browserWin=Env.browser.window;
		var browserContext=new Context(browserWin);
		var prefs=Store.get("FirebugLite");
		var persistedState=prefs&&prefs.persistedState||defaultPersistedState;
		var chrome={},context=options.context||Env.browser,type=chrome.type=Env.Options.enablePersistent?"popup":options.type,isChromeFrame=type=="frame",useLocalSkin=Env.useLocalSkin,url=useLocalSkin?Env.Location.skin:"about:blank",body=context.document.getElementsByTagName("body")[0],formatNode=function(node){if(!Env.isDebugMode){node.firebugIgnore=true
		}var browserWinSize=browserContext.getWindowSize();
		var height=persistedState.height||300;
		height=Math.min(browserWinSize.height,height);
		height=Math.max(200,height);
		node.style.border="0";
		node.style.visibility="hidden";
		node.style.zIndex="2147483647";
		node.style.position=noFixedPosition?"absolute":"fixed";
		node.style.width="100%";
		node.style.left="0";
		node.style.bottom=noFixedPosition?"-1px":"0";
		node.style.height=height+"px"
		},createChromeDiv=function(){var node=chrome.node=createGlobalElement("div"),style=createGlobalElement("style"),css=FirebugChrome.Skin.CSS,rules=".fbBody *{margin:0;padding:0;font-size:11px;line-height:13px;color:inherit;}"+css+".fbBody #fbHSplitter{position:absolute !important;} .fbBody #fbHTML span{line-height:14px;} .fbBody .lineNo div{line-height:inherit !important;}";
		style.type="text/css";
		if(style.styleSheet){style.styleSheet.cssText=rules
		}else{style.appendChild(context.document.createTextNode(rules))
		}document.getElementsByTagName("head")[0].appendChild(style);
		node.className="fbBody";
		node.style.overflow="hidden";
		node.innerHTML=getChromeDivTemplate();
		if(isIE){setTimeout(function(){node.firstChild.style.height="1px";
		node.firstChild.style.position="static"
		},0)
		}formatNode(node);
		body.appendChild(node);
		chrome.window=window;
		chrome.document=document;
		onChromeLoad(chrome)
		};
		try{if(type=="div"){createChromeDiv();
		return
		}else{if(isChromeFrame){var node=chrome.node=createGlobalElement("iframe");
		node.setAttribute("src",url);
		node.setAttribute("frameBorder","0");
		formatNode(node);
		body.appendChild(node);
		node.id=options.id
		}else{var height=persistedState.popupHeight||300;
		var browserWinSize=browserContext.getWindowSize();
		var browserWinLeft=typeof browserWin.screenX=="number"?browserWin.screenX:browserWin.screenLeft;
		var popupLeft=typeof persistedState.popupLeft=="number"?persistedState.popupLeft:browserWinLeft;
		var browserWinTop=typeof browserWin.screenY=="number"?browserWin.screenY:browserWin.screenTop;
		var popupTop=typeof persistedState.popupTop=="number"?persistedState.popupTop:Math.max(0,Math.min(browserWinTop+browserWinSize.height-height,screen.availHeight-height-61));
		var popupWidth=typeof persistedState.popupWidth=="number"?persistedState.popupWidth:Math.max(0,Math.min(browserWinSize.width,screen.availWidth-10));
		var popupHeight=typeof persistedState.popupHeight=="number"?persistedState.popupHeight:300;
		var options=["true,top=",popupTop,",left=",popupLeft,",height=",popupHeight,",width=",popupWidth,",resizable"].join(""),node=chrome.node=context.window.open(url,"popup",options);
		if(node){try{node.focus()
		}catch(E){alert("Firebug Error: Firebug popup was blocked.");
		return
		}}else{alert("Firebug Error: Firebug popup was blocked.");
		return
		}}}if(!useLocalSkin){var tpl=getChromeTemplate(!isChromeFrame),doc=isChromeFrame?node.contentWindow.document:node.document;
		doc.write(tpl);
		doc.close()
		}var win,waitDelay=useLocalSkin?isChromeFrame?200:300:100,waitForWindow=function(){if(isChromeFrame&&(win=node.contentWindow)&&node.contentWindow.document.getElementById("fbCommandLine")||!isChromeFrame&&(win=node.window)&&node.document&&node.document.getElementById("fbCommandLine")){chrome.window=win.window;
		chrome.document=win.document;
		setTimeout(function(){onChromeLoad(chrome)
		},useLocalSkin?200:0)
		}else{setTimeout(waitForWindow,waitDelay)
		}};
		waitForWindow()
		}catch(e){var msg=e.message||e;
		if(/access/i.test(msg)){if(isChromeFrame){body.removeChild(node)
		}else{if(type=="popup"){node.close()
		}}createChromeDiv()
		}else{alert("Firebug Error: Firebug GUI could not be created.")
		}}};
		var onChromeLoad=function onChromeLoad(chrome){Env.chrome=chrome;
		if(FBTrace.DBG_INITIALIZE){FBTrace.sysout("Chrome onChromeLoad","chrome window loaded")
		}if(Env.Options.enablePersistent){Env.FirebugChrome=FirebugChrome;
		chrome.window.Firebug=chrome.window.Firebug||{};
		chrome.window.Firebug.SharedEnv=Env;
		if(Env.isDevelopmentMode){Env.browser.window.FBDev.loadChromeApplication(chrome)
		}else{var doc=chrome.document;
		var script=doc.createElement("script");
		script.src=Env.Location.app+"#remote,persist";
		doc.getElementsByTagName("head")[0].appendChild(script)
		}}else{if(chrome.type=="frame"||chrome.type=="div"){setTimeout(function(){FBL.Firebug.initialize()
		},0)
		}else{if(chrome.type=="popup"){var oldChrome=FirebugChrome.chromeMap.frame;
		var newChrome=new Chrome(chrome);
		dispatch(newChrome.panelMap,"detach",[oldChrome,newChrome]);
		newChrome.reattach(oldChrome,newChrome)
		}}}};
		var getChromeDivTemplate=function(){return FirebugChrome.Skin.HTML
		};
		var getChromeTemplate=function(isPopup){var tpl=FirebugChrome.Skin;
		var r=[],i=-1;
		r[++i]='<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/DTD/strict.dtd">';
		r[++i]="<html><head><title>";
		r[++i]=Firebug.version;
		r[++i]="</title><style>html,body{margin:0;padding:0;overflow:hidden;}";
		r[++i]=tpl.CSS;
		r[++i]="</style>";
		r[++i]='</head><body class="fbBody'+(isPopup?" FirebugPopup":"")+'">';
		r[++i]=tpl.HTML;
		r[++i]="</body></html>";
		return r.join("")
		};
		var Chrome=function Chrome(chrome){var type=chrome.type;
		var Base=type=="frame"||type=="div"?ChromeFrameBase:ChromePopupBase;
		append(this,Base);
		append(this,chrome);
		append(this,new Context(chrome.window));
		FirebugChrome.chromeMap[type]=this;
		Firebug.chrome=this;
		Env.chrome=chrome.window;
		this.commandLineVisible=false;
		this.sidePanelVisible=false;
		this.create();
		return this
		};
		var ChromeBase={};
		append(ChromeBase,Controller);
		append(ChromeBase,PanelBar);
		append(ChromeBase,{node:null,type:null,document:null,window:null,sidePanelVisible:false,commandLineVisible:false,largeCommandLineVisible:false,inspectButton:null,create:function(){PanelBar.create.call(this);
		if(Firebug.Inspector){this.inspectButton=new Button({type:"toggle",element:$("fbChrome_btInspect"),owner:Firebug.Inspector,onPress:Firebug.Inspector.startInspecting,onUnpress:Firebug.Inspector.stopInspecting})
		}},destroy:function(){if(Firebug.Inspector){this.inspectButton.destroy()
		}PanelBar.destroy.call(this);
		this.shutdown()
		},testMenu:function(){var firebugMenu=new Menu({id:"fbFirebugMenu",items:[{label:"Open Firebug",type:"shortcut",key:isFirefox?"Shift+F12":"F12",checked:true,command:"toggleChrome"},{label:"Open Firebug in New Window",type:"shortcut",key:isFirefox?"Ctrl+Shift+F12":"Ctrl+F12",command:"openPopup"},{label:"Inspect Element",type:"shortcut",key:"Ctrl+Shift+C",command:"toggleInspect"},{label:"Command Line",type:"shortcut",key:"Ctrl+Shift+L",command:"focusCommandLine"},"-",{label:"Options",type:"group",child:"fbFirebugOptionsMenu"},"-",{label:"Firebug Lite Website...",command:"visitWebsite"},{label:"Discussion Group...",command:"visitDiscussionGroup"},{label:"Issue Tracker...",command:"visitIssueTracker"}],onHide:function(){iconButton.restore()
		},toggleChrome:function(){Firebug.chrome.toggle()
		},openPopup:function(){Firebug.chrome.toggle(true,true)
		},toggleInspect:function(){Firebug.Inspector.toggleInspect()
		},focusCommandLine:function(){Firebug.chrome.focusCommandLine()
		},visitWebsite:function(){this.visit("http://getfirebug.com/lite.html")
		},visitDiscussionGroup:function(){this.visit("http://groups.google.com/group/firebug")
		},visitIssueTracker:function(){this.visit("http://code.google.com/p/fbug/issues/list")
		},visit:function(url){window.open(url)
		}});
		var firebugOptionsMenu={id:"fbFirebugOptionsMenu",getItems:function(){var cookiesDisabled=!Firebug.saveCookies;
		return[{label:"Start Opened",type:"checkbox",value:"startOpened",checked:Firebug.startOpened,disabled:cookiesDisabled},{label:"Start in New Window",type:"checkbox",value:"startInNewWindow",checked:Firebug.startInNewWindow,disabled:cookiesDisabled},{label:"Show Icon When Hidden",type:"checkbox",value:"showIconWhenHidden",checked:Firebug.showIconWhenHidden,disabled:cookiesDisabled},{label:"Override Console Object",type:"checkbox",value:"overrideConsole",checked:Firebug.overrideConsole,disabled:cookiesDisabled},{label:"Ignore Firebug Elements",type:"checkbox",value:"ignoreFirebugElements",checked:Firebug.ignoreFirebugElements,disabled:cookiesDisabled},{label:"Disable When Firebug Active",type:"checkbox",value:"disableWhenFirebugActive",checked:Firebug.disableWhenFirebugActive,disabled:cookiesDisabled},{label:"Disable XHR Listener",type:"checkbox",value:"disableXHRListener",checked:Firebug.disableXHRListener,disabled:cookiesDisabled},{label:"Disable Resource Fetching",type:"checkbox",value:"disableResourceFetching",checked:Firebug.disableResourceFetching,disabled:cookiesDisabled},{label:"Enable Trace Mode",type:"checkbox",value:"enableTrace",checked:Firebug.enableTrace,disabled:cookiesDisabled},{label:"Enable Persistent Mode (experimental)",type:"checkbox",value:"enablePersistent",checked:Firebug.enablePersistent,disabled:cookiesDisabled},"-",{label:"Reset All Firebug Options",command:"restorePrefs",disabled:cookiesDisabled}]
		},onCheck:function(target,value,checked){Firebug.setPref(value,checked)
		},restorePrefs:function(target){Firebug.erasePrefs();
		if(target){this.updateMenu(target)
		}},updateMenu:function(target){var options=getElementsByClass(target.parentNode,"fbMenuOption");
		var firstOption=options[0];
		var enabled=Firebug.saveCookies;
		if(enabled){Menu.check(firstOption)
		}else{Menu.uncheck(firstOption)
		}if(enabled){Menu.check(options[0])
		}else{Menu.uncheck(options[0])
		}for(var i=1,length=options.length;
		i<length;
		i++){var option=options[i];
		var value=option.getAttribute("value");
		var pref=Firebug[value];
		if(pref){Menu.check(option)
		}else{Menu.uncheck(option)
		}if(enabled){Menu.enable(option)
		}else{Menu.disable(option)
		}}}};
		Menu.register(firebugOptionsMenu);
		var menu=firebugMenu;
		var testMenuClick=function(event){cancelEvent(event,true);
		var target=event.target||event.srcElement;
		if(menu.isVisible){menu.hide()
		}else{var offsetLeft=isIE6?1:-4,chrome=Firebug.chrome,box=chrome.getElementBox(target),offset=chrome.type=="div"?chrome.getElementPosition(chrome.node):{top:0,left:0};
		menu.show(box.left+offsetLeft-offset.left,box.top+box.height-5-offset.top)
		}return false
		};
		var iconButton=new IconButton({type:"toggle",element:$("fbFirebugButton"),onClick:testMenuClick});
		iconButton.initialize()
		},initialize:function(){if(Env.bookmarkletOutdated){Firebug.Console.logFormatted(["A new bookmarklet version is available. Please visit http://getfirebug.com/firebuglite#Install and update it."],Firebug.context,"warn")
		}if(Firebug.Console){Firebug.Console.flush()
		}if(Firebug.Trace){FBTrace.flush(Firebug.Trace)
		}if(FBTrace.DBG_INITIALIZE){FBTrace.sysout("Firebug.chrome.initialize","initializing chrome application")
		}Controller.initialize.call(this);
		PanelBar.initialize.call(this);
		fbTop=$("fbTop");
		fbContent=$("fbContent");
		fbContentStyle=fbContent.style;
		fbBottom=$("fbBottom");
		fbBtnInspect=$("fbBtnInspect");
		fbToolbar=$("fbToolbar");
		fbPanelBox1=$("fbPanelBox1");
		fbPanelBox1Style=fbPanelBox1.style;
		fbPanelBox2=$("fbPanelBox2");
		fbPanelBox2Style=fbPanelBox2.style;
		fbPanelBar2Box=$("fbPanelBar2Box");
		fbPanelBar2BoxStyle=fbPanelBar2Box.style;
		fbHSplitter=$("fbHSplitter");
		fbVSplitter=$("fbVSplitter");
		fbVSplitterStyle=fbVSplitter.style;
		fbPanel1=$("fbPanel1");
		fbPanel1Style=fbPanel1.style;
		fbPanel2=$("fbPanel2");
		fbPanel2Style=fbPanel2.style;
		fbConsole=$("fbConsole");
		fbConsoleStyle=fbConsole.style;
		fbHTML=$("fbHTML");
		fbCommandLine=$("fbCommandLine");
		fbLargeCommandLine=$("fbLargeCommandLine");
		fbLargeCommandButtons=$("fbLargeCommandButtons");
		topHeight=fbTop.offsetHeight;
		topPartialHeight=fbToolbar.offsetHeight;
		disableTextSelection($("fbToolbar"));
		disableTextSelection($("fbPanelBarBox"));
		disableTextSelection($("fbPanelBar1"));
		disableTextSelection($("fbPanelBar2"));
		if(isIE6&&Firebug.Selector){var as=$$(".fbHover");
		for(var i=0,a;
		a=as[i];
		i++){a.setAttribute("href","javascript:void(0)")
		}}if(Firebug.Inspector){this.inspectButton.initialize()
		}this.addController([$("fbLargeCommandLineIcon"),"click",this.showLargeCommandLine]);
		var self=this;
		setTimeout(function(){self.selectPanel(Firebug.context.persistedState.selectedPanelName);
		if(Firebug.context.persistedState.selectedPanelName=="Console"&&Firebug.CommandLine){Firebug.chrome.focusCommandLine()
		}},0);
		var onPanelMouseDown=function onPanelMouseDown(event){var target=event.target||event.srcElement;
		if(FBL.isLeftClick(event)){var editable=FBL.getAncestorByClass(target,"editable");
		if(editable){Firebug.Editor.startEditing(editable);
		FBL.cancelEvent(event)
		}else{if(!hasClass(target,"textEditorInner")){Firebug.Editor.stopEditing()
		}}}else{if(FBL.isMiddleClick(event)&&Firebug.getRepNode(target)){FBL.cancelEvent(event)
		}}};
		Firebug.getElementPanel=function(element){var panelNode=getAncestorByClass(element,"fbPanel");
		var id=panelNode.id.substr(2);
		var panel=Firebug.chrome.panelMap[id];
		if(!panel){if(Firebug.chrome.selectedPanel.sidePanelBar){panel=Firebug.chrome.selectedPanel.sidePanelBar.panelMap[id]
		}}return panel
		};
		var onKeyCodeListenersMap=[];
		var onKeyCodeListen=function(event){for(var keyCode in onKeyCodeListenersMap){var listeners=onKeyCodeListenersMap[keyCode];
		for(var i=0,listener;
		listener=listeners[i];
		i++){var filter=listener.filter||FBL.noKeyModifiers;
		if(event.keyCode==keyCode&&(!filter||filter(event))){listener.listener();
		FBL.cancelEvent(event,true);
		return false
		}}}};
		addEvent(Firebug.chrome.document,"keydown",onKeyCodeListen);
		Firebug.chrome.keyCodeListen=function(key,filter,listener,capture){var keyCode=KeyEvent["DOM_VK_"+key];
		if(!onKeyCodeListenersMap[keyCode]){onKeyCodeListenersMap[keyCode]=[]
		}onKeyCodeListenersMap[keyCode].push({filter:filter,listener:listener});
		return keyCode
		};
		Firebug.chrome.keyIgnore=function(keyCode){onKeyCodeListenersMap[keyCode]=null;
		delete onKeyCodeListenersMap[keyCode]
		};
		this.addController([fbPanel1,"mousedown",onPanelMouseDown],[fbPanel2,"mousedown",onPanelMouseDown]);
		if(FBL.domplate){this.testMenu()
		}},shutdown:function(){if(Firebug.Inspector){this.inspectButton.shutdown()
		}restoreTextSelection($("fbToolbar"));
		restoreTextSelection($("fbPanelBarBox"));
		restoreTextSelection($("fbPanelBar1"));
		restoreTextSelection($("fbPanelBar2"));
		Controller.shutdown.call(this);
		PanelBar.shutdown.call(this);
		fbTop=null;
		fbContent=null;
		fbContentStyle=null;
		fbBottom=null;
		fbBtnInspect=null;
		fbToolbar=null;
		fbPanelBox1=null;
		fbPanelBox1Style=null;
		fbPanelBox2=null;
		fbPanelBox2Style=null;
		fbPanelBar2Box=null;
		fbPanelBar2BoxStyle=null;
		fbHSplitter=null;
		fbVSplitter=null;
		fbVSplitterStyle=null;
		fbPanel1=null;
		fbPanel1Style=null;
		fbPanel2=null;
		fbConsole=null;
		fbConsoleStyle=null;
		fbHTML=null;
		fbCommandLine=null;
		fbLargeCommandLine=null;
		fbLargeCommandButtons=null;
		topHeight=null;
		topPartialHeight=null
		},toggle:function(forceOpen,popup){if(popup){this.detach()
		}else{if(isOpera&&Firebug.chrome.type=="popup"&&Firebug.chrome.node.closed){var frame=FirebugChrome.chromeMap.frame;
		frame.reattach();
		FirebugChrome.chromeMap.popup=null;
		frame.open();
		return
		}if(Firebug.chrome.type=="popup"){return
		}var shouldOpen=forceOpen||!Firebug.context.persistedState.isOpen;
		if(shouldOpen){this.open()
		}else{this.close()
		}}},detach:function(){if(!FirebugChrome.chromeMap.popup){this.close();
		createChromeWindow({type:"popup"})
		}},reattach:function(oldChrome,newChrome){Firebug.browser.window.Firebug=Firebug;
		var newPanelMap=newChrome.panelMap;
		var oldPanelMap=oldChrome.panelMap;
		var panel;
		for(var name in newPanelMap){panel=newPanelMap[name];
		if(panel.options.innerHTMLSync){panel.panelNode.innerHTML=oldPanelMap[name].panelNode.innerHTML
		}}Firebug.chrome=newChrome;
		if(newChrome.type=="popup"){newChrome.initialize()
		}else{Firebug.context.persistedState.selectedPanelName=oldChrome.selectedPanel.name
		}dispatch(newPanelMap,"reattach",[oldChrome,newChrome])
		},draw:function(){var size=this.getSize();
		var commandLineHeight=Firebug.chrome.commandLineVisible?fbCommandLine.offsetHeight:0,y=Math.max(size.height,topHeight),heightValue=Math.max(y-topHeight-commandLineHeight,0),height=heightValue+"px",sideWidthValue=Firebug.chrome.sidePanelVisible?Firebug.context.persistedState.sidePanelWidth:0,width=Math.max(size.width-sideWidthValue,0)+"px";
		fbPanelBox1Style.height=height;
		fbPanel1Style.height=height;
		if(isIE||isOpera){fbVSplitterStyle.height=Math.max(y-topPartialHeight-commandLineHeight,0)+"px"
		}fbPanelBox1Style.width=width;
		fbPanel1Style.width=width;
		if(Firebug.chrome.sidePanelVisible){sideWidthValue=Math.max(sideWidthValue-6,0);
		var sideWidth=sideWidthValue+"px";
		fbPanelBox2Style.width=sideWidth;
		fbVSplitterStyle.right=sideWidth;
		if(Firebug.chrome.largeCommandLineVisible){fbLargeCommandLine=$("fbLargeCommandLine");
		fbLargeCommandLine.style.height=heightValue-4+"px";
		fbLargeCommandLine.style.width=sideWidthValue-2+"px";
		fbLargeCommandButtons=$("fbLargeCommandButtons");
		fbLargeCommandButtons.style.width=sideWidth
		}else{fbPanel2Style.height=height;
		fbPanel2Style.width=sideWidth;
		fbPanelBar2BoxStyle.width=sideWidth
		}}},getSize:function(){return this.type=="div"?{height:this.node.offsetHeight,width:this.node.offsetWidth}:this.getWindowSize()
		},resize:function(){var self=this;
		setTimeout(function(){self.draw();
		if(noFixedPosition&&(self.type=="frame"||self.type=="div")){self.fixIEPosition()
		}},0)
		},layout:function(panel){if(FBTrace.DBG_CHROME){FBTrace.sysout("Chrome.layout","")
		}var options=panel.options;
		changeCommandLineVisibility(options.hasCommandLine);
		changeSidePanelVisibility(panel.hasSidePanel);
		Firebug.chrome.draw()
		},showLargeCommandLine:function(hideToggleIcon){var chrome=Firebug.chrome;
		if(!chrome.largeCommandLineVisible){chrome.largeCommandLineVisible=true;
		if(chrome.selectedPanel.options.hasCommandLine){if(Firebug.CommandLine){Firebug.CommandLine.blur()
		}changeCommandLineVisibility(false)
		}changeSidePanelVisibility(true);
		fbLargeCommandLine.style.display="block";
		fbLargeCommandButtons.style.display="block";
		fbPanel2Style.display="none";
		fbPanelBar2BoxStyle.display="none";
		chrome.draw();
		fbLargeCommandLine.focus();
		if(Firebug.CommandLine){Firebug.CommandLine.setMultiLine(true)
		}}},hideLargeCommandLine:function(){if(Firebug.chrome.largeCommandLineVisible){Firebug.chrome.largeCommandLineVisible=false;
		if(Firebug.CommandLine){Firebug.CommandLine.setMultiLine(false)
		}fbLargeCommandLine.blur();
		fbPanel2Style.display="block";
		fbPanelBar2BoxStyle.display="block";
		fbLargeCommandLine.style.display="none";
		fbLargeCommandButtons.style.display="none";
		changeSidePanelVisibility(false);
		if(Firebug.chrome.selectedPanel.options.hasCommandLine){changeCommandLineVisibility(true)
		}Firebug.chrome.draw()
		}},focusCommandLine:function(){var selectedPanelName=this.selectedPanel.name,panelToSelect;
		if(focusCommandLineState==0||selectedPanelName!="Console"){focusCommandLineState=0;
		lastFocusedPanelName=selectedPanelName;
		panelToSelect="Console"
		}if(focusCommandLineState==1){panelToSelect=lastFocusedPanelName
		}this.selectPanel(panelToSelect);
		try{if(Firebug.CommandLine){if(panelToSelect=="Console"){Firebug.CommandLine.focus()
		}else{Firebug.CommandLine.blur()
		}}}catch(e){}focusCommandLineState=++focusCommandLineState%2
		}});
		var ChromeFrameBase=extend(ChromeBase,{create:function(){ChromeBase.create.call(this);
		if(isFirefox){this.node.style.display="block"
		}if(Env.Options.startInNewWindow){this.close();
		this.toggle(true,true);
		return
		}if(Env.Options.startOpened){this.open()
		}else{this.close()
		}},destroy:function(){var size=Firebug.chrome.getWindowSize();
		Firebug.context.persistedState.height=size.height;
		if(Firebug.saveCookies){Firebug.savePrefs()
		}removeGlobalEvent("keydown",onGlobalKeyDown);
		ChromeBase.destroy.call(this);
		this.document=null;
		delete this.document;
		this.window=null;
		delete this.window;
		this.node.parentNode.removeChild(this.node);
		this.node=null;
		delete this.node
		},initialize:function(){ChromeBase.initialize.call(this);
		this.addController([Firebug.browser.window,"resize",this.resize],[$("fbWindow_btClose"),"click",this.close],[$("fbWindow_btDetach"),"click",this.detach],[$("fbWindow_btDeactivate"),"click",this.deactivate]);
		if(!Env.Options.enablePersistent){this.addController([Firebug.browser.window,"unload",Firebug.shutdown])
		}if(noFixedPosition){this.addController([Firebug.browser.window,"scroll",this.fixIEPosition])
		}fbVSplitter.onmousedown=onVSplitterMouseDown;
		fbHSplitter.onmousedown=onHSplitterMouseDown;
		this.isInitialized=true
		},shutdown:function(){fbVSplitter.onmousedown=null;
		fbHSplitter.onmousedown=null;
		ChromeBase.shutdown.apply(this);
		this.isInitialized=false
		},reattach:function(){var frame=FirebugChrome.chromeMap.frame;
		ChromeBase.reattach(FirebugChrome.chromeMap.popup,this)
		},open:function(){if(!Firebug.context.persistedState.isOpen){Firebug.context.persistedState.isOpen=true;
		if(Env.isChromeExtension){localStorage.setItem("Firebug","1,1")
		}var node=this.node;
		node.style.visibility="hidden";
		if(Firebug.showIconWhenHidden){if(ChromeMini.isInitialized){ChromeMini.shutdown()
		}}else{node.style.display="block"
		}var main=$("fbChrome");
		main.style.display="";
		var self=this;
		node.style.visibility="visible";
		setTimeout(function(){self.initialize();
		if(noFixedPosition){self.fixIEPosition()
		}self.draw()
		},10)
		}},close:function(){if(Firebug.context.persistedState.isOpen){if(this.isInitialized){this.shutdown()
		}Firebug.context.persistedState.isOpen=false;
		if(Env.isChromeExtension){localStorage.setItem("Firebug","1,0")
		}var node=this.node;
		if(Firebug.showIconWhenHidden){node.style.visibility="hidden";
		var main=$("fbChrome",FirebugChrome.chromeMap.frame.document);
		main.style.display="none";
		ChromeMini.initialize();
		node.style.visibility="visible"
		}else{node.style.display="none"
		}}},deactivate:function(){if(Env.isChromeExtension){localStorage.removeItem("Firebug");
		Firebug.GoogleChrome.dispatch("FB_deactivate");
		Firebug.chrome.close()
		}else{Firebug.shutdown()
		}},fixIEPosition:function(){var doc=this.document;
		var offset=isIE?doc.body.clientTop||doc.documentElement.clientTop:0;
		var size=Firebug.browser.getWindowSize();
		var scroll=Firebug.browser.getWindowScrollPosition();
		var maxHeight=size.height;
		var height=this.node.offsetHeight;
		var bodyStyle=doc.body.currentStyle;
		this.node.style.top=maxHeight-height+scroll.top+"px";
		if((this.type=="frame"||this.type=="div")&&(bodyStyle.marginLeft||bodyStyle.marginRight)){this.node.style.width=size.width+"px"
		}if(fbVSplitterStyle){fbVSplitterStyle.right=Firebug.context.persistedState.sidePanelWidth+"px"
		}this.draw()
		}});
		var ChromeMini=extend(Controller,{create:function(chrome){append(this,chrome);
		this.type="mini"
		},initialize:function(){Controller.initialize.apply(this);
		var doc=FirebugChrome.chromeMap.frame.document;
		var mini=$("fbMiniChrome",doc);
		mini.style.display="block";
		var miniIcon=$("fbMiniIcon",doc);
		var width=miniIcon.offsetWidth+10;
		miniIcon.title="Open "+Firebug.version;
		var errors=$("fbMiniErrors",doc);
		if(errors.offsetWidth){width+=errors.offsetWidth+10
		}var node=this.node;
		node.style.height="27px";
		node.style.width=width+"px";
		node.style.left="";
		node.style.right=0;
		if(this.node.nodeName.toLowerCase()=="iframe"){node.setAttribute("allowTransparency","true");
		this.document.body.style.backgroundColor="transparent"
		}else{node.style.background="transparent"
		}if(noFixedPosition){this.fixIEPosition()
		}this.addController([$("fbMiniIcon",doc),"click",onMiniIconClick]);
		if(noFixedPosition){this.addController([Firebug.browser.window,"scroll",this.fixIEPosition])
		}this.isInitialized=true
		},shutdown:function(){var node=this.node;
		node.style.height=Firebug.context.persistedState.height+"px";
		node.style.width="100%";
		node.style.left=0;
		node.style.right="";
		if(this.node.nodeName.toLowerCase()=="iframe"){node.setAttribute("allowTransparency","false");
		this.document.body.style.backgroundColor="#fff"
		}else{node.style.background="#fff"
		}if(noFixedPosition){this.fixIEPosition()
		}var doc=FirebugChrome.chromeMap.frame.document;
		var mini=$("fbMiniChrome",doc);
		mini.style.display="none";
		Controller.shutdown.apply(this);
		this.isInitialized=false
		},draw:function(){},fixIEPosition:ChromeFrameBase.fixIEPosition});
		var ChromePopupBase=extend(ChromeBase,{initialize:function(){setClass(this.document.body,"FirebugPopup");
		ChromeBase.initialize.call(this);
		this.addController([Firebug.chrome.window,"resize",this.resize],[Firebug.chrome.window,"unload",this.destroy]);
		if(Env.Options.enablePersistent){this.persist=bind(this.persist,this);
		addEvent(Firebug.browser.window,"unload",this.persist)
		}else{this.addController([Firebug.browser.window,"unload",this.close])
		}fbVSplitter.onmousedown=onVSplitterMouseDown
		},destroy:function(){var chromeWin=Firebug.chrome.window;
		var left=chromeWin.screenX||chromeWin.screenLeft;
		var top=chromeWin.screenY||chromeWin.screenTop;
		var size=Firebug.chrome.getWindowSize();
		Firebug.context.persistedState.popupTop=top;
		Firebug.context.persistedState.popupLeft=left;
		Firebug.context.persistedState.popupWidth=size.width;
		Firebug.context.persistedState.popupHeight=size.height;
		if(Firebug.saveCookies){Firebug.savePrefs()
		}var frame=FirebugChrome.chromeMap.frame;
		if(frame){dispatch(frame.panelMap,"detach",[this,frame]);
		frame.reattach(this,frame)
		}if(Env.Options.enablePersistent){removeEvent(Firebug.browser.window,"unload",this.persist)
		}ChromeBase.destroy.apply(this);
		FirebugChrome.chromeMap.popup=null;
		this.node.close()
		},persist:function(){persistTimeStart=new Date().getTime();
		removeEvent(Firebug.browser.window,"unload",this.persist);
		Firebug.Inspector.destroy();
		Firebug.browser.window.FirebugOldBrowser=true;
		var persistTimeStart=new Date().getTime();
		var waitMainWindow=function(){var doc,head;
		try{if(window.opener&&!window.opener.FirebugOldBrowser&&(doc=window.opener.document)){try{if(Env.isDebugMode){window.FBL=FBL
		}window.Firebug=Firebug;
		window.opener.Firebug=Firebug;
		Env.browser=window.opener;
		Firebug.browser=Firebug.context=new Context(Env.browser);
		Firebug.loadPrefs();
		registerConsole();
		var persistDelay=new Date().getTime()-persistTimeStart;
		var chrome=Firebug.chrome;
		addEvent(Firebug.browser.window,"unload",chrome.persist);
		FBL.cacheDocument();
		Firebug.Inspector.create();
		Firebug.Console.logFormatted(["Firebug could not capture console calls during "+persistDelay+"ms"],Firebug.context,"info");
		setTimeout(function(){var htmlPanel=chrome.getPanel("HTML");
		htmlPanel.createUI()
		},50)
		}catch(pE){alert("persist error: "+(pE.message||pE))
		}}else{window.setTimeout(waitMainWindow,0)
		}}catch(E){window.close()
		}};
		waitMainWindow()
		},close:function(){this.destroy()
		}});
		var changeCommandLineVisibility=function changeCommandLineVisibility(visibility){var last=Firebug.chrome.commandLineVisible;
		var visible=Firebug.chrome.commandLineVisible=typeof visibility=="boolean"?visibility:!Firebug.chrome.commandLineVisible;
		if(visible!=last){if(visible){fbBottom.className="";
		if(Firebug.CommandLine){Firebug.CommandLine.activate()
		}}else{if(Firebug.CommandLine){Firebug.CommandLine.deactivate()
		}fbBottom.className="hide"
		}}};
		var changeSidePanelVisibility=function changeSidePanelVisibility(visibility){var last=Firebug.chrome.sidePanelVisible;
		Firebug.chrome.sidePanelVisible=typeof visibility=="boolean"?visibility:!Firebug.chrome.sidePanelVisible;
		if(Firebug.chrome.sidePanelVisible!=last){fbPanelBox2.className=Firebug.chrome.sidePanelVisible?"":"hide";
		fbPanelBar2Box.className=Firebug.chrome.sidePanelVisible?"":"hide"
		}};
		var onGlobalKeyDown=function onGlobalKeyDown(event){var keyCode=event.keyCode;
		var shiftKey=event.shiftKey;
		var ctrlKey=event.ctrlKey;
		if(keyCode==123&&(!isFirefox&&!shiftKey||shiftKey&&isFirefox)){Firebug.chrome.toggle(false,ctrlKey);
		cancelEvent(event,true);
		if(Env.isChromeExtension){Firebug.GoogleChrome.dispatch("FB_enableIcon")
		}}else{if(keyCode==67&&ctrlKey&&shiftKey){Firebug.Inspector.toggleInspect();
		cancelEvent(event,true)
		}else{if(keyCode==76&&ctrlKey&&shiftKey){Firebug.chrome.focusCommandLine();
		cancelEvent(event,true)
		}}}};
		var onMiniIconClick=function onMiniIconClick(event){Firebug.chrome.toggle(false,event.ctrlKey);
		cancelEvent(event,true)
		};
		var onHSplitterMouseDown=function onHSplitterMouseDown(event){addGlobalEvent("mousemove",onHSplitterMouseMove);
		addGlobalEvent("mouseup",onHSplitterMouseUp);
		if(isIE){addEvent(Firebug.browser.document.documentElement,"mouseleave",onHSplitterMouseUp)
		}fbHSplitter.className="fbOnMovingHSplitter";
		return false
		};
		var onHSplitterMouseMove=function onHSplitterMouseMove(event){cancelEvent(event,true);
		var clientY=event.clientY;
		var win=isIE?event.srcElement.ownerDocument.parentWindow:event.target.defaultView||event.target.ownerDocument&&event.target.ownerDocument.defaultView;
		if(!win){return
		}if(win!=win.parent){var frameElement=win.frameElement;
		if(frameElement){var framePos=Firebug.browser.getElementPosition(frameElement).top;
		clientY+=framePos;
		if(frameElement.style.position!="fixed"){clientY-=Firebug.browser.getWindowScrollPosition().top
		}}}if(isOpera&&isQuiksMode&&win.frameElement.id=="FirebugUI"){clientY=Firebug.browser.getWindowSize().height-win.frameElement.offsetHeight+clientY
		}onHSplitterMouseMoveBuffer=clientY;
		if(new Date().getTime()-lastHSplitterMouseMove>chromeRedrawSkipRate){lastHSplitterMouseMove=new Date().getTime();
		handleHSplitterMouseMove()
		}else{if(!onHSplitterMouseMoveTimer){onHSplitterMouseMoveTimer=setTimeout(handleHSplitterMouseMove,chromeRedrawSkipRate)
		}}cancelEvent(event,true);
		return false
		};
		var handleHSplitterMouseMove=function(){if(onHSplitterMouseMoveTimer){clearTimeout(onHSplitterMouseMoveTimer);
		onHSplitterMouseMoveTimer=null
		}var clientY=onHSplitterMouseMoveBuffer;
		var windowSize=Firebug.browser.getWindowSize();
		var scrollSize=Firebug.browser.getWindowScrollSize();
		var commandLineHeight=Firebug.chrome.commandLineVisible?fbCommandLine.offsetHeight:0;
		var fixedHeight=topHeight+commandLineHeight;
		var chromeNode=Firebug.chrome.node;
		var scrollbarSize=!isIE&&(scrollSize.width>windowSize.width)?17:0;
		var height=windowSize.height;
		var chromeHeight=Math.max(height-clientY+5-scrollbarSize,fixedHeight);
		chromeHeight=Math.min(chromeHeight,windowSize.height-scrollbarSize);
		Firebug.context.persistedState.height=chromeHeight;
		chromeNode.style.height=chromeHeight+"px";
		if(noFixedPosition){Firebug.chrome.fixIEPosition()
		}Firebug.chrome.draw()
		};
		var onHSplitterMouseUp=function onHSplitterMouseUp(event){removeGlobalEvent("mousemove",onHSplitterMouseMove);
		removeGlobalEvent("mouseup",onHSplitterMouseUp);
		if(isIE){removeEvent(Firebug.browser.document.documentElement,"mouseleave",onHSplitterMouseUp)
		}fbHSplitter.className="";
		Firebug.chrome.draw();
		return false
		};
		var onVSplitterMouseDown=function onVSplitterMouseDown(event){addGlobalEvent("mousemove",onVSplitterMouseMove);
		addGlobalEvent("mouseup",onVSplitterMouseUp);
		return false
		};
		var onVSplitterMouseMove=function onVSplitterMouseMove(event){if(new Date().getTime()-lastVSplitterMouseMove>chromeRedrawSkipRate){var target=event.target||event.srcElement;
		if(target&&target.ownerDocument){var clientX=event.clientX;
		var win=document.all?event.srcElement.ownerDocument.parentWindow:event.target.ownerDocument.defaultView;
		if(win!=win.parent){clientX+=win.frameElement?win.frameElement.offsetLeft:0
		}var size=Firebug.chrome.getSize();
		var x=Math.max(size.width-clientX+3,6);
		Firebug.context.persistedState.sidePanelWidth=x;
		Firebug.chrome.draw()
		}lastVSplitterMouseMove=new Date().getTime()
		}cancelEvent(event,true);
		return false
		};
		var onVSplitterMouseUp=function onVSplitterMouseUp(event){removeGlobalEvent("mousemove",onVSplitterMouseMove);
		removeGlobalEvent("mouseup",onVSplitterMouseUp);
		Firebug.chrome.draw()
		}
		}});
		FBL.ns(function(){with(FBL){Firebug.Lite={}
		}});
		FBL.ns(function(){with(FBL){Firebug.Lite.Cache={ID:"firebug-"+new Date().getTime()};
		var cacheUID=0;
		var createCache=function(){var map={};
		var data={};
		var CID=Firebug.Lite.Cache.ID;
		var supportsDeleteExpando=!document.all;
		var cacheFunction=function(element){return cacheAPI.set(element)
		};
		var cacheAPI={get:function(key){return map.hasOwnProperty(key)?map[key]:null
		},set:function(element){var id=getValidatedKey(element);
		if(!id){id=++cacheUID;
		element[CID]=id
		}if(!map.hasOwnProperty(id)){map[id]=element;
		data[id]={}
		}return id
		},unset:function(element){var id=getValidatedKey(element);
		if(!id){return
		}if(supportsDeleteExpando){delete element[CID]
		}else{if(element.removeAttribute){element.removeAttribute(CID)
		}}delete map[id];
		delete data[id]
		},key:function(element){return getValidatedKey(element)
		},has:function(element){var id=getValidatedKey(element);
		return id&&map.hasOwnProperty(id)
		},each:function(callback){for(var key in map){if(map.hasOwnProperty(key)){callback(key,map[key])
		}}},data:function(element,name,value){if(value){if(!name){return null
		}var id=cacheAPI.set(element);
		return data[id][name]=value
		}else{var id=cacheAPI.key(element);
		return data.hasOwnProperty(id)&&data[id].hasOwnProperty(name)?data[id][name]:null
		}},clear:function(){for(var id in map){var element=map[id];
		cacheAPI.unset(element)
		}}};
		var getValidatedKey=function(element){var id=element[CID];
		if(!supportsDeleteExpando&&id&&map.hasOwnProperty(id)&&map[id]!=element){element.removeAttribute(CID);
		id=null
		}return id
		};
		FBL.append(cacheFunction,cacheAPI);
		return cacheFunction
		};
		Firebug.Lite.Cache.StyleSheet=createCache();
		Firebug.Lite.Cache.Element=createCache();
		Firebug.Lite.Cache.Event=createCache()
		}});
		FBL.ns(function(){with(FBL){var sourceMap={};
		Firebug.Lite.Proxy={_callbacks:{},load:function(url){var resourceDomain=getDomain(url);
		var isLocalResource=!resourceDomain||resourceDomain==Firebug.context.window.location.host;
		return isLocalResource?fetchResource(url):fetchProxyResource(url)
		},loadJSONP:function(url,callback){var script=createGlobalElement("script"),doc=Firebug.context.document,uid=""+new Date().getTime(),callbackName="callback=Firebug.Lite.Proxy._callbacks."+uid,jsonpURL=url.indexOf("?")!=-1?url+"&"+callbackName:url+"?"+callbackName;
		Firebug.Lite.Proxy._callbacks[uid]=function(data){if(callback){callback(data)
		}script.parentNode.removeChild(script);
		delete Firebug.Lite.Proxy._callbacks[uid]
		};
		script.src=jsonpURL;
		if(doc.documentElement){doc.documentElement.appendChild(script)
		}},YQL:function(url,callback){var yql="http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where%20url%3D%22"+encodeURIComponent(url)+"%22&format=xml";
		this.loadJSONP(yql,function(data){var source=data.results[0];
		var match=/<body>\s+<p>([\s\S]+)<\/p>\s+<\/body>$/.exec(source);
		if(match){source=match[1]
		}console.log(source)
		})
		}};
		Firebug.Lite.Proxy.fetchResourceDisabledMessage='/* Firebug Lite resource fetching is disabled.\nTo enabled it set the Firebug Lite option "disableResourceFetching" to "false".\nMore info at http://getfirebug.com/firebuglite#Options */';
		var fetchResource=function(url){if(Firebug.disableResourceFetching){var source=sourceMap[url]=Firebug.Lite.Proxy.fetchResourceDisabledMessage;
		return source
		}if(sourceMap.hasOwnProperty(url)){return sourceMap[url]
		}var xhr=FBL.getNativeXHRObject();
		xhr.open("get",url,false);
		xhr.send();
		var source=sourceMap[url]=xhr.responseText;
		return source
		};
		var fetchProxyResource=function(url){if(sourceMap.hasOwnProperty(url)){return sourceMap[url]
		}var proxyURL=Env.Location.baseDir+"plugin/proxy/proxy.php?url="+encodeURIComponent(url);
		var response=fetchResource(proxyURL);
		try{var data=eval("("+response+")")
		}catch(E){return"ERROR: Firebug Lite Proxy plugin returned an invalid response."
		}var source=data?data.contents:"";
		return source
		}
		}});
		FBL.ns(function(){with(FBL){Firebug.Lite.Style={}
		}});
		FBL.ns(function(){with(FBL){Firebug.Lite.Script=function(window){this.fileName=null;
		this.isValid=null;
		this.baseLineNumber=null;
		this.lineExtent=null;
		this.tag=null;
		this.functionName=null;
		this.functionSource=null
		};
		Firebug.Lite.Script.prototype={isLineExecutable:function(){},pcToLine:function(){},lineToPc:function(){},toString:function(){return"Firebug.Lite.Script"
		}}
		}});
		FBL.ns(function(){with(FBL){Firebug.Lite.Browser=function(window){this.contentWindow=window;
		this.contentDocument=window.document;
		this.currentURI={spec:window.location.href}
		};
		Firebug.Lite.Browser.prototype={toString:function(){return"Firebug.Lite.Browser"
		}}
		}});
		var JSON=window.JSON||{};
		(function(){function f(n){return n<10?"0"+n:n
		}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null
		};
		String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf()
		}
		}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;
		function quote(string){escapable.lastIndex=0;
		return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];
		return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)
		})+'"':'"'+string+'"'
		}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];
		if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)
		}if(typeof rep==="function"){value=rep.call(holder,key,value)
		}switch(typeof value){case"string":return quote(value);
		case"number":return isFinite(value)?String(value):"null";
		case"boolean":case"null":return String(value);
		case"object":if(!value){return"null"
		}gap+=indent;
		partial=[];
		if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;
		for(i=0;
		i<length;
		i+=1){partial[i]=str(i,value)||"null"
		}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";
		gap=mind;
		return v
		}if(rep&&typeof rep==="object"){length=rep.length;
		for(i=0;
		i<length;
		i+=1){k=rep[i];
		if(typeof k==="string"){v=str(k,value);
		if(v){partial.push(quote(k)+(gap?": ":":")+v)
		}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);
		if(v){partial.push(quote(k)+(gap?": ":":")+v)
		}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";
		gap=mind;
		return v
		}}if(typeof JSON.stringify!=="function"){JSON.stringify=function(value,replacer,space){var i;
		gap="";
		indent="";
		if(typeof space==="number"){for(i=0;
		i<space;
		i+=1){indent+=" "
		}}else{if(typeof space==="string"){indent=space
		}}rep=replacer;
		if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")
		}return str("",{"":value})
		}
		}if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){var j;
		function walk(holder,key){var k,v,value=holder[key];
		if(value&&typeof value==="object"){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);
		if(v!==undefined){value[k]=v
		}else{delete value[k]
		}}}}return reviver.call(holder,key,value)
		}text=String(text);
		cx.lastIndex=0;
		if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)
		})
		}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");
		return typeof reviver==="function"?walk({"":j},""):j
		}throw new SyntaxError("JSON.parse")
		}
		}FBL.JSON=JSON
		}());
		(function(){var store=(function(){var api={},win=window,doc=win.document,localStorageName="localStorage",globalStorageName="globalStorage",namespace="__firebug__storejs__",storage;
		api.disabled=false;
		api.set=function(key,value){};
		api.get=function(key){};
		api.remove=function(key){};
		api.clear=function(){};
		api.transact=function(key,transactionFn){var val=api.get(key);
		if(typeof val=="undefined"){val={}
		}transactionFn(val);
		api.set(key,val)
		};
		api.serialize=function(value){return JSON.stringify(value)
		};
		api.deserialize=function(value){if(typeof value!="string"){return undefined
		}return JSON.parse(value)
		};
		function isLocalStorageNameSupported(){try{return(localStorageName in win&&win[localStorageName])
		}catch(err){return false
		}}function isGlobalStorageNameSupported(){try{return(globalStorageName in win&&win[globalStorageName]&&win[globalStorageName][win.location.hostname])
		}catch(err){return false
		}}if(isLocalStorageNameSupported()){storage=win[localStorageName];
		api.set=function(key,val){storage.setItem(key,api.serialize(val))
		};
		api.get=function(key){return api.deserialize(storage.getItem(key))
		};
		api.remove=function(key){storage.removeItem(key)
		};
		api.clear=function(){storage.clear()
		}
		}else{if(isGlobalStorageNameSupported()){storage=win[globalStorageName][win.location.hostname];
		api.set=function(key,val){storage[key]=api.serialize(val)
		};
		api.get=function(key){return api.deserialize(storage[key]&&storage[key].value)
		};
		api.remove=function(key){delete storage[key]
		};
		api.clear=function(){for(var key in storage){delete storage[key]
		}}
		}else{if(doc.documentElement.addBehavior){var storage=doc.createElement("div");
		function withIEStorage(storeFunction){return function(){var args=Array.prototype.slice.call(arguments,0);
		args.unshift(storage);
		doc.documentElement.appendChild(storage);
		storage.addBehavior("#default#userData");
		storage.load(localStorageName);
		var result=storeFunction.apply(api,args);
		doc.documentElement.removeChild(storage);
		return result
		}
		}api.set=withIEStorage(function(storage,key,val){storage.setAttribute(key,api.serialize(val));
		storage.save(localStorageName)
		});
		api.get=withIEStorage(function(storage,key){return api.deserialize(storage.getAttribute(key))
		});
		api.remove=withIEStorage(function(storage,key){storage.removeAttribute(key);
		storage.save(localStorageName)
		});
		api.clear=withIEStorage(function(storage){var attributes=storage.XMLDocument.documentElement.attributes;
		storage.load(localStorageName);
		for(var i=0,attr;
		attr=attributes[i];
		i++){storage.removeAttribute(attr.name)
		}storage.save(localStorageName)
		})
		}}}try{api.set(namespace,namespace);
		if(api.get(namespace)!=namespace){api.disabled=true
		}api.remove(namespace)
		}catch(e){api.disabled=true
		}return api
		})();
		if(typeof module!="undefined"){module.exports=store
		}FBL.Store=store
		})();
		FBL.ns(function(){with(FBL){var chunker=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,done=0,toString=Object.prototype.toString,hasDuplicate=false,baseHasDuplicate=true;
		[0,0].sort(function(){baseHasDuplicate=false;
		return 0
		});
		var Sizzle=function(selector,context,results,seed){results=results||[];
		var origContext=context=context||document;
		if(context.nodeType!==1&&context.nodeType!==9){return[]
		}if(!selector||typeof selector!=="string"){return results
		}var parts=[],m,set,checkSet,check,mode,extra,prune=true,contextXML=isXML(context),soFar=selector;
		while((chunker.exec(""),m=chunker.exec(soFar))!==null){soFar=m[3];
		parts.push(m[1]);
		if(m[2]){extra=m[3];
		break
		}}if(parts.length>1&&origPOS.exec(selector)){if(parts.length===2&&Expr.relative[parts[0]]){set=posProcess(parts[0]+parts[1],context)
		}else{set=Expr.relative[parts[0]]?[context]:Sizzle(parts.shift(),context);
		while(parts.length){selector=parts.shift();
		if(Expr.relative[selector]){selector+=parts.shift()
		}set=posProcess(selector,set)
		}}}else{if(!seed&&parts.length>1&&context.nodeType===9&&!contextXML&&Expr.match.ID.test(parts[0])&&!Expr.match.ID.test(parts[parts.length-1])){var ret=Sizzle.find(parts.shift(),context,contextXML);
		context=ret.expr?Sizzle.filter(ret.expr,ret.set)[0]:ret.set[0]
		}if(context){var ret=seed?{expr:parts.pop(),set:makeArray(seed)}:Sizzle.find(parts.pop(),parts.length===1&&(parts[0]==="~"||parts[0]==="+")&&context.parentNode?context.parentNode:context,contextXML);
		set=ret.expr?Sizzle.filter(ret.expr,ret.set):ret.set;
		if(parts.length>0){checkSet=makeArray(set)
		}else{prune=false
		}while(parts.length){var cur=parts.pop(),pop=cur;
		if(!Expr.relative[cur]){cur=""
		}else{pop=parts.pop()
		}if(pop==null){pop=context
		}Expr.relative[cur](checkSet,pop,contextXML)
		}}else{checkSet=parts=[]
		}}if(!checkSet){checkSet=set
		}if(!checkSet){throw"Syntax error, unrecognized expression: "+(cur||selector)
		}if(toString.call(checkSet)==="[object Array]"){if(!prune){results.push.apply(results,checkSet)
		}else{if(context&&context.nodeType===1){for(var i=0;
		checkSet[i]!=null;
		i++){if(checkSet[i]&&(checkSet[i]===true||checkSet[i].nodeType===1&&contains(context,checkSet[i]))){results.push(set[i])
		}}}else{for(var i=0;
		checkSet[i]!=null;
		i++){if(checkSet[i]&&checkSet[i].nodeType===1){results.push(set[i])
		}}}}}else{makeArray(checkSet,results)
		}if(extra){Sizzle(extra,origContext,results,seed);
		Sizzle.uniqueSort(results)
		}return results
		};
		Sizzle.uniqueSort=function(results){if(sortOrder){hasDuplicate=baseHasDuplicate;
		results.sort(sortOrder);
		if(hasDuplicate){for(var i=1;
		i<results.length;
		i++){if(results[i]===results[i-1]){results.splice(i--,1)
		}}}}return results
		};
		Sizzle.matches=function(expr,set){return Sizzle(expr,null,null,set)
		};
		Sizzle.find=function(expr,context,isXML){var set,match;
		if(!expr){return[]
		}for(var i=0,l=Expr.order.length;
		i<l;
		i++){var type=Expr.order[i],match;
		if((match=Expr.leftMatch[type].exec(expr))){var left=match[1];
		match.splice(1,1);
		if(left.substr(left.length-1)!=="\\"){match[1]=(match[1]||"").replace(/\\/g,"");
		set=Expr.find[type](match,context,isXML);
		if(set!=null){expr=expr.replace(Expr.match[type],"");
		break
		}}}}if(!set){set=context.getElementsByTagName("*")
		}return{set:set,expr:expr}
		};
		Sizzle.filter=function(expr,set,inplace,not){var old=expr,result=[],curLoop=set,match,anyFound,isXMLFilter=set&&set[0]&&isXML(set[0]);
		while(expr&&set.length){for(var type in Expr.filter){if((match=Expr.match[type].exec(expr))!=null){var filter=Expr.filter[type],found,item;
		anyFound=false;
		if(curLoop==result){result=[]
		}if(Expr.preFilter[type]){match=Expr.preFilter[type](match,curLoop,inplace,result,not,isXMLFilter);
		if(!match){anyFound=found=true
		}else{if(match===true){continue
		}}}if(match){for(var i=0;
		(item=curLoop[i])!=null;
		i++){if(item){found=filter(item,match,i,curLoop);
		var pass=not^!!found;
		if(inplace&&found!=null){if(pass){anyFound=true
		}else{curLoop[i]=false
		}}else{if(pass){result.push(item);
		anyFound=true
		}}}}}if(found!==undefined){if(!inplace){curLoop=result
		}expr=expr.replace(Expr.match[type],"");
		if(!anyFound){return[]
		}break
		}}}if(expr==old){if(anyFound==null){throw"Syntax error, unrecognized expression: "+expr
		}else{break
		}}old=expr
		}return curLoop
		};
		var Expr=Sizzle.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(elem){return elem.getAttribute("href")
		}},relative:{"+":function(checkSet,part,isXML){var isPartStr=typeof part==="string",isTag=isPartStr&&!/\W/.test(part),isPartStrNotTag=isPartStr&&!isTag;
		if(isTag&&!isXML){part=part.toUpperCase()
		}for(var i=0,l=checkSet.length,elem;
		i<l;
		i++){if((elem=checkSet[i])){while((elem=elem.previousSibling)&&elem.nodeType!==1){}checkSet[i]=isPartStrNotTag||elem&&elem.nodeName===part?elem||false:elem===part
		}}if(isPartStrNotTag){Sizzle.filter(part,checkSet,true)
		}},">":function(checkSet,part,isXML){var isPartStr=typeof part==="string";
		if(isPartStr&&!/\W/.test(part)){part=isXML?part:part.toUpperCase();
		for(var i=0,l=checkSet.length;
		i<l;
		i++){var elem=checkSet[i];
		if(elem){var parent=elem.parentNode;
		checkSet[i]=parent.nodeName===part?parent:false
		}}}else{for(var i=0,l=checkSet.length;
		i<l;
		i++){var elem=checkSet[i];
		if(elem){checkSet[i]=isPartStr?elem.parentNode:elem.parentNode===part
		}}if(isPartStr){Sizzle.filter(part,checkSet,true)
		}}},"":function(checkSet,part,isXML){var doneName=done++,checkFn=dirCheck;
		if(!/\W/.test(part)){var nodeCheck=part=isXML?part:part.toUpperCase();
		checkFn=dirNodeCheck
		}checkFn("parentNode",part,doneName,checkSet,nodeCheck,isXML)
		},"~":function(checkSet,part,isXML){var doneName=done++,checkFn=dirCheck;
		if(typeof part==="string"&&!/\W/.test(part)){var nodeCheck=part=isXML?part:part.toUpperCase();
		checkFn=dirNodeCheck
		}checkFn("previousSibling",part,doneName,checkSet,nodeCheck,isXML)
		}},find:{ID:function(match,context,isXML){if(typeof context.getElementById!=="undefined"&&!isXML){var m=context.getElementById(match[1]);
		return m?[m]:[]
		}},NAME:function(match,context,isXML){if(typeof context.getElementsByName!=="undefined"){var ret=[],results=context.getElementsByName(match[1]);
		for(var i=0,l=results.length;
		i<l;
		i++){if(results[i].getAttribute("name")===match[1]){ret.push(results[i])
		}}return ret.length===0?null:ret
		}},TAG:function(match,context){return context.getElementsByTagName(match[1])
		}},preFilter:{CLASS:function(match,curLoop,inplace,result,not,isXML){match=" "+match[1].replace(/\\/g,"")+" ";
		if(isXML){return match
		}for(var i=0,elem;
		(elem=curLoop[i])!=null;
		i++){if(elem){if(not^(elem.className&&(" "+elem.className+" ").indexOf(match)>=0)){if(!inplace){result.push(elem)
		}}else{if(inplace){curLoop[i]=false
		}}}}return false
		},ID:function(match){return match[1].replace(/\\/g,"")
		},TAG:function(match,curLoop){for(var i=0;
		curLoop[i]===false;
		i++){}return curLoop[i]&&isXML(curLoop[i])?match[1]:match[1].toUpperCase()
		},CHILD:function(match){if(match[1]=="nth"){var test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(match[2]=="even"&&"2n"||match[2]=="odd"&&"2n+1"||!/\D/.test(match[2])&&"0n+"+match[2]||match[2]);
		match[2]=(test[1]+(test[2]||1))-0;
		match[3]=test[3]-0
		}match[0]=done++;
		return match
		},ATTR:function(match,curLoop,inplace,result,not,isXML){var name=match[1].replace(/\\/g,"");
		if(!isXML&&Expr.attrMap[name]){match[1]=Expr.attrMap[name]
		}if(match[2]==="~="){match[4]=" "+match[4]+" "
		}return match
		},PSEUDO:function(match,curLoop,inplace,result,not){if(match[1]==="not"){if((chunker.exec(match[3])||"").length>1||/^\w/.test(match[3])){match[3]=Sizzle(match[3],null,null,curLoop)
		}else{var ret=Sizzle.filter(match[3],curLoop,inplace,true^not);
		if(!inplace){result.push.apply(result,ret)
		}return false
		}}else{if(Expr.match.POS.test(match[0])||Expr.match.CHILD.test(match[0])){return true
		}}return match
		},POS:function(match){match.unshift(true);
		return match
		}},filters:{enabled:function(elem){return elem.disabled===false&&elem.type!=="hidden"
		},disabled:function(elem){return elem.disabled===true
		},checked:function(elem){return elem.checked===true
		},selected:function(elem){elem.parentNode.selectedIndex;
		return elem.selected===true
		},parent:function(elem){return !!elem.firstChild
		},empty:function(elem){return !elem.firstChild
		},has:function(elem,i,match){return !!Sizzle(match[3],elem).length
		},header:function(elem){return/h\d/i.test(elem.nodeName)
		},text:function(elem){return"text"===elem.type
		},radio:function(elem){return"radio"===elem.type
		},checkbox:function(elem){return"checkbox"===elem.type
		},file:function(elem){return"file"===elem.type
		},password:function(elem){return"password"===elem.type
		},submit:function(elem){return"submit"===elem.type
		},image:function(elem){return"image"===elem.type
		},reset:function(elem){return"reset"===elem.type
		},button:function(elem){return"button"===elem.type||elem.nodeName.toUpperCase()==="BUTTON"
		},input:function(elem){return/input|select|textarea|button/i.test(elem.nodeName)
		}},setFilters:{first:function(elem,i){return i===0
		},last:function(elem,i,match,array){return i===array.length-1
		},even:function(elem,i){return i%2===0
		},odd:function(elem,i){return i%2===1
		},lt:function(elem,i,match){return i<match[3]-0
		},gt:function(elem,i,match){return i>match[3]-0
		},nth:function(elem,i,match){return match[3]-0==i
		},eq:function(elem,i,match){return match[3]-0==i
		}},filter:{PSEUDO:function(elem,match,i,array){var name=match[1],filter=Expr.filters[name];
		if(filter){return filter(elem,i,match,array)
		}else{if(name==="contains"){return(elem.textContent||elem.innerText||"").indexOf(match[3])>=0
		}else{if(name==="not"){var not=match[3];
		for(var i=0,l=not.length;
		i<l;
		i++){if(not[i]===elem){return false
		}}return true
		}}}},CHILD:function(elem,match){var type=match[1],node=elem;
		switch(type){case"only":case"first":while((node=node.previousSibling)){if(node.nodeType===1){return false
		}}if(type=="first"){return true
		}node=elem;
		case"last":while((node=node.nextSibling)){if(node.nodeType===1){return false
		}}return true;
		case"nth":var first=match[2],last=match[3];
		if(first==1&&last==0){return true
		}var doneName=match[0],parent=elem.parentNode;
		if(parent&&(parent.sizcache!==doneName||!elem.nodeIndex)){var count=0;
		for(node=parent.firstChild;
		node;
		node=node.nextSibling){if(node.nodeType===1){node.nodeIndex=++count
		}}parent.sizcache=doneName
		}var diff=elem.nodeIndex-last;
		if(first==0){return diff==0
		}else{return(diff%first==0&&diff/first>=0)
		}}},ID:function(elem,match){return elem.nodeType===1&&elem.getAttribute("id")===match
		},TAG:function(elem,match){return(match==="*"&&elem.nodeType===1)||elem.nodeName===match
		},CLASS:function(elem,match){return(" "+(elem.className||elem.getAttribute("class"))+" ").indexOf(match)>-1
		},ATTR:function(elem,match){var name=match[1],result=Expr.attrHandle[name]?Expr.attrHandle[name](elem):elem[name]!=null?elem[name]:elem.getAttribute(name),value=result+"",type=match[2],check=match[4];
		return result==null?type==="!=":type==="="?value===check:type==="*="?value.indexOf(check)>=0:type==="~="?(" "+value+" ").indexOf(check)>=0:!check?value&&result!==false:type==="!="?value!=check:type==="^="?value.indexOf(check)===0:type==="$="?value.substr(value.length-check.length)===check:type==="|="?value===check||value.substr(0,check.length+1)===check+"-":false
		},POS:function(elem,match,i,array){var name=match[2],filter=Expr.setFilters[name];
		if(filter){return filter(elem,i,match,array)
		}}}};
		var origPOS=Expr.match.POS;
		for(var type in Expr.match){Expr.match[type]=new RegExp(Expr.match[type].source+/(?![^\[]*\])(?![^\(]*\))/.source);
		Expr.leftMatch[type]=new RegExp(/(^(?:.|\r|\n)*?)/.source+Expr.match[type].source)
		}var makeArray=function(array,results){array=Array.prototype.slice.call(array,0);
		if(results){results.push.apply(results,array);
		return results
		}return array
		};
		try{Array.prototype.slice.call(document.documentElement.childNodes,0)
		}catch(e){makeArray=function(array,results){var ret=results||[];
		if(toString.call(array)==="[object Array]"){Array.prototype.push.apply(ret,array)
		}else{if(typeof array.length==="number"){for(var i=0,l=array.length;
		i<l;
		i++){ret.push(array[i])
		}}else{for(var i=0;
		array[i];
		i++){ret.push(array[i])
		}}}return ret
		}
		}var sortOrder;
		if(document.documentElement.compareDocumentPosition){sortOrder=function(a,b){if(!a.compareDocumentPosition||!b.compareDocumentPosition){if(a==b){hasDuplicate=true
		}return 0
		}var ret=a.compareDocumentPosition(b)&4?-1:a===b?0:1;
		if(ret===0){hasDuplicate=true
		}return ret
		}
		}else{if("sourceIndex" in document.documentElement){sortOrder=function(a,b){if(!a.sourceIndex||!b.sourceIndex){if(a==b){hasDuplicate=true
		}return 0
		}var ret=a.sourceIndex-b.sourceIndex;
		if(ret===0){hasDuplicate=true
		}return ret
		}
		}else{if(document.createRange){sortOrder=function(a,b){if(!a.ownerDocument||!b.ownerDocument){if(a==b){hasDuplicate=true
		}return 0
		}var aRange=a.ownerDocument.createRange(),bRange=b.ownerDocument.createRange();
		aRange.setStart(a,0);
		aRange.setEnd(a,0);
		bRange.setStart(b,0);
		bRange.setEnd(b,0);
		var ret=aRange.compareBoundaryPoints(Range.START_TO_END,bRange);
		if(ret===0){hasDuplicate=true
		}return ret
		}
		}}}(function(){var form=document.createElement("div"),id="script"+(new Date).getTime();
		form.innerHTML="<a name='"+id+"'/>";
		var root=document.documentElement;
		root.insertBefore(form,root.firstChild);
		if(!!document.getElementById(id)){Expr.find.ID=function(match,context,isXML){if(typeof context.getElementById!=="undefined"&&!isXML){var m=context.getElementById(match[1]);
		return m?m.id===match[1]||typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id").nodeValue===match[1]?[m]:undefined:[]
		}};
		Expr.filter.ID=function(elem,match){var node=typeof elem.getAttributeNode!=="undefined"&&elem.getAttributeNode("id");
		return elem.nodeType===1&&node&&node.nodeValue===match
		}
		}root.removeChild(form);
		root=form=null
		})();
		(function(){var div=document.createElement("div");
		div.appendChild(document.createComment(""));
		if(div.getElementsByTagName("*").length>0){Expr.find.TAG=function(match,context){var results=context.getElementsByTagName(match[1]);
		if(match[1]==="*"){var tmp=[];
		for(var i=0;
		results[i];
		i++){if(results[i].nodeType===1){tmp.push(results[i])
		}}results=tmp
		}return results
		}
		}div.innerHTML="<a href='#'></a>";
		if(div.firstChild&&typeof div.firstChild.getAttribute!=="undefined"&&div.firstChild.getAttribute("href")!=="#"){Expr.attrHandle.href=function(elem){return elem.getAttribute("href",2)
		}
		}div=null
		})();
		if(document.querySelectorAll){(function(){var oldSizzle=Sizzle,div=document.createElement("div");
		div.innerHTML="<p class='TEST'></p>";
		if(div.querySelectorAll&&div.querySelectorAll(".TEST").length===0){return
		}Sizzle=function(query,context,extra,seed){context=context||document;
		if(!seed&&context.nodeType===9&&!isXML(context)){try{return makeArray(context.querySelectorAll(query),extra)
		}catch(e){}}return oldSizzle(query,context,extra,seed)
		};
		for(var prop in oldSizzle){Sizzle[prop]=oldSizzle[prop]
		}div=null
		})()
		}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var div=document.createElement("div");
		div.innerHTML="<div class='test e'></div><div class='test'></div>";
		if(div.getElementsByClassName("e").length===0){return
		}div.lastChild.className="e";
		if(div.getElementsByClassName("e").length===1){return
		}Expr.order.splice(1,0,"CLASS");
		Expr.find.CLASS=function(match,context,isXML){if(typeof context.getElementsByClassName!=="undefined"&&!isXML){return context.getElementsByClassName(match[1])
		}};
		div=null
		})()
		}function dirNodeCheck(dir,cur,doneName,checkSet,nodeCheck,isXML){var sibDir=dir=="previousSibling"&&!isXML;
		for(var i=0,l=checkSet.length;
		i<l;
		i++){var elem=checkSet[i];
		if(elem){if(sibDir&&elem.nodeType===1){elem.sizcache=doneName;
		elem.sizset=i
		}elem=elem[dir];
		var match=false;
		while(elem){if(elem.sizcache===doneName){match=checkSet[elem.sizset];
		break
		}if(elem.nodeType===1&&!isXML){elem.sizcache=doneName;
		elem.sizset=i
		}if(elem.nodeName===cur){match=elem;
		break
		}elem=elem[dir]
		}checkSet[i]=match
		}}}function dirCheck(dir,cur,doneName,checkSet,nodeCheck,isXML){var sibDir=dir=="previousSibling"&&!isXML;
		for(var i=0,l=checkSet.length;
		i<l;
		i++){var elem=checkSet[i];
		if(elem){if(sibDir&&elem.nodeType===1){elem.sizcache=doneName;
		elem.sizset=i
		}elem=elem[dir];
		var match=false;
		while(elem){if(elem.sizcache===doneName){match=checkSet[elem.sizset];
		break
		}if(elem.nodeType===1){if(!isXML){elem.sizcache=doneName;
		elem.sizset=i
		}if(typeof cur!=="string"){if(elem===cur){match=true;
		break
		}}else{if(Sizzle.filter(cur,[elem]).length>0){match=elem;
		break
		}}}elem=elem[dir]
		}checkSet[i]=match
		}}}var contains=document.compareDocumentPosition?function(a,b){return a.compareDocumentPosition(b)&16
		}:function(a,b){return a!==b&&(a.contains?a.contains(b):true)
		};
		var isXML=function(elem){return elem.nodeType===9&&elem.documentElement.nodeName!=="HTML"||!!elem.ownerDocument&&elem.ownerDocument.documentElement.nodeName!=="HTML"
		};
		var posProcess=function(selector,context){var tmpSet=[],later="",match,root=context.nodeType?[context]:context;
		while((match=Expr.match.PSEUDO.exec(selector))){later+=match[0];
		selector=selector.replace(Expr.match.PSEUDO,"")
		}selector=Expr.relative[selector]?selector+"*":selector;
		for(var i=0,l=root.length;
		i<l;
		i++){Sizzle(selector,root[i],tmpSet)
		}return Sizzle.filter(later,tmpSet)
		};
		Firebug.Selector=Sizzle
		}});
		FBL.ns(function(){with(FBL){var ElementCache=Firebug.Lite.Cache.Element;
		var inspectorTS,inspectorTimer,isInspecting;
		Firebug.Inspector={create:function(){offlineFragment=Env.browser.document.createDocumentFragment();
		createBoxModelInspector();
		createOutlineInspector()
		},destroy:function(){destroyBoxModelInspector();
		destroyOutlineInspector();
		offlineFragment=null
		},toggleInspect:function(){if(isInspecting){this.stopInspecting()
		}else{Firebug.chrome.inspectButton.changeState("pressed");
		this.startInspecting()
		}},startInspecting:function(){isInspecting=true;
		Firebug.chrome.selectPanel("HTML");
		createInspectorFrame();
		var size=Firebug.browser.getWindowScrollSize();
		fbInspectFrame.style.width=size.width+"px";
		fbInspectFrame.style.height=size.height+"px";
		addEvent(fbInspectFrame,"mousemove",Firebug.Inspector.onInspecting);
		addEvent(fbInspectFrame,"mousedown",Firebug.Inspector.onInspectingClick)
		},stopInspecting:function(){isInspecting=false;
		if(outlineVisible){this.hideOutline()
		}removeEvent(fbInspectFrame,"mousemove",Firebug.Inspector.onInspecting);
		removeEvent(fbInspectFrame,"mousedown",Firebug.Inspector.onInspectingClick);
		destroyInspectorFrame();
		Firebug.chrome.inspectButton.restore();
		if(Firebug.chrome.type=="popup"){Firebug.chrome.node.focus()
		}},onInspectingClick:function(e){fbInspectFrame.style.display="none";
		var targ=Firebug.browser.getElementFromPoint(e.clientX,e.clientY);
		fbInspectFrame.style.display="block";
		var id=targ.id;
		if(id&&/^fbOutline\w$/.test(id)){return
		}if(id=="FirebugUI"){return
		}while(targ.nodeType!=1){targ=targ.parentNode
		}Firebug.Inspector.stopInspecting()
		},onInspecting:function(e){if(new Date().getTime()-lastInspecting>30){fbInspectFrame.style.display="none";
		var targ=Firebug.browser.getElementFromPoint(e.clientX,e.clientY);
		fbInspectFrame.style.display="block";
		var id=targ.id;
		if(id&&/^fbOutline\w$/.test(id)){return
		}if(id=="FirebugUI"){return
		}while(targ.nodeType!=1){targ=targ.parentNode
		}if(targ.nodeName.toLowerCase()=="body"){return
		}Firebug.Inspector.drawOutline(targ);
		if(ElementCache(targ)){var target=""+ElementCache.key(targ);
		var lazySelect=function(){inspectorTS=new Date().getTime();
		if(Firebug.HTML){Firebug.HTML.selectTreeNode(""+ElementCache.key(targ))
		}};
		if(inspectorTimer){clearTimeout(inspectorTimer);
		inspectorTimer=null
		}if(new Date().getTime()-inspectorTS>200){setTimeout(lazySelect,0)
		}else{inspectorTimer=setTimeout(lazySelect,300)
		}}lastInspecting=new Date().getTime()
		}},onInspectingBody:function(e){if(new Date().getTime()-lastInspecting>30){var targ=e.target;
		var id=targ.id;
		if(id&&/^fbOutline\w$/.test(id)){return
		}if(id=="FirebugUI"){return
		}while(targ.nodeType!=1){targ=targ.parentNode
		}if(targ.nodeName.toLowerCase()=="body"){return
		}Firebug.Inspector.drawOutline(targ);
		if(ElementCache.has(targ)){FBL.Firebug.HTML.selectTreeNode(""+ElementCache.key(targ))
		}lastInspecting=new Date().getTime()
		}},drawOutline:function(el){var border=2;
		var scrollbarSize=17;
		var windowSize=Firebug.browser.getWindowSize();
		var scrollSize=Firebug.browser.getWindowScrollSize();
		var scrollPosition=Firebug.browser.getWindowScrollPosition();
		var box=Firebug.browser.getElementBox(el);
		var top=box.top;
		var left=box.left;
		var height=box.height;
		var width=box.width;
		var freeHorizontalSpace=scrollPosition.left+windowSize.width-left-width-(!isIE&&scrollSize.height>windowSize.height?scrollbarSize:0);
		var freeVerticalSpace=scrollPosition.top+windowSize.height-top-height-(!isIE&&scrollSize.width>windowSize.width?scrollbarSize:0);
		var numVerticalBorders=freeVerticalSpace>0?2:1;
		var o=outlineElements;
		var style;
		style=o.fbOutlineT.style;
		style.top=top-border+"px";
		style.left=left+"px";
		style.height=border+"px";
		style.width=width+"px";
		style=o.fbOutlineL.style;
		style.top=top-border+"px";
		style.left=left-border+"px";
		style.height=height+numVerticalBorders*border+"px";
		style.width=border+"px";
		style=o.fbOutlineB.style;
		if(freeVerticalSpace>0){style.top=top+height+"px";
		style.left=left+"px";
		style.width=width+"px"
		}else{style.top=-2*border+"px";
		style.left=-2*border+"px";
		style.width=border+"px"
		}style=o.fbOutlineR.style;
		if(freeHorizontalSpace>0){style.top=top-border+"px";
		style.left=left+width+"px";
		style.height=height+numVerticalBorders*border+"px";
		style.width=(freeHorizontalSpace<border?freeHorizontalSpace:border)+"px"
		}else{style.top=-2*border+"px";
		style.left=-2*border+"px";
		style.height=border+"px";
		style.width=border+"px"
		}if(!outlineVisible){this.showOutline()
		}},hideOutline:function(){if(!outlineVisible){return
		}for(var name in outline){offlineFragment.appendChild(outlineElements[name])
		}outlineVisible=false
		},showOutline:function(){if(outlineVisible){return
		}if(boxModelVisible){this.hideBoxModel()
		}for(var name in outline){Firebug.browser.document.getElementsByTagName("body")[0].appendChild(outlineElements[name])
		}outlineVisible=true
		},drawBoxModel:function(el){if(!el||!el.parentNode){return
		}var box=Firebug.browser.getElementBox(el);
		var windowSize=Firebug.browser.getWindowSize();
		var scrollPosition=Firebug.browser.getWindowScrollPosition();
		var offsetHeight=Firebug.chrome.type=="frame"?Firebug.context.persistedState.height:0;
		if(box.top>scrollPosition.top+windowSize.height-offsetHeight||box.left>scrollPosition.left+windowSize.width||scrollPosition.top>box.top+box.height||scrollPosition.left>box.left+box.width){return
		}var top=box.top;
		var left=box.left;
		var height=box.height;
		var width=box.width;
		var margin=Firebug.browser.getMeasurementBox(el,"margin");
		var padding=Firebug.browser.getMeasurementBox(el,"padding");
		var border=Firebug.browser.getMeasurementBox(el,"border");
		boxModelStyle.top=top-margin.top+"px";
		boxModelStyle.left=left-margin.left+"px";
		boxModelStyle.height=height+margin.top+margin.bottom+"px";
		boxModelStyle.width=width+margin.left+margin.right+"px";
		boxBorderStyle.top=margin.top+"px";
		boxBorderStyle.left=margin.left+"px";
		boxBorderStyle.height=height+"px";
		boxBorderStyle.width=width+"px";
		boxPaddingStyle.top=margin.top+border.top+"px";
		boxPaddingStyle.left=margin.left+border.left+"px";
		boxPaddingStyle.height=height-border.top-border.bottom+"px";
		boxPaddingStyle.width=width-border.left-border.right+"px";
		boxContentStyle.top=margin.top+border.top+padding.top+"px";
		boxContentStyle.left=margin.left+border.left+padding.left+"px";
		boxContentStyle.height=height-border.top-padding.top-padding.bottom-border.bottom+"px";
		boxContentStyle.width=width-border.left-padding.left-padding.right-border.right+"px";
		if(!boxModelVisible){this.showBoxModel()
		}},hideBoxModel:function(){if(!boxModelVisible){return
		}offlineFragment.appendChild(boxModel);
		boxModelVisible=false
		},showBoxModel:function(){if(boxModelVisible){return
		}if(outlineVisible){this.hideOutline()
		}Firebug.browser.document.getElementsByTagName("body")[0].appendChild(boxModel);
		boxModelVisible=true
		}};
		var offlineFragment=null;
		var boxModelVisible=false;
		var boxModel,boxModelStyle,boxMargin,boxMarginStyle,boxBorder,boxBorderStyle,boxPadding,boxPaddingStyle,boxContent,boxContentStyle;
		var resetStyle="margin:0; padding:0; border:0; position:absolute; overflow:hidden; display:block;";
		var offscreenStyle=resetStyle+"top:-1234px; left:-1234px;";
		var inspectStyle=resetStyle+"z-index: 2147483500;";
		var inspectFrameStyle=resetStyle+"z-index: 2147483550; top:0; left:0; background:url("+Env.Location.skinDir+"pixel_transparent.gif);";
		var inspectModelOpacity=isIE?"filter:alpha(opacity=80);":"opacity:0.8;";
		var inspectModelStyle=inspectStyle+inspectModelOpacity;
		var inspectMarginStyle=inspectStyle+"background: #EDFF64; height:100%; width:100%;";
		var inspectBorderStyle=inspectStyle+"background: #666;";
		var inspectPaddingStyle=inspectStyle+"background: SlateBlue;";
		var inspectContentStyle=inspectStyle+"background: SkyBlue;";
		var outlineStyle={fbHorizontalLine:"background: #3875D7;height: 2px;",fbVerticalLine:"background: #3875D7;width: 2px;"};
		var lastInspecting=0;
		var fbInspectFrame=null;
		var outlineVisible=false;
		var outlineElements={};
		var outline={fbOutlineT:"fbHorizontalLine",fbOutlineL:"fbVerticalLine",fbOutlineB:"fbHorizontalLine",fbOutlineR:"fbVerticalLine"};
		var getInspectingTarget=function(){};
		var createInspectorFrame=function createInspectorFrame(){fbInspectFrame=createGlobalElement("div");
		fbInspectFrame.id="fbInspectFrame";
		fbInspectFrame.firebugIgnore=true;
		fbInspectFrame.style.cssText=inspectFrameStyle;
		Firebug.browser.document.getElementsByTagName("body")[0].appendChild(fbInspectFrame)
		};
		var destroyInspectorFrame=function destroyInspectorFrame(){if(fbInspectFrame){Firebug.browser.document.getElementsByTagName("body")[0].removeChild(fbInspectFrame);
		fbInspectFrame=null
		}};
		var createOutlineInspector=function createOutlineInspector(){for(var name in outline){var el=outlineElements[name]=createGlobalElement("div");
		el.id=name;
		el.firebugIgnore=true;
		el.style.cssText=inspectStyle+outlineStyle[outline[name]];
		offlineFragment.appendChild(el)
		}};
		var destroyOutlineInspector=function destroyOutlineInspector(){for(var name in outline){var el=outlineElements[name];
		el.parentNode.removeChild(el)
		}};
		var createBoxModelInspector=function createBoxModelInspector(){boxModel=createGlobalElement("div");
		boxModel.id="fbBoxModel";
		boxModel.firebugIgnore=true;
		boxModelStyle=boxModel.style;
		boxModelStyle.cssText=inspectModelStyle;
		boxMargin=createGlobalElement("div");
		boxMargin.id="fbBoxMargin";
		boxMarginStyle=boxMargin.style;
		boxMarginStyle.cssText=inspectMarginStyle;
		boxModel.appendChild(boxMargin);
		boxBorder=createGlobalElement("div");
		boxBorder.id="fbBoxBorder";
		boxBorderStyle=boxBorder.style;
		boxBorderStyle.cssText=inspectBorderStyle;
		boxModel.appendChild(boxBorder);
		boxPadding=createGlobalElement("div");
		boxPadding.id="fbBoxPadding";
		boxPaddingStyle=boxPadding.style;
		boxPaddingStyle.cssText=inspectPaddingStyle;
		boxModel.appendChild(boxPadding);
		boxContent=createGlobalElement("div");
		boxContent.id="fbBoxContent";
		boxContentStyle=boxContent.style;
		boxContentStyle.cssText=inspectContentStyle;
		boxModel.appendChild(boxContent);
		offlineFragment.appendChild(boxModel)
		};
		var destroyBoxModelInspector=function destroyBoxModelInspector(){boxModel.parentNode.removeChild(boxModel)
		}
		}});
		(function(){FBL.DomplateTag=function DomplateTag(tagName){this.tagName=tagName
		};
		FBL.DomplateEmbed=function DomplateEmbed(){};
		FBL.DomplateLoop=function DomplateLoop(){};
		var DomplateTag=FBL.DomplateTag;
		var DomplateEmbed=FBL.DomplateEmbed;
		var DomplateLoop=FBL.DomplateLoop;
		var womb=null;
		FBL.domplate=function(){var lastSubject;
		for(var i=0;
		i<arguments.length;
		++i){lastSubject=lastSubject?copyObject(lastSubject,arguments[i]):arguments[i]
		}for(var name in lastSubject){var val=lastSubject[name];
		if(isTag(val)){val.tag.subject=lastSubject
		}}return lastSubject
		};
		var domplate=FBL.domplate;
		FBL.domplate.context=function(context,fn){var lastContext=domplate.lastContext;
		domplate.topContext=context;
		fn.apply(context);
		domplate.topContext=lastContext
		};
		FBL.TAG=function(){var embed=new DomplateEmbed();
		return embed.merge(arguments)
		};
		FBL.FOR=function(){var loop=new DomplateLoop();
		return loop.merge(arguments)
		};
		FBL.DomplateTag.prototype={merge:function(args,oldTag){if(oldTag){this.tagName=oldTag.tagName
		}this.context=oldTag?oldTag.context:null;
		this.subject=oldTag?oldTag.subject:null;
		this.attrs=oldTag?copyObject(oldTag.attrs):{};
		this.classes=oldTag?copyObject(oldTag.classes):{};
		this.props=oldTag?copyObject(oldTag.props):null;
		this.listeners=oldTag?copyArray(oldTag.listeners):null;
		this.children=oldTag?copyArray(oldTag.children):[];
		this.vars=oldTag?copyArray(oldTag.vars):[];
		var attrs=args.length?args[0]:null;
		var hasAttrs=typeof(attrs)=="object"&&!isTag(attrs);
		this.children=[];
		if(domplate.topContext){this.context=domplate.topContext
		}if(args.length){parseChildren(args,hasAttrs?1:0,this.vars,this.children)
		}if(hasAttrs){this.parseAttrs(attrs)
		}return creator(this,DomplateTag)
		},parseAttrs:function(args){for(var name in args){var val=parseValue(args[name]);
		readPartNames(val,this.vars);
		if(name.indexOf("on")==0){var eventName=name.substr(2);
		if(!this.listeners){this.listeners=[]
		}this.listeners.push(eventName,val)
		}else{if(name.indexOf("_")==0){var propName=name.substr(1);
		if(!this.props){this.props={}
		}this.props[propName]=val
		}else{if(name.indexOf("$")==0){var className=name.substr(1);
		if(!this.classes){this.classes={}
		}this.classes[className]=val
		}else{if(name=="class"&&this.attrs.hasOwnProperty(name)){this.attrs[name]+=" "+val
		}else{this.attrs[name]=val
		}}}}}},compile:function(){if(this.renderMarkup){return
		}this.compileMarkup();
		this.compileDOM()
		},compileMarkup:function(){this.markupArgs=[];
		var topBlock=[],topOuts=[],blocks=[],info={args:this.markupArgs,argIndex:0};
		this.generateMarkup(topBlock,topOuts,blocks,info);
		this.addCode(topBlock,topOuts,blocks);
		var fnBlock=["r=(function (__code__, __context__, __in__, __out__"];
		for(var i=0;
		i<info.argIndex;
		++i){fnBlock.push(", s",i)
		}fnBlock.push(") {");
		if(this.subject){fnBlock.push("with (this) {")
		}if(this.context){fnBlock.push("with (__context__) {")
		}fnBlock.push("with (__in__) {");
		fnBlock.push.apply(fnBlock,blocks);
		if(this.subject){fnBlock.push("}")
		}if(this.context){fnBlock.push("}")
		}fnBlock.push("}})");
		function __link__(tag,code,outputs,args){if(!tag||!tag.tag){return
		}tag.tag.compile();
		var tagOutputs=[];
		var markupArgs=[code,tag.tag.context,args,tagOutputs];
		markupArgs.push.apply(markupArgs,tag.tag.markupArgs);
		tag.tag.renderMarkup.apply(tag.tag.subject,markupArgs);
		outputs.push(tag);
		outputs.push(tagOutputs)
		}function __escape__(value){function replaceChars(ch){switch(ch){case"<":return"&lt;";
		case">":return"&gt;";
		case"&":return"&amp;";
		case"'":return"&#39;";
		case'"':return"&quot;"
		}return"?"
		}return String(value).replace(/[<>&"']/g,replaceChars)
		}function __loop__(iter,outputs,fn){var iterOuts=[];
		outputs.push(iterOuts);
		if(iter instanceof Array){iter=new ArrayIterator(iter)
		}try{while(1){var value=iter.next();
		var itemOuts=[0,0];
		iterOuts.push(itemOuts);
		fn.apply(this,[value,itemOuts])
		}}catch(exc){if(exc!=StopIteration){throw exc
		}}}var js=fnBlock.join("");
		var r=null;
		eval(js);
		this.renderMarkup=r
		},getVarNames:function(args){if(this.vars){args.push.apply(args,this.vars)
		}for(var i=0;
		i<this.children.length;
		++i){var child=this.children[i];
		if(isTag(child)){child.tag.getVarNames(args)
		}else{if(child instanceof Parts){for(var i=0;
		i<child.parts.length;
		++i){if(child.parts[i] instanceof Variable){var name=child.parts[i].name;
		var names=name.split(".");
		args.push(names[0])
		}}}}}},generateMarkup:function(topBlock,topOuts,blocks,info){topBlock.push(',"<',this.tagName,'"');
		for(var name in this.attrs){if(name!="class"){var val=this.attrs[name];
		topBlock.push(', " ',name,'=\\""');
		addParts(val,",",topBlock,info,true);
		topBlock.push(', "\\""')
		}}if(this.listeners){for(var i=0;
		i<this.listeners.length;
		i+=2){readPartNames(this.listeners[i+1],topOuts)
		}}if(this.props){for(var name in this.props){readPartNames(this.props[name],topOuts)
		}}if(this.attrs.hasOwnProperty("class")||this.classes){topBlock.push(', " class=\\""');
		if(this.attrs.hasOwnProperty("class")){addParts(this.attrs["class"],",",topBlock,info,true)
		}topBlock.push(', " "');
		for(var name in this.classes){topBlock.push(", (");
		addParts(this.classes[name],"",topBlock,info);
		topBlock.push(' ? "',name,'" + " " : "")')
		}topBlock.push(', "\\""')
		}topBlock.push(',">"');
		this.generateChildMarkup(topBlock,topOuts,blocks,info);
		topBlock.push(',"</',this.tagName,'>"')
		},generateChildMarkup:function(topBlock,topOuts,blocks,info){for(var i=0;
		i<this.children.length;
		++i){var child=this.children[i];
		if(isTag(child)){child.tag.generateMarkup(topBlock,topOuts,blocks,info)
		}else{addParts(child,",",topBlock,info,true)
		}}},addCode:function(topBlock,topOuts,blocks){if(topBlock.length){blocks.push('__code__.push(""',topBlock.join(""),");")
		}if(topOuts.length){blocks.push("__out__.push(",topOuts.join(","),");")
		}topBlock.splice(0,topBlock.length);
		topOuts.splice(0,topOuts.length)
		},addLocals:function(blocks){var varNames=[];
		this.getVarNames(varNames);
		var map={};
		for(var i=0;
		i<varNames.length;
		++i){var name=varNames[i];
		if(map.hasOwnProperty(name)){continue
		}map[name]=1;
		var names=name.split(".");
		blocks.push("var ",names[0]+" = __in__."+names[0]+";")
		}},compileDOM:function(){var path=[];
		var blocks=[];
		this.domArgs=[];
		path.embedIndex=0;
		path.loopIndex=0;
		path.staticIndex=0;
		path.renderIndex=0;
		var nodeCount=this.generateDOM(path,blocks,this.domArgs);
		var fnBlock=["r=(function (root, context, o"];
		for(var i=0;
		i<path.staticIndex;
		++i){fnBlock.push(", ","s"+i)
		}for(var i=0;
		i<path.renderIndex;
		++i){fnBlock.push(", ","d"+i)
		}fnBlock.push(") {");
		for(var i=0;
		i<path.loopIndex;
		++i){fnBlock.push("var l",i," = 0;")
		}for(var i=0;
		i<path.embedIndex;
		++i){fnBlock.push("var e",i," = 0;")
		}if(this.subject){fnBlock.push("with (this) {")
		}if(this.context){fnBlock.push("with (context) {")
		}fnBlock.push(blocks.join(""));
		if(this.subject){fnBlock.push("}")
		}if(this.context){fnBlock.push("}")
		}fnBlock.push("return ",nodeCount,";");
		fnBlock.push("})");
		function __bind__(object,fn){return function(event){return fn.apply(object,[event])
		}
		}function __link__(node,tag,args){if(!tag||!tag.tag){return
		}tag.tag.compile();
		var domArgs=[node,tag.tag.context,0];
		domArgs.push.apply(domArgs,tag.tag.domArgs);
		domArgs.push.apply(domArgs,args);
		return tag.tag.renderDOM.apply(tag.tag.subject,domArgs)
		}var self=this;
		function __loop__(iter,fn){var nodeCount=0;
		for(var i=0;
		i<iter.length;
		++i){iter[i][0]=i;
		iter[i][1]=nodeCount;
		nodeCount+=fn.apply(this,iter[i])
		}return nodeCount
		}function __path__(parent,offset){var root=parent;
		for(var i=2;
		i<arguments.length;
		++i){var index=arguments[i];
		if(i==3){index+=offset
		}if(index==-1){parent=parent.parentNode
		}else{parent=parent.childNodes[index]
		}}return parent
		}var js=fnBlock.join("");
		var r=null;
		eval(js);
		this.renderDOM=r
		},generateDOM:function(path,blocks,args){if(this.listeners||this.props){this.generateNodePath(path,blocks)
		}if(this.listeners){for(var i=0;
		i<this.listeners.length;
		i+=2){var val=this.listeners[i+1];
		var arg=generateArg(val,path,args);
		blocks.push('addEvent(node, "',this.listeners[i],'", __bind__(this, ',arg,"), false);")
		}}if(this.props){for(var name in this.props){var val=this.props[name];
		var arg=generateArg(val,path,args);
		blocks.push("node.",name," = ",arg,";")
		}}this.generateChildDOM(path,blocks,args);
		return 1
		},generateNodePath:function(path,blocks){blocks.push("var node = __path__(root, o");
		for(var i=0;
		i<path.length;
		++i){blocks.push(",",path[i])
		}blocks.push(");")
		},generateChildDOM:function(path,blocks,args){path.push(0);
		for(var i=0;
		i<this.children.length;
		++i){var child=this.children[i];
		if(isTag(child)){path[path.length-1]+="+"+child.tag.generateDOM(path,blocks,args)
		}else{path[path.length-1]+="+1"
		}}path.pop()
		}};
		FBL.DomplateEmbed.prototype=copyObject(FBL.DomplateTag.prototype,{merge:function(args,oldTag){this.value=oldTag?oldTag.value:parseValue(args[0]);
		this.attrs=oldTag?oldTag.attrs:{};
		this.vars=oldTag?copyArray(oldTag.vars):[];
		var attrs=args[1];
		for(var name in attrs){var val=parseValue(attrs[name]);
		this.attrs[name]=val;
		readPartNames(val,this.vars)
		}return creator(this,DomplateEmbed)
		},getVarNames:function(names){if(this.value instanceof Parts){names.push(this.value.parts[0].name)
		}if(this.vars){names.push.apply(names,this.vars)
		}},generateMarkup:function(topBlock,topOuts,blocks,info){this.addCode(topBlock,topOuts,blocks);
		blocks.push("__link__(");
		addParts(this.value,"",blocks,info);
		blocks.push(", __code__, __out__, {");
		var lastName=null;
		for(var name in this.attrs){if(lastName){blocks.push(",")
		}lastName=name;
		var val=this.attrs[name];
		blocks.push('"',name,'":');
		addParts(val,"",blocks,info)
		}blocks.push("});")
		},generateDOM:function(path,blocks,args){var embedName="e"+path.embedIndex++;
		this.generateNodePath(path,blocks);
		var valueName="d"+path.renderIndex++;
		var argsName="d"+path.renderIndex++;
		blocks.push(embedName+" = __link__(node, ",valueName,", ",argsName,");");
		return embedName
		}});
		FBL.DomplateLoop.prototype=copyObject(FBL.DomplateTag.prototype,{merge:function(args,oldTag){this.varName=oldTag?oldTag.varName:args[0];
		this.iter=oldTag?oldTag.iter:parseValue(args[1]);
		this.vars=[];
		this.children=oldTag?copyArray(oldTag.children):[];
		var offset=Math.min(args.length,2);
		parseChildren(args,offset,this.vars,this.children);
		return creator(this,DomplateLoop)
		},getVarNames:function(names){if(this.iter instanceof Parts){names.push(this.iter.parts[0].name)
		}DomplateTag.prototype.getVarNames.apply(this,[names])
		},generateMarkup:function(topBlock,topOuts,blocks,info){this.addCode(topBlock,topOuts,blocks);
		var iterName;
		if(this.iter instanceof Parts){var part=this.iter.parts[0];
		iterName=part.name;
		if(part.format){for(var i=0;
		i<part.format.length;
		++i){iterName=part.format[i]+"("+iterName+")"
		}}}else{iterName=this.iter
		}blocks.push("__loop__.apply(this, [",iterName,", __out__, function(",this.varName,", __out__) {");
		this.generateChildMarkup(topBlock,topOuts,blocks,info);
		this.addCode(topBlock,topOuts,blocks);
		blocks.push("}]);")
		},generateDOM:function(path,blocks,args){var iterName="d"+path.renderIndex++;
		var counterName="i"+path.loopIndex;
		var loopName="l"+path.loopIndex++;
		if(!path.length){path.push(-1,0)
		}var preIndex=path.renderIndex;
		path.renderIndex=0;
		var nodeCount=0;
		var subBlocks=[];
		var basePath=path[path.length-1];
		for(var i=0;
		i<this.children.length;
		++i){path[path.length-1]=basePath+"+"+loopName+"+"+nodeCount;
		var child=this.children[i];
		if(isTag(child)){nodeCount+="+"+child.tag.generateDOM(path,subBlocks,args)
		}else{nodeCount+="+1"
		}}path[path.length-1]=basePath+"+"+loopName;
		blocks.push(loopName," = __loop__.apply(this, [",iterName,", function(",counterName,",",loopName);
		for(var i=0;
		i<path.renderIndex;
		++i){blocks.push(",d"+i)
		}blocks.push(") {");
		blocks.push(subBlocks.join(""));
		blocks.push("return ",nodeCount,";");
		blocks.push("}]);");
		path.renderIndex=preIndex;
		return loopName
		}});
		function Variable(name,format){this.name=name;
		this.format=format
		}function Parts(parts){this.parts=parts
		}function parseParts(str){var re=/\$([_A-Za-z][_A-Za-z0-9.|]*)/g;
		var index=0;
		var parts=[];
		var m;
		while(m=re.exec(str)){var pre=str.substr(index,(re.lastIndex-m[0].length)-index);
		if(pre){parts.push(pre)
		}var expr=m[1].split("|");
		parts.push(new Variable(expr[0],expr.slice(1)));
		index=re.lastIndex
		}if(!index){return str
		}var post=str.substr(index);
		if(post){parts.push(post)
		}return new Parts(parts)
		}function parseValue(val){return typeof(val)=="string"?parseParts(val):val
		}function parseChildren(args,offset,vars,children){for(var i=offset;
		i<args.length;
		++i){var val=parseValue(args[i]);
		children.push(val);
		readPartNames(val,vars)
		}}function readPartNames(val,vars){if(val instanceof Parts){for(var i=0;
		i<val.parts.length;
		++i){var part=val.parts[i];
		if(part instanceof Variable){vars.push(part.name)
		}}}}function generateArg(val,path,args){if(val instanceof Parts){var vals=[];
		for(var i=0;
		i<val.parts.length;
		++i){var part=val.parts[i];
		if(part instanceof Variable){var varName="d"+path.renderIndex++;
		if(part.format){for(var j=0;
		j<part.format.length;
		++j){varName=part.format[j]+"("+varName+")"
		}}vals.push(varName)
		}else{vals.push('"'+part.replace(/"/g,'\\"')+'"')
		}}return vals.join("+")
		}else{args.push(val);
		return"s"+path.staticIndex++
		}}function addParts(val,delim,block,info,escapeIt){var vals=[];
		if(val instanceof Parts){for(var i=0;
		i<val.parts.length;
		++i){var part=val.parts[i];
		if(part instanceof Variable){var partName=part.name;
		if(part.format){for(var j=0;
		j<part.format.length;
		++j){partName=part.format[j]+"("+partName+")"
		}}if(escapeIt){vals.push("__escape__("+partName+")")
		}else{vals.push(partName)
		}}else{vals.push('"'+part+'"')
		}}}else{if(isTag(val)){info.args.push(val);
		vals.push("s"+info.argIndex++)
		}else{vals.push('"'+val+'"')
		}}var parts=vals.join(delim);
		if(parts){block.push(delim,parts)
		}}function isTag(obj){return(typeof(obj)=="function"||obj instanceof Function)&&!!obj.tag
		}function creator(tag,cons){var fn=new Function("var tag = arguments.callee.tag;var cons = arguments.callee.cons;var newTag = new cons();return newTag.merge(arguments, tag);");
		fn.tag=tag;
		fn.cons=cons;
		extend(fn,Renderer);
		return fn
		}function copyArray(oldArray){var ary=[];
		if(oldArray){for(var i=0;
		i<oldArray.length;
		++i){ary.push(oldArray[i])
		}}return ary
		}function copyObject(l,r){var m={};
		extend(m,l);
		extend(m,r);
		return m
		}function extend(l,r){for(var n in r){l[n]=r[n]
		}}function addEvent(object,name,handler){if(document.all){object.attachEvent("on"+name,handler)
		}else{object.addEventListener(name,handler,false)
		}}function ArrayIterator(array){var index=-1;
		this.next=function(){if(++index>=array.length){throw StopIteration
		}return array[index]
		}
		}function StopIteration(){}FBL.$break=function(){throw StopIteration
		};
		var Renderer={renderHTML:function(args,outputs,self){var code=[];
		var markupArgs=[code,this.tag.context,args,outputs];
		markupArgs.push.apply(markupArgs,this.tag.markupArgs);
		this.tag.renderMarkup.apply(self?self:this.tag.subject,markupArgs);
		return code.join("")
		},insertRows:function(args,before,self){this.tag.compile();
		var outputs=[];
		var html=this.renderHTML(args,outputs,self);
		var doc=before.ownerDocument;
		var div=doc.createElement("div");
		div.innerHTML="<table><tbody>"+html+"</tbody></table>";
		var tbody=div.firstChild.firstChild;
		var parent=before.tagName=="TR"?before.parentNode:before;
		var after=before.tagName=="TR"?before.nextSibling:null;
		var firstRow=tbody.firstChild,lastRow;
		while(tbody.firstChild){lastRow=tbody.firstChild;
		if(after){parent.insertBefore(lastRow,after)
		}else{parent.appendChild(lastRow)
		}}var offset=0;
		if(before.tagName=="TR"){var node=firstRow.parentNode.firstChild;
		for(;
		node&&node!=firstRow;
		node=node.nextSibling){++offset
		}}var domArgs=[firstRow,this.tag.context,offset];
		domArgs.push.apply(domArgs,this.tag.domArgs);
		domArgs.push.apply(domArgs,outputs);
		this.tag.renderDOM.apply(self?self:this.tag.subject,domArgs);
		return[firstRow,lastRow]
		},insertBefore:function(args,before,self){return this.insertNode(args,before.ownerDocument,before,false,self)
		},insertAfter:function(args,after,self){return this.insertNode(args,after.ownerDocument,after,true,self)
		},insertNode:function(args,doc,element,isAfter,self){if(!args){args={}
		}this.tag.compile();
		var outputs=[];
		var html=this.renderHTML(args,outputs,self);
		var doc=element.ownerDocument;
		if(!womb||womb.ownerDocument!=doc){womb=doc.createElement("div")
		}womb.innerHTML=html;
		var root=womb.firstChild;
		if(isAfter){while(womb.firstChild){if(element.nextSibling){element.parentNode.insertBefore(womb.firstChild,element.nextSibling)
		}else{element.parentNode.appendChild(womb.firstChild)
		}}}else{while(womb.lastChild){element.parentNode.insertBefore(womb.lastChild,element)
		}}var domArgs=[root,this.tag.context,0];
		domArgs.push.apply(domArgs,this.tag.domArgs);
		domArgs.push.apply(domArgs,outputs);
		this.tag.renderDOM.apply(self?self:this.tag.subject,domArgs);
		return root
		},replace:function(args,parent,self){this.tag.compile();
		var outputs=[];
		var html=this.renderHTML(args,outputs,self);
		var root;
		if(parent.nodeType==1){parent.innerHTML=html;
		root=parent.firstChild
		}else{if(!parent||parent.nodeType!=9){parent=document
		}if(!womb||womb.ownerDocument!=parent){womb=parent.createElement("div")
		}womb.innerHTML=html;
		root=womb.firstChild
		}var domArgs=[root,this.tag.context,0];
		domArgs.push.apply(domArgs,this.tag.domArgs);
		domArgs.push.apply(domArgs,outputs);
		this.tag.renderDOM.apply(self?self:this.tag.subject,domArgs);
		return root
		},append:function(args,parent,self){this.tag.compile();
		var outputs=[];
		var html=this.renderHTML(args,outputs,self);
		if(!womb||womb.ownerDocument!=parent.ownerDocument){womb=parent.ownerDocument.createElement("div")
		}womb.innerHTML=html;
		var root=womb.firstChild;
		while(womb.firstChild){parent.appendChild(womb.firstChild)
		}womb=null;
		var domArgs=[root,this.tag.context,0];
		domArgs.push.apply(domArgs,this.tag.domArgs);
		domArgs.push.apply(domArgs,outputs);
		this.tag.renderDOM.apply(self?self:this.tag.subject,domArgs);
		return root
		}};
		function defineTags(){for(var i=0;
		i<arguments.length;
		++i){var tagName=arguments[i];
		var fn=new Function("var newTag = new arguments.callee.DomplateTag('"+tagName+"'); return newTag.merge(arguments);");
		fn.DomplateTag=DomplateTag;
		var fnName=tagName.toUpperCase();
		FBL[fnName]=fn
		}}defineTags("a","button","br","canvas","code","col","colgroup","div","fieldset","form","h1","h2","h3","hr","img","input","label","legend","li","ol","optgroup","option","p","pre","select","span","strong","table","tbody","td","textarea","tfoot","th","thead","tr","tt","ul","iframe")
		})();
		var FirebugReps=FBL.ns(function(){with(FBL){var OBJECTBOX=this.OBJECTBOX=SPAN({"class":"objectBox objectBox-$className"});
		var OBJECTBLOCK=this.OBJECTBLOCK=DIV({"class":"objectBox objectBox-$className"});
		var OBJECTLINK=this.OBJECTLINK=isIE6?A({"class":"objectLink objectLink-$className a11yFocus",href:"javascript:void(0)",title:"$object|FBL.getElementXPath",_repObject:"$object"}):A({"class":"objectLink objectLink-$className a11yFocus",title:"$object|FBL.getElementXPath",_repObject:"$object"});
		this.Undefined=domplate(Firebug.Rep,{tag:OBJECTBOX("undefined"),className:"undefined",supportsObject:function(object,type){return type=="undefined"
		}});
		this.Null=domplate(Firebug.Rep,{tag:OBJECTBOX("null"),className:"null",supportsObject:function(object,type){return object==null
		}});
		this.Nada=domplate(Firebug.Rep,{tag:SPAN(""),className:"nada"});
		this.Number=domplate(Firebug.Rep,{tag:OBJECTBOX("$object"),className:"number",supportsObject:function(object,type){return type=="boolean"||type=="number"
		}});
		this.String=domplate(Firebug.Rep,{tag:OBJECTBOX("&quot;$object&quot;"),shortTag:OBJECTBOX("&quot;$object|cropString&quot;"),className:"string",supportsObject:function(object,type){return type=="string"
		}});
		this.Text=domplate(Firebug.Rep,{tag:OBJECTBOX("$object"),shortTag:OBJECTBOX("$object|cropString"),className:"text"});
		this.Caption=domplate(Firebug.Rep,{tag:SPAN({"class":"caption"},"$object")});
		this.Warning=domplate(Firebug.Rep,{tag:DIV({"class":"warning focusRow",role:"listitem"},"$object|STR")});
		this.Func=domplate(Firebug.Rep,{tag:OBJECTLINK("$object|summarizeFunction"),summarizeFunction:function(fn){var fnRegex=/function ([^(]+\([^)]*\)) \{/;
		var fnText=safeToString(fn);
		var m=fnRegex.exec(fnText);
		return m?m[1]:"function()"
		},copySource:function(fn){copyToClipboard(safeToString(fn))
		},monitor:function(fn,script,monitored){if(monitored){Firebug.Debugger.unmonitorScript(fn,script,"monitor")
		}else{Firebug.Debugger.monitorScript(fn,script,"monitor")
		}},className:"function",supportsObject:function(object,type){return isFunction(object)
		},inspectObject:function(fn,context){var sourceLink=findSourceForFunction(fn,context);
		if(sourceLink){Firebug.chrome.select(sourceLink)
		}if(FBTrace.DBG_FUNCTION_NAME){FBTrace.sysout("reps.function.inspectObject selected sourceLink is ",sourceLink)
		}},getTooltip:function(fn,context){var script=findScriptForFunctionInContext(context,fn);
		if(script){return $STRF("Line",[normalizeURL(script.fileName),script.baseLineNumber])
		}else{if(fn.toString){return fn.toString()
		}}},getTitle:function(fn,context){var name=fn.name?fn.name:"function";
		return name+"()"
		},getContextMenuItems:function(fn,target,context,script){if(!script){script=findScriptForFunctionInContext(context,fn)
		}if(!script){return
		}var scriptInfo=getSourceFileAndLineByScript(context,script);
		var monitored=scriptInfo?fbs.isMonitored(scriptInfo.sourceFile.href,scriptInfo.lineNo):false;
		var name=script?getFunctionName(script,context):fn.name;
		return[{label:"CopySource",command:bindFixed(this.copySource,this,fn)},"-",{label:$STRF("ShowCallsInConsole",[name]),nol10n:true,type:"checkbox",checked:monitored,command:bindFixed(this.monitor,this,fn,script,monitored)}]
		}});
		this.Obj=domplate(Firebug.Rep,{tag:OBJECTLINK(SPAN({"class":"objectTitle"},"$object|getTitle "),SPAN({"class":"objectProps"},SPAN({"class":"objectLeftBrace",role:"presentation"},"{"),FOR("prop","$object|propIterator",SPAN({"class":"objectPropName",role:"presentation"},"$prop.name"),SPAN({"class":"objectEqual",role:"presentation"},"$prop.equal"),TAG("$prop.tag",{object:"$prop.object"}),SPAN({"class":"objectComma",role:"presentation"},"$prop.delim")),SPAN({"class":"objectRightBrace"},"}"))),propNumberTag:SPAN({"class":"objectProp-number"},"$object"),propStringTag:SPAN({"class":"objectProp-string"},"&quot;$object&quot;"),propObjectTag:SPAN({"class":"objectProp-object"},"$object"),propIterator:function(object){var maxLength=55;
		if(!object){return[]
		}var props=[];
		var length=0;
		var numProperties=0;
		var numPropertiesShown=0;
		var maxLengthReached=false;
		var lib=this;
		var propRepsMap={"boolean":this.propNumberTag,number:this.propNumberTag,string:this.propStringTag,object:this.propObjectTag};
		try{var title=Firebug.Rep.getTitle(object);
		length+=title.length;
		for(var name in object){var value;
		try{value=object[name]
		}catch(exc){continue
		}var type=typeof(value);
		if(type=="boolean"||type=="number"||(type=="string"&&value)||(type=="object"&&value&&value.toString)){var tag=propRepsMap[type];
		var value=(type=="object")?Firebug.getRep(value).getTitle(value):value+"";
		length+=name.length+value.length+4;
		if(length<=maxLength){props.push({tag:tag,name:name,object:value,equal:"=",delim:", "});
		numPropertiesShown++
		}else{maxLengthReached=true
		}}numProperties++;
		if(maxLengthReached&&numProperties>numPropertiesShown){break
		}}if(numProperties>numPropertiesShown){props.push({object:"...",tag:FirebugReps.Caption.tag,name:"",equal:"",delim:""})
		}else{if(props.length>0){props[props.length-1].delim=""
		}}}catch(exc){}return props
		},fb_1_6_propIterator:function(object,max){max=max||3;
		if(!object){return[]
		}var props=[];
		var len=0,count=0;
		try{for(var name in object){var value;
		try{value=object[name]
		}catch(exc){continue
		}var t=typeof(value);
		if(t=="boolean"||t=="number"||(t=="string"&&value)||(t=="object"&&value&&value.toString)){var rep=Firebug.getRep(value);
		var tag=rep.shortTag||rep.tag;
		if(t=="object"){value=rep.getTitle(value);
		tag=rep.titleTag
		}count++;
		if(count<=max){props.push({tag:tag,name:name,object:value,equal:"=",delim:", "})
		}else{break
		}}}if(count>max){props[Math.max(1,max-1)]={object:"more...",tag:FirebugReps.Caption.tag,name:"",equal:"",delim:""}
		}else{if(props.length>0){props[props.length-1].delim=""
		}}}catch(exc){}return props
		},className:"object",supportsObject:function(object,type){return true
		}});
		this.Arr=domplate(Firebug.Rep,{tag:OBJECTBOX({_repObject:"$object"},SPAN({"class":"arrayLeftBracket",role:"presentation"},"["),FOR("item","$object|arrayIterator",TAG("$item.tag",{object:"$item.object"}),SPAN({"class":"arrayComma",role:"presentation"},"$item.delim")),SPAN({"class":"arrayRightBracket",role:"presentation"},"]")),shortTag:OBJECTBOX({_repObject:"$object"},SPAN({"class":"arrayLeftBracket",role:"presentation"},"["),FOR("item","$object|shortArrayIterator",TAG("$item.tag",{object:"$item.object"}),SPAN({"class":"arrayComma",role:"presentation"},"$item.delim")),SPAN({"class":"arrayRightBracket"},"]")),arrayIterator:function(array){var items=[];
		for(var i=0;
		i<array.length;
		++i){var value=array[i];
		var rep=Firebug.getRep(value);
		var tag=rep.shortTag?rep.shortTag:rep.tag;
		var delim=(i==array.length-1?"":", ");
		items.push({object:value,tag:tag,delim:delim})
		}return items
		},shortArrayIterator:function(array){var items=[];
		for(var i=0;
		i<array.length&&i<3;
		++i){var value=array[i];
		var rep=Firebug.getRep(value);
		var tag=rep.shortTag?rep.shortTag:rep.tag;
		var delim=(i==array.length-1?"":", ");
		items.push({object:value,tag:tag,delim:delim})
		}if(array.length>3){items.push({object:(array.length-3)+" more...",tag:FirebugReps.Caption.tag,delim:""})
		}return items
		},shortPropIterator:this.Obj.propIterator,getItemIndex:function(child){var arrayIndex=0;
		for(child=child.previousSibling;
		child;
		child=child.previousSibling){if(child.repObject){++arrayIndex
		}}return arrayIndex
		},className:"array",supportsObject:function(object){return this.isArray(object)
		},isArray:function(obj){try{if(!obj){return false
		}else{if(isIE&&!isFunction(obj)&&typeof obj=="object"&&isFinite(obj.length)&&obj.nodeType!=8){return true
		}else{if(isFinite(obj.length)&&isFunction(obj.splice)){return true
		}else{if(isFinite(obj.length)&&isFunction(obj.callee)){return true
		}else{if(instanceOf(obj,"HTMLCollection")){return true
		}else{if(instanceOf(obj,"NodeList")){return true
		}else{return false
		}}}}}}}catch(exc){if(FBTrace.DBG_ERRORS){FBTrace.sysout("isArray FAILS:",exc);
		FBTrace.sysout("isArray Fails on obj",obj)
		}}return false
		},getTitle:function(object,context){return"["+object.length+"]"
		}});
		this.Property=domplate(Firebug.Rep,{supportsObject:function(object){return object instanceof Property
		},getRealObject:function(prop,context){return prop.object[prop.name]
		},getTitle:function(prop,context){return prop.name
		}});
		this.NetFile=domplate(this.Obj,{supportsObject:function(object){return object instanceof Firebug.NetFile
		},browseObject:function(file,context){openNewTab(file.href);
		return true
		},getRealObject:function(file,context){return null
		}});
		this.Except=domplate(Firebug.Rep,{tag:OBJECTBOX({_repObject:"$object"},"$object.message"),className:"exception",supportsObject:function(object){return object instanceof ErrorCopy
		}});
		this.Element=domplate(Firebug.Rep,{tag:OBJECTLINK("&lt;",SPAN({"class":"nodeTag"},"$object.nodeName|toLowerCase"),FOR("attr","$object|attrIterator","&nbsp;$attr.nodeName=&quot;",SPAN({"class":"nodeValue"},"$attr.nodeValue"),"&quot;"),"&gt;"),shortTag:OBJECTLINK(SPAN({"class":"$object|getVisible"},SPAN({"class":"selectorTag"},"$object|getSelectorTag"),SPAN({"class":"selectorId"},"$object|getSelectorId"),SPAN({"class":"selectorClass"},"$object|getSelectorClass"),SPAN({"class":"selectorValue"},"$object|getValue"))),getVisible:function(elt){return isVisible(elt)?"":"selectorHidden"
		},getSelectorTag:function(elt){return elt.nodeName.toLowerCase()
		},getSelectorId:function(elt){return elt.id?"#"+elt.id:""
		},getSelectorClass:function(elt){return elt.className?"."+elt.className.split(" ")[0]:""
		},getValue:function(elt){return"";
		var value;
		if(elt instanceof HTMLImageElement){value=getFileName(elt.src)
		}else{if(elt instanceof HTMLAnchorElement){value=getFileName(elt.href)
		}else{if(elt instanceof HTMLInputElement){value=elt.value
		}else{if(elt instanceof HTMLFormElement){value=getFileName(elt.action)
		}else{if(elt instanceof HTMLScriptElement){value=getFileName(elt.src)
		}}}}}return value?" "+cropString(value,20):""
		},attrIterator:function(elt){var attrs=[];
		var idAttr,classAttr;
		if(elt.attributes){for(var i=0;
		i<elt.attributes.length;
		++i){var attr=elt.attributes[i];
		if(!attr.specified||attr.nodeName&&attr.nodeName.indexOf("firebug-")!=-1){continue
		}else{if(attr.nodeName=="id"){idAttr=attr
		}else{if(attr.nodeName=="class"){classAttr=attr
		}else{if(attr.nodeName=="style"){attrs.push({nodeName:attr.nodeName,nodeValue:attr.nodeValue||elt.style.cssText.replace(/([^\s]+)\s*:/g,function(m,g){return g.toLowerCase()+":"
		})})
		}else{attrs.push(attr)
		}}}}}}if(classAttr){attrs.splice(0,0,classAttr)
		}if(idAttr){attrs.splice(0,0,idAttr)
		}return attrs
		},shortAttrIterator:function(elt){var attrs=[];
		if(elt.attributes){for(var i=0;
		i<elt.attributes.length;
		++i){var attr=elt.attributes[i];
		if(attr.nodeName=="id"||attr.nodeName=="class"){attrs.push(attr)
		}}}return attrs
		},getHidden:function(elt){return isVisible(elt)?"":"nodeHidden"
		},getXPath:function(elt){return getElementTreeXPath(elt)
		},getNodeText:function(element){var text=element.textContent;
		if(Firebug.showFullTextNodes){return text
		}else{return cropString(text,50)
		}},getNodeTextGroups:function(element){var text=element.textContent;
		if(!Firebug.showFullTextNodes){text=cropString(text,50)
		}var escapeGroups=[];
		if(Firebug.showTextNodesWithWhitespace){escapeGroups.push({group:"whitespace","class":"nodeWhiteSpace",extra:{"\t":"_Tab","\n":"_Para"," ":"_Space"}})
		}if(Firebug.showTextNodesWithEntities){escapeGroups.push({group:"text","class":"nodeTextEntity",extra:{}})
		}if(escapeGroups.length){return escapeGroupsForEntities(text,escapeGroups)
		}else{return[{str:text,"class":"",extra:""}]
		}},copyHTML:function(elt){var html=getElementXML(elt);
		copyToClipboard(html)
		},copyInnerHTML:function(elt){copyToClipboard(elt.innerHTML)
		},copyXPath:function(elt){var xpath=getElementXPath(elt);
		copyToClipboard(xpath)
		},persistor:function(context,xpath){var elts=xpath?getElementsByXPath(context.window.document,xpath):null;
		return elts&&elts.length?elts[0]:null
		},className:"element",supportsObject:function(object){return instanceOf(object,"Element")
		},browseObject:function(elt,context){var tag=elt.nodeName.toLowerCase();
		if(tag=="script"){openNewTab(elt.src)
		}else{if(tag=="link"){openNewTab(elt.href)
		}else{if(tag=="a"){openNewTab(elt.href)
		}else{if(tag=="img"){openNewTab(elt.src)
		}}}}return true
		},persistObject:function(elt,context){var xpath=getElementXPath(elt);
		return bind(this.persistor,top,xpath)
		},getTitle:function(element,context){return getElementCSSSelector(element)
		},getTooltip:function(elt){return this.getXPath(elt)
		},getContextMenuItems:function(elt,target,context){var monitored=areEventsMonitored(elt,null,context);
		return[{label:"CopyHTML",command:bindFixed(this.copyHTML,this,elt)},{label:"CopyInnerHTML",command:bindFixed(this.copyInnerHTML,this,elt)},{label:"CopyXPath",command:bindFixed(this.copyXPath,this,elt)},"-",{label:"ShowEventsInConsole",type:"checkbox",checked:monitored,command:bindFixed(toggleMonitorEvents,FBL,elt,null,monitored,context)},"-",{label:"ScrollIntoView",command:bindFixed(elt.scrollIntoView,elt)}]
		}});
		this.TextNode=domplate(Firebug.Rep,{tag:OBJECTLINK("&lt;",SPAN({"class":"nodeTag"},"TextNode"),"&nbsp;textContent=&quot;",SPAN({"class":"nodeValue"},"$object.textContent|cropString"),"&quot;","&gt;"),className:"textNode",supportsObject:function(object){return object instanceof Text
		}});
		this.Document=domplate(Firebug.Rep,{tag:OBJECTLINK("Document ",SPAN({"class":"objectPropValue"},"$object|getLocation")),getLocation:function(doc){return doc.location?getFileName(doc.location.href):""
		},className:"object",supportsObject:function(object){return instanceOf(object,"Document")
		},browseObject:function(doc,context){openNewTab(doc.location.href);
		return true
		},persistObject:function(doc,context){return this.persistor
		},persistor:function(context){return context.window.document
		},getTitle:function(win,context){return"document"
		},getTooltip:function(doc){return doc.location.href
		}});
		this.StyleSheet=domplate(Firebug.Rep,{tag:OBJECTLINK("StyleSheet ",SPAN({"class":"objectPropValue"},"$object|getLocation")),getLocation:function(styleSheet){return getFileName(styleSheet.href)
		},copyURL:function(styleSheet){copyToClipboard(styleSheet.href)
		},openInTab:function(styleSheet){openNewTab(styleSheet.href)
		},className:"object",supportsObject:function(object){return instanceOf(object,"CSSStyleSheet")
		},browseObject:function(styleSheet,context){openNewTab(styleSheet.href);
		return true
		},persistObject:function(styleSheet,context){return bind(this.persistor,top,styleSheet.href)
		},getTooltip:function(styleSheet){return styleSheet.href
		},getContextMenuItems:function(styleSheet,target,context){return[{label:"CopyLocation",command:bindFixed(this.copyURL,this,styleSheet)},"-",{label:"OpenInTab",command:bindFixed(this.openInTab,this,styleSheet)}]
		},persistor:function(context,href){return getStyleSheetByHref(href,context)
		}});
		this.Window=domplate(Firebug.Rep,{tag:OBJECTLINK("Window ",SPAN({"class":"objectPropValue"},"$object|getLocation")),getLocation:function(win){try{return(win&&win.location&&!win.closed)?getFileName(win.location.href):""
		}catch(exc){if(FBTrace.DBG_ERRORS){FBTrace.sysout("reps.Window window closed?")
		}}},className:"object",supportsObject:function(object){return instanceOf(object,"Window")
		},browseObject:function(win,context){openNewTab(win.location.href);
		return true
		},persistObject:function(win,context){return this.persistor
		},persistor:function(context){return context.window
		},getTitle:function(win,context){return"window"
		},getTooltip:function(win){if(win&&!win.closed){return win.location.href
		}}});
		this.Event=domplate(Firebug.Rep,{tag:TAG("$copyEventTag",{object:"$object|copyEvent"}),copyEventTag:OBJECTLINK("$object|summarizeEvent"),summarizeEvent:function(event){var info=[event.type," "];
		var eventFamily=getEventFamily(event.type);
		if(eventFamily=="mouse"){info.push("clientX=",event.clientX,", clientY=",event.clientY)
		}else{if(eventFamily=="key"){info.push("charCode=",event.charCode,", keyCode=",event.keyCode)
		}}return info.join("")
		},copyEvent:function(event){return new EventCopy(event)
		},className:"object",supportsObject:function(object){return instanceOf(object,"Event")||instanceOf(object,"EventCopy")
		},getTitle:function(event,context){return"Event "+event.type
		}});
		this.SourceLink=domplate(Firebug.Rep,{tag:OBJECTLINK({$collapsed:"$object|hideSourceLink"},"$object|getSourceLinkTitle"),hideSourceLink:function(sourceLink){return sourceLink?sourceLink.href.indexOf("XPCSafeJSObjectWrapper")!=-1:true
		},getSourceLinkTitle:function(sourceLink){if(!sourceLink){return""
		}try{var fileName=getFileName(sourceLink.href);
		fileName=decodeURIComponent(fileName);
		fileName=cropString(fileName,17)
		}catch(exc){if(FBTrace.DBG_ERRORS){FBTrace.sysout("reps.getSourceLinkTitle decodeURIComponent fails for '"+fileName+"': "+exc,exc)
		}}return typeof sourceLink.line=="number"?fileName+" (line "+sourceLink.line+")":fileName
		},copyLink:function(sourceLink){copyToClipboard(sourceLink.href)
		},openInTab:function(sourceLink){openNewTab(sourceLink.href)
		},className:"sourceLink",supportsObject:function(object){return object instanceof SourceLink
		},getTooltip:function(sourceLink){return decodeURI(sourceLink.href)
		},inspectObject:function(sourceLink,context){if(sourceLink.type=="js"){var scriptFile=getSourceFileByHref(sourceLink.href,context);
		if(scriptFile){return Firebug.chrome.select(sourceLink)
		}}else{if(sourceLink.type=="css"){if(sourceLink.object){Firebug.chrome.select(sourceLink.object);
		return
		}var stylesheet=getStyleSheetByHref(sourceLink.href,context);
		if(stylesheet){var ownerNode=stylesheet.ownerNode;
		if(ownerNode){Firebug.chrome.select(sourceLink,"html");
		return
		}var panel=context.getPanel("stylesheet");
		if(panel&&panel.getRuleByLine(stylesheet,sourceLink.line)){return Firebug.chrome.select(sourceLink)
		}}}}viewSource(sourceLink.href,sourceLink.line)
		},browseObject:function(sourceLink,context){openNewTab(sourceLink.href);
		return true
		},getContextMenuItems:function(sourceLink,target,context){return[{label:"CopyLocation",command:bindFixed(this.copyLink,this,sourceLink)},"-",{label:"OpenInTab",command:bindFixed(this.openInTab,this,sourceLink)}]
		}});
		this.SourceFile=domplate(this.SourceLink,{tag:OBJECTLINK({$collapsed:"$object|hideSourceLink"},"$object|getSourceLinkTitle"),persistor:function(context,href){return getSourceFileByHref(href,context)
		},className:"sourceFile",supportsObject:function(object){return object instanceof SourceFile
		},persistObject:function(sourceFile){return bind(this.persistor,top,sourceFile.href)
		},browseObject:function(sourceLink,context){},getTooltip:function(sourceFile){return sourceFile.href
		}});
		this.StackFrame=domplate(Firebug.Rep,{tag:OBJECTBLOCK(A({"class":"objectLink objectLink-function focusRow a11yFocus",_repObject:"$object.fn"},"$object|getCallName")," ( ",FOR("arg","$object|argIterator",TAG("$arg.tag",{object:"$arg.value"}),SPAN({"class":"arrayComma"},"$arg.delim"))," )",SPAN({"class":"objectLink-sourceLink objectLink"},"$object|getSourceLinkTitle")),getCallName:function(frame){return frame.name||"anonymous"
		},getSourceLinkTitle:function(frame){var fileName=cropString(getFileName(frame.href),20);
		return fileName+(frame.lineNo?" (line "+frame.lineNo+")":"");
		var fileName=cropString(getFileName(frame.href),17);
		return $STRF("Line",[fileName,frame.lineNo])
		},argIterator:function(frame){if(!frame.args){return[]
		}var items=[];
		for(var i=0;
		i<frame.args.length;
		++i){var arg=frame.args[i];
		if(!arg){break
		}var rep=Firebug.getRep(arg.value);
		var tag=rep.shortTag?rep.shortTag:rep.tag;
		var delim=(i==frame.args.length-1?"":", ");
		items.push({name:arg.name,value:arg.value,tag:tag,delim:delim})
		}return items
		},className:"stackFrame",supportsObject:function(object){return object instanceof StackFrame
		},inspectObject:function(stackFrame,context){var sourceLink=new SourceLink(stackFrame.href,stackFrame.lineNo,"js");
		Firebug.chrome.select(sourceLink)
		},getTooltip:function(stackFrame,context){return $STRF("Line",[stackFrame.href,stackFrame.lineNo])
		}});
		this.StackTrace=domplate(Firebug.Rep,{tag:FOR("frame","$object.frames focusRow",TAG(this.StackFrame.tag,{object:"$frame"})),className:"stackTrace",supportsObject:function(object){return object instanceof StackTrace
		}});
		this.jsdStackFrame=domplate(Firebug.Rep,{inspectable:false,supportsObject:function(object){return(object instanceof jsdIStackFrame)&&(object.isValid)
		},getTitle:function(frame,context){if(!frame.isValid){return"(invalid frame)"
		}return getFunctionName(frame.script,context)
		},getTooltip:function(frame,context){if(!frame.isValid){return"(invalid frame)"
		}var sourceInfo=FBL.getSourceFileAndLineByScript(context,frame.script,frame);
		if(sourceInfo){return $STRF("Line",[sourceInfo.sourceFile.href,sourceInfo.lineNo])
		}else{return $STRF("Line",[frame.script.fileName,frame.line])
		}},getContextMenuItems:function(frame,target,context){var fn=frame.script.functionObject.getWrappedValue();
		return FirebugReps.Func.getContextMenuItems(fn,target,context,frame.script)
		}});
		this.ErrorMessage=domplate(Firebug.Rep,{tag:OBJECTBOX({$hasTwisty:"$object|hasStackTrace",$hasBreakSwitch:"$object|hasBreakSwitch",$breakForError:"$object|hasErrorBreak",_repObject:"$object",_stackTrace:"$object|getLastErrorStackTrace",onclick:"$onToggleError"},DIV({"class":"errorTitle a11yFocus",role:"checkbox","aria-checked":"false"},"$object.message|getMessage"),DIV({"class":"errorTrace"}),DIV({"class":"errorSourceBox errorSource-$object|getSourceType"},IMG({"class":"errorBreak a11yFocus",src:"blank.gif",role:"checkbox","aria-checked":"false",title:"Break on this error"}),A({"class":"errorSource a11yFocus"},"$object|getLine")),TAG(this.SourceLink.tag,{object:"$object|getSourceLink"})),getLastErrorStackTrace:function(error){return error.trace
		},hasStackTrace:function(error){var url=error.href.toString();
		var fromCommandLine=(url.indexOf("XPCSafeJSObjectWrapper")!=-1);
		return !fromCommandLine&&error.trace
		},hasBreakSwitch:function(error){return error.href&&error.lineNo>0
		},hasErrorBreak:function(error){return fbs.hasErrorBreakpoint(error.href,error.lineNo)
		},getMessage:function(message){var re=/\[Exception... "(.*?)" nsresult:/;
		var m=re.exec(message);
		return m?m[1]:message
		},getLine:function(error){if(error.category=="js"){if(error.source){return cropString(error.source,80)
		}else{if(error.href&&error.href.indexOf("XPCSafeJSObjectWrapper")==-1){return cropString(error.getSourceLine(),80)
		}}}},getSourceLink:function(error){var ext=error.category=="css"?"css":"js";
		return error.lineNo?new SourceLink(error.href,error.lineNo,ext):null
		},getSourceType:function(error){if(error.source){return"syntax"
		}else{if(error.lineNo==1&&getFileExtension(error.href)!="js"){return"none"
		}else{if(error.category=="css"){return"none"
		}else{if(!error.href||!error.lineNo){return"none"
		}else{return"exec"
		}}}}},onToggleError:function(event){var target=event.currentTarget;
		if(hasClass(event.target,"errorBreak")){this.breakOnThisError(target.repObject)
		}else{if(hasClass(event.target,"errorSource")){var panel=Firebug.getElementPanel(event.target);
		this.inspectObject(target.repObject,panel.context)
		}else{if(hasClass(event.target,"errorTitle")){var traceBox=target.childNodes[1];
		toggleClass(target,"opened");
		event.target.setAttribute("aria-checked",hasClass(target,"opened"));
		if(hasClass(target,"opened")){if(target.stackTrace){var node=FirebugReps.StackTrace.tag.append({object:target.stackTrace},traceBox)
		}if(Firebug.A11yModel.enabled){var panel=Firebug.getElementPanel(event.target);
		dispatch([Firebug.A11yModel],"onLogRowContentCreated",[panel,traceBox])
		}}else{clearNode(traceBox)
		}}}}},copyError:function(error){var message=[this.getMessage(error.message),error.href,"Line "+error.lineNo];
		copyToClipboard(message.join("\n"))
		},breakOnThisError:function(error){if(this.hasErrorBreak(error)){Firebug.Debugger.clearErrorBreakpoint(error.href,error.lineNo)
		}else{Firebug.Debugger.setErrorBreakpoint(error.href,error.lineNo)
		}},className:"errorMessage",inspectable:false,supportsObject:function(object){return object instanceof ErrorMessage
		},inspectObject:function(error,context){var sourceLink=this.getSourceLink(error);
		FirebugReps.SourceLink.inspectObject(sourceLink,context)
		},getContextMenuItems:function(error,target,context){var breakOnThisError=this.hasErrorBreak(error);
		var items=[{label:"CopyError",command:bindFixed(this.copyError,this,error)}];
		if(error.category=="css"){items.push("-",{label:"BreakOnThisError",type:"checkbox",checked:breakOnThisError,command:bindFixed(this.breakOnThisError,this,error)},optionMenu("BreakOnAllErrors","breakOnErrors"))
		}return items
		}});
		this.Assert=domplate(Firebug.Rep,{tag:DIV(DIV({"class":"errorTitle"}),DIV({"class":"assertDescription"})),className:"assert",inspectObject:function(error,context){var sourceLink=this.getSourceLink(error);
		Firebug.chrome.select(sourceLink)
		},getContextMenuItems:function(error,target,context){var breakOnThisError=this.hasErrorBreak(error);
		return[{label:"CopyError",command:bindFixed(this.copyError,this,error)},"-",{label:"BreakOnThisError",type:"checkbox",checked:breakOnThisError,command:bindFixed(this.breakOnThisError,this,error)},{label:"BreakOnAllErrors",type:"checkbox",checked:Firebug.breakOnErrors,command:bindFixed(this.breakOnAllErrors,this,error)}]
		}});
		this.SourceText=domplate(Firebug.Rep,{tag:DIV(FOR("line","$object|lineIterator",DIV({"class":"sourceRow",role:"presentation"},SPAN({"class":"sourceLine",role:"presentation"},"$line.lineNo"),SPAN({"class":"sourceRowText",role:"presentation"},"$line.text")))),lineIterator:function(sourceText){var maxLineNoChars=(sourceText.lines.length+"").length;
		var list=[];
		for(var i=0;
		i<sourceText.lines.length;
		++i){var lineNo=(i+1)+"";
		while(lineNo.length<maxLineNoChars){lineNo=" "+lineNo
		}list.push({lineNo:lineNo,text:sourceText.lines[i]})
		}return list
		},getHTML:function(sourceText){return getSourceLineRange(sourceText,1,sourceText.lines.length)
		}});
		this.nsIDOMHistory=domplate(Firebug.Rep,{tag:OBJECTBOX({onclick:"$showHistory"},OBJECTLINK("$object|summarizeHistory")),className:"nsIDOMHistory",summarizeHistory:function(history){try{var items=history.length;
		return items+" history entries"
		}catch(exc){return"object does not support history (nsIDOMHistory)"
		}},showHistory:function(history){try{var items=history.length;
		Firebug.chrome.select(history)
		}catch(exc){}},supportsObject:function(object,type){return(object instanceof Ci.nsIDOMHistory)
		}});
		this.ApplicationCache=domplate(Firebug.Rep,{tag:OBJECTBOX({onclick:"$showApplicationCache"},OBJECTLINK("$object|summarizeCache")),summarizeCache:function(applicationCache){try{return applicationCache.length+" items in offline cache"
		}catch(exc){return"https://bugzilla.mozilla.org/show_bug.cgi?id=422264"
		}},showApplicationCache:function(event){openNewTab("https://bugzilla.mozilla.org/show_bug.cgi?id=422264")
		},className:"applicationCache",supportsObject:function(object,type){if(Ci.nsIDOMOfflineResourceList){return(object instanceof Ci.nsIDOMOfflineResourceList)
		}}});
		this.Storage=domplate(Firebug.Rep,{tag:OBJECTBOX({onclick:"$show"},OBJECTLINK("$object|summarize")),summarize:function(storage){return storage.length+" items in Storage"
		},show:function(storage){openNewTab("http://dev.w3.org/html5/webstorage/#storage-0")
		},className:"Storage",supportsObject:function(object,type){return(object instanceof Storage)
		}});
		Firebug.registerRep(this.Undefined,this.Null,this.Number,this.String,this.Window,this.Element,this.Document,this.StyleSheet,this.Event,this.Property,this.Except,this.Arr);
		Firebug.setDefaultReps(this.Func,this.Obj)
		}});
		FBL.ns(function(){with(FBL){var saveTimeout=400;
		var pageAmount=10;
		var currentTarget=null;
		var currentGroup=null;
		var currentPanel=null;
		var currentEditor=null;
		var defaultEditor=null;
		var originalClassName=null;
		var originalValue=null;
		var defaultValue=null;
		var previousValue=null;
		var invalidEditor=false;
		var ignoreNextInput=false;
		Firebug.Editor=extend(Firebug.Module,{supportsStopEvent:true,dispatchName:"editor",tabCharacter:"    ",startEditing:function(target,value,editor){this.stopEditing();
		if(hasClass(target,"insertBefore")||hasClass(target,"insertAfter")){return
		}var panel=Firebug.getElementPanel(target);
		if(!panel.editable){return
		}if(FBTrace.DBG_EDITOR){FBTrace.sysout("editor.startEditing "+value,target)
		}defaultValue=target.getAttribute("defaultValue");
		if(value==undefined){var textContent=isIE?"innerText":"textContent";
		value=target[textContent];
		if(value==defaultValue){value=""
		}}originalValue=previousValue=value;
		invalidEditor=false;
		currentTarget=target;
		currentPanel=panel;
		currentGroup=getAncestorByClass(target,"editGroup");
		currentPanel.editing=true;
		var panelEditor=currentPanel.getEditor(target,value);
		currentEditor=editor?editor:panelEditor;
		if(!currentEditor){currentEditor=getDefaultEditor(currentPanel)
		}var inlineParent=getInlineParent(target);
		var targetSize=getOffsetSize(inlineParent);
		setClass(panel.panelNode,"editing");
		setClass(target,"editing");
		if(currentGroup){setClass(currentGroup,"editing")
		}currentEditor.show(target,currentPanel,value,targetSize);
		currentEditor.beginEditing(target,value);
		if(FBTrace.DBG_EDITOR){FBTrace.sysout("Editor start panel "+currentPanel.name)
		}this.attachListeners(currentEditor,panel.context)
		},stopEditing:function(cancel){if(!currentTarget){return
		}if(FBTrace.DBG_EDITOR){FBTrace.sysout("editor.stopEditing cancel:"+cancel+" saveTimeout: "+this.saveTimeout)
		}clearTimeout(this.saveTimeout);
		delete this.saveTimeout;
		this.detachListeners(currentEditor,currentPanel.context);
		removeClass(currentPanel.panelNode,"editing");
		removeClass(currentTarget,"editing");
		if(currentGroup){removeClass(currentGroup,"editing")
		}var value=currentEditor.getValue();
		if(value==defaultValue){value=""
		}var removeGroup=currentEditor.endEditing(currentTarget,value,cancel);
		try{if(cancel){if(value!=originalValue){this.saveEditAndNotifyListeners(currentTarget,originalValue,previousValue)
		}if(removeGroup&&!originalValue&&currentGroup){currentGroup.parentNode.removeChild(currentGroup)
		}}else{if(!value){this.saveEditAndNotifyListeners(currentTarget,null,previousValue);
		if(removeGroup&&currentGroup){currentGroup.parentNode.removeChild(currentGroup)
		}}else{this.save(value)
		}}}catch(exc){}currentEditor.hide();
		currentPanel.editing=false;
		currentTarget=null;
		currentGroup=null;
		currentPanel=null;
		currentEditor=null;
		originalValue=null;
		invalidEditor=false;
		return value
		},cancelEditing:function(){return this.stopEditing(true)
		},update:function(saveNow){if(this.saveTimeout){clearTimeout(this.saveTimeout)
		}invalidEditor=true;
		currentEditor.layout();
		if(saveNow){this.save()
		}else{var context=currentPanel.context;
		this.saveTimeout=context.setTimeout(bindFixed(this.save,this),saveTimeout);
		if(FBTrace.DBG_EDITOR){FBTrace.sysout("editor.update saveTimeout: "+this.saveTimeout)
		}}},save:function(value){if(!invalidEditor){return
		}if(value==undefined){value=currentEditor.getValue()
		}if(FBTrace.DBG_EDITOR){FBTrace.sysout("editor.save saveTimeout: "+this.saveTimeout+" currentPanel: "+(currentPanel?currentPanel.name:"null"))
		}try{this.saveEditAndNotifyListeners(currentTarget,value,previousValue);
		previousValue=value;
		invalidEditor=false
		}catch(exc){if(FBTrace.DBG_ERRORS){FBTrace.sysout("editor.save FAILS "+exc,exc)
		}}},saveEditAndNotifyListeners:function(currentTarget,value,previousValue){currentEditor.saveEdit(currentTarget,value,previousValue)
		},setEditTarget:function(element){if(!element){dispatch([Firebug.A11yModel],"onInlineEditorClose",[currentPanel,currentTarget,true]);
		this.stopEditing()
		}else{if(hasClass(element,"insertBefore")){this.insertRow(element,"before")
		}else{if(hasClass(element,"insertAfter")){this.insertRow(element,"after")
		}else{this.startEditing(element)
		}}}},tabNextEditor:function(){if(!currentTarget){return
		}var value=currentEditor.getValue();
		var nextEditable=currentTarget;
		do{nextEditable=!value&&currentGroup?getNextOutsider(nextEditable,currentGroup):getNextByClass(nextEditable,"editable")
		}while(nextEditable&&!nextEditable.offsetHeight);
		this.setEditTarget(nextEditable)
		},tabPreviousEditor:function(){if(!currentTarget){return
		}var value=currentEditor.getValue();
		var prevEditable=currentTarget;
		do{prevEditable=!value&&currentGroup?getPreviousOutsider(prevEditable,currentGroup):getPreviousByClass(prevEditable,"editable")
		}while(prevEditable&&!prevEditable.offsetHeight);
		this.setEditTarget(prevEditable)
		},insertRow:function(relative,insertWhere){var group=relative||getAncestorByClass(currentTarget,"editGroup")||currentTarget;
		var value=this.stopEditing();
		currentPanel=Firebug.getElementPanel(group);
		currentEditor=currentPanel.getEditor(group,value);
		if(!currentEditor){currentEditor=getDefaultEditor(currentPanel)
		}currentGroup=currentEditor.insertNewRow(group,insertWhere);
		if(!currentGroup){return
		}var editable=hasClass(currentGroup,"editable")?currentGroup:getNextByClass(currentGroup,"editable");
		if(editable){this.setEditTarget(editable)
		}},insertRowForObject:function(relative){var container=getAncestorByClass(relative,"insertInto");
		if(container){relative=getChildByClass(container,"insertBefore");
		if(relative){this.insertRow(relative,"before")
		}}},attachListeners:function(editor,context){var win=isIE?currentTarget.ownerDocument.parentWindow:currentTarget.ownerDocument.defaultView;
		addEvent(win,"resize",this.onResize);
		addEvent(win,"blur",this.onBlur);
		var chrome=Firebug.chrome;
		this.listeners=[chrome.keyCodeListen("ESCAPE",null,bind(this.cancelEditing,this))];
		if(editor.arrowCompletion){this.listeners.push(chrome.keyCodeListen("UP",null,bindFixed(editor.completeValue,editor,-1)),chrome.keyCodeListen("DOWN",null,bindFixed(editor.completeValue,editor,1)),chrome.keyCodeListen("PAGE_UP",null,bindFixed(editor.completeValue,editor,-pageAmount)),chrome.keyCodeListen("PAGE_DOWN",null,bindFixed(editor.completeValue,editor,pageAmount)))
		}if(currentEditor.tabNavigation){this.listeners.push(chrome.keyCodeListen("RETURN",null,bind(this.tabNextEditor,this)),chrome.keyCodeListen("RETURN",isControl,bind(this.insertRow,this,null,"after")),chrome.keyCodeListen("TAB",null,bind(this.tabNextEditor,this)),chrome.keyCodeListen("TAB",isShift,bind(this.tabPreviousEditor,this)))
		}else{if(currentEditor.multiLine){this.listeners.push(chrome.keyCodeListen("TAB",null,insertTab))
		}else{this.listeners.push(chrome.keyCodeListen("RETURN",null,bindFixed(this.stopEditing,this)));
		if(currentEditor.tabCompletion){this.listeners.push(chrome.keyCodeListen("TAB",null,bind(editor.completeValue,editor,1)),chrome.keyCodeListen("TAB",isShift,bind(editor.completeValue,editor,-1)))
		}}}},detachListeners:function(editor,context){if(!this.listeners){return
		}var win=isIE?currentTarget.ownerDocument.parentWindow:currentTarget.ownerDocument.defaultView;
		removeEvent(win,"resize",this.onResize);
		removeEvent(win,"blur",this.onBlur);
		var chrome=Firebug.chrome;
		if(chrome){for(var i=0;
		i<this.listeners.length;
		++i){chrome.keyIgnore(this.listeners[i])
		}}delete this.listeners
		},onResize:function(event){currentEditor.layout(true)
		},onBlur:function(event){if(currentEditor.enterOnBlur&&isAncestor(event.target,currentEditor.box)){this.stopEditing()
		}},initialize:function(){Firebug.Module.initialize.apply(this,arguments);
		this.onResize=bindFixed(this.onResize,this);
		this.onBlur=bind(this.onBlur,this)
		},disable:function(){this.stopEditing()
		},showContext:function(browser,context){this.stopEditing()
		},showPanel:function(browser,panel){this.stopEditing()
		}});
		Firebug.BaseEditor=extend(Firebug.MeasureBox,{getValue:function(){},setValue:function(value){},show:function(target,panel,value,textSize,targetSize){},hide:function(){},layout:function(forceAll){},getContextMenuItems:function(target){var items=[];
		items.push({label:"Cut",commandID:"cmd_cut"});
		items.push({label:"Copy",commandID:"cmd_copy"});
		items.push({label:"Paste",commandID:"cmd_paste"});
		return items
		},beginEditing:function(target,value){},saveEdit:function(target,value,previousValue){},endEditing:function(target,value,cancel){return true
		},insertNewRow:function(target,insertWhere){}});
		var inlineEditorAttributes={"class":"textEditorInner",type:"text",spellcheck:"false",onkeypress:"$onKeyPress",onoverflow:"$onOverflow",oncontextmenu:"$onContextMenu"};
		if(isIE){inlineEditorAttributes.onpropertychange="$onInput";
		inlineEditorAttributes.onkeydown="$onKeyDown"
		}else{inlineEditorAttributes.oninput="$onInput"
		}Firebug.InlineEditor=function(doc){this.initializeInline(doc)
		};
		Firebug.InlineEditor.prototype=domplate(Firebug.BaseEditor,{enterOnBlur:true,outerMargin:8,shadowExpand:7,tag:DIV({"class":"inlineEditor"},DIV({"class":"textEditorTop1"},DIV({"class":"textEditorTop2"})),DIV({"class":"textEditorInner1"},DIV({"class":"textEditorInner2"},INPUT(inlineEditorAttributes))),DIV({"class":"textEditorBottom1"},DIV({"class":"textEditorBottom2"}))),inputTag:INPUT({"class":"textEditorInner",type:"text",onkeypress:"$onKeyPress",onoverflow:"$onOverflow"}),expanderTag:IMG({"class":"inlineExpander",src:"blank.gif"}),initialize:function(){this.fixedWidth=false;
		this.completeAsYouType=true;
		this.tabNavigation=true;
		this.multiLine=false;
		this.tabCompletion=false;
		this.arrowCompletion=true;
		this.noWrap=true;
		this.numeric=false
		},destroy:function(){this.destroyInput()
		},initializeInline:function(doc){if(FBTrace.DBG_EDITOR){FBTrace.sysout("Firebug.InlineEditor initializeInline()")
		}this.box=this.tag.append({},doc.body,this);
		this.input=this.box.getElementsByTagName("input")[0];
		if(isIElt8){this.input.style.top="-8px"
		}this.expander=this.expanderTag.replace({},doc,this);
		this.initialize()
		},destroyInput:function(){},getValue:function(){return this.input.value
		},setValue:function(value){return this.input.value=stripNewLines(value)
		},show:function(target,panel,value,targetSize){this.target=target;
		this.panel=panel;
		this.targetSize=targetSize;
		var innerHTML=target.innerHTML;
		var isEmptyElement=!innerHTML;
		if(isEmptyElement){target.innerHTML="."
		}this.targetOffset={x:target.offsetLeft,y:target.offsetTop};
		if(isEmptyElement){target.innerHTML=innerHTML
		}this.originalClassName=this.box.className;
		var classNames=target.className.split(" ");
		for(var i=0;
		i<classNames.length;
		++i){setClass(this.box,"editor-"+classNames[i])
		}copyTextStyles(target,this.box);
		this.setValue(value);
		if(this.fixedWidth){this.updateLayout(true)
		}else{this.startMeasuring(target);
		this.textSize=this.measureInputText(value);
		var parent=this.input.parentNode;
		if(hasClass(parent,"textEditorInner2")){var yDiff=this.textSize.height-this.shadowExpand;
		if(isIE6){yDiff-=2
		}parent.style.height=yDiff+"px";
		parent.parentNode.style.height=yDiff+"px"
		}this.updateLayout(true)
		}this.getAutoCompleter().reset();
		if(isIElt8){panel.panelNode.appendChild(this.box)
		}else{target.offsetParent.appendChild(this.box)
		}if(isIE){this.input.style.fontFamily="Monospace";
		this.input.style.fontSize="11px"
		}if(!this.fixedWidth){copyBoxStyles(target,this.expander);
		target.parentNode.replaceChild(this.expander,target);
		collapse(target,true);
		this.expander.parentNode.insertBefore(target,this.expander)
		}this.box.style.display="block";
		var self=this;
		setTimeout(function(){self.input.focus();
		self.input.select()
		},0)
		},hide:function(){this.box.className=this.originalClassName;
		if(!this.fixedWidth){this.stopMeasuring();
		collapse(this.target,false);
		if(this.expander.parentNode){this.expander.parentNode.removeChild(this.expander)
		}}if(this.box.parentNode){this.input.blur();
		this.box.parentNode.removeChild(this.box)
		}delete this.target;
		delete this.panel
		},layout:function(forceAll){if(!this.fixedWidth){this.textSize=this.measureInputText(this.input.value)
		}if(forceAll){this.targetOffset=getClientOffset(this.expander)
		}this.updateLayout(false,forceAll)
		},beginEditing:function(target,value){},saveEdit:function(target,value,previousValue){},endEditing:function(target,value,cancel){return true
		},insertNewRow:function(target,insertWhere){},advanceToNext:function(target,charCode){return false
		},getAutoCompleteRange:function(value,offset){},getAutoCompleteList:function(preExpr,expr,postExpr){},getAutoCompleter:function(){if(!this.autoCompleter){this.autoCompleter=new Firebug.AutoCompleter(null,bind(this.getAutoCompleteRange,this),bind(this.getAutoCompleteList,this),true,false)
		}return this.autoCompleter
		},completeValue:function(amt){var selectRangeCallback=this.getAutoCompleter().complete(currentPanel.context,this.input,true,amt<0);
		if(selectRangeCallback){Firebug.Editor.update(true);
		if(isSafari){setTimeout(selectRangeCallback,0)
		}else{selectRangeCallback()
		}}else{this.incrementValue(amt)
		}},incrementValue:function(amt){var value=this.input.value;
		if(isIE){var start=getInputSelectionStart(this.input),end=start
		}else{var start=this.input.selectionStart,end=this.input.selectionEnd
		}var range=this.getAutoCompleteRange(value,start);
		if(!range||range.type!="int"){range={start:0,end:value.length-1}
		}var expr=value.substr(range.start,range.end-range.start+1);
		preExpr=value.substr(0,range.start);
		postExpr=value.substr(range.end+1);
		var intValue=parseInt(expr);
		if(!!intValue||intValue==0){var m=/\d+/.exec(expr);
		var digitPost=expr.substr(m.index+m[0].length);
		var completion=intValue-amt;
		this.input.value=preExpr+completion+digitPost+postExpr;
		setSelectionRange(this.input,start,end);
		Firebug.Editor.update(true);
		return true
		}else{return false
		}},onKeyPress:function(event){if(event.keyCode==27&&!this.completeAsYouType){var reverted=this.getAutoCompleter().revert(this.input);
		if(reverted){cancelEvent(event)
		}}else{if(event.charCode&&this.advanceToNext(this.target,event.charCode)){Firebug.Editor.tabNextEditor();
		cancelEvent(event)
		}else{if(this.numeric&&event.charCode&&(event.charCode<48||event.charCode>57)&&event.charCode!=45&&event.charCode!=46){FBL.cancelEvent(event)
		}else{this.ignoreNextInput=event.keyCode==8
		}}}},onOverflow:function(){this.updateLayout(false,false,3)
		},onKeyDown:function(event){if(event.keyCode>46||event.keyCode==32||event.keyCode==8){this.keyDownPressed=true
		}},onInput:function(event){if(isIE){if(event.propertyName!="value"||!isVisible(this.input)||!this.keyDownPressed){return
		}this.keyDownPressed=false
		}var selectRangeCallback;
		if(this.ignoreNextInput){this.ignoreNextInput=false;
		this.getAutoCompleter().reset()
		}else{if(this.completeAsYouType){selectRangeCallback=this.getAutoCompleter().complete(currentPanel.context,this.input,false)
		}else{this.getAutoCompleter().reset()
		}}Firebug.Editor.update();
		if(selectRangeCallback){if(isSafari){setTimeout(selectRangeCallback,0)
		}else{selectRangeCallback()
		}}},onContextMenu:function(event){cancelEvent(event);
		var popup=$("fbInlineEditorPopup");
		FBL.eraseNode(popup);
		var target=event.target||event.srcElement;
		var menu=this.getContextMenuItems(target);
		if(menu){for(var i=0;
		i<menu.length;
		++i){FBL.createMenuItem(popup,menu[i])
		}}if(!popup.firstChild){return false
		}popup.openPopupAtScreen(event.screenX,event.screenY,true);
		return true
		},updateLayout:function(initial,forceAll,extraWidth){if(this.fixedWidth){this.box.style.left=(this.targetOffset.x)+"px";
		this.box.style.top=(this.targetOffset.y)+"px";
		var w=this.target.offsetWidth;
		var h=this.target.offsetHeight;
		this.input.style.width=w+"px";
		this.input.style.height=(h-3)+"px"
		}else{if(initial||forceAll){this.box.style.left=this.targetOffset.x+"px";
		this.box.style.top=this.targetOffset.y+"px"
		}var approxTextWidth=this.textSize.width;
		var maxWidth=(currentPanel.panelNode.scrollWidth-this.targetOffset.x)-this.outerMargin;
		var wrapped=initial?this.noWrap&&this.targetSize.height>this.textSize.height+3:this.noWrap&&approxTextWidth>maxWidth;
		if(wrapped){var style=isIE?this.target.currentStyle:this.target.ownerDocument.defaultView.getComputedStyle(this.target,"");
		targetMargin=parseInt(style.marginLeft)+parseInt(style.marginRight);
		approxTextWidth=maxWidth-targetMargin;
		this.input.style.width="100%";
		this.box.style.width=approxTextWidth+"px"
		}else{var charWidth=this.measureInputText("m").width;
		if(extraWidth){charWidth*=extraWidth
		}var inputWidth=approxTextWidth+charWidth;
		if(initial){if(isIE){var xDiff=13;
		this.box.style.width=(inputWidth+xDiff)+"px"
		}else{this.box.style.width="auto"
		}}else{var xDiff=isIE?13:this.box.scrollWidth-this.input.offsetWidth;
		this.box.style.width=(inputWidth+xDiff)+"px"
		}this.input.style.width=inputWidth+"px"
		}this.expander.style.width=approxTextWidth+"px";
		this.expander.style.height=Math.max(this.textSize.height-3,0)+"px"
		}if(forceAll){scrollIntoCenterView(this.box,null,true)
		}}});
		Firebug.AutoCompleter=function(getExprOffset,getRange,evaluator,selectMode,caseSensitive){var candidates=null;
		var originalValue=null;
		var originalOffset=-1;
		var lastExpr=null;
		var lastOffset=-1;
		var exprOffset=0;
		var lastIndex=0;
		var preParsed=null;
		var preExpr=null;
		var postExpr=null;
		this.revert=function(textBox){if(originalOffset!=-1){textBox.value=originalValue;
		setSelectionRange(textBox,originalOffset,originalOffset);
		this.reset();
		return true
		}else{this.reset();
		return false
		}};
		this.reset=function(){candidates=null;
		originalValue=null;
		originalOffset=-1;
		lastExpr=null;
		lastOffset=0;
		exprOffset=0
		};
		this.complete=function(context,textBox,cycle,reverse){var value=textBox.value;
		var offset=getInputSelectionStart(textBox);
		if(isSafari&&!cycle&&offset>=0){offset++
		}if(!selectMode&&originalOffset!=-1){offset=originalOffset
		}if(!candidates||!cycle||offset!=lastOffset){originalOffset=offset;
		originalValue=value;
		var parseStart=getExprOffset?getExprOffset(value,offset,context):0;
		preParsed=value.substr(0,parseStart);
		var parsed=value.substr(parseStart);
		var range=getRange?getRange(parsed,offset-parseStart,context):null;
		if(!range){range={start:0,end:parsed.length-1}
		}var expr=parsed.substr(range.start,range.end-range.start+1);
		preExpr=parsed.substr(0,range.start);
		postExpr=parsed.substr(range.end+1);
		exprOffset=parseStart+range.start;
		if(!cycle){if(!expr){return
		}else{if(lastExpr&&lastExpr.indexOf(expr)!=0){candidates=null
		}else{if(lastExpr&&lastExpr.length>=expr.length){candidates=null;
		lastExpr=expr;
		return
		}}}}lastExpr=expr;
		lastOffset=offset;
		var searchExpr;
		if(expr&&offset!=parseStart+range.end+1){if(cycle){offset=range.start;
		searchExpr=expr;
		expr=""
		}else{return
		}}var values=evaluator(preExpr,expr,postExpr,context);
		if(!values){return
		}if(expr){candidates=[];
		if(caseSensitive){for(var i=0;
		i<values.length;
		++i){var name=values[i];
		if(name.indexOf&&name.indexOf(expr)==0){candidates.push(name)
		}}}else{var lowerExpr=caseSensitive?expr:expr.toLowerCase();
		for(var i=0;
		i<values.length;
		++i){var name=values[i];
		if(name.indexOf&&name.toLowerCase().indexOf(lowerExpr)==0){candidates.push(name)
		}}}lastIndex=reverse?candidates.length-1:0
		}else{if(searchExpr){var searchIndex=-1;
		if(caseSensitive){searchIndex=values.indexOf(expr)
		}else{var lowerExpr=searchExpr.toLowerCase();
		for(var i=0;
		i<values.length;
		++i){var name=values[i];
		if(name&&name.toLowerCase().indexOf(lowerExpr)==0){searchIndex=i;
		break
		}}}if(searchIndex==-1){return this.reset()
		}expr=searchExpr;
		candidates=cloneArray(values);
		lastIndex=searchIndex
		}else{expr="";
		candidates=[];
		for(var i=0;
		i<values.length;
		++i){if(values[i].substr){candidates.push(values[i])
		}}lastIndex=-1
		}}}if(cycle){expr=lastExpr;
		lastIndex+=reverse?-1:1
		}if(!candidates.length){return
		}if(lastIndex>=candidates.length){lastIndex=0
		}else{if(lastIndex<0){lastIndex=candidates.length-1
		}}var completion=candidates[lastIndex];
		var preCompletion=expr.substr(0,offset-exprOffset);
		var postCompletion=completion.substr(offset-exprOffset);
		textBox.value=preParsed+preExpr+preCompletion+postCompletion+postExpr;
		var offsetEnd=preParsed.length+preExpr.length+completion.length;
		return function(){if(selectMode){setSelectionRange(textBox,offset,offsetEnd)
		}else{setSelectionRange(textBox,offsetEnd,offsetEnd)
		}}
		}
		};
		var getDefaultEditor=function getDefaultEditor(panel){if(!defaultEditor){var doc=panel.document;
		defaultEditor=new Firebug.InlineEditor(doc)
		}return defaultEditor
		};
		var getOutsider=function getOutsider(element,group,stepper){var parentGroup=getAncestorByClass(group.parentNode,"editGroup");
		var next;
		do{next=stepper(next||element)
		}while(isAncestor(next,group)||isGroupInsert(next,parentGroup));
		return next
		};
		var isGroupInsert=function isGroupInsert(next,group){return(!group||isAncestor(next,group))&&(hasClass(next,"insertBefore")||hasClass(next,"insertAfter"))
		};
		var getNextOutsider=function getNextOutsider(element,group){return getOutsider(element,group,bind(getNextByClass,FBL,"editable"))
		};
		var getPreviousOutsider=function getPreviousOutsider(element,group){return getOutsider(element,group,bind(getPreviousByClass,FBL,"editable"))
		};
		var getInlineParent=function getInlineParent(element){var lastInline=element;
		for(;
		element;
		element=element.parentNode){var s=isIE?element.currentStyle:element.ownerDocument.defaultView.getComputedStyle(element,"");
		if(s.display!="inline"){return lastInline
		}else{lastInline=element
		}}return null
		};
		var insertTab=function insertTab(){insertTextIntoElement(currentEditor.input,Firebug.Editor.tabCharacter)
		};
		Firebug.registerModule(Firebug.Editor)
		}});
		FBL.ns(function(){with(FBL){if(Env.Options.disableXHRListener){return
		}var XHRSpy=function(){this.requestHeaders=[];
		this.responseHeaders=[]
		};
		XHRSpy.prototype={method:null,url:null,async:null,xhrRequest:null,href:null,loaded:false,logRow:null,responseText:null,requestHeaders:null,responseHeaders:null,sourceLink:null,getURL:function(){return this.href
		}};
		var XMLHttpRequestWrapper=function(activeXObject){var xhrRequest=typeof activeXObject!="undefined"?activeXObject:new _XMLHttpRequest(),spy=new XHRSpy(),self=this,reqType,reqUrl,reqStartTS;
		var updateSelfPropertiesIgnore={abort:1,channel:1,getAllResponseHeaders:1,getInterface:1,getResponseHeader:1,mozBackgroundRequest:1,multipart:1,onreadystatechange:1,open:1,send:1,setRequestHeader:1};
		var updateSelfProperties=function(){if(supportsXHRIterator){for(var propName in xhrRequest){if(propName in updateSelfPropertiesIgnore){continue
		}try{var propValue=xhrRequest[propName];
		if(propValue&&!isFunction(propValue)){self[propName]=propValue
		}}catch(E){}}}else{if(xhrRequest.readyState==4){self.status=xhrRequest.status;
		self.statusText=xhrRequest.statusText;
		self.responseText=xhrRequest.responseText;
		self.responseXML=xhrRequest.responseXML
		}}};
		var updateXHRPropertiesIgnore={channel:1,onreadystatechange:1,readyState:1,responseBody:1,responseText:1,responseXML:1,status:1,statusText:1,upload:1};
		var updateXHRProperties=function(){for(var propName in self){if(propName in updateXHRPropertiesIgnore){continue
		}try{var propValue=self[propName];
		if(propValue&&!xhrRequest[propName]){xhrRequest[propName]=propValue
		}}catch(E){}}};
		var logXHR=function(){var row=Firebug.Console.log(spy,null,"spy",Firebug.Spy.XHR);
		if(row){setClass(row,"loading");
		spy.logRow=row
		}};
		var finishXHR=function(){var duration=new Date().getTime()-reqStartTS;
		var success=xhrRequest.status==200;
		var responseHeadersText=xhrRequest.getAllResponseHeaders();
		var responses=responseHeadersText?responseHeadersText.split(/[\n\r]/):[];
		var reHeader=/^(\S+):\s*(.*)/;
		for(var i=0,l=responses.length;
		i<l;
		i++){var text=responses[i];
		var match=text.match(reHeader);
		if(match){var name=match[1];
		var value=match[2];
		if(name=="Content-Type"){spy.mimeType=value
		}spy.responseHeaders.push({name:[name],value:[value]})
		}}with({row:spy.logRow,status:xhrRequest.status==0?"":xhrRequest.status+" "+xhrRequest.statusText,time:duration,success:success}){setTimeout(function(){spy.responseText=xhrRequest.responseText;
		row=row||spy.logRow;
		if(!row){return
		}handleRequestStatus(success,status,time)
		},200)
		}spy.loaded=true;
		updateSelfProperties()
		};
		var handleStateChange=function(){self.readyState=xhrRequest.readyState;
		if(xhrRequest.readyState==4){finishXHR();
		xhrRequest.onreadystatechange=function(){}
		}self.onreadystatechange()
		};
		var handleRequestStatus=function(success,status,time){var row=spy.logRow;
		FBL.removeClass(row,"loading");
		if(!success){FBL.setClass(row,"error")
		}var item=FBL.$$(".spyStatus",row)[0];
		item.innerHTML=status;
		if(time){var item=FBL.$$(".spyTime",row)[0];
		item.innerHTML=time+"ms"
		}};
		this.readyState=0;
		this.onreadystatechange=function(){};
		this.open=function(method,url,async,user,password){updateSelfProperties();
		if(spy.loaded){spy=new XHRSpy()
		}spy.method=method;
		spy.url=url;
		spy.async=async;
		spy.href=url;
		spy.xhrRequest=xhrRequest;
		spy.urlParams=parseURLParamsArray(url);
		try{if(supportsApply){xhrRequest.open.apply(xhrRequest,arguments)
		}else{xhrRequest.open(method,url,async,user,password)
		}}catch(e){}xhrRequest.onreadystatechange=handleStateChange
		};
		this.send=function(data){spy.data=data;
		reqStartTS=new Date().getTime();
		updateXHRProperties();
		try{xhrRequest.send(data)
		}catch(e){}finally{logXHR();
		if(!spy.async){self.readyState=xhrRequest.readyState;
		try{finishXHR()
		}catch(E){}}}};
		this.setRequestHeader=function(header,value){spy.requestHeaders.push({name:[header],value:[value]});
		return xhrRequest.setRequestHeader(header,value)
		};
		this.abort=function(){xhrRequest.abort();
		updateSelfProperties();
		handleRequestStatus(false,"Aborted")
		};
		this.getResponseHeader=function(header){return xhrRequest.getResponseHeader(header)
		};
		this.getAllResponseHeaders=function(){return xhrRequest.getAllResponseHeaders()
		};
		var supportsApply=!isIE6&&xhrRequest&&xhrRequest.open&&typeof xhrRequest.open.apply!="undefined";
		var numberOfXHRProperties=0;
		for(var propName in xhrRequest){numberOfXHRProperties++;
		if(propName in updateSelfPropertiesIgnore){continue
		}try{var propValue=xhrRequest[propName];
		if(isFunction(propValue)){if(typeof self[propName]=="undefined"){this[propName]=(function(name,xhr){return supportsApply?function(){return xhr[name].apply(xhr,arguments)
		}:function(a,b,c,d,e){return xhr[name](a,b,c,d,e)
		}
		})(propName,xhrRequest)
		}}else{this[propName]=propValue
		}}catch(E){}}var supportsXHRIterator=numberOfXHRProperties>0;
		return this
		};
		var _ActiveXObject;
		var isIE6=/msie 6/i.test(navigator.appVersion);
		if(isIE6){_ActiveXObject=window.ActiveXObject;
		var xhrObjects=" MSXML2.XMLHTTP.5.0 MSXML2.XMLHTTP.4.0 MSXML2.XMLHTTP.3.0 MSXML2.XMLHTTP Microsoft.XMLHTTP ";
		window.ActiveXObject=function(name){var error=null;
		try{var activeXObject=new _ActiveXObject(name)
		}catch(e){error=e
		}finally{if(!error){if(xhrObjects.indexOf(" "+name+" ")!=-1){return new XMLHttpRequestWrapper(activeXObject)
		}else{return activeXObject
		}}else{throw error.message
		}}}
		}if(!isIE6){var _XMLHttpRequest=XMLHttpRequest;
		window.XMLHttpRequest=function(){return new XMLHttpRequestWrapper()
		}
		}FBL.getNativeXHRObject=function(){var xhrObj=false;
		try{xhrObj=new _XMLHttpRequest()
		}catch(e){var progid=["MSXML2.XMLHTTP.5.0","MSXML2.XMLHTTP.4.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"];
		for(var i=0;
		i<progid.length;
		++i){try{xhrObj=new _ActiveXObject(progid[i])
		}catch(e){continue
		}break
		}}finally{return xhrObj
		}}
		}});
		FBL.ns(function(){with(FBL){var reIgnore=/about:|javascript:|resource:|chrome:|jar:/;
		var layoutInterval=300;
		var indentWidth=18;
		var cacheSession=null;
		var contexts=new Array();
		var panelName="net";
		var maxQueueRequests=500;
		var activeRequests=[];
		var mimeExtensionMap={txt:"text/plain",html:"text/html",htm:"text/html",xhtml:"text/html",xml:"text/xml",css:"text/css",js:"application/x-javascript",jss:"application/x-javascript",jpg:"image/jpg",jpeg:"image/jpeg",gif:"image/gif",png:"image/png",bmp:"image/bmp",swf:"application/x-shockwave-flash",flv:"video/x-flv"};
		var fileCategories={"undefined":1,html:1,css:1,js:1,xhr:1,image:1,flash:1,txt:1,bin:1};
		var textFileCategories={txt:1,html:1,xhr:1,css:1,js:1};
		var binaryFileCategories={bin:1,flash:1};
		var mimeCategoryMap={"text/plain":"txt","application/octet-stream":"bin","text/html":"html","text/xml":"html","text/css":"css","application/x-javascript":"js","text/javascript":"js","application/javascript":"js","image/jpeg":"image","image/jpg":"image","image/gif":"image","image/png":"image","image/bmp":"image","application/x-shockwave-flash":"flash","video/x-flv":"flash"};
		var binaryCategoryMap={image:1,flash:1};
		Firebug.NetMonitor=extend(Firebug.ActivableModule,{dispatchName:"netMonitor",clear:function(context){var panel=context.getPanel(panelName,true);
		if(panel){panel.clear()
		}},initialize:function(){return;
		this.panelName=panelName;
		Firebug.ActivableModule.initialize.apply(this,arguments);
		if(Firebug.TraceModule){Firebug.TraceModule.addListener(this.TraceListener)
		}NetHttpObserver.registerObserver();
		NetHttpActivityObserver.registerObserver();
		Firebug.Debugger.addListener(this.DebuggerListener)
		},shutdown:function(){return;
		prefs.removeObserver(Firebug.prefDomain,this,false);
		if(Firebug.TraceModule){Firebug.TraceModule.removeListener(this.TraceListener)
		}NetHttpObserver.unregisterObserver();
		NetHttpActivityObserver.unregisterObserver();
		Firebug.Debugger.removeListener(this.DebuggerListener)
		}});
		Firebug.NetMonitor.NetInfoBody=domplate(Firebug.Rep,new Firebug.Listener(),{tag:DIV({"class":"netInfoBody",_repObject:"$file"},TAG("$infoTabs",{file:"$file"}),TAG("$infoBodies",{file:"$file"})),infoTabs:DIV({"class":"netInfoTabs focusRow subFocusRow",role:"tablist"},A({"class":"netInfoParamsTab netInfoTab a11yFocus",onclick:"$onClickTab",role:"tab",view:"Params",$collapsed:"$file|hideParams"},$STR("URLParameters")),A({"class":"netInfoHeadersTab netInfoTab a11yFocus",onclick:"$onClickTab",role:"tab",view:"Headers"},$STR("Headers")),A({"class":"netInfoPostTab netInfoTab a11yFocus",onclick:"$onClickTab",role:"tab",view:"Post",$collapsed:"$file|hidePost"},$STR("Post")),A({"class":"netInfoPutTab netInfoTab a11yFocus",onclick:"$onClickTab",role:"tab",view:"Put",$collapsed:"$file|hidePut"},$STR("Put")),A({"class":"netInfoResponseTab netInfoTab a11yFocus",onclick:"$onClickTab",role:"tab",view:"Response",$collapsed:"$file|hideResponse"},$STR("Response")),A({"class":"netInfoCacheTab netInfoTab a11yFocus",onclick:"$onClickTab",role:"tab",view:"Cache",$collapsed:"$file|hideCache"},$STR("Cache")),A({"class":"netInfoHtmlTab netInfoTab a11yFocus",onclick:"$onClickTab",role:"tab",view:"Html",$collapsed:"$file|hideHtml"},$STR("HTML"))),infoBodies:DIV({"class":"netInfoBodies outerFocusRow"},TABLE({"class":"netInfoParamsText netInfoText netInfoParamsTable",role:"tabpanel",cellpadding:0,cellspacing:0},TBODY()),DIV({"class":"netInfoHeadersText netInfoText",role:"tabpanel"}),DIV({"class":"netInfoPostText netInfoText",role:"tabpanel"}),DIV({"class":"netInfoPutText netInfoText",role:"tabpanel"}),PRE({"class":"netInfoResponseText netInfoText",role:"tabpanel"}),DIV({"class":"netInfoCacheText netInfoText",role:"tabpanel"},TABLE({"class":"netInfoCacheTable",cellpadding:0,cellspacing:0,role:"presentation"},TBODY({role:"list","aria-label":$STR("Cache")}))),DIV({"class":"netInfoHtmlText netInfoText",role:"tabpanel"},IFRAME({"class":"netInfoHtmlPreview",role:"document"}))),headerDataTag:FOR("param","$headers",TR({role:"listitem"},TD({"class":"netInfoParamName",role:"presentation"},TAG("$param|getNameTag",{param:"$param"})),TD({"class":"netInfoParamValue",role:"list","aria-label":"$param.name"},FOR("line","$param|getParamValueIterator",CODE({"class":"focusRow subFocusRow",role:"listitem"},"$line"))))),customTab:A({"class":"netInfo$tabId\\Tab netInfoTab",onclick:"$onClickTab",view:"$tabId",role:"tab"},"$tabTitle"),customBody:DIV({"class":"netInfo$tabId\\Text netInfoText",role:"tabpanel"}),nameTag:SPAN("$param|getParamName"),nameWithTooltipTag:SPAN({title:"$param.name"},"$param|getParamName"),getNameTag:function(param){return(this.getParamName(param)==param.name)?this.nameTag:this.nameWithTooltipTag
		},getParamName:function(param){var limit=25;
		var name=param.name;
		if(name.length>limit){name=name.substr(0,limit)+"..."
		}return name
		},getParamTitle:function(param){var limit=25;
		var name=param.name;
		if(name.length>limit){return name
		}return""
		},hideParams:function(file){return !file.urlParams||!file.urlParams.length
		},hidePost:function(file){return file.method.toUpperCase()!="POST"
		},hidePut:function(file){return file.method.toUpperCase()!="PUT"
		},hideResponse:function(file){return false
		},hideCache:function(file){return true;
		return !file.cacheEntry
		},hideHtml:function(file){return(file.mimeType!="text/html")&&(file.mimeType!="application/xhtml+xml")
		},onClickTab:function(event){this.selectTab(event.currentTarget||event.srcElement)
		},getParamValueIterator:function(param){return param.value;
		return wrapText(param.value,true)
		},appendTab:function(netInfoBox,tabId,tabTitle){var args={tabId:tabId,tabTitle:tabTitle};
		this.customTab.append(args,$$(".netInfoTabs",netInfoBox)[0]);
		this.customBody.append(args,$$(".netInfoBodies",netInfoBox)[0])
		},selectTabByName:function(netInfoBox,tabName){var tab=getChildByClass(netInfoBox,"netInfoTabs","netInfo"+tabName+"Tab");
		if(tab){this.selectTab(tab)
		}},selectTab:function(tab){var view=tab.getAttribute("view");
		var netInfoBox=getAncestorByClass(tab,"netInfoBody");
		var selectedTab=netInfoBox.selectedTab;
		if(selectedTab){removeClass(netInfoBox.selectedText,"netInfoTextSelected");
		removeClass(selectedTab,"netInfoTabSelected");
		selectedTab.setAttribute("aria-selected","false")
		}var textBodyName="netInfo"+view+"Text";
		selectedTab=netInfoBox.selectedTab=tab;
		netInfoBox.selectedText=$$("."+textBodyName,netInfoBox)[0];
		setClass(netInfoBox.selectedText,"netInfoTextSelected");
		setClass(selectedTab,"netInfoTabSelected");
		selectedTab.setAttribute("selected","true");
		selectedTab.setAttribute("aria-selected","true");
		var file=Firebug.getRepObject(netInfoBox);
		var context=Firebug.chrome;
		this.updateInfo(netInfoBox,file,context)
		},updateInfo:function(netInfoBox,file,context){if(FBTrace.DBG_NET){FBTrace.sysout("net.updateInfo; file",file)
		}if(!netInfoBox){if(FBTrace.DBG_NET||FBTrace.DBG_ERRORS){FBTrace.sysout("net.updateInfo; ERROR netInfo == null "+file.href,file)
		}return
		}var tab=netInfoBox.selectedTab;
		if(hasClass(tab,"netInfoParamsTab")){if(file.urlParams&&!netInfoBox.urlParamsPresented){netInfoBox.urlParamsPresented=true;
		this.insertHeaderRows(netInfoBox,file.urlParams,"Params")
		}}else{if(hasClass(tab,"netInfoHeadersTab")){var headersText=$$(".netInfoHeadersText",netInfoBox)[0];
		if(file.responseHeaders&&!netInfoBox.responseHeadersPresented){netInfoBox.responseHeadersPresented=true;
		NetInfoHeaders.renderHeaders(headersText,file.responseHeaders,"ResponseHeaders")
		}if(file.requestHeaders&&!netInfoBox.requestHeadersPresented){netInfoBox.requestHeadersPresented=true;
		NetInfoHeaders.renderHeaders(headersText,file.requestHeaders,"RequestHeaders")
		}}else{if(hasClass(tab,"netInfoPostTab")){if(!netInfoBox.postPresented){netInfoBox.postPresented=true;
		var postText=$$(".netInfoPostText",netInfoBox)[0];
		NetInfoPostData.render(context,postText,file)
		}}else{if(hasClass(tab,"netInfoPutTab")){if(!netInfoBox.putPresented){netInfoBox.putPresented=true;
		var putText=$$(".netInfoPutText",netInfoBox)[0];
		NetInfoPostData.render(context,putText,file)
		}}else{if(hasClass(tab,"netInfoResponseTab")&&file.loaded&&!netInfoBox.responsePresented){var responseTextBox=$$(".netInfoResponseText",netInfoBox)[0];
		if(file.category=="image"){netInfoBox.responsePresented=true;
		var responseImage=netInfoBox.ownerDocument.createElement("img");
		responseImage.src=file.href;
		clearNode(responseTextBox);
		responseTextBox.appendChild(responseImage,responseTextBox)
		}else{this.setResponseText(file,netInfoBox,responseTextBox,context)
		}}else{if(hasClass(tab,"netInfoCacheTab")&&file.loaded&&!netInfoBox.cachePresented){var responseTextBox=netInfoBox.getElementsByClassName("netInfoCacheText").item(0);
		if(file.cacheEntry){netInfoBox.cachePresented=true;
		this.insertHeaderRows(netInfoBox,file.cacheEntry,"Cache")
		}}else{if(hasClass(tab,"netInfoHtmlTab")&&file.loaded&&!netInfoBox.htmlPresented){netInfoBox.htmlPresented=true;
		var text=Utils.getResponseText(file,context);
		var iframe=$$(".netInfoHtmlPreview",netInfoBox)[0];
		var reScript=/<script(.|\s)*?\/script>/gi;
		text=text.replace(reScript,"");
		iframe.contentWindow.document.write(text);
		iframe.contentWindow.document.close()
		}}}}}}}dispatch(NetInfoBody.fbListeners,"updateTabBody",[netInfoBox,file,context])
		},setResponseText:function(file,netInfoBox,responseTextBox,context){netInfoBox.responsePresented=true;
		if(isIE){responseTextBox.style.whiteSpace="nowrap"
		}responseTextBox[typeof responseTextBox.textContent!="undefined"?"textContent":"innerText"]=file.responseText;
		return;
		var text=Utils.getResponseText(file,context);
		var limit=Firebug.netDisplayedResponseLimit+15;
		var limitReached=text?(text.length>limit):false;
		if(limitReached){text=text.substr(0,limit)+"..."
		}if(text){insertWrappedText(text,responseTextBox)
		}else{insertWrappedText("",responseTextBox)
		}if(limitReached){var object={text:$STR("net.responseSizeLimitMessage"),onClickLink:function(){var panel=context.getPanel("net",true);
		panel.openResponseInTab(file)
		}};
		Firebug.NetMonitor.ResponseSizeLimit.append(object,responseTextBox)
		}netInfoBox.responsePresented=true;
		if(FBTrace.DBG_NET){FBTrace.sysout("net.setResponseText; response text updated")
		}},insertHeaderRows:function(netInfoBox,headers,tableName,rowName){if(!headers.length){return
		}var headersTable=$$(".netInfo"+tableName+"Table",netInfoBox)[0];
		var tbody=getChildByClass(headersTable,"netInfo"+rowName+"Body");
		if(!tbody){tbody=headersTable.firstChild
		}var titleRow=getChildByClass(tbody,"netInfo"+rowName+"Title");
		this.headerDataTag.insertRows({headers:headers},titleRow?titleRow:tbody);
		removeClass(titleRow,"collapsed")
		}});
		var NetInfoBody=Firebug.NetMonitor.NetInfoBody;
		Firebug.NetMonitor.NetInfoHeaders=domplate(Firebug.Rep,{tag:DIV({"class":"netInfoHeadersTable",role:"tabpanel"},DIV({"class":"netInfoHeadersGroup netInfoResponseHeadersTitle"},SPAN($STR("ResponseHeaders")),SPAN({"class":"netHeadersViewSource response collapsed",onclick:"$onViewSource",_sourceDisplayed:false,_rowName:"ResponseHeaders"},$STR("net.headers.view source"))),TABLE({cellpadding:0,cellspacing:0},TBODY({"class":"netInfoResponseHeadersBody",role:"list","aria-label":$STR("ResponseHeaders")})),DIV({"class":"netInfoHeadersGroup netInfoRequestHeadersTitle"},SPAN($STR("RequestHeaders")),SPAN({"class":"netHeadersViewSource request collapsed",onclick:"$onViewSource",_sourceDisplayed:false,_rowName:"RequestHeaders"},$STR("net.headers.view source"))),TABLE({cellpadding:0,cellspacing:0},TBODY({"class":"netInfoRequestHeadersBody",role:"list","aria-label":$STR("RequestHeaders")}))),sourceTag:TR({role:"presentation"},TD({colspan:2,role:"presentation"},PRE({"class":"source"}))),onViewSource:function(event){var target=event.target;
		var requestHeaders=(target.rowName=="RequestHeaders");
		var netInfoBox=getAncestorByClass(target,"netInfoBody");
		var file=netInfoBox.repObject;
		if(target.sourceDisplayed){var headers=requestHeaders?file.requestHeaders:file.responseHeaders;
		this.insertHeaderRows(netInfoBox,headers,target.rowName);
		target.innerHTML=$STR("net.headers.view source")
		}else{var source=requestHeaders?file.requestHeadersText:file.responseHeadersText;
		this.insertSource(netInfoBox,source,target.rowName);
		target.innerHTML=$STR("net.headers.pretty print")
		}target.sourceDisplayed=!target.sourceDisplayed;
		cancelEvent(event)
		},insertSource:function(netInfoBox,source,rowName){var tbody=$$(".netInfo"+rowName+"Body",netInfoBox)[0];
		var node=this.sourceTag.replace({},tbody);
		var sourceNode=$$(".source",node)[0];
		sourceNode.innerHTML=source
		},insertHeaderRows:function(netInfoBox,headers,rowName){var headersTable=$$(".netInfoHeadersTable",netInfoBox)[0];
		var tbody=$$(".netInfo"+rowName+"Body",headersTable)[0];
		clearNode(tbody);
		if(!headers.length){return
		}NetInfoBody.headerDataTag.insertRows({headers:headers},tbody);
		var titleRow=getChildByClass(headersTable,"netInfo"+rowName+"Title");
		removeClass(titleRow,"collapsed")
		},init:function(parent){var rootNode=this.tag.append({},parent);
		var netInfoBox=getAncestorByClass(parent,"netInfoBody");
		var file=netInfoBox.repObject;
		var viewSource;
		viewSource=$$(".request",rootNode)[0];
		if(file.requestHeadersText){removeClass(viewSource,"collapsed")
		}viewSource=$$(".response",rootNode)[0];
		if(file.responseHeadersText){removeClass(viewSource,"collapsed")
		}},renderHeaders:function(parent,headers,rowName){if(!parent.firstChild){this.init(parent)
		}this.insertHeaderRows(parent,headers,rowName)
		}});
		var NetInfoHeaders=Firebug.NetMonitor.NetInfoHeaders;
		Firebug.NetMonitor.NetInfoPostData=domplate(Firebug.Rep,{paramsTable:TABLE({"class":"netInfoPostParamsTable",cellpadding:0,cellspacing:0,role:"presentation"},TBODY({role:"list","aria-label":$STR("net.label.Parameters")},TR({"class":"netInfoPostParamsTitle",role:"presentation"},TD({colspan:3,role:"presentation"},DIV({"class":"netInfoPostParams"},$STR("net.label.Parameters"),SPAN({"class":"netInfoPostContentType"},"application/x-www-form-urlencoded")))))),partsTable:TABLE({"class":"netInfoPostPartsTable",cellpadding:0,cellspacing:0,role:"presentation"},TBODY({role:"list","aria-label":$STR("net.label.Parts")},TR({"class":"netInfoPostPartsTitle",role:"presentation"},TD({colspan:2,role:"presentation"},DIV({"class":"netInfoPostParams"},$STR("net.label.Parts"),SPAN({"class":"netInfoPostContentType"},"multipart/form-data")))))),jsonTable:TABLE({"class":"netInfoPostJSONTable",cellpadding:0,cellspacing:0,role:"presentation"},TBODY({role:"list","aria-label":$STR("JSON")},TR({"class":"netInfoPostJSONTitle",role:"presentation"},TD({role:"presentation"},DIV({"class":"netInfoPostParams"},$STR("JSON")))),TR(TD({"class":"netInfoPostJSONBody"})))),xmlTable:TABLE({"class":"netInfoPostXMLTable",cellpadding:0,cellspacing:0,role:"presentation"},TBODY({role:"list","aria-label":$STR("xmlviewer.tab.XML")},TR({"class":"netInfoPostXMLTitle",role:"presentation"},TD({role:"presentation"},DIV({"class":"netInfoPostParams"},$STR("xmlviewer.tab.XML")))),TR(TD({"class":"netInfoPostXMLBody"})))),sourceTable:TABLE({"class":"netInfoPostSourceTable",cellpadding:0,cellspacing:0,role:"presentation"},TBODY({role:"list","aria-label":$STR("net.label.Source")},TR({"class":"netInfoPostSourceTitle",role:"presentation"},TD({colspan:2,role:"presentation"},DIV({"class":"netInfoPostSource"},$STR("net.label.Source")))))),sourceBodyTag:TR({role:"presentation"},TD({colspan:2,role:"presentation"},FOR("line","$param|getParamValueIterator",CODE({"class":"focusRow subFocusRow",role:"listitem"},"$line")))),getParamValueIterator:function(param){return NetInfoBody.getParamValueIterator(param)
		},render:function(context,parentNode,file){var spy=getAncestorByClass(parentNode,"spyHead");
		var spyObject=spy.repObject;
		var data=spyObject.data;
		var contentType=file.mimeType;
		if(contentType&&contentType=="application/x-www-form-urlencoded"||data&&data.indexOf("=")!=-1){var params=parseURLEncodedTextArray(data);
		if(params){this.insertParameters(parentNode,params)
		}}var jsonData={responseText:data};
		if(Firebug.JSONViewerModel.isJSON(contentType,data)){this.insertJSON(parentNode,jsonData,context)
		}var postText=data;
		if(postText){this.insertSource(parentNode,postText)
		}},insertParameters:function(parentNode,params){if(!params||!params.length){return
		}var paramTable=this.paramsTable.append({object:{}},parentNode);
		var row=$$(".netInfoPostParamsTitle",paramTable)[0];
		var tbody=paramTable.getElementsByTagName("tbody")[0];
		NetInfoBody.headerDataTag.insertRows({headers:params},row)
		},insertParts:function(parentNode,data){if(!data.params||!data.params.length){return
		}var partsTable=this.partsTable.append({object:{}},parentNode);
		var row=$$(".netInfoPostPartsTitle",paramTable)[0];
		NetInfoBody.headerDataTag.insertRows({headers:data.params},row)
		},insertJSON:function(parentNode,file,context){var text=file.responseText;
		var data=parseJSONString(text);
		if(!data){return
		}var jsonTable=this.jsonTable.append({},parentNode);
		var jsonBody=$$(".netInfoPostJSONBody",jsonTable)[0];
		if(!this.toggles){this.toggles={}
		}Firebug.DOMPanel.DirTable.tag.replace({object:data,toggles:this.toggles},jsonBody)
		},insertXML:function(parentNode,file,context){var text=Utils.getPostText(file,context);
		var jsonTable=this.xmlTable.append(null,parentNode);
		var jsonBody=$$(".netInfoPostXMLBody",jsonTable)[0];
		Firebug.XMLViewerModel.insertXML(jsonBody,text)
		},insertSource:function(parentNode,text){var sourceTable=this.sourceTable.append({object:{}},parentNode);
		var row=$$(".netInfoPostSourceTitle",sourceTable)[0];
		var param={value:[text]};
		this.sourceBodyTag.insertRows({param:param},row)
		},parseMultiPartText:function(file,context){var text=Utils.getPostText(file,context);
		if(text==undefined){return null
		}FBTrace.sysout("net.parseMultiPartText; boundary: ",text);
		var boundary=text.match(/\s*boundary=\s*(.*)/)[1];
		var divider="\r\n\r\n";
		var bodyStart=text.indexOf(divider);
		var body=text.substr(bodyStart+divider.length);
		var postData={};
		postData.mimeType="multipart/form-data";
		postData.params=[];
		var parts=body.split("--"+boundary);
		for(var i=0;
		i<parts.length;
		i++){var part=parts[i].split(divider);
		if(part.length!=2){continue
		}var m=part[0].match(/\s*name=\"(.*)\"(;|$)/);
		postData.params.push({name:(m&&m.length>1)?m[1]:"",value:trim(part[1])})
		}return postData
		}});
		var NetInfoPostData=Firebug.NetMonitor.NetInfoPostData;
		var $STRP=function(a){return a
		};
		Firebug.NetMonitor.NetLimit=domplate(Firebug.Rep,{collapsed:true,tableTag:DIV(TABLE({width:"100%",cellpadding:0,cellspacing:0},TBODY())),limitTag:TR({"class":"netRow netLimitRow",$collapsed:"$isCollapsed"},TD({"class":"netCol netLimitCol",colspan:6},TABLE({cellpadding:0,cellspacing:0},TBODY(TR(TD(SPAN({"class":"netLimitLabel"},$STRP("plural.Limit_Exceeded",[0]))),TD({style:"width:100%"}),TD(BUTTON({"class":"netLimitButton",title:"$limitPrefsTitle",onclick:"$onPreferences"},$STR("LimitPrefs"))),TD("&nbsp;")))))),isCollapsed:function(){return this.collapsed
		},onPreferences:function(event){openNewTab("about:config")
		},updateCounter:function(row){removeClass(row,"collapsed");
		var limitLabel=row.getElementsByClassName("netLimitLabel").item(0);
		limitLabel.firstChild.nodeValue=$STRP("plural.Limit_Exceeded",[row.limitInfo.totalCount])
		},createTable:function(parent,limitInfo){var table=this.tableTag.replace({},parent);
		var row=this.createRow(table.firstChild.firstChild,limitInfo);
		return[table,row]
		},createRow:function(parent,limitInfo){var row=this.limitTag.insertRows(limitInfo,parent,this)[0];
		row.limitInfo=limitInfo;
		return row
		},observe:function(subject,topic,data){if(topic!="nsPref:changed"){return
		}if(data.indexOf("net.logLimit")!=-1){this.updateMaxLimit()
		}},updateMaxLimit:function(){var value=Firebug.getPref(Firebug.prefDomain,"net.logLimit");
		maxQueueRequests=value?value:maxQueueRequests
		}});
		var NetLimit=Firebug.NetMonitor.NetLimit;
		Firebug.NetMonitor.ResponseSizeLimit=domplate(Firebug.Rep,{tag:DIV({"class":"netInfoResponseSizeLimit"},SPAN("$object.beforeLink"),A({"class":"objectLink",onclick:"$onClickLink"},"$object.linkText"),SPAN("$object.afterLink")),reLink:/^(.*)<a>(.*)<\/a>(.*$)/,append:function(obj,parent){var m=obj.text.match(this.reLink);
		return this.tag.append({onClickLink:obj.onClickLink,object:{beforeLink:m[1],linkText:m[2],afterLink:m[3]}},parent,this)
		}});
		Firebug.NetMonitor.Utils={findHeader:function(headers,name){if(!headers){return null
		}name=name.toLowerCase();
		for(var i=0;
		i<headers.length;
		++i){var headerName=headers[i].name.toLowerCase();
		if(headerName==name){return headers[i].value
		}}},formatPostText:function(text){if(text instanceof XMLDocument){return getElementXML(text.documentElement)
		}else{return text
		}},getPostText:function(file,context,noLimit){if(!file.postText){file.postText=readPostTextFromRequest(file.request,context);
		if(!file.postText&&context){file.postText=readPostTextFromPage(file.href,context)
		}}if(!file.postText){return file.postText
		}var limit=Firebug.netDisplayedPostBodyLimit;
		if(file.postText.length>limit&&!noLimit){return cropString(file.postText,limit,"\n\n... "+$STR("net.postDataSizeLimitMessage")+" ...\n\n")
		}return file.postText
		},getResponseText:function(file,context){return(typeof(file.responseText)!="undefined")?file.responseText:context.sourceCache.loadText(file.href,file.method,file)
		},isURLEncodedRequest:function(file,context){var text=Utils.getPostText(file,context);
		if(text&&text.toLowerCase().indexOf("content-type: application/x-www-form-urlencoded")==0){return true
		}var headerValue=Utils.findHeader(file.requestHeaders,"content-type");
		if(headerValue&&headerValue.indexOf("application/x-www-form-urlencoded")==0){return true
		}return false
		},isMultiPartRequest:function(file,context){var text=Utils.getPostText(file,context);
		if(text&&text.toLowerCase().indexOf("content-type: multipart/form-data")==0){return true
		}return false
		},getMimeType:function(mimeType,uri){if(!mimeType||!(mimeCategoryMap.hasOwnProperty(mimeType))){var ext=getFileExtension(uri);
		if(!ext){return mimeType
		}else{var extMimeType=mimeExtensionMap[ext.toLowerCase()];
		return extMimeType?extMimeType:mimeType
		}}else{return mimeType
		}},getDateFromSeconds:function(s){var d=new Date();
		d.setTime(s*1000);
		return d
		},getHttpHeaders:function(request,file){try{var http=QI(request,Ci.nsIHttpChannel);
		file.status=request.responseStatus;
		file.method=http.requestMethod;
		file.urlParams=parseURLParams(file.href);
		file.mimeType=Utils.getMimeType(request.contentType,request.name);
		if(!file.responseHeaders&&Firebug.collectHttpHeaders){var requestHeaders=[],responseHeaders=[];
		http.visitRequestHeaders({visitHeader:function(name,value){requestHeaders.push({name:name,value:value})
		}});
		http.visitResponseHeaders({visitHeader:function(name,value){responseHeaders.push({name:name,value:value})
		}});
		file.requestHeaders=requestHeaders;
		file.responseHeaders=responseHeaders
		}}catch(exc){if(FBTrace.DBG_ERRORS){FBTrace.sysout("net.getHttpHeaders FAILS "+file.href,exc)
		}}},isXHR:function(request){try{var callbacks=request.notificationCallbacks;
		var xhrRequest=callbacks?callbacks.getInterface(Ci.nsIXMLHttpRequest):null;
		if(FBTrace.DBG_NET){FBTrace.sysout("net.isXHR; "+(xhrRequest!=null)+", "+safeGetName(request))
		}return(xhrRequest!=null)
		}catch(exc){}return false
		},getFileCategory:function(file){if(file.category){if(FBTrace.DBG_NET){FBTrace.sysout("net.getFileCategory; current: "+file.category+" for: "+file.href,file)
		}return file.category
		}if(file.isXHR){if(FBTrace.DBG_NET){FBTrace.sysout("net.getFileCategory; XHR for: "+file.href,file)
		}return file.category="xhr"
		}if(!file.mimeType){var ext=getFileExtension(file.href);
		if(ext){file.mimeType=mimeExtensionMap[ext.toLowerCase()]
		}}if(!file.mimeType){return""
		}var mimeType=file.mimeType;
		if(mimeType){mimeType=mimeType.split(";")[0]
		}return(file.category=mimeCategoryMap[mimeType])
		}};
		var Utils=Firebug.NetMonitor.Utils;
		Firebug.registerModule(Firebug.NetMonitor)
		}});
		FBL.ns(function(){with(FBL){var contexts=[];
		Firebug.Spy=extend(Firebug.Module,{dispatchName:"spy",initialize:function(){if(Firebug.TraceModule){Firebug.TraceModule.addListener(this.TraceListener)
		}Firebug.Module.initialize.apply(this,arguments)
		},shutdown:function(){Firebug.Module.shutdown.apply(this,arguments);
		if(Firebug.TraceModule){Firebug.TraceModule.removeListener(this.TraceListener)
		}},initContext:function(context){context.spies=[];
		if(Firebug.showXMLHttpRequests&&Firebug.Console.isAlwaysEnabled()){this.attachObserver(context,context.window)
		}if(FBTrace.DBG_SPY){FBTrace.sysout("spy.initContext "+contexts.length+" ",context.getName())
		}},destroyContext:function(context){this.detachObserver(context,null);
		if(FBTrace.DBG_SPY&&context.spies.length){FBTrace.sysout("spy.destroyContext; ERROR There are leaking Spies ("+context.spies.length+") "+context.getName())
		}delete context.spies;
		if(FBTrace.DBG_SPY){FBTrace.sysout("spy.destroyContext "+contexts.length+" ",context.getName())
		}},watchWindow:function(context,win){if(Firebug.showXMLHttpRequests&&Firebug.Console.isAlwaysEnabled()){this.attachObserver(context,win)
		}},unwatchWindow:function(context,win){try{this.detachObserver(context,win)
		}catch(ex){ERROR(ex)
		}},updateOption:function(name,value){if(name=="showXMLHttpRequests"){var tach=value?this.attachObserver:this.detachObserver;
		for(var i=0;
		i<TabWatcher.contexts.length;
		++i){var context=TabWatcher.contexts[i];
		iterateWindows(context.window,function(win){tach.apply(this,[context,win])
		})
		}}},skipSpy:function(win){if(!win){return true
		}var uri=safeGetWindowLocation(win);
		if(uri&&(uri.indexOf("about:")==0||uri.indexOf("chrome:")==0)){return true
		}},attachObserver:function(context,win){if(Firebug.Spy.skipSpy(win)){return
		}for(var i=0;
		i<contexts.length;
		++i){if((contexts[i].context==context)&&(contexts[i].win==win)){return
		}}if(contexts.length==0){httpObserver.addObserver(SpyHttpObserver,"firebug-http-event",false);
		SpyHttpActivityObserver.registerObserver()
		}contexts.push({context:context,win:win});
		if(FBTrace.DBG_SPY){FBTrace.sysout("spy.attachObserver (HTTP) "+contexts.length+" ",context.getName())
		}},detachObserver:function(context,win){for(var i=0;
		i<contexts.length;
		++i){if(contexts[i].context==context){if(win&&(contexts[i].win!=win)){continue
		}contexts.splice(i,1);
		if(contexts.length==0){httpObserver.removeObserver(SpyHttpObserver,"firebug-http-event");
		SpyHttpActivityObserver.unregisterObserver()
		}if(FBTrace.DBG_SPY){FBTrace.sysout("spy.detachObserver (HTTP) "+contexts.length+" ",context.getName())
		}return
		}}},getXHR:function(request){if(!(request instanceof Ci.nsIHttpChannel)){return null
		}try{var callbacks=request.notificationCallbacks;
		return(callbacks?callbacks.getInterface(Ci.nsIXMLHttpRequest):null)
		}catch(exc){if(exc.name=="NS_NOINTERFACE"){if(FBTrace.DBG_SPY){FBTrace.sysout("spy.getXHR; Request is not nsIXMLHttpRequest: "+safeGetRequestName(request))
		}}}return null
		}});
		Firebug.Spy.XHR=domplate(Firebug.Rep,{tag:DIV({"class":"spyHead",_repObject:"$object"},TABLE({"class":"spyHeadTable focusRow outerFocusRow",cellpadding:0,cellspacing:0,role:"listitem","aria-expanded":"false"},TBODY({role:"presentation"},TR({"class":"spyRow"},TD({"class":"spyTitleCol spyCol",onclick:"$onToggleBody"},DIV({"class":"spyTitle"},"$object|getCaption"),DIV({"class":"spyFullTitle spyTitle"},"$object|getFullUri")),TD({"class":"spyCol"},DIV({"class":"spyStatus"},"$object|getStatus")),TD({"class":"spyCol"},SPAN({"class":"spyIcon"})),TD({"class":"spyCol"},SPAN({"class":"spyTime"})),TD({"class":"spyCol"},TAG(FirebugReps.SourceLink.tag,{object:"$object.sourceLink"})))))),getCaption:function(spy){return spy.method.toUpperCase()+" "+cropString(spy.getURL(),100)
		},getFullUri:function(spy){return spy.method.toUpperCase()+" "+spy.getURL()
		},getStatus:function(spy){var text="";
		if(spy.statusCode){text+=spy.statusCode+" "
		}if(spy.statusText){return text+=spy.statusText
		}return text
		},onToggleBody:function(event){var target=event.currentTarget||event.srcElement;
		var logRow=getAncestorByClass(target,"logRow-spy");
		if(isLeftClick(event)){toggleClass(logRow,"opened");
		var spy=getChildByClass(logRow,"spyHead").repObject;
		var spyHeadTable=getAncestorByClass(target,"spyHeadTable");
		if(hasClass(logRow,"opened")){updateHttpSpyInfo(spy,logRow);
		if(spyHeadTable){spyHeadTable.setAttribute("aria-expanded","true")
		}}else{}}},copyURL:function(spy){copyToClipboard(spy.getURL())
		},copyParams:function(spy){var text=spy.postText;
		if(!text){return
		}var url=reEncodeURL(spy,text,true);
		copyToClipboard(url)
		},copyResponse:function(spy){copyToClipboard(spy.responseText)
		},openInTab:function(spy){openNewTab(spy.getURL(),spy.postText)
		},supportsObject:function(object){return false;
		return object instanceof Firebug.Spy.XMLHttpRequestSpy
		},browseObject:function(spy,context){var url=spy.getURL();
		openNewTab(url);
		return true
		},getRealObject:function(spy,context){return spy.xhrRequest
		},getContextMenuItems:function(spy){var items=[{label:"CopyLocation",command:bindFixed(this.copyURL,this,spy)}];
		if(spy.postText){items.push({label:"CopyLocationParameters",command:bindFixed(this.copyParams,this,spy)})
		}items.push({label:"CopyResponse",command:bindFixed(this.copyResponse,this,spy)},"-",{label:"OpenInTab",command:bindFixed(this.openInTab,this,spy)});
		return items
		}});
		function updateTime(spy){var timeBox=spy.logRow.getElementsByClassName("spyTime").item(0);
		if(spy.responseTime){timeBox.textContent=" "+formatTime(spy.responseTime)
		}}function updateLogRow(spy){updateTime(spy);
		var statusBox=spy.logRow.getElementsByClassName("spyStatus").item(0);
		statusBox.textContent=Firebug.Spy.XHR.getStatus(spy);
		removeClass(spy.logRow,"loading");
		setClass(spy.logRow,"loaded");
		try{var errorRange=Math.floor(spy.xhrRequest.status/100);
		if(errorRange==4||errorRange==5){setClass(spy.logRow,"error")
		}}catch(exc){}}var updateHttpSpyInfo=function updateHttpSpyInfo(spy,logRow){if(!spy.logRow&&logRow){spy.logRow=logRow
		}if(!spy.logRow||!hasClass(spy.logRow,"opened")){return
		}if(!spy.params){spy.params=parseURLParams(spy.href+"")
		}if(!spy.requestHeaders){spy.requestHeaders=getRequestHeaders(spy)
		}if(!spy.responseHeaders&&spy.loaded){spy.responseHeaders=getResponseHeaders(spy)
		}var template=Firebug.NetMonitor.NetInfoBody;
		var netInfoBox=getChildByClass(spy.logRow,"spyHead","netInfoBody");
		if(!netInfoBox){var head=getChildByClass(spy.logRow,"spyHead");
		netInfoBox=template.tag.append({file:spy},head);
		dispatch(template.fbListeners,"initTabBody",[netInfoBox,spy]);
		template.selectTabByName(netInfoBox,"Response")
		}else{template.updateInfo(netInfoBox,spy,spy.context)
		}};
		function getRequestHeaders(spy){var headers=[];
		var channel=spy.xhrRequest.channel;
		if(channel instanceof Ci.nsIHttpChannel){channel.visitRequestHeaders({visitHeader:function(name,value){headers.push({name:name,value:value})
		}})
		}return headers
		}function getResponseHeaders(spy){var headers=[];
		try{var channel=spy.xhrRequest.channel;
		if(channel instanceof Ci.nsIHttpChannel){channel.visitResponseHeaders({visitHeader:function(name,value){headers.push({name:name,value:value})
		}})
		}}catch(exc){if(FBTrace.DBG_SPY||FBTrace.DBG_ERRORS){FBTrace.sysout("spy.getResponseHeaders; EXCEPTION "+safeGetRequestName(spy.request),exc)
		}}return headers
		}Firebug.registerModule(Firebug.Spy)
		}});
		FBL.ns(function(){with(FBL){var contentTypes={"text/javascript":1,"text/x-javascript":1,"text/json":1,"text/x-json":1,"application/json":1,"application/x-json":1,"application/javascript":1,"application/x-javascript":1,"application/json-rpc":1};
		Firebug.JSONViewerModel=extend(Firebug.Module,{dispatchName:"jsonViewer",initialize:function(){Firebug.NetMonitor.NetInfoBody.addListener(this);
		this.toggles={}
		},shutdown:function(){Firebug.NetMonitor.NetInfoBody.removeListener(this)
		},initTabBody:function(infoBox,file){if(FBTrace.DBG_JSONVIEWER){FBTrace.sysout("jsonviewer.initTabBody",infoBox)
		}dispatch(this.fbListeners,"onParseJSON",[file]);
		if(!file.jsonObject){if(this.isJSON(file.mimeType,file.responseText)){file.jsonObject=this.parseJSON(file)
		}}if(file.jsonObject&&hasProperties(file.jsonObject)){Firebug.NetMonitor.NetInfoBody.appendTab(infoBox,"JSON",$STR("JSON"));
		if(FBTrace.DBG_JSONVIEWER){FBTrace.sysout("jsonviewer.initTabBody; JSON object available "+(typeof(file.jsonObject)!="undefined"),file.jsonObject)
		}}},isJSON:function(contentType,data){var responseText=data?trim(data):null;
		if(responseText&&responseText.indexOf("{")==0){return true
		}if(!contentType){return false
		}contentType=contentType.split(";")[0];
		contentType=trim(contentType);
		return contentTypes[contentType]
		},updateTabBody:function(infoBox,file,context){var tab=infoBox.selectedTab;
		var tabBody=$$(".netInfoJSONText",infoBox)[0];
		if(!hasClass(tab,"netInfoJSONTab")||tabBody.updated){return
		}tabBody.updated=true;
		if(file.jsonObject){Firebug.DOMPanel.DirTable.tag.replace({object:file.jsonObject,toggles:this.toggles},tabBody)
		}},parseJSON:function(file){var jsonString=new String(file.responseText);
		return parseJSONString(jsonString)
		}});
		Firebug.registerModule(Firebug.JSONViewerModel)
		}});
		FBL.ns(function(){with(FBL){var xmlContentTypes=["text/xml","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml",,"application/vnd.mozilla.maybe.feed","application/rdf+xml","application/vnd.mozilla.xul+xml"];
		Firebug.XMLViewerModel=extend(Firebug.Module,{dispatchName:"xmlViewer",initialize:function(){Firebug.Module.initialize.apply(this,arguments);
		Firebug.NetMonitor.NetInfoBody.addListener(this)
		},shutdown:function(){Firebug.Module.shutdown.apply(this,arguments);
		Firebug.NetMonitor.NetInfoBody.removeListener(this)
		},initTabBody:function(infoBox,file){if(FBTrace.DBG_XMLVIEWER){FBTrace.sysout("xmlviewer.initTabBody",infoBox)
		}if(this.isXML(file.mimeType,file.responseText)){Firebug.NetMonitor.NetInfoBody.appendTab(infoBox,"XML",$STR("XML"));
		if(FBTrace.DBG_XMLVIEWER){FBTrace.sysout("xmlviewer.initTabBody; XML response available")
		}}},isXML:function(contentType){if(!contentType){return false
		}for(var i=0;
		i<xmlContentTypes.length;
		i++){if(contentType.indexOf(xmlContentTypes[i])==0){return true
		}}return false
		},updateTabBody:function(infoBox,file,context){var tab=infoBox.selectedTab;
		var tabBody=$$(".netInfoXMLText",infoBox)[0];
		if(!hasClass(tab,"netInfoXMLTab")||tabBody.updated){return
		}tabBody.updated=true;
		this.insertXML(tabBody,Firebug.NetMonitor.Utils.getResponseText(file,context))
		},insertXML:function(parentNode,text){var xmlText=text.replace(/^\s*<?.+?>\s*/,"");
		var div=parentNode.ownerDocument.createElement("div");
		div.innerHTML=xmlText;
		var root=div.getElementsByTagName("*")[0];
		if(FBTrace.DBG_XMLVIEWER){FBTrace.sysout("xmlviewer.updateTabBody; XML response parsed",doc)
		}var html=[];
		Firebug.Reps.appendNode(root,html);
		parentNode.innerHTML=html.join("")
		}});
		Firebug.XMLViewerModel.ParseError=domplate(Firebug.Rep,{tag:DIV({"class":"xmlInfoError"},DIV({"class":"xmlInfoErrorMsg"},"$error.message"),PRE({"class":"xmlInfoErrorSource"},"$error|getSource")),getSource:function(error){var parts=error.source.split("\n");
		if(parts.length!=2){return error.source
		}var limit=50;
		var column=parts[1].length;
		if(column>=limit){parts[0]="..."+parts[0].substr(column-limit);
		parts[1]="..."+parts[1].substr(column-limit)
		}if(parts[0].length>80){parts[0]=parts[0].substr(0,80)+"..."
		}return parts.join("\n")
		}});
		Firebug.registerModule(Firebug.XMLViewerModel)
		}});
		FBL.ns(function(){with(FBL){var consoleQueue=[];
		var lastHighlightedObject;
		var FirebugContext=Env.browser;
		var maxQueueRequests=500;
		Firebug.ConsoleBase={log:function(object,context,className,rep,noThrottle,sourceLink){return this.logRow(appendObject,object,context,className,rep,sourceLink,noThrottle)
		},logFormatted:function(objects,context,className,noThrottle,sourceLink){return this.logRow(appendFormatted,objects,context,className,null,sourceLink,noThrottle)
		},openGroup:function(objects,context,className,rep,noThrottle,sourceLink,noPush){return this.logRow(appendOpenGroup,objects,context,className,rep,sourceLink,noThrottle)
		},closeGroup:function(context,noThrottle){return this.logRow(appendCloseGroup,null,context,null,null,null,noThrottle,true)
		},logRow:function(appender,objects,context,className,rep,sourceLink,noThrottle,noRow){noThrottle=true;
		if(!context){context=FirebugContext
		}if(FBTrace.DBG_ERRORS&&!context){FBTrace.sysout("Console.logRow has no context, skipping objects",objects)
		}if(!context){return
		}if(noThrottle||!context){var panel=this.getPanel(context);
		if(panel){var row=panel.append(appender,objects,className,rep,sourceLink,noRow);
		var container=panel.panelNode;
		return row
		}else{consoleQueue.push([appender,objects,context,className,rep,sourceLink,noThrottle,noRow])
		}}else{if(!context.throttle){return
		}var args=[appender,objects,context,className,rep,sourceLink,true,noRow];
		context.throttle(this.logRow,this,args)
		}},appendFormatted:function(args,row,context){if(!context){context=FirebugContext
		}var panel=this.getPanel(context);
		panel.appendFormatted(args,row)
		},clear:function(context){if(!context){context=Firebug.context
		}var panel=this.getPanel(context,true);
		if(panel){panel.clear()
		}},getPanel:function(context,noCreate){return Firebug.chrome?Firebug.chrome.getPanel("Console"):null
		}};
		var ActivableConsole=extend(Firebug.ConsoleBase,{isAlwaysEnabled:function(){return true
		}});
		Firebug.Console=Firebug.Console=extend(ActivableConsole,{dispatchName:"console",error:function(){Firebug.Console.logFormatted(arguments,Firebug.browser,"error")
		},flush:function(){dispatch(this.fbListeners,"flush",[]);
		for(var i=0,length=consoleQueue.length;
		i<length;
		i++){var args=consoleQueue[i];
		this.logRow.apply(this,args)
		}},showPanel:function(browser,panel){},getFirebugConsoleElement:function(context,win){var element=win.document.getElementById("_firebugConsole");
		if(!element){if(FBTrace.DBG_CONSOLE){FBTrace.sysout("getFirebugConsoleElement forcing element")
		}var elementForcer="(function(){var r=null; try { r = window._getFirebugConsoleElement();}catch(exc){r=exc;} return r;})();";
		if(context.stopped){Firebug.Console.injector.evaluateConsoleScript(context)
		}else{var r=Firebug.CommandLine.evaluateInWebPage(elementForcer,context,win)
		}if(FBTrace.DBG_CONSOLE){FBTrace.sysout("getFirebugConsoleElement forcing element result "+r,r)
		}var element=win.document.getElementById("_firebugConsole");
		if(!element){if(FBTrace.DBG_ERRORS){FBTrace.sysout("console.getFirebugConsoleElement: no _firebugConsole in win:",win)
		}Firebug.Console.logFormatted(["Firebug cannot find _firebugConsole element",r,win],context,"error",true)
		}}return element
		},isReadyElsePreparing:function(context,win){if(FBTrace.DBG_CONSOLE){FBTrace.sysout("console.isReadyElsePreparing, win is "+(win?"an argument: ":"null, context.window: ")+(win?win.location:context.window.location),(win?win:context.window))
		}if(win){return this.injector.attachIfNeeded(context,win)
		}else{var attached=true;
		for(var i=0;
		i<context.windows.length;
		i++){attached=attached&&this.injector.attachIfNeeded(context,context.windows[i])
		}if(context.windows.indexOf(context.window)==-1){FBTrace.sysout("isReadyElsePreparing ***************** context.window not in context.windows")
		}if(FBTrace.DBG_CONSOLE){FBTrace.sysout("console.isReadyElsePreparing attached to "+context.windows.length+" and returns "+attached)
		}return attached
		}},initialize:function(){this.panelName="console"
		},enable:function(){if(Firebug.Console.isAlwaysEnabled()){this.watchForErrors()
		}},disable:function(){if(Firebug.Console.isAlwaysEnabled()){this.unwatchForErrors()
		}},initContext:function(context,persistedState){Firebug.ActivableModule.initContext.apply(this,arguments);
		context.consoleReloadWarning=true
		},loadedContext:function(context){for(var url in context.sourceFileMap){return
		}this.clearReloadWarning(context)
		},clearReloadWarning:function(context){if(context.consoleReloadWarning){var panel=context.getPanel(this.panelName);
		panel.clearReloadWarning();
		delete context.consoleReloadWarning
		}},togglePersist:function(context){var panel=context.getPanel(this.panelName);
		panel.persistContent=panel.persistContent?false:true;
		Firebug.chrome.setGlobalAttribute("cmd_togglePersistConsole","checked",panel.persistContent)
		},showContext:function(browser,context){Firebug.chrome.setGlobalAttribute("cmd_clearConsole","disabled",!context);
		Firebug.ActivableModule.showContext.apply(this,arguments)
		},destroyContext:function(context,persistedState){Firebug.Console.injector.detachConsole(context,context.window)
		},onPanelEnable:function(panelName){if(panelName!=this.panelName){return
		}if(FBTrace.DBG_CONSOLE){FBTrace.sysout("console.onPanelEnable**************")
		}this.watchForErrors();
		Firebug.Debugger.addDependentModule(this)
		},onPanelDisable:function(panelName){if(panelName!=this.panelName){return
		}if(FBTrace.DBG_CONSOLE){FBTrace.sysout("console.onPanelDisable**************")
		}Firebug.Debugger.removeDependentModule(this);
		this.unwatchForErrors();
		this.clear()
		},onSuspendFirebug:function(){if(FBTrace.DBG_CONSOLE){FBTrace.sysout("console.onSuspendFirebug\n")
		}if(Firebug.Console.isAlwaysEnabled()){this.unwatchForErrors()
		}},onResumeFirebug:function(){if(FBTrace.DBG_CONSOLE){FBTrace.sysout("console.onResumeFirebug\n")
		}if(Firebug.Console.isAlwaysEnabled()){this.watchForErrors()
		}},watchForErrors:function(){Firebug.Errors.checkEnabled();
		$("fbStatusIcon").setAttribute("console","on")
		},unwatchForErrors:function(){Firebug.Errors.checkEnabled();
		$("fbStatusIcon").removeAttribute("console")
		},onMonitorScript:function(context,frame){Firebug.Console.log(frame,context)
		},onFunctionCall:function(context,frame,depth,calling){if(calling){Firebug.Console.openGroup([frame,"depth:"+depth],context)
		}else{Firebug.Console.closeGroup(context)
		}},logRow:function(appender,objects,context,className,rep,sourceLink,noThrottle,noRow){if(!context){context=FirebugContext
		}if(FBTrace.DBG_WINDOWS&&!context){FBTrace.sysout("Console.logRow: no context \n")
		}if(this.isAlwaysEnabled()){return Firebug.ConsoleBase.logRow.apply(this,arguments)
		}}});
		Firebug.ConsoleListener={log:function(context,object,className,sourceLink){},logFormatted:function(context,objects,className,sourceLink){}};
		Firebug.ConsolePanel=function(){};
		Firebug.ConsolePanel.prototype=extend(Firebug.Panel,{wasScrolledToBottom:false,messageCount:0,lastLogTime:0,groups:null,limit:null,append:function(appender,objects,className,rep,sourceLink,noRow){var container=this.getTopContainer();
		if(noRow){appender.apply(this,[objects])
		}else{var row=this.createRow("logRow",className);
		appender.apply(this,[objects,row,rep]);
		if(sourceLink){FirebugReps.SourceLink.tag.append({object:sourceLink},row)
		}container.appendChild(row);
		this.filterLogRow(row,this.wasScrolledToBottom);
		if(this.wasScrolledToBottom){scrollToBottom(this.panelNode)
		}return row
		}},clear:function(){if(this.panelNode){if(FBTrace.DBG_CONSOLE){FBTrace.sysout("ConsolePanel.clear")
		}clearNode(this.panelNode);
		this.insertLogLimit(this.context)
		}},insertLogLimit:function(){var row=this.createRow("limitRow");
		var limitInfo={totalCount:0,limitPrefsTitle:$STRF("LimitPrefsTitle",[Firebug.prefDomain+".console.logLimit"])};
		return;
		var netLimitRep=Firebug.NetMonitor.NetLimit;
		var nodes=netLimitRep.createTable(row,limitInfo);
		this.limit=nodes[1];
		var container=this.panelNode;
		container.insertBefore(nodes[0],container.firstChild)
		},insertReloadWarning:function(){this.warningRow=this.append(appendObject,$STR("message.Reload to activate window console"),"info")
		},clearReloadWarning:function(){if(this.warningRow){this.warningRow.parentNode.removeChild(this.warningRow);
		delete this.warningRow
		}},appendObject:function(object,row,rep){if(!rep){rep=Firebug.getRep(object)
		}return rep.tag.append({object:object},row)
		},appendFormatted:function(objects,row,rep){if(!objects||!objects.length){return
		}function logText(text,row){var node=row.ownerDocument.createTextNode(text);
		row.appendChild(node)
		}var format=objects[0];
		var objIndex=0;
		if(typeof(format)!="string"){format="";
		objIndex=-1
		}else{if(objects.length===1){if(format.length<1){logText("(an empty string)",row);
		return
		}}}var parts=parseFormat(format);
		var trialIndex=objIndex;
		for(var i=0;
		i<parts.length;
		i++){var part=parts[i];
		if(part&&typeof(part)=="object"){if(++trialIndex>objects.length){format="";
		objIndex=-1;
		parts.length=0;
		break
		}}}for(var i=0;
		i<parts.length;
		++i){var part=parts[i];
		if(part&&typeof(part)=="object"){var object=objects[++objIndex];
		if(typeof(object)!="undefined"){this.appendObject(object,row,part.rep)
		}else{this.appendObject(part.type,row,FirebugReps.Text)
		}}else{FirebugReps.Text.tag.append({object:part},row)
		}}for(var i=objIndex+1;
		i<objects.length;
		++i){logText(" ",row);
		var object=objects[i];
		if(typeof(object)=="string"){FirebugReps.Text.tag.append({object:object},row)
		}else{this.appendObject(object,row)
		}}},appendOpenGroup:function(objects,row,rep){if(!this.groups){this.groups=[]
		}setClass(row,"logGroup");
		setClass(row,"opened");
		var innerRow=this.createRow("logRow");
		setClass(innerRow,"logGroupLabel");
		if(rep){rep.tag.replace({objects:objects},innerRow)
		}else{this.appendFormatted(objects,innerRow,rep)
		}row.appendChild(innerRow);
		var groupBody=this.createRow("logGroupBody");
		row.appendChild(groupBody);
		groupBody.setAttribute("role","group");
		this.groups.push(groupBody);
		addEvent(innerRow,"mousedown",function(event){if(isLeftClick(event)){var target=event.target||event.srcElement;
		target=getAncestorByClass(target,"logGroupLabel");
		var groupRow=target.parentNode;
		if(hasClass(groupRow,"opened")){removeClass(groupRow,"opened");
		target.setAttribute("aria-expanded","false")
		}else{setClass(groupRow,"opened");
		target.setAttribute("aria-expanded","true")
		}}})
		},appendCloseGroup:function(object,row,rep){if(this.groups){this.groups.pop()
		}},onMouseMove:function(event){if(!Firebug.Inspector){return
		}var target=event.srcElement||event.target;
		var object=getAncestorByClass(target,"objectLink-element");
		object=object?object.repObject:null;
		if(object&&instanceOf(object,"Element")&&object.nodeType==1){if(object!=lastHighlightedObject){Firebug.Inspector.drawBoxModel(object);
		object=lastHighlightedObject
		}}else{Firebug.Inspector.hideBoxModel()
		}},onMouseDown:function(event){var target=event.srcElement||event.target;
		var object=getAncestorByClass(target,"objectLink");
		var repObject=object?object.repObject:null;
		if(!repObject){return
		}if(hasClass(object,"objectLink-object")){Firebug.chrome.selectPanel("DOM");
		Firebug.chrome.getPanel("DOM").select(repObject,true)
		}else{if(hasClass(object,"objectLink-element")){Firebug.chrome.selectPanel("HTML");
		Firebug.chrome.getPanel("HTML").select(repObject,true)
		}}},name:"Console",title:"Console",options:{hasCommandLine:true,hasToolButtons:true,isPreRendered:true},create:function(){Firebug.Panel.create.apply(this,arguments);
		this.context=Firebug.browser.window;
		this.document=Firebug.chrome.document;
		this.onMouseMove=bind(this.onMouseMove,this);
		this.onMouseDown=bind(this.onMouseDown,this);
		this.clearButton=new Button({element:$("fbConsole_btClear"),owner:Firebug.Console,onClick:Firebug.Console.clear})
		},initialize:function(){Firebug.Panel.initialize.apply(this,arguments);
		if(!this.persistedContent&&Firebug.Console.isAlwaysEnabled()){this.insertLogLimit(this.context);
		this.updateMaxLimit();
		if(this.context.consoleReloadWarning){this.insertReloadWarning()
		}}addEvent(this.panelNode,"mouseover",this.onMouseMove);
		addEvent(this.panelNode,"mousedown",this.onMouseDown);
		this.clearButton.initialize()
		},initializeNode:function(){if(FBTrace.DBG_CONSOLE){this.onScroller=bind(this.onScroll,this);
		addEvent(this.panelNode,"scroll",this.onScroller)
		}this.onResizer=bind(this.onResize,this);
		this.resizeEventTarget=Firebug.chrome.$("fbContentBox");
		addEvent(this.resizeEventTarget,"resize",this.onResizer)
		},destroyNode:function(){if(this.onScroller){removeEvent(this.panelNode,"scroll",this.onScroller)
		}},shutdown:function(){this.clearButton.shutdown();
		removeEvent(this.panelNode,"mousemove",this.onMouseMove);
		removeEvent(this.panelNode,"mousedown",this.onMouseDown);
		this.destroyNode();
		Firebug.Panel.shutdown.apply(this,arguments)
		},ishow:function(state){if(FBTrace.DBG_CONSOLE){FBTrace.sysout("Console.panel show; "+this.context.getName(),state)
		}var enabled=Firebug.Console.isAlwaysEnabled();
		if(enabled){Firebug.Console.disabledPanelPage.hide(this);
		this.showCommandLine(true);
		this.showToolbarButtons("fbConsoleButtons",true);
		Firebug.chrome.setGlobalAttribute("cmd_togglePersistConsole","checked",this.persistContent);
		if(state&&state.wasScrolledToBottom){this.wasScrolledToBottom=state.wasScrolledToBottom;
		delete state.wasScrolledToBottom
		}if(this.wasScrolledToBottom){scrollToBottom(this.panelNode)
		}if(FBTrace.DBG_CONSOLE){FBTrace.sysout("console.show ------------------ wasScrolledToBottom: "+this.wasScrolledToBottom+", "+this.context.getName())
		}}else{this.hide(state);
		Firebug.Console.disabledPanelPage.show(this)
		}},ihide:function(state){if(FBTrace.DBG_CONSOLE){FBTrace.sysout("Console.panel hide; "+this.context.getName(),state)
		}this.showToolbarButtons("fbConsoleButtons",false);
		this.showCommandLine(false);
		if(FBTrace.DBG_CONSOLE){FBTrace.sysout("console.hide ------------------ wasScrolledToBottom: "+this.wasScrolledToBottom+", "+this.context.getName())
		}},destroy:function(state){if(this.panelNode.offsetHeight){this.wasScrolledToBottom=isScrolledToBottom(this.panelNode)
		}if(state){state.wasScrolledToBottom=this.wasScrolledToBottom
		}if(FBTrace.DBG_CONSOLE){FBTrace.sysout("console.destroy ------------------ wasScrolledToBottom: "+this.wasScrolledToBottom+", "+this.context.getName())
		}},shouldBreakOnNext:function(){return Firebug.getPref(Firebug.servicePrefDomain,"breakOnErrors")
		},getBreakOnNextTooltip:function(enabled){return(enabled?$STR("console.Disable Break On All Errors"):$STR("console.Break On All Errors"))
		},enablePanel:function(module){if(FBTrace.DBG_CONSOLE){FBTrace.sysout("console.ConsolePanel.enablePanel; "+this.context.getName())
		}Firebug.ActivablePanel.enablePanel.apply(this,arguments);
		this.showCommandLine(true);
		if(this.wasScrolledToBottom){scrollToBottom(this.panelNode)
		}},disablePanel:function(module){if(FBTrace.DBG_CONSOLE){FBTrace.sysout("console.ConsolePanel.disablePanel; "+this.context.getName())
		}Firebug.ActivablePanel.disablePanel.apply(this,arguments);
		this.showCommandLine(false)
		},getOptionsMenuItems:function(){return[optionMenu("ShowJavaScriptErrors","showJSErrors"),optionMenu("ShowJavaScriptWarnings","showJSWarnings"),optionMenu("ShowCSSErrors","showCSSErrors"),optionMenu("ShowXMLErrors","showXMLErrors"),optionMenu("ShowXMLHttpRequests","showXMLHttpRequests"),optionMenu("ShowChromeErrors","showChromeErrors"),optionMenu("ShowChromeMessages","showChromeMessages"),optionMenu("ShowExternalErrors","showExternalErrors"),optionMenu("ShowNetworkErrors","showNetworkErrors"),this.getShowStackTraceMenuItem(),this.getStrictOptionMenuItem(),"-",optionMenu("LargeCommandLine","largeCommandLine")]
		},getShowStackTraceMenuItem:function(){var menuItem=serviceOptionMenu("ShowStackTrace","showStackTrace");
		if(FirebugContext&&!Firebug.Debugger.isAlwaysEnabled()){menuItem.disabled=true
		}return menuItem
		},getStrictOptionMenuItem:function(){var strictDomain="javascript.options";
		var strictName="strict";
		var strictValue=prefs.getBoolPref(strictDomain+"."+strictName);
		return{label:"JavascriptOptionsStrict",type:"checkbox",checked:strictValue,command:bindFixed(Firebug.setPref,Firebug,strictDomain,strictName,!strictValue)}
		},getBreakOnMenuItems:function(){return[]
		},search:function(text){if(!text){return
		}if(this.matchSet){for(var i in this.matchSet){removeClass(this.matchSet[i],"matched")
		}}this.matchSet=[];
		function findRow(node){return getAncestorByClass(node,"logRow")
		}var search=new TextSearch(this.panelNode,findRow);
		var logRow=search.find(text);
		if(!logRow){dispatch([Firebug.A11yModel],"onConsoleSearchMatchFound",[this,text,[]]);
		return false
		}for(;
		logRow;
		logRow=search.findNext()){setClass(logRow,"matched");
		this.matchSet.push(logRow)
		}dispatch([Firebug.A11yModel],"onConsoleSearchMatchFound",[this,text,this.matchSet]);
		return true
		},breakOnNext:function(breaking){Firebug.setPref(Firebug.servicePrefDomain,"breakOnErrors",breaking)
		},createRow:function(rowName,className){var elt=this.document.createElement("div");
		elt.className=rowName+(className?" "+rowName+"-"+className:"");
		return elt
		},getTopContainer:function(){if(this.groups&&this.groups.length){return this.groups[this.groups.length-1]
		}else{return this.panelNode
		}},filterLogRow:function(logRow,scrolledToBottom){if(this.searchText){setClass(logRow,"matching");
		setClass(logRow,"matched");
		setTimeout(bindFixed(function(){if(this.searchFilter(this.searchText,logRow)){this.matchSet.push(logRow)
		}else{removeClass(logRow,"matched")
		}removeClass(logRow,"matching");
		if(scrolledToBottom){scrollToBottom(this.panelNode)
		}},this),100)
		}},searchFilter:function(text,logRow){var count=this.panelNode.childNodes.length;
		var searchRange=this.document.createRange();
		searchRange.setStart(this.panelNode,0);
		searchRange.setEnd(this.panelNode,count);
		var startPt=this.document.createRange();
		startPt.setStartBefore(logRow);
		var endPt=this.document.createRange();
		endPt.setStartAfter(logRow);
		return finder.Find(text,searchRange,startPt,endPt)!=null
		},observe:function(subject,topic,data){if(topic!="nsPref:changed"){return
		}var prefDomain="Firebug.extension.";
		var prefName=data.substr(prefDomain.length);
		if(prefName=="console.logLimit"){this.updateMaxLimit()
		}},updateMaxLimit:function(){var value=1000;
		maxQueueRequests=value?value:maxQueueRequests
		},showCommandLine:function(shouldShow){return;
		if(shouldShow){collapse(Firebug.chrome.$("fbCommandBox"),false);
		Firebug.CommandLine.setMultiLine(Firebug.largeCommandLine,Firebug.chrome)
		}else{Firebug.CommandLine.setMultiLine(false,Firebug.chrome,Firebug.largeCommandLine);
		collapse(Firebug.chrome.$("fbCommandBox"),true)
		}},onScroll:function(event){this.wasScrolledToBottom=FBL.isScrolledToBottom(this.panelNode);
		if(FBTrace.DBG_CONSOLE){FBTrace.sysout("console.onScroll ------------------ wasScrolledToBottom: "+this.wasScrolledToBottom+", wasScrolledToBottom: "+this.context.getName(),event)
		}},onResize:function(event){if(FBTrace.DBG_CONSOLE){FBTrace.sysout("console.onResize ------------------ wasScrolledToBottom: "+this.wasScrolledToBottom+", offsetHeight: "+this.panelNode.offsetHeight+", scrollTop: "+this.panelNode.scrollTop+", scrollHeight: "+this.panelNode.scrollHeight+", "+this.context.getName(),event)
		}if(this.wasScrolledToBottom){scrollToBottom(this.panelNode)
		}}});
		function parseFormat(format){var parts=[];
		if(format.length<=0){return parts
		}var reg=/((^%|.%)(\d+)?(\.)([a-zA-Z]))|((^%|.%)([a-zA-Z]))/;
		for(var m=reg.exec(format);
		m;
		m=reg.exec(format)){if(m[0].substr(0,2)=="%%"){parts.push(format.substr(0,m.index));
		parts.push(m[0].substr(1))
		}else{var type=m[8]?m[8]:m[5];
		var precision=m[3]?parseInt(m[3]):(m[4]=="."?-1:0);
		var rep=null;
		switch(type){case"s":rep=FirebugReps.Text;
		break;
		case"f":case"i":case"d":rep=FirebugReps.Number;
		break;
		case"o":rep=null;
		break
		}parts.push(format.substr(0,m[0][0]=="%"?m.index:m.index+1));
		parts.push({rep:rep,precision:precision,type:("%"+type)})
		}format=format.substr(m.index+m[0].length)
		}parts.push(format);
		return parts
		}var appendObject=Firebug.ConsolePanel.prototype.appendObject;
		var appendFormatted=Firebug.ConsolePanel.prototype.appendFormatted;
		var appendOpenGroup=Firebug.ConsolePanel.prototype.appendOpenGroup;
		var appendCloseGroup=Firebug.ConsolePanel.prototype.appendCloseGroup;
		Firebug.registerModule(Firebug.Console);
		Firebug.registerPanel(Firebug.ConsolePanel)
		}});
		FBL.ns(function(){with(FBL){var frameCounters={};
		var traceRecursion=0;
		Firebug.Console.injector={install:function(context){var win=context.window;
		var consoleHandler=new FirebugConsoleHandler(context,win);
		var properties=["log","debug","info","warn","error","assert","dir","dirxml","group","groupCollapsed","groupEnd","time","timeEnd","count","trace","profile","profileEnd","clear","open","close"];
		var Handler=function(name){var c=consoleHandler;
		var f=consoleHandler[name];
		return function(){return f.apply(c,arguments)
		}
		};
		var installer=function(c){for(var i=0,l=properties.length;
		i<l;
		i++){var name=properties[i];
		c[name]=new Handler(name);
		c.firebuglite=Firebug.version
		}};
		var sandbox;
		if(win.console){if(Env.Options.overrideConsole){sandbox=new win.Function("arguments.callee.install(window.console={})")
		}else{return
		}}else{try{sandbox=new win.Function("arguments.callee.install(window.console={})")
		}catch(E){sandbox=new win.Function("arguments.callee.install(window.firebug={})")
		}}sandbox.install=installer;
		sandbox()
		},isAttached:function(context,win){if(win.wrappedJSObject){var attached=(win.wrappedJSObject._getFirebugConsoleElement?true:false);
		if(FBTrace.DBG_CONSOLE){FBTrace.sysout("Console.isAttached:"+attached+" to win.wrappedJSObject "+safeGetWindowLocation(win.wrappedJSObject))
		}return attached
		}else{if(FBTrace.DBG_CONSOLE){FBTrace.sysout("Console.isAttached? to win "+win.location+" fnc:"+win._getFirebugConsoleElement)
		}return(win._getFirebugConsoleElement?true:false)
		}},attachIfNeeded:function(context,win){if(FBTrace.DBG_CONSOLE){FBTrace.sysout("Console.attachIfNeeded has win "+(win?((win.wrappedJSObject?"YES":"NO")+" wrappedJSObject"):"null"))
		}if(this.isAttached(context,win)){return true
		}if(FBTrace.DBG_CONSOLE){FBTrace.sysout("Console.attachIfNeeded found isAttached false ")
		}this.attachConsoleInjector(context,win);
		this.addConsoleListener(context,win);
		Firebug.Console.clearReloadWarning(context);
		var attached=this.isAttached(context,win);
		if(attached){dispatch(Firebug.Console.fbListeners,"onConsoleInjected",[context,win])
		}return attached
		},attachConsoleInjector:function(context,win){var consoleInjection=this.getConsoleInjectionScript();
		if(FBTrace.DBG_CONSOLE){FBTrace.sysout("attachConsoleInjector evaluating in "+win.location,consoleInjection)
		}Firebug.CommandLine.evaluateInWebPage(consoleInjection,context,win);
		if(FBTrace.DBG_CONSOLE){FBTrace.sysout("attachConsoleInjector evaluation completed for "+win.location)
		}},getConsoleInjectionScript:function(){if(!this.consoleInjectionScript){var script="";
		script+="window.__defineGetter__('console', function() {\n";
		script+=" return (window._firebug ? window._firebug : window.loadFirebugConsole()); })\n\n";
		script+="window.loadFirebugConsole = function() {\n";
		script+="window._firebug =  new _FirebugConsole();";
		if(FBTrace.DBG_CONSOLE){script+=" window.dump('loadFirebugConsole '+window.location+'\\n');\n"
		}script+=" return window._firebug };\n";
		var theFirebugConsoleScript=getResource("chrome://firebug/content/consoleInjected.js");
		script+=theFirebugConsoleScript;
		this.consoleInjectionScript=script
		}return this.consoleInjectionScript
		},forceConsoleCompilationInPage:function(context,win){if(!win){if(FBTrace.DBG_CONSOLE){FBTrace.sysout("no win in forceConsoleCompilationInPage!")
		}return
		}var consoleForcer="window.loadFirebugConsole();";
		if(context.stopped){Firebug.Console.injector.evaluateConsoleScript(context)
		}else{Firebug.CommandLine.evaluateInWebPage(consoleForcer,context,win)
		}if(FBTrace.DBG_CONSOLE){FBTrace.sysout("forceConsoleCompilationInPage "+win.location,consoleForcer)
		}},evaluateConsoleScript:function(context){var scriptSource=this.getConsoleInjectionScript();
		Firebug.Debugger.evaluate(scriptSource,context)
		},addConsoleListener:function(context,win){if(!context.activeConsoleHandlers){context.activeConsoleHandlers=[]
		}else{for(var i=0;
		i<context.activeConsoleHandlers.length;
		i++){if(context.activeConsoleHandlers[i].window==win){context.activeConsoleHandlers[i].detach();
		if(FBTrace.DBG_CONSOLE){FBTrace.sysout("consoleInjector addConsoleListener removed handler("+context.activeConsoleHandlers[i].handler_name+") from _firebugConsole in : "+win.location+"\n")
		}context.activeConsoleHandlers.splice(i,1)
		}}}var element=Firebug.Console.getFirebugConsoleElement(context,win);
		if(element){element.setAttribute("FirebugVersion",Firebug.version)
		}else{return false
		}var handler=new FirebugConsoleHandler(context,win);
		handler.attachTo(element);
		context.activeConsoleHandlers.push(handler);
		if(FBTrace.DBG_CONSOLE){FBTrace.sysout("consoleInjector addConsoleListener attached handler("+handler.handler_name+") to _firebugConsole in : "+win.location+"\n")
		}return true
		},detachConsole:function(context,win){if(win&&win.document){var element=win.document.getElementById("_firebugConsole");
		if(element){element.parentNode.removeChild(element)
		}}}};
		var total_handlers=0;
		var FirebugConsoleHandler=function FirebugConsoleHandler(context,win){this.window=win;
		this.attachTo=function(element){this.element=element;
		this.boundHandler=bind(this.handleEvent,this);
		this.element.addEventListener("firebugAppendConsole",this.boundHandler,true)
		};
		this.detach=function(){this.element.removeEventListener("firebugAppendConsole",this.boundHandler,true)
		};
		this.handler_name=++total_handlers;
		this.handleEvent=function(event){if(FBTrace.DBG_CONSOLE){FBTrace.sysout("FirebugConsoleHandler("+this.handler_name+") "+event.target.getAttribute("methodName")+", event",event)
		}if(!Firebug.CommandLine.CommandHandler.handle(event,this,win)){if(FBTrace.DBG_CONSOLE){FBTrace.sysout("FirebugConsoleHandler",this)
		}var methodName=event.target.getAttribute("methodName");
		Firebug.Console.log($STRF("console.MethodNotSupported",[methodName]))
		}};
		this.firebuglite=Firebug.version;
		this.init=function(){var consoleElement=win.document.getElementById("_firebugConsole");
		consoleElement.setAttribute("FirebugVersion",Firebug.version)
		};
		this.log=function(){logFormatted(arguments,"log")
		};
		this.debug=function(){logFormatted(arguments,"debug",true)
		};
		this.info=function(){logFormatted(arguments,"info",true)
		};
		this.warn=function(){logFormatted(arguments,"warn",true)
		};
		this.error=function(){logFormatted(arguments,"error",true)
		};
		this.exception=function(){logAssert("error",arguments)
		};
		this.assert=function(x){if(!x){var rest=[];
		for(var i=1;
		i<arguments.length;
		i++){rest.push(arguments[i])
		}logAssert("assert",rest)
		}};
		this.dir=function(o){Firebug.Console.log(o,context,"dir",Firebug.DOMPanel.DirTable)
		};
		this.dirxml=function(o){if(instanceOf(o,"Window")){o=o.document.documentElement
		}else{if(instanceOf(o,"Document")){o=o.documentElement
		}}Firebug.Console.log(o,context,"dirxml",Firebug.HTMLPanel.SoloElement)
		};
		this.group=function(){var sourceLink=null;
		Firebug.Console.openGroup(arguments,null,"group",null,false,sourceLink)
		};
		this.groupEnd=function(){Firebug.Console.closeGroup(context)
		};
		this.groupCollapsed=function(){var sourceLink=getStackLink();
		var row=Firebug.Console.openGroup(arguments,null,"group",null,true,sourceLink);
		removeClass(row,"opened")
		};
		this.profile=function(title){logFormatted(["console.profile() not supported."],"warn",true)
		};
		this.profileEnd=function(){logFormatted(["console.profile() not supported."],"warn",true)
		};
		this.count=function(key){var frameId="0";
		if(frameId){if(!frameCounters){frameCounters={}
		}if(key!=undefined){frameId+=key
		}var frameCounter=frameCounters[frameId];
		if(!frameCounter){var logRow=logFormatted(["0"],null,true,true);
		frameCounter={logRow:logRow,count:1};
		frameCounters[frameId]=frameCounter
		}else{++frameCounter.count
		}var label=key==undefined?frameCounter.count:key+" "+frameCounter.count;
		frameCounter.logRow.firstChild.firstChild.nodeValue=label
		}};
		this.trace=function(){var getFuncName=function getFuncName(f){if(f.getName instanceof Function){return f.getName()
		}if(f.name){return f.name
		}var name=f.toString().match(/function\s*([_$\w\d]*)/)[1];
		return name||"anonymous"
		};
		var wasVisited=function(fn){for(var i=0,l=frames.length;
		i<l;
		i++){if(frames[i].fn==fn){return true
		}}return false
		};
		traceRecursion++;
		if(traceRecursion>1){traceRecursion--;
		return
		}var frames=[];
		for(var fn=arguments.callee.caller.caller;
		fn;
		fn=fn.caller){if(wasVisited(fn)){break
		}var args=[];
		for(var i=0,l=fn.arguments.length;
		i<l;
		++i){args.push({value:fn.arguments[i]})
		}frames.push({fn:fn,name:getFuncName(fn),args:args})
		}try{(0)()
		}catch(e){var result=e;
		var stack=result.stack||result.stacktrace||"";
		stack=stack.replace(/\n\r|\r\n/g,"\n");
		var items=stack.split(/[\n\r]/);
		if(FBL.isSafari){var reChromeStackItem=/^\s+at\s+(.*)((?:http|https|ftp|file):\/\/.*)$/;
		var reChromeStackItemName=/\s*\($/;
		var reChromeStackItemValue=/^(.+)\:(\d+\:\d+)\)?$/;
		var framePos=0;
		for(var i=4,length=items.length;
		i<length;
		i++,framePos++){var frame=frames[framePos];
		var item=items[i];
		var match=item.match(reChromeStackItem);
		if(match){var name=match[1];
		if(name){name=name.replace(reChromeStackItemName,"");
		frame.name=name
		}var value=match[2].match(reChromeStackItemValue);
		if(value){frame.href=value[1];
		frame.lineNo=value[2]
		}}}}else{if(FBL.isFirefox){var reFirefoxStackItem=/^(.*)@(.*)$/;
		var reFirefoxStackItemValue=/^(.+)\:(\d+)$/;
		var framePos=0;
		for(var i=2,length=items.length;
		i<length;
		i++,framePos++){var frame=frames[framePos]||{};
		var item=items[i];
		var match=item.match(reFirefoxStackItem);
		if(match){var name=match[1];
		var value=match[2].match(reFirefoxStackItemValue);
		if(value){frame.href=value[1];
		frame.lineNo=value[2]
		}}}}}}Firebug.Console.log({frames:frames},context,"stackTrace",FirebugReps.StackTrace);
		traceRecursion--
		};
		this.trace_ok=function(){var getFuncName=function getFuncName(f){if(f.getName instanceof Function){return f.getName()
		}if(f.name){return f.name
		}var name=f.toString().match(/function\s*([_$\w\d]*)/)[1];
		return name||"anonymous"
		};
		var wasVisited=function(fn){for(var i=0,l=frames.length;
		i<l;
		i++){if(frames[i].fn==fn){return true
		}}return false
		};
		var frames=[];
		for(var fn=arguments.callee.caller;
		fn;
		fn=fn.caller){if(wasVisited(fn)){break
		}var args=[];
		for(var i=0,l=fn.arguments.length;
		i<l;
		++i){args.push({value:fn.arguments[i]})
		}frames.push({fn:fn,name:getFuncName(fn),args:args})
		}Firebug.Console.log({frames:frames},context,"stackTrace",FirebugReps.StackTrace)
		};
		this.clear=function(){Firebug.Console.clear(context)
		};
		this.time=function(name,reset){if(!name){return
		}var time=new Date().getTime();
		if(!this.timeCounters){this.timeCounters={}
		}var key="KEY"+name.toString();
		if(!reset&&this.timeCounters[key]){return
		}this.timeCounters[key]=time
		};
		this.timeEnd=function(name){var time=new Date().getTime();
		if(!this.timeCounters){return
		}var key="KEY"+name.toString();
		var timeCounter=this.timeCounters[key];
		if(timeCounter){var diff=time-timeCounter;
		var label=name+": "+diff+"ms";
		this.info(label);
		delete this.timeCounters[key]
		}return diff
		};
		this.evaluated=function(result,context){if(FBTrace.DBG_CONSOLE){FBTrace.sysout("consoleInjector.FirebugConsoleHandler evalutated default called",result)
		}Firebug.Console.log(result,context)
		};
		this.evaluateError=function(result,context){Firebug.Console.log(result,context,"errorMessage")
		};
		function logFormatted(args,className,linkToSource,noThrottle){var sourceLink=linkToSource?getStackLink():null;
		return Firebug.Console.logFormatted(args,context,className,noThrottle,sourceLink)
		}function logAssert(category,args){Firebug.Errors.increaseCount(context);
		if(!args||!args.length||args.length==0){var msg=[FBL.$STR("Assertion")]
		}else{var msg=args[0]
		}if(Firebug.errorStackTrace){var trace=Firebug.errorStackTrace;
		delete Firebug.errorStackTrace;
		if(FBTrace.DBG_CONSOLE){FBTrace.sysout("logAssert trace from errorStackTrace",trace)
		}}else{if(msg.stack){var trace=parseToStackTrace(msg.stack);
		if(FBTrace.DBG_CONSOLE){FBTrace.sysout("logAssert trace from msg.stack",trace)
		}}else{var trace=getJSDUserStack();
		if(FBTrace.DBG_CONSOLE){FBTrace.sysout("logAssert trace from getJSDUserStack",trace)
		}}}var errorObject=new FBL.ErrorMessage(msg,(msg.fileName?msg.fileName:win.location),(msg.lineNumber?msg.lineNumber:0),"",category,context,trace);
		if(trace&&trace.frames&&trace.frames[0]){errorObject.correctWithStackTrace(trace)
		}errorObject.resetSource();
		var objects=errorObject;
		if(args.length>1){objects=[errorObject];
		for(var i=1;
		i<args.length;
		i++){objects.push(args[i])
		}}var row=Firebug.Console.log(objects,context,"errorMessage",null,true);
		row.scrollIntoView()
		}function getComponentsStackDump(){var frame=Components.stack;
		var userURL=win.location.href.toString();
		if(FBTrace.DBG_CONSOLE){FBTrace.sysout("consoleInjector.getComponentsStackDump initial stack for userURL "+userURL,frame)
		}while(frame&&FBL.isSystemURL(frame.filename)){frame=frame.caller
		}if(frame){frame=frame.caller
		}if(frame){frame=frame.caller
		}if(FBTrace.DBG_CONSOLE){FBTrace.sysout("consoleInjector.getComponentsStackDump final stack for userURL "+userURL,frame)
		}return frame
		}function getStackLink(){return
		}function getJSDUserStack(){var trace=FBL.getCurrentStackTrace(context);
		var frames=trace?trace.frames:null;
		if(frames&&(frames.length>0)){var oldest=frames.length-1;
		for(var i=0;
		i<frames.length;
		i++){if(frames[oldest-i].href.indexOf("chrome:")==0){break
		}var fn=frames[oldest-i].fn+"";
		if(fn&&(fn.indexOf("_firebugEvalEvent")!=-1)){break
		}}FBTrace.sysout("consoleInjector getJSDUserStack: "+frames.length+" oldest: "+oldest+" i: "+i+" i - oldest + 2: "+(i-oldest+2),trace);
		trace.frames=trace.frames.slice(2-i);
		return trace
		}else{return"Firebug failed to get stack trace with any frames"
		}}};
		FBL.registerConsole=function(){var win=Env.browser.window;
		Firebug.Console.injector.install(win)
		};
		registerConsole()
		}});
		FBL.ns(function(){with(FBL){var commandPrefix=">>>";
		var reOpenBracket=/[\[\(\{]/;
		var reCloseBracket=/[\]\)\}]/;
		var commandHistory=[];
		var commandPointer=-1;
		var isAutoCompleting=null;
		var autoCompletePrefix=null;
		var autoCompleteExpr=null;
		var autoCompleteBuffer=null;
		var autoCompletePosition=null;
		var fbCommandLine=null;
		var fbLargeCommandLine=null;
		var fbLargeCommandButtons=null;
		var _completion={window:["console"],document:["getElementById","getElementsByTagName"]};
		var _stack=function(command){Firebug.context.persistedState.commandHistory.push(command);
		Firebug.context.persistedState.commandPointer=Firebug.context.persistedState.commandHistory.length
		};
		Firebug.CommandLine=extend(Firebug.Module,{element:null,isMultiLine:false,isActive:false,initialize:function(doc){this.clear=bind(this.clear,this);
		this.enter=bind(this.enter,this);
		this.onError=bind(this.onError,this);
		this.onKeyDown=bind(this.onKeyDown,this);
		this.onMultiLineKeyDown=bind(this.onMultiLineKeyDown,this);
		addEvent(Firebug.browser.window,"error",this.onError);
		addEvent(Firebug.chrome.window,"error",this.onError)
		},shutdown:function(doc){this.deactivate();
		removeEvent(Firebug.browser.window,"error",this.onError);
		removeEvent(Firebug.chrome.window,"error",this.onError)
		},activate:function(multiLine,hideToggleIcon,onRun){defineCommandLineAPI();
		Firebug.context.persistedState.commandHistory=Firebug.context.persistedState.commandHistory||[];
		Firebug.context.persistedState.commandPointer=Firebug.context.persistedState.commandPointer||-1;
		if(this.isActive){if(this.isMultiLine==multiLine){return
		}this.deactivate()
		}fbCommandLine=$("fbCommandLine");
		fbLargeCommandLine=$("fbLargeCommandLine");
		fbLargeCommandButtons=$("fbLargeCommandButtons");
		if(multiLine){onRun=onRun||this.enter;
		this.isMultiLine=true;
		this.element=fbLargeCommandLine;
		addEvent(this.element,"keydown",this.onMultiLineKeyDown);
		addEvent($("fbSmallCommandLineIcon"),"click",Firebug.chrome.hideLargeCommandLine);
		this.runButton=new Button({element:$("fbCommand_btRun"),owner:Firebug.CommandLine,onClick:onRun});
		this.runButton.initialize();
		this.clearButton=new Button({element:$("fbCommand_btClear"),owner:Firebug.CommandLine,onClick:this.clear});
		this.clearButton.initialize()
		}else{this.isMultiLine=false;
		this.element=fbCommandLine;
		if(!fbCommandLine){return
		}addEvent(this.element,"keydown",this.onKeyDown)
		}if(isOpera){fixOperaTabKey(this.element)
		}if(this.lastValue){this.element.value=this.lastValue
		}this.isActive=true
		},deactivate:function(){if(!this.isActive){return
		}this.isActive=false;
		this.lastValue=this.element.value;
		if(this.isMultiLine){removeEvent(this.element,"keydown",this.onMultiLineKeyDown);
		removeEvent($("fbSmallCommandLineIcon"),"click",Firebug.chrome.hideLargeCommandLine);
		this.runButton.destroy();
		this.clearButton.destroy()
		}else{removeEvent(this.element,"keydown",this.onKeyDown)
		}this.element=null;
		delete this.element;
		fbCommandLine=null;
		fbLargeCommandLine=null;
		fbLargeCommandButtons=null
		},focus:function(){this.element.focus()
		},blur:function(){this.element.blur()
		},clear:function(){this.element.value=""
		},evaluate:function(expr){var api="Firebug.CommandLine.API";
		var result=Firebug.context.evaluate(expr,"window",api,Firebug.Console.error);
		return result
		},enter:function(){var command=this.element.value;
		if(!command){return
		}_stack(command);
		Firebug.Console.log(commandPrefix+" "+stripNewLines(command),Firebug.browser,"command",FirebugReps.Text);
		var result=this.evaluate(command);
		Firebug.Console.log(result)
		},prevCommand:function(){if(Firebug.context.persistedState.commandPointer>0&&Firebug.context.persistedState.commandHistory.length>0){this.element.value=Firebug.context.persistedState.commandHistory[--Firebug.context.persistedState.commandPointer]
		}},nextCommand:function(){var element=this.element;
		var limit=Firebug.context.persistedState.commandHistory.length-1;
		var i=Firebug.context.persistedState.commandPointer;
		if(i<limit){element.value=Firebug.context.persistedState.commandHistory[++Firebug.context.persistedState.commandPointer]
		}else{if(i==limit){++Firebug.context.persistedState.commandPointer;
		element.value=""
		}}},autocomplete:function(reverse){var element=this.element;
		var command=element.value;
		var offset=getExpressionOffset(command);
		var valBegin=offset?command.substr(0,offset):"";
		var val=command.substr(offset);
		var buffer,obj,objName,commandBegin,result,prefix;
		if(!isAutoCompleting){var reObj=/(.*[^_$\w\d\.])?((?:[_$\w][_$\w\d]*\.)*)([_$\w][_$\w\d]*)?$/;
		var r=reObj.exec(val);
		if(r[1]||r[2]||r[3]){commandBegin=r[1]||"";
		objName=r[2]||"";
		prefix=r[3]||""
		}else{if(val==""){commandBegin=objName=prefix=""
		}else{return
		}}isAutoCompleting=true;
		if(objName==""){obj=window
		}else{objName=objName.replace(/\.$/,"");
		var n=objName.split(".");
		var target=window,o;
		for(var i=0,ni;
		ni=n[i];
		i++){if(o=target[ni]){target=o
		}else{target=null;
		break
		}}obj=target
		}if(obj){autoCompletePrefix=prefix;
		autoCompleteExpr=valBegin+commandBegin+(objName?objName+".":"");
		autoCompletePosition=-1;
		buffer=autoCompleteBuffer=isIE?_completion[objName||"window"]||[]:[];
		for(var p in obj){buffer.push(p)
		}}}else{buffer=autoCompleteBuffer
		}if(buffer){prefix=autoCompletePrefix;
		var diff=reverse?-1:1;
		for(var i=autoCompletePosition+diff,l=buffer.length,bi;
		i>=0&&i<l;
		i+=diff){bi=buffer[i];
		if(bi.indexOf(prefix)==0){autoCompletePosition=i;
		result=bi;
		break
		}}}if(result){element.value=autoCompleteExpr+result
		}},setMultiLine:function(multiLine){if(multiLine==this.isMultiLine){return
		}this.activate(multiLine)
		},onError:function(msg,href,lineNo){href=href||"";
		var lastSlash=href.lastIndexOf("/");
		var fileName=lastSlash==-1?href:href.substr(lastSlash+1);
		var html=['<span class="errorMessage">',msg,"</span>",'<div class="objectBox-sourceLink">',fileName," (line ",lineNo,")</div>"]
		},onKeyDown:function(e){e=e||event;
		var code=e.keyCode;
		if(code!=9&&code!=16&&code!=17&&code!=18){isAutoCompleting=false
		}if(code==13){this.enter();
		this.clear()
		}else{if(code==27){setTimeout(this.clear,0)
		}else{if(code==38){this.prevCommand()
		}else{if(code==40){this.nextCommand()
		}else{if(code==9){this.autocomplete(e.shiftKey)
		}else{return
		}}}}}cancelEvent(e,true);
		return false
		},onMultiLineKeyDown:function(e){e=e||event;
		var code=e.keyCode;
		if(code==13&&e.ctrlKey){this.enter()
		}}});
		Firebug.registerModule(Firebug.CommandLine);
		function getExpressionOffset(command){var bracketCount=0;
		var start=command.length-1;
		for(;
		start>=0;
		--start){var c=command[start];
		if((c==","||c==";"||c==" ")&&!bracketCount){break
		}if(reOpenBracket.test(c)){if(bracketCount){--bracketCount
		}else{break
		}}else{if(reCloseBracket.test(c)){++bracketCount
		}}}return start+1
		}var CommandLineAPI={$:function(id){return Firebug.browser.document.getElementById(id)
		},$$:function(selector,context){context=context||Firebug.browser.document;
		return Firebug.Selector?Firebug.Selector(selector,context):Firebug.Console.error("Firebug.Selector module not loaded.")
		},$0:null,$1:null,dir:function(o){Firebug.Console.log(o,Firebug.context,"dir",Firebug.DOMPanel.DirTable)
		},dirxml:function(o){if(instanceOf(o,"Window")){o=o.document.documentElement
		}else{if(instanceOf(o,"Document")){o=o.documentElement
		}}Firebug.Console.log(o,Firebug.context,"dirxml",Firebug.HTMLPanel.SoloElement)
		}};
		var defineCommandLineAPI=function defineCommandLineAPI(){Firebug.CommandLine.API={};
		for(var m in CommandLineAPI){if(!Env.browser.window[m]){Firebug.CommandLine.API[m]=CommandLineAPI[m]
		}}var stack=FirebugChrome.htmlSelectionStack;
		if(stack){Firebug.CommandLine.API.$0=stack[0];
		Firebug.CommandLine.API.$1=stack[1]
		}}
		}});
		FBL.ns(function(){with(FBL){var ElementCache=Firebug.Lite.Cache.Element;
		var cacheID=Firebug.Lite.Cache.ID;
		var ignoreHTMLProps={sizcache:1,sizset:1};
		if(Firebug.ignoreFirebugElements){ignoreHTMLProps[cacheID]=1
		}Firebug.HTML=extend(Firebug.Module,{appendTreeNode:function(nodeArray,html){var reTrim=/^\s+|\s+$/g;
		if(!nodeArray.length){nodeArray=[nodeArray]
		}for(var n=0,node;
		node=nodeArray[n];
		n++){if(node.nodeType==1){if(Firebug.ignoreFirebugElements&&node.firebugIgnore){continue
		}var uid=ElementCache(node);
		var child=node.childNodes;
		var childLength=child.length;
		var nodeName=node.nodeName.toLowerCase();
		var nodeVisible=isVisible(node);
		var hasSingleTextChild=childLength==1&&node.firstChild.nodeType==3&&nodeName!="script"&&nodeName!="style";
		var nodeControl=!hasSingleTextChild&&childLength>0?('<div class="nodeControl"></div>'):"";
		if(isIE&&nodeControl){html.push(nodeControl)
		}if(typeof uid!="undefined"){html.push('<div class="objectBox-element" ','id="',uid,'">',!isIE&&nodeControl?nodeControl:"","<span ",cacheID,'="',uid,'"  class="nodeBox',nodeVisible?"":" nodeHidden",'">&lt;<span class="nodeTag">',nodeName,"</span>")
		}else{html.push('<div class="objectBox-element"><span class="nodeBox',nodeVisible?"":" nodeHidden",'">&lt;<span class="nodeTag">',nodeName,"</span>")
		}for(var i=0;
		i<node.attributes.length;
		++i){var attr=node.attributes[i];
		if(!attr.specified||isIE&&(browserVersion-0<9)&&typeof attr.nodeValue!="string"||Firebug.ignoreFirebugElements&&ignoreHTMLProps.hasOwnProperty(attr.nodeName)){continue
		}var name=attr.nodeName.toLowerCase();
		var value=name=="style"?formatStyles(node.style.cssText):attr.nodeValue;
		html.push('&nbsp;<span class="nodeName">',name,'</span>=&quot;<span class="nodeValue">',escapeHTML(value),"</span>&quot;")
		}if(hasSingleTextChild){var value=child[0].nodeValue.replace(reTrim,"");
		if(value){html.push('&gt;<span class="nodeText">',escapeHTML(value),'</span>&lt;/<span class="nodeTag">',nodeName,"</span>&gt;</span></div>")
		}else{html.push("/&gt;</span></div>")
		}}else{if(childLength>0){html.push("&gt;</span></div>")
		}else{html.push("/&gt;</span></div>")
		}}}else{if(node.nodeType==3){if(node.parentNode&&(node.parentNode.nodeName.toLowerCase()=="script"||node.parentNode.nodeName.toLowerCase()=="style")){var value=node.nodeValue.replace(reTrim,"");
		if(isIE){var src=value+"\n"
		}else{var src="\n"+value+"\n"
		}var match=src.match(/\n/g);
		var num=match?match.length:0;
		var s=[],sl=0;
		for(var c=1;
		c<num;
		c++){s[sl++]='<div line="'+c+'">'+c+"</div>"
		}html.push('<div class="lineNo">',s.join(""),'</div><pre class="sourceCode">',escapeHTML(src),"</pre>")
		}else{var value=node.nodeValue.replace(reTrim,"");
		if(value){html.push('<div class="nodeText">',escapeHTML(value),"</div>")
		}}}}}},appendTreeChildren:function(treeNode){var doc=Firebug.chrome.document;
		var uid=treeNode.id;
		var parentNode=ElementCache.get(uid);
		if(parentNode.childNodes.length==0){return
		}var treeNext=treeNode.nextSibling;
		var treeParent=treeNode.parentNode;
		var control=isIE?treeNode.previousSibling:treeNode.firstChild;
		control.className="nodeControl nodeMaximized";
		var html=[];
		var children=doc.createElement("div");
		children.className="nodeChildren";
		this.appendTreeNode(parentNode.childNodes,html);
		children.innerHTML=html.join("");
		treeParent.insertBefore(children,treeNext);
		var closeElement=doc.createElement("div");
		closeElement.className="objectBox-element";
		closeElement.innerHTML='&lt;/<span class="nodeTag">'+parentNode.nodeName.toLowerCase()+"&gt;</span>";
		treeParent.insertBefore(closeElement,treeNext)
		},removeTreeChildren:function(treeNode){var children=treeNode.nextSibling;
		var closeTag=children.nextSibling;
		var control=isIE?treeNode.previousSibling:treeNode.firstChild;
		control.className="nodeControl";
		children.parentNode.removeChild(children);
		closeTag.parentNode.removeChild(closeTag)
		},isTreeNodeVisible:function(id){return $(id)
		},select:function(el){var id=el&&ElementCache(el);
		if(id){this.selectTreeNode(id)
		}},selectTreeNode:function(id){id=""+id;
		var node,stack=[];
		while(id&&!this.isTreeNodeVisible(id)){stack.push(id);
		var node=ElementCache.get(id).parentNode;
		if(node){id=ElementCache(node)
		}else{break
		}}stack.push(id);
		while(stack.length>0){id=stack.pop();
		node=$(id);
		if(stack.length>0&&ElementCache.get(id).childNodes.length>0){this.appendTreeChildren(node)
		}}selectElement(node);
		if(fbPanel1){fbPanel1.scrollTop=Math.round(node.offsetTop-fbPanel1.clientHeight/2)
		}}});
		Firebug.registerModule(Firebug.HTML);
		function HTMLPanel(){}HTMLPanel.prototype=extend(Firebug.Panel,{name:"HTML",title:"HTML",options:{hasSidePanel:true,isPreRendered:!Firebug.flexChromeEnabled,innerHTMLSync:true},create:function(){Firebug.Panel.create.apply(this,arguments);
		this.panelNode.style.padding="4px 3px 1px 15px";
		this.panelNode.style.minWidth="500px";
		if(Env.Options.enablePersistent||Firebug.chrome.type!="popup"){this.createUI()
		}if(this.sidePanelBar&&!this.sidePanelBar.selectedPanel){this.sidePanelBar.selectPanel("css")
		}},destroy:function(){selectedElement=null;
		fbPanel1=null;
		selectedSidePanelTS=null;
		selectedSidePanelTimer=null;
		Firebug.Panel.destroy.apply(this,arguments)
		},createUI:function(){var rootNode=Firebug.browser.document.documentElement;
		var html=[];
		Firebug.HTML.appendTreeNode(rootNode,html);
		this.panelNode.innerHTML=html.join("")
		},initialize:function(){Firebug.Panel.initialize.apply(this,arguments);
		addEvent(this.panelNode,"click",Firebug.HTML.onTreeClick);
		fbPanel1=$("fbPanel1");
		if(!selectedElement){Firebug.context.persistedState.selectedHTMLElementId=Firebug.context.persistedState.selectedHTMLElementId&&ElementCache.get(Firebug.context.persistedState.selectedHTMLElementId)?Firebug.context.persistedState.selectedHTMLElementId:ElementCache(Firebug.browser.document.body);
		Firebug.HTML.selectTreeNode(Firebug.context.persistedState.selectedHTMLElementId)
		}addEvent(fbPanel1,"mousemove",Firebug.HTML.onListMouseMove);
		addEvent($("fbContent"),"mouseout",Firebug.HTML.onListMouseMove);
		addEvent(Firebug.chrome.node,"mouseout",Firebug.HTML.onListMouseMove)
		},shutdown:function(){removeEvent(fbPanel1,"mousemove",Firebug.HTML.onListMouseMove);
		removeEvent($("fbContent"),"mouseout",Firebug.HTML.onListMouseMove);
		removeEvent(Firebug.chrome.node,"mouseout",Firebug.HTML.onListMouseMove);
		removeEvent(this.panelNode,"click",Firebug.HTML.onTreeClick);
		fbPanel1=null;
		Firebug.Panel.shutdown.apply(this,arguments)
		},reattach:function(){if(Firebug.context.persistedState.selectedHTMLElementId){Firebug.HTML.selectTreeNode(Firebug.context.persistedState.selectedHTMLElementId)
		}},updateSelection:function(object){var id=ElementCache(object);
		if(id){Firebug.HTML.selectTreeNode(id)
		}}});
		Firebug.registerPanel(HTMLPanel);
		var formatStyles=function(styles){return isIE?styles.replace(/([^\s]+)\s*:/g,function(m,g){return g.toLowerCase()+":"
		}):styles
		};
		var selectedElement=null;
		var fbPanel1=null;
		var selectedSidePanelTS,selectedSidePanelTimer;
		var selectElement=function selectElement(e){if(e!=selectedElement){if(selectedElement){selectedElement.className="objectBox-element"
		}e.className=e.className+" selectedElement";
		if(FBL.isFirefox){e.style.MozBorderRadius="2px"
		}else{if(FBL.isSafari){e.style.WebkitBorderRadius="2px"
		}}e.style.borderRadius="2px";
		selectedElement=e;
		Firebug.context.persistedState.selectedHTMLElementId=e.id;
		var target=ElementCache.get(e.id);
		var sidePanelBar=Firebug.chrome.getPanel("HTML").sidePanelBar;
		var selectedSidePanel=sidePanelBar?sidePanelBar.selectedPanel:null;
		var stack=FirebugChrome.htmlSelectionStack;
		stack.unshift(target);
		if(stack.length>2){stack.pop()
		}var lazySelect=function(){selectedSidePanelTS=new Date().getTime();
		if(selectedSidePanel){selectedSidePanel.select(target,true)
		}};
		if(selectedSidePanelTimer){clearTimeout(selectedSidePanelTimer);
		selectedSidePanelTimer=null
		}if(new Date().getTime()-selectedSidePanelTS>100){setTimeout(lazySelect,0)
		}else{selectedSidePanelTimer=setTimeout(lazySelect,150)
		}}};
		Firebug.HTML.onTreeClick=function(e){e=e||event;
		var targ;
		if(e.target){targ=e.target
		}else{if(e.srcElement){targ=e.srcElement
		}}if(targ.nodeType==3){targ=targ.parentNode
		}if(targ.className.indexOf("nodeControl")!=-1||targ.className=="nodeTag"){if(targ.className=="nodeTag"){var control=isIE?(targ.parentNode.previousSibling||targ):(targ.parentNode.previousSibling||targ);
		selectElement(targ.parentNode.parentNode);
		if(control.className.indexOf("nodeControl")==-1){return
		}}else{control=targ
		}FBL.cancelEvent(e);
		var treeNode=isIE?control.nextSibling:control.parentNode;
		if(control.className.indexOf(" nodeMaximized")!=-1){FBL.Firebug.HTML.removeTreeChildren(treeNode)
		}else{FBL.Firebug.HTML.appendTreeChildren(treeNode)
		}}else{if(targ.className=="nodeValue"||targ.className=="nodeName"){}}};
		function onListMouseOut(e){e=e||event||window;
		var targ;
		if(e.target){targ=e.target
		}else{if(e.srcElement){targ=e.srcElement
		}}if(targ.nodeType==3){targ=targ.parentNode
		}if(hasClass(targ,"fbPanel")){FBL.Firebug.Inspector.hideBoxModel();
		hoverElement=null
		}}var hoverElement=null;
		var hoverElementTS=0;
		Firebug.HTML.onListMouseMove=function onListMouseMove(e){try{e=e||event||window;
		var targ;
		if(e.target){targ=e.target
		}else{if(e.srcElement){targ=e.srcElement
		}}if(targ.nodeType==3){targ=targ.parentNode
		}var found=false;
		while(targ&&!found){if(!/\snodeBox\s|\sobjectBox-selector\s/.test(" "+targ.className+" ")){targ=targ.parentNode
		}else{found=true
		}}if(!targ){FBL.Firebug.Inspector.hideBoxModel();
		hoverElement=null;
		return
		}if(typeof targ.attributes[cacheID]=="undefined"){return
		}var uid=targ.attributes[cacheID];
		if(!uid){return
		}var el=ElementCache.get(uid.value);
		var nodeName=el.nodeName.toLowerCase();
		if(FBL.isIE&&" meta title script link ".indexOf(" "+nodeName+" ")!=-1){return
		}if(!/\snodeBox\s|\sobjectBox-selector\s/.test(" "+targ.className+" ")){return
		}if(el.id=="FirebugUI"||" html head body br script link iframe ".indexOf(" "+nodeName+" ")!=-1){FBL.Firebug.Inspector.hideBoxModel();
		hoverElement=null;
		return
		}if((new Date().getTime()-hoverElementTS>40)&&hoverElement!=el){hoverElementTS=new Date().getTime();
		hoverElement=el;
		FBL.Firebug.Inspector.drawBoxModel(el)
		}}catch(E){}};
		Firebug.Reps={appendText:function(object,html){html.push(escapeHTML(objectToString(object)))
		},appendNull:function(object,html){html.push('<span class="objectBox-null">',escapeHTML(objectToString(object)),"</span>")
		},appendString:function(object,html){html.push('<span class="objectBox-string">&quot;',escapeHTML(objectToString(object)),"&quot;</span>")
		},appendInteger:function(object,html){html.push('<span class="objectBox-number">',escapeHTML(objectToString(object)),"</span>")
		},appendFloat:function(object,html){html.push('<span class="objectBox-number">',escapeHTML(objectToString(object)),"</span>")
		},appendFunction:function(object,html){var reName=/function ?(.*?)\(/;
		var m=reName.exec(objectToString(object));
		var name=m&&m[1]?m[1]:"function";
		html.push('<span class="objectBox-function">',escapeHTML(name),"()</span>")
		},appendObject:function(object,html){try{if(object==undefined){this.appendNull("undefined",html)
		}else{if(object==null){this.appendNull("null",html)
		}else{if(typeof object=="string"){this.appendString(object,html)
		}else{if(typeof object=="number"){this.appendInteger(object,html)
		}else{if(typeof object=="boolean"){this.appendInteger(object,html)
		}else{if(typeof object=="function"){this.appendFunction(object,html)
		}else{if(object.nodeType==1){this.appendSelector(object,html)
		}else{if(typeof object=="object"){if(typeof object.length!="undefined"){this.appendArray(object,html)
		}else{this.appendObjectFormatted(object,html)
		}}else{this.appendText(object,html)
		}}}}}}}}}catch(exc){}},appendObjectFormatted:function(object,html){var text=objectToString(object);
		var reObject=/\[object (.*?)\]/;
		var m=reObject.exec(text);
		html.push('<span class="objectBox-object">',m?m[1]:text,"</span>")
		},appendSelector:function(object,html){var uid=ElementCache(object);
		var uidString=uid?[cacheID,'="',uid,'"'].join(""):"";
		html.push('<span class="objectBox-selector"',uidString,">");
		html.push('<span class="selectorTag">',escapeHTML(object.nodeName.toLowerCase()),"</span>");
		if(object.id){html.push('<span class="selectorId">#',escapeHTML(object.id),"</span>")
		}if(object.className){html.push('<span class="selectorClass">.',escapeHTML(object.className),"</span>")
		}html.push("</span>")
		},appendNode:function(node,html){if(node.nodeType==1){var uid=ElementCache(node);
		var uidString=uid?[cacheID,'="',uid,'"'].join(""):"";
		html.push('<div class="objectBox-element"',uidString,'">',"<span ",cacheID,'="',uid,'" class="nodeBox">','&lt;<span class="nodeTag">',node.nodeName.toLowerCase(),"</span>");
		for(var i=0;
		i<node.attributes.length;
		++i){var attr=node.attributes[i];
		if(!attr.specified||attr.nodeName==cacheID){continue
		}var name=attr.nodeName.toLowerCase();
		var value=name=="style"?node.style.cssText:attr.nodeValue;
		html.push('&nbsp;<span class="nodeName">',name,'</span>=&quot;<span class="nodeValue">',escapeHTML(value),"</span>&quot;")
		}if(node.firstChild){html.push('&gt;</div><div class="nodeChildren">');
		for(var child=node.firstChild;
		child;
		child=child.nextSibling){this.appendNode(child,html)
		}html.push('</div><div class="objectBox-element">&lt;/<span class="nodeTag">',node.nodeName.toLowerCase(),"&gt;</span></span></div>")
		}else{html.push("/&gt;</span></div>")
		}}else{if(node.nodeType==3){var value=trim(node.nodeValue);
		if(value){html.push('<div class="nodeText">',escapeHTML(value),"</div>")
		}}}},appendArray:function(object,html){html.push('<span class="objectBox-array"><b>[</b> ');
		for(var i=0,l=object.length,obj;
		i<l;
		++i){this.appendObject(object[i],html);
		if(i<l-1){html.push(", ")
		}}html.push(" <b>]</b></span>")
		}}
		}});
		FBL.ns(function(){with(FBL){var maxWidth=100,maxHeight=80;
		var infoTipMargin=10;
		var infoTipWindowPadding=25;
		Firebug.InfoTip=extend(Firebug.Module,{dispatchName:"infoTip",tags:domplate({infoTipTag:DIV({"class":"infoTip"}),colorTag:DIV({style:"background: $rgbValue; width: 100px; height: 40px"},"&nbsp;"),imgTag:DIV({"class":"infoTipImageBox infoTipLoading"},IMG({"class":"infoTipImage",src:"$urlValue",repeat:"$repeat",onload:"$onLoadImage"}),IMG({"class":"infoTipBgImage",collapsed:true,src:"blank.gif"}),DIV({"class":"infoTipCaption"})),onLoadImage:function(event){var img=event.currentTarget||event.srcElement;
		var innerBox=img.parentNode;
		var caption=getElementByClass(innerBox,"infoTipCaption");
		var bgImg=getElementByClass(innerBox,"infoTipBgImage");
		if(!bgImg){return
		}if(isIE){removeClass(innerBox,"infoTipLoading")
		}var updateInfoTip=function(){var w=img.naturalWidth||img.width||10,h=img.naturalHeight||img.height||10;
		var repeat=img.getAttribute("repeat");
		if(repeat=="repeat-x"||(w==1&&h>1)){collapse(img,true);
		collapse(bgImg,false);
		bgImg.style.background="url("+img.src+") repeat-x";
		bgImg.style.width=maxWidth+"px";
		if(h>maxHeight){bgImg.style.height=maxHeight+"px"
		}else{bgImg.style.height=h+"px"
		}}else{if(repeat=="repeat-y"||(h==1&&w>1)){collapse(img,true);
		collapse(bgImg,false);
		bgImg.style.background="url("+img.src+") repeat-y";
		bgImg.style.height=maxHeight+"px";
		if(w>maxWidth){bgImg.style.width=maxWidth+"px"
		}else{bgImg.style.width=w+"px"
		}}else{if(repeat=="repeat"||(w==1&&h==1)){collapse(img,true);
		collapse(bgImg,false);
		bgImg.style.background="url("+img.src+") repeat";
		bgImg.style.width=maxWidth+"px";
		bgImg.style.height=maxHeight+"px"
		}else{if(w>maxWidth||h>maxHeight){if(w>h){img.style.width=maxWidth+"px";
		img.style.height=Math.round((h/w)*maxWidth)+"px"
		}else{img.style.width=Math.round((w/h)*maxHeight)+"px";
		img.style.height=maxHeight+"px"
		}}}}}caption.innerHTML=$STRF(w+" x "+h)
		};
		if(isIE){setTimeout(updateInfoTip,0)
		}else{updateInfoTip();
		removeClass(innerBox,"infoTipLoading")
		}}}),initializeBrowser:function(browser){browser.onInfoTipMouseOut=bind(this.onMouseOut,this,browser);
		browser.onInfoTipMouseMove=bind(this.onMouseMove,this,browser);
		var doc=browser.document;
		if(!doc){return
		}addEvent(doc,"mouseover",browser.onInfoTipMouseMove);
		addEvent(doc,"mouseout",browser.onInfoTipMouseOut);
		addEvent(doc,"mousemove",browser.onInfoTipMouseMove);
		return browser.infoTip=this.tags.infoTipTag.append({},getBody(doc))
		},uninitializeBrowser:function(browser){if(browser.infoTip){var doc=browser.document;
		removeEvent(doc,"mouseover",browser.onInfoTipMouseMove);
		removeEvent(doc,"mouseout",browser.onInfoTipMouseOut);
		removeEvent(doc,"mousemove",browser.onInfoTipMouseMove);
		browser.infoTip.parentNode.removeChild(browser.infoTip);
		delete browser.infoTip;
		delete browser.onInfoTipMouseMove
		}},showInfoTip:function(infoTip,panel,target,x,y,rangeParent,rangeOffset){if(!Firebug.showInfoTips){return
		}var scrollParent=getOverflowParent(target);
		var scrollX=x+(scrollParent?scrollParent.scrollLeft:0);
		if(panel.showInfoTip(infoTip,target,scrollX,y,rangeParent,rangeOffset)){var htmlElt=infoTip.ownerDocument.documentElement;
		var panelWidth=htmlElt.clientWidth;
		var panelHeight=htmlElt.clientHeight;
		if(x+infoTip.offsetWidth+infoTipMargin>panelWidth){infoTip.style.left=Math.max(0,panelWidth-(infoTip.offsetWidth+infoTipMargin))+"px";
		infoTip.style.right="auto"
		}else{infoTip.style.left=(x+infoTipMargin)+"px";
		infoTip.style.right="auto"
		}if(y+infoTip.offsetHeight+infoTipMargin>panelHeight){infoTip.style.top=Math.max(0,panelHeight-(infoTip.offsetHeight+infoTipMargin))+"px";
		infoTip.style.bottom="auto"
		}else{infoTip.style.top=(y+infoTipMargin)+"px";
		infoTip.style.bottom="auto"
		}if(FBTrace.DBG_INFOTIP){FBTrace.sysout("infotip.showInfoTip; top: "+infoTip.style.top+", left: "+infoTip.style.left+", bottom: "+infoTip.style.bottom+", right:"+infoTip.style.right+", offsetHeight: "+infoTip.offsetHeight+", offsetWidth: "+infoTip.offsetWidth+", x: "+x+", panelWidth: "+panelWidth+", y: "+y+", panelHeight: "+panelHeight)
		}infoTip.setAttribute("active","true")
		}else{this.hideInfoTip(infoTip)
		}},hideInfoTip:function(infoTip){if(infoTip){infoTip.removeAttribute("active")
		}},onMouseOut:function(event,browser){if(!event.relatedTarget){this.hideInfoTip(browser.infoTip)
		}},onMouseMove:function(event,browser){if(getAncestorByClass(event.target,"infoTip")){return
		}if(browser.currentPanel){var x=event.clientX,y=event.clientY,target=event.target||event.srcElement;
		this.showInfoTip(browser.infoTip,browser.currentPanel,target,x,y,event.rangeParent,event.rangeOffset)
		}else{this.hideInfoTip(browser.infoTip)
		}},populateColorInfoTip:function(infoTip,color){this.tags.colorTag.replace({rgbValue:color},infoTip);
		return true
		},populateImageInfoTip:function(infoTip,url,repeat){if(!repeat){repeat="no-repeat"
		}this.tags.imgTag.replace({urlValue:url,repeat:repeat},infoTip);
		return true
		},disable:function(){},showPanel:function(browser,panel){if(panel){var infoTip=panel.panelBrowser.infoTip;
		if(!infoTip){infoTip=this.initializeBrowser(panel.panelBrowser)
		}this.hideInfoTip(infoTip)
		}},showSidePanel:function(browser,panel){this.showPanel(browser,panel)
		}});
		Firebug.registerModule(Firebug.InfoTip)
		}});
		FBL.ns(function(){with(FBL){var CssParser=null;
		CssParser=(function(){function rule(start,body_start,end){return{start:start||0,body_start:body_start||0,end:end||0,line:-1,selector:null,parent:null,children:[],addChild:function(start,body_start,end){var r=rule(start,body_start,end);
		r.parent=this;
		this.children.push(r);
		return r
		},lastChild:function(){return this.children[this.children.length-1]
		}}
		}function removeAll(str,re){var m;
		while(m=str.match(re)){str=str.substring(m[0].length)
		}return str
		}function trim(str){return str.replace(/^\s+|\s+$/g,"")
		}function normalizeSelector(selector){selector=selector.replace(/[\n\r]/g," ");
		selector=trim(selector);
		selector=selector.replace(/\s*,\s*/g,",");
		return selector
		}function preprocessRules(text,rule_node){for(var i=0,il=rule_node.children.length;
		i<il;
		i++){var r=rule_node.children[i],rule_start=text.substring(r.start,r.body_start),cur_len=rule_start.length;
		rule_start=rule_start.replace(/[\n\r]/g," ");
		rule_start=removeAll(rule_start,/^\s*\/\*.*?\*\/[\s\t]*/);
		rule_start=rule_start.replace(/^[\s\t]+/,"");
		r.start+=(cur_len-rule_start.length);
		r.selector=normalizeSelector(rule_start)
		}return rule_node
		}function saveLineIndexes(text){var result=[0],i=0,il=text.length,ch,ch2;
		while(i<il){ch=text.charAt(i);
		if(ch=="\n"||ch=="\r"){if(ch=="\r"&&i<il-1&&text.charAt(i+1)=="\n"){i++
		}result.push(i+1)
		}i++
		}return result
		}function saveLineNumbers(text,rule_node,line_indexes,startLine){preprocessRules(text,rule_node);
		startLine=startLine||0;
		if(!line_indexes){var line_indexes=saveLineIndexes(text)
		}for(var i=0,il=rule_node.children.length;
		i<il;
		i++){var r=rule_node.children[i];
		r.line=line_indexes.length+startLine;
		for(var j=0,jl=line_indexes.length-1;
		j<jl;
		j++){var line_ix=line_indexes[j];
		if(r.start>=line_indexes[j]&&r.start<line_indexes[j+1]){r.line=j+1+startLine;
		break
		}}saveLineNumbers(text,r,line_indexes)
		}return rule_node
		}return{read:function(text,startLine){var rule_start=[],rule_body_start=[],rules=[],in_comment=0,root=rule(),cur_parent=root,last_rule=null,stack=[],ch,ch2;
		stack.last=function(){return this[this.length-1]
		};
		function hasStr(pos,substr){return text.substr(pos,substr.length)==substr
		}for(var i=0,il=text.length;
		i<il;
		i++){ch=text.charAt(i);
		ch2=i<il-1?text.charAt(i+1):"";
		if(!rule_start.length){rule_start.push(i)
		}switch(ch){case"@":if(!in_comment){if(hasStr(i,"@import")){var m=text.substr(i).match(/^@import\s*url\((['"])?.+?\1?\)\;?/);
		if(m){cur_parent.addChild(i,i+7,i+m[0].length);
		i+=m[0].length;
		rule_start.pop()
		}break
		}}case"/":if(!in_comment&&ch2=="*"){in_comment++
		}break;
		case"*":if(ch2=="/"){in_comment--
		}break;
		case"{":if(!in_comment){rule_body_start.push(i);
		cur_parent=cur_parent.addChild(rule_start.pop());
		stack.push(cur_parent)
		}break;
		case"}":if(!in_comment){var last_rule=stack.pop();
		rule_start.pop();
		last_rule.body_start=rule_body_start.pop();
		last_rule.end=i;
		cur_parent=last_rule.parent||root
		}break
		}}return saveLineNumbers(text,root,null,startLine)
		},normalizeSelector:normalizeSelector,findBySelector:function(rule_node,selector,source){var selector=normalizeSelector(selector),result=[];
		if(rule_node){for(var i=0,il=rule_node.children.length;
		i<il;
		i++){var r=rule_node.children[i];
		if(r.selector==selector){result.push(r)
		}}}if(result.length){return result
		}else{return null
		}}}
		})();
		FBL.CssParser=CssParser
		}});
		FBL.ns(function(){with(FBL){var CssAnalyzer={};
		var CSSRuleMap={};
		var ElementCSSRulesMap={};
		var internalStyleSheetIndex=-1;
		var reSelectorTag=/(^|\s)(?:\w+)/g;
		var reSelectorClass=/\.[\w\d_-]+/g;
		var reSelectorId=/#[\w\d_-]+/g;
		var globalCSSRuleIndex;
		var processAllStyleSheetsTimeout=null;
		var externalStyleSheetURLs=[];
		var ElementCache=Firebug.Lite.Cache.Element;
		var StyleSheetCache=Firebug.Lite.Cache.StyleSheet;
		CssAnalyzer.externalStyleSheetWarning=domplate(Firebug.Rep,{tag:DIV({"class":"warning focusRow",style:"font-weight:normal;",role:"listitem"},SPAN("$object|STR"),A({href:"$href",target:"_blank"},"$link|STR"))});
		CssAnalyzer.processAllStyleSheets=function(doc,styleSheetIterator){try{processAllStyleSheets(doc,styleSheetIterator)
		}catch(e){FBTrace.sysout("CssAnalyzer.processAllStyleSheets fails: ",e)
		}};
		CssAnalyzer.getElementCSSRules=function(element){try{return getElementCSSRules(element)
		}catch(e){FBTrace.sysout("CssAnalyzer.getElementCSSRules fails: ",e)
		}};
		CssAnalyzer.getRuleData=function(ruleId){return CSSRuleMap[ruleId]
		};
		CssAnalyzer.getRuleLine=function(){};
		CssAnalyzer.hasExternalStyleSheet=function(){return externalStyleSheetURLs.length>0
		};
		CssAnalyzer.parseStyleSheet=function(href){var sourceData=extractSourceData(href);
		var parsedObj=CssParser.read(sourceData.source,sourceData.startLine);
		var parsedRules=parsedObj.children;
		for(var i=0;
		i<parsedRules.length;
		){if(parsedRules[i].selector.indexOf("@")!=-1){parsedRules.splice(i,1)
		}else{i++
		}}return parsedRules
		};
		var processAllStyleSheets=function(doc,styleSheetIterator){styleSheetIterator=styleSheetIterator||processStyleSheet;
		globalCSSRuleIndex=-1;
		var styleSheets=doc.styleSheets;
		var importedStyleSheets=[];
		if(FBTrace.DBG_CSS){var start=new Date().getTime()
		}for(var i=0,length=styleSheets.length;
		i<length;
		i++){try{var styleSheet=styleSheets[i];
		if("firebugIgnore" in styleSheet){continue
		}var rules=isIE?styleSheet.rules:styleSheet.cssRules;
		rules.length
		}catch(e){externalStyleSheetURLs.push(styleSheet.href);
		styleSheet.restricted=true;
		var ssid=StyleSheetCache(styleSheet)
		}styleSheetIterator(doc,styleSheet);
		var importedStyleSheet,importedRules;
		if(isIE){var imports=styleSheet.imports;
		for(var j=0,importsLength=imports.length;
		j<importsLength;
		j++){try{importedStyleSheet=imports[j];
		importedRules=importedStyleSheet.rules;
		importedRules.length
		}catch(e){externalStyleSheetURLs.push(styleSheet.href);
		importedStyleSheet.restricted=true;
		var ssid=StyleSheetCache(importedStyleSheet)
		}styleSheetIterator(doc,importedStyleSheet)
		}}else{if(rules){for(var j=0,rulesLength=rules.length;
		j<rulesLength;
		j++){try{var rule=rules[j];
		importedStyleSheet=rule.styleSheet;
		if(importedStyleSheet){importedRules=importedStyleSheet.cssRules;
		importedRules.length
		}else{break
		}}catch(e){externalStyleSheetURLs.push(styleSheet.href);
		importedStyleSheet.restricted=true;
		var ssid=StyleSheetCache(importedStyleSheet)
		}styleSheetIterator(doc,importedStyleSheet)
		}}}}if(FBTrace.DBG_CSS){FBTrace.sysout("FBL.processAllStyleSheets","all stylesheet rules processed in "+(new Date().getTime()-start)+"ms")
		}};
		var processStyleSheet=function(doc,styleSheet){if(styleSheet.restricted){return
		}var rules=isIE?styleSheet.rules:styleSheet.cssRules;
		var ssid=StyleSheetCache(styleSheet);
		var href=styleSheet.href;
		var shouldParseCSS=typeof CssParser!="undefined"&&!Firebug.disableResourceFetching;
		if(shouldParseCSS){try{var parsedRules=CssAnalyzer.parseStyleSheet(href)
		}catch(e){if(FBTrace.DBG_ERRORS){FBTrace.sysout("processStyleSheet FAILS",e.message||e)
		}shouldParseCSS=false
		}finally{var parsedRulesIndex=0;
		var dontSupportGroupedRules=isIE&&browserVersion<9;
		var group=[];
		var groupItem
		}}for(var i=0,length=rules.length;
		i<length;
		i++){var rid=ssid+":"+i;
		var rule=rules[i];
		var selector=rule.selectorText||"";
		var lineNo=null;
		if(!selector||selector.indexOf("@")!=-1){continue
		}if(isIE){selector=selector.replace(reSelectorTag,function(s){return s.toLowerCase()
		})
		}if(shouldParseCSS){var parsedRule=parsedRules[parsedRulesIndex];
		var parsedSelector=parsedRule.selector;
		if(dontSupportGroupedRules&&parsedSelector.indexOf(",")!=-1&&group.length==0){group=parsedSelector.split(",")
		}if(dontSupportGroupedRules&&group.length>0){groupItem=group.shift();
		if(CssParser.normalizeSelector(selector)==groupItem){lineNo=parsedRule.line
		}if(group.length==0){parsedRulesIndex++
		}}else{if(CssParser.normalizeSelector(selector)==parsedRule.selector){lineNo=parsedRule.line;
		parsedRulesIndex++
		}}}CSSRuleMap[rid]={styleSheetId:ssid,styleSheetIndex:i,order:++globalCSSRuleIndex,specificity:selector&&selector.indexOf(",")==-1?getCSSRuleSpecificity(selector):0,rule:rule,lineNo:lineNo,selector:selector,cssText:rule.style?rule.style.cssText:rule.cssText?rule.cssText:""};
		var elements=Firebug.Selector(selector,doc);
		for(var j=0,elementsLength=elements.length;
		j<elementsLength;
		j++){var element=elements[j];
		var eid=ElementCache(element);
		if(!ElementCSSRulesMap[eid]){ElementCSSRulesMap[eid]=[]
		}ElementCSSRulesMap[eid].push(rid)
		}}};
		var loadExternalStylesheet=function(doc,styleSheetIterator,styleSheet){var url=styleSheet.href;
		styleSheet.firebugIgnore=true;
		var source=Firebug.Lite.Proxy.load(url);
		source=source.replace(/url\(([^\)]+)\)/g,function(a,name){var hasDomain=/\w+:\/\/./.test(name);
		if(!hasDomain){name=name.replace(/^(["'])(.+)\1$/,"$2");
		var first=name.charAt(0);
		if(first=="/"){var m=/^([^:]+:\/{1,3}[^\/]+)/.exec(url);
		return m?"url("+m[1]+name+")":"url("+name+")"
		}else{var path=url.replace(/[^\/]+\.[\w\d]+(\?.+|#.+)?$/g,"");
		path=path+name;
		var reBack=/[^\/]+\/\.\.\//;
		while(reBack.test(path)){path=path.replace(reBack,"")
		}return"url("+path+")"
		}}return a
		});
		var oldStyle=styleSheet.ownerNode;
		if(!oldStyle){return
		}if(!oldStyle.parentNode){return
		}var style=createGlobalElement("style");
		style.setAttribute("charset","utf-8");
		style.setAttribute("type","text/css");
		style.innerHTML=source;
		oldStyle.parentNode.insertBefore(style,oldStyle.nextSibling);
		oldStyle.parentNode.removeChild(oldStyle);
		doc.styleSheets[doc.styleSheets.length-1].externalURL=url;
		console.log(url,"call "+externalStyleSheetURLs.length,source);
		externalStyleSheetURLs.pop();
		if(processAllStyleSheetsTimeout){clearTimeout(processAllStyleSheetsTimeout)
		}processAllStyleSheetsTimeout=setTimeout(function(){console.log("processing");
		FBL.processAllStyleSheets(doc,styleSheetIterator);
		processAllStyleSheetsTimeout=null
		},200)
		};
		var getElementCSSRules=function(element){var eid=ElementCache(element);
		var rules=ElementCSSRulesMap[eid];
		if(!rules){return
		}var arr=[element];
		var Selector=Firebug.Selector;
		var ruleId,rule;
		for(var i=0,length=rules.length;
		i<length;
		i++){ruleId=rules[i];
		rule=CSSRuleMap[ruleId];
		if(rule.selector.indexOf(",")!=-1){var selectors=rule.selector.split(",");
		var maxSpecificity=-1;
		var sel,spec,mostSpecificSelector;
		for(var j,len=selectors.length;
		j<len;
		j++){sel=selectors[j];
		if(Selector.matches(sel,arr).length==1){spec=getCSSRuleSpecificity(sel);
		if(spec>maxSpecificity){maxSpecificity=spec;
		mostSpecificSelector=sel
		}}}rule.specificity=maxSpecificity
		}}rules.sort(sortElementRules);
		return rules
		};
		var sortElementRules=function(a,b){var ruleA=CSSRuleMap[a];
		var ruleB=CSSRuleMap[b];
		var specificityA=ruleA.specificity;
		var specificityB=ruleB.specificity;
		if(specificityA>specificityB){return 1
		}else{if(specificityA<specificityB){return -1
		}else{return ruleA.order>ruleB.order?1:-1
		}}};
		var solveRulesTied=function(a,b){var ruleA=CSSRuleMap[a];
		var ruleB=CSSRuleMap[b];
		if(ruleA.specificity==ruleB.specificity){return ruleA.order>ruleB.order?1:-1
		}return null
		};
		var getCSSRuleSpecificity=function(selector){var match=selector.match(reSelectorTag);
		var tagCount=match?match.length:0;
		match=selector.match(reSelectorClass);
		var classCount=match?match.length:0;
		match=selector.match(reSelectorId);
		var idCount=match?match.length:0;
		return tagCount+10*classCount+100*idCount
		};
		var extractSourceData=function(href){var sourceData={source:null,startLine:0};
		if(href){sourceData.source=Firebug.Lite.Proxy.load(href)
		}else{var index=0;
		var ssIndex=++internalStyleSheetIndex;
		var reStyleTag=/\<\s*style.*\>/gi;
		var reEndStyleTag=/\<\/\s*style.*\>/gi;
		var source=Firebug.Lite.Proxy.load(Env.browser.location.href);
		source=source.replace(/\n\r|\r\n/g,"\n");
		var startLine=0;
		do{var matchStyleTag=source.match(reStyleTag);
		var i0=source.indexOf(matchStyleTag[0])+matchStyleTag[0].length;
		for(var i=0;
		i<i0;
		i++){if(source.charAt(i)=="\n"){startLine++
		}}source=source.substr(i0);
		index++
		}while(index<=ssIndex);
		var matchEndStyleTag=source.match(reEndStyleTag);
		var i1=source.indexOf(matchEndStyleTag[0]);
		var extractedSource=source.substr(0,i1);
		sourceData.source=extractedSource;
		sourceData.startLine=startLine
		}return sourceData
		};
		FBL.CssAnalyzer=CssAnalyzer
		}});
		(function(){this.getElementXPath=function(element){try{if(element&&element.id){return'//*[@id="'+element.id+'"]'
		}else{return this.getElementTreeXPath(element)
		}}catch(E){}};
		this.getElementTreeXPath=function(element){var paths=[];
		for(;
		element&&element.nodeType==1;
		element=element.parentNode){var index=0;
		var nodeName=element.nodeName;
		for(var sibling=element.previousSibling;
		sibling;
		sibling=sibling.previousSibling){if(sibling.nodeType!=1){continue
		}if(sibling.nodeName==nodeName){++index
		}}var tagName=element.nodeName.toLowerCase();
		var pathIndex=(index?"["+(index+1)+"]":"");
		paths.splice(0,0,tagName+pathIndex)
		}return paths.length?"/"+paths.join("/"):null
		};
		this.getElementsByXPath=function(doc,xpath){var nodes=[];
		try{var result=doc.evaluate(xpath,doc,null,XPathResult.ANY_TYPE,null);
		for(var item=result.iterateNext();
		item;
		item=result.iterateNext()){nodes.push(item)
		}}catch(exc){}return nodes
		};
		this.getRuleMatchingElements=function(rule,doc){var css=rule.selectorText;
		var xpath=this.cssToXPath(css);
		return this.getElementsByXPath(doc,xpath)
		}
		}).call(FBL);
		FBL.ns(function(){with(FBL){var toCamelCase=function toCamelCase(s){return s.replace(reSelectorCase,toCamelCaseReplaceFn)
		};
		var toSelectorCase=function toSelectorCase(s){return s.replace(reCamelCase,"-$1").toLowerCase()
		};
		var reCamelCase=/([A-Z])/g;
		var reSelectorCase=/\-(.)/g;
		var toCamelCaseReplaceFn=function toCamelCaseReplaceFn(m,g){return g.toUpperCase()
		};
		var ElementCache=Firebug.Lite.Cache.Element;
		var StyleSheetCache=Firebug.Lite.Cache.StyleSheet;
		Firebug.SourceBoxPanel=Firebug.Panel;
		var reSelectorTag=/(^|\s)(?:\w+)/g;
		var domUtils=null;
		var textContent=isIE?"innerText":"textContent";
		var CSSDomplateBase={isEditable:function(rule){return !rule.isSystemSheet
		},isSelectorEditable:function(rule){return rule.isSelectorEditable&&this.isEditable(rule)
		}};
		var CSSPropTag=domplate(CSSDomplateBase,{tag:DIV({"class":"cssProp focusRow",$disabledStyle:"$prop.disabled",$editGroup:"$rule|isEditable",$cssOverridden:"$prop.overridden",role:"option"},A({"class":"cssPropDisable"},"&nbsp;&nbsp;"),SPAN({"class":"cssPropName",$editable:"$rule|isEditable"},"$prop.name"),SPAN({"class":"cssColon"},":"),SPAN({"class":"cssPropValue",$editable:"$rule|isEditable"},"$prop.value$prop.important"),SPAN({"class":"cssSemi"},";"))});
		var CSSRuleTag=TAG("$rule.tag",{rule:"$rule"});
		var CSSImportRuleTag=domplate({tag:DIV({"class":"cssRule insertInto focusRow importRule",_repObject:"$rule.rule"},"@import &quot;",A({"class":"objectLink",_repObject:"$rule.rule.styleSheet"},"$rule.rule.href"),"&quot;;")});
		var CSSStyleRuleTag=domplate(CSSDomplateBase,{tag:DIV({"class":"cssRule insertInto",$cssEditableRule:"$rule|isEditable",$editGroup:"$rule|isSelectorEditable",_repObject:"$rule.rule",ruleId:"$rule.id",role:"presentation"},DIV({"class":"cssHead focusRow",role:"listitem"},SPAN({"class":"cssSelector",$editable:"$rule|isSelectorEditable"},"$rule.selector")," {"),DIV({role:"group"},DIV({"class":"cssPropertyListBox",role:"listbox"},FOR("prop","$rule.props",TAG(CSSPropTag.tag,{rule:"$rule",prop:"$prop"})))),DIV({"class":"editable insertBefore",role:"presentation"},"}"))});
		var reSplitCSS=/(url\("?[^"\)]+?"?\))|(rgb\(.*?\))|(#[\dA-Fa-f]+)|(-?\d+(\.\d+)?(%|[a-z]{1,2})?)|([^,\s]+)|"(.*?)"/;
		var reURL=/url\("?([^"\)]+)?"?\)/;
		var reRepeat=/no-repeat|repeat-x|repeat-y|repeat/;
		var sothinkInstalled=false;
		var styleGroups={text:["font-family","font-size","font-weight","font-style","color","text-transform","text-decoration","letter-spacing","word-spacing","line-height","text-align","vertical-align","direction","column-count","column-gap","column-width"],background:["background-color","background-image","background-repeat","background-position","background-attachment","opacity"],box:["width","height","top","right","bottom","left","margin-top","margin-right","margin-bottom","margin-left","padding-top","padding-right","padding-bottom","padding-left","border-top-width","border-right-width","border-bottom-width","border-left-width","border-top-color","border-right-color","border-bottom-color","border-left-color","border-top-style","border-right-style","border-bottom-style","border-left-style","-moz-border-top-radius","-moz-border-right-radius","-moz-border-bottom-radius","-moz-border-left-radius","outline-top-width","outline-right-width","outline-bottom-width","outline-left-width","outline-top-color","outline-right-color","outline-bottom-color","outline-left-color","outline-top-style","outline-right-style","outline-bottom-style","outline-left-style"],layout:["position","display","visibility","z-index","overflow-x","overflow-y","overflow-clip","white-space","clip","float","clear","-moz-box-sizing"],other:["cursor","list-style-image","list-style-position","list-style-type","marker-offset","user-focus","user-select","user-modify","user-input"]};
		var styleGroupTitles={text:"Text",background:"Background",box:"Box Model",layout:"Layout",other:"Other"};
		Firebug.CSSModule=extend(Firebug.Module,{freeEdit:function(styleSheet,value){if(!styleSheet.editStyleSheet){var ownerNode=getStyleSheetOwnerNode(styleSheet);
		styleSheet.disabled=true;
		var url=CCSV("@mozilla.org/network/standard-url;1",Components.interfaces.nsIURL);
		url.spec=styleSheet.href;
		var editStyleSheet=ownerNode.ownerDocument.createElementNS("http://www.w3.org/1999/xhtml","style");
		unwrapObject(editStyleSheet).firebugIgnore=true;
		editStyleSheet.setAttribute("type","text/css");
		editStyleSheet.setAttributeNS("http://www.w3.org/XML/1998/namespace","base",url.directory);
		if(ownerNode.hasAttribute("media")){editStyleSheet.setAttribute("media",ownerNode.getAttribute("media"))
		}ownerNode.parentNode.insertBefore(editStyleSheet,ownerNode.nextSibling);
		styleSheet.editStyleSheet=editStyleSheet
		}styleSheet.editStyleSheet.innerHTML=value;
		if(FBTrace.DBG_CSS){FBTrace.sysout("css.saveEdit styleSheet.href:"+styleSheet.href+" got innerHTML:"+value+"\n")
		}dispatch(this.fbListeners,"onCSSFreeEdit",[styleSheet,value])
		},insertRule:function(styleSheet,cssText,ruleIndex){if(FBTrace.DBG_CSS){FBTrace.sysout("Insert: "+ruleIndex+" "+cssText)
		}var insertIndex=styleSheet.insertRule(cssText,ruleIndex);
		dispatch(this.fbListeners,"onCSSInsertRule",[styleSheet,cssText,ruleIndex]);
		return insertIndex
		},deleteRule:function(styleSheet,ruleIndex){if(FBTrace.DBG_CSS){FBTrace.sysout("deleteRule: "+ruleIndex+" "+styleSheet.cssRules.length,styleSheet.cssRules)
		}dispatch(this.fbListeners,"onCSSDeleteRule",[styleSheet,ruleIndex]);
		styleSheet.deleteRule(ruleIndex)
		},setProperty:function(rule,propName,propValue,propPriority){var style=rule.style||rule;
		var baseText=style.cssText;
		if(style.getPropertyValue){var prevValue=style.getPropertyValue(propName);
		var prevPriority=style.getPropertyPriority(propName);
		style.removeProperty(propName);
		style.setProperty(propName,propValue,propPriority)
		}else{style[toCamelCase(propName)]=propValue
		}if(propName){dispatch(this.fbListeners,"onCSSSetProperty",[style,propName,propValue,propPriority,prevValue,prevPriority,rule,baseText])
		}},removeProperty:function(rule,propName,parent){var style=rule.style||rule;
		var baseText=style.cssText;
		if(style.getPropertyValue){var prevValue=style.getPropertyValue(propName);
		var prevPriority=style.getPropertyPriority(propName);
		style.removeProperty(propName)
		}else{style[toCamelCase(propName)]=""
		}if(propName){dispatch(this.fbListeners,"onCSSRemoveProperty",[style,propName,prevValue,prevPriority,rule,baseText])
		}}});
		Firebug.CSSStyleSheetPanel=function(){};
		Firebug.CSSStyleSheetPanel.prototype=extend(Firebug.SourceBoxPanel,{template:domplate({tag:DIV({"class":"cssSheet insertInto a11yCSSView"},FOR("rule","$rules",CSSRuleTag),DIV({"class":"cssSheet editable insertBefore"},""))}),refresh:function(){if(this.location){this.updateLocation(this.location)
		}else{if(this.selection){this.updateSelection(this.selection)
		}}},toggleEditing:function(){if(!this.stylesheetEditor){this.stylesheetEditor=new StyleSheetEditor(this.document)
		}if(this.editing){Firebug.Editor.stopEditing()
		}else{if(!this.location){return
		}var styleSheet=this.location.editStyleSheet?this.location.editStyleSheet.sheet:this.location;
		var css=getStyleSheetCSS(styleSheet,this.context);
		this.stylesheetEditor.styleSheet=this.location;
		Firebug.Editor.startEditing(this.panelNode,css,this.stylesheetEditor)
		}},getStylesheetURL:function(rule){if(this.location.href){return this.location.href
		}else{return this.context.window.location.href
		}},getRuleByLine:function(styleSheet,line){if(!domUtils){return null
		}var cssRules=styleSheet.cssRules;
		for(var i=0;
		i<cssRules.length;
		++i){var rule=cssRules[i];
		if(rule instanceof CSSStyleRule){var ruleLine=domUtils.getRuleLine(rule);
		if(ruleLine>=line){return rule
		}}}},highlightRule:function(rule){var ruleElement=Firebug.getElementByRepObject(this.panelNode.firstChild,rule);
		if(ruleElement){scrollIntoCenterView(ruleElement,this.panelNode);
		setClassTimed(ruleElement,"jumpHighlight",this.context)
		}},getStyleSheetRules:function(context,styleSheet){var isSystemSheet=isSystemStyleSheet(styleSheet);
		function appendRules(cssRules){for(var i=0;
		i<cssRules.length;
		++i){var rule=cssRules[i];
		if(instanceOf(rule,"CSSStyleRule")){var props=this.getRuleProperties(context,rule);
		var line=null;
		var selector=rule.selectorText;
		if(isIE){selector=selector.replace(reSelectorTag,function(s){return s.toLowerCase()
		})
		}var ruleId=rule.selectorText+"/"+line;
		rules.push({tag:CSSStyleRuleTag.tag,rule:rule,id:ruleId,selector:selector,props:props,isSystemSheet:isSystemSheet,isSelectorEditable:true})
		}else{if(instanceOf(rule,"CSSImportRule")){rules.push({tag:CSSImportRuleTag.tag,rule:rule})
		}else{if(instanceOf(rule,"CSSMediaRule")){appendRules.apply(this,[rule.cssRules])
		}else{if(FBTrace.DBG_ERRORS||FBTrace.DBG_CSS){FBTrace.sysout("css getStyleSheetRules failed to classify a rule ",rule)
		}}}}}}var rules=[];
		appendRules.apply(this,[styleSheet.cssRules||styleSheet.rules]);
		return rules
		},parseCSSProps:function(style,inheritMode){var props=[];
		if(Firebug.expandShorthandProps){var count=style.length-1,index=style.length;
		while(index--){var propName=style.item(count-index);
		this.addProperty(propName,style.getPropertyValue(propName),!!style.getPropertyPriority(propName),false,inheritMode,props)
		}}else{var lines=style.cssText.match(/(?:[^;\(]*(?:\([^\)]*?\))?[^;\(]*)*;?/g);
		var propRE=/\s*([^:\s]*)\s*:\s*(.*?)\s*(! important)?;?$/;
		var line,i=0;
		var m;
		while(line=lines[i++]){m=propRE.exec(line);
		if(!m){continue
		}if(m[2]){this.addProperty(m[1],m[2],!!m[3],false,inheritMode,props)
		}}}return props
		},getRuleProperties:function(context,rule,inheritMode){var props=this.parseCSSProps(rule.style,inheritMode);
		var line;
		var ruleId=rule.selectorText+"/"+line;
		this.addOldProperties(context,ruleId,inheritMode,props);
		sortProperties(props);
		return props
		},addOldProperties:function(context,ruleId,inheritMode,props){if(context.selectorMap&&context.selectorMap.hasOwnProperty(ruleId)){var moreProps=context.selectorMap[ruleId];
		for(var i=0;
		i<moreProps.length;
		++i){var prop=moreProps[i];
		this.addProperty(prop.name,prop.value,prop.important,true,inheritMode,props)
		}}},addProperty:function(name,value,important,disabled,inheritMode,props){name=name.toLowerCase();
		if(inheritMode&&!inheritedStyleNames[name]){return
		}name=this.translateName(name,value);
		if(name){value=stripUnits(rgbToHex(value));
		important=important?" !important":"";
		var prop={name:name,value:value,important:important,disabled:disabled};
		props.push(prop)
		}},translateName:function(name,value){if((value=="-moz-initial"&&(name=="-moz-background-clip"||name=="-moz-background-origin"||name=="-moz-background-inline-policy"))||(value=="physical"&&(name=="margin-left-ltr-source"||name=="margin-left-rtl-source"||name=="margin-right-ltr-source"||name=="margin-right-rtl-source"))||(value=="physical"&&(name=="padding-left-ltr-source"||name=="padding-left-rtl-source"||name=="padding-right-ltr-source"||name=="padding-right-rtl-source"))){return null
		}if(name=="margin-left-value"){return"margin-left"
		}else{if(name=="margin-right-value"){return"margin-right"
		}else{if(name=="margin-top-value"){return"margin-top"
		}else{if(name=="margin-bottom-value"){return"margin-bottom"
		}else{if(name=="padding-left-value"){return"padding-left"
		}else{if(name=="padding-right-value"){return"padding-right"
		}else{if(name=="padding-top-value"){return"padding-top"
		}else{if(name=="padding-bottom-value"){return"padding-bottom"
		}else{return name
		}}}}}}}}},editElementStyle:function(){var rulesBox=$$(".cssElementRuleContainer",this.panelNode)[0];
		var styleRuleBox=rulesBox&&Firebug.getElementByRepObject(rulesBox,this.selection);
		if(!styleRuleBox){var rule={rule:this.selection,inherited:false,selector:"element.style",props:[]};
		if(!rulesBox){styleRuleBox=this.template.cascadedTag.replace({rules:[rule],inherited:[],inheritLabel:"Inherited from"},this.panelNode);
		styleRuleBox=$$(".cssElementRuleContainer",styleRuleBox)[0]
		}else{styleRuleBox=this.template.ruleTag.insertBefore({rule:rule},rulesBox)
		}styleRuleBox=$$(".insertInto",styleRuleBox)[0]
		}Firebug.Editor.insertRowForObject(styleRuleBox)
		},insertPropertyRow:function(row){Firebug.Editor.insertRowForObject(row)
		},insertRule:function(row){var location=getAncestorByClass(row,"cssRule");
		if(!location){location=getChildByClass(this.panelNode,"cssSheet");
		Firebug.Editor.insertRowForObject(location)
		}else{Firebug.Editor.insertRow(location,"before")
		}},editPropertyRow:function(row){var propValueBox=getChildByClass(row,"cssPropValue");
		Firebug.Editor.startEditing(propValueBox)
		},deletePropertyRow:function(row){var rule=Firebug.getRepObject(row);
		var propName=getChildByClass(row,"cssPropName")[textContent];
		Firebug.CSSModule.removeProperty(rule,propName);
		var ruleId=Firebug.getRepNode(row).getAttribute("ruleId");
		if(this.context.selectorMap&&this.context.selectorMap.hasOwnProperty(ruleId)){var map=this.context.selectorMap[ruleId];
		for(var i=0;
		i<map.length;
		++i){if(map[i].name==propName){map.splice(i,1);
		break
		}}}if(this.name=="stylesheet"){dispatch([Firebug.A11yModel],"onInlineEditorClose",[this,row.firstChild,true])
		}row.parentNode.removeChild(row);
		this.markChange(this.name=="stylesheet")
		},disablePropertyRow:function(row){toggleClass(row,"disabledStyle");
		var rule=Firebug.getRepObject(row);
		var propName=getChildByClass(row,"cssPropName")[textContent];
		if(!this.context.selectorMap){this.context.selectorMap={}
		}var ruleId=Firebug.getRepNode(row).getAttribute("ruleId");
		if(!(this.context.selectorMap.hasOwnProperty(ruleId))){this.context.selectorMap[ruleId]=[]
		}var map=this.context.selectorMap[ruleId];
		var propValue=getChildByClass(row,"cssPropValue")[textContent];
		var parsedValue=parsePriority(propValue);
		if(hasClass(row,"disabledStyle")){Firebug.CSSModule.removeProperty(rule,propName);
		map.push({name:propName,value:parsedValue.value,important:parsedValue.priority})
		}else{Firebug.CSSModule.setProperty(rule,propName,parsedValue.value,parsedValue.priority);
		var index=findPropByName(map,propName);
		map.splice(index,1)
		}this.markChange(this.name=="stylesheet")
		},onMouseDown:function(event){var offset=event.clientX-this.panelNode.parentNode.offsetLeft;
		if(!isLeftClick(event)||offset>20){return
		}var target=event.target||event.srcElement;
		if(hasClass(target,"textEditor")){return
		}var row=getAncestorByClass(target,"cssProp");
		if(row&&hasClass(row,"editGroup")){this.disablePropertyRow(row);
		cancelEvent(event)
		}},onDoubleClick:function(event){var offset=event.clientX-this.panelNode.parentNode.offsetLeft;
		if(!isLeftClick(event)||offset<=20){return
		}var target=event.target||event.srcElement;
		if(hasClass(target,"textEditorInner")){return
		}var row=getAncestorByClass(target,"cssRule");
		if(row&&!getAncestorByClass(target,"cssPropName")&&!getAncestorByClass(target,"cssPropValue")){this.insertPropertyRow(row);
		cancelEvent(event)
		}},name:"stylesheet",title:"CSS",parentPanel:null,searchable:true,dependents:["css","stylesheet","dom","domSide","layout"],options:{hasToolButtons:true},create:function(){Firebug.Panel.create.apply(this,arguments);
		this.onMouseDown=bind(this.onMouseDown,this);
		this.onDoubleClick=bind(this.onDoubleClick,this);
		if(this.name=="stylesheet"){this.onChangeSelect=bind(this.onChangeSelect,this);
		var doc=Firebug.browser.document;
		var selectNode=this.selectNode=createElement("select");
		CssAnalyzer.processAllStyleSheets(doc,function(doc,styleSheet){var key=StyleSheetCache.key(styleSheet);
		var fileName=getFileName(styleSheet.href)||getFileName(doc.location.href);
		var option=createElement("option",{value:key});
		option.appendChild(Firebug.chrome.document.createTextNode(fileName));
		selectNode.appendChild(option)
		});
		this.toolButtonsNode.appendChild(selectNode)
		}},onChangeSelect:function(event){event=event||window.event;
		var target=event.srcElement||event.currentTarget;
		var key=target.value;
		var styleSheet=StyleSheetCache.get(key);
		this.updateLocation(styleSheet)
		},initialize:function(){Firebug.Panel.initialize.apply(this,arguments);
		this.context=Firebug.chrome;
		this.document=Firebug.chrome.document;
		this.initializeNode();
		if(this.name=="stylesheet"){var styleSheets=Firebug.browser.document.styleSheets;
		if(styleSheets.length>0){addEvent(this.selectNode,"change",this.onChangeSelect);
		this.updateLocation(styleSheets[0])
		}}},shutdown:function(){Firebug.Editor.stopEditing();
		if(this.name=="stylesheet"){removeEvent(this.selectNode,"change",this.onChangeSelect)
		}this.destroyNode();
		Firebug.Panel.shutdown.apply(this,arguments)
		},destroy:function(state){Firebug.Panel.destroy.apply(this,arguments)
		},initializeNode:function(oldPanelNode){addEvent(this.panelNode,"mousedown",this.onMouseDown);
		addEvent(this.panelNode,"dblclick",this.onDoubleClick)
		},destroyNode:function(){removeEvent(this.panelNode,"mousedown",this.onMouseDown);
		removeEvent(this.panelNode,"dblclick",this.onDoubleClick)
		},ishow:function(state){Firebug.Inspector.stopInspecting(true);
		this.showToolbarButtons("fbCSSButtons",true);
		if(this.context.loaded&&!this.location){restoreObjects(this,state);
		if(!this.location){this.location=this.getDefaultLocation()
		}if(state&&state.scrollTop){this.panelNode.scrollTop=state.scrollTop
		}}},ihide:function(){this.showToolbarButtons("fbCSSButtons",false);
		this.lastScrollTop=this.panelNode.scrollTop
		},supportsObject:function(object){if(object instanceof CSSStyleSheet){return 1
		}else{if(object instanceof CSSStyleRule){return 2
		}else{if(object instanceof CSSStyleDeclaration){return 2
		}else{if(object instanceof SourceLink&&object.type=="css"&&reCSS.test(object.href)){return 2
		}else{return 0
		}}}}},updateLocation:function(styleSheet){if(!styleSheet){return
		}if(styleSheet.editStyleSheet){styleSheet=styleSheet.editStyleSheet.sheet
		}if(styleSheet.restricted){FirebugReps.Warning.tag.replace({object:"AccessRestricted"},this.panelNode);
		CssAnalyzer.externalStyleSheetWarning.tag.append({object:"The stylesheet could not be loaded due to access restrictions. ",link:"more...",href:"http://getfirebug.com/wiki/index.php/Firebug_Lite_FAQ#I_keep_seeing_.22Access_to_restricted_URI_denied.22"},this.panelNode);
		return
		}var rules=this.getStyleSheetRules(this.context,styleSheet);
		var result;
		if(rules.length){result=this.template.tag.replace({rules:rules},this.panelNode)
		}else{result=FirebugReps.Warning.tag.replace({object:"EmptyStyleSheet"},this.panelNode)
		}},updateSelection:function(object){this.selection=null;
		if(object instanceof CSSStyleDeclaration){object=object.parentRule
		}if(object instanceof CSSStyleRule){this.navigate(object.parentStyleSheet);
		this.highlightRule(object)
		}else{if(object instanceof CSSStyleSheet){this.navigate(object)
		}else{if(object instanceof SourceLink){try{var sourceLink=object;
		var sourceFile=getSourceFileByHref(sourceLink.href,this.context);
		if(sourceFile){clearNode(this.panelNode);
		this.showSourceFile(sourceFile);
		var lineNo=object.line;
		if(lineNo){this.scrollToLine(lineNo,this.jumpHighlightFactory(lineNo,this.context))
		}}else{var stylesheet=getStyleSheetByHref(sourceLink.href,this.context);
		if(stylesheet){this.navigate(stylesheet)
		}else{if(FBTrace.DBG_CSS){FBTrace.sysout("css.updateSelection no sourceFile for "+sourceLink.href,sourceLink)
		}}}}catch(exc){if(FBTrace.DBG_CSS){FBTrace.sysout("css.upDateSelection FAILS "+exc,exc)
		}}}}}},updateOption:function(name,value){if(name=="expandShorthandProps"){this.refresh()
		}},getLocationList:function(){var styleSheets=getAllStyleSheets(this.context);
		return styleSheets
		},getOptionsMenuItems:function(){return[{label:"Expand Shorthand Properties",type:"checkbox",checked:Firebug.expandShorthandProps,command:bindFixed(Firebug.togglePref,Firebug,"expandShorthandProps")},"-",{label:"Refresh",command:bind(this.refresh,this)}]
		},getContextMenuItems:function(style,target){var items=[];
		if(this.infoTipType=="color"){items.push({label:"CopyColor",command:bindFixed(copyToClipboard,FBL,this.infoTipObject)})
		}else{if(this.infoTipType=="image"){items.push({label:"CopyImageLocation",command:bindFixed(copyToClipboard,FBL,this.infoTipObject)},{label:"OpenImageInNewTab",command:bindFixed(openNewTab,FBL,this.infoTipObject)})
		}}if(isElement(this.selection)){items.push({label:"EditStyle",command:bindFixed(this.editElementStyle,this)})
		}else{if(!isSystemStyleSheet(this.selection)){items.push({label:"NewRule",command:bindFixed(this.insertRule,this,target)})
		}}var cssRule=getAncestorByClass(target,"cssRule");
		if(cssRule&&hasClass(cssRule,"cssEditableRule")){items.push("-",{label:"NewProp",command:bindFixed(this.insertPropertyRow,this,target)});
		var propRow=getAncestorByClass(target,"cssProp");
		if(propRow){var propName=getChildByClass(propRow,"cssPropName")[textContent];
		var isDisabled=hasClass(propRow,"disabledStyle");
		items.push({label:$STRF("EditProp",[propName]),nol10n:true,command:bindFixed(this.editPropertyRow,this,propRow)},{label:$STRF("DeleteProp",[propName]),nol10n:true,command:bindFixed(this.deletePropertyRow,this,propRow)},{label:$STRF("DisableProp",[propName]),nol10n:true,type:"checkbox",checked:isDisabled,command:bindFixed(this.disablePropertyRow,this,propRow)})
		}}items.push("-",{label:"Refresh",command:bind(this.refresh,this)});
		return items
		},browseObject:function(object){if(this.infoTipType=="image"){openNewTab(this.infoTipObject);
		return true
		}},showInfoTip:function(infoTip,target,x,y){var propValue=getAncestorByClass(target,"cssPropValue");
		if(propValue){var offset=getClientOffset(propValue);
		var offsetX=x-offset.x;
		var text=propValue[textContent];
		var charWidth=propValue.offsetWidth/text.length;
		var charOffset=Math.floor(offsetX/charWidth);
		var cssValue=parseCSSValue(text,charOffset);
		if(cssValue){if(cssValue.value==this.infoTipValue){return true
		}this.infoTipValue=cssValue.value;
		if(cssValue.type=="rgb"||(!cssValue.type&&isColorKeyword(cssValue.value))){this.infoTipType="color";
		this.infoTipObject=cssValue.value;
		return Firebug.InfoTip.populateColorInfoTip(infoTip,cssValue.value)
		}else{if(cssValue.type=="url"){var propNameNode=getElementByClass(target.parentNode,"cssPropName");
		if(propNameNode&&isImageRule(propNameNode[textContent])){var rule=Firebug.getRepObject(target);
		var baseURL=this.getStylesheetURL(rule);
		var relURL=parseURLValue(cssValue.value);
		var absURL=isDataURL(relURL)?relURL:absoluteURL(relURL,baseURL);
		var repeat=parseRepeatValue(text);
		this.infoTipType="image";
		this.infoTipObject=absURL;
		return Firebug.InfoTip.populateImageInfoTip(infoTip,absURL,repeat)
		}}}}}delete this.infoTipType;
		delete this.infoTipValue;
		delete this.infoTipObject
		},getEditor:function(target,value){if(target==this.panelNode||hasClass(target,"cssSelector")||hasClass(target,"cssRule")||hasClass(target,"cssSheet")){if(!this.ruleEditor){this.ruleEditor=new CSSRuleEditor(this.document)
		}return this.ruleEditor
		}else{if(!this.editor){this.editor=new CSSEditor(this.document)
		}return this.editor
		}},getDefaultLocation:function(){try{var styleSheets=this.context.window.document.styleSheets;
		if(styleSheets.length){var sheet=styleSheets[0];
		return(Firebug.filterSystemURLs&&isSystemURL(getURLForStyleSheet(sheet)))?null:sheet
		}}catch(exc){if(FBTrace.DBG_LOCATIONS){FBTrace.sysout("css.getDefaultLocation FAILS "+exc,exc)
		}}},getObjectDescription:function(styleSheet){var url=getURLForStyleSheet(styleSheet);
		var instance=getInstanceForStyleSheet(styleSheet);
		var baseDescription=splitURLBase(url);
		if(instance){baseDescription.name=baseDescription.name+" #"+(instance+1)
		}return baseDescription
		},search:function(text,reverse){var curDoc=this.searchCurrentDoc(!Firebug.searchGlobal,text,reverse);
		if(!curDoc&&Firebug.searchGlobal){return this.searchOtherDocs(text,reverse)
		}return curDoc
		},searchOtherDocs:function(text,reverse){var scanRE=Firebug.Search.getTestingRegex(text);
		function scanDoc(styleSheet){for(var i=0;
		i<styleSheet.cssRules.length;
		i++){if(scanRE.test(styleSheet.cssRules[i].cssText)){return true
		}}}if(this.navigateToNextDocument(scanDoc,reverse)){return this.searchCurrentDoc(true,text,reverse)
		}},searchCurrentDoc:function(wrapSearch,text,reverse){if(!text){delete this.currentSearch;
		return false
		}var row;
		if(this.currentSearch&&text==this.currentSearch.text){row=this.currentSearch.findNext(wrapSearch,false,reverse,Firebug.Search.isCaseSensitive(text))
		}else{if(this.editing){this.currentSearch=new TextSearch(this.stylesheetEditor.box);
		row=this.currentSearch.find(text,reverse,Firebug.Search.isCaseSensitive(text));
		if(row){var sel=this.document.defaultView.getSelection();
		sel.removeAllRanges();
		sel.addRange(this.currentSearch.range);
		scrollSelectionIntoView(this);
		return true
		}else{return false
		}}else{function findRow(node){return node.nodeType==1?node:node.parentNode
		}this.currentSearch=new TextSearch(this.panelNode,findRow);
		row=this.currentSearch.find(text,reverse,Firebug.Search.isCaseSensitive(text))
		}}if(row){this.document.defaultView.getSelection().selectAllChildren(row);
		scrollIntoCenterView(row,this.panelNode);
		dispatch([Firebug.A11yModel],"onCSSSearchMatchFound",[this,text,row]);
		return true
		}else{dispatch([Firebug.A11yModel],"onCSSSearchMatchFound",[this,text,null]);
		return false
		}},getSearchOptionsMenuItems:function(){return[Firebug.Search.searchOptionMenu("search.Case_Sensitive","searchCaseSensitive"),Firebug.Search.searchOptionMenu("search.Multiple_Files","searchGlobal")]
		}});
		function CSSElementPanel(){}CSSElementPanel.prototype=extend(Firebug.CSSStyleSheetPanel.prototype,{template:domplate({cascadedTag:DIV({"class":"a11yCSSView",role:"presentation"},DIV({role:"list","aria-label":$STR("aria.labels.style rules")},FOR("rule","$rules",TAG("$ruleTag",{rule:"$rule"}))),DIV({role:"list","aria-label":$STR("aria.labels.inherited style rules")},FOR("section","$inherited",H1({"class":"cssInheritHeader groupHeader focusRow",role:"listitem"},SPAN({"class":"cssInheritLabel"},"$inheritLabel"),TAG(FirebugReps.Element.shortTag,{object:"$section.element"})),DIV({role:"group"},FOR("rule","$section.rules",TAG("$ruleTag",{rule:"$rule"})))))),ruleTag:isIE?DIV({"class":"cssElementRuleContainer"},TAG(FirebugReps.SourceLink.tag,{object:"$rule.sourceLink"}),TAG(CSSStyleRuleTag.tag,{rule:"$rule"})):DIV({"class":"cssElementRuleContainer"},TAG(CSSStyleRuleTag.tag,{rule:"$rule"}),TAG(FirebugReps.SourceLink.tag,{object:"$rule.sourceLink"}))}),updateCascadeView:function(element){var rules=[],sections=[],usedProps={};
		this.getInheritedRules(element,sections,usedProps);
		this.getElementRules(element,rules,usedProps);
		if(rules.length||sections.length){var inheritLabel="Inherited from";
		var result=this.template.cascadedTag.replace({rules:rules,inherited:sections,inheritLabel:inheritLabel},this.panelNode)
		}else{var result=FirebugReps.Warning.tag.replace({object:"EmptyElementCSS"},this.panelNode)
		}if(CssAnalyzer.hasExternalStyleSheet()){CssAnalyzer.externalStyleSheetWarning.tag.append({object:"The results here may be inaccurate because some stylesheets could not be loaded due to access restrictions. ",link:"more...",href:"http://getfirebug.com/wiki/index.php/Firebug_Lite_FAQ#I_keep_seeing_.22This_element_has_no_style_rules.22"},this.panelNode)
		}},getStylesheetURL:function(rule){if(rule&&rule.parentStyleSheet&&rule.parentStyleSheet.href){return rule.parentStyleSheet.href
		}else{return this.selection.ownerDocument.location.href
		}},getInheritedRules:function(element,sections,usedProps){var parent=element.parentNode;
		if(parent&&parent.nodeType==1){this.getInheritedRules(parent,sections,usedProps);
		var rules=[];
		this.getElementRules(parent,rules,usedProps,true);
		if(rules.length){sections.splice(0,0,{element:parent,rules:rules})
		}}},getElementRules:function(element,rules,usedProps,inheritMode){var inspectedRules,displayedRules={};
		inspectedRules=CssAnalyzer.getElementCSSRules(element);
		if(inspectedRules){for(var i=0,length=inspectedRules.length;
		i<length;
		++i){var ruleId=inspectedRules[i];
		var ruleData=CssAnalyzer.getRuleData(ruleId);
		var rule=ruleData.rule;
		var ssid=ruleData.styleSheetId;
		var parentStyleSheet=StyleSheetCache.get(ssid);
		var href=parentStyleSheet.externalURL?parentStyleSheet.externalURL:parentStyleSheet.href;
		var instance=null;
		var isSystemSheet=false;
		if(!Firebug.showUserAgentCSS&&isSystemSheet){continue
		}if(!href){href=element.ownerDocument.location.href
		}var props=this.getRuleProperties(this.context,rule,inheritMode);
		if(inheritMode&&!props.length){continue
		}var line=ruleData.lineNo;
		var ruleId=rule.selectorText+"/"+line;
		var sourceLink=new SourceLink(href,line,"css",rule,instance);
		this.markOverridenProps(props,usedProps,inheritMode);
		rules.splice(0,0,{rule:rule,id:ruleId,selector:ruleData.selector,sourceLink:sourceLink,props:props,inherited:inheritMode,isSystemSheet:isSystemSheet})
		}}if(element.style){this.getStyleProperties(element,rules,usedProps,inheritMode)
		}if(FBTrace.DBG_CSS){FBTrace.sysout("getElementRules "+rules.length+" rules for "+getElementXPath(element),rules)
		}},markOverridenProps:function(props,usedProps,inheritMode){for(var i=0;
		i<props.length;
		++i){var prop=props[i];
		if(usedProps.hasOwnProperty(prop.name)){var deadProps=usedProps[prop.name];
		for(var j=0;
		j<deadProps.length;
		++j){var deadProp=deadProps[j];
		if(!deadProp.disabled&&!deadProp.wasInherited&&deadProp.important&&!prop.important){prop.overridden=true
		}else{if(!prop.disabled){deadProp.overridden=true
		}}}}else{usedProps[prop.name]=[]
		}prop.wasInherited=inheritMode?true:false;
		usedProps[prop.name].push(prop)
		}},getStyleProperties:function(element,rules,usedProps,inheritMode){var props=this.parseCSSProps(element.style,inheritMode);
		this.addOldProperties(this.context,getElementXPath(element),inheritMode,props);
		sortProperties(props);
		this.markOverridenProps(props,usedProps,inheritMode);
		if(props.length){rules.splice(0,0,{rule:element,id:getElementXPath(element),selector:"element.style",props:props,inherited:inheritMode})
		}},name:"css",title:"Style",parentPanel:"HTML",order:0,initialize:function(){this.context=Firebug.chrome;
		this.document=Firebug.chrome.document;
		Firebug.CSSStyleSheetPanel.prototype.initialize.apply(this,arguments);
		var selection=ElementCache.get(Firebug.context.persistedState.selectedHTMLElementId);
		if(selection){this.select(selection,true)
		}},ishow:function(state){},watchWindow:function(win){if(domUtils){var doc=win.document
		}},unwatchWindow:function(win){var doc=win.document;
		if(isAncestor(this.stateChangeEl,doc)){this.removeStateChangeHandlers()
		}},supportsObject:function(object){return object instanceof Element?1:0
		},updateView:function(element){this.updateCascadeView(element);
		if(domUtils){this.contentState=safeGetContentState(element);
		this.addStateChangeHandlers(element)
		}},updateSelection:function(element){if(!instanceOf(element,"Element")){return
		}if(sothinkInstalled){FirebugReps.Warning.tag.replace({object:"SothinkWarning"},this.panelNode);
		return
		}if(!element){return
		}this.updateView(element)
		},updateOption:function(name,value){if(name=="showUserAgentCSS"||name=="expandShorthandProps"){this.refresh()
		}},getOptionsMenuItems:function(){var ret=[{label:"Show User Agent CSS",type:"checkbox",checked:Firebug.showUserAgentCSS,command:bindFixed(Firebug.togglePref,Firebug,"showUserAgentCSS")},{label:"Expand Shorthand Properties",type:"checkbox",checked:Firebug.expandShorthandProps,command:bindFixed(Firebug.togglePref,Firebug,"expandShorthandProps")}];
		if(domUtils&&this.selection){var state=safeGetContentState(this.selection);
		ret.push("-");
		ret.push({label:":active",type:"checkbox",checked:state&STATE_ACTIVE,command:bindFixed(this.updateContentState,this,STATE_ACTIVE,state&STATE_ACTIVE)});
		ret.push({label:":hover",type:"checkbox",checked:state&STATE_HOVER,command:bindFixed(this.updateContentState,this,STATE_HOVER,state&STATE_HOVER)})
		}return ret
		},updateContentState:function(state,remove){domUtils.setContentState(remove?this.selection.ownerDocument.documentElement:this.selection,state);
		this.refresh()
		},addStateChangeHandlers:function(el){this.removeStateChangeHandlers();
		this.stateChangeEl=el
		},removeStateChangeHandlers:function(){var sel=this.stateChangeEl;
		if(sel){}},contentStateCheck:function(state){if(!state||this.contentState&state){var timeoutRunner=bindFixed(function(){var newState=safeGetContentState(this.selection);
		if(newState!=this.contentState){this.context.invalidatePanels(this.name)
		}},this);
		setTimeout(timeoutRunner,0)
		}}});
		function safeGetContentState(selection){try{return domUtils.getContentState(selection)
		}catch(e){if(FBTrace.DBG_ERRORS){FBTrace.sysout("css.safeGetContentState; EXCEPTION",e)
		}}}function CSSComputedElementPanel(){}CSSComputedElementPanel.prototype=extend(CSSElementPanel.prototype,{template:domplate({computedTag:DIV({"class":"a11yCSSView",role:"list","aria-label":$STR("aria.labels.computed styles")},FOR("group","$groups",H1({"class":"cssInheritHeader groupHeader focusRow",role:"listitem"},SPAN({"class":"cssInheritLabel"},"$group.title")),TABLE({width:"100%",role:"group"},TBODY({role:"presentation"},FOR("prop","$group.props",TR({"class":"focusRow computedStyleRow",role:"listitem"},TD({"class":"stylePropName",role:"presentation"},"$prop.name"),TD({"class":"stylePropValue",role:"presentation"},"$prop.value")))))))}),updateComputedView:function(element){var win=isIE?element.ownerDocument.parentWindow:element.ownerDocument.defaultView;
		var style=isIE?element.currentStyle:win.getComputedStyle(element,"");
		var groups=[];
		for(var groupName in styleGroups){var title=styleGroupTitles[groupName];
		var group={title:title,props:[]};
		groups.push(group);
		var props=styleGroups[groupName];
		for(var i=0;
		i<props.length;
		++i){var propName=props[i];
		var propValue=style.getPropertyValue?style.getPropertyValue(propName):""+style[toCamelCase(propName)];
		if(propValue===undefined||propValue===null){continue
		}propValue=stripUnits(rgbToHex(propValue));
		if(propValue){group.props.push({name:propName,value:propValue})
		}}}var result=this.template.computedTag.replace({groups:groups},this.panelNode)
		},name:"computed",title:"Computed",parentPanel:"HTML",order:1,updateView:function(element){this.updateComputedView(element)
		},getOptionsMenuItems:function(){return[{label:"Refresh",command:bind(this.refresh,this)}]
		}});
		function CSSEditor(doc){this.initializeInline(doc)
		}CSSEditor.prototype=domplate(Firebug.InlineEditor.prototype,{insertNewRow:function(target,insertWhere){var rule=Firebug.getRepObject(target);
		var emptyProp={name:"",value:"",important:""};
		if(insertWhere=="before"){return CSSPropTag.tag.insertBefore({prop:emptyProp,rule:rule},target)
		}else{return CSSPropTag.tag.insertAfter({prop:emptyProp,rule:rule},target)
		}},saveEdit:function(target,value,previousValue){if(!value){return
		}target.innerHTML=escapeForCss(value);
		var row=getAncestorByClass(target,"cssProp");
		if(hasClass(row,"disabledStyle")){toggleClass(row,"disabledStyle")
		}var rule=Firebug.getRepObject(target);
		if(hasClass(target,"cssPropName")){if(value&&previousValue!=value){var propValue=getChildByClass(row,"cssPropValue")[textContent];
		var parsedValue=parsePriority(propValue);
		if(propValue&&propValue!="undefined"){if(FBTrace.DBG_CSS){FBTrace.sysout("CSSEditor.saveEdit : "+previousValue+"->"+value+" = "+propValue+"\n")
		}if(previousValue){Firebug.CSSModule.removeProperty(rule,previousValue)
		}Firebug.CSSModule.setProperty(rule,value,parsedValue.value,parsedValue.priority)
		}}else{if(!value){Firebug.CSSModule.removeProperty(rule,previousValue)
		}}}else{if(getAncestorByClass(target,"cssPropValue")){var propName=getChildByClass(row,"cssPropName")[textContent];
		var propValue=getChildByClass(row,"cssPropValue")[textContent];
		if(FBTrace.DBG_CSS){FBTrace.sysout("CSSEditor.saveEdit propName=propValue: "+propName+" = "+propValue+"\n")
		}if(value&&value!="null"){var parsedValue=parsePriority(value);
		Firebug.CSSModule.setProperty(rule,propName,parsedValue.value,parsedValue.priority)
		}else{if(previousValue&&previousValue!="null"){Firebug.CSSModule.removeProperty(rule,propName)
		}}}}this.panel.markChange(this.panel.name=="stylesheet")
		},advanceToNext:function(target,charCode){if(charCode==58&&hasClass(target,"cssPropName")){return true
		}},getAutoCompleteRange:function(value,offset){if(hasClass(this.target,"cssPropName")){return{start:0,end:value.length-1}
		}else{return parseCSSValue(value,offset)
		}},getAutoCompleteList:function(preExpr,expr,postExpr){if(hasClass(this.target,"cssPropName")){return getCSSPropertyNames()
		}else{var row=getAncestorByClass(this.target,"cssProp");
		var propName=getChildByClass(row,"cssPropName")[textContent];
		return getCSSKeywordsByProperty(propName)
		}}});
		function CSSRuleEditor(doc){this.initializeInline(doc);
		this.completeAsYouType=false
		}CSSRuleEditor.uniquifier=0;
		CSSRuleEditor.prototype=domplate(Firebug.InlineEditor.prototype,{insertNewRow:function(target,insertWhere){var emptyRule={selector:"",id:"",props:[],isSelectorEditable:true};
		if(insertWhere=="before"){return CSSStyleRuleTag.tag.insertBefore({rule:emptyRule},target)
		}else{return CSSStyleRuleTag.tag.insertAfter({rule:emptyRule},target)
		}},saveEdit:function(target,value,previousValue){if(FBTrace.DBG_CSS){FBTrace.sysout("CSSRuleEditor.saveEdit: '"+value+"'  '"+previousValue+"'",target)
		}target.innerHTML=escapeForCss(value);
		if(value===previousValue){return
		}var row=getAncestorByClass(target,"cssRule");
		var styleSheet=this.panel.location;
		styleSheet=styleSheet.editStyleSheet?styleSheet.editStyleSheet.sheet:styleSheet;
		var cssRules=styleSheet.cssRules;
		var rule=Firebug.getRepObject(target),oldRule=rule;
		var ruleIndex=cssRules.length;
		if(rule||Firebug.getRepObject(row.nextSibling)){var searchRule=rule||Firebug.getRepObject(row.nextSibling);
		for(ruleIndex=0;
		ruleIndex<cssRules.length&&searchRule!=cssRules[ruleIndex];
		ruleIndex++){}}if(oldRule){Firebug.CSSModule.deleteRule(styleSheet,ruleIndex)
		}if(value){var cssText=[value,"{"];
		var props=row.getElementsByClassName("cssProp");
		for(var i=0;
		i<props.length;
		i++){var propEl=props[i];
		if(!hasClass(propEl,"disabledStyle")){cssText.push(getChildByClass(propEl,"cssPropName")[textContent]);
		cssText.push(":");
		cssText.push(getChildByClass(propEl,"cssPropValue")[textContent]);
		cssText.push(";")
		}}cssText.push("}");
		cssText=cssText.join("");
		try{var insertLoc=Firebug.CSSModule.insertRule(styleSheet,cssText,ruleIndex);
		rule=cssRules[insertLoc];
		ruleIndex++
		}catch(err){if(FBTrace.DBG_CSS||FBTrace.DBG_ERRORS){FBTrace.sysout("CSS Insert Error: "+err,err)
		}target.innerHTML=escapeForCss(previousValue);
		row.repObject=undefined;
		return
		}}else{rule=undefined
		}row.repObject=rule;
		if(!oldRule){var ruleId="new/"+value+"/"+(++CSSRuleEditor.uniquifier);
		row.setAttribute("ruleId",ruleId)
		}this.panel.markChange(this.panel.name=="stylesheet")
		}});
		function StyleSheetEditor(doc){this.box=this.tag.replace({},doc,this);
		this.input=this.box.firstChild
		}StyleSheetEditor.prototype=domplate(Firebug.BaseEditor,{multiLine:true,tag:DIV(TEXTAREA({"class":"styleSheetEditor fullPanelEditor",oninput:"$onInput"})),getValue:function(){return this.input.value
		},setValue:function(value){return this.input.value=value
		},show:function(target,panel,value,textSize,targetSize){this.target=target;
		this.panel=panel;
		this.panel.panelNode.appendChild(this.box);
		this.input.value=value;
		this.input.focus();
		var command=Firebug.chrome.$("cmd_toggleCSSEditing");
		command.setAttribute("checked",true)
		},hide:function(){var command=Firebug.chrome.$("cmd_toggleCSSEditing");
		command.setAttribute("checked",false);
		if(this.box.parentNode==this.panel.panelNode){this.panel.panelNode.removeChild(this.box)
		}delete this.target;
		delete this.panel;
		delete this.styleSheet
		},saveEdit:function(target,value,previousValue){Firebug.CSSModule.freeEdit(this.styleSheet,value)
		},endEditing:function(){this.panel.refresh();
		return true
		},onInput:function(){Firebug.Editor.update()
		},scrollToLine:function(line,offset){this.startMeasuring(this.input);
		var lineHeight=this.measureText().height;
		this.stopMeasuring();
		this.input.scrollTop=(line*lineHeight)+offset
		}});
		var rgbToHex=function rgbToHex(value){return value.replace(/\brgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)/gi,rgbToHexReplacer)
		};
		var rgbToHexReplacer=function(_,r,g,b){return"#"+((1<<24)+(r<<16)+(g<<8)+(b<<0)).toString(16).substr(-6).toUpperCase()
		};
		var stripUnits=function stripUnits(value){return value.replace(/(url\(.*?\)|[^0]\S*\s*)|0(%|em|ex|px|in|cm|mm|pt|pc)(\s|$)/gi,stripUnitsReplacer)
		};
		var stripUnitsReplacer=function(_,skip,remove,whitespace){return skip||("0"+whitespace)
		};
		function parsePriority(value){var rePriority=/(.*?)\s*(!important)?$/;
		var m=rePriority.exec(value);
		var propValue=m?m[1]:"";
		var priority=m&&m[2]?"important":"";
		return{value:propValue,priority:priority}
		}function parseURLValue(value){var m=reURL.exec(value);
		return m?m[1]:""
		}function parseRepeatValue(value){var m=reRepeat.exec(value);
		return m?m[0]:""
		}function parseCSSValue(value,offset){var start=0;
		var m;
		while(1){m=reSplitCSS.exec(value);
		if(m&&m.index+m[0].length<offset){value=value.substr(m.index+m[0].length);
		start+=m.index+m[0].length;
		offset-=m.index+m[0].length
		}else{break
		}}if(m){var type;
		if(m[1]){type="url"
		}else{if(m[2]||m[3]){type="rgb"
		}else{if(m[4]){type="int"
		}}}return{value:m[0],start:start+m.index,end:start+m.index+(m[0].length-1),type:type}
		}}function findPropByName(props,name){for(var i=0;
		i<props.length;
		++i){if(props[i].name==name){return i
		}}}function sortProperties(props){props.sort(function(a,b){return a.name>b.name?1:-1
		})
		}function getTopmostRuleLine(panelNode){for(var child=panelNode.firstChild;
		child;
		child=child.nextSibling){if(child.offsetTop+child.offsetHeight>panelNode.scrollTop){var rule=child.repObject;
		if(rule){return{line:domUtils.getRuleLine(rule),offset:panelNode.scrollTop-child.offsetTop}
		}}}return 0
		}function getStyleSheetCSS(sheet,context){if(sheet.ownerNode instanceof HTMLStyleElement){return sheet.ownerNode.innerHTML
		}else{return context.sourceCache.load(sheet.href).join("")
		}}function getStyleSheetOwnerNode(sheet){for(;
		sheet&&!sheet.ownerNode;
		sheet=sheet.parentStyleSheet){}return sheet.ownerNode
		}function scrollSelectionIntoView(panel){var selCon=getSelectionController(panel);
		selCon.scrollSelectionIntoView(nsISelectionController.SELECTION_NORMAL,nsISelectionController.SELECTION_FOCUS_REGION,true)
		}function getSelectionController(panel){var browser=Firebug.chrome.getPanelBrowser(panel);
		return browser.docShell.QueryInterface(nsIInterfaceRequestor).getInterface(nsISelectionDisplay).QueryInterface(nsISelectionController)
		}Firebug.registerModule(Firebug.CSSModule);
		Firebug.registerPanel(Firebug.CSSStyleSheetPanel);
		Firebug.registerPanel(CSSElementPanel);
		Firebug.registerPanel(CSSComputedElementPanel)
		}});
		FBL.ns(function(){with(FBL){Firebug.Script=extend(Firebug.Module,{getPanel:function(){return Firebug.chrome?Firebug.chrome.getPanel("Script"):null
		},selectSourceCode:function(index){this.getPanel().selectSourceCode(index)
		}});
		Firebug.registerModule(Firebug.Script);
		function ScriptPanel(){}ScriptPanel.prototype=extend(Firebug.Panel,{name:"Script",title:"Script",selectIndex:0,sourceIndex:-1,options:{hasToolButtons:true},create:function(){Firebug.Panel.create.apply(this,arguments);
		this.onChangeSelect=bind(this.onChangeSelect,this);
		var doc=Firebug.browser.document;
		var scripts=doc.getElementsByTagName("script");
		var selectNode=this.selectNode=createElement("select");
		for(var i=0,script;
		script=scripts[i];
		i++){if(Firebug.ignoreFirebugElements&&script.getAttribute("firebugIgnore")){continue
		}var fileName=getFileName(script.src)||getFileName(doc.location.href);
		var option=createElement("option",{value:i});
		option.appendChild(Firebug.chrome.document.createTextNode(fileName));
		selectNode.appendChild(option)
		}this.toolButtonsNode.appendChild(selectNode)
		},initialize:function(){this.selectSourceCode(this.selectIndex);
		Firebug.Panel.initialize.apply(this,arguments);
		addEvent(this.selectNode,"change",this.onChangeSelect)
		},shutdown:function(){removeEvent(this.selectNode,"change",this.onChangeSelect);
		Firebug.Panel.shutdown.apply(this,arguments)
		},detach:function(oldChrome,newChrome){Firebug.Panel.detach.apply(this,arguments);
		var oldPanel=oldChrome.getPanel("Script");
		var index=oldPanel.selectIndex;
		this.selectNode.selectedIndex=index;
		this.selectIndex=index;
		this.sourceIndex=-1
		},onChangeSelect:function(event){var select=this.selectNode;
		this.selectIndex=select.selectedIndex;
		var option=select.options[select.selectedIndex];
		if(!option){return
		}var selectedSourceIndex=parseInt(option.value);
		this.renderSourceCode(selectedSourceIndex)
		},selectSourceCode:function(index){var select=this.selectNode;
		select.selectedIndex=index;
		var option=select.options[index];
		if(!option){return
		}var selectedSourceIndex=parseInt(option.value);
		this.renderSourceCode(selectedSourceIndex)
		},renderSourceCode:function(index){if(this.sourceIndex!=index){var renderProcess=function renderProcess(src){var html=[],hl=0;
		src=isIE&&!isExternal?src+"\n":"\n"+src;
		src=src.replace(/\n\r|\r\n/g,"\n");
		var match=src.match(/[\n]/g);
		var lines=match?match.length:0;
		html[hl++]='<div><div class="sourceBox" style="left:';
		html[hl++]=35+7*(lines+"").length;
		html[hl++]='px;"><pre class="sourceCode">';
		html[hl++]=escapeHTML(src);
		html[hl++]='</pre></div><div class="lineNo">';
		for(var l=1,lines;
		l<=lines;
		l++){html[hl++]='<div line="';
		html[hl++]=l;
		html[hl++]='">';
		html[hl++]=l;
		html[hl++]="</div>"
		}html[hl++]="</div></div>";
		updatePanel(html)
		};
		var updatePanel=function(html){self.panelNode.innerHTML=html.join("");
		setTimeout(function(){self.synchronizeUI()
		},0)
		};
		var onFailure=function(){FirebugReps.Warning.tag.replace({object:"AccessRestricted"},self.panelNode)
		};
		var self=this;
		var doc=Firebug.browser.document;
		var script=doc.getElementsByTagName("script")[index];
		var url=getScriptURL(script);
		var isExternal=url&&url!=doc.location.href;
		try{if(Firebug.disableResourceFetching){renderProcess(Firebug.Lite.Proxy.fetchResourceDisabledMessage)
		}else{if(isExternal){Ajax.request({url:url,onSuccess:renderProcess,onFailure:onFailure})
		}else{var src=script.innerHTML;
		renderProcess(src)
		}}}catch(e){onFailure()
		}this.sourceIndex=index
		}}});
		Firebug.registerPanel(ScriptPanel);
		var getScriptURL=function getScriptURL(script){var reFile=/([^\/\?#]+)(#.+)?$/;
		var rePath=/^(.*\/)/;
		var reProtocol=/^\w+:\/\//;
		var path=null;
		var doc=Firebug.browser.document;
		var file=reFile.exec(script.src);
		if(file){var fileName=file[1];
		var fileOptions=file[2];
		if(reProtocol.test(script.src)){path=rePath.exec(script.src)[1]
		}else{var r=rePath.exec(script.src);
		var src=r?r[1]:script.src;
		var backDir=/^((?:\.\.\/)+)(.*)/.exec(src);
		var reLastDir=/^(.*\/)[^\/]+\/$/;
		path=rePath.exec(doc.location.href)[1];
		if(backDir){var j=backDir[1].length/3;
		var p;
		while(j-->0){path=reLastDir.exec(path)[1]
		}path+=backDir[2]
		}else{if(src.indexOf("/")!=-1){if(/^\.\/./.test(src)){path+=src.substring(2)
		}else{if(/^\/./.test(src)){var domain=/^(\w+:\/\/[^\/]+)/.exec(path);
		path=domain[1]+src
		}else{path+=src
		}}}}}}var m=path&&path.match(/([^\/]+)\/$/)||null;
		if(path&&m){return path+fileName
		}};
		var getFileName=function getFileName(path){if(!path){return""
		}var match=path&&path.match(/[^\/]+(\?.*)?(#.*)?$/);
		return match&&match[0]||path
		}
		}});
		FBL.ns(function(){with(FBL){var ElementCache=Firebug.Lite.Cache.Element;
		var insertSliceSize=18;
		var insertInterval=40;
		var ignoreVars={__firebug__:1,"eval":1,java:1,sun:1,Packages:1,JavaArray:1,JavaMember:1,JavaObject:1,JavaClass:1,JavaPackage:1,_firebug:1,_FirebugConsole:1,_FirebugCommandLine:1};
		if(Firebug.ignoreFirebugElements){ignoreVars[Firebug.Lite.Cache.ID]=1
		}var memberPanelRep=isIE6?{"class":"memberLabel $member.type\\Label",href:"javacript:void(0)"}:{"class":"memberLabel $member.type\\Label"};
		var RowTag=TR({"class":"memberRow $member.open $member.type\\Row",$hasChildren:"$member.hasChildren",role:"presentation",level:"$member.level"},TD({"class":"memberLabelCell",style:"padding-left: $member.indent\\px",role:"presentation"},A(memberPanelRep,SPAN({},"$member.name"))),TD({"class":"memberValueCell",role:"presentation"},TAG("$member.tag",{object:"$member.value"})));
		var WatchRowTag=TR({"class":"watchNewRow",level:0},TD({"class":"watchEditCell",colspan:2},DIV({"class":"watchEditBox a11yFocusNoTab",role:"button",tabindex:"0","aria-label":$STR("press enter to add new watch expression")},$STR("NewWatch"))));
		var SizerRow=TR({role:"presentation"},TD({width:"30%"}),TD({width:"70%"}));
		var domTableClass=isIElt8?"domTable domTableIE":"domTable";
		var DirTablePlate=domplate(Firebug.Rep,{tag:TABLE({"class":domTableClass,cellpadding:0,cellspacing:0,onclick:"$onClick",role:"tree"},TBODY({role:"presentation"},SizerRow,FOR("member","$object|memberIterator",RowTag))),watchTag:TABLE({"class":domTableClass,cellpadding:0,cellspacing:0,_toggles:"$toggles",_domPanel:"$domPanel",onclick:"$onClick",role:"tree"},TBODY({role:"presentation"},SizerRow,WatchRowTag)),tableTag:TABLE({"class":domTableClass,cellpadding:0,cellspacing:0,_toggles:"$toggles",_domPanel:"$domPanel",onclick:"$onClick",role:"tree"},TBODY({role:"presentation"},SizerRow)),rowTag:FOR("member","$members",RowTag),memberIterator:function(object,level){return getMembers(object,level)
		},onClick:function(event){if(!isLeftClick(event)){return
		}var target=event.target||event.srcElement;
		var row=getAncestorByClass(target,"memberRow");
		var label=getAncestorByClass(target,"memberLabel");
		if(label&&hasClass(row,"hasChildren")){var row=label.parentNode.parentNode;
		this.toggleRow(row)
		}else{var object=Firebug.getRepObject(target);
		if(typeof(object)=="function"){Firebug.chrome.select(object,"script");
		cancelEvent(event)
		}else{if(event.detail==2&&!object){var panel=row.parentNode.parentNode.domPanel;
		if(panel){var rowValue=panel.getRowPropertyValue(row);
		if(typeof(rowValue)=="boolean"){panel.setPropertyValue(row,!rowValue)
		}else{panel.editProperty(row)
		}cancelEvent(event)
		}}}}return false
		},toggleRow:function(row){var level=parseInt(row.getAttribute("level"));
		var toggles=row.parentNode.parentNode.toggles;
		if(hasClass(row,"opened")){removeClass(row,"opened");
		if(toggles){var path=getPath(row);
		for(var i=0;
		i<path.length;
		++i){if(i==path.length-1){delete toggles[path[i]]
		}else{toggles=toggles[path[i]]
		}}}var rowTag=this.rowTag;
		var tbody=row.parentNode;
		setTimeout(function(){for(var firstRow=row.nextSibling;
		firstRow;
		firstRow=row.nextSibling){if(parseInt(firstRow.getAttribute("level"))<=level){break
		}tbody.removeChild(firstRow)
		}},row.insertTimeout?row.insertTimeout:0)
		}else{setClass(row,"opened");
		if(toggles){var path=getPath(row);
		for(var i=0;
		i<path.length;
		++i){var name=path[i];
		if(toggles.hasOwnProperty(name)){toggles=toggles[name]
		}else{toggles=toggles[name]={}
		}}}var value=row.lastChild.firstChild.repObject;
		var members=getMembers(value,level+1);
		var rowTag=this.rowTag;
		var lastRow=row;
		var delay=0;
		while(members.length){with({slice:members.splice(0,insertSliceSize),isLast:!members.length}){setTimeout(function(){if(lastRow.parentNode){var result=rowTag.insertRows({members:slice},lastRow);
		lastRow=result[1]
		}if(isLast){row.removeAttribute("insertTimeout")
		}},delay)
		}delay+=insertInterval
		}row.insertTimeout=delay
		}}});
		Firebug.DOMBasePanel=function(){};
		Firebug.DOMBasePanel.prototype=extend(Firebug.Panel,{tag:DirTablePlate.tableTag,getRealObject:function(object){if(!object){return object
		}if(object.wrappedJSObject){return object.wrappedJSObject
		}return object
		},rebuild:function(update,scrollTop){var members=getMembers(this.selection);
		expandMembers(members,this.toggles,0,0);
		this.showMembers(members,update,scrollTop);
		if(!this.parentPanel){updateStatusBar(this)
		}},showMembers:function(members,update,scrollTop){if(this.timeouts){for(var i=0;
		i<this.timeouts.length;
		++i){this.context.clearTimeout(this.timeouts[i])
		}delete this.timeouts
		}if(!members.length){return this.showEmptyMembers()
		}var panelNode=this.panelNode;
		var priorScrollTop=scrollTop==undefined?panelNode.scrollTop:scrollTop;
		var offscreen=update&&panelNode.firstChild;
		var dest=offscreen?panelNode.ownerDocument:panelNode;
		var table=this.tag.replace({domPanel:this,toggles:this.toggles},dest);
		var tbody=table.lastChild;
		var rowTag=DirTablePlate.rowTag;
		var panel=this;
		var result;
		var timeouts=[];
		var delay=0;
		var renderStart=new Date().getTime();
		while(members.length){with({slice:members.splice(0,insertSliceSize),isLast:!members.length}){timeouts.push(this.context.setTimeout(function(){if(!tbody.lastChild){return
		}result=rowTag.insertRows({members:slice},tbody.lastChild);
		if((panelNode.scrollHeight+panelNode.offsetHeight)>=priorScrollTop){panelNode.scrollTop=priorScrollTop
		}},delay));
		delay+=insertInterval
		}}if(offscreen){timeouts.push(this.context.setTimeout(function(){if(panelNode.firstChild){panelNode.replaceChild(table,panelNode.firstChild)
		}else{panelNode.appendChild(table)
		}panelNode.scrollTop=priorScrollTop
		},delay))
		}else{timeouts.push(this.context.setTimeout(function(){panelNode.scrollTop=scrollTop==undefined?0:scrollTop
		},delay))
		}this.timeouts=timeouts
		},showEmptyMembers:function(){FirebugReps.Warning.tag.replace({object:"NoMembersWarning"},this.panelNode)
		},findPathObject:function(object){var pathIndex=-1;
		for(var i=0;
		i<this.objectPath.length;
		++i){if(this.getPathObject(i)===object){return i
		}}return -1
		},getPathObject:function(index){var object=this.objectPath[index];
		if(object instanceof Property){return object.getObject()
		}else{return object
		}},getRowObject:function(row){var object=getRowOwnerObject(row);
		return object?object:this.selection
		},getRowPropertyValue:function(row){var object=this.getRowObject(row);
		object=this.getRealObject(object);
		if(object){var propName=getRowName(row);
		if(object instanceof jsdIStackFrame){return Firebug.Debugger.evaluate(propName,this.context)
		}else{return object[propName]
		}}},onMouseMove:function(event){var target=event.srcElement||event.target;
		var object=getAncestorByClass(target,"objectLink-element");
		object=object?object.repObject:null;
		if(object&&instanceOf(object,"Element")&&object.nodeType==1){if(object!=lastHighlightedObject){Firebug.Inspector.drawBoxModel(object);
		object=lastHighlightedObject
		}}else{Firebug.Inspector.hideBoxModel()
		}},create:function(){this.context=Firebug.browser;
		this.objectPath=[];
		this.propertyPath=[];
		this.viewPath=[];
		this.pathIndex=-1;
		this.toggles={};
		Firebug.Panel.create.apply(this,arguments);
		this.panelNode.style.padding="0 1px"
		},initialize:function(){Firebug.Panel.initialize.apply(this,arguments);
		addEvent(this.panelNode,"mousemove",this.onMouseMove)
		},shutdown:function(){removeEvent(this.panelNode,"mousemove",this.onMouseMove);
		Firebug.Panel.shutdown.apply(this,arguments)
		},ishow:function(state){if(this.context.loaded&&!this.selection){if(!state){this.select(null);
		return
		}if(state.viewPath){this.viewPath=state.viewPath
		}if(state.propertyPath){this.propertyPath=state.propertyPath
		}var defaultObject=this.getDefaultSelection(this.context);
		var selectObject=defaultObject;
		if(state.firstSelection){var restored=state.firstSelection(this.context);
		if(restored){selectObject=restored;
		this.objectPath=[defaultObject,restored]
		}else{this.objectPath=[defaultObject]
		}}else{this.objectPath=[defaultObject]
		}if(this.propertyPath.length>1){for(var i=1;
		i<this.propertyPath.length;
		++i){var name=this.propertyPath[i];
		if(!name){continue
		}var object=selectObject;
		try{selectObject=object[name]
		}catch(exc){selectObject=null
		}if(selectObject){this.objectPath.push(new Property(object,name))
		}else{this.viewPath.splice(i);
		this.propertyPath.splice(i);
		this.objectPath.splice(i);
		selectObject=this.getPathObject(this.objectPath.length-1);
		break
		}}}var selection=state.pathIndex<=this.objectPath.length-1?this.getPathObject(state.pathIndex):this.getPathObject(this.objectPath.length-1);
		this.select(selection)
		}},supportsObject:function(object){if(object==null){return 1000
		}if(typeof(object)=="undefined"){return 1000
		}else{if(object instanceof SourceLink){return 0
		}else{return 1
		}}},refresh:function(){this.rebuild(true)
		},updateSelection:function(object){var previousIndex=this.pathIndex;
		var previousView=previousIndex==-1?null:this.viewPath[previousIndex];
		var newPath=this.pathToAppend;
		delete this.pathToAppend;
		var pathIndex=this.findPathObject(object);
		if(newPath||pathIndex==-1){this.toggles={};
		if(newPath){if(previousView){if(this.panelNode.scrollTop){previousView.scrollTop=this.panelNode.scrollTop
		}var start=previousIndex+1,length=this.objectPath.length-start;
		this.objectPath.splice(start,length);
		this.propertyPath.splice(start,length);
		this.viewPath.splice(start,length)
		}var value=this.getPathObject(previousIndex);
		if(!value){if(FBTrace.DBG_ERRORS){FBTrace.sysout("dom.updateSelection no pathObject for "+previousIndex+"\n")
		}return
		}for(var i=0,length=newPath.length;
		i<length;
		++i){var name=newPath[i];
		var object=value;
		try{value=value[name]
		}catch(exc){if(FBTrace.DBG_ERRORS){FBTrace.sysout("dom.updateSelection FAILS at path_i="+i+" for name:"+name+"\n")
		}return
		}++this.pathIndex;
		this.objectPath.push(new Property(object,name));
		this.propertyPath.push(name);
		this.viewPath.push({toggles:this.toggles,scrollTop:0})
		}}else{this.toggles={};
		var win=Firebug.browser.window;
		if(object===win){this.pathIndex=0;
		this.objectPath=[win];
		this.propertyPath=[null];
		this.viewPath=[{toggles:this.toggles,scrollTop:0}]
		}else{this.pathIndex=1;
		this.objectPath=[win,object];
		this.propertyPath=[null,null];
		this.viewPath=[{toggles:{},scrollTop:0},{toggles:this.toggles,scrollTop:0}]
		}}this.panelNode.scrollTop=0;
		this.rebuild()
		}else{this.pathIndex=pathIndex;
		var view=this.viewPath[pathIndex];
		this.toggles=view.toggles;
		if(previousView&&this.panelNode.scrollTop){previousView.scrollTop=this.panelNode.scrollTop
		}this.rebuild(false,view.scrollTop)
		}},getObjectPath:function(object){return this.objectPath
		},getDefaultSelection:function(){return Firebug.browser.window
		}});
		var updateStatusBar=function(panel){var path=panel.propertyPath;
		var index=panel.pathIndex;
		var r=[];
		for(var i=0,l=path.length;
		i<l;
		i++){r.push(i==index?'<a class="fbHover fbButton fbBtnSelected" ':'<a class="fbHover fbButton" ');
		r.push("pathIndex=");
		r.push(i);
		if(isIE6){r.push(' href="javascript:void(0)"')
		}r.push(">");
		r.push(i==0?"window":path[i]||"Object");
		r.push("</a>");
		if(i<l-1){r.push('<span class="fbStatusSeparator">&gt;</span>')
		}}panel.statusBarNode.innerHTML=r.join("")
		};
		var DOMMainPanel=Firebug.DOMPanel=function(){};
		Firebug.DOMPanel.DirTable=DirTablePlate;
		DOMMainPanel.prototype=extend(Firebug.DOMBasePanel.prototype,{onClickStatusBar:function(event){var target=event.srcElement||event.target;
		var element=getAncestorByClass(target,"fbHover");
		if(element){var pathIndex=element.getAttribute("pathIndex");
		if(pathIndex){this.select(this.getPathObject(pathIndex))
		}}},selectRow:function(row,target){if(!target){target=row.lastChild.firstChild
		}if(!target||!target.repObject){return
		}this.pathToAppend=getPath(row);
		var valueBox=row.lastChild.firstChild;
		if(hasClass(valueBox,"objectBox-array")){var arrayIndex=FirebugReps.Arr.getItemIndex(target);
		this.pathToAppend.push(arrayIndex)
		}this.select(target.repObject,true)
		},onClick:function(event){var target=event.srcElement||event.target;
		var repNode=Firebug.getRepNode(target);
		if(repNode){var row=getAncestorByClass(target,"memberRow");
		if(row){this.selectRow(row,repNode);
		cancelEvent(event)
		}}},name:"DOM",title:"DOM",searchable:true,statusSeparator:">",options:{hasToolButtons:true,hasStatusBar:true},create:function(){Firebug.DOMBasePanel.prototype.create.apply(this,arguments);
		this.onClick=bind(this.onClick,this);
		this.onClickStatusBar=bind(this.onClickStatusBar,this);
		this.panelNode.style.padding="0 1px"
		},initialize:function(oldPanelNode){Firebug.DOMBasePanel.prototype.initialize.apply(this,arguments);
		addEvent(this.panelNode,"click",this.onClick);
		this.ishow();
		addEvent(this.statusBarNode,"click",this.onClickStatusBar)
		},shutdown:function(){removeEvent(this.panelNode,"click",this.onClick);
		Firebug.DOMBasePanel.prototype.shutdown.apply(this,arguments)
		}});
		Firebug.registerPanel(DOMMainPanel);
		var getMembers=function getMembers(object,level){if(!level){level=0
		}var ordinals=[],userProps=[],userClasses=[],userFuncs=[],domProps=[],domFuncs=[],domConstants=[];
		try{var domMembers=getDOMMembers(object);
		if(object.wrappedJSObject){var insecureObject=object.wrappedJSObject
		}else{var insecureObject=object
		}if(isIE&&isFunction(object)){addMember("user",userProps,"prototype",object.prototype,level)
		}for(var name in insecureObject){if(ignoreVars[name]==1){continue
		}var val;
		try{val=insecureObject[name]
		}catch(exc){if(FBTrace.DBG_ERRORS&&FBTrace.DBG_DOM){FBTrace.sysout("dom.getMembers cannot access "+name,exc)
		}}var ordinal=parseInt(name);
		if(ordinal||ordinal==0){addMember("ordinal",ordinals,name,val,level)
		}else{if(isFunction(val)){if(isClassFunction(val)&&!(name in domMembers)){addMember("userClass",userClasses,name,val,level)
		}else{if(name in domMembers){addMember("domFunction",domFuncs,name,val,level,domMembers[name])
		}else{addMember("userFunction",userFuncs,name,val,level)
		}}}else{var prefix="";
		if(name in domMembers&&!(name in domConstantMap)){addMember("dom",domProps,(prefix+name),val,level,domMembers[name])
		}else{if(name in domConstantMap){addMember("dom",domConstants,(prefix+name),val,level)
		}else{addMember("user",userProps,(prefix+name),val,level)
		}}}}}}catch(exc){throw exc;
		if(FBTrace.DBG_ERRORS&&FBTrace.DBG_DOM){FBTrace.sysout("dom.getMembers FAILS: ",exc)
		}}function sortName(a,b){return a.name>b.name?1:-1
		}function sortOrder(a,b){return a.order>b.order?1:-1
		}var members=[];
		members.push.apply(members,ordinals);
		Firebug.showUserProps=true;
		Firebug.showUserFuncs=true;
		Firebug.showDOMProps=true;
		Firebug.showDOMFuncs=true;
		Firebug.showDOMConstants=true;
		if(Firebug.showUserProps){userProps.sort(sortName);
		members.push.apply(members,userProps)
		}if(Firebug.showUserFuncs){userClasses.sort(sortName);
		members.push.apply(members,userClasses);
		userFuncs.sort(sortName);
		members.push.apply(members,userFuncs)
		}if(Firebug.showDOMProps){domProps.sort(sortName);
		members.push.apply(members,domProps)
		}if(Firebug.showDOMFuncs){domFuncs.sort(sortName);
		members.push.apply(members,domFuncs)
		}if(Firebug.showDOMConstants){members.push.apply(members,domConstants)
		}return members
		};
		function expandMembers(members,toggles,offset,level){var expanded=0;
		for(var i=offset;
		i<members.length;
		++i){var member=members[i];
		if(member.level>level){break
		}if(toggles.hasOwnProperty(member.name)){member.open="opened";
		var newMembers=getMembers(member.value,level+1);
		var args=[i+1,0];
		args.push.apply(args,newMembers);
		members.splice.apply(members,args);
		expanded+=newMembers.length;
		i+=newMembers.length+expandMembers(members,toggles[member.name],i+1,level+1)
		}}return expanded
		}function isClassFunction(fn){try{for(var name in fn.prototype){return true
		}}catch(exc){}return false
		}FBL.ErrorCopy=function(message){this.message=message
		};
		var addMember=function addMember(type,props,name,value,level,order){var rep=Firebug.getRep(value);
		var tag=rep.shortTag?rep.shortTag:rep.tag;
		var ErrorCopy=function(){};
		var valueType=typeof(value);
		var hasChildren=hasProperties(value)&&!(value instanceof ErrorCopy)&&(isFunction(value)||(valueType=="object"&&value!=null)||(valueType=="string"&&value.length>Firebug.stringCropLength));
		props.push({name:name,value:value,type:type,rowClass:"memberRow-"+type,open:"",order:order,level:level,indent:level*16,hasChildren:hasChildren,tag:tag})
		};
		var getWatchRowIndex=function getWatchRowIndex(row){var index=-1;
		for(;
		row&&hasClass(row,"watchRow");
		row=row.previousSibling){++index
		}return index
		};
		var getRowName=function getRowName(row){var node=row.firstChild;
		return node.textContent?node.textContent:node.innerText
		};
		var getRowValue=function getRowValue(row){return row.lastChild.firstChild.repObject
		};
		var getRowOwnerObject=function getRowOwnerObject(row){var parentRow=getParentRow(row);
		if(parentRow){return getRowValue(parentRow)
		}};
		var getParentRow=function getParentRow(row){var level=parseInt(row.getAttribute("level"))-1;
		for(row=row.previousSibling;
		row;
		row=row.previousSibling){if(parseInt(row.getAttribute("level"))==level){return row
		}}};
		var getPath=function getPath(row){var name=getRowName(row);
		var path=[name];
		var level=parseInt(row.getAttribute("level"))-1;
		for(row=row.previousSibling;
		row;
		row=row.previousSibling){if(parseInt(row.getAttribute("level"))==level){var name=getRowName(row);
		path.splice(0,0,name);
		--level
		}}return path
		};
		Firebug.DOM=extend(Firebug.Module,{getPanel:function(){return Firebug.chrome?Firebug.chrome.getPanel("DOM"):null
		}});
		Firebug.registerModule(Firebug.DOM);
		var lastHighlightedObject;
		function DOMSidePanel(){}DOMSidePanel.prototype=extend(Firebug.DOMBasePanel.prototype,{selectRow:function(row,target){if(!target){target=row.lastChild.firstChild
		}if(!target||!target.repObject){return
		}this.pathToAppend=getPath(row);
		var valueBox=row.lastChild.firstChild;
		if(hasClass(valueBox,"objectBox-array")){var arrayIndex=FirebugReps.Arr.getItemIndex(target);
		this.pathToAppend.push(arrayIndex)
		}var object=target.repObject;
		if(instanceOf(object,"Element")){Firebug.HTML.selectTreeNode(ElementCache(object))
		}else{Firebug.chrome.selectPanel("DOM");
		Firebug.chrome.getPanel("DOM").select(object,true)
		}},onClick:function(event){var target=event.srcElement||event.target;
		var repNode=Firebug.getRepNode(target);
		if(repNode){var row=getAncestorByClass(target,"memberRow");
		if(row){this.selectRow(row,repNode);
		cancelEvent(event)
		}}},name:"DOMSidePanel",parentPanel:"HTML",title:"DOM",options:{hasToolButtons:true},isInitialized:false,create:function(){Firebug.DOMBasePanel.prototype.create.apply(this,arguments);
		this.onClick=bind(this.onClick,this)
		},initialize:function(){Firebug.DOMBasePanel.prototype.initialize.apply(this,arguments);
		addEvent(this.panelNode,"click",this.onClick);
		var selection=ElementCache.get(Firebug.context.persistedState.selectedHTMLElementId);
		if(selection){this.select(selection,true)
		}},shutdown:function(){removeEvent(this.panelNode,"click",this.onClick);
		Firebug.DOMBasePanel.prototype.shutdown.apply(this,arguments)
		},reattach:function(oldChrome){this.toggles=oldChrome.getPanel("DOMSidePanel").toggles
		}});
		Firebug.registerPanel(DOMSidePanel)
		}});
		FBL.FBTrace={};
		(function(){var traceOptions={DBG_TIMESTAMP:1,DBG_INITIALIZE:1,DBG_CHROME:1,DBG_ERRORS:1,DBG_DISPATCH:1,DBG_CSS:1};
		this.module=null;
		this.initialize=function(){if(!this.messageQueue){this.messageQueue=[]
		}for(var name in traceOptions){this[name]=traceOptions[name]
		}};
		this.sysout=function(){return this.logFormatted(arguments,"")
		};
		this.dumpProperties=function(title,object){return this.logFormatted("dumpProperties() not supported.","warning")
		};
		this.dumpStack=function(){return this.logFormatted("dumpStack() not supported.","warning")
		};
		this.flush=function(module){this.module=module;
		var queue=this.messageQueue;
		this.messageQueue=[];
		for(var i=0;
		i<queue.length;
		++i){this.writeMessage(queue[i][0],queue[i][1],queue[i][2])
		}};
		this.getPanel=function(){return this.module?this.module.getPanel():null
		};
		this.logFormatted=function(objects,className){var html=this.DBG_TIMESTAMP?[getTimestamp()," | "]:[];
		var length=objects.length;
		for(var i=0;
		i<length;
		++i){appendText(" ",html);
		var object=objects[i];
		if(i==0){html.push("<b>");
		appendText(object,html);
		html.push("</b>")
		}else{appendText(object,html)
		}}return this.logRow(html,className)
		};
		this.logRow=function(message,className){var panel=this.getPanel();
		if(panel&&panel.panelNode){this.writeMessage(message,className)
		}else{this.messageQueue.push([message,className])
		}return this.LOG_COMMAND
		};
		this.writeMessage=function(message,className){var container=this.getPanel().containerNode;
		var isScrolledToBottom=container.scrollTop+container.offsetHeight>=container.scrollHeight;
		this.writeRow.call(this,message,className);
		if(isScrolledToBottom){container.scrollTop=container.scrollHeight-container.offsetHeight
		}};
		this.appendRow=function(row){var container=this.getPanel().panelNode;
		container.appendChild(row)
		};
		this.writeRow=function(message,className){var row=this.getPanel().panelNode.ownerDocument.createElement("div");
		row.className="logRow"+(className?" logRow-"+className:"");
		row.innerHTML=message.join("");
		this.appendRow(row)
		};
		function appendText(object,html){html.push(escapeHTML(objectToString(object)))
		}function getTimestamp(){var now=new Date();
		var ms=""+(now.getMilliseconds()/1000).toFixed(3);
		ms=ms.substr(2);
		return now.toLocaleTimeString()+"."+ms
		}var HTMLtoEntity={"<":"&lt;",">":"&gt;","&":"&amp;","'":"&#39;",'"':"&quot;"};
		function replaceChars(ch){return HTMLtoEntity[ch]
		}function escapeHTML(value){return(value+"").replace(/[<>&"']/g,replaceChars)
		}function objectToString(object){try{return object+""
		}catch(exc){return null
		}}}).apply(FBL.FBTrace);
		FBL.ns(function(){with(FBL){if(!Env.Options.enableTrace){return
		}Firebug.Trace=extend(Firebug.Module,{getPanel:function(){return Firebug.chrome?Firebug.chrome.getPanel("Trace"):null
		},clear:function(){this.getPanel().panelNode.innerHTML=""
		}});
		Firebug.registerModule(Firebug.Trace);
		function TracePanel(){}TracePanel.prototype=extend(Firebug.Panel,{name:"Trace",title:"Trace",options:{hasToolButtons:true,innerHTMLSync:true},create:function(){Firebug.Panel.create.apply(this,arguments);
		this.clearButton=new Button({caption:"Clear",title:"Clear FBTrace logs",owner:Firebug.Trace,onClick:Firebug.Trace.clear})
		},initialize:function(){Firebug.Panel.initialize.apply(this,arguments);
		this.clearButton.initialize()
		},shutdown:function(){this.clearButton.shutdown();
		Firebug.Panel.shutdown.apply(this,arguments)
		}});
		Firebug.registerPanel(TracePanel)
		}});
		FBL.ns(function(){with(FBL){var modules=[];
		var panelTypes=[];
		var panelTypeMap={};
		var parentPanelMap={};
		var registerModule=Firebug.registerModule;
		var registerPanel=Firebug.registerPanel;
		append(Firebug,{extend:function(fn){if(Firebug.chrome&&Firebug.chrome.addPanel){var namespace=ns(fn);
		fn.call(namespace,FBL)
		}else{setTimeout(function(){Firebug.extend(fn)
		},100)
		}},registerModule:function(){registerModule.apply(Firebug,arguments);
		modules.push.apply(modules,arguments);
		dispatch(modules,"initialize",[]);
		if(FBTrace.DBG_INITIALIZE){FBTrace.sysout("Firebug.registerModule")
		}},registerPanel:function(){registerPanel.apply(Firebug,arguments);
		panelTypes.push.apply(panelTypes,arguments);
		for(var i=0,panelType;
		panelType=arguments[i];
		++i){if(panelType.prototype.name=="Dev"){continue
		}panelTypeMap[panelType.prototype.name]=arguments[i];
		var parentPanelName=panelType.prototype.parentPanel;
		if(parentPanelName){parentPanelMap[parentPanelName]=1
		}else{var panelName=panelType.prototype.name;
		var chrome=Firebug.chrome;
		chrome.addPanel(panelName);
		var onTabClick=function onTabClick(){chrome.selectPanel(panelName);
		return false
		};
		chrome.addController([chrome.panelMap[panelName].tabNode,"mousedown",onTabClick])
		}}if(FBTrace.DBG_INITIALIZE){for(var i=0;
		i<arguments.length;
		++i){FBTrace.sysout("Firebug.registerPanel",arguments[i].prototype.name)
		}}}})
		}});
		FBL.ns(function(){with(FBL){FirebugChrome.Skin={CSS:'.obscured{left:-999999px !important;}.collapsed{display:none;}[collapsed="true"]{display:none;}#fbCSS{padding:0 !important;}.cssPropDisable{float:left;display:block;width:2em;cursor:default;}.infoTip{z-index:2147483647;position:fixed;padding:2px 3px;border:1px solid #CBE087;background:LightYellow;font-family:Monaco,monospace;color:#000000;display:none;white-space:nowrap;pointer-events:none;}.infoTip[active="true"]{display:block;}.infoTipLoading{width:16px;height:16px;background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/chrome://firebug/skin/loading_16.gif) no-repeat;}.infoTipImageBox{font-size:11px;min-width:100px;text-align:center;}.infoTipCaption{font-size:11px;font:Monaco,monospace;}.infoTipLoading > .infoTipImage,.infoTipLoading > .infoTipCaption{display:none;}h1.groupHeader{padding:2px 4px;margin:0 0 4px 0;border-top:1px solid #CCCCCC;border-bottom:1px solid #CCCCCC;background:#eee url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/group.gif) repeat-x;font-size:11px;font-weight:bold;_position:relative;}.inlineEditor,.fixedWidthEditor{z-index:2147483647;position:absolute;display:none;}.inlineEditor{margin-left:-6px;margin-top:-3px;}.textEditorInner,.fixedWidthEditor{margin:0 0 0 0 !important;padding:0;border:none !important;font:inherit;text-decoration:inherit;background-color:#FFFFFF;}.fixedWidthEditor{border-top:1px solid #888888 !important;border-bottom:1px solid #888888 !important;}.textEditorInner{position:relative;top:-7px;left:-5px;outline:none;resize:none;}.textEditorInner1{padding-left:11px;background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/textEditorBorders.png) repeat-y;_background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/textEditorBorders.gif) repeat-y;_overflow:hidden;}.textEditorInner2{position:relative;padding-right:2px;background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/textEditorBorders.png) repeat-y 100% 0;_background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/textEditorBorders.gif) repeat-y 100% 0;_position:fixed;}.textEditorTop1{background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/textEditorCorners.png) no-repeat 100% 0;margin-left:11px;height:10px;_background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/textEditorCorners.gif) no-repeat 100% 0;_overflow:hidden;}.textEditorTop2{position:relative;left:-11px;width:11px;height:10px;background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/textEditorCorners.png) no-repeat;_background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/textEditorCorners.gif) no-repeat;}.textEditorBottom1{position:relative;background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/textEditorCorners.png) no-repeat 100% 100%;margin-left:11px;height:12px;_background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/textEditorCorners.gif) no-repeat 100% 100%;}.textEditorBottom2{position:relative;left:-11px;width:11px;height:12px;background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/textEditorCorners.png) no-repeat 0 100%;_background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/textEditorCorners.gif) no-repeat 0 100%;}.panelNode-css{overflow-x:hidden;}.cssSheet > .insertBefore{height:1.5em;}.cssRule{position:relative;margin:0;padding:1em 0 0 6px;font-family:Monaco,monospace;color:#000000;}.cssRule:first-child{padding-top:6px;}.cssElementRuleContainer{position:relative;}.cssHead{padding-right:150px;}.cssProp{}.cssPropName{color:DarkGreen;}.cssPropValue{margin-left:8px;color:DarkBlue;}.cssOverridden span{text-decoration:line-through;}.cssInheritedRule{}.cssInheritLabel{margin-right:0.5em;font-weight:bold;}.cssRule .objectLink-sourceLink{top:0;}.cssProp.editGroup:hover{background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/disable.png) no-repeat 2px 1px;_background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/disable.gif) no-repeat 2px 1px;}.cssProp.editGroup.editing{background:none;}.cssProp.disabledStyle{background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/disableHover.png) no-repeat 2px 1px;_background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/disableHover.gif) no-repeat 2px 1px;opacity:1;color:#CCCCCC;}.disabledStyle .cssPropName,.disabledStyle .cssPropValue{color:#CCCCCC;}.cssPropValue.editing + .cssSemi,.inlineExpander + .cssSemi{display:none;}.cssPropValue.editing{white-space:nowrap;}.stylePropName{font-weight:bold;padding:0 4px 4px 4px;width:50%;}.stylePropValue{width:50%;}.panelNode-net{overflow-x:hidden;}.netTable{width:100%;}.hideCategory-undefined .category-undefined,.hideCategory-html .category-html,.hideCategory-css .category-css,.hideCategory-js .category-js,.hideCategory-image .category-image,.hideCategory-xhr .category-xhr,.hideCategory-flash .category-flash,.hideCategory-txt .category-txt,.hideCategory-bin .category-bin{display:none;}.netHeadRow{background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/chrome://firebug/skin/group.gif) repeat-x #FFFFFF;}.netHeadCol{border-bottom:1px solid #CCCCCC;padding:2px 4px 2px 18px;font-weight:bold;}.netHeadLabel{white-space:nowrap;overflow:hidden;}.netHeaderRow{height:16px;}.netHeaderCell{cursor:pointer;-moz-user-select:none;border-bottom:1px solid #9C9C9C;padding:0 !important;font-weight:bold;background:#BBBBBB url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/chrome://firebug/skin/tableHeader.gif) repeat-x;white-space:nowrap;}.netHeaderRow > .netHeaderCell:first-child > .netHeaderCellBox{padding:2px 14px 2px 18px;}.netHeaderCellBox{padding:2px 14px 2px 10px;border-left:1px solid #D9D9D9;border-right:1px solid #9C9C9C;}.netHeaderCell:hover:active{background:#959595 url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/chrome://firebug/skin/tableHeaderActive.gif) repeat-x;}.netHeaderSorted{background:#7D93B2 url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/chrome://firebug/skin/tableHeaderSorted.gif) repeat-x;}.netHeaderSorted > .netHeaderCellBox{border-right-color:#6B7C93;background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/chrome://firebug/skin/arrowDown.png) no-repeat right;}.netHeaderSorted.sortedAscending > .netHeaderCellBox{background-image:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/chrome://firebug/skin/arrowUp.png);}.netHeaderSorted:hover:active{background:#536B90 url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/chrome://firebug/skin/tableHeaderSortedActive.gif) repeat-x;}.panelNode-net .netRowHeader{display:block;}.netRowHeader{cursor:pointer;display:none;height:15px;margin-right:0 !important;}.netRow .netRowHeader{background-position:5px 1px;}.netRow[breakpoint="true"] .netRowHeader{background-image:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/chrome://firebug/skin/breakpoint.png);}.netRow[breakpoint="true"][disabledBreakpoint="true"] .netRowHeader{background-image:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/chrome://firebug/skin/breakpointDisabled.png);}.netRow.category-xhr:hover .netRowHeader{background-color:#F6F6F6;}#netBreakpointBar{max-width:38px;}#netHrefCol > .netHeaderCellBox{border-left:0px;}.netRow .netRowHeader{width:3px;}.netInfoRow .netRowHeader{display:table-cell;}.netTable[hiddenCols~=netHrefCol] TD[id="netHrefCol"],.netTable[hiddenCols~=netHrefCol] TD.netHrefCol,.netTable[hiddenCols~=netStatusCol] TD[id="netStatusCol"],.netTable[hiddenCols~=netStatusCol] TD.netStatusCol,.netTable[hiddenCols~=netDomainCol] TD[id="netDomainCol"],.netTable[hiddenCols~=netDomainCol] TD.netDomainCol,.netTable[hiddenCols~=netSizeCol] TD[id="netSizeCol"],.netTable[hiddenCols~=netSizeCol] TD.netSizeCol,.netTable[hiddenCols~=netTimeCol] TD[id="netTimeCol"],.netTable[hiddenCols~=netTimeCol] TD.netTimeCol{display:none;}.netRow{background:LightYellow;}.netRow.loaded{background:#FFFFFF;}.netRow.loaded:hover{background:#EFEFEF;}.netCol{padding:0;vertical-align:top;border-bottom:1px solid #EFEFEF;white-space:nowrap;height:17px;}.netLabel{width:100%;}.netStatusCol{padding-left:10px;color:rgb(128,128,128);}.responseError > .netStatusCol{color:red;}.netDomainCol{padding-left:5px;}.netSizeCol{text-align:right;padding-right:10px;}.netHrefLabel{-moz-box-sizing:padding-box;overflow:hidden;z-index:10;position:absolute;padding-left:18px;padding-top:1px;max-width:15%;font-weight:bold;}.netFullHrefLabel{display:none;-moz-user-select:none;padding-right:10px;padding-bottom:3px;max-width:100%;background:#FFFFFF;z-index:200;}.netHrefCol:hover > .netFullHrefLabel{display:block;}.netRow.loaded:hover .netCol > .netFullHrefLabel{background-color:#EFEFEF;}.useA11y .a11yShowFullLabel{display:block;background-image:none !important;border:1px solid #CBE087;background-color:LightYellow;font-family:Monaco,monospace;color:#000000;font-size:10px;z-index:2147483647;}.netSizeLabel{padding-left:6px;}.netStatusLabel,.netDomainLabel,.netSizeLabel,.netBar{padding:1px 0 2px 0 !important;}.responseError{color:red;}.hasHeaders .netHrefLabel:hover{cursor:pointer;color:blue;text-decoration:underline;}.netLoadingIcon{position:absolute;border:0;margin-left:14px;width:16px;height:16px;background:transparent no-repeat 0 0;background-image:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/chrome://firebug/skin/loading_16.gif);display:inline-block;}.loaded .netLoadingIcon{display:none;}.netBar,.netSummaryBar{position:relative;border-right:50px solid transparent;}.netResolvingBar{position:absolute;left:0;top:0;bottom:0;background:#FFFFFF url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/chrome://firebug/skin/netBarResolving.gif) repeat-x;z-index:60;}.netConnectingBar{position:absolute;left:0;top:0;bottom:0;background:#FFFFFF url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/chrome://firebug/skin/netBarConnecting.gif) repeat-x;z-index:50;}.netBlockingBar{position:absolute;left:0;top:0;bottom:0;background:#FFFFFF url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/chrome://firebug/skin/netBarWaiting.gif) repeat-x;z-index:40;}.netSendingBar{position:absolute;left:0;top:0;bottom:0;background:#FFFFFF url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/chrome://firebug/skin/netBarSending.gif) repeat-x;z-index:30;}.netWaitingBar{position:absolute;left:0;top:0;bottom:0;background:#FFFFFF url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/chrome://firebug/skin/netBarResponded.gif) repeat-x;z-index:20;min-width:1px;}.netReceivingBar{position:absolute;left:0;top:0;bottom:0;background:#38D63B url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/chrome://firebug/skin/netBarLoading.gif) repeat-x;z-index:10;}.netWindowLoadBar,.netContentLoadBar{position:absolute;left:0;top:0;bottom:0;width:1px;background-color:red;z-index:70;opacity:0.5;display:none;margin-bottom:-1px;}.netContentLoadBar{background-color:Blue;}.netTimeLabel{-moz-box-sizing:padding-box;position:absolute;top:1px;left:100%;padding-left:6px;color:#444444;min-width:16px;}.loaded .netReceivingBar,.loaded.netReceivingBar{background:#B6B6B6 url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/chrome://firebug/skin/netBarLoaded.gif) repeat-x;border-color:#B6B6B6;}.fromCache .netReceivingBar,.fromCache.netReceivingBar{background:#D6D6D6 url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/chrome://firebug/skin/netBarCached.gif) repeat-x;border-color:#D6D6D6;}.netSummaryRow .netTimeLabel,.loaded .netTimeLabel{background:transparent;}.timeInfoTip{width:150px; height:40px}.timeInfoTipBar,.timeInfoTipEventBar{position:relative;display:block;margin:0;opacity:1;height:15px;width:4px;}.timeInfoTipEventBar{width:1px !important;}.timeInfoTipCell.startTime{padding-right:8px;}.timeInfoTipCell.elapsedTime{text-align:right;padding-right:8px;}.sizeInfoLabelCol{font-weight:bold;padding-right:10px;font-family:Lucida Grande,Tahoma,sans-serif;font-size:11px;}.sizeInfoSizeCol{font-weight:bold;}.sizeInfoDetailCol{color:gray;text-align:right;}.sizeInfoDescCol{font-style:italic;}.netSummaryRow .netReceivingBar{background:#BBBBBB;border:none;}.netSummaryLabel{color:#222222;}.netSummaryRow{background:#BBBBBB !important;font-weight:bold;}.netSummaryRow .netBar{border-right-color:#BBBBBB;}.netSummaryRow > .netCol{border-top:1px solid #999999;border-bottom:2px solid;-moz-border-bottom-colors:#EFEFEF #999999;padding-top:1px;padding-bottom:2px;}.netSummaryRow > .netHrefCol:hover{background:transparent !important;}.netCountLabel{padding-left:18px;}.netTotalSizeCol{text-align:right;padding-right:10px;}.netTotalTimeCol{text-align:right;}.netCacheSizeLabel{position:absolute;z-index:1000;left:0;top:0;}.netLimitRow{background:rgb(255,255,225) !important;font-weight:normal;color:black;font-weight:normal;}.netLimitLabel{padding-left:18px;}.netLimitRow > .netCol{border-bottom:2px solid;-moz-border-bottom-colors:#EFEFEF #999999;vertical-align:middle !important;padding-top:2px;padding-bottom:2px;}.netLimitButton{font-size:11px;padding-top:1px;padding-bottom:1px;}.netInfoCol{border-top:1px solid #EEEEEE;background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/chrome://firebug/skin/group.gif) repeat-x #FFFFFF;}.netInfoBody{margin:10px 0 4px 10px;}.netInfoTabs{position:relative;padding-left:17px;}.netInfoTab{position:relative;top:-3px;margin-top:10px;padding:4px 6px;border:1px solid transparent;border-bottom:none;_border:none;font-weight:bold;color:#565656;cursor:pointer;}.netInfoTabSelected{cursor:default !important;border:1px solid #D7D7D7 !important;border-bottom:none !important;-moz-border-radius:4px 4px 0 0;-webkit-border-radius:4px 4px 0 0;border-radius:4px 4px 0 0;background-color:#FFFFFF;}.logRow-netInfo.error .netInfoTitle{color:red;}.logRow-netInfo.loading .netInfoResponseText{font-style:italic;color:#888888;}.loading .netInfoResponseHeadersTitle{display:none;}.netInfoResponseSizeLimit{font-family:Lucida Grande,Tahoma,sans-serif;padding-top:10px;font-size:11px;}.netInfoText{display:none;margin:0;border:1px solid #D7D7D7;border-right:none;padding:8px;background-color:#FFFFFF;font-family:Monaco,monospace;white-space:pre-wrap;}.netInfoTextSelected{display:block;}.netInfoParamName{padding-right:10px;font-family:Lucida Grande,Tahoma,sans-serif;font-weight:bold;vertical-align:top;text-align:right;white-space:nowrap;}.netInfoPostText .netInfoParamName{width:1px;}.netInfoParamValue{width:100%;}.netInfoHeadersText,.netInfoPostText,.netInfoPutText{padding-top:0;}.netInfoHeadersGroup,.netInfoPostParams,.netInfoPostSource{margin-bottom:4px;border-bottom:1px solid #D7D7D7;padding-top:8px;padding-bottom:2px;font-family:Lucida Grande,Tahoma,sans-serif;font-weight:bold;color:#565656;}.netInfoPostParamsTable,.netInfoPostPartsTable,.netInfoPostJSONTable,.netInfoPostXMLTable,.netInfoPostSourceTable{margin-bottom:10px;width:100%;}.netInfoPostContentType{color:#bdbdbd;padding-left:50px;font-weight:normal;}.netInfoHtmlPreview{border:0;width:100%;height:100%;}.netHeadersViewSource{color:#bdbdbd;margin-left:200px;font-weight:normal;}.netHeadersViewSource:hover{color:blue;cursor:pointer;}.netActivationRow,.netPageSeparatorRow{background:rgb(229,229,229) !important;font-weight:normal;color:black;}.netActivationLabel{background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/chrome://firebug/skin/infoIcon.png) no-repeat 3px 2px;padding-left:22px;}.netPageSeparatorRow{height:5px !important;}.netPageSeparatorLabel{padding-left:22px;height:5px !important;}.netPageRow{background-color:rgb(255,255,255);}.netPageRow:hover{background:#EFEFEF;}.netPageLabel{padding:1px 0 2px 18px !important;font-weight:bold;}.netActivationRow > .netCol{border-bottom:2px solid;-moz-border-bottom-colors:#EFEFEF #999999;padding-top:2px;padding-bottom:3px;}.twisty,.logRow-errorMessage > .hasTwisty > .errorTitle,.logRow-log > .objectBox-array.hasTwisty,.logRow-spy .spyHead .spyTitle,.logGroup > .logRow,.memberRow.hasChildren > .memberLabelCell > .memberLabel,.hasHeaders .netHrefLabel,.netPageRow > .netCol > .netPageTitle{background-image:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/tree_open.gif);background-repeat:no-repeat;background-position:2px 2px;min-height:12px;}.logRow-errorMessage > .hasTwisty.opened > .errorTitle,.logRow-log > .objectBox-array.hasTwisty.opened,.logRow-spy.opened .spyHead .spyTitle,.logGroup.opened > .logRow,.memberRow.hasChildren.opened > .memberLabelCell > .memberLabel,.nodeBox.highlightOpen > .nodeLabel > .twisty,.nodeBox.open > .nodeLabel > .twisty,.netRow.opened > .netCol > .netHrefLabel,.netPageRow.opened > .netCol > .netPageTitle{background-image:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/tree_close.gif);}.twisty{background-position:4px 4px;}* html .logRow-spy .spyHead .spyTitle,* html .logGroup .logGroupLabel,* html .hasChildren .memberLabelCell .memberLabel,* html .hasHeaders .netHrefLabel{background-image:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/tree_open.gif);background-repeat:no-repeat;background-position:2px 2px;}* html .opened .spyHead .spyTitle,* html .opened .logGroupLabel,* html .opened .memberLabelCell .memberLabel{background-image:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/tree_close.gif);background-repeat:no-repeat;background-position:2px 2px;}.panelNode-console{overflow-x:hidden;}.objectLink{text-decoration:none;}.objectLink:hover{cursor:pointer;text-decoration:underline;}.logRow{position:relative;margin:0;border-bottom:1px solid #D7D7D7;padding:2px 4px 1px 6px;background-color:#FFFFFF;overflow:hidden !important;}.useA11y .logRow:focus{border-bottom:1px solid #000000 !important;outline:none !important;background-color:#FFFFAD !important;}.useA11y .logRow:focus a.objectLink-sourceLink{background-color:#FFFFAD;}.useA11y .a11yFocus:focus,.useA11y .objectBox:focus{outline:2px solid #FF9933;background-color:#FFFFAD;}.useA11y .objectBox-null:focus,.useA11y .objectBox-undefined:focus{background-color:#888888 !important;}.useA11y .logGroup.opened > .logRow{border-bottom:1px solid #ffffff;}.logGroup{background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/group.gif) repeat-x #FFFFFF;padding:0 !important;border:none !important;}.logGroupBody{display:none;margin-left:16px;border-left:1px solid #D7D7D7;border-top:1px solid #D7D7D7;background:#FFFFFF;}.logGroup > .logRow{background-color:transparent !important;font-weight:bold;}.logGroup.opened > .logRow{border-bottom:none;}.logGroup.opened > .logGroupBody{display:block;}.logRow-command > .objectBox-text{font-family:Monaco,monospace;color:#0000FF;white-space:pre-wrap;}.logRow-info,.logRow-warn,.logRow-error,.logRow-assert,.logRow-warningMessage,.logRow-errorMessage{padding-left:22px;background-repeat:no-repeat;background-position:4px 2px;}.logRow-assert,.logRow-warningMessage,.logRow-errorMessage{padding-top:0;padding-bottom:0;}.logRow-info,.logRow-info .objectLink-sourceLink{background-color:#FFFFFF;}.logRow-warn,.logRow-warningMessage,.logRow-warn .objectLink-sourceLink,.logRow-warningMessage .objectLink-sourceLink{background-color:cyan;}.logRow-error,.logRow-assert,.logRow-errorMessage,.logRow-error .objectLink-sourceLink,.logRow-errorMessage .objectLink-sourceLink{background-color:LightYellow;}.logRow-error,.logRow-assert,.logRow-errorMessage{color:#FF0000;}.logRow-info{}.logRow-warn,.logRow-warningMessage{}.logRow-error,.logRow-assert,.logRow-errorMessage{}.objectBox-string,.objectBox-text,.objectBox-number,.objectLink-element,.objectLink-textNode,.objectLink-function,.objectBox-stackTrace,.objectLink-profile{font-family:Monaco,monospace;}.objectBox-string,.objectBox-text,.objectLink-textNode{white-space:pre-wrap;}.objectBox-number,.objectLink-styleRule,.objectLink-element,.objectLink-textNode{color:#000088;}.objectBox-string{color:#FF0000;}.objectLink-function,.objectBox-stackTrace,.objectLink-profile{color:DarkGreen;}.objectBox-null,.objectBox-undefined{padding:0 2px;border:1px solid #666666;background-color:#888888;color:#FFFFFF;}.objectBox-exception{padding:0 2px 0 18px;color:red;}.objectLink-sourceLink{position:absolute;right:4px;top:2px;padding-left:8px;font-family:Lucida Grande,sans-serif;font-weight:bold;color:#0000FF;}.errorTitle{margin-top:0px;margin-bottom:1px;padding-top:2px;padding-bottom:2px;}.errorTrace{margin-left:17px;}.errorSourceBox{margin:2px 0;}.errorSource-none{display:none;}.errorSource-syntax > .errorBreak{visibility:hidden;}.errorSource{cursor:pointer;font-family:Monaco,monospace;color:DarkGreen;}.errorSource:hover{text-decoration:underline;}.errorBreak{cursor:pointer;display:none;margin:0 6px 0 0;width:13px;height:14px;vertical-align:bottom;opacity:0.1;}.hasBreakSwitch .errorBreak{display:inline;}.breakForError .errorBreak{opacity:1;}.assertDescription{margin:0;}.logRow-profile > .logRow > .objectBox-text{font-family:Lucida Grande,Tahoma,sans-serif;color:#000000;}.logRow-profile > .logRow > .objectBox-text:last-child{color:#555555;font-style:italic;}.logRow-profile.opened > .logRow{padding-bottom:4px;}.profilerRunning > .logRow{padding-left:22px !important;}.profileSizer{width:100%;overflow-x:auto;overflow-y:scroll;}.profileTable{border-bottom:1px solid #D7D7D7;padding:0 0 4px 0;}.profileTable tr[odd="1"]{background-color:#F5F5F5;vertical-align:middle;}.profileTable a{vertical-align:middle;}.profileTable td{padding:1px 4px 0 4px;}.headerCell{cursor:pointer;-moz-user-select:none;border-bottom:1px solid #9C9C9C;padding:0 !important;font-weight:bold;}.headerCellBox{padding:2px 4px;border-left:1px solid #D9D9D9;border-right:1px solid #9C9C9C;}.headerCell:hover:active{}.headerSorted{}.headerSorted > .headerCellBox{border-right-color:#6B7C93;}.headerSorted.sortedAscending > .headerCellBox{}.headerSorted:hover:active{}.linkCell{text-align:right;}.linkCell > .objectLink-sourceLink{position:static;}.logRow-stackTrace{padding-top:0;background:#f8f8f8;}.logRow-stackTrace > .objectBox-stackFrame{position:relative;padding-top:2px;}.objectLink-object{font-family:Lucida Grande,sans-serif;font-weight:bold;color:DarkGreen;white-space:pre-wrap;}.objectProp-object{color:DarkGreen;}.objectProps{color:#000;font-weight:normal;}.objectPropName{color:#777;}.objectProps .objectProp-string{color:#f55;}.objectProps .objectProp-number{color:#55a;}.objectProps .objectProp-object{color:#585;}.selectorTag,.selectorId,.selectorClass{font-family:Monaco,monospace;font-weight:normal;}.selectorTag{color:#0000FF;}.selectorId{color:DarkBlue;}.selectorClass{color:red;}.selectorHidden > .selectorTag{color:#5F82D9;}.selectorHidden > .selectorId{color:#888888;}.selectorHidden > .selectorClass{color:#D86060;}.selectorValue{font-family:Lucida Grande,sans-serif;font-style:italic;color:#555555;}.panelNode.searching .logRow{display:none;}.logRow.matched{display:block !important;}.logRow.matching{position:absolute;left:-1000px;top:-1000px;max-width:0;max-height:0;overflow:hidden;}.objectLeftBrace,.objectRightBrace,.objectEqual,.objectComma,.arrayLeftBracket,.arrayRightBracket,.arrayComma{font-family:Monaco,monospace;}.objectLeftBrace,.objectRightBrace,.arrayLeftBracket,.arrayRightBracket{font-weight:bold;}.objectLeftBrace,.arrayLeftBracket{margin-right:4px;}.objectRightBrace,.arrayRightBracket{margin-left:4px;}.logRow-dir{padding:0;}.logRow-errorMessage .hasTwisty .errorTitle,.logRow-spy .spyHead .spyTitle,.logGroup .logRow{cursor:pointer;padding-left:18px;background-repeat:no-repeat;background-position:3px 3px;}.logRow-errorMessage > .hasTwisty > .errorTitle{background-position:2px 3px;}.logRow-errorMessage > .hasTwisty > .errorTitle:hover,.logRow-spy .spyHead .spyTitle:hover,.logGroup > .logRow:hover{text-decoration:underline;}.logRow-spy{padding:0 !important;}.logRow-spy,.logRow-spy .objectLink-sourceLink{background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/group.gif) repeat-x #FFFFFF;padding-right:4px;right:0;}.logRow-spy.opened{padding-bottom:4px;border-bottom:none;}.spyTitle{color:#000000;font-weight:bold;-moz-box-sizing:padding-box;overflow:hidden;z-index:100;padding-left:18px;}.spyCol{padding:0;white-space:nowrap;height:16px;}.spyTitleCol:hover > .objectLink-sourceLink,.spyTitleCol:hover > .spyTime,.spyTitleCol:hover > .spyStatus,.spyTitleCol:hover > .spyTitle{display:none;}.spyFullTitle{display:none;-moz-user-select:none;max-width:100%;background-color:Transparent;}.spyTitleCol:hover > .spyFullTitle{display:block;}.spyStatus{padding-left:10px;color:rgb(128,128,128);}.spyTime{margin-left:4px;margin-right:4px;color:rgb(128,128,128);}.spyIcon{margin-right:4px;margin-left:4px;width:16px;height:16px;vertical-align:middle;background:transparent no-repeat 0 0;display:none;}.loading .spyHead .spyRow .spyIcon{background-image:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/loading_16.gif);display:block;}.logRow-spy.loaded:not(.error) .spyHead .spyRow .spyIcon{width:0;margin:0;}.logRow-spy.error .spyHead .spyRow .spyIcon{background-image:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/errorIcon-sm.png);display:block;background-position:2px 2px;}.logRow-spy .spyHead .netInfoBody{display:none;}.logRow-spy.opened .spyHead .netInfoBody{margin-top:10px;display:block;}.logRow-spy.error .spyTitle,.logRow-spy.error .spyStatus,.logRow-spy.error .spyTime{color:red;}.logRow-spy.loading .spyResponseText{font-style:italic;color:#888888;}.caption{font-family:Lucida Grande,Tahoma,sans-serif;font-weight:bold;color:#444444;}.warning{padding:10px;font-family:Lucida Grande,Tahoma,sans-serif;font-weight:bold;color:#888888;}.panelNode-dom{overflow-x:hidden !important;}.domTable{font-size:1em;width:100%;table-layout:fixed;background:#fff;}.domTableIE{width:auto;}.memberLabelCell{padding:2px 0 2px 0;vertical-align:top;}.memberValueCell{padding:1px 0 1px 5px;display:block;overflow:hidden;}.memberLabel{display:block;cursor:default;-moz-user-select:none;overflow:hidden;padding-left:18px;background-color:#FFFFFF;text-decoration:none;}.memberRow.hasChildren .memberLabelCell .memberLabel:hover{cursor:pointer;color:blue;text-decoration:underline;}.userLabel{color:#000000;font-weight:bold;}.userClassLabel{color:#E90000;font-weight:bold;}.userFunctionLabel{color:#025E2A;font-weight:bold;}.domLabel{color:#000000;}.domFunctionLabel{color:#025E2A;}.ordinalLabel{color:SlateBlue;font-weight:bold;}.scopesRow{padding:2px 18px;background-color:LightYellow;border-bottom:5px solid #BEBEBE;color:#666666;}.scopesLabel{background-color:LightYellow;}.watchEditCell{padding:2px 18px;background-color:LightYellow;border-bottom:1px solid #BEBEBE;color:#666666;}.editor-watchNewRow,.editor-memberRow{font-family:Monaco,monospace !important;}.editor-memberRow{padding:1px 0 !important;}.editor-watchRow{padding-bottom:0 !important;}.watchRow > .memberLabelCell{font-family:Monaco,monospace;padding-top:1px;padding-bottom:1px;}.watchRow > .memberLabelCell > .memberLabel{background-color:transparent;}.watchRow > .memberValueCell{padding-top:2px;padding-bottom:2px;}.watchRow > .memberLabelCell,.watchRow > .memberValueCell{background-color:#F5F5F5;border-bottom:1px solid #BEBEBE;}.watchToolbox{z-index:2147483647;position:absolute;right:0;padding:1px 2px;}#fbConsole{overflow-x:hidden !important;}#fbCSS{font:1em Monaco,monospace;padding:0 7px;}#fbstylesheetButtons select,#fbScriptButtons select{font:11px Lucida Grande,Tahoma,sans-serif;margin-top:1px;padding-left:3px;background:#fafafa;border:1px inset #fff;width:220px;outline:none;}.Selector{margin-top:10px}.CSSItem{margin-left:4%}.CSSText{padding-left:20px;}.CSSProperty{color:#005500;}.CSSValue{padding-left:5px; color:#000088;}#fbHTMLStatusBar{display:inline;}.fbToolbarButtons{display:none;}.fbStatusSeparator{display:block;float:left;padding-top:4px;}#fbStatusBarBox{display:none;}#fbToolbarContent{display:block;position:absolute;_position:absolute;top:0;padding-top:4px;height:23px;clip:rect(0,2048px,27px,0);}.fbTabMenuTarget{display:none !important;float:left;width:10px;height:10px;margin-top:6px;background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/tabMenuTarget.png);}.fbTabMenuTarget:hover{background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/tabMenuTargetHover.png);}.fbShadow{float:left;background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/shadowAlpha.png) no-repeat bottom right !important;background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/shadow2.gif) no-repeat bottom right;margin:10px 0 0 10px !important;margin:10px 0 0 5px;}.fbShadowContent{display:block;position:relative;background-color:#fff;border:1px solid #a9a9a9;top:-6px;left:-6px;}.fbMenu{display:none;position:absolute;font-size:11px;line-height:13px;z-index:2147483647;}.fbMenuContent{padding:2px;}.fbMenuSeparator{display:block;position:relative;padding:1px 18px 0;text-decoration:none;color:#000;cursor:default;background:#ACA899;margin:4px 0;}.fbMenuOption{display:block;position:relative;padding:2px 18px;text-decoration:none;color:#000;cursor:default;}.fbMenuOption:hover{color:#fff;background:#316AC5;}.fbMenuGroup{background:transparent url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/tabMenuPin.png) no-repeat right 0;}.fbMenuGroup:hover{background:#316AC5 url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/tabMenuPin.png) no-repeat right -17px;}.fbMenuGroupSelected{color:#fff;background:#316AC5 url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/tabMenuPin.png) no-repeat right -17px;}.fbMenuChecked{background:transparent url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/tabMenuCheckbox.png) no-repeat 4px 0;}.fbMenuChecked:hover{background:#316AC5 url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/tabMenuCheckbox.png) no-repeat 4px -17px;}.fbMenuRadioSelected{background:transparent url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/tabMenuRadio.png) no-repeat 4px 0;}.fbMenuRadioSelected:hover{background:#316AC5 url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/tabMenuRadio.png) no-repeat 4px -17px;}.fbMenuShortcut{padding-right:85px;}.fbMenuShortcutKey{position:absolute;right:0;top:2px;width:77px;}#fbFirebugMenu{top:22px;left:0;}.fbMenuDisabled{color:#ACA899 !important;}#fbFirebugSettingsMenu{left:245px;top:99px;}#fbConsoleMenu{top:42px;left:48px;}.fbIconButton{display:block;}.fbIconButton{display:block;}.fbIconButton{display:block;float:left;height:20px;width:20px;color:#000;margin-right:2px;text-decoration:none;cursor:default;}.fbIconButton:hover{position:relative;top:-1px;left:-1px;margin-right:0;_margin-right:1px;color:#333;border:1px solid #fff;border-bottom:1px solid #bbb;border-right:1px solid #bbb;}.fbIconPressed{position:relative;margin-right:0;_margin-right:1px;top:0 !important;left:0 !important;height:19px;color:#333 !important;border:1px solid #bbb !important;border-bottom:1px solid #cfcfcf !important;border-right:1px solid #ddd !important;}#fbErrorPopup{position:absolute;right:0;bottom:0;height:19px;width:75px;background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/sprite.png) #f1f2ee 0 0;z-index:999;}#fbErrorPopupContent{position:absolute;right:0;top:1px;height:18px;width:75px;_width:74px;border-left:1px solid #aca899;}#fbErrorIndicator{position:absolute;top:2px;right:5px;}.fbBtnInspectActive{background:#aaa;color:#fff !important;}.fbBody{margin:0;padding:0;overflow:hidden;font-family:Lucida Grande,Tahoma,sans-serif;font-size:11px;background:#fff;}.clear{clear:both;}#fbMiniChrome{display:none;right:0;height:27px;background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/sprite.png) #f1f2ee 0 0;margin-left:1px;}#fbMiniContent{display:block;position:relative;left:-1px;right:0;top:1px;height:25px;border-left:1px solid #aca899;}#fbToolbarSearch{float:right;border:1px solid #ccc;margin:0 5px 0 0;background:#fff url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/search.png) no-repeat 4px 2px !important;background:#fff url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/search.gif) no-repeat 4px 2px;padding-left:20px;font-size:11px;}#fbToolbarErrors{float:right;margin:1px 4px 0 0;font-size:11px;}#fbLeftToolbarErrors{float:left;margin:7px 0px 0 5px;font-size:11px;}.fbErrors{padding-left:20px;height:14px;background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/errorIcon.png) no-repeat !important;background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/errorIcon.gif) no-repeat;color:#f00;font-weight:bold;}#fbMiniErrors{display:inline;display:none;float:right;margin:5px 2px 0 5px;}#fbMiniIcon{float:right;margin:3px 4px 0;height:20px;width:20px;float:right;background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/sprite.png) 0 -135px;cursor:pointer;}#fbChrome{font-family:Lucida Grande,Tahoma,sans-serif;font-size:11px;position:absolute;_position:static;top:0;left:0;height:100%;width:100%;border-collapse:collapse;border-spacing:0;background:#fff;overflow:hidden;}#fbChrome > tbody > tr > td{padding:0;}#fbTop{height:49px;}#fbToolbar{background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/sprite.png) #f1f2ee 0 0;height:27px;font-size:11px;line-height:13px;}#fbPanelBarBox{background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/sprite.png) #dbd9c9 0 -27px;height:22px;}#fbContent{height:100%;vertical-align:top;}#fbBottom{height:18px;background:#fff;}#fbToolbarIcon{float:left;padding:0 5px 0;}#fbToolbarIcon a{background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/sprite.png) 0 -135px;}#fbToolbarButtons{padding:0 2px 0 5px;}#fbToolbarButtons{padding:0 2px 0 5px;}.fbButton{text-decoration:none;display:block;float:left;color:#000;padding:4px 6px 4px 7px;cursor:default;}.fbButton:hover{color:#333;background:#f5f5ef url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/buttonBg.png);padding:3px 5px 3px 6px;border:1px solid #fff;border-bottom:1px solid #bbb;border-right:1px solid #bbb;}.fbBtnPressed{background:#e3e3db url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/buttonBgHover.png) !important;padding:3px 4px 2px 6px !important;margin:1px 0 0 1px !important;border:1px solid #ACA899 !important;border-color:#ACA899 #ECEBE3 #ECEBE3 #ACA899 !important;}#fbStatusBarBox{top:4px;cursor:default;}.fbToolbarSeparator{overflow:hidden;border:1px solid;border-color:transparent #fff transparent #777;_border-color:#eee #fff #eee #777;height:7px;margin:6px 3px;float:left;}.fbBtnSelected{font-weight:bold;}.fbStatusBar{color:#aca899;}.fbStatusBar a{text-decoration:none;color:black;}.fbStatusBar a:hover{color:blue;cursor:pointer;}#fbWindowButtons{position:absolute;white-space:nowrap;right:0;top:0;height:17px;width:48px;padding:5px;z-index:6;background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/sprite.png) #f1f2ee 0 0;}#fbPanelBar1{width:1024px; z-index:8;left:0;white-space:nowrap;background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/sprite.png) #dbd9c9 0 -27px;position:absolute;left:4px;}#fbPanelBar2Box{background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/sprite.png) #dbd9c9 0 -27px;position:absolute;height:22px;width:300px; z-index:9;right:0;}#fbPanelBar2{position:absolute;width:290px; height:22px;padding-left:4px;}.fbPanel{display:none;}#fbPanelBox1,#fbPanelBox2{max-height:inherit;height:100%;font-size:1em;}#fbPanelBox2{background:#fff;}#fbPanelBox2{width:300px;background:#fff;}#fbPanel2{margin-left:6px;background:#fff;}#fbLargeCommandLine{display:none;position:absolute;z-index:9;top:27px;right:0;width:294px;height:201px;border-width:0;margin:0;padding:2px 0 0 2px;resize:none;outline:none;font-size:11px;overflow:auto;border-top:1px solid #B9B7AF;_right:-1px;_border-left:1px solid #fff;}#fbLargeCommandButtons{display:none;background:#ECE9D8;bottom:0;right:0;width:294px;height:21px;padding-top:1px;position:fixed;border-top:1px solid #ACA899;z-index:9;}#fbSmallCommandLineIcon{background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/down.png) no-repeat;position:absolute;right:2px;bottom:3px;z-index:99;}#fbSmallCommandLineIcon:hover{background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/downHover.png) no-repeat;}.hide{overflow:hidden !important;position:fixed !important;display:none !important;visibility:hidden !important;}#fbCommand{height:18px;}#fbCommandBox{position:fixed;_position:absolute;width:100%;height:18px;bottom:0;overflow:hidden;z-index:9;background:#fff;border:0;border-top:1px solid #ccc;}#fbCommandIcon{position:absolute;color:#00f;top:2px;left:6px;display:inline;font:11px Monaco,monospace;z-index:10;}#fbCommandLine{position:absolute;width:100%;top:0;left:0;border:0;margin:0;padding:2px 0 2px 32px;font:11px Monaco,monospace;z-index:9;outline:none;}#fbLargeCommandLineIcon{background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/up.png) no-repeat;position:absolute;right:1px;bottom:1px;z-index:10;}#fbLargeCommandLineIcon:hover{background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/upHover.png) no-repeat;}div.fbFitHeight{overflow:auto;position:relative;}.fbSmallButton{overflow:hidden;width:16px;height:16px;display:block;text-decoration:none;cursor:default;}#fbWindowButtons .fbSmallButton{float:right;}#fbWindow_btClose{background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/min.png);}#fbWindow_btClose:hover{background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/minHover.png);}#fbWindow_btDetach{background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/detach.png);}#fbWindow_btDetach:hover{background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/detachHover.png);}#fbWindow_btDeactivate{background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/off.png);}#fbWindow_btDeactivate:hover{background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/offHover.png);}.fbTab{text-decoration:none;display:none;float:left;width:auto;float:left;cursor:default;font-family:Lucida Grande,Tahoma,sans-serif;font-size:11px;line-height:13px;font-weight:bold;height:22px;color:#565656;}.fbPanelBar span{float:left;}.fbPanelBar .fbTabL,.fbPanelBar .fbTabR{height:22px;width:8px;}.fbPanelBar .fbTabText{padding:4px 1px 0;}a.fbTab:hover{background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/sprite.png) 0 -73px;}a.fbTab:hover .fbTabL{background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/sprite.png) -16px -96px;}a.fbTab:hover .fbTabR{background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/sprite.png) -24px -96px;}.fbSelectedTab{background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/sprite.png) #f1f2ee 0 -50px !important;color:#000;}.fbSelectedTab .fbTabL{background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/sprite.png) 0 -96px !important;}.fbSelectedTab .fbTabR{background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/sprite.png) -8px -96px !important;}#fbHSplitter{position:fixed;_position:absolute;left:0;top:0;width:100%;height:5px;overflow:hidden;cursor:n-resize !important;background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/pixel_transparent.gif);z-index:9;}#fbHSplitter.fbOnMovingHSplitter{height:100%;z-index:100;}.fbVSplitter{background:#ece9d8;color:#000;border:1px solid #716f64;border-width:0 1px;border-left-color:#aca899;width:4px;cursor:e-resize;overflow:hidden;right:294px;text-decoration:none;z-index:10;position:absolute;height:100%;top:27px;}div.lineNo{font:1em/1.4545em Monaco,monospace;position:relative;float:left;top:0;left:0;margin:0 5px 0 0;padding:0 5px 0 10px;background:#eee;color:#888;border-right:1px solid #ccc;text-align:right;}.sourceBox{position:absolute;}.sourceCode{font:1em Monaco,monospace;overflow:hidden;white-space:pre;display:inline;}.nodeControl{margin-top:3px;margin-left:-14px;float:left;width:9px;height:9px;overflow:hidden;cursor:default;background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/tree_open.gif);_float:none;_display:inline;_position:absolute;}div.nodeMaximized{background:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/tree_close.gif);}div.objectBox-element{padding:1px 3px;}.objectBox-selector{cursor:default;}.selectedElement{background:highlight;color:#fff !important;}.selectedElement span{color:#fff !important;}* html .selectedElement{position:relative;}@media screen and (-webkit-min-device-pixel-ratio:0){.selectedElement{background:#316AC5;color:#fff !important;}}.logRow *{font-size:1em;}.logRow{position:relative;border-bottom:1px solid #D7D7D7;padding:2px 4px 1px 6px;zbackground-color:#FFFFFF;}.logRow-command{font-family:Monaco,monospace;color:blue;}.objectBox-string,.objectBox-text,.objectBox-number,.objectBox-function,.objectLink-element,.objectLink-textNode,.objectLink-function,.objectBox-stackTrace,.objectLink-profile{font-family:Monaco,monospace;}.objectBox-null{padding:0 2px;border:1px solid #666666;background-color:#888888;color:#FFFFFF;}.objectBox-string{color:red;}.objectBox-number{color:#000088;}.objectBox-function{color:DarkGreen;}.objectBox-object{color:DarkGreen;font-weight:bold;font-family:Lucida Grande,sans-serif;}.objectBox-array{color:#000;}.logRow-info,.logRow-error,.logRow-warn{background:#fff no-repeat 2px 2px;padding-left:20px;padding-bottom:3px;}.logRow-info{background-image:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/infoIcon.png) !important;background-image:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/infoIcon.gif);}.logRow-warn{background-color:cyan;background-image:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/warningIcon.png) !important;background-image:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/warningIcon.gif);}.logRow-error{background-color:LightYellow;background-image:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/errorIcon.png) !important;background-image:url(https://cdn.jsdelivr.net/gh/aardio/firebug-lite@1.4.1/skin/xp/errorIcon.gif);color:#f00;}.errorMessage{vertical-align:top;color:#f00;}.objectBox-sourceLink{position:absolute;right:4px;top:2px;padding-left:8px;font-family:Lucida Grande,sans-serif;font-weight:bold;color:#0000FF;}.selectorTag,.selectorId,.selectorClass{font-family:Monaco,monospace;font-weight:normal;}.selectorTag{color:#0000FF;}.selectorId{color:DarkBlue;}.selectorClass{color:red;}.objectBox-element{font-family:Monaco,monospace;color:#000088;}.nodeChildren{padding-left:26px;}.nodeTag{color:blue;cursor:pointer;}.nodeValue{color:#FF0000;font-weight:normal;}.nodeText,.nodeComment{margin:0 2px;vertical-align:top;}.nodeText{color:#333333;font-family:Monaco,monospace;}.nodeComment{color:DarkGreen;}.nodeHidden,.nodeHidden *{color:#888888;}.nodeHidden .nodeTag{color:#5F82D9;}.nodeHidden .nodeValue{color:#D86060;}.selectedElement .nodeHidden,.selectedElement .nodeHidden *{color:SkyBlue !important;}.log-object{}.property{position:relative;clear:both;height:15px;}.propertyNameCell{vertical-align:top;float:left;width:28%;position:absolute;left:0;z-index:0;}.propertyValueCell{float:right;width:68%;background:#fff;position:absolute;padding-left:5px;display:table-cell;right:0;z-index:1;}.propertyName{font-weight:bold;}.FirebugPopup{height:100% !important;}.FirebugPopup #fbWindowButtons{display:none !important;}.FirebugPopup #fbHSplitter{display:none !important;}',HTML:'<table id="fbChrome" cellpadding="0" cellspacing="0" border="0"><tbody><tr><td id="fbTop" colspan="2"><div id="fbWindowButtons"><a id="fbWindow_btDeactivate" class="fbSmallButton fbHover" title="Deactivate Firebug for this web page">&nbsp;</a><a id="fbWindow_btDetach" class="fbSmallButton fbHover" title="Open Firebug in popup window">&nbsp;</a><a id="fbWindow_btClose" class="fbSmallButton fbHover" title="Minimize Firebug">&nbsp;</a></div><div id="fbToolbar"><div id="fbToolbarContent"><span id="fbToolbarIcon"><a id="fbFirebugButton" class="fbIconButton" class="fbHover" target="_blank">&nbsp;</a></span><span id="fbToolbarButtons"><span id="fbFixedButtons"><a id="fbChrome_btInspect" class="fbButton fbHover" title="Click an element in the page to inspect">Inspect</a></span><span id="fbConsoleButtons" class="fbToolbarButtons"><a id="fbConsole_btClear" class="fbButton fbHover" title="Clear the console">Clear</a></span></span><span id="fbStatusBarBox"><span class="fbToolbarSeparator"></span></span></div></div><div id="fbPanelBarBox"><div id="fbPanelBar1" class="fbPanelBar"><a id="fbConsoleTab" class="fbTab fbHover"><span class="fbTabL"></span><span class="fbTabText">Console</span><span class="fbTabMenuTarget"></span><span class="fbTabR"></span></a><a id="fbHTMLTab" class="fbTab fbHover"><span class="fbTabL"></span><span class="fbTabText">HTML</span><span class="fbTabR"></span></a><a class="fbTab fbHover"><span class="fbTabL"></span><span class="fbTabText">CSS</span><span class="fbTabR"></span></a><a class="fbTab fbHover"><span class="fbTabL"></span><span class="fbTabText">Script</span><span class="fbTabR"></span></a><a class="fbTab fbHover"><span class="fbTabL"></span><span class="fbTabText">DOM</span><span class="fbTabR"></span></a></div><div id="fbPanelBar2Box" class="hide"><div id="fbPanelBar2" class="fbPanelBar"></div></div></div><div id="fbHSplitter">&nbsp;</div></td></tr><tr id="fbContent"><td id="fbPanelBox1"><div id="fbPanel1" class="fbFitHeight"><div id="fbConsole" class="fbPanel"></div><div id="fbHTML" class="fbPanel"></div></div></td><td id="fbPanelBox2" class="hide"><div id="fbVSplitter" class="fbVSplitter">&nbsp;</div><div id="fbPanel2" class="fbFitHeight"><div id="fbHTML_Style" class="fbPanel"></div><div id="fbHTML_Layout" class="fbPanel"></div><div id="fbHTML_DOM" class="fbPanel"></div></div><textarea id="fbLargeCommandLine" class="fbFitHeight"></textarea><div id="fbLargeCommandButtons"><a id="fbCommand_btRun" class="fbButton fbHover">Run</a><a id="fbCommand_btClear" class="fbButton fbHover">Clear</a><a id="fbSmallCommandLineIcon" class="fbSmallButton fbHover"></a></div></td></tr><tr id="fbBottom" class="hide"><td id="fbCommand" colspan="2"><div id="fbCommandBox"><div id="fbCommandIcon">&gt;&gt;&gt;</div><input id="fbCommandLine" name="fbCommandLine" type="text"/><a id="fbLargeCommandLineIcon" class="fbSmallButton fbHover"></a></div></td></tr></tbody></table><span id="fbMiniChrome"><span id="fbMiniContent"><span id="fbMiniIcon" title="Open Firebug Lite"></span><span id="fbMiniErrors" class="fbErrors"></span></span></span>'}
		}});
		FBL.initialize()
		})();
	`,
	"css/tabulator.min.css": `/* Tabulator v4.9.3 (c) Oliver Folkerd */
	.tabulator{position:relative;border:1px solid #999;background-color:#888;font-size:14px;text-align:left;overflow:hidden;transform:translatez(0)}.tabulator[tabulator-layout=fitDataFill] .tabulator-tableHolder .tabulator-table{min-width:100%}.tabulator[tabulator-layout=fitDataTable]{display:inline-block}.tabulator.tabulator-block-select{-webkit-user-select:none;-ms-user-select:none;user-select:none}.tabulator .tabulator-header{position:relative;box-sizing:border-box;width:100%;border-bottom:1px solid #999;background-color:#e6e6e6;color:#555;font-weight:700;white-space:nowrap;overflow:hidden;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none}.tabulator .tabulator-header.tabulator-header-hidden{display:none}.tabulator .tabulator-header .tabulator-col{display:inline-block;position:relative;box-sizing:border-box;border-right:1px solid #aaa;background:#e6e6e6;text-align:left;vertical-align:bottom;overflow:hidden}.tabulator .tabulator-header .tabulator-col.tabulator-moving{position:absolute;border:1px solid #999;background:#cdcdcd;pointer-events:none}.tabulator .tabulator-header .tabulator-col .tabulator-col-content{box-sizing:border-box;position:relative;padding:4px}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-header-menu-button{padding:0 8px}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-header-menu-button:hover{cursor:pointer;opacity:.6}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title-holder{position:relative}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title{box-sizing:border-box;width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;vertical-align:bottom}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title .tabulator-title-editor{box-sizing:border-box;width:100%;border:1px solid #999;padding:1px;background:#fff}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title .tabulator-header-menu-button+.tabulator-title-editor{width:calc(100% - 22px)}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-sorter{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;position:absolute;top:0;bottom:0;right:4px}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-sorter .tabulator-arrow{width:0;height:0;border-left:6px solid transparent;border-right:6px solid transparent;border-bottom:6px solid #bbb}.tabulator .tabulator-header .tabulator-col.tabulator-col-group .tabulator-col-group-cols{position:relative;display:-ms-flexbox;display:flex;border-top:1px solid #aaa;overflow:hidden;margin-right:-1px}.tabulator .tabulator-header .tabulator-col:first-child .tabulator-col-resize-handle.prev{display:none}.tabulator .tabulator-header .tabulator-col .tabulator-header-filter{position:relative;box-sizing:border-box;margin-top:2px;width:100%;text-align:center}.tabulator .tabulator-header .tabulator-col .tabulator-header-filter textarea{height:auto!important}.tabulator .tabulator-header .tabulator-col .tabulator-header-filter svg{margin-top:3px}.tabulator .tabulator-header .tabulator-col .tabulator-header-filter input::-ms-clear{width:0;height:0}.tabulator .tabulator-header .tabulator-col.tabulator-sortable .tabulator-col-title{padding-right:25px}.tabulator .tabulator-header .tabulator-col.tabulator-sortable:hover{cursor:pointer;background-color:#cdcdcd}.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort=none] .tabulator-col-content .tabulator-col-sorter{color:#bbb}.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort=none] .tabulator-col-content .tabulator-col-sorter .tabulator-arrow{border-top:none;border-bottom:6px solid #bbb}.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort=asc] .tabulator-col-content .tabulator-col-sorter{color:#666}.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort=asc] .tabulator-col-content .tabulator-col-sorter .tabulator-arrow{border-top:none;border-bottom:6px solid #666}.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort=desc] .tabulator-col-content .tabulator-col-sorter{color:#666}.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort=desc] .tabulator-col-content .tabulator-col-sorter .tabulator-arrow{border-bottom:none;border-top:6px solid #666;color:#666}.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical .tabulator-col-content .tabulator-col-title{-ms-writing-mode:tb-rl;writing-mode:vertical-rl;text-orientation:mixed;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical.tabulator-col-vertical-flip .tabulator-col-title{transform:rotate(180deg)}.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical.tabulator-sortable .tabulator-col-title{padding-right:0;padding-top:20px}.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical.tabulator-sortable.tabulator-col-vertical-flip .tabulator-col-title{padding-right:0;padding-bottom:20px}.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical.tabulator-sortable .tabulator-col-sorter{-ms-flex-pack:center;justify-content:center;left:0;right:0;top:4px;bottom:auto}.tabulator .tabulator-header .tabulator-frozen{display:inline-block;position:absolute;z-index:10}.tabulator .tabulator-header .tabulator-frozen.tabulator-frozen-left{border-right:2px solid #aaa}.tabulator .tabulator-header .tabulator-frozen.tabulator-frozen-right{border-left:2px solid #aaa}.tabulator .tabulator-header .tabulator-calcs-holder{box-sizing:border-box;min-width:600%;background:#f3f3f3!important;border-top:1px solid #aaa;border-bottom:1px solid #aaa;overflow:hidden}.tabulator .tabulator-header .tabulator-calcs-holder .tabulator-row{background:#f3f3f3!important}.tabulator .tabulator-header .tabulator-calcs-holder .tabulator-row .tabulator-col-resize-handle{display:none}.tabulator .tabulator-header .tabulator-frozen-rows-holder{min-width:600%}.tabulator .tabulator-header .tabulator-frozen-rows-holder:empty{display:none}.tabulator .tabulator-tableHolder{position:relative;width:100%;white-space:nowrap;overflow:auto;-webkit-overflow-scrolling:touch}.tabulator .tabulator-tableHolder:focus{outline:none}.tabulator .tabulator-tableHolder .tabulator-placeholder{box-sizing:border-box;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;width:100%}.tabulator .tabulator-tableHolder .tabulator-placeholder[tabulator-render-mode=virtual]{min-height:100%;min-width:100%}.tabulator .tabulator-tableHolder .tabulator-placeholder span{display:inline-block;margin:0 auto;padding:10px;color:#ccc;font-weight:700;font-size:20px}.tabulator .tabulator-tableHolder .tabulator-table{position:relative;display:inline-block;background-color:#fff;white-space:nowrap;overflow:visible;color:#333}.tabulator .tabulator-tableHolder .tabulator-table .tabulator-row.tabulator-calcs{font-weight:700;background:#e2e2e2!important}.tabulator .tabulator-tableHolder .tabulator-table .tabulator-row.tabulator-calcs.tabulator-calcs-top{border-bottom:2px solid #aaa}.tabulator .tabulator-tableHolder .tabulator-table .tabulator-row.tabulator-calcs.tabulator-calcs-bottom{border-top:2px solid #aaa}.tabulator .tabulator-footer{padding:5px 10px;border-top:1px solid #999;background-color:#e6e6e6;text-align:right;color:#555;font-weight:700;white-space:nowrap;-ms-user-select:none;user-select:none;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none}.tabulator .tabulator-footer .tabulator-calcs-holder{box-sizing:border-box;width:calc(100% + 20px);margin:-5px -10px 5px;text-align:left;background:#f3f3f3!important;border-bottom:1px solid #aaa;border-top:1px solid #aaa;overflow:hidden}.tabulator .tabulator-footer .tabulator-calcs-holder .tabulator-row{background:#f3f3f3!important}.tabulator .tabulator-footer .tabulator-calcs-holder .tabulator-row .tabulator-col-resize-handle{display:none}.tabulator .tabulator-footer .tabulator-calcs-holder:only-child{margin-bottom:-5px;border-bottom:none}.tabulator .tabulator-footer .tabulator-paginator{color:#555;font-family:inherit;font-weight:inherit;font-size:inherit}.tabulator .tabulator-footer .tabulator-page-size{display:inline-block;margin:0 5px;padding:2px 5px;border:1px solid #aaa;border-radius:3px}.tabulator .tabulator-footer .tabulator-pages{margin:0 7px}.tabulator .tabulator-footer .tabulator-page{display:inline-block;margin:0 2px;padding:2px 5px;border:1px solid #aaa;border-radius:3px;background:hsla(0,0%,100%,.2)}.tabulator .tabulator-footer .tabulator-page.active{color:#d00}.tabulator .tabulator-footer .tabulator-page:disabled{opacity:.5}.tabulator .tabulator-footer .tabulator-page:not(.disabled):hover{cursor:pointer;background:rgba(0,0,0,.2);color:#fff}.tabulator .tabulator-col-resize-handle{position:absolute;right:0;top:0;bottom:0;width:5px}.tabulator .tabulator-col-resize-handle.prev{left:0;right:auto}.tabulator .tabulator-col-resize-handle:hover{cursor:ew-resize}.tabulator .tabulator-loader{position:absolute;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;top:0;left:0;z-index:100;height:100%;width:100%;background:rgba(0,0,0,.4);text-align:center}.tabulator .tabulator-loader .tabulator-loader-msg{display:inline-block;margin:0 auto;padding:10px 20px;border-radius:10px;background:#fff;font-weight:700;font-size:16px}.tabulator .tabulator-loader .tabulator-loader-msg.tabulator-loading{border:4px solid #333;color:#000}.tabulator .tabulator-loader .tabulator-loader-msg.tabulator-error{border:4px solid #d00;color:#590000}.tabulator-row{position:relative;box-sizing:border-box;min-height:22px;background-color:#fff}.tabulator-row.tabulator-row-even{background-color:#efefef}.tabulator-row.tabulator-selectable:hover{background-color:#bbb;cursor:pointer}.tabulator-row.tabulator-selected{background-color:#9abcea}.tabulator-row.tabulator-selected:hover{background-color:#769bcc;cursor:pointer}.tabulator-row.tabulator-row-moving{border:1px solid #000;background:#fff}.tabulator-row.tabulator-moving{position:absolute;border-top:1px solid #aaa;border-bottom:1px solid #aaa;pointer-events:none;z-index:15}.tabulator-row .tabulator-row-resize-handle{position:absolute;right:0;bottom:0;left:0;height:5px}.tabulator-row .tabulator-row-resize-handle.prev{top:0;bottom:auto}.tabulator-row .tabulator-row-resize-handle:hover{cursor:ns-resize}.tabulator-row .tabulator-frozen{display:inline-block;position:absolute;background-color:inherit;z-index:10}.tabulator-row .tabulator-frozen.tabulator-frozen-left{border-right:2px solid #aaa}.tabulator-row .tabulator-frozen.tabulator-frozen-right{border-left:2px solid #aaa}.tabulator-row .tabulator-responsive-collapse{box-sizing:border-box;padding:5px;border-top:1px solid #aaa;border-bottom:1px solid #aaa}.tabulator-row .tabulator-responsive-collapse:empty{display:none}.tabulator-row .tabulator-responsive-collapse table{font-size:14px}.tabulator-row .tabulator-responsive-collapse table tr td{position:relative}.tabulator-row .tabulator-responsive-collapse table tr td:first-of-type{padding-right:10px}.tabulator-row .tabulator-cell{display:inline-block;position:relative;box-sizing:border-box;padding:4px;border-right:1px solid #aaa;vertical-align:middle;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tabulator-row .tabulator-cell.tabulator-editing{border:1px solid #1d68cd;outline:none;padding:0}.tabulator-row .tabulator-cell.tabulator-editing input,.tabulator-row .tabulator-cell.tabulator-editing select{border:1px;background:transparent}.tabulator-row .tabulator-cell.tabulator-validation-fail{border:1px solid #d00}.tabulator-row .tabulator-cell.tabulator-validation-fail input,.tabulator-row .tabulator-cell.tabulator-validation-fail select{border:1px;background:transparent;color:#d00}.tabulator-row .tabulator-cell:first-child .tabulator-col-resize-handle.prev{display:none}.tabulator-row .tabulator-cell.tabulator-row-handle{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none}.tabulator-row .tabulator-cell.tabulator-row-handle .tabulator-row-handle-box{width:80%}.tabulator-row .tabulator-cell.tabulator-row-handle .tabulator-row-handle-box .tabulator-row-handle-bar{width:100%;height:3px;margin-top:2px;background:#666}.tabulator-row .tabulator-cell .tabulator-data-tree-branch{display:inline-block;vertical-align:middle;height:9px;width:7px;margin-top:-9px;margin-right:5px;border-bottom-left-radius:1px;border-left:2px solid #aaa;border-bottom:2px solid #aaa}.tabulator-row .tabulator-cell .tabulator-data-tree-control{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;vertical-align:middle;height:11px;width:11px;margin-right:5px;border:1px solid #333;border-radius:2px;background:rgba(0,0,0,.1);overflow:hidden}.tabulator-row .tabulator-cell .tabulator-data-tree-control:hover{cursor:pointer;background:rgba(0,0,0,.2)}.tabulator-row .tabulator-cell .tabulator-data-tree-control .tabulator-data-tree-control-collapse{display:inline-block;position:relative;height:7px;width:1px;background:transparent}.tabulator-row .tabulator-cell .tabulator-data-tree-control .tabulator-data-tree-control-collapse:after{position:absolute;content:"";left:-3px;top:3px;height:1px;width:7px;background:#333}.tabulator-row .tabulator-cell .tabulator-data-tree-control .tabulator-data-tree-control-expand{display:inline-block;position:relative;height:7px;width:1px;background:#333}.tabulator-row .tabulator-cell .tabulator-data-tree-control .tabulator-data-tree-control-expand:after{position:absolute;content:"";left:-3px;top:3px;height:1px;width:7px;background:#333}.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none;height:15px;width:15px;border-radius:20px;background:#666;color:#fff;font-weight:700;font-size:1.1em}.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle:hover{opacity:.7}.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle.open .tabulator-responsive-collapse-toggle-close{display:initial}.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle.open .tabulator-responsive-collapse-toggle-open,.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle .tabulator-responsive-collapse-toggle-close{display:none}.tabulator-row .tabulator-cell .tabulator-traffic-light{display:inline-block;height:14px;width:14px;border-radius:14px}.tabulator-row.tabulator-group{box-sizing:border-box;border-bottom:1px solid #999;border-right:1px solid #aaa;border-top:1px solid #999;padding:5px;padding-left:10px;background:#ccc;font-weight:700;min-width:100%}.tabulator-row.tabulator-group:hover{cursor:pointer;background-color:rgba(0,0,0,.1)}.tabulator-row.tabulator-group.tabulator-group-visible .tabulator-arrow{margin-right:10px;border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid #666;border-bottom:0}.tabulator-row.tabulator-group.tabulator-group-level-1{padding-left:30px}.tabulator-row.tabulator-group.tabulator-group-level-2{padding-left:50px}.tabulator-row.tabulator-group.tabulator-group-level-3{padding-left:70px}.tabulator-row.tabulator-group.tabulator-group-level-4{padding-left:90px}.tabulator-row.tabulator-group.tabulator-group-level-5{padding-left:110px}.tabulator-row.tabulator-group .tabulator-group-toggle{display:inline-block}.tabulator-row.tabulator-group .tabulator-arrow{display:inline-block;width:0;height:0;margin-right:16px;border-top:6px solid transparent;border-bottom:6px solid transparent;border-right:0;border-left:6px solid #666;vertical-align:middle}.tabulator-row.tabulator-group span{margin-left:10px;color:#d00}.tabulator-menu{position:absolute;display:inline-block;box-sizing:border-box;background:#fff;border:1px solid #aaa;box-shadow:0 0 5px 0 rgba(0,0,0,.2);font-size:14px;overflow-y:auto;-webkit-overflow-scrolling:touch;z-index:10000}.tabulator-menu .tabulator-menu-item{position:relative;box-sizing:border-box;padding:5px 10px;-webkit-user-select:none;-ms-user-select:none;user-select:none}.tabulator-menu .tabulator-menu-item.tabulator-menu-item-disabled{opacity:.5}.tabulator-menu .tabulator-menu-item:not(.tabulator-menu-item-disabled):hover{cursor:pointer;background:#efefef}.tabulator-menu .tabulator-menu-item.tabulator-menu-item-submenu{padding-right:25px}.tabulator-menu .tabulator-menu-item.tabulator-menu-item-submenu:after{display:inline-block;position:absolute;top:calc(5px + .4em);right:10px;height:7px;width:7px;content:"";border-width:1px 1px 0 0;border-style:solid;border-color:#aaa;vertical-align:top;transform:rotate(45deg)}.tabulator-menu .tabulator-menu-separator{border-top:1px solid #aaa}.tabulator-edit-select-list{position:absolute;display:inline-block;box-sizing:border-box;max-height:200px;background:#fff;border:1px solid #aaa;font-size:14px;overflow-y:auto;-webkit-overflow-scrolling:touch;z-index:10000}.tabulator-edit-select-list .tabulator-edit-select-list-item{padding:4px;color:#333}.tabulator-edit-select-list .tabulator-edit-select-list-item.active{color:#fff;background:#1d68cd}.tabulator-edit-select-list .tabulator-edit-select-list-item.active.focused{outline:1px solid hsla(0,0%,100%,.5)}.tabulator-edit-select-list .tabulator-edit-select-list-item.focused{outline:1px solid #1d68cd}.tabulator-edit-select-list .tabulator-edit-select-list-item:hover{cursor:pointer;color:#fff;background:#1d68cd}.tabulator-edit-select-list .tabulator-edit-select-list-notice{padding:4px;color:#333;text-align:center}.tabulator-edit-select-list .tabulator-edit-select-list-group{border-bottom:1px solid #aaa;padding:4px;padding-top:6px;color:#333;font-weight:700}.tabulator.tabulator-ltr{direction:ltr}.tabulator.tabulator-rtl{text-align:initial;direction:rtl}.tabulator.tabulator-rtl .tabulator-header .tabulator-col{text-align:initial;border-left:1px solid #aaa;border-right:initial}.tabulator.tabulator-rtl .tabulator-header .tabulator-col.tabulator-col-group .tabulator-col-group-cols{margin-right:0;margin-left:-1px}.tabulator.tabulator-rtl .tabulator-header .tabulator-col.tabulator-sortable .tabulator-col-title{padding-right:0;padding-left:25px}.tabulator.tabulator-rtl .tabulator-header .tabulator-col .tabulator-col-content .tabulator-arrow{left:8px;right:auto}.tabulator.tabulator-rtl .tabulator-row .tabulator-cell{border-right:initial;border-left:1px solid #aaa}.tabulator.tabulator-rtl .tabulator-row .tabulator-cell .tabulator-data-tree-branch{margin-right:0;margin-left:5px;border-bottom-left-radius:0;border-bottom-right-radius:1px;border-left:initial;border-right:2px solid #aaa}.tabulator.tabulator-rtl .tabulator-row .tabulator-cell .tabulator-data-tree-control{margin-right:0;margin-left:5px}.tabulator.tabulator-rtl .tabulator-col-resize-handle{position:absolute;left:0;right:auto}.tabulator.tabulator-rtl .tabulator-col-resize-handle.prev{right:0;left:auto}.tabulator-print-fullscreen{position:absolute;top:0;bottom:0;left:0;right:0;z-index:10000}body.tabulator-print-fullscreen-hide>:not(.tabulator-print-fullscreen){display:none!important}.tabulator-print-table{border-collapse:collapse}.tabulator-print-table .tabulator-data-tree-branch{display:inline-block;vertical-align:middle;height:9px;width:7px;margin-top:-9px;margin-right:5px;border-bottom-left-radius:1px;border-left:2px solid #aaa;border-bottom:2px solid #aaa}.tabulator-print-table .tabulator-print-table-group{box-sizing:border-box;border-bottom:1px solid #999;border-right:1px solid #aaa;border-top:1px solid #999;padding:5px;padding-left:10px;background:#ccc;font-weight:700;min-width:100%}.tabulator-print-table .tabulator-print-table-group:hover{cursor:pointer;background-color:rgba(0,0,0,.1)}.tabulator-print-table .tabulator-print-table-group.tabulator-group-visible .tabulator-arrow{margin-right:10px;border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid #666;border-bottom:0}.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-1 td{padding-left:30px!important}.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-2 td{padding-left:50px!important}.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-3 td{padding-left:70px!important}.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-4 td{padding-left:90px!important}.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-5 td{padding-left:110px!important}.tabulator-print-table .tabulator-print-table-group .tabulator-group-toggle{display:inline-block}.tabulator-print-table .tabulator-print-table-group .tabulator-arrow{display:inline-block;width:0;height:0;margin-right:16px;border-top:6px solid transparent;border-bottom:6px solid transparent;border-right:0;border-left:6px solid #666;vertical-align:middle}.tabulator-print-table .tabulator-print-table-group span{margin-left:10px;color:#d00}.tabulator-print-table .tabulator-data-tree-control{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;vertical-align:middle;height:11px;width:11px;margin-right:5px;border:1px solid #333;border-radius:2px;background:rgba(0,0,0,.1);overflow:hidden}.tabulator-print-table .tabulator-data-tree-control:hover{cursor:pointer;background:rgba(0,0,0,.2)}.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-collapse{display:inline-block;position:relative;height:7px;width:1px;background:transparent}.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-collapse:after{position:absolute;content:"";left:-3px;top:3px;height:1px;width:7px;background:#333}.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-expand{display:inline-block;position:relative;height:7px;width:1px;background:#333}.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-expand:after{position:absolute;content:"";left:-3px;top:3px;height:1px;width:7px;background:#333}
	/*# sourceMappingURL=tabulator.min.css.map */
	`,
	"js/tabulator.min.js": `/* Tabulator v4.9.3 (c) Oliver Folkerd */
	var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(e,t){"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Tabulator=t()}(this,function(){"use strict";Array.prototype.findIndex||Object.defineProperty(Array.prototype,"findIndex",{value:function(e){if(null==this)throw new TypeError('"this" is null or not defined');var t=Object(this),o=t.length>>>0;if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var i=arguments[1],n=0;n<o;){var s=t[n];if(e.call(i,s,n,t))return n;n++}return-1}}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(e){if(null==this)throw new TypeError('"this" is null or not defined');var t=Object(this),o=t.length>>>0;if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var i=arguments[1],n=0;n<o;){var s=t[n];if(e.call(i,s,n,t))return s;n++}}}),String.prototype.includes||(String.prototype.includes=function(e,t){if(e instanceof RegExp)throw TypeError("first argument must not be a RegExp");return void 0===t&&(t=0),-1!==this.indexOf(e,t)}),Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{value:function(e,t){if(null==this)throw new TypeError('"this" is null or not defined');var o=Object(this),i=o.length>>>0;if(0===i)return!1;for(var n=0|t,s=Math.max(n>=0?n:i-Math.abs(n),0);s<i;){if(function(e,t){return e===t||"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t)}(o[s],e))return!0;s++}return!1}}),"function"!=typeof Object.assign&&Object.defineProperty(Object,"assign",{value:function(e,t){if(null===e||void 0===e)throw new TypeError("Cannot convert undefined or null to object");for(var o=Object(e),i=1;i<arguments.length;i++){var n=arguments[i];if(null!==n&&void 0!==n)for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(o[s]=n[s])}return o},writable:!0,configurable:!0});var t=function(e){this.table=e,this.blockHozScrollEvent=!1,this.headersElement=this.createHeadersElement(),this.element=this.createHeaderElement(),this.rowManager=null,this.columns=[],this.columnsByIndex=[],this.columnsByField={},this.scrollLeft=0,this.element.insertBefore(this.headersElement,this.element.firstChild)};t.prototype.createHeadersElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-headers"),e},t.prototype.createHeaderElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-header"),this.table.options.headerVisible||e.classList.add("tabulator-header-hidden"),e},t.prototype.initialize=function(){},t.prototype.setRowManager=function(e){this.rowManager=e},t.prototype.getElement=function(){return this.element},t.prototype.getHeadersElement=function(){return this.headersElement},t.prototype.scrollHorizontal=function(e){var t=0,o=this.element.scrollWidth-this.table.element.clientWidth;this.element.scrollLeft=e,e>o?(t=e-o,this.element.style.marginLeft=-t+"px"):this.element.style.marginLeft=0,this.scrollLeft=e,this.table.modExists("frozenColumns")&&this.table.modules.frozenColumns.scrollHorizontal()},t.prototype.generateColumnsFromRowData=function(e){var t,o,i=[],n=this.table.options.autoColumnsDefinitions;if(e&&e.length){t=e[0];for(var s in t){var a={field:s,title:s},r=t[s];switch(void 0===r?"undefined":_typeof(r)){case"undefined":o="string";break;case"boolean":o="boolean";break;case"object":o=Array.isArray(r)?"array":"string";break;default:o=isNaN(r)||""===r?r.match(/((^[0-9]+[a-z]+)|(^[a-z]+[0-9]+))+$/i)?"alphanum":"string":"number"}a.sorter=o,i.push(a)}if(n)switch(void 0===n?"undefined":_typeof(n)){case"function":this.table.options.columns=n.call(this.table,i);break;case"object":Array.isArray(n)?i.forEach(function(e){var t=n.find(function(t){return t.field===e.field});t&&Object.assign(e,t)}):i.forEach(function(e){n[e.field]&&Object.assign(e,n[e.field])}),this.table.options.columns=i}else this.table.options.columns=i;this.setColumns(this.table.options.columns)}},t.prototype.setColumns=function(e,t){for(var o=this;o.headersElement.firstChild;)o.headersElement.removeChild(o.headersElement.firstChild);o.columns=[],o.columnsByIndex=[],o.columnsByField={},o.table.modExists("frozenColumns")&&o.table.modules.frozenColumns.reset(),e.forEach(function(e,t){o._addColumn(e)}),o._reIndexColumns(),o.table.options.responsiveLayout&&o.table.modExists("responsiveLayout",!0)&&o.table.modules.responsiveLayout.initialize(),this.table.options.virtualDomHoz&&this.table.vdomHoz.reinitialize(!1,!0),o.redraw(!0)},t.prototype._addColumn=function(e,t,o){var i=new n(e,this),s=i.getElement(),a=o?this.findColumnIndex(o):o;if(o&&a>-1){var r=this.columns.indexOf(o.getTopColumn()),l=o.getElement();t?(this.columns.splice(r,0,i),l.parentNode.insertBefore(s,l)):(this.columns.splice(r+1,0,i),l.parentNode.insertBefore(s,l.nextSibling))}else t?(this.columns.unshift(i),this.headersElement.insertBefore(i.getElement(),this.headersElement.firstChild)):(this.columns.push(i),this.headersElement.appendChild(i.getElement())),i.columnRendered();return i},t.prototype.registerColumnField=function(e){e.definition.field&&(this.columnsByField[e.definition.field]=e)},t.prototype.registerColumnPosition=function(e){this.columnsByIndex.push(e)},t.prototype._reIndexColumns=function(){this.columnsByIndex=[],this.columns.forEach(function(e){e.reRegisterPosition()})},t.prototype._verticalAlignHeaders=function(){var e=this,t=0;e.columns.forEach(function(e){var o;e.clearVerticalAlign(),(o=e.getHeight())>t&&(t=o)}),e.columns.forEach(function(o){o.verticalAlign(e.table.options.columnHeaderVertAlign,t)}),e.rowManager.adjustTableSize()},t.prototype.findColumn=function(e){var t=this;if("object"!=(void 0===e?"undefined":_typeof(e)))return this.columnsByField[e]||!1;if(e instanceof n)return e;if(e instanceof o)return e._getSelf()||!1;if("undefined"!=typeof HTMLElement&&e instanceof HTMLElement){return t.columns.find(function(t){return t.element===e})||!1}return!1},t.prototype.getColumnByField=function(e){return this.columnsByField[e]},t.prototype.getColumnsByFieldRoot=function(e){var t=this,o=[];return Object.keys(this.columnsByField).forEach(function(i){i.split(".")[0]===e&&o.push(t.columnsByField[i])}),o},t.prototype.getColumnByIndex=function(e){return this.columnsByIndex[e]},t.prototype.getFirstVisibileColumn=function(e){var e=this.columnsByIndex.findIndex(function(e){return e.visible});return e>-1&&this.columnsByIndex[e]},t.prototype.getColumns=function(){return this.columns},t.prototype.findColumnIndex=function(e){return this.columnsByIndex.findIndex(function(t){return e===t})},t.prototype.getRealColumns=function(){return this.columnsByIndex},t.prototype.traverse=function(e){this.columnsByIndex.forEach(function(t,o){e(t,o)})},t.prototype.getDefinitions=function(e){var t=this,o=[];return t.columnsByIndex.forEach(function(t){(!e||e&&t.visible)&&o.push(t.getDefinition())}),o},t.prototype.getDefinitionTree=function(){var e=this,t=[];return e.columns.forEach(function(e){t.push(e.getDefinition(!0))}),t},t.prototype.getComponents=function(e){var t=this,o=[];return(e?t.columns:t.columnsByIndex).forEach(function(e){o.push(e.getComponent())}),o},t.prototype.getWidth=function(){var e=0;return this.columnsByIndex.forEach(function(t){t.visible&&(e+=t.getWidth())}),e},t.prototype.moveColumn=function(e,t,o){this.moveColumnActual(e,t,o),this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.initialize(),this.table.modExists("columnCalcs")&&this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows),t.element.parentNode.insertBefore(e.element,t.element),o&&t.element.parentNode.insertBefore(t.element,e.element),this._verticalAlignHeaders(),this.table.rowManager.reinitialize()},t.prototype.moveColumnActual=function(e,t,o){e.parent.isGroup?this._moveColumnInArray(e.parent.columns,e,t,o):this._moveColumnInArray(this.columns,e,t,o),this._moveColumnInArray(this.columnsByIndex,e,t,o,!0),this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.initialize(),this.table.options.virtualDomHoz&&this.table.vdomHoz.reinitialize(!0),this.table.options.columnMoved&&this.table.options.columnMoved.call(this.table,e.getComponent(),this.table.columnManager.getComponents()),this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.columns&&this.table.modules.persistence.save("columns")},t.prototype._moveColumnInArray=function(e,t,o,i,n){var s,a=this,r=e.indexOf(t),l=[];r>-1&&(e.splice(r,1),s=e.indexOf(o),s>-1?i&&(s+=1):s=r,e.splice(s,0,t),n&&(this.table.options.dataTree&&this.table.modExists("dataTree",!0)&&this.table.rowManager.rows.forEach(function(e){l=l.concat(a.table.modules.dataTree.getTreeChildren(e,!1,!0))}),l=l.concat(this.table.rowManager.rows),l.forEach(function(e){if(e.cells.length){var t=e.cells.splice(r,1)[0];e.cells.splice(s,0,t)}})))},t.prototype.scrollToColumn=function(e,t,o){var i=this,n=0,s=0,a=0,r=e.getElement();return new Promise(function(l,c){if(void 0===t&&(t=i.table.options.scrollToColumnPosition),void 0===o&&(o=i.table.options.scrollToColumnIfVisible),e.visible){switch(t){case"middle":case"center":a=-i.element.clientWidth/2;break;case"right":a=r.clientWidth-i.headersElement.clientWidth}if(!o&&(s=r.offsetLeft)>0&&s+r.offsetWidth<i.element.clientWidth)return!1;n=r.offsetLeft+a,n=Math.max(Math.min(n,i.table.rowManager.element.scrollWidth-i.table.rowManager.element.clientWidth),0),i.table.rowManager.scrollHorizontal(n),i.scrollHorizontal(n),l()}else console.warn("Scroll Error - Column not visible"),c("Scroll Error - Column not visible")})},t.prototype.generateCells=function(e){var t=this,o=[];return t.columnsByIndex.forEach(function(t){o.push(t.generateCell(e))}),o},t.prototype.getFlexBaseWidth=function(){var e=this,t=e.table.element.clientWidth,o=0;return e.rowManager.element.scrollHeight>e.rowManager.element.clientHeight&&(t-=e.rowManager.element.offsetWidth-e.rowManager.element.clientWidth),this.columnsByIndex.forEach(function(i){var n,s,a;i.visible&&(n=i.definition.width||0,s=void 0===i.minWidth?e.table.options.columnMinWidth:parseInt(i.minWidth),a="string"==typeof n?n.indexOf("%")>-1?t/100*parseInt(n):parseInt(n):n,o+=a>s?a:s)}),o},t.prototype.addColumn=function(e,t,o){var i=this;return new Promise(function(n,s){var a=i._addColumn(e,t,o);i._reIndexColumns(),i.table.options.responsiveLayout&&i.table.modExists("responsiveLayout",!0)&&i.table.modules.responsiveLayout.initialize(),i.table.modExists("columnCalcs")&&i.table.modules.columnCalcs.recalc(i.table.rowManager.activeRows),i.redraw(!0),"fitColumns"!=i.table.modules.layout.getMode()&&a.reinitializeWidth(),i._verticalAlignHeaders(),i.table.rowManager.reinitialize(),i.table.options.virtualDomHoz&&i.table.vdomHoz.reinitialize(),n(a)})},t.prototype.deregisterColumn=function(e){var t,o=e.getField();o&&delete this.columnsByField[o],t=this.columnsByIndex.indexOf(e),t>-1&&this.columnsByIndex.splice(t,1),t=this.columns.indexOf(e),t>-1&&this.columns.splice(t,1),this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.initialize(),this._verticalAlignHeaders(),this.redraw()},t.prototype.redraw=function(e){e&&(h.prototype.helpers.elVisible(this.element)&&this._verticalAlignHeaders(),this.table.rowManager.resetScroll(),this.table.rowManager.reinitialize()),["fitColumns","fitDataStretch"].indexOf(this.table.modules.layout.getMode())>-1?this.table.modules.layout.layout():e?this.table.modules.layout.layout():this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.update(),this.table.modExists("frozenColumns")&&this.table.modules.frozenColumns.layout(),this.table.modExists("columnCalcs")&&this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows),e&&(this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.columns&&this.table.modules.persistence.save("columns"),this.table.modExists("columnCalcs")&&this.table.modules.columnCalcs.redraw()),this.table.footerManager.redraw()};var o=function(e){this._column=e,this.type="ColumnComponent"};o.prototype.getElement=function(){return this._column.getElement()},o.prototype.getDefinition=function(){return this._column.getDefinition()},o.prototype.getField=function(){return this._column.getField()},o.prototype.getCells=function(){var e=[];return this._column.cells.forEach(function(t){e.push(t.getComponent())}),e},o.prototype.getVisibility=function(){return console.warn("getVisibility function is deprecated, you should now use the isVisible function"),this._column.visible},o.prototype.isVisible=function(){return this._column.visible},o.prototype.show=function(){this._column.isGroup?this._column.columns.forEach(function(e){e.show()}):this._column.show()},o.prototype.hide=function(){this._column.isGroup?this._column.columns.forEach(function(e){e.hide()}):this._column.hide()},o.prototype.toggle=function(){this._column.visible?this.hide():this.show()},o.prototype.delete=function(){return this._column.delete()},o.prototype.getSubColumns=function(){var e=[];return this._column.columns.length&&this._column.columns.forEach(function(t){e.push(t.getComponent())}),e},o.prototype.getParentColumn=function(){return this._column.parent instanceof n&&this._column.parent.getComponent()},o.prototype._getSelf=function(){return this._column},o.prototype.scrollTo=function(){return this._column.table.columnManager.scrollToColumn(this._column)},o.prototype.getTable=function(){return this._column.table},o.prototype.headerFilterFocus=function(){this._column.table.modExists("filter",!0)&&this._column.table.modules.filter.setHeaderFilterFocus(this._column)},o.prototype.reloadHeaderFilter=function(){this._column.table.modExists("filter",!0)&&this._column.table.modules.filter.reloadHeaderFilter(this._column)},o.prototype.getHeaderFilterValue=function(){if(this._column.table.modExists("filter",!0))return this._column.table.modules.filter.getHeaderFilterValue(this._column)},o.prototype.setHeaderFilterValue=function(e){this._column.table.modExists("filter",!0)&&this._column.table.modules.filter.setHeaderFilterValue(this._column,e)},o.prototype.move=function(e,t){var o=this._column.table.columnManager.findColumn(e);o?this._column.table.columnManager.moveColumn(this._column,o,t):console.warn("Move Error - No matching column found:",o)},o.prototype.getNextColumn=function(){var e=this._column.nextColumn();return!!e&&e.getComponent()},o.prototype.getPrevColumn=function(){var e=this._column.prevColumn();return!!e&&e.getComponent()},o.prototype.updateDefinition=function(e){return this._column.updateDefinition(e)},o.prototype.getWidth=function(){return this._column.getWidth()},o.prototype.setWidth=function(e){var t;return t=!0===e?this._column.reinitializeWidth(!0):this._column.setWidth(e),this._column.table.options.virtualDomHoz&&this._column.table.vdomHoz.reinitialize(!0),t},o.prototype.validate=function(){return this._column.validate()};var n=function e(t,o){var i=this;this.table=o.table,this.definition=t,this.parent=o,this.type="column",this.columns=[],this.cells=[],this.element=this.createElement(),this.contentElement=!1,this.titleHolderElement=!1,this.titleElement=!1,this.groupElement=this.createGroupElement(),this.isGroup=!1,this.tooltip=!1,this.hozAlign="",this.vertAlign="",this.field="",this.fieldStructure="",this.getFieldValue="",this.setFieldValue="",this.titleFormatterRendered=!1,this.setField(this.definition.field),this.table.options.invalidOptionWarnings&&this.checkDefinition(),this.modules={},this.cellEvents={cellClick:!1,cellDblClick:!1,cellContext:!1,cellTap:!1,cellDblTap:!1,cellTapHold:!1,cellMouseEnter:!1,cellMouseLeave:!1,cellMouseOver:!1,cellMouseOut:!1,cellMouseMove:!1},this.width=null,this.widthStyled="",this.maxWidth=null,this.maxWidthStyled="",this.minWidth=null,this.minWidthStyled="",this.widthFixed=!1,this.visible=!0,this.component=null,this._mapDepricatedFunctionality(),t.columns?(this.isGroup=!0,t.columns.forEach(function(t,o){var n=new e(t,i);i.attachColumn(n)}),i.checkColumnVisibility()):o.registerColumnField(this),t.rowHandle&&!1!==this.table.options.movableRows&&this.table.modExists("moveRow")&&this.table.modules.moveRow.setHandle(!0),this._buildHeader(),this.bindModuleColumns()};n.prototype.createElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-col"),e.setAttribute("role","columnheader"),e.setAttribute("aria-sort","none"),e},n.prototype.createGroupElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-col-group-cols"),e},n.prototype.checkDefinition=function(){var e=this;Object.keys(this.definition).forEach(function(t){-1===e.defaultOptionList.indexOf(t)&&console.warn("Invalid column definition option in '"+(e.field||e.definition.title)+"' column:",t)})},n.prototype.setField=function(e){this.field=e,this.fieldStructure=e?this.table.options.nestedFieldSeparator?e.split(this.table.options.nestedFieldSeparator):[e]:[],this.getFieldValue=this.fieldStructure.length>1?this._getNestedData:this._getFlatData,this.setFieldValue=this.fieldStructure.length>1?this._setNestedData:this._setFlatData},n.prototype.registerColumnPosition=function(e){this.parent.registerColumnPosition(e)},n.prototype.registerColumnField=function(e){this.parent.registerColumnField(e)},n.prototype.reRegisterPosition=function(){this.isGroup?this.columns.forEach(function(e){e.reRegisterPosition()}):this.registerColumnPosition(this)},n.prototype._mapDepricatedFunctionality=function(){void 0!==this.definition.hideInHtml&&(this.definition.htmlOutput=!this.definition.hideInHtml,console.warn("hideInHtml column definition property is deprecated, you should now use htmlOutput")),void 0!==this.definition.align&&(this.definition.hozAlign=this.definition.align,console.warn("align column definition property is deprecated, you should now use hozAlign")),void 0!==this.definition.downloadTitle&&(this.definition.titleDownload=this.definition.downloadTitle,console.warn("downloadTitle definition property is deprecated, you should now use titleDownload"))},n.prototype.setTooltip=function(){var e=this,t=e.definition,o=t.headerTooltip||!1===t.tooltip?t.headerTooltip:e.table.options.tooltipsHeader;o?!0===o?t.field?e.table.modules.localize.bind("columns|"+t.field,function(o){e.element.setAttribute("title",o||t.title)}):e.element.setAttribute("title",t.title):("function"==typeof o&&!1===(o=o(e.getComponent()))&&(o=""),e.element.setAttribute("title",o)):e.element.setAttribute("title","")},n.prototype._buildHeader=function(){for(var e=this,t=e.definition;e.element.firstChild;)e.element.removeChild(e.element.firstChild);t.headerVertical&&(e.element.classList.add("tabulator-col-vertical"),"flip"===t.headerVertical&&e.element.classList.add("tabulator-col-vertical-flip")),e.contentElement=e._bindEvents(),e.contentElement=e._buildColumnHeaderContent(),e.element.appendChild(e.contentElement),e.isGroup?e._buildGroupHeader():e._buildColumnHeader(),e.setTooltip(),e.table.options.resizableColumns&&e.table.modExists("resizeColumns")&&e.table.modules.resizeColumns.initializeColumn("header",e,e.element),t.headerFilter&&e.table.modExists("filter")&&e.table.modExists("edit")&&(void 0!==t.headerFilterPlaceholder&&t.field&&e.table.modules.localize.setHeaderFilterColumnPlaceholder(t.field,t.headerFilterPlaceholder),e.table.modules.filter.initializeColumn(e)),e.table.modExists("frozenColumns")&&e.table.modules.frozenColumns.initializeColumn(e),e.table.options.movableColumns&&!e.isGroup&&e.table.modExists("moveColumn")&&e.table.modules.moveColumn.initializeColumn(e),(t.topCalc||t.bottomCalc)&&e.table.modExists("columnCalcs")&&e.table.modules.columnCalcs.initializeColumn(e),e.table.modExists("persistence")&&e.table.modules.persistence.config.columns&&e.table.modules.persistence.initializeColumn(e),e.element.addEventListener("mouseenter",function(t){e.setTooltip()})},n.prototype._bindEvents=function(){var e,t,o,i=this,n=i.definition;"function"==typeof n.headerClick&&i.element.addEventListener("click",function(e){n.headerClick(e,i.getComponent())}),"function"==typeof n.headerDblClick&&i.element.addEventListener("dblclick",function(e){n.headerDblClick(e,i.getComponent())}),"function"==typeof n.headerContext&&i.element.addEventListener("contextmenu",function(e){n.headerContext(e,i.getComponent())}),"function"==typeof n.headerTap&&(o=!1,i.element.addEventListener("touchstart",function(e){o=!0},{passive:!0}),i.element.addEventListener("touchend",function(e){o&&n.headerTap(e,i.getComponent()),o=!1})),"function"==typeof n.headerDblTap&&(e=null,i.element.addEventListener("touchend",function(t){e?(clearTimeout(e),e=null,n.headerDblTap(t,i.getComponent())):e=setTimeout(function(){clearTimeout(e),e=null},300)})),"function"==typeof n.headerTapHold&&(t=null,i.element.addEventListener("touchstart",function(e){clearTimeout(t),t=setTimeout(function(){clearTimeout(t),t=null,o=!1,n.headerTapHold(e,i.getComponent())},1e3)},{passive:!0}),i.element.addEventListener("touchend",function(e){clearTimeout(t),t=null})),"function"==typeof n.cellClick&&(i.cellEvents.cellClick=n.cellClick),"function"==typeof n.cellDblClick&&(i.cellEvents.cellDblClick=n.cellDblClick),"function"==typeof n.cellContext&&(i.cellEvents.cellContext=n.cellContext),"function"==typeof n.cellMouseEnter&&(i.cellEvents.cellMouseEnter=n.cellMouseEnter),"function"==typeof n.cellMouseLeave&&(i.cellEvents.cellMouseLeave=n.cellMouseLeave),"function"==typeof n.cellMouseOver&&(i.cellEvents.cellMouseOver=n.cellMouseOver),"function"==typeof n.cellMouseOut&&(i.cellEvents.cellMouseOut=n.cellMouseOut),"function"==typeof n.cellMouseMove&&(i.cellEvents.cellMouseMove=n.cellMouseMove),"function"==typeof n.cellTap&&(i.cellEvents.cellTap=n.cellTap),"function"==typeof n.cellDblTap&&(i.cellEvents.cellDblTap=n.cellDblTap),"function"==typeof n.cellTapHold&&(i.cellEvents.cellTapHold=n.cellTapHold),"function"==typeof n.cellEdited&&(i.cellEvents.cellEdited=n.cellEdited),"function"==typeof n.cellEditing&&(i.cellEvents.cellEditing=n.cellEditing),"function"==typeof n.cellEditCancelled&&(i.cellEvents.cellEditCancelled=n.cellEditCancelled)},n.prototype._buildColumnHeader=function(){var e=this,t=this.definition,o=this.table;if(o.modExists("sort")&&o.modules.sort.initializeColumn(this,this.titleHolderElement),(t.headerContextMenu||t.headerClickMenu||t.headerMenu)&&o.modExists("menu")&&o.modules.menu.initializeColumnHeader(this),o.modExists("format")&&o.modules.format.initializeColumn(this),void 0!==t.editor&&o.modExists("edit")&&o.modules.edit.initializeColumn(this),void 0!==t.validator&&o.modExists("validate")&&o.modules.validate.initializeColumn(this),o.modExists("mutator")&&o.modules.mutator.initializeColumn(this),o.modExists("accessor")&&o.modules.accessor.initializeColumn(this),_typeof(o.options.responsiveLayout)&&o.modExists("responsiveLayout")&&o.modules.responsiveLayout.initializeColumn(this),void 0!==t.visible&&(t.visible?this.show(!0):this.hide(!0)),t.cssClass){t.cssClass.split(" ").forEach(function(t){e.element.classList.add(t)})}t.field&&this.element.setAttribute("tabulator-field",t.field),this.setMinWidth(void 0===t.minWidth?this.table.options.columnMinWidth:parseInt(t.minWidth)),(t.maxWidth||this.table.options.columnMaxWidth)&&!1!==t.maxWidth&&this.setMaxWidth(void 0===t.maxWidth?this.table.options.columnMaxWidth:parseInt(t.maxWidth)),this.reinitializeWidth(),this.tooltip=this.definition.tooltip||!1===this.definition.tooltip?this.definition.tooltip:this.table.options.tooltips,this.hozAlign=void 0===this.definition.hozAlign?this.table.options.cellHozAlign:this.definition.hozAlign,this.vertAlign=void 0===this.definition.vertAlign?this.table.options.cellVertAlign:this.definition.vertAlign,this.titleElement.style.textAlign=this.definition.headerHozAlign||this.table.options.headerHozAlign},n.prototype._buildColumnHeaderContent=function(){var e=(this.definition,this.table,document.createElement("div"));return e.classList.add("tabulator-col-content"),this.titleHolderElement=document.createElement("div"),this.titleHolderElement.classList.add("tabulator-col-title-holder"),e.appendChild(this.titleHolderElement),this.titleElement=this._buildColumnHeaderTitle(),this.titleHolderElement.appendChild(this.titleElement),e},n.prototype._buildColumnHeaderTitle=function(){var e=this,t=e.definition,o=e.table,i=document.createElement("div");if(i.classList.add("tabulator-col-title"),t.editableTitle){var n=document.createElement("input");n.classList.add("tabulator-title-editor"),n.addEventListener("click",function(e){e.stopPropagation(),n.focus()}),n.addEventListener("change",function(){t.title=n.value,o.options.columnTitleChanged.call(e.table,e.getComponent())}),i.appendChild(n),t.field?o.modules.localize.bind("columns|"+t.field,function(e){n.value=e||t.title||"&nbsp;"}):n.value=t.title||"&nbsp;"}else t.field?o.modules.localize.bind("columns|"+t.field,function(o){e._formatColumnHeaderTitle(i,o||t.title||"&nbsp;")}):e._formatColumnHeaderTitle(i,t.title||"&nbsp;");return i},n.prototype._formatColumnHeaderTitle=function(e,t){var o,i,n,s,a,r=this;if(this.definition.titleFormatter&&this.table.modExists("format"))switch(o=this.table.modules.format.getFormatter(this.definition.titleFormatter),a=function(e){r.titleFormatterRendered=e},s={getValue:function(){return t},getElement:function(){return e}},n=this.definition.titleFormatterParams||{},n="function"==typeof n?n():n,i=o.call(this.table.modules.format,s,n,a),void 0===i?"undefined":_typeof(i)){case"object":i instanceof Node?e.appendChild(i):(e.innerHTML="",console.warn("Format Error - Title formatter has returned a type of object, the only valid formatter object return is an instance of Node, the formatter returned:",i));break;case"undefined":case"null":e.innerHTML="";break;default:e.innerHTML=i}else e.innerHTML=t},n.prototype._buildGroupHeader=function(){var e=this;if(this.element.classList.add("tabulator-col-group"),this.element.setAttribute("role","columngroup"),this.element.setAttribute("aria-title",this.definition.title),this.definition.cssClass){this.definition.cssClass.split(" ").forEach(function(t){e.element.classList.add(t)})}(this.definition.headerContextMenu||this.definition.headerMenu)&&this.table.modExists("menu")&&this.table.modules.menu.initializeColumnHeader(this),this.titleElement.style.textAlign=this.definition.headerHozAlign||this.table.options.headerHozAlign,this.element.appendChild(this.groupElement)},n.prototype._getFlatData=function(e){return e[this.field]},n.prototype._getNestedData=function(e){for(var t,o=e,i=this.fieldStructure,n=i.length,s=0;s<n&&(o=o[i[s]],t=o,o);s++);return t},n.prototype._setFlatData=function(e,t){this.field&&(e[this.field]=t)},n.prototype._setNestedData=function(e,t){for(var o=e,i=this.fieldStructure,n=i.length,s=0;s<n;s++)if(s==n-1)o[i[s]]=t;else{if(!o[i[s]]){if(void 0===t)break;o[i[s]]={}}o=o[i[s]]}},n.prototype.attachColumn=function(e){var t=this;t.groupElement?(t.columns.push(e),t.groupElement.appendChild(e.getElement())):console.warn("Column Warning - Column being attached to another column instead of column group")},n.prototype.verticalAlign=function(e,t){var o=this.parent.isGroup?this.parent.getGroupElement().clientHeight:t||this.parent.getHeadersElement().clientHeight;this.element.style.height=o+"px",this.isGroup&&(this.groupElement.style.minHeight=o-this.contentElement.offsetHeight+"px"),this.isGroup||"top"===e||(this.element.style.paddingTop="bottom"===e?this.element.clientHeight-this.contentElement.offsetHeight+"px":(this.element.clientHeight-this.contentElement.offsetHeight)/2+"px"),this.columns.forEach(function(t){t.verticalAlign(e)})},n.prototype.clearVerticalAlign=function(){this.element.style.paddingTop="",this.element.style.height="",this.element.style.minHeight="",this.groupElement.style.minHeight="",this.columns.forEach(function(e){e.clearVerticalAlign()})},n.prototype.bindModuleColumns=function(){"rownum"==this.definition.formatter&&(this.table.rowManager.rowNumColumn=this)},n.prototype.getElement=function(){return this.element},n.prototype.getGroupElement=function(){return this.groupElement},n.prototype.getField=function(){return this.field},n.prototype.getFirstColumn=function(){return this.isGroup?!!this.columns.length&&this.columns[0].getFirstColumn():this},n.prototype.getLastColumn=function(){return this.isGroup?!!this.columns.length&&this.columns[this.columns.length-1].getLastColumn():this},n.prototype.getColumns=function(){return this.columns},n.prototype.getCells=function(){return this.cells},n.prototype.getTopColumn=function(){return this.parent.isGroup?this.parent.getTopColumn():this},n.prototype.getDefinition=function(e){var t=[];return this.isGroup&&e&&(this.columns.forEach(function(e){t.push(e.getDefinition(!0))}),this.definition.columns=t),this.definition},n.prototype.checkColumnVisibility=function(){var e=!1;this.columns.forEach(function(t){t.visible&&(e=!0)}),e?(this.show(),this.parent.table.options.columnVisibilityChanged.call(this.table,this.getComponent(),!1)):this.hide()},n.prototype.show=function(e,t){this.visible||(this.visible=!0,this.element.style.display="",this.parent.isGroup&&this.parent.checkColumnVisibility(),this.cells.forEach(function(e){e.show()}),this.isGroup||null!==this.width||this.reinitializeWidth(),this.table.columnManager._verticalAlignHeaders(),this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.columns&&this.table.modules.persistence.save("columns"),!t&&this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.updateColumnVisibility(this,this.visible),e||this.table.options.columnVisibilityChanged.call(this.table,this.getComponent(),!0),this.parent.isGroup&&this.parent.matchChildWidths(),!this.silent&&this.table.options.virtualDomHoz&&this.table.vdomHoz.reinitialize())},n.prototype.hide=function(e,t){this.visible&&(this.visible=!1,this.element.style.display="none",this.table.columnManager._verticalAlignHeaders(),this.parent.isGroup&&this.parent.checkColumnVisibility(),this.cells.forEach(function(e){e.hide()}),this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.columns&&this.table.modules.persistence.save("columns"),!t&&this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.updateColumnVisibility(this,this.visible),e||this.table.options.columnVisibilityChanged.call(this.table,this.getComponent(),!1),this.parent.isGroup&&this.parent.matchChildWidths(),!this.silent&&this.table.options.virtualDomHoz&&this.table.vdomHoz.reinitialize())},n.prototype.matchChildWidths=function(){var e=0;this.contentElement&&this.columns.length&&(this.columns.forEach(function(t){t.visible&&(e+=t.getWidth())}),this.contentElement.style.maxWidth=e-1+"px",this.parent.isGroup&&this.parent.matchChildWidths())},n.prototype.removeChild=function(e){var t=this.columns.indexOf(e);t>-1&&this.columns.splice(t,1),this.columns.length||this.delete()},n.prototype.setWidth=function(e){this.widthFixed=!0,this.setWidthActual(e)},n.prototype.setWidthActual=function(e){isNaN(e)&&(e=Math.floor(this.table.element.clientWidth/100*parseInt(e))),e=Math.max(this.minWidth,e),this.maxWidth&&(e=Math.min(this.maxWidth,e)),this.width=e,this.widthStyled=e?e+"px":"",this.element.style.width=this.widthStyled,this.isGroup||this.cells.forEach(function(e){e.setWidth()}),this.parent.isGroup&&this.parent.matchChildWidths(),this.table.modExists("frozenColumns")&&this.table.modules.frozenColumns.layout()},n.prototype.checkCellHeights=function(){var e=[]
	;this.cells.forEach(function(t){t.row.heightInitialized&&(null!==t.row.getElement().offsetParent?(e.push(t.row),t.row.clearCellHeight()):t.row.heightInitialized=!1)}),e.forEach(function(e){e.calcHeight()}),e.forEach(function(e){e.setCellHeight()})},n.prototype.getWidth=function(){var e=0;return this.isGroup?this.columns.forEach(function(t){t.visible&&(e+=t.getWidth())}):e=this.width,e},n.prototype.getHeight=function(){return this.element.offsetHeight},n.prototype.setMinWidth=function(e){this.minWidth=e,this.minWidthStyled=e?e+"px":"",this.element.style.minWidth=this.minWidthStyled,this.cells.forEach(function(e){e.setMinWidth()})},n.prototype.setMaxWidth=function(e){this.maxWidth=e,this.maxWidthStyled=e?e+"px":"",this.element.style.maxWidth=this.maxWidthStyled,this.cells.forEach(function(e){e.setMaxWidth()})},n.prototype.delete=function(){var e=this;return new Promise(function(t,o){e.isGroup&&e.columns.forEach(function(e){e.delete()}),e.table.modExists("edit")&&e.table.modules.edit.currentCell.column===e&&e.table.modules.edit.cancelEdit();for(var i=e.cells.length,n=0;n<i;n++)e.cells[0].delete();e.element.parentNode&&e.element.parentNode.removeChild(e.element),e.element=!1,e.contentElement=!1,e.titleElement=!1,e.groupElement=!1,e.parent.isGroup&&e.parent.removeChild(e),e.table.columnManager.deregisterColumn(e),e.table.options.virtualDomHoz&&e.table.vdomHoz.reinitialize(!0),t()})},n.prototype.columnRendered=function(){this.titleFormatterRendered&&this.titleFormatterRendered()},n.prototype.validate=function(){var e=[];return this.cells.forEach(function(t){t.validate()||e.push(t.getComponent())}),!e.length||e},n.prototype.generateCell=function(e){var t=this,o=new u(t,e);return this.cells.push(o),o},n.prototype.nextColumn=function(){var e=this.table.columnManager.findColumnIndex(this);return e>-1&&this._nextVisibleColumn(e+1)},n.prototype._nextVisibleColumn=function(e){var t=this.table.columnManager.getColumnByIndex(e);return!t||t.visible?t:this._nextVisibleColumn(e+1)},n.prototype.prevColumn=function(){var e=this.table.columnManager.findColumnIndex(this);return e>-1&&this._prevVisibleColumn(e-1)},n.prototype._prevVisibleColumn=function(e){var t=this.table.columnManager.getColumnByIndex(e);return!t||t.visible?t:this._prevVisibleColumn(e-1)},n.prototype.reinitializeWidth=function(e){this.widthFixed=!1,void 0===this.definition.width||e||this.setWidth(this.definition.width),this.table.modExists("filter")&&this.table.modules.filter.hideHeaderFilterElements(),this.fitToData(),this.table.modExists("filter")&&this.table.modules.filter.showHeaderFilterElements()},n.prototype.fitToData=function(){var e=this;this.widthFixed||(this.element.style.width="",e.cells.forEach(function(e){e.clearWidth()}));var t=this.element.offsetWidth;e.width&&this.widthFixed||(e.cells.forEach(function(e){var o=e.getWidth();o>t&&(t=o)}),t&&e.setWidthActual(t+1))},n.prototype.updateDefinition=function(e){var t=this;return new Promise(function(o,i){var n;t.isGroup?(console.warn("Column Update Error - The updateDefinition function is only available on ungrouped columns"),i("Column Update Error - The updateDefinition function is only available on columns, not column groups")):t.parent.isGroup?(console.warn("Column Update Error - The updateDefinition function is only available on ungrouped columns"),i("Column Update Error - The updateDefinition function is only available on columns, not column groups")):(n=Object.assign({},t.getDefinition()),n=Object.assign(n,e),t.table.columnManager.addColumn(n,!1,t).then(function(e){n.field==t.field&&(t.field=!1),t.delete().then(function(){o(e.getComponent())}).catch(function(e){i(e)})}).catch(function(e){i(e)}))})},n.prototype.deleteCell=function(e){var t=this.cells.indexOf(e);t>-1&&this.cells.splice(t,1)},n.prototype.defaultOptionList=["title","field","columns","visible","align","hozAlign","vertAlign","width","minWidth","maxWidth","widthGrow","widthShrink","resizable","frozen","responsive","tooltip","cssClass","rowHandle","hideInHtml","print","htmlOutput","sorter","sorterParams","formatter","formatterParams","variableHeight","editable","editor","editorParams","validator","mutator","mutatorParams","mutatorData","mutatorDataParams","mutatorEdit","mutatorEditParams","mutatorClipboard","mutatorClipboardParams","accessor","accessorParams","accessorData","accessorDataParams","accessorDownload","accessorDownloadParams","accessorClipboard","accessorClipboardParams","accessorPrint","accessorPrintParams","accessorHtmlOutput","accessorHtmlOutputParams","clipboard","download","downloadTitle","topCalc","topCalcParams","topCalcFormatter","topCalcFormatterParams","bottomCalc","bottomCalcParams","bottomCalcFormatter","bottomCalcFormatterParams","cellClick","cellDblClick","cellContext","cellTap","cellDblTap","cellTapHold","cellMouseEnter","cellMouseLeave","cellMouseOver","cellMouseOut","cellMouseMove","cellEditing","cellEdited","cellEditCancelled","headerSort","headerSortStartingDir","headerSortTristate","headerClick","headerDblClick","headerContext","headerTap","headerDblTap","headerTapHold","headerTooltip","headerVertical","headerHozAlign","editableTitle","titleFormatter","titleFormatterParams","headerFilter","headerFilterPlaceholder","headerFilterParams","headerFilterEmptyCheck","headerFilterFunc","headerFilterFuncParams","headerFilterLiveFilter","print","headerContextMenu","headerMenu","contextMenu","clickMenu","formatterPrint","formatterPrintParams","formatterClipboard","formatterClipboardParams","formatterHtmlOutput","formatterHtmlOutputParams","titlePrint","titleClipboard","titleHtmlOutput","titleDownload"],n.prototype.getComponent=function(){return this.component||(this.component=new o(this)),this.component};var s=function(e){this.table=e,this.element=this.createHolderElement(),this.tableElement=this.createTableElement(),this.heightFixer=this.createTableElement(),this.columnManager=null,this.height=0,this.firstRender=!1,this.renderMode="virtual",this.fixedHeight=!1,this.rows=[],this.activeRows=[],this.activeRowsCount=0,this.displayRows=[],this.displayRowsCount=0,this.scrollTop=0,this.scrollLeft=0,this.vDomRowHeight=20,this.vDomTop=0,this.vDomBottom=0,this.vDomScrollPosTop=0,this.vDomScrollPosBottom=0,this.vDomTopPad=0,this.vDomBottomPad=0,this.vDomMaxRenderChain=90,this.vDomWindowBuffer=0,this.vDomWindowMinTotalRows=20,this.vDomWindowMinMarginRows=5,this.vDomTopNewRows=[],this.vDomBottomNewRows=[],this.rowNumColumn=!1,this.redrawBlock=!1,this.redrawBlockRestoreConfig=!1,this.redrawBlockRederInPosition=!1};s.prototype.createHolderElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-tableHolder"),e.setAttribute("tabindex",0),e},s.prototype.createTableElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-table"),e},s.prototype.getElement=function(){return this.element},s.prototype.getTableElement=function(){return this.tableElement},s.prototype.getRowPosition=function(e,t){return t?this.activeRows.indexOf(e):this.rows.indexOf(e)},s.prototype.setColumnManager=function(e){this.columnManager=e},s.prototype.initialize=function(){var e=this;e.setRenderMode(),e.element.appendChild(e.tableElement),e.firstRender=!0,e.element.addEventListener("scroll",function(){var t=e.element.scrollLeft;e.scrollLeft!=t&&(e.columnManager.scrollHorizontal(t),e.table.options.groupBy&&e.table.modules.groupRows.scrollHeaders(t),e.table.modExists("columnCalcs")&&e.table.modules.columnCalcs.scrollHorizontal(t),e.table.options.scrollHorizontal(t)),e.scrollLeft=t}),"virtual"===this.renderMode&&e.element.addEventListener("scroll",function(){var t=e.element.scrollTop,o=e.scrollTop>t;e.scrollTop!=t?(e.scrollTop=t,e.scrollVertical(o),"scroll"==e.table.options.ajaxProgressiveLoad&&e.table.modules.ajax.nextPage(e.element.scrollHeight-e.element.clientHeight-t),e.table.options.scrollVertical(t)):e.scrollTop=t})},s.prototype.findRow=function(e){var t=this;if("object"!=(void 0===e?"undefined":_typeof(e))){if(void 0===e||null===e)return!1;return t.rows.find(function(o){return o.data[t.table.options.index]==e})||!1}if(e instanceof l)return e;if(e instanceof r)return e._getSelf()||!1;if("undefined"!=typeof HTMLElement&&e instanceof HTMLElement){return t.rows.find(function(t){return t.getElement()===e})||!1}return!1},s.prototype.getRowFromDataObject=function(e){return this.rows.find(function(t){return t.data===e})||!1},s.prototype.getRowFromPosition=function(e,t){return t?this.activeRows[e]:this.rows[e]},s.prototype.scrollToRow=function(e,t,o){var i,n=this,s=this.getDisplayRows().indexOf(e),a=e.getElement(),r=0;return new Promise(function(e,l){if(s>-1){if(void 0===t&&(t=n.table.options.scrollToRowPosition),void 0===o&&(o=n.table.options.scrollToRowIfVisible),"nearest"===t)switch(n.renderMode){case"classic":i=h.prototype.helpers.elOffset(a).top,t=Math.abs(n.element.scrollTop-i)>Math.abs(n.element.scrollTop+n.element.clientHeight-i)?"bottom":"top";break;case"virtual":t=Math.abs(n.vDomTop-s)>Math.abs(n.vDomBottom-s)?"bottom":"top"}if(!o&&h.prototype.helpers.elVisible(a)&&(r=h.prototype.helpers.elOffset(a).top-h.prototype.helpers.elOffset(n.element).top)>0&&r<n.element.clientHeight-a.offsetHeight)return!1;switch(n.renderMode){case"classic":n.element.scrollTop=h.prototype.helpers.elOffset(a).top-h.prototype.helpers.elOffset(n.element).top+n.element.scrollTop;break;case"virtual":n._virtualRenderFill(s,!0)}switch(t){case"middle":case"center":n.element.scrollHeight-n.element.scrollTop==n.element.clientHeight?n.element.scrollTop=n.element.scrollTop+(a.offsetTop-n.element.scrollTop)-(n.element.scrollHeight-a.offsetTop)/2:n.element.scrollTop=n.element.scrollTop-n.element.clientHeight/2;break;case"bottom":n.element.scrollHeight-n.element.scrollTop==n.element.clientHeight?n.element.scrollTop=n.element.scrollTop-(n.element.scrollHeight-a.offsetTop)+a.offsetHeight:n.element.scrollTop=n.element.scrollTop-n.element.clientHeight+a.offsetHeight}e()}else console.warn("Scroll Error - Row not visible"),l("Scroll Error - Row not visible")})},s.prototype.setData=function(e,t,o){var i=this,n=this;return new Promise(function(s,a){t&&i.getDisplayRows().length?n.table.options.pagination?n._setDataActual(e,!0):i.reRenderInPosition(function(){n._setDataActual(e)}):(i.table.options.autoColumns&&o&&i.table.columnManager.generateColumnsFromRowData(e),i.resetScroll(),i._setDataActual(e)),s()})},s.prototype._setDataActual=function(e,t){var o=this;o.table.options.dataLoading.call(this.table,e),this._wipeElements(),this.table.options.history&&this.table.modExists("history")&&this.table.modules.history.clear(),Array.isArray(e)?(this.table.modExists("selectRow")&&this.table.modules.selectRow.clearSelectionData(),this.table.options.reactiveData&&this.table.modExists("reactiveData",!0)&&this.table.modules.reactiveData.watchData(e),e.forEach(function(e,t){if(e&&"object"===(void 0===e?"undefined":_typeof(e))){var i=new l(e,o);o.rows.push(i)}else console.warn("Data Loading Warning - Invalid row data detected and ignored, expecting object but received:",e)}),o.refreshActiveData(!1,!1,t),o.table.options.dataLoaded.call(this.table,e)):console.error("Data Loading Error - Unable to process data due to invalid data type \nExpecting: array \nReceived: ",void 0===e?"undefined":_typeof(e),"\nData:     ",e)},s.prototype._wipeElements=function(){this.rows.forEach(function(e){e.wipe()}),this.table.options.groupBy&&this.table.modExists("groupRows")&&this.table.modules.groupRows.wipe(),this.rows=[],this.activeRows=[],this.activeRowsCount=0,this.displayRows=[],this.displayRowsCount=0,this.adjustTableSize()},s.prototype.deleteRow=function(e,t){var o=this.rows.indexOf(e),i=this.activeRows.indexOf(e);i>-1&&this.activeRows.splice(i,1),o>-1&&this.rows.splice(o,1),this.setActiveRows(this.activeRows),this.displayRowIterator(function(t){var o=t.indexOf(e);o>-1&&t.splice(o,1)}),t||this.reRenderInPosition(),this.regenerateRowNumbers(),this.table.options.rowDeleted.call(this.table,e.getComponent()),this.table.options.dataChanged&&this.table.options.dataChanged.call(this.table,this.getData()),this.table.options.groupBy&&this.table.modExists("groupRows")?this.table.modules.groupRows.updateGroupRows(!0):this.table.options.pagination&&this.table.modExists("page")?this.refreshActiveData(!1,!1,!0):this.table.options.pagination&&this.table.modExists("page")&&this.refreshActiveData("page")},s.prototype.addRow=function(e,t,o,i){var n=this.addRowActual(e,t,o,i);return this.table.options.history&&this.table.modExists("history")&&this.table.modules.history.action("rowAdd",n,{data:e,pos:t,index:o}),n},s.prototype.addRows=function(e,t,o){var i=this,n=this,s=0,a=[];return new Promise(function(r,l){t=i.findAddRowPos(t),Array.isArray(e)||(e=[e]),s=e.length-1,(void 0===o&&t||void 0!==o&&!t)&&e.reverse(),e.forEach(function(e,i){var s=n.addRow(e,t,o,!0);a.push(s)}),i.table.options.groupBy&&i.table.modExists("groupRows")?i.table.modules.groupRows.updateGroupRows(!0):i.table.options.pagination&&i.table.modExists("page")?i.refreshActiveData(!1,!1,!0):i.reRenderInPosition(),i.table.modExists("columnCalcs")&&i.table.modules.columnCalcs.recalc(i.table.rowManager.activeRows),i.regenerateRowNumbers(),r(a)})},s.prototype.findAddRowPos=function(e){return void 0===e&&(e=this.table.options.addRowPos),"pos"===e&&(e=!0),"bottom"===e&&(e=!1),e},s.prototype.addRowActual=function(e,t,o,i){var n,s,a=e instanceof l?e:new l(e||{},this),r=this.findAddRowPos(t),c=-1;if(!o&&this.table.options.pagination&&"page"==this.table.options.paginationAddRow&&(s=this.getDisplayRows(),r?s.length?o=s[0]:this.activeRows.length&&(o=this.activeRows[this.activeRows.length-1],r=!1):s.length&&(o=s[s.length-1],r=!(s.length<this.table.modules.page.getPageSize()))),void 0!==o&&(o=this.findRow(o)),this.table.options.groupBy&&this.table.modExists("groupRows")){this.table.modules.groupRows.assignRowToGroup(a);var u=a.getGroup().rows;u.length>1&&(!o||o&&-1==u.indexOf(o)?r?u[0]!==a&&(o=u[0],this._moveRowInArray(a.getGroup().rows,a,o,!r)):u[u.length-1]!==a&&(o=u[u.length-1],this._moveRowInArray(a.getGroup().rows,a,o,!r)):this._moveRowInArray(a.getGroup().rows,a,o,!r))}return o&&(c=this.rows.indexOf(o)),o&&c>-1?(n=this.activeRows.indexOf(o),this.displayRowIterator(function(e){var t=e.indexOf(o);t>-1&&e.splice(r?t:t+1,0,a)}),n>-1&&this.activeRows.splice(r?n:n+1,0,a),this.rows.splice(r?c:c+1,0,a)):r?(this.displayRowIterator(function(e){e.unshift(a)}),this.activeRows.unshift(a),this.rows.unshift(a)):(this.displayRowIterator(function(e){e.push(a)}),this.activeRows.push(a),this.rows.push(a)),this.setActiveRows(this.activeRows),this.table.options.rowAdded.call(this.table,a.getComponent()),this.table.options.dataChanged&&this.table.options.dataChanged.call(this.table,this.getData()),i||this.reRenderInPosition(),a},s.prototype.moveRow=function(e,t,o){this.table.options.history&&this.table.modExists("history")&&this.table.modules.history.action("rowMove",e,{posFrom:this.getRowPosition(e),posTo:this.getRowPosition(t),to:t,after:o}),this.moveRowActual(e,t,o),this.regenerateRowNumbers(),this.table.options.rowMoved.call(this.table,e.getComponent())},s.prototype.moveRowActual=function(e,t,o){var i=this;if(this._moveRowInArray(this.rows,e,t,o),this._moveRowInArray(this.activeRows,e,t,o),this.displayRowIterator(function(n){i._moveRowInArray(n,e,t,o)}),this.table.options.groupBy&&this.table.modExists("groupRows")){!o&&t instanceof H&&(t=this.table.rowManager.prevDisplayRow(e)||t);var n=t.getGroup(),s=e.getGroup();n===s?this._moveRowInArray(n.rows,e,t,o):(s&&s.removeRow(e),n.insertRow(e,t,o))}},s.prototype._moveRowInArray=function(e,t,o,i){var n,s,a,r;if(t!==o&&(n=e.indexOf(t),n>-1&&(e.splice(n,1),s=e.indexOf(o),s>-1?i?e.splice(s+1,0,t):e.splice(s,0,t):e.splice(n,0,t)),e===this.getDisplayRows())){a=n<s?n:s,r=s>n?s:n+1;for(var l=a;l<=r;l++)e[l]&&this.styleRow(e[l],l)}},s.prototype.clearData=function(){this.setData([])},s.prototype.getRowIndex=function(e){return this.findRowIndex(e,this.rows)},s.prototype.getDisplayRowIndex=function(e){var t=this.getDisplayRows().indexOf(e);return t>-1&&t},s.prototype.nextDisplayRow=function(e,t){var o=this.getDisplayRowIndex(e),i=!1;return!1!==o&&o<this.displayRowsCount-1&&(i=this.getDisplayRows()[o+1]),!i||i instanceof l&&"row"==i.type?i:this.nextDisplayRow(i,t)},s.prototype.prevDisplayRow=function(e,t){var o=this.getDisplayRowIndex(e),i=!1;return o&&(i=this.getDisplayRows()[o-1]),!t||!i||i instanceof l&&"row"==i.type?i:this.prevDisplayRow(i,t)},s.prototype.findRowIndex=function(e,t){var o;return!!((e=this.findRow(e))&&(o=t.indexOf(e))>-1)&&o},s.prototype.getData=function(e,t){var o=[];return this.getRows(e).forEach(function(e){"row"==e.type&&o.push(e.getData(t||"data"))}),o},s.prototype.getComponents=function(e){var t=[];return this.getRows(e).forEach(function(e){t.push(e.getComponent())}),t},s.prototype.getDataCount=function(e){return this.getRows(e).length},s.prototype._genRemoteRequest=function(){var e=this,t=this.table,o=t.options,i={};if(t.modExists("page")){if(o.ajaxSorting){var n=this.table.modules.sort.getSort();n.forEach(function(e){delete e.column}),i[this.table.modules.page.paginationDataSentNames.sorters]=n}if(o.ajaxFiltering){var s=this.table.modules.filter.getFilters(!0,!0);i[this.table.modules.page.paginationDataSentNames.filters]=s}this.table.modules.ajax.setParams(i,!0)}t.modules.ajax.sendRequest().then(function(t){e._setDataActual(t,!0)}).catch(function(e){})},s.prototype.filterRefresh=function(){var e=this.table,t=e.options,o=this.scrollLeft;t.ajaxFiltering?"remote"==t.pagination&&e.modExists("page")?(e.modules.page.reset(!0),e.modules.page.setPage(1).then(function(){}).catch(function(){})):t.ajaxProgressiveLoad?e.modules.ajax.loadData().then(function(){}).catch(function(){}):this._genRemoteRequest():this.refreshActiveData("filter"),this.scrollHorizontal(o)},s.prototype.sorterRefresh=function(e){var t=this.table,o=this.table.options,i=this.scrollLeft;o.ajaxSorting?("remote"==o.pagination||o.progressiveLoad)&&t.modExists("page")?(t.modules.page.reset(!0),t.modules.page.setPage(1).then(function(){}).catch(function(){})):o.ajaxProgressiveLoad?t.modules.ajax.loadData().then(function(){}).catch(function(){}):this._genRemoteRequest():this.refreshActiveData(e?"filter":"sort"),this.scrollHorizontal(i)},s.prototype.scrollHorizontal=function(e){this.scrollLeft=e,this.element.scrollLeft=e,this.table.options.groupBy&&this.table.modules.groupRows.scrollHeaders(e),this.table.modExists("columnCalcs")&&this.table.modules.columnCalcs.scrollHorizontal(e)},s.prototype.refreshActiveData=function(e,t,o){var i,n=this,s=this.table,a=["all","filter","sort","display","freeze","group","tree","page"];if(this.redrawBlock)return void((!this.redrawBlockRestoreConfig||a.indexOf(e)<a.indexOf(this.redrawBlockRestoreConfig.stage))&&(this.redrawBlockRestoreConfig={stage:e,skipStage:t,renderInPosition:o}));switch(n.table.modExists("edit")&&n.table.modules.edit.cancelEdit(),e||(e="all"),s.options.selectable&&!s.options.selectablePersistence&&s.modExists("selectRow")&&s.modules.selectRow.deselectRows(),e){case"all":case"filter":t?t=!1:s.modExists("filter")?n.setActiveRows(s.modules.filter.filter(n.rows)):n.setActiveRows(n.rows.slice(0));case"sort":t?t=!1:s.modExists("sort")&&s.modules.sort.sort(this.activeRows),this.regenerateRowNumbers();case"display":this.resetDisplayRows();case"freeze":t?t=!1:this.table.modExists("frozenRows")&&s.modules.frozenRows.isFrozen()&&(s.modules.frozenRows.getDisplayIndex()||s.modules.frozenRows.setDisplayIndex(this.getNextDisplayIndex()),i=s.modules.frozenRows.getDisplayIndex(),!0!==(i=n.setDisplayRows(s.modules.frozenRows.getRows(this.getDisplayRows(i-1)),i))&&s.modules.frozenRows.setDisplayIndex(i));case"group":t?t=!1:s.options.groupBy&&s.modExists("groupRows")&&(s.modules.groupRows.getDisplayIndex()||s.modules.groupRows.setDisplayIndex(this.getNextDisplayIndex()),i=s.modules.groupRows.getDisplayIndex(),!0!==(i=n.setDisplayRows(s.modules.groupRows.getRows(this.getDisplayRows(i-1)),i))&&s.modules.groupRows.setDisplayIndex(i));case"tree":t?t=!1:s.options.dataTree&&s.modExists("dataTree")&&(s.modules.dataTree.getDisplayIndex()||s.modules.dataTree.setDisplayIndex(this.getNextDisplayIndex()),i=s.modules.dataTree.getDisplayIndex(),!0!==(i=n.setDisplayRows(s.modules.dataTree.getRows(this.getDisplayRows(i-1)),i))&&s.modules.dataTree.setDisplayIndex(i)),s.options.pagination&&s.modExists("page")&&!o&&"local"==s.modules.page.getMode()&&s.modules.page.reset();case"page":t?t=!1:s.options.pagination&&s.modExists("page")&&(s.modules.page.getDisplayIndex()||s.modules.page.setDisplayIndex(this.getNextDisplayIndex()),i=s.modules.page.getDisplayIndex(),"local"==s.modules.page.getMode()&&s.modules.page.setMaxRows(this.getDisplayRows(i-1).length),!0!==(i=n.setDisplayRows(s.modules.page.getRows(this.getDisplayRows(i-1)),i))&&s.modules.page.setDisplayIndex(i))}h.prototype.helpers.elVisible(n.element)&&(o?n.reRenderInPosition():("all"===e&&this.table.options.virtualDomHoz&&this.table.vdomHoz.dataChange(),n.renderTable(),s.options.layoutColumnsOnNewData&&n.table.columnManager.redraw(!0))),s.modExists("columnCalcs")&&s.modules.columnCalcs.recalc(this.activeRows)},s.prototype.regenerateRowNumbers=function(){var e=this;this.rowNumColumn&&this.activeRows.forEach(function(t){var o=t.getCell(e.rowNumColumn);o&&o._generateContents()})},s.prototype.setActiveRows=function(e){this.activeRows=e,this.activeRowsCount=this.activeRows.length},s.prototype.resetDisplayRows=function(){this.displayRows=[],this.displayRows.push(this.activeRows.slice(0)),this.displayRowsCount=this.displayRows[0].length,this.table.modExists("frozenRows")&&this.table.modules.frozenRows.setDisplayIndex(0),this.table.options.groupBy&&this.table.modExists("groupRows")&&this.table.modules.groupRows.setDisplayIndex(0),this.table.options.pagination&&this.table.modExists("page")&&this.table.modules.page.setDisplayIndex(0)},s.prototype.getNextDisplayIndex=function(){return this.displayRows.length},s.prototype.setDisplayRows=function(e,t){var o=!0;return t&&void 0!==this.displayRows[t]?(this.displayRows[t]=e,o=!0):(this.displayRows.push(e),o=t=this.displayRows.length-1),t==this.displayRows.length-1&&(this.displayRowsCount=this.displayRows[this.displayRows.length-1].length),o},s.prototype.getDisplayRows=function(e){return void 0===e?this.displayRows.length?this.displayRows[this.displayRows.length-1]:[]:this.displayRows[e]||[]},s.prototype.getVisibleRows=function(e){var t=this.element.scrollTop,o=this.element.clientHeight+t,i=!1,n=0,s=0,a=this.getDisplayRows();if(e){this.getDisplayRows();for(var r=this.vDomTop;r<=this.vDomBottom;r++)if(a[r])if(i){if(!(o-a[r].getElement().offsetTop>=0))break;s=r}else if(t-a[r].getElement().offsetTop>=0)n=r;else{if(i=!0,!(o-a[r].getElement().offsetTop>=0))break;s=r}}else n=this.vDomTop,s=this.vDomBottom;return a.slice(n,s+1)},s.prototype.displayRowIterator=function(e){this.displayRows.forEach(e),this.displayRowsCount=this.displayRows[this.displayRows.length-1].length},s.prototype.getRows=function(e){var t;switch(e){case"active":t=this.activeRows;break;case"display":t=this.table.rowManager.getDisplayRows();break;case"visible":t=this.getVisibleRows(!0);break;case"selected":t=this.table.modules.selectRow.selectedRows;break;default:t=this.rows}return t},s.prototype.reRenderInPosition=function(e){if("virtual"==this.getRenderMode())if(this.redrawBlock)e?e():this.redrawBlockRederInPosition=!0;else{for(var t=this.element.scrollTop,o=!1,i=!1,n=this.scrollLeft,s=this.getDisplayRows(),a=this.vDomTop;a<=this.vDomBottom;a++)if(s[a]){var r=t-s[a].getElement().offsetTop;if(!(!1===i||Math.abs(r)<i))break;i=r,o=a}e&&e(),this._virtualRenderFill(!1===o?this.displayRowsCount-1:o,!0,i||0),this.scrollHorizontal(n)}else this.renderTable(),e&&e()},s.prototype.setRenderMode=function(){this.table.options.virtualDom?(this.renderMode="virtual",this.table.element.clientHeight||this.table.options.height?this.fixedHeight=!0:this.fixedHeight=!1):this.renderMode="classic"},s.prototype.getRenderMode=function(){return this.renderMode},s.prototype.renderTable=function(){switch(this.table.options.renderStarted.call(this.table),this.element.scrollTop=0,this.renderMode){case"classic":this._simpleRender();break;case"virtual":this._virtualRenderFill()}this.firstRender&&(this.displayRowsCount?(this.firstRender=!1,this.table.modules.layout.layout()):this.renderEmptyScroll()),this.table.modExists("frozenColumns")&&this.table.modules.frozenColumns.layout(),this.displayRowsCount||this.table.options.placeholder&&(this.table.options.placeholder.setAttribute("tabulator-render-mode",this.renderMode),this.getElement().appendChild(this.table.options.placeholder),this.table.options.placeholder.style.width=this.table.columnManager.getWidth()+"px"),this.table.options.renderComplete.call(this.table)},s.prototype._simpleRender=function(){this._clearVirtualDom(),this.displayRowsCount?this.checkClassicModeGroupHeaderWidth():this.renderEmptyScroll()},s.prototype.checkClassicModeGroupHeaderWidth=function(){var e=this,t=this.tableElement,o=!0;e.getDisplayRows().forEach(function(i,n){e.styleRow(i,n),t.appendChild(i.getElement()),i.initialize(!0),"group"!==i.type&&(o=!1)}),t.style.minWidth=o?e.table.columnManager.getWidth()+"px":""},s.prototype.renderEmptyScroll=function(){this.table.options.placeholder?this.tableElement.style.display="none":this.tableElement.style.minWidth=this.table.columnManager.getWidth()+"px"},s.prototype._clearVirtualDom=function(){var e=this.tableElement;for(this.table.options.placeholder&&this.table.options.placeholder.parentNode&&this.table.options.placeholder.parentNode.removeChild(this.table.options.placeholder);e.firstChild;)e.removeChild(e.firstChild);e.style.paddingTop="",e.style.paddingBottom="",e.style.minWidth="",e.style.minHeight="",e.style.display="",e.style.visibility="",this.scrollTop=0,this.scrollLeft=0,this.vDomTop=0,this.vDomBottom=0,this.vDomTopPad=0,this.vDomBottomPad=0},s.prototype.styleRow=function(e,t){var o=e.getElement();t%2?(o.classList.add("tabulator-row-even"),o.classList.remove("tabulator-row-odd")):(o.classList.add("tabulator-row-odd"),o.classList.remove("tabulator-row-even"))},s.prototype._virtualRenderFill=function(e,t,o){var i=this,n=i.tableElement,s=i.element,a=0,r=0,l=0,c=0,u=!0,d=i.getDisplayRows();if(e=e||0,o=o||0,e){for(;n.firstChild;)n.removeChild(n.firstChild);var p=(i.displayRowsCount-e+1)*i.vDomRowHeight;p<i.height&&(e-=Math.ceil((i.height-p)/i.vDomRowHeight))<0&&(e=0),a=Math.min(Math.max(Math.floor(i.vDomWindowBuffer/i.vDomRowHeight),i.vDomWindowMinMarginRows),e),e-=a}else i._clearVirtualDom();if(i.displayRowsCount&&h.prototype.helpers.elVisible(i.element)){for(i.vDomTop=e,i.vDomBottom=e-1;(r<=i.height+i.vDomWindowBuffer||c<i.vDomWindowMinTotalRows)&&i.vDomBottom<i.displayRowsCount-1;){var m=i.vDomBottom+1,f=d[m],g=0;i.styleRow(f,m),n.appendChild(f.getElement()),f.initialize(),f.heightInitialized||f.normalizeHeight(!0),g=f.getHeight(),c<a?l+=g:r+=g,g>this.vDomWindowBuffer&&(this.vDomWindowBuffer=2*g),"group"!==f.type&&(u=!1),i.vDomBottom++,c++}e?(i.vDomTopPad=t?i.vDomRowHeight*this.vDomTop+o:i.scrollTop-l,i.vDomBottomPad=i.vDomBottom==i.displayRowsCount-1?0:Math.max(i.vDomScrollHeight-i.vDomTopPad-r-l,0)):(this.vDomTopPad=0,i.vDomRowHeight=Math.floor((r+l)/c),i.vDomBottomPad=i.vDomRowHeight*(i.displayRowsCount-i.vDomBottom-1),i.vDomScrollHeight=l+r+i.vDomBottomPad-i.height),n.style.paddingTop=i.vDomTopPad+"px",n.style.paddingBottom=i.vDomBottomPad+"px",t&&(this.scrollTop=i.vDomTopPad+l+o-(this.element.scrollWidth>this.element.clientWidth?this.element.offsetHeight-this.element.clientHeight:0)),this.scrollTop=Math.min(this.scrollTop,this.element.scrollHeight-this.height),this.element.scrollWidth>this.element.offsetWidth&&t&&(this.scrollTop+=this.element.offsetHeight-this.element.clientHeight),this.vDomScrollPosTop=this.scrollTop,this.vDomScrollPosBottom=this.scrollTop,s.scrollTop=this.scrollTop,n.style.minWidth=u?i.table.columnManager.getWidth()+"px":"",i.table.options.groupBy&&"fitDataFill"!=i.table.modules.layout.getMode()&&i.displayRowsCount==i.table.modules.groupRows.countGroups()&&(i.tableElement.style.minWidth=i.table.columnManager.getWidth())}else this.renderEmptyScroll();this.fixedHeight||this.adjustTableSize()},s.prototype.scrollVertical=function(e){var t=this.scrollTop-this.vDomScrollPosTop,o=this.scrollTop-this.vDomScrollPosBottom,i=2*this.vDomWindowBuffer;if(-t>i||o>i){var n=this.scrollLeft;this._virtualRenderFill(Math.floor(this.element.scrollTop/this.element.scrollHeight*this.displayRowsCount)),this.scrollHorizontal(n)}else e?(t<0&&this._addTopRow(-t),o<0&&(this.vDomScrollHeight-this.scrollTop>this.vDomWindowBuffer?this._removeBottomRow(-o):this.vDomScrollPosBottom=this.scrollTop)):(t>=0&&(this.scrollTop>this.vDomWindowBuffer?this._removeTopRow(t):this.vDomScrollPosTop=this.scrollTop),o>=0&&this._addBottomRow(o))},s.prototype._addTopRow=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=this.tableElement,i=this.getDisplayRows();if(this.vDomTop){var n=this.vDomTop-1,s=i[n],a=s.getHeight()||this.vDomRowHeight;e>=a&&(this.styleRow(s,n),o.insertBefore(s.getElement(),o.firstChild),s.initialized&&s.heightInitialized||(this.vDomTopNewRows.push(s),s.heightInitialized||s.clearCellHeight()),s.initialize(),this.vDomTopPad-=a,this.vDomTopPad<0&&(this.vDomTopPad=n*this.vDomRowHeight),n||(this.vDomTopPad=0),o.style.paddingTop=this.vDomTopPad+"px",this.vDomScrollPosTop-=a,this.vDomTop--),e=-(this.scrollTop-this.vDomScrollPosTop),s.getHeight()>this.vDomWindowBuffer&&(this.vDomWindowBuffer=2*s.getHeight()),t<this.vDomMaxRenderChain&&this.vDomTop&&e>=(i[this.vDomTop-1].getHeight()||this.vDomRowHeight)?this._addTopRow(e,t+1):this._quickNormalizeRowHeight(this.vDomTopNewRows)}},s.prototype._removeTopRow=function(e){var t=this.tableElement,o=this.getDisplayRows()[this.vDomTop],i=o.getHeight()||this.vDomRowHeight;if(e>=i){var n=o.getElement();n.parentNode.removeChild(n),this.vDomTopPad+=i,t.style.paddingTop=this.vDomTopPad+"px",this.vDomScrollPosTop+=this.vDomTop?i:i+this.vDomWindowBuffer,this.vDomTop++,e=this.scrollTop-this.vDomScrollPosTop,this._removeTopRow(e)}},s.prototype._addBottomRow=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=this.tableElement,i=this.getDisplayRows();if(this.vDomBottom<this.displayRowsCount-1){var n=this.vDomBottom+1,s=i[n],a=s.getHeight()||this.vDomRowHeight;e>=a&&(this.styleRow(s,n),o.appendChild(s.getElement()),s.initialized&&s.heightInitialized||(this.vDomBottomNewRows.push(s),s.heightInitialized||s.clearCellHeight()),s.initialize(),this.vDomBottomPad-=a,(this.vDomBottomPad<0||n==this.displayRowsCount-1)&&(this.vDomBottomPad=0),o.style.paddingBottom=this.vDomBottomPad+"px",this.vDomScrollPosBottom+=a,this.vDomBottom++),e=this.scrollTop-this.vDomScrollPosBottom,s.getHeight()>this.vDomWindowBuffer&&(this.vDomWindowBuffer=2*s.getHeight()),t<this.vDomMaxRenderChain&&this.vDomBottom<this.displayRowsCount-1&&e>=(i[this.vDomBottom+1].getHeight()||this.vDomRowHeight)?this._addBottomRow(e,t+1):this._quickNormalizeRowHeight(this.vDomBottomNewRows)}},s.prototype._removeBottomRow=function(e){var t=this.tableElement,o=this.getDisplayRows()[this.vDomBottom],i=o.getHeight()||this.vDomRowHeight;if(e>=i){var n=o.getElement();n.parentNode&&n.parentNode.removeChild(n),this.vDomBottomPad+=i,this.vDomBottomPad<0&&(this.vDomBottomPad=0),t.style.paddingBottom=this.vDomBottomPad+"px",this.vDomScrollPosBottom-=i,this.vDomBottom--,e=-(this.scrollTop-this.vDomScrollPosBottom),this._removeBottomRow(e)}},s.prototype._quickNormalizeRowHeight=function(e){e.forEach(function(e){e.calcHeight()}),e.forEach(function(e){e.setCellHeight()}),e.length=0},s.prototype.normalizeHeight=function(){this.activeRows.forEach(function(e){e.normalizeHeight()})},s.prototype.adjustTableSize=function(){var e,t=this.element.clientHeight;if("virtual"===this.renderMode){
	var o=Math.floor(this.columnManager.getElement().getBoundingClientRect().height+(this.table.footerManager&&this.table.footerManager.active&&!this.table.footerManager.external?this.table.footerManager.getElement().getBoundingClientRect().height:0));this.fixedHeight?(this.element.style.minHeight="calc(100% - "+o+"px)",this.element.style.height="calc(100% - "+o+"px)",this.element.style.maxHeight="calc(100% - "+o+"px)"):(this.element.style.height="",this.element.style.height=this.table.element.clientHeight-o+"px",this.element.scrollTop=this.scrollTop),this.height=this.element.clientHeight,this.vDomWindowBuffer=this.table.options.virtualDomBuffer||this.height,this.fixedHeight||t==this.element.clientHeight||((e=this.table.modExists("resizeTable"))&&!this.table.modules.resizeTable.autoResize||!e)&&this.redraw()}},s.prototype.reinitialize=function(){this.rows.forEach(function(e){e.reinitialize(!0)})},s.prototype.blockRedraw=function(){this.redrawBlock=!0,this.redrawBlockRestoreConfig=!1},s.prototype.restoreRedraw=function(){this.redrawBlock=!1,this.redrawBlockRestoreConfig?(this.refreshActiveData(this.redrawBlockRestoreConfig.stage,this.redrawBlockRestoreConfig.skipStage,this.redrawBlockRestoreConfig.renderInPosition),this.redrawBlockRestoreConfig=!1):this.redrawBlockRederInPosition&&this.reRenderInPosition(),this.redrawBlockRederInPosition=!1},s.prototype.redraw=function(e){var t=this.scrollLeft;this.adjustTableSize(),this.table.tableWidth=this.table.element.clientWidth,e?this.renderTable():("classic"==this.renderMode?this.table.options.groupBy?this.refreshActiveData("group",!1,!1):this._simpleRender():(this.reRenderInPosition(),this.scrollHorizontal(t)),this.displayRowsCount||this.table.options.placeholder&&this.getElement().appendChild(this.table.options.placeholder))},s.prototype.resetScroll=function(){if(this.element.scrollLeft=0,this.element.scrollTop=0,"ie"===this.table.browser){var e=document.createEvent("Event");e.initEvent("scroll",!1,!0),this.element.dispatchEvent(e)}else this.element.dispatchEvent(new Event("scroll"))};var a=function(e){this.table=e,this.element=this.table.rowManager.tableElement,this.holderEl=this.table.rowManager.element,this.leftCol=0,this.rightCol=0,this.scrollLeft=0,this.vDomScrollPosLeft=0,this.vDomScrollPosRight=0,this.vDomPadLeft=0,this.vDomPadRight=0,this.fitDataColAvg=0,this.window=200,this.initialized=!1,this.columns=[],this.compatabilityCheck()&&this.initialize()};a.prototype.compatabilityCheck=function(){var e=this.table.options,t=!0;return"fitDataTable"==e.layout&&(console.warn("Horizontal Vitrual DOM is not compatible with fitDataTable layout mode"),t=!1),e.responsiveLayout&&(console.warn("Horizontal Vitrual DOM is not compatible with responsive columns"),t=!1),this.table.rtl&&(console.warn("Horizontal Vitrual DOM is not currently compatible with RTL text direction"),t=!1),e.columns&&e.columns.find(function(e){return e.frozen})&&(console.warn("Horizontal Vitrual DOM is not compatible with frozen columns"),t=!1),t||(e.virtualDomHoz=!1),t},a.prototype.initialize=function(){var e=this;this.holderEl.addEventListener("scroll",function(){var t=e.holderEl.scrollLeft;e.scrollLeft!=t&&(e.scrollLeft=t,e.scroll(t-(e.vDomScrollPosLeft+e.window)))})},a.prototype.deinitialize=function(){this.initialized=!1},a.prototype.clear=function(){this.columns=[],this.leftCol=-1,this.rightCol=0,this.vDomScrollPosLeft=0,this.vDomScrollPosRight=0,this.vDomPadLeft=0,this.vDomPadRight=0},a.prototype.dataChange=function(){var e,t,o,i=!1,n=0,s=0;if("fitData"===this.table.options.layout){if(this.table.columnManager.columnsByIndex.forEach(function(e){!e.definition.width&&e.visible&&(i=!0)}),i&&i&&this.table.rowManager.getDisplayRows().length&&(this.vDomScrollPosRight=this.scrollLeft+this.holderEl.clientWidth+this.window,this.table.options.groupBy?(e=this.table.modules.groupRows.getGroups(!1)[0],t=e.getRows(!1)[0]):t=this.table.rowManager.getDisplayRows()[0],t)){o=t.getElement(),t.generateCells(),this.element.appendChild(o);for(var s=0;s<t.cells.length;s++){var a=t.cells[s];if(o.appendChild(a.getElement()),a.column.reinitializeWidth(),(n+=a.column.getWidth())>this.vDomScrollPosRight)break}for(o.parentNode.removeChild(o),this.fitDataColAvg=Math.floor(n/(s+1)),s;s<this.table.columnManager.columnsByIndex.length;s++)this.table.columnManager.columnsByIndex[s].setWidth(this.fitDataColAvg);this.reinitialize(!1,!0)}}else"fitColumns"===this.table.options.layout&&(this.table.modules.layout.layout(),this.table.vdomHoz.reinitialize(!1,!0))},a.prototype.fitDataLayoutOverride=function(){for(var e=this.leftCol;e<=this.rightCol;e++)this.columns[e].reinitializeWidth()},a.prototype.reinitialize=function(e,t){var o=this,i={cols:this.columns,leftCol:this.leftCol,rightCol:this.rightCol};if(!e||this.initialized){this.clear(),this.scrollLeft=this.holderEl.scrollLeft,this.vDomScrollPosLeft=this.scrollLeft-this.window,this.vDomScrollPosRight=this.scrollLeft+this.holderEl.clientWidth+this.window;var n=0;this.table.columnManager.columnsByIndex.forEach(function(e){var t={};if(e.visible){var i=e.getWidth();t.leftPos=n,t.rightPos=n+i,n+i>o.vDomScrollPosLeft&&n<o.vDomScrollPosRight?(-1==o.leftCol&&(o.leftCol=o.columns.length,o.vDomPadLeft=n),o.rightCol=o.columns.length):-1!==o.leftCol&&(o.vDomPadRight+=i),o.columns.push(e),e.modules.vdomHoz=t,n+=i}}),this.element.style.paddingLeft=this.vDomPadLeft+"px",this.element.style.paddingRight=this.vDomPadRight+"px",this.initialized=!0,t||e&&!this.reinitChanged(i)||this.renitializeRows(),this.holderEl.scrollLeft=this.scrollLeft}},a.prototype.reinitChanged=function(e){var t=this,o=!0;return e.cols.length!==this.columns.length||e.leftCol!==this.leftCol||e.rightCol!==this.rightCol||(e.cols.forEach(function(e,i){e!==t.columns[i]&&(o=!1)}),!o)},a.prototype.renitializeRows=function(){var e=this;this.table.rowManager.getVisibleRows().forEach(function(t){e.reinitializeRow(t,!0)})},a.prototype.scroll=function(e){this.vDomScrollPosLeft+=e,this.vDomScrollPosRight+=e,e>.8*this.holderEl.clientWidth?this.reinitialize():e>0?(this.addColRight(),this.removeColLeft()):(this.addColLeft(),this.removeColRight())},a.prototype.colPositionAdjust=function(e,t,o){for(var i=e;i<t;i++){var n=this.columns[i];n.modules.vdomHoz.leftPos-=o,n.modules.vdomHoz.rightPos-=o}},a.prototype.addColRight=function(){var e,t,o,i=this.columns[this.rightCol+1];i&&i.modules.vdomHoz.leftPos<=this.vDomScrollPosRight&&(e=this.table.rowManager.getVisibleRows(),e.forEach(function(e){if("group"!==e.type){var t=e.getCell(i);e.getElement().appendChild(t.getElement()),t.cellRendered()}}),this.fitDataColAvg&&(t=i.getWidth())===this.fitDataColAvg&&(i.reinitializeWidth(),(o=t-i.getWidth())&&(i.modules.vdomHoz.rightPos-=o,this.colPositionAdjust(this.rightCol+1,this.columns.length,o))),this.rightCol++,this.rightCol>=this.columns.length-1?this.vDomPadRight=0:this.vDomPadRight-=i.getWidth(),this.element.style.paddingRight=this.vDomPadRight+"px",this.addColRight())},a.prototype.addColLeft=function(){var e=this.columns[this.leftCol-1];if(e&&e.modules.vdomHoz.rightPos>=this.vDomScrollPosLeft){this.table.rowManager.getVisibleRows().forEach(function(t){if("group"!==t.type){var o=t.getCell(e);t.getElement().prepend(o.getElement()),o.cellRendered()}}),this.leftCol?this.vDomPadLeft-=e.getWidth():this.vDomPadLeft=0,this.element.style.paddingLeft=this.vDomPadLeft+"px",this.leftCol--,this.addColLeft()}},a.prototype.removeColRight=function(e){var t,e=this.columns[this.rightCol];e&&e.modules.vdomHoz.leftPos>this.vDomScrollPosRight&&(t=this.table.rowManager.getVisibleRows(),e.modules.vdomHoz.visible=!1,t.forEach(function(t){if("group"!==t.type){var o=t.getCell(e);t.getElement().removeChild(o.getElement())}}),this.vDomPadRight+=e.getWidth(),this.element.style.paddingRight=this.vDomPadRight+"px",this.rightCol--,this.removeColRight())},a.prototype.removeColLeft=function(){var e,t=this.columns[this.leftCol];t&&t.modules.vdomHoz.rightPos<this.vDomScrollPosLeft&&(e=this.table.rowManager.getVisibleRows(),e.forEach(function(e){if("group"!==e.type){var o=e.getCell(t);e.getElement().removeChild(o.getElement())}}),this.vDomPadLeft+=t.getWidth(),this.element.style.paddingLeft=this.vDomPadLeft+"px",this.leftCol++,this.removeColLeft())},a.prototype.initializeRow=function(e){if("group"!==e.type){e.modules.vdomHoz={leftCol:this.leftCol,rightCol:this.rightCol};for(var t=this.leftCol;t<=this.rightCol;t++){var o=this.columns[t];if(o&&o.visible){var i=e.getCell(o);e.getElement().appendChild(i.getElement()),i.cellRendered()}}}},a.prototype.reinitializeRow=function(e,t){if("group"!==e.type&&(t||!e.modules.vdomHoz||e.modules.vdomHoz.leftCol!==this.leftCol||e.modules.vdomHoz.rightCol!==this.rightCol)){for(var o=e.getElement();o.firstChild;)o.removeChild(o.firstChild);this.initializeRow(e)}};var r=function(e){this._row=e};r.prototype.getData=function(e){return this._row.getData(e)},r.prototype.getElement=function(){return this._row.getElement()},r.prototype.getCells=function(){var e=[];return this._row.getCells().forEach(function(t){e.push(t.getComponent())}),e},r.prototype.getCell=function(e){var t=this._row.getCell(e);return!!t&&t.getComponent()},r.prototype.getIndex=function(){return this._row.getData("data")[this._row.table.options.index]},r.prototype.getPosition=function(e){return this._row.table.rowManager.getRowPosition(this._row,e)},r.prototype.delete=function(){return this._row.delete()},r.prototype.scrollTo=function(){return this._row.table.rowManager.scrollToRow(this._row)},r.prototype.pageTo=function(){if(this._row.table.modExists("page",!0))return this._row.table.modules.page.setPageToRow(this._row)},r.prototype.move=function(e,t){this._row.moveToRow(e,t)},r.prototype.update=function(e){return this._row.updateData(e)},r.prototype.normalizeHeight=function(){this._row.normalizeHeight(!0)},r.prototype.select=function(){this._row.table.modules.selectRow.selectRows(this._row)},r.prototype.deselect=function(){this._row.table.modules.selectRow.deselectRows(this._row)},r.prototype.toggleSelect=function(){this._row.table.modules.selectRow.toggleRow(this._row)},r.prototype.isSelected=function(){return this._row.table.modules.selectRow.isRowSelected(this._row)},r.prototype._getSelf=function(){return this._row},r.prototype.validate=function(){return this._row.validate()},r.prototype.freeze=function(){this._row.table.modExists("frozenRows",!0)&&this._row.table.modules.frozenRows.freezeRow(this._row)},r.prototype.unfreeze=function(){this._row.table.modExists("frozenRows",!0)&&this._row.table.modules.frozenRows.unfreezeRow(this._row)},r.prototype.isFrozen=function(){if(this._row.table.modExists("frozenRows",!0)){return this._row.table.modules.frozenRows.rows.indexOf(this._row)>-1}return!1},r.prototype.treeCollapse=function(){this._row.table.modExists("dataTree",!0)&&this._row.table.modules.dataTree.collapseRow(this._row)},r.prototype.treeExpand=function(){this._row.table.modExists("dataTree",!0)&&this._row.table.modules.dataTree.expandRow(this._row)},r.prototype.treeToggle=function(){this._row.table.modExists("dataTree",!0)&&this._row.table.modules.dataTree.toggleRow(this._row)},r.prototype.getTreeParent=function(){return!!this._row.table.modExists("dataTree",!0)&&this._row.table.modules.dataTree.getTreeParent(this._row)},r.prototype.getTreeChildren=function(){return!!this._row.table.modExists("dataTree",!0)&&this._row.table.modules.dataTree.getTreeChildren(this._row,!0)},r.prototype.addTreeChild=function(e,t,o){return!!this._row.table.modExists("dataTree",!0)&&this._row.table.modules.dataTree.addTreeChildRow(this._row,e,t,o)},r.prototype.reformat=function(){return this._row.reinitialize()},r.prototype.getGroup=function(){return this._row.getGroup().getComponent()},r.prototype.getTable=function(){return this._row.table},r.prototype.getNextRow=function(){var e=this._row.nextRow();return e?e.getComponent():e},r.prototype.getPrevRow=function(){var e=this._row.prevRow();return e?e.getComponent():e};var l=function(e,t){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"row";this.table=t.table,this.parent=t,this.data={},this.type=o,this.element=!1,this.modules={},this.cells=[],this.height=0,this.heightStyled="",this.manualHeight=!1,this.outerHeight=0,this.initialized=!1,this.heightInitialized=!1,this.component=null,this.created=!1,this.setData(e)};l.prototype.create=function(){this.created||(this.created=!0,this.generateElement())},l.prototype.createElement=function(){var e=document.createElement("div");e.classList.add("tabulator-row"),e.setAttribute("role","row"),this.element=e},l.prototype.getElement=function(){return this.create(),this.element},l.prototype.detachElement=function(){this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)},l.prototype.generateElement=function(){var e,t,o,i=this;this.createElement(),!1!==i.table.options.selectable&&i.table.modExists("selectRow")&&i.table.modules.selectRow.initializeRow(this),!1!==i.table.options.movableRows&&i.table.modExists("moveRow")&&i.table.modules.moveRow.initializeRow(this),!1!==i.table.options.dataTree&&i.table.modExists("dataTree")&&i.table.modules.dataTree.initializeRow(this),"collapse"===i.table.options.responsiveLayout&&i.table.modExists("responsiveLayout")&&i.table.modules.responsiveLayout.initializeRow(this),(i.table.options.rowContextMenu||i.table.options.rowClickMenu)&&this.table.modExists("menu")&&i.table.modules.menu.initializeRow(this),i.table.options.rowClick&&i.element.addEventListener("click",function(e){i.table.options.rowClick(e,i.getComponent())}),i.table.options.rowDblClick&&i.element.addEventListener("dblclick",function(e){i.table.options.rowDblClick(e,i.getComponent())}),i.table.options.rowContext&&i.element.addEventListener("contextmenu",function(e){i.table.options.rowContext(e,i.getComponent())}),i.table.options.rowMouseEnter&&i.element.addEventListener("mouseenter",function(e){i.table.options.rowMouseEnter(e,i.getComponent())}),i.table.options.rowMouseLeave&&i.element.addEventListener("mouseleave",function(e){i.table.options.rowMouseLeave(e,i.getComponent())}),i.table.options.rowMouseOver&&i.element.addEventListener("mouseover",function(e){i.table.options.rowMouseOver(e,i.getComponent())}),i.table.options.rowMouseOut&&i.element.addEventListener("mouseout",function(e){i.table.options.rowMouseOut(e,i.getComponent())}),i.table.options.rowMouseMove&&i.element.addEventListener("mousemove",function(e){i.table.options.rowMouseMove(e,i.getComponent())}),i.table.options.rowTap&&(o=!1,i.element.addEventListener("touchstart",function(e){o=!0},{passive:!0}),i.element.addEventListener("touchend",function(e){o&&i.table.options.rowTap(e,i.getComponent()),o=!1})),i.table.options.rowDblTap&&(e=null,i.element.addEventListener("touchend",function(t){e?(clearTimeout(e),e=null,i.table.options.rowDblTap(t,i.getComponent())):e=setTimeout(function(){clearTimeout(e),e=null},300)})),i.table.options.rowTapHold&&(t=null,i.element.addEventListener("touchstart",function(e){clearTimeout(t),t=setTimeout(function(){clearTimeout(t),t=null,o=!1,i.table.options.rowTapHold(e,i.getComponent())},1e3)},{passive:!0}),i.element.addEventListener("touchend",function(e){clearTimeout(t),t=null}))},l.prototype.generateCells=function(){this.cells=this.table.columnManager.generateCells(this)},l.prototype.initialize=function(e){var t=this;if(this.create(),!this.initialized||e){for(this.deleteCells();this.element.firstChild;)this.element.removeChild(this.element.firstChild);this.table.modExists("frozenColumns")&&this.table.modules.frozenColumns.layoutRow(this),this.generateCells(),this.table.options.virtualDomHoz&&this.table.vdomHoz.initialized?this.table.vdomHoz.initializeRow(this):this.cells.forEach(function(e){t.element.appendChild(e.getElement()),e.cellRendered()}),e&&this.normalizeHeight(),this.table.options.dataTree&&this.table.modExists("dataTree")&&this.table.modules.dataTree.layoutRow(this),"collapse"===this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout")&&this.table.modules.responsiveLayout.layoutRow(this),this.table.options.rowFormatter&&this.table.options.rowFormatter(this.getComponent()),this.table.options.resizableRows&&this.table.modExists("resizeRows")&&this.table.modules.resizeRows.initializeRow(this),this.initialized=!0}else this.table.options.virtualDomHoz&&this.table.vdomHoz.reinitializeRow(this)},l.prototype.reinitializeHeight=function(){this.heightInitialized=!1,this.element&&null!==this.element.offsetParent&&this.normalizeHeight(!0)},l.prototype.reinitialize=function(e){this.initialized=!1,this.heightInitialized=!1,this.manualHeight||(this.height=0,this.heightStyled=""),this.element&&null!==this.element.offsetParent&&this.initialize(!0),this.table.options.dataTree&&this.table.modExists("dataTree",!0)&&this.table.modules.dataTree.getTreeChildren(this,!1,!0).forEach(function(e){e.reinitialize(!0)})},l.prototype.calcHeight=function(e){var t=0,o=this.table.options.resizableRows?this.element.clientHeight:0;this.cells.forEach(function(e){var o=e.getHeight();o>t&&(t=o)}),this.height=e?Math.max(t,o):this.manualHeight?this.height:Math.max(t,o),this.heightStyled=this.height?this.height+"px":"",this.outerHeight=this.element.offsetHeight},l.prototype.setCellHeight=function(){this.cells.forEach(function(e){e.setHeight()}),this.heightInitialized=!0},l.prototype.clearCellHeight=function(){this.cells.forEach(function(e){e.clearHeight()})},l.prototype.normalizeHeight=function(e){e&&this.clearCellHeight(),this.calcHeight(e),this.setCellHeight()},l.prototype.setHeight=function(e,t){(this.height!=e||t)&&(this.manualHeight=!0,this.height=e,this.heightStyled=e?e+"px":"",this.setCellHeight(),this.outerHeight=this.element.offsetHeight)},l.prototype.getHeight=function(){return this.outerHeight},l.prototype.getWidth=function(){return this.element.offsetWidth},l.prototype.deleteCell=function(e){var t=this.cells.indexOf(e);t>-1&&this.cells.splice(t,1)},l.prototype.setData=function(e){this.table.modExists("mutator")&&(e=this.table.modules.mutator.transformRow(e,"data")),this.data=e,this.table.options.reactiveData&&this.table.modExists("reactiveData",!0)&&this.table.modules.reactiveData.watchRow(this)},l.prototype.updateData=function(e){var t,o=this,i=this.element&&h.prototype.helpers.elVisible(this.element),n={};return new Promise(function(s,a){"string"==typeof e&&(e=JSON.parse(e)),o.table.options.reactiveData&&o.table.modExists("reactiveData",!0)&&o.table.modules.reactiveData.block(),o.table.modExists("mutator")?(n=Object.assign(n,o.data),n=Object.assign(n,e),t=o.table.modules.mutator.transformRow(n,"data",e)):t=e;for(var r in t)o.data[r]=t[r];o.table.options.reactiveData&&o.table.modExists("reactiveData",!0)&&o.table.modules.reactiveData.unblock();for(var r in e){o.table.columnManager.getColumnsByFieldRoot(r).forEach(function(e){var n=o.getCell(e.getField());if(n){var s=e.getFieldValue(t);n.getValue()!=s&&(n.setValueProcessData(s),i&&n.cellRendered())}})}o.table.options.groupUpdateOnCellEdit&&o.table.options.groupBy&&o.table.modExists("groupRows")&&o.table.modules.groupRows.reassignRowToGroup(o.row),i?(o.normalizeHeight(!0),o.table.options.rowFormatter&&o.table.options.rowFormatter(o.getComponent())):(o.initialized=!1,o.height=0,o.heightStyled=""),!1!==o.table.options.dataTree&&o.table.modExists("dataTree")&&o.table.modules.dataTree.redrawNeeded(e)&&(o.table.modules.dataTree.initializeRow(o),i&&(o.table.modules.dataTree.layoutRow(o),o.table.rowManager.refreshActiveData("tree",!1,!0))),o.table.options.rowUpdated.call(o.table,o.getComponent()),o.table.options.dataChanged&&o.table.options.dataChanged.call(o.table,o.table.rowManager.getData()),s()})},l.prototype.getData=function(e){return e&&this.table.modExists("accessor")?this.table.modules.accessor.transformRow(this,e):this.data},l.prototype.getCell=function(e){return e=this.table.columnManager.findColumn(e),this.cells.find(function(t){return t.column===e})},l.prototype.getCellIndex=function(e){return this.cells.findIndex(function(t){return t===e})},l.prototype.findNextEditableCell=function(e){var t=!1;if(e<this.cells.length-1)for(var o=e+1;o<this.cells.length;o++){var i=this.cells[o];if(i.column.modules.edit&&h.prototype.helpers.elVisible(i.getElement())){var n=!0;if("function"==typeof i.column.modules.edit.check&&(n=i.column.modules.edit.check(i.getComponent())),n){t=i;break}}}return t},l.prototype.findPrevEditableCell=function(e){var t=!1;if(e>0)for(var o=e-1;o>=0;o--){var i=this.cells[o],n=!0;if(i.column.modules.edit&&h.prototype.helpers.elVisible(i.getElement())&&("function"==typeof i.column.modules.edit.check&&(n=i.column.modules.edit.check(i.getComponent())),n)){t=i;break}}return t},l.prototype.getCells=function(){return this.cells},l.prototype.nextRow=function(){return this.table.rowManager.nextDisplayRow(this,!0)||!1},l.prototype.prevRow=function(){return this.table.rowManager.prevDisplayRow(this,!0)||!1},l.prototype.moveToRow=function(e,t){var o=this.table.rowManager.findRow(e);o?(this.table.rowManager.moveRowActual(this,o,!t),this.table.rowManager.refreshActiveData("display",!1,!0)):console.warn("Move Error - No matching row found:",e)},l.prototype.validate=function(){var e=[];return this.cells.forEach(function(t){t.validate()||e.push(t.getComponent())}),!e.length||e},l.prototype.delete=function(){var e=this;return new Promise(function(t,o){var i,n;e.table.options.history&&e.table.modExists("history")&&(e.table.options.groupBy&&e.table.modExists("groupRows")?(n=e.getGroup().rows,(i=n.indexOf(e))&&(i=n[i-1])):(i=e.table.rowManager.getRowIndex(e))&&(i=e.table.rowManager.rows[i-1]),e.table.modules.history.action("rowDelete",e,{data:e.getData(),pos:!i,index:i})),e.deleteActual(),t()})},l.prototype.deleteActual=function(e){this.table.rowManager.getRowIndex(this);this.detatchModules(),this.table.options.reactiveData&&this.table.modExists("reactiveData",!0),this.modules.group&&this.modules.group.removeRow(this),this.table.rowManager.deleteRow(this,e),this.deleteCells(),this.initialized=!1,this.heightInitialized=!1,this.element=!1,this.table.options.dataTree&&this.table.modExists("dataTree",!0)&&this.table.modules.dataTree.rowDelete(this),this.table.modExists("columnCalcs")&&(this.table.options.groupBy&&this.table.modExists("groupRows")?this.table.modules.columnCalcs.recalcRowGroup(this):this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows))},l.prototype.detatchModules=function(){this.table.modExists("selectRow")&&this.table.modules.selectRow._deselectRow(this,!0),this.table.modExists("edit")&&this.table.modules.edit.currentCell.row===this&&this.table.modules.edit.cancelEdit(),this.table.modExists("frozenRows")&&this.table.modules.frozenRows.detachRow(this)},l.prototype.deleteCells=function(){for(var e=this.cells.length,t=0;t<e;t++)this.cells[0].delete()},l.prototype.wipe=function(){if(this.detatchModules(),this.deleteCells(),this.element){for(;this.element.firstChild;)this.element.removeChild(this.element.firstChild);this.element.parentNode&&this.element.parentNode.removeChild(this.element)}this.element=!1,this.modules={}},l.prototype.getGroup=function(){return this.modules.group||!1},l.prototype.getComponent=function(){return this.component||(this.component=new r(this)),this.component};var c=function(e){this._cell=e};c.prototype.getValue=function(){return this._cell.getValue()},c.prototype.getOldValue=function(){return this._cell.getOldValue()},c.prototype.getInitialValue=function(){return this._cell.initialValue},c.prototype.getElement=function(){return this._cell.getElement()},c.prototype.getRow=function(){return this._cell.row.getComponent()},c.prototype.getData=function(){return this._cell.row.getData()},c.prototype.getField=function(){return this._cell.column.getField()},c.prototype.getColumn=function(){return this._cell.column.getComponent()},c.prototype.setValue=function(e,t){void 0===t&&(t=!0),this._cell.setValue(e,t)},c.prototype.restoreOldValue=function(){this._cell.setValueActual(this._cell.getOldValue())},c.prototype.restoreInitialValue=function(){this._cell.setValueActual(this._cell.initialValue)},c.prototype.edit=function(e){return this._cell.edit(e)},c.prototype.cancelEdit=function(){this._cell.cancelEdit()},c.prototype.isEdited=function(){return!!this._cell.modules.edit&&this._cell.modules.edit.edited},c.prototype.clearEdited=function(){self.table.modExists("edit",!0)&&this._cell.table.modules.edit.clearEdited(this._cell)},c.prototype.isValid=function(){return!this._cell.modules.validate||!this._cell.modules.validate.invalid},c.prototype.validate=function(){return this._cell.validate()},c.prototype.clearValidation=function(){this._cell.table.modExists("validate",!0)&&this._cell.table.modules.validate.clearValidation(this._cell)},c.prototype.nav=function(){return this._cell.nav()},c.prototype.checkHeight=function(){this._cell.checkHeight()},c.prototype.getTable=function(){return this._cell.table},c.prototype._getSelf=function(){return this._cell};var u=function(e,t){this.table=e.table,this.column=e,this.row=t,this.element=null,this.value=null,this.initialValue,this.oldValue=null,this.modules={},this.height=null,this.width=null,this.minWidth=null,this.component=null,this.loaded=!1,this.build()};u.prototype.build=function(){this.generateElement(),this.setWidth(),this._configureCell(),this.setValueActual(this.column.getFieldValue(this.row.data)),this.initialValue=this.value},u.prototype.generateElement=function(){this.element=document.createElement("div"),this.element.className="tabulator-cell",this.element.setAttribute("role","gridcell"),this.element=this.element},u.prototype._configureCell=function(){var e=this,t=e.column.cellEvents,o=e.element,i=this.column.getField(),n={top:"flex-start",bottom:"flex-end",middle:"center"},s={left:"flex-start",right:"flex-end",center:"center"};if(o.style.textAlign=e.column.hozAlign,e.column.vertAlign&&(o.style.display="inline-flex",o.style.alignItems=n[e.column.vertAlign]||"",e.column.hozAlign&&(o.style.justifyContent=s[e.column.hozAlign]||"")),i&&o.setAttribute("tabulator-field",i),e.column.definition.cssClass){e.column.definition.cssClass.split(" ").forEach(function(e){o.classList.add(e)})}"hover"===this.table.options.tooltipGenerationMode&&o.addEventListener("mouseenter",function(t){e._generateTooltip()}),e._bindClickEvents(t),e._bindTouchEvents(t),e._bindMouseEvents(t),e.column.modules.edit&&e.table.modules.edit.bindEditor(e),e.column.definition.rowHandle&&!1!==e.table.options.movableRows&&e.table.modExists("moveRow")&&e.table.modules.moveRow.initializeCell(e),e.column.visible||e.hide()},u.prototype._bindClickEvents=function(e){var t=this,o=t.element;(e.cellClick||t.table.options.cellClick)&&o.addEventListener("click",function(o){var i=t.getComponent();e.cellClick&&e.cellClick.call(t.table,o,i),t.table.options.cellClick&&t.table.options.cellClick.call(t.table,o,i)}),e.cellDblClick||this.table.options.cellDblClick?o.addEventListener("dblclick",function(o){var i=t.getComponent();e.cellDblClick&&e.cellDblClick.call(t.table,o,i),t.table.options.cellDblClick&&t.table.options.cellDblClick.call(t.table,o,i)}):o.addEventListener("dblclick",function(e){if(!t.table.modExists("edit")||t.table.modules.edit.currentCell!==t){e.preventDefault();try{if(document.selection){var o=document.body.createTextRange();o.moveToElementText(t.element),o.select()}else if(window.getSelection){var o=document.createRange();o.selectNode(t.element),window.getSelection().removeAllRanges(),window.getSelection().addRange(o)}}catch(e){}}}),(e.cellContext||this.table.options.cellContext)&&o.addEventListener("contextmenu",function(o){var i=t.getComponent();e.cellContext&&e.cellContext.call(t.table,o,i),t.table.options.cellContext&&t.table.options.cellContext.call(t.table,o,i)})},u.prototype._bindMouseEvents=function(e){var t=this,o=t.element;(e.cellMouseEnter||t.table.options.cellMouseEnter)&&o.addEventListener("mouseenter",function(o){var i=t.getComponent();e.cellMouseEnter&&e.cellMouseEnter.call(t.table,o,i),t.table.options.cellMouseEnter&&t.table.options.cellMouseEnter.call(t.table,o,i)}),(e.cellMouseLeave||t.table.options.cellMouseLeave)&&o.addEventListener("mouseleave",function(o){var i=t.getComponent();e.cellMouseLeave&&e.cellMouseLeave.call(t.table,o,i),t.table.options.cellMouseLeave&&t.table.options.cellMouseLeave.call(t.table,o,i)}),(e.cellMouseOver||t.table.options.cellMouseOver)&&o.addEventListener("mouseover",function(o){var i=t.getComponent();e.cellMouseOver&&e.cellMouseOver.call(t.table,o,i),t.table.options.cellMouseOver&&t.table.options.cellMouseOver.call(t.table,o,i)}),(e.cellMouseOut||t.table.options.cellMouseOut)&&o.addEventListener("mouseout",function(o){var i=t.getComponent();e.cellMouseOut&&e.cellMouseOut.call(t.table,o,i),t.table.options.cellMouseOut&&t.table.options.cellMouseOut.call(t.table,o,i)}),(e.cellMouseMove||t.table.options.cellMouseMove)&&o.addEventListener("mousemove",function(o){var i=t.getComponent();e.cellMouseMove&&e.cellMouseMove.call(t.table,o,i),t.table.options.cellMouseMove&&t.table.options.cellMouseMove.call(t.table,o,i)})},u.prototype._bindTouchEvents=function(e){var t,o,i,n=this,s=n.element;(e.cellTap||this.table.options.cellTap)&&(i=!1,s.addEventListener("touchstart",function(e){i=!0},{passive:!0}),s.addEventListener("touchend",function(t){if(i){var o=n.getComponent();e.cellTap&&e.cellTap.call(n.table,t,o),n.table.options.cellTap&&n.table.options.cellTap.call(n.table,t,o)}i=!1})),(e.cellDblTap||this.table.options.cellDblTap)&&(t=null,s.addEventListener("touchend",function(o){if(t){clearTimeout(t),t=null;var i=n.getComponent();e.cellDblTap&&e.cellDblTap.call(n.table,o,i),n.table.options.cellDblTap&&n.table.options.cellDblTap.call(n.table,o,i)}else t=setTimeout(function(){clearTimeout(t),t=null},300)})),(e.cellTapHold||this.table.options.cellTapHold)&&(o=null,s.addEventListener("touchstart",function(t){clearTimeout(o),o=setTimeout(function(){clearTimeout(o),o=null,i=!1;var s=n.getComponent();e.cellTapHold&&e.cellTapHold.call(n.table,t,s),n.table.options.cellTapHold&&n.table.options.cellTapHold.call(n.table,t,s)},1e3)},{passive:!0}),s.addEventListener("touchend",function(e){clearTimeout(o),o=null}))},u.prototype._generateContents=function(){var e;switch(e=this.table.modExists("format")?this.table.modules.format.formatValue(this):this.element.innerHTML=this.value,void 0===e?"undefined":_typeof(e)){case"object":if(e instanceof Node){for(;this.element.firstChild;)this.element.removeChild(this.element.firstChild);this.element.appendChild(e)}else this.element.innerHTML="",null!=e&&console.warn("Format Error - Formatter has returned a type of object, the only valid formatter object return is an instance of Node, the formatter returned:",e);break;case"undefined":case"null":this.element.innerHTML="";break;default:this.element.innerHTML=e}},u.prototype.cellRendered=function(){this.table.modExists("format")&&this.table.modules.format.cellRendered&&this.table.modules.format.cellRendered(this)},u.prototype._generateTooltip=function(){var e=this.column.tooltip;e?(!0===e?e=this.value:"function"==typeof e&&!1===(e=e(this.getComponent()))&&(e=""),void 0===e&&(e=""),this.element.setAttribute("title",e)):this.element.setAttribute("title","")},u.prototype.getElement=function(e){return this.loaded||(this.loaded=!0,e||this.layoutElement()),this.element},u.prototype.getValue=function(){return this.value},u.prototype.getOldValue=function(){return this.oldValue},u.prototype.setValue=function(e,t){var o,i=this.setValueProcessData(e,t);i&&(this.table.options.history&&this.table.modExists("history")&&this.table.modules.history.action("cellEdit",this,{oldValue:this.oldValue,newValue:this.value}),o=this.getComponent(),this.column.cellEvents.cellEdited&&this.column.cellEvents.cellEdited.call(this.table,o),this.table.options.groupUpdateOnCellEdit&&this.table.options.groupBy&&this.table.modExists("groupRows")&&this.table.modules.groupRows.reassignRowToGroup(this.row),this.cellRendered(),this.table.options.cellEdited.call(this.table,o),
	this.table.options.dataChanged&&this.table.options.dataChanged.call(this.table,this.table.rowManager.getData()))},u.prototype.setValueProcessData=function(e,t){var o=!1;return this.value!=e&&(o=!0,t&&this.column.modules.mutate&&(e=this.table.modules.mutator.transformCell(this,e))),this.setValueActual(e),o&&this.table.modExists("columnCalcs")&&(this.column.definition.topCalc||this.column.definition.bottomCalc)&&(this.table.options.groupBy&&this.table.modExists("groupRows")?("table"!=this.table.options.columnCalcs&&"both"!=this.table.options.columnCalcs||this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows),"table"!=this.table.options.columnCalcs&&this.table.modules.columnCalcs.recalcRowGroup(this.row)):this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows)),o},u.prototype.setValueActual=function(e){this.oldValue=this.value,this.value=e,this.table.options.reactiveData&&this.table.modExists("reactiveData")&&this.table.modules.reactiveData.block(),this.column.setFieldValue(this.row.data,e),this.table.options.reactiveData&&this.table.modExists("reactiveData")&&this.table.modules.reactiveData.unblock(),this.loaded&&this.layoutElement()},u.prototype.layoutElement=function(){this._generateContents(),this._generateTooltip(),this.table.options.resizableColumns&&this.table.modExists("resizeColumns")&&"row"===this.row.type&&this.table.modules.resizeColumns.initializeColumn("cell",this.column,this.element),(this.column.definition.contextMenu||this.column.definition.clickMenu)&&this.table.modExists("menu")&&this.table.modules.menu.initializeCell(this),this.table.modExists("frozenColumns")&&this.table.modules.frozenColumns.layoutElement(this.element,this.column)},u.prototype.setWidth=function(){this.width=this.column.width,this.element.style.width=this.column.widthStyled},u.prototype.clearWidth=function(){this.width="",this.element.style.width=""},u.prototype.getWidth=function(){return this.width||this.element.offsetWidth},u.prototype.setMinWidth=function(){this.minWidth=this.column.minWidth,this.element.style.minWidth=this.column.minWidthStyled},u.prototype.setMaxWidth=function(){this.maxWidth=this.column.maxWidth,this.element.style.maxWidth=this.column.maxWidthStyled},u.prototype.checkHeight=function(){this.row.reinitializeHeight()},u.prototype.clearHeight=function(){this.element.style.height="",this.height=null},u.prototype.setHeight=function(){this.height=this.row.height,this.element.style.height=this.row.heightStyled},u.prototype.getHeight=function(){return this.height||this.element.offsetHeight},u.prototype.show=function(){this.element.style.display=this.column.vertAlign?"inline-flex":""},u.prototype.hide=function(){this.element.style.display="none"},u.prototype.edit=function(e){if(this.table.modExists("edit",!0))return this.table.modules.edit.editCell(this,e)},u.prototype.cancelEdit=function(){if(this.table.modExists("edit",!0)){var e=this.table.modules.edit.getCurrentCell();e&&e._getSelf()===this?this.table.modules.edit.cancelEdit():console.warn("Cancel Editor Error - This cell is not currently being edited ")}},u.prototype.validate=function(){if(this.column.modules.validate&&this.table.modExists("validate",!0)){return!0===this.table.modules.validate.validate(this.column.modules.validate,this,this.getValue())}return!0},u.prototype.delete=function(){!this.table.rowManager.redrawBlock&&this.element.parentNode&&this.element.parentNode.removeChild(this.element),this.modules.validate&&this.modules.validate.invalid&&this.table.modules.validate.clearValidation(this),this.modules.edit&&this.modules.edit.edited&&this.table.modules.edit.clearEdited(this),this.table.options.history&&this.table.modules.history.clearComponentHistory(this),this.element=!1,this.column.deleteCell(this),this.row.deleteCell(this),this.calcs={}},u.prototype.nav=function(){var e=this,t=!1,o=this.row.getCellIndex(this);return{next:function(){var t,o=this.right();return!!o||!(!(t=e.table.rowManager.nextDisplayRow(e.row,!0))||!(o=t.findNextEditableCell(-1)))&&(o.edit(),!0)},prev:function(){var t,o=this.left();return!!o||!(!(t=e.table.rowManager.prevDisplayRow(e.row,!0))||!(o=t.findPrevEditableCell(t.cells.length)))&&(o.edit(),!0)},left:function(){return!!(t=e.row.findPrevEditableCell(o))&&(t.edit(),!0)},right:function(){return!!(t=e.row.findNextEditableCell(o))&&(t.edit(),!0)},up:function(){var t=e.table.rowManager.prevDisplayRow(e.row,!0);t&&t.cells[o].edit()},down:function(){var t=e.table.rowManager.nextDisplayRow(e.row,!0);t&&t.cells[o].edit()}}},u.prototype.getIndex=function(){this.row.getCellIndex(this)},u.prototype.getComponent=function(){return this.component||(this.component=new c(this)),this.component};var d=function(e){this.table=e,this.active=!1,this.element=this.createElement(),this.external=!1,this.links=[],this._initialize()};d.prototype.createElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-footer"),e},d.prototype._initialize=function(e){if(this.table.options.footerElement)switch(_typeof(this.table.options.footerElement)){case"string":"<"===this.table.options.footerElement[0]?this.element.innerHTML=this.table.options.footerElement:(this.external=!0,this.element=document.querySelector(this.table.options.footerElement));break;default:this.element=this.table.options.footerElement}},d.prototype.getElement=function(){return this.element},d.prototype.append=function(e,t){this.activate(t),this.element.appendChild(e),this.table.rowManager.adjustTableSize()},d.prototype.prepend=function(e,t){this.activate(t),this.element.insertBefore(e,this.element.firstChild),this.table.rowManager.adjustTableSize()},d.prototype.remove=function(e){e.parentNode.removeChild(e),this.deactivate()},d.prototype.deactivate=function(e){this.element.firstChild&&!e||(this.external||this.element.parentNode.removeChild(this.element),this.active=!1)},d.prototype.activate=function(e){this.active||(this.active=!0,this.external||(this.table.element.appendChild(this.getElement()),this.table.element.style.display="")),e&&this.links.push(e)},d.prototype.redraw=function(){this.links.forEach(function(e){e.footerRedraw()})};var h=function e(t,o){this.options={},this.columnManager=null,this.rowManager=null,this.footerManager=null,this.vdomHoz=null,this.browser="",this.browserSlow=!1,this.browserMobile=!1,this.rtl=!1,this.modules={},this.initializeElement(t)&&(this.initializeOptions(o||{}),this._create()),e.prototype.comms.register(this)};h.prototype.defaultOptions={height:!1,minHeight:!1,maxHeight:!1,layout:"fitData",layoutColumnsOnNewData:!1,columnMinWidth:40,columnMaxWidth:!1,columnHeaderVertAlign:"top",columnVertAlign:!1,resizableColumns:!0,resizableRows:!1,autoResize:!0,columns:[],cellHozAlign:"",cellVertAlign:"",headerHozAlign:"",data:[],autoColumns:!1,autoColumnsDefinitions:!1,reactiveData:!1,nestedFieldSeparator:".",tooltips:!1,tooltipsHeader:!1,tooltipGenerationMode:"load",initialSort:!1,initialFilter:!1,initialHeaderFilter:!1,columnHeaderSortMulti:!0,sortOrderReverse:!1,headerSort:!0,headerSortTristate:!1,headerSortElement:"<div class='tabulator-arrow'></div>",footerElement:!1,index:"id",textDirection:"auto",keybindings:[],tabEndNewRow:!1,invalidOptionWarnings:!0,clipboard:!1,clipboardCopyStyled:!0,clipboardCopyConfig:!1,clipboardCopyFormatter:!1,clipboardCopyRowRange:"active",clipboardPasteParser:"table",clipboardPasteAction:"insert",clipboardCopied:function(){},clipboardPasted:function(){},clipboardPasteError:function(){},downloadDataFormatter:!1,downloadReady:function(e,t){return t},downloadComplete:!1,downloadConfig:{},downloadRowRange:"active",dataTree:!1,dataTreeFilter:!0,dataTreeSort:!0,dataTreeElementColumn:!1,dataTreeBranchElement:!0,dataTreeChildIndent:9,dataTreeChildField:"_children",dataTreeCollapseElement:!1,dataTreeExpandElement:!1,dataTreeStartExpanded:!1,dataTreeRowExpanded:function(){},dataTreeRowCollapsed:function(){},dataTreeChildColumnCalcs:!1,dataTreeSelectPropagate:!1,printAsHtml:!1,printFormatter:!1,printHeader:!1,printFooter:!1,printCopyStyle:!0,printStyled:!0,printVisibleRows:!0,printRowRange:"visible",printConfig:{},addRowPos:"bottom",selectable:"highlight",selectableRangeMode:"drag",selectableRollingSelection:!0,selectablePersistence:!0,selectableCheck:function(e,t){return!0},headerFilterLiveFilterDelay:300,headerFilterPlaceholder:!1,headerVisible:!0,history:!1,locale:!1,langs:{},virtualDom:!0,virtualDomBuffer:0,virtualDomHoz:!1,persistentLayout:!1,persistentSort:!1,persistentFilter:!1,persistenceID:"",persistenceMode:!0,persistenceReaderFunc:!1,persistenceWriterFunc:!1,persistence:!1,responsiveLayout:!1,responsiveLayoutCollapseStartOpen:!0,responsiveLayoutCollapseUseFormatters:!0,responsiveLayoutCollapseFormatter:!1,pagination:!1,paginationSize:!1,paginationInitialPage:1,paginationButtonCount:5,paginationSizeSelector:!1,paginationElement:!1,paginationDataSent:{},paginationDataReceived:{},paginationAddRow:"page",ajaxURL:!1,ajaxURLGenerator:!1,ajaxParams:{},ajaxConfig:"get",ajaxContentType:"form",ajaxRequestFunc:!1,ajaxLoader:!0,ajaxLoaderLoading:!1,ajaxLoaderError:!1,ajaxFiltering:!1,ajaxSorting:!1,ajaxProgressiveLoad:!1,ajaxProgressiveLoadDelay:0,ajaxProgressiveLoadScrollMargin:0,groupBy:!1,groupStartOpen:!0,groupValues:!1,groupUpdateOnCellEdit:!1,groupHeader:!1,groupHeaderPrint:null,groupHeaderClipboard:null,groupHeaderHtmlOutput:null,groupHeaderDownload:null,htmlOutputConfig:!1,movableColumns:!1,movableRows:!1,movableRowsConnectedTables:!1,movableRowsConnectedElements:!1,movableRowsSender:!1,movableRowsReceiver:"insert",movableRowsSendingStart:function(){},movableRowsSent:function(){},movableRowsSentFailed:function(){},movableRowsSendingStop:function(){},movableRowsReceivingStart:function(){},movableRowsReceived:function(){},movableRowsReceivedFailed:function(){},movableRowsReceivingStop:function(){},movableRowsElementDrop:function(){},scrollToRowPosition:"top",scrollToRowIfVisible:!0,scrollToColumnPosition:"left",scrollToColumnIfVisible:!0,rowFormatter:!1,rowFormatterPrint:null,rowFormatterClipboard:null,rowFormatterHtmlOutput:null,placeholder:!1,tableBuilding:function(){},tableBuilt:function(){},renderStarted:function(){},renderComplete:function(){},rowClick:!1,rowDblClick:!1,rowContext:!1,rowTap:!1,rowDblTap:!1,rowTapHold:!1,rowMouseEnter:!1,rowMouseLeave:!1,rowMouseOver:!1,rowMouseOut:!1,rowMouseMove:!1,rowContextMenu:!1,rowClickMenu:!1,rowAdded:function(){},rowDeleted:function(){},rowMoved:function(){},rowUpdated:function(){},rowSelectionChanged:function(){},rowSelected:function(){},rowDeselected:function(){},rowResized:function(){},cellClick:!1,cellDblClick:!1,cellContext:!1,cellTap:!1,cellDblTap:!1,cellTapHold:!1,cellMouseEnter:!1,cellMouseLeave:!1,cellMouseOver:!1,cellMouseOut:!1,cellMouseMove:!1,cellEditing:function(){},cellEdited:function(){},cellEditCancelled:function(){},columnMoved:!1,columnResized:function(){},columnTitleChanged:function(){},columnVisibilityChanged:function(){},htmlImporting:function(){},htmlImported:function(){},dataLoading:function(){},dataLoaded:function(){},dataEdited:!1,dataChanged:!1,ajaxRequesting:function(){},ajaxResponse:!1,ajaxError:function(){},dataFiltering:!1,dataFiltered:!1,dataSorting:function(){},dataSorted:function(){},groupToggleElement:"arrow",groupClosedShowCalcs:!1,dataGrouping:function(){},dataGrouped:!1,groupVisibilityChanged:function(){},groupClick:!1,groupDblClick:!1,groupContext:!1,groupContextMenu:!1,groupClickMenu:!1,groupTap:!1,groupDblTap:!1,groupTapHold:!1,columnCalcs:!0,pageLoaded:function(){},localized:function(){},validationMode:"blocking",validationFailed:function(){},historyUndo:function(){},historyRedo:function(){},scrollHorizontal:function(){},scrollVertical:function(){}},h.prototype.initializeOptions=function(e){if(!1!==e.invalidOptionWarnings)for(var t in e)void 0===this.defaultOptions[t]&&console.warn("Invalid table constructor option:",t);for(var t in this.defaultOptions)t in e?this.options[t]=e[t]:Array.isArray(this.defaultOptions[t])?this.options[t]=Object.assign([],this.defaultOptions[t]):"object"===_typeof(this.defaultOptions[t])&&null!==this.defaultOptions[t]?this.options[t]=Object.assign({},this.defaultOptions[t]):this.options[t]=this.defaultOptions[t]},h.prototype.initializeElement=function(e){return"undefined"!=typeof HTMLElement&&e instanceof HTMLElement?(this.element=e,!0):"string"==typeof e?(this.element=document.querySelector(e),!!this.element||(console.error("Tabulator Creation Error - no element found matching selector: ",e),!1)):(console.error("Tabulator Creation Error - Invalid element provided:",e),!1)},h.prototype.rtlCheck=function(){var e=window.getComputedStyle(this.element);switch(this.options.textDirection){case"auto":if("rtl"!==e.direction)break;case"rtl":this.element.classList.add("tabulator-rtl"),this.rtl=!0;break;case"ltr":this.element.classList.add("tabulator-ltr");default:this.rtl=!1}},h.prototype._mapDepricatedFunctionality=function(){(this.options.persistentLayout||this.options.persistentSort||this.options.persistentFilter)&&(this.options.persistence||(this.options.persistence={})),this.options.dataEdited&&(console.warn("DEPRECATION WARNING - dataEdited option has been deprecated, please use the dataChanged option instead"),this.options.dataChanged=this.options.dataEdited),this.options.downloadDataFormatter&&console.warn("DEPRECATION WARNING - downloadDataFormatter option has been deprecated"),void 0!==this.options.clipboardCopyHeader&&(this.options.columnHeaders=this.options.clipboardCopyHeader,console.warn("DEPRECATION WARNING - clipboardCopyHeader option has been deprecated, please use the columnHeaders property on the clipboardCopyConfig option")),!0!==this.options.printVisibleRows&&(console.warn("printVisibleRows option is deprecated, you should now use the printRowRange option"),this.options.persistence.printRowRange="active"),!0!==this.options.printCopyStyle&&(console.warn("printCopyStyle option is deprecated, you should now use the printStyled option"),this.options.persistence.printStyled=this.options.printCopyStyle),this.options.persistentLayout&&(console.warn("persistentLayout option is deprecated, you should now use the persistence option"),!0!==this.options.persistence&&void 0===this.options.persistence.columns&&(this.options.persistence.columns=!0)),this.options.persistentSort&&(console.warn("persistentSort option is deprecated, you should now use the persistence option"),!0!==this.options.persistence&&void 0===this.options.persistence.sort&&(this.options.persistence.sort=!0)),this.options.persistentFilter&&(console.warn("persistentFilter option is deprecated, you should now use the persistence option"),!0!==this.options.persistence&&void 0===this.options.persistence.filter&&(this.options.persistence.filter=!0)),this.options.columnVertAlign&&(console.warn("columnVertAlign option is deprecated, you should now use the columnHeaderVertAlign option"),this.options.columnHeaderVertAlign=this.options.columnVertAlign)},h.prototype._clearSelection=function(){this.element.classList.add("tabulator-block-select"),window.getSelection?window.getSelection().empty?window.getSelection().empty():window.getSelection().removeAllRanges&&window.getSelection().removeAllRanges():document.selection&&document.selection.empty(),this.element.classList.remove("tabulator-block-select")},h.prototype._create=function(){this._clearObjectPointers(),this._mapDepricatedFunctionality(),this.bindModules(),this.rtlCheck(),"TABLE"===this.element.tagName&&this.modExists("htmlTableImport",!0)&&this.modules.htmlTableImport.parseTable(),this.columnManager=new t(this),this.rowManager=new s(this),this.footerManager=new d(this),this.columnManager.setRowManager(this.rowManager),this.rowManager.setColumnManager(this.columnManager),this.options.virtualDomHoz&&(this.vdomHoz=new a(this)),this._buildElement(),this._loadInitialData()},h.prototype._clearObjectPointers=function(){this.options.columns=this.options.columns.slice(0),this.options.reactiveData||(this.options.data=this.options.data.slice(0))},h.prototype._buildElement=function(){var e=this,t=this.element,o=this.modules,i=this.options;for(i.tableBuilding.call(this),t.classList.add("tabulator"),t.setAttribute("role","grid");t.firstChild;)t.removeChild(t.firstChild);i.height&&(i.height=isNaN(i.height)?i.height:i.height+"px",t.style.height=i.height),!1!==i.minHeight&&(i.minHeight=isNaN(i.minHeight)?i.minHeight:i.minHeight+"px",t.style.minHeight=i.minHeight),!1!==i.maxHeight&&(i.maxHeight=isNaN(i.maxHeight)?i.maxHeight:i.maxHeight+"px",t.style.maxHeight=i.maxHeight),this.columnManager.initialize(),this.rowManager.initialize(),this._detectBrowser(),this.modExists("layout",!0)&&o.layout.initialize(i.layout),o.localize.initialize(),!1!==i.headerFilterPlaceholder&&o.localize.setHeaderFilterPlaceholder(i.headerFilterPlaceholder);for(var n in i.langs)o.localize.installLang(n,i.langs[n]);if(o.localize.setLocale(i.locale),"string"==typeof i.placeholder){var s=document.createElement("div");s.classList.add("tabulator-placeholder");var a=document.createElement("span");a.innerHTML=i.placeholder,s.appendChild(a),i.placeholder=s}if(t.appendChild(this.columnManager.getElement()),t.appendChild(this.rowManager.getElement()),i.footerElement&&this.footerManager.activate(),i.persistence&&this.modExists("persistence",!0)&&o.persistence.initialize(),i.movableRows&&this.modExists("moveRow")&&o.moveRow.initialize(),i.autoColumns&&this.options.data&&this.columnManager.generateColumnsFromRowData(this.options.data),this.modExists("columnCalcs")&&o.columnCalcs.initialize(),this.columnManager.setColumns(i.columns),i.dataTree&&this.modExists("dataTree",!0)&&o.dataTree.initialize(),this.modExists("frozenRows")&&this.modules.frozenRows.initialize(),(i.persistence&&this.modExists("persistence",!0)&&o.persistence.config.sort||i.initialSort)&&this.modExists("sort",!0)){var r=[];i.persistence&&this.modExists("persistence",!0)&&o.persistence.config.sort?!1===(r=o.persistence.load("sort"))&&i.initialSort&&(r=i.initialSort):i.initialSort&&(r=i.initialSort),o.sort.setSort(r)}if((i.persistence&&this.modExists("persistence",!0)&&o.persistence.config.filter||i.initialFilter)&&this.modExists("filter",!0)){var l=[];i.persistence&&this.modExists("persistence",!0)&&o.persistence.config.filter?!1===(l=o.persistence.load("filter"))&&i.initialFilter&&(l=i.initialFilter):i.initialFilter&&(l=i.initialFilter),o.filter.setFilter(l)}i.initialHeaderFilter&&this.modExists("filter",!0)&&i.initialHeaderFilter.forEach(function(t){var i=e.columnManager.findColumn(t.field);if(!i)return console.warn("Column Filter Error - No matching column found:",t.field),!1;o.filter.setHeaderFilterValue(i,t.value)}),this.modExists("ajax")&&o.ajax.initialize(),i.pagination&&this.modExists("page",!0)&&o.page.initialize(),i.groupBy&&this.modExists("groupRows",!0)&&o.groupRows.initialize(),this.modExists("keybindings")&&o.keybindings.initialize(),this.modExists("selectRow")&&o.selectRow.clearSelectionData(!0),i.autoResize&&this.modExists("resizeTable")&&o.resizeTable.initialize(),this.modExists("clipboard")&&o.clipboard.initialize(),i.printAsHtml&&this.modExists("print")&&o.print.initialize(),i.tableBuilt.call(this)},h.prototype._loadInitialData=function(){var e=this;if(e.options.pagination&&e.modExists("page"))if(e.modules.page.reset(!0,!0),"local"==e.options.pagination){if(e.options.data.length)e.rowManager.setData(e.options.data,!1,!0);else{if((e.options.ajaxURL||e.options.ajaxURLGenerator)&&e.modExists("ajax"))return void e.modules.ajax.loadData(!1,!0).then(function(){}).catch(function(){e.options.paginationInitialPage&&e.modules.page.setPage(e.options.paginationInitialPage)});e.rowManager.setData(e.options.data,!1,!0)}e.options.paginationInitialPage&&e.modules.page.setPage(e.options.paginationInitialPage)}else e.options.ajaxURL?e.modules.page.setPage(e.options.paginationInitialPage).then(function(){}).catch(function(){}):e.rowManager.setData([],!1,!0);else e.options.data.length?e.rowManager.setData(e.options.data):(e.options.ajaxURL||e.options.ajaxURLGenerator)&&e.modExists("ajax")?e.modules.ajax.loadData(!1,!0).then(function(){}).catch(function(){}):e.rowManager.setData(e.options.data,!1,!0)},h.prototype.destroy=function(){var e=this.element;for(h.prototype.comms.deregister(this),this.options.reactiveData&&this.modExists("reactiveData",!0)&&this.modules.reactiveData.unwatchData(),this.rowManager.rows.forEach(function(e){e.wipe()}),this.rowManager.rows=[],this.rowManager.activeRows=[],this.rowManager.displayRows=[],this.options.autoResize&&this.modExists("resizeTable")&&this.modules.resizeTable.clearBindings(),this.modExists("keybindings")&&this.modules.keybindings.clearBindings();e.firstChild;)e.removeChild(e.firstChild);e.classList.remove("tabulator")},h.prototype._detectBrowser=function(){var e=navigator.userAgent||navigator.vendor||window.opera;e.indexOf("Trident")>-1?(this.browser="ie",this.browserSlow=!0):e.indexOf("Edge")>-1?(this.browser="edge",this.browserSlow=!0):e.indexOf("Firefox")>-1?(this.browser="firefox",this.browserSlow=!1):(this.browser="other",this.browserSlow=!1),this.browserMobile=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4))},h.prototype.blockRedraw=function(){return this.rowManager.blockRedraw()},h.prototype.restoreRedraw=function(){return this.rowManager.restoreRedraw()},h.prototype.setDataFromLocalFile=function(e){var t=this;return new Promise(function(o,i){var n=document.createElement("input");n.type="file",n.accept=e||".json,application/json",n.addEventListener("change",function(e){var s,a=n.files[0],r=new FileReader;r.readAsText(a),r.onload=function(e){try{s=JSON.parse(r.result)}catch(e){return console.warn("File Load Error - File contents is invalid JSON",e),void i(e)}t.setData(s).then(function(e){o(e)}).catch(function(e){o(e)})},r.onerror=function(e){console.warn("File Load Error - Unable to read file"),i()}}),n.click()})},h.prototype.setData=function(e,t,o){return this.modExists("ajax")&&this.modules.ajax.blockActiveRequest(),this._setData(e,t,o,!1,!0)},h.prototype._setData=function(e,t,o,i,n){var s=this;return"string"!=typeof e?e?s.rowManager.setData(e,i,n):s.modExists("ajax")&&(s.modules.ajax.getUrl||s.options.ajaxURLGenerator)?"remote"==s.options.pagination&&s.modExists("page",!0)?(s.modules.page.reset(!0,!0),s.modules.page.setPage(1)):s.modules.ajax.loadData(i,n):s.rowManager.setData([],i,n):0==e.indexOf("{")||0==e.indexOf("[")?s.rowManager.setData(JSON.parse(e),i,n):s.modExists("ajax",!0)?(t&&s.modules.ajax.setParams(t),o&&s.modules.ajax.setConfig(o),s.modules.ajax.setUrl(e),"remote"==s.options.pagination&&s.modExists("page",!0)?(s.modules.page.reset(!0,!0),s.modules.page.setPage(1)):s.modules.ajax.loadData(i,n)):void 0},h.prototype.clearData=function(){this.modExists("ajax")&&this.modules.ajax.blockActiveRequest(),this.rowManager.clearData()},h.prototype.getData=function(e){return!0===e&&(console.warn("passing a boolean to the getData function is deprecated, you should now pass the string 'active'"),e="active"),this.rowManager.getData(e)},h.prototype.getDataCount=function(e){return!0===e&&(console.warn("passing a boolean to the getDataCount function is deprecated, you should now pass the string 'active'"),e="active"),this.rowManager.getDataCount(e)},h.prototype.searchRows=function(e,t,o){if(this.modExists("filter",!0))return this.modules.filter.search("rows",e,t,o)},h.prototype.searchData=function(e,t,o){if(this.modExists("filter",!0))return this.modules.filter.search("data",e,t,o)},h.prototype.getHtml=function(e,t,o){if(this.modExists("export",!0))return this.modules.export.getHtml(e,t,o)},h.prototype.print=function(e,t,o){if(this.modExists("print",!0))return this.modules.print.printFullscreen(e,t,o)},h.prototype.getAjaxUrl=function(){if(this.modExists("ajax",!0))return this.modules.ajax.getUrl()},h.prototype.replaceData=function(e,t,o){return this.modExists("ajax")&&this.modules.ajax.blockActiveRequest(),this._setData(e,t,o,!0)},h.prototype.updateData=function(e){var t=this,o=this,i=0;return new Promise(function(n,s){t.modExists("ajax")&&t.modules.ajax.blockActiveRequest(),"string"==typeof e&&(e=JSON.parse(e)),e?e.forEach(function(e){var t=o.rowManager.findRow(e[o.options.index]);t&&(i++,t.updateData(e).then(function(){--i||n()}))}):(console.warn("Update Error - No data provided"),s("Update Error - No data provided"))})},h.prototype.addData=function(e,t,o){var i=this;return new Promise(function(n,s){i.modExists("ajax")&&i.modules.ajax.blockActiveRequest(),"string"==typeof e&&(e=JSON.parse(e)),e?i.rowManager.addRows(e,t,o).then(function(e){var t=[];e.forEach(function(e){t.push(e.getComponent())}),n(t)}):(console.warn("Update Error - No data provided"),s("Update Error - No data provided"))})},h.prototype.updateOrAddData=function(e){var t=this,o=this,i=[],n=0;return new Promise(function(s,a){t.modExists("ajax")&&t.modules.ajax.blockActiveRequest(),"string"==typeof e&&(e=JSON.parse(e)),e?e.forEach(function(e){var t=o.rowManager.findRow(e[o.options.index]);n++,t?t.updateData(e).then(function(){n--,i.push(t.getComponent()),n||s(i)}):o.rowManager.addRows(e).then(function(e){n--,i.push(e[0].getComponent()),n||s(i)})}):(console.warn("Update Error - No data provided"),a("Update Error - No data provided"))})},h.prototype.getRow=function(e){var t=this.rowManager.findRow(e);return t?t.getComponent():(console.warn("Find Error - No matching row found:",e),!1)},h.prototype.getRowFromPosition=function(e,t){var o=this.rowManager.getRowFromPosition(e,t);return o?o.getComponent():(console.warn("Find Error - No matching row found:",e),!1)},h.prototype.deleteRow=function(e){var t=this;return new Promise(function(o,i){function n(){++a==e.length&&r&&(s.rowManager.reRenderInPosition(),o())}var s=t,a=0,r=0,l=[];Array.isArray(e)||(e=[e]),e.forEach(function(e){var o=t.rowManager.findRow(e,!0);o?l.push(o):(console.warn("Delete Error - No matching row found:",e),i("Delete Error - No matching row found"),n())}),l.sort(function(e,o){return t.rowManager.rows.indexOf(e)>t.rowManager.rows.indexOf(o)?1:-1}),l.forEach(function(e){e.delete().then(function(){r++,n()}).catch(function(e){n(),i(e)})})})},h.prototype.addRow=function(e,t,o){var i=this;return new Promise(function(n,s){"string"==typeof e&&(e=JSON.parse(e)),i.rowManager.addRows(e,t,o).then(function(e){i.modExists("columnCalcs")&&i.modules.columnCalcs.recalc(i.rowManager.activeRows),n(e[0].getComponent())})})},h.prototype.updateOrAddRow=function(e,t){var o=this;return new Promise(function(i,n){var s=o.rowManager.findRow(e);"string"==typeof t&&(t=JSON.parse(t)),s?s.updateData(t).then(function(){o.modExists("columnCalcs")&&o.modules.columnCalcs.recalc(o.rowManager.activeRows),i(s.getComponent())}).catch(function(e){n(e)}):s=o.rowManager.addRows(t).then(function(e){o.modExists("columnCalcs")&&o.modules.columnCalcs.recalc(o.rowManager.activeRows),i(e[0].getComponent())}).catch(function(e){n(e)})})},h.prototype.updateRow=function(e,t){var o=this;return new Promise(function(i,n){var s=o.rowManager.findRow(e);"string"==typeof t&&(t=JSON.parse(t)),s?s.updateData(t).then(function(){i(s.getComponent())}).catch(function(e){n(e)}):(console.warn("Update Error - No matching row found:",e),n("Update Error - No matching row found"))})},h.prototype.scrollToRow=function(e,t,o){var i=this;return new Promise(function(n,s){var a=i.rowManager.findRow(e);a?i.rowManager.scrollToRow(a,t,o).then(function(){n()}).catch(function(e){s(e)}):(console.warn("Scroll Error - No matching row found:",e),s("Scroll Error - No matching row found"))})},h.prototype.moveRow=function(e,t,o){var i=this.rowManager.findRow(e);i?i.moveToRow(t,o):console.warn("Move Error - No matching row found:",e)},h.prototype.getRows=function(e){return!0===e&&(console.warn("passing a boolean to the getRows function is deprecated, you should now pass the string 'active'"),e="active"),this.rowManager.getComponents(e)},h.prototype.getRowPosition=function(e,t){var o=this.rowManager.findRow(e);return o?this.rowManager.getRowPosition(o,t):(console.warn("Position Error - No matching row found:",e),!1)},h.prototype.copyToClipboard=function(e){this.modExists("clipboard",!0)&&this.modules.clipboard.copy(e)},h.prototype.setColumns=function(e){this.columnManager.setColumns(e)},h.prototype.getColumns=function(e){return this.columnManager.getComponents(e)},h.prototype.getColumn=function(e){var t=this.columnManager.findColumn(e);return t?t.getComponent():(console.warn("Find Error - No matching column found:",e),!1)},h.prototype.getColumnDefinitions=function(){return this.columnManager.getDefinitionTree()},h.prototype.getColumnLayout=function(){if(this.modExists("persistence",!0))return this.modules.persistence.parseColumns(this.columnManager.getColumns())},h.prototype.setColumnLayout=function(e){return!!this.modExists("persistence",!0)&&(this.columnManager.setColumns(this.modules.persistence.mergeDefinition(this.options.columns,e)),!0)},h.prototype.showColumn=function(e){var t=this.columnManager.findColumn(e);if(!t)return console.warn("Column Show Error - No matching column found:",e),!1;t.show(),this.options.responsiveLayout&&this.modExists("responsiveLayout",!0)&&this.modules.responsiveLayout.update()},h.prototype.hideColumn=function(e){var t=this.columnManager.findColumn(e);if(!t)return console.warn("Column Hide Error - No matching column found:",e),!1;t.hide(),this.options.responsiveLayout&&this.modExists("responsiveLayout",!0)&&this.modules.responsiveLayout.update()},h.prototype.toggleColumn=function(e){var t=this.columnManager.findColumn(e);if(!t)return console.warn("Column Visibility Toggle Error - No matching column found:",e),!1;t.visible?t.hide():t.show()},h.prototype.addColumn=function(e,t,o){var i=this;return new Promise(function(n,s){var a=i.columnManager.findColumn(o);i.columnManager.addColumn(e,t,a).then(function(e){n(e.getComponent())}).catch(function(e){s(e)})})},h.prototype.deleteColumn=function(e){var t=this;return new Promise(function(o,i){var n=t.columnManager.findColumn(e);n?n.delete().then(function(){o()}).catch(function(e){i(e)}):(console.warn("Column Delete Error - No matching column found:",e),i())})
	},h.prototype.updateColumnDefinition=function(e,t){var o=this;return new Promise(function(i,n){var s=o.columnManager.findColumn(e);s?s.updateDefinition(t).then(function(e){i(e)}).catch(function(e){n(e)}):(console.warn("Column Update Error - No matching column found:",e),n())})},h.prototype.moveColumn=function(e,t,o){var i=this.columnManager.findColumn(e),n=this.columnManager.findColumn(t);i?n?this.columnManager.moveColumn(i,n,o):console.warn("Move Error - No matching column found:",n):console.warn("Move Error - No matching column found:",e)},h.prototype.scrollToColumn=function(e,t,o){var i=this;return new Promise(function(n,s){var a=i.columnManager.findColumn(e);a?i.columnManager.scrollToColumn(a,t,o).then(function(){n()}).catch(function(e){s(e)}):(console.warn("Scroll Error - No matching column found:",e),s("Scroll Error - No matching column found"))})},h.prototype.setLocale=function(e){this.modules.localize.setLocale(e)},h.prototype.getLocale=function(){return this.modules.localize.getLocale()},h.prototype.getLang=function(e){return this.modules.localize.getLang(e)},h.prototype.redraw=function(e){this.columnManager.redraw(e),this.rowManager.redraw(e)},h.prototype.setHeight=function(e){"classic"!==this.rowManager.renderMode?(this.options.height=isNaN(e)?e:e+"px",this.element.style.height=this.options.height,this.rowManager.setRenderMode(),this.rowManager.redraw()):console.warn("setHeight function is not available in classic render mode")},h.prototype.setSort=function(e,t){this.modExists("sort",!0)&&(this.modules.sort.setSort(e,t),this.rowManager.sorterRefresh())},h.prototype.getSorters=function(){if(this.modExists("sort",!0))return this.modules.sort.getSort()},h.prototype.clearSort=function(){this.modExists("sort",!0)&&(this.modules.sort.clear(),this.rowManager.sorterRefresh())},h.prototype.setFilter=function(e,t,o,i){this.modExists("filter",!0)&&(this.modules.filter.setFilter(e,t,o,i),this.rowManager.filterRefresh())},h.prototype.refreshFilter=function(){this.modExists("filter",!0)&&this.rowManager.filterRefresh()},h.prototype.addFilter=function(e,t,o,i){this.modExists("filter",!0)&&(this.modules.filter.addFilter(e,t,o,i),this.rowManager.filterRefresh())},h.prototype.getFilters=function(e){if(this.modExists("filter",!0))return this.modules.filter.getFilters(e)},h.prototype.setHeaderFilterFocus=function(e){if(this.modExists("filter",!0)){var t=this.columnManager.findColumn(e);if(!t)return console.warn("Column Filter Focus Error - No matching column found:",e),!1;this.modules.filter.setHeaderFilterFocus(t)}},h.prototype.getHeaderFilterValue=function(e){if(this.modExists("filter",!0)){var t=this.columnManager.findColumn(e);if(t)return this.modules.filter.getHeaderFilterValue(t);console.warn("Column Filter Error - No matching column found:",e)}},h.prototype.setHeaderFilterValue=function(e,t){if(this.modExists("filter",!0)){var o=this.columnManager.findColumn(e);if(!o)return console.warn("Column Filter Error - No matching column found:",e),!1;this.modules.filter.setHeaderFilterValue(o,t)}},h.prototype.getHeaderFilters=function(){if(this.modExists("filter",!0))return this.modules.filter.getHeaderFilters()},h.prototype.removeFilter=function(e,t,o){this.modExists("filter",!0)&&(this.modules.filter.removeFilter(e,t,o),this.rowManager.filterRefresh())},h.prototype.clearFilter=function(e){this.modExists("filter",!0)&&(this.modules.filter.clearFilter(e),this.rowManager.filterRefresh())},h.prototype.clearHeaderFilter=function(){this.modExists("filter",!0)&&(this.modules.filter.clearHeaderFilter(),this.rowManager.filterRefresh())},h.prototype.selectRow=function(e){this.modExists("selectRow",!0)&&(!0===e&&(console.warn("passing a boolean to the selectRowselectRow function is deprecated, you should now pass the string 'active'"),e="active"),this.modules.selectRow.selectRows(e))},h.prototype.deselectRow=function(e){this.modExists("selectRow",!0)&&this.modules.selectRow.deselectRows(e)},h.prototype.toggleSelectRow=function(e){this.modExists("selectRow",!0)&&this.modules.selectRow.toggleRow(e)},h.prototype.getSelectedRows=function(){if(this.modExists("selectRow",!0))return this.modules.selectRow.getSelectedRows()},h.prototype.getSelectedData=function(){if(this.modExists("selectRow",!0))return this.modules.selectRow.getSelectedData()},h.prototype.getInvalidCells=function(){if(this.modExists("validate",!0))return this.modules.validate.getInvalidCells()},h.prototype.clearCellValidation=function(e){var t=this;this.modExists("validate",!0)&&(e||(e=this.modules.validate.getInvalidCells()),Array.isArray(e)||(e=[e]),e.forEach(function(e){t.modules.validate.clearValidation(e._getSelf())}))},h.prototype.validate=function(e){var t=[];return this.rowManager.rows.forEach(function(e){var o=e.validate();!0!==o&&(t=t.concat(o))}),!t.length||t},h.prototype.setMaxPage=function(e){if(!this.options.pagination||!this.modExists("page"))return!1;this.modules.page.setMaxPage(e)},h.prototype.setPage=function(e){return this.options.pagination&&this.modExists("page")?this.modules.page.setPage(e):new Promise(function(e,t){t()})},h.prototype.setPageToRow=function(e){var t=this;return new Promise(function(o,i){t.options.pagination&&t.modExists("page")?(e=t.rowManager.findRow(e),e?t.modules.page.setPageToRow(e).then(function(){o()}).catch(function(){i()}):i()):i()})},h.prototype.setPageSize=function(e){if(!this.options.pagination||!this.modExists("page"))return!1;this.modules.page.setPageSize(e),this.modules.page.setPage(1).then(function(){}).catch(function(){})},h.prototype.getPageSize=function(){if(this.options.pagination&&this.modExists("page",!0))return this.modules.page.getPageSize()},h.prototype.previousPage=function(){if(!this.options.pagination||!this.modExists("page"))return!1;this.modules.page.previousPage()},h.prototype.nextPage=function(){if(!this.options.pagination||!this.modExists("page"))return!1;this.modules.page.nextPage()},h.prototype.getPage=function(){return!(!this.options.pagination||!this.modExists("page"))&&this.modules.page.getPage()},h.prototype.getPageMax=function(){return!(!this.options.pagination||!this.modExists("page"))&&this.modules.page.getPageMax()},h.prototype.setGroupBy=function(e){if(!this.modExists("groupRows",!0))return!1;this.options.groupBy=e,this.modules.groupRows.initialize(),this.rowManager.refreshActiveData("display"),this.options.persistence&&this.modExists("persistence",!0)&&this.modules.persistence.config.group&&this.modules.persistence.save("group")},h.prototype.setGroupValues=function(e){if(!this.modExists("groupRows",!0))return!1;this.options.groupValues=e,this.modules.groupRows.initialize(),this.rowManager.refreshActiveData("display"),this.options.persistence&&this.modExists("persistence",!0)&&this.modules.persistence.config.group&&this.modules.persistence.save("group")},h.prototype.setGroupStartOpen=function(e){if(!this.modExists("groupRows",!0))return!1;this.options.groupStartOpen=e,this.modules.groupRows.initialize(),this.options.groupBy?(this.rowManager.refreshActiveData("group"),this.options.persistence&&this.modExists("persistence",!0)&&this.modules.persistence.config.group&&this.modules.persistence.save("group")):console.warn("Grouping Update - cant refresh view, no groups have been set")},h.prototype.setGroupHeader=function(e){if(!this.modExists("groupRows",!0))return!1;this.options.groupHeader=e,this.modules.groupRows.initialize(),this.options.groupBy?(this.rowManager.refreshActiveData("group"),this.options.persistence&&this.modExists("persistence",!0)&&this.modules.persistence.config.group&&this.modules.persistence.save("group")):console.warn("Grouping Update - cant refresh view, no groups have been set")},h.prototype.getGroups=function(e){return!!this.modExists("groupRows",!0)&&this.modules.groupRows.getGroups(!0)},h.prototype.getGroupedData=function(){if(this.modExists("groupRows",!0))return this.options.groupBy?this.modules.groupRows.getGroupedData():this.getData()},h.prototype.getEditedCells=function(){if(this.modExists("edit",!0))return this.modules.edit.getEditedCells()},h.prototype.clearCellEdited=function(e){var t=this;this.modExists("edit",!0)&&(e||(e=this.modules.edit.getEditedCells()),Array.isArray(e)||(e=[e]),e.forEach(function(e){t.modules.edit.clearEdited(e._getSelf())}))},h.prototype.getCalcResults=function(){return!!this.modExists("columnCalcs",!0)&&this.modules.columnCalcs.getResults()},h.prototype.recalc=function(){this.modExists("columnCalcs",!0)&&this.modules.columnCalcs.recalcAll(this.rowManager.activeRows)},h.prototype.navigatePrev=function(){var e=!1;return!(!this.modExists("edit",!0)||!(e=this.modules.edit.currentCell))&&e.nav().prev()},h.prototype.navigateNext=function(){var e=!1;return!(!this.modExists("edit",!0)||!(e=this.modules.edit.currentCell))&&e.nav().next()},h.prototype.navigateLeft=function(){var t=!1;return!(!this.modExists("edit",!0)||!(t=this.modules.edit.currentCell))&&(e.preventDefault(),t.nav().left())},h.prototype.navigateRight=function(){var t=!1;return!(!this.modExists("edit",!0)||!(t=this.modules.edit.currentCell))&&(e.preventDefault(),t.nav().right())},h.prototype.navigateUp=function(){var t=!1;return!(!this.modExists("edit",!0)||!(t=this.modules.edit.currentCell))&&(e.preventDefault(),t.nav().up())},h.prototype.navigateDown=function(){var t=!1;return!(!this.modExists("edit",!0)||!(t=this.modules.edit.currentCell))&&(e.preventDefault(),t.nav().down())},h.prototype.undo=function(){return!(!this.options.history||!this.modExists("history",!0))&&this.modules.history.undo()},h.prototype.redo=function(){return!(!this.options.history||!this.modExists("history",!0))&&this.modules.history.redo()},h.prototype.getHistoryUndoSize=function(){return!(!this.options.history||!this.modExists("history",!0))&&this.modules.history.getHistoryUndoSize()},h.prototype.getHistoryRedoSize=function(){return!(!this.options.history||!this.modExists("history",!0))&&this.modules.history.getHistoryRedoSize()},h.prototype.clearHistory=function(){return!(!this.options.history||!this.modExists("history",!0))&&this.modules.history.clear()},h.prototype.download=function(e,t,o,i){this.modExists("download",!0)&&this.modules.download.download(e,t,o,i)},h.prototype.downloadToTab=function(e,t,o,i){this.modExists("download",!0)&&this.modules.download.download(e,t,o,i,!0)},h.prototype.tableComms=function(e,t,o,i){this.modules.comms.receive(e,t,o,i)},h.prototype.moduleBindings={},h.prototype.extendModule=function(e,t,o){if(h.prototype.moduleBindings[e]){var i=h.prototype.moduleBindings[e].prototype[t];if(i)if("object"==(void 0===o?"undefined":_typeof(o)))for(var n in o)i[n]=o[n];else console.warn("Module Error - Invalid value type, it must be an object");else console.warn("Module Error - property does not exist:",t)}else console.warn("Module Error - module does not exist:",e)},h.prototype.registerModule=function(e,t){h.prototype.moduleBindings[e]=t},h.prototype.bindModules=function(){this.modules={};for(var e in h.prototype.moduleBindings)this.modules[e]=new h.prototype.moduleBindings[e](this)},h.prototype.modExists=function(e,t){return!!this.modules[e]||(t&&console.error("Tabulator Module Not Installed: "+e),!1)},h.prototype.helpers={elVisible:function(e){return!(e.offsetWidth<=0&&e.offsetHeight<=0)},elOffset:function(e){var t=e.getBoundingClientRect();return{top:t.top+window.pageYOffset-document.documentElement.clientTop,left:t.left+window.pageXOffset-document.documentElement.clientLeft}},deepClone:function(e){var t=Object.assign(Array.isArray(e)?[]:{},e);for(var o in e)null!=e[o]&&"object"===_typeof(e[o])&&(e[o]instanceof Date?t[o]=new Date(e[o]):t[o]=this.deepClone(e[o]));return t}},h.prototype.comms={tables:[],register:function(e){h.prototype.comms.tables.push(e)},deregister:function(e){var t=h.prototype.comms.tables.indexOf(e);t>-1&&h.prototype.comms.tables.splice(t,1)},lookupTable:function(e,t){var o,i,n=[];if("string"==typeof e){if(o=document.querySelectorAll(e),o.length)for(var s=0;s<o.length;s++)(i=h.prototype.comms.matchElement(o[s]))&&n.push(i)}else"undefined"!=typeof HTMLElement&&e instanceof HTMLElement||e instanceof h?(i=h.prototype.comms.matchElement(e))&&n.push(i):Array.isArray(e)?e.forEach(function(e){n=n.concat(h.prototype.comms.lookupTable(e))}):t||console.warn("Table Connection Error - Invalid Selector",e);return n},matchElement:function(e){return h.prototype.comms.tables.find(function(t){return e instanceof h?t===e:t.element===e})}},h.prototype.findTable=function(e){var t=h.prototype.comms.lookupTable(e,!0);return!(Array.isArray(t)&&!t.length)&&t};var p=function(e){this.table=e,this.mode=null};p.prototype.initialize=function(e){this.modes[e]?this.mode=e:(console.warn("Layout Error - invalid mode set, defaulting to 'fitData' : "+e),this.mode="fitData"),this.table.element.setAttribute("tabulator-layout",this.mode)},p.prototype.getMode=function(){return this.mode},p.prototype.layout=function(){this.modes[this.mode].call(this,this.table.columnManager.columnsByIndex),0===this.mode.indexOf("fitData")&&this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.columns&&this.table.modules.persistence.save("columns")},p.prototype.modes={fitData:function(e){this.table.options.virtualDomHoz?this.table.vdomHoz.fitDataLayoutOverride():e.forEach(function(e){e.reinitializeWidth()}),this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.update()},fitDataFill:function(e){e.forEach(function(e){e.reinitializeWidth()}),this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.update()},fitDataTable:function(e){e.forEach(function(e){e.reinitializeWidth()}),this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.update()},fitDataStretch:function(e){var t=this,o=0,i=this.table.rowManager.element.clientWidth,n=0,s=!1;e.forEach(function(e,i){e.widthFixed||e.reinitializeWidth(),(t.table.options.responsiveLayout?e.modules.responsive.visible:e.visible)&&(s=e),e.visible&&(o+=e.getWidth())}),s?(n=i-o+s.getWidth(),this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&(s.setWidth(0),this.table.modules.responsiveLayout.update()),n>0?s.setWidth(n):s.reinitializeWidth()):this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.update()},fitColumns:function(e){function t(e){return"string"==typeof e?e.indexOf("%")>-1?n/100*parseInt(e):parseInt(e):e}function o(e,i,n,s){function a(e){return n*(e.column.definition.widthGrow||1)}function l(e){return t(e.width)-n*(e.column.definition.widthShrink||0)}var c=[],u=0,d=0,h=0,p=r,m=0,f=0,g=[];return e.forEach(function(e,t){var o=s?l(e):a(e);e.column.minWidth>=o?c.push(e):e.column.maxWidth&&e.column.maxWidth<o?(e.width=e.column.maxWidth,i-=e.column.maxWidth,(p-=s?e.column.definition.widthShrink||1:e.column.definition.widthGrow||1)&&(n=Math.floor(i/p))):(g.push(e),f+=s?e.column.definition.widthShrink||1:e.column.definition.widthGrow||1)}),c.length?(c.forEach(function(e){u+=s?e.width-e.column.minWidth:e.column.minWidth,e.width=e.column.minWidth}),d=i-u,h=f?Math.floor(d/f):d,m=d-h*f,m+=o(g,d,h,s)):(m=f?i-Math.floor(i/f)*f:i,g.forEach(function(e){e.width=s?l(e):a(e)})),m}var i=this,n=i.table.element.clientWidth,s=0,a=0,r=0,l=0,c=[],u=[],d=0,h=0,p=0;this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.update(),this.table.rowManager.element.scrollHeight>this.table.rowManager.element.clientHeight&&(n-=this.table.rowManager.element.offsetWidth-this.table.rowManager.element.clientWidth),e.forEach(function(e){var o,i,n;e.visible&&(o=e.definition.width,i=parseInt(e.minWidth),o?(n=t(o),s+=n>i?n:i,e.definition.widthShrink&&(u.push({column:e,width:n>i?n:i}),d+=e.definition.widthShrink)):(c.push({column:e,width:0}),r+=e.definition.widthGrow||1))}),a=n-s,l=Math.floor(a/r);var p=o(c,a,l,!1);c.length&&p>0&&(c[c.length-1].width+=+p),c.forEach(function(e){a-=e.width}),h=Math.abs(p)+a,h>0&&d&&(p=o(u,h,Math.floor(h/d),!0)),u.length&&(u[u.length-1].width-=p),c.forEach(function(e){e.column.setWidth(e.width)}),u.forEach(function(e){e.column.setWidth(e.width)})}},h.prototype.registerModule("layout",p);var m=function(e){this.table=e,this.locale="default",this.lang=!1,this.bindings={},this.langList={}};m.prototype.initialize=function(){this.langList=h.prototype.helpers.deepClone(this.langs)},m.prototype.setHeaderFilterPlaceholder=function(e){this.langList.default.headerFilters.default=e},m.prototype.setHeaderFilterColumnPlaceholder=function(e,t){this.langList.default.headerFilters.columns[e]=t,this.lang&&!this.lang.headerFilters.columns[e]&&(this.lang.headerFilters.columns[e]=t)},m.prototype.installLang=function(e,t){this.langList[e]?this._setLangProp(this.langList[e],t):this.langList[e]=t},m.prototype._setLangProp=function(e,t){for(var o in t)e[o]&&"object"==_typeof(e[o])?this._setLangProp(e[o],t[o]):e[o]=t[o]},m.prototype.setLocale=function(e){function t(e,o){for(var i in e)"object"==_typeof(e[i])?(o[i]||(o[i]={}),t(e[i],o[i])):o[i]=e[i]}var o=this;if(e=e||"default",!0===e&&navigator.language&&(e=navigator.language.toLowerCase()),e&&!o.langList[e]){var i=e.split("-")[0];o.langList[i]?(console.warn("Localization Error - Exact matching locale not found, using closest match: ",e,i),e=i):(console.warn("Localization Error - Matching locale not found, using default: ",e),e="default")}o.locale=e,o.lang=h.prototype.helpers.deepClone(o.langList.default||{}),"default"!=e&&t(o.langList[e],o.lang),o.table.options.localized.call(o.table,o.locale,o.lang),o._executeBindings()},m.prototype.getLocale=function(e){return self.locale},m.prototype.getLang=function(e){return e?this.langList[e]:this.lang},m.prototype.getText=function(e,t){var e=t?e+"|"+t:e,o=e.split("|");return this._getLangElement(o,this.locale)||""},m.prototype._getLangElement=function(e,t){var o=this,i=o.lang;return e.forEach(function(e){var t;i&&(t=i[e],i=void 0!==t&&t)}),i},m.prototype.bind=function(e,t){this.bindings[e]||(this.bindings[e]=[]),this.bindings[e].push(t),t(this.getText(e),this.lang)},m.prototype._executeBindings=function(){var e=this;for(var t in e.bindings)!function(t){e.bindings[t].forEach(function(o){o(e.getText(t),e.lang)})}(t)},m.prototype.langs={default:{groups:{item:"item",items:"items"},columns:{},ajax:{loading:"Loading",error:"Error"},pagination:{page_size:"Page Size",page_title:"Show Page",first:"First",first_title:"First Page",last:"Last",last_title:"Last Page",prev:"Prev",prev_title:"Prev Page",next:"Next",next_title:"Next Page",all:"All"},headerFilters:{default:"filter column...",columns:{}}}},h.prototype.registerModule("localize",m);var f=function(e){this.table=e};f.prototype.getConnections=function(e){var t,o=this,i=[];return t=h.prototype.comms.lookupTable(e),t.forEach(function(e){o.table!==e&&i.push(e)}),i},f.prototype.send=function(e,t,o,i){var n=this,s=this.getConnections(e);s.forEach(function(e){e.tableComms(n.table.element,t,o,i)}),!s.length&&e&&console.warn("Table Connection Error - No tables matching selector found",e)},f.prototype.receive=function(e,t,o,i){if(this.table.modExists(t))return this.table.modules[t].commsReceived(e,o,i);console.warn("Inter-table Comms Error - no such module:",t)},h.prototype.registerModule("comms",f);var g=function(e){this.table=e,this.allowedTypes=["","data","download","clipboard","print","htmlOutput"]};g.prototype.initializeColumn=function(e){var t=this,o=!1,i={};this.allowedTypes.forEach(function(n){var s,a="accessor"+(n.charAt(0).toUpperCase()+n.slice(1));e.definition[a]&&(s=t.lookupAccessor(e.definition[a]))&&(o=!0,i[a]={accessor:s,params:e.definition[a+"Params"]||{}})}),o&&(e.modules.accessor=i)},g.prototype.lookupAccessor=function(e){var t=!1;switch(void 0===e?"undefined":_typeof(e)){case"string":this.accessors[e]?t=this.accessors[e]:console.warn("Accessor Error - No such accessor found, ignoring: ",e);break;case"function":t=e}return t},g.prototype.transformRow=function(e,t){var o="accessor"+(t.charAt(0).toUpperCase()+t.slice(1)),i=e.getComponent(),n=h.prototype.helpers.deepClone(e.data||{});return this.table.columnManager.traverse(function(e){var s,a,r,l;e.modules.accessor&&(a=e.modules.accessor[o]||e.modules.accessor.accessor||!1)&&"undefined"!=(s=e.getFieldValue(n))&&(l=e.getComponent(),r="function"==typeof a.params?a.params(s,n,t,l,i):a.params,e.setFieldValue(n,a.accessor(s,n,t,r,l,i)))}),n},g.prototype.accessors={},h.prototype.registerModule("accessor",g);var b=function(e){this.table=e,this.config=!1,this.url="",this.urlGenerator=!1,this.params=!1,this.loaderElement=this.createLoaderElement(),this.msgElement=this.createMsgElement(),this.loadingElement=!1,this.errorElement=!1,this.loaderPromise=!1,this.progressiveLoad=!1,this.loading=!1,this.requestOrder=0};b.prototype.initialize=function(){var e;this.loaderElement.appendChild(this.msgElement),this.table.options.ajaxLoaderLoading&&("string"==typeof this.table.options.ajaxLoaderLoading?(e=document.createElement("template"),e.innerHTML=this.table.options.ajaxLoaderLoading.trim(),this.loadingElement=e.content.firstChild):this.loadingElement=this.table.options.ajaxLoaderLoading),this.loaderPromise=this.table.options.ajaxRequestFunc||this.defaultLoaderPromise,this.urlGenerator=this.table.options.ajaxURLGenerator||this.defaultURLGenerator,this.table.options.ajaxLoaderError&&("string"==typeof this.table.options.ajaxLoaderError?(e=document.createElement("template"),e.innerHTML=this.table.options.ajaxLoaderError.trim(),this.errorElement=e.content.firstChild):this.errorElement=this.table.options.ajaxLoaderError),this.table.options.ajaxParams&&this.setParams(this.table.options.ajaxParams),this.table.options.ajaxConfig&&this.setConfig(this.table.options.ajaxConfig),this.table.options.ajaxURL&&this.setUrl(this.table.options.ajaxURL),this.table.options.ajaxProgressiveLoad&&(this.table.options.pagination?(this.progressiveLoad=!1,console.error("Progressive Load Error - Pagination and progressive load cannot be used at the same time")):this.table.modExists("page")?(this.progressiveLoad=this.table.options.ajaxProgressiveLoad,this.table.modules.page.initializeProgressive(this.progressiveLoad)):console.error("Pagination plugin is required for progressive ajax loading"))},b.prototype.createLoaderElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-loader"),e},b.prototype.createMsgElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-loader-msg"),e.setAttribute("role","alert"),e},b.prototype.setParams=function(e,t){if(t){this.params=this.params||{};for(var o in e)this.params[o]=e[o]}else this.params=e},b.prototype.getParams=function(){return this.params||{}},b.prototype.setConfig=function(e){if(this._loadDefaultConfig(),"string"==typeof e)this.config.method=e;else for(var t in e)this.config[t]=e[t]},b.prototype._loadDefaultConfig=function(e){var t=this;if(!t.config||e){t.config={};for(var o in t.defaultConfig)t.config[o]=t.defaultConfig[o]}},b.prototype.setUrl=function(e){this.url=e},b.prototype.getUrl=function(){return this.url},b.prototype.loadData=function(e,t){return this.progressiveLoad?this._loadDataProgressive():this._loadDataStandard(e,t)},b.prototype.nextPage=function(e){var t;this.loading||(t=this.table.options.ajaxProgressiveLoadScrollMargin||2*this.table.rowManager.getElement().clientHeight,e<t&&this.table.modules.page.nextPage().then(function(){}).catch(function(){}))},b.prototype.blockActiveRequest=function(){this.requestOrder++},b.prototype._loadDataProgressive=function(){return this.table.rowManager.setData([]),this.table.modules.page.setPage(1)},b.prototype._loadDataStandard=function(e,t){var o=this;return new Promise(function(i,n){o.sendRequest(e).then(function(s){o.table.rowManager.setData(s,e,t).then(function(){i()}).catch(function(e){n(e)})}).catch(function(e){n(e)})})},b.prototype.generateParamsList=function(e,t){var o=this,i=[];if(t=t||"",Array.isArray(e))e.forEach(function(e,n){i=i.concat(o.generateParamsList(e,t?t+"["+n+"]":n))});else if("object"===(void 0===e?"undefined":_typeof(e)))for(var n in e)i=i.concat(o.generateParamsList(e[n],t?t+"["+n+"]":n));else i.push({key:t,value:e});return i},b.prototype.serializeParams=function(e){var t=this.generateParamsList(e),o=[];return t.forEach(function(e){o.push(encodeURIComponent(e.key)+"="+encodeURIComponent(e.value))}),o.join("&")},b.prototype.sendRequest=function(e){var t,o=this,i=this,n=i.url;return i.requestOrder++,t=i.requestOrder,i._loadDefaultConfig(),new Promise(function(s,a){!1!==i.table.options.ajaxRequesting.call(o.table,i.url,i.params)?(i.loading=!0,e||i.showLoader(),o.loaderPromise(n,i.config,i.params).then(function(e){t===i.requestOrder?(i.table.options.ajaxResponse&&(e=i.table.options.ajaxResponse.call(i.table,i.url,i.params,e)),s(e),i.hideLoader(),i.loading=!1):console.warn("Ajax Response Blocked - An active ajax request was blocked by an attempt to change table data while the request was being made")}).catch(function(e){console.error("Ajax Load Error: ",e),i.table.options.ajaxError.call(i.table,e),i.showError(),setTimeout(function(){i.hideLoader()},3e3),i.loading=!1,a(e)})):a()})},b.prototype.showLoader=function(){if("function"==typeof this.table.options.ajaxLoader?this.table.options.ajaxLoader():this.table.options.ajaxLoader){for(this.hideLoader();this.msgElement.firstChild;)this.msgElement.removeChild(this.msgElement.firstChild);this.msgElement.classList.remove("tabulator-error"),this.msgElement.classList.add("tabulator-loading"),this.loadingElement?this.msgElement.appendChild(this.loadingElement):this.msgElement.innerHTML=this.table.modules.localize.getText("ajax|loading"),this.table.element.appendChild(this.loaderElement)}},b.prototype.showError=function(){for(this.hideLoader();this.msgElement.firstChild;)this.msgElement.removeChild(this.msgElement.firstChild);this.msgElement.classList.remove("tabulator-loading"),this.msgElement.classList.add("tabulator-error"),this.errorElement?this.msgElement.appendChild(this.errorElement):this.msgElement.innerHTML=this.table.modules.localize.getText("ajax|error"),this.table.element.appendChild(this.loaderElement)},b.prototype.hideLoader=function(){this.loaderElement.parentNode&&this.loaderElement.parentNode.removeChild(this.loaderElement)},b.prototype.defaultConfig={method:"GET"},b.prototype.defaultURLGenerator=function(e,t,o){return e&&o&&Object.keys(o).length&&(t.method&&"get"!=t.method.toLowerCase()||(t.method="get",e+=(e.includes("?")?"&":"?")+this.modules.ajax.serializeParams(o))),e},b.prototype.defaultLoaderPromise=function(e,t,o){var i,n=this;return new Promise(function(s,a){if(e=n.urlGenerator.call(n.table,e,t,o),"GET"!=t.method.toUpperCase())if(i="object"===_typeof(n.table.options.ajaxContentType)?n.table.options.ajaxContentType:n.contentTypeFormatters[n.table.options.ajaxContentType]){for(var r in i.headers)t.headers||(t.headers={}),void 0===t.headers[r]&&(t.headers[r]=i.headers[r]);t.body=i.body.call(n,e,t,o)}else console.warn("Ajax Error - Invalid ajaxContentType value:",n.table.options.ajaxContentType);e?(void 0===t.headers&&(t.headers={}),void 0===t.headers.Accept&&(t.headers.Accept="application/json"),void 0===t.headers["X-Requested-With"]&&(t.headers["X-Requested-With"]="XMLHttpRequest"),void 0===t.mode&&(t.mode="cors"),"cors"==t.mode?(void 0===t.headers["Access-Control-Allow-Origin"]&&(t.headers["Access-Control-Allow-Origin"]=window.location.origin),void 0===t.credentials&&(t.credentials="same-origin")):void 0===t.credentials&&(t.credentials="include"),fetch(e,t).then(function(e){e.ok?e.json().then(function(e){s(e)}).catch(function(e){a(e),console.warn("Ajax Load Error - Invalid JSON returned",e)}):(console.error("Ajax Load Error - Connection Error: "+e.status,e.statusText),a(e))}).catch(function(e){console.error("Ajax Load Error - Connection Error: ",e),a(e)})):(console.warn("Ajax Load Error - No URL Set"),s([]))})},b.prototype.contentTypeFormatters={json:{headers:{"Content-Type":"application/json"},body:function(e,t,o){return JSON.stringify(o)}},form:{headers:{},body:function(e,t,o){var i=this.generateParamsList(o),n=new FormData;return i.forEach(function(e){n.append(e.key,e.value)}),n}}},h.prototype.registerModule("ajax",b);var v=function(e){this._row=e};v.prototype.getData=function(e){return this._row.getData(e)},v.prototype.getElement=function(){return this._row.getElement()},v.prototype.getTable=function(){return this._row.table},v.prototype.getCells=function(){var e=[];return this._row.getCells().forEach(function(t){e.push(t.getComponent())}),e},v.prototype.getCell=function(e){var t=this._row.getCell(e);return!!t&&t.getComponent()},v.prototype._getSelf=function(){return this._row};var y=function(e){this.table=e,this.topCalcs=[],this.botCalcs=[],this.genColumn=!1,this.topElement=this.createElement(),this.botElement=this.createElement(),this.topRow=!1,this.botRow=!1,this.topInitialized=!1,this.botInitialized=!1,this.initialize()};y.prototype.createElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-calcs-holder"),e},y.prototype.initialize=function(){this.genColumn=new n({field:"value"},this)},y.prototype.registerColumnField=function(){},y.prototype.initializeColumn=function(e){var t=e.definition,o={topCalcParams:t.topCalcParams||{},botCalcParams:t.bottomCalcParams||{}};if(t.topCalc){switch(_typeof(t.topCalc)){case"string":this.calculations[t.topCalc]?o.topCalc=this.calculations[t.topCalc]:console.warn("Column Calc Error - No such calculation found, ignoring: ",t.topCalc);break;case"function":o.topCalc=t.topCalc}o.topCalc&&(e.modules.columnCalcs=o,this.topCalcs.push(e),"group"!=this.table.options.columnCalcs&&this.initializeTopRow())}if(t.bottomCalc){switch(_typeof(t.bottomCalc)){case"string":this.calculations[t.bottomCalc]?o.botCalc=this.calculations[t.bottomCalc]:console.warn("Column Calc Error - No such calculation found, ignoring: ",t.bottomCalc);break;case"function":o.botCalc=t.bottomCalc}o.botCalc&&(e.modules.columnCalcs=o,this.botCalcs.push(e),"group"!=this.table.options.columnCalcs&&this.initializeBottomRow())}},y.prototype.removeCalcs=function(){var e=!1;this.topInitialized&&(this.topInitialized=!1,this.topElement.parentNode.removeChild(this.topElement),e=!0),this.botInitialized&&(this.botInitialized=!1,this.table.footerManager.remove(this.botElement),e=!0),e&&this.table.rowManager.adjustTableSize()},y.prototype.initializeTopRow=function(){this.topInitialized||(this.table.columnManager.getElement().insertBefore(this.topElement,this.table.columnManager.headersElement.nextSibling),this.topInitialized=!0)},y.prototype.initializeBottomRow=function(){this.botInitialized||(this.table.footerManager.prepend(this.botElement),this.botInitialized=!0)},y.prototype.scrollHorizontal=function(e){this.botInitialized&&this.botRow&&(this.botRow.getElement().style.marginLeft=-e+"px")},y.prototype.recalc=function(e){var t;if(this.topInitialized||this.botInitialized){if(this.rowsToData(e),this.topInitialized){for(this.topRow&&this.topRow.deleteCells(),t=this.generateRow("top",this.rowsToData(e)),this.topRow=t;this.topElement.firstChild;)this.topElement.removeChild(this.topElement.firstChild);this.topElement.appendChild(t.getElement()),t.initialize(!0)}if(this.botInitialized){for(this.botRow&&this.botRow.deleteCells(),t=this.generateRow("bottom",this.rowsToData(e)),this.botRow=t;this.botElement.firstChild;)this.botElement.removeChild(this.botElement.firstChild);this.botElement.appendChild(t.getElement()),t.initialize(!0)}this.table.rowManager.adjustTableSize(),this.table.modExists("frozenColumns")&&this.table.modules.frozenColumns.layout()}},y.prototype.recalcRowGroup=function(e){this.recalcGroup(this.table.modules.groupRows.getRowGroup(e))},y.prototype.recalcAll=function(){var e=this
	;if((this.topCalcs.length||this.botCalcs.length)&&("group"!==this.table.options.columnCalcs&&this.recalc(this.table.rowManager.activeRows),this.table.options.groupBy&&"table"!==this.table.options.columnCalcs)){table.modules.groupRows.getChildGroups().forEach(function(t){e.recalcGroup(t)})}},y.prototype.recalcGroup=function(e){var t,o;e&&e.calcs&&(e.calcs.bottom&&(t=this.rowsToData(e.rows),o=this.generateRowData("bottom",t),e.calcs.bottom.updateData(o),e.calcs.bottom.reinitialize()),e.calcs.top&&(t=this.rowsToData(e.rows),o=this.generateRowData("top",t),e.calcs.top.updateData(o),e.calcs.top.reinitialize()))},y.prototype.generateTopRow=function(e){return this.generateRow("top",this.rowsToData(e))},y.prototype.generateBottomRow=function(e){return this.generateRow("bottom",this.rowsToData(e))},y.prototype.rowsToData=function(e){var t=this,o=[];return e.forEach(function(e){if(o.push(e.getData()),t.table.options.dataTree&&t.table.options.dataTreeChildColumnCalcs&&e.modules.dataTree.open){var i=t.rowsToData(t.table.modules.dataTree.getFilteredTreeChildren(e));o=o.concat(i)}}),o},y.prototype.generateRow=function(e,t){var o,i=this,n=this.generateRowData(e,t);return i.table.modExists("mutator")&&i.table.modules.mutator.disable(),o=new l(n,this,"calc"),i.table.modExists("mutator")&&i.table.modules.mutator.enable(),o.getElement().classList.add("tabulator-calcs","tabulator-calcs-"+e),o.component=!1,o.getComponent=function(){return this.component||(this.component=new v(this)),this.component},o.generateCells=function(){var t=[];i.table.columnManager.columnsByIndex.forEach(function(n){i.genColumn.setField(n.getField()),i.genColumn.hozAlign=n.hozAlign,n.definition[e+"CalcFormatter"]&&i.table.modExists("format")?i.genColumn.modules.format={formatter:i.table.modules.format.getFormatter(n.definition[e+"CalcFormatter"]),params:n.definition[e+"CalcFormatterParams"]||{}}:i.genColumn.modules.format={formatter:i.table.modules.format.getFormatter("plaintext"),params:{}},i.genColumn.definition.cssClass=n.definition.cssClass;var s=new u(i.genColumn,o);s.getElement(),s.column=n,s.setWidth(),n.cells.push(s),t.push(s),n.visible||s.hide()}),this.cells=t},o},y.prototype.generateRowData=function(e,t){var o,i,n={},s="top"==e?this.topCalcs:this.botCalcs,a="top"==e?"topCalc":"botCalc";return s.forEach(function(e){var s=[];e.modules.columnCalcs&&e.modules.columnCalcs[a]&&(t.forEach(function(t){s.push(e.getFieldValue(t))}),i=a+"Params",o="function"==typeof e.modules.columnCalcs[i]?e.modules.columnCalcs[i](s,t):e.modules.columnCalcs[i],e.setFieldValue(n,e.modules.columnCalcs[a](s,t,o)))}),n},y.prototype.hasTopCalcs=function(){return!!this.topCalcs.length},y.prototype.hasBottomCalcs=function(){return!!this.botCalcs.length},y.prototype.redraw=function(){this.topRow&&this.topRow.normalizeHeight(!0),this.botRow&&this.botRow.normalizeHeight(!0)},y.prototype.getResults=function(){var e,t=this,o={};return this.table.options.groupBy&&this.table.modExists("groupRows")?(e=this.table.modules.groupRows.getGroups(!0),e.forEach(function(e){o[e.getKey()]=t.getGroupResults(e)})):o={top:this.topRow?this.topRow.getData():{},bottom:this.botRow?this.botRow.getData():{}},o},y.prototype.getGroupResults=function(e){var t=this,o=e._getSelf(),i=e.getSubGroups(),n={};return i.forEach(function(e){n[e.getKey()]=t.getGroupResults(e)}),{top:o.calcs.top?o.calcs.top.getData():{},bottom:o.calcs.bottom?o.calcs.bottom.getData():{},groups:n}},y.prototype.calculations={avg:function(e,t,o){var i=0,n=void 0!==o.precision?o.precision:2;return e.length&&(i=e.reduce(function(e,t){return Number(e)+Number(t)}),i/=e.length,i=!1!==n?i.toFixed(n):i),parseFloat(i).toString()},max:function(e,t,o){var i=null,n=void 0!==o.precision&&o.precision;return e.forEach(function(e){((e=Number(e))>i||null===i)&&(i=e)}),null!==i?!1!==n?i.toFixed(n):i:""},min:function(e,t,o){var i=null,n=void 0!==o.precision&&o.precision;return e.forEach(function(e){((e=Number(e))<i||null===i)&&(i=e)}),null!==i?!1!==n?i.toFixed(n):i:""},sum:function(e,t,o){var i=0,n=void 0!==o.precision&&o.precision;return e.length&&e.forEach(function(e){e=Number(e),i+=isNaN(e)?0:Number(e)}),!1!==n?i.toFixed(n):i},concat:function(e,t,o){var i=0;return e.length&&(i=e.reduce(function(e,t){return String(e)+String(t)})),i},count:function(e,t,o){var i=0;return e.length&&e.forEach(function(e){e&&i++}),i}},h.prototype.registerModule("columnCalcs",y);var w=function(e){this.table=e,this.mode=!0,this.pasteParser=function(){},this.pasteAction=function(){},this.customSelection=!1,this.rowRange=!1,this.blocked=!0};w.prototype.initialize=function(){var e=this;this.mode=this.table.options.clipboard,this.rowRange=this.table.options.clipboardCopyRowRange,!0!==this.mode&&"copy"!==this.mode||this.table.element.addEventListener("copy",function(t){var o,i,n;if(!e.blocked){if(t.preventDefault(),e.customSelection)o=e.customSelection,e.table.options.clipboardCopyFormatter&&(o=e.table.options.clipboardCopyFormatter("plain",o));else{var n=e.table.modules.export.generateExportList(e.table.options.clipboardCopyConfig,e.table.options.clipboardCopyStyled,e.rowRange,"clipboard");i=e.table.modules.export.genereateHTMLTable(n),o=i?e.generatePlainContent(n):"",e.table.options.clipboardCopyFormatter&&(o=e.table.options.clipboardCopyFormatter("plain",o),i=e.table.options.clipboardCopyFormatter("html",i))}window.clipboardData&&window.clipboardData.setData?window.clipboardData.setData("Text",o):t.clipboardData&&t.clipboardData.setData?(t.clipboardData.setData("text/plain",o),i&&t.clipboardData.setData("text/html",i)):t.originalEvent&&t.originalEvent.clipboardData.setData&&(t.originalEvent.clipboardData.setData("text/plain",o),i&&t.originalEvent.clipboardData.setData("text/html",i)),e.table.options.clipboardCopied.call(e.table,o,i),e.reset()}}),!0!==this.mode&&"paste"!==this.mode||this.table.element.addEventListener("paste",function(t){e.paste(t)}),this.setPasteParser(this.table.options.clipboardPasteParser),this.setPasteAction(this.table.options.clipboardPasteAction)},w.prototype.reset=function(){this.blocked=!0,this.customSelection=!1},w.prototype.generatePlainContent=function(e){var t=[];return e.forEach(function(e){var o=[];e.columns.forEach(function(t){var i="";if(t)if("group"===e.type&&(t.value=t.component.getKey()),null===t.value)i="";else switch(_typeof(t.value)){case"object":i=JSON.stringify(t.value);break;case"undefined":i="";break;default:i=t.value}o.push(i)}),t.push(o.join("\t"))}),t.join("\n")},w.prototype.copy=function(e,t){var e,o,i;this.blocked=!1,this.customSelection=!1,!0!==this.mode&&"copy"!==this.mode||(this.rowRange=e||this.table.options.clipboardCopyRowRange,void 0!==window.getSelection&&void 0!==document.createRange?(e=document.createRange(),e.selectNodeContents(this.table.element),o=window.getSelection(),o.toString()&&t&&(this.customSelection=o.toString()),o.removeAllRanges(),o.addRange(e)):void 0!==document.selection&&void 0!==document.body.createTextRange&&(i=document.body.createTextRange(),i.moveToElementText(this.table.element),i.select()),document.execCommand("copy"),o&&o.removeAllRanges())},w.prototype.setPasteAction=function(e){switch(void 0===e?"undefined":_typeof(e)){case"string":this.pasteAction=this.pasteActions[e],this.pasteAction||console.warn("Clipboard Error - No such paste action found:",e);break;case"function":this.pasteAction=e}},w.prototype.setPasteParser=function(e){switch(void 0===e?"undefined":_typeof(e)){case"string":this.pasteParser=this.pasteParsers[e],this.pasteParser||console.warn("Clipboard Error - No such paste parser found:",e);break;case"function":this.pasteParser=e}},w.prototype.paste=function(e){var t,o,i;this.checkPaseOrigin(e)&&(t=this.getPasteData(e),o=this.pasteParser.call(this,t),o?(e.preventDefault(),this.table.modExists("mutator")&&(o=this.mutateData(o)),i=this.pasteAction.call(this,o),this.table.options.clipboardPasted.call(this.table,t,o,i)):this.table.options.clipboardPasteError.call(this.table,t))},w.prototype.mutateData=function(e){var t=this,o=[];return Array.isArray(e)?e.forEach(function(e){o.push(t.table.modules.mutator.transformRow(e,"clipboard"))}):o=e,o},w.prototype.checkPaseOrigin=function(e){var t=!0;return("DIV"!=e.target.tagName||this.table.modules.edit.currentCell)&&(t=!1),t},w.prototype.getPasteData=function(e){var t;return window.clipboardData&&window.clipboardData.getData?t=window.clipboardData.getData("Text"):e.clipboardData&&e.clipboardData.getData?t=e.clipboardData.getData("text/plain"):e.originalEvent&&e.originalEvent.clipboardData.getData&&(t=e.originalEvent.clipboardData.getData("text/plain")),t},w.prototype.pasteParsers={table:function(e){var t=[],o=!0,i=this.table.columnManager.columns,n=[],s=[];return e=e.split("\n"),e.forEach(function(e){t.push(e.split("\t"))}),!(!t.length||1===t.length&&t[0].length<2)&&(!0,t[0].forEach(function(e){var t=i.find(function(t){return e&&t.definition.title&&e.trim()&&t.definition.title.trim()===e.trim()});t?n.push(t):o=!1}),o||(o=!0,n=[],t[0].forEach(function(e){var t=i.find(function(t){return e&&t.field&&e.trim()&&t.field.trim()===e.trim()});t?n.push(t):o=!1}),o||(n=this.table.columnManager.columnsByIndex)),o&&t.shift(),t.forEach(function(e){var t={};e.forEach(function(e,o){n[o]&&(t[n[o].field]=e)}),s.push(t)}),s)}},w.prototype.pasteActions={replace:function(e){return this.table.setData(e)},update:function(e){return this.table.updateOrAddData(e)},insert:function(e){return this.table.addData(e)}},h.prototype.registerModule("clipboard",w);var E=function(e){this.table=e,this.indent=10,this.field="",this.collapseEl=null,this.expandEl=null,this.branchEl=null,this.elementField=!1,this.startOpen=function(){},this.displayIndex=0};E.prototype.initialize=function(){var e=null,t=this.table.columnManager.getFirstVisibileColumn(),o=this.table.options;switch(this.field=o.dataTreeChildField,this.indent=o.dataTreeChildIndent,this.elementField=o.dataTreeElementColumn||!!t&&t.field,o.dataTreeBranchElement&&(!0===o.dataTreeBranchElement?(this.branchEl=document.createElement("div"),this.branchEl.classList.add("tabulator-data-tree-branch")):"string"==typeof o.dataTreeBranchElement?(e=document.createElement("div"),e.innerHTML=o.dataTreeBranchElement,this.branchEl=e.firstChild):this.branchEl=o.dataTreeBranchElement),o.dataTreeCollapseElement?"string"==typeof o.dataTreeCollapseElement?(e=document.createElement("div"),e.innerHTML=o.dataTreeCollapseElement,this.collapseEl=e.firstChild):this.collapseEl=o.dataTreeCollapseElement:(this.collapseEl=document.createElement("div"),this.collapseEl.classList.add("tabulator-data-tree-control"),this.collapseEl.tabIndex=0,this.collapseEl.innerHTML="<div class='tabulator-data-tree-control-collapse'></div>"),o.dataTreeExpandElement?"string"==typeof o.dataTreeExpandElement?(e=document.createElement("div"),e.innerHTML=o.dataTreeExpandElement,this.expandEl=e.firstChild):this.expandEl=o.dataTreeExpandElement:(this.expandEl=document.createElement("div"),this.expandEl.classList.add("tabulator-data-tree-control"),this.expandEl.tabIndex=0,this.expandEl.innerHTML="<div class='tabulator-data-tree-control-expand'></div>"),_typeof(o.dataTreeStartExpanded)){case"boolean":this.startOpen=function(e,t){return o.dataTreeStartExpanded};break;case"function":this.startOpen=o.dataTreeStartExpanded;break;default:this.startOpen=function(e,t){return o.dataTreeStartExpanded[t]}}},E.prototype.initializeRow=function(e){var t=e.getData()[this.field],o=Array.isArray(t),i=o||!o&&"object"===(void 0===t?"undefined":_typeof(t))&&null!==t;!i&&e.modules.dataTree&&e.modules.dataTree.branchEl&&e.modules.dataTree.branchEl.parentNode.removeChild(e.modules.dataTree.branchEl),!i&&e.modules.dataTree&&e.modules.dataTree.controlEl&&e.modules.dataTree.controlEl.parentNode.removeChild(e.modules.dataTree.controlEl),e.modules.dataTree={index:e.modules.dataTree?e.modules.dataTree.index:0,open:!!i&&(e.modules.dataTree?e.modules.dataTree.open:this.startOpen(e.getComponent(),0)),controlEl:!(!e.modules.dataTree||!i)&&e.modules.dataTree.controlEl,branchEl:!(!e.modules.dataTree||!i)&&e.modules.dataTree.branchEl,parent:!!e.modules.dataTree&&e.modules.dataTree.parent,children:i}},E.prototype.layoutRow=function(e){var t=this.elementField?e.getCell(this.elementField):e.getCells()[0],o=t.getElement(),i=e.modules.dataTree;i.branchEl&&(i.branchEl.parentNode&&i.branchEl.parentNode.removeChild(i.branchEl),i.branchEl=!1),i.controlEl&&(i.controlEl.parentNode&&i.controlEl.parentNode.removeChild(i.controlEl),i.controlEl=!1),this.generateControlElement(e,o),e.getElement().classList.add("tabulator-tree-level-"+i.index),i.index&&(this.branchEl?(i.branchEl=this.branchEl.cloneNode(!0),o.insertBefore(i.branchEl,o.firstChild),this.table.rtl?i.branchEl.style.marginRight=(i.branchEl.offsetWidth+i.branchEl.style.marginLeft)*(i.index-1)+i.index*this.indent+"px":i.branchEl.style.marginLeft=(i.branchEl.offsetWidth+i.branchEl.style.marginRight)*(i.index-1)+i.index*this.indent+"px"):this.table.rtl?o.style.paddingRight=parseInt(window.getComputedStyle(o,null).getPropertyValue("padding-right"))+i.index*this.indent+"px":o.style.paddingLeft=parseInt(window.getComputedStyle(o,null).getPropertyValue("padding-left"))+i.index*this.indent+"px")},E.prototype.generateControlElement=function(e,t){var o=this,i=e.modules.dataTree,t=t||e.getCells()[0].getElement(),n=i.controlEl;!1!==i.children&&(i.open?(i.controlEl=this.collapseEl.cloneNode(!0),i.controlEl.addEventListener("click",function(t){t.stopPropagation(),o.collapseRow(e)})):(i.controlEl=this.expandEl.cloneNode(!0),i.controlEl.addEventListener("click",function(t){t.stopPropagation(),o.expandRow(e)})),i.controlEl.addEventListener("mousedown",function(e){e.stopPropagation()}),n&&n.parentNode===t?n.parentNode.replaceChild(i.controlEl,n):t.insertBefore(i.controlEl,t.firstChild))},E.prototype.setDisplayIndex=function(e){this.displayIndex=e},E.prototype.getDisplayIndex=function(){return this.displayIndex},E.prototype.getRows=function(e){var t=this,o=[];return e.forEach(function(e,i){var n,s;o.push(e),e instanceof l&&(e.create(),n=e.modules.dataTree.children,n.index||!1===n.children||(s=t.getChildren(e),s.forEach(function(e){e.create(),o.push(e)})))}),o},E.prototype.getChildren=function(e,t){var o=this,i=e.modules.dataTree,n=[],s=[];return!1!==i.children&&(i.open||t)&&(Array.isArray(i.children)||(i.children=this.generateChildren(e)),n=this.table.modExists("filter")&&this.table.options.dataTreeFilter?this.table.modules.filter.filter(i.children):i.children,this.table.modExists("sort")&&this.table.options.dataTreeSort&&this.table.modules.sort.sort(n),n.forEach(function(e){s.push(e),o.getChildren(e).forEach(function(e){s.push(e)})})),s},E.prototype.generateChildren=function(e){var t=this,o=[],i=e.getData()[this.field];return Array.isArray(i)||(i=[i]),i.forEach(function(i){var n=new l(i||{},t.table.rowManager);n.create(),n.modules.dataTree.index=e.modules.dataTree.index+1,n.modules.dataTree.parent=e,n.modules.dataTree.children&&(n.modules.dataTree.open=t.startOpen(n.getComponent(),n.modules.dataTree.index)),o.push(n)}),o},E.prototype.expandRow=function(e,t){var o=e.modules.dataTree;!1!==o.children&&(o.open=!0,e.reinitialize(),this.table.rowManager.refreshActiveData("tree",!1,!0),this.table.options.dataTreeRowExpanded(e.getComponent(),e.modules.dataTree.index))},E.prototype.collapseRow=function(e){var t=e.modules.dataTree;!1!==t.children&&(t.open=!1,e.reinitialize(),this.table.rowManager.refreshActiveData("tree",!1,!0),this.table.options.dataTreeRowCollapsed(e.getComponent(),e.modules.dataTree.index))},E.prototype.toggleRow=function(e){var t=e.modules.dataTree;!1!==t.children&&(t.open?this.collapseRow(e):this.expandRow(e))},E.prototype.getTreeParent=function(e){return!!e.modules.dataTree.parent&&e.modules.dataTree.parent.getComponent()},E.prototype.getFilteredTreeChildren=function(e){var t,o=e.modules.dataTree,i=[];return o.children&&(Array.isArray(o.children)||(o.children=this.generateChildren(e)),t=this.table.modExists("filter")&&this.table.options.dataTreeFilter?this.table.modules.filter.filter(o.children):o.children,t.forEach(function(e){e instanceof l&&i.push(e)})),i},E.prototype.rowDelete=function(e){var t,o=e.modules.dataTree.parent;o&&(t=this.findChildIndex(e,o),!1!==t&&o.data[this.field].splice(t,1),o.data[this.field].length||delete o.data[this.field],this.initializeRow(o),this.layoutRow(o)),this.table.rowManager.refreshActiveData("tree",!1,!0)},E.prototype.addTreeChildRow=function(e,t,o,i){var n=!1;"string"==typeof t&&(t=JSON.parse(t)),Array.isArray(e.data[this.field])||(e.data[this.field]=[],e.modules.dataTree.open=this.startOpen(e.getComponent(),e.modules.dataTree.index)),void 0!==i&&!1!==(n=this.findChildIndex(i,e))&&e.data[this.field].splice(o?n:n+1,0,t),!1===n&&(o?e.data[this.field].unshift(t):e.data[this.field].push(t)),this.initializeRow(e),this.layoutRow(e),this.table.rowManager.refreshActiveData("tree",!1,!0)},E.prototype.findChildIndex=function(e,t){var o=this,i=!1;return"object"==(void 0===e?"undefined":_typeof(e))?e instanceof l?i=e.data:e instanceof r?i=e._getSelf().data:"undefined"!=typeof HTMLElement&&e instanceof HTMLElement&&t.modules.dataTree&&(i=t.modules.dataTree.children.find(function(t){return t instanceof l&&t.element===e}))&&(i=i.data):i=void 0!==e&&null!==e&&t.data[this.field].find(function(t){return t.data[o.table.options.index]==e}),i&&(Array.isArray(t.data[this.field])&&(i=t.data[this.field].indexOf(i)),-1==i&&(i=!1)),i},E.prototype.getTreeChildren=function(e,t,o){var i=this,n=e.modules.dataTree,s=[];return n.children&&(Array.isArray(n.children)||(n.children=this.generateChildren(e)),n.children.forEach(function(e){e instanceof l&&(s.push(t?e.getComponent():e),o&&(s=s.concat(i.getTreeChildren(e,t,o))))})),s},E.prototype.checkForRestyle=function(e){e.row.cells.indexOf(e)||e.row.reinitialize()},E.prototype.getChildField=function(){return this.field},E.prototype.redrawNeeded=function(e){return!!this.field&&void 0!==e[this.field]||!!this.elementField&&void 0!==e[this.elementField]},h.prototype.registerModule("dataTree",E);var C=function(e){this.table=e};C.prototype.download=function(e,t,o,i,n){function s(o,i){n?!0===n?a.triggerDownload(o,i,e,t,!0):n(o):a.triggerDownload(o,i,e,t)}var a=this,r=!1;if("function"==typeof e?r=e:a.downloaders[e]?r=a.downloaders[e]:console.warn("Download Error - No such download type found: ",e),r){var l=this.generateExportList(i);r.call(this.table,l,o||{},s)}},C.prototype.generateExportList=function(e){var t=this.table.modules.export.generateExportList(this.table.options.downloadConfig,!1,e||this.table.options.downloadRowRange,"download"),o=this.table.options.groupHeaderDownload;return o&&!Array.isArray(o)&&(o=[o]),t.forEach(function(e){var t;"group"===e.type&&(t=e.columns[0],o&&o[e.indent]&&(t.value=o[e.indent](t.value,e.component._group.getRowCount(),e.component._group.getData(),e.component)))}),t},C.prototype.triggerDownload=function(e,t,o,i,n){var s=document.createElement("a"),a=new Blob([e],{type:t}),i=i||"Tabulator."+("function"==typeof o?"txt":o);(a=this.table.options.downloadReady.call(this.table,e,a))&&(n?window.open(window.URL.createObjectURL(a)):navigator.msSaveOrOpenBlob?navigator.msSaveOrOpenBlob(a,i):(s.setAttribute("href",window.URL.createObjectURL(a)),s.setAttribute("download",i),s.style.display="none",document.body.appendChild(s),s.click(),document.body.removeChild(s)),this.table.options.downloadComplete&&this.table.options.downloadComplete())},C.prototype.commsReceived=function(e,t,o){switch(t){case"intercept":this.download(o.type,"",o.options,o.active,o.intercept)}},C.prototype.downloaders={csv:function(e,t,o){var i=t&&t.delimiter?t.delimiter:",",n=[],s=[];e.forEach(function(e){var t=[];switch(e.type){case"group":console.warn("Download Warning - CSV downloader cannot process row groups");break;case"calc":console.warn("Download Warning - CSV downloader cannot process column calculations");break;case"header":e.columns.forEach(function(e,t){e&&1===e.depth&&(s[t]=void 0===e.value||null===e.value?"":'"'+String(e.value).split('"').join('""')+'"')});break;case"row":e.columns.forEach(function(e){if(e){switch(_typeof(e.value)){case"object":e.value=JSON.stringify(e.value);break;case"undefined":case"null":e.value=""}t.push('"'+String(e.value).split('"').join('""')+'"')}}),n.push(t.join(i))}}),s.length&&n.unshift(s.join(i)),n=n.join("\n"),t.bom&&(n="\ufeff"+n),o(n,"text/csv")},json:function(e,t,o){var i=[];e.forEach(function(e){var t={};switch(e.type){case"header":break;case"group":console.warn("Download Warning - JSON downloader cannot process row groups");break;case"calc":console.warn("Download Warning - JSON downloader cannot process column calculations");break;case"row":e.columns.forEach(function(e){e&&(t[e.component.getField()]=e.value)}),i.push(t)}}),i=JSON.stringify(i,null,"\t"),o(i,"application/json")},pdf:function(e,t,o){function i(e,t){var o=[];return e.columns.forEach(function(e){var i;if(e){switch(_typeof(e.value)){case"object":e.value=JSON.stringify(e.value);break;case"undefined":case"null":e.value=""}i={content:e.value,colSpan:e.width,rowSpan:e.height},t&&(i.styles=t),o.push(i)}else o.push("")}),o}var n=[],s=[],a={},r=t.rowGroupStyles||{fontStyle:"bold",fontSize:12,cellPadding:6,fillColor:220},l=t.rowCalcStyles||{fontStyle:"bold",fontSize:10,cellPadding:4,fillColor:232},c=t.jsPDF||{},u=t&&t.title?t.title:"";c.orientation||(c.orientation=t.orientation||"landscape"),c.unit||(c.unit="pt"),e.forEach(function(e){switch(e.type){case"header":n.push(i(e));break;case"group":s.push(i(e,r));break;case"calc":s.push(i(e,l));break;case"row":s.push(i(e))}});var d=new jsPDF(c);t&&t.autoTable&&(a="function"==typeof t.autoTable?t.autoTable(d)||{}:t.autoTable),u&&(a.addPageContent=function(e){d.text(u,40,30)}),a.head=n,a.body=s,d.autoTable(a),t&&t.documentProcessing&&t.documentProcessing(d),o(d.output("arraybuffer"),"application/pdf")},xlsx:function(e,t,o){function i(){var t=[],o=[],i={},n={s:{c:0,r:0},e:{c:e[0]?e[0].columns.reduce(function(e,t){return e+(t&&t.width?t.width:1)},0):0,r:e.length}};return e.forEach(function(e,i){var n=[];e.columns.forEach(function(e,t){e?(n.push(e.value instanceof Date||"object"!==_typeof(e.value)?e.value:JSON.stringify(e.value)),(e.width>1||e.height>-1)&&o.push({s:{r:i,c:t},e:{r:i+e.height-1,c:t+e.width-1}})):n.push("")}),t.push(n)}),XLSX.utils.sheet_add_aoa(i,t),i["!ref"]=XLSX.utils.encode_range(n),o.length&&(i["!merges"]=o),i}var n,s=this,a=t.sheetName||"Sheet1",r=XLSX.utils.book_new();if(r.SheetNames=[],r.Sheets={},t.sheetOnly)return void o(i());if(t.sheets)for(var l in t.sheets)!0===t.sheets[l]?(r.SheetNames.push(l),r.Sheets[l]=i()):(r.SheetNames.push(l),this.modules.comms.send(t.sheets[l],"download","intercept",{type:"xlsx",options:{sheetOnly:!0},active:s.active,intercept:function(e){r.Sheets[l]=e}}));else r.SheetNames.push(a),r.Sheets[a]=i();t.documentProcessing&&(r=t.documentProcessing(r)),n=XLSX.write(r,{bookType:"xlsx",bookSST:!0,type:"binary"}),o(function(e){for(var t=new ArrayBuffer(e.length),o=new Uint8Array(t),i=0;i!=e.length;++i)o[i]=255&e.charCodeAt(i);return t}(n),"application/octet-stream")},html:function(e,t,o){this.modExists("export",!0)&&o(this.modules.export.genereateHTMLTable(e),"text/html")}},h.prototype.registerModule("download",C);var x=function(e){this.table=e,this.currentCell=!1,this.mouseClick=!1,this.recursionBlock=!1,this.invalidEdit=!1,this.editedCells=[]};x.prototype.initializeColumn=function(e){var t=this,o={editor:!1,blocked:!1,check:e.definition.editable,params:e.definition.editorParams||{}};switch(_typeof(e.definition.editor)){case"string":"tick"===e.definition.editor&&(e.definition.editor="tickCross",console.warn("DEPRECATION WARNING - the tick editor has been deprecated, please use the tickCross editor")),t.editors[e.definition.editor]?o.editor=t.editors[e.definition.editor]:console.warn("Editor Error - No such editor found: ",e.definition.editor);break;case"function":o.editor=e.definition.editor;break;case"boolean":!0===e.definition.editor&&("function"!=typeof e.definition.formatter?("tick"===e.definition.formatter&&(e.definition.formatter="tickCross",console.warn("DEPRECATION WARNING - the tick editor has been deprecated, please use the tickCross editor")),t.editors[e.definition.formatter]?o.editor=t.editors[e.definition.formatter]:o.editor=t.editors.input):console.warn("Editor Error - Cannot auto lookup editor for a custom formatter: ",e.definition.formatter))}o.editor&&(e.modules.edit=o)},x.prototype.getCurrentCell=function(){return!!this.currentCell&&this.currentCell.getComponent()},x.prototype.clearEditor=function(e){var t,o=this.currentCell;if(this.invalidEdit=!1,o){for(this.currentCell=!1,t=o.getElement(),e?o.validate():t.classList.remove("tabulator-validation-fail"),t.classList.remove("tabulator-editing");t.firstChild;)t.removeChild(t.firstChild);o.row.getElement().classList.remove("tabulator-row-editing")}},x.prototype.cancelEdit=function(){if(this.currentCell){var e=this.currentCell,t=this.currentCell.getComponent();this.clearEditor(!0),e.setValueActual(e.getValue()),e.cellRendered(),("textarea"==e.column.definition.editor||e.column.definition.variableHeight)&&e.row.normalizeHeight(!0),e.column.cellEvents.cellEditCancelled&&e.column.cellEvents.cellEditCancelled.call(this.table,t),this.table.options.cellEditCancelled.call(this.table,t)}},x.prototype.bindEditor=function(e){var t=this,o=e.getElement(!0);o.setAttribute("tabindex",0),o.addEventListener("click",function(e){o.classList.contains("tabulator-editing")||o.focus({preventScroll:!0})}),o.addEventListener("mousedown",function(e){2===e.button?e.preventDefault():t.mouseClick=!0}),o.addEventListener("focus",function(o){t.recursionBlock||t.edit(e,o,!1)})},x.prototype.focusCellNoEvent=function(e,t){this.recursionBlock=!0,t&&"ie"===this.table.browser||e.getElement().focus({preventScroll:!0}),this.recursionBlock=!1},x.prototype.editCell=function(e,t){this.focusCellNoEvent(e),this.edit(e,!1,t)},x.prototype.focusScrollAdjust=function(e){if("virtual"==this.table.rowManager.getRenderMode()){var t=this.table.rowManager.element.scrollTop,o=this.table.rowManager.element.clientHeight+this.table.rowManager.element.scrollTop,i=e.row.getElement();i.offsetTop;i.offsetTop<t?this.table.rowManager.element.scrollTop-=t-i.offsetTop:i.offsetTop+i.offsetHeight>o&&(this.table.rowManager.element.scrollTop+=i.offsetTop+i.offsetHeight-o);var n=this.table.rowManager.element.scrollLeft,s=this.table.rowManager.element.clientWidth+this.table.rowManager.element.scrollLeft,a=e.getElement();a.offsetLeft;this.table.modExists("frozenColumns")&&(n+=parseInt(this.table.modules.frozenColumns.leftMargin),s-=parseInt(this.table.modules.frozenColumns.rightMargin)),this.table.options.virtualDomHoz&&(n-=parseInt(this.table.vdomHoz.vDomPadLeft),s-=parseInt(this.table.vdomHoz.vDomPadLeft)),a.offsetLeft<n?this.table.rowManager.element.scrollLeft-=n-a.offsetLeft:a.offsetLeft+a.offsetWidth>s&&(this.table.rowManager.element.scrollLeft+=a.offsetLeft+a.offsetWidth-s)}},x.prototype.edit=function(e,t,o){function i(t){if(c.currentCell===e){var o=!0;return e.column.modules.validate&&c.table.modExists("validate")&&"manual"!=c.table.options.validationMode&&(o=c.table.modules.validate.validate(e.column.modules.validate,e,t)),!0===o||"highlight"===c.table.options.validationMode?(c.clearEditor(),e.modules.edit||(e.modules.edit={}),e.modules.edit.edited=!0,-1==c.editedCells.indexOf(e)&&c.editedCells.push(e),e.setValue(t,!0),c.table.options.dataTree&&c.table.modExists("dataTree")&&c.table.modules.dataTree.checkForRestyle(e),!0===o||(h.classList.add("tabulator-validation-fail"),c.table.options.validationFailed.call(c.table,e.getComponent(),t,o),!1)):(c.invalidEdit=!0,h.classList.add("tabulator-validation-fail"),c.focusCellNoEvent(e,!0),d(),c.table.options.validationFailed.call(c.table,e.getComponent(),t,o),!1)}}function n(){c.currentCell===e&&(c.cancelEdit(),c.table.options.dataTree&&c.table.modExists("dataTree")&&c.table.modules.dataTree.checkForRestyle(e))}function s(e){d=e}var a,r,l,c=this,u=!0,d=function(){},h=e.getElement();if(this.currentCell)return void(this.invalidEdit||this.cancelEdit());if(e.column.modules.edit.blocked)return this.mouseClick=!1,h.blur(),!1;switch(t&&t.stopPropagation(),_typeof(e.column.modules.edit.check)){case"function":u=e.column.modules.edit.check(e.getComponent());break;case"boolean":u=e.column.modules.edit.check}if(u||o){if(c.cancelEdit(),c.currentCell=e,this.focusScrollAdjust(e),r=e.getComponent(),this.mouseClick&&(this.mouseClick=!1,e.column.cellEvents.cellClick&&e.column.cellEvents.cellClick.call(this.table,t,r)),e.column.cellEvents.cellEditing&&e.column.cellEvents.cellEditing.call(this.table,r),c.table.options.cellEditing.call(this.table,r),l="function"==typeof e.column.modules.edit.params?e.column.modules.edit.params(r):e.column.modules.edit.params,!1===(a=e.column.modules.edit.editor.call(c,r,s,i,n,l)))return h.blur(),!1;if(!(a instanceof Node))return console.warn("Edit Error - Editor should return an instance of Node, the editor returned:",a),h.blur(),!1;for(h.classList.add("tabulator-editing"),e.row.getElement().classList.add("tabulator-row-editing");h.firstChild;)h.removeChild(h.firstChild);h.appendChild(a),d();for(var p=h.children,m=0;m<p.length;m++)p[m].addEventListener("click",function(e){e.stopPropagation()});return!0}return this.mouseClick=!1,h.blur(),!1},x.prototype.maskInput=function(e,t){function o(t){var r=i[t];void 0!==r&&r!==a&&r!==n&&r!==s&&(e.value=e.value+""+r,o(t+1))}var i=t.mask,n=void 0!==t.maskLetterChar?t.maskLetterChar:"A",s=void 0!==t.maskNumberChar?t.maskNumberChar:"9",a=void 0!==t.maskWildcardChar?t.maskWildcardChar:"*",r=!1;e.addEventListener("keydown",function(t){var o=e.value.length,l=t.key;if(t.keyCode>46){if(o>=i.length)return t.preventDefault(),t.stopPropagation(),r=!1,!1;switch(i[o]){case n:if(l.toUpperCase()==l.toLowerCase())return t.preventDefault(),t.stopPropagation(),r=!1,!1;break;case s:if(isNaN(l))return t.preventDefault(),t.stopPropagation(),r=!1,!1;break;case a:break;default:if(l!==i[o])return t.preventDefault(),t.stopPropagation(),r=!1,!1}r=!0}}),e.addEventListener("keyup",function(i){i.keyCode>46&&t.maskAutoFill&&o(e.value.length)}),e.placeholder||(e.placeholder=i),t.maskAutoFill&&o(e.value.length)},x.prototype.getEditedCells=function(){var e=[];return this.editedCells.forEach(function(t){e.push(t.getComponent())}),e},x.prototype.clearEdited=function(e){var t;e.modules.edit&&e.modules.edit.edited&&(e.modules.edit.edited=!1,e.modules.validate&&(e.modules.validate.invalid=!1)),(t=this.editedCells.indexOf(e))>-1&&this.editedCells.splice(t,1)},x.prototype.editors={input:function(e,t,o,i,n){function s(e){(null===a||void 0===a)&&""!==r.value||r.value!==a?o(r.value)&&(a=r.value):i()}var a=e.getValue(),r=document.createElement("input");if(r.setAttribute("type",n.search?"search":"text"),r.style.padding="4px",r.style.width="100%",r.style.boxSizing="border-box",n.elementAttributes&&"object"==_typeof(n.elementAttributes))for(var l in n.elementAttributes)"+"==l.charAt(0)?(l=l.slice(1),r.setAttribute(l,r.getAttribute(l)+n.elementAttributes["+"+l])):r.setAttribute(l,n.elementAttributes[l]);return r.value=void 0!==a?a:"",t(function(){r.focus({preventScroll:!0}),r.style.height="100%"}),r.addEventListener("change",s),r.addEventListener("blur",s),r.addEventListener("keydown",function(e){switch(e.keyCode){case 13:s(e);break;case 27:i();break;case 35:case 36:e.stopPropagation()}}),n.mask&&this.table.modules.edit.maskInput(r,n),r},textarea:function(e,t,o,i,n){function s(t){(null===a||void 0===a)&&""!==c.value||c.value!==a?(o(c.value)&&(a=c.value),setTimeout(function(){e.getRow().normalizeHeight()},300)):i()}var a=e.getValue(),r=n.verticalNavigation||"hybrid",l=String(null!==a&&void 0!==a?a:""),c=(l.match(/(?:\r\n|\r|\n)/g),document.createElement("textarea")),u=0;if(c.style.display="block",c.style.padding="2px",c.style.height="100%",c.style.width="100%",c.style.boxSizing="border-box",c.style.whiteSpace="pre-wrap",c.style.resize="none",
	n.elementAttributes&&"object"==_typeof(n.elementAttributes))for(var d in n.elementAttributes)"+"==d.charAt(0)?(d=d.slice(1),c.setAttribute(d,c.getAttribute(d)+n.elementAttributes["+"+d])):c.setAttribute(d,n.elementAttributes[d]);return c.value=l,t(function(){c.focus({preventScroll:!0}),c.style.height="100%",c.scrollHeight,c.style.height=c.scrollHeight+"px",e.getRow().normalizeHeight()}),c.addEventListener("change",s),c.addEventListener("blur",s),c.addEventListener("keyup",function(){c.style.height="";var t=c.scrollHeight;c.style.height=t+"px",t!=u&&(u=t,e.getRow().normalizeHeight())}),c.addEventListener("keydown",function(e){switch(e.keyCode){case 27:i();break;case 38:("editor"==r||"hybrid"==r&&c.selectionStart)&&(e.stopImmediatePropagation(),e.stopPropagation());break;case 40:("editor"==r||"hybrid"==r&&c.selectionStart!==c.value.length)&&(e.stopImmediatePropagation(),e.stopPropagation());break;case 35:case 36:e.stopPropagation()}}),n.mask&&this.table.modules.edit.maskInput(c,n),c},number:function(e,t,o,i,n){function s(){var e=l.value;isNaN(e)||""===e||(e=Number(e)),e!==a?o(e)&&(a=e):i()}var a=e.getValue(),r=n.verticalNavigation||"editor",l=document.createElement("input");if(l.setAttribute("type","number"),void 0!==n.max&&l.setAttribute("max",n.max),void 0!==n.min&&l.setAttribute("min",n.min),void 0!==n.step&&l.setAttribute("step",n.step),l.style.padding="4px",l.style.width="100%",l.style.boxSizing="border-box",n.elementAttributes&&"object"==_typeof(n.elementAttributes))for(var c in n.elementAttributes)"+"==c.charAt(0)?(c=c.slice(1),l.setAttribute(c,l.getAttribute(c)+n.elementAttributes["+"+c])):l.setAttribute(c,n.elementAttributes[c]);l.value=a;var u=function(e){s()};return t(function(){l.removeEventListener("blur",u),l.focus({preventScroll:!0}),l.style.height="100%",l.addEventListener("blur",u)}),l.addEventListener("keydown",function(e){switch(e.keyCode){case 13:s();break;case 27:i();break;case 38:case 40:"editor"==r&&(e.stopImmediatePropagation(),e.stopPropagation());break;case 35:case 36:e.stopPropagation()}}),n.mask&&this.table.modules.edit.maskInput(l,n),l},range:function(e,t,o,i,n){function s(){var e=r.value;isNaN(e)||""===e||(e=Number(e)),e!=a?o(e)&&(a=e):i()}var a=e.getValue(),r=document.createElement("input");if(r.setAttribute("type","range"),void 0!==n.max&&r.setAttribute("max",n.max),void 0!==n.min&&r.setAttribute("min",n.min),void 0!==n.step&&r.setAttribute("step",n.step),r.style.padding="4px",r.style.width="100%",r.style.boxSizing="border-box",n.elementAttributes&&"object"==_typeof(n.elementAttributes))for(var l in n.elementAttributes)"+"==l.charAt(0)?(l=l.slice(1),r.setAttribute(l,r.getAttribute(l)+n.elementAttributes["+"+l])):r.setAttribute(l,n.elementAttributes[l]);return r.value=a,t(function(){r.focus({preventScroll:!0}),r.style.height="100%"}),r.addEventListener("blur",function(e){s()}),r.addEventListener("keydown",function(e){switch(e.keyCode){case 13:s();break;case 27:i()}}),r},select:function(e,t,o,i,n){function s(t){var o,i={},n=x.table.getData();return o=t?x.table.columnManager.getColumnByField(t):e.getColumn()._getSelf(),o?n.forEach(function(e){var t=o.getFieldValue(e);null!==t&&void 0!==t&&""!==t&&(i[t]=!0)}):console.warn("unable to find matching column to create select lookup list:",t),Object.keys(i)}function a(t,o){function i(e){var e={label:e.label,value:e.value,itemParams:e.itemParams,elementAttributes:e.elementAttributes,element:!1};return o.indexOf(e.value)>-1&&c(e),s.push(e),a.push(e),e}var s=[],a=[];if("function"==typeof t&&(t=t(e)),Array.isArray(t))t.forEach(function(e){var t;"object"===(void 0===e?"undefined":_typeof(e))?e.options?(t={label:e.label,group:!0,itemParams:e.itemParams,elementAttributes:e.elementAttributes,element:!1},a.push(t),e.options.forEach(function(e){i(e)})):i(e):(t={label:e,value:e,element:!1},o.indexOf(t.value)>-1&&c(t),s.push(t),a.push(t))});else for(var l in t){var u={label:t[l],value:l,element:!1};o.indexOf(u.value)>-1&&c(u),s.push(u),a.push(u)}n.sortValuesList&&(s.sort(function(e,t){return e.label<t.label?-1:e.label>t.label?1:0}),a.sort(function(e,t){return e.label<t.label?-1:e.label>t.label?1:0}),"asc"!==n.sortValuesList&&(s.reverse(),a.reverse())),S=s,P=a,r()}function r(){for(;k.firstChild;)k.removeChild(k.firstChild);P.forEach(function(t){var o=t.element;if(!o){if(o=document.createElement("div"),t.label=n.listItemFormatter?n.listItemFormatter(t.value,t.label,e,o,t.itemParams):t.label,t.group?(o.classList.add("tabulator-edit-select-list-group"),o.tabIndex=0,o.innerHTML=""===t.label?"&nbsp;":t.label):(o.classList.add("tabulator-edit-select-list-item"),o.tabIndex=0,o.innerHTML=""===t.label?"&nbsp;":t.label,o.addEventListener("click",function(){F=!0,setTimeout(function(){F=!1},10),z?(d(t),T.focus()):p(t)}),A.indexOf(t)>-1&&o.classList.add("active")),t.elementAttributes&&"object"==_typeof(t.elementAttributes))for(var i in t.elementAttributes)"+"==i.charAt(0)?(i=i.slice(1),o.setAttribute(i,T.getAttribute(i)+t.elementAttributes["+"+i])):o.setAttribute(i,t.elementAttributes[i]);o.addEventListener("mousedown",function(){_=!1,setTimeout(function(){_=!0},10)}),t.element=o}k.appendChild(o)})}function l(e,t){!z&&H&&H.element&&H.element.classList.remove("active"),H&&H.element&&H.element.classList.remove("focused"),H=e,e.element&&(e.element.classList.add("focused"),t&&e.element.classList.add("active")),e&&e.element&&e.element.scrollIntoView&&e.element.scrollIntoView({behavior:"smooth",block:"nearest",inline:"start"})}function c(e){-1==A.indexOf(e)&&(A.push(e),l(e,!0)),f()}function u(e){var t=A[e];e>-1&&(A.splice(e,1),t.element&&t.element.classList.remove("active"))}function d(e){e||(e=H);var t=A.indexOf(e);t>-1?u(t):(!0!==z&&A.length>=z&&u(0),c(e)),f()}function p(e){y(),e||(e=H),e&&(T.value=e.label,o(e.value)),D=[e.value]}function m(e){e||y();var t=[];A.forEach(function(e){t.push(e.value)}),D=t,o(t)}function f(){var e=[];A.forEach(function(t){e.push(t.label)}),T.value=e.join(", "),!1===x.currentCell&&m(!0)}function g(){for(var e=A.length,t=0;t<e;t++)u(0)}function b(){y(),i()}function v(){if(A=[],!k.parentNode){!0===n.values?a(s(),D):"string"==typeof n.values?a(s(n.values),D):a(n.values||[],D);var e=h.prototype.helpers.elOffset(R);k.style.minWidth=R.offsetWidth+"px",k.style.top=e.top+R.offsetHeight+"px",k.style.left=e.left+"px",k.addEventListener("mousedown",function(e){_=!1,setTimeout(function(){_=!0},10)}),document.body.appendChild(k)}}function y(){k.parentNode&&k.parentNode.removeChild(k),w()}function w(){x.table.rowManager.element.removeEventListener("scroll",b)}function E(e){clearTimeout(B);var t=String.fromCharCode(event.keyCode).toLowerCase();N+=t.toLowerCase();var o=S.find(function(e){return void 0!==e.label&&e.label.toLowerCase().startsWith(N)});o&&l(o,!z),B=setTimeout(function(){N=""},800)}var C=this,x=this,R=e.getElement(),M=e.getValue(),L=n.verticalNavigation||"editor",D=void 0!==M||null===M?Array.isArray(M)?M:[M]:void 0!==n.defaultValue?n.defaultValue:[],T=document.createElement("input"),k=document.createElement("div"),z=n.multiselect,S=[],H={},P=[],A=[],_=!0,F=!1,N="",B=null;if((Array.isArray(n)||!Array.isArray(n)&&"object"===(void 0===n?"undefined":_typeof(n))&&!n.values)&&(console.warn("DEPRECATION WARNING - values for the select editor must now be passed into the values property of the editorParams object, not as the editorParams object"),n={values:n}),T.setAttribute("type","text"),T.style.padding="4px",T.style.width="100%",T.style.boxSizing="border-box",T.style.cursor="default",T.readOnly=0!=this.currentCell,n.elementAttributes&&"object"==_typeof(n.elementAttributes))for(var O in n.elementAttributes)"+"==O.charAt(0)?(O=O.slice(1),T.setAttribute(O,T.getAttribute(O)+n.elementAttributes["+"+O])):T.setAttribute(O,n.elementAttributes[O]);return T.value=void 0!==M||null===M?M:"",T.addEventListener("search",function(e){T.value||(g(),m())}),T.addEventListener("keydown",function(e){var t;switch(e.keyCode){case 38:t=S.indexOf(H),("editor"==L||"hybrid"==L&&t)&&(e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault(),t>0&&l(S[t-1],!z));break;case 40:t=S.indexOf(H),("editor"==L||"hybrid"==L&&t<S.length-1)&&(e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault(),t<S.length-1&&(-1==t?l(S[0],!z):l(S[t+1],!z)));break;case 37:case 39:e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault();break;case 13:z?d():p();break;case 27:b();break;case 9:break;default:!1===x.currentCell&&e.preventDefault(),e.keyCode>=38&&e.keyCode<=90&&E(e.keyCode)}}),T.addEventListener("blur",function(e){_&&(z?m():b())}),T.addEventListener("focus",function(e){F||v()}),k=document.createElement("div"),k.classList.add("tabulator-edit-select-list"),t(function(){T.style.height="100%",T.focus({preventScroll:!0})}),setTimeout(function(){C.table.rowManager.element.addEventListener("scroll",b)},10),T},autocomplete:function(e,t,o,i,n){function s(){!0===n.values?S=a():"string"==typeof n.values&&(S=a(n.values))}function a(t){var o,i={},s=E.table.getData();return o=t?E.table.columnManager.getColumnByField(t):e.getColumn()._getSelf(),o?(s.forEach(function(e){var t=o.getFieldValue(e);null!==t&&void 0!==t&&""!==t&&(i[t]=!0)}),i=n.sortValuesList?"asc"==n.sortValuesList?Object.keys(i).sort():Object.keys(i).sort().reverse():Object.keys(i)):console.warn("unable to find matching column to create autocomplete lookup list:",t),i}function r(e,t){var o,i,s=[];o=S||(n.values||[]),n.searchFunc?(s=n.searchFunc(e,o),s instanceof Promise?(l(void 0!==n.searchingPlaceholder?n.searchingPlaceholder:"Searching..."),s.then(function(e){d(c(e),t)}).catch(function(e){console.err("error in autocomplete search promise:",e)})):d(c(s),t)):(i=c(o),""===e?n.showListOnEmpty&&(s=i):i.forEach(function(t){null===t.value&&void 0===t.value||(String(t.value).toLowerCase().indexOf(String(e).toLowerCase())>-1||String(t.title).toLowerCase().indexOf(String(e).toLowerCase())>-1)&&s.push(t)}),d(s,t))}function l(e){var t=document.createElement("div");u(),!1!==e&&(t.classList.add("tabulator-edit-select-list-notice"),t.tabIndex=0,e instanceof Node?t.appendChild(e):t.innerHTML=e,D.appendChild(t))}function c(e){var t=[];if(Array.isArray(e))e.forEach(function(e){var o={};"object"===(void 0===e?"undefined":_typeof(e))?(o.title=n.listItemFormatter?n.listItemFormatter(e.value,e.label):e.label,o.value=e.value):(o.title=n.listItemFormatter?n.listItemFormatter(e,e):e,o.value=e),t.push(o)});else for(var o in e){var i={title:n.listItemFormatter?n.listItemFormatter(o,e[o]):e[o],value:o};t.push(i)}return t}function u(){for(;D.firstChild;)D.removeChild(D.firstChild)}function d(e,t){e.length?p(e,t):n.emptyPlaceholder&&l(n.emptyPlaceholder)}function p(e,t){var o=!1;u(),T=e,T.forEach(function(e){var i=e.element;i||(i=document.createElement("div"),i.classList.add("tabulator-edit-select-list-item"),i.tabIndex=0,i.innerHTML=e.title,i.addEventListener("click",function(t){g(e),m()}),i.addEventListener("mousedown",function(e){z=!1,setTimeout(function(){z=!0},10)}),e.element=i,t&&e.value==x&&(L.value=e.title,e.element.classList.add("active"),o=!0),e===k&&(e.element.classList.add("active"),o=!0)),D.appendChild(i)}),o||g(!1)}function m(){b(),k?x!==k.value?(x=k.value,L.value=k.title,o(k.value)):i():n.freetext?(x=L.value,o(L.value)):n.allowEmpty&&""===L.value?(x=L.value,o(L.value)):i()}function f(){if(!D.parentNode){for(console.log("show",M);D.firstChild;)D.removeChild(D.firstChild);var e=h.prototype.helpers.elOffset(C);D.style.minWidth=C.offsetWidth+"px",D.style.top=e.top+C.offsetHeight+"px",D.style.left=e.left+"px",document.body.appendChild(D)}}function g(e,t){k&&k.element&&k.element.classList.remove("active"),k=e,e&&e.element&&e.element.classList.add("active"),e&&e.element&&e.element.scrollIntoView&&e.element.scrollIntoView({behavior:"smooth",block:"nearest",inline:"start"})}function b(){D.parentNode&&D.parentNode.removeChild(D),y()}function v(){b(),i()}function y(){E.table.rowManager.element.removeEventListener("scroll",v)}var w=this,E=this,C=e.getElement(),x=e.getValue(),R=n.verticalNavigation||"editor",M=void 0!==x||null===x?x:void 0!==n.defaultValue?n.defaultValue:"",L=document.createElement("input"),D=document.createElement("div"),T=[],k=!1,z=!0,S=!1;if(L.setAttribute("type","search"),L.style.padding="4px",L.style.width="100%",L.style.boxSizing="border-box",n.elementAttributes&&"object"==_typeof(n.elementAttributes))for(var H in n.elementAttributes)"+"==H.charAt(0)?(H=H.slice(1),L.setAttribute(H,L.getAttribute(H)+n.elementAttributes["+"+H])):L.setAttribute(H,n.elementAttributes[H]);return D.classList.add("tabulator-edit-select-list"),D.addEventListener("mousedown",function(e){z=!1,setTimeout(function(){z=!0},10)}),L.addEventListener("keydown",function(e){var t;switch(e.keyCode){case 38:t=T.indexOf(k),("editor"==R||"hybrid"==R&&t)&&(e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault(),g(t>0?T[t-1]:!1));break;case 40:t=T.indexOf(k),("editor"==R||"hybrid"==R&&t<T.length-1)&&(e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault(),t<T.length-1&&g(-1==t?T[0]:T[t+1]));break;case 37:case 39:e.stopImmediatePropagation(),e.stopPropagation();break;case 13:m();break;case 27:v();break;case 36:case 35:e.stopImmediatePropagation()}}),L.addEventListener("keyup",function(e){switch(e.keyCode){case 38:case 37:case 39:case 40:case 13:case 27:break;default:r(L.value)}}),L.addEventListener("search",function(e){r(L.value)}),L.addEventListener("blur",function(e){z&&m()}),L.addEventListener("focus",function(e){var t=M;s(),f(),L.value=t,r(t,!0)}),t(function(){L.style.height="100%",L.focus({preventScroll:!0})}),n.mask&&this.table.modules.edit.maskInput(L,n),setTimeout(function(){w.table.rowManager.element.addEventListener("scroll",v)},10),s(),L.value=M,r(M,!0),L},star:function(e,t,o,i,n){function s(e){h.forEach(function(t,o){o<e?("ie"==r.table.browser?t.setAttribute("class","tabulator-star-active"):t.classList.replace("tabulator-star-inactive","tabulator-star-active"),t.innerHTML='<polygon fill="#488CE9" stroke="#014AAE" stroke-width="37.6152" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points="259.216,29.942 330.27,173.919 489.16,197.007 374.185,309.08 401.33,467.31 259.216,392.612 117.104,467.31 144.25,309.08 29.274,197.007 188.165,173.919 "/>'):("ie"==r.table.browser?t.setAttribute("class","tabulator-star-inactive"):t.classList.replace("tabulator-star-active","tabulator-star-inactive"),t.innerHTML='<polygon fill="#010155" stroke="#686868" stroke-width="37.6152" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points="259.216,29.942 330.27,173.919 489.16,197.007 374.185,309.08 401.33,467.31 259.216,392.612 117.104,467.31 144.25,309.08 29.274,197.007 188.165,173.919 "/>')})}function a(e){c=e,s(e)}var r=this,l=e.getElement(),c=e.getValue(),u=l.getElementsByTagName("svg").length||5,d=l.getElementsByTagName("svg")[0]?l.getElementsByTagName("svg")[0].getAttribute("width"):14,h=[],p=document.createElement("div"),m=document.createElementNS("http://www.w3.org/2000/svg","svg");if(l.style.whiteSpace="nowrap",l.style.overflow="hidden",l.style.textOverflow="ellipsis",p.style.verticalAlign="middle",p.style.display="inline-block",p.style.padding="4px",m.setAttribute("width",d),m.setAttribute("height",d),m.setAttribute("viewBox","0 0 512 512"),m.setAttribute("xml:space","preserve"),m.style.padding="0 1px",n.elementAttributes&&"object"==_typeof(n.elementAttributes))for(var f in n.elementAttributes)"+"==f.charAt(0)?(f=f.slice(1),p.setAttribute(f,p.getAttribute(f)+n.elementAttributes["+"+f])):p.setAttribute(f,n.elementAttributes[f]);for(var g=1;g<=u;g++)!function(e){var t=document.createElement("span"),i=m.cloneNode(!0);h.push(i),t.addEventListener("mouseenter",function(t){t.stopPropagation(),t.stopImmediatePropagation(),s(e)}),t.addEventListener("mousemove",function(e){e.stopPropagation(),e.stopImmediatePropagation()}),t.addEventListener("click",function(t){t.stopPropagation(),t.stopImmediatePropagation(),o(e),l.blur()}),t.appendChild(i),p.appendChild(t)}(g);return c=Math.min(parseInt(c),u),s(c),p.addEventListener("mousemove",function(e){s(0)}),p.addEventListener("click",function(e){o(0)}),l.addEventListener("blur",function(e){i()}),l.addEventListener("keydown",function(e){switch(e.keyCode){case 39:a(c+1);break;case 37:a(c-1);break;case 13:o(c);break;case 27:i()}}),p},progress:function(e,t,o,i,n){function s(){var e=window.getComputedStyle(l,null),t=d*Math.round(m.offsetWidth/((l.clientWidth-parseInt(e.getPropertyValue("padding-left"))-parseInt(e.getPropertyValue("padding-right")))/100))+u;o(t),l.setAttribute("aria-valuenow",t),l.setAttribute("aria-label",h)}var a,r,l=e.getElement(),c=void 0===n.max?l.getElementsByTagName("div")[0].getAttribute("max")||100:n.max,u=void 0===n.min?l.getElementsByTagName("div")[0].getAttribute("min")||0:n.min,d=(c-u)/100,h=e.getValue()||0,p=document.createElement("div"),m=document.createElement("div");if(p.style.position="absolute",p.style.right="0",p.style.top="0",p.style.bottom="0",p.style.width="5px",p.classList.add("tabulator-progress-handle"),m.style.display="inline-block",m.style.position="relative",m.style.height="100%",m.style.backgroundColor="#488CE9",m.style.maxWidth="100%",m.style.minWidth="0%",n.elementAttributes&&"object"==_typeof(n.elementAttributes))for(var f in n.elementAttributes)"+"==f.charAt(0)?(f=f.slice(1),m.setAttribute(f,m.getAttribute(f)+n.elementAttributes["+"+f])):m.setAttribute(f,n.elementAttributes[f]);return l.style.padding="4px 4px",h=Math.min(parseFloat(h),c),h=Math.max(parseFloat(h),u),h=Math.round((h-u)/d),m.style.width=h+"%",l.setAttribute("aria-valuemin",u),l.setAttribute("aria-valuemax",c),m.appendChild(p),p.addEventListener("mousedown",function(e){a=e.screenX,r=m.offsetWidth}),p.addEventListener("mouseover",function(){p.style.cursor="ew-resize"}),l.addEventListener("mousemove",function(e){a&&(m.style.width=r+e.screenX-a+"px")}),l.addEventListener("mouseup",function(e){a&&(e.stopPropagation(),e.stopImmediatePropagation(),a=!1,r=!1,s())}),l.addEventListener("keydown",function(e){switch(e.keyCode){case 39:e.preventDefault(),m.style.width=m.clientWidth+l.clientWidth/100+"px";break;case 37:e.preventDefault(),m.style.width=m.clientWidth-l.clientWidth/100+"px";break;case 9:case 13:s();break;case 27:i()}}),l.addEventListener("blur",function(){i()}),m},tickCross:function(e,t,o,i,n){function s(e){return l?e?u?c:r.checked:r.checked&&!u?(r.checked=!1,r.indeterminate=!0,u=!0,c):(u=!1,r.checked):r.checked}var a=e.getValue(),r=document.createElement("input"),l=n.tristate,c=void 0===n.indeterminateValue?null:n.indeterminateValue,u=!1;if(r.setAttribute("type","checkbox"),r.style.marginTop="5px",r.style.boxSizing="border-box",n.elementAttributes&&"object"==_typeof(n.elementAttributes))for(var d in n.elementAttributes)"+"==d.charAt(0)?(d=d.slice(1),r.setAttribute(d,r.getAttribute(d)+n.elementAttributes["+"+d])):r.setAttribute(d,n.elementAttributes[d]);return r.value=a,!l||void 0!==a&&a!==c&&""!==a||(u=!0,r.indeterminate=!0),"firefox"!=this.table.browser&&t(function(){r.focus({preventScroll:!0})}),r.checked=!0===a||"true"===a||"True"===a||1===a,t(function(){r.focus()}),r.addEventListener("change",function(e){o(s())}),r.addEventListener("blur",function(e){o(s(!0))}),r.addEventListener("keydown",function(e){13==e.keyCode&&o(s()),27==e.keyCode&&i()}),r}},h.prototype.registerModule("edit",x);var R=function(e,t,o,i){this.type=e,this.columns=t,this.component=o||!1,this.indent=i||0},M=function(e,t,o,i,n){this.value=e,this.component=t||!1,this.width=o,this.height=i,this.depth=n},L=function(e){this.table=e,this.config={},this.cloneTableStyle=!0,this.colVisProp=""};L.prototype.generateExportList=function(e,t,o,i){this.cloneTableStyle=t,this.config=e||{},this.colVisProp=i;var n=!1!==this.config.columnHeaders?this.headersToExportRows(this.generateColumnGroupHeaders()):[],s=this.bodyToExportRows(this.rowLookup(o));return n.concat(s)},L.prototype.genereateTable=function(e,t,o,i){var n=this.generateExportList(e,t,o,i);return this.genereateTableElement(n)},L.prototype.rowLookup=function(e){var t=this,o=[];if("function"==typeof e)e.call(this.table).forEach(function(e){(e=t.table.rowManager.findRow(e))&&o.push(e)});else switch(e){case!0:case"visible":o=this.table.rowManager.getVisibleRows(!0);break;case"all":o=this.table.rowManager.rows;break;case"selected":o=this.table.modules.selectRow.selectedRows;break;case"active":default:o=this.table.options.pagination?this.table.rowManager.getDisplayRows(this.table.rowManager.displayRows.length-2):this.table.rowManager.getDisplayRows()}return Object.assign([],o)},L.prototype.generateColumnGroupHeaders=function(){var e=this,t=[];return(!1!==this.config.columnGroups?this.table.columnManager.columns:this.table.columnManager.columnsByIndex).forEach(function(o){var i=e.processColumnGroup(o);i&&t.push(i)}),t},L.prototype.processColumnGroup=function(e){var t=this,o=e.columns,i=0,n=e.definition["title"+(this.colVisProp.charAt(0).toUpperCase()+this.colVisProp.slice(1))]||e.definition.title,s={title:n,column:e,depth:1};if(o.length){if(s.subGroups=[],s.width=0,o.forEach(function(e){var o=t.processColumnGroup(e);o&&(s.width+=o.width,s.subGroups.push(o),o.depth>i&&(i=o.depth))}),s.depth+=i,!s.width)return!1}else{if(!this.columnVisCheck(e))return!1;s.width=1}return s},L.prototype.columnVisCheck=function(e){return!1!==e.definition[this.colVisProp]&&(e.visible||!e.visible&&e.definition[this.colVisProp])},L.prototype.headersToExportRows=function(e){function t(e,n){var s=i-n;if(void 0===o[n]&&(o[n]=[]),e.height=e.subGroups?1:s-e.depth+1,o[n].push(e),e.height>1)for(var a=1;a<e.height;a++)void 0===o[n+a]&&(o[n+a]=[]),o[n+a].push(!1);if(e.width>1)for(var r=1;r<e.width;r++)o[n].push(!1);e.subGroups&&e.subGroups.forEach(function(e){t(e,n+1)})}var o=[],i=0,n=[];return e.forEach(function(e){e.depth>i&&(i=e.depth)}),e.forEach(function(e){t(e,0)}),o.forEach(function(e){var t=[];e.forEach(function(e){e?t.push(new M(e.title,e.column.getComponent(),e.width,e.height,e.depth)):t.push(null)}),n.push(new R("header",t))}),n},L.prototype.bodyToExportRows=function(e){var t=this,o=[],i=[];return this.table.columnManager.columnsByIndex.forEach(function(e){t.columnVisCheck(e)&&o.push(e.getComponent())}),!1!==this.config.columnCalcs&&this.table.modExists("columnCalcs")&&(this.table.modules.columnCalcs.topInitialized&&e.unshift(this.table.modules.columnCalcs.topRow),this.table.modules.columnCalcs.botInitialized&&e.push(this.table.modules.columnCalcs.botRow)),e=e.filter(function(e){switch(e.type){case"group":return!1!==t.config.rowGroups;case"calc":return!1!==t.config.columnCalcs;case"row":return!(t.table.options.dataTree&&!1===t.config.dataTree&&e.modules.dataTree.parent)}return!0}),e.forEach(function(e,n){var s=e.getData(t.colVisProp),a=[],r=0;switch(e.type){case"group":r=e.level,a.push(new M(e.key,e.getComponent(),o.length,1));break;case"calc":case"row":o.forEach(function(e){a.push(new M(e._column.getFieldValue(s),e,1,1))}),t.table.options.dataTree&&!1!==t.config.dataTree&&(r=e.modules.dataTree.index)}i.push(new R(e.type,a,e.getComponent(),r))}),i},L.prototype.genereateTableElement=function(e){var t=this,o=document.createElement("table"),i=document.createElement("thead"),n=document.createElement("tbody"),s=this.lookupTableStyles(),a=this.table.options["rowFormatter"+(this.colVisProp.charAt(0).toUpperCase()+this.colVisProp.slice(1))],r={};return r.rowFormatter=null!==a?a:this.table.options.rowFormatter,this.table.options.dataTree&&!1!==this.config.dataTree&&this.table.modExists("columnCalcs")&&(r.treeElementField=this.table.modules.dataTree.elementField),r.groupHeader=this.table.options["groupHeader"+(this.colVisProp.charAt(0).toUpperCase()+this.colVisProp.slice(1))],r.groupHeader&&!Array.isArray(r.groupHeader)&&(r.groupHeader=[r.groupHeader]),o.classList.add("tabulator-print-table"),this.mapElementStyles(this.table.columnManager.getHeadersElement(),i,["border-top","border-left","border-right","border-bottom","background-color","color","font-weight","font-family","font-size"]),e.length>1e3&&console.warn("It may take a long time to render an HTML table with more than 1000 rows"),e.forEach(function(e,o){switch(e.type){case"header":i.appendChild(t.genereateHeaderElement(e,r,s));break;case"group":n.appendChild(t.genereateGroupElement(e,r,s));break;case"calc":n.appendChild(t.genereateCalcElement(e,r,s));break;case"row":var a=t.genereateRowElement(e,r,s);t.mapElementStyles(o%2&&s.evenRow?s.evenRow:s.oddRow,a,["border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size","background-color"]),n.appendChild(a)}}),i.innerHTML&&o.appendChild(i),o.appendChild(n),this.mapElementStyles(this.table.element,o,["border-top","border-left","border-right","border-bottom"]),o},L.prototype.lookupTableStyles=function(){var e={};return this.cloneTableStyle&&window.getComputedStyle&&(e.oddRow=this.table.element.querySelector(".tabulator-row-odd:not(.tabulator-group):not(.tabulator-calcs)"),e.evenRow=this.table.element.querySelector(".tabulator-row-even:not(.tabulator-group):not(.tabulator-calcs)"),e.calcRow=this.table.element.querySelector(".tabulator-row.tabulator-calcs"),e.firstRow=this.table.element.querySelector(".tabulator-row:not(.tabulator-group):not(.tabulator-calcs)"),e.firstGroup=this.table.element.getElementsByClassName("tabulator-group")[0],e.firstRow&&(e.styleCells=e.firstRow.getElementsByClassName("tabulator-cell"),e.firstCell=e.styleCells[0],e.lastCell=e.styleCells[e.styleCells.length-1])),e},L.prototype.genereateHeaderElement=function(e,t,o){var i=this,n=document.createElement("tr");return e.columns.forEach(function(e){if(e){var t=document.createElement("th"),o=e.component._column.definition.cssClass?e.component._column.definition.cssClass.split(" "):[];t.colSpan=e.width,t.rowSpan=e.height,t.innerHTML=e.value,i.cloneTableStyle&&(t.style.boxSizing="border-box"),o.forEach(function(e){t.classList.add(e)}),i.mapElementStyles(e.component.getElement(),t,["text-align","border-top","border-left","border-right","border-bottom","background-color","color","font-weight","font-family","font-size"]),i.mapElementStyles(e.component._column.contentElement,t,["padding-top","padding-left","padding-right","padding-bottom"]),e.component._column.visible?i.mapElementStyles(e.component.getElement(),t,["width"]):e.component._column.definition.width&&(t.style.width=e.component._column.definition.width+"px"),e.component._column.parent&&i.mapElementStyles(e.component._column.parent.groupElement,t,["border-top"]),n.appendChild(t)}}),n},L.prototype.genereateGroupElement=function(e,t,o){var i=document.createElement("tr"),n=document.createElement("td"),s=e.columns[0];return i.classList.add("tabulator-print-table-row"),t.groupHeader&&t.groupHeader[e.indent]?s.value=t.groupHeader[e.indent](s.value,e.component._group.getRowCount(),e.component._group.getData(),e.component):!1===t.groupHeader?s.value=s.value:s.value=e.component._group.generator(s.value,e.component._group.getRowCount(),e.component._group.getData(),e.component),n.colSpan=s.width,n.innerHTML=s.value,i.classList.add("tabulator-print-table-group"),i.classList.add("tabulator-group-level-"+e.indent),s.component.isVisible()&&i.classList.add("tabulator-group-visible"),this.mapElementStyles(o.firstGroup,i,["border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size","background-color"]),this.mapElementStyles(o.firstGroup,n,["padding-top","padding-left","padding-right","padding-bottom"]),i.appendChild(n),i},L.prototype.genereateCalcElement=function(e,t,o){var i=this.genereateRowElement(e,t,o);return i.classList.add("tabulator-print-table-calcs"),this.mapElementStyles(o.calcRow,i,["border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size","background-color"]),i},L.prototype.genereateRowElement=function(e,t,o){var n=this,s=document.createElement("tr");return s.classList.add("tabulator-print-table-row"),e.columns.forEach(function(a){if(a){var r=document.createElement("td"),l=a.component._column,c=a.value,u={modules:{},getValue:function(){return c},getField:function(){return l.definition.field},getElement:function(){return r},getColumn:function(){return l.getComponent()},getData:function(){return e.component.getData()},getRow:function(){return e.component},getComponent:function(){return u},column:l};if((l.definition.cssClass?l.definition.cssClass.split(" "):[]).forEach(function(e){r.classList.add(e)}),n.table.modExists("format")&&!1!==n.config.formatCells)c=n.table.modules.format.formatExportValue(u,n.colVisProp);else switch(void 0===c?"undefined":_typeof(c)){case"object":c=JSON.stringify(c);break;case"undefined":case"null":c="";break;default:c=c}c instanceof Node?r.appendChild(c):r.innerHTML=c,o.firstCell&&(n.mapElementStyles(o.firstCell,r,["padding-top","padding-left","padding-right","padding-bottom","border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size"]),l.definition.align&&(r.style.textAlign=l.definition.align)),n.table.options.dataTree&&!1!==n.config.dataTree&&(t.treeElementField&&t.treeElementField==l.field||!t.treeElementField&&0==i)&&(e.component._row.modules.dataTree.controlEl&&r.insertBefore(e.component._row.modules.dataTree.controlEl.cloneNode(!0),r.firstChild),e.component._row.modules.dataTree.branchEl&&r.insertBefore(e.component._row.modules.dataTree.branchEl.cloneNode(!0),r.firstChild)),s.appendChild(r),u.modules.format&&u.modules.format.renderedCallback&&u.modules.format.renderedCallback(),t.rowFormatter&&!1!==n.config.formatCells&&t.rowFormatter(e.component)}}),s},L.prototype.genereateHTMLTable=function(e){var t=document.createElement("div");return t.appendChild(this.genereateTableElement(e)),t.innerHTML},L.prototype.getHtml=function(e,t,o,i){var n=this.generateExportList(o||this.table.options.htmlOutputConfig,t,e,i||"htmlOutput");return this.genereateHTMLTable(n)},L.prototype.mapElementStyles=function(e,t,o){if(this.cloneTableStyle&&e&&t){var i={"background-color":"backgroundColor",color:"fontColor",width:"width","font-weight":"fontWeight","font-family":"fontFamily","font-size":"fontSize","text-align":"textAlign","border-top":"borderTop","border-left":"borderLeft","border-right":"borderRight","border-bottom":"borderBottom","padding-top":"paddingTop","padding-left":"paddingLeft","padding-right":"paddingRight","padding-bottom":"paddingBottom"};if(window.getComputedStyle){var n=window.getComputedStyle(e);o.forEach(function(e){t.style[i[e]]=n.getPropertyValue(e)})}}},h.prototype.registerModule("export",L);var D=function(e){this.table=e,this.filterList=[],this.headerFilters={},this.headerFilterColumns=[],this.prevHeaderFilterChangeCheck="",this.prevHeaderFilterChangeCheck="{}",this.changed=!1};D.prototype.initializeColumn=function(e,t){function o(t){var o,a="input"==e.modules.filter.tagType&&"text"==e.modules.filter.attrType||"textarea"==e.modules.filter.tagType?"partial":"match",r="",l="";if(void 0===e.modules.filter.prevSuccess||e.modules.filter.prevSuccess!==t){if(e.modules.filter.prevSuccess=t,e.modules.filter.emptyFunc(t))delete n.headerFilters[s];else{switch(e.modules.filter.value=t,_typeof(e.definition.headerFilterFunc)){case"string":n.filters[e.definition.headerFilterFunc]?(r=e.definition.headerFilterFunc,o=function(o){var i=e.definition.headerFilterFuncParams||{},s=e.getFieldValue(o);return i="function"==typeof i?i(t,s,o):i,n.filters[e.definition.headerFilterFunc](t,s,o,i)}):console.warn("Header Filter Error - Matching filter function not found: ",e.definition.headerFilterFunc);break;case"function":o=function(o){var i=e.definition.headerFilterFuncParams||{},n=e.getFieldValue(o);return i="function"==typeof i?i(t,n,o):i,e.definition.headerFilterFunc(t,n,o,i)},r=o}if(!o)switch(a){case"partial":o=function(o){var i=e.getFieldValue(o);return void 0!==i&&null!==i&&String(i).toLowerCase().indexOf(String(t).toLowerCase())>-1},r="like";break;default:o=function(o){return e.getFieldValue(o)==t},r="="}n.headerFilters[s]={value:t,func:o,
	type:r,params:i||{}}}l=JSON.stringify(n.headerFilters),n.prevHeaderFilterChangeCheck!==l&&(n.prevHeaderFilterChangeCheck=l,n.changed=!0,n.table.rowManager.filterRefresh())}return!0}var i,n=this,s=e.getField();e.modules.filter={success:o,attrType:!1,tagType:!1,emptyFunc:!1},this.generateHeaderFilterElement(e)},D.prototype.generateHeaderFilterElement=function(e,t,o){function i(){}var n,s,a,r,l,c,u,d=this,h=this,p=e.modules.filter.success,m=e.getField();if(e.modules.filter.headerElement&&e.modules.filter.headerElement.parentNode&&e.contentElement.removeChild(e.modules.filter.headerElement.parentNode),m){switch(e.modules.filter.emptyFunc=e.definition.headerFilterEmptyCheck||function(e){return!e&&"0"!==e&&0!==e},n=document.createElement("div"),n.classList.add("tabulator-header-filter"),_typeof(e.definition.headerFilter)){case"string":h.table.modules.edit.editors[e.definition.headerFilter]?(s=h.table.modules.edit.editors[e.definition.headerFilter],"tick"!==e.definition.headerFilter&&"tickCross"!==e.definition.headerFilter||e.definition.headerFilterEmptyCheck||(e.modules.filter.emptyFunc=function(e){return!0!==e&&!1!==e})):console.warn("Filter Error - Cannot build header filter, No such editor found: ",e.definition.editor);break;case"function":s=e.definition.headerFilter;break;case"boolean":e.modules.edit&&e.modules.edit.editor?s=e.modules.edit.editor:e.definition.formatter&&h.table.modules.edit.editors[e.definition.formatter]?(s=h.table.modules.edit.editors[e.definition.formatter],"tick"!==e.definition.formatter&&"tickCross"!==e.definition.formatter||e.definition.headerFilterEmptyCheck||(e.modules.filter.emptyFunc=function(e){return!0!==e&&!1!==e})):s=h.table.modules.edit.editors.input}if(s){if(r={getValue:function(){return void 0!==t?t:""},getField:function(){return e.definition.field},getElement:function(){return n},getColumn:function(){return e.getComponent()},getRow:function(){return{normalizeHeight:function(){}}}},u=e.definition.headerFilterParams||{},u="function"==typeof u?u.call(h.table):u,!(a=s.call(this.table.modules.edit,r,function(){},p,i,u)))return void console.warn("Filter Error - Cannot add filter to "+m+" column, editor returned a value of false");if(!(a instanceof Node))return void console.warn("Filter Error - Cannot add filter to "+m+" column, editor should return an instance of Node, the editor returned:",a);m?h.table.modules.localize.bind("headerFilters|columns|"+e.definition.field,function(e){a.setAttribute("placeholder",void 0!==e&&e?e:h.table.modules.localize.getText("headerFilters|default"))}):h.table.modules.localize.bind("headerFilters|default",function(e){a.setAttribute("placeholder",void 0!==h.column.definition.headerFilterPlaceholder&&h.column.definition.headerFilterPlaceholder?h.column.definition.headerFilterPlaceholder:e)}),a.addEventListener("click",function(e){e.stopPropagation(),a.focus()}),a.addEventListener("focus",function(e){var t=d.table.columnManager.element.scrollLeft;t!==d.table.rowManager.element.scrollLeft&&(d.table.rowManager.scrollHorizontal(t),d.table.columnManager.scrollHorizontal(t))}),l=!1,c=function(e){l&&clearTimeout(l),l=setTimeout(function(){p(a.value)},h.table.options.headerFilterLiveFilterDelay)},e.modules.filter.headerElement=a,e.modules.filter.attrType=a.hasAttribute("type")?a.getAttribute("type").toLowerCase():"",e.modules.filter.tagType=a.tagName.toLowerCase(),!1!==e.definition.headerFilterLiveFilter&&("autocomplete"!==e.definition.headerFilter&&"tickCross"!==e.definition.headerFilter&&("autocomplete"!==e.definition.editor&&"tickCross"!==e.definition.editor||!0!==e.definition.headerFilter)&&(a.addEventListener("keyup",c),a.addEventListener("search",c),"number"==e.modules.filter.attrType&&a.addEventListener("change",function(e){p(a.value)}),"text"==e.modules.filter.attrType&&"ie"!==this.table.browser&&a.setAttribute("type","search")),"input"!=e.modules.filter.tagType&&"select"!=e.modules.filter.tagType&&"textarea"!=e.modules.filter.tagType||a.addEventListener("mousedown",function(e){e.stopPropagation()})),n.appendChild(a),e.contentElement.appendChild(n),o||h.headerFilterColumns.push(e)}}else console.warn("Filter Error - Cannot add header filter, column has no field set:",e.definition.title)},D.prototype.hideHeaderFilterElements=function(){this.headerFilterColumns.forEach(function(e){e.modules.filter&&e.modules.filter.headerElement&&(e.modules.filter.headerElement.style.display="none")})},D.prototype.showHeaderFilterElements=function(){this.headerFilterColumns.forEach(function(e){e.modules.filter&&e.modules.filter.headerElement&&(e.modules.filter.headerElement.style.display="")})},D.prototype.setHeaderFilterFocus=function(e){e.modules.filter&&e.modules.filter.headerElement?e.modules.filter.headerElement.focus():console.warn("Column Filter Focus Error - No header filter set on column:",e.getField())},D.prototype.getHeaderFilterValue=function(e){if(e.modules.filter&&e.modules.filter.headerElement)return e.modules.filter.headerElement.value;console.warn("Column Filter Error - No header filter set on column:",e.getField())},D.prototype.setHeaderFilterValue=function(e,t){e&&(e.modules.filter&&e.modules.filter.headerElement?(this.generateHeaderFilterElement(e,t,!0),e.modules.filter.success(t)):console.warn("Column Filter Error - No header filter set on column:",e.getField()))},D.prototype.reloadHeaderFilter=function(e){e&&(e.modules.filter&&e.modules.filter.headerElement?this.generateHeaderFilterElement(e,e.modules.filter.value,!0):console.warn("Column Filter Error - No header filter set on column:",e.getField()))},D.prototype.hasChanged=function(){var e=this.changed;return this.changed=!1,e},D.prototype.setFilter=function(e,t,o,i){var n=this;n.filterList=[],Array.isArray(e)||(e=[{field:e,type:t,value:o,params:i}]),n.addFilter(e)},D.prototype.addFilter=function(e,t,o,i){var n=this;Array.isArray(e)||(e=[{field:e,type:t,value:o,params:i}]),e.forEach(function(e){(e=n.findFilter(e))&&(n.filterList.push(e),n.changed=!0)}),this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.filter&&this.table.modules.persistence.save("filter")},D.prototype.findFilter=function(e){var t,o=this;if(Array.isArray(e))return this.findSubFilters(e);var i=!1;return"function"==typeof e.field?i=function(t){return e.field(t,e.type||{})}:o.filters[e.type]?(t=o.table.columnManager.getColumnByField(e.field),i=t?function(i){return o.filters[e.type](e.value,t.getFieldValue(i),i,e.params||{})}:function(t){return o.filters[e.type](e.value,t[e.field],t,e.params||{})}):console.warn("Filter Error - No such filter type found, ignoring: ",e.type),e.func=i,!!e.func&&e},D.prototype.findSubFilters=function(e){var t=this,o=[];return e.forEach(function(e){(e=t.findFilter(e))&&o.push(e)}),!!o.length&&o},D.prototype.getFilters=function(e,t){var o=[];return e&&(o=this.getHeaderFilters()),t&&o.forEach(function(e){"function"==typeof e.type&&(e.type="function")}),o=o.concat(this.filtersToArray(this.filterList,t))},D.prototype.filtersToArray=function(e,t){var o=this,i=[];return e.forEach(function(e){var n;Array.isArray(e)?i.push(o.filtersToArray(e,t)):(n={field:e.field,type:e.type,value:e.value},t&&"function"==typeof n.type&&(n.type="function"),i.push(n))}),i},D.prototype.getHeaderFilters=function(){var e=[];for(var t in this.headerFilters)e.push({field:t,type:this.headerFilters[t].type,value:this.headerFilters[t].value});return e},D.prototype.removeFilter=function(e,t,o){var i=this;Array.isArray(e)||(e=[{field:e,type:t,value:o}]),e.forEach(function(e){var t=-1;t="object"==_typeof(e.field)?i.filterList.findIndex(function(t){return e===t}):i.filterList.findIndex(function(t){return e.field===t.field&&e.type===t.type&&e.value===t.value}),t>-1?(i.filterList.splice(t,1),i.changed=!0):console.warn("Filter Error - No matching filter type found, ignoring: ",e.type)}),this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.filter&&this.table.modules.persistence.save("filter")},D.prototype.clearFilter=function(e){this.filterList=[],e&&this.clearHeaderFilter(),this.changed=!0,this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.filter&&this.table.modules.persistence.save("filter")},D.prototype.clearHeaderFilter=function(){var e=this;this.headerFilters={},e.prevHeaderFilterChangeCheck="{}",this.headerFilterColumns.forEach(function(t){void 0!==t.modules.filter.value&&delete t.modules.filter.value,t.modules.filter.prevSuccess=void 0,e.reloadHeaderFilter(t)}),this.changed=!0},D.prototype.search=function(e,t,o,i){var n=this,s=[],a=[];return Array.isArray(t)||(t=[{field:t,type:o,value:i}]),t.forEach(function(e){(e=n.findFilter(e))&&a.push(e)}),this.table.rowManager.rows.forEach(function(t){var o=!0;a.forEach(function(e){n.filterRecurse(e,t.getData())||(o=!1)}),o&&s.push("data"===e?t.getData("data"):t.getComponent())}),s},D.prototype.filter=function(e,t){var o=this,i=[],n=[];return o.table.options.dataFiltering&&o.table.options.dataFiltering.call(o.table,o.getFilters()),o.table.options.ajaxFiltering||!o.filterList.length&&!Object.keys(o.headerFilters).length?i=e.slice(0):e.forEach(function(e){o.filterRow(e)&&i.push(e)}),o.table.options.dataFiltered&&(i.forEach(function(e){n.push(e.getComponent())}),o.table.options.dataFiltered.call(o.table,o.getFilters(),n)),i},D.prototype.filterRow=function(e,t){var o=this,i=!0,n=e.getData();o.filterList.forEach(function(e){o.filterRecurse(e,n)||(i=!1)});for(var s in o.headerFilters)o.headerFilters[s].func(n)||(i=!1);return i},D.prototype.filterRecurse=function(e,t){var o=this,i=!1;return Array.isArray(e)?e.forEach(function(e){o.filterRecurse(e,t)&&(i=!0)}):i=e.func(t),i},D.prototype.filters={"=":function(e,t,o,i){return t==e},"<":function(e,t,o,i){return t<e},"<=":function(e,t,o,i){return t<=e},">":function(e,t,o,i){return t>e},">=":function(e,t,o,i){return t>=e},"!=":function(e,t,o,i){return t!=e},regex:function(e,t,o,i){return"string"==typeof e&&(e=new RegExp(e)),e.test(t)},like:function(e,t,o,i){return null===e||void 0===e?t===e:void 0!==t&&null!==t&&String(t).toLowerCase().indexOf(e.toLowerCase())>-1},keywords:function(e,t,o,i){var n=e.toLowerCase().split(void 0===i.separator?" ":i.separator),s=String(null===t||void 0===t?"":t).toLowerCase(),a=[];return n.forEach(function(e){s.includes(e)&&a.push(!0)}),i.matchAll?a.length===n.length:!!a.length},starts:function(e,t,o,i){return null===e||void 0===e?t===e:void 0!==t&&null!==t&&String(t).toLowerCase().startsWith(e.toLowerCase())},ends:function(e,t,o,i){return null===e||void 0===e?t===e:void 0!==t&&null!==t&&String(t).toLowerCase().endsWith(e.toLowerCase())},in:function(e,t,o,i){return Array.isArray(e)?!e.length||e.indexOf(t)>-1:(console.warn("Filter Error - filter value is not an array:",e),!1)}},h.prototype.registerModule("filter",D);var T=function(e){this.table=e};T.prototype.initializeColumn=function(e){e.modules.format=this.lookupFormatter(e,""),void 0!==e.definition.formatterPrint&&(e.modules.format.print=this.lookupFormatter(e,"Print")),void 0!==e.definition.formatterClipboard&&(e.modules.format.clipboard=this.lookupFormatter(e,"Clipboard")),void 0!==e.definition.formatterHtmlOutput&&(e.modules.format.htmlOutput=this.lookupFormatter(e,"HtmlOutput"))},T.prototype.lookupFormatter=function(e,t){var o={params:e.definition["formatter"+t+"Params"]||{}},i=e.definition["formatter"+t];switch(void 0===i?"undefined":_typeof(i)){case"string":"tick"===i&&(i="tickCross",void 0===o.params.crossElement&&(o.params.crossElement=!1),console.warn("DEPRECATION WARNING - the tick formatter has been deprecated, please use the tickCross formatter with the crossElement param set to false")),this.formatters[i]?o.formatter=this.formatters[i]:(console.warn("Formatter Error - No such formatter found: ",i),o.formatter=this.formatters.plaintext);break;case"function":o.formatter=i;break;default:o.formatter=this.formatters.plaintext}return o},T.prototype.cellRendered=function(e){e.modules.format&&e.modules.format.renderedCallback&&!e.modules.format.rendered&&(e.modules.format.renderedCallback(),e.modules.format.rendered=!0)},T.prototype.formatValue=function(e){function t(t){e.modules.format||(e.modules.format={}),e.modules.format.renderedCallback=t,e.modules.format.rendered=!1}var o=e.getComponent(),i="function"==typeof e.column.modules.format.params?e.column.modules.format.params(o):e.column.modules.format.params;return e.column.modules.format.formatter.call(this,o,i,t)},T.prototype.formatExportValue=function(e,t){var o,i=e.column.modules.format[t];if(i){var n=function(t){e.modules.format||(e.modules.format={}),e.modules.format.renderedCallback=t,e.modules.format.rendered=!1};return o="function"==typeof i.params?i.params(component):i.params,i.formatter.call(this,e.getComponent(),o,n)}return this.formatValue(e)},T.prototype.sanitizeHTML=function(e){if(e){var t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","~~~":"&#x60;","=":"&#x3D;"};var tmps=new RegExp("[&<>\"'~~~=\\/]", "g");return String(e).replace(tmps,function(e){return t[e]})}return e},T.prototype.emptyToSpace=function(e){return null===e||void 0===e||""===e?"&nbsp;":e},T.prototype.getFormatter=function(e){var e;switch(void 0===e?"undefined":_typeof(e)){case"string":this.formatters[e]?e=this.formatters[e]:(console.warn("Formatter Error - No such formatter found: ",e),e=this.formatters.plaintext);break;case"function":e=e;break;default:e=this.formatters.plaintext}return e},T.prototype.formatters={plaintext:function(e,t,o){return this.emptyToSpace(this.sanitizeHTML(e.getValue()))},html:function(e,t,o){return e.getValue()},textarea:function(e,t,o){return e.getElement().style.whiteSpace="pre-wrap",this.emptyToSpace(this.sanitizeHTML(e.getValue()))},money:function(e,t,o){var i,n,s,a,r=parseFloat(e.getValue()),l=t.decimal||".",c=t.thousand||",",u=t.symbol||"",d=!!t.symbolAfter,h=void 0!==t.precision?t.precision:2;if(isNaN(r))return this.emptyToSpace(this.sanitizeHTML(e.getValue()));for(i=!1!==h?r.toFixed(h):r,i=String(i).split("."),n=i[0],s=i.length>1?l+i[1]:"",a=/(\d+)(\d{3})/;a.test(n);)n=n.replace(a,"$1"+c+"$2");return d?n+s+u:u+n+s},link:function(e,t,o){var i,n=e.getValue(),s=t.urlPrefix||"",a=t.download,r=n,l=document.createElement("a");if(t.labelField&&(i=e.getData(),r=i[t.labelField]),t.label)switch(_typeof(t.label)){case"string":r=t.label;break;case"function":r=t.label(e)}if(r){if(t.urlField&&(i=e.getData(),n=i[t.urlField]),t.url)switch(_typeof(t.url)){case"string":n=t.url;break;case"function":n=t.url(e)}return l.setAttribute("href",s+n),t.target&&l.setAttribute("target",t.target),t.download&&(a="function"==typeof a?a(e):!0===a?"":a,l.setAttribute("download",a)),l.innerHTML=this.emptyToSpace(this.sanitizeHTML(r)),l}return"&nbsp;"},image:function(e,t,o){var i=document.createElement("img"),n=e.getValue();switch(t.urlPrefix&&(n=t.urlPrefix+e.getValue()),t.urlSuffix&&(n+=t.urlSuffix),i.setAttribute("src",n),_typeof(t.height)){case"number":i.style.height=t.height+"px";break;case"string":i.style.height=t.height}switch(_typeof(t.width)){case"number":i.style.width=t.width+"px";break;case"string":i.style.width=t.width}return i.addEventListener("load",function(){e.getRow().normalizeHeight()}),i},tickCross:function(e,t,o){var i=e.getValue(),n=e.getElement(),s=t.allowEmpty,a=t.allowTruthy,r=void 0!==t.tickElement?t.tickElement:'<svg enable-background="new 0 0 24 24" height="14" width="14" viewBox="0 0 24 24" xml:space="preserve" ><path fill="#2DC214" clip-rule="evenodd" d="M21.652,3.211c-0.293-0.295-0.77-0.295-1.061,0L9.41,14.34  c-0.293,0.297-0.771,0.297-1.062,0L3.449,9.351C3.304,9.203,3.114,9.13,2.923,9.129C2.73,9.128,2.534,9.201,2.387,9.351  l-2.165,1.946C0.078,11.445,0,11.63,0,11.823c0,0.194,0.078,0.397,0.223,0.544l4.94,5.184c0.292,0.296,0.771,0.776,1.062,1.07  l2.124,2.141c0.292,0.293,0.769,0.293,1.062,0l14.366-14.34c0.293-0.294,0.293-0.777,0-1.071L21.652,3.211z" fill-rule="evenodd"/></svg>',l=void 0!==t.crossElement?t.crossElement:'<svg enable-background="new 0 0 24 24" height="14" width="14"  viewBox="0 0 24 24" xml:space="preserve" ><path fill="#CE1515" d="M22.245,4.015c0.313,0.313,0.313,0.826,0,1.139l-6.276,6.27c-0.313,0.312-0.313,0.826,0,1.14l6.273,6.272  c0.313,0.313,0.313,0.826,0,1.14l-2.285,2.277c-0.314,0.312-0.828,0.312-1.142,0l-6.271-6.271c-0.313-0.313-0.828-0.313-1.141,0  l-6.276,6.267c-0.313,0.313-0.828,0.313-1.141,0l-2.282-2.28c-0.313-0.313-0.313-0.826,0-1.14l6.278-6.269  c0.313-0.312,0.313-0.826,0-1.14L1.709,5.147c-0.314-0.313-0.314-0.827,0-1.14l2.284-2.278C4.308,1.417,4.821,1.417,5.135,1.73  L11.405,8c0.314,0.314,0.828,0.314,1.141,0.001l6.276-6.267c0.312-0.312,0.826-0.312,1.141,0L22.245,4.015z"/></svg>';return a&&i||!0===i||"true"===i||"True"===i||1===i||"1"===i?(n.setAttribute("aria-checked",!0),r||""):!s||"null"!==i&&""!==i&&null!==i&&void 0!==i?(n.setAttribute("aria-checked",!1),l||""):(n.setAttribute("aria-checked","mixed"),"")},datetime:function(e,t,o){var i=t.inputFormat||"YYYY-MM-DD hh:mm:ss",n=t.outputFormat||"DD/MM/YYYY hh:mm:ss",s=void 0!==t.invalidPlaceholder?t.invalidPlaceholder:"",a=e.getValue(),r=moment(a,i);return r.isValid()?t.timezone?r.tz(t.timezone).format(n):r.format(n):!0===s?a:"function"==typeof s?s(a):s},datetimediff:function(e,t,o){var i=t.inputFormat||"YYYY-MM-DD hh:mm:ss",n=void 0!==t.invalidPlaceholder?t.invalidPlaceholder:"",s=void 0!==t.suffix&&t.suffix,a=void 0!==t.unit?t.unit:void 0,r=void 0!==t.humanize&&t.humanize,l=void 0!==t.date?t.date:moment(),c=e.getValue(),u=moment(c,i);return u.isValid()?r?moment.duration(u.diff(l)).humanize(s):u.diff(l,a)+(s?" "+s:""):!0===n?c:"function"==typeof n?n(c):n},lookup:function(e,t,o){var i=e.getValue();return void 0===t[i]?(console.warn("Missing display value for "+i),i):t[i]},star:function(e,t,o){var i=e.getValue(),n=e.getElement(),s=t&&t.stars?t.stars:5,a=document.createElement("span"),r=document.createElementNS("http://www.w3.org/2000/svg","svg");a.style.verticalAlign="middle",r.setAttribute("width","14"),r.setAttribute("height","14"),r.setAttribute("viewBox","0 0 512 512"),r.setAttribute("xml:space","preserve"),r.style.padding="0 1px",i=i&&!isNaN(i)?parseInt(i):0,i=Math.max(0,Math.min(i,s));for(var l=1;l<=s;l++){var c=r.cloneNode(!0);c.innerHTML=l<=i?'<polygon fill="#FFEA00" stroke="#C1AB60" stroke-width="37.6152" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points="259.216,29.942 330.27,173.919 489.16,197.007 374.185,309.08 401.33,467.31 259.216,392.612 117.104,467.31 144.25,309.08 29.274,197.007 188.165,173.919 "/>':'<polygon fill="#D2D2D2" stroke="#686868" stroke-width="37.6152" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points="259.216,29.942 330.27,173.919 489.16,197.007 374.185,309.08 401.33,467.31 259.216,392.612 117.104,467.31 144.25,309.08 29.274,197.007 188.165,173.919 "/>',a.appendChild(c)}return n.style.whiteSpace="nowrap",n.style.overflow="hidden",n.style.textOverflow="ellipsis",n.setAttribute("aria-label",i),a},traffic:function(e,t,o){var i,n,s=this.sanitizeHTML(e.getValue())||0,a=document.createElement("span"),r=t&&t.max?t.max:100,l=t&&t.min?t.min:0,c=t&&void 0!==t.color?t.color:["red","orange","green"],u="#666666";if(!isNaN(s)&&void 0!==e.getValue()){switch(a.classList.add("tabulator-traffic-light"),n=parseFloat(s)<=r?parseFloat(s):r,n=parseFloat(n)>=l?parseFloat(n):l,i=(r-l)/100,n=Math.round((n-l)/i),void 0===c?"undefined":_typeof(c)){case"string":u=c;break;case"function":u=c(s);break;case"object":if(Array.isArray(c)){var d=100/c.length,h=Math.floor(n/d);h=Math.min(h,c.length-1),h=Math.max(h,0),u=c[h];break}}return a.style.backgroundColor=u,a}},progress:function(e,t,o){var i,n,s,a,r,l=this.sanitizeHTML(e.getValue())||0,u=e.getElement(),d=t&&t.max?t.max:100,h=t&&t.min?t.min:0,p=t&&t.legendAlign?t.legendAlign:"center";switch(n=parseFloat(l)<=d?parseFloat(l):d,n=parseFloat(n)>=h?parseFloat(n):h,i=(d-h)/100,n=Math.round((n-h)/i),_typeof(t.color)){case"string":s=t.color;break;case"function":s=t.color(l);break;case"object":if(Array.isArray(t.color)){var m=100/t.color.length,f=Math.floor(n/m);f=Math.min(f,t.color.length-1),f=Math.max(f,0),s=t.color[f];break}default:s="#2DC214"}switch(_typeof(t.legend)){case"string":a=t.legend;break;case"function":a=t.legend(l);break;case"boolean":a=l;break;default:a=!1}switch(_typeof(t.legendColor)){case"string":r=t.legendColor;break;case"function":r=t.legendColor(l);break;case"object":if(Array.isArray(t.legendColor)){var m=100/t.legendColor.length,f=Math.floor(n/m);f=Math.min(f,t.legendColor.length-1),f=Math.max(f,0),r=t.legendColor[f]}break;default:r="#000"}u.style.minWidth="30px",u.style.position="relative",u.setAttribute("aria-label",n);var g=document.createElement("div");if(g.style.display="inline-block",g.style.position="relative",g.style.width=n+"%",g.style.backgroundColor=s,g.style.height="100%",g.setAttribute("data-max",d),g.setAttribute("data-min",h),a){var b=document.createElement("div");b.style.position="absolute",b.style.top="4px",b.style.left=0,b.style.textAlign=p,b.style.width="100%",b.style.color=r,b.innerHTML=a}return o(function(){if(!(e instanceof c)){var t=document.createElement("div");t.style.position="absolute",t.style.top="4px",t.style.bottom="4px",t.style.left="4px",t.style.right="4px",u.appendChild(t),u=t}u.appendChild(g),a&&u.appendChild(b)}),""},color:function(e,t,o){return e.getElement().style.backgroundColor=this.sanitizeHTML(e.getValue()),""},buttonTick:function(e,t,o){return'<svg enable-background="new 0 0 24 24" height="14" width="14" viewBox="0 0 24 24" xml:space="preserve" ><path fill="#2DC214" clip-rule="evenodd" d="M21.652,3.211c-0.293-0.295-0.77-0.295-1.061,0L9.41,14.34  c-0.293,0.297-0.771,0.297-1.062,0L3.449,9.351C3.304,9.203,3.114,9.13,2.923,9.129C2.73,9.128,2.534,9.201,2.387,9.351  l-2.165,1.946C0.078,11.445,0,11.63,0,11.823c0,0.194,0.078,0.397,0.223,0.544l4.94,5.184c0.292,0.296,0.771,0.776,1.062,1.07  l2.124,2.141c0.292,0.293,0.769,0.293,1.062,0l14.366-14.34c0.293-0.294,0.293-0.777,0-1.071L21.652,3.211z" fill-rule="evenodd"/></svg>'},buttonCross:function(e,t,o){return'<svg enable-background="new 0 0 24 24" height="14" width="14" viewBox="0 0 24 24" xml:space="preserve" ><path fill="#CE1515" d="M22.245,4.015c0.313,0.313,0.313,0.826,0,1.139l-6.276,6.27c-0.313,0.312-0.313,0.826,0,1.14l6.273,6.272  c0.313,0.313,0.313,0.826,0,1.14l-2.285,2.277c-0.314,0.312-0.828,0.312-1.142,0l-6.271-6.271c-0.313-0.313-0.828-0.313-1.141,0  l-6.276,6.267c-0.313,0.313-0.828,0.313-1.141,0l-2.282-2.28c-0.313-0.313-0.313-0.826,0-1.14l6.278-6.269  c0.313-0.312,0.313-0.826,0-1.14L1.709,5.147c-0.314-0.313-0.314-0.827,0-1.14l2.284-2.278C4.308,1.417,4.821,1.417,5.135,1.73  L11.405,8c0.314,0.314,0.828,0.314,1.141,0.001l6.276-6.267c0.312-0.312,0.826-0.312,1.141,0L22.245,4.015z"/></svg>'},rownum:function(e,t,o){return this.table.rowManager.activeRows.indexOf(e.getRow()._getSelf())+1},handle:function(e,t,o){return e.getElement().classList.add("tabulator-row-handle"),"<div class='tabulator-row-handle-box'><div class='tabulator-row-handle-bar'></div><div class='tabulator-row-handle-bar'></div><div class='tabulator-row-handle-bar'></div></div>"},responsiveCollapse:function(e,t,o){function i(e){var t=s.element;s.open=e,t&&(s.open?(n.classList.add("open"),t.style.display=""):(n.classList.remove("open"),t.style.display="none"))}var n=document.createElement("div"),s=e.getRow()._row.modules.responsiveLayout;return n.classList.add("tabulator-responsive-collapse-toggle"),n.innerHTML="<span class='tabulator-responsive-collapse-toggle-open'>+</span><span class='tabulator-responsive-collapse-toggle-close'>-</span>",e.getElement().classList.add("tabulator-row-handle"),n.addEventListener("click",function(e){e.stopImmediatePropagation(),i(!s.open)}),i(s.open),n},rowSelection:function(e,t,o){var i=this,n=document.createElement("input");if(n.type="checkbox",this.table.modExists("selectRow",!0))if(n.addEventListener("click",function(e){e.stopPropagation()}),"function"==typeof e.getRow){var s=e.getRow();s instanceof r?(n.addEventListener("change",function(e){s.toggleSelect()}),n.checked=s.isSelected&&s.isSelected(),this.table.modules.selectRow.registerRowSelectCheckbox(s,n)):n=""}else n.addEventListener("change",function(e){i.table.modules.selectRow.selectedRows.length?i.table.deselectRow():i.table.selectRow(t.rowRange)}),this.table.modules.selectRow.registerHeaderSelectCheckbox(n);return n}},h.prototype.registerModule("format",T);var k=function(e){this.table=e,this.leftColumns=[],this.rightColumns=[],this.leftMargin=0,this.rightMargin=0,this.rightPadding=0,this.initializationMode="left",this.active=!1,this.scrollEndTimer=!1};k.prototype.reset=function(){this.initializationMode="left",this.leftColumns=[],this.rightColumns=[],this.leftMargin=0,this.rightMargin=0,this.rightMargin=0,this.active=!1,this.table.columnManager.headersElement.style.marginLeft=0,this.table.columnManager.element.style.paddingRight=0},k.prototype.initializeColumn=function(e){var t={margin:0,edge:!1};e.isGroup||(this.frozenCheck(e)?(t.position=this.initializationMode,"left"==this.initializationMode?this.leftColumns.push(e):this.rightColumns.unshift(e),this.active=!0,e.modules.frozen=t):this.initializationMode="right")},k.prototype.frozenCheck=function(e){return e.parent.isGroup&&e.definition.frozen&&console.warn("Frozen Column Error - Parent column group must be frozen, not individual columns or sub column groups"),e.parent.isGroup?this.frozenCheck(e.parent):e.definition.frozen},k.prototype.scrollHorizontal=function(){var e,t=this;this.active&&(clearTimeout(this.scrollEndTimer),this.scrollEndTimer=setTimeout(function(){t.layout()},100),e=this.table.rowManager.getVisibleRows(),this.calcMargins(),this.layoutColumnPosition(),this.layoutCalcRows(),e.forEach(function(e){"row"===e.type&&t.layoutRow(e)}),this.table.rowManager.tableElement.style.marginRight=this.rightMargin)},k.prototype.calcMargins=function(){this.leftMargin=this._calcSpace(this.leftColumns,this.leftColumns.length)+"px",this.table.columnManager.headersElement.style.marginLeft=this.leftMargin,this.rightMargin=this._calcSpace(this.rightColumns,this.rightColumns.length)+"px",this.table.columnManager.element.style.paddingRight=this.rightMargin,this.rightPadding=this.table.rowManager.element.clientWidth+this.table.columnManager.scrollLeft},k.prototype.layoutCalcRows=function(){this.table.modExists("columnCalcs")&&(this.table.modules.columnCalcs.topInitialized&&this.table.modules.columnCalcs.topRow&&this.layoutRow(this.table.modules.columnCalcs.topRow),this.table.modules.columnCalcs.botInitialized&&this.table.modules.columnCalcs.botRow&&this.layoutRow(this.table.modules.columnCalcs.botRow))},k.prototype.layoutColumnPosition=function(e){var t=this,o=[];this.leftColumns.forEach(function(i,n){if(i.modules.frozen.margin=t._calcSpace(t.leftColumns,n)+t.table.columnManager.scrollLeft+"px",n==t.leftColumns.length-1?i.modules.frozen.edge=!0:i.modules.frozen.edge=!1,i.parent.isGroup){var s=t.getColGroupParentElement(i);o.includes(s)||(t.layoutElement(s,i),o.push(s)),i.modules.frozen.edge&&s.classList.add("tabulator-frozen-"+i.modules.frozen.position)}else t.layoutElement(i.getElement(),i);e&&i.cells.forEach(function(e){t.layoutElement(e.getElement(!0),i)})}),this.rightColumns.forEach(function(o,i){o.modules.frozen.margin=t.rightPadding-t._calcSpace(t.rightColumns,i+1)+"px",i==t.rightColumns.length-1?o.modules.frozen.edge=!0:o.modules.frozen.edge=!1,o.parent.isGroup?t.layoutElement(t.getColGroupParentElement(o),o):t.layoutElement(o.getElement(),o),e&&o.cells.forEach(function(e){t.layoutElement(e.getElement(!0),o)})})},k.prototype.getColGroupParentElement=function(e){return e.parent.isGroup?this.getColGroupParentElement(e.parent):e.getElement()},k.prototype.layout=function(){var e=this;e.active&&(this.calcMargins(),e.table.rowManager.getDisplayRows().forEach(function(t){"row"===t.type&&e.layoutRow(t)}),this.layoutCalcRows(),this.layoutColumnPosition(!0),this.table.rowManager.tableElement.style.marginRight=this.rightMargin)},k.prototype.layoutRow=function(e){var t=this;e.getElement().style.paddingLeft=this.leftMargin,this.leftColumns.forEach(function(o){var i=e.getCell(o);i&&t.layoutElement(i.getElement(!0),o)}),this.rightColumns.forEach(function(o){var i=e.getCell(o);i&&t.layoutElement(i.getElement(!0),o)})},k.prototype.layoutElement=function(e,t){t.modules.frozen&&(e.style.position="absolute",e.style.left=t.modules.frozen.margin,e.classList.add("tabulator-frozen"),t.modules.frozen.edge&&e.classList.add("tabulator-frozen-"+t.modules.frozen.position))},k.prototype._calcSpace=function(e,t){for(var o=0,i=0;i<t;i++)e[i].visible&&(o+=e[i].getWidth());return o},h.prototype.registerModule("frozenColumns",k);var z=function(e){this.table=e,this.topElement=document.createElement("div"),this.rows=[],this.displayIndex=0};z.prototype.initialize=function(){this.rows=[],this.topElement.classList.add("tabulator-frozen-rows-holder"),this.table.columnManager.getElement().insertBefore(this.topElement,this.table.columnManager.headersElement.nextSibling)},z.prototype.setDisplayIndex=function(e){this.displayIndex=e},z.prototype.getDisplayIndex=function(){return this.displayIndex},z.prototype.isFrozen=function(){return!!this.rows.length},z.prototype.getRows=function(e){var t=e.slice(0);return this.rows.forEach(function(e){var o=t.indexOf(e);o>-1&&t.splice(o,1)}),t},z.prototype.freezeRow=function(e){e.modules.frozen?console.warn("Freeze Error - Row is already frozen"):(e.modules.frozen=!0,this.topElement.appendChild(e.getElement()),e.initialize(),e.normalizeHeight(),this.table.rowManager.adjustTableSize(),this.rows.push(e),this.table.rowManager.refreshActiveData("display"),this.styleRows())},z.prototype.unfreezeRow=function(e){this.rows.indexOf(e);e.modules.frozen?(e.modules.frozen=!1,this.detachRow(e),this.table.rowManager.adjustTableSize(),this.table.rowManager.refreshActiveData("display"),this.rows.length&&this.styleRows()):console.warn("Freeze Error - Row is already unfrozen")},z.prototype.detachRow=function(e){var t=this.rows.indexOf(e);if(t>-1){var o=e.getElement();o.parentNode.removeChild(o),this.rows.splice(t,1)}},z.prototype.styleRows=function(e){var t=this;this.rows.forEach(function(e,o){t.table.rowManager.styleRow(e,o)})},h.prototype.registerModule("frozenRows",z);var S=function(e){this._group=e,this.type="GroupComponent"};S.prototype.getKey=function(){return this._group.key},S.prototype.getField=function(){return this._group.field},S.prototype.getElement=function(){return this._group.element},S.prototype.getRows=function(){return this._group.getRows(!0)},S.prototype.getSubGroups=function(){return this._group.getSubGroups(!0)},S.prototype.getParentGroup=function(){return!!this._group.parent&&this._group.parent.getComponent()},S.prototype.getVisibility=function(){return console.warn("getVisibility function is deprecated, you should now use the isVisible function"),this._group.visible},S.prototype.isVisible=function(){return this._group.visible},S.prototype.show=function(){this._group.show()},S.prototype.hide=function(){this._group.hide()},S.prototype.toggle=function(){this._group.toggleVisibility()},S.prototype._getSelf=function(){return this._group},S.prototype.getTable=function(){return this._group.groupManager.table};var H=function(e,t,o,i,n,s,a){this.groupManager=e,this.parent=t,this.key=i,this.level=o,this.field=n,this.hasSubGroups=o<e.groupIDLookups.length-1,this.addRow=this.hasSubGroups?this._addRowToGroup:this._addRow,this.type="group",this.old=a,this.rows=[],this.groups=[],this.groupList=[],this.generator=s,this.elementContents=!1,this.height=0,this.outerHeight=0,this.initialized=!1,this.calcs={},this.initialized=!1,this.modules={},this.arrowElement=!1,this.visible=a?a.visible:void 0!==e.startOpen[o]?e.startOpen[o]:e.startOpen[0],this.component=null,this.createElements(),this.addBindings(),this.createValueGroups()};H.prototype.wipe=function(){this.groupList.length?this.groupList.forEach(function(e){e.wipe()}):(this.element=!1,this.arrowElement=!1,this.elementContents=!1)
	},H.prototype.createElements=function(){var e=document.createElement("div");e.classList.add("tabulator-arrow"),this.element=document.createElement("div"),this.element.classList.add("tabulator-row"),this.element.classList.add("tabulator-group"),this.element.classList.add("tabulator-group-level-"+this.level),this.element.setAttribute("role","rowgroup"),this.arrowElement=document.createElement("div"),this.arrowElement.classList.add("tabulator-group-toggle"),this.arrowElement.appendChild(e),!1!==this.groupManager.table.options.movableRows&&this.groupManager.table.modExists("moveRow")&&this.groupManager.table.modules.moveRow.initializeGroupHeader(this)},H.prototype.createValueGroups=function(){var e=this,t=this.level+1;this.groupManager.allowedValues&&this.groupManager.allowedValues[t]&&this.groupManager.allowedValues[t].forEach(function(o){e._createGroup(o,t)})},H.prototype.addBindings=function(){var e,t,o,i,n=this;n.groupManager.table.options.groupClick&&n.element.addEventListener("click",function(e){n.groupManager.table.options.groupClick.call(n.groupManager.table,e,n.getComponent())}),n.groupManager.table.options.groupDblClick&&n.element.addEventListener("dblclick",function(e){n.groupManager.table.options.groupDblClick.call(n.groupManager.table,e,n.getComponent())}),n.groupManager.table.options.groupContext&&n.element.addEventListener("contextmenu",function(e){n.groupManager.table.options.groupContext.call(n.groupManager.table,e,n.getComponent())}),(n.groupManager.table.options.groupContextMenu||n.groupManager.table.options.groupClickMenu)&&n.groupManager.table.modExists("menu")&&n.groupManager.table.modules.menu.initializeGroup.call(n.groupManager.table.modules.menu,n),n.groupManager.table.options.groupTap&&(o=!1,n.element.addEventListener("touchstart",function(e){o=!0},{passive:!0}),n.element.addEventListener("touchend",function(e){o&&n.groupManager.table.options.groupTap(e,n.getComponent()),o=!1})),n.groupManager.table.options.groupDblTap&&(e=null,n.element.addEventListener("touchend",function(t){e?(clearTimeout(e),e=null,n.groupManager.table.options.groupDblTap(t,n.getComponent())):e=setTimeout(function(){clearTimeout(e),e=null},300)})),n.groupManager.table.options.groupTapHold&&(t=null,n.element.addEventListener("touchstart",function(e){clearTimeout(t),t=setTimeout(function(){clearTimeout(t),t=null,o=!1,n.groupManager.table.options.groupTapHold(e,n.getComponent())},1e3)},{passive:!0}),n.element.addEventListener("touchend",function(e){clearTimeout(t),t=null})),n.groupManager.table.options.groupToggleElement&&(i="arrow"==n.groupManager.table.options.groupToggleElement?n.arrowElement:n.element,i.addEventListener("click",function(e){e.stopPropagation(),e.stopImmediatePropagation(),n.toggleVisibility()}))},H.prototype._createGroup=function(e,t){var o=t+"_"+e,i=new H(this.groupManager,this,t,e,this.groupManager.groupIDLookups[t].field,this.groupManager.headerGenerator[t]||this.groupManager.headerGenerator[0],!!this.old&&this.old.groups[o]);this.groups[o]=i,this.groupList.push(i)},H.prototype._addRowToGroup=function(e){var t=this.level+1;if(this.hasSubGroups){var o=this.groupManager.groupIDLookups[t].func(e.getData()),i=t+"_"+o;this.groupManager.allowedValues&&this.groupManager.allowedValues[t]?this.groups[i]&&this.groups[i].addRow(e):(this.groups[i]||this._createGroup(o,t),this.groups[i].addRow(e))}},H.prototype._addRow=function(e){this.rows.push(e),e.modules.group=this},H.prototype.insertRow=function(e,t,o){var i=this.conformRowData({});e.updateData(i);var n=this.rows.indexOf(t);n>-1?o?this.rows.splice(n+1,0,e):this.rows.splice(n,0,e):o?this.rows.push(e):this.rows.unshift(e),e.modules.group=this,this.generateGroupHeaderContents(),this.groupManager.table.modExists("columnCalcs")&&"table"!=this.groupManager.table.options.columnCalcs&&this.groupManager.table.modules.columnCalcs.recalcGroup(this),this.groupManager.updateGroupRows(!0)},H.prototype.scrollHeader=function(e){this.arrowElement.style.marginLeft=e,this.groupList.forEach(function(t){t.scrollHeader(e)})},H.prototype.getRowIndex=function(e){},H.prototype.conformRowData=function(e){return this.field?e[this.field]=this.key:console.warn("Data Conforming Error - Cannot conform row data to match new group as groupBy is a function"),this.parent&&(e=this.parent.conformRowData(e)),e},H.prototype.removeRow=function(e){var t=this.rows.indexOf(e),o=e.getElement();t>-1&&this.rows.splice(t,1),this.groupManager.table.options.groupValues||this.rows.length?(o.parentNode&&o.parentNode.removeChild(o),this.generateGroupHeaderContents(),this.groupManager.table.modExists("columnCalcs")&&"table"!=this.groupManager.table.options.columnCalcs&&this.groupManager.table.modules.columnCalcs.recalcGroup(this)):(this.parent?this.parent.removeGroup(this):this.groupManager.removeGroup(this),this.groupManager.updateGroupRows(!0))},H.prototype.removeGroup=function(e){var t,o=e.level+"_"+e.key;this.groups[o]&&(delete this.groups[o],t=this.groupList.indexOf(e),t>-1&&this.groupList.splice(t,1),this.groupList.length||(this.parent?this.parent.removeGroup(this):this.groupManager.removeGroup(this)))},H.prototype.getHeadersAndRows=function(e){var t=[];return t.push(this),this._visSet(),this.visible?this.groupList.length?this.groupList.forEach(function(o){t=t.concat(o.getHeadersAndRows(e))}):(!e&&"table"!=this.groupManager.table.options.columnCalcs&&this.groupManager.table.modExists("columnCalcs")&&this.groupManager.table.modules.columnCalcs.hasTopCalcs()&&(this.calcs.top&&(this.calcs.top.detachElement(),this.calcs.top.deleteCells()),this.calcs.top=this.groupManager.table.modules.columnCalcs.generateTopRow(this.rows),t.push(this.calcs.top)),t=t.concat(this.rows),!e&&"table"!=this.groupManager.table.options.columnCalcs&&this.groupManager.table.modExists("columnCalcs")&&this.groupManager.table.modules.columnCalcs.hasBottomCalcs()&&(this.calcs.bottom&&(this.calcs.bottom.detachElement(),this.calcs.bottom.deleteCells()),this.calcs.bottom=this.groupManager.table.modules.columnCalcs.generateBottomRow(this.rows),t.push(this.calcs.bottom))):this.groupList.length||"table"==this.groupManager.table.options.columnCalcs||this.groupManager.table.modExists("columnCalcs")&&(!e&&this.groupManager.table.modules.columnCalcs.hasTopCalcs()&&(this.calcs.top&&(this.calcs.top.detachElement(),this.calcs.top.deleteCells()),this.groupManager.table.options.groupClosedShowCalcs&&(this.calcs.top=this.groupManager.table.modules.columnCalcs.generateTopRow(this.rows),t.push(this.calcs.top))),!e&&this.groupManager.table.modules.columnCalcs.hasBottomCalcs()&&(this.calcs.bottom&&(this.calcs.bottom.detachElement(),this.calcs.bottom.deleteCells()),this.groupManager.table.options.groupClosedShowCalcs&&(this.calcs.bottom=this.groupManager.table.modules.columnCalcs.generateBottomRow(this.rows),t.push(this.calcs.bottom)))),t},H.prototype.getData=function(e,t){var o=[];return this._visSet(),(!e||e&&this.visible)&&this.rows.forEach(function(e){o.push(e.getData(t||"data"))}),o},H.prototype.getRowCount=function(){var e=0;return this.groupList.length?this.groupList.forEach(function(t){e+=t.getRowCount()}):e=this.rows.length,e},H.prototype.toggleVisibility=function(){this.visible?this.hide():this.show()},H.prototype.hide=function(){this.visible=!1,"classic"!=this.groupManager.table.rowManager.getRenderMode()||this.groupManager.table.options.pagination?this.groupManager.updateGroupRows(!0):(this.element.classList.remove("tabulator-group-visible"),this.groupList.length?this.groupList.forEach(function(e){e.getHeadersAndRows().forEach(function(e){e.detachElement()})}):this.rows.forEach(function(e){var t=e.getElement();t.parentNode.removeChild(t)}),this.groupManager.table.rowManager.setDisplayRows(this.groupManager.updateGroupRows(),this.groupManager.getDisplayIndex()),this.groupManager.table.rowManager.checkClassicModeGroupHeaderWidth()),this.groupManager.table.options.groupVisibilityChanged.call(this.table,this.getComponent(),!1)},H.prototype.show=function(){var e=this;if(e.visible=!0,"classic"!=this.groupManager.table.rowManager.getRenderMode()||this.groupManager.table.options.pagination)this.groupManager.updateGroupRows(!0);else{this.element.classList.add("tabulator-group-visible");var t=e.getElement();this.groupList.length?this.groupList.forEach(function(e){e.getHeadersAndRows().forEach(function(e){var o=e.getElement();t.parentNode.insertBefore(o,t.nextSibling),e.initialize(),t=o})}):e.rows.forEach(function(e){var o=e.getElement();t.parentNode.insertBefore(o,t.nextSibling),e.initialize(),t=o}),this.groupManager.table.rowManager.setDisplayRows(this.groupManager.updateGroupRows(),this.groupManager.getDisplayIndex()),this.groupManager.table.rowManager.checkClassicModeGroupHeaderWidth()}this.groupManager.table.options.groupVisibilityChanged.call(this.table,this.getComponent(),!0)},H.prototype._visSet=function(){var e=[];"function"==typeof this.visible&&(this.rows.forEach(function(t){e.push(t.getData())}),this.visible=this.visible(this.key,this.getRowCount(),e,this.getComponent()))},H.prototype.getRowGroup=function(e){var t=!1;return this.groupList.length?this.groupList.forEach(function(o){var i=o.getRowGroup(e);i&&(t=i)}):this.rows.find(function(t){return t===e})&&(t=this),t},H.prototype.getSubGroups=function(e){var t=[];return this.groupList.forEach(function(o){t.push(e?o.getComponent():o)}),t},H.prototype.getRows=function(e){var t=[];return this.rows.forEach(function(o){t.push(e?o.getComponent():o)}),t},H.prototype.generateGroupHeaderContents=function(){var e=[];for(this.rows.forEach(function(t){e.push(t.getData())}),this.elementContents=this.generator(this.key,this.getRowCount(),e,this.getComponent());this.element.firstChild;)this.element.removeChild(this.element.firstChild);"string"==typeof this.elementContents?this.element.innerHTML=this.elementContents:this.element.appendChild(this.elementContents),this.element.insertBefore(this.arrowElement,this.element.firstChild)},H.prototype.getPath=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.unshift(this.key),this.parent&&this.parent.getPath(e),e},H.prototype.getElement=function(){this.addBindingsd=!1,this._visSet(),this.visible?this.element.classList.add("tabulator-group-visible"):this.element.classList.remove("tabulator-group-visible");for(var e=0;e<this.element.childNodes.length;++e)this.element.childNodes[e].parentNode.removeChild(this.element.childNodes[e]);return this.generateGroupHeaderContents(),this.element},H.prototype.detachElement=function(){this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)},H.prototype.normalizeHeight=function(){this.setHeight(this.element.clientHeight)},H.prototype.initialize=function(e){this.initialized&&!e||(this.normalizeHeight(),this.initialized=!0)},H.prototype.reinitialize=function(){this.initialized=!1,this.height=0,h.prototype.helpers.elVisible(this.element)&&this.initialize(!0)},H.prototype.setHeight=function(e){this.height!=e&&(this.height=e,this.outerHeight=this.element.offsetHeight)},H.prototype.getHeight=function(){return this.outerHeight},H.prototype.getGroup=function(){return this},H.prototype.reinitializeHeight=function(){},H.prototype.calcHeight=function(){},H.prototype.setCellHeight=function(){},H.prototype.clearCellHeight=function(){},H.prototype.getComponent=function(){return this.component||(this.component=new S(this)),this.component};var P=function(e){this.table=e,this.groupIDLookups=!1,this.startOpen=[function(){return!1}],this.headerGenerator=[function(){return""}],this.groupList=[],this.allowedValues=!1,this.groups={},this.displayIndex=0};P.prototype.initialize=function(){var e=this,t=e.table.options.groupBy,o=e.table.options.groupStartOpen,i=e.table.options.groupHeader;if(this.allowedValues=e.table.options.groupValues,Array.isArray(t)&&Array.isArray(i)&&t.length>i.length&&console.warn("Error creating group headers, groupHeader array is shorter than groupBy array"),e.headerGenerator=[function(){return""}],this.startOpen=[function(){return!1}],e.table.modules.localize.bind("groups|item",function(t,o){e.headerGenerator[0]=function(e,i,n){return(void 0===e?"":e)+"<span>("+i+" "+(1===i?t:o.groups.items)+")</span>"}}),this.groupIDLookups=[],Array.isArray(t)||t)this.table.modExists("columnCalcs")&&"table"!=this.table.options.columnCalcs&&"both"!=this.table.options.columnCalcs&&this.table.modules.columnCalcs.removeCalcs();else if(this.table.modExists("columnCalcs")&&"group"!=this.table.options.columnCalcs){var n=this.table.columnManager.getRealColumns();n.forEach(function(t){t.definition.topCalc&&e.table.modules.columnCalcs.initializeTopRow(),t.definition.bottomCalc&&e.table.modules.columnCalcs.initializeBottomRow()})}Array.isArray(t)||(t=[t]),t.forEach(function(t,o){var i,n;"function"==typeof t?i=t:(n=e.table.columnManager.getColumnByField(t),i=n?function(e){return n.getFieldValue(e)}:function(e){return e[t]}),e.groupIDLookups.push({field:"function"!=typeof t&&t,func:i,values:!!e.allowedValues&&e.allowedValues[o]})}),o&&(Array.isArray(o)||(o=[o]),o.forEach(function(e){e="function"==typeof e?e:function(){return!0}}),e.startOpen=o),i&&(e.headerGenerator=Array.isArray(i)?i:[i]),this.initialized=!0},P.prototype.setDisplayIndex=function(e){this.displayIndex=e},P.prototype.getDisplayIndex=function(){return this.displayIndex},P.prototype.getRows=function(e){return this.groupIDLookups.length?(this.table.options.dataGrouping.call(this.table),this.generateGroups(e),this.table.options.dataGrouped&&this.table.options.dataGrouped.call(this.table,this.getGroups(!0)),this.updateGroupRows()):e.slice(0)},P.prototype.getGroups=function(e){var t=[];return this.groupList.forEach(function(o){t.push(e?o.getComponent():o)}),t},P.prototype.getChildGroups=function(e){var t=this,o=[];return e||(e=this),e.groupList.forEach(function(e){e.groupList.length?o=o.concat(t.getChildGroups(e)):o.push(e)}),o},P.prototype.wipe=function(){this.groupList.forEach(function(e){e.wipe()})},P.prototype.pullGroupListData=function(e){var t=this,o=[];return e.forEach(function(e){var i={};i.level=0,i.rowCount=0,i.headerContent="";var n=[];e.hasSubGroups?(n=t.pullGroupListData(e.groupList),i.level=e.level,i.rowCount=n.length-e.groupList.length,i.headerContent=e.generator(e.key,i.rowCount,e.rows,e),o.push(i),o=o.concat(n)):(i.level=e.level,i.headerContent=e.generator(e.key,e.rows.length,e.rows,e),i.rowCount=e.getRows().length,o.push(i),e.getRows().forEach(function(e){o.push(e.getData("data"))}))}),o},P.prototype.getGroupedData=function(){return this.pullGroupListData(this.groupList)},P.prototype.getRowGroup=function(e){var t=!1;return this.groupList.forEach(function(o){var i=o.getRowGroup(e);i&&(t=i)}),t},P.prototype.countGroups=function(){return this.groupList.length},P.prototype.generateGroups=function(e){var t=this,o=t.groups;t.groups={},t.groupList=[],this.allowedValues&&this.allowedValues[0]?(this.allowedValues[0].forEach(function(e){t.createGroup(e,0,o)}),e.forEach(function(e){t.assignRowToExistingGroup(e,o)})):e.forEach(function(e){t.assignRowToGroup(e,o)})},P.prototype.createGroup=function(e,t,o){var i,n=t+"_"+e;o=o||[],i=new H(this,!1,t,e,this.groupIDLookups[0].field,this.headerGenerator[0],o[n]),this.groups[n]=i,this.groupList.push(i)},P.prototype.assignRowToExistingGroup=function(e,t){var o=this.groupIDLookups[0].func(e.getData()),i="0_"+o;this.groups[i]&&this.groups[i].addRow(e)},P.prototype.assignRowToGroup=function(e,t){var o=this.groupIDLookups[0].func(e.getData()),i=!this.groups["0_"+o];return i&&this.createGroup(o,0,t),this.groups["0_"+o].addRow(e),!i},P.prototype.reassignRowToGroup=function(e){var t=e.getGroup(),o=t.getPath(),i=this.getExpectedPath(e);o.length==i.length&&o.every(function(e,t){return e===i[t]})||(t.removeRow(e),this.assignRowToGroup(e,self.groups),this.table.rowManager.refreshActiveData("group",!1,!0))},P.prototype.getExpectedPath=function(e){var t=[],o=e.getData();return this.groupIDLookups.forEach(function(e){t.push(e.func(o))}),t},P.prototype.updateGroupRows=function(e){var t=this,o=[];if(t.groupList.forEach(function(e){o=o.concat(e.getHeadersAndRows())}),e){var i=t.table.rowManager.setDisplayRows(o,this.getDisplayIndex());!0!==i&&this.setDisplayIndex(i),t.table.rowManager.refreshActiveData("group",!0,!0)}return o},P.prototype.scrollHeaders=function(e){this.table.options.virtualDomHoz&&(e-=this.table.vdomHoz.vDomPadLeft),e+="px",this.groupList.forEach(function(t){t.scrollHeader(e)})},P.prototype.removeGroup=function(e){var t,o=e.level+"_"+e.key;this.groups[o]&&(delete this.groups[o],(t=this.groupList.indexOf(e))>-1&&this.groupList.splice(t,1))},h.prototype.registerModule("groupRows",P);var A=function(e){this.table=e,this.history=[],this.index=-1};A.prototype.clear=function(){this.history=[],this.index=-1},A.prototype.action=function(e,t,o){this.history=this.history.slice(0,this.index+1),this.history.push({type:e,component:t,data:o}),this.index++},A.prototype.getHistoryUndoSize=function(){return this.index+1},A.prototype.getHistoryRedoSize=function(){return this.history.length-(this.index+1)},A.prototype.clearComponentHistory=function(e){var t=this.history.findIndex(function(t){return t.component===e});t>-1&&(this.history.splice(t,1),t<=this.index&&this.index--,this.clearComponentHistory(e))},A.prototype.undo=function(){if(this.index>-1){var e=this.history[this.index];return this.undoers[e.type].call(this,e),this.index--,this.table.options.historyUndo.call(this.table,e.type,e.component.getComponent(),e.data),!0}return console.warn("History Undo Error - No more history to undo"),!1},A.prototype.redo=function(){if(this.history.length-1>this.index){this.index++;var e=this.history[this.index];return this.redoers[e.type].call(this,e),this.table.options.historyRedo.call(this.table,e.type,e.component.getComponent(),e.data),!0}return console.warn("History Redo Error - No more history to redo"),!1},A.prototype.undoers={cellEdit:function(e){e.component.setValueProcessData(e.data.oldValue)},rowAdd:function(e){e.component.deleteActual()},rowDelete:function(e){var t=this.table.rowManager.addRowActual(e.data.data,e.data.pos,e.data.index);this.table.options.groupBy&&this.table.modExists("groupRows")&&this.table.modules.groupRows.updateGroupRows(!0),this._rebindRow(e.component,t)},rowMove:function(e){this.table.rowManager.moveRowActual(e.component,this.table.rowManager.rows[e.data.posFrom],!e.data.after),this.table.rowManager.redraw()}},A.prototype.redoers={cellEdit:function(e){e.component.setValueProcessData(e.data.newValue)},rowAdd:function(e){var t=this.table.rowManager.addRowActual(e.data.data,e.data.pos,e.data.index);this.table.options.groupBy&&this.table.modExists("groupRows")&&this.table.modules.groupRows.updateGroupRows(!0),this._rebindRow(e.component,t)},rowDelete:function(e){e.component.deleteActual()},rowMove:function(e){this.table.rowManager.moveRowActual(e.component,this.table.rowManager.rows[e.data.posTo],e.data.after),this.table.rowManager.redraw()}},A.prototype._rebindRow=function(e,t){this.history.forEach(function(o){if(o.component instanceof l)o.component===e&&(o.component=t);else if(o.component instanceof u&&o.component.row===e){var i=o.component.column.getField();i&&(o.component=t.getCell(i))}})},h.prototype.registerModule("history",A);var _=function(e){this.table=e,this.fieldIndex=[],this.hasIndex=!1};_.prototype.parseTable=function(){var e=this,t=e.table.element,o=e.table.options,i=(o.columns,t.getElementsByTagName("th")),n=t.getElementsByTagName("tbody")[0],s=[];e.hasIndex=!1,e.table.options.htmlImporting.call(this.table),n=n?n.getElementsByTagName("tr"):[],e._extractOptions(t,o),i.length?e._extractHeaders(i,n):e._generateBlankHeaders(i,n);for(var a=0;a<n.length;a++){var r=n[a],l=r.getElementsByTagName("td"),c={};e.hasIndex||(c[o.index]=a);for(var u=0;u<l.length;u++){var d=l[u];void 0!==this.fieldIndex[u]&&(c[this.fieldIndex[u]]=d.innerHTML)}s.push(c)}var h=document.createElement("div"),p=t.attributes;for(var u in p)"object"==_typeof(p[u])&&h.setAttribute(p[u].name,p[u].value);t.parentNode.replaceChild(h,t),o.data=s,e.table.options.htmlImported.call(this.table),this.table.element=h},_.prototype._extractOptions=function(e,t,o){var i=e.attributes,n=o?Object.assign([],o):Object.keys(t),s={};n.forEach(function(e){s[e.toLowerCase()]=e});for(var a in i){var r,l=i[a];l&&"object"==(void 0===l?"undefined":_typeof(l))&&l.name&&0===l.name.indexOf("tabulator-")&&(r=l.name.replace("tabulator-",""),void 0!==s[r]&&(t[s[r]]=this._attribValue(l.value)))}},_.prototype._attribValue=function(e){return"true"===e||"false"!==e&&e},_.prototype._findCol=function(e){return this.table.options.columns.find(function(t){return t.title===e})||!1},_.prototype._extractHeaders=function(e,t){for(var o=0;o<e.length;o++){var i,s=e[o],a=!1,r=this._findCol(s.textContent);r?a=!0:r={title:s.textContent.trim()},r.field||(r.field=s.textContent.trim().toLowerCase().replace(" ","_")),i=s.getAttribute("width"),i&&!r.width&&(r.width=i),s.attributes,this._extractOptions(s,r,n.prototype.defaultOptionList),this.fieldIndex[o]=r.field,r.field==this.table.options.index&&(this.hasIndex=!0),a||this.table.options.columns.push(r)}},_.prototype._generateBlankHeaders=function(e,t){for(var o=0;o<e.length;o++){var i=e[o],n={title:"",field:"col"+o};this.fieldIndex[o]=n.field;var s=i.getAttribute("width");s&&(n.width=s),this.table.options.columns.push(n)}},h.prototype.registerModule("htmlTableImport",_);var F=function(e){this.table=e,this.watchKeys=null,this.pressedKeys=null,this.keyupBinding=!1,this.keydownBinding=!1};F.prototype.initialize=function(){var e=this.table.options.keybindings,t={};if(this.watchKeys={},this.pressedKeys=[],!1!==e){for(var o in this.bindings)t[o]=this.bindings[o];if(Object.keys(e).length)for(var i in e)t[i]=e[i];this.mapBindings(t),this.bindEvents()}},F.prototype.mapBindings=function(e){var t=this,o=this;for(var i in e)!function(i){t.actions[i]?e[i]&&("object"!==_typeof(e[i])&&(e[i]=[e[i]]),e[i].forEach(function(e){o.mapBinding(i,e)})):console.warn("Key Binding Error - no such action:",i)}(i)},F.prototype.mapBinding=function(e,t){var o=this,i={action:this.actions[e],keys:[],ctrl:!1,shift:!1,meta:!1};t.toString().toLowerCase().split(" ").join("").split("+").forEach(function(e){switch(e){case"ctrl":i.ctrl=!0;break;case"shift":i.shift=!0;break;case"meta":i.meta=!0;break;default:e=parseInt(e),i.keys.push(e),o.watchKeys[e]||(o.watchKeys[e]=[]),o.watchKeys[e].push(i)}})},F.prototype.bindEvents=function(){var e=this;this.keyupBinding=function(t){var o=t.keyCode,i=e.watchKeys[o];i&&(e.pressedKeys.push(o),i.forEach(function(o){e.checkBinding(t,o)}))},this.keydownBinding=function(t){var o=t.keyCode;if(e.watchKeys[o]){var i=e.pressedKeys.indexOf(o);i>-1&&e.pressedKeys.splice(i,1)}},this.table.element.addEventListener("keydown",this.keyupBinding),this.table.element.addEventListener("keyup",this.keydownBinding)},F.prototype.clearBindings=function(){this.keyupBinding&&this.table.element.removeEventListener("keydown",this.keyupBinding),this.keydownBinding&&this.table.element.removeEventListener("keyup",this.keydownBinding)},F.prototype.checkBinding=function(e,t){var o=this,i=!0;return e.ctrlKey==t.ctrl&&e.shiftKey==t.shift&&e.metaKey==t.meta&&(t.keys.forEach(function(e){-1==o.pressedKeys.indexOf(e)&&(i=!1)}),i&&t.action.call(o,e),!0)},F.prototype.bindings={navPrev:"shift + 9",navNext:9,navUp:38,navDown:40,scrollPageUp:33,scrollPageDown:34,scrollToStart:36,scrollToEnd:35,undo:"ctrl + 90",redo:"ctrl + 89",copyToClipboard:"ctrl + 67"},F.prototype.actions={keyBlock:function(e){e.stopPropagation(),e.preventDefault()},scrollPageUp:function(e){var t=this.table.rowManager,o=t.scrollTop-t.height;t.element.scrollHeight;e.preventDefault(),t.displayRowsCount&&(o>=0?t.element.scrollTop=o:t.scrollToRow(t.getDisplayRows()[0])),this.table.element.focus()},scrollPageDown:function(e){var t=this.table.rowManager,o=t.scrollTop+t.height,i=t.element.scrollHeight;e.preventDefault(),t.displayRowsCount&&(o<=i?t.element.scrollTop=o:t.scrollToRow(t.getDisplayRows()[t.displayRowsCount-1])),this.table.element.focus()},scrollToStart:function(e){var t=this.table.rowManager;e.preventDefault(),t.displayRowsCount&&t.scrollToRow(t.getDisplayRows()[0]),this.table.element.focus()},scrollToEnd:function(e){var t=this.table.rowManager;e.preventDefault(),t.displayRowsCount&&t.scrollToRow(t.getDisplayRows()[t.displayRowsCount-1]),this.table.element.focus()},navPrev:function(e){var t=!1;this.table.modExists("edit")&&(t=this.table.modules.edit.currentCell)&&(e.preventDefault(),t.nav().prev())},navNext:function(e){var t,o=!1,i=this.table.options.tabEndNewRow;this.table.modExists("edit")&&(o=this.table.modules.edit.currentCell)&&(e.preventDefault(),t=o.nav(),t.next()||i&&(o.getElement().firstChild.blur(),i=!0===i?this.table.addRow({}):"function"==typeof i?this.table.addRow(i(o.row.getComponent())):this.table.addRow(Object.assign({},i)),i.then(function(){setTimeout(function(){t.next()})})))},navLeft:function(e){var t=!1;this.table.modExists("edit")&&(t=this.table.modules.edit.currentCell)&&(e.preventDefault(),t.nav().left())},navRight:function(e){var t=!1;this.table.modExists("edit")&&(t=this.table.modules.edit.currentCell)&&(e.preventDefault(),t.nav().right())},navUp:function(e){var t=!1;this.table.modExists("edit")&&(t=this.table.modules.edit.currentCell)&&(e.preventDefault(),t.nav().up())},navDown:function(e){var t=!1;this.table.modExists("edit")&&(t=this.table.modules.edit.currentCell)&&(e.preventDefault(),t.nav().down())},undo:function(e){this.table.options.history&&this.table.modExists("history")&&this.table.modExists("edit")&&(this.table.modules.edit.currentCell||(e.preventDefault(),this.table.modules.history.undo()))},redo:function(e){this.table.options.history&&this.table.modExists("history")&&this.table.modExists("edit")&&(this.table.modules.edit.currentCell||(e.preventDefault(),this.table.modules.history.redo()))},copyToClipboard:function(e){this.table.modules.edit.currentCell||this.table.modExists("clipboard",!0)&&this.table.modules.clipboard.copy(!1,!0)}},h.prototype.registerModule("keybindings",F);var N=function(e){this.table=e,this.menuElements=[],this.blurEvent=this.hideMenu.bind(this),this.escEvent=this.escMenu.bind(this),this.nestedMenuBlock=!1,this.positionReversedX=!1};N.prototype.initializeColumnHeader=function(e){var t,o=this;e.definition.headerContextMenu&&(e.getElement().addEventListener("contextmenu",this.LoadMenuEvent.bind(this,e,e.definition.headerContextMenu)),this.tapHold(e,e.definition.headerContextMenu)),e.definition.headerMenu&&(t=document.createElement("span"),t.classList.add("tabulator-header-menu-button"),t.innerHTML="&vellip;",t.addEventListener("click",function(t){t.stopPropagation(),t.preventDefault(),o.LoadMenuEvent(e,e.definition.headerMenu,t)}),e.titleElement.insertBefore(t,e.titleElement.firstChild))},N.prototype.LoadMenuEvent=function(e,t,o){t="function"==typeof t?t.call(this.table,e.getComponent(),o):t,this.loadMenu(o,e,t)},N.prototype.tapHold=function(e,t){var o=this,i=e.getElement(),n=null,s=!1;i.addEventListener("touchstart",function(i){clearTimeout(n),s=!1,n=setTimeout(function(){clearTimeout(n),n=null,s=!0,o.LoadMenuEvent(e,t,i)},1e3)},{passive:!0}),i.addEventListener("touchend",function(e){clearTimeout(n),n=null,s&&e.preventDefault()})},N.prototype.initializeCell=function(e){e.column.definition.contextMenu&&(e.getElement(!0).addEventListener("contextmenu",this.LoadMenuEvent.bind(this,e,e.column.definition.contextMenu)),this.tapHold(e,e.column.definition.contextMenu)),e.column.definition.clickMenu&&e.getElement(!0).addEventListener("click",this.LoadMenuEvent.bind(this,e,e.column.definition.clickMenu))},N.prototype.initializeRow=function(e){this.table.options.rowContextMenu&&(e.getElement().addEventListener("contextmenu",this.LoadMenuEvent.bind(this,e,this.table.options.rowContextMenu)),this.tapHold(e,this.table.options.rowContextMenu)),this.table.options.rowClickMenu&&e.getElement().addEventListener("click",this.LoadMenuEvent.bind(this,e,this.table.options.rowClickMenu))},N.prototype.initializeGroup=function(e){this.table.options.groupContextMenu&&(e.getElement().addEventListener("contextmenu",this.LoadMenuEvent.bind(this,e,this.table.options.groupContextMenu)),this.tapHold(e,this.table.options.groupContextMenu)),this.table.options.groupClickMenu&&e.getElement().addEventListener("click",this.LoadMenuEvent.bind(this,e,this.table.options.groupClickMenu))},N.prototype.loadMenu=function(e,t,o,i){var n=this,s=!(e instanceof MouseEvent),a=document.createElement("div");if(a.classList.add("tabulator-menu"),s||e.preventDefault(),o&&o.length){if(!i){if(this.nestedMenuBlock){if(this.isOpen())return}else this.nestedMenuBlock=setTimeout(function(){n.nestedMenuBlock=!1},100);this.hideMenu(),this.menuElements=[]}o.forEach(function(e){var o=document.createElement("div"),i=e.label,s=e.disabled;e.separator?o.classList.add("tabulator-menu-separator"):(o.classList.add("tabulator-menu-item"),"function"==typeof i&&(i=i.call(n.table,t.getComponent())),i instanceof Node?o.appendChild(i):o.innerHTML=i,"function"==typeof s&&(s=s.call(n.table,t.getComponent())),s?(o.classList.add("tabulator-menu-item-disabled"),o.addEventListener("click",function(e){e.stopPropagation()})):e.menu&&e.menu.length?o.addEventListener("click",function(i){i.stopPropagation(),n.hideOldSubMenus(a),n.loadMenu(i,t,e.menu,o)}):e.action&&o.addEventListener("click",function(o){e.action(o,t.getComponent())}),e.menu&&e.menu.length&&o.classList.add("tabulator-menu-item-submenu")),a.appendChild(o)}),a.addEventListener("click",function(e){n.hideMenu()}),this.menuElements.push(a),this.positionMenu(a,i,s,e)}},N.prototype.hideOldSubMenus=function(e){var t=this.menuElements.indexOf(e);if(t>-1)for(var o=this.menuElements.length-1;o>t;o--){var i=this.menuElements[o];i.parentNode&&i.parentNode.removeChild(i),this.menuElements.pop()}},N.prototype.positionMenu=function(e,t,o,i){var n,s,a,r=this,l=Math.max(document.body.offsetHeight,window.innerHeight);t?(a=h.prototype.helpers.elOffset(t),n=a.left+t.offsetWidth,s=a.top-1):(n=o?i.touches[0].pageX:i.pageX,s=o?i.touches[0].pageY:i.pageY,this.positionReversedX=!1),e.style.top=s+"px",e.style.left=n+"px",setTimeout(function(){r.table.rowManager.element.addEventListener("scroll",r.blurEvent),document.body.addEventListener("click",r.blurEvent),document.body.addEventListener("contextmenu",r.blurEvent),window.addEventListener("resize",r.blurEvent),document.body.addEventListener("keydown",r.escEvent)},100),document.body.appendChild(e),s+e.offsetHeight>=l&&(e.style.top="",e.style.bottom=t?l-a.top-t.offsetHeight-1+"px":l-s+"px"),(n+e.offsetWidth>=document.body.offsetWidth||this.positionReversedX)&&(e.style.left="",e.style.right=t?document.documentElement.offsetWidth-a.left+"px":document.documentElement.offsetWidth-n+"px",this.positionReversedX=!0)},N.prototype.isOpen=function(){return!!this.menuElements.length},N.prototype.escMenu=function(e){27==e.keyCode&&this.hideMenu()},N.prototype.hideMenu=function(){this.menuElements.forEach(function(e){e.parentNode&&e.parentNode.removeChild(e)}),document.body.removeEventListener("keydown",this.escEvent),document.body.removeEventListener("click",this.blurEvent),document.body.removeEventListener("contextmenu",this.blurEvent),window.removeEventListener("resize",this.blurEvent),this.table.rowManager.element.removeEventListener("scroll",this.blurEvent)},N.prototype.menus={},h.prototype.registerModule("menu",N);var B=function(e){this.table=e,this.placeholderElement=this.createPlaceholderElement(),this.hoverElement=!1,this.checkTimeout=!1,this.checkPeriod=250,this.moving=!1,this.toCol=!1,this.toColAfter=!1,this.startX=0,this.autoScrollMargin=40,this.autoScrollStep=5,this.autoScrollTimeout=!1,this.touchMove=!1,this.moveHover=this.moveHover.bind(this),this.endMove=this.endMove.bind(this)};B.prototype.createPlaceholderElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-col"),e.classList.add("tabulator-col-placeholder"),e},B.prototype.initializeColumn=function(e){
	var t,o=this,i={};e.modules.frozen||(t=e.getElement(),i.mousemove=function(i){e.parent===o.moving.parent&&((o.touchMove?i.touches[0].pageX:i.pageX)-h.prototype.helpers.elOffset(t).left+o.table.columnManager.element.scrollLeft>e.getWidth()/2?o.toCol===e&&o.toColAfter||(t.parentNode.insertBefore(o.placeholderElement,t.nextSibling),o.moveColumn(e,!0)):(o.toCol!==e||o.toColAfter)&&(t.parentNode.insertBefore(o.placeholderElement,t),o.moveColumn(e,!1)))}.bind(o),t.addEventListener("mousedown",function(t){o.touchMove=!1,1===t.which&&(o.checkTimeout=setTimeout(function(){o.startMove(t,e)},o.checkPeriod))}),t.addEventListener("mouseup",function(e){1===e.which&&o.checkTimeout&&clearTimeout(o.checkTimeout)}),o.bindTouchEvents(e)),e.modules.moveColumn=i},B.prototype.bindTouchEvents=function(e){var t,o,i,n,s,a,r,l=this,c=e.getElement(),u=!1;c.addEventListener("touchstart",function(c){l.checkTimeout=setTimeout(function(){l.touchMove=!0,t=e,o=e.nextColumn(),n=o?o.getWidth()/2:0,i=e.prevColumn(),s=i?i.getWidth()/2:0,a=0,r=0,u=!1,l.startMove(c,e)},l.checkPeriod)},{passive:!0}),c.addEventListener("touchmove",function(c){var d,h;l.moving&&(l.moveHover(c),u||(u=c.touches[0].pageX),d=c.touches[0].pageX-u,d>0?o&&d-a>n&&(h=o)!==e&&(u=c.touches[0].pageX,h.getElement().parentNode.insertBefore(l.placeholderElement,h.getElement().nextSibling),l.moveColumn(h,!0)):i&&-d-r>s&&(h=i)!==e&&(u=c.touches[0].pageX,h.getElement().parentNode.insertBefore(l.placeholderElement,h.getElement()),l.moveColumn(h,!1)),h&&(t=h,o=h.nextColumn(),a=n,n=o?o.getWidth()/2:0,i=h.prevColumn(),r=s,s=i?i.getWidth()/2:0))},{passive:!0}),c.addEventListener("touchend",function(e){l.checkTimeout&&clearTimeout(l.checkTimeout),l.moving&&l.endMove(e)})},B.prototype.startMove=function(e,t){var o=t.getElement();this.moving=t,this.startX=(this.touchMove?e.touches[0].pageX:e.pageX)-h.prototype.helpers.elOffset(o).left,this.table.element.classList.add("tabulator-block-select"),this.placeholderElement.style.width=t.getWidth()+"px",this.placeholderElement.style.height=t.getHeight()+"px",o.parentNode.insertBefore(this.placeholderElement,o),o.parentNode.removeChild(o),this.hoverElement=o.cloneNode(!0),this.hoverElement.classList.add("tabulator-moving"),this.table.columnManager.getElement().appendChild(this.hoverElement),this.hoverElement.style.left="0",this.hoverElement.style.bottom="0",this.touchMove||(this._bindMouseMove(),document.body.addEventListener("mousemove",this.moveHover),document.body.addEventListener("mouseup",this.endMove)),this.moveHover(e)},B.prototype._bindMouseMove=function(){this.table.columnManager.columnsByIndex.forEach(function(e){e.modules.moveColumn.mousemove&&e.getElement().addEventListener("mousemove",e.modules.moveColumn.mousemove)})},B.prototype._unbindMouseMove=function(){this.table.columnManager.columnsByIndex.forEach(function(e){e.modules.moveColumn.mousemove&&e.getElement().removeEventListener("mousemove",e.modules.moveColumn.mousemove)})},B.prototype.moveColumn=function(e,t){var o=this.moving.getCells();this.toCol=e,this.toColAfter=t,t?e.getCells().forEach(function(e,t){var i=e.getElement(!0);i.parentNode.insertBefore(o[t].getElement(),i.nextSibling)}):e.getCells().forEach(function(e,t){var i=e.getElement(!0);i.parentNode.insertBefore(o[t].getElement(),i)})},B.prototype.endMove=function(e){(1===e.which||this.touchMove)&&(this._unbindMouseMove(),this.placeholderElement.parentNode.insertBefore(this.moving.getElement(),this.placeholderElement.nextSibling),this.placeholderElement.parentNode.removeChild(this.placeholderElement),this.hoverElement.parentNode.removeChild(this.hoverElement),this.table.element.classList.remove("tabulator-block-select"),this.toCol&&this.table.columnManager.moveColumnActual(this.moving,this.toCol,this.toColAfter),this.moving=!1,this.toCol=!1,this.toColAfter=!1,this.touchMove||(document.body.removeEventListener("mousemove",this.moveHover),document.body.removeEventListener("mouseup",this.endMove)))},B.prototype.moveHover=function(e){var t,o=this,i=o.table.columnManager.getElement(),n=i.scrollLeft,s=(o.touchMove?e.touches[0].pageX:e.pageX)-h.prototype.helpers.elOffset(i).left+n;o.hoverElement.style.left=s-o.startX+"px",s-n<o.autoScrollMargin&&(o.autoScrollTimeout||(o.autoScrollTimeout=setTimeout(function(){t=Math.max(0,n-5),o.table.rowManager.getElement().scrollLeft=t,o.autoScrollTimeout=!1},1))),n+i.clientWidth-s<o.autoScrollMargin&&(o.autoScrollTimeout||(o.autoScrollTimeout=setTimeout(function(){t=Math.min(i.clientWidth,n+5),o.table.rowManager.getElement().scrollLeft=t,o.autoScrollTimeout=!1},1)))},h.prototype.registerModule("moveColumn",B);var O=function(e){this.table=e,this.placeholderElement=this.createPlaceholderElement(),this.hoverElement=!1,this.checkTimeout=!1,this.checkPeriod=150,this.moving=!1,this.toRow=!1,this.toRowAfter=!1,this.hasHandle=!1,this.startY=0,this.startX=0,this.moveHover=this.moveHover.bind(this),this.endMove=this.endMove.bind(this),this.tableRowDropEvent=!1,this.touchMove=!1,this.connection=!1,this.connectionSelectorsTables=!1,this.connectionSelectorsElements=!1,this.connectionElements=[],this.connections=[],this.connectedTable=!1,this.connectedRow=!1};O.prototype.createPlaceholderElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-row"),e.classList.add("tabulator-row-placeholder"),e},O.prototype.initialize=function(e){this.connectionSelectorsTables=this.table.options.movableRowsConnectedTables,this.connectionSelectorsElements=this.table.options.movableRowsConnectedElements,this.connection=this.connectionSelectorsTables||this.connectionSelectorsElements},O.prototype.setHandle=function(e){this.hasHandle=e},O.prototype.initializeGroupHeader=function(e){var t=this,o={};o.mouseup=function(e){t.tableRowDrop(e,row)}.bind(t),o.mousemove=function(o){if(o.pageY-h.prototype.helpers.elOffset(e.element).top+t.table.rowManager.element.scrollTop>e.getHeight()/2){if(t.toRow!==e||!t.toRowAfter){var i=e.getElement();i.parentNode.insertBefore(t.placeholderElement,i.nextSibling),t.moveRow(e,!0)}}else if(t.toRow!==e||t.toRowAfter){var i=e.getElement();i.previousSibling&&(i.parentNode.insertBefore(t.placeholderElement,i),t.moveRow(e,!1))}}.bind(t),e.modules.moveRow=o},O.prototype.initializeRow=function(e){var t,o=this,i={};i.mouseup=function(t){o.tableRowDrop(t,e)}.bind(o),i.mousemove=function(t){var i=e.getElement();t.pageY-h.prototype.helpers.elOffset(i).top+o.table.rowManager.element.scrollTop>e.getHeight()/2?o.toRow===e&&o.toRowAfter||(i.parentNode.insertBefore(o.placeholderElement,i.nextSibling),o.moveRow(e,!0)):(o.toRow!==e||o.toRowAfter)&&(i.parentNode.insertBefore(o.placeholderElement,i),o.moveRow(e,!1))}.bind(o),this.hasHandle||(t=e.getElement(),t.addEventListener("mousedown",function(t){1===t.which&&(o.checkTimeout=setTimeout(function(){o.startMove(t,e)},o.checkPeriod))}),t.addEventListener("mouseup",function(e){1===e.which&&o.checkTimeout&&clearTimeout(o.checkTimeout)}),this.bindTouchEvents(e,e.getElement())),e.modules.moveRow=i},O.prototype.initializeCell=function(e){var t=this,o=e.getElement(!0);o.addEventListener("mousedown",function(o){1===o.which&&(t.checkTimeout=setTimeout(function(){t.startMove(o,e.row)},t.checkPeriod))}),o.addEventListener("mouseup",function(e){1===e.which&&t.checkTimeout&&clearTimeout(t.checkTimeout)}),this.bindTouchEvents(e.row,o)},O.prototype.bindTouchEvents=function(e,t){var o,i,n,s,a,r,l,c=this,u=!1;t.addEventListener("touchstart",function(t){c.checkTimeout=setTimeout(function(){c.touchMove=!0,o=e,i=e.nextRow(),s=i?i.getHeight()/2:0,n=e.prevRow(),a=n?n.getHeight()/2:0,r=0,l=0,u=!1,c.startMove(t,e)},c.checkPeriod)},{passive:!0}),this.moving,this.toRow,this.toRowAfter,t.addEventListener("touchmove",function(t){var d,h;c.moving&&(t.preventDefault(),c.moveHover(t),u||(u=t.touches[0].pageY),d=t.touches[0].pageY-u,d>0?i&&d-r>s&&(h=i)!==e&&(u=t.touches[0].pageY,h.getElement().parentNode.insertBefore(c.placeholderElement,h.getElement().nextSibling),c.moveRow(h,!0)):n&&-d-l>a&&(h=n)!==e&&(u=t.touches[0].pageY,h.getElement().parentNode.insertBefore(c.placeholderElement,h.getElement()),c.moveRow(h,!1)),h&&(o=h,i=h.nextRow(),r=s,s=i?i.getHeight()/2:0,n=h.prevRow(),l=a,a=n?n.getHeight()/2:0))}),t.addEventListener("touchend",function(e){c.checkTimeout&&clearTimeout(c.checkTimeout),c.moving&&(c.endMove(e),c.touchMove=!1)})},O.prototype._bindMouseMove=function(){this.table.rowManager.getDisplayRows().forEach(function(e){"row"!==e.type&&"group"!==e.type||!e.modules.moveRow.mousemove||e.getElement().addEventListener("mousemove",e.modules.moveRow.mousemove)})},O.prototype._unbindMouseMove=function(){this.table.rowManager.getDisplayRows().forEach(function(e){"row"!==e.type&&"group"!==e.type||!e.modules.moveRow.mousemove||e.getElement().removeEventListener("mousemove",e.modules.moveRow.mousemove)})},O.prototype.startMove=function(e,t){var o=t.getElement();this.setStartPosition(e,t),this.moving=t,this.table.element.classList.add("tabulator-block-select"),this.placeholderElement.style.width=t.getWidth()+"px",this.placeholderElement.style.height=t.getHeight()+"px",this.connection?(this.table.element.classList.add("tabulator-movingrow-sending"),this.connectToTables(t)):(o.parentNode.insertBefore(this.placeholderElement,o),o.parentNode.removeChild(o)),this.hoverElement=o.cloneNode(!0),this.hoverElement.classList.add("tabulator-moving"),this.connection?(document.body.appendChild(this.hoverElement),this.hoverElement.style.left="0",this.hoverElement.style.top="0",this.hoverElement.style.width=this.table.element.clientWidth+"px",this.hoverElement.style.whiteSpace="nowrap",this.hoverElement.style.overflow="hidden",this.hoverElement.style.pointerEvents="none"):(this.table.rowManager.getTableElement().appendChild(this.hoverElement),this.hoverElement.style.left="0",this.hoverElement.style.top="0",this._bindMouseMove()),document.body.addEventListener("mousemove",this.moveHover),document.body.addEventListener("mouseup",this.endMove),this.moveHover(e)},O.prototype.setStartPosition=function(e,t){var o,i,n=this.touchMove?e.touches[0].pageX:e.pageX,s=this.touchMove?e.touches[0].pageY:e.pageY;o=t.getElement(),this.connection?(i=o.getBoundingClientRect(),this.startX=i.left-n+window.pageXOffset,this.startY=i.top-s+window.pageYOffset):this.startY=s-o.getBoundingClientRect().top},O.prototype.endMove=function(e){e&&1!==e.which&&!this.touchMove||(this._unbindMouseMove(),this.connection||(this.placeholderElement.parentNode.insertBefore(this.moving.getElement(),this.placeholderElement.nextSibling),this.placeholderElement.parentNode.removeChild(this.placeholderElement)),this.hoverElement.parentNode.removeChild(this.hoverElement),this.table.element.classList.remove("tabulator-block-select"),this.toRow&&this.table.rowManager.moveRow(this.moving,this.toRow,this.toRowAfter),this.moving=!1,this.toRow=!1,this.toRowAfter=!1,document.body.removeEventListener("mousemove",this.moveHover),document.body.removeEventListener("mouseup",this.endMove),this.connection&&(this.table.element.classList.remove("tabulator-movingrow-sending"),this.disconnectFromTables()))},O.prototype.moveRow=function(e,t){this.toRow=e,this.toRowAfter=t},O.prototype.moveHover=function(e){this.connection?this.moveHoverConnections.call(this,e):this.moveHoverTable.call(this,e)},O.prototype.moveHoverTable=function(e){var t=this.table.rowManager.getElement(),o=t.scrollTop,i=(this.touchMove?e.touches[0].pageY:e.pageY)-t.getBoundingClientRect().top+o;this.hoverElement.style.top=i-this.startY+"px"},O.prototype.moveHoverConnections=function(e){this.hoverElement.style.left=this.startX+(this.touchMove?e.touches[0].pageX:e.pageX)+"px",this.hoverElement.style.top=this.startY+(this.touchMove?e.touches[0].pageY:e.pageY)+"px"},O.prototype.elementRowDrop=function(e,t,o){this.table.options.movableRowsElementDrop&&this.table.options.movableRowsElementDrop(e,t,!!o&&o.getComponent())},O.prototype.connectToTables=function(e){var t,o=this;this.connectionSelectorsTables&&(t=this.table.modules.comms.getConnections(this.connectionSelectorsTables),this.table.options.movableRowsSendingStart.call(this.table,t),this.table.modules.comms.send(this.connectionSelectorsTables,"moveRow","connect",{row:e})),this.connectionSelectorsElements&&(this.connectionElements=[],Array.isArray(this.connectionSelectorsElements)||(this.connectionSelectorsElements=[this.connectionSelectorsElements]),this.connectionSelectorsElements.forEach(function(e){"string"==typeof e?o.connectionElements=o.connectionElements.concat(Array.prototype.slice.call(document.querySelectorAll(e))):o.connectionElements.push(e)}),this.connectionElements.forEach(function(e){var t=function(t){o.elementRowDrop(t,e,o.moving)};e.addEventListener("mouseup",t),e.tabulatorElementDropEvent=t,e.classList.add("tabulator-movingrow-receiving")}))},O.prototype.disconnectFromTables=function(){var e;this.connectionSelectorsTables&&(e=this.table.modules.comms.getConnections(this.connectionSelectorsTables),this.table.options.movableRowsSendingStop.call(this.table,e),this.table.modules.comms.send(this.connectionSelectorsTables,"moveRow","disconnect")),this.connectionElements.forEach(function(e){e.classList.remove("tabulator-movingrow-receiving"),e.removeEventListener("mouseup",e.tabulatorElementDropEvent),delete e.tabulatorElementDropEvent})},O.prototype.connect=function(e,t){var o=this;return this.connectedTable?(console.warn("Move Row Error - Table cannot accept connection, already connected to table:",this.connectedTable),!1):(this.connectedTable=e,this.connectedRow=t,this.table.element.classList.add("tabulator-movingrow-receiving"),o.table.rowManager.getDisplayRows().forEach(function(e){"row"===e.type&&e.modules.moveRow&&e.modules.moveRow.mouseup&&e.getElement().addEventListener("mouseup",e.modules.moveRow.mouseup)}),o.tableRowDropEvent=o.tableRowDrop.bind(o),o.table.element.addEventListener("mouseup",o.tableRowDropEvent),this.table.options.movableRowsReceivingStart.call(this.table,t,e),!0)},O.prototype.disconnect=function(e){var t=this;e===this.connectedTable?(this.connectedTable=!1,this.connectedRow=!1,this.table.element.classList.remove("tabulator-movingrow-receiving"),t.table.rowManager.getDisplayRows().forEach(function(e){"row"===e.type&&e.modules.moveRow&&e.modules.moveRow.mouseup&&e.getElement().removeEventListener("mouseup",e.modules.moveRow.mouseup)}),t.table.element.removeEventListener("mouseup",t.tableRowDropEvent),this.table.options.movableRowsReceivingStop.call(this.table,e)):console.warn("Move Row Error - trying to disconnect from non connected table")},O.prototype.dropComplete=function(e,t,o){var i=!1;if(o){switch(_typeof(this.table.options.movableRowsSender)){case"string":i=this.senders[this.table.options.movableRowsSender];break;case"function":i=this.table.options.movableRowsSender}i?i.call(this,this.moving.getComponent(),t?t.getComponent():void 0,e):this.table.options.movableRowsSender&&console.warn("Mover Row Error - no matching sender found:",this.table.options.movableRowsSender),this.table.options.movableRowsSent.call(this.table,this.moving.getComponent(),t?t.getComponent():void 0,e)}else this.table.options.movableRowsSentFailed.call(this.table,this.moving.getComponent(),t?t.getComponent():void 0,e);this.endMove()},O.prototype.tableRowDrop=function(e,t){var o=!1,i=!1;switch(e.stopImmediatePropagation(),_typeof(this.table.options.movableRowsReceiver)){case"string":o=this.receivers[this.table.options.movableRowsReceiver];break;case"function":o=this.table.options.movableRowsReceiver}o?i=o.call(this,this.connectedRow.getComponent(),t?t.getComponent():void 0,this.connectedTable):console.warn("Mover Row Error - no matching receiver found:",this.table.options.movableRowsReceiver),i?this.table.options.movableRowsReceived.call(this.table,this.connectedRow.getComponent(),t?t.getComponent():void 0,this.connectedTable):this.table.options.movableRowsReceivedFailed.call(this.table,this.connectedRow.getComponent(),t?t.getComponent():void 0,this.connectedTable),this.table.modules.comms.send(this.connectedTable,"moveRow","dropcomplete",{row:t,success:i})},O.prototype.receivers={insert:function(e,t,o){return this.table.addRow(e.getData(),void 0,t),!0},add:function(e,t,o){return this.table.addRow(e.getData()),!0},update:function(e,t,o){return!!t&&(t.update(e.getData()),!0)},replace:function(e,t,o){return!!t&&(this.table.addRow(e.getData(),void 0,t),t.delete(),!0)}},O.prototype.senders={delete:function(e,t,o){e.delete()}},O.prototype.commsReceived=function(e,t,o){switch(t){case"connect":return this.connect(e,o.row);case"disconnect":return this.disconnect(e);case"dropcomplete":return this.dropComplete(e,o.row,o.success)}},h.prototype.registerModule("moveRow",O);var I=function(e){this.table=e,this.allowedTypes=["","data","edit","clipboard"],this.enabled=!0};I.prototype.initializeColumn=function(e){var t=this,o=!1,i={};this.allowedTypes.forEach(function(n){var s,a="mutator"+(n.charAt(0).toUpperCase()+n.slice(1));e.definition[a]&&(s=t.lookupMutator(e.definition[a]))&&(o=!0,i[a]={mutator:s,params:e.definition[a+"Params"]||{}})}),o&&(e.modules.mutate=i)},I.prototype.lookupMutator=function(e){var t=!1;switch(void 0===e?"undefined":_typeof(e)){case"string":this.mutators[e]?t=this.mutators[e]:console.warn("Mutator Error - No such mutator found, ignoring: ",e);break;case"function":t=e}return t},I.prototype.transformRow=function(e,t,o){var i,n=this,s="mutator"+(t.charAt(0).toUpperCase()+t.slice(1));return this.enabled&&n.table.columnManager.traverse(function(n){var a,r,l;n.modules.mutate&&(a=n.modules.mutate[s]||n.modules.mutate.mutator||!1)&&(i=n.getFieldValue(void 0!==o?o:e),"data"!=t&&void 0===i||(l=n.getComponent(),r="function"==typeof a.params?a.params(i,e,t,l):a.params,n.setFieldValue(e,a.mutator(i,e,t,r,l))))}),e},I.prototype.transformCell=function(e,t){var o=e.column.modules.mutate.mutatorEdit||e.column.modules.mutate.mutator||!1,i={};return o?(i=Object.assign(i,e.row.getData()),e.column.setFieldValue(i,t),o.mutator(t,i,"edit",o.params,e.getComponent())):t},I.prototype.enable=function(){this.enabled=!0},I.prototype.disable=function(){this.enabled=!1},I.prototype.mutators={},h.prototype.registerModule("mutator",I);var V=function(e){this.table=e,this.mode="local",this.progressiveLoad=!1,this.size=0,this.page=1,this.count=5,this.max=1,this.displayIndex=0,this.initialLoad=!0,this.pageSizes=[],this.dataReceivedNames={},this.dataSentNames={},this.createElements()};V.prototype.createElements=function(){var e;this.element=document.createElement("span"),this.element.classList.add("tabulator-paginator"),this.pagesElement=document.createElement("span"),this.pagesElement.classList.add("tabulator-pages"),e=document.createElement("button"),e.classList.add("tabulator-page"),e.setAttribute("type","button"),e.setAttribute("role","button"),e.setAttribute("aria-label",""),e.setAttribute("title",""),this.firstBut=e.cloneNode(!0),this.firstBut.setAttribute("data-page","first"),this.prevBut=e.cloneNode(!0),this.prevBut.setAttribute("data-page","prev"),this.nextBut=e.cloneNode(!0),this.nextBut.setAttribute("data-page","next"),this.lastBut=e.cloneNode(!0),this.lastBut.setAttribute("data-page","last"),this.table.options.paginationSizeSelector&&(this.pageSizeSelect=document.createElement("select"),this.pageSizeSelect.classList.add("tabulator-page-size"))},V.prototype.generatePageSizeSelectList=function(){var e=this,t=[];if(this.pageSizeSelect){if(Array.isArray(this.table.options.paginationSizeSelector))t=this.table.options.paginationSizeSelector,this.pageSizes=t,-1==this.pageSizes.indexOf(this.size)&&t.unshift(this.size);else if(-1==this.pageSizes.indexOf(this.size)){t=[];for(var o=1;o<5;o++)t.push(this.size*o);this.pageSizes=t}else t=this.pageSizes;for(;this.pageSizeSelect.firstChild;)this.pageSizeSelect.removeChild(this.pageSizeSelect.firstChild);t.forEach(function(t){var o=document.createElement("option");o.value=t,!0===t?e.table.modules.localize.bind("pagination|all",function(e){o.innerHTML=e}):o.innerHTML=t,e.pageSizeSelect.appendChild(o)}),this.pageSizeSelect.value=this.size}},V.prototype.initialize=function(e){var t,o,i,n=this;this.dataSentNames=Object.assign({},this.paginationDataSentNames),this.dataSentNames=Object.assign(this.dataSentNames,this.table.options.paginationDataSent),this.dataReceivedNames=Object.assign({},this.paginationDataReceivedNames),this.dataReceivedNames=Object.assign(this.dataReceivedNames,this.table.options.paginationDataReceived),n.table.modules.localize.bind("pagination|first",function(e){n.firstBut.innerHTML=e}),n.table.modules.localize.bind("pagination|first_title",function(e){n.firstBut.setAttribute("aria-label",e),n.firstBut.setAttribute("title",e)}),n.table.modules.localize.bind("pagination|prev",function(e){n.prevBut.innerHTML=e}),n.table.modules.localize.bind("pagination|prev_title",function(e){n.prevBut.setAttribute("aria-label",e),n.prevBut.setAttribute("title",e)}),n.table.modules.localize.bind("pagination|next",function(e){n.nextBut.innerHTML=e}),n.table.modules.localize.bind("pagination|next_title",function(e){n.nextBut.setAttribute("aria-label",e),n.nextBut.setAttribute("title",e)}),n.table.modules.localize.bind("pagination|last",function(e){n.lastBut.innerHTML=e}),n.table.modules.localize.bind("pagination|last_title",function(e){n.lastBut.setAttribute("aria-label",e),n.lastBut.setAttribute("title",e)}),n.firstBut.addEventListener("click",function(){n.setPage(1).then(function(){}).catch(function(){})}),n.prevBut.addEventListener("click",function(){n.previousPage().then(function(){}).catch(function(){})}),n.nextBut.addEventListener("click",function(){n.nextPage().then(function(){}).catch(function(){})}),n.lastBut.addEventListener("click",function(){n.setPage(n.max).then(function(){}).catch(function(){})}),n.table.options.paginationElement&&(n.element=n.table.options.paginationElement),this.pageSizeSelect&&(t=document.createElement("label"),n.table.modules.localize.bind("pagination|page_size",function(e){n.pageSizeSelect.setAttribute("aria-label",e),n.pageSizeSelect.setAttribute("title",e),t.innerHTML=e}),n.element.appendChild(t),n.element.appendChild(n.pageSizeSelect),n.pageSizeSelect.addEventListener("change",function(e){n.setPageSize("true"==n.pageSizeSelect.value||n.pageSizeSelect.value),n.setPage(1).then(function(){}).catch(function(){})})),n.element.appendChild(n.firstBut),n.element.appendChild(n.prevBut),n.element.appendChild(n.pagesElement),n.element.appendChild(n.nextBut),n.element.appendChild(n.lastBut),n.table.options.paginationElement||e||n.table.footerManager.append(n.element,n),n.mode=n.table.options.pagination,n.table.options.paginationSize?n.size=n.table.options.paginationSize:(o=document.createElement("div"),o.classList.add("tabulator-row"),o.style.visibility=e,i=document.createElement("div"),i.classList.add("tabulator-cell"),i.innerHTML="Page Row Test",o.appendChild(i),n.table.rowManager.getTableElement().appendChild(o),n.size=Math.floor(n.table.rowManager.getElement().clientHeight/o.offsetHeight),n.table.rowManager.getTableElement().removeChild(o)),n.count=n.table.options.paginationButtonCount,n.generatePageSizeSelectList()},V.prototype.initializeProgressive=function(e){this.initialize(!0),this.mode="progressive_"+e,this.progressiveLoad=!0},V.prototype.setDisplayIndex=function(e){this.displayIndex=e},V.prototype.getDisplayIndex=function(){return this.displayIndex},V.prototype.setMaxRows=function(e){this.max=e?!0===this.size?1:Math.ceil(e/this.size):1,this.page>this.max&&(this.page=this.max)},V.prototype.reset=function(e,t){return("local"==this.mode||e)&&(this.page=1),t&&(this.initialLoad=!0),!0},V.prototype.setMaxPage=function(e){e=parseInt(e),this.max=e||1,this.page>this.max&&(this.page=this.max,this.trigger())},V.prototype.setPage=function(e){var t=this,o=this;switch(e){case"first":return this.setPage(1);case"prev":return this.previousPage();case"next":return this.nextPage();case"last":return this.setPage(this.max)}return new Promise(function(i,n){e=parseInt(e),e>0&&e<=t.max||"local"!==t.mode?(t.page=e,t.trigger().then(function(){i()}).catch(function(){n()}),o.table.options.persistence&&o.table.modExists("persistence",!0)&&o.table.modules.persistence.config.page&&o.table.modules.persistence.save("page")):(console.warn("Pagination Error - Requested page is out of range of 1 - "+t.max+":",e),n())})},V.prototype.setPageToRow=function(e){var t=this;return new Promise(function(o,i){var n=t.table.rowManager.getDisplayRows(t.displayIndex-1),s=n.indexOf(e);if(s>-1){var a=!0===t.size?1:Math.ceil((s+1)/t.size);t.setPage(a).then(function(){o()}).catch(function(){i()})}else console.warn("Pagination Error - Requested row is not visible"),i()})},V.prototype.setPageSize=function(e){!0!==e&&(e=parseInt(e)),e>0&&(this.size=e),this.pageSizeSelect&&this.generatePageSizeSelectList(),this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.page&&this.table.modules.persistence.save("page")},V.prototype._setPageButtons=function(){for(var e=this,t=Math.floor((this.count-1)/2),o=Math.ceil((this.count-1)/2),i=this.max-this.page+t+1<this.count?this.max-this.count+1:Math.max(this.page-t,1),n=this.page<=o?Math.min(this.count,this.max):Math.min(this.page+o,this.max);e.pagesElement.firstChild;)e.pagesElement.removeChild(e.pagesElement.firstChild);1==e.page?(e.firstBut.disabled=!0,e.prevBut.disabled=!0):(e.firstBut.disabled=!1,e.prevBut.disabled=!1),e.page==e.max?(e.lastBut.disabled=!0,e.nextBut.disabled=!0):(e.lastBut.disabled=!1,e.nextBut.disabled=!1);for(var s=i;s<=n;s++)s>0&&s<=e.max&&e.pagesElement.appendChild(e._generatePageButton(s));this.footerRedraw()},V.prototype._generatePageButton=function(e){var t=this,o=document.createElement("button");return o.classList.add("tabulator-page"),e==t.page&&o.classList.add("active"),o.setAttribute("type","button"),o.setAttribute("role","button"),t.table.modules.localize.bind("pagination|page_title",function(t){o.setAttribute("aria-label",t+" "+e),o.setAttribute("title",t+" "+e)}),o.setAttribute("data-page",e),o.textContent=e,o.addEventListener("click",function(o){t.setPage(e).then(function(){}).catch(function(){})}),o},V.prototype.previousPage=function(){var e=this;return new Promise(function(t,o){e.page>1?(e.page--,e.trigger().then(function(){t()}).catch(function(){o()}),e.table.options.persistence&&e.table.modExists("persistence",!0)&&e.table.modules.persistence.config.page&&e.table.modules.persistence.save("page")):(console.warn("Pagination Error - Previous page would be less than page 1:",0),o())})},V.prototype.nextPage=function(){var e=this;return new Promise(function(t,o){e.page<e.max?(e.page++,e.trigger().then(function(){t()}).catch(function(){o()}),e.table.options.persistence&&e.table.modExists("persistence",!0)&&e.table.modules.persistence.config.page&&e.table.modules.persistence.save("page")):(e.progressiveLoad||console.warn("Pagination Error - Next page would be greater than maximum page of "+e.max+":",e.max+1),o())})},V.prototype.getPage=function(){return this.page},V.prototype.getPageMax=function(){return this.max},V.prototype.getPageSize=function(e){return this.size},V.prototype.getMode=function(){return this.mode},V.prototype.getRows=function(e){var t,o,i;if("local"==this.mode){t=[],!0===this.size?(o=0,i=e.length):(o=this.size*(this.page-1),i=o+parseInt(this.size)),this._setPageButtons();for(var n=o;n<i;n++)e[n]&&t.push(e[n]);return t}return this._setPageButtons(),e.slice(0)},V.prototype.trigger=function(){var e,t=this;return new Promise(function(o,i){switch(t.mode){case"local":e=t.table.rowManager.scrollLeft,t.table.rowManager.refreshActiveData("page"),t.table.rowManager.scrollHorizontal(e),t.table.options.pageLoaded.call(t.table,t.getPage()),o();break;case"remote":case"progressive_load":case"progressive_scroll":t.table.modules.ajax.blockActiveRequest(),t._getRemotePage().then(function(){o()}).catch(function(){i()});break;default:console.warn("Pagination Error - no such pagination mode:",t.mode),i()}})},V.prototype._getRemotePage=function(){var e,t,o=this,i=this;return new Promise(function(n,s){if(i.table.modExists("ajax",!0)||s(),e=h.prototype.helpers.deepClone(i.table.modules.ajax.getParams()||{}),t=i.table.modules.ajax.getParams(),t[o.dataSentNames.page]=i.page,o.size&&(t[o.dataSentNames.size]=o.size),o.table.options.ajaxSorting&&o.table.modExists("sort")){var a=i.table.modules.sort.getSort();a.forEach(function(e){delete e.column}),t[o.dataSentNames.sorters]=a}if(o.table.options.ajaxFiltering&&o.table.modExists("filter")){var r=i.table.modules.filter.getFilters(!0,!0);t[o.dataSentNames.filters]=r}i.table.modules.ajax.setParams(t),i.table.modules.ajax.sendRequest(o.progressiveLoad).then(function(e){i._parseRemoteData(e),n()}).catch(function(e){s()}),i.table.modules.ajax.setParams(e)})},V.prototype._parseRemoteData=function(e){var t,e,o,i=this;if(void 0===e[this.dataReceivedNames.last_page]&&console.warn("Remote Pagination Error - Server response missing '"+this.dataReceivedNames.last_page+"' property"),e[this.dataReceivedNames.data]){if(this.max=parseInt(e[this.dataReceivedNames.last_page])||1,this.progressiveLoad)switch(this.mode){case"progressive_load":1==this.page?this.table.rowManager.setData(e[this.dataReceivedNames.data],!1,this.initialLoad&&1==this.page):this.table.rowManager.addRows(e[this.dataReceivedNames.data]),this.page<this.max&&setTimeout(function(){i.nextPage().then(function(){}).catch(function(){})},i.table.options.ajaxProgressiveLoadDelay);break;case"progressive_scroll":e=this.table.rowManager.getData().concat(e[this.dataReceivedNames.data]),this.table.rowManager.setData(e,!0,this.initialLoad&&1==this.page),o=this.table.options.ajaxProgressiveLoadScrollMargin||2*this.table.rowManager.element.clientHeight,i.table.rowManager.element.scrollHeight<=i.table.rowManager.element.clientHeight+o&&i.nextPage().then(function(){}).catch(function(){})}else t=this.table.rowManager.scrollLeft,this.table.rowManager.setData(e[this.dataReceivedNames.data],!1,this.initialLoad&&1==this.page),this.table.rowManager.scrollHorizontal(t),this.table.columnManager.scrollHorizontal(t),this.table.options.pageLoaded.call(this.table,this.getPage());this.initialLoad=!1}else console.warn("Remote Pagination Error - Server response missing '"+this.dataReceivedNames.data+"' property")},V.prototype.footerRedraw=function(){var e=this.table.footerManager.element;Math.ceil(e.clientWidth)-e.scrollWidth<0?this.pagesElement.style.display="none":(this.pagesElement.style.display="",Math.ceil(e.clientWidth)-e.scrollWidth<0&&(this.pagesElement.style.display="none"))},V.prototype.paginationDataSentNames={page:"page",size:"size",sorters:"sorters",filters:"filters"},V.prototype.paginationDataReceivedNames={current_page:"current_page",last_page:"last_page",data:"data"},h.prototype.registerModule("page",V);var j=function(e){this.table=e,this.mode="",this.id="",this.defWatcherBlock=!1,this.config={},this.readFunc=!1,this.writeFunc=!1};j.prototype.localStorageTest=function(){var e="_tabulator_test";try{return window.localStorage.setItem(e,e),window.localStorage.removeItem(e),!0}catch(e){return!1}},j.prototype.initialize=function(){var e,t=this.table.options.persistenceMode,o=this.table.options.persistenceID;this.mode=!0!==t?t:this.localStorageTest()?"local":"cookie",this.table.options.persistenceReaderFunc?"function"==typeof this.table.options.persistenceReaderFunc?this.readFunc=this.table.options.persistenceReaderFunc:this.readers[this.table.options.persistenceReaderFunc]?this.readFunc=this.readers[this.table.options.persistenceReaderFunc]:console.warn("Persistence Read Error - invalid reader set",this.table.options.persistenceReaderFunc):this.readers[this.mode]?this.readFunc=this.readers[this.mode]:console.warn("Persistence Read Error - invalid reader set",this.mode),
	this.table.options.persistenceWriterFunc?"function"==typeof this.table.options.persistenceWriterFunc?this.writeFunc=this.table.options.persistenceWriterFunc:this.readers[this.table.options.persistenceWriterFunc]?this.writeFunc=this.readers[this.table.options.persistenceWriterFunc]:console.warn("Persistence Write Error - invalid reader set",this.table.options.persistenceWriterFunc):this.writers[this.mode]?this.writeFunc=this.writers[this.mode]:console.warn("Persistence Write Error - invalid writer set",this.mode),this.id="tabulator-"+(o||this.table.element.getAttribute("id")||""),this.config={sort:!0===this.table.options.persistence||this.table.options.persistence.sort,filter:!0===this.table.options.persistence||this.table.options.persistence.filter,group:!0===this.table.options.persistence||this.table.options.persistence.group,page:!0===this.table.options.persistence||this.table.options.persistence.page,columns:!0===this.table.options.persistence?["title","width","visible"]:this.table.options.persistence.columns},this.config.page&&(e=this.retreiveData("page"))&&(void 0===e.paginationSize||!0!==this.config.page&&!this.config.page.size||(this.table.options.paginationSize=e.paginationSize),void 0===e.paginationInitialPage||!0!==this.config.page&&!this.config.page.page||(this.table.options.paginationInitialPage=e.paginationInitialPage)),this.config.group&&(e=this.retreiveData("group"))&&(void 0===e.groupBy||!0!==this.config.group&&!this.config.group.groupBy||(this.table.options.groupBy=e.groupBy),void 0===e.groupStartOpen||!0!==this.config.group&&!this.config.group.groupStartOpen||(this.table.options.groupStartOpen=e.groupStartOpen),void 0===e.groupHeader||!0!==this.config.group&&!this.config.group.groupHeader||(this.table.options.groupHeader=e.groupHeader)),this.config.columns&&(this.table.options.columns=this.load("columns",this.table.options.columns))},j.prototype.initializeColumn=function(e){var t,o,i=this;this.config.columns&&(this.defWatcherBlock=!0,t=e.getDefinition(),o=!0===this.config.columns?Object.keys(t):this.config.columns,o.forEach(function(e){var o=Object.getOwnPropertyDescriptor(t,e),n=t[e];o&&Object.defineProperty(t,e,{set:function(e){n=e,i.defWatcherBlock||i.save("columns"),o.set&&o.set(e)},get:function(){return o.get&&o.get(),n}})}),this.defWatcherBlock=!1)},j.prototype.load=function(e,t){var o=this.retreiveData(e);return t&&(o=o?this.mergeDefinition(t,o):t),o},j.prototype.retreiveData=function(e){return!!this.readFunc&&this.readFunc(this.id,e)},j.prototype.mergeDefinition=function(e,t){var o=this,i=[];return t=t||[],t.forEach(function(t,n){var s,a=o._findColumn(e,t);a&&(!0===o.config.columns||void 0==o.config.columns?(s=Object.keys(a),s.push("width")):s=o.config.columns,s.forEach(function(e){"columns"!==e&&void 0!==t[e]&&(a[e]=t[e])}),a.columns&&(a.columns=o.mergeDefinition(a.columns,t.columns)),i.push(a))}),e.forEach(function(e,n){o._findColumn(t,e)||(i.length>n?i.splice(n,0,e):i.push(e))}),i},j.prototype._findColumn=function(e,t){var o=t.columns?"group":t.field?"field":"object";return e.find(function(e){switch(o){case"group":return e.title===t.title&&e.columns.length===t.columns.length;case"field":return e.field===t.field;case"object":return e===t}})},j.prototype.save=function(e){var t={};switch(e){case"columns":t=this.parseColumns(this.table.columnManager.getColumns());break;case"filter":t=this.table.modules.filter.getFilters();break;case"sort":t=this.validateSorters(this.table.modules.sort.getSort());break;case"group":t=this.getGroupConfig();break;case"page":t=this.getPageConfig()}this.writeFunc&&this.writeFunc(this.id,e,t)},j.prototype.validateSorters=function(e){return e.forEach(function(e){e.column=e.field,delete e.field}),e},j.prototype.getGroupConfig=function(){var e={};return this.config.group&&((!0===this.config.group||this.config.group.groupBy)&&(e.groupBy=this.table.options.groupBy),(!0===this.config.group||this.config.group.groupStartOpen)&&(e.groupStartOpen=this.table.options.groupStartOpen),(!0===this.config.group||this.config.group.groupHeader)&&(e.groupHeader=this.table.options.groupHeader)),e},j.prototype.getPageConfig=function(){var e={};return this.config.page&&((!0===this.config.page||this.config.page.size)&&(e.paginationSize=this.table.modules.page.getPageSize()),(!0===this.config.page||this.config.page.page)&&(e.paginationInitialPage=this.table.modules.page.getPage())),e},j.prototype.parseColumns=function(e){var t=this,o=[],i=["headerContextMenu","headerMenu","contextMenu","clickMenu"];return e.forEach(function(e){var n,s={},a=e.getDefinition();e.isGroup?(s.title=a.title,s.columns=t.parseColumns(e.getColumns())):(s.field=e.getField(),!0===t.config.columns||void 0==t.config.columns?(n=Object.keys(a),n.push("width")):n=t.config.columns,n.forEach(function(t){switch(t){case"width":s.width=e.getWidth();break;case"visible":s.visible=e.visible;break;default:"function"!=typeof a[t]&&-1===i.indexOf(t)&&(s[t]=a[t])}})),o.push(s)}),o},j.prototype.readers={local:function(e,t){var o=localStorage.getItem(e+"-"+t);return!!o&&JSON.parse(o)},cookie:function(e,t){var o,i,n=document.cookie,s=e+"-"+t,a=n.indexOf(s+"=");return a>-1&&(n=n.substr(a),o=n.indexOf(";"),o>-1&&(n=n.substr(0,o)),i=n.replace(s+"=","")),!!i&&JSON.parse(i)}},j.prototype.writers={local:function(e,t,o){localStorage.setItem(e+"-"+t,JSON.stringify(o))},cookie:function(e,t,o){var i=new Date;i.setDate(i.getDate()+1e4),document.cookie=e+"-"+t+"="+JSON.stringify(o)+"; expires="+i.toUTCString()}},h.prototype.registerModule("persistence",j);var W=function(e){this.table=e,this.element=!1,this.manualBlock=!1};W.prototype.initialize=function(){window.addEventListener("beforeprint",this.replaceTable.bind(this)),window.addEventListener("afterprint",this.cleanup.bind(this))},W.prototype.replaceTable=function(){this.manualBlock||(this.element=document.createElement("div"),this.element.classList.add("tabulator-print-table"),this.element.appendChild(this.table.modules.export.genereateTable(this.table.options.printConfig,this.table.options.printStyled,this.table.options.printRowRange,"print")),this.table.element.style.display="none",this.table.element.parentNode.insertBefore(this.element,this.table.element))},W.prototype.cleanup=function(){document.body.classList.remove("tabulator-print-fullscreen-hide"),this.element&&this.element.parentNode&&(this.element.parentNode.removeChild(this.element),this.table.element.style.display="")},W.prototype.printFullscreen=function(e,t,o){var i,n,s=window.scrollX,a=window.scrollY,r=document.createElement("div"),l=document.createElement("div"),c=this.table.modules.export.genereateTable(void 0!==o?o:this.table.options.printConfig,void 0!==t?t:this.table.options.printStyled,e,"print");this.manualBlock=!0,this.element=document.createElement("div"),this.element.classList.add("tabulator-print-fullscreen"),this.table.options.printHeader&&(r.classList.add("tabulator-print-header"),i="function"==typeof this.table.options.printHeader?this.table.options.printHeader.call(this.table):this.table.options.printHeader,"string"==typeof i?r.innerHTML=i:r.appendChild(i),this.element.appendChild(r)),this.element.appendChild(c),this.table.options.printFooter&&(l.classList.add("tabulator-print-footer"),n="function"==typeof this.table.options.printFooter?this.table.options.printFooter.call(this.table):this.table.options.printFooter,"string"==typeof n?l.innerHTML=n:l.appendChild(n),this.element.appendChild(l)),document.body.classList.add("tabulator-print-fullscreen-hide"),document.body.appendChild(this.element),this.table.options.printFormatter&&this.table.options.printFormatter(this.element,c),window.print(),this.cleanup(),window.scrollTo(s,a),this.manualBlock=!1},h.prototype.registerModule("print",W);var G=function(e){this.table=e,this.data=!1,this.blocked=!1,this.origFuncs={},this.currentVersion=0};G.prototype.watchData=function(e){var t,o=this;this.currentVersion++,t=this.currentVersion,o.unwatchData(),o.data=e,o.origFuncs.push=e.push,Object.defineProperty(o.data,"push",{enumerable:!1,configurable:!0,value:function(){var i=Array.from(arguments);return o.blocked||t!==o.currentVersion||i.forEach(function(e){o.table.rowManager.addRowActual(e,!1)}),o.origFuncs.push.apply(e,arguments)}}),o.origFuncs.unshift=e.unshift,Object.defineProperty(o.data,"unshift",{enumerable:!1,configurable:!0,value:function(){var i=Array.from(arguments);return o.blocked||t!==o.currentVersion||i.forEach(function(e){o.table.rowManager.addRowActual(e,!0)}),o.origFuncs.unshift.apply(e,arguments)}}),o.origFuncs.shift=e.shift,Object.defineProperty(o.data,"shift",{enumerable:!1,configurable:!0,value:function(){var i;return o.blocked||t!==o.currentVersion||o.data.length&&(i=o.table.rowManager.getRowFromDataObject(o.data[0]))&&i.deleteActual(),o.origFuncs.shift.call(e)}}),o.origFuncs.pop=e.pop,Object.defineProperty(o.data,"pop",{enumerable:!1,configurable:!0,value:function(){var i;return o.blocked||t!==o.currentVersion||o.data.length&&(i=o.table.rowManager.getRowFromDataObject(o.data[o.data.length-1]))&&i.deleteActual(),o.origFuncs.pop.call(e)}}),o.origFuncs.splice=e.splice,Object.defineProperty(o.data,"splice",{enumerable:!1,configurable:!0,value:function(){var i,n=Array.from(arguments),s=n[0]<0?e.length+n[0]:n[0],a=n[1],r=!!n[2]&&n.slice(2);if(!o.blocked&&t===o.currentVersion){if(r&&(i=!!e[s]&&o.table.rowManager.getRowFromDataObject(e[s]),i?r.forEach(function(e){o.table.rowManager.addRowActual(e,!0,i,!0)}):(r=r.slice().reverse(),r.forEach(function(e){o.table.rowManager.addRowActual(e,!0,!1,!0)}))),0!==a){var l=e.slice(s,void 0===n[1]?n[1]:s+a);l.forEach(function(e,t){var i=o.table.rowManager.getRowFromDataObject(e);i&&i.deleteActual(t!==l.length-1)})}(r||0!==a)&&o.table.rowManager.reRenderInPosition()}return o.origFuncs.splice.apply(e,arguments)}})},G.prototype.unwatchData=function(){if(!1!==this.data)for(var e in this.origFuncs)Object.defineProperty(this.data,e,{enumerable:!0,configurable:!0,writable:!0,value:this.origFuncs.key})},G.prototype.watchRow=function(e){var t=e.getData();this.blocked=!0;for(var o in t)this.watchKey(e,t,o);this.table.options.dataTree&&this.watchTreeChildren(e),this.blocked=!1},G.prototype.watchTreeChildren=function(e){function t(){o.table.modules.dataTree.initializeRow(e),o.table.modules.dataTree.layoutRow(e),o.table.rowManager.refreshActiveData("tree",!1,!0)}var o=this,i=e.getData()[this.table.options.dataTreeChildField],n={};i&&(n.push=i.push,Object.defineProperty(i,"push",{enumerable:!1,configurable:!0,value:function(){var e=n.push.apply(i,arguments);return t(),e}}),n.unshift=i.unshift,Object.defineProperty(i,"unshift",{enumerable:!1,configurable:!0,value:function(){var e=n.unshift.apply(i,arguments);return t(),e}}),n.shift=i.shift,Object.defineProperty(i,"shift",{enumerable:!1,configurable:!0,value:function(){var e=n.shift.call(i);return t(),e}}),n.pop=i.pop,Object.defineProperty(i,"pop",{enumerable:!1,configurable:!0,value:function(){var e=n.pop.call(i);return t(),e}}),n.splice=i.splice,Object.defineProperty(i,"splice",{enumerable:!1,configurable:!0,value:function(){var e=n.splice.apply(i,arguments);return t(),e}}))},G.prototype.watchKey=function(e,t,o){var i=this,n=Object.getOwnPropertyDescriptor(t,o),s=t[o],a=this.currentVersion;Object.defineProperty(t,o,{set:function(t){if(s=t,!i.blocked&&a===i.currentVersion){var r={};r[o]=t,e.updateData(r)}n.set&&n.set(t)},get:function(){return n.get&&n.get(),s}})},G.prototype.unwatchRow=function(e){var t=e.getData();for(var o in t)Object.defineProperty(t,o,{value:t[o]})},G.prototype.block=function(){this.blocked=!0},G.prototype.unblock=function(){this.blocked=!1},h.prototype.registerModule("reactiveData",G);var U=function(e){this.table=e,this.startColumn=!1,this.startX=!1,this.startWidth=!1,this.handle=null,this.prevHandle=null};U.prototype.initializeColumn=function(e,t,o){var i=this,n=!1,s=this.table.options.resizableColumns;if("header"===e&&(n="textarea"==t.definition.formatter||t.definition.variableHeight,t.modules.resize={variableHeight:n}),!0===s||s==e){var a=document.createElement("div");a.className="tabulator-col-resize-handle";var r=document.createElement("div");r.className="tabulator-col-resize-handle prev",a.addEventListener("click",function(e){e.stopPropagation()});var l=function(e){var o=t.getLastColumn();o&&i._checkResizability(o)&&(i.startColumn=t,i._mouseDown(e,o,a))};a.addEventListener("mousedown",l),a.addEventListener("touchstart",l,{passive:!0}),a.addEventListener("dblclick",function(e){var o=t.getLastColumn();o&&i._checkResizability(o)&&(e.stopPropagation(),o.reinitializeWidth(!0))}),r.addEventListener("click",function(e){e.stopPropagation()});var c=function(e){var o,n,s;(o=t.getFirstColumn())&&(n=i.table.columnManager.findColumnIndex(o),(s=n>0&&i.table.columnManager.getColumnByIndex(n-1))&&i._checkResizability(s)&&(i.startColumn=t,i._mouseDown(e,s,r)))};r.addEventListener("mousedown",c),r.addEventListener("touchstart",c,{passive:!0}),r.addEventListener("dblclick",function(e){var o,n,s;(o=t.getFirstColumn())&&(n=i.table.columnManager.findColumnIndex(o),(s=n>0&&i.table.columnManager.getColumnByIndex(n-1))&&i._checkResizability(s)&&(e.stopPropagation(),s.reinitializeWidth(!0)))}),o.appendChild(a),o.appendChild(r)}},U.prototype._checkResizability=function(e){return void 0!==e.definition.resizable?e.definition.resizable:this.table.options.resizableColumns},U.prototype._mouseDown=function(e,t,o){function i(e){s.table.rtl?t.setWidth(s.startWidth-((void 0===e.screenX?e.touches[0].screenX:e.screenX)-s.startX)):t.setWidth(s.startWidth+((void 0===e.screenX?e.touches[0].screenX:e.screenX)-s.startX)),s.table.options.virtualDomHoz&&s.table.vdomHoz.reinitialize(!0),!s.table.browserSlow&&t.modules.resize&&t.modules.resize.variableHeight&&t.checkCellHeights()}function n(e){s.startColumn.modules.edit&&(s.startColumn.modules.edit.blocked=!1),s.table.browserSlow&&t.modules.resize&&t.modules.resize.variableHeight&&t.checkCellHeights(),document.body.removeEventListener("mouseup",n),document.body.removeEventListener("mousemove",i),o.removeEventListener("touchmove",i),o.removeEventListener("touchend",n),s.table.element.classList.remove("tabulator-block-select"),s.table.options.persistence&&s.table.modExists("persistence",!0)&&s.table.modules.persistence.config.columns&&s.table.modules.persistence.save("columns"),s.table.options.columnResized.call(s.table,t.getComponent())}var s=this;s.table.element.classList.add("tabulator-block-select"),e.stopPropagation(),s.startColumn.modules.edit&&(s.startColumn.modules.edit.blocked=!0),s.startX=void 0===e.screenX?e.touches[0].screenX:e.screenX,s.startWidth=t.getWidth(),document.body.addEventListener("mousemove",i),document.body.addEventListener("mouseup",n),o.addEventListener("touchmove",i,{passive:!0}),o.addEventListener("touchend",n)},h.prototype.registerModule("resizeColumns",U);var X=function(e){this.table=e,this.startColumn=!1,this.startY=!1,this.startHeight=!1,this.handle=null,this.prevHandle=null};X.prototype.initializeRow=function(e){var t=this,o=e.getElement(),i=document.createElement("div");i.className="tabulator-row-resize-handle";var n=document.createElement("div");n.className="tabulator-row-resize-handle prev",i.addEventListener("click",function(e){e.stopPropagation()});var s=function(o){t.startRow=e,t._mouseDown(o,e,i)};i.addEventListener("mousedown",s),i.addEventListener("touchstart",s,{passive:!0}),n.addEventListener("click",function(e){e.stopPropagation()});var a=function(o){var i=t.table.rowManager.prevDisplayRow(e);i&&(t.startRow=i,t._mouseDown(o,i,n))};n.addEventListener("mousedown",a),n.addEventListener("touchstart",a,{passive:!0}),o.appendChild(i),o.appendChild(n)},X.prototype._mouseDown=function(e,t,o){function i(e){t.setHeight(s.startHeight+((void 0===e.screenY?e.touches[0].screenY:e.screenY)-s.startY))}function n(e){document.body.removeEventListener("mouseup",i),document.body.removeEventListener("mousemove",i),o.removeEventListener("touchmove",i),o.removeEventListener("touchend",n),s.table.element.classList.remove("tabulator-block-select"),s.table.options.rowResized.call(this.table,t.getComponent())}var s=this;s.table.element.classList.add("tabulator-block-select"),e.stopPropagation(),s.startY=void 0===e.screenY?e.touches[0].screenY:e.screenY,s.startHeight=t.getHeight(),document.body.addEventListener("mousemove",i),document.body.addEventListener("mouseup",n),o.addEventListener("touchmove",i,{passive:!0}),o.addEventListener("touchend",n)},h.prototype.registerModule("resizeRows",X);var q=function(e){this.table=e,this.binding=!1,this.observer=!1,this.containerObserver=!1,this.tableHeight=0,this.tableWidth=0,this.containerHeight=0,this.containerWidth=0,this.autoResize=!1};q.prototype.initialize=function(e){var t,o=this,i=this.table;this.tableHeight=i.element.clientHeight,this.tableWidth=i.element.clientWidth,i.element.parentNode&&(this.containerHeight=i.element.parentNode.clientHeight,this.containerWidth=i.element.parentNode.clientWidth),"undefined"!=typeof ResizeObserver&&"virtual"===i.rowManager.getRenderMode()?(this.autoResize=!0,this.observer=new ResizeObserver(function(e){if(!i.browserMobile||i.browserMobile&&!i.modules.edit.currentCell){var t=Math.floor(e[0].contentRect.height),n=Math.floor(e[0].contentRect.width);o.tableHeight==t&&o.tableWidth==n||(o.tableHeight=t,o.tableWidth=n,i.element.parentNode&&(o.containerHeight=i.element.parentNode.clientHeight,o.containerWidth=i.element.parentNode.clientWidth),i.options.virtualDomHoz&&i.vdomHoz.reinitialize(!0),i.redraw())}}),this.observer.observe(i.element),t=window.getComputedStyle(i.element),this.table.element.parentNode&&!this.table.rowManager.fixedHeight&&(t.getPropertyValue("max-height")||t.getPropertyValue("min-height"))&&(this.containerObserver=new ResizeObserver(function(e){if(!i.browserMobile||i.browserMobile&&!i.modules.edit.currentCell){var t=Math.floor(e[0].contentRect.height),n=Math.floor(e[0].contentRect.width);o.containerHeight==t&&o.containerWidth==n||(o.containerHeight=t,o.containerWidth=n,o.tableHeight=i.element.clientHeight,o.tableWidth=i.element.clientWidth),i.options.virtualDomHoz&&i.vdomHoz.reinitialize(!0),i.redraw()}}),this.containerObserver.observe(this.table.element.parentNode))):(this.binding=function(){(!i.browserMobile||i.browserMobile&&!i.modules.edit.currentCell)&&(i.options.virtualDomHoz&&i.vdomHoz.reinitialize(!0),i.redraw())},window.addEventListener("resize",this.binding))},q.prototype.clearBindings=function(e){this.binding&&window.removeEventListener("resize",this.binding),this.observer&&this.observer.unobserve(this.table.element),this.containerObserver&&this.containerObserver.unobserve(this.table.element.parentNode)},h.prototype.registerModule("resizeTable",q);var Y=function(e){this.table=e,this.columns=[],this.hiddenColumns=[],this.mode="",this.index=0,this.collapseFormatter=[],this.collapseStartOpen=!0,this.collapseHandleColumn=!1};Y.prototype.initialize=function(){var e=this,t=[];this.mode=this.table.options.responsiveLayout,this.collapseFormatter=this.table.options.responsiveLayoutCollapseFormatter||this.formatCollapsedData,this.collapseStartOpen=this.table.options.responsiveLayoutCollapseStartOpen,this.hiddenColumns=[],this.table.columnManager.columnsByIndex.forEach(function(o,i){o.modules.responsive&&o.modules.responsive.order&&o.modules.responsive.visible&&(o.modules.responsive.index=i,t.push(o),o.visible||"collapse"!==e.mode||e.hiddenColumns.push(o))}),t=t.reverse(),t=t.sort(function(e,t){return t.modules.responsive.order-e.modules.responsive.order||t.modules.responsive.index-e.modules.responsive.index}),this.columns=t,"collapse"===this.mode&&this.generateCollapsedContent();for(var o=this.table.columnManager.columnsByIndex,i=Array.isArray(o),n=0,o=i?o:o[Symbol.iterator]();;){var s;if(i){if(n>=o.length)break;s=o[n++]}else{if(n=o.next(),n.done)break;s=n.value}var a=s;if("responsiveCollapse"==a.definition.formatter){this.collapseHandleColumn=a;break}}this.collapseHandleColumn&&(this.hiddenColumns.length?this.collapseHandleColumn.show():this.collapseHandleColumn.hide())},Y.prototype.initializeColumn=function(e){var t=e.getDefinition();e.modules.responsive={order:void 0===t.responsive?1:t.responsive,visible:!1!==t.visible}},Y.prototype.initializeRow=function(e){var t;"calc"!==e.type&&(t=document.createElement("div"),t.classList.add("tabulator-responsive-collapse"),e.modules.responsiveLayout={element:t,open:this.collapseStartOpen},this.collapseStartOpen||(t.style.display="none"))},Y.prototype.layoutRow=function(e){var t=e.getElement();e.modules.responsiveLayout&&(t.appendChild(e.modules.responsiveLayout.element),this.generateCollapsedRowContent(e))},Y.prototype.updateColumnVisibility=function(e,t){e.modules.responsive&&(e.modules.responsive.visible=t,this.initialize())},Y.prototype.hideColumn=function(e){var t=this.hiddenColumns.length;e.hide(!1,!0),"collapse"===this.mode&&(this.hiddenColumns.unshift(e),this.generateCollapsedContent(),this.collapseHandleColumn&&!t&&this.collapseHandleColumn.show())},Y.prototype.showColumn=function(e){var t;e.show(!1,!0),e.setWidth(e.getWidth()),"collapse"===this.mode&&(t=this.hiddenColumns.indexOf(e),t>-1&&this.hiddenColumns.splice(t,1),this.generateCollapsedContent(),this.collapseHandleColumn&&!this.hiddenColumns.length&&this.collapseHandleColumn.hide())},Y.prototype.update=function(){for(var e=this,t=!0;t;){var o="fitColumns"==e.table.modules.layout.getMode()?e.table.columnManager.getFlexBaseWidth():e.table.columnManager.getWidth(),i=(e.table.options.headerVisible?e.table.columnManager.element.clientWidth:e.table.element.clientWidth)-o;if(i<0){var n=e.columns[e.index];n?(e.hideColumn(n),e.index++):t=!1}else{var s=e.columns[e.index-1];s&&i>0&&i>=s.getWidth()?(e.showColumn(s),e.index--):t=!1}e.table.rowManager.activeRowsCount||e.table.rowManager.renderEmptyScroll()}},Y.prototype.generateCollapsedContent=function(){var e=this;this.table.rowManager.getDisplayRows().forEach(function(t){e.generateCollapsedRowContent(t)})},Y.prototype.generateCollapsedRowContent=function(e){var t,o;if(e.modules.responsiveLayout){for(t=e.modules.responsiveLayout.element;t.firstChild;)t.removeChild(t.firstChild);o=this.collapseFormatter(this.generateCollapsedRowData(e)),o&&t.appendChild(o)}},Y.prototype.generateCollapsedRowData=function(e){var t,o=this,i=e.getData(),n=[];return this.hiddenColumns.forEach(function(s){var a=s.getFieldValue(i);s.definition.title&&s.field&&(s.modules.format&&o.table.options.responsiveLayoutCollapseUseFormatters?(t={value:!1,data:{},getValue:function(){return a},getData:function(){return i},getElement:function(){return document.createElement("div")},getRow:function(){return e.getComponent()},getColumn:function(){return s.getComponent()}},n.push({field:s.field,title:s.definition.title,value:s.modules.format.formatter.call(o.table.modules.format,t,s.modules.format.params)})):n.push({field:s.field,title:s.definition.title,value:a}))}),n},Y.prototype.formatCollapsedData=function(e){var t=document.createElement("table");return e.forEach(function(e){var o,i=document.createElement("tr"),n=document.createElement("td"),s=document.createElement("td"),a=document.createElement("strong");n.appendChild(a),this.table.modules.localize.bind("columns|"+e.field,function(t){a.innerText=t||e.title}),e.value instanceof Node?(o=document.createElement("div"),o.appendChild(e.value),s.appendChild(o)):s.innerHTML=e.value,i.appendChild(n),i.appendChild(s),t.appendChild(i)},this),Object.keys(e).length?t:""},h.prototype.registerModule("responsiveLayout",Y);var K=function(e){this.table=e,this.selecting=!1,this.lastClickedRow=!1,this.selectPrev=[],this.selectedRows=[],this.headerCheckboxElement=null};K.prototype.clearSelectionData=function(e){this.selecting=!1,this.lastClickedRow=!1,this.selectPrev=[],this.selectedRows=[],e||this._rowSelectionChanged()},K.prototype.initializeRow=function(e){var t=this,o=e.getElement(),i=function e(){setTimeout(function(){t.selecting=!1},50),document.body.removeEventListener("mouseup",e)};e.modules.select={selected:!1},t.table.options.selectableCheck.call(this.table,e.getComponent())?(o.classList.add("tabulator-selectable"),o.classList.remove("tabulator-unselectable"),t.table.options.selectable&&"highlight"!=t.table.options.selectable&&("click"===t.table.options.selectableRangeMode?o.addEventListener("click",function(o){if(o.shiftKey){t.table._clearSelection(),t.lastClickedRow=t.lastClickedRow||e;var i=t.table.rowManager.getDisplayRowIndex(t.lastClickedRow),n=t.table.rowManager.getDisplayRowIndex(e),s=i<=n?i:n,a=i>=n?i:n,r=t.table.rowManager.getDisplayRows().slice(0),l=r.splice(s,a-s+1);o.ctrlKey||o.metaKey?(l.forEach(function(o){o!==t.lastClickedRow&&(!0===t.table.options.selectable||t.isRowSelected(e)?t.toggleRow(o):t.selectedRows.length<t.table.options.selectable&&t.toggleRow(o))}),t.lastClickedRow=e):(t.deselectRows(void 0,!0),!0!==t.table.options.selectable&&l.length>t.table.options.selectable&&(l=l.slice(0,t.table.options.selectable)),t.selectRows(l)),t.table._clearSelection()}else o.ctrlKey||o.metaKey?(t.toggleRow(e),t.lastClickedRow=e):(t.deselectRows(void 0,!0),t.selectRows(e),t.lastClickedRow=e)}):(o.addEventListener("click",function(o){t.table.modExists("edit")&&t.table.modules.edit.getCurrentCell()||t.table._clearSelection(),t.selecting||t.toggleRow(e)}),o.addEventListener("mousedown",function(o){if(o.shiftKey)return t.table._clearSelection(),t.selecting=!0,t.selectPrev=[],document.body.addEventListener("mouseup",i),document.body.addEventListener("keyup",i),t.toggleRow(e),!1}),o.addEventListener("mouseenter",function(o){t.selecting&&(t.table._clearSelection(),t.toggleRow(e),t.selectPrev[1]==e&&t.toggleRow(t.selectPrev[0]))}),o.addEventListener("mouseout",function(o){t.selecting&&(t.table._clearSelection(),t.selectPrev.unshift(e))})))):(o.classList.add("tabulator-unselectable"),o.classList.remove("tabulator-selectable"))},K.prototype.toggleRow=function(e){this.table.options.selectableCheck.call(this.table,e.getComponent())&&(e.modules.select&&e.modules.select.selected?this._deselectRow(e):this._selectRow(e))},K.prototype.selectRows=function(e){var t,o=this;switch(void 0===e?"undefined":_typeof(e)){case"undefined":this.table.rowManager.rows.forEach(function(e){o._selectRow(e,!0,!0)}),this._rowSelectionChanged();break;case"string":t=this.table.rowManager.findRow(e),t?this._selectRow(t,!0,!0):this.table.rowManager.getRows(e).forEach(function(e){o._selectRow(e,!0,!0)}),this._rowSelectionChanged();break;default:Array.isArray(e)?(e.forEach(function(e){o._selectRow(e,!0,!0)}),this._rowSelectionChanged()):this._selectRow(e,!1,!0)}},K.prototype._selectRow=function(e,t,o){if(!isNaN(this.table.options.selectable)&&!0!==this.table.options.selectable&&!o&&this.selectedRows.length>=this.table.options.selectable){if(!this.table.options.selectableRollingSelection)return!1;this._deselectRow(this.selectedRows[0])}var i=this.table.rowManager.findRow(e);i?-1==this.selectedRows.indexOf(i)&&(i.getElement().classList.add("tabulator-selected"),i.modules.select||(i.modules.select={}),i.modules.select.selected=!0,i.modules.select.checkboxEl&&(i.modules.select.checkboxEl.checked=!0),this.selectedRows.push(i),this.table.options.dataTreeSelectPropagate&&this.childRowSelection(i,!0),t||this.table.options.rowSelected.call(this.table,i.getComponent()),this._rowSelectionChanged(t)):t||console.warn("Selection Error - No such row found, ignoring selection:"+e)},K.prototype.isRowSelected=function(e){return-1!==this.selectedRows.indexOf(e)},K.prototype.deselectRows=function(e,t){var o,i=this;if(void 0===e){o=i.selectedRows.length;for(var n=0;n<o;n++)i._deselectRow(i.selectedRows[0],!0);i._rowSelectionChanged(t)}else Array.isArray(e)?(e.forEach(function(e){i._deselectRow(e,!0)}),i._rowSelectionChanged(t)):i._deselectRow(e,t)},K.prototype._deselectRow=function(e,t){var o,i=this,n=i.table.rowManager.findRow(e);n?(o=i.selectedRows.findIndex(function(e){return e==n}))>-1&&(n.getElement().classList.remove("tabulator-selected"),n.modules.select||(n.modules.select={}),n.modules.select.selected=!1,n.modules.select.checkboxEl&&(n.modules.select.checkboxEl.checked=!1),i.selectedRows.splice(o,1),this.table.options.dataTreeSelectPropagate&&this.childRowSelection(n,!1),t||i.table.options.rowDeselected.call(this.table,n.getComponent()),i._rowSelectionChanged(t)):t||console.warn("Deselection Error - No such row found, ignoring selection:"+e)},K.prototype.getSelectedData=function(){var e=[];return this.selectedRows.forEach(function(t){e.push(t.getData())}),e},K.prototype.getSelectedRows=function(){var e=[];return this.selectedRows.forEach(function(t){e.push(t.getComponent())}),e},K.prototype._rowSelectionChanged=function(e){this.headerCheckboxElement&&(0===this.selectedRows.length?(this.headerCheckboxElement.checked=!1,this.headerCheckboxElement.indeterminate=!1):this.table.rowManager.rows.length===this.selectedRows.length?(this.headerCheckboxElement.checked=!0,this.headerCheckboxElement.indeterminate=!1):(this.headerCheckboxElement.indeterminate=!0,this.headerCheckboxElement.checked=!1)),e||this.table.options.rowSelectionChanged.call(this.table,this.getSelectedData(),this.getSelectedRows())},K.prototype.registerRowSelectCheckbox=function(e,t){e._row.modules.select||(e._row.modules.select={}),e._row.modules.select.checkboxEl=t},K.prototype.registerHeaderSelectCheckbox=function(e){this.headerCheckboxElement=e},K.prototype.childRowSelection=function(e,t){var o=this.table.modules.dataTree.getChildren(e,!0);if(t)for(var i=o,n=Array.isArray(i),s=0,i=n?i:i[Symbol.iterator]();;){var a;if(n){if(s>=i.length)break;a=i[s++]}else{if(s=i.next(),s.done)break;a=s.value}var r=a;this._selectRow(r,!0)}else for(var l=o,c=Array.isArray(l),u=0,l=c?l:l[Symbol.iterator]();;){var d;if(c){if(u>=l.length)break;d=l[u++]}else{if(u=l.next(),u.done)break;d=u.value}var h=d;this._deselectRow(h,!0)}},h.prototype.registerModule("selectRow",K);var J=function(e){this.table=e,this.sortList=[],this.changed=!1};J.prototype.initializeColumn=function(e,t){var o,i,n=this,s=!1;switch(_typeof(e.definition.sorter)){case"string":n.sorters[e.definition.sorter]?s=n.sorters[e.definition.sorter]:console.warn("Sort Error - No such sorter found: ",e.definition.sorter);break;case"function":s=e.definition.sorter}e.modules.sort={sorter:s,dir:"none",params:e.definition.sorterParams||{},startingDir:e.definition.headerSortStartingDir||"asc",tristate:void 0!==e.definition.headerSortTristate?e.definition.headerSortTristate:this.table.options.headerSortTristate},(void 0===e.definition.headerSort?!1!==this.table.options.headerSort:!1!==e.definition.headerSort)&&(o=e.getElement(),o.classList.add("tabulator-sortable"),i=document.createElement("div"),i.classList.add("tabulator-col-sorter"),"object"==_typeof(this.table.options.headerSortElement)?i.appendChild(this.table.options.headerSortElement):i.innerHTML=this.table.options.headerSortElement,t.appendChild(i),e.modules.sort.element=i,o.addEventListener("click",function(t){var o="",i=[],s=!1;if(e.modules.sort){if(e.modules.sort.tristate)o="none"==e.modules.sort.dir?e.modules.sort.startingDir:e.modules.sort.dir==e.modules.sort.startingDir?"asc"==e.modules.sort.dir?"desc":"asc":"none";else switch(e.modules.sort.dir){case"asc":o="desc";break;case"desc":o="asc";break;default:o=e.modules.sort.startingDir}n.table.options.columnHeaderSortMulti&&(t.shiftKey||t.ctrlKey)?(i=n.getSort(),s=i.findIndex(function(t){return t.field===e.getField()}),s>-1?(i[s].dir=o,s!=i.length-1&&(s=i.splice(s,1)[0],"none"!=o&&i.push(s))):"none"!=o&&i.push({column:e,dir:o}),n.setSort(i)):"none"==o?n.clear():n.setSort(e,o),n.table.rowManager.sorterRefresh(!n.sortList.length)}}))},J.prototype.hasChanged=function(){var e=this.changed;return this.changed=!1,e},J.prototype.getSort=function(){var e=this,t=[];return e.sortList.forEach(function(e){e.column&&t.push({column:e.column.getComponent(),field:e.column.getField(),dir:e.dir})}),t},J.prototype.setSort=function(e,t){var o=this,i=[];Array.isArray(e)||(e=[{column:e,dir:t}]),e.forEach(function(e){var t
	;t=o.table.columnManager.findColumn(e.column),t?(e.column=t,i.push(e),o.changed=!0):console.warn("Sort Warning - Sort field does not exist and is being ignored: ",e.column)}),o.sortList=i,this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.sort&&this.table.modules.persistence.save("sort")},J.prototype.clear=function(){this.setSort([])},J.prototype.findSorter=function(e){var t,o=this.table.rowManager.activeRows[0],i="string";if(o&&(o=o.getData(),e.getField()))switch(t=e.getFieldValue(o),void 0===t?"undefined":_typeof(t)){case"undefined":i="string";break;case"boolean":i="boolean";break;default:isNaN(t)||""===t?t.match(/((^[0-9]+[a-z]+)|(^[a-z]+[0-9]+))+$/i)&&(i="alphanum"):i="number"}return this.sorters[i]},J.prototype.sort=function(e){var t=this,o=this.table.options.sortOrderReverse?t.sortList.slice().reverse():t.sortList,i=[],n=[];t.table.options.dataSorting&&t.table.options.dataSorting.call(t.table,t.getSort()),t.clearColumnHeaders(),t.table.options.ajaxSorting?o.forEach(function(e,o){t.setColumnHeader(e.column,e.dir)}):(o.forEach(function(e,o){var n=e.column.modules.sort;e.column&&n&&(n.sorter||(n.sorter=t.findSorter(e.column)),e.params="function"==typeof n.params?n.params(e.column.getComponent(),e.dir):n.params,i.push(e)),t.setColumnHeader(e.column,e.dir)}),i.length&&t._sortItems(e,i)),t.table.options.dataSorted&&(e.forEach(function(e){n.push(e.getComponent())}),t.table.options.dataSorted.call(t.table,t.getSort(),n))},J.prototype.clearColumnHeaders=function(){this.table.columnManager.getRealColumns().forEach(function(e){e.modules.sort&&(e.modules.sort.dir="none",e.getElement().setAttribute("aria-sort","none"))})},J.prototype.setColumnHeader=function(e,t){e.modules.sort.dir=t,e.getElement().setAttribute("aria-sort",t)},J.prototype._sortItems=function(e,t){var o=this,i=t.length-1;e.sort(function(e,n){for(var s,a=i;a>=0;a--){var r=t[a];if(0!==(s=o._sortRow(e,n,r.column,r.dir,r.params)))break}return s})},J.prototype._sortRow=function(e,t,o,i,n){var s,a,r="asc"==i?e:t,l="asc"==i?t:e;return e=o.getFieldValue(r.getData()),t=o.getFieldValue(l.getData()),e=void 0!==e?e:"",t=void 0!==t?t:"",s=r.getComponent(),a=l.getComponent(),o.modules.sort.sorter.call(this,e,t,s,a,o.getComponent(),i,n)},J.prototype.sorters={number:function(e,t,o,i,n,s,a){var r=a.alignEmptyValues,l=a.decimalSeparator,c=a.thousandSeparator,u=0;if(e=String(e),t=String(t),c&&(e=e.split(c).join(""),t=t.split(c).join("")),l&&(e=e.split(l).join("."),t=t.split(l).join(".")),e=parseFloat(e),t=parseFloat(t),isNaN(e))u=isNaN(t)?0:-1;else{if(!isNaN(t))return e-t;u=1}return("top"===r&&"desc"===s||"bottom"===r&&"asc"===s)&&(u*=-1),u},string:function(e,t,o,i,n,s,a){var r,l=a.alignEmptyValues,c=0;if(e){if(t){switch(_typeof(a.locale)){case"boolean":a.locale&&(r=this.table.modules.localize.getLocale());break;case"string":r=a.locale}return String(e).toLowerCase().localeCompare(String(t).toLowerCase(),r)}c=1}else c=t?-1:0;return("top"===l&&"desc"===s||"bottom"===l&&"asc"===s)&&(c*=-1),c},date:function(e,t,o,i,n,s,a){return a.format||(a.format="DD/MM/YYYY"),this.sorters.datetime.call(this,e,t,o,i,n,s,a)},time:function(e,t,o,i,n,s,a){return a.format||(a.format="HH:mm"),this.sorters.datetime.call(this,e,t,o,i,n,s,a)},datetime:function(e,t,o,i,n,s,a){var r=a.format||"DD/MM/YYYY HH:mm:ss",l=a.alignEmptyValues,c=0;if("undefined"!=typeof moment){if(e=moment(e,r),t=moment(t,r),e.isValid()){if(t.isValid())return e-t;c=1}else c=t.isValid()?-1:0;return("top"===l&&"desc"===s||"bottom"===l&&"asc"===s)&&(c*=-1),c}console.error("Sort Error - 'datetime' sorter is dependant on moment.js")},boolean:function(e,t,o,i,n,s,a){return(!0===e||"true"===e||"True"===e||1===e?1:0)-(!0===t||"true"===t||"True"===t||1===t?1:0)},array:function(e,t,o,i,n,s,a){function r(e){switch(u){case"length":return e.length;case"sum":return e.reduce(function(e,t){return e+t});case"max":return Math.max.apply(null,e);case"min":return Math.min.apply(null,e);case"avg":return e.reduce(function(e,t){return e+t})/e.length}}var l=0,c=0,u=a.type||"length",d=a.alignEmptyValues,h=0;if(Array.isArray(e)){if(Array.isArray(t))return l=e?r(e):0,c=t?r(t):0,l-c;d=1}else d=Array.isArray(t)?-1:0;return("top"===d&&"desc"===s||"bottom"===d&&"asc"===s)&&(h*=-1),h},exists:function(e,t,o,i,n,s,a){return(void 0===e?0:1)-(void 0===t?0:1)},alphanum:function(e,t,o,i,n,s,a){var r,l,c,u,d,h=0,p=/(\d+)|(\D+)/g,m=/\d/,f=a.alignEmptyValues,g=0;if(e||0===e){if(t||0===t){if(isFinite(e)&&isFinite(t))return e-t;if(r=String(e).toLowerCase(),l=String(t).toLowerCase(),r===l)return 0;if(!m.test(r)||!m.test(l))return r>l?1:-1;for(r=r.match(p),l=l.match(p),d=r.length>l.length?l.length:r.length;h<d;)if(c=r[h],u=l[h++],c!==u)return isFinite(c)&&isFinite(u)?("0"===c.charAt(0)&&(c="."+c),"0"===u.charAt(0)&&(u="."+u),c-u):c>u?1:-1;return r.length>l.length}g=1}else g=t||0===t?-1:0;return("top"===f&&"desc"===s||"bottom"===f&&"asc"===s)&&(g*=-1),g}},h.prototype.registerModule("sort",J);var $=function(e){this.table=e,this.invalidCells=[]};return $.prototype.initializeColumn=function(e){var t,o=this,i=[];e.definition.validator&&(Array.isArray(e.definition.validator)?e.definition.validator.forEach(function(e){(t=o._extractValidator(e))&&i.push(t)}):(t=this._extractValidator(e.definition.validator))&&i.push(t),e.modules.validate=!!i.length&&i)},$.prototype._extractValidator=function(e){var t,o,i;switch(void 0===e?"undefined":_typeof(e)){case"string":return i=e.indexOf(":"),i>-1?(t=e.substring(0,i),o=e.substring(i+1)):t=e,this._buildValidator(t,o);case"function":return this._buildValidator(e);case"object":return this._buildValidator(e.type,e.parameters)}},$.prototype._buildValidator=function(e,t){var o="function"==typeof e?e:this.validators[e];return o?{type:"function"==typeof e?"function":e,func:o,params:t}:(console.warn("Validator Setup Error - No matching validator found:",e),!1)},$.prototype.validate=function(e,t,o){var i=this,n=[],s=this.invalidCells.indexOf(t);return e&&e.forEach(function(e){e.func.call(i,t.getComponent(),o,e.params)||n.push({type:e.type,parameters:e.params})}),n=!n.length||n,t.modules.validate||(t.modules.validate={}),!0===n?(t.modules.validate.invalid=!1,t.getElement().classList.remove("tabulator-validation-fail"),s>-1&&this.invalidCells.splice(s,1)):(t.modules.validate.invalid=!0,"manual"!==this.table.options.validationMode&&t.getElement().classList.add("tabulator-validation-fail"),-1==s&&this.invalidCells.push(t)),n},$.prototype.getInvalidCells=function(){var e=[];return this.invalidCells.forEach(function(t){e.push(t.getComponent())}),e},$.prototype.clearValidation=function(e){var t;e.modules.validate&&e.modules.validate.invalid&&(e.getElement().classList.remove("tabulator-validation-fail"),e.modules.validate.invalid=!1,(t=this.invalidCells.indexOf(e))>-1&&this.invalidCells.splice(t,1))},$.prototype.validators={integer:function(e,t,o){return""===t||null===t||void 0===t||"number"==typeof(t=Number(t))&&isFinite(t)&&Math.floor(t)===t},float:function(e,t,o){return""===t||null===t||void 0===t||"number"==typeof(t=Number(t))&&isFinite(t)&&t%1!=0},numeric:function(e,t,o){return""===t||null===t||void 0===t||!isNaN(t)},string:function(e,t,o){return""===t||null===t||void 0===t||isNaN(t)},max:function(e,t,o){return""===t||null===t||void 0===t||parseFloat(t)<=o},min:function(e,t,o){return""===t||null===t||void 0===t||parseFloat(t)>=o},starts:function(e,t,o){return""===t||null===t||void 0===t||String(t).toLowerCase().startsWith(String(o).toLowerCase())},ends:function(e,t,o){return""===t||null===t||void 0===t||String(t).toLowerCase().endsWith(String(o).toLowerCase())},minLength:function(e,t,o){return""===t||null===t||void 0===t||String(t).length>=o},maxLength:function(e,t,o){return""===t||null===t||void 0===t||String(t).length<=o},in:function(e,t,o){return""===t||null===t||void 0===t||("string"==typeof o&&(o=o.split("|")),""===t||o.indexOf(t)>-1)},regex:function(e,t,o){return""===t||null===t||void 0===t||new RegExp(o).test(t)},unique:function(e,t,o){if(""===t||null===t||void 0===t)return!0;var i=!0,n=e.getData(),s=e.getColumn()._getSelf();return this.table.rowManager.rows.forEach(function(e){var o=e.getData();o!==n&&t==s.getFieldValue(o)&&(i=!1)}),i},required:function(e,t,o){return""!==t&&null!==t&&void 0!==t}},h.prototype.registerModule("validate",$),h});
	`,
	"js/fetch.umd.js": `
	(function (global, factory) {
		typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
		typeof define === 'function' && define.amd ? define(['exports'], factory) :
		(factory((global.WHATWGFetch = {})));
	  }(this, (function (exports) { 'use strict';
	  
		var global =
		  (typeof globalThis !== 'undefined' && globalThis) ||
		  (typeof self !== 'undefined' && self) ||
		  (typeof global !== 'undefined' && global);
	  
		var support = {
		  searchParams: 'URLSearchParams' in global,
		  iterable: 'Symbol' in global && 'iterator' in Symbol,
		  blob:
			'FileReader' in global &&
			'Blob' in global &&
			(function() {
			  try {
				new Blob();
				return true
			  } catch (e) {
				return false
			  }
			})(),
		  formData: 'FormData' in global,
		  arrayBuffer: 'ArrayBuffer' in global
		};
	  
		function isDataView(obj) {
		  return obj && DataView.prototype.isPrototypeOf(obj)
		}
	  
		if (support.arrayBuffer) {
		  var viewClasses = [
			'[object Int8Array]',
			'[object Uint8Array]',
			'[object Uint8ClampedArray]',
			'[object Int16Array]',
			'[object Uint16Array]',
			'[object Int32Array]',
			'[object Uint32Array]',
			'[object Float32Array]',
			'[object Float64Array]'
		  ];
	  
		  var isArrayBufferView =
			ArrayBuffer.isView ||
			function(obj) {
			  return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1
			};
		}
	  
		function normalizeName(name) {
		  if (typeof name !== 'string') {
			name = String(name);
		  }
		  var tmps = new RegExp("[^a-z0-9\\-#$%&'*+.^_~~~|~!]", "i");
		  if (tmps.test(name) || name === '') {
			throw new TypeError('Invalid character in header field name: "' + name + '"')
		  }
		  return name.toLowerCase()
		}
	  
		function normalizeValue(value) {
		  if (typeof value !== 'string') {
			value = String(value);
		  }
		  return value
		}
	  
		// Build a destructive iterator for the value list
		function iteratorFor(items) {
		  var iterator = {
			next: function() {
			  var value = items.shift();
			  return {done: value === undefined, value: value}
			}
		  };
	  
		  if (support.iterable) {
			iterator[Symbol.iterator] = function() {
			  return iterator
			};
		  }
	  
		  return iterator
		}
	  
		function Headers(headers) {
		  this.map = {};
	  
		  if (headers instanceof Headers) {
			headers.forEach(function(value, name) {
			  this.append(name, value);
			}, this);
		  } else if (Array.isArray(headers)) {
			headers.forEach(function(header) {
			  this.append(header[0], header[1]);
			}, this);
		  } else if (headers) {
			Object.getOwnPropertyNames(headers).forEach(function(name) {
			  this.append(name, headers[name]);
			}, this);
		  }
		}
	  
		Headers.prototype.append = function(name, value) {
		  name = normalizeName(name);
		  value = normalizeValue(value);
		  var oldValue = this.map[name];
		  this.map[name] = oldValue ? oldValue + ', ' + value : value;
		};
	  
		Headers.prototype['delete'] = function(name) {
		  delete this.map[normalizeName(name)];
		};
	  
		Headers.prototype.get = function(name) {
		  name = normalizeName(name);
		  return this.has(name) ? this.map[name] : null
		};
	  
		Headers.prototype.has = function(name) {
		  return this.map.hasOwnProperty(normalizeName(name))
		};
	  
		Headers.prototype.set = function(name, value) {
		  this.map[normalizeName(name)] = normalizeValue(value);
		};
	  
		Headers.prototype.forEach = function(callback, thisArg) {
		  for (var name in this.map) {
			if (this.map.hasOwnProperty(name)) {
			  callback.call(thisArg, this.map[name], name, this);
			}
		  }
		};
	  
		Headers.prototype.keys = function() {
		  var items = [];
		  this.forEach(function(value, name) {
			items.push(name);
		  });
		  return iteratorFor(items)
		};
	  
		Headers.prototype.values = function() {
		  var items = [];
		  this.forEach(function(value) {
			items.push(value);
		  });
		  return iteratorFor(items)
		};
	  
		Headers.prototype.entries = function() {
		  var items = [];
		  this.forEach(function(value, name) {
			items.push([name, value]);
		  });
		  return iteratorFor(items)
		};
	  
		if (support.iterable) {
		  Headers.prototype[Symbol.iterator] = Headers.prototype.entries;
		}
	  
		function consumed(body) {
		  if (body.bodyUsed) {
			return Promise.reject(new TypeError('Already read'))
		  }
		  body.bodyUsed = true;
		}
	  
		function fileReaderReady(reader) {
		  return new Promise(function(resolve, reject) {
			reader.onload = function() {
			  resolve(reader.result);
			};
			reader.onerror = function() {
			  reject(reader.error);
			};
		  })
		}
	  
		function readBlobAsArrayBuffer(blob) {
		  var reader = new FileReader();
		  var promise = fileReaderReady(reader);
		  reader.readAsArrayBuffer(blob);
		  return promise
		}
	  
		function readBlobAsText(blob) {
		  var reader = new FileReader();
		  var promise = fileReaderReady(reader);
		  reader.readAsText(blob);
		  return promise
		}
	  
		function readArrayBufferAsText(buf) {
		  var view = new Uint8Array(buf);
		  var chars = new Array(view.length);
	  
		  for (var i = 0; i < view.length; i++) {
			chars[i] = String.fromCharCode(view[i]);
		  }
		  return chars.join('')
		}
	  
		function bufferClone(buf) {
		  if (buf.slice) {
			return buf.slice(0)
		  } else {
			var view = new Uint8Array(buf.byteLength);
			view.set(new Uint8Array(buf));
			return view.buffer
		  }
		}
	  
		function Body() {
		  this.bodyUsed = false;
	  
		  this._initBody = function(body) {
			/*
			  fetch-mock wraps the Response object in an ES6 Proxy to
			  provide useful test harness features such as flush. However, on
			  ES5 browsers without fetch or Proxy support pollyfills must be used;
			  the proxy-pollyfill is unable to proxy an attribute unless it exists
			  on the object before the Proxy is created. This change ensures
			  Response.bodyUsed exists on the instance, while maintaining the
			  semantic of setting Request.bodyUsed in the constructor before
			  _initBody is called.
			*/
			this.bodyUsed = this.bodyUsed;
			this._bodyInit = body;
			if (!body) {
			  this._bodyText = '';
			} else if (typeof body === 'string') {
			  this._bodyText = body;
			} else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
			  this._bodyBlob = body;
			} else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
			  this._bodyFormData = body;
			} else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
			  this._bodyText = body.toString();
			} else if (support.arrayBuffer && support.blob && isDataView(body)) {
			  this._bodyArrayBuffer = bufferClone(body.buffer);
			  // IE 10-11 can't handle a DataView body.
			  this._bodyInit = new Blob([this._bodyArrayBuffer]);
			} else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {
			  this._bodyArrayBuffer = bufferClone(body);
			} else {
			  this._bodyText = body = Object.prototype.toString.call(body);
			}
	  
			if (!this.headers.get('content-type')) {
			  if (typeof body === 'string') {
				this.headers.set('content-type', 'text/plain;charset=UTF-8');
			  } else if (this._bodyBlob && this._bodyBlob.type) {
				this.headers.set('content-type', this._bodyBlob.type);
			  } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
				this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');
			  }
			}
		  };
	  
		  if (support.blob) {
			this.blob = function() {
			  var rejected = consumed(this);
			  if (rejected) {
				return rejected
			  }
	  
			  if (this._bodyBlob) {
				return Promise.resolve(this._bodyBlob)
			  } else if (this._bodyArrayBuffer) {
				return Promise.resolve(new Blob([this._bodyArrayBuffer]))
			  } else if (this._bodyFormData) {
				throw new Error('could not read FormData body as blob')
			  } else {
				return Promise.resolve(new Blob([this._bodyText]))
			  }
			};
	  
			this.arrayBuffer = function() {
			  if (this._bodyArrayBuffer) {
				var isConsumed = consumed(this);
				if (isConsumed) {
				  return isConsumed
				}
				if (ArrayBuffer.isView(this._bodyArrayBuffer)) {
				  return Promise.resolve(
					this._bodyArrayBuffer.buffer.slice(
					  this._bodyArrayBuffer.byteOffset,
					  this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength
					)
				  )
				} else {
				  return Promise.resolve(this._bodyArrayBuffer)
				}
			  } else {
				return this.blob().then(readBlobAsArrayBuffer)
			  }
			};
		  }
	  
		  this.text = function() {
			var rejected = consumed(this);
			if (rejected) {
			  return rejected
			}
	  
			if (this._bodyBlob) {
			  return readBlobAsText(this._bodyBlob)
			} else if (this._bodyArrayBuffer) {
			  return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))
			} else if (this._bodyFormData) {
			  throw new Error('could not read FormData body as text')
			} else {
			  return Promise.resolve(this._bodyText)
			}
		  };
	  
		  if (support.formData) {
			this.formData = function() {
			  return this.text().then(decode)
			};
		  }
	  
		  this.json = function() {
			return this.text().then(JSON.parse)
		  };
	  
		  return this
		}
	  
		// HTTP methods whose capitalization should be normalized
		var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'];
	  
		function normalizeMethod(method) {
		  var upcased = method.toUpperCase();
		  return methods.indexOf(upcased) > -1 ? upcased : method
		}
	  
		function Request(input, options) {
		  if (!(this instanceof Request)) {
			throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.')
		  }
	  
		  options = options || {};
		  var body = options.body;
	  
		  if (input instanceof Request) {
			if (input.bodyUsed) {
			  throw new TypeError('Already read')
			}
			this.url = input.url;
			this.credentials = input.credentials;
			if (!options.headers) {
			  this.headers = new Headers(input.headers);
			}
			this.method = input.method;
			this.mode = input.mode;
			this.signal = input.signal;
			if (!body && input._bodyInit != null) {
			  body = input._bodyInit;
			  input.bodyUsed = true;
			}
		  } else {
			this.url = String(input);
		  }
	  
		  this.credentials = options.credentials || this.credentials || 'same-origin';
		  if (options.headers || !this.headers) {
			this.headers = new Headers(options.headers);
		  }
		  this.method = normalizeMethod(options.method || this.method || 'GET');
		  this.mode = options.mode || this.mode || null;
		  this.signal = options.signal || this.signal;
		  this.referrer = null;
	  
		  if ((this.method === 'GET' || this.method === 'HEAD') && body) {
			throw new TypeError('Body not allowed for GET or HEAD requests')
		  }
		  this._initBody(body);
	  
		  if (this.method === 'GET' || this.method === 'HEAD') {
			if (options.cache === 'no-store' || options.cache === 'no-cache') {
			  // Search for a '_' parameter in the query string
			  var reParamSearch = /([?&])_=[^&]*/;
			  if (reParamSearch.test(this.url)) {
				// If it already exists then set the value with the current time
				this.url = this.url.replace(reParamSearch, '$1_=' + new Date().getTime());
			  } else {
				// Otherwise add a new '_' parameter to the end with the current time
				var reQueryString = /\?/;
				this.url += (reQueryString.test(this.url) ? '&' : '?') + '_=' + new Date().getTime();
			  }
			}
		  }
		}
	  
		Request.prototype.clone = function() {
		  return new Request(this, {body: this._bodyInit})
		};
	  
		function decode(body) {
		  var form = new FormData();
		  body
			.trim()
			.split('&')
			.forEach(function(bytes) {
			  if (bytes) {
				var split = bytes.split('=');
				var name = split.shift().replace(/\+/g, ' ');
				var value = split.join('=').replace(/\+/g, ' ');
				form.append(decodeURIComponent(name), decodeURIComponent(value));
			  }
			});
		  return form
		}
	  
		function parseHeaders(rawHeaders) {
		  var headers = new Headers();
		  // Replace instances of \r\n and \n followed by at least one space or horizontal tab with a space
		  // https://tools.ietf.org/html/rfc7230#section-3.2
		  var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, ' ');
		  // Avoiding split via regex to work around a common IE11 bug with the core-js 3.6.0 regex polyfill
		  // https://github.com/github/fetch/issues/748
		  // https://github.com/zloirock/core-js/issues/751
		  preProcessedHeaders
			.split('\r')
			.map(function(header) {
			  return header.indexOf('\n') === 0 ? header.substr(1, header.length) : header
			})
			.forEach(function(line) {
			  var parts = line.split(':');
			  var key = parts.shift().trim();
			  if (key) {
				var value = parts.join(':').trim();
				headers.append(key, value);
			  }
			});
		  return headers
		}
	  
		Body.call(Request.prototype);
	  
		function Response(bodyInit, options) {
		  if (!(this instanceof Response)) {
			throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.')
		  }
		  if (!options) {
			options = {};
		  }
	  
		  this.type = 'default';
		  this.status = options.status === undefined ? 200 : options.status;
		  this.ok = this.status >= 200 && this.status < 300;
		  this.statusText = options.statusText === undefined ? '' : '' + options.statusText;
		  this.headers = new Headers(options.headers);
		  this.url = options.url || '';
		  this._initBody(bodyInit);
		}
	  
		Body.call(Response.prototype);
	  
		Response.prototype.clone = function() {
		  return new Response(this._bodyInit, {
			status: this.status,
			statusText: this.statusText,
			headers: new Headers(this.headers),
			url: this.url
		  })
		};
	  
		Response.error = function() {
		  var response = new Response(null, {status: 0, statusText: ''});
		  response.type = 'error';
		  return response
		};
	  
		var redirectStatuses = [301, 302, 303, 307, 308];
	  
		Response.redirect = function(url, status) {
		  if (redirectStatuses.indexOf(status) === -1) {
			throw new RangeError('Invalid status code')
		  }
	  
		  return new Response(null, {status: status, headers: {location: url}})
		};
	  
		exports.DOMException = global.DOMException;
		try {
		  new exports.DOMException();
		} catch (err) {
		  exports.DOMException = function(message, name) {
			this.message = message;
			this.name = name;
			var error = Error(message);
			this.stack = error.stack;
		  };
		  exports.DOMException.prototype = Object.create(Error.prototype);
		  exports.DOMException.prototype.constructor = exports.DOMException;
		}
	  
		function fetch(input, init) {
		  return new Promise(function(resolve, reject) {
			var request = new Request(input, init);
	  
			if (request.signal && request.signal.aborted) {
			  return reject(new exports.DOMException('Aborted', 'AbortError'))
			}
	  
			var xhr = new XMLHttpRequest();
	  
			function abortXhr() {
			  xhr.abort();
			}
	  
			xhr.onload = function() {
			  var options = {
				status: xhr.status,
				statusText: xhr.statusText,
				headers: parseHeaders(xhr.getAllResponseHeaders() || '')
			  };
			  options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL');
			  var body = 'response' in xhr ? xhr.response : xhr.responseText;
			  setTimeout(function() {
				resolve(new Response(body, options));
			  }, 0);
			};
	  
			xhr.onerror = function() {
			  setTimeout(function() {
				reject(new TypeError('Network request failed'));
			  }, 0);
			};
	  
			xhr.ontimeout = function() {
			  setTimeout(function() {
				reject(new TypeError('Network request failed'));
			  }, 0);
			};
	  
			xhr.onabort = function() {
			  setTimeout(function() {
				reject(new exports.DOMException('Aborted', 'AbortError'));
			  }, 0);
			};
	  
			function fixUrl(url) {
			  try {
				return url === '' && global.location.href ? global.location.href : url
			  } catch (e) {
				return url
			  }
			}
	  
			xhr.open(request.method, fixUrl(request.url), true);
	  
			if (request.credentials === 'include') {
			  xhr.withCredentials = true;
			} else if (request.credentials === 'omit') {
			  xhr.withCredentials = false;
			}
	  
			if ('responseType' in xhr) {
			  if (support.blob) {
				xhr.responseType = 'blob';
			  } else if (
				support.arrayBuffer &&
				request.headers.get('Content-Type') &&
				request.headers.get('Content-Type').indexOf('application/octet-stream') !== -1
			  ) {
				xhr.responseType = 'arraybuffer';
			  }
			}
	  
			if (init && typeof init.headers === 'object' && !(init.headers instanceof Headers)) {
			  Object.getOwnPropertyNames(init.headers).forEach(function(name) {
				xhr.setRequestHeader(name, normalizeValue(init.headers[name]));
			  });
			} else {
			  request.headers.forEach(function(value, name) {
				xhr.setRequestHeader(name, value);
			  });
			}
	  
			if (request.signal) {
			  request.signal.addEventListener('abort', abortXhr);
	  
			  xhr.onreadystatechange = function() {
				// DONE (success or failure)
				if (xhr.readyState === 4) {
				  request.signal.removeEventListener('abort', abortXhr);
				}
			  };
			}
	  
			xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit);
		  })
		}
	  
		fetch.polyfill = true;
	  
		if (!global.fetch) {
		  global.fetch = fetch;
		  global.Headers = Headers;
		  global.Request = Request;
		  global.Response = Response;
		}
	  
		exports.Headers = Headers;
		exports.Request = Request;
		exports.Response = Response;
		exports.fetch = fetch;
	  
		Object.defineProperty(exports, '__esModule', { value: true });
	  
	  })));
	  
	`,
	"js/polyfill.min.js": `
	!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t():"function"==typeof define&&define.amd?define(t):t()}(0,function(){"use strict";function e(e){var t=this.constructor;return this.then(function(n){return t.resolve(e()).then(function(){return n})},function(n){return t.resolve(e()).then(function(){return t.reject(n)})})}function t(e){return new this(function(t,n){function o(e,n){if(n&&("object"==typeof n||"function"==typeof n)){var f=n.then;if("function"==typeof f)return void f.call(n,function(t){o(e,t)},function(n){r[e]={status:"rejected",reason:n},0==--i&&t(r)})}r[e]={status:"fulfilled",value:n},0==--i&&t(r)}if(!e||"undefined"==typeof e.length)return n(new TypeError(typeof e+" "+e+" is not iterable(cannot read property Symbol(Symbol.iterator))"));var r=Array.prototype.slice.call(e);if(0===r.length)return t([]);for(var i=r.length,f=0;r.length>f;f++)o(f,r[f])})}function n(e){return!(!e||"undefined"==typeof e.length)}function o(){}function r(e){if(!(this instanceof r))throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=undefined,this._deferreds=[],l(e,this)}function i(e,t){for(;3===e._state;)e=e._value;0!==e._state?(e._handled=!0,r._immediateFn(function(){var n=1===e._state?t.onFulfilled:t.onRejected;if(null!==n){var o;try{o=n(e._value)}catch(r){return void u(t.promise,r)}f(t.promise,o)}else(1===e._state?f:u)(t.promise,e._value)})):e._deferreds.push(t)}function f(e,t){try{if(t===e)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var n=t.then;if(t instanceof r)return e._state=3,e._value=t,void c(e);if("function"==typeof n)return void l(function(e,t){return function(){e.apply(t,arguments)}}(n,t),e)}e._state=1,e._value=t,c(e)}catch(o){u(e,o)}}function u(e,t){e._state=2,e._value=t,c(e)}function c(e){2===e._state&&0===e._deferreds.length&&r._immediateFn(function(){e._handled||r._unhandledRejectionFn(e._value)});for(var t=0,n=e._deferreds.length;n>t;t++)i(e,e._deferreds[t]);e._deferreds=null}function l(e,t){var n=!1;try{e(function(e){n||(n=!0,f(t,e))},function(e){n||(n=!0,u(t,e))})}catch(o){if(n)return;n=!0,u(t,o)}}var a=setTimeout;r.prototype["catch"]=function(e){return this.then(null,e)},r.prototype.then=function(e,t){var n=new this.constructor(o);return i(this,new function(e,t,n){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.promise=n}(e,t,n)),n},r.prototype["finally"]=e,r.all=function(e){return new r(function(t,o){function r(e,n){try{if(n&&("object"==typeof n||"function"==typeof n)){var u=n.then;if("function"==typeof u)return void u.call(n,function(t){r(e,t)},o)}i[e]=n,0==--f&&t(i)}catch(c){o(c)}}if(!n(e))return o(new TypeError("Promise.all accepts an array"));var i=Array.prototype.slice.call(e);if(0===i.length)return t([]);for(var f=i.length,u=0;i.length>u;u++)r(u,i[u])})},r.allSettled=t,r.resolve=function(e){return e&&"object"==typeof e&&e.constructor===r?e:new r(function(t){t(e)})},r.reject=function(e){return new r(function(t,n){n(e)})},r.race=function(e){return new r(function(t,o){if(!n(e))return o(new TypeError("Promise.race accepts an array"));for(var i=0,f=e.length;f>i;i++)r.resolve(e[i]).then(t,o)})},r._immediateFn="function"==typeof setImmediate&&function(e){setImmediate(e)}||function(e){a(e,0)},r._unhandledRejectionFn=function(e){void 0!==console&&console&&console.warn("Possible Unhandled Promise Rejection:",e)};var s=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw Error("unable to locate global object")}();"function"!=typeof s.Promise?s.Promise=r:s.Promise.prototype["finally"]?s.Promise.allSettled||(s.Promise.allSettled=t):s.Promise.prototype["finally"]=e});

	`,
	"js/jquery.min.js": `
/*! jQuery v1.12.4 | (c) jQuery Foundation | jquery.org/license */
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=a.document,e=c.slice,f=c.concat,g=c.push,h=c.indexOf,i={},j=i.toString,k=i.hasOwnProperty,l={},m="1.12.4",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return e.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:e.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a){return n.each(this,a)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(e.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor()},push:g,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(n.isPlainObject(c)||(b=n.isArray(c)))?(b?(b=!1,f=a&&n.isArray(a)?a:[]):f=a&&n.isPlainObject(a)?a:{},g[d]=n.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray||function(a){return"array"===n.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){var b=a&&a.toString();return!n.isArray(a)&&b-parseFloat(b)+1>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==n.type(a)||a.nodeType||n.isWindow(a))return!1;try{if(a.constructor&&!k.call(a,"constructor")&&!k.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(!l.ownFirst)for(b in a)return k.call(a,b);for(b in a);return void 0===b||k.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?i[j.call(a)]||"object":typeof a},globalEval:function(b){b&&n.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b){var c,d=0;if(s(a)){for(c=a.length;c>d;d++)if(b.call(a[d],d,a[d])===!1)break}else for(d in a)if(b.call(a[d],d,a[d])===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):g.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(h)return h.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,e,g=0,h=[];if(s(a))for(d=a.length;d>g;g++)e=b(a[g],g,c),null!=e&&h.push(e);else for(g in a)e=b(a[g],g,c),null!=e&&h.push(e);return f.apply([],h)},guid:1,proxy:function(a,b){var c,d,f;return"string"==typeof b&&(f=a[b],b=a,a=f),n.isFunction(a)?(c=e.call(arguments,2),d=function(){return a.apply(b||this,c.concat(e.call(arguments)))},d.guid=a.guid=a.guid||n.guid++,d):void 0},now:function(){return+new Date},support:l}),"function"==typeof Symbol&&(n.fn[Symbol.iterator]=c[Symbol.iterator]),n.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(a,b){i["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=!!a&&"length"in a&&a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ga(),z=ga(),A=ga(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+M+"))|)"+L+"*\\]",O=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+N+")*)|.*)\\)|)",P=new RegExp(L+"+","g"),Q=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),R=new RegExp("^"+L+"*,"+L+"*"),S=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),T=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),U=new RegExp(O),V=new RegExp("^"+M+"$"),W={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M+"|[*])"),ATTR:new RegExp("^"+N),PSEUDO:new RegExp("^"+O),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},X=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Z=/^[^{]+\{\s*\[native \w/,$=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,_=/[+~]/,aa=/'|\\/g,ba=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),ca=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},da=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(ea){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fa(a,b,d,e){var f,h,j,k,l,o,r,s,w=b&&b.ownerDocument,x=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==x&&9!==x&&11!==x)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==x&&(o=$.exec(a)))if(f=o[1]){if(9===x){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(w&&(j=w.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(o[2])return H.apply(d,b.getElementsByTagName(a)),d;if((f=o[3])&&c.getElementsByClassName&&b.getElementsByClassName)return H.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==x)w=b,s=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(aa,"\\$&"):b.setAttribute("id",k=u),r=g(a),h=r.length,l=V.test(k)?"#"+k:"[id='"+k+"']";while(h--)r[h]=l+" "+qa(r[h]);s=r.join(","),w=_.test(a)&&oa(b.parentNode)||b}if(s)try{return H.apply(d,w.querySelectorAll(s)),d}catch(y){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(Q,"$1"),b,d,e)}function ga(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ha(a){return a[u]=!0,a}function ia(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ja(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function ka(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function la(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function na(a){return ha(function(b){return b=+b,ha(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function oa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=fa.support={},f=fa.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fa.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ia(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ia(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Z.test(n.getElementsByClassName),c.getById=ia(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ba,ca);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ba,ca);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return"undefined"!=typeof b.getElementsByClassName&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=Z.test(n.querySelectorAll))&&(ia(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\r\\' msallowcapture=''><option selected=''></option></select>",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ia(function(a){var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Z.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ia(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",O)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Z.test(o.compareDocumentPosition),t=b||Z.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return ka(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?ka(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},fa.matches=function(a,b){return fa(a,null,null,b)},fa.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(T,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fa(b,n,null,[a]).length>0},fa.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fa.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fa.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fa.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fa.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fa.selectors={cacheLength:50,createPseudo:ha,match:W,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ba,ca),a[3]=(a[3]||a[4]||a[5]||"").replace(ba,ca),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fa.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fa.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return W.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&U.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ba,ca).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fa.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(P," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fa.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ha(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ha(function(a){var b=[],c=[],d=h(a.replace(Q,"$1"));return d[u]?ha(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ha(function(a){return function(b){return fa(a,b).length>0}}),contains:ha(function(a){return a=a.replace(ba,ca),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ha(function(a){return V.test(a||"")||fa.error("unsupported lang: "+a),a=a.replace(ba,ca).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Y.test(a.nodeName)},input:function(a){return X.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:na(function(){return[0]}),last:na(function(a,b){return[b-1]}),eq:na(function(a,b,c){return[0>c?c+b:c]}),even:na(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:na(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:na(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:na(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=la(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=ma(b);function pa(){}pa.prototype=d.filters=d.pseudos,d.setFilters=new pa,g=fa.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){c&&!(e=R.exec(h))||(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=S.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(Q," ")}),h=h.slice(c.length));for(g in d.filter)!(e=W[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?fa.error(a):z(a,i).slice(0)};function qa(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function ra(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j,k=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(j=b[u]||(b[u]={}),i=j[b.uniqueID]||(j[b.uniqueID]={}),(h=i[d])&&h[0]===w&&h[1]===f)return k[2]=h[2];if(i[d]=k,k[2]=a(b,c,g))return!0}}}function sa(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ta(a,b,c){for(var d=0,e=b.length;e>d;d++)fa(a,b[d],c);return c}function ua(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(c&&!c(f,d,e)||(g.push(f),j&&b.push(h)));return g}function va(a,b,c,d,e,f){return d&&!d[u]&&(d=va(d)),e&&!e[u]&&(e=va(e,f)),ha(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ta(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ua(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ua(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ua(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function wa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ra(function(a){return a===b},h,!0),l=ra(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[ra(sa(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return va(i>1&&sa(m),i>1&&qa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(Q,"$1"),c,e>i&&wa(a.slice(i,e)),f>e&&wa(a=a.slice(e)),f>e&&qa(a))}m.push(c)}return sa(m)}function xa(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=F.call(i));u=ua(u)}H.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&fa.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ha(f):f}return h=fa.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xa(e,d)),f.selector=a}return f},i=fa.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ba,ca),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=W.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(ba,ca),_.test(j[0].type)&&oa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qa(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,!b||_.test(a)&&oa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ia(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ia(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||ja("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ia(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ja("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ia(function(a){return null==a.getAttribute("disabled")})||ja(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fa}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.uniqueSort=n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},v=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},w=n.expr.match.needsContext,x=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,y=/^.[^:#\[\.,]*$/;function z(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(y.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return n.inArray(a,b)>-1!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;e>b;b++)if(n.contains(d[b],this))return!0}));for(b=0;e>b;b++)n.find(a,d[b],c);return c=this.pushStack(e>1?n.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(z(this,a||[],!1))},not:function(a){return this.pushStack(z(this,a||[],!0))},is:function(a){return!!z(this,"string"==typeof a&&w.test(a)?n(a):a||[],!1).length}});var A,B=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=n.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||A,"string"==typeof a){if(e="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:B.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),x.test(e[1])&&n.isPlainObject(b))for(e in b)n.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}if(f=d.getElementById(e[2]),f&&f.parentNode){if(f.id!==e[2])return A.find(a);this.length=1,this[0]=f}return this.context=d,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof c.ready?c.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};C.prototype=n.fn,A=n(d);var D=/^(?:parents|prev(?:Until|All))/,E={children:!0,contents:!0,next:!0,prev:!0};n.fn.extend({has:function(a){var b,c=n(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(n.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=w.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?n.inArray(this[0],n(a)):n.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.uniqueSort(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function F(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return u(a,"parentNode")},parentsUntil:function(a,b,c){return u(a,"parentNode",c)},next:function(a){return F(a,"nextSibling")},prev:function(a){return F(a,"previousSibling")},nextAll:function(a){return u(a,"nextSibling")},prevAll:function(a){return u(a,"previousSibling")},nextUntil:function(a,b,c){return u(a,"nextSibling",c)},prevUntil:function(a,b,c){return u(a,"previousSibling",c)},siblings:function(a){return v((a.parentNode||{}).firstChild,a)},children:function(a){return v(a.firstChild)},contents:function(a){return n.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(E[a]||(e=n.uniqueSort(e)),D.test(a)&&(e=e.reverse())),this.pushStack(e)}});var G=/\S+/g;function H(a){var b={};return n.each(a.match(G)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?H(a):n.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h<f.length)f[h].apply(c[0],c[1])===!1&&a.stopOnFalse&&(h=f.length,c=!1)}a.memory||(c=!1),b=!1,e&&(f=c?[]:"")},j={add:function(){return f&&(c&&!b&&(h=f.length-1,g.push(c)),function d(b){n.each(b,function(b,c){n.isFunction(c)?a.unique&&j.has(c)||f.push(c):c&&c.length&&"string"!==n.type(c)&&d(c)})}(arguments),c&&!b&&i()),this},remove:function(){return n.each(arguments,function(a,b){var c;while((c=n.inArray(b,f,c))>-1)f.splice(c,1),h>=c&&h--}),this},has:function(a){return a?n.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=!0,c||j.disable(),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().progress(c.notify).done(c.resolve).fail(c.reject):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=e.call(arguments),d=c.length,f=1!==d||a&&n.isFunction(a.promise)?d:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(d){b[a]=this,c[a]=arguments.length>1?e.call(arguments):d,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(d>1)for(i=new Array(d),j=new Array(d),k=new Array(d);d>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().progress(h(b,j,i)).done(h(b,k,c)).fail(g.reject):--f;return f||g.resolveWith(k,c),g.promise()}});var I;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(I.resolveWith(d,[n]),n.fn.triggerHandler&&(n(d).triggerHandler("ready"),n(d).off("ready"))))}});function J(){d.addEventListener?(d.removeEventListener("DOMContentLoaded",K),a.removeEventListener("load",K)):(d.detachEvent("onreadystatechange",K),a.detachEvent("onload",K))}function K(){(d.addEventListener||"load"===a.event.type||"complete"===d.readyState)&&(J(),n.ready())}n.ready.promise=function(b){if(!I)if(I=n.Deferred(),"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll)a.setTimeout(n.ready);else if(d.addEventListener)d.addEventListener("DOMContentLoaded",K),a.addEventListener("load",K);else{d.attachEvent("onreadystatechange",K),a.attachEvent("onload",K);var c=!1;try{c=null==a.frameElement&&d.documentElement}catch(e){}c&&c.doScroll&&!function f(){if(!n.isReady){try{c.doScroll("left")}catch(b){return a.setTimeout(f,50)}J(),n.ready()}}()}return I.promise(b)},n.ready.promise();var L;for(L in n(l))break;l.ownFirst="0"===L,l.inlineBlockNeedsLayout=!1,n(function(){var a,b,c,e;c=d.getElementsByTagName("body")[0],c&&c.style&&(b=d.createElement("div"),e=d.createElement("div"),e.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(e).appendChild(b),"undefined"!=typeof b.style.zoom&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",l.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(e))}),function(){var a=d.createElement("div");l.deleteExpando=!0;try{delete a.test}catch(b){l.deleteExpando=!1}a=null}();var M=function(a){var b=n.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b},N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(O,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}n.data(a,b,c)}else c=void 0;
}return c}function Q(a){var b;for(b in a)if(("data"!==b||!n.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function R(a,b,d,e){if(M(a)){var f,g,h=n.expando,i=a.nodeType,j=i?n.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||n.guid++:h),j[k]||(j[k]=i?{}:{toJSON:n.noop}),"object"!=typeof b&&"function"!=typeof b||(e?j[k]=n.extend(j[k],b):j[k].data=n.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[n.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[n.camelCase(b)])):f=g,f}}function S(a,b,c){if(M(a)){var d,e,f=a.nodeType,g=f?n.cache:a,h=f?a[n.expando]:n.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){n.isArray(b)?b=b.concat(n.map(b,n.camelCase)):b in d?b=[b]:(b=n.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!Q(d):!n.isEmptyObject(d))return}(c||(delete g[h].data,Q(g[h])))&&(f?n.cleanData([a],!0):l.deleteExpando||g!=g.window?delete g[h]:g[h]=void 0)}}}n.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?n.cache[a[n.expando]]:a[n.expando],!!a&&!Q(a)},data:function(a,b,c){return R(a,b,c)},removeData:function(a,b){return S(a,b)},_data:function(a,b,c){return R(a,b,c,!0)},_removeData:function(a,b){return S(a,b,!0)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=n.data(f),1===f.nodeType&&!n._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d])));n._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){n.data(this,a)}):arguments.length>1?this.each(function(){n.data(this,a,b)}):f?P(f,a,n.data(f,a)):void 0},removeData:function(a){return this.each(function(){n.removeData(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=n._data(a,b),c&&(!d||n.isArray(c)?d=n._data(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return n._data(a,c)||n._data(a,c,{empty:n.Callbacks("once memory").add(function(){n._removeData(a,b+"queue"),n._removeData(a,c)})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?n.queue(this[0],a):void 0===b?this:this.each(function(){var c=n.queue(this,a,b);n._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&n.dequeue(this,a)})},dequeue:function(a){return this.each(function(){n.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=n.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=n._data(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}}),function(){var a;l.shrinkWrapBlocks=function(){if(null!=a)return a;a=!1;var b,c,e;return c=d.getElementsByTagName("body")[0],c&&c.style?(b=d.createElement("div"),e=d.createElement("div"),e.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(e).appendChild(b),"undefined"!=typeof b.style.zoom&&(b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:1px;width:1px;zoom:1",b.appendChild(d.createElement("div")).style.width="5px",a=3!==b.offsetWidth),c.removeChild(e),a):void 0}}();var T=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,U=new RegExp("^(?:([+-])=|)("+T+")([a-z%]*)$","i"),V=["Top","Right","Bottom","Left"],W=function(a,b){return a=b||a,"none"===n.css(a,"display")||!n.contains(a.ownerDocument,a)};function X(a,b,c,d){var e,f=1,g=20,h=d?function(){return d.cur()}:function(){return n.css(a,b,"")},i=h(),j=c&&c[3]||(n.cssNumber[b]?"":"px"),k=(n.cssNumber[b]||"px"!==j&&+i)&&U.exec(n.css(a,b));if(k&&k[3]!==j){j=j||k[3],c=c||[],k=+i||1;do f=f||".5",k/=f,n.style(a,b,k+j);while(f!==(f=h()/i)&&1!==f&&--g)}return c&&(k=+k||+i||0,e=c[1]?k+(c[1]+1)*c[2]:+c[2],d&&(d.unit=j,d.start=k,d.end=e)),e}var Y=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)Y(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},Z=/^(?:checkbox|radio)$/i,$=/<([\w:-]+)/,_=/^$|\/(?:java|ecma)script/i,aa=/^\s+/,ba="abbr|article|aside|audio|bdi|canvas|data|datalist|details|dialog|figcaption|figure|footer|header|hgroup|main|mark|meter|nav|output|picture|progress|section|summary|template|time|video";function ca(a){var b=ba.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}!function(){var a=d.createElement("div"),b=d.createDocumentFragment(),c=d.createElement("input");a.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",l.leadingWhitespace=3===a.firstChild.nodeType,l.tbody=!a.getElementsByTagName("tbody").length,l.htmlSerialize=!!a.getElementsByTagName("link").length,l.html5Clone="<:nav></:nav>"!==d.createElement("nav").cloneNode(!0).outerHTML,c.type="checkbox",c.checked=!0,b.appendChild(c),l.appendChecked=c.checked,a.innerHTML="<textarea>x</textarea>",l.noCloneChecked=!!a.cloneNode(!0).lastChild.defaultValue,b.appendChild(a),c=d.createElement("input"),c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),a.appendChild(c),l.checkClone=a.cloneNode(!0).cloneNode(!0).lastChild.checked,l.noCloneEvent=!!a.addEventListener,a[n.expando]=1,l.attributes=!a.getAttribute(n.expando)}();var da={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:l.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]};da.optgroup=da.option,da.tbody=da.tfoot=da.colgroup=da.caption=da.thead,da.th=da.td;function ea(a,b){var c,d,e=0,f="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||n.nodeName(d,b)?f.push(d):n.merge(f,ea(d,b));return void 0===b||b&&n.nodeName(a,b)?n.merge([a],f):f}function fa(a,b){for(var c,d=0;null!=(c=a[d]);d++)n._data(c,"globalEval",!b||n._data(b[d],"globalEval"))}var ga=/<|&#?\w+;/,ha=/<tbody/i;function ia(a){Z.test(a.type)&&(a.defaultChecked=a.checked)}function ja(a,b,c,d,e){for(var f,g,h,i,j,k,m,o=a.length,p=ca(b),q=[],r=0;o>r;r++)if(g=a[r],g||0===g)if("object"===n.type(g))n.merge(q,g.nodeType?[g]:g);else if(ga.test(g)){i=i||p.appendChild(b.createElement("div")),j=($.exec(g)||["",""])[1].toLowerCase(),m=da[j]||da._default,i.innerHTML=m[1]+n.htmlPrefilter(g)+m[2],f=m[0];while(f--)i=i.lastChild;if(!l.leadingWhitespace&&aa.test(g)&&q.push(b.createTextNode(aa.exec(g)[0])),!l.tbody){g="table"!==j||ha.test(g)?"<table>"!==m[1]||ha.test(g)?0:i:i.firstChild,f=g&&g.childNodes.length;while(f--)n.nodeName(k=g.childNodes[f],"tbody")&&!k.childNodes.length&&g.removeChild(k)}n.merge(q,i.childNodes),i.textContent="";while(i.firstChild)i.removeChild(i.firstChild);i=p.lastChild}else q.push(b.createTextNode(g));i&&p.removeChild(i),l.appendChecked||n.grep(ea(q,"input"),ia),r=0;while(g=q[r++])if(d&&n.inArray(g,d)>-1)e&&e.push(g);else if(h=n.contains(g.ownerDocument,g),i=ea(p.appendChild(g),"script"),h&&fa(i),c){f=0;while(g=i[f++])_.test(g.type||"")&&c.push(g)}return i=null,p}!function(){var b,c,e=d.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(l[b]=c in a)||(e.setAttribute(c,"t"),l[b]=e.attributes[c].expando===!1);e=null}();var ka=/^(?:input|select|textarea)$/i,la=/^key/,ma=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,na=/^(?:focusinfocus|focusoutblur)$/,oa=/^([^.]*)(?:\.(.+)|)/;function pa(){return!0}function qa(){return!1}function ra(){try{return d.activeElement}catch(a){}}function sa(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)sa(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=qa;else if(!e)return a;return 1===f&&(g=e,e=function(a){return n().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=n.guid++)),a.each(function(){n.event.add(this,b,e,d,c)})}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=n._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=n.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return"undefined"==typeof n||a&&n.event.triggered===a.type?void 0:n.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(G)||[""],h=b.length;while(h--)f=oa.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=n.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=n.event.special[o]||{},l=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},i),(m=g[o])||(m=g[o]=[],m.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,l):m.push(l),n.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=n.hasData(a)&&n._data(a);if(r&&(k=r.events)){b=(b||"").match(G)||[""],j=b.length;while(j--)if(h=oa.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=m.length;while(f--)g=m[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(m.splice(f,1),g.selector&&m.delegateCount--,l.remove&&l.remove.call(a,g));i&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(k)&&(delete r.handle,n._removeData(a,"events"))}},trigger:function(b,c,e,f){var g,h,i,j,l,m,o,p=[e||d],q=k.call(b,"type")?b.type:b,r=k.call(b,"namespace")?b.namespace.split("."):[];if(i=m=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!na.test(q+n.event.triggered)&&(q.indexOf(".")>-1&&(r=q.split("."),q=r.shift(),r.sort()),h=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=r.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:n.makeArray(c,[b]),l=n.event.special[q]||{},f||!l.trigger||l.trigger.apply(e,c)!==!1)){if(!f&&!l.noBubble&&!n.isWindow(e)){for(j=l.delegateType||q,na.test(j+q)||(i=i.parentNode);i;i=i.parentNode)p.push(i),m=i;m===(e.ownerDocument||d)&&p.push(m.defaultView||m.parentWindow||a)}o=0;while((i=p[o++])&&!b.isPropagationStopped())b.type=o>1?j:l.bindType||q,g=(n._data(i,"events")||{})[b.type]&&n._data(i,"handle"),g&&g.apply(i,c),g=h&&i[h],g&&g.apply&&M(i)&&(b.result=g.apply(i,c),b.result===!1&&b.preventDefault());if(b.type=q,!f&&!b.isDefaultPrevented()&&(!l._default||l._default.apply(p.pop(),c)===!1)&&M(e)&&h&&e[q]&&!n.isWindow(e)){m=e[h],m&&(e[h]=null),n.event.triggered=q;try{e[q]()}catch(s){}n.event.triggered=void 0,m&&(e[h]=m)}return b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,d,f,g,h=[],i=e.call(arguments),j=(n._data(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())a.rnamespace&&!a.rnamespace.test(g.namespace)||(a.handleObj=g,a.data=g.data,d=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==d&&(a.result=d)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&("click"!==a.type||isNaN(a.button)||a.button<1))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>-1:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},fix:function(a){if(a[n.expando])return a;var b,c,e,f=a.type,g=a,h=this.fixHooks[f];h||(this.fixHooks[f]=h=ma.test(f)?this.mouseHooks:la.test(f)?this.keyHooks:{}),e=h.props?this.props.concat(h.props):this.props,a=new n.Event(g),b=e.length;while(b--)c=e[b],a[c]=g[c];return a.target||(a.target=g.srcElement||d),3===a.target.nodeType&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,h.filter?h.filter(a,g):a},props:"altKey bubbles cancelable ctrlKey currentTarget detail eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,e,f,g=b.button,h=b.fromElement;return null==a.pageX&&null!=b.clientX&&(e=a.target.ownerDocument||d,f=e.documentElement,c=e.body,a.pageX=b.clientX+(f&&f.scrollLeft||c&&c.scrollLeft||0)-(f&&f.clientLeft||c&&c.clientLeft||0),a.pageY=b.clientY+(f&&f.scrollTop||c&&c.scrollTop||0)-(f&&f.clientTop||c&&c.clientTop||0)),!a.relatedTarget&&h&&(a.relatedTarget=h===a.target?b.toElement:h),a.which||void 0===g||(a.which=1&g?1:2&g?3:4&g?2:0),a}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==ra()&&this.focus)try{return this.focus(),!1}catch(a){}},delegateType:"focusin"},blur:{trigger:function(){return this===ra()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return n.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(a){return n.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c){var d=n.extend(new n.Event,c,{type:a,isSimulated:!0});n.event.trigger(d,null,b),d.isDefaultPrevented()&&c.preventDefault()}},n.removeEvent=d.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c)}:function(a,b,c){var d="on"+b;a.detachEvent&&("undefined"==typeof a[d]&&(a[d]=null),a.detachEvent(d,c))},n.Event=function(a,b){return this instanceof n.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?pa:qa):this.type=a,b&&n.extend(this,b),this.timeStamp=a&&a.timeStamp||n.now(),void(this[n.expando]=!0)):new n.Event(a,b)},n.Event.prototype={constructor:n.Event,isDefaultPrevented:qa,isPropagationStopped:qa,isImmediatePropagationStopped:qa,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=pa,a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=pa,a&&!this.isSimulated&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=pa,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},n.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){n.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return e&&(e===d||n.contains(d,e))||(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),l.submit||(n.event.special.submit={setup:function(){return n.nodeName(this,"form")?!1:void n.event.add(this,"click._submit keypress._submit",function(a){var b=a.target,c=n.nodeName(b,"input")||n.nodeName(b,"button")?n.prop(b,"form"):void 0;c&&!n._data(c,"submit")&&(n.event.add(c,"submit._submit",function(a){a._submitBubble=!0}),n._data(c,"submit",!0))})},postDispatch:function(a){a._submitBubble&&(delete a._submitBubble,this.parentNode&&!a.isTrigger&&n.event.simulate("submit",this.parentNode,a))},teardown:function(){return n.nodeName(this,"form")?!1:void n.event.remove(this,"._submit")}}),l.change||(n.event.special.change={setup:function(){return ka.test(this.nodeName)?("checkbox"!==this.type&&"radio"!==this.type||(n.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&(this._justChanged=!0)}),n.event.add(this,"click._change",function(a){this._justChanged&&!a.isTrigger&&(this._justChanged=!1),n.event.simulate("change",this,a)})),!1):void n.event.add(this,"beforeactivate._change",function(a){var b=a.target;ka.test(b.nodeName)&&!n._data(b,"change")&&(n.event.add(b,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||n.event.simulate("change",this.parentNode,a)}),n._data(b,"change",!0))})},handle:function(a){var b=a.target;return this!==b||a.isSimulated||a.isTrigger||"radio"!==b.type&&"checkbox"!==b.type?a.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return n.event.remove(this,"._change"),!ka.test(this.nodeName)}}),l.focusin||n.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){n.event.simulate(b,a.target,n.event.fix(a))};n.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=n._data(d,b);e||d.addEventListener(a,c,!0),n._data(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=n._data(d,b)-1;e?n._data(d,b,e):(d.removeEventListener(a,c,!0),n._removeData(d,b))}}}),n.fn.extend({on:function(a,b,c,d){return sa(this,a,b,c,d)},one:function(a,b,c,d){return sa(this,a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,n(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return b!==!1&&"function"!=typeof b||(c=b,b=void 0),c===!1&&(c=qa),this.each(function(){n.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){n.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?n.event.trigger(a,b,c,!0):void 0}});var ta=/ jQuery\d+="(?:null|\d+)"/g,ua=new RegExp("<(?:"+ba+")[\\s/>]","i"),va=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,wa=/<script|<style|<link/i,xa=/checked\s*(?:[^=]|=\s*.checked.)/i,ya=/^true\/(.*)/,za=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,Aa=ca(d),Ba=Aa.appendChild(d.createElement("div"));function Ca(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function Da(a){return a.type=(null!==n.find.attr(a,"type"))+"/"+a.type,a}function Ea(a){var b=ya.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Fa(a,b){if(1===b.nodeType&&n.hasData(a)){var c,d,e,f=n._data(a),g=n._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)n.event.add(b,c,h[c][d])}g.data&&(g.data=n.extend({},g.data))}}function Ga(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!l.noCloneEvent&&b[n.expando]){e=n._data(b);for(d in e.events)n.removeEvent(b,d,e.handle);b.removeAttribute(n.expando)}"script"===c&&b.text!==a.text?(Da(b).text=a.text,Ea(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),l.html5Clone&&a.innerHTML&&!n.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&Z.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:"input"!==c&&"textarea"!==c||(b.defaultValue=a.defaultValue)}}function Ha(a,b,c,d){b=f.apply([],b);var e,g,h,i,j,k,m=0,o=a.length,p=o-1,q=b[0],r=n.isFunction(q);if(r||o>1&&"string"==typeof q&&!l.checkClone&&xa.test(q))return a.each(function(e){var f=a.eq(e);r&&(b[0]=q.call(this,e,f.html())),Ha(f,b,c,d)});if(o&&(k=ja(b,a[0].ownerDocument,!1,a,d),e=k.firstChild,1===k.childNodes.length&&(k=e),e||d)){for(i=n.map(ea(k,"script"),Da),h=i.length;o>m;m++)g=k,m!==p&&(g=n.clone(g,!0,!0),h&&n.merge(i,ea(g,"script"))),c.call(a[m],g,m);if(h)for(j=i[i.length-1].ownerDocument,n.map(i,Ea),m=0;h>m;m++)g=i[m],_.test(g.type||"")&&!n._data(g,"globalEval")&&n.contains(j,g)&&(g.src?n._evalUrl&&n._evalUrl(g.src):n.globalEval((g.text||g.textContent||g.innerHTML||"").replace(za,"")));k=e=null}return a}function Ia(a,b,c){for(var d,e=b?n.filter(b,a):a,f=0;null!=(d=e[f]);f++)c||1!==d.nodeType||n.cleanData(ea(d)),d.parentNode&&(c&&n.contains(d.ownerDocument,d)&&fa(ea(d,"script")),d.parentNode.removeChild(d));return a}n.extend({htmlPrefilter:function(a){return a.replace(va,"<$1></$2>")},clone:function(a,b,c){var d,e,f,g,h,i=n.contains(a.ownerDocument,a);if(l.html5Clone||n.isXMLDoc(a)||!ua.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(Ba.innerHTML=a.outerHTML,Ba.removeChild(f=Ba.firstChild)),!(l.noCloneEvent&&l.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(d=ea(f),h=ea(a),g=0;null!=(e=h[g]);++g)d[g]&&Ga(e,d[g]);if(b)if(c)for(h=h||ea(a),d=d||ea(f),g=0;null!=(e=h[g]);g++)Fa(e,d[g]);else Fa(a,f);return d=ea(f,"script"),d.length>0&&fa(d,!i&&ea(a,"script")),d=h=e=null,f},cleanData:function(a,b){for(var d,e,f,g,h=0,i=n.expando,j=n.cache,k=l.attributes,m=n.event.special;null!=(d=a[h]);h++)if((b||M(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)m[e]?n.event.remove(d,e):n.removeEvent(d,e,g.handle);j[f]&&(delete j[f],k||"undefined"==typeof d.removeAttribute?d[i]=void 0:d.removeAttribute(i),c.push(f))}}}),n.fn.extend({domManip:Ha,detach:function(a){return Ia(this,a,!0)},remove:function(a){return Ia(this,a)},text:function(a){return Y(this,function(a){return void 0===a?n.text(this):this.empty().append((this[0]&&this[0].ownerDocument||d).createTextNode(a))},null,a,arguments.length)},append:function(){return Ha(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ca(this,a);b.appendChild(a)}})},prepend:function(){return Ha(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ca(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return Ha(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return Ha(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&n.cleanData(ea(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&n.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return Y(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(ta,""):void 0;if("string"==typeof a&&!wa.test(a)&&(l.htmlSerialize||!ua.test(a))&&(l.leadingWhitespace||!aa.test(a))&&!da[($.exec(a)||["",""])[1].toLowerCase()]){a=n.htmlPrefilter(a);try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(ea(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=[];return Ha(this,arguments,function(b){var c=this.parentNode;n.inArray(this,a)<0&&(n.cleanData(ea(this)),c&&c.replaceChild(b,this))},a)}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=0,e=[],f=n(a),h=f.length-1;h>=d;d++)c=d===h?this:this.clone(!0),n(f[d])[b](c),g.apply(e,c.get());return this.pushStack(e)}});var Ja,Ka={HTML:"block",BODY:"block"};function La(a,b){var c=n(b.createElement(a)).appendTo(b.body),d=n.css(c[0],"display");return c.detach(),d}function Ma(a){var b=d,c=Ka[a];return c||(c=La(a,b),"none"!==c&&c||(Ja=(Ja||n("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=(Ja[0].contentWindow||Ja[0].contentDocument).document,b.write(),b.close(),c=La(a,b),Ja.detach()),Ka[a]=c),c}var Na=/^margin/,Oa=new RegExp("^("+T+")(?!px)[a-z%]+$","i"),Pa=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e},Qa=d.documentElement;!function(){var b,c,e,f,g,h,i=d.createElement("div"),j=d.createElement("div");if(j.style){j.style.cssText="float:left;opacity:.5",l.opacity="0.5"===j.style.opacity,l.cssFloat=!!j.style.cssFloat,j.style.backgroundClip="content-box",j.cloneNode(!0).style.backgroundClip="",l.clearCloneStyle="content-box"===j.style.backgroundClip,i=d.createElement("div"),i.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",j.innerHTML="",i.appendChild(j),l.boxSizing=""===j.style.boxSizing||""===j.style.MozBoxSizing||""===j.style.WebkitBoxSizing,n.extend(l,{reliableHiddenOffsets:function(){return null==b&&k(),f},boxSizingReliable:function(){return null==b&&k(),e},pixelMarginRight:function(){return null==b&&k(),c},pixelPosition:function(){return null==b&&k(),b},reliableMarginRight:function(){return null==b&&k(),g},reliableMarginLeft:function(){return null==b&&k(),h}});function k(){var k,l,m=d.documentElement;m.appendChild(i),j.style.cssText="-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",b=e=h=!1,c=g=!0,a.getComputedStyle&&(l=a.getComputedStyle(j),b="1%"!==(l||{}).top,h="2px"===(l||{}).marginLeft,e="4px"===(l||{width:"4px"}).width,j.style.marginRight="50%",c="4px"===(l||{marginRight:"4px"}).marginRight,k=j.appendChild(d.createElement("div")),k.style.cssText=j.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",k.style.marginRight=k.style.width="0",j.style.width="1px",g=!parseFloat((a.getComputedStyle(k)||{}).marginRight),j.removeChild(k)),j.style.display="none",f=0===j.getClientRects().length,f&&(j.style.display="",j.innerHTML="<table><tr><td></td><td>t</td></tr></table>",j.childNodes[0].style.borderCollapse="separate",k=j.getElementsByTagName("td"),k[0].style.cssText="margin:0;border:0;padding:0;display:none",f=0===k[0].offsetHeight,f&&(k[0].style.display="",k[1].style.display="none",f=0===k[0].offsetHeight)),m.removeChild(i)}}}();var Ra,Sa,Ta=/^(top|right|bottom|left)$/;a.getComputedStyle?(Ra=function(b){var c=b.ownerDocument.defaultView;return c&&c.opener||(c=a),c.getComputedStyle(b)},Sa=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ra(a),g=c?c.getPropertyValue(b)||c[b]:void 0,""!==g&&void 0!==g||n.contains(a.ownerDocument,a)||(g=n.style(a,b)),c&&!l.pixelMarginRight()&&Oa.test(g)&&Na.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f),void 0===g?g:g+""}):Qa.currentStyle&&(Ra=function(a){return a.currentStyle},Sa=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ra(a),g=c?c[b]:void 0,null==g&&h&&h[b]&&(g=h[b]),Oa.test(g)&&!Ta.test(b)&&(d=h.left,e=a.runtimeStyle,f=e&&e.left,f&&(e.left=a.currentStyle.left),h.left="fontSize"===b?"1em":g,g=h.pixelLeft+"px",h.left=d,f&&(e.left=f)),void 0===g?g:g+""||"auto"});function Ua(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}var Va=/alpha\([^)]*\)/i,Wa=/opacity\s*=\s*([^)]*)/i,Xa=/^(none|table(?!-c[ea]).+)/,Ya=new RegExp("^("+T+")(.*)$","i"),Za={position:"absolute",visibility:"hidden",display:"block"},$a={letterSpacing:"0",fontWeight:"400"},_a=["Webkit","O","Moz","ms"],ab=d.createElement("div").style;function bb(a){if(a in ab)return a;var b=a.charAt(0).toUpperCase()+a.slice(1),c=_a.length;while(c--)if(a=_a[c]+b,a in ab)return a}function cb(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=n._data(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&W(d)&&(f[g]=n._data(d,"olddisplay",Ma(d.nodeName)))):(e=W(d),(c&&"none"!==c||!e)&&n._data(d,"olddisplay",e?c:n.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}function db(a,b,c){var d=Ya.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function eb(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=n.css(a,c+V[f],!0,e)),d?("content"===c&&(g-=n.css(a,"padding"+V[f],!0,e)),"margin"!==c&&(g-=n.css(a,"border"+V[f]+"Width",!0,e))):(g+=n.css(a,"padding"+V[f],!0,e),"padding"!==c&&(g+=n.css(a,"border"+V[f]+"Width",!0,e)));return g}function fb(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Ra(a),g=l.boxSizing&&"border-box"===n.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=Sa(a,b,f),(0>e||null==e)&&(e=a.style[b]),Oa.test(e))return e;d=g&&(l.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+eb(a,b,c||(g?"border":"content"),d,f)+"px"}n.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Sa(a,"opacity");return""===c?"1":c}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":l.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=n.camelCase(b),i=a.style;if(b=n.cssProps[h]||(n.cssProps[h]=bb(h)||h),g=n.cssHooks[b]||n.cssHooks[h],void 0===c)return g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b];if(f=typeof c,"string"===f&&(e=U.exec(c))&&e[1]&&(c=X(a,b,e),f="number"),null!=c&&c===c&&("number"===f&&(c+=e&&e[3]||(n.cssNumber[h]?"":"px")),l.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),!(g&&"set"in g&&void 0===(c=g.set(a,c,d)))))try{i[b]=c}catch(j){}}},css:function(a,b,c,d){var e,f,g,h=n.camelCase(b);return b=n.cssProps[h]||(n.cssProps[h]=bb(h)||h),g=n.cssHooks[b]||n.cssHooks[h],g&&"get"in g&&(f=g.get(a,!0,c)),void 0===f&&(f=Sa(a,b,d)),"normal"===f&&b in $a&&(f=$a[b]),""===c||c?(e=parseFloat(f),c===!0||isFinite(e)?e||0:f):f}}),n.each(["height","width"],function(a,b){n.cssHooks[b]={get:function(a,c,d){return c?Xa.test(n.css(a,"display"))&&0===a.offsetWidth?Pa(a,Za,function(){return fb(a,b,d)}):fb(a,b,d):void 0},set:function(a,c,d){var e=d&&Ra(a);return db(a,c,d?eb(a,b,d,l.boxSizing&&"border-box"===n.css(a,"boxSizing",!1,e),e):0)}}}),l.opacity||(n.cssHooks.opacity={get:function(a,b){return Wa.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=n.isNumeric(b)?"alpha(opacity="+100*b+")":"",f=d&&d.filter||c.filter||"";c.zoom=1,(b>=1||""===b)&&""===n.trim(f.replace(Va,""))&&c.removeAttribute&&(c.removeAttribute("filter"),""===b||d&&!d.filter)||(c.filter=Va.test(f)?f.replace(Va,e):f+" "+e)}}),n.cssHooks.marginRight=Ua(l.reliableMarginRight,function(a,b){return b?Pa(a,{display:"inline-block"},Sa,[a,"marginRight"]):void 0}),n.cssHooks.marginLeft=Ua(l.reliableMarginLeft,function(a,b){return b?(parseFloat(Sa(a,"marginLeft"))||(n.contains(a.ownerDocument,a)?a.getBoundingClientRect().left-Pa(a,{
marginLeft:0},function(){return a.getBoundingClientRect().left}):0))+"px":void 0}),n.each({margin:"",padding:"",border:"Width"},function(a,b){n.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+V[d]+b]=f[d]||f[d-2]||f[0];return e}},Na.test(a)||(n.cssHooks[a+b].set=db)}),n.fn.extend({css:function(a,b){return Y(this,function(a,b,c){var d,e,f={},g=0;if(n.isArray(b)){for(d=Ra(a),e=b.length;e>g;g++)f[b[g]]=n.css(a,b[g],!1,d);return f}return void 0!==c?n.style(a,b,c):n.css(a,b)},a,b,arguments.length>1)},show:function(){return cb(this,!0)},hide:function(){return cb(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){W(this)?n(this).show():n(this).hide()})}});function gb(a,b,c,d,e){return new gb.prototype.init(a,b,c,d,e)}n.Tween=gb,gb.prototype={constructor:gb,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||n.easing._default,this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(n.cssNumber[c]?"":"px")},cur:function(){var a=gb.propHooks[this.prop];return a&&a.get?a.get(this):gb.propHooks._default.get(this)},run:function(a){var b,c=gb.propHooks[this.prop];return this.options.duration?this.pos=b=n.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):gb.propHooks._default.set(this),this}},gb.prototype.init.prototype=gb.prototype,gb.propHooks={_default:{get:function(a){var b;return 1!==a.elem.nodeType||null!=a.elem[a.prop]&&null==a.elem.style[a.prop]?a.elem[a.prop]:(b=n.css(a.elem,a.prop,""),b&&"auto"!==b?b:0)},set:function(a){n.fx.step[a.prop]?n.fx.step[a.prop](a):1!==a.elem.nodeType||null==a.elem.style[n.cssProps[a.prop]]&&!n.cssHooks[a.prop]?a.elem[a.prop]=a.now:n.style(a.elem,a.prop,a.now+a.unit)}}},gb.propHooks.scrollTop=gb.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},n.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},_default:"swing"},n.fx=gb.prototype.init,n.fx.step={};var hb,ib,jb=/^(?:toggle|show|hide)$/,kb=/queueHooks$/;function lb(){return a.setTimeout(function(){hb=void 0}),hb=n.now()}function mb(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=V[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function nb(a,b,c){for(var d,e=(qb.tweeners[b]||[]).concat(qb.tweeners["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function ob(a,b,c){var d,e,f,g,h,i,j,k,m=this,o={},p=a.style,q=a.nodeType&&W(a),r=n._data(a,"fxshow");c.queue||(h=n._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,m.always(function(){m.always(function(){h.unqueued--,n.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[p.overflow,p.overflowX,p.overflowY],j=n.css(a,"display"),k="none"===j?n._data(a,"olddisplay")||Ma(a.nodeName):j,"inline"===k&&"none"===n.css(a,"float")&&(l.inlineBlockNeedsLayout&&"inline"!==Ma(a.nodeName)?p.zoom=1:p.display="inline-block")),c.overflow&&(p.overflow="hidden",l.shrinkWrapBlocks()||m.always(function(){p.overflow=c.overflow[0],p.overflowX=c.overflow[1],p.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],jb.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(q?"hide":"show")){if("show"!==e||!r||void 0===r[d])continue;q=!0}o[d]=r&&r[d]||n.style(a,d)}else j=void 0;if(n.isEmptyObject(o))"inline"===("none"===j?Ma(a.nodeName):j)&&(p.display=j);else{r?"hidden"in r&&(q=r.hidden):r=n._data(a,"fxshow",{}),f&&(r.hidden=!q),q?n(a).show():m.done(function(){n(a).hide()}),m.done(function(){var b;n._removeData(a,"fxshow");for(b in o)n.style(a,b,o[b])});for(d in o)g=nb(q?r[d]:0,d,m),d in r||(r[d]=g.start,q&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function pb(a,b){var c,d,e,f,g;for(c in a)if(d=n.camelCase(c),e=b[d],f=a[c],n.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=n.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function qb(a,b,c){var d,e,f=0,g=qb.prefilters.length,h=n.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=hb||lb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:n.extend({},b),opts:n.extend(!0,{specialEasing:{},easing:n.easing._default},c),originalProperties:b,originalOptions:c,startTime:hb||lb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=n.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?(h.notifyWith(a,[j,1,0]),h.resolveWith(a,[j,b])):h.rejectWith(a,[j,b]),this}}),k=j.props;for(pb(k,j.opts.specialEasing);g>f;f++)if(d=qb.prefilters[f].call(j,a,k,j.opts))return n.isFunction(d.stop)&&(n._queueHooks(j.elem,j.opts.queue).stop=n.proxy(d.stop,d)),d;return n.map(k,nb,j),n.isFunction(j.opts.start)&&j.opts.start.call(a,j),n.fx.timer(n.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}n.Animation=n.extend(qb,{tweeners:{"*":[function(a,b){var c=this.createTween(a,b);return X(c.elem,a,U.exec(b),c),c}]},tweener:function(a,b){n.isFunction(a)?(b=a,a=["*"]):a=a.match(G);for(var c,d=0,e=a.length;e>d;d++)c=a[d],qb.tweeners[c]=qb.tweeners[c]||[],qb.tweeners[c].unshift(b)},prefilters:[ob],prefilter:function(a,b){b?qb.prefilters.unshift(a):qb.prefilters.push(a)}}),n.speed=function(a,b,c){var d=a&&"object"==typeof a?n.extend({},a):{complete:c||!c&&b||n.isFunction(a)&&a,duration:a,easing:c&&b||b&&!n.isFunction(b)&&b};return d.duration=n.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in n.fx.speeds?n.fx.speeds[d.duration]:n.fx.speeds._default,null!=d.queue&&d.queue!==!0||(d.queue="fx"),d.old=d.complete,d.complete=function(){n.isFunction(d.old)&&d.old.call(this),d.queue&&n.dequeue(this,d.queue)},d},n.fn.extend({fadeTo:function(a,b,c,d){return this.filter(W).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=n.isEmptyObject(a),f=n.speed(b,c,d),g=function(){var b=qb(this,n.extend({},a),f);(e||n._data(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=n.timers,g=n._data(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&kb.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));!b&&c||n.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=n._data(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=n.timers,g=d?d.length:0;for(c.finish=!0,n.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),n.each(["toggle","show","hide"],function(a,b){var c=n.fn[b];n.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(mb(b,!0),a,d,e)}}),n.each({slideDown:mb("show"),slideUp:mb("hide"),slideToggle:mb("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){n.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),n.timers=[],n.fx.tick=function(){var a,b=n.timers,c=0;for(hb=n.now();c<b.length;c++)a=b[c],a()||b[c]!==a||b.splice(c--,1);b.length||n.fx.stop(),hb=void 0},n.fx.timer=function(a){n.timers.push(a),a()?n.fx.start():n.timers.pop()},n.fx.interval=13,n.fx.start=function(){ib||(ib=a.setInterval(n.fx.tick,n.fx.interval))},n.fx.stop=function(){a.clearInterval(ib),ib=null},n.fx.speeds={slow:600,fast:200,_default:400},n.fn.delay=function(b,c){return b=n.fx?n.fx.speeds[b]||b:b,c=c||"fx",this.queue(c,function(c,d){var e=a.setTimeout(c,b);d.stop=function(){a.clearTimeout(e)}})},function(){var a,b=d.createElement("input"),c=d.createElement("div"),e=d.createElement("select"),f=e.appendChild(d.createElement("option"));c=d.createElement("div"),c.setAttribute("className","t"),c.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",a=c.getElementsByTagName("a")[0],b.setAttribute("type","checkbox"),c.appendChild(b),a=c.getElementsByTagName("a")[0],a.style.cssText="top:1px",l.getSetAttribute="t"!==c.className,l.style=/top/.test(a.getAttribute("style")),l.hrefNormalized="/a"===a.getAttribute("href"),l.checkOn=!!b.value,l.optSelected=f.selected,l.enctype=!!d.createElement("form").enctype,e.disabled=!0,l.optDisabled=!f.disabled,b=d.createElement("input"),b.setAttribute("value",""),l.input=""===b.getAttribute("value"),b.value="t",b.setAttribute("type","radio"),l.radioValue="t"===b.value}();var rb=/\r/g,sb=/[\x20\t\r\n\f]+/g;n.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=n.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,n(this).val()):a,null==e?e="":"number"==typeof e?e+="":n.isArray(e)&&(e=n.map(e,function(a){return null==a?"":a+""})),b=n.valHooks[this.type]||n.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=n.valHooks[e.type]||n.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(rb,""):null==c?"":c)}}}),n.extend({valHooks:{option:{get:function(a){var b=n.find.attr(a,"value");return null!=b?b:n.trim(n.text(a)).replace(sb," ")}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],(c.selected||i===e)&&(l.optDisabled?!c.disabled:null===c.getAttribute("disabled"))&&(!c.parentNode.disabled||!n.nodeName(c.parentNode,"optgroup"))){if(b=n(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=n.makeArray(b),g=e.length;while(g--)if(d=e[g],n.inArray(n.valHooks.option.get(d),f)>-1)try{d.selected=c=!0}catch(h){d.scrollHeight}else d.selected=!1;return c||(a.selectedIndex=-1),e}}}}),n.each(["radio","checkbox"],function(){n.valHooks[this]={set:function(a,b){return n.isArray(b)?a.checked=n.inArray(n(a).val(),b)>-1:void 0}},l.checkOn||(n.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var tb,ub,vb=n.expr.attrHandle,wb=/^(?:checked|selected)$/i,xb=l.getSetAttribute,yb=l.input;n.fn.extend({attr:function(a,b){return Y(this,n.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){n.removeAttr(this,a)})}}),n.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return"undefined"==typeof a.getAttribute?n.prop(a,b,c):(1===f&&n.isXMLDoc(a)||(b=b.toLowerCase(),e=n.attrHooks[b]||(n.expr.match.bool.test(b)?ub:tb)),void 0!==c?null===c?void n.removeAttr(a,b):e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+""),c):e&&"get"in e&&null!==(d=e.get(a,b))?d:(d=n.find.attr(a,b),null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!l.radioValue&&"radio"===b&&n.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(G);if(f&&1===a.nodeType)while(c=f[e++])d=n.propFix[c]||c,n.expr.match.bool.test(c)?yb&&xb||!wb.test(c)?a[d]=!1:a[n.camelCase("default-"+c)]=a[d]=!1:n.attr(a,c,""),a.removeAttribute(xb?c:d)}}),ub={set:function(a,b,c){return b===!1?n.removeAttr(a,c):yb&&xb||!wb.test(c)?a.setAttribute(!xb&&n.propFix[c]||c,c):a[n.camelCase("default-"+c)]=a[c]=!0,c}},n.each(n.expr.match.bool.source.match(/\w+/g),function(a,b){var c=vb[b]||n.find.attr;yb&&xb||!wb.test(b)?vb[b]=function(a,b,d){var e,f;return d||(f=vb[b],vb[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,vb[b]=f),e}:vb[b]=function(a,b,c){return c?void 0:a[n.camelCase("default-"+b)]?b.toLowerCase():null}}),yb&&xb||(n.attrHooks.value={set:function(a,b,c){return n.nodeName(a,"input")?void(a.defaultValue=b):tb&&tb.set(a,b,c)}}),xb||(tb={set:function(a,b,c){var d=a.getAttributeNode(c);return d||a.setAttributeNode(d=a.ownerDocument.createAttribute(c)),d.value=b+="","value"===c||b===a.getAttribute(c)?b:void 0}},vb.id=vb.name=vb.coords=function(a,b,c){var d;return c?void 0:(d=a.getAttributeNode(b))&&""!==d.value?d.value:null},n.valHooks.button={get:function(a,b){var c=a.getAttributeNode(b);return c&&c.specified?c.value:void 0},set:tb.set},n.attrHooks.contenteditable={set:function(a,b,c){tb.set(a,""===b?!1:b,c)}},n.each(["width","height"],function(a,b){n.attrHooks[b]={set:function(a,c){return""===c?(a.setAttribute(b,"auto"),c):void 0}}})),l.style||(n.attrHooks.style={get:function(a){return a.style.cssText||void 0},set:function(a,b){return a.style.cssText=b+""}});var zb=/^(?:input|select|textarea|button|object)$/i,Ab=/^(?:a|area)$/i;n.fn.extend({prop:function(a,b){return Y(this,n.prop,a,b,arguments.length>1)},removeProp:function(a){return a=n.propFix[a]||a,this.each(function(){try{this[a]=void 0,delete this[a]}catch(b){}})}}),n.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&n.isXMLDoc(a)||(b=n.propFix[b]||b,e=n.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=n.find.attr(a,"tabindex");return b?parseInt(b,10):zb.test(a.nodeName)||Ab.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),l.hrefNormalized||n.each(["href","src"],function(a,b){n.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}}),l.optSelected||(n.propHooks.selected={get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),n.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){n.propFix[this.toLowerCase()]=this}),l.enctype||(n.propFix.enctype="encoding");var Bb=/[\t\r\n\f]/g;function Cb(a){return n.attr(a,"class")||""}n.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(n.isFunction(a))return this.each(function(b){n(this).addClass(a.call(this,b,Cb(this)))});if("string"==typeof a&&a){b=a.match(G)||[];while(c=this[i++])if(e=Cb(c),d=1===c.nodeType&&(" "+e+" ").replace(Bb," ")){g=0;while(f=b[g++])d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=n.trim(d),e!==h&&n.attr(c,"class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(n.isFunction(a))return this.each(function(b){n(this).removeClass(a.call(this,b,Cb(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a){b=a.match(G)||[];while(c=this[i++])if(e=Cb(c),d=1===c.nodeType&&(" "+e+" ").replace(Bb," ")){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")>-1)d=d.replace(" "+f+" "," ");h=n.trim(d),e!==h&&n.attr(c,"class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):n.isFunction(a)?this.each(function(c){n(this).toggleClass(a.call(this,c,Cb(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=n(this),f=a.match(G)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&"boolean"!==c||(b=Cb(this),b&&n._data(this,"__className__",b),n.attr(this,"class",b||a===!1?"":n._data(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&&(" "+Cb(c)+" ").replace(Bb," ").indexOf(b)>-1)return!0;return!1}}),n.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){n.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),n.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var Db=a.location,Eb=n.now(),Fb=/\?/,Gb=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;n.parseJSON=function(b){if(a.JSON&&a.JSON.parse)return a.JSON.parse(b+"");var c,d=null,e=n.trim(b+"");return e&&!n.trim(e.replace(Gb,function(a,b,e,f){return c&&b&&(d=0),0===d?a:(c=e||b,d+=!f-!e,"")}))?Function("return "+e)():n.error("Invalid JSON: "+b)},n.parseXML=function(b){var c,d;if(!b||"string"!=typeof b)return null;try{a.DOMParser?(d=new a.DOMParser,c=d.parseFromString(b,"text/xml")):(c=new a.ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b))}catch(e){c=void 0}return c&&c.documentElement&&!c.getElementsByTagName("parsererror").length||n.error("Invalid XML: "+b),c};var Hb=/#.*$/,Ib=/([?&])_=[^&]*/,Jb=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Kb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Lb=/^(?:GET|HEAD)$/,Mb=/^\/\//,Nb=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Ob={},Pb={},Qb="*/".concat("*"),Rb=Db.href,Sb=Nb.exec(Rb.toLowerCase())||[];function Tb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(G)||[];if(n.isFunction(c))while(d=f[e++])"+"===d.charAt(0)?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Ub(a,b,c,d){var e={},f=a===Pb;function g(h){var i;return e[h]=!0,n.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Vb(a,b){var c,d,e=n.ajaxSettings.flatOptions||{};for(d in b)void 0!==b[d]&&((e[d]?a:c||(c={}))[d]=b[d]);return c&&n.extend(!0,a,c),a}function Wb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===e&&(e=a.mimeType||b.getResponseHeader("Content-Type"));if(e)for(g in h)if(h[g]&&h[g].test(e)){i.unshift(g);break}if(i[0]in c)f=i[0];else{for(g in c){if(!i[0]||a.converters[g+" "+i[0]]){f=g;break}d||(d=g)}f=f||d}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Xb(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}n.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Rb,type:"GET",isLocal:Kb.test(Sb[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Qb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":n.parseJSON,"text xml":n.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Vb(Vb(a,n.ajaxSettings),b):Vb(n.ajaxSettings,a)},ajaxPrefilter:Tb(Ob),ajaxTransport:Tb(Pb),ajax:function(b,c){"object"==typeof b&&(c=b,b=void 0),c=c||{};var d,e,f,g,h,i,j,k,l=n.ajaxSetup({},c),m=l.context||l,o=l.context&&(m.nodeType||m.jquery)?n(m):n.event,p=n.Deferred(),q=n.Callbacks("once memory"),r=l.statusCode||{},s={},t={},u=0,v="canceled",w={readyState:0,getResponseHeader:function(a){var b;if(2===u){if(!k){k={};while(b=Jb.exec(g))k[b[1].toLowerCase()]=b[2]}b=k[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===u?g:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return u||(a=t[c]=t[c]||a,s[a]=b),this},overrideMimeType:function(a){return u||(l.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>u)for(b in a)r[b]=[r[b],a[b]];else w.always(a[w.status]);return this},abort:function(a){var b=a||v;return j&&j.abort(b),y(0,b),this}};if(p.promise(w).complete=q.add,w.success=w.done,w.error=w.fail,l.url=((b||l.url||Rb)+"").replace(Hb,"").replace(Mb,Sb[1]+"//"),l.type=c.method||c.type||l.method||l.type,l.dataTypes=n.trim(l.dataType||"*").toLowerCase().match(G)||[""],null==l.crossDomain&&(d=Nb.exec(l.url.toLowerCase()),l.crossDomain=!(!d||d[1]===Sb[1]&&d[2]===Sb[2]&&(d[3]||("http:"===d[1]?"80":"443"))===(Sb[3]||("http:"===Sb[1]?"80":"443")))),l.data&&l.processData&&"string"!=typeof l.data&&(l.data=n.param(l.data,l.traditional)),Ub(Ob,l,c,w),2===u)return w;i=n.event&&l.global,i&&0===n.active++&&n.event.trigger("ajaxStart"),l.type=l.type.toUpperCase(),l.hasContent=!Lb.test(l.type),f=l.url,l.hasContent||(l.data&&(f=l.url+=(Fb.test(f)?"&":"?")+l.data,delete l.data),l.cache===!1&&(l.url=Ib.test(f)?f.replace(Ib,"$1_="+Eb++):f+(Fb.test(f)?"&":"?")+"_="+Eb++)),l.ifModified&&(n.lastModified[f]&&w.setRequestHeader("If-Modified-Since",n.lastModified[f]),n.etag[f]&&w.setRequestHeader("If-None-Match",n.etag[f])),(l.data&&l.hasContent&&l.contentType!==!1||c.contentType)&&w.setRequestHeader("Content-Type",l.contentType),w.setRequestHeader("Accept",l.dataTypes[0]&&l.accepts[l.dataTypes[0]]?l.accepts[l.dataTypes[0]]+("*"!==l.dataTypes[0]?", "+Qb+"; q=0.01":""):l.accepts["*"]);for(e in l.headers)w.setRequestHeader(e,l.headers[e]);if(l.beforeSend&&(l.beforeSend.call(m,w,l)===!1||2===u))return w.abort();v="abort";for(e in{success:1,error:1,complete:1})w[e](l[e]);if(j=Ub(Pb,l,c,w)){if(w.readyState=1,i&&o.trigger("ajaxSend",[w,l]),2===u)return w;l.async&&l.timeout>0&&(h=a.setTimeout(function(){w.abort("timeout")},l.timeout));try{u=1,j.send(s,y)}catch(x){if(!(2>u))throw x;y(-1,x)}}else y(-1,"No Transport");function y(b,c,d,e){var k,s,t,v,x,y=c;2!==u&&(u=2,h&&a.clearTimeout(h),j=void 0,g=e||"",w.readyState=b>0?4:0,k=b>=200&&300>b||304===b,d&&(v=Wb(l,w,d)),v=Xb(l,v,w,k),k?(l.ifModified&&(x=w.getResponseHeader("Last-Modified"),x&&(n.lastModified[f]=x),x=w.getResponseHeader("etag"),x&&(n.etag[f]=x)),204===b||"HEAD"===l.type?y="nocontent":304===b?y="notmodified":(y=v.state,s=v.data,t=v.error,k=!t)):(t=y,!b&&y||(y="error",0>b&&(b=0))),w.status=b,w.statusText=(c||y)+"",k?p.resolveWith(m,[s,y,w]):p.rejectWith(m,[w,y,t]),w.statusCode(r),r=void 0,i&&o.trigger(k?"ajaxSuccess":"ajaxError",[w,l,k?s:t]),q.fireWith(m,[w,y]),i&&(o.trigger("ajaxComplete",[w,l]),--n.active||n.event.trigger("ajaxStop")))}return w},getJSON:function(a,b,c){return n.get(a,b,c,"json")},getScript:function(a,b){return n.get(a,void 0,b,"script")}}),n.each(["get","post"],function(a,b){n[b]=function(a,c,d,e){return n.isFunction(c)&&(e=e||d,d=c,c=void 0),n.ajax(n.extend({url:a,type:b,dataType:e,data:c,success:d},n.isPlainObject(a)&&a))}}),n._evalUrl=function(a){return n.ajax({url:a,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},n.fn.extend({wrapAll:function(a){if(n.isFunction(a))return this.each(function(b){n(this).wrapAll(a.call(this,b))});if(this[0]){var b=n(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&1===a.firstChild.nodeType)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return n.isFunction(a)?this.each(function(b){n(this).wrapInner(a.call(this,b))}):this.each(function(){var b=n(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=n.isFunction(a);return this.each(function(c){n(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){n.nodeName(this,"body")||n(this).replaceWith(this.childNodes)}).end()}});function Yb(a){return a.style&&a.style.display||n.css(a,"display")}function Zb(a){if(!n.contains(a.ownerDocument||d,a))return!0;while(a&&1===a.nodeType){if("none"===Yb(a)||"hidden"===a.type)return!0;a=a.parentNode}return!1}n.expr.filters.hidden=function(a){return l.reliableHiddenOffsets()?a.offsetWidth<=0&&a.offsetHeight<=0&&!a.getClientRects().length:Zb(a)},n.expr.filters.visible=function(a){return!n.expr.filters.hidden(a)};var $b=/%20/g,_b=/\[\]$/,ac=/\r?\n/g,bc=/^(?:submit|button|image|reset|file)$/i,cc=/^(?:input|select|textarea|keygen)/i;function dc(a,b,c,d){var e;if(n.isArray(b))n.each(b,function(b,e){c||_b.test(a)?d(a,e):dc(a+"["+("object"==typeof e&&null!=e?b:"")+"]",e,c,d)});else if(c||"object"!==n.type(b))d(a,b);else for(e in b)dc(a+"["+e+"]",b[e],c,d)}n.param=function(a,b){var c,d=[],e=function(a,b){b=n.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=n.ajaxSettings&&n.ajaxSettings.traditional),n.isArray(a)||a.jquery&&!n.isPlainObject(a))n.each(a,function(){e(this.name,this.value)});else for(c in a)dc(c,a[c],b,e);return d.join("&").replace($b,"+")},n.fn.extend({serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=n.prop(this,"elements");return a?n.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!n(this).is(":disabled")&&cc.test(this.nodeName)&&!bc.test(a)&&(this.checked||!Z.test(a))}).map(function(a,b){var c=n(this).val();return null==c?null:n.isArray(c)?n.map(c,function(a){return{name:b.name,value:a.replace(ac,"\r\n")}}):{name:b.name,value:c.replace(ac,"\r\n")}}).get()}}),n.ajaxSettings.xhr=void 0!==a.ActiveXObject?function(){return this.isLocal?ic():d.documentMode>8?hc():/^(get|post|head|put|delete|options)$/i.test(this.type)&&hc()||ic()}:hc;var ec=0,fc={},gc=n.ajaxSettings.xhr();a.attachEvent&&a.attachEvent("onunload",function(){for(var a in fc)fc[a](void 0,!0)}),l.cors=!!gc&&"withCredentials"in gc,gc=l.ajax=!!gc,gc&&n.ajaxTransport(function(b){if(!b.crossDomain||l.cors){var c;return{send:function(d,e){var f,g=b.xhr(),h=++ec;if(g.open(b.type,b.url,b.async,b.username,b.password),b.xhrFields)for(f in b.xhrFields)g[f]=b.xhrFields[f];b.mimeType&&g.overrideMimeType&&g.overrideMimeType(b.mimeType),b.crossDomain||d["X-Requested-With"]||(d["X-Requested-With"]="XMLHttpRequest");for(f in d)void 0!==d[f]&&g.setRequestHeader(f,d[f]+"");g.send(b.hasContent&&b.data||null),c=function(a,d){var f,i,j;if(c&&(d||4===g.readyState))if(delete fc[h],c=void 0,g.onreadystatechange=n.noop,d)4!==g.readyState&&g.abort();else{j={},f=g.status,"string"==typeof g.responseText&&(j.text=g.responseText);try{i=g.statusText}catch(k){i=""}f||!b.isLocal||b.crossDomain?1223===f&&(f=204):f=j.text?200:404}j&&e(f,i,j,g.getAllResponseHeaders())},b.async?4===g.readyState?a.setTimeout(c):g.onreadystatechange=fc[h]=c:c()},abort:function(){c&&c(void 0,!0)}}}});function hc(){try{return new a.XMLHttpRequest}catch(b){}}function ic(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}n.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(a){return n.globalEval(a),a}}}),n.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),n.ajaxTransport("script",function(a){if(a.crossDomain){var b,c=d.head||n("head")[0]||d.documentElement;return{send:function(e,f){b=d.createElement("script"),b.async=!0,a.scriptCharset&&(b.charset=a.scriptCharset),b.src=a.url,b.onload=b.onreadystatechange=function(a,c){(c||!b.readyState||/loaded|complete/.test(b.readyState))&&(b.onload=b.onreadystatechange=null,b.parentNode&&b.parentNode.removeChild(b),b=null,c||f(200,"success"))},c.insertBefore(b,c.firstChild)},abort:function(){b&&b.onload(void 0,!0)}}}});var jc=[],kc=/(=)\?(?=&|$)|\?\?/;n.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=jc.pop()||n.expando+"_"+Eb++;return this[a]=!0,a}}),n.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(kc.test(b.url)?"url":"string"==typeof b.data&&0===(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&kc.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=n.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(kc,"$1"+e):b.jsonp!==!1&&(b.url+=(Fb.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||n.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){void 0===f?n(a).removeProp(e):a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,jc.push(e)),g&&n.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),n.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||d;var e=x.exec(a),f=!c&&[];return e?[b.createElement(e[1])]:(e=ja([a],b,f),f&&f.length&&n(f).remove(),n.merge([],e.childNodes))};var lc=n.fn.load;n.fn.load=function(a,b,c){if("string"!=typeof a&&lc)return lc.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>-1&&(d=n.trim(a.slice(h,a.length)),a=a.slice(0,h)),n.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&n.ajax({url:a,type:e||"GET",dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?n("<div>").append(n.parseHTML(a)).find(d):a)}).always(c&&function(a,b){g.each(function(){c.apply(this,f||[a.responseText,b,a])})}),this},n.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){n.fn[b]=function(a){return this.on(b,a)}}),n.expr.filters.animated=function(a){return n.grep(n.timers,function(b){return a===b.elem}).length};function mc(a){return n.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}n.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=n.css(a,"position"),l=n(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=n.css(a,"top"),i=n.css(a,"left"),j=("absolute"===k||"fixed"===k)&&n.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),n.isFunction(b)&&(b=b.call(a,c,n.extend({},h))),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},n.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){n.offset.setOffset(this,a,b)});var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;if(f)return b=f.documentElement,n.contains(b,e)?("undefined"!=typeof e.getBoundingClientRect&&(d=e.getBoundingClientRect()),c=mc(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d},position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===n.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),n.nodeName(a[0],"html")||(c=a.offset()),c.top+=n.css(a[0],"borderTopWidth",!0),c.left+=n.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-n.css(d,"marginTop",!0),left:b.left-c.left-n.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent;while(a&&!n.nodeName(a,"html")&&"static"===n.css(a,"position"))a=a.offsetParent;return a||Qa})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);n.fn[a]=function(d){return Y(this,function(a,d,e){var f=mc(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?n(f).scrollLeft():e,c?e:n(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),n.each(["top","left"],function(a,b){n.cssHooks[b]=Ua(l.pixelPosition,function(a,c){return c?(c=Sa(a,b),Oa.test(c)?n(a).position()[b]+"px":c):void 0})}),n.each({Height:"height",Width:"width"},function(a,b){n.each({
padding:"inner"+a,content:b,"":"outer"+a},function(c,d){n.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return Y(this,function(b,c,d){var e;return n.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?n.css(b,c,g):n.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),n.fn.extend({bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}}),n.fn.size=function(){return this.length},n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var nc=a.jQuery,oc=a.$;return n.noConflict=function(b){return a.$===n&&(a.$=oc),b&&a.jQuery===n&&(a.jQuery=nc),n},b||(a.jQuery=a.$=n),n});
`,
}
View Source
var ShellModeG bool = false
View Source
var VersionG string = "0.6.0"

Functions

func RunCode

func RunCode(codeA string, objA interface{}, sharedMapA *tk.SyncMap, optsA ...string) interface{}

func SetLeVSilent

func SetLeVSilent(vA bool)

Types

type ExprElement

type ExprElement struct {
	// 0: value, 1: operator, 6: (, 7: ), 9: end
	Type     int
	Priority int
	Value    string
}

type FuncContext

type FuncContext struct {
	// VarsM          map[int]interface{}
	VarsLocalMapM  map[int]int
	VarsM          *[]interface{}
	ReturnPointerM int

	DeferStackM *tk.SimpleStack

	Layer int
}

type Instr

type Instr struct {
	Code     int
	ParamLen int
	Params   []VarRef
	Line     string
}

func (Instr) ParamsToList

func (v Instr) ParamsToList(fromA int) []interface{}

func (Instr) ParamsToStrs

func (v Instr) ParamsToStrs(fromA int) []string

type UndefinedStruct

type UndefinedStruct struct {
	// contains filtered or unexported fields
}
var Undefined UndefinedStruct = UndefinedStruct{0}

func (UndefinedStruct) String

func (o UndefinedStruct) String() string

type VarRef

type VarRef struct {
	Ref   int // -99 - invalid, -15 - ref, -12 - unref, -10 - quickEval, -9 - eval, -8 - pop, -7 - peek, -6 - push, -5 - tmp, -4 - pln, -3 - var(string), -2 - drop, -1 - debug, > 0 normal vars
	Value interface{}
}

func GetVarRefFromArray

func GetVarRefFromArray(aryA []VarRef, idxT int) VarRef

type XieAny

type XieAny struct {
	Value interface{}

	Members map[string]interface{}
}

func (*XieAny) Call

func (p *XieAny) Call(argsA ...interface{}) interface{}

func (*XieAny) GetMember

func (p *XieAny) GetMember(argsA ...interface{}) interface{}

func (XieAny) GetValue

func (v XieAny) GetValue(argsA ...interface{}) interface{}

func (*XieAny) Init

func (p *XieAny) Init(argsA ...interface{}) interface{}

func (*XieAny) SetMember

func (p *XieAny) SetMember(argsA ...interface{}) interface{}

func (*XieAny) SetValue

func (p *XieAny) SetValue(argsA ...interface{}) interface{}

func (XieAny) String

func (v XieAny) String() string

func (XieAny) TypeName

func (v XieAny) TypeName() string

type XieHandler

type XieHandler func(actionA string, dataA interface{}, paramsA ...interface{}) interface{}

type XieObject

type XieObject interface {
	TypeName() string

	Init(argsA ...interface{}) interface{}

	SetValue(argsA ...interface{}) interface{}

	GetValue(argsA ...interface{}) interface{}

	Call(argsA ...interface{}) interface{}

	SetMember(argsA ...interface{}) interface{}

	GetMember(argsA ...interface{}) interface{}
}

type XieString

type XieString struct {
	Value string

	Members map[string]interface{}
}

func (*XieString) Call

func (p *XieString) Call(argsA ...interface{}) interface{}

func (*XieString) GetMember

func (p *XieString) GetMember(argsA ...interface{}) interface{}

func (XieString) GetValue

func (v XieString) GetValue(argsA ...interface{}) interface{}

func (*XieString) Init

func (p *XieString) Init(argsA ...interface{}) interface{}

func (*XieString) SetMember

func (p *XieString) SetMember(argsA ...interface{}) interface{}

func (*XieString) SetValue

func (p *XieString) SetValue(argsA ...interface{}) interface{}

func (XieString) String

func (v XieString) String() string

func (XieString) TypeName

func (v XieString) TypeName() string

type XieVM

type XieVM struct {
	SourceM        []string
	CodeListM      []string
	InstrListM     []Instr
	CodeSourceMapM map[int]int

	LabelsM      map[int]int
	VarIndexMapM map[string]int
	VarNameMapM  map[int]string

	CodePointerM int

	StackM        []interface{}
	StackPointerM int

	FuncStackM        []FuncContext
	FuncStackPointerM int

	FuncContextM FuncContext

	CurrentFuncContextM *FuncContext

	TmpM interface{} // 预制全局变量$tmp,一般用于临时存储

	SharedMapM *tk.SyncMap // 预设全局共享映射,线程安全,可用于存储各个虚拟机需共享的内容

	ErrorHandlerM int

	VerboseM bool

	VerbosePlusM bool

	GuiM map[string]interface{}
}

func NewXie

func NewXie(sharedMapA *tk.SyncMap, globalsA ...map[string]interface{}) *XieVM

func (*XieVM) CallFunc

func (p *XieVM) CallFunc(codeA string, argCountA int) string

func (*XieVM) Debug

func (p *XieVM) Debug()

func (*XieVM) ErrStrf

func (p *XieVM) ErrStrf(formatA string, argsA ...interface{}) string

func (*XieVM) EvalExpression

func (p *XieVM) EvalExpression(strA string) (resultR interface{})

func (*XieVM) EvalExpressionNoGroup

func (p *XieVM) EvalExpressionNoGroup(strA string, valuesA *map[string]interface{}) interface{}

func (*XieVM) GetSwitchVarValue

func (p *XieVM) GetSwitchVarValue(argsA []string, switchStrA string, defaultA ...string) string

func (*XieVM) GetVar

func (p *XieVM) GetVar(keyA string) interface{}

func (*XieVM) GetVarInt

func (p *XieVM) GetVarInt(keyA int) interface{}

func (*XieVM) GetVarRef

func (p *XieVM) GetVarRef(vA VarRef) *interface{}

func (*XieVM) GetVarRefNative

func (p *XieVM) GetVarRefNative(vA VarRef) interface{}

func (*XieVM) GetVarValue

func (p *XieVM) GetVarValue(vA VarRef) interface{}

func (*XieVM) GetVarValueGlobal

func (p *XieVM) GetVarValueGlobal(vA VarRef) interface{}

func (*XieVM) GetVarValueWithLayer

func (p *XieVM) GetVarValueWithLayer(vA VarRef) (interface{}, int)

func (*XieVM) GetVars

func (p *XieVM) GetVars() []interface{}

get current vars in context

func (*XieVM) GoFunc

func (p *XieVM) GoFunc(codeA string, argCountA int) string

func (*XieVM) InitVM

func (p *XieVM) InitVM(sharedMapA *tk.SyncMap, globalsA ...map[string]interface{})

func (*XieVM) Load

func (p *XieVM) Load(codeA string) string

func (*XieVM) NewInstr

func (p *XieVM) NewInstr(codeA string, valuesA *map[string]interface{}) Instr

func (*XieVM) ParamsToList

func (p *XieVM) ParamsToList(v Instr, fromA int) []interface{}

func (*XieVM) ParamsToRefList

func (p *XieVM) ParamsToRefList(v *Instr, fromA int) []interface{}

func (*XieVM) ParamsToReflectValueList

func (p *XieVM) ParamsToReflectValueList(v Instr, fromA int) []reflect.Value

func (*XieVM) ParamsToStrs

func (p *XieVM) ParamsToStrs(v Instr, fromA int) []string

func (*XieVM) ParseLine

func (p *XieVM) ParseLine(commandA string) ([]string, string, error)

func (*XieVM) ParseVar

func (p *XieVM) ParseVar(strA string) VarRef

func (*XieVM) Peek

func (p *XieVM) Peek() interface{}

func (*XieVM) Pop

func (p *XieVM) Pop() interface{}

func (*XieVM) PopFunc

func (p *XieVM) PopFunc() int

func (*XieVM) Pops

func (p *XieVM) Pops() string

func (*XieVM) Push

func (p *XieVM) Push(vA interface{})

func (*XieVM) PushFunc

func (p *XieVM) PushFunc()

func (*XieVM) PushVar

func (p *XieVM) PushVar(vA interface{})

func (*XieVM) QuickEval

func (p *XieVM) QuickEval(strA string) interface{}

func (*XieVM) Run

func (p *XieVM) Run(posA ...int) string

func (*XieVM) RunDefer

func (p *XieVM) RunDefer() interface{}

func (*XieVM) RunLine

func (p *XieVM) RunLine(lineA int, codeA ...Instr) (resultR interface{})

func (*XieVM) SetVar

func (p *XieVM) SetVar(keyA string, vA interface{}) error

func (*XieVM) SetVarGlobal

func (p *XieVM) SetVarGlobal(keyA string, vA interface{})

func (*XieVM) SetVarInt

func (p *XieVM) SetVarInt(keyA int, vA interface{}) error

func (*XieVM) SetVarIntGlobal

func (p *XieVM) SetVarIntGlobal(keyA int, vA interface{}) error

func (*XieVM) SetVarIntLocal

func (p *XieVM) SetVarIntLocal(keyA int, vA interface{}) error

func (*XieVM) SplitExpr

func (p *XieVM) SplitExpr(strA string) ([]ExprElement, error)

Directories

Path Synopsis
cmd
xie Module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL