-
Notifications
You must be signed in to change notification settings - Fork 72
/
jquery-calx-2.2.8.min.js
228 lines (228 loc) · 113 KB
/
jquery-calx-2.2.8.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
"undefined"==typeof Zepto&&(Zepto=void 0);"undefined"==typeof jQuery&&(jQuery=Zepto);"undefined"==typeof numeral&&(numeral=void 0);"undefined"==typeof moment&&(moment=void 0);"undefined"==typeof jStat&&(jStat=void 0);
(function(r,x,h,g){function F(a){function b(){this.yy={}}var c={trace:function(){},yy:{},symbols_:{error:2,expressions:3,e:4,EOF:5,variableSequence:6,TIME_AMPM:7,TIME_24:8,number:9,STRING:10,TRUE:11,FALSE:12,NULL:13,"=":14,"+":15,"(":16,")":17,"[":18,expseq:19,"]":20,"<":21,">":22,NOT:23,"-":24,"*":25,"/":26,"^":27,E:28,FUNCTION:29,cell:30,FIXEDCELL:31,":":32,CELL:33,SHEET:34,"!":35,";":36,",":37,VARIABLE:38,DECIMAL:39,NUMBER:40,"%":41,"#":42,$accept:0,$end:1},terminals_:{5:"EOF",7:"TIME_AMPM",8:"TIME_24",
10:"STRING",11:"TRUE",12:"FALSE",13:"NULL",14:"=",15:"+",16:"(",17:")",18:"[",20:"]",21:"<",22:">",23:"NOT",24:"-",25:"*",26:"/",27:"^",28:"E",29:"FUNCTION",31:"FIXEDCELL",32:":",33:"CELL",34:"SHEET",35:"!",36:";",37:",",38:"VARIABLE",39:"DECIMAL",40:"NUMBER",41:"%",42:"#"},productions_:[0,[3,2],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,3],[4,3],[4,3],[4,3],[4,4],[4,4],[4,4],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,2],[4,2],[4,1],[4,3],[4,4],[4,1],[4,1],[4,2],[30,1],[30,3],[30,1],[30,
3],[30,3],[30,5],[19,1],[19,3],[19,3],[6,1],[6,3],[9,1],[9,3],[9,2],[2,3],[2,4]],performAction:function(b,c,d,p,m,q,g){b=q.length-1;switch(m){case 1:return q[b-1];case 2:this.$=a.getVariable(q[b]);break;case 3:this.$=a.time(q[b]);break;case 4:this.$=a.time(q[b]);break;case 5:this.$=1*q[b];isNaN(this.$)&&(this.$=0);break;case 6:this.$=q[b].substring(1,q[b].length-1);break;case 7:this.$=!0;break;case 8:this.$=!1;break;case 9:this.$=null;break;case 10:this.$=a.comparator.equal.apply(a,[q[b-2],q[b]]);
break;case 11:this.$=e.math.SUM.apply(a,[q[b-2],q[b]]);break;case 12:this.$=1*q[b-1];break;case 13:this.$=q[b-1];break;case 14:this.$=a.comparator.lessEqual.apply(a,[q[b-3],q[b]]);break;case 15:this.$=a.comparator.greaterEqual.apply(a,[q[b-3],q[b]]);break;case 16:this.$=a.comparator.notEqual.apply(a,[q[b-3],q[b]]);break;case 17:this.$=q[b-2]!=q[b];break;case 18:this.$=a.comparator.greater.apply(a,[q[b-2],q[b]]);break;case 19:this.$=a.comparator.less.apply(a,[q[b-2],q[b]]);break;case 20:this.$=e.math.SUBTRACT.apply(a,
[q[b-2],q[b]]);break;case 21:this.$=e.math.MULTIPLY.apply(a,[q[b-2],q[b]]);break;case 22:this.$=e.math.DIVIDE.apply(a,[q[b-2],q[b]]);break;case 23:this.$=e.math.POWER.apply(a,[q[b-2],q[b]]);break;case 24:this.$=-1*q[b];isNaN(this.$)&&(this.$=0);break;case 25:this.$=1*q[b];isNaN(this.$)&&(this.$=0);break;case 26:this.$=Math.E;break;case 27:this.$=a.callFunction(q[b-2]);break;case 28:this.$=a.callFunction(q[b-3],q[b-1]);break;case 32:this.$=a.getCellValue(q[b]);break;case 33:this.$=a.getCellRangeValue(q[b-
2],q[b]);break;case 34:this.$=a.getCellValue(q[b]);break;case 35:this.$=a.getCellRangeValue(q[b-2],q[b]);break;case 36:this.$=a.getRemoteCellValue(q[b-2],q[b]);break;case 37:this.$=a.getRemoteCellRangeValue(q[b-4],q[b-2],q[b]);break;case 38:this.$=[q[b]];break;case 39:q[b-2].push(q[b]);this.$=q[b-2];break;case 40:q[b-2].push(q[b]);this.$=q[b-2];break;case 41:this.$=[q[b]];break;case 42:this.$=r.isArray(q[b-2])?q[b-2]:[q[b-2]];this.$.push(q[b]);break;case 43:this.$=1*q[b];break;case 44:this.$=1*(q[b-
2]+"."+q[b]);break;case 45:this.$=.01*q[b-1];break;case 46:this.$=q[b-2]+q[b-1]+q[b];break;case 47:this.$=q[b-2]+q[b-1]+q[b]}},table:[{2:18,3:1,4:2,6:3,7:[1,4],8:[1,5],9:6,10:[1,7],11:[1,8],12:[1,9],13:[1,10],15:[1,14],16:[1,11],18:[1,12],24:[1,13],28:[1,15],29:[1,16],30:17,31:[1,21],33:[1,22],34:[1,23],38:[1,19],40:[1,20],42:[1,24]},{1:[3]},{5:[1,25],14:[1,26],15:[1,27],21:[1,28],22:[1,29],23:[1,30],24:[1,31],25:[1,32],26:[1,33],27:[1,34]},{5:[2,2],14:[2,2],15:[2,2],17:[2,2],20:[2,2],21:[2,2],22:[2,
2],23:[2,2],24:[2,2],25:[2,2],26:[2,2],27:[2,2],36:[2,2],37:[2,2],39:[1,35]},{5:[2,3],14:[2,3],15:[2,3],17:[2,3],20:[2,3],21:[2,3],22:[2,3],23:[2,3],24:[2,3],25:[2,3],26:[2,3],27:[2,3],36:[2,3],37:[2,3]},{5:[2,4],14:[2,4],15:[2,4],17:[2,4],20:[2,4],21:[2,4],22:[2,4],23:[2,4],24:[2,4],25:[2,4],26:[2,4],27:[2,4],36:[2,4],37:[2,4]},{5:[2,5],14:[2,5],15:[2,5],17:[2,5],20:[2,5],21:[2,5],22:[2,5],23:[2,5],24:[2,5],25:[2,5],26:[2,5],27:[2,5],36:[2,5],37:[2,5],41:[1,36]},{5:[2,6],14:[2,6],15:[2,6],17:[2,
6],20:[2,6],21:[2,6],22:[2,6],23:[2,6],24:[2,6],25:[2,6],26:[2,6],27:[2,6],36:[2,6],37:[2,6]},{5:[2,7],14:[2,7],15:[2,7],17:[2,7],20:[2,7],21:[2,7],22:[2,7],23:[2,7],24:[2,7],25:[2,7],26:[2,7],27:[2,7],36:[2,7],37:[2,7]},{5:[2,8],14:[2,8],15:[2,8],17:[2,8],20:[2,8],21:[2,8],22:[2,8],23:[2,8],24:[2,8],25:[2,8],26:[2,8],27:[2,8],36:[2,8],37:[2,8]},{5:[2,9],14:[2,9],15:[2,9],17:[2,9],20:[2,9],21:[2,9],22:[2,9],23:[2,9],24:[2,9],25:[2,9],26:[2,9],27:[2,9],36:[2,9],37:[2,9]},{2:18,4:37,6:3,7:[1,4],8:[1,
5],9:6,10:[1,7],11:[1,8],12:[1,9],13:[1,10],15:[1,14],16:[1,11],18:[1,12],24:[1,13],28:[1,15],29:[1,16],30:17,31:[1,21],33:[1,22],34:[1,23],38:[1,19],40:[1,20],42:[1,24]},{2:18,4:39,6:3,7:[1,4],8:[1,5],9:6,10:[1,7],11:[1,8],12:[1,9],13:[1,10],15:[1,14],16:[1,11],18:[1,12],19:38,24:[1,13],28:[1,15],29:[1,16],30:17,31:[1,21],33:[1,22],34:[1,23],38:[1,19],40:[1,20],42:[1,24]},{2:18,4:40,6:3,7:[1,4],8:[1,5],9:6,10:[1,7],11:[1,8],12:[1,9],13:[1,10],15:[1,14],16:[1,11],18:[1,12],24:[1,13],28:[1,15],29:[1,
16],30:17,31:[1,21],33:[1,22],34:[1,23],38:[1,19],40:[1,20],42:[1,24]},{2:18,4:41,6:3,7:[1,4],8:[1,5],9:6,10:[1,7],11:[1,8],12:[1,9],13:[1,10],15:[1,14],16:[1,11],18:[1,12],24:[1,13],28:[1,15],29:[1,16],30:17,31:[1,21],33:[1,22],34:[1,23],38:[1,19],40:[1,20],42:[1,24]},{5:[2,26],14:[2,26],15:[2,26],17:[2,26],20:[2,26],21:[2,26],22:[2,26],23:[2,26],24:[2,26],25:[2,26],26:[2,26],27:[2,26],36:[2,26],37:[2,26]},{16:[1,42]},{5:[2,29],14:[2,29],15:[2,29],17:[2,29],20:[2,29],21:[2,29],22:[2,29],23:[2,29],
24:[2,29],25:[2,29],26:[2,29],27:[2,29],36:[2,29],37:[2,29]},{2:43,5:[2,30],14:[2,30],15:[2,30],17:[2,30],20:[2,30],21:[2,30],22:[2,30],23:[2,30],24:[2,30],25:[2,30],26:[2,30],27:[2,30],36:[2,30],37:[2,30],38:[1,44],42:[1,24]},{5:[2,41],14:[2,41],15:[2,41],17:[2,41],20:[2,41],21:[2,41],22:[2,41],23:[2,41],24:[2,41],25:[2,41],26:[2,41],27:[2,41],36:[2,41],37:[2,41],39:[2,41],42:[1,45]},{5:[2,43],14:[2,43],15:[2,43],17:[2,43],20:[2,43],21:[2,43],22:[2,43],23:[2,43],24:[2,43],25:[2,43],26:[2,43],27:[2,
43],36:[2,43],37:[2,43],39:[1,46],41:[2,43]},{5:[2,32],14:[2,32],15:[2,32],17:[2,32],20:[2,32],21:[2,32],22:[2,32],23:[2,32],24:[2,32],25:[2,32],26:[2,32],27:[2,32],32:[1,47],36:[2,32],37:[2,32]},{5:[2,34],14:[2,34],15:[2,34],17:[2,34],20:[2,34],21:[2,34],22:[2,34],23:[2,34],24:[2,34],25:[2,34],26:[2,34],27:[2,34],32:[1,48],36:[2,34],37:[2,34]},{35:[1,49]},{38:[1,50]},{1:[2,1]},{2:18,4:51,6:3,7:[1,4],8:[1,5],9:6,10:[1,7],11:[1,8],12:[1,9],13:[1,10],15:[1,14],16:[1,11],18:[1,12],24:[1,13],28:[1,15],
29:[1,16],30:17,31:[1,21],33:[1,22],34:[1,23],38:[1,19],40:[1,20],42:[1,24]},{2:18,4:52,6:3,7:[1,4],8:[1,5],9:6,10:[1,7],11:[1,8],12:[1,9],13:[1,10],15:[1,14],16:[1,11],18:[1,12],24:[1,13],28:[1,15],29:[1,16],30:17,31:[1,21],33:[1,22],34:[1,23],38:[1,19],40:[1,20],42:[1,24]},{2:18,4:55,6:3,7:[1,4],8:[1,5],9:6,10:[1,7],11:[1,8],12:[1,9],13:[1,10],14:[1,53],15:[1,14],16:[1,11],18:[1,12],22:[1,54],24:[1,13],28:[1,15],29:[1,16],30:17,31:[1,21],33:[1,22],34:[1,23],38:[1,19],40:[1,20],42:[1,24]},{2:18,
4:57,6:3,7:[1,4],8:[1,5],9:6,10:[1,7],11:[1,8],12:[1,9],13:[1,10],14:[1,56],15:[1,14],16:[1,11],18:[1,12],24:[1,13],28:[1,15],29:[1,16],30:17,31:[1,21],33:[1,22],34:[1,23],38:[1,19],40:[1,20],42:[1,24]},{2:18,4:58,6:3,7:[1,4],8:[1,5],9:6,10:[1,7],11:[1,8],12:[1,9],13:[1,10],15:[1,14],16:[1,11],18:[1,12],24:[1,13],28:[1,15],29:[1,16],30:17,31:[1,21],33:[1,22],34:[1,23],38:[1,19],40:[1,20],42:[1,24]},{2:18,4:59,6:3,7:[1,4],8:[1,5],9:6,10:[1,7],11:[1,8],12:[1,9],13:[1,10],15:[1,14],16:[1,11],18:[1,12],
24:[1,13],28:[1,15],29:[1,16],30:17,31:[1,21],33:[1,22],34:[1,23],38:[1,19],40:[1,20],42:[1,24]},{2:18,4:60,6:3,7:[1,4],8:[1,5],9:6,10:[1,7],11:[1,8],12:[1,9],13:[1,10],15:[1,14],16:[1,11],18:[1,12],24:[1,13],28:[1,15],29:[1,16],30:17,31:[1,21],33:[1,22],34:[1,23],38:[1,19],40:[1,20],42:[1,24]},{2:18,4:61,6:3,7:[1,4],8:[1,5],9:6,10:[1,7],11:[1,8],12:[1,9],13:[1,10],15:[1,14],16:[1,11],18:[1,12],24:[1,13],28:[1,15],29:[1,16],30:17,31:[1,21],33:[1,22],34:[1,23],38:[1,19],40:[1,20],42:[1,24]},{2:18,
4:62,6:3,7:[1,4],8:[1,5],9:6,10:[1,7],11:[1,8],12:[1,9],13:[1,10],15:[1,14],16:[1,11],18:[1,12],24:[1,13],28:[1,15],29:[1,16],30:17,31:[1,21],33:[1,22],34:[1,23],38:[1,19],40:[1,20],42:[1,24]},{38:[1,63]},{5:[2,45],14:[2,45],15:[2,45],17:[2,45],20:[2,45],21:[2,45],22:[2,45],23:[2,45],24:[2,45],25:[2,45],26:[2,45],27:[2,45],36:[2,45],37:[2,45],41:[2,45]},{14:[1,26],15:[1,27],17:[1,64],21:[1,28],22:[1,29],23:[1,30],24:[1,31],25:[1,32],26:[1,33],27:[1,34]},{20:[1,65],36:[1,66],37:[1,67]},{14:[1,26],
15:[1,27],17:[2,38],20:[2,38],21:[1,28],22:[1,29],23:[1,30],24:[1,31],25:[1,32],26:[1,33],27:[1,34],36:[2,38],37:[2,38]},{5:[2,24],14:[2,24],15:[2,24],17:[2,24],20:[2,24],21:[2,24],22:[2,24],23:[2,24],24:[2,24],25:[1,32],26:[1,33],27:[1,34],36:[2,24],37:[2,24]},{5:[2,25],14:[2,25],15:[2,25],17:[2,25],20:[2,25],21:[2,25],22:[2,25],23:[2,25],24:[2,25],25:[1,32],26:[1,33],27:[1,34],36:[2,25],37:[2,25]},{2:18,4:39,6:3,7:[1,4],8:[1,5],9:6,10:[1,7],11:[1,8],12:[1,9],13:[1,10],15:[1,14],16:[1,11],17:[1,
68],18:[1,12],19:69,24:[1,13],28:[1,15],29:[1,16],30:17,31:[1,21],33:[1,22],34:[1,23],38:[1,19],40:[1,20],42:[1,24]},{5:[2,31],14:[2,31],15:[2,31],17:[2,31],20:[2,31],21:[2,31],22:[2,31],23:[2,31],24:[2,31],25:[2,31],26:[2,31],27:[2,31],36:[2,31],37:[2,31]},{42:[1,45]},{38:[1,70]},{40:[1,71]},{31:[1,72]},{33:[1,73]},{33:[1,74]},{35:[1,75]},{5:[2,10],14:[2,10],15:[1,27],17:[2,10],20:[2,10],21:[1,28],22:[1,29],23:[1,30],24:[1,31],25:[1,32],26:[1,33],27:[1,34],36:[2,10],37:[2,10]},{5:[2,11],14:[2,11],
15:[2,11],17:[2,11],20:[2,11],21:[2,11],22:[2,11],23:[2,11],24:[2,11],25:[1,32],26:[1,33],27:[1,34],36:[2,11],37:[2,11]},{2:18,4:76,6:3,7:[1,4],8:[1,5],9:6,10:[1,7],11:[1,8],12:[1,9],13:[1,10],15:[1,14],16:[1,11],18:[1,12],24:[1,13],28:[1,15],29:[1,16],30:17,31:[1,21],33:[1,22],34:[1,23],38:[1,19],40:[1,20],42:[1,24]},{2:18,4:77,6:3,7:[1,4],8:[1,5],9:6,10:[1,7],11:[1,8],12:[1,9],13:[1,10],15:[1,14],16:[1,11],18:[1,12],24:[1,13],28:[1,15],29:[1,16],30:17,31:[1,21],33:[1,22],34:[1,23],38:[1,19],40:[1,
20],42:[1,24]},{5:[2,19],14:[2,19],15:[1,27],17:[2,19],20:[2,19],21:[2,19],22:[2,19],23:[2,19],24:[1,31],25:[1,32],26:[1,33],27:[1,34],36:[2,19],37:[2,19]},{2:18,4:78,6:3,7:[1,4],8:[1,5],9:6,10:[1,7],11:[1,8],12:[1,9],13:[1,10],15:[1,14],16:[1,11],18:[1,12],24:[1,13],28:[1,15],29:[1,16],30:17,31:[1,21],33:[1,22],34:[1,23],38:[1,19],40:[1,20],42:[1,24]},{5:[2,18],14:[2,18],15:[1,27],17:[2,18],20:[2,18],21:[2,18],22:[2,18],23:[2,18],24:[1,31],25:[1,32],26:[1,33],27:[1,34],36:[2,18],37:[2,18]},{5:[2,
17],14:[2,17],15:[1,27],17:[2,17],20:[2,17],21:[1,28],22:[1,29],23:[2,17],24:[1,31],25:[1,32],26:[1,33],27:[1,34],36:[2,17],37:[2,17]},{5:[2,20],14:[2,20],15:[2,20],17:[2,20],20:[2,20],21:[2,20],22:[2,20],23:[2,20],24:[2,20],25:[1,32],26:[1,33],27:[1,34],36:[2,20],37:[2,20]},{5:[2,21],14:[2,21],15:[2,21],17:[2,21],20:[2,21],21:[2,21],22:[2,21],23:[2,21],24:[2,21],25:[2,21],26:[2,21],27:[1,34],36:[2,21],37:[2,21]},{5:[2,22],14:[2,22],15:[2,22],17:[2,22],20:[2,22],21:[2,22],22:[2,22],23:[2,22],24:[2,
22],25:[2,22],26:[2,22],27:[1,34],36:[2,22],37:[2,22]},{5:[2,23],14:[2,23],15:[2,23],17:[2,23],20:[2,23],21:[2,23],22:[2,23],23:[2,23],24:[2,23],25:[2,23],26:[2,23],27:[2,23],36:[2,23],37:[2,23]},{5:[2,42],14:[2,42],15:[2,42],17:[2,42],20:[2,42],21:[2,42],22:[2,42],23:[2,42],24:[2,42],25:[2,42],26:[2,42],27:[2,42],36:[2,42],37:[2,42],39:[2,42]},{5:[2,12],14:[2,12],15:[2,12],17:[2,12],20:[2,12],21:[2,12],22:[2,12],23:[2,12],24:[2,12],25:[2,12],26:[2,12],27:[2,12],36:[2,12],37:[2,12]},{5:[2,13],14:[2,
13],15:[2,13],17:[2,13],20:[2,13],21:[2,13],22:[2,13],23:[2,13],24:[2,13],25:[2,13],26:[2,13],27:[2,13],36:[2,13],37:[2,13]},{2:18,4:79,6:3,7:[1,4],8:[1,5],9:6,10:[1,7],11:[1,8],12:[1,9],13:[1,10],15:[1,14],16:[1,11],18:[1,12],24:[1,13],28:[1,15],29:[1,16],30:17,31:[1,21],33:[1,22],34:[1,23],38:[1,19],40:[1,20],42:[1,24]},{2:18,4:80,6:3,7:[1,4],8:[1,5],9:6,10:[1,7],11:[1,8],12:[1,9],13:[1,10],15:[1,14],16:[1,11],18:[1,12],24:[1,13],28:[1,15],29:[1,16],30:17,31:[1,21],33:[1,22],34:[1,23],38:[1,19],
40:[1,20],42:[1,24]},{5:[2,27],14:[2,27],15:[2,27],17:[2,27],20:[2,27],21:[2,27],22:[2,27],23:[2,27],24:[2,27],25:[2,27],26:[2,27],27:[2,27],36:[2,27],37:[2,27]},{17:[1,81],36:[1,66],37:[1,67]},{35:[1,82]},{5:[2,44],14:[2,44],15:[2,44],17:[2,44],20:[2,44],21:[2,44],22:[2,44],23:[2,44],24:[2,44],25:[2,44],26:[2,44],27:[2,44],36:[2,44],37:[2,44],41:[2,44]},{5:[2,33],14:[2,33],15:[2,33],17:[2,33],20:[2,33],21:[2,33],22:[2,33],23:[2,33],24:[2,33],25:[2,33],26:[2,33],27:[2,33],36:[2,33],37:[2,33]},{5:[2,
35],14:[2,35],15:[2,35],17:[2,35],20:[2,35],21:[2,35],22:[2,35],23:[2,35],24:[2,35],25:[2,35],26:[2,35],27:[2,35],36:[2,35],37:[2,35]},{5:[2,36],14:[2,36],15:[2,36],17:[2,36],20:[2,36],21:[2,36],22:[2,36],23:[2,36],24:[2,36],25:[2,36],26:[2,36],27:[2,36],32:[1,83],36:[2,36],37:[2,36]},{5:[2,46],14:[2,46],15:[2,46],17:[2,46],20:[2,46],21:[2,46],22:[2,46],23:[2,46],24:[2,46],25:[2,46],26:[2,46],27:[2,46],36:[2,46],37:[2,46],38:[2,46],42:[2,46]},{5:[2,14],14:[2,14],15:[1,27],17:[2,14],20:[2,14],21:[2,
14],22:[2,14],23:[2,14],24:[1,31],25:[1,32],26:[1,33],27:[1,34],36:[2,14],37:[2,14]},{5:[2,16],14:[2,16],15:[1,27],17:[2,16],20:[2,16],21:[2,16],22:[2,16],23:[2,16],24:[1,31],25:[1,32],26:[1,33],27:[1,34],36:[2,16],37:[2,16]},{5:[2,15],14:[2,15],15:[1,27],17:[2,15],20:[2,15],21:[2,15],22:[2,15],23:[2,15],24:[1,31],25:[1,32],26:[1,33],27:[1,34],36:[2,15],37:[2,15]},{14:[1,26],15:[1,27],17:[2,39],20:[2,39],21:[1,28],22:[1,29],23:[1,30],24:[1,31],25:[1,32],26:[1,33],27:[1,34],36:[2,39],37:[2,39]},{14:[1,
26],15:[1,27],17:[2,40],20:[2,40],21:[1,28],22:[1,29],23:[1,30],24:[1,31],25:[1,32],26:[1,33],27:[1,34],36:[2,40],37:[2,40]},{5:[2,28],14:[2,28],15:[2,28],17:[2,28],20:[2,28],21:[2,28],22:[2,28],23:[2,28],24:[2,28],25:[2,28],26:[2,28],27:[2,28],36:[2,28],37:[2,28]},{5:[2,47],14:[2,47],15:[2,47],17:[2,47],20:[2,47],21:[2,47],22:[2,47],23:[2,47],24:[2,47],25:[2,47],26:[2,47],27:[2,47],36:[2,47],37:[2,47],38:[2,47],42:[2,47]},{33:[1,84]},{5:[2,37],14:[2,37],15:[2,37],17:[2,37],20:[2,37],21:[2,37],22:[2,
37],23:[2,37],24:[2,37],25:[2,37],26:[2,37],27:[2,37],36:[2,37],37:[2,37]}],defaultActions:{25:[2,1]},parseError:function(a,b){if(b.recoverable)this.trace(a);else throw Error(a);},parse:function(a){function b(a){e.length-=2*a;q.length-=a;g.length-=a}function c(){var a;a=d.lexer.lex()||1;"number"!==typeof a&&(a=d.symbols_[a]||a);return a}var d=this,e=[0],q=[null],g=[],h=this.table,l="",r=0,n=0,t=0,v=g.slice.call(arguments,1);this.lexer.setInput(a);this.lexer.yy=this.yy;this.yy.lexer=this.lexer;this.yy.parser=
this;"undefined"==typeof this.lexer.yylloc&&(this.lexer.yylloc={});var u=this.lexer.yylloc;g.push(u);var x=this.lexer.options&&this.lexer.options.ranges;this.parseError="function"===typeof this.yy.parseError?this.yy.parseError:Object.getPrototypeOf(this).parseError;for(var w,B,z,y,C={},E,A;;){z=e[e.length-1];if(this.defaultActions[z])y=this.defaultActions[z];else{if(null===w||"undefined"==typeof w)w=c();y=h[z]&&h[z][w]}if("undefined"===typeof y||!y.length||!y[0]){A=function(a){for(var b=e.length-
1,c=0;;){if((2).toString()in h[a])return c;if(0===a||2>b)return!1;b-=2;a=e[b];++c}};var D;y="";if(t)1!==B&&(D=A(z));else{D=A(z);A=[];for(E in h[z])this.terminals_[E]&&2<E&&A.push("'"+this.terminals_[E]+"'");y=this.lexer.showPosition?"Parse error on line "+(r+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+A.join(", ")+", got '"+(this.terminals_[w]||w)+"'":"Parse error on line "+(r+1)+": Unexpected "+(1==w?"end of input":"'"+(this.terminals_[w]||w)+"'");this.parseError(y,{text:this.lexer.match,token:this.terminals_[w]||
w,line:this.lexer.yylineno,loc:u,expected:A,recoverable:!1!==D})}if(3==t){if(1===w||1===B)throw Error(y||"Parsing halted while starting to recover from another error.");n=this.lexer.yyleng;l=this.lexer.yytext;r=this.lexer.yylineno;u=this.lexer.yylloc;w=c()}if(!1===D)throw Error(y||"Parsing halted. No suitable error recovery rule available.");b(D);B=2==w?null:w;w=2;z=e[e.length-1];y=h[z]&&h[z][2];t=3}if(y[0]instanceof Array&&1<y.length)throw Error("Parse Error: multiple actions possible at state: "+
z+", token: "+w);switch(y[0]){case 1:e.push(w);q.push(this.lexer.yytext);g.push(this.lexer.yylloc);e.push(y[1]);w=null;B?(w=B,B=null):(n=this.lexer.yyleng,l=this.lexer.yytext,r=this.lexer.yylineno,u=this.lexer.yylloc,0<t&&t--);break;case 2:A=this.productions_[y[1]][1];C.$=q[q.length-A];C._$={first_line:g[g.length-(A||1)].first_line,last_line:g[g.length-1].last_line,first_column:g[g.length-(A||1)].first_column,last_column:g[g.length-1].last_column};x&&(C._$.range=[g[g.length-(A||1)].range[0],g[g.length-
1].range[1]]);z=this.performAction.apply(C,[l,n,r,this.yy,y[1],q,g].concat(v));if("undefined"!==typeof z)return z;A&&(e=e.slice(0,-2*A),q=q.slice(0,-1*A),g=g.slice(0,-1*A));e.push(this.productions_[y[1]][0]);q.push(C.$);g.push(C._$);z=h[e[e.length-2]][e[e.length-1]];e.push(z);break;case 3:return!0}}}},d=function(){return{EOF:1,parseError:function(a,b){if(this.yy.parser)this.yy.parser.parseError(a,b);else throw Error(a);},setInput:function(a){this._input=a;this._more=this._backtrack=this.done=!1;this.yylineno=
this.yyleng=0;this.yytext=this.matched=this.match="";this.conditionStack=["INITIAL"];this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0};this.options.ranges&&(this.yylloc.range=[0,0]);this.offset=0;return this},input:function(){var a=this._input[0];this.yytext+=a;this.yyleng++;this.offset++;this.match+=a;this.matched+=a;a.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++;this.options.ranges&&this.yylloc.range[1]++;this._input=this._input.slice(1);
return a},unput:function(a){var b=a.length,c=a.split(/(?:\r\n?|\n)/g);this._input=a+this._input;this.yytext=this.yytext.substr(0,this.yytext.length-b-1);this.offset-=b;a=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1);this.matched=this.matched.substr(0,this.matched.length-1);c.length-1&&(this.yylineno-=c.length-1);var d=this.yylloc.range;this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:c?
(c.length===a.length?this.yylloc.first_column:0)+a[a.length-c.length].length-c[0].length:this.yylloc.first_column-b};this.options.ranges&&(this.yylloc.range=[d[0],d[0]+this.yyleng-b]);this.yyleng=this.yytext.length;return this},more:function(){this._more=!0;return this},reject:function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+
this.showPosition(),{text:"",token:null,line:this.yylineno});return this},less:function(a){this.unput(this.match.slice(a))},pastInput:function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(20<a.length?"...":"")+a.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var a=this.match;20>a.length&&(a+=this._input.substr(0,20-a.length));return(a.substr(0,20)+(20<a.length?"...":"")).replace(/\n/g,"")},showPosition:function(){var a=this.pastInput(),b=Array(a.length+1).join("-");
return a+this.upcomingInput()+"\n"+b+"^"},test_match:function(a,b){var c,d;this.options.backtrack_lexer&&(d={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&
(d.yylloc.range=this.yylloc.range.slice(0)));if(c=a[0].match(/(?:\r\n?|\n).*/g))this.yylineno+=c.length;this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:c?c[c.length-1].length-c[c.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+a[0].length};this.yytext+=a[0];this.match+=a[0];this.matches=a;this.yyleng=this.yytext.length;this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]);this._backtrack=
this._more=!1;this._input=this._input.slice(a[0].length);this.matched+=a[0];c=this.performAction.call(this,this.yy,this,b,this.conditionStack[this.conditionStack.length-1]);this.done&&this._input&&(this.done=!1);if(c)return c;if(this._backtrack)for(var e in d)this[e]=d[e];return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var a,b,c;this._more||(this.match=this.yytext="");for(var d=this._currentRules(),e=0;e<d.length;e++)if((b=this._input.match(this.rules[d[e]]))&&(!a||
b[0].length>a[0].length))if(a=b,c=e,this.options.backtrack_lexer){a=this.test_match(b,d[e]);if(!1!==a)return a;if(this._backtrack)a=!1;else return!1}else if(!this.options.flex)break;return a?(a=this.test_match(a,d[c]),!1!==a?a:!1):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var a=this.next();return a?a:this.lex()},begin:function(a){this.conditionStack.push(a)},
popState:function(){return 0<this.conditionStack.length-1?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(a){a=this.conditionStack.length-1-Math.abs(a||0);return 0<=a?this.conditionStack[a]:"INITIAL"},pushState:function(a){this.begin(a)},stateStackSize:function(){return this.conditionStack.length},
options:{},performAction:function(b,c,d,e){switch(d){case 1:return 10;case 2:return 10;case 3:return 34;case 4:return 29;case 5:return 7;case 6:return 8;case 7:return"cell"==a.obj.type?34:38;case 8:return"cell"==a.obj.type?31:38;case 9:return"cell"==a.obj.type?33:38;case 10:return 29;case 11:return 38;case 12:return 38;case 13:return 40;case 15:return" ";case 16:return 39;case 17:return 32;case 18:return 36;case 19:return 37;case 20:return 25;case 21:return 26;case 22:return 24;case 23:return 15;
case 24:return 27;case 25:return 16;case 26:return 17;case 27:return 18;case 28:return 20;case 29:return 22;case 30:return 21;case 31:return 23;case 32:return"PI";case 33:return 28;case 34:return 11;case 35:return 12;case 36:return 13;case 37:return'"';case 38:return"'";case 39:return"!";case 40:return 14;case 41:return 41;case 42:return 42;case 43:return 5}},rules:[/^(?:\s+)/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:#[A-Za-z0-9_]+)/,/^(?:[A-Za-z]{1,}[A-Za-z_0-9]+(?=[(]))/,/^(?:([0]?[1-9]|1[0-2])[:][0-5][0-9]([:][0-5][0-9])?[ ]?(AM|am|aM|Am|PM|pm|pM|Pm))/,
/^(?:([0]?[0-9]|1[0-9]|2[0-3])[:][0-5][0-9]([:][0-5][0-9])?)/,/^(?:[A-Za-z0-9_]+>[A-Za-z0-9_]+)/,/^(?:\$[A-Za-z]+\$[0-9]+)/,/^(?:[A-Za-z]+[0-9]+)/,/^(?:[A-Za-z]+(?=[(]))/,/^(?:[A-Za-z]{1,}[A-Za-z_0-9]+)/,/^(?:[A-Za-z_]+)/,/^(?:[0-9]+)/,/^(?:\$)/,/^(?: )/,/^(?:[.])/,/^(?::)/,/^(?:;)/,/^(?:,)/,/^(?:\*)/,/^(?:\/)/,/^(?:-)/,/^(?:\+)/,/^(?:\^)/,/^(?:\()/,/^(?:\))/,/^(?:\[)/,/^(?:\])/,/^(?:>)/,/^(?:<)/,/^(?:NOT\b)/,/^(?:PI\b)/,/^(?:E\b)/,/^(?:TRUE\b)/,/^(?:FALSE\b)/,/^(?:NULL\b)/,/^(?:")/,/^(?:')/,/^(?:!)/,
/^(?:=)/,/^(?:%)/,/^(?:[#])/,/^(?:$)/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43],inclusive:!0}}}}();c.lexer=d;b.prototype=c;c.Parser=b;return new b}function u(a,b){this.sheet=a;this.options=r.extend({},{element:void 0,address:"",formatter:void 0,unformatter:void 0,styleFormatter:void 0,format:!1,formula:!1,value:null},b);this.value=null;this.formula=this.format=!1;this.unformatter=this.formatter=
void 0;this.floatValue=this.computedValue=this.formattedValue=null;this.processed=this.affected=!1;this.dependencies={};this.dependant={};this.styleFormatter=this.conditionalStyle=!1;this.address="";this.hasDynamicDependency=this.isCheckbox=this.remoteDependency=!1;this.init()}function v(a,b,c){this.identifier=a;this.el=r(b);this.elementId=this.el.attr("id");this.lang="en";this.cells={};this.variables={};this.config=c;this.counter=1;this.relatedSheet=!1;this.dependant={};this.dependencies={};this.calculating=
this.calculated=!1;this.activeCell=null;this.totalCell=0;this.affectedCell=[];this.init()}if("undefined"==typeof r)return!1;"function"!==typeof Array.indexOf&&(Array.prototype.indexOf=function(a,b){for(var c=b||0;c<this.length;c++)if(this[c]==a)return c;return-1});"function"!==typeof Object.getPrototypeOf&&(Object.getPrototypeOf="object"===typeof"test".__proto__?function(a){return a.__proto__}:function(a){return a.constructor.prototype});var G={autoCalculate:!0,autoCalculateTrigger:"blur",onBeforeCalculate:null,
onAfterCalculate:null,onBeforeRender:null,onAfterRender:null,defaultFormat:!1,ajaxUrl:null,ajaxMethod:"get",graphHandler:"flot",checkCircularReference:!1,data:{}},e={custom:{},date:{DATE:function(a,b,c){return"undefined"==typeof h?l.ERRKEY.momentRequired:"undefined"==typeof b?h(a):new Date(a,b-1,c)},DATEDIFF:function(a,b,c){return"undefined"==typeof h?l.ERRKEY.momentRequired:h(b).diff(h.utc(a),c)},DATEFORMAT:function(a,b){return"undefined"==typeof h?l.ERRKEY.momentRequired:h(a).format(b)},DATEVALUE:function(a){return"undefined"==
typeof h?l.ERRKEY.momentRequired:Math.ceil((h(a)-h("1900-1-1"))/864E5)+2},DAY:function(a){return"undefined"==typeof h?l.ERRKEY.momentRequired:h(new Date(a)).date()},DAYNAME:function(a){return l.DAY_NAME[e.date.WEEKDAY(a)-1]},DAYS:function(a,b){return"undefined"==typeof h?l.ERRKEY.momentRequired:h(new Date(a)).diff(h(new Date(b)),"days")},DAYS360:function(a,b,c){if("undefined"==typeof h)return l.ERRKEY.momentRequired;a=h(new Date(a));b=h(new Date(b));var d=31,f=31,k=a.date(),s=b.date();if(c)k=31===
k?30:k,s=31===s?30:s;else if(1===a.month()&&(d=a.daysInMonth()),1===b.month()&&(f=b.daysInMonth()),k=k===d?30:k,30===k||k===d)s=s===f?30:s;return 360*(b.year()-a.year())+30*(b.month()-a.month())+(s-k)},EDATE:function(a,b){return"undefined"==typeof h?l.ERRKEY.momentRequired:h(new Date(a)).add("months",b).toDate()},EOMONTH:function(a,b){if("undefined"==typeof h)return l.ERRKEY.momentRequired;var c=h(new Date(a)).add("months",b);return new Date(c.year(),c.month(),c.daysInMonth())},FROMNOW:function(a,
b){return"undefined"==typeof h?l.ERRKEY.momentRequired:h(new Date(a)).fromNow(b)},HOUR:function(a){return"undefined"==typeof h?l.ERRKEY.momentRequired:1>=a?Math.floor(24*a):h(new Date(a)).hours()},MINUTE:function(a){return"undefined"==typeof h?l.ERRKEY.momentRequired:1>=a?Math.floor(1440*a)-60*Math.floor(24*a):h(new Date(a)).minutes()},ISOWEEKNUM:function(a){return"undefined"==typeof h?l.ERRKEY.momentRequired:h(new Date(a)).format("w")},MONTH:function(a){return"undefined"==typeof h?l.ERRKEY.momentRequired:
h(new Date(a)).month()+1},NETWORKDAYS:function(a,b,c){return e.date.NETWORKDAYSINTL(a,b,1,c)},NETWORKDAYSINTL:function(a,b,c,d){if("undefined"==typeof h)return l.ERRKEY.momentRequired;c=l.WEEKEND_TYPES["undefined"===typeof c?1:c];var f=h(a);a=b=h(b).diff(f,"days")+1;var k="",s=[];if("undefined"!==typeof d)for(k=0;k<d.length;k++)s[k]=h(new Date(d[k])).format("MM-DD-YYYY");for(d=0;d<b;)k=f.format("d"),0<=c.indexOf(parseInt(k,10))?a--:0<=s.indexOf(f.format("MM-DD-YYYY"))&&a--,f=f.add("days",1),d++;return a},
NOW:function(){return new Date},SECOND:function(a){return"undefined"==typeof h?l.ERRKEY.momentRequired:h(new Date(a)).seconds()},TIME:function(a,b,c){return(3600*a+60*b+c)/86400},TIMEVALUE:function(a){if("undefined"==typeof h)return l.ERRKEY.momentRequired;a=h(new Date(a));return(3600*a.hours()+60*a.minutes()+a.seconds())/86400},TODAY:function(){return new Date},WEEKDAY:function(a,b){if("undefined"==typeof h)return l.ERRKEY.momentRequired;var c=h(new Date(a)).format("d");return l.WEEK_TYPES["undefined"===
typeof b?1:b][c]},WEEKNUM:function(a,b){if("undefined"==typeof h)return l.ERRKEY.momentRequired;var c=h(new Date(a)),d=h(new Date(c.year(),0,1)),f="undefined"===typeof b?1:b,k=l.WEEK_STARTS[f],s=d.format("d"),k=s<k?k-s+1:s-k;return 21===f?e.date.ISOWEEKNUM(a):Math.floor(c.diff(d.subtract("days",k),"days")/7)+1},WORKDAY:function(a,b,c){return e.date.WORKDAYINTL(a,b,1,c)},WORKDAYINTL:function(a,b,c,d){if("undefined"==typeof h)return l.ERRKEY.momentRequired;c=l.WEEKEND_TYPES["undefined"===typeof c?1:
c];a=h(new Date(a));var f="",k=[];if("undefined"!==typeof d)for(f=0;f<d.length;f++)k[f]=h(new Date(d[f])).format("MM-DD-YYYY");for(d=0;d<b;)a=a.add("days",1),f=a.format("d"),0>c.indexOf(parseInt(f,10))&&0>k.indexOf(a.format("MM-DD-YYYY"))&&d++;return a.toDate()},YEAR:function(a){return"undefined"==typeof h?l.ERRKEY.momentRequired:h(new Date(a)).year()},YEARFRAC:function(a,b,c){if("undefined"==typeof h)return l.ERRKEY.momentRequired;c="undefined"===typeof c?0:c;var d=h(new Date(a)),f=h(new Date(b));
if(!d.isValid()||!f.isValid())return"#VALUE!";if(-1===[0,1,2,3,4].indexOf(c))return"#NUM!";if(d===f)return 0;0<d.diff(f)&&(f=h(new Date(a)),d=h(new Date(b)));var k=d.year(),s=d.month(),e=d.date(),m=f.year();a=f.month();b=f.date();switch(c){case 0:return 31===e&&31===b?b=e=30:31===e?e=30:30===e&&31===b?b=30:1===s&&1===a&&d.daysInMonth()===e&&f.daysInMonth()===b?b=e=30:1===s&&d.daysInMonth()===e&&(e=30),(b+30*a+360*m-(e+30*s+360*k))/360;case 1:c=365;if(k===m||k+1===m&&(s>a||s===a&&e>=b)){if(k===m&&
h([k]).isLeapYear())c=366;else if(k=d,m=f,s=h(new Date(k.year(),2,1)),h([k.year()]).isLeapYear()&&0>k.diff(s)&&0<=m.diff(s)?k=!0:(s=h(new Date(m.year(),2,1)),k=h([m.year()]).isLeapYear()&&0<=m.diff(s)&&0>k.diff(s)?!0:!1),k||1===a&&29===b)c=366;return f.diff(d,"days")/c}a=m-k+1;a=h(new Date(m+1,0,1)).diff(h(new Date(k,0,1)),"days")/a;return f.diff(d,"days")/a;case 2:return f.diff(d,"days")/360;case 3:return f.diff(d,"days")/365;case 4:return 31===e&&(e=30),31===b&&(b=30),(b+30*a+360*m-(e+30*s+360*
k))/360}}},math:{ABS:function(a){return Math.abs(a)},ACOS:function(a){return Math.acos(a)},ACOSH:function(a){return Math.log(a+Math.sqrt(a*a-1))},ACOT:function(a){return Math.atan(1/a)},ACOTH:function(a){return.5*Math.log((a+1)/(a-1))},AGGREGATE:function(a,b){for(var c=[],d=2;d<arguments.length;d++)switch(a){case 1:c[d-2]=e.statistic.AVERAGE(arguments[d]);break;case 2:c[d-2]=e.statistic.COUNT(arguments[d]);break;case 3:c[d-2]=e.statistic.COUNTA(arguments[d]);break;case 4:c[d-2]=e.statistic.MAX(arguments[d]);
break;case 5:c[d-2]=e.statistic.MIN(arguments[d]);break;case 6:c[d-2]=e.statistic.PRODUCT(arguments[d]);break;case 7:c[d-2]=e.statistic.STDEVS(arguments[d]);break;case 8:c[d-2]=e.statistic.STDEVP(arguments[d]);break;case 9:c[d-2]=e.math.SUM(arguments[d]);break;case 10:c[d-2]=e.statistic.VARS(arguments[d]);break;case 11:c[d-2]=e.statistic.VARP(arguments[d]);break;case 12:c[d-2]=e.statistic.MEDIAN(arguments[d]);break;case 13:c[d-2]=e.statistic.MODESNGL(arguments[d]);break;case 14:c[d-2]=e.statistic.LARGE(arguments[d]);
break;case 15:c[d-2]=e.statistic.SMALL(arguments[d]);break;case 16:c[d-2]=e.statistic.PERCENTILEINC(arguments[d]);break;case 17:c[d-2]=e.statistic.QUARTILEINC(arguments[d]);break;case 18:c[d-2]=e.statistic.PERCENTILEEXC(arguments[d]);break;case 19:c[d-2]=e.statistic.QUARTILEEXC(arguments[d])}return c},ARABIC:function(a){if(!/^M*(?:D?C{0,3}|C[MD])(?:L?X{0,3}|X[CL])(?:V?I{0,3}|I[XV])$/.test(a))return"#VALUE!";var b=0;a.replace(/[MDLV]|C[MD]?|X[CL]?|I[XV]?/g,function(a){b+={M:1E3,CM:900,D:500,CD:400,
C:100,XC:90,L:50,XL:40,X:10,IX:9,V:5,IV:4,I:1}[a]});return b},ASIN:function(a){return Math.asin(a)},ASINH:function(a){return Math.log(a+Math.sqrt(a*a+1))},ATAN:function(a){return Math.atan(a)},ATAN2:function(a,b){return Math.atan2(a,b)},ATANH:function(a){return Math.log((1+a)/(1-a))/2},BASE:function(a,b,c){c="undefined"===typeof c?0:c;a=a.toString(b);return Array(Math.max(c+1-a.length,0)).join("0")+a},CEILING:function(a,b,c){if(0===b)return 0;b="undefined"===typeof b?1:Math.abs(b);c="undefined"===
typeof c?0:c;var d=-Math.floor(Math.log(b)/Math.log(10));return 0<=a?e.math.ROUND(Math.ceil(a/b)*b,d):0===c?-e.math.ROUND(Math.floor(Math.abs(a)/b)*b,d):-e.math.ROUND(Math.ceil(Math.abs(a)/b)*b,d)},CEILINGMATH:function(a,b,c){return e.math.CEILING(a,b,c)},CEILINGPRECISE:function(a,b,c){return e.math.CEILING(a,b,c)},COMBIN:function(a,b){return e.math.FACT(a)/(e.math.FACT(b)*e.math.FACT(a-b))},COMBINA:function(a,b){return 0===a&&0===b?1:e.math.COMBIN(a+b-1,a-1)},COS:function(a){return Math.cos(a)},
COSH:function(a){return(Math.exp(a)+Math.exp(-a))/2},COT:function(a){return 1/Math.tan(a)},COTH:function(a){a=Math.exp(2*a);return(a+1)/(a-1)},CSC:function(a){return 1/Math.sin(a)},CSCH:function(a){return 2/(Math.exp(a)-Math.exp(-a))},DECIMAL:function(a,b){return parseInt(a,b)},DEGREES:function(a){return 180*a/Math.PI},DIVIDE:function(a,b){return""===a||""===b?"":0==b?"#DIV/0":parseFloat(a)/parseFloat(b)},EVEN:function(a){return e.math.CEILING(a,-2,-1)},EXP:function(a){return Math.exp(a)},FACT:function(a){a=
Math.floor(a);if(0===a||1===a)return 1;0<l.MEMOIZED_FACT[a]||(l.MEMOIZED_FACT[a]=e.math.FACT(a-1)*a);return l.MEMOIZED_FACT[a]},FACTDOUBLE:function(a){a=Math.floor(a);return 0>=a?1:a*e.math.FACTDOUBLE(a-2)},FLOOR:function(a,b,c){if(0===b)return 0;b="undefined"===typeof b?1:Math.abs(b);c="undefined"===typeof c?0:c;var d=-Math.floor(Math.log(b)/Math.log(10));return 0<=a?e.math.ROUND(Math.floor(a/b)*b,d):0===c?-e.math.ROUND(Math.ceil(Math.abs(a)/b)*b,d):-e.math.ROUND(Math.floor(Math.abs(a)/b)*b,d)},
FLOORMATH:function(a,b,c){return e.math.FLOOR(a,b,c)},FLOORPRECISE:function(a,b,c){return e.math.FLOOR(a,b,c)},GCD:function(){for(var a,b,c=arguments.length-1,d=arguments[c];c;)for(b=arguments[--c];a=b%d;b=d,d=a);return d},INT:function(a){return Math.floor(a)},ISEVEN:function(a){return Math.floor(Math.abs(a))&1?!1:!0},ISOCEILING:function(a,b,c){return e.math.CEILING(a,b,c)},ISODD:function(a){return Math.floor(Math.abs(a))&1?!0:!1},LCM:function(){for(var a=n.toArray(arguments),b,c,d,f=1;void 0!==(d=
a.pop());)for(;1<d;){if(d%2){b=3;for(c=Math.floor(Math.sqrt(d));b<=c&&d%b;b+=2);c=b<=c?b:d}else c=2;d/=c;f*=c;for(b=a.length;b;0===a[--b]%c&&1===(a[b]/=c)&&a.splice(b,1));}return f},LN:function(a){return Math.log(a)},LOG:function(a,b){b="undefined"===typeof b?10:b;return Math.log(a)/Math.log(b)},LOG10:function(a){return Math.log(a)/Math.log(10)},MOD:function(a,b){var c=Math.abs(a%b);return 0<b?c:-c},MROUND:function(a,b){if(0>a*b)throw Error("Number and multiple must have the same sign.");return Math.round(a/
b)*b},MULTINOMIAL:function(){for(var a=0,b=1,c=0;c<arguments.length;c++)a+=arguments[c],b*=e.math.FACT(arguments[c]);return e.math.FACT(a)/b},MULTIPLY:function(a,b){if(""===a||""===b)return"";a=isNaN(parseFloat(a))?0:parseFloat(a);b=isNaN(parseFloat(b))?0:parseFloat(b);return a*b},ODD:function(a){var b=Math.ceil(Math.abs(a)),b=b&1?b:b+1;return 0<a?b:-b},PI:function(){return Math.PI},POWER:function(a,b){return Math.pow(a,b)},PRODUCT:function(){for(var a=1,b=0;b<arguments.length;b++)a*=arguments[b];
return a},QUOTIENT:function(a,b){return(a/b).toFixed(0)},RADIANS:function(a){return a*Math.PI/180},RAND:function(){return Math.random()},RANDBETWEEN:function(a,b){return a+Math.ceil((b-a+1)*Math.random())-1},ROUND:function(a,b){return Math.round(a*Math.pow(10,b))/Math.pow(10,b)},ROUNDDOWN:function(a,b){return(0<a?1:-1)*Math.floor(Math.abs(a)*Math.pow(10,b))/Math.pow(10,b)},ROUNDUP:function(a,b){return(0<a?1:-1)*Math.ceil(Math.abs(a)*Math.pow(10,b))/Math.pow(10,b)},SERIESSUM:function(a,b,c,d){for(var f=
d[0]*Math.pow(a,b),k=1;k<d.length;k++)f+=d[k]*Math.pow(a,b+k*c);return f},SEC:function(a){return 1/Math.cos(a)},SECH:function(a){return 2/(Math.exp(a)+Math.exp(-a))},SIGN:function(a){return 0>a?-1:0===a?0:1},SIN:function(a){return Math.sin(a)},SINH:function(a){return(Math.exp(a)-Math.exp(-a))/2},SQRT:function(a){return Math.sqrt(a)},SQRTPI:function(a){return Math.sqrt(a*Math.PI)},SUBTOTAL:function(a){for(var b=[],c=1;c<arguments.length;c++)switch(a){case 1:b[c-1]=e.statistic.AVERAGE(arguments[c]);
break;case 2:b[c-1]=e.statistic.COUNT(arguments[c]);break;case 3:b[c-1]=e.statistic.COUNTA(arguments[c]);break;case 4:b[c-1]=e.statistic.MAX(arguments[c]);break;case 5:b[c-1]=e.statistic.MIN(arguments[c]);break;case 6:b[c-1]=e.statistic.PRODUCT(arguments[c]);break;case 7:b[c-1]=e.statistic.STDEV(arguments[c]);break;case 8:b[c-1]=e.statistic.STDEVP(arguments[c]);break;case 9:b[c-1]=e.math.SUM(arguments[c]);break;case 10:b[c-1]=e.statistic.VAR(arguments[c]);break;case 11:b[c-1]=e.statistic.VARP(arguments[c])}return b},
SUBTRACT:function(a,b){if(""===a&&""===b)return"";a=isNaN(parseFloat(a))?0:parseFloat(a);b=isNaN(parseFloat(b))?0:parseFloat(b);return a-b},SUM:function(){var a,b,c,d="",f=0;for(b=0;b<arguments.length;b++)if("object"==typeof arguments[b])for(a in arguments[b])d+="undefined"!=typeof arguments[b][a]?arguments[b][a]:"",c=isNaN(parseFloat(arguments[b][a],10))?0:parseFloat(arguments[b][a],10),f+=c;else d+="undefined"!=typeof arguments[b]?arguments[b]:"",c=isNaN(parseFloat(arguments[b],10))?0:parseFloat(arguments[b],
10),f+=c;return 0===f&&""===r.trim(d)?"":f},SUMIF:function(a,b,c){var d=0;a=n.objectToArray(a);c="undefined"==typeof c?a:n.objectToArray(c);for(var f=0;f<a.length;f++)this.evaluate(a[f]+b)&&(d+=c[f]);return d},SUMIFS:function(){for(var a=(arguments.length-1)/2,b=n.objectToArray(arguments[0]),c=0,d=0;d<b.length;d++){for(var f=!0,k=0;k<a;k++){var e=arguments[2*k+1],p=n.objectToArray(arguments[2*k+2]);f&&(f=this.evaluate(p[d]+e))}c+=f?b[d]:0}return c},SUMPRODUCT:function(){for(var a in arguments)if(arguments[a]=
n.objectToArray(arguments[a]),0<a&&arguments[a-1].length!==arguments[a].length)return"#VALUE!";a=[];for(var b=0;b<arguments.length;b++)for(var c=0;c<arguments[b].length;c++)a[c]=0==b?arguments[b][c]:e.math.MULTIPLY(a[c],arguments[b][c]);return e.math.SUM(a)},SUMSQ:function(){for(var a=n.toArray(arguments),b=0,c=0;c<a.length;c++)b+=r.isNumeric(a[c])?a[c]*a[c]:0;return b},SUMX2MY2:function(a,b){for(var c=0,d=0;d<a.length;d++)c+=a[d]*a[d]-b[d]*b[d];return c},SUMX2PY2:function(a,b){for(var c=0,d=0;d<
a.length;d++)c+=a[d]*a[d]+b[d]*b[d];return c},SUMXMY2:function(a,b){for(var c=0,d=0;d<a.length;d++)c+=Math.pow(a[d]-b[d],2);return c},TAN:function(a){return Math.tan(a)},TANH:function(a){a=Math.exp(2*a);return(a-1)/(a+1)},TRUNC:function(a,b){b="undefined"===typeof b?0:b;return(0<a?1:-1)*Math.floor(Math.abs(a)*Math.pow(10,b))/Math.pow(10,b)}},financial:{ACCRINT:function(a,b,c,d,f,k,s,p){if("undefined"==typeof h)return"#NAME?";if(!h(a).isValid()||!h(b).isValid()||!h(c).isValid())return"#VALUE!";if(0>=
d||0>=f||-1===[1,2,4].indexOf(k)||-1===[0,1,2,3,4].indexOf(s)||0<=h(a).diff(h(c)))return"#NUM!";f="undefined"===typeof f?0:f;s="undefined"===typeof s?0:s;k=0;p=h(new Date(a));h(new Date(b));h(new Date(c));h([p.year()]).isLeapYear();switch(s){case 0:k=e.date.YEARFRAC(a,c,s);break;case 1:k=e.date.YEARFRAC(a,c,s);break;case 2:k=e.date.YEARFRAC(a,c,s);break;case 3:k=e.date.YEARFRAC(a,c,s);break;case 4:k=e.date.YEARFRAC(a,c,s)}return f*d*k},ACCRINTM:function(){},AMORDEGRC:function(){},AMORLINC:function(){},
COUPDAYBS:function(){},COUPDAYS:function(){},COUPDAYSNC:function(){},COUPNCD:function(){},COUPNUM:function(){},COUPPCD:function(){},CUMIPMT:function(a,b,c,d,f,k){if(0>=a||0>=b||0>=c||1>d||1>f||d>f||0!==k&&1!==k)return"#NUM!";b=e.financial.PMT(a,b,c,0,k);var s=0;1===d&&0===k&&(s=-c,d++);for(;d<=f;d++)s=1===k?s+(e.financial.FV(a,d-2,b,c,1)-b):s+e.financial.FV(a,d-1,b,c,0);return s*a},CUMPRINC:function(a,b,c,d,f,k){if(0>=a||0>=b||0>=c||1>d||1>f||d>f||0!==k&&1!==k)return"#NUM!";b=e.financial.PMT(a,b,
c,0,k);var s=0;1===d&&(s=0===k?b+c*a:b,d++);for(;d<=f;d++)s=0<k?s+(b-(e.financial.FV(a,d-2,b,c,1)-b)*a):s+(b-e.financial.FV(a,d-1,b,c,0)*a);return s},DB:function(a,b,c,d,f){f="undefined"===typeof f?12:f;if(isNaN(a)||isNaN(b)||isNaN(c)||isNaN(d)||isNaN(f))return"#VALUE!";if(0>a||0>b||0>c||0>d||-1===[1,2,3,4,5,6,7,8,9,10,11,12].indexOf(f)||d>c)return"#NUM!";if(b>=a)return 0;b=(1-Math.pow(b/a,1/c)).toFixed(3);for(var k=f=a*b*f/12,e=0,p=d===c?c-1:d,m=2;m<=p;m++)e=(a-k)*b,k+=e;return 1===d?f:d===c?(a-
k)*b:e},DDB:function(a,b,c,d,f){f="undefined"===typeof f?2:f;if(isNaN(a)||isNaN(b)||isNaN(c)||isNaN(d)||isNaN(f))return"#VALUE!";if(0>a||0>b||0>c||0>d||0>=f||d>c)return"#NUM!";if(b>=a)return 0;for(var k=0,e=0,p=1;p<=d;p++)e=Math.min(f/c*(a-k),a-b-k),k+=e;return e},DISC:function(){},DOLLARDE:function(a,b){if(isNaN(a)||isNaN(b))return"#VALUE!";if(0>b)return"#NUM!";if(0<=b&&1>b)return"#DIV/0!";b=parseInt(b,10);var c=parseInt(a,10),c=c+a%1*Math.pow(10,Math.ceil(Math.log(b)/Math.LN10))/b,d=Math.pow(10,
Math.ceil(Math.log(b)/Math.LN2)+1);return c=Math.round(c*d)/d},DOLLARFR:function(a,b){if(isNaN(a)||isNaN(b))return"#VALUE!";if(0>b)return"#NUM!";if(0<=b&&1>b)return"#DIV/0!";b=parseInt(b,10);var c=parseInt(a,10);return c+=a%1*Math.pow(10,-Math.ceil(Math.log(b)/Math.LN10))*b},DURATION:function(){},EFFECT:function(a,b){if(isNaN(a)||isNaN(b))return"#VALUE!";if(0>=a||1>b)return"#NUM!";b=parseInt(b,10);return Math.pow(1+a/b,b)-1},FV:function(a,b,c,d,f){f="undefined"===typeof f?0:f;0===a?a=d+c*b:(b=Math.pow(1+
a,b),a=1===f?d*b+c*(1+a)*(b-1)/a:d*b+c*(b-1)/a);return-a},FVSCHEDULE:function(a,b){for(var c=a,d=0;d<b.length;d++){if(isNaN(b[d]))return"#VALUE!";c*=1+b[d]}return c},INTRATE:function(){},IPMT:function(a,b,c,d,f,k){k="undefined"===typeof k?0:k;c=e.financial.PMT(a,c,d,f,k);return(1===b?1===k?0:-d:1===k?e.financial.FV(a,b-2,c,d,1)-c:e.financial.FV(a,b-1,c,d,0))*a},IRR:function(a,b){var c,d=[],f;for(f in a)c=parseFloat(a[f],10),c=isNaN(c)?0:c,d.push(c);c=function(a,b,c){c+=1;for(var d=a[0],f=1;f<a.length;f++)d+=
a[f]/Math.pow(c,(b[f]-b[0])/365);return d};f=function(a,b,c){c+=1;for(var d=0,f=1;f<a.length;f++)var k=(b[f]-b[0])/365,d=d-k*a[f]/Math.pow(c,k+1);return d};for(var k=[],e=!1,p=!1,m=0;m<d.length;m++)k[m]=0===m?0:k[m-1]+365,0<d[m]&&(e=!0),0>d[m]&&(p=!0);if(!e||!p)return"#NUM!";var e="undefined"===typeof b?.1:b,q,g,p=0,m=!0;do g=c(d,k,e),m=e-g/f(d,k,e),q=Math.abs(m-e),e=m,m=1E-10<q&&1E-10<Math.abs(g);while(m&&50>++p);return m?"#NUM!":e},ISPMT:function(a,b,c,d){return d*a*(b/c-1)},MDURATION:function(){},
MIRR:function(a,b,c){var d=[],f;for(f in a)d.push(a[f]);a=d.length;f=[];for(var k=[],s=0;s<a;s++)0>d[s]?f.push(d[s]):k.push(d[s]);c=-e.financial.NPV(c,k)*Math.pow(1+c,a-1);b=e.financial.NPV(b,f)*(1+b);return Math.pow(c/b,1/(a-1))-1},NOMINAL:function(a,b){if(isNaN(a)||isNaN(b))return"#VALUE!";if(0>=a||1>b)return"#NUM!";b=parseInt(b,10);return(Math.pow(a+1,1/b)-1)*b},NPER:function(a,b,c,d,f){f="undefined"===typeof f?0:f;return Math.log((b*(1+a*f)-("undefined"===typeof d?0:d)*a)/(c*a+b*(1+a*f)))/Math.log(1+
a)},NPV:function(){for(var a,b=[],c=0;c<arguments.length;c++)if("object"==typeof arguments[c])for(var d in arguments[c])a=parseFloat(arguments[c][d],10),a=isNaN(a)?0:a,b=b.concat([a]);else a=parseFloat(arguments[c],10),a=isNaN(a)?0:a,b=b.concat([a]);a=b[0];c=0;for(d=1;d<b.length;d++)c+=b[d]/Math.pow(1+a,d);return c},ODDFPRICE:function(){},ODDFYIELD:function(){},ODDLPRICE:function(){},ODDLYIELD:function(){},PDURATION:function(a,b,c){return isNaN(a)||isNaN(b)||isNaN(c)?"#VALUE!":0>=a?"#NUM!":(Math.log(c)-
Math.log(b))/Math.log(1+a)},PMT:function(a,b,c,d,f){f="undefined"===typeof f?0:f;d="undefined"===typeof d?0:d;0===a?a=(c+d)/b:(b=Math.pow(1+a,b),a=1===f?(d*a/(b-1)+c*a/(1-1/b))/(1+a):d*a/(b-1)+c*a/(1-1/b));return-a},PPMT:function(a,b,c,d,f,k){return e.financial.PMT(a,c,d,f,k)-e.financial.IPMT(a,b,c,d,f,k)},PRICE:function(){},PRICEDISC:function(){},PRICEMAT:function(){},PV:function(a,b,c,d,f){f="undefined"===typeof f?0:f;d="undefined"===typeof d?0:d;return 0===a?-c*b-d:((1-Math.pow(1+a,b))/a*c*(1+
a*f)-d)/Math.pow(1+a,b)},RATE:function(a,b,c,d,f,k){d="undefined"===typeof d?0:d;f="undefined"===typeof f?0:f;var e,p,m,q=0,g=e=0,h="undefined"===typeof k?.01:k;1E-10>Math.abs(h)||(e=Math.exp(a*Math.log(1+h)));k=c+b*a+d;p=c*e+b*(1/h+f)*(e-1)+d;g=m=0;for(q=h;1E-10<Math.abs(k-p)&&50>g;)h=(p*m-k*q)/(p-k),m=q,q=h,1E-10>Math.abs(h)?e=c*(1+a*h)+b*(1+h*f)*a+d:(e=Math.exp(a*Math.log(1+h)),e=c*e+b*(1/h+f)*(e-1)+d),k=p,p=e,++g;return h},RECEIVED:function(){},RRI:function(a,b,c){return isNaN(a)||isNaN(b)||isNaN(c)?
"#VALUE!":0===a||0===b?"#NUM!":Math.pow(c/b,1/a)-1},SLN:function(a,b,c){return isNaN(a)||isNaN(b)||isNaN(c)?"#VALUE!":0===c?"#NUM!":(a-b)/c},SYD:function(a,b,c,d){if(isNaN(a)||isNaN(b)||isNaN(c)||isNaN(d))return"#VALUE!";if(0===c||1>d||d>c)return"#NUM!";d=parseInt(d,10);return(a-b)*(c-d+1)*2/(c*(c+1))},TBILLEQ:function(a,b,c){return h(a).isValid()&&h(b).isValid()?0>=c||0<h(a).diff(h(b))||1<h(b).diff(h(a),"years")?"#NUM!":365*c/(360-c*e.date.DAYS360(a,b)):"#VALUE!"},TBILLPRICE:function(a,b,c){return h(a).isValid()&&
h(b).isValid()?0>=c||0<h(a).diff(h(b))||1<h(b).diff(h(a),"years")?"#NUM!":100*(1-c*e.date.DAYS360(a,b)/360):"#VALUE!"},TBILLYIELD:function(a,b,c){return h(a).isValid()&&h(b).isValid()?0>=c||0<h(a).diff(h(b))||1<h(b).diff(h(a),"years")?"#NUM!":360*(100-c)/(c*e.date.DAYS360(a,b)):"#VALUE!"},VDB:function(){},XIRR:function(a,b,c){var d=[],f;for(f in a)d.push(a[f]);a=function(a,b,c){c+=1;for(var d=a[0],f=1;f<a.length;f++)d+=a[f]/Math.pow(c,h(b[f]).diff(h(b[0]),"days")/365);return d};f=function(a,b,c){c+=
1;for(var d=0,f=1;f<a.length;f++)var k=h(b[f]).diff(h(b[0]),"days")/365,d=d-k*a[f]/Math.pow(c,k+1);return d};for(var k=!1,e=!1,p=0;p<d.length;p++)0<d[p]&&(k=!0),0>d[p]&&(e=!0);if(!k||!e)return"#NUM!";c=c||.1;var m,k=0,e=!0;do m=a(d,b,c),e=c-m/f(d,b,c),p=Math.abs(e-c),c=e,e=1E-10<p&&1E-10<Math.abs(m);while(e&&50>++k);return e?"#NUM!":c},XNPV:function(a,b,c){for(var d=0,f=0;f<b.length;f++)d+=b[f]/Math.pow(1+a,h(c[f]).diff(h(c[0]),"days")/365);return d},YIELD:function(){},YIELDDISC:function(){},YIELDMAT:function(){}},
statistic:{AVEDEV:function(){if("undefined"==typeof g)return l.ERRKEY.jStatRequired;var a=n.arrayMerge(arguments);return g.sum(g(a).subtract(g.mean(a)).abs()[0])/a.length},AVERAGE:function(){for(var a=n.arrayMerge(arguments),b=a.length,c=0,d=0,f=0,k=0;k<b;k++)!0!==a[k]&&!1!==a[k]&&(f=parseFloat(a[k]),d+=isNaN(f)?0:f,c++);return d/c},AVERAGEA:function(){return"undefined"==typeof g?l.ERRKEY.jStatRequired:g.mean(n.arrayMerge(arguments))},AVERAGEIF:function(a,b,c){c="undefined"===typeof c?a:c;for(var d=
0,f=0,k=0;k<a.length;k++)eval(a[k]+b)&&(f+=c[k],d++);return f/d},AVERAGEIFS:function(){for(var a=(arguments.length-1)/2,b=arguments[0],c=0,d=0,f=0;f<b.length;f++){for(var k=!0,e=0;e<a;e++)eval(arguments[2*e+1][f]+arguments[2*e+2])||(k=!1);k&&(d+=b[f],c++)}return d/c},BETADIST:function(a,b,c,d,f,k){if("undefined"==typeof g)return l.ERRKEY.jStatRequired;f="undefined"===typeof f?0:f;a=(a-f)/(("undefined"===typeof k?1:k)-f);return d?g.beta.cdf(a,b,c):g.beta.pdf(a,b,c)},BETAINV:function(a,b,c,d,f){if("undefined"==
typeof g)return l.ERRKEY.jStatRequired;d="undefined"===typeof d?0:d;f="undefined"===typeof f?1:f;return g.beta.inv(a,b,c)*(f-d)+d},BINOMDIST:function(a,b,c,d){return"undefined"==typeof g?l.ERRKEY.jStatRequired:d?g.binomial.cdf(a,b,c):g.binomial.pdf(a,b,c)},BINOMDISTRANGE:function(a,b,c,d){d="undefined"===typeof d?c:d;for(var f=0;c<=d;c++)f+=e.math.COMBIN(a,c)*Math.pow(b,c)*Math.pow(1-b,a-c);return f},BINOMINV:function(a,b,c){if("undefined"==typeof g)return l.ERRKEY.jStatRequired;for(var d=0;d<=a;){if(g.binomial.cdf(d,
a,b)>=c)return d;d++}},CHISQDIST:function(a,b,c){return"undefined"==typeof g?l.ERRKEY.jStatRequired:c?g.chisquare.cdf(a,b):g.chisquare.pdf(a,b)},CHISQDISTRT:function(a,b){},CHISQINV:function(a,b){return"undefined"==typeof g?l.ERRKEY.jStatRequired:g.chisquare.inv(a,b)},CHISQINVRT:function(){},CHISQTEST:function(){},CONFIDENCENORM:function(a,b,c){return"undefined"==typeof g?l.ERRKEY.jStatRequired:g.normalci(1,a,b,c)[1]-1},CONFIDENCET:function(a,b,c){return"undefined"==typeof g?l.ERRKEY.jStatRequired:
g.tci(1,a,b,c)[1]-1},CORREL:function(){return"undefined"==typeof g?l.ERRKEY.jStatRequired:g.corrcoeff.apply(this,arguments)},COUNT:function(){return n.arrayMerge(arguments).length},COUNTA:function(){var a=n.arrayMerge(arguments);return a.length-e.statistic.COUNTBLANK(a)},COUNTBLANK:function(){for(var a=n.arrayMerge(arguments),b=0,c=0;c<a.length;c++)null!==a[c]&&""!==a[c]||b++;return b},COUNTIF:function(a,b){var c=0,d;for(d in a)a[d].match(new RegExp(b))&&c++;return c},COUNTIFS:function(){var a=(arguments.length-
1)/2,b=arguments[0],c=0,d;for(d in b){for(var b=!0,f=0;f<a;f++)eval(arguments[2*f+1][d]+arguments[2*f+2])||(b=!1);c+=b?1:0}return c},COUNTUNIQUE:function(){return n.unique(n.arrayMerge(arguments)).length},COVARIANCEP:function(a,b){if("undefined"==typeof g)return l.ERRKEY.jStatRequired;for(var c=g.mean(a),d=g.mean(b),f=0,k=a.length,e=0;e<k;e++)f+=(a[e]-c)*(b[e]-d);return f/k},COVARIANCES:function(){return"undefined"==typeof g?l.ERRKEY.jStatRequired:g.covariance.apply(this,arguments)},DEVSQ:function(){if("undefined"==
typeof g)return l.ERRKEY.jStatRequired;for(var a=n.arrayMerge(arguments),b=g.mean(a),c=0,d=0;d<a.length;d++)c+=Math.pow(a[d]-b,2);return c},EXPONDIST:function(a,b,c){return"undefined"==typeof g?l.ERRKEY.jStatRequired:c?g.exponential.cdf(a,b):g.exponential.pdf(a,b)},FDIST:function(a,b,c,d){return"undefined"==typeof g?l.ERRKEY.jStatRequired:d?g.centralF.cdf(a,b,c):g.centralF.pdf(a,b,c)},FDISTRT:function(){},FINV:function(a,b,c){return"undefined"==typeof g?l.ERRKEY.jStatRequired:g.centralF.inv(a,b,c)},
FINVRT:function(){},FTEST:function(){},FISHER:function(a){return Math.log((1+a)/(1-a))/2},FISHERINV:function(a){a=Math.exp(2*a);return(a-1)/(a+1)},FORECAST:function(a,b,c){if("undefined"==typeof g)return l.ERRKEY.jStatRequired;for(var d=g.mean(c),f=g.mean(b),k=c.length,e=0,p=0,m=0;m<k;m++)e+=(c[m]-d)*(b[m]-f),p+=Math.pow(c[m]-d,2);b=e/p;return f-b*d+b*a},FREQUENCY:function(a,b){for(var c=a.length,d=b.length,f=[],k=0;k<=d;k++)for(var e=f[k]=0;e<c;e++)0===k?a[e]<=b[0]&&(f[0]+=1):k<d?a[e]>b[k-1]&&a[e]<=
b[k]&&(f[k]+=1):k===d&&a[e]>b[d-1]&&(f[d]+=1);return f},GAMMA:function(){return"undefined"==typeof g?l.ERRKEY.jStatRequired:g.gammafn.apply(this,arguments)},GAMMADIST:function(a,b,c,d){},GAMMAINV:function(a,b,c){},GAMMALN:function(){return"undefined"==typeof g?l.ERRKEY.jStatRequired:g.gammaln.apply(this,arguments)},GAMMALNPRECISE:function(){},GAUSS:function(a){return"undefined"==typeof g?l.ERRKEY.jStatRequired:g.normal.cdf(a,0,1)-.5},GEOMEAN:function(){return"undefined"==typeof g?l.ERRKEY.jStatRequired:
g.geomean(n.arrayMerge(arguments))},GROWTH:function(a,b,c,d){var f;if("undefined"===typeof b)for(b=[],f=1;f<=a.length;f++)b.push(f);if("undefined"===typeof c)for(c=[],f=1;f<=a.length;f++)c.push(f);"undefined"===typeof d&&(d=!0);var k=a.length,e=0,p=0,m=0,g=0;for(f=0;f<k;f++)var h=b[f],l=Math.log(a[f]),e=e+h,p=p+l,m=m+h*l,g=g+h*h;e/=k;p/=k;m/=k;g/=k;d?(a=(m-e*p)/(g-e*e),e=p-a*e):(a=m/g,e=0);p=[];for(f=0;f<c.length;f++)p.push(Math.exp(e+a*c[f]));return p},HARMEAN:function(){for(var a=n.arrayMerge(arguments),
b=a.length,c=0,d=0;d<b;d++)c+=1/a[d];return b/c},HYPGEOMDIST:function(a,b,c,d,f){function k(a,b,c,d){return e.math.COMBIN(c,a)*e.math.COMBIN(d-c,b-a)/e.math.COMBIN(d,b)}function s(a,b,c,d){for(var f=0,e=0;e<=a;e++)f+=k(e,b,c,d);return f}return f?s(a,b,c,d):k(a,b,c,d)},INTERCEPT:function(a,b){return e.statistic.FORECAST(0,a,b)},KURT:function(){if("undefined"==typeof g)return l.ERRKEY.jStatRequired;for(var a=n.arrayMerge(arguments),b=g.mean(a),c=a.length,d=0,f=0;f<c;f++)d+=Math.pow(a[f]-b,4);d/=Math.pow(g.stdev(a,
!0),4);return c*(c+1)/((c-1)*(c-2)*(c-3))*d-3*(c-1)*(c-1)/((c-2)*(c-3))},LARGE:function(a,b){a=n.objectToArray(a);return a.sort(function(a,b){return b-a})[b-1]},LINEST:function(a,b){if("undefined"==typeof g)return l.ERRKEY.jStatRequired;for(var c=g.mean(b),d=g.mean(a),f=b.length,k=0,e=0,p=0;p<f;p++)k+=(b[p]-c)*(a[p]-d),e+=Math.pow(b[p]-c,2);f=k/e;return[f,d-f*c]},LOGEST:function(){},LOGNORMDIST:function(a,b,c,d){return"undefined"==typeof g?l.ERRKEY.jStatRequired:d?g.lognormal.cdf(a,b,c):g.lognormal.pdf(a,
b,c)},LOGNORMINV:function(a,b,c){return"undefined"==typeof g?l.ERRKEY.jStatRequired:g.lognormal.inv(a,b,c)},MAX:function(){for(var a=n.arrayMerge(arguments),b=a.length,c=0<b?a[0]:0,d=0;d<b;d++)c=a[d]>c&&!0!==a[d]&&!1!==a[d]?a[d]:c;return c},MAXA:function(){var a=n.arrayMerge(arguments);return 0<a.length?Math.max.apply(Math,a):0},MEDIAN:function(){return"undefined"==typeof g?l.ERRKEY.jStatRequired:g.median(n.arrayMerge(arguments))},MIN:function(){for(var a=n.arrayMerge(arguments),b=a.length,c=0<b?
a[0]:0,d=0;d<b;d++)c=a[d]<c&&!0!==a[d]&&!1!==a[d]?a[d]:c;return c},MINA:function(){var a=n.arrayMerge(arguments);return 0<a.length?Math.min.apply(Math,a):0},MODEMULT:function(){for(var a=n.arrayMerge(arguments),b=a.length,c={},d=[],f=0,e,s=0;s<b;s++)e=a[s],c[e]=c[e]?c[e]+1:1,c[e]>f&&(f=c[e],d=[]),c[e]===f&&(d[d.length]=e);return d},MODESNGL:function(){return e.statistic.MODEMULT(n.arrayMerge(arguments)).sort(function(a,b){return a-b})[0]},NEGBINOMDIST:function(a,b,c,d){return"undefined"==typeof g?
l.ERRKEY.jStatRequired:d?g.negbin.cdf(a,b,c):g.negbin.pdf(a,b,c)},NORMDIST:function(a,b,c,d){return"undefined"==typeof g?l.ERRKEY.jStatRequired:isNaN(a)||isNaN(b)||isNaN(c)?"#VALUE!":0>=c?"#NUM!":d?g.normal.cdf(a,b,c):g.normal.pdf(a,b,c)},NORMINV:function(a,b,c){return"undefined"==typeof g?l.ERRKEY.jStatRequired:g.normal.inv(a,b,c)},NORMSDIST:function(a,b){return"undefined"==typeof g?l.ERRKEY.jStatRequired:b?g.normal.cdf(a,0,1):g.normal.pdf(a,0,1)},NORMSINV:function(a){return"undefined"==typeof g?
l.ERRKEY.jStatRequired:g.normal.inv(a,0,1)},PEARSON:function(a,b){if("undefined"==typeof g)return l.ERRKEY.jStatRequired;for(var c=g.mean(a),d=g.mean(b),f=a.length,e=0,s=0,p=0,m=0;m<f;m++)e+=(a[m]-c)*(b[m]-d),s+=Math.pow(a[m]-c,2),p+=Math.pow(b[m]-d,2);return e/Math.sqrt(s*p)},PERCENTILEEXC:function(a,b){a=a.sort(function(a,b){return a-b});var c=a.length;if(b<1/(c+1)||b>1-1/(c+1))return"#NUM!";var c=b*(c+1)-1,d=Math.floor(c);return n.cleanFloat(c===d?a[c]:a[d]+(c-d)*(a[d+1]-a[d]))},PERCENTILEINC:function(a,
b){a=a.sort(function(a,b){return a-b});var c=b*(a.length-1),d=Math.floor(c);return n.cleanFloat(c===d?a[c]:a[d]+(c-d)*(a[d+1]-a[d]))},PERCENTRANKEXC:function(a,b,c){a=a.sort(function(a,b){return a-b});var d=n.unique(a),f=a.length,e=d.length;c=Math.pow(10,"undefined"===typeof c?3:c);for(var s=0,p=!1,g=0;!p&&g<e;)b===d[g]?(s=(a.indexOf(d[g])+1)/(f+1),p=!0):b>=d[g]&&(b<d[g+1]||g===e-1)&&(s=(a.indexOf(d[g])+1+(b-d[g])/(d[g+1]-d[g]))/(f+1),p=!0),g++;return Math.floor(s*c)/c},PERCENTRANKINC:function(a,
b,c){a=a.sort(function(a,b){return a-b});var d=n.unique(a),f=a.length,e=d.length;c=Math.pow(10,"undefined"===typeof c?3:c);for(var s=0,g=!1,m=0;!g&&m<e;)b===d[m]?(s=a.indexOf(d[m])/(f-1),g=!0):b>=d[m]&&(b<d[m+1]||m===e-1)&&(s=(a.indexOf(d[m])+(b-d[m])/(d[m+1]-d[m]))/(f-1),g=!0),m++;return Math.floor(s*c)/c},PERMUT:function(a,b){return e.math.FACT(a)/e.math.FACT(a-b)},PERMUTATIONA:function(a,b){return Math.pow(a,b)},PHI:function(a){return Math.exp(-.5*a*a)/l.SQRT2PI},POISSONDIST:function(a,b,c){return"undefined"==
typeof g?l.ERRKEY.jStatRequired:c?g.poisson.cdf(a,b):g.poisson.pdf(a,b)},PROB:function(a,b,c,d){if("undefined"===typeof c)return 0;d="undefined"===typeof d?c:d;if(c===d)return 0<=a.indexOf(c)?b[a.indexOf(c)]:0;for(var f=a.sort(function(a,b){return a-b}),e=f.length,g=0,p=0;p<e;p++)f[p]>=c&&f[p]<=d&&(g+=b[a.indexOf(f[p])]);return g},QUARTILEEXC:function(a,b){switch(b){case 1:return e.statistic.PERCENTILEEXC(a,.25);case 2:return e.statistic.PERCENTILEEXC(a,.5);case 3:return e.statistic.PERCENTILEEXC(a,
.75);default:return"#NUM!"}},QUARTILEINC:function(a,b){switch(b){case 1:return e.statistic.PERCENTILEINC(a,.25);case 2:return e.statistic.PERCENTILEINC(a,.5);case 3:return e.statistic.PERCENTILEINC(a,.75);default:return"#NUM!"}},RANKAVG:function(a,b,c){b=b.sort(("undefined"===typeof c?0:c)?function(a,b){return a-b}:function(a,b){return b-a});c=n.countIn(b,a);return 1<c?(2*b.indexOf(a)+c+1)/2:b.indexOf(a)+1},RANKEQ:function(a,b,c){b=b.sort(("undefined"===typeof c?0:c)?function(a,b){return a-b}:function(a,
b){return b-a});return b.indexOf(a)+1},RSQ:function(a,b){return Math.pow(e.statistic.PEARSON(a,b),2)},SKEW:function(){if("undefined"==typeof g)return l.ERRKEY.jStatRequired;for(var a=n.arrayMerge(arguments),b=g.mean(a),c=a.length,d=0,f=0;f<c;f++)d+=Math.pow(a[f]-b,3);return c*d/((c-1)*(c-2)*Math.pow(g.stdev(a,!0),3))},SKEWP:function(){if("undefined"==typeof g)return l.ERRKEY.jStatRequired;for(var a=n.arrayMerge(arguments),b=g.mean(a),c=a.length,d=0,f=0,e=0;e<c;e++)f+=Math.pow(a[e]-b,3),d+=Math.pow(a[e]-
b,2);return f/c/Math.pow(d/c,1.5)},SLOPE:function(a,b){if("undefined"==typeof g)return l.ERRKEY.jStatRequired;for(var c=g.mean(b),d=g.mean(a),f=b.length,e=0,s=0,p=0;p<f;p++)e+=(b[p]-c)*(a[p]-d),s+=Math.pow(b[p]-c,2);return e/s},SMALL:function(a,b){return a.sort(function(a,b){return a-b})[b-1]},STANDARDIZE:function(a,b,c){return(a-b)/c},STDEVA:function(){for(var a=n.arrayMerge(arguments),b=a.length,c=0,d=g.mean(a),f=0;f<b;f++)c+=Math.pow(a[f]-d,2);return Math.sqrt(c/(b-1))},STDEVP:function(){for(var a=
n.arrayMerge(arguments),b=a.length,c=0,d=0,f=e.statistic.AVERAGE(a),k=0;k<b;k++)!0!==a[k]&&!1!==a[k]&&(c+=Math.pow(a[k]-f,2),d++);return Math.sqrt(c/d)},STDEVPA:function(){if("undefined"==typeof g)return l.ERRKEY.jStatRequired;for(var a=n.arrayMerge(arguments),b=a.length,c=0,d=g.mean(a),f=0;f<b;f++)c+=Math.pow(a[f]-d,2);return Math.sqrt(c/b)},STDEVS:function(){for(var a=n.arrayMerge(arguments),b=a.length,c=0,d=0,f=e.statistic.AVERAGE(a),k=0;k<b;k++)!0!==a[k]&&!1!==a[k]&&(c+=Math.pow(a[k]-f,2),d++);
return Math.sqrt(c/(d-1))},STEYX:function(a,b){if("undefined"==typeof g)return l.ERRKEY.jStatRequired;for(var c=g.mean(b),d=g.mean(a),f=b.length,e=0,s=0,p=0,m=0;m<f;m++)e+=Math.pow(a[m]-d,2),s+=(b[m]-c)*(a[m]-d),p+=Math.pow(b[m]-c,2);return Math.sqrt((e-s*s/p)/(f-2))},TDIST:function(a,b,c){return"undefined"==typeof g?l.ERRKEY.jStatRequired:c?g.studentt.cdf(a,b):g.studentt.pdf(a,b)},TDIST2T:function(){},TDISTRT:function(){},TINV:function(a,b){return"undefined"==typeof g?l.ERRKEY.jStatRequired:g.studentt.inv(a,
b)},TINV2T:function(){},TTEST:function(){},TREND:function(){},TRIMMEAN:function(a,b){if("undefined"==typeof g)return l.ERRKEY.jStatRequired;var c=e.math.FLOOR(a.length*b,2)/2;return g.mean(n.initial(n.rest(a.sort(function(a,b){return a-b}),c),c))},VARA:function(){if("undefined"==typeof g)return l.ERRKEY.jStatRequired;for(var a=n.arrayMerge(arguments),b=a.length,c=0,d=g.mean(a),f=0;f<b;f++)c+=Math.pow(a[f]-d,2);return c/(b-1)},VARP:function(){for(var a=n.arrayMerge(arguments),b=a.length,c=0,d=0,f=
e.statistic.AVERAGE(a),k=0;k<b;k++)!0!==a[k]&&!1!==a[k]&&(c+=Math.pow(a[k]-f,2),d++);return c/d},VARPA:function(){if("undefined"==typeof g)return l.ERRKEY.jStatRequired;for(var a=n.arrayMerge(arguments),b=a.length,c=0,d=g.mean(a),f=0;f<b;f++)c+=Math.pow(a[f]-d,2);return c/b},VARS:function(){for(var a=n.arrayMerge(arguments),b=a.length,c=0,d=0,f=e.statistic.AVERAGE(a),k=0;k<b;k++)!0!==a[k]&&!1!==a[k]&&(c+=Math.pow(a[k]-f,2),d++);return c/(d-1)},WEIBULLDIST:function(a,b,c,d){return d?1-Math.exp(-Math.pow(a/
c,b)):Math.pow(a,b-1)*Math.exp(-Math.pow(a/c,b))*b/Math.pow(c,b)},ZTEST:function(a,b,c){var d=a.length;c="undefined"===typeof c?e.statistic.STDEVS(a):c;return 1-e.statistic.NORMSDIST((e.statistic.AVERAGE(a)-b)/(c/Math.sqrt(d)),e.logical.TRUE)}},logical:{AND:function(){for(var a=!0,b=0;b<arguments.length;b++)arguments[b]||(a=!1);return a},CHOOSE:function(){var a=arguments[0];return"undefined"==typeof arguments[a]?"#NUM!":arguments[a]},FALSE:function(){return!1},IF:function(a,b,c){return a?"undefined"===
typeof b?!0:b:"undefined"===typeof c?!1:c},IFERROR:function(a,b){return 0<=l.ERROR.indexOf(a)?b:a},IFNA:function(a,b){return"#N/A"===a?b:a},NOT:function(a){return!a},OR:function(){for(var a=!1,b=0;b<arguments.length;b++)arguments[b]&&(a=!0);return a},SWITCH:function(){var a;if(0<arguments.length){var b=arguments[0],c=arguments.length-1,d=Math.floor(c/2),f=!1,c=0===c%2?null:arguments[arguments.length-1];if(d)for(var e=0;e<d;e++)if(b==arguments[2*e+1]){a=arguments[2*e+2];f=!0;break}!f&&c&&(a=c)}return a},
TRUE:function(){return!0},XOR:function(){for(var a=0,b=0;b<arguments.length;b++)arguments[b]&&a++;return Math.floor(Math.abs(a))&1?!0:!1},NULL:function(){return null}},geometry:{},text:{CONCAT:function(){var a="",b;for(b in arguments)a="object"==typeof arguments[b]?a+e.text.CONCAT.apply(this,arguments[b]):a+arguments[b];return a},CHAR:function(a){return String.fromCharCode(a)},CLEAN:function(a){return a.replace(/[\0-\x1F]/g,"")},CODE:function(a){return a.charCodeAt(0)},CONCATENATE:function(){for(var a=
"",b=0;b<arguments.length;b++)null!==arguments[b]&&void 0!==arguments[b]&&(a+=arguments[b]);return a},DOLLAR:function(a,b){if("undefined"==typeof x)return"#NAME?";b="undefined"===typeof b?2:b;var c="";0>=b?(a=Math.round(a*Math.pow(10,b))/Math.pow(10,b),c="($0,0)"):0<b&&(c="($0,0."+Array(b+1).join("0")+")");return x(a).format(c)},EXACT:function(a,b){return a===b},FIND:function(a,b,c){return b?b.indexOf(a,("undefined"===typeof c?0:c)-1)+1:null},FIXED:function(a,b,c){if("undefined"==typeof x)return"#NAME?";
b="undefined"===typeof b?2:b;c=("undefined"===typeof c?0:c)?"0":"0,0";0>=b?a=Math.round(a*Math.pow(10,b))/Math.pow(10,b):0<b&&(c+="."+Array(b+1).join("0"));return x(a).format(c)},HTML2TEXT:function(a){var b="";a&&(a instanceof Array?a.forEach(function(a){""!==b&&(b+="\n");b+=a.replace(/<(?:.|\n)*?>/gm,"")}):b=a.replace(/<(?:.|\n)*?>/gm,""));return b},HUMANIZE:function(a){return a instanceof Date?(a=h(a),a.hours()||a.minutes()||a.seconds()?a.format("dddd, MMMM Do YYYY, h:mm:ss"):a.format("dddd, MMMM Do YYYY")):
a},JOIN:function(a,b){return a.join(b)},LEFT:function(a,b){return a?a.substring(0,"undefined"===typeof b?1:b):null},LEN:function(a){return(a+"").length},LOWER:function(a){return a?a.toLowerCase():a},MID:function(a,b,c){return a.substring(b-1,c)},NUMBERVALUE:function(a,b,c){c="undefined"===typeof c?",":c;return Number(a.replace("undefined"===typeof b?".":b,".").replace(c,""))},PROPER:function(a){return a.replace(/\w\S*/g,function(a){return a.charAt(0).toUpperCase()+a.substr(1).toLowerCase()})},REGEXEXTRACT:function(a,
b){var c=a.match(new RegExp(b));return c?c[0]:null},REGEXMATCH:function(a,b,c){var d=a.match(new RegExp(b));return c?d:a.match(new RegExp(b))?!0:!1},REGEXREPLACE:function(a,b,c){return a.replace(new RegExp(b),c)},REPLACE:function(a,b,c,d){return a.substr(0,b-1)+d+a.substr(b-1+c)},REPT:function(a,b){return Array(b+1).join(a)},RIGHT:function(a,b){return a?a.substring(a.length-("undefined"===typeof b?1:b)):null},ROMAN:function(a){a=String(a).split("");for(var b=" C CC CCC CD D DC DCC DCCC CM X XX XXX XL L LX LXX LXXX XC I II III IV V VI VII VIII IX".split(" "),
c="",d=3;d--;)c=(b[+a.pop()+10*d]||"")+c;return Array(+a.join("")+1).join("M")+c},SEARCH:function(a,b,c){c="undefined"===typeof c?0:c;return b.toLowerCase().indexOf(a.toLowerCase(),c-1)+1},SPLIT:function(a,b){a=r.trim(a);return a.split(a,b||/\s+/)},SUBSTITUTE:function(a,b,c,d){if(a&&b&&c){if("undefined"===typeof d)return a.replace(new RegExp(b,"g"),c);for(var f=0,e=0;0<a.indexOf(b,f);)if(f=a.indexOf(b,f+1),e++,e===d)return a.substring(0,f)+c+a.substring(f+b.length)}else return a},T:function(a){return"string"===
typeof a?a:null},TEXT:function(a,b){if("undefined"==typeof x)return"#NAME?";var c="";if(a)if(a instanceof Object)try{c=JSON.stringify(a)}catch(d){}else"string"===typeof a?c=b?0<=b.indexOf("0")?x(a).format(b):h(new Date(a)).format(b):a:a.toString&&"function"===typeof a.toString&&(c=a.toString());return c},TRIM:function(a){return r.trim(a)},UNICHAR:function(a){return e.text.CHAR(a)},UNICODE:function(a){return e.text.CODE(a)},UPPER:function(a){return a.toUpperCase()},VALUE:function(a){return"undefined"==
typeof x?"#NAME?":x().unformat(a)}},trigonometry:{},general:{VLOOKUP:function(a,b,c,d){var f,e;typeof("object"==b)&&"Object"==b.constructor.name&&(b=n.rangeToTable(b));e=b.length;f=b[0].length;c-=1;if(c>f-1)return"#REF!";if(0>c)return"#VALUE!";if(0==("undefined"==typeof d?!1:d)){for(f=0;f<e;f++)if(a==b[f][0])return b[f][c];return"#N/A!"}d={};var g;for(f=0;f<e;f++){if(a==b[f][0])return b[f][c];g=b[f][0]-a;0>g&&(d[f]=g)}e=a=null;for(var p in d)null==a?(a=d[p],e=p):(a=a>d[p]?a:d[p],e=a>d[p]?e:p);return null==
e?"#N/A!":b[e][c]},HLOOKUP:function(a,b,c,d){typeof("object"==b)&&(b=n.rangeToTable(b));b=n.transposeTable(b);return e.general.VLOOKUP(a,b,c,d)},LOOKUP:function(a,b,c){var d,f,e=[];c="undefined"==typeof c?!1:c;typeof("object"==b)&&"Object"==b.constructor.name&&(b=n.objectToArray(b),f=b.length);typeof("object"==c)&&"Object"==c.constructor.name&&(c=n.objectToArray(c));if(a<Math.min.apply(Math,b))return"#N/A!";for(d=0;d<f;d++){if(a==b[d])return c?c[d]:b[d];e[d]=a-b[d]}a=e.length;f=Math.max.apply(Math,
e);for(d=0;d<a;d++)0>e[d]&&(e[d]=f);a=Math.min.apply(Math,e);d=e.indexOf(a);return c?c[d]:b[d]},SERVER:function(){if(null==this.config.ajaxUrl)return l.ERRKEY.ajaxUrlRequired;for(var a,b=arguments[0],c={},d=1;d<arguments.length;d++)c["params["+d+"]"]=arguments[d];c["function"]=b;r.ajax({url:this.config.ajaxUrl,method:this.config.ajaxMethod,data:c,async:!1,success:function(b){a=b},error:function(b){a=l.ERRKEY.sendRequestError}});return a},GRAPH:function(a,b){var c={},d=this.getActiveCell().el,f={};
b="undefined"==typeof b?[]:b;for(var e,g,p=0;p<b.length;p++)e=b[p].split("="),c[e[0]]=e[1];d.height()||d.css("height","300px");d.width||d.css("width","300px");switch(c.type){case "bar":g=n.rangeToTable(a);typeof("undefined"!=c.reverse)&&"true"==c.reverse&&g.reverse();f.series={bars:{show:!0,barWidth:.6,align:"center"},stack:!0};"undefined"!=typeof c.bar_orientation&&"horizontal"==c.bar_orientation&&(f.series.bars.horizontal=!0);break;case "pie":g=n.objectToArray(a);f.series={pie:{show:!0,radius:.8}};
f.legend={show:!1};break;case "doughnut":case "donut":g=n.objectToArray(a);f.series={pie:{show:!0,innerRadius:.5,radius:.8}};f.legend={show:!1};break;default:g=n.rangeToTable(a),typeof("undefined"!=c.reverse)&&"true"==c.reverse&&g.reverse()}"undefined"!=typeof c.orientation&&"vertical"==c.orientation&&(g=n.transposeTable(g));if("undefined"!=typeof c.label){e=this.evaluate(c.label);e=n.objectToArray(e);var p=g.length,m,h,l;for(h=0;h<p;h++)for(m=g[h].length,l=0;l<m;l++)a=g[h][l],g[h][l]=[e[l],a];f.xaxis=
{mode:"categories",tickLength:0}}else for(p=g.length,h=0;h<p;h++)for(m=g[h].length,l=0;l<m;l++)a=g[h][l],g[h][l]="undefined"!=typeof c.bar_orientation&&"horizontal"==c.bar_orientation?[a,l]:[l,a];if("undefined"!=typeof c.legend){e=this.evaluate(c.legend);e=n.objectToArray(e);p=[];for(m=0;m<g.length;m++)p.push({label:e[m],data:g[m]});g=p}"undefined"!=typeof c.show_x_axis&&"false"==c.show_x_axis&&(f.xaxis=f.xaxis||{},f.xaxis.show=!1);"undefined"!=typeof c.show_y_axis&&"false"==c.show_y_axis&&(f.yaxis=
f.yaxis||{},f.yaxis.show=!1);f.grid={backgroundColor:{colors:["#fff","#eee"]},borderWidth:{top:0,right:0,bottom:0,left:0}};setTimeout(function(){r.plot(d,g,f)},100);return!1}},engineering:{BIN2DEC:function(a){if(!n.isValidBinary(a))return"#NUM!";var b=parseInt(a,2);a=a.toString();return 10===a.length&&"1"===a.substring(0,1)?parseInt(a.substring(1),2)-512:b},BIN2HEX:function(a,b){if(!n.isValidBinary(a))return"#NUM!";var c=a.toString();if(10===c.length&&"1"===c.substring(0,1))return(0xfffffffe00+parseInt(c.substring(1),
2)).toString(16);c=parseInt(a,2).toString(16);if("undefined"===typeof b)return c;if(isNaN(b))return"#VALUE!";if(0>b)return"#NUM!";b=Math.floor(b);return b>=c.length?n.repeat("0",b-c.length)+c:"#NUM!"},BIN2OCT:function(a,b){if(!n.isValidBinary(a))return"#NUM!";var c=a.toString();if(10===c.length&&"1"===c.substring(0,1))return(1073741312+parseInt(c.substring(1),2)).toString(8);c=parseInt(a,2).toString(8);if("undefined"===typeof b)return c;if(isNaN(b))return"#VALUE!";if(0>b)return"#NUM!";b=Math.floor(b);
return b>=c.length?n.repeat("0",b-c.length)+c:"#NUM!"},BITAND:function(a,b){a=parseFloat(a,10);b=parseFloat(b,10);return isNaN(a)||isNaN(b)?"#VALUE!":0>a||0>b||Math.floor(a)!==a||Math.floor(b)!==b||0xffffffffffff<a||0xffffffffffff<b?"#NUM!":a&b},BITLSHIFT:function(a,b){a=parseFloat(a,10);b=parseFloat(b,10);return isNaN(a)||isNaN(b)?"#VALUE!":0>a||Math.floor(a)!==a||0xffffffffffff<a||53<Math.abs(b)?"#NUM!":0<=b?a<<b:a>>-b},BITOR:function(a,b){a=parseFloat(a,10);b=parseFloat(b,10);return isNaN(a)||
isNaN(b)?"#VALUE!":0>a||0>b||Math.floor(a)!==a||Math.floor(b)!==b||0xffffffffffff<a||0xffffffffffff<b?"#NUM!":a|b},BITRSHIFT:function(a,b){a=parseFloat(a,10);b=parseFloat(b,10);return isNaN(a)||isNaN(b)?"#VALUE!":0>a||Math.floor(a)!==a||0xffffffffffff<a||53<Math.abs(b)?"#NUM!":0<=b?a>>b:a<<-b},BITXOR:function(a,b){a=parseFloat(a,10);b=parseFloat(b,10);return isNaN(a)||isNaN(b)?"#VALUE!":0>a||0>b||Math.floor(a)!==a||Math.floor(b)!==b||0xffffffffffff<a||0xffffffffffff<b?"#NUM!":a^b},COMPLEX:function(a,
b,c){if(isNaN(a)||isNaN(b))return"#VALUE!";c="undefined"===typeof c?"i":c;return"i"!==c&&"j"!==c?"#VALUE!":0===a&&0===b?0:0===a?1===b?c:b.toString()+c:0===b?a.toString():a.toString()+(0<b?"+":"")+(1===b?c:b.toString()+c)},CONVERT:function(a,b,c){if(isNaN(a))return"#VALUE!";for(var d=[["a.u. of action","?",null,"action",!1,!1,1.05457168181818E-34],["a.u. of charge","e",null,"electric_charge",!1,!1,1.60217653141414E-19],["a.u. of energy","Eh",null,"energy",!1,!1,4.35974417757576E-18],["a.u. of length",
"a?",null,"length",!1,!1,5.29177210818182E-11],["a.u. of mass","m?",null,"mass",!1,!1,9.10938261616162E-31],["a.u. of time","?/Eh",null,"time",!1,!1,2.41888432650516E-17],["admiralty knot","admkn",null,"speed",!1,!0,.514773333],["ampere","A",null,"electric_current",!0,!1,1],["ampere per meter","A/m",null,"magnetic_field_intensity",!0,!1,1],["\u00e5ngstr\u00f6m","\u00c5",["ang"],"length",!1,!0,1E-10],["are","ar",null,"area",!1,!0,100],["astronomical unit","ua",null,"length",!1,!1,1.49597870691667E-11],
["bar","bar",null,"pressure",!1,!1,1E5],["barn","b",null,"area",!1,!1,1E-28],["becquerel","Bq",null,"radioactivity",!0,!1,1],["bit","bit",["b"],"information",!1,!0,1],["btu","BTU",["btu"],"energy",!1,!0,1055.05585262],["byte","byte",null,"information",!1,!0,8],["candela","cd",null,"luminous_intensity",!0,!1,1],["candela per square metre","cd/m?",null,"luminance",!0,!1,1],["coulomb","C",null,"electric_charge",!0,!1,1],["cubic \u00e5ngstr\u00f6m","ang3",["ang^3"],"volume",!1,!0,1E-30],["cubic foot",
"ft3",["ft^3"],"volume",!1,!0,.028316846592],["cubic inch","in3",["in^3"],"volume",!1,!0,1.6387064E-5],["cubic light-year","ly3",["ly^3"],"volume",!1,!0,8.46786664623715E-47],["cubic metre","m?",null,"volume",!0,!0,1],["cubic mile","mi3",["mi^3"],"volume",!1,!0,4.16818182544058E9],["cubic nautical mile","Nmi3",["Nmi^3"],"volume",!1,!0,6352182208],["cubic Pica","Pica3",["Picapt3","Pica^3","Picapt^3"],"volume",!1,!0,7.58660370370369E-8],["cubic yard","yd3",["yd^3"],"volume",!1,!0,.764554857984],["cup",
"cup",null,"volume",!1,!0,2.365882365E-4],["dalton","Da",["u"],"mass",!1,!1,1.66053886282828E-27],["day","d",["day"],"time",!1,!0,86400],["degree","\u00b0",null,"angle",!1,!1,.0174532925199433],["degrees Rankine","Rank",null,"temperature",!1,!0,.555555555555556],["dyne","dyn",["dy"],"force",!1,!0,1E-5],["electronvolt","eV",["ev"],"energy",!1,!0,1.60217656514141],["ell","ell",null,"length",!1,!0,1.143],["erg","erg",["e"],"energy",!1,!0,1E-7],["farad","F",null,"electric_capacitance",!0,!1,1],["fluid ounce",
"oz",null,"volume",!1,!0,2.95735295625E-5],["foot","ft",null,"length",!1,!0,.3048],["foot-pound","flb",null,"energy",!1,!0,1.3558179483314],["gal","Gal",null,"acceleration",!1,!1,.01],["gallon","gal",null,"volume",!1,!0,.003785411784],["gauss","G",["ga"],"magnetic_flux_density",!1,!0,1],["grain","grain",null,"mass",!1,!0,6.47989E-5],["gram","g",null,"mass",!1,!0,.001],["gray","Gy",null,"absorbed_dose",!0,!1,1],["gross registered ton","GRT",["regton"],"volume",!1,!0,2.8316846592],["hectare","ha",null,
"area",!1,!0,1E4],["henry","H",null,"inductance",!0,!1,1],["hertz","Hz",null,"frequency",!0,!1,1],["horsepower","HP",["h"],"power",!1,!0,745.69987158227],["horsepower-hour","HPh",["hh","hph"],"energy",!1,!0,2684519.538],["hour","h",["hr"],"time",!1,!0,3600],["imperial gallon (U.K.)","uk_gal",null,"volume",!1,!0,.00454609],["imperial hundredweight","lcwt",["uk_cwt","hweight"],"mass",!1,!0,50.802345],["imperial quart (U.K)","uk_qt",null,"volume",!1,!0,.0011365225],["imperial ton","brton",["uk_ton",
"LTON"],"mass",!1,!0,1016.046909],["inch","in",null,"length",!1,!0,.0254],["international acre","uk_acre",null,"area",!1,!0,4046.8564224],["IT calorie","cal",null,"energy",!1,!0,4.1868],["joule","J",null,"energy",!0,!0,1],["katal","kat",null,"catalytic_activity",!0,!1,1],["kelvin","K",["kel"],"temperature",!0,!0,1],["kilogram","kg",null,"mass",!0,!0,1],["knot","kn",null,"speed",!1,!0,.514444444444444],["light-year","ly",null,"length",!1,!0,9460730472580800],["litre","L",["l","lt"],"volume",!1,!0,
.001],["lumen","lm",null,"luminous_flux",!0,!1,1],["lux","lx",null,"illuminance",!0,!1,1],["maxwell","Mx",null,"magnetic_flux",!1,!1,1E-18],["measurement ton","MTON",null,"volume",!1,!0,1.13267386368],["meter per hour","m/h",["m/hr"],"speed",!1,!0,2.7777777777778E-4],["meter per second","m/s",["m/sec"],"speed",!0,!0,1],["meter per second squared","m?s??",null,"acceleration",!0,!1,1],["parsec","pc",["parsec"],"length",!1,!0,0x6da012f958ee1c],["meter squared per second","m?/s",null,"kinematic_viscosity",
!0,!1,1],["metre","m",null,"length",!0,!0,1],["miles per hour","mph",null,"speed",!1,!0,.44704],["millimetre of mercury","mmHg",null,"pressure",!1,!1,133.322],["minute","?",null,"angle",!1,!1,2.90888208665722E-4],["minute","min",["mn"],"time",!1,!0,60],["modern teaspoon","tspm",null,"volume",!1,!0,5E-6],["mole","mol",null,"amount_of_substance",!0,!1,1],["morgen","Morgen",null,"area",!1,!0,2500],["n.u. of action","?",null,"action",!1,!1,1.05457168181818E-34],["n.u. of mass","m?",null,"mass",!1,!1,
9.10938261616162E-31],["n.u. of speed","c?",null,"speed",!1,!1,299792458],["n.u. of time","?/(me?c??)",null,"time",!1,!1,1.28808866778687E-21],["nautical mile","M",["Nmi"],"length",!1,!0,1852],["newton","N",null,"force",!0,!0,1],["\u0153rsted","Oe ",null,"magnetic_field_intensity",!1,!1,79.5774715459477],["ohm","\u03a9",null,"electric_resistance",!0,!1,1],["ounce mass","ozm",null,"mass",!1,!0,.028349523125],["pascal","Pa",null,"pressure",!0,!1,1],["pascal second","Pa?s",null,"dynamic_viscosity",!0,
!1,1],["pferdest\u00e4rke","PS",null,"power",!1,!0,735.49875],["phot","ph",null,"illuminance",!1,!1,1E-4],["pica (1/6 inch)","pica",null,"length",!1,!0,3.5277777777778E-4],["pica (1/72 inch)","Pica",["Picapt"],"length",!1,!0,.00423333333333333],["poise","P",null,"dynamic_viscosity",!1,!1,.1],["pond","pond",null,"force",!1,!0,.00980665],["pound force","lbf",null,"force",!1,!0,4.4482216152605],["pound mass","lbm",null,"mass",!1,!0,.45359237],["quart","qt",null,"volume",!1,!0,9.46352946E-4],["radian",
"rad",null,"angle",!0,!1,1],["second","?",null,"angle",!1,!1,4.84813681109536E-6],["second","s",["sec"],"time",!0,!0,1],["short hundredweight","cwt",["shweight"],"mass",!1,!0,45.359237],["siemens","S",null,"electrical_conductance",!0,!1,1],["sievert","Sv",null,"equivalent_dose",!0,!1,1],["slug","sg",null,"mass",!1,!0,14.59390294],["square \u00e5ngstr\u00f6m","ang2",["ang^2"],"area",!1,!0,1E-20],["square foot","ft2",["ft^2"],"area",!1,!0,.09290304],["square inch","in2",["in^2"],"area",!1,!0,6.4516E-4],
["square light-year","ly2",["ly^2"],"area",!1,!0,8.95054210748189E31],["square meter","m?",null,"area",!0,!0,1],["square mile","mi2",["mi^2"],"area",!1,!0,2589988.110336],["square nautical mile","Nmi2",["Nmi^2"],"area",!1,!0,3429904],["square Pica","Pica2",["Picapt2","Pica^2","Picapt^2"],"area",!1,!0,1.792111111111E-5],["square yard","yd2",["yd^2"],"area",!1,!0,.83612736],["statute mile","mi",null,"length",!1,!0,1609.344],["steradian","sr",null,"solid_angle",!0,!1,1],["stilb","sb",null,"luminance",
!1,!1,1E-4],["stokes","St",null,"kinematic_viscosity",!1,!1,1E-4],["stone","stone",null,"mass",!1,!0,6.35029318],["tablespoon","tbs",null,"volume",!1,!0,1.47868E-5],["teaspoon","tsp",null,"volume",!1,!0,4.92892E-6],["tesla","T",null,"magnetic_flux_density",!0,!0,1],["thermodynamic calorie","c",null,"energy",!1,!0,4.184],["ton","ton",null,"mass",!1,!0,907.18474],["tonne","t",null,"mass",!1,!1,1E3],["U.K. pint","uk_pt",null,"volume",!1,!0,5.6826125E-4],["U.S. bushel","bushel",null,"volume",!1,!0,.03523907],
["U.S. oil barrel","barrel",null,"volume",!1,!0,.158987295],["U.S. pint","pt",["us_pt"],"volume",!1,!0,4.73176473E-4],["U.S. survey mile","survey_mi",null,"length",!1,!0,1609.347219],["U.S. survey/statute acre","us_acre",null,"area",!1,!0,4046.87261],["volt","V",null,"voltage",!0,!1,1],["watt","W",null,"power",!0,!0,1],["watt-hour","Wh",["wh"],"energy",!1,!0,3600],["weber","Wb",null,"magnetic_flux",!0,!1,1],["yard","yd",null,"length",!1,!0,.9144],["year","yr",null,"time",!1,!0,31557600]],f={Yi:["yobi",
80,1.2089258196146292E24,"Yi","yotta"],Zi:["zebi",70,1.1805916207174113E21,"Zi","zetta"],Ei:["exbi",60,0x1000000000000000,"Ei","exa"],Pi:["pebi",50,0x4000000000000,"Pi","peta"],Ti:["tebi",40,1099511627776,"Ti","tera"],Gi:["gibi",30,1073741824,"Gi","giga"],Mi:["mebi",20,1048576,"Mi","mega"],ki:["kibi",10,1024,"ki","kilo"]},e={Y:["yotta",1E24,"Y"],Z:["zetta",1E21,"Z"],E:["exa",1E18,"E"],P:["peta",1E15,"P"],T:["tera",1E12,"T"],G:["giga",1E9,"G"],M:["mega",1E6,"M"],k:["kilo",1E3,"k"],h:["hecto",100,"h"],
e:["dekao",10,"e"],d:["deci",.1,"d"],c:["centi",.01,"c"],m:["milli",.001,"m"],u:["micro",1E-6,"u"],n:["nano",1E-9,"n"],p:["pico",1E-12,"p"],f:["femto",1E-15,"f"],a:["atto",1E-18,"a"],z:["zepto",1E-21,"z"],y:["yocto",1E-24,"y"]},g=null,p=null,h=b,q=c,l=1,r=1,n,t=0;t<d.length;t++){n=null===d[t][2]?[]:d[t][2];if(d[t][1]===h||0<=n.indexOf(h))g=d[t];if(d[t][1]===q||0<=n.indexOf(q))p=d[t]}if(null===g)for(n=f[b.substring(0,2)],t=e[b.substring(0,1)],"da"===b.substring(0,2)&&(t=["dekao",10,"da"]),n?(l=n[2],
h=b.substring(2)):t&&(l=t[1],h=b.substring(t[2].length)),b=0;b<d.length;b++)if(n=null===d[b][2]?[]:d[b][2],d[b][1]===h||0<=n.indexOf(h))g=d[b];if(null===p)for(f=f[c.substring(0,2)],e=e[c.substring(0,1)],"da"===c.substring(0,2)&&(e=["dekao",10,"da"]),f?(r=f[2],q=c.substring(2)):e&&(r=e[1],q=c.substring(e[2].length)),c=0;c<d.length;c++)if(n=null===d[c][2]?[]:d[c][2],d[c][1]===q||0<=n.indexOf(q))p=d[c];return null===g||null===p||g[3]!==p[3]?"#N/A":a*g[6]*l/(p[6]*r)},DEC2BIN:function(a,b){if(isNaN(a))return"#VALUE!";
if(!/^-?[0-9]{1,3}$/.test(a)||-512>a||511<a)return"#NUM!";if(0>a)return"1"+n.repeat("0",9-(512+a).toString(2).length)+(512+a).toString(2);var c=parseInt(a,10).toString(2);if("undefined"===typeof b)return c;if(isNaN(b))return"#VALUE!";if(0>b)return"#NUM!";b=Math.floor(b);return b>=c.length?n.repeat("0",b-c.length)+c:"#NUM!"},DEC2HEX:function(a,b){if(isNaN(a))return"#VALUE!";if(!/^-?[0-9]{1,12}$/.test(a)||-549755813888>a||549755813887<a)return"#NUM!";if(0>a)return(1099511627776+a).toString(16);var c=
parseInt(a,10).toString(16);if("undefined"===typeof b)return c;if(isNaN(b))return"#VALUE!";if(0>b)return"#NUM!";b=Math.floor(b);return b>=c.length?n.repeat("0",b-c.length)+c:"#NUM!"},DEC2OCT:function(a,b){if(isNaN(a))return"#VALUE!";if(!/^-?[0-9]{1,9}$/.test(a)||-536870912>a||536870911<a)return"#NUM!";if(0>a)return(1073741824+a).toString(8);var c=parseInt(a,10).toString(8);if("undefined"===typeof b)return c;if(isNaN(b))return"#VALUE!";if(0>b)return"#NUM!";b=Math.floor(b);return b>=c.length?n.repeat("0",
b-c.length)+c:"#NUM!"},DELTA:function(a,b){b="undefined"===typeof b?0:b;return isNaN(a)||isNaN(b)?"#VALUE!":a===b?1:0},ERF:function(a,b){b="undefined"===typeof b?0:b;return isNaN(a)||isNaN(b)?"#VALUE!":g.erf(a)},ERFC:function(a){return isNaN(a)?"#VALUE!":g.erfc(a)},ERFCPRECISE:function(){},ERFPRECISE:function(){},GESTEP:function(a,b){b="undefined"===typeof b?0:b;return isNaN(a)||isNaN(b)?"#VALUE!":a>=b?1:0},HEX2BIN:function(a,b){if(!/^[0-9A-Fa-f]{1,10}$/.test(a))return"#NUM!";var c=10===a.length&&
"f"===a.substring(0,1).toLowerCase()?!0:!1,d=c?parseInt(a,16)-1099511627776:parseInt(a,16);if(-512>d||511<d)return"#NUM!";if(c)return"1"+n.repeat("0",9-(512+d).toString(2).length)+(512+d).toString(2);c=d.toString(2);if("undefined"===typeof b)return c;if(isNaN(b))return"#VALUE!";if(0>b)return"#NUM!";b=Math.floor(b);return b>=c.length?n.repeat("0",b-c.length)+c:"#NUM!"},HEX2DEC:function(a){if(!/^[0-9A-Fa-f]{1,10}$/.test(a))return"#NUM!";a=parseInt(a,16);return 549755813888<=a?a-1099511627776:a},HEX2OCT:function(a,
b){if(!/^[0-9A-Fa-f]{1,10}$/.test(a))return"#NUM!";var c=parseInt(a,16);if(536870911<c&&0xffe0000000>c)return"#NUM!";if(0xffe0000000<=c)return(c-0xffc0000000).toString(8);c=c.toString(8);if("undefined"===typeof b)return c;if(isNaN(b))return"#VALUE!";if(0>b)return"#NUM!";b=Math.floor(b);return b>=c.length?n.repeat("0",b-c.length)+c:"#NUM!"},IMABS:function(a){var b=e.engineering.IMREAL(a);a=e.engineering.IMAGINARY(a);return"#NUM!"===b||"#NUM!"===a?"#NUM!":Math.sqrt(Math.pow(b,2)+Math.pow(a,2))},IMAGINARY:function(a){if(0===
a||"0"===a)return 0;if(0<=["i","j"].indexOf(a))return 1;a=a.replace("+i","+1i").replace("-i","-1i").replace("+j","+1j").replace("-j","-1j");var b=a.indexOf("+"),c=a.indexOf("-");0===b&&(b=a.indexOf("+",1));0===c&&(c=a.indexOf("-",1));var d=a.substring(a.length-1,a.length),d="i"===d||"j"===d;return 0<=b||0<=c?d?0<=b?isNaN(a.substring(0,b))||isNaN(a.substring(b+1,a.length-1))?"#NUM!":Number(a.substring(b+1,a.length-1)):isNaN(a.substring(0,c))||isNaN(a.substring(c+1,a.length-1))?"#NUM!":-Number(a.substring(c+
1,a.length-1)):"#NUM!":d?isNaN(a.substring(0,a.length-1))?"#NUM!":a.substring(0,a.length-1):isNaN(a)?"#NUM!":0},IMARGUMENT:function(a){var b=e.engineering.IMREAL(a);a=e.engineering.IMAGINARY(a);return"#NUM!"===b||"#NUM!"===a?"#NUM!":0===b&&0===a?"#DIV/0!":0===b&&0<a?Math.PI/2:0===b&&0>a?-Math.PI/2:0===a&&0<b?0:0===a&&0>b?-Math.PI:0<b?Math.atan(a/b):0>b&&0<=a?Math.atan(a/b)+Math.PI:Math.atan(a/b)-Math.PI},IMCONJUGATE:function(a){var b=e.engineering.IMREAL(a),c=e.engineering.IMAGINARY(a),d=a.substring(a.length-
1);return"#NUM!"===b||"#NUM!"===c?"#NUM!":0!==c?e.engineering.COMPLEX(b,-c,"i"===d||"j"===d?d:"i"):a},IMCOS:function(a){if(!0===a||!1===a)return"#VALUE!";var b=e.engineering.IMREAL(a),c=e.engineering.IMAGINARY(a);a=a.substring(a.length-1);a="i"===a||"j"===a?a:"i";return"#NUM!"===b||"#NUM!"===c?"#NUM!":e.engineering.COMPLEX(Math.cos(b)*(Math.exp(c)+Math.exp(-c))/2,-Math.sin(b)*(Math.exp(c)-Math.exp(-c))/2,a)},IMCOSH:function(a){if(!0===a||!1===a)return"#VALUE!";var b=e.engineering.IMREAL(a),c=e.engineering.IMAGINARY(a);
a=a.substring(a.length-1);a="i"===a||"j"===a?a:"i";return"#NUM!"===b||"#NUM!"===c?"#NUM!":e.engineering.COMPLEX(Math.cos(c)*(Math.exp(b)+Math.exp(-b))/2,Math.sin(c)*(Math.exp(b)-Math.exp(-b))/2,a)},IMCOT:function(a){if(!0===a||!1===a)return"#VALUE!";var b=e.engineering.IMREAL(a),c=e.engineering.IMAGINARY(a);return"#NUM!"===b||"#NUM!"===c?"#NUM!":e.engineering.IMDIV(e.engineering.IMCOS(a),e.engineering.IMSIN(a))},IMCSC:function(a){if(!0===a||!1===a)return"#VALUE!";var b=e.engineering.IMREAL(a),c=e.engineering.IMAGINARY(a);
return"#NUM!"===b||"#NUM!"===c?"#NUM!":e.engineering.IMDIV("1",e.engineering.IMSIN(a))},IMCSCH:function(a){if(!0===a||!1===a)return"#VALUE!";var b=e.engineering.IMREAL(a),c=e.engineering.IMAGINARY(a);return"#NUM!"===b||"#NUM!"===c?"#NUM!":e.engineering.IMDIV("1",e.engineering.IMSINH(a))},IMDIV:function(a,b){var c=e.engineering.IMREAL(a),d=e.engineering.IMAGINARY(a),f=e.engineering.IMREAL(b),k=e.engineering.IMAGINARY(b),g=a.substring(a.length-1),p=a.substring(a.length-1),h="i";"j"===g?h="j":"j"===
p&&(h="j");if("#NUM!"===c||"#NUM!"===d||"#NUM!"===f||"#NUM!"===k||0===f&&0===k)return"#NUM!";g=f*f+k*k;return e.engineering.COMPLEX((c*f+d*k)/g,(d*f-c*k)/g,h)},IMEXP:function(a){var b=e.engineering.IMREAL(a),c=e.engineering.IMAGINARY(a);a=a.substring(a.length-1);a="i"===a||"j"===a?a:"i";if("#NUM!"===b||"#NUM!"===c)return"#NUM!";b=Math.exp(b);return e.engineering.COMPLEX(b*Math.cos(c),b*Math.sin(c),a)},IMLN:function(a){var b=e.engineering.IMREAL(a),c=e.engineering.IMAGINARY(a);a=a.substring(a.length-
1);a="i"===a||"j"===a?a:"i";return"#NUM!"===b||"#NUM!"===c?"#NUM!":e.engineering.COMPLEX(Math.log(Math.sqrt(b*b+c*c)),Math.atan(c/b),a)},IMLOG10:function(a){var b=e.engineering.IMREAL(a),c=e.engineering.IMAGINARY(a);a=a.substring(a.length-1);a="i"===a||"j"===a?a:"i";return"#NUM!"===b||"#NUM!"===c?"#NUM!":e.engineering.COMPLEX(Math.log(Math.sqrt(b*b+c*c))/Math.log(10),Math.atan(c/b)/Math.log(10),a)},IMLOG2:function(a){var b=e.engineering.IMREAL(a),c=e.engineering.IMAGINARY(a);a=a.substring(a.length-
1);a="i"===a||"j"===a?a:"i";return"#NUM!"===b||"#NUM!"===c?"#NUM!":e.engineering.COMPLEX(Math.log(Math.sqrt(b*b+c*c))/Math.log(2),Math.atan(c/b)/Math.log(2),a)},IMPOWER:function(a,b){if(isNaN(b))return"#VALUE!";var c=e.engineering.IMREAL(a),d=e.engineering.IMAGINARY(a),f=a.substring(a.length-1),f="i"===f||"j"===f?f:"i";if("#NUM!"===c||"#NUM!"===d)return"#NUM!";c=Math.pow(e.engineering.IMABS(a),b);d=e.engineering.IMARGUMENT(a);return e.engineering.COMPLEX(c*Math.cos(b*d),c*Math.sin(b*d),f)},IMPRODUCT:function(){for(var a=
arguments[0],b=1;b<arguments.length;b++){var c=e.engineering.IMREAL(a),a=e.engineering.IMAGINARY(a),d=e.engineering.IMREAL(arguments[b]),f=e.engineering.IMAGINARY(arguments[b]);if("#NUM!"===c||"#NUM!"===a||"#NUM!"===d||"#NUM!"===f)return"#NUM!";a=e.engineering.COMPLEX(c*d-a*f,c*f+a*d)}return a},IMREAL:function(a){if(0===a||"0"===a||0<="i +i 1i +1i -i -1i j +j 1j +1j -j -1j".split(" ").indexOf(a))return 0;var b=a.indexOf("+"),c=a.indexOf("-");0===b&&(b=a.indexOf("+",1));0===c&&(c=a.indexOf("-",1));
var d=a.substring(a.length-1,a.length),d="i"===d||"j"===d;return 0<=b||0<=c?d?0<=b?isNaN(a.substring(0,b))||isNaN(a.substring(b+1,a.length-1))?"#NUM!":Number(a.substring(0,b)):isNaN(a.substring(0,c))||isNaN(a.substring(c+1,a.length-1))?"#NUM!":Number(a.substring(0,c)):"#NUM!":d?isNaN(a.substring(0,a.length-1))?"#NUM!":0:isNaN(a)?"#NUM!":a},IMSEC:function(a){if(!0===a||!1===a)return"#VALUE!";var b=e.engineering.IMREAL(a),c=e.engineering.IMAGINARY(a);return"#NUM!"===b||"#NUM!"===c?"#NUM!":e.engineering.IMDIV("1",
e.engineering.IMCOS(a))},IMSECH:function(a){if(!0===a||!1===a)return"#VALUE!";var b=e.engineering.IMREAL(a),c=e.engineering.IMAGINARY(a);return"#NUM!"===b||"#NUM!"===c?"#NUM!":e.engineering.IMDIV("1",e.engineering.IMCOSH(a))},IMSIN:function(a){if(!0===a||!1===a)return"#VALUE!";var b=e.engineering.IMREAL(a),c=e.engineering.IMAGINARY(a);a=a.substring(a.length-1);a="i"===a||"j"===a?a:"i";return"#NUM!"===b||"#NUM!"===c?"#NUM!":e.engineering.COMPLEX(Math.sin(b)*(Math.exp(c)+Math.exp(-c))/2,Math.cos(b)*
(Math.exp(c)-Math.exp(-c))/2,a)},IMSINH:function(a){if(!0===a||!1===a)return"#VALUE!";var b=e.engineering.IMREAL(a),c=e.engineering.IMAGINARY(a);a=a.substring(a.length-1);a="i"===a||"j"===a?a:"i";return"#NUM!"===b||"#NUM!"===c?"#NUM!":e.engineering.COMPLEX(Math.cos(c)*(Math.exp(b)-Math.exp(-b))/2,Math.sin(c)*(Math.exp(b)+Math.exp(-b))/2,a)},IMSQRT:function(a){var b=e.engineering.IMREAL(a),c=e.engineering.IMAGINARY(a),d=a.substring(a.length-1),d="i"===d||"j"===d?d:"i";if("#NUM!"===b||"#NUM!"===c)return"#NUM!";
b=Math.sqrt(e.engineering.IMABS(a));a=e.engineering.IMARGUMENT(a);return e.engineering.COMPLEX(b*Math.cos(a/2),b*Math.sin(a/2),d)},IMSUB:function(a,b){var c=e.engineering.IMREAL(a),d=e.engineering.IMAGINARY(a),f=e.engineering.IMREAL(b),k=e.engineering.IMAGINARY(b),g=a.substring(a.length-1),p=a.substring(a.length-1),h="i";"j"===g?h="j":"j"===p&&(h="j");return"#NUM!"===c||"#NUM!"===d||"#NUM!"===f||"#NUM!"===k?"#NUM!":e.engineering.COMPLEX(c-f,d-k,h)},IMSUM:function(){for(var a=arguments[0],b=1;b<arguments.length;b++){var c=
e.engineering.IMREAL(a),a=e.engineering.IMAGINARY(a),d=e.engineering.IMREAL(arguments[b]),f=e.engineering.IMAGINARY(arguments[b]);if("#NUM!"===c||"#NUM!"===a||"#NUM!"===d||"#NUM!"===f)return"#NUM!";a=e.engineering.COMPLEX(c+d,a+f)}return a},IMTAN:function(a){if(!0===a||!1===a)return"#VALUE!";var b=e.engineering.IMREAL(a),c=e.engineering.IMAGINARY(a);return"#NUM!"===b||"#NUM!"===c?"#NUM!":e.engineering.IMDIV(e.engineering.IMSIN(a),e.engineering.IMCOS(a))},OCT2BIN:function(a,b){if(!/^[0-7]{1,10}$/.test(a))return"#NUM!";
var c=10===a.length&&"7"===a.substring(0,1)?!0:!1,d=c?parseInt(a,8)-1073741824:parseInt(a,8);if(-512>d||511<d)return"#NUM!";if(c)return"1"+n.repeat("0",9-(512+d).toString(2).length)+(512+d).toString(2);c=d.toString(2);if("undefined"===typeof b)return c;if(isNaN(b))return"#VALUE!";if(0>b)return"#NUM!";b=Math.floor(b);return b>=c.length?n.repeat("0",b-c.length)+c:"#NUM!"},OCT2DEC:function(a){if(!/^[0-7]{1,10}$/.test(a))return"#NUM!";a=parseInt(a,8);return 536870912<=a?a-1073741824:a},OCT2HEX:function(a,
b){if(!/^[0-7]{1,10}$/.test(a))return"#NUM!";var c=parseInt(a,8);if(536870912<=c)return"ff"+(c+3221225472).toString(16);c=c.toString(16);if("undefined"===typeof b)return c;if(isNaN(b))return"#VALUE!";if(0>b)return"#NUM!";b=Math.floor(b);return b>=c.length?n.repeat("0",b-c.length)+c:"#NUM!"}},user_defined:{}},n={toChr:function(a){var b="";for(a-=1;0<=a;)b=String.fromCharCode(a%26+97)+b,a=Math.floor(a/26)-1;return b.toUpperCase()},toNum:function(a){a=a.split("");var b="ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),
c,d,f=0;c=0;for(d=a.length-1;c<a.length;c+=1,d-=1)f+=Math.pow(b.length,d)*(b.indexOf(a[c])+1);return f},cellRange:function(a,b){var c=/[A-Z]+/,d=/[0-9]+/,f=a.toUpperCase(),e=b.toUpperCase(),g=this.toNum(f.match(c)[0]),c=this.toNum(e.match(c)[0]),f=parseInt(f.match(d)[0],10),d=parseInt(e.match(d)[0],10),e=[],h,m;if(g<c)for(m=g;m<=c;m++)if(f<d)for(h=f;h<=d;h++)g=this.toChr(m)+h,e.push(g);else for(h=f;h>=d;h--)g=this.toChr(m)+h,e.push(g);else for(m=g;m>=c;m--)if(f<d)for(h=f;h<=d;h++)g=this.toChr(m)+
h,e.push(g);else for(h=f;h>=d;h--)g=this.toChr(m)+h,e.push(g);return e},isValidBinary:function(a){return/^[01]{1,10}$/.test(a)},strRepeat:function(a,b){if(1>b)return"";for(var c="";0<b;)b&1&&(c+=a),b>>=1,a+=a;return c},repeat:function(a,b,c){if(null==a)return"";b=~~b;if(null==c)return this.strRepeat(String(a),b);for(var d=[];0<b;d[--b]=a);return d.join(c)},unique:function(a){return a.reduce(function(a,c){0>a.indexOf(c)&&a.push(c);return a},[])},initial:function(a,b,c){return Array.prototype.slice.call(a,
0,Math.max(0,a.length-(null==b||c?1:b)))},rest:function(a,b,c){return Array.prototype.slice.call(a,null==b||c?1:b)},arrayMerge:function(a){var b,c,d=[];for(c=0;c<a.length;c++)if("object"==typeof a[c])for(b in a[c])""!==r.trim(a[c][b])&&(d=d.concat(a[c][b]));else""!==r.trim(d.concat(a[c]))&&(d=d.concat(a[c]));return d},toArray:function(a){return Array.prototype.slice.call(a,0)},objectToArray:function(a){var b=[],c;for(c in a)b.push(a[c]);return b},trimEmptyCell:function(a){var b={},c;for(c in a)""!==
r.trim(a[c])&&(b[c]=a[c]);return b},cleanFloat:function(a){var b=Math.pow(10,14);return Math.round(a*b)/b},countIn:function(a,b){for(var c=0,d=0;d<a.length;d++)a[d]===b&&c++;return c},rangeToTable:function(a){var b,c,d=0,f=/[A-Z]+/,e=/[0-9]+/,g=[],h=[];for(b in a)c=this.toNum(b.match(f)[0])-1,d=parseInt(b.match(e)[0],10)-1,"undefined"==typeof g[d]&&(g[d]=[]),g[d][c]=a[b];a=0;b=g.length;for(d=0;d<b;d++)if("undefined"!=typeof g[d]){f=g[d].length;"undefined"==typeof h[a]&&(h[a]=[]);for(c=0;c<f;c++)"undefined"!=
typeof g[d][c]&&h[a].push(g[d][c]);a++}return h},transposeTable:function(a){var b,c,d,f,e;d=a.length;e=[];for(b=0;b<d;b++)for(f=a[b].length,c=0;c<f;c++)"undefined"==typeof e[c]&&(e[c]=[]),e[c].push(a[b][c]);return e}},l={MEMOIZED_FACT:[],SQRT2PI:2.5066282746310002,WEEK_STARTS:[void 0,0,1,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,1,2,3,4,5,6,0],WEEK_TYPES:[[],[1,2,3,4,5,6,7],[7,1,2,3,4,5,6],[6,0,1,2,3,4,5],[],[],[],[],[],[],[],[7,1,2,3,4,5,6],[6,7,1,2,3,4,5],[5,6,7,1,2,3,4],[4,
5,6,7,1,2,3],[3,4,5,6,7,1,2],[2,3,4,5,6,7,1],[1,2,3,4,5,6,7]],WEEKEND_TYPES:[[],[6,0],[0,1],[1,2],[2,3],[3,4],[4,5],[5,6],void 0,void 0,void 0,[0],[1],[2],[3],[4],[5],[6]],DAY_NAME:"Sunday Monday Thuesday Wednesday Thursday Friday Saturday".split(" "),ERROR:"#DIV/0! #N/A #NAME? #NUM! #NULL! #REF! #VALUE! #ERROR! #ERROR_MOMENT_JS_REQUIRED! #ERROR_JSTAT_JS_REQUIRED! #ERROR_AJAX_URL_REQUIRED! #ERROR_SEND_REQUEST! #UNDEFINED_VARIABLE!".split(" "),ERRKEY:{jStatRequired:"#ERROR_JSTAT_JS_REQUIRED!",momentRequired:"#ERROR_MOMENT_JS_REQUIRED!",
ajaxUrlRequired:"#ERROR_AJAX_URL_REQUIRED!",sendRequestError:"#ERROR_SEND_REQUEST!"},VARIABLE:{},SELF_RENDER_FORMULA:["GRAPH"]};u.fx=u.prototype;u.fx.init=function(){"undefined"!=typeof this.options.element?this.el=r(this.options.element):(this.el=!1,this.address="undefined"!=typeof this.options.address?this.options.address:"");var a=this.el&&this.el.attr("data-cell")?this.el.attr("data-cell"):this.options.address,b=this.el&&this.el.attr("data-formula")?this.el.attr("data-formula"):this.options.formula,
c=this.el&&this.el.attr("data-format")?this.el.attr("data-format"):this.options.format,d=this.el&&this.el.val()?this.el.val():this.options.value,f=this.el&&this.el.attr("data-formatter")?window[this.el.attr("data-formatter")]:this.options.formatter,e=this.el&&this.el.attr("data-unformatter")?window[this.el.attr("data-unformatter")]:this.options.unformatter,g=this.el&&this.el.attr("data-style-formatter")?window[this.el.attr("data-style-formatter")]:this.options.styleFormatter,h=this.el?this.el.prop("tagName").toLowerCase():
"";a&&""!=r.trim(a)?a=a.toUpperCase():(a="CALX"+this.sheet.counter,this.el&&this.el.attr("data-cell",a),this.sheet.counter++);b=b&&""!=r.trim(b)?b.replace(""",'"').replace("'","'").replace(""",'"'):!1;"input"!=h||"checkbox"!=this.el.attr("type")&&"radio"!=this.el.attr("type")||(d=this.el.attr("data-unchecked"),d="undefined"==typeof d?"":d,d=this.el.prop("checked")?this.el.val():d,this.isCheckbox=!0);this.el&&-1==this.formTags.indexOf(h)&&(d=this.el.text());if(!1===c||"undefined"===typeof c)c=
this.sheet.config.defaultFormat;this.formula=b;this.format=c;this.address=a;this.formatter=f;this.unformatter=e;this.styleFormatter=this.conditionalStyle=g;c&&"undefined"!=typeof x&&""!==r.trim(d)?(a=x().unformat(d),-1<c.indexOf("%")&&-1==d.indexOf("%")&&(a/=100)):a=this.unformatter?this.unformatter(d,c):r.isNumeric(d)?parseFloat(d):d;this.setValue(a);""!=r.trim(d)&&r.isNumeric(d)&&this.renderComputedValue()};u.fx.calculate=function(a,b){a="undefined"==typeof a?!0:a;b="undefined"==typeof b?!0:b;this.sheet.clearAffectedCell();
this.sheet.config.autoCalculate&&a&&"function"==typeof this.sheet.config.onBeforeCalculate&&this.sheet.config.onBeforeCalculate.call(this.sheet);t.isCalculating=!0;this.evaluateFormula();for(var c in this.dependant)this.dependant[c].processDependant();for(c in this.sheet.dependant)this.sheet.dependant[c].calculate(!1,!1);t.isCalculating=!1;if(this.sheet.hasRelatedSheet())for(c in this.sheet.cells)this.sheet.cells[c].hasRemoteDependency()&&(this.sheet.cells[c].evaluateFormula(),this.sheet.cells[c].processDependant(),
this.sheet.cells[c].renderComputedValue());this.sheet.config.autoCalculate&&a&&"function"==typeof this.sheet.config.onAfterCalculate&&this.sheet.config.onAfterCalculate.call(this.sheet);this.sheet.config.autoCalculate&&a&&"function"==typeof this.sheet.config.onBeforeRender&&this.sheet.config.onBeforeRender.call(this.sheet);b&&this.renderComputedValue();this.sheet.config.autoCalculate&&a&&"function"==typeof this.sheet.config.onAfterRender&&this.sheet.config.onAfterRender.call(this.sheet);return this};
u.fx.buildDependency=function(){var a={remoteColumnRange:/\#[A-Za-z0-9_]+\s*!\s*[A-Za-z]+\s*:\s*[A-Za-z]+/g,remoteRowRange:/\#[A-Za-z0-9_]+\s*!\s*[0-9]+\s*:\s*[0-9]+/g,remoteCellRange:/\#[A-Za-z0-9_]+\s*!\s*[A-Za-z]+[0-9]+\s*:\s*[A-Za-z]+[0-9]+/g,remoteCell:/\#[A-Za-z0-9_]+\s*!\s*[A-Za-z]+[0-9]+/g,columnRange:/[A-Za-z]+\s*:\s*[A-Za-z]+/g,rowRange:/[0-9]+\s*:\s*[0-9]+/g,cellRange:/[A-Za-z]+[0-9]+\s*:\s*[A-Za-z]+[0-9]+/g,cell:/[A-Z]+[0-9]+/g},b=this.formula,c="#"+this.sheet.el.attr("id"),d=this.address,
f,e,g,h,m,l,n;for(e in this.dependencies)0>e.indexOf("#")?this.dependencies[e].removeDependant(d):this.dependencies[e].removeDependant(c+"!"+d),delete this.dependencies[e];if(b)for(e in a)if(m=b.match(a[e]),b=b.replace(a[e],""),null!==m)switch(e){case "remoteCellRange":for(d=0;d<m.length;d++){f=m[d].split("!");l=r.trim(f[0]);h=f[1].split(":");f=r.trim(h[0]);h=r.trim(h[1]);f=this.sheet.getRemoteCellRange(l,f,h);n=r(l).attr("data-calx-identifier");if("undefined"==typeof n||"undefined"==typeof t.sheetRegistry[n])r(l).calx(),
n=r(l).attr("data-calx-identifier");"undefined"!=typeof n&&"undefined"!=typeof t.sheetRegistry[n]&&(t.sheetRegistry[n].registerDependant(this.sheet),this.sheet.registerDependency(t.sheetRegistry[n]));for(g in f)h=l+"!"+g,"undefined"==typeof this.dependencies[h]&&!1!==f[g]&&(this.hasRemoteDependency(!0),this.dependencies[h]=f[g],f[g].registerDependant(c+"!"+this.getAddress(),this))}break;case "remoteCell":for(d=0;d<m.length;d++)f=m[d].split("!"),l=r.trim(f[0]),h=r.trim(f[1]),f=this.sheet.getRemoteCell(l,
h),n=r(l).attr("data-calx-identifier"),"undefined"!=typeof n&&"undefined"!=typeof t.sheetRegistry[n]||r(l).calx(),"undefined"!=typeof n&&"undefined"!=typeof t.sheetRegistry[n]&&(t.sheetRegistry[n].registerDependant(this.sheet),this.sheet.registerDependency(t.sheetRegistry[n])),h=l+"!"+h,"undefined"==typeof this.dependencies[h]&&!1!==f&&(this.hasRemoteDependency(!0),this.dependencies[h]=f,f.registerDependant(c+"!"+this.getAddress(),this));break;case "cellRange":for(d=0;d<m.length;d++)for(g in h=m[d].split(":"),
f=r.trim(h[0]),h=r.trim(h[1]),f=this.sheet.getCellRange(f,h),f)"undefined"==typeof this.dependencies[g]&&!1!==f[g]&&(this.dependencies[g]=f[g],f[g].registerDependant(this.getAddress(),this));break;case "cell":for(d=0;d<m.length;d++)h=m[d],f=this.sheet.getCell(h),"undefined"==typeof this.dependencies[h]&&!1!==f&&(this.dependencies[h]=f,f.registerDependant(this.getAddress(),this))}return this};u.fx.removeDependency=function(a){"undefined"!=typeof this.dependencies[a]&&delete this.dependencies[a]};u.fx.processDependency=
function(){if(0==this.isProcessed()){for(var a in this.dependencies)0==this.dependencies[a].isProcessed()&&this.dependencies[a].processDependency();this.evaluateFormula();this.setProcessed(!0);-1==this.sheet.affectedCell.indexOf(this.address)&&this.sheet.affectedCell.push(this.address)}};u.fx.registerDependant=function(a,b){"undefined"==typeof this.dependant[a]&&b&&(this.dependant[a]=b)};u.fx.removeDependant=function(a){"undefined"!=typeof this.dependant[a]&&delete this.dependant[a]};u.fx.processDependant=
function(){var a;if(!1===this.isProcessed()||!0===t.isCalculating){this.processDependency();for(var b in this.dependant)if(!this.dependant[b].isProcessed()&&(a=this.dependant[b].processDependant(),!1===a))return a;this.setAffected(!1);this.setProcessed(!0);-1==this.sheet.affectedCell.indexOf(this.address)&&this.sheet.affectedCell.push(this.address)}else return!1};u.fx.hasRemoteDependency=function(a){if("undefined"==typeof a)return this.remoteDependency;this.remoteDependency=a};u.fx.renderComputedValue=
function(){if(this.formula&&"graph"==this.formula.substring(0,5).toLowerCase())return this;if(!1!==this.el){var a=this.el.prop("tagName").toLowerCase(),b=-1<this.formTags.indexOf(a),c=this.formula?this.computedValue:this.value,d=this.getFormattedValue();b?this.isCheckbox?this.el.prop("checked",c==this.el.val()):"select"==a?this.el.val(c):"input"!=a&&"textarea"!=a||this.el.val(d):this.el.html(d)}"function"==typeof this.conditionalStyle&&(a=this.conditionalStyle.apply(null,[this.getValue(),this.el]),
"object"==typeof a&&this.el.css(a));"function"==typeof this.styleFormatter&&(a=this.styleFormatter.apply(null,[this.getValue(),this.el]),"object"==typeof a&&this.el.css(a));return this};u.fx.resyncValue=function(){if(!1!==this.el){var a=this.el.prop("tagName").toLowerCase(),a=-1<this.formTags.indexOf(a)?this.el.val():this.el.text();this.isCheckbox&&!this.el.prop("checked")&&(a=this.el.attr("data-unchecked-value")||"");if(this.format&&"undefined"!=typeof x&&""!==r.trim(a)){var b=x().unformat(a);-1<
this.format.indexOf("%")&&-1==a.indexOf("%")&&(b/=100)}else b=this.unformatter?this.unformatter(a,this.format):r.isNumeric(a)?parseFloat(a):a;this.setValue(b)}};u.fx.resyncFormula=function(){if(this.el&&this.el.attr("data-formula")!=this.formula){var a=this.el.attr("data-formula");this.setFormula(a)}};u.fx.checkCircularReference=function(a){var b,c=!1;"undefined"==typeof a&&(a=this.getAddress());if(!1!==this.formula){for(b in this.dependencies)if(c=c||b==a)return!0;for(b in this.dependencies)if(c=
c||this.dependencies[b].checkCircularReference(a))return!0}return c};u.fx.evaluateFormula=function(){if(this.formula)try{return this.sheet.setActiveCell(this),this.computedValue=this.sheet.evaluate(this.formula)}catch(a){this.computedValue="#ERROR!"}return!1};u.fx.formTags=["input","select","textarea","button"];u.fx.setConditionalStyle=function(a){"function"==typeof a&&(this.styleFormatter=this.conditionalStyle=a)};u.fx.setStyleFormatter=u.fx.setConditionalStyle;u.fx.setFormat=function(a){this.format=
a;!1!==this.el&&(this.el.attr("data-format",a),this.renderComputedValue());-1==this.sheet.affectedCell.indexOf(this.address)&&this.sheet.affectedCell.push(this.address);return this};u.fx.setFormatter=function(a){this.formatter=a};u.fx.setUnformatter=function(a){this.unformatter=a};u.fx.getFormat=function(){return this.format};u.fx.getFormatter=function(){return this.formatter};u.fx.getUnformatter=function(){return this.unformatter};u.fx.setFormula=function(a){if("string"!==typeof a)return!1;this.formula=
a;!1!==this.el&&this.el.attr("data-formula",a);this.buildDependency();-1==this.sheet.affectedCell.indexOf(this.address)&&this.sheet.affectedCell.push(this.address);return this};u.fx.getFormula=function(){return this.formula};u.fx.getAddress=function(){return this.address};u.fx.getFormattedValue=function(){var a=this.formula?this.computedValue:this.value;return this.formatter?this.formatter(a,this.format):""!=this.format&&"undefined"!=typeof x&&""!==a&&!1!==a&&null!==a&&-1==l.ERROR.indexOf(a)&&r.isNumeric(a)?
x(a).format(this.format):a};u.fx.setValue=function(a){this.value=a;-1==this.sheet.affectedCell.indexOf(this.address)&&this.sheet.affectedCell.push(this.address);return this};u.fx.getValue=function(){return this.formula?this.computedValue:this.value};u.fx.setAffected=function(a){this.affected="undefined"==typeof a?!0:a;return this};u.fx.isAffected=function(){return this.affected};u.fx.setProcessed=function(a){this.processed="undefined"==typeof a?!0:a;return this};u.fx.isProcessed=function(){return this.processed};
u.fx.highlightDependant=function(){for(var a in this.dependant)this.dependant[a].el&&this.dependant[a].el.css("border","solid 1px blue")};u.fx.highlightDependency=function(){for(var a in this.dependencies)this.dependencies[a].el&&this.dependencies[a].el.css("border","solid 1px red")};v.fx=v.prototype;v.fx.init=function(){var a=this.el.find("[data-cell],[data-formula],[data-format]"),b=this,c;defaultCellOptions=this.defaultCellOptions;this.totalCell=a.length;this.parser=F(this);this.el.attr("data-calx-identifier",
this.identifier);a.each(function(){var a=r(this).attr("data-cell"),a=r.extend({element:this,address:a},defaultCellOptions,b.config.data[a]);c=new u(b,a);b.registerCell(c)});for(var d in this.config.data)"undefined"==typeof this.cells[d]&&(a=r.extend({address:d},defaultCellOptions,b.config.data[d]),c=new u(b,a),b.registerCell(c));b.attachEvent()};v.fx.checkCircularReference=function(){var a,b={isCircular:!1,cell:null};for(a in this.cells)if(b.isCircular=this.cells[a].checkCircularReference(),!0===
b.isCircular){b.cell=this.cells[a];break}return b};v.fx.clearProcessedFlag=function(){for(var a in this.cells)!1!==this.cells[a].formula?(this.cells[a].setProcessed(!1),this.cells[a].setAffected(!0)):(this.cells[a].setProcessed(!0),this.cells[a].setAffected(!1))};v.fx.buildCellDependency=function(){for(var a in this.cells)this.cells[a].buildDependency()};v.fx.renderComputedValue=function(){for(var a=0;a<this.affectedCell.length;a++)this.cells[this.affectedCell[a]].renderComputedValue();this.clearAffectedCell()};
v.fx.clearAffectedCell=function(){this.affectedCell=[]};v.fx.hasRelatedSheet=function(){return this.relatedSheet};v.fx.clearCalculatedFlag=function(){for(var a in this.dependant)this.dependant[a].setCalculated(!1);for(a in this.dependencies)this.dependencies[a].setCalculated(!1)};v.fx.isCalculated=function(){return this.calculated};v.fx.setCalculated=function(a){this.calculated="undefined"==typeof a?!0:a};v.fx.clearDependencies=function(){};v.fx.registerDependant=function(a){this.relatedSheet=!0;
"undefined"==typeof this.dependant[a.identifier]&&(this.dependant[a.identifier]=a)};v.fx.registerDependency=function(a){this.relatedSheet=!0;"undefined"==typeof this.dependencies[a.identifier]&&(this.dependencies[a.identifier]=a)};v.fx.obj={type:"cell"};v.fx.defaultCellOptions={element:void 0,address:"",formatter:void 0,unformatter:void 0,styleFormatter:void 0,format:!1,formula:!1,value:null};v.fx.comparator={greater:function(a,b){return a>b},greaterEqual:function(a,b){return a>=b},less:function(a,
b){return a<b},lessEqual:function(a,b){return a<=b},equal:function(a,b){return a==b},notEqual:function(a,b){return a!=b}};v.fx.getVariable=function(a){a=a[0];var b=a.toUpperCase();return"TRUE"==b?!0:"FALSE"==b?!1:"NULL"==b?null:"undefined"==typeof this.variables[a]?"undefined"==typeof l.VARIABLE[a]?"#UNDEFINED_VARIABLE!":"function"==typeof l.VARIABLE[a]?l.VARIABLE[a].call(this):l.VARIABLE[a]:"function"==typeof this.variables[a]?this.variables[a].call(this):this.variables[a]};v.fx.time=function(a){var b=
a.split(":");a=new Date;var c="undefined"==typeof b[0]?0:b[0],d="undefined"==typeof b[1]?0:b[1],b="undefined"==typeof b[2]?0:b[2];return new Date(a.getFullYear(),a.getMonth(),a.getDate(),c,d,b)};v.fx.callFunction=function(a,b){var c,d;d=a.toUpperCase();if("function"==typeof e[d])return e[d].apply(this,b);for(c in e)if("function"==typeof e[c][d])return e[c][d].apply(this,b);return"#NAME?"};v.fx.getRemoteCell=function(a,b){var c=r(a).attr("data-calx-identifier");return c&&"undefined"!=typeof t.sheetRegistry[c]?
t.sheetRegistry[c].getCell(b):!1};v.fx.getRemoteCellRange=function(a,b,c){return(a=r(a).attr("data-calx-identifier"))&&"undefined"!=typeof t.sheetRegistry[a]?t.sheetRegistry[a].getCellRange(b,c):!1};v.fx.getRemoteCellValue=function(a,b){var c=r(a).attr("data-calx-identifier");return c&&"undefined"!=typeof t.sheetRegistry[c]?t.sheetRegistry[c].getCellValue(b):!1};v.fx.getRemoteCellRangeValue=function(a,b,c){return(a=r(a).attr("data-calx-identifier"))&&"undefined"!=typeof t.sheetRegistry[a]?t.sheetRegistry[a].getCellRangeValue(b,
c):!1};v.fx.getCellRangeValue=function(a,b){a=a.toUpperCase();b=b.toUpperCase();var c=n.cellRange(a,b),d=c.length,f={},e;for(e=0;e<d;e++)f[c[e]]=this.getCellValue(c[e]);return f};v.fx.getCellValue=function(a){a=a.toUpperCase();return"undefined"==typeof this.cells[a]?!1:this.cells[a].getValue()};v.fx.evaluate=function(a){return this.parser.parse(a)};v.fx.update=function(){var a=this.el.find("[data-cell],[data-formula],[data-format]"),b=this,c;this.totalCell=a.length;for(var d in this.cells)this.cells[d].el&&
!r.contains(document,this.cells[d].el[0])&&delete this.cells[d];a.each(function(){var a=r(this).attr("data-cell");a&&"undefined"==typeof b.cells[a]?(a=r.extend({element:this,address:a},defaultCellOptions,b.config.data[a]),c=new u(b,a),b.registerCell(c)):(b.cells[a].resyncValue(),b.cells[a].resyncFormula())});this.buildCellDependency()};v.fx.calculate=function(){this.clearAffectedCell();"function"==typeof this.config.onBeforeCalculate&&this.config.onBeforeCalculate.call(this);var a;this.calculateDependency(this.identifier);
this.clearProcessedFlag();for(a in this.cells)this.cells[a].processDependency();this.setCalculated();for(a in this.cells)this.cells[a].hasRemoteDependency()&&this.cells[a].evaluateFormula();this.calculateDependant(this.identifier);"function"==typeof this.config.onAfterCalculate&&this.config.onAfterCalculate.call(this);"function"==typeof this.config.onBeforeRender&&this.config.onBeforeRender.call(this);this.renderComputedValue();"function"==typeof this.config.onAfterRender&&this.config.onAfterRender.call(this);
return this};v.fx.calculateDependant=function(a){};v.fx.calculateDependency=function(a){};v.fx.registerCell=function(a){var b=a.getAddress();this.cells[b]=a;-1==this.affectedCell.indexOf(a.getAddress())&&this.affectedCell.push(a.getAddress())};v.fx.registerVariable=function(a,b){if("object"==typeof a)for(var c in a)this.variables[c]=a[c];else this.variables[a]=b};v.fx.getCell=function(a){a=a.toUpperCase();return"undefined"!=typeof this.cells[a]?this.cells[a]:!1};v.fx.getCellRange=function(a,b){a=
a.toUpperCase();b=b.toUpperCase();var c=n.cellRange(a,b),d=c.length,f={},e;for(e=0;e<d;e++)f[c[e]]=this.getCell(c[e]);return f};v.fx.applyChange=function(){for(var a in this.cells)this.cells[a].processDependency(!1,!1);for(a in this.cells)this.cells[a].renderComputedValue();return this};v.fx.scan=function(){};v.fx.refresh=function(){var a=this.el.find("[data-cell],[data-formula],[data-format]"),b=this,c,d=this.defaultCellOptions;this.totalCell=a.length;this.cells={};a.each(function(){var a=r(this).attr("data-cell"),
a=r.extend({element:this,address:a},d,b.config.data[a]);c=new u(b,a);b.registerCell(c)});this.buildCellDependency()};v.fx.reset=function(){("form"==this.el.prop("tagName").toLowerCase()?this.el:this.el.find("form")).each(function(){this.reset()});for(var a in this.cells)this.cells[a].resyncValue();this.calculate()};v.fx.setActiveCell=function(a){this.activeCell=a};v.fx.getActiveCell=function(){return this.activeCell};v.fx.attachEvent=function(){var a=this;this.el.on("calx.getValue","input[data-cell]",
function(){var b=r(this).attr("data-cell"),b=a.cells[b],c=b.getValue(),d=b.getFormat();d&&0<=d.indexOf("%")&&(c=100*c+" %");b.isCheckbox||b.el.val(c)});this.el.on("calx.renderComputedValue","input[data-cell]",function(){var b=r(this).attr("data-cell");a.cells[b].renderComputedValue()});this.el.on("calx.setValue","input[data-cell], select[data-cell]",function(){var b=r(this).attr("data-cell"),b=a.cells[b],c=b.getValue(),d=b.el.val(),e=b.getFormat();b.isCheckbox&&"checkbox"==b.el.attr("type")?b.el.prop("checked")?
b.setValue(d):(e=b.el.attr("data-unchecked"),d=e="undefined"==typeof e?"":e,b.setValue(e)):b.isCheckbox&&"radio"==b.el.attr("type")?(b.setValue(d),a.el.find('[name="'+b.el.attr("name")+'"]').not(b.el).each(function(){var b=r(this),c=b.attr("data-unchecked"),b=b.attr("data-cell");a.cells[b].setValue("undefined"==typeof c?"":c)})):(e&&"undefined"!=typeof x&&""!==r.trim(d)?(rawValue=x().unformat(d),-1<e.indexOf("%")&&-1==d.indexOf("%")&&(rawValue/=100)):rawValue=r.isNumeric(d)?parseFloat(d):d,b.setValue(rawValue));
c!=d&&b.setAffected(!0)});this.el.on("calx.calculateSheet","input[data-cell]",function(){a.calculate()});this.el.on("calx.calculateCellDependant","input[data-cell], select[data-cell]",function(){var b=r(this).attr("data-cell"),b=a.cells[b];b.isAffected()&&(!0===t.isCalculating&&(t.isCalculating=!1),a.clearProcessedFlag(),b.calculate(!0,!1),a.hasRelatedSheet()?a.calculate():a.renderComputedValue())});this.el.on(a.config.autoCalculateTrigger,"input[data-cell]",function(){var b=r(this);b.attr("data-formula")||
a.config.autoCalculate&&setTimeout(function(){b.trigger("calx.calculateCellDependant")},50)});this.el.on("blur","input[data-cell]",function(){r(this).trigger("calx.renderComputedValue")});this.el.on("change","select[data-cell]",function(){r(this).trigger("calx.setValue");a.config.autoCalculate&&r(this).trigger("calx.calculateCellDependant")});this.el.on("click","input[data-cell][type=checkbox], input[data-cell][type=radio]",function(){r(this).trigger("calx.setValue");a.config.autoCalculate&&r(this).trigger("calx.calculateCellDependant")});
this.el.on("focus","input[data-cell]",function(){r(this).trigger("calx.getValue")});this.el.on("keyup","input[data-cell]",function(a){if(r(this).attr("data-formula"))return a.preventDefault(),!1;r(this).trigger("calx.setValue")})};v.fx.detachEvent=function(){this.el.off("calx.getValue");this.el.off("calx.setValue");this.el.off("calx.renderComputedValue");this.el.off("calx.calculateSheet");this.el.off("calx.calculateCellDependant")};var t={isCalculating:!1,version:"2.2.8",sheetRegistry:{},init:function(a){var b,
c,d;this.each(function(){b=r(this).attr("data-calx-identifier");c=r(this).attr("id");d=r.extend({},G,a);"undefined"!==typeof d.data[c]&&(d.data=d.data[c]);b&&"undefined"!=typeof t.sheetRegistry[b]?t.sheetRegistry[b].refresh():(b="CALX"+(new Date).valueOf(),t.sheetRegistry[b]=new v(b,this,d))});for(b in t.sheetRegistry)t.sheetRegistry[b].buildCellDependency();for(b in t.sheetRegistry){if(t.sheetRegistry[b].config.checkCircularReference){var e=t.sheetRegistry[b].checkCircularReference();e.isCircular&&
(e="Circular reference detected, this may cause calx to stop working.\ncell : "+e.cell.getAddress()+"\nformula : "+e.cell.getFormula()+"\n\nPlease check each cells involved in the formula that has direct or indirect reference to "+e.cell.getAddress(),alert(e),r.error(e))}t.sheetRegistry[b].config.autoCalculate&&t.sheetRegistry[b].calculate();t.sheetRegistry[b].renderComputedValue()}return this},registerFunction:function(a,b,c){if("undefined"==typeof c?0:c)for(var d in e)"undefined"!=typeof e[d][a]&&
delete e[d][a];e.user_defined[a]=b},registerVariable:function(a,b,c){c="undefined"==typeof c?!1:c;0===this.length&&(c=!0);if(c)if("object"==typeof a)for(var d in a)l.VARIABLE[d]=a[d];else l.VARIABLE[a]=b;else this.each(function(){var c=r(this).attr("data-calx-identifier");c&&"undefined"!=typeof t.sheetRegistry[c]&&(t.sheetRegistry[c].registerVariable(a,b),t.sheetRegistry[c].calculate())});return this},refresh:function(){return this.each(function(){var a=r(this).attr("data-calx-identifier");a&&"undefined"!=
typeof t.sheetRegistry[a]&&t.sheetRegistry[a].refresh()})},update:function(){return this.each(function(){var a=r(this).attr("data-calx-identifier");a&&"undefined"!=typeof t.sheetRegistry[a]&&t.sheetRegistry[a].update()})},getSheet:function(){var a=r(this).attr("data-calx-identifier");return"undefined"==typeof t.sheetRegistry[a]?!1:t.sheetRegistry[a]},getCell:function(a){var b=r(this).attr("data-calx-identifier");return t.sheetRegistry[b].getCell(a)},getUtility:function(){return n},getFormula:function(){return e},
evaluate:function(a){var b=r(this).attr("data-calx-identifier");return t.sheetRegistry[b].evaluate(a)},destroy:function(){this.each(function(){var a=r(this),b=a.attr("data-calx-identifier");a.removeAttr("data-calx-identifier");"undefined"!=typeof t.sheetRegistry[b]&&(t.sheetRegistry[b].detachEvent(),t.sheetRegistry[b].clearDependencies(),delete t.sheetRegistry[b])});return this},reset:function(){return this.each(function(){var a=r(this).attr("data-calx-identifier");a&&"undefined"!=typeof t.sheetRegistry[a]&&
t.sheetRegistry[a].reset()})},calculate:function(){return this.each(function(){var a=r(this).attr("data-calx-identifier");a&&"undefined"!=typeof t.sheetRegistry[a]&&t.sheetRegistry[a].calculate()})},setValue:function(a,b){var c=r(this).attr("data-calx-identifier"),c=t.sheetRegistry[c];c.getCell(a).setValue(b).renderComputedValue();c.config.autoCalculate&&c.calculate()}};r.fn.calx=function(a,b){if(t[a])return t[a].apply(this,Array.prototype.slice.call(arguments,1));if("object"==typeof a||"undefined"==
typeof a)return t.init.apply(this,arguments);r.error("Method "+a+" does not exist on jQuery.calx")}})(jQuery,numeral,moment,jStat);