code_text
stringlengths
604
999k
repo_name
stringlengths
4
100
file_path
stringlengths
4
873
language
stringclasses
23 values
license
stringclasses
15 values
size
int32
1.02k
999k
/* * /MathJax/jax/output/SVG/fonts/STIX-Web/Variants/Italic/Main.js * * Copyright (c) 2009-2014 The MathJax Consortium * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ MathJax.OutputJax.SVG.FONTDATA.FONTS["STIXMathJax_Variants-italic"]={directory:"Variants/Italic",family:"STIXMathJax_Variants",style:"italic",id:"STIXWEBVARIANTSI",32:[0,0,250,0,0,""],160:[0,0,250,0,0,""],57901:[677,45,852,43,812,"793 65l19 -15c-28 -54 -75 -81 -130 -81c-74 0 -100 50 -103 191h-238c-87 -119 -137 -205 -213 -205c-47 0 -85 38 -85 83c0 34 18 60 53 60c48 0 37 -53 69 -53c48 0 109 89 142 139l322 493h28l27 -539c2 -37 12 -107 49 -107c16 0 44 8 60 34zM578 200l-13 305 l-201 -305c-3 -4 -6 -10 -6 -13c0 -1 1 -1 1 -2c7 0 25 11 32 15h187"],57902:[670,3,724,35,709,"325 522l3 -2c70 95 154 150 274 150c62 0 107 -43 107 -104c0 -96 -114 -164 -173 -183c82 -8 155 -52 155 -151c0 -146 -199 -235 -333 -235c-41 0 -86 6 -121 32l11 22c32 -16 74 -20 107 -20c124 0 229 100 229 200c0 62 -52 114 -173 114h-66l11 38h19 c79 0 250 44 250 161c0 50 -29 79 -85 79c-47 0 -103 -34 -130 -62c-54 -54 -93 -123 -142 -291l-37 -128c-24 -83 -42 -130 -127 -140c-19 -2 -43 -2 -69 -2l9 24c41 0 52 23 92 162l104 363c3 9 3 17 3 24c0 18 -11 30 -42 30h-22l4 24c55 5 125 15 185 35"],57903:[671,11,569,43,586,"514 140l15 -16c-4 -6 -89 -135 -250 -135c-118 0 -236 66 -236 230c0 221 168 402 357 444c24 5 46 8 67 8c72 0 119 -35 119 -94c0 -32 -31 -85 -75 -85c-37 0 -56 25 -56 52c0 51 50 42 50 69c0 15 -27 23 -48 23c-104 0 -212 -75 -268 -214 c-23 -58 -39 -125 -39 -208c0 -128 74 -182 162 -182c101 0 186 91 202 108"],57904:[662,0,801,34,788,"49 534l-15 19c45 43 91 69 142 85c64 20 134 24 213 24c307 0 399 -67 399 -240s-114 -422 -479 -422h-257l7 24c42 0 59 24 77 87l97 337c14 48 33 98 33 121c0 22 -9 37 -45 37c-79 0 -145 -50 -172 -72zM381 586l-145 -499c-4 -13 -5 -21 -5 -26c0 -18 21 -21 59 -21 c95 0 388 40 388 378c0 130 -62 204 -247 204c-24 0 -45 -17 -50 -36"],57905:[670,4,553,40,599,"511 152l16 -18c-52 -55 -110 -92 -172 -114c-46 -17 -95 -24 -147 -24c-83 0 -168 37 -168 119c0 123 118 200 213 238c-44 21 -82 41 -82 110c0 116 174 207 274 207c90 0 154 -32 154 -99c0 -18 -17 -77 -72 -77c-28 0 -54 21 -54 49c0 40 30 47 30 60 c0 26 -15 34 -47 34c-101 0 -199 -71 -199 -144c0 -56 56 -88 134 -88h68l-9 -38c-112 0 -303 -88 -303 -227c0 -61 51 -90 125 -90c83 0 188 49 239 102"],57906:[662,0,652,43,710,"59 534l-16 18c104 97 200 110 295 110c210 0 372 -19 372 -117c0 -43 -24 -80 -68 -80c-30 0 -57 20 -57 47c1 55 47 36 47 63c0 28 -89 47 -180 47c-40 0 -55 -8 -67 -49l-57 -196h218l-13 -40h-216l-44 -149c-53 -178 -112 -188 -213 -188l8 24c36 0 59 25 78 92 l118 405c4 14 10 36 10 52c0 22 -10 33 -46 33c-83 0 -146 -50 -169 -72"],57907:[671,131,580,40,580,"425 91l-5 2c-45 -36 -106 -55 -166 -55c-109 0 -214 64 -214 204c0 234 224 429 421 429c72 0 119 -35 119 -94c0 -32 -34 -83 -78 -83c-30 0 -53 23 -53 50c0 49 50 45 50 66c0 16 -24 26 -48 26c-104 0 -210 -81 -268 -213c-25 -57 -36 -103 -36 -186 c0 -112 59 -156 130 -156c115 0 233 89 258 232l23 4c2 -10 2 -22 2 -34c0 -111 -54 -279 -163 -357c-54 -39 -107 -57 -186 -57c-71 0 -125 22 -154 54l15 19c23 -26 90 -38 131 -38c95 0 186 92 222 187"],57908:[664,21,831,41,845,"845 662l-10 -24c-43 0 -51 -27 -69 -92l-120 -427c-6 -20 -7 -38 -7 -52c0 -28 16 -41 54 -41c26 0 43 8 63 27l15 -19c-33 -38 -97 -55 -138 -55c-42 0 -106 21 -106 84c0 11 1 22 5 35l71 252c-9 -4 -22 -13 -30 -13h-258l-68 -244c-24 -85 -82 -93 -189 -93l10 24 c42 4 60 25 78 88l95 341c2 6 27 104 27 121c0 22 -7 34 -39 34c-72 0 -143 -50 -172 -75l-16 18c46 53 140 113 268 113c52 0 72 -25 72 -75c0 -26 -9 -60 -21 -102l-36 -123c11 2 20 13 30 13h257l56 194c26 89 70 91 178 91"],57909:[662,0,575,38,591,"591 662l-6 -24c-94 0 -135 -5 -167 -117l-118 -410c-1 -4 -3 -13 -3 -24c0 -24 24 -32 48 -32c51 0 110 18 168 73l18 -19c-84 -82 -174 -109 -289 -109h-204l6 24c75 0 124 0 156 112l104 362c6 21 18 56 18 76c0 26 -21 32 -48 32c-42 0 -122 -25 -168 -73l-17 19 c73 72 148 110 314 110h188"],57910:[662,120,632,31,785,"785 662l-9 -24c-87 0 -115 -33 -136 -105l-126 -440c-42 -146 -150 -213 -284 -213c-111 0 -199 49 -199 135c0 50 34 91 78 91c34 0 53 -22 53 -55c0 -40 -36 -49 -36 -66c0 -50 49 -65 110 -65c144 0 172 177 210 310l93 322c3 9 4 17 4 24c0 35 -30 44 -65 44 c-138 0 -213 -128 -245 -193h-28c37 95 116 235 295 235h285"],57911:[670,13,809,30,783,"308 449l6 -3c89 99 235 224 354 224c73 0 115 -43 115 -104c0 -54 -32 -103 -82 -103c-30 0 -50 24 -50 51c0 56 55 37 55 77c0 18 -15 39 -45 39c-94 0 -218 -93 -330 -229c45 -204 160 -349 279 -349c44 0 103 29 135 74l20 -16c-44 -58 -103 -123 -220 -123 c-134 0 -249 153 -281 280l-40 -140c-34 -120 -72 -127 -194 -127l7 24c41 0 62 39 97 163l103 362c3 9 4 16 4 23c0 21 -18 30 -47 30c-6 0 -11 0 -18 -1l5 25c58 6 126 16 187 36"],57912:[670,7,693,30,653,"636 143l17 -18c-59 -60 -152 -132 -276 -132c-36 0 -62 5 -88 11c-33 7 -64 15 -110 15c-44 0 -104 -19 -149 -19l6 24c33 0 61 25 78 93l70 284c48 193 203 269 304 269c71 0 97 -55 97 -110c0 -50 -36 -83 -81 -83c-30 0 -50 24 -50 51c0 48 50 41 50 64 c0 17 -7 38 -58 38c-185 0 -130 -365 -265 -538v-4c25 17 83 22 114 22c103 0 80 -50 168 -50c58 0 118 31 173 83"],57913:[671,45,1166,40,1128,"1113 54l15 -19c-35 -49 -87 -67 -142 -67c-23 0 -88 13 -88 80c0 6 0 12 5 54l44 395h-3l-412 -489h-15c-58 123 -106 245 -140 406h-1c-21 -87 -54 -253 -131 -375c-32 -51 -67 -84 -118 -84c-49 0 -87 37 -87 84c0 34 18 60 53 60c48 0 41 -57 73 -57 c18 0 43 17 60 47c73 126 136 473 159 582h30c45 -191 92 -381 169 -540l457 540h27l-61 -557c-1 -9 -2 -19 -2 -29c0 -30 10 -58 44 -58c32 0 54 17 64 27"],57914:[795,37,957,40,1064,"671 125h1c141 466 168 561 191 596c30 46 67 74 114 74c49 0 87 -37 87 -84c0 -34 -18 -60 -53 -60c-48 0 -41 57 -73 57c-54 0 -71 -73 -81 -104l-191 -628h-20c-94 128 -185 279 -258 476h-2c-36 -174 -105 -489 -259 -489c-49 0 -87 37 -87 84c0 34 18 60 53 60 c48 0 41 -57 73 -57c120 0 182 454 218 621h27c78 -195 155 -410 260 -546"],57915:[669,10,737,38,729,"360 662l6 -23c-116 -34 -221 -213 -221 -409c0 -137 69 -200 165 -200c75 0 163 54 226 142c51 72 84 165 84 288c0 100 -58 153 -117 153s-118 -42 -118 -108c0 -25 11 -37 36 -37c9 0 17 5 35 5c25 0 29 -16 29 -33c0 -37 -40 -72 -80 -72c-58 0 -87 44 -87 100 c0 99 114 201 240 201c116 0 171 -107 171 -210c0 -116 -61 -243 -134 -322c-84 -90 -193 -147 -321 -147c-129 0 -236 73 -236 223c0 249 180 427 322 449"],57916:[662,0,667,38,709,"290 662h99c278 0 320 -63 320 -160c0 -93 -67 -274 -395 -274l9 24c178 17 283 114 283 246c0 91 -48 124 -178 124c-35 0 -43 -16 -56 -60l-126 -443c-20 -70 -70 -119 -191 -119l8 24c42 0 58 35 82 117l89 305c15 53 30 103 30 126c0 22 -10 34 -46 34 c-87 0 -136 -54 -162 -72l-18 19c98 94 183 109 252 109"],57917:[671,131,744,43,704,"680 9h24c-41 -132 -146 -140 -232 -140c-94 0 -186 53 -274 76c-46 12 -87 19 -124 19v24c114 43 213 49 268 60c142 28 244 177 244 336c0 105 -7 246 -149 246c-171 0 -290 -168 -290 -345c0 -88 64 -145 145 -145c41 0 84 7 128 42l14 -18c-46 -45 -126 -74 -207 -74 c-60 0 -118 19 -154 68c-18 25 -30 57 -30 96c0 214 205 417 412 417c164 0 238 -113 238 -243c0 -158 -90 -305 -244 -383c-34 -17 -99 -39 -141 -45l-1 -4c69 -22 170 -74 242 -74c76 0 119 46 131 87"],57918:[662,3,854,38,816,"800 129l16 -18c-52 -55 -121 -114 -192 -114c-143 0 -129 149 -211 243c-14 16 -77 51 -82 51l9 23c178 17 271 120 271 189c0 92 -49 117 -179 117c-35 0 -43 -12 -49 -34l-116 -396c-27 -93 -63 -190 -211 -190l9 24c42 0 57 35 81 117l91 315c14 47 30 93 30 116 c0 22 -10 36 -46 36c-87 0 -138 -52 -167 -73l-16 19c104 108 200 108 350 108c278 0 327 -54 327 -146c0 -71 -43 -166 -253 -221v-4c149 -57 84 -232 195 -232c58 0 107 35 143 70"],57919:[671,0,634,38,671,"38 193l26 3c10 -61 40 -113 114 -139c30 -11 64 -16 98 -16c102 0 203 48 203 152c0 112 -275 84 -275 271c0 142 196 207 274 207c105 0 193 -29 193 -102c0 -30 -18 -79 -69 -79c-28 0 -56 22 -56 50c0 40 30 45 30 60c0 34 -60 34 -98 34c-46 0 -188 -34 -188 -141 c0 -128 308 -98 308 -278c0 -94 -146 -215 -316 -215c-179 0 -244 86 -244 193"],57920:[721,0,509,41,730,"712 721l18 -15c-60 -98 -161 -141 -301 -147l-108 -372c-51 -176 -112 -187 -213 -187l9 24c40 0 63 38 84 112l93 324c12 43 25 86 25 108c0 21 -17 32 -35 32c-52 0 -145 -22 -223 -123l-20 14c84 122 175 172 386 172c40 0 70 -6 101 -6c79 0 154 18 184 64"],57921:[672,13,817,37,950,"355 489l-75 -257c-12 -41 -23 -80 -23 -110c0 -37 21 -85 72 -85c291 0 266 406 398 559c36 42 69 76 137 76c63 0 86 -35 86 -73c0 -40 -19 -85 -68 -85c-28 0 -50 18 -50 41c0 34 17 33 17 43c0 12 -6 18 -22 18c-51 0 -97 -89 -125 -153c-73 -168 -96 -476 -386 -476 c-49 0 -169 9 -169 121c0 20 3 43 10 69l78 277c6 20 26 96 26 113c0 22 -5 39 -37 39c-72 0 -136 -44 -172 -71l-15 19c47 42 139 108 267 108c55 0 72 -28 72 -67c0 -32 -9 -66 -21 -106"],57922:[677,33,638,33,680,"335 112l5 -6c51 40 156 130 227 231c42 60 73 120 73 175c0 61 -24 87 -62 87c-31 0 -24 -49 -70 -49c-33 0 -50 23 -50 54c0 42 36 73 83 73c46 0 87 -12 116 -59c17 -26 23 -66 23 -93c0 -83 -45 -166 -108 -245c-96 -119 -234 -228 -324 -310l-29 -3 c12 103 25 222 25 346c0 136 -16 309 -132 309c-25 0 -48 -6 -64 -19l-15 19c35 29 71 40 108 40c187 0 206 -202 206 -378c0 -45 -8 -140 -12 -172"],57923:[685,32,956,33,998,"724 115l6 -3c49 58 127 132 182 237c28 54 46 110 46 158c0 70 -21 108 -61 108c-23 0 -15 -50 -56 -50c-34 0 -50 26 -50 54c0 46 37 66 83 66c79 0 124 -76 124 -171c0 -211 -230 -409 -340 -546h-26v68c0 169 -6 379 -89 491h-7l-323 -559h-30c21 130 45 292 45 442 c0 122 -32 216 -134 216c-16 0 -35 -9 -46 -18l-15 19c36 29 73 35 110 35c173 0 188 -164 188 -321c0 -23 -1 -55 -3 -82h6l197 342l45 49c77 -83 151 -265 151 -432c0 -36 0 -67 -3 -103"],57924:[672,13,692,38,739,"444 473l10 -95c115 53 226 106 226 177c0 10 -4 24 -19 24c-10 0 -6 -12 -33 -12c-22 0 -34 23 -34 47c0 34 28 58 69 58c36 0 76 -31 76 -95c0 -97 -101 -157 -278 -240l25 -172c8 -58 25 -103 67 -103c16 0 41 7 57 33l19 -14c-26 -54 -66 -81 -120 -81 c-61 0 -105 33 -122 171l-16 129c-215 -107 -273 -154 -273 -207c0 -9 2 -14 8 -14s12 9 26 9c31 0 40 -18 40 -42c0 -27 -22 -59 -71 -59c-33 0 -63 26 -63 79c0 112 137 179 328 276l-24 153c-6 38 -20 105 -64 105c-16 0 -43 -8 -58 -34l-22 10c26 54 70 86 124 86 c64 0 107 -47 122 -189"],57925:[675,131,719,34,763,"462 119l3 -4c60 39 256 277 256 393c0 61 -24 95 -59 95c-29 0 -23 -47 -66 -47c-31 0 -47 21 -47 50c0 39 35 69 78 69c74 0 136 -47 136 -153c0 -191 -365 -653 -600 -653c-106 0 -126 81 -129 144l22 10c24 -55 65 -73 120 -73c53 0 110 18 187 85 c0 86 -5 196 -16 290c-14 125 -48 293 -151 293c-17 0 -55 -7 -77 -23l-16 18c42 40 85 49 127 49c167 0 200 -186 222 -353c6 -45 10 -158 10 -190"],57926:[664,94,752,38,714,"714 662l-6 -21c-27 -4 -54 -34 -89 -76l-160 -190h110l-17 -38h-126c-90 -102 -174 -202 -270 -286c10 2 21 2 31 2c137 0 205 -94 327 -94c76 0 119 46 133 87h22c-41 -132 -146 -140 -232 -140c-94 0 -186 51 -274 76c-43 12 -81 18 -116 18h-9l3 19 c28 14 77 43 121 89c73 74 142 149 211 229h-112l15 38h130l153 183l-7 5c-11 -1 -24 -2 -34 -2c-78 0 -95 48 -161 48c-86 0 -155 -80 -174 -108l-20 11c67 102 174 152 266 152c43 0 98 -22 145 -22c58 0 88 20 140 20"],57954:[460,11,570,56,514,"326 460h8c102 0 180 -67 180 -187c0 -101 -65 -208 -152 -256c-39 -21 -85 -28 -131 -28c-102 0 -175 71 -175 168c0 181 125 303 270 303zM414 323c0 53 -22 115 -82 115c-44 0 -82 -28 -111 -73c-52 -80 -65 -160 -65 -243c0 -55 24 -109 77 -109c47 0 88 34 116 72 c51 70 65 176 65 238"],57958:[460,0,570,100,415,"204 419l204 41c4 0 7 -1 7 -7c0 -5 -2 -13 -3 -18l-103 -359c-4 -13 -7 -24 -7 -32c0 -20 16 -29 69 -29v-15h-271v15c75 4 98 25 114 80l69 243c5 16 8 30 8 41c0 19 -10 30 -41 30c-12 0 -27 -2 -46 -5v15"],57962:[460,0,570,59,487,"156 288l-21 7c39 115 118 165 202 165c76 0 150 -46 150 -142c0 -84 -75 -145 -286 -247h142c57 0 78 20 103 70l17 -7l-51 -134h-353v17l239 148c57 35 102 66 102 129c0 35 -19 93 -94 93c-74 0 -115 -31 -150 -99"],57966:[461,217,570,40,513,"206 352l-17 7c43 72 107 102 182 102c74 0 142 -37 142 -122c0 -74 -44 -133 -131 -173v-3c51 -20 82 -55 82 -128c0 -79 -47 -140 -104 -190c-49 -43 -133 -62 -205 -62s-115 31 -115 64c0 25 21 36 47 36c19 0 37 -6 64 -30c26 -23 52 -32 71 -32c33 0 78 18 103 46 c26 31 39 79 39 126c0 108 -64 130 -160 130h-24v20c57 9 127 23 166 45c49 28 80 79 80 140c0 55 -35 91 -88 91c-43 0 -96 -20 -132 -67"],57970:[450,217,570,17,542,"542 450l-127 -440h86l-20 -72h-86l-45 -155h-100l45 155h-278l20 71l460 441h45zM404 318l-3 1l-320 -309h234"],57974:[450,218,570,23,536,"536 450l-31 -80h-247l-41 -87c123 -14 252 -85 252 -221c0 -145 -126 -280 -326 -280c-76 0 -87 9 -108 28c-9 9 -12 20 -12 30c0 27 20 46 59 46c66 0 59 -62 131 -62c81 0 169 91 169 192c0 137 -141 180 -243 180v25l110 229h287"],57978:[668,10,570,28,553,"553 668l-2 -17c-145 -32 -271 -100 -337 -244l3 -3c52 22 77 25 116 25c103 0 169 -61 169 -164c0 -125 -92 -275 -287 -275c-135 0 -187 98 -187 213c0 110 57 221 156 312c103 94 231 140 369 153zM216 18h2c39 0 71 16 96 41c51 50 78 134 78 203 c0 72 -31 129 -105 129c-52 0 -92 -38 -111 -73c-31 -57 -49 -128 -49 -192c0 -60 33 -108 89 -108"],57982:[450,217,570,40,543,"543 434l-408 -651h-79l384 587h-224c-79 0 -116 -15 -157 -82l-19 6l91 156h402"],57986:[668,10,570,50,519,"243 352v1c-72 71 -101 111 -101 165c0 96 91 150 198 150s179 -53 179 -134c0 -78 -49 -125 -169 -161v-1c86 -79 132 -123 132 -196c0 -111 -109 -186 -233 -186c-102 0 -199 47 -199 166c0 94 73 161 193 196zM445 525c0 71 -43 115 -107 115s-102 -35 -102 -100 c0 -42 16 -70 94 -143c87 41 115 89 115 128zM389 150c0 57 -15 73 -122 179c-90 -34 -141 -98 -141 -185c0 -82 63 -126 131 -126c79 0 132 63 132 132"],57990:[460,217,570,23,526,"355 53l-3 3c-52 -22 -77 -25 -116 -25c-103 0 -169 61 -169 164c0 125 91 265 272 265c135 0 187 -98 187 -213c0 -110 -57 -221 -156 -312c-103 -94 -209 -139 -347 -152l2 18c150 41 264 108 330 252zM338 432h-2c-39 0 -71 -16 -96 -41c-51 -50 -63 -120 -63 -189 c0 -72 42 -124 97 -124c41 0 71 14 98 43c31 57 55 139 55 203c0 60 -33 108 -89 108"]};MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Variants/Italic/Main.js");
sh4hin/cdnjs
ajax/libs/mathjax/2.4.0/jax/output/SVG/fonts/STIX-Web/Variants/Italic/Main.js
JavaScript
mit
14,147
CodeMirror.registerHelper("fold", "brace", function(cm, start) { var line = start.line, lineText = cm.getLine(line); var startCh, tokenType; function findOpening(openCh) { for (var at = start.ch, pass = 0;;) { var found = lineText.lastIndexOf(openCh, at - 1); if (found == -1) { if (pass == 1) break; pass = 1; at = lineText.length; continue; } if (pass == 1 && found < start.ch) break; tokenType = cm.getTokenAt(CodeMirror.Pos(line, found + 1)).type; if (!/^(comment|string)/.test(tokenType)) return found + 1; at = found - 1; } } var startToken = "{", endToken = "}", startCh = findOpening("{"); if (startCh == null) { startToken = "[", endToken = "]"; startCh = findOpening("["); } if (startCh == null) return; var count = 1, lastLine = cm.lastLine(), end, endCh; outer: for (var i = line; i <= lastLine; ++i) { var text = cm.getLine(i), pos = i == line ? startCh : 0; for (;;) { var nextOpen = text.indexOf(startToken, pos), nextClose = text.indexOf(endToken, pos); if (nextOpen < 0) nextOpen = text.length; if (nextClose < 0) nextClose = text.length; pos = Math.min(nextOpen, nextClose); if (pos == text.length) break; if (cm.getTokenAt(CodeMirror.Pos(i, pos + 1)).type == tokenType) { if (pos == nextOpen) ++count; else if (!--count) { end = i; endCh = pos; break outer; } } ++pos; } } if (end == null || line == end && endCh == startCh) return; return {from: CodeMirror.Pos(line, startCh), to: CodeMirror.Pos(end, endCh)}; }); CodeMirror.braceRangeFinder = CodeMirror.fold.brace; // deprecated CodeMirror.registerHelper("fold", "import", function(cm, start) { function hasImport(line) { if (line < cm.firstLine() || line > cm.lastLine()) return null; var start = cm.getTokenAt(CodeMirror.Pos(line, 1)); if (!/\S/.test(start.string)) start = cm.getTokenAt(CodeMirror.Pos(line, start.end + 1)); if (start.type != "keyword" || start.string != "import") return null; // Now find closing semicolon, return its position for (var i = line, e = Math.min(cm.lastLine(), line + 10); i <= e; ++i) { var text = cm.getLine(i), semi = text.indexOf(";"); if (semi != -1) return {startCh: start.end, end: CodeMirror.Pos(i, semi)}; } } var start = start.line, has = hasImport(start), prev; if (!has || hasImport(start - 1) || ((prev = hasImport(start - 2)) && prev.end.line == start - 1)) return null; for (var end = has.end;;) { var next = hasImport(end.line + 1); if (next == null) break; end = next.end; } return {from: cm.clipPos(CodeMirror.Pos(start, has.startCh + 1)), to: end}; }); CodeMirror.importRangeFinder = CodeMirror.fold["import"]; // deprecated CodeMirror.registerHelper("fold", "include", function(cm, start) { function hasInclude(line) { if (line < cm.firstLine() || line > cm.lastLine()) return null; var start = cm.getTokenAt(CodeMirror.Pos(line, 1)); if (!/\S/.test(start.string)) start = cm.getTokenAt(CodeMirror.Pos(line, start.end + 1)); if (start.type == "meta" && start.string.slice(0, 8) == "#include") return start.start + 8; } var start = start.line, has = hasInclude(start); if (has == null || hasInclude(start - 1) != null) return null; for (var end = start;;) { var next = hasInclude(end + 1); if (next == null) break; ++end; } return {from: CodeMirror.Pos(start, has + 1), to: cm.clipPos(CodeMirror.Pos(end))}; }); CodeMirror.includeRangeFinder = CodeMirror.fold.include; // deprecated
joseluisq/cdnjs
ajax/libs/codemirror/3.15.0/addon/fold/brace-fold.js
JavaScript
mit
3,640
YUI.add('io-base', function (Y, NAME) { /** Base IO functionality. Provides basic XHR transport support. @module io @submodule io-base @for IO **/ var // List of events that comprise the IO event lifecycle. EVENTS = ['start', 'complete', 'end', 'success', 'failure', 'progress'], // Whitelist of used XHR response object properties. XHR_PROPS = ['status', 'statusText', 'responseText', 'responseXML'], win = Y.config.win, uid = 0; /** The IO class is a utility that brokers HTTP requests through a simplified interface. Specifically, it allows JavaScript to make HTTP requests to a resource without a page reload. The underlying transport for making same-domain requests is the XMLHttpRequest object. IO can also use Flash, if specified as a transport, for cross-domain requests. @class IO @constructor @param {Object} config Object of EventTarget's publish method configurations used to configure IO's events. **/ function IO (config) { var io = this; io._uid = 'io:' + uid++; io._init(config); Y.io._map[io._uid] = io; } IO.prototype = { //-------------------------------------- // Properties //-------------------------------------- /** * A counter that increments for each transaction. * * @property _id * @private * @type {Number} */ _id: 0, /** * Object of IO HTTP headers sent with each transaction. * * @property _headers * @private * @type {Object} */ _headers: { 'X-Requested-With' : 'XMLHttpRequest' }, /** * Object that stores timeout values for any transaction with a defined * "timeout" configuration property. * * @property _timeout * @private * @type {Object} */ _timeout: {}, //-------------------------------------- // Methods //-------------------------------------- _init: function(config) { var io = this, i, len; io.cfg = config || {}; Y.augment(io, Y.EventTarget); for (i = 0, len = EVENTS.length; i < len; ++i) { // Publish IO global events with configurations, if any. // IO global events are set to broadcast by default. // These events use the "io:" namespace. io.publish('io:' + EVENTS[i], Y.merge({ broadcast: 1 }, config)); // Publish IO transaction events with configurations, if // any. These events use the "io-trn:" namespace. io.publish('io-trn:' + EVENTS[i], config); } }, /** * Method that creates a unique transaction object for each request. * * @method _create * @private * @param {Object} cfg Configuration object subset to determine if * the transaction is an XDR or file upload, * requiring an alternate transport. * @param {Number} id Transaction id * @return {Object} The transaction object */ _create: function(config, id) { var io = this, transaction = { id : Y.Lang.isNumber(id) ? id : io._id++, uid: io._uid }, alt = config.xdr ? config.xdr.use : null, form = config.form && config.form.upload ? 'iframe' : null, use; if (alt === 'native') { // Non-IE and IE >= 10 can use XHR level 2 and not rely on an // external transport. alt = Y.UA.ie && !SUPPORTS_CORS ? 'xdr' : null; // Prevent "pre-flight" OPTIONS request by removing the // `X-Requested-With` HTTP header from CORS requests. This header // can be added back on a per-request basis, if desired. io.setHeader('X-Requested-With'); } use = alt || form; transaction = use ? Y.merge(Y.IO.customTransport(use), transaction) : Y.merge(Y.IO.defaultTransport(), transaction); if (transaction.notify) { config.notify = function (e, t, c) { io.notify(e, t, c); }; } if (!use) { if (win && win.FormData && config.data instanceof win.FormData) { transaction.c.upload.onprogress = function (e) { io.progress(transaction, e, config); }; transaction.c.onload = function (e) { io.load(transaction, e, config); }; transaction.c.onerror = function (e) { io.error(transaction, e, config); }; transaction.upload = true; } } return transaction; }, _destroy: function(transaction) { if (win && !transaction.notify && !transaction.xdr) { if (XHR && !transaction.upload) { transaction.c.onreadystatechange = null; } else if (transaction.upload) { transaction.c.upload.onprogress = null; transaction.c.onload = null; transaction.c.onerror = null; } else if (Y.UA.ie && !transaction.e) { // IE, when using XMLHttpRequest as an ActiveX Object, will throw // a "Type Mismatch" error if the event handler is set to "null". transaction.c.abort(); } } transaction = transaction.c = null; }, /** * Method for creating and firing events. * * @method _evt * @private * @param {String} eventName Event to be published. * @param {Object} transaction Transaction object. * @param {Object} config Configuration data subset for event subscription. */ _evt: function(eventName, transaction, config) { var io = this, params, args = config['arguments'], emitFacade = io.cfg.emitFacade, globalEvent = "io:" + eventName, trnEvent = "io-trn:" + eventName; // Workaround for #2532107 this.detach(trnEvent); if (transaction.e) { transaction.c = { status: 0, statusText: transaction.e }; } // Fire event with parameters or an Event Facade. params = [ emitFacade ? { id: transaction.id, data: transaction.c, cfg: config, 'arguments': args } : transaction.id ]; if (!emitFacade) { if (eventName === EVENTS[0] || eventName === EVENTS[2]) { if (args) { params.push(args); } } else { if (transaction.evt) { params.push(transaction.evt); } else { params.push(transaction.c); } if (args) { params.push(args); } } } params.unshift(globalEvent); // Fire global events. io.fire.apply(io, params); // Fire transaction events, if receivers are defined. if (config.on) { params[0] = trnEvent; io.once(trnEvent, config.on[eventName], config.context || Y); io.fire.apply(io, params); } }, /** * Fires event "io:start" and creates, fires a transaction-specific * start event, if `config.on.start` is defined. * * @method start * @param {Object} transaction Transaction object. * @param {Object} config Configuration object for the transaction. */ start: function(transaction, config) { /** * Signals the start of an IO request. * @event io:start */ this._evt(EVENTS[0], transaction, config); }, /** * Fires event "io:complete" and creates, fires a * transaction-specific "complete" event, if config.on.complete is * defined. * * @method complete * @param {Object} transaction Transaction object. * @param {Object} config Configuration object for the transaction. */ complete: function(transaction, config) { /** * Signals the completion of the request-response phase of a * transaction. Response status and data are accessible, if * available, in this event. * @event io:complete */ this._evt(EVENTS[1], transaction, config); }, /** * Fires event "io:end" and creates, fires a transaction-specific "end" * event, if config.on.end is defined. * * @method end * @param {Object} transaction Transaction object. * @param {Object} config Configuration object for the transaction. */ end: function(transaction, config) { /** * Signals the end of the transaction lifecycle. * @event io:end */ this._evt(EVENTS[2], transaction, config); this._destroy(transaction); }, /** * Fires event "io:success" and creates, fires a transaction-specific * "success" event, if config.on.success is defined. * * @method success * @param {Object} transaction Transaction object. * @param {Object} config Configuration object for the transaction. */ success: function(transaction, config) { /** * Signals an HTTP response with status in the 2xx range. * Fires after io:complete. * @event io:success */ this._evt(EVENTS[3], transaction, config); this.end(transaction, config); }, /** * Fires event "io:failure" and creates, fires a transaction-specific * "failure" event, if config.on.failure is defined. * * @method failure * @param {Object} transaction Transaction object. * @param {Object} config Configuration object for the transaction. */ failure: function(transaction, config) { /** * Signals an HTTP response with status outside of the 2xx range. * Fires after io:complete. * @event io:failure */ this._evt(EVENTS[4], transaction, config); this.end(transaction, config); }, /** * Fires event "io:progress" and creates, fires a transaction-specific * "progress" event -- for XMLHttpRequest file upload -- if * config.on.progress is defined. * * @method progress * @param {Object} transaction Transaction object. * @param {Object} progress event. * @param {Object} config Configuration object for the transaction. */ progress: function(transaction, e, config) { /** * Signals the interactive state during a file upload transaction. * This event fires after io:start and before io:complete. * @event io:progress */ transaction.evt = e; this._evt(EVENTS[5], transaction, config); }, /** * Fires event "io:complete" and creates, fires a transaction-specific * "complete" event -- for XMLHttpRequest file upload -- if * config.on.complete is defined. * * @method load * @param {Object} transaction Transaction object. * @param {Object} load event. * @param {Object} config Configuration object for the transaction. */ load: function (transaction, e, config) { transaction.evt = e.target; this._evt(EVENTS[1], transaction, config); }, /** * Fires event "io:failure" and creates, fires a transaction-specific * "failure" event -- for XMLHttpRequest file upload -- if * config.on.failure is defined. * * @method error * @param {Object} transaction Transaction object. * @param {Object} error event. * @param {Object} config Configuration object for the transaction. */ error: function (transaction, e, config) { transaction.evt = e; this._evt(EVENTS[4], transaction, config); }, /** * Retry an XDR transaction, using the Flash tranport, if the native * transport fails. * * @method _retry * @private * @param {Object} transaction Transaction object. * @param {String} uri Qualified path to transaction resource. * @param {Object} config Configuration object for the transaction. */ _retry: function(transaction, uri, config) { this._destroy(transaction); config.xdr.use = 'flash'; return this.send(uri, config, transaction.id); }, /** * Method that concatenates string data for HTTP GET transactions. * * @method _concat * @private * @param {String} uri URI or root data. * @param {String} data Data to be concatenated onto URI. * @return {String} */ _concat: function(uri, data) { uri += (uri.indexOf('?') === -1 ? '?' : '&') + data; return uri; }, /** * Stores default client headers for all transactions. If a label is * passed with no value argument, the header will be deleted. * * @method setHeader * @param {String} name HTTP header * @param {String} value HTTP header value */ setHeader: function(name, value) { if (value) { this._headers[name] = value; } else { delete this._headers[name]; } }, /** * Method that sets all HTTP headers to be sent in a transaction. * * @method _setHeaders * @private * @param {Object} transaction - XHR instance for the specific transaction. * @param {Object} headers - HTTP headers for the specific transaction, as * defined in the configuration object passed to YUI.io(). */ _setHeaders: function(transaction, headers) { headers = Y.merge(this._headers, headers); Y.Object.each(headers, function(value, name) { if (value !== 'disable') { transaction.setRequestHeader(name, headers[name]); } }); }, /** * Starts timeout count if the configuration object has a defined * timeout property. * * @method _startTimeout * @private * @param {Object} transaction Transaction object generated by _create(). * @param {Object} timeout Timeout in milliseconds. */ _startTimeout: function(transaction, timeout) { var io = this; io._timeout[transaction.id] = setTimeout(function() { io._abort(transaction, 'timeout'); }, timeout); }, /** * Clears the timeout interval started by _startTimeout(). * * @method _clearTimeout * @private * @param {Number} id - Transaction id. */ _clearTimeout: function(id) { clearTimeout(this._timeout[id]); delete this._timeout[id]; }, /** * Method that determines if a transaction response qualifies as success * or failure, based on the response HTTP status code, and fires the * appropriate success or failure events. * * @method _result * @private * @static * @param {Object} transaction Transaction object generated by _create(). * @param {Object} config Configuration object passed to io(). */ _result: function(transaction, config) { var status; // Firefox will throw an exception if attempting to access // an XHR object's status property, after a request is aborted. try { status = transaction.c.status; } catch(e) { status = 0; } // IE reports HTTP 204 as HTTP 1223. if (status >= 200 && status < 300 || status === 304 || status === 1223) { this.success(transaction, config); } else { this.failure(transaction, config); } }, /** * Event handler bound to onreadystatechange. * * @method _rS * @private * @param {Object} transaction Transaction object generated by _create(). * @param {Object} config Configuration object passed to YUI.io(). */ _rS: function(transaction, config) { var io = this; if (transaction.c.readyState === 4) { if (config.timeout) { io._clearTimeout(transaction.id); } // Yield in the event of request timeout or abort. setTimeout(function() { io.complete(transaction, config); io._result(transaction, config); }, 0); } }, /** * Terminates a transaction due to an explicit abort or timeout. * * @method _abort * @private * @param {Object} transaction Transaction object generated by _create(). * @param {String} type Identifies timed out or aborted transaction. */ _abort: function(transaction, type) { if (transaction && transaction.c) { transaction.e = type; transaction.c.abort(); } }, /** * Requests a transaction. `send()` is implemented as `Y.io()`. Each * transaction may include a configuration object. Its properties are: * * <dl> * <dt>method</dt> * <dd>HTTP method verb (e.g., GET or POST). If this property is not * not defined, the default value will be GET.</dd> * * <dt>data</dt> * <dd>This is the name-value string that will be sent as the * transaction data. If the request is HTTP GET, the data become * part of querystring. If HTTP POST, the data are sent in the * message body.</dd> * * <dt>xdr</dt> * <dd>Defines the transport to be used for cross-domain requests. * By setting this property, the transaction will use the specified * transport instead of XMLHttpRequest. The properties of the * transport object are: * <dl> * <dt>use</dt> * <dd>The transport to be used: 'flash' or 'native'</dd> * <dt>dataType</dt> * <dd>Set the value to 'XML' if that is the expected response * content type.</dd> * <dt>credentials</dt> * <dd>Set the value to 'true' to set XHR.withCredentials property to true.</dd> * </dl></dd> * * <dt>form</dt> * <dd>Form serialization configuration object. Its properties are: * <dl> * <dt>id</dt> * <dd>Node object or id of HTML form</dd> * <dt>useDisabled</dt> * <dd>`true` to also serialize disabled form field values * (defaults to `false`)</dd> * </dl></dd> * * <dt>on</dt> * <dd>Assigns transaction event subscriptions. Available events are: * <dl> * <dt>start</dt> * <dd>Fires when a request is sent to a resource.</dd> * <dt>complete</dt> * <dd>Fires when the transaction is complete.</dd> * <dt>success</dt> * <dd>Fires when the HTTP response status is within the 2xx * range.</dd> * <dt>failure</dt> * <dd>Fires when the HTTP response status is outside the 2xx * range, if an exception occurs, if the transation is aborted, * or if the transaction exceeds a configured `timeout`.</dd> * <dt>end</dt> * <dd>Fires at the conclusion of the transaction * lifecycle, after `success` or `failure`.</dd> * </dl> * * <p>Callback functions for `start` and `end` receive the id of the * transaction as a first argument. For `complete`, `success`, and * `failure`, callbacks receive the id and the response object * (usually the XMLHttpRequest instance). If the `arguments` * property was included in the configuration object passed to * `Y.io()`, the configured data will be passed to all callbacks as * the last argument.</p> * </dd> * * <dt>sync</dt> * <dd>Pass `true` to make a same-domain transaction synchronous. * <strong>CAVEAT</strong>: This will negatively impact the user * experience. Have a <em>very</em> good reason if you intend to use * this.</dd> * * <dt>context</dt> * <dd>The "`this'" object for all configured event handlers. If a * specific context is needed for individual callbacks, bind the * callback to a context using `Y.bind()`.</dd> * * <dt>headers</dt> * <dd>Object map of transaction headers to send to the server. The * object keys are the header names and the values are the header * values.</dd> * * <dt>timeout</dt> * <dd>Millisecond threshold for the transaction before being * automatically aborted.</dd> * * <dt>arguments</dt> * <dd>User-defined data passed to all registered event handlers. * This value is available as the second argument in the "start" and * "end" event handlers. It is the third argument in the "complete", * "success", and "failure" event handlers. <strong>Be sure to quote * this property name in the transaction configuration as * "arguments" is a reserved word in JavaScript</strong> (e.g. * `Y.io({ ..., "arguments": stuff })`).</dd> * </dl> * * @method send * @public * @param {String} uri Qualified path to transaction resource. * @param {Object} config Configuration object for the transaction. * @param {Number} id Transaction id, if already set. * @return {Object} */ send: function(uri, config, id) { var transaction, method, i, len, sync, data, io = this, u = uri, response = {}; config = config ? Y.Object(config) : {}; transaction = io._create(config, id); method = config.method ? config.method.toUpperCase() : 'GET'; sync = config.sync; data = config.data; // Serialize a map object into a key-value string using // querystring-stringify-simple. if ((Y.Lang.isObject(data) && !data.nodeType) && !transaction.upload) { if (Y.QueryString && Y.QueryString.stringify) { config.data = data = Y.QueryString.stringify(data); } else { } } if (config.form) { if (config.form.upload) { // This is a file upload transaction, calling // upload() in io-upload-iframe. return io.upload(transaction, uri, config); } else { // Serialize HTML form data into a key-value string. data = io._serialize(config.form, data); } } // Convert falsy values to an empty string. This way IE can't be // rediculous and translate `undefined` to "undefined". data || (data = ''); if (data) { switch (method) { case 'GET': case 'HEAD': case 'DELETE': u = io._concat(u, data); data = ''; break; case 'POST': case 'PUT': // If Content-Type is defined in the configuration object, or // or as a default header, it will be used instead of // 'application/x-www-form-urlencoded; charset=UTF-8' config.headers = Y.merge({ 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' }, config.headers); break; } } if (transaction.xdr) { // Route data to io-xdr module for flash and XDomainRequest. return io.xdr(u, transaction, config); } else if (transaction.notify) { // Route data to custom transport return transaction.c.send(transaction, uri, config); } if (!sync && !transaction.upload) { transaction.c.onreadystatechange = function() { io._rS(transaction, config); }; } try { // Determine if request is to be set as // synchronous or asynchronous. transaction.c.open(method, u, !sync, config.username || null, config.password || null); io._setHeaders(transaction.c, config.headers || {}); io.start(transaction, config); // Will work only in browsers that implement the // Cross-Origin Resource Sharing draft. if (config.xdr && config.xdr.credentials && SUPPORTS_CORS) { transaction.c.withCredentials = true; } // Using "null" with HTTP POST will result in a request // with no Content-Length header defined. transaction.c.send(data); if (sync) { // Create a response object for synchronous transactions, // mixing id and arguments properties with the xhr // properties whitelist. for (i = 0, len = XHR_PROPS.length; i < len; ++i) { response[XHR_PROPS[i]] = transaction.c[XHR_PROPS[i]]; } response.getAllResponseHeaders = function() { return transaction.c.getAllResponseHeaders(); }; response.getResponseHeader = function(name) { return transaction.c.getResponseHeader(name); }; io.complete(transaction, config); io._result(transaction, config); return response; } } catch(e) { if (transaction.xdr) { // This exception is usually thrown by browsers // that do not support XMLHttpRequest Level 2. // Retry the request with the XDR transport set // to 'flash'. If the Flash transport is not // initialized or available, the transaction // will resolve to a transport error. return io._retry(transaction, uri, config); } else { io.complete(transaction, config); io._result(transaction, config); } } // If config.timeout is defined, and the request is standard XHR, // initialize timeout polling. if (config.timeout) { io._startTimeout(transaction, config.timeout); } return { id: transaction.id, abort: function() { return transaction.c ? io._abort(transaction, 'abort') : false; }, isInProgress: function() { return transaction.c ? (transaction.c.readyState % 4) : false; }, io: io }; } }; /** Method for initiating an ajax call. The first argument is the url end point for the call. The second argument is an object to configure the transaction and attach event subscriptions. The configuration object supports the following properties: <dl> <dt>method</dt> <dd>HTTP method verb (e.g., GET or POST). If this property is not not defined, the default value will be GET.</dd> <dt>data</dt> <dd>This is the name-value string that will be sent as the transaction data. If the request is HTTP GET, the data become part of querystring. If HTTP POST, the data are sent in the message body.</dd> <dt>xdr</dt> <dd>Defines the transport to be used for cross-domain requests. By setting this property, the transaction will use the specified transport instead of XMLHttpRequest. The properties of the transport object are: <dl> <dt>use</dt> <dd>The transport to be used: 'flash' or 'native'</dd> <dt>dataType</dt> <dd>Set the value to 'XML' if that is the expected response content type.</dd> </dl></dd> <dt>form</dt> <dd>Form serialization configuration object. Its properties are: <dl> <dt>id</dt> <dd>Node object or id of HTML form</dd> <dt>useDisabled</dt> <dd>`true` to also serialize disabled form field values (defaults to `false`)</dd> </dl></dd> <dt>on</dt> <dd>Assigns transaction event subscriptions. Available events are: <dl> <dt>start</dt> <dd>Fires when a request is sent to a resource.</dd> <dt>complete</dt> <dd>Fires when the transaction is complete.</dd> <dt>success</dt> <dd>Fires when the HTTP response status is within the 2xx range.</dd> <dt>failure</dt> <dd>Fires when the HTTP response status is outside the 2xx range, if an exception occurs, if the transation is aborted, or if the transaction exceeds a configured `timeout`.</dd> <dt>end</dt> <dd>Fires at the conclusion of the transaction lifecycle, after `success` or `failure`.</dd> </dl> <p>Callback functions for `start` and `end` receive the id of the transaction as a first argument. For `complete`, `success`, and `failure`, callbacks receive the id and the response object (usually the XMLHttpRequest instance). If the `arguments` property was included in the configuration object passed to `Y.io()`, the configured data will be passed to all callbacks as the last argument.</p> </dd> <dt>sync</dt> <dd>Pass `true` to make a same-domain transaction synchronous. <strong>CAVEAT</strong>: This will negatively impact the user experience. Have a <em>very</em> good reason if you intend to use this.</dd> <dt>context</dt> <dd>The "`this'" object for all configured event handlers. If a specific context is needed for individual callbacks, bind the callback to a context using `Y.bind()`.</dd> <dt>headers</dt> <dd>Object map of transaction headers to send to the server. The object keys are the header names and the values are the header values.</dd> <dt>timeout</dt> <dd>Millisecond threshold for the transaction before being automatically aborted.</dd> <dt>arguments</dt> <dd>User-defined data passed to all registered event handlers. This value is available as the second argument in the "start" and "end" event handlers. It is the third argument in the "complete", "success", and "failure" event handlers. <strong>Be sure to quote this property name in the transaction configuration as "arguments" is a reserved word in JavaScript</strong> (e.g. `Y.io({ ..., "arguments": stuff })`).</dd> </dl> @method io @static @param {String} url qualified path to transaction resource. @param {Object} config configuration object for the transaction. @return {Object} @for YUI **/ Y.io = function(url, config) { // Calling IO through the static interface will use and reuse // an instance of IO. var transaction = Y.io._map['io:0'] || new IO(); return transaction.send.apply(transaction, [url, config]); }; /** Method for setting and deleting IO HTTP headers to be sent with every request. Hosted as a property on the `io` function (e.g. `Y.io.header`). @method header @param {String} name HTTP header @param {String} value HTTP header value @static **/ Y.io.header = function(name, value) { // Calling IO through the static interface will use and reuse // an instance of IO. var transaction = Y.io._map['io:0'] || new IO(); transaction.setHeader(name, value); }; Y.IO = IO; // Map of all IO instances created. Y.io._map = {}; var XHR = win && win.XMLHttpRequest, XDR = win && win.XDomainRequest, AX = win && win.ActiveXObject, // Checks for the presence of the `withCredentials` in an XHR instance // object, which will be present if the environment supports CORS. SUPPORTS_CORS = XHR && 'withCredentials' in (new XMLHttpRequest()); Y.mix(Y.IO, { /** * The ID of the default IO transport, defaults to `xhr` * @property _default * @type {String} * @static */ _default: 'xhr', /** * * @method defaultTransport * @static * @param {String} [id] The transport to set as the default, if empty a new transport is created. * @return {Object} The transport object with a `send` method */ defaultTransport: function(id) { if (id) { Y.IO._default = id; } else { var o = { c: Y.IO.transports[Y.IO._default](), notify: Y.IO._default === 'xhr' ? false : true }; return o; } }, /** * An object hash of custom transports available to IO * @property transports * @type {Object} * @static */ transports: { xhr: function () { return XHR ? new XMLHttpRequest() : AX ? new ActiveXObject('Microsoft.XMLHTTP') : null; }, xdr: function () { return XDR ? new XDomainRequest() : null; }, iframe: function () { return {}; }, flash: null, nodejs: null }, /** * Create a custom transport of type and return it's object * @method customTransport * @param {String} id The id of the transport to create. * @static */ customTransport: function(id) { var o = { c: Y.IO.transports[id]() }; o[(id === 'xdr' || id === 'flash') ? 'xdr' : 'notify'] = true; return o; } }); Y.mix(Y.IO.prototype, { /** * Fired from the notify method of the transport which in turn fires * the event on the IO object. * @method notify * @param {String} event The name of the event * @param {Object} transaction The transaction object * @param {Object} config The configuration object for this transaction */ notify: function(event, transaction, config) { var io = this; switch (event) { case 'timeout': case 'abort': case 'transport error': transaction.c = { status: 0, statusText: event }; event = 'failure'; default: io[event].apply(io, [transaction, config]); } } }); }, '@VERSION@', {"requires": ["event-custom-base", "querystring-stringify-simple"]});
wil93/cdnjs
ajax/libs/yui/3.10.0/io-base/io-base.js
JavaScript
mit
34,110
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "prie\u0161piet", "popiet" ], "DAY": [ "sekmadienis", "pirmadienis", "antradienis", "tre\u010diadienis", "ketvirtadienis", "penktadienis", "\u0161e\u0161tadienis" ], "MONTH": [ "sausio", "vasaris", "kovas", "balandis", "gegu\u017e\u0117", "bir\u017eelis", "liepa", "rugpj\u016btis", "rugs\u0117jis", "spalis", "lapkritis", "gruodis" ], "SHORTDAY": [ "Sk", "Pr", "An", "Tr", "Kt", "Pn", "\u0160t" ], "SHORTMONTH": [ "Saus.", "Vas", "Kov.", "Bal.", "Geg.", "Bir.", "Liep.", "Rugp.", "Rugs.", "Spal.", "Lapkr.", "Gruod." ], "fullDate": "y 'm'. MMMM d 'd'., EEEE", "longDate": "y 'm'. MMMM d 'd'.", "medium": "y MMM d HH:mm:ss", "mediumDate": "y MMM d", "mediumTime": "HH:mm:ss", "short": "yyyy-MM-dd HH:mm", "shortDate": "yyyy-MM-dd", "shortTime": "HH:mm" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "Lt", "DECIMAL_SEP": ",", "GROUP_SEP": "\u00a0", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "macFrac": 0, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "macFrac": 0, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "-", "negSuf": "\u00a0\u00a4", "posPre": "", "posSuf": "\u00a0\u00a4" } ] }, "id": "lt-lt", "pluralCat": function (n) { if (n % 10 == 1 && (n % 100 < 11 || n % 100 > 19)) { return PLURAL_CATEGORY.ONE; } if (n == (n | 0) && n % 10 >= 2 && n % 10 <= 9 && (n % 100 < 11 || n % 100 > 19)) { return PLURAL_CATEGORY.FEW; } return PLURAL_CATEGORY.OTHER;} }); }]);
stefanneculai/cdnjs
ajax/libs/angular-i18n/1.2.0/angular-locale_lt-lt.js
JavaScript
mit
2,225
/*************** Details ***************/ /*! * Velocity.js: Accelerated JavaScript animation. * @version 0.0.18 * @docs http://velocityjs.org * @license Copyright 2014 Julian Shapiro. MIT License: http://en.wikipedia.org/wiki/MIT_License */ /**************** Summary ****************/ /* Velocity is a concise CSS manipulation library with a performant animation stack built on top of it. To minimize DOM interaction, Velocity reuses previous animation values and batches DOM queries wherever possible. Whenever Velocity triggers a DOM query (a GET) or a DOM update (a SET), a comment indicating such is placed next to the offending line of code. To learn more about the nuances of DOM performance, check out these talks: https://www.youtube.com/watch?v=cmZqLzPy0XE and https://www.youtube.com/watch?v=n8ep4leoN9A. Velocity is structured into four sections: - CSS Stack: Works independently from the rest of Velocity. - Velocity.animate() is the core animation method that iterates over the targeted element set and queues the incoming Velocity animation onto each element individually. This process consists of: - Pre-Queueing: Prepare the element for animation by instantiating its data cache and processing the call's options argument. - Queueing: The logic that runs once the call has reached its point of execution in the element's $.queue() stack. Most logic is placed here to avoid risking it becoming stale. - Pushing: Consolidation of the tween data followed by its push onto the global in-progress calls container. - tick(): The single requestAnimationFrame loop responsible for tweening all in-progress calls. - completeCall(): Handles the cleanup process for each Velocity call. The biggest cause of both codebase bloat and codepath obfuscation is support for animating individual values of compound-value CSS properties (e.g. "textShadowBlur" in "textShadow: 0px 0px 0px black"). */ /* NOTICE: Despite the ensuing code indicating that Velocity works *without* jQuery and *with* Zepto, this support has not yet landed. */ ;(function (global, window, document, undefined) { /***************** Constants *****************/ var NAME = "velocity", DEFAULT_DURATION = 400, DEFAULT_EASING = "swing"; /********************* Helper Functions *********************/ /* IE detection. Gist: https://gist.github.com/julianshapiro/9098609 */ var IE = (function() { if (document.documentMode) { return document.documentMode; } else { for (var i = 7; i > 4; i--) { var div = document.createElement("div"); div.innerHTML = "<!--[if IE " + i + "]><span></span><![endif]-->"; if (div.getElementsByTagName("span").length) { div = null; return i; } } } return undefined; })(); /* RAF polyfill. Gist: https://gist.github.com/julianshapiro/9497513 */ var requestAnimationFrame = window.requestAnimationFrame || (function() { var timeLast = 0; return window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) { var timeCurrent = (new Date()).getTime(), timeDelta; /* Dynamically set delay on a per-tick basis to match 60fps. */ /* Technique by Erik Moller. MIT license: https://gist.github.com/paulirish/1579671 */ timeDelta = Math.max(0, 16 - (timeCurrent - timeLast)); timeLast = timeCurrent + timeDelta; return setTimeout(function() { callback(timeCurrent + timeDelta); }, timeDelta); }; })(); /* Sparse array compacting. Copyright Lo-Dash. MIT License: https://github.com/lodash/lodash/blob/master/LICENSE.txt */ function compactSparseArray (array) { var index = -1, length = array ? array.length : 0, result = []; while (++index < length) { var value = array[index]; if (value) { result.push(value); } } return result; } /* Determine if a variable is a function. */ function isFunction (variable) { return Object.prototype.toString.call(variable) === "[object Function]"; } /* Determine if a variable is an array. */ var isArray = Array.isArray || function (variable) { return Object.prototype.toString.call(variable) === "[object Array]"; } /* Determine if a variable is a nodeList. Copyright Martin Bohm. MIT License: https://gist.github.com/Tomalak/818a78a226a0738eaade */ function isNodeList (nodes) { var stringRepresentation = Object.prototype.toString.call(nodes); return typeof nodes === "object" && /^\[object (HTMLCollection|NodeList|Object)\]$/.test(stringRepresentation) && nodes.length !== undefined && (nodes.length === 0 || (typeof nodes[0] === "object" && nodes[0].nodeType > 0)); } /* Determine if variable is a wrapped jQuery or Zepto element. */ function isWrapped (elements) { return elements.jquery || (window.Zepto && window.Zepto.zepto.isZ(elements)) } /****************** Dependencies ******************/ /* Local to our Velocity scope, assign $ to our jQuery shim if jQuery itself isn't loaded. (The shim is a port of the jQuery utility functions that Velocity uses.) */ /* Note: We can't default to Zepto since the shimless version of Velocity does not work with Zepto, which is missing several utility functions that Velocity requires. */ var $ = window.jQuery || (global.Velocity && global.Velocity.Utilities); if (!$) { throw new Error("Velocity: Either jQuery or Velocity's jQuery shim must first be loaded.") /* We allow the global Velocity variable to pre-exist so long as we were responsible for its creation (via the jQuery shim, which uniquely assigns a Utilities property to the Velocity object). */ } else if (global.Velocity !== undefined && !global.Velocity.Utilities) { throw new Error("Velocity: Namespace is occupied."); /* Nothing prevents Velocity from working on IE6+7, but it is not worth the time to test on them. Revert to jQuery's $.animate(), and lose Velocity's extra features. */ } else if (IE <= 7) { if (!window.jQuery) { throw new Error("Velocity: For IE<=7, Velocity falls back to jQuery, which must first be loaded."); } else { window.jQuery.fn.velocity = window.jQuery.fn.animate; /* Now that $.fn.velocity is aliased, abort this Velocity declaration. */ return; } /* IE8 doesn't work with the jQuery shim; it requires jQuery proper. */ } else if (IE === 8 && !window.jQuery) { throw new Error("Velocity: For IE8, Velocity requires jQuery to be loaded. (Velocity's jQuery shim does not work with IE8.)"); } /************* State *************/ /* Velocity registers itself onto a global container (window.jQuery || window.Zepto || window) so that that certain features are accessible beyond just a per-element scope. This master object contains an .animate() method, which is later assigned to $.fn (if jQuery or Zepto are present). Accordingly, Velocity can both act on wrapped DOM elements and stand alone for targeting raw DOM elements. */ /* Note: The global object also doubles as a publicly-accessible data store for the purposes of unit testing. (Capitalized objects are meant for private use, lowercase objects are meant for public use.) */ /* Note: We alias both the lowercase and uppercase variants of "velocity" to minimize user issues due to the lowercase nature of the $.fn extension. */ var Velocity = global.Velocity = global.velocity = $.extend(global.Velocity || {}, { /* Container for page-wide Velocity state data. */ State: { /* Detect mobile devices to determine if mobileHA should be turned on. */ isMobile: /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), /* The mobileHA option's behavior changes on older Android devices (Gingerbread, versions 2.3.3-2.3.7). */ isAndroid: /Android/i.test(navigator.userAgent), isGingerbread: /Android 2\.3\.[3-7]/i.test(navigator.userAgent), /* Create a cached element for re-use when checking for CSS property prefixes. */ prefixElement: document.createElement("div"), /* Cache every prefix match to avoid repeating lookups. */ prefixMatches: {}, /* Cache the anchor used for animating window scrolling. */ scrollAnchor: null, /* Cache the property names associated with the scroll anchor. */ scrollPropertyLeft: null, scrollPropertyTop: null, /* Keep track of whether our RAF tick is running. */ isTicking: false, /* Container for every in-progress call to Velocity. */ calls: [] }, /* Velocity's custom CSS stack. Made global for unit testing. */ CSS: { /* Defined below. */ }, Utilities: { /* Defined by Velocity's optional jQuery shim. */ }, /* Container for the user's custom animation sequences that are referenced by name via Velocity's first argument (in place of a properties map object). */ Sequences: { /* Manually registered by the user. Learn more: VelocityJS.org/#sequences */ }, Easings: { /* Defined below. */ }, /* Page-wide option defaults, which can be overriden by the user. */ defaults: { queue: "", duration: DEFAULT_DURATION, easing: DEFAULT_EASING, complete: null, display: null, loop: false, delay: false, mobileHA: true, /* Set to false to prevent property values from being cached between immediately consecutive Velocity-initiated calls. See Value Transferring for further details. */ _cacheValues: true }, /* Velocity's core animation method, subsequently aliased to $.fn. */ animate: function () { /* Defined below. */ }, /* Set to 1 or 2 (most verbose) to output debug info to console. */ debug: false }); /* Retrieve the appropriate scroll anchor and property name for the browser. Learn more: https://developer.mozilla.org/en-US/docs/Web/API/Window.scrollY */ if (window.pageYOffset !== undefined) { Velocity.State.scrollAnchor = window; Velocity.State.scrollPropertyLeft = "pageXOffset"; Velocity.State.scrollPropertyTop = "pageYOffset"; } else { Velocity.State.scrollAnchor = document.documentElement || document.body.parentNode || document.body; Velocity.State.scrollPropertyLeft = "scrollLeft"; Velocity.State.scrollPropertyTop = "scrollTop"; } /************** Easing **************/ /* Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */ var generateBezier = (function () { function A (aA1, aA2) { return 1.0 - 3.0 * aA2 + 3.0 * aA1; } function B (aA1, aA2) { return 3.0 * aA2 - 6.0 * aA1; } function C (aA1) { return 3.0 * aA1; } function calcBezier (aT, aA1, aA2) { return ((A(aA1, aA2)*aT + B(aA1, aA2))*aT + C(aA1))*aT; } function getSlope (aT, aA1, aA2) { return 3.0 * A(aA1, aA2)*aT*aT + 2.0 * B(aA1, aA2) * aT + C(aA1); } return function (mX1, mY1, mX2, mY2) { /* Must contain four arguments. */ if (arguments.length !== 4) { return false; } /* Arguments must be numbers. */ for (var i = 0; i < 4; ++i) { if (typeof arguments[i] !== "number" || isNaN(arguments[i]) || !isFinite(arguments[i])) { return false; } } /* X values must be in the [0, 1] range. */ mX1 = Math.min(mX1, 1); mX2 = Math.min(mX2, 1); mX1 = Math.max(mX1, 0); mX2 = Math.max(mX2, 0); function getTForX (aX) { var aGuessT = aX; for (var i = 0; i < 8; ++i) { var currentSlope = getSlope(aGuessT, mX1, mX2); if (currentSlope === 0.0) { return aGuessT; } var currentX = calcBezier(aGuessT, mX1, mX2) - aX; aGuessT -= currentX / currentSlope; } return aGuessT; } return function (aX) { if (mX1 === mY1 && mX2 === mY2) { return aX; } else { return calcBezier(getTForX(aX), mY1, mY2); } }; }; }()); /* Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */ /* Given a tension, friction, and duration, a simulation at 60FPS will first run without a defined duration in order to calculate the full path. A second pass then adjusts the time dela -- using the relation between actual time and duration -- to calculate the path for the duration-constrained animation. */ var generateSpringRK4 = (function () { function springAccelerationForState (state) { return (-state.tension * state.x) - (state.friction * state.v); } function springEvaluateStateWithDerivative (initialState, dt, derivative) { var state = { x: initialState.x + derivative.dx * dt, v: initialState.v + derivative.dv * dt, tension: initialState.tension, friction: initialState.friction }; return { dx: state.v, dv: springAccelerationForState(state) }; } function springIntegrateState (state, dt) { var a = { dx: state.v, dv: springAccelerationForState(state) }, b = springEvaluateStateWithDerivative(state, dt * 0.5, a), c = springEvaluateStateWithDerivative(state, dt * 0.5, b), d = springEvaluateStateWithDerivative(state, dt, c), dxdt = 1.0 / 6.0 * (a.dx + 2.0 * (b.dx + c.dx) + d.dx), dvdt = 1.0 / 6.0 * (a.dv + 2.0 * (b.dv + c.dv) + d.dv); state.x = state.x + dxdt * dt; state.v = state.v + dvdt * dt; return state; } return function springRK4Factory (tension, friction, duration) { var initState = { x: -1, v: 0, tension: null, friction: null }, path = [0], time_lapsed = 0, tolerance = 1 / 10000, DT = 16 / 1000, have_duration, dt, last_state; tension = parseFloat(tension) || 600; friction = parseFloat(friction) || 20; duration = duration || null; initState.tension = tension; initState.friction = friction; have_duration = duration !== null; /* Calculate the actual time it takes for this animation to complete with the provided conditions. */ if (have_duration) { /* Run the simulation without a duration. */ time_lapsed = springRK4Factory(tension, friction); /* Compute the adjusted time delta. */ dt = time_lapsed / duration * DT; } else { dt = DT; } while (true) { /* Next/step function .*/ last_state = springIntegrateState(last_state || initState, dt); /* Store the position. */ path.push(1 + last_state.x); time_lapsed += 16; /* If the change threshold is reached, break. */ if (!(Math.abs(last_state.x) > tolerance && Math.abs(last_state.v) > tolerance)) { break; } } /* If duration is not defined, return the actual time required for completing this animation. Otherwise, return a closure that holds the computed path and returns a snapshot of the position according to a given percentComplete. */ return !have_duration ? time_lapsed : function(percentComplete) { return path[ (percentComplete * (path.length - 1)) | 0 ]; }; }; }()); /* Velocity embeds the named easings from jQuery, jQuery UI, and CSS3 in order to save users from having to include additional libraries on their page. */ (function () { /* jQuery's default named easing types. */ Velocity.Easings["linear"] = function(p) { return p; }; Velocity.Easings["swing"] = function(p) { return 0.5 - Math.cos(p * Math.PI) / 2; }; /* CSS3's named easing types. */ Velocity.Easings["ease"] = generateBezier(0.25, 0.1, 0.25, 1.0); Velocity.Easings["ease-in"] = generateBezier(0.42, 0.0, 1.00, 1.0); Velocity.Easings["ease-out"] = generateBezier(0.00, 0.0, 0.58, 1.0); Velocity.Easings["ease-in-out"] = generateBezier(0.42, 0.0, 0.58, 1.0); /* jQuery UI's Robert Penner easing equations. Copyright The jQuery Foundation. MIT License: https://jquery.org/license */ var baseEasings = {}; $.each(["Quad", "Cubic", "Quart", "Quint", "Expo"], function(i, name) { baseEasings[name] = function(p) { return Math.pow(p, i + 2); }; }); $.extend(baseEasings, { Sine: function (p) { return 1 - Math.cos(p * Math.PI / 2); }, Circ: function (p) { return 1 - Math.sqrt(1 - p * p); }, Elastic: function(p) { return p === 0 || p === 1 ? p : -Math.pow(2, 8 * (p - 1)) * Math.sin(((p - 1) * 80 - 7.5) * Math.PI / 15); }, Back: function(p) { return p * p * (3 * p - 2); }, Bounce: function (p) { var pow2, bounce = 4; while (p < ((pow2 = Math.pow(2, --bounce)) - 1) / 11) {} return 1 / Math.pow(4, 3 - bounce) - 7.5625 * Math.pow((pow2 * 3 - 2) / 22 - p, 2); } }); /* jQuery's easing generator for the object above. */ $.each(baseEasings, function(name, easeIn) { Velocity.Easings["easeIn" + name] = easeIn; Velocity.Easings["easeOut" + name] = function(p) { return 1 - easeIn(1 - p); }; Velocity.Easings["easeInOut" + name] = function(p) { return p < 0.5 ? easeIn(p * 2) / 2 : 1 - easeIn(p * -2 + 2) / 2; }; }); /* Bonus "spring" easing, which is a less exaggerated version of easeInOutElastic. */ Velocity.Easings["spring"] = function(p) { return 1 - (Math.cos(p * 4.5 * Math.PI) * Math.exp(-p * 6)); }; })(); /* Determine the appropriate easing type given an easing input. */ function getEasing(value, duration) { var easing = value; /* The easing option can either be a string that references a pre-registered easing, or it can be a two-/four-item array of integers to be converted into a bezier/spring function. */ if (typeof value === "string") { /* Ensure that the easing has been assigned to jQuery's Velocity.Easings object. */ if (!Velocity.Easings[value]) { easing = false; } } else if (isArray(value) && value.length === 2) { /* springRK4 must be passed the animation's duration. */ /* Note: If the springRK4 array contains non-numbers, generateSpringRK4() returns an easing function generated with default tension and friction values. */ easing = generateSpringRK4.apply(null, value.concat([ duration ])); } else if (isArray(value) && value.length === 4) { /* Note: If the bezier array contains non-numbers, generateBezier() returns false. */ easing = generateBezier.apply(null, value); } else { easing = false; } /* Revert to the Velocity-wide default easing type, or fall back to "swing" (which is also jQuery's default) if the Velocity-wide default has been incorrectly modified. */ if (easing === false) { if (Velocity.Easings[Velocity.defaults.easing]) { easing = Velocity.defaults.easing; } else { easing = DEFAULT_EASING; } } return easing; } /***************** CSS Stack *****************/ /* The CSS object is a highly condensed and performant CSS stack that fully replaces jQuery's. It handles the validation, getting, and setting of both standard CSS properties and CSS property hooks. */ /* Note: A "CSS" shorthand is aliased so that our code is easier to read. */ var CSS = Velocity.CSS = { /************* RegEx *************/ RegEx: { /* Unwrap a property value's surrounding text, e.g. "rgba(4, 3, 2, 1)" ==> "4, 3, 2, 1" and "rect(4px 3px 2px 1px)" ==> "4px 3px 2px 1px". */ valueUnwrap: /^[A-z]+\((.*)\)$/i, wrappedValueAlreadyExtracted: /[0-9.]+ [0-9.]+ [0-9.]+( [0-9.]+)?/, /* Split a multi-value property into an array of subvalues, e.g. "rgba(4, 3, 2, 1) 4px 3px 2px 1px" ==> [ "rgba(4, 3, 2, 1)", "4px", "3px", "2px", "1px" ]. */ valueSplit: /([A-z]+\(.+\))|(([A-z0-9#-.]+?)(?=\s|$))/ig }, /************ Hooks ************/ /* Hooks allow a subproperty (e.g. "boxShadowBlur") of a compound-value CSS property (e.g. "boxShadow: X Y Blur Spread Color") to be animated as if it were a discrete property. */ /* Note: Beyond enabling fine-grained property animation, hooking is necessary since Velocity only tweens properties with single numeric values; unlike CSS transitions, Velocity does not interpolate compound-values. */ Hooks: { /******************** Registration ********************/ /* Templates are a concise way of indicating which subproperties must be individually registered for each compound-value CSS property. */ /* Each template consists of the compound-value's base name, its constituent subproperty names, and those subproperties' default values. */ templates: { /* Note: Colors are defaulted to white -- as opposed to black -- since colors that are currently set to "transparent" default to their respective template below when color-animated, and white is typically a closer match to transparent than black is. */ "color": [ "Red Green Blue Alpha", "255 255 255 1" ], "backgroundColor": [ "Red Green Blue Alpha", "255 255 255 1" ], "borderColor": [ "Red Green Blue Alpha", "255 255 255 1" ], "borderTopColor": [ "Red Green Blue Alpha", "255 255 255 1" ], "borderRightColor": [ "Red Green Blue Alpha", "255 255 255 1" ], "borderBottomColor": [ "Red Green Blue Alpha", "255 255 255 1" ], "borderLeftColor": [ "Red Green Blue Alpha", "255 255 255 1" ], "outlineColor": [ "Red Green Blue Alpha", "255 255 255 1" ], "textShadow": [ "Color X Y Blur", "black 0px 0px 0px" ], /* Todo: Add support for inset boxShadows. (webkit places it last whereas IE places it first.) */ "boxShadow": [ "Color X Y Blur Spread", "black 0px 0px 0px 0px" ], "clip": [ "Top Right Bottom Left", "0px 0px 0px 0px" ], "backgroundPosition": [ "X Y", "0% 0%" ], "transformOrigin": [ "X Y Z", "50% 50% 0%" ], "perspectiveOrigin": [ "X Y", "50% 50%" ] }, /* A "registered" hook is one that has been converted from its template form into a live, tweenable property. It contains data to associate it with its root property. */ registered: { /* Note: A registered hook looks like this ==> textShadowBlur: [ "textShadow", 3 ], which consists of the subproperty's name, the associated root property's name, and the subproperty's position in the root's value. */ }, /* Convert the templates into individual hooks then append them to the registered object above. */ register: function () { var rootProperty, hookTemplate, hookNames; /* In IE, color values inside compound-value properties are positioned at the end the value instead of at the beginning. Thus, we re-arrange the templates accordingly. */ if (IE) { for (rootProperty in CSS.Hooks.templates) { hookTemplate = CSS.Hooks.templates[rootProperty]; hookNames = hookTemplate[0].split(" "); var defaultValues = hookTemplate[1].match(CSS.RegEx.valueSplit); if (hookNames[0] === "Color") { /* Reposition both the hook's name and its default value to the end of their respective strings. */ hookNames.push(hookNames.shift()); defaultValues.push(defaultValues.shift()); /* Replace the existing template for the hook's root property. */ CSS.Hooks.templates[rootProperty] = [ hookNames.join(" "), defaultValues.join(" ") ]; } } } /* Hook registration. */ for (rootProperty in CSS.Hooks.templates) { hookTemplate = CSS.Hooks.templates[rootProperty]; hookNames = hookTemplate[0].split(" "); for (var i in hookNames) { var fullHookName = rootProperty + hookNames[i], hookPosition = i; /* For each hook, register its full name (e.g. textShadowBlur) with its root property (e.g. textShadow) and the hook's position in its template's default value string. */ CSS.Hooks.registered[fullHookName] = [ rootProperty, hookPosition ]; } } }, /***************************** Injection and Extraction *****************************/ /* Look up the root property associated with the hook (e.g. return "textShadow" for "textShadowBlur"). */ /* Since a hook cannot be set directly (the browser won't recognize it), style updating for hooks is routed through the hook's root property. */ getRoot: function (property) { var hookData = CSS.Hooks.registered[property]; if (hookData) { return hookData[0]; } else { /* If there was no hook match, return the property name untouched. */ return property; } }, /* Convert any rootPropertyValue, null or otherwise, into a space-delimited list of hook values so that the targeted hook can be injected or extracted at its standard position. */ cleanRootPropertyValue: function(rootProperty, rootPropertyValue) { /* If the rootPropertyValue is wrapped with "rgb()", "clip()", etc., remove the wrapping to normalize the value before manipulation. */ if (CSS.RegEx.valueUnwrap.test(rootPropertyValue)) { rootPropertyValue = rootPropertyValue.match(CSS.Hooks.RegEx.valueUnwrap)[1]; } /* If rootPropertyValue is a CSS null-value (from which there's inherently no hook value to extract), default to the root's default value as defined in CSS.Hooks.templates. */ /* Note: CSS null-values include "none", "auto", and "transparent". They must be converted into their zero-values (e.g. textShadow: "none" ==> textShadow: "0px 0px 0px black") for hook manipulation to proceed. */ if (CSS.Values.isCSSNullValue(rootPropertyValue)) { rootPropertyValue = CSS.Hooks.templates[rootProperty][1]; } return rootPropertyValue; }, /* Extracted the hook's value from its root property's value. This is used to get the starting value of an animating hook. */ extractValue: function (fullHookName, rootPropertyValue) { var hookData = CSS.Hooks.registered[fullHookName]; if (hookData) { var hookRoot = hookData[0], hookPosition = hookData[1]; rootPropertyValue = CSS.Hooks.cleanRootPropertyValue(hookRoot, rootPropertyValue); /* Split rootPropertyValue into its constituent hook values then grab the desired hook at its standard position. */ return rootPropertyValue.toString().match(CSS.RegEx.valueSplit)[hookPosition]; } else { /* If the provided fullHookName isn't a registered hook, return the rootPropertyValue that was passed in. */ return rootPropertyValue; } }, /* Inject the hook's value into its root property's value. This is used to piece back together the root property once Velocity has updated one of its individually hooked values through tweening. */ injectValue: function (fullHookName, hookValue, rootPropertyValue) { var hookData = CSS.Hooks.registered[fullHookName]; if (hookData) { var hookRoot = hookData[0], hookPosition = hookData[1], rootPropertyValueParts, rootPropertyValueUpdated; rootPropertyValue = CSS.Hooks.cleanRootPropertyValue(hookRoot, rootPropertyValue); /* Split rootPropertyValue into its individual hook values, replace the targeted value with hookValue, then reconstruct the rootPropertyValue string. */ rootPropertyValueParts = rootPropertyValue.toString().match(CSS.RegEx.valueSplit); rootPropertyValueParts[hookPosition] = hookValue; rootPropertyValueUpdated = rootPropertyValueParts.join(" "); return rootPropertyValueUpdated; } else { /* If the provided fullHookName isn't a registered hook, return the rootPropertyValue that was passed in. */ return rootPropertyValue; } } }, /******************* Normalizations *******************/ /* Normalizations standardize CSS property manipulation by pollyfilling browser-specific implementations (e.g. opacity) and reformatting special properties (e.g. clip, rgba) to look like standard ones. */ Normalizations: { /* Normalizations are passed a normalization target (either the property's name, its extracted value, or its injected value), the targeted element (which may need to be queried), and the targeted property value. */ registered: { clip: function(type, element, propertyValue) { switch (type) { case "name": return "clip"; /* Clip needs to be unwrapped and stripped of its commas during extraction. */ case "extract": var extracted; /* If Velocity also extracted this value, skip extraction. */ if (CSS.RegEx.wrappedValueAlreadyExtracted.test(propertyValue)) { extracted = propertyValue; } else { /* Remove the "rect()" wrapper. */ extracted = propertyValue.toString().match(CSS.RegEx.valueUnwrap); /* Strip off commas. */ extracted = extracted ? extracted[1].replace(/,(\s+)?/g, " ") : propertyValue; } return extracted; /* Clip needs to be re-wrapped during injection. */ case "inject": return "rect(" + propertyValue + ")"; } }, /* <=IE8 do not support the standard opacity property. They use filter:alpha(opacity=INT) instead. */ opacity: function (type, element, propertyValue) { if (IE <= 8) { switch (type) { case "name": return "filter"; case "extract": /* <=IE8 return a "filter" value of "alpha(opacity=\d{1,3})". Extract the value and convert it to a decimal value to match the standard CSS opacity property's formatting. */ var extracted = propertyValue.toString().match(/alpha\(opacity=(.*)\)/i); if (extracted) { /* Convert to decimal value. */ propertyValue = extracted[1] / 100; } else { /* When extracting opacity, default to 1 (fully visible) since a null value means opacity hasn't been set and the element is therefore fully visible. */ propertyValue = 1; } return propertyValue; case "inject": /* Opacified elements are required to have their zoom property set to a non-zero value. */ element.style.zoom = 1; /* Setting the filter property on elements with certain font property combinations can result in a highly unappealing ultra-bolding effect. There's no way to remedy this throughout a tween, but dropping the value altogether (when opacity hits 1) at leasts ensures that the glitch is gone post-tweening. */ if (parseFloat(propertyValue) >= 1) { return ""; } else { /* As per the filter property's spec, convert the decimal value to a whole number and wrap the value. */ return "alpha(opacity=" + parseInt(parseFloat(propertyValue) * 100, 10) + ")"; } } /* With all other browsers, normalization is not required; return the same values that were passed in. */ } else { switch (type) { case "name": return "opacity"; case "extract": return propertyValue; case "inject": return propertyValue; } } } }, /***************************** Batched Registrations *****************************/ /* Note: Batched normalizations extend the CSS.Normalizations.registered object. */ register: function () { /***************** Transforms *****************/ /* Transforms are the subproperties contained by the CSS "transform" property. Transforms must undergo normalization so that they can be referenced in a properties map by their individual names. */ /* Note: When transforms are "set", they are actually assigned to a per-element transformCache. When all transform setting is complete complete, CSS.flushTransformCache() must be manually called to flush the values to the DOM. Transform setting is batched in this way to improve performance: the transform style only needs to be updated once when multiple transform subproperties are being animated simultaneously. */ var transformProperties = [ "translateX", "translateY", "scale", "scaleX", "scaleY", "skewX", "skewY", "rotateZ" ]; /* IE9 and Android Gingerbread have support for 2D -- but not 3D -- transforms. Since animating unsupported transform properties results in the browser ignoring the *entire* transform string, we prevent these 3D values from being normalized for these browsers so that tweening skips these properties altogether (since it will ignore them as being unsupported by the browser.) */ if (!(IE <= 9) && !Velocity.State.isGingerbread) { /* Append 3D transform properties onto transformProperties. */ /* Note: Since the standalone CSS "perspective" property and the CSS transform "perspective" subproperty share the same name, the latter is given a unique token within Velocity: "transformPerspective". */ transformProperties = transformProperties.concat([ "transformPerspective", "translateZ", "scaleZ", "rotateX", "rotateY" ]); } for (var i = 0, transformPropertiesLength = transformProperties.length; i < transformPropertiesLength; i++) { /* Wrap the dynamically generated normalization function in a new scope so that transformName's value is paired with its respective function. (Otherwise, all functions would take the final for loop's transformName.) */ (function() { var transformName = transformProperties[i]; CSS.Normalizations.registered[transformName] = function (type, element, propertyValue) { switch (type) { /* The normalized property name is the parent "transform" property -- the property that is actually set in CSS. */ case "name": return "transform"; /* Transform values are cached onto a per-element transformCache object. */ case "extract": /* If this transform has yet to be assigned a value, return its null value. */ if ($.data(element, NAME).transformCache[transformName] === undefined) { /* Scale transformProperties default to 1 whereas all other transform properties default to 0. */ return /^scale/i.test(transformName) ? 1 : 0; /* When transform values are set, they are wrapped in parentheses as per the CSS spec. Thus, when extracting their values (for tween calculations), we strip off the parentheses. */ } else { return $.data(element, NAME).transformCache[transformName].replace(/[()]/g, ""); } case "inject": var invalid = false; /* If an individual transform property contains an unsupported unit type, the browser ignores the *entire* transform property. Thus, protect users from themselves by skipping setting for transform values supplied with invalid unit types. */ /* Switch on the base transform type; ignore the axis by removing the last letter from the transform's name. */ switch (transformName.substr(0, transformName.length - 1)) { /* Whitelist unit types for each transform. */ case "translate": invalid = !/(%|px|em|rem|\d)$/i.test(propertyValue); break; /* Since an axis-free "scale" property is supported as well, a little hack is used here to detect it by chopping off its last letter. */ case "scal": case "scale": /* Chrome on Android has a bug in which scaled elements blur if their initial scale value is below 1 (which can happen with forcefeeding). Thus, we detect a yet-unset scale property and ensure that its first value is always 1. More info here: http://stackoverflow.com/questions/10417890/css3-animations-with-transform-causes-blurred-elements-on-webkit/10417962#10417962 */ if (Velocity.State.isAndroid && $.data(element, NAME).transformCache[transformName] === undefined) { propertyValue = 1; } invalid = !/(\d)$/i.test(propertyValue); break; case "skew": invalid = !/(deg|\d)$/i.test(propertyValue); break; case "rotate": invalid = !/(deg|\d)$/i.test(propertyValue); break; } if (!invalid) { /* As per the CSS spec, wrap the value in parentheses. */ $.data(element, NAME).transformCache[transformName] = "(" + propertyValue + ")"; } /* Although the value is set on the transformCache object, return the newly-updated value for the calling code to process as normal. */ return $.data(element, NAME).transformCache[transformName]; } }; })(); } /************* Colors *************/ /* Since Velocity only animates a single numeric value per property, color animation is achieved by hooking the individual RGBA components of CSS color properties. Accordingly, color values must be normalized (e.g. "#ff0000", "red", and "rgb(255, 0, 0)" ==> "255 0 0 1") so that their components can be injected/extracted by CSS.Hooks logic. */ var colorProperties = [ "color", "backgroundColor", "borderColor", "borderTopColor", "borderRightColor", "borderBottomColor", "borderLeftColor", "outlineColor" ]; for (var i = 0, colorPropertiesLength = colorProperties.length; i < colorPropertiesLength; i++) { /* Hex to RGB conversion. Copyright Tim Down: http://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb */ function hexToRgb (hex) { var shortformRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i, longformRegex = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i, rgbParts; hex = hex.replace(shortformRegex, function (m, r, g, b) { return r + r + g + g + b + b; }); rgbParts = longformRegex.exec(hex); return rgbParts ? "rgb(" + (parseInt(rgbParts[1], 16) + " " + parseInt(rgbParts[2], 16) + " " + parseInt(rgbParts[3], 16)) + ")" : "rgb(0 0 0)"; } /* Wrap the dynamically generated normalization function in a new scope so that colorName's value is paired with its respective function. (Otherwise, all functions would take the final for loop's colorName.) */ (function () { var colorName = colorProperties[i]; /* Note: In IE<=8, which support rgb but not rgba, colorProperties are reverted to rgb by stripping off the alpha component. */ CSS.Normalizations.registered[colorName] = function(type, element, propertyValue) { switch (type) { case "name": return colorName; /* Convert all color values into the rgb format. (Old IE can return hex values and color names instead of rgb/rgba.) */ case "extract": var extracted; /* If the color is already in its hookable form (e.g. "255 255 255 1") due to having been previously extracted, skip extraction. */ if (CSS.RegEx.wrappedValueAlreadyExtracted.test(propertyValue)) { extracted = propertyValue; } else { var converted, colorNames = { aqua: "rgb(0, 255, 255);", black: "rgb(0, 0, 0)", blue: "rgb(0, 0, 255)", fuchsia: "rgb(255, 0, 255)", gray: "rgb(128, 128, 128)", green: "rgb(0, 128, 0)", lime: "rgb(0, 255, 0)", maroon: "rgb(128, 0, 0)", navy: "rgb(0, 0, 128)", olive: "rgb(128, 128, 0)", purple: "rgb(128, 0, 128)", red: "rgb(255, 0, 0)", silver: "rgb(192, 192, 192)", teal: "rgb(0, 128, 128)", white: "rgb(255, 255, 255)", yellow: "rgb(255, 255, 0)" }; /* Convert color names to rgb. */ if (/^[A-z]+$/i.test(propertyValue)) { if (colorNames[propertyValue] !== undefined) { converted = colorNames[propertyValue] } else { /* If an unmatched color name is provided, default to black. */ converted = colorNames.black; } /* Convert hex values to rgb. */ } else if (/^#([A-f\d]{3}){1,2}$/i.test(propertyValue)) { converted = hexToRgb(propertyValue); /* If the provided color doesn't match any of the accepted color formats, default to black. */ } else if (!(/^rgba?\(/i.test(propertyValue))) { converted = colorNames.black; } /* Remove the surrounding "rgb/rgba()" string then replace commas with spaces and strip repeated spaces (in case the value included spaces to begin with). */ extracted = (converted || propertyValue).toString().match(CSS.RegEx.valueUnwrap)[1].replace(/,(\s+)?/g, " "); } /* So long as this isn't <=IE8, add a fourth (alpha) component if it's missing and default it to 1 (visible). */ if (!(IE <= 8) && extracted.split(" ").length === 3) { extracted += " 1"; } return extracted; case "inject": /* If this is IE<=8 and an alpha component exists, strip it off. */ if (IE <= 8) { if (propertyValue.split(" ").length === 4) { propertyValue = propertyValue.split(/\s+/).slice(0, 3).join(" "); } /* Otherwise, add a fourth (alpha) component if it's missing and default it to 1 (visible). */ } else if (propertyValue.split(" ").length === 3) { propertyValue += " 1"; } /* Re-insert the browser-appropriate wrapper("rgb/rgba()"), insert commas, and strip off decimal units on all values but the fourth (R, G, and B only accept whole numbers). */ return (IE <= 8 ? "rgb" : "rgba") + "(" + propertyValue.replace(/\s+/g, ",").replace(/\.(\d)+(?=,)/g, "") + ")"; } }; })(); } } }, /************************ CSS Property Names ************************/ Names: { /* Camelcase a property name into its JavaScript notation (e.g. "background-color" ==> "backgroundColor"). Camelcasing is used to normalize property names between and across calls. */ camelCase: function (property) { return property.replace(/-(\w)/g, function (match, subMatch) { return subMatch.toUpperCase(); }); }, /* Determine whether a property should be set with a vendor prefix. */ /* If a prefixed version of the property exists, return it. Otherwise, return the original property name. If the property is not at all supported by the browser, return a false flag. */ prefixCheck: function (property) { /* If this property has already been checked, return the cached value. */ if (Velocity.State.prefixMatches[property]) { return [ Velocity.State.prefixMatches[property], true ]; } else { var vendors = [ "", "Webkit", "Moz", "ms", "O" ]; for (var i = 0, vendorsLength = vendors.length; i < vendorsLength; i++) { var propertyPrefixed; if (i === 0) { propertyPrefixed = property; } else { /* Capitalize the first letter of the property to conform to JavaScript vendor prefix notation (e.g. webkitFilter). */ propertyPrefixed = vendors[i] + property.replace(/^\w/, function(match) { return match.toUpperCase(); }); } /* Check if the browser supports this property as prefixed. */ if (typeof Velocity.State.prefixElement.style[propertyPrefixed] === "string") { /* Cache the match. */ Velocity.State.prefixMatches[property] = propertyPrefixed; return [ propertyPrefixed, true ]; } } /* If the browser doesn't support this property in any form, include a false flag so that the caller can decide how to proceed. */ return [ property, false ]; } } }, /************************ CSS Property Values ************************/ Values: { isCSSNullValue: function (value) { /* The browser defaults CSS values that have not been set to either 0 or one of several possible null-value strings. Thus, we check for both falsiness and these special strings. */ /* Null-value checking is performed to default the special strings to 0 (for the sake of tweening) or their hook templates as defined as CSS.Hooks (for the sake of hook injection/extraction). */ /* Note: Chrome returns "rgba(0, 0, 0, 0)" for an undefined color whereas IE returns "transparent". */ return (value == 0 || /^(none|auto|transparent|(rgba\(0, ?0, ?0, ?0\)))$/i.test(value)); }, /* Retrieve a property's default unit type. Used for assigning a unit type when one is not supplied by the user. */ getUnitType: function (property) { if (/^(rotate|skew)/i.test(property)) { return "deg"; } else if (/(^(scale|scaleX|scaleY|scaleZ|opacity|alpha|fillOpacity|flexGrow|flexHeight|zIndex|fontWeight)$)|color/i.test(property)) { /* The above properties are unitless. */ return ""; } else { /* Default to px for all other properties. */ return "px"; } }, /* HTML elements default to an associated display type when they're not set to display:none. */ /* Note: This function used for correctly setting the non-"none" display value in certain Velocity sequences, such as fadeIn/Out. */ getDisplayType: function (element) { var tagName = element.tagName.toString().toLowerCase(); if (/^(b|big|i|small|tt|abbr|acronym|cite|code|dfn|em|kbd|strong|samp|var|a|bdo|br|img|map|object|q|script|span|sub|sup|button|input|label|select|textarea)$/i.test(tagName)) { return "inline"; } else if (/^(li)$/i.test(tagName)) { return "list-item"; } else if (/^(tr)$/i.test(tagName)) { return "table-row"; /* Default to "block" when no match is found. */ } else { return "block"; } } }, /**************************** Style Getting & Setting ****************************/ /* The singular getPropertyValue, which routes the logic for all normalizations, hooks, and standard CSS properties. */ getPropertyValue: function (element, property, rootPropertyValue, forceStyleLookup) { /* Get an element's computed property value. */ /* Note: Retrieving the value of a CSS property cannot simply be performed by checking an element's style attribute (which only reflects user-defined values). Instead, the browser must be queried for a property's *computed* value. You can read more about getComputedStyle here: https://developer.mozilla.org/en/docs/Web/API/window.getComputedStyle */ function computePropertyValue (element, property) { /* When box-sizing isn't set to border-box, height and width style values are incorrectly computed when an element's scrollbars are visible (which expands the element's dimensions). Thus, we defer to the more accurate offsetHeight/Width property, which includes the total dimensions for interior, border, padding, and scrollbar. We subtract border and padding to get the sum of interior + scrollbar. */ var computedValue = 0; /* IE<=8 doesn't support window.getComputedStyle, thus we defer to jQuery, which has an extensive array of hacks to accurately retrieve IE8 property values. Re-implementing that logic here is not worth bloating the codebase for a dying browser. The performance repercussions of using jQuery here are minimal since Velocity is optimized to rarely (and sometimes never) query the DOM. Further, the $.css() codepath isn't that slow. */ if (IE <= 8) { computedValue = $.css(element, property); /* GET */ /* All other browsers support getComputedStyle. The returned live object reference is cached onto its associated element so that it does not need to be refetched upon every GET. */ } else { if (!forceStyleLookup) { if (property === "height" && CSS.getPropertyValue(element, "boxSizing").toString().toLowerCase() !== "border-box") { return element.offsetHeight - (parseFloat(CSS.getPropertyValue(element, "borderTopWidth")) || 0) - (parseFloat(CSS.getPropertyValue(element, "borderBottomWidth")) || 0) - (parseFloat(CSS.getPropertyValue(element, "paddingTop")) || 0) - (parseFloat(CSS.getPropertyValue(element, "paddingBottom")) || 0); } else if (property === "width" && CSS.getPropertyValue(element, "boxSizing").toString().toLowerCase() !== "border-box") { return element.offsetWidth - (parseFloat(CSS.getPropertyValue(element, "borderLeftWidth")) || 0) - (parseFloat(CSS.getPropertyValue(element, "borderRightWidth")) || 0) - (parseFloat(CSS.getPropertyValue(element, "paddingLeft")) || 0) - (parseFloat(CSS.getPropertyValue(element, "paddingRight")) || 0); } } var computedStyle; /* For elements that Velocity hasn't been called on directly (e.g. when Velocity queries the DOM on behalf of a parent of an element its animating), perform a direct getComputedStyle lookup since the object isn't cached. */ if ($.data(element, NAME) === undefined) { computedStyle = window.getComputedStyle(element, null); /* GET */ /* If the computedStyle object has yet to be cached, do so now. */ } else if (!$.data(element, NAME).computedStyle) { computedStyle = $.data(element, NAME).computedStyle = window.getComputedStyle(element, null); /* GET */ /* If computedStyle is cached, use it. */ } else { computedStyle = $.data(element, NAME).computedStyle; } /* IE doesn't return a value for borderColor -- it only returns individual values for each border side's color. As a polyfill, default to querying for just the top border's color. */ if (IE && property === "borderColor") { property = "borderTopColor"; } /* IE9 has a bug in which the "filter" property must be accessed from computedStyle using the getPropertyValue method instead of a direct property lookup. The getPropertyValue method is slower than a direct lookup, which is why we avoid it by default. */ if (IE === 9 && property === "filter") { computedValue = computedStyle.getPropertyValue(property); /* GET */ } else { computedValue = computedStyle[property]; } /* Fall back to the property's style value (if defined) when computedValue returns nothing, which can happen when the element hasn't been painted. */ if (computedValue === "" || computedValue === null) { computedValue = element.style[property]; } } /* For top, right, bottom, and left (TRBL) values that are set to "auto" on elements of "fixed" or "absolute" position, defer to jQuery for converting "auto" to a numeric value. (For elements with a "static" or "relative" position, "auto" has the same effect as being set to 0, so no conversion is necessary.) */ /* An example of why numeric conversion is necessary: When an element with "position:absolute" has an untouched "left" property, which reverts to "auto", left's value is 0 relative to its parent element, but is often non-zero relative to its *containing* (not parent) element, which is the nearest "position:relative" ancestor or the viewport (and always the viewport in the case of "position:fixed"). */ if (computedValue === "auto" && /^(top|right|bottom|left)$/i.test(property)) { var position = computePropertyValue(element, "position"); /* GET */ /* For absolute positioning, jQuery's $.position() only returns values for top and left; right and bottom will have their "auto" value reverted to 0. */ /* Note: A jQuery object must be created here since jQuery doesn't have a low-level alias for $.position(). Not a big deal since we're currently in a GET batch anyway. */ if (position === "fixed" || (position === "absolute" && /top|left/i.test(property))) { /* Note: jQuery strips the pixel unit from its returned values; we re-add it here to conform with computePropertyValue's behavior. */ computedValue = $(element).position()[property] + "px"; /* GET */ } } return computedValue; } var propertyValue; /* If this is a hooked property (e.g. "clipLeft" instead of the root property of "clip"), extract the hook's value from a normalized rootPropertyValue using CSS.Hooks.extractValue(). */ if (CSS.Hooks.registered[property]) { var hook = property, hookRoot = CSS.Hooks.getRoot(hook); /* If a cached rootPropertyValue wasn't passed in (which Velocity always attempts to do in order to avoid requerying the DOM), query the DOM for the root property's value. */ if (rootPropertyValue === undefined) { /* Since the browser is now being directly queried, use the official post-prefixing property name for this lookup. */ rootPropertyValue = CSS.getPropertyValue(element, CSS.Names.prefixCheck(hookRoot)[0]); /* GET */ } /* If this root has a normalization registered, peform the associated normalization extraction. */ if (CSS.Normalizations.registered[hookRoot]) { rootPropertyValue = CSS.Normalizations.registered[hookRoot]("extract", element, rootPropertyValue); } /* Extract the hook's value. */ propertyValue = CSS.Hooks.extractValue(hook, rootPropertyValue); /* If this is a normalized property (e.g. "opacity" becomes "filter" in <=IE8) or "translateX" becomes "transform"), normalize the property's name and value, and handle the special case of transforms. */ /* Note: Normalizing a property is mutually exclusive from hooking a property since hook-extracted values are strictly numerical and therefore do not require normalization extraction. */ } else if (CSS.Normalizations.registered[property]) { var normalizedPropertyName, normalizedPropertyValue; normalizedPropertyName = CSS.Normalizations.registered[property]("name", element); /* Transform values are calculated via normalization extraction (see below), which checks against the element's transformCache. At no point do transform GETs ever actually query the DOM; initial stylesheet values are never processed. This is because parsing 3D transform matrices is not always accurate and would bloat our codebase; thus, normalization extraction defaults initial transform values to their zero-values (e.g. 1 for scaleX and 0 for translateX). */ if (normalizedPropertyName !== "transform") { normalizedPropertyValue = computePropertyValue(element, CSS.Names.prefixCheck(normalizedPropertyName)[0]); /* GET */ /* If the value is a CSS null-value and this property has a hook template, use that zero-value template so that hooks can be extracted from it. */ if (CSS.Values.isCSSNullValue(normalizedPropertyValue) && CSS.Hooks.templates[property]) { normalizedPropertyValue = CSS.Hooks.templates[property][1]; } } propertyValue = CSS.Normalizations.registered[property]("extract", element, normalizedPropertyValue); } /* If a value wasn't produced via hook extraction or normalization, query the DOM. */ if (!/^[\d-]/.test(propertyValue)) { propertyValue = computePropertyValue(element, CSS.Names.prefixCheck(property)[0]); /* GET */ } /* Since property lookups are for animation purposes (which entails computing the numeric delta between start and end values), convert CSS null-values to an integer of value 0. */ if (CSS.Values.isCSSNullValue(propertyValue)) { propertyValue = 0; } if (Velocity.debug >= 2) console.log("Get " + property + ": " + propertyValue); return propertyValue; }, /* The singular setPropertyValue, which routes the logic for all normalizations, hooks, and standard CSS properties. */ setPropertyValue: function(element, property, propertyValue, rootPropertyValue, scrollData) { var propertyName = property; /* In order to be subjected to call options and element queueing, scroll animation is routed through Velocity as if it were a standard CSS property. */ if (property === "scroll") { /* If a container option is present, scroll the container instead of the browser window. */ if (scrollData.container) { scrollData.container["scroll" + scrollData.direction] = propertyValue; /* Otherwise, Velocity defaults to scrolling the browser window. */ } else { if (scrollData.direction === "Left") { window.scrollTo(propertyValue, scrollData.alternateValue); } else { window.scrollTo(scrollData.alternateValue, propertyValue); } } } else { /* Transforms (translateX, rotateZ, etc.) are applied to a per-element transformCache object, which is manually flushed via flushTransformCache(). Thus, for now, we merely cache transforms being SET. */ if (CSS.Normalizations.registered[property] && CSS.Normalizations.registered[property]("name", element) === "transform") { /* Perform a normalization injection. */ /* Note: The normalization logic handles the transformCache updating. */ CSS.Normalizations.registered[property]("inject", element, propertyValue); propertyName = "transform"; propertyValue = $.data(element, NAME).transformCache[property]; } else { /* Inject hooks. */ if (CSS.Hooks.registered[property]) { var hookName = property, hookRoot = CSS.Hooks.getRoot(property); /* If a cached rootPropertyValue was not provided, query the DOM for the hookRoot's current value. */ rootPropertyValue = rootPropertyValue || CSS.getPropertyValue(element, hookRoot); /* GET */ propertyValue = CSS.Hooks.injectValue(hookName, propertyValue, rootPropertyValue); property = hookRoot; } /* Normalize names and values. */ if (CSS.Normalizations.registered[property]) { propertyValue = CSS.Normalizations.registered[property]("inject", element, propertyValue); property = CSS.Normalizations.registered[property]("name", element); } /* Assign the appropriate vendor prefix before perform an official style update. */ propertyName = CSS.Names.prefixCheck(property)[0]; /* A try/catch is used for IE<=8, which throws an error when "invalid" CSS values are set, e.g. a negative width. Try/catch is avoided for other browsers since it incurs a performance overhead. */ if (IE <= 8) { try { element.style[propertyName] = propertyValue; } catch (e) { console.log("Error setting [" + propertyName + "] to [" + propertyValue + "]"); } } else { element.style[propertyName] = propertyValue; } if (Velocity.debug >= 2) console.log("Set " + property + " (" + propertyName + "): " + propertyValue); } } /* Return the normalized property name and value in case the caller wants to know how these values were modified before being applied to the DOM. */ return [ propertyName, propertyValue ]; }, /* To increase performance by batching transform updates into a single SET, transforms are not directly applied to an element until flushTransformCache() is called. */ /* Note: Velocity does not apply transform values in the same order that they were defined in the call's property map. Doing so would become problematic since there'd be no indication of how an element's existing transforms should be re-ordered along with the new ones. */ flushTransformCache: function(element) { var transformString = "", transformName, transformValue, perspective; /* Transform properties are stored as members of the transformCache object. Concatenate all the members into a string. */ for (transformName in $.data(element, NAME).transformCache) { transformValue = $.data(element, NAME).transformCache[transformName]; /* Transform's perspective subproperty must be set first in order to take effect. We store it for now. */ if (transformName === "transformPerspective") { perspective = transformValue; continue; } /* IE9 only supports one rotation type, rotateZ, which it refers to as "rotate". */ if (IE === 9 && transformName === "rotateZ") { transformName = "rotate"; } transformString += transformName + transformValue + " "; } /* If present, set the perspective subproperty first. */ if (perspective) { transformString = "perspective" + perspective + " " + transformString; } CSS.setPropertyValue(element, "transform", transformString); } }; /* Register hooks and normalizations. */ CSS.Hooks.register(); CSS.Normalizations.register(); /********************** Velocity.animate **********************/ Velocity.animate = function() { /************************* Arguments Assignment *************************/ /* To allow for expressive CoffeeScript code, Velocity supports an alternative syntax in which "properties" and "options" objects are defined on a container object that's passed in as Velocity's sole argument. */ var syntacticSugar = (arguments[0] && arguments[0].properties !== undefined), /* When Velocity is called via the utility function ($.Velocity.animate()/Velocity.animate()), elements are explicitly passed in as the first parameter. Thus, argument positioning varies. We normalize them here. */ elementWrapped = isWrapped(this), argumentIndex; var elements, propertiesMap, options; /* Detect jQuery/Zepto elements being animated via the $.fn method. */ if (elementWrapped) { elements = this; argumentIndex = 0; /* Otherwise, raw elements are being animated via the utility function. */ } else { elements = syntacticSugar ? arguments[0].elements : arguments[0]; /* To guard from user errors, extract the raw DOM element(s) from the wrapped object if one was mistakenly passed into the utility function. */ elements = isWrapped(elements) ? [].slice.call(elements) : elements; argumentIndex = 1; } if (syntacticSugar) { propertiesMap = arguments[0].properties; options = arguments[0].options; } else { propertiesMap = arguments[argumentIndex]; options = arguments[argumentIndex + 1]; } /* The length of the element set (in the form of a nodeList or an array of elements) is defaulted to 1 in case a single raw DOM element is passed in (which doesn't contain a length property). */ var elementsLength = (isNodeList(elements) || isArray(elements)) ? elements.length : 1, elementsIndex = 0; /*************************** Argument Overloading ***************************/ /* Support is included for jQuery's argument overloading: $.animate(propertyMap [, duration] [, easing] [, complete]). Overloading is detected by checking for the absence of an object being passed into options. The stop action does not accept animation options, and is therefore excluded from this check. */ /* Note: Although argument overloading is an incredibly sloppy practice in JavaScript, support is included so that velocity() can act as a drop-in replacement for $.animate(). */ if (propertiesMap !== "stop" && !$.isPlainObject(options)) { /* The utility function shifts all arguments one position to the right, so we adjust for that offset. */ var startingArgumentPosition = argumentIndex + 1; options = {}; /* Iterate through all options arguments */ for (var i = startingArgumentPosition; i < arguments.length; i++) { /* Treat a number as a duration. Parse it out. */ /* Note: The following RegEx will return true if passed an array with a number as its first item. Thus, arrays are skipped from this check. */ if (!isArray(arguments[i]) && /^\d/.test(arguments[i])) { options.duration = parseFloat(arguments[i]); /* Treat a string as an easing. */ } else if (typeof arguments[i] === "string") { options.easing = arguments[i]; /* Also treat two-item (tension, friction) and four-item (cubic bezier points) arrays as an easing. */ } else if (isArray(arguments[i]) && (arguments[i].length === 2 || arguments[i].length === 4)) { options.easing = arguments[i]; /* Treat a function as a callback. */ } else if (isFunction(arguments[i])) { options.complete = arguments[i]; } } } /********************* Action Detection *********************/ /* Velocity's behavior is categorized into "actions": Elements can either be specially scrolled into view, or they can be started, stopped, or reversed. If a literal or referenced properties map is passed in as Velocity's first argument, the associated action is "start". Alternatively, "scroll", "reverse", or "stop" can be passed in instead of a properties map. */ var action; switch (propertiesMap) { case "scroll": action = "scroll"; break; case "reverse": action = "reverse"; break; case "stop": action = "stop"; break; default: /* Treat a non-empty plain object as a literal properties map. */ if ($.isPlainObject(propertiesMap) && !$.isEmptyObject(propertiesMap)) { action = "start"; /* Check if a string matches a registered sequence (see Sequences above). */ } else if (typeof propertiesMap === "string" && Velocity.Sequences[propertiesMap]) { var elementsOriginal = elements, durationOriginal = options.duration; /* If the backwards option was passed in, reverse the element set so that elements animate from the last to the first (useful in combination with the stagger option). */ if (options.backwards === true) { elements = (elements.jquery ? [].slice.call(elements) : elements).reverse(); } /* Individually trigger the sequence for each element in the set to prevent users from having to handle iteration logic in their own sequence code. */ $.each(elements, function(elementIndex, element) { /* If the stagger option was passed in, successively delay each element by the stagger value (in ms). */ if (parseFloat(options.stagger)) { options.delay = parseFloat(options.stagger) * elementIndex; } /* If the drag option was passed in, successively increase/decrease (depending on the presense of options.backwards) the duration of each element's animation, using floors to prevent producing very short durations. */ if (options.drag) { /* Default the duration of UI pack effects (callouts and transitions) to 1000ms instead of the usual default duration of 400ms. */ options.duration = parseFloat(durationOriginal) || (/^(callout|transition)/.test(propertiesMap) ? 1000 : DEFAULT_DURATION); /* For each element, take the greater duration of: A) animation completion percentage relative to the original duration, B) 75% of the original duration, or C) a 200ms fallback (in case duration is already set to a low value). The end result is a baseline of 75% of the sequence's duration that increases/decreases as the end of the element set is approached. */ options.duration = Math.max(options.duration * (options.backwards ? 1 - elementIndex/elementsLength : (elementIndex + 1) / elementsLength), options.duration * 0.75, 200); } /* Pass in the call's options object so that the sequence can optionally extend it. It defaults to an empty object instead of null to reduce the options checking logic required inside the sequence. */ /* Note: The element is passed in as both the call's context and its first argument -- allowing for more expressive sequence declarations. */ Velocity.Sequences[propertiesMap].call(element, element, options || {}, elementIndex, elementsLength); }); /* Since the animation logic resides within the sequence's own code, abort the remainder of this call. (The performance overhead up to this point is virtually non-existant.) */ /* Note: The jQuery call chain is kept intact by returning the complete element set. */ return elementsOriginal; } else { console.log("First argument was not a property map, a known action, or a registered sequence. Aborting.") return elements; } } /************************** Call-Wide Variables **************************/ /* A container for CSS unit conversion ratios (e.g. %, rem, and em ==> px) that is used to cache ratios across all properties being animated in a single Velocity call. Calculating unit ratios necessitates DOM querying and updating, and is therefore avoided (via caching) wherever possible; further, ratios are only calculated when they're needed. */ /* Note: This container is call-wide instead of page-wide to avoid the risk of using stale conversion metrics across Velocity animations that are not immediately consecutively chained. */ var unitConversionRatios = { /* Performance optimization insight: When the parent element, CSS position value, and fontSize do not differ amongst elements, the elements' unit ratios are identical. */ lastParent: null, lastPosition: null, lastFontSize: null, /* Percent is the only unit types whose ratio is dependant upon axis. */ lastPercentToPxWidth: null, lastPercentToPxHeight: null, lastEmToPx: null, /* The rem==>px ratio is relative to the document's fontSize -- not any property belonging to the element. Thus, it is automatically call-wide cached whenever the rem unit is being animated. */ remToPxRatio: null }; /* A container for all the ensuing tween data and metadata associated with this call. This container gets pushed to the page-wide Velocity.State.calls array that is processed during animation ticking. */ var call = []; /************************ Element Processing ************************/ /* Element processing consists of three parts -- data processing that cannot go stale and data processing that *can* go stale (i.e. third-party style modifications): 1) Pre-Queueing: Element-wide variables, including the element's data storage, are instantiated. Call options are prepared. If triggered, the Stop action is executed. 2) Queueing: The logic that runs once this call has reached its point of execution in the element's $.queue() stack. Most logic is placed here to avoid risking it becoming stale. 3) Pushing: Consolidation of the tween data followed by its push onto the global in-progress calls container. */ function processElement () { /************************* Part I: Pre-Queueing *************************/ /*************************** Element-Wide Variables ***************************/ var element = this, /* The runtime opts object is the extension of the current call's options and Velocity's page-wide option defaults. */ opts = $.extend({}, Velocity.defaults, options), /* A container for the processed data associated with each property in the propertyMap. (Each property in the map produces its own "tween".) */ tweensContainer = {}; /******************** Action: Stop ********************/ /* When the stop action is triggered, the elements' remaining queue calls (including loops) are removed, but its in-progress animation runs until completion. This is intentional in order to avoid visually-abrupt stopping. */ /* Note: The stop command runs prior to Queueing since its behavior is intended to take effect *immediately*, regardless of the targeted element's current state. */ if (action === "stop") { /* Clearing jQuery's $.queue() array is achieved by manually setting it to []. */ /* Note: To stop only the animations associated with a specific queue, a custom queue name can optionally be provided in place of an options object. */ $.queue(element, (typeof options === "string") ? options : "", []); /* Since we're stopping, do not proceed with Queueing. */ return true; } /****************** Data Cache ******************/ /* A primary design goal of Velocity is to cache data wherever possible in order to avoid DOM requerying. Accordingly, each element has a data cache instantiated on it. */ if ($.data(element, NAME) === undefined) { $.data(element, NAME, { /* Keep track of whether the element is currently being animated by Velocity. This is used to ensure that property values are not transferred between non-consecutive (stale) calls. */ isAnimating: false, /* A reference to the element's live computedStyle object. You can learn more about computedStyle here: https://developer.mozilla.org/en/docs/Web/API/window.getComputedStyle */ computedStyle: null, /* Tween data is cached for each animation on the element so that data can be passed across calls -- in particular, end values are used as subsequent start values in consecutive Velocity calls. */ tweensContainer: null, /* The full root property values of each CSS hook being animated on this element are cached so that: 1) Concurrently-animating hooks sharing the same root can have their root values' merged into one while tweening. 2) Post-hook-injection root values can be transferred over to consecutively chained Velocity calls as starting root values. */ rootPropertyValueCache: {}, /* A cache for transform updates, which must be manually flushed via CSS.flushTransformCache(). */ transformCache: {} }); } /****************** Option: Delay ******************/ /* Since queue:false doesn't respect the item's existing queue, we avoid injecting its delay here (it's set later on). */ /* Note: Velocity rolls its own delay function since jQuery doesn't have a utility alias for $.fn.delay() (and thus requires jQuery element creation, which we avoid since its overhead includes DOM querying). */ if (/^\d/.test(opts.delay) && opts.queue !== false) { $.queue(element, opts.queue, function(next) { /* This is a flag used to indicate to the upcoming completeCall() function that this queue entry was initiated by Velocity. See completeCall() for further details. */ Velocity.velocityQueueEntryFlag = true; /* The ensuing queue item (which is assigned to the "next" argument that $.queue() automatically passes in) will be triggered after a setTimeout delay. */ setTimeout(next, parseFloat(opts.delay)); }); } /********************* Option: Duration *********************/ /* Support for jQuery's named durations. */ switch (opts.duration.toString().toLowerCase()) { case "fast": opts.duration = 200; break; case "normal": opts.duration = DEFAULT_DURATION; break; case "slow": opts.duration = 600; break; default: /* Remove the potential "ms" suffix and default to 1 if the user is attempting to set a duration of 0 (in order to produce an immediate style change). */ opts.duration = parseFloat(opts.duration) || 1; } /******************* Option: Easing *******************/ opts.easing = getEasing(opts.easing, opts.duration); /********************** Option: Complete **********************/ /* The complete option must be a function. Otherwise, default to null. */ /* Note: The complete option is the only option that is processed on a call-wide basis since it is fired once per call -- not once per element. */ if (options && options.complete && !isFunction(options.complete)) { options.complete = null; } /******************** Option: Display ********************/ /* Refer to Velocity's documentation (VelocityJS.org/#display) for a description of the display option's behavior. */ if (opts.display) { opts.display = opts.display.toString().toLowerCase(); } /********************** Option: mobileHA **********************/ /* When set to true, and if this is a mobile device, mobileHA automatically enables hardware acceleration (via a null transform hack) on animating elements. HA is removed from the element at the completion of its animation. */ /* Note: Android Gingerbread doesn't support HA. If a null transform hack (mobileHA) is in fact set, it will prevent other tranform subproperties from taking effect. */ /* Note: You can read more about the use of mobileHA in Velocity's documentation: VelocityJS.org/#mobileHA. */ opts.mobileHA = (opts.mobileHA && Velocity.State.isMobile && !Velocity.State.isGingerbread); /*********************** Part II: Queueing ***********************/ /* When a set of elements is targeted by a Velocity call, the set is broken up and each element has the current Velocity call individually queued onto it. In this way, each element's existing queue is respected; some elements may already be animating and accordingly should not have this current Velocity call triggered immediately. */ /* In each queue, tween data is processed for each animating property then pushed onto the call-wide calls array. When the last element in the set has had its tweens processed, the call array is pushed to Velocity.State.calls for live processing by the requestAnimationFrame tick. */ function buildQueue(next) { /******************* Option: Begin *******************/ /* The begin callback is fired once per call -- not once per elemenet -- and is passed the full raw DOM element set as both its context and its first argument. */ if (elementsIndex === 0 && options && isFunction(options.begin)) { var rawElements = elements.jquery ? elements.get() : elements; options.begin.call(rawElements, rawElements); } /***************************************** Tween Data Construction (for Scroll) *****************************************/ /* Note: In order to be subjected to chaining and animation options, scroll's tweening is routed through Velocity as if it were a standard CSS property animation. */ if (action === "scroll") { /* The scroll action uniquely takes an optional "offset" option -- specified in pixels -- that offsets the targeted scroll position. */ var scrollDirection = (/^x$/i.test(opts.axis) ? "Left" : "Top"), scrollOffset = parseFloat(opts.offset) || 0, scrollPositionCurrent, scrollPositionCurrentAlternate, scrollPositionEnd; /* Scroll also uniquely takes an optional "container" option, which indicates the parent element that should be scrolled -- as opposed to the browser window itself. This is useful for scrolling toward an element that's inside an overflowing parent element. */ if (opts.container) { /* Ensure that either a jQuery object or a raw DOM element was passed in. */ if (opts.container.jquery || opts.container.nodeType) { /* Extract the raw DOM element from the jQuery wrapper. */ opts.container = opts.container[0] || opts.container; /* Note: Unlike other properties in Velocity, the browser's scroll position is never cached since it so frequently changes (due to the user's natural interaction with the page). */ scrollPositionCurrent = opts.container["scroll" + scrollDirection]; /* GET */ /* $.position() values are relative to the container's currently viewable area (without taking into account the container's true dimensions -- say, for example, if the container was not overflowing). Thus, the scroll end value is the sum of the child element's position *and* the scroll container's current scroll position. */ /* Note: jQuery does not offer a utility alias for $.position(), so we have to incur jQuery object conversion here. This syncs up with an ensuing batch of GETs, so it fortunately does not trigger layout thrashing. */ scrollPositionEnd = (scrollPositionCurrent + $(element).position()[scrollDirection.toLowerCase()]) + scrollOffset; /* GET */ /* If a value other than a jQuery object or a raw DOM element was passed in, default to null so that this option is ignored. */ } else { opts.container = null; } } else { /* If the window itself is being scrolled -- not a containing element -- perform a live scroll position lookup using the appropriate cached property names (which differ based on browser type). */ scrollPositionCurrent = Velocity.State.scrollAnchor[Velocity.State["scrollProperty" + scrollDirection]]; /* GET */ /* When scrolling the browser window, cache the alternate axis's current value since window.scrollTo() doesn't let us change only one value at a time. */ scrollPositionCurrentAlternate = Velocity.State.scrollAnchor[Velocity.State["scrollProperty" + (scrollDirection === "Left" ? "Top" : "Left")]]; /* GET */ /* Unlike $.position(), $.offset() values are relative to the browser window's true dimensions -- not merely its currently viewable area -- and therefore end values do not need to be compounded onto current values. */ scrollPositionEnd = $(element).offset()[scrollDirection.toLowerCase()] + scrollOffset; /* GET */ } /* Since there's only one format that scroll's associated tweensContainer can take, we create it manually. */ tweensContainer = { scroll: { rootPropertyValue: false, startValue: scrollPositionCurrent, currentValue: scrollPositionCurrent, endValue: scrollPositionEnd, unitType: "", easing: opts.easing, scrollData: { container: opts.container, direction: scrollDirection, alternateValue: scrollPositionCurrentAlternate } }, element: element }; /****************************************** Tween Data Construction (for Reverse) ******************************************/ /* Reverse acts like a "start" action in that a property map is animated toward. The only difference is that the property map used for reverse is the inverse of the map used in the previous call. Thus, we manipulate the previous call to construct our new map: use the previous map's end values as our new map's start values. Copy over all other data. */ /* Note: Reverse can be directly called via the "reverse" parameter, or it can be indirectly triggered via the loop option. (Loops are composed of multiple reverses.) */ /* Note: Reverse calls do not need to be consecutively chained onto a currently-animating element in order to operate on cached values; there is no harm to reverse being called on a potentially stale data cache since reverse's behavior is simply defined as reverting to the element's values as they were prior to the previous *Velocity* call. */ } else if (action === "reverse") { /* Abort if there is no prior animation data to reverse to. */ if (!$.data(element, NAME).tweensContainer) { /* Dequeue the element so that this queue entry releases itself immediately, allowing subsequent queue entries to run. */ $.dequeue(element, opts.queue); return; } else { /********************* Options Parsing *********************/ /* If the element was hidden via the display option in the previous call, revert display to block prior to reversal so that the element is visible again. */ if ($.data(element, NAME).opts.display === "none") { $.data(element, NAME).opts.display = "block"; } /* If the loop option was set in the previous call, disable it so that "reverse" calls aren't recursively generated. Further, remove the previous call's callback options; typically, users do not want these to be refired. */ $.data(element, NAME).opts.loop = false; $.data(element, NAME).opts.begin = null; $.data(element, NAME).opts.complete = null; /* Since we're extending an opts object that has already been exteded with the defaults options object, we remove non-explicitly-defined properties that are auto-assigned values. */ if (!options.easing) { delete opts.easing; } if (!options.duration) { delete opts.duration; } /* The opts object used for reversal is an extension of the options object optionally passed into this reverse call plus the options used in the previous Velocity call. */ opts = $.extend({}, $.data(element, NAME).opts, opts); /************************************* Tweens Container Reconstruction *************************************/ /* Create a deepy copy (indicated via the true flag) of the previous call's tweensContainer. */ var lastTweensContainer = $.extend(true, {}, $.data(element, NAME).tweensContainer); /* Manipulate the previous tweensContainer by replacing its end values and currentValues with its start values. */ for (var lastTween in lastTweensContainer) { /* In addition to tween data, tweensContainers contain an element property that we ignore here. */ if (lastTween !== "element") { var lastStartValue = lastTweensContainer[lastTween].startValue; lastTweensContainer[lastTween].startValue = lastTweensContainer[lastTween].currentValue = lastTweensContainer[lastTween].endValue; lastTweensContainer[lastTween].endValue = lastStartValue; /* Easing is the only option that embeds into the individual tween data (since it can be defined on a per-property basis). Accordingly, every property's easing value must be updated when an options object is passed in with a reverse call. The side effect of this extensibility is that all per-property easing values are forcefully reset to the new value. */ if (options) { lastTweensContainer[lastTween].easing = opts.easing; } } } tweensContainer = lastTweensContainer; } /***************************************** Tween Data Construction (for Start) *****************************************/ } else if (action === "start") { /************************* Value Transferring *************************/ /* If this queue entry follows a previous Velocity-initiated queue entry *and* if this entry was created while the element was in the process of being animated by Velocity, then this current call is safe to use the end values from the prior call as its start values. Velocity attempts to perform this value transfer process whenever possible in order to avoid requerying the DOM. */ /* If values aren't transferred from a prior call and start values were not forcefed by the user (more on this below), then the DOM is queried for the element's current values as a last resort. */ /* Note: Conversely, animation reversal (and looping) *always* perform inter-call value transfers; they never requery the DOM. */ var lastTweensContainer; /* The per-element isAnimating flag is used to indicate whether it's safe (i.e. the data isn't stale) to transfer over end values to use as start values. If it's set to true and there is a previous Velocity call to pull values from, do so. */ if ($.data(element, NAME).tweensContainer && $.data(element, NAME).isAnimating === true) { lastTweensContainer = $.data(element, NAME).tweensContainer; } /*************************** Tween Data Calculation ***************************/ /* This function parses property data and defaults endValue, easing, and startValue as appropriate. */ /* Property map values can either take the form of 1) a single value representing the end value, or 2) an array in the form of [ endValue, [, easing] [, startValue] ]. The optional third parameter is a forcefed startValue to be used instead of querying the DOM for the element's current value. Read Velocity's docmentation to learn more about forcefeeding: VelocityJS.org/#forcefeeding */ function parsePropertyValue (valueData) { var endValue = undefined, easing = undefined, startValue = undefined; /* Handle the array format, which can be structured as one of three potential overloads: A) [ endValue, easing, startValue ], B) [ endValue, easing ], or C) [ endValue, startValue ] */ if (isArray(valueData)) { /* endValue is always the first item in the array. Don't bother validating endValue's value now since the ensuing property cycling logic inherently does that. */ endValue = valueData[0]; /* Two-item array format: If the second item is a number or a function, treat it as a start value since easings can only be strings or arrays. */ if ((!isArray(valueData[1]) && /^[\d-]/.test(valueData[1])) || isFunction(valueData[1])) { startValue = valueData[1]; /* Two or three-item array: If the second item is a string, treat it as an easing. */ } else if (typeof valueData[1] === "string" || isArray(valueData[1])) { easing = getEasing(valueData[1], opts.duration); /* Don't bother validating startValue's value now since the ensuing property cycling logic inherently does that. */ if (valueData[2]) { startValue = valueData[2]; } } /* Handle the single-value format. */ } else { endValue = valueData; } /* Default to the call's easing if a per-property easing type was not defined. */ easing = easing || opts.easing; /* If functions were passed in as values, pass the function the current element as its context, plus the element's index and the element set's size as arguments. Then, assign the returned value. */ if (isFunction(endValue)) { endValue = endValue.call(element, elementsIndex, elementsLength); } if (isFunction(startValue)) { startValue = startValue.call(element, elementsIndex, elementsLength); } /* Allow startValue to be left as undefined to indicate to the ensuing code that its value was not forcefed. */ return [ endValue || 0, easing, startValue ]; } /* Create a tween out of each property, and append its associated data to tweensContainer. */ for (var property in propertiesMap) { /* Normalize property names via camel casing so that properties can be consistently manipulated. */ /************************** Start Value Sourcing **************************/ /* Parse out endValue, easing, and startValue from the property's data. */ var valueData = parsePropertyValue(propertiesMap[property]), endValue = valueData[0], easing = valueData[1], startValue = valueData[2]; /* Now that the original property name's format has been used for the parsePropertyValue() lookup above, we force the property to its camelCase styling to normalize it for manipulation. */ property = CSS.Names.camelCase(property); /* In case this property is a hook, there are circumstances where we will intend to work on the hook's root property and not the hooked subproperty. */ var rootProperty = CSS.Hooks.getRoot(property), rootPropertyValue = false; /* Properties that are not supported by the browser (and do not have an associated normalization) will inherently produce no style changes when set, so they are skipped in order to decrease animation tick overhead. Property support is determined via prefixCheck(), which returns a false flag when no supported is detected. */ if (CSS.Names.prefixCheck(rootProperty)[1] === false && CSS.Normalizations.registered[rootProperty] === undefined) { if (Velocity.debug) console.log("Skipping [" + rootProperty + "] due to a lack of browser support."); continue; } /* If the display option is being set to a non-"none" (e.g. "block") and opacity (filter on IE<=8) is being animated to an endValue of non-zero, the user's intention is to fade in from invisible, thus we forcefeed opacity a startValue of 0 if its startValue hasn't already been sourced by value transferring or prior forcefeeding. */ if ((opts.display && opts.display !== "none") && /opacity|filter/.test(property) && !startValue && endValue !== 0) { startValue = 0; } /* If values have been transferred from the previous Velocity call, extract the endValue and rootPropertyValue for all of the current call's properties that were *also* animated in the previous call. */ /* Note: Value transferring can optionally be disabled by the user via the _cacheValues option. */ if (opts._cacheValues && lastTweensContainer && lastTweensContainer[property]) { if (startValue === undefined) { startValue = lastTweensContainer[property].endValue + lastTweensContainer[property].unitType; } /* The previous call's rootPropertyValue is extracted from the element's data cache since that's the instance of rootPropertyValue that gets freshly updated by the tweening process, whereas the rootPropertyValue attached to the incoming lastTweensContainer is equal to the root property's value prior to any tweening. */ rootPropertyValue = $.data(element, NAME).rootPropertyValueCache[rootProperty]; /* If values were not transferred from a previous Velocity call, query the DOM as needed. */ } else { /* Handle hooked properties. */ if (CSS.Hooks.registered[property]) { if (startValue === undefined) { rootPropertyValue = CSS.getPropertyValue(element, rootProperty); /* GET */ /* Note: The following getPropertyValue() call does not actually trigger a DOM query; getPropertyValue() will extract the hook from rootPropertyValue. */ startValue = CSS.getPropertyValue(element, property, rootPropertyValue); /* If startValue is already defined via forcefeeding, do not query the DOM for the root property's value; just grab rootProperty's zero-value template from CSS.Hooks. This overwrites the element's actual root property value (if one is set), but this is acceptable since the primary reason users forcefeed is to avoid DOM queries, and thus we likewise avoid querying the DOM for the root property's value. */ } else { /* Grab this hook's zero-value template, e.g. "0px 0px 0px black". */ rootPropertyValue = CSS.Hooks.templates[rootProperty][1]; } /* Handle non-hooked properties that haven't already been defined via forcefeeding. */ } else if (startValue === undefined) { startValue = CSS.getPropertyValue(element, property); /* GET */ } } /************************** Value Data Extraction **************************/ var separatedValue, endValueUnitType, startValueUnitType, operator; /* Separates a property value into its numeric value and its unit type. */ function separateValue (property, value) { var unitType, numericValue; numericValue = (value || 0) .toString() .toLowerCase() /* Match the unit type at the end of the value. */ .replace(/[%A-z]+$/, function(match) { /* Grab the unit type. */ unitType = match; /* Strip the unit type off of value. */ return ""; }); /* If no unit type was supplied, assign one that is appropriate for this property (e.g. "deg" for rotateZ or "px" for width). */ if (!unitType) { unitType = CSS.Values.getUnitType(property); } return [ numericValue, unitType ]; } /* Separate startValue. */ separatedValue = separateValue(property, startValue); startValue = separatedValue[0]; startValueUnitType = separatedValue[1]; /* Separate endValue, and extract a value operator (e.g. "+=", "-=") if one exists. */ separatedValue = separateValue(property, endValue); endValue = separatedValue[0].replace(/^([+-\/*])=/, function(match, subMatch) { operator = subMatch; /* Strip the operator off of the value. */ return ""; }); endValueUnitType = separatedValue[1]; /* Parse float values from endValue and startValue. Default to 0 if NaN is returned. */ startValue = parseFloat(startValue) || 0; endValue = parseFloat(endValue) || 0; /***************************** Value & Unit Conversion *****************************/ var elementUnitRatios; /* Custom support for properties that don't actually accept the % unit type, but where pollyfilling is trivial and relatively foolproof. */ if (endValueUnitType === "%") { /* A %-value fontSize/lineHeight is relative to the parent's fontSize (as opposed to the parent's dimensions), which is identical to the em unit's behavior, so we piggyback off of that. */ if (/^(fontSize|lineHeight)$/.test(property)) { /* Convert % into an em decimal value. */ endValue = endValue / 100; endValueUnitType = "em"; /* For scaleX and scaleY, convert the value into its decimal format and strip off the unit type. */ } else if (/^scale/.test(property)) { endValue = endValue / 100; endValueUnitType = ""; /* For RGB components, take the defined percentage of 255 and strip off the unit type. */ } else if (/(Red|Green|Blue)$/i.test(property)) { endValue = (endValue / 100) * 255; endValueUnitType = ""; } } /* When queried, the browser returns (most) CSS property values in pixels. Therefore, if an endValue with a unit type of %, em, or rem is animated toward, startValue must be converted from pixels into the same unit type as endValue in order for value manipulation logic (increment/decrement) to proceed. Further, if the startValue was forcefed or transferred from a previous call, startValue may also not be in pixels. Unit conversion logic therefore consists of two steps: 1) Calculating the ratio of %,/em/rem relative to pixels then 2) Converting startValue into the same unit of measurement as endValue based on these ratios. */ /* Unit conversion ratios are calculated by momentarily setting a value with the target unit type on the element, comparing the returned pixel value, then reverting to the original value. */ /* Note: Even if only one of these unit types is being animated, all unit ratios are calculated at once since the overhead of batching the SETs and GETs together upfront outweights the potential overhead of layout thrashing caused by re-querying for uncalculated ratios for subsequently-processed properties. */ /* Note: Instead of adjusting the CSS properties on the target element, an alternative way of performing value conversion is to inject a cloned element into the element's parent and manipulate *its* values instead. This is a cleaner method that avoids the ensuing rounds of layout thrashing, but it's ultimately less performant due to the overhead involved with DOM tree modification (element insertion/deletion). */ /* Todo: Shift this logic into the calls' first tick instance so that it's synced with RAF. */ /* Todo: Store the original values and skip re-setting if we're animating height or width in the properties map. */ function calculateUnitRatios () { /* The properties below are used to determine whether the element differs sufficiently from this same call's prior element (in the overall element set) to also differ in its unit conversion ratios. If the properties match up with those of the prior element, the prior element's conversion ratios are used. Like most optimizations in Velocity, this is done to minimize DOM querying. */ var sameRatioIndicators = { parent: element.parentNode, /* GET */ position: CSS.getPropertyValue(element, "position"), /* GET */ fontSize: CSS.getPropertyValue(element, "fontSize") /* GET */ }, /* Determine if the same % ratio can be used. % is relative to the element's position value and the parent's width and height dimensions. */ sameBasePercent = ((sameRatioIndicators.position === unitConversionRatios.lastPosition) && (sameRatioIndicators.parent === unitConversionRatios.lastParent)), /* Determine if the same em ratio can be used. em is relative to the element's fontSize, which itself is relative to the parent's fontSize. */ sameBaseEm = ((sameRatioIndicators.fontSize === unitConversionRatios.lastFontSize) && (sameRatioIndicators.parent === unitConversionRatios.lastParent)); /* Store these ratio indicators call-wide for the next element to compare against. */ unitConversionRatios.lastParent = sameRatioIndicators.parent; unitConversionRatios.lastPosition = sameRatioIndicators.position; unitConversionRatios.lastFontSize = sameRatioIndicators.fontSize; /* Whereas % and em ratios are determined on a per-element basis, the rem unit type only needs to be checked once per call since it is exclusively dependant upon the body element's fontSize. If this is the first time that calculateUnitRatios() is being run during this call, remToPxRatio will still be set to its default value of null, so we calculate it now. */ if (unitConversionRatios.remToPxRatio === null) { /* Default to most browsers' default fontSize of 16px in the case of 0. */ unitConversionRatios.remToPxRatio = parseFloat(CSS.getPropertyValue(document.body, "fontSize")) || 16; /* GET */ } var originalValues = { /* To accurately and consistently calculate conversion ratios, the element's overflow and box-sizing are temporarily removed. Both properties modify an element's visible dimensions. */ /* Note: Overflow must be manipulated on a per-axis basis since the plain overflow property overwrites its subproperties' values. */ overflowX: null, overflowY: null, boxSizing: null, /* width and height act as our proxy properties for measuring the horizontal and vertical % ratios. Since they can be artificially constrained by their min-/max- equivalents, those properties are converted as well. */ width: null, minWidth: null, maxWidth: null, height: null, minHeight: null, maxHeight: null, /* paddingLeft arbitrarily acts as our proxy for the em ratio. */ paddingLeft: null }, elementUnitRatios = {}, /* Note: IE<=8 round to the nearest pixel when returning CSS values, thus we perform conversions using a measurement of 10 (instead of 1) to give our ratios a precision of at least 1 decimal value. */ measurement = 10; /* For organizational purposes, current ratios calculations are consolidated onto the elementUnitRatios object. */ elementUnitRatios.remToPxRatio = unitConversionRatios.remToPxRatio; /* After temporary unit conversion logic runs, width and height properties that were originally set to "auto" must be set back to "auto" instead of to the actual corresponding pixel value. Leaving the values at their hard-coded pixel value equivalents would inherently prevent the elements from vertically adjusting as the height of its inner content changes. */ /* IE tells us whether or not the property is set to "auto". Other browsers provide no way of determing "auto" values on height/width, and thus we have to trigger additional layout thrashing (see below) to solve this. */ if (IE) { var isIEWidthAuto = /^auto$/i.test(element.currentStyle.width), isIEHeightAuto = /^auto$/i.test(element.currentStyle.height); } /* Note: To minimize layout thrashing, the ensuing unit conversion logic is split into batches to synchronize GETs and SETs. */ if (!sameBasePercent || !sameBaseEm) { originalValues.overflowX = CSS.getPropertyValue(element, "overflowX"); /* GET */ originalValues.overflowY = CSS.getPropertyValue(element, "overflowY"); /* GET */ originalValues.boxSizing = CSS.getPropertyValue(element, "boxSizing"); /* GET */ /* Since % values are relative to their respective axes, ratios are calculated for both width and height. In contrast, only a single ratio is required for rem and em. */ /* When calculating % values, we set a flag to indiciate that we want the computed value instead of offsetWidth/Height, which incorporate additional dimensions (such as padding and border-width) into their values. */ originalValues.width = CSS.getPropertyValue(element, "width", null, true); /* GET */ originalValues.minWidth = CSS.getPropertyValue(element, "minWidth"); /* GET */ /* Note: max-width/height must default to "none" when 0 is returned, otherwise the element cannot have its width/height set. */ originalValues.maxWidth = CSS.getPropertyValue(element, "maxWidth") || "none"; /* GET */ originalValues.height = CSS.getPropertyValue(element, "height", null, true); /* GET */ originalValues.minHeight = CSS.getPropertyValue(element, "minHeight"); /* GET */ originalValues.maxHeight = CSS.getPropertyValue(element, "maxHeight") || "none"; /* GET */ originalValues.paddingLeft = CSS.getPropertyValue(element, "paddingLeft"); /* GET */ } if (sameBasePercent) { elementUnitRatios.percentToPxRatioWidth = unitConversionRatios.lastPercentToPxWidth; elementUnitRatios.percentToPxRatioHeight = unitConversionRatios.lastPercentToPxHeight; } else { CSS.setPropertyValue(element, "overflowX", "hidden"); /* SET */ CSS.setPropertyValue(element, "overflowY", "hidden"); /* SET */ CSS.setPropertyValue(element, "boxSizing", "content-box"); /* SET */ CSS.setPropertyValue(element, "width", measurement + "%"); /* SET */ CSS.setPropertyValue(element, "minWidth", measurement + "%"); /* SET */ CSS.setPropertyValue(element, "maxWidth", measurement + "%"); /* SET */ CSS.setPropertyValue(element, "height", measurement + "%"); /* SET */ CSS.setPropertyValue(element, "minHeight", measurement + "%"); /* SET */ CSS.setPropertyValue(element, "maxHeight", measurement + "%"); /* SET */ } if (sameBaseEm) { elementUnitRatios.emToPxRatio = unitConversionRatios.lastEmToPx; } else { CSS.setPropertyValue(element, "paddingLeft", measurement + "em"); /* SET */ } /* The following pixel-value GETs cannot be batched with the prior GETs since they depend upon the values temporarily set immediately above; layout thrashing cannot be avoided here. */ if (!sameBasePercent) { /* Divide the returned value by the measurement value to get the ratio between 1% and 1px. Default to 1 since conversion logic using 0 can produce Infinite. */ elementUnitRatios.percentToPxRatioWidth = unitConversionRatios.lastPercentToPxWidth = (parseFloat(CSS.getPropertyValue(element, "width", null, true)) || 1) / measurement; /* GET */ elementUnitRatios.percentToPxRatioHeight = unitConversionRatios.lastPercentToPxHeight = (parseFloat(CSS.getPropertyValue(element, "height", null, true)) || 1) / measurement; /* GET */ } if (!sameBaseEm) { elementUnitRatios.emToPxRatio = unitConversionRatios.lastEmToPx = (parseFloat(CSS.getPropertyValue(element, "paddingLeft")) || 1) / measurement; /* GET */ } /* Revert each test property to its original value. */ for (var originalValueProperty in originalValues) { if (originalValues[originalValueProperty] !== null) { CSS.setPropertyValue(element, originalValueProperty, originalValues[originalValueProperty]); /* SETs */ } } /* In IE, revert to "auto" for width and height if it was originally set. */ if (IE) { if (isIEWidthAuto) { CSS.setPropertyValue(element, "width", "auto"); /* SET */ } if (isIEHeightAuto) { CSS.setPropertyValue(element, "height", "auto"); /* SET */ } /* For other browsers, additional layout thrashing must be triggered to determine whether a property was originally set to "auto". */ } else { /* Set height to "auto" then compare the returned value against the element's current height value. If they're identical, leave height set to "auto". If they're different, then "auto" wasn't originally set on the element prior to our conversions, and we revert it to its actual value. */ /* Note: The following GETs and SETs cannot be batched together due to the cross-effect setting one axis to "auto" has on the other. */ CSS.setPropertyValue(element, "height", "auto"); /* SET */ if (originalValues.height !== CSS.getPropertyValue(element, "height", null, true)) { /* GET */ CSS.setPropertyValue(element, "height", originalValues.height); /* SET */ } CSS.setPropertyValue(element, "width", "auto"); /* SET */ if (originalValues.width !== CSS.getPropertyValue(element, "width", null, true)) { /* GET */ CSS.setPropertyValue(element, "width", originalValues.width); /* SET */ } } if (Velocity.debug >= 1) console.log("Unit ratios: " + JSON.stringify(elementUnitRatios), element); return elementUnitRatios; } /* The * and / operators, which are not passed in with an associated unit, inherently use startValue's unit. Skip value and unit conversion. */ if (/[\/*]/.test(operator)) { endValueUnitType = startValueUnitType; /* If startValue and endValue differ in unit type, convert startValue into the same unit type as endValue so that if endValueUnitType is a relative unit (%, em, rem), the values set during tweening will continue to be accurately relative even if the metrics they depend on are dynamically changing during the course of the animation. Conversely, if we always normalized into px and used px for setting values, the px ratio would become stale if the original unit being animated toward was relative and the underlying metrics change during the animation. */ /* Since 0 is 0 in any unit type, no conversion is necessary when startValue is 0 -- we just start at 0 with endValueUnitType. */ } else if ((startValueUnitType !== endValueUnitType) && startValue !== 0) { /* Unit conversion is also skipped when endValue is 0, but *startValueUnitType* must be used in this case for tween values to remain accurate. */ /* Note: Skipping unit conversion here means that if endValueUnitType was originally a relative unit, the animation won't relatively match the underlying metrics if they change, but this is acceptable since we're animating toward invisibility instead of toward visibility that remains past the point of the animation's completion. */ if (endValue === 0) { endValueUnitType = startValueUnitType; } else { /* By this point, we cannot avoid unit conversion (it's undesirable since it causes layout thrashing). If we haven't already, we trigger calculateUnitRatios(), which runs once per element per call. */ elementUnitRatios = elementUnitRatios || calculateUnitRatios(); /* The following RegEx matches CSS properties that have their % values measured relative to the x-axis. */ /* Note: W3C spec mandates that all of margin and padding's properties (even top and bottom) are %-relative to the *width* of the parent element, so they're included in this expression. */ var axis = (/margin|padding|left|right|width|text|word|letter/i.test(property) || /X$/.test(property)) ? "x" : "y"; /* In order to avoid generating n^2 bespoke conversion functions, unit conversion is a two-step process: 1) Convert startValue into pixels. 2) Convert this new pixel value into endValue's unit type. */ switch (startValueUnitType) { case "%": /* Note: translateX and translateY are the only properties that are %-relative to an element's own dimensions -- not its parent's dimensions. Velocity does not include a special conversion process for these properties due of the additional DOM overhead it would entail. Therefore, animating translateX/Y from a % value to a non-% value will produce an incorrect start value. Fortunately, this sort of cross-unit conversion is rarely done by users in practice. */ startValue *= (axis === "x" ? elementUnitRatios.percentToPxRatioWidth : elementUnitRatios.percentToPxRatioHeight); break; case "em": startValue *= elementUnitRatios.emToPxRatio; break; case "rem": startValue *= elementUnitRatios.remToPxRatio; break; case "px": /* px acts as our midpoint in the unit conversion process; do nothing. */ break; } /* Invert the px ratios to convert into to the target unit. */ switch (endValueUnitType) { case "%": startValue *= 1 / (axis === "x" ? elementUnitRatios.percentToPxRatioWidth : elementUnitRatios.percentToPxRatioHeight); break; case "em": startValue *= 1 / elementUnitRatios.emToPxRatio; break; case "rem": startValue *= 1 / elementUnitRatios.remToPxRatio; break; case "px": /* startValue is already in px, do nothing; we're done. */ break; } } } /*********************** Value Operators ***********************/ /* Operator logic must be performed last since it requires unit-normalized start and end values. */ /* Note: Relative percent values do not behave how most people think; while one would expect "+=50%" to increase the property 1.5x its current value, it in fact increases the percent units in absolute terms: 50 points is added on top of the current % value. */ switch (operator) { case "+": endValue = startValue + endValue; break; case "-": endValue = startValue - endValue; break; case "*": endValue = startValue * endValue; break; case "/": endValue = startValue / endValue; break; } /************************** tweensContainer Push **************************/ /* Construct the per-property tween object, and push it to the element's tweensContainer. */ tweensContainer[property] = { rootPropertyValue: rootPropertyValue, startValue: startValue, currentValue: startValue, endValue: endValue, unitType: endValueUnitType, easing: easing }; if (Velocity.debug) console.log("tweensContainer (" + property + "): " + JSON.stringify(tweensContainer[property]), element); } /* Along with its property data, store a reference to the element itself onto tweensContainer. */ tweensContainer.element = element; } /*************** Pushing ***************/ /* Note: tweensContainer can be empty if all of the properties in this call's property map were skipped due to not being supported by the browser. The element property is used as a proxy for checking that the tweensContainer has been appended to. */ if (tweensContainer.element) { /***************** Call Push *****************/ /* The call array houses the tweensContainers for each element being animated in the current call. */ call.push(tweensContainer); /* Store on the element its tweensContainer plus the current call's opts so that Velocity can reference this data the next time this element is animated. */ $.data(element, NAME).tweensContainer = tweensContainer; $.data(element, NAME).opts = opts; /* Switch on the element's animating flag. */ $.data(element, NAME).isAnimating = true; /****************** Calls Push ******************/ /* Once the final element in this call's targeted element set has been processed, push the call array onto Velocity.State.calls for the animation tick to immediately begin processing. */ if (elementsIndex === elementsLength - 1) { /* To speed up iterating over this array, it is compacted (falsey items -- calls that have completed -- are removed) when its length has ballooned to a point that can impact tick performance. This only becomes necessary when animation has been continuous with many elements over a long period of time; whenever all active calls are completed, completeCall() clears Velocity.State.calls. */ if (Velocity.State.calls.length > 10000) { Velocity.State.calls = compactSparseArray(Velocity.State.calls); } /* Add the current call plus its associated metadata (the element set and the call's options) onto the page-wide call container. Anything on this call container is subjected to tick() processing. */ Velocity.State.calls.push([ call, elements, opts ]); /* If the animation tick isn't currently running, start it. (Velocity shuts the tick off when there are no active calls to process.) */ if (Velocity.State.isTicking === false) { Velocity.State.isTicking = true; /* Start the tick loop. */ tick(); } } else { elementsIndex++; } } } /* When the queue option is set to false, the call skips the element's queue and fires immediately. */ if (opts.queue === false) { /* Since this buildQueue call doesn't respect the element's existing queue (which is where a delay option would have been appended), we manually inject the delay property here with an explicit setTimeout. */ if (opts.delay) { setTimeout(buildQueue, opts.delay); } else { buildQueue(); } /* Otherwise, the call undergoes element queueing as normal. */ /* Note: To interoperate with jQuery, Velocity uses jQuery's own $.queue() stack for queuing logic. */ } else { $.queue(element, opts.queue, function(next) { /* This is a flag used to indicate to the upcoming completeCall() function that this queue entry was initiated by Velocity. See completeCall() for further details. */ Velocity.velocityQueueEntryFlag = true; buildQueue(next); }); } /********************* Auto-Dequeuing *********************/ /* As per jQuery's $.queue() behavior, to fire the first non-custom-queue entry on an element, the element must be dequeued if its queue stack consists *solely* of the current call. (This can be determined by checking for the "inprogress" item that jQuery prepends to active queue stack arrays.) Regardless, whenever the element's queue is further appended with additional items -- including $.delay()'s or even $.animate() calls, the queue's first entry is automatically fired. This behavior contrasts that of custom queues, which never auto-fire. */ /* Note: When an element set is being subjected to a non-parallel Velocity call, the animation will not begin until each one of the elements in the set has reached the end of its individually pre-existing queue chain. */ /* Note: Unfortunately, most people don't fully grasp jQuery's powerful, yet quirky, $.queue() function. Lean more here: http://stackoverflow.com/questions/1058158/can-somebody-explain-jquery-queue-to-me */ if ((opts.queue === "" || opts.queue === "fx") && $.queue(element)[0] !== "inprogress") { $.dequeue(element); } } /************************** Element Set Iteration **************************/ /* Determine elements' type, then individually process each element in the set via processElement(). */ if (elementWrapped) { elements.each(processElement); /* Process a single raw DOM element. Check for a nodeType to avoid throwing errors due to invalid input. */ } else if (elementsLength === 1 && elements.nodeType) { processElement.call(elements); /* Otherwise, process a set of raw DOM elements. */ } else { for (var rawElementsIndex in elements) { if (elements[rawElementsIndex].nodeType) { processElement.call(elements[rawElementsIndex]); } } } /******************** Option: Loop ********************/ /* The loop option accepts an integer indicating how many times the element should loop between the values in the current call's properties map and the element's property values prior to this call. */ /* Note: The loop option's logic is performed here -- after element processing -- because the current call needs to undergo its queue insertion prior to the loop option generating its series of constituent "reverse" calls, which chain after the current call. Two reverse calls (two "alternations") constitute one loop. */ var opts = $.extend({}, Velocity.defaults, options), reverseCallsCount; opts.loop = parseInt(opts.loop); reverseCallsCount = (opts.loop * 2) - 1; if (opts.loop) { /* Double the loop count to convert it into its appropriate number of "reverse" calls. Subtract 1 from the resulting value since the current call is included in the total alternation count. */ for (var x = 0; x < reverseCallsCount; x++) { /* Since the logic for the reverse action occurs inside Queueing and thus this call's options object isn't parsed until then as well, the current call's delay option must be explicitly passed into the reverse call so that the delay logic that occurs inside *Pre-Queueing* can process this delay. */ var reverseOptions = { delay: opts.delay }; /* If a complete callback was passed into this call, transfer it to the loop sequence's final "reverse" call so that it's triggered when the entire sequence is complete (and not when the very first animation is complete). */ if (opts.complete && (x === reverseCallsCount - 1)) { reverseOptions.complete = opts.complete; } if (elementWrapped) { elements.velocity("reverse", reverseOptions); } else { Velocity.animate(elements, "reverse", reverseOptions); } } } /************** Chaining **************/ /* Return the processed elements back to the call chain. */ return elements; }; /***************************** Tick (Calls Processing) *****************************/ /* Note: There is only a single tick() instance; all calls to Velocity are pushed to the Velocity.State.calls array, which is fully iterated through upon each tick. */ function tick (timestamp) { /* An empty timestamp argument indicates that this is the first tick occurence since ticking was turned on (which implies that this tick wasn't called by itself). We leverage this indicator to fully ignore the first tick pass since RAF's initial pass is fired whenever the browser's next tick sync time occurs (whereas subsequent RAF passes are spaced by a timer resolution of ~16ms), which results in the first elements subjected to Velocity calls being animated out of sync with any elements animated immediately thereafter. In short, we ignore the first RAF tick pass so that elements being immediately consecutively animated -- instead of simultaneously animated by the same Velocity call -- are properly batched into the same initial RAF tick and consequently remain in sync thereafter. */ if (timestamp) { /* We ignore RAF's high resolution timestamp since it can be significantly offset when the browser is under high stress; we opt for choppiness over allowing the browser to drop huge chunks of frames. */ var timeCurrent = (new Date).getTime(); /******************** Call Iteration ********************/ /* Iterate through each active call. */ for (var i = 0, callsLength = Velocity.State.calls.length; i < callsLength; i++) { /* When a velocity call is completed, its Velocity.State.calls array entry is set to false. Continue on to the next call. */ if (!Velocity.State.calls[i]) { continue; } /************************ Call-Wide Variables ************************/ var callContainer = Velocity.State.calls[i], call = callContainer[0], opts = callContainer[2], timeStart = callContainer[3]; /* If timeStart is undefined, then this is the first time that this call has been processed by tick(). We assign timeStart now so that its value is as close to the real animation start time as possible. (Conversely, had timeStart been defined when this call was added to Velocity.State.calls, the delay between that time and now would cause the first few frames of the tween to be skipped since percentComplete is calculated relative to timeStart.) */ /* Further, subtract 16ms (the approximate resolution of RAF) from the current time value so that the first tick iteration isn't wasted by animating at 0% tween completion, which would produce the same style value as the element's current value. */ if (!timeStart) { timeStart = Velocity.State.calls[i][3] = timeCurrent - 16; } /* The tween's completion percentage is relative to the tween's start time, not the tween's start value (which would result in unpredictable tween durations since JavaScript's timers are not particularly accurate). Accordingly, we ensure that percentComplete does not exceed 1. */ var percentComplete = Math.min((timeCurrent - timeStart) / opts.duration, 1); /********************** Element Iteration **********************/ /* For every call, iterate through each of the elements in its set. */ for (var j = 0, callLength = call.length; j < callLength; j++) { var tweensContainer = call[j], element = tweensContainer.element; /* Check to see if this element has been deleted midway through the animation by checking for the continued existence of its data cache. If it's gone, skip animating this element. */ if (!$.data(element, NAME)) { continue; } var transformPropertyExists = false; /********************* Display Toggling *********************/ /* If the display option is set to non-"none", set it upfront so that the element has a chance to become visible before tweening begins. (Otherwise, display's "none" value is set in completeCall() once the animation has completed.) */ if (opts.display && opts.display !== "none") { CSS.setPropertyValue(element, "display", opts.display); } /************************ Property Iteration ************************/ /* For every element, iterate through each property. */ for (var property in tweensContainer) { /* Note: In addition to property tween data, tweensContainer contains a reference to its associated element. */ if (property !== "element") { var tween = tweensContainer[property], currentValue, /* Easing can either be a bezier function or a string that references a pre-registered easing on the Velocity.Easings object. In either case, return the appropriate easing function. */ easing = (typeof tween.easing === "string") ? Velocity.Easings[tween.easing] : tween.easing; /****************************** Current Value Calculation ******************************/ /* If this is the last tick pass (if we've reached 100% completion for this tween), ensure that currentValue is explicitly set to its target endValue so that it's not subjected to any rounding. */ if (percentComplete === 1) { currentValue = tween.endValue; /* Otherwise, calculate currentValue based on the current delta from startValue. */ } else { currentValue = tween.startValue + ((tween.endValue - tween.startValue) * easing(percentComplete)); } tween.currentValue = currentValue; /****************** Hooks: Part I ******************/ /* For hooked properties, the newly-updated rootPropertyValueCache is cached onto the element so that it can be used for subsequent hooks in this call that are associated with the same root property. If we didn't cache the updated rootPropertyValue, each subsequent update to the root property in this tick pass would reset the previous hook's updates to rootPropertyValue prior to injection. */ /* A nice performance byproduct of rootPropertyValue caching is that subsequently chained animations using the same hookRoot but a different hook can use this cached rootPropertyValue. */ if (CSS.Hooks.registered[property]) { var hookRoot = CSS.Hooks.getRoot(property), rootPropertyValueCache = $.data(element, NAME).rootPropertyValueCache[hookRoot]; if (rootPropertyValueCache) { tween.rootPropertyValue = rootPropertyValueCache; } } /***************** DOM Update *****************/ /* setPropertyValue() returns an array of the property name and property value post any normalization that may have been performed. */ /* Note: To solve an IE<=8 positioning bug, the unit type is dropped when setting a property value of 0. */ var adjustedSetData = CSS.setPropertyValue(element, property, tween.currentValue + (parseFloat(currentValue) === 0 ? "" : tween.unitType), tween.rootPropertyValue, tween.scrollData); /* SET */ /******************* Hooks: Part II *******************/ /* Now that we have the hook's updated rootPropertyValue (which is the post-processed value provided by the adjustedSetData array), cache it onto the element. */ if (CSS.Hooks.registered[property]) { /* Since adjustedSetData contains normalized data ready for DOM updating, the rootPropertyValue needs to be re-extracted from its normalized form. */ if (CSS.Normalizations.registered[hookRoot]) { $.data(element, NAME).rootPropertyValueCache[hookRoot] = CSS.Normalizations.registered[hookRoot]("extract", null, adjustedSetData[1]); } else { $.data(element, NAME).rootPropertyValueCache[hookRoot] = adjustedSetData[1]; } } /*************** Transforms ***************/ /* Flag whether a transform property is being animated so that flushTransformCache() can be triggered once this tick pass is complete. */ if (adjustedSetData[0] === "transform") { transformPropertyExists = true; } } } /**************** mobileHA ****************/ /* If mobileHA is enabled, set the translate3d transform to null to force hardware acceleration. It's safe to override this property since Velocity doesn't actually support its animation (hooks are used in its place). */ if (opts.mobileHA) { /* Don't set the null transform hack if we've already done so. */ if ($.data(element, NAME).transformCache.translate3d === undefined) { /* All entries on the transformCache object are concatenated into a single transform string via flushTransformCache(). */ $.data(element, NAME).transformCache.translate3d = "(0px, 0px, 0px)"; transformPropertyExists = true; } } if (transformPropertyExists) { CSS.flushTransformCache(element); } } /* The non-"none" display value is only applied to an element once -- when its associated call is first ticked through. Accordingly, it's set to false so that it isn't re-processed by this call in the next tick. */ if (opts.display && opts.display !== "none") { Velocity.State.calls[i][2].display = false; } /* If this call has finished tweening, pass its index to completeCall() to handle call cleanup. */ if (percentComplete === 1) { completeCall(i); } } } /* Note: completeCall() contains the logic for setting the isTicking flag to false (which occurs when the last active call on Velocity.State.calls has completed). */ if (Velocity.State.isTicking) { requestAnimationFrame(tick); } } /********************** Call Completion **********************/ /* Note: Unlike tick(), which processes all active calls at once, call completion is handled on a per-call basis. */ function completeCall (callIndex) { /* Pull the metadata from the call. */ var call = Velocity.State.calls[callIndex][0], elements = Velocity.State.calls[callIndex][1], opts = Velocity.State.calls[callIndex][2]; var remainingCallsExist = false; /************************* Element Finalization *************************/ for (var i = 0, callLength = call.length; i < callLength; i++) { var element = call[i].element; /* If the display option is set to "none" (meaning the user intends to hide the element), set this value now that the animation is complete. */ /* Note: The display option is ignored with "reverse" calls, which is what loops are composed of. See reverse's logic for further details. */ if (opts.display === "none" && !opts.loop) { CSS.setPropertyValue(element, "display", opts.display); } /* If the element's queue is empty (if only the "inprogress" item is left at position 0) or if its queue is about to run a non-Velocity-initiated entry, turn off the isAnimating flag. A non-Velocity-initiatied queue entry's logic might alter an element's CSS values and thereby cause Velocity's cached value data to go stale. To detect if a queue entry was initiated by Velocity, we check for the existence of our special Velocity.queueEntryFlag declaration, which minifiers won't rename since the flag is assigned to jQuery's global $ object and thus exists out of Velocity's own scope. */ if ($.queue(element)[1] === undefined || !/\.velocityQueueEntryFlag/i.test($.queue(element)[1])) { /* The element may have been deleted. Ensure that its data cache still exists before acting on it. */ if ($.data(element, NAME)) { $.data(element, NAME).isAnimating = false; /* Clear the element's rootPropertyValueCache, which will become stale. */ $.data(element, NAME).rootPropertyValueCache = {}; /* Transform subproperties that trigger hardware acceleration are de-applied entirely when they hit their zero values so that HA'd elements don't remain blurry. */ var transformHAProperties = [ "transformPerspective", "translateZ", "rotateX", "rotateY" ], transformHAProperty, transformHAPropertyExists = false; for (var transformHAPropertyIndex in transformHAProperties) { transformHAProperty = transformHAProperties[transformHAPropertyIndex]; /* If any transform subproperty begins with "(0", remove it. */ if (/^\(0[^.]/.test($.data(element, NAME).transformCache[transformHAProperty])) { transformHAPropertyExists = true; delete $.data(element, NAME).transformCache[transformHAProperty]; } } /* Mobile devices have hardware acceleration removed at the end of the animation in order to avoid straining the GPU's available memory. */ if (opts.mobileHA) { transformHAPropertyExists = true; delete $.data(element, NAME).transformCache.translate3d; } /* Flush the subproperty removals to the DOM. */ if (transformHAPropertyExists) { CSS.flushTransformCache(element); } } } /********************** Option: Complete **********************/ /* The complete callback is fired once per call -- not once per elemenet -- and is passed the full raw DOM element set as both its context and its first argument. */ /* Note: If this is a loop, complete callback firing is handled by the loop's final reverse call -- we skip handling it here. */ if ((i === callLength - 1) && !opts.loop && opts.complete) { var rawElements = elements.jquery ? elements.get() : elements; opts.complete.call(rawElements, rawElements); } /**************** Dequeueing ****************/ /* Fire the next call in the queue so long as this call's queue wasn't set to false (to trigger a parallel animation), which would have already caused the next call to fire. */ /* Note: Even if the end of the animation queue has been reached, $.dequeue() must still be called in order to completely clear jQuery's animation queue. */ if (opts.queue !== false) { $.dequeue(element, opts.queue); } } /************************ Calls Array Cleanup ************************/ /* Since this call is complete, remove it from Velocity.State.calls. For performance reasons, the call is set to false instead of being deleted from the array. Learn more here: http://www.html5rocks.com/en/tutorials/speed/v8/ */ Velocity.State.calls[callIndex] = false; /* Iterate through the calls array to determine if this was the last running animation. If so, set a flag to end ticking and clear the calls array. */ for (var j = 0, callsLength = Velocity.State.calls.length; j < callsLength; j++) { if (Velocity.State.calls[j] !== false) { remainingCallsExist = true; break; } } if (remainingCallsExist === false) { /* tick() will detect this flag upon its next iteration and subsequently turn itself off. */ Velocity.State.isTicking = false; /* Clear the calls array so that its length is reset. */ delete Velocity.State.calls; Velocity.State.calls = []; } } /******************* Installation *******************/ /* Both jQuery and Zepto allow their $.fn object to be extended to allow wrapped elements to be subjected to plugin calls. If either framework is loaded, register a "velocity" extension pointing to Velocity's core animate() method. */ var framework = window.jQuery || window.Zepto; if (framework) { /* Assign the object function to Velocity's animate() method. */ framework.fn.velocity = Velocity.animate; /* Assign the object function's defaults to Velocity's global defaults object. */ framework.fn.velocity.defaults = Velocity.defaults; /* If this is the standalone version of Velocity. */ } else { /* Support for AMD and CommonJS module loaders. */ if (typeof define !== "undefined" && define.amd) { define(function() { return Velocity; }); } else if (typeof module !== "undefined" && module.exports) { module.exports = Velocity; } } /*********************** Packaged Sequences ***********************/ /* slideUp, slideDown */ $.each([ "Down", "Up" ], function(i, direction) { /* Generate the slide sequences dynamically in order to minimize code redundancy. */ Velocity.Sequences["slide" + direction] = function (element, options) { var opts = $.extend({}, options), originalValues = { height: null, marginTop: null, marginBottom: null, paddingTop: null, paddingBottom: null, overflow: null, overflowX: null, overflowY: null }, /* The slide functions make use of the begin and complete callbacks, so the the user's custom callbacks are stored upfront for triggering once slideDown/Up's own callback logic is complete. */ begin = opts.begin, complete = opts.complete, isHeightAuto = false; /* Unless the user is trying to override the display option, show the element before slideDown begins and hide the element after slideUp completes. */ if (direction === "Down") { /* All elements subjected to sliding down are set to the "block" display value (-- )as opposed to an element-appropriate block/inline distinction) because inline elements cannot actually have their dimensions modified. */ opts.display = opts.display || "block"; } else { opts.display = opts.display || "none"; } /* Begin callback. */ opts.begin = function () { /* Check for height: "auto" so we can revert back to it when the sliding animation is complete. */ function checkHeightAuto() { element.style.display = "block"; originalValues.height = Velocity.CSS.getPropertyValue(element, "height"); /* We determine if height was originally set to "auto" by checking if the computed "auto" value is identical to the original value. */ element.style.height = "auto"; if (Velocity.CSS.getPropertyValue(element, "height") === originalValues.height) { isHeightAuto = true; } /* Revert to the computed value before sliding begins to prevent vertical popping due to scrollbars. */ /* Note: Webkit has a glitch where height must be explicitly assigned the "px" unit to take effect when height is currently set to "auto". */ Velocity.CSS.setPropertyValue(element, "height", originalValues.height + "px"); } if (direction === "Down") { originalValues.overflow = [ Velocity.CSS.getPropertyValue(element, "overflow"), 0 ]; originalValues.overflowX = [ Velocity.CSS.getPropertyValue(element, "overflowX"), 0 ]; originalValues.overflowY = [ Velocity.CSS.getPropertyValue(element, "overflowY"), 0 ]; /* Ensure the element is visible, and temporarily remove vertical scrollbars since animating them is visually unappealing. */ element.style.overflow = "hidden"; element.style.overflowX = "visible"; element.style.overflowY = "hidden"; /* With the scrollars no longer affecting sizing, determine whether the element is currently set to height: "auto". */ checkHeightAuto(); /* Cache the elements' original vertical dimensional values so that we can animate back to them from starting values of 0. */ for (var property in originalValues) { /* Overflow values have already been cached, do not overwrite them with "hidden" (which they were just set to). */ if (/^overflow/.test(property)) { continue; } /* Use forcefeeding to animate slideDown properties from 0. */ originalValues[property] = [ Velocity.CSS.getPropertyValue(element, property), 0 ]; } /* Hide the element inside this begin callback, otherwise it'll momentarily flash itself before the actual animation tick begins. */ element.style.display = "none"; } else { checkHeightAuto(); for (var property in originalValues) { /* Use forcefeeding to animate slideUp properties toward 0. */ originalValues[property] = [ 0, Velocity.CSS.getPropertyValue(element, property) ]; } /* As with slideDown, slideUp hides the element's scrollbars while animating since scrollbar height tweening looks unappealing. */ element.style.overflow = "hidden"; element.style.overflowX = "visible"; element.style.overflowY = "hidden"; } /* If the user passed in a begin callback, fire it now. */ if (begin) { begin.call(element, element); } } /* Complete callback. */ opts.complete = function (element) { var propertyValuePosition = (direction === "Down") ? 0 : 1; if (isHeightAuto === true) { /* If the element's height was originally set to auto, overwrite the computed value with "auto". */ originalValues.height[propertyValuePosition] = "auto"; } else { /* Note: Webkit has a glitch where height must be explicitly assigned the "px" unit to take effect after an element's height has been set to "auto". */ originalValues.height[propertyValuePosition] += "px"; } /* Reset the element to its original values once its slide animation is complete. (For slideDown, overflow values are reset. For slideUp, all values are reset (since they were animated to 0).) */ for (var property in originalValues) { element.style[property] = originalValues[property][propertyValuePosition]; } /* If the user passed in a complete callback, fire it now. */ if (complete) { complete.call(element, element); } }; /* Animation triggering. */ Velocity.animate(element, originalValues, opts); }; }); /* fadeIn, fadeOut */ $.each([ "In", "Out" ], function(i, direction) { /* Generate the slide sequences dynamically in order to minimize code redundancy. */ Velocity.Sequences["fade" + direction] = function (element, options, elementsIndex, elementsSize) { var opts = $.extend({}, options), propertiesMap = { opacity: (direction === "In") ? 1 : 0 }; /* Since sequences are triggered individually for each element in the animated set, we avoid repeatedly triggering callbacks by firing them only when the final element is reached. */ if (elementsIndex !== elementsSize - 1) { opts.complete = opts.begin = null; } /* If a display value was passed into the sequence, use it. Otherwise, default to "none" for fadeOut and default to the element-specific default value for fadeIn. */ /* Note: We allow users to pass in "null" to skip display setting altogether. */ if (opts.display !== null) { opts.display = (direction === "In") ? Velocity.CSS.Values.getDisplayType(element) : "none"; } Velocity.animate(this, propertiesMap, opts); }; }); })((window.jQuery || window.Zepto || window), window, document); /****************** Known Issues ******************/ /* When animating height or width to a % value on an element *without* box-sizing:border-box and *with* visible scrollbars on *both* axes, the opposite axis (e.g. height vs width) will be shortened by the height/width of its scrollbar. */ /* The translateX/Y/Z subproperties of the transform CSS property are %-relative to the element itself -- not its parent. Velocity, however, doesn't make the distinction. Thus, converting to or from the % unit with these subproperties will produce an inaccurate conversion value. */
FaiblUG/cdnjs
ajax/libs/velocity/0.0.18/jquery.velocity.js
JavaScript
mit
178,453
YUI.add("tabview-base",function(B){var C=B.ClassNameManager.getClassName,F="tabview",K="tab",L="content",J="panel",G="selected",H={},I=".",D={tabview:C(F),tabviewPanel:C(F,J),tabviewList:C(F,"list"),tab:C(K),tabLabel:C(K,"label"),tabPanel:C(K,J),selectedTab:C(K,G),selectedPanel:C(K,J,G)},E={tabview:I+D.tabview,tabviewList:"> ul",tab:"> ul > li",tabLabel:"> ul > li > a ",tabviewPanel:"> div",tabPanel:"> div > div",selectedTab:"> ul > "+I+D.selectedTab,selectedPanel:"> div "+I+D.selectedPanel},A=function(M){this.init.apply(this,arguments);};A.NAME="tabviewBase";A._queries=E;A._classNames=D;B.mix(A.prototype,{init:function(M){M=M||H;this._node=M.host||B.one(M.node);this.refresh();},initClassNames:function(M){B.Object.each(E,function(P,O){if(D[O]){var N=this.all(P);if(M!==undefined){N=N.item(M);}if(N){N.addClass(D[O]);}}},this._node);this._node.addClass(D.tabview);},_select:function(N){var Q=this._node,R=Q.one(E.selectedTab),P=Q.one(E.selectedPanel),O=Q.all(E.tab).item(N),M=Q.all(E.tabPanel).item(N);if(R){R.removeClass(D.selectedTab);}if(P){P.removeClass(D.selectedPanel);}if(O){O.addClass(D.selectedTab);}if(M){M.addClass(D.selectedPanel);}},initState:function(){var N=this._node,O=N.one(E.selectedTab),M=O?N.all(E.tab).indexOf(O):0;this._select(M);},_scrubTextNodes:function(){this._node.one(E.tabviewList).get("childNodes").each(function(M){if(M.get("nodeType")===3){M.remove();}});},refresh:function(){this._scrubTextNodes();this.initClassNames();this.initState();this.initEvents();},tabEventName:"click",initEvents:function(){this._node.delegate(this.tabEventName,this.onTabEvent,E.tab,this);},onTabEvent:function(M){M.preventDefault();this._select(this._node.all(E.tab).indexOf(M.currentTarget));},destroy:function(){this._node.detach(this.tabEventName);}});B.TabviewBase=A;},"@VERSION@",{requires:["node-event-delegate","classnamemanager","skin-sam-tabview"]});
Kaakati/cdnjs
ajax/libs/yui/3.2.0/tabview/tabview-base-min.js
JavaScript
mit
1,880
YUI.add("io-base",function(a){var h=a.Lang,k=["start","complete","end","success","failure"],g=["status","statusText","responseText","responseXML"],b="getAllResponseHeaders",d="getResponseHeader",i=a.config.win,j=i.XMLHttpRequest,e=i.XDomainRequest,f=0;function c(m){var l=this;l._uid="io:"+f++;l._init(m);a.io._map[l._uid]=l;}c.prototype={_id:0,_headers:{"X-Requested-With":"XMLHttpRequest"},_timeout:{},_init:function(n){var m=this,l;m.cfg=n||{};a.augment(m,a.EventTarget);for(l=0;l<5;l++){m.publish("io:"+k[l],a.merge({broadcast:1},n));m.publish("io-trn:"+k[l],n);}},_create:function(v,p){var s=this,r={id:h.isNumber(p)?p:s._id++,uid:s._uid},l=v.xdr,m=l?l.use:v.form&&v.form.upload?"iframe":"xhr",q=(l&&l.use==="native"&&e),n=s._transport;switch(m){case"native":case"xhr":r.c=q?new e():j?new j():new ActiveXObject("Microsoft.XMLHTTP");r.t=q?true:false;break;default:r.c=n?n[m]:{};r.t=true;}return r;},_destroy:function(l){if(i){if(j&&l.t===true){l.c.onreadystatechange=null;}else{if(a.UA.ie){l.c.abort();}}}l.c=null;l=null;},_evt:function(q,n,u){var t=this,l,x,v=u["arguments"],w=t.cfg.emitFacade,m="io:"+q,r="io-trn:"+q;if(n.e){n.c={status:0,statusText:n.e};}l=w?[{id:n.id,data:n.c,cfg:u,"arguments":v}]:[n.id];if(!w){if(q===k[0]||q===k[2]){if(v){l.push(v);}}else{x=v?l.push(n.c,v):l.push(n.c);}}l.unshift(m);t.fire.apply(t,l);if(u.on){l[0]=r;t.once(r,u.on[q],u.context||a);t.fire.apply(t,l);}},start:function(l,m){this._evt(k[0],l,m);},complete:function(l,m){this._evt(k[1],l,m);},end:function(l,m){this._evt(k[2],l,m);this._destroy(l);},success:function(l,m){this._evt(k[3],l,m);this.end(l,m);},failure:function(l,m){this._evt(k[4],l,m);this.end(l,m);},_retry:function(m,l,n){this._destroy(m);n.xdr.use="flash";return this.send(l,n,m.id);},_concat:function(l,m){l+=(l.indexOf("?")===-1?"?":"&")+m;return l;},setHeader:function(m,n){if(n){this._headers[m]=n;}else{delete this._headers[m];}},_setHeaders:function(m,l){l=a.merge(this._headers,l);a.Object.each(l,function(n,o){if(n!=="disable"){m.setRequestHeader(o,l[o]);}});},_startTimeout:function(m,l){var n=this;n._timeout[m.id]=i.setTimeout(function(){n._abort(m,"timeout");},l);},_clearTimeout:function(l){i.clearTimeout(this._timeout[l]);delete this._timeout[l];},_result:function(n,p){var l;try{l=n.c.status;}catch(m){l=0;}if(l>=200&&l<300||l===1223){this.success(n,p);}else{this.failure(n,p);}},_rS:function(l,n){var m=this;if(l.c.readyState===4){if(n.timeout){m._clearTimeout(l.id);}i.setTimeout(function(){m.complete(l,n);m._result(l,n);},0);}},_abort:function(m,l){if(m&&m.c){m.e=l;m.c.abort();}},send:function(p,y,t){var n,q,l,A,x,w=this,z=p;y=y?a.Object(y):{};n=w._create(y,t);q=y.method?y.method.toUpperCase():"GET";A=y.sync;x=y.data;if(h.isObject(x)){x=a.QueryString.stringify(x);}if(y.form){if(y.form.upload){return w.upload(n,p,y);}else{x=w._serialize(y.form,x);}}if(x){switch(q){case"GET":case"HEAD":case"DELETE":z=w._concat(z,x);x="";break;case"POST":case"PUT":y.headers=a.merge({"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},y.headers);break;}}if(n.t){return w.xdr(z,n,y);}if(!A){n.c.onreadystatechange=function(){w._rS(n,y);};}try{n.c.open(q,z,A?false:true,y.username||null,y.password||null);w._setHeaders(n.c,y.headers||{});w.start(n,y);if(y.xdr&&y.xdr.credentials){if(!a.UA.ie){n.c.withCredentials=true;}}n.c.send(x);if(A){l=a.mix({id:n.id,"arguments":y["arguments"]},n.c,false,g);l[b]=function(){return n.c[b]();};l[d]=function(m){return n.c[d](m);};w.complete(n,y);w._result(n,y);return l;}}catch(v){if(n.t){return w._retry(n,p,y);}else{w.complete(n,y);w._result(n,y);}}if(y.timeout){w._startTimeout(n,y.timeout);}return{id:n.id,abort:function(){return n.c?w._abort(n,"abort"):false;},isInProgress:function(){return n.c?n.c.readyState!==4&&n.c.readyState!==0:false;},io:w};}};a.io=function(l,n){var m=a.io._map["io:0"]||new c();return m.send.apply(m,[l,n]);};a.io.header=function(m,n){var p=a.io._map["io:0"]||new c();p.setHeader(m,n);};a.IO=c;a.io._map={};},"@VERSION@",{requires:["event-custom-base","querystring-stringify-simple"]});
CarlosOhh/cdnjs
ajax/libs/yui/3.4.0/io-base/io-base-min.js
JavaScript
mit
4,035
"use strict";angular.module("ngLocale",[],["$provide",function(a){var b={ZERO:"zero",ONE:"one",TWO:"two",FEW:"few",MANY:"many",OTHER:"other"};a.value("$locale",{DATETIME_FORMATS:{AMPMS:["a. m.","p. m."],DAY:["domingo","lunes","martes","mi\u00e9rcoles","jueves","viernes","s\u00e1bado"],ERANAMES:["antes de Cristo","despu\u00e9s de Cristo"],ERAS:["a. C.","d. C."],FIRSTDAYOFWEEK:0,MONTH:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"],SHORTDAY:["dom.","lun.","mar.","mi\u00e9.","jue.","vie.","s\u00e1b."],SHORTMONTH:["ene.","feb.","mar.","abr.","may.","jun.","jul.","ago.","sept.","oct.","nov.","dic."],WEEKENDRANGE:[5,6],fullDate:"EEEE, d 'de' MMMM 'de' y",longDate:"d 'de' MMMM 'de' y",medium:"d MMM y H:mm:ss",mediumDate:"d MMM y",mediumTime:"H:mm:ss","short":"d/M/yy H:mm",shortDate:"d/M/yy",shortTime:"H:mm"},NUMBER_FORMATS:{CURRENCY_SYM:"\u20ac",DECIMAL_SEP:",",GROUP_SEP:".",PATTERNS:[{gSize:3,lgSize:3,maxFrac:3,minFrac:0,minInt:1,negPre:"-",negSuf:"",posPre:"",posSuf:""},{gSize:3,lgSize:3,maxFrac:2,minFrac:2,minInt:1,negPre:"-",negSuf:"\u00a0\u00a4",posPre:"",posSuf:"\u00a0\u00a4"}]},id:"es-es",pluralCat:function(d,c){if(d==1){return b.ONE}return b.OTHER}})}]);
samthor/cdnjs
ajax/libs/angular-i18n/1.4.7/angular-locale_es-es.min.js
JavaScript
mit
1,240
if (typeof __coverage__ === 'undefined') { __coverage__ = {}; } if (!__coverage__['build/exec-command/exec-command.js']) { __coverage__['build/exec-command/exec-command.js'] = {"path":"build/exec-command/exec-command.js","s":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0,"106":0,"107":0,"108":0,"109":0,"110":0,"111":0,"112":0,"113":0,"114":0,"115":0,"116":0,"117":0,"118":0,"119":0,"120":0,"121":0,"122":0,"123":0,"124":0,"125":0,"126":0,"127":0,"128":0,"129":0,"130":0,"131":0,"132":0,"133":0,"134":0,"135":0,"136":0,"137":0,"138":0,"139":0,"140":0,"141":0,"142":0,"143":0,"144":0,"145":0,"146":0,"147":0,"148":0,"149":0,"150":0,"151":0,"152":0,"153":0,"154":0,"155":0,"156":0,"157":0,"158":0,"159":0,"160":0,"161":0,"162":0,"163":0,"164":0,"165":0,"166":0,"167":0,"168":0,"169":0,"170":0,"171":0,"172":0,"173":0,"174":0,"175":0,"176":0,"177":0,"178":0,"179":0,"180":0,"181":0,"182":0,"183":0,"184":0,"185":0,"186":0,"187":0,"188":0,"189":0,"190":0,"191":0,"192":0,"193":0,"194":0,"195":0,"196":0,"197":0,"198":0,"199":0,"200":0,"201":0,"202":0,"203":0,"204":0,"205":0,"206":0,"207":0,"208":0,"209":0,"210":0,"211":0,"212":0,"213":0,"214":0,"215":0,"216":0,"217":0,"218":0,"219":0,"220":0,"221":0,"222":0,"223":0,"224":0,"225":0,"226":0,"227":0,"228":0,"229":0,"230":0,"231":0,"232":0,"233":0,"234":0,"235":0,"236":0,"237":0,"238":0,"239":0,"240":0,"241":0,"242":0,"243":0,"244":0,"245":0,"246":0,"247":0,"248":0,"249":0,"250":0,"251":0,"252":0,"253":0,"254":0,"255":0,"256":0,"257":0,"258":0,"259":0,"260":0,"261":0,"262":0,"263":0,"264":0,"265":0,"266":0,"267":0,"268":0,"269":0,"270":0,"271":0},"b":{"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[0,0],"6":[0,0],"7":[0,0],"8":[0,0],"9":[0,0],"10":[0,0],"11":[0,0],"12":[0,0],"13":[0,0],"14":[0,0],"15":[0,0],"16":[0,0],"17":[0,0],"18":[0,0],"19":[0,0,0],"20":[0,0],"21":[0,0],"22":[0,0],"23":[0,0],"24":[0,0],"25":[0,0],"26":[0,0],"27":[0,0],"28":[0,0],"29":[0,0],"30":[0,0],"31":[0,0],"32":[0,0],"33":[0,0],"34":[0,0],"35":[0,0],"36":[0,0],"37":[0,0],"38":[0,0,0],"39":[0,0],"40":[0,0],"41":[0,0],"42":[0,0],"43":[0,0],"44":[0,0],"45":[0,0],"46":[0,0],"47":[0,0,0],"48":[0,0],"49":[0,0],"50":[0,0],"51":[0,0],"52":[0,0],"53":[0,0],"54":[0,0],"55":[0,0],"56":[0,0],"57":[0,0],"58":[0,0],"59":[0,0],"60":[0,0],"61":[0,0],"62":[0,0],"63":[0,0],"64":[0,0],"65":[0,0],"66":[0,0],"67":[0,0],"68":[0,0],"69":[0,0],"70":[0,0],"71":[0,0],"72":[0,0],"73":[0,0],"74":[0,0],"75":[0,0],"76":[0,0],"77":[0,0],"78":[0,0],"79":[0,0],"80":[0,0],"81":[0,0],"82":[0,0],"83":[0,0],"84":[0,0],"85":[0,0],"86":[0,0],"87":[0,0],"88":[0,0],"89":[0,0],"90":[0,0],"91":[0,0],"92":[0,0],"93":[0,0]},"f":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":43}}},"2":{"name":"(anonymous_2)","line":12,"loc":{"start":{"line":12,"column":26},"end":{"line":12,"column":37}}},"3":{"name":"(anonymous_3)","line":23,"loc":{"start":{"line":23,"column":20},"end":{"line":23,"column":45}}},"4":{"name":"(anonymous_4)","line":53,"loc":{"start":{"line":53,"column":30},"end":{"line":53,"column":42}}},"5":{"name":"(anonymous_5)","line":86,"loc":{"start":{"line":86,"column":21},"end":{"line":86,"column":45}}},"6":{"name":"(anonymous_6)","line":102,"loc":{"start":{"line":102,"column":22},"end":{"line":102,"column":46}}},"7":{"name":"(anonymous_7)","line":122,"loc":{"start":{"line":122,"column":25},"end":{"line":122,"column":36}}},"8":{"name":"(anonymous_8)","line":128,"loc":{"start":{"line":128,"column":25},"end":{"line":128,"column":36}}},"9":{"name":"(anonymous_9)","line":130,"loc":{"start":{"line":130,"column":33},"end":{"line":130,"column":57}}},"10":{"name":"(anonymous_10)","line":133,"loc":{"start":{"line":133,"column":34},"end":{"line":133,"column":58}}},"11":{"name":"(anonymous_11)","line":138,"loc":{"start":{"line":138,"column":59},"end":{"line":138,"column":71}}},"12":{"name":"(anonymous_12)","line":142,"loc":{"start":{"line":142,"column":26},"end":{"line":142,"column":50}}},"13":{"name":"(anonymous_13)","line":184,"loc":{"start":{"line":184,"column":22},"end":{"line":184,"column":41}}},"14":{"name":"(anonymous_14)","line":196,"loc":{"start":{"line":196,"column":28},"end":{"line":196,"column":48}}},"15":{"name":"(anonymous_15)","line":212,"loc":{"start":{"line":212,"column":32},"end":{"line":212,"column":52}}},"16":{"name":"(anonymous_16)","line":230,"loc":{"start":{"line":230,"column":26},"end":{"line":230,"column":37}}},"17":{"name":"(anonymous_17)","line":236,"loc":{"start":{"line":236,"column":33},"end":{"line":236,"column":45}}},"18":{"name":"(anonymous_18)","line":249,"loc":{"start":{"line":249,"column":37},"end":{"line":249,"column":49}}},"19":{"name":"(anonymous_19)","line":280,"loc":{"start":{"line":280,"column":29},"end":{"line":280,"column":48}}},"20":{"name":"(anonymous_20)","line":291,"loc":{"start":{"line":291,"column":26},"end":{"line":291,"column":45}}},"21":{"name":"(anonymous_21)","line":303,"loc":{"start":{"line":303,"column":29},"end":{"line":303,"column":48}}},"22":{"name":"(anonymous_22)","line":315,"loc":{"start":{"line":315,"column":27},"end":{"line":315,"column":46}}},"23":{"name":"(anonymous_23)","line":347,"loc":{"start":{"line":347,"column":27},"end":{"line":347,"column":46}}},"24":{"name":"(anonymous_24)","line":383,"loc":{"start":{"line":383,"column":29},"end":{"line":383,"column":40}}},"25":{"name":"(anonymous_25)","line":395,"loc":{"start":{"line":395,"column":27},"end":{"line":395,"column":46}}},"26":{"name":"(anonymous_26)","line":415,"loc":{"start":{"line":415,"column":27},"end":{"line":415,"column":46}}},"27":{"name":"(anonymous_27)","line":443,"loc":{"start":{"line":443,"column":37},"end":{"line":443,"column":48}}},"28":{"name":"(anonymous_28)","line":452,"loc":{"start":{"line":452,"column":35},"end":{"line":452,"column":46}}},"29":{"name":"(anonymous_29)","line":462,"loc":{"start":{"line":462,"column":22},"end":{"line":462,"column":41}}},"30":{"name":"(anonymous_30)","line":494,"loc":{"start":{"line":494,"column":37},"end":{"line":494,"column":49}}},"31":{"name":"(anonymous_31)","line":536,"loc":{"start":{"line":536,"column":44},"end":{"line":536,"column":56}}},"32":{"name":"(anonymous_32)","line":544,"loc":{"start":{"line":544,"column":41},"end":{"line":544,"column":53}}},"33":{"name":"(anonymous_33)","line":605,"loc":{"start":{"line":605,"column":37},"end":{"line":605,"column":49}}},"34":{"name":"(anonymous_34)","line":628,"loc":{"start":{"line":628,"column":42},"end":{"line":628,"column":54}}},"35":{"name":"(anonymous_35)","line":646,"loc":{"start":{"line":646,"column":25},"end":{"line":646,"column":44}}},"36":{"name":"(anonymous_36)","line":670,"loc":{"start":{"line":670,"column":31},"end":{"line":670,"column":42}}},"37":{"name":"(anonymous_37)","line":678,"loc":{"start":{"line":678,"column":29},"end":{"line":678,"column":40}}},"38":{"name":"(anonymous_38)","line":686,"loc":{"start":{"line":686,"column":30},"end":{"line":686,"column":41}}},"39":{"name":"(anonymous_39)","line":694,"loc":{"start":{"line":694,"column":29},"end":{"line":694,"column":40}}},"40":{"name":"(anonymous_40)","line":701,"loc":{"start":{"line":701,"column":40},"end":{"line":701,"column":51}}},"41":{"name":"(anonymous_41)","line":704,"loc":{"start":{"line":704,"column":42},"end":{"line":704,"column":53}}},"42":{"name":"(anonymous_42)","line":707,"loc":{"start":{"line":707,"column":45},"end":{"line":707,"column":56}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":717,"column":41}},"2":{"start":{"line":12,"column":8},"end":{"line":64,"column":10}},"3":{"start":{"line":13,"column":12},"end":{"line":13,"column":70}},"4":{"start":{"line":24,"column":12},"end":{"line":28,"column":41}},"5":{"start":{"line":30,"column":12},"end":{"line":62,"column":13}},"6":{"start":{"line":31,"column":16},"end":{"line":31,"column":36}},"7":{"start":{"line":32,"column":16},"end":{"line":32,"column":44}},"8":{"start":{"line":33,"column":16},"end":{"line":33,"column":36}},"9":{"start":{"line":35,"column":16},"end":{"line":61,"column":17}},"10":{"start":{"line":36,"column":20},"end":{"line":36,"column":74}},"11":{"start":{"line":38,"column":20},"end":{"line":38,"column":58}},"12":{"start":{"line":40,"column":20},"end":{"line":40,"column":56}},"13":{"start":{"line":41,"column":20},"end":{"line":41,"column":49}},"14":{"start":{"line":42,"column":20},"end":{"line":42,"column":47}},"15":{"start":{"line":44,"column":20},"end":{"line":44,"column":39}},"16":{"start":{"line":45,"column":20},"end":{"line":47,"column":21}},"17":{"start":{"line":46,"column":24},"end":{"line":46,"column":41}},"18":{"start":{"line":49,"column":20},"end":{"line":49,"column":37}},"19":{"start":{"line":51,"column":20},"end":{"line":51,"column":52}},"20":{"start":{"line":53,"column":20},"end":{"line":55,"column":23}},"21":{"start":{"line":54,"column":24},"end":{"line":54,"column":41}},"22":{"start":{"line":56,"column":20},"end":{"line":56,"column":35}},"23":{"start":{"line":57,"column":20},"end":{"line":59,"column":21}},"24":{"start":{"line":58,"column":24},"end":{"line":58,"column":49}},"25":{"start":{"line":60,"column":20},"end":{"line":60,"column":33}},"26":{"start":{"line":63,"column":12},"end":{"line":63,"column":31}},"27":{"start":{"line":66,"column":8},"end":{"line":698,"column":11}},"28":{"start":{"line":87,"column":16},"end":{"line":87,"column":54}},"29":{"start":{"line":89,"column":16},"end":{"line":93,"column":17}},"30":{"start":{"line":90,"column":20},"end":{"line":90,"column":56}},"31":{"start":{"line":92,"column":20},"end":{"line":92,"column":56}},"32":{"start":{"line":103,"column":16},"end":{"line":103,"column":46}},"33":{"start":{"line":104,"column":16},"end":{"line":115,"column":17}},"34":{"start":{"line":105,"column":20},"end":{"line":112,"column":21}},"35":{"start":{"line":106,"column":24},"end":{"line":106,"column":77}},"36":{"start":{"line":108,"column":24},"end":{"line":111,"column":25}},"37":{"start":{"line":109,"column":28},"end":{"line":109,"column":75}},"38":{"start":{"line":113,"column":20},"end":{"line":113,"column":69}},"39":{"start":{"line":123,"column":16},"end":{"line":125,"column":17}},"40":{"start":{"line":124,"column":20},"end":{"line":124,"column":64}},"41":{"start":{"line":126,"column":16},"end":{"line":126,"column":34}},"42":{"start":{"line":129,"column":16},"end":{"line":136,"column":19}},"43":{"start":{"line":131,"column":24},"end":{"line":131,"column":64}},"44":{"start":{"line":134,"column":24},"end":{"line":134,"column":65}},"45":{"start":{"line":138,"column":16},"end":{"line":140,"column":26}},"46":{"start":{"line":139,"column":20},"end":{"line":139,"column":46}},"47":{"start":{"line":143,"column":16},"end":{"line":143,"column":92}},"48":{"start":{"line":145,"column":16},"end":{"line":149,"column":17}},"49":{"start":{"line":146,"column":20},"end":{"line":146,"column":47}},"50":{"start":{"line":148,"column":20},"end":{"line":148,"column":39}},"51":{"start":{"line":150,"column":16},"end":{"line":150,"column":27}},"52":{"start":{"line":185,"column":20},"end":{"line":185,"column":50}},"53":{"start":{"line":186,"column":20},"end":{"line":186,"column":73}},"54":{"start":{"line":197,"column":20},"end":{"line":197,"column":50}},"55":{"start":{"line":198,"column":20},"end":{"line":202,"column":21}},"56":{"start":{"line":199,"column":24},"end":{"line":199,"column":80}},"57":{"start":{"line":201,"column":24},"end":{"line":201,"column":58}},"58":{"start":{"line":213,"column":20},"end":{"line":213,"column":60}},"59":{"start":{"line":214,"column":20},"end":{"line":221,"column":21}},"60":{"start":{"line":215,"column":24},"end":{"line":215,"column":60}},"61":{"start":{"line":216,"column":24},"end":{"line":216,"column":63}},"62":{"start":{"line":217,"column":24},"end":{"line":217,"column":57}},"63":{"start":{"line":218,"column":24},"end":{"line":218,"column":52}},"64":{"start":{"line":220,"column":24},"end":{"line":220,"column":57}},"65":{"start":{"line":222,"column":20},"end":{"line":222,"column":31}},"66":{"start":{"line":231,"column":20},"end":{"line":240,"column":26}},"67":{"start":{"line":237,"column":28},"end":{"line":237,"column":61}},"68":{"start":{"line":238,"column":28},"end":{"line":238,"column":50}},"69":{"start":{"line":239,"column":28},"end":{"line":239,"column":37}},"70":{"start":{"line":242,"column":20},"end":{"line":246,"column":21}},"71":{"start":{"line":243,"column":24},"end":{"line":243,"column":55}},"72":{"start":{"line":245,"column":24},"end":{"line":245,"column":58}},"73":{"start":{"line":249,"column":20},"end":{"line":266,"column":23}},"74":{"start":{"line":250,"column":24},"end":{"line":250,"column":40}},"75":{"start":{"line":251,"column":24},"end":{"line":256,"column":25}},"76":{"start":{"line":252,"column":28},"end":{"line":252,"column":38}},"77":{"start":{"line":253,"column":28},"end":{"line":255,"column":29}},"78":{"start":{"line":254,"column":32},"end":{"line":254,"column":41}},"79":{"start":{"line":257,"column":24},"end":{"line":265,"column":25}},"80":{"start":{"line":258,"column":28},"end":{"line":258,"column":45}},"81":{"start":{"line":259,"column":28},"end":{"line":263,"column":29}},"82":{"start":{"line":260,"column":32},"end":{"line":260,"column":53}},"83":{"start":{"line":261,"column":32},"end":{"line":261,"column":56}},"84":{"start":{"line":262,"column":32},"end":{"line":262,"column":41}},"85":{"start":{"line":264,"column":28},"end":{"line":264,"column":39}},"86":{"start":{"line":267,"column":20},"end":{"line":270,"column":21}},"87":{"start":{"line":268,"column":24},"end":{"line":268,"column":37}},"88":{"start":{"line":269,"column":24},"end":{"line":269,"column":45}},"89":{"start":{"line":281,"column":20},"end":{"line":281,"column":81}},"90":{"start":{"line":292,"column":20},"end":{"line":292,"column":50}},"91":{"start":{"line":293,"column":20},"end":{"line":293,"column":84}},"92":{"start":{"line":304,"column":20},"end":{"line":304,"column":50}},"93":{"start":{"line":305,"column":20},"end":{"line":305,"column":87}},"94":{"start":{"line":316,"column":20},"end":{"line":317,"column":60}},"95":{"start":{"line":319,"column":20},"end":{"line":321,"column":21}},"96":{"start":{"line":320,"column":24},"end":{"line":320,"column":55}},"97":{"start":{"line":322,"column":20},"end":{"line":337,"column":21}},"98":{"start":{"line":323,"column":24},"end":{"line":334,"column":25}},"99":{"start":{"line":324,"column":28},"end":{"line":330,"column":29}},"100":{"start":{"line":325,"column":32},"end":{"line":325,"column":70}},"101":{"start":{"line":326,"column":32},"end":{"line":326,"column":51}},"102":{"start":{"line":328,"column":32},"end":{"line":328,"column":142}},"103":{"start":{"line":329,"column":32},"end":{"line":329,"column":60}},"104":{"start":{"line":331,"column":28},"end":{"line":331,"column":37}},"105":{"start":{"line":333,"column":28},"end":{"line":333,"column":59}},"106":{"start":{"line":336,"column":24},"end":{"line":336,"column":48}},"107":{"start":{"line":348,"column":20},"end":{"line":349,"column":60}},"108":{"start":{"line":351,"column":20},"end":{"line":353,"column":21}},"109":{"start":{"line":352,"column":24},"end":{"line":352,"column":44}},"110":{"start":{"line":354,"column":20},"end":{"line":356,"column":21}},"111":{"start":{"line":355,"column":24},"end":{"line":355,"column":55}},"112":{"start":{"line":357,"column":20},"end":{"line":373,"column":21}},"113":{"start":{"line":358,"column":24},"end":{"line":370,"column":25}},"114":{"start":{"line":359,"column":28},"end":{"line":366,"column":29}},"115":{"start":{"line":360,"column":32},"end":{"line":360,"column":80}},"116":{"start":{"line":361,"column":32},"end":{"line":361,"column":51}},"117":{"start":{"line":363,"column":32},"end":{"line":364,"column":126}},"118":{"start":{"line":365,"column":32},"end":{"line":365,"column":60}},"119":{"start":{"line":367,"column":28},"end":{"line":367,"column":37}},"120":{"start":{"line":369,"column":28},"end":{"line":369,"column":59}},"121":{"start":{"line":372,"column":24},"end":{"line":372,"column":48}},"122":{"start":{"line":384,"column":20},"end":{"line":384,"column":81}},"123":{"start":{"line":396,"column":20},"end":{"line":396,"column":51}},"124":{"start":{"line":397,"column":20},"end":{"line":398,"column":57}},"125":{"start":{"line":400,"column":20},"end":{"line":404,"column":21}},"126":{"start":{"line":401,"column":24},"end":{"line":403,"column":25}},"127":{"start":{"line":402,"column":28},"end":{"line":402,"column":60}},"128":{"start":{"line":416,"column":20},"end":{"line":416,"column":51}},"129":{"start":{"line":418,"column":20},"end":{"line":419,"column":60}},"130":{"start":{"line":421,"column":20},"end":{"line":435,"column":21}},"131":{"start":{"line":422,"column":24},"end":{"line":426,"column":25}},"132":{"start":{"line":423,"column":28},"end":{"line":425,"column":29}},"133":{"start":{"line":424,"column":32},"end":{"line":424,"column":74}},"134":{"start":{"line":427,"column":24},"end":{"line":434,"column":25}},"135":{"start":{"line":428,"column":28},"end":{"line":428,"column":60}},"136":{"start":{"line":429,"column":31},"end":{"line":434,"column":25}},"137":{"start":{"line":430,"column":28},"end":{"line":430,"column":96}},"138":{"start":{"line":431,"column":28},"end":{"line":433,"column":29}},"139":{"start":{"line":432,"column":32},"end":{"line":432,"column":59}},"140":{"start":{"line":444,"column":20},"end":{"line":444,"column":47}},"141":{"start":{"line":453,"column":20},"end":{"line":453,"column":47}},"142":{"start":{"line":463,"column":20},"end":{"line":475,"column":57}},"143":{"start":{"line":477,"column":20},"end":{"line":477,"column":82}},"144":{"start":{"line":479,"column":20},"end":{"line":637,"column":21}},"145":{"start":{"line":480,"column":24},"end":{"line":480,"column":47}},"146":{"start":{"line":481,"column":24},"end":{"line":481,"column":46}},"147":{"start":{"line":482,"column":24},"end":{"line":482,"column":61}},"148":{"start":{"line":484,"column":24},"end":{"line":487,"column":25}},"149":{"start":{"line":485,"column":28},"end":{"line":485,"column":53}},"150":{"start":{"line":486,"column":28},"end":{"line":486,"column":35}},"151":{"start":{"line":488,"column":24},"end":{"line":565,"column":25}},"152":{"start":{"line":489,"column":28},"end":{"line":489,"column":85}},"153":{"start":{"line":490,"column":28},"end":{"line":490,"column":46}},"154":{"start":{"line":491,"column":28},"end":{"line":491,"column":46}},"155":{"start":{"line":493,"column":28},"end":{"line":493,"column":42}},"156":{"start":{"line":494,"column":28},"end":{"line":496,"column":31}},"157":{"start":{"line":495,"column":32},"end":{"line":495,"column":76}},"158":{"start":{"line":497,"column":28},"end":{"line":497,"column":44}},"159":{"start":{"line":498,"column":28},"end":{"line":498,"column":54}},"160":{"start":{"line":499,"column":28},"end":{"line":501,"column":29}},"161":{"start":{"line":500,"column":32},"end":{"line":500,"column":56}},"162":{"start":{"line":502,"column":28},"end":{"line":508,"column":29}},"163":{"start":{"line":503,"column":32},"end":{"line":507,"column":33}},"164":{"start":{"line":504,"column":36},"end":{"line":504,"column":86}},"165":{"start":{"line":506,"column":36},"end":{"line":506,"column":77}},"166":{"start":{"line":509,"column":28},"end":{"line":513,"column":29}},"167":{"start":{"line":510,"column":32},"end":{"line":510,"column":62}},"168":{"start":{"line":512,"column":32},"end":{"line":512,"column":45}},"169":{"start":{"line":514,"column":28},"end":{"line":516,"column":29}},"170":{"start":{"line":515,"column":32},"end":{"line":515,"column":65}},"171":{"start":{"line":517,"column":28},"end":{"line":517,"column":43}},"172":{"start":{"line":519,"column":28},"end":{"line":519,"column":63}},"173":{"start":{"line":520,"column":28},"end":{"line":522,"column":29}},"174":{"start":{"line":521,"column":32},"end":{"line":521,"column":80}},"175":{"start":{"line":523,"column":28},"end":{"line":527,"column":29}},"176":{"start":{"line":524,"column":32},"end":{"line":526,"column":33}},"177":{"start":{"line":525,"column":36},"end":{"line":525,"column":64}},"178":{"start":{"line":528,"column":28},"end":{"line":542,"column":29}},"179":{"start":{"line":529,"column":32},"end":{"line":529,"column":59}},"180":{"start":{"line":531,"column":32},"end":{"line":532,"column":63}},"181":{"start":{"line":534,"column":32},"end":{"line":541,"column":33}},"182":{"start":{"line":535,"column":36},"end":{"line":535,"column":46}},"183":{"start":{"line":536,"column":36},"end":{"line":538,"column":39}},"184":{"start":{"line":537,"column":40},"end":{"line":537,"column":70}},"185":{"start":{"line":540,"column":36},"end":{"line":540,"column":50}},"186":{"start":{"line":543,"column":28},"end":{"line":543,"column":64}},"187":{"start":{"line":544,"column":28},"end":{"line":553,"column":31}},"188":{"start":{"line":545,"column":32},"end":{"line":545,"column":60}},"189":{"start":{"line":546,"column":32},"end":{"line":551,"column":33}},"190":{"start":{"line":547,"column":36},"end":{"line":549,"column":37}},"191":{"start":{"line":548,"column":40},"end":{"line":548,"column":66}},"192":{"start":{"line":550,"column":36},"end":{"line":550,"column":59}},"193":{"start":{"line":552,"column":32},"end":{"line":552,"column":61}},"194":{"start":{"line":554,"column":28},"end":{"line":554,"column":53}},"195":{"start":{"line":555,"column":28},"end":{"line":555,"column":50}},"196":{"start":{"line":556,"column":28},"end":{"line":556,"column":76}},"197":{"start":{"line":557,"column":28},"end":{"line":557,"column":40}},"198":{"start":{"line":558,"column":28},"end":{"line":560,"column":29}},"199":{"start":{"line":559,"column":32},"end":{"line":559,"column":59}},"200":{"start":{"line":561,"column":28},"end":{"line":563,"column":29}},"201":{"start":{"line":562,"column":32},"end":{"line":562,"column":61}},"202":{"start":{"line":564,"column":28},"end":{"line":564,"column":43}},"203":{"start":{"line":566,"column":27},"end":{"line":637,"column":21}},"204":{"start":{"line":567,"column":24},"end":{"line":567,"column":71}},"205":{"start":{"line":568,"column":24},"end":{"line":586,"column":25}},"206":{"start":{"line":569,"column":28},"end":{"line":571,"column":29}},"207":{"start":{"line":570,"column":32},"end":{"line":570,"column":60}},"208":{"start":{"line":572,"column":28},"end":{"line":572,"column":66}},"209":{"start":{"line":573,"column":28},"end":{"line":583,"column":29}},"210":{"start":{"line":574,"column":32},"end":{"line":574,"column":42}},"211":{"start":{"line":575,"column":32},"end":{"line":577,"column":33}},"212":{"start":{"line":576,"column":36},"end":{"line":576,"column":64}},"213":{"start":{"line":578,"column":32},"end":{"line":578,"column":126}},"214":{"start":{"line":579,"column":32},"end":{"line":579,"column":50}},"215":{"start":{"line":580,"column":32},"end":{"line":580,"column":63}},"216":{"start":{"line":582,"column":32},"end":{"line":582,"column":57}},"217":{"start":{"line":585,"column":28},"end":{"line":585,"column":53}},"218":{"start":{"line":588,"column":24},"end":{"line":588,"column":52}},"219":{"start":{"line":589,"column":24},"end":{"line":593,"column":25}},"220":{"start":{"line":590,"column":28},"end":{"line":590,"column":49}},"221":{"start":{"line":592,"column":28},"end":{"line":592,"column":87}},"222":{"start":{"line":594,"column":24},"end":{"line":596,"column":25}},"223":{"start":{"line":595,"column":28},"end":{"line":595,"column":82}},"224":{"start":{"line":598,"column":24},"end":{"line":600,"column":25}},"225":{"start":{"line":599,"column":28},"end":{"line":599,"column":56}},"226":{"start":{"line":601,"column":24},"end":{"line":623,"column":25}},"227":{"start":{"line":602,"column":28},"end":{"line":602,"column":59}},"228":{"start":{"line":603,"column":28},"end":{"line":603,"column":62}},"229":{"start":{"line":604,"column":28},"end":{"line":604,"column":48}},"230":{"start":{"line":605,"column":28},"end":{"line":607,"column":31}},"231":{"start":{"line":606,"column":32},"end":{"line":606,"column":95}},"232":{"start":{"line":608,"column":28},"end":{"line":614,"column":29}},"233":{"start":{"line":609,"column":32},"end":{"line":613,"column":33}},"234":{"start":{"line":610,"column":36},"end":{"line":610,"column":73}},"235":{"start":{"line":612,"column":36},"end":{"line":612,"column":64}},"236":{"start":{"line":615,"column":28},"end":{"line":617,"column":29}},"237":{"start":{"line":616,"column":32},"end":{"line":616,"column":79}},"238":{"start":{"line":618,"column":28},"end":{"line":618,"column":56}},"239":{"start":{"line":619,"column":28},"end":{"line":619,"column":46}},"240":{"start":{"line":620,"column":28},"end":{"line":620,"column":47}},"241":{"start":{"line":622,"column":28},"end":{"line":622,"column":53}},"242":{"start":{"line":624,"column":24},"end":{"line":624,"column":45}},"243":{"start":{"line":625,"column":24},"end":{"line":634,"column":25}},"244":{"start":{"line":626,"column":28},"end":{"line":633,"column":29}},"245":{"start":{"line":628,"column":32},"end":{"line":632,"column":35}},"246":{"start":{"line":629,"column":36},"end":{"line":631,"column":37}},"247":{"start":{"line":630,"column":40},"end":{"line":630,"column":65}},"248":{"start":{"line":636,"column":24},"end":{"line":636,"column":46}},"249":{"start":{"line":647,"column":20},"end":{"line":663,"column":21}},"250":{"start":{"line":648,"column":24},"end":{"line":651,"column":72}},"251":{"start":{"line":653,"column":28},"end":{"line":653,"column":47}},"252":{"start":{"line":654,"column":28},"end":{"line":654,"column":61}},"253":{"start":{"line":655,"column":28},"end":{"line":660,"column":29}},"254":{"start":{"line":656,"column":32},"end":{"line":656,"column":94}},"255":{"start":{"line":657,"column":32},"end":{"line":657,"column":70}},"256":{"start":{"line":658,"column":32},"end":{"line":658,"column":96}},"257":{"start":{"line":659,"column":32},"end":{"line":659,"column":75}},"258":{"start":{"line":662,"column":24},"end":{"line":662,"column":43}},"259":{"start":{"line":671,"column":20},"end":{"line":671,"column":61}},"260":{"start":{"line":679,"column":20},"end":{"line":679,"column":59}},"261":{"start":{"line":687,"column":20},"end":{"line":687,"column":60}},"262":{"start":{"line":695,"column":20},"end":{"line":695,"column":59}},"263":{"start":{"line":700,"column":8},"end":{"line":710,"column":9}},"264":{"start":{"line":701,"column":12},"end":{"line":703,"column":14}},"265":{"start":{"line":702,"column":16},"end":{"line":702,"column":71}},"266":{"start":{"line":704,"column":12},"end":{"line":706,"column":14}},"267":{"start":{"line":705,"column":16},"end":{"line":705,"column":74}},"268":{"start":{"line":707,"column":12},"end":{"line":709,"column":14}},"269":{"start":{"line":708,"column":16},"end":{"line":708,"column":85}},"270":{"start":{"line":712,"column":8},"end":{"line":712,"column":30}},"271":{"start":{"line":713,"column":8},"end":{"line":713,"column":43}}},"branchMap":{"1":{"line":30,"type":"if","locations":[{"start":{"line":30,"column":12},"end":{"line":30,"column":12}},{"start":{"line":30,"column":12},"end":{"line":30,"column":12}}]},"2":{"line":35,"type":"if","locations":[{"start":{"line":35,"column":16},"end":{"line":35,"column":16}},{"start":{"line":35,"column":16},"end":{"line":35,"column":16}}]},"3":{"line":45,"type":"if","locations":[{"start":{"line":45,"column":20},"end":{"line":45,"column":20}},{"start":{"line":45,"column":20},"end":{"line":45,"column":20}}]},"4":{"line":57,"type":"if","locations":[{"start":{"line":57,"column":20},"end":{"line":57,"column":20}},{"start":{"line":57,"column":20},"end":{"line":57,"column":20}}]},"5":{"line":89,"type":"if","locations":[{"start":{"line":89,"column":16},"end":{"line":89,"column":16}},{"start":{"line":89,"column":16},"end":{"line":89,"column":16}}]},"6":{"line":123,"type":"if","locations":[{"start":{"line":123,"column":16},"end":{"line":123,"column":16}},{"start":{"line":123,"column":16},"end":{"line":123,"column":16}}]},"7":{"line":143,"type":"cond-expr","locations":[{"start":{"line":143,"column":78},"end":{"line":143,"column":82}},{"start":{"line":143,"column":85},"end":{"line":143,"column":90}}]},"8":{"line":143,"type":"binary-expr","locations":[{"start":{"line":143,"column":28},"end":{"line":143,"column":62}},{"start":{"line":143,"column":66},"end":{"line":143,"column":75}}]},"9":{"line":145,"type":"if","locations":[{"start":{"line":145,"column":16},"end":{"line":145,"column":16}},{"start":{"line":145,"column":16},"end":{"line":145,"column":16}}]},"10":{"line":198,"type":"if","locations":[{"start":{"line":198,"column":20},"end":{"line":198,"column":20}},{"start":{"line":198,"column":20},"end":{"line":198,"column":20}}]},"11":{"line":198,"type":"binary-expr","locations":[{"start":{"line":198,"column":24},"end":{"line":198,"column":56}},{"start":{"line":198,"column":60},"end":{"line":198,"column":67}}]},"12":{"line":214,"type":"if","locations":[{"start":{"line":214,"column":20},"end":{"line":214,"column":20}},{"start":{"line":214,"column":20},"end":{"line":214,"column":20}}]},"13":{"line":235,"type":"cond-expr","locations":[{"start":{"line":235,"column":44},"end":{"line":235,"column":71}},{"start":{"line":235,"column":74},"end":{"line":235,"column":79}}]},"14":{"line":242,"type":"if","locations":[{"start":{"line":242,"column":20},"end":{"line":242,"column":20}},{"start":{"line":242,"column":20},"end":{"line":242,"column":20}}]},"15":{"line":251,"type":"if","locations":[{"start":{"line":251,"column":24},"end":{"line":251,"column":24}},{"start":{"line":251,"column":24},"end":{"line":251,"column":24}}]},"16":{"line":253,"type":"if","locations":[{"start":{"line":253,"column":28},"end":{"line":253,"column":28}},{"start":{"line":253,"column":28},"end":{"line":253,"column":28}}]},"17":{"line":257,"type":"if","locations":[{"start":{"line":257,"column":24},"end":{"line":257,"column":24}},{"start":{"line":257,"column":24},"end":{"line":257,"column":24}}]},"18":{"line":259,"type":"if","locations":[{"start":{"line":259,"column":28},"end":{"line":259,"column":28}},{"start":{"line":259,"column":28},"end":{"line":259,"column":28}}]},"19":{"line":259,"type":"binary-expr","locations":[{"start":{"line":259,"column":33},"end":{"line":259,"column":49}},{"start":{"line":259,"column":53},"end":{"line":259,"column":80}},{"start":{"line":259,"column":85},"end":{"line":259,"column":95}}]},"20":{"line":267,"type":"if","locations":[{"start":{"line":267,"column":20},"end":{"line":267,"column":20}},{"start":{"line":267,"column":20},"end":{"line":267,"column":20}}]},"21":{"line":267,"type":"binary-expr","locations":[{"start":{"line":267,"column":24},"end":{"line":267,"column":35}},{"start":{"line":267,"column":39},"end":{"line":267,"column":43}}]},"22":{"line":319,"type":"if","locations":[{"start":{"line":319,"column":20},"end":{"line":319,"column":20}},{"start":{"line":319,"column":20},"end":{"line":319,"column":20}}]},"23":{"line":322,"type":"if","locations":[{"start":{"line":322,"column":20},"end":{"line":322,"column":20}},{"start":{"line":322,"column":20},"end":{"line":322,"column":20}}]},"24":{"line":323,"type":"if","locations":[{"start":{"line":323,"column":24},"end":{"line":323,"column":24}},{"start":{"line":323,"column":24},"end":{"line":323,"column":24}}]},"25":{"line":324,"type":"if","locations":[{"start":{"line":324,"column":28},"end":{"line":324,"column":28}},{"start":{"line":324,"column":28},"end":{"line":324,"column":28}}]},"26":{"line":324,"type":"binary-expr","locations":[{"start":{"line":324,"column":32},"end":{"line":324,"column":46}},{"start":{"line":324,"column":51},"end":{"line":324,"column":95}}]},"27":{"line":351,"type":"if","locations":[{"start":{"line":351,"column":20},"end":{"line":351,"column":20}},{"start":{"line":351,"column":20},"end":{"line":351,"column":20}}]},"28":{"line":351,"type":"binary-expr","locations":[{"start":{"line":351,"column":24},"end":{"line":351,"column":34}},{"start":{"line":351,"column":38},"end":{"line":351,"column":48}}]},"29":{"line":354,"type":"if","locations":[{"start":{"line":354,"column":20},"end":{"line":354,"column":20}},{"start":{"line":354,"column":20},"end":{"line":354,"column":20}}]},"30":{"line":357,"type":"if","locations":[{"start":{"line":357,"column":20},"end":{"line":357,"column":20}},{"start":{"line":357,"column":20},"end":{"line":357,"column":20}}]},"31":{"line":358,"type":"if","locations":[{"start":{"line":358,"column":24},"end":{"line":358,"column":24}},{"start":{"line":358,"column":24},"end":{"line":358,"column":24}}]},"32":{"line":359,"type":"if","locations":[{"start":{"line":359,"column":28},"end":{"line":359,"column":28}},{"start":{"line":359,"column":28},"end":{"line":359,"column":28}}]},"33":{"line":359,"type":"binary-expr","locations":[{"start":{"line":359,"column":32},"end":{"line":359,"column":46}},{"start":{"line":359,"column":51},"end":{"line":359,"column":95}}]},"34":{"line":400,"type":"if","locations":[{"start":{"line":400,"column":20},"end":{"line":400,"column":20}},{"start":{"line":400,"column":20},"end":{"line":400,"column":20}}]},"35":{"line":400,"type":"binary-expr","locations":[{"start":{"line":400,"column":24},"end":{"line":400,"column":39}},{"start":{"line":400,"column":44},"end":{"line":400,"column":64}}]},"36":{"line":401,"type":"if","locations":[{"start":{"line":401,"column":24},"end":{"line":401,"column":24}},{"start":{"line":401,"column":24},"end":{"line":401,"column":24}}]},"37":{"line":421,"type":"if","locations":[{"start":{"line":421,"column":20},"end":{"line":421,"column":20}},{"start":{"line":421,"column":20},"end":{"line":421,"column":20}}]},"38":{"line":421,"type":"binary-expr","locations":[{"start":{"line":421,"column":24},"end":{"line":421,"column":39}},{"start":{"line":421,"column":43},"end":{"line":421,"column":57}},{"start":{"line":421,"column":62},"end":{"line":421,"column":82}}]},"39":{"line":422,"type":"if","locations":[{"start":{"line":422,"column":24},"end":{"line":422,"column":24}},{"start":{"line":422,"column":24},"end":{"line":422,"column":24}}]},"40":{"line":423,"type":"if","locations":[{"start":{"line":423,"column":28},"end":{"line":423,"column":28}},{"start":{"line":423,"column":28},"end":{"line":423,"column":28}}]},"41":{"line":427,"type":"if","locations":[{"start":{"line":427,"column":24},"end":{"line":427,"column":24}},{"start":{"line":427,"column":24},"end":{"line":427,"column":24}}]},"42":{"line":429,"type":"if","locations":[{"start":{"line":429,"column":31},"end":{"line":429,"column":31}},{"start":{"line":429,"column":31},"end":{"line":429,"column":31}}]},"43":{"line":431,"type":"if","locations":[{"start":{"line":431,"column":28},"end":{"line":431,"column":28}},{"start":{"line":431,"column":28},"end":{"line":431,"column":28}}]},"44":{"line":472,"type":"cond-expr","locations":[{"start":{"line":472,"column":55},"end":{"line":472,"column":59}},{"start":{"line":472,"column":62},"end":{"line":472,"column":67}}]},"45":{"line":477,"type":"cond-expr","locations":[{"start":{"line":477,"column":55},"end":{"line":477,"column":59}},{"start":{"line":477,"column":62},"end":{"line":477,"column":64}}]},"46":{"line":479,"type":"if","locations":[{"start":{"line":479,"column":20},"end":{"line":479,"column":20}},{"start":{"line":479,"column":20},"end":{"line":479,"column":20}}]},"47":{"line":479,"type":"binary-expr","locations":[{"start":{"line":479,"column":24},"end":{"line":479,"column":31}},{"start":{"line":479,"column":35},"end":{"line":479,"column":47}},{"start":{"line":479,"column":51},"end":{"line":479,"column":67}}]},"48":{"line":482,"type":"binary-expr","locations":[{"start":{"line":482,"column":30},"end":{"line":482,"column":52}},{"start":{"line":482,"column":56},"end":{"line":482,"column":60}}]},"49":{"line":484,"type":"if","locations":[{"start":{"line":484,"column":24},"end":{"line":484,"column":24}},{"start":{"line":484,"column":24},"end":{"line":484,"column":24}}]},"50":{"line":484,"type":"binary-expr","locations":[{"start":{"line":484,"column":28},"end":{"line":484,"column":42}},{"start":{"line":484,"column":46},"end":{"line":484,"column":59}}]},"51":{"line":488,"type":"if","locations":[{"start":{"line":488,"column":24},"end":{"line":488,"column":24}},{"start":{"line":488,"column":24},"end":{"line":488,"column":24}}]},"52":{"line":489,"type":"cond-expr","locations":[{"start":{"line":489,"column":47},"end":{"line":489,"column":60}},{"start":{"line":489,"column":63},"end":{"line":489,"column":84}}]},"53":{"line":499,"type":"if","locations":[{"start":{"line":499,"column":28},"end":{"line":499,"column":28}},{"start":{"line":499,"column":28},"end":{"line":499,"column":28}}]},"54":{"line":502,"type":"if","locations":[{"start":{"line":502,"column":28},"end":{"line":502,"column":28}},{"start":{"line":502,"column":28},"end":{"line":502,"column":28}}]},"55":{"line":502,"type":"binary-expr","locations":[{"start":{"line":502,"column":32},"end":{"line":502,"column":33}},{"start":{"line":502,"column":37},"end":{"line":502,"column":56}}]},"56":{"line":503,"type":"if","locations":[{"start":{"line":503,"column":32},"end":{"line":503,"column":32}},{"start":{"line":503,"column":32},"end":{"line":503,"column":32}}]},"57":{"line":509,"type":"if","locations":[{"start":{"line":509,"column":28},"end":{"line":509,"column":28}},{"start":{"line":509,"column":28},"end":{"line":509,"column":28}}]},"58":{"line":514,"type":"if","locations":[{"start":{"line":514,"column":28},"end":{"line":514,"column":28}},{"start":{"line":514,"column":28},"end":{"line":514,"column":28}}]},"59":{"line":520,"type":"if","locations":[{"start":{"line":520,"column":28},"end":{"line":520,"column":28}},{"start":{"line":520,"column":28},"end":{"line":520,"column":28}}]},"60":{"line":523,"type":"if","locations":[{"start":{"line":523,"column":28},"end":{"line":523,"column":28}},{"start":{"line":523,"column":28},"end":{"line":523,"column":28}}]},"61":{"line":524,"type":"if","locations":[{"start":{"line":524,"column":32},"end":{"line":524,"column":32}},{"start":{"line":524,"column":32},"end":{"line":524,"column":32}}]},"62":{"line":528,"type":"if","locations":[{"start":{"line":528,"column":28},"end":{"line":528,"column":28}},{"start":{"line":528,"column":28},"end":{"line":528,"column":28}}]},"63":{"line":532,"type":"cond-expr","locations":[{"start":{"line":532,"column":43},"end":{"line":532,"column":55}},{"start":{"line":532,"column":58},"end":{"line":532,"column":62}}]},"64":{"line":534,"type":"if","locations":[{"start":{"line":534,"column":32},"end":{"line":534,"column":32}},{"start":{"line":534,"column":32},"end":{"line":534,"column":32}}]},"65":{"line":534,"type":"binary-expr","locations":[{"start":{"line":534,"column":36},"end":{"line":534,"column":38}},{"start":{"line":534,"column":42},"end":{"line":534,"column":51}}]},"66":{"line":546,"type":"if","locations":[{"start":{"line":546,"column":32},"end":{"line":546,"column":32}},{"start":{"line":546,"column":32},"end":{"line":546,"column":32}}]},"67":{"line":546,"type":"binary-expr","locations":[{"start":{"line":546,"column":36},"end":{"line":546,"column":37}},{"start":{"line":546,"column":41},"end":{"line":546,"column":52}}]},"68":{"line":547,"type":"if","locations":[{"start":{"line":547,"column":36},"end":{"line":547,"column":36}},{"start":{"line":547,"column":36},"end":{"line":547,"column":36}}]},"69":{"line":558,"type":"if","locations":[{"start":{"line":558,"column":28},"end":{"line":558,"column":28}},{"start":{"line":558,"column":28},"end":{"line":558,"column":28}}]},"70":{"line":561,"type":"if","locations":[{"start":{"line":561,"column":28},"end":{"line":561,"column":28}},{"start":{"line":561,"column":28},"end":{"line":561,"column":28}}]},"71":{"line":566,"type":"if","locations":[{"start":{"line":566,"column":27},"end":{"line":566,"column":27}},{"start":{"line":566,"column":27},"end":{"line":566,"column":27}}]},"72":{"line":566,"type":"binary-expr","locations":[{"start":{"line":566,"column":31},"end":{"line":566,"column":38}},{"start":{"line":566,"column":42},"end":{"line":566,"column":54}}]},"73":{"line":568,"type":"if","locations":[{"start":{"line":568,"column":24},"end":{"line":568,"column":24}},{"start":{"line":568,"column":24},"end":{"line":568,"column":24}}]},"74":{"line":569,"type":"if","locations":[{"start":{"line":569,"column":28},"end":{"line":569,"column":28}},{"start":{"line":569,"column":28},"end":{"line":569,"column":28}}]},"75":{"line":569,"type":"binary-expr","locations":[{"start":{"line":569,"column":32},"end":{"line":569,"column":35}},{"start":{"line":569,"column":39},"end":{"line":569,"column":60}}]},"76":{"line":573,"type":"if","locations":[{"start":{"line":573,"column":28},"end":{"line":573,"column":28}},{"start":{"line":573,"column":28},"end":{"line":573,"column":28}}]},"77":{"line":575,"type":"if","locations":[{"start":{"line":575,"column":32},"end":{"line":575,"column":32}},{"start":{"line":575,"column":32},"end":{"line":575,"column":32}}]},"78":{"line":589,"type":"if","locations":[{"start":{"line":589,"column":24},"end":{"line":589,"column":24}},{"start":{"line":589,"column":24},"end":{"line":589,"column":24}}]},"79":{"line":594,"type":"if","locations":[{"start":{"line":594,"column":24},"end":{"line":594,"column":24}},{"start":{"line":594,"column":24},"end":{"line":594,"column":24}}]},"80":{"line":598,"type":"if","locations":[{"start":{"line":598,"column":24},"end":{"line":598,"column":24}},{"start":{"line":598,"column":24},"end":{"line":598,"column":24}}]},"81":{"line":598,"type":"binary-expr","locations":[{"start":{"line":598,"column":28},"end":{"line":598,"column":31}},{"start":{"line":598,"column":35},"end":{"line":598,"column":56}}]},"82":{"line":601,"type":"if","locations":[{"start":{"line":601,"column":24},"end":{"line":601,"column":24}},{"start":{"line":601,"column":24},"end":{"line":601,"column":24}}]},"83":{"line":601,"type":"binary-expr","locations":[{"start":{"line":601,"column":28},"end":{"line":601,"column":31}},{"start":{"line":601,"column":35},"end":{"line":601,"column":48}}]},"84":{"line":608,"type":"if","locations":[{"start":{"line":608,"column":28},"end":{"line":608,"column":28}},{"start":{"line":608,"column":28},"end":{"line":608,"column":28}}]},"85":{"line":609,"type":"if","locations":[{"start":{"line":609,"column":32},"end":{"line":609,"column":32}},{"start":{"line":609,"column":32},"end":{"line":609,"column":32}}]},"86":{"line":615,"type":"if","locations":[{"start":{"line":615,"column":28},"end":{"line":615,"column":28}},{"start":{"line":615,"column":28},"end":{"line":615,"column":28}}]},"87":{"line":625,"type":"if","locations":[{"start":{"line":625,"column":24},"end":{"line":625,"column":24}},{"start":{"line":625,"column":24},"end":{"line":625,"column":24}}]},"88":{"line":626,"type":"if","locations":[{"start":{"line":626,"column":28},"end":{"line":626,"column":28}},{"start":{"line":626,"column":28},"end":{"line":626,"column":28}}]},"89":{"line":629,"type":"if","locations":[{"start":{"line":629,"column":36},"end":{"line":629,"column":36}},{"start":{"line":629,"column":36},"end":{"line":629,"column":36}}]},"90":{"line":647,"type":"if","locations":[{"start":{"line":647,"column":20},"end":{"line":647,"column":20}},{"start":{"line":647,"column":20},"end":{"line":647,"column":20}}]},"91":{"line":655,"type":"if","locations":[{"start":{"line":655,"column":28},"end":{"line":655,"column":28}},{"start":{"line":655,"column":28},"end":{"line":655,"column":28}}]},"92":{"line":700,"type":"if","locations":[{"start":{"line":700,"column":8},"end":{"line":700,"column":8}},{"start":{"line":700,"column":8},"end":{"line":700,"column":8}}]},"93":{"line":700,"type":"binary-expr","locations":[{"start":{"line":700,"column":12},"end":{"line":700,"column":19}},{"start":{"line":700,"column":23},"end":{"line":700,"column":35}}]}},"code":["(function () { YUI.add('exec-command', function (Y, NAME) {","",""," /**"," * Plugin for the frame module to handle execCommands for Editor"," * @class Plugin.ExecCommand"," * @extends Base"," * @constructor"," * @module editor"," * @submodule exec-command"," */"," var ExecCommand = function() {"," ExecCommand.superclass.constructor.apply(this, arguments);"," },"," /**"," * This method is meant to normalize IE's in ability to exec the proper command on elements with CSS styling."," * @method fixIETags"," * @protected"," * @param {String} cmd The command to execute"," * @param {String} tag The tag to create"," * @param {String} rule The rule that we are looking for."," */"," fixIETags = function(cmd, tag, rule) {"," var inst = this.getInstance(),"," doc = inst.config.doc,"," sel = doc.selection.createRange(),"," o = doc.queryCommandValue(cmd),"," html, reg, m, p, d, s, c;",""," if (o) {"," html = sel.htmlText;"," reg = new RegExp(rule, 'g');"," m = html.match(reg);",""," if (m) {"," html = html.replace(rule + ';', '').replace(rule, '');",""," sel.pasteHTML('<var id=\"yui-ie-bs\">');",""," p = doc.getElementById('yui-ie-bs');"," d = doc.createElement('div');"," s = doc.createElement(tag);",""," d.innerHTML = html;"," if (p.parentNode !== inst.config.doc.body) {"," p = p.parentNode;"," }",""," c = d.childNodes;",""," p.parentNode.replaceChild(s, p);",""," Y.each(c, function(f) {"," s.appendChild(f);"," });"," sel.collapse();"," if (sel.moveToElementText) {"," sel.moveToElementText(s);"," }"," sel.select();"," }"," }"," this._command(cmd);"," };",""," Y.extend(ExecCommand, Y.Base, {"," /**"," * An internal reference to the keyCode of the last key that was pressed."," * @private"," * @property _lastKey"," */"," _lastKey: null,"," /**"," * An internal reference to the instance of the frame plugged into."," * @private"," * @property _inst"," */"," _inst: null,"," /**"," * Execute a command on the frame's document."," * @method command"," * @param {String} action The action to perform (bold, italic, fontname)"," * @param {String} value The optional value (helvetica)"," * @return {Node/NodeList} Should return the Node/Nodelist affected"," */"," command: function(action, value) {"," var fn = ExecCommand.COMMANDS[action];",""," if (fn) {"," return fn.call(this, action, value);"," } else {"," return this._command(action, value);"," }"," },"," /**"," * The private version of execCommand that doesn't filter for overrides."," * @private"," * @method _command"," * @param {String} action The action to perform (bold, italic, fontname)"," * @param {String} value The optional value (helvetica)"," */"," _command: function(action, value) {"," var inst = this.getInstance();"," try {"," try {"," inst.config.doc.execCommand('styleWithCSS', null, 1);"," } catch (e1) {"," try {"," inst.config.doc.execCommand('useCSS', null, 0);"," } catch (e2) {"," }"," }"," inst.config.doc.execCommand(action, null, value);"," } catch (e) {"," }"," },"," /**"," * Get's the instance of YUI bound to the parent frame"," * @method getInstance"," * @return {YUI} The YUI instance bound to the parent frame"," */"," getInstance: function() {"," if (!this._inst) {"," this._inst = this.get('host').getInstance();"," }"," return this._inst;"," },"," initializer: function() {"," Y.mix(this.get('host'), {"," execCommand: function(action, value) {"," return this.exec.command(action, value);"," },"," _execCommand: function(action, value) {"," return this.exec._command(action, value);"," }"," });",""," this.get('host').on('dom:keypress', Y.bind(function(e) {"," this._lastKey = e.keyCode;"," }, this));"," },"," _wrapContent: function(str, override) {"," var useP = (this.getInstance().host.editorPara && !override ? true : false);",""," if (useP) {"," str = '<p>' + str + '</p>';"," } else {"," str = str + '<br>';"," }"," return str;"," }"," }, {"," /**"," * execCommand"," * @property NAME"," * @static"," */"," NAME: 'execCommand',"," /**"," * exec"," * @property NS"," * @static"," */"," NS: 'exec',"," ATTRS: {"," host: {"," value: false"," }"," },"," /**"," * Static object literal of execCommand overrides"," * @property COMMANDS"," * @static"," */"," COMMANDS: {"," /**"," * Wraps the content with a new element of type (tag)"," * @method COMMANDS.wrap"," * @static"," * @param {String} cmd The command executed: wrap"," * @param {String} tag The tag to wrap the selection with"," * @return {NodeList} NodeList of the items touched by this command."," */"," wrap: function(cmd, tag) {"," var inst = this.getInstance();"," return (new inst.EditorSelection()).wrapContent(tag);"," },"," /**"," * Inserts the provided HTML at the cursor, should be a single element."," * @method COMMANDS.inserthtml"," * @static"," * @param {String} cmd The command executed: inserthtml"," * @param {String} html The html to insert"," * @return {Node} Node instance of the item touched by this command."," */"," inserthtml: function(cmd, html) {"," var inst = this.getInstance();"," if (inst.EditorSelection.hasCursor() || Y.UA.ie) {"," return (new inst.EditorSelection()).insertContent(html);"," } else {"," this._command('inserthtml', html);"," }"," },"," /**"," * Inserts the provided HTML at the cursor, and focuses the cursor afterwards."," * @method COMMANDS.insertandfocus"," * @static"," * @param {String} cmd The command executed: insertandfocus"," * @param {String} html The html to insert"," * @return {Node} Node instance of the item touched by this command."," */"," insertandfocus: function(cmd, html) {"," var inst = this.getInstance(), out, sel;"," if (inst.EditorSelection.hasCursor()) {"," html += inst.EditorSelection.CURSOR;"," out = this.command('inserthtml', html);"," sel = new inst.EditorSelection();"," sel.focusCursor(true, true);"," } else {"," this.command('inserthtml', html);"," }"," return out;"," },"," /**"," * Inserts a BR at the current cursor position"," * @method COMMANDS.insertbr"," * @static"," * @param {String} cmd The command executed: insertbr"," */"," insertbr: function() {"," var inst = this.getInstance(),"," sel = new inst.EditorSelection(),"," html = '<var>|</var>', last = null,"," root = inst.EditorSelection.ROOT,"," q = (Y.UA.webkit) ? 'span.Apple-style-span,var' : 'var',"," insert = function(n) {"," var c = inst.Node.create('<br>');"," n.insert(c, 'before');"," return c;"," };",""," if (sel._selection.pasteHTML) {"," sel._selection.pasteHTML(html);"," } else {"," this._command('inserthtml', html);"," }","",""," root.all(q).each(function(n) {"," var g = true, s;"," if (Y.UA.webkit) {"," g = false;"," if (n.get('innerHTML') === '|') {"," g = true;"," }"," }"," if (g) {"," last = insert(n);"," if ((!last.previous() || !last.previous().test('br')) && Y.UA.gecko) {"," s = last.cloneNode();"," last.insert(s, 'after');"," last = s;"," }"," n.remove();"," }"," });"," if (Y.UA.webkit && last) {"," insert(last);"," sel.selectNode(last);"," }"," },"," /**"," * Inserts an image at the cursor position"," * @method COMMANDS.insertimage"," * @static"," * @param {String} cmd The command executed: insertimage"," * @param {String} img The url of the image to be inserted"," * @return {Node} Node instance of the item touched by this command."," */"," insertimage: function(cmd, img) {"," return this.command('inserthtml', '<img src=\"' + img + '\">');"," },"," /**"," * Add a class to all of the elements in the selection"," * @method COMMANDS.addclass"," * @static"," * @param {String} cmd The command executed: addclass"," * @param {String} cls The className to add"," * @return {NodeList} NodeList of the items touched by this command."," */"," addclass: function(cmd, cls) {"," var inst = this.getInstance();"," return (new inst.EditorSelection()).getSelected().addClass(cls);"," },"," /**"," * Remove a class from all of the elements in the selection"," * @method COMMANDS.removeclass"," * @static"," * @param {String} cmd The command executed: removeclass"," * @param {String} cls The className to remove"," * @return {NodeList} NodeList of the items touched by this command."," */"," removeclass: function(cmd, cls) {"," var inst = this.getInstance();"," return (new inst.EditorSelection()).getSelected().removeClass(cls);"," },"," /**"," * Adds a forecolor to the current selection, or creates a new element and applies it"," * @method COMMANDS.forecolor"," * @static"," * @param {String} cmd The command executed: forecolor"," * @param {String} val The color value to apply"," * @return {NodeList} NodeList of the items touched by this command."," */"," forecolor: function(cmd, val) {"," var inst = this.getInstance(),"," sel = new inst.EditorSelection(), n;",""," if (!Y.UA.ie) {"," this._command('useCSS', false);"," }"," if (inst.EditorSelection.hasCursor()) {"," if (sel.isCollapsed) {"," if (sel.anchorNode && (sel.anchorNode.get('innerHTML') === '&nbsp;')) {"," sel.anchorNode.setStyle('color', val);"," n = sel.anchorNode;"," } else {"," n = this.command('inserthtml', '<span style=\"color: ' + val + '\">' + inst.EditorSelection.CURSOR + '</span>');"," sel.focusCursor(true, true);"," }"," return n;"," } else {"," return this._command(cmd, val);"," }"," } else {"," this._command(cmd, val);"," }"," },"," /**"," * Adds a background color to the current selection, or creates a new element and applies it"," * @method COMMANDS.backcolor"," * @static"," * @param {String} cmd The command executed: backcolor"," * @param {String} val The color value to apply"," * @return {NodeList} NodeList of the items touched by this command."," */"," backcolor: function(cmd, val) {"," var inst = this.getInstance(),"," sel = new inst.EditorSelection(), n;",""," if (Y.UA.gecko || Y.UA.opera) {"," cmd = 'hilitecolor';"," }"," if (!Y.UA.ie) {"," this._command('useCSS', false);"," }"," if (inst.EditorSelection.hasCursor()) {"," if (sel.isCollapsed) {"," if (sel.anchorNode && (sel.anchorNode.get('innerHTML') === '&nbsp;')) {"," sel.anchorNode.setStyle('backgroundColor', val);"," n = sel.anchorNode;"," } else {"," n = this.command('inserthtml',"," '<span style=\"background-color: ' + val + '\">' + inst.EditorSelection.CURSOR + '</span>');"," sel.focusCursor(true, true);"," }"," return n;"," } else {"," return this._command(cmd, val);"," }"," } else {"," this._command(cmd, val);"," }"," },"," /**"," * Sugar method, calles backcolor"," * @method COMMANDS.hilitecolor"," * @static"," * @param {String} cmd The command executed: backcolor"," * @param {String} val The color value to apply"," * @return {NodeList} NodeList of the items touched by this command."," */"," hilitecolor: function() {"," return ExecCommand.COMMANDS.backcolor.apply(this, arguments);"," },"," /**"," * Adds a font name to the current selection, or creates a new element and applies it"," * @method COMMANDS.fontname2"," * @deprecated"," * @static"," * @param {String} cmd The command executed: fontname"," * @param {String} val The font name to apply"," * @return {NodeList} NodeList of the items touched by this command."," */"," fontname2: function(cmd, val) {"," this._command('fontname', val);"," var inst = this.getInstance(),"," sel = new inst.EditorSelection();",""," if (sel.isCollapsed && (this._lastKey !== 32)) {"," if (sel.anchorNode.test('font')) {"," sel.anchorNode.set('face', val);"," }"," }"," },"," /**"," * Adds a fontsize to the current selection, or creates a new element and applies it"," * @method COMMANDS.fontsize2"," * @deprecated"," * @static"," * @param {String} cmd The command executed: fontsize"," * @param {String} val The font size to apply"," * @return {NodeList} NodeList of the items touched by this command."," */"," fontsize2: function(cmd, val) {"," this._command('fontsize', val);",""," var inst = this.getInstance(),"," sel = new inst.EditorSelection(), p;",""," if (sel.isCollapsed && sel.anchorNode && (this._lastKey !== 32)) {"," if (Y.UA.webkit) {"," if (sel.anchorNode.getStyle('lineHeight')) {"," sel.anchorNode.setStyle('lineHeight', '');"," }"," }"," if (sel.anchorNode.test('font')) {"," sel.anchorNode.set('size', val);"," } else if (Y.UA.gecko) {"," p = sel.anchorNode.ancestor(inst.EditorSelection.DEFAULT_BLOCK_TAG);"," if (p) {"," p.setStyle('fontSize', '');"," }"," }"," }"," },"," /**"," * Overload for COMMANDS.list"," * @method COMMANDS.insertorderedlist"," * @static"," * @param {String} cmd The command executed: list, ul"," */"," insertunorderedlist: function() {"," this.command('list', 'ul');"," },"," /**"," * Overload for COMMANDS.list"," * @method COMMANDS.insertunorderedlist"," * @static"," * @param {String} cmd The command executed: list, ol"," */"," insertorderedlist: function() {"," this.command('list', 'ol');"," },"," /**"," * Noramlizes lists creation/destruction for IE. All others pass through to native calls"," * @method COMMANDS.list"," * @static"," * @param {String} cmd The command executed: list (not used)"," * @param {String} tag The tag to deal with"," */"," list: function(cmd, tag) {"," var inst = this.getInstance(), html, self = this,"," /*"," The yui3- class name below is not a skinnable class,"," it's a utility class used internally by editor and"," stripped when completed, calling getClassName on this"," is a waste of resources."," */"," DIR = 'dir', cls = 'yui3-touched',"," dir, range, div, elm, n, str, s, par, list, lis,"," useP = (inst.host.editorPara ? true : false), tmp,"," sdir, hasPParent, fc,"," root = inst.EditorSelection.ROOT,"," sel = new inst.EditorSelection();",""," cmd = 'insert' + ((tag === 'ul') ? 'un' : '') + 'orderedlist';",""," if (Y.UA.ie && Y.UA.ie < 11 && !sel.isCollapsed) {"," range = sel._selection;"," html = range.htmlText;"," div = inst.Node.create(html) || root;",""," if (div.test('li') || div.one('li')) {"," this._command(cmd, null);"," return;"," }"," if (div.test(tag)) {"," elm = range.item ? range.item(0) : range.parentElement();"," n = inst.one(elm);"," lis = n.all('li');",""," str = '<div>';"," lis.each(function(l) {"," str = self._wrapContent(l.get('innerHTML'));"," });"," str += '</div>';"," s = inst.Node.create(str);"," if (n.get('parentNode').test('div')) {"," n = n.get('parentNode');"," }"," if (n && n.hasAttribute(DIR)) {"," if (useP) {"," s.all('p').setAttribute(DIR, n.getAttribute(DIR));"," } else {"," s.setAttribute(DIR, n.getAttribute(DIR));"," }"," }"," if (useP) {"," n.replace(s.get('innerHTML'));"," } else {"," n.replace(s);"," }"," if (range.moveToElementText) {"," range.moveToElementText(s._node);"," }"," range.select();"," } else {"," par = Y.one(range.parentElement());"," if (!par.test(inst.EditorSelection.BLOCKS)) {"," par = par.ancestor(inst.EditorSelection.BLOCKS);"," }"," if (par) {"," if (par.hasAttribute(DIR)) {"," dir = par.getAttribute(DIR);"," }"," }"," if (html.indexOf('<br>') > -1) {"," html = html.split(/<br>/i);"," } else {"," tmp = inst.Node.create(html),"," ps = tmp ? tmp.all('p') : null;",""," if (ps && ps.size()) {"," html = [];"," ps.each(function(n) {"," html.push(n.get('innerHTML'));"," });"," } else {"," html = [html];"," }"," }"," list = '<' + tag + ' id=\"ie-list\">';"," Y.each(html, function(v) {"," var a = inst.Node.create(v);"," if (a && a.test('p')) {"," if (a.hasAttribute(DIR)) {"," dir = a.getAttribute(DIR);"," }"," v = a.get('innerHTML');"," }"," list += '<li>' + v + '</li>';"," });"," list += '</' + tag + '>';"," range.pasteHTML(list);"," elm = inst.config.doc.getElementById('ie-list');"," elm.id = '';"," if (dir) {"," elm.setAttribute(DIR, dir);"," }"," if (range.moveToElementText) {"," range.moveToElementText(elm);"," }"," range.select();"," }"," } else if (Y.UA.ie && Y.UA.ie < 11) {"," par = inst.one(sel._selection.parentElement());"," if (par.test('p')) {"," if (par && par.hasAttribute(DIR)) {"," dir = par.getAttribute(DIR);"," }"," html = Y.EditorSelection.getText(par);"," if (html === '') {"," sdir = '';"," if (dir) {"," sdir = ' dir=\"' + dir + '\"';"," }"," list = inst.Node.create(Y.Lang.sub('<{tag}{dir}><li></li></{tag}>', { tag: tag, dir: sdir }));"," par.replace(list);"," sel.selectNode(list.one('li'));"," } else {"," this._command(cmd, null);"," }"," } else {"," this._command(cmd, null);"," }"," } else {"," root.all(tag).addClass(cls);"," if (sel.anchorNode.test(inst.EditorSelection.BLOCKS)) {"," par = sel.anchorNode;"," } else {"," par = sel.anchorNode.ancestor(inst.EditorSelection.BLOCKS);"," }"," if (!par) { //No parent, find the first block under the anchorNode"," par = sel.anchorNode.one(inst.EditorSelection.BLOCKS);"," }",""," if (par && par.hasAttribute(DIR)) {"," dir = par.getAttribute(DIR);"," }"," if (par && par.test(tag)) {"," hasPParent = par.ancestor('p');"," html = inst.Node.create('<div/>');"," elm = par.all('li');"," elm.each(function(h) {"," html.append(self._wrapContent(h.get('innerHTML'), hasPParent));"," });"," if (dir) {"," if (useP) {"," html.all('p').setAttribute(DIR, dir);"," } else {"," html.setAttribute(DIR, dir);"," }"," }"," if (useP) {"," html = inst.Node.create(html.get('innerHTML'));"," }"," fc = html.get('firstChild');"," par.replace(html);"," sel.selectNode(fc);"," } else {"," this._command(cmd, null);"," }"," list = root.all(tag);"," if (dir) {"," if (list.size()) {"," //Changed to a List"," list.each(function(n) {"," if (!n.hasClass(cls)) {"," n.setAttribute(DIR, dir);"," }"," });"," }"," }",""," list.removeClass(cls);"," }"," },"," /**"," * Noramlizes alignment for Webkit Browsers"," * @method COMMANDS.justify"," * @static"," * @param {String} cmd The command executed: justify (not used)"," * @param {String} val The actual command from the justify{center,all,left,right} stubs"," */"," justify: function(cmd, val) {"," if (Y.UA.webkit) {"," var inst = this.getInstance(),"," sel = new inst.EditorSelection(),"," aNode = sel.anchorNode, html,"," bgColor = aNode.getStyle('backgroundColor');",""," this._command(val);"," sel = new inst.EditorSelection();"," if (sel.anchorNode.test('div')) {"," html = '<span>' + sel.anchorNode.get('innerHTML') + '</span>';"," sel.anchorNode.set('innerHTML', html);"," sel.anchorNode.one('span').setStyle('backgroundColor', bgColor);"," sel.selectNode(sel.anchorNode.one('span'));"," }"," } else {"," this._command(val);"," }"," },"," /**"," * Override method for COMMANDS.justify"," * @method COMMANDS.justifycenter"," * @static"," */"," justifycenter: function() {"," this.command('justify', 'justifycenter');"," },"," /**"," * Override method for COMMANDS.justify"," * @method COMMANDS.justifyleft"," * @static"," */"," justifyleft: function() {"," this.command('justify', 'justifyleft');"," },"," /**"," * Override method for COMMANDS.justify"," * @method COMMANDS.justifyright"," * @static"," */"," justifyright: function() {"," this.command('justify', 'justifyright');"," },"," /**"," * Override method for COMMANDS.justify"," * @method COMMANDS.justifyfull"," * @static"," */"," justifyfull: function() {"," this.command('justify', 'justifyfull');"," }"," }"," });",""," if (Y.UA.ie && Y.UA.ie < 11) {"," ExecCommand.COMMANDS.bold = function() {"," fixIETags.call(this, 'bold', 'b', 'FONT-WEIGHT: bold');"," };"," ExecCommand.COMMANDS.italic = function() {"," fixIETags.call(this, 'italic', 'i', 'FONT-STYLE: italic');"," };"," ExecCommand.COMMANDS.underline = function() {"," fixIETags.call(this, 'underline', 'u', 'TEXT-DECORATION: underline');"," };"," }",""," Y.namespace('Plugin');"," Y.Plugin.ExecCommand = ExecCommand;","","","","}, '@VERSION@', {\"requires\": [\"frame\"]});","","}());"]}; } var __cov_zJJLlBnPHhoxKUOe9$BLCQ = __coverage__['build/exec-command/exec-command.js']; __cov_zJJLlBnPHhoxKUOe9$BLCQ.s['1']++;YUI.add('exec-command',function(Y,NAME){__cov_zJJLlBnPHhoxKUOe9$BLCQ.f['1']++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['2']++;var ExecCommand=function(){__cov_zJJLlBnPHhoxKUOe9$BLCQ.f['2']++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['3']++;ExecCommand.superclass.constructor.apply(this,arguments);},fixIETags=function(cmd,tag,rule){__cov_zJJLlBnPHhoxKUOe9$BLCQ.f['3']++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['4']++;var inst=this.getInstance(),doc=inst.config.doc,sel=doc.selection.createRange(),o=doc.queryCommandValue(cmd),html,reg,m,p,d,s,c;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['5']++;if(o){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['1'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['6']++;html=sel.htmlText;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['7']++;reg=new RegExp(rule,'g');__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['8']++;m=html.match(reg);__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['9']++;if(m){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['2'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['10']++;html=html.replace(rule+';','').replace(rule,'');__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['11']++;sel.pasteHTML('<var id="yui-ie-bs">');__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['12']++;p=doc.getElementById('yui-ie-bs');__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['13']++;d=doc.createElement('div');__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['14']++;s=doc.createElement(tag);__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['15']++;d.innerHTML=html;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['16']++;if(p.parentNode!==inst.config.doc.body){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['3'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['17']++;p=p.parentNode;}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['3'][1]++;}__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['18']++;c=d.childNodes;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['19']++;p.parentNode.replaceChild(s,p);__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['20']++;Y.each(c,function(f){__cov_zJJLlBnPHhoxKUOe9$BLCQ.f['4']++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['21']++;s.appendChild(f);});__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['22']++;sel.collapse();__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['23']++;if(sel.moveToElementText){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['4'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['24']++;sel.moveToElementText(s);}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['4'][1]++;}__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['25']++;sel.select();}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['2'][1]++;}}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['1'][1]++;}__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['26']++;this._command(cmd);};__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['27']++;Y.extend(ExecCommand,Y.Base,{_lastKey:null,_inst:null,command:function(action,value){__cov_zJJLlBnPHhoxKUOe9$BLCQ.f['5']++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['28']++;var fn=ExecCommand.COMMANDS[action];__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['29']++;if(fn){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['5'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['30']++;return fn.call(this,action,value);}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['5'][1]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['31']++;return this._command(action,value);}},_command:function(action,value){__cov_zJJLlBnPHhoxKUOe9$BLCQ.f['6']++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['32']++;var inst=this.getInstance();__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['33']++;try{__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['34']++;try{__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['35']++;inst.config.doc.execCommand('styleWithCSS',null,1);}catch(e1){__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['36']++;try{__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['37']++;inst.config.doc.execCommand('useCSS',null,0);}catch(e2){}}__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['38']++;inst.config.doc.execCommand(action,null,value);}catch(e){}},getInstance:function(){__cov_zJJLlBnPHhoxKUOe9$BLCQ.f['7']++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['39']++;if(!this._inst){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['6'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['40']++;this._inst=this.get('host').getInstance();}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['6'][1]++;}__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['41']++;return this._inst;},initializer:function(){__cov_zJJLlBnPHhoxKUOe9$BLCQ.f['8']++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['42']++;Y.mix(this.get('host'),{execCommand:function(action,value){__cov_zJJLlBnPHhoxKUOe9$BLCQ.f['9']++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['43']++;return this.exec.command(action,value);},_execCommand:function(action,value){__cov_zJJLlBnPHhoxKUOe9$BLCQ.f['10']++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['44']++;return this.exec._command(action,value);}});__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['45']++;this.get('host').on('dom:keypress',Y.bind(function(e){__cov_zJJLlBnPHhoxKUOe9$BLCQ.f['11']++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['46']++;this._lastKey=e.keyCode;},this));},_wrapContent:function(str,override){__cov_zJJLlBnPHhoxKUOe9$BLCQ.f['12']++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['47']++;var useP=(__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['8'][0]++,this.getInstance().host.editorPara)&&(__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['8'][1]++,!override)?(__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['7'][0]++,true):(__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['7'][1]++,false);__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['48']++;if(useP){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['9'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['49']++;str='<p>'+str+'</p>';}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['9'][1]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['50']++;str=str+'<br>';}__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['51']++;return str;}},{NAME:'execCommand',NS:'exec',ATTRS:{host:{value:false}},COMMANDS:{wrap:function(cmd,tag){__cov_zJJLlBnPHhoxKUOe9$BLCQ.f['13']++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['52']++;var inst=this.getInstance();__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['53']++;return new inst.EditorSelection().wrapContent(tag);},inserthtml:function(cmd,html){__cov_zJJLlBnPHhoxKUOe9$BLCQ.f['14']++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['54']++;var inst=this.getInstance();__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['55']++;if((__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['11'][0]++,inst.EditorSelection.hasCursor())||(__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['11'][1]++,Y.UA.ie)){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['10'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['56']++;return new inst.EditorSelection().insertContent(html);}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['10'][1]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['57']++;this._command('inserthtml',html);}},insertandfocus:function(cmd,html){__cov_zJJLlBnPHhoxKUOe9$BLCQ.f['15']++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['58']++;var inst=this.getInstance(),out,sel;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['59']++;if(inst.EditorSelection.hasCursor()){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['12'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['60']++;html+=inst.EditorSelection.CURSOR;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['61']++;out=this.command('inserthtml',html);__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['62']++;sel=new inst.EditorSelection();__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['63']++;sel.focusCursor(true,true);}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['12'][1]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['64']++;this.command('inserthtml',html);}__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['65']++;return out;},insertbr:function(){__cov_zJJLlBnPHhoxKUOe9$BLCQ.f['16']++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['66']++;var inst=this.getInstance(),sel=new inst.EditorSelection(),html='<var>|</var>',last=null,root=inst.EditorSelection.ROOT,q=Y.UA.webkit?(__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['13'][0]++,'span.Apple-style-span,var'):(__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['13'][1]++,'var'),insert=function(n){__cov_zJJLlBnPHhoxKUOe9$BLCQ.f['17']++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['67']++;var c=inst.Node.create('<br>');__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['68']++;n.insert(c,'before');__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['69']++;return c;};__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['70']++;if(sel._selection.pasteHTML){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['14'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['71']++;sel._selection.pasteHTML(html);}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['14'][1]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['72']++;this._command('inserthtml',html);}__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['73']++;root.all(q).each(function(n){__cov_zJJLlBnPHhoxKUOe9$BLCQ.f['18']++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['74']++;var g=true,s;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['75']++;if(Y.UA.webkit){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['15'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['76']++;g=false;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['77']++;if(n.get('innerHTML')==='|'){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['16'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['78']++;g=true;}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['16'][1]++;}}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['15'][1]++;}__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['79']++;if(g){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['17'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['80']++;last=insert(n);__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['81']++;if(((__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['19'][0]++,!last.previous())||(__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['19'][1]++,!last.previous().test('br')))&&(__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['19'][2]++,Y.UA.gecko)){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['18'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['82']++;s=last.cloneNode();__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['83']++;last.insert(s,'after');__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['84']++;last=s;}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['18'][1]++;}__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['85']++;n.remove();}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['17'][1]++;}});__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['86']++;if((__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['21'][0]++,Y.UA.webkit)&&(__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['21'][1]++,last)){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['20'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['87']++;insert(last);__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['88']++;sel.selectNode(last);}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['20'][1]++;}},insertimage:function(cmd,img){__cov_zJJLlBnPHhoxKUOe9$BLCQ.f['19']++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['89']++;return this.command('inserthtml','<img src="'+img+'">');},addclass:function(cmd,cls){__cov_zJJLlBnPHhoxKUOe9$BLCQ.f['20']++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['90']++;var inst=this.getInstance();__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['91']++;return new inst.EditorSelection().getSelected().addClass(cls);},removeclass:function(cmd,cls){__cov_zJJLlBnPHhoxKUOe9$BLCQ.f['21']++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['92']++;var inst=this.getInstance();__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['93']++;return new inst.EditorSelection().getSelected().removeClass(cls);},forecolor:function(cmd,val){__cov_zJJLlBnPHhoxKUOe9$BLCQ.f['22']++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['94']++;var inst=this.getInstance(),sel=new inst.EditorSelection(),n;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['95']++;if(!Y.UA.ie){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['22'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['96']++;this._command('useCSS',false);}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['22'][1]++;}__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['97']++;if(inst.EditorSelection.hasCursor()){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['23'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['98']++;if(sel.isCollapsed){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['24'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['99']++;if((__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['26'][0]++,sel.anchorNode)&&(__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['26'][1]++,sel.anchorNode.get('innerHTML')==='&nbsp;')){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['25'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['100']++;sel.anchorNode.setStyle('color',val);__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['101']++;n=sel.anchorNode;}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['25'][1]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['102']++;n=this.command('inserthtml','<span style="color: '+val+'">'+inst.EditorSelection.CURSOR+'</span>');__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['103']++;sel.focusCursor(true,true);}__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['104']++;return n;}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['24'][1]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['105']++;return this._command(cmd,val);}}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['23'][1]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['106']++;this._command(cmd,val);}},backcolor:function(cmd,val){__cov_zJJLlBnPHhoxKUOe9$BLCQ.f['23']++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['107']++;var inst=this.getInstance(),sel=new inst.EditorSelection(),n;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['108']++;if((__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['28'][0]++,Y.UA.gecko)||(__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['28'][1]++,Y.UA.opera)){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['27'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['109']++;cmd='hilitecolor';}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['27'][1]++;}__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['110']++;if(!Y.UA.ie){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['29'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['111']++;this._command('useCSS',false);}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['29'][1]++;}__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['112']++;if(inst.EditorSelection.hasCursor()){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['30'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['113']++;if(sel.isCollapsed){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['31'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['114']++;if((__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['33'][0]++,sel.anchorNode)&&(__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['33'][1]++,sel.anchorNode.get('innerHTML')==='&nbsp;')){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['32'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['115']++;sel.anchorNode.setStyle('backgroundColor',val);__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['116']++;n=sel.anchorNode;}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['32'][1]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['117']++;n=this.command('inserthtml','<span style="background-color: '+val+'">'+inst.EditorSelection.CURSOR+'</span>');__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['118']++;sel.focusCursor(true,true);}__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['119']++;return n;}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['31'][1]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['120']++;return this._command(cmd,val);}}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['30'][1]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['121']++;this._command(cmd,val);}},hilitecolor:function(){__cov_zJJLlBnPHhoxKUOe9$BLCQ.f['24']++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['122']++;return ExecCommand.COMMANDS.backcolor.apply(this,arguments);},fontname2:function(cmd,val){__cov_zJJLlBnPHhoxKUOe9$BLCQ.f['25']++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['123']++;this._command('fontname',val);__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['124']++;var inst=this.getInstance(),sel=new inst.EditorSelection();__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['125']++;if((__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['35'][0]++,sel.isCollapsed)&&(__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['35'][1]++,this._lastKey!==32)){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['34'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['126']++;if(sel.anchorNode.test('font')){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['36'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['127']++;sel.anchorNode.set('face',val);}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['36'][1]++;}}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['34'][1]++;}},fontsize2:function(cmd,val){__cov_zJJLlBnPHhoxKUOe9$BLCQ.f['26']++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['128']++;this._command('fontsize',val);__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['129']++;var inst=this.getInstance(),sel=new inst.EditorSelection(),p;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['130']++;if((__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['38'][0]++,sel.isCollapsed)&&(__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['38'][1]++,sel.anchorNode)&&(__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['38'][2]++,this._lastKey!==32)){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['37'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['131']++;if(Y.UA.webkit){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['39'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['132']++;if(sel.anchorNode.getStyle('lineHeight')){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['40'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['133']++;sel.anchorNode.setStyle('lineHeight','');}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['40'][1]++;}}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['39'][1]++;}__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['134']++;if(sel.anchorNode.test('font')){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['41'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['135']++;sel.anchorNode.set('size',val);}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['41'][1]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['136']++;if(Y.UA.gecko){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['42'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['137']++;p=sel.anchorNode.ancestor(inst.EditorSelection.DEFAULT_BLOCK_TAG);__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['138']++;if(p){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['43'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['139']++;p.setStyle('fontSize','');}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['43'][1]++;}}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['42'][1]++;}}}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['37'][1]++;}},insertunorderedlist:function(){__cov_zJJLlBnPHhoxKUOe9$BLCQ.f['27']++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['140']++;this.command('list','ul');},insertorderedlist:function(){__cov_zJJLlBnPHhoxKUOe9$BLCQ.f['28']++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['141']++;this.command('list','ol');},list:function(cmd,tag){__cov_zJJLlBnPHhoxKUOe9$BLCQ.f['29']++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['142']++;var inst=this.getInstance(),html,self=this,DIR='dir',cls='yui3-touched',dir,range,div,elm,n,str,s,par,list,lis,useP=inst.host.editorPara?(__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['44'][0]++,true):(__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['44'][1]++,false),tmp,sdir,hasPParent,fc,root=inst.EditorSelection.ROOT,sel=new inst.EditorSelection();__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['143']++;cmd='insert'+(tag==='ul'?(__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['45'][0]++,'un'):(__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['45'][1]++,''))+'orderedlist';__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['144']++;if((__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['47'][0]++,Y.UA.ie)&&(__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['47'][1]++,Y.UA.ie<11)&&(__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['47'][2]++,!sel.isCollapsed)){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['46'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['145']++;range=sel._selection;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['146']++;html=range.htmlText;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['147']++;div=(__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['48'][0]++,inst.Node.create(html))||(__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['48'][1]++,root);__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['148']++;if((__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['50'][0]++,div.test('li'))||(__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['50'][1]++,div.one('li'))){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['49'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['149']++;this._command(cmd,null);__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['150']++;return;}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['49'][1]++;}__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['151']++;if(div.test(tag)){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['51'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['152']++;elm=range.item?(__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['52'][0]++,range.item(0)):(__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['52'][1]++,range.parentElement());__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['153']++;n=inst.one(elm);__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['154']++;lis=n.all('li');__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['155']++;str='<div>';__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['156']++;lis.each(function(l){__cov_zJJLlBnPHhoxKUOe9$BLCQ.f['30']++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['157']++;str=self._wrapContent(l.get('innerHTML'));});__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['158']++;str+='</div>';__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['159']++;s=inst.Node.create(str);__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['160']++;if(n.get('parentNode').test('div')){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['53'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['161']++;n=n.get('parentNode');}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['53'][1]++;}__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['162']++;if((__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['55'][0]++,n)&&(__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['55'][1]++,n.hasAttribute(DIR))){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['54'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['163']++;if(useP){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['56'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['164']++;s.all('p').setAttribute(DIR,n.getAttribute(DIR));}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['56'][1]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['165']++;s.setAttribute(DIR,n.getAttribute(DIR));}}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['54'][1]++;}__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['166']++;if(useP){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['57'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['167']++;n.replace(s.get('innerHTML'));}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['57'][1]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['168']++;n.replace(s);}__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['169']++;if(range.moveToElementText){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['58'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['170']++;range.moveToElementText(s._node);}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['58'][1]++;}__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['171']++;range.select();}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['51'][1]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['172']++;par=Y.one(range.parentElement());__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['173']++;if(!par.test(inst.EditorSelection.BLOCKS)){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['59'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['174']++;par=par.ancestor(inst.EditorSelection.BLOCKS);}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['59'][1]++;}__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['175']++;if(par){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['60'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['176']++;if(par.hasAttribute(DIR)){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['61'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['177']++;dir=par.getAttribute(DIR);}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['61'][1]++;}}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['60'][1]++;}__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['178']++;if(html.indexOf('<br>')>-1){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['62'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['179']++;html=html.split(/<br>/i);}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['62'][1]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['180']++;tmp=inst.Node.create(html),ps=tmp?(__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['63'][0]++,tmp.all('p')):(__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['63'][1]++,null);__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['181']++;if((__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['65'][0]++,ps)&&(__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['65'][1]++,ps.size())){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['64'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['182']++;html=[];__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['183']++;ps.each(function(n){__cov_zJJLlBnPHhoxKUOe9$BLCQ.f['31']++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['184']++;html.push(n.get('innerHTML'));});}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['64'][1]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['185']++;html=[html];}}__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['186']++;list='<'+tag+' id="ie-list">';__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['187']++;Y.each(html,function(v){__cov_zJJLlBnPHhoxKUOe9$BLCQ.f['32']++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['188']++;var a=inst.Node.create(v);__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['189']++;if((__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['67'][0]++,a)&&(__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['67'][1]++,a.test('p'))){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['66'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['190']++;if(a.hasAttribute(DIR)){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['68'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['191']++;dir=a.getAttribute(DIR);}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['68'][1]++;}__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['192']++;v=a.get('innerHTML');}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['66'][1]++;}__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['193']++;list+='<li>'+v+'</li>';});__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['194']++;list+='</'+tag+'>';__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['195']++;range.pasteHTML(list);__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['196']++;elm=inst.config.doc.getElementById('ie-list');__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['197']++;elm.id='';__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['198']++;if(dir){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['69'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['199']++;elm.setAttribute(DIR,dir);}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['69'][1]++;}__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['200']++;if(range.moveToElementText){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['70'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['201']++;range.moveToElementText(elm);}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['70'][1]++;}__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['202']++;range.select();}}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['46'][1]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['203']++;if((__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['72'][0]++,Y.UA.ie)&&(__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['72'][1]++,Y.UA.ie<11)){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['71'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['204']++;par=inst.one(sel._selection.parentElement());__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['205']++;if(par.test('p')){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['73'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['206']++;if((__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['75'][0]++,par)&&(__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['75'][1]++,par.hasAttribute(DIR))){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['74'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['207']++;dir=par.getAttribute(DIR);}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['74'][1]++;}__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['208']++;html=Y.EditorSelection.getText(par);__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['209']++;if(html===''){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['76'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['210']++;sdir='';__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['211']++;if(dir){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['77'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['212']++;sdir=' dir="'+dir+'"';}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['77'][1]++;}__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['213']++;list=inst.Node.create(Y.Lang.sub('<{tag}{dir}><li></li></{tag}>',{tag:tag,dir:sdir}));__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['214']++;par.replace(list);__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['215']++;sel.selectNode(list.one('li'));}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['76'][1]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['216']++;this._command(cmd,null);}}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['73'][1]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['217']++;this._command(cmd,null);}}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['71'][1]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['218']++;root.all(tag).addClass(cls);__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['219']++;if(sel.anchorNode.test(inst.EditorSelection.BLOCKS)){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['78'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['220']++;par=sel.anchorNode;}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['78'][1]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['221']++;par=sel.anchorNode.ancestor(inst.EditorSelection.BLOCKS);}__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['222']++;if(!par){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['79'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['223']++;par=sel.anchorNode.one(inst.EditorSelection.BLOCKS);}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['79'][1]++;}__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['224']++;if((__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['81'][0]++,par)&&(__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['81'][1]++,par.hasAttribute(DIR))){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['80'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['225']++;dir=par.getAttribute(DIR);}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['80'][1]++;}__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['226']++;if((__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['83'][0]++,par)&&(__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['83'][1]++,par.test(tag))){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['82'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['227']++;hasPParent=par.ancestor('p');__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['228']++;html=inst.Node.create('<div/>');__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['229']++;elm=par.all('li');__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['230']++;elm.each(function(h){__cov_zJJLlBnPHhoxKUOe9$BLCQ.f['33']++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['231']++;html.append(self._wrapContent(h.get('innerHTML'),hasPParent));});__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['232']++;if(dir){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['84'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['233']++;if(useP){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['85'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['234']++;html.all('p').setAttribute(DIR,dir);}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['85'][1]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['235']++;html.setAttribute(DIR,dir);}}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['84'][1]++;}__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['236']++;if(useP){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['86'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['237']++;html=inst.Node.create(html.get('innerHTML'));}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['86'][1]++;}__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['238']++;fc=html.get('firstChild');__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['239']++;par.replace(html);__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['240']++;sel.selectNode(fc);}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['82'][1]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['241']++;this._command(cmd,null);}__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['242']++;list=root.all(tag);__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['243']++;if(dir){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['87'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['244']++;if(list.size()){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['88'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['245']++;list.each(function(n){__cov_zJJLlBnPHhoxKUOe9$BLCQ.f['34']++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['246']++;if(!n.hasClass(cls)){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['89'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['247']++;n.setAttribute(DIR,dir);}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['89'][1]++;}});}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['88'][1]++;}}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['87'][1]++;}__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['248']++;list.removeClass(cls);}}},justify:function(cmd,val){__cov_zJJLlBnPHhoxKUOe9$BLCQ.f['35']++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['249']++;if(Y.UA.webkit){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['90'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['250']++;var inst=this.getInstance(),sel=new inst.EditorSelection(),aNode=sel.anchorNode,html,bgColor=aNode.getStyle('backgroundColor');__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['251']++;this._command(val);__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['252']++;sel=new inst.EditorSelection();__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['253']++;if(sel.anchorNode.test('div')){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['91'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['254']++;html='<span>'+sel.anchorNode.get('innerHTML')+'</span>';__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['255']++;sel.anchorNode.set('innerHTML',html);__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['256']++;sel.anchorNode.one('span').setStyle('backgroundColor',bgColor);__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['257']++;sel.selectNode(sel.anchorNode.one('span'));}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['91'][1]++;}}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['90'][1]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['258']++;this._command(val);}},justifycenter:function(){__cov_zJJLlBnPHhoxKUOe9$BLCQ.f['36']++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['259']++;this.command('justify','justifycenter');},justifyleft:function(){__cov_zJJLlBnPHhoxKUOe9$BLCQ.f['37']++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['260']++;this.command('justify','justifyleft');},justifyright:function(){__cov_zJJLlBnPHhoxKUOe9$BLCQ.f['38']++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['261']++;this.command('justify','justifyright');},justifyfull:function(){__cov_zJJLlBnPHhoxKUOe9$BLCQ.f['39']++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['262']++;this.command('justify','justifyfull');}}});__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['263']++;if((__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['93'][0]++,Y.UA.ie)&&(__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['93'][1]++,Y.UA.ie<11)){__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['92'][0]++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['264']++;ExecCommand.COMMANDS.bold=function(){__cov_zJJLlBnPHhoxKUOe9$BLCQ.f['40']++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['265']++;fixIETags.call(this,'bold','b','FONT-WEIGHT: bold');};__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['266']++;ExecCommand.COMMANDS.italic=function(){__cov_zJJLlBnPHhoxKUOe9$BLCQ.f['41']++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['267']++;fixIETags.call(this,'italic','i','FONT-STYLE: italic');};__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['268']++;ExecCommand.COMMANDS.underline=function(){__cov_zJJLlBnPHhoxKUOe9$BLCQ.f['42']++;__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['269']++;fixIETags.call(this,'underline','u','TEXT-DECORATION: underline');};}else{__cov_zJJLlBnPHhoxKUOe9$BLCQ.b['92'][1]++;}__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['270']++;Y.namespace('Plugin');__cov_zJJLlBnPHhoxKUOe9$BLCQ.s['271']++;Y.Plugin.ExecCommand=ExecCommand;},'@VERSION@',{'requires':['frame']});
a8m/cdnjs
ajax/libs/yui/3.14.1/exec-command/exec-command-coverage.js
JavaScript
mit
107,681
YUI.add('slider', function(Y) { /** * Create a sliding value range input visualized as a draggable thumb on a * background element. * * @module slider */ var SLIDER = 'slider', RAIL = 'rail', THUMB = 'thumb', VALUE = 'value', MIN = 'min', MAX = 'max', MIN_GUTTER = 'minGutter', MAX_GUTTER = 'maxGutter', THUMB_IMAGE = 'thumbImage', RAIL_SIZE = 'railSize', CONTENT_BOX = 'contentBox', SLIDE_START = 'slideStart', SLIDE_END = 'slideEnd', THUMB_DRAG = 'thumbDrag', SYNC = 'sync', POSITION_THUMB = 'positionThumb', RENDERED = 'rendered', DISABLED = 'disabled', DISABLED_CHANGE = 'disabledChange', DOT = '.', PX = 'px', WIDTH = 'width', HEIGHT = 'height', COMPLETE = 'complete', L = Y.Lang, isBoolean= L.isBoolean, isString = L.isString, isNumber = L.isNumber, getCN = Y.ClassNameManager.getClassName, IMAGE = 'image', C_RAIL = getCN(SLIDER,RAIL), C_THUMB = getCN(SLIDER,THUMB), C_THUMB_IMAGE = getCN(SLIDER,THUMB,IMAGE), C_IMAGE_ERROR = getCN(SLIDER,IMAGE,'error'), M = Math, max = M.max, round = M.round, floor = M.floor; /** * Create a slider to represent an integer value between a given minimum and * maximum. Sliders may be aligned vertically or horizontally, based on the * <code>axis</code> configuration. * * @class Slider * @extends Widget * @param config {Object} Configuration object * @constructor */ function Slider() { Slider.superclass.constructor.apply(this,arguments); } Y.mix(Slider, { /** * The identity of the widget. * * @property Slider.NAME * @type String * @static */ NAME : SLIDER, /** * Object property names used for respective X and Y axis Sliders (e.g. * &quot;left&quot; vs. &quot;top&quot; for placing the thumb according to * its representative value). * * @property Slider._AXIS_KEYS * @type Object * @protected * @static */ _AXIS_KEYS : { x : { dim : WIDTH, offAxisDim : HEIGHT, eventPageAxis : 'pageX', ddStick : 'stickX', xyIndex : 0 }, y : { dim : HEIGHT, offAxisDim : WIDTH, eventPageAxis : 'pageY', ddStick : 'stickY', xyIndex : 1 } }, /** * Static Object hash used to capture existing markup for progressive * enhancement. Keys correspond to config attribute names and values * are selectors used to inspect the contentBox for an existing node * structure. * * @property Slider.HTML_PARSER * @type Object * @protected * @static */ HTML_PARSER : { rail : DOT + C_RAIL, thumb : DOT + C_THUMB, thumbImage : DOT + C_THUMB_IMAGE }, /** * Static property used to define the default attribute configuration of * the Widget. * * @property Slider.ATTRS * @type Object * @protected * @static */ ATTRS : { /** * Axis upon which the Slider's thumb moves. &quot;x&quot; for * horizontal, &quot;y&quot; for vertical. * * @attribute axis * @type String * @default &quot;x&quot; * @writeOnce */ axis : { value : 'x', writeOnce : true, validator : function (v) { return this._validateNewAxis(v); }, setter : function (v) { return this._setAxisFn(v); } }, /** * Value associated with the left or top most position of the thumb on * the rail. * * @attribute min * @type Number * @default 0 */ min : { value : 0, validator : function (v) { return this._validateNewMin(v); } }, /** * Value associated with the right or bottom most position of the thumb * on the rail. * * @attribute max * @type Number * @default 100 */ max : { value : 100, validator : function (v) { return this._validateNewMax(v); } }, /** * The current value of the Slider. This value is interpretted into a * position for the thumb along the Slider's rail. * * @attribute value * @type Number * @default 0 */ value : { value : 0, validator : function (v) { return this._validateNewValue(v); } }, /** * The Node representing the Slider's rail, usually visualized as a * bar of some sort using a background image, along which the thumb * moves. This Node contains the thumb Node. * * @attribute rail * @type Node * @default null */ rail : { value : null, validator : function (v) { return this._validateNewRail(v); }, setter : function (v) { return this._setRailFn(v); } }, /** * <p>The Node representing the Slider's thumb, usually visualized as a * pointer using a contained image Node (see thumbImage). The current * value of the Slider is calculated from the centerpoint of this * Node in relation to the rail Node. If provided, the thumbImage * Node is contained within this Node.</p> * * <p>If no thumbImage is provided and the Node passed as the thumb is * an <code>img</code> element, the assigned Node will be allocated to * the thumbImage and the thumb container defaulted.</p> * * @attribute thumb * @type Node * @default null */ thumb : { value : null, validator : function (v) { return this._validateNewThumb(v); }, setter : function (v) { return this._setThumbFn(v); } }, /** * <p>The Node representing the image element to use for the Slider's * thumb.</p> * * <p>Alternately, an image URL can be passed and an <code>img</code> * Node will be generated accordingly.</p> * * <p>If no thumbImage is provided and the Node passed as the thumb is * an <code>img</code> element, the assigned Node will be allocated to * the thumbImage and the thumb container defaulted.</p> * * <p>If thumbImage is provided but its URL resolves to a 404, a default * style will be applied to maintain basic functionality.</p> * * @attribute thumbImage * @type Node|String * @default null */ thumbImage : { value : null, validator : function (v) { return this._validateNewThumbImage(v); }, setter : function (v) { return this._setThumbImageFn(v); } }, /** * <p>The width or height of the rail element representing the physical * space along which the thumb can move. CSS size values (e.g. '30em') * accepted but converted to pixels during render.</p> * * <p>Alternately, but not recommended, this attribute can be left * unassigned in favor of specifying height or width.</p> * * @attribute railSize * @type String * @default '0' */ railSize : { value : '0', validator : function (v) { return this._validateNewRailSize(v); } }, /** * Boolean indicating whether clicking and dragging on the rail will * trigger thumb movement. * * @attribute railEnabled * @type Boolean * @default true */ railEnabled : { value : true, validator : isBoolean }, /** * Like CSS padding, the distance in pixels from the inner top or left * edge of the rail node within which the thumb can travel. Negative * values allow the edge of the thumb to escape the rail node * boundaries. * * @attribute minGutter * @type Number * @default 0 */ minGutter : { value : 0, validator : isNumber }, /** * Like CSS padding, the distance in pixels from the inner bottom or * right edge of the rail node within which the thumb can travel. * Negative values allow the edge of the thumb to escape the rail node * boundaries. * * @attribute maxGutter * @type Number * @default 0 */ maxGutter : { value : 0, validator : isNumber } } }); Y.extend(Slider, Y.Widget, { /** * Collection of object property names from the appropriate hash set in * Slider._AXIS_KEYS. * * @property _key * @type Object * @protected */ _key : null, /** * Factor used to translate positional coordinates (e.g. left or top) to * the Slider's value. * * @property _factor * @type Number * @protected */ _factor : 1, /** * Pixel dimension of the rail Node's width for X axis Sliders or height * for Y axis Sliders. Used with _factor to calculate positional * coordinates for the thumb. * * @property _railSize * @type Number * @protected */ _railSize : null, /** * Pixel dimension of the thumb Node's width for X axis Sliders or height * for Y axis Sliders. Used with _factor to calculate positional * coordinates for the thumb. * * @property _thumbSize * @type Number * @protected */ _thumbSize : null, /** * Pixel offset of the point in the thumb element from its top/left edge * to where the value calculation should take place. By default, this is * calculated to half the width of the thumb, causing the value to be * marked from the center of the thumb. * * @property _thumbOffset * @type Number * @protected */ _thumbOffset : 0, /** * Object returned from temporary subscription to disabledChange event to * defer setting the disabled state while Slider is loading the thumb * image. * * @property _stall * @type Object * @protected */ _stall : false, /** * Deferred value for the disabled attribute when stalled (see _stall * property). * * @property _disabled * @type Boolean * @protected */ _disabled : false, /** * Construction logic executed durint Slider instantiation. Subscribes to * after events for min, max, and railSize. Publishes custom events * including slideStart and slideEnd. * * @method initializer * @protected */ initializer : function () { this._key = Slider._AXIS_KEYS[this.get('axis')]; this.after('minChange', this._afterMinChange); this.after('maxChange', this._afterMaxChange); this.after('railSizeChange', this._afterRailSizeChange); /** * Signals the beginning of a thumb drag operation. Payload includes * the DD.Drag instance's drag:start event under key ddEvent. * * @event slideStart * @param event {Event.Facade} An Event Facade object with the following attribute specific properties added: * <dl> * <dt>ddEvent</dt> * <dd><code>drag:start</code> event from the managed DD.Drag instance</dd> * </dl> */ this.publish(SLIDE_START); /** * Signals the end of a thumb drag operation. Payload includes * the DD.Drag instance's drag:end event under key ddEvent. * * @event slideEnd * @param event {Event.Facade} An Event Facade object with the following attribute specific properties added: * <dl> * <dt>ddEvent</dt> * <dd><code>drag:end</code> event from the managed DD.Drag instance</dd> * </dl> */ this.publish(SLIDE_END); /** * Communicates a request to synchronize the Slider UI with the * attribute state. Links the sync request with the default sync * logic in _defSyncFn. * * @event sync * @param event {Event.Facade} Event Facade object * @preventable _defSyncFn */ this.publish(SYNC, { defaultFn: this._defSyncFn }); /** * Signals a request to reposition the thumb in response to API methods. * Triggers the thumb placement logic in _defPositionThumbFn. * * @event positionThumb * @param event {Event.Facade} An Event Facade object with the following attribute specific properties added: * <dl> * <dt>changeEv</dt> * <dd><code>valueChange</code> event fired in response to the change in the value attribute</dd> * </dl> * @preventable _defPositionThumbFn */ this.publish(POSITION_THUMB, { defaultFn: this._defPositionThumbFn }); }, /** * Create the DOM structure for the Slider. * * @method renderUI * @protected */ renderUI : function () { this._initRail(); this._initThumb(); }, /** * Creates the rail element if not provided and not discovered via * HTML_PARSER. * * @method _initRail * @protected */ _initRail : function () { var cb = this.get(CONTENT_BOX), rail = this.get(RAIL); // Create rail if necessary. Make sure it's in the contentBox if (!rail) { rail = cb.appendChild( Y.Node.create('<div class="'+C_RAIL+'"></div>')); this.set(RAIL,rail); } else if (!cb.contains(rail)) { cb.appendChild(rail); } rail.addClass(C_RAIL); rail.addClass(this.getClassName(RAIL,this.get('axis'))); }, /** * <p>Creates the thumb element (not image) if not provided and not * discovered via HTML_PARSER. If the thumb is an <code>img</code> element * but no thumbImage configured or discovered, reassigns the thumb element * to the thumbImage and defaults the thumb element as a div.</p> * * <p>Makes sure the thumb is a child of the rail element and calls * _initThumbImage if thumbImage is provided.</p> * * @method _initThumb * @protected */ _initThumb : function () { var rail = this.get(RAIL), thumb = this.get(THUMB); // Passed an img element as the thumb if (thumb && !this.get(THUMB_IMAGE) && thumb.get('nodeName').toLowerCase() === 'img') { this.set(THUMB_IMAGE, thumb); this.set(THUMB,null); thumb = null; } if (!thumb) { thumb = Y.Node.create( '<div class="'+C_THUMB+'"></div>'); this.set(THUMB,thumb); } thumb.addClass(C_THUMB); if (!rail.contains(thumb)) { rail.appendChild(thumb); } if (this.get(THUMB_IMAGE)) { this._initThumbImage(); } }, /** * Ensures the thumbImage is a child of the thumb element. * * @method _initThumbImage * @protected */ _initThumbImage : function () { var thumb = this.get(THUMB), img = this.get(THUMB_IMAGE); if (img) { img.replaceClass(C_THUMB,C_THUMB_IMAGE); if (!thumb.contains(img)) { thumb.appendChild(img); } } }, /** * Creates the Y.DD instance used to handle the thumb movement and binds * Slider interaction to the configured value model. * * @method bindUI * @protected */ bindUI : function () { /** * Bridges user interaction with the thumb to the value attribute. * * @event thumbDrag * @param event {Event.Facade} An Event Facade object with the following attribute specific properties added: * <dl> * <dt>ddEvent</dt> * <dd><code>drag:drag</code> event from the managed DD.Drag instance</dd> * </dl> * @preventable _defThumbDragFn */ this.publish(THUMB_DRAG, {defaultFn: this._defThumbDragFn}); this._bindThumbDD(); this.after('valueChange', this._afterValueChange); this.after('thumbImageChange', this._afterThumbImageChange); this.after(DISABLED_CHANGE, this._afterDisabledChange); }, /** * Creates the Y.DD instance used to handle the thumb interaction. * * @method _bindThumbDD * @protected */ _bindThumbDD : function () { var ddConf = { node : this.get(THUMB), bubble : false }, conConf = { constrain2node : this.get(RAIL) }; conConf[this._key.ddStick] = true; this._dd = new Y.DD.Drag(ddConf).plug(Y.Plugin.DDConstrained, conConf); this._dd.on('drag:start', Y.bind(this._onDDStartDrag, this)); this._dd.on('drag:drag', Y.bind(this._onDDDrag, this)); this._dd.on('drag:end', Y.bind(this._onDDEndDrag, this)); this._initRailDD(); }, /** * Subscribes to the rail Node's mousedown event to actuate the thumb when * backgroundEnabled is true. * * @method _initRailDD * @protected */ _initRailDD : function () { this.get(RAIL).on('mousedown',Y.bind(this._handleRailMouseDown,this)); }, /** * If the Slider is not disabled and railEnabled is true, moves the thumb * to the mousedown position and hands control over to DD. * * @method _handleRailMouseDown * @param e {Event} Mousedown event facade * @protected */ _handleRailMouseDown : function (e) { if (this.get('railEnabled') && !this.get(DISABLED)) { var dd = this._dd, xyIndex = this._key.xyIndex, xy; if (dd.get('primaryButtonOnly') && e.button > 1) { Y.log('Mousedown was not produced by the primary button', 'warn', 'dd-drag'); return false; } dd._dragThreshMet = true; dd._fixIEMouseDown(); e.halt(); Y.DD.DDM.activeDrag = dd; // Adjust registered starting position by half the thumb's x/y xy = dd.get('dragNode').getXY(); xy[xyIndex] += this._thumbOffset; dd._setStartPosition(xy); dd.set('activeHandle',dd.get('dragNode')); dd.start(); dd._alignNode([e.pageX,e.pageY]); } }, /** * Synchronizes the DOM state with the attribute settings (most notably * railSize and value). If thumbImage is provided and is still loading, * sync is delayed until it is complete, since the image's dimensions are * taken into consideration for calculations. * * @method syncUI */ syncUI : function () { this.get(CONTENT_BOX).removeClass(C_IMAGE_ERROR); var img = this.get(THUMB_IMAGE); if (this._isImageLoading(img)) { Y.log('Thumb image loading. Scheduling sync.','info','slider'); // Schedule the sync for when the image loads/errors this._scheduleSync(); } else { Y.log('No thumb image, or image already loaded. Syncing immediately.','info','slider'); this._ready(img,!this._isImageLoaded(img)); } }, /** * Binds to the load and error event on the thumbImage to sync the DOM * state with the attribute settings when the image resource is resolved. * The Slider is disabled while it waits. * * @method _scheduleSync * @protected */ _scheduleSync : function () { var img, handler; if (!this._stall) { // disable the control until the image is loaded this._disabled = this.get(DISABLED); this.set(DISABLED,true); this._stall = this.on(DISABLED_CHANGE,this._stallDisabledChange); img = this.get(THUMB_IMAGE); handler = Y.bind(this._imageLoaded,this,img); img.on('load', handler); img.on('error',handler); } }, /** * Method subscribed to the disabledChange event when thumbImage is being * loaded. Prevents manually enabling the Slider until the thumbImage * resource is resolved. Intended value is stored during load and set upon * completion. * * @method _stallDisabledChange * @param e {Event} Change event for the disabled attribute * @protected */ _stallDisabledChange : function (e) { this._disabled = e.newVal; e.preventDefault(); }, /** * Event handler assigned to the thumbImage's load and error event if it * was not loaded prior to instantiation. Restores the disabled value. * * @method _imageLoaded * @param img {Node} The thumbImage Node * @param e {Event} load or error event fired by the thumbImage * @protected */ _imageLoaded : function (img,e) { var error = (e.type.toLowerCase().indexOf('error') > -1); // Need to execute inside a setTimeout because IE doesn't report // img.complete === true until after the img.onload handler // @TODO: readyState reports correctly in onload. Lose this wrapper // and use that in _isImageLoaded. Y.later(0, this, function () { if (this._stall) { this._stall.detach(); } Y.log('Thumb image '+e.type+'ed. Syncing','info','slider'); this._stall = false; this._ready(img,error); this.set(DISABLED,this._disabled); }); }, /** * Applies a class to the content box if the thumbImage failed to resolve, * the fires the internal sync event triggering a sync between UI and * state. * * @method _ready * @param img {Node} the thumbImage Node * @param error {Boolean} Indicates an error while loading the thumbImage * @protected */ _ready : function (img,error) { var method = error ? 'addClass' : 'removeClass'; // If the thumb image url results in 404, assign a class to provide // default thumb dimensions/UI this.get(CONTENT_BOX)[method](C_IMAGE_ERROR); this.fire(SYNC); }, /** * The default synchronization behavior, updating the Slider's DOM state to * match the current attribute values. * * @method _defSyncFn * @param e {Event} Internal sync event * @protected */ _defSyncFn : function (e) { this._uiSetThumbSize(); this._setThumbOffset(); this._uiSetRailSize(); this._setRailOffsetXY(); this._setDDGutter(); this._resetDDCacheRegion(); this._setFactor(); var val = this.get(VALUE); this.fire(POSITION_THUMB, { value : val, offset : this._convertValueToOffset(val) }); // Forces a reflow of the bounding box to address IE8 inline-block // container not expanding correctly. bug 2527905 this.get('boundingBox').toggleClass(''); }, /** * Captures the thumb's pixel height or width (depending on the Slider's * axis) for use in positioning calculations. * * @method _uiSetThumbSize * @protected */ _uiSetThumbSize : function () { var thumb = this.get(THUMB), dim = this._key.dim, img = this.get(THUMB_IMAGE), size; // offsetWidth fails in hidden containers size = parseInt(thumb.getComputedStyle(dim),10); Y.log('thumb '+dim+': '+size+'px','info','slider'); if (img && this._isImageLoaded(img)) { Y.log('using thumbImage '+dim+' ('+img.get(dim)+') for _thumbSize','info','slider'); size = img.get(dim); } this._thumbSize = size; }, /** * Establishes the point in the thumb that should align to the rail * position representing the calculated value. * * @method _setThumbOffset * @protected */ _setThumbOffset : function () { this._thumbOffset = floor(this._thumbSize / 2); Y.log('_thumbOffset calculated to '+this._thumbOffset+'px','info','slider'); }, /** * Stores the rail Node's pixel height or width, depending on the Slider's * axis, for use in calculating thumb position from the value. * * @method _uiSetRailSize * @protected */ _uiSetRailSize : function () { var rail = this.get(RAIL), thumb = this.get(THUMB), img = this.get(THUMB_IMAGE), dim = this._key.dim, size = this.get(RAIL_SIZE), setxy = false; if (parseInt(size,10)) { Y.log('railSize provided: '+size,'info','slider'); // Convert to pixels rail.setStyle(dim,size); size = parseInt(rail.getComputedStyle(dim),10); Y.log('pixel '+dim+' of railSize: '+size+'px', 'info', 'slider'); } else { Y.log('defaulting railSize from max of computed style and configured '+dim+' attribute value', 'info', 'slider'); // Default from height or width (axis respective), or dims assigned // via css to the rail or thumb, whichever is largest. // Dear implementers, please use railSize, not height/width to // set the rail dims size = this.get(dim); if (parseInt(size,10)) { setxy = true; rail.setStyle(dim,size); size = parseInt(rail.getComputedStyle(dim),10); } size = max( size|0, parseInt(thumb.getComputedStyle(dim),10), parseInt(rail.getComputedStyle(dim),10)); Y.log('pixel '+dim+' of rail: '+size+'px', 'info', 'slider'); if (img && this._isImageLoaded(img)) { Y.log('using max of thumbImage '+dim+' ('+img.get(dim)+' and '+size+' for railSize', 'info', 'slider'); size = max(img.get(dim),size); } } rail.setStyle(dim, size + PX); this._railSize = size; // handle the (not recommended) fallback case of setting rail size via // widget height/width params. This is the only case that sets the // off-axis rail dim in the code. if (setxy) { dim = this._key.offAxisDim; size = this.get(dim); if (size) { rail.set(dim,size); } } }, /** * Store the current XY position of the rail Node on the page. For use in * calculating thumb position from value. * * @method _setRailOffsetXY * @protected */ _setRailOffsetXY : function () { this._offsetXY = this.get(RAIL).getXY()[this._key.xyIndex] + this.get(MIN_GUTTER); }, /** * Passes the gutter attribute value to the DDConstrain gutter attribute. * * @method _setDDGutter * @protected */ _setDDGutter : function () { var gutter = this._key.xyIndex ? this.get(MIN_GUTTER) + " 0 " + this.get(MAX_GUTTER) : "0 " + this.get(MAX_GUTTER) + " 0 " + this.get(MIN_GUTTER); Y.log('setting DDConstrain gutter "'+gutter+'"','info','slider'); this._dd.con.set('gutter', gutter); }, /** * Resets the cached region inside the DD constrain instance to support * repositioning the Slider after instantiation. * * @method _resetDDCacheRegion * @protected */ _resetDDCacheRegion : function () { // Workaround for ticket #2527964 this._dd.con._cacheRegion(); }, /** * Calculates the multiplier used to translate the value into a thumb * position. * * @method _setFactor * @protected */ _setFactor : function () { var range = this._railSize - this._thumbSize - this.get(MIN_GUTTER) - this.get(MAX_GUTTER); this._factor = this._railSize ? (this.get(MAX) - this.get(MIN)) / range : 1; Y.log('_factor set to '+this._factor,'info','slider'); }, /** * Convenience method for accessing the current value of the Slider. * Equivalent to <code>slider.get(&quot;value&quot;)</code>. * * @method getValue * @return {Number} the value */ getValue : function () { return this.get(VALUE); }, /** * Convenience method for updating the current value of the Slider. * Equivalent to <code>slider.set(&quot;value&quot;,val)</code>. * * @method setValue * @param val {Number} the new value */ setValue : function (val) { this.set(VALUE,val); }, /** * Validator applied to new values for the axis attribute. Only * &quot;x&quot; and &quot;y&quot; are permitted. * * @method _validateNewAxis * @param v {String} proposed value for the axis attribute * @return Boolean * @protected */ _validateNewAxis : function (v) { return isString(v) && 'xXyY'.indexOf(v.charAt(0)) > -1; }, /** * Validator applied to the min attribute. * * @method _validateNewMin * @param v {MIXED} proposed value for the min attribute * @return Boolean * @protected */ _validateNewMin : function (v) { return isNumber(v); }, /** * Validator applied to the max attribute. * * @method _validateNewMax * @param v {MIXED} proposed value for the max attribute * @return Boolean * @protected */ _validateNewMax : function (v) { return isNumber(v); }, /** * Validator applied to the value attribute. * * @method _validateNewValue * @param v {MIXED} proposed value for the value attribute * @return Boolean * @protected */ _validateNewValue : function (v) { var min = this.get(MIN), max = this.get(MAX); return isNumber(v) && (min < max ? (v >= min && v <= max) : (v >= max && v <= min)); }, /** * Validator applied to the rail attribute. Rejects all values after the * Slider has been rendered. * * @method _validateNewRail * @param v {MIXED} proposed value for the rail attribute * @return Boolean * @protected */ _validateNewRail : function (v) { return !this.get(RENDERED) || v; }, /** * Validator applied to the thumb attribute. Rejects all values after the * Slider has been rendered. * * @method _validateNewThumb * @param v {MIXED} proposed value for the thumb attribute * @return Boolean * @protected */ _validateNewThumb : function (v) { return !this.get(RENDERED) || v; }, /** * Validator applied to the thumbImage attribute. Rejects all values after * the Slider has been rendered. * * @method _validateNewThumbImage * @param v {MIXED} proposed value for the thumbImage attribute * @return Boolean * @protected */ _validateNewThumbImage : function (v) { return !this.get(RENDERED) || v; }, /** * Validator applied to the railSize attribute. Only strings of css size * values (e.g. '200px') are allowed. * * @method _validateNewRailSize * @param v {String} proposed value for the railSize attribute * @return Boolean * @protected */ _validateNewRailSize : function (v) { return isString(v) && (v === '0' || /^\d+(?:p[xtc]|%|e[mx]|in|[mc]m)$/.test(v)); }, /** * Setter applied to the input when updating the axis attribute. * * @method _setAxisFn * @param v {String} proposed value for the axis attribute * @return {String} lowercased first character of the input string * @protected */ _setAxisFn : function (v) { return v.charAt(0).toLowerCase(); }, /** * Setter applied to the input when updating the rail attribute. Input can * be a Node, raw HTMLElement, or a selector string to locate it. * * @method _setRailFn * @param v {Node|String|HTMLElement} The rail element Node or selector * @return {Node} The Node if found. Otherwise null. * @protected */ _setRailFn : function (v) { return Y.get(v) || null; }, /** * Setter applied to the input when updating the thumb attribute. Input can * be a Node, raw HTMLElement, or a selector string to locate it. * * @method _setThumbFn * @param v {Node|String|HTMLElement} The thumb element Node or selector * @return {Node} The Node if found. Otherwise null. * @protected */ _setThumbFn : function (v) { return Y.get(v) || null; }, /** * Setter applied to the input when updating the thumbImage attribute. * Input can be a Node, raw HTMLElement, selector string to locate it, or * the URL for an image resource. * * String input will be treated as a selector. If no element is found using * the selector, an <code>img</code> Node will be created with the string * used as the <code>src</code> attribute. * * @method _setThumbImageFn * @param v {Node|String|HTMLElement} The thumbImage element Node, selector, * or image URL * @return {Node} The Node if found or created. Otherwise null. * @protected */ _setThumbImageFn : function (v) { return v ? Y.get(v) || Y.Node.create('<img src="'+v+'" alt="Slider thumb">') : null; }, /** * Caches the current page position of the rail element and fires the * slideStart event in response to the DD's drag:start. * * @method _onDDStartDrag * @param e {Event} the DD instance's drag:start custom event * @protected */ _onDDStartDrag : function (e) { Y.log('slide start','info','slider'); this._setRailOffsetXY(); this.fire(SLIDE_START,{ ddEvent: e }); }, /** * Fires the thumbDrag event to queue Slider value update. * * @method _onDDDrag * @param e {Event} the DD instance's drag:drag custom event * @protected */ _onDDDrag : function (e) { Y.log('thumb drag','info','slider'); this.fire(THUMB_DRAG, { ddEvent: e }); }, /** * The default value update behavior in response to Slider thumb * interaction. Calculates the value using stored offsets, the _factor * multiplier and the min value. * * @method _defThumbDragFn * @param e {Event} the internal thumbDrag event * @protected */ _defThumbDragFn : function (e) { var before = this.get(VALUE), val = e.ddEvent[this._key.eventPageAxis] - this._offsetXY; Y.log('setting value from thumb drag: before('+before+') raw('+val+') factored('+this._convertOffsetToValue(val)+')', 'info','slider'); val = this._convertOffsetToValue(val); if (before !== val) { this.set(VALUE, val, { ddEvent: e.ddEvent }); } }, /** * Fires the slideEnd event. * * @method _onDDEndDrag * @param e {Event} the DD instance's drag:end custom event * @protected */ _onDDEndDrag : function (e) { Y.log('slide end','info','slider'); this.fire(SLIDE_END,{ ddEvent: e }); }, /** * Calls _uiPositionThumb with the value of the custom event's * &quot;offset&quot; property. * * @method _defPositionThumbFn * @param e {Event} the positionThumb custom event * @protected */ _defPositionThumbFn : function (e) { Y.log('setting thumb offset ('+e.offset+') from value attribute update ('+e.value+')', 'info', 'slider'); this._uiPositionThumb(e.offset); }, /** * Places the thumb at a particular X or Y location based on the configured * axis. * * @method _uiPositionThumb * @param xy {Number} the desired left or top pixel position of the thumb * in relation to the rail Node. * @protected */ _uiPositionThumb : function (xy) { var dd = this._dd, thumb = dd.get('dragNode'), hidden = thumb.ancestor(this._isDisplayNone); if (!hidden) { dd._setStartPosition(dd.get('dragNode').getXY()); // stickX/stickY config on DD instance will negate off-axis move dd._alignNode([xy,xy],true); } }, /** * Helper function to search up the ancestor axis looking for a node with * style display: none. This is passed as a function to node.ancestor(..) * to test if a given node is in the displayed DOM and can get accurate * positioning information. * * @method _isDisplayNone * @param el {Node} ancestor node as the function walks up the parent axis * @return {Boolean} true if the node is styled with display: none * @protected */ _isDisplayNone : function (node) { return node.getComputedStyle('display') === 'none'; }, /** * Fires the internal positionThumb event in response to a change in the * value attribute. * * @method _afterValueChange * @param e {Event} valueChange custom event * @protected */ _afterValueChange : function (e) { if (!e.ddEvent) { var xy = this._convertValueToOffset(e.newVal); Y.log('firing positionThumb to position thumb', 'info', 'slider'); this.fire(POSITION_THUMB,{ value: e.newVal, offset: xy }); } }, /** * Converts a value to a pixel offset for the thumb position on the rail. * * @method _convertValueToOffset * @param v {Number} value between the Slider's min and max * @protected */ _convertValueToOffset : function (v) { return round((v - this.get(MIN)) / this._factor) + this._offsetXY; }, /** * Converts a pixel offset of the thumb on the rail to a value. * * @method _convertOffsetToValue * @param v {Number} pixel offset of the thumb on the rail * @protected */ _convertOffsetToValue : function (v) { return round(this.get(MIN) + (v * this._factor)); }, /** * Replaces the thumb Node in response to a change in the thumb attribute. * This only has effect after the Slider is rendered. * * @method _afterThumbChange * @param e {Event} thumbChange custom event * @protected */ _afterThumbChange : function (e) { var thumb; if (this.get(RENDERED)) { if (e.prevValue) { e.prevValue.get('parentNode').removeChild(e.prevValue); } this._initThumb(); thumb = this.get(THUMB); this._dd.set('node',thumb); this._dd.set('dragNode',thumb); this.syncUI(); } }, /** * Sets or replaces the thumb's contained <code>img</code> Node with the * new Node in response to a change in the thumbImage attribute. This only * has effect after the Slider is rendered. * * @method _afterThumbImageChange * @param e {Event} thumbImageChange custom event * @protected */ _afterThumbImageChange : function (e) { if (this.get(RENDERED)) { if (e.prevValue) { e.prevValue.get('parentNode').removeChild(e.prevValue); } this._initThumbImage(); this.syncUI(); } }, /** * Updates the Slider UI in response to change in the min attribute. * * @method _afterMinChange * @param e {Event} minChange custom event * @protected */ _afterMinChange : function (e) { this._refresh(e); }, /** * Updates the Slider UI in response to change in the max attribute. * * @method _afterMaxChange * @param e {Event} maxChange custom event * @protected */ _afterMaxChange : function (e) { this._refresh(e); }, /** * Updates the Slider UI in response to change in the railSize attribute. * * @method _afterRailSizeChange * @param e {Event} railSizeChange custom event * @protected */ _afterRailSizeChange : function (e) { this._refresh(e); }, /** * Locks or unlocks the DD instance in response to a change in the disabled * attribute. * * @method _afterDisabledChange * @param e {Event} disabledChange custom event * @protected */ _afterDisabledChange : function (e) { if (this._dd) { this._dd.set('lock',e.newVal); } }, /** * Common handler to call syncUI in response to change events that occurred * after the Slider is rendered. * * @method _refresh * @param e {Event} An attribute change event * @protected */ _refresh : function (e) { if (e.newVal !== e.prevVal && this.get(RENDERED)) { this.syncUI(); } }, /** * Used to determine if there is a current or pending request for the * thumbImage resource. * * @method _isImageLoading * @param img {Node} <code>img</code> Node * @return Boolean * @protected */ _isImageLoading : function (img) { return img && !img.get(COMPLETE); }, /** * Used to determine if the image resource loaded successfully or there was * an error. * * NOTES: * <ul> * <li>img load error fired xbrowser for image resources not yet resolved</li> * <li>img.complete reports false in IE for images not yet loaded as well as images that failed to load</li> * <li>img.complete true && img.naturalWidth == 0 in FF and Safari indicate image failed to load</li> * <li>img.complete && img.width == 0 in Opera indicates image failed to load</li> * </ul> * * @method _isImageLoaded * @param img {Node} <code>img</code> Node * @return Boolean * @protected */ _isImageLoaded : function (img) { if (img) { var w = img.get('naturalWidth'); return img.get(COMPLETE) && (!isNumber(w) ? img.get(WIDTH) : w); } return true; } }); Y.Slider = Slider; }, '@VERSION@' ,{requires:['widget','dd-constrain']});
dc-js/cdnjs
ajax/libs/yui/3.0.0/slider/slider-debug.js
JavaScript
mit
43,902
YUI.add("node-focusmanager",function(B){var J="activeDescendant",L="id",I="disabled",N="tabIndex",E="focused",A="focusClass",Q="circular",C="UI",F="key",G=J+"Change",O="host",P={37:true,38:true,39:true,40:true},M={"a":true,"button":true,"input":true,"object":true},H=B.Lang,K=B.UA,D=function(){D.superclass.constructor.apply(this,arguments);};D.ATTRS={focused:{value:false,readOnly:true},descendants:{getter:function(R){return this.get(O).all(R);}},activeDescendant:{setter:function(V){var T=H.isNumber,S=B.Attribute.INVALID_VALUE,R=this._descendantsMap,Y=this._descendants,X,U,W;if(T(V)){X=V;U=X;}else{if((V instanceof B.Node)&&R){X=R[V.get(L)];if(T(X)){U=X;}else{U=S;}}else{U=S;}}if(Y){W=Y.item(X);if(W&&W.get("disabled")){U=S;}}return U;}},keys:{value:{next:null,previous:null}},focusClass:{},circular:{value:true}};B.extend(D,B.Plugin.Base,{_stopped:true,_descendants:null,_descendantsMap:null,_focusedNode:null,_lastNodeIndex:0,_eventHandlers:null,_initDescendants:function(){var Y=this.get("descendants"),R={},W=-1,V,U=this.get(J),X,S,T=0;if(H.isUndefined(U)){U=-1;}if(Y){V=Y.size();for(T=0;T<V;T++){X=Y.item(T);if(W===-1&&!X.get(I)){W=T;}if(U<0&&parseInt(X.getAttribute(N,2),10)===0){U=T;}if(X){X.set(N,-1);}S=X.get(L);if(!S){S=B.guid();X.set(L,S);}R[S]=T;}if(U<0){U=0;}X=Y.item(U);if(!X||X.get(I)){X=Y.item(W);U=W;}this._lastNodeIndex=V-1;this._descendants=Y;this._descendantsMap=R;this.set(J,U);if(X){X.set(N,0);}}},_isDescendant:function(R){return(R.get(L) in this._descendantsMap);},_removeFocusClass:function(){var S=this._focusedNode,T=this.get(A),R;if(T){R=H.isString(T)?T:T.className;}if(S&&R){S.removeClass(R);}},_detachKeyHandler:function(){var S=this._prevKeyHandler,R=this._nextKeyHandler;if(S){S.detach();}if(R){R.detach();}},_preventScroll:function(R){if(P[R.keyCode]&&this._isDescendant(R.target)){R.preventDefault();}},_fireClick:function(S){var R=S.target,T=R.get("nodeName").toLowerCase();if(S.keyCode===13&&(!M[T]||(T==="a"&&!R.getAttribute("href")))){R.simulate("click");}},_attachKeyHandler:function(){this._detachKeyHandler();var U=this.get("keys.next"),S=this.get("keys.previous"),T=this.get(O),R=this._eventHandlers;if(S){this._prevKeyHandler=B.on(F,B.bind(this._focusPrevious,this),T,S);}if(U){this._nextKeyHandler=B.on(F,B.bind(this._focusNext,this),T,U);}if(K.opera){R.push(T.on("keypress",this._preventScroll,this));}if(!K.opera){R.push(T.on("keypress",this._fireClick,this));}},_detachEventHandlers:function(){this._detachKeyHandler();var R=this._eventHandlers;if(R){B.Array.each(R,function(S){S.detach();});this._eventHandlers=null;}},_attachEventHandlers:function(){var U=this._descendants,R,S,T;if(U&&U.size()){R=this._eventHandlers||[];S=this.get(O).get("ownerDocument");if(R.length===0){R.push(S.on("focus",this._onDocFocus,this));R.push(S.on("mousedown",this._onDocMouseDown,this));R.push(this.after("keysChange",this._attachKeyHandler));R.push(this.after("descendantsChange",this._initDescendants));R.push(this.after(G,this._afterActiveDescendantChange));T=this.after("focusedChange",B.bind(function(V){if(V.newVal){this._attachKeyHandler();T.detach();}},this));R.push(T);}this._eventHandlers=R;}},_onDocMouseDown:function(U){var W=this.get(O),R=U.target,V=W.contains(R),T,S=function(Y){var X=false;if(!Y.compareTo(W)){X=this._isDescendant(Y)?Y:S.call(this,Y.get("parentNode"));}return X;};if(V){T=S.call(this,R);if(T){R=T;}else{if(!T&&this.get(E)){this._set(E,false);this._onDocFocus(U);}}}if(V&&this._isDescendant(R)){this.focus(R);}else{if(K.webkit&&this.get(E)&&(!V||(V&&!this._isDescendant(R)))){this._set(E,false);this._onDocFocus(U);}}},_onDocFocus:function(W){var U=this._focusTarget||W.target,S=this.get(E),V=this.get(A),T=this._focusedNode,R;if(this._focusTarget){this._focusTarget=null;}if(this.get(O).contains(U)){R=this._isDescendant(U);if(!S&&R){S=true;}else{if(S&&!R){S=false;}}}else{S=false;}if(V){if(T&&(!T.compareTo(U)||!S)){this._removeFocusClass();}if(R&&S){if(V.fn){U=V.fn(U);U.addClass(V.className);}else{U.addClass(V);}this._focusedNode=U;}}this._set(E,S);},_focusNext:function(S,T){var R=T||this.get(J),U;if(this._isDescendant(S.target)&&(R<=this._lastNodeIndex)){R=R+1;if(R===(this._lastNodeIndex+1)&&this.get(Q)){R=0;}U=this._descendants.item(R);if(U&&U.get(I)){this._focusNext(S,R);}else{this.focus(R);}}this._preventScroll(S);},_focusPrevious:function(S,T){var R=T||this.get(J),U;if(this._isDescendant(S.target)&&R>=0){R=R-1;if(R===-1&&this.get(Q)){R=this._lastNodeIndex;}U=this._descendants.item(R);if(U&&U.get(I)){this._focusPrevious(S,R);}else{this.focus(R);}}this._preventScroll(S);},_afterActiveDescendantChange:function(R){var S=this._descendants.item(R.prevVal);if(S){S.set(N,-1);}S=this._descendants.item(R.newVal);if(S){S.set(N,0);}},initializer:function(R){this.start();},destructor:function(){this.stop();this.get(O).focusManager=null;},focus:function(R){if(H.isUndefined(R)){R=this.get(J);}this.set(J,R,{src:C});var S=this._descendants.item(this.get(J));if(S){S.focus();if(K.opera&&S.get("nodeName").toLowerCase()==="button"){this._focusTarget=S;}}},blur:function(){var R;if(this.get(E)){R=this._descendants.item(this.get(J));if(R){R.blur();this._removeFocusClass();}this._set(E,false,{src:C});}},start:function(){if(this._stopped){this._initDescendants();this._attachEventHandlers();this._stopped=false;}},stop:function(){if(!this._stopped){this._detachEventHandlers();this._descendants=null;this._focusedNode=null;this._lastNodeIndex=0;this._stopped=true;}},refresh:function(){this._initDescendants();if(!this._eventHandlers){this._attachEventHandlers();}}});D.NAME="nodeFocusManager";D.NS="focusManager";B.namespace("Plugin");B.Plugin.NodeFocusManager=D;},"@VERSION@",{requires:["attribute","node","plugin","node-event-simulate","event-key","event-focus"]});
wil93/cdnjs
ajax/libs/yui/3.2.0/node-focusmanager/node-focusmanager-min.js
JavaScript
mit
5,744
/* Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.md or http://ckeditor.com/license */ CKEDITOR.lang['es']={"editor":"Editor de texto enriquecido","editorPanel":"Panel del Editor de Texto Enriquecido","common":{"editorHelp":"Pulse ALT 0 para ayuda","browseServer":"Ver Servidor","url":"URL","protocol":"Protocolo","upload":"Cargar","uploadSubmit":"Enviar al Servidor","image":"Imagen","flash":"Flash","form":"Formulario","checkbox":"Casilla de Verificación","radio":"Botones de Radio","textField":"Campo de Texto","textarea":"Area de Texto","hiddenField":"Campo Oculto","button":"Botón","select":"Campo de Selección","imageButton":"Botón Imagen","notSet":"<No definido>","id":"Id","name":"Nombre","langDir":"Orientación","langDirLtr":"Izquierda a Derecha (LTR)","langDirRtl":"Derecha a Izquierda (RTL)","langCode":"Cód. de idioma","longDescr":"Descripción larga URL","cssClass":"Clases de hojas de estilo","advisoryTitle":"Título","cssStyle":"Estilo","ok":"Aceptar","cancel":"Cancelar","close":"Cerrar","preview":"Previsualización","resize":"Arrastre para redimensionar","generalTab":"General","advancedTab":"Avanzado","validateNumberFailed":"El valor no es un número.","confirmNewPage":"Cualquier cambio que no se haya guardado se perderá.\r\n¿Está seguro de querer crear una nueva página?","confirmCancel":"Algunas de las opciones se han cambiado.\r\n¿Está seguro de querer cerrar el diálogo?","options":"Opciones","target":"Destino","targetNew":"Nueva ventana (_blank)","targetTop":"Ventana principal (_top)","targetSelf":"Misma ventana (_self)","targetParent":"Ventana padre (_parent)","langDirLTR":"Izquierda a derecha (LTR)","langDirRTL":"Derecha a izquierda (RTL)","styles":"Estilos","cssClasses":"Clase de la hoja de estilos","width":"Anchura","height":"Altura","align":"Alineación","alignLeft":"Izquierda","alignRight":"Derecha","alignCenter":"Centrado","alignJustify":"Justificado","alignTop":"Tope","alignMiddle":"Centro","alignBottom":"Pie","alignNone":"Ninguno","invalidValue":"Valor no válido","invalidHeight":"Altura debe ser un número.","invalidWidth":"Anchura debe ser un número.","invalidCssLength":"El valor especificado para el campo \"%1\" debe ser un número positivo, incluyendo optionalmente una unidad de medida CSS válida (px, %, in, cm, mm, em, ex, pt, o pc).","invalidHtmlLength":"El valor especificado para el campo \"%1\" debe ser un número positivo, incluyendo optionalmente una unidad de medida HTML válida (px o %).","invalidInlineStyle":"El valor especificado para el estilo debe consistir en uno o más pares con el formato \"nombre: valor\", separados por punto y coma.","cssLengthTooltip":"Introduca un número para el valor en pixels o un número con una unidad de medida CSS válida (px, %, in, cm, mm, em, ex, pt, o pc).","unavailable":"%1<span class=\"cke_accessibility\">, no disponible</span>"},"about":{"copy":"Copyright &copy; $1. Todos los derechos reservados.","dlgTitle":"Acerca de CKEditor","help":"Lea la $1 para resolver sus dudas.","moreInfo":"Para información de licencia, por favor visite nuestro sitio web:","title":"Acerca de CKEditor","userGuide":"Guía de usuario de CKEditor"},"basicstyles":{"bold":"Negrita","italic":"Cursiva","strike":"Tachado","subscript":"Subíndice","superscript":"Superíndice","underline":"Subrayado"},"blockquote":{"toolbar":"Cita"},"clipboard":{"copy":"Copiar","copyError":"La configuración de seguridad de este navegador no permite la ejecución automática de operaciones de copiado.\r\nPor favor use el teclado (Ctrl/Cmd+C).","cut":"Cortar","cutError":"La configuración de seguridad de este navegador no permite la ejecución automática de operaciones de cortado.\r\nPor favor use el teclado (Ctrl/Cmd+X).","paste":"Pegar","pasteArea":"Zona de pegado","pasteMsg":"Por favor pegue dentro del cuadro utilizando el teclado (<STRONG>Ctrl/Cmd+V</STRONG>);\r\nluego presione <STRONG>Aceptar</STRONG>.","securityMsg":"Debido a la configuración de seguridad de su navegador, el editor no tiene acceso al portapapeles.\r\nEs necesario que lo pegue de nuevo en esta ventana.","title":"Pegar"},"contextmenu":{"options":"Opciones del menú contextual"},"button":{"selectedLabel":"%1 (Seleccionado)"},"toolbar":{"toolbarCollapse":"Contraer barra de herramientas","toolbarExpand":"Expandir barra de herramientas","toolbarGroups":{"document":"Documento","clipboard":"Portapapeles/Deshacer","editing":"Edición","forms":"Formularios","basicstyles":"Estilos básicos","paragraph":"Párrafo","links":"Enlaces","insert":"Insertar","styles":"Estilos","colors":"Colores","tools":"Herramientas"},"toolbars":"Barras de herramientas del editor"},"elementspath":{"eleLabel":"Ruta de los elementos","eleTitle":"%1 elemento"},"format":{"label":"Formato","panelTitle":"Formato","tag_address":"Dirección","tag_div":"Normal (DIV)","tag_h1":"Encabezado 1","tag_h2":"Encabezado 2","tag_h3":"Encabezado 3","tag_h4":"Encabezado 4","tag_h5":"Encabezado 5","tag_h6":"Encabezado 6","tag_p":"Normal","tag_pre":"Con formato"},"horizontalrule":{"toolbar":"Insertar Línea Horizontal"},"image":{"alt":"Texto Alternativo","border":"Borde","btnUpload":"Enviar al Servidor","button2Img":"¿Desea convertir el botón de imagen en una simple imagen?","hSpace":"Esp.Horiz","img2Button":"¿Desea convertir la imagen en un botón de imagen?","infoTab":"Información de Imagen","linkTab":"Vínculo","lockRatio":"Proporcional","menu":"Propiedades de Imagen","resetSize":"Tamaño Original","title":"Propiedades de Imagen","titleButton":"Propiedades de Botón de Imagen","upload":"Cargar","urlMissing":"Debe indicar la URL de la imagen.","vSpace":"Esp.Vert","validateBorder":"El borde debe ser un número.","validateHSpace":"El espaciado horizontal debe ser un número.","validateVSpace":"El espaciado vertical debe ser un número."},"indent":{"indent":"Aumentar Sangría","outdent":"Disminuir Sangría"},"fakeobjects":{"anchor":"Ancla","flash":"Animación flash","hiddenfield":"Campo oculto","iframe":"IFrame","unknown":"Objeto desconocido"},"link":{"acccessKey":"Tecla de Acceso","advanced":"Avanzado","advisoryContentType":"Tipo de Contenido","advisoryTitle":"Título","anchor":{"toolbar":"Referencia","menu":"Propiedades de Referencia","title":"Propiedades de Referencia","name":"Nombre de la Referencia","errorName":"Por favor, complete el nombre de la Referencia","remove":"Quitar Referencia"},"anchorId":"Por ID de elemento","anchorName":"Por Nombre de Referencia","charset":"Fuente de caracteres vinculado","cssClasses":"Clases de hojas de estilo","emailAddress":"Dirección de E-Mail","emailBody":"Cuerpo del Mensaje","emailSubject":"Título del Mensaje","id":"Id","info":"Información de Vínculo","langCode":"Código idioma","langDir":"Orientación","langDirLTR":"Izquierda a Derecha (LTR)","langDirRTL":"Derecha a Izquierda (RTL)","menu":"Editar Vínculo","name":"Nombre","noAnchors":"(No hay referencias disponibles en el documento)","noEmail":"Por favor escriba la dirección de e-mail","noUrl":"Por favor escriba el vínculo URL","other":"<otro>","popupDependent":"Dependiente (Netscape)","popupFeatures":"Características de Ventana Emergente","popupFullScreen":"Pantalla Completa (IE)","popupLeft":"Posición Izquierda","popupLocationBar":"Barra de ubicación","popupMenuBar":"Barra de Menú","popupResizable":"Redimensionable","popupScrollBars":"Barras de desplazamiento","popupStatusBar":"Barra de Estado","popupToolbar":"Barra de Herramientas","popupTop":"Posición Derecha","rel":"Relación","selectAnchor":"Seleccionar una referencia","styles":"Estilo","tabIndex":"Indice de tabulación","target":"Destino","targetFrame":"<marco>","targetFrameName":"Nombre del Marco Destino","targetPopup":"<ventana emergente>","targetPopupName":"Nombre de Ventana Emergente","title":"Vínculo","toAnchor":"Referencia en esta página","toEmail":"E-Mail","toUrl":"URL","toolbar":"Insertar/Editar Vínculo","type":"Tipo de vínculo","unlink":"Eliminar Vínculo","upload":"Cargar"},"list":{"bulletedlist":"Viñetas","numberedlist":"Numeración"},"magicline":{"title":"Insertar párrafo aquí"},"maximize":{"maximize":"Maximizar","minimize":"Minimizar"},"pastetext":{"button":"Pegar como Texto Plano","title":"Pegar como Texto Plano"},"pastefromword":{"confirmCleanup":"El texto que desea parece provenir de Word.\r\n¿Desea depurarlo antes de pegarlo?","error":"No ha sido posible limpiar los datos debido a un error interno","title":"Pegar desde Word","toolbar":"Pegar desde Word"},"removeformat":{"toolbar":"Eliminar Formato"},"sourcearea":{"toolbar":"Fuente HTML"},"specialchar":{"options":"Opciones de caracteres especiales","title":"Seleccione un caracter especial","toolbar":"Insertar Caracter Especial"},"scayt":{"btn_about":"Acerca de Corrector","btn_dictionaries":"Diccionarios","btn_disable":"Desactivar Corrector","btn_enable":"Activar Corrector","btn_langs":"Idiomas","btn_options":"Opciones","text_title":"Comprobar Ortografía Mientras Escribe"},"stylescombo":{"label":"Estilo","panelTitle":"Estilos para formatear","panelTitle1":"Estilos de párrafo","panelTitle2":"Estilos de carácter","panelTitle3":"Estilos de objeto"},"table":{"border":"Tamaño de Borde","caption":"Título","cell":{"menu":"Celda","insertBefore":"Insertar celda a la izquierda","insertAfter":"Insertar celda a la derecha","deleteCell":"Eliminar Celdas","merge":"Combinar Celdas","mergeRight":"Combinar a la derecha","mergeDown":"Combinar hacia abajo","splitHorizontal":"Dividir la celda horizontalmente","splitVertical":"Dividir la celda verticalmente","title":"Propiedades de celda","cellType":"Tipo de Celda","rowSpan":"Expandir filas","colSpan":"Expandir columnas","wordWrap":"Ajustar al contenido","hAlign":"Alineación Horizontal","vAlign":"Alineación Vertical","alignBaseline":"Linea de base","bgColor":"Color de fondo","borderColor":"Color de borde","data":"Datos","header":"Encabezado","yes":"Sí","no":"No","invalidWidth":"La anchura de celda debe ser un número.","invalidHeight":"La altura de celda debe ser un número.","invalidRowSpan":"La expansión de filas debe ser un número entero.","invalidColSpan":"La expansión de columnas debe ser un número entero.","chooseColor":"Elegir"},"cellPad":"Esp. interior","cellSpace":"Esp. e/celdas","column":{"menu":"Columna","insertBefore":"Insertar columna a la izquierda","insertAfter":"Insertar columna a la derecha","deleteColumn":"Eliminar Columnas"},"columns":"Columnas","deleteTable":"Eliminar Tabla","headers":"Encabezados","headersBoth":"Ambas","headersColumn":"Primera columna","headersNone":"Ninguno","headersRow":"Primera fila","invalidBorder":"El tamaño del borde debe ser un número.","invalidCellPadding":"El espaciado interior debe ser un número.","invalidCellSpacing":"El espaciado entre celdas debe ser un número.","invalidCols":"El número de columnas debe ser un número mayor que 0.","invalidHeight":"La altura de tabla debe ser un número.","invalidRows":"El número de filas debe ser un número mayor que 0.","invalidWidth":"La anchura de tabla debe ser un número.","menu":"Propiedades de Tabla","row":{"menu":"Fila","insertBefore":"Insertar fila en la parte superior","insertAfter":"Insertar fila en la parte inferior","deleteRow":"Eliminar Filas"},"rows":"Filas","summary":"Síntesis","title":"Propiedades de Tabla","toolbar":"Tabla","widthPc":"porcentaje","widthPx":"pixeles","widthUnit":"unidad de la anchura"},"undo":{"redo":"Rehacer","undo":"Deshacer"},"wsc":{"btnIgnore":"Ignorar","btnIgnoreAll":"Ignorar Todo","btnReplace":"Reemplazar","btnReplaceAll":"Reemplazar Todo","btnUndo":"Deshacer","changeTo":"Cambiar a","errorLoading":"Error cargando la aplicación del servidor: %s.","ieSpellDownload":"Módulo de Control de Ortografía no instalado.\r\n¿Desea descargarlo ahora?","manyChanges":"Control finalizado: se ha cambiado %1 palabras","noChanges":"Control finalizado: no se ha cambiado ninguna palabra","noMispell":"Control finalizado: no se encontraron errores","noSuggestions":"- No hay sugerencias -","notAvailable":"Lo sentimos pero el servicio no está disponible.","notInDic":"No se encuentra en el Diccionario","oneChange":"Control finalizado: se ha cambiado una palabra","progress":"Control de Ortografía en progreso...","title":"Comprobar ortografía","toolbar":"Ortografía"}};
phult/centery-dashboard
assets/plugins/ckeditor/lang/es.js
JavaScript
mit
12,302
"use strict";angular.module("ngLocale",[],["$provide",function(a){var d={ZERO:"zero",ONE:"one",TWO:"two",FEW:"few",MANY:"many",OTHER:"other"};function c(f){f=f+"";var e=f.indexOf(".");return(e==-1)?0:f.length-e-1}function b(j,e){var g=e;if(undefined===g){g=Math.min(c(j),3)}var i=Math.pow(10,g);var h=((j*i)|0)%i;return{v:g,f:h}}a.value("$locale",{DATETIME_FORMATS:{AMPMS:["AM","PM"],DAY:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],ERANAMES:["Before Christ","Anno Domini"],ERAS:["BC","AD"],FIRSTDAYOFWEEK:0,MONTH:["January","February","March","April","May","June","July","August","September","October","November","December"],SHORTDAY:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],SHORTMONTH:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],WEEKENDRANGE:[5,6],fullDate:"EEEE, y MMMM dd",longDate:"y MMMM d",medium:"y MMM d HH:mm:ss",mediumDate:"y MMM d",mediumTime:"HH:mm:ss","short":"yyyy-MM-dd HH:mm",shortDate:"yyyy-MM-dd",shortTime:"HH:mm"},NUMBER_FORMATS:{CURRENCY_SYM:"$",DECIMAL_SEP:".",GROUP_SEP:",",PATTERNS:[{gSize:3,lgSize:3,maxFrac:3,minFrac:0,minInt:1,negPre:"-",negSuf:"",posPre:"",posSuf:""},{gSize:3,lgSize:3,maxFrac:2,minFrac:2,minInt:1,negPre:"-\u00a4",negSuf:"",posPre:"\u00a4",posSuf:""}]},id:"en-iso",pluralCat:function(h,f){var g=h|0;var e=b(h,f);if(g==1&&e.v==0){return d.ONE}return d.OTHER}})}]);
x112358/cdnjs
ajax/libs/angular-i18n/1.5.0-beta.0/angular-locale_en-iso.min.js
JavaScript
mit
1,371
YUI.add('node-base', function (Y, NAME) { /** * @module node * @submodule node-base */ var methods = [ /** * Determines whether each node has the given className. * @method hasClass * @for Node * @param {String} className the class name to search for * @return {Boolean} Whether or not the element has the specified class */ 'hasClass', /** * Adds a class name to each node. * @method addClass * @param {String} className the class name to add to the node's class attribute * @chainable */ 'addClass', /** * Removes a class name from each node. * @method removeClass * @param {String} className the class name to remove from the node's class attribute * @chainable */ 'removeClass', /** * Replace a class with another class for each node. * If no oldClassName is present, the newClassName is simply added. * @method replaceClass * @param {String} oldClassName the class name to be replaced * @param {String} newClassName the class name that will be replacing the old class name * @chainable */ 'replaceClass', /** * If the className exists on the node it is removed, if it doesn't exist it is added. * @method toggleClass * @param {String} className the class name to be toggled * @param {Boolean} force Option to force adding or removing the class. * @chainable */ 'toggleClass' ]; Y.Node.importMethod(Y.DOM, methods); /** * Determines whether each node has the given className. * @method hasClass * @see Node.hasClass * @for NodeList * @param {String} className the class name to search for * @return {Array} An array of booleans for each node bound to the NodeList. */ /** * Adds a class name to each node. * @method addClass * @see Node.addClass * @param {String} className the class name to add to the node's class attribute * @chainable */ /** * Removes a class name from each node. * @method removeClass * @see Node.removeClass * @param {String} className the class name to remove from the node's class attribute * @chainable */ /** * Replace a class with another class for each node. * If no oldClassName is present, the newClassName is simply added. * @method replaceClass * @see Node.replaceClass * @param {String} oldClassName the class name to be replaced * @param {String} newClassName the class name that will be replacing the old class name * @chainable */ /** * If the className exists on the node it is removed, if it doesn't exist it is added. * @method toggleClass * @see Node.toggleClass * @param {String} className the class name to be toggled * @chainable */ Y.NodeList.importMethod(Y.Node.prototype, methods); /** * @module node * @submodule node-base */ var Y_Node = Y.Node, Y_DOM = Y.DOM; /** * Returns a new dom node using the provided markup string. * @method create * @static * @param {String} html The markup used to create the element * Use <a href="../classes/Escape.html#method_html">`Y.Escape.html()`</a> * to escape html content. * @param {HTMLDocument} doc An optional document context * @return {Node} A Node instance bound to a DOM node or fragment * @for Node */ Y_Node.create = function(html, doc) { if (doc && doc._node) { doc = doc._node; } return Y.one(Y_DOM.create(html, doc)); }; Y.mix(Y_Node.prototype, { /** * Creates a new Node using the provided markup string. * @method create * @param {String} html The markup used to create the element. * Use <a href="../classes/Escape.html#method_html">`Y.Escape.html()`</a> * to escape html content. * @param {HTMLDocument} doc An optional document context * @return {Node} A Node instance bound to a DOM node or fragment */ create: Y_Node.create, /** * Inserts the content before the reference node. * @method insert * @param {String | Node | HTMLElement | NodeList | HTMLCollection} content The content to insert * Use <a href="../classes/Escape.html#method_html">`Y.Escape.html()`</a> * to escape html content. * @param {Int | Node | HTMLElement | String} where The position to insert at. * Possible "where" arguments * <dl> * <dt>Y.Node</dt> * <dd>The Node to insert before</dd> * <dt>HTMLElement</dt> * <dd>The element to insert before</dd> * <dt>Int</dt> * <dd>The index of the child element to insert before</dd> * <dt>"replace"</dt> * <dd>Replaces the existing HTML</dd> * <dt>"before"</dt> * <dd>Inserts before the existing HTML</dd> * <dt>"before"</dt> * <dd>Inserts content before the node</dd> * <dt>"after"</dt> * <dd>Inserts content after the node</dd> * </dl> * @chainable */ insert: function(content, where) { this._insert(content, where); return this; }, _insert: function(content, where) { var node = this._node, ret = null; if (typeof where == 'number') { // allow index where = this._node.childNodes[where]; } else if (where && where._node) { // Node where = where._node; } if (content && typeof content != 'string') { // allow Node or NodeList/Array instances content = content._node || content._nodes || content; } ret = Y_DOM.addHTML(node, content, where); return ret; }, /** * Inserts the content as the firstChild of the node. * @method prepend * @param {String | Node | HTMLElement} content The content to insert * Use <a href="../classes/Escape.html#method_html">`Y.Escape.html()`</a> * to escape html content. * @chainable */ prepend: function(content) { return this.insert(content, 0); }, /** * Inserts the content as the lastChild of the node. * @method append * @param {String | Node | HTMLElement} content The content to insert * Use <a href="../classes/Escape.html#method_html">`Y.Escape.html()`</a> * to escape html content. * @chainable */ append: function(content) { return this.insert(content, null); }, /** * @method appendChild * @param {String | HTMLElement | Node} node Node to be appended * Use <a href="../classes/Escape.html#method_html">`Y.Escape.html()`</a> * to escape html content. * @return {Node} The appended node */ appendChild: function(node) { return Y_Node.scrubVal(this._insert(node)); }, /** * @method insertBefore * @param {String | HTMLElement | Node} newNode Node to be appended * @param {HTMLElement | Node} refNode Node to be inserted before * Use <a href="../classes/Escape.html#method_html">`Y.Escape.html()`</a> * to escape html content. * @return {Node} The inserted node */ insertBefore: function(newNode, refNode) { return Y.Node.scrubVal(this._insert(newNode, refNode)); }, /** * Appends the node to the given node. * @method appendTo * @param {Node | HTMLElement} node The node to append to * @chainable */ appendTo: function(node) { Y.one(node).append(this); return this; }, // This method is deprecated, and is intentionally left undocumented. // Use `setHTML` instead. setContent: function(content) { this._insert(content, 'replace'); return this; }, // This method is deprecated, and is intentionally left undocumented. // Use `getHTML` instead. getContent: function() { var node = this; if (node._node.nodeType === 11) { // 11 === Node.DOCUMENT_FRAGMENT_NODE // "this", when it is a document fragment, must be cloned because // the nodes contained in the fragment actually disappear once // the fragment is appended anywhere node = node.create("<div/>").append(node.cloneNode(true)); } return node.get("innerHTML"); } }); /** * Replaces the node's current html content with the content provided. * Note that this passes to innerHTML and is not escaped. * Use <a href="../classes/Escape.html#method_html">`Y.Escape.html()`</a> * to escape html content or `set('text')` to add as text. * @method setHTML * @param {String | HTML | Node | HTMLElement | NodeList | HTMLCollection} content The content to insert * @chainable */ Y.Node.prototype.setHTML = Y.Node.prototype.setContent; /** * Returns the node's current html content (e.g. innerHTML) * @method getHTML * @return {String} The html content */ Y.Node.prototype.getHTML = Y.Node.prototype.getContent; Y.NodeList.importMethod(Y.Node.prototype, [ /** * Called on each Node instance * @for NodeList * @method append * @see Node.append */ 'append', /** * Called on each Node instance * @for NodeList * @method insert * @see Node.insert */ 'insert', /** * Called on each Node instance * @for NodeList * @method appendChild * @see Node.appendChild */ 'appendChild', /** * Called on each Node instance * @for NodeList * @method insertBefore * @see Node.insertBefore */ 'insertBefore', /** * Called on each Node instance * @for NodeList * @method prepend * @see Node.prepend */ 'prepend', 'setContent', 'getContent', /** * Called on each Node instance * Note that this passes to innerHTML and is not escaped. * Use <a href="../classes/Escape.html#method_html">`Y.Escape.html()`</a> * to escape html content or `set('text')` to add as text. * @for NodeList * @method setHTML * @see Node.setHTML */ 'setHTML', /** * Called on each Node instance * @for NodeList * @method getHTML * @see Node.getHTML */ 'getHTML' ]); /** * @module node * @submodule node-base */ var Y_Node = Y.Node, Y_DOM = Y.DOM; /** * Static collection of configuration attributes for special handling * @property ATTRS * @static * @type object */ Y_Node.ATTRS = { /** * Allows for getting and setting the text of an element. * Formatting is preserved and special characters are treated literally. * @config text * @type String */ text: { getter: function() { return Y_DOM.getText(this._node); }, setter: function(content) { Y_DOM.setText(this._node, content); return content; } }, /** * Allows for getting and setting the text of an element. * Formatting is preserved and special characters are treated literally. * @config for * @type String */ 'for': { getter: function() { return Y_DOM.getAttribute(this._node, 'for'); }, setter: function(val) { Y_DOM.setAttribute(this._node, 'for', val); return val; } }, 'options': { getter: function() { return this._node.getElementsByTagName('option'); } }, /** * Returns a NodeList instance of all HTMLElement children. * @readOnly * @config children * @type NodeList */ 'children': { getter: function() { var node = this._node, children = node.children, childNodes, i, len; if (!children) { childNodes = node.childNodes; children = []; for (i = 0, len = childNodes.length; i < len; ++i) { if (childNodes[i].tagName) { children[children.length] = childNodes[i]; } } } return Y.all(children); } }, value: { getter: function() { return Y_DOM.getValue(this._node); }, setter: function(val) { Y_DOM.setValue(this._node, val); return val; } } }; Y.Node.importMethod(Y.DOM, [ /** * Allows setting attributes on DOM nodes, normalizing in some cases. * This passes through to the DOM node, allowing for custom attributes. * @method setAttribute * @for Node * @for NodeList * @chainable * @param {string} name The attribute name * @param {string} value The value to set */ 'setAttribute', /** * Allows getting attributes on DOM nodes, normalizing in some cases. * This passes through to the DOM node, allowing for custom attributes. * @method getAttribute * @for Node * @for NodeList * @param {string} name The attribute name * @return {string} The attribute value */ 'getAttribute' ]); /** * @module node * @submodule node-base */ var Y_Node = Y.Node; var Y_NodeList = Y.NodeList; /** * List of events that route to DOM events * @static * @property DOM_EVENTS * @for Node */ Y_Node.DOM_EVENTS = { abort: 1, beforeunload: 1, blur: 1, change: 1, click: 1, close: 1, command: 1, contextmenu: 1, dblclick: 1, DOMMouseScroll: 1, drag: 1, dragstart: 1, dragenter: 1, dragover: 1, dragleave: 1, dragend: 1, drop: 1, error: 1, focus: 1, key: 1, keydown: 1, keypress: 1, keyup: 1, load: 1, message: 1, mousedown: 1, mouseenter: 1, mouseleave: 1, mousemove: 1, mousemultiwheel: 1, mouseout: 1, mouseover: 1, mouseup: 1, mousewheel: 1, orientationchange: 1, reset: 1, resize: 1, select: 1, selectstart: 1, submit: 1, scroll: 1, textInput: 1, unload: 1 }; // Add custom event adaptors to this list. This will make it so // that delegate, key, available, contentready, etc all will // be available through Node.on Y.mix(Y_Node.DOM_EVENTS, Y.Env.evt.plugins); Y.augment(Y_Node, Y.EventTarget); Y.mix(Y_Node.prototype, { /** * Removes event listeners from the node and (optionally) its subtree * @method purge * @param {Boolean} recurse (optional) Whether or not to remove listeners from the * node's subtree * @param {String} type (optional) Only remove listeners of the specified type * @chainable * */ purge: function(recurse, type) { Y.Event.purgeElement(this._node, recurse, type); return this; } }); Y.mix(Y.NodeList.prototype, { _prepEvtArgs: function(type, fn, context) { // map to Y.on/after signature (type, fn, nodes, context, arg1, arg2, etc) var args = Y.Array(arguments, 0, true); if (args.length < 2) { // type only (event hash) just add nodes args[2] = this._nodes; } else { args.splice(2, 0, this._nodes); } args[3] = context || this; // default to NodeList instance as context return args; }, /** Subscribe a callback function for each `Node` in the collection to execute in response to a DOM event. NOTE: Generally, the `on()` method should be avoided on `NodeLists`, in favor of using event delegation from a parent Node. See the Event user guide for details. Most DOM events are associated with a preventable default behavior, such as link clicks navigating to a new page. Callbacks are passed a `DOMEventFacade` object as their first argument (usually called `e`) that can be used to prevent this default behavior with `e.preventDefault()`. See the `DOMEventFacade` API for all available properties and methods on the object. By default, the `this` object will be the `NodeList` that the subscription came from, <em>not the `Node` that received the event</em>. Use `e.currentTarget` to refer to the `Node`. Returning `false` from a callback is supported as an alternative to calling `e.preventDefault(); e.stopPropagation();`. However, it is recommended to use the event methods. @example Y.all(".sku").on("keydown", function (e) { if (e.keyCode === 13) { e.preventDefault(); // Use e.currentTarget to refer to the individual Node var item = Y.MyApp.searchInventory( e.currentTarget.get('value') ); // etc ... } }); @method on @param {String} type The name of the event @param {Function} fn The callback to execute in response to the event @param {Object} [context] Override `this` object in callback @param {Any} [arg*] 0..n additional arguments to supply to the subscriber @return {EventHandle} A subscription handle capable of detaching that subscription @for NodeList **/ on: function(type, fn, context) { return Y.on.apply(Y, this._prepEvtArgs.apply(this, arguments)); }, /** * Applies an one-time event listener to each Node bound to the NodeList. * @method once * @param {String} type The event being listened for * @param {Function} fn The handler to call when the event fires * @param {Object} context The context to call the handler with. * Default is the NodeList instance. * @return {EventHandle} A subscription handle capable of detaching that * subscription * @for NodeList */ once: function(type, fn, context) { return Y.once.apply(Y, this._prepEvtArgs.apply(this, arguments)); }, /** * Applies an event listener to each Node bound to the NodeList. * The handler is called only after all on() handlers are called * and the event is not prevented. * @method after * @param {String} type The event being listened for * @param {Function} fn The handler to call when the event fires * @param {Object} context The context to call the handler with. * Default is the NodeList instance. * @return {EventHandle} A subscription handle capable of detaching that * subscription * @for NodeList */ after: function(type, fn, context) { return Y.after.apply(Y, this._prepEvtArgs.apply(this, arguments)); }, /** * Applies an one-time event listener to each Node bound to the NodeList * that will be called only after all on() handlers are called and the * event is not prevented. * * @method onceAfter * @param {String} type The event being listened for * @param {Function} fn The handler to call when the event fires * @param {Object} context The context to call the handler with. * Default is the NodeList instance. * @return {EventHandle} A subscription handle capable of detaching that * subscription * @for NodeList */ onceAfter: function(type, fn, context) { return Y.onceAfter.apply(Y, this._prepEvtArgs.apply(this, arguments)); } }); Y_NodeList.importMethod(Y.Node.prototype, [ /** * Called on each Node instance * @method detach * @see Node.detach * @for NodeList */ 'detach', /** Called on each Node instance * @method detachAll * @see Node.detachAll * @for NodeList */ 'detachAll' ]); /** Subscribe a callback function to execute in response to a DOM event or custom event. Most DOM events are associated with a preventable default behavior such as link clicks navigating to a new page. Callbacks are passed a `DOMEventFacade` object as their first argument (usually called `e`) that can be used to prevent this default behavior with `e.preventDefault()`. See the `DOMEventFacade` API for all available properties and methods on the object. If the event name passed as the first parameter is not a whitelisted DOM event, it will be treated as a custom event subscriptions, allowing `node.fire('customEventName')` later in the code. Refer to the Event user guide for the full DOM event whitelist. By default, the `this` object in the callback will refer to the subscribed `Node`. Returning `false` from a callback is supported as an alternative to calling `e.preventDefault(); e.stopPropagation();`. However, it is recommended to use the event methods. @example Y.one("#my-form").on("submit", function (e) { e.preventDefault(); // proceed with ajax form submission instead... }); @method on @param {String} type The name of the event @param {Function} fn The callback to execute in response to the event @param {Object} [context] Override `this` object in callback @param {Any} [arg*] 0..n additional arguments to supply to the subscriber @return {EventHandle} A subscription handle capable of detaching that subscription @for Node **/ Y.mix(Y.Node.ATTRS, { offsetHeight: { setter: function(h) { Y.DOM.setHeight(this._node, h); return h; }, getter: function() { return this._node.offsetHeight; } }, offsetWidth: { setter: function(w) { Y.DOM.setWidth(this._node, w); return w; }, getter: function() { return this._node.offsetWidth; } } }); Y.mix(Y.Node.prototype, { sizeTo: function(w, h) { var node; if (arguments.length < 2) { node = Y.one(w); w = node.get('offsetWidth'); h = node.get('offsetHeight'); } this.setAttrs({ offsetWidth: w, offsetHeight: h }); } }); if (!Y.config.doc.documentElement.hasAttribute) { // IE < 8 Y.Node.prototype.hasAttribute = function(attr) { if (attr === 'value') { if (this.get('value') !== "") { // IE < 8 fails to populate specified when set in HTML return true; } } return !!(this._node.attributes[attr] && this._node.attributes[attr].specified); }; } // IE throws an error when calling focus() on an element that's invisible, not // displayed, or disabled. Y.Node.prototype.focus = function () { try { this._node.focus(); } catch (e) { Y.log('error focusing node: ' + e.toString(), 'error', 'node'); } return this; }; // IE throws error when setting input.type = 'hidden', // input.setAttribute('type', 'hidden') and input.attributes.type.value = 'hidden' Y.Node.ATTRS.type = { setter: function(val) { if (val === 'hidden') { try { this._node.type = 'hidden'; } catch(e) { this._node.style.display = 'none'; this._inputType = 'hidden'; } } else { try { // IE errors when changing the type from "hidden' this._node.type = val; } catch (e) { Y.log('error setting type: ' + val, 'info', 'node'); } } return val; }, getter: function() { return this._inputType || this._node.type; }, _bypassProxy: true // don't update DOM when using with Attribute }; if (Y.config.doc.createElement('form').elements.nodeType) { // IE: elements collection is also FORM node which trips up scrubVal. Y.Node.ATTRS.elements = { getter: function() { return this.all('input, textarea, button, select'); } }; } /** * Provides methods for managing custom Node data. * * @module node * @main node * @submodule node-data */ Y.mix(Y.Node.prototype, { _initData: function() { if (! ('_data' in this)) { this._data = {}; } }, /** * @method getData * @for Node * @description Retrieves arbitrary data stored on a Node instance. * If no data is associated with the Node, it will attempt to retrieve * a value from the corresponding HTML data attribute. (e.g. node.getData('foo') * will check node.getAttribute('data-foo')). * @param {string} name Optional name of the data field to retrieve. * If no name is given, all data is returned. * @return {any | Object} Whatever is stored at the given field, * or an object hash of all fields. */ getData: function(name) { this._initData(); var data = this._data, ret = data; if (arguments.length) { // single field if (name in data) { ret = data[name]; } else { // initialize from HTML attribute ret = this._getDataAttribute(name); } } else if (typeof data == 'object' && data !== null) { // all fields ret = {}; Y.Object.each(data, function(v, n) { ret[n] = v; }); ret = this._getDataAttributes(ret); } return ret; }, _getDataAttributes: function(ret) { ret = ret || {}; var i = 0, attrs = this._node.attributes, len = attrs.length, prefix = this.DATA_PREFIX, prefixLength = prefix.length, name; while (i < len) { name = attrs[i].name; if (name.indexOf(prefix) === 0) { name = name.substr(prefixLength); if (!(name in ret)) { // only merge if not already stored ret[name] = this._getDataAttribute(name); } } i += 1; } return ret; }, _getDataAttribute: function(name) { name = this.DATA_PREFIX + name; var node = this._node, attrs = node.attributes, data = attrs && attrs[name] && attrs[name].value; return data; }, /** * @method setData * @for Node * @description Stores arbitrary data on a Node instance. * This is not stored with the DOM node. * @param {string} name The name of the field to set. If no val * is given, name is treated as the data and overrides any existing data. * @param {any} val The value to be assigned to the field. * @chainable */ setData: function(name, val) { this._initData(); if (arguments.length > 1) { this._data[name] = val; } else { this._data = name; } return this; }, /** * @method clearData * @for Node * @description Clears internally stored data. * @param {string} name The name of the field to clear. If no name * is given, all data is cleared. * @chainable */ clearData: function(name) { if ('_data' in this) { if (typeof name != 'undefined') { delete this._data[name]; } else { delete this._data; } } return this; } }); Y.mix(Y.NodeList.prototype, { /** * @method getData * @for NodeList * @description Retrieves arbitrary data stored on each Node instance * bound to the NodeList. * @see Node * @param {string} name Optional name of the data field to retrieve. * If no name is given, all data is returned. * @return {Array} An array containing all of the data for each Node instance. * or an object hash of all fields. */ getData: function(name) { var args = (arguments.length) ? [name] : []; return this._invoke('getData', args, true); }, /** * @method setData * @for NodeList * @description Stores arbitrary data on each Node instance bound to the * NodeList. This is not stored with the DOM node. * @param {string} name The name of the field to set. If no name * is given, name is treated as the data and overrides any existing data. * @param {any} val The value to be assigned to the field. * @chainable */ setData: function(name, val) { var args = (arguments.length > 1) ? [name, val] : [name]; return this._invoke('setData', args); }, /** * @method clearData * @for NodeList * @description Clears data on all Node instances bound to the NodeList. * @param {string} name The name of the field to clear. If no name * is given, all data is cleared. * @chainable */ clearData: function(name) { var args = (arguments.length) ? [name] : []; return this._invoke('clearData', [name]); } }); }, '@VERSION@', {"requires": ["event-base", "node-core", "dom-base", "dom-style"]});
calvinf/cdnjs
ajax/libs/yui/3.13.0/node-base/node-base-debug.js
JavaScript
mit
28,451
YUI.add("imageloader",function(B){B.ImgLoadGroup=function(){this._init();B.ImgLoadGroup.superclass.constructor.apply(this,arguments);};B.ImgLoadGroup.NAME="imgLoadGroup";B.ImgLoadGroup.ATTRS={name:{value:""},timeLimit:{value:null},foldDistance:{validator:B.Lang.isNumber,setter:function(D){this._setFoldTriggers();return D;},lazyAdd:false},className:{value:null,setter:function(D){this._className=D;return D;},lazyAdd:false}};var C={_init:function(){this._triggers=[];this._imgObjs={};this._timeout=null;this._classImageEls=null;this._className=null;this._areFoldTriggersSet=false;this._maxKnownHLimit=0;B.on("domready",this._onloadTasks,this);},addTrigger:function(F,E){if(!F||!E){return this;}var D=function(){this.fetch();};this._triggers.push(B.on(E,D,F,this));return this;},addCustomTrigger:function(D,F){if(!D){return this;}var E=function(){this.fetch();};if(B.Lang.isUndefined(F)){this._triggers.push(B.on(D,E,this));}else{this._triggers.push(F.on(D,E,this));}return this;},_setFoldTriggers:function(){if(this._areFoldTriggersSet){return;}var D=function(){this._foldCheck();};this._triggers.push(B.on("scroll",D,window,this));this._triggers.push(B.on("resize",D,window,this));this._areFoldTriggersSet=true;},_onloadTasks:function(){var D=this.get("timeLimit");if(D&&D>0){this._timeout=setTimeout(this._getFetchTimeout(),D*1000);}if(!B.Lang.isUndefined(this.get("foldDistance"))){this._foldCheck();}},_getFetchTimeout:function(){var D=this;return function(){D.fetch();};},registerImage:function(){var D=arguments[0].domId;if(!D){return null;}this._imgObjs[D]=new B.ImgLoadImgObj(arguments[0]);return this._imgObjs[D];},fetch:function(){this._clearTriggers();this._fetchByClass();for(var D in this._imgObjs){if(this._imgObjs.hasOwnProperty(D)){this._imgObjs[D].fetch();}}},_clearTriggers:function(){clearTimeout(this._timeout);for(var E=0,D=this._triggers.length;E<D;E++){this._triggers[E].detach();}},_foldCheck:function(){var I=true,J=B.DOM.viewportRegion(),H=J.bottom+this.get("foldDistance"),K,E,G,F,D;if(H<=this._maxKnownHLimit){return;}this._maxKnownHLimit=H;for(K in this._imgObjs){if(this._imgObjs.hasOwnProperty(K)){E=this._imgObjs[K].fetch(H);I=I&&E;}}if(this._className){if(this._classImageEls===null){this._classImageEls=[];G=B.all("."+this._className);G.each(function(L){this._classImageEls.push({el:L,y:L.getY(),fetched:false});},this);}G=this._classImageEls;for(F=0,D=G.length;F<D;F++){if(G[F].fetched){continue;}if(G[F].y&&G[F].y<=H){G[F].el.removeClass(this._className);G[F].fetched=true;}else{I=false;}}}if(I){this._clearTriggers();}},_fetchByClass:function(){if(!this._className){return;}B.all("."+this._className).removeClass(this._className);}};B.extend(B.ImgLoadGroup,B.Base,C);B.ImgLoadImgObj=function(){B.ImgLoadImgObj.superclass.constructor.apply(this,arguments);this._init();};B.ImgLoadImgObj.NAME="imgLoadImgObj";B.ImgLoadImgObj.ATTRS={domId:{value:null,writeOnce:true},bgUrl:{value:null},srcUrl:{value:null},width:{value:null},height:{value:null},setVisible:{value:false},isPng:{value:false},sizingMethod:{value:"scale"},enabled:{value:"true"}};var A={_init:function(){this._fetched=false;this._imgEl=null;this._yPos=null;},fetch:function(F){if(this._fetched){return true;}var D=this._getImgEl(),E;if(!D){return false;}if(F){E=this._getYPos();if(!E||E>F){return false;}}if(this.get("bgUrl")!==null){if(this.get("isPng")&&B.UA.ie&&B.UA.ie<=6){D.setStyle("filter",'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+this.get("url")+'", sizingMethod="'+this.get("sizingMethod")+'", enabled="'+this.get("enabled")+'")');}else{D.setStyle("backgroundImage","url('"+this.get("bgUrl")+"')");}}else{if(this.get("srcUrl")!==null){D.setAttribute("src",this.get("srcUrl"));}}if(this.get("setVisible")){D.setStyle("visibility","visible");}if(this.get("width")){D.setAttribute("width",this.get("width"));}if(this.get("height")){D.setAttribute("height",this.get("height"));}this._fetched=true;return true;},_getImgEl:function(){if(this._imgEl===null){this._imgEl=B.get("#"+this.get("domId"));}return this._imgEl;},_getYPos:function(){if(this._yPos===null){this._yPos=this._getImgEl().getY();}return this._yPos;}};B.extend(B.ImgLoadImgObj,B.Base,A);},"@VERSION@",{requires:["base-base","node-style","node-screen"]});
peteygao/cdnjs
ajax/libs/yui/3.0.0/imageloader/imageloader-min.js
JavaScript
mit
4,240
YUI.add("editor-base",function(e,t){var n=function(){n.superclass.constructor.apply(this,arguments)},r=":last-child",i="body";e.extend(n,e.Base,{frame:null,initializer:function(){var t=(new e.Frame({designMode:!0,title:n.STRINGS.title,use:n.USE,dir:this.get("dir"),extracss:this.get("extracss"),linkedcss:this.get("linkedcss"),defaultblock:this.get("defaultblock"),host:this})).plug(e.Plugin.ExecCommand);t.after("ready",e.bind(this._afterFrameReady,this)),t.addTarget(this),this.frame=t,this.publish("nodeChange",{emitFacade:!0,bubbles:!0,defaultFn:this._defNodeChangeFn})},destructor:function(){this.frame.destroy(),this.detachAll()},copyStyles:function(t,n){if(t.test("a"))return;var r=["color","fontSize","fontFamily","backgroundColor","fontStyle"],i={};e.each(r,function(e){i[e]=t.getStyle(e)}),t.ancestor("b,strong")&&(i.fontWeight="bold"),t.ancestor("u")&&(i.textDecoration||(i.textDecoration="underline")),n.setStyles(i)},_lastBookmark:null,_resolveChangedNode:function(e){var t=this.getInstance(),n,s,o,u;e&&e.test(i)&&(u=new t.EditorSelection,u&&u.anchorNode&&(e=u.anchorNode));if(t&&e&&e.test("html")){n=t.one(i).one(r);while(!o)n?(s=n.one(r),s?n=s:o=!0):o=!0;n&&(n.test("br")&&(n.previous()?n=n.previous():n=n.get("parentNode")),n&&(e=n))}return e||(e=t.one(i)),e},_defNodeChangeFn:function(t){var r=(new Date).getTime(),i=this.getInstance(),s,o,u,a={},f,l,c=[],h="",p="",d,v=!1;if(e.UA.ie)try{s=i.config.doc.selection.createRange(),s.getBookmark&&(this._lastBookmark=s.getBookmark())}catch(m){}t.changedNode=this._resolveChangedNode(t.changedNode);switch(t.changedType){case"tab":!t.changedNode.test("li, li *")&&!t.changedEvent.shiftKey&&(t.changedEvent.frameEvent.preventDefault(),e.UA.webkit?this.execCommand("inserttext"," "):e.UA.gecko?this.frame.exec._command("inserthtml",n.TABKEY):e.UA.ie&&this.execCommand("inserthtml",n.TABKEY));break;case"backspace-up":e.UA.webkit&&t.changedNode&&t.changedNode.set("innerHTML",t.changedNode.get("innerHTML"))}e.UA.webkit&&t.commands&&(t.commands.indent||t.commands.outdent)&&(d=i.all(".webkit-indent-blockquote, blockquote"),d.size()&&d.setStyle("margin","")),o=this.getDomPath(t.changedNode,!1),t.commands&&(a=t.commands),e.each(o,function(t){var r=t.tagName.toLowerCase(),s=n.TAG2CMD[r],o,u,d,m,g;s&&(a[s]=1),o=t.currentStyle||t.style,""+o.fontWeight=="normal"&&(v=!0),""+o.fontWeight=="bold"&&(a.bold=1),e.UA.ie&&o.fontWeight>400&&(a.bold=1),o.fontStyle==="italic"&&(a.italic=1),o.textDecoration.indexOf("underline")>-1&&(a.underline=1),o.textDecoration.indexOf("line-through")>-1&&(a.strikethrough=1),u=i.one(t),u.getStyle("fontFamily")&&(d=u.getStyle("fontFamily").split(",")[0].toLowerCase(),d&&(f=d),f&&(f=f.replace(/'/g,"").replace(/"/g,""))),l=n.NORMALIZE_FONTSIZE(u),m=t.className.split(" "),e.each(m,function(e){e!==""&&e.substr(0,4)!=="yui_"&&c.push(e)}),h=n.FILTER_RGB(u.getStyle("color")),g=n.FILTER_RGB(o.backgroundColor),g!=="transparent"&&g!==""&&(p=g)}),v&&(delete a.bold,delete a.italic),t.dompath=i.all(o),t.classNames=c,t.commands=a,t.fontFamily||(t.fontFamily=f),t.fontSize||(t.fontSize=l),t.fontColor||(t.fontColor=h),t.backgroundColor||(t.backgroundColor=p),u=(new Date).getTime()},getDomPath:function(e,t){var n=[],r,i=this.frame.getInstance();r=i.Node.getDOMNode(e);while(r!==null){if(r===i.config.doc.documentElement||r===i.config.doc||!r.tagName){r=null;break}if(!i.DOM.inDoc(r)){r=null;break}r.nodeName&&r.nodeType&&r.nodeType===1&&n.push(r);if(r===i.config.doc.body){r=null;break}r=r.parentNode}return n.length===0&&(n[0]=i.config.doc.body),t?i.all(n.reverse()):n.reverse()},_afterFrameReady:function(){var t=this.frame.getInstance();this.frame.on("dom:mouseup",e.bind(this._onFrameMouseUp,this)),this.frame.on("dom:mousedown",e.bind(this._onFrameMouseDown,this)),this.frame.on("dom:keydown",e.bind(this._onFrameKeyDown,this)),e.UA.ie&&(this.frame.on("dom:activate",e.bind(this._onFrameActivate,this)),this.frame.on("dom:beforedeactivate",e.bind(this._beforeFrameDeactivate,this))),this.frame.on("dom:keyup",e.bind(this._onFrameKeyUp,this)),this.frame.on("dom:keypress",e.bind(this._onFrameKeyPress,this)),this.frame.on("dom:paste",e.bind(this._onPaste,this)),t.EditorSelection.filter(),this.fire("ready")},_beforeFrameDeactivate:function(e){if(e.frameTarget.test("html"))return;var t=this.getInstance(),n=t.config.doc.selection.createRange();n.compareEndPoints&&!n.compareEndPoints("StartToEnd",n)&&n.pasteHTML('<var id="yui-ie-cursor">')},_onFrameActivate:function(e){if(e.frameTarget.test("html"))return;var t=this.getInstance(),n=new t.EditorSelection,r=n.createRange(),i=t.all("#yui-ie-cursor");i.size()&&i.each(function(e){e.set("id","");if(r.moveToElementText)try{r.moveToElementText(e._node);var t=r.move("character",-1);t===-1&&r.move("character",1),r.select(),r.text=""}catch(n){}e.remove()})},_onPaste:function(e){this.fire("nodeChange",{changedNode:e.frameTarget,changedType:"paste",changedEvent:e.frameEvent})},_onFrameMouseUp:function(e){this.fire("nodeChange",{changedNode:e.frameTarget,changedType:"mouseup",changedEvent:e.frameEvent})},_onFrameMouseDown:function(e){this.fire("nodeChange",{changedNode:e.frameTarget,changedType:"mousedown",changedEvent:e.frameEvent})},_currentSelection:null,_currentSelectionTimer:null,_currentSelectionClear:null,_onFrameKeyDown:function(t){var r,i;this._currentSelection?i=this._currentSelection:(this._currentSelectionTimer&&this._currentSelectionTimer.cancel(),this._currentSelectionTimer=e.later(850,this,function(){this._currentSelectionClear=!0}),r=this.frame.getInstance(),i=new r.EditorSelection(t),this._currentSelection=i),r=this.frame.getInstance(),i=new r.EditorSelection,this._currentSelection=i,i&&i.anchorNode&&(this.fire("nodeChange",{changedNode:i.anchorNode,changedType:"keydown",changedEvent:t.frameEvent}),n.NC_KEYS[t.keyCode]&&(this.fire("nodeChange",{changedNode:i.anchorNode,changedType:n.NC_KEYS[t.keyCode],changedEvent:t.frameEvent}),this.fire("nodeChange",{changedNode:i.anchorNode,changedType:n.NC_KEYS[t.keyCode]+"-down",changedEvent :t.frameEvent})))},_onFrameKeyPress:function(e){var t=this._currentSelection;t&&t.anchorNode&&(this.fire("nodeChange",{changedNode:t.anchorNode,changedType:"keypress",changedEvent:e.frameEvent}),n.NC_KEYS[e.keyCode]&&this.fire("nodeChange",{changedNode:t.anchorNode,changedType:n.NC_KEYS[e.keyCode]+"-press",changedEvent:e.frameEvent}))},_onFrameKeyUp:function(e){var t=this.frame.getInstance(),r=new t.EditorSelection(e);r&&r.anchorNode&&(this.fire("nodeChange",{changedNode:r.anchorNode,changedType:"keyup",selection:r,changedEvent:e.frameEvent}),n.NC_KEYS[e.keyCode]&&this.fire("nodeChange",{changedNode:r.anchorNode,changedType:n.NC_KEYS[e.keyCode]+"-up",selection:r,changedEvent:e.frameEvent})),this._currentSelectionClear&&(this._currentSelectionClear=this._currentSelection=null)},execCommand:function(e,t){var n=this.frame.execCommand(e,t),r=this.frame.getInstance(),i=new r.EditorSelection,s={},o={changedNode:i.anchorNode,changedType:"execcommand",nodes:n};switch(e){case"forecolor":o.fontColor=t;break;case"backcolor":o.backgroundColor=t;break;case"fontsize":o.fontSize=t;break;case"fontname":o.fontFamily=t}return s[e]=1,o.commands=s,this.fire("nodeChange",o),n},getInstance:function(){return this.frame.getInstance()},render:function(e){return this.frame.set("content",this.get("content")),this.frame.render(e),this},focus:function(e){return this.frame.focus(e),this},show:function(){return this.frame.show(),this},hide:function(){return this.frame.hide(),this},getContent:function(){var e="",t=this.getInstance();return t&&t.EditorSelection&&(e=t.EditorSelection.unfilter()),e=e.replace(/ _yuid="([^>]*)"/g,""),e}},{NORMALIZE_FONTSIZE:function(e){var t=e.getStyle("fontSize"),n=t;switch(t){case"-webkit-xxx-large":t="48px";break;case"xx-large":t="32px";break;case"x-large":t="24px";break;case"large":t="18px";break;case"medium":t="16px";break;case"small":t="13px";break;case"x-small":t="10px"}return n!==t&&e.setStyle("fontSize",t),t},TABKEY:'<span class="tab">&nbsp;&nbsp;&nbsp;&nbsp;</span>',FILTER_RGB:function(e){if(e.toLowerCase().indexOf("rgb")!==-1){var t=new RegExp("(.*?)rgb\\s*?\\(\\s*?([0-9]+).*?,\\s*?([0-9]+).*?,\\s*?([0-9]+).*?\\)(.*?)","gi"),n=e.replace(t,"$1,$2,$3,$4,$5").split(","),r,i,s;n.length===5&&(r=parseInt(n[1],10).toString(16),i=parseInt(n[2],10).toString(16),s=parseInt(n[3],10).toString(16),r=r.length===1?"0"+r:r,i=i.length===1?"0"+i:i,s=s.length===1?"0"+s:s,e="#"+r+i+s)}return e},TAG2CMD:{b:"bold",strong:"bold",i:"italic",em:"italic",u:"underline",sup:"superscript",sub:"subscript",img:"insertimage",a:"createlink",ul:"insertunorderedlist",ol:"insertorderedlist"},NC_KEYS:{8:"backspace",9:"tab",13:"enter",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",46:"delete"},USE:["substitute","node","selector-css3","editor-selection","stylesheet"],NAME:"editorBase",STRINGS:{title:"Rich Text Editor"},ATTRS:{content:{value:'<br class="yui-cursor">',setter:function(t){return t.substr(0,1)==="\n"&&(t=t.substr(1)),t===""&&(t='<br class="yui-cursor">'),t===" "&&e.UA.gecko&&(t='<br class="yui-cursor">'),this.frame.set("content",t)},getter:function(){return this.frame.get("content")}},dir:{writeOnce:!0,value:"ltr"},linkedcss:{value:"",setter:function(e){return this.frame&&this.frame.set("linkedcss",e),e}},extracss:{value:!1,setter:function(e){return this.frame&&this.frame.set("extracss",e),e}},defaultblock:{value:"p"}}}),e.EditorBase=n},"@VERSION@",{requires:["base","frame","node","exec-command","editor-selection"]});
vuonghuuphuc/cdnjs
ajax/libs/yui/3.8.1/editor-base/editor-base-min.js
JavaScript
mit
9,513
YUI.add('loader-base', function (Y, NAME) { /** * The YUI loader core * @module loader * @submodule loader-base */ (function() { var VERSION = Y.version, BUILD = '/build/', ROOT = VERSION + '/', CDN_BASE = Y.Env.base, GALLERY_VERSION = 'gallery-2013.12.12-21-06', TNT = '2in3', TNT_VERSION = '4', YUI2_VERSION = '2.9.0', COMBO_BASE = CDN_BASE + 'combo?', META = { version: VERSION, root: ROOT, base: Y.Env.base, comboBase: COMBO_BASE, skin: { defaultSkin: 'sam', base: 'assets/skins/', path: 'skin.css', after: [ 'cssreset', 'cssfonts', 'cssgrids', 'cssbase', 'cssreset-context', 'cssfonts-context' ] }, groups: {}, patterns: {} }, groups = META.groups, yui2Update = function(tnt, yui2, config) { var root = TNT + '.' + (tnt || TNT_VERSION) + '/' + (yui2 || YUI2_VERSION) + BUILD, base = (config && config.base) ? config.base : CDN_BASE, combo = (config && config.comboBase) ? config.comboBase : COMBO_BASE; groups.yui2.base = base + root; groups.yui2.root = root; groups.yui2.comboBase = combo; }, galleryUpdate = function(tag, config) { var root = (tag || GALLERY_VERSION) + BUILD, base = (config && config.base) ? config.base : CDN_BASE, combo = (config && config.comboBase) ? config.comboBase : COMBO_BASE; groups.gallery.base = base + root; groups.gallery.root = root; groups.gallery.comboBase = combo; }; groups[VERSION] = {}; groups.gallery = { ext: false, combine: true, comboBase: COMBO_BASE, update: galleryUpdate, patterns: { 'gallery-': {}, 'lang/gallery-': {}, 'gallerycss-': { type: 'css' } } }; groups.yui2 = { combine: true, ext: false, comboBase: COMBO_BASE, update: yui2Update, patterns: { 'yui2-': { configFn: function(me) { if (/-skin|reset|fonts|grids|base/.test(me.name)) { me.type = 'css'; me.path = me.path.replace(/\.js/, '.css'); // this makes skins in builds earlier than // 2.6.0 work as long as combine is false me.path = me.path.replace(/\/yui2-skin/, '/assets/skins/sam/yui2-skin'); } } } } }; galleryUpdate(); yui2Update(); if (YUI.Env[VERSION]) { Y.mix(META, YUI.Env[VERSION], false, [ 'modules', 'groups', 'skin' ], 0, true); } YUI.Env[VERSION] = META; }()); /*jslint forin: true, maxlen: 350 */ /** * Loader dynamically loads script and css files. It includes the dependency * information for the version of the library in use, and will automatically pull in * dependencies for the modules requested. It can also load the * files from the Yahoo! CDN, and it can utilize the combo service provided on * this network to reduce the number of http connections required to download * YUI files. * * @module loader * @main loader * @submodule loader-base */ var NOT_FOUND = {}, NO_REQUIREMENTS = [], MAX_URL_LENGTH = 1024, GLOBAL_ENV = YUI.Env, GLOBAL_LOADED = GLOBAL_ENV._loaded, CSS = 'css', JS = 'js', INTL = 'intl', DEFAULT_SKIN = 'sam', VERSION = Y.version, ROOT_LANG = '', YObject = Y.Object, oeach = YObject.each, yArray = Y.Array, _queue = GLOBAL_ENV._loaderQueue, META = GLOBAL_ENV[VERSION], SKIN_PREFIX = 'skin-', L = Y.Lang, ON_PAGE = GLOBAL_ENV.mods, modulekey, _path = function(dir, file, type, nomin) { var path = dir + '/' + file; if (!nomin) { path += '-min'; } path += '.' + (type || CSS); return path; }; if (!YUI.Env._cssLoaded) { YUI.Env._cssLoaded = {}; } /** * The component metadata is stored in Y.Env.meta. * Part of the loader module. * @property meta * @for YUI */ Y.Env.meta = META; /** * Loader dynamically loads script and css files. It includes the dependency * info for the version of the library in use, and will automatically pull in * dependencies for the modules requested. It can load the * files from the Yahoo! CDN, and it can utilize the combo service provided on * this network to reduce the number of http connections required to download * YUI files. You can also specify an external, custom combo service to host * your modules as well. var Y = YUI(); var loader = new Y.Loader({ filter: 'debug', base: '../../', root: 'build/', combine: true, require: ['node', 'dd', 'console'] }); var out = loader.resolve(true); * @constructor * @class Loader * @param {Object} config an optional set of configuration options. * @param {String} config.base The base dir which to fetch this module from * @param {String} config.comboBase The Combo service base path. Ex: `http://yui.yahooapis.com/combo?` * @param {String} config.root The root path to prepend to module names for the combo service. Ex: `2.5.2/build/` * @param {String|Object} config.filter A filter to apply to result urls. <a href="#property_filter">See filter property</a> * @param {Object} config.filters Per-component filter specification. If specified for a given component, this overrides the filter config. * @param {Boolean} config.combine Use a combo service to reduce the number of http connections required to load your dependencies * @param {Boolean} [config.async=true] Fetch files in async * @param {Array} config.ignore: A list of modules that should never be dynamically loaded * @param {Array} config.force A list of modules that should always be loaded when required, even if already present on the page * @param {HTMLElement|String} config.insertBefore Node or id for a node that should be used as the insertion point for new nodes * @param {Object} config.jsAttributes Object literal containing attributes to add to script nodes * @param {Object} config.cssAttributes Object literal containing attributes to add to link nodes * @param {Number} config.timeout The number of milliseconds before a timeout occurs when dynamically loading nodes. If not set, there is no timeout * @param {Object} config.context Execution context for all callbacks * @param {Function} config.onSuccess Callback for the 'success' event * @param {Function} config.onFailure Callback for the 'failure' event * @param {Function} config.onCSS Callback for the 'CSSComplete' event. When loading YUI components with CSS the CSS is loaded first, then the script. This provides a moment you can tie into to improve the presentation of the page while the script is loading. * @param {Function} config.onTimeout Callback for the 'timeout' event * @param {Function} config.onProgress Callback executed each time a script or css file is loaded * @param {Object} config.modules A list of module definitions. See <a href="#method_addModule">Loader.addModule</a> for the supported module metadata * @param {Object} config.groups A list of group definitions. Each group can contain specific definitions for `base`, `comboBase`, `combine`, and accepts a list of `modules`. * @param {String} config.2in3 The version of the YUI 2 in 3 wrapper to use. The intrinsic support for YUI 2 modules in YUI 3 relies on versions of the YUI 2 components inside YUI 3 module wrappers. These wrappers change over time to accomodate the issues that arise from running YUI 2 in a YUI 3 sandbox. * @param {String} config.yui2 When using the 2in3 project, you can select the version of YUI 2 to use. Valid values are `2.2.2`, `2.3.1`, `2.4.1`, `2.5.2`, `2.6.0`, `2.7.0`, `2.8.0`, `2.8.1` and `2.9.0` [default] -- plus all versions of YUI 2 going forward. */ Y.Loader = function(o) { var self = this; //Catch no config passed. o = o || {}; modulekey = META.md5; /** * Internal callback to handle multiple internal insert() calls * so that css is inserted prior to js * @property _internalCallback * @private */ // self._internalCallback = null; /** * Callback that will be executed when the loader is finished * with an insert * @method onSuccess * @type function */ // self.onSuccess = null; /** * Callback that will be executed if there is a failure * @method onFailure * @type function */ // self.onFailure = null; /** * Callback for the 'CSSComplete' event. When loading YUI components * with CSS the CSS is loaded first, then the script. This provides * a moment you can tie into to improve the presentation of the page * while the script is loading. * @method onCSS * @type function */ // self.onCSS = null; /** * Callback executed each time a script or css file is loaded * @method onProgress * @type function */ // self.onProgress = null; /** * Callback that will be executed if a timeout occurs * @method onTimeout * @type function */ // self.onTimeout = null; /** * The execution context for all callbacks * @property context * @default {YUI} the YUI instance */ self.context = Y; /** * Data that is passed to all callbacks * @property data */ // self.data = null; /** * Node reference or id where new nodes should be inserted before * @property insertBefore * @type string|HTMLElement */ // self.insertBefore = null; /** * The charset attribute for inserted nodes * @property charset * @type string * @deprecated , use cssAttributes or jsAttributes. */ // self.charset = null; /** * An object literal containing attributes to add to link nodes * @property cssAttributes * @type object */ // self.cssAttributes = null; /** * An object literal containing attributes to add to script nodes * @property jsAttributes * @type object */ // self.jsAttributes = null; /** * The base directory. * @property base * @type string * @default http://yui.yahooapis.com/[YUI VERSION]/build/ */ self.base = Y.Env.meta.base + Y.Env.meta.root; /** * Base path for the combo service * @property comboBase * @type string * @default http://yui.yahooapis.com/combo? */ self.comboBase = Y.Env.meta.comboBase; /* * Base path for language packs. */ // self.langBase = Y.Env.meta.langBase; // self.lang = ""; /** * If configured, the loader will attempt to use the combo * service for YUI resources and configured external resources. * @property combine * @type boolean * @default true if a base dir isn't in the config */ self.combine = o.base && (o.base.indexOf(self.comboBase.substr(0, 20)) > -1); /** * The default seperator to use between files in a combo URL * @property comboSep * @type {String} * @default Ampersand */ self.comboSep = '&'; /** * Max url length for combo urls. The default is 1024. This is the URL * limit for the Yahoo! hosted combo servers. If consuming * a different combo service that has a different URL limit * it is possible to override this default by supplying * the maxURLLength config option. The config option will * only take effect if lower than the default. * * @property maxURLLength * @type int */ self.maxURLLength = MAX_URL_LENGTH; /** * Ignore modules registered on the YUI global * @property ignoreRegistered * @default false */ self.ignoreRegistered = o.ignoreRegistered; /** * Root path to prepend to module path for the combo * service * @property root * @type string * @default [YUI VERSION]/build/ */ self.root = Y.Env.meta.root; /** * Timeout value in milliseconds. If set, self value will be used by * the get utility. the timeout event will fire if * a timeout occurs. * @property timeout * @type int */ self.timeout = 0; /** * A list of modules that should not be loaded, even if * they turn up in the dependency tree * @property ignore * @type string[] */ // self.ignore = null; /** * A list of modules that should always be loaded, even * if they have already been inserted into the page. * @property force * @type string[] */ // self.force = null; self.forceMap = {}; /** * Should we allow rollups * @property allowRollup * @type boolean * @default false */ self.allowRollup = false; /** * A filter to apply to result urls. This filter will modify the default * path for all modules. The default path for the YUI library is the * minified version of the files (e.g., event-min.js). The filter property * can be a predefined filter or a custom filter. The valid predefined * filters are: * <dl> * <dt>DEBUG</dt> * <dd>Selects the debug versions of the library (e.g., event-debug.js). * This option will automatically include the Logger widget</dd> * <dt>RAW</dt> * <dd>Selects the non-minified version of the library (e.g., event.js). * </dd> * </dl> * You can also define a custom filter, which must be an object literal * containing a search expression and a replace string: * * myFilter: { * 'searchExp': "-min\\.js", * 'replaceStr': "-debug.js" * } * * @property filter * @type string| {searchExp: string, replaceStr: string} */ // self.filter = null; /** * per-component filter specification. If specified for a given * component, this overrides the filter config. * @property filters * @type object */ self.filters = {}; /** * The list of requested modules * @property required * @type {string: boolean} */ self.required = {}; /** * If a module name is predefined when requested, it is checked againsts * the patterns provided in this property. If there is a match, the * module is added with the default configuration. * * At the moment only supporting module prefixes, but anticipate * supporting at least regular expressions. * @property patterns * @type Object */ // self.patterns = Y.merge(Y.Env.meta.patterns); self.patterns = {}; /** * The library metadata * @property moduleInfo */ // self.moduleInfo = Y.merge(Y.Env.meta.moduleInfo); self.moduleInfo = {}; self.groups = Y.merge(Y.Env.meta.groups); /** * Provides the information used to skin the skinnable components. * The following skin definition would result in 'skin1' and 'skin2' * being loaded for calendar (if calendar was requested), and * 'sam' for all other skinnable components: * * skin: { * // The default skin, which is automatically applied if not * // overriden by a component-specific skin definition. * // Change this in to apply a different skin globally * defaultSkin: 'sam', * * // This is combined with the loader base property to get * // the default root directory for a skin. ex: * // http://yui.yahooapis.com/2.3.0/build/assets/skins/sam/ * base: 'assets/skins/', * * // Any component-specific overrides can be specified here, * // making it possible to load different skins for different * // components. It is possible to load more than one skin * // for a given component as well. * overrides: { * calendar: ['skin1', 'skin2'] * } * } * @property skin * @type {Object} */ self.skin = Y.merge(Y.Env.meta.skin); /* * Map of conditional modules * @since 3.2.0 */ self.conditions = {}; // map of modules with a hash of modules that meet the requirement // self.provides = {}; self.config = o; self._internal = true; self._populateCache(); /** * Set when beginning to compute the dependency tree. * Composed of what YUI reports to be loaded combined * with what has been loaded by any instance on the page * with the version number specified in the metadata. * @property loaded * @type {string: boolean} */ self.loaded = GLOBAL_LOADED[VERSION]; /** * Should Loader fetch scripts in `async`, defaults to `true` * @property async */ self.async = true; self._inspectPage(); self._internal = false; self._config(o); self.forceMap = (self.force) ? Y.Array.hash(self.force) : {}; self.testresults = null; if (Y.config.tests) { self.testresults = Y.config.tests; } /** * List of rollup files found in the library metadata * @property rollups */ // self.rollups = null; /** * Whether or not to load optional dependencies for * the requested modules * @property loadOptional * @type boolean * @default false */ // self.loadOptional = false; /** * All of the derived dependencies in sorted order, which * will be populated when either calculate() or insert() * is called * @property sorted * @type string[] */ self.sorted = []; /* * A list of modules to attach to the YUI instance when complete. * If not supplied, the sorted list of dependencies are applied. * @property attaching */ // self.attaching = null; /** * Flag to indicate the dependency tree needs to be recomputed * if insert is called again. * @property dirty * @type boolean * @default true */ self.dirty = true; /** * List of modules inserted by the utility * @property inserted * @type {string: boolean} */ self.inserted = {}; /** * List of skipped modules during insert() because the module * was not defined * @property skipped */ self.skipped = {}; // Y.on('yui:load', self.loadNext, self); self.tested = {}; /* * Cached sorted calculate results * @property results * @since 3.2.0 */ //self.results = {}; if (self.ignoreRegistered) { //Clear inpage already processed modules. self._resetModules(); } }; Y.Loader.prototype = { /** * Checks the cache for modules and conditions, if they do not exist * process the default metadata and populate the local moduleInfo hash. * @method _populateCache * @private */ _populateCache: function() { var self = this, defaults = META.modules, cache = GLOBAL_ENV._renderedMods, i; if (cache && !self.ignoreRegistered) { for (i in cache) { if (cache.hasOwnProperty(i)) { self.moduleInfo[i] = Y.merge(cache[i]); } } cache = GLOBAL_ENV._conditions; for (i in cache) { if (cache.hasOwnProperty(i)) { self.conditions[i] = Y.merge(cache[i]); } } } else { for (i in defaults) { if (defaults.hasOwnProperty(i)) { self.addModule(defaults[i], i); } } } }, /** * Reset modules in the module cache to a pre-processed state so additional * computations with a different skin or language will work as expected. * @method _resetModules * @private */ _resetModules: function() { var self = this, i, o, mod, name, details; for (i in self.moduleInfo) { if (self.moduleInfo.hasOwnProperty(i)) { mod = self.moduleInfo[i]; name = mod.name; details = (YUI.Env.mods[name] ? YUI.Env.mods[name].details : null); if (details) { self.moduleInfo[name]._reset = true; self.moduleInfo[name].requires = details.requires || []; self.moduleInfo[name].optional = details.optional || []; self.moduleInfo[name].supersedes = details.supercedes || []; } if (mod.defaults) { for (o in mod.defaults) { if (mod.defaults.hasOwnProperty(o)) { if (mod[o]) { mod[o] = mod.defaults[o]; } } } } delete mod.langCache; delete mod.skinCache; if (mod.skinnable) { self._addSkin(self.skin.defaultSkin, mod.name); } } } }, /** Regex that matches a CSS URL. Used to guess the file type when it's not specified. @property REGEX_CSS @type RegExp @final @protected @since 3.5.0 **/ REGEX_CSS: /\.css(?:[?;].*)?$/i, /** * Default filters for raw and debug * @property FILTER_DEFS * @type Object * @final * @protected */ FILTER_DEFS: { RAW: { 'searchExp': '-min\\.js', 'replaceStr': '.js' }, DEBUG: { 'searchExp': '-min\\.js', 'replaceStr': '-debug.js' }, COVERAGE: { 'searchExp': '-min\\.js', 'replaceStr': '-coverage.js' } }, /* * Check the pages meta-data and cache the result. * @method _inspectPage * @private */ _inspectPage: function() { var self = this, v, m, req, mr, i; //Inspect the page for CSS only modules and mark them as loaded. for (i in self.moduleInfo) { if (self.moduleInfo.hasOwnProperty(i)) { v = self.moduleInfo[i]; if (v.type && v.type === CSS) { if (self.isCSSLoaded(v.name)) { self.loaded[i] = true; } } } } for (i in ON_PAGE) { if (ON_PAGE.hasOwnProperty(i)) { v = ON_PAGE[i]; if (v.details) { m = self.moduleInfo[v.name]; req = v.details.requires; mr = m && m.requires; if (m) { if (!m._inspected && req && mr.length !== req.length) { // console.log('deleting ' + m.name); delete m.expanded; } } else { m = self.addModule(v.details, i); } m._inspected = true; } } } }, /* * returns true if b is not loaded, and is required directly or by means of modules it supersedes. * @private * @method _requires * @param {String} mod1 The first module to compare * @param {String} mod2 The second module to compare */ _requires: function(mod1, mod2) { var i, rm, after_map, s, info = this.moduleInfo, m = info[mod1], other = info[mod2]; if (!m || !other) { return false; } rm = m.expanded_map; after_map = m.after_map; // check if this module should be sorted after the other // do this first to short circut circular deps if (after_map && (mod2 in after_map)) { return true; } after_map = other.after_map; // and vis-versa if (after_map && (mod1 in after_map)) { return false; } // check if this module requires one the other supersedes s = info[mod2] && info[mod2].supersedes; if (s) { for (i = 0; i < s.length; i++) { if (this._requires(mod1, s[i])) { return true; } } } s = info[mod1] && info[mod1].supersedes; if (s) { for (i = 0; i < s.length; i++) { if (this._requires(mod2, s[i])) { return false; } } } // check if this module requires the other directly // if (r && yArray.indexOf(r, mod2) > -1) { if (rm && (mod2 in rm)) { return true; } // external css files should be sorted below yui css if (m.ext && m.type === CSS && !other.ext && other.type === CSS) { return true; } return false; }, /** * Apply a new config to the Loader instance * @method _config * @private * @param {Object} o The new configuration */ _config: function(o) { var i, j, val, a, f, group, groupName, self = this, mods = [], mod; // apply config values if (o) { for (i in o) { if (o.hasOwnProperty(i)) { val = o[i]; //TODO This should be a case if (i === 'require') { self.require(val); } else if (i === 'skin') { //If the config.skin is a string, format to the expected object if (typeof val === 'string') { self.skin.defaultSkin = o.skin; val = { defaultSkin: val }; } Y.mix(self.skin, val, true); } else if (i === 'groups') { for (j in val) { if (val.hasOwnProperty(j)) { groupName = j; group = val[j]; self.addGroup(group, groupName); if (group.aliases) { for (a in group.aliases) { if (group.aliases.hasOwnProperty(a)) { self.addAlias(group.aliases[a], a); } } } } } } else if (i === 'modules') { // add a hash of module definitions for (j in val) { if (val.hasOwnProperty(j)) { self.addModule(val[j], j); } } } else if (i === 'aliases') { for (j in val) { if (val.hasOwnProperty(j)) { self.addAlias(val[j], j); } } } else if (i === 'gallery') { if (this.groups.gallery.update) { this.groups.gallery.update(val, o); } } else if (i === 'yui2' || i === '2in3') { if (this.groups.yui2.update) { this.groups.yui2.update(o['2in3'], o.yui2, o); } } else { self[i] = val; } } } } // fix filter f = self.filter; if (L.isString(f)) { f = f.toUpperCase(); self.filterName = f; self.filter = self.FILTER_DEFS[f]; if (f === 'DEBUG') { self.require('yui-log', 'dump'); } } if (self.filterName && self.coverage) { if (self.filterName === 'COVERAGE' && L.isArray(self.coverage) && self.coverage.length) { for (i = 0; i < self.coverage.length; i++) { mod = self.coverage[i]; if (self.moduleInfo[mod] && self.moduleInfo[mod].use) { mods = [].concat(mods, self.moduleInfo[mod].use); } else { mods.push(mod); } } self.filters = self.filters || {}; Y.Array.each(mods, function(mod) { self.filters[mod] = self.FILTER_DEFS.COVERAGE; }); self.filterName = 'RAW'; self.filter = self.FILTER_DEFS[self.filterName]; } } }, /** * Returns the skin module name for the specified skin name. If a * module name is supplied, the returned skin module name is * specific to the module passed in. * @method formatSkin * @param {string} skin the name of the skin. * @param {string} mod optional: the name of a module to skin. * @return {string} the full skin module name. */ formatSkin: function(skin, mod) { var s = SKIN_PREFIX + skin; if (mod) { s = s + '-' + mod; } return s; }, /** * Adds the skin def to the module info * @method _addSkin * @param {string} skin the name of the skin. * @param {string} mod the name of the module. * @param {string} parent parent module if this is a skin of a * submodule or plugin. * @return {string} the module name for the skin. * @private */ _addSkin: function(skin, mod, parent) { var mdef, pkg, name, nmod, info = this.moduleInfo, sinf = this.skin, ext = info[mod] && info[mod].ext; // Add a module definition for the module-specific skin css if (mod) { name = this.formatSkin(skin, mod); if (!info[name]) { mdef = info[mod]; pkg = mdef.pkg || mod; nmod = { skin: true, name: name, group: mdef.group, type: 'css', after: sinf.after, path: (parent || pkg) + '/' + sinf.base + skin + '/' + mod + '.css', ext: ext }; if (mdef.base) { nmod.base = mdef.base; } if (mdef.configFn) { nmod.configFn = mdef.configFn; } this.addModule(nmod, name); } } return name; }, /** * Adds an alias module to the system * @method addAlias * @param {Array} use An array of modules that makes up this alias * @param {String} name The name of the alias * @example * var loader = new Y.Loader({}); * loader.addAlias([ 'node', 'yql' ], 'davglass'); * loader.require(['davglass']); * var out = loader.resolve(true); * * //out.js will contain Node and YQL modules */ addAlias: function(use, name) { YUI.Env.aliases[name] = use; this.addModule({ name: name, use: use }); }, /** * Add a new module group * @method addGroup * @param {Object} config An object containing the group configuration data * @param {String} config.name required, the group name * @param {String} config.base The base directory for this module group * @param {String} config.root The root path to add to each combo resource path * @param {Boolean} config.combine Should the request be combined * @param {String} config.comboBase Combo service base path * @param {Object} config.modules The group of modules * @param {String} name the group name. * @example * var loader = new Y.Loader({}); * loader.addGroup({ * name: 'davglass', * combine: true, * comboBase: '/combo?', * root: '', * modules: { * //Module List here * } * }, 'davglass'); */ addGroup: function(o, name) { var mods = o.modules, self = this, i, v; name = name || o.name; o.name = name; self.groups[name] = o; if (o.patterns) { for (i in o.patterns) { if (o.patterns.hasOwnProperty(i)) { o.patterns[i].group = name; self.patterns[i] = o.patterns[i]; } } } if (mods) { for (i in mods) { if (mods.hasOwnProperty(i)) { v = mods[i]; if (typeof v === 'string') { v = { name: i, fullpath: v }; } v.group = name; self.addModule(v, i); } } } }, /** * Add a new module to the component metadata. * @method addModule * @param {Object} config An object containing the module data. * @param {String} config.name Required, the component name * @param {String} config.type Required, the component type (js or css) * @param {String} config.path Required, the path to the script from `base` * @param {Array} config.requires Array of modules required by this component * @param {Array} [config.optional] Array of optional modules for this component * @param {Array} [config.supersedes] Array of the modules this component replaces * @param {Array} [config.after] Array of modules the components which, if present, should be sorted above this one * @param {Object} [config.after_map] Faster alternative to 'after' -- supply a hash instead of an array * @param {Number} [config.rollup] The number of superseded modules required for automatic rollup * @param {String} [config.fullpath] If `fullpath` is specified, this is used instead of the configured `base + path` * @param {Boolean} [config.skinnable] Flag to determine if skin assets should automatically be pulled in * @param {Object} [config.submodules] Hash of submodules * @param {String} [config.group] The group the module belongs to -- this is set automatically when it is added as part of a group configuration. * @param {Array} [config.lang] Array of BCP 47 language tags of languages for which this module has localized resource bundles, e.g., `["en-GB", "zh-Hans-CN"]` * @param {Object} [config.condition] Specifies that the module should be loaded automatically if a condition is met. This is an object with up to four fields: * @param {String} [config.condition.trigger] The name of a module that can trigger the auto-load * @param {Function} [config.condition.test] A function that returns true when the module is to be loaded. * @param {String} [config.condition.ua] The UA name of <a href="UA.html">Y.UA</a> object that returns true when the module is to be loaded. e.g., `"ie"`, `"nodejs"`. * @param {String} [config.condition.when] Specifies the load order of the conditional module * with regard to the position of the trigger module. * This should be one of three values: `before`, `after`, or `instead`. The default is `after`. * @param {Object} [config.testresults] A hash of test results from `Y.Features.all()` * @param {Function} [config.configFn] A function to exectute when configuring this module * @param {Object} config.configFn.mod The module config, modifying this object will modify it's config. Returning false will delete the module's config. * @param {String} [name] The module name, required if not in the module data. * @return {Object} the module definition or null if the object passed in did not provide all required attributes. */ addModule: function(o, name) { name = name || o.name; if (typeof o === 'string') { o = { name: name, fullpath: o }; } var subs, i, l, t, sup, s, smod, plugins, plug, j, langs, packName, supName, flatSup, flatLang, lang, ret, overrides, skinname, when, g, p, conditions = this.conditions, trigger; //Only merge this data if the temp flag is set //from an earlier pass from a pattern or else //an override module (YUI_config) can not be used to //replace a default module. if (this.moduleInfo[name] && this.moduleInfo[name].temp) { //This catches temp modules loaded via a pattern // The module will be added twice, once from the pattern and // Once from the actual add call, this ensures that properties // that were added to the module the first time around (group: gallery) // are also added the second time around too. o = Y.merge(this.moduleInfo[name], o); } o.name = name; if (!o || !o.name) { return null; } if (!o.type) { //Always assume it's javascript unless the CSS pattern is matched. o.type = JS; p = o.path || o.fullpath; if (p && this.REGEX_CSS.test(p)) { o.type = CSS; } } if (!o.path && !o.fullpath) { o.path = _path(name, name, o.type); } o.supersedes = o.supersedes || o.use; o.ext = ('ext' in o) ? o.ext : (this._internal) ? false : true; // Handle submodule logic subs = o.submodules; this.moduleInfo[name] = o; o.requires = o.requires || []; /* Only allowing the cascade of requires information, since optional and supersedes are far more fine grained than a blanket requires is. */ if (this.requires) { for (i = 0; i < this.requires.length; i++) { o.requires.push(this.requires[i]); } } if (o.group && this.groups && this.groups[o.group]) { g = this.groups[o.group]; if (g.requires) { for (i = 0; i < g.requires.length; i++) { o.requires.push(g.requires[i]); } } } if (!o.defaults) { o.defaults = { requires: o.requires ? [].concat(o.requires) : null, supersedes: o.supersedes ? [].concat(o.supersedes) : null, optional: o.optional ? [].concat(o.optional) : null }; } if (o.skinnable && o.ext && o.temp) { skinname = this._addSkin(this.skin.defaultSkin, name); o.requires.unshift(skinname); } if (o.requires.length) { o.requires = this.filterRequires(o.requires) || []; } if (!o.langPack && o.lang) { langs = yArray(o.lang); for (j = 0; j < langs.length; j++) { lang = langs[j]; packName = this.getLangPackName(lang, name); smod = this.moduleInfo[packName]; if (!smod) { smod = this._addLangPack(lang, o, packName); } } } if (subs) { sup = o.supersedes || []; l = 0; for (i in subs) { if (subs.hasOwnProperty(i)) { s = subs[i]; s.path = s.path || _path(name, i, o.type); s.pkg = name; s.group = o.group; if (s.supersedes) { sup = sup.concat(s.supersedes); } smod = this.addModule(s, i); sup.push(i); if (smod.skinnable) { o.skinnable = true; overrides = this.skin.overrides; if (overrides && overrides[i]) { for (j = 0; j < overrides[i].length; j++) { skinname = this._addSkin(overrides[i][j], i, name); sup.push(skinname); } } skinname = this._addSkin(this.skin.defaultSkin, i, name); sup.push(skinname); } // looks like we are expected to work out the metadata // for the parent module language packs from what is // specified in the child modules. if (s.lang && s.lang.length) { langs = yArray(s.lang); for (j = 0; j < langs.length; j++) { lang = langs[j]; packName = this.getLangPackName(lang, name); supName = this.getLangPackName(lang, i); smod = this.moduleInfo[packName]; if (!smod) { smod = this._addLangPack(lang, o, packName); } flatSup = flatSup || yArray.hash(smod.supersedes); if (!(supName in flatSup)) { smod.supersedes.push(supName); } o.lang = o.lang || []; flatLang = flatLang || yArray.hash(o.lang); if (!(lang in flatLang)) { o.lang.push(lang); } // Add rollup file, need to add to supersedes list too // default packages packName = this.getLangPackName(ROOT_LANG, name); supName = this.getLangPackName(ROOT_LANG, i); smod = this.moduleInfo[packName]; if (!smod) { smod = this._addLangPack(lang, o, packName); } if (!(supName in flatSup)) { smod.supersedes.push(supName); } // Add rollup file, need to add to supersedes list too } } l++; } } //o.supersedes = YObject.keys(yArray.hash(sup)); o.supersedes = yArray.dedupe(sup); if (this.allowRollup) { o.rollup = (l < 4) ? l : Math.min(l - 1, 4); } } plugins = o.plugins; if (plugins) { for (i in plugins) { if (plugins.hasOwnProperty(i)) { plug = plugins[i]; plug.pkg = name; plug.path = plug.path || _path(name, i, o.type); plug.requires = plug.requires || []; plug.group = o.group; this.addModule(plug, i); if (o.skinnable) { this._addSkin(this.skin.defaultSkin, i, name); } } } } if (o.condition) { t = o.condition.trigger; if (YUI.Env.aliases[t]) { t = YUI.Env.aliases[t]; } if (!Y.Lang.isArray(t)) { t = [t]; } for (i = 0; i < t.length; i++) { trigger = t[i]; when = o.condition.when; conditions[trigger] = conditions[trigger] || {}; conditions[trigger][name] = o.condition; // the 'when' attribute can be 'before', 'after', or 'instead' // the default is after. if (when && when !== 'after') { if (when === 'instead') { // replace the trigger o.supersedes = o.supersedes || []; o.supersedes.push(trigger); } // before the trigger // the trigger requires the conditional mod, // so it should appear before the conditional // mod if we do not intersede. } else { // after the trigger o.after = o.after || []; o.after.push(trigger); } } } if (o.supersedes) { o.supersedes = this.filterRequires(o.supersedes); } if (o.after) { o.after = this.filterRequires(o.after); o.after_map = yArray.hash(o.after); } // this.dirty = true; if (o.configFn) { ret = o.configFn(o); if (ret === false) { delete this.moduleInfo[name]; delete GLOBAL_ENV._renderedMods[name]; o = null; } } //Add to global cache if (o) { if (!GLOBAL_ENV._renderedMods) { GLOBAL_ENV._renderedMods = {}; } GLOBAL_ENV._renderedMods[name] = Y.mix(GLOBAL_ENV._renderedMods[name] || {}, o); GLOBAL_ENV._conditions = conditions; } return o; }, /** * Add a requirement for one or more module * @method require * @param {string[] | string*} what the modules to load. */ require: function(what) { var a = (typeof what === 'string') ? yArray(arguments) : what; this.dirty = true; this.required = Y.merge(this.required, yArray.hash(this.filterRequires(a))); this._explodeRollups(); }, /** * Grab all the items that were asked for, check to see if the Loader * meta-data contains a "use" array. If it doesm remove the asked item and replace it with * the content of the "use". * This will make asking for: "dd" * Actually ask for: "dd-ddm-base,dd-ddm,dd-ddm-drop,dd-drag,dd-proxy,dd-constrain,dd-drop,dd-scroll,dd-drop-plugin" * @private * @method _explodeRollups */ _explodeRollups: function() { var self = this, m, m2, i, a, v, len, len2, r = self.required; if (!self.allowRollup) { for (i in r) { if (r.hasOwnProperty(i)) { m = self.getModule(i); if (m && m.use) { len = m.use.length; for (a = 0; a < len; a++) { m2 = self.getModule(m.use[a]); if (m2 && m2.use) { len2 = m2.use.length; for (v = 0; v < len2; v++) { r[m2.use[v]] = true; } } else { r[m.use[a]] = true; } } } } } self.required = r; } }, /** * Explodes the required array to remove aliases and replace them with real modules * @method filterRequires * @param {Array} r The original requires array * @return {Array} The new array of exploded requirements */ filterRequires: function(r) { if (r) { if (!Y.Lang.isArray(r)) { r = [r]; } r = Y.Array(r); var c = [], i, mod, o, m; for (i = 0; i < r.length; i++) { mod = this.getModule(r[i]); if (mod && mod.use) { for (o = 0; o < mod.use.length; o++) { //Must walk the other modules in case a module is a rollup of rollups (datatype) m = this.getModule(mod.use[o]); if (m && m.use && (m.name !== mod.name)) { c = Y.Array.dedupe([].concat(c, this.filterRequires(m.use))); } else { c.push(mod.use[o]); } } } else { c.push(r[i]); } } r = c; } return r; }, /** * Returns an object containing properties for all modules required * in order to load the requested module * @method getRequires * @param {object} mod The module definition from moduleInfo. * @return {array} the expanded requirement list. */ getRequires: function(mod) { if (!mod) { //console.log('returning no reqs for ' + mod.name); return NO_REQUIREMENTS; } if (mod._parsed) { //console.log('returning requires for ' + mod.name, mod.requires); return mod.expanded || NO_REQUIREMENTS; } //TODO add modue cache here out of scope.. var i, m, j, add, packName, lang, testresults = this.testresults, name = mod.name, cond, adddef = ON_PAGE[name] && ON_PAGE[name].details, d, go, def, r, old_mod, o, skinmod, skindef, skinpar, skinname, intl = mod.lang || mod.intl, info = this.moduleInfo, ftests = Y.Features && Y.Features.tests.load, hash, reparse; // console.log(name); // pattern match leaves module stub that needs to be filled out if (mod.temp && adddef) { old_mod = mod; mod = this.addModule(adddef, name); mod.group = old_mod.group; mod.pkg = old_mod.pkg; delete mod.expanded; } // console.log('cache: ' + mod.langCache + ' == ' + this.lang); //If a skin or a lang is different, reparse.. reparse = !((!this.lang || mod.langCache === this.lang) && (mod.skinCache === this.skin.defaultSkin)); if (mod.expanded && !reparse) { return mod.expanded; } d = []; hash = {}; r = this.filterRequires(mod.requires); if (mod.lang) { //If a module has a lang attribute, auto add the intl requirement. d.unshift('intl'); r.unshift('intl'); intl = true; } o = this.filterRequires(mod.optional); mod._parsed = true; mod.langCache = this.lang; mod.skinCache = this.skin.defaultSkin; for (i = 0; i < r.length; i++) { if (!hash[r[i]]) { d.push(r[i]); hash[r[i]] = true; m = this.getModule(r[i]); if (m) { add = this.getRequires(m); intl = intl || (m.expanded_map && (INTL in m.expanded_map)); for (j = 0; j < add.length; j++) { d.push(add[j]); } } } } // get the requirements from superseded modules, if any r = this.filterRequires(mod.supersedes); if (r) { for (i = 0; i < r.length; i++) { if (!hash[r[i]]) { // if this module has submodules, the requirements list is // expanded to include the submodules. This is so we can // prevent dups when a submodule is already loaded and the // parent is requested. if (mod.submodules) { d.push(r[i]); } hash[r[i]] = true; m = this.getModule(r[i]); if (m) { add = this.getRequires(m); intl = intl || (m.expanded_map && (INTL in m.expanded_map)); for (j = 0; j < add.length; j++) { d.push(add[j]); } } } } } if (o && this.loadOptional) { for (i = 0; i < o.length; i++) { if (!hash[o[i]]) { d.push(o[i]); hash[o[i]] = true; m = info[o[i]]; if (m) { add = this.getRequires(m); intl = intl || (m.expanded_map && (INTL in m.expanded_map)); for (j = 0; j < add.length; j++) { d.push(add[j]); } } } } } cond = this.conditions[name]; if (cond) { //Set the module to not parsed since we have conditionals and this could change the dependency tree. mod._parsed = false; if (testresults && ftests) { oeach(testresults, function(result, id) { var condmod = ftests[id].name; if (!hash[condmod] && ftests[id].trigger === name) { if (result && ftests[id]) { hash[condmod] = true; d.push(condmod); } } }); } else { for (i in cond) { if (cond.hasOwnProperty(i)) { if (!hash[i]) { def = cond[i]; //first see if they've specfied a ua check //then see if they've got a test fn & if it returns true //otherwise just having a condition block is enough go = def && ((!def.ua && !def.test) || (def.ua && Y.UA[def.ua]) || (def.test && def.test(Y, r))); if (go) { hash[i] = true; d.push(i); m = this.getModule(i); if (m) { add = this.getRequires(m); for (j = 0; j < add.length; j++) { d.push(add[j]); } } } } } } } } // Create skin modules if (mod.skinnable) { skindef = this.skin.overrides; for (i in YUI.Env.aliases) { if (YUI.Env.aliases.hasOwnProperty(i)) { if (Y.Array.indexOf(YUI.Env.aliases[i], name) > -1) { skinpar = i; } } } if (skindef && (skindef[name] || (skinpar && skindef[skinpar]))) { skinname = name; if (skindef[skinpar]) { skinname = skinpar; } for (i = 0; i < skindef[skinname].length; i++) { skinmod = this._addSkin(skindef[skinname][i], name); if (!this.isCSSLoaded(skinmod, this._boot)) { d.push(skinmod); } } } else { skinmod = this._addSkin(this.skin.defaultSkin, name); if (!this.isCSSLoaded(skinmod, this._boot)) { d.push(skinmod); } } } mod._parsed = false; if (intl) { if (mod.lang && !mod.langPack && Y.Intl) { lang = Y.Intl.lookupBestLang(this.lang || ROOT_LANG, mod.lang); packName = this.getLangPackName(lang, name); if (packName) { d.unshift(packName); } } d.unshift(INTL); } mod.expanded_map = yArray.hash(d); mod.expanded = YObject.keys(mod.expanded_map); return mod.expanded; }, /** * Check to see if named css module is already loaded on the page * @method isCSSLoaded * @param {String} name The name of the css file * @return Boolean */ isCSSLoaded: function(name, skip) { //TODO - Make this call a batching call with name being an array if (!name || !YUI.Env.cssStampEl || (!skip && this.ignoreRegistered)) { return false; } var el = YUI.Env.cssStampEl, ret = false, mod = YUI.Env._cssLoaded[name], style = el.currentStyle; //IE if (mod !== undefined) { return mod; } //Add the classname to the element el.className = name; if (!style) { style = Y.config.doc.defaultView.getComputedStyle(el, null); } if (style && style.display === 'none') { ret = true; } el.className = ''; //Reset the classname to '' YUI.Env._cssLoaded[name] = ret; return ret; }, /** * Returns a hash of module names the supplied module satisfies. * @method getProvides * @param {string} name The name of the module. * @return {object} what this module provides. */ getProvides: function(name) { var m = this.getModule(name), o, s; // supmap = this.provides; if (!m) { return NOT_FOUND; } if (m && !m.provides) { o = {}; s = m.supersedes; if (s) { yArray.each(s, function(v) { Y.mix(o, this.getProvides(v)); }, this); } o[name] = true; m.provides = o; } return m.provides; }, /** * Calculates the dependency tree, the result is stored in the sorted * property. * @method calculate * @param {object} o optional options object. * @param {string} type optional argument to prune modules. */ calculate: function(o, type) { if (o || type || this.dirty) { if (o) { this._config(o); } if (!this._init) { this._setup(); } this._explode(); if (this.allowRollup) { this._rollup(); } else { this._explodeRollups(); } this._reduce(); this._sort(); } }, /** * Creates a "psuedo" package for languages provided in the lang array * @method _addLangPack * @private * @param {String} lang The language to create * @param {Object} m The module definition to create the language pack around * @param {String} packName The name of the package (e.g: lang/datatype-date-en-US) * @return {Object} The module definition */ _addLangPack: function(lang, m, packName) { var name = m.name, packPath, conf, existing = this.moduleInfo[packName]; if (!existing) { packPath = _path((m.pkg || name), packName, JS, true); conf = { path: packPath, intl: true, langPack: true, ext: m.ext, group: m.group, supersedes: [] }; if (m.root) { conf.root = m.root; } if (m.base) { conf.base = m.base; } if (m.configFn) { conf.configFn = m.configFn; } this.addModule(conf, packName); if (lang) { Y.Env.lang = Y.Env.lang || {}; Y.Env.lang[lang] = Y.Env.lang[lang] || {}; Y.Env.lang[lang][name] = true; } } return this.moduleInfo[packName]; }, /** * Investigates the current YUI configuration on the page. By default, * modules already detected will not be loaded again unless a force * option is encountered. Called by calculate() * @method _setup * @private */ _setup: function() { var info = this.moduleInfo, name, i, j, m, l, packName; for (name in info) { if (info.hasOwnProperty(name)) { m = info[name]; if (m) { // remove dups //m.requires = YObject.keys(yArray.hash(m.requires)); m.requires = yArray.dedupe(m.requires); // Create lang pack modules //if (m.lang && m.lang.length) { if (m.lang) { // Setup root package if the module has lang defined, // it needs to provide a root language pack packName = this.getLangPackName(ROOT_LANG, name); this._addLangPack(null, m, packName); } } } } //l = Y.merge(this.inserted); l = {}; // available modules if (!this.ignoreRegistered) { Y.mix(l, GLOBAL_ENV.mods); } // add the ignore list to the list of loaded packages if (this.ignore) { Y.mix(l, yArray.hash(this.ignore)); } // expand the list to include superseded modules for (j in l) { if (l.hasOwnProperty(j)) { Y.mix(l, this.getProvides(j)); } } // remove modules on the force list from the loaded list if (this.force) { for (i = 0; i < this.force.length; i++) { if (this.force[i] in l) { delete l[this.force[i]]; } } } Y.mix(this.loaded, l); this._init = true; }, /** * Builds a module name for a language pack * @method getLangPackName * @param {string} lang the language code. * @param {string} mname the module to build it for. * @return {string} the language pack module name. */ getLangPackName: function(lang, mname) { return ('lang/' + mname + ((lang) ? '_' + lang : '')); }, /** * Inspects the required modules list looking for additional * dependencies. Expands the required list to include all * required modules. Called by calculate() * @method _explode * @private */ _explode: function() { //TODO Move done out of scope var r = this.required, m, reqs, done = {}, self = this, name, expound; // the setup phase is over, all modules have been created self.dirty = false; self._explodeRollups(); r = self.required; for (name in r) { if (r.hasOwnProperty(name)) { if (!done[name]) { done[name] = true; m = self.getModule(name); if (m) { expound = m.expound; if (expound) { r[expound] = self.getModule(expound); reqs = self.getRequires(r[expound]); Y.mix(r, yArray.hash(reqs)); } reqs = self.getRequires(m); Y.mix(r, yArray.hash(reqs)); } } } } }, /** * The default method used to test a module against a pattern * @method _patternTest * @private * @param {String} mname The module being tested * @param {String} pname The pattern to match */ _patternTest: function(mname, pname) { return (mname.indexOf(pname) > -1); }, /** * Get's the loader meta data for the requested module * @method getModule * @param {String} mname The module name to get * @return {Object} The module metadata */ getModule: function(mname) { //TODO: Remove name check - it's a quick hack to fix pattern WIP if (!mname) { return null; } var p, found, pname, m = this.moduleInfo[mname], patterns = this.patterns; // check the patterns library to see if we should automatically add // the module with defaults if (!m || (m && m.ext)) { for (pname in patterns) { if (patterns.hasOwnProperty(pname)) { p = patterns[pname]; //There is no test method, create a default one that tests // the pattern against the mod name if (!p.test) { p.test = this._patternTest; } if (p.test(mname, pname)) { // use the metadata supplied for the pattern // as the module definition. found = p; break; } } } } if (!m) { if (found) { if (p.action) { p.action.call(this, mname, pname); } else { // ext true or false? m = this.addModule(Y.merge(found), mname); if (found.configFn) { m.configFn = found.configFn; } m.temp = true; } } } else { if (found && m && found.configFn && !m.configFn) { m.configFn = found.configFn; m.configFn(m); } } return m; }, // impl in rollup submodule _rollup: function() { }, /** * Remove superceded modules and loaded modules. Called by * calculate() after we have the mega list of all dependencies * @method _reduce * @return {object} the reduced dependency hash. * @private */ _reduce: function(r) { r = r || this.required; var i, j, s, m, type = this.loadType, ignore = this.ignore ? yArray.hash(this.ignore) : false; for (i in r) { if (r.hasOwnProperty(i)) { m = this.getModule(i); // remove if already loaded if (((this.loaded[i] || ON_PAGE[i]) && !this.forceMap[i] && !this.ignoreRegistered) || (type && m && m.type !== type)) { delete r[i]; } if (ignore && ignore[i]) { delete r[i]; } // remove anything this module supersedes s = m && m.supersedes; if (s) { for (j = 0; j < s.length; j++) { if (s[j] in r) { delete r[s[j]]; } } } } } return r; }, /** * Handles the queue when a module has been loaded for all cases * @method _finish * @private * @param {String} msg The message from Loader * @param {Boolean} success A boolean denoting success or failure */ _finish: function(msg, success) { _queue.running = false; var onEnd = this.onEnd; if (onEnd) { onEnd.call(this.context, { msg: msg, data: this.data, success: success }); } this._continue(); }, /** * The default Loader onSuccess handler, calls this.onSuccess with a payload * @method _onSuccess * @private */ _onSuccess: function() { var self = this, skipped = Y.merge(self.skipped), fn, failed = [], rreg = self.requireRegistration, success, msg, i, mod; for (i in skipped) { if (skipped.hasOwnProperty(i)) { delete self.inserted[i]; } } self.skipped = {}; for (i in self.inserted) { if (self.inserted.hasOwnProperty(i)) { mod = self.getModule(i); if (mod && rreg && mod.type === JS && !(i in YUI.Env.mods)) { failed.push(i); } else { Y.mix(self.loaded, self.getProvides(i)); } } } fn = self.onSuccess; msg = (failed.length) ? 'notregistered' : 'success'; success = !(failed.length); if (fn) { fn.call(self.context, { msg: msg, data: self.data, success: success, failed: failed, skipped: skipped }); } self._finish(msg, success); }, /** * The default Loader onProgress handler, calls this.onProgress with a payload * @method _onProgress * @private */ _onProgress: function(e) { var self = this, i; //set the internal cache to what just came in. if (e.data && e.data.length) { for (i = 0; i < e.data.length; i++) { e.data[i] = self.getModule(e.data[i].name); } } if (self.onProgress) { self.onProgress.call(self.context, { name: e.url, data: e.data }); } }, /** * The default Loader onFailure handler, calls this.onFailure with a payload * @method _onFailure * @private */ _onFailure: function(o) { var f = this.onFailure, msg = [], i = 0, len = o.errors.length; for (i; i < len; i++) { msg.push(o.errors[i].error); } msg = msg.join(','); if (f) { f.call(this.context, { msg: msg, data: this.data, success: false }); } this._finish(msg, false); }, /** * The default Loader onTimeout handler, calls this.onTimeout with a payload * @method _onTimeout * @param {Get.Transaction} transaction The Transaction object from `Y.Get` * @private */ _onTimeout: function(transaction) { var f = this.onTimeout; if (f) { f.call(this.context, { msg: 'timeout', data: this.data, success: false, transaction: transaction }); } }, /** * Sorts the dependency tree. The last step of calculate() * @method _sort * @private */ _sort: function() { // create an indexed list var s = YObject.keys(this.required), // loaded = this.loaded, //TODO Move this out of scope done = {}, p = 0, l, a, b, j, k, moved, doneKey; // keep going until we make a pass without moving anything for (;;) { l = s.length; moved = false; // start the loop after items that are already sorted for (j = p; j < l; j++) { // check the next module on the list to see if its // dependencies have been met a = s[j]; // check everything below current item and move if we // find a requirement for the current item for (k = j + 1; k < l; k++) { doneKey = a + s[k]; if (!done[doneKey] && this._requires(a, s[k])) { // extract the dependency so we can move it up b = s.splice(k, 1); // insert the dependency above the item that // requires it s.splice(j, 0, b[0]); // only swap two dependencies once to short circut // circular dependencies done[doneKey] = true; // keep working moved = true; break; } } // jump out of loop if we moved something if (moved) { break; // this item is sorted, move our pointer and keep going } else { p++; } } // when we make it here and moved is false, we are // finished sorting if (!moved) { break; } } this.sorted = s; }, /** * Handles the actual insertion of script/link tags * @method _insert * @private * @param {Object} source The YUI instance the request came from * @param {Object} o The metadata to include * @param {String} type JS or CSS * @param {Boolean} [skipcalc=false] Do a Loader.calculate on the meta */ _insert: function(source, o, type, skipcalc) { // restore the state at the time of the request if (source) { this._config(source); } // build the dependency list // don't include type so we can process CSS and script in // one pass when the type is not specified. var modules = this.resolve(!skipcalc), self = this, comp = 0, actions = 0, mods = {}, deps, complete; self._refetch = []; if (type) { //Filter out the opposite type and reset the array so the checks later work modules[((type === JS) ? CSS : JS)] = []; } if (!self.fetchCSS) { modules.css = []; } if (modules.js.length) { comp++; } if (modules.css.length) { comp++; } //console.log('Resolved Modules: ', modules); complete = function(d) { actions++; var errs = {}, i = 0, o = 0, u = '', fn, modName, resMods; if (d && d.errors) { for (i = 0; i < d.errors.length; i++) { if (d.errors[i].request) { u = d.errors[i].request.url; } else { u = d.errors[i]; } errs[u] = u; } } if (d && d.data && d.data.length && (d.type === 'success')) { for (i = 0; i < d.data.length; i++) { self.inserted[d.data[i].name] = true; //If the external module has a skin or a lang, reprocess it if (d.data[i].lang || d.data[i].skinnable) { delete self.inserted[d.data[i].name]; self._refetch.push(d.data[i].name); } } } if (actions === comp) { self._loading = null; if (self._refetch.length) { //Get the deps for the new meta-data and reprocess for (i = 0; i < self._refetch.length; i++) { deps = self.getRequires(self.getModule(self._refetch[i])); for (o = 0; o < deps.length; o++) { if (!self.inserted[deps[o]]) { //We wouldn't be to this point without the module being here mods[deps[o]] = deps[o]; } } } mods = Y.Object.keys(mods); if (mods.length) { self.require(mods); resMods = self.resolve(true); if (resMods.cssMods.length) { for (i=0; i < resMods.cssMods.length; i++) { modName = resMods.cssMods[i].name; delete YUI.Env._cssLoaded[modName]; if (self.isCSSLoaded(modName)) { self.inserted[modName] = true; delete self.required[modName]; } } self.sorted = []; self._sort(); } d = null; //bail self._insert(); //insert the new deps } } if (d && d.fn) { fn = d.fn; delete d.fn; fn.call(self, d); } } }; this._loading = true; if (!modules.js.length && !modules.css.length) { actions = -1; complete({ fn: self._onSuccess }); return; } if (modules.css.length) { //Load CSS first Y.Get.css(modules.css, { data: modules.cssMods, attributes: self.cssAttributes, insertBefore: self.insertBefore, charset: self.charset, timeout: self.timeout, context: self, onProgress: function(e) { self._onProgress.call(self, e); }, onTimeout: function(d) { self._onTimeout.call(self, d); }, onSuccess: function(d) { d.type = 'success'; d.fn = self._onSuccess; complete.call(self, d); }, onFailure: function(d) { d.type = 'failure'; d.fn = self._onFailure; complete.call(self, d); } }); } if (modules.js.length) { Y.Get.js(modules.js, { data: modules.jsMods, insertBefore: self.insertBefore, attributes: self.jsAttributes, charset: self.charset, timeout: self.timeout, autopurge: false, context: self, async: self.async, onProgress: function(e) { self._onProgress.call(self, e); }, onTimeout: function(d) { self._onTimeout.call(self, d); }, onSuccess: function(d) { d.type = 'success'; d.fn = self._onSuccess; complete.call(self, d); }, onFailure: function(d) { d.type = 'failure'; d.fn = self._onFailure; complete.call(self, d); } }); } }, /** * Once a loader operation is completely finished, process any additional queued items. * @method _continue * @private */ _continue: function() { if (!(_queue.running) && _queue.size() > 0) { _queue.running = true; _queue.next()(); } }, /** * inserts the requested modules and their dependencies. * <code>type</code> can be "js" or "css". Both script and * css are inserted if type is not provided. * @method insert * @param {object} o optional options object. * @param {string} type the type of dependency to insert. */ insert: function(o, type, skipsort) { var self = this, copy = Y.merge(this); delete copy.require; delete copy.dirty; _queue.add(function() { self._insert(copy, o, type, skipsort); }); this._continue(); }, /** * Executed every time a module is loaded, and if we are in a load * cycle, we attempt to load the next script. Public so that it * is possible to call this if using a method other than * Y.register to determine when scripts are fully loaded * @method loadNext * @deprecated * @param {string} mname optional the name of the module that has * been loaded (which is usually why it is time to load the next * one). */ loadNext: function() { return; }, /** * Apply filter defined for this instance to a url/path * @method _filter * @param {string} u the string to filter. * @param {string} name the name of the module, if we are processing * a single module as opposed to a combined url. * @return {string} the filtered string. * @private */ _filter: function(u, name, group) { var f = this.filter, hasFilter = name && (name in this.filters), modFilter = hasFilter && this.filters[name], groupName = group || (this.moduleInfo[name] ? this.moduleInfo[name].group : null); if (groupName && this.groups[groupName] && this.groups[groupName].filter) { modFilter = this.groups[groupName].filter; hasFilter = true; } if (u) { if (hasFilter) { f = (L.isString(modFilter)) ? this.FILTER_DEFS[modFilter.toUpperCase()] || null : modFilter; } if (f) { u = u.replace(new RegExp(f.searchExp, 'g'), f.replaceStr); } } return u; }, /** * Generates the full url for a module * @method _url * @param {string} path the path fragment. * @param {String} name The name of the module * @param {String} [base=self.base] The base url to use * @return {string} the full url. * @private */ _url: function(path, name, base) { return this._filter((base || this.base || '') + path, name); }, /** * Returns an Object hash of file arrays built from `loader.sorted` or from an arbitrary list of sorted modules. * @method resolve * @param {Boolean} [calc=false] Perform a loader.calculate() before anything else * @param {Array} [s=loader.sorted] An override for the loader.sorted array * @return {Object} Object hash (js and css) of two arrays of file lists * @example This method can be used as an off-line dep calculator * * var Y = YUI(); * var loader = new Y.Loader({ * filter: 'debug', * base: '../../', * root: 'build/', * combine: true, * require: ['node', 'dd', 'console'] * }); * var out = loader.resolve(true); * */ resolve: function(calc, s) { var len, i, m, url, group, groupName, j, frag, comboSource, comboSources, mods, comboBase, base, urls, u = [], tmpBase, baseLen, resCombos = {}, self = this, comboSep, maxURLLength, inserted = (self.ignoreRegistered) ? {} : self.inserted, resolved = { js: [], jsMods: [], css: [], cssMods: [] }, type = self.loadType || 'js', addSingle; if (self.skin.overrides || self.skin.defaultSkin !== DEFAULT_SKIN || self.ignoreRegistered) { self._resetModules(); } if (calc) { self.calculate(); } s = s || self.sorted; addSingle = function(m) { if (m) { group = (m.group && self.groups[m.group]) || NOT_FOUND; //Always assume it's async if (group.async === false) { m.async = group.async; } url = (m.fullpath) ? self._filter(m.fullpath, s[i]) : self._url(m.path, s[i], group.base || m.base); if (m.attributes || m.async === false) { url = { url: url, async: m.async }; if (m.attributes) { url.attributes = m.attributes; } } resolved[m.type].push(url); resolved[m.type + 'Mods'].push(m); } else { } }; len = s.length; // the default combo base comboBase = self.comboBase; url = comboBase; comboSources = {}; for (i = 0; i < len; i++) { comboSource = comboBase; m = self.getModule(s[i]); groupName = m && m.group; group = self.groups[groupName]; if (groupName && group) { if (!group.combine || m.fullpath) { //This is not a combo module, skip it and load it singly later. addSingle(m); continue; } m.combine = true; if (group.comboBase) { comboSource = group.comboBase; } if ("root" in group && L.isValue(group.root)) { m.root = group.root; } m.comboSep = group.comboSep || self.comboSep; m.maxURLLength = group.maxURLLength || self.maxURLLength; } else { if (!self.combine) { //This is not a combo module, skip it and load it singly later. addSingle(m); continue; } } comboSources[comboSource] = comboSources[comboSource] || []; comboSources[comboSource].push(m); } for (j in comboSources) { if (comboSources.hasOwnProperty(j)) { resCombos[j] = resCombos[j] || { js: [], jsMods: [], css: [], cssMods: [] }; url = j; mods = comboSources[j]; len = mods.length; if (len) { for (i = 0; i < len; i++) { if (inserted[mods[i]]) { continue; } m = mods[i]; // Do not try to combine non-yui JS unless combo def // is found if (m && (m.combine || !m.ext)) { resCombos[j].comboSep = m.comboSep; resCombos[j].group = m.group; resCombos[j].maxURLLength = m.maxURLLength; frag = ((L.isValue(m.root)) ? m.root : self.root) + (m.path || m.fullpath); frag = self._filter(frag, m.name); resCombos[j][m.type].push(frag); resCombos[j][m.type + 'Mods'].push(m); } else { //Add them to the next process.. if (mods[i]) { addSingle(mods[i]); } } } } } } for (j in resCombos) { if (resCombos.hasOwnProperty(j)) { base = j; comboSep = resCombos[base].comboSep || self.comboSep; maxURLLength = resCombos[base].maxURLLength || self.maxURLLength; for (type in resCombos[base]) { if (type === JS || type === CSS) { urls = resCombos[base][type]; mods = resCombos[base][type + 'Mods']; len = urls.length; tmpBase = base + urls.join(comboSep); baseLen = tmpBase.length; if (maxURLLength <= base.length) { maxURLLength = MAX_URL_LENGTH; } if (len) { if (baseLen > maxURLLength) { u = []; for (s = 0; s < len; s++) { u.push(urls[s]); tmpBase = base + u.join(comboSep); if (tmpBase.length > maxURLLength) { m = u.pop(); tmpBase = base + u.join(comboSep); resolved[type].push(self._filter(tmpBase, null, resCombos[base].group)); u = []; if (m) { u.push(m); } } } if (u.length) { tmpBase = base + u.join(comboSep); resolved[type].push(self._filter(tmpBase, null, resCombos[base].group)); } } else { resolved[type].push(self._filter(tmpBase, null, resCombos[base].group)); } } resolved[type + 'Mods'] = resolved[type + 'Mods'].concat(mods); } } } } resCombos = null; return resolved; }, /** Shortcut to calculate, resolve and load all modules. var loader = new Y.Loader({ ignoreRegistered: true, modules: { mod: { path: 'mod.js' } }, requires: [ 'mod' ] }); loader.load(function() { console.log('All modules have loaded..'); }); @method load @param {Callback} cb Executed after all load operations are complete */ load: function(cb) { if (!cb) { return; } var self = this, out = self.resolve(true); self.data = out; self.onEnd = function() { cb.apply(self.context || self, arguments); }; self.insert(); } }; }, '@VERSION@', {"requires": ["get", "features"]}); YUI.add('loader-rollup', function (Y, NAME) { /** * Optional automatic rollup logic for reducing http connections * when not using a combo service. * @module loader * @submodule rollup */ /** * Look for rollup packages to determine if all of the modules a * rollup supersedes are required. If so, include the rollup to * help reduce the total number of connections required. Called * by calculate(). This is an optional feature, and requires the * appropriate submodule to function. * @method _rollup * @for Loader * @private */ Y.Loader.prototype._rollup = function() { var i, j, m, s, r = this.required, roll, info = this.moduleInfo, rolled, c, smod; // find and cache rollup modules if (this.dirty || !this.rollups) { this.rollups = {}; for (i in info) { if (info.hasOwnProperty(i)) { m = this.getModule(i); // if (m && m.rollup && m.supersedes) { if (m && m.rollup) { this.rollups[i] = m; } } } } // make as many passes as needed to pick up rollup rollups for (;;) { rolled = false; // go through the rollup candidates for (i in this.rollups) { if (this.rollups.hasOwnProperty(i)) { // there can be only one, unless forced if (!r[i] && ((!this.loaded[i]) || this.forceMap[i])) { m = this.getModule(i); s = m.supersedes || []; roll = false; // @TODO remove continue if (!m.rollup) { continue; } c = 0; // check the threshold for (j = 0; j < s.length; j++) { smod = info[s[j]]; // if the superseded module is loaded, we can't // load the rollup unless it has been forced. if (this.loaded[s[j]] && !this.forceMap[s[j]]) { roll = false; break; // increment the counter if this module is required. // if we are beyond the rollup threshold, we will // use the rollup module } else if (r[s[j]] && m.type === smod.type) { c++; roll = (c >= m.rollup); if (roll) { break; } } } if (roll) { // add the rollup r[i] = true; rolled = true; // expand the rollup's dependencies this.getRequires(m); } } } } // if we made it here w/o rolling up something, we are done if (!rolled) { break; } } }; }, '@VERSION@', {"requires": ["loader-base"]}); YUI.add('loader-yui3', function (Y, NAME) { /* This file is auto-generated by (yogi loader --yes --mix --start ../) */ /*jshint maxlen:900, eqeqeq: false */ /** * YUI 3 module metadata * @module loader * @submodule loader-yui3 */ YUI.Env[Y.version].modules = YUI.Env[Y.version].modules || {}; Y.mix(YUI.Env[Y.version].modules, { "align-plugin": { "requires": [ "node-screen", "node-pluginhost" ] }, "anim": { "use": [ "anim-base", "anim-color", "anim-curve", "anim-easing", "anim-node-plugin", "anim-scroll", "anim-xy" ] }, "anim-base": { "requires": [ "base-base", "node-style" ] }, "anim-color": { "requires": [ "anim-base" ] }, "anim-curve": { "requires": [ "anim-xy" ] }, "anim-easing": { "requires": [ "anim-base" ] }, "anim-node-plugin": { "requires": [ "node-pluginhost", "anim-base" ] }, "anim-scroll": { "requires": [ "anim-base" ] }, "anim-shape": { "requires": [ "anim-base", "anim-easing", "anim-color", "matrix" ] }, "anim-shape-transform": { "use": [ "anim-shape" ] }, "anim-xy": { "requires": [ "anim-base", "node-screen" ] }, "app": { "use": [ "app-base", "app-content", "app-transitions", "lazy-model-list", "model", "model-list", "model-sync-rest", "model-sync-local", "router", "view", "view-node-map" ] }, "app-base": { "requires": [ "classnamemanager", "pjax-base", "router", "view" ] }, "app-content": { "requires": [ "app-base", "pjax-content" ] }, "app-transitions": { "requires": [ "app-base" ] }, "app-transitions-css": { "type": "css" }, "app-transitions-native": { "condition": { "name": "app-transitions-native", "test": function (Y) { var doc = Y.config.doc, node = doc ? doc.documentElement : null; if (node && node.style) { return ('MozTransition' in node.style || 'WebkitTransition' in node.style || 'transition' in node.style); } return false; }, "trigger": "app-transitions" }, "requires": [ "app-transitions", "app-transitions-css", "parallel", "transition" ] }, "array-extras": { "requires": [ "yui-base" ] }, "array-invoke": { "requires": [ "yui-base" ] }, "arraylist": { "requires": [ "yui-base" ] }, "arraylist-add": { "requires": [ "arraylist" ] }, "arraylist-filter": { "requires": [ "arraylist" ] }, "arraysort": { "requires": [ "yui-base" ] }, "async-queue": { "requires": [ "event-custom" ] }, "attribute": { "use": [ "attribute-base", "attribute-complex" ] }, "attribute-base": { "requires": [ "attribute-core", "attribute-observable", "attribute-extras" ] }, "attribute-complex": { "requires": [ "attribute-base" ] }, "attribute-core": { "requires": [ "oop" ] }, "attribute-events": { "use": [ "attribute-observable" ] }, "attribute-extras": { "requires": [ "oop" ] }, "attribute-observable": { "requires": [ "event-custom" ] }, "autocomplete": { "use": [ "autocomplete-base", "autocomplete-sources", "autocomplete-list", "autocomplete-plugin" ] }, "autocomplete-base": { "optional": [ "autocomplete-sources" ], "requires": [ "array-extras", "base-build", "escape", "event-valuechange", "node-base" ] }, "autocomplete-filters": { "requires": [ "array-extras", "text-wordbreak" ] }, "autocomplete-filters-accentfold": { "requires": [ "array-extras", "text-accentfold", "text-wordbreak" ] }, "autocomplete-highlighters": { "requires": [ "array-extras", "highlight-base" ] }, "autocomplete-highlighters-accentfold": { "requires": [ "array-extras", "highlight-accentfold" ] }, "autocomplete-list": { "after": [ "autocomplete-sources" ], "lang": [ "en", "es", "hu", "it" ], "requires": [ "autocomplete-base", "event-resize", "node-screen", "selector-css3", "shim-plugin", "widget", "widget-position", "widget-position-align" ], "skinnable": true }, "autocomplete-list-keys": { "condition": { "name": "autocomplete-list-keys", "test": function (Y) { // Only add keyboard support to autocomplete-list if this doesn't appear to // be an iOS or Android-based mobile device. // // There's currently no feasible way to actually detect whether a device has // a hardware keyboard, so this sniff will have to do. It can easily be // overridden by manually loading the autocomplete-list-keys module. // // Worth noting: even though iOS supports bluetooth keyboards, Mobile Safari // doesn't fire the keyboard events used by AutoCompleteList, so there's // no point loading the -keys module even when a bluetooth keyboard may be // available. return !(Y.UA.ios || Y.UA.android); }, "trigger": "autocomplete-list" }, "requires": [ "autocomplete-list", "base-build" ] }, "autocomplete-plugin": { "requires": [ "autocomplete-list", "node-pluginhost" ] }, "autocomplete-sources": { "optional": [ "io-base", "json-parse", "jsonp", "yql" ], "requires": [ "autocomplete-base" ] }, "axes": { "use": [ "axis-numeric", "axis-category", "axis-time", "axis-stacked" ] }, "axes-base": { "use": [ "axis-numeric-base", "axis-category-base", "axis-time-base", "axis-stacked-base" ] }, "axis": { "requires": [ "dom", "widget", "widget-position", "widget-stack", "graphics", "axis-base" ] }, "axis-base": { "requires": [ "classnamemanager", "datatype-number", "datatype-date", "base", "event-custom" ] }, "axis-category": { "requires": [ "axis", "axis-category-base" ] }, "axis-category-base": { "requires": [ "axis-base" ] }, "axis-numeric": { "requires": [ "axis", "axis-numeric-base" ] }, "axis-numeric-base": { "requires": [ "axis-base" ] }, "axis-stacked": { "requires": [ "axis-numeric", "axis-stacked-base" ] }, "axis-stacked-base": { "requires": [ "axis-numeric-base" ] }, "axis-time": { "requires": [ "axis", "axis-time-base" ] }, "axis-time-base": { "requires": [ "axis-base" ] }, "base": { "use": [ "base-base", "base-pluginhost", "base-build" ] }, "base-base": { "requires": [ "attribute-base", "base-core", "base-observable" ] }, "base-build": { "requires": [ "base-base" ] }, "base-core": { "requires": [ "attribute-core" ] }, "base-observable": { "requires": [ "attribute-observable" ] }, "base-pluginhost": { "requires": [ "base-base", "pluginhost" ] }, "button": { "requires": [ "button-core", "cssbutton", "widget" ] }, "button-core": { "requires": [ "attribute-core", "classnamemanager", "node-base", "escape" ] }, "button-group": { "requires": [ "button-plugin", "cssbutton", "widget" ] }, "button-plugin": { "requires": [ "button-core", "cssbutton", "node-pluginhost" ] }, "cache": { "use": [ "cache-base", "cache-offline", "cache-plugin" ] }, "cache-base": { "requires": [ "base" ] }, "cache-offline": { "requires": [ "cache-base", "json" ] }, "cache-plugin": { "requires": [ "plugin", "cache-base" ] }, "calendar": { "requires": [ "calendar-base", "calendarnavigator" ], "skinnable": true }, "calendar-base": { "lang": [ "de", "en", "es", "es-AR", "fr", "hu", "it", "ja", "nb-NO", "nl", "pt-BR", "ru", "zh-Hans", "zh-Hans-CN", "zh-Hant", "zh-Hant-HK", "zh-HANT-TW" ], "requires": [ "widget", "datatype-date", "datatype-date-math", "cssgrids" ], "skinnable": true }, "calendarnavigator": { "requires": [ "plugin", "classnamemanager", "datatype-date", "node" ], "skinnable": true }, "charts": { "use": [ "charts-base" ] }, "charts-base": { "requires": [ "dom", "event-mouseenter", "event-touch", "graphics-group", "axes", "series-pie", "series-line", "series-marker", "series-area", "series-spline", "series-column", "series-bar", "series-areaspline", "series-combo", "series-combospline", "series-line-stacked", "series-marker-stacked", "series-area-stacked", "series-spline-stacked", "series-column-stacked", "series-bar-stacked", "series-areaspline-stacked", "series-combo-stacked", "series-combospline-stacked" ] }, "charts-legend": { "requires": [ "charts-base" ] }, "classnamemanager": { "requires": [ "yui-base" ] }, "clickable-rail": { "requires": [ "slider-base" ] }, "collection": { "use": [ "array-extras", "arraylist", "arraylist-add", "arraylist-filter", "array-invoke" ] }, "color": { "use": [ "color-base", "color-hsl", "color-harmony" ] }, "color-base": { "requires": [ "yui-base" ] }, "color-harmony": { "requires": [ "color-hsl" ] }, "color-hsl": { "requires": [ "color-base" ] }, "color-hsv": { "requires": [ "color-base" ] }, "console": { "lang": [ "en", "es", "hu", "it", "ja" ], "requires": [ "yui-log", "widget" ], "skinnable": true }, "console-filters": { "requires": [ "plugin", "console" ], "skinnable": true }, "content-editable": { "requires": [ "node-base", "editor-selection", "stylesheet", "plugin" ] }, "controller": { "use": [ "router" ] }, "cookie": { "requires": [ "yui-base" ] }, "createlink-base": { "requires": [ "editor-base" ] }, "cssbase": { "after": [ "cssreset", "cssfonts", "cssgrids", "cssreset-context", "cssfonts-context", "cssgrids-context" ], "type": "css" }, "cssbase-context": { "after": [ "cssreset", "cssfonts", "cssgrids", "cssreset-context", "cssfonts-context", "cssgrids-context" ], "type": "css" }, "cssbutton": { "type": "css" }, "cssfonts": { "type": "css" }, "cssfonts-context": { "type": "css" }, "cssgrids": { "optional": [ "cssnormalize" ], "type": "css" }, "cssgrids-base": { "optional": [ "cssnormalize" ], "type": "css" }, "cssgrids-responsive": { "optional": [ "cssnormalize" ], "requires": [ "cssgrids", "cssgrids-responsive-base" ], "type": "css" }, "cssgrids-units": { "optional": [ "cssnormalize" ], "requires": [ "cssgrids-base" ], "type": "css" }, "cssnormalize": { "type": "css" }, "cssnormalize-context": { "type": "css" }, "cssreset": { "type": "css" }, "cssreset-context": { "type": "css" }, "dataschema": { "use": [ "dataschema-base", "dataschema-json", "dataschema-xml", "dataschema-array", "dataschema-text" ] }, "dataschema-array": { "requires": [ "dataschema-base" ] }, "dataschema-base": { "requires": [ "base" ] }, "dataschema-json": { "requires": [ "dataschema-base", "json" ] }, "dataschema-text": { "requires": [ "dataschema-base" ] }, "dataschema-xml": { "requires": [ "dataschema-base" ] }, "datasource": { "use": [ "datasource-local", "datasource-io", "datasource-get", "datasource-function", "datasource-cache", "datasource-jsonschema", "datasource-xmlschema", "datasource-arrayschema", "datasource-textschema", "datasource-polling" ] }, "datasource-arrayschema": { "requires": [ "datasource-local", "plugin", "dataschema-array" ] }, "datasource-cache": { "requires": [ "datasource-local", "plugin", "cache-base" ] }, "datasource-function": { "requires": [ "datasource-local" ] }, "datasource-get": { "requires": [ "datasource-local", "get" ] }, "datasource-io": { "requires": [ "datasource-local", "io-base" ] }, "datasource-jsonschema": { "requires": [ "datasource-local", "plugin", "dataschema-json" ] }, "datasource-local": { "requires": [ "base" ] }, "datasource-polling": { "requires": [ "datasource-local" ] }, "datasource-textschema": { "requires": [ "datasource-local", "plugin", "dataschema-text" ] }, "datasource-xmlschema": { "requires": [ "datasource-local", "plugin", "datatype-xml", "dataschema-xml" ] }, "datatable": { "use": [ "datatable-core", "datatable-table", "datatable-head", "datatable-body", "datatable-base", "datatable-column-widths", "datatable-message", "datatable-mutable", "datatable-sort", "datatable-datasource" ] }, "datatable-base": { "requires": [ "datatable-core", "datatable-table", "datatable-head", "datatable-body", "base-build", "widget" ], "skinnable": true }, "datatable-body": { "requires": [ "datatable-core", "view", "classnamemanager" ] }, "datatable-column-widths": { "requires": [ "datatable-base" ] }, "datatable-core": { "requires": [ "escape", "model-list", "node-event-delegate" ] }, "datatable-datasource": { "requires": [ "datatable-base", "plugin", "datasource-local" ] }, "datatable-foot": { "requires": [ "datatable-core", "view" ] }, "datatable-formatters": { "requires": [ "datatable-body", "datatype-number-format", "datatype-date-format", "escape" ] }, "datatable-head": { "requires": [ "datatable-core", "view", "classnamemanager" ] }, "datatable-highlight": { "requires": [ "datatable-base", "event-hover" ], "skinnable": true }, "datatable-keynav": { "requires": [ "datatable-base" ] }, "datatable-message": { "lang": [ "en", "fr", "es", "hu", "it" ], "requires": [ "datatable-base" ], "skinnable": true }, "datatable-mutable": { "requires": [ "datatable-base" ] }, "datatable-paginator": { "lang": [ "en", "fr" ], "requires": [ "model", "view", "paginator-core", "datatable-foot", "datatable-paginator-templates" ], "skinnable": true }, "datatable-paginator-templates": { "requires": [ "template" ] }, "datatable-scroll": { "requires": [ "datatable-base", "datatable-column-widths", "dom-screen" ], "skinnable": true }, "datatable-sort": { "lang": [ "en", "fr", "es", "hu" ], "requires": [ "datatable-base" ], "skinnable": true }, "datatable-table": { "requires": [ "datatable-core", "datatable-head", "datatable-body", "view", "classnamemanager" ] }, "datatype": { "use": [ "datatype-date", "datatype-number", "datatype-xml" ] }, "datatype-date": { "use": [ "datatype-date-parse", "datatype-date-format", "datatype-date-math" ] }, "datatype-date-format": { "lang": [ "ar", "ar-JO", "ca", "ca-ES", "da", "da-DK", "de", "de-AT", "de-DE", "el", "el-GR", "en", "en-AU", "en-CA", "en-GB", "en-IE", "en-IN", "en-JO", "en-MY", "en-NZ", "en-PH", "en-SG", "en-US", "es", "es-AR", "es-BO", "es-CL", "es-CO", "es-EC", "es-ES", "es-MX", "es-PE", "es-PY", "es-US", "es-UY", "es-VE", "fi", "fi-FI", "fr", "fr-BE", "fr-CA", "fr-FR", "hi", "hi-IN", "hu", "id", "id-ID", "it", "it-IT", "ja", "ja-JP", "ko", "ko-KR", "ms", "ms-MY", "nb", "nb-NO", "nl", "nl-BE", "nl-NL", "pl", "pl-PL", "pt", "pt-BR", "ro", "ro-RO", "ru", "ru-RU", "sv", "sv-SE", "th", "th-TH", "tr", "tr-TR", "vi", "vi-VN", "zh-Hans", "zh-Hans-CN", "zh-Hant", "zh-Hant-HK", "zh-Hant-TW" ] }, "datatype-date-math": { "requires": [ "yui-base" ] }, "datatype-date-parse": {}, "datatype-number": { "use": [ "datatype-number-parse", "datatype-number-format" ] }, "datatype-number-format": {}, "datatype-number-parse": { "requires": [ "escape" ] }, "datatype-xml": { "use": [ "datatype-xml-parse", "datatype-xml-format" ] }, "datatype-xml-format": {}, "datatype-xml-parse": {}, "dd": { "use": [ "dd-ddm-base", "dd-ddm", "dd-ddm-drop", "dd-drag", "dd-proxy", "dd-constrain", "dd-drop", "dd-scroll", "dd-delegate" ] }, "dd-constrain": { "requires": [ "dd-drag" ] }, "dd-ddm": { "requires": [ "dd-ddm-base", "event-resize" ] }, "dd-ddm-base": { "requires": [ "node", "base", "yui-throttle", "classnamemanager" ] }, "dd-ddm-drop": { "requires": [ "dd-ddm" ] }, "dd-delegate": { "requires": [ "dd-drag", "dd-drop-plugin", "event-mouseenter" ] }, "dd-drag": { "requires": [ "dd-ddm-base" ] }, "dd-drop": { "requires": [ "dd-drag", "dd-ddm-drop" ] }, "dd-drop-plugin": { "requires": [ "dd-drop" ] }, "dd-gestures": { "condition": { "name": "dd-gestures", "trigger": "dd-drag", "ua": "touchEnabled" }, "requires": [ "dd-drag", "event-synthetic", "event-gestures" ] }, "dd-plugin": { "optional": [ "dd-constrain", "dd-proxy" ], "requires": [ "dd-drag" ] }, "dd-proxy": { "requires": [ "dd-drag" ] }, "dd-scroll": { "requires": [ "dd-drag" ] }, "dial": { "lang": [ "en", "es", "hu" ], "requires": [ "widget", "dd-drag", "event-mouseenter", "event-move", "event-key", "transition", "intl" ], "skinnable": true }, "dom": { "use": [ "dom-base", "dom-screen", "dom-style", "selector-native", "selector" ] }, "dom-base": { "requires": [ "dom-core" ] }, "dom-core": { "requires": [ "oop", "features" ] }, "dom-screen": { "requires": [ "dom-base", "dom-style" ] }, "dom-style": { "requires": [ "dom-base", "color-base" ] }, "dom-style-ie": { "condition": { "name": "dom-style-ie", "test": function (Y) { var testFeature = Y.Features.test, addFeature = Y.Features.add, WINDOW = Y.config.win, DOCUMENT = Y.config.doc, DOCUMENT_ELEMENT = 'documentElement', ret = false; addFeature('style', 'computedStyle', { test: function() { return WINDOW && 'getComputedStyle' in WINDOW; } }); addFeature('style', 'opacity', { test: function() { return DOCUMENT && 'opacity' in DOCUMENT[DOCUMENT_ELEMENT].style; } }); ret = (!testFeature('style', 'opacity') && !testFeature('style', 'computedStyle')); return ret; }, "trigger": "dom-style" }, "requires": [ "dom-style" ] }, "dump": { "requires": [ "yui-base" ] }, "editor": { "use": [ "frame", "editor-selection", "exec-command", "editor-base", "editor-para", "editor-br", "editor-bidi", "editor-tab", "createlink-base" ] }, "editor-base": { "requires": [ "base", "frame", "node", "exec-command", "editor-selection" ] }, "editor-bidi": { "requires": [ "editor-base" ] }, "editor-br": { "requires": [ "editor-base" ] }, "editor-inline": { "requires": [ "editor-base", "content-editable" ] }, "editor-lists": { "requires": [ "editor-base" ] }, "editor-para": { "requires": [ "editor-para-base" ] }, "editor-para-base": { "requires": [ "editor-base" ] }, "editor-para-ie": { "condition": { "name": "editor-para-ie", "trigger": "editor-para", "ua": "ie", "when": "instead" }, "requires": [ "editor-para-base" ] }, "editor-selection": { "requires": [ "node" ] }, "editor-tab": { "requires": [ "editor-base" ] }, "escape": { "requires": [ "yui-base" ] }, "event": { "after": [ "node-base" ], "use": [ "event-base", "event-delegate", "event-synthetic", "event-mousewheel", "event-mouseenter", "event-key", "event-focus", "event-resize", "event-hover", "event-outside", "event-touch", "event-move", "event-flick", "event-valuechange", "event-tap" ] }, "event-base": { "after": [ "node-base" ], "requires": [ "event-custom-base" ] }, "event-base-ie": { "after": [ "event-base" ], "condition": { "name": "event-base-ie", "test": function(Y) { var imp = Y.config.doc && Y.config.doc.implementation; return (imp && (!imp.hasFeature('Events', '2.0'))); }, "trigger": "node-base" }, "requires": [ "node-base" ] }, "event-contextmenu": { "requires": [ "event-synthetic", "dom-screen" ] }, "event-custom": { "use": [ "event-custom-base", "event-custom-complex" ] }, "event-custom-base": { "requires": [ "oop" ] }, "event-custom-complex": { "requires": [ "event-custom-base" ] }, "event-delegate": { "requires": [ "node-base" ] }, "event-flick": { "requires": [ "node-base", "event-touch", "event-synthetic" ] }, "event-focus": { "requires": [ "event-synthetic" ] }, "event-gestures": { "use": [ "event-flick", "event-move" ] }, "event-hover": { "requires": [ "event-mouseenter" ] }, "event-key": { "requires": [ "event-synthetic" ] }, "event-mouseenter": { "requires": [ "event-synthetic" ] }, "event-mousewheel": { "requires": [ "node-base" ] }, "event-move": { "requires": [ "node-base", "event-touch", "event-synthetic" ] }, "event-outside": { "requires": [ "event-synthetic" ] }, "event-resize": { "requires": [ "node-base", "event-synthetic" ] }, "event-simulate": { "requires": [ "event-base" ] }, "event-synthetic": { "requires": [ "node-base", "event-custom-complex" ] }, "event-tap": { "requires": [ "node-base", "event-base", "event-touch", "event-synthetic" ] }, "event-touch": { "requires": [ "node-base" ] }, "event-valuechange": { "requires": [ "event-focus", "event-synthetic" ] }, "exec-command": { "requires": [ "frame" ] }, "features": { "requires": [ "yui-base" ] }, "file": { "requires": [ "file-flash", "file-html5" ] }, "file-flash": { "requires": [ "base" ] }, "file-html5": { "requires": [ "base" ] }, "frame": { "requires": [ "base", "node", "plugin", "selector-css3", "yui-throttle" ] }, "gesture-simulate": { "requires": [ "async-queue", "event-simulate", "node-screen" ] }, "get": { "requires": [ "yui-base" ] }, "graphics": { "requires": [ "node", "event-custom", "pluginhost", "matrix", "classnamemanager" ] }, "graphics-canvas": { "condition": { "name": "graphics-canvas", "test": function(Y) { var DOCUMENT = Y.config.doc, useCanvas = Y.config.defaultGraphicEngine && Y.config.defaultGraphicEngine == "canvas", canvas = DOCUMENT && DOCUMENT.createElement("canvas"), svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); return (!svg || useCanvas) && (canvas && canvas.getContext && canvas.getContext("2d")); }, "trigger": "graphics" }, "requires": [ "graphics" ] }, "graphics-canvas-default": { "condition": { "name": "graphics-canvas-default", "test": function(Y) { var DOCUMENT = Y.config.doc, useCanvas = Y.config.defaultGraphicEngine && Y.config.defaultGraphicEngine == "canvas", canvas = DOCUMENT && DOCUMENT.createElement("canvas"), svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); return (!svg || useCanvas) && (canvas && canvas.getContext && canvas.getContext("2d")); }, "trigger": "graphics" } }, "graphics-group": { "requires": [ "graphics" ] }, "graphics-svg": { "condition": { "name": "graphics-svg", "test": function(Y) { var DOCUMENT = Y.config.doc, useSVG = !Y.config.defaultGraphicEngine || Y.config.defaultGraphicEngine != "canvas", canvas = DOCUMENT && DOCUMENT.createElement("canvas"), svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); return svg && (useSVG || !canvas); }, "trigger": "graphics" }, "requires": [ "graphics" ] }, "graphics-svg-default": { "condition": { "name": "graphics-svg-default", "test": function(Y) { var DOCUMENT = Y.config.doc, useSVG = !Y.config.defaultGraphicEngine || Y.config.defaultGraphicEngine != "canvas", canvas = DOCUMENT && DOCUMENT.createElement("canvas"), svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); return svg && (useSVG || !canvas); }, "trigger": "graphics" } }, "graphics-vml": { "condition": { "name": "graphics-vml", "test": function(Y) { var DOCUMENT = Y.config.doc, canvas = DOCUMENT && DOCUMENT.createElement("canvas"); return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d"))); }, "trigger": "graphics" }, "requires": [ "graphics" ] }, "graphics-vml-default": { "condition": { "name": "graphics-vml-default", "test": function(Y) { var DOCUMENT = Y.config.doc, canvas = DOCUMENT && DOCUMENT.createElement("canvas"); return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d"))); }, "trigger": "graphics" } }, "handlebars": { "use": [ "handlebars-compiler" ] }, "handlebars-base": { "requires": [] }, "handlebars-compiler": { "requires": [ "handlebars-base" ] }, "highlight": { "use": [ "highlight-base", "highlight-accentfold" ] }, "highlight-accentfold": { "requires": [ "highlight-base", "text-accentfold" ] }, "highlight-base": { "requires": [ "array-extras", "classnamemanager", "escape", "text-wordbreak" ] }, "history": { "use": [ "history-base", "history-hash", "history-hash-ie", "history-html5" ] }, "history-base": { "requires": [ "event-custom-complex" ] }, "history-hash": { "after": [ "history-html5" ], "requires": [ "event-synthetic", "history-base", "yui-later" ] }, "history-hash-ie": { "condition": { "name": "history-hash-ie", "test": function (Y) { var docMode = Y.config.doc && Y.config.doc.documentMode; return Y.UA.ie && (!('onhashchange' in Y.config.win) || !docMode || docMode < 8); }, "trigger": "history-hash" }, "requires": [ "history-hash", "node-base" ] }, "history-html5": { "optional": [ "json" ], "requires": [ "event-base", "history-base", "node-base" ] }, "imageloader": { "requires": [ "base-base", "node-style", "node-screen" ] }, "intl": { "requires": [ "intl-base", "event-custom" ] }, "intl-base": { "requires": [ "yui-base" ] }, "io": { "use": [ "io-base", "io-xdr", "io-form", "io-upload-iframe", "io-queue" ] }, "io-base": { "requires": [ "event-custom-base", "querystring-stringify-simple" ] }, "io-form": { "requires": [ "io-base", "node-base" ] }, "io-nodejs": { "condition": { "name": "io-nodejs", "trigger": "io-base", "ua": "nodejs" }, "requires": [ "io-base" ] }, "io-queue": { "requires": [ "io-base", "queue-promote" ] }, "io-upload-iframe": { "requires": [ "io-base", "node-base" ] }, "io-xdr": { "requires": [ "io-base", "datatype-xml-parse" ] }, "json": { "use": [ "json-parse", "json-stringify" ] }, "json-parse": { "requires": [ "yui-base" ] }, "json-parse-shim": { "condition": { "name": "json-parse-shim", "test": function (Y) { var _JSON = Y.config.global.JSON, Native = Object.prototype.toString.call(_JSON) === '[object JSON]' && _JSON, nativeSupport = Y.config.useNativeJSONParse !== false && !!Native; function workingNative( k, v ) { return k === "ok" ? true : v; } // Double check basic functionality. This is mainly to catch early broken // implementations of the JSON API in Firefox 3.1 beta1 and beta2 if ( nativeSupport ) { try { nativeSupport = ( Native.parse( '{"ok":false}', workingNative ) ).ok; } catch ( e ) { nativeSupport = false; } } return !nativeSupport; }, "trigger": "json-parse" }, "requires": [ "json-parse" ] }, "json-stringify": { "requires": [ "yui-base" ] }, "json-stringify-shim": { "condition": { "name": "json-stringify-shim", "test": function (Y) { var _JSON = Y.config.global.JSON, Native = Object.prototype.toString.call(_JSON) === '[object JSON]' && _JSON, nativeSupport = Y.config.useNativeJSONStringify !== false && !!Native; // Double check basic native functionality. This is primarily to catch broken // early JSON API implementations in Firefox 3.1 beta1 and beta2. if ( nativeSupport ) { try { nativeSupport = ( '0' === Native.stringify(0) ); } catch ( e ) { nativeSupport = false; } } return !nativeSupport; }, "trigger": "json-stringify" }, "requires": [ "json-stringify" ] }, "jsonp": { "requires": [ "get", "oop" ] }, "jsonp-url": { "requires": [ "jsonp" ] }, "lazy-model-list": { "requires": [ "model-list" ] }, "loader": { "use": [ "loader-base", "loader-rollup", "loader-yui3" ] }, "loader-base": { "requires": [ "get", "features" ] }, "loader-rollup": { "requires": [ "loader-base" ] }, "loader-yui3": { "requires": [ "loader-base" ] }, "matrix": { "requires": [ "yui-base" ] }, "model": { "requires": [ "base-build", "escape", "json-parse" ] }, "model-list": { "requires": [ "array-extras", "array-invoke", "arraylist", "base-build", "escape", "json-parse", "model" ] }, "model-sync-local": { "requires": [ "model", "json-stringify" ] }, "model-sync-rest": { "requires": [ "model", "io-base", "json-stringify" ] }, "node": { "use": [ "node-base", "node-event-delegate", "node-pluginhost", "node-screen", "node-style" ] }, "node-base": { "requires": [ "event-base", "node-core", "dom-base", "dom-style" ] }, "node-core": { "requires": [ "dom-core", "selector" ] }, "node-event-delegate": { "requires": [ "node-base", "event-delegate" ] }, "node-event-html5": { "requires": [ "node-base" ] }, "node-event-simulate": { "requires": [ "node-base", "event-simulate", "gesture-simulate" ] }, "node-flick": { "requires": [ "classnamemanager", "transition", "event-flick", "plugin" ], "skinnable": true }, "node-focusmanager": { "requires": [ "attribute", "node", "plugin", "node-event-simulate", "event-key", "event-focus" ] }, "node-load": { "requires": [ "node-base", "io-base" ] }, "node-menunav": { "requires": [ "node", "classnamemanager", "plugin", "node-focusmanager" ], "skinnable": true }, "node-pluginhost": { "requires": [ "node-base", "pluginhost" ] }, "node-screen": { "requires": [ "dom-screen", "node-base" ] }, "node-scroll-info": { "requires": [ "array-extras", "base-build", "event-resize", "node-pluginhost", "plugin", "selector" ] }, "node-style": { "requires": [ "dom-style", "node-base" ] }, "oop": { "requires": [ "yui-base" ] }, "overlay": { "requires": [ "widget", "widget-stdmod", "widget-position", "widget-position-align", "widget-stack", "widget-position-constrain" ], "skinnable": true }, "paginator": { "requires": [ "paginator-core" ] }, "paginator-core": { "requires": [ "base" ] }, "paginator-url": { "requires": [ "paginator" ] }, "panel": { "requires": [ "widget", "widget-autohide", "widget-buttons", "widget-modality", "widget-position", "widget-position-align", "widget-position-constrain", "widget-stack", "widget-stdmod" ], "skinnable": true }, "parallel": { "requires": [ "yui-base" ] }, "pjax": { "requires": [ "pjax-base", "pjax-content" ] }, "pjax-base": { "requires": [ "classnamemanager", "node-event-delegate", "router" ] }, "pjax-content": { "requires": [ "io-base", "node-base", "router" ] }, "pjax-plugin": { "requires": [ "node-pluginhost", "pjax", "plugin" ] }, "plugin": { "requires": [ "base-base" ] }, "pluginhost": { "use": [ "pluginhost-base", "pluginhost-config" ] }, "pluginhost-base": { "requires": [ "yui-base" ] }, "pluginhost-config": { "requires": [ "pluginhost-base" ] }, "promise": { "requires": [ "timers" ] }, "querystring": { "use": [ "querystring-parse", "querystring-stringify" ] }, "querystring-parse": { "requires": [ "yui-base", "array-extras" ] }, "querystring-parse-simple": { "requires": [ "yui-base" ] }, "querystring-stringify": { "requires": [ "yui-base" ] }, "querystring-stringify-simple": { "requires": [ "yui-base" ] }, "queue-promote": { "requires": [ "yui-base" ] }, "range-slider": { "requires": [ "slider-base", "slider-value-range", "clickable-rail" ] }, "recordset": { "use": [ "recordset-base", "recordset-sort", "recordset-filter", "recordset-indexer" ] }, "recordset-base": { "requires": [ "base", "arraylist" ] }, "recordset-filter": { "requires": [ "recordset-base", "array-extras", "plugin" ] }, "recordset-indexer": { "requires": [ "recordset-base", "plugin" ] }, "recordset-sort": { "requires": [ "arraysort", "recordset-base", "plugin" ] }, "resize": { "use": [ "resize-base", "resize-proxy", "resize-constrain" ] }, "resize-base": { "requires": [ "base", "widget", "event", "oop", "dd-drag", "dd-delegate", "dd-drop" ], "skinnable": true }, "resize-constrain": { "requires": [ "plugin", "resize-base" ] }, "resize-plugin": { "optional": [ "resize-constrain" ], "requires": [ "resize-base", "plugin" ] }, "resize-proxy": { "requires": [ "plugin", "resize-base" ] }, "router": { "optional": [ "querystring-parse" ], "requires": [ "array-extras", "base-build", "history" ] }, "scrollview": { "requires": [ "scrollview-base", "scrollview-scrollbars" ] }, "scrollview-base": { "requires": [ "widget", "event-gestures", "event-mousewheel", "transition" ], "skinnable": true }, "scrollview-base-ie": { "condition": { "name": "scrollview-base-ie", "trigger": "scrollview-base", "ua": "ie" }, "requires": [ "scrollview-base" ] }, "scrollview-list": { "requires": [ "plugin", "classnamemanager" ], "skinnable": true }, "scrollview-paginator": { "requires": [ "plugin", "classnamemanager" ] }, "scrollview-scrollbars": { "requires": [ "classnamemanager", "transition", "plugin" ], "skinnable": true }, "selector": { "requires": [ "selector-native" ] }, "selector-css2": { "condition": { "name": "selector-css2", "test": function (Y) { var DOCUMENT = Y.config.doc, ret = DOCUMENT && !('querySelectorAll' in DOCUMENT); return ret; }, "trigger": "selector" }, "requires": [ "selector-native" ] }, "selector-css3": { "requires": [ "selector-native", "selector-css2" ] }, "selector-native": { "requires": [ "dom-base" ] }, "series-area": { "requires": [ "series-cartesian", "series-fill-util" ] }, "series-area-stacked": { "requires": [ "series-stacked", "series-area" ] }, "series-areaspline": { "requires": [ "series-area", "series-curve-util" ] }, "series-areaspline-stacked": { "requires": [ "series-stacked", "series-areaspline" ] }, "series-bar": { "requires": [ "series-marker", "series-histogram-base" ] }, "series-bar-stacked": { "requires": [ "series-stacked", "series-bar" ] }, "series-base": { "requires": [ "graphics", "axis-base" ] }, "series-candlestick": { "requires": [ "series-range" ] }, "series-cartesian": { "requires": [ "series-base" ] }, "series-column": { "requires": [ "series-marker", "series-histogram-base" ] }, "series-column-stacked": { "requires": [ "series-stacked", "series-column" ] }, "series-combo": { "requires": [ "series-cartesian", "series-line-util", "series-plot-util", "series-fill-util" ] }, "series-combo-stacked": { "requires": [ "series-stacked", "series-combo" ] }, "series-combospline": { "requires": [ "series-combo", "series-curve-util" ] }, "series-combospline-stacked": { "requires": [ "series-combo-stacked", "series-curve-util" ] }, "series-curve-util": {}, "series-fill-util": {}, "series-histogram-base": { "requires": [ "series-cartesian", "series-plot-util" ] }, "series-line": { "requires": [ "series-cartesian", "series-line-util" ] }, "series-line-stacked": { "requires": [ "series-stacked", "series-line" ] }, "series-line-util": {}, "series-marker": { "requires": [ "series-cartesian", "series-plot-util" ] }, "series-marker-stacked": { "requires": [ "series-stacked", "series-marker" ] }, "series-ohlc": { "requires": [ "series-range" ] }, "series-pie": { "requires": [ "series-base", "series-plot-util" ] }, "series-plot-util": {}, "series-range": { "requires": [ "series-cartesian" ] }, "series-spline": { "requires": [ "series-line", "series-curve-util" ] }, "series-spline-stacked": { "requires": [ "series-stacked", "series-spline" ] }, "series-stacked": { "requires": [ "axis-stacked" ] }, "shim-plugin": { "requires": [ "node-style", "node-pluginhost" ] }, "slider": { "use": [ "slider-base", "slider-value-range", "clickable-rail", "range-slider" ] }, "slider-base": { "requires": [ "widget", "dd-constrain", "event-key" ], "skinnable": true }, "slider-value-range": { "requires": [ "slider-base" ] }, "sortable": { "requires": [ "dd-delegate", "dd-drop-plugin", "dd-proxy" ] }, "sortable-scroll": { "requires": [ "dd-scroll", "sortable" ] }, "stylesheet": { "requires": [ "yui-base" ] }, "substitute": { "optional": [ "dump" ], "requires": [ "yui-base" ] }, "swf": { "requires": [ "event-custom", "node", "swfdetect", "escape" ] }, "swfdetect": { "requires": [ "yui-base" ] }, "tabview": { "requires": [ "widget", "widget-parent", "widget-child", "tabview-base", "node-pluginhost", "node-focusmanager" ], "skinnable": true }, "tabview-base": { "requires": [ "node-event-delegate", "classnamemanager" ] }, "tabview-plugin": { "requires": [ "tabview-base" ] }, "template": { "use": [ "template-base", "template-micro" ] }, "template-base": { "requires": [ "yui-base" ] }, "template-micro": { "requires": [ "escape" ] }, "test": { "requires": [ "event-simulate", "event-custom", "json-stringify" ] }, "test-console": { "requires": [ "console-filters", "test", "array-extras" ], "skinnable": true }, "text": { "use": [ "text-accentfold", "text-wordbreak" ] }, "text-accentfold": { "requires": [ "array-extras", "text-data-accentfold" ] }, "text-data-accentfold": { "requires": [ "yui-base" ] }, "text-data-wordbreak": { "requires": [ "yui-base" ] }, "text-wordbreak": { "requires": [ "array-extras", "text-data-wordbreak" ] }, "timers": { "requires": [ "yui-base" ] }, "transition": { "requires": [ "node-style" ] }, "transition-timer": { "condition": { "name": "transition-timer", "test": function (Y) { var DOCUMENT = Y.config.doc, node = (DOCUMENT) ? DOCUMENT.documentElement: null, ret = true; if (node && node.style) { ret = !('MozTransition' in node.style || 'WebkitTransition' in node.style || 'transition' in node.style); } return ret; }, "trigger": "transition" }, "requires": [ "transition" ] }, "tree": { "requires": [ "base-build", "tree-node" ] }, "tree-labelable": { "requires": [ "tree" ] }, "tree-lazy": { "requires": [ "base-pluginhost", "plugin", "tree" ] }, "tree-node": {}, "tree-openable": { "requires": [ "tree" ] }, "tree-selectable": { "requires": [ "tree" ] }, "tree-sortable": { "requires": [ "tree" ] }, "uploader": { "requires": [ "uploader-html5", "uploader-flash" ] }, "uploader-flash": { "requires": [ "swfdetect", "escape", "widget", "base", "cssbutton", "node", "event-custom", "uploader-queue" ] }, "uploader-html5": { "requires": [ "widget", "node-event-simulate", "file-html5", "uploader-queue" ] }, "uploader-queue": { "requires": [ "base" ] }, "view": { "requires": [ "base-build", "node-event-delegate" ] }, "view-node-map": { "requires": [ "view" ] }, "widget": { "use": [ "widget-base", "widget-htmlparser", "widget-skin", "widget-uievents" ] }, "widget-anim": { "requires": [ "anim-base", "plugin", "widget" ] }, "widget-autohide": { "requires": [ "base-build", "event-key", "event-outside", "widget" ] }, "widget-base": { "requires": [ "attribute", "base-base", "base-pluginhost", "classnamemanager", "event-focus", "node-base", "node-style" ], "skinnable": true }, "widget-base-ie": { "condition": { "name": "widget-base-ie", "trigger": "widget-base", "ua": "ie" }, "requires": [ "widget-base" ] }, "widget-buttons": { "requires": [ "button-plugin", "cssbutton", "widget-stdmod" ] }, "widget-child": { "requires": [ "base-build", "widget" ] }, "widget-htmlparser": { "requires": [ "widget-base" ] }, "widget-modality": { "requires": [ "base-build", "event-outside", "widget" ], "skinnable": true }, "widget-parent": { "requires": [ "arraylist", "base-build", "widget" ] }, "widget-position": { "requires": [ "base-build", "node-screen", "widget" ] }, "widget-position-align": { "requires": [ "widget-position" ] }, "widget-position-constrain": { "requires": [ "widget-position" ] }, "widget-skin": { "requires": [ "widget-base" ] }, "widget-stack": { "requires": [ "base-build", "widget" ], "skinnable": true }, "widget-stdmod": { "requires": [ "base-build", "widget" ] }, "widget-uievents": { "requires": [ "node-event-delegate", "widget-base" ] }, "yql": { "requires": [ "oop" ] }, "yql-jsonp": { "condition": { "name": "yql-jsonp", "test": function (Y) { /* Only load the JSONP module when not in nodejs or winjs TODO Make the winjs module a CORS module */ return (!Y.UA.nodejs && !Y.UA.winjs); }, "trigger": "yql", "when": "after" }, "requires": [ "jsonp", "jsonp-url" ] }, "yql-nodejs": { "condition": { "name": "yql-nodejs", "trigger": "yql", "ua": "nodejs", "when": "after" } }, "yql-winjs": { "condition": { "name": "yql-winjs", "trigger": "yql", "ua": "winjs", "when": "after" } }, "yui": {}, "yui-base": {}, "yui-later": { "requires": [ "yui-base" ] }, "yui-log": { "requires": [ "yui-base" ] }, "yui-throttle": { "requires": [ "yui-base" ] } }); YUI.Env[Y.version].md5 = '7becfe88413f127e331d461de8ec774c'; }, '@VERSION@', {"requires": ["loader-base"]}); YUI.add('loader', function (Y, NAME) {}, '@VERSION@', {"use": ["loader-base", "loader-rollup", "loader-yui3"]});
tkirda/cdnjs
ajax/libs/yui/3.14.1/loader/loader.js
JavaScript
mit
157,576
/* Translators (2009 onwards): * - Fulup */ /** * @requires OpenLayers/Lang.js */ /** * Namespace: OpenLayers.Lang["br"] * Dictionary for Brezhoneg. Keys for entries are used in calls to * <OpenLayers.Lang.translate>. Entry bodies are normal strings or * strings formatted for use with <OpenLayers.String.format> calls. */ OpenLayers.Lang["br"] = OpenLayers.Util.applyDefaults({ 'unhandledRequest': "Distro evel reked anveret ${statusText}", 'Permalink': "Peurliamm", 'Overlays': "Gwiskadoù", 'Base Layer': "Gwiskad diazez", 'noFID': "N\'haller ket hizivaat un elfenn ma n\'eus ket a niverenn-anaout (FID) eviti.", 'browserNotSupported': "N\'eo ket skoret an daskor vektorel gant ho merdeer. Setu aze an daskorerioù skoret evit ar poent :\n${renderers}", 'minZoomLevelError': "Ne zleer implijout ar perzh minZoomLevel nemet evit gwiskadoù FixedZoomLevels-descendent. Ar fed ma wiria ar gwiskad WHS-se hag-eñ ez eus eus minZoomLevel zo un aspadenn gozh. Koulskoude n\'omp ket evit e ziverkañ kuit da derriñ arloadoù diazezet war OL a c\'hallfe bezañ stag outañ. Setu perak eo dispredet -- Lamet kuit e vo ar gwiriañ minZoomLevel a-is er stumm 3.0. Ober gant an arventennoù bihanañ/brasañ evel deskrivet amañ e plas : http://trac.openlayers.org/wiki/SettingZoomLevels", 'commitSuccess': "Treuzgread WFS : MAT EO ${response}", 'commitFailed': "Treuzgread WFS Transaction: C\'HWITET ${response}", 'googleWarning': "N\'eus ket bet gallet kargañ ar gwiskad Google ent reizh.\x3cbr\x3e\x3cbr\x3eEvit en em zizober eus ar c\'hemenn-mañ, dibabit ur BaseLayer nevez en diuzer gwiskadoù er c\'horn dehoù el laez.\x3cbr\x3e\x3cbr\x3eSur a-walc\'h eo peogwir n\'eo ket bet ensoc\'het levraoueg Google Maps pe neuze ne glot ket an alc\'hwez API gant ho lec\'hienn.\x3cbr\x3e\x3cbr\x3eDiorroerien : Evit reizhañ an dra-se, \x3ca href=\'http://trac.openlayers.org/wiki/Google\' target=\'_blank\'\x3eclick here\x3c/a\x3e", 'getLayerWarning': "N\'haller ket kargañ ar gwiskad ${layerType} ent reizh.\x3cbr\x3e\x3cbr\x3eEvit en em zizober eus ar c\'hemenn-mañ, dibabit ur BaseLayer nevez en diuzer gwiskadoù er c\'horn dehoù el laez.\x3cbr\x3e\x3cbr\x3eSur a-walc\'h eo peogwir n\'eo ket bet ensoc\'het mat al levraoueg ${layerLib}.\x3cbr\x3e\x3cbr\x3eDiorroerien : Evit gouzout penaos reizhañ an dra-se, \x3ca href=\'http://trac.openlayers.org/wiki/${layerLib}\' target=\'_blank\'\x3eclick here\x3c/a\x3e", 'Scale = 1 : ${scaleDenom}': "Skeul = 1 : ${scaleDenom}", 'W': "K", 'E': "R", 'N': "N", 'S': "S", 'reprojectDeprecated': "Emaoc\'h oc\'h implijout an dibarzh \'reproject\' war ar gwiskad ${layerName}. Dispredet eo an dibarzh-mañ : bet eo hag e talveze da ziskwel roadennoù war-c\'horre kartennoù diazez kenwerzhel, un dra hag a c\'haller ober bremañ gant an arc\'hwel dre skor banndres boullek Mercator. Muioc\'h a ditouroù a c\'haller da gaout war http://trac.openlayers.org/wiki/SphericalMercator.", 'methodDeprecated': "Dispredet eo an daore-se ha tennet e vo kuit eus ar stumm 3.0. Grit gant ${newMethod} e plas." });
willdady/cdnjs
ajax/libs/openlayers/2.12/lib/OpenLayers/Lang/br.js
JavaScript
mit
3,153
<?php /* * This file is part of SwiftMailer. * (c) 2004-2009 Chris Corbyn * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ /** * SendmailTransport for sending mail through a Sendmail/Postfix (etc..) binary. * * @package Swift * @subpackage Transport * @author Chris Corbyn */ class Swift_SendmailTransport extends Swift_Transport_SendmailTransport { /** * Create a new SendmailTransport, optionally using $command for sending. * * @param string $command */ public function __construct($command = '/usr/sbin/sendmail -bs') { call_user_func_array( array($this, 'Swift_Transport_SendmailTransport::__construct'), Swift_DependencyContainer::getInstance() ->createDependenciesFor('transport.sendmail') ); $this->setCommand($command); } /** * Create a new SendmailTransport instance. * * @param string $command * * @return Swift_SendmailTransport */ public static function newInstance($command = '/usr/sbin/sendmail -bs') { return new self($command); } }
sensukho/Portalc
vendor/swiftmailer/swiftmailer/lib/classes/Swift/SendmailTransport.php
PHP
mit
1,211
/** * @license AngularJS v1.3.13 * (c) 2010-2014 Google, Inc. http://angularjs.org * License: MIT */ (function(window, document, undefined) {'use strict'; /** * @description * * This object provides a utility for producing rich Error messages within * Angular. It can be called as follows: * * var exampleMinErr = minErr('example'); * throw exampleMinErr('one', 'This {0} is {1}', foo, bar); * * The above creates an instance of minErr in the example namespace. The * resulting error will have a namespaced error code of example.one. The * resulting error will replace {0} with the value of foo, and {1} with the * value of bar. The object is not restricted in the number of arguments it can * take. * * If fewer arguments are specified than necessary for interpolation, the extra * interpolation markers will be preserved in the final string. * * Since data will be parsed statically during a build step, some restrictions * are applied with respect to how minErr instances are created and called. * Instances should have names of the form namespaceMinErr for a minErr created * using minErr('namespace') . Error codes, namespaces and template strings * should all be static strings, not variables or general expressions. * * @param {string} module The namespace to use for the new minErr instance. * @param {function} ErrorConstructor Custom error constructor to be instantiated when returning * error from returned function, for cases when a particular type of error is useful. * @returns {function(code:string, template:string, ...templateArgs): Error} minErr instance */ function minErr(module, ErrorConstructor) { ErrorConstructor = ErrorConstructor || Error; return function() { var code = arguments[0], prefix = '[' + (module ? module + ':' : '') + code + '] ', template = arguments[1], templateArgs = arguments, message, i; message = prefix + template.replace(/\{\d+\}/g, function(match) { var index = +match.slice(1, -1), arg; if (index + 2 < templateArgs.length) { return toDebugString(templateArgs[index + 2]); } return match; }); message = message + '\nhttp://errors.angularjs.org/1.3.13/' + (module ? module + '/' : '') + code; for (i = 2; i < arguments.length; i++) { message = message + (i == 2 ? '?' : '&') + 'p' + (i - 2) + '=' + encodeURIComponent(toDebugString(arguments[i])); } return new ErrorConstructor(message); }; } /* We need to tell jshint what variables are being exported */ /* global angular: true, msie: true, jqLite: true, jQuery: true, slice: true, splice: true, push: true, toString: true, ngMinErr: true, angularModule: true, uid: true, REGEX_STRING_REGEXP: true, VALIDITY_STATE_PROPERTY: true, lowercase: true, uppercase: true, manualLowercase: true, manualUppercase: true, nodeName_: true, isArrayLike: true, forEach: true, sortedKeys: true, forEachSorted: true, reverseParams: true, nextUid: true, setHashKey: true, extend: true, int: true, inherit: true, noop: true, identity: true, valueFn: true, isUndefined: true, isDefined: true, isObject: true, isString: true, isNumber: true, isDate: true, isArray: true, isFunction: true, isRegExp: true, isWindow: true, isScope: true, isFile: true, isFormData: true, isBlob: true, isBoolean: true, isPromiseLike: true, trim: true, escapeForRegexp: true, isElement: true, makeMap: true, includes: true, arrayRemove: true, copy: true, shallowCopy: true, equals: true, csp: true, concat: true, sliceArgs: true, bind: true, toJsonReplacer: true, toJson: true, fromJson: true, startingTag: true, tryDecodeURIComponent: true, parseKeyValue: true, toKeyValue: true, encodeUriSegment: true, encodeUriQuery: true, angularInit: true, bootstrap: true, getTestability: true, snake_case: true, bindJQuery: true, assertArg: true, assertArgFn: true, assertNotHasOwnProperty: true, getter: true, getBlockNodes: true, hasOwnProperty: true, createMap: true, NODE_TYPE_ELEMENT: true, NODE_TYPE_TEXT: true, NODE_TYPE_COMMENT: true, NODE_TYPE_DOCUMENT: true, NODE_TYPE_DOCUMENT_FRAGMENT: true, */ //////////////////////////////////// /** * @ngdoc module * @name ng * @module ng * @description * * # ng (core module) * The ng module is loaded by default when an AngularJS application is started. The module itself * contains the essential components for an AngularJS application to function. The table below * lists a high level breakdown of each of the services/factories, filters, directives and testing * components available within this core module. * * <div doc-module-components="ng"></div> */ var REGEX_STRING_REGEXP = /^\/(.+)\/([a-z]*)$/; // The name of a form control's ValidityState property. // This is used so that it's possible for internal tests to create mock ValidityStates. var VALIDITY_STATE_PROPERTY = 'validity'; /** * @ngdoc function * @name angular.lowercase * @module ng * @kind function * * @description Converts the specified string to lowercase. * @param {string} string String to be converted to lowercase. * @returns {string} Lowercased string. */ var lowercase = function(string) {return isString(string) ? string.toLowerCase() : string;}; var hasOwnProperty = Object.prototype.hasOwnProperty; /** * @ngdoc function * @name angular.uppercase * @module ng * @kind function * * @description Converts the specified string to uppercase. * @param {string} string String to be converted to uppercase. * @returns {string} Uppercased string. */ var uppercase = function(string) {return isString(string) ? string.toUpperCase() : string;}; var manualLowercase = function(s) { /* jshint bitwise: false */ return isString(s) ? s.replace(/[A-Z]/g, function(ch) {return String.fromCharCode(ch.charCodeAt(0) | 32);}) : s; }; var manualUppercase = function(s) { /* jshint bitwise: false */ return isString(s) ? s.replace(/[a-z]/g, function(ch) {return String.fromCharCode(ch.charCodeAt(0) & ~32);}) : s; }; // String#toLowerCase and String#toUpperCase don't produce correct results in browsers with Turkish // locale, for this reason we need to detect this case and redefine lowercase/uppercase methods // with correct but slower alternatives. if ('i' !== 'I'.toLowerCase()) { lowercase = manualLowercase; uppercase = manualUppercase; } var msie, // holds major version number for IE, or NaN if UA is not IE. jqLite, // delay binding since jQuery could be loaded after us. jQuery, // delay binding slice = [].slice, splice = [].splice, push = [].push, toString = Object.prototype.toString, ngMinErr = minErr('ng'), /** @name angular */ angular = window.angular || (window.angular = {}), angularModule, uid = 0; /** * documentMode is an IE-only property * http://msdn.microsoft.com/en-us/library/ie/cc196988(v=vs.85).aspx */ msie = document.documentMode; /** * @private * @param {*} obj * @return {boolean} Returns true if `obj` is an array or array-like object (NodeList, Arguments, * String ...) */ function isArrayLike(obj) { if (obj == null || isWindow(obj)) { return false; } var length = obj.length; if (obj.nodeType === NODE_TYPE_ELEMENT && length) { return true; } return isString(obj) || isArray(obj) || length === 0 || typeof length === 'number' && length > 0 && (length - 1) in obj; } /** * @ngdoc function * @name angular.forEach * @module ng * @kind function * * @description * Invokes the `iterator` function once for each item in `obj` collection, which can be either an * object or an array. The `iterator` function is invoked with `iterator(value, key, obj)`, where `value` * is the value of an object property or an array element, `key` is the object property key or * array element index and obj is the `obj` itself. Specifying a `context` for the function is optional. * * It is worth noting that `.forEach` does not iterate over inherited properties because it filters * using the `hasOwnProperty` method. * * Unlike ES262's * [Array.prototype.forEach](http://www.ecma-international.org/ecma-262/5.1/#sec-15.4.4.18), * Providing 'undefined' or 'null' values for `obj` will not throw a TypeError, but rather just * return the value provided. * ```js var values = {name: 'misko', gender: 'male'}; var log = []; angular.forEach(values, function(value, key) { this.push(key + ': ' + value); }, log); expect(log).toEqual(['name: misko', 'gender: male']); ``` * * @param {Object|Array} obj Object to iterate over. * @param {Function} iterator Iterator function. * @param {Object=} context Object to become context (`this`) for the iterator function. * @returns {Object|Array} Reference to `obj`. */ function forEach(obj, iterator, context) { var key, length; if (obj) { if (isFunction(obj)) { for (key in obj) { // Need to check if hasOwnProperty exists, // as on IE8 the result of querySelectorAll is an object without a hasOwnProperty function if (key != 'prototype' && key != 'length' && key != 'name' && (!obj.hasOwnProperty || obj.hasOwnProperty(key))) { iterator.call(context, obj[key], key, obj); } } } else if (isArray(obj) || isArrayLike(obj)) { var isPrimitive = typeof obj !== 'object'; for (key = 0, length = obj.length; key < length; key++) { if (isPrimitive || key in obj) { iterator.call(context, obj[key], key, obj); } } } else if (obj.forEach && obj.forEach !== forEach) { obj.forEach(iterator, context, obj); } else { for (key in obj) { if (obj.hasOwnProperty(key)) { iterator.call(context, obj[key], key, obj); } } } } return obj; } function sortedKeys(obj) { return Object.keys(obj).sort(); } function forEachSorted(obj, iterator, context) { var keys = sortedKeys(obj); for (var i = 0; i < keys.length; i++) { iterator.call(context, obj[keys[i]], keys[i]); } return keys; } /** * when using forEach the params are value, key, but it is often useful to have key, value. * @param {function(string, *)} iteratorFn * @returns {function(*, string)} */ function reverseParams(iteratorFn) { return function(value, key) { iteratorFn(key, value); }; } /** * A consistent way of creating unique IDs in angular. * * Using simple numbers allows us to generate 28.6 million unique ids per second for 10 years before * we hit number precision issues in JavaScript. * * Math.pow(2,53) / 60 / 60 / 24 / 365 / 10 = 28.6M * * @returns {number} an unique alpha-numeric string */ function nextUid() { return ++uid; } /** * Set or clear the hashkey for an object. * @param obj object * @param h the hashkey (!truthy to delete the hashkey) */ function setHashKey(obj, h) { if (h) { obj.$$hashKey = h; } else { delete obj.$$hashKey; } } /** * @ngdoc function * @name angular.extend * @module ng * @kind function * * @description * Extends the destination object `dst` by copying own enumerable properties from the `src` object(s) * to `dst`. You can specify multiple `src` objects. If you want to preserve original objects, you can do so * by passing an empty object as the target: `var object = angular.extend({}, object1, object2)`. * Note: Keep in mind that `angular.extend` does not support recursive merge (deep copy). * * @param {Object} dst Destination object. * @param {...Object} src Source object(s). * @returns {Object} Reference to `dst`. */ function extend(dst) { var h = dst.$$hashKey; for (var i = 1, ii = arguments.length; i < ii; i++) { var obj = arguments[i]; if (obj) { var keys = Object.keys(obj); for (var j = 0, jj = keys.length; j < jj; j++) { var key = keys[j]; dst[key] = obj[key]; } } } setHashKey(dst, h); return dst; } function int(str) { return parseInt(str, 10); } function inherit(parent, extra) { return extend(Object.create(parent), extra); } /** * @ngdoc function * @name angular.noop * @module ng * @kind function * * @description * A function that performs no operations. This function can be useful when writing code in the * functional style. ```js function foo(callback) { var result = calculateResult(); (callback || angular.noop)(result); } ``` */ function noop() {} noop.$inject = []; /** * @ngdoc function * @name angular.identity * @module ng * @kind function * * @description * A function that returns its first argument. This function is useful when writing code in the * functional style. * ```js function transformer(transformationFn, value) { return (transformationFn || angular.identity)(value); }; ``` * @param {*} value to be returned. * @returns {*} the value passed in. */ function identity($) {return $;} identity.$inject = []; function valueFn(value) {return function() {return value;};} /** * @ngdoc function * @name angular.isUndefined * @module ng * @kind function * * @description * Determines if a reference is undefined. * * @param {*} value Reference to check. * @returns {boolean} True if `value` is undefined. */ function isUndefined(value) {return typeof value === 'undefined';} /** * @ngdoc function * @name angular.isDefined * @module ng * @kind function * * @description * Determines if a reference is defined. * * @param {*} value Reference to check. * @returns {boolean} True if `value` is defined. */ function isDefined(value) {return typeof value !== 'undefined';} /** * @ngdoc function * @name angular.isObject * @module ng * @kind function * * @description * Determines if a reference is an `Object`. Unlike `typeof` in JavaScript, `null`s are not * considered to be objects. Note that JavaScript arrays are objects. * * @param {*} value Reference to check. * @returns {boolean} True if `value` is an `Object` but not `null`. */ function isObject(value) { // http://jsperf.com/isobject4 return value !== null && typeof value === 'object'; } /** * @ngdoc function * @name angular.isString * @module ng * @kind function * * @description * Determines if a reference is a `String`. * * @param {*} value Reference to check. * @returns {boolean} True if `value` is a `String`. */ function isString(value) {return typeof value === 'string';} /** * @ngdoc function * @name angular.isNumber * @module ng * @kind function * * @description * Determines if a reference is a `Number`. * * @param {*} value Reference to check. * @returns {boolean} True if `value` is a `Number`. */ function isNumber(value) {return typeof value === 'number';} /** * @ngdoc function * @name angular.isDate * @module ng * @kind function * * @description * Determines if a value is a date. * * @param {*} value Reference to check. * @returns {boolean} True if `value` is a `Date`. */ function isDate(value) { return toString.call(value) === '[object Date]'; } /** * @ngdoc function * @name angular.isArray * @module ng * @kind function * * @description * Determines if a reference is an `Array`. * * @param {*} value Reference to check. * @returns {boolean} True if `value` is an `Array`. */ var isArray = Array.isArray; /** * @ngdoc function * @name angular.isFunction * @module ng * @kind function * * @description * Determines if a reference is a `Function`. * * @param {*} value Reference to check. * @returns {boolean} True if `value` is a `Function`. */ function isFunction(value) {return typeof value === 'function';} /** * Determines if a value is a regular expression object. * * @private * @param {*} value Reference to check. * @returns {boolean} True if `value` is a `RegExp`. */ function isRegExp(value) { return toString.call(value) === '[object RegExp]'; } /** * Checks if `obj` is a window object. * * @private * @param {*} obj Object to check * @returns {boolean} True if `obj` is a window obj. */ function isWindow(obj) { return obj && obj.window === obj; } function isScope(obj) { return obj && obj.$evalAsync && obj.$watch; } function isFile(obj) { return toString.call(obj) === '[object File]'; } function isFormData(obj) { return toString.call(obj) === '[object FormData]'; } function isBlob(obj) { return toString.call(obj) === '[object Blob]'; } function isBoolean(value) { return typeof value === 'boolean'; } function isPromiseLike(obj) { return obj && isFunction(obj.then); } var trim = function(value) { return isString(value) ? value.trim() : value; }; // Copied from: // http://docs.closure-library.googlecode.com/git/local_closure_goog_string_string.js.source.html#line1021 // Prereq: s is a string. var escapeForRegexp = function(s) { return s.replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g, '\\$1'). replace(/\x08/g, '\\x08'); }; /** * @ngdoc function * @name angular.isElement * @module ng * @kind function * * @description * Determines if a reference is a DOM element (or wrapped jQuery element). * * @param {*} value Reference to check. * @returns {boolean} True if `value` is a DOM element (or wrapped jQuery element). */ function isElement(node) { return !!(node && (node.nodeName // we are a direct element || (node.prop && node.attr && node.find))); // we have an on and find method part of jQuery API } /** * @param str 'key1,key2,...' * @returns {object} in the form of {key1:true, key2:true, ...} */ function makeMap(str) { var obj = {}, items = str.split(","), i; for (i = 0; i < items.length; i++) obj[items[i]] = true; return obj; } function nodeName_(element) { return lowercase(element.nodeName || (element[0] && element[0].nodeName)); } function includes(array, obj) { return Array.prototype.indexOf.call(array, obj) != -1; } function arrayRemove(array, value) { var index = array.indexOf(value); if (index >= 0) array.splice(index, 1); return value; } /** * @ngdoc function * @name angular.copy * @module ng * @kind function * * @description * Creates a deep copy of `source`, which should be an object or an array. * * * If no destination is supplied, a copy of the object or array is created. * * If a destination is provided, all of its elements (for arrays) or properties (for objects) * are deleted and then all elements/properties from the source are copied to it. * * If `source` is not an object or array (inc. `null` and `undefined`), `source` is returned. * * If `source` is identical to 'destination' an exception will be thrown. * * @param {*} source The source that will be used to make a copy. * Can be any type, including primitives, `null`, and `undefined`. * @param {(Object|Array)=} destination Destination into which the source is copied. If * provided, must be of the same type as `source`. * @returns {*} The copy or updated `destination`, if `destination` was specified. * * @example <example module="copyExample"> <file name="index.html"> <div ng-controller="ExampleController"> <form novalidate class="simple-form"> Name: <input type="text" ng-model="user.name" /><br /> E-mail: <input type="email" ng-model="user.email" /><br /> Gender: <input type="radio" ng-model="user.gender" value="male" />male <input type="radio" ng-model="user.gender" value="female" />female<br /> <button ng-click="reset()">RESET</button> <button ng-click="update(user)">SAVE</button> </form> <pre>form = {{user | json}}</pre> <pre>master = {{master | json}}</pre> </div> <script> angular.module('copyExample', []) .controller('ExampleController', ['$scope', function($scope) { $scope.master= {}; $scope.update = function(user) { // Example with 1 argument $scope.master= angular.copy(user); }; $scope.reset = function() { // Example with 2 arguments angular.copy($scope.master, $scope.user); }; $scope.reset(); }]); </script> </file> </example> */ function copy(source, destination, stackSource, stackDest) { if (isWindow(source) || isScope(source)) { throw ngMinErr('cpws', "Can't copy! Making copies of Window or Scope instances is not supported."); } if (!destination) { destination = source; if (source) { if (isArray(source)) { destination = copy(source, [], stackSource, stackDest); } else if (isDate(source)) { destination = new Date(source.getTime()); } else if (isRegExp(source)) { destination = new RegExp(source.source, source.toString().match(/[^\/]*$/)[0]); destination.lastIndex = source.lastIndex; } else if (isObject(source)) { var emptyObject = Object.create(Object.getPrototypeOf(source)); destination = copy(source, emptyObject, stackSource, stackDest); } } } else { if (source === destination) throw ngMinErr('cpi', "Can't copy! Source and destination are identical."); stackSource = stackSource || []; stackDest = stackDest || []; if (isObject(source)) { var index = stackSource.indexOf(source); if (index !== -1) return stackDest[index]; stackSource.push(source); stackDest.push(destination); } var result; if (isArray(source)) { destination.length = 0; for (var i = 0; i < source.length; i++) { result = copy(source[i], null, stackSource, stackDest); if (isObject(source[i])) { stackSource.push(source[i]); stackDest.push(result); } destination.push(result); } } else { var h = destination.$$hashKey; if (isArray(destination)) { destination.length = 0; } else { forEach(destination, function(value, key) { delete destination[key]; }); } for (var key in source) { if (source.hasOwnProperty(key)) { result = copy(source[key], null, stackSource, stackDest); if (isObject(source[key])) { stackSource.push(source[key]); stackDest.push(result); } destination[key] = result; } } setHashKey(destination,h); } } return destination; } /** * Creates a shallow copy of an object, an array or a primitive. * * Assumes that there are no proto properties for objects. */ function shallowCopy(src, dst) { if (isArray(src)) { dst = dst || []; for (var i = 0, ii = src.length; i < ii; i++) { dst[i] = src[i]; } } else if (isObject(src)) { dst = dst || {}; for (var key in src) { if (!(key.charAt(0) === '$' && key.charAt(1) === '$')) { dst[key] = src[key]; } } } return dst || src; } /** * @ngdoc function * @name angular.equals * @module ng * @kind function * * @description * Determines if two objects or two values are equivalent. Supports value types, regular * expressions, arrays and objects. * * Two objects or values are considered equivalent if at least one of the following is true: * * * Both objects or values pass `===` comparison. * * Both objects or values are of the same type and all of their properties are equal by * comparing them with `angular.equals`. * * Both values are NaN. (In JavaScript, NaN == NaN => false. But we consider two NaN as equal) * * Both values represent the same regular expression (In JavaScript, * /abc/ == /abc/ => false. But we consider two regular expressions as equal when their textual * representation matches). * * During a property comparison, properties of `function` type and properties with names * that begin with `$` are ignored. * * Scope and DOMWindow objects are being compared only by identify (`===`). * * @param {*} o1 Object or value to compare. * @param {*} o2 Object or value to compare. * @returns {boolean} True if arguments are equal. */ function equals(o1, o2) { if (o1 === o2) return true; if (o1 === null || o2 === null) return false; if (o1 !== o1 && o2 !== o2) return true; // NaN === NaN var t1 = typeof o1, t2 = typeof o2, length, key, keySet; if (t1 == t2) { if (t1 == 'object') { if (isArray(o1)) { if (!isArray(o2)) return false; if ((length = o1.length) == o2.length) { for (key = 0; key < length; key++) { if (!equals(o1[key], o2[key])) return false; } return true; } } else if (isDate(o1)) { if (!isDate(o2)) return false; return equals(o1.getTime(), o2.getTime()); } else if (isRegExp(o1) && isRegExp(o2)) { return o1.toString() == o2.toString(); } else { if (isScope(o1) || isScope(o2) || isWindow(o1) || isWindow(o2) || isArray(o2)) return false; keySet = {}; for (key in o1) { if (key.charAt(0) === '$' || isFunction(o1[key])) continue; if (!equals(o1[key], o2[key])) return false; keySet[key] = true; } for (key in o2) { if (!keySet.hasOwnProperty(key) && key.charAt(0) !== '$' && o2[key] !== undefined && !isFunction(o2[key])) return false; } return true; } } } return false; } var csp = function() { if (isDefined(csp.isActive_)) return csp.isActive_; var active = !!(document.querySelector('[ng-csp]') || document.querySelector('[data-ng-csp]')); if (!active) { try { /* jshint -W031, -W054 */ new Function(''); /* jshint +W031, +W054 */ } catch (e) { active = true; } } return (csp.isActive_ = active); }; function concat(array1, array2, index) { return array1.concat(slice.call(array2, index)); } function sliceArgs(args, startIndex) { return slice.call(args, startIndex || 0); } /* jshint -W101 */ /** * @ngdoc function * @name angular.bind * @module ng * @kind function * * @description * Returns a function which calls function `fn` bound to `self` (`self` becomes the `this` for * `fn`). You can supply optional `args` that are prebound to the function. This feature is also * known as [partial application](http://en.wikipedia.org/wiki/Partial_application), as * distinguished from [function currying](http://en.wikipedia.org/wiki/Currying#Contrast_with_partial_function_application). * * @param {Object} self Context which `fn` should be evaluated in. * @param {function()} fn Function to be bound. * @param {...*} args Optional arguments to be prebound to the `fn` function call. * @returns {function()} Function that wraps the `fn` with all the specified bindings. */ /* jshint +W101 */ function bind(self, fn) { var curryArgs = arguments.length > 2 ? sliceArgs(arguments, 2) : []; if (isFunction(fn) && !(fn instanceof RegExp)) { return curryArgs.length ? function() { return arguments.length ? fn.apply(self, concat(curryArgs, arguments, 0)) : fn.apply(self, curryArgs); } : function() { return arguments.length ? fn.apply(self, arguments) : fn.call(self); }; } else { // in IE, native methods are not functions so they cannot be bound (note: they don't need to be) return fn; } } function toJsonReplacer(key, value) { var val = value; if (typeof key === 'string' && key.charAt(0) === '$' && key.charAt(1) === '$') { val = undefined; } else if (isWindow(value)) { val = '$WINDOW'; } else if (value && document === value) { val = '$DOCUMENT'; } else if (isScope(value)) { val = '$SCOPE'; } return val; } /** * @ngdoc function * @name angular.toJson * @module ng * @kind function * * @description * Serializes input into a JSON-formatted string. Properties with leading $$ characters will be * stripped since angular uses this notation internally. * * @param {Object|Array|Date|string|number} obj Input to be serialized into JSON. * @param {boolean|number=} pretty If set to true, the JSON output will contain newlines and whitespace. * If set to an integer, the JSON output will contain that many spaces per indentation (the default is 2). * @returns {string|undefined} JSON-ified string representing `obj`. */ function toJson(obj, pretty) { if (typeof obj === 'undefined') return undefined; if (!isNumber(pretty)) { pretty = pretty ? 2 : null; } return JSON.stringify(obj, toJsonReplacer, pretty); } /** * @ngdoc function * @name angular.fromJson * @module ng * @kind function * * @description * Deserializes a JSON string. * * @param {string} json JSON string to deserialize. * @returns {Object|Array|string|number} Deserialized JSON string. */ function fromJson(json) { return isString(json) ? JSON.parse(json) : json; } /** * @returns {string} Returns the string representation of the element. */ function startingTag(element) { element = jqLite(element).clone(); try { // turns out IE does not let you set .html() on elements which // are not allowed to have children. So we just ignore it. element.empty(); } catch (e) {} var elemHtml = jqLite('<div>').append(element).html(); try { return element[0].nodeType === NODE_TYPE_TEXT ? lowercase(elemHtml) : elemHtml. match(/^(<[^>]+>)/)[1]. replace(/^<([\w\-]+)/, function(match, nodeName) { return '<' + lowercase(nodeName); }); } catch (e) { return lowercase(elemHtml); } } ///////////////////////////////////////////////// /** * Tries to decode the URI component without throwing an exception. * * @private * @param str value potential URI component to check. * @returns {boolean} True if `value` can be decoded * with the decodeURIComponent function. */ function tryDecodeURIComponent(value) { try { return decodeURIComponent(value); } catch (e) { // Ignore any invalid uri component } } /** * Parses an escaped url query string into key-value pairs. * @returns {Object.<string,boolean|Array>} */ function parseKeyValue(/**string*/keyValue) { var obj = {}, key_value, key; forEach((keyValue || "").split('&'), function(keyValue) { if (keyValue) { key_value = keyValue.replace(/\+/g,'%20').split('='); key = tryDecodeURIComponent(key_value[0]); if (isDefined(key)) { var val = isDefined(key_value[1]) ? tryDecodeURIComponent(key_value[1]) : true; if (!hasOwnProperty.call(obj, key)) { obj[key] = val; } else if (isArray(obj[key])) { obj[key].push(val); } else { obj[key] = [obj[key],val]; } } } }); return obj; } function toKeyValue(obj) { var parts = []; forEach(obj, function(value, key) { if (isArray(value)) { forEach(value, function(arrayValue) { parts.push(encodeUriQuery(key, true) + (arrayValue === true ? '' : '=' + encodeUriQuery(arrayValue, true))); }); } else { parts.push(encodeUriQuery(key, true) + (value === true ? '' : '=' + encodeUriQuery(value, true))); } }); return parts.length ? parts.join('&') : ''; } /** * We need our custom method because encodeURIComponent is too aggressive and doesn't follow * http://www.ietf.org/rfc/rfc3986.txt with regards to the character set (pchar) allowed in path * segments: * segment = *pchar * pchar = unreserved / pct-encoded / sub-delims / ":" / "@" * pct-encoded = "%" HEXDIG HEXDIG * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" * sub-delims = "!" / "$" / "&" / "'" / "(" / ")" * / "*" / "+" / "," / ";" / "=" */ function encodeUriSegment(val) { return encodeUriQuery(val, true). replace(/%26/gi, '&'). replace(/%3D/gi, '='). replace(/%2B/gi, '+'); } /** * This method is intended for encoding *key* or *value* parts of query component. We need a custom * method because encodeURIComponent is too aggressive and encodes stuff that doesn't have to be * encoded per http://tools.ietf.org/html/rfc3986: * query = *( pchar / "/" / "?" ) * pchar = unreserved / pct-encoded / sub-delims / ":" / "@" * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" * pct-encoded = "%" HEXDIG HEXDIG * sub-delims = "!" / "$" / "&" / "'" / "(" / ")" * / "*" / "+" / "," / ";" / "=" */ function encodeUriQuery(val, pctEncodeSpaces) { return encodeURIComponent(val). replace(/%40/gi, '@'). replace(/%3A/gi, ':'). replace(/%24/g, '$'). replace(/%2C/gi, ','). replace(/%3B/gi, ';'). replace(/%20/g, (pctEncodeSpaces ? '%20' : '+')); } var ngAttrPrefixes = ['ng-', 'data-ng-', 'ng:', 'x-ng-']; function getNgAttribute(element, ngAttr) { var attr, i, ii = ngAttrPrefixes.length; element = jqLite(element); for (i = 0; i < ii; ++i) { attr = ngAttrPrefixes[i] + ngAttr; if (isString(attr = element.attr(attr))) { return attr; } } return null; } /** * @ngdoc directive * @name ngApp * @module ng * * @element ANY * @param {angular.Module} ngApp an optional application * {@link angular.module module} name to load. * @param {boolean=} ngStrictDi if this attribute is present on the app element, the injector will be * created in "strict-di" mode. This means that the application will fail to invoke functions which * do not use explicit function annotation (and are thus unsuitable for minification), as described * in {@link guide/di the Dependency Injection guide}, and useful debugging info will assist in * tracking down the root of these bugs. * * @description * * Use this directive to **auto-bootstrap** an AngularJS application. The `ngApp` directive * designates the **root element** of the application and is typically placed near the root element * of the page - e.g. on the `<body>` or `<html>` tags. * * Only one AngularJS application can be auto-bootstrapped per HTML document. The first `ngApp` * found in the document will be used to define the root element to auto-bootstrap as an * application. To run multiple applications in an HTML document you must manually bootstrap them using * {@link angular.bootstrap} instead. AngularJS applications cannot be nested within each other. * * You can specify an **AngularJS module** to be used as the root module for the application. This * module will be loaded into the {@link auto.$injector} when the application is bootstrapped. It * should contain the application code needed or have dependencies on other modules that will * contain the code. See {@link angular.module} for more information. * * In the example below if the `ngApp` directive were not placed on the `html` element then the * document would not be compiled, the `AppController` would not be instantiated and the `{{ a+b }}` * would not be resolved to `3`. * * `ngApp` is the easiest, and most common way to bootstrap an application. * <example module="ngAppDemo"> <file name="index.html"> <div ng-controller="ngAppDemoController"> I can add: {{a}} + {{b}} = {{ a+b }} </div> </file> <file name="script.js"> angular.module('ngAppDemo', []).controller('ngAppDemoController', function($scope) { $scope.a = 1; $scope.b = 2; }); </file> </example> * * Using `ngStrictDi`, you would see something like this: * <example ng-app-included="true"> <file name="index.html"> <div ng-app="ngAppStrictDemo" ng-strict-di> <div ng-controller="GoodController1"> I can add: {{a}} + {{b}} = {{ a+b }} <p>This renders because the controller does not fail to instantiate, by using explicit annotation style (see script.js for details) </p> </div> <div ng-controller="GoodController2"> Name: <input ng-model="name"><br /> Hello, {{name}}! <p>This renders because the controller does not fail to instantiate, by using explicit annotation style (see script.js for details) </p> </div> <div ng-controller="BadController"> I can add: {{a}} + {{b}} = {{ a+b }} <p>The controller could not be instantiated, due to relying on automatic function annotations (which are disabled in strict mode). As such, the content of this section is not interpolated, and there should be an error in your web console. </p> </div> </div> </file> <file name="script.js"> angular.module('ngAppStrictDemo', []) // BadController will fail to instantiate, due to relying on automatic function annotation, // rather than an explicit annotation .controller('BadController', function($scope) { $scope.a = 1; $scope.b = 2; }) // Unlike BadController, GoodController1 and GoodController2 will not fail to be instantiated, // due to using explicit annotations using the array style and $inject property, respectively. .controller('GoodController1', ['$scope', function($scope) { $scope.a = 1; $scope.b = 2; }]) .controller('GoodController2', GoodController2); function GoodController2($scope) { $scope.name = "World"; } GoodController2.$inject = ['$scope']; </file> <file name="style.css"> div[ng-controller] { margin-bottom: 1em; -webkit-border-radius: 4px; border-radius: 4px; border: 1px solid; padding: .5em; } div[ng-controller^=Good] { border-color: #d6e9c6; background-color: #dff0d8; color: #3c763d; } div[ng-controller^=Bad] { border-color: #ebccd1; background-color: #f2dede; color: #a94442; margin-bottom: 0; } </file> </example> */ function angularInit(element, bootstrap) { var appElement, module, config = {}; // The element `element` has priority over any other element forEach(ngAttrPrefixes, function(prefix) { var name = prefix + 'app'; if (!appElement && element.hasAttribute && element.hasAttribute(name)) { appElement = element; module = element.getAttribute(name); } }); forEach(ngAttrPrefixes, function(prefix) { var name = prefix + 'app'; var candidate; if (!appElement && (candidate = element.querySelector('[' + name.replace(':', '\\:') + ']'))) { appElement = candidate; module = candidate.getAttribute(name); } }); if (appElement) { config.strictDi = getNgAttribute(appElement, "strict-di") !== null; bootstrap(appElement, module ? [module] : [], config); } } /** * @ngdoc function * @name angular.bootstrap * @module ng * @description * Use this function to manually start up angular application. * * See: {@link guide/bootstrap Bootstrap} * * Note that Protractor based end-to-end tests cannot use this function to bootstrap manually. * They must use {@link ng.directive:ngApp ngApp}. * * Angular will detect if it has been loaded into the browser more than once and only allow the * first loaded script to be bootstrapped and will report a warning to the browser console for * each of the subsequent scripts. This prevents strange results in applications, where otherwise * multiple instances of Angular try to work on the DOM. * * ```html * <!doctype html> * <html> * <body> * <div ng-controller="WelcomeController"> * {{greeting}} * </div> * * <script src="angular.js"></script> * <script> * var app = angular.module('demo', []) * .controller('WelcomeController', function($scope) { * $scope.greeting = 'Welcome!'; * }); * angular.bootstrap(document, ['demo']); * </script> * </body> * </html> * ``` * * @param {DOMElement} element DOM element which is the root of angular application. * @param {Array<String|Function|Array>=} modules an array of modules to load into the application. * Each item in the array should be the name of a predefined module or a (DI annotated) * function that will be invoked by the injector as a `config` block. * See: {@link angular.module modules} * @param {Object=} config an object for defining configuration options for the application. The * following keys are supported: * * * `strictDi` - disable automatic function annotation for the application. This is meant to * assist in finding bugs which break minified code. Defaults to `false`. * * @returns {auto.$injector} Returns the newly created injector for this app. */ function bootstrap(element, modules, config) { if (!isObject(config)) config = {}; var defaultConfig = { strictDi: false }; config = extend(defaultConfig, config); var doBootstrap = function() { element = jqLite(element); if (element.injector()) { var tag = (element[0] === document) ? 'document' : startingTag(element); //Encode angle brackets to prevent input from being sanitized to empty string #8683 throw ngMinErr( 'btstrpd', "App Already Bootstrapped with this Element '{0}'", tag.replace(/</,'&lt;').replace(/>/,'&gt;')); } modules = modules || []; modules.unshift(['$provide', function($provide) { $provide.value('$rootElement', element); }]); if (config.debugInfoEnabled) { // Pushing so that this overrides `debugInfoEnabled` setting defined in user's `modules`. modules.push(['$compileProvider', function($compileProvider) { $compileProvider.debugInfoEnabled(true); }]); } modules.unshift('ng'); var injector = createInjector(modules, config.strictDi); injector.invoke(['$rootScope', '$rootElement', '$compile', '$injector', function bootstrapApply(scope, element, compile, injector) { scope.$apply(function() { element.data('$injector', injector); compile(element)(scope); }); }] ); return injector; }; var NG_ENABLE_DEBUG_INFO = /^NG_ENABLE_DEBUG_INFO!/; var NG_DEFER_BOOTSTRAP = /^NG_DEFER_BOOTSTRAP!/; if (window && NG_ENABLE_DEBUG_INFO.test(window.name)) { config.debugInfoEnabled = true; window.name = window.name.replace(NG_ENABLE_DEBUG_INFO, ''); } if (window && !NG_DEFER_BOOTSTRAP.test(window.name)) { return doBootstrap(); } window.name = window.name.replace(NG_DEFER_BOOTSTRAP, ''); angular.resumeBootstrap = function(extraModules) { forEach(extraModules, function(module) { modules.push(module); }); return doBootstrap(); }; if (isFunction(angular.resumeDeferredBootstrap)) { angular.resumeDeferredBootstrap(); } } /** * @ngdoc function * @name angular.reloadWithDebugInfo * @module ng * @description * Use this function to reload the current application with debug information turned on. * This takes precedence over a call to `$compileProvider.debugInfoEnabled(false)`. * * See {@link ng.$compileProvider#debugInfoEnabled} for more. */ function reloadWithDebugInfo() { window.name = 'NG_ENABLE_DEBUG_INFO!' + window.name; window.location.reload(); } /** * @name angular.getTestability * @module ng * @description * Get the testability service for the instance of Angular on the given * element. * @param {DOMElement} element DOM element which is the root of angular application. */ function getTestability(rootElement) { var injector = angular.element(rootElement).injector(); if (!injector) { throw ngMinErr('test', 'no injector found for element argument to getTestability'); } return injector.get('$$testability'); } var SNAKE_CASE_REGEXP = /[A-Z]/g; function snake_case(name, separator) { separator = separator || '_'; return name.replace(SNAKE_CASE_REGEXP, function(letter, pos) { return (pos ? separator : '') + letter.toLowerCase(); }); } var bindJQueryFired = false; var skipDestroyOnNextJQueryCleanData; function bindJQuery() { var originalCleanData; if (bindJQueryFired) { return; } // bind to jQuery if present; jQuery = window.jQuery; // Use jQuery if it exists with proper functionality, otherwise default to us. // Angular 1.2+ requires jQuery 1.7+ for on()/off() support. // Angular 1.3+ technically requires at least jQuery 2.1+ but it may work with older // versions. It will not work for sure with jQuery <1.7, though. if (jQuery && jQuery.fn.on) { jqLite = jQuery; extend(jQuery.fn, { scope: JQLitePrototype.scope, isolateScope: JQLitePrototype.isolateScope, controller: JQLitePrototype.controller, injector: JQLitePrototype.injector, inheritedData: JQLitePrototype.inheritedData }); // All nodes removed from the DOM via various jQuery APIs like .remove() // are passed through jQuery.cleanData. Monkey-patch this method to fire // the $destroy event on all removed nodes. originalCleanData = jQuery.cleanData; jQuery.cleanData = function(elems) { var events; if (!skipDestroyOnNextJQueryCleanData) { for (var i = 0, elem; (elem = elems[i]) != null; i++) { events = jQuery._data(elem, "events"); if (events && events.$destroy) { jQuery(elem).triggerHandler('$destroy'); } } } else { skipDestroyOnNextJQueryCleanData = false; } originalCleanData(elems); }; } else { jqLite = JQLite; } angular.element = jqLite; // Prevent double-proxying. bindJQueryFired = true; } /** * throw error if the argument is falsy. */ function assertArg(arg, name, reason) { if (!arg) { throw ngMinErr('areq', "Argument '{0}' is {1}", (name || '?'), (reason || "required")); } return arg; } function assertArgFn(arg, name, acceptArrayAnnotation) { if (acceptArrayAnnotation && isArray(arg)) { arg = arg[arg.length - 1]; } assertArg(isFunction(arg), name, 'not a function, got ' + (arg && typeof arg === 'object' ? arg.constructor.name || 'Object' : typeof arg)); return arg; } /** * throw error if the name given is hasOwnProperty * @param {String} name the name to test * @param {String} context the context in which the name is used, such as module or directive */ function assertNotHasOwnProperty(name, context) { if (name === 'hasOwnProperty') { throw ngMinErr('badname', "hasOwnProperty is not a valid {0} name", context); } } /** * Return the value accessible from the object by path. Any undefined traversals are ignored * @param {Object} obj starting object * @param {String} path path to traverse * @param {boolean} [bindFnToScope=true] * @returns {Object} value as accessible by path */ //TODO(misko): this function needs to be removed function getter(obj, path, bindFnToScope) { if (!path) return obj; var keys = path.split('.'); var key; var lastInstance = obj; var len = keys.length; for (var i = 0; i < len; i++) { key = keys[i]; if (obj) { obj = (lastInstance = obj)[key]; } } if (!bindFnToScope && isFunction(obj)) { return bind(lastInstance, obj); } return obj; } /** * Return the DOM siblings between the first and last node in the given array. * @param {Array} array like object * @returns {jqLite} jqLite collection containing the nodes */ function getBlockNodes(nodes) { // TODO(perf): just check if all items in `nodes` are siblings and if they are return the original // collection, otherwise update the original collection. var node = nodes[0]; var endNode = nodes[nodes.length - 1]; var blockNodes = [node]; do { node = node.nextSibling; if (!node) break; blockNodes.push(node); } while (node !== endNode); return jqLite(blockNodes); } /** * Creates a new object without a prototype. This object is useful for lookup without having to * guard against prototypically inherited properties via hasOwnProperty. * * Related micro-benchmarks: * - http://jsperf.com/object-create2 * - http://jsperf.com/proto-map-lookup/2 * - http://jsperf.com/for-in-vs-object-keys2 * * @returns {Object} */ function createMap() { return Object.create(null); } var NODE_TYPE_ELEMENT = 1; var NODE_TYPE_TEXT = 3; var NODE_TYPE_COMMENT = 8; var NODE_TYPE_DOCUMENT = 9; var NODE_TYPE_DOCUMENT_FRAGMENT = 11; /** * @ngdoc type * @name angular.Module * @module ng * @description * * Interface for configuring angular {@link angular.module modules}. */ function setupModuleLoader(window) { var $injectorMinErr = minErr('$injector'); var ngMinErr = minErr('ng'); function ensure(obj, name, factory) { return obj[name] || (obj[name] = factory()); } var angular = ensure(window, 'angular', Object); // We need to expose `angular.$$minErr` to modules such as `ngResource` that reference it during bootstrap angular.$$minErr = angular.$$minErr || minErr; return ensure(angular, 'module', function() { /** @type {Object.<string, angular.Module>} */ var modules = {}; /** * @ngdoc function * @name angular.module * @module ng * @description * * The `angular.module` is a global place for creating, registering and retrieving Angular * modules. * All modules (angular core or 3rd party) that should be available to an application must be * registered using this mechanism. * * When passed two or more arguments, a new module is created. If passed only one argument, an * existing module (the name passed as the first argument to `module`) is retrieved. * * * # Module * * A module is a collection of services, directives, controllers, filters, and configuration information. * `angular.module` is used to configure the {@link auto.$injector $injector}. * * ```js * // Create a new module * var myModule = angular.module('myModule', []); * * // register a new service * myModule.value('appName', 'MyCoolApp'); * * // configure existing services inside initialization blocks. * myModule.config(['$locationProvider', function($locationProvider) { * // Configure existing providers * $locationProvider.hashPrefix('!'); * }]); * ``` * * Then you can create an injector and load your modules like this: * * ```js * var injector = angular.injector(['ng', 'myModule']) * ``` * * However it's more likely that you'll just use * {@link ng.directive:ngApp ngApp} or * {@link angular.bootstrap} to simplify this process for you. * * @param {!string} name The name of the module to create or retrieve. * @param {!Array.<string>=} requires If specified then new module is being created. If * unspecified then the module is being retrieved for further configuration. * @param {Function=} configFn Optional configuration function for the module. Same as * {@link angular.Module#config Module#config()}. * @returns {module} new module with the {@link angular.Module} api. */ return function module(name, requires, configFn) { var assertNotHasOwnProperty = function(name, context) { if (name === 'hasOwnProperty') { throw ngMinErr('badname', 'hasOwnProperty is not a valid {0} name', context); } }; assertNotHasOwnProperty(name, 'module'); if (requires && modules.hasOwnProperty(name)) { modules[name] = null; } return ensure(modules, name, function() { if (!requires) { throw $injectorMinErr('nomod', "Module '{0}' is not available! You either misspelled " + "the module name or forgot to load it. If registering a module ensure that you " + "specify the dependencies as the second argument.", name); } /** @type {!Array.<Array.<*>>} */ var invokeQueue = []; /** @type {!Array.<Function>} */ var configBlocks = []; /** @type {!Array.<Function>} */ var runBlocks = []; var config = invokeLater('$injector', 'invoke', 'push', configBlocks); /** @type {angular.Module} */ var moduleInstance = { // Private state _invokeQueue: invokeQueue, _configBlocks: configBlocks, _runBlocks: runBlocks, /** * @ngdoc property * @name angular.Module#requires * @module ng * * @description * Holds the list of modules which the injector will load before the current module is * loaded. */ requires: requires, /** * @ngdoc property * @name angular.Module#name * @module ng * * @description * Name of the module. */ name: name, /** * @ngdoc method * @name angular.Module#provider * @module ng * @param {string} name service name * @param {Function} providerType Construction function for creating new instance of the * service. * @description * See {@link auto.$provide#provider $provide.provider()}. */ provider: invokeLater('$provide', 'provider'), /** * @ngdoc method * @name angular.Module#factory * @module ng * @param {string} name service name * @param {Function} providerFunction Function for creating new instance of the service. * @description * See {@link auto.$provide#factory $provide.factory()}. */ factory: invokeLater('$provide', 'factory'), /** * @ngdoc method * @name angular.Module#service * @module ng * @param {string} name service name * @param {Function} constructor A constructor function that will be instantiated. * @description * See {@link auto.$provide#service $provide.service()}. */ service: invokeLater('$provide', 'service'), /** * @ngdoc method * @name angular.Module#value * @module ng * @param {string} name service name * @param {*} object Service instance object. * @description * See {@link auto.$provide#value $provide.value()}. */ value: invokeLater('$provide', 'value'), /** * @ngdoc method * @name angular.Module#constant * @module ng * @param {string} name constant name * @param {*} object Constant value. * @description * Because the constant are fixed, they get applied before other provide methods. * See {@link auto.$provide#constant $provide.constant()}. */ constant: invokeLater('$provide', 'constant', 'unshift'), /** * @ngdoc method * @name angular.Module#animation * @module ng * @param {string} name animation name * @param {Function} animationFactory Factory function for creating new instance of an * animation. * @description * * **NOTE**: animations take effect only if the **ngAnimate** module is loaded. * * * Defines an animation hook that can be later used with * {@link ngAnimate.$animate $animate} service and directives that use this service. * * ```js * module.animation('.animation-name', function($inject1, $inject2) { * return { * eventName : function(element, done) { * //code to run the animation * //once complete, then run done() * return function cancellationFunction(element) { * //code to cancel the animation * } * } * } * }) * ``` * * See {@link ng.$animateProvider#register $animateProvider.register()} and * {@link ngAnimate ngAnimate module} for more information. */ animation: invokeLater('$animateProvider', 'register'), /** * @ngdoc method * @name angular.Module#filter * @module ng * @param {string} name Filter name. * @param {Function} filterFactory Factory function for creating new instance of filter. * @description * See {@link ng.$filterProvider#register $filterProvider.register()}. */ filter: invokeLater('$filterProvider', 'register'), /** * @ngdoc method * @name angular.Module#controller * @module ng * @param {string|Object} name Controller name, or an object map of controllers where the * keys are the names and the values are the constructors. * @param {Function} constructor Controller constructor function. * @description * See {@link ng.$controllerProvider#register $controllerProvider.register()}. */ controller: invokeLater('$controllerProvider', 'register'), /** * @ngdoc method * @name angular.Module#directive * @module ng * @param {string|Object} name Directive name, or an object map of directives where the * keys are the names and the values are the factories. * @param {Function} directiveFactory Factory function for creating new instance of * directives. * @description * See {@link ng.$compileProvider#directive $compileProvider.directive()}. */ directive: invokeLater('$compileProvider', 'directive'), /** * @ngdoc method * @name angular.Module#config * @module ng * @param {Function} configFn Execute this function on module load. Useful for service * configuration. * @description * Use this method to register work which needs to be performed on module loading. * For more about how to configure services, see * {@link providers#provider-recipe Provider Recipe}. */ config: config, /** * @ngdoc method * @name angular.Module#run * @module ng * @param {Function} initializationFn Execute this function after injector creation. * Useful for application initialization. * @description * Use this method to register work which should be performed when the injector is done * loading all modules. */ run: function(block) { runBlocks.push(block); return this; } }; if (configFn) { config(configFn); } return moduleInstance; /** * @param {string} provider * @param {string} method * @param {String=} insertMethod * @returns {angular.Module} */ function invokeLater(provider, method, insertMethod, queue) { if (!queue) queue = invokeQueue; return function() { queue[insertMethod || 'push']([provider, method, arguments]); return moduleInstance; }; } }); }; }); } /* global: toDebugString: true */ function serializeObject(obj) { var seen = []; return JSON.stringify(obj, function(key, val) { val = toJsonReplacer(key, val); if (isObject(val)) { if (seen.indexOf(val) >= 0) return '<<already seen>>'; seen.push(val); } return val; }); } function toDebugString(obj) { if (typeof obj === 'function') { return obj.toString().replace(/ \{[\s\S]*$/, ''); } else if (typeof obj === 'undefined') { return 'undefined'; } else if (typeof obj !== 'string') { return serializeObject(obj); } return obj; } /* global angularModule: true, version: true, $LocaleProvider, $CompileProvider, htmlAnchorDirective, inputDirective, inputDirective, formDirective, scriptDirective, selectDirective, styleDirective, optionDirective, ngBindDirective, ngBindHtmlDirective, ngBindTemplateDirective, ngClassDirective, ngClassEvenDirective, ngClassOddDirective, ngCspDirective, ngCloakDirective, ngControllerDirective, ngFormDirective, ngHideDirective, ngIfDirective, ngIncludeDirective, ngIncludeFillContentDirective, ngInitDirective, ngNonBindableDirective, ngPluralizeDirective, ngRepeatDirective, ngShowDirective, ngStyleDirective, ngSwitchDirective, ngSwitchWhenDirective, ngSwitchDefaultDirective, ngOptionsDirective, ngTranscludeDirective, ngModelDirective, ngListDirective, ngChangeDirective, patternDirective, patternDirective, requiredDirective, requiredDirective, minlengthDirective, minlengthDirective, maxlengthDirective, maxlengthDirective, ngValueDirective, ngModelOptionsDirective, ngAttributeAliasDirectives, ngEventDirectives, $AnchorScrollProvider, $AnimateProvider, $BrowserProvider, $CacheFactoryProvider, $ControllerProvider, $DocumentProvider, $ExceptionHandlerProvider, $FilterProvider, $InterpolateProvider, $IntervalProvider, $HttpProvider, $HttpBackendProvider, $LocationProvider, $LogProvider, $ParseProvider, $RootScopeProvider, $QProvider, $$QProvider, $$SanitizeUriProvider, $SceProvider, $SceDelegateProvider, $SnifferProvider, $TemplateCacheProvider, $TemplateRequestProvider, $$TestabilityProvider, $TimeoutProvider, $$RAFProvider, $$AsyncCallbackProvider, $WindowProvider, $$jqLiteProvider */ /** * @ngdoc object * @name angular.version * @module ng * @description * An object that contains information about the current AngularJS version. This object has the * following properties: * * - `full` – `{string}` – Full version string, such as "0.9.18". * - `major` – `{number}` – Major version number, such as "0". * - `minor` – `{number}` – Minor version number, such as "9". * - `dot` – `{number}` – Dot version number, such as "18". * - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat". */ var version = { full: '1.3.13', // all of these placeholder strings will be replaced by grunt's major: 1, // package task minor: 3, dot: 13, codeName: 'meticulous-riffleshuffle' }; function publishExternalAPI(angular) { extend(angular, { 'bootstrap': bootstrap, 'copy': copy, 'extend': extend, 'equals': equals, 'element': jqLite, 'forEach': forEach, 'injector': createInjector, 'noop': noop, 'bind': bind, 'toJson': toJson, 'fromJson': fromJson, 'identity': identity, 'isUndefined': isUndefined, 'isDefined': isDefined, 'isString': isString, 'isFunction': isFunction, 'isObject': isObject, 'isNumber': isNumber, 'isElement': isElement, 'isArray': isArray, 'version': version, 'isDate': isDate, 'lowercase': lowercase, 'uppercase': uppercase, 'callbacks': {counter: 0}, 'getTestability': getTestability, '$$minErr': minErr, '$$csp': csp, 'reloadWithDebugInfo': reloadWithDebugInfo }); angularModule = setupModuleLoader(window); try { angularModule('ngLocale'); } catch (e) { angularModule('ngLocale', []).provider('$locale', $LocaleProvider); } angularModule('ng', ['ngLocale'], ['$provide', function ngModule($provide) { // $$sanitizeUriProvider needs to be before $compileProvider as it is used by it. $provide.provider({ $$sanitizeUri: $$SanitizeUriProvider }); $provide.provider('$compile', $CompileProvider). directive({ a: htmlAnchorDirective, input: inputDirective, textarea: inputDirective, form: formDirective, script: scriptDirective, select: selectDirective, style: styleDirective, option: optionDirective, ngBind: ngBindDirective, ngBindHtml: ngBindHtmlDirective, ngBindTemplate: ngBindTemplateDirective, ngClass: ngClassDirective, ngClassEven: ngClassEvenDirective, ngClassOdd: ngClassOddDirective, ngCloak: ngCloakDirective, ngController: ngControllerDirective, ngForm: ngFormDirective, ngHide: ngHideDirective, ngIf: ngIfDirective, ngInclude: ngIncludeDirective, ngInit: ngInitDirective, ngNonBindable: ngNonBindableDirective, ngPluralize: ngPluralizeDirective, ngRepeat: ngRepeatDirective, ngShow: ngShowDirective, ngStyle: ngStyleDirective, ngSwitch: ngSwitchDirective, ngSwitchWhen: ngSwitchWhenDirective, ngSwitchDefault: ngSwitchDefaultDirective, ngOptions: ngOptionsDirective, ngTransclude: ngTranscludeDirective, ngModel: ngModelDirective, ngList: ngListDirective, ngChange: ngChangeDirective, pattern: patternDirective, ngPattern: patternDirective, required: requiredDirective, ngRequired: requiredDirective, minlength: minlengthDirective, ngMinlength: minlengthDirective, maxlength: maxlengthDirective, ngMaxlength: maxlengthDirective, ngValue: ngValueDirective, ngModelOptions: ngModelOptionsDirective }). directive({ ngInclude: ngIncludeFillContentDirective }). directive(ngAttributeAliasDirectives). directive(ngEventDirectives); $provide.provider({ $anchorScroll: $AnchorScrollProvider, $animate: $AnimateProvider, $browser: $BrowserProvider, $cacheFactory: $CacheFactoryProvider, $controller: $ControllerProvider, $document: $DocumentProvider, $exceptionHandler: $ExceptionHandlerProvider, $filter: $FilterProvider, $interpolate: $InterpolateProvider, $interval: $IntervalProvider, $http: $HttpProvider, $httpBackend: $HttpBackendProvider, $location: $LocationProvider, $log: $LogProvider, $parse: $ParseProvider, $rootScope: $RootScopeProvider, $q: $QProvider, $$q: $$QProvider, $sce: $SceProvider, $sceDelegate: $SceDelegateProvider, $sniffer: $SnifferProvider, $templateCache: $TemplateCacheProvider, $templateRequest: $TemplateRequestProvider, $$testability: $$TestabilityProvider, $timeout: $TimeoutProvider, $window: $WindowProvider, $$rAF: $$RAFProvider, $$asyncCallback: $$AsyncCallbackProvider, $$jqLite: $$jqLiteProvider }); } ]); } /* global JQLitePrototype: true, addEventListenerFn: true, removeEventListenerFn: true, BOOLEAN_ATTR: true, ALIASED_ATTR: true, */ ////////////////////////////////// //JQLite ////////////////////////////////// /** * @ngdoc function * @name angular.element * @module ng * @kind function * * @description * Wraps a raw DOM element or HTML string as a [jQuery](http://jquery.com) element. * * If jQuery is available, `angular.element` is an alias for the * [jQuery](http://api.jquery.com/jQuery/) function. If jQuery is not available, `angular.element` * delegates to Angular's built-in subset of jQuery, called "jQuery lite" or "jqLite." * * <div class="alert alert-success">jqLite is a tiny, API-compatible subset of jQuery that allows * Angular to manipulate the DOM in a cross-browser compatible way. **jqLite** implements only the most * commonly needed functionality with the goal of having a very small footprint.</div> * * To use jQuery, simply load it before `DOMContentLoaded` event fired. * * <div class="alert">**Note:** all element references in Angular are always wrapped with jQuery or * jqLite; they are never raw DOM references.</div> * * ## Angular's jqLite * jqLite provides only the following jQuery methods: * * - [`addClass()`](http://api.jquery.com/addClass/) * - [`after()`](http://api.jquery.com/after/) * - [`append()`](http://api.jquery.com/append/) * - [`attr()`](http://api.jquery.com/attr/) - Does not support functions as parameters * - [`bind()`](http://api.jquery.com/bind/) - Does not support namespaces, selectors or eventData * - [`children()`](http://api.jquery.com/children/) - Does not support selectors * - [`clone()`](http://api.jquery.com/clone/) * - [`contents()`](http://api.jquery.com/contents/) * - [`css()`](http://api.jquery.com/css/) - Only retrieves inline-styles, does not call `getComputedStyle()` * - [`data()`](http://api.jquery.com/data/) * - [`detach()`](http://api.jquery.com/detach/) * - [`empty()`](http://api.jquery.com/empty/) * - [`eq()`](http://api.jquery.com/eq/) * - [`find()`](http://api.jquery.com/find/) - Limited to lookups by tag name * - [`hasClass()`](http://api.jquery.com/hasClass/) * - [`html()`](http://api.jquery.com/html/) * - [`next()`](http://api.jquery.com/next/) - Does not support selectors * - [`on()`](http://api.jquery.com/on/) - Does not support namespaces, selectors or eventData * - [`off()`](http://api.jquery.com/off/) - Does not support namespaces or selectors * - [`one()`](http://api.jquery.com/one/) - Does not support namespaces or selectors * - [`parent()`](http://api.jquery.com/parent/) - Does not support selectors * - [`prepend()`](http://api.jquery.com/prepend/) * - [`prop()`](http://api.jquery.com/prop/) * - [`ready()`](http://api.jquery.com/ready/) * - [`remove()`](http://api.jquery.com/remove/) * - [`removeAttr()`](http://api.jquery.com/removeAttr/) * - [`removeClass()`](http://api.jquery.com/removeClass/) * - [`removeData()`](http://api.jquery.com/removeData/) * - [`replaceWith()`](http://api.jquery.com/replaceWith/) * - [`text()`](http://api.jquery.com/text/) * - [`toggleClass()`](http://api.jquery.com/toggleClass/) * - [`triggerHandler()`](http://api.jquery.com/triggerHandler/) - Passes a dummy event object to handlers. * - [`unbind()`](http://api.jquery.com/unbind/) - Does not support namespaces * - [`val()`](http://api.jquery.com/val/) * - [`wrap()`](http://api.jquery.com/wrap/) * * ## jQuery/jqLite Extras * Angular also provides the following additional methods and events to both jQuery and jqLite: * * ### Events * - `$destroy` - AngularJS intercepts all jqLite/jQuery's DOM destruction apis and fires this event * on all DOM nodes being removed. This can be used to clean up any 3rd party bindings to the DOM * element before it is removed. * * ### Methods * - `controller(name)` - retrieves the controller of the current element or its parent. By default * retrieves controller associated with the `ngController` directive. If `name` is provided as * camelCase directive name, then the controller for this directive will be retrieved (e.g. * `'ngModel'`). * - `injector()` - retrieves the injector of the current element or its parent. * - `scope()` - retrieves the {@link ng.$rootScope.Scope scope} of the current * element or its parent. Requires {@link guide/production#disabling-debug-data Debug Data} to * be enabled. * - `isolateScope()` - retrieves an isolate {@link ng.$rootScope.Scope scope} if one is attached directly to the * current element. This getter should be used only on elements that contain a directive which starts a new isolate * scope. Calling `scope()` on this element always returns the original non-isolate scope. * Requires {@link guide/production#disabling-debug-data Debug Data} to be enabled. * - `inheritedData()` - same as `data()`, but walks up the DOM until a value is found or the top * parent element is reached. * * @param {string|DOMElement} element HTML string or DOMElement to be wrapped into jQuery. * @returns {Object} jQuery object. */ JQLite.expando = 'ng339'; var jqCache = JQLite.cache = {}, jqId = 1, addEventListenerFn = function(element, type, fn) { element.addEventListener(type, fn, false); }, removeEventListenerFn = function(element, type, fn) { element.removeEventListener(type, fn, false); }; /* * !!! This is an undocumented "private" function !!! */ JQLite._data = function(node) { //jQuery always returns an object on cache miss return this.cache[node[this.expando]] || {}; }; function jqNextId() { return ++jqId; } var SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g; var MOZ_HACK_REGEXP = /^moz([A-Z])/; var MOUSE_EVENT_MAP= { mouseleave: "mouseout", mouseenter: "mouseover"}; var jqLiteMinErr = minErr('jqLite'); /** * Converts snake_case to camelCase. * Also there is special case for Moz prefix starting with upper case letter. * @param name Name to normalize */ function camelCase(name) { return name. replace(SPECIAL_CHARS_REGEXP, function(_, separator, letter, offset) { return offset ? letter.toUpperCase() : letter; }). replace(MOZ_HACK_REGEXP, 'Moz$1'); } var SINGLE_TAG_REGEXP = /^<(\w+)\s*\/?>(?:<\/\1>|)$/; var HTML_REGEXP = /<|&#?\w+;/; var TAG_NAME_REGEXP = /<([\w:]+)/; var XHTML_TAG_REGEXP = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi; var wrapMap = { 'option': [1, '<select multiple="multiple">', '</select>'], 'thead': [1, '<table>', '</table>'], 'col': [2, '<table><colgroup>', '</colgroup></table>'], 'tr': [2, '<table><tbody>', '</tbody></table>'], 'td': [3, '<table><tbody><tr>', '</tr></tbody></table>'], '_default': [0, "", ""] }; wrapMap.optgroup = wrapMap.option; wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; wrapMap.th = wrapMap.td; function jqLiteIsTextNode(html) { return !HTML_REGEXP.test(html); } function jqLiteAcceptsData(node) { // The window object can accept data but has no nodeType // Otherwise we are only interested in elements (1) and documents (9) var nodeType = node.nodeType; return nodeType === NODE_TYPE_ELEMENT || !nodeType || nodeType === NODE_TYPE_DOCUMENT; } function jqLiteBuildFragment(html, context) { var tmp, tag, wrap, fragment = context.createDocumentFragment(), nodes = [], i; if (jqLiteIsTextNode(html)) { // Convert non-html into a text node nodes.push(context.createTextNode(html)); } else { // Convert html into DOM nodes tmp = tmp || fragment.appendChild(context.createElement("div")); tag = (TAG_NAME_REGEXP.exec(html) || ["", ""])[1].toLowerCase(); wrap = wrapMap[tag] || wrapMap._default; tmp.innerHTML = wrap[1] + html.replace(XHTML_TAG_REGEXP, "<$1></$2>") + wrap[2]; // Descend through wrappers to the right content i = wrap[0]; while (i--) { tmp = tmp.lastChild; } nodes = concat(nodes, tmp.childNodes); tmp = fragment.firstChild; tmp.textContent = ""; } // Remove wrapper from fragment fragment.textContent = ""; fragment.innerHTML = ""; // Clear inner HTML forEach(nodes, function(node) { fragment.appendChild(node); }); return fragment; } function jqLiteParseHTML(html, context) { context = context || document; var parsed; if ((parsed = SINGLE_TAG_REGEXP.exec(html))) { return [context.createElement(parsed[1])]; } if ((parsed = jqLiteBuildFragment(html, context))) { return parsed.childNodes; } return []; } ///////////////////////////////////////////// function JQLite(element) { if (element instanceof JQLite) { return element; } var argIsString; if (isString(element)) { element = trim(element); argIsString = true; } if (!(this instanceof JQLite)) { if (argIsString && element.charAt(0) != '<') { throw jqLiteMinErr('nosel', 'Looking up elements via selectors is not supported by jqLite! See: http://docs.angularjs.org/api/angular.element'); } return new JQLite(element); } if (argIsString) { jqLiteAddNodes(this, jqLiteParseHTML(element)); } else { jqLiteAddNodes(this, element); } } function jqLiteClone(element) { return element.cloneNode(true); } function jqLiteDealoc(element, onlyDescendants) { if (!onlyDescendants) jqLiteRemoveData(element); if (element.querySelectorAll) { var descendants = element.querySelectorAll('*'); for (var i = 0, l = descendants.length; i < l; i++) { jqLiteRemoveData(descendants[i]); } } } function jqLiteOff(element, type, fn, unsupported) { if (isDefined(unsupported)) throw jqLiteMinErr('offargs', 'jqLite#off() does not support the `selector` argument'); var expandoStore = jqLiteExpandoStore(element); var events = expandoStore && expandoStore.events; var handle = expandoStore && expandoStore.handle; if (!handle) return; //no listeners registered if (!type) { for (type in events) { if (type !== '$destroy') { removeEventListenerFn(element, type, handle); } delete events[type]; } } else { forEach(type.split(' '), function(type) { if (isDefined(fn)) { var listenerFns = events[type]; arrayRemove(listenerFns || [], fn); if (listenerFns && listenerFns.length > 0) { return; } } removeEventListenerFn(element, type, handle); delete events[type]; }); } } function jqLiteRemoveData(element, name) { var expandoId = element.ng339; var expandoStore = expandoId && jqCache[expandoId]; if (expandoStore) { if (name) { delete expandoStore.data[name]; return; } if (expandoStore.handle) { if (expandoStore.events.$destroy) { expandoStore.handle({}, '$destroy'); } jqLiteOff(element); } delete jqCache[expandoId]; element.ng339 = undefined; // don't delete DOM expandos. IE and Chrome don't like it } } function jqLiteExpandoStore(element, createIfNecessary) { var expandoId = element.ng339, expandoStore = expandoId && jqCache[expandoId]; if (createIfNecessary && !expandoStore) { element.ng339 = expandoId = jqNextId(); expandoStore = jqCache[expandoId] = {events: {}, data: {}, handle: undefined}; } return expandoStore; } function jqLiteData(element, key, value) { if (jqLiteAcceptsData(element)) { var isSimpleSetter = isDefined(value); var isSimpleGetter = !isSimpleSetter && key && !isObject(key); var massGetter = !key; var expandoStore = jqLiteExpandoStore(element, !isSimpleGetter); var data = expandoStore && expandoStore.data; if (isSimpleSetter) { // data('key', value) data[key] = value; } else { if (massGetter) { // data() return data; } else { if (isSimpleGetter) { // data('key') // don't force creation of expandoStore if it doesn't exist yet return data && data[key]; } else { // mass-setter: data({key1: val1, key2: val2}) extend(data, key); } } } } } function jqLiteHasClass(element, selector) { if (!element.getAttribute) return false; return ((" " + (element.getAttribute('class') || '') + " ").replace(/[\n\t]/g, " "). indexOf(" " + selector + " ") > -1); } function jqLiteRemoveClass(element, cssClasses) { if (cssClasses && element.setAttribute) { forEach(cssClasses.split(' '), function(cssClass) { element.setAttribute('class', trim( (" " + (element.getAttribute('class') || '') + " ") .replace(/[\n\t]/g, " ") .replace(" " + trim(cssClass) + " ", " ")) ); }); } } function jqLiteAddClass(element, cssClasses) { if (cssClasses && element.setAttribute) { var existingClasses = (' ' + (element.getAttribute('class') || '') + ' ') .replace(/[\n\t]/g, " "); forEach(cssClasses.split(' '), function(cssClass) { cssClass = trim(cssClass); if (existingClasses.indexOf(' ' + cssClass + ' ') === -1) { existingClasses += cssClass + ' '; } }); element.setAttribute('class', trim(existingClasses)); } } function jqLiteAddNodes(root, elements) { // THIS CODE IS VERY HOT. Don't make changes without benchmarking. if (elements) { // if a Node (the most common case) if (elements.nodeType) { root[root.length++] = elements; } else { var length = elements.length; // if an Array or NodeList and not a Window if (typeof length === 'number' && elements.window !== elements) { if (length) { for (var i = 0; i < length; i++) { root[root.length++] = elements[i]; } } } else { root[root.length++] = elements; } } } } function jqLiteController(element, name) { return jqLiteInheritedData(element, '$' + (name || 'ngController') + 'Controller'); } function jqLiteInheritedData(element, name, value) { // if element is the document object work with the html element instead // this makes $(document).scope() possible if (element.nodeType == NODE_TYPE_DOCUMENT) { element = element.documentElement; } var names = isArray(name) ? name : [name]; while (element) { for (var i = 0, ii = names.length; i < ii; i++) { if ((value = jqLite.data(element, names[i])) !== undefined) return value; } // If dealing with a document fragment node with a host element, and no parent, use the host // element as the parent. This enables directives within a Shadow DOM or polyfilled Shadow DOM // to lookup parent controllers. element = element.parentNode || (element.nodeType === NODE_TYPE_DOCUMENT_FRAGMENT && element.host); } } function jqLiteEmpty(element) { jqLiteDealoc(element, true); while (element.firstChild) { element.removeChild(element.firstChild); } } function jqLiteRemove(element, keepData) { if (!keepData) jqLiteDealoc(element); var parent = element.parentNode; if (parent) parent.removeChild(element); } function jqLiteDocumentLoaded(action, win) { win = win || window; if (win.document.readyState === 'complete') { // Force the action to be run async for consistent behaviour // from the action's point of view // i.e. it will definitely not be in a $apply win.setTimeout(action); } else { // No need to unbind this handler as load is only ever called once jqLite(win).on('load', action); } } ////////////////////////////////////////// // Functions which are declared directly. ////////////////////////////////////////// var JQLitePrototype = JQLite.prototype = { ready: function(fn) { var fired = false; function trigger() { if (fired) return; fired = true; fn(); } // check if document is already loaded if (document.readyState === 'complete') { setTimeout(trigger); } else { this.on('DOMContentLoaded', trigger); // works for modern browsers and IE9 // we can not use jqLite since we are not done loading and jQuery could be loaded later. // jshint -W064 JQLite(window).on('load', trigger); // fallback to window.onload for others // jshint +W064 } }, toString: function() { var value = []; forEach(this, function(e) { value.push('' + e);}); return '[' + value.join(', ') + ']'; }, eq: function(index) { return (index >= 0) ? jqLite(this[index]) : jqLite(this[this.length + index]); }, length: 0, push: push, sort: [].sort, splice: [].splice }; ////////////////////////////////////////// // Functions iterating getter/setters. // these functions return self on setter and // value on get. ////////////////////////////////////////// var BOOLEAN_ATTR = {}; forEach('multiple,selected,checked,disabled,readOnly,required,open'.split(','), function(value) { BOOLEAN_ATTR[lowercase(value)] = value; }); var BOOLEAN_ELEMENTS = {}; forEach('input,select,option,textarea,button,form,details'.split(','), function(value) { BOOLEAN_ELEMENTS[value] = true; }); var ALIASED_ATTR = { 'ngMinlength': 'minlength', 'ngMaxlength': 'maxlength', 'ngMin': 'min', 'ngMax': 'max', 'ngPattern': 'pattern' }; function getBooleanAttrName(element, name) { // check dom last since we will most likely fail on name var booleanAttr = BOOLEAN_ATTR[name.toLowerCase()]; // booleanAttr is here twice to minimize DOM access return booleanAttr && BOOLEAN_ELEMENTS[nodeName_(element)] && booleanAttr; } function getAliasedAttrName(element, name) { var nodeName = element.nodeName; return (nodeName === 'INPUT' || nodeName === 'TEXTAREA') && ALIASED_ATTR[name]; } forEach({ data: jqLiteData, removeData: jqLiteRemoveData }, function(fn, name) { JQLite[name] = fn; }); forEach({ data: jqLiteData, inheritedData: jqLiteInheritedData, scope: function(element) { // Can't use jqLiteData here directly so we stay compatible with jQuery! return jqLite.data(element, '$scope') || jqLiteInheritedData(element.parentNode || element, ['$isolateScope', '$scope']); }, isolateScope: function(element) { // Can't use jqLiteData here directly so we stay compatible with jQuery! return jqLite.data(element, '$isolateScope') || jqLite.data(element, '$isolateScopeNoTemplate'); }, controller: jqLiteController, injector: function(element) { return jqLiteInheritedData(element, '$injector'); }, removeAttr: function(element, name) { element.removeAttribute(name); }, hasClass: jqLiteHasClass, css: function(element, name, value) { name = camelCase(name); if (isDefined(value)) { element.style[name] = value; } else { return element.style[name]; } }, attr: function(element, name, value) { var lowercasedName = lowercase(name); if (BOOLEAN_ATTR[lowercasedName]) { if (isDefined(value)) { if (!!value) { element[name] = true; element.setAttribute(name, lowercasedName); } else { element[name] = false; element.removeAttribute(lowercasedName); } } else { return (element[name] || (element.attributes.getNamedItem(name) || noop).specified) ? lowercasedName : undefined; } } else if (isDefined(value)) { element.setAttribute(name, value); } else if (element.getAttribute) { // the extra argument "2" is to get the right thing for a.href in IE, see jQuery code // some elements (e.g. Document) don't have get attribute, so return undefined var ret = element.getAttribute(name, 2); // normalize non-existing attributes to undefined (as jQuery) return ret === null ? undefined : ret; } }, prop: function(element, name, value) { if (isDefined(value)) { element[name] = value; } else { return element[name]; } }, text: (function() { getText.$dv = ''; return getText; function getText(element, value) { if (isUndefined(value)) { var nodeType = element.nodeType; return (nodeType === NODE_TYPE_ELEMENT || nodeType === NODE_TYPE_TEXT) ? element.textContent : ''; } element.textContent = value; } })(), val: function(element, value) { if (isUndefined(value)) { if (element.multiple && nodeName_(element) === 'select') { var result = []; forEach(element.options, function(option) { if (option.selected) { result.push(option.value || option.text); } }); return result.length === 0 ? null : result; } return element.value; } element.value = value; }, html: function(element, value) { if (isUndefined(value)) { return element.innerHTML; } jqLiteDealoc(element, true); element.innerHTML = value; }, empty: jqLiteEmpty }, function(fn, name) { /** * Properties: writes return selection, reads return first value */ JQLite.prototype[name] = function(arg1, arg2) { var i, key; var nodeCount = this.length; // jqLiteHasClass has only two arguments, but is a getter-only fn, so we need to special-case it // in a way that survives minification. // jqLiteEmpty takes no arguments but is a setter. if (fn !== jqLiteEmpty && (((fn.length == 2 && (fn !== jqLiteHasClass && fn !== jqLiteController)) ? arg1 : arg2) === undefined)) { if (isObject(arg1)) { // we are a write, but the object properties are the key/values for (i = 0; i < nodeCount; i++) { if (fn === jqLiteData) { // data() takes the whole object in jQuery fn(this[i], arg1); } else { for (key in arg1) { fn(this[i], key, arg1[key]); } } } // return self for chaining return this; } else { // we are a read, so read the first child. // TODO: do we still need this? var value = fn.$dv; // Only if we have $dv do we iterate over all, otherwise it is just the first element. var jj = (value === undefined) ? Math.min(nodeCount, 1) : nodeCount; for (var j = 0; j < jj; j++) { var nodeValue = fn(this[j], arg1, arg2); value = value ? value + nodeValue : nodeValue; } return value; } } else { // we are a write, so apply to all children for (i = 0; i < nodeCount; i++) { fn(this[i], arg1, arg2); } // return self for chaining return this; } }; }); function createEventHandler(element, events) { var eventHandler = function(event, type) { // jQuery specific api event.isDefaultPrevented = function() { return event.defaultPrevented; }; var eventFns = events[type || event.type]; var eventFnsLength = eventFns ? eventFns.length : 0; if (!eventFnsLength) return; if (isUndefined(event.immediatePropagationStopped)) { var originalStopImmediatePropagation = event.stopImmediatePropagation; event.stopImmediatePropagation = function() { event.immediatePropagationStopped = true; if (event.stopPropagation) { event.stopPropagation(); } if (originalStopImmediatePropagation) { originalStopImmediatePropagation.call(event); } }; } event.isImmediatePropagationStopped = function() { return event.immediatePropagationStopped === true; }; // Copy event handlers in case event handlers array is modified during execution. if ((eventFnsLength > 1)) { eventFns = shallowCopy(eventFns); } for (var i = 0; i < eventFnsLength; i++) { if (!event.isImmediatePropagationStopped()) { eventFns[i].call(element, event); } } }; // TODO: this is a hack for angularMocks/clearDataCache that makes it possible to deregister all // events on `element` eventHandler.elem = element; return eventHandler; } ////////////////////////////////////////// // Functions iterating traversal. // These functions chain results into a single // selector. ////////////////////////////////////////// forEach({ removeData: jqLiteRemoveData, on: function jqLiteOn(element, type, fn, unsupported) { if (isDefined(unsupported)) throw jqLiteMinErr('onargs', 'jqLite#on() does not support the `selector` or `eventData` parameters'); // Do not add event handlers to non-elements because they will not be cleaned up. if (!jqLiteAcceptsData(element)) { return; } var expandoStore = jqLiteExpandoStore(element, true); var events = expandoStore.events; var handle = expandoStore.handle; if (!handle) { handle = expandoStore.handle = createEventHandler(element, events); } // http://jsperf.com/string-indexof-vs-split var types = type.indexOf(' ') >= 0 ? type.split(' ') : [type]; var i = types.length; while (i--) { type = types[i]; var eventFns = events[type]; if (!eventFns) { events[type] = []; if (type === 'mouseenter' || type === 'mouseleave') { // Refer to jQuery's implementation of mouseenter & mouseleave // Read about mouseenter and mouseleave: // http://www.quirksmode.org/js/events_mouse.html#link8 jqLiteOn(element, MOUSE_EVENT_MAP[type], function(event) { var target = this, related = event.relatedTarget; // For mousenter/leave call the handler if related is outside the target. // NB: No relatedTarget if the mouse left/entered the browser window if (!related || (related !== target && !target.contains(related))) { handle(event, type); } }); } else { if (type !== '$destroy') { addEventListenerFn(element, type, handle); } } eventFns = events[type]; } eventFns.push(fn); } }, off: jqLiteOff, one: function(element, type, fn) { element = jqLite(element); //add the listener twice so that when it is called //you can remove the original function and still be //able to call element.off(ev, fn) normally element.on(type, function onFn() { element.off(type, fn); element.off(type, onFn); }); element.on(type, fn); }, replaceWith: function(element, replaceNode) { var index, parent = element.parentNode; jqLiteDealoc(element); forEach(new JQLite(replaceNode), function(node) { if (index) { parent.insertBefore(node, index.nextSibling); } else { parent.replaceChild(node, element); } index = node; }); }, children: function(element) { var children = []; forEach(element.childNodes, function(element) { if (element.nodeType === NODE_TYPE_ELEMENT) children.push(element); }); return children; }, contents: function(element) { return element.contentDocument || element.childNodes || []; }, append: function(element, node) { var nodeType = element.nodeType; if (nodeType !== NODE_TYPE_ELEMENT && nodeType !== NODE_TYPE_DOCUMENT_FRAGMENT) return; node = new JQLite(node); for (var i = 0, ii = node.length; i < ii; i++) { var child = node[i]; element.appendChild(child); } }, prepend: function(element, node) { if (element.nodeType === NODE_TYPE_ELEMENT) { var index = element.firstChild; forEach(new JQLite(node), function(child) { element.insertBefore(child, index); }); } }, wrap: function(element, wrapNode) { wrapNode = jqLite(wrapNode).eq(0).clone()[0]; var parent = element.parentNode; if (parent) { parent.replaceChild(wrapNode, element); } wrapNode.appendChild(element); }, remove: jqLiteRemove, detach: function(element) { jqLiteRemove(element, true); }, after: function(element, newElement) { var index = element, parent = element.parentNode; newElement = new JQLite(newElement); for (var i = 0, ii = newElement.length; i < ii; i++) { var node = newElement[i]; parent.insertBefore(node, index.nextSibling); index = node; } }, addClass: jqLiteAddClass, removeClass: jqLiteRemoveClass, toggleClass: function(element, selector, condition) { if (selector) { forEach(selector.split(' '), function(className) { var classCondition = condition; if (isUndefined(classCondition)) { classCondition = !jqLiteHasClass(element, className); } (classCondition ? jqLiteAddClass : jqLiteRemoveClass)(element, className); }); } }, parent: function(element) { var parent = element.parentNode; return parent && parent.nodeType !== NODE_TYPE_DOCUMENT_FRAGMENT ? parent : null; }, next: function(element) { return element.nextElementSibling; }, find: function(element, selector) { if (element.getElementsByTagName) { return element.getElementsByTagName(selector); } else { return []; } }, clone: jqLiteClone, triggerHandler: function(element, event, extraParameters) { var dummyEvent, eventFnsCopy, handlerArgs; var eventName = event.type || event; var expandoStore = jqLiteExpandoStore(element); var events = expandoStore && expandoStore.events; var eventFns = events && events[eventName]; if (eventFns) { // Create a dummy event to pass to the handlers dummyEvent = { preventDefault: function() { this.defaultPrevented = true; }, isDefaultPrevented: function() { return this.defaultPrevented === true; }, stopImmediatePropagation: function() { this.immediatePropagationStopped = true; }, isImmediatePropagationStopped: function() { return this.immediatePropagationStopped === true; }, stopPropagation: noop, type: eventName, target: element }; // If a custom event was provided then extend our dummy event with it if (event.type) { dummyEvent = extend(dummyEvent, event); } // Copy event handlers in case event handlers array is modified during execution. eventFnsCopy = shallowCopy(eventFns); handlerArgs = extraParameters ? [dummyEvent].concat(extraParameters) : [dummyEvent]; forEach(eventFnsCopy, function(fn) { if (!dummyEvent.isImmediatePropagationStopped()) { fn.apply(element, handlerArgs); } }); } } }, function(fn, name) { /** * chaining functions */ JQLite.prototype[name] = function(arg1, arg2, arg3) { var value; for (var i = 0, ii = this.length; i < ii; i++) { if (isUndefined(value)) { value = fn(this[i], arg1, arg2, arg3); if (isDefined(value)) { // any function which returns a value needs to be wrapped value = jqLite(value); } } else { jqLiteAddNodes(value, fn(this[i], arg1, arg2, arg3)); } } return isDefined(value) ? value : this; }; // bind legacy bind/unbind to on/off JQLite.prototype.bind = JQLite.prototype.on; JQLite.prototype.unbind = JQLite.prototype.off; }); // Provider for private $$jqLite service function $$jqLiteProvider() { this.$get = function $$jqLite() { return extend(JQLite, { hasClass: function(node, classes) { if (node.attr) node = node[0]; return jqLiteHasClass(node, classes); }, addClass: function(node, classes) { if (node.attr) node = node[0]; return jqLiteAddClass(node, classes); }, removeClass: function(node, classes) { if (node.attr) node = node[0]; return jqLiteRemoveClass(node, classes); } }); }; } /** * Computes a hash of an 'obj'. * Hash of a: * string is string * number is number as string * object is either result of calling $$hashKey function on the object or uniquely generated id, * that is also assigned to the $$hashKey property of the object. * * @param obj * @returns {string} hash string such that the same input will have the same hash string. * The resulting string key is in 'type:hashKey' format. */ function hashKey(obj, nextUidFn) { var key = obj && obj.$$hashKey; if (key) { if (typeof key === 'function') { key = obj.$$hashKey(); } return key; } var objType = typeof obj; if (objType == 'function' || (objType == 'object' && obj !== null)) { key = obj.$$hashKey = objType + ':' + (nextUidFn || nextUid)(); } else { key = objType + ':' + obj; } return key; } /** * HashMap which can use objects as keys */ function HashMap(array, isolatedUid) { if (isolatedUid) { var uid = 0; this.nextUid = function() { return ++uid; }; } forEach(array, this.put, this); } HashMap.prototype = { /** * Store key value pair * @param key key to store can be any type * @param value value to store can be any type */ put: function(key, value) { this[hashKey(key, this.nextUid)] = value; }, /** * @param key * @returns {Object} the value for the key */ get: function(key) { return this[hashKey(key, this.nextUid)]; }, /** * Remove the key/value pair * @param key */ remove: function(key) { var value = this[key = hashKey(key, this.nextUid)]; delete this[key]; return value; } }; /** * @ngdoc function * @module ng * @name angular.injector * @kind function * * @description * Creates an injector object that can be used for retrieving services as well as for * dependency injection (see {@link guide/di dependency injection}). * * @param {Array.<string|Function>} modules A list of module functions or their aliases. See * {@link angular.module}. The `ng` module must be explicitly added. * @param {boolean=} [strictDi=false] Whether the injector should be in strict mode, which * disallows argument name annotation inference. * @returns {injector} Injector object. See {@link auto.$injector $injector}. * * @example * Typical usage * ```js * // create an injector * var $injector = angular.injector(['ng']); * * // use the injector to kick off your application * // use the type inference to auto inject arguments, or use implicit injection * $injector.invoke(function($rootScope, $compile, $document) { * $compile($document)($rootScope); * $rootScope.$digest(); * }); * ``` * * Sometimes you want to get access to the injector of a currently running Angular app * from outside Angular. Perhaps, you want to inject and compile some markup after the * application has been bootstrapped. You can do this using the extra `injector()` added * to JQuery/jqLite elements. See {@link angular.element}. * * *This is fairly rare but could be the case if a third party library is injecting the * markup.* * * In the following example a new block of HTML containing a `ng-controller` * directive is added to the end of the document body by JQuery. We then compile and link * it into the current AngularJS scope. * * ```js * var $div = $('<div ng-controller="MyCtrl">{{content.label}}</div>'); * $(document.body).append($div); * * angular.element(document).injector().invoke(function($compile) { * var scope = angular.element($div).scope(); * $compile($div)(scope); * }); * ``` */ /** * @ngdoc module * @name auto * @description * * Implicit module which gets automatically added to each {@link auto.$injector $injector}. */ var FN_ARGS = /^function\s*[^\(]*\(\s*([^\)]*)\)/m; var FN_ARG_SPLIT = /,/; var FN_ARG = /^\s*(_?)(\S+?)\1\s*$/; var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg; var $injectorMinErr = minErr('$injector'); function anonFn(fn) { // For anonymous functions, showing at the very least the function signature can help in // debugging. var fnText = fn.toString().replace(STRIP_COMMENTS, ''), args = fnText.match(FN_ARGS); if (args) { return 'function(' + (args[1] || '').replace(/[\s\r\n]+/, ' ') + ')'; } return 'fn'; } function annotate(fn, strictDi, name) { var $inject, fnText, argDecl, last; if (typeof fn === 'function') { if (!($inject = fn.$inject)) { $inject = []; if (fn.length) { if (strictDi) { if (!isString(name) || !name) { name = fn.name || anonFn(fn); } throw $injectorMinErr('strictdi', '{0} is not using explicit annotation and cannot be invoked in strict mode', name); } fnText = fn.toString().replace(STRIP_COMMENTS, ''); argDecl = fnText.match(FN_ARGS); forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg) { arg.replace(FN_ARG, function(all, underscore, name) { $inject.push(name); }); }); } fn.$inject = $inject; } } else if (isArray(fn)) { last = fn.length - 1; assertArgFn(fn[last], 'fn'); $inject = fn.slice(0, last); } else { assertArgFn(fn, 'fn', true); } return $inject; } /////////////////////////////////////// /** * @ngdoc service * @name $injector * * @description * * `$injector` is used to retrieve object instances as defined by * {@link auto.$provide provider}, instantiate types, invoke methods, * and load modules. * * The following always holds true: * * ```js * var $injector = angular.injector(); * expect($injector.get('$injector')).toBe($injector); * expect($injector.invoke(function($injector) { * return $injector; * })).toBe($injector); * ``` * * # Injection Function Annotation * * JavaScript does not have annotations, and annotations are needed for dependency injection. The * following are all valid ways of annotating function with injection arguments and are equivalent. * * ```js * // inferred (only works if code not minified/obfuscated) * $injector.invoke(function(serviceA){}); * * // annotated * function explicit(serviceA) {}; * explicit.$inject = ['serviceA']; * $injector.invoke(explicit); * * // inline * $injector.invoke(['serviceA', function(serviceA){}]); * ``` * * ## Inference * * In JavaScript calling `toString()` on a function returns the function definition. The definition * can then be parsed and the function arguments can be extracted. This method of discovering * annotations is disallowed when the injector is in strict mode. * *NOTE:* This does not work with minification, and obfuscation tools since these tools change the * argument names. * * ## `$inject` Annotation * By adding an `$inject` property onto a function the injection parameters can be specified. * * ## Inline * As an array of injection names, where the last item in the array is the function to call. */ /** * @ngdoc method * @name $injector#get * * @description * Return an instance of the service. * * @param {string} name The name of the instance to retrieve. * @param {string} caller An optional string to provide the origin of the function call for error messages. * @return {*} The instance. */ /** * @ngdoc method * @name $injector#invoke * * @description * Invoke the method and supply the method arguments from the `$injector`. * * @param {!Function} fn The function to invoke. Function parameters are injected according to the * {@link guide/di $inject Annotation} rules. * @param {Object=} self The `this` for the invoked method. * @param {Object=} locals Optional object. If preset then any argument names are read from this * object first, before the `$injector` is consulted. * @returns {*} the value returned by the invoked `fn` function. */ /** * @ngdoc method * @name $injector#has * * @description * Allows the user to query if the particular service exists. * * @param {string} name Name of the service to query. * @returns {boolean} `true` if injector has given service. */ /** * @ngdoc method * @name $injector#instantiate * @description * Create a new instance of JS type. The method takes a constructor function, invokes the new * operator, and supplies all of the arguments to the constructor function as specified by the * constructor annotation. * * @param {Function} Type Annotated constructor function. * @param {Object=} locals Optional object. If preset then any argument names are read from this * object first, before the `$injector` is consulted. * @returns {Object} new instance of `Type`. */ /** * @ngdoc method * @name $injector#annotate * * @description * Returns an array of service names which the function is requesting for injection. This API is * used by the injector to determine which services need to be injected into the function when the * function is invoked. There are three ways in which the function can be annotated with the needed * dependencies. * * # Argument names * * The simplest form is to extract the dependencies from the arguments of the function. This is done * by converting the function into a string using `toString()` method and extracting the argument * names. * ```js * // Given * function MyController($scope, $route) { * // ... * } * * // Then * expect(injector.annotate(MyController)).toEqual(['$scope', '$route']); * ``` * * You can disallow this method by using strict injection mode. * * This method does not work with code minification / obfuscation. For this reason the following * annotation strategies are supported. * * # The `$inject` property * * If a function has an `$inject` property and its value is an array of strings, then the strings * represent names of services to be injected into the function. * ```js * // Given * var MyController = function(obfuscatedScope, obfuscatedRoute) { * // ... * } * // Define function dependencies * MyController['$inject'] = ['$scope', '$route']; * * // Then * expect(injector.annotate(MyController)).toEqual(['$scope', '$route']); * ``` * * # The array notation * * It is often desirable to inline Injected functions and that's when setting the `$inject` property * is very inconvenient. In these situations using the array notation to specify the dependencies in * a way that survives minification is a better choice: * * ```js * // We wish to write this (not minification / obfuscation safe) * injector.invoke(function($compile, $rootScope) { * // ... * }); * * // We are forced to write break inlining * var tmpFn = function(obfuscatedCompile, obfuscatedRootScope) { * // ... * }; * tmpFn.$inject = ['$compile', '$rootScope']; * injector.invoke(tmpFn); * * // To better support inline function the inline annotation is supported * injector.invoke(['$compile', '$rootScope', function(obfCompile, obfRootScope) { * // ... * }]); * * // Therefore * expect(injector.annotate( * ['$compile', '$rootScope', function(obfus_$compile, obfus_$rootScope) {}]) * ).toEqual(['$compile', '$rootScope']); * ``` * * @param {Function|Array.<string|Function>} fn Function for which dependent service names need to * be retrieved as described above. * * @param {boolean=} [strictDi=false] Disallow argument name annotation inference. * * @returns {Array.<string>} The names of the services which the function requires. */ /** * @ngdoc service * @name $provide * * @description * * The {@link auto.$provide $provide} service has a number of methods for registering components * with the {@link auto.$injector $injector}. Many of these functions are also exposed on * {@link angular.Module}. * * An Angular **service** is a singleton object created by a **service factory**. These **service * factories** are functions which, in turn, are created by a **service provider**. * The **service providers** are constructor functions. When instantiated they must contain a * property called `$get`, which holds the **service factory** function. * * When you request a service, the {@link auto.$injector $injector} is responsible for finding the * correct **service provider**, instantiating it and then calling its `$get` **service factory** * function to get the instance of the **service**. * * Often services have no configuration options and there is no need to add methods to the service * provider. The provider will be no more than a constructor function with a `$get` property. For * these cases the {@link auto.$provide $provide} service has additional helper methods to register * services without specifying a provider. * * * {@link auto.$provide#provider provider(provider)} - registers a **service provider** with the * {@link auto.$injector $injector} * * {@link auto.$provide#constant constant(obj)} - registers a value/object that can be accessed by * providers and services. * * {@link auto.$provide#value value(obj)} - registers a value/object that can only be accessed by * services, not providers. * * {@link auto.$provide#factory factory(fn)} - registers a service **factory function**, `fn`, * that will be wrapped in a **service provider** object, whose `$get` property will contain the * given factory function. * * {@link auto.$provide#service service(class)} - registers a **constructor function**, `class` * that will be wrapped in a **service provider** object, whose `$get` property will instantiate * a new object using the given constructor function. * * See the individual methods for more information and examples. */ /** * @ngdoc method * @name $provide#provider * @description * * Register a **provider function** with the {@link auto.$injector $injector}. Provider functions * are constructor functions, whose instances are responsible for "providing" a factory for a * service. * * Service provider names start with the name of the service they provide followed by `Provider`. * For example, the {@link ng.$log $log} service has a provider called * {@link ng.$logProvider $logProvider}. * * Service provider objects can have additional methods which allow configuration of the provider * and its service. Importantly, you can configure what kind of service is created by the `$get` * method, or how that service will act. For example, the {@link ng.$logProvider $logProvider} has a * method {@link ng.$logProvider#debugEnabled debugEnabled} * which lets you specify whether the {@link ng.$log $log} service will log debug messages to the * console or not. * * @param {string} name The name of the instance. NOTE: the provider will be available under `name + 'Provider'` key. * @param {(Object|function())} provider If the provider is: * * - `Object`: then it should have a `$get` method. The `$get` method will be invoked using * {@link auto.$injector#invoke $injector.invoke()} when an instance needs to be created. * - `Constructor`: a new instance of the provider will be created using * {@link auto.$injector#instantiate $injector.instantiate()}, then treated as `object`. * * @returns {Object} registered provider instance * @example * * The following example shows how to create a simple event tracking service and register it using * {@link auto.$provide#provider $provide.provider()}. * * ```js * // Define the eventTracker provider * function EventTrackerProvider() { * var trackingUrl = '/track'; * * // A provider method for configuring where the tracked events should been saved * this.setTrackingUrl = function(url) { * trackingUrl = url; * }; * * // The service factory function * this.$get = ['$http', function($http) { * var trackedEvents = {}; * return { * // Call this to track an event * event: function(event) { * var count = trackedEvents[event] || 0; * count += 1; * trackedEvents[event] = count; * return count; * }, * // Call this to save the tracked events to the trackingUrl * save: function() { * $http.post(trackingUrl, trackedEvents); * } * }; * }]; * } * * describe('eventTracker', function() { * var postSpy; * * beforeEach(module(function($provide) { * // Register the eventTracker provider * $provide.provider('eventTracker', EventTrackerProvider); * })); * * beforeEach(module(function(eventTrackerProvider) { * // Configure eventTracker provider * eventTrackerProvider.setTrackingUrl('/custom-track'); * })); * * it('tracks events', inject(function(eventTracker) { * expect(eventTracker.event('login')).toEqual(1); * expect(eventTracker.event('login')).toEqual(2); * })); * * it('saves to the tracking url', inject(function(eventTracker, $http) { * postSpy = spyOn($http, 'post'); * eventTracker.event('login'); * eventTracker.save(); * expect(postSpy).toHaveBeenCalled(); * expect(postSpy.mostRecentCall.args[0]).not.toEqual('/track'); * expect(postSpy.mostRecentCall.args[0]).toEqual('/custom-track'); * expect(postSpy.mostRecentCall.args[1]).toEqual({ 'login': 1 }); * })); * }); * ``` */ /** * @ngdoc method * @name $provide#factory * @description * * Register a **service factory**, which will be called to return the service instance. * This is short for registering a service where its provider consists of only a `$get` property, * which is the given service factory function. * You should use {@link auto.$provide#factory $provide.factory(getFn)} if you do not need to * configure your service in a provider. * * @param {string} name The name of the instance. * @param {function()} $getFn The $getFn for the instance creation. Internally this is a short hand * for `$provide.provider(name, {$get: $getFn})`. * @returns {Object} registered provider instance * * @example * Here is an example of registering a service * ```js * $provide.factory('ping', ['$http', function($http) { * return function ping() { * return $http.send('/ping'); * }; * }]); * ``` * You would then inject and use this service like this: * ```js * someModule.controller('Ctrl', ['ping', function(ping) { * ping(); * }]); * ``` */ /** * @ngdoc method * @name $provide#service * @description * * Register a **service constructor**, which will be invoked with `new` to create the service * instance. * This is short for registering a service where its provider's `$get` property is the service * constructor function that will be used to instantiate the service instance. * * You should use {@link auto.$provide#service $provide.service(class)} if you define your service * as a type/class. * * @param {string} name The name of the instance. * @param {Function} constructor A class (constructor function) that will be instantiated. * @returns {Object} registered provider instance * * @example * Here is an example of registering a service using * {@link auto.$provide#service $provide.service(class)}. * ```js * var Ping = function($http) { * this.$http = $http; * }; * * Ping.$inject = ['$http']; * * Ping.prototype.send = function() { * return this.$http.get('/ping'); * }; * $provide.service('ping', Ping); * ``` * You would then inject and use this service like this: * ```js * someModule.controller('Ctrl', ['ping', function(ping) { * ping.send(); * }]); * ``` */ /** * @ngdoc method * @name $provide#value * @description * * Register a **value service** with the {@link auto.$injector $injector}, such as a string, a * number, an array, an object or a function. This is short for registering a service where its * provider's `$get` property is a factory function that takes no arguments and returns the **value * service**. * * Value services are similar to constant services, except that they cannot be injected into a * module configuration function (see {@link angular.Module#config}) but they can be overridden by * an Angular * {@link auto.$provide#decorator decorator}. * * @param {string} name The name of the instance. * @param {*} value The value. * @returns {Object} registered provider instance * * @example * Here are some examples of creating value services. * ```js * $provide.value('ADMIN_USER', 'admin'); * * $provide.value('RoleLookup', { admin: 0, writer: 1, reader: 2 }); * * $provide.value('halfOf', function(value) { * return value / 2; * }); * ``` */ /** * @ngdoc method * @name $provide#constant * @description * * Register a **constant service**, such as a string, a number, an array, an object or a function, * with the {@link auto.$injector $injector}. Unlike {@link auto.$provide#value value} it can be * injected into a module configuration function (see {@link angular.Module#config}) and it cannot * be overridden by an Angular {@link auto.$provide#decorator decorator}. * * @param {string} name The name of the constant. * @param {*} value The constant value. * @returns {Object} registered instance * * @example * Here a some examples of creating constants: * ```js * $provide.constant('SHARD_HEIGHT', 306); * * $provide.constant('MY_COLOURS', ['red', 'blue', 'grey']); * * $provide.constant('double', function(value) { * return value * 2; * }); * ``` */ /** * @ngdoc method * @name $provide#decorator * @description * * Register a **service decorator** with the {@link auto.$injector $injector}. A service decorator * intercepts the creation of a service, allowing it to override or modify the behaviour of the * service. The object returned by the decorator may be the original service, or a new service * object which replaces or wraps and delegates to the original service. * * @param {string} name The name of the service to decorate. * @param {function()} decorator This function will be invoked when the service needs to be * instantiated and should return the decorated service instance. The function is called using * the {@link auto.$injector#invoke injector.invoke} method and is therefore fully injectable. * Local injection arguments: * * * `$delegate` - The original service instance, which can be monkey patched, configured, * decorated or delegated to. * * @example * Here we decorate the {@link ng.$log $log} service to convert warnings to errors by intercepting * calls to {@link ng.$log#error $log.warn()}. * ```js * $provide.decorator('$log', ['$delegate', function($delegate) { * $delegate.warn = $delegate.error; * return $delegate; * }]); * ``` */ function createInjector(modulesToLoad, strictDi) { strictDi = (strictDi === true); var INSTANTIATING = {}, providerSuffix = 'Provider', path = [], loadedModules = new HashMap([], true), providerCache = { $provide: { provider: supportObject(provider), factory: supportObject(factory), service: supportObject(service), value: supportObject(value), constant: supportObject(constant), decorator: decorator } }, providerInjector = (providerCache.$injector = createInternalInjector(providerCache, function(serviceName, caller) { if (angular.isString(caller)) { path.push(caller); } throw $injectorMinErr('unpr', "Unknown provider: {0}", path.join(' <- ')); })), instanceCache = {}, instanceInjector = (instanceCache.$injector = createInternalInjector(instanceCache, function(serviceName, caller) { var provider = providerInjector.get(serviceName + providerSuffix, caller); return instanceInjector.invoke(provider.$get, provider, undefined, serviceName); })); forEach(loadModules(modulesToLoad), function(fn) { instanceInjector.invoke(fn || noop); }); return instanceInjector; //////////////////////////////////// // $provider //////////////////////////////////// function supportObject(delegate) { return function(key, value) { if (isObject(key)) { forEach(key, reverseParams(delegate)); } else { return delegate(key, value); } }; } function provider(name, provider_) { assertNotHasOwnProperty(name, 'service'); if (isFunction(provider_) || isArray(provider_)) { provider_ = providerInjector.instantiate(provider_); } if (!provider_.$get) { throw $injectorMinErr('pget', "Provider '{0}' must define $get factory method.", name); } return providerCache[name + providerSuffix] = provider_; } function enforceReturnValue(name, factory) { return function enforcedReturnValue() { var result = instanceInjector.invoke(factory, this); if (isUndefined(result)) { throw $injectorMinErr('undef', "Provider '{0}' must return a value from $get factory method.", name); } return result; }; } function factory(name, factoryFn, enforce) { return provider(name, { $get: enforce !== false ? enforceReturnValue(name, factoryFn) : factoryFn }); } function service(name, constructor) { return factory(name, ['$injector', function($injector) { return $injector.instantiate(constructor); }]); } function value(name, val) { return factory(name, valueFn(val), false); } function constant(name, value) { assertNotHasOwnProperty(name, 'constant'); providerCache[name] = value; instanceCache[name] = value; } function decorator(serviceName, decorFn) { var origProvider = providerInjector.get(serviceName + providerSuffix), orig$get = origProvider.$get; origProvider.$get = function() { var origInstance = instanceInjector.invoke(orig$get, origProvider); return instanceInjector.invoke(decorFn, null, {$delegate: origInstance}); }; } //////////////////////////////////// // Module Loading //////////////////////////////////// function loadModules(modulesToLoad) { var runBlocks = [], moduleFn; forEach(modulesToLoad, function(module) { if (loadedModules.get(module)) return; loadedModules.put(module, true); function runInvokeQueue(queue) { var i, ii; for (i = 0, ii = queue.length; i < ii; i++) { var invokeArgs = queue[i], provider = providerInjector.get(invokeArgs[0]); provider[invokeArgs[1]].apply(provider, invokeArgs[2]); } } try { if (isString(module)) { moduleFn = angularModule(module); runBlocks = runBlocks.concat(loadModules(moduleFn.requires)).concat(moduleFn._runBlocks); runInvokeQueue(moduleFn._invokeQueue); runInvokeQueue(moduleFn._configBlocks); } else if (isFunction(module)) { runBlocks.push(providerInjector.invoke(module)); } else if (isArray(module)) { runBlocks.push(providerInjector.invoke(module)); } else { assertArgFn(module, 'module'); } } catch (e) { if (isArray(module)) { module = module[module.length - 1]; } if (e.message && e.stack && e.stack.indexOf(e.message) == -1) { // Safari & FF's stack traces don't contain error.message content // unlike those of Chrome and IE // So if stack doesn't contain message, we create a new string that contains both. // Since error.stack is read-only in Safari, I'm overriding e and not e.stack here. /* jshint -W022 */ e = e.message + '\n' + e.stack; } throw $injectorMinErr('modulerr', "Failed to instantiate module {0} due to:\n{1}", module, e.stack || e.message || e); } }); return runBlocks; } //////////////////////////////////// // internal Injector //////////////////////////////////// function createInternalInjector(cache, factory) { function getService(serviceName, caller) { if (cache.hasOwnProperty(serviceName)) { if (cache[serviceName] === INSTANTIATING) { throw $injectorMinErr('cdep', 'Circular dependency found: {0}', serviceName + ' <- ' + path.join(' <- ')); } return cache[serviceName]; } else { try { path.unshift(serviceName); cache[serviceName] = INSTANTIATING; return cache[serviceName] = factory(serviceName, caller); } catch (err) { if (cache[serviceName] === INSTANTIATING) { delete cache[serviceName]; } throw err; } finally { path.shift(); } } } function invoke(fn, self, locals, serviceName) { if (typeof locals === 'string') { serviceName = locals; locals = null; } var args = [], $inject = createInjector.$$annotate(fn, strictDi, serviceName), length, i, key; for (i = 0, length = $inject.length; i < length; i++) { key = $inject[i]; if (typeof key !== 'string') { throw $injectorMinErr('itkn', 'Incorrect injection token! Expected service name as string, got {0}', key); } args.push( locals && locals.hasOwnProperty(key) ? locals[key] : getService(key, serviceName) ); } if (isArray(fn)) { fn = fn[length]; } // http://jsperf.com/angularjs-invoke-apply-vs-switch // #5388 return fn.apply(self, args); } function instantiate(Type, locals, serviceName) { // Check if Type is annotated and use just the given function at n-1 as parameter // e.g. someModule.factory('greeter', ['$window', function(renamed$window) {}]); // Object creation: http://jsperf.com/create-constructor/2 var instance = Object.create((isArray(Type) ? Type[Type.length - 1] : Type).prototype || null); var returnedValue = invoke(Type, instance, locals, serviceName); return isObject(returnedValue) || isFunction(returnedValue) ? returnedValue : instance; } return { invoke: invoke, instantiate: instantiate, get: getService, annotate: createInjector.$$annotate, has: function(name) { return providerCache.hasOwnProperty(name + providerSuffix) || cache.hasOwnProperty(name); } }; } } createInjector.$$annotate = annotate; /** * @ngdoc provider * @name $anchorScrollProvider * * @description * Use `$anchorScrollProvider` to disable automatic scrolling whenever * {@link ng.$location#hash $location.hash()} changes. */ function $AnchorScrollProvider() { var autoScrollingEnabled = true; /** * @ngdoc method * @name $anchorScrollProvider#disableAutoScrolling * * @description * By default, {@link ng.$anchorScroll $anchorScroll()} will automatically detect changes to * {@link ng.$location#hash $location.hash()} and scroll to the element matching the new hash.<br /> * Use this method to disable automatic scrolling. * * If automatic scrolling is disabled, one must explicitly call * {@link ng.$anchorScroll $anchorScroll()} in order to scroll to the element related to the * current hash. */ this.disableAutoScrolling = function() { autoScrollingEnabled = false; }; /** * @ngdoc service * @name $anchorScroll * @kind function * @requires $window * @requires $location * @requires $rootScope * * @description * When called, it checks the current value of {@link ng.$location#hash $location.hash()} and * scrolls to the related element, according to the rules specified in the * [Html5 spec](http://dev.w3.org/html5/spec/Overview.html#the-indicated-part-of-the-document). * * It also watches the {@link ng.$location#hash $location.hash()} and automatically scrolls to * match any anchor whenever it changes. This can be disabled by calling * {@link ng.$anchorScrollProvider#disableAutoScrolling $anchorScrollProvider.disableAutoScrolling()}. * * Additionally, you can use its {@link ng.$anchorScroll#yOffset yOffset} property to specify a * vertical scroll-offset (either fixed or dynamic). * * @property {(number|function|jqLite)} yOffset * If set, specifies a vertical scroll-offset. This is often useful when there are fixed * positioned elements at the top of the page, such as navbars, headers etc. * * `yOffset` can be specified in various ways: * - **number**: A fixed number of pixels to be used as offset.<br /><br /> * - **function**: A getter function called everytime `$anchorScroll()` is executed. Must return * a number representing the offset (in pixels).<br /><br /> * - **jqLite**: A jqLite/jQuery element to be used for specifying the offset. The distance from * the top of the page to the element's bottom will be used as offset.<br /> * **Note**: The element will be taken into account only as long as its `position` is set to * `fixed`. This option is useful, when dealing with responsive navbars/headers that adjust * their height and/or positioning according to the viewport's size. * * <br /> * <div class="alert alert-warning"> * In order for `yOffset` to work properly, scrolling should take place on the document's root and * not some child element. * </div> * * @example <example module="anchorScrollExample"> <file name="index.html"> <div id="scrollArea" ng-controller="ScrollController"> <a ng-click="gotoBottom()">Go to bottom</a> <a id="bottom"></a> You're at the bottom! </div> </file> <file name="script.js"> angular.module('anchorScrollExample', []) .controller('ScrollController', ['$scope', '$location', '$anchorScroll', function ($scope, $location, $anchorScroll) { $scope.gotoBottom = function() { // set the location.hash to the id of // the element you wish to scroll to. $location.hash('bottom'); // call $anchorScroll() $anchorScroll(); }; }]); </file> <file name="style.css"> #scrollArea { height: 280px; overflow: auto; } #bottom { display: block; margin-top: 2000px; } </file> </example> * * <hr /> * The example below illustrates the use of a vertical scroll-offset (specified as a fixed value). * See {@link ng.$anchorScroll#yOffset $anchorScroll.yOffset} for more details. * * @example <example module="anchorScrollOffsetExample"> <file name="index.html"> <div class="fixed-header" ng-controller="headerCtrl"> <a href="" ng-click="gotoAnchor(x)" ng-repeat="x in [1,2,3,4,5]"> Go to anchor {{x}} </a> </div> <div id="anchor{{x}}" class="anchor" ng-repeat="x in [1,2,3,4,5]"> Anchor {{x}} of 5 </div> </file> <file name="script.js"> angular.module('anchorScrollOffsetExample', []) .run(['$anchorScroll', function($anchorScroll) { $anchorScroll.yOffset = 50; // always scroll by 50 extra pixels }]) .controller('headerCtrl', ['$anchorScroll', '$location', '$scope', function ($anchorScroll, $location, $scope) { $scope.gotoAnchor = function(x) { var newHash = 'anchor' + x; if ($location.hash() !== newHash) { // set the $location.hash to `newHash` and // $anchorScroll will automatically scroll to it $location.hash('anchor' + x); } else { // call $anchorScroll() explicitly, // since $location.hash hasn't changed $anchorScroll(); } }; } ]); </file> <file name="style.css"> body { padding-top: 50px; } .anchor { border: 2px dashed DarkOrchid; padding: 10px 10px 200px 10px; } .fixed-header { background-color: rgba(0, 0, 0, 0.2); height: 50px; position: fixed; top: 0; left: 0; right: 0; } .fixed-header > a { display: inline-block; margin: 5px 15px; } </file> </example> */ this.$get = ['$window', '$location', '$rootScope', function($window, $location, $rootScope) { var document = $window.document; // Helper function to get first anchor from a NodeList // (using `Array#some()` instead of `angular#forEach()` since it's more performant // and working in all supported browsers.) function getFirstAnchor(list) { var result = null; Array.prototype.some.call(list, function(element) { if (nodeName_(element) === 'a') { result = element; return true; } }); return result; } function getYOffset() { var offset = scroll.yOffset; if (isFunction(offset)) { offset = offset(); } else if (isElement(offset)) { var elem = offset[0]; var style = $window.getComputedStyle(elem); if (style.position !== 'fixed') { offset = 0; } else { offset = elem.getBoundingClientRect().bottom; } } else if (!isNumber(offset)) { offset = 0; } return offset; } function scrollTo(elem) { if (elem) { elem.scrollIntoView(); var offset = getYOffset(); if (offset) { // `offset` is the number of pixels we should scroll UP in order to align `elem` properly. // This is true ONLY if the call to `elem.scrollIntoView()` initially aligns `elem` at the // top of the viewport. // // IF the number of pixels from the top of `elem` to the end of the page's content is less // than the height of the viewport, then `elem.scrollIntoView()` will align the `elem` some // way down the page. // // This is often the case for elements near the bottom of the page. // // In such cases we do not need to scroll the whole `offset` up, just the difference between // the top of the element and the offset, which is enough to align the top of `elem` at the // desired position. var elemTop = elem.getBoundingClientRect().top; $window.scrollBy(0, elemTop - offset); } } else { $window.scrollTo(0, 0); } } function scroll() { var hash = $location.hash(), elm; // empty hash, scroll to the top of the page if (!hash) scrollTo(null); // element with given id else if ((elm = document.getElementById(hash))) scrollTo(elm); // first anchor with given name :-D else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) scrollTo(elm); // no element and hash == 'top', scroll to the top of the page else if (hash === 'top') scrollTo(null); } // does not scroll when user clicks on anchor link that is currently on // (no url change, no $location.hash() change), browser native does scroll if (autoScrollingEnabled) { $rootScope.$watch(function autoScrollWatch() {return $location.hash();}, function autoScrollWatchAction(newVal, oldVal) { // skip the initial scroll if $location.hash is empty if (newVal === oldVal && newVal === '') return; jqLiteDocumentLoaded(function() { $rootScope.$evalAsync(scroll); }); }); } return scroll; }]; } var $animateMinErr = minErr('$animate'); /** * @ngdoc provider * @name $animateProvider * * @description * Default implementation of $animate that doesn't perform any animations, instead just * synchronously performs DOM * updates and calls done() callbacks. * * In order to enable animations the ngAnimate module has to be loaded. * * To see the functional implementation check out src/ngAnimate/animate.js */ var $AnimateProvider = ['$provide', function($provide) { this.$$selectors = {}; /** * @ngdoc method * @name $animateProvider#register * * @description * Registers a new injectable animation factory function. The factory function produces the * animation object which contains callback functions for each event that is expected to be * animated. * * * `eventFn`: `function(Element, doneFunction)` The element to animate, the `doneFunction` * must be called once the element animation is complete. If a function is returned then the * animation service will use this function to cancel the animation whenever a cancel event is * triggered. * * * ```js * return { * eventFn : function(element, done) { * //code to run the animation * //once complete, then run done() * return function cancellationFunction() { * //code to cancel the animation * } * } * } * ``` * * @param {string} name The name of the animation. * @param {Function} factory The factory function that will be executed to return the animation * object. */ this.register = function(name, factory) { var key = name + '-animation'; if (name && name.charAt(0) != '.') throw $animateMinErr('notcsel', "Expecting class selector starting with '.' got '{0}'.", name); this.$$selectors[name.substr(1)] = key; $provide.factory(key, factory); }; /** * @ngdoc method * @name $animateProvider#classNameFilter * * @description * Sets and/or returns the CSS class regular expression that is checked when performing * an animation. Upon bootstrap the classNameFilter value is not set at all and will * therefore enable $animate to attempt to perform an animation on any element. * When setting the classNameFilter value, animations will only be performed on elements * that successfully match the filter expression. This in turn can boost performance * for low-powered devices as well as applications containing a lot of structural operations. * @param {RegExp=} expression The className expression which will be checked against all animations * @return {RegExp} The current CSS className expression value. If null then there is no expression value */ this.classNameFilter = function(expression) { if (arguments.length === 1) { this.$$classNameFilter = (expression instanceof RegExp) ? expression : null; } return this.$$classNameFilter; }; this.$get = ['$$q', '$$asyncCallback', '$rootScope', function($$q, $$asyncCallback, $rootScope) { var currentDefer; function runAnimationPostDigest(fn) { var cancelFn, defer = $$q.defer(); defer.promise.$$cancelFn = function ngAnimateMaybeCancel() { cancelFn && cancelFn(); }; $rootScope.$$postDigest(function ngAnimatePostDigest() { cancelFn = fn(function ngAnimateNotifyComplete() { defer.resolve(); }); }); return defer.promise; } function resolveElementClasses(element, classes) { var toAdd = [], toRemove = []; var hasClasses = createMap(); forEach((element.attr('class') || '').split(/\s+/), function(className) { hasClasses[className] = true; }); forEach(classes, function(status, className) { var hasClass = hasClasses[className]; // If the most recent class manipulation (via $animate) was to remove the class, and the // element currently has the class, the class is scheduled for removal. Otherwise, if // the most recent class manipulation (via $animate) was to add the class, and the // element does not currently have the class, the class is scheduled to be added. if (status === false && hasClass) { toRemove.push(className); } else if (status === true && !hasClass) { toAdd.push(className); } }); return (toAdd.length + toRemove.length) > 0 && [toAdd.length ? toAdd : null, toRemove.length ? toRemove : null]; } function cachedClassManipulation(cache, classes, op) { for (var i=0, ii = classes.length; i < ii; ++i) { var className = classes[i]; cache[className] = op; } } function asyncPromise() { // only serve one instance of a promise in order to save CPU cycles if (!currentDefer) { currentDefer = $$q.defer(); $$asyncCallback(function() { currentDefer.resolve(); currentDefer = null; }); } return currentDefer.promise; } function applyStyles(element, options) { if (angular.isObject(options)) { var styles = extend(options.from || {}, options.to || {}); element.css(styles); } } /** * * @ngdoc service * @name $animate * @description The $animate service provides rudimentary DOM manipulation functions to * insert, remove and move elements within the DOM, as well as adding and removing classes. * This service is the core service used by the ngAnimate $animator service which provides * high-level animation hooks for CSS and JavaScript. * * $animate is available in the AngularJS core, however, the ngAnimate module must be included * to enable full out animation support. Otherwise, $animate will only perform simple DOM * manipulation operations. * * To learn more about enabling animation support, click here to visit the {@link ngAnimate * ngAnimate module page} as well as the {@link ngAnimate.$animate ngAnimate $animate service * page}. */ return { animate: function(element, from, to) { applyStyles(element, { from: from, to: to }); return asyncPromise(); }, /** * * @ngdoc method * @name $animate#enter * @kind function * @description Inserts the element into the DOM either after the `after` element or * as the first child within the `parent` element. When the function is called a promise * is returned that will be resolved at a later time. * @param {DOMElement} element the element which will be inserted into the DOM * @param {DOMElement} parent the parent element which will append the element as * a child (if the after element is not present) * @param {DOMElement} after the sibling element which will append the element * after itself * @param {object=} options an optional collection of styles that will be applied to the element. * @return {Promise} the animation callback promise */ enter: function(element, parent, after, options) { applyStyles(element, options); after ? after.after(element) : parent.prepend(element); return asyncPromise(); }, /** * * @ngdoc method * @name $animate#leave * @kind function * @description Removes the element from the DOM. When the function is called a promise * is returned that will be resolved at a later time. * @param {DOMElement} element the element which will be removed from the DOM * @param {object=} options an optional collection of options that will be applied to the element. * @return {Promise} the animation callback promise */ leave: function(element, options) { element.remove(); return asyncPromise(); }, /** * * @ngdoc method * @name $animate#move * @kind function * @description Moves the position of the provided element within the DOM to be placed * either after the `after` element or inside of the `parent` element. When the function * is called a promise is returned that will be resolved at a later time. * * @param {DOMElement} element the element which will be moved around within the * DOM * @param {DOMElement} parent the parent element where the element will be * inserted into (if the after element is not present) * @param {DOMElement} after the sibling element where the element will be * positioned next to * @param {object=} options an optional collection of options that will be applied to the element. * @return {Promise} the animation callback promise */ move: function(element, parent, after, options) { // Do not remove element before insert. Removing will cause data associated with the // element to be dropped. Insert will implicitly do the remove. return this.enter(element, parent, after, options); }, /** * * @ngdoc method * @name $animate#addClass * @kind function * @description Adds the provided className CSS class value to the provided element. * When the function is called a promise is returned that will be resolved at a later time. * @param {DOMElement} element the element which will have the className value * added to it * @param {string} className the CSS class which will be added to the element * @param {object=} options an optional collection of options that will be applied to the element. * @return {Promise} the animation callback promise */ addClass: function(element, className, options) { return this.setClass(element, className, [], options); }, $$addClassImmediately: function(element, className, options) { element = jqLite(element); className = !isString(className) ? (isArray(className) ? className.join(' ') : '') : className; forEach(element, function(element) { jqLiteAddClass(element, className); }); applyStyles(element, options); return asyncPromise(); }, /** * * @ngdoc method * @name $animate#removeClass * @kind function * @description Removes the provided className CSS class value from the provided element. * When the function is called a promise is returned that will be resolved at a later time. * @param {DOMElement} element the element which will have the className value * removed from it * @param {string} className the CSS class which will be removed from the element * @param {object=} options an optional collection of options that will be applied to the element. * @return {Promise} the animation callback promise */ removeClass: function(element, className, options) { return this.setClass(element, [], className, options); }, $$removeClassImmediately: function(element, className, options) { element = jqLite(element); className = !isString(className) ? (isArray(className) ? className.join(' ') : '') : className; forEach(element, function(element) { jqLiteRemoveClass(element, className); }); applyStyles(element, options); return asyncPromise(); }, /** * * @ngdoc method * @name $animate#setClass * @kind function * @description Adds and/or removes the given CSS classes to and from the element. * When the function is called a promise is returned that will be resolved at a later time. * @param {DOMElement} element the element which will have its CSS classes changed * removed from it * @param {string} add the CSS classes which will be added to the element * @param {string} remove the CSS class which will be removed from the element * @param {object=} options an optional collection of options that will be applied to the element. * @return {Promise} the animation callback promise */ setClass: function(element, add, remove, options) { var self = this; var STORAGE_KEY = '$$animateClasses'; var createdCache = false; element = jqLite(element); var cache = element.data(STORAGE_KEY); if (!cache) { cache = { classes: {}, options: options }; createdCache = true; } else if (options && cache.options) { cache.options = angular.extend(cache.options || {}, options); } var classes = cache.classes; add = isArray(add) ? add : add.split(' '); remove = isArray(remove) ? remove : remove.split(' '); cachedClassManipulation(classes, add, true); cachedClassManipulation(classes, remove, false); if (createdCache) { cache.promise = runAnimationPostDigest(function(done) { var cache = element.data(STORAGE_KEY); element.removeData(STORAGE_KEY); // in the event that the element is removed before postDigest // is run then the cache will be undefined and there will be // no need anymore to add or remove and of the element classes if (cache) { var classes = resolveElementClasses(element, cache.classes); if (classes) { self.$$setClassImmediately(element, classes[0], classes[1], cache.options); } } done(); }); element.data(STORAGE_KEY, cache); } return cache.promise; }, $$setClassImmediately: function(element, add, remove, options) { add && this.$$addClassImmediately(element, add); remove && this.$$removeClassImmediately(element, remove); applyStyles(element, options); return asyncPromise(); }, enabled: noop, cancel: noop }; }]; }]; function $$AsyncCallbackProvider() { this.$get = ['$$rAF', '$timeout', function($$rAF, $timeout) { return $$rAF.supported ? function(fn) { return $$rAF(fn); } : function(fn) { return $timeout(fn, 0, false); }; }]; } /* global stripHash: true */ /** * ! This is a private undocumented service ! * * @name $browser * @requires $log * @description * This object has two goals: * * - hide all the global state in the browser caused by the window object * - abstract away all the browser specific features and inconsistencies * * For tests we provide {@link ngMock.$browser mock implementation} of the `$browser` * service, which can be used for convenient testing of the application without the interaction with * the real browser apis. */ /** * @param {object} window The global window object. * @param {object} document jQuery wrapped document. * @param {object} $log window.console or an object with the same interface. * @param {object} $sniffer $sniffer service */ function Browser(window, document, $log, $sniffer) { var self = this, rawDocument = document[0], location = window.location, history = window.history, setTimeout = window.setTimeout, clearTimeout = window.clearTimeout, pendingDeferIds = {}; self.isMock = false; var outstandingRequestCount = 0; var outstandingRequestCallbacks = []; // TODO(vojta): remove this temporary api self.$$completeOutstandingRequest = completeOutstandingRequest; self.$$incOutstandingRequestCount = function() { outstandingRequestCount++; }; /** * Executes the `fn` function(supports currying) and decrements the `outstandingRequestCallbacks` * counter. If the counter reaches 0, all the `outstandingRequestCallbacks` are executed. */ function completeOutstandingRequest(fn) { try { fn.apply(null, sliceArgs(arguments, 1)); } finally { outstandingRequestCount--; if (outstandingRequestCount === 0) { while (outstandingRequestCallbacks.length) { try { outstandingRequestCallbacks.pop()(); } catch (e) { $log.error(e); } } } } } function getHash(url) { var index = url.indexOf('#'); return index === -1 ? '' : url.substr(index + 1); } /** * @private * Note: this method is used only by scenario runner * TODO(vojta): prefix this method with $$ ? * @param {function()} callback Function that will be called when no outstanding request */ self.notifyWhenNoOutstandingRequests = function(callback) { // force browser to execute all pollFns - this is needed so that cookies and other pollers fire // at some deterministic time in respect to the test runner's actions. Leaving things up to the // regular poller would result in flaky tests. forEach(pollFns, function(pollFn) { pollFn(); }); if (outstandingRequestCount === 0) { callback(); } else { outstandingRequestCallbacks.push(callback); } }; ////////////////////////////////////////////////////////////// // Poll Watcher API ////////////////////////////////////////////////////////////// var pollFns = [], pollTimeout; /** * @name $browser#addPollFn * * @param {function()} fn Poll function to add * * @description * Adds a function to the list of functions that poller periodically executes, * and starts polling if not started yet. * * @returns {function()} the added function */ self.addPollFn = function(fn) { if (isUndefined(pollTimeout)) startPoller(100, setTimeout); pollFns.push(fn); return fn; }; /** * @param {number} interval How often should browser call poll functions (ms) * @param {function()} setTimeout Reference to a real or fake `setTimeout` function. * * @description * Configures the poller to run in the specified intervals, using the specified * setTimeout fn and kicks it off. */ function startPoller(interval, setTimeout) { (function check() { forEach(pollFns, function(pollFn) { pollFn(); }); pollTimeout = setTimeout(check, interval); })(); } ////////////////////////////////////////////////////////////// // URL API ////////////////////////////////////////////////////////////// var cachedState, lastHistoryState, lastBrowserUrl = location.href, baseElement = document.find('base'), reloadLocation = null; cacheState(); lastHistoryState = cachedState; /** * @name $browser#url * * @description * GETTER: * Without any argument, this method just returns current value of location.href. * * SETTER: * With at least one argument, this method sets url to new value. * If html5 history api supported, pushState/replaceState is used, otherwise * location.href/location.replace is used. * Returns its own instance to allow chaining * * NOTE: this api is intended for use only by the $location service. Please use the * {@link ng.$location $location service} to change url. * * @param {string} url New url (when used as setter) * @param {boolean=} replace Should new url replace current history record? * @param {object=} state object to use with pushState/replaceState */ self.url = function(url, replace, state) { // In modern browsers `history.state` is `null` by default; treating it separately // from `undefined` would cause `$browser.url('/foo')` to change `history.state` // to undefined via `pushState`. Instead, let's change `undefined` to `null` here. if (isUndefined(state)) { state = null; } // Android Browser BFCache causes location, history reference to become stale. if (location !== window.location) location = window.location; if (history !== window.history) history = window.history; // setter if (url) { var sameState = lastHistoryState === state; // Don't change anything if previous and current URLs and states match. This also prevents // IE<10 from getting into redirect loop when in LocationHashbangInHtml5Url mode. // See https://github.com/angular/angular.js/commit/ffb2701 if (lastBrowserUrl === url && (!$sniffer.history || sameState)) { return self; } var sameBase = lastBrowserUrl && stripHash(lastBrowserUrl) === stripHash(url); lastBrowserUrl = url; lastHistoryState = state; // Don't use history API if only the hash changed // due to a bug in IE10/IE11 which leads // to not firing a `hashchange` nor `popstate` event // in some cases (see #9143). if ($sniffer.history && (!sameBase || !sameState)) { history[replace ? 'replaceState' : 'pushState'](state, '', url); cacheState(); // Do the assignment again so that those two variables are referentially identical. lastHistoryState = cachedState; } else { if (!sameBase) { reloadLocation = url; } if (replace) { location.replace(url); } else if (!sameBase) { location.href = url; } else { location.hash = getHash(url); } } return self; // getter } else { // - reloadLocation is needed as browsers don't allow to read out // the new location.href if a reload happened. // - the replacement is a workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=407172 return reloadLocation || location.href.replace(/%27/g,"'"); } }; /** * @name $browser#state * * @description * This method is a getter. * * Return history.state or null if history.state is undefined. * * @returns {object} state */ self.state = function() { return cachedState; }; var urlChangeListeners = [], urlChangeInit = false; function cacheStateAndFireUrlChange() { cacheState(); fireUrlChange(); } // This variable should be used *only* inside the cacheState function. var lastCachedState = null; function cacheState() { // This should be the only place in $browser where `history.state` is read. cachedState = window.history.state; cachedState = isUndefined(cachedState) ? null : cachedState; // Prevent callbacks fo fire twice if both hashchange & popstate were fired. if (equals(cachedState, lastCachedState)) { cachedState = lastCachedState; } lastCachedState = cachedState; } function fireUrlChange() { if (lastBrowserUrl === self.url() && lastHistoryState === cachedState) { return; } lastBrowserUrl = self.url(); lastHistoryState = cachedState; forEach(urlChangeListeners, function(listener) { listener(self.url(), cachedState); }); } /** * @name $browser#onUrlChange * * @description * Register callback function that will be called, when url changes. * * It's only called when the url is changed from outside of angular: * - user types different url into address bar * - user clicks on history (forward/back) button * - user clicks on a link * * It's not called when url is changed by $browser.url() method * * The listener gets called with new url as parameter. * * NOTE: this api is intended for use only by the $location service. Please use the * {@link ng.$location $location service} to monitor url changes in angular apps. * * @param {function(string)} listener Listener function to be called when url changes. * @return {function(string)} Returns the registered listener fn - handy if the fn is anonymous. */ self.onUrlChange = function(callback) { // TODO(vojta): refactor to use node's syntax for events if (!urlChangeInit) { // We listen on both (hashchange/popstate) when available, as some browsers (e.g. Opera) // don't fire popstate when user change the address bar and don't fire hashchange when url // changed by push/replaceState // html5 history api - popstate event if ($sniffer.history) jqLite(window).on('popstate', cacheStateAndFireUrlChange); // hashchange event jqLite(window).on('hashchange', cacheStateAndFireUrlChange); urlChangeInit = true; } urlChangeListeners.push(callback); return callback; }; /** * Checks whether the url has changed outside of Angular. * Needs to be exported to be able to check for changes that have been done in sync, * as hashchange/popstate events fire in async. */ self.$$checkUrlChange = fireUrlChange; ////////////////////////////////////////////////////////////// // Misc API ////////////////////////////////////////////////////////////// /** * @name $browser#baseHref * * @description * Returns current <base href> * (always relative - without domain) * * @returns {string} The current base href */ self.baseHref = function() { var href = baseElement.attr('href'); return href ? href.replace(/^(https?\:)?\/\/[^\/]*/, '') : ''; }; ////////////////////////////////////////////////////////////// // Cookies API ////////////////////////////////////////////////////////////// var lastCookies = {}; var lastCookieString = ''; var cookiePath = self.baseHref(); function safeDecodeURIComponent(str) { try { return decodeURIComponent(str); } catch (e) { return str; } } /** * @name $browser#cookies * * @param {string=} name Cookie name * @param {string=} value Cookie value * * @description * The cookies method provides a 'private' low level access to browser cookies. * It is not meant to be used directly, use the $cookie service instead. * * The return values vary depending on the arguments that the method was called with as follows: * * - cookies() -> hash of all cookies, this is NOT a copy of the internal state, so do not modify * it * - cookies(name, value) -> set name to value, if value is undefined delete the cookie * - cookies(name) -> the same as (name, undefined) == DELETES (no one calls it right now that * way) * * @returns {Object} Hash of all cookies (if called without any parameter) */ self.cookies = function(name, value) { var cookieLength, cookieArray, cookie, i, index; if (name) { if (value === undefined) { rawDocument.cookie = encodeURIComponent(name) + "=;path=" + cookiePath + ";expires=Thu, 01 Jan 1970 00:00:00 GMT"; } else { if (isString(value)) { cookieLength = (rawDocument.cookie = encodeURIComponent(name) + '=' + encodeURIComponent(value) + ';path=' + cookiePath).length + 1; // per http://www.ietf.org/rfc/rfc2109.txt browser must allow at minimum: // - 300 cookies // - 20 cookies per unique domain // - 4096 bytes per cookie if (cookieLength > 4096) { $log.warn("Cookie '" + name + "' possibly not set or overflowed because it was too large (" + cookieLength + " > 4096 bytes)!"); } } } } else { if (rawDocument.cookie !== lastCookieString) { lastCookieString = rawDocument.cookie; cookieArray = lastCookieString.split("; "); lastCookies = {}; for (i = 0; i < cookieArray.length; i++) { cookie = cookieArray[i]; index = cookie.indexOf('='); if (index > 0) { //ignore nameless cookies name = safeDecodeURIComponent(cookie.substring(0, index)); // the first value that is seen for a cookie is the most // specific one. values for the same cookie name that // follow are for less specific paths. if (lastCookies[name] === undefined) { lastCookies[name] = safeDecodeURIComponent(cookie.substring(index + 1)); } } } } return lastCookies; } }; /** * @name $browser#defer * @param {function()} fn A function, who's execution should be deferred. * @param {number=} [delay=0] of milliseconds to defer the function execution. * @returns {*} DeferId that can be used to cancel the task via `$browser.defer.cancel()`. * * @description * Executes a fn asynchronously via `setTimeout(fn, delay)`. * * Unlike when calling `setTimeout` directly, in test this function is mocked and instead of using * `setTimeout` in tests, the fns are queued in an array, which can be programmatically flushed * via `$browser.defer.flush()`. * */ self.defer = function(fn, delay) { var timeoutId; outstandingRequestCount++; timeoutId = setTimeout(function() { delete pendingDeferIds[timeoutId]; completeOutstandingRequest(fn); }, delay || 0); pendingDeferIds[timeoutId] = true; return timeoutId; }; /** * @name $browser#defer.cancel * * @description * Cancels a deferred task identified with `deferId`. * * @param {*} deferId Token returned by the `$browser.defer` function. * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully * canceled. */ self.defer.cancel = function(deferId) { if (pendingDeferIds[deferId]) { delete pendingDeferIds[deferId]; clearTimeout(deferId); completeOutstandingRequest(noop); return true; } return false; }; } function $BrowserProvider() { this.$get = ['$window', '$log', '$sniffer', '$document', function($window, $log, $sniffer, $document) { return new Browser($window, $document, $log, $sniffer); }]; } /** * @ngdoc service * @name $cacheFactory * * @description * Factory that constructs {@link $cacheFactory.Cache Cache} objects and gives access to * them. * * ```js * * var cache = $cacheFactory('cacheId'); * expect($cacheFactory.get('cacheId')).toBe(cache); * expect($cacheFactory.get('noSuchCacheId')).not.toBeDefined(); * * cache.put("key", "value"); * cache.put("another key", "another value"); * * // We've specified no options on creation * expect(cache.info()).toEqual({id: 'cacheId', size: 2}); * * ``` * * * @param {string} cacheId Name or id of the newly created cache. * @param {object=} options Options object that specifies the cache behavior. Properties: * * - `{number=}` `capacity` — turns the cache into LRU cache. * * @returns {object} Newly created cache object with the following set of methods: * * - `{object}` `info()` — Returns id, size, and options of cache. * - `{{*}}` `put({string} key, {*} value)` — Puts a new key-value pair into the cache and returns * it. * - `{{*}}` `get({string} key)` — Returns cached value for `key` or undefined for cache miss. * - `{void}` `remove({string} key)` — Removes a key-value pair from the cache. * - `{void}` `removeAll()` — Removes all cached values. * - `{void}` `destroy()` — Removes references to this cache from $cacheFactory. * * @example <example module="cacheExampleApp"> <file name="index.html"> <div ng-controller="CacheController"> <input ng-model="newCacheKey" placeholder="Key"> <input ng-model="newCacheValue" placeholder="Value"> <button ng-click="put(newCacheKey, newCacheValue)">Cache</button> <p ng-if="keys.length">Cached Values</p> <div ng-repeat="key in keys"> <span ng-bind="key"></span> <span>: </span> <b ng-bind="cache.get(key)"></b> </div> <p>Cache Info</p> <div ng-repeat="(key, value) in cache.info()"> <span ng-bind="key"></span> <span>: </span> <b ng-bind="value"></b> </div> </div> </file> <file name="script.js"> angular.module('cacheExampleApp', []). controller('CacheController', ['$scope', '$cacheFactory', function($scope, $cacheFactory) { $scope.keys = []; $scope.cache = $cacheFactory('cacheId'); $scope.put = function(key, value) { if ($scope.cache.get(key) === undefined) { $scope.keys.push(key); } $scope.cache.put(key, value === undefined ? null : value); }; }]); </file> <file name="style.css"> p { margin: 10px 0 3px; } </file> </example> */ function $CacheFactoryProvider() { this.$get = function() { var caches = {}; function cacheFactory(cacheId, options) { if (cacheId in caches) { throw minErr('$cacheFactory')('iid', "CacheId '{0}' is already taken!", cacheId); } var size = 0, stats = extend({}, options, {id: cacheId}), data = {}, capacity = (options && options.capacity) || Number.MAX_VALUE, lruHash = {}, freshEnd = null, staleEnd = null; /** * @ngdoc type * @name $cacheFactory.Cache * * @description * A cache object used to store and retrieve data, primarily used by * {@link $http $http} and the {@link ng.directive:script script} directive to cache * templates and other data. * * ```js * angular.module('superCache') * .factory('superCache', ['$cacheFactory', function($cacheFactory) { * return $cacheFactory('super-cache'); * }]); * ``` * * Example test: * * ```js * it('should behave like a cache', inject(function(superCache) { * superCache.put('key', 'value'); * superCache.put('another key', 'another value'); * * expect(superCache.info()).toEqual({ * id: 'super-cache', * size: 2 * }); * * superCache.remove('another key'); * expect(superCache.get('another key')).toBeUndefined(); * * superCache.removeAll(); * expect(superCache.info()).toEqual({ * id: 'super-cache', * size: 0 * }); * })); * ``` */ return caches[cacheId] = { /** * @ngdoc method * @name $cacheFactory.Cache#put * @kind function * * @description * Inserts a named entry into the {@link $cacheFactory.Cache Cache} object to be * retrieved later, and incrementing the size of the cache if the key was not already * present in the cache. If behaving like an LRU cache, it will also remove stale * entries from the set. * * It will not insert undefined values into the cache. * * @param {string} key the key under which the cached data is stored. * @param {*} value the value to store alongside the key. If it is undefined, the key * will not be stored. * @returns {*} the value stored. */ put: function(key, value) { if (capacity < Number.MAX_VALUE) { var lruEntry = lruHash[key] || (lruHash[key] = {key: key}); refresh(lruEntry); } if (isUndefined(value)) return; if (!(key in data)) size++; data[key] = value; if (size > capacity) { this.remove(staleEnd.key); } return value; }, /** * @ngdoc method * @name $cacheFactory.Cache#get * @kind function * * @description * Retrieves named data stored in the {@link $cacheFactory.Cache Cache} object. * * @param {string} key the key of the data to be retrieved * @returns {*} the value stored. */ get: function(key) { if (capacity < Number.MAX_VALUE) { var lruEntry = lruHash[key]; if (!lruEntry) return; refresh(lruEntry); } return data[key]; }, /** * @ngdoc method * @name $cacheFactory.Cache#remove * @kind function * * @description * Removes an entry from the {@link $cacheFactory.Cache Cache} object. * * @param {string} key the key of the entry to be removed */ remove: function(key) { if (capacity < Number.MAX_VALUE) { var lruEntry = lruHash[key]; if (!lruEntry) return; if (lruEntry == freshEnd) freshEnd = lruEntry.p; if (lruEntry == staleEnd) staleEnd = lruEntry.n; link(lruEntry.n,lruEntry.p); delete lruHash[key]; } delete data[key]; size--; }, /** * @ngdoc method * @name $cacheFactory.Cache#removeAll * @kind function * * @description * Clears the cache object of any entries. */ removeAll: function() { data = {}; size = 0; lruHash = {}; freshEnd = staleEnd = null; }, /** * @ngdoc method * @name $cacheFactory.Cache#destroy * @kind function * * @description * Destroys the {@link $cacheFactory.Cache Cache} object entirely, * removing it from the {@link $cacheFactory $cacheFactory} set. */ destroy: function() { data = null; stats = null; lruHash = null; delete caches[cacheId]; }, /** * @ngdoc method * @name $cacheFactory.Cache#info * @kind function * * @description * Retrieve information regarding a particular {@link $cacheFactory.Cache Cache}. * * @returns {object} an object with the following properties: * <ul> * <li>**id**: the id of the cache instance</li> * <li>**size**: the number of entries kept in the cache instance</li> * <li>**...**: any additional properties from the options object when creating the * cache.</li> * </ul> */ info: function() { return extend({}, stats, {size: size}); } }; /** * makes the `entry` the freshEnd of the LRU linked list */ function refresh(entry) { if (entry != freshEnd) { if (!staleEnd) { staleEnd = entry; } else if (staleEnd == entry) { staleEnd = entry.n; } link(entry.n, entry.p); link(entry, freshEnd); freshEnd = entry; freshEnd.n = null; } } /** * bidirectionally links two entries of the LRU linked list */ function link(nextEntry, prevEntry) { if (nextEntry != prevEntry) { if (nextEntry) nextEntry.p = prevEntry; //p stands for previous, 'prev' didn't minify if (prevEntry) prevEntry.n = nextEntry; //n stands for next, 'next' didn't minify } } } /** * @ngdoc method * @name $cacheFactory#info * * @description * Get information about all the caches that have been created * * @returns {Object} - key-value map of `cacheId` to the result of calling `cache#info` */ cacheFactory.info = function() { var info = {}; forEach(caches, function(cache, cacheId) { info[cacheId] = cache.info(); }); return info; }; /** * @ngdoc method * @name $cacheFactory#get * * @description * Get access to a cache object by the `cacheId` used when it was created. * * @param {string} cacheId Name or id of a cache to access. * @returns {object} Cache object identified by the cacheId or undefined if no such cache. */ cacheFactory.get = function(cacheId) { return caches[cacheId]; }; return cacheFactory; }; } /** * @ngdoc service * @name $templateCache * * @description * The first time a template is used, it is loaded in the template cache for quick retrieval. You * can load templates directly into the cache in a `script` tag, or by consuming the * `$templateCache` service directly. * * Adding via the `script` tag: * * ```html * <script type="text/ng-template" id="templateId.html"> * <p>This is the content of the template</p> * </script> * ``` * * **Note:** the `script` tag containing the template does not need to be included in the `head` of * the document, but it must be a descendent of the {@link ng.$rootElement $rootElement} (IE, * element with ng-app attribute), otherwise the template will be ignored. * * Adding via the $templateCache service: * * ```js * var myApp = angular.module('myApp', []); * myApp.run(function($templateCache) { * $templateCache.put('templateId.html', 'This is the content of the template'); * }); * ``` * * To retrieve the template later, simply use it in your HTML: * ```html * <div ng-include=" 'templateId.html' "></div> * ``` * * or get it via Javascript: * ```js * $templateCache.get('templateId.html') * ``` * * See {@link ng.$cacheFactory $cacheFactory}. * */ function $TemplateCacheProvider() { this.$get = ['$cacheFactory', function($cacheFactory) { return $cacheFactory('templates'); }]; } /* ! VARIABLE/FUNCTION NAMING CONVENTIONS THAT APPLY TO THIS FILE! * * DOM-related variables: * * - "node" - DOM Node * - "element" - DOM Element or Node * - "$node" or "$element" - jqLite-wrapped node or element * * * Compiler related stuff: * * - "linkFn" - linking fn of a single directive * - "nodeLinkFn" - function that aggregates all linking fns for a particular node * - "childLinkFn" - function that aggregates all linking fns for child nodes of a particular node * - "compositeLinkFn" - function that aggregates all linking fns for a compilation root (nodeList) */ /** * @ngdoc service * @name $compile * @kind function * * @description * Compiles an HTML string or DOM into a template and produces a template function, which * can then be used to link {@link ng.$rootScope.Scope `scope`} and the template together. * * The compilation is a process of walking the DOM tree and matching DOM elements to * {@link ng.$compileProvider#directive directives}. * * <div class="alert alert-warning"> * **Note:** This document is an in-depth reference of all directive options. * For a gentle introduction to directives with examples of common use cases, * see the {@link guide/directive directive guide}. * </div> * * ## Comprehensive Directive API * * There are many different options for a directive. * * The difference resides in the return value of the factory function. * You can either return a "Directive Definition Object" (see below) that defines the directive properties, * or just the `postLink` function (all other properties will have the default values). * * <div class="alert alert-success"> * **Best Practice:** It's recommended to use the "directive definition object" form. * </div> * * Here's an example directive declared with a Directive Definition Object: * * ```js * var myModule = angular.module(...); * * myModule.directive('directiveName', function factory(injectables) { * var directiveDefinitionObject = { * priority: 0, * template: '<div></div>', // or // function(tElement, tAttrs) { ... }, * // or * // templateUrl: 'directive.html', // or // function(tElement, tAttrs) { ... }, * transclude: false, * restrict: 'A', * templateNamespace: 'html', * scope: false, * controller: function($scope, $element, $attrs, $transclude, otherInjectables) { ... }, * controllerAs: 'stringAlias', * require: 'siblingDirectiveName', // or // ['^parentDirectiveName', '?optionalDirectiveName', '?^optionalParent'], * compile: function compile(tElement, tAttrs, transclude) { * return { * pre: function preLink(scope, iElement, iAttrs, controller) { ... }, * post: function postLink(scope, iElement, iAttrs, controller) { ... } * } * // or * // return function postLink( ... ) { ... } * }, * // or * // link: { * // pre: function preLink(scope, iElement, iAttrs, controller) { ... }, * // post: function postLink(scope, iElement, iAttrs, controller) { ... } * // } * // or * // link: function postLink( ... ) { ... } * }; * return directiveDefinitionObject; * }); * ``` * * <div class="alert alert-warning"> * **Note:** Any unspecified options will use the default value. You can see the default values below. * </div> * * Therefore the above can be simplified as: * * ```js * var myModule = angular.module(...); * * myModule.directive('directiveName', function factory(injectables) { * var directiveDefinitionObject = { * link: function postLink(scope, iElement, iAttrs) { ... } * }; * return directiveDefinitionObject; * // or * // return function postLink(scope, iElement, iAttrs) { ... } * }); * ``` * * * * ### Directive Definition Object * * The directive definition object provides instructions to the {@link ng.$compile * compiler}. The attributes are: * * #### `multiElement` * When this property is set to true, the HTML compiler will collect DOM nodes between * nodes with the attributes `directive-name-start` and `directive-name-end`, and group them * together as the directive elements. It is recommended that this feature be used on directives * which are not strictly behavioural (such as {@link ngClick}), and which * do not manipulate or replace child nodes (such as {@link ngInclude}). * * #### `priority` * When there are multiple directives defined on a single DOM element, sometimes it * is necessary to specify the order in which the directives are applied. The `priority` is used * to sort the directives before their `compile` functions get called. Priority is defined as a * number. Directives with greater numerical `priority` are compiled first. Pre-link functions * are also run in priority order, but post-link functions are run in reverse order. The order * of directives with the same priority is undefined. The default priority is `0`. * * #### `terminal` * If set to true then the current `priority` will be the last set of directives * which will execute (any directives at the current priority will still execute * as the order of execution on same `priority` is undefined). Note that expressions * and other directives used in the directive's template will also be excluded from execution. * * #### `scope` * **If set to `true`,** then a new scope will be created for this directive. If multiple directives on the * same element request a new scope, only one new scope is created. The new scope rule does not * apply for the root of the template since the root of the template always gets a new scope. * * **If set to `{}` (object hash),** then a new "isolate" scope is created. The 'isolate' scope differs from * normal scope in that it does not prototypically inherit from the parent scope. This is useful * when creating reusable components, which should not accidentally read or modify data in the * parent scope. * * The 'isolate' scope takes an object hash which defines a set of local scope properties * derived from the parent scope. These local properties are useful for aliasing values for * templates. Locals definition is a hash of local scope property to its source: * * * `@` or `@attr` - bind a local scope property to the value of DOM attribute. The result is * always a string since DOM attributes are strings. If no `attr` name is specified then the * attribute name is assumed to be the same as the local name. * Given `<widget my-attr="hello {{name}}">` and widget definition * of `scope: { localName:'@myAttr' }`, then widget scope property `localName` will reflect * the interpolated value of `hello {{name}}`. As the `name` attribute changes so will the * `localName` property on the widget scope. The `name` is read from the parent scope (not * component scope). * * * `=` or `=attr` - set up bi-directional binding between a local scope property and the * parent scope property of name defined via the value of the `attr` attribute. If no `attr` * name is specified then the attribute name is assumed to be the same as the local name. * Given `<widget my-attr="parentModel">` and widget definition of * `scope: { localModel:'=myAttr' }`, then widget scope property `localModel` will reflect the * value of `parentModel` on the parent scope. Any changes to `parentModel` will be reflected * in `localModel` and any changes in `localModel` will reflect in `parentModel`. If the parent * scope property doesn't exist, it will throw a NON_ASSIGNABLE_MODEL_EXPRESSION exception. You * can avoid this behavior using `=?` or `=?attr` in order to flag the property as optional. If * you want to shallow watch for changes (i.e. $watchCollection instead of $watch) you can use * `=*` or `=*attr` (`=*?` or `=*?attr` if the property is optional). * * * `&` or `&attr` - provides a way to execute an expression in the context of the parent scope. * If no `attr` name is specified then the attribute name is assumed to be the same as the * local name. Given `<widget my-attr="count = count + value">` and widget definition of * `scope: { localFn:'&myAttr' }`, then isolate scope property `localFn` will point to * a function wrapper for the `count = count + value` expression. Often it's desirable to * pass data from the isolated scope via an expression to the parent scope, this can be * done by passing a map of local variable names and values into the expression wrapper fn. * For example, if the expression is `increment(amount)` then we can specify the amount value * by calling the `localFn` as `localFn({amount: 22})`. * * * #### `bindToController` * When an isolate scope is used for a component (see above), and `controllerAs` is used, `bindToController: true` will * allow a component to have its properties bound to the controller, rather than to scope. When the controller * is instantiated, the initial values of the isolate scope bindings are already available. * * #### `controller` * Controller constructor function. The controller is instantiated before the * pre-linking phase and it is shared with other directives (see * `require` attribute). This allows the directives to communicate with each other and augment * each other's behavior. The controller is injectable (and supports bracket notation) with the following locals: * * * `$scope` - Current scope associated with the element * * `$element` - Current element * * `$attrs` - Current attributes object for the element * * `$transclude` - A transclude linking function pre-bound to the correct transclusion scope: * `function([scope], cloneLinkingFn, futureParentElement)`. * * `scope`: optional argument to override the scope. * * `cloneLinkingFn`: optional argument to create clones of the original transcluded content. * * `futureParentElement`: * * defines the parent to which the `cloneLinkingFn` will add the cloned elements. * * default: `$element.parent()` resp. `$element` for `transclude:'element'` resp. `transclude:true`. * * only needed for transcludes that are allowed to contain non html elements (e.g. SVG elements) * and when the `cloneLinkinFn` is passed, * as those elements need to created and cloned in a special way when they are defined outside their * usual containers (e.g. like `<svg>`). * * See also the `directive.templateNamespace` property. * * * #### `require` * Require another directive and inject its controller as the fourth argument to the linking function. The * `require` takes a string name (or array of strings) of the directive(s) to pass in. If an array is used, the * injected argument will be an array in corresponding order. If no such directive can be * found, or if the directive does not have a controller, then an error is raised. The name can be prefixed with: * * * (no prefix) - Locate the required controller on the current element. Throw an error if not found. * * `?` - Attempt to locate the required controller or pass `null` to the `link` fn if not found. * * `^` - Locate the required controller by searching the element and its parents. Throw an error if not found. * * `^^` - Locate the required controller by searching the element's parents. Throw an error if not found. * * `?^` - Attempt to locate the required controller by searching the element and its parents or pass * `null` to the `link` fn if not found. * * `?^^` - Attempt to locate the required controller by searching the element's parents, or pass * `null` to the `link` fn if not found. * * * #### `controllerAs` * Controller alias at the directive scope. An alias for the controller so it * can be referenced at the directive template. The directive needs to define a scope for this * configuration to be used. Useful in the case when directive is used as component. * * * #### `restrict` * String of subset of `EACM` which restricts the directive to a specific directive * declaration style. If omitted, the defaults (elements and attributes) are used. * * * `E` - Element name (default): `<my-directive></my-directive>` * * `A` - Attribute (default): `<div my-directive="exp"></div>` * * `C` - Class: `<div class="my-directive: exp;"></div>` * * `M` - Comment: `<!-- directive: my-directive exp -->` * * * #### `templateNamespace` * String representing the document type used by the markup in the template. * AngularJS needs this information as those elements need to be created and cloned * in a special way when they are defined outside their usual containers like `<svg>` and `<math>`. * * * `html` - All root nodes in the template are HTML. Root nodes may also be * top-level elements such as `<svg>` or `<math>`. * * `svg` - The root nodes in the template are SVG elements (excluding `<math>`). * * `math` - The root nodes in the template are MathML elements (excluding `<svg>`). * * If no `templateNamespace` is specified, then the namespace is considered to be `html`. * * #### `template` * HTML markup that may: * * Replace the contents of the directive's element (default). * * Replace the directive's element itself (if `replace` is true - DEPRECATED). * * Wrap the contents of the directive's element (if `transclude` is true). * * Value may be: * * * A string. For example `<div red-on-hover>{{delete_str}}</div>`. * * A function which takes two arguments `tElement` and `tAttrs` (described in the `compile` * function api below) and returns a string value. * * * #### `templateUrl` * This is similar to `template` but the template is loaded from the specified URL, asynchronously. * * Because template loading is asynchronous the compiler will suspend compilation of directives on that element * for later when the template has been resolved. In the meantime it will continue to compile and link * sibling and parent elements as though this element had not contained any directives. * * The compiler does not suspend the entire compilation to wait for templates to be loaded because this * would result in the whole app "stalling" until all templates are loaded asynchronously - even in the * case when only one deeply nested directive has `templateUrl`. * * Template loading is asynchronous even if the template has been preloaded into the {@link $templateCache} * * You can specify `templateUrl` as a string representing the URL or as a function which takes two * arguments `tElement` and `tAttrs` (described in the `compile` function api below) and returns * a string value representing the url. In either case, the template URL is passed through {@link * $sce#getTrustedResourceUrl $sce.getTrustedResourceUrl}. * * * #### `replace` ([*DEPRECATED*!], will be removed in next major release - i.e. v2.0) * specify what the template should replace. Defaults to `false`. * * * `true` - the template will replace the directive's element. * * `false` - the template will replace the contents of the directive's element. * * The replacement process migrates all of the attributes / classes from the old element to the new * one. See the {@link guide/directive#template-expanding-directive * Directives Guide} for an example. * * There are very few scenarios where element replacement is required for the application function, * the main one being reusable custom components that are used within SVG contexts * (because SVG doesn't work with custom elements in the DOM tree). * * #### `transclude` * Extract the contents of the element where the directive appears and make it available to the directive. * The contents are compiled and provided to the directive as a **transclusion function**. See the * {@link $compile#transclusion Transclusion} section below. * * There are two kinds of transclusion depending upon whether you want to transclude just the contents of the * directive's element or the entire element: * * * `true` - transclude the content (i.e. the child nodes) of the directive's element. * * `'element'` - transclude the whole of the directive's element including any directives on this * element that defined at a lower priority than this directive. When used, the `template` * property is ignored. * * * #### `compile` * * ```js * function compile(tElement, tAttrs, transclude) { ... } * ``` * * The compile function deals with transforming the template DOM. Since most directives do not do * template transformation, it is not used often. The compile function takes the following arguments: * * * `tElement` - template element - The element where the directive has been declared. It is * safe to do template transformation on the element and child elements only. * * * `tAttrs` - template attributes - Normalized list of attributes declared on this element shared * between all directive compile functions. * * * `transclude` - [*DEPRECATED*!] A transclude linking function: `function(scope, cloneLinkingFn)` * * <div class="alert alert-warning"> * **Note:** The template instance and the link instance may be different objects if the template has * been cloned. For this reason it is **not** safe to do anything other than DOM transformations that * apply to all cloned DOM nodes within the compile function. Specifically, DOM listener registration * should be done in a linking function rather than in a compile function. * </div> * <div class="alert alert-warning"> * **Note:** The compile function cannot handle directives that recursively use themselves in their * own templates or compile functions. Compiling these directives results in an infinite loop and a * stack overflow errors. * * This can be avoided by manually using $compile in the postLink function to imperatively compile * a directive's template instead of relying on automatic template compilation via `template` or * `templateUrl` declaration or manual compilation inside the compile function. * </div> * * <div class="alert alert-error"> * **Note:** The `transclude` function that is passed to the compile function is deprecated, as it * e.g. does not know about the right outer scope. Please use the transclude function that is passed * to the link function instead. * </div> * A compile function can have a return value which can be either a function or an object. * * * returning a (post-link) function - is equivalent to registering the linking function via the * `link` property of the config object when the compile function is empty. * * * returning an object with function(s) registered via `pre` and `post` properties - allows you to * control when a linking function should be called during the linking phase. See info about * pre-linking and post-linking functions below. * * * #### `link` * This property is used only if the `compile` property is not defined. * * ```js * function link(scope, iElement, iAttrs, controller, transcludeFn) { ... } * ``` * * The link function is responsible for registering DOM listeners as well as updating the DOM. It is * executed after the template has been cloned. This is where most of the directive logic will be * put. * * * `scope` - {@link ng.$rootScope.Scope Scope} - The scope to be used by the * directive for registering {@link ng.$rootScope.Scope#$watch watches}. * * * `iElement` - instance element - The element where the directive is to be used. It is safe to * manipulate the children of the element only in `postLink` function since the children have * already been linked. * * * `iAttrs` - instance attributes - Normalized list of attributes declared on this element shared * between all directive linking functions. * * * `controller` - a controller instance - A controller instance if at least one directive on the * element defines a controller. The controller is shared among all the directives, which allows * the directives to use the controllers as a communication channel. * * * `transcludeFn` - A transclude linking function pre-bound to the correct transclusion scope. * This is the same as the `$transclude` * parameter of directive controllers, see there for details. * `function([scope], cloneLinkingFn, futureParentElement)`. * * #### Pre-linking function * * Executed before the child elements are linked. Not safe to do DOM transformation since the * compiler linking function will fail to locate the correct elements for linking. * * #### Post-linking function * * Executed after the child elements are linked. * * Note that child elements that contain `templateUrl` directives will not have been compiled * and linked since they are waiting for their template to load asynchronously and their own * compilation and linking has been suspended until that occurs. * * It is safe to do DOM transformation in the post-linking function on elements that are not waiting * for their async templates to be resolved. * * * ### Transclusion * * Transclusion is the process of extracting a collection of DOM element from one part of the DOM and * copying them to another part of the DOM, while maintaining their connection to the original AngularJS * scope from where they were taken. * * Transclusion is used (often with {@link ngTransclude}) to insert the * original contents of a directive's element into a specified place in the template of the directive. * The benefit of transclusion, over simply moving the DOM elements manually, is that the transcluded * content has access to the properties on the scope from which it was taken, even if the directive * has isolated scope. * See the {@link guide/directive#creating-a-directive-that-wraps-other-elements Directives Guide}. * * This makes it possible for the widget to have private state for its template, while the transcluded * content has access to its originating scope. * * <div class="alert alert-warning"> * **Note:** When testing an element transclude directive you must not place the directive at the root of the * DOM fragment that is being compiled. See {@link guide/unit-testing#testing-transclusion-directives * Testing Transclusion Directives}. * </div> * * #### Transclusion Functions * * When a directive requests transclusion, the compiler extracts its contents and provides a **transclusion * function** to the directive's `link` function and `controller`. This transclusion function is a special * **linking function** that will return the compiled contents linked to a new transclusion scope. * * <div class="alert alert-info"> * If you are just using {@link ngTransclude} then you don't need to worry about this function, since * ngTransclude will deal with it for us. * </div> * * If you want to manually control the insertion and removal of the transcluded content in your directive * then you must use this transclude function. When you call a transclude function it returns a a jqLite/JQuery * object that contains the compiled DOM, which is linked to the correct transclusion scope. * * When you call a transclusion function you can pass in a **clone attach function**. This function accepts * two parameters, `function(clone, scope) { ... }`, where the `clone` is a fresh compiled copy of your transcluded * content and the `scope` is the newly created transclusion scope, to which the clone is bound. * * <div class="alert alert-info"> * **Best Practice**: Always provide a `cloneFn` (clone attach function) when you call a translude function * since you then get a fresh clone of the original DOM and also have access to the new transclusion scope. * </div> * * It is normal practice to attach your transcluded content (`clone`) to the DOM inside your **clone * attach function**: * * ```js * var transcludedContent, transclusionScope; * * $transclude(function(clone, scope) { * element.append(clone); * transcludedContent = clone; * transclusionScope = scope; * }); * ``` * * Later, if you want to remove the transcluded content from your DOM then you should also destroy the * associated transclusion scope: * * ```js * transcludedContent.remove(); * transclusionScope.$destroy(); * ``` * * <div class="alert alert-info"> * **Best Practice**: if you intend to add and remove transcluded content manually in your directive * (by calling the transclude function to get the DOM and and calling `element.remove()` to remove it), * then you are also responsible for calling `$destroy` on the transclusion scope. * </div> * * The built-in DOM manipulation directives, such as {@link ngIf}, {@link ngSwitch} and {@link ngRepeat} * automatically destroy their transluded clones as necessary so you do not need to worry about this if * you are simply using {@link ngTransclude} to inject the transclusion into your directive. * * * #### Transclusion Scopes * * When you call a transclude function it returns a DOM fragment that is pre-bound to a **transclusion * scope**. This scope is special, in that it is a child of the directive's scope (and so gets destroyed * when the directive's scope gets destroyed) but it inherits the properties of the scope from which it * was taken. * * For example consider a directive that uses transclusion and isolated scope. The DOM hierarchy might look * like this: * * ```html * <div ng-app> * <div isolate> * <div transclusion> * </div> * </div> * </div> * ``` * * The `$parent` scope hierarchy will look like this: * * ``` * - $rootScope * - isolate * - transclusion * ``` * * but the scopes will inherit prototypically from different scopes to their `$parent`. * * ``` * - $rootScope * - transclusion * - isolate * ``` * * * ### Attributes * * The {@link ng.$compile.directive.Attributes Attributes} object - passed as a parameter in the * `link()` or `compile()` functions. It has a variety of uses. * * accessing *Normalized attribute names:* * Directives like 'ngBind' can be expressed in many ways: 'ng:bind', `data-ng-bind`, or 'x-ng-bind'. * the attributes object allows for normalized access to * the attributes. * * * *Directive inter-communication:* All directives share the same instance of the attributes * object which allows the directives to use the attributes object as inter directive * communication. * * * *Supports interpolation:* Interpolation attributes are assigned to the attribute object * allowing other directives to read the interpolated value. * * * *Observing interpolated attributes:* Use `$observe` to observe the value changes of attributes * that contain interpolation (e.g. `src="{{bar}}"`). Not only is this very efficient but it's also * the only way to easily get the actual value because during the linking phase the interpolation * hasn't been evaluated yet and so the value is at this time set to `undefined`. * * ```js * function linkingFn(scope, elm, attrs, ctrl) { * // get the attribute value * console.log(attrs.ngModel); * * // change the attribute * attrs.$set('ngModel', 'new value'); * * // observe changes to interpolated attribute * attrs.$observe('ngModel', function(value) { * console.log('ngModel has changed value to ' + value); * }); * } * ``` * * ## Example * * <div class="alert alert-warning"> * **Note**: Typically directives are registered with `module.directive`. The example below is * to illustrate how `$compile` works. * </div> * <example module="compileExample"> <file name="index.html"> <script> angular.module('compileExample', [], function($compileProvider) { // configure new 'compile' directive by passing a directive // factory function. The factory function injects the '$compile' $compileProvider.directive('compile', function($compile) { // directive factory creates a link function return function(scope, element, attrs) { scope.$watch( function(scope) { // watch the 'compile' expression for changes return scope.$eval(attrs.compile); }, function(value) { // when the 'compile' expression changes // assign it into the current DOM element.html(value); // compile the new DOM and link it to the current // scope. // NOTE: we only compile .childNodes so that // we don't get into infinite loop compiling ourselves $compile(element.contents())(scope); } ); }; }); }) .controller('GreeterController', ['$scope', function($scope) { $scope.name = 'Angular'; $scope.html = 'Hello {{name}}'; }]); </script> <div ng-controller="GreeterController"> <input ng-model="name"> <br> <textarea ng-model="html"></textarea> <br> <div compile="html"></div> </div> </file> <file name="protractor.js" type="protractor"> it('should auto compile', function() { var textarea = $('textarea'); var output = $('div[compile]'); // The initial state reads 'Hello Angular'. expect(output.getText()).toBe('Hello Angular'); textarea.clear(); textarea.sendKeys('{{name}}!'); expect(output.getText()).toBe('Angular!'); }); </file> </example> * * * @param {string|DOMElement} element Element or HTML string to compile into a template function. * @param {function(angular.Scope, cloneAttachFn=)} transclude function available to directives - DEPRECATED. * * <div class="alert alert-error"> * **Note:** Passing a `transclude` function to the $compile function is deprecated, as it * e.g. will not use the right outer scope. Please pass the transclude function as a * `parentBoundTranscludeFn` to the link function instead. * </div> * * @param {number} maxPriority only apply directives lower than given priority (Only effects the * root element(s), not their children) * @returns {function(scope, cloneAttachFn=, options=)} a link function which is used to bind template * (a DOM element/tree) to a scope. Where: * * * `scope` - A {@link ng.$rootScope.Scope Scope} to bind to. * * `cloneAttachFn` - If `cloneAttachFn` is provided, then the link function will clone the * `template` and call the `cloneAttachFn` function allowing the caller to attach the * cloned elements to the DOM document at the appropriate place. The `cloneAttachFn` is * called as: <br> `cloneAttachFn(clonedElement, scope)` where: * * * `clonedElement` - is a clone of the original `element` passed into the compiler. * * `scope` - is the current scope with which the linking function is working with. * * * `options` - An optional object hash with linking options. If `options` is provided, then the following * keys may be used to control linking behavior: * * * `parentBoundTranscludeFn` - the transclude function made available to * directives; if given, it will be passed through to the link functions of * directives found in `element` during compilation. * * `transcludeControllers` - an object hash with keys that map controller names * to controller instances; if given, it will make the controllers * available to directives. * * `futureParentElement` - defines the parent to which the `cloneAttachFn` will add * the cloned elements; only needed for transcludes that are allowed to contain non html * elements (e.g. SVG elements). See also the directive.controller property. * * Calling the linking function returns the element of the template. It is either the original * element passed in, or the clone of the element if the `cloneAttachFn` is provided. * * After linking the view is not updated until after a call to $digest which typically is done by * Angular automatically. * * If you need access to the bound view, there are two ways to do it: * * - If you are not asking the linking function to clone the template, create the DOM element(s) * before you send them to the compiler and keep this reference around. * ```js * var element = $compile('<p>{{total}}</p>')(scope); * ``` * * - if on the other hand, you need the element to be cloned, the view reference from the original * example would not point to the clone, but rather to the original template that was cloned. In * this case, you can access the clone via the cloneAttachFn: * ```js * var templateElement = angular.element('<p>{{total}}</p>'), * scope = ....; * * var clonedElement = $compile(templateElement)(scope, function(clonedElement, scope) { * //attach the clone to DOM document at the right place * }); * * //now we have reference to the cloned DOM via `clonedElement` * ``` * * * For information on how the compiler works, see the * {@link guide/compiler Angular HTML Compiler} section of the Developer Guide. */ var $compileMinErr = minErr('$compile'); /** * @ngdoc provider * @name $compileProvider * * @description */ $CompileProvider.$inject = ['$provide', '$$sanitizeUriProvider']; function $CompileProvider($provide, $$sanitizeUriProvider) { var hasDirectives = {}, Suffix = 'Directive', COMMENT_DIRECTIVE_REGEXP = /^\s*directive\:\s*([\w\-]+)\s+(.*)$/, CLASS_DIRECTIVE_REGEXP = /(([\w\-]+)(?:\:([^;]+))?;?)/, ALL_OR_NOTHING_ATTRS = makeMap('ngSrc,ngSrcset,src,srcset'), REQUIRE_PREFIX_REGEXP = /^(?:(\^\^?)?(\?)?(\^\^?)?)?/; // Ref: http://developers.whatwg.org/webappapis.html#event-handler-idl-attributes // The assumption is that future DOM event attribute names will begin with // 'on' and be composed of only English letters. var EVENT_HANDLER_ATTR_REGEXP = /^(on[a-z]+|formaction)$/; function parseIsolateBindings(scope, directiveName) { var LOCAL_REGEXP = /^\s*([@&]|=(\*?))(\??)\s*(\w*)\s*$/; var bindings = {}; forEach(scope, function(definition, scopeName) { var match = definition.match(LOCAL_REGEXP); if (!match) { throw $compileMinErr('iscp', "Invalid isolate scope definition for directive '{0}'." + " Definition: {... {1}: '{2}' ...}", directiveName, scopeName, definition); } bindings[scopeName] = { mode: match[1][0], collection: match[2] === '*', optional: match[3] === '?', attrName: match[4] || scopeName }; }); return bindings; } /** * @ngdoc method * @name $compileProvider#directive * @kind function * * @description * Register a new directive with the compiler. * * @param {string|Object} name Name of the directive in camel-case (i.e. <code>ngBind</code> which * will match as <code>ng-bind</code>), or an object map of directives where the keys are the * names and the values are the factories. * @param {Function|Array} directiveFactory An injectable directive factory function. See * {@link guide/directive} for more info. * @returns {ng.$compileProvider} Self for chaining. */ this.directive = function registerDirective(name, directiveFactory) { assertNotHasOwnProperty(name, 'directive'); if (isString(name)) { assertArg(directiveFactory, 'directiveFactory'); if (!hasDirectives.hasOwnProperty(name)) { hasDirectives[name] = []; $provide.factory(name + Suffix, ['$injector', '$exceptionHandler', function($injector, $exceptionHandler) { var directives = []; forEach(hasDirectives[name], function(directiveFactory, index) { try { var directive = $injector.invoke(directiveFactory); if (isFunction(directive)) { directive = { compile: valueFn(directive) }; } else if (!directive.compile && directive.link) { directive.compile = valueFn(directive.link); } directive.priority = directive.priority || 0; directive.index = index; directive.name = directive.name || name; directive.require = directive.require || (directive.controller && directive.name); directive.restrict = directive.restrict || 'EA'; if (isObject(directive.scope)) { directive.$$isolateBindings = parseIsolateBindings(directive.scope, directive.name); } directives.push(directive); } catch (e) { $exceptionHandler(e); } }); return directives; }]); } hasDirectives[name].push(directiveFactory); } else { forEach(name, reverseParams(registerDirective)); } return this; }; /** * @ngdoc method * @name $compileProvider#aHrefSanitizationWhitelist * @kind function * * @description * Retrieves or overrides the default regular expression that is used for whitelisting of safe * urls during a[href] sanitization. * * The sanitization is a security measure aimed at preventing XSS attacks via html links. * * Any url about to be assigned to a[href] via data-binding is first normalized and turned into * an absolute url. Afterwards, the url is matched against the `aHrefSanitizationWhitelist` * regular expression. If a match is found, the original url is written into the dom. Otherwise, * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM. * * @param {RegExp=} regexp New regexp to whitelist urls with. * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for * chaining otherwise. */ this.aHrefSanitizationWhitelist = function(regexp) { if (isDefined(regexp)) { $$sanitizeUriProvider.aHrefSanitizationWhitelist(regexp); return this; } else { return $$sanitizeUriProvider.aHrefSanitizationWhitelist(); } }; /** * @ngdoc method * @name $compileProvider#imgSrcSanitizationWhitelist * @kind function * * @description * Retrieves or overrides the default regular expression that is used for whitelisting of safe * urls during img[src] sanitization. * * The sanitization is a security measure aimed at prevent XSS attacks via html links. * * Any url about to be assigned to img[src] via data-binding is first normalized and turned into * an absolute url. Afterwards, the url is matched against the `imgSrcSanitizationWhitelist` * regular expression. If a match is found, the original url is written into the dom. Otherwise, * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM. * * @param {RegExp=} regexp New regexp to whitelist urls with. * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for * chaining otherwise. */ this.imgSrcSanitizationWhitelist = function(regexp) { if (isDefined(regexp)) { $$sanitizeUriProvider.imgSrcSanitizationWhitelist(regexp); return this; } else { return $$sanitizeUriProvider.imgSrcSanitizationWhitelist(); } }; /** * @ngdoc method * @name $compileProvider#debugInfoEnabled * * @param {boolean=} enabled update the debugInfoEnabled state if provided, otherwise just return the * current debugInfoEnabled state * @returns {*} current value if used as getter or itself (chaining) if used as setter * * @kind function * * @description * Call this method to enable/disable various debug runtime information in the compiler such as adding * binding information and a reference to the current scope on to DOM elements. * If enabled, the compiler will add the following to DOM elements that have been bound to the scope * * `ng-binding` CSS class * * `$binding` data property containing an array of the binding expressions * * You may want to disable this in production for a significant performance boost. See * {@link guide/production#disabling-debug-data Disabling Debug Data} for more. * * The default value is true. */ var debugInfoEnabled = true; this.debugInfoEnabled = function(enabled) { if (isDefined(enabled)) { debugInfoEnabled = enabled; return this; } return debugInfoEnabled; }; this.$get = [ '$injector', '$interpolate', '$exceptionHandler', '$templateRequest', '$parse', '$controller', '$rootScope', '$document', '$sce', '$animate', '$$sanitizeUri', function($injector, $interpolate, $exceptionHandler, $templateRequest, $parse, $controller, $rootScope, $document, $sce, $animate, $$sanitizeUri) { var Attributes = function(element, attributesToCopy) { if (attributesToCopy) { var keys = Object.keys(attributesToCopy); var i, l, key; for (i = 0, l = keys.length; i < l; i++) { key = keys[i]; this[key] = attributesToCopy[key]; } } else { this.$attr = {}; } this.$$element = element; }; Attributes.prototype = { /** * @ngdoc method * @name $compile.directive.Attributes#$normalize * @kind function * * @description * Converts an attribute name (e.g. dash/colon/underscore-delimited string, optionally prefixed with `x-` or * `data-`) to its normalized, camelCase form. * * Also there is special case for Moz prefix starting with upper case letter. * * For further information check out the guide on {@link guide/directive#matching-directives Matching Directives} * * @param {string} name Name to normalize */ $normalize: directiveNormalize, /** * @ngdoc method * @name $compile.directive.Attributes#$addClass * @kind function * * @description * Adds the CSS class value specified by the classVal parameter to the element. If animations * are enabled then an animation will be triggered for the class addition. * * @param {string} classVal The className value that will be added to the element */ $addClass: function(classVal) { if (classVal && classVal.length > 0) { $animate.addClass(this.$$element, classVal); } }, /** * @ngdoc method * @name $compile.directive.Attributes#$removeClass * @kind function * * @description * Removes the CSS class value specified by the classVal parameter from the element. If * animations are enabled then an animation will be triggered for the class removal. * * @param {string} classVal The className value that will be removed from the element */ $removeClass: function(classVal) { if (classVal && classVal.length > 0) { $animate.removeClass(this.$$element, classVal); } }, /** * @ngdoc method * @name $compile.directive.Attributes#$updateClass * @kind function * * @description * Adds and removes the appropriate CSS class values to the element based on the difference * between the new and old CSS class values (specified as newClasses and oldClasses). * * @param {string} newClasses The current CSS className value * @param {string} oldClasses The former CSS className value */ $updateClass: function(newClasses, oldClasses) { var toAdd = tokenDifference(newClasses, oldClasses); if (toAdd && toAdd.length) { $animate.addClass(this.$$element, toAdd); } var toRemove = tokenDifference(oldClasses, newClasses); if (toRemove && toRemove.length) { $animate.removeClass(this.$$element, toRemove); } }, /** * Set a normalized attribute on the element in a way such that all directives * can share the attribute. This function properly handles boolean attributes. * @param {string} key Normalized key. (ie ngAttribute) * @param {string|boolean} value The value to set. If `null` attribute will be deleted. * @param {boolean=} writeAttr If false, does not write the value to DOM element attribute. * Defaults to true. * @param {string=} attrName Optional none normalized name. Defaults to key. */ $set: function(key, value, writeAttr, attrName) { // TODO: decide whether or not to throw an error if "class" //is set through this function since it may cause $updateClass to //become unstable. var node = this.$$element[0], booleanKey = getBooleanAttrName(node, key), aliasedKey = getAliasedAttrName(node, key), observer = key, nodeName; if (booleanKey) { this.$$element.prop(key, value); attrName = booleanKey; } else if (aliasedKey) { this[aliasedKey] = value; observer = aliasedKey; } this[key] = value; // translate normalized key to actual key if (attrName) { this.$attr[key] = attrName; } else { attrName = this.$attr[key]; if (!attrName) { this.$attr[key] = attrName = snake_case(key, '-'); } } nodeName = nodeName_(this.$$element); if ((nodeName === 'a' && key === 'href') || (nodeName === 'img' && key === 'src')) { // sanitize a[href] and img[src] values this[key] = value = $$sanitizeUri(value, key === 'src'); } else if (nodeName === 'img' && key === 'srcset') { // sanitize img[srcset] values var result = ""; // first check if there are spaces because it's not the same pattern var trimmedSrcset = trim(value); // ( 999x ,| 999w ,| ,|, ) var srcPattern = /(\s+\d+x\s*,|\s+\d+w\s*,|\s+,|,\s+)/; var pattern = /\s/.test(trimmedSrcset) ? srcPattern : /(,)/; // split srcset into tuple of uri and descriptor except for the last item var rawUris = trimmedSrcset.split(pattern); // for each tuples var nbrUrisWith2parts = Math.floor(rawUris.length / 2); for (var i = 0; i < nbrUrisWith2parts; i++) { var innerIdx = i * 2; // sanitize the uri result += $$sanitizeUri(trim(rawUris[innerIdx]), true); // add the descriptor result += (" " + trim(rawUris[innerIdx + 1])); } // split the last item into uri and descriptor var lastTuple = trim(rawUris[i * 2]).split(/\s/); // sanitize the last uri result += $$sanitizeUri(trim(lastTuple[0]), true); // and add the last descriptor if any if (lastTuple.length === 2) { result += (" " + trim(lastTuple[1])); } this[key] = value = result; } if (writeAttr !== false) { if (value === null || value === undefined) { this.$$element.removeAttr(attrName); } else { this.$$element.attr(attrName, value); } } // fire observers var $$observers = this.$$observers; $$observers && forEach($$observers[observer], function(fn) { try { fn(value); } catch (e) { $exceptionHandler(e); } }); }, /** * @ngdoc method * @name $compile.directive.Attributes#$observe * @kind function * * @description * Observes an interpolated attribute. * * The observer function will be invoked once during the next `$digest` following * compilation. The observer is then invoked whenever the interpolated value * changes. * * @param {string} key Normalized key. (ie ngAttribute) . * @param {function(interpolatedValue)} fn Function that will be called whenever the interpolated value of the attribute changes. * See the {@link guide/directive#text-and-attribute-bindings Directives} guide for more info. * @returns {function()} Returns a deregistration function for this observer. */ $observe: function(key, fn) { var attrs = this, $$observers = (attrs.$$observers || (attrs.$$observers = createMap())), listeners = ($$observers[key] || ($$observers[key] = [])); listeners.push(fn); $rootScope.$evalAsync(function() { if (!listeners.$$inter && attrs.hasOwnProperty(key)) { // no one registered attribute interpolation function, so lets call it manually fn(attrs[key]); } }); return function() { arrayRemove(listeners, fn); }; } }; function safeAddClass($element, className) { try { $element.addClass(className); } catch (e) { // ignore, since it means that we are trying to set class on // SVG element, where class name is read-only. } } var startSymbol = $interpolate.startSymbol(), endSymbol = $interpolate.endSymbol(), denormalizeTemplate = (startSymbol == '{{' || endSymbol == '}}') ? identity : function denormalizeTemplate(template) { return template.replace(/\{\{/g, startSymbol).replace(/}}/g, endSymbol); }, NG_ATTR_BINDING = /^ngAttr[A-Z]/; compile.$$addBindingInfo = debugInfoEnabled ? function $$addBindingInfo($element, binding) { var bindings = $element.data('$binding') || []; if (isArray(binding)) { bindings = bindings.concat(binding); } else { bindings.push(binding); } $element.data('$binding', bindings); } : noop; compile.$$addBindingClass = debugInfoEnabled ? function $$addBindingClass($element) { safeAddClass($element, 'ng-binding'); } : noop; compile.$$addScopeInfo = debugInfoEnabled ? function $$addScopeInfo($element, scope, isolated, noTemplate) { var dataName = isolated ? (noTemplate ? '$isolateScopeNoTemplate' : '$isolateScope') : '$scope'; $element.data(dataName, scope); } : noop; compile.$$addScopeClass = debugInfoEnabled ? function $$addScopeClass($element, isolated) { safeAddClass($element, isolated ? 'ng-isolate-scope' : 'ng-scope'); } : noop; return compile; //================================ function compile($compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext) { if (!($compileNodes instanceof jqLite)) { // jquery always rewraps, whereas we need to preserve the original selector so that we can // modify it. $compileNodes = jqLite($compileNodes); } // We can not compile top level text elements since text nodes can be merged and we will // not be able to attach scope data to them, so we will wrap them in <span> forEach($compileNodes, function(node, index) { if (node.nodeType == NODE_TYPE_TEXT && node.nodeValue.match(/\S+/) /* non-empty */ ) { $compileNodes[index] = jqLite(node).wrap('<span></span>').parent()[0]; } }); var compositeLinkFn = compileNodes($compileNodes, transcludeFn, $compileNodes, maxPriority, ignoreDirective, previousCompileContext); compile.$$addScopeClass($compileNodes); var namespace = null; return function publicLinkFn(scope, cloneConnectFn, options) { assertArg(scope, 'scope'); options = options || {}; var parentBoundTranscludeFn = options.parentBoundTranscludeFn, transcludeControllers = options.transcludeControllers, futureParentElement = options.futureParentElement; // When `parentBoundTranscludeFn` is passed, it is a // `controllersBoundTransclude` function (it was previously passed // as `transclude` to directive.link) so we must unwrap it to get // its `boundTranscludeFn` if (parentBoundTranscludeFn && parentBoundTranscludeFn.$$boundTransclude) { parentBoundTranscludeFn = parentBoundTranscludeFn.$$boundTransclude; } if (!namespace) { namespace = detectNamespaceForChildElements(futureParentElement); } var $linkNode; if (namespace !== 'html') { // When using a directive with replace:true and templateUrl the $compileNodes // (or a child element inside of them) // might change, so we need to recreate the namespace adapted compileNodes // for call to the link function. // Note: This will already clone the nodes... $linkNode = jqLite( wrapTemplate(namespace, jqLite('<div>').append($compileNodes).html()) ); } else if (cloneConnectFn) { // important!!: we must call our jqLite.clone() since the jQuery one is trying to be smart // and sometimes changes the structure of the DOM. $linkNode = JQLitePrototype.clone.call($compileNodes); } else { $linkNode = $compileNodes; } if (transcludeControllers) { for (var controllerName in transcludeControllers) { $linkNode.data('$' + controllerName + 'Controller', transcludeControllers[controllerName].instance); } } compile.$$addScopeInfo($linkNode, scope); if (cloneConnectFn) cloneConnectFn($linkNode, scope); if (compositeLinkFn) compositeLinkFn(scope, $linkNode, $linkNode, parentBoundTranscludeFn); return $linkNode; }; } function detectNamespaceForChildElements(parentElement) { // TODO: Make this detect MathML as well... var node = parentElement && parentElement[0]; if (!node) { return 'html'; } else { return nodeName_(node) !== 'foreignobject' && node.toString().match(/SVG/) ? 'svg' : 'html'; } } /** * Compile function matches each node in nodeList against the directives. Once all directives * for a particular node are collected their compile functions are executed. The compile * functions return values - the linking functions - are combined into a composite linking * function, which is the a linking function for the node. * * @param {NodeList} nodeList an array of nodes or NodeList to compile * @param {function(angular.Scope, cloneAttachFn=)} transcludeFn A linking function, where the * scope argument is auto-generated to the new child of the transcluded parent scope. * @param {DOMElement=} $rootElement If the nodeList is the root of the compilation tree then * the rootElement must be set the jqLite collection of the compile root. This is * needed so that the jqLite collection items can be replaced with widgets. * @param {number=} maxPriority Max directive priority. * @returns {Function} A composite linking function of all of the matched directives or null. */ function compileNodes(nodeList, transcludeFn, $rootElement, maxPriority, ignoreDirective, previousCompileContext) { var linkFns = [], attrs, directives, nodeLinkFn, childNodes, childLinkFn, linkFnFound, nodeLinkFnFound; for (var i = 0; i < nodeList.length; i++) { attrs = new Attributes(); // we must always refer to nodeList[i] since the nodes can be replaced underneath us. directives = collectDirectives(nodeList[i], [], attrs, i === 0 ? maxPriority : undefined, ignoreDirective); nodeLinkFn = (directives.length) ? applyDirectivesToNode(directives, nodeList[i], attrs, transcludeFn, $rootElement, null, [], [], previousCompileContext) : null; if (nodeLinkFn && nodeLinkFn.scope) { compile.$$addScopeClass(attrs.$$element); } childLinkFn = (nodeLinkFn && nodeLinkFn.terminal || !(childNodes = nodeList[i].childNodes) || !childNodes.length) ? null : compileNodes(childNodes, nodeLinkFn ? ( (nodeLinkFn.transcludeOnThisElement || !nodeLinkFn.templateOnThisElement) && nodeLinkFn.transclude) : transcludeFn); if (nodeLinkFn || childLinkFn) { linkFns.push(i, nodeLinkFn, childLinkFn); linkFnFound = true; nodeLinkFnFound = nodeLinkFnFound || nodeLinkFn; } //use the previous context only for the first element in the virtual group previousCompileContext = null; } // return a linking function if we have found anything, null otherwise return linkFnFound ? compositeLinkFn : null; function compositeLinkFn(scope, nodeList, $rootElement, parentBoundTranscludeFn) { var nodeLinkFn, childLinkFn, node, childScope, i, ii, idx, childBoundTranscludeFn; var stableNodeList; if (nodeLinkFnFound) { // copy nodeList so that if a nodeLinkFn removes or adds an element at this DOM level our // offsets don't get screwed up var nodeListLength = nodeList.length; stableNodeList = new Array(nodeListLength); // create a sparse array by only copying the elements which have a linkFn for (i = 0; i < linkFns.length; i+=3) { idx = linkFns[i]; stableNodeList[idx] = nodeList[idx]; } } else { stableNodeList = nodeList; } for (i = 0, ii = linkFns.length; i < ii;) { node = stableNodeList[linkFns[i++]]; nodeLinkFn = linkFns[i++]; childLinkFn = linkFns[i++]; if (nodeLinkFn) { if (nodeLinkFn.scope) { childScope = scope.$new(); compile.$$addScopeInfo(jqLite(node), childScope); } else { childScope = scope; } if (nodeLinkFn.transcludeOnThisElement) { childBoundTranscludeFn = createBoundTranscludeFn( scope, nodeLinkFn.transclude, parentBoundTranscludeFn, nodeLinkFn.elementTranscludeOnThisElement); } else if (!nodeLinkFn.templateOnThisElement && parentBoundTranscludeFn) { childBoundTranscludeFn = parentBoundTranscludeFn; } else if (!parentBoundTranscludeFn && transcludeFn) { childBoundTranscludeFn = createBoundTranscludeFn(scope, transcludeFn); } else { childBoundTranscludeFn = null; } nodeLinkFn(childLinkFn, childScope, node, $rootElement, childBoundTranscludeFn); } else if (childLinkFn) { childLinkFn(scope, node.childNodes, undefined, parentBoundTranscludeFn); } } } } function createBoundTranscludeFn(scope, transcludeFn, previousBoundTranscludeFn, elementTransclusion) { var boundTranscludeFn = function(transcludedScope, cloneFn, controllers, futureParentElement, containingScope) { if (!transcludedScope) { transcludedScope = scope.$new(false, containingScope); transcludedScope.$$transcluded = true; } return transcludeFn(transcludedScope, cloneFn, { parentBoundTranscludeFn: previousBoundTranscludeFn, transcludeControllers: controllers, futureParentElement: futureParentElement }); }; return boundTranscludeFn; } /** * Looks for directives on the given node and adds them to the directive collection which is * sorted. * * @param node Node to search. * @param directives An array to which the directives are added to. This array is sorted before * the function returns. * @param attrs The shared attrs object which is used to populate the normalized attributes. * @param {number=} maxPriority Max directive priority. */ function collectDirectives(node, directives, attrs, maxPriority, ignoreDirective) { var nodeType = node.nodeType, attrsMap = attrs.$attr, match, className; switch (nodeType) { case NODE_TYPE_ELEMENT: /* Element */ // use the node name: <directive> addDirective(directives, directiveNormalize(nodeName_(node)), 'E', maxPriority, ignoreDirective); // iterate over the attributes for (var attr, name, nName, ngAttrName, value, isNgAttr, nAttrs = node.attributes, j = 0, jj = nAttrs && nAttrs.length; j < jj; j++) { var attrStartName = false; var attrEndName = false; attr = nAttrs[j]; name = attr.name; value = trim(attr.value); // support ngAttr attribute binding ngAttrName = directiveNormalize(name); if (isNgAttr = NG_ATTR_BINDING.test(ngAttrName)) { name = name.replace(PREFIX_REGEXP, '') .substr(8).replace(/_(.)/g, function(match, letter) { return letter.toUpperCase(); }); } var directiveNName = ngAttrName.replace(/(Start|End)$/, ''); if (directiveIsMultiElement(directiveNName)) { if (ngAttrName === directiveNName + 'Start') { attrStartName = name; attrEndName = name.substr(0, name.length - 5) + 'end'; name = name.substr(0, name.length - 6); } } nName = directiveNormalize(name.toLowerCase()); attrsMap[nName] = name; if (isNgAttr || !attrs.hasOwnProperty(nName)) { attrs[nName] = value; if (getBooleanAttrName(node, nName)) { attrs[nName] = true; // presence means true } } addAttrInterpolateDirective(node, directives, value, nName, isNgAttr); addDirective(directives, nName, 'A', maxPriority, ignoreDirective, attrStartName, attrEndName); } // use class as directive className = node.className; if (isObject(className)) { // Maybe SVGAnimatedString className = className.animVal; } if (isString(className) && className !== '') { while (match = CLASS_DIRECTIVE_REGEXP.exec(className)) { nName = directiveNormalize(match[2]); if (addDirective(directives, nName, 'C', maxPriority, ignoreDirective)) { attrs[nName] = trim(match[3]); } className = className.substr(match.index + match[0].length); } } break; case NODE_TYPE_TEXT: /* Text Node */ addTextInterpolateDirective(directives, node.nodeValue); break; case NODE_TYPE_COMMENT: /* Comment */ try { match = COMMENT_DIRECTIVE_REGEXP.exec(node.nodeValue); if (match) { nName = directiveNormalize(match[1]); if (addDirective(directives, nName, 'M', maxPriority, ignoreDirective)) { attrs[nName] = trim(match[2]); } } } catch (e) { // turns out that under some circumstances IE9 throws errors when one attempts to read // comment's node value. // Just ignore it and continue. (Can't seem to reproduce in test case.) } break; } directives.sort(byPriority); return directives; } /** * Given a node with an directive-start it collects all of the siblings until it finds * directive-end. * @param node * @param attrStart * @param attrEnd * @returns {*} */ function groupScan(node, attrStart, attrEnd) { var nodes = []; var depth = 0; if (attrStart && node.hasAttribute && node.hasAttribute(attrStart)) { do { if (!node) { throw $compileMinErr('uterdir', "Unterminated attribute, found '{0}' but no matching '{1}' found.", attrStart, attrEnd); } if (node.nodeType == NODE_TYPE_ELEMENT) { if (node.hasAttribute(attrStart)) depth++; if (node.hasAttribute(attrEnd)) depth--; } nodes.push(node); node = node.nextSibling; } while (depth > 0); } else { nodes.push(node); } return jqLite(nodes); } /** * Wrapper for linking function which converts normal linking function into a grouped * linking function. * @param linkFn * @param attrStart * @param attrEnd * @returns {Function} */ function groupElementsLinkFnWrapper(linkFn, attrStart, attrEnd) { return function(scope, element, attrs, controllers, transcludeFn) { element = groupScan(element[0], attrStart, attrEnd); return linkFn(scope, element, attrs, controllers, transcludeFn); }; } /** * Once the directives have been collected, their compile functions are executed. This method * is responsible for inlining directive templates as well as terminating the application * of the directives if the terminal directive has been reached. * * @param {Array} directives Array of collected directives to execute their compile function. * this needs to be pre-sorted by priority order. * @param {Node} compileNode The raw DOM node to apply the compile functions to * @param {Object} templateAttrs The shared attribute function * @param {function(angular.Scope, cloneAttachFn=)} transcludeFn A linking function, where the * scope argument is auto-generated to the new * child of the transcluded parent scope. * @param {JQLite} jqCollection If we are working on the root of the compile tree then this * argument has the root jqLite array so that we can replace nodes * on it. * @param {Object=} originalReplaceDirective An optional directive that will be ignored when * compiling the transclusion. * @param {Array.<Function>} preLinkFns * @param {Array.<Function>} postLinkFns * @param {Object} previousCompileContext Context used for previous compilation of the current * node * @returns {Function} linkFn */ function applyDirectivesToNode(directives, compileNode, templateAttrs, transcludeFn, jqCollection, originalReplaceDirective, preLinkFns, postLinkFns, previousCompileContext) { previousCompileContext = previousCompileContext || {}; var terminalPriority = -Number.MAX_VALUE, newScopeDirective, controllerDirectives = previousCompileContext.controllerDirectives, controllers, newIsolateScopeDirective = previousCompileContext.newIsolateScopeDirective, templateDirective = previousCompileContext.templateDirective, nonTlbTranscludeDirective = previousCompileContext.nonTlbTranscludeDirective, hasTranscludeDirective = false, hasTemplate = false, hasElementTranscludeDirective = previousCompileContext.hasElementTranscludeDirective, $compileNode = templateAttrs.$$element = jqLite(compileNode), directive, directiveName, $template, replaceDirective = originalReplaceDirective, childTranscludeFn = transcludeFn, linkFn, directiveValue; // executes all directives on the current element for (var i = 0, ii = directives.length; i < ii; i++) { directive = directives[i]; var attrStart = directive.$$start; var attrEnd = directive.$$end; // collect multiblock sections if (attrStart) { $compileNode = groupScan(compileNode, attrStart, attrEnd); } $template = undefined; if (terminalPriority > directive.priority) { break; // prevent further processing of directives } if (directiveValue = directive.scope) { // skip the check for directives with async templates, we'll check the derived sync // directive when the template arrives if (!directive.templateUrl) { if (isObject(directiveValue)) { // This directive is trying to add an isolated scope. // Check that there is no scope of any kind already assertNoDuplicate('new/isolated scope', newIsolateScopeDirective || newScopeDirective, directive, $compileNode); newIsolateScopeDirective = directive; } else { // This directive is trying to add a child scope. // Check that there is no isolated scope already assertNoDuplicate('new/isolated scope', newIsolateScopeDirective, directive, $compileNode); } } newScopeDirective = newScopeDirective || directive; } directiveName = directive.name; if (!directive.templateUrl && directive.controller) { directiveValue = directive.controller; controllerDirectives = controllerDirectives || {}; assertNoDuplicate("'" + directiveName + "' controller", controllerDirectives[directiveName], directive, $compileNode); controllerDirectives[directiveName] = directive; } if (directiveValue = directive.transclude) { hasTranscludeDirective = true; // Special case ngIf and ngRepeat so that we don't complain about duplicate transclusion. // This option should only be used by directives that know how to safely handle element transclusion, // where the transcluded nodes are added or replaced after linking. if (!directive.$$tlb) { assertNoDuplicate('transclusion', nonTlbTranscludeDirective, directive, $compileNode); nonTlbTranscludeDirective = directive; } if (directiveValue == 'element') { hasElementTranscludeDirective = true; terminalPriority = directive.priority; $template = $compileNode; $compileNode = templateAttrs.$$element = jqLite(document.createComment(' ' + directiveName + ': ' + templateAttrs[directiveName] + ' ')); compileNode = $compileNode[0]; replaceWith(jqCollection, sliceArgs($template), compileNode); childTranscludeFn = compile($template, transcludeFn, terminalPriority, replaceDirective && replaceDirective.name, { // Don't pass in: // - controllerDirectives - otherwise we'll create duplicates controllers // - newIsolateScopeDirective or templateDirective - combining templates with // element transclusion doesn't make sense. // // We need only nonTlbTranscludeDirective so that we prevent putting transclusion // on the same element more than once. nonTlbTranscludeDirective: nonTlbTranscludeDirective }); } else { $template = jqLite(jqLiteClone(compileNode)).contents(); $compileNode.empty(); // clear contents childTranscludeFn = compile($template, transcludeFn); } } if (directive.template) { hasTemplate = true; assertNoDuplicate('template', templateDirective, directive, $compileNode); templateDirective = directive; directiveValue = (isFunction(directive.template)) ? directive.template($compileNode, templateAttrs) : directive.template; directiveValue = denormalizeTemplate(directiveValue); if (directive.replace) { replaceDirective = directive; if (jqLiteIsTextNode(directiveValue)) { $template = []; } else { $template = removeComments(wrapTemplate(directive.templateNamespace, trim(directiveValue))); } compileNode = $template[0]; if ($template.length != 1 || compileNode.nodeType !== NODE_TYPE_ELEMENT) { throw $compileMinErr('tplrt', "Template for directive '{0}' must have exactly one root element. {1}", directiveName, ''); } replaceWith(jqCollection, $compileNode, compileNode); var newTemplateAttrs = {$attr: {}}; // combine directives from the original node and from the template: // - take the array of directives for this element // - split it into two parts, those that already applied (processed) and those that weren't (unprocessed) // - collect directives from the template and sort them by priority // - combine directives as: processed + template + unprocessed var templateDirectives = collectDirectives(compileNode, [], newTemplateAttrs); var unprocessedDirectives = directives.splice(i + 1, directives.length - (i + 1)); if (newIsolateScopeDirective) { markDirectivesAsIsolate(templateDirectives); } directives = directives.concat(templateDirectives).concat(unprocessedDirectives); mergeTemplateAttributes(templateAttrs, newTemplateAttrs); ii = directives.length; } else { $compileNode.html(directiveValue); } } if (directive.templateUrl) { hasTemplate = true; assertNoDuplicate('template', templateDirective, directive, $compileNode); templateDirective = directive; if (directive.replace) { replaceDirective = directive; } nodeLinkFn = compileTemplateUrl(directives.splice(i, directives.length - i), $compileNode, templateAttrs, jqCollection, hasTranscludeDirective && childTranscludeFn, preLinkFns, postLinkFns, { controllerDirectives: controllerDirectives, newIsolateScopeDirective: newIsolateScopeDirective, templateDirective: templateDirective, nonTlbTranscludeDirective: nonTlbTranscludeDirective }); ii = directives.length; } else if (directive.compile) { try { linkFn = directive.compile($compileNode, templateAttrs, childTranscludeFn); if (isFunction(linkFn)) { addLinkFns(null, linkFn, attrStart, attrEnd); } else if (linkFn) { addLinkFns(linkFn.pre, linkFn.post, attrStart, attrEnd); } } catch (e) { $exceptionHandler(e, startingTag($compileNode)); } } if (directive.terminal) { nodeLinkFn.terminal = true; terminalPriority = Math.max(terminalPriority, directive.priority); } } nodeLinkFn.scope = newScopeDirective && newScopeDirective.scope === true; nodeLinkFn.transcludeOnThisElement = hasTranscludeDirective; nodeLinkFn.elementTranscludeOnThisElement = hasElementTranscludeDirective; nodeLinkFn.templateOnThisElement = hasTemplate; nodeLinkFn.transclude = childTranscludeFn; previousCompileContext.hasElementTranscludeDirective = hasElementTranscludeDirective; // might be normal or delayed nodeLinkFn depending on if templateUrl is present return nodeLinkFn; //////////////////// function addLinkFns(pre, post, attrStart, attrEnd) { if (pre) { if (attrStart) pre = groupElementsLinkFnWrapper(pre, attrStart, attrEnd); pre.require = directive.require; pre.directiveName = directiveName; if (newIsolateScopeDirective === directive || directive.$$isolateScope) { pre = cloneAndAnnotateFn(pre, {isolateScope: true}); } preLinkFns.push(pre); } if (post) { if (attrStart) post = groupElementsLinkFnWrapper(post, attrStart, attrEnd); post.require = directive.require; post.directiveName = directiveName; if (newIsolateScopeDirective === directive || directive.$$isolateScope) { post = cloneAndAnnotateFn(post, {isolateScope: true}); } postLinkFns.push(post); } } function getControllers(directiveName, require, $element, elementControllers) { var value, retrievalMethod = 'data', optional = false; var $searchElement = $element; var match; if (isString(require)) { match = require.match(REQUIRE_PREFIX_REGEXP); require = require.substring(match[0].length); if (match[3]) { if (match[1]) match[3] = null; else match[1] = match[3]; } if (match[1] === '^') { retrievalMethod = 'inheritedData'; } else if (match[1] === '^^') { retrievalMethod = 'inheritedData'; $searchElement = $element.parent(); } if (match[2] === '?') { optional = true; } value = null; if (elementControllers && retrievalMethod === 'data') { if (value = elementControllers[require]) { value = value.instance; } } value = value || $searchElement[retrievalMethod]('$' + require + 'Controller'); if (!value && !optional) { throw $compileMinErr('ctreq', "Controller '{0}', required by directive '{1}', can't be found!", require, directiveName); } return value || null; } else if (isArray(require)) { value = []; forEach(require, function(require) { value.push(getControllers(directiveName, require, $element, elementControllers)); }); } return value; } function nodeLinkFn(childLinkFn, scope, linkNode, $rootElement, boundTranscludeFn) { var i, ii, linkFn, controller, isolateScope, elementControllers, transcludeFn, $element, attrs; if (compileNode === linkNode) { attrs = templateAttrs; $element = templateAttrs.$$element; } else { $element = jqLite(linkNode); attrs = new Attributes($element, templateAttrs); } if (newIsolateScopeDirective) { isolateScope = scope.$new(true); } if (boundTranscludeFn) { // track `boundTranscludeFn` so it can be unwrapped if `transcludeFn` // is later passed as `parentBoundTranscludeFn` to `publicLinkFn` transcludeFn = controllersBoundTransclude; transcludeFn.$$boundTransclude = boundTranscludeFn; } if (controllerDirectives) { // TODO: merge `controllers` and `elementControllers` into single object. controllers = {}; elementControllers = {}; forEach(controllerDirectives, function(directive) { var locals = { $scope: directive === newIsolateScopeDirective || directive.$$isolateScope ? isolateScope : scope, $element: $element, $attrs: attrs, $transclude: transcludeFn }, controllerInstance; controller = directive.controller; if (controller == '@') { controller = attrs[directive.name]; } controllerInstance = $controller(controller, locals, true, directive.controllerAs); // For directives with element transclusion the element is a comment, // but jQuery .data doesn't support attaching data to comment nodes as it's hard to // clean up (http://bugs.jquery.com/ticket/8335). // Instead, we save the controllers for the element in a local hash and attach to .data // later, once we have the actual element. elementControllers[directive.name] = controllerInstance; if (!hasElementTranscludeDirective) { $element.data('$' + directive.name + 'Controller', controllerInstance.instance); } controllers[directive.name] = controllerInstance; }); } if (newIsolateScopeDirective) { compile.$$addScopeInfo($element, isolateScope, true, !(templateDirective && (templateDirective === newIsolateScopeDirective || templateDirective === newIsolateScopeDirective.$$originalDirective))); compile.$$addScopeClass($element, true); var isolateScopeController = controllers && controllers[newIsolateScopeDirective.name]; var isolateBindingContext = isolateScope; if (isolateScopeController && isolateScopeController.identifier && newIsolateScopeDirective.bindToController === true) { isolateBindingContext = isolateScopeController.instance; } forEach(isolateScope.$$isolateBindings = newIsolateScopeDirective.$$isolateBindings, function(definition, scopeName) { var attrName = definition.attrName, optional = definition.optional, mode = definition.mode, // @, =, or & lastValue, parentGet, parentSet, compare; switch (mode) { case '@': attrs.$observe(attrName, function(value) { isolateBindingContext[scopeName] = value; }); attrs.$$observers[attrName].$$scope = scope; if (attrs[attrName]) { // If the attribute has been provided then we trigger an interpolation to ensure // the value is there for use in the link fn isolateBindingContext[scopeName] = $interpolate(attrs[attrName])(scope); } break; case '=': if (optional && !attrs[attrName]) { return; } parentGet = $parse(attrs[attrName]); if (parentGet.literal) { compare = equals; } else { compare = function(a, b) { return a === b || (a !== a && b !== b); }; } parentSet = parentGet.assign || function() { // reset the change, or we will throw this exception on every $digest lastValue = isolateBindingContext[scopeName] = parentGet(scope); throw $compileMinErr('nonassign', "Expression '{0}' used with directive '{1}' is non-assignable!", attrs[attrName], newIsolateScopeDirective.name); }; lastValue = isolateBindingContext[scopeName] = parentGet(scope); var parentValueWatch = function parentValueWatch(parentValue) { if (!compare(parentValue, isolateBindingContext[scopeName])) { // we are out of sync and need to copy if (!compare(parentValue, lastValue)) { // parent changed and it has precedence isolateBindingContext[scopeName] = parentValue; } else { // if the parent can be assigned then do so parentSet(scope, parentValue = isolateBindingContext[scopeName]); } } return lastValue = parentValue; }; parentValueWatch.$stateful = true; var unwatch; if (definition.collection) { unwatch = scope.$watchCollection(attrs[attrName], parentValueWatch); } else { unwatch = scope.$watch($parse(attrs[attrName], parentValueWatch), null, parentGet.literal); } isolateScope.$on('$destroy', unwatch); break; case '&': parentGet = $parse(attrs[attrName]); isolateBindingContext[scopeName] = function(locals) { return parentGet(scope, locals); }; break; } }); } if (controllers) { forEach(controllers, function(controller) { controller(); }); controllers = null; } // PRELINKING for (i = 0, ii = preLinkFns.length; i < ii; i++) { linkFn = preLinkFns[i]; invokeLinkFn(linkFn, linkFn.isolateScope ? isolateScope : scope, $element, attrs, linkFn.require && getControllers(linkFn.directiveName, linkFn.require, $element, elementControllers), transcludeFn ); } // RECURSION // We only pass the isolate scope, if the isolate directive has a template, // otherwise the child elements do not belong to the isolate directive. var scopeToChild = scope; if (newIsolateScopeDirective && (newIsolateScopeDirective.template || newIsolateScopeDirective.templateUrl === null)) { scopeToChild = isolateScope; } childLinkFn && childLinkFn(scopeToChild, linkNode.childNodes, undefined, boundTranscludeFn); // POSTLINKING for (i = postLinkFns.length - 1; i >= 0; i--) { linkFn = postLinkFns[i]; invokeLinkFn(linkFn, linkFn.isolateScope ? isolateScope : scope, $element, attrs, linkFn.require && getControllers(linkFn.directiveName, linkFn.require, $element, elementControllers), transcludeFn ); } // This is the function that is injected as `$transclude`. // Note: all arguments are optional! function controllersBoundTransclude(scope, cloneAttachFn, futureParentElement) { var transcludeControllers; // No scope passed in: if (!isScope(scope)) { futureParentElement = cloneAttachFn; cloneAttachFn = scope; scope = undefined; } if (hasElementTranscludeDirective) { transcludeControllers = elementControllers; } if (!futureParentElement) { futureParentElement = hasElementTranscludeDirective ? $element.parent() : $element; } return boundTranscludeFn(scope, cloneAttachFn, transcludeControllers, futureParentElement, scopeToChild); } } } function markDirectivesAsIsolate(directives) { // mark all directives as needing isolate scope. for (var j = 0, jj = directives.length; j < jj; j++) { directives[j] = inherit(directives[j], {$$isolateScope: true}); } } /** * looks up the directive and decorates it with exception handling and proper parameters. We * call this the boundDirective. * * @param {string} name name of the directive to look up. * @param {string} location The directive must be found in specific format. * String containing any of theses characters: * * * `E`: element name * * `A': attribute * * `C`: class * * `M`: comment * @returns {boolean} true if directive was added. */ function addDirective(tDirectives, name, location, maxPriority, ignoreDirective, startAttrName, endAttrName) { if (name === ignoreDirective) return null; var match = null; if (hasDirectives.hasOwnProperty(name)) { for (var directive, directives = $injector.get(name + Suffix), i = 0, ii = directives.length; i < ii; i++) { try { directive = directives[i]; if ((maxPriority === undefined || maxPriority > directive.priority) && directive.restrict.indexOf(location) != -1) { if (startAttrName) { directive = inherit(directive, {$$start: startAttrName, $$end: endAttrName}); } tDirectives.push(directive); match = directive; } } catch (e) { $exceptionHandler(e); } } } return match; } /** * looks up the directive and returns true if it is a multi-element directive, * and therefore requires DOM nodes between -start and -end markers to be grouped * together. * * @param {string} name name of the directive to look up. * @returns true if directive was registered as multi-element. */ function directiveIsMultiElement(name) { if (hasDirectives.hasOwnProperty(name)) { for (var directive, directives = $injector.get(name + Suffix), i = 0, ii = directives.length; i < ii; i++) { directive = directives[i]; if (directive.multiElement) { return true; } } } return false; } /** * When the element is replaced with HTML template then the new attributes * on the template need to be merged with the existing attributes in the DOM. * The desired effect is to have both of the attributes present. * * @param {object} dst destination attributes (original DOM) * @param {object} src source attributes (from the directive template) */ function mergeTemplateAttributes(dst, src) { var srcAttr = src.$attr, dstAttr = dst.$attr, $element = dst.$$element; // reapply the old attributes to the new element forEach(dst, function(value, key) { if (key.charAt(0) != '$') { if (src[key] && src[key] !== value) { value += (key === 'style' ? ';' : ' ') + src[key]; } dst.$set(key, value, true, srcAttr[key]); } }); // copy the new attributes on the old attrs object forEach(src, function(value, key) { if (key == 'class') { safeAddClass($element, value); dst['class'] = (dst['class'] ? dst['class'] + ' ' : '') + value; } else if (key == 'style') { $element.attr('style', $element.attr('style') + ';' + value); dst['style'] = (dst['style'] ? dst['style'] + ';' : '') + value; // `dst` will never contain hasOwnProperty as DOM parser won't let it. // You will get an "InvalidCharacterError: DOM Exception 5" error if you // have an attribute like "has-own-property" or "data-has-own-property", etc. } else if (key.charAt(0) != '$' && !dst.hasOwnProperty(key)) { dst[key] = value; dstAttr[key] = srcAttr[key]; } }); } function compileTemplateUrl(directives, $compileNode, tAttrs, $rootElement, childTranscludeFn, preLinkFns, postLinkFns, previousCompileContext) { var linkQueue = [], afterTemplateNodeLinkFn, afterTemplateChildLinkFn, beforeTemplateCompileNode = $compileNode[0], origAsyncDirective = directives.shift(), derivedSyncDirective = inherit(origAsyncDirective, { templateUrl: null, transclude: null, replace: null, $$originalDirective: origAsyncDirective }), templateUrl = (isFunction(origAsyncDirective.templateUrl)) ? origAsyncDirective.templateUrl($compileNode, tAttrs) : origAsyncDirective.templateUrl, templateNamespace = origAsyncDirective.templateNamespace; $compileNode.empty(); $templateRequest($sce.getTrustedResourceUrl(templateUrl)) .then(function(content) { var compileNode, tempTemplateAttrs, $template, childBoundTranscludeFn; content = denormalizeTemplate(content); if (origAsyncDirective.replace) { if (jqLiteIsTextNode(content)) { $template = []; } else { $template = removeComments(wrapTemplate(templateNamespace, trim(content))); } compileNode = $template[0]; if ($template.length != 1 || compileNode.nodeType !== NODE_TYPE_ELEMENT) { throw $compileMinErr('tplrt', "Template for directive '{0}' must have exactly one root element. {1}", origAsyncDirective.name, templateUrl); } tempTemplateAttrs = {$attr: {}}; replaceWith($rootElement, $compileNode, compileNode); var templateDirectives = collectDirectives(compileNode, [], tempTemplateAttrs); if (isObject(origAsyncDirective.scope)) { markDirectivesAsIsolate(templateDirectives); } directives = templateDirectives.concat(directives); mergeTemplateAttributes(tAttrs, tempTemplateAttrs); } else { compileNode = beforeTemplateCompileNode; $compileNode.html(content); } directives.unshift(derivedSyncDirective); afterTemplateNodeLinkFn = applyDirectivesToNode(directives, compileNode, tAttrs, childTranscludeFn, $compileNode, origAsyncDirective, preLinkFns, postLinkFns, previousCompileContext); forEach($rootElement, function(node, i) { if (node == compileNode) { $rootElement[i] = $compileNode[0]; } }); afterTemplateChildLinkFn = compileNodes($compileNode[0].childNodes, childTranscludeFn); while (linkQueue.length) { var scope = linkQueue.shift(), beforeTemplateLinkNode = linkQueue.shift(), linkRootElement = linkQueue.shift(), boundTranscludeFn = linkQueue.shift(), linkNode = $compileNode[0]; if (scope.$$destroyed) continue; if (beforeTemplateLinkNode !== beforeTemplateCompileNode) { var oldClasses = beforeTemplateLinkNode.className; if (!(previousCompileContext.hasElementTranscludeDirective && origAsyncDirective.replace)) { // it was cloned therefore we have to clone as well. linkNode = jqLiteClone(compileNode); } replaceWith(linkRootElement, jqLite(beforeTemplateLinkNode), linkNode); // Copy in CSS classes from original node safeAddClass(jqLite(linkNode), oldClasses); } if (afterTemplateNodeLinkFn.transcludeOnThisElement) { childBoundTranscludeFn = createBoundTranscludeFn(scope, afterTemplateNodeLinkFn.transclude, boundTranscludeFn); } else { childBoundTranscludeFn = boundTranscludeFn; } afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, linkNode, $rootElement, childBoundTranscludeFn); } linkQueue = null; }); return function delayedNodeLinkFn(ignoreChildLinkFn, scope, node, rootElement, boundTranscludeFn) { var childBoundTranscludeFn = boundTranscludeFn; if (scope.$$destroyed) return; if (linkQueue) { linkQueue.push(scope, node, rootElement, childBoundTranscludeFn); } else { if (afterTemplateNodeLinkFn.transcludeOnThisElement) { childBoundTranscludeFn = createBoundTranscludeFn(scope, afterTemplateNodeLinkFn.transclude, boundTranscludeFn); } afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, node, rootElement, childBoundTranscludeFn); } }; } /** * Sorting function for bound directives. */ function byPriority(a, b) { var diff = b.priority - a.priority; if (diff !== 0) return diff; if (a.name !== b.name) return (a.name < b.name) ? -1 : 1; return a.index - b.index; } function assertNoDuplicate(what, previousDirective, directive, element) { if (previousDirective) { throw $compileMinErr('multidir', 'Multiple directives [{0}, {1}] asking for {2} on: {3}', previousDirective.name, directive.name, what, startingTag(element)); } } function addTextInterpolateDirective(directives, text) { var interpolateFn = $interpolate(text, true); if (interpolateFn) { directives.push({ priority: 0, compile: function textInterpolateCompileFn(templateNode) { var templateNodeParent = templateNode.parent(), hasCompileParent = !!templateNodeParent.length; // When transcluding a template that has bindings in the root // we don't have a parent and thus need to add the class during linking fn. if (hasCompileParent) compile.$$addBindingClass(templateNodeParent); return function textInterpolateLinkFn(scope, node) { var parent = node.parent(); if (!hasCompileParent) compile.$$addBindingClass(parent); compile.$$addBindingInfo(parent, interpolateFn.expressions); scope.$watch(interpolateFn, function interpolateFnWatchAction(value) { node[0].nodeValue = value; }); }; } }); } } function wrapTemplate(type, template) { type = lowercase(type || 'html'); switch (type) { case 'svg': case 'math': var wrapper = document.createElement('div'); wrapper.innerHTML = '<' + type + '>' + template + '</' + type + '>'; return wrapper.childNodes[0].childNodes; default: return template; } } function getTrustedContext(node, attrNormalizedName) { if (attrNormalizedName == "srcdoc") { return $sce.HTML; } var tag = nodeName_(node); // maction[xlink:href] can source SVG. It's not limited to <maction>. if (attrNormalizedName == "xlinkHref" || (tag == "form" && attrNormalizedName == "action") || (tag != "img" && (attrNormalizedName == "src" || attrNormalizedName == "ngSrc"))) { return $sce.RESOURCE_URL; } } function addAttrInterpolateDirective(node, directives, value, name, allOrNothing) { var trustedContext = getTrustedContext(node, name); allOrNothing = ALL_OR_NOTHING_ATTRS[name] || allOrNothing; var interpolateFn = $interpolate(value, true, trustedContext, allOrNothing); // no interpolation found -> ignore if (!interpolateFn) return; if (name === "multiple" && nodeName_(node) === "select") { throw $compileMinErr("selmulti", "Binding to the 'multiple' attribute is not supported. Element: {0}", startingTag(node)); } directives.push({ priority: 100, compile: function() { return { pre: function attrInterpolatePreLinkFn(scope, element, attr) { var $$observers = (attr.$$observers || (attr.$$observers = {})); if (EVENT_HANDLER_ATTR_REGEXP.test(name)) { throw $compileMinErr('nodomevents', "Interpolations for HTML DOM event attributes are disallowed. Please use the " + "ng- versions (such as ng-click instead of onclick) instead."); } // If the attribute has changed since last $interpolate()ed var newValue = attr[name]; if (newValue !== value) { // we need to interpolate again since the attribute value has been updated // (e.g. by another directive's compile function) // ensure unset/empty values make interpolateFn falsy interpolateFn = newValue && $interpolate(newValue, true, trustedContext, allOrNothing); value = newValue; } // if attribute was updated so that there is no interpolation going on we don't want to // register any observers if (!interpolateFn) return; // initialize attr object so that it's ready in case we need the value for isolate // scope initialization, otherwise the value would not be available from isolate // directive's linking fn during linking phase attr[name] = interpolateFn(scope); ($$observers[name] || ($$observers[name] = [])).$$inter = true; (attr.$$observers && attr.$$observers[name].$$scope || scope). $watch(interpolateFn, function interpolateFnWatchAction(newValue, oldValue) { //special case for class attribute addition + removal //so that class changes can tap into the animation //hooks provided by the $animate service. Be sure to //skip animations when the first digest occurs (when //both the new and the old values are the same) since //the CSS classes are the non-interpolated values if (name === 'class' && newValue != oldValue) { attr.$updateClass(newValue, oldValue); } else { attr.$set(name, newValue); } }); } }; } }); } /** * This is a special jqLite.replaceWith, which can replace items which * have no parents, provided that the containing jqLite collection is provided. * * @param {JqLite=} $rootElement The root of the compile tree. Used so that we can replace nodes * in the root of the tree. * @param {JqLite} elementsToRemove The jqLite element which we are going to replace. We keep * the shell, but replace its DOM node reference. * @param {Node} newNode The new DOM node. */ function replaceWith($rootElement, elementsToRemove, newNode) { var firstElementToRemove = elementsToRemove[0], removeCount = elementsToRemove.length, parent = firstElementToRemove.parentNode, i, ii; if ($rootElement) { for (i = 0, ii = $rootElement.length; i < ii; i++) { if ($rootElement[i] == firstElementToRemove) { $rootElement[i++] = newNode; for (var j = i, j2 = j + removeCount - 1, jj = $rootElement.length; j < jj; j++, j2++) { if (j2 < jj) { $rootElement[j] = $rootElement[j2]; } else { delete $rootElement[j]; } } $rootElement.length -= removeCount - 1; // If the replaced element is also the jQuery .context then replace it // .context is a deprecated jQuery api, so we should set it only when jQuery set it // http://api.jquery.com/context/ if ($rootElement.context === firstElementToRemove) { $rootElement.context = newNode; } break; } } } if (parent) { parent.replaceChild(newNode, firstElementToRemove); } // TODO(perf): what's this document fragment for? is it needed? can we at least reuse it? var fragment = document.createDocumentFragment(); fragment.appendChild(firstElementToRemove); // Copy over user data (that includes Angular's $scope etc.). Don't copy private // data here because there's no public interface in jQuery to do that and copying over // event listeners (which is the main use of private data) wouldn't work anyway. jqLite(newNode).data(jqLite(firstElementToRemove).data()); // Remove data of the replaced element. We cannot just call .remove() // on the element it since that would deallocate scope that is needed // for the new node. Instead, remove the data "manually". if (!jQuery) { delete jqLite.cache[firstElementToRemove[jqLite.expando]]; } else { // jQuery 2.x doesn't expose the data storage. Use jQuery.cleanData to clean up after // the replaced element. The cleanData version monkey-patched by Angular would cause // the scope to be trashed and we do need the very same scope to work with the new // element. However, we cannot just cache the non-patched version and use it here as // that would break if another library patches the method after Angular does (one // example is jQuery UI). Instead, set a flag indicating scope destroying should be // skipped this one time. skipDestroyOnNextJQueryCleanData = true; jQuery.cleanData([firstElementToRemove]); } for (var k = 1, kk = elementsToRemove.length; k < kk; k++) { var element = elementsToRemove[k]; jqLite(element).remove(); // must do this way to clean up expando fragment.appendChild(element); delete elementsToRemove[k]; } elementsToRemove[0] = newNode; elementsToRemove.length = 1; } function cloneAndAnnotateFn(fn, annotation) { return extend(function() { return fn.apply(null, arguments); }, fn, annotation); } function invokeLinkFn(linkFn, scope, $element, attrs, controllers, transcludeFn) { try { linkFn(scope, $element, attrs, controllers, transcludeFn); } catch (e) { $exceptionHandler(e, startingTag($element)); } } }]; } var PREFIX_REGEXP = /^((?:x|data)[\:\-_])/i; /** * Converts all accepted directives format into proper directive name. * @param name Name to normalize */ function directiveNormalize(name) { return camelCase(name.replace(PREFIX_REGEXP, '')); } /** * @ngdoc type * @name $compile.directive.Attributes * * @description * A shared object between directive compile / linking functions which contains normalized DOM * element attributes. The values reflect current binding state `{{ }}`. The normalization is * needed since all of these are treated as equivalent in Angular: * * ``` * <span ng:bind="a" ng-bind="a" data-ng-bind="a" x-ng-bind="a"> * ``` */ /** * @ngdoc property * @name $compile.directive.Attributes#$attr * * @description * A map of DOM element attribute names to the normalized name. This is * needed to do reverse lookup from normalized name back to actual name. */ /** * @ngdoc method * @name $compile.directive.Attributes#$set * @kind function * * @description * Set DOM element attribute value. * * * @param {string} name Normalized element attribute name of the property to modify. The name is * reverse-translated using the {@link ng.$compile.directive.Attributes#$attr $attr} * property to the original name. * @param {string} value Value to set the attribute to. The value can be an interpolated string. */ /** * Closure compiler type information */ function nodesetLinkingFn( /* angular.Scope */ scope, /* NodeList */ nodeList, /* Element */ rootElement, /* function(Function) */ boundTranscludeFn ) {} function directiveLinkingFn( /* nodesetLinkingFn */ nodesetLinkingFn, /* angular.Scope */ scope, /* Node */ node, /* Element */ rootElement, /* function(Function) */ boundTranscludeFn ) {} function tokenDifference(str1, str2) { var values = '', tokens1 = str1.split(/\s+/), tokens2 = str2.split(/\s+/); outer: for (var i = 0; i < tokens1.length; i++) { var token = tokens1[i]; for (var j = 0; j < tokens2.length; j++) { if (token == tokens2[j]) continue outer; } values += (values.length > 0 ? ' ' : '') + token; } return values; } function removeComments(jqNodes) { jqNodes = jqLite(jqNodes); var i = jqNodes.length; if (i <= 1) { return jqNodes; } while (i--) { var node = jqNodes[i]; if (node.nodeType === NODE_TYPE_COMMENT) { splice.call(jqNodes, i, 1); } } return jqNodes; } var $controllerMinErr = minErr('$controller'); /** * @ngdoc provider * @name $controllerProvider * @description * The {@link ng.$controller $controller service} is used by Angular to create new * controllers. * * This provider allows controller registration via the * {@link ng.$controllerProvider#register register} method. */ function $ControllerProvider() { var controllers = {}, globals = false, CNTRL_REG = /^(\S+)(\s+as\s+(\w+))?$/; /** * @ngdoc method * @name $controllerProvider#register * @param {string|Object} name Controller name, or an object map of controllers where the keys are * the names and the values are the constructors. * @param {Function|Array} constructor Controller constructor fn (optionally decorated with DI * annotations in the array notation). */ this.register = function(name, constructor) { assertNotHasOwnProperty(name, 'controller'); if (isObject(name)) { extend(controllers, name); } else { controllers[name] = constructor; } }; /** * @ngdoc method * @name $controllerProvider#allowGlobals * @description If called, allows `$controller` to find controller constructors on `window` */ this.allowGlobals = function() { globals = true; }; this.$get = ['$injector', '$window', function($injector, $window) { /** * @ngdoc service * @name $controller * @requires $injector * * @param {Function|string} constructor If called with a function then it's considered to be the * controller constructor function. Otherwise it's considered to be a string which is used * to retrieve the controller constructor using the following steps: * * * check if a controller with given name is registered via `$controllerProvider` * * check if evaluating the string on the current scope returns a constructor * * if $controllerProvider#allowGlobals, check `window[constructor]` on the global * `window` object (not recommended) * * The string can use the `controller as property` syntax, where the controller instance is published * as the specified property on the `scope`; the `scope` must be injected into `locals` param for this * to work correctly. * * @param {Object} locals Injection locals for Controller. * @return {Object} Instance of given controller. * * @description * `$controller` service is responsible for instantiating controllers. * * It's just a simple call to {@link auto.$injector $injector}, but extracted into * a service, so that one can override this service with [BC version](https://gist.github.com/1649788). */ return function(expression, locals, later, ident) { // PRIVATE API: // param `later` --- indicates that the controller's constructor is invoked at a later time. // If true, $controller will allocate the object with the correct // prototype chain, but will not invoke the controller until a returned // callback is invoked. // param `ident` --- An optional label which overrides the label parsed from the controller // expression, if any. var instance, match, constructor, identifier; later = later === true; if (ident && isString(ident)) { identifier = ident; } if (isString(expression)) { match = expression.match(CNTRL_REG); if (!match) { throw $controllerMinErr('ctrlfmt', "Badly formed controller string '{0}'. " + "Must match `__name__ as __id__` or `__name__`.", expression); } constructor = match[1], identifier = identifier || match[3]; expression = controllers.hasOwnProperty(constructor) ? controllers[constructor] : getter(locals.$scope, constructor, true) || (globals ? getter($window, constructor, true) : undefined); assertArgFn(expression, constructor, true); } if (later) { // Instantiate controller later: // This machinery is used to create an instance of the object before calling the // controller's constructor itself. // // This allows properties to be added to the controller before the constructor is // invoked. Primarily, this is used for isolate scope bindings in $compile. // // This feature is not intended for use by applications, and is thus not documented // publicly. // Object creation: http://jsperf.com/create-constructor/2 var controllerPrototype = (isArray(expression) ? expression[expression.length - 1] : expression).prototype; instance = Object.create(controllerPrototype || null); if (identifier) { addIdentifier(locals, identifier, instance, constructor || expression.name); } return extend(function() { $injector.invoke(expression, instance, locals, constructor); return instance; }, { instance: instance, identifier: identifier }); } instance = $injector.instantiate(expression, locals, constructor); if (identifier) { addIdentifier(locals, identifier, instance, constructor || expression.name); } return instance; }; function addIdentifier(locals, identifier, instance, name) { if (!(locals && isObject(locals.$scope))) { throw minErr('$controller')('noscp', "Cannot export controller '{0}' as '{1}'! No $scope object provided via `locals`.", name, identifier); } locals.$scope[identifier] = instance; } }]; } /** * @ngdoc service * @name $document * @requires $window * * @description * A {@link angular.element jQuery or jqLite} wrapper for the browser's `window.document` object. * * @example <example module="documentExample"> <file name="index.html"> <div ng-controller="ExampleController"> <p>$document title: <b ng-bind="title"></b></p> <p>window.document title: <b ng-bind="windowTitle"></b></p> </div> </file> <file name="script.js"> angular.module('documentExample', []) .controller('ExampleController', ['$scope', '$document', function($scope, $document) { $scope.title = $document[0].title; $scope.windowTitle = angular.element(window.document)[0].title; }]); </file> </example> */ function $DocumentProvider() { this.$get = ['$window', function(window) { return jqLite(window.document); }]; } /** * @ngdoc service * @name $exceptionHandler * @requires ng.$log * * @description * Any uncaught exception in angular expressions is delegated to this service. * The default implementation simply delegates to `$log.error` which logs it into * the browser console. * * In unit tests, if `angular-mocks.js` is loaded, this service is overridden by * {@link ngMock.$exceptionHandler mock $exceptionHandler} which aids in testing. * * ## Example: * * ```js * angular.module('exceptionOverride', []).factory('$exceptionHandler', function() { * return function(exception, cause) { * exception.message += ' (caused by "' + cause + '")'; * throw exception; * }; * }); * ``` * * This example will override the normal action of `$exceptionHandler`, to make angular * exceptions fail hard when they happen, instead of just logging to the console. * * <hr /> * Note, that code executed in event-listeners (even those registered using jqLite's `on`/`bind` * methods) does not delegate exceptions to the {@link ng.$exceptionHandler $exceptionHandler} * (unless executed during a digest). * * If you wish, you can manually delegate exceptions, e.g. * `try { ... } catch(e) { $exceptionHandler(e); }` * * @param {Error} exception Exception associated with the error. * @param {string=} cause optional information about the context in which * the error was thrown. * */ function $ExceptionHandlerProvider() { this.$get = ['$log', function($log) { return function(exception, cause) { $log.error.apply($log, arguments); }; }]; } var APPLICATION_JSON = 'application/json'; var CONTENT_TYPE_APPLICATION_JSON = {'Content-Type': APPLICATION_JSON + ';charset=utf-8'}; var JSON_START = /^\[|^\{(?!\{)/; var JSON_ENDS = { '[': /]$/, '{': /}$/ }; var JSON_PROTECTION_PREFIX = /^\)\]\}',?\n/; function defaultHttpResponseTransform(data, headers) { if (isString(data)) { // Strip json vulnerability protection prefix and trim whitespace var tempData = data.replace(JSON_PROTECTION_PREFIX, '').trim(); if (tempData) { var contentType = headers('Content-Type'); if ((contentType && (contentType.indexOf(APPLICATION_JSON) === 0)) || isJsonLike(tempData)) { data = fromJson(tempData); } } } return data; } function isJsonLike(str) { var jsonStart = str.match(JSON_START); return jsonStart && JSON_ENDS[jsonStart[0]].test(str); } /** * Parse headers into key value object * * @param {string} headers Raw headers as a string * @returns {Object} Parsed headers as key value object */ function parseHeaders(headers) { var parsed = createMap(), key, val, i; if (!headers) return parsed; forEach(headers.split('\n'), function(line) { i = line.indexOf(':'); key = lowercase(trim(line.substr(0, i))); val = trim(line.substr(i + 1)); if (key) { parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; } }); return parsed; } /** * Returns a function that provides access to parsed headers. * * Headers are lazy parsed when first requested. * @see parseHeaders * * @param {(string|Object)} headers Headers to provide access to. * @returns {function(string=)} Returns a getter function which if called with: * * - if called with single an argument returns a single header value or null * - if called with no arguments returns an object containing all headers. */ function headersGetter(headers) { var headersObj = isObject(headers) ? headers : undefined; return function(name) { if (!headersObj) headersObj = parseHeaders(headers); if (name) { var value = headersObj[lowercase(name)]; if (value === void 0) { value = null; } return value; } return headersObj; }; } /** * Chain all given functions * * This function is used for both request and response transforming * * @param {*} data Data to transform. * @param {function(string=)} headers HTTP headers getter fn. * @param {number} status HTTP status code of the response. * @param {(Function|Array.<Function>)} fns Function or an array of functions. * @returns {*} Transformed data. */ function transformData(data, headers, status, fns) { if (isFunction(fns)) return fns(data, headers, status); forEach(fns, function(fn) { data = fn(data, headers, status); }); return data; } function isSuccess(status) { return 200 <= status && status < 300; } /** * @ngdoc provider * @name $httpProvider * @description * Use `$httpProvider` to change the default behavior of the {@link ng.$http $http} service. * */ function $HttpProvider() { /** * @ngdoc property * @name $httpProvider#defaults * @description * * Object containing default values for all {@link ng.$http $http} requests. * * - **`defaults.cache`** - {Object} - an object built with {@link ng.$cacheFactory `$cacheFactory`} * that will provide the cache for all requests who set their `cache` property to `true`. * If you set the `default.cache = false` then only requests that specify their own custom * cache object will be cached. See {@link $http#caching $http Caching} for more information. * * - **`defaults.xsrfCookieName`** - {string} - Name of cookie containing the XSRF token. * Defaults value is `'XSRF-TOKEN'`. * * - **`defaults.xsrfHeaderName`** - {string} - Name of HTTP header to populate with the * XSRF token. Defaults value is `'X-XSRF-TOKEN'`. * * - **`defaults.headers`** - {Object} - Default headers for all $http requests. * Refer to {@link ng.$http#setting-http-headers $http} for documentation on * setting default headers. * - **`defaults.headers.common`** * - **`defaults.headers.post`** * - **`defaults.headers.put`** * - **`defaults.headers.patch`** * **/ var defaults = this.defaults = { // transform incoming response data transformResponse: [defaultHttpResponseTransform], // transform outgoing request data transformRequest: [function(d) { return isObject(d) && !isFile(d) && !isBlob(d) && !isFormData(d) ? toJson(d) : d; }], // default headers headers: { common: { 'Accept': 'application/json, text/plain, */*' }, post: shallowCopy(CONTENT_TYPE_APPLICATION_JSON), put: shallowCopy(CONTENT_TYPE_APPLICATION_JSON), patch: shallowCopy(CONTENT_TYPE_APPLICATION_JSON) }, xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN' }; var useApplyAsync = false; /** * @ngdoc method * @name $httpProvider#useApplyAsync * @description * * Configure $http service to combine processing of multiple http responses received at around * the same time via {@link ng.$rootScope.Scope#$applyAsync $rootScope.$applyAsync}. This can result in * significant performance improvement for bigger applications that make many HTTP requests * concurrently (common during application bootstrap). * * Defaults to false. If no value is specifed, returns the current configured value. * * @param {boolean=} value If true, when requests are loaded, they will schedule a deferred * "apply" on the next tick, giving time for subsequent requests in a roughly ~10ms window * to load and share the same digest cycle. * * @returns {boolean|Object} If a value is specified, returns the $httpProvider for chaining. * otherwise, returns the current configured value. **/ this.useApplyAsync = function(value) { if (isDefined(value)) { useApplyAsync = !!value; return this; } return useApplyAsync; }; /** * @ngdoc property * @name $httpProvider#interceptors * @description * * Array containing service factories for all synchronous or asynchronous {@link ng.$http $http} * pre-processing of request or postprocessing of responses. * * These service factories are ordered by request, i.e. they are applied in the same order as the * array, on request, but reverse order, on response. * * {@link ng.$http#interceptors Interceptors detailed info} **/ var interceptorFactories = this.interceptors = []; this.$get = ['$httpBackend', '$browser', '$cacheFactory', '$rootScope', '$q', '$injector', function($httpBackend, $browser, $cacheFactory, $rootScope, $q, $injector) { var defaultCache = $cacheFactory('$http'); /** * Interceptors stored in reverse order. Inner interceptors before outer interceptors. * The reversal is needed so that we can build up the interception chain around the * server request. */ var reversedInterceptors = []; forEach(interceptorFactories, function(interceptorFactory) { reversedInterceptors.unshift(isString(interceptorFactory) ? $injector.get(interceptorFactory) : $injector.invoke(interceptorFactory)); }); /** * @ngdoc service * @kind function * @name $http * @requires ng.$httpBackend * @requires $cacheFactory * @requires $rootScope * @requires $q * @requires $injector * * @description * The `$http` service is a core Angular service that facilitates communication with the remote * HTTP servers via the browser's [XMLHttpRequest](https://developer.mozilla.org/en/xmlhttprequest) * object or via [JSONP](http://en.wikipedia.org/wiki/JSONP). * * For unit testing applications that use `$http` service, see * {@link ngMock.$httpBackend $httpBackend mock}. * * For a higher level of abstraction, please check out the {@link ngResource.$resource * $resource} service. * * The $http API is based on the {@link ng.$q deferred/promise APIs} exposed by * the $q service. While for simple usage patterns this doesn't matter much, for advanced usage * it is important to familiarize yourself with these APIs and the guarantees they provide. * * * ## General usage * The `$http` service is a function which takes a single argument — a configuration object — * that is used to generate an HTTP request and returns a {@link ng.$q promise} * with two $http specific methods: `success` and `error`. * * ```js * // Simple GET request example : * $http.get('/someUrl'). * success(function(data, status, headers, config) { * // this callback will be called asynchronously * // when the response is available * }). * error(function(data, status, headers, config) { * // called asynchronously if an error occurs * // or server returns response with an error status. * }); * ``` * * ```js * // Simple POST request example (passing data) : * $http.post('/someUrl', {msg:'hello word!'}). * success(function(data, status, headers, config) { * // this callback will be called asynchronously * // when the response is available * }). * error(function(data, status, headers, config) { * // called asynchronously if an error occurs * // or server returns response with an error status. * }); * ``` * * * Since the returned value of calling the $http function is a `promise`, you can also use * the `then` method to register callbacks, and these callbacks will receive a single argument – * an object representing the response. See the API signature and type info below for more * details. * * A response status code between 200 and 299 is considered a success status and * will result in the success callback being called. Note that if the response is a redirect, * XMLHttpRequest will transparently follow it, meaning that the error callback will not be * called for such responses. * * ## Writing Unit Tests that use $http * When unit testing (using {@link ngMock ngMock}), it is necessary to call * {@link ngMock.$httpBackend#flush $httpBackend.flush()} to flush each pending * request using trained responses. * * ``` * $httpBackend.expectGET(...); * $http.get(...); * $httpBackend.flush(); * ``` * * ## Shortcut methods * * Shortcut methods are also available. All shortcut methods require passing in the URL, and * request data must be passed in for POST/PUT requests. * * ```js * $http.get('/someUrl').success(successCallback); * $http.post('/someUrl', data).success(successCallback); * ``` * * Complete list of shortcut methods: * * - {@link ng.$http#get $http.get} * - {@link ng.$http#head $http.head} * - {@link ng.$http#post $http.post} * - {@link ng.$http#put $http.put} * - {@link ng.$http#delete $http.delete} * - {@link ng.$http#jsonp $http.jsonp} * - {@link ng.$http#patch $http.patch} * * * ## Setting HTTP Headers * * The $http service will automatically add certain HTTP headers to all requests. These defaults * can be fully configured by accessing the `$httpProvider.defaults.headers` configuration * object, which currently contains this default configuration: * * - `$httpProvider.defaults.headers.common` (headers that are common for all requests): * - `Accept: application/json, text/plain, * / *` * - `$httpProvider.defaults.headers.post`: (header defaults for POST requests) * - `Content-Type: application/json` * - `$httpProvider.defaults.headers.put` (header defaults for PUT requests) * - `Content-Type: application/json` * * To add or overwrite these defaults, simply add or remove a property from these configuration * objects. To add headers for an HTTP method other than POST or PUT, simply add a new object * with the lowercased HTTP method name as the key, e.g. * `$httpProvider.defaults.headers.get = { 'My-Header' : 'value' }. * * The defaults can also be set at runtime via the `$http.defaults` object in the same * fashion. For example: * * ``` * module.run(function($http) { * $http.defaults.headers.common.Authorization = 'Basic YmVlcDpib29w' * }); * ``` * * In addition, you can supply a `headers` property in the config object passed when * calling `$http(config)`, which overrides the defaults without changing them globally. * * To explicitly remove a header automatically added via $httpProvider.defaults.headers on a per request basis, * Use the `headers` property, setting the desired header to `undefined`. For example: * * ```js * var req = { * method: 'POST', * url: 'http://example.com', * headers: { * 'Content-Type': undefined * }, * data: { test: 'test' }, * } * * $http(req).success(function(){...}).error(function(){...}); * ``` * * ## Transforming Requests and Responses * * Both requests and responses can be transformed using transformation functions: `transformRequest` * and `transformResponse`. These properties can be a single function that returns * the transformed value (`function(data, headersGetter, status)`) or an array of such transformation functions, * which allows you to `push` or `unshift` a new transformation function into the transformation chain. * * ### Default Transformations * * The `$httpProvider` provider and `$http` service expose `defaults.transformRequest` and * `defaults.transformResponse` properties. If a request does not provide its own transformations * then these will be applied. * * You can augment or replace the default transformations by modifying these properties by adding to or * replacing the array. * * Angular provides the following default transformations: * * Request transformations (`$httpProvider.defaults.transformRequest` and `$http.defaults.transformRequest`): * * - If the `data` property of the request configuration object contains an object, serialize it * into JSON format. * * Response transformations (`$httpProvider.defaults.transformResponse` and `$http.defaults.transformResponse`): * * - If XSRF prefix is detected, strip it (see Security Considerations section below). * - If JSON response is detected, deserialize it using a JSON parser. * * * ### Overriding the Default Transformations Per Request * * If you wish override the request/response transformations only for a single request then provide * `transformRequest` and/or `transformResponse` properties on the configuration object passed * into `$http`. * * Note that if you provide these properties on the config object the default transformations will be * overwritten. If you wish to augment the default transformations then you must include them in your * local transformation array. * * The following code demonstrates adding a new response transformation to be run after the default response * transformations have been run. * * ```js * function appendTransform(defaults, transform) { * * // We can't guarantee that the default transformation is an array * defaults = angular.isArray(defaults) ? defaults : [defaults]; * * // Append the new transformation to the defaults * return defaults.concat(transform); * } * * $http({ * url: '...', * method: 'GET', * transformResponse: appendTransform($http.defaults.transformResponse, function(value) { * return doTransform(value); * }) * }); * ``` * * * ## Caching * * To enable caching, set the request configuration `cache` property to `true` (to use default * cache) or to a custom cache object (built with {@link ng.$cacheFactory `$cacheFactory`}). * When the cache is enabled, `$http` stores the response from the server in the specified * cache. The next time the same request is made, the response is served from the cache without * sending a request to the server. * * Note that even if the response is served from cache, delivery of the data is asynchronous in * the same way that real requests are. * * If there are multiple GET requests for the same URL that should be cached using the same * cache, but the cache is not populated yet, only one request to the server will be made and * the remaining requests will be fulfilled using the response from the first request. * * You can change the default cache to a new object (built with * {@link ng.$cacheFactory `$cacheFactory`}) by updating the * {@link ng.$http#defaults `$http.defaults.cache`} property. All requests who set * their `cache` property to `true` will now use this cache object. * * If you set the default cache to `false` then only requests that specify their own custom * cache object will be cached. * * ## Interceptors * * Before you start creating interceptors, be sure to understand the * {@link ng.$q $q and deferred/promise APIs}. * * For purposes of global error handling, authentication, or any kind of synchronous or * asynchronous pre-processing of request or postprocessing of responses, it is desirable to be * able to intercept requests before they are handed to the server and * responses before they are handed over to the application code that * initiated these requests. The interceptors leverage the {@link ng.$q * promise APIs} to fulfill this need for both synchronous and asynchronous pre-processing. * * The interceptors are service factories that are registered with the `$httpProvider` by * adding them to the `$httpProvider.interceptors` array. The factory is called and * injected with dependencies (if specified) and returns the interceptor. * * There are two kinds of interceptors (and two kinds of rejection interceptors): * * * `request`: interceptors get called with a http `config` object. The function is free to * modify the `config` object or create a new one. The function needs to return the `config` * object directly, or a promise containing the `config` or a new `config` object. * * `requestError`: interceptor gets called when a previous interceptor threw an error or * resolved with a rejection. * * `response`: interceptors get called with http `response` object. The function is free to * modify the `response` object or create a new one. The function needs to return the `response` * object directly, or as a promise containing the `response` or a new `response` object. * * `responseError`: interceptor gets called when a previous interceptor threw an error or * resolved with a rejection. * * * ```js * // register the interceptor as a service * $provide.factory('myHttpInterceptor', function($q, dependency1, dependency2) { * return { * // optional method * 'request': function(config) { * // do something on success * return config; * }, * * // optional method * 'requestError': function(rejection) { * // do something on error * if (canRecover(rejection)) { * return responseOrNewPromise * } * return $q.reject(rejection); * }, * * * * // optional method * 'response': function(response) { * // do something on success * return response; * }, * * // optional method * 'responseError': function(rejection) { * // do something on error * if (canRecover(rejection)) { * return responseOrNewPromise * } * return $q.reject(rejection); * } * }; * }); * * $httpProvider.interceptors.push('myHttpInterceptor'); * * * // alternatively, register the interceptor via an anonymous factory * $httpProvider.interceptors.push(function($q, dependency1, dependency2) { * return { * 'request': function(config) { * // same as above * }, * * 'response': function(response) { * // same as above * } * }; * }); * ``` * * ## Security Considerations * * When designing web applications, consider security threats from: * * - [JSON vulnerability](http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx) * - [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery) * * Both server and the client must cooperate in order to eliminate these threats. Angular comes * pre-configured with strategies that address these issues, but for this to work backend server * cooperation is required. * * ### JSON Vulnerability Protection * * A [JSON vulnerability](http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx) * allows third party website to turn your JSON resource URL into * [JSONP](http://en.wikipedia.org/wiki/JSONP) request under some conditions. To * counter this your server can prefix all JSON requests with following string `")]}',\n"`. * Angular will automatically strip the prefix before processing it as JSON. * * For example if your server needs to return: * ```js * ['one','two'] * ``` * * which is vulnerable to attack, your server can return: * ```js * )]}', * ['one','two'] * ``` * * Angular will strip the prefix, before processing the JSON. * * * ### Cross Site Request Forgery (XSRF) Protection * * [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery) is a technique by which * an unauthorized site can gain your user's private data. Angular provides a mechanism * to counter XSRF. When performing XHR requests, the $http service reads a token from a cookie * (by default, `XSRF-TOKEN`) and sets it as an HTTP header (`X-XSRF-TOKEN`). Since only * JavaScript that runs on your domain could read the cookie, your server can be assured that * the XHR came from JavaScript running on your domain. The header will not be set for * cross-domain requests. * * To take advantage of this, your server needs to set a token in a JavaScript readable session * cookie called `XSRF-TOKEN` on the first HTTP GET request. On subsequent XHR requests the * server can verify that the cookie matches `X-XSRF-TOKEN` HTTP header, and therefore be sure * that only JavaScript running on your domain could have sent the request. The token must be * unique for each user and must be verifiable by the server (to prevent the JavaScript from * making up its own tokens). We recommend that the token is a digest of your site's * authentication cookie with a [salt](https://en.wikipedia.org/wiki/Salt_(cryptography&#41;) * for added security. * * The name of the headers can be specified using the xsrfHeaderName and xsrfCookieName * properties of either $httpProvider.defaults at config-time, $http.defaults at run-time, * or the per-request config object. * * * @param {object} config Object describing the request to be made and how it should be * processed. The object has following properties: * * - **method** – `{string}` – HTTP method (e.g. 'GET', 'POST', etc) * - **url** – `{string}` – Absolute or relative URL of the resource that is being requested. * - **params** – `{Object.<string|Object>}` – Map of strings or objects which will be turned * to `?key1=value1&key2=value2` after the url. If the value is not a string, it will be * JSONified. * - **data** – `{string|Object}` – Data to be sent as the request message data. * - **headers** – `{Object}` – Map of strings or functions which return strings representing * HTTP headers to send to the server. If the return value of a function is null, the * header will not be sent. * - **xsrfHeaderName** – `{string}` – Name of HTTP header to populate with the XSRF token. * - **xsrfCookieName** – `{string}` – Name of cookie containing the XSRF token. * - **transformRequest** – * `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` – * transform function or an array of such functions. The transform function takes the http * request body and headers and returns its transformed (typically serialized) version. * See {@link ng.$http#overriding-the-default-transformations-per-request * Overriding the Default Transformations} * - **transformResponse** – * `{function(data, headersGetter, status)|Array.<function(data, headersGetter, status)>}` – * transform function or an array of such functions. The transform function takes the http * response body, headers and status and returns its transformed (typically deserialized) version. * See {@link ng.$http#overriding-the-default-transformations-per-request * Overriding the Default Transformations} * - **cache** – `{boolean|Cache}` – If true, a default $http cache will be used to cache the * GET request, otherwise if a cache instance built with * {@link ng.$cacheFactory $cacheFactory}, this cache will be used for * caching. * - **timeout** – `{number|Promise}` – timeout in milliseconds, or {@link ng.$q promise} * that should abort the request when resolved. * - **withCredentials** - `{boolean}` - whether to set the `withCredentials` flag on the * XHR object. See [requests with credentials](https://developer.mozilla.org/docs/Web/HTTP/Access_control_CORS#Requests_with_credentials) * for more information. * - **responseType** - `{string}` - see * [requestType](https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest#responseType). * * @returns {HttpPromise} Returns a {@link ng.$q promise} object with the * standard `then` method and two http specific methods: `success` and `error`. The `then` * method takes two arguments a success and an error callback which will be called with a * response object. The `success` and `error` methods take a single argument - a function that * will be called when the request succeeds or fails respectively. The arguments passed into * these functions are destructured representation of the response object passed into the * `then` method. The response object has these properties: * * - **data** – `{string|Object}` – The response body transformed with the transform * functions. * - **status** – `{number}` – HTTP status code of the response. * - **headers** – `{function([headerName])}` – Header getter function. * - **config** – `{Object}` – The configuration object that was used to generate the request. * - **statusText** – `{string}` – HTTP status text of the response. * * @property {Array.<Object>} pendingRequests Array of config objects for currently pending * requests. This is primarily meant to be used for debugging purposes. * * * @example <example module="httpExample"> <file name="index.html"> <div ng-controller="FetchController"> <select ng-model="method"> <option>GET</option> <option>JSONP</option> </select> <input type="text" ng-model="url" size="80"/> <button id="fetchbtn" ng-click="fetch()">fetch</button><br> <button id="samplegetbtn" ng-click="updateModel('GET', 'http-hello.html')">Sample GET</button> <button id="samplejsonpbtn" ng-click="updateModel('JSONP', 'https://angularjs.org/greet.php?callback=JSON_CALLBACK&name=Super%20Hero')"> Sample JSONP </button> <button id="invalidjsonpbtn" ng-click="updateModel('JSONP', 'https://angularjs.org/doesntexist&callback=JSON_CALLBACK')"> Invalid JSONP </button> <pre>http status code: {{status}}</pre> <pre>http response data: {{data}}</pre> </div> </file> <file name="script.js"> angular.module('httpExample', []) .controller('FetchController', ['$scope', '$http', '$templateCache', function($scope, $http, $templateCache) { $scope.method = 'GET'; $scope.url = 'http-hello.html'; $scope.fetch = function() { $scope.code = null; $scope.response = null; $http({method: $scope.method, url: $scope.url, cache: $templateCache}). success(function(data, status) { $scope.status = status; $scope.data = data; }). error(function(data, status) { $scope.data = data || "Request failed"; $scope.status = status; }); }; $scope.updateModel = function(method, url) { $scope.method = method; $scope.url = url; }; }]); </file> <file name="http-hello.html"> Hello, $http! </file> <file name="protractor.js" type="protractor"> var status = element(by.binding('status')); var data = element(by.binding('data')); var fetchBtn = element(by.id('fetchbtn')); var sampleGetBtn = element(by.id('samplegetbtn')); var sampleJsonpBtn = element(by.id('samplejsonpbtn')); var invalidJsonpBtn = element(by.id('invalidjsonpbtn')); it('should make an xhr GET request', function() { sampleGetBtn.click(); fetchBtn.click(); expect(status.getText()).toMatch('200'); expect(data.getText()).toMatch(/Hello, \$http!/); }); // Commented out due to flakes. See https://github.com/angular/angular.js/issues/9185 // it('should make a JSONP request to angularjs.org', function() { // sampleJsonpBtn.click(); // fetchBtn.click(); // expect(status.getText()).toMatch('200'); // expect(data.getText()).toMatch(/Super Hero!/); // }); it('should make JSONP request to invalid URL and invoke the error handler', function() { invalidJsonpBtn.click(); fetchBtn.click(); expect(status.getText()).toMatch('0'); expect(data.getText()).toMatch('Request failed'); }); </file> </example> */ function $http(requestConfig) { if (!angular.isObject(requestConfig)) { throw minErr('$http')('badreq', 'Http request configuration must be an object. Received: {0}', requestConfig); } var config = extend({ method: 'get', transformRequest: defaults.transformRequest, transformResponse: defaults.transformResponse }, requestConfig); config.headers = mergeHeaders(requestConfig); config.method = uppercase(config.method); var serverRequest = function(config) { var headers = config.headers; var reqData = transformData(config.data, headersGetter(headers), undefined, config.transformRequest); // strip content-type if data is undefined if (isUndefined(reqData)) { forEach(headers, function(value, header) { if (lowercase(header) === 'content-type') { delete headers[header]; } }); } if (isUndefined(config.withCredentials) && !isUndefined(defaults.withCredentials)) { config.withCredentials = defaults.withCredentials; } // send request return sendReq(config, reqData).then(transformResponse, transformResponse); }; var chain = [serverRequest, undefined]; var promise = $q.when(config); // apply interceptors forEach(reversedInterceptors, function(interceptor) { if (interceptor.request || interceptor.requestError) { chain.unshift(interceptor.request, interceptor.requestError); } if (interceptor.response || interceptor.responseError) { chain.push(interceptor.response, interceptor.responseError); } }); while (chain.length) { var thenFn = chain.shift(); var rejectFn = chain.shift(); promise = promise.then(thenFn, rejectFn); } promise.success = function(fn) { promise.then(function(response) { fn(response.data, response.status, response.headers, config); }); return promise; }; promise.error = function(fn) { promise.then(null, function(response) { fn(response.data, response.status, response.headers, config); }); return promise; }; return promise; function transformResponse(response) { // make a copy since the response must be cacheable var resp = extend({}, response); if (!response.data) { resp.data = response.data; } else { resp.data = transformData(response.data, response.headers, response.status, config.transformResponse); } return (isSuccess(response.status)) ? resp : $q.reject(resp); } function executeHeaderFns(headers) { var headerContent, processedHeaders = {}; forEach(headers, function(headerFn, header) { if (isFunction(headerFn)) { headerContent = headerFn(); if (headerContent != null) { processedHeaders[header] = headerContent; } } else { processedHeaders[header] = headerFn; } }); return processedHeaders; } function mergeHeaders(config) { var defHeaders = defaults.headers, reqHeaders = extend({}, config.headers), defHeaderName, lowercaseDefHeaderName, reqHeaderName; defHeaders = extend({}, defHeaders.common, defHeaders[lowercase(config.method)]); // using for-in instead of forEach to avoid unecessary iteration after header has been found defaultHeadersIteration: for (defHeaderName in defHeaders) { lowercaseDefHeaderName = lowercase(defHeaderName); for (reqHeaderName in reqHeaders) { if (lowercase(reqHeaderName) === lowercaseDefHeaderName) { continue defaultHeadersIteration; } } reqHeaders[defHeaderName] = defHeaders[defHeaderName]; } // execute if header value is a function for merged headers return executeHeaderFns(reqHeaders); } } $http.pendingRequests = []; /** * @ngdoc method * @name $http#get * * @description * Shortcut method to perform `GET` request. * * @param {string} url Relative or absolute URL specifying the destination of the request * @param {Object=} config Optional configuration object * @returns {HttpPromise} Future object */ /** * @ngdoc method * @name $http#delete * * @description * Shortcut method to perform `DELETE` request. * * @param {string} url Relative or absolute URL specifying the destination of the request * @param {Object=} config Optional configuration object * @returns {HttpPromise} Future object */ /** * @ngdoc method * @name $http#head * * @description * Shortcut method to perform `HEAD` request. * * @param {string} url Relative or absolute URL specifying the destination of the request * @param {Object=} config Optional configuration object * @returns {HttpPromise} Future object */ /** * @ngdoc method * @name $http#jsonp * * @description * Shortcut method to perform `JSONP` request. * * @param {string} url Relative or absolute URL specifying the destination of the request. * The name of the callback should be the string `JSON_CALLBACK`. * @param {Object=} config Optional configuration object * @returns {HttpPromise} Future object */ createShortMethods('get', 'delete', 'head', 'jsonp'); /** * @ngdoc method * @name $http#post * * @description * Shortcut method to perform `POST` request. * * @param {string} url Relative or absolute URL specifying the destination of the request * @param {*} data Request content * @param {Object=} config Optional configuration object * @returns {HttpPromise} Future object */ /** * @ngdoc method * @name $http#put * * @description * Shortcut method to perform `PUT` request. * * @param {string} url Relative or absolute URL specifying the destination of the request * @param {*} data Request content * @param {Object=} config Optional configuration object * @returns {HttpPromise} Future object */ /** * @ngdoc method * @name $http#patch * * @description * Shortcut method to perform `PATCH` request. * * @param {string} url Relative or absolute URL specifying the destination of the request * @param {*} data Request content * @param {Object=} config Optional configuration object * @returns {HttpPromise} Future object */ createShortMethodsWithData('post', 'put', 'patch'); /** * @ngdoc property * @name $http#defaults * * @description * Runtime equivalent of the `$httpProvider.defaults` property. Allows configuration of * default headers, withCredentials as well as request and response transformations. * * See "Setting HTTP Headers" and "Transforming Requests and Responses" sections above. */ $http.defaults = defaults; return $http; function createShortMethods(names) { forEach(arguments, function(name) { $http[name] = function(url, config) { return $http(extend(config || {}, { method: name, url: url })); }; }); } function createShortMethodsWithData(name) { forEach(arguments, function(name) { $http[name] = function(url, data, config) { return $http(extend(config || {}, { method: name, url: url, data: data })); }; }); } /** * Makes the request. * * !!! ACCESSES CLOSURE VARS: * $httpBackend, defaults, $log, $rootScope, defaultCache, $http.pendingRequests */ function sendReq(config, reqData) { var deferred = $q.defer(), promise = deferred.promise, cache, cachedResp, reqHeaders = config.headers, url = buildUrl(config.url, config.params); $http.pendingRequests.push(config); promise.then(removePendingReq, removePendingReq); if ((config.cache || defaults.cache) && config.cache !== false && (config.method === 'GET' || config.method === 'JSONP')) { cache = isObject(config.cache) ? config.cache : isObject(defaults.cache) ? defaults.cache : defaultCache; } if (cache) { cachedResp = cache.get(url); if (isDefined(cachedResp)) { if (isPromiseLike(cachedResp)) { // cached request has already been sent, but there is no response yet cachedResp.then(resolvePromiseWithResult, resolvePromiseWithResult); } else { // serving from cache if (isArray(cachedResp)) { resolvePromise(cachedResp[1], cachedResp[0], shallowCopy(cachedResp[2]), cachedResp[3]); } else { resolvePromise(cachedResp, 200, {}, 'OK'); } } } else { // put the promise for the non-transformed response into cache as a placeholder cache.put(url, promise); } } // if we won't have the response in cache, set the xsrf headers and // send the request to the backend if (isUndefined(cachedResp)) { var xsrfValue = urlIsSameOrigin(config.url) ? $browser.cookies()[config.xsrfCookieName || defaults.xsrfCookieName] : undefined; if (xsrfValue) { reqHeaders[(config.xsrfHeaderName || defaults.xsrfHeaderName)] = xsrfValue; } $httpBackend(config.method, url, reqData, done, reqHeaders, config.timeout, config.withCredentials, config.responseType); } return promise; /** * Callback registered to $httpBackend(): * - caches the response if desired * - resolves the raw $http promise * - calls $apply */ function done(status, response, headersString, statusText) { if (cache) { if (isSuccess(status)) { cache.put(url, [status, response, parseHeaders(headersString), statusText]); } else { // remove promise from the cache cache.remove(url); } } function resolveHttpPromise() { resolvePromise(response, status, headersString, statusText); } if (useApplyAsync) { $rootScope.$applyAsync(resolveHttpPromise); } else { resolveHttpPromise(); if (!$rootScope.$$phase) $rootScope.$apply(); } } /** * Resolves the raw $http promise. */ function resolvePromise(response, status, headers, statusText) { // normalize internal statuses to 0 status = Math.max(status, 0); (isSuccess(status) ? deferred.resolve : deferred.reject)({ data: response, status: status, headers: headersGetter(headers), config: config, statusText: statusText }); } function resolvePromiseWithResult(result) { resolvePromise(result.data, result.status, shallowCopy(result.headers()), result.statusText); } function removePendingReq() { var idx = $http.pendingRequests.indexOf(config); if (idx !== -1) $http.pendingRequests.splice(idx, 1); } } function buildUrl(url, params) { if (!params) return url; var parts = []; forEachSorted(params, function(value, key) { if (value === null || isUndefined(value)) return; if (!isArray(value)) value = [value]; forEach(value, function(v) { if (isObject(v)) { if (isDate(v)) { v = v.toISOString(); } else { v = toJson(v); } } parts.push(encodeUriQuery(key) + '=' + encodeUriQuery(v)); }); }); if (parts.length > 0) { url += ((url.indexOf('?') == -1) ? '?' : '&') + parts.join('&'); } return url; } }]; } function createXhr() { return new window.XMLHttpRequest(); } /** * @ngdoc service * @name $httpBackend * @requires $window * @requires $document * * @description * HTTP backend used by the {@link ng.$http service} that delegates to * XMLHttpRequest object or JSONP and deals with browser incompatibilities. * * You should never need to use this service directly, instead use the higher-level abstractions: * {@link ng.$http $http} or {@link ngResource.$resource $resource}. * * During testing this implementation is swapped with {@link ngMock.$httpBackend mock * $httpBackend} which can be trained with responses. */ function $HttpBackendProvider() { this.$get = ['$browser', '$window', '$document', function($browser, $window, $document) { return createHttpBackend($browser, createXhr, $browser.defer, $window.angular.callbacks, $document[0]); }]; } function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDocument) { // TODO(vojta): fix the signature return function(method, url, post, callback, headers, timeout, withCredentials, responseType) { $browser.$$incOutstandingRequestCount(); url = url || $browser.url(); if (lowercase(method) == 'jsonp') { var callbackId = '_' + (callbacks.counter++).toString(36); callbacks[callbackId] = function(data) { callbacks[callbackId].data = data; callbacks[callbackId].called = true; }; var jsonpDone = jsonpReq(url.replace('JSON_CALLBACK', 'angular.callbacks.' + callbackId), callbackId, function(status, text) { completeRequest(callback, status, callbacks[callbackId].data, "", text); callbacks[callbackId] = noop; }); } else { var xhr = createXhr(); xhr.open(method, url, true); forEach(headers, function(value, key) { if (isDefined(value)) { xhr.setRequestHeader(key, value); } }); xhr.onload = function requestLoaded() { var statusText = xhr.statusText || ''; // responseText is the old-school way of retrieving response (supported by IE8 & 9) // response/responseType properties were introduced in XHR Level2 spec (supported by IE10) var response = ('response' in xhr) ? xhr.response : xhr.responseText; // normalize IE9 bug (http://bugs.jquery.com/ticket/1450) var status = xhr.status === 1223 ? 204 : xhr.status; // fix status code when it is 0 (0 status is undocumented). // Occurs when accessing file resources or on Android 4.1 stock browser // while retrieving files from application cache. if (status === 0) { status = response ? 200 : urlResolve(url).protocol == 'file' ? 404 : 0; } completeRequest(callback, status, response, xhr.getAllResponseHeaders(), statusText); }; var requestError = function() { // The response is always empty // See https://xhr.spec.whatwg.org/#request-error-steps and https://fetch.spec.whatwg.org/#concept-network-error completeRequest(callback, -1, null, null, ''); }; xhr.onerror = requestError; xhr.onabort = requestError; if (withCredentials) { xhr.withCredentials = true; } if (responseType) { try { xhr.responseType = responseType; } catch (e) { // WebKit added support for the json responseType value on 09/03/2013 // https://bugs.webkit.org/show_bug.cgi?id=73648. Versions of Safari prior to 7 are // known to throw when setting the value "json" as the response type. Other older // browsers implementing the responseType // // The json response type can be ignored if not supported, because JSON payloads are // parsed on the client-side regardless. if (responseType !== 'json') { throw e; } } } xhr.send(post || null); } if (timeout > 0) { var timeoutId = $browserDefer(timeoutRequest, timeout); } else if (isPromiseLike(timeout)) { timeout.then(timeoutRequest); } function timeoutRequest() { jsonpDone && jsonpDone(); xhr && xhr.abort(); } function completeRequest(callback, status, response, headersString, statusText) { // cancel timeout and subsequent timeout promise resolution if (timeoutId !== undefined) { $browserDefer.cancel(timeoutId); } jsonpDone = xhr = null; callback(status, response, headersString, statusText); $browser.$$completeOutstandingRequest(noop); } }; function jsonpReq(url, callbackId, done) { // we can't use jQuery/jqLite here because jQuery does crazy shit with script elements, e.g.: // - fetches local scripts via XHR and evals them // - adds and immediately removes script elements from the document var script = rawDocument.createElement('script'), callback = null; script.type = "text/javascript"; script.src = url; script.async = true; callback = function(event) { removeEventListenerFn(script, "load", callback); removeEventListenerFn(script, "error", callback); rawDocument.body.removeChild(script); script = null; var status = -1; var text = "unknown"; if (event) { if (event.type === "load" && !callbacks[callbackId].called) { event = { type: "error" }; } text = event.type; status = event.type === "error" ? 404 : 200; } if (done) { done(status, text); } }; addEventListenerFn(script, "load", callback); addEventListenerFn(script, "error", callback); rawDocument.body.appendChild(script); return callback; } } var $interpolateMinErr = minErr('$interpolate'); /** * @ngdoc provider * @name $interpolateProvider * * @description * * Used for configuring the interpolation markup. Defaults to `{{` and `}}`. * * @example <example module="customInterpolationApp"> <file name="index.html"> <script> var customInterpolationApp = angular.module('customInterpolationApp', []); customInterpolationApp.config(function($interpolateProvider) { $interpolateProvider.startSymbol('//'); $interpolateProvider.endSymbol('//'); }); customInterpolationApp.controller('DemoController', function() { this.label = "This binding is brought you by // interpolation symbols."; }); </script> <div ng-app="App" ng-controller="DemoController as demo"> //demo.label// </div> </file> <file name="protractor.js" type="protractor"> it('should interpolate binding with custom symbols', function() { expect(element(by.binding('demo.label')).getText()).toBe('This binding is brought you by // interpolation symbols.'); }); </file> </example> */ function $InterpolateProvider() { var startSymbol = '{{'; var endSymbol = '}}'; /** * @ngdoc method * @name $interpolateProvider#startSymbol * @description * Symbol to denote start of expression in the interpolated string. Defaults to `{{`. * * @param {string=} value new value to set the starting symbol to. * @returns {string|self} Returns the symbol when used as getter and self if used as setter. */ this.startSymbol = function(value) { if (value) { startSymbol = value; return this; } else { return startSymbol; } }; /** * @ngdoc method * @name $interpolateProvider#endSymbol * @description * Symbol to denote the end of expression in the interpolated string. Defaults to `}}`. * * @param {string=} value new value to set the ending symbol to. * @returns {string|self} Returns the symbol when used as getter and self if used as setter. */ this.endSymbol = function(value) { if (value) { endSymbol = value; return this; } else { return endSymbol; } }; this.$get = ['$parse', '$exceptionHandler', '$sce', function($parse, $exceptionHandler, $sce) { var startSymbolLength = startSymbol.length, endSymbolLength = endSymbol.length, escapedStartRegexp = new RegExp(startSymbol.replace(/./g, escape), 'g'), escapedEndRegexp = new RegExp(endSymbol.replace(/./g, escape), 'g'); function escape(ch) { return '\\\\\\' + ch; } /** * @ngdoc service * @name $interpolate * @kind function * * @requires $parse * @requires $sce * * @description * * Compiles a string with markup into an interpolation function. This service is used by the * HTML {@link ng.$compile $compile} service for data binding. See * {@link ng.$interpolateProvider $interpolateProvider} for configuring the * interpolation markup. * * * ```js * var $interpolate = ...; // injected * var exp = $interpolate('Hello {{name | uppercase}}!'); * expect(exp({name:'Angular'}).toEqual('Hello ANGULAR!'); * ``` * * `$interpolate` takes an optional fourth argument, `allOrNothing`. If `allOrNothing` is * `true`, the interpolation function will return `undefined` unless all embedded expressions * evaluate to a value other than `undefined`. * * ```js * var $interpolate = ...; // injected * var context = {greeting: 'Hello', name: undefined }; * * // default "forgiving" mode * var exp = $interpolate('{{greeting}} {{name}}!'); * expect(exp(context)).toEqual('Hello !'); * * // "allOrNothing" mode * exp = $interpolate('{{greeting}} {{name}}!', false, null, true); * expect(exp(context)).toBeUndefined(); * context.name = 'Angular'; * expect(exp(context)).toEqual('Hello Angular!'); * ``` * * `allOrNothing` is useful for interpolating URLs. `ngSrc` and `ngSrcset` use this behavior. * * ####Escaped Interpolation * $interpolate provides a mechanism for escaping interpolation markers. Start and end markers * can be escaped by preceding each of their characters with a REVERSE SOLIDUS U+005C (backslash). * It will be rendered as a regular start/end marker, and will not be interpreted as an expression * or binding. * * This enables web-servers to prevent script injection attacks and defacing attacks, to some * degree, while also enabling code examples to work without relying on the * {@link ng.directive:ngNonBindable ngNonBindable} directive. * * **For security purposes, it is strongly encouraged that web servers escape user-supplied data, * replacing angle brackets (&lt;, &gt;) with &amp;lt; and &amp;gt; respectively, and replacing all * interpolation start/end markers with their escaped counterparts.** * * Escaped interpolation markers are only replaced with the actual interpolation markers in rendered * output when the $interpolate service processes the text. So, for HTML elements interpolated * by {@link ng.$compile $compile}, or otherwise interpolated with the `mustHaveExpression` parameter * set to `true`, the interpolated text must contain an unescaped interpolation expression. As such, * this is typically useful only when user-data is used in rendering a template from the server, or * when otherwise untrusted data is used by a directive. * * <example> * <file name="index.html"> * <div ng-init="username='A user'"> * <p ng-init="apptitle='Escaping demo'">{{apptitle}}: \{\{ username = "defaced value"; \}\} * </p> * <p><strong>{{username}}</strong> attempts to inject code which will deface the * application, but fails to accomplish their task, because the server has correctly * escaped the interpolation start/end markers with REVERSE SOLIDUS U+005C (backslash) * characters.</p> * <p>Instead, the result of the attempted script injection is visible, and can be removed * from the database by an administrator.</p> * </div> * </file> * </example> * * @param {string} text The text with markup to interpolate. * @param {boolean=} mustHaveExpression if set to true then the interpolation string must have * embedded expression in order to return an interpolation function. Strings with no * embedded expression will return null for the interpolation function. * @param {string=} trustedContext when provided, the returned function passes the interpolated * result through {@link ng.$sce#getTrusted $sce.getTrusted(interpolatedResult, * trustedContext)} before returning it. Refer to the {@link ng.$sce $sce} service that * provides Strict Contextual Escaping for details. * @param {boolean=} allOrNothing if `true`, then the returned function returns undefined * unless all embedded expressions evaluate to a value other than `undefined`. * @returns {function(context)} an interpolation function which is used to compute the * interpolated string. The function has these parameters: * * - `context`: evaluation context for all expressions embedded in the interpolated text */ function $interpolate(text, mustHaveExpression, trustedContext, allOrNothing) { allOrNothing = !!allOrNothing; var startIndex, endIndex, index = 0, expressions = [], parseFns = [], textLength = text.length, exp, concat = [], expressionPositions = []; while (index < textLength) { if (((startIndex = text.indexOf(startSymbol, index)) != -1) && ((endIndex = text.indexOf(endSymbol, startIndex + startSymbolLength)) != -1)) { if (index !== startIndex) { concat.push(unescapeText(text.substring(index, startIndex))); } exp = text.substring(startIndex + startSymbolLength, endIndex); expressions.push(exp); parseFns.push($parse(exp, parseStringifyInterceptor)); index = endIndex + endSymbolLength; expressionPositions.push(concat.length); concat.push(''); } else { // we did not find an interpolation, so we have to add the remainder to the separators array if (index !== textLength) { concat.push(unescapeText(text.substring(index))); } break; } } // Concatenating expressions makes it hard to reason about whether some combination of // concatenated values are unsafe to use and could easily lead to XSS. By requiring that a // single expression be used for iframe[src], object[src], etc., we ensure that the value // that's used is assigned or constructed by some JS code somewhere that is more testable or // make it obvious that you bound the value to some user controlled value. This helps reduce // the load when auditing for XSS issues. if (trustedContext && concat.length > 1) { throw $interpolateMinErr('noconcat', "Error while interpolating: {0}\nStrict Contextual Escaping disallows " + "interpolations that concatenate multiple expressions when a trusted value is " + "required. See http://docs.angularjs.org/api/ng.$sce", text); } if (!mustHaveExpression || expressions.length) { var compute = function(values) { for (var i = 0, ii = expressions.length; i < ii; i++) { if (allOrNothing && isUndefined(values[i])) return; concat[expressionPositions[i]] = values[i]; } return concat.join(''); }; var getValue = function(value) { return trustedContext ? $sce.getTrusted(trustedContext, value) : $sce.valueOf(value); }; var stringify = function(value) { if (value == null) { // null || undefined return ''; } switch (typeof value) { case 'string': break; case 'number': value = '' + value; break; default: value = toJson(value); } return value; }; return extend(function interpolationFn(context) { var i = 0; var ii = expressions.length; var values = new Array(ii); try { for (; i < ii; i++) { values[i] = parseFns[i](context); } return compute(values); } catch (err) { var newErr = $interpolateMinErr('interr', "Can't interpolate: {0}\n{1}", text, err.toString()); $exceptionHandler(newErr); } }, { // all of these properties are undocumented for now exp: text, //just for compatibility with regular watchers created via $watch expressions: expressions, $$watchDelegate: function(scope, listener, objectEquality) { var lastValue; return scope.$watchGroup(parseFns, function interpolateFnWatcher(values, oldValues) { var currValue = compute(values); if (isFunction(listener)) { listener.call(this, currValue, values !== oldValues ? lastValue : currValue, scope); } lastValue = currValue; }, objectEquality); } }); } function unescapeText(text) { return text.replace(escapedStartRegexp, startSymbol). replace(escapedEndRegexp, endSymbol); } function parseStringifyInterceptor(value) { try { value = getValue(value); return allOrNothing && !isDefined(value) ? value : stringify(value); } catch (err) { var newErr = $interpolateMinErr('interr', "Can't interpolate: {0}\n{1}", text, err.toString()); $exceptionHandler(newErr); } } } /** * @ngdoc method * @name $interpolate#startSymbol * @description * Symbol to denote the start of expression in the interpolated string. Defaults to `{{`. * * Use {@link ng.$interpolateProvider#startSymbol `$interpolateProvider.startSymbol`} to change * the symbol. * * @returns {string} start symbol. */ $interpolate.startSymbol = function() { return startSymbol; }; /** * @ngdoc method * @name $interpolate#endSymbol * @description * Symbol to denote the end of expression in the interpolated string. Defaults to `}}`. * * Use {@link ng.$interpolateProvider#endSymbol `$interpolateProvider.endSymbol`} to change * the symbol. * * @returns {string} end symbol. */ $interpolate.endSymbol = function() { return endSymbol; }; return $interpolate; }]; } function $IntervalProvider() { this.$get = ['$rootScope', '$window', '$q', '$$q', function($rootScope, $window, $q, $$q) { var intervals = {}; /** * @ngdoc service * @name $interval * * @description * Angular's wrapper for `window.setInterval`. The `fn` function is executed every `delay` * milliseconds. * * The return value of registering an interval function is a promise. This promise will be * notified upon each tick of the interval, and will be resolved after `count` iterations, or * run indefinitely if `count` is not defined. The value of the notification will be the * number of iterations that have run. * To cancel an interval, call `$interval.cancel(promise)`. * * In tests you can use {@link ngMock.$interval#flush `$interval.flush(millis)`} to * move forward by `millis` milliseconds and trigger any functions scheduled to run in that * time. * * <div class="alert alert-warning"> * **Note**: Intervals created by this service must be explicitly destroyed when you are finished * with them. In particular they are not automatically destroyed when a controller's scope or a * directive's element are destroyed. * You should take this into consideration and make sure to always cancel the interval at the * appropriate moment. See the example below for more details on how and when to do this. * </div> * * @param {function()} fn A function that should be called repeatedly. * @param {number} delay Number of milliseconds between each function call. * @param {number=} [count=0] Number of times to repeat. If not set, or 0, will repeat * indefinitely. * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise * will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block. * @returns {promise} A promise which will be notified on each iteration. * * @example * <example module="intervalExample"> * <file name="index.html"> * <script> * angular.module('intervalExample', []) * .controller('ExampleController', ['$scope', '$interval', * function($scope, $interval) { * $scope.format = 'M/d/yy h:mm:ss a'; * $scope.blood_1 = 100; * $scope.blood_2 = 120; * * var stop; * $scope.fight = function() { * // Don't start a new fight if we are already fighting * if ( angular.isDefined(stop) ) return; * * stop = $interval(function() { * if ($scope.blood_1 > 0 && $scope.blood_2 > 0) { * $scope.blood_1 = $scope.blood_1 - 3; * $scope.blood_2 = $scope.blood_2 - 4; * } else { * $scope.stopFight(); * } * }, 100); * }; * * $scope.stopFight = function() { * if (angular.isDefined(stop)) { * $interval.cancel(stop); * stop = undefined; * } * }; * * $scope.resetFight = function() { * $scope.blood_1 = 100; * $scope.blood_2 = 120; * }; * * $scope.$on('$destroy', function() { * // Make sure that the interval is destroyed too * $scope.stopFight(); * }); * }]) * // Register the 'myCurrentTime' directive factory method. * // We inject $interval and dateFilter service since the factory method is DI. * .directive('myCurrentTime', ['$interval', 'dateFilter', * function($interval, dateFilter) { * // return the directive link function. (compile function not needed) * return function(scope, element, attrs) { * var format, // date format * stopTime; // so that we can cancel the time updates * * // used to update the UI * function updateTime() { * element.text(dateFilter(new Date(), format)); * } * * // watch the expression, and update the UI on change. * scope.$watch(attrs.myCurrentTime, function(value) { * format = value; * updateTime(); * }); * * stopTime = $interval(updateTime, 1000); * * // listen on DOM destroy (removal) event, and cancel the next UI update * // to prevent updating time after the DOM element was removed. * element.on('$destroy', function() { * $interval.cancel(stopTime); * }); * } * }]); * </script> * * <div> * <div ng-controller="ExampleController"> * Date format: <input ng-model="format"> <hr/> * Current time is: <span my-current-time="format"></span> * <hr/> * Blood 1 : <font color='red'>{{blood_1}}</font> * Blood 2 : <font color='red'>{{blood_2}}</font> * <button type="button" data-ng-click="fight()">Fight</button> * <button type="button" data-ng-click="stopFight()">StopFight</button> * <button type="button" data-ng-click="resetFight()">resetFight</button> * </div> * </div> * * </file> * </example> */ function interval(fn, delay, count, invokeApply) { var setInterval = $window.setInterval, clearInterval = $window.clearInterval, iteration = 0, skipApply = (isDefined(invokeApply) && !invokeApply), deferred = (skipApply ? $$q : $q).defer(), promise = deferred.promise; count = isDefined(count) ? count : 0; promise.then(null, null, fn); promise.$$intervalId = setInterval(function tick() { deferred.notify(iteration++); if (count > 0 && iteration >= count) { deferred.resolve(iteration); clearInterval(promise.$$intervalId); delete intervals[promise.$$intervalId]; } if (!skipApply) $rootScope.$apply(); }, delay); intervals[promise.$$intervalId] = deferred; return promise; } /** * @ngdoc method * @name $interval#cancel * * @description * Cancels a task associated with the `promise`. * * @param {promise} promise returned by the `$interval` function. * @returns {boolean} Returns `true` if the task was successfully canceled. */ interval.cancel = function(promise) { if (promise && promise.$$intervalId in intervals) { intervals[promise.$$intervalId].reject('canceled'); $window.clearInterval(promise.$$intervalId); delete intervals[promise.$$intervalId]; return true; } return false; }; return interval; }]; } /** * @ngdoc service * @name $locale * * @description * $locale service provides localization rules for various Angular components. As of right now the * only public api is: * * * `id` – `{string}` – locale id formatted as `languageId-countryId` (e.g. `en-us`) */ function $LocaleProvider() { this.$get = function() { return { id: 'en-us', NUMBER_FORMATS: { DECIMAL_SEP: '.', GROUP_SEP: ',', PATTERNS: [ { // Decimal Pattern minInt: 1, minFrac: 0, maxFrac: 3, posPre: '', posSuf: '', negPre: '-', negSuf: '', gSize: 3, lgSize: 3 },{ //Currency Pattern minInt: 1, minFrac: 2, maxFrac: 2, posPre: '\u00A4', posSuf: '', negPre: '(\u00A4', negSuf: ')', gSize: 3, lgSize: 3 } ], CURRENCY_SYM: '$' }, DATETIME_FORMATS: { MONTH: 'January,February,March,April,May,June,July,August,September,October,November,December' .split(','), SHORTMONTH: 'Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec'.split(','), DAY: 'Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday'.split(','), SHORTDAY: 'Sun,Mon,Tue,Wed,Thu,Fri,Sat'.split(','), AMPMS: ['AM','PM'], medium: 'MMM d, y h:mm:ss a', 'short': 'M/d/yy h:mm a', fullDate: 'EEEE, MMMM d, y', longDate: 'MMMM d, y', mediumDate: 'MMM d, y', shortDate: 'M/d/yy', mediumTime: 'h:mm:ss a', shortTime: 'h:mm a' }, pluralCat: function(num) { if (num === 1) { return 'one'; } return 'other'; } }; }; } var PATH_MATCH = /^([^\?#]*)(\?([^#]*))?(#(.*))?$/, DEFAULT_PORTS = {'http': 80, 'https': 443, 'ftp': 21}; var $locationMinErr = minErr('$location'); /** * Encode path using encodeUriSegment, ignoring forward slashes * * @param {string} path Path to encode * @returns {string} */ function encodePath(path) { var segments = path.split('/'), i = segments.length; while (i--) { segments[i] = encodeUriSegment(segments[i]); } return segments.join('/'); } function parseAbsoluteUrl(absoluteUrl, locationObj) { var parsedUrl = urlResolve(absoluteUrl); locationObj.$$protocol = parsedUrl.protocol; locationObj.$$host = parsedUrl.hostname; locationObj.$$port = int(parsedUrl.port) || DEFAULT_PORTS[parsedUrl.protocol] || null; } function parseAppUrl(relativeUrl, locationObj) { var prefixed = (relativeUrl.charAt(0) !== '/'); if (prefixed) { relativeUrl = '/' + relativeUrl; } var match = urlResolve(relativeUrl); locationObj.$$path = decodeURIComponent(prefixed && match.pathname.charAt(0) === '/' ? match.pathname.substring(1) : match.pathname); locationObj.$$search = parseKeyValue(match.search); locationObj.$$hash = decodeURIComponent(match.hash); // make sure path starts with '/'; if (locationObj.$$path && locationObj.$$path.charAt(0) != '/') { locationObj.$$path = '/' + locationObj.$$path; } } /** * * @param {string} begin * @param {string} whole * @returns {string} returns text from whole after begin or undefined if it does not begin with * expected string. */ function beginsWith(begin, whole) { if (whole.indexOf(begin) === 0) { return whole.substr(begin.length); } } function stripHash(url) { var index = url.indexOf('#'); return index == -1 ? url : url.substr(0, index); } function trimEmptyHash(url) { return url.replace(/(#.+)|#$/, '$1'); } function stripFile(url) { return url.substr(0, stripHash(url).lastIndexOf('/') + 1); } /* return the server only (scheme://host:port) */ function serverBase(url) { return url.substring(0, url.indexOf('/', url.indexOf('//') + 2)); } /** * LocationHtml5Url represents an url * This object is exposed as $location service when HTML5 mode is enabled and supported * * @constructor * @param {string} appBase application base URL * @param {string} basePrefix url path prefix */ function LocationHtml5Url(appBase, basePrefix) { this.$$html5 = true; basePrefix = basePrefix || ''; var appBaseNoFile = stripFile(appBase); parseAbsoluteUrl(appBase, this); /** * Parse given html5 (regular) url string into properties * @param {string} url HTML5 url * @private */ this.$$parse = function(url) { var pathUrl = beginsWith(appBaseNoFile, url); if (!isString(pathUrl)) { throw $locationMinErr('ipthprfx', 'Invalid url "{0}", missing path prefix "{1}".', url, appBaseNoFile); } parseAppUrl(pathUrl, this); if (!this.$$path) { this.$$path = '/'; } this.$$compose(); }; /** * Compose url and update `absUrl` property * @private */ this.$$compose = function() { var search = toKeyValue(this.$$search), hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : ''; this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash; this.$$absUrl = appBaseNoFile + this.$$url.substr(1); // first char is always '/' }; this.$$parseLinkUrl = function(url, relHref) { if (relHref && relHref[0] === '#') { // special case for links to hash fragments: // keep the old url and only replace the hash fragment this.hash(relHref.slice(1)); return true; } var appUrl, prevAppUrl; var rewrittenUrl; if ((appUrl = beginsWith(appBase, url)) !== undefined) { prevAppUrl = appUrl; if ((appUrl = beginsWith(basePrefix, appUrl)) !== undefined) { rewrittenUrl = appBaseNoFile + (beginsWith('/', appUrl) || appUrl); } else { rewrittenUrl = appBase + prevAppUrl; } } else if ((appUrl = beginsWith(appBaseNoFile, url)) !== undefined) { rewrittenUrl = appBaseNoFile + appUrl; } else if (appBaseNoFile == url + '/') { rewrittenUrl = appBaseNoFile; } if (rewrittenUrl) { this.$$parse(rewrittenUrl); } return !!rewrittenUrl; }; } /** * LocationHashbangUrl represents url * This object is exposed as $location service when developer doesn't opt into html5 mode. * It also serves as the base class for html5 mode fallback on legacy browsers. * * @constructor * @param {string} appBase application base URL * @param {string} hashPrefix hashbang prefix */ function LocationHashbangUrl(appBase, hashPrefix) { var appBaseNoFile = stripFile(appBase); parseAbsoluteUrl(appBase, this); /** * Parse given hashbang url into properties * @param {string} url Hashbang url * @private */ this.$$parse = function(url) { var withoutBaseUrl = beginsWith(appBase, url) || beginsWith(appBaseNoFile, url); var withoutHashUrl; if (withoutBaseUrl.charAt(0) === '#') { // The rest of the url starts with a hash so we have // got either a hashbang path or a plain hash fragment withoutHashUrl = beginsWith(hashPrefix, withoutBaseUrl); if (isUndefined(withoutHashUrl)) { // There was no hashbang prefix so we just have a hash fragment withoutHashUrl = withoutBaseUrl; } } else { // There was no hashbang path nor hash fragment: // If we are in HTML5 mode we use what is left as the path; // Otherwise we ignore what is left withoutHashUrl = this.$$html5 ? withoutBaseUrl : ''; } parseAppUrl(withoutHashUrl, this); this.$$path = removeWindowsDriveName(this.$$path, withoutHashUrl, appBase); this.$$compose(); /* * In Windows, on an anchor node on documents loaded from * the filesystem, the browser will return a pathname * prefixed with the drive name ('/C:/path') when a * pathname without a drive is set: * * a.setAttribute('href', '/foo') * * a.pathname === '/C:/foo' //true * * Inside of Angular, we're always using pathnames that * do not include drive names for routing. */ function removeWindowsDriveName(path, url, base) { /* Matches paths for file protocol on windows, such as /C:/foo/bar, and captures only /foo/bar. */ var windowsFilePathExp = /^\/[A-Z]:(\/.*)/; var firstPathSegmentMatch; //Get the relative path from the input URL. if (url.indexOf(base) === 0) { url = url.replace(base, ''); } // The input URL intentionally contains a first path segment that ends with a colon. if (windowsFilePathExp.exec(url)) { return path; } firstPathSegmentMatch = windowsFilePathExp.exec(path); return firstPathSegmentMatch ? firstPathSegmentMatch[1] : path; } }; /** * Compose hashbang url and update `absUrl` property * @private */ this.$$compose = function() { var search = toKeyValue(this.$$search), hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : ''; this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash; this.$$absUrl = appBase + (this.$$url ? hashPrefix + this.$$url : ''); }; this.$$parseLinkUrl = function(url, relHref) { if (stripHash(appBase) == stripHash(url)) { this.$$parse(url); return true; } return false; }; } /** * LocationHashbangUrl represents url * This object is exposed as $location service when html5 history api is enabled but the browser * does not support it. * * @constructor * @param {string} appBase application base URL * @param {string} hashPrefix hashbang prefix */ function LocationHashbangInHtml5Url(appBase, hashPrefix) { this.$$html5 = true; LocationHashbangUrl.apply(this, arguments); var appBaseNoFile = stripFile(appBase); this.$$parseLinkUrl = function(url, relHref) { if (relHref && relHref[0] === '#') { // special case for links to hash fragments: // keep the old url and only replace the hash fragment this.hash(relHref.slice(1)); return true; } var rewrittenUrl; var appUrl; if (appBase == stripHash(url)) { rewrittenUrl = url; } else if ((appUrl = beginsWith(appBaseNoFile, url))) { rewrittenUrl = appBase + hashPrefix + appUrl; } else if (appBaseNoFile === url + '/') { rewrittenUrl = appBaseNoFile; } if (rewrittenUrl) { this.$$parse(rewrittenUrl); } return !!rewrittenUrl; }; this.$$compose = function() { var search = toKeyValue(this.$$search), hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : ''; this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash; // include hashPrefix in $$absUrl when $$url is empty so IE8 & 9 do not reload page because of removal of '#' this.$$absUrl = appBase + hashPrefix + this.$$url; }; } var locationPrototype = { /** * Are we in html5 mode? * @private */ $$html5: false, /** * Has any change been replacing? * @private */ $$replace: false, /** * @ngdoc method * @name $location#absUrl * * @description * This method is getter only. * * Return full url representation with all segments encoded according to rules specified in * [RFC 3986](http://www.ietf.org/rfc/rfc3986.txt). * * * ```js * // given url http://example.com/#/some/path?foo=bar&baz=xoxo * var absUrl = $location.absUrl(); * // => "http://example.com/#/some/path?foo=bar&baz=xoxo" * ``` * * @return {string} full url */ absUrl: locationGetter('$$absUrl'), /** * @ngdoc method * @name $location#url * * @description * This method is getter / setter. * * Return url (e.g. `/path?a=b#hash`) when called without any parameter. * * Change path, search and hash, when called with parameter and return `$location`. * * * ```js * // given url http://example.com/#/some/path?foo=bar&baz=xoxo * var url = $location.url(); * // => "/some/path?foo=bar&baz=xoxo" * ``` * * @param {string=} url New url without base prefix (e.g. `/path?a=b#hash`) * @return {string} url */ url: function(url) { if (isUndefined(url)) return this.$$url; var match = PATH_MATCH.exec(url); if (match[1] || url === '') this.path(decodeURIComponent(match[1])); if (match[2] || match[1] || url === '') this.search(match[3] || ''); this.hash(match[5] || ''); return this; }, /** * @ngdoc method * @name $location#protocol * * @description * This method is getter only. * * Return protocol of current url. * * * ```js * // given url http://example.com/#/some/path?foo=bar&baz=xoxo * var protocol = $location.protocol(); * // => "http" * ``` * * @return {string} protocol of current url */ protocol: locationGetter('$$protocol'), /** * @ngdoc method * @name $location#host * * @description * This method is getter only. * * Return host of current url. * * * ```js * // given url http://example.com/#/some/path?foo=bar&baz=xoxo * var host = $location.host(); * // => "example.com" * ``` * * @return {string} host of current url. */ host: locationGetter('$$host'), /** * @ngdoc method * @name $location#port * * @description * This method is getter only. * * Return port of current url. * * * ```js * // given url http://example.com/#/some/path?foo=bar&baz=xoxo * var port = $location.port(); * // => 80 * ``` * * @return {Number} port */ port: locationGetter('$$port'), /** * @ngdoc method * @name $location#path * * @description * This method is getter / setter. * * Return path of current url when called without any parameter. * * Change path when called with parameter and return `$location`. * * Note: Path should always begin with forward slash (/), this method will add the forward slash * if it is missing. * * * ```js * // given url http://example.com/#/some/path?foo=bar&baz=xoxo * var path = $location.path(); * // => "/some/path" * ``` * * @param {(string|number)=} path New path * @return {string} path */ path: locationGetterSetter('$$path', function(path) { path = path !== null ? path.toString() : ''; return path.charAt(0) == '/' ? path : '/' + path; }), /** * @ngdoc method * @name $location#search * * @description * This method is getter / setter. * * Return search part (as object) of current url when called without any parameter. * * Change search part when called with parameter and return `$location`. * * * ```js * // given url http://example.com/#/some/path?foo=bar&baz=xoxo * var searchObject = $location.search(); * // => {foo: 'bar', baz: 'xoxo'} * * // set foo to 'yipee' * $location.search('foo', 'yipee'); * // $location.search() => {foo: 'yipee', baz: 'xoxo'} * ``` * * @param {string|Object.<string>|Object.<Array.<string>>} search New search params - string or * hash object. * * When called with a single argument the method acts as a setter, setting the `search` component * of `$location` to the specified value. * * If the argument is a hash object containing an array of values, these values will be encoded * as duplicate search parameters in the url. * * @param {(string|Number|Array<string>|boolean)=} paramValue If `search` is a string or number, then `paramValue` * will override only a single search property. * * If `paramValue` is an array, it will override the property of the `search` component of * `$location` specified via the first argument. * * If `paramValue` is `null`, the property specified via the first argument will be deleted. * * If `paramValue` is `true`, the property specified via the first argument will be added with no * value nor trailing equal sign. * * @return {Object} If called with no arguments returns the parsed `search` object. If called with * one or more arguments returns `$location` object itself. */ search: function(search, paramValue) { switch (arguments.length) { case 0: return this.$$search; case 1: if (isString(search) || isNumber(search)) { search = search.toString(); this.$$search = parseKeyValue(search); } else if (isObject(search)) { search = copy(search, {}); // remove object undefined or null properties forEach(search, function(value, key) { if (value == null) delete search[key]; }); this.$$search = search; } else { throw $locationMinErr('isrcharg', 'The first argument of the `$location#search()` call must be a string or an object.'); } break; default: if (isUndefined(paramValue) || paramValue === null) { delete this.$$search[search]; } else { this.$$search[search] = paramValue; } } this.$$compose(); return this; }, /** * @ngdoc method * @name $location#hash * * @description * This method is getter / setter. * * Return hash fragment when called without any parameter. * * Change hash fragment when called with parameter and return `$location`. * * * ```js * // given url http://example.com/#/some/path?foo=bar&baz=xoxo#hashValue * var hash = $location.hash(); * // => "hashValue" * ``` * * @param {(string|number)=} hash New hash fragment * @return {string} hash */ hash: locationGetterSetter('$$hash', function(hash) { return hash !== null ? hash.toString() : ''; }), /** * @ngdoc method * @name $location#replace * * @description * If called, all changes to $location during current `$digest` will be replacing current history * record, instead of adding new one. */ replace: function() { this.$$replace = true; return this; } }; forEach([LocationHashbangInHtml5Url, LocationHashbangUrl, LocationHtml5Url], function(Location) { Location.prototype = Object.create(locationPrototype); /** * @ngdoc method * @name $location#state * * @description * This method is getter / setter. * * Return the history state object when called without any parameter. * * Change the history state object when called with one parameter and return `$location`. * The state object is later passed to `pushState` or `replaceState`. * * NOTE: This method is supported only in HTML5 mode and only in browsers supporting * the HTML5 History API (i.e. methods `pushState` and `replaceState`). If you need to support * older browsers (like IE9 or Android < 4.0), don't use this method. * * @param {object=} state State object for pushState or replaceState * @return {object} state */ Location.prototype.state = function(state) { if (!arguments.length) return this.$$state; if (Location !== LocationHtml5Url || !this.$$html5) { throw $locationMinErr('nostate', 'History API state support is available only ' + 'in HTML5 mode and only in browsers supporting HTML5 History API'); } // The user might modify `stateObject` after invoking `$location.state(stateObject)` // but we're changing the $$state reference to $browser.state() during the $digest // so the modification window is narrow. this.$$state = isUndefined(state) ? null : state; return this; }; }); function locationGetter(property) { return function() { return this[property]; }; } function locationGetterSetter(property, preprocess) { return function(value) { if (isUndefined(value)) return this[property]; this[property] = preprocess(value); this.$$compose(); return this; }; } /** * @ngdoc service * @name $location * * @requires $rootElement * * @description * The $location service parses the URL in the browser address bar (based on the * [window.location](https://developer.mozilla.org/en/window.location)) and makes the URL * available to your application. Changes to the URL in the address bar are reflected into * $location service and changes to $location are reflected into the browser address bar. * * **The $location service:** * * - Exposes the current URL in the browser address bar, so you can * - Watch and observe the URL. * - Change the URL. * - Synchronizes the URL with the browser when the user * - Changes the address bar. * - Clicks the back or forward button (or clicks a History link). * - Clicks on a link. * - Represents the URL object as a set of methods (protocol, host, port, path, search, hash). * * For more information see {@link guide/$location Developer Guide: Using $location} */ /** * @ngdoc provider * @name $locationProvider * @description * Use the `$locationProvider` to configure how the application deep linking paths are stored. */ function $LocationProvider() { var hashPrefix = '', html5Mode = { enabled: false, requireBase: true, rewriteLinks: true }; /** * @ngdoc method * @name $locationProvider#hashPrefix * @description * @param {string=} prefix Prefix for hash part (containing path and search) * @returns {*} current value if used as getter or itself (chaining) if used as setter */ this.hashPrefix = function(prefix) { if (isDefined(prefix)) { hashPrefix = prefix; return this; } else { return hashPrefix; } }; /** * @ngdoc method * @name $locationProvider#html5Mode * @description * @param {(boolean|Object)=} mode If boolean, sets `html5Mode.enabled` to value. * If object, sets `enabled`, `requireBase` and `rewriteLinks` to respective values. Supported * properties: * - **enabled** – `{boolean}` – (default: false) If true, will rely on `history.pushState` to * change urls where supported. Will fall back to hash-prefixed paths in browsers that do not * support `pushState`. * - **requireBase** - `{boolean}` - (default: `true`) When html5Mode is enabled, specifies * whether or not a <base> tag is required to be present. If `enabled` and `requireBase` are * true, and a base tag is not present, an error will be thrown when `$location` is injected. * See the {@link guide/$location $location guide for more information} * - **rewriteLinks** - `{boolean}` - (default: `true`) When html5Mode is enabled, * enables/disables url rewriting for relative links. * * @returns {Object} html5Mode object if used as getter or itself (chaining) if used as setter */ this.html5Mode = function(mode) { if (isBoolean(mode)) { html5Mode.enabled = mode; return this; } else if (isObject(mode)) { if (isBoolean(mode.enabled)) { html5Mode.enabled = mode.enabled; } if (isBoolean(mode.requireBase)) { html5Mode.requireBase = mode.requireBase; } if (isBoolean(mode.rewriteLinks)) { html5Mode.rewriteLinks = mode.rewriteLinks; } return this; } else { return html5Mode; } }; /** * @ngdoc event * @name $location#$locationChangeStart * @eventType broadcast on root scope * @description * Broadcasted before a URL will change. * * This change can be prevented by calling * `preventDefault` method of the event. See {@link ng.$rootScope.Scope#$on} for more * details about event object. Upon successful change * {@link ng.$location#$locationChangeSuccess $locationChangeSuccess} is fired. * * The `newState` and `oldState` parameters may be defined only in HTML5 mode and when * the browser supports the HTML5 History API. * * @param {Object} angularEvent Synthetic event object. * @param {string} newUrl New URL * @param {string=} oldUrl URL that was before it was changed. * @param {string=} newState New history state object * @param {string=} oldState History state object that was before it was changed. */ /** * @ngdoc event * @name $location#$locationChangeSuccess * @eventType broadcast on root scope * @description * Broadcasted after a URL was changed. * * The `newState` and `oldState` parameters may be defined only in HTML5 mode and when * the browser supports the HTML5 History API. * * @param {Object} angularEvent Synthetic event object. * @param {string} newUrl New URL * @param {string=} oldUrl URL that was before it was changed. * @param {string=} newState New history state object * @param {string=} oldState History state object that was before it was changed. */ this.$get = ['$rootScope', '$browser', '$sniffer', '$rootElement', '$window', function($rootScope, $browser, $sniffer, $rootElement, $window) { var $location, LocationMode, baseHref = $browser.baseHref(), // if base[href] is undefined, it defaults to '' initialUrl = $browser.url(), appBase; if (html5Mode.enabled) { if (!baseHref && html5Mode.requireBase) { throw $locationMinErr('nobase', "$location in HTML5 mode requires a <base> tag to be present!"); } appBase = serverBase(initialUrl) + (baseHref || '/'); LocationMode = $sniffer.history ? LocationHtml5Url : LocationHashbangInHtml5Url; } else { appBase = stripHash(initialUrl); LocationMode = LocationHashbangUrl; } $location = new LocationMode(appBase, '#' + hashPrefix); $location.$$parseLinkUrl(initialUrl, initialUrl); $location.$$state = $browser.state(); var IGNORE_URI_REGEXP = /^\s*(javascript|mailto):/i; function setBrowserUrlWithFallback(url, replace, state) { var oldUrl = $location.url(); var oldState = $location.$$state; try { $browser.url(url, replace, state); // Make sure $location.state() returns referentially identical (not just deeply equal) // state object; this makes possible quick checking if the state changed in the digest // loop. Checking deep equality would be too expensive. $location.$$state = $browser.state(); } catch (e) { // Restore old values if pushState fails $location.url(oldUrl); $location.$$state = oldState; throw e; } } $rootElement.on('click', function(event) { // TODO(vojta): rewrite link when opening in new tab/window (in legacy browser) // currently we open nice url link and redirect then if (!html5Mode.rewriteLinks || event.ctrlKey || event.metaKey || event.shiftKey || event.which == 2 || event.button == 2) return; var elm = jqLite(event.target); // traverse the DOM up to find first A tag while (nodeName_(elm[0]) !== 'a') { // ignore rewriting if no A tag (reached root element, or no parent - removed from document) if (elm[0] === $rootElement[0] || !(elm = elm.parent())[0]) return; } var absHref = elm.prop('href'); // get the actual href attribute - see // http://msdn.microsoft.com/en-us/library/ie/dd347148(v=vs.85).aspx var relHref = elm.attr('href') || elm.attr('xlink:href'); if (isObject(absHref) && absHref.toString() === '[object SVGAnimatedString]') { // SVGAnimatedString.animVal should be identical to SVGAnimatedString.baseVal, unless during // an animation. absHref = urlResolve(absHref.animVal).href; } // Ignore when url is started with javascript: or mailto: if (IGNORE_URI_REGEXP.test(absHref)) return; if (absHref && !elm.attr('target') && !event.isDefaultPrevented()) { if ($location.$$parseLinkUrl(absHref, relHref)) { // We do a preventDefault for all urls that are part of the angular application, // in html5mode and also without, so that we are able to abort navigation without // getting double entries in the location history. event.preventDefault(); // update location manually if ($location.absUrl() != $browser.url()) { $rootScope.$apply(); // hack to work around FF6 bug 684208 when scenario runner clicks on links $window.angular['ff-684208-preventDefault'] = true; } } } }); // rewrite hashbang url <> html5 url if (trimEmptyHash($location.absUrl()) != trimEmptyHash(initialUrl)) { $browser.url($location.absUrl(), true); } var initializing = true; // update $location when $browser url changes $browser.onUrlChange(function(newUrl, newState) { $rootScope.$evalAsync(function() { var oldUrl = $location.absUrl(); var oldState = $location.$$state; var defaultPrevented; $location.$$parse(newUrl); $location.$$state = newState; defaultPrevented = $rootScope.$broadcast('$locationChangeStart', newUrl, oldUrl, newState, oldState).defaultPrevented; // if the location was changed by a `$locationChangeStart` handler then stop // processing this location change if ($location.absUrl() !== newUrl) return; if (defaultPrevented) { $location.$$parse(oldUrl); $location.$$state = oldState; setBrowserUrlWithFallback(oldUrl, false, oldState); } else { initializing = false; afterLocationChange(oldUrl, oldState); } }); if (!$rootScope.$$phase) $rootScope.$digest(); }); // update browser $rootScope.$watch(function $locationWatch() { var oldUrl = trimEmptyHash($browser.url()); var newUrl = trimEmptyHash($location.absUrl()); var oldState = $browser.state(); var currentReplace = $location.$$replace; var urlOrStateChanged = oldUrl !== newUrl || ($location.$$html5 && $sniffer.history && oldState !== $location.$$state); if (initializing || urlOrStateChanged) { initializing = false; $rootScope.$evalAsync(function() { var newUrl = $location.absUrl(); var defaultPrevented = $rootScope.$broadcast('$locationChangeStart', newUrl, oldUrl, $location.$$state, oldState).defaultPrevented; // if the location was changed by a `$locationChangeStart` handler then stop // processing this location change if ($location.absUrl() !== newUrl) return; if (defaultPrevented) { $location.$$parse(oldUrl); $location.$$state = oldState; } else { if (urlOrStateChanged) { setBrowserUrlWithFallback(newUrl, currentReplace, oldState === $location.$$state ? null : $location.$$state); } afterLocationChange(oldUrl, oldState); } }); } $location.$$replace = false; // we don't need to return anything because $evalAsync will make the digest loop dirty when // there is a change }); return $location; function afterLocationChange(oldUrl, oldState) { $rootScope.$broadcast('$locationChangeSuccess', $location.absUrl(), oldUrl, $location.$$state, oldState); } }]; } /** * @ngdoc service * @name $log * @requires $window * * @description * Simple service for logging. Default implementation safely writes the message * into the browser's console (if present). * * The main purpose of this service is to simplify debugging and troubleshooting. * * The default is to log `debug` messages. You can use * {@link ng.$logProvider ng.$logProvider#debugEnabled} to change this. * * @example <example module="logExample"> <file name="script.js"> angular.module('logExample', []) .controller('LogController', ['$scope', '$log', function($scope, $log) { $scope.$log = $log; $scope.message = 'Hello World!'; }]); </file> <file name="index.html"> <div ng-controller="LogController"> <p>Reload this page with open console, enter text and hit the log button...</p> Message: <input type="text" ng-model="message"/> <button ng-click="$log.log(message)">log</button> <button ng-click="$log.warn(message)">warn</button> <button ng-click="$log.info(message)">info</button> <button ng-click="$log.error(message)">error</button> </div> </file> </example> */ /** * @ngdoc provider * @name $logProvider * @description * Use the `$logProvider` to configure how the application logs messages */ function $LogProvider() { var debug = true, self = this; /** * @ngdoc method * @name $logProvider#debugEnabled * @description * @param {boolean=} flag enable or disable debug level messages * @returns {*} current value if used as getter or itself (chaining) if used as setter */ this.debugEnabled = function(flag) { if (isDefined(flag)) { debug = flag; return this; } else { return debug; } }; this.$get = ['$window', function($window) { return { /** * @ngdoc method * @name $log#log * * @description * Write a log message */ log: consoleLog('log'), /** * @ngdoc method * @name $log#info * * @description * Write an information message */ info: consoleLog('info'), /** * @ngdoc method * @name $log#warn * * @description * Write a warning message */ warn: consoleLog('warn'), /** * @ngdoc method * @name $log#error * * @description * Write an error message */ error: consoleLog('error'), /** * @ngdoc method * @name $log#debug * * @description * Write a debug message */ debug: (function() { var fn = consoleLog('debug'); return function() { if (debug) { fn.apply(self, arguments); } }; }()) }; function formatError(arg) { if (arg instanceof Error) { if (arg.stack) { arg = (arg.message && arg.stack.indexOf(arg.message) === -1) ? 'Error: ' + arg.message + '\n' + arg.stack : arg.stack; } else if (arg.sourceURL) { arg = arg.message + '\n' + arg.sourceURL + ':' + arg.line; } } return arg; } function consoleLog(type) { var console = $window.console || {}, logFn = console[type] || console.log || noop, hasApply = false; // Note: reading logFn.apply throws an error in IE11 in IE8 document mode. // The reason behind this is that console.log has type "object" in IE8... try { hasApply = !!logFn.apply; } catch (e) {} if (hasApply) { return function() { var args = []; forEach(arguments, function(arg) { args.push(formatError(arg)); }); return logFn.apply(console, args); }; } // we are IE which either doesn't have window.console => this is noop and we do nothing, // or we are IE where console.log doesn't have apply so we log at least first 2 args return function(arg1, arg2) { logFn(arg1, arg2 == null ? '' : arg2); }; } }]; } var $parseMinErr = minErr('$parse'); // Sandboxing Angular Expressions // ------------------------------ // Angular expressions are generally considered safe because these expressions only have direct // access to `$scope` and locals. However, one can obtain the ability to execute arbitrary JS code by // obtaining a reference to native JS functions such as the Function constructor. // // As an example, consider the following Angular expression: // // {}.toString.constructor('alert("evil JS code")') // // This sandboxing technique is not perfect and doesn't aim to be. The goal is to prevent exploits // against the expression language, but not to prevent exploits that were enabled by exposing // sensitive JavaScript or browser APIs on Scope. Exposing such objects on a Scope is never a good // practice and therefore we are not even trying to protect against interaction with an object // explicitly exposed in this way. // // In general, it is not possible to access a Window object from an angular expression unless a // window or some DOM object that has a reference to window is published onto a Scope. // Similarly we prevent invocations of function known to be dangerous, as well as assignments to // native objects. // // See https://docs.angularjs.org/guide/security function ensureSafeMemberName(name, fullExpression) { if (name === "__defineGetter__" || name === "__defineSetter__" || name === "__lookupGetter__" || name === "__lookupSetter__" || name === "__proto__") { throw $parseMinErr('isecfld', 'Attempting to access a disallowed field in Angular expressions! ' + 'Expression: {0}', fullExpression); } return name; } function ensureSafeObject(obj, fullExpression) { // nifty check if obj is Function that is fast and works across iframes and other contexts if (obj) { if (obj.constructor === obj) { throw $parseMinErr('isecfn', 'Referencing Function in Angular expressions is disallowed! Expression: {0}', fullExpression); } else if (// isWindow(obj) obj.window === obj) { throw $parseMinErr('isecwindow', 'Referencing the Window in Angular expressions is disallowed! Expression: {0}', fullExpression); } else if (// isElement(obj) obj.children && (obj.nodeName || (obj.prop && obj.attr && obj.find))) { throw $parseMinErr('isecdom', 'Referencing DOM nodes in Angular expressions is disallowed! Expression: {0}', fullExpression); } else if (// block Object so that we can't get hold of dangerous Object.* methods obj === Object) { throw $parseMinErr('isecobj', 'Referencing Object in Angular expressions is disallowed! Expression: {0}', fullExpression); } } return obj; } var CALL = Function.prototype.call; var APPLY = Function.prototype.apply; var BIND = Function.prototype.bind; function ensureSafeFunction(obj, fullExpression) { if (obj) { if (obj.constructor === obj) { throw $parseMinErr('isecfn', 'Referencing Function in Angular expressions is disallowed! Expression: {0}', fullExpression); } else if (obj === CALL || obj === APPLY || obj === BIND) { throw $parseMinErr('isecff', 'Referencing call, apply or bind in Angular expressions is disallowed! Expression: {0}', fullExpression); } } } //Keyword constants var CONSTANTS = createMap(); forEach({ 'null': function() { return null; }, 'true': function() { return true; }, 'false': function() { return false; }, 'undefined': function() {} }, function(constantGetter, name) { constantGetter.constant = constantGetter.literal = constantGetter.sharedGetter = true; CONSTANTS[name] = constantGetter; }); //Not quite a constant, but can be lex/parsed the same CONSTANTS['this'] = function(self) { return self; }; CONSTANTS['this'].sharedGetter = true; //Operators - will be wrapped by binaryFn/unaryFn/assignment/filter var OPERATORS = extend(createMap(), { '+':function(self, locals, a, b) { a=a(self, locals); b=b(self, locals); if (isDefined(a)) { if (isDefined(b)) { return a + b; } return a; } return isDefined(b) ? b : undefined;}, '-':function(self, locals, a, b) { a=a(self, locals); b=b(self, locals); return (isDefined(a) ? a : 0) - (isDefined(b) ? b : 0); }, '*':function(self, locals, a, b) {return a(self, locals) * b(self, locals);}, '/':function(self, locals, a, b) {return a(self, locals) / b(self, locals);}, '%':function(self, locals, a, b) {return a(self, locals) % b(self, locals);}, '===':function(self, locals, a, b) {return a(self, locals) === b(self, locals);}, '!==':function(self, locals, a, b) {return a(self, locals) !== b(self, locals);}, '==':function(self, locals, a, b) {return a(self, locals) == b(self, locals);}, '!=':function(self, locals, a, b) {return a(self, locals) != b(self, locals);}, '<':function(self, locals, a, b) {return a(self, locals) < b(self, locals);}, '>':function(self, locals, a, b) {return a(self, locals) > b(self, locals);}, '<=':function(self, locals, a, b) {return a(self, locals) <= b(self, locals);}, '>=':function(self, locals, a, b) {return a(self, locals) >= b(self, locals);}, '&&':function(self, locals, a, b) {return a(self, locals) && b(self, locals);}, '||':function(self, locals, a, b) {return a(self, locals) || b(self, locals);}, '!':function(self, locals, a) {return !a(self, locals);}, //Tokenized as operators but parsed as assignment/filters '=':true, '|':true }); var ESCAPE = {"n":"\n", "f":"\f", "r":"\r", "t":"\t", "v":"\v", "'":"'", '"':'"'}; ///////////////////////////////////////// /** * @constructor */ var Lexer = function(options) { this.options = options; }; Lexer.prototype = { constructor: Lexer, lex: function(text) { this.text = text; this.index = 0; this.tokens = []; while (this.index < this.text.length) { var ch = this.text.charAt(this.index); if (ch === '"' || ch === "'") { this.readString(ch); } else if (this.isNumber(ch) || ch === '.' && this.isNumber(this.peek())) { this.readNumber(); } else if (this.isIdent(ch)) { this.readIdent(); } else if (this.is(ch, '(){}[].,;:?')) { this.tokens.push({index: this.index, text: ch}); this.index++; } else if (this.isWhitespace(ch)) { this.index++; } else { var ch2 = ch + this.peek(); var ch3 = ch2 + this.peek(2); var op1 = OPERATORS[ch]; var op2 = OPERATORS[ch2]; var op3 = OPERATORS[ch3]; if (op1 || op2 || op3) { var token = op3 ? ch3 : (op2 ? ch2 : ch); this.tokens.push({index: this.index, text: token, operator: true}); this.index += token.length; } else { this.throwError('Unexpected next character ', this.index, this.index + 1); } } } return this.tokens; }, is: function(ch, chars) { return chars.indexOf(ch) !== -1; }, peek: function(i) { var num = i || 1; return (this.index + num < this.text.length) ? this.text.charAt(this.index + num) : false; }, isNumber: function(ch) { return ('0' <= ch && ch <= '9') && typeof ch === "string"; }, isWhitespace: function(ch) { // IE treats non-breaking space as \u00A0 return (ch === ' ' || ch === '\r' || ch === '\t' || ch === '\n' || ch === '\v' || ch === '\u00A0'); }, isIdent: function(ch) { return ('a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || '_' === ch || ch === '$'); }, isExpOperator: function(ch) { return (ch === '-' || ch === '+' || this.isNumber(ch)); }, throwError: function(error, start, end) { end = end || this.index; var colStr = (isDefined(start) ? 's ' + start + '-' + this.index + ' [' + this.text.substring(start, end) + ']' : ' ' + end); throw $parseMinErr('lexerr', 'Lexer Error: {0} at column{1} in expression [{2}].', error, colStr, this.text); }, readNumber: function() { var number = ''; var start = this.index; while (this.index < this.text.length) { var ch = lowercase(this.text.charAt(this.index)); if (ch == '.' || this.isNumber(ch)) { number += ch; } else { var peekCh = this.peek(); if (ch == 'e' && this.isExpOperator(peekCh)) { number += ch; } else if (this.isExpOperator(ch) && peekCh && this.isNumber(peekCh) && number.charAt(number.length - 1) == 'e') { number += ch; } else if (this.isExpOperator(ch) && (!peekCh || !this.isNumber(peekCh)) && number.charAt(number.length - 1) == 'e') { this.throwError('Invalid exponent'); } else { break; } } this.index++; } this.tokens.push({ index: start, text: number, constant: true, value: Number(number) }); }, readIdent: function() { var start = this.index; while (this.index < this.text.length) { var ch = this.text.charAt(this.index); if (!(this.isIdent(ch) || this.isNumber(ch))) { break; } this.index++; } this.tokens.push({ index: start, text: this.text.slice(start, this.index), identifier: true }); }, readString: function(quote) { var start = this.index; this.index++; var string = ''; var rawString = quote; var escape = false; while (this.index < this.text.length) { var ch = this.text.charAt(this.index); rawString += ch; if (escape) { if (ch === 'u') { var hex = this.text.substring(this.index + 1, this.index + 5); if (!hex.match(/[\da-f]{4}/i)) this.throwError('Invalid unicode escape [\\u' + hex + ']'); this.index += 4; string += String.fromCharCode(parseInt(hex, 16)); } else { var rep = ESCAPE[ch]; string = string + (rep || ch); } escape = false; } else if (ch === '\\') { escape = true; } else if (ch === quote) { this.index++; this.tokens.push({ index: start, text: rawString, constant: true, value: string }); return; } else { string += ch; } this.index++; } this.throwError('Unterminated quote', start); } }; function isConstant(exp) { return exp.constant; } /** * @constructor */ var Parser = function(lexer, $filter, options) { this.lexer = lexer; this.$filter = $filter; this.options = options; }; Parser.ZERO = extend(function() { return 0; }, { sharedGetter: true, constant: true }); Parser.prototype = { constructor: Parser, parse: function(text) { this.text = text; this.tokens = this.lexer.lex(text); var value = this.statements(); if (this.tokens.length !== 0) { this.throwError('is an unexpected token', this.tokens[0]); } value.literal = !!value.literal; value.constant = !!value.constant; return value; }, primary: function() { var primary; if (this.expect('(')) { primary = this.filterChain(); this.consume(')'); } else if (this.expect('[')) { primary = this.arrayDeclaration(); } else if (this.expect('{')) { primary = this.object(); } else if (this.peek().identifier && this.peek().text in CONSTANTS) { primary = CONSTANTS[this.consume().text]; } else if (this.peek().identifier) { primary = this.identifier(); } else if (this.peek().constant) { primary = this.constant(); } else { this.throwError('not a primary expression', this.peek()); } var next, context; while ((next = this.expect('(', '[', '.'))) { if (next.text === '(') { primary = this.functionCall(primary, context); context = null; } else if (next.text === '[') { context = primary; primary = this.objectIndex(primary); } else if (next.text === '.') { context = primary; primary = this.fieldAccess(primary); } else { this.throwError('IMPOSSIBLE'); } } return primary; }, throwError: function(msg, token) { throw $parseMinErr('syntax', 'Syntax Error: Token \'{0}\' {1} at column {2} of the expression [{3}] starting at [{4}].', token.text, msg, (token.index + 1), this.text, this.text.substring(token.index)); }, peekToken: function() { if (this.tokens.length === 0) throw $parseMinErr('ueoe', 'Unexpected end of expression: {0}', this.text); return this.tokens[0]; }, peek: function(e1, e2, e3, e4) { return this.peekAhead(0, e1, e2, e3, e4); }, peekAhead: function(i, e1, e2, e3, e4) { if (this.tokens.length > i) { var token = this.tokens[i]; var t = token.text; if (t === e1 || t === e2 || t === e3 || t === e4 || (!e1 && !e2 && !e3 && !e4)) { return token; } } return false; }, expect: function(e1, e2, e3, e4) { var token = this.peek(e1, e2, e3, e4); if (token) { this.tokens.shift(); return token; } return false; }, consume: function(e1) { if (this.tokens.length === 0) { throw $parseMinErr('ueoe', 'Unexpected end of expression: {0}', this.text); } var token = this.expect(e1); if (!token) { this.throwError('is unexpected, expecting [' + e1 + ']', this.peek()); } return token; }, unaryFn: function(op, right) { var fn = OPERATORS[op]; return extend(function $parseUnaryFn(self, locals) { return fn(self, locals, right); }, { constant:right.constant, inputs: [right] }); }, binaryFn: function(left, op, right, isBranching) { var fn = OPERATORS[op]; return extend(function $parseBinaryFn(self, locals) { return fn(self, locals, left, right); }, { constant: left.constant && right.constant, inputs: !isBranching && [left, right] }); }, identifier: function() { var id = this.consume().text; //Continue reading each `.identifier` unless it is a method invocation while (this.peek('.') && this.peekAhead(1).identifier && !this.peekAhead(2, '(')) { id += this.consume().text + this.consume().text; } return getterFn(id, this.options, this.text); }, constant: function() { var value = this.consume().value; return extend(function $parseConstant() { return value; }, { constant: true, literal: true }); }, statements: function() { var statements = []; while (true) { if (this.tokens.length > 0 && !this.peek('}', ')', ';', ']')) statements.push(this.filterChain()); if (!this.expect(';')) { // optimize for the common case where there is only one statement. // TODO(size): maybe we should not support multiple statements? return (statements.length === 1) ? statements[0] : function $parseStatements(self, locals) { var value; for (var i = 0, ii = statements.length; i < ii; i++) { value = statements[i](self, locals); } return value; }; } } }, filterChain: function() { var left = this.expression(); var token; while ((token = this.expect('|'))) { left = this.filter(left); } return left; }, filter: function(inputFn) { var fn = this.$filter(this.consume().text); var argsFn; var args; if (this.peek(':')) { argsFn = []; args = []; // we can safely reuse the array while (this.expect(':')) { argsFn.push(this.expression()); } } var inputs = [inputFn].concat(argsFn || []); return extend(function $parseFilter(self, locals) { var input = inputFn(self, locals); if (args) { args[0] = input; var i = argsFn.length; while (i--) { args[i + 1] = argsFn[i](self, locals); } return fn.apply(undefined, args); } return fn(input); }, { constant: !fn.$stateful && inputs.every(isConstant), inputs: !fn.$stateful && inputs }); }, expression: function() { return this.assignment(); }, assignment: function() { var left = this.ternary(); var right; var token; if ((token = this.expect('='))) { if (!left.assign) { this.throwError('implies assignment but [' + this.text.substring(0, token.index) + '] can not be assigned to', token); } right = this.ternary(); return extend(function $parseAssignment(scope, locals) { return left.assign(scope, right(scope, locals), locals); }, { inputs: [left, right] }); } return left; }, ternary: function() { var left = this.logicalOR(); var middle; var token; if ((token = this.expect('?'))) { middle = this.assignment(); if (this.consume(':')) { var right = this.assignment(); return extend(function $parseTernary(self, locals) { return left(self, locals) ? middle(self, locals) : right(self, locals); }, { constant: left.constant && middle.constant && right.constant }); } } return left; }, logicalOR: function() { var left = this.logicalAND(); var token; while ((token = this.expect('||'))) { left = this.binaryFn(left, token.text, this.logicalAND(), true); } return left; }, logicalAND: function() { var left = this.equality(); var token; while ((token = this.expect('&&'))) { left = this.binaryFn(left, token.text, this.equality(), true); } return left; }, equality: function() { var left = this.relational(); var token; while ((token = this.expect('==','!=','===','!=='))) { left = this.binaryFn(left, token.text, this.relational()); } return left; }, relational: function() { var left = this.additive(); var token; while ((token = this.expect('<', '>', '<=', '>='))) { left = this.binaryFn(left, token.text, this.additive()); } return left; }, additive: function() { var left = this.multiplicative(); var token; while ((token = this.expect('+','-'))) { left = this.binaryFn(left, token.text, this.multiplicative()); } return left; }, multiplicative: function() { var left = this.unary(); var token; while ((token = this.expect('*','/','%'))) { left = this.binaryFn(left, token.text, this.unary()); } return left; }, unary: function() { var token; if (this.expect('+')) { return this.primary(); } else if ((token = this.expect('-'))) { return this.binaryFn(Parser.ZERO, token.text, this.unary()); } else if ((token = this.expect('!'))) { return this.unaryFn(token.text, this.unary()); } else { return this.primary(); } }, fieldAccess: function(object) { var getter = this.identifier(); return extend(function $parseFieldAccess(scope, locals, self) { var o = self || object(scope, locals); return (o == null) ? undefined : getter(o); }, { assign: function(scope, value, locals) { var o = object(scope, locals); if (!o) object.assign(scope, o = {}, locals); return getter.assign(o, value); } }); }, objectIndex: function(obj) { var expression = this.text; var indexFn = this.expression(); this.consume(']'); return extend(function $parseObjectIndex(self, locals) { var o = obj(self, locals), i = indexFn(self, locals), v; ensureSafeMemberName(i, expression); if (!o) return undefined; v = ensureSafeObject(o[i], expression); return v; }, { assign: function(self, value, locals) { var key = ensureSafeMemberName(indexFn(self, locals), expression); // prevent overwriting of Function.constructor which would break ensureSafeObject check var o = ensureSafeObject(obj(self, locals), expression); if (!o) obj.assign(self, o = {}, locals); return o[key] = value; } }); }, functionCall: function(fnGetter, contextGetter) { var argsFn = []; if (this.peekToken().text !== ')') { do { argsFn.push(this.expression()); } while (this.expect(',')); } this.consume(')'); var expressionText = this.text; // we can safely reuse the array across invocations var args = argsFn.length ? [] : null; return function $parseFunctionCall(scope, locals) { var context = contextGetter ? contextGetter(scope, locals) : isDefined(contextGetter) ? undefined : scope; var fn = fnGetter(scope, locals, context) || noop; if (args) { var i = argsFn.length; while (i--) { args[i] = ensureSafeObject(argsFn[i](scope, locals), expressionText); } } ensureSafeObject(context, expressionText); ensureSafeFunction(fn, expressionText); // IE doesn't have apply for some native functions var v = fn.apply ? fn.apply(context, args) : fn(args[0], args[1], args[2], args[3], args[4]); if (args) { // Free-up the memory (arguments of the last function call). args.length = 0; } return ensureSafeObject(v, expressionText); }; }, // This is used with json array declaration arrayDeclaration: function() { var elementFns = []; if (this.peekToken().text !== ']') { do { if (this.peek(']')) { // Support trailing commas per ES5.1. break; } elementFns.push(this.expression()); } while (this.expect(',')); } this.consume(']'); return extend(function $parseArrayLiteral(self, locals) { var array = []; for (var i = 0, ii = elementFns.length; i < ii; i++) { array.push(elementFns[i](self, locals)); } return array; }, { literal: true, constant: elementFns.every(isConstant), inputs: elementFns }); }, object: function() { var keys = [], valueFns = []; if (this.peekToken().text !== '}') { do { if (this.peek('}')) { // Support trailing commas per ES5.1. break; } var token = this.consume(); if (token.constant) { keys.push(token.value); } else if (token.identifier) { keys.push(token.text); } else { this.throwError("invalid key", token); } this.consume(':'); valueFns.push(this.expression()); } while (this.expect(',')); } this.consume('}'); return extend(function $parseObjectLiteral(self, locals) { var object = {}; for (var i = 0, ii = valueFns.length; i < ii; i++) { object[keys[i]] = valueFns[i](self, locals); } return object; }, { literal: true, constant: valueFns.every(isConstant), inputs: valueFns }); } }; ////////////////////////////////////////////////// // Parser helper functions ////////////////////////////////////////////////// function setter(obj, locals, path, setValue, fullExp) { ensureSafeObject(obj, fullExp); ensureSafeObject(locals, fullExp); var element = path.split('.'), key; for (var i = 0; element.length > 1; i++) { key = ensureSafeMemberName(element.shift(), fullExp); var propertyObj = (i === 0 && locals && locals[key]) || obj[key]; if (!propertyObj) { propertyObj = {}; obj[key] = propertyObj; } obj = ensureSafeObject(propertyObj, fullExp); } key = ensureSafeMemberName(element.shift(), fullExp); ensureSafeObject(obj[key], fullExp); obj[key] = setValue; return setValue; } var getterFnCacheDefault = createMap(); var getterFnCacheExpensive = createMap(); function isPossiblyDangerousMemberName(name) { return name == 'constructor'; } /** * Implementation of the "Black Hole" variant from: * - http://jsperf.com/angularjs-parse-getter/4 * - http://jsperf.com/path-evaluation-simplified/7 */ function cspSafeGetterFn(key0, key1, key2, key3, key4, fullExp, expensiveChecks) { ensureSafeMemberName(key0, fullExp); ensureSafeMemberName(key1, fullExp); ensureSafeMemberName(key2, fullExp); ensureSafeMemberName(key3, fullExp); ensureSafeMemberName(key4, fullExp); var eso = function(o) { return ensureSafeObject(o, fullExp); }; var eso0 = (expensiveChecks || isPossiblyDangerousMemberName(key0)) ? eso : identity; var eso1 = (expensiveChecks || isPossiblyDangerousMemberName(key1)) ? eso : identity; var eso2 = (expensiveChecks || isPossiblyDangerousMemberName(key2)) ? eso : identity; var eso3 = (expensiveChecks || isPossiblyDangerousMemberName(key3)) ? eso : identity; var eso4 = (expensiveChecks || isPossiblyDangerousMemberName(key4)) ? eso : identity; return function cspSafeGetter(scope, locals) { var pathVal = (locals && locals.hasOwnProperty(key0)) ? locals : scope; if (pathVal == null) return pathVal; pathVal = eso0(pathVal[key0]); if (!key1) return pathVal; if (pathVal == null) return undefined; pathVal = eso1(pathVal[key1]); if (!key2) return pathVal; if (pathVal == null) return undefined; pathVal = eso2(pathVal[key2]); if (!key3) return pathVal; if (pathVal == null) return undefined; pathVal = eso3(pathVal[key3]); if (!key4) return pathVal; if (pathVal == null) return undefined; pathVal = eso4(pathVal[key4]); return pathVal; }; } function getterFnWithEnsureSafeObject(fn, fullExpression) { return function(s, l) { return fn(s, l, ensureSafeObject, fullExpression); }; } function getterFn(path, options, fullExp) { var expensiveChecks = options.expensiveChecks; var getterFnCache = (expensiveChecks ? getterFnCacheExpensive : getterFnCacheDefault); var fn = getterFnCache[path]; if (fn) return fn; var pathKeys = path.split('.'), pathKeysLength = pathKeys.length; // http://jsperf.com/angularjs-parse-getter/6 if (options.csp) { if (pathKeysLength < 6) { fn = cspSafeGetterFn(pathKeys[0], pathKeys[1], pathKeys[2], pathKeys[3], pathKeys[4], fullExp, expensiveChecks); } else { fn = function cspSafeGetter(scope, locals) { var i = 0, val; do { val = cspSafeGetterFn(pathKeys[i++], pathKeys[i++], pathKeys[i++], pathKeys[i++], pathKeys[i++], fullExp, expensiveChecks)(scope, locals); locals = undefined; // clear after first iteration scope = val; } while (i < pathKeysLength); return val; }; } } else { var code = ''; if (expensiveChecks) { code += 's = eso(s, fe);\nl = eso(l, fe);\n'; } var needsEnsureSafeObject = expensiveChecks; forEach(pathKeys, function(key, index) { ensureSafeMemberName(key, fullExp); var lookupJs = (index // we simply dereference 's' on any .dot notation ? 's' // but if we are first then we check locals first, and if so read it first : '((l&&l.hasOwnProperty("' + key + '"))?l:s)') + '.' + key; if (expensiveChecks || isPossiblyDangerousMemberName(key)) { lookupJs = 'eso(' + lookupJs + ', fe)'; needsEnsureSafeObject = true; } code += 'if(s == null) return undefined;\n' + 's=' + lookupJs + ';\n'; }); code += 'return s;'; /* jshint -W054 */ var evaledFnGetter = new Function('s', 'l', 'eso', 'fe', code); // s=scope, l=locals, eso=ensureSafeObject /* jshint +W054 */ evaledFnGetter.toString = valueFn(code); if (needsEnsureSafeObject) { evaledFnGetter = getterFnWithEnsureSafeObject(evaledFnGetter, fullExp); } fn = evaledFnGetter; } fn.sharedGetter = true; fn.assign = function(self, value, locals) { return setter(self, locals, path, value, path); }; getterFnCache[path] = fn; return fn; } var objectValueOf = Object.prototype.valueOf; function getValueOf(value) { return isFunction(value.valueOf) ? value.valueOf() : objectValueOf.call(value); } /////////////////////////////////// /** * @ngdoc service * @name $parse * @kind function * * @description * * Converts Angular {@link guide/expression expression} into a function. * * ```js * var getter = $parse('user.name'); * var setter = getter.assign; * var context = {user:{name:'angular'}}; * var locals = {user:{name:'local'}}; * * expect(getter(context)).toEqual('angular'); * setter(context, 'newValue'); * expect(context.user.name).toEqual('newValue'); * expect(getter(context, locals)).toEqual('local'); * ``` * * * @param {string} expression String expression to compile. * @returns {function(context, locals)} a function which represents the compiled expression: * * * `context` – `{object}` – an object against which any expressions embedded in the strings * are evaluated against (typically a scope object). * * `locals` – `{object=}` – local variables context object, useful for overriding values in * `context`. * * The returned function also has the following properties: * * `literal` – `{boolean}` – whether the expression's top-level node is a JavaScript * literal. * * `constant` – `{boolean}` – whether the expression is made entirely of JavaScript * constant literals. * * `assign` – `{?function(context, value)}` – if the expression is assignable, this will be * set to a function to change its value on the given context. * */ /** * @ngdoc provider * @name $parseProvider * * @description * `$parseProvider` can be used for configuring the default behavior of the {@link ng.$parse $parse} * service. */ function $ParseProvider() { var cacheDefault = createMap(); var cacheExpensive = createMap(); this.$get = ['$filter', '$sniffer', function($filter, $sniffer) { var $parseOptions = { csp: $sniffer.csp, expensiveChecks: false }, $parseOptionsExpensive = { csp: $sniffer.csp, expensiveChecks: true }; function wrapSharedExpression(exp) { var wrapped = exp; if (exp.sharedGetter) { wrapped = function $parseWrapper(self, locals) { return exp(self, locals); }; wrapped.literal = exp.literal; wrapped.constant = exp.constant; wrapped.assign = exp.assign; } return wrapped; } return function $parse(exp, interceptorFn, expensiveChecks) { var parsedExpression, oneTime, cacheKey; switch (typeof exp) { case 'string': cacheKey = exp = exp.trim(); var cache = (expensiveChecks ? cacheExpensive : cacheDefault); parsedExpression = cache[cacheKey]; if (!parsedExpression) { if (exp.charAt(0) === ':' && exp.charAt(1) === ':') { oneTime = true; exp = exp.substring(2); } var parseOptions = expensiveChecks ? $parseOptionsExpensive : $parseOptions; var lexer = new Lexer(parseOptions); var parser = new Parser(lexer, $filter, parseOptions); parsedExpression = parser.parse(exp); if (parsedExpression.constant) { parsedExpression.$$watchDelegate = constantWatchDelegate; } else if (oneTime) { //oneTime is not part of the exp passed to the Parser so we may have to //wrap the parsedExpression before adding a $$watchDelegate parsedExpression = wrapSharedExpression(parsedExpression); parsedExpression.$$watchDelegate = parsedExpression.literal ? oneTimeLiteralWatchDelegate : oneTimeWatchDelegate; } else if (parsedExpression.inputs) { parsedExpression.$$watchDelegate = inputsWatchDelegate; } cache[cacheKey] = parsedExpression; } return addInterceptor(parsedExpression, interceptorFn); case 'function': return addInterceptor(exp, interceptorFn); default: return addInterceptor(noop, interceptorFn); } }; function collectExpressionInputs(inputs, list) { for (var i = 0, ii = inputs.length; i < ii; i++) { var input = inputs[i]; if (!input.constant) { if (input.inputs) { collectExpressionInputs(input.inputs, list); } else if (list.indexOf(input) === -1) { // TODO(perf) can we do better? list.push(input); } } } return list; } function expressionInputDirtyCheck(newValue, oldValueOfValue) { if (newValue == null || oldValueOfValue == null) { // null/undefined return newValue === oldValueOfValue; } if (typeof newValue === 'object') { // attempt to convert the value to a primitive type // TODO(docs): add a note to docs that by implementing valueOf even objects and arrays can // be cheaply dirty-checked newValue = getValueOf(newValue); if (typeof newValue === 'object') { // objects/arrays are not supported - deep-watching them would be too expensive return false; } // fall-through to the primitive equality check } //Primitive or NaN return newValue === oldValueOfValue || (newValue !== newValue && oldValueOfValue !== oldValueOfValue); } function inputsWatchDelegate(scope, listener, objectEquality, parsedExpression) { var inputExpressions = parsedExpression.$$inputs || (parsedExpression.$$inputs = collectExpressionInputs(parsedExpression.inputs, [])); var lastResult; if (inputExpressions.length === 1) { var oldInputValue = expressionInputDirtyCheck; // init to something unique so that equals check fails inputExpressions = inputExpressions[0]; return scope.$watch(function expressionInputWatch(scope) { var newInputValue = inputExpressions(scope); if (!expressionInputDirtyCheck(newInputValue, oldInputValue)) { lastResult = parsedExpression(scope); oldInputValue = newInputValue && getValueOf(newInputValue); } return lastResult; }, listener, objectEquality); } var oldInputValueOfValues = []; for (var i = 0, ii = inputExpressions.length; i < ii; i++) { oldInputValueOfValues[i] = expressionInputDirtyCheck; // init to something unique so that equals check fails } return scope.$watch(function expressionInputsWatch(scope) { var changed = false; for (var i = 0, ii = inputExpressions.length; i < ii; i++) { var newInputValue = inputExpressions[i](scope); if (changed || (changed = !expressionInputDirtyCheck(newInputValue, oldInputValueOfValues[i]))) { oldInputValueOfValues[i] = newInputValue && getValueOf(newInputValue); } } if (changed) { lastResult = parsedExpression(scope); } return lastResult; }, listener, objectEquality); } function oneTimeWatchDelegate(scope, listener, objectEquality, parsedExpression) { var unwatch, lastValue; return unwatch = scope.$watch(function oneTimeWatch(scope) { return parsedExpression(scope); }, function oneTimeListener(value, old, scope) { lastValue = value; if (isFunction(listener)) { listener.apply(this, arguments); } if (isDefined(value)) { scope.$$postDigest(function() { if (isDefined(lastValue)) { unwatch(); } }); } }, objectEquality); } function oneTimeLiteralWatchDelegate(scope, listener, objectEquality, parsedExpression) { var unwatch, lastValue; return unwatch = scope.$watch(function oneTimeWatch(scope) { return parsedExpression(scope); }, function oneTimeListener(value, old, scope) { lastValue = value; if (isFunction(listener)) { listener.call(this, value, old, scope); } if (isAllDefined(value)) { scope.$$postDigest(function() { if (isAllDefined(lastValue)) unwatch(); }); } }, objectEquality); function isAllDefined(value) { var allDefined = true; forEach(value, function(val) { if (!isDefined(val)) allDefined = false; }); return allDefined; } } function constantWatchDelegate(scope, listener, objectEquality, parsedExpression) { var unwatch; return unwatch = scope.$watch(function constantWatch(scope) { return parsedExpression(scope); }, function constantListener(value, old, scope) { if (isFunction(listener)) { listener.apply(this, arguments); } unwatch(); }, objectEquality); } function addInterceptor(parsedExpression, interceptorFn) { if (!interceptorFn) return parsedExpression; var watchDelegate = parsedExpression.$$watchDelegate; var regularWatch = watchDelegate !== oneTimeLiteralWatchDelegate && watchDelegate !== oneTimeWatchDelegate; var fn = regularWatch ? function regularInterceptedExpression(scope, locals) { var value = parsedExpression(scope, locals); return interceptorFn(value, scope, locals); } : function oneTimeInterceptedExpression(scope, locals) { var value = parsedExpression(scope, locals); var result = interceptorFn(value, scope, locals); // we only return the interceptor's result if the // initial value is defined (for bind-once) return isDefined(value) ? result : value; }; // Propagate $$watchDelegates other then inputsWatchDelegate if (parsedExpression.$$watchDelegate && parsedExpression.$$watchDelegate !== inputsWatchDelegate) { fn.$$watchDelegate = parsedExpression.$$watchDelegate; } else if (!interceptorFn.$stateful) { // If there is an interceptor, but no watchDelegate then treat the interceptor like // we treat filters - it is assumed to be a pure function unless flagged with $stateful fn.$$watchDelegate = inputsWatchDelegate; fn.inputs = [parsedExpression]; } return fn; } }]; } /** * @ngdoc service * @name $q * @requires $rootScope * * @description * A service that helps you run functions asynchronously, and use their return values (or exceptions) * when they are done processing. * * This is an implementation of promises/deferred objects inspired by * [Kris Kowal's Q](https://github.com/kriskowal/q). * * $q can be used in two fashions --- one which is more similar to Kris Kowal's Q or jQuery's Deferred * implementations, and the other which resembles ES6 promises to some degree. * * # $q constructor * * The streamlined ES6 style promise is essentially just using $q as a constructor which takes a `resolver` * function as the first argument. This is similar to the native Promise implementation from ES6 Harmony, * see [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise). * * While the constructor-style use is supported, not all of the supporting methods from ES6 Harmony promises are * available yet. * * It can be used like so: * * ```js * // for the purpose of this example let's assume that variables `$q` and `okToGreet` * // are available in the current lexical scope (they could have been injected or passed in). * * function asyncGreet(name) { * // perform some asynchronous operation, resolve or reject the promise when appropriate. * return $q(function(resolve, reject) { * setTimeout(function() { * if (okToGreet(name)) { * resolve('Hello, ' + name + '!'); * } else { * reject('Greeting ' + name + ' is not allowed.'); * } * }, 1000); * }); * } * * var promise = asyncGreet('Robin Hood'); * promise.then(function(greeting) { * alert('Success: ' + greeting); * }, function(reason) { * alert('Failed: ' + reason); * }); * ``` * * Note: progress/notify callbacks are not currently supported via the ES6-style interface. * * However, the more traditional CommonJS-style usage is still available, and documented below. * * [The CommonJS Promise proposal](http://wiki.commonjs.org/wiki/Promises) describes a promise as an * interface for interacting with an object that represents the result of an action that is * performed asynchronously, and may or may not be finished at any given point in time. * * From the perspective of dealing with error handling, deferred and promise APIs are to * asynchronous programming what `try`, `catch` and `throw` keywords are to synchronous programming. * * ```js * // for the purpose of this example let's assume that variables `$q` and `okToGreet` * // are available in the current lexical scope (they could have been injected or passed in). * * function asyncGreet(name) { * var deferred = $q.defer(); * * setTimeout(function() { * deferred.notify('About to greet ' + name + '.'); * * if (okToGreet(name)) { * deferred.resolve('Hello, ' + name + '!'); * } else { * deferred.reject('Greeting ' + name + ' is not allowed.'); * } * }, 1000); * * return deferred.promise; * } * * var promise = asyncGreet('Robin Hood'); * promise.then(function(greeting) { * alert('Success: ' + greeting); * }, function(reason) { * alert('Failed: ' + reason); * }, function(update) { * alert('Got notification: ' + update); * }); * ``` * * At first it might not be obvious why this extra complexity is worth the trouble. The payoff * comes in the way of guarantees that promise and deferred APIs make, see * https://github.com/kriskowal/uncommonjs/blob/master/promises/specification.md. * * Additionally the promise api allows for composition that is very hard to do with the * traditional callback ([CPS](http://en.wikipedia.org/wiki/Continuation-passing_style)) approach. * For more on this please see the [Q documentation](https://github.com/kriskowal/q) especially the * section on serial or parallel joining of promises. * * # The Deferred API * * A new instance of deferred is constructed by calling `$q.defer()`. * * The purpose of the deferred object is to expose the associated Promise instance as well as APIs * that can be used for signaling the successful or unsuccessful completion, as well as the status * of the task. * * **Methods** * * - `resolve(value)` – resolves the derived promise with the `value`. If the value is a rejection * constructed via `$q.reject`, the promise will be rejected instead. * - `reject(reason)` – rejects the derived promise with the `reason`. This is equivalent to * resolving it with a rejection constructed via `$q.reject`. * - `notify(value)` - provides updates on the status of the promise's execution. This may be called * multiple times before the promise is either resolved or rejected. * * **Properties** * * - promise – `{Promise}` – promise object associated with this deferred. * * * # The Promise API * * A new promise instance is created when a deferred instance is created and can be retrieved by * calling `deferred.promise`. * * The purpose of the promise object is to allow for interested parties to get access to the result * of the deferred task when it completes. * * **Methods** * * - `then(successCallback, errorCallback, notifyCallback)` – regardless of when the promise was or * will be resolved or rejected, `then` calls one of the success or error callbacks asynchronously * as soon as the result is available. The callbacks are called with a single argument: the result * or rejection reason. Additionally, the notify callback may be called zero or more times to * provide a progress indication, before the promise is resolved or rejected. * * This method *returns a new promise* which is resolved or rejected via the return value of the * `successCallback`, `errorCallback`. It also notifies via the return value of the * `notifyCallback` method. The promise cannot be resolved or rejected from the notifyCallback * method. * * - `catch(errorCallback)` – shorthand for `promise.then(null, errorCallback)` * * - `finally(callback, notifyCallback)` – allows you to observe either the fulfillment or rejection of a promise, * but to do so without modifying the final value. This is useful to release resources or do some * clean-up that needs to be done whether the promise was rejected or resolved. See the [full * specification](https://github.com/kriskowal/q/wiki/API-Reference#promisefinallycallback) for * more information. * * # Chaining promises * * Because calling the `then` method of a promise returns a new derived promise, it is easily * possible to create a chain of promises: * * ```js * promiseB = promiseA.then(function(result) { * return result + 1; * }); * * // promiseB will be resolved immediately after promiseA is resolved and its value * // will be the result of promiseA incremented by 1 * ``` * * It is possible to create chains of any length and since a promise can be resolved with another * promise (which will defer its resolution further), it is possible to pause/defer resolution of * the promises at any point in the chain. This makes it possible to implement powerful APIs like * $http's response interceptors. * * * # Differences between Kris Kowal's Q and $q * * There are two main differences: * * - $q is integrated with the {@link ng.$rootScope.Scope} Scope model observation * mechanism in angular, which means faster propagation of resolution or rejection into your * models and avoiding unnecessary browser repaints, which would result in flickering UI. * - Q has many more features than $q, but that comes at a cost of bytes. $q is tiny, but contains * all the important functionality needed for common async tasks. * * # Testing * * ```js * it('should simulate promise', inject(function($q, $rootScope) { * var deferred = $q.defer(); * var promise = deferred.promise; * var resolvedValue; * * promise.then(function(value) { resolvedValue = value; }); * expect(resolvedValue).toBeUndefined(); * * // Simulate resolving of promise * deferred.resolve(123); * // Note that the 'then' function does not get called synchronously. * // This is because we want the promise API to always be async, whether or not * // it got called synchronously or asynchronously. * expect(resolvedValue).toBeUndefined(); * * // Propagate promise resolution to 'then' functions using $apply(). * $rootScope.$apply(); * expect(resolvedValue).toEqual(123); * })); * ``` * * @param {function(function, function)} resolver Function which is responsible for resolving or * rejecting the newly created promise. The first parameter is a function which resolves the * promise, the second parameter is a function which rejects the promise. * * @returns {Promise} The newly created promise. */ function $QProvider() { this.$get = ['$rootScope', '$exceptionHandler', function($rootScope, $exceptionHandler) { return qFactory(function(callback) { $rootScope.$evalAsync(callback); }, $exceptionHandler); }]; } function $$QProvider() { this.$get = ['$browser', '$exceptionHandler', function($browser, $exceptionHandler) { return qFactory(function(callback) { $browser.defer(callback); }, $exceptionHandler); }]; } /** * Constructs a promise manager. * * @param {function(function)} nextTick Function for executing functions in the next turn. * @param {function(...*)} exceptionHandler Function into which unexpected exceptions are passed for * debugging purposes. * @returns {object} Promise manager. */ function qFactory(nextTick, exceptionHandler) { var $qMinErr = minErr('$q', TypeError); function callOnce(self, resolveFn, rejectFn) { var called = false; function wrap(fn) { return function(value) { if (called) return; called = true; fn.call(self, value); }; } return [wrap(resolveFn), wrap(rejectFn)]; } /** * @ngdoc method * @name ng.$q#defer * @kind function * * @description * Creates a `Deferred` object which represents a task which will finish in the future. * * @returns {Deferred} Returns a new instance of deferred. */ var defer = function() { return new Deferred(); }; function Promise() { this.$$state = { status: 0 }; } Promise.prototype = { then: function(onFulfilled, onRejected, progressBack) { var result = new Deferred(); this.$$state.pending = this.$$state.pending || []; this.$$state.pending.push([result, onFulfilled, onRejected, progressBack]); if (this.$$state.status > 0) scheduleProcessQueue(this.$$state); return result.promise; }, "catch": function(callback) { return this.then(null, callback); }, "finally": function(callback, progressBack) { return this.then(function(value) { return handleCallback(value, true, callback); }, function(error) { return handleCallback(error, false, callback); }, progressBack); } }; //Faster, more basic than angular.bind http://jsperf.com/angular-bind-vs-custom-vs-native function simpleBind(context, fn) { return function(value) { fn.call(context, value); }; } function processQueue(state) { var fn, promise, pending; pending = state.pending; state.processScheduled = false; state.pending = undefined; for (var i = 0, ii = pending.length; i < ii; ++i) { promise = pending[i][0]; fn = pending[i][state.status]; try { if (isFunction(fn)) { promise.resolve(fn(state.value)); } else if (state.status === 1) { promise.resolve(state.value); } else { promise.reject(state.value); } } catch (e) { promise.reject(e); exceptionHandler(e); } } } function scheduleProcessQueue(state) { if (state.processScheduled || !state.pending) return; state.processScheduled = true; nextTick(function() { processQueue(state); }); } function Deferred() { this.promise = new Promise(); //Necessary to support unbound execution :/ this.resolve = simpleBind(this, this.resolve); this.reject = simpleBind(this, this.reject); this.notify = simpleBind(this, this.notify); } Deferred.prototype = { resolve: function(val) { if (this.promise.$$state.status) return; if (val === this.promise) { this.$$reject($qMinErr( 'qcycle', "Expected promise to be resolved with value other than itself '{0}'", val)); } else { this.$$resolve(val); } }, $$resolve: function(val) { var then, fns; fns = callOnce(this, this.$$resolve, this.$$reject); try { if ((isObject(val) || isFunction(val))) then = val && val.then; if (isFunction(then)) { this.promise.$$state.status = -1; then.call(val, fns[0], fns[1], this.notify); } else { this.promise.$$state.value = val; this.promise.$$state.status = 1; scheduleProcessQueue(this.promise.$$state); } } catch (e) { fns[1](e); exceptionHandler(e); } }, reject: function(reason) { if (this.promise.$$state.status) return; this.$$reject(reason); }, $$reject: function(reason) { this.promise.$$state.value = reason; this.promise.$$state.status = 2; scheduleProcessQueue(this.promise.$$state); }, notify: function(progress) { var callbacks = this.promise.$$state.pending; if ((this.promise.$$state.status <= 0) && callbacks && callbacks.length) { nextTick(function() { var callback, result; for (var i = 0, ii = callbacks.length; i < ii; i++) { result = callbacks[i][0]; callback = callbacks[i][3]; try { result.notify(isFunction(callback) ? callback(progress) : progress); } catch (e) { exceptionHandler(e); } } }); } } }; /** * @ngdoc method * @name $q#reject * @kind function * * @description * Creates a promise that is resolved as rejected with the specified `reason`. This api should be * used to forward rejection in a chain of promises. If you are dealing with the last promise in * a promise chain, you don't need to worry about it. * * When comparing deferreds/promises to the familiar behavior of try/catch/throw, think of * `reject` as the `throw` keyword in JavaScript. This also means that if you "catch" an error via * a promise error callback and you want to forward the error to the promise derived from the * current promise, you have to "rethrow" the error by returning a rejection constructed via * `reject`. * * ```js * promiseB = promiseA.then(function(result) { * // success: do something and resolve promiseB * // with the old or a new result * return result; * }, function(reason) { * // error: handle the error if possible and * // resolve promiseB with newPromiseOrValue, * // otherwise forward the rejection to promiseB * if (canHandle(reason)) { * // handle the error and recover * return newPromiseOrValue; * } * return $q.reject(reason); * }); * ``` * * @param {*} reason Constant, message, exception or an object representing the rejection reason. * @returns {Promise} Returns a promise that was already resolved as rejected with the `reason`. */ var reject = function(reason) { var result = new Deferred(); result.reject(reason); return result.promise; }; var makePromise = function makePromise(value, resolved) { var result = new Deferred(); if (resolved) { result.resolve(value); } else { result.reject(value); } return result.promise; }; var handleCallback = function handleCallback(value, isResolved, callback) { var callbackOutput = null; try { if (isFunction(callback)) callbackOutput = callback(); } catch (e) { return makePromise(e, false); } if (isPromiseLike(callbackOutput)) { return callbackOutput.then(function() { return makePromise(value, isResolved); }, function(error) { return makePromise(error, false); }); } else { return makePromise(value, isResolved); } }; /** * @ngdoc method * @name $q#when * @kind function * * @description * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. * This is useful when you are dealing with an object that might or might not be a promise, or if * the promise comes from a source that can't be trusted. * * @param {*} value Value or a promise * @returns {Promise} Returns a promise of the passed value or promise */ var when = function(value, callback, errback, progressBack) { var result = new Deferred(); result.resolve(value); return result.promise.then(callback, errback, progressBack); }; /** * @ngdoc method * @name $q#all * @kind function * * @description * Combines multiple promises into a single promise that is resolved when all of the input * promises are resolved. * * @param {Array.<Promise>|Object.<Promise>} promises An array or hash of promises. * @returns {Promise} Returns a single promise that will be resolved with an array/hash of values, * each value corresponding to the promise at the same index/key in the `promises` array/hash. * If any of the promises is resolved with a rejection, this resulting promise will be rejected * with the same rejection value. */ function all(promises) { var deferred = new Deferred(), counter = 0, results = isArray(promises) ? [] : {}; forEach(promises, function(promise, key) { counter++; when(promise).then(function(value) { if (results.hasOwnProperty(key)) return; results[key] = value; if (!(--counter)) deferred.resolve(results); }, function(reason) { if (results.hasOwnProperty(key)) return; deferred.reject(reason); }); }); if (counter === 0) { deferred.resolve(results); } return deferred.promise; } var $Q = function Q(resolver) { if (!isFunction(resolver)) { throw $qMinErr('norslvr', "Expected resolverFn, got '{0}'", resolver); } if (!(this instanceof Q)) { // More useful when $Q is the Promise itself. return new Q(resolver); } var deferred = new Deferred(); function resolveFn(value) { deferred.resolve(value); } function rejectFn(reason) { deferred.reject(reason); } resolver(resolveFn, rejectFn); return deferred.promise; }; $Q.defer = defer; $Q.reject = reject; $Q.when = when; $Q.all = all; return $Q; } function $$RAFProvider() { //rAF this.$get = ['$window', '$timeout', function($window, $timeout) { var requestAnimationFrame = $window.requestAnimationFrame || $window.webkitRequestAnimationFrame; var cancelAnimationFrame = $window.cancelAnimationFrame || $window.webkitCancelAnimationFrame || $window.webkitCancelRequestAnimationFrame; var rafSupported = !!requestAnimationFrame; var raf = rafSupported ? function(fn) { var id = requestAnimationFrame(fn); return function() { cancelAnimationFrame(id); }; } : function(fn) { var timer = $timeout(fn, 16.66, false); // 1000 / 60 = 16.666 return function() { $timeout.cancel(timer); }; }; raf.supported = rafSupported; return raf; }]; } /** * DESIGN NOTES * * The design decisions behind the scope are heavily favored for speed and memory consumption. * * The typical use of scope is to watch the expressions, which most of the time return the same * value as last time so we optimize the operation. * * Closures construction is expensive in terms of speed as well as memory: * - No closures, instead use prototypical inheritance for API * - Internal state needs to be stored on scope directly, which means that private state is * exposed as $$____ properties * * Loop operations are optimized by using while(count--) { ... } * - this means that in order to keep the same order of execution as addition we have to add * items to the array at the beginning (unshift) instead of at the end (push) * * Child scopes are created and removed often * - Using an array would be slow since inserts in middle are expensive so we use linked list * * There are few watches then a lot of observers. This is why you don't want the observer to be * implemented in the same way as watch. Watch requires return of initialization function which * are expensive to construct. */ /** * @ngdoc provider * @name $rootScopeProvider * @description * * Provider for the $rootScope service. */ /** * @ngdoc method * @name $rootScopeProvider#digestTtl * @description * * Sets the number of `$digest` iterations the scope should attempt to execute before giving up and * assuming that the model is unstable. * * The current default is 10 iterations. * * In complex applications it's possible that the dependencies between `$watch`s will result in * several digest iterations. However if an application needs more than the default 10 digest * iterations for its model to stabilize then you should investigate what is causing the model to * continuously change during the digest. * * Increasing the TTL could have performance implications, so you should not change it without * proper justification. * * @param {number} limit The number of digest iterations. */ /** * @ngdoc service * @name $rootScope * @description * * Every application has a single root {@link ng.$rootScope.Scope scope}. * All other scopes are descendant scopes of the root scope. Scopes provide separation * between the model and the view, via a mechanism for watching the model for changes. * They also provide an event emission/broadcast and subscription facility. See the * {@link guide/scope developer guide on scopes}. */ function $RootScopeProvider() { var TTL = 10; var $rootScopeMinErr = minErr('$rootScope'); var lastDirtyWatch = null; var applyAsyncId = null; this.digestTtl = function(value) { if (arguments.length) { TTL = value; } return TTL; }; this.$get = ['$injector', '$exceptionHandler', '$parse', '$browser', function($injector, $exceptionHandler, $parse, $browser) { /** * @ngdoc type * @name $rootScope.Scope * * @description * A root scope can be retrieved using the {@link ng.$rootScope $rootScope} key from the * {@link auto.$injector $injector}. Child scopes are created using the * {@link ng.$rootScope.Scope#$new $new()} method. (Most scopes are created automatically when * compiled HTML template is executed.) * * Here is a simple scope snippet to show how you can interact with the scope. * ```html * <file src="./test/ng/rootScopeSpec.js" tag="docs1" /> * ``` * * # Inheritance * A scope can inherit from a parent scope, as in this example: * ```js var parent = $rootScope; var child = parent.$new(); parent.salutation = "Hello"; expect(child.salutation).toEqual('Hello'); child.salutation = "Welcome"; expect(child.salutation).toEqual('Welcome'); expect(parent.salutation).toEqual('Hello'); * ``` * * When interacting with `Scope` in tests, additional helper methods are available on the * instances of `Scope` type. See {@link ngMock.$rootScope.Scope ngMock Scope} for additional * details. * * * @param {Object.<string, function()>=} providers Map of service factory which need to be * provided for the current scope. Defaults to {@link ng}. * @param {Object.<string, *>=} instanceCache Provides pre-instantiated services which should * append/override services provided by `providers`. This is handy * when unit-testing and having the need to override a default * service. * @returns {Object} Newly created scope. * */ function Scope() { this.$id = nextUid(); this.$$phase = this.$parent = this.$$watchers = this.$$nextSibling = this.$$prevSibling = this.$$childHead = this.$$childTail = null; this.$root = this; this.$$destroyed = false; this.$$listeners = {}; this.$$listenerCount = {}; this.$$isolateBindings = null; } /** * @ngdoc property * @name $rootScope.Scope#$id * * @description * Unique scope ID (monotonically increasing) useful for debugging. */ /** * @ngdoc property * @name $rootScope.Scope#$parent * * @description * Reference to the parent scope. */ /** * @ngdoc property * @name $rootScope.Scope#$root * * @description * Reference to the root scope. */ Scope.prototype = { constructor: Scope, /** * @ngdoc method * @name $rootScope.Scope#$new * @kind function * * @description * Creates a new child {@link ng.$rootScope.Scope scope}. * * The parent scope will propagate the {@link ng.$rootScope.Scope#$digest $digest()} event. * The scope can be removed from the scope hierarchy using {@link ng.$rootScope.Scope#$destroy $destroy()}. * * {@link ng.$rootScope.Scope#$destroy $destroy()} must be called on a scope when it is * desired for the scope and its child scopes to be permanently detached from the parent and * thus stop participating in model change detection and listener notification by invoking. * * @param {boolean} isolate If true, then the scope does not prototypically inherit from the * parent scope. The scope is isolated, as it can not see parent scope properties. * When creating widgets, it is useful for the widget to not accidentally read parent * state. * * @param {Scope} [parent=this] The {@link ng.$rootScope.Scope `Scope`} that will be the `$parent` * of the newly created scope. Defaults to `this` scope if not provided. * This is used when creating a transclude scope to correctly place it * in the scope hierarchy while maintaining the correct prototypical * inheritance. * * @returns {Object} The newly created child scope. * */ $new: function(isolate, parent) { var child; parent = parent || this; if (isolate) { child = new Scope(); child.$root = this.$root; } else { // Only create a child scope class if somebody asks for one, // but cache it to allow the VM to optimize lookups. if (!this.$$ChildScope) { this.$$ChildScope = function ChildScope() { this.$$watchers = this.$$nextSibling = this.$$childHead = this.$$childTail = null; this.$$listeners = {}; this.$$listenerCount = {}; this.$id = nextUid(); this.$$ChildScope = null; }; this.$$ChildScope.prototype = this; } child = new this.$$ChildScope(); } child.$parent = parent; child.$$prevSibling = parent.$$childTail; if (parent.$$childHead) { parent.$$childTail.$$nextSibling = child; parent.$$childTail = child; } else { parent.$$childHead = parent.$$childTail = child; } // When the new scope is not isolated or we inherit from `this`, and // the parent scope is destroyed, the property `$$destroyed` is inherited // prototypically. In all other cases, this property needs to be set // when the parent scope is destroyed. // The listener needs to be added after the parent is set if (isolate || parent != this) child.$on('$destroy', destroyChild); return child; function destroyChild() { child.$$destroyed = true; } }, /** * @ngdoc method * @name $rootScope.Scope#$watch * @kind function * * @description * Registers a `listener` callback to be executed whenever the `watchExpression` changes. * * - The `watchExpression` is called on every call to {@link ng.$rootScope.Scope#$digest * $digest()} and should return the value that will be watched. (Since * {@link ng.$rootScope.Scope#$digest $digest()} reruns when it detects changes the * `watchExpression` can execute multiple times per * {@link ng.$rootScope.Scope#$digest $digest()} and should be idempotent.) * - The `listener` is called only when the value from the current `watchExpression` and the * previous call to `watchExpression` are not equal (with the exception of the initial run, * see below). Inequality is determined according to reference inequality, * [strict comparison](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators) * via the `!==` Javascript operator, unless `objectEquality == true` * (see next point) * - When `objectEquality == true`, inequality of the `watchExpression` is determined * according to the {@link angular.equals} function. To save the value of the object for * later comparison, the {@link angular.copy} function is used. This therefore means that * watching complex objects will have adverse memory and performance implications. * - The watch `listener` may change the model, which may trigger other `listener`s to fire. * This is achieved by rerunning the watchers until no changes are detected. The rerun * iteration limit is 10 to prevent an infinite loop deadlock. * * * If you want to be notified whenever {@link ng.$rootScope.Scope#$digest $digest} is called, * you can register a `watchExpression` function with no `listener`. (Since `watchExpression` * can execute multiple times per {@link ng.$rootScope.Scope#$digest $digest} cycle when a * change is detected, be prepared for multiple calls to your listener.) * * After a watcher is registered with the scope, the `listener` fn is called asynchronously * (via {@link ng.$rootScope.Scope#$evalAsync $evalAsync}) to initialize the * watcher. In rare cases, this is undesirable because the listener is called when the result * of `watchExpression` didn't change. To detect this scenario within the `listener` fn, you * can compare the `newVal` and `oldVal`. If these two values are identical (`===`) then the * listener was called due to initialization. * * * * # Example * ```js // let's assume that scope was dependency injected as the $rootScope var scope = $rootScope; scope.name = 'misko'; scope.counter = 0; expect(scope.counter).toEqual(0); scope.$watch('name', function(newValue, oldValue) { scope.counter = scope.counter + 1; }); expect(scope.counter).toEqual(0); scope.$digest(); // the listener is always called during the first $digest loop after it was registered expect(scope.counter).toEqual(1); scope.$digest(); // but now it will not be called unless the value changes expect(scope.counter).toEqual(1); scope.name = 'adam'; scope.$digest(); expect(scope.counter).toEqual(2); // Using a function as a watchExpression var food; scope.foodCounter = 0; expect(scope.foodCounter).toEqual(0); scope.$watch( // This function returns the value being watched. It is called for each turn of the $digest loop function() { return food; }, // This is the change listener, called when the value returned from the above function changes function(newValue, oldValue) { if ( newValue !== oldValue ) { // Only increment the counter if the value changed scope.foodCounter = scope.foodCounter + 1; } } ); // No digest has been run so the counter will be zero expect(scope.foodCounter).toEqual(0); // Run the digest but since food has not changed count will still be zero scope.$digest(); expect(scope.foodCounter).toEqual(0); // Update food and run digest. Now the counter will increment food = 'cheeseburger'; scope.$digest(); expect(scope.foodCounter).toEqual(1); * ``` * * * * @param {(function()|string)} watchExpression Expression that is evaluated on each * {@link ng.$rootScope.Scope#$digest $digest} cycle. A change in the return value triggers * a call to the `listener`. * * - `string`: Evaluated as {@link guide/expression expression} * - `function(scope)`: called with current `scope` as a parameter. * @param {function(newVal, oldVal, scope)} listener Callback called whenever the value * of `watchExpression` changes. * * - `newVal` contains the current value of the `watchExpression` * - `oldVal` contains the previous value of the `watchExpression` * - `scope` refers to the current scope * @param {boolean=} objectEquality Compare for object equality using {@link angular.equals} instead of * comparing for reference equality. * @returns {function()} Returns a deregistration function for this listener. */ $watch: function(watchExp, listener, objectEquality) { var get = $parse(watchExp); if (get.$$watchDelegate) { return get.$$watchDelegate(this, listener, objectEquality, get); } var scope = this, array = scope.$$watchers, watcher = { fn: listener, last: initWatchVal, get: get, exp: watchExp, eq: !!objectEquality }; lastDirtyWatch = null; if (!isFunction(listener)) { watcher.fn = noop; } if (!array) { array = scope.$$watchers = []; } // we use unshift since we use a while loop in $digest for speed. // the while loop reads in reverse order. array.unshift(watcher); return function deregisterWatch() { arrayRemove(array, watcher); lastDirtyWatch = null; }; }, /** * @ngdoc method * @name $rootScope.Scope#$watchGroup * @kind function * * @description * A variant of {@link ng.$rootScope.Scope#$watch $watch()} where it watches an array of `watchExpressions`. * If any one expression in the collection changes the `listener` is executed. * * - The items in the `watchExpressions` array are observed via standard $watch operation and are examined on every * call to $digest() to see if any items changes. * - The `listener` is called whenever any expression in the `watchExpressions` array changes. * * @param {Array.<string|Function(scope)>} watchExpressions Array of expressions that will be individually * watched using {@link ng.$rootScope.Scope#$watch $watch()} * * @param {function(newValues, oldValues, scope)} listener Callback called whenever the return value of any * expression in `watchExpressions` changes * The `newValues` array contains the current values of the `watchExpressions`, with the indexes matching * those of `watchExpression` * and the `oldValues` array contains the previous values of the `watchExpressions`, with the indexes matching * those of `watchExpression` * The `scope` refers to the current scope. * @returns {function()} Returns a de-registration function for all listeners. */ $watchGroup: function(watchExpressions, listener) { var oldValues = new Array(watchExpressions.length); var newValues = new Array(watchExpressions.length); var deregisterFns = []; var self = this; var changeReactionScheduled = false; var firstRun = true; if (!watchExpressions.length) { // No expressions means we call the listener ASAP var shouldCall = true; self.$evalAsync(function() { if (shouldCall) listener(newValues, newValues, self); }); return function deregisterWatchGroup() { shouldCall = false; }; } if (watchExpressions.length === 1) { // Special case size of one return this.$watch(watchExpressions[0], function watchGroupAction(value, oldValue, scope) { newValues[0] = value; oldValues[0] = oldValue; listener(newValues, (value === oldValue) ? newValues : oldValues, scope); }); } forEach(watchExpressions, function(expr, i) { var unwatchFn = self.$watch(expr, function watchGroupSubAction(value, oldValue) { newValues[i] = value; oldValues[i] = oldValue; if (!changeReactionScheduled) { changeReactionScheduled = true; self.$evalAsync(watchGroupAction); } }); deregisterFns.push(unwatchFn); }); function watchGroupAction() { changeReactionScheduled = false; if (firstRun) { firstRun = false; listener(newValues, newValues, self); } else { listener(newValues, oldValues, self); } } return function deregisterWatchGroup() { while (deregisterFns.length) { deregisterFns.shift()(); } }; }, /** * @ngdoc method * @name $rootScope.Scope#$watchCollection * @kind function * * @description * Shallow watches the properties of an object and fires whenever any of the properties change * (for arrays, this implies watching the array items; for object maps, this implies watching * the properties). If a change is detected, the `listener` callback is fired. * * - The `obj` collection is observed via standard $watch operation and is examined on every * call to $digest() to see if any items have been added, removed, or moved. * - The `listener` is called whenever anything within the `obj` has changed. Examples include * adding, removing, and moving items belonging to an object or array. * * * # Example * ```js $scope.names = ['igor', 'matias', 'misko', 'james']; $scope.dataCount = 4; $scope.$watchCollection('names', function(newNames, oldNames) { $scope.dataCount = newNames.length; }); expect($scope.dataCount).toEqual(4); $scope.$digest(); //still at 4 ... no changes expect($scope.dataCount).toEqual(4); $scope.names.pop(); $scope.$digest(); //now there's been a change expect($scope.dataCount).toEqual(3); * ``` * * * @param {string|function(scope)} obj Evaluated as {@link guide/expression expression}. The * expression value should evaluate to an object or an array which is observed on each * {@link ng.$rootScope.Scope#$digest $digest} cycle. Any shallow change within the * collection will trigger a call to the `listener`. * * @param {function(newCollection, oldCollection, scope)} listener a callback function called * when a change is detected. * - The `newCollection` object is the newly modified data obtained from the `obj` expression * - The `oldCollection` object is a copy of the former collection data. * Due to performance considerations, the`oldCollection` value is computed only if the * `listener` function declares two or more arguments. * - The `scope` argument refers to the current scope. * * @returns {function()} Returns a de-registration function for this listener. When the * de-registration function is executed, the internal watch operation is terminated. */ $watchCollection: function(obj, listener) { $watchCollectionInterceptor.$stateful = true; var self = this; // the current value, updated on each dirty-check run var newValue; // a shallow copy of the newValue from the last dirty-check run, // updated to match newValue during dirty-check run var oldValue; // a shallow copy of the newValue from when the last change happened var veryOldValue; // only track veryOldValue if the listener is asking for it var trackVeryOldValue = (listener.length > 1); var changeDetected = 0; var changeDetector = $parse(obj, $watchCollectionInterceptor); var internalArray = []; var internalObject = {}; var initRun = true; var oldLength = 0; function $watchCollectionInterceptor(_value) { newValue = _value; var newLength, key, bothNaN, newItem, oldItem; // If the new value is undefined, then return undefined as the watch may be a one-time watch if (isUndefined(newValue)) return; if (!isObject(newValue)) { // if primitive if (oldValue !== newValue) { oldValue = newValue; changeDetected++; } } else if (isArrayLike(newValue)) { if (oldValue !== internalArray) { // we are transitioning from something which was not an array into array. oldValue = internalArray; oldLength = oldValue.length = 0; changeDetected++; } newLength = newValue.length; if (oldLength !== newLength) { // if lengths do not match we need to trigger change notification changeDetected++; oldValue.length = oldLength = newLength; } // copy the items to oldValue and look for changes. for (var i = 0; i < newLength; i++) { oldItem = oldValue[i]; newItem = newValue[i]; bothNaN = (oldItem !== oldItem) && (newItem !== newItem); if (!bothNaN && (oldItem !== newItem)) { changeDetected++; oldValue[i] = newItem; } } } else { if (oldValue !== internalObject) { // we are transitioning from something which was not an object into object. oldValue = internalObject = {}; oldLength = 0; changeDetected++; } // copy the items to oldValue and look for changes. newLength = 0; for (key in newValue) { if (newValue.hasOwnProperty(key)) { newLength++; newItem = newValue[key]; oldItem = oldValue[key]; if (key in oldValue) { bothNaN = (oldItem !== oldItem) && (newItem !== newItem); if (!bothNaN && (oldItem !== newItem)) { changeDetected++; oldValue[key] = newItem; } } else { oldLength++; oldValue[key] = newItem; changeDetected++; } } } if (oldLength > newLength) { // we used to have more keys, need to find them and destroy them. changeDetected++; for (key in oldValue) { if (!newValue.hasOwnProperty(key)) { oldLength--; delete oldValue[key]; } } } } return changeDetected; } function $watchCollectionAction() { if (initRun) { initRun = false; listener(newValue, newValue, self); } else { listener(newValue, veryOldValue, self); } // make a copy for the next time a collection is changed if (trackVeryOldValue) { if (!isObject(newValue)) { //primitive veryOldValue = newValue; } else if (isArrayLike(newValue)) { veryOldValue = new Array(newValue.length); for (var i = 0; i < newValue.length; i++) { veryOldValue[i] = newValue[i]; } } else { // if object veryOldValue = {}; for (var key in newValue) { if (hasOwnProperty.call(newValue, key)) { veryOldValue[key] = newValue[key]; } } } } } return this.$watch(changeDetector, $watchCollectionAction); }, /** * @ngdoc method * @name $rootScope.Scope#$digest * @kind function * * @description * Processes all of the {@link ng.$rootScope.Scope#$watch watchers} of the current scope and * its children. Because a {@link ng.$rootScope.Scope#$watch watcher}'s listener can change * the model, the `$digest()` keeps calling the {@link ng.$rootScope.Scope#$watch watchers} * until no more listeners are firing. This means that it is possible to get into an infinite * loop. This function will throw `'Maximum iteration limit exceeded.'` if the number of * iterations exceeds 10. * * Usually, you don't call `$digest()` directly in * {@link ng.directive:ngController controllers} or in * {@link ng.$compileProvider#directive directives}. * Instead, you should call {@link ng.$rootScope.Scope#$apply $apply()} (typically from within * a {@link ng.$compileProvider#directive directive}), which will force a `$digest()`. * * If you want to be notified whenever `$digest()` is called, * you can register a `watchExpression` function with * {@link ng.$rootScope.Scope#$watch $watch()} with no `listener`. * * In unit tests, you may need to call `$digest()` to simulate the scope life cycle. * * # Example * ```js var scope = ...; scope.name = 'misko'; scope.counter = 0; expect(scope.counter).toEqual(0); scope.$watch('name', function(newValue, oldValue) { scope.counter = scope.counter + 1; }); expect(scope.counter).toEqual(0); scope.$digest(); // the listener is always called during the first $digest loop after it was registered expect(scope.counter).toEqual(1); scope.$digest(); // but now it will not be called unless the value changes expect(scope.counter).toEqual(1); scope.name = 'adam'; scope.$digest(); expect(scope.counter).toEqual(2); * ``` * */ $digest: function() { var watch, value, last, watchers, length, dirty, ttl = TTL, next, current, target = this, watchLog = [], logIdx, logMsg, asyncTask; beginPhase('$digest'); // Check for changes to browser url that happened in sync before the call to $digest $browser.$$checkUrlChange(); if (this === $rootScope && applyAsyncId !== null) { // If this is the root scope, and $applyAsync has scheduled a deferred $apply(), then // cancel the scheduled $apply and flush the queue of expressions to be evaluated. $browser.defer.cancel(applyAsyncId); flushApplyAsync(); } lastDirtyWatch = null; do { // "while dirty" loop dirty = false; current = target; while (asyncQueue.length) { try { asyncTask = asyncQueue.shift(); asyncTask.scope.$eval(asyncTask.expression, asyncTask.locals); } catch (e) { $exceptionHandler(e); } lastDirtyWatch = null; } traverseScopesLoop: do { // "traverse the scopes" loop if ((watchers = current.$$watchers)) { // process our watches length = watchers.length; while (length--) { try { watch = watchers[length]; // Most common watches are on primitives, in which case we can short // circuit it with === operator, only when === fails do we use .equals if (watch) { if ((value = watch.get(current)) !== (last = watch.last) && !(watch.eq ? equals(value, last) : (typeof value === 'number' && typeof last === 'number' && isNaN(value) && isNaN(last)))) { dirty = true; lastDirtyWatch = watch; watch.last = watch.eq ? copy(value, null) : value; watch.fn(value, ((last === initWatchVal) ? value : last), current); if (ttl < 5) { logIdx = 4 - ttl; if (!watchLog[logIdx]) watchLog[logIdx] = []; watchLog[logIdx].push({ msg: isFunction(watch.exp) ? 'fn: ' + (watch.exp.name || watch.exp.toString()) : watch.exp, newVal: value, oldVal: last }); } } else if (watch === lastDirtyWatch) { // If the most recently dirty watcher is now clean, short circuit since the remaining watchers // have already been tested. dirty = false; break traverseScopesLoop; } } } catch (e) { $exceptionHandler(e); } } } // Insanity Warning: scope depth-first traversal // yes, this code is a bit crazy, but it works and we have tests to prove it! // this piece should be kept in sync with the traversal in $broadcast if (!(next = (current.$$childHead || (current !== target && current.$$nextSibling)))) { while (current !== target && !(next = current.$$nextSibling)) { current = current.$parent; } } } while ((current = next)); // `break traverseScopesLoop;` takes us to here if ((dirty || asyncQueue.length) && !(ttl--)) { clearPhase(); throw $rootScopeMinErr('infdig', '{0} $digest() iterations reached. Aborting!\n' + 'Watchers fired in the last 5 iterations: {1}', TTL, watchLog); } } while (dirty || asyncQueue.length); clearPhase(); while (postDigestQueue.length) { try { postDigestQueue.shift()(); } catch (e) { $exceptionHandler(e); } } }, /** * @ngdoc event * @name $rootScope.Scope#$destroy * @eventType broadcast on scope being destroyed * * @description * Broadcasted when a scope and its children are being destroyed. * * Note that, in AngularJS, there is also a `$destroy` jQuery event, which can be used to * clean up DOM bindings before an element is removed from the DOM. */ /** * @ngdoc method * @name $rootScope.Scope#$destroy * @kind function * * @description * Removes the current scope (and all of its children) from the parent scope. Removal implies * that calls to {@link ng.$rootScope.Scope#$digest $digest()} will no longer * propagate to the current scope and its children. Removal also implies that the current * scope is eligible for garbage collection. * * The `$destroy()` is usually used by directives such as * {@link ng.directive:ngRepeat ngRepeat} for managing the * unrolling of the loop. * * Just before a scope is destroyed, a `$destroy` event is broadcasted on this scope. * Application code can register a `$destroy` event handler that will give it a chance to * perform any necessary cleanup. * * Note that, in AngularJS, there is also a `$destroy` jQuery event, which can be used to * clean up DOM bindings before an element is removed from the DOM. */ $destroy: function() { // we can't destroy the root scope or a scope that has been already destroyed if (this.$$destroyed) return; var parent = this.$parent; this.$broadcast('$destroy'); this.$$destroyed = true; if (this === $rootScope) return; for (var eventName in this.$$listenerCount) { decrementListenerCount(this, this.$$listenerCount[eventName], eventName); } // sever all the references to parent scopes (after this cleanup, the current scope should // not be retained by any of our references and should be eligible for garbage collection) if (parent.$$childHead == this) parent.$$childHead = this.$$nextSibling; if (parent.$$childTail == this) parent.$$childTail = this.$$prevSibling; if (this.$$prevSibling) this.$$prevSibling.$$nextSibling = this.$$nextSibling; if (this.$$nextSibling) this.$$nextSibling.$$prevSibling = this.$$prevSibling; // Disable listeners, watchers and apply/digest methods this.$destroy = this.$digest = this.$apply = this.$evalAsync = this.$applyAsync = noop; this.$on = this.$watch = this.$watchGroup = function() { return noop; }; this.$$listeners = {}; // All of the code below is bogus code that works around V8's memory leak via optimized code // and inline caches. // // see: // - https://code.google.com/p/v8/issues/detail?id=2073#c26 // - https://github.com/angular/angular.js/issues/6794#issuecomment-38648909 // - https://github.com/angular/angular.js/issues/1313#issuecomment-10378451 this.$parent = this.$$nextSibling = this.$$prevSibling = this.$$childHead = this.$$childTail = this.$root = this.$$watchers = null; }, /** * @ngdoc method * @name $rootScope.Scope#$eval * @kind function * * @description * Executes the `expression` on the current scope and returns the result. Any exceptions in * the expression are propagated (uncaught). This is useful when evaluating Angular * expressions. * * # Example * ```js var scope = ng.$rootScope.Scope(); scope.a = 1; scope.b = 2; expect(scope.$eval('a+b')).toEqual(3); expect(scope.$eval(function(scope){ return scope.a + scope.b; })).toEqual(3); * ``` * * @param {(string|function())=} expression An angular expression to be executed. * * - `string`: execute using the rules as defined in {@link guide/expression expression}. * - `function(scope)`: execute the function with the current `scope` parameter. * * @param {(object)=} locals Local variables object, useful for overriding values in scope. * @returns {*} The result of evaluating the expression. */ $eval: function(expr, locals) { return $parse(expr)(this, locals); }, /** * @ngdoc method * @name $rootScope.Scope#$evalAsync * @kind function * * @description * Executes the expression on the current scope at a later point in time. * * The `$evalAsync` makes no guarantees as to when the `expression` will be executed, only * that: * * - it will execute after the function that scheduled the evaluation (preferably before DOM * rendering). * - at least one {@link ng.$rootScope.Scope#$digest $digest cycle} will be performed after * `expression` execution. * * Any exceptions from the execution of the expression are forwarded to the * {@link ng.$exceptionHandler $exceptionHandler} service. * * __Note:__ if this function is called outside of a `$digest` cycle, a new `$digest` cycle * will be scheduled. However, it is encouraged to always call code that changes the model * from within an `$apply` call. That includes code evaluated via `$evalAsync`. * * @param {(string|function())=} expression An angular expression to be executed. * * - `string`: execute using the rules as defined in {@link guide/expression expression}. * - `function(scope)`: execute the function with the current `scope` parameter. * * @param {(object)=} locals Local variables object, useful for overriding values in scope. */ $evalAsync: function(expr, locals) { // if we are outside of an $digest loop and this is the first time we are scheduling async // task also schedule async auto-flush if (!$rootScope.$$phase && !asyncQueue.length) { $browser.defer(function() { if (asyncQueue.length) { $rootScope.$digest(); } }); } asyncQueue.push({scope: this, expression: expr, locals: locals}); }, $$postDigest: function(fn) { postDigestQueue.push(fn); }, /** * @ngdoc method * @name $rootScope.Scope#$apply * @kind function * * @description * `$apply()` is used to execute an expression in angular from outside of the angular * framework. (For example from browser DOM events, setTimeout, XHR or third party libraries). * Because we are calling into the angular framework we need to perform proper scope life * cycle of {@link ng.$exceptionHandler exception handling}, * {@link ng.$rootScope.Scope#$digest executing watches}. * * ## Life cycle * * # Pseudo-Code of `$apply()` * ```js function $apply(expr) { try { return $eval(expr); } catch (e) { $exceptionHandler(e); } finally { $root.$digest(); } } * ``` * * * Scope's `$apply()` method transitions through the following stages: * * 1. The {@link guide/expression expression} is executed using the * {@link ng.$rootScope.Scope#$eval $eval()} method. * 2. Any exceptions from the execution of the expression are forwarded to the * {@link ng.$exceptionHandler $exceptionHandler} service. * 3. The {@link ng.$rootScope.Scope#$watch watch} listeners are fired immediately after the * expression was executed using the {@link ng.$rootScope.Scope#$digest $digest()} method. * * * @param {(string|function())=} exp An angular expression to be executed. * * - `string`: execute using the rules as defined in {@link guide/expression expression}. * - `function(scope)`: execute the function with current `scope` parameter. * * @returns {*} The result of evaluating the expression. */ $apply: function(expr) { try { beginPhase('$apply'); return this.$eval(expr); } catch (e) { $exceptionHandler(e); } finally { clearPhase(); try { $rootScope.$digest(); } catch (e) { $exceptionHandler(e); throw e; } } }, /** * @ngdoc method * @name $rootScope.Scope#$applyAsync * @kind function * * @description * Schedule the invocation of $apply to occur at a later time. The actual time difference * varies across browsers, but is typically around ~10 milliseconds. * * This can be used to queue up multiple expressions which need to be evaluated in the same * digest. * * @param {(string|function())=} exp An angular expression to be executed. * * - `string`: execute using the rules as defined in {@link guide/expression expression}. * - `function(scope)`: execute the function with current `scope` parameter. */ $applyAsync: function(expr) { var scope = this; expr && applyAsyncQueue.push($applyAsyncExpression); scheduleApplyAsync(); function $applyAsyncExpression() { scope.$eval(expr); } }, /** * @ngdoc method * @name $rootScope.Scope#$on * @kind function * * @description * Listens on events of a given type. See {@link ng.$rootScope.Scope#$emit $emit} for * discussion of event life cycle. * * The event listener function format is: `function(event, args...)`. The `event` object * passed into the listener has the following attributes: * * - `targetScope` - `{Scope}`: the scope on which the event was `$emit`-ed or * `$broadcast`-ed. * - `currentScope` - `{Scope}`: the scope that is currently handling the event. Once the * event propagates through the scope hierarchy, this property is set to null. * - `name` - `{string}`: name of the event. * - `stopPropagation` - `{function=}`: calling `stopPropagation` function will cancel * further event propagation (available only for events that were `$emit`-ed). * - `preventDefault` - `{function}`: calling `preventDefault` sets `defaultPrevented` flag * to true. * - `defaultPrevented` - `{boolean}`: true if `preventDefault` was called. * * @param {string} name Event name to listen on. * @param {function(event, ...args)} listener Function to call when the event is emitted. * @returns {function()} Returns a deregistration function for this listener. */ $on: function(name, listener) { var namedListeners = this.$$listeners[name]; if (!namedListeners) { this.$$listeners[name] = namedListeners = []; } namedListeners.push(listener); var current = this; do { if (!current.$$listenerCount[name]) { current.$$listenerCount[name] = 0; } current.$$listenerCount[name]++; } while ((current = current.$parent)); var self = this; return function() { var indexOfListener = namedListeners.indexOf(listener); if (indexOfListener !== -1) { namedListeners[indexOfListener] = null; decrementListenerCount(self, 1, name); } }; }, /** * @ngdoc method * @name $rootScope.Scope#$emit * @kind function * * @description * Dispatches an event `name` upwards through the scope hierarchy notifying the * registered {@link ng.$rootScope.Scope#$on} listeners. * * The event life cycle starts at the scope on which `$emit` was called. All * {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get * notified. Afterwards, the event traverses upwards toward the root scope and calls all * registered listeners along the way. The event will stop propagating if one of the listeners * cancels it. * * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed * onto the {@link ng.$exceptionHandler $exceptionHandler} service. * * @param {string} name Event name to emit. * @param {...*} args Optional one or more arguments which will be passed onto the event listeners. * @return {Object} Event object (see {@link ng.$rootScope.Scope#$on}). */ $emit: function(name, args) { var empty = [], namedListeners, scope = this, stopPropagation = false, event = { name: name, targetScope: scope, stopPropagation: function() {stopPropagation = true;}, preventDefault: function() { event.defaultPrevented = true; }, defaultPrevented: false }, listenerArgs = concat([event], arguments, 1), i, length; do { namedListeners = scope.$$listeners[name] || empty; event.currentScope = scope; for (i = 0, length = namedListeners.length; i < length; i++) { // if listeners were deregistered, defragment the array if (!namedListeners[i]) { namedListeners.splice(i, 1); i--; length--; continue; } try { //allow all listeners attached to the current scope to run namedListeners[i].apply(null, listenerArgs); } catch (e) { $exceptionHandler(e); } } //if any listener on the current scope stops propagation, prevent bubbling if (stopPropagation) { event.currentScope = null; return event; } //traverse upwards scope = scope.$parent; } while (scope); event.currentScope = null; return event; }, /** * @ngdoc method * @name $rootScope.Scope#$broadcast * @kind function * * @description * Dispatches an event `name` downwards to all child scopes (and their children) notifying the * registered {@link ng.$rootScope.Scope#$on} listeners. * * The event life cycle starts at the scope on which `$broadcast` was called. All * {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get * notified. Afterwards, the event propagates to all direct and indirect scopes of the current * scope and calls all registered listeners along the way. The event cannot be canceled. * * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed * onto the {@link ng.$exceptionHandler $exceptionHandler} service. * * @param {string} name Event name to broadcast. * @param {...*} args Optional one or more arguments which will be passed onto the event listeners. * @return {Object} Event object, see {@link ng.$rootScope.Scope#$on} */ $broadcast: function(name, args) { var target = this, current = target, next = target, event = { name: name, targetScope: target, preventDefault: function() { event.defaultPrevented = true; }, defaultPrevented: false }; if (!target.$$listenerCount[name]) return event; var listenerArgs = concat([event], arguments, 1), listeners, i, length; //down while you can, then up and next sibling or up and next sibling until back at root while ((current = next)) { event.currentScope = current; listeners = current.$$listeners[name] || []; for (i = 0, length = listeners.length; i < length; i++) { // if listeners were deregistered, defragment the array if (!listeners[i]) { listeners.splice(i, 1); i--; length--; continue; } try { listeners[i].apply(null, listenerArgs); } catch (e) { $exceptionHandler(e); } } // Insanity Warning: scope depth-first traversal // yes, this code is a bit crazy, but it works and we have tests to prove it! // this piece should be kept in sync with the traversal in $digest // (though it differs due to having the extra check for $$listenerCount) if (!(next = ((current.$$listenerCount[name] && current.$$childHead) || (current !== target && current.$$nextSibling)))) { while (current !== target && !(next = current.$$nextSibling)) { current = current.$parent; } } } event.currentScope = null; return event; } }; var $rootScope = new Scope(); //The internal queues. Expose them on the $rootScope for debugging/testing purposes. var asyncQueue = $rootScope.$$asyncQueue = []; var postDigestQueue = $rootScope.$$postDigestQueue = []; var applyAsyncQueue = $rootScope.$$applyAsyncQueue = []; return $rootScope; function beginPhase(phase) { if ($rootScope.$$phase) { throw $rootScopeMinErr('inprog', '{0} already in progress', $rootScope.$$phase); } $rootScope.$$phase = phase; } function clearPhase() { $rootScope.$$phase = null; } function decrementListenerCount(current, count, name) { do { current.$$listenerCount[name] -= count; if (current.$$listenerCount[name] === 0) { delete current.$$listenerCount[name]; } } while ((current = current.$parent)); } /** * function used as an initial value for watchers. * because it's unique we can easily tell it apart from other values */ function initWatchVal() {} function flushApplyAsync() { while (applyAsyncQueue.length) { try { applyAsyncQueue.shift()(); } catch (e) { $exceptionHandler(e); } } applyAsyncId = null; } function scheduleApplyAsync() { if (applyAsyncId === null) { applyAsyncId = $browser.defer(function() { $rootScope.$apply(flushApplyAsync); }); } } }]; } /** * @description * Private service to sanitize uris for links and images. Used by $compile and $sanitize. */ function $$SanitizeUriProvider() { var aHrefSanitizationWhitelist = /^\s*(https?|ftp|mailto|tel|file):/, imgSrcSanitizationWhitelist = /^\s*((https?|ftp|file|blob):|data:image\/)/; /** * @description * Retrieves or overrides the default regular expression that is used for whitelisting of safe * urls during a[href] sanitization. * * The sanitization is a security measure aimed at prevent XSS attacks via html links. * * Any url about to be assigned to a[href] via data-binding is first normalized and turned into * an absolute url. Afterwards, the url is matched against the `aHrefSanitizationWhitelist` * regular expression. If a match is found, the original url is written into the dom. Otherwise, * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM. * * @param {RegExp=} regexp New regexp to whitelist urls with. * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for * chaining otherwise. */ this.aHrefSanitizationWhitelist = function(regexp) { if (isDefined(regexp)) { aHrefSanitizationWhitelist = regexp; return this; } return aHrefSanitizationWhitelist; }; /** * @description * Retrieves or overrides the default regular expression that is used for whitelisting of safe * urls during img[src] sanitization. * * The sanitization is a security measure aimed at prevent XSS attacks via html links. * * Any url about to be assigned to img[src] via data-binding is first normalized and turned into * an absolute url. Afterwards, the url is matched against the `imgSrcSanitizationWhitelist` * regular expression. If a match is found, the original url is written into the dom. Otherwise, * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM. * * @param {RegExp=} regexp New regexp to whitelist urls with. * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for * chaining otherwise. */ this.imgSrcSanitizationWhitelist = function(regexp) { if (isDefined(regexp)) { imgSrcSanitizationWhitelist = regexp; return this; } return imgSrcSanitizationWhitelist; }; this.$get = function() { return function sanitizeUri(uri, isImage) { var regex = isImage ? imgSrcSanitizationWhitelist : aHrefSanitizationWhitelist; var normalizedVal; normalizedVal = urlResolve(uri).href; if (normalizedVal !== '' && !normalizedVal.match(regex)) { return 'unsafe:' + normalizedVal; } return uri; }; }; } var $sceMinErr = minErr('$sce'); var SCE_CONTEXTS = { HTML: 'html', CSS: 'css', URL: 'url', // RESOURCE_URL is a subtype of URL used in contexts where a privileged resource is sourced from a // url. (e.g. ng-include, script src, templateUrl) RESOURCE_URL: 'resourceUrl', JS: 'js' }; // Helper functions follow. function adjustMatcher(matcher) { if (matcher === 'self') { return matcher; } else if (isString(matcher)) { // Strings match exactly except for 2 wildcards - '*' and '**'. // '*' matches any character except those from the set ':/.?&'. // '**' matches any character (like .* in a RegExp). // More than 2 *'s raises an error as it's ill defined. if (matcher.indexOf('***') > -1) { throw $sceMinErr('iwcard', 'Illegal sequence *** in string matcher. String: {0}', matcher); } matcher = escapeForRegexp(matcher). replace('\\*\\*', '.*'). replace('\\*', '[^:/.?&;]*'); return new RegExp('^' + matcher + '$'); } else if (isRegExp(matcher)) { // The only other type of matcher allowed is a Regexp. // Match entire URL / disallow partial matches. // Flags are reset (i.e. no global, ignoreCase or multiline) return new RegExp('^' + matcher.source + '$'); } else { throw $sceMinErr('imatcher', 'Matchers may only be "self", string patterns or RegExp objects'); } } function adjustMatchers(matchers) { var adjustedMatchers = []; if (isDefined(matchers)) { forEach(matchers, function(matcher) { adjustedMatchers.push(adjustMatcher(matcher)); }); } return adjustedMatchers; } /** * @ngdoc service * @name $sceDelegate * @kind function * * @description * * `$sceDelegate` is a service that is used by the `$sce` service to provide {@link ng.$sce Strict * Contextual Escaping (SCE)} services to AngularJS. * * Typically, you would configure or override the {@link ng.$sceDelegate $sceDelegate} instead of * the `$sce` service to customize the way Strict Contextual Escaping works in AngularJS. This is * because, while the `$sce` provides numerous shorthand methods, etc., you really only need to * override 3 core functions (`trustAs`, `getTrusted` and `valueOf`) to replace the way things * work because `$sce` delegates to `$sceDelegate` for these operations. * * Refer {@link ng.$sceDelegateProvider $sceDelegateProvider} to configure this service. * * The default instance of `$sceDelegate` should work out of the box with little pain. While you * can override it completely to change the behavior of `$sce`, the common case would * involve configuring the {@link ng.$sceDelegateProvider $sceDelegateProvider} instead by setting * your own whitelists and blacklists for trusting URLs used for loading AngularJS resources such as * templates. Refer {@link ng.$sceDelegateProvider#resourceUrlWhitelist * $sceDelegateProvider.resourceUrlWhitelist} and {@link * ng.$sceDelegateProvider#resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist} */ /** * @ngdoc provider * @name $sceDelegateProvider * @description * * The `$sceDelegateProvider` provider allows developers to configure the {@link ng.$sceDelegate * $sceDelegate} service. This allows one to get/set the whitelists and blacklists used to ensure * that the URLs used for sourcing Angular templates are safe. Refer {@link * ng.$sceDelegateProvider#resourceUrlWhitelist $sceDelegateProvider.resourceUrlWhitelist} and * {@link ng.$sceDelegateProvider#resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist} * * For the general details about this service in Angular, read the main page for {@link ng.$sce * Strict Contextual Escaping (SCE)}. * * **Example**: Consider the following case. <a name="example"></a> * * - your app is hosted at url `http://myapp.example.com/` * - but some of your templates are hosted on other domains you control such as * `http://srv01.assets.example.com/`,  `http://srv02.assets.example.com/`, etc. * - and you have an open redirect at `http://myapp.example.com/clickThru?...`. * * Here is what a secure configuration for this scenario might look like: * * ``` * angular.module('myApp', []).config(function($sceDelegateProvider) { * $sceDelegateProvider.resourceUrlWhitelist([ * // Allow same origin resource loads. * 'self', * // Allow loading from our assets domain. Notice the difference between * and **. * 'http://srv*.assets.example.com/**' * ]); * * // The blacklist overrides the whitelist so the open redirect here is blocked. * $sceDelegateProvider.resourceUrlBlacklist([ * 'http://myapp.example.com/clickThru**' * ]); * }); * ``` */ function $SceDelegateProvider() { this.SCE_CONTEXTS = SCE_CONTEXTS; // Resource URLs can also be trusted by policy. var resourceUrlWhitelist = ['self'], resourceUrlBlacklist = []; /** * @ngdoc method * @name $sceDelegateProvider#resourceUrlWhitelist * @kind function * * @param {Array=} whitelist When provided, replaces the resourceUrlWhitelist with the value * provided. This must be an array or null. A snapshot of this array is used so further * changes to the array are ignored. * * Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items * allowed in this array. * * Note: **an empty whitelist array will block all URLs**! * * @return {Array} the currently set whitelist array. * * The **default value** when no whitelist has been explicitly set is `['self']` allowing only * same origin resource requests. * * @description * Sets/Gets the whitelist of trusted resource URLs. */ this.resourceUrlWhitelist = function(value) { if (arguments.length) { resourceUrlWhitelist = adjustMatchers(value); } return resourceUrlWhitelist; }; /** * @ngdoc method * @name $sceDelegateProvider#resourceUrlBlacklist * @kind function * * @param {Array=} blacklist When provided, replaces the resourceUrlBlacklist with the value * provided. This must be an array or null. A snapshot of this array is used so further * changes to the array are ignored. * * Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items * allowed in this array. * * The typical usage for the blacklist is to **block * [open redirects](http://cwe.mitre.org/data/definitions/601.html)** served by your domain as * these would otherwise be trusted but actually return content from the redirected domain. * * Finally, **the blacklist overrides the whitelist** and has the final say. * * @return {Array} the currently set blacklist array. * * The **default value** when no whitelist has been explicitly set is the empty array (i.e. there * is no blacklist.) * * @description * Sets/Gets the blacklist of trusted resource URLs. */ this.resourceUrlBlacklist = function(value) { if (arguments.length) { resourceUrlBlacklist = adjustMatchers(value); } return resourceUrlBlacklist; }; this.$get = ['$injector', function($injector) { var htmlSanitizer = function htmlSanitizer(html) { throw $sceMinErr('unsafe', 'Attempting to use an unsafe value in a safe context.'); }; if ($injector.has('$sanitize')) { htmlSanitizer = $injector.get('$sanitize'); } function matchUrl(matcher, parsedUrl) { if (matcher === 'self') { return urlIsSameOrigin(parsedUrl); } else { // definitely a regex. See adjustMatchers() return !!matcher.exec(parsedUrl.href); } } function isResourceUrlAllowedByPolicy(url) { var parsedUrl = urlResolve(url.toString()); var i, n, allowed = false; // Ensure that at least one item from the whitelist allows this url. for (i = 0, n = resourceUrlWhitelist.length; i < n; i++) { if (matchUrl(resourceUrlWhitelist[i], parsedUrl)) { allowed = true; break; } } if (allowed) { // Ensure that no item from the blacklist blocked this url. for (i = 0, n = resourceUrlBlacklist.length; i < n; i++) { if (matchUrl(resourceUrlBlacklist[i], parsedUrl)) { allowed = false; break; } } } return allowed; } function generateHolderType(Base) { var holderType = function TrustedValueHolderType(trustedValue) { this.$$unwrapTrustedValue = function() { return trustedValue; }; }; if (Base) { holderType.prototype = new Base(); } holderType.prototype.valueOf = function sceValueOf() { return this.$$unwrapTrustedValue(); }; holderType.prototype.toString = function sceToString() { return this.$$unwrapTrustedValue().toString(); }; return holderType; } var trustedValueHolderBase = generateHolderType(), byType = {}; byType[SCE_CONTEXTS.HTML] = generateHolderType(trustedValueHolderBase); byType[SCE_CONTEXTS.CSS] = generateHolderType(trustedValueHolderBase); byType[SCE_CONTEXTS.URL] = generateHolderType(trustedValueHolderBase); byType[SCE_CONTEXTS.JS] = generateHolderType(trustedValueHolderBase); byType[SCE_CONTEXTS.RESOURCE_URL] = generateHolderType(byType[SCE_CONTEXTS.URL]); /** * @ngdoc method * @name $sceDelegate#trustAs * * @description * Returns an object that is trusted by angular for use in specified strict * contextual escaping contexts (such as ng-bind-html, ng-include, any src * attribute interpolation, any dom event binding attribute interpolation * such as for onclick, etc.) that uses the provided value. * See {@link ng.$sce $sce} for enabling strict contextual escaping. * * @param {string} type The kind of context in which this value is safe for use. e.g. url, * resourceUrl, html, js and css. * @param {*} value The value that that should be considered trusted/safe. * @returns {*} A value that can be used to stand in for the provided `value` in places * where Angular expects a $sce.trustAs() return value. */ function trustAs(type, trustedValue) { var Constructor = (byType.hasOwnProperty(type) ? byType[type] : null); if (!Constructor) { throw $sceMinErr('icontext', 'Attempted to trust a value in invalid context. Context: {0}; Value: {1}', type, trustedValue); } if (trustedValue === null || trustedValue === undefined || trustedValue === '') { return trustedValue; } // All the current contexts in SCE_CONTEXTS happen to be strings. In order to avoid trusting // mutable objects, we ensure here that the value passed in is actually a string. if (typeof trustedValue !== 'string') { throw $sceMinErr('itype', 'Attempted to trust a non-string value in a content requiring a string: Context: {0}', type); } return new Constructor(trustedValue); } /** * @ngdoc method * @name $sceDelegate#valueOf * * @description * If the passed parameter had been returned by a prior call to {@link ng.$sceDelegate#trustAs * `$sceDelegate.trustAs`}, returns the value that had been passed to {@link * ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}. * * If the passed parameter is not a value that had been returned by {@link * ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}, returns it as-is. * * @param {*} value The result of a prior {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`} * call or anything else. * @returns {*} The `value` that was originally provided to {@link ng.$sceDelegate#trustAs * `$sceDelegate.trustAs`} if `value` is the result of such a call. Otherwise, returns * `value` unchanged. */ function valueOf(maybeTrusted) { if (maybeTrusted instanceof trustedValueHolderBase) { return maybeTrusted.$$unwrapTrustedValue(); } else { return maybeTrusted; } } /** * @ngdoc method * @name $sceDelegate#getTrusted * * @description * Takes the result of a {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`} call and * returns the originally supplied value if the queried context type is a supertype of the * created type. If this condition isn't satisfied, throws an exception. * * @param {string} type The kind of context in which this value is to be used. * @param {*} maybeTrusted The result of a prior {@link ng.$sceDelegate#trustAs * `$sceDelegate.trustAs`} call. * @returns {*} The value the was originally provided to {@link ng.$sceDelegate#trustAs * `$sceDelegate.trustAs`} if valid in this context. Otherwise, throws an exception. */ function getTrusted(type, maybeTrusted) { if (maybeTrusted === null || maybeTrusted === undefined || maybeTrusted === '') { return maybeTrusted; } var constructor = (byType.hasOwnProperty(type) ? byType[type] : null); if (constructor && maybeTrusted instanceof constructor) { return maybeTrusted.$$unwrapTrustedValue(); } // If we get here, then we may only take one of two actions. // 1. sanitize the value for the requested type, or // 2. throw an exception. if (type === SCE_CONTEXTS.RESOURCE_URL) { if (isResourceUrlAllowedByPolicy(maybeTrusted)) { return maybeTrusted; } else { throw $sceMinErr('insecurl', 'Blocked loading resource from url not allowed by $sceDelegate policy. URL: {0}', maybeTrusted.toString()); } } else if (type === SCE_CONTEXTS.HTML) { return htmlSanitizer(maybeTrusted); } throw $sceMinErr('unsafe', 'Attempting to use an unsafe value in a safe context.'); } return { trustAs: trustAs, getTrusted: getTrusted, valueOf: valueOf }; }]; } /** * @ngdoc provider * @name $sceProvider * @description * * The $sceProvider provider allows developers to configure the {@link ng.$sce $sce} service. * - enable/disable Strict Contextual Escaping (SCE) in a module * - override the default implementation with a custom delegate * * Read more about {@link ng.$sce Strict Contextual Escaping (SCE)}. */ /* jshint maxlen: false*/ /** * @ngdoc service * @name $sce * @kind function * * @description * * `$sce` is a service that provides Strict Contextual Escaping services to AngularJS. * * # Strict Contextual Escaping * * Strict Contextual Escaping (SCE) is a mode in which AngularJS requires bindings in certain * contexts to result in a value that is marked as safe to use for that context. One example of * such a context is binding arbitrary html controlled by the user via `ng-bind-html`. We refer * to these contexts as privileged or SCE contexts. * * As of version 1.2, Angular ships with SCE enabled by default. * * Note: When enabled (the default), IE<11 in quirks mode is not supported. In this mode, IE<11 allow * one to execute arbitrary javascript by the use of the expression() syntax. Refer * <http://blogs.msdn.com/b/ie/archive/2008/10/16/ending-expressions.aspx> to learn more about them. * You can ensure your document is in standards mode and not quirks mode by adding `<!doctype html>` * to the top of your HTML document. * * SCE assists in writing code in way that (a) is secure by default and (b) makes auditing for * security vulnerabilities such as XSS, clickjacking, etc. a lot easier. * * Here's an example of a binding in a privileged context: * * ``` * <input ng-model="userHtml"> * <div ng-bind-html="userHtml"></div> * ``` * * Notice that `ng-bind-html` is bound to `userHtml` controlled by the user. With SCE * disabled, this application allows the user to render arbitrary HTML into the DIV. * In a more realistic example, one may be rendering user comments, blog articles, etc. via * bindings. (HTML is just one example of a context where rendering user controlled input creates * security vulnerabilities.) * * For the case of HTML, you might use a library, either on the client side, or on the server side, * to sanitize unsafe HTML before binding to the value and rendering it in the document. * * How would you ensure that every place that used these types of bindings was bound to a value that * was sanitized by your library (or returned as safe for rendering by your server?) How can you * ensure that you didn't accidentally delete the line that sanitized the value, or renamed some * properties/fields and forgot to update the binding to the sanitized value? * * To be secure by default, you want to ensure that any such bindings are disallowed unless you can * determine that something explicitly says it's safe to use a value for binding in that * context. You can then audit your code (a simple grep would do) to ensure that this is only done * for those values that you can easily tell are safe - because they were received from your server, * sanitized by your library, etc. You can organize your codebase to help with this - perhaps * allowing only the files in a specific directory to do this. Ensuring that the internal API * exposed by that code doesn't markup arbitrary values as safe then becomes a more manageable task. * * In the case of AngularJS' SCE service, one uses {@link ng.$sce#trustAs $sce.trustAs} * (and shorthand methods such as {@link ng.$sce#trustAsHtml $sce.trustAsHtml}, etc.) to * obtain values that will be accepted by SCE / privileged contexts. * * * ## How does it work? * * In privileged contexts, directives and code will bind to the result of {@link ng.$sce#getTrusted * $sce.getTrusted(context, value)} rather than to the value directly. Directives use {@link * ng.$sce#parseAs $sce.parseAs} rather than `$parse` to watch attribute bindings, which performs the * {@link ng.$sce#getTrusted $sce.getTrusted} behind the scenes on non-constant literals. * * As an example, {@link ng.directive:ngBindHtml ngBindHtml} uses {@link * ng.$sce#parseAsHtml $sce.parseAsHtml(binding expression)}. Here's the actual code (slightly * simplified): * * ``` * var ngBindHtmlDirective = ['$sce', function($sce) { * return function(scope, element, attr) { * scope.$watch($sce.parseAsHtml(attr.ngBindHtml), function(value) { * element.html(value || ''); * }); * }; * }]; * ``` * * ## Impact on loading templates * * This applies both to the {@link ng.directive:ngInclude `ng-include`} directive as well as * `templateUrl`'s specified by {@link guide/directive directives}. * * By default, Angular only loads templates from the same domain and protocol as the application * document. This is done by calling {@link ng.$sce#getTrustedResourceUrl * $sce.getTrustedResourceUrl} on the template URL. To load templates from other domains and/or * protocols, you may either either {@link ng.$sceDelegateProvider#resourceUrlWhitelist whitelist * them} or {@link ng.$sce#trustAsResourceUrl wrap it} into a trusted value. * * *Please note*: * The browser's * [Same Origin Policy](https://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_XMLHttpRequest) * and [Cross-Origin Resource Sharing (CORS)](http://www.w3.org/TR/cors/) * policy apply in addition to this and may further restrict whether the template is successfully * loaded. This means that without the right CORS policy, loading templates from a different domain * won't work on all browsers. Also, loading templates from `file://` URL does not work on some * browsers. * * ## This feels like too much overhead * * It's important to remember that SCE only applies to interpolation expressions. * * If your expressions are constant literals, they're automatically trusted and you don't need to * call `$sce.trustAs` on them (remember to include the `ngSanitize` module) (e.g. * `<div ng-bind-html="'<b>implicitly trusted</b>'"></div>`) just works. * * Additionally, `a[href]` and `img[src]` automatically sanitize their URLs and do not pass them * through {@link ng.$sce#getTrusted $sce.getTrusted}. SCE doesn't play a role here. * * The included {@link ng.$sceDelegate $sceDelegate} comes with sane defaults to allow you to load * templates in `ng-include` from your application's domain without having to even know about SCE. * It blocks loading templates from other domains or loading templates over http from an https * served document. You can change these by setting your own custom {@link * ng.$sceDelegateProvider#resourceUrlWhitelist whitelists} and {@link * ng.$sceDelegateProvider#resourceUrlBlacklist blacklists} for matching such URLs. * * This significantly reduces the overhead. It is far easier to pay the small overhead and have an * application that's secure and can be audited to verify that with much more ease than bolting * security onto an application later. * * <a name="contexts"></a> * ## What trusted context types are supported? * * | Context | Notes | * |---------------------|----------------| * | `$sce.HTML` | For HTML that's safe to source into the application. The {@link ng.directive:ngBindHtml ngBindHtml} directive uses this context for bindings. If an unsafe value is encountered and the {@link ngSanitize $sanitize} module is present this will sanitize the value instead of throwing an error. | * | `$sce.CSS` | For CSS that's safe to source into the application. Currently unused. Feel free to use it in your own directives. | * | `$sce.URL` | For URLs that are safe to follow as links. Currently unused (`<a href=` and `<img src=` sanitize their urls and don't constitute an SCE context. | * | `$sce.RESOURCE_URL` | For URLs that are not only safe to follow as links, but whose contents are also safe to include in your application. Examples include `ng-include`, `src` / `ngSrc` bindings for tags other than `IMG` (e.g. `IFRAME`, `OBJECT`, etc.) <br><br>Note that `$sce.RESOURCE_URL` makes a stronger statement about the URL than `$sce.URL` does and therefore contexts requiring values trusted for `$sce.RESOURCE_URL` can be used anywhere that values trusted for `$sce.URL` are required. | * | `$sce.JS` | For JavaScript that is safe to execute in your application's context. Currently unused. Feel free to use it in your own directives. | * * ## Format of items in {@link ng.$sceDelegateProvider#resourceUrlWhitelist resourceUrlWhitelist}/{@link ng.$sceDelegateProvider#resourceUrlBlacklist Blacklist} <a name="resourceUrlPatternItem"></a> * * Each element in these arrays must be one of the following: * * - **'self'** * - The special **string**, `'self'`, can be used to match against all URLs of the **same * domain** as the application document using the **same protocol**. * - **String** (except the special value `'self'`) * - The string is matched against the full *normalized / absolute URL* of the resource * being tested (substring matches are not good enough.) * - There are exactly **two wildcard sequences** - `*` and `**`. All other characters * match themselves. * - `*`: matches zero or more occurrences of any character other than one of the following 6 * characters: '`:`', '`/`', '`.`', '`?`', '`&`' and ';'. It's a useful wildcard for use * in a whitelist. * - `**`: matches zero or more occurrences of *any* character. As such, it's not * not appropriate to use in for a scheme, domain, etc. as it would match too much. (e.g. * http://**.example.com/ would match http://evil.com/?ignore=.example.com/ and that might * not have been the intention.) Its usage at the very end of the path is ok. (e.g. * http://foo.example.com/templates/**). * - **RegExp** (*see caveat below*) * - *Caveat*: While regular expressions are powerful and offer great flexibility, their syntax * (and all the inevitable escaping) makes them *harder to maintain*. It's easy to * accidentally introduce a bug when one updates a complex expression (imho, all regexes should * have good test coverage.). For instance, the use of `.` in the regex is correct only in a * small number of cases. A `.` character in the regex used when matching the scheme or a * subdomain could be matched against a `:` or literal `.` that was likely not intended. It * is highly recommended to use the string patterns and only fall back to regular expressions * if they as a last resort. * - The regular expression must be an instance of RegExp (i.e. not a string.) It is * matched against the **entire** *normalized / absolute URL* of the resource being tested * (even when the RegExp did not have the `^` and `$` codes.) In addition, any flags * present on the RegExp (such as multiline, global, ignoreCase) are ignored. * - If you are generating your JavaScript from some other templating engine (not * recommended, e.g. in issue [#4006](https://github.com/angular/angular.js/issues/4006)), * remember to escape your regular expression (and be aware that you might need more than * one level of escaping depending on your templating engine and the way you interpolated * the value.) Do make use of your platform's escaping mechanism as it might be good * enough before coding your own. e.g. Ruby has * [Regexp.escape(str)](http://www.ruby-doc.org/core-2.0.0/Regexp.html#method-c-escape) * and Python has [re.escape](http://docs.python.org/library/re.html#re.escape). * Javascript lacks a similar built in function for escaping. Take a look at Google * Closure library's [goog.string.regExpEscape(s)]( * http://docs.closure-library.googlecode.com/git/closure_goog_string_string.js.source.html#line962). * * Refer {@link ng.$sceDelegateProvider $sceDelegateProvider} for an example. * * ## Show me an example using SCE. * * <example module="mySceApp" deps="angular-sanitize.js"> * <file name="index.html"> * <div ng-controller="AppController as myCtrl"> * <i ng-bind-html="myCtrl.explicitlyTrustedHtml" id="explicitlyTrustedHtml"></i><br><br> * <b>User comments</b><br> * By default, HTML that isn't explicitly trusted (e.g. Alice's comment) is sanitized when * $sanitize is available. If $sanitize isn't available, this results in an error instead of an * exploit. * <div class="well"> * <div ng-repeat="userComment in myCtrl.userComments"> * <b>{{userComment.name}}</b>: * <span ng-bind-html="userComment.htmlComment" class="htmlComment"></span> * <br> * </div> * </div> * </div> * </file> * * <file name="script.js"> * angular.module('mySceApp', ['ngSanitize']) * .controller('AppController', ['$http', '$templateCache', '$sce', * function($http, $templateCache, $sce) { * var self = this; * $http.get("test_data.json", {cache: $templateCache}).success(function(userComments) { * self.userComments = userComments; * }); * self.explicitlyTrustedHtml = $sce.trustAsHtml( * '<span onmouseover="this.textContent=&quot;Explicitly trusted HTML bypasses ' + * 'sanitization.&quot;">Hover over this text.</span>'); * }]); * </file> * * <file name="test_data.json"> * [ * { "name": "Alice", * "htmlComment": * "<span onmouseover='this.textContent=\"PWN3D!\"'>Is <i>anyone</i> reading this?</span>" * }, * { "name": "Bob", * "htmlComment": "<i>Yes!</i> Am I the only other one?" * } * ] * </file> * * <file name="protractor.js" type="protractor"> * describe('SCE doc demo', function() { * it('should sanitize untrusted values', function() { * expect(element.all(by.css('.htmlComment')).first().getInnerHtml()) * .toBe('<span>Is <i>anyone</i> reading this?</span>'); * }); * * it('should NOT sanitize explicitly trusted values', function() { * expect(element(by.id('explicitlyTrustedHtml')).getInnerHtml()).toBe( * '<span onmouseover="this.textContent=&quot;Explicitly trusted HTML bypasses ' + * 'sanitization.&quot;">Hover over this text.</span>'); * }); * }); * </file> * </example> * * * * ## Can I disable SCE completely? * * Yes, you can. However, this is strongly discouraged. SCE gives you a lot of security benefits * for little coding overhead. It will be much harder to take an SCE disabled application and * either secure it on your own or enable SCE at a later stage. It might make sense to disable SCE * for cases where you have a lot of existing code that was written before SCE was introduced and * you're migrating them a module at a time. * * That said, here's how you can completely disable SCE: * * ``` * angular.module('myAppWithSceDisabledmyApp', []).config(function($sceProvider) { * // Completely disable SCE. For demonstration purposes only! * // Do not use in new projects. * $sceProvider.enabled(false); * }); * ``` * */ /* jshint maxlen: 100 */ function $SceProvider() { var enabled = true; /** * @ngdoc method * @name $sceProvider#enabled * @kind function * * @param {boolean=} value If provided, then enables/disables SCE. * @return {boolean} true if SCE is enabled, false otherwise. * * @description * Enables/disables SCE and returns the current value. */ this.enabled = function(value) { if (arguments.length) { enabled = !!value; } return enabled; }; /* Design notes on the default implementation for SCE. * * The API contract for the SCE delegate * ------------------------------------- * The SCE delegate object must provide the following 3 methods: * * - trustAs(contextEnum, value) * This method is used to tell the SCE service that the provided value is OK to use in the * contexts specified by contextEnum. It must return an object that will be accepted by * getTrusted() for a compatible contextEnum and return this value. * * - valueOf(value) * For values that were not produced by trustAs(), return them as is. For values that were * produced by trustAs(), return the corresponding input value to trustAs. Basically, if * trustAs is wrapping the given values into some type, this operation unwraps it when given * such a value. * * - getTrusted(contextEnum, value) * This function should return the a value that is safe to use in the context specified by * contextEnum or throw and exception otherwise. * * NOTE: This contract deliberately does NOT state that values returned by trustAs() must be * opaque or wrapped in some holder object. That happens to be an implementation detail. For * instance, an implementation could maintain a registry of all trusted objects by context. In * such a case, trustAs() would return the same object that was passed in. getTrusted() would * return the same object passed in if it was found in the registry under a compatible context or * throw an exception otherwise. An implementation might only wrap values some of the time based * on some criteria. getTrusted() might return a value and not throw an exception for special * constants or objects even if not wrapped. All such implementations fulfill this contract. * * * A note on the inheritance model for SCE contexts * ------------------------------------------------ * I've used inheritance and made RESOURCE_URL wrapped types a subtype of URL wrapped types. This * is purely an implementation details. * * The contract is simply this: * * getTrusted($sce.RESOURCE_URL, value) succeeding implies that getTrusted($sce.URL, value) * will also succeed. * * Inheritance happens to capture this in a natural way. In some future, we * may not use inheritance anymore. That is OK because no code outside of * sce.js and sceSpecs.js would need to be aware of this detail. */ this.$get = ['$parse', '$sceDelegate', function( $parse, $sceDelegate) { // Prereq: Ensure that we're not running in IE<11 quirks mode. In that mode, IE < 11 allow // the "expression(javascript expression)" syntax which is insecure. if (enabled && msie < 8) { throw $sceMinErr('iequirks', 'Strict Contextual Escaping does not support Internet Explorer version < 11 in quirks ' + 'mode. You can fix this by adding the text <!doctype html> to the top of your HTML ' + 'document. See http://docs.angularjs.org/api/ng.$sce for more information.'); } var sce = shallowCopy(SCE_CONTEXTS); /** * @ngdoc method * @name $sce#isEnabled * @kind function * * @return {Boolean} true if SCE is enabled, false otherwise. If you want to set the value, you * have to do it at module config time on {@link ng.$sceProvider $sceProvider}. * * @description * Returns a boolean indicating if SCE is enabled. */ sce.isEnabled = function() { return enabled; }; sce.trustAs = $sceDelegate.trustAs; sce.getTrusted = $sceDelegate.getTrusted; sce.valueOf = $sceDelegate.valueOf; if (!enabled) { sce.trustAs = sce.getTrusted = function(type, value) { return value; }; sce.valueOf = identity; } /** * @ngdoc method * @name $sce#parseAs * * @description * Converts Angular {@link guide/expression expression} into a function. This is like {@link * ng.$parse $parse} and is identical when the expression is a literal constant. Otherwise, it * wraps the expression in a call to {@link ng.$sce#getTrusted $sce.getTrusted(*type*, * *result*)} * * @param {string} type The kind of SCE context in which this result will be used. * @param {string} expression String expression to compile. * @returns {function(context, locals)} a function which represents the compiled expression: * * * `context` – `{object}` – an object against which any expressions embedded in the strings * are evaluated against (typically a scope object). * * `locals` – `{object=}` – local variables context object, useful for overriding values in * `context`. */ sce.parseAs = function sceParseAs(type, expr) { var parsed = $parse(expr); if (parsed.literal && parsed.constant) { return parsed; } else { return $parse(expr, function(value) { return sce.getTrusted(type, value); }); } }; /** * @ngdoc method * @name $sce#trustAs * * @description * Delegates to {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}. As such, * returns an object that is trusted by angular for use in specified strict contextual * escaping contexts (such as ng-bind-html, ng-include, any src attribute * interpolation, any dom event binding attribute interpolation such as for onclick, etc.) * that uses the provided value. See * {@link ng.$sce $sce} for enabling strict contextual * escaping. * * @param {string} type The kind of context in which this value is safe for use. e.g. url, * resource_url, html, js and css. * @param {*} value The value that that should be considered trusted/safe. * @returns {*} A value that can be used to stand in for the provided `value` in places * where Angular expects a $sce.trustAs() return value. */ /** * @ngdoc method * @name $sce#trustAsHtml * * @description * Shorthand method. `$sce.trustAsHtml(value)` → * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.HTML, value)`} * * @param {*} value The value to trustAs. * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedHtml * $sce.getTrustedHtml(value)} to obtain the original value. (privileged directives * only accept expressions that are either literal constants or are the * return value of {@link ng.$sce#trustAs $sce.trustAs}.) */ /** * @ngdoc method * @name $sce#trustAsUrl * * @description * Shorthand method. `$sce.trustAsUrl(value)` → * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.URL, value)`} * * @param {*} value The value to trustAs. * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedUrl * $sce.getTrustedUrl(value)} to obtain the original value. (privileged directives * only accept expressions that are either literal constants or are the * return value of {@link ng.$sce#trustAs $sce.trustAs}.) */ /** * @ngdoc method * @name $sce#trustAsResourceUrl * * @description * Shorthand method. `$sce.trustAsResourceUrl(value)` → * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.RESOURCE_URL, value)`} * * @param {*} value The value to trustAs. * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedResourceUrl * $sce.getTrustedResourceUrl(value)} to obtain the original value. (privileged directives * only accept expressions that are either literal constants or are the return * value of {@link ng.$sce#trustAs $sce.trustAs}.) */ /** * @ngdoc method * @name $sce#trustAsJs * * @description * Shorthand method. `$sce.trustAsJs(value)` → * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.JS, value)`} * * @param {*} value The value to trustAs. * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedJs * $sce.getTrustedJs(value)} to obtain the original value. (privileged directives * only accept expressions that are either literal constants or are the * return value of {@link ng.$sce#trustAs $sce.trustAs}.) */ /** * @ngdoc method * @name $sce#getTrusted * * @description * Delegates to {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted`}. As such, * takes the result of a {@link ng.$sce#trustAs `$sce.trustAs`}() call and returns the * originally supplied value if the queried context type is a supertype of the created type. * If this condition isn't satisfied, throws an exception. * * @param {string} type The kind of context in which this value is to be used. * @param {*} maybeTrusted The result of a prior {@link ng.$sce#trustAs `$sce.trustAs`} * call. * @returns {*} The value the was originally provided to * {@link ng.$sce#trustAs `$sce.trustAs`} if valid in this context. * Otherwise, throws an exception. */ /** * @ngdoc method * @name $sce#getTrustedHtml * * @description * Shorthand method. `$sce.getTrustedHtml(value)` → * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.HTML, value)`} * * @param {*} value The value to pass to `$sce.getTrusted`. * @returns {*} The return value of `$sce.getTrusted($sce.HTML, value)` */ /** * @ngdoc method * @name $sce#getTrustedCss * * @description * Shorthand method. `$sce.getTrustedCss(value)` → * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.CSS, value)`} * * @param {*} value The value to pass to `$sce.getTrusted`. * @returns {*} The return value of `$sce.getTrusted($sce.CSS, value)` */ /** * @ngdoc method * @name $sce#getTrustedUrl * * @description * Shorthand method. `$sce.getTrustedUrl(value)` → * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.URL, value)`} * * @param {*} value The value to pass to `$sce.getTrusted`. * @returns {*} The return value of `$sce.getTrusted($sce.URL, value)` */ /** * @ngdoc method * @name $sce#getTrustedResourceUrl * * @description * Shorthand method. `$sce.getTrustedResourceUrl(value)` → * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.RESOURCE_URL, value)`} * * @param {*} value The value to pass to `$sceDelegate.getTrusted`. * @returns {*} The return value of `$sce.getTrusted($sce.RESOURCE_URL, value)` */ /** * @ngdoc method * @name $sce#getTrustedJs * * @description * Shorthand method. `$sce.getTrustedJs(value)` → * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.JS, value)`} * * @param {*} value The value to pass to `$sce.getTrusted`. * @returns {*} The return value of `$sce.getTrusted($sce.JS, value)` */ /** * @ngdoc method * @name $sce#parseAsHtml * * @description * Shorthand method. `$sce.parseAsHtml(expression string)` → * {@link ng.$sce#parseAs `$sce.parseAs($sce.HTML, value)`} * * @param {string} expression String expression to compile. * @returns {function(context, locals)} a function which represents the compiled expression: * * * `context` – `{object}` – an object against which any expressions embedded in the strings * are evaluated against (typically a scope object). * * `locals` – `{object=}` – local variables context object, useful for overriding values in * `context`. */ /** * @ngdoc method * @name $sce#parseAsCss * * @description * Shorthand method. `$sce.parseAsCss(value)` → * {@link ng.$sce#parseAs `$sce.parseAs($sce.CSS, value)`} * * @param {string} expression String expression to compile. * @returns {function(context, locals)} a function which represents the compiled expression: * * * `context` – `{object}` – an object against which any expressions embedded in the strings * are evaluated against (typically a scope object). * * `locals` – `{object=}` – local variables context object, useful for overriding values in * `context`. */ /** * @ngdoc method * @name $sce#parseAsUrl * * @description * Shorthand method. `$sce.parseAsUrl(value)` → * {@link ng.$sce#parseAs `$sce.parseAs($sce.URL, value)`} * * @param {string} expression String expression to compile. * @returns {function(context, locals)} a function which represents the compiled expression: * * * `context` – `{object}` – an object against which any expressions embedded in the strings * are evaluated against (typically a scope object). * * `locals` – `{object=}` – local variables context object, useful for overriding values in * `context`. */ /** * @ngdoc method * @name $sce#parseAsResourceUrl * * @description * Shorthand method. `$sce.parseAsResourceUrl(value)` → * {@link ng.$sce#parseAs `$sce.parseAs($sce.RESOURCE_URL, value)`} * * @param {string} expression String expression to compile. * @returns {function(context, locals)} a function which represents the compiled expression: * * * `context` – `{object}` – an object against which any expressions embedded in the strings * are evaluated against (typically a scope object). * * `locals` – `{object=}` – local variables context object, useful for overriding values in * `context`. */ /** * @ngdoc method * @name $sce#parseAsJs * * @description * Shorthand method. `$sce.parseAsJs(value)` → * {@link ng.$sce#parseAs `$sce.parseAs($sce.JS, value)`} * * @param {string} expression String expression to compile. * @returns {function(context, locals)} a function which represents the compiled expression: * * * `context` – `{object}` – an object against which any expressions embedded in the strings * are evaluated against (typically a scope object). * * `locals` – `{object=}` – local variables context object, useful for overriding values in * `context`. */ // Shorthand delegations. var parse = sce.parseAs, getTrusted = sce.getTrusted, trustAs = sce.trustAs; forEach(SCE_CONTEXTS, function(enumValue, name) { var lName = lowercase(name); sce[camelCase("parse_as_" + lName)] = function(expr) { return parse(enumValue, expr); }; sce[camelCase("get_trusted_" + lName)] = function(value) { return getTrusted(enumValue, value); }; sce[camelCase("trust_as_" + lName)] = function(value) { return trustAs(enumValue, value); }; }); return sce; }]; } /** * !!! This is an undocumented "private" service !!! * * @name $sniffer * @requires $window * @requires $document * * @property {boolean} history Does the browser support html5 history api ? * @property {boolean} transitions Does the browser support CSS transition events ? * @property {boolean} animations Does the browser support CSS animation events ? * * @description * This is very simple implementation of testing browser's features. */ function $SnifferProvider() { this.$get = ['$window', '$document', function($window, $document) { var eventSupport = {}, android = int((/android (\d+)/.exec(lowercase(($window.navigator || {}).userAgent)) || [])[1]), boxee = /Boxee/i.test(($window.navigator || {}).userAgent), document = $document[0] || {}, vendorPrefix, vendorRegex = /^(Moz|webkit|ms)(?=[A-Z])/, bodyStyle = document.body && document.body.style, transitions = false, animations = false, match; if (bodyStyle) { for (var prop in bodyStyle) { if (match = vendorRegex.exec(prop)) { vendorPrefix = match[0]; vendorPrefix = vendorPrefix.substr(0, 1).toUpperCase() + vendorPrefix.substr(1); break; } } if (!vendorPrefix) { vendorPrefix = ('WebkitOpacity' in bodyStyle) && 'webkit'; } transitions = !!(('transition' in bodyStyle) || (vendorPrefix + 'Transition' in bodyStyle)); animations = !!(('animation' in bodyStyle) || (vendorPrefix + 'Animation' in bodyStyle)); if (android && (!transitions || !animations)) { transitions = isString(document.body.style.webkitTransition); animations = isString(document.body.style.webkitAnimation); } } return { // Android has history.pushState, but it does not update location correctly // so let's not use the history API at all. // http://code.google.com/p/android/issues/detail?id=17471 // https://github.com/angular/angular.js/issues/904 // older webkit browser (533.9) on Boxee box has exactly the same problem as Android has // so let's not use the history API also // We are purposefully using `!(android < 4)` to cover the case when `android` is undefined // jshint -W018 history: !!($window.history && $window.history.pushState && !(android < 4) && !boxee), // jshint +W018 hasEvent: function(event) { // IE9 implements 'input' event it's so fubared that we rather pretend that it doesn't have // it. In particular the event is not fired when backspace or delete key are pressed or // when cut operation is performed. // IE10+ implements 'input' event but it erroneously fires under various situations, // e.g. when placeholder changes, or a form is focused. if (event === 'input' && msie <= 11) return false; if (isUndefined(eventSupport[event])) { var divElm = document.createElement('div'); eventSupport[event] = 'on' + event in divElm; } return eventSupport[event]; }, csp: csp(), vendorPrefix: vendorPrefix, transitions: transitions, animations: animations, android: android }; }]; } var $compileMinErr = minErr('$compile'); /** * @ngdoc service * @name $templateRequest * * @description * The `$templateRequest` service downloads the provided template using `$http` and, upon success, * stores the contents inside of `$templateCache`. If the HTTP request fails or the response data * of the HTTP request is empty, a `$compile` error will be thrown (the exception can be thwarted * by setting the 2nd parameter of the function to true). * * @param {string} tpl The HTTP request template URL * @param {boolean=} ignoreRequestError Whether or not to ignore the exception when the request fails or the template is empty * * @return {Promise} the HTTP Promise for the given. * * @property {number} totalPendingRequests total amount of pending template requests being downloaded. */ function $TemplateRequestProvider() { this.$get = ['$templateCache', '$http', '$q', function($templateCache, $http, $q) { function handleRequestFn(tpl, ignoreRequestError) { handleRequestFn.totalPendingRequests++; var transformResponse = $http.defaults && $http.defaults.transformResponse; if (isArray(transformResponse)) { transformResponse = transformResponse.filter(function(transformer) { return transformer !== defaultHttpResponseTransform; }); } else if (transformResponse === defaultHttpResponseTransform) { transformResponse = null; } var httpOptions = { cache: $templateCache, transformResponse: transformResponse }; return $http.get(tpl, httpOptions) ['finally'](function() { handleRequestFn.totalPendingRequests--; }) .then(function(response) { return response.data; }, handleError); function handleError(resp) { if (!ignoreRequestError) { throw $compileMinErr('tpload', 'Failed to load template: {0}', tpl); } return $q.reject(resp); } } handleRequestFn.totalPendingRequests = 0; return handleRequestFn; }]; } function $$TestabilityProvider() { this.$get = ['$rootScope', '$browser', '$location', function($rootScope, $browser, $location) { /** * @name $testability * * @description * The private $$testability service provides a collection of methods for use when debugging * or by automated test and debugging tools. */ var testability = {}; /** * @name $$testability#findBindings * * @description * Returns an array of elements that are bound (via ng-bind or {{}}) * to expressions matching the input. * * @param {Element} element The element root to search from. * @param {string} expression The binding expression to match. * @param {boolean} opt_exactMatch If true, only returns exact matches * for the expression. Filters and whitespace are ignored. */ testability.findBindings = function(element, expression, opt_exactMatch) { var bindings = element.getElementsByClassName('ng-binding'); var matches = []; forEach(bindings, function(binding) { var dataBinding = angular.element(binding).data('$binding'); if (dataBinding) { forEach(dataBinding, function(bindingName) { if (opt_exactMatch) { var matcher = new RegExp('(^|\\s)' + escapeForRegexp(expression) + '(\\s|\\||$)'); if (matcher.test(bindingName)) { matches.push(binding); } } else { if (bindingName.indexOf(expression) != -1) { matches.push(binding); } } }); } }); return matches; }; /** * @name $$testability#findModels * * @description * Returns an array of elements that are two-way found via ng-model to * expressions matching the input. * * @param {Element} element The element root to search from. * @param {string} expression The model expression to match. * @param {boolean} opt_exactMatch If true, only returns exact matches * for the expression. */ testability.findModels = function(element, expression, opt_exactMatch) { var prefixes = ['ng-', 'data-ng-', 'ng\\:']; for (var p = 0; p < prefixes.length; ++p) { var attributeEquals = opt_exactMatch ? '=' : '*='; var selector = '[' + prefixes[p] + 'model' + attributeEquals + '"' + expression + '"]'; var elements = element.querySelectorAll(selector); if (elements.length) { return elements; } } }; /** * @name $$testability#getLocation * * @description * Shortcut for getting the location in a browser agnostic way. Returns * the path, search, and hash. (e.g. /path?a=b#hash) */ testability.getLocation = function() { return $location.url(); }; /** * @name $$testability#setLocation * * @description * Shortcut for navigating to a location without doing a full page reload. * * @param {string} url The location url (path, search and hash, * e.g. /path?a=b#hash) to go to. */ testability.setLocation = function(url) { if (url !== $location.url()) { $location.url(url); $rootScope.$digest(); } }; /** * @name $$testability#whenStable * * @description * Calls the callback when $timeout and $http requests are completed. * * @param {function} callback */ testability.whenStable = function(callback) { $browser.notifyWhenNoOutstandingRequests(callback); }; return testability; }]; } function $TimeoutProvider() { this.$get = ['$rootScope', '$browser', '$q', '$$q', '$exceptionHandler', function($rootScope, $browser, $q, $$q, $exceptionHandler) { var deferreds = {}; /** * @ngdoc service * @name $timeout * * @description * Angular's wrapper for `window.setTimeout`. The `fn` function is wrapped into a try/catch * block and delegates any exceptions to * {@link ng.$exceptionHandler $exceptionHandler} service. * * The return value of registering a timeout function is a promise, which will be resolved when * the timeout is reached and the timeout function is executed. * * To cancel a timeout request, call `$timeout.cancel(promise)`. * * In tests you can use {@link ngMock.$timeout `$timeout.flush()`} to * synchronously flush the queue of deferred functions. * * @param {function()} fn A function, whose execution should be delayed. * @param {number=} [delay=0] Delay in milliseconds. * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise * will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block. * @returns {Promise} Promise that will be resolved when the timeout is reached. The value this * promise will be resolved with is the return value of the `fn` function. * */ function timeout(fn, delay, invokeApply) { var skipApply = (isDefined(invokeApply) && !invokeApply), deferred = (skipApply ? $$q : $q).defer(), promise = deferred.promise, timeoutId; timeoutId = $browser.defer(function() { try { deferred.resolve(fn()); } catch (e) { deferred.reject(e); $exceptionHandler(e); } finally { delete deferreds[promise.$$timeoutId]; } if (!skipApply) $rootScope.$apply(); }, delay); promise.$$timeoutId = timeoutId; deferreds[timeoutId] = deferred; return promise; } /** * @ngdoc method * @name $timeout#cancel * * @description * Cancels a task associated with the `promise`. As a result of this, the promise will be * resolved with a rejection. * * @param {Promise=} promise Promise returned by the `$timeout` function. * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully * canceled. */ timeout.cancel = function(promise) { if (promise && promise.$$timeoutId in deferreds) { deferreds[promise.$$timeoutId].reject('canceled'); delete deferreds[promise.$$timeoutId]; return $browser.defer.cancel(promise.$$timeoutId); } return false; }; return timeout; }]; } // NOTE: The usage of window and document instead of $window and $document here is // deliberate. This service depends on the specific behavior of anchor nodes created by the // browser (resolving and parsing URLs) that is unlikely to be provided by mock objects and // cause us to break tests. In addition, when the browser resolves a URL for XHR, it // doesn't know about mocked locations and resolves URLs to the real document - which is // exactly the behavior needed here. There is little value is mocking these out for this // service. var urlParsingNode = document.createElement("a"); var originUrl = urlResolve(window.location.href); /** * * Implementation Notes for non-IE browsers * ---------------------------------------- * Assigning a URL to the href property of an anchor DOM node, even one attached to the DOM, * results both in the normalizing and parsing of the URL. Normalizing means that a relative * URL will be resolved into an absolute URL in the context of the application document. * Parsing means that the anchor node's host, hostname, protocol, port, pathname and related * properties are all populated to reflect the normalized URL. This approach has wide * compatibility - Safari 1+, Mozilla 1+, Opera 7+,e etc. See * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html * * Implementation Notes for IE * --------------------------- * IE >= 8 and <= 10 normalizes the URL when assigned to the anchor node similar to the other * browsers. However, the parsed components will not be set if the URL assigned did not specify * them. (e.g. if you assign a.href = "foo", then a.protocol, a.host, etc. will be empty.) We * work around that by performing the parsing in a 2nd step by taking a previously normalized * URL (e.g. by assigning to a.href) and assigning it a.href again. This correctly populates the * properties such as protocol, hostname, port, etc. * * IE7 does not normalize the URL when assigned to an anchor node. (Apparently, it does, if one * uses the inner HTML approach to assign the URL as part of an HTML snippet - * http://stackoverflow.com/a/472729) However, setting img[src] does normalize the URL. * Unfortunately, setting img[src] to something like "javascript:foo" on IE throws an exception. * Since the primary usage for normalizing URLs is to sanitize such URLs, we can't use that * method and IE < 8 is unsupported. * * References: * http://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html * http://url.spec.whatwg.org/#urlutils * https://github.com/angular/angular.js/pull/2902 * http://james.padolsey.com/javascript/parsing-urls-with-the-dom/ * * @kind function * @param {string} url The URL to be parsed. * @description Normalizes and parses a URL. * @returns {object} Returns the normalized URL as a dictionary. * * | member name | Description | * |---------------|----------------| * | href | A normalized version of the provided URL if it was not an absolute URL | * | protocol | The protocol including the trailing colon | * | host | The host and port (if the port is non-default) of the normalizedUrl | * | search | The search params, minus the question mark | * | hash | The hash string, minus the hash symbol * | hostname | The hostname * | port | The port, without ":" * | pathname | The pathname, beginning with "/" * */ function urlResolve(url) { var href = url; if (msie) { // Normalize before parse. Refer Implementation Notes on why this is // done in two steps on IE. urlParsingNode.setAttribute("href", href); href = urlParsingNode.href; } urlParsingNode.setAttribute('href', href); // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils return { href: urlParsingNode.href, protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', host: urlParsingNode.host, search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', hostname: urlParsingNode.hostname, port: urlParsingNode.port, pathname: (urlParsingNode.pathname.charAt(0) === '/') ? urlParsingNode.pathname : '/' + urlParsingNode.pathname }; } /** * Parse a request URL and determine whether this is a same-origin request as the application document. * * @param {string|object} requestUrl The url of the request as a string that will be resolved * or a parsed URL object. * @returns {boolean} Whether the request is for the same origin as the application document. */ function urlIsSameOrigin(requestUrl) { var parsed = (isString(requestUrl)) ? urlResolve(requestUrl) : requestUrl; return (parsed.protocol === originUrl.protocol && parsed.host === originUrl.host); } /** * @ngdoc service * @name $window * * @description * A reference to the browser's `window` object. While `window` * is globally available in JavaScript, it causes testability problems, because * it is a global variable. In angular we always refer to it through the * `$window` service, so it may be overridden, removed or mocked for testing. * * Expressions, like the one defined for the `ngClick` directive in the example * below, are evaluated with respect to the current scope. Therefore, there is * no risk of inadvertently coding in a dependency on a global value in such an * expression. * * @example <example module="windowExample"> <file name="index.html"> <script> angular.module('windowExample', []) .controller('ExampleController', ['$scope', '$window', function($scope, $window) { $scope.greeting = 'Hello, World!'; $scope.doGreeting = function(greeting) { $window.alert(greeting); }; }]); </script> <div ng-controller="ExampleController"> <input type="text" ng-model="greeting" /> <button ng-click="doGreeting(greeting)">ALERT</button> </div> </file> <file name="protractor.js" type="protractor"> it('should display the greeting in the input box', function() { element(by.model('greeting')).sendKeys('Hello, E2E Tests'); // If we click the button it will block the test runner // element(':button').click(); }); </file> </example> */ function $WindowProvider() { this.$get = valueFn(window); } /* global currencyFilter: true, dateFilter: true, filterFilter: true, jsonFilter: true, limitToFilter: true, lowercaseFilter: true, numberFilter: true, orderByFilter: true, uppercaseFilter: true, */ /** * @ngdoc provider * @name $filterProvider * @description * * Filters are just functions which transform input to an output. However filters need to be * Dependency Injected. To achieve this a filter definition consists of a factory function which is * annotated with dependencies and is responsible for creating a filter function. * * ```js * // Filter registration * function MyModule($provide, $filterProvider) { * // create a service to demonstrate injection (not always needed) * $provide.value('greet', function(name){ * return 'Hello ' + name + '!'; * }); * * // register a filter factory which uses the * // greet service to demonstrate DI. * $filterProvider.register('greet', function(greet){ * // return the filter function which uses the greet service * // to generate salutation * return function(text) { * // filters need to be forgiving so check input validity * return text && greet(text) || text; * }; * }); * } * ``` * * The filter function is registered with the `$injector` under the filter name suffix with * `Filter`. * * ```js * it('should be the same instance', inject( * function($filterProvider) { * $filterProvider.register('reverse', function(){ * return ...; * }); * }, * function($filter, reverseFilter) { * expect($filter('reverse')).toBe(reverseFilter); * }); * ``` * * * For more information about how angular filters work, and how to create your own filters, see * {@link guide/filter Filters} in the Angular Developer Guide. */ /** * @ngdoc service * @name $filter * @kind function * @description * Filters are used for formatting data displayed to the user. * * The general syntax in templates is as follows: * * {{ expression [| filter_name[:parameter_value] ... ] }} * * @param {String} name Name of the filter function to retrieve * @return {Function} the filter function * @example <example name="$filter" module="filterExample"> <file name="index.html"> <div ng-controller="MainCtrl"> <h3>{{ originalText }}</h3> <h3>{{ filteredText }}</h3> </div> </file> <file name="script.js"> angular.module('filterExample', []) .controller('MainCtrl', function($scope, $filter) { $scope.originalText = 'hello'; $scope.filteredText = $filter('uppercase')($scope.originalText); }); </file> </example> */ $FilterProvider.$inject = ['$provide']; function $FilterProvider($provide) { var suffix = 'Filter'; /** * @ngdoc method * @name $filterProvider#register * @param {string|Object} name Name of the filter function, or an object map of filters where * the keys are the filter names and the values are the filter factories. * @returns {Object} Registered filter instance, or if a map of filters was provided then a map * of the registered filter instances. */ function register(name, factory) { if (isObject(name)) { var filters = {}; forEach(name, function(filter, key) { filters[key] = register(key, filter); }); return filters; } else { return $provide.factory(name + suffix, factory); } } this.register = register; this.$get = ['$injector', function($injector) { return function(name) { return $injector.get(name + suffix); }; }]; //////////////////////////////////////// /* global currencyFilter: false, dateFilter: false, filterFilter: false, jsonFilter: false, limitToFilter: false, lowercaseFilter: false, numberFilter: false, orderByFilter: false, uppercaseFilter: false, */ register('currency', currencyFilter); register('date', dateFilter); register('filter', filterFilter); register('json', jsonFilter); register('limitTo', limitToFilter); register('lowercase', lowercaseFilter); register('number', numberFilter); register('orderBy', orderByFilter); register('uppercase', uppercaseFilter); } /** * @ngdoc filter * @name filter * @kind function * * @description * Selects a subset of items from `array` and returns it as a new array. * * @param {Array} array The source array. * @param {string|Object|function()} expression The predicate to be used for selecting items from * `array`. * * Can be one of: * * - `string`: The string is used for matching against the contents of the `array`. All strings or * objects with string properties in `array` that match this string will be returned. This also * applies to nested object properties. * The predicate can be negated by prefixing the string with `!`. * * - `Object`: A pattern object can be used to filter specific properties on objects contained * by `array`. For example `{name:"M", phone:"1"}` predicate will return an array of items * which have property `name` containing "M" and property `phone` containing "1". A special * property name `$` can be used (as in `{$:"text"}`) to accept a match against any * property of the object or its nested object properties. That's equivalent to the simple * substring match with a `string` as described above. The predicate can be negated by prefixing * the string with `!`. * For example `{name: "!M"}` predicate will return an array of items which have property `name` * not containing "M". * * Note that a named property will match properties on the same level only, while the special * `$` property will match properties on the same level or deeper. E.g. an array item like * `{name: {first: 'John', last: 'Doe'}}` will **not** be matched by `{name: 'John'}`, but * **will** be matched by `{$: 'John'}`. * * - `function(value, index)`: A predicate function can be used to write arbitrary filters. The * function is called for each element of `array`. The final result is an array of those * elements that the predicate returned true for. * * @param {function(actual, expected)|true|undefined} comparator Comparator which is used in * determining if the expected value (from the filter expression) and actual value (from * the object in the array) should be considered a match. * * Can be one of: * * - `function(actual, expected)`: * The function will be given the object value and the predicate value to compare and * should return true if both values should be considered equal. * * - `true`: A shorthand for `function(actual, expected) { return angular.equals(actual, expected)}`. * This is essentially strict comparison of expected and actual. * * - `false|undefined`: A short hand for a function which will look for a substring match in case * insensitive way. * * @example <example> <file name="index.html"> <div ng-init="friends = [{name:'John', phone:'555-1276'}, {name:'Mary', phone:'800-BIG-MARY'}, {name:'Mike', phone:'555-4321'}, {name:'Adam', phone:'555-5678'}, {name:'Julie', phone:'555-8765'}, {name:'Juliette', phone:'555-5678'}]"></div> Search: <input ng-model="searchText"> <table id="searchTextResults"> <tr><th>Name</th><th>Phone</th></tr> <tr ng-repeat="friend in friends | filter:searchText"> <td>{{friend.name}}</td> <td>{{friend.phone}}</td> </tr> </table> <hr> Any: <input ng-model="search.$"> <br> Name only <input ng-model="search.name"><br> Phone only <input ng-model="search.phone"><br> Equality <input type="checkbox" ng-model="strict"><br> <table id="searchObjResults"> <tr><th>Name</th><th>Phone</th></tr> <tr ng-repeat="friendObj in friends | filter:search:strict"> <td>{{friendObj.name}}</td> <td>{{friendObj.phone}}</td> </tr> </table> </file> <file name="protractor.js" type="protractor"> var expectFriendNames = function(expectedNames, key) { element.all(by.repeater(key + ' in friends').column(key + '.name')).then(function(arr) { arr.forEach(function(wd, i) { expect(wd.getText()).toMatch(expectedNames[i]); }); }); }; it('should search across all fields when filtering with a string', function() { var searchText = element(by.model('searchText')); searchText.clear(); searchText.sendKeys('m'); expectFriendNames(['Mary', 'Mike', 'Adam'], 'friend'); searchText.clear(); searchText.sendKeys('76'); expectFriendNames(['John', 'Julie'], 'friend'); }); it('should search in specific fields when filtering with a predicate object', function() { var searchAny = element(by.model('search.$')); searchAny.clear(); searchAny.sendKeys('i'); expectFriendNames(['Mary', 'Mike', 'Julie', 'Juliette'], 'friendObj'); }); it('should use a equal comparison when comparator is true', function() { var searchName = element(by.model('search.name')); var strict = element(by.model('strict')); searchName.clear(); searchName.sendKeys('Julie'); strict.click(); expectFriendNames(['Julie'], 'friendObj'); }); </file> </example> */ function filterFilter() { return function(array, expression, comparator) { if (!isArray(array)) return array; var predicateFn; var matchAgainstAnyProp; switch (typeof expression) { case 'function': predicateFn = expression; break; case 'boolean': case 'number': case 'string': matchAgainstAnyProp = true; //jshint -W086 case 'object': //jshint +W086 predicateFn = createPredicateFn(expression, comparator, matchAgainstAnyProp); break; default: return array; } return array.filter(predicateFn); }; } // Helper functions for `filterFilter` function createPredicateFn(expression, comparator, matchAgainstAnyProp) { var shouldMatchPrimitives = isObject(expression) && ('$' in expression); var predicateFn; if (comparator === true) { comparator = equals; } else if (!isFunction(comparator)) { comparator = function(actual, expected) { if (isObject(actual) || isObject(expected)) { // Prevent an object to be considered equal to a string like `'[object'` return false; } actual = lowercase('' + actual); expected = lowercase('' + expected); return actual.indexOf(expected) !== -1; }; } predicateFn = function(item) { if (shouldMatchPrimitives && !isObject(item)) { return deepCompare(item, expression.$, comparator, false); } return deepCompare(item, expression, comparator, matchAgainstAnyProp); }; return predicateFn; } function deepCompare(actual, expected, comparator, matchAgainstAnyProp, dontMatchWholeObject) { var actualType = typeof actual; var expectedType = typeof expected; if ((expectedType === 'string') && (expected.charAt(0) === '!')) { return !deepCompare(actual, expected.substring(1), comparator, matchAgainstAnyProp); } else if (isArray(actual)) { // In case `actual` is an array, consider it a match // if ANY of it's items matches `expected` return actual.some(function(item) { return deepCompare(item, expected, comparator, matchAgainstAnyProp); }); } switch (actualType) { case 'object': var key; if (matchAgainstAnyProp) { for (key in actual) { if ((key.charAt(0) !== '$') && deepCompare(actual[key], expected, comparator, true)) { return true; } } return dontMatchWholeObject ? false : deepCompare(actual, expected, comparator, false); } else if (expectedType === 'object') { for (key in expected) { var expectedVal = expected[key]; if (isFunction(expectedVal)) { continue; } var matchAnyProperty = key === '$'; var actualVal = matchAnyProperty ? actual : actual[key]; if (!deepCompare(actualVal, expectedVal, comparator, matchAnyProperty, matchAnyProperty)) { return false; } } return true; } else { return comparator(actual, expected); } break; case 'function': return false; default: return comparator(actual, expected); } } /** * @ngdoc filter * @name currency * @kind function * * @description * Formats a number as a currency (ie $1,234.56). When no currency symbol is provided, default * symbol for current locale is used. * * @param {number} amount Input to filter. * @param {string=} symbol Currency symbol or identifier to be displayed. * @param {number=} fractionSize Number of decimal places to round the amount to, defaults to default max fraction size for current locale * @returns {string} Formatted number. * * * @example <example module="currencyExample"> <file name="index.html"> <script> angular.module('currencyExample', []) .controller('ExampleController', ['$scope', function($scope) { $scope.amount = 1234.56; }]); </script> <div ng-controller="ExampleController"> <input type="number" ng-model="amount"> <br> default currency symbol ($): <span id="currency-default">{{amount | currency}}</span><br> custom currency identifier (USD$): <span id="currency-custom">{{amount | currency:"USD$"}}</span> no fractions (0): <span id="currency-no-fractions">{{amount | currency:"USD$":0}}</span> </div> </file> <file name="protractor.js" type="protractor"> it('should init with 1234.56', function() { expect(element(by.id('currency-default')).getText()).toBe('$1,234.56'); expect(element(by.id('currency-custom')).getText()).toBe('USD$1,234.56'); expect(element(by.id('currency-no-fractions')).getText()).toBe('USD$1,235'); }); it('should update', function() { if (browser.params.browser == 'safari') { // Safari does not understand the minus key. See // https://github.com/angular/protractor/issues/481 return; } element(by.model('amount')).clear(); element(by.model('amount')).sendKeys('-1234'); expect(element(by.id('currency-default')).getText()).toBe('($1,234.00)'); expect(element(by.id('currency-custom')).getText()).toBe('(USD$1,234.00)'); expect(element(by.id('currency-no-fractions')).getText()).toBe('(USD$1,234)'); }); </file> </example> */ currencyFilter.$inject = ['$locale']; function currencyFilter($locale) { var formats = $locale.NUMBER_FORMATS; return function(amount, currencySymbol, fractionSize) { if (isUndefined(currencySymbol)) { currencySymbol = formats.CURRENCY_SYM; } if (isUndefined(fractionSize)) { fractionSize = formats.PATTERNS[1].maxFrac; } // if null or undefined pass it through return (amount == null) ? amount : formatNumber(amount, formats.PATTERNS[1], formats.GROUP_SEP, formats.DECIMAL_SEP, fractionSize). replace(/\u00A4/g, currencySymbol); }; } /** * @ngdoc filter * @name number * @kind function * * @description * Formats a number as text. * * If the input is not a number an empty string is returned. * * @param {number|string} number Number to format. * @param {(number|string)=} fractionSize Number of decimal places to round the number to. * If this is not provided then the fraction size is computed from the current locale's number * formatting pattern. In the case of the default locale, it will be 3. * @returns {string} Number rounded to decimalPlaces and places a “,” after each third digit. * * @example <example module="numberFilterExample"> <file name="index.html"> <script> angular.module('numberFilterExample', []) .controller('ExampleController', ['$scope', function($scope) { $scope.val = 1234.56789; }]); </script> <div ng-controller="ExampleController"> Enter number: <input ng-model='val'><br> Default formatting: <span id='number-default'>{{val | number}}</span><br> No fractions: <span>{{val | number:0}}</span><br> Negative number: <span>{{-val | number:4}}</span> </div> </file> <file name="protractor.js" type="protractor"> it('should format numbers', function() { expect(element(by.id('number-default')).getText()).toBe('1,234.568'); expect(element(by.binding('val | number:0')).getText()).toBe('1,235'); expect(element(by.binding('-val | number:4')).getText()).toBe('-1,234.5679'); }); it('should update', function() { element(by.model('val')).clear(); element(by.model('val')).sendKeys('3374.333'); expect(element(by.id('number-default')).getText()).toBe('3,374.333'); expect(element(by.binding('val | number:0')).getText()).toBe('3,374'); expect(element(by.binding('-val | number:4')).getText()).toBe('-3,374.3330'); }); </file> </example> */ numberFilter.$inject = ['$locale']; function numberFilter($locale) { var formats = $locale.NUMBER_FORMATS; return function(number, fractionSize) { // if null or undefined pass it through return (number == null) ? number : formatNumber(number, formats.PATTERNS[0], formats.GROUP_SEP, formats.DECIMAL_SEP, fractionSize); }; } var DECIMAL_SEP = '.'; function formatNumber(number, pattern, groupSep, decimalSep, fractionSize) { if (!isFinite(number) || isObject(number)) return ''; var isNegative = number < 0; number = Math.abs(number); var numStr = number + '', formatedText = '', parts = []; var hasExponent = false; if (numStr.indexOf('e') !== -1) { var match = numStr.match(/([\d\.]+)e(-?)(\d+)/); if (match && match[2] == '-' && match[3] > fractionSize + 1) { number = 0; } else { formatedText = numStr; hasExponent = true; } } if (!hasExponent) { var fractionLen = (numStr.split(DECIMAL_SEP)[1] || '').length; // determine fractionSize if it is not specified if (isUndefined(fractionSize)) { fractionSize = Math.min(Math.max(pattern.minFrac, fractionLen), pattern.maxFrac); } // safely round numbers in JS without hitting imprecisions of floating-point arithmetics // inspired by: // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/round number = +(Math.round(+(number.toString() + 'e' + fractionSize)).toString() + 'e' + -fractionSize); var fraction = ('' + number).split(DECIMAL_SEP); var whole = fraction[0]; fraction = fraction[1] || ''; var i, pos = 0, lgroup = pattern.lgSize, group = pattern.gSize; if (whole.length >= (lgroup + group)) { pos = whole.length - lgroup; for (i = 0; i < pos; i++) { if ((pos - i) % group === 0 && i !== 0) { formatedText += groupSep; } formatedText += whole.charAt(i); } } for (i = pos; i < whole.length; i++) { if ((whole.length - i) % lgroup === 0 && i !== 0) { formatedText += groupSep; } formatedText += whole.charAt(i); } // format fraction part. while (fraction.length < fractionSize) { fraction += '0'; } if (fractionSize && fractionSize !== "0") formatedText += decimalSep + fraction.substr(0, fractionSize); } else { if (fractionSize > 0 && number < 1) { formatedText = number.toFixed(fractionSize); number = parseFloat(formatedText); } } if (number === 0) { isNegative = false; } parts.push(isNegative ? pattern.negPre : pattern.posPre, formatedText, isNegative ? pattern.negSuf : pattern.posSuf); return parts.join(''); } function padNumber(num, digits, trim) { var neg = ''; if (num < 0) { neg = '-'; num = -num; } num = '' + num; while (num.length < digits) num = '0' + num; if (trim) num = num.substr(num.length - digits); return neg + num; } function dateGetter(name, size, offset, trim) { offset = offset || 0; return function(date) { var value = date['get' + name](); if (offset > 0 || value > -offset) value += offset; if (value === 0 && offset == -12) value = 12; return padNumber(value, size, trim); }; } function dateStrGetter(name, shortForm) { return function(date, formats) { var value = date['get' + name](); var get = uppercase(shortForm ? ('SHORT' + name) : name); return formats[get][value]; }; } function timeZoneGetter(date) { var zone = -1 * date.getTimezoneOffset(); var paddedZone = (zone >= 0) ? "+" : ""; paddedZone += padNumber(Math[zone > 0 ? 'floor' : 'ceil'](zone / 60), 2) + padNumber(Math.abs(zone % 60), 2); return paddedZone; } function getFirstThursdayOfYear(year) { // 0 = index of January var dayOfWeekOnFirst = (new Date(year, 0, 1)).getDay(); // 4 = index of Thursday (+1 to account for 1st = 5) // 11 = index of *next* Thursday (+1 account for 1st = 12) return new Date(year, 0, ((dayOfWeekOnFirst <= 4) ? 5 : 12) - dayOfWeekOnFirst); } function getThursdayThisWeek(datetime) { return new Date(datetime.getFullYear(), datetime.getMonth(), // 4 = index of Thursday datetime.getDate() + (4 - datetime.getDay())); } function weekGetter(size) { return function(date) { var firstThurs = getFirstThursdayOfYear(date.getFullYear()), thisThurs = getThursdayThisWeek(date); var diff = +thisThurs - +firstThurs, result = 1 + Math.round(diff / 6.048e8); // 6.048e8 ms per week return padNumber(result, size); }; } function ampmGetter(date, formats) { return date.getHours() < 12 ? formats.AMPMS[0] : formats.AMPMS[1]; } var DATE_FORMATS = { yyyy: dateGetter('FullYear', 4), yy: dateGetter('FullYear', 2, 0, true), y: dateGetter('FullYear', 1), MMMM: dateStrGetter('Month'), MMM: dateStrGetter('Month', true), MM: dateGetter('Month', 2, 1), M: dateGetter('Month', 1, 1), dd: dateGetter('Date', 2), d: dateGetter('Date', 1), HH: dateGetter('Hours', 2), H: dateGetter('Hours', 1), hh: dateGetter('Hours', 2, -12), h: dateGetter('Hours', 1, -12), mm: dateGetter('Minutes', 2), m: dateGetter('Minutes', 1), ss: dateGetter('Seconds', 2), s: dateGetter('Seconds', 1), // while ISO 8601 requires fractions to be prefixed with `.` or `,` // we can be just safely rely on using `sss` since we currently don't support single or two digit fractions sss: dateGetter('Milliseconds', 3), EEEE: dateStrGetter('Day'), EEE: dateStrGetter('Day', true), a: ampmGetter, Z: timeZoneGetter, ww: weekGetter(2), w: weekGetter(1) }; var DATE_FORMATS_SPLIT = /((?:[^yMdHhmsaZEw']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z|w+))(.*)/, NUMBER_STRING = /^\-?\d+$/; /** * @ngdoc filter * @name date * @kind function * * @description * Formats `date` to a string based on the requested `format`. * * `format` string can be composed of the following elements: * * * `'yyyy'`: 4 digit representation of year (e.g. AD 1 => 0001, AD 2010 => 2010) * * `'yy'`: 2 digit representation of year, padded (00-99). (e.g. AD 2001 => 01, AD 2010 => 10) * * `'y'`: 1 digit representation of year, e.g. (AD 1 => 1, AD 199 => 199) * * `'MMMM'`: Month in year (January-December) * * `'MMM'`: Month in year (Jan-Dec) * * `'MM'`: Month in year, padded (01-12) * * `'M'`: Month in year (1-12) * * `'dd'`: Day in month, padded (01-31) * * `'d'`: Day in month (1-31) * * `'EEEE'`: Day in Week,(Sunday-Saturday) * * `'EEE'`: Day in Week, (Sun-Sat) * * `'HH'`: Hour in day, padded (00-23) * * `'H'`: Hour in day (0-23) * * `'hh'`: Hour in AM/PM, padded (01-12) * * `'h'`: Hour in AM/PM, (1-12) * * `'mm'`: Minute in hour, padded (00-59) * * `'m'`: Minute in hour (0-59) * * `'ss'`: Second in minute, padded (00-59) * * `'s'`: Second in minute (0-59) * * `'sss'`: Millisecond in second, padded (000-999) * * `'a'`: AM/PM marker * * `'Z'`: 4 digit (+sign) representation of the timezone offset (-1200-+1200) * * `'ww'`: Week of year, padded (00-53). Week 01 is the week with the first Thursday of the year * * `'w'`: Week of year (0-53). Week 1 is the week with the first Thursday of the year * * `format` string can also be one of the following predefined * {@link guide/i18n localizable formats}: * * * `'medium'`: equivalent to `'MMM d, y h:mm:ss a'` for en_US locale * (e.g. Sep 3, 2010 12:05:08 PM) * * `'short'`: equivalent to `'M/d/yy h:mm a'` for en_US locale (e.g. 9/3/10 12:05 PM) * * `'fullDate'`: equivalent to `'EEEE, MMMM d, y'` for en_US locale * (e.g. Friday, September 3, 2010) * * `'longDate'`: equivalent to `'MMMM d, y'` for en_US locale (e.g. September 3, 2010) * * `'mediumDate'`: equivalent to `'MMM d, y'` for en_US locale (e.g. Sep 3, 2010) * * `'shortDate'`: equivalent to `'M/d/yy'` for en_US locale (e.g. 9/3/10) * * `'mediumTime'`: equivalent to `'h:mm:ss a'` for en_US locale (e.g. 12:05:08 PM) * * `'shortTime'`: equivalent to `'h:mm a'` for en_US locale (e.g. 12:05 PM) * * `format` string can contain literal values. These need to be escaped by surrounding with single quotes (e.g. * `"h 'in the morning'"`). In order to output a single quote, escape it - i.e., two single quotes in a sequence * (e.g. `"h 'o''clock'"`). * * @param {(Date|number|string)} date Date to format either as Date object, milliseconds (string or * number) or various ISO 8601 datetime string formats (e.g. yyyy-MM-ddTHH:mm:ss.sssZ and its * shorter versions like yyyy-MM-ddTHH:mmZ, yyyy-MM-dd or yyyyMMddTHHmmssZ). If no timezone is * specified in the string input, the time is considered to be in the local timezone. * @param {string=} format Formatting rules (see Description). If not specified, * `mediumDate` is used. * @param {string=} timezone Timezone to be used for formatting. Right now, only `'UTC'` is supported. * If not specified, the timezone of the browser will be used. * @returns {string} Formatted string or the input if input is not recognized as date/millis. * * @example <example> <file name="index.html"> <span ng-non-bindable>{{1288323623006 | date:'medium'}}</span>: <span>{{1288323623006 | date:'medium'}}</span><br> <span ng-non-bindable>{{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}</span>: <span>{{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}</span><br> <span ng-non-bindable>{{1288323623006 | date:'MM/dd/yyyy @ h:mma'}}</span>: <span>{{'1288323623006' | date:'MM/dd/yyyy @ h:mma'}}</span><br> <span ng-non-bindable>{{1288323623006 | date:"MM/dd/yyyy 'at' h:mma"}}</span>: <span>{{'1288323623006' | date:"MM/dd/yyyy 'at' h:mma"}}</span><br> </file> <file name="protractor.js" type="protractor"> it('should format date', function() { expect(element(by.binding("1288323623006 | date:'medium'")).getText()). toMatch(/Oct 2\d, 2010 \d{1,2}:\d{2}:\d{2} (AM|PM)/); expect(element(by.binding("1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'")).getText()). toMatch(/2010\-10\-2\d \d{2}:\d{2}:\d{2} (\-|\+)?\d{4}/); expect(element(by.binding("'1288323623006' | date:'MM/dd/yyyy @ h:mma'")).getText()). toMatch(/10\/2\d\/2010 @ \d{1,2}:\d{2}(AM|PM)/); expect(element(by.binding("'1288323623006' | date:\"MM/dd/yyyy 'at' h:mma\"")).getText()). toMatch(/10\/2\d\/2010 at \d{1,2}:\d{2}(AM|PM)/); }); </file> </example> */ dateFilter.$inject = ['$locale']; function dateFilter($locale) { var R_ISO8601_STR = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/; // 1 2 3 4 5 6 7 8 9 10 11 function jsonStringToDate(string) { var match; if (match = string.match(R_ISO8601_STR)) { var date = new Date(0), tzHour = 0, tzMin = 0, dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear, timeSetter = match[8] ? date.setUTCHours : date.setHours; if (match[9]) { tzHour = int(match[9] + match[10]); tzMin = int(match[9] + match[11]); } dateSetter.call(date, int(match[1]), int(match[2]) - 1, int(match[3])); var h = int(match[4] || 0) - tzHour; var m = int(match[5] || 0) - tzMin; var s = int(match[6] || 0); var ms = Math.round(parseFloat('0.' + (match[7] || 0)) * 1000); timeSetter.call(date, h, m, s, ms); return date; } return string; } return function(date, format, timezone) { var text = '', parts = [], fn, match; format = format || 'mediumDate'; format = $locale.DATETIME_FORMATS[format] || format; if (isString(date)) { date = NUMBER_STRING.test(date) ? int(date) : jsonStringToDate(date); } if (isNumber(date)) { date = new Date(date); } if (!isDate(date)) { return date; } while (format) { match = DATE_FORMATS_SPLIT.exec(format); if (match) { parts = concat(parts, match, 1); format = parts.pop(); } else { parts.push(format); format = null; } } if (timezone && timezone === 'UTC') { date = new Date(date.getTime()); date.setMinutes(date.getMinutes() + date.getTimezoneOffset()); } forEach(parts, function(value) { fn = DATE_FORMATS[value]; text += fn ? fn(date, $locale.DATETIME_FORMATS) : value.replace(/(^'|'$)/g, '').replace(/''/g, "'"); }); return text; }; } /** * @ngdoc filter * @name json * @kind function * * @description * Allows you to convert a JavaScript object into JSON string. * * This filter is mostly useful for debugging. When using the double curly {{value}} notation * the binding is automatically converted to JSON. * * @param {*} object Any JavaScript object (including arrays and primitive types) to filter. * @param {number=} spacing The number of spaces to use per indentation, defaults to 2. * @returns {string} JSON string. * * * @example <example> <file name="index.html"> <pre id="default-spacing">{{ {'name':'value'} | json }}</pre> <pre id="custom-spacing">{{ {'name':'value'} | json:4 }}</pre> </file> <file name="protractor.js" type="protractor"> it('should jsonify filtered objects', function() { expect(element(by.id('default-spacing')).getText()).toMatch(/\{\n "name": ?"value"\n}/); expect(element(by.id('custom-spacing')).getText()).toMatch(/\{\n "name": ?"value"\n}/); }); </file> </example> * */ function jsonFilter() { return function(object, spacing) { if (isUndefined(spacing)) { spacing = 2; } return toJson(object, spacing); }; } /** * @ngdoc filter * @name lowercase * @kind function * @description * Converts string to lowercase. * @see angular.lowercase */ var lowercaseFilter = valueFn(lowercase); /** * @ngdoc filter * @name uppercase * @kind function * @description * Converts string to uppercase. * @see angular.uppercase */ var uppercaseFilter = valueFn(uppercase); /** * @ngdoc filter * @name limitTo * @kind function * * @description * Creates a new array or string containing only a specified number of elements. The elements * are taken from either the beginning or the end of the source array, string or number, as specified by * the value and sign (positive or negative) of `limit`. If a number is used as input, it is * converted to a string. * * @param {Array|string|number} input Source array, string or number to be limited. * @param {string|number} limit The length of the returned array or string. If the `limit` number * is positive, `limit` number of items from the beginning of the source array/string are copied. * If the number is negative, `limit` number of items from the end of the source array/string * are copied. The `limit` will be trimmed if it exceeds `array.length` * @returns {Array|string} A new sub-array or substring of length `limit` or less if input array * had less than `limit` elements. * * @example <example module="limitToExample"> <file name="index.html"> <script> angular.module('limitToExample', []) .controller('ExampleController', ['$scope', function($scope) { $scope.numbers = [1,2,3,4,5,6,7,8,9]; $scope.letters = "abcdefghi"; $scope.longNumber = 2345432342; $scope.numLimit = 3; $scope.letterLimit = 3; $scope.longNumberLimit = 3; }]); </script> <div ng-controller="ExampleController"> Limit {{numbers}} to: <input type="number" step="1" ng-model="numLimit"> <p>Output numbers: {{ numbers | limitTo:numLimit }}</p> Limit {{letters}} to: <input type="number" step="1" ng-model="letterLimit"> <p>Output letters: {{ letters | limitTo:letterLimit }}</p> Limit {{longNumber}} to: <input type="number" step="1" ng-model="longNumberLimit"> <p>Output long number: {{ longNumber | limitTo:longNumberLimit }}</p> </div> </file> <file name="protractor.js" type="protractor"> var numLimitInput = element(by.model('numLimit')); var letterLimitInput = element(by.model('letterLimit')); var longNumberLimitInput = element(by.model('longNumberLimit')); var limitedNumbers = element(by.binding('numbers | limitTo:numLimit')); var limitedLetters = element(by.binding('letters | limitTo:letterLimit')); var limitedLongNumber = element(by.binding('longNumber | limitTo:longNumberLimit')); it('should limit the number array to first three items', function() { expect(numLimitInput.getAttribute('value')).toBe('3'); expect(letterLimitInput.getAttribute('value')).toBe('3'); expect(longNumberLimitInput.getAttribute('value')).toBe('3'); expect(limitedNumbers.getText()).toEqual('Output numbers: [1,2,3]'); expect(limitedLetters.getText()).toEqual('Output letters: abc'); expect(limitedLongNumber.getText()).toEqual('Output long number: 234'); }); // There is a bug in safari and protractor that doesn't like the minus key // it('should update the output when -3 is entered', function() { // numLimitInput.clear(); // numLimitInput.sendKeys('-3'); // letterLimitInput.clear(); // letterLimitInput.sendKeys('-3'); // longNumberLimitInput.clear(); // longNumberLimitInput.sendKeys('-3'); // expect(limitedNumbers.getText()).toEqual('Output numbers: [7,8,9]'); // expect(limitedLetters.getText()).toEqual('Output letters: ghi'); // expect(limitedLongNumber.getText()).toEqual('Output long number: 342'); // }); it('should not exceed the maximum size of input array', function() { numLimitInput.clear(); numLimitInput.sendKeys('100'); letterLimitInput.clear(); letterLimitInput.sendKeys('100'); longNumberLimitInput.clear(); longNumberLimitInput.sendKeys('100'); expect(limitedNumbers.getText()).toEqual('Output numbers: [1,2,3,4,5,6,7,8,9]'); expect(limitedLetters.getText()).toEqual('Output letters: abcdefghi'); expect(limitedLongNumber.getText()).toEqual('Output long number: 2345432342'); }); </file> </example> */ function limitToFilter() { return function(input, limit) { if (isNumber(input)) input = input.toString(); if (!isArray(input) && !isString(input)) return input; if (Math.abs(Number(limit)) === Infinity) { limit = Number(limit); } else { limit = int(limit); } //NaN check on limit if (limit) { return limit > 0 ? input.slice(0, limit) : input.slice(limit); } else { return isString(input) ? "" : []; } }; } /** * @ngdoc filter * @name orderBy * @kind function * * @description * Orders a specified `array` by the `expression` predicate. It is ordered alphabetically * for strings and numerically for numbers. Note: if you notice numbers are not being sorted * correctly, make sure they are actually being saved as numbers and not strings. * * @param {Array} array The array to sort. * @param {function(*)|string|Array.<(function(*)|string)>=} expression A predicate to be * used by the comparator to determine the order of elements. * * Can be one of: * * - `function`: Getter function. The result of this function will be sorted using the * `<`, `=`, `>` operator. * - `string`: An Angular expression. The result of this expression is used to compare elements * (for example `name` to sort by a property called `name` or `name.substr(0, 3)` to sort by * 3 first characters of a property called `name`). The result of a constant expression * is interpreted as a property name to be used in comparisons (for example `"special name"` * to sort object by the value of their `special name` property). An expression can be * optionally prefixed with `+` or `-` to control ascending or descending sort order * (for example, `+name` or `-name`). If no property is provided, (e.g. `'+'`) then the array * element itself is used to compare where sorting. * - `Array`: An array of function or string predicates. The first predicate in the array * is used for sorting, but when two items are equivalent, the next predicate is used. * * If the predicate is missing or empty then it defaults to `'+'`. * * @param {boolean=} reverse Reverse the order of the array. * @returns {Array} Sorted copy of the source array. * * @example <example module="orderByExample"> <file name="index.html"> <script> angular.module('orderByExample', []) .controller('ExampleController', ['$scope', function($scope) { $scope.friends = [{name:'John', phone:'555-1212', age:10}, {name:'Mary', phone:'555-9876', age:19}, {name:'Mike', phone:'555-4321', age:21}, {name:'Adam', phone:'555-5678', age:35}, {name:'Julie', phone:'555-8765', age:29}]; $scope.predicate = '-age'; }]); </script> <div ng-controller="ExampleController"> <pre>Sorting predicate = {{predicate}}; reverse = {{reverse}}</pre> <hr/> [ <a href="" ng-click="predicate=''">unsorted</a> ] <table class="friend"> <tr> <th><a href="" ng-click="predicate = 'name'; reverse=false">Name</a> (<a href="" ng-click="predicate = '-name'; reverse=false">^</a>)</th> <th><a href="" ng-click="predicate = 'phone'; reverse=!reverse">Phone Number</a></th> <th><a href="" ng-click="predicate = 'age'; reverse=!reverse">Age</a></th> </tr> <tr ng-repeat="friend in friends | orderBy:predicate:reverse"> <td>{{friend.name}}</td> <td>{{friend.phone}}</td> <td>{{friend.age}}</td> </tr> </table> </div> </file> </example> * * It's also possible to call the orderBy filter manually, by injecting `$filter`, retrieving the * filter routine with `$filter('orderBy')`, and calling the returned filter routine with the * desired parameters. * * Example: * * @example <example module="orderByExample"> <file name="index.html"> <div ng-controller="ExampleController"> <table class="friend"> <tr> <th><a href="" ng-click="reverse=false;order('name', false)">Name</a> (<a href="" ng-click="order('-name',false)">^</a>)</th> <th><a href="" ng-click="reverse=!reverse;order('phone', reverse)">Phone Number</a></th> <th><a href="" ng-click="reverse=!reverse;order('age',reverse)">Age</a></th> </tr> <tr ng-repeat="friend in friends"> <td>{{friend.name}}</td> <td>{{friend.phone}}</td> <td>{{friend.age}}</td> </tr> </table> </div> </file> <file name="script.js"> angular.module('orderByExample', []) .controller('ExampleController', ['$scope', '$filter', function($scope, $filter) { var orderBy = $filter('orderBy'); $scope.friends = [ { name: 'John', phone: '555-1212', age: 10 }, { name: 'Mary', phone: '555-9876', age: 19 }, { name: 'Mike', phone: '555-4321', age: 21 }, { name: 'Adam', phone: '555-5678', age: 35 }, { name: 'Julie', phone: '555-8765', age: 29 } ]; $scope.order = function(predicate, reverse) { $scope.friends = orderBy($scope.friends, predicate, reverse); }; $scope.order('-age',false); }]); </file> </example> */ orderByFilter.$inject = ['$parse']; function orderByFilter($parse) { return function(array, sortPredicate, reverseOrder) { if (!(isArrayLike(array))) return array; sortPredicate = isArray(sortPredicate) ? sortPredicate : [sortPredicate]; if (sortPredicate.length === 0) { sortPredicate = ['+']; } sortPredicate = sortPredicate.map(function(predicate) { var descending = false, get = predicate || identity; if (isString(predicate)) { if ((predicate.charAt(0) == '+' || predicate.charAt(0) == '-')) { descending = predicate.charAt(0) == '-'; predicate = predicate.substring(1); } if (predicate === '') { // Effectively no predicate was passed so we compare identity return reverseComparator(compare, descending); } get = $parse(predicate); if (get.constant) { var key = get(); return reverseComparator(function(a, b) { return compare(a[key], b[key]); }, descending); } } return reverseComparator(function(a, b) { return compare(get(a),get(b)); }, descending); }); return slice.call(array).sort(reverseComparator(comparator, reverseOrder)); function comparator(o1, o2) { for (var i = 0; i < sortPredicate.length; i++) { var comp = sortPredicate[i](o1, o2); if (comp !== 0) return comp; } return 0; } function reverseComparator(comp, descending) { return descending ? function(a, b) {return comp(b,a);} : comp; } function isPrimitive(value) { switch (typeof value) { case 'number': /* falls through */ case 'boolean': /* falls through */ case 'string': return true; default: return false; } } function objectToString(value) { if (value === null) return 'null'; if (typeof value.valueOf === 'function') { value = value.valueOf(); if (isPrimitive(value)) return value; } if (typeof value.toString === 'function') { value = value.toString(); if (isPrimitive(value)) return value; } return ''; } function compare(v1, v2) { var t1 = typeof v1; var t2 = typeof v2; if (t1 === t2 && t1 === "object") { v1 = objectToString(v1); v2 = objectToString(v2); } if (t1 === t2) { if (t1 === "string") { v1 = v1.toLowerCase(); v2 = v2.toLowerCase(); } if (v1 === v2) return 0; return v1 < v2 ? -1 : 1; } else { return t1 < t2 ? -1 : 1; } } }; } function ngDirective(directive) { if (isFunction(directive)) { directive = { link: directive }; } directive.restrict = directive.restrict || 'AC'; return valueFn(directive); } /** * @ngdoc directive * @name a * @restrict E * * @description * Modifies the default behavior of the html A tag so that the default action is prevented when * the href attribute is empty. * * This change permits the easy creation of action links with the `ngClick` directive * without changing the location or causing page reloads, e.g.: * `<a href="" ng-click="list.addItem()">Add Item</a>` */ var htmlAnchorDirective = valueFn({ restrict: 'E', compile: function(element, attr) { if (!attr.href && !attr.xlinkHref && !attr.name) { return function(scope, element) { // If the linked element is not an anchor tag anymore, do nothing if (element[0].nodeName.toLowerCase() !== 'a') return; // SVGAElement does not use the href attribute, but rather the 'xlinkHref' attribute. var href = toString.call(element.prop('href')) === '[object SVGAnimatedString]' ? 'xlink:href' : 'href'; element.on('click', function(event) { // if we have no href url, then don't navigate anywhere. if (!element.attr(href)) { event.preventDefault(); } }); }; } } }); /** * @ngdoc directive * @name ngHref * @restrict A * @priority 99 * * @description * Using Angular markup like `{{hash}}` in an href attribute will * make the link go to the wrong URL if the user clicks it before * Angular has a chance to replace the `{{hash}}` markup with its * value. Until Angular replaces the markup the link will be broken * and will most likely return a 404 error. The `ngHref` directive * solves this problem. * * The wrong way to write it: * ```html * <a href="http://www.gravatar.com/avatar/{{hash}}">link1</a> * ``` * * The correct way to write it: * ```html * <a ng-href="http://www.gravatar.com/avatar/{{hash}}">link1</a> * ``` * * @element A * @param {template} ngHref any string which can contain `{{}}` markup. * * @example * This example shows various combinations of `href`, `ng-href` and `ng-click` attributes * in links and their different behaviors: <example> <file name="index.html"> <input ng-model="value" /><br /> <a id="link-1" href ng-click="value = 1">link 1</a> (link, don't reload)<br /> <a id="link-2" href="" ng-click="value = 2">link 2</a> (link, don't reload)<br /> <a id="link-3" ng-href="/{{'123'}}">link 3</a> (link, reload!)<br /> <a id="link-4" href="" name="xx" ng-click="value = 4">anchor</a> (link, don't reload)<br /> <a id="link-5" name="xxx" ng-click="value = 5">anchor</a> (no link)<br /> <a id="link-6" ng-href="{{value}}">link</a> (link, change location) </file> <file name="protractor.js" type="protractor"> it('should execute ng-click but not reload when href without value', function() { element(by.id('link-1')).click(); expect(element(by.model('value')).getAttribute('value')).toEqual('1'); expect(element(by.id('link-1')).getAttribute('href')).toBe(''); }); it('should execute ng-click but not reload when href empty string', function() { element(by.id('link-2')).click(); expect(element(by.model('value')).getAttribute('value')).toEqual('2'); expect(element(by.id('link-2')).getAttribute('href')).toBe(''); }); it('should execute ng-click and change url when ng-href specified', function() { expect(element(by.id('link-3')).getAttribute('href')).toMatch(/\/123$/); element(by.id('link-3')).click(); // At this point, we navigate away from an Angular page, so we need // to use browser.driver to get the base webdriver. browser.wait(function() { return browser.driver.getCurrentUrl().then(function(url) { return url.match(/\/123$/); }); }, 5000, 'page should navigate to /123'); }); xit('should execute ng-click but not reload when href empty string and name specified', function() { element(by.id('link-4')).click(); expect(element(by.model('value')).getAttribute('value')).toEqual('4'); expect(element(by.id('link-4')).getAttribute('href')).toBe(''); }); it('should execute ng-click but not reload when no href but name specified', function() { element(by.id('link-5')).click(); expect(element(by.model('value')).getAttribute('value')).toEqual('5'); expect(element(by.id('link-5')).getAttribute('href')).toBe(null); }); it('should only change url when only ng-href', function() { element(by.model('value')).clear(); element(by.model('value')).sendKeys('6'); expect(element(by.id('link-6')).getAttribute('href')).toMatch(/\/6$/); element(by.id('link-6')).click(); // At this point, we navigate away from an Angular page, so we need // to use browser.driver to get the base webdriver. browser.wait(function() { return browser.driver.getCurrentUrl().then(function(url) { return url.match(/\/6$/); }); }, 5000, 'page should navigate to /6'); }); </file> </example> */ /** * @ngdoc directive * @name ngSrc * @restrict A * @priority 99 * * @description * Using Angular markup like `{{hash}}` in a `src` attribute doesn't * work right: The browser will fetch from the URL with the literal * text `{{hash}}` until Angular replaces the expression inside * `{{hash}}`. The `ngSrc` directive solves this problem. * * The buggy way to write it: * ```html * <img src="http://www.gravatar.com/avatar/{{hash}}"/> * ``` * * The correct way to write it: * ```html * <img ng-src="http://www.gravatar.com/avatar/{{hash}}"/> * ``` * * @element IMG * @param {template} ngSrc any string which can contain `{{}}` markup. */ /** * @ngdoc directive * @name ngSrcset * @restrict A * @priority 99 * * @description * Using Angular markup like `{{hash}}` in a `srcset` attribute doesn't * work right: The browser will fetch from the URL with the literal * text `{{hash}}` until Angular replaces the expression inside * `{{hash}}`. The `ngSrcset` directive solves this problem. * * The buggy way to write it: * ```html * <img srcset="http://www.gravatar.com/avatar/{{hash}} 2x"/> * ``` * * The correct way to write it: * ```html * <img ng-srcset="http://www.gravatar.com/avatar/{{hash}} 2x"/> * ``` * * @element IMG * @param {template} ngSrcset any string which can contain `{{}}` markup. */ /** * @ngdoc directive * @name ngDisabled * @restrict A * @priority 100 * * @description * * We shouldn't do this, because it will make the button enabled on Chrome/Firefox but not on IE8 and older IEs: * ```html * <div ng-init="scope = { isDisabled: false }"> * <button disabled="{{scope.isDisabled}}">Disabled</button> * </div> * ``` * * The HTML specification does not require browsers to preserve the values of boolean attributes * such as disabled. (Their presence means true and their absence means false.) * If we put an Angular interpolation expression into such an attribute then the * binding information would be lost when the browser removes the attribute. * The `ngDisabled` directive solves this problem for the `disabled` attribute. * This complementary directive is not removed by the browser and so provides * a permanent reliable place to store the binding information. * * @example <example> <file name="index.html"> Click me to toggle: <input type="checkbox" ng-model="checked"><br/> <button ng-model="button" ng-disabled="checked">Button</button> </file> <file name="protractor.js" type="protractor"> it('should toggle button', function() { expect(element(by.css('button')).getAttribute('disabled')).toBeFalsy(); element(by.model('checked')).click(); expect(element(by.css('button')).getAttribute('disabled')).toBeTruthy(); }); </file> </example> * * @element INPUT * @param {expression} ngDisabled If the {@link guide/expression expression} is truthy, * then special attribute "disabled" will be set on the element */ /** * @ngdoc directive * @name ngChecked * @restrict A * @priority 100 * * @description * The HTML specification does not require browsers to preserve the values of boolean attributes * such as checked. (Their presence means true and their absence means false.) * If we put an Angular interpolation expression into such an attribute then the * binding information would be lost when the browser removes the attribute. * The `ngChecked` directive solves this problem for the `checked` attribute. * This complementary directive is not removed by the browser and so provides * a permanent reliable place to store the binding information. * @example <example> <file name="index.html"> Check me to check both: <input type="checkbox" ng-model="master"><br/> <input id="checkSlave" type="checkbox" ng-checked="master"> </file> <file name="protractor.js" type="protractor"> it('should check both checkBoxes', function() { expect(element(by.id('checkSlave')).getAttribute('checked')).toBeFalsy(); element(by.model('master')).click(); expect(element(by.id('checkSlave')).getAttribute('checked')).toBeTruthy(); }); </file> </example> * * @element INPUT * @param {expression} ngChecked If the {@link guide/expression expression} is truthy, * then special attribute "checked" will be set on the element */ /** * @ngdoc directive * @name ngReadonly * @restrict A * @priority 100 * * @description * The HTML specification does not require browsers to preserve the values of boolean attributes * such as readonly. (Their presence means true and their absence means false.) * If we put an Angular interpolation expression into such an attribute then the * binding information would be lost when the browser removes the attribute. * The `ngReadonly` directive solves this problem for the `readonly` attribute. * This complementary directive is not removed by the browser and so provides * a permanent reliable place to store the binding information. * @example <example> <file name="index.html"> Check me to make text readonly: <input type="checkbox" ng-model="checked"><br/> <input type="text" ng-readonly="checked" value="I'm Angular"/> </file> <file name="protractor.js" type="protractor"> it('should toggle readonly attr', function() { expect(element(by.css('[type="text"]')).getAttribute('readonly')).toBeFalsy(); element(by.model('checked')).click(); expect(element(by.css('[type="text"]')).getAttribute('readonly')).toBeTruthy(); }); </file> </example> * * @element INPUT * @param {expression} ngReadonly If the {@link guide/expression expression} is truthy, * then special attribute "readonly" will be set on the element */ /** * @ngdoc directive * @name ngSelected * @restrict A * @priority 100 * * @description * The HTML specification does not require browsers to preserve the values of boolean attributes * such as selected. (Their presence means true and their absence means false.) * If we put an Angular interpolation expression into such an attribute then the * binding information would be lost when the browser removes the attribute. * The `ngSelected` directive solves this problem for the `selected` attribute. * This complementary directive is not removed by the browser and so provides * a permanent reliable place to store the binding information. * * @example <example> <file name="index.html"> Check me to select: <input type="checkbox" ng-model="selected"><br/> <select> <option>Hello!</option> <option id="greet" ng-selected="selected">Greetings!</option> </select> </file> <file name="protractor.js" type="protractor"> it('should select Greetings!', function() { expect(element(by.id('greet')).getAttribute('selected')).toBeFalsy(); element(by.model('selected')).click(); expect(element(by.id('greet')).getAttribute('selected')).toBeTruthy(); }); </file> </example> * * @element OPTION * @param {expression} ngSelected If the {@link guide/expression expression} is truthy, * then special attribute "selected" will be set on the element */ /** * @ngdoc directive * @name ngOpen * @restrict A * @priority 100 * * @description * The HTML specification does not require browsers to preserve the values of boolean attributes * such as open. (Their presence means true and their absence means false.) * If we put an Angular interpolation expression into such an attribute then the * binding information would be lost when the browser removes the attribute. * The `ngOpen` directive solves this problem for the `open` attribute. * This complementary directive is not removed by the browser and so provides * a permanent reliable place to store the binding information. * @example <example> <file name="index.html"> Check me check multiple: <input type="checkbox" ng-model="open"><br/> <details id="details" ng-open="open"> <summary>Show/Hide me</summary> </details> </file> <file name="protractor.js" type="protractor"> it('should toggle open', function() { expect(element(by.id('details')).getAttribute('open')).toBeFalsy(); element(by.model('open')).click(); expect(element(by.id('details')).getAttribute('open')).toBeTruthy(); }); </file> </example> * * @element DETAILS * @param {expression} ngOpen If the {@link guide/expression expression} is truthy, * then special attribute "open" will be set on the element */ var ngAttributeAliasDirectives = {}; // boolean attrs are evaluated forEach(BOOLEAN_ATTR, function(propName, attrName) { // binding to multiple is not supported if (propName == "multiple") return; var normalized = directiveNormalize('ng-' + attrName); ngAttributeAliasDirectives[normalized] = function() { return { restrict: 'A', priority: 100, link: function(scope, element, attr) { scope.$watch(attr[normalized], function ngBooleanAttrWatchAction(value) { attr.$set(attrName, !!value); }); } }; }; }); // aliased input attrs are evaluated forEach(ALIASED_ATTR, function(htmlAttr, ngAttr) { ngAttributeAliasDirectives[ngAttr] = function() { return { priority: 100, link: function(scope, element, attr) { //special case ngPattern when a literal regular expression value //is used as the expression (this way we don't have to watch anything). if (ngAttr === "ngPattern" && attr.ngPattern.charAt(0) == "/") { var match = attr.ngPattern.match(REGEX_STRING_REGEXP); if (match) { attr.$set("ngPattern", new RegExp(match[1], match[2])); return; } } scope.$watch(attr[ngAttr], function ngAttrAliasWatchAction(value) { attr.$set(ngAttr, value); }); } }; }; }); // ng-src, ng-srcset, ng-href are interpolated forEach(['src', 'srcset', 'href'], function(attrName) { var normalized = directiveNormalize('ng-' + attrName); ngAttributeAliasDirectives[normalized] = function() { return { priority: 99, // it needs to run after the attributes are interpolated link: function(scope, element, attr) { var propName = attrName, name = attrName; if (attrName === 'href' && toString.call(element.prop('href')) === '[object SVGAnimatedString]') { name = 'xlinkHref'; attr.$attr[name] = 'xlink:href'; propName = null; } attr.$observe(normalized, function(value) { if (!value) { if (attrName === 'href') { attr.$set(name, null); } return; } attr.$set(name, value); // on IE, if "ng:src" directive declaration is used and "src" attribute doesn't exist // then calling element.setAttribute('src', 'foo') doesn't do anything, so we need // to set the property as well to achieve the desired effect. // we use attr[attrName] value since $set can sanitize the url. if (msie && propName) element.prop(propName, attr[name]); }); } }; }; }); /* global -nullFormCtrl, -SUBMITTED_CLASS, addSetValidityMethod: true */ var nullFormCtrl = { $addControl: noop, $$renameControl: nullFormRenameControl, $removeControl: noop, $setValidity: noop, $setDirty: noop, $setPristine: noop, $setSubmitted: noop }, SUBMITTED_CLASS = 'ng-submitted'; function nullFormRenameControl(control, name) { control.$name = name; } /** * @ngdoc type * @name form.FormController * * @property {boolean} $pristine True if user has not interacted with the form yet. * @property {boolean} $dirty True if user has already interacted with the form. * @property {boolean} $valid True if all of the containing forms and controls are valid. * @property {boolean} $invalid True if at least one containing control or form is invalid. * @property {boolean} $submitted True if user has submitted the form even if its invalid. * * @property {Object} $error Is an object hash, containing references to controls or * forms with failing validators, where: * * - keys are validation tokens (error names), * - values are arrays of controls or forms that have a failing validator for given error name. * * Built-in validation tokens: * * - `email` * - `max` * - `maxlength` * - `min` * - `minlength` * - `number` * - `pattern` * - `required` * - `url` * - `date` * - `datetimelocal` * - `time` * - `week` * - `month` * * @description * `FormController` keeps track of all its controls and nested forms as well as the state of them, * such as being valid/invalid or dirty/pristine. * * Each {@link ng.directive:form form} directive creates an instance * of `FormController`. * */ //asks for $scope to fool the BC controller module FormController.$inject = ['$element', '$attrs', '$scope', '$animate', '$interpolate']; function FormController(element, attrs, $scope, $animate, $interpolate) { var form = this, controls = []; var parentForm = form.$$parentForm = element.parent().controller('form') || nullFormCtrl; // init state form.$error = {}; form.$$success = {}; form.$pending = undefined; form.$name = $interpolate(attrs.name || attrs.ngForm || '')($scope); form.$dirty = false; form.$pristine = true; form.$valid = true; form.$invalid = false; form.$submitted = false; parentForm.$addControl(form); /** * @ngdoc method * @name form.FormController#$rollbackViewValue * * @description * Rollback all form controls pending updates to the `$modelValue`. * * Updates may be pending by a debounced event or because the input is waiting for a some future * event defined in `ng-model-options`. This method is typically needed by the reset button of * a form that uses `ng-model-options` to pend updates. */ form.$rollbackViewValue = function() { forEach(controls, function(control) { control.$rollbackViewValue(); }); }; /** * @ngdoc method * @name form.FormController#$commitViewValue * * @description * Commit all form controls pending updates to the `$modelValue`. * * Updates may be pending by a debounced event or because the input is waiting for a some future * event defined in `ng-model-options`. This method is rarely needed as `NgModelController` * usually handles calling this in response to input events. */ form.$commitViewValue = function() { forEach(controls, function(control) { control.$commitViewValue(); }); }; /** * @ngdoc method * @name form.FormController#$addControl * * @description * Register a control with the form. * * Input elements using ngModelController do this automatically when they are linked. */ form.$addControl = function(control) { // Breaking change - before, inputs whose name was "hasOwnProperty" were quietly ignored // and not added to the scope. Now we throw an error. assertNotHasOwnProperty(control.$name, 'input'); controls.push(control); if (control.$name) { form[control.$name] = control; } }; // Private API: rename a form control form.$$renameControl = function(control, newName) { var oldName = control.$name; if (form[oldName] === control) { delete form[oldName]; } form[newName] = control; control.$name = newName; }; /** * @ngdoc method * @name form.FormController#$removeControl * * @description * Deregister a control from the form. * * Input elements using ngModelController do this automatically when they are destroyed. */ form.$removeControl = function(control) { if (control.$name && form[control.$name] === control) { delete form[control.$name]; } forEach(form.$pending, function(value, name) { form.$setValidity(name, null, control); }); forEach(form.$error, function(value, name) { form.$setValidity(name, null, control); }); forEach(form.$$success, function(value, name) { form.$setValidity(name, null, control); }); arrayRemove(controls, control); }; /** * @ngdoc method * @name form.FormController#$setValidity * * @description * Sets the validity of a form control. * * This method will also propagate to parent forms. */ addSetValidityMethod({ ctrl: this, $element: element, set: function(object, property, controller) { var list = object[property]; if (!list) { object[property] = [controller]; } else { var index = list.indexOf(controller); if (index === -1) { list.push(controller); } } }, unset: function(object, property, controller) { var list = object[property]; if (!list) { return; } arrayRemove(list, controller); if (list.length === 0) { delete object[property]; } }, parentForm: parentForm, $animate: $animate }); /** * @ngdoc method * @name form.FormController#$setDirty * * @description * Sets the form to a dirty state. * * This method can be called to add the 'ng-dirty' class and set the form to a dirty * state (ng-dirty class). This method will also propagate to parent forms. */ form.$setDirty = function() { $animate.removeClass(element, PRISTINE_CLASS); $animate.addClass(element, DIRTY_CLASS); form.$dirty = true; form.$pristine = false; parentForm.$setDirty(); }; /** * @ngdoc method * @name form.FormController#$setPristine * * @description * Sets the form to its pristine state. * * This method can be called to remove the 'ng-dirty' class and set the form to its pristine * state (ng-pristine class). This method will also propagate to all the controls contained * in this form. * * Setting a form back to a pristine state is often useful when we want to 'reuse' a form after * saving or resetting it. */ form.$setPristine = function() { $animate.setClass(element, PRISTINE_CLASS, DIRTY_CLASS + ' ' + SUBMITTED_CLASS); form.$dirty = false; form.$pristine = true; form.$submitted = false; forEach(controls, function(control) { control.$setPristine(); }); }; /** * @ngdoc method * @name form.FormController#$setUntouched * * @description * Sets the form to its untouched state. * * This method can be called to remove the 'ng-touched' class and set the form controls to their * untouched state (ng-untouched class). * * Setting a form controls back to their untouched state is often useful when setting the form * back to its pristine state. */ form.$setUntouched = function() { forEach(controls, function(control) { control.$setUntouched(); }); }; /** * @ngdoc method * @name form.FormController#$setSubmitted * * @description * Sets the form to its submitted state. */ form.$setSubmitted = function() { $animate.addClass(element, SUBMITTED_CLASS); form.$submitted = true; parentForm.$setSubmitted(); }; } /** * @ngdoc directive * @name ngForm * @restrict EAC * * @description * Nestable alias of {@link ng.directive:form `form`} directive. HTML * does not allow nesting of form elements. It is useful to nest forms, for example if the validity of a * sub-group of controls needs to be determined. * * Note: the purpose of `ngForm` is to group controls, * but not to be a replacement for the `<form>` tag with all of its capabilities * (e.g. posting to the server, ...). * * @param {string=} ngForm|name Name of the form. If specified, the form controller will be published into * related scope, under this name. * */ /** * @ngdoc directive * @name form * @restrict E * * @description * Directive that instantiates * {@link form.FormController FormController}. * * If the `name` attribute is specified, the form controller is published onto the current scope under * this name. * * # Alias: {@link ng.directive:ngForm `ngForm`} * * In Angular forms can be nested. This means that the outer form is valid when all of the child * forms are valid as well. However, browsers do not allow nesting of `<form>` elements, so * Angular provides the {@link ng.directive:ngForm `ngForm`} directive which behaves identically to * `<form>` but can be nested. This allows you to have nested forms, which is very useful when * using Angular validation directives in forms that are dynamically generated using the * {@link ng.directive:ngRepeat `ngRepeat`} directive. Since you cannot dynamically generate the `name` * attribute of input elements using interpolation, you have to wrap each set of repeated inputs in an * `ngForm` directive and nest these in an outer `form` element. * * * # CSS classes * - `ng-valid` is set if the form is valid. * - `ng-invalid` is set if the form is invalid. * - `ng-pristine` is set if the form is pristine. * - `ng-dirty` is set if the form is dirty. * - `ng-submitted` is set if the form was submitted. * * Keep in mind that ngAnimate can detect each of these classes when added and removed. * * * # Submitting a form and preventing the default action * * Since the role of forms in client-side Angular applications is different than in classical * roundtrip apps, it is desirable for the browser not to translate the form submission into a full * page reload that sends the data to the server. Instead some javascript logic should be triggered * to handle the form submission in an application-specific way. * * For this reason, Angular prevents the default action (form submission to the server) unless the * `<form>` element has an `action` attribute specified. * * You can use one of the following two ways to specify what javascript method should be called when * a form is submitted: * * - {@link ng.directive:ngSubmit ngSubmit} directive on the form element * - {@link ng.directive:ngClick ngClick} directive on the first * button or input field of type submit (input[type=submit]) * * To prevent double execution of the handler, use only one of the {@link ng.directive:ngSubmit ngSubmit} * or {@link ng.directive:ngClick ngClick} directives. * This is because of the following form submission rules in the HTML specification: * * - If a form has only one input field then hitting enter in this field triggers form submit * (`ngSubmit`) * - if a form has 2+ input fields and no buttons or input[type=submit] then hitting enter * doesn't trigger submit * - if a form has one or more input fields and one or more buttons or input[type=submit] then * hitting enter in any of the input fields will trigger the click handler on the *first* button or * input[type=submit] (`ngClick`) *and* a submit handler on the enclosing form (`ngSubmit`) * * Any pending `ngModelOptions` changes will take place immediately when an enclosing form is * submitted. Note that `ngClick` events will occur before the model is updated. Use `ngSubmit` * to have access to the updated model. * * ## Animation Hooks * * Animations in ngForm are triggered when any of the associated CSS classes are added and removed. * These classes are: `.ng-pristine`, `.ng-dirty`, `.ng-invalid` and `.ng-valid` as well as any * other validations that are performed within the form. Animations in ngForm are similar to how * they work in ngClass and animations can be hooked into using CSS transitions, keyframes as well * as JS animations. * * The following example shows a simple way to utilize CSS transitions to style a form element * that has been rendered as invalid after it has been validated: * * <pre> * //be sure to include ngAnimate as a module to hook into more * //advanced animations * .my-form { * transition:0.5s linear all; * background: white; * } * .my-form.ng-invalid { * background: red; * color:white; * } * </pre> * * @example <example deps="angular-animate.js" animations="true" fixBase="true" module="formExample"> <file name="index.html"> <script> angular.module('formExample', []) .controller('FormController', ['$scope', function($scope) { $scope.userType = 'guest'; }]); </script> <style> .my-form { -webkit-transition:all linear 0.5s; transition:all linear 0.5s; background: transparent; } .my-form.ng-invalid { background: red; } </style> <form name="myForm" ng-controller="FormController" class="my-form"> userType: <input name="input" ng-model="userType" required> <span class="error" ng-show="myForm.input.$error.required">Required!</span><br> <tt>userType = {{userType}}</tt><br> <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br> <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br> <tt>myForm.$valid = {{myForm.$valid}}</tt><br> <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br> </form> </file> <file name="protractor.js" type="protractor"> it('should initialize to model', function() { var userType = element(by.binding('userType')); var valid = element(by.binding('myForm.input.$valid')); expect(userType.getText()).toContain('guest'); expect(valid.getText()).toContain('true'); }); it('should be invalid if empty', function() { var userType = element(by.binding('userType')); var valid = element(by.binding('myForm.input.$valid')); var userInput = element(by.model('userType')); userInput.clear(); userInput.sendKeys(''); expect(userType.getText()).toEqual('userType ='); expect(valid.getText()).toContain('false'); }); </file> </example> * * @param {string=} name Name of the form. If specified, the form controller will be published into * related scope, under this name. */ var formDirectiveFactory = function(isNgForm) { return ['$timeout', function($timeout) { var formDirective = { name: 'form', restrict: isNgForm ? 'EAC' : 'E', controller: FormController, compile: function ngFormCompile(formElement) { // Setup initial state of the control formElement.addClass(PRISTINE_CLASS).addClass(VALID_CLASS); return { pre: function ngFormPreLink(scope, formElement, attr, controller) { // if `action` attr is not present on the form, prevent the default action (submission) if (!('action' in attr)) { // we can't use jq events because if a form is destroyed during submission the default // action is not prevented. see #1238 // // IE 9 is not affected because it doesn't fire a submit event and try to do a full // page reload if the form was destroyed by submission of the form via a click handler // on a button in the form. Looks like an IE9 specific bug. var handleFormSubmission = function(event) { scope.$apply(function() { controller.$commitViewValue(); controller.$setSubmitted(); }); event.preventDefault(); }; addEventListenerFn(formElement[0], 'submit', handleFormSubmission); // unregister the preventDefault listener so that we don't not leak memory but in a // way that will achieve the prevention of the default action. formElement.on('$destroy', function() { $timeout(function() { removeEventListenerFn(formElement[0], 'submit', handleFormSubmission); }, 0, false); }); } var parentFormCtrl = controller.$$parentForm, alias = controller.$name; if (alias) { setter(scope, null, alias, controller, alias); attr.$observe(attr.name ? 'name' : 'ngForm', function(newValue) { if (alias === newValue) return; setter(scope, null, alias, undefined, alias); alias = newValue; setter(scope, null, alias, controller, alias); parentFormCtrl.$$renameControl(controller, alias); }); } formElement.on('$destroy', function() { parentFormCtrl.$removeControl(controller); if (alias) { setter(scope, null, alias, undefined, alias); } extend(controller, nullFormCtrl); //stop propagating child destruction handlers upwards }); } }; } }; return formDirective; }]; }; var formDirective = formDirectiveFactory(); var ngFormDirective = formDirectiveFactory(true); /* global VALID_CLASS: false, INVALID_CLASS: false, PRISTINE_CLASS: false, DIRTY_CLASS: false, UNTOUCHED_CLASS: false, TOUCHED_CLASS: false, $ngModelMinErr: false, */ // Regex code is obtained from SO: https://stackoverflow.com/questions/3143070/javascript-regex-iso-datetime#answer-3143231 var ISO_DATE_REGEXP = /\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z)/; var URL_REGEXP = /^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/; var EMAIL_REGEXP = /^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i; var NUMBER_REGEXP = /^\s*(\-|\+)?(\d+|(\d*(\.\d*)))\s*$/; var DATE_REGEXP = /^(\d{4})-(\d{2})-(\d{2})$/; var DATETIMELOCAL_REGEXP = /^(\d{4})-(\d\d)-(\d\d)T(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/; var WEEK_REGEXP = /^(\d{4})-W(\d\d)$/; var MONTH_REGEXP = /^(\d{4})-(\d\d)$/; var TIME_REGEXP = /^(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/; var inputType = { /** * @ngdoc input * @name input[text] * * @description * Standard HTML text input with angular data binding, inherited by most of the `input` elements. * * * @param {string} ngModel Assignable angular expression to data-bind to. * @param {string=} name Property name of the form under which the control is published. * @param {string=} required Adds `required` validation error key if the value is not entered. * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of * `required` when you want to data-bind to the `required` attribute. * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than * minlength. * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of * any length. * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string * that contains the regular expression body that will be converted to a regular expression * as in the ngPattern directive. * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel value does not match * a RegExp found by evaluating the Angular expression given in the attribute value. * If the expression evaluates to a RegExp object then this is used directly. * If the expression is a string then it will be converted to a RegExp after wrapping it in `^` and `$` * characters. For instance, `"abc"` will be converted to `new RegExp('^abc$')`. * @param {string=} ngChange Angular expression to be executed when input changes due to user * interaction with the input element. * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input. * This parameter is ignored for input[type=password] controls, which will never trim the * input. * * @example <example name="text-input-directive" module="textInputExample"> <file name="index.html"> <script> angular.module('textInputExample', []) .controller('ExampleController', ['$scope', function($scope) { $scope.example = { text: 'guest', word: /^\s*\w*\s*$/ }; }]); </script> <form name="myForm" ng-controller="ExampleController"> Single word: <input type="text" name="input" ng-model="example.text" ng-pattern="example.word" required ng-trim="false"> <span class="error" ng-show="myForm.input.$error.required"> Required!</span> <span class="error" ng-show="myForm.input.$error.pattern"> Single word only!</span> <tt>text = {{example.text}}</tt><br/> <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/> <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/> <tt>myForm.$valid = {{myForm.$valid}}</tt><br/> <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/> </form> </file> <file name="protractor.js" type="protractor"> var text = element(by.binding('example.text')); var valid = element(by.binding('myForm.input.$valid')); var input = element(by.model('example.text')); it('should initialize to model', function() { expect(text.getText()).toContain('guest'); expect(valid.getText()).toContain('true'); }); it('should be invalid if empty', function() { input.clear(); input.sendKeys(''); expect(text.getText()).toEqual('text ='); expect(valid.getText()).toContain('false'); }); it('should be invalid if multi word', function() { input.clear(); input.sendKeys('hello world'); expect(valid.getText()).toContain('false'); }); </file> </example> */ 'text': textInputType, /** * @ngdoc input * @name input[date] * * @description * Input with date validation and transformation. In browsers that do not yet support * the HTML5 date input, a text element will be used. In that case, text must be entered in a valid ISO-8601 * date format (yyyy-MM-dd), for example: `2009-01-06`. Since many * modern browsers do not yet support this input type, it is important to provide cues to users on the * expected input format via a placeholder or label. * * The model must always be a Date object, otherwise Angular will throw an error. * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string. * * The timezone to be used to read/write the `Date` instance in the model can be defined using * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser. * * @param {string} ngModel Assignable angular expression to data-bind to. * @param {string=} name Property name of the form under which the control is published. * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`. This must be a * valid ISO date string (yyyy-MM-dd). * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`. This must be * a valid ISO date string (yyyy-MM-dd). * @param {string=} required Sets `required` validation error key if the value is not entered. * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of * `required` when you want to data-bind to the `required` attribute. * @param {string=} ngChange Angular expression to be executed when input changes due to user * interaction with the input element. * * @example <example name="date-input-directive" module="dateInputExample"> <file name="index.html"> <script> angular.module('dateInputExample', []) .controller('DateController', ['$scope', function($scope) { $scope.example = { value: new Date(2013, 9, 22) }; }]); </script> <form name="myForm" ng-controller="DateController as dateCtrl"> Pick a date in 2013: <input type="date" id="exampleInput" name="input" ng-model="example.value" placeholder="yyyy-MM-dd" min="2013-01-01" max="2013-12-31" required /> <span class="error" ng-show="myForm.input.$error.required"> Required!</span> <span class="error" ng-show="myForm.input.$error.date"> Not a valid date!</span> <tt>value = {{example.value | date: "yyyy-MM-dd"}}</tt><br/> <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/> <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/> <tt>myForm.$valid = {{myForm.$valid}}</tt><br/> <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/> </form> </file> <file name="protractor.js" type="protractor"> var value = element(by.binding('example.value | date: "yyyy-MM-dd"')); var valid = element(by.binding('myForm.input.$valid')); var input = element(by.model('example.value')); // currently protractor/webdriver does not support // sending keys to all known HTML5 input controls // for various browsers (see https://github.com/angular/protractor/issues/562). function setInput(val) { // set the value of the element and force validation. var scr = "var ipt = document.getElementById('exampleInput'); " + "ipt.value = '" + val + "';" + "angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('" + val + "'); });"; browser.executeScript(scr); } it('should initialize to model', function() { expect(value.getText()).toContain('2013-10-22'); expect(valid.getText()).toContain('myForm.input.$valid = true'); }); it('should be invalid if empty', function() { setInput(''); expect(value.getText()).toEqual('value ='); expect(valid.getText()).toContain('myForm.input.$valid = false'); }); it('should be invalid if over max', function() { setInput('2015-01-01'); expect(value.getText()).toContain(''); expect(valid.getText()).toContain('myForm.input.$valid = false'); }); </file> </example> */ 'date': createDateInputType('date', DATE_REGEXP, createDateParser(DATE_REGEXP, ['yyyy', 'MM', 'dd']), 'yyyy-MM-dd'), /** * @ngdoc input * @name input[datetime-local] * * @description * Input with datetime validation and transformation. In browsers that do not yet support * the HTML5 date input, a text element will be used. In that case, the text must be entered in a valid ISO-8601 * local datetime format (yyyy-MM-ddTHH:mm:ss), for example: `2010-12-28T14:57:00`. * * The model must always be a Date object, otherwise Angular will throw an error. * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string. * * The timezone to be used to read/write the `Date` instance in the model can be defined using * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser. * * @param {string} ngModel Assignable angular expression to data-bind to. * @param {string=} name Property name of the form under which the control is published. * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`. This must be a * valid ISO datetime format (yyyy-MM-ddTHH:mm:ss). * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`. This must be * a valid ISO datetime format (yyyy-MM-ddTHH:mm:ss). * @param {string=} required Sets `required` validation error key if the value is not entered. * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of * `required` when you want to data-bind to the `required` attribute. * @param {string=} ngChange Angular expression to be executed when input changes due to user * interaction with the input element. * * @example <example name="datetimelocal-input-directive" module="dateExample"> <file name="index.html"> <script> angular.module('dateExample', []) .controller('DateController', ['$scope', function($scope) { $scope.example = { value: new Date(2010, 11, 28, 14, 57) }; }]); </script> <form name="myForm" ng-controller="DateController as dateCtrl"> Pick a date between in 2013: <input type="datetime-local" id="exampleInput" name="input" ng-model="example.value" placeholder="yyyy-MM-ddTHH:mm:ss" min="2001-01-01T00:00:00" max="2013-12-31T00:00:00" required /> <span class="error" ng-show="myForm.input.$error.required"> Required!</span> <span class="error" ng-show="myForm.input.$error.datetimelocal"> Not a valid date!</span> <tt>value = {{example.value | date: "yyyy-MM-ddTHH:mm:ss"}}</tt><br/> <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/> <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/> <tt>myForm.$valid = {{myForm.$valid}}</tt><br/> <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/> </form> </file> <file name="protractor.js" type="protractor"> var value = element(by.binding('example.value | date: "yyyy-MM-ddTHH:mm:ss"')); var valid = element(by.binding('myForm.input.$valid')); var input = element(by.model('example.value')); // currently protractor/webdriver does not support // sending keys to all known HTML5 input controls // for various browsers (https://github.com/angular/protractor/issues/562). function setInput(val) { // set the value of the element and force validation. var scr = "var ipt = document.getElementById('exampleInput'); " + "ipt.value = '" + val + "';" + "angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('" + val + "'); });"; browser.executeScript(scr); } it('should initialize to model', function() { expect(value.getText()).toContain('2010-12-28T14:57:00'); expect(valid.getText()).toContain('myForm.input.$valid = true'); }); it('should be invalid if empty', function() { setInput(''); expect(value.getText()).toEqual('value ='); expect(valid.getText()).toContain('myForm.input.$valid = false'); }); it('should be invalid if over max', function() { setInput('2015-01-01T23:59:00'); expect(value.getText()).toContain(''); expect(valid.getText()).toContain('myForm.input.$valid = false'); }); </file> </example> */ 'datetime-local': createDateInputType('datetimelocal', DATETIMELOCAL_REGEXP, createDateParser(DATETIMELOCAL_REGEXP, ['yyyy', 'MM', 'dd', 'HH', 'mm', 'ss', 'sss']), 'yyyy-MM-ddTHH:mm:ss.sss'), /** * @ngdoc input * @name input[time] * * @description * Input with time validation and transformation. In browsers that do not yet support * the HTML5 date input, a text element will be used. In that case, the text must be entered in a valid ISO-8601 * local time format (HH:mm:ss), for example: `14:57:00`. Model must be a Date object. This binding will always output a * Date object to the model of January 1, 1970, or local date `new Date(1970, 0, 1, HH, mm, ss)`. * * The model must always be a Date object, otherwise Angular will throw an error. * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string. * * The timezone to be used to read/write the `Date` instance in the model can be defined using * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser. * * @param {string} ngModel Assignable angular expression to data-bind to. * @param {string=} name Property name of the form under which the control is published. * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`. This must be a * valid ISO time format (HH:mm:ss). * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`. This must be a * valid ISO time format (HH:mm:ss). * @param {string=} required Sets `required` validation error key if the value is not entered. * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of * `required` when you want to data-bind to the `required` attribute. * @param {string=} ngChange Angular expression to be executed when input changes due to user * interaction with the input element. * * @example <example name="time-input-directive" module="timeExample"> <file name="index.html"> <script> angular.module('timeExample', []) .controller('DateController', ['$scope', function($scope) { $scope.example = { value: new Date(1970, 0, 1, 14, 57, 0) }; }]); </script> <form name="myForm" ng-controller="DateController as dateCtrl"> Pick a between 8am and 5pm: <input type="time" id="exampleInput" name="input" ng-model="example.value" placeholder="HH:mm:ss" min="08:00:00" max="17:00:00" required /> <span class="error" ng-show="myForm.input.$error.required"> Required!</span> <span class="error" ng-show="myForm.input.$error.time"> Not a valid date!</span> <tt>value = {{example.value | date: "HH:mm:ss"}}</tt><br/> <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/> <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/> <tt>myForm.$valid = {{myForm.$valid}}</tt><br/> <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/> </form> </file> <file name="protractor.js" type="protractor"> var value = element(by.binding('example.value | date: "HH:mm:ss"')); var valid = element(by.binding('myForm.input.$valid')); var input = element(by.model('example.value')); // currently protractor/webdriver does not support // sending keys to all known HTML5 input controls // for various browsers (https://github.com/angular/protractor/issues/562). function setInput(val) { // set the value of the element and force validation. var scr = "var ipt = document.getElementById('exampleInput'); " + "ipt.value = '" + val + "';" + "angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('" + val + "'); });"; browser.executeScript(scr); } it('should initialize to model', function() { expect(value.getText()).toContain('14:57:00'); expect(valid.getText()).toContain('myForm.input.$valid = true'); }); it('should be invalid if empty', function() { setInput(''); expect(value.getText()).toEqual('value ='); expect(valid.getText()).toContain('myForm.input.$valid = false'); }); it('should be invalid if over max', function() { setInput('23:59:00'); expect(value.getText()).toContain(''); expect(valid.getText()).toContain('myForm.input.$valid = false'); }); </file> </example> */ 'time': createDateInputType('time', TIME_REGEXP, createDateParser(TIME_REGEXP, ['HH', 'mm', 'ss', 'sss']), 'HH:mm:ss.sss'), /** * @ngdoc input * @name input[week] * * @description * Input with week-of-the-year validation and transformation to Date. In browsers that do not yet support * the HTML5 week input, a text element will be used. In that case, the text must be entered in a valid ISO-8601 * week format (yyyy-W##), for example: `2013-W02`. * * The model must always be a Date object, otherwise Angular will throw an error. * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string. * * The timezone to be used to read/write the `Date` instance in the model can be defined using * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser. * * @param {string} ngModel Assignable angular expression to data-bind to. * @param {string=} name Property name of the form under which the control is published. * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`. This must be a * valid ISO week format (yyyy-W##). * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`. This must be * a valid ISO week format (yyyy-W##). * @param {string=} required Sets `required` validation error key if the value is not entered. * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of * `required` when you want to data-bind to the `required` attribute. * @param {string=} ngChange Angular expression to be executed when input changes due to user * interaction with the input element. * * @example <example name="week-input-directive" module="weekExample"> <file name="index.html"> <script> angular.module('weekExample', []) .controller('DateController', ['$scope', function($scope) { $scope.example = { value: new Date(2013, 0, 3) }; }]); </script> <form name="myForm" ng-controller="DateController as dateCtrl"> Pick a date between in 2013: <input id="exampleInput" type="week" name="input" ng-model="example.value" placeholder="YYYY-W##" min="2012-W32" max="2013-W52" required /> <span class="error" ng-show="myForm.input.$error.required"> Required!</span> <span class="error" ng-show="myForm.input.$error.week"> Not a valid date!</span> <tt>value = {{example.value | date: "yyyy-Www"}}</tt><br/> <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/> <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/> <tt>myForm.$valid = {{myForm.$valid}}</tt><br/> <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/> </form> </file> <file name="protractor.js" type="protractor"> var value = element(by.binding('example.value | date: "yyyy-Www"')); var valid = element(by.binding('myForm.input.$valid')); var input = element(by.model('example.value')); // currently protractor/webdriver does not support // sending keys to all known HTML5 input controls // for various browsers (https://github.com/angular/protractor/issues/562). function setInput(val) { // set the value of the element and force validation. var scr = "var ipt = document.getElementById('exampleInput'); " + "ipt.value = '" + val + "';" + "angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('" + val + "'); });"; browser.executeScript(scr); } it('should initialize to model', function() { expect(value.getText()).toContain('2013-W01'); expect(valid.getText()).toContain('myForm.input.$valid = true'); }); it('should be invalid if empty', function() { setInput(''); expect(value.getText()).toEqual('value ='); expect(valid.getText()).toContain('myForm.input.$valid = false'); }); it('should be invalid if over max', function() { setInput('2015-W01'); expect(value.getText()).toContain(''); expect(valid.getText()).toContain('myForm.input.$valid = false'); }); </file> </example> */ 'week': createDateInputType('week', WEEK_REGEXP, weekParser, 'yyyy-Www'), /** * @ngdoc input * @name input[month] * * @description * Input with month validation and transformation. In browsers that do not yet support * the HTML5 month input, a text element will be used. In that case, the text must be entered in a valid ISO-8601 * month format (yyyy-MM), for example: `2009-01`. * * The model must always be a Date object, otherwise Angular will throw an error. * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string. * If the model is not set to the first of the month, the next view to model update will set it * to the first of the month. * * The timezone to be used to read/write the `Date` instance in the model can be defined using * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser. * * @param {string} ngModel Assignable angular expression to data-bind to. * @param {string=} name Property name of the form under which the control is published. * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`. This must be * a valid ISO month format (yyyy-MM). * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`. This must * be a valid ISO month format (yyyy-MM). * @param {string=} required Sets `required` validation error key if the value is not entered. * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of * `required` when you want to data-bind to the `required` attribute. * @param {string=} ngChange Angular expression to be executed when input changes due to user * interaction with the input element. * * @example <example name="month-input-directive" module="monthExample"> <file name="index.html"> <script> angular.module('monthExample', []) .controller('DateController', ['$scope', function($scope) { $scope.example = { value: new Date(2013, 9, 1) }; }]); </script> <form name="myForm" ng-controller="DateController as dateCtrl"> Pick a month in 2013: <input id="exampleInput" type="month" name="input" ng-model="example.value" placeholder="yyyy-MM" min="2013-01" max="2013-12" required /> <span class="error" ng-show="myForm.input.$error.required"> Required!</span> <span class="error" ng-show="myForm.input.$error.month"> Not a valid month!</span> <tt>value = {{example.value | date: "yyyy-MM"}}</tt><br/> <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/> <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/> <tt>myForm.$valid = {{myForm.$valid}}</tt><br/> <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/> </form> </file> <file name="protractor.js" type="protractor"> var value = element(by.binding('example.value | date: "yyyy-MM"')); var valid = element(by.binding('myForm.input.$valid')); var input = element(by.model('example.value')); // currently protractor/webdriver does not support // sending keys to all known HTML5 input controls // for various browsers (https://github.com/angular/protractor/issues/562). function setInput(val) { // set the value of the element and force validation. var scr = "var ipt = document.getElementById('exampleInput'); " + "ipt.value = '" + val + "';" + "angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('" + val + "'); });"; browser.executeScript(scr); } it('should initialize to model', function() { expect(value.getText()).toContain('2013-10'); expect(valid.getText()).toContain('myForm.input.$valid = true'); }); it('should be invalid if empty', function() { setInput(''); expect(value.getText()).toEqual('value ='); expect(valid.getText()).toContain('myForm.input.$valid = false'); }); it('should be invalid if over max', function() { setInput('2015-01'); expect(value.getText()).toContain(''); expect(valid.getText()).toContain('myForm.input.$valid = false'); }); </file> </example> */ 'month': createDateInputType('month', MONTH_REGEXP, createDateParser(MONTH_REGEXP, ['yyyy', 'MM']), 'yyyy-MM'), /** * @ngdoc input * @name input[number] * * @description * Text input with number validation and transformation. Sets the `number` validation * error if not a valid number. * * The model must always be a number, otherwise Angular will throw an error. * * @param {string} ngModel Assignable angular expression to data-bind to. * @param {string=} name Property name of the form under which the control is published. * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`. * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`. * @param {string=} required Sets `required` validation error key if the value is not entered. * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of * `required` when you want to data-bind to the `required` attribute. * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than * minlength. * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of * any length. * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string * that contains the regular expression body that will be converted to a regular expression * as in the ngPattern directive. * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel value does not match * a RegExp found by evaluating the Angular expression given in the attribute value. * If the expression evaluates to a RegExp object then this is used directly. * If the expression is a string then it will be converted to a RegExp after wrapping it in `^` and `$` * characters. For instance, `"abc"` will be converted to `new RegExp('^abc$')`. * @param {string=} ngChange Angular expression to be executed when input changes due to user * interaction with the input element. * * @example <example name="number-input-directive" module="numberExample"> <file name="index.html"> <script> angular.module('numberExample', []) .controller('ExampleController', ['$scope', function($scope) { $scope.example = { value: 12 }; }]); </script> <form name="myForm" ng-controller="ExampleController"> Number: <input type="number" name="input" ng-model="example.value" min="0" max="99" required> <span class="error" ng-show="myForm.input.$error.required"> Required!</span> <span class="error" ng-show="myForm.input.$error.number"> Not valid number!</span> <tt>value = {{example.value}}</tt><br/> <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/> <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/> <tt>myForm.$valid = {{myForm.$valid}}</tt><br/> <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/> </form> </file> <file name="protractor.js" type="protractor"> var value = element(by.binding('example.value')); var valid = element(by.binding('myForm.input.$valid')); var input = element(by.model('example.value')); it('should initialize to model', function() { expect(value.getText()).toContain('12'); expect(valid.getText()).toContain('true'); }); it('should be invalid if empty', function() { input.clear(); input.sendKeys(''); expect(value.getText()).toEqual('value ='); expect(valid.getText()).toContain('false'); }); it('should be invalid if over max', function() { input.clear(); input.sendKeys('123'); expect(value.getText()).toEqual('value ='); expect(valid.getText()).toContain('false'); }); </file> </example> */ 'number': numberInputType, /** * @ngdoc input * @name input[url] * * @description * Text input with URL validation. Sets the `url` validation error key if the content is not a * valid URL. * * <div class="alert alert-warning"> * **Note:** `input[url]` uses a regex to validate urls that is derived from the regex * used in Chromium. If you need stricter validation, you can use `ng-pattern` or modify * the built-in validators (see the {@link guide/forms Forms guide}) * </div> * * @param {string} ngModel Assignable angular expression to data-bind to. * @param {string=} name Property name of the form under which the control is published. * @param {string=} required Sets `required` validation error key if the value is not entered. * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of * `required` when you want to data-bind to the `required` attribute. * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than * minlength. * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of * any length. * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string * that contains the regular expression body that will be converted to a regular expression * as in the ngPattern directive. * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel value does not match * a RegExp found by evaluating the Angular expression given in the attribute value. * If the expression evaluates to a RegExp object then this is used directly. * If the expression is a string then it will be converted to a RegExp after wrapping it in `^` and `$` * characters. For instance, `"abc"` will be converted to `new RegExp('^abc$')`. * @param {string=} ngChange Angular expression to be executed when input changes due to user * interaction with the input element. * * @example <example name="url-input-directive" module="urlExample"> <file name="index.html"> <script> angular.module('urlExample', []) .controller('ExampleController', ['$scope', function($scope) { $scope.url = { text: 'http://google.com' }; }]); </script> <form name="myForm" ng-controller="ExampleController"> URL: <input type="url" name="input" ng-model="url.text" required> <span class="error" ng-show="myForm.input.$error.required"> Required!</span> <span class="error" ng-show="myForm.input.$error.url"> Not valid url!</span> <tt>text = {{url.text}}</tt><br/> <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/> <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/> <tt>myForm.$valid = {{myForm.$valid}}</tt><br/> <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/> <tt>myForm.$error.url = {{!!myForm.$error.url}}</tt><br/> </form> </file> <file name="protractor.js" type="protractor"> var text = element(by.binding('url.text')); var valid = element(by.binding('myForm.input.$valid')); var input = element(by.model('url.text')); it('should initialize to model', function() { expect(text.getText()).toContain('http://google.com'); expect(valid.getText()).toContain('true'); }); it('should be invalid if empty', function() { input.clear(); input.sendKeys(''); expect(text.getText()).toEqual('text ='); expect(valid.getText()).toContain('false'); }); it('should be invalid if not url', function() { input.clear(); input.sendKeys('box'); expect(valid.getText()).toContain('false'); }); </file> </example> */ 'url': urlInputType, /** * @ngdoc input * @name input[email] * * @description * Text input with email validation. Sets the `email` validation error key if not a valid email * address. * * <div class="alert alert-warning"> * **Note:** `input[email]` uses a regex to validate email addresses that is derived from the regex * used in Chromium. If you need stricter validation (e.g. requiring a top-level domain), you can * use `ng-pattern` or modify the built-in validators (see the {@link guide/forms Forms guide}) * </div> * * @param {string} ngModel Assignable angular expression to data-bind to. * @param {string=} name Property name of the form under which the control is published. * @param {string=} required Sets `required` validation error key if the value is not entered. * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of * `required` when you want to data-bind to the `required` attribute. * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than * minlength. * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of * any length. * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string * that contains the regular expression body that will be converted to a regular expression * as in the ngPattern directive. * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel value does not match * a RegExp found by evaluating the Angular expression given in the attribute value. * If the expression evaluates to a RegExp object then this is used directly. * If the expression is a string then it will be converted to a RegExp after wrapping it in `^` and `$` * characters. For instance, `"abc"` will be converted to `new RegExp('^abc$')`. * @param {string=} ngChange Angular expression to be executed when input changes due to user * interaction with the input element. * * @example <example name="email-input-directive" module="emailExample"> <file name="index.html"> <script> angular.module('emailExample', []) .controller('ExampleController', ['$scope', function($scope) { $scope.email = { text: 'me@example.com' }; }]); </script> <form name="myForm" ng-controller="ExampleController"> Email: <input type="email" name="input" ng-model="email.text" required> <span class="error" ng-show="myForm.input.$error.required"> Required!</span> <span class="error" ng-show="myForm.input.$error.email"> Not valid email!</span> <tt>text = {{email.text}}</tt><br/> <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/> <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/> <tt>myForm.$valid = {{myForm.$valid}}</tt><br/> <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/> <tt>myForm.$error.email = {{!!myForm.$error.email}}</tt><br/> </form> </file> <file name="protractor.js" type="protractor"> var text = element(by.binding('email.text')); var valid = element(by.binding('myForm.input.$valid')); var input = element(by.model('email.text')); it('should initialize to model', function() { expect(text.getText()).toContain('me@example.com'); expect(valid.getText()).toContain('true'); }); it('should be invalid if empty', function() { input.clear(); input.sendKeys(''); expect(text.getText()).toEqual('text ='); expect(valid.getText()).toContain('false'); }); it('should be invalid if not email', function() { input.clear(); input.sendKeys('xxx'); expect(valid.getText()).toContain('false'); }); </file> </example> */ 'email': emailInputType, /** * @ngdoc input * @name input[radio] * * @description * HTML radio button. * * @param {string} ngModel Assignable angular expression to data-bind to. * @param {string} value The value to which the expression should be set when selected. * @param {string=} name Property name of the form under which the control is published. * @param {string=} ngChange Angular expression to be executed when input changes due to user * interaction with the input element. * @param {string} ngValue Angular expression which sets the value to which the expression should * be set when selected. * * @example <example name="radio-input-directive" module="radioExample"> <file name="index.html"> <script> angular.module('radioExample', []) .controller('ExampleController', ['$scope', function($scope) { $scope.color = { name: 'blue' }; $scope.specialValue = { "id": "12345", "value": "green" }; }]); </script> <form name="myForm" ng-controller="ExampleController"> <input type="radio" ng-model="color.name" value="red"> Red <br/> <input type="radio" ng-model="color.name" ng-value="specialValue"> Green <br/> <input type="radio" ng-model="color.name" value="blue"> Blue <br/> <tt>color = {{color.name | json}}</tt><br/> </form> Note that `ng-value="specialValue"` sets radio item's value to be the value of `$scope.specialValue`. </file> <file name="protractor.js" type="protractor"> it('should change state', function() { var color = element(by.binding('color.name')); expect(color.getText()).toContain('blue'); element.all(by.model('color.name')).get(0).click(); expect(color.getText()).toContain('red'); }); </file> </example> */ 'radio': radioInputType, /** * @ngdoc input * @name input[checkbox] * * @description * HTML checkbox. * * @param {string} ngModel Assignable angular expression to data-bind to. * @param {string=} name Property name of the form under which the control is published. * @param {expression=} ngTrueValue The value to which the expression should be set when selected. * @param {expression=} ngFalseValue The value to which the expression should be set when not selected. * @param {string=} ngChange Angular expression to be executed when input changes due to user * interaction with the input element. * * @example <example name="checkbox-input-directive" module="checkboxExample"> <file name="index.html"> <script> angular.module('checkboxExample', []) .controller('ExampleController', ['$scope', function($scope) { $scope.checkboxModel = { value1 : true, value2 : 'YES' }; }]); </script> <form name="myForm" ng-controller="ExampleController"> Value1: <input type="checkbox" ng-model="checkboxModel.value1"> <br/> Value2: <input type="checkbox" ng-model="checkboxModel.value2" ng-true-value="'YES'" ng-false-value="'NO'"> <br/> <tt>value1 = {{checkboxModel.value1}}</tt><br/> <tt>value2 = {{checkboxModel.value2}}</tt><br/> </form> </file> <file name="protractor.js" type="protractor"> it('should change state', function() { var value1 = element(by.binding('checkboxModel.value1')); var value2 = element(by.binding('checkboxModel.value2')); expect(value1.getText()).toContain('true'); expect(value2.getText()).toContain('YES'); element(by.model('checkboxModel.value1')).click(); element(by.model('checkboxModel.value2')).click(); expect(value1.getText()).toContain('false'); expect(value2.getText()).toContain('NO'); }); </file> </example> */ 'checkbox': checkboxInputType, 'hidden': noop, 'button': noop, 'submit': noop, 'reset': noop, 'file': noop }; function stringBasedInputType(ctrl) { ctrl.$formatters.push(function(value) { return ctrl.$isEmpty(value) ? value : value.toString(); }); } function textInputType(scope, element, attr, ctrl, $sniffer, $browser) { baseInputType(scope, element, attr, ctrl, $sniffer, $browser); stringBasedInputType(ctrl); } function baseInputType(scope, element, attr, ctrl, $sniffer, $browser) { var type = lowercase(element[0].type); // In composition mode, users are still inputing intermediate text buffer, // hold the listener until composition is done. // More about composition events: https://developer.mozilla.org/en-US/docs/Web/API/CompositionEvent if (!$sniffer.android) { var composing = false; element.on('compositionstart', function(data) { composing = true; }); element.on('compositionend', function() { composing = false; listener(); }); } var listener = function(ev) { if (timeout) { $browser.defer.cancel(timeout); timeout = null; } if (composing) return; var value = element.val(), event = ev && ev.type; // By default we will trim the value // If the attribute ng-trim exists we will avoid trimming // If input type is 'password', the value is never trimmed if (type !== 'password' && (!attr.ngTrim || attr.ngTrim !== 'false')) { value = trim(value); } // If a control is suffering from bad input (due to native validators), browsers discard its // value, so it may be necessary to revalidate (by calling $setViewValue again) even if the // control's value is the same empty value twice in a row. if (ctrl.$viewValue !== value || (value === '' && ctrl.$$hasNativeValidators)) { ctrl.$setViewValue(value, event); } }; // if the browser does support "input" event, we are fine - except on IE9 which doesn't fire the // input event on backspace, delete or cut if ($sniffer.hasEvent('input')) { element.on('input', listener); } else { var timeout; var deferListener = function(ev, input, origValue) { if (!timeout) { timeout = $browser.defer(function() { timeout = null; if (!input || input.value !== origValue) { listener(ev); } }); } }; element.on('keydown', function(event) { var key = event.keyCode; // ignore // command modifiers arrows if (key === 91 || (15 < key && key < 19) || (37 <= key && key <= 40)) return; deferListener(event, this, this.value); }); // if user modifies input value using context menu in IE, we need "paste" and "cut" events to catch it if ($sniffer.hasEvent('paste')) { element.on('paste cut', deferListener); } } // if user paste into input using mouse on older browser // or form autocomplete on newer browser, we need "change" event to catch it element.on('change', listener); ctrl.$render = function() { element.val(ctrl.$isEmpty(ctrl.$viewValue) ? '' : ctrl.$viewValue); }; } function weekParser(isoWeek, existingDate) { if (isDate(isoWeek)) { return isoWeek; } if (isString(isoWeek)) { WEEK_REGEXP.lastIndex = 0; var parts = WEEK_REGEXP.exec(isoWeek); if (parts) { var year = +parts[1], week = +parts[2], hours = 0, minutes = 0, seconds = 0, milliseconds = 0, firstThurs = getFirstThursdayOfYear(year), addDays = (week - 1) * 7; if (existingDate) { hours = existingDate.getHours(); minutes = existingDate.getMinutes(); seconds = existingDate.getSeconds(); milliseconds = existingDate.getMilliseconds(); } return new Date(year, 0, firstThurs.getDate() + addDays, hours, minutes, seconds, milliseconds); } } return NaN; } function createDateParser(regexp, mapping) { return function(iso, date) { var parts, map; if (isDate(iso)) { return iso; } if (isString(iso)) { // When a date is JSON'ified to wraps itself inside of an extra // set of double quotes. This makes the date parsing code unable // to match the date string and parse it as a date. if (iso.charAt(0) == '"' && iso.charAt(iso.length - 1) == '"') { iso = iso.substring(1, iso.length - 1); } if (ISO_DATE_REGEXP.test(iso)) { return new Date(iso); } regexp.lastIndex = 0; parts = regexp.exec(iso); if (parts) { parts.shift(); if (date) { map = { yyyy: date.getFullYear(), MM: date.getMonth() + 1, dd: date.getDate(), HH: date.getHours(), mm: date.getMinutes(), ss: date.getSeconds(), sss: date.getMilliseconds() / 1000 }; } else { map = { yyyy: 1970, MM: 1, dd: 1, HH: 0, mm: 0, ss: 0, sss: 0 }; } forEach(parts, function(part, index) { if (index < mapping.length) { map[mapping[index]] = +part; } }); return new Date(map.yyyy, map.MM - 1, map.dd, map.HH, map.mm, map.ss || 0, map.sss * 1000 || 0); } } return NaN; }; } function createDateInputType(type, regexp, parseDate, format) { return function dynamicDateInputType(scope, element, attr, ctrl, $sniffer, $browser, $filter) { badInputChecker(scope, element, attr, ctrl); baseInputType(scope, element, attr, ctrl, $sniffer, $browser); var timezone = ctrl && ctrl.$options && ctrl.$options.timezone; var previousDate; ctrl.$$parserName = type; ctrl.$parsers.push(function(value) { if (ctrl.$isEmpty(value)) return null; if (regexp.test(value)) { // Note: We cannot read ctrl.$modelValue, as there might be a different // parser/formatter in the processing chain so that the model // contains some different data format! var parsedDate = parseDate(value, previousDate); if (timezone === 'UTC') { parsedDate.setMinutes(parsedDate.getMinutes() - parsedDate.getTimezoneOffset()); } return parsedDate; } return undefined; }); ctrl.$formatters.push(function(value) { if (value && !isDate(value)) { throw $ngModelMinErr('datefmt', 'Expected `{0}` to be a date', value); } if (isValidDate(value)) { previousDate = value; if (previousDate && timezone === 'UTC') { var timezoneOffset = 60000 * previousDate.getTimezoneOffset(); previousDate = new Date(previousDate.getTime() + timezoneOffset); } return $filter('date')(value, format, timezone); } else { previousDate = null; return ''; } }); if (isDefined(attr.min) || attr.ngMin) { var minVal; ctrl.$validators.min = function(value) { return !isValidDate(value) || isUndefined(minVal) || parseDate(value) >= minVal; }; attr.$observe('min', function(val) { minVal = parseObservedDateValue(val); ctrl.$validate(); }); } if (isDefined(attr.max) || attr.ngMax) { var maxVal; ctrl.$validators.max = function(value) { return !isValidDate(value) || isUndefined(maxVal) || parseDate(value) <= maxVal; }; attr.$observe('max', function(val) { maxVal = parseObservedDateValue(val); ctrl.$validate(); }); } function isValidDate(value) { // Invalid Date: getTime() returns NaN return value && !(value.getTime && value.getTime() !== value.getTime()); } function parseObservedDateValue(val) { return isDefined(val) ? (isDate(val) ? val : parseDate(val)) : undefined; } }; } function badInputChecker(scope, element, attr, ctrl) { var node = element[0]; var nativeValidation = ctrl.$$hasNativeValidators = isObject(node.validity); if (nativeValidation) { ctrl.$parsers.push(function(value) { var validity = element.prop(VALIDITY_STATE_PROPERTY) || {}; // Detect bug in FF35 for input[email] (https://bugzilla.mozilla.org/show_bug.cgi?id=1064430): // - also sets validity.badInput (should only be validity.typeMismatch). // - see http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#e-mail-state-(type=email) // - can ignore this case as we can still read out the erroneous email... return validity.badInput && !validity.typeMismatch ? undefined : value; }); } } function numberInputType(scope, element, attr, ctrl, $sniffer, $browser) { badInputChecker(scope, element, attr, ctrl); baseInputType(scope, element, attr, ctrl, $sniffer, $browser); ctrl.$$parserName = 'number'; ctrl.$parsers.push(function(value) { if (ctrl.$isEmpty(value)) return null; if (NUMBER_REGEXP.test(value)) return parseFloat(value); return undefined; }); ctrl.$formatters.push(function(value) { if (!ctrl.$isEmpty(value)) { if (!isNumber(value)) { throw $ngModelMinErr('numfmt', 'Expected `{0}` to be a number', value); } value = value.toString(); } return value; }); if (attr.min || attr.ngMin) { var minVal; ctrl.$validators.min = function(value) { return ctrl.$isEmpty(value) || isUndefined(minVal) || value >= minVal; }; attr.$observe('min', function(val) { if (isDefined(val) && !isNumber(val)) { val = parseFloat(val, 10); } minVal = isNumber(val) && !isNaN(val) ? val : undefined; // TODO(matsko): implement validateLater to reduce number of validations ctrl.$validate(); }); } if (attr.max || attr.ngMax) { var maxVal; ctrl.$validators.max = function(value) { return ctrl.$isEmpty(value) || isUndefined(maxVal) || value <= maxVal; }; attr.$observe('max', function(val) { if (isDefined(val) && !isNumber(val)) { val = parseFloat(val, 10); } maxVal = isNumber(val) && !isNaN(val) ? val : undefined; // TODO(matsko): implement validateLater to reduce number of validations ctrl.$validate(); }); } } function urlInputType(scope, element, attr, ctrl, $sniffer, $browser) { // Note: no badInputChecker here by purpose as `url` is only a validation // in browsers, i.e. we can always read out input.value even if it is not valid! baseInputType(scope, element, attr, ctrl, $sniffer, $browser); stringBasedInputType(ctrl); ctrl.$$parserName = 'url'; ctrl.$validators.url = function(modelValue, viewValue) { var value = modelValue || viewValue; return ctrl.$isEmpty(value) || URL_REGEXP.test(value); }; } function emailInputType(scope, element, attr, ctrl, $sniffer, $browser) { // Note: no badInputChecker here by purpose as `url` is only a validation // in browsers, i.e. we can always read out input.value even if it is not valid! baseInputType(scope, element, attr, ctrl, $sniffer, $browser); stringBasedInputType(ctrl); ctrl.$$parserName = 'email'; ctrl.$validators.email = function(modelValue, viewValue) { var value = modelValue || viewValue; return ctrl.$isEmpty(value) || EMAIL_REGEXP.test(value); }; } function radioInputType(scope, element, attr, ctrl) { // make the name unique, if not defined if (isUndefined(attr.name)) { element.attr('name', nextUid()); } var listener = function(ev) { if (element[0].checked) { ctrl.$setViewValue(attr.value, ev && ev.type); } }; element.on('click', listener); ctrl.$render = function() { var value = attr.value; element[0].checked = (value == ctrl.$viewValue); }; attr.$observe('value', ctrl.$render); } function parseConstantExpr($parse, context, name, expression, fallback) { var parseFn; if (isDefined(expression)) { parseFn = $parse(expression); if (!parseFn.constant) { throw minErr('ngModel')('constexpr', 'Expected constant expression for `{0}`, but saw ' + '`{1}`.', name, expression); } return parseFn(context); } return fallback; } function checkboxInputType(scope, element, attr, ctrl, $sniffer, $browser, $filter, $parse) { var trueValue = parseConstantExpr($parse, scope, 'ngTrueValue', attr.ngTrueValue, true); var falseValue = parseConstantExpr($parse, scope, 'ngFalseValue', attr.ngFalseValue, false); var listener = function(ev) { ctrl.$setViewValue(element[0].checked, ev && ev.type); }; element.on('click', listener); ctrl.$render = function() { element[0].checked = ctrl.$viewValue; }; // Override the standard `$isEmpty` because the $viewValue of an empty checkbox is always set to `false` // This is because of the parser below, which compares the `$modelValue` with `trueValue` to convert // it to a boolean. ctrl.$isEmpty = function(value) { return value === false; }; ctrl.$formatters.push(function(value) { return equals(value, trueValue); }); ctrl.$parsers.push(function(value) { return value ? trueValue : falseValue; }); } /** * @ngdoc directive * @name textarea * @restrict E * * @description * HTML textarea element control with angular data-binding. The data-binding and validation * properties of this element are exactly the same as those of the * {@link ng.directive:input input element}. * * @param {string} ngModel Assignable angular expression to data-bind to. * @param {string=} name Property name of the form under which the control is published. * @param {string=} required Sets `required` validation error key if the value is not entered. * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of * `required` when you want to data-bind to the `required` attribute. * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than * minlength. * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of any * length. * @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the * RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for * patterns defined as scope expressions. * @param {string=} ngChange Angular expression to be executed when input changes due to user * interaction with the input element. * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input. */ /** * @ngdoc directive * @name input * @restrict E * * @description * HTML input element control. When used together with {@link ngModel `ngModel`}, it provides data-binding, * input state control, and validation. * Input control follows HTML5 input types and polyfills the HTML5 validation behavior for older browsers. * * <div class="alert alert-warning"> * **Note:** Not every feature offered is available for all input types. * Specifically, data binding and event handling via `ng-model` is unsupported for `input[file]`. * </div> * * @param {string} ngModel Assignable angular expression to data-bind to. * @param {string=} name Property name of the form under which the control is published. * @param {string=} required Sets `required` validation error key if the value is not entered. * @param {boolean=} ngRequired Sets `required` attribute if set to true * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than * minlength. * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of any * length. * @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the * RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for * patterns defined as scope expressions. * @param {string=} ngChange Angular expression to be executed when input changes due to user * interaction with the input element. * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input. * This parameter is ignored for input[type=password] controls, which will never trim the * input. * * @example <example name="input-directive" module="inputExample"> <file name="index.html"> <script> angular.module('inputExample', []) .controller('ExampleController', ['$scope', function($scope) { $scope.user = {name: 'guest', last: 'visitor'}; }]); </script> <div ng-controller="ExampleController"> <form name="myForm"> User name: <input type="text" name="userName" ng-model="user.name" required> <span class="error" ng-show="myForm.userName.$error.required"> Required!</span><br> Last name: <input type="text" name="lastName" ng-model="user.last" ng-minlength="3" ng-maxlength="10"> <span class="error" ng-show="myForm.lastName.$error.minlength"> Too short!</span> <span class="error" ng-show="myForm.lastName.$error.maxlength"> Too long!</span><br> </form> <hr> <tt>user = {{user}}</tt><br/> <tt>myForm.userName.$valid = {{myForm.userName.$valid}}</tt><br> <tt>myForm.userName.$error = {{myForm.userName.$error}}</tt><br> <tt>myForm.lastName.$valid = {{myForm.lastName.$valid}}</tt><br> <tt>myForm.lastName.$error = {{myForm.lastName.$error}}</tt><br> <tt>myForm.$valid = {{myForm.$valid}}</tt><br> <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br> <tt>myForm.$error.minlength = {{!!myForm.$error.minlength}}</tt><br> <tt>myForm.$error.maxlength = {{!!myForm.$error.maxlength}}</tt><br> </div> </file> <file name="protractor.js" type="protractor"> var user = element(by.exactBinding('user')); var userNameValid = element(by.binding('myForm.userName.$valid')); var lastNameValid = element(by.binding('myForm.lastName.$valid')); var lastNameError = element(by.binding('myForm.lastName.$error')); var formValid = element(by.binding('myForm.$valid')); var userNameInput = element(by.model('user.name')); var userLastInput = element(by.model('user.last')); it('should initialize to model', function() { expect(user.getText()).toContain('{"name":"guest","last":"visitor"}'); expect(userNameValid.getText()).toContain('true'); expect(formValid.getText()).toContain('true'); }); it('should be invalid if empty when required', function() { userNameInput.clear(); userNameInput.sendKeys(''); expect(user.getText()).toContain('{"last":"visitor"}'); expect(userNameValid.getText()).toContain('false'); expect(formValid.getText()).toContain('false'); }); it('should be valid if empty when min length is set', function() { userLastInput.clear(); userLastInput.sendKeys(''); expect(user.getText()).toContain('{"name":"guest","last":""}'); expect(lastNameValid.getText()).toContain('true'); expect(formValid.getText()).toContain('true'); }); it('should be invalid if less than required min length', function() { userLastInput.clear(); userLastInput.sendKeys('xx'); expect(user.getText()).toContain('{"name":"guest"}'); expect(lastNameValid.getText()).toContain('false'); expect(lastNameError.getText()).toContain('minlength'); expect(formValid.getText()).toContain('false'); }); it('should be invalid if longer than max length', function() { userLastInput.clear(); userLastInput.sendKeys('some ridiculously long name'); expect(user.getText()).toContain('{"name":"guest"}'); expect(lastNameValid.getText()).toContain('false'); expect(lastNameError.getText()).toContain('maxlength'); expect(formValid.getText()).toContain('false'); }); </file> </example> */ var inputDirective = ['$browser', '$sniffer', '$filter', '$parse', function($browser, $sniffer, $filter, $parse) { return { restrict: 'E', require: ['?ngModel'], link: { pre: function(scope, element, attr, ctrls) { if (ctrls[0]) { (inputType[lowercase(attr.type)] || inputType.text)(scope, element, attr, ctrls[0], $sniffer, $browser, $filter, $parse); } } } }; }]; var CONSTANT_VALUE_REGEXP = /^(true|false|\d+)$/; /** * @ngdoc directive * @name ngValue * * @description * Binds the given expression to the value of `<option>` or {@link input[radio] `input[radio]`}, * so that when the element is selected, the {@link ngModel `ngModel`} of that element is set to * the bound value. * * `ngValue` is useful when dynamically generating lists of radio buttons using * {@link ngRepeat `ngRepeat`}, as shown below. * * Likewise, `ngValue` can be used to generate `<option>` elements for * the {@link select `select`} element. In that case however, only strings are supported * for the `value `attribute, so the resulting `ngModel` will always be a string. * Support for `select` models with non-string values is available via `ngOptions`. * * @element input * @param {string=} ngValue angular expression, whose value will be bound to the `value` attribute * of the `input` element * * @example <example name="ngValue-directive" module="valueExample"> <file name="index.html"> <script> angular.module('valueExample', []) .controller('ExampleController', ['$scope', function($scope) { $scope.names = ['pizza', 'unicorns', 'robots']; $scope.my = { favorite: 'unicorns' }; }]); </script> <form ng-controller="ExampleController"> <h2>Which is your favorite?</h2> <label ng-repeat="name in names" for="{{name}}"> {{name}} <input type="radio" ng-model="my.favorite" ng-value="name" id="{{name}}" name="favorite"> </label> <div>You chose {{my.favorite}}</div> </form> </file> <file name="protractor.js" type="protractor"> var favorite = element(by.binding('my.favorite')); it('should initialize to model', function() { expect(favorite.getText()).toContain('unicorns'); }); it('should bind the values to the inputs', function() { element.all(by.model('my.favorite')).get(0).click(); expect(favorite.getText()).toContain('pizza'); }); </file> </example> */ var ngValueDirective = function() { return { restrict: 'A', priority: 100, compile: function(tpl, tplAttr) { if (CONSTANT_VALUE_REGEXP.test(tplAttr.ngValue)) { return function ngValueConstantLink(scope, elm, attr) { attr.$set('value', scope.$eval(attr.ngValue)); }; } else { return function ngValueLink(scope, elm, attr) { scope.$watch(attr.ngValue, function valueWatchAction(value) { attr.$set('value', value); }); }; } } }; }; /** * @ngdoc directive * @name ngBind * @restrict AC * * @description * The `ngBind` attribute tells Angular to replace the text content of the specified HTML element * with the value of a given expression, and to update the text content when the value of that * expression changes. * * Typically, you don't use `ngBind` directly, but instead you use the double curly markup like * `{{ expression }}` which is similar but less verbose. * * It is preferable to use `ngBind` instead of `{{ expression }}` if a template is momentarily * displayed by the browser in its raw state before Angular compiles it. Since `ngBind` is an * element attribute, it makes the bindings invisible to the user while the page is loading. * * An alternative solution to this problem would be using the * {@link ng.directive:ngCloak ngCloak} directive. * * * @element ANY * @param {expression} ngBind {@link guide/expression Expression} to evaluate. * * @example * Enter a name in the Live Preview text box; the greeting below the text box changes instantly. <example module="bindExample"> <file name="index.html"> <script> angular.module('bindExample', []) .controller('ExampleController', ['$scope', function($scope) { $scope.name = 'Whirled'; }]); </script> <div ng-controller="ExampleController"> Enter name: <input type="text" ng-model="name"><br> Hello <span ng-bind="name"></span>! </div> </file> <file name="protractor.js" type="protractor"> it('should check ng-bind', function() { var nameInput = element(by.model('name')); expect(element(by.binding('name')).getText()).toBe('Whirled'); nameInput.clear(); nameInput.sendKeys('world'); expect(element(by.binding('name')).getText()).toBe('world'); }); </file> </example> */ var ngBindDirective = ['$compile', function($compile) { return { restrict: 'AC', compile: function ngBindCompile(templateElement) { $compile.$$addBindingClass(templateElement); return function ngBindLink(scope, element, attr) { $compile.$$addBindingInfo(element, attr.ngBind); element = element[0]; scope.$watch(attr.ngBind, function ngBindWatchAction(value) { element.textContent = value === undefined ? '' : value; }); }; } }; }]; /** * @ngdoc directive * @name ngBindTemplate * * @description * The `ngBindTemplate` directive specifies that the element * text content should be replaced with the interpolation of the template * in the `ngBindTemplate` attribute. * Unlike `ngBind`, the `ngBindTemplate` can contain multiple `{{` `}}` * expressions. This directive is needed since some HTML elements * (such as TITLE and OPTION) cannot contain SPAN elements. * * @element ANY * @param {string} ngBindTemplate template of form * <tt>{{</tt> <tt>expression</tt> <tt>}}</tt> to eval. * * @example * Try it here: enter text in text box and watch the greeting change. <example module="bindExample"> <file name="index.html"> <script> angular.module('bindExample', []) .controller('ExampleController', ['$scope', function($scope) { $scope.salutation = 'Hello'; $scope.name = 'World'; }]); </script> <div ng-controller="ExampleController"> Salutation: <input type="text" ng-model="salutation"><br> Name: <input type="text" ng-model="name"><br> <pre ng-bind-template="{{salutation}} {{name}}!"></pre> </div> </file> <file name="protractor.js" type="protractor"> it('should check ng-bind', function() { var salutationElem = element(by.binding('salutation')); var salutationInput = element(by.model('salutation')); var nameInput = element(by.model('name')); expect(salutationElem.getText()).toBe('Hello World!'); salutationInput.clear(); salutationInput.sendKeys('Greetings'); nameInput.clear(); nameInput.sendKeys('user'); expect(salutationElem.getText()).toBe('Greetings user!'); }); </file> </example> */ var ngBindTemplateDirective = ['$interpolate', '$compile', function($interpolate, $compile) { return { compile: function ngBindTemplateCompile(templateElement) { $compile.$$addBindingClass(templateElement); return function ngBindTemplateLink(scope, element, attr) { var interpolateFn = $interpolate(element.attr(attr.$attr.ngBindTemplate)); $compile.$$addBindingInfo(element, interpolateFn.expressions); element = element[0]; attr.$observe('ngBindTemplate', function(value) { element.textContent = value === undefined ? '' : value; }); }; } }; }]; /** * @ngdoc directive * @name ngBindHtml * * @description * Evaluates the expression and inserts the resulting HTML into the element in a secure way. By default, * the resulting HTML content will be sanitized using the {@link ngSanitize.$sanitize $sanitize} service. * To utilize this functionality, ensure that `$sanitize` is available, for example, by including {@link * ngSanitize} in your module's dependencies (not in core Angular). In order to use {@link ngSanitize} * in your module's dependencies, you need to include "angular-sanitize.js" in your application. * * You may also bypass sanitization for values you know are safe. To do so, bind to * an explicitly trusted value via {@link ng.$sce#trustAsHtml $sce.trustAsHtml}. See the example * under {@link ng.$sce#show-me-an-example-using-sce- Strict Contextual Escaping (SCE)}. * * Note: If a `$sanitize` service is unavailable and the bound value isn't explicitly trusted, you * will have an exception (instead of an exploit.) * * @element ANY * @param {expression} ngBindHtml {@link guide/expression Expression} to evaluate. * * @example <example module="bindHtmlExample" deps="angular-sanitize.js"> <file name="index.html"> <div ng-controller="ExampleController"> <p ng-bind-html="myHTML"></p> </div> </file> <file name="script.js"> angular.module('bindHtmlExample', ['ngSanitize']) .controller('ExampleController', ['$scope', function($scope) { $scope.myHTML = 'I am an <code>HTML</code>string with ' + '<a href="#">links!</a> and other <em>stuff</em>'; }]); </file> <file name="protractor.js" type="protractor"> it('should check ng-bind-html', function() { expect(element(by.binding('myHTML')).getText()).toBe( 'I am an HTMLstring with links! and other stuff'); }); </file> </example> */ var ngBindHtmlDirective = ['$sce', '$parse', '$compile', function($sce, $parse, $compile) { return { restrict: 'A', compile: function ngBindHtmlCompile(tElement, tAttrs) { var ngBindHtmlGetter = $parse(tAttrs.ngBindHtml); var ngBindHtmlWatch = $parse(tAttrs.ngBindHtml, function getStringValue(value) { return (value || '').toString(); }); $compile.$$addBindingClass(tElement); return function ngBindHtmlLink(scope, element, attr) { $compile.$$addBindingInfo(element, attr.ngBindHtml); scope.$watch(ngBindHtmlWatch, function ngBindHtmlWatchAction() { // we re-evaluate the expr because we want a TrustedValueHolderType // for $sce, not a string element.html($sce.getTrustedHtml(ngBindHtmlGetter(scope)) || ''); }); }; } }; }]; /** * @ngdoc directive * @name ngChange * * @description * Evaluate the given expression when the user changes the input. * The expression is evaluated immediately, unlike the JavaScript onchange event * which only triggers at the end of a change (usually, when the user leaves the * form element or presses the return key). * * The `ngChange` expression is only evaluated when a change in the input value causes * a new value to be committed to the model. * * It will not be evaluated: * * if the value returned from the `$parsers` transformation pipeline has not changed * * if the input has continued to be invalid since the model will stay `null` * * if the model is changed programmatically and not by a change to the input value * * * Note, this directive requires `ngModel` to be present. * * @element input * @param {expression} ngChange {@link guide/expression Expression} to evaluate upon change * in input value. * * @example * <example name="ngChange-directive" module="changeExample"> * <file name="index.html"> * <script> * angular.module('changeExample', []) * .controller('ExampleController', ['$scope', function($scope) { * $scope.counter = 0; * $scope.change = function() { * $scope.counter++; * }; * }]); * </script> * <div ng-controller="ExampleController"> * <input type="checkbox" ng-model="confirmed" ng-change="change()" id="ng-change-example1" /> * <input type="checkbox" ng-model="confirmed" id="ng-change-example2" /> * <label for="ng-change-example2">Confirmed</label><br /> * <tt>debug = {{confirmed}}</tt><br/> * <tt>counter = {{counter}}</tt><br/> * </div> * </file> * <file name="protractor.js" type="protractor"> * var counter = element(by.binding('counter')); * var debug = element(by.binding('confirmed')); * * it('should evaluate the expression if changing from view', function() { * expect(counter.getText()).toContain('0'); * * element(by.id('ng-change-example1')).click(); * * expect(counter.getText()).toContain('1'); * expect(debug.getText()).toContain('true'); * }); * * it('should not evaluate the expression if changing from model', function() { * element(by.id('ng-change-example2')).click(); * expect(counter.getText()).toContain('0'); * expect(debug.getText()).toContain('true'); * }); * </file> * </example> */ var ngChangeDirective = valueFn({ restrict: 'A', require: 'ngModel', link: function(scope, element, attr, ctrl) { ctrl.$viewChangeListeners.push(function() { scope.$eval(attr.ngChange); }); } }); function classDirective(name, selector) { name = 'ngClass' + name; return ['$animate', function($animate) { return { restrict: 'AC', link: function(scope, element, attr) { var oldVal; scope.$watch(attr[name], ngClassWatchAction, true); attr.$observe('class', function(value) { ngClassWatchAction(scope.$eval(attr[name])); }); if (name !== 'ngClass') { scope.$watch('$index', function($index, old$index) { // jshint bitwise: false var mod = $index & 1; if (mod !== (old$index & 1)) { var classes = arrayClasses(scope.$eval(attr[name])); mod === selector ? addClasses(classes) : removeClasses(classes); } }); } function addClasses(classes) { var newClasses = digestClassCounts(classes, 1); attr.$addClass(newClasses); } function removeClasses(classes) { var newClasses = digestClassCounts(classes, -1); attr.$removeClass(newClasses); } function digestClassCounts(classes, count) { var classCounts = element.data('$classCounts') || {}; var classesToUpdate = []; forEach(classes, function(className) { if (count > 0 || classCounts[className]) { classCounts[className] = (classCounts[className] || 0) + count; if (classCounts[className] === +(count > 0)) { classesToUpdate.push(className); } } }); element.data('$classCounts', classCounts); return classesToUpdate.join(' '); } function updateClasses(oldClasses, newClasses) { var toAdd = arrayDifference(newClasses, oldClasses); var toRemove = arrayDifference(oldClasses, newClasses); toAdd = digestClassCounts(toAdd, 1); toRemove = digestClassCounts(toRemove, -1); if (toAdd && toAdd.length) { $animate.addClass(element, toAdd); } if (toRemove && toRemove.length) { $animate.removeClass(element, toRemove); } } function ngClassWatchAction(newVal) { if (selector === true || scope.$index % 2 === selector) { var newClasses = arrayClasses(newVal || []); if (!oldVal) { addClasses(newClasses); } else if (!equals(newVal,oldVal)) { var oldClasses = arrayClasses(oldVal); updateClasses(oldClasses, newClasses); } } oldVal = shallowCopy(newVal); } } }; function arrayDifference(tokens1, tokens2) { var values = []; outer: for (var i = 0; i < tokens1.length; i++) { var token = tokens1[i]; for (var j = 0; j < tokens2.length; j++) { if (token == tokens2[j]) continue outer; } values.push(token); } return values; } function arrayClasses(classVal) { if (isArray(classVal)) { return classVal; } else if (isString(classVal)) { return classVal.split(' '); } else if (isObject(classVal)) { var classes = []; forEach(classVal, function(v, k) { if (v) { classes = classes.concat(k.split(' ')); } }); return classes; } return classVal; } }]; } /** * @ngdoc directive * @name ngClass * @restrict AC * * @description * The `ngClass` directive allows you to dynamically set CSS classes on an HTML element by databinding * an expression that represents all classes to be added. * * The directive operates in three different ways, depending on which of three types the expression * evaluates to: * * 1. If the expression evaluates to a string, the string should be one or more space-delimited class * names. * * 2. If the expression evaluates to an array, each element of the array should be a string that is * one or more space-delimited class names. * * 3. If the expression evaluates to an object, then for each key-value pair of the * object with a truthy value the corresponding key is used as a class name. * * The directive won't add duplicate classes if a particular class was already set. * * When the expression changes, the previously added classes are removed and only then the * new classes are added. * * @animations * **add** - happens just before the class is applied to the elements * * **remove** - happens just before the class is removed from the element * * @element ANY * @param {expression} ngClass {@link guide/expression Expression} to eval. The result * of the evaluation can be a string representing space delimited class * names, an array, or a map of class names to boolean values. In the case of a map, the * names of the properties whose values are truthy will be added as css classes to the * element. * * @example Example that demonstrates basic bindings via ngClass directive. <example> <file name="index.html"> <p ng-class="{strike: deleted, bold: important, red: error}">Map Syntax Example</p> <input type="checkbox" ng-model="deleted"> deleted (apply "strike" class)<br> <input type="checkbox" ng-model="important"> important (apply "bold" class)<br> <input type="checkbox" ng-model="error"> error (apply "red" class) <hr> <p ng-class="style">Using String Syntax</p> <input type="text" ng-model="style" placeholder="Type: bold strike red"> <hr> <p ng-class="[style1, style2, style3]">Using Array Syntax</p> <input ng-model="style1" placeholder="Type: bold, strike or red"><br> <input ng-model="style2" placeholder="Type: bold, strike or red"><br> <input ng-model="style3" placeholder="Type: bold, strike or red"><br> </file> <file name="style.css"> .strike { text-decoration: line-through; } .bold { font-weight: bold; } .red { color: red; } </file> <file name="protractor.js" type="protractor"> var ps = element.all(by.css('p')); it('should let you toggle the class', function() { expect(ps.first().getAttribute('class')).not.toMatch(/bold/); expect(ps.first().getAttribute('class')).not.toMatch(/red/); element(by.model('important')).click(); expect(ps.first().getAttribute('class')).toMatch(/bold/); element(by.model('error')).click(); expect(ps.first().getAttribute('class')).toMatch(/red/); }); it('should let you toggle string example', function() { expect(ps.get(1).getAttribute('class')).toBe(''); element(by.model('style')).clear(); element(by.model('style')).sendKeys('red'); expect(ps.get(1).getAttribute('class')).toBe('red'); }); it('array example should have 3 classes', function() { expect(ps.last().getAttribute('class')).toBe(''); element(by.model('style1')).sendKeys('bold'); element(by.model('style2')).sendKeys('strike'); element(by.model('style3')).sendKeys('red'); expect(ps.last().getAttribute('class')).toBe('bold strike red'); }); </file> </example> ## Animations The example below demonstrates how to perform animations using ngClass. <example module="ngAnimate" deps="angular-animate.js" animations="true"> <file name="index.html"> <input id="setbtn" type="button" value="set" ng-click="myVar='my-class'"> <input id="clearbtn" type="button" value="clear" ng-click="myVar=''"> <br> <span class="base-class" ng-class="myVar">Sample Text</span> </file> <file name="style.css"> .base-class { -webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s; transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s; } .base-class.my-class { color: red; font-size:3em; } </file> <file name="protractor.js" type="protractor"> it('should check ng-class', function() { expect(element(by.css('.base-class')).getAttribute('class')).not. toMatch(/my-class/); element(by.id('setbtn')).click(); expect(element(by.css('.base-class')).getAttribute('class')). toMatch(/my-class/); element(by.id('clearbtn')).click(); expect(element(by.css('.base-class')).getAttribute('class')).not. toMatch(/my-class/); }); </file> </example> ## ngClass and pre-existing CSS3 Transitions/Animations The ngClass directive still supports CSS3 Transitions/Animations even if they do not follow the ngAnimate CSS naming structure. Upon animation ngAnimate will apply supplementary CSS classes to track the start and end of an animation, but this will not hinder any pre-existing CSS transitions already on the element. To get an idea of what happens during a class-based animation, be sure to view the step by step details of {@link ng.$animate#addClass $animate.addClass} and {@link ng.$animate#removeClass $animate.removeClass}. */ var ngClassDirective = classDirective('', true); /** * @ngdoc directive * @name ngClassOdd * @restrict AC * * @description * The `ngClassOdd` and `ngClassEven` directives work exactly as * {@link ng.directive:ngClass ngClass}, except they work in * conjunction with `ngRepeat` and take effect only on odd (even) rows. * * This directive can be applied only within the scope of an * {@link ng.directive:ngRepeat ngRepeat}. * * @element ANY * @param {expression} ngClassOdd {@link guide/expression Expression} to eval. The result * of the evaluation can be a string representing space delimited class names or an array. * * @example <example> <file name="index.html"> <ol ng-init="names=['John', 'Mary', 'Cate', 'Suz']"> <li ng-repeat="name in names"> <span ng-class-odd="'odd'" ng-class-even="'even'"> {{name}} </span> </li> </ol> </file> <file name="style.css"> .odd { color: red; } .even { color: blue; } </file> <file name="protractor.js" type="protractor"> it('should check ng-class-odd and ng-class-even', function() { expect(element(by.repeater('name in names').row(0).column('name')).getAttribute('class')). toMatch(/odd/); expect(element(by.repeater('name in names').row(1).column('name')).getAttribute('class')). toMatch(/even/); }); </file> </example> */ var ngClassOddDirective = classDirective('Odd', 0); /** * @ngdoc directive * @name ngClassEven * @restrict AC * * @description * The `ngClassOdd` and `ngClassEven` directives work exactly as * {@link ng.directive:ngClass ngClass}, except they work in * conjunction with `ngRepeat` and take effect only on odd (even) rows. * * This directive can be applied only within the scope of an * {@link ng.directive:ngRepeat ngRepeat}. * * @element ANY * @param {expression} ngClassEven {@link guide/expression Expression} to eval. The * result of the evaluation can be a string representing space delimited class names or an array. * * @example <example> <file name="index.html"> <ol ng-init="names=['John', 'Mary', 'Cate', 'Suz']"> <li ng-repeat="name in names"> <span ng-class-odd="'odd'" ng-class-even="'even'"> {{name}} &nbsp; &nbsp; &nbsp; </span> </li> </ol> </file> <file name="style.css"> .odd { color: red; } .even { color: blue; } </file> <file name="protractor.js" type="protractor"> it('should check ng-class-odd and ng-class-even', function() { expect(element(by.repeater('name in names').row(0).column('name')).getAttribute('class')). toMatch(/odd/); expect(element(by.repeater('name in names').row(1).column('name')).getAttribute('class')). toMatch(/even/); }); </file> </example> */ var ngClassEvenDirective = classDirective('Even', 1); /** * @ngdoc directive * @name ngCloak * @restrict AC * * @description * The `ngCloak` directive is used to prevent the Angular html template from being briefly * displayed by the browser in its raw (uncompiled) form while your application is loading. Use this * directive to avoid the undesirable flicker effect caused by the html template display. * * The directive can be applied to the `<body>` element, but the preferred usage is to apply * multiple `ngCloak` directives to small portions of the page to permit progressive rendering * of the browser view. * * `ngCloak` works in cooperation with the following css rule embedded within `angular.js` and * `angular.min.js`. * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}). * * ```css * [ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak { * display: none !important; * } * ``` * * When this css rule is loaded by the browser, all html elements (including their children) that * are tagged with the `ngCloak` directive are hidden. When Angular encounters this directive * during the compilation of the template it deletes the `ngCloak` element attribute, making * the compiled element visible. * * For the best result, the `angular.js` script must be loaded in the head section of the html * document; alternatively, the css rule above must be included in the external stylesheet of the * application. * * Legacy browsers, like IE7, do not provide attribute selector support (added in CSS 2.1) so they * cannot match the `[ng\:cloak]` selector. To work around this limitation, you must add the css * class `ng-cloak` in addition to the `ngCloak` directive as shown in the example below. * * @element ANY * * @example <example> <file name="index.html"> <div id="template1" ng-cloak>{{ 'hello' }}</div> <div id="template2" ng-cloak class="ng-cloak">{{ 'hello IE7' }}</div> </file> <file name="protractor.js" type="protractor"> it('should remove the template directive and css class', function() { expect($('#template1').getAttribute('ng-cloak')). toBeNull(); expect($('#template2').getAttribute('ng-cloak')). toBeNull(); }); </file> </example> * */ var ngCloakDirective = ngDirective({ compile: function(element, attr) { attr.$set('ngCloak', undefined); element.removeClass('ng-cloak'); } }); /** * @ngdoc directive * @name ngController * * @description * The `ngController` directive attaches a controller class to the view. This is a key aspect of how angular * supports the principles behind the Model-View-Controller design pattern. * * MVC components in angular: * * * Model — Models are the properties of a scope; scopes are attached to the DOM where scope properties * are accessed through bindings. * * View — The template (HTML with data bindings) that is rendered into the View. * * Controller — The `ngController` directive specifies a Controller class; the class contains business * logic behind the application to decorate the scope with functions and values * * Note that you can also attach controllers to the DOM by declaring it in a route definition * via the {@link ngRoute.$route $route} service. A common mistake is to declare the controller * again using `ng-controller` in the template itself. This will cause the controller to be attached * and executed twice. * * @element ANY * @scope * @priority 500 * @param {expression} ngController Name of a constructor function registered with the current * {@link ng.$controllerProvider $controllerProvider} or an {@link guide/expression expression} * that on the current scope evaluates to a constructor function. * * The controller instance can be published into a scope property by specifying * `ng-controller="as propertyName"`. * * If the current `$controllerProvider` is configured to use globals (via * {@link ng.$controllerProvider#allowGlobals `$controllerProvider.allowGlobals()` }), this may * also be the name of a globally accessible constructor function (not recommended). * * @example * Here is a simple form for editing user contact information. Adding, removing, clearing, and * greeting are methods declared on the controller (see source tab). These methods can * easily be called from the angular markup. Any changes to the data are automatically reflected * in the View without the need for a manual update. * * Two different declaration styles are included below: * * * one binds methods and properties directly onto the controller using `this`: * `ng-controller="SettingsController1 as settings"` * * one injects `$scope` into the controller: * `ng-controller="SettingsController2"` * * The second option is more common in the Angular community, and is generally used in boilerplates * and in this guide. However, there are advantages to binding properties directly to the controller * and avoiding scope. * * * Using `controller as` makes it obvious which controller you are accessing in the template when * multiple controllers apply to an element. * * If you are writing your controllers as classes you have easier access to the properties and * methods, which will appear on the scope, from inside the controller code. * * Since there is always a `.` in the bindings, you don't have to worry about prototypal * inheritance masking primitives. * * This example demonstrates the `controller as` syntax. * * <example name="ngControllerAs" module="controllerAsExample"> * <file name="index.html"> * <div id="ctrl-as-exmpl" ng-controller="SettingsController1 as settings"> * Name: <input type="text" ng-model="settings.name"/> * [ <a href="" ng-click="settings.greet()">greet</a> ]<br/> * Contact: * <ul> * <li ng-repeat="contact in settings.contacts"> * <select ng-model="contact.type"> * <option>phone</option> * <option>email</option> * </select> * <input type="text" ng-model="contact.value"/> * [ <a href="" ng-click="settings.clearContact(contact)">clear</a> * | <a href="" ng-click="settings.removeContact(contact)">X</a> ] * </li> * <li>[ <a href="" ng-click="settings.addContact()">add</a> ]</li> * </ul> * </div> * </file> * <file name="app.js"> * angular.module('controllerAsExample', []) * .controller('SettingsController1', SettingsController1); * * function SettingsController1() { * this.name = "John Smith"; * this.contacts = [ * {type: 'phone', value: '408 555 1212'}, * {type: 'email', value: 'john.smith@example.org'} ]; * } * * SettingsController1.prototype.greet = function() { * alert(this.name); * }; * * SettingsController1.prototype.addContact = function() { * this.contacts.push({type: 'email', value: 'yourname@example.org'}); * }; * * SettingsController1.prototype.removeContact = function(contactToRemove) { * var index = this.contacts.indexOf(contactToRemove); * this.contacts.splice(index, 1); * }; * * SettingsController1.prototype.clearContact = function(contact) { * contact.type = 'phone'; * contact.value = ''; * }; * </file> * <file name="protractor.js" type="protractor"> * it('should check controller as', function() { * var container = element(by.id('ctrl-as-exmpl')); * expect(container.element(by.model('settings.name')) * .getAttribute('value')).toBe('John Smith'); * * var firstRepeat = * container.element(by.repeater('contact in settings.contacts').row(0)); * var secondRepeat = * container.element(by.repeater('contact in settings.contacts').row(1)); * * expect(firstRepeat.element(by.model('contact.value')).getAttribute('value')) * .toBe('408 555 1212'); * * expect(secondRepeat.element(by.model('contact.value')).getAttribute('value')) * .toBe('john.smith@example.org'); * * firstRepeat.element(by.linkText('clear')).click(); * * expect(firstRepeat.element(by.model('contact.value')).getAttribute('value')) * .toBe(''); * * container.element(by.linkText('add')).click(); * * expect(container.element(by.repeater('contact in settings.contacts').row(2)) * .element(by.model('contact.value')) * .getAttribute('value')) * .toBe('yourname@example.org'); * }); * </file> * </example> * * This example demonstrates the "attach to `$scope`" style of controller. * * <example name="ngController" module="controllerExample"> * <file name="index.html"> * <div id="ctrl-exmpl" ng-controller="SettingsController2"> * Name: <input type="text" ng-model="name"/> * [ <a href="" ng-click="greet()">greet</a> ]<br/> * Contact: * <ul> * <li ng-repeat="contact in contacts"> * <select ng-model="contact.type"> * <option>phone</option> * <option>email</option> * </select> * <input type="text" ng-model="contact.value"/> * [ <a href="" ng-click="clearContact(contact)">clear</a> * | <a href="" ng-click="removeContact(contact)">X</a> ] * </li> * <li>[ <a href="" ng-click="addContact()">add</a> ]</li> * </ul> * </div> * </file> * <file name="app.js"> * angular.module('controllerExample', []) * .controller('SettingsController2', ['$scope', SettingsController2]); * * function SettingsController2($scope) { * $scope.name = "John Smith"; * $scope.contacts = [ * {type:'phone', value:'408 555 1212'}, * {type:'email', value:'john.smith@example.org'} ]; * * $scope.greet = function() { * alert($scope.name); * }; * * $scope.addContact = function() { * $scope.contacts.push({type:'email', value:'yourname@example.org'}); * }; * * $scope.removeContact = function(contactToRemove) { * var index = $scope.contacts.indexOf(contactToRemove); * $scope.contacts.splice(index, 1); * }; * * $scope.clearContact = function(contact) { * contact.type = 'phone'; * contact.value = ''; * }; * } * </file> * <file name="protractor.js" type="protractor"> * it('should check controller', function() { * var container = element(by.id('ctrl-exmpl')); * * expect(container.element(by.model('name')) * .getAttribute('value')).toBe('John Smith'); * * var firstRepeat = * container.element(by.repeater('contact in contacts').row(0)); * var secondRepeat = * container.element(by.repeater('contact in contacts').row(1)); * * expect(firstRepeat.element(by.model('contact.value')).getAttribute('value')) * .toBe('408 555 1212'); * expect(secondRepeat.element(by.model('contact.value')).getAttribute('value')) * .toBe('john.smith@example.org'); * * firstRepeat.element(by.linkText('clear')).click(); * * expect(firstRepeat.element(by.model('contact.value')).getAttribute('value')) * .toBe(''); * * container.element(by.linkText('add')).click(); * * expect(container.element(by.repeater('contact in contacts').row(2)) * .element(by.model('contact.value')) * .getAttribute('value')) * .toBe('yourname@example.org'); * }); * </file> *</example> */ var ngControllerDirective = [function() { return { restrict: 'A', scope: true, controller: '@', priority: 500 }; }]; /** * @ngdoc directive * @name ngCsp * * @element html * @description * Enables [CSP (Content Security Policy)](https://developer.mozilla.org/en/Security/CSP) support. * * This is necessary when developing things like Google Chrome Extensions or Universal Windows Apps. * * CSP forbids apps to use `eval` or `Function(string)` generated functions (among other things). * For Angular to be CSP compatible there are only two things that we need to do differently: * * - don't use `Function` constructor to generate optimized value getters * - don't inject custom stylesheet into the document * * AngularJS uses `Function(string)` generated functions as a speed optimization. Applying the `ngCsp` * directive will cause Angular to use CSP compatibility mode. When this mode is on AngularJS will * evaluate all expressions up to 30% slower than in non-CSP mode, but no security violations will * be raised. * * CSP forbids JavaScript to inline stylesheet rules. In non CSP mode Angular automatically * includes some CSS rules (e.g. {@link ng.directive:ngCloak ngCloak}). * To make those directives work in CSP mode, include the `angular-csp.css` manually. * * Angular tries to autodetect if CSP is active and automatically turn on the CSP-safe mode. This * autodetection however triggers a CSP error to be logged in the console: * * ``` * Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of * script in the following Content Security Policy directive: "default-src 'self'". Note that * 'script-src' was not explicitly set, so 'default-src' is used as a fallback. * ``` * * This error is harmless but annoying. To prevent the error from showing up, put the `ngCsp` * directive on the root element of the application or on the `angular.js` script tag, whichever * appears first in the html document. * * *Note: This directive is only available in the `ng-csp` and `data-ng-csp` attribute form.* * * @example * This example shows how to apply the `ngCsp` directive to the `html` tag. ```html <!doctype html> <html ng-app ng-csp> ... ... </html> ``` * @example // Note: the suffix `.csp` in the example name triggers // csp mode in our http server! <example name="example.csp" module="cspExample" ng-csp="true"> <file name="index.html"> <div ng-controller="MainController as ctrl"> <div> <button ng-click="ctrl.inc()" id="inc">Increment</button> <span id="counter"> {{ctrl.counter}} </span> </div> <div> <button ng-click="ctrl.evil()" id="evil">Evil</button> <span id="evilError"> {{ctrl.evilError}} </span> </div> </div> </file> <file name="script.js"> angular.module('cspExample', []) .controller('MainController', function() { this.counter = 0; this.inc = function() { this.counter++; }; this.evil = function() { // jshint evil:true try { eval('1+2'); } catch (e) { this.evilError = e.message; } }; }); </file> <file name="protractor.js" type="protractor"> var util, webdriver; var incBtn = element(by.id('inc')); var counter = element(by.id('counter')); var evilBtn = element(by.id('evil')); var evilError = element(by.id('evilError')); function getAndClearSevereErrors() { return browser.manage().logs().get('browser').then(function(browserLog) { return browserLog.filter(function(logEntry) { return logEntry.level.value > webdriver.logging.Level.WARNING.value; }); }); } function clearErrors() { getAndClearSevereErrors(); } function expectNoErrors() { getAndClearSevereErrors().then(function(filteredLog) { expect(filteredLog.length).toEqual(0); if (filteredLog.length) { console.log('browser console errors: ' + util.inspect(filteredLog)); } }); } function expectError(regex) { getAndClearSevereErrors().then(function(filteredLog) { var found = false; filteredLog.forEach(function(log) { if (log.message.match(regex)) { found = true; } }); if (!found) { throw new Error('expected an error that matches ' + regex); } }); } beforeEach(function() { util = require('util'); webdriver = require('protractor/node_modules/selenium-webdriver'); }); // For now, we only test on Chrome, // as Safari does not load the page with Protractor's injected scripts, // and Firefox webdriver always disables content security policy (#6358) if (browser.params.browser !== 'chrome') { return; } it('should not report errors when the page is loaded', function() { // clear errors so we are not dependent on previous tests clearErrors(); // Need to reload the page as the page is already loaded when // we come here browser.driver.getCurrentUrl().then(function(url) { browser.get(url); }); expectNoErrors(); }); it('should evaluate expressions', function() { expect(counter.getText()).toEqual('0'); incBtn.click(); expect(counter.getText()).toEqual('1'); expectNoErrors(); }); it('should throw and report an error when using "eval"', function() { evilBtn.click(); expect(evilError.getText()).toMatch(/Content Security Policy/); expectError(/Content Security Policy/); }); </file> </example> */ // ngCsp is not implemented as a proper directive any more, because we need it be processed while we // bootstrap the system (before $parse is instantiated), for this reason we just have // the csp.isActive() fn that looks for ng-csp attribute anywhere in the current doc /** * @ngdoc directive * @name ngClick * * @description * The ngClick directive allows you to specify custom behavior when * an element is clicked. * * @element ANY * @priority 0 * @param {expression} ngClick {@link guide/expression Expression} to evaluate upon * click. ({@link guide/expression#-event- Event object is available as `$event`}) * * @example <example> <file name="index.html"> <button ng-click="count = count + 1" ng-init="count=0"> Increment </button> <span> count: {{count}} </span> </file> <file name="protractor.js" type="protractor"> it('should check ng-click', function() { expect(element(by.binding('count')).getText()).toMatch('0'); element(by.css('button')).click(); expect(element(by.binding('count')).getText()).toMatch('1'); }); </file> </example> */ /* * A collection of directives that allows creation of custom event handlers that are defined as * angular expressions and are compiled and executed within the current scope. */ var ngEventDirectives = {}; // For events that might fire synchronously during DOM manipulation // we need to execute their event handlers asynchronously using $evalAsync, // so that they are not executed in an inconsistent state. var forceAsyncEvents = { 'blur': true, 'focus': true }; forEach( 'click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste'.split(' '), function(eventName) { var directiveName = directiveNormalize('ng-' + eventName); ngEventDirectives[directiveName] = ['$parse', '$rootScope', function($parse, $rootScope) { return { restrict: 'A', compile: function($element, attr) { // We expose the powerful $event object on the scope that provides access to the Window, // etc. that isn't protected by the fast paths in $parse. We explicitly request better // checks at the cost of speed since event handler expressions are not executed as // frequently as regular change detection. var fn = $parse(attr[directiveName], /* interceptorFn */ null, /* expensiveChecks */ true); return function ngEventHandler(scope, element) { element.on(eventName, function(event) { var callback = function() { fn(scope, {$event:event}); }; if (forceAsyncEvents[eventName] && $rootScope.$$phase) { scope.$evalAsync(callback); } else { scope.$apply(callback); } }); }; } }; }]; } ); /** * @ngdoc directive * @name ngDblclick * * @description * The `ngDblclick` directive allows you to specify custom behavior on a dblclick event. * * @element ANY * @priority 0 * @param {expression} ngDblclick {@link guide/expression Expression} to evaluate upon * a dblclick. (The Event object is available as `$event`) * * @example <example> <file name="index.html"> <button ng-dblclick="count = count + 1" ng-init="count=0"> Increment (on double click) </button> count: {{count}} </file> </example> */ /** * @ngdoc directive * @name ngMousedown * * @description * The ngMousedown directive allows you to specify custom behavior on mousedown event. * * @element ANY * @priority 0 * @param {expression} ngMousedown {@link guide/expression Expression} to evaluate upon * mousedown. ({@link guide/expression#-event- Event object is available as `$event`}) * * @example <example> <file name="index.html"> <button ng-mousedown="count = count + 1" ng-init="count=0"> Increment (on mouse down) </button> count: {{count}} </file> </example> */ /** * @ngdoc directive * @name ngMouseup * * @description * Specify custom behavior on mouseup event. * * @element ANY * @priority 0 * @param {expression} ngMouseup {@link guide/expression Expression} to evaluate upon * mouseup. ({@link guide/expression#-event- Event object is available as `$event`}) * * @example <example> <file name="index.html"> <button ng-mouseup="count = count + 1" ng-init="count=0"> Increment (on mouse up) </button> count: {{count}} </file> </example> */ /** * @ngdoc directive * @name ngMouseover * * @description * Specify custom behavior on mouseover event. * * @element ANY * @priority 0 * @param {expression} ngMouseover {@link guide/expression Expression} to evaluate upon * mouseover. ({@link guide/expression#-event- Event object is available as `$event`}) * * @example <example> <file name="index.html"> <button ng-mouseover="count = count + 1" ng-init="count=0"> Increment (when mouse is over) </button> count: {{count}} </file> </example> */ /** * @ngdoc directive * @name ngMouseenter * * @description * Specify custom behavior on mouseenter event. * * @element ANY * @priority 0 * @param {expression} ngMouseenter {@link guide/expression Expression} to evaluate upon * mouseenter. ({@link guide/expression#-event- Event object is available as `$event`}) * * @example <example> <file name="index.html"> <button ng-mouseenter="count = count + 1" ng-init="count=0"> Increment (when mouse enters) </button> count: {{count}} </file> </example> */ /** * @ngdoc directive * @name ngMouseleave * * @description * Specify custom behavior on mouseleave event. * * @element ANY * @priority 0 * @param {expression} ngMouseleave {@link guide/expression Expression} to evaluate upon * mouseleave. ({@link guide/expression#-event- Event object is available as `$event`}) * * @example <example> <file name="index.html"> <button ng-mouseleave="count = count + 1" ng-init="count=0"> Increment (when mouse leaves) </button> count: {{count}} </file> </example> */ /** * @ngdoc directive * @name ngMousemove * * @description * Specify custom behavior on mousemove event. * * @element ANY * @priority 0 * @param {expression} ngMousemove {@link guide/expression Expression} to evaluate upon * mousemove. ({@link guide/expression#-event- Event object is available as `$event`}) * * @example <example> <file name="index.html"> <button ng-mousemove="count = count + 1" ng-init="count=0"> Increment (when mouse moves) </button> count: {{count}} </file> </example> */ /** * @ngdoc directive * @name ngKeydown * * @description * Specify custom behavior on keydown event. * * @element ANY * @priority 0 * @param {expression} ngKeydown {@link guide/expression Expression} to evaluate upon * keydown. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.) * * @example <example> <file name="index.html"> <input ng-keydown="count = count + 1" ng-init="count=0"> key down count: {{count}} </file> </example> */ /** * @ngdoc directive * @name ngKeyup * * @description * Specify custom behavior on keyup event. * * @element ANY * @priority 0 * @param {expression} ngKeyup {@link guide/expression Expression} to evaluate upon * keyup. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.) * * @example <example> <file name="index.html"> <p>Typing in the input box below updates the key count</p> <input ng-keyup="count = count + 1" ng-init="count=0"> key up count: {{count}} <p>Typing in the input box below updates the keycode</p> <input ng-keyup="event=$event"> <p>event keyCode: {{ event.keyCode }}</p> <p>event altKey: {{ event.altKey }}</p> </file> </example> */ /** * @ngdoc directive * @name ngKeypress * * @description * Specify custom behavior on keypress event. * * @element ANY * @param {expression} ngKeypress {@link guide/expression Expression} to evaluate upon * keypress. ({@link guide/expression#-event- Event object is available as `$event`} * and can be interrogated for keyCode, altKey, etc.) * * @example <example> <file name="index.html"> <input ng-keypress="count = count + 1" ng-init="count=0"> key press count: {{count}} </file> </example> */ /** * @ngdoc directive * @name ngSubmit * * @description * Enables binding angular expressions to onsubmit events. * * Additionally it prevents the default action (which for form means sending the request to the * server and reloading the current page), but only if the form does not contain `action`, * `data-action`, or `x-action` attributes. * * <div class="alert alert-warning"> * **Warning:** Be careful not to cause "double-submission" by using both the `ngClick` and * `ngSubmit` handlers together. See the * {@link form#submitting-a-form-and-preventing-the-default-action `form` directive documentation} * for a detailed discussion of when `ngSubmit` may be triggered. * </div> * * @element form * @priority 0 * @param {expression} ngSubmit {@link guide/expression Expression} to eval. * ({@link guide/expression#-event- Event object is available as `$event`}) * * @example <example module="submitExample"> <file name="index.html"> <script> angular.module('submitExample', []) .controller('ExampleController', ['$scope', function($scope) { $scope.list = []; $scope.text = 'hello'; $scope.submit = function() { if ($scope.text) { $scope.list.push(this.text); $scope.text = ''; } }; }]); </script> <form ng-submit="submit()" ng-controller="ExampleController"> Enter text and hit enter: <input type="text" ng-model="text" name="text" /> <input type="submit" id="submit" value="Submit" /> <pre>list={{list}}</pre> </form> </file> <file name="protractor.js" type="protractor"> it('should check ng-submit', function() { expect(element(by.binding('list')).getText()).toBe('list=[]'); element(by.css('#submit')).click(); expect(element(by.binding('list')).getText()).toContain('hello'); expect(element(by.model('text')).getAttribute('value')).toBe(''); }); it('should ignore empty strings', function() { expect(element(by.binding('list')).getText()).toBe('list=[]'); element(by.css('#submit')).click(); element(by.css('#submit')).click(); expect(element(by.binding('list')).getText()).toContain('hello'); }); </file> </example> */ /** * @ngdoc directive * @name ngFocus * * @description * Specify custom behavior on focus event. * * Note: As the `focus` event is executed synchronously when calling `input.focus()` * AngularJS executes the expression using `scope.$evalAsync` if the event is fired * during an `$apply` to ensure a consistent state. * * @element window, input, select, textarea, a * @priority 0 * @param {expression} ngFocus {@link guide/expression Expression} to evaluate upon * focus. ({@link guide/expression#-event- Event object is available as `$event`}) * * @example * See {@link ng.directive:ngClick ngClick} */ /** * @ngdoc directive * @name ngBlur * * @description * Specify custom behavior on blur event. * * A [blur event](https://developer.mozilla.org/en-US/docs/Web/Events/blur) fires when * an element has lost focus. * * Note: As the `blur` event is executed synchronously also during DOM manipulations * (e.g. removing a focussed input), * AngularJS executes the expression using `scope.$evalAsync` if the event is fired * during an `$apply` to ensure a consistent state. * * @element window, input, select, textarea, a * @priority 0 * @param {expression} ngBlur {@link guide/expression Expression} to evaluate upon * blur. ({@link guide/expression#-event- Event object is available as `$event`}) * * @example * See {@link ng.directive:ngClick ngClick} */ /** * @ngdoc directive * @name ngCopy * * @description * Specify custom behavior on copy event. * * @element window, input, select, textarea, a * @priority 0 * @param {expression} ngCopy {@link guide/expression Expression} to evaluate upon * copy. ({@link guide/expression#-event- Event object is available as `$event`}) * * @example <example> <file name="index.html"> <input ng-copy="copied=true" ng-init="copied=false; value='copy me'" ng-model="value"> copied: {{copied}} </file> </example> */ /** * @ngdoc directive * @name ngCut * * @description * Specify custom behavior on cut event. * * @element window, input, select, textarea, a * @priority 0 * @param {expression} ngCut {@link guide/expression Expression} to evaluate upon * cut. ({@link guide/expression#-event- Event object is available as `$event`}) * * @example <example> <file name="index.html"> <input ng-cut="cut=true" ng-init="cut=false; value='cut me'" ng-model="value"> cut: {{cut}} </file> </example> */ /** * @ngdoc directive * @name ngPaste * * @description * Specify custom behavior on paste event. * * @element window, input, select, textarea, a * @priority 0 * @param {expression} ngPaste {@link guide/expression Expression} to evaluate upon * paste. ({@link guide/expression#-event- Event object is available as `$event`}) * * @example <example> <file name="index.html"> <input ng-paste="paste=true" ng-init="paste=false" placeholder='paste here'> pasted: {{paste}} </file> </example> */ /** * @ngdoc directive * @name ngIf * @restrict A * * @description * The `ngIf` directive removes or recreates a portion of the DOM tree based on an * {expression}. If the expression assigned to `ngIf` evaluates to a false * value then the element is removed from the DOM, otherwise a clone of the * element is reinserted into the DOM. * * `ngIf` differs from `ngShow` and `ngHide` in that `ngIf` completely removes and recreates the * element in the DOM rather than changing its visibility via the `display` css property. A common * case when this difference is significant is when using css selectors that rely on an element's * position within the DOM, such as the `:first-child` or `:last-child` pseudo-classes. * * Note that when an element is removed using `ngIf` its scope is destroyed and a new scope * is created when the element is restored. The scope created within `ngIf` inherits from * its parent scope using * [prototypal inheritance](https://github.com/angular/angular.js/wiki/Understanding-Scopes#javascript-prototypal-inheritance). * An important implication of this is if `ngModel` is used within `ngIf` to bind to * a javascript primitive defined in the parent scope. In this case any modifications made to the * variable within the child scope will override (hide) the value in the parent scope. * * Also, `ngIf` recreates elements using their compiled state. An example of this behavior * is if an element's class attribute is directly modified after it's compiled, using something like * jQuery's `.addClass()` method, and the element is later removed. When `ngIf` recreates the element * the added class will be lost because the original compiled state is used to regenerate the element. * * Additionally, you can provide animations via the `ngAnimate` module to animate the `enter` * and `leave` effects. * * @animations * enter - happens just after the `ngIf` contents change and a new DOM element is created and injected into the `ngIf` container * leave - happens just before the `ngIf` contents are removed from the DOM * * @element ANY * @scope * @priority 600 * @param {expression} ngIf If the {@link guide/expression expression} is falsy then * the element is removed from the DOM tree. If it is truthy a copy of the compiled * element is added to the DOM tree. * * @example <example module="ngAnimate" deps="angular-animate.js" animations="true"> <file name="index.html"> Click me: <input type="checkbox" ng-model="checked" ng-init="checked=true" /><br/> Show when checked: <span ng-if="checked" class="animate-if"> This is removed when the checkbox is unchecked. </span> </file> <file name="animations.css"> .animate-if { background:white; border:1px solid black; padding:10px; } .animate-if.ng-enter, .animate-if.ng-leave { -webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s; transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s; } .animate-if.ng-enter, .animate-if.ng-leave.ng-leave-active { opacity:0; } .animate-if.ng-leave, .animate-if.ng-enter.ng-enter-active { opacity:1; } </file> </example> */ var ngIfDirective = ['$animate', function($animate) { return { multiElement: true, transclude: 'element', priority: 600, terminal: true, restrict: 'A', $$tlb: true, link: function($scope, $element, $attr, ctrl, $transclude) { var block, childScope, previousElements; $scope.$watch($attr.ngIf, function ngIfWatchAction(value) { if (value) { if (!childScope) { $transclude(function(clone, newScope) { childScope = newScope; clone[clone.length++] = document.createComment(' end ngIf: ' + $attr.ngIf + ' '); // Note: We only need the first/last node of the cloned nodes. // However, we need to keep the reference to the jqlite wrapper as it might be changed later // by a directive with templateUrl when its template arrives. block = { clone: clone }; $animate.enter(clone, $element.parent(), $element); }); } } else { if (previousElements) { previousElements.remove(); previousElements = null; } if (childScope) { childScope.$destroy(); childScope = null; } if (block) { previousElements = getBlockNodes(block.clone); $animate.leave(previousElements).then(function() { previousElements = null; }); block = null; } } }); } }; }]; /** * @ngdoc directive * @name ngInclude * @restrict ECA * * @description * Fetches, compiles and includes an external HTML fragment. * * By default, the template URL is restricted to the same domain and protocol as the * application document. This is done by calling {@link $sce#getTrustedResourceUrl * $sce.getTrustedResourceUrl} on it. To load templates from other domains or protocols * you may either {@link ng.$sceDelegateProvider#resourceUrlWhitelist whitelist them} or * {@link $sce#trustAsResourceUrl wrap them} as trusted values. Refer to Angular's {@link * ng.$sce Strict Contextual Escaping}. * * In addition, the browser's * [Same Origin Policy](https://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_XMLHttpRequest) * and [Cross-Origin Resource Sharing (CORS)](http://www.w3.org/TR/cors/) * policy may further restrict whether the template is successfully loaded. * For example, `ngInclude` won't work for cross-domain requests on all browsers and for `file://` * access on some browsers. * * @animations * enter - animation is used to bring new content into the browser. * leave - animation is used to animate existing content away. * * The enter and leave animation occur concurrently. * * @scope * @priority 400 * * @param {string} ngInclude|src angular expression evaluating to URL. If the source is a string constant, * make sure you wrap it in **single** quotes, e.g. `src="'myPartialTemplate.html'"`. * @param {string=} onload Expression to evaluate when a new partial is loaded. * * @param {string=} autoscroll Whether `ngInclude` should call {@link ng.$anchorScroll * $anchorScroll} to scroll the viewport after the content is loaded. * * - If the attribute is not set, disable scrolling. * - If the attribute is set without value, enable scrolling. * - Otherwise enable scrolling only if the expression evaluates to truthy value. * * @example <example module="includeExample" deps="angular-animate.js" animations="true"> <file name="index.html"> <div ng-controller="ExampleController"> <select ng-model="template" ng-options="t.name for t in templates"> <option value="">(blank)</option> </select> url of the template: <code>{{template.url}}</code> <hr/> <div class="slide-animate-container"> <div class="slide-animate" ng-include="template.url"></div> </div> </div> </file> <file name="script.js"> angular.module('includeExample', ['ngAnimate']) .controller('ExampleController', ['$scope', function($scope) { $scope.templates = [ { name: 'template1.html', url: 'template1.html'}, { name: 'template2.html', url: 'template2.html'} ]; $scope.template = $scope.templates[0]; }]); </file> <file name="template1.html"> Content of template1.html </file> <file name="template2.html"> Content of template2.html </file> <file name="animations.css"> .slide-animate-container { position:relative; background:white; border:1px solid black; height:40px; overflow:hidden; } .slide-animate { padding:10px; } .slide-animate.ng-enter, .slide-animate.ng-leave { -webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s; transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s; position:absolute; top:0; left:0; right:0; bottom:0; display:block; padding:10px; } .slide-animate.ng-enter { top:-50px; } .slide-animate.ng-enter.ng-enter-active { top:0; } .slide-animate.ng-leave { top:0; } .slide-animate.ng-leave.ng-leave-active { top:50px; } </file> <file name="protractor.js" type="protractor"> var templateSelect = element(by.model('template')); var includeElem = element(by.css('[ng-include]')); it('should load template1.html', function() { expect(includeElem.getText()).toMatch(/Content of template1.html/); }); it('should load template2.html', function() { if (browser.params.browser == 'firefox') { // Firefox can't handle using selects // See https://github.com/angular/protractor/issues/480 return; } templateSelect.click(); templateSelect.all(by.css('option')).get(2).click(); expect(includeElem.getText()).toMatch(/Content of template2.html/); }); it('should change to blank', function() { if (browser.params.browser == 'firefox') { // Firefox can't handle using selects return; } templateSelect.click(); templateSelect.all(by.css('option')).get(0).click(); expect(includeElem.isPresent()).toBe(false); }); </file> </example> */ /** * @ngdoc event * @name ngInclude#$includeContentRequested * @eventType emit on the scope ngInclude was declared in * @description * Emitted every time the ngInclude content is requested. * * @param {Object} angularEvent Synthetic event object. * @param {String} src URL of content to load. */ /** * @ngdoc event * @name ngInclude#$includeContentLoaded * @eventType emit on the current ngInclude scope * @description * Emitted every time the ngInclude content is reloaded. * * @param {Object} angularEvent Synthetic event object. * @param {String} src URL of content to load. */ /** * @ngdoc event * @name ngInclude#$includeContentError * @eventType emit on the scope ngInclude was declared in * @description * Emitted when a template HTTP request yields an erroneous response (status < 200 || status > 299) * * @param {Object} angularEvent Synthetic event object. * @param {String} src URL of content to load. */ var ngIncludeDirective = ['$templateRequest', '$anchorScroll', '$animate', '$sce', function($templateRequest, $anchorScroll, $animate, $sce) { return { restrict: 'ECA', priority: 400, terminal: true, transclude: 'element', controller: angular.noop, compile: function(element, attr) { var srcExp = attr.ngInclude || attr.src, onloadExp = attr.onload || '', autoScrollExp = attr.autoscroll; return function(scope, $element, $attr, ctrl, $transclude) { var changeCounter = 0, currentScope, previousElement, currentElement; var cleanupLastIncludeContent = function() { if (previousElement) { previousElement.remove(); previousElement = null; } if (currentScope) { currentScope.$destroy(); currentScope = null; } if (currentElement) { $animate.leave(currentElement).then(function() { previousElement = null; }); previousElement = currentElement; currentElement = null; } }; scope.$watch($sce.parseAsResourceUrl(srcExp), function ngIncludeWatchAction(src) { var afterAnimation = function() { if (isDefined(autoScrollExp) && (!autoScrollExp || scope.$eval(autoScrollExp))) { $anchorScroll(); } }; var thisChangeId = ++changeCounter; if (src) { //set the 2nd param to true to ignore the template request error so that the inner //contents and scope can be cleaned up. $templateRequest(src, true).then(function(response) { if (thisChangeId !== changeCounter) return; var newScope = scope.$new(); ctrl.template = response; // Note: This will also link all children of ng-include that were contained in the original // html. If that content contains controllers, ... they could pollute/change the scope. // However, using ng-include on an element with additional content does not make sense... // Note: We can't remove them in the cloneAttchFn of $transclude as that // function is called before linking the content, which would apply child // directives to non existing elements. var clone = $transclude(newScope, function(clone) { cleanupLastIncludeContent(); $animate.enter(clone, null, $element).then(afterAnimation); }); currentScope = newScope; currentElement = clone; currentScope.$emit('$includeContentLoaded', src); scope.$eval(onloadExp); }, function() { if (thisChangeId === changeCounter) { cleanupLastIncludeContent(); scope.$emit('$includeContentError', src); } }); scope.$emit('$includeContentRequested', src); } else { cleanupLastIncludeContent(); ctrl.template = null; } }); }; } }; }]; // This directive is called during the $transclude call of the first `ngInclude` directive. // It will replace and compile the content of the element with the loaded template. // We need this directive so that the element content is already filled when // the link function of another directive on the same element as ngInclude // is called. var ngIncludeFillContentDirective = ['$compile', function($compile) { return { restrict: 'ECA', priority: -400, require: 'ngInclude', link: function(scope, $element, $attr, ctrl) { if (/SVG/.test($element[0].toString())) { // WebKit: https://bugs.webkit.org/show_bug.cgi?id=135698 --- SVG elements do not // support innerHTML, so detect this here and try to generate the contents // specially. $element.empty(); $compile(jqLiteBuildFragment(ctrl.template, document).childNodes)(scope, function namespaceAdaptedClone(clone) { $element.append(clone); }, {futureParentElement: $element}); return; } $element.html(ctrl.template); $compile($element.contents())(scope); } }; }]; /** * @ngdoc directive * @name ngInit * @restrict AC * * @description * The `ngInit` directive allows you to evaluate an expression in the * current scope. * * <div class="alert alert-error"> * The only appropriate use of `ngInit` is for aliasing special properties of * {@link ng.directive:ngRepeat `ngRepeat`}, as seen in the demo below. Besides this case, you * should use {@link guide/controller controllers} rather than `ngInit` * to initialize values on a scope. * </div> * <div class="alert alert-warning"> * **Note**: If you have assignment in `ngInit` along with {@link ng.$filter `$filter`}, make * sure you have parenthesis for correct precedence: * <pre class="prettyprint"> * `<div ng-init="test1 = (data | orderBy:'name')"></div>` * </pre> * </div> * * @priority 450 * * @element ANY * @param {expression} ngInit {@link guide/expression Expression} to eval. * * @example <example module="initExample"> <file name="index.html"> <script> angular.module('initExample', []) .controller('ExampleController', ['$scope', function($scope) { $scope.list = [['a', 'b'], ['c', 'd']]; }]); </script> <div ng-controller="ExampleController"> <div ng-repeat="innerList in list" ng-init="outerIndex = $index"> <div ng-repeat="value in innerList" ng-init="innerIndex = $index"> <span class="example-init">list[ {{outerIndex}} ][ {{innerIndex}} ] = {{value}};</span> </div> </div> </div> </file> <file name="protractor.js" type="protractor"> it('should alias index positions', function() { var elements = element.all(by.css('.example-init')); expect(elements.get(0).getText()).toBe('list[ 0 ][ 0 ] = a;'); expect(elements.get(1).getText()).toBe('list[ 0 ][ 1 ] = b;'); expect(elements.get(2).getText()).toBe('list[ 1 ][ 0 ] = c;'); expect(elements.get(3).getText()).toBe('list[ 1 ][ 1 ] = d;'); }); </file> </example> */ var ngInitDirective = ngDirective({ priority: 450, compile: function() { return { pre: function(scope, element, attrs) { scope.$eval(attrs.ngInit); } }; } }); /** * @ngdoc directive * @name ngList * * @description * Text input that converts between a delimited string and an array of strings. The default * delimiter is a comma followed by a space - equivalent to `ng-list=", "`. You can specify a custom * delimiter as the value of the `ngList` attribute - for example, `ng-list=" | "`. * * The behaviour of the directive is affected by the use of the `ngTrim` attribute. * * If `ngTrim` is set to `"false"` then whitespace around both the separator and each * list item is respected. This implies that the user of the directive is responsible for * dealing with whitespace but also allows you to use whitespace as a delimiter, such as a * tab or newline character. * * Otherwise whitespace around the delimiter is ignored when splitting (although it is respected * when joining the list items back together) and whitespace around each list item is stripped * before it is added to the model. * * ### Example with Validation * * <example name="ngList-directive" module="listExample"> * <file name="app.js"> * angular.module('listExample', []) * .controller('ExampleController', ['$scope', function($scope) { * $scope.names = ['morpheus', 'neo', 'trinity']; * }]); * </file> * <file name="index.html"> * <form name="myForm" ng-controller="ExampleController"> * List: <input name="namesInput" ng-model="names" ng-list required> * <span class="error" ng-show="myForm.namesInput.$error.required"> * Required!</span> * <br> * <tt>names = {{names}}</tt><br/> * <tt>myForm.namesInput.$valid = {{myForm.namesInput.$valid}}</tt><br/> * <tt>myForm.namesInput.$error = {{myForm.namesInput.$error}}</tt><br/> * <tt>myForm.$valid = {{myForm.$valid}}</tt><br/> * <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/> * </form> * </file> * <file name="protractor.js" type="protractor"> * var listInput = element(by.model('names')); * var names = element(by.exactBinding('names')); * var valid = element(by.binding('myForm.namesInput.$valid')); * var error = element(by.css('span.error')); * * it('should initialize to model', function() { * expect(names.getText()).toContain('["morpheus","neo","trinity"]'); * expect(valid.getText()).toContain('true'); * expect(error.getCssValue('display')).toBe('none'); * }); * * it('should be invalid if empty', function() { * listInput.clear(); * listInput.sendKeys(''); * * expect(names.getText()).toContain(''); * expect(valid.getText()).toContain('false'); * expect(error.getCssValue('display')).not.toBe('none'); * }); * </file> * </example> * * ### Example - splitting on whitespace * <example name="ngList-directive-newlines"> * <file name="index.html"> * <textarea ng-model="list" ng-list="&#10;" ng-trim="false"></textarea> * <pre>{{ list | json }}</pre> * </file> * <file name="protractor.js" type="protractor"> * it("should split the text by newlines", function() { * var listInput = element(by.model('list')); * var output = element(by.binding('list | json')); * listInput.sendKeys('abc\ndef\nghi'); * expect(output.getText()).toContain('[\n "abc",\n "def",\n "ghi"\n]'); * }); * </file> * </example> * * @element input * @param {string=} ngList optional delimiter that should be used to split the value. */ var ngListDirective = function() { return { restrict: 'A', priority: 100, require: 'ngModel', link: function(scope, element, attr, ctrl) { // We want to control whitespace trimming so we use this convoluted approach // to access the ngList attribute, which doesn't pre-trim the attribute var ngList = element.attr(attr.$attr.ngList) || ', '; var trimValues = attr.ngTrim !== 'false'; var separator = trimValues ? trim(ngList) : ngList; var parse = function(viewValue) { // If the viewValue is invalid (say required but empty) it will be `undefined` if (isUndefined(viewValue)) return; var list = []; if (viewValue) { forEach(viewValue.split(separator), function(value) { if (value) list.push(trimValues ? trim(value) : value); }); } return list; }; ctrl.$parsers.push(parse); ctrl.$formatters.push(function(value) { if (isArray(value)) { return value.join(ngList); } return undefined; }); // Override the standard $isEmpty because an empty array means the input is empty. ctrl.$isEmpty = function(value) { return !value || !value.length; }; } }; }; /* global VALID_CLASS: true, INVALID_CLASS: true, PRISTINE_CLASS: true, DIRTY_CLASS: true, UNTOUCHED_CLASS: true, TOUCHED_CLASS: true, */ var VALID_CLASS = 'ng-valid', INVALID_CLASS = 'ng-invalid', PRISTINE_CLASS = 'ng-pristine', DIRTY_CLASS = 'ng-dirty', UNTOUCHED_CLASS = 'ng-untouched', TOUCHED_CLASS = 'ng-touched', PENDING_CLASS = 'ng-pending'; var $ngModelMinErr = new minErr('ngModel'); /** * @ngdoc type * @name ngModel.NgModelController * * @property {string} $viewValue Actual string value in the view. * @property {*} $modelValue The value in the model that the control is bound to. * @property {Array.<Function>} $parsers Array of functions to execute, as a pipeline, whenever the control reads value from the DOM. The functions are called in array order, each passing its return value through to the next. The last return value is forwarded to the {@link ngModel.NgModelController#$validators `$validators`} collection. Parsers are used to sanitize / convert the {@link ngModel.NgModelController#$viewValue `$viewValue`}. Returning `undefined` from a parser means a parse error occurred. In that case, no {@link ngModel.NgModelController#$validators `$validators`} will run and the `ngModel` will be set to `undefined` unless {@link ngModelOptions `ngModelOptions.allowInvalid`} is set to `true`. The parse error is stored in `ngModel.$error.parse`. * * @property {Array.<Function>} $formatters Array of functions to execute, as a pipeline, whenever the model value changes. The functions are called in reverse array order, each passing the value through to the next. The last return value is used as the actual DOM value. Used to format / convert values for display in the control. * ```js * function formatter(value) { * if (value) { * return value.toUpperCase(); * } * } * ngModel.$formatters.push(formatter); * ``` * * @property {Object.<string, function>} $validators A collection of validators that are applied * whenever the model value changes. The key value within the object refers to the name of the * validator while the function refers to the validation operation. The validation operation is * provided with the model value as an argument and must return a true or false value depending * on the response of that validation. * * ```js * ngModel.$validators.validCharacters = function(modelValue, viewValue) { * var value = modelValue || viewValue; * return /[0-9]+/.test(value) && * /[a-z]+/.test(value) && * /[A-Z]+/.test(value) && * /\W+/.test(value); * }; * ``` * * @property {Object.<string, function>} $asyncValidators A collection of validations that are expected to * perform an asynchronous validation (e.g. a HTTP request). The validation function that is provided * is expected to return a promise when it is run during the model validation process. Once the promise * is delivered then the validation status will be set to true when fulfilled and false when rejected. * When the asynchronous validators are triggered, each of the validators will run in parallel and the model * value will only be updated once all validators have been fulfilled. As long as an asynchronous validator * is unfulfilled, its key will be added to the controllers `$pending` property. Also, all asynchronous validators * will only run once all synchronous validators have passed. * * Please note that if $http is used then it is important that the server returns a success HTTP response code * in order to fulfill the validation and a status level of `4xx` in order to reject the validation. * * ```js * ngModel.$asyncValidators.uniqueUsername = function(modelValue, viewValue) { * var value = modelValue || viewValue; * * // Lookup user by username * return $http.get('/api/users/' + value). * then(function resolved() { * //username exists, this means validation fails * return $q.reject('exists'); * }, function rejected() { * //username does not exist, therefore this validation passes * return true; * }); * }; * ``` * * @property {Array.<Function>} $viewChangeListeners Array of functions to execute whenever the * view value has changed. It is called with no arguments, and its return value is ignored. * This can be used in place of additional $watches against the model value. * * @property {Object} $error An object hash with all failing validator ids as keys. * @property {Object} $pending An object hash with all pending validator ids as keys. * * @property {boolean} $untouched True if control has not lost focus yet. * @property {boolean} $touched True if control has lost focus. * @property {boolean} $pristine True if user has not interacted with the control yet. * @property {boolean} $dirty True if user has already interacted with the control. * @property {boolean} $valid True if there is no error. * @property {boolean} $invalid True if at least one error on the control. * @property {string} $name The name attribute of the control. * * @description * * `NgModelController` provides API for the {@link ngModel `ngModel`} directive. * The controller contains services for data-binding, validation, CSS updates, and value formatting * and parsing. It purposefully does not contain any logic which deals with DOM rendering or * listening to DOM events. * Such DOM related logic should be provided by other directives which make use of * `NgModelController` for data-binding to control elements. * Angular provides this DOM logic for most {@link input `input`} elements. * At the end of this page you can find a {@link ngModel.NgModelController#custom-control-example * custom control example} that uses `ngModelController` to bind to `contenteditable` elements. * * @example * ### Custom Control Example * This example shows how to use `NgModelController` with a custom control to achieve * data-binding. Notice how different directives (`contenteditable`, `ng-model`, and `required`) * collaborate together to achieve the desired result. * * Note that `contenteditable` is an HTML5 attribute, which tells the browser to let the element * contents be edited in place by the user. This will not work on older browsers. * * We are using the {@link ng.service:$sce $sce} service here and include the {@link ngSanitize $sanitize} * module to automatically remove "bad" content like inline event listener (e.g. `<span onclick="...">`). * However, as we are using `$sce` the model can still decide to provide unsafe content if it marks * that content using the `$sce` service. * * <example name="NgModelController" module="customControl" deps="angular-sanitize.js"> <file name="style.css"> [contenteditable] { border: 1px solid black; background-color: white; min-height: 20px; } .ng-invalid { border: 1px solid red; } </file> <file name="script.js"> angular.module('customControl', ['ngSanitize']). directive('contenteditable', ['$sce', function($sce) { return { restrict: 'A', // only activate on element attribute require: '?ngModel', // get a hold of NgModelController link: function(scope, element, attrs, ngModel) { if (!ngModel) return; // do nothing if no ng-model // Specify how UI should be updated ngModel.$render = function() { element.html($sce.getTrustedHtml(ngModel.$viewValue || '')); }; // Listen for change events to enable binding element.on('blur keyup change', function() { scope.$evalAsync(read); }); read(); // initialize // Write data to the model function read() { var html = element.html(); // When we clear the content editable the browser leaves a <br> behind // If strip-br attribute is provided then we strip this out if ( attrs.stripBr && html == '<br>' ) { html = ''; } ngModel.$setViewValue(html); } } }; }]); </file> <file name="index.html"> <form name="myForm"> <div contenteditable name="myWidget" ng-model="userContent" strip-br="true" required>Change me!</div> <span ng-show="myForm.myWidget.$error.required">Required!</span> <hr> <textarea ng-model="userContent"></textarea> </form> </file> <file name="protractor.js" type="protractor"> it('should data-bind and become invalid', function() { if (browser.params.browser == 'safari' || browser.params.browser == 'firefox') { // SafariDriver can't handle contenteditable // and Firefox driver can't clear contenteditables very well return; } var contentEditable = element(by.css('[contenteditable]')); var content = 'Change me!'; expect(contentEditable.getText()).toEqual(content); contentEditable.clear(); contentEditable.sendKeys(protractor.Key.BACK_SPACE); expect(contentEditable.getText()).toEqual(''); expect(contentEditable.getAttribute('class')).toMatch(/ng-invalid-required/); }); </file> * </example> * * */ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$parse', '$animate', '$timeout', '$rootScope', '$q', '$interpolate', function($scope, $exceptionHandler, $attr, $element, $parse, $animate, $timeout, $rootScope, $q, $interpolate) { this.$viewValue = Number.NaN; this.$modelValue = Number.NaN; this.$$rawModelValue = undefined; // stores the parsed modelValue / model set from scope regardless of validity. this.$validators = {}; this.$asyncValidators = {}; this.$parsers = []; this.$formatters = []; this.$viewChangeListeners = []; this.$untouched = true; this.$touched = false; this.$pristine = true; this.$dirty = false; this.$valid = true; this.$invalid = false; this.$error = {}; // keep invalid keys here this.$$success = {}; // keep valid keys here this.$pending = undefined; // keep pending keys here this.$name = $interpolate($attr.name || '', false)($scope); var parsedNgModel = $parse($attr.ngModel), parsedNgModelAssign = parsedNgModel.assign, ngModelGet = parsedNgModel, ngModelSet = parsedNgModelAssign, pendingDebounce = null, ctrl = this; this.$$setOptions = function(options) { ctrl.$options = options; if (options && options.getterSetter) { var invokeModelGetter = $parse($attr.ngModel + '()'), invokeModelSetter = $parse($attr.ngModel + '($$$p)'); ngModelGet = function($scope) { var modelValue = parsedNgModel($scope); if (isFunction(modelValue)) { modelValue = invokeModelGetter($scope); } return modelValue; }; ngModelSet = function($scope, newValue) { if (isFunction(parsedNgModel($scope))) { invokeModelSetter($scope, {$$$p: ctrl.$modelValue}); } else { parsedNgModelAssign($scope, ctrl.$modelValue); } }; } else if (!parsedNgModel.assign) { throw $ngModelMinErr('nonassign', "Expression '{0}' is non-assignable. Element: {1}", $attr.ngModel, startingTag($element)); } }; /** * @ngdoc method * @name ngModel.NgModelController#$render * * @description * Called when the view needs to be updated. It is expected that the user of the ng-model * directive will implement this method. * * The `$render()` method is invoked in the following situations: * * * `$rollbackViewValue()` is called. If we are rolling back the view value to the last * committed value then `$render()` is called to update the input control. * * The value referenced by `ng-model` is changed programmatically and both the `$modelValue` and * the `$viewValue` are different to last time. * * Since `ng-model` does not do a deep watch, `$render()` is only invoked if the values of * `$modelValue` and `$viewValue` are actually different to their previous value. If `$modelValue` * or `$viewValue` are objects (rather than a string or number) then `$render()` will not be * invoked if you only change a property on the objects. */ this.$render = noop; /** * @ngdoc method * @name ngModel.NgModelController#$isEmpty * * @description * This is called when we need to determine if the value of an input is empty. * * For instance, the required directive does this to work out if the input has data or not. * * The default `$isEmpty` function checks whether the value is `undefined`, `''`, `null` or `NaN`. * * You can override this for input directives whose concept of being empty is different to the * default. The `checkboxInputType` directive does this because in its case a value of `false` * implies empty. * * @param {*} value The value of the input to check for emptiness. * @returns {boolean} True if `value` is "empty". */ this.$isEmpty = function(value) { return isUndefined(value) || value === '' || value === null || value !== value; }; var parentForm = $element.inheritedData('$formController') || nullFormCtrl, currentValidationRunId = 0; /** * @ngdoc method * @name ngModel.NgModelController#$setValidity * * @description * Change the validity state, and notify the form. * * This method can be called within $parsers/$formatters or a custom validation implementation. * However, in most cases it should be sufficient to use the `ngModel.$validators` and * `ngModel.$asyncValidators` collections which will call `$setValidity` automatically. * * @param {string} validationErrorKey Name of the validator. The `validationErrorKey` will be assigned * to either `$error[validationErrorKey]` or `$pending[validationErrorKey]` * (for unfulfilled `$asyncValidators`), so that it is available for data-binding. * The `validationErrorKey` should be in camelCase and will get converted into dash-case * for class name. Example: `myError` will result in `ng-valid-my-error` and `ng-invalid-my-error` * class and can be bound to as `{{someForm.someControl.$error.myError}}` . * @param {boolean} isValid Whether the current state is valid (true), invalid (false), pending (undefined), * or skipped (null). Pending is used for unfulfilled `$asyncValidators`. * Skipped is used by Angular when validators do not run because of parse errors and * when `$asyncValidators` do not run because any of the `$validators` failed. */ addSetValidityMethod({ ctrl: this, $element: $element, set: function(object, property) { object[property] = true; }, unset: function(object, property) { delete object[property]; }, parentForm: parentForm, $animate: $animate }); /** * @ngdoc method * @name ngModel.NgModelController#$setPristine * * @description * Sets the control to its pristine state. * * This method can be called to remove the `ng-dirty` class and set the control to its pristine * state (`ng-pristine` class). A model is considered to be pristine when the control * has not been changed from when first compiled. */ this.$setPristine = function() { ctrl.$dirty = false; ctrl.$pristine = true; $animate.removeClass($element, DIRTY_CLASS); $animate.addClass($element, PRISTINE_CLASS); }; /** * @ngdoc method * @name ngModel.NgModelController#$setDirty * * @description * Sets the control to its dirty state. * * This method can be called to remove the `ng-pristine` class and set the control to its dirty * state (`ng-dirty` class). A model is considered to be dirty when the control has been changed * from when first compiled. */ this.$setDirty = function() { ctrl.$dirty = true; ctrl.$pristine = false; $animate.removeClass($element, PRISTINE_CLASS); $animate.addClass($element, DIRTY_CLASS); parentForm.$setDirty(); }; /** * @ngdoc method * @name ngModel.NgModelController#$setUntouched * * @description * Sets the control to its untouched state. * * This method can be called to remove the `ng-touched` class and set the control to its * untouched state (`ng-untouched` class). Upon compilation, a model is set as untouched * by default, however this function can be used to restore that state if the model has * already been touched by the user. */ this.$setUntouched = function() { ctrl.$touched = false; ctrl.$untouched = true; $animate.setClass($element, UNTOUCHED_CLASS, TOUCHED_CLASS); }; /** * @ngdoc method * @name ngModel.NgModelController#$setTouched * * @description * Sets the control to its touched state. * * This method can be called to remove the `ng-untouched` class and set the control to its * touched state (`ng-touched` class). A model is considered to be touched when the user has * first focused the control element and then shifted focus away from the control (blur event). */ this.$setTouched = function() { ctrl.$touched = true; ctrl.$untouched = false; $animate.setClass($element, TOUCHED_CLASS, UNTOUCHED_CLASS); }; /** * @ngdoc method * @name ngModel.NgModelController#$rollbackViewValue * * @description * Cancel an update and reset the input element's value to prevent an update to the `$modelValue`, * which may be caused by a pending debounced event or because the input is waiting for a some * future event. * * If you have an input that uses `ng-model-options` to set up debounced events or events such * as blur you can have a situation where there is a period when the `$viewValue` * is out of synch with the ngModel's `$modelValue`. * * In this case, you can run into difficulties if you try to update the ngModel's `$modelValue` * programmatically before these debounced/future events have resolved/occurred, because Angular's * dirty checking mechanism is not able to tell whether the model has actually changed or not. * * The `$rollbackViewValue()` method should be called before programmatically changing the model of an * input which may have such events pending. This is important in order to make sure that the * input field will be updated with the new model value and any pending operations are cancelled. * * <example name="ng-model-cancel-update" module="cancel-update-example"> * <file name="app.js"> * angular.module('cancel-update-example', []) * * .controller('CancelUpdateController', ['$scope', function($scope) { * $scope.resetWithCancel = function(e) { * if (e.keyCode == 27) { * $scope.myForm.myInput1.$rollbackViewValue(); * $scope.myValue = ''; * } * }; * $scope.resetWithoutCancel = function(e) { * if (e.keyCode == 27) { * $scope.myValue = ''; * } * }; * }]); * </file> * <file name="index.html"> * <div ng-controller="CancelUpdateController"> * <p>Try typing something in each input. See that the model only updates when you * blur off the input. * </p> * <p>Now see what happens if you start typing then press the Escape key</p> * * <form name="myForm" ng-model-options="{ updateOn: 'blur' }"> * <p>With $rollbackViewValue()</p> * <input name="myInput1" ng-model="myValue" ng-keydown="resetWithCancel($event)"><br/> * myValue: "{{ myValue }}" * * <p>Without $rollbackViewValue()</p> * <input name="myInput2" ng-model="myValue" ng-keydown="resetWithoutCancel($event)"><br/> * myValue: "{{ myValue }}" * </form> * </div> * </file> * </example> */ this.$rollbackViewValue = function() { $timeout.cancel(pendingDebounce); ctrl.$viewValue = ctrl.$$lastCommittedViewValue; ctrl.$render(); }; /** * @ngdoc method * @name ngModel.NgModelController#$validate * * @description * Runs each of the registered validators (first synchronous validators and then * asynchronous validators). * If the validity changes to invalid, the model will be set to `undefined`, * unless {@link ngModelOptions `ngModelOptions.allowInvalid`} is `true`. * If the validity changes to valid, it will set the model to the last available valid * modelValue, i.e. either the last parsed value or the last value set from the scope. */ this.$validate = function() { // ignore $validate before model is initialized if (isNumber(ctrl.$modelValue) && isNaN(ctrl.$modelValue)) { return; } var viewValue = ctrl.$$lastCommittedViewValue; // Note: we use the $$rawModelValue as $modelValue might have been // set to undefined during a view -> model update that found validation // errors. We can't parse the view here, since that could change // the model although neither viewValue nor the model on the scope changed var modelValue = ctrl.$$rawModelValue; // Check if the there's a parse error, so we don't unset it accidentially var parserName = ctrl.$$parserName || 'parse'; var parserValid = ctrl.$error[parserName] ? false : undefined; var prevValid = ctrl.$valid; var prevModelValue = ctrl.$modelValue; var allowInvalid = ctrl.$options && ctrl.$options.allowInvalid; ctrl.$$runValidators(parserValid, modelValue, viewValue, function(allValid) { // If there was no change in validity, don't update the model // This prevents changing an invalid modelValue to undefined if (!allowInvalid && prevValid !== allValid) { // Note: Don't check ctrl.$valid here, as we could have // external validators (e.g. calculated on the server), // that just call $setValidity and need the model value // to calculate their validity. ctrl.$modelValue = allValid ? modelValue : undefined; if (ctrl.$modelValue !== prevModelValue) { ctrl.$$writeModelToScope(); } } }); }; this.$$runValidators = function(parseValid, modelValue, viewValue, doneCallback) { currentValidationRunId++; var localValidationRunId = currentValidationRunId; // check parser error if (!processParseErrors(parseValid)) { validationDone(false); return; } if (!processSyncValidators()) { validationDone(false); return; } processAsyncValidators(); function processParseErrors(parseValid) { var errorKey = ctrl.$$parserName || 'parse'; if (parseValid === undefined) { setValidity(errorKey, null); } else { setValidity(errorKey, parseValid); if (!parseValid) { forEach(ctrl.$validators, function(v, name) { setValidity(name, null); }); forEach(ctrl.$asyncValidators, function(v, name) { setValidity(name, null); }); return false; } } return true; } function processSyncValidators() { var syncValidatorsValid = true; forEach(ctrl.$validators, function(validator, name) { var result = validator(modelValue, viewValue); syncValidatorsValid = syncValidatorsValid && result; setValidity(name, result); }); if (!syncValidatorsValid) { forEach(ctrl.$asyncValidators, function(v, name) { setValidity(name, null); }); return false; } return true; } function processAsyncValidators() { var validatorPromises = []; var allValid = true; forEach(ctrl.$asyncValidators, function(validator, name) { var promise = validator(modelValue, viewValue); if (!isPromiseLike(promise)) { throw $ngModelMinErr("$asyncValidators", "Expected asynchronous validator to return a promise but got '{0}' instead.", promise); } setValidity(name, undefined); validatorPromises.push(promise.then(function() { setValidity(name, true); }, function(error) { allValid = false; setValidity(name, false); })); }); if (!validatorPromises.length) { validationDone(true); } else { $q.all(validatorPromises).then(function() { validationDone(allValid); }, noop); } } function setValidity(name, isValid) { if (localValidationRunId === currentValidationRunId) { ctrl.$setValidity(name, isValid); } } function validationDone(allValid) { if (localValidationRunId === currentValidationRunId) { doneCallback(allValid); } } }; /** * @ngdoc method * @name ngModel.NgModelController#$commitViewValue * * @description * Commit a pending update to the `$modelValue`. * * Updates may be pending by a debounced event or because the input is waiting for a some future * event defined in `ng-model-options`. this method is rarely needed as `NgModelController` * usually handles calling this in response to input events. */ this.$commitViewValue = function() { var viewValue = ctrl.$viewValue; $timeout.cancel(pendingDebounce); // If the view value has not changed then we should just exit, except in the case where there is // a native validator on the element. In this case the validation state may have changed even though // the viewValue has stayed empty. if (ctrl.$$lastCommittedViewValue === viewValue && (viewValue !== '' || !ctrl.$$hasNativeValidators)) { return; } ctrl.$$lastCommittedViewValue = viewValue; // change to dirty if (ctrl.$pristine) { this.$setDirty(); } this.$$parseAndValidate(); }; this.$$parseAndValidate = function() { var viewValue = ctrl.$$lastCommittedViewValue; var modelValue = viewValue; var parserValid = isUndefined(modelValue) ? undefined : true; if (parserValid) { for (var i = 0; i < ctrl.$parsers.length; i++) { modelValue = ctrl.$parsers[i](modelValue); if (isUndefined(modelValue)) { parserValid = false; break; } } } if (isNumber(ctrl.$modelValue) && isNaN(ctrl.$modelValue)) { // ctrl.$modelValue has not been touched yet... ctrl.$modelValue = ngModelGet($scope); } var prevModelValue = ctrl.$modelValue; var allowInvalid = ctrl.$options && ctrl.$options.allowInvalid; ctrl.$$rawModelValue = modelValue; if (allowInvalid) { ctrl.$modelValue = modelValue; writeToModelIfNeeded(); } // Pass the $$lastCommittedViewValue here, because the cached viewValue might be out of date. // This can happen if e.g. $setViewValue is called from inside a parser ctrl.$$runValidators(parserValid, modelValue, ctrl.$$lastCommittedViewValue, function(allValid) { if (!allowInvalid) { // Note: Don't check ctrl.$valid here, as we could have // external validators (e.g. calculated on the server), // that just call $setValidity and need the model value // to calculate their validity. ctrl.$modelValue = allValid ? modelValue : undefined; writeToModelIfNeeded(); } }); function writeToModelIfNeeded() { if (ctrl.$modelValue !== prevModelValue) { ctrl.$$writeModelToScope(); } } }; this.$$writeModelToScope = function() { ngModelSet($scope, ctrl.$modelValue); forEach(ctrl.$viewChangeListeners, function(listener) { try { listener(); } catch (e) { $exceptionHandler(e); } }); }; /** * @ngdoc method * @name ngModel.NgModelController#$setViewValue * * @description * Update the view value. * * This method should be called when an input directive want to change the view value; typically, * this is done from within a DOM event handler. * * For example {@link ng.directive:input input} calls it when the value of the input changes and * {@link ng.directive:select select} calls it when an option is selected. * * If the new `value` is an object (rather than a string or a number), we should make a copy of the * object before passing it to `$setViewValue`. This is because `ngModel` does not perform a deep * watch of objects, it only looks for a change of identity. If you only change the property of * the object then ngModel will not realise that the object has changed and will not invoke the * `$parsers` and `$validators` pipelines. * * For this reason, you should not change properties of the copy once it has been passed to * `$setViewValue`. Otherwise you may cause the model value on the scope to change incorrectly. * * When this method is called, the new `value` will be staged for committing through the `$parsers` * and `$validators` pipelines. If there are no special {@link ngModelOptions} specified then the staged * value sent directly for processing, finally to be applied to `$modelValue` and then the * **expression** specified in the `ng-model` attribute. * * Lastly, all the registered change listeners, in the `$viewChangeListeners` list, are called. * * In case the {@link ng.directive:ngModelOptions ngModelOptions} directive is used with `updateOn` * and the `default` trigger is not listed, all those actions will remain pending until one of the * `updateOn` events is triggered on the DOM element. * All these actions will be debounced if the {@link ng.directive:ngModelOptions ngModelOptions} * directive is used with a custom debounce for this particular event. * * Note that calling this function does not trigger a `$digest`. * * @param {string} value Value from the view. * @param {string} trigger Event that triggered the update. */ this.$setViewValue = function(value, trigger) { ctrl.$viewValue = value; if (!ctrl.$options || ctrl.$options.updateOnDefault) { ctrl.$$debounceViewValueCommit(trigger); } }; this.$$debounceViewValueCommit = function(trigger) { var debounceDelay = 0, options = ctrl.$options, debounce; if (options && isDefined(options.debounce)) { debounce = options.debounce; if (isNumber(debounce)) { debounceDelay = debounce; } else if (isNumber(debounce[trigger])) { debounceDelay = debounce[trigger]; } else if (isNumber(debounce['default'])) { debounceDelay = debounce['default']; } } $timeout.cancel(pendingDebounce); if (debounceDelay) { pendingDebounce = $timeout(function() { ctrl.$commitViewValue(); }, debounceDelay); } else if ($rootScope.$$phase) { ctrl.$commitViewValue(); } else { $scope.$apply(function() { ctrl.$commitViewValue(); }); } }; // model -> value // Note: we cannot use a normal scope.$watch as we want to detect the following: // 1. scope value is 'a' // 2. user enters 'b' // 3. ng-change kicks in and reverts scope value to 'a' // -> scope value did not change since the last digest as // ng-change executes in apply phase // 4. view should be changed back to 'a' $scope.$watch(function ngModelWatch() { var modelValue = ngModelGet($scope); // if scope model value and ngModel value are out of sync // TODO(perf): why not move this to the action fn? if (modelValue !== ctrl.$modelValue) { ctrl.$modelValue = ctrl.$$rawModelValue = modelValue; var formatters = ctrl.$formatters, idx = formatters.length; var viewValue = modelValue; while (idx--) { viewValue = formatters[idx](viewValue); } if (ctrl.$viewValue !== viewValue) { ctrl.$viewValue = ctrl.$$lastCommittedViewValue = viewValue; ctrl.$render(); ctrl.$$runValidators(undefined, modelValue, viewValue, noop); } } return modelValue; }); }]; /** * @ngdoc directive * @name ngModel * * @element input * @priority 1 * * @description * The `ngModel` directive binds an `input`,`select`, `textarea` (or custom form control) to a * property on the scope using {@link ngModel.NgModelController NgModelController}, * which is created and exposed by this directive. * * `ngModel` is responsible for: * * - Binding the view into the model, which other directives such as `input`, `textarea` or `select` * require. * - Providing validation behavior (i.e. required, number, email, url). * - Keeping the state of the control (valid/invalid, dirty/pristine, touched/untouched, validation errors). * - Setting related css classes on the element (`ng-valid`, `ng-invalid`, `ng-dirty`, `ng-pristine`, `ng-touched`, `ng-untouched`) including animations. * - Registering the control with its parent {@link ng.directive:form form}. * * Note: `ngModel` will try to bind to the property given by evaluating the expression on the * current scope. If the property doesn't already exist on this scope, it will be created * implicitly and added to the scope. * * For best practices on using `ngModel`, see: * * - [Understanding Scopes](https://github.com/angular/angular.js/wiki/Understanding-Scopes) * * For basic examples, how to use `ngModel`, see: * * - {@link ng.directive:input input} * - {@link input[text] text} * - {@link input[checkbox] checkbox} * - {@link input[radio] radio} * - {@link input[number] number} * - {@link input[email] email} * - {@link input[url] url} * - {@link input[date] date} * - {@link input[datetime-local] datetime-local} * - {@link input[time] time} * - {@link input[month] month} * - {@link input[week] week} * - {@link ng.directive:select select} * - {@link ng.directive:textarea textarea} * * # CSS classes * The following CSS classes are added and removed on the associated input/select/textarea element * depending on the validity of the model. * * - `ng-valid`: the model is valid * - `ng-invalid`: the model is invalid * - `ng-valid-[key]`: for each valid key added by `$setValidity` * - `ng-invalid-[key]`: for each invalid key added by `$setValidity` * - `ng-pristine`: the control hasn't been interacted with yet * - `ng-dirty`: the control has been interacted with * - `ng-touched`: the control has been blurred * - `ng-untouched`: the control hasn't been blurred * - `ng-pending`: any `$asyncValidators` are unfulfilled * * Keep in mind that ngAnimate can detect each of these classes when added and removed. * * ## Animation Hooks * * Animations within models are triggered when any of the associated CSS classes are added and removed * on the input element which is attached to the model. These classes are: `.ng-pristine`, `.ng-dirty`, * `.ng-invalid` and `.ng-valid` as well as any other validations that are performed on the model itself. * The animations that are triggered within ngModel are similar to how they work in ngClass and * animations can be hooked into using CSS transitions, keyframes as well as JS animations. * * The following example shows a simple way to utilize CSS transitions to style an input element * that has been rendered as invalid after it has been validated: * * <pre> * //be sure to include ngAnimate as a module to hook into more * //advanced animations * .my-input { * transition:0.5s linear all; * background: white; * } * .my-input.ng-invalid { * background: red; * color:white; * } * </pre> * * @example * <example deps="angular-animate.js" animations="true" fixBase="true" module="inputExample"> <file name="index.html"> <script> angular.module('inputExample', []) .controller('ExampleController', ['$scope', function($scope) { $scope.val = '1'; }]); </script> <style> .my-input { -webkit-transition:all linear 0.5s; transition:all linear 0.5s; background: transparent; } .my-input.ng-invalid { color:white; background: red; } </style> Update input to see transitions when valid/invalid. Integer is a valid value. <form name="testForm" ng-controller="ExampleController"> <input ng-model="val" ng-pattern="/^\d+$/" name="anim" class="my-input" /> </form> </file> * </example> * * ## Binding to a getter/setter * * Sometimes it's helpful to bind `ngModel` to a getter/setter function. A getter/setter is a * function that returns a representation of the model when called with zero arguments, and sets * the internal state of a model when called with an argument. It's sometimes useful to use this * for models that have an internal representation that's different than what the model exposes * to the view. * * <div class="alert alert-success"> * **Best Practice:** It's best to keep getters fast because Angular is likely to call them more * frequently than other parts of your code. * </div> * * You use this behavior by adding `ng-model-options="{ getterSetter: true }"` to an element that * has `ng-model` attached to it. You can also add `ng-model-options="{ getterSetter: true }"` to * a `<form>`, which will enable this behavior for all `<input>`s within it. See * {@link ng.directive:ngModelOptions `ngModelOptions`} for more. * * The following example shows how to use `ngModel` with a getter/setter: * * @example * <example name="ngModel-getter-setter" module="getterSetterExample"> <file name="index.html"> <div ng-controller="ExampleController"> <form name="userForm"> Name: <input type="text" name="userName" ng-model="user.name" ng-model-options="{ getterSetter: true }" /> </form> <pre>user.name = <span ng-bind="user.name()"></span></pre> </div> </file> <file name="app.js"> angular.module('getterSetterExample', []) .controller('ExampleController', ['$scope', function($scope) { var _name = 'Brian'; $scope.user = { name: function(newName) { if (angular.isDefined(newName)) { _name = newName; } return _name; } }; }]); </file> * </example> */ var ngModelDirective = ['$rootScope', function($rootScope) { return { restrict: 'A', require: ['ngModel', '^?form', '^?ngModelOptions'], controller: NgModelController, // Prelink needs to run before any input directive // so that we can set the NgModelOptions in NgModelController // before anyone else uses it. priority: 1, compile: function ngModelCompile(element) { // Setup initial state of the control element.addClass(PRISTINE_CLASS).addClass(UNTOUCHED_CLASS).addClass(VALID_CLASS); return { pre: function ngModelPreLink(scope, element, attr, ctrls) { var modelCtrl = ctrls[0], formCtrl = ctrls[1] || nullFormCtrl; modelCtrl.$$setOptions(ctrls[2] && ctrls[2].$options); // notify others, especially parent forms formCtrl.$addControl(modelCtrl); attr.$observe('name', function(newValue) { if (modelCtrl.$name !== newValue) { formCtrl.$$renameControl(modelCtrl, newValue); } }); scope.$on('$destroy', function() { formCtrl.$removeControl(modelCtrl); }); }, post: function ngModelPostLink(scope, element, attr, ctrls) { var modelCtrl = ctrls[0]; if (modelCtrl.$options && modelCtrl.$options.updateOn) { element.on(modelCtrl.$options.updateOn, function(ev) { modelCtrl.$$debounceViewValueCommit(ev && ev.type); }); } element.on('blur', function(ev) { if (modelCtrl.$touched) return; if ($rootScope.$$phase) { scope.$evalAsync(modelCtrl.$setTouched); } else { scope.$apply(modelCtrl.$setTouched); } }); } }; } }; }]; var DEFAULT_REGEXP = /(\s+|^)default(\s+|$)/; /** * @ngdoc directive * @name ngModelOptions * * @description * Allows tuning how model updates are done. Using `ngModelOptions` you can specify a custom list of * events that will trigger a model update and/or a debouncing delay so that the actual update only * takes place when a timer expires; this timer will be reset after another change takes place. * * Given the nature of `ngModelOptions`, the value displayed inside input fields in the view might * be different than the value in the actual model. This means that if you update the model you * should also invoke {@link ngModel.NgModelController `$rollbackViewValue`} on the relevant input field in * order to make sure it is synchronized with the model and that any debounced action is canceled. * * The easiest way to reference the control's {@link ngModel.NgModelController `$rollbackViewValue`} * method is by making sure the input is placed inside a form that has a `name` attribute. This is * important because `form` controllers are published to the related scope under the name in their * `name` attribute. * * Any pending changes will take place immediately when an enclosing form is submitted via the * `submit` event. Note that `ngClick` events will occur before the model is updated. Use `ngSubmit` * to have access to the updated model. * * `ngModelOptions` has an effect on the element it's declared on and its descendants. * * @param {Object} ngModelOptions options to apply to the current model. Valid keys are: * - `updateOn`: string specifying which event should the input be bound to. You can set several * events using an space delimited list. There is a special event called `default` that * matches the default events belonging of the control. * - `debounce`: integer value which contains the debounce model update value in milliseconds. A * value of 0 triggers an immediate update. If an object is supplied instead, you can specify a * custom value for each event. For example: * `ng-model-options="{ updateOn: 'default blur', debounce: {'default': 500, 'blur': 0} }"` * - `allowInvalid`: boolean value which indicates that the model can be set with values that did * not validate correctly instead of the default behavior of setting the model to undefined. * - `getterSetter`: boolean value which determines whether or not to treat functions bound to `ngModel` as getters/setters. * - `timezone`: Defines the timezone to be used to read/write the `Date` instance in the model for * `<input type="date">`, `<input type="time">`, ... . Right now, the only supported value is `'UTC'`, * otherwise the default timezone of the browser will be used. * * @example The following example shows how to override immediate updates. Changes on the inputs within the form will update the model only when the control loses focus (blur event). If `escape` key is pressed while the input field is focused, the value is reset to the value in the current model. <example name="ngModelOptions-directive-blur" module="optionsExample"> <file name="index.html"> <div ng-controller="ExampleController"> <form name="userForm"> Name: <input type="text" name="userName" ng-model="user.name" ng-model-options="{ updateOn: 'blur' }" ng-keyup="cancel($event)" /><br /> Other data: <input type="text" ng-model="user.data" /><br /> </form> <pre>user.name = <span ng-bind="user.name"></span></pre> </div> </file> <file name="app.js"> angular.module('optionsExample', []) .controller('ExampleController', ['$scope', function($scope) { $scope.user = { name: 'say', data: '' }; $scope.cancel = function(e) { if (e.keyCode == 27) { $scope.userForm.userName.$rollbackViewValue(); } }; }]); </file> <file name="protractor.js" type="protractor"> var model = element(by.binding('user.name')); var input = element(by.model('user.name')); var other = element(by.model('user.data')); it('should allow custom events', function() { input.sendKeys(' hello'); input.click(); expect(model.getText()).toEqual('say'); other.click(); expect(model.getText()).toEqual('say hello'); }); it('should $rollbackViewValue when model changes', function() { input.sendKeys(' hello'); expect(input.getAttribute('value')).toEqual('say hello'); input.sendKeys(protractor.Key.ESCAPE); expect(input.getAttribute('value')).toEqual('say'); other.click(); expect(model.getText()).toEqual('say'); }); </file> </example> This one shows how to debounce model changes. Model will be updated only 1 sec after last change. If the `Clear` button is pressed, any debounced action is canceled and the value becomes empty. <example name="ngModelOptions-directive-debounce" module="optionsExample"> <file name="index.html"> <div ng-controller="ExampleController"> <form name="userForm"> Name: <input type="text" name="userName" ng-model="user.name" ng-model-options="{ debounce: 1000 }" /> <button ng-click="userForm.userName.$rollbackViewValue(); user.name=''">Clear</button><br /> </form> <pre>user.name = <span ng-bind="user.name"></span></pre> </div> </file> <file name="app.js"> angular.module('optionsExample', []) .controller('ExampleController', ['$scope', function($scope) { $scope.user = { name: 'say' }; }]); </file> </example> This one shows how to bind to getter/setters: <example name="ngModelOptions-directive-getter-setter" module="getterSetterExample"> <file name="index.html"> <div ng-controller="ExampleController"> <form name="userForm"> Name: <input type="text" name="userName" ng-model="user.name" ng-model-options="{ getterSetter: true }" /> </form> <pre>user.name = <span ng-bind="user.name()"></span></pre> </div> </file> <file name="app.js"> angular.module('getterSetterExample', []) .controller('ExampleController', ['$scope', function($scope) { var _name = 'Brian'; $scope.user = { name: function(newName) { return angular.isDefined(newName) ? (_name = newName) : _name; } }; }]); </file> </example> */ var ngModelOptionsDirective = function() { return { restrict: 'A', controller: ['$scope', '$attrs', function($scope, $attrs) { var that = this; this.$options = $scope.$eval($attrs.ngModelOptions); // Allow adding/overriding bound events if (this.$options.updateOn !== undefined) { this.$options.updateOnDefault = false; // extract "default" pseudo-event from list of events that can trigger a model update this.$options.updateOn = trim(this.$options.updateOn.replace(DEFAULT_REGEXP, function() { that.$options.updateOnDefault = true; return ' '; })); } else { this.$options.updateOnDefault = true; } }] }; }; // helper methods function addSetValidityMethod(context) { var ctrl = context.ctrl, $element = context.$element, classCache = {}, set = context.set, unset = context.unset, parentForm = context.parentForm, $animate = context.$animate; classCache[INVALID_CLASS] = !(classCache[VALID_CLASS] = $element.hasClass(VALID_CLASS)); ctrl.$setValidity = setValidity; function setValidity(validationErrorKey, state, controller) { if (state === undefined) { createAndSet('$pending', validationErrorKey, controller); } else { unsetAndCleanup('$pending', validationErrorKey, controller); } if (!isBoolean(state)) { unset(ctrl.$error, validationErrorKey, controller); unset(ctrl.$$success, validationErrorKey, controller); } else { if (state) { unset(ctrl.$error, validationErrorKey, controller); set(ctrl.$$success, validationErrorKey, controller); } else { set(ctrl.$error, validationErrorKey, controller); unset(ctrl.$$success, validationErrorKey, controller); } } if (ctrl.$pending) { cachedToggleClass(PENDING_CLASS, true); ctrl.$valid = ctrl.$invalid = undefined; toggleValidationCss('', null); } else { cachedToggleClass(PENDING_CLASS, false); ctrl.$valid = isObjectEmpty(ctrl.$error); ctrl.$invalid = !ctrl.$valid; toggleValidationCss('', ctrl.$valid); } // re-read the state as the set/unset methods could have // combined state in ctrl.$error[validationError] (used for forms), // where setting/unsetting only increments/decrements the value, // and does not replace it. var combinedState; if (ctrl.$pending && ctrl.$pending[validationErrorKey]) { combinedState = undefined; } else if (ctrl.$error[validationErrorKey]) { combinedState = false; } else if (ctrl.$$success[validationErrorKey]) { combinedState = true; } else { combinedState = null; } toggleValidationCss(validationErrorKey, combinedState); parentForm.$setValidity(validationErrorKey, combinedState, ctrl); } function createAndSet(name, value, controller) { if (!ctrl[name]) { ctrl[name] = {}; } set(ctrl[name], value, controller); } function unsetAndCleanup(name, value, controller) { if (ctrl[name]) { unset(ctrl[name], value, controller); } if (isObjectEmpty(ctrl[name])) { ctrl[name] = undefined; } } function cachedToggleClass(className, switchValue) { if (switchValue && !classCache[className]) { $animate.addClass($element, className); classCache[className] = true; } else if (!switchValue && classCache[className]) { $animate.removeClass($element, className); classCache[className] = false; } } function toggleValidationCss(validationErrorKey, isValid) { validationErrorKey = validationErrorKey ? '-' + snake_case(validationErrorKey, '-') : ''; cachedToggleClass(VALID_CLASS + validationErrorKey, isValid === true); cachedToggleClass(INVALID_CLASS + validationErrorKey, isValid === false); } } function isObjectEmpty(obj) { if (obj) { for (var prop in obj) { return false; } } return true; } /** * @ngdoc directive * @name ngNonBindable * @restrict AC * @priority 1000 * * @description * The `ngNonBindable` directive tells Angular not to compile or bind the contents of the current * DOM element. This is useful if the element contains what appears to be Angular directives and * bindings but which should be ignored by Angular. This could be the case if you have a site that * displays snippets of code, for instance. * * @element ANY * * @example * In this example there are two locations where a simple interpolation binding (`{{}}`) is present, * but the one wrapped in `ngNonBindable` is left alone. * * @example <example> <file name="index.html"> <div>Normal: {{1 + 2}}</div> <div ng-non-bindable>Ignored: {{1 + 2}}</div> </file> <file name="protractor.js" type="protractor"> it('should check ng-non-bindable', function() { expect(element(by.binding('1 + 2')).getText()).toContain('3'); expect(element.all(by.css('div')).last().getText()).toMatch(/1 \+ 2/); }); </file> </example> */ var ngNonBindableDirective = ngDirective({ terminal: true, priority: 1000 }); /** * @ngdoc directive * @name ngPluralize * @restrict EA * * @description * `ngPluralize` is a directive that displays messages according to en-US localization rules. * These rules are bundled with angular.js, but can be overridden * (see {@link guide/i18n Angular i18n} dev guide). You configure ngPluralize directive * by specifying the mappings between * [plural categories](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html) * and the strings to be displayed. * * # Plural categories and explicit number rules * There are two * [plural categories](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html) * in Angular's default en-US locale: "one" and "other". * * While a plural category may match many numbers (for example, in en-US locale, "other" can match * any number that is not 1), an explicit number rule can only match one number. For example, the * explicit number rule for "3" matches the number 3. There are examples of plural categories * and explicit number rules throughout the rest of this documentation. * * # Configuring ngPluralize * You configure ngPluralize by providing 2 attributes: `count` and `when`. * You can also provide an optional attribute, `offset`. * * The value of the `count` attribute can be either a string or an {@link guide/expression * Angular expression}; these are evaluated on the current scope for its bound value. * * The `when` attribute specifies the mappings between plural categories and the actual * string to be displayed. The value of the attribute should be a JSON object. * * The following example shows how to configure ngPluralize: * * ```html * <ng-pluralize count="personCount" when="{'0': 'Nobody is viewing.', * 'one': '1 person is viewing.', * 'other': '{} people are viewing.'}"> * </ng-pluralize> *``` * * In the example, `"0: Nobody is viewing."` is an explicit number rule. If you did not * specify this rule, 0 would be matched to the "other" category and "0 people are viewing" * would be shown instead of "Nobody is viewing". You can specify an explicit number rule for * other numbers, for example 12, so that instead of showing "12 people are viewing", you can * show "a dozen people are viewing". * * You can use a set of closed braces (`{}`) as a placeholder for the number that you want substituted * into pluralized strings. In the previous example, Angular will replace `{}` with * <span ng-non-bindable>`{{personCount}}`</span>. The closed braces `{}` is a placeholder * for <span ng-non-bindable>{{numberExpression}}</span>. * * # Configuring ngPluralize with offset * The `offset` attribute allows further customization of pluralized text, which can result in * a better user experience. For example, instead of the message "4 people are viewing this document", * you might display "John, Kate and 2 others are viewing this document". * The offset attribute allows you to offset a number by any desired value. * Let's take a look at an example: * * ```html * <ng-pluralize count="personCount" offset=2 * when="{'0': 'Nobody is viewing.', * '1': '{{person1}} is viewing.', * '2': '{{person1}} and {{person2}} are viewing.', * 'one': '{{person1}}, {{person2}} and one other person are viewing.', * 'other': '{{person1}}, {{person2}} and {} other people are viewing.'}"> * </ng-pluralize> * ``` * * Notice that we are still using two plural categories(one, other), but we added * three explicit number rules 0, 1 and 2. * When one person, perhaps John, views the document, "John is viewing" will be shown. * When three people view the document, no explicit number rule is found, so * an offset of 2 is taken off 3, and Angular uses 1 to decide the plural category. * In this case, plural category 'one' is matched and "John, Mary and one other person are viewing" * is shown. * * Note that when you specify offsets, you must provide explicit number rules for * numbers from 0 up to and including the offset. If you use an offset of 3, for example, * you must provide explicit number rules for 0, 1, 2 and 3. You must also provide plural strings for * plural categories "one" and "other". * * @param {string|expression} count The variable to be bound to. * @param {string} when The mapping between plural category to its corresponding strings. * @param {number=} offset Offset to deduct from the total number. * * @example <example module="pluralizeExample"> <file name="index.html"> <script> angular.module('pluralizeExample', []) .controller('ExampleController', ['$scope', function($scope) { $scope.person1 = 'Igor'; $scope.person2 = 'Misko'; $scope.personCount = 1; }]); </script> <div ng-controller="ExampleController"> Person 1:<input type="text" ng-model="person1" value="Igor" /><br/> Person 2:<input type="text" ng-model="person2" value="Misko" /><br/> Number of People:<input type="text" ng-model="personCount" value="1" /><br/> <!--- Example with simple pluralization rules for en locale ---> Without Offset: <ng-pluralize count="personCount" when="{'0': 'Nobody is viewing.', 'one': '1 person is viewing.', 'other': '{} people are viewing.'}"> </ng-pluralize><br> <!--- Example with offset ---> With Offset(2): <ng-pluralize count="personCount" offset=2 when="{'0': 'Nobody is viewing.', '1': '{{person1}} is viewing.', '2': '{{person1}} and {{person2}} are viewing.', 'one': '{{person1}}, {{person2}} and one other person are viewing.', 'other': '{{person1}}, {{person2}} and {} other people are viewing.'}"> </ng-pluralize> </div> </file> <file name="protractor.js" type="protractor"> it('should show correct pluralized string', function() { var withoutOffset = element.all(by.css('ng-pluralize')).get(0); var withOffset = element.all(by.css('ng-pluralize')).get(1); var countInput = element(by.model('personCount')); expect(withoutOffset.getText()).toEqual('1 person is viewing.'); expect(withOffset.getText()).toEqual('Igor is viewing.'); countInput.clear(); countInput.sendKeys('0'); expect(withoutOffset.getText()).toEqual('Nobody is viewing.'); expect(withOffset.getText()).toEqual('Nobody is viewing.'); countInput.clear(); countInput.sendKeys('2'); expect(withoutOffset.getText()).toEqual('2 people are viewing.'); expect(withOffset.getText()).toEqual('Igor and Misko are viewing.'); countInput.clear(); countInput.sendKeys('3'); expect(withoutOffset.getText()).toEqual('3 people are viewing.'); expect(withOffset.getText()).toEqual('Igor, Misko and one other person are viewing.'); countInput.clear(); countInput.sendKeys('4'); expect(withoutOffset.getText()).toEqual('4 people are viewing.'); expect(withOffset.getText()).toEqual('Igor, Misko and 2 other people are viewing.'); }); it('should show data-bound names', function() { var withOffset = element.all(by.css('ng-pluralize')).get(1); var personCount = element(by.model('personCount')); var person1 = element(by.model('person1')); var person2 = element(by.model('person2')); personCount.clear(); personCount.sendKeys('4'); person1.clear(); person1.sendKeys('Di'); person2.clear(); person2.sendKeys('Vojta'); expect(withOffset.getText()).toEqual('Di, Vojta and 2 other people are viewing.'); }); </file> </example> */ var ngPluralizeDirective = ['$locale', '$interpolate', function($locale, $interpolate) { var BRACE = /{}/g, IS_WHEN = /^when(Minus)?(.+)$/; return { restrict: 'EA', link: function(scope, element, attr) { var numberExp = attr.count, whenExp = attr.$attr.when && element.attr(attr.$attr.when), // we have {{}} in attrs offset = attr.offset || 0, whens = scope.$eval(whenExp) || {}, whensExpFns = {}, startSymbol = $interpolate.startSymbol(), endSymbol = $interpolate.endSymbol(), braceReplacement = startSymbol + numberExp + '-' + offset + endSymbol, watchRemover = angular.noop, lastCount; forEach(attr, function(expression, attributeName) { var tmpMatch = IS_WHEN.exec(attributeName); if (tmpMatch) { var whenKey = (tmpMatch[1] ? '-' : '') + lowercase(tmpMatch[2]); whens[whenKey] = element.attr(attr.$attr[attributeName]); } }); forEach(whens, function(expression, key) { whensExpFns[key] = $interpolate(expression.replace(BRACE, braceReplacement)); }); scope.$watch(numberExp, function ngPluralizeWatchAction(newVal) { var count = parseFloat(newVal); var countIsNaN = isNaN(count); if (!countIsNaN && !(count in whens)) { // If an explicit number rule such as 1, 2, 3... is defined, just use it. // Otherwise, check it against pluralization rules in $locale service. count = $locale.pluralCat(count - offset); } // If both `count` and `lastCount` are NaN, we don't need to re-register a watch. // In JS `NaN !== NaN`, so we have to exlicitly check. if ((count !== lastCount) && !(countIsNaN && isNaN(lastCount))) { watchRemover(); watchRemover = scope.$watch(whensExpFns[count], updateElementText); lastCount = count; } }); function updateElementText(newText) { element.text(newText || ''); } } }; }]; /** * @ngdoc directive * @name ngRepeat * * @description * The `ngRepeat` directive instantiates a template once per item from a collection. Each template * instance gets its own scope, where the given loop variable is set to the current collection item, * and `$index` is set to the item index or key. * * Special properties are exposed on the local scope of each template instance, including: * * | Variable | Type | Details | * |-----------|-----------------|-----------------------------------------------------------------------------| * | `$index` | {@type number} | iterator offset of the repeated element (0..length-1) | * | `$first` | {@type boolean} | true if the repeated element is first in the iterator. | * | `$middle` | {@type boolean} | true if the repeated element is between the first and last in the iterator. | * | `$last` | {@type boolean} | true if the repeated element is last in the iterator. | * | `$even` | {@type boolean} | true if the iterator position `$index` is even (otherwise false). | * | `$odd` | {@type boolean} | true if the iterator position `$index` is odd (otherwise false). | * * Creating aliases for these properties is possible with {@link ng.directive:ngInit `ngInit`}. * This may be useful when, for instance, nesting ngRepeats. * * # Iterating over object properties * * It is possible to get `ngRepeat` to iterate over the properties of an object using the following * syntax: * * ```js * <div ng-repeat="(key, value) in myObj"> ... </div> * ``` * * You need to be aware that the JavaScript specification does not define what order * it will return the keys for an object. In order to have a guaranteed deterministic order * for the keys, Angular versions up to and including 1.3 **sort the keys alphabetically**. * * If this is not desired, the recommended workaround is to convert your object into an array * that is sorted into the order that you prefer before providing it to `ngRepeat`. You could * do this with a filter such as [toArrayFilter](http://ngmodules.org/modules/angular-toArrayFilter) * or implement a `$watch` on the object yourself. * * In version 1.4 we will remove the sorting, since it seems that browsers generally follow the * strategy of providing keys in the order in which they were defined, although there are exceptions * when keys are deleted and reinstated. * * * # Special repeat start and end points * To repeat a series of elements instead of just one parent element, ngRepeat (as well as other ng directives) supports extending * the range of the repeater by defining explicit start and end points by using **ng-repeat-start** and **ng-repeat-end** respectively. * The **ng-repeat-start** directive works the same as **ng-repeat**, but will repeat all the HTML code (including the tag it's defined on) * up to and including the ending HTML tag where **ng-repeat-end** is placed. * * The example below makes use of this feature: * ```html * <header ng-repeat-start="item in items"> * Header {{ item }} * </header> * <div class="body"> * Body {{ item }} * </div> * <footer ng-repeat-end> * Footer {{ item }} * </footer> * ``` * * And with an input of {@type ['A','B']} for the items variable in the example above, the output will evaluate to: * ```html * <header> * Header A * </header> * <div class="body"> * Body A * </div> * <footer> * Footer A * </footer> * <header> * Header B * </header> * <div class="body"> * Body B * </div> * <footer> * Footer B * </footer> * ``` * * The custom start and end points for ngRepeat also support all other HTML directive syntax flavors provided in AngularJS (such * as **data-ng-repeat-start**, **x-ng-repeat-start** and **ng:repeat-start**). * * @animations * **.enter** - when a new item is added to the list or when an item is revealed after a filter * * **.leave** - when an item is removed from the list or when an item is filtered out * * **.move** - when an adjacent item is filtered out causing a reorder or when the item contents are reordered * * @element ANY * @scope * @priority 1000 * @param {repeat_expression} ngRepeat The expression indicating how to enumerate a collection. These * formats are currently supported: * * * `variable in expression` – where variable is the user defined loop variable and `expression` * is a scope expression giving the collection to enumerate. * * For example: `album in artist.albums`. * * * `(key, value) in expression` – where `key` and `value` can be any user defined identifiers, * and `expression` is the scope expression giving the collection to enumerate. * * For example: `(name, age) in {'adam':10, 'amalie':12}`. * * * `variable in expression track by tracking_expression` – You can also provide an optional tracking function * which can be used to associate the objects in the collection with the DOM elements. If no tracking function * is specified the ng-repeat associates elements by identity in the collection. It is an error to have * more than one tracking function to resolve to the same key. (This would mean that two distinct objects are * mapped to the same DOM element, which is not possible.) Filters should be applied to the expression, * before specifying a tracking expression. * * For example: `item in items` is equivalent to `item in items track by $id(item)`. This implies that the DOM elements * will be associated by item identity in the array. * * For example: `item in items track by $id(item)`. A built in `$id()` function can be used to assign a unique * `$$hashKey` property to each item in the array. This property is then used as a key to associated DOM elements * with the corresponding item in the array by identity. Moving the same object in array would move the DOM * element in the same way in the DOM. * * For example: `item in items track by item.id` is a typical pattern when the items come from the database. In this * case the object identity does not matter. Two objects are considered equivalent as long as their `id` * property is same. * * For example: `item in items | filter:searchText track by item.id` is a pattern that might be used to apply a filter * to items in conjunction with a tracking expression. * * * `variable in expression as alias_expression` – You can also provide an optional alias expression which will then store the * intermediate results of the repeater after the filters have been applied. Typically this is used to render a special message * when a filter is active on the repeater, but the filtered result set is empty. * * For example: `item in items | filter:x as results` will store the fragment of the repeated items as `results`, but only after * the items have been processed through the filter. * * @example * This example initializes the scope to a list of names and * then uses `ngRepeat` to display every person: <example module="ngAnimate" deps="angular-animate.js" animations="true"> <file name="index.html"> <div ng-init="friends = [ {name:'John', age:25, gender:'boy'}, {name:'Jessie', age:30, gender:'girl'}, {name:'Johanna', age:28, gender:'girl'}, {name:'Joy', age:15, gender:'girl'}, {name:'Mary', age:28, gender:'girl'}, {name:'Peter', age:95, gender:'boy'}, {name:'Sebastian', age:50, gender:'boy'}, {name:'Erika', age:27, gender:'girl'}, {name:'Patrick', age:40, gender:'boy'}, {name:'Samantha', age:60, gender:'girl'} ]"> I have {{friends.length}} friends. They are: <input type="search" ng-model="q" placeholder="filter friends..." /> <ul class="example-animate-container"> <li class="animate-repeat" ng-repeat="friend in friends | filter:q as results"> [{{$index + 1}}] {{friend.name}} who is {{friend.age}} years old. </li> <li class="animate-repeat" ng-if="results.length == 0"> <strong>No results found...</strong> </li> </ul> </div> </file> <file name="animations.css"> .example-animate-container { background:white; border:1px solid black; list-style:none; margin:0; padding:0 10px; } .animate-repeat { line-height:40px; list-style:none; box-sizing:border-box; } .animate-repeat.ng-move, .animate-repeat.ng-enter, .animate-repeat.ng-leave { -webkit-transition:all linear 0.5s; transition:all linear 0.5s; } .animate-repeat.ng-leave.ng-leave-active, .animate-repeat.ng-move, .animate-repeat.ng-enter { opacity:0; max-height:0; } .animate-repeat.ng-leave, .animate-repeat.ng-move.ng-move-active, .animate-repeat.ng-enter.ng-enter-active { opacity:1; max-height:40px; } </file> <file name="protractor.js" type="protractor"> var friends = element.all(by.repeater('friend in friends')); it('should render initial data set', function() { expect(friends.count()).toBe(10); expect(friends.get(0).getText()).toEqual('[1] John who is 25 years old.'); expect(friends.get(1).getText()).toEqual('[2] Jessie who is 30 years old.'); expect(friends.last().getText()).toEqual('[10] Samantha who is 60 years old.'); expect(element(by.binding('friends.length')).getText()) .toMatch("I have 10 friends. They are:"); }); it('should update repeater when filter predicate changes', function() { expect(friends.count()).toBe(10); element(by.model('q')).sendKeys('ma'); expect(friends.count()).toBe(2); expect(friends.get(0).getText()).toEqual('[1] Mary who is 28 years old.'); expect(friends.last().getText()).toEqual('[2] Samantha who is 60 years old.'); }); </file> </example> */ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) { var NG_REMOVED = '$$NG_REMOVED'; var ngRepeatMinErr = minErr('ngRepeat'); var updateScope = function(scope, index, valueIdentifier, value, keyIdentifier, key, arrayLength) { // TODO(perf): generate setters to shave off ~40ms or 1-1.5% scope[valueIdentifier] = value; if (keyIdentifier) scope[keyIdentifier] = key; scope.$index = index; scope.$first = (index === 0); scope.$last = (index === (arrayLength - 1)); scope.$middle = !(scope.$first || scope.$last); // jshint bitwise: false scope.$odd = !(scope.$even = (index&1) === 0); // jshint bitwise: true }; var getBlockStart = function(block) { return block.clone[0]; }; var getBlockEnd = function(block) { return block.clone[block.clone.length - 1]; }; return { restrict: 'A', multiElement: true, transclude: 'element', priority: 1000, terminal: true, $$tlb: true, compile: function ngRepeatCompile($element, $attr) { var expression = $attr.ngRepeat; var ngRepeatEndComment = document.createComment(' end ngRepeat: ' + expression + ' '); var match = expression.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+track\s+by\s+([\s\S]+?))?\s*$/); if (!match) { throw ngRepeatMinErr('iexp', "Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'.", expression); } var lhs = match[1]; var rhs = match[2]; var aliasAs = match[3]; var trackByExp = match[4]; match = lhs.match(/^(?:(\s*[\$\w]+)|\(\s*([\$\w]+)\s*,\s*([\$\w]+)\s*\))$/); if (!match) { throw ngRepeatMinErr('iidexp', "'_item_' in '_item_ in _collection_' should be an identifier or '(_key_, _value_)' expression, but got '{0}'.", lhs); } var valueIdentifier = match[3] || match[1]; var keyIdentifier = match[2]; if (aliasAs && (!/^[$a-zA-Z_][$a-zA-Z0-9_]*$/.test(aliasAs) || /^(null|undefined|this|\$index|\$first|\$middle|\$last|\$even|\$odd|\$parent|\$root|\$id)$/.test(aliasAs))) { throw ngRepeatMinErr('badident', "alias '{0}' is invalid --- must be a valid JS identifier which is not a reserved name.", aliasAs); } var trackByExpGetter, trackByIdExpFn, trackByIdArrayFn, trackByIdObjFn; var hashFnLocals = {$id: hashKey}; if (trackByExp) { trackByExpGetter = $parse(trackByExp); } else { trackByIdArrayFn = function(key, value) { return hashKey(value); }; trackByIdObjFn = function(key) { return key; }; } return function ngRepeatLink($scope, $element, $attr, ctrl, $transclude) { if (trackByExpGetter) { trackByIdExpFn = function(key, value, index) { // assign key, value, and $index to the locals so that they can be used in hash functions if (keyIdentifier) hashFnLocals[keyIdentifier] = key; hashFnLocals[valueIdentifier] = value; hashFnLocals.$index = index; return trackByExpGetter($scope, hashFnLocals); }; } // Store a list of elements from previous run. This is a hash where key is the item from the // iterator, and the value is objects with following properties. // - scope: bound scope // - element: previous element. // - index: position // // We are using no-proto object so that we don't need to guard against inherited props via // hasOwnProperty. var lastBlockMap = createMap(); //watch props $scope.$watchCollection(rhs, function ngRepeatAction(collection) { var index, length, previousNode = $element[0], // node that cloned nodes should be inserted after // initialized to the comment node anchor nextNode, // Same as lastBlockMap but it has the current state. It will become the // lastBlockMap on the next iteration. nextBlockMap = createMap(), collectionLength, key, value, // key/value of iteration trackById, trackByIdFn, collectionKeys, block, // last object information {scope, element, id} nextBlockOrder, elementsToRemove; if (aliasAs) { $scope[aliasAs] = collection; } if (isArrayLike(collection)) { collectionKeys = collection; trackByIdFn = trackByIdExpFn || trackByIdArrayFn; } else { trackByIdFn = trackByIdExpFn || trackByIdObjFn; // if object, extract keys, sort them and use to determine order of iteration over obj props collectionKeys = []; for (var itemKey in collection) { if (collection.hasOwnProperty(itemKey) && itemKey.charAt(0) != '$') { collectionKeys.push(itemKey); } } collectionKeys.sort(); } collectionLength = collectionKeys.length; nextBlockOrder = new Array(collectionLength); // locate existing items for (index = 0; index < collectionLength; index++) { key = (collection === collectionKeys) ? index : collectionKeys[index]; value = collection[key]; trackById = trackByIdFn(key, value, index); if (lastBlockMap[trackById]) { // found previously seen block block = lastBlockMap[trackById]; delete lastBlockMap[trackById]; nextBlockMap[trackById] = block; nextBlockOrder[index] = block; } else if (nextBlockMap[trackById]) { // if collision detected. restore lastBlockMap and throw an error forEach(nextBlockOrder, function(block) { if (block && block.scope) lastBlockMap[block.id] = block; }); throw ngRepeatMinErr('dupes', "Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: {0}, Duplicate key: {1}, Duplicate value: {2}", expression, trackById, value); } else { // new never before seen block nextBlockOrder[index] = {id: trackById, scope: undefined, clone: undefined}; nextBlockMap[trackById] = true; } } // remove leftover items for (var blockKey in lastBlockMap) { block = lastBlockMap[blockKey]; elementsToRemove = getBlockNodes(block.clone); $animate.leave(elementsToRemove); if (elementsToRemove[0].parentNode) { // if the element was not removed yet because of pending animation, mark it as deleted // so that we can ignore it later for (index = 0, length = elementsToRemove.length; index < length; index++) { elementsToRemove[index][NG_REMOVED] = true; } } block.scope.$destroy(); } // we are not using forEach for perf reasons (trying to avoid #call) for (index = 0; index < collectionLength; index++) { key = (collection === collectionKeys) ? index : collectionKeys[index]; value = collection[key]; block = nextBlockOrder[index]; if (block.scope) { // if we have already seen this object, then we need to reuse the // associated scope/element nextNode = previousNode; // skip nodes that are already pending removal via leave animation do { nextNode = nextNode.nextSibling; } while (nextNode && nextNode[NG_REMOVED]); if (getBlockStart(block) != nextNode) { // existing item which got moved $animate.move(getBlockNodes(block.clone), null, jqLite(previousNode)); } previousNode = getBlockEnd(block); updateScope(block.scope, index, valueIdentifier, value, keyIdentifier, key, collectionLength); } else { // new item which we don't know about $transclude(function ngRepeatTransclude(clone, scope) { block.scope = scope; // http://jsperf.com/clone-vs-createcomment var endNode = ngRepeatEndComment.cloneNode(false); clone[clone.length++] = endNode; // TODO(perf): support naked previousNode in `enter` to avoid creation of jqLite wrapper? $animate.enter(clone, null, jqLite(previousNode)); previousNode = endNode; // Note: We only need the first/last node of the cloned nodes. // However, we need to keep the reference to the jqlite wrapper as it might be changed later // by a directive with templateUrl when its template arrives. block.clone = clone; nextBlockMap[block.id] = block; updateScope(block.scope, index, valueIdentifier, value, keyIdentifier, key, collectionLength); }); } } lastBlockMap = nextBlockMap; }); }; } }; }]; var NG_HIDE_CLASS = 'ng-hide'; var NG_HIDE_IN_PROGRESS_CLASS = 'ng-hide-animate'; /** * @ngdoc directive * @name ngShow * * @description * The `ngShow` directive shows or hides the given HTML element based on the expression * provided to the `ngShow` attribute. The element is shown or hidden by removing or adding * the `.ng-hide` CSS class onto the element. The `.ng-hide` CSS class is predefined * in AngularJS and sets the display style to none (using an !important flag). * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}). * * ```html * <!-- when $scope.myValue is truthy (element is visible) --> * <div ng-show="myValue"></div> * * <!-- when $scope.myValue is falsy (element is hidden) --> * <div ng-show="myValue" class="ng-hide"></div> * ``` * * When the `ngShow` expression evaluates to a falsy value then the `.ng-hide` CSS class is added to the class * attribute on the element causing it to become hidden. When truthy, the `.ng-hide` CSS class is removed * from the element causing the element not to appear hidden. * * ## Why is !important used? * * You may be wondering why !important is used for the `.ng-hide` CSS class. This is because the `.ng-hide` selector * can be easily overridden by heavier selectors. For example, something as simple * as changing the display style on a HTML list item would make hidden elements appear visible. * This also becomes a bigger issue when dealing with CSS frameworks. * * By using !important, the show and hide behavior will work as expected despite any clash between CSS selector * specificity (when !important isn't used with any conflicting styles). If a developer chooses to override the * styling to change how to hide an element then it is just a matter of using !important in their own CSS code. * * ### Overriding `.ng-hide` * * By default, the `.ng-hide` class will style the element with `display: none!important`. If you wish to change * the hide behavior with ngShow/ngHide then this can be achieved by restating the styles for the `.ng-hide` * class CSS. Note that the selector that needs to be used is actually `.ng-hide:not(.ng-hide-animate)` to cope * with extra animation classes that can be added. * * ```css * .ng-hide:not(.ng-hide-animate) { * /&#42; this is just another form of hiding an element &#42;/ * display: block!important; * position: absolute; * top: -9999px; * left: -9999px; * } * ``` * * By default you don't need to override in CSS anything and the animations will work around the display style. * * ## A note about animations with `ngShow` * * Animations in ngShow/ngHide work with the show and hide events that are triggered when the directive expression * is true and false. This system works like the animation system present with ngClass except that * you must also include the !important flag to override the display property * so that you can perform an animation when the element is hidden during the time of the animation. * * ```css * // * //a working example can be found at the bottom of this page * // * .my-element.ng-hide-add, .my-element.ng-hide-remove { * /&#42; this is required as of 1.3x to properly * apply all styling in a show/hide animation &#42;/ * transition: 0s linear all; * } * * .my-element.ng-hide-add-active, * .my-element.ng-hide-remove-active { * /&#42; the transition is defined in the active class &#42;/ * transition: 1s linear all; * } * * .my-element.ng-hide-add { ... } * .my-element.ng-hide-add.ng-hide-add-active { ... } * .my-element.ng-hide-remove { ... } * .my-element.ng-hide-remove.ng-hide-remove-active { ... } * ``` * * Keep in mind that, as of AngularJS version 1.3.0-beta.11, there is no need to change the display * property to block during animation states--ngAnimate will handle the style toggling automatically for you. * * @animations * addClass: `.ng-hide` - happens after the `ngShow` expression evaluates to a truthy value and the just before contents are set to visible * removeClass: `.ng-hide` - happens after the `ngShow` expression evaluates to a non truthy value and just before the contents are set to hidden * * @element ANY * @param {expression} ngShow If the {@link guide/expression expression} is truthy * then the element is shown or hidden respectively. * * @example <example module="ngAnimate" deps="angular-animate.js" animations="true"> <file name="index.html"> Click me: <input type="checkbox" ng-model="checked"><br/> <div> Show: <div class="check-element animate-show" ng-show="checked"> <span class="glyphicon glyphicon-thumbs-up"></span> I show up when your checkbox is checked. </div> </div> <div> Hide: <div class="check-element animate-show" ng-hide="checked"> <span class="glyphicon glyphicon-thumbs-down"></span> I hide when your checkbox is checked. </div> </div> </file> <file name="glyphicons.css"> @import url(../../components/bootstrap-3.1.1/css/bootstrap.css); </file> <file name="animations.css"> .animate-show { line-height: 20px; opacity: 1; padding: 10px; border: 1px solid black; background: white; } .animate-show.ng-hide-add.ng-hide-add-active, .animate-show.ng-hide-remove.ng-hide-remove-active { -webkit-transition: all linear 0.5s; transition: all linear 0.5s; } .animate-show.ng-hide { line-height: 0; opacity: 0; padding: 0 10px; } .check-element { padding: 10px; border: 1px solid black; background: white; } </file> <file name="protractor.js" type="protractor"> var thumbsUp = element(by.css('span.glyphicon-thumbs-up')); var thumbsDown = element(by.css('span.glyphicon-thumbs-down')); it('should check ng-show / ng-hide', function() { expect(thumbsUp.isDisplayed()).toBeFalsy(); expect(thumbsDown.isDisplayed()).toBeTruthy(); element(by.model('checked')).click(); expect(thumbsUp.isDisplayed()).toBeTruthy(); expect(thumbsDown.isDisplayed()).toBeFalsy(); }); </file> </example> */ var ngShowDirective = ['$animate', function($animate) { return { restrict: 'A', multiElement: true, link: function(scope, element, attr) { scope.$watch(attr.ngShow, function ngShowWatchAction(value) { // we're adding a temporary, animation-specific class for ng-hide since this way // we can control when the element is actually displayed on screen without having // to have a global/greedy CSS selector that breaks when other animations are run. // Read: https://github.com/angular/angular.js/issues/9103#issuecomment-58335845 $animate[value ? 'removeClass' : 'addClass'](element, NG_HIDE_CLASS, { tempClasses: NG_HIDE_IN_PROGRESS_CLASS }); }); } }; }]; /** * @ngdoc directive * @name ngHide * * @description * The `ngHide` directive shows or hides the given HTML element based on the expression * provided to the `ngHide` attribute. The element is shown or hidden by removing or adding * the `ng-hide` CSS class onto the element. The `.ng-hide` CSS class is predefined * in AngularJS and sets the display style to none (using an !important flag). * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}). * * ```html * <!-- when $scope.myValue is truthy (element is hidden) --> * <div ng-hide="myValue" class="ng-hide"></div> * * <!-- when $scope.myValue is falsy (element is visible) --> * <div ng-hide="myValue"></div> * ``` * * When the `ngHide` expression evaluates to a truthy value then the `.ng-hide` CSS class is added to the class * attribute on the element causing it to become hidden. When falsy, the `.ng-hide` CSS class is removed * from the element causing the element not to appear hidden. * * ## Why is !important used? * * You may be wondering why !important is used for the `.ng-hide` CSS class. This is because the `.ng-hide` selector * can be easily overridden by heavier selectors. For example, something as simple * as changing the display style on a HTML list item would make hidden elements appear visible. * This also becomes a bigger issue when dealing with CSS frameworks. * * By using !important, the show and hide behavior will work as expected despite any clash between CSS selector * specificity (when !important isn't used with any conflicting styles). If a developer chooses to override the * styling to change how to hide an element then it is just a matter of using !important in their own CSS code. * * ### Overriding `.ng-hide` * * By default, the `.ng-hide` class will style the element with `display: none!important`. If you wish to change * the hide behavior with ngShow/ngHide then this can be achieved by restating the styles for the `.ng-hide` * class in CSS: * * ```css * .ng-hide { * /&#42; this is just another form of hiding an element &#42;/ * display: block!important; * position: absolute; * top: -9999px; * left: -9999px; * } * ``` * * By default you don't need to override in CSS anything and the animations will work around the display style. * * ## A note about animations with `ngHide` * * Animations in ngShow/ngHide work with the show and hide events that are triggered when the directive expression * is true and false. This system works like the animation system present with ngClass, except that the `.ng-hide` * CSS class is added and removed for you instead of your own CSS class. * * ```css * // * //a working example can be found at the bottom of this page * // * .my-element.ng-hide-add, .my-element.ng-hide-remove { * transition: 0.5s linear all; * } * * .my-element.ng-hide-add { ... } * .my-element.ng-hide-add.ng-hide-add-active { ... } * .my-element.ng-hide-remove { ... } * .my-element.ng-hide-remove.ng-hide-remove-active { ... } * ``` * * Keep in mind that, as of AngularJS version 1.3.0-beta.11, there is no need to change the display * property to block during animation states--ngAnimate will handle the style toggling automatically for you. * * @animations * removeClass: `.ng-hide` - happens after the `ngHide` expression evaluates to a truthy value and just before the contents are set to hidden * addClass: `.ng-hide` - happens after the `ngHide` expression evaluates to a non truthy value and just before the contents are set to visible * * @element ANY * @param {expression} ngHide If the {@link guide/expression expression} is truthy then * the element is shown or hidden respectively. * * @example <example module="ngAnimate" deps="angular-animate.js" animations="true"> <file name="index.html"> Click me: <input type="checkbox" ng-model="checked"><br/> <div> Show: <div class="check-element animate-hide" ng-show="checked"> <span class="glyphicon glyphicon-thumbs-up"></span> I show up when your checkbox is checked. </div> </div> <div> Hide: <div class="check-element animate-hide" ng-hide="checked"> <span class="glyphicon glyphicon-thumbs-down"></span> I hide when your checkbox is checked. </div> </div> </file> <file name="glyphicons.css"> @import url(../../components/bootstrap-3.1.1/css/bootstrap.css); </file> <file name="animations.css"> .animate-hide { -webkit-transition: all linear 0.5s; transition: all linear 0.5s; line-height: 20px; opacity: 1; padding: 10px; border: 1px solid black; background: white; } .animate-hide.ng-hide { line-height: 0; opacity: 0; padding: 0 10px; } .check-element { padding: 10px; border: 1px solid black; background: white; } </file> <file name="protractor.js" type="protractor"> var thumbsUp = element(by.css('span.glyphicon-thumbs-up')); var thumbsDown = element(by.css('span.glyphicon-thumbs-down')); it('should check ng-show / ng-hide', function() { expect(thumbsUp.isDisplayed()).toBeFalsy(); expect(thumbsDown.isDisplayed()).toBeTruthy(); element(by.model('checked')).click(); expect(thumbsUp.isDisplayed()).toBeTruthy(); expect(thumbsDown.isDisplayed()).toBeFalsy(); }); </file> </example> */ var ngHideDirective = ['$animate', function($animate) { return { restrict: 'A', multiElement: true, link: function(scope, element, attr) { scope.$watch(attr.ngHide, function ngHideWatchAction(value) { // The comment inside of the ngShowDirective explains why we add and // remove a temporary class for the show/hide animation $animate[value ? 'addClass' : 'removeClass'](element,NG_HIDE_CLASS, { tempClasses: NG_HIDE_IN_PROGRESS_CLASS }); }); } }; }]; /** * @ngdoc directive * @name ngStyle * @restrict AC * * @description * The `ngStyle` directive allows you to set CSS style on an HTML element conditionally. * * @element ANY * @param {expression} ngStyle * * {@link guide/expression Expression} which evals to an * object whose keys are CSS style names and values are corresponding values for those CSS * keys. * * Since some CSS style names are not valid keys for an object, they must be quoted. * See the 'background-color' style in the example below. * * @example <example> <file name="index.html"> <input type="button" value="set color" ng-click="myStyle={color:'red'}"> <input type="button" value="set background" ng-click="myStyle={'background-color':'blue'}"> <input type="button" value="clear" ng-click="myStyle={}"> <br/> <span ng-style="myStyle">Sample Text</span> <pre>myStyle={{myStyle}}</pre> </file> <file name="style.css"> span { color: black; } </file> <file name="protractor.js" type="protractor"> var colorSpan = element(by.css('span')); it('should check ng-style', function() { expect(colorSpan.getCssValue('color')).toBe('rgba(0, 0, 0, 1)'); element(by.css('input[value=\'set color\']')).click(); expect(colorSpan.getCssValue('color')).toBe('rgba(255, 0, 0, 1)'); element(by.css('input[value=clear]')).click(); expect(colorSpan.getCssValue('color')).toBe('rgba(0, 0, 0, 1)'); }); </file> </example> */ var ngStyleDirective = ngDirective(function(scope, element, attr) { scope.$watchCollection(attr.ngStyle, function ngStyleWatchAction(newStyles, oldStyles) { if (oldStyles && (newStyles !== oldStyles)) { forEach(oldStyles, function(val, style) { element.css(style, '');}); } if (newStyles) element.css(newStyles); }); }); /** * @ngdoc directive * @name ngSwitch * @restrict EA * * @description * The `ngSwitch` directive is used to conditionally swap DOM structure on your template based on a scope expression. * Elements within `ngSwitch` but without `ngSwitchWhen` or `ngSwitchDefault` directives will be preserved at the location * as specified in the template. * * The directive itself works similar to ngInclude, however, instead of downloading template code (or loading it * from the template cache), `ngSwitch` simply chooses one of the nested elements and makes it visible based on which element * matches the value obtained from the evaluated expression. In other words, you define a container element * (where you place the directive), place an expression on the **`on="..."` attribute** * (or the **`ng-switch="..."` attribute**), define any inner elements inside of the directive and place * a when attribute per element. The when attribute is used to inform ngSwitch which element to display when the on * expression is evaluated. If a matching expression is not found via a when attribute then an element with the default * attribute is displayed. * * <div class="alert alert-info"> * Be aware that the attribute values to match against cannot be expressions. They are interpreted * as literal string values to match against. * For example, **`ng-switch-when="someVal"`** will match against the string `"someVal"` not against the * value of the expression `$scope.someVal`. * </div> * @animations * enter - happens after the ngSwitch contents change and the matched child element is placed inside the container * leave - happens just after the ngSwitch contents change and just before the former contents are removed from the DOM * * @usage * * ``` * <ANY ng-switch="expression"> * <ANY ng-switch-when="matchValue1">...</ANY> * <ANY ng-switch-when="matchValue2">...</ANY> * <ANY ng-switch-default>...</ANY> * </ANY> * ``` * * * @scope * @priority 1200 * @param {*} ngSwitch|on expression to match against <tt>ng-switch-when</tt>. * On child elements add: * * * `ngSwitchWhen`: the case statement to match against. If match then this * case will be displayed. If the same match appears multiple times, all the * elements will be displayed. * * `ngSwitchDefault`: the default case when no other case match. If there * are multiple default cases, all of them will be displayed when no other * case match. * * * @example <example module="switchExample" deps="angular-animate.js" animations="true"> <file name="index.html"> <div ng-controller="ExampleController"> <select ng-model="selection" ng-options="item for item in items"> </select> <tt>selection={{selection}}</tt> <hr/> <div class="animate-switch-container" ng-switch on="selection"> <div class="animate-switch" ng-switch-when="settings">Settings Div</div> <div class="animate-switch" ng-switch-when="home">Home Span</div> <div class="animate-switch" ng-switch-default>default</div> </div> </div> </file> <file name="script.js"> angular.module('switchExample', ['ngAnimate']) .controller('ExampleController', ['$scope', function($scope) { $scope.items = ['settings', 'home', 'other']; $scope.selection = $scope.items[0]; }]); </file> <file name="animations.css"> .animate-switch-container { position:relative; background:white; border:1px solid black; height:40px; overflow:hidden; } .animate-switch { padding:10px; } .animate-switch.ng-animate { -webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s; transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s; position:absolute; top:0; left:0; right:0; bottom:0; } .animate-switch.ng-leave.ng-leave-active, .animate-switch.ng-enter { top:-50px; } .animate-switch.ng-leave, .animate-switch.ng-enter.ng-enter-active { top:0; } </file> <file name="protractor.js" type="protractor"> var switchElem = element(by.css('[ng-switch]')); var select = element(by.model('selection')); it('should start in settings', function() { expect(switchElem.getText()).toMatch(/Settings Div/); }); it('should change to home', function() { select.all(by.css('option')).get(1).click(); expect(switchElem.getText()).toMatch(/Home Span/); }); it('should select default', function() { select.all(by.css('option')).get(2).click(); expect(switchElem.getText()).toMatch(/default/); }); </file> </example> */ var ngSwitchDirective = ['$animate', function($animate) { return { restrict: 'EA', require: 'ngSwitch', // asks for $scope to fool the BC controller module controller: ['$scope', function ngSwitchController() { this.cases = {}; }], link: function(scope, element, attr, ngSwitchController) { var watchExpr = attr.ngSwitch || attr.on, selectedTranscludes = [], selectedElements = [], previousLeaveAnimations = [], selectedScopes = []; var spliceFactory = function(array, index) { return function() { array.splice(index, 1); }; }; scope.$watch(watchExpr, function ngSwitchWatchAction(value) { var i, ii; for (i = 0, ii = previousLeaveAnimations.length; i < ii; ++i) { $animate.cancel(previousLeaveAnimations[i]); } previousLeaveAnimations.length = 0; for (i = 0, ii = selectedScopes.length; i < ii; ++i) { var selected = getBlockNodes(selectedElements[i].clone); selectedScopes[i].$destroy(); var promise = previousLeaveAnimations[i] = $animate.leave(selected); promise.then(spliceFactory(previousLeaveAnimations, i)); } selectedElements.length = 0; selectedScopes.length = 0; if ((selectedTranscludes = ngSwitchController.cases['!' + value] || ngSwitchController.cases['?'])) { forEach(selectedTranscludes, function(selectedTransclude) { selectedTransclude.transclude(function(caseElement, selectedScope) { selectedScopes.push(selectedScope); var anchor = selectedTransclude.element; caseElement[caseElement.length++] = document.createComment(' end ngSwitchWhen: '); var block = { clone: caseElement }; selectedElements.push(block); $animate.enter(caseElement, anchor.parent(), anchor); }); }); } }); } }; }]; var ngSwitchWhenDirective = ngDirective({ transclude: 'element', priority: 1200, require: '^ngSwitch', multiElement: true, link: function(scope, element, attrs, ctrl, $transclude) { ctrl.cases['!' + attrs.ngSwitchWhen] = (ctrl.cases['!' + attrs.ngSwitchWhen] || []); ctrl.cases['!' + attrs.ngSwitchWhen].push({ transclude: $transclude, element: element }); } }); var ngSwitchDefaultDirective = ngDirective({ transclude: 'element', priority: 1200, require: '^ngSwitch', multiElement: true, link: function(scope, element, attr, ctrl, $transclude) { ctrl.cases['?'] = (ctrl.cases['?'] || []); ctrl.cases['?'].push({ transclude: $transclude, element: element }); } }); /** * @ngdoc directive * @name ngTransclude * @restrict EAC * * @description * Directive that marks the insertion point for the transcluded DOM of the nearest parent directive that uses transclusion. * * Any existing content of the element that this directive is placed on will be removed before the transcluded content is inserted. * * @element ANY * * @example <example module="transcludeExample"> <file name="index.html"> <script> angular.module('transcludeExample', []) .directive('pane', function(){ return { restrict: 'E', transclude: true, scope: { title:'@' }, template: '<div style="border: 1px solid black;">' + '<div style="background-color: gray">{{title}}</div>' + '<ng-transclude></ng-transclude>' + '</div>' }; }) .controller('ExampleController', ['$scope', function($scope) { $scope.title = 'Lorem Ipsum'; $scope.text = 'Neque porro quisquam est qui dolorem ipsum quia dolor...'; }]); </script> <div ng-controller="ExampleController"> <input ng-model="title"> <br/> <textarea ng-model="text"></textarea> <br/> <pane title="{{title}}">{{text}}</pane> </div> </file> <file name="protractor.js" type="protractor"> it('should have transcluded', function() { var titleElement = element(by.model('title')); titleElement.clear(); titleElement.sendKeys('TITLE'); var textElement = element(by.model('text')); textElement.clear(); textElement.sendKeys('TEXT'); expect(element(by.binding('title')).getText()).toEqual('TITLE'); expect(element(by.binding('text')).getText()).toEqual('TEXT'); }); </file> </example> * */ var ngTranscludeDirective = ngDirective({ restrict: 'EAC', link: function($scope, $element, $attrs, controller, $transclude) { if (!$transclude) { throw minErr('ngTransclude')('orphan', 'Illegal use of ngTransclude directive in the template! ' + 'No parent directive that requires a transclusion found. ' + 'Element: {0}', startingTag($element)); } $transclude(function(clone) { $element.empty(); $element.append(clone); }); } }); /** * @ngdoc directive * @name script * @restrict E * * @description * Load the content of a `<script>` element into {@link ng.$templateCache `$templateCache`}, so that the * template can be used by {@link ng.directive:ngInclude `ngInclude`}, * {@link ngRoute.directive:ngView `ngView`}, or {@link guide/directive directives}. The type of the * `<script>` element must be specified as `text/ng-template`, and a cache name for the template must be * assigned through the element's `id`, which can then be used as a directive's `templateUrl`. * * @param {string} type Must be set to `'text/ng-template'`. * @param {string} id Cache name of the template. * * @example <example> <file name="index.html"> <script type="text/ng-template" id="/tpl.html"> Content of the template. </script> <a ng-click="currentTpl='/tpl.html'" id="tpl-link">Load inlined template</a> <div id="tpl-content" ng-include src="currentTpl"></div> </file> <file name="protractor.js" type="protractor"> it('should load template defined inside script tag', function() { element(by.css('#tpl-link')).click(); expect(element(by.css('#tpl-content')).getText()).toMatch(/Content of the template/); }); </file> </example> */ var scriptDirective = ['$templateCache', function($templateCache) { return { restrict: 'E', terminal: true, compile: function(element, attr) { if (attr.type == 'text/ng-template') { var templateUrl = attr.id, text = element[0].text; $templateCache.put(templateUrl, text); } } }; }]; var ngOptionsMinErr = minErr('ngOptions'); /** * @ngdoc directive * @name select * @restrict E * * @description * HTML `SELECT` element with angular data-binding. * * # `ngOptions` * * The `ngOptions` attribute can be used to dynamically generate a list of `<option>` * elements for the `<select>` element using the array or object obtained by evaluating the * `ngOptions` comprehension expression. * * In many cases, `ngRepeat` can be used on `<option>` elements instead of `ngOptions` to achieve a * similar result. However, `ngOptions` provides some benefits such as reducing memory and * increasing speed by not creating a new scope for each repeated instance, as well as providing * more flexibility in how the `<select>`'s model is assigned via the `select` **`as`** part of the * comprehension expression. `ngOptions` should be used when the `<select>` model needs to be bound * to a non-string value. This is because an option element can only be bound to string values at * present. * * When an item in the `<select>` menu is selected, the array element or object property * represented by the selected option will be bound to the model identified by the `ngModel` * directive. * * Optionally, a single hard-coded `<option>` element, with the value set to an empty string, can * be nested into the `<select>` element. This element will then represent the `null` or "not selected" * option. See example below for demonstration. * * <div class="alert alert-warning"> * **Note:** `ngModel` compares by reference, not value. This is important when binding to an * array of objects. See an example [in this jsfiddle](http://jsfiddle.net/qWzTb/). * </div> * * ## `select` **`as`** * * Using `select` **`as`** will bind the result of the `select` expression to the model, but * the value of the `<select>` and `<option>` html elements will be either the index (for array data sources) * or property name (for object data sources) of the value within the collection. If a **`track by`** expression * is used, the result of that expression will be set as the value of the `option` and `select` elements. * * * ### `select` **`as`** and **`track by`** * * <div class="alert alert-warning"> * Do not use `select` **`as`** and **`track by`** in the same expression. They are not designed to work together. * </div> * * Consider the following example: * * ```html * <select ng-options="item.subItem as item.label for item in values track by item.id" ng-model="selected"> * ``` * * ```js * $scope.values = [{ * id: 1, * label: 'aLabel', * subItem: { name: 'aSubItem' } * }, { * id: 2, * label: 'bLabel', * subItem: { name: 'bSubItem' } * }]; * * $scope.selected = { name: 'aSubItem' }; * ``` * * With the purpose of preserving the selection, the **`track by`** expression is always applied to the element * of the data source (to `item` in this example). To calculate whether an element is selected, we do the * following: * * 1. Apply **`track by`** to the elements in the array. In the example: `[1, 2]` * 2. Apply **`track by`** to the already selected value in `ngModel`. * In the example: this is not possible as **`track by`** refers to `item.id`, but the selected * value from `ngModel` is `{name: 'aSubItem'}`, so the **`track by`** expression is applied to * a wrong object, the selected element can't be found, `<select>` is always reset to the "not * selected" option. * * * @param {string} ngModel Assignable angular expression to data-bind to. * @param {string=} name Property name of the form under which the control is published. * @param {string=} required The control is considered valid only if value is entered. * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of * `required` when you want to data-bind to the `required` attribute. * @param {comprehension_expression=} ngOptions in one of the following forms: * * * for array data sources: * * `label` **`for`** `value` **`in`** `array` * * `select` **`as`** `label` **`for`** `value` **`in`** `array` * * `label` **`group by`** `group` **`for`** `value` **`in`** `array` * * `label` **`group by`** `group` **`for`** `value` **`in`** `array` **`track by`** `trackexpr` * * `label` **`for`** `value` **`in`** `array` | orderBy:`orderexpr` **`track by`** `trackexpr` * (for including a filter with `track by`) * * for object data sources: * * `label` **`for (`**`key` **`,`** `value`**`) in`** `object` * * `select` **`as`** `label` **`for (`**`key` **`,`** `value`**`) in`** `object` * * `label` **`group by`** `group` **`for (`**`key`**`,`** `value`**`) in`** `object` * * `select` **`as`** `label` **`group by`** `group` * **`for` `(`**`key`**`,`** `value`**`) in`** `object` * * Where: * * * `array` / `object`: an expression which evaluates to an array / object to iterate over. * * `value`: local variable which will refer to each item in the `array` or each property value * of `object` during iteration. * * `key`: local variable which will refer to a property name in `object` during iteration. * * `label`: The result of this expression will be the label for `<option>` element. The * `expression` will most likely refer to the `value` variable (e.g. `value.propertyName`). * * `select`: The result of this expression will be bound to the model of the parent `<select>` * element. If not specified, `select` expression will default to `value`. * * `group`: The result of this expression will be used to group options using the `<optgroup>` * DOM element. * * `trackexpr`: Used when working with an array of objects. The result of this expression will be * used to identify the objects in the array. The `trackexpr` will most likely refer to the * `value` variable (e.g. `value.propertyName`). With this the selection is preserved * even when the options are recreated (e.g. reloaded from the server). * * @example <example module="selectExample"> <file name="index.html"> <script> angular.module('selectExample', []) .controller('ExampleController', ['$scope', function($scope) { $scope.colors = [ {name:'black', shade:'dark'}, {name:'white', shade:'light'}, {name:'red', shade:'dark'}, {name:'blue', shade:'dark'}, {name:'yellow', shade:'light'} ]; $scope.myColor = $scope.colors[2]; // red }]); </script> <div ng-controller="ExampleController"> <ul> <li ng-repeat="color in colors"> Name: <input ng-model="color.name"> [<a href ng-click="colors.splice($index, 1)">X</a>] </li> <li> [<a href ng-click="colors.push({})">add</a>] </li> </ul> <hr/> Color (null not allowed): <select ng-model="myColor" ng-options="color.name for color in colors"></select><br> Color (null allowed): <span class="nullable"> <select ng-model="myColor" ng-options="color.name for color in colors"> <option value="">-- choose color --</option> </select> </span><br/> Color grouped by shade: <select ng-model="myColor" ng-options="color.name group by color.shade for color in colors"> </select><br/> Select <a href ng-click="myColor = { name:'not in list', shade: 'other' }">bogus</a>.<br> <hr/> Currently selected: {{ {selected_color:myColor} }} <div style="border:solid 1px black; height:20px" ng-style="{'background-color':myColor.name}"> </div> </div> </file> <file name="protractor.js" type="protractor"> it('should check ng-options', function() { expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('red'); element.all(by.model('myColor')).first().click(); element.all(by.css('select[ng-model="myColor"] option')).first().click(); expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('black'); element(by.css('.nullable select[ng-model="myColor"]')).click(); element.all(by.css('.nullable select[ng-model="myColor"] option')).first().click(); expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('null'); }); </file> </example> */ var ngOptionsDirective = valueFn({ restrict: 'A', terminal: true }); // jshint maxlen: false var selectDirective = ['$compile', '$parse', function($compile, $parse) { //000011111111110000000000022222222220000000000000000000003333333333000000000000004444444444444440000000005555555555555550000000666666666666666000000000000000777777777700000000000000000008888888888 var NG_OPTIONS_REGEXP = /^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+group\s+by\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?$/, nullModelCtrl = {$setViewValue: noop}; // jshint maxlen: 100 return { restrict: 'E', require: ['select', '?ngModel'], controller: ['$element', '$scope', '$attrs', function($element, $scope, $attrs) { var self = this, optionsMap = {}, ngModelCtrl = nullModelCtrl, nullOption, unknownOption; self.databound = $attrs.ngModel; self.init = function(ngModelCtrl_, nullOption_, unknownOption_) { ngModelCtrl = ngModelCtrl_; nullOption = nullOption_; unknownOption = unknownOption_; }; self.addOption = function(value, element) { assertNotHasOwnProperty(value, '"option value"'); optionsMap[value] = true; if (ngModelCtrl.$viewValue == value) { $element.val(value); if (unknownOption.parent()) unknownOption.remove(); } // Workaround for https://code.google.com/p/chromium/issues/detail?id=381459 // Adding an <option selected="selected"> element to a <select required="required"> should // automatically select the new element if (element && element[0].hasAttribute('selected')) { element[0].selected = true; } }; self.removeOption = function(value) { if (this.hasOption(value)) { delete optionsMap[value]; if (ngModelCtrl.$viewValue === value) { this.renderUnknownOption(value); } } }; self.renderUnknownOption = function(val) { var unknownVal = '? ' + hashKey(val) + ' ?'; unknownOption.val(unknownVal); $element.prepend(unknownOption); $element.val(unknownVal); unknownOption.prop('selected', true); // needed for IE }; self.hasOption = function(value) { return optionsMap.hasOwnProperty(value); }; $scope.$on('$destroy', function() { // disable unknown option so that we don't do work when the whole select is being destroyed self.renderUnknownOption = noop; }); }], link: function(scope, element, attr, ctrls) { // if ngModel is not defined, we don't need to do anything if (!ctrls[1]) return; var selectCtrl = ctrls[0], ngModelCtrl = ctrls[1], multiple = attr.multiple, optionsExp = attr.ngOptions, nullOption = false, // if false, user will not be able to select it (used by ngOptions) emptyOption, renderScheduled = false, // we can't just jqLite('<option>') since jqLite is not smart enough // to create it in <select> and IE barfs otherwise. optionTemplate = jqLite(document.createElement('option')), optGroupTemplate =jqLite(document.createElement('optgroup')), unknownOption = optionTemplate.clone(); // find "null" option for (var i = 0, children = element.children(), ii = children.length; i < ii; i++) { if (children[i].value === '') { emptyOption = nullOption = children.eq(i); break; } } selectCtrl.init(ngModelCtrl, nullOption, unknownOption); // required validator if (multiple) { ngModelCtrl.$isEmpty = function(value) { return !value || value.length === 0; }; } if (optionsExp) setupAsOptions(scope, element, ngModelCtrl); else if (multiple) setupAsMultiple(scope, element, ngModelCtrl); else setupAsSingle(scope, element, ngModelCtrl, selectCtrl); //////////////////////////// function setupAsSingle(scope, selectElement, ngModelCtrl, selectCtrl) { ngModelCtrl.$render = function() { var viewValue = ngModelCtrl.$viewValue; if (selectCtrl.hasOption(viewValue)) { if (unknownOption.parent()) unknownOption.remove(); selectElement.val(viewValue); if (viewValue === '') emptyOption.prop('selected', true); // to make IE9 happy } else { if (isUndefined(viewValue) && emptyOption) { selectElement.val(''); } else { selectCtrl.renderUnknownOption(viewValue); } } }; selectElement.on('change', function() { scope.$apply(function() { if (unknownOption.parent()) unknownOption.remove(); ngModelCtrl.$setViewValue(selectElement.val()); }); }); } function setupAsMultiple(scope, selectElement, ctrl) { var lastView; ctrl.$render = function() { var items = new HashMap(ctrl.$viewValue); forEach(selectElement.find('option'), function(option) { option.selected = isDefined(items.get(option.value)); }); }; // we have to do it on each watch since ngModel watches reference, but // we need to work of an array, so we need to see if anything was inserted/removed scope.$watch(function selectMultipleWatch() { if (!equals(lastView, ctrl.$viewValue)) { lastView = shallowCopy(ctrl.$viewValue); ctrl.$render(); } }); selectElement.on('change', function() { scope.$apply(function() { var array = []; forEach(selectElement.find('option'), function(option) { if (option.selected) { array.push(option.value); } }); ctrl.$setViewValue(array); }); }); } function setupAsOptions(scope, selectElement, ctrl) { var match; if (!(match = optionsExp.match(NG_OPTIONS_REGEXP))) { throw ngOptionsMinErr('iexp', "Expected expression in form of " + "'_select_ (as _label_)? for (_key_,)?_value_ in _collection_'" + " but got '{0}'. Element: {1}", optionsExp, startingTag(selectElement)); } var displayFn = $parse(match[2] || match[1]), valueName = match[4] || match[6], selectAs = / as /.test(match[0]) && match[1], selectAsFn = selectAs ? $parse(selectAs) : null, keyName = match[5], groupByFn = $parse(match[3] || ''), valueFn = $parse(match[2] ? match[1] : valueName), valuesFn = $parse(match[7]), track = match[8], trackFn = track ? $parse(match[8]) : null, trackKeysCache = {}, // This is an array of array of existing option groups in DOM. // We try to reuse these if possible // - optionGroupsCache[0] is the options with no option group // - optionGroupsCache[?][0] is the parent: either the SELECT or OPTGROUP element optionGroupsCache = [[{element: selectElement, label:''}]], //re-usable object to represent option's locals locals = {}; if (nullOption) { // compile the element since there might be bindings in it $compile(nullOption)(scope); // remove the class, which is added automatically because we recompile the element and it // becomes the compilation root nullOption.removeClass('ng-scope'); // we need to remove it before calling selectElement.empty() because otherwise IE will // remove the label from the element. wtf? nullOption.remove(); } // clear contents, we'll add what's needed based on the model selectElement.empty(); selectElement.on('change', selectionChanged); ctrl.$render = render; scope.$watchCollection(valuesFn, scheduleRendering); scope.$watchCollection(getLabels, scheduleRendering); if (multiple) { scope.$watchCollection(function() { return ctrl.$modelValue; }, scheduleRendering); } // ------------------------------------------------------------------ // function callExpression(exprFn, key, value) { locals[valueName] = value; if (keyName) locals[keyName] = key; return exprFn(scope, locals); } function selectionChanged() { scope.$apply(function() { var collection = valuesFn(scope) || []; var viewValue; if (multiple) { viewValue = []; forEach(selectElement.val(), function(selectedKey) { selectedKey = trackFn ? trackKeysCache[selectedKey] : selectedKey; viewValue.push(getViewValue(selectedKey, collection[selectedKey])); }); } else { var selectedKey = trackFn ? trackKeysCache[selectElement.val()] : selectElement.val(); viewValue = getViewValue(selectedKey, collection[selectedKey]); } ctrl.$setViewValue(viewValue); render(); }); } function getViewValue(key, value) { if (key === '?') { return undefined; } else if (key === '') { return null; } else { var viewValueFn = selectAsFn ? selectAsFn : valueFn; return callExpression(viewValueFn, key, value); } } function getLabels() { var values = valuesFn(scope); var toDisplay; if (values && isArray(values)) { toDisplay = new Array(values.length); for (var i = 0, ii = values.length; i < ii; i++) { toDisplay[i] = callExpression(displayFn, i, values[i]); } return toDisplay; } else if (values) { // TODO: Add a test for this case toDisplay = {}; for (var prop in values) { if (values.hasOwnProperty(prop)) { toDisplay[prop] = callExpression(displayFn, prop, values[prop]); } } } return toDisplay; } function createIsSelectedFn(viewValue) { var selectedSet; if (multiple) { if (trackFn && isArray(viewValue)) { selectedSet = new HashMap([]); for (var trackIndex = 0; trackIndex < viewValue.length; trackIndex++) { // tracking by key selectedSet.put(callExpression(trackFn, null, viewValue[trackIndex]), true); } } else { selectedSet = new HashMap(viewValue); } } else if (trackFn) { viewValue = callExpression(trackFn, null, viewValue); } return function isSelected(key, value) { var compareValueFn; if (trackFn) { compareValueFn = trackFn; } else if (selectAsFn) { compareValueFn = selectAsFn; } else { compareValueFn = valueFn; } if (multiple) { return isDefined(selectedSet.remove(callExpression(compareValueFn, key, value))); } else { return viewValue === callExpression(compareValueFn, key, value); } }; } function scheduleRendering() { if (!renderScheduled) { scope.$$postDigest(render); renderScheduled = true; } } /** * A new labelMap is created with each render. * This function is called for each existing option with added=false, * and each new option with added=true. * - Labels that are passed to this method twice, * (once with added=true and once with added=false) will end up with a value of 0, and * will cause no change to happen to the corresponding option. * - Labels that are passed to this method only once with added=false will end up with a * value of -1 and will eventually be passed to selectCtrl.removeOption() * - Labels that are passed to this method only once with added=true will end up with a * value of 1 and will eventually be passed to selectCtrl.addOption() */ function updateLabelMap(labelMap, label, added) { labelMap[label] = labelMap[label] || 0; labelMap[label] += (added ? 1 : -1); } function render() { renderScheduled = false; // Temporary location for the option groups before we render them var optionGroups = {'':[]}, optionGroupNames = [''], optionGroupName, optionGroup, option, existingParent, existingOptions, existingOption, viewValue = ctrl.$viewValue, values = valuesFn(scope) || [], keys = keyName ? sortedKeys(values) : values, key, value, groupLength, length, groupIndex, index, labelMap = {}, selected, isSelected = createIsSelectedFn(viewValue), anySelected = false, lastElement, element, label, optionId; trackKeysCache = {}; // We now build up the list of options we need (we merge later) for (index = 0; length = keys.length, index < length; index++) { key = index; if (keyName) { key = keys[index]; if (key.charAt(0) === '$') continue; } value = values[key]; optionGroupName = callExpression(groupByFn, key, value) || ''; if (!(optionGroup = optionGroups[optionGroupName])) { optionGroup = optionGroups[optionGroupName] = []; optionGroupNames.push(optionGroupName); } selected = isSelected(key, value); anySelected = anySelected || selected; label = callExpression(displayFn, key, value); // what will be seen by the user // doing displayFn(scope, locals) || '' overwrites zero values label = isDefined(label) ? label : ''; optionId = trackFn ? trackFn(scope, locals) : (keyName ? keys[index] : index); if (trackFn) { trackKeysCache[optionId] = key; } optionGroup.push({ // either the index into array or key from object id: optionId, label: label, selected: selected // determine if we should be selected }); } if (!multiple) { if (nullOption || viewValue === null) { // insert null option if we have a placeholder, or the model is null optionGroups[''].unshift({id:'', label:'', selected:!anySelected}); } else if (!anySelected) { // option could not be found, we have to insert the undefined item optionGroups[''].unshift({id:'?', label:'', selected:true}); } } // Now we need to update the list of DOM nodes to match the optionGroups we computed above for (groupIndex = 0, groupLength = optionGroupNames.length; groupIndex < groupLength; groupIndex++) { // current option group name or '' if no group optionGroupName = optionGroupNames[groupIndex]; // list of options for that group. (first item has the parent) optionGroup = optionGroups[optionGroupName]; if (optionGroupsCache.length <= groupIndex) { // we need to grow the optionGroups existingParent = { element: optGroupTemplate.clone().attr('label', optionGroupName), label: optionGroup.label }; existingOptions = [existingParent]; optionGroupsCache.push(existingOptions); selectElement.append(existingParent.element); } else { existingOptions = optionGroupsCache[groupIndex]; existingParent = existingOptions[0]; // either SELECT (no group) or OPTGROUP element // update the OPTGROUP label if not the same. if (existingParent.label != optionGroupName) { existingParent.element.attr('label', existingParent.label = optionGroupName); } } lastElement = null; // start at the beginning for (index = 0, length = optionGroup.length; index < length; index++) { option = optionGroup[index]; if ((existingOption = existingOptions[index + 1])) { // reuse elements lastElement = existingOption.element; if (existingOption.label !== option.label) { updateLabelMap(labelMap, existingOption.label, false); updateLabelMap(labelMap, option.label, true); lastElement.text(existingOption.label = option.label); lastElement.prop('label', existingOption.label); } if (existingOption.id !== option.id) { lastElement.val(existingOption.id = option.id); } // lastElement.prop('selected') provided by jQuery has side-effects if (lastElement[0].selected !== option.selected) { lastElement.prop('selected', (existingOption.selected = option.selected)); if (msie) { // See #7692 // The selected item wouldn't visually update on IE without this. // Tested on Win7: IE9, IE10 and IE11. Future IEs should be tested as well lastElement.prop('selected', existingOption.selected); } } } else { // grow elements // if it's a null option if (option.id === '' && nullOption) { // put back the pre-compiled element element = nullOption; } else { // jQuery(v1.4.2) Bug: We should be able to chain the method calls, but // in this version of jQuery on some browser the .text() returns a string // rather then the element. (element = optionTemplate.clone()) .val(option.id) .prop('selected', option.selected) .attr('selected', option.selected) .prop('label', option.label) .text(option.label); } existingOptions.push(existingOption = { element: element, label: option.label, id: option.id, selected: option.selected }); updateLabelMap(labelMap, option.label, true); if (lastElement) { lastElement.after(element); } else { existingParent.element.append(element); } lastElement = element; } } // remove any excessive OPTIONs in a group index++; // increment since the existingOptions[0] is parent element not OPTION while (existingOptions.length > index) { option = existingOptions.pop(); updateLabelMap(labelMap, option.label, false); option.element.remove(); } } // remove any excessive OPTGROUPs from select while (optionGroupsCache.length > groupIndex) { // remove all the labels in the option group optionGroup = optionGroupsCache.pop(); for (index = 1; index < optionGroup.length; ++index) { updateLabelMap(labelMap, optionGroup[index].label, false); } optionGroup[0].element.remove(); } forEach(labelMap, function(count, label) { if (count > 0) { selectCtrl.addOption(label); } else if (count < 0) { selectCtrl.removeOption(label); } }); } } } }; }]; var optionDirective = ['$interpolate', function($interpolate) { var nullSelectCtrl = { addOption: noop, removeOption: noop }; return { restrict: 'E', priority: 100, compile: function(element, attr) { if (isUndefined(attr.value)) { var interpolateFn = $interpolate(element.text(), true); if (!interpolateFn) { attr.$set('value', element.text()); } } return function(scope, element, attr) { var selectCtrlName = '$selectController', parent = element.parent(), selectCtrl = parent.data(selectCtrlName) || parent.parent().data(selectCtrlName); // in case we are in optgroup if (!selectCtrl || !selectCtrl.databound) { selectCtrl = nullSelectCtrl; } if (interpolateFn) { scope.$watch(interpolateFn, function interpolateWatchAction(newVal, oldVal) { attr.$set('value', newVal); if (oldVal !== newVal) { selectCtrl.removeOption(oldVal); } selectCtrl.addOption(newVal, element); }); } else { selectCtrl.addOption(attr.value, element); } element.on('$destroy', function() { selectCtrl.removeOption(attr.value); }); }; } }; }]; var styleDirective = valueFn({ restrict: 'E', terminal: false }); var requiredDirective = function() { return { restrict: 'A', require: '?ngModel', link: function(scope, elm, attr, ctrl) { if (!ctrl) return; attr.required = true; // force truthy in case we are on non input element ctrl.$validators.required = function(modelValue, viewValue) { return !attr.required || !ctrl.$isEmpty(viewValue); }; attr.$observe('required', function() { ctrl.$validate(); }); } }; }; var patternDirective = function() { return { restrict: 'A', require: '?ngModel', link: function(scope, elm, attr, ctrl) { if (!ctrl) return; var regexp, patternExp = attr.ngPattern || attr.pattern; attr.$observe('pattern', function(regex) { if (isString(regex) && regex.length > 0) { regex = new RegExp('^' + regex + '$'); } if (regex && !regex.test) { throw minErr('ngPattern')('noregexp', 'Expected {0} to be a RegExp but was {1}. Element: {2}', patternExp, regex, startingTag(elm)); } regexp = regex || undefined; ctrl.$validate(); }); ctrl.$validators.pattern = function(value) { return ctrl.$isEmpty(value) || isUndefined(regexp) || regexp.test(value); }; } }; }; var maxlengthDirective = function() { return { restrict: 'A', require: '?ngModel', link: function(scope, elm, attr, ctrl) { if (!ctrl) return; var maxlength = -1; attr.$observe('maxlength', function(value) { var intVal = int(value); maxlength = isNaN(intVal) ? -1 : intVal; ctrl.$validate(); }); ctrl.$validators.maxlength = function(modelValue, viewValue) { return (maxlength < 0) || ctrl.$isEmpty(viewValue) || (viewValue.length <= maxlength); }; } }; }; var minlengthDirective = function() { return { restrict: 'A', require: '?ngModel', link: function(scope, elm, attr, ctrl) { if (!ctrl) return; var minlength = 0; attr.$observe('minlength', function(value) { minlength = int(value) || 0; ctrl.$validate(); }); ctrl.$validators.minlength = function(modelValue, viewValue) { return ctrl.$isEmpty(viewValue) || viewValue.length >= minlength; }; } }; }; if (window.angular.bootstrap) { //AngularJS is already loaded, so we can return here... console.log('WARNING: Tried to load angular more than once.'); return; } //try to bind to jquery now so that one can write jqLite(document).ready() //but we will rebind on bootstrap again. bindJQuery(); publishExternalAPI(angular); jqLite(document).ready(function() { angularInit(document, bootstrap); }); })(window, document); !window.angular.$$csp() && window.angular.element(document).find('head').prepend('<style type="text/css">@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide:not(.ng-hide-animate){display:none !important;}ng\\:form{display:block;}</style>');
abcd-ca/ionic
config/lib/js/angular/angular.js
JavaScript
mit
952,665
var path = require('path'); module.exports = function (start, opts) { var modules = opts.moduleDirectory ? [].concat(opts.moduleDirectory) : ['node_modules'] ; var prefix = '/'; if (/^([A-Za-z]:)/.test(start)) { prefix = ''; } else if (/^\\\\/.test(start)) { prefix = '\\\\'; } var splitRe = process.platform === 'win32' ? /[\/\\]/ : /\/+/; // ensure that `start` is an absolute path at this point, // resolving againt the process' current working directory start = path.resolve(start); var parts = start.split(splitRe); var dirs = []; for (var i = parts.length - 1; i >= 0; i--) { if (modules.indexOf(parts[i]) !== -1) continue; dirs = dirs.concat(modules.map(function(module_dir) { return prefix + path.join( path.join.apply(path, parts.slice(0, i + 1)), module_dir ); })); } if (process.platform === 'win32'){ dirs[dirs.length-1] = dirs[dirs.length-1].replace(":", ":\\"); } return dirs.concat(opts.paths); }
wenjoy/homePage
node_modules/geetest/node_modules/request/node_modules/karma/node_modules/grunt-coffeelint/node_modules/coffeelint-stylish/node_modules/chalk/node_modules/strip-ansi/node_modules/ava/node_modules/minimist/node_modules/covert/node_modules/resolve/lib/node-modules-paths.js
JavaScript
mit
1,104
webshim.register("url",function(a,b,c,d,e){"use strict";!function(a){function b(a){if(f)return new g(a);var b=d.createElement("a");return b.href=a,b}var f,g=a.URL;try{if(g){if(f=new a.URL("http://example.com"),"searchParams"in f)return;"href"in f||(f=e)}}catch(h){}if(a.URL=function(e,h){function i(a,b){var c=a.split("&");b&&-1===c[0].indexOf("=")&&(c[0]="="+c[0]);var d=[];c.forEach(function(a){if(0!==a.length){var b=a.indexOf("=");if(-1!==b)var c=a.substring(0,b),e=a.substring(b+1);else c=a,e="";c=c.replace("+"," "),e=e.replace("+"," "),d.push({name:c,value:e})}});var e=[];return d.forEach(function(a){e.push({name:decodeURIComponent(a.name),value:decodeURIComponent(a.value)})}),e}function j(a,b){function c(){f||(f=!0,a.search=d(e),f=!1)}function d(a){var b="",c=!0;return a.forEach(function(a){var d=encodeURIComponent(a.name),e=encodeURIComponent(a.value);c||(b+="&"),b+=d+"="+e,c=!1}),b}var e=[];b&&(e=i(b)),this._setPairs=function(a){e=a},this._updateSteps=function(){c()};var f=!1;webshim.defineProperties(this,{append:{value:function(a,b){e.push({name:a,value:b}),c()}},"delete":{value:function(a){for(var b=0;b<e.length;)e[b].name===a?e.splice(b,1):++b;c()}},get:{value:function(a){for(var b=0;b<e.length;++b)if(e[b].name===a)return e[b].value;return null}},getAll:{value:function(a){for(var b=[],c=0;c<e.length;++c)e[c].name===a&&b.push(e[c].value);return b}},has:{value:function(a){for(var b=0;b<e.length;++b)if(e[b].name===a)return!0;return!1}},set:{value:function(a,b){for(var d=!1,f=0;f<e.length;)e[f].name===a?d?e.splice(f,1):(e[f].value=b,++f):++f;c()}},toString:{value:function(){return d(e)}}})}function k(){var a=m.href.replace(/#$|\?$|\?(?=#)/g,"");m.href!==a&&(m.href=a)}function l(){p._setPairs(m.search?i(m.search.substring(1)):[]),p._updateSteps()}if(!(this instanceof a.URL))throw new TypeError("Failed to construct 'URL': Please use the 'new' operator.");h&&(e=function(){if(f)return new g(e,h).href;var a;if(d.implementation&&d.implementation.createHTMLDocument?a=d.implementation.createHTMLDocument(""):d.implementation&&d.implementation.createDocument?(a=d.implementation.createElement("http://www.w3.org/1999/xhtml","html",null),a.documentElement.appendChild(a.createElement("head")),a.documentElement.appendChild(a.createElement("body"))):c.ActiveXObject&&(a=new c.ActiveXObject("htmlfile"),a.write("<head></head><body></body>"),a.close()),!a)throw Error("base not supported");var b=a.createElement("base");b.href=h,a.getElementsByTagName("head")[0].appendChild(b);var i=a.createElement("a");return i.href=e,i.href}());var m=b(e||""),n=Object.defineProperties&&function(){var a={};return Object.defineProperties(a,{p:{get:function(){return!0}}}),a.p}(),o=n?this:d.createElement("a"),p=new j(o,m.search?m.search.substring(1):null);return webshim.defineProperties(o,{href:{get:function(){return m.href},set:function(a){m.href=a,k(),l()}},origin:{get:function(){return"origin"in m?m.origin:this.protocol+"//"+this.host}},protocol:{get:function(){return m.protocol},set:function(a){m.protocol=a}},username:{get:function(){return m.username},set:function(a){m.username=a}},password:{get:function(){return m.password},set:function(a){m.password=a}},host:{get:function(){var a={"http:":/:80$/,"https:":/:443$/,"ftp:":/:21$/}[m.protocol];return a?m.host.replace(a,""):m.host},set:function(a){m.host=a}},hostname:{get:function(){return m.hostname},set:function(a){m.hostname=a}},port:{get:function(){return m.port},set:function(a){m.port=a}},pathname:{get:function(){return"/"!==m.pathname.charAt(0)?"/"+m.pathname:m.pathname},set:function(a){m.pathname=a}},search:{get:function(){return m.search},set:function(a){m.search!==a&&(m.search=a,k(),l())}},searchParams:{get:function(){return p}},hash:{get:function(){return m.hash},set:function(a){m.hash=a,k()}}}),o},g)for(var i in g)g.hasOwnProperty(i)&&(a.URL[i]=g[i])}(c)});
mzdani/cdnjs
ajax/libs/webshim/1.15.3/minified/shims/url.js
JavaScript
mit
3,852
/*! * Bootstrap v3.2.0 (http://getbootstrap.com) * Copyright 2011-2014 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) */ if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){return a(b.target).is(this)?b.handleObj.handler.apply(this,arguments):void 0}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.2.0",d.prototype.close=function(b){function c(){f.detach().trigger("closed.bs.alert").remove()}var d=a(this),e=d.attr("data-target");e||(e=d.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,""));var f=a(e);b&&b.preventDefault(),f.length||(f=d.hasClass("alert")?d:d.parent()),f.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one("bsTransitionEnd",c).emulateTransitionEnd(150):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.2.0",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),d[e](null==f[b]?this.options[b]:f[b]),setTimeout(a.proxy(function(){"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")&&(c.prop("checked")&&this.$element.hasClass("active")?a=!1:b.find(".active").removeClass("active")),a&&c.prop("checked",!this.$element.hasClass("active")).trigger("change")}a&&this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target);d.hasClass("btn")||(d=d.closest(".btn")),b.call(d,"toggle"),c.preventDefault()})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b).on("keydown.bs.carousel",a.proxy(this.keydown,this)),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=this.sliding=this.interval=this.$active=this.$items=null,"hover"==this.options.pause&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.2.0",c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},c.prototype.keydown=function(a){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.to=function(b){var c=this,d=this.getItemIndex(this.$active=this.$element.find(".item.active"));return b>this.$items.length-1||0>b?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){c.to(b)}):d==b?this.pause().cycle():this.slide(b>d?"next":"prev",a(this.$items[b]))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){return this.sliding?void 0:this.slide("next")},c.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},c.prototype.slide=function(b,c){var d=this.$element.find(".item.active"),e=c||d[b](),f=this.interval,g="next"==b?"left":"right",h="next"==b?"first":"last",i=this;if(!e.length){if(!this.options.wrap)return;e=this.$element.find(".item")[h]()}if(e.hasClass("active"))return this.sliding=!1;var j=e[0],k=a.Event("slide.bs.carousel",{relatedTarget:j,direction:g});if(this.$element.trigger(k),!k.isDefaultPrevented()){if(this.sliding=!0,f&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var l=a(this.$indicators.children()[this.getItemIndex(e)]);l&&l.addClass("active")}var m=a.Event("slid.bs.carousel",{relatedTarget:j,direction:g});return a.support.transition&&this.$element.hasClass("slide")?(e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),d.one("bsTransitionEnd",function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger(m)},0)}).emulateTransitionEnd(1e3*d.css("transition-duration").slice(0,-1))):(d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger(m)),f&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this},a(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault()}}),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.collapse"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b);!e&&f.toggle&&"show"==b&&(b=!b),e||d.data("bs.collapse",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.transitioning=null,this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};c.VERSION="3.2.0",c.DEFAULTS={toggle:!0},c.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},c.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var c=a.Event("show.bs.collapse");if(this.$element.trigger(c),!c.isDefaultPrevented()){var d=this.$parent&&this.$parent.find("> .panel > .in");if(d&&d.length){var e=d.data("bs.collapse");if(e&&e.transitioning)return;b.call(d,"hide"),e||d.data("bs.collapse",null)}var f=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[f](0),this.transitioning=1;var g=function(){this.$element.removeClass("collapsing").addClass("collapse in")[f](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return g.call(this);var h=a.camelCase(["scroll",f].join("-"));this.$element.one("bsTransitionEnd",a.proxy(g,this)).emulateTransitionEnd(350)[f](this.$element[0][h])}}},c.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var d=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(d,this)).emulateTransitionEnd(350):d.call(this)}}},c.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var d=a.fn.collapse;a.fn.collapse=b,a.fn.collapse.Constructor=c,a.fn.collapse.noConflict=function(){return a.fn.collapse=d,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(c){var d,e=a(this),f=e.attr("data-target")||c.preventDefault()||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""),g=a(f),h=g.data("bs.collapse"),i=h?"toggle":e.data(),j=e.attr("data-parent"),k=j&&a(j);h&&h.transitioning||(k&&k.find('[data-toggle="collapse"][data-parent="'+j+'"]').not(e).addClass("collapsed"),e[g.hasClass("in")?"addClass":"removeClass"]("collapsed")),b.call(g,i)})}(jQuery),+function(a){"use strict";function b(b){b&&3===b.which||(a(e).remove(),a(f).each(function(){var d=c(a(this)),e={relatedTarget:this};d.hasClass("open")&&(d.trigger(b=a.Event("hide.bs.dropdown",e)),b.isDefaultPrevented()||d.removeClass("open").trigger("hidden.bs.dropdown",e))}))}function c(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.2.0",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=c(e),g=f.hasClass("open");if(b(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a('<div class="dropdown-backdrop"/>').insertAfter(a(this)).on("click",b);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;e.trigger("focus"),f.toggleClass("open").trigger("shown.bs.dropdown",h)}return!1}},g.prototype.keydown=function(b){if(/(38|40|27)/.test(b.keyCode)){var d=a(this);if(b.preventDefault(),b.stopPropagation(),!d.is(".disabled, :disabled")){var e=c(d),g=e.hasClass("open");if(!g||g&&27==b.keyCode)return 27==b.which&&e.find(f).trigger("focus"),d.trigger("click");var h=" li:not(.divider):visible a",i=e.find('[role="menu"]'+h+', [role="listbox"]'+h);if(i.length){var j=i.index(i.filter(":focus"));38==b.keyCode&&j>0&&j--,40==b.keyCode&&j<i.length-1&&j++,~j||(j=0),i.eq(j).trigger("focus")}}}};var h=a.fn.dropdown;a.fn.dropdown=d,a.fn.dropdown.Constructor=g,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=h,this},a(document).on("click.bs.dropdown.data-api",b).on("click.bs.dropdown.data-api",".dropdown form",function(a){a.stopPropagation()}).on("click.bs.dropdown.data-api",f,g.prototype.toggle).on("keydown.bs.dropdown.data-api",f+', [role="menu"], [role="listbox"]',g.prototype.keydown)}(jQuery),+function(a){"use strict";function b(b,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},c.DEFAULTS,e.data(),"object"==typeof b&&b);f||e.data("bs.modal",f=new c(this,g)),"string"==typeof b?f[b](d):g.show&&f.show(d)})}var c=function(b,c){this.options=c,this.$body=a(document.body),this.$element=a(b),this.$backdrop=this.isShown=null,this.scrollbarWidth=0,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,a.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};c.VERSION="3.2.0",c.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},c.prototype.toggle=function(a){return this.isShown?this.hide():this.show(a)},c.prototype.show=function(b){var c=this,d=a.Event("show.bs.modal",{relatedTarget:b});this.$element.trigger(d),this.isShown||d.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.$body.addClass("modal-open"),this.setScrollbar(),this.escape(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.backdrop(function(){var d=a.support.transition&&c.$element.hasClass("fade");c.$element.parent().length||c.$element.appendTo(c.$body),c.$element.show().scrollTop(0),d&&c.$element[0].offsetWidth,c.$element.addClass("in").attr("aria-hidden",!1),c.enforceFocus();var e=a.Event("shown.bs.modal",{relatedTarget:b});d?c.$element.find(".modal-dialog").one("bsTransitionEnd",function(){c.$element.trigger("focus").trigger(e)}).emulateTransitionEnd(300):c.$element.trigger("focus").trigger(e)}))},c.prototype.hide=function(b){b&&b.preventDefault(),b=a.Event("hide.bs.modal"),this.$element.trigger(b),this.isShown&&!b.isDefaultPrevented()&&(this.isShown=!1,this.$body.removeClass("modal-open"),this.resetScrollbar(),this.escape(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").attr("aria-hidden",!0).off("click.dismiss.bs.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",a.proxy(this.hideModal,this)).emulateTransitionEnd(300):this.hideModal())},c.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(a){this.$element[0]===a.target||this.$element.has(a.target).length||this.$element.trigger("focus")},this))},c.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.bs.modal",a.proxy(function(a){27==a.which&&this.hide()},this)):this.isShown||this.$element.off("keyup.dismiss.bs.modal")},c.prototype.hideModal=function(){var a=this;this.$element.hide(),this.backdrop(function(){a.$element.trigger("hidden.bs.modal")})},c.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},c.prototype.backdrop=function(b){var c=this,d=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var e=a.support.transition&&d;if(this.$backdrop=a('<div class="modal-backdrop '+d+'" />').appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(a){a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus.call(this.$element[0]):this.hide.call(this))},this)),e&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;e?this.$backdrop.one("bsTransitionEnd",b).emulateTransitionEnd(150):b()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var f=function(){c.removeBackdrop(),b&&b()};a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",f).emulateTransitionEnd(150):f()}else b&&b()},c.prototype.checkScrollbar=function(){document.body.clientWidth>=window.innerWidth||(this.scrollbarWidth=this.scrollbarWidth||this.measureScrollbar())},c.prototype.setScrollbar=function(){var a=parseInt(this.$body.css("padding-right")||0,10);this.scrollbarWidth&&this.$body.css("padding-right",a+this.scrollbarWidth)},c.prototype.resetScrollbar=function(){this.$body.css("padding-right","")},c.prototype.measureScrollbar=function(){var a=document.createElement("div");a.className="modal-scrollbar-measure",this.$body.append(a);var b=a.offsetWidth-a.clientWidth;return this.$body[0].removeChild(a),b};var d=a.fn.modal;a.fn.modal=b,a.fn.modal.Constructor=c,a.fn.modal.noConflict=function(){return a.fn.modal=d,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(c){var d=a(this),e=d.attr("href"),f=a(d.attr("data-target")||e&&e.replace(/.*(?=#[^\s]+$)/,"")),g=f.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(e)&&e},f.data(),d.data());d.is("a")&&c.preventDefault(),f.one("show.bs.modal",function(a){a.isDefaultPrevented()||f.one("hidden.bs.modal",function(){d.is(":visible")&&d.trigger("focus")})}),b.call(f,g,this)})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tooltip"),f="object"==typeof b&&b;(e||"destroy"!=b)&&(e||d.data("bs.tooltip",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",a,b)};c.VERSION="3.2.0",c.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},c.prototype.init=function(b,c,d){this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(this.options.viewport.selector||this.options.viewport);for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show()},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide()},c.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var c=a.contains(document.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!c)return;var d=this,e=this.tip(),f=this.getUID(this.type);this.setContent(),e.attr("id",f),this.$element.attr("aria-describedby",f),this.options.animation&&e.addClass("fade");var g="function"==typeof this.options.placement?this.options.placement.call(this,e[0],this.$element[0]):this.options.placement,h=/\s?auto?\s?/i,i=h.test(g);i&&(g=g.replace(h,"")||"top"),e.detach().css({top:0,left:0,display:"block"}).addClass(g).data("bs."+this.type,this),this.options.container?e.appendTo(this.options.container):e.insertAfter(this.$element);var j=this.getPosition(),k=e[0].offsetWidth,l=e[0].offsetHeight;if(i){var m=g,n=this.$element.parent(),o=this.getPosition(n);g="bottom"==g&&j.top+j.height+l-o.scroll>o.height?"top":"top"==g&&j.top-o.scroll-l<0?"bottom":"right"==g&&j.right+k>o.width?"left":"left"==g&&j.left-k<o.left?"right":g,e.removeClass(m).addClass(g)}var p=this.getCalculatedOffset(g,j,k,l);this.applyPlacement(p,g);var q=function(){d.$element.trigger("shown.bs."+d.type),d.hoverState=null};a.support.transition&&this.$tip.hasClass("fade")?e.one("bsTransitionEnd",q).emulateTransitionEnd(150):q()}},c.prototype.applyPlacement=function(b,c){var d=this.tip(),e=d[0].offsetWidth,f=d[0].offsetHeight,g=parseInt(d.css("margin-top"),10),h=parseInt(d.css("margin-left"),10);isNaN(g)&&(g=0),isNaN(h)&&(h=0),b.top=b.top+g,b.left=b.left+h,a.offset.setOffset(d[0],a.extend({using:function(a){d.css({top:Math.round(a.top),left:Math.round(a.left)})}},b),0),d.addClass("in");var i=d[0].offsetWidth,j=d[0].offsetHeight;"top"==c&&j!=f&&(b.top=b.top+f-j);var k=this.getViewportAdjustedDelta(c,b,i,j);k.left?b.left+=k.left:b.top+=k.top;var l=k.left?2*k.left-e+i:2*k.top-f+j,m=k.left?"left":"top",n=k.left?"offsetWidth":"offsetHeight";d.offset(b),this.replaceArrow(l,d[0][n],m)},c.prototype.replaceArrow=function(a,b,c){this.arrow().css(c,a?50*(1-a/b)+"%":"")},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},c.prototype.hide=function(){function b(){"in"!=c.hoverState&&d.detach(),c.$element.trigger("hidden.bs."+c.type)}var c=this,d=this.tip(),e=a.Event("hide.bs."+this.type);return this.$element.removeAttr("aria-describedby"),this.$element.trigger(e),e.isDefaultPrevented()?void 0:(d.removeClass("in"),a.support.transition&&this.$tip.hasClass("fade")?d.one("bsTransitionEnd",b).emulateTransitionEnd(150):b(),this.hoverState=null,this)},c.prototype.fixTitle=function(){var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("data-original-title"))&&a.attr("data-original-title",a.attr("title")||"").attr("title","")},c.prototype.hasContent=function(){return this.getTitle()},c.prototype.getPosition=function(b){b=b||this.$element;var c=b[0],d="BODY"==c.tagName;return a.extend({},"function"==typeof c.getBoundingClientRect?c.getBoundingClientRect():null,{scroll:d?document.documentElement.scrollTop||document.body.scrollTop:b.scrollTop(),width:d?a(window).width():b.outerWidth(),height:d?a(window).height():b.outerHeight()},d?{top:0,left:0}:b.offset())},c.prototype.getCalculatedOffset=function(a,b,c,d){return"bottom"==a?{top:b.top+b.height,left:b.left+b.width/2-c/2}:"top"==a?{top:b.top-d,left:b.left+b.width/2-c/2}:"left"==a?{top:b.top+b.height/2-d/2,left:b.left-c}:{top:b.top+b.height/2-d/2,left:b.left+b.width}},c.prototype.getViewportAdjustedDelta=function(a,b,c,d){var e={top:0,left:0};if(!this.$viewport)return e;var f=this.options.viewport&&this.options.viewport.padding||0,g=this.getPosition(this.$viewport);if(/right|left/.test(a)){var h=b.top-f-g.scroll,i=b.top+f-g.scroll+d;h<g.top?e.top=g.top-h:i>g.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;j<g.left?e.left=g.left-j:k>g.width&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){return this.$tip=this.$tip||a(this.options.template)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.validate=function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),c.tip().hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){clearTimeout(this.timeout),this.hide().$element.off("."+this.type).removeData("bs."+this.type)};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof b&&b;(e||"destroy"!=b)&&(e||d.data("bs.popover",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");c.VERSION="3.2.0",c.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").empty()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},c.prototype.tip=function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function b(c,d){var e=a.proxy(this.process,this);this.$body=a("body"),this.$scrollElement=a(a(c).is("body")?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",e),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.2.0",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b="offset",c=0;a.isWindow(this.$scrollElement[0])||(b="position",c=this.$scrollElement.scrollTop()),this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight();var d=this;this.$body.find(this.selector).map(function(){var d=a(this),e=d.data("target")||d.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[b]().top+c,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){d.offsets.push(this[0]),d.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b<=e[0])return g!=(a=f[0])&&this.activate(a);for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(!e[a+1]||b<=e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,a(this.selector).parentsUntil(this.options.target,".active").removeClass("active");var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")};var d=a.fn.scrollspy;a.fn.scrollspy=c,a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=d,this},a(window).on("load.bs.scrollspy.data-api",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);c.call(b,b.data())})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new c(this)),"string"==typeof b&&e[b]()})}var c=function(b){this.element=a(b)};c.VERSION="3.2.0",c.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a")[0],f=a.Event("show.bs.tab",{relatedTarget:e});if(b.trigger(f),!f.isDefaultPrevented()){var g=a(d);this.activate(b.closest("li"),c),this.activate(g,g.parent(),function(){b.trigger({type:"shown.bs.tab",relatedTarget:e})})}}},c.prototype.activate=function(b,c,d){function e(){f.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),g?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var f=c.find("> .active"),g=d&&a.support.transition&&f.hasClass("fade");g?f.one("bsTransitionEnd",e).emulateTransitionEnd(150):e(),f.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this},a(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(c){c.preventDefault(),b.call(a(this),"show")})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof b&&b;e||d.data("bs.affix",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=this.unpin=this.pinnedOffset=null,this.checkPosition()};c.VERSION="3.2.0",c.RESET="affix affix-top affix-bottom",c.DEFAULTS={offset:0,target:window},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=a(document).height(),d=this.$target.scrollTop(),e=this.$element.offset(),f=this.options.offset,g=f.top,h=f.bottom;"object"!=typeof f&&(h=g=f),"function"==typeof g&&(g=f.top(this.$element)),"function"==typeof h&&(h=f.bottom(this.$element));var i=null!=this.unpin&&d+this.unpin<=e.top?!1:null!=h&&e.top+this.$element.height()>=b-h?"bottom":null!=g&&g>=d?"top":!1;if(this.affixed!==i){null!=this.unpin&&this.$element.css("top","");var j="affix"+(i?"-"+i:""),k=a.Event(j+".bs.affix");this.$element.trigger(k),k.isDefaultPrevented()||(this.affixed=i,this.unpin="bottom"==i?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(j).trigger(a.Event(j.replace("affix","affixed"))),"bottom"==i&&this.$element.offset({top:b-this.$element.height()-h}))}}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},d.offsetBottom&&(d.offset.bottom=d.offsetBottom),d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery);
kenwilcox/ui-grid
misc/site/js/bootstrap.min.js
JavaScript
mit
31,819
typeof YUI!="undefined"&&(YUI._YUI=YUI);var YUI=function(){var e=0,t=this,n=arguments,r=n.length,i=function(e,t){return e&&e.hasOwnProperty&&e instanceof t},s=typeof YUI_config!="undefined"&&YUI_config;i(t,YUI)?(t._init(),YUI.GlobalConfig&&t.applyConfig(YUI.GlobalConfig),s&&t.applyConfig(s),r||t._setup()):t=new YUI;if(r){for(;e<r;e++)t.applyConfig(n[e]);t._setup()}return t.instanceOf=i,t};(function(){var e,t,n="@VERSION@",r=".",i="http://yui.yahooapis.com/",s="yui3-js-enabled",o="yui3-css-stamp",u=function(){},a=Array.prototype.slice,f={"io.xdrReady":1,"io.xdrResponse":1,"SWF.eventHandler":1},l=typeof window!="undefined",c=l?window:null,h=l?c.document:null,p=h&&h.documentElement,d=p&&p.className,v={},m=(new Date).getTime(),g=function(e,t,n,r){e&&e.addEventListener?e.addEventListener(t,n,r):e&&e.attachEvent&&e.attachEvent("on"+t,n)},y=function(e,t,n,r){if(e&&e.removeEventListener)try{e.removeEventListener(t,n,r)}catch(i){}else e&&e.detachEvent&&e.detachEvent("on"+t,n)},b=function(){YUI.Env.windowLoaded=!0,YUI.Env.DOMReady=!0,l&&y(window,"load",b)},w=function(e,t){var n=e.Env._loader,r=["loader-base"],i=YUI.Env,s=i.mods;return n?(n.ignoreRegistered=!1,n.onEnd=null,n.data=null,n.required=[],n.loadType=null):(n=new e.Loader(e.config),e.Env._loader=n),s&&s.loader&&(r=[].concat(r,YUI.Env.loaderExtras)),YUI.Env.core=e.Array.dedupe([].concat(YUI.Env.core,r)),n},E=function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},S={success:!0};p&&d.indexOf(s)==-1&&(d&&(d+=" "),d+=s,p.className=d),n.indexOf("@")>-1&&(n="3.5.0"),e={applyConfig:function(e){e=e||u;var t,n,r=this.config,i=r.modules,s=r.groups,o=r.aliases,a=this.Env._loader;for(n in e)e.hasOwnProperty(n)&&(t=e[n],i&&n=="modules"?E(i,t):o&&n=="aliases"?E(o,t):s&&n=="groups"?E(s,t):n=="win"?(r[n]=t&&t.contentWindow||t,r.doc=r[n]?r[n].document:null):n!="_yuid"&&(r[n]=t));a&&a._config(e)},_config:function(e){this.applyConfig(e)},_init:function(){var e,t,r=this,s=YUI.Env,u=r.Env,a;r.version=n;if(!u){r.Env={core:["get","features","intl-base","yui-log","yui-later"],loaderExtras:["loader-rollup","loader-yui3"],mods:{},versions:{},base:i,cdn:i+n+"/build/",_idx:0,_used:{},_attached:{},_missed:[],_yidx:0,_uidx:0,_guidp:"y",_loaded:{},_BASE_RE:/(?:\?(?:[^&]*&)*([^&]*))?\b(simpleyui|yui(?:-\w+)?)\/\2(?:-(min|debug))?\.js/,parseBasePath:function(e,t){var n=e.match(t),r,i;return n&&(r=RegExp.leftContext||e.slice(0,e.indexOf(n[0])),i=n[3],n[1]&&(r+="?"+n[1]),r={filter:i,path:r}),r},getBase:s&&s.getBase||function(t){var n=h&&h.getElementsByTagName("script")||[],i=u.cdn,s,o,a,f;for(o=0,a=n.length;o<a;++o){f=n[o].src;if(f){s=r.Env.parseBasePath(f,t);if(s){e=s.filter,i=s.path;break}}}return i}},u=r.Env,u._loaded[n]={};if(s&&r!==YUI)u._yidx=++s._yidx,u._guidp=("yui_"+n+"_"+u._yidx+"_"+m).replace(/[^a-z0-9_]+/g,"_");else if(YUI._YUI){s=YUI._YUI.Env,u._yidx+=s._yidx,u._uidx+=s._uidx;for(a in s)a in u||(u[a]=s[a]);delete YUI._YUI}r.id=r.stamp(r),v[r.id]=r}r.constructor=YUI,r.config=r.config||{bootstrap:!0,cacheUse:!0,debug:!0,doc:h,fetchCSS:!0,throwFail:!0,useBrowserConsole:!0,useNativeES5:!0,win:c,global:Function("return this")()},h&&!h.getElementById(o)?(t=h.createElement("div"),t.innerHTML='<div id="'+o+'" style="position: absolute !important; visibility: hidden !important"></div>',YUI.Env.cssStampEl=t.firstChild,h.body?h.body.appendChild(YUI.Env.cssStampEl):p.insertBefore(YUI.Env.cssStampEl,p.firstChild)):h&&h.getElementById(o)&&!YUI.Env.cssStampEl&&(YUI.Env.cssStampEl=h.getElementById(o)),r.config.lang=r.config.lang||"en-US",r.config.base=YUI.config.base||r.Env.getBase(r.Env._BASE_RE);if(!e||!"mindebug".indexOf(e))e="min";e=e?"-"+e:e,r.config.loaderPath=YUI.config.loaderPath||"loader/loader"+e+".js"},_setup:function(){var e,t=this,n=[],r=YUI.Env.mods,i=t.config.core||[].concat(YUI.Env.core);for(e=0;e<i.length;e++)r[i[e]]&&n.push(i[e]);t._attach(["yui-base"]),t._attach(n),t.Loader&&w(t)},applyTo:function(e,t,n){if(t in f){var r=v[e],i,s,o;if(r){i=t.split("."),s=r;for(o=0;o<i.length;o+=1)s=s[i[o]],s||this.log("applyTo not found: "+t,"warn","yui");return s&&s.apply(r,n)}return null}return this.log(t+": applyTo not allowed","warn","yui"),null},add:function(e,t,n,r){r=r||{};var i=YUI.Env,s={name:e,fn:t,version:n,details:r},o={},u,a,f,l=i.versions;i.mods[e]=s,l[n]=l[n]||{},l[n][e]=s;for(f in v)v.hasOwnProperty(f)&&(a=v[f],o[a.id]||(o[a.id]=!0,u=a.Env._loader,u&&(!u.moduleInfo[e]||u.moduleInfo[e].temp)&&u.addModule(r,e)));return this},_attach:function(e,t){var n,r,i,s,o,u,a,f=YUI.Env.mods,l=YUI.Env.aliases,c=this,h,p=YUI.Env._renderedMods,d=c.Env._loader,v=c.Env._attached,m=e.length,d,g,y,b=[];for(n=0;n<m;n++){r=e[n],i=f[r],b.push(r);if(d&&d.conditions[r])for(h in d.conditions[r])d.conditions[r].hasOwnProperty(h)&&(g=d.conditions[r][h],y=g&&(g.ua&&c.UA[g.ua]||g.test&&g.test(c)),y&&b.push(g.name))}e=b,m=e.length;for(n=0;n<m;n++)if(!v[e[n]]){r=e[n],i=f[r];if(l&&l[r]&&!i){c._attach(l[r]);continue}if(!i)d&&d.moduleInfo[r]&&(i=d.moduleInfo[r],t=!0),!t&&r&&r.indexOf("skin-")===-1&&r.indexOf("css")===-1&&(c.Env._missed.push(r),c.Env._missed=c.Array.dedupe(c.Env._missed),c.message("NOT loaded: "+r,"warn","yui"));else{v[r]=!0;for(h=0;h<c.Env._missed.length;h++)c.Env._missed[h]===r&&(c.message("Found: "+r+" (was reported as missing earlier)","warn","yui"),c.Env._missed.splice(h,1));if(d&&p&&p[r]&&p[r].temp){d.getRequires(p[r]),o=[];for(h in d.moduleInfo[r].expanded_map)d.moduleInfo[r].expanded_map.hasOwnProperty(h)&&o.push(h);c._attach(o)}s=i.details,o=s.requires,u=s.use,a=s.after,s.lang&&(o=o||[],o.unshift("intl"));if(o)for(h=0;h<o.length;h++)if(!v[o[h]]){if(!c._attach(o))return!1;break}if(a)for(h=0;h<a.length;h++)if(!v[a[h]]){if(!c._attach(a,!0))return!1;break}if(i.fn)if(c.config.throwFail)i.fn(c,r);else try{i.fn(c,r)}catch(w){return c.error("Attach error: "+r,w,r),!1}if(u)for(h=0;h<u.length;h++)if(!v[u[h]]){if(!c._attach(u))return!1;break}}}return!0},_delayCallback:function(e,t){var n=this,r=["event-base"];return t=n.Lang.isObject(t)?t:{event:t},t.event==="load"&&r.push("event-synthetic" ),function(){var i=arguments;n._use(r,function(){n.on(t.event,function(){i[1].delayUntil=t.event,e.apply(n,i)},t.args)})}},use:function(){var e=a.call(arguments,0),t=e[e.length-1],n=this,r=0,i,s=n.Env,o=!0;n.Lang.isFunction(t)?(e.pop(),n.config.delayUntil&&(t=n._delayCallback(t,n.config.delayUntil))):t=null,n.Lang.isArray(e[0])&&(e=e[0]);if(n.config.cacheUse){while(i=e[r++])if(!s._attached[i]){o=!1;break}if(o)return e.length,n._notify(t,S,e),n}return n._loading?(n._useQueue=n._useQueue||new n.Queue,n._useQueue.add([e,t])):n._use(e,function(n,r){n._notify(t,r,e)}),n},_notify:function(e,t,n){if(!t.success&&this.config.loadErrorFn)this.config.loadErrorFn.call(this,this,e,t,n);else if(e){this.Env._missed&&this.Env._missed.length&&(t.msg="Missing modules: "+this.Env._missed.join(),t.success=!1);if(this.config.throwFail)e(this,t);else try{e(this,t)}catch(r){this.error("use callback error",r,n)}}},_use:function(e,t){this.Array||this._attach(["yui-base"]);var r,i,s,o=this,u=YUI.Env,a=u.mods,f=o.Env,l=f._used,c=u.aliases,h=u._loaderQueue,p=e[0],d=o.Array,v=o.config,m=v.bootstrap,g=[],y,b=[],E=!0,S=v.fetchCSS,x=function(e,t){var r=0,i=[],s,o,f,h,p;if(!e.length)return;if(c){o=e.length;for(r=0;r<o;r++)c[e[r]]&&!a[e[r]]?i=[].concat(i,c[e[r]]):i.push(e[r]);e=i}o=e.length;for(r=0;r<o;r++){s=e[r],t||b.push(s);if(l[s])continue;f=a[s],h=null,p=null,f?(l[s]=!0,h=f.details.requires,p=f.details.use):u._loaded[n][s]?l[s]=!0:g.push(s),h&&h.length&&x(h),p&&p.length&&x(p,1)}},T=function(n){var r=n||{success:!0,msg:"not dynamic"},i,s,u=!0,a=r.data;o._loading=!1,a&&(s=g,g=[],b=[],x(a),i=g.length,i&&[].concat(g).sort().join()==s.sort().join()&&(i=!1)),i&&a?(o._loading=!0,o._use(g,function(){o._attach(a)&&o._notify(t,r,a)})):(a&&(u=o._attach(a)),u&&o._notify(t,r,e)),o._useQueue&&o._useQueue.size()&&!o._loading&&o._use.apply(o,o._useQueue.next())};if(p==="*"){e=[];for(y in a)a.hasOwnProperty(y)&&e.push(y);return E=o._attach(e),E&&T(),o}return(a.loader||a["loader-base"])&&!o.Loader&&o._attach(["loader"+(a.loader?"":"-base")]),m&&o.Loader&&e.length&&(i=w(o),i.require(e),i.ignoreRegistered=!0,i._boot=!0,i.calculate(null,S?null:"js"),e=i.sorted,i._boot=!1),x(e),r=g.length,r&&(g=d.dedupe(g),r=g.length),m&&r&&o.Loader?(o._loading=!0,i=w(o),i.onEnd=T,i.context=o,i.data=e,i.ignoreRegistered=!1,i.require(g),i.insert(null,S?null:"js")):m&&r&&o.Get&&!f.bootstrapped?(o._loading=!0,s=function(){o._loading=!1,h.running=!1,f.bootstrapped=!0,u._bootstrapping=!1,o._attach(["loader"])&&o._use(e,t)},u._bootstrapping?h.add(s):(u._bootstrapping=!0,o.Get.script(v.base+v.loaderPath,{onEnd:s}))):(E=o._attach(e),E&&T()),o},namespace:function(){var e=arguments,t,n=0,i,s,o;for(;n<e.length;n++){t=this,o=e[n];if(o.indexOf(r)>-1){s=o.split(r);for(i=s[0]=="YAHOO"?1:0;i<s.length;i++)t[s[i]]=t[s[i]]||{},t=t[s[i]]}else t[o]=t[o]||{},t=t[o]}return t},log:u,message:u,dump:function(e){return""+e},error:function(e,t,n){var r=this,i;r.config.errorFn&&(i=r.config.errorFn.apply(r,arguments));if(!i)throw t||new Error(e);return r.message(e,"error",""+n),r},guid:function(e){var t=this.Env._guidp+"_"+ ++this.Env._uidx;return e?e+t:t},stamp:function(e,t){var n;if(!e)return e;e.uniqueID&&e.nodeType&&e.nodeType!==9?n=e.uniqueID:n=typeof e=="string"?e:e._yuid;if(!n){n=this.guid();if(!t)try{e._yuid=n}catch(r){n=null}}return n},destroy:function(){var e=this;e.Event&&e.Event._unload(),delete v[e.id],delete e.Env,delete e.config}},YUI.prototype=e;for(t in e)e.hasOwnProperty(t)&&(YUI[t]=e[t]);YUI.applyConfig=function(e){if(!e)return;YUI.GlobalConfig&&this.prototype.applyConfig.call(this,YUI.GlobalConfig),this.prototype.applyConfig.call(this,e),YUI.GlobalConfig=this.config},YUI._init(),l?g(window,"load",b):b(),YUI.Env.add=g,YUI.Env.remove=y,typeof exports=="object"&&(exports.YUI=YUI,YUI.setLoadHook=function(e){YUI._getLoadHook=e},YUI._getLoadHook=null),YUI.Env[n]={}})(),YUI.add("yui-base",function(e,t){function m(e,t,n){var r,i;t||(t=0);if(n||m.test(e))try{return d.slice.call(e,t)}catch(s){i=[];for(r=e.length;t<r;++t)i.push(e[t]);return i}return[e]}function g(){this._init(),this.add.apply(this,arguments)}var n=e.Lang||(e.Lang={}),r=String.prototype,i=Object.prototype.toString,s={"undefined":"undefined",number:"number","boolean":"boolean",string:"string","[object Function]":"function","[object RegExp]":"regexp","[object Array]":"array","[object Date]":"date","[object Error]":"error"},o=/\{\s*([^|}]+?)\s*(?:\|([^}]*))?\s*\}/g,u=" \n \f\r \u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u2028\u2029\u202f\u205f\u3000\ufeff",a="[ -\r \u00a0\u1680\u180e\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+",f=new RegExp("^"+a),l=new RegExp(a+"$"),c=new RegExp(f.source+"|"+l.source,"g"),h=/\{\s*\[(?:native code|function)\]\s*\}/i;n._isNative=function(t){return!!(e.config.useNativeES5&&t&&h.test(t))},n.isArray=n._isNative(Array.isArray)?Array.isArray:function(e){return n.type(e)==="array"},n.isBoolean=function(e){return typeof e=="boolean"},n.isDate=function(e){return n.type(e)==="date"&&e.toString()!=="Invalid Date"&&!isNaN(e)},n.isFunction=function(e){return n.type(e)==="function"},n.isNull=function(e){return e===null},n.isNumber=function(e){return typeof e=="number"&&isFinite(e)},n.isObject=function(e,t){var r=typeof e;return e&&(r==="object"||!t&&(r==="function"||n.isFunction(e)))||!1},n.isString=function(e){return typeof e=="string"},n.isUndefined=function(e){return typeof e=="undefined"},n.isValue=function(e){var t=n.type(e);switch(t){case"number":return isFinite(e);case"null":case"undefined":return!1;default:return!!t}},n.now=Date.now||function(){return(new Date).getTime()},n.sub=function(e,t){return e.replace?e.replace(o,function(e,r){return n.isUndefined(t[r])?e:t[r]}):e},n.trim=n._isNative(r.trim)&&!u.trim()?function(e){return e&&e.trim?e.trim():e}:function(e){try{return e.replace(c,"")}catch(t){return e}},n.trimLeft=n._isNative(r.trimLeft)&&!u.trimLeft()?function(e){return e.trimLeft()}:function(e){return e.replace(f,"")},n.trimRight=n. _isNative(r.trimRight)&&!u.trimRight()?function(e){return e.trimRight()}:function(e){return e.replace(l,"")},n.type=function(e){return s[typeof e]||s[i.call(e)]||(e?"object":"null")};var p=e.Lang,d=Array.prototype,v=Object.prototype.hasOwnProperty;e.Array=m,m.dedupe=p._isNative(Object.create)?function(e){var t=Object.create(null),n=[],r,i,s;for(r=0,s=e.length;r<s;++r)i=e[r],t[i]||(t[i]=1,n.push(i));return n}:function(e){var t={},n=[],r,i,s;for(r=0,s=e.length;r<s;++r)i=e[r],v.call(t,i)||(t[i]=1,n.push(i));return n},m.each=m.forEach=p._isNative(d.forEach)?function(t,n,r){return d.forEach.call(t||[],n,r||e),e}:function(t,n,r){for(var i=0,s=t&&t.length||0;i<s;++i)i in t&&n.call(r||e,t[i],i,t);return e},m.hash=function(e,t){var n={},r=t&&t.length||0,i,s;for(i=0,s=e.length;i<s;++i)i in e&&(n[e[i]]=r>i&&i in t?t[i]:!0);return n},m.indexOf=p._isNative(d.indexOf)?function(e,t,n){return d.indexOf.call(e,t,n)}:function(e,t,n){var r=e.length;n=+n||0,n=(n>0||-1)*Math.floor(Math.abs(n)),n<0&&(n+=r,n<0&&(n=0));for(;n<r;++n)if(n in e&&e[n]===t)return n;return-1},m.numericSort=function(e,t){return e-t},m.some=p._isNative(d.some)?function(e,t,n){return d.some.call(e,t,n)}:function(e,t,n){for(var r=0,i=e.length;r<i;++r)if(r in e&&t.call(n,e[r],r,e))return!0;return!1},m.test=function(e){var t=0;if(p.isArray(e))t=1;else if(p.isObject(e))try{"length"in e&&!e.tagName&&(!e.scrollTo||!e.document)&&!e.apply&&(t=2)}catch(n){}return t},g.prototype={_init:function(){this._q=[]},next:function(){return this._q.shift()},last:function(){return this._q.pop()},add:function(){return this._q.push.apply(this._q,arguments),this},size:function(){return this._q.length}},e.Queue=g,YUI.Env._loaderQueue=YUI.Env._loaderQueue||new g;var y="__",v=Object.prototype.hasOwnProperty,b=e.Lang.isObject;e.cached=function(e,t,n){return t||(t={}),function(r){var i=arguments.length>1?Array.prototype.join.call(arguments,y):String(r);if(!(i in t)||n&&t[i]==n)t[i]=e.apply(e,arguments);return t[i]}},e.getLocation=function(){var t=e.config.win;return t&&t.location},e.merge=function(){var e=0,t=arguments.length,n={},r,i;for(;e<t;++e){i=arguments[e];for(r in i)v.call(i,r)&&(n[r]=i[r])}return n},e.mix=function(t,n,r,i,s,o){var u,a,f,l,c,h,p;if(!t||!n)return t||e;if(s){s===2&&e.mix(t.prototype,n.prototype,r,i,0,o),f=s===1||s===3?n.prototype:n,p=s===1||s===4?t.prototype:t;if(!f||!p)return t}else f=n,p=t;u=r&&!o;if(i)for(l=0,h=i.length;l<h;++l){c=i[l];if(!v.call(f,c))continue;a=u?!1:c in p;if(o&&a&&b(p[c],!0)&&b(f[c],!0))e.mix(p[c],f[c],r,null,0,o);else if(r||!a)p[c]=f[c]}else{for(c in f){if(!v.call(f,c))continue;a=u?!1:c in p;if(o&&a&&b(p[c],!0)&&b(f[c],!0))e.mix(p[c],f[c],r,null,0,o);else if(r||!a)p[c]=f[c]}e.Object._hasEnumBug&&e.mix(p,f,r,e.Object._forceEnum,s,o)}return t};var p=e.Lang,v=Object.prototype.hasOwnProperty,w,E=e.Object=p._isNative(Object.create)?function(e){return Object.create(e)}:function(){function e(){}return function(t){return e.prototype=t,new e}}(),S=E._forceEnum=["hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toString","toLocaleString","valueOf"],x=E._hasEnumBug=!{valueOf:0}.propertyIsEnumerable("valueOf"),T=E._hasProtoEnumBug=function(){}.propertyIsEnumerable("prototype"),N=E.owns=function(e,t){return!!e&&v.call(e,t)};E.hasKey=N,E.keys=p._isNative(Object.keys)&&!T?Object.keys:function(e){if(!p.isObject(e))throw new TypeError("Object.keys called on a non-object");var t=[],n,r,i;if(T&&typeof e=="function")for(r in e)N(e,r)&&r!=="prototype"&&t.push(r);else for(r in e)N(e,r)&&t.push(r);if(x)for(n=0,i=S.length;n<i;++n)r=S[n],N(e,r)&&t.push(r);return t},E.values=function(e){var t=E.keys(e),n=0,r=t.length,i=[];for(;n<r;++n)i.push(e[t[n]]);return i},E.size=function(e){try{return E.keys(e).length}catch(t){return 0}},E.hasValue=function(t,n){return e.Array.indexOf(E.values(t),n)>-1},E.each=function(t,n,r,i){var s;for(s in t)(i||N(t,s))&&n.call(r||e,t[s],s,t);return e},E.some=function(t,n,r,i){var s;for(s in t)if(i||N(t,s))if(n.call(r||e,t[s],s,t))return!0;return!1},E.getValue=function(t,n){if(!p.isObject(t))return w;var r,i=e.Array(n),s=i.length;for(r=0;t!==w&&r<s;r++)t=t[i[r]];return t},E.setValue=function(t,n,r){var i,s=e.Array(n),o=s.length-1,u=t;if(o>=0){for(i=0;u!==w&&i<o;i++)u=u[s[i]];if(u===w)return w;u[s[i]]=r}return t},E.isEmpty=function(e){return!E.keys(Object(e)).length},YUI.Env.parseUA=function(t){var n=function(e){var t=0;return parseFloat(e.replace(/\./g,function(){return t++===1?"":"."}))},r=e.config.win,i=r&&r.navigator,s={ie:0,opera:0,gecko:0,webkit:0,safari:0,chrome:0,mobile:null,air:0,phantomjs:0,ipad:0,iphone:0,ipod:0,ios:null,android:0,silk:0,accel:!1,webos:0,caja:i&&i.cajaVersion,secure:!1,os:null,nodejs:0,winjs:typeof Windows!="undefined"&&!!Windows.System,touchEnabled:!1},o=t||i&&i.userAgent,u=r&&r.location,a=u&&u.href,f;return s.userAgent=o,s.secure=a&&a.toLowerCase().indexOf("https")===0,o&&(/windows|win32/i.test(o)?s.os="windows":/macintosh|mac_powerpc/i.test(o)?s.os="macintosh":/android/i.test(o)?s.os="android":/symbos/i.test(o)?s.os="symbos":/linux/i.test(o)?s.os="linux":/rhino/i.test(o)&&(s.os="rhino"),/KHTML/.test(o)&&(s.webkit=1),/IEMobile|XBLWP7/.test(o)&&(s.mobile="windows"),/Fennec/.test(o)&&(s.mobile="gecko"),f=o.match(/AppleWebKit\/([^\s]*)/),f&&f[1]&&(s.webkit=n(f[1]),s.safari=s.webkit,/PhantomJS/.test(o)&&(f=o.match(/PhantomJS\/([^\s]*)/),f&&f[1]&&(s.phantomjs=n(f[1]))),/ Mobile\//.test(o)||/iPad|iPod|iPhone/.test(o)?(s.mobile="Apple",f=o.match(/OS ([^\s]*)/),f&&f[1]&&(f=n(f[1].replace("_","."))),s.ios=f,s.os="ios",s.ipad=s.ipod=s.iphone=0,f=o.match(/iPad|iPod|iPhone/),f&&f[0]&&(s[f[0].toLowerCase()]=s.ios)):(f=o.match(/NokiaN[^\/]*|webOS\/\d\.\d/),f&&(s.mobile=f[0]),/webOS/.test(o)&&(s.mobile="WebOS",f=o.match(/webOS\/([^\s]*);/),f&&f[1]&&(s.webos=n(f[1]))),/ Android/.test(o)&&(/Mobile/.test(o)&&(s.mobile="Android"),f=o.match(/Android ([^\s]*);/),f&&f[1]&&(s.android=n(f[1]))),/Silk/.test(o)&&(f=o.match(/Silk\/([^\s]*)\)/),f&&f[1]&&(s.silk=n(f[1])),s.android||(s.android=2.34,s.os="Android"),/Accelerated=true/ .test(o)&&(s.accel=!0))),f=o.match(/OPR\/(\d+\.\d+)/),f&&f[1]?s.opera=n(f[1]):(f=o.match(/(Chrome|CrMo|CriOS)\/([^\s]*)/),f&&f[1]&&f[2]?(s.chrome=n(f[2]),s.safari=0,f[1]==="CrMo"&&(s.mobile="chrome")):(f=o.match(/AdobeAIR\/([^\s]*)/),f&&(s.air=f[0])))),s.webkit||(/Opera/.test(o)?(f=o.match(/Opera[\s\/]([^\s]*)/),f&&f[1]&&(s.opera=n(f[1])),f=o.match(/Version\/([^\s]*)/),f&&f[1]&&(s.opera=n(f[1])),/Opera Mobi/.test(o)&&(s.mobile="opera",f=o.replace("Opera Mobi","").match(/Opera ([^\s]*)/),f&&f[1]&&(s.opera=n(f[1]))),f=o.match(/Opera Mini[^;]*/),f&&(s.mobile=f[0])):(f=o.match(/MSIE ([^;]*)|Trident.*; rv:([0-9.]+)/),f&&(f[1]||f[2])?s.ie=n(f[1]||f[2]):(f=o.match(/Gecko\/([^\s]*)/),f&&(s.gecko=1,f=o.match(/rv:([^\s\)]*)/),f&&f[1]&&(s.gecko=n(f[1]),/Mobile|Tablet/.test(o)&&(s.mobile="ffos"))))))),r&&i&&!(s.chrome&&s.chrome<6)&&(s.touchEnabled="ontouchstart"in r||"msMaxTouchPoints"in i&&i.msMaxTouchPoints>0),t||(typeof process=="object"&&process.versions&&process.versions.node&&(s.os=process.platform,s.nodejs=n(process.versions.node)),YUI.Env.UA=s),s},e.UA=YUI.Env.UA||YUI.Env.parseUA(),e.UA.compareVersions=function(e,t){var n,r,i,s,o,u;if(e===t)return 0;r=(e+"").split("."),s=(t+"").split(".");for(o=0,u=Math.max(r.length,s.length);o<u;++o){n=parseInt(r[o],10),i=parseInt(s[o],10),isNaN(n)&&(n=0),isNaN(i)&&(i=0);if(n<i)return-1;if(n>i)return 1}return 0},YUI.Env.aliases={anim:["anim-base","anim-color","anim-curve","anim-easing","anim-node-plugin","anim-scroll","anim-xy"],"anim-shape-transform":["anim-shape"],app:["app-base","app-content","app-transitions","lazy-model-list","model","model-list","model-sync-rest","router","view","view-node-map"],attribute:["attribute-base","attribute-complex"],"attribute-events":["attribute-observable"],autocomplete:["autocomplete-base","autocomplete-sources","autocomplete-list","autocomplete-plugin"],axes:["axis-numeric","axis-category","axis-time","axis-stacked"],"axes-base":["axis-numeric-base","axis-category-base","axis-time-base","axis-stacked-base"],base:["base-base","base-pluginhost","base-build"],cache:["cache-base","cache-offline","cache-plugin"],charts:["charts-base"],collection:["array-extras","arraylist","arraylist-add","arraylist-filter","array-invoke"],color:["color-base","color-hsl","color-harmony"],controller:["router"],dataschema:["dataschema-base","dataschema-json","dataschema-xml","dataschema-array","dataschema-text"],datasource:["datasource-local","datasource-io","datasource-get","datasource-function","datasource-cache","datasource-jsonschema","datasource-xmlschema","datasource-arrayschema","datasource-textschema","datasource-polling"],datatable:["datatable-core","datatable-table","datatable-head","datatable-body","datatable-base","datatable-column-widths","datatable-message","datatable-mutable","datatable-sort","datatable-datasource"],datatype:["datatype-date","datatype-number","datatype-xml"],"datatype-date":["datatype-date-parse","datatype-date-format","datatype-date-math"],"datatype-number":["datatype-number-parse","datatype-number-format"],"datatype-xml":["datatype-xml-parse","datatype-xml-format"],dd:["dd-ddm-base","dd-ddm","dd-ddm-drop","dd-drag","dd-proxy","dd-constrain","dd-drop","dd-scroll","dd-delegate"],dom:["dom-base","dom-screen","dom-style","selector-native","selector"],editor:["frame","editor-selection","exec-command","editor-base","editor-para","editor-br","editor-bidi","editor-tab","createlink-base"],event:["event-base","event-delegate","event-synthetic","event-mousewheel","event-mouseenter","event-key","event-focus","event-resize","event-hover","event-outside","event-touch","event-move","event-flick","event-valuechange","event-tap"],"event-custom":["event-custom-base","event-custom-complex"],"event-gestures":["event-flick","event-move"],handlebars:["handlebars-compiler"],highlight:["highlight-base","highlight-accentfold"],history:["history-base","history-hash","history-hash-ie","history-html5"],io:["io-base","io-xdr","io-form","io-upload-iframe","io-queue"],json:["json-parse","json-stringify"],loader:["loader-base","loader-rollup","loader-yui3"],node:["node-base","node-event-delegate","node-pluginhost","node-screen","node-style"],pluginhost:["pluginhost-base","pluginhost-config"],querystring:["querystring-parse","querystring-stringify"],recordset:["recordset-base","recordset-sort","recordset-filter","recordset-indexer"],resize:["resize-base","resize-proxy","resize-constrain"],slider:["slider-base","slider-value-range","clickable-rail","range-slider"],template:["template-base","template-micro"],text:["text-accentfold","text-wordbreak"],widget:["widget-base","widget-htmlparser","widget-skin","widget-uievents"]}},"@VERSION@",{use:["get","features","intl-base","yui-log","yui-later"]}),YUI.add("get",function(e,t){var n=e.Lang,r,i,s;e.Get=i={cssOptions:{attributes:{rel:"stylesheet"},doc:e.config.linkDoc||e.config.doc,pollInterval:50},jsOptions:{autopurge:!0,doc:e.config.scriptDoc||e.config.doc},options:{attributes:{charset:"utf-8"},purgethreshold:20},REGEX_CSS:/\.css(?:[?;].*)?$/i,REGEX_JS:/\.js(?:[?;].*)?$/i,_insertCache:{},_pending:null,_purgeNodes:[],_queue:[],abort:function(e){var t,n,r,i,s;if(!e.abort){n=e,s=this._pending,e=null;if(s&&s.transaction.id===n)e=s.transaction,this._pending=null;else for(t=0,i=this._queue.length;t<i;++t){r=this._queue[t].transaction;if(r.id===n){e=r,this._queue.splice(t,1);break}}}e&&e.abort()},css:function(e,t,n){return this._load("css",e,t,n)},js:function(e,t,n){return this._load("js",e,t,n)},load:function(e,t,n){return this._load(null,e,t,n)},_autoPurge:function(e){e&&this._purgeNodes.length>=e&&this._purge(this._purgeNodes)},_getEnv:function(){var t=e.config.doc,n=e.UA;return this._env={async:t&&t.createElement("script").async===!0||n.ie>=10,cssFail:n.gecko>=9||n.compareVersions(n.webkit,535.24)>=0,cssLoad:(!n.gecko&&!n.webkit||n.gecko>=9||n.compareVersions(n.webkit,535.24)>=0)&&!(n.chrome&&n.chrome<=18),preservesScriptOrder:!!(n.gecko||n.opera||n.ie&&n.ie>=10)}},_getTransaction:function(t,r){var i=[ ],o,u,a,f;n.isArray(t)||(t=[t]),r=e.merge(this.options,r),r.attributes=e.merge(this.options.attributes,r.attributes);for(o=0,u=t.length;o<u;++o){f=t[o],a={attributes:{}};if(typeof f=="string")a.url=f;else{if(!f.url)continue;e.mix(a,f,!1,null,0,!0),f=f.url}e.mix(a,r,!1,null,0,!0),a.type||(this.REGEX_CSS.test(f)?a.type="css":(!this.REGEX_JS.test(f),a.type="js")),e.mix(a,a.type==="js"?this.jsOptions:this.cssOptions,!1,null,0,!0),a.attributes.id||(a.attributes.id=e.guid()),a.win?a.doc=a.win.document:a.win=a.doc.defaultView||a.doc.parentWindow,a.charset&&(a.attributes.charset=a.charset),i.push(a)}return new s(i,r)},_load:function(e,t,n,r){var s;return typeof n=="function"&&(r=n,n={}),n||(n={}),n.type=e,n._onFinish=i._onTransactionFinish,this._env||this._getEnv(),s=this._getTransaction(t,n),this._queue.push({callback:r,transaction:s}),this._next(),s},_onTransactionFinish:function(){i._pending=null,i._next()},_next:function(){var e;if(this._pending)return;e=this._queue.shift(),e&&(this._pending=e,e.transaction.execute(e.callback))},_purge:function(t){var n=this._purgeNodes,r=t!==n,i,s;while(s=t.pop()){if(!s._yuiget_finished)continue;s.parentNode&&s.parentNode.removeChild(s),r&&(i=e.Array.indexOf(n,s),i>-1&&n.splice(i,1))}}},i.script=i.js,i.Transaction=s=function(t,n){var r=this;r.id=s._lastId+=1,r.data=n.data,r.errors=[],r.nodes=[],r.options=n,r.requests=t,r._callbacks=[],r._queue=[],r._reqsWaiting=0,r.tId=r.id,r.win=n.win||e.config.win},s._lastId=0,s.prototype={_state:"new",abort:function(e){this._pending=null,this._pendingCSS=null,this._pollTimer=clearTimeout(this._pollTimer),this._queue=[],this._reqsWaiting=0,this.errors.push({error:e||"Aborted"}),this._finish()},execute:function(e){var t=this,n=t.requests,r=t._state,i,s,o,u;if(r==="done"){e&&e(t.errors.length?t.errors:null,t);return}e&&t._callbacks.push(e);if(r==="executing")return;t._state="executing",t._queue=o=[],t.options.timeout&&(t._timeout=setTimeout(function(){t.abort("Timeout")},t.options.timeout)),t._reqsWaiting=n.length;for(i=0,s=n.length;i<s;++i)u=n[i],u.async||u.type==="css"?t._insert(u):o.push(u);t._next()},purge:function(){i._purge(this.nodes)},_createNode:function(e,t,n){var i=n.createElement(e),s,o;r||(o=n.createElement("div"),o.setAttribute("class","a"),r=o.className==="a"?{}:{"for":"htmlFor","class":"className"});for(s in t)t.hasOwnProperty(s)&&i.setAttribute(r[s]||s,t[s]);return i},_finish:function(){var e=this.errors.length?this.errors:null,t=this.options,n=t.context||this,r,i,s;if(this._state==="done")return;this._state="done";for(i=0,s=this._callbacks.length;i<s;++i)this._callbacks[i].call(n,e,this);r=this._getEventData(),e?(t.onTimeout&&e[e.length-1].error==="Timeout"&&t.onTimeout.call(n,r),t.onFailure&&t.onFailure.call(n,r)):t.onSuccess&&t.onSuccess.call(n,r),t.onEnd&&t.onEnd.call(n,r),t._onFinish&&t._onFinish()},_getEventData:function(t){return t?e.merge(this,{abort:this.abort,purge:this.purge,request:t,url:t.url,win:t.win}):this},_getInsertBefore:function(t){var n=t.doc,r=t.insertBefore,s,o;return r?typeof r=="string"?n.getElementById(r):r:(s=i._insertCache,o=e.stamp(n),(r=s[o])?r:(r=n.getElementsByTagName("base")[0])?s[o]=r:(r=n.head||n.getElementsByTagName("head")[0],r?(r.appendChild(n.createTextNode("")),s[o]=r.lastChild):s[o]=n.getElementsByTagName("script")[0]))},_insert:function(t){function c(){u._progress("Failed to load "+t.url,t)}function h(){f&&clearTimeout(f),u._progress(null,t)}var n=i._env,r=this._getInsertBefore(t),s=t.type==="js",o=t.node,u=this,a=e.UA,f,l;o||(s?l="script":!n.cssLoad&&a.gecko?l="style":l="link",o=t.node=this._createNode(l,t.attributes,t.doc)),s?(o.setAttribute("src",t.url),t.async?o.async=!0:(n.async&&(o.async=!1),n.preservesScriptOrder||(this._pending=t))):!n.cssLoad&&a.gecko?o.innerHTML=(t.attributes.charset?'@charset "'+t.attributes.charset+'";':"")+'@import "'+t.url+'";':o.setAttribute("href",t.url),s&&a.ie&&(a.ie<9||document.documentMode&&document.documentMode<9)?o.onreadystatechange=function(){/loaded|complete/.test(o.readyState)&&(o.onreadystatechange=null,h())}:!s&&!n.cssLoad?this._poll(t):(a.ie>=10?(o.onerror=function(){setTimeout(c,0)},o.onload=function(){setTimeout(h,0)}):(o.onerror=c,o.onload=h),!n.cssFail&&!s&&(f=setTimeout(c,t.timeout||3e3))),this.nodes.push(o),r.parentNode.insertBefore(o,r)},_next:function(){if(this._pending)return;this._queue.length?this._insert(this._queue.shift()):this._reqsWaiting||this._finish()},_poll:function(t){var n=this,r=n._pendingCSS,i=e.UA.webkit,s,o,u,a,f,l;if(t){r||(r=n._pendingCSS=[]),r.push(t);if(n._pollTimer)return}n._pollTimer=null;for(s=0;s<r.length;++s){f=r[s];if(i){l=f.doc.styleSheets,u=l.length,a=f.node.href;while(--u>=0)if(l[u].href===a){r.splice(s,1),s-=1,n._progress(null,f);break}}else try{o=!!f.node.sheet.cssRules,r.splice(s,1),s-=1,n._progress(null,f)}catch(c){}}r.length&&(n._pollTimer=setTimeout(function(){n._poll.call(n)},n.options.pollInterval))},_progress:function(e,t){var n=this.options;e&&(t.error=e,this.errors.push({error:e,request:t})),t.node._yuiget_finished=t.finished=!0,n.onProgress&&n.onProgress.call(n.context||this,this._getEventData(t)),t.autopurge&&(i._autoPurge(this.options.purgethreshold),i._purgeNodes.push(t.node)),this._pending===t&&(this._pending=null),this._reqsWaiting-=1,this._next()}}},"@VERSION@",{requires:["yui-base"]}),YUI.add("features",function(e,t){var n={};e.mix(e.namespace("Features"),{tests:n,add:function(e,t,r){n[e]=n[e]||{},n[e][t]=r},all:function(t,r){var i=n[t],s=[];return i&&e.Object.each(i,function(n,i){s.push(i+":"+(e.Features.test(t,i,r)?1:0))}),s.length?s.join(";"):""},test:function(t,r,i){i=i||[];var s,o,u,a=n[t],f=a&&a[r];return!f||(s=f.result,e.Lang.isUndefined(s)&&(o=f.ua,o&&(s=e.UA[o]),u=f.test,u&&(!o||s)&&(s=u.apply(e,i)),f.result=s)),s}});var r=e.Features.add;r("load","0",{name:"app-transitions-native",test:function(e){var t=e.config.doc,n=t?t.documentElement:null;return n&&n.style?"MozTransition"in n.style||"WebkitTransition"in n.style||"transition"in n.style:!1},trigger:"app-transitions" }),r("load","1",{name:"autocomplete-list-keys",test:function(e){return!e.UA.ios&&!e.UA.android},trigger:"autocomplete-list"}),r("load","2",{name:"dd-gestures",trigger:"dd-drag",ua:"touchEnabled"}),r("load","3",{name:"dom-style-ie",test:function(e){var t=e.Features.test,n=e.Features.add,r=e.config.win,i=e.config.doc,s="documentElement",o=!1;return n("style","computedStyle",{test:function(){return r&&"getComputedStyle"in r}}),n("style","opacity",{test:function(){return i&&"opacity"in i[s].style}}),o=!t("style","opacity")&&!t("style","computedStyle"),o},trigger:"dom-style"}),r("load","4",{name:"editor-para-ie",trigger:"editor-para",ua:"ie",when:"instead"}),r("load","5",{name:"event-base-ie",test:function(e){var t=e.config.doc&&e.config.doc.implementation;return t&&!t.hasFeature("Events","2.0")},trigger:"node-base"}),r("load","6",{name:"graphics-canvas",test:function(e){var t=e.config.doc,n=e.config.defaultGraphicEngine&&e.config.defaultGraphicEngine=="canvas",r=t&&t.createElement("canvas"),i=t&&t.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1");return(!i||n)&&r&&r.getContext&&r.getContext("2d")},trigger:"graphics"}),r("load","7",{name:"graphics-canvas-default",test:function(e){var t=e.config.doc,n=e.config.defaultGraphicEngine&&e.config.defaultGraphicEngine=="canvas",r=t&&t.createElement("canvas"),i=t&&t.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1");return(!i||n)&&r&&r.getContext&&r.getContext("2d")},trigger:"graphics"}),r("load","8",{name:"graphics-svg",test:function(e){var t=e.config.doc,n=!e.config.defaultGraphicEngine||e.config.defaultGraphicEngine!="canvas",r=t&&t.createElement("canvas"),i=t&&t.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1");return i&&(n||!r)},trigger:"graphics"}),r("load","9",{name:"graphics-svg-default",test:function(e){var t=e.config.doc,n=!e.config.defaultGraphicEngine||e.config.defaultGraphicEngine!="canvas",r=t&&t.createElement("canvas"),i=t&&t.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1");return i&&(n||!r)},trigger:"graphics"}),r("load","10",{name:"graphics-vml",test:function(e){var t=e.config.doc,n=t&&t.createElement("canvas");return t&&!t.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")&&(!n||!n.getContext||!n.getContext("2d"))},trigger:"graphics"}),r("load","11",{name:"graphics-vml-default",test:function(e){var t=e.config.doc,n=t&&t.createElement("canvas");return t&&!t.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")&&(!n||!n.getContext||!n.getContext("2d"))},trigger:"graphics"}),r("load","12",{name:"history-hash-ie",test:function(e){var t=e.config.doc&&e.config.doc.documentMode;return e.UA.ie&&(!("onhashchange"in e.config.win)||!t||t<8)},trigger:"history-hash"}),r("load","13",{name:"io-nodejs",trigger:"io-base",ua:"nodejs"}),r("load","14",{name:"json-parse-shim",test:function(e){function i(e,t){return e==="ok"?!0:t}var t=e.config.global.JSON,n=Object.prototype.toString.call(t)==="[object JSON]"&&t,r=e.config.useNativeJSONParse!==!1&&!!n;if(r)try{r=n.parse('{"ok":false}',i).ok}catch(s){r=!1}return!r},trigger:"json-parse"}),r("load","15",{name:"json-stringify-shim",test:function(e){var t=e.config.global.JSON,n=Object.prototype.toString.call(t)==="[object JSON]"&&t,r=e.config.useNativeJSONStringify!==!1&&!!n;if(r)try{r="0"===n.stringify(0)}catch(i){r=!1}return!r},trigger:"json-stringify"}),r("load","16",{name:"scrollview-base-ie",trigger:"scrollview-base",ua:"ie"}),r("load","17",{name:"selector-css2",test:function(e){var t=e.config.doc,n=t&&!("querySelectorAll"in t);return n},trigger:"selector"}),r("load","18",{name:"transition-timer",test:function(e){var t=e.config.doc,n=t?t.documentElement:null,r=!0;return n&&n.style&&(r=!("MozTransition"in n.style||"WebkitTransition"in n.style||"transition"in n.style)),r},trigger:"transition"}),r("load","19",{name:"widget-base-ie",trigger:"widget-base",ua:"ie"}),r("load","20",{name:"yql-jsonp",test:function(e){return!e.UA.nodejs&&!e.UA.winjs},trigger:"yql",when:"after"}),r("load","21",{name:"yql-nodejs",trigger:"yql",ua:"nodejs",when:"after"}),r("load","22",{name:"yql-winjs",trigger:"yql",ua:"winjs",when:"after"})},"@VERSION@",{requires:["yui-base"]}),YUI.add("intl-base",function(e,t){var n=/[, ]/;e.mix(e.namespace("Intl"),{lookupBestLang:function(t,r){function a(e){var t;for(t=0;t<r.length;t+=1)if(e.toLowerCase()===r[t].toLowerCase())return r[t]}var i,s,o,u;e.Lang.isString(t)&&(t=t.split(n));for(i=0;i<t.length;i+=1){s=t[i];if(!s||s==="*")continue;while(s.length>0){o=a(s);if(o)return o;u=s.lastIndexOf("-");if(!(u>=0))break;s=s.substring(0,u),u>=2&&s.charAt(u-2)==="-"&&(s=s.substring(0,u-2))}}return""}})},"@VERSION@",{requires:["yui-base"]}),YUI.add("yui-log",function(e,t){var n=e,r="yui:log",i="undefined",s={debug:1,info:2,warn:4,error:8};n.log=function(e,t,o,u){var a,f,l,c,h,p,d=n,v=d.config,m=d.fire?d:YUI.Env.globalEvents;return v.debug&&(o=o||"",typeof o!="undefined"&&(f=v.logExclude,l=v.logInclude,!l||o in l?l&&o in l?a=!l[o]:f&&o in f&&(a=f[o]):a=1,d.config.logLevel=d.config.logLevel||"debug",p=s[d.config.logLevel.toLowerCase()],t in s&&s[t]<p&&(a=1)),a||(v.useBrowserConsole&&(c=o?o+": "+e:e,d.Lang.isFunction(v.logFn)?v.logFn.call(d,e,t,o):typeof console!==i&&console.log?(h=t&&console[t]&&t in s?t:"log",console[h](c)):typeof opera!==i&&opera.postError(c)),m&&!u&&(m===d&&!m.getEvent(r)&&m.publish(r,{broadcast:2}),m.fire(r,{msg:e,cat:t,src:o})))),d},n.message=function(){return n.log.apply(n,arguments)}},"@VERSION@",{requires:["yui-base"]}),YUI.add("yui-later",function(e,t){var n=[];e.later=function(t,r,i,s,o){t=t||0,s=e.Lang.isUndefined(s)?n:e.Array(s),r=r||e.config.win||e;var u=!1,a=r&&e.Lang.isString(i)?r[i]:i,f=function(){u||(a.apply?a.apply(r,s||n):a(s[0],s[1],s[2],s[3]))},l=o?setInterval(f,t):setTimeout(f,t);return{id:l,interval:o,cancel:function(){u=!0,this.interval?clearInterval(l):clearTimeout(l) }}},e.Lang.later=e.later},"@VERSION@",{requires:["yui-base"]}),YUI.add("yui",function(e,t){},"@VERSION@",{use:["get","features","intl-base","yui-log","yui-later"]}),YUI.add("oop",function(e,t){function a(t,n,i,s,o){if(t&&t[o]&&t!==e)return t[o].call(t,n,i);switch(r.test(t)){case 1:return r[o](t,n,i);case 2:return r[o](e.Array(t,0,!0),n,i);default:return e.Object[o](t,n,i,s)}}var n=e.Lang,r=e.Array,i=Object.prototype,s="_~yuim~_",o=i.hasOwnProperty,u=i.toString;e.augment=function(t,n,r,i,s){var a=t.prototype,f=a&&n,l=n.prototype,c=a||t,h,p,d,v,m;return s=s?e.Array(s):[],f&&(p={},d={},v={},h=function(e,t){if(r||!(t in a))u.call(e)==="[object Function]"?(v[t]=e,p[t]=d[t]=function(){return m(this,e,arguments)}):p[t]=e},m=function(e,t,r){for(var i in v)o.call(v,i)&&e[i]===d[i]&&(e[i]=v[i]);return n.apply(e,s),t.apply(e,r)},i?e.Array.each(i,function(e){e in l&&h(l[e],e)}):e.Object.each(l,h,null,!0)),e.mix(c,p||l,r,i),f||n.apply(c,s),t},e.aggregate=function(t,n,r,i){return e.mix(t,n,r,i,0,!0)},e.extend=function(t,n,r,s){(!n||!t)&&e.error("extend failed, verify dependencies");var o=n.prototype,u=e.Object(o);return t.prototype=u,u.constructor=t,t.superclass=o,n!=Object&&o.constructor==i.constructor&&(o.constructor=n),r&&e.mix(u,r,!0),s&&e.mix(t,s,!0),t},e.each=function(e,t,n,r){return a(e,t,n,r,"each")},e.some=function(e,t,n,r){return a(e,t,n,r,"some")},e.clone=function(t,r,i,o,u,a){var f,l,c;if(!n.isObject(t)||e.instanceOf(t,YUI)||t.addEventListener||t.attachEvent)return t;l=a||{};switch(n.type(t)){case"date":return new Date(t);case"regexp":return t;case"function":return t;case"array":f=[];break;default:if(t[s])return l[t[s]];c=e.guid(),f=r?{}:e.Object(t),t[s]=c,l[c]=t}return e.each(t,function(n,a){(a||a===0)&&(!i||i.call(o||this,n,a,this,t)!==!1)&&a!==s&&a!="prototype"&&(this[a]=e.clone(n,r,i,o,u||t,l))},f),a||(e.Object.each(l,function(e,t){if(e[s])try{delete e[s]}catch(n){e[s]=null}},this),l=null),f},e.bind=function(t,r){var i=arguments.length>2?e.Array(arguments,2,!0):null;return function(){var s=n.isString(t)?r[t]:t,o=i?i.concat(e.Array(arguments,0,!0)):arguments;return s.apply(r||s,o)}},e.rbind=function(t,r){var i=arguments.length>2?e.Array(arguments,2,!0):null;return function(){var s=n.isString(t)?r[t]:t,o=i?e.Array(arguments,0,!0).concat(i):arguments;return s.apply(r||s,o)}}},"@VERSION@",{requires:["yui-base"]}),YUI.add("features",function(e,t){var n={};e.mix(e.namespace("Features"),{tests:n,add:function(e,t,r){n[e]=n[e]||{},n[e][t]=r},all:function(t,r){var i=n[t],s=[];return i&&e.Object.each(i,function(n,i){s.push(i+":"+(e.Features.test(t,i,r)?1:0))}),s.length?s.join(";"):""},test:function(t,r,i){i=i||[];var s,o,u,a=n[t],f=a&&a[r];return!f||(s=f.result,e.Lang.isUndefined(s)&&(o=f.ua,o&&(s=e.UA[o]),u=f.test,u&&(!o||s)&&(s=u.apply(e,i)),f.result=s)),s}});var r=e.Features.add;r("load","0",{name:"app-transitions-native",test:function(e){var t=e.config.doc,n=t?t.documentElement:null;return n&&n.style?"MozTransition"in n.style||"WebkitTransition"in n.style||"transition"in n.style:!1},trigger:"app-transitions"}),r("load","1",{name:"autocomplete-list-keys",test:function(e){return!e.UA.ios&&!e.UA.android},trigger:"autocomplete-list"}),r("load","2",{name:"dd-gestures",trigger:"dd-drag",ua:"touchEnabled"}),r("load","3",{name:"dom-style-ie",test:function(e){var t=e.Features.test,n=e.Features.add,r=e.config.win,i=e.config.doc,s="documentElement",o=!1;return n("style","computedStyle",{test:function(){return r&&"getComputedStyle"in r}}),n("style","opacity",{test:function(){return i&&"opacity"in i[s].style}}),o=!t("style","opacity")&&!t("style","computedStyle"),o},trigger:"dom-style"}),r("load","4",{name:"editor-para-ie",trigger:"editor-para",ua:"ie",when:"instead"}),r("load","5",{name:"event-base-ie",test:function(e){var t=e.config.doc&&e.config.doc.implementation;return t&&!t.hasFeature("Events","2.0")},trigger:"node-base"}),r("load","6",{name:"graphics-canvas",test:function(e){var t=e.config.doc,n=e.config.defaultGraphicEngine&&e.config.defaultGraphicEngine=="canvas",r=t&&t.createElement("canvas"),i=t&&t.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1");return(!i||n)&&r&&r.getContext&&r.getContext("2d")},trigger:"graphics"}),r("load","7",{name:"graphics-canvas-default",test:function(e){var t=e.config.doc,n=e.config.defaultGraphicEngine&&e.config.defaultGraphicEngine=="canvas",r=t&&t.createElement("canvas"),i=t&&t.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1");return(!i||n)&&r&&r.getContext&&r.getContext("2d")},trigger:"graphics"}),r("load","8",{name:"graphics-svg",test:function(e){var t=e.config.doc,n=!e.config.defaultGraphicEngine||e.config.defaultGraphicEngine!="canvas",r=t&&t.createElement("canvas"),i=t&&t.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1");return i&&(n||!r)},trigger:"graphics"}),r("load","9",{name:"graphics-svg-default",test:function(e){var t=e.config.doc,n=!e.config.defaultGraphicEngine||e.config.defaultGraphicEngine!="canvas",r=t&&t.createElement("canvas"),i=t&&t.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1");return i&&(n||!r)},trigger:"graphics"}),r("load","10",{name:"graphics-vml",test:function(e){var t=e.config.doc,n=t&&t.createElement("canvas");return t&&!t.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")&&(!n||!n.getContext||!n.getContext("2d"))},trigger:"graphics"}),r("load","11",{name:"graphics-vml-default",test:function(e){var t=e.config.doc,n=t&&t.createElement("canvas");return t&&!t.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")&&(!n||!n.getContext||!n.getContext("2d"))},trigger:"graphics"}),r("load","12",{name:"history-hash-ie",test:function(e){var t=e.config.doc&&e.config.doc.documentMode;return e.UA.ie&&(!("onhashchange"in e.config.win)||!t||t<8)},trigger:"history-hash"}),r("load","13",{name:"io-nodejs",trigger:"io-base",ua:"nodejs"}),r("load","14",{name :"json-parse-shim",test:function(e){function i(e,t){return e==="ok"?!0:t}var t=e.config.global.JSON,n=Object.prototype.toString.call(t)==="[object JSON]"&&t,r=e.config.useNativeJSONParse!==!1&&!!n;if(r)try{r=n.parse('{"ok":false}',i).ok}catch(s){r=!1}return!r},trigger:"json-parse"}),r("load","15",{name:"json-stringify-shim",test:function(e){var t=e.config.global.JSON,n=Object.prototype.toString.call(t)==="[object JSON]"&&t,r=e.config.useNativeJSONStringify!==!1&&!!n;if(r)try{r="0"===n.stringify(0)}catch(i){r=!1}return!r},trigger:"json-stringify"}),r("load","16",{name:"scrollview-base-ie",trigger:"scrollview-base",ua:"ie"}),r("load","17",{name:"selector-css2",test:function(e){var t=e.config.doc,n=t&&!("querySelectorAll"in t);return n},trigger:"selector"}),r("load","18",{name:"transition-timer",test:function(e){var t=e.config.doc,n=t?t.documentElement:null,r=!0;return n&&n.style&&(r=!("MozTransition"in n.style||"WebkitTransition"in n.style||"transition"in n.style)),r},trigger:"transition"}),r("load","19",{name:"widget-base-ie",trigger:"widget-base",ua:"ie"}),r("load","20",{name:"yql-jsonp",test:function(e){return!e.UA.nodejs&&!e.UA.winjs},trigger:"yql",when:"after"}),r("load","21",{name:"yql-nodejs",trigger:"yql",ua:"nodejs",when:"after"}),r("load","22",{name:"yql-winjs",trigger:"yql",ua:"winjs",when:"after"})},"@VERSION@",{requires:["yui-base"]}),YUI.add("dom-core",function(e,t){var n="nodeType",r="ownerDocument",i="documentElement",s="defaultView",o="parentWindow",u="tagName",a="parentNode",f="previousSibling",l="nextSibling",c="contains",h="compareDocumentPosition",p=[],d=function(){var t=e.config.doc.createElement("div"),n=t.appendChild(e.config.doc.createTextNode("")),r=!1;try{r=t.contains(n)}catch(i){}return r}(),v={byId:function(e,t){return v.allById(e,t)[0]||null},getId:function(e){var t;return e.id&&!e.id.tagName&&!e.id.item?t=e.id:e.attributes&&e.attributes.id&&(t=e.attributes.id.value),t},setId:function(e,t){e.setAttribute?e.setAttribute("id",t):e.id=t},ancestor:function(e,t,n,r){var i=null;return n&&(i=!t||t(e)?e:null),i||v.elementByAxis(e,a,t,null,r)},ancestors:function(e,t,n,r){var i=e,s=[];while(i=v.ancestor(i,t,n,r)){n=!1;if(i){s.unshift(i);if(r&&r(i))return s}}return s},elementByAxis:function(e,t,n,r,i){while(e&&(e=e[t])){if((r||e[u])&&(!n||n(e)))return e;if(i&&i(e))return null}return null},contains:function(e,t){var r=!1;if(!t||!e||!t[n]||!e[n])r=!1;else if(e[c]&&(t[n]===1||d))r=e[c](t);else if(e[h]){if(e===t||!!(e[h](t)&16))r=!0}else r=v._bruteContains(e,t);return r},inDoc:function(e,t){var n=!1,s;return e&&e.nodeType&&(t||(t=e[r]),s=t[i],s&&s.contains&&e.tagName?n=s.contains(e):n=v.contains(s,e)),n},allById:function(t,n){n=n||e.config.doc;var r=[],i=[],s,o;if(n.querySelectorAll)i=n.querySelectorAll('[id="'+t+'"]');else if(n.all){r=n.all(t);if(r){r.nodeName&&(r.id===t?(i.push(r),r=p):r=[r]);if(r.length)for(s=0;o=r[s++];)(o.id===t||o.attributes&&o.attributes.id&&o.attributes.id.value===t)&&i.push(o)}}else i=[v._getDoc(n).getElementById(t)];return i},isWindow:function(e){return!!(e&&e.scrollTo&&e.document)},_removeChildNodes:function(e){while(e.firstChild)e.removeChild(e.firstChild)},siblings:function(e,t){var n=[],r=e;while(r=r[f])r[u]&&(!t||t(r))&&n.unshift(r);r=e;while(r=r[l])r[u]&&(!t||t(r))&&n.push(r);return n},_bruteContains:function(e,t){while(t){if(e===t)return!0;t=t.parentNode}return!1},_getRegExp:function(e,t){return t=t||"",v._regexCache=v._regexCache||{},v._regexCache[e+t]||(v._regexCache[e+t]=new RegExp(e,t)),v._regexCache[e+t]},_getDoc:function(t){var i=e.config.doc;return t&&(i=t[n]===9?t:t[r]||t.document||e.config.doc),i},_getWin:function(t){var n=v._getDoc(t);return n[s]||n[o]||e.config.win},_batch:function(e,t,n,r,i,s){t=typeof t=="string"?v[t]:t;var o,u=0,a,f;if(t&&e)while(a=e[u++])o=o=t.call(v,a,n,r,i,s),typeof o!="undefined"&&(f||(f=[]),f.push(o));return typeof f!="undefined"?f:e},generateID:function(t){var n=t.id;return n||(n=e.stamp(t),t.id=n),n}};e.DOM=v},"@VERSION@",{requires:["oop","features"]}),YUI.add("dom-base",function(e,t){var n=e.config.doc.documentElement,r=e.DOM,i="tagName",s="ownerDocument",o="",u=e.Features.add,a=e.Features.test;e.mix(r,{getText:n.textContent!==undefined?function(e){var t="";return e&&(t=e.textContent),t||""}:function(e){var t="";return e&&(t=e.innerText||e.nodeValue),t||""},setText:n.textContent!==undefined?function(e,t){e&&(e.textContent=t)}:function(e,t){"innerText"in e?e.innerText=t:"nodeValue"in e&&(e.nodeValue=t)},CUSTOM_ATTRIBUTES:n.hasAttribute?{htmlFor:"for",className:"class"}:{"for":"htmlFor","class":"className"},setAttribute:function(e,t,n,i){e&&t&&e.setAttribute&&(t=r.CUSTOM_ATTRIBUTES[t]||t,e.setAttribute(t,n,i))},getAttribute:function(e,t,n){n=n!==undefined?n:2;var i="";return e&&t&&e.getAttribute&&(t=r.CUSTOM_ATTRIBUTES[t]||t,i=e.getAttribute(t,n),i===null&&(i="")),i},VALUE_SETTERS:{},VALUE_GETTERS:{},getValue:function(e){var t="",n;return e&&e[i]&&(n=r.VALUE_GETTERS[e[i].toLowerCase()],n?t=n(e):t=e.value),t===o&&(t=o),typeof t=="string"?t:""},setValue:function(e,t){var n;e&&e[i]&&(n=r.VALUE_SETTERS[e[i].toLowerCase()],n?n(e,t):e.value=t)},creators:{}}),u("value-set","select",{test:function(){var t=e.config.doc.createElement("select");return t.innerHTML="<option>1</option><option>2</option>",t.value="2",t.value&&t.value==="2"}}),a("value-set","select")||(r.VALUE_SETTERS.select=function(e,t){for(var n=0,i=e.getElementsByTagName("option"),s;s=i[n++];)if(r.getValue(s)===t){s.selected=!0;break}}),e.mix(r.VALUE_GETTERS,{button:function(e){return e.attributes&&e.attributes.value?e.attributes.value.value:""}}),e.mix(r.VALUE_SETTERS,{button:function(e,t){var n=e.attributes.value;n||(n=e[s].createAttribute("value"),e.setAttributeNode(n)),n.value=t}}),e.mix(r.VALUE_GETTERS,{option:function(e){var t=e.attributes;return t.value&&t.value.specified?e.value:e.text},select:function(e){var t=e.value,n=e.options;return n&&n.length&&(e.multiple||e.selectedIndex>-1&&(t=r.getValue(n[e.selectedIndex]))),t}});var f,l,c;e.mix(e.DOM ,{hasClass:function(t,n){var r=e.DOM._getRegExp("(?:^|\\s+)"+n+"(?:\\s+|$)");return r.test(t.className)},addClass:function(t,n){e.DOM.hasClass(t,n)||(t.className=e.Lang.trim([t.className,n].join(" ")))},removeClass:function(t,n){n&&l(t,n)&&(t.className=e.Lang.trim(t.className.replace(e.DOM._getRegExp("(?:^|\\s+)"+n+"(?:\\s+|$)")," ")),l(t,n)&&c(t,n))},replaceClass:function(e,t,n){c(e,t),f(e,n)},toggleClass:function(e,t,n){var r=n!==undefined?n:!l(e,t);r?f(e,t):c(e,t)}}),l=e.DOM.hasClass,c=e.DOM.removeClass,f=e.DOM.addClass;var h=/<([a-z]+)/i,r=e.DOM,u=e.Features.add,a=e.Features.test,p={},d=function(t,n){var r=e.config.doc.createElement("div"),i=!0;r.innerHTML=t;if(!r.firstChild||r.firstChild.tagName!==n.toUpperCase())i=!1;return i},v=/(?:\/(?:thead|tfoot|tbody|caption|col|colgroup)>)+\s*<tbody/,m="<table>",g="</table>";e.mix(e.DOM,{_fragClones:{},_create:function(e,t,n){n=n||"div";var i=r._fragClones[n];return i?i=i.cloneNode(!1):i=r._fragClones[n]=t.createElement(n),i.innerHTML=e,i},_children:function(e,t){var n=0,r=e.children,i,s,o;r&&r.tags&&(t?r=e.children.tags(t):s=r.tags("!").length);if(!r||!r.tags&&t||s){i=r||e.childNodes,r=[];while(o=i[n++])o.nodeType===1&&(!t||t===o.tagName)&&r.push(o)}return r||[]},create:function(t,n){typeof t=="string"&&(t=e.Lang.trim(t)),n=n||e.config.doc;var i=h.exec(t),s=r._create,o=p,u=null,a,f,l;return t!=undefined&&(i&&i[1]&&(a=o[i[1].toLowerCase()],typeof a=="function"?s=a:f=a),l=s(t,n,f).childNodes,l.length===1?u=l[0].parentNode.removeChild(l[0]):l[0]&&l[0].className==="yui3-big-dummy"?l.length===2?u=l[0].nextSibling:(l[0].parentNode.removeChild(l[0]),u=r._nl2frag(l,n)):u=r._nl2frag(l,n)),u},_nl2frag:function(t,n){var r=null,i,s;if(t&&(t.push||t.item)&&t[0]){n=n||t[0].ownerDocument,r=n.createDocumentFragment(),t.item&&(t=e.Array(t,0,!0));for(i=0,s=t.length;i<s;i++)r.appendChild(t[i])}return r},addHTML:function(t,n,i){var s=t.parentNode,o=0,u,a=n,f;if(n!=undefined)if(n.nodeType)f=n;else if(typeof n=="string"||typeof n=="number")a=f=r.create(n);else if(n[0]&&n[0].nodeType){f=e.config.doc.createDocumentFragment();while(u=n[o++])f.appendChild(u)}if(i)if(f&&i.parentNode)i.parentNode.insertBefore(f,i);else switch(i){case"replace":while(t.firstChild)t.removeChild(t.firstChild);f&&t.appendChild(f);break;case"before":f&&s.insertBefore(f,t);break;case"after":f&&(t.nextSibling?s.insertBefore(f,t.nextSibling):s.appendChild(f));break;default:f&&t.appendChild(f)}else f&&t.appendChild(f);return a},wrap:function(t,n){var r=n&&n.nodeType?n:e.DOM.create(n),i=r.getElementsByTagName("*");i.length&&(r=i[i.length-1]),t.parentNode&&t.parentNode.replaceChild(r,t),r.appendChild(t)},unwrap:function(e){var t=e.parentNode,n=t.lastChild,r=e,i;if(t){i=t.parentNode;if(i){e=t.firstChild;while(e!==n)r=e.nextSibling,i.insertBefore(e,t),e=r;i.replaceChild(n,t)}else t.removeChild(e)}}}),u("innerhtml","table",{test:function(){var t=e.config.doc.createElement("table");try{t.innerHTML="<tbody></tbody>"}catch(n){return!1}return t.firstChild&&t.firstChild.nodeName==="TBODY"}}),u("innerhtml-div","tr",{test:function(){return d("<tr></tr>","tr")}}),u("innerhtml-div","script",{test:function(){return d("<script></script>","script")}}),a("innerhtml","table")||(p.tbody=function(t,n){var i=r.create(m+t+g,n),s=e.DOM._children(i,"tbody")[0];return i.children.length>1&&s&&!v.test(t)&&s.parentNode.removeChild(s),i}),a("innerhtml-div","script")||(p.script=function(e,t){var n=t.createElement("div");return n.innerHTML="-"+e,n.removeChild(n.firstChild),n},p.link=p.style=p.script),a("innerhtml-div","tr")||(e.mix(p,{option:function(e,t){return r.create('<select><option class="yui3-big-dummy" selected></option>'+e+"</select>",t)},tr:function(e,t){return r.create("<tbody>"+e+"</tbody>",t)},td:function(e,t){return r.create("<tr>"+e+"</tr>",t)},col:function(e,t){return r.create("<colgroup>"+e+"</colgroup>",t)},tbody:"table"}),e.mix(p,{legend:"fieldset",th:p.td,thead:p.tbody,tfoot:p.tbody,caption:p.tbody,colgroup:p.tbody,optgroup:p.option})),r.creators=p,e.mix(e.DOM,{setWidth:function(t,n){e.DOM._setSize(t,"width",n)},setHeight:function(t,n){e.DOM._setSize(t,"height",n)},_setSize:function(e,t,n){n=n>0?n:0;var r=0;e.style[t]=n+"px",r=t==="height"?e.offsetHeight:e.offsetWidth,r>n&&(n-=r-n,n<0&&(n=0),e.style[t]=n+"px")}})},"@VERSION@",{requires:["dom-core"]}),YUI.add("color-base",function(e,t){var n=/^#?([\da-fA-F]{2})([\da-fA-F]{2})([\da-fA-F]{2})(\ufffe)?/,r=/^#?([\da-fA-F]{1})([\da-fA-F]{1})([\da-fA-F]{1})(\ufffe)?/,i=/rgba?\(([\d]{1,3}), ?([\d]{1,3}), ?([\d]{1,3}),? ?([.\d]*)?\)/,s={HEX:"hex",RGB:"rgb",RGBA:"rgba"},o={hex:"toHex",rgb:"toRGB",rgba:"toRGBA"};e.Color={KEYWORDS:{black:"000",silver:"c0c0c0",gray:"808080",white:"fff",maroon:"800000",red:"f00",purple:"800080",fuchsia:"f0f",green:"008000",lime:"0f0",olive:"808000",yellow:"ff0",navy:"000080",blue:"00f",teal:"008080",aqua:"0ff"},REGEX_HEX:n,REGEX_HEX3:r,REGEX_RGB:i,re_RGB:i,re_hex:n,re_hex3:r,STR_HEX:"#{*}{*}{*}",STR_RGB:"rgb({*}, {*}, {*})",STR_RGBA:"rgba({*}, {*}, {*}, {*})",TYPES:s,CONVERTS:o,convert:function(t,n){var r=e.Color.CONVERTS[n.toLowerCase()],i=t;return r&&e.Color[r]&&(i=e.Color[r](t)),i},toHex:function(t){var n=e.Color._convertTo(t,"hex"),r=n.toLowerCase()==="transparent";return n.charAt(0)!=="#"&&!r&&(n="#"+n),r?n.toLowerCase():n.toUpperCase()},toRGB:function(t){var n=e.Color._convertTo(t,"rgb");return n.toLowerCase()},toRGBA:function(t){var n=e.Color._convertTo(t,"rgba");return n.toLowerCase()},toArray:function(t){var n=e.Color.findType(t).toUpperCase(),r,i,s,o;return n==="HEX"&&t.length<5&&(n="HEX3"),n.charAt(n.length-1)==="A"&&(n=n.slice(0,-1)),r=e.Color["REGEX_"+n],r&&(i=r.exec(t)||[],s=i.length,s&&(i.shift(),s--,n==="HEX3"&&(i[0]+=i[0],i[1]+=i[1],i[2]+=i[2]),o=i[s-1],o||(i[s-1]=1))),i},fromArray:function(t,n){t=t.concat();if(typeof n=="undefined")return t.join(", ");var r="{*}";n=e.Color["STR_"+n.toUpperCase()],t.length===3&&n.match(/\{\*\}/g).length===4&&t.push(1);while(n.indexOf(r)>=0&&t.length>0)n=n.replace(r,t.shift());return n},findType :function(t){if(e.Color.KEYWORDS[t])return"keyword";var n=t.indexOf("("),r;return n>0&&(r=t.substr(0,n)),r&&e.Color.TYPES[r.toUpperCase()]?e.Color.TYPES[r.toUpperCase()]:"hex"},_getAlpha:function(t){var n,r=e.Color.toArray(t);return r.length>3&&(n=r.pop()),+n||1},_keywordToHex:function(t){var n=e.Color.KEYWORDS[t];if(n)return n},_convertTo:function(t,n){if(t==="transparent")return t;var r=e.Color.findType(t),i=n,s,o,u,a;return r==="keyword"&&(t=e.Color._keywordToHex(t),r="hex"),r==="hex"&&t.length<5&&(t.charAt(0)==="#"&&(t=t.substr(1)),t="#"+t.charAt(0)+t.charAt(0)+t.charAt(1)+t.charAt(1)+t.charAt(2)+t.charAt(2)),r===n?t:(r.charAt(r.length-1)==="a"&&(r=r.slice(0,-1)),s=n.charAt(n.length-1)==="a",s&&(n=n.slice(0,-1),o=e.Color._getAlpha(t)),a=n.charAt(0).toUpperCase()+n.substr(1).toLowerCase(),u=e.Color["_"+r+"To"+a],u||r!=="rgb"&&n!=="rgb"&&(t=e.Color["_"+r+"ToRgb"](t),r="rgb",u=e.Color["_"+r+"To"+a]),u&&(t=u(t,s)),s&&(e.Lang.isArray(t)||(t=e.Color.toArray(t)),t.push(o),t=e.Color.fromArray(t,i.toUpperCase())),t)},_hexToRgb:function(e,t){var n,r,i;return e.charAt(0)==="#"&&(e=e.substr(1)),e=parseInt(e,16),n=e>>16,r=e>>8&255,i=e&255,t?[n,r,i]:"rgb("+n+", "+r+", "+i+")"},_rgbToHex:function(t){var n=e.Color.toArray(t),r=n[2]|n[1]<<8|n[0]<<16;r=(+r).toString(16);while(r.length<6)r="0"+r;return"#"+r}}},"@VERSION@",{requires:["yui-base"]}),YUI.add("dom-style",function(e,t){(function(e){var t="documentElement",n="defaultView",r="ownerDocument",i="style",s="float",o="cssFloat",u="styleFloat",a="transparent",f="getComputedStyle",l="getBoundingClientRect",c=e.config.win,h=e.config.doc,p=undefined,d=e.DOM,v="transform",m="transformOrigin",g=["WebkitTransform","MozTransform","OTransform","msTransform"],y=/color$/i,b=/width|height|top|left|right|bottom|margin|padding/i;e.Array.each(g,function(e){e in h[t].style&&(v=e,m=e+"Origin")}),e.mix(d,{DEFAULT_UNIT:"px",CUSTOM_STYLES:{},setStyle:function(e,t,n,r){r=r||e.style;var i=d.CUSTOM_STYLES;if(r){n===null||n===""?n="":!isNaN(new Number(n))&&b.test(t)&&(n+=d.DEFAULT_UNIT);if(t in i){if(i[t].set){i[t].set(e,n,r);return}typeof i[t]=="string"&&(t=i[t])}else t===""&&(t="cssText",n="");r[t]=n}},getStyle:function(e,t,n){n=n||e.style;var r=d.CUSTOM_STYLES,i="";if(n){if(t in r){if(r[t].get)return r[t].get(e,t,n);typeof r[t]=="string"&&(t=r[t])}i=n[t],i===""&&(i=d[f](e,t))}return i},setStyles:function(t,n){var r=t.style;e.each(n,function(e,n){d.setStyle(t,n,e,r)},d)},getComputedStyle:function(e,t){var s="",o=e[r],u;return e[i]&&o[n]&&o[n][f]&&(u=o[n][f](e,null),u&&(s=u[t])),s}}),h[t][i][o]!==p?d.CUSTOM_STYLES[s]=o:h[t][i][u]!==p&&(d.CUSTOM_STYLES[s]=u),e.UA.opera&&(d[f]=function(t,i){var s=t[r][n],o=s[f](t,"")[i];return y.test(i)&&(o=e.Color.toRGB(o)),o}),e.UA.webkit&&(d[f]=function(e,t){var i=e[r][n],s=i[f](e,"")[t];return s==="rgba(0, 0, 0, 0)"&&(s=a),s}),e.DOM._getAttrOffset=function(t,n){var r=e.DOM[f](t,n),i=t.offsetParent,s,o,u;return r==="auto"&&(s=e.DOM.getStyle(t,"position"),s==="static"||s==="relative"?r=0:i&&i[l]&&(o=i[l]()[n],u=t[l]()[n],n==="left"||n==="top"?r=u-o:r=o-t[l]()[n])),r},e.DOM._getOffset=function(e){var t,n=null;return e&&(t=d.getStyle(e,"position"),n=[parseInt(d[f](e,"left"),10),parseInt(d[f](e,"top"),10)],isNaN(n[0])&&(n[0]=parseInt(d.getStyle(e,"left"),10),isNaN(n[0])&&(n[0]=t==="relative"?0:e.offsetLeft||0)),isNaN(n[1])&&(n[1]=parseInt(d.getStyle(e,"top"),10),isNaN(n[1])&&(n[1]=t==="relative"?0:e.offsetTop||0))),n},d.CUSTOM_STYLES.transform={set:function(e,t,n){n[v]=t},get:function(e,t){return d[f](e,v)}},d.CUSTOM_STYLES.transformOrigin={set:function(e,t,n){n[m]=t},get:function(e,t){return d[f](e,m)}}})(e)},"@VERSION@",{requires:["dom-base","color-base"]}),YUI.add("dom-style-ie",function(e,t){(function(e){var t="hasLayout",n="px",r="filter",i="filters",s="opacity",o="auto",u="borderWidth",a="borderTopWidth",f="borderRightWidth",l="borderBottomWidth",c="borderLeftWidth",h="width",p="height",d="transparent",v="visible",m="getComputedStyle",g=undefined,y=e.config.doc.documentElement,b=e.Features.test,w=e.Features.add,E=/^(\d[.\d]*)+(em|ex|px|gd|rem|vw|vh|vm|ch|mm|cm|in|pt|pc|deg|rad|ms|s|hz|khz|%){1}?/i,S=e.UA.ie>=8,x=function(e){return e.currentStyle||e.style},T={CUSTOM_STYLES:{},get:function(t,r){var i="",o;return t&&(o=x(t)[r],r===s&&e.DOM.CUSTOM_STYLES[s]?i=e.DOM.CUSTOM_STYLES[s].get(t):!o||o.indexOf&&o.indexOf(n)>-1?i=o:e.DOM.IE.COMPUTED[r]?i=e.DOM.IE.COMPUTED[r](t,r):E.test(o)?i=T.getPixel(t,r)+n:i=o),i},sizeOffsets:{width:["Left","Right"],height:["Top","Bottom"],top:["Top"],bottom:["Bottom"]},getOffset:function(e,t){var r=x(e)[t],i=t.charAt(0).toUpperCase()+t.substr(1),s="offset"+i,u="pixel"+i,a=T.sizeOffsets[t],f=e.ownerDocument.compatMode,l="";return r===o||r.indexOf("%")>-1?(l=e["offset"+i],f!=="BackCompat"&&(a[0]&&(l-=T.getPixel(e,"padding"+a[0]),l-=T.getBorderWidth(e,"border"+a[0]+"Width",1)),a[1]&&(l-=T.getPixel(e,"padding"+a[1]),l-=T.getBorderWidth(e,"border"+a[1]+"Width",1)))):(!e.style[u]&&!e.style[t]&&(e.style[t]=r),l=e.style[u]),l+n},borderMap:{thin:S?"1px":"2px",medium:S?"3px":"4px",thick:S?"5px":"6px"},getBorderWidth:function(e,t,r){var i=r?"":n,s=e.currentStyle[t];return s.indexOf(n)<0&&(T.borderMap[s]&&e.currentStyle.borderStyle!=="none"?s=T.borderMap[s]:s=0),r?parseFloat(s):s},getPixel:function(e,t){var n=null,r=x(e),i=r.right,s=r[t];return e.style.right=s,n=e.style.pixelRight,e.style.right=i,n},getMargin:function(e,t){var r,i=x(e);return i[t]==o?r=0:r=T.getPixel(e,t),r+n},getVisibility:function(e,t){var n;while((n=e.currentStyle)&&n[t]=="inherit")e=e.parentNode;return n?n[t]:v},getColor:function(t,n){var r=x(t)[n];return(!r||r===d)&&e.DOM.elementByAxis(t,"parentNode",null,function(e){r=x(e)[n];if(r&&r!==d)return t=e,!0}),e.Color.toRGB(r)},getBorderColor:function(t,n){var r=x(t),i=r[n]||r.color;return e.Color.toRGB(e.Color.toHex(i))}},N={};w("style","computedStyle",{test:function(){return"getComputedStyle"in e.config.win}}),w("style","opacity",{test:function(){return"opacity"in y.style}}),w("style","filter",{test:function( ){return"filters"in y}}),!b("style","opacity")&&b("style","filter")&&(e.DOM.CUSTOM_STYLES[s]={get:function(e){var t=100;try{t=e[i]["DXImageTransform.Microsoft.Alpha"][s]}catch(n){try{t=e[i]("alpha")[s]}catch(r){}}return t/100},set:function(e,n,i){var o,u=x(e),a=u[r];i=i||e.style,n===""&&(o=s in u?u[s]:1,n=o),typeof a=="string"&&(i[r]=a.replace(/alpha([^)]*\))/gi,"")+(n<1?"alpha("+s+"="+n*100+")":""),i[r]||i.removeAttribute(r),u[t]||(i.zoom=1))}});try{e.config.doc.createElement("div").style.height="-1px"}catch(C){e.DOM.CUSTOM_STYLES.height={set:function(e,t,n){var r=parseFloat(t);if(r>=0||t==="auto"||t==="")n.height=t}},e.DOM.CUSTOM_STYLES.width={set:function(e,t,n){var r=parseFloat(t);if(r>=0||t==="auto"||t==="")n.width=t}}}b("style","computedStyle")||(N[h]=N[p]=T.getOffset,N.color=N.backgroundColor=T.getColor,N[u]=N[a]=N[f]=N[l]=N[c]=T.getBorderWidth,N.marginTop=N.marginRight=N.marginBottom=N.marginLeft=T.getMargin,N.visibility=T.getVisibility,N.borderColor=N.borderTopColor=N.borderRightColor=N.borderBottomColor=N.borderLeftColor=T.getBorderColor,e.DOM[m]=T.get,e.namespace("DOM.IE"),e.DOM.IE.COMPUTED=N,e.DOM.IE.ComputedStyle=T)})(e)},"@VERSION@",{requires:["dom-style"]}),YUI.add("dom-screen",function(e,t){(function(e){var t="documentElement",n="compatMode",r="position",i="fixed",s="relative",o="left",u="top",a="BackCompat",f="medium",l="borderLeftWidth",c="borderTopWidth",h="getBoundingClientRect",p="getComputedStyle",d=e.DOM,v=/^t(?:able|d|h)$/i,m;e.UA.ie&&(e.config.doc[n]!=="BackCompat"?m=t:m="body"),e.mix(d,{winHeight:function(e){var t=d._getWinSize(e).height;return t},winWidth:function(e){var t=d._getWinSize(e).width;return t},docHeight:function(e){var t=d._getDocSize(e).height;return Math.max(t,d._getWinSize(e).height)},docWidth:function(e){var t=d._getDocSize(e).width;return Math.max(t,d._getWinSize(e).width)},docScrollX:function(n,r){r=r||n?d._getDoc(n):e.config.doc;var i=r.defaultView,s=i?i.pageXOffset:0;return Math.max(r[t].scrollLeft,r.body.scrollLeft,s)},docScrollY:function(n,r){r=r||n?d._getDoc(n):e.config.doc;var i=r.defaultView,s=i?i.pageYOffset:0;return Math.max(r[t].scrollTop,r.body.scrollTop,s)},getXY:function(){return e.config.doc[t][h]?function(r){var i=null,s,o,u,f,l,c,p,v,g,y;if(r&&r.tagName){p=r.ownerDocument,u=p[n],u!==a?y=p[t]:y=p.body,y.contains?g=y.contains(r):g=e.DOM.contains(y,r);if(g){v=p.defaultView,v&&"pageXOffset"in v?(s=v.pageXOffset,o=v.pageYOffset):(s=m?p[m].scrollLeft:d.docScrollX(r,p),o=m?p[m].scrollTop:d.docScrollY(r,p)),e.UA.ie&&(!p.documentMode||p.documentMode<8||u===a)&&(l=y.clientLeft,c=y.clientTop),f=r[h](),i=[f.left,f.top];if(l||c)i[0]-=l,i[1]-=c;if(o||s)if(!e.UA.ios||e.UA.ios>=4.2)i[0]+=s,i[1]+=o}else i=d._getOffset(r)}return i}:function(t){var n=null,s,o,u,a,f;if(t)if(d.inDoc(t)){n=[t.offsetLeft,t.offsetTop],s=t.ownerDocument,o=t,u=e.UA.gecko||e.UA.webkit>519?!0:!1;while(o=o.offsetParent)n[0]+=o.offsetLeft,n[1]+=o.offsetTop,u&&(n=d._calcBorders(o,n));if(d.getStyle(t,r)!=i){o=t;while(o=o.parentNode){a=o.scrollTop,f=o.scrollLeft,e.UA.gecko&&d.getStyle(o,"overflow")!=="visible"&&(n=d._calcBorders(o,n));if(a||f)n[0]-=f,n[1]-=a}n[0]+=d.docScrollX(t,s),n[1]+=d.docScrollY(t,s)}else n[0]+=d.docScrollX(t,s),n[1]+=d.docScrollY(t,s)}else n=d._getOffset(t);return n}}(),getScrollbarWidth:e.cached(function(){var t=e.config.doc,n=t.createElement("div"),r=t.getElementsByTagName("body")[0],i=.1;return r&&(n.style.cssText="position:absolute;visibility:hidden;overflow:scroll;width:20px;",n.appendChild(t.createElement("p")).style.height="1px",r.insertBefore(n,r.firstChild),i=n.offsetWidth-n.clientWidth,r.removeChild(n)),i},null,.1),getX:function(e){return d.getXY(e)[0]},getY:function(e){return d.getXY(e)[1]},setXY:function(e,t,n){var i=d.setStyle,a,f,l,c;e&&t&&(a=d.getStyle(e,r),f=d._getOffset(e),a=="static"&&(a=s,i(e,r,a)),c=d.getXY(e),t[0]!==null&&i(e,o,t[0]-c[0]+f[0]+"px"),t[1]!==null&&i(e,u,t[1]-c[1]+f[1]+"px"),n||(l=d.getXY(e),(l[0]!==t[0]||l[1]!==t[1])&&d.setXY(e,t,!0)))},setX:function(e,t){return d.setXY(e,[t,null])},setY:function(e,t){return d.setXY(e,[null,t])},swapXY:function(e,t){var n=d.getXY(e);d.setXY(e,d.getXY(t)),d.setXY(t,n)},_calcBorders:function(t,n){var r=parseInt(d[p](t,c),10)||0,i=parseInt(d[p](t,l),10)||0;return e.UA.gecko&&v.test(t.tagName)&&(r=0,i=0),n[0]+=i,n[1]+=r,n},_getWinSize:function(r,i){i=i||r?d._getDoc(r):e.config.doc;var s=i.defaultView||i.parentWindow,o=i[n],u=s.innerHeight,a=s.innerWidth,f=i[t];return o&&!e.UA.opera&&(o!="CSS1Compat"&&(f=i.body),u=f.clientHeight,a=f.clientWidth),{height:u,width:a}},_getDocSize:function(r){var i=r?d._getDoc(r):e.config.doc,s=i[t];return i[n]!="CSS1Compat"&&(s=i.body),{height:s.scrollHeight,width:s.scrollWidth}}})})(e),function(e){var t="top",n="right",r="bottom",i="left",s=function(e,s){var o=Math.max(e[t],s[t]),u=Math.min(e[n],s[n]),a=Math.min(e[r],s[r]),f=Math.max(e[i],s[i]),l={};return l[t]=o,l[n]=u,l[r]=a,l[i]=f,l},o=e.DOM;e.mix(o,{region:function(e){var t=o.getXY(e),n=!1;return e&&t&&(n=o._getRegion(t[1],t[0]+e.offsetWidth,t[1]+e.offsetHeight,t[0])),n},intersect:function(u,a,f){var l=f||o.region(u),c={},h=a,p;if(h.tagName)c=o.region(h);else{if(!e.Lang.isObject(a))return!1;c=a}return p=s(c,l),{top:p[t],right:p[n],bottom:p[r],left:p[i],area:(p[r]-p[t])*(p[n]-p[i]),yoff:p[r]-p[t],xoff:p[n]-p[i],inRegion:o.inRegion(u,a,!1,f)}},inRegion:function(u,a,f,l){var c={},h=l||o.region(u),p=a,d;if(p.tagName)c=o.region(p);else{if(!e.Lang.isObject(a))return!1;c=a}return f?h[i]>=c[i]&&h[n]<=c[n]&&h[t]>=c[t]&&h[r]<=c[r]:(d=s(c,h),d[r]>=d[t]&&d[n]>=d[i]?!0:!1)},inViewportRegion:function(e,t,n){return o.inRegion(e,o.viewportRegion(e),t,n)},_getRegion:function(e,s,o,u){var a={};return a[t]=a[1]=e,a[i]=a[0]=u,a[r]=o,a[n]=s,a.width=a[n]-a[i],a.height=a[r]-a[t],a},viewportRegion:function(t){t=t||e.config.doc.documentElement;var n=!1,r,i;return t&&(r=o.docScrollX(t),i=o.docScrollY(t),n=o._getRegion(i,o.winWidth(t)+r,i+o.winHeight(t),r)),n}})}(e)},"@VERSION@",{requires:["dom-base","dom-style"]}),YUI.add("selector-native" ,function(e,t){(function(e){e.namespace("Selector");var t="compareDocumentPosition",n="ownerDocument",r={_types:{esc:{token:"\ue000",re:/\\[:\[\]\(\)#\.\'\>+~"]/gi},attr:{token:"\ue001",re:/(\[[^\]]*\])/g},pseudo:{token:"\ue002",re:/(\([^\)]*\))/g}},useNative:!0,_escapeId:function(e){return e&&(e=e.replace(/([:\[\]\(\)#\.'<>+~"])/g,"\\$1")),e},_compare:"sourceIndex"in e.config.doc.documentElement?function(e,t){var n=e.sourceIndex,r=t.sourceIndex;return n===r?0:n>r?1:-1}:e.config.doc.documentElement[t]?function(e,n){return e[t](n)&4?-1:1}:function(e,t){var r,i,s;return e&&t&&(r=e[n].createRange(),r.setStart(e,0),i=t[n].createRange(),i.setStart(t,0),s=r.compareBoundaryPoints(1,i)),s},_sort:function(t){return t&&(t=e.Array(t,0,!0),t.sort&&t.sort(r._compare)),t},_deDupe:function(e){var t=[],n,r;for(n=0;r=e[n++];)r._found||(t[t.length]=r,r._found=!0);for(n=0;r=t[n++];)r._found=null,r.removeAttribute("_found");return t},query:function(t,n,i,s){n=n||e.config.doc;var o=[],u=e.Selector.useNative&&e.config.doc.querySelector&&!s,a=[[t,n]],f,l,c,h=u?e.Selector._nativeQuery:e.Selector._bruteQuery;if(t&&h){!s&&(!u||n.tagName)&&(a=r._splitQueries(t,n));for(c=0;f=a[c++];)l=h(f[0],f[1],i),i||(l=e.Array(l,0,!0)),l&&(o=o.concat(l));a.length>1&&(o=r._sort(r._deDupe(o)))}return i?o[0]||null:o},_replaceSelector:function(t){var n=e.Selector._parse("esc",t),i,s;return t=e.Selector._replace("esc",t),s=e.Selector._parse("pseudo",t),t=r._replace("pseudo",t),i=e.Selector._parse("attr",t),t=e.Selector._replace("attr",t),{esc:n,attrs:i,pseudos:s,selector:t}},_restoreSelector:function(t){var n=t.selector;return n=e.Selector._restore("attr",n,t.attrs),n=e.Selector._restore("pseudo",n,t.pseudos),n=e.Selector._restore("esc",n,t.esc),n},_replaceCommas:function(t){var n=e.Selector._replaceSelector(t),t=n.selector;return t&&(t=t.replace(/,/g,"\ue007"),n.selector=t,t=e.Selector._restoreSelector(n)),t},_splitQueries:function(t,n){t.indexOf(",")>-1&&(t=e.Selector._replaceCommas(t));var r=t.split("\ue007"),i=[],s="",o,u,a;if(n){n.nodeType===1&&(o=e.Selector._escapeId(e.DOM.getId(n)),o||(o=e.guid(),e.DOM.setId(n,o)),s='[id="'+o+'"] ');for(u=0,a=r.length;u<a;++u)t=s+r[u],i.push([t,n])}return i},_nativeQuery:function(t,n,r){if((e.UA.webkit||e.UA.opera)&&t.indexOf(":checked")>-1&&e.Selector.pseudos&&e.Selector.pseudos.checked)return e.Selector.query(t,n,r,!0);try{return n["querySelector"+(r?"":"All")](t)}catch(i){return e.Selector.query(t,n,r,!0)}},filter:function(t,n){var r=[],i,s;if(t&&n)for(i=0;s=t[i++];)e.Selector.test(s,n)&&(r[r.length]=s);return r},test:function(t,r,i){var s=!1,o=!1,u,a,f,l,c,h,p,d,v;if(t&&t.tagName)if(typeof r=="function")s=r.call(t,t);else{u=r.split(","),!i&&!e.DOM.inDoc(t)&&(a=t.parentNode,a?i=a:(c=t[n].createDocumentFragment(),c.appendChild(t),i=c,o=!0)),i=i||t[n],h=e.Selector._escapeId(e.DOM.getId(t)),h||(h=e.guid(),e.DOM.setId(t,h));for(p=0;v=u[p++];){v+='[id="'+h+'"]',l=e.Selector.query(v,i);for(d=0;f=l[d++];)if(f===t){s=!0;break}if(s)break}o&&c.removeChild(t)}return s},ancestor:function(t,n,r){return e.DOM.ancestor(t,function(t){return e.Selector.test(t,n)},r)},_parse:function(t,n){return n.match(e.Selector._types[t].re)},_replace:function(t,n){var r=e.Selector._types[t];return n.replace(r.re,r.token)},_restore:function(t,n,r){if(r){var i=e.Selector._types[t].token,s,o;for(s=0,o=r.length;s<o;++s)n=n.replace(i,r[s])}return n}};e.mix(e.Selector,r,!0)})(e)},"@VERSION@",{requires:["dom-base"]}),YUI.add("selector",function(e,t){},"@VERSION@",{requires:["selector-native"]}),YUI.add("event-custom-base",function(e,t){e.Env.evt={handles:{},plugins:{}};var n=0,r=1,i={objs:null,before:function(t,r,i,s){var o=t,u;return s&&(u=[t,s].concat(e.Array(arguments,4,!0)),o=e.rbind.apply(e,u)),this._inject(n,o,r,i)},after:function(t,n,i,s){var o=t,u;return s&&(u=[t,s].concat(e.Array(arguments,4,!0)),o=e.rbind.apply(e,u)),this._inject(r,o,n,i)},_inject:function(t,n,r,i){var s=e.stamp(r),o,u;return r._yuiaop||(r._yuiaop={}),o=r._yuiaop,o[i]||(o[i]=new e.Do.Method(r,i),r[i]=function(){return o[i].exec.apply(o[i],arguments)}),u=s+e.stamp(n)+i,o[i].register(u,n,t),new e.EventHandle(o[i],u)},detach:function(e){e.detach&&e.detach()}};e.Do=i,i.Method=function(e,t){this.obj=e,this.methodName=t,this.method=e[t],this.before={},this.after={}},i.Method.prototype.register=function(e,t,n){n?this.after[e]=t:this.before[e]=t},i.Method.prototype._delete=function(e){delete this.before[e],delete this.after[e]},i.Method.prototype.exec=function(){var t=e.Array(arguments,0,!0),n,r,s,o=this.before,u=this.after,a=!1;for(n in o)if(o.hasOwnProperty(n)){r=o[n].apply(this.obj,t);if(r)switch(r.constructor){case i.Halt:return r.retVal;case i.AlterArgs:t=r.newArgs;break;case i.Prevent:a=!0;break;default:}}a||(r=this.method.apply(this.obj,t)),i.originalRetVal=r,i.currentRetVal=r;for(n in u)if(u.hasOwnProperty(n)){s=u[n].apply(this.obj,t);if(s&&s.constructor===i.Halt)return s.retVal;s&&s.constructor===i.AlterReturn&&(r=s.newRetVal,i.currentRetVal=r)}return r},i.AlterArgs=function(e,t){this.msg=e,this.newArgs=t},i.AlterReturn=function(e,t){this.msg=e,this.newRetVal=t},i.Halt=function(e,t){this.msg=e,this.retVal=t},i.Prevent=function(e){this.msg=e},i.Error=i.Halt;var s=e.Array,o="after",u=["broadcast","monitored","bubbles","context","contextFn","currentTarget","defaultFn","defaultTargetOnly","details","emitFacade","fireOnce","async","host","preventable","preventedFn","queuable","silent","stoppedFn","target","type"],a=s.hash(u),f=Array.prototype.slice,l=9,c="yui:log",h=function(e,t,n){var r;for(r in t)a[r]&&(n||!(r in e))&&(e[r]=t[r]);return e};e.CustomEvent=function(t,n){this._kds=e.CustomEvent.keepDeprecatedSubs,this.id=e.guid(),this.type=t,this.silent=this.logSystem=t===c,this._kds&&(this.subscribers={},this.afters={}),n&&h(this,n,!0)},e.CustomEvent.keepDeprecatedSubs=!1,e.CustomEvent.mixConfigs=h,e.CustomEvent.prototype={constructor:e.CustomEvent,signature:l,context:e,preventable:!0,bubbles:!0,hasSubs:function(e){var t=0,n=0,r=this._subscribers,i=this._afters ,s=this.sibling;return r&&(t=r.length),i&&(n=i.length),s&&(r=s._subscribers,i=s._afters,r&&(t+=r.length),i&&(n+=i.length)),e?e==="after"?n:t:t+n},monitor:function(e){this.monitored=!0;var t=this.id+"|"+this.type+"_"+e,n=f.call(arguments,0);return n[0]=t,this.host.on.apply(this.host,n)},getSubs:function(){var e=this.sibling,t=this._subscribers,n=this._afters,r,i;return e&&(r=e._subscribers,i=e._afters),r?t?t=t.concat(r):t=r.concat():t?t=t.concat():t=[],i?n?n=n.concat(i):n=i.concat():n?n=n.concat():n=[],[t,n]},applyConfig:function(e,t){h(this,e,t)},_on:function(t,n,r,i){t||this.log("Invalid callback for CE: "+this.type);var s=new e.Subscriber(t,n,r,i),u;return this.fireOnce&&this.fired&&(u=this.firedWith,this.emitFacade&&this._addFacadeToArgs&&this._addFacadeToArgs(u),this.async?setTimeout(e.bind(this._notify,this,s,u),0):this._notify(s,u)),i===o?(this._afters||(this._afters=[]),this._afters.push(s)):(this._subscribers||(this._subscribers=[]),this._subscribers.push(s)),this._kds&&(i===o?this.afters[s.id]=s:this.subscribers[s.id]=s),new e.EventHandle(this,s)},subscribe:function(e,t){var n=arguments.length>2?f.call(arguments,2):null;return this._on(e,t,n,!0)},on:function(e,t){var n=arguments.length>2?f.call(arguments,2):null;return this.monitored&&this.host&&this.host._monitor("attach",this,{args:arguments}),this._on(e,t,n,!0)},after:function(e,t){var n=arguments.length>2?f.call(arguments,2):null;return this._on(e,t,n,o)},detach:function(e,t){if(e&&e.detach)return e.detach();var n,r,i=0,s=this._subscribers,o=this._afters;if(s)for(n=s.length;n>=0;n--)r=s[n],r&&(!e||e===r.fn)&&(this._delete(r,s,n),i++);if(o)for(n=o.length;n>=0;n--)r=o[n],r&&(!e||e===r.fn)&&(this._delete(r,o,n),i++);return i},unsubscribe:function(){return this.detach.apply(this,arguments)},_notify:function(e,t,n){this.log(this.type+"->"+"sub: "+e.id);var r;return r=e.notify(t,this),!1===r||this.stopped>1?(this.log(this.type+" cancelled by subscriber"),!1):!0},log:function(e,t){},fire:function(){var e=[];return e.push.apply(e,arguments),this._fire(e)},_fire:function(e){return this.fireOnce&&this.fired?(this.log("fireOnce event: "+this.type+" already fired"),!0):(this.fired=!0,this.fireOnce&&(this.firedWith=e),this.emitFacade?this.fireComplex(e):this.fireSimple(e))},fireSimple:function(e){this.stopped=0,this.prevented=0;if(this.hasSubs()){var t=this.getSubs();this._procSubs(t[0],e),this._procSubs(t[1],e)}return this.broadcast&&this._broadcast(e),this.stopped?!1:!0},fireComplex:function(e){return this.log("Missing event-custom-complex needed to emit a facade for: "+this.type),e[0]=e[0]||{},this.fireSimple(e)},_procSubs:function(e,t,n){var r,i,s;for(i=0,s=e.length;i<s;i++){r=e[i];if(r&&r.fn){!1===this._notify(r,t,n)&&(this.stopped=2);if(this.stopped===2)return!1}}return!0},_broadcast:function(t){if(!this.stopped&&this.broadcast){var n=t.concat();n.unshift(this.type),this.host!==e&&e.fire.apply(e,n),this.broadcast===2&&e.Global.fire.apply(e.Global,n)}},unsubscribeAll:function(){return this.detachAll.apply(this,arguments)},detachAll:function(){return this.detach()},_delete:function(e,t,n){var r=e._when;t||(t=r===o?this._afters:this._subscribers),t&&(n=s.indexOf(t,e,0),e&&t[n]===e&&t.splice(n,1)),this._kds&&(r===o?delete this.afters[e.id]:delete this.subscribers[e.id]),this.monitored&&this.host&&this.host._monitor("detach",this,{ce:this,sub:e}),e&&(e.deleted=!0)}},e.Subscriber=function(t,n,r,i){this.fn=t,this.context=n,this.id=e.guid(),this.args=r,this._when=i},e.Subscriber.prototype={constructor:e.Subscriber,_notify:function(e,t,n){if(this.deleted&&!this.postponed){if(!this.postponed)return delete this.postponed,null;delete this.fn,delete this.context}var r=this.args,i;switch(n.signature){case 0:i=this.fn.call(e,n.type,t,e);break;case 1:i=this.fn.call(e,t[0]||null,e);break;default:r||t?(t=t||[],r=r?t.concat(r):t,i=this.fn.apply(e,r)):i=this.fn.call(e)}return this.once&&n._delete(this),i},notify:function(t,n){var r=this.context,i=!0;r||(r=n.contextFn?n.contextFn():n.context);if(e.config&&e.config.throwFail)i=this._notify(r,t,n);else try{i=this._notify(r,t,n)}catch(s){e.error(this+" failed: "+s.message,s)}return i},contains:function(e,t){return t?this.fn===e&&this.context===t:this.fn===e},valueOf:function(){return this.id}},e.EventHandle=function(e,t){this.evt=e,this.sub=t},e.EventHandle.prototype={batch:function(t,n){t.call(n||this,this),e.Lang.isArray(this.evt)&&e.Array.each(this.evt,function(e){e.batch.call(n||e,t)})},detach:function(){var t=this.evt,n=0,r;if(t)if(e.Lang.isArray(t))for(r=0;r<t.length;r++)n+=t[r].detach();else t._delete(this.sub),n=1;return n},monitor:function(e){return this.evt.monitor.apply(this.evt,arguments)}};var p=e.Lang,d=":",v="|",m="~AFTER~",g=/(.*?)(:)(.*?)/,y=e.cached(function(e){return e.replace(g,"*$2$3")}),b=function(e,t){return!t||!e||e.indexOf(d)>-1?e:t+d+e},w=e.cached(function(e,t){var n=e,r,i,s;return p.isString(n)?(s=n.indexOf(m),s>-1&&(i=!0,n=n.substr(m.length)),s=n.indexOf(v),s>-1&&(r=n.substr(0,s),n=n.substr(s+1),n==="*"&&(n=null)),[r,t?b(n,t):n,i,n]):n}),E=function(t){var n=this._yuievt,r;n||(n=this._yuievt={events:{},targets:null,config:{host:this,context:this},chain:e.config.chain}),r=n.config,t&&(h(r,t,!0),t.chain!==undefined&&(n.chain=t.chain),t.prefix&&(r.prefix=t.prefix))};E.prototype={constructor:E,once:function(){var e=this.on.apply(this,arguments);return e.batch(function(e){e.sub&&(e.sub.once=!0)}),e},onceAfter:function(){var e=this.after.apply(this,arguments);return e.batch(function(e){e.sub&&(e.sub.once=!0)}),e},parseType:function(e,t){return w(e,t||this._yuievt.config.prefix)},on:function(t,n,r){var i=this._yuievt,s=w(t,i.config.prefix),o,u,a,l,c,h,d,v=e.Env.evt.handles,g,y,b,E=e.Node,S,x,T;this._monitor("attach",s[1],{args:arguments,category:s[0],after:s[2]});if(p.isObject(t))return p.isFunction(t)?e.Do.before.apply(e.Do,arguments):(o=n,u=r,a=f.call(arguments,0),l=[],p.isArray(t)&&(T=!0),g=t._after,delete t._after,e.each(t,function(e,t){p.isObject(e)&&(o=e.fn||(p.isFunction(e)?e:o), u=e.context||u);var n=g?m:"";a[0]=n+(T?e:t),a[1]=o,a[2]=u,l.push(this.on.apply(this,a))},this),i.chain?this:new e.EventHandle(l));h=s[0],g=s[2],b=s[3];if(E&&e.instanceOf(this,E)&&b in E.DOM_EVENTS)return a=f.call(arguments,0),a.splice(2,0,E.getDOMNode(this)),e.on.apply(e,a);t=s[1];if(e.instanceOf(this,YUI)){y=e.Env.evt.plugins[t],a=f.call(arguments,0),a[0]=b,E&&(S=a[2],e.instanceOf(S,e.NodeList)?S=e.NodeList.getDOMNodes(S):e.instanceOf(S,E)&&(S=E.getDOMNode(S)),x=b in E.DOM_EVENTS,x&&(a[2]=S));if(y)d=y.on.apply(e,a);else if(!t||x)d=e.Event._attach(a)}return d||(c=i.events[t]||this.publish(t),d=c._on(n,r,arguments.length>3?f.call(arguments,3):null,g?"after":!0),t.indexOf("*:")!==-1&&(this._hasSiblings=!0)),h&&(v[h]=v[h]||{},v[h][t]=v[h][t]||[],v[h][t].push(d)),i.chain?this:d},subscribe:function(){return this.on.apply(this,arguments)},detach:function(t,n,r){var i=this._yuievt.events,s,o=e.Node,u=o&&e.instanceOf(this,o);if(!t&&this!==e){for(s in i)i.hasOwnProperty(s)&&i[s].detach(n,r);return u&&e.Event.purgeElement(o.getDOMNode(this)),this}var a=w(t,this._yuievt.config.prefix),l=p.isArray(a)?a[0]:null,c=a?a[3]:null,h,d=e.Env.evt.handles,v,m,g,y,b=function(e,t,n){var r=e[t],i,s;if(r)for(s=r.length-1;s>=0;--s)i=r[s].evt,(i.host===n||i.el===n)&&r[s].detach()};if(l){m=d[l],t=a[1],v=u?e.Node.getDOMNode(this):this;if(m){if(t)b(m,t,v);else for(s in m)m.hasOwnProperty(s)&&b(m,s,v);return this}}else{if(p.isObject(t)&&t.detach)return t.detach(),this;if(u&&(!c||c in o.DOM_EVENTS))return g=f.call(arguments,0),g[2]=o.getDOMNode(this),e.detach.apply(e,g),this}h=e.Env.evt.plugins[c];if(e.instanceOf(this,YUI)){g=f.call(arguments,0);if(h&&h.detach)return h.detach.apply(e,g),this;if(!t||!h&&o&&t in o.DOM_EVENTS)return g[0]=t,e.Event.detach.apply(e.Event,g),this}return y=i[a[1]],y&&y.detach(n,r),this},unsubscribe:function(){return this.detach.apply(this,arguments)},detachAll:function(e){return this.detach(e)},unsubscribeAll:function(){return this.detachAll.apply(this,arguments)},publish:function(t,n){var r,i=this._yuievt,s=i.config,o=s.prefix;return typeof t=="string"?(o&&(t=b(t,o)),r=this._publish(t,s,n)):(r={},e.each(t,function(e,t){o&&(t=b(t,o)),r[t]=this._publish(t,s,e||n)},this)),r},_getFullType:function(e){var t=this._yuievt.config.prefix;return t?t+d+e:e},_publish:function(t,n,r){var i,s=this._yuievt,o=s.config,u=o.host,a=o.context,f=s.events;return i=f[t],(o.monitored&&!i||i&&i.monitored)&&this._monitor("publish",t,{args:arguments}),i||(i=f[t]=new e.CustomEvent(t,n),n||(i.host=u,i.context=a)),r&&h(i,r,!0),i},_monitor:function(e,t,n){var r,i,s;if(t){typeof t=="string"?(s=t,i=this.getEvent(t,!0)):(i=t,s=t.type);if(this._yuievt.config.monitored&&(!i||i.monitored)||i&&i.monitored)r=s+"_"+e,n.monitored=e,this.fire.call(this,r,n)}},fire:function(e){var t=typeof e=="string",n=arguments.length,r=e,i=this._yuievt,s=i.config,o=s.prefix,u,a,l,c;t&&n<=3?n===2?c=[arguments[1]]:n===3?c=[arguments[1],arguments[2]]:c=[]:c=f.call(arguments,t?1:0),t||(r=e&&e.type),o&&(r=b(r,o)),a=i.events[r],this._hasSiblings&&(l=this.getSibling(r,a),l&&!a&&(a=this.publish(r))),(s.monitored&&(!a||a.monitored)||a&&a.monitored)&&this._monitor("fire",a||r,{args:c});if(!a){if(i.hasTargets)return this.bubble({type:r},c,this);u=!0}else l&&(a.sibling=l),u=a._fire(c);return i.chain?this:u},getSibling:function(e,t){var n;return e.indexOf(d)>-1&&(e=y(e),n=this.getEvent(e,!0),n&&(n.applyConfig(t),n.bubbles=!1,n.broadcast=0)),n},getEvent:function(e,t){var n,r;return t||(n=this._yuievt.config.prefix,e=n?b(e,n):e),r=this._yuievt.events,r[e]||null},after:function(t,n){var r=f.call(arguments,0);switch(p.type(t)){case"function":return e.Do.after.apply(e.Do,arguments);case"array":case"object":r[0]._after=!0;break;default:r[0]=m+t}return this.on.apply(this,r)},before:function(){return this.on.apply(this,arguments)}},e.EventTarget=E,e.mix(e,E.prototype),E.call(e,{bubbles:!1}),YUI.Env.globalEvents=YUI.Env.globalEvents||new E,e.Global=YUI.Env.globalEvents},"@VERSION@",{requires:["oop"]}),YUI.add("event-custom-complex",function(e,t){var n,r,i=e.Object,s,o={},u=e.CustomEvent.prototype,a=e.EventTarget.prototype,f=function(e,t){var n;for(n in t)r.hasOwnProperty(n)||(e[n]=t[n])};e.EventFacade=function(e,t){e||(e=o),this._event=e,this.details=e.details,this.type=e.type,this._type=e.type,this.target=e.target,this.currentTarget=t,this.relatedTarget=e.relatedTarget},e.mix(e.EventFacade.prototype,{stopPropagation:function(){this._event.stopPropagation(),this.stopped=1},stopImmediatePropagation:function(){this._event.stopImmediatePropagation(),this.stopped=2},preventDefault:function(){this._event.preventDefault(),this.prevented=1},halt:function(e){this._event.halt(e),this.prevented=1,this.stopped=e?2:1}}),u.fireComplex=function(t){var n,r,i,s,o,u=!0,a,f,l,c,h,p,d,v,m,g=this,y=g.host||g,b,w,E=g.stack,S=y._yuievt,x;if(E&&g.queuable&&g.type!==E.next.type)return g.log("queue "+g.type),E.queue||(E.queue=[]),E.queue.push([g,t]),!0;x=g.hasSubs()||S.hasTargets||g.broadcast,g.target=g.target||y,g.currentTarget=y,g.details=t.concat();if(x){n=E||{id:g.id,next:g,silent:g.silent,stopped:0,prevented:0,bubbling:null,type:g.type,defaultTargetOnly:g.defaultTargetOnly},f=g.getSubs(),l=f[0],c=f[1],g.stopped=g.type!==n.type?0:n.stopped,g.prevented=g.type!==n.type?0:n.prevented,g.stoppedFn&&(a=new e.EventTarget({fireOnce:!0,context:y}),g.events=a,a.on("stopped",g.stoppedFn)),g.log("Firing "+g.type),g._facade=null,r=g._createFacade(t),l&&g._procSubs(l,t,r),g.bubbles&&y.bubble&&!g.stopped&&(w=n.bubbling,n.bubbling=g.type,n.type!==g.type&&(n.stopped=0,n.prevented=0),u=y.bubble(g,t,null,n),g.stopped=Math.max(g.stopped,n.stopped),g.prevented=Math.max(g.prevented,n.prevented),n.bubbling=w),d=g.prevented,d?(v=g.preventedFn,v&&v.apply(y,t)):(m=g.defaultFn,m&&(!g.defaultTargetOnly&&!n.defaultTargetOnly||y===r.target)&&m.apply(y,t)),g.broadcast&&g._broadcast(t);if(c&&!g.prevented&&g.stopped<2){h=n.afterQueue;if(n.id===g.id||g.type!==S.bubbling){g._procSubs(c,t,r);if(h)while(b=h.last())b()}else p=c,n .execDefaultCnt&&(p=e.merge(p),e.each(p,function(e){e.postponed=!0})),h||(n.afterQueue=new e.Queue),n.afterQueue.add(function(){g._procSubs(p,t,r)})}g.target=null;if(n.id===g.id){s=n.queue;if(s)while(s.length)i=s.pop(),o=i[0],n.next=o,o._fire(i[1]);g.stack=null}u=!g.stopped,g.type!==S.bubbling&&(n.stopped=0,n.prevented=0,g.stopped=0,g.prevented=0)}else m=g.defaultFn,m&&(r=g._createFacade(t),(!g.defaultTargetOnly||y===r.target)&&m.apply(y,t));return g._facade=null,u},u._hasPotentialSubscribers=function(){return this.hasSubs()||this.host._yuievt.hasTargets||this.broadcast},u._createFacade=u._getFacade=function(t){var n=this.details,r=n&&n[0],i=r&&typeof r=="object",s=this._facade;return s||(s=new e.EventFacade(this,this.currentTarget)),i?(f(s,r),r.type&&(s.type=r.type),t&&(t[0]=s)):t&&t.unshift(s),s.details=this.details,s.target=this.originalTarget||this.target,s.currentTarget=this.currentTarget,s.stopped=0,s.prevented=0,this._facade=s,this._facade},u._addFacadeToArgs=function(e){var t=e[0];t&&t.halt&&t.stopImmediatePropagation&&t.stopPropagation&&t._event||this._createFacade(e)},u.stopPropagation=function(){this.stopped=1,this.stack&&(this.stack.stopped=1),this.events&&this.events.fire("stopped",this)},u.stopImmediatePropagation=function(){this.stopped=2,this.stack&&(this.stack.stopped=2),this.events&&this.events.fire("stopped",this)},u.preventDefault=function(){this.preventable&&(this.prevented=1,this.stack&&(this.stack.prevented=1))},u.halt=function(e){e?this.stopImmediatePropagation():this.stopPropagation(),this.preventDefault()},a.addTarget=function(t){var n=this._yuievt;n.targets||(n.targets={}),n.targets[e.stamp(t)]=t,n.hasTargets=!0},a.getTargets=function(){var e=this._yuievt.targets;return e?i.values(e):[]},a.removeTarget=function(t){var n=this._yuievt.targets;n&&(delete n[e.stamp(t,!0)],i.size(n)===0&&(this._yuievt.hasTargets=!1))},a.bubble=function(e,t,n,r){var i=this._yuievt.targets,s=!0,o,u,a,f,l,c=e&&e.type,h=n||e&&e.target||this,p;if(!e||!e.stopped&&i)for(a in i)if(i.hasOwnProperty(a)){o=i[a],u=o._yuievt.events[c],o._hasSiblings&&(l=o.getSibling(c,u)),l&&!u&&(u=o.publish(c)),p=o._yuievt.bubbling,o._yuievt.bubbling=c;if(!u)o._yuievt.hasTargets&&o.bubble(e,t,h,r);else{l&&(u.sibling=l),u.target=h,u.originalTarget=h,u.currentTarget=o,f=u.broadcast,u.broadcast=!1,u.emitFacade=!0,u.stack=r,s=s&&u.fire.apply(u,t||e.details||[]),u.broadcast=f,u.originalTarget=null;if(u.stopped)break}o._yuievt.bubbling=p}return s},a._hasPotentialSubscribers=function(e){var t=this._yuievt,n=t.events[e];return n?n.hasSubs()||t.hasTargets||n.broadcast:!1},n=new e.EventFacade,r={};for(s in n)r[s]=!0},"@VERSION@",{requires:["event-custom-base"]}),YUI.add("node-core",function(e,t){var n=".",r="nodeName",i="nodeType",s="ownerDocument",o="tagName",u="_yuid",a={},f=Array.prototype.slice,l=e.DOM,c=function(t){if(!this.getDOMNode)return new c(t);if(typeof t=="string"){t=c._fromString(t);if(!t)return null}var n=t.nodeType!==9?t.uniqueID:t[u];n&&c._instances[n]&&c._instances[n]._node!==t&&(t[u]=null),n=n||e.stamp(t),n||(n=e.guid()),this[u]=n,this._node=t,this._stateProxy=t,this._initPlugins&&this._initPlugins()},h=function(t){var n=null;return t&&(n=typeof t=="string"?function(n){return e.Selector.test(n,t)}:function(n){return t(e.one(n))}),n};c.ATTRS={},c.DOM_EVENTS={},c._fromString=function(t){return t&&(t.indexOf("doc")===0?t=e.config.doc:t.indexOf("win")===0?t=e.config.win:t=e.Selector.query(t,null,!0)),t||null},c.NAME="node",c.re_aria=/^(?:role$|aria-)/,c.SHOW_TRANSITION="fadeIn",c.HIDE_TRANSITION="fadeOut",c._instances={},c.getDOMNode=function(e){return e?e.nodeType?e:e._node||null:null},c.scrubVal=function(t,n){if(t){if(typeof t=="object"||typeof t=="function")if(i in t||l.isWindow(t))t=e.one(t);else if(t.item&&!t._nodes||t[0]&&t[0][i])t=e.all(t)}else typeof t=="undefined"?t=n:t===null&&(t=null);return t},c.addMethod=function(e,t,n){e&&t&&typeof t=="function"&&(c.prototype[e]=function(){var e=f.call(arguments),r=this,i;return e[0]&&e[0]._node&&(e[0]=e[0]._node),e[1]&&e[1]._node&&(e[1]=e[1]._node),e.unshift(r._node),i=t.apply(n||r,e),i&&(i=c.scrubVal(i,r)),typeof i!="undefined"||(i=r),i})},c.importMethod=function(t,n,r){typeof n=="string"?(r=r||n,c.addMethod(r,t[n],t)):e.Array.each(n,function(e){c.importMethod(t,e)})},c.one=function(t){var n=null,r,i;if(t){if(typeof t=="string"){t=c._fromString(t);if(!t)return null}else if(t.getDOMNode)return t;if(t.nodeType||e.DOM.isWindow(t)){i=t.uniqueID&&t.nodeType!==9?t.uniqueID:t._yuid,n=c._instances[i],r=n?n._node:null;if(!n||r&&t!==r)n=new c(t),t.nodeType!=11&&(c._instances[n[u]]=n)}}return n},c.DEFAULT_SETTER=function(t,r){var i=this._stateProxy,s;return t.indexOf(n)>-1?(s=t,t=t.split(n),e.Object.setValue(i,t,r)):typeof i[t]!="undefined"&&(i[t]=r),r},c.DEFAULT_GETTER=function(t){var r=this._stateProxy,i;return t.indexOf&&t.indexOf(n)>-1?i=e.Object.getValue(r,t.split(n)):typeof r[t]!="undefined"&&(i=r[t]),i},e.mix(c.prototype,{DATA_PREFIX:"data-",toString:function(){var e=this[u]+": not bound to a node",t=this._node,n,i,s;return t&&(n=t.attributes,i=n&&n.id?t.getAttribute("id"):null,s=n&&n.className?t.getAttribute("className"):null,e=t[r],i&&(e+="#"+i),s&&(e+="."+s.replace(" ",".")),e+=" "+this[u]),e},get:function(e){var t;return this._getAttr?t=this._getAttr(e):t=this._get(e),t?t=c.scrubVal(t,this):t===null&&(t=null),t},_get:function(e){var t=c.ATTRS[e],n;return t&&t.getter?n=t.getter.call(this):c.re_aria.test(e)?n=this._node.getAttribute(e,2):n=c.DEFAULT_GETTER.apply(this,arguments),n},set:function(e,t){var n=c.ATTRS[e];return this._setAttr?this._setAttr.apply(this,arguments):n&&n.setter?n.setter.call(this,t,e):c.re_aria.test(e)?this._node.setAttribute(e,t):c.DEFAULT_SETTER.apply(this,arguments),this},setAttrs:function(t){return this._setAttrs?this._setAttrs(t):e.Object.each(t,function(e,t){this.set(t,e)},this),this},getAttrs:function(t){var n={};return this._getAttrs?this._getAttrs(t):e.Array.each(t,function(e,t){n[e]=this.get(e)},this),n},compareTo:function(e){var t= this._node;return e&&e._node&&(e=e._node),t===e},inDoc:function(e){var t=this._node;e=e?e._node||e:t[s];if(e.documentElement)return l.contains(e.documentElement,t)},getById:function(t){var n=this._node,r=l.byId(t,n[s]);return r&&l.contains(n,r)?r=e.one(r):r=null,r},ancestor:function(t,n,r){return arguments.length===2&&(typeof n=="string"||typeof n=="function")&&(r=n),e.one(l.ancestor(this._node,h(t),n,h(r)))},ancestors:function(t,n,r){return arguments.length===2&&(typeof n=="string"||typeof n=="function")&&(r=n),e.all(l.ancestors(this._node,h(t),n,h(r)))},previous:function(t,n){return e.one(l.elementByAxis(this._node,"previousSibling",h(t),n))},next:function(t,n){return e.one(l.elementByAxis(this._node,"nextSibling",h(t),n))},siblings:function(t){return e.all(l.siblings(this._node,h(t)))},one:function(t){return e.one(e.Selector.query(t,this._node,!0))},all:function(t){var n;return this._node&&(n=e.all(e.Selector.query(t,this._node)),n._query=t,n._queryRoot=this._node),n||e.all([])},test:function(t){return e.Selector.test(this._node,t)},remove:function(e){var t=this._node;return t&&t.parentNode&&t.parentNode.removeChild(t),e&&this.destroy(),this},replace:function(e){var t=this._node;return typeof e=="string"&&(e=c.create(e)),t.parentNode.replaceChild(c.getDOMNode(e),t),this},replaceChild:function(t,n){return typeof t=="string"&&(t=l.create(t)),e.one(this._node.replaceChild(c.getDOMNode(t),c.getDOMNode(n)))},destroy:function(t){var n=e.config.doc.uniqueID?"uniqueID":"_yuid",r;this.purge(),this.unplug&&this.unplug(),this.clearData(),t&&e.NodeList.each(this.all("*"),function(t){r=c._instances[t[n]],r?r.destroy():e.Event.purgeElement(t)}),this._node=null,this._stateProxy=null,delete c._instances[this._yuid]},invoke:function(e,t,n,r,i,s){var o=this._node,u;return t&&t._node&&(t=t._node),n&&n._node&&(n=n._node),u=o[e](t,n,r,i,s),c.scrubVal(u,this)},swap:e.config.doc.documentElement.swapNode?function(e){this._node.swapNode(c.getDOMNode(e))}:function(e){e=c.getDOMNode(e);var t=this._node,n=e.parentNode,r=e.nextSibling;return r===t?n.insertBefore(t,e):e===t.nextSibling?n.insertBefore(e,t):(t.parentNode.replaceChild(e,t),l.addHTML(n,t,r)),this},hasMethod:function(e){var t=this._node;return!(!(t&&e in t&&typeof t[e]!="unknown")||typeof t[e]!="function"&&String(t[e]).indexOf("function")!==1)},isFragment:function(){return this.get("nodeType")===11},empty:function(){return this.get("childNodes").remove().destroy(!0),this},getDOMNode:function(){return this._node}},!0),e.Node=c,e.one=c.one;var p=function(t){var n=[];t&&(typeof t=="string"?(this._query=t,t=e.Selector.query(t)):t.nodeType||l.isWindow(t)?t=[t]:t._node?t=[t._node]:t[0]&&t[0]._node?(e.Array.each(t,function(e){e._node&&n.push(e._node)}),t=n):t=e.Array(t,0,!0)),this._nodes=t||[]};p.NAME="NodeList",p.getDOMNodes=function(e){return e&&e._nodes?e._nodes:e},p.each=function(t,n,r){var i=t._nodes;i&&i.length&&e.Array.each(i,n,r||t)},p.addMethod=function(t,n,r){t&&n&&(p.prototype[t]=function(){var t=[],i=arguments;return e.Array.each(this._nodes,function(s){var o=s.uniqueID&&s.nodeType!==9?"uniqueID":"_yuid",u=e.Node._instances[s[o]],a,f;u||(u=p._getTempNode(s)),a=r||u,f=n.apply(a,i),f!==undefined&&f!==u&&(t[t.length]=f)}),t.length?t:this})},p.importMethod=function(t,n,r){typeof n=="string"?(r=r||n,p.addMethod(n,t[n])):e.Array.each(n,function(e){p.importMethod(t,e)})},p._getTempNode=function(t){var n=p._tempNode;return n||(n=e.Node.create("<div></div>"),p._tempNode=n),n._node=t,n._stateProxy=t,n},e.mix(p.prototype,{_invoke:function(e,t,n){var r=n?[]:this;return this.each(function(i){var s=i[e].apply(i,t);n&&r.push(s)}),r},item:function(t){return e.one((this._nodes||[])[t])},each:function(t,n){var r=this;return e.Array.each(this._nodes,function(i,s){return i=e.one(i),t.call(n||i,i,s,r)}),r},batch:function(t,n){var r=this;return e.Array.each(this._nodes,function(i,s){var o=e.Node._instances[i[u]];return o||(o=p._getTempNode(i)),t.call(n||o,o,s,r)}),r},some:function(t,n){var r=this;return e.Array.some(this._nodes,function(i,s){return i=e.one(i),n=n||i,t.call(n,i,s,r)})},toFrag:function(){return e.one(e.DOM._nl2frag(this._nodes))},indexOf:function(t){return e.Array.indexOf(this._nodes,e.Node.getDOMNode(t))},filter:function(t){return e.all(e.Selector.filter(this._nodes,t))},modulus:function(t,n){n=n||0;var r=[];return p.each(this,function(e,i){i%t===n&&r.push(e)}),e.all(r)},odd:function(){return this.modulus(2,1)},even:function(){return this.modulus(2)},destructor:function(){},refresh:function(){var t,n=this._nodes,r=this._query,i=this._queryRoot;return r&&(i||n&&n[0]&&n[0].ownerDocument&&(i=n[0].ownerDocument),this._nodes=e.Selector.query(r,i)),this},size:function(){return this._nodes.length},isEmpty:function(){return this._nodes.length<1},toString:function(){var e="",t=this[u]+": not bound to any nodes",n=this._nodes,i;return n&&n[0]&&(i=n[0],e+=i[r],i.id&&(e+="#"+i.id),i.className&&(e+="."+i.className.replace(" ",".")),n.length>1&&(e+="...["+n.length+" items]")),e||t},getDOMNodes:function(){return this._nodes}},!0),p.importMethod(e.Node.prototype,["destroy","empty","remove","set"]),p.prototype.get=function(t){var n=[],r=this._nodes,i=!1,s=p._getTempNode,o,u;return r[0]&&(o=e.Node._instances[r[0]._yuid]||s(r[0]),u=o._get(t),u&&u.nodeType&&(i=!0)),e.Array.each(r,function(r){o=e.Node._instances[r._yuid],o||(o=s(r)),u=o._get(t),i||(u=e.Node.scrubVal(u,o)),n.push(u)}),i?e.all(n):n},e.NodeList=p,e.all=function(e){return new p(e)},e.Node.all=e.all;var d=e.NodeList,v=Array.prototype,m={concat:1,pop:0,push:0,shift:0,slice:1,splice:1,unshift:0};e.Object.each(m,function(t,n){d.prototype[n]=function(){var r=[],i=0,s,o;while(typeof (s=arguments[i++])!="undefined")r.push(s._node||s._nodes||s);return o=v[n].apply(this._nodes,r),t?o=e.all(o):o=e.Node.scrubVal(o),o}}),e.Array.each(["removeChild","hasChildNodes","cloneNode","hasAttribute","scrollIntoView","getElementsByTagName","focus","blur","submit","reset","select","createCaption"],function(t){e.Node.prototype[t]=function( e,n,r){var i=this.invoke(t,e,n,r);return i}}),e.Node.prototype.removeAttribute=function(e){var t=this._node;return t&&t.removeAttribute(e,0),this},e.Node.importMethod(e.DOM,["contains","setAttribute","getAttribute","wrap","unwrap","generateID"]),e.NodeList.importMethod(e.Node.prototype,["getAttribute","setAttribute","removeAttribute","unwrap","wrap","generateID"])},"@VERSION@",{requires:["dom-core","selector"]}),YUI.add("node-base",function(e,t){var n=["hasClass","addClass","removeClass","replaceClass","toggleClass"];e.Node.importMethod(e.DOM,n),e.NodeList.importMethod(e.Node.prototype,n);var r=e.Node,i=e.DOM;r.create=function(t,n){return n&&n._node&&(n=n._node),e.one(i.create(t,n))},e.mix(r.prototype,{create:r.create,insert:function(e,t){return this._insert(e,t),this},_insert:function(e,t){var n=this._node,r=null;return typeof t=="number"?t=this._node.childNodes[t]:t&&t._node&&(t=t._node),e&&typeof e!="string"&&(e=e._node||e._nodes||e),r=i.addHTML(n,e,t),r},prepend:function(e){return this.insert(e,0)},append:function(e){return this.insert(e,null)},appendChild:function(e){return r.scrubVal(this._insert(e))},insertBefore:function(t,n){return e.Node.scrubVal(this._insert(t,n))},appendTo:function(t){return e.one(t).append(this),this},setContent:function(e){return this._insert(e,"replace"),this},getContent:function(){var e=this;return e._node.nodeType===11&&(e=e.create("<div/>").append(e.cloneNode(!0))),e.get("innerHTML")}}),e.Node.prototype.setHTML=e.Node.prototype.setContent,e.Node.prototype.getHTML=e.Node.prototype.getContent,e.NodeList.importMethod(e.Node.prototype,["append","insert","appendChild","insertBefore","prepend","setContent","getContent","setHTML","getHTML"]);var r=e.Node,i=e.DOM;r.ATTRS={text:{getter:function(){return i.getText(this._node)},setter:function(e){return i.setText(this._node,e),e}},"for":{getter:function(){return i.getAttribute(this._node,"for")},setter:function(e){return i.setAttribute(this._node,"for",e),e}},options:{getter:function(){return this._node.getElementsByTagName("option")}},children:{getter:function(){var t=this._node,n=t.children,r,i,s;if(!n){r=t.childNodes,n=[];for(i=0,s=r.length;i<s;++i)r[i].tagName&&(n[n.length]=r[i])}return e.all(n)}},value:{getter:function(){return i.getValue(this._node)},setter:function(e){return i.setValue(this._node,e),e}}},e.Node.importMethod(e.DOM,["setAttribute","getAttribute"]);var r=e.Node,s=e.NodeList;r.DOM_EVENTS={abort:1,beforeunload:1,blur:1,change:1,click:1,close:1,command:1,contextmenu:1,dblclick:1,DOMMouseScroll:1,drag:1,dragstart:1,dragenter:1,dragover:1,dragleave:1,dragend:1,drop:1,error:1,focus:1,key:1,keydown:1,keypress:1,keyup:1,load:1,message:1,mousedown:1,mouseenter:1,mouseleave:1,mousemove:1,mousemultiwheel:1,mouseout:1,mouseover:1,mouseup:1,mousewheel:1,orientationchange:1,reset:1,resize:1,select:1,selectstart:1,submit:1,scroll:1,textInput:1,unload:1},e.mix(r.DOM_EVENTS,e.Env.evt.plugins),e.augment(r,e.EventTarget),e.mix(r.prototype,{purge:function(t,n){return e.Event.purgeElement(this._node,t,n),this}}),e.mix(e.NodeList.prototype,{_prepEvtArgs:function(t,n,r){var i=e.Array(arguments,0,!0);return i.length<2?i[2]=this._nodes:i.splice(2,0,this._nodes),i[3]=r||this,i},on:function(t,n,r){return e.on.apply(e,this._prepEvtArgs.apply(this,arguments))},once:function(t,n,r){return e.once.apply(e,this._prepEvtArgs.apply(this,arguments))},after:function(t,n,r){return e.after.apply(e,this._prepEvtArgs.apply(this,arguments))},onceAfter:function(t,n,r){return e.onceAfter.apply(e,this._prepEvtArgs.apply(this,arguments))}}),s.importMethod(e.Node.prototype,["detach","detachAll"]),e.mix(e.Node.ATTRS,{offsetHeight:{setter:function(t){return e.DOM.setHeight(this._node,t),t},getter:function(){return this._node.offsetHeight}},offsetWidth:{setter:function(t){return e.DOM.setWidth(this._node,t),t},getter:function(){return this._node.offsetWidth}}}),e.mix(e.Node.prototype,{sizeTo:function(t,n){var r;arguments.length<2&&(r=e.one(t),t=r.get("offsetWidth"),n=r.get("offsetHeight")),this.setAttrs({offsetWidth:t,offsetHeight:n})}});var r=e.Node;e.mix(r.prototype,{show:function(e){return e=arguments[arguments.length-1],this.toggleView(!0,e),this},_show:function(){this.removeAttribute("hidden"),this.setStyle("display","")},_isHidden:function(){return this.hasAttribute("hidden")||e.DOM.getComputedStyle(this._node,"display")==="none"},toggleView:function(e,t){return this._toggleView.apply(this,arguments),this},_toggleView:function(e,t){return t=arguments[arguments.length-1],typeof e!="boolean"&&(e=this._isHidden()?1:0),e?this._show():this._hide(),typeof t=="function"&&t.call(this),this},hide:function(e){return e=arguments[arguments.length-1],this.toggleView(!1,e),this},_hide:function(){this.setAttribute("hidden",""),this.setStyle("display","none")}}),e.NodeList.importMethod(e.Node.prototype,["show","hide","toggleView"]),e.config.doc.documentElement.hasAttribute||(e.Node.prototype.hasAttribute=function(e){return e==="value"&&this.get("value")!==""?!0:!!this._node.attributes[e]&&!!this._node.attributes[e].specified}),e.Node.prototype.focus=function(){try{this._node.focus()}catch(e){}return this},e.Node.ATTRS.type={setter:function(e){if(e==="hidden")try{this._node.type="hidden"}catch(t){this.setStyle("display","none"),this._inputType="hidden"}else try{this._node.type=e}catch(t){}return e},getter:function(){return this._inputType||this._node.type},_bypassProxy:!0},e.config.doc.createElement("form").elements.nodeType&&(e.Node.ATTRS.elements={getter:function(){return this.all("input, textarea, button, select")}}),e.mix(e.Node.prototype,{_initData:function(){"_data"in this||(this._data={})},getData:function(t){this._initData();var n=this._data,r=n;return arguments.length?t in n?r=n[t]:r=this._getDataAttribute(t):typeof n=="object"&&n!==null&&(r={},e.Object.each(n,function(e,t){r[t]=e}),r=this._getDataAttributes(r)),r},_getDataAttributes:function(e){e=e||{};var t=0,n=this._node.attributes,r=n.length,i=this.DATA_PREFIX,s=i.length,o;while(t<r)o=n[t].name ,o.indexOf(i)===0&&(o=o.substr(s),o in e||(e[o]=this._getDataAttribute(o))),t+=1;return e},_getDataAttribute:function(e){e=this.DATA_PREFIX+e;var t=this._node,n=t.attributes,r=n&&n[e]&&n[e].value;return r},setData:function(e,t){return this._initData(),arguments.length>1?this._data[e]=t:this._data=e,this},clearData:function(e){return"_data"in this&&(typeof e!="undefined"?delete this._data[e]:delete this._data),this}}),e.mix(e.NodeList.prototype,{getData:function(e){var t=arguments.length?[e]:[];return this._invoke("getData",t,!0)},setData:function(e,t){var n=arguments.length>1?[e,t]:[e];return this._invoke("setData",n)},clearData:function(e){var t=arguments.length?[e]:[];return this._invoke("clearData",[e])}})},"@VERSION@",{requires:["event-base","node-core","dom-base","dom-style"]}),function(){var e=YUI.Env;e._ready||(e._ready=function(){e.DOMReady=!0,e.remove(YUI.config.doc,"DOMContentLoaded",e._ready)},e.add(YUI.config.doc,"DOMContentLoaded",e._ready))}(),YUI.add("event-base",function(e,t){e.publish("domready",{fireOnce:!0,async:!0}),YUI.Env.DOMReady?e.fire("domready"):e.Do.before(function(){e.fire("domready")},YUI.Env,"_ready");var n=e.UA,r={},i={63232:38,63233:40,63234:37,63235:39,63276:33,63277:34,25:9,63272:46,63273:36,63275:35},s=function(t){if(!t)return t;try{t&&3==t.nodeType&&(t=t.parentNode)}catch(n){return null}return e.one(t)},o=function(e,t,n){this._event=e,this._currentTarget=t,this._wrapper=n||r,this.init()};e.extend(o,Object,{init:function(){var e=this._event,t=this._wrapper.overrides,r=e.pageX,o=e.pageY,u,a=this._currentTarget;this.altKey=e.altKey,this.ctrlKey=e.ctrlKey,this.metaKey=e.metaKey,this.shiftKey=e.shiftKey,this.type=t&&t.type||e.type,this.clientX=e.clientX,this.clientY=e.clientY,this.pageX=r,this.pageY=o,u=e.keyCode||e.charCode,n.webkit&&u in i&&(u=i[u]),this.keyCode=u,this.charCode=u,this.which=e.which||e.charCode||u,this.button=this.which,this.target=s(e.target),this.currentTarget=s(a),this.relatedTarget=s(e.relatedTarget);if(e.type=="mousewheel"||e.type=="DOMMouseScroll")this.wheelDelta=e.detail?e.detail*-1:Math.round(e.wheelDelta/80)||(e.wheelDelta<0?-1:1);this._touch&&this._touch(e,a,this._wrapper)},stopPropagation:function(){this._event.stopPropagation(),this._wrapper.stopped=1,this.stopped=1},stopImmediatePropagation:function(){var e=this._event;e.stopImmediatePropagation?e.stopImmediatePropagation():this.stopPropagation(),this._wrapper.stopped=2,this.stopped=2},preventDefault:function(e){var t=this._event;t.preventDefault(),t.returnValue=e||!1,this._wrapper.prevented=1,this.prevented=1},halt:function(e){e?this.stopImmediatePropagation():this.stopPropagation(),this.preventDefault()}}),o.resolve=s,e.DOM2EventFacade=o,e.DOMEventFacade=o,function(){e.Env.evt.dom_wrappers={},e.Env.evt.dom_map={};var t=e.Env.evt,n=e.config,r=n.win,i=YUI.Env.add,s=YUI.Env.remove,o=function(){YUI.Env.windowLoaded=!0,e.Event._load(),s(r,"load",o)},u=function(){e.Event._unload()},a="domready",f="~yui|2|compat~",l=function(t){try{return t&&typeof t!="string"&&e.Lang.isNumber(t.length)&&!t.tagName&&!e.DOM.isWindow(t)}catch(n){return!1}},c=e.CustomEvent.prototype._delete,h=function(t){var n=c.apply(this,arguments);return this.hasSubs()||e.Event._clean(this),n},p=function(){var n=!1,o=0,c=[],d=t.dom_wrappers,v=null,m=t.dom_map;return{POLL_RETRYS:1e3,POLL_INTERVAL:40,lastError:null,_interval:null,_dri:null,DOMReady:!1,startInterval:function(){p._interval||(p._interval=setInterval(p._poll,p.POLL_INTERVAL))},onAvailable:function(t,n,r,i,s,u){var a=e.Array(t),f,l;for(f=0;f<a.length;f+=1)c.push({id:a[f],fn:n,obj:r,override:i,checkReady:s,compat:u});return o=this.POLL_RETRYS,setTimeout(p._poll,0),l=new e.EventHandle({_delete:function(){if(l.handle){l.handle.detach();return}var e,t;for(e=0;e<a.length;e++)for(t=0;t<c.length;t++)a[e]===c[t].id&&c.splice(t,1)}}),l},onContentReady:function(e,t,n,r,i){return p.onAvailable(e,t,n,r,!0,i)},attach:function(t,n,r,i){return p._attach(e.Array(arguments,0,!0))},_createWrapper:function(t,n,s,o,u){var a,f=e.stamp(t),l="event:"+f+n;return!1===u&&(l+="native"),s&&(l+="capture"),a=d[l],a||(a=e.publish(l,{silent:!0,bubbles:!1,emitFacade:!1,contextFn:function(){return o?a.el:(a.nodeRef=a.nodeRef||e.one(a.el),a.nodeRef)}}),a.overrides={},a.el=t,a.key=l,a.domkey=f,a.type=n,a.fn=function(e){a.fire(p.getEvent(e,t,o||!1===u))},a.capture=s,t==r&&n=="load"&&(a.fireOnce=!0,v=l),a._delete=h,d[l]=a,m[f]=m[f]||{},m[f][l]=a,i(t,n,a.fn,s)),a},_attach:function(t,n){var i,s,o,u,a,c=!1,h,d=t[0],v=t[1],m=t[2]||r,g=n&&n.facade,y=n&&n.capture,b=n&&n.overrides;t[t.length-1]===f&&(i=!0);if(!v||!v.call)return!1;if(l(m))return s=[],e.each(m,function(e,r){t[2]=e,s.push(p._attach(t.slice(),n))}),new e.EventHandle(s);if(e.Lang.isString(m)){if(i)o=e.DOM.byId(m);else{o=e.Selector.query(m);switch(o.length){case 0:o=null;break;case 1:o=o[0];break;default:return t[2]=o,p._attach(t,n)}}if(!o)return h=p.onAvailable(m,function(){h.handle=p._attach(t,n)},p,!0,!1,i),h;m=o}return m?(e.Node&&e.instanceOf(m,e.Node)&&(m=e.Node.getDOMNode(m)),u=p._createWrapper(m,d,y,i,g),b&&e.mix(u.overrides,b),m==r&&d=="load"&&YUI.Env.windowLoaded&&(c=!0),i&&t.pop(),a=t[3],h=u._on(v,a,t.length>4?t.slice(4):null),c&&u.fire(),h):!1},detach:function(t,n,r,i){var s=e.Array(arguments,0,!0),o,u,a,c,h,v;s[s.length-1]===f&&(o=!0);if(t&&t.detach)return t.detach();typeof r=="string"&&(o?r=e.DOM.byId(r):(r=e.Selector.query(r),u=r.length,u<1?r=null:u==1&&(r=r[0])));if(!r)return!1;if(r.detach)return s.splice(2,1),r.detach.apply(r,s);if(l(r)){a=!0;for(c=0,u=r.length;c<u;++c)s[2]=r[c],a=e.Event.detach.apply(e.Event,s)&&a;return a}return!t||!n||!n.call?p.purgeElement(r,!1,t):(h="event:"+e.stamp(r)+t,v=d[h],v?v.detach(n):!1)},getEvent:function(t,n,i){var s=t||r.event;return i?s:new e.DOMEventFacade(s,n,d["event:"+e.stamp(n)+t.type])},generateId:function(t){return e.DOM.generateID(t)},_isValidCollection:l,_load:function(t){n||(n=!0,e.fire&&e.fire(a),p._poll())},_poll:function(){if(p.locked)return;if(e.UA.ie&&!YUI.Env.DOMReady){p.startInterval ();return}p.locked=!0;var t,r,i,s,u,a,f=!n;f||(f=o>0),u=[],a=function(t,n){var r,i=n.override;try{n.compat?(n.override?i===!0?r=n.obj:r=i:r=t,n.fn.call(r,n.obj)):(r=n.obj||e.one(t),n.fn.apply(r,e.Lang.isArray(i)?i:[]))}catch(s){}};for(t=0,r=c.length;t<r;++t)i=c[t],i&&!i.checkReady&&(s=i.compat?e.DOM.byId(i.id):e.Selector.query(i.id,null,!0),s?(a(s,i),c[t]=null):u.push(i));for(t=0,r=c.length;t<r;++t){i=c[t];if(i&&i.checkReady){s=i.compat?e.DOM.byId(i.id):e.Selector.query(i.id,null,!0);if(s){if(n||s.get&&s.get("nextSibling")||s.nextSibling)a(s,i),c[t]=null}else u.push(i)}}o=u.length===0?0:o-1,f?p.startInterval():(clearInterval(p._interval),p._interval=null),p.locked=!1;return},purgeElement:function(t,n,r){var i=e.Lang.isString(t)?e.Selector.query(t,null,!0):t,s=p.getListeners(i,r),o,u,a,f;if(n&&i){s=s||[],a=e.Selector.query("*",i),u=a.length;for(o=0;o<u;++o)f=p.getListeners(a[o],r),f&&(s=s.concat(f))}if(s)for(o=0,u=s.length;o<u;++o)s[o].detachAll()},_clean:function(t){var n=t.key,r=t.domkey;s(t.el,t.type,t.fn,t.capture),delete d[n],delete e._yuievt.events[n],m[r]&&(delete m[r][n],e.Object.size(m[r])||delete m[r])},getListeners:function(n,r){var i=e.stamp(n,!0),s=m[i],o=[],u=r?"event:"+i+r:null,a=t.plugins;return s?(u?(a[r]&&a[r].eventDef&&(u+="_synth"),s[u]&&o.push(s[u]),u+="native",s[u]&&o.push(s[u])):e.each(s,function(e,t){o.push(e)}),o.length?o:null):null},_unload:function(t){e.each(d,function(e,n){e.type=="unload"&&e.fire(t),e.detachAll()}),s(r,"unload",u)},nativeAdd:i,nativeRemove:s}}();e.Event=p,n.injected||YUI.Env.windowLoaded?o():i(r,"load",o);if(e.UA.ie){e.on(a,p._poll);if(e.UA.ie<7)try{i(r,"unload",u)}catch(d){}}p.Custom=e.CustomEvent,p.Subscriber=e.Subscriber,p.Target=e.EventTarget,p.Handle=e.EventHandle,p.Facade=e.EventFacade,p._poll()}(),e.Env.evt.plugins.available={on:function(t,n,r,i){var s=arguments.length>4?e.Array(arguments,4,!0):null;return e.Event.onAvailable.call(e.Event,r,n,i,s)}},e.Env.evt.plugins.contentready={on:function(t,n,r,i){var s=arguments.length>4?e.Array(arguments,4,!0):null;return e.Event.onContentReady.call(e.Event,r,n,i,s)}}},"@VERSION@",{requires:["event-custom-base"]}),function(){var e,t=YUI.Env,n=YUI.config,r=n.doc,i=r&&r.documentElement,s="onreadystatechange",o=n.pollInterval||40;i.doScroll&&!t._ieready&&(t._ieready=function(){t._ready()}, /*! DOMReady: based on work by: Dean Edwards/John Resig/Matthias Miller/Diego Perini */ self!==self.top?(e=function(){r.readyState=="complete"&&(t.remove(r,s,e),t.ieready())},t.add(r,s,e)):t._dri=setInterval(function(){try{i.doScroll("left"),clearInterval(t._dri),t._dri=null,t._ieready()}catch(e){}},o))}(),YUI.add("event-base-ie",function(e,t){function n(){e.DOM2EventFacade.apply(this,arguments)}function r(t){var n=e.config.doc.createEventObject(t),i=r.prototype;return n.hasOwnProperty=function(){return!0},n.init=i.init,n.halt=i.halt,n.preventDefault=i.preventDefault,n.stopPropagation=i.stopPropagation,n.stopImmediatePropagation=i.stopImmediatePropagation,e.DOM2EventFacade.apply(n,arguments),n}var i=e.config.doc&&e.config.doc.implementation,s=e.config.lazyEventFacade,o={0:1,4:2,2:3},u={mouseout:"toElement",mouseover:"fromElement"},a=e.DOM2EventFacade.resolve,f={init:function(){n.superclass.init.apply(this,arguments);var t=this._event,r,i,s,u,f,l;this.target=a(t.srcElement),"clientX"in t&&!r&&0!==r&&(r=t.clientX,i=t.clientY,s=e.config.doc,u=s.body,f=s.documentElement,r+=f.scrollLeft||u&&u.scrollLeft||0,i+=f.scrollTop||u&&u.scrollTop||0,this.pageX=r,this.pageY=i),t.type=="mouseout"?l=t.toElement:t.type=="mouseover"&&(l=t.fromElement),this.relatedTarget=a(l||t.relatedTarget),this.which=this.button=t.keyCode||o[t.button]||t.button},stopPropagation:function(){this._event.cancelBubble=!0,this._wrapper.stopped=1,this.stopped=1},stopImmediatePropagation:function(){this.stopPropagation(),this._wrapper.stopped=2,this.stopped=2},preventDefault:function(e){this._event.returnValue=e||!1,this._wrapper.prevented=1,this.prevented=1}};e.extend(n,e.DOM2EventFacade,f),e.extend(r,e.DOM2EventFacade,f),r.prototype.init=function(){var e=this._event,t=this._wrapper.overrides,n=r._define,i=r._lazyProperties,s;this.altKey=e.altKey,this.ctrlKey=e.ctrlKey,this.metaKey=e.metaKey,this.shiftKey=e.shiftKey,this.type=t&&t.type||e.type,this.clientX=e.clientX,this.clientY=e.clientY,this.keyCode=this.charCode=e.keyCode,this.which=this.button=e.keyCode||o[e.button]||e.button;for(s in i)i.hasOwnProperty(s)&&n(this,s,i[s]);this._touch&&this._touch(e,this._currentTarget,this._wrapper)},r._lazyProperties={target:function(){return a(this._event.srcElement)},relatedTarget:function(){var e=this._event,t=u[e.type]||"relatedTarget";return a(e[t]||e.relatedTarget)},currentTarget:function(){return a(this._currentTarget)},wheelDelta:function(){var e=this._event;if(e.type==="mousewheel"||e.type==="DOMMouseScroll")return e.detail?e.detail*-1:Math.round(e.wheelDelta/80)||(e.wheelDelta<0?-1:1)},pageX:function(){var t=this._event,n=t.pageX,r,i,s;return n===undefined&&(r=e.config.doc,i=r.body&&r.body.scrollLeft,s=r.documentElement.scrollLeft,n=t.clientX+(s||i||0)),n},pageY:function(){var t=this._event,n=t.pageY,r,i,s;return n===undefined&&(r=e.config.doc,i=r.body&&r.body.scrollTop,s=r.documentElement.scrollTop,n=t.clientY+(s||i||0)),n}},r._define=function(e,t,n){function r(r){var i=arguments.length?r:n.call(this);return delete e[t],Object.defineProperty(e,t,{value:i,configurable:!0,writable:!0}),i}Object.defineProperty(e,t,{get:r,set:r,configurable:!0})};if(i&&!i.hasFeature("Events","2.0")){if(s)try{Object.defineProperty(e.config.doc.createEventObject(),"z",{})}catch(l){s=!1}e.DOMEventFacade=s?r:n}},"@VERSION@",{requires:["node-base"]}),YUI.add("pluginhost-base",function(e,t){function r(){this._plugins={}}var n=e.Lang;r.prototype={plug:function(e,t){var r,i,s;if(n.isArray(e))for(r=0,i=e.length;r<i;r++)this.plug(e[r]);else e&&!n.isFunction(e)&&(t=e.cfg,e=e.fn),e&&e.NS&&(s=e.NS,t=t||{},t.host=this,this.hasPlugin(s)?this[s].setAttrs&&this[s].setAttrs(t):(this[s]=new e(t),this._plugins[s]=e));return this},unplug:function(e){var t= e,r=this._plugins;if(e)n.isFunction(e)&&(t=e.NS,t&&(!r[t]||r[t]!==e)&&(t=null)),t&&(this[t]&&(this[t].destroy&&this[t].destroy(),delete this[t]),r[t]&&delete r[t]);else for(t in this._plugins)this._plugins.hasOwnProperty(t)&&this.unplug(t);return this},hasPlugin:function(e){return this._plugins[e]&&this[e]},_initPlugins:function(e){this._plugins=this._plugins||{},this._initConfigPlugins&&this._initConfigPlugins(e)},_destroyPlugins:function(){this.unplug()}},e.namespace("Plugin").Host=r},"@VERSION@",{requires:["yui-base"]}),YUI.add("pluginhost-config",function(e,t){var n=e.Plugin.Host,r=e.Lang;n.prototype._initConfigPlugins=function(t){var n=this._getClasses?this._getClasses():[this.constructor],r=[],i={},s,o,u,a,f;for(o=n.length-1;o>=0;o--)s=n[o],a=s._UNPLUG,a&&e.mix(i,a,!0),u=s._PLUG,u&&e.mix(r,u,!0);for(f in r)r.hasOwnProperty(f)&&(i[f]||this.plug(r[f]));t&&t.plugins&&this.plug(t.plugins)},n.plug=function(t,n,i){var s,o,u,a;if(t!==e.Base){t._PLUG=t._PLUG||{},r.isArray(n)||(i&&(n={fn:n,cfg:i}),n=[n]);for(o=0,u=n.length;o<u;o++)s=n[o],a=s.NAME||s.fn.NAME,t._PLUG[a]=s}},n.unplug=function(t,n){var i,s,o,u;if(t!==e.Base){t._UNPLUG=t._UNPLUG||{},r.isArray(n)||(n=[n]);for(s=0,o=n.length;s<o;s++)i=n[s],u=i.NAME,t._PLUG[u]?delete t._PLUG[u]:t._UNPLUG[u]=i}}},"@VERSION@",{requires:["pluginhost-base"]}),YUI.add("event-delegate",function(e,t){function f(t,r,u,l){var c=n(arguments,0,!0),h=i(u)?u:null,p,d,v,m,g,y,b,w,E;if(s(t)){w=[];if(o(t))for(y=0,b=t.length;y<b;++y)c[0]=t[y],w.push(e.delegate.apply(e,c));else{c.unshift(null);for(y in t)t.hasOwnProperty(y)&&(c[0]=y,c[1]=t[y],w.push(e.delegate.apply(e,c)))}return new e.EventHandle(w)}p=t.split(/\|/),p.length>1&&(g=p.shift(),c[0]=t=p.shift()),d=e.Node.DOM_EVENTS[t],s(d)&&d.delegate&&(E=d.delegate.apply(d,arguments));if(!E){if(!t||!r||!u||!l)return;v=h?e.Selector.query(h,null,!0):u,!v&&i(u)&&(E=e.on("available",function(){e.mix(E,e.delegate.apply(e,c),!0)},u)),!E&&v&&(c.splice(2,2,v),E=e.Event._attach(c,{facade:!1}),E.sub.filter=l,E.sub._notify=f.notifySub)}return E&&g&&(m=a[g]||(a[g]={}),m=m[t]||(m[t]=[]),m.push(E)),E}var n=e.Array,r=e.Lang,i=r.isString,s=r.isObject,o=r.isArray,u=e.Selector.test,a=e.Env.evt.handles;f.notifySub=function(t,r,i){r=r.slice(),this.args&&r.push.apply(r,this.args);var s=f._applyFilter(this.filter,r,i),o,u,a,l;if(s){s=n(s),o=r[0]=new e.DOMEventFacade(r[0],i.el,i),o.container=e.one(i.el);for(u=0,a=s.length;u<a&&!o.stopped;++u){o.currentTarget=e.one(s[u]),l=this.fn.apply(this.context||o.currentTarget,r);if(l===!1)break}return l}},f.compileFilter=e.cached(function(e){return function(t,n){return u(t._node,e,n.currentTarget===n.target?null:n.currentTarget._node)}}),f._disabledRE=/^(?:button|input|select|textarea)$/i,f._applyFilter=function(t,n,r){var s=n[0],o=r.el,a=s.target||s.srcElement,l=[],c=!1;a.nodeType===3&&(a=a.parentNode);if(a.disabled&&f._disabledRE.test(a.nodeName))return l;n.unshift(a);if(i(t))while(a){c=a===o,u(a,t,c?null:o)&&l.push(a);if(c)break;a=a.parentNode}else{n[0]=e.one(a),n[1]=new e.DOMEventFacade(s,o,r);while(a){t.apply(n[0],n)&&l.push(a);if(a===o)break;a=a.parentNode,n[0]=e.one(a)}n[1]=s}return l.length<=1&&(l=l[0]),n.shift(),l},e.delegate=e.Event.delegate=f},"@VERSION@",{requires:["node-base"]}),YUI.add("node-event-delegate",function(e,t){e.Node.prototype.delegate=function(t){var n=e.Array(arguments,0,!0),r=e.Lang.isObject(t)&&!e.Lang.isArray(t)?1:2;return n.splice(r,0,this._node),e.delegate.apply(e,n)}},"@VERSION@",{requires:["node-base","event-delegate"]}),YUI.add("node-pluginhost",function(e,t){e.Node.plug=function(){var t=e.Array(arguments);return t.unshift(e.Node),e.Plugin.Host.plug.apply(e.Base,t),e.Node},e.Node.unplug=function(){var t=e.Array(arguments);return t.unshift(e.Node),e.Plugin.Host.unplug.apply(e.Base,t),e.Node},e.mix(e.Node,e.Plugin.Host,!1,null,1),e.Object.each(e.Node._instances,function(t){e.Plugin.Host.apply(t)}),e.NodeList.prototype.plug=function(){var t=arguments;return e.NodeList.each(this,function(n){e.Node.prototype.plug.apply(e.one(n),t)}),this},e.NodeList.prototype.unplug=function(){var t=arguments;return e.NodeList.each(this,function(n){e.Node.prototype.unplug.apply(e.one(n),t)}),this}},"@VERSION@",{requires:["node-base","pluginhost"]}),YUI.add("node-screen",function(e,t){e.each(["winWidth","winHeight","docWidth","docHeight","docScrollX","docScrollY"],function(t){e.Node.ATTRS[t]={getter:function(){var n=Array.prototype.slice.call(arguments);return n.unshift(e.Node.getDOMNode(this)),e.DOM[t].apply(this,n)}}}),e.Node.ATTRS.scrollLeft={getter:function(){var t=e.Node.getDOMNode(this);return"scrollLeft"in t?t.scrollLeft:e.DOM.docScrollX(t)},setter:function(t){var n=e.Node.getDOMNode(this);n&&("scrollLeft"in n?n.scrollLeft=t:(n.document||n.nodeType===9)&&e.DOM._getWin(n).scrollTo(t,e.DOM.docScrollY(n)))}},e.Node.ATTRS.scrollTop={getter:function(){var t=e.Node.getDOMNode(this);return"scrollTop"in t?t.scrollTop:e.DOM.docScrollY(t)},setter:function(t){var n=e.Node.getDOMNode(this);n&&("scrollTop"in n?n.scrollTop=t:(n.document||n.nodeType===9)&&e.DOM._getWin(n).scrollTo(e.DOM.docScrollX(n),t))}},e.Node.importMethod(e.DOM,["getXY","setXY","getX","setX","getY","setY","swapXY"]),e.Node.ATTRS.region={getter:function(){var t=this.getDOMNode(),n;return t&&!t.tagName&&t.nodeType===9&&(t=t.documentElement),e.DOM.isWindow(t)?n=e.DOM.viewportRegion(t):n=e.DOM.region(t),n}},e.Node.ATTRS.viewportRegion={getter:function(){return e.DOM.viewportRegion(e.Node.getDOMNode(this))}},e.Node.importMethod(e.DOM,"inViewportRegion"),e.Node.prototype.intersect=function(t,n){var r=e.Node.getDOMNode(this);return e.instanceOf(t,e.Node)&&(t=e.Node.getDOMNode(t)),e.DOM.intersect(r,t,n)},e.Node.prototype.inRegion=function(t,n,r){var i=e.Node.getDOMNode(this);return e.instanceOf(t,e.Node)&&(t=e.Node.getDOMNode(t)),e.DOM.inRegion(i,t,n,r)}},"@VERSION@",{requires:["dom-screen","node-base"]}),YUI.add("node-style",function(e,t){(function(e){e.mix(e.Node.prototype,{setStyle:function(t,n){return e.DOM.setStyle(this._node,t,n), this},setStyles:function(t){return e.DOM.setStyles(this._node,t),this},getStyle:function(t){return e.DOM.getStyle(this._node,t)},getComputedStyle:function(t){return e.DOM.getComputedStyle(this._node,t)}}),e.NodeList.importMethod(e.Node.prototype,["getStyle","getComputedStyle","setStyle","setStyles"])})(e)},"@VERSION@",{requires:["dom-style","node-base"]}),YUI.add("querystring-stringify-simple",function(e,t){var n=e.namespace("QueryString"),r=encodeURIComponent;n.stringify=function(t,n){var i=[],s=n&&n.arrayKey?!0:!1,o,u,a;for(o in t)if(t.hasOwnProperty(o))if(e.Lang.isArray(t[o]))for(u=0,a=t[o].length;u<a;u++)i.push(r(s?o+"[]":o)+"="+r(t[o][u]));else i.push(r(o)+"="+r(t[o]));return i.join("&")}},"@VERSION@",{requires:["yui-base"]}),YUI.add("io-base",function(e,t){function o(t){var n=this;n._uid="io:"+s++,n._init(t),e.io._map[n._uid]=n}var n=["start","complete","end","success","failure","progress"],r=["status","statusText","responseText","responseXML"],i=e.config.win,s=0;o.prototype={_id:0,_headers:{"X-Requested-With":"XMLHttpRequest"},_timeout:{},_init:function(t){var r=this,i,s;r.cfg=t||{},e.augment(r,e.EventTarget);for(i=0,s=n.length;i<s;++i)r.publish("io:"+n[i],e.merge({broadcast:1},t)),r.publish("io-trn:"+n[i],t)},_create:function(t,n){var r=this,s={id:e.Lang.isNumber(n)?n:r._id++,uid:r._uid},o=t.xdr?t.xdr.use:null,u=t.form&&t.form.upload?"iframe":null,a;return o==="native"&&(o=e.UA.ie&&!l?"xdr":null,r.setHeader("X-Requested-With")),a=o||u,s=a?e.merge(e.IO.customTransport(a),s):e.merge(e.IO.defaultTransport(),s),s.notify&&(t.notify=function(e,t,n){r.notify(e,t,n)}),a||i&&i.FormData&&t.data instanceof i.FormData&&(s.c.upload.onprogress=function(e){r.progress(s,e,t)},s.c.onload=function(e){r.load(s,e,t)},s.c.onerror=function(e){r.error(s,e,t)},s.upload=!0),s},_destroy:function(t){i&&!t.notify&&!t.xdr&&(u&&!t.upload?t.c.onreadystatechange=null:t.upload?(t.c.upload.onprogress=null,t.c.onload=null,t.c.onerror=null):e.UA.ie&&!t.e&&t.c.abort()),t=t.c=null},_evt:function(t,r,i){var s=this,o,u=i.arguments,a=s.cfg.emitFacade,f="io:"+t,l="io-trn:"+t;this.detach(l),r.e&&(r.c={status:0,statusText:r.e}),o=[a?{id:r.id,data:r.c,cfg:i,arguments:u}:r.id],a||(t===n[0]||t===n[2]?u&&o.push(u):(r.evt?o.push(r.evt):o.push(r.c),u&&o.push(u))),o.unshift(f),s.fire.apply(s,o),i.on&&(o[0]=l,s.once(l,i.on[t],i.context||e),s.fire.apply(s,o))},start:function(e,t){this._evt(n[0],e,t)},complete:function(e,t){this._evt(n[1],e,t)},end:function(e,t){this._evt(n[2],e,t),this._destroy(e)},success:function(e,t){this._evt(n[3],e,t),this.end(e,t)},failure:function(e,t){this._evt(n[4],e,t),this.end(e,t)},progress:function(e,t,r){e.evt=t,this._evt(n[5],e,r)},load:function(e,t,r){e.evt=t.target,this._evt(n[1],e,r)},error:function(e,t,r){e.evt=t,this._evt(n[4],e,r)},_retry:function(e,t,n){return this._destroy(e),n.xdr.use="flash",this.send(t,n,e.id)},_concat:function(e,t){return e+=(e.indexOf("?")===-1?"?":"&")+t,e},setHeader:function(e,t){t?this._headers[e]=t:delete this._headers[e]},_setHeaders:function(t,n){n=e.merge(this._headers,n),e.Object.each(n,function(e,r){e!=="disable"&&t.setRequestHeader(r,n[r])})},_startTimeout:function(e,t){var n=this;n._timeout[e.id]=setTimeout(function(){n._abort(e,"timeout")},t)},_clearTimeout:function(e){clearTimeout(this._timeout[e]),delete this._timeout[e]},_result:function(e,t){var n;try{n=e.c.status}catch(r){n=0}n>=200&&n<300||n===304||n===1223?this.success(e,t):this.failure(e,t)},_rS:function(e,t){var n=this;e.c.readyState===4&&(t.timeout&&n._clearTimeout(e.id),setTimeout(function(){n.complete(e,t),n._result(e,t)},0))},_abort:function(e,t){e&&e.c&&(e.e=t,e.c.abort())},send:function(t,n,i){var s,o,u,a,f,c,h=this,p=t,d={};n=n?e.Object(n):{},s=h._create(n,i),o=n.method?n.method.toUpperCase():"GET",f=n.sync,c=n.data,e.Lang.isObject(c)&&!c.nodeType&&!s.upload&&e.QueryString&&e.QueryString.stringify&&(n.data=c=e.QueryString.stringify(c));if(n.form){if(n.form.upload)return h.upload(s,t,n);c=h._serialize(n.form,c)}c||(c="");if(c)switch(o){case"GET":case"HEAD":case"DELETE":p=h._concat(p,c),c="";break;case"POST":case"PUT":n.headers=e.merge({"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},n.headers)}if(s.xdr)return h.xdr(p,s,n);if(s.notify)return s.c.send(s,t,n);!f&&!s.upload&&(s.c.onreadystatechange=function(){h._rS(s,n)});try{s.c.open(o,p,!f,n.username||null,n.password||null),h._setHeaders(s.c,n.headers||{}),h.start(s,n),n.xdr&&n.xdr.credentials&&l&&(s.c.withCredentials=!0),s.c.send(c);if(f){for(u=0,a=r.length;u<a;++u)d[r[u]]=s.c[r[u]];return d.getAllResponseHeaders=function(){return s.c.getAllResponseHeaders()},d.getResponseHeader=function(e){return s.c.getResponseHeader(e)},h.complete(s,n),h._result(s,n),d}}catch(v){if(s.xdr)return h._retry(s,t,n);h.complete(s,n),h._result(s,n)}return n.timeout&&h._startTimeout(s,n.timeout),{id:s.id,abort:function(){return s.c?h._abort(s,"abort"):!1},isInProgress:function(){return s.c?s.c.readyState%4:!1},io:h}}},e.io=function(t,n){var r=e.io._map["io:0"]||new o;return r.send.apply(r,[t,n])},e.io.header=function(t,n){var r=e.io._map["io:0"]||new o;r.setHeader(t,n)},e.IO=o,e.io._map={};var u=i&&i.XMLHttpRequest,a=i&&i.XDomainRequest,f=i&&i.ActiveXObject,l=u&&"withCredentials"in new XMLHttpRequest;e.mix(e.IO,{_default:"xhr",defaultTransport:function(t){if(!t){var n={c:e.IO.transports[e.IO._default](),notify:e.IO._default==="xhr"?!1:!0};return n}e.IO._default=t},transports:{xhr:function(){return u?new XMLHttpRequest:f?new ActiveXObject("Microsoft.XMLHTTP"):null},xdr:function(){return a?new XDomainRequest:null},iframe:function(){return{}},flash:null,nodejs:null},customTransport:function(t){var n={c:e.IO.transports[t]()};return n[t==="xdr"||t==="flash"?"xdr":"notify"]=!0,n}}),e.mix(e.IO.prototype,{notify:function(e,t,n){var r=this;switch(e){case"timeout":case"abort":case"transport error":t.c={status:0,statusText:e},e="failure";default:r[e].apply(r,[t,n])}}})},"@VERSION@",{requires:["event-custom-base","querystring-stringify-simple"]}),YUI.add("json-parse" ,function(e,t){var n=e.config.global.JSON;e.namespace("JSON").parse=function(e,t,r){return n.parse(typeof e=="string"?e:e+"",t,r)}},"@VERSION@",{requires:["yui-base"]}),YUI.add("transition",function(e,t){var n="",r="",i=e.config.doc,s="documentElement",o=i[s].style,u="transition",a="transitionProperty",f,l,c,h,p,d,v={},m=["Webkit","Moz"],g={Webkit:"webkitTransitionEnd"},y=function(){this.init.apply(this,arguments)};y._TRANSFORM="transform",y._toCamel=function(e){return e=e.replace(/-([a-z])/gi,function(e,t){return t.toUpperCase()}),e},y._toHyphen=function(e){return e=e.replace(/([A-Z]?)([a-z]+)([A-Z]?)/g,function(e,t,n,r){var i=(t?"-"+t.toLowerCase():"")+n;return r&&(i+="-"+r.toLowerCase()),i}),e},y.SHOW_TRANSITION="fadeIn",y.HIDE_TRANSITION="fadeOut",y.useNative=!1,"transition"in o&&"transitionProperty"in o&&"transitionDuration"in o&&"transitionTimingFunction"in o&&"transitionDelay"in o?(y.useNative=!0,y.supported=!0):e.Array.each(m,function(e){var t=e+"Transition";t in i[s].style&&(n=e,r=y._toHyphen(e)+"-",y.useNative=!0,y.supported=!0,y._VENDOR_PREFIX=e)}),typeof o.transform=="undefined"&&e.Array.each(m,function(e){var t=e+"Transform";typeof o[t]!="undefined"&&(y._TRANSFORM=t)}),n&&(u=n+"Transition",a=n+"TransitionProperty"),f=r+"transition-property",l=r+"transition-duration",c=r+"transition-timing-function",h=r+"transition-delay",p="transitionend",d="on"+n.toLowerCase()+"transitionend",p=g[n]||p,y.fx={},y.toggles={},y._hasEnd={},y._reKeywords=/^(?:node|duration|iterations|easing|delay|on|onstart|onend)$/i,e.Node.DOM_EVENTS[p]=1,y.NAME="transition",y.DEFAULT_EASING="ease",y.DEFAULT_DURATION=.5,y.DEFAULT_DELAY=0,y._nodeAttrs={},y.prototype={constructor:y,init:function(e,t){var n=this;return n._node=e,!n._running&&t&&(n._config=t,e._transition=n,n._duration="duration"in t?t.duration:n.constructor.DEFAULT_DURATION,n._delay="delay"in t?t.delay:n.constructor.DEFAULT_DELAY,n._easing=t.easing||n.constructor.DEFAULT_EASING,n._count=0,n._running=!1),n},addProperty:function(t,n){var r=this,i=this._node,s=e.stamp(i),o=e.one(i),u=y._nodeAttrs[s],a,f,l,c,h;u||(u=y._nodeAttrs[s]={}),c=u[t],n&&n.value!==undefined?h=n.value:n!==undefined&&(h=n,n=v),typeof h=="function"&&(h=h.call(o,o)),c&&c.transition&&c.transition!==r&&c.transition._count--,r._count++,l=(typeof n.duration!="undefined"?n.duration:r._duration)||1e-4,u[t]={value:h,duration:l,delay:typeof n.delay!="undefined"?n.delay:r._delay,easing:n.easing||r._easing,transition:r},a=e.DOM.getComputedStyle(i,t),f=typeof h=="string"?a:parseFloat(a),y.useNative&&f===h&&setTimeout(function(){r._onNativeEnd.call(i,{propertyName:t,elapsedTime:l})},l*1e3)},removeProperty:function(t){var n=this,r=y._nodeAttrs[e.stamp(n._node)];r&&r[t]&&(delete r[t],n._count--)},initAttrs:function(t){var n,r=this._node;t.transform&&!t[y._TRANSFORM]&&(t[y._TRANSFORM]=t.transform,delete t.transform);for(n in t)t.hasOwnProperty(n)&&!y._reKeywords.test(n)&&(this.addProperty(n,t[n]),r.style[n]===""&&e.DOM.setStyle(r,n,e.DOM.getComputedStyle(r,n)))},run:function(t){var n=this,r=n._node,i=n._config,s={type:"transition:start",config:i};return n._running||(n._running=!0,i.on&&i.on.start&&i.on.start.call(e.one(r),s),n.initAttrs(n._config),n._callback=t,n._start()),n},_start:function(){this._runNative()},_prepDur:function(e){return e=parseFloat(e)*1e3,e+"ms"},_runNative:function(){var t=this,n=t._node,r=e.stamp(n),i=n.style,s=n.ownerDocument.defaultView.getComputedStyle(n),o=y._nodeAttrs[r],u="",a=s[y._toCamel(f)],d=f+": ",v=l+": ",m=c+": ",g=h+": ",b,w,E;a!=="all"&&(d+=a+",",v+=s[y._toCamel(l)]+",",m+=s[y._toCamel(c)]+",",g+=s[y._toCamel(h)]+",");for(E in o)b=y._toHyphen(E),w=o[E],(w=o[E])&&w.transition===t&&(E in n.style?(v+=t._prepDur(w.duration)+",",g+=t._prepDur(w.delay)+",",m+=w.easing+",",d+=b+",",u+=b+": "+w.value+"; "):this.removeProperty(E));d=d.replace(/,$/,";"),v=v.replace(/,$/,";"),m=m.replace(/,$/,";"),g=g.replace(/,$/,";"),y._hasEnd[r]||(n.addEventListener(p,t._onNativeEnd,""),y._hasEnd[r]=!0),i.cssText+=d+v+m+g+u},_end:function(t){var n=this,r=n._node,i=n._callback,s=n._config,o={type:"transition:end",config:s,elapsedTime:t},u=e.one(r);n._running=!1,n._callback=null,r&&(s.on&&s.on.end?setTimeout(function(){s.on.end.call(u,o),i&&i.call(u,o)},1):i&&setTimeout(function(){i.call(u,o)},1))},_endNative:function(e){var t=this._node,n=t.ownerDocument.defaultView.getComputedStyle(t,"")[y._toCamel(f)];e=y._toHyphen(e),typeof n=="string"&&(n=n.replace(new RegExp("(?:^|,\\s)"+e+",?"),","),n=n.replace(/^,|,$/,""),t.style[u]=n)},_onNativeEnd:function(t){var n=this,r=e.stamp(n),i=t,s=y._toCamel(i.propertyName),o=i.elapsedTime,u=y._nodeAttrs[r],f=u[s],l=f?f.transition:null,c,h;l&&(l.removeProperty(s),l._endNative(s),h=l._config[s],c={type:"propertyEnd",propertyName:s,elapsedTime:o,config:h},h&&h.on&&h.on.end&&h.on.end.call(e.one(n),c),l._count<=0&&(l._end(o),n.style[a]=""))},destroy:function(){var e=this,t=e._node;t&&(t.removeEventListener(p,e._onNativeEnd,!1),e._node=null)}},e.Transition=y,e.TransitionNative=y,e.Node.prototype.transition=function(t,n,r){var i=y._nodeAttrs[e.stamp(this._node)],s=i?i.transition||null:null,o,u;if(typeof t=="string"){typeof n=="function"&&(r=n,n=null),o=y.fx[t];if(n&&typeof n!="boolean"){n=e.clone(n);for(u in o)o.hasOwnProperty(u)&&(u in n||(n[u]=o[u]))}else n=o}else r=n,n=t;return s&&!s._running?s.init(this,n):s=new y(this._node,n),s.run(r),this},e.Node.prototype.show=function(t,n,r){return this._show(),t&&e.Transition&&(typeof t!="string"&&!t.push&&(typeof n=="function"&&(r=n,n=t),t=y.SHOW_TRANSITION),this.transition(t,n,r)),this},e.NodeList.prototype.show=function(t,n,r){var i=this._nodes,s=0,o;while(o=i[s++])e.one(o).show(t,n,r);return this};var b=function(e,t,n){return function(){t&&t.call(e),n&&typeof n=="function"&&n.apply(e._node,arguments)}};e.Node.prototype.hide=function(t,n,r){return t&&e.Transition?(typeof n=="function"&&(r=n,n=null),r=b(this,this._hide,r),typeof t!="string"&&!t.push&&(typeof n=="function"&&(r=n,n=t),t=y.HIDE_TRANSITION),this.transition (t,n,r)):this._hide(),this},e.NodeList.prototype.hide=function(t,n,r){var i=this._nodes,s=0,o;while(o=i[s++])e.one(o).hide(t,n,r);return this},e.NodeList.prototype.transition=function(t,n){var r=this._nodes,i=0,s;while(s=r[i++])e.one(s).transition(t,n);return this},e.Node.prototype.toggleView=function(t,n,r){this._toggles=this._toggles||[],r=arguments[arguments.length-1];if(typeof t!="string"){n=t,this._toggleView(n,r);return}return typeof n=="function"&&(n=undefined),typeof n=="undefined"&&t in this._toggles&&(n=!this._toggles[t]),n=n?1:0,n?this._show():r=b(this,this._hide,r),this._toggles[t]=n,this.transition(e.Transition.toggles[t][n],r),this},e.NodeList.prototype.toggleView=function(t,n,r){var i=this._nodes,s=0,o;while(o=i[s++])o=e.one(o),o.toggleView.apply(o,arguments);return this},e.mix(y.fx,{fadeOut:{opacity:0,duration:.5,easing:"ease-out"},fadeIn:{opacity:1,duration:.5,easing:"ease-in"},sizeOut:{height:0,width:0,duration:.75,easing:"ease-out"},sizeIn:{height:function(e){return e.get("scrollHeight")+"px"},width:function(e){return e.get("scrollWidth")+"px"},duration:.5,easing:"ease-in",on:{start:function(){var e=this.getStyle("overflow");e!=="hidden"&&(this.setStyle("overflow","hidden"),this._transitionOverflow=e)},end:function(){this._transitionOverflow&&(this.setStyle("overflow",this._transitionOverflow),delete this._transitionOverflow)}}}}),e.mix(y.toggles,{size:["sizeOut","sizeIn"],fade:["fadeOut","fadeIn"]})},"@VERSION@",{requires:["node-style"]}),YUI.add("selector-css2",function(e,t){var n="parentNode",r="tagName",i="attributes",s="combinator",o="pseudos",u=e.Selector,a={_reRegExpTokens:/([\^\$\?\[\]\*\+\-\.\(\)\|\\])/,SORT_RESULTS:!0,_isXML:function(){var t=e.config.doc.createElement("div").tagName!=="DIV";return t}(),shorthand:{"\\#(-?[_a-z0-9]+[-\\w\\uE000]*)":"[id=$1]","\\.(-?[_a-z]+[-\\w\\uE000]*)":"[className~=$1]"},operators:{"":function(t,n){return e.DOM.getAttribute(t,n)!==""},"~=":"(?:^|\\s+){val}(?:\\s+|$)","|=":"^{val}-?"},pseudos:{"first-child":function(t){return e.DOM._children(t[n])[0]===t}},_bruteQuery:function(t,n,r){var i=[],s=[],o,a=u._tokenize(t),f=a[a.length-1],l=e.DOM._getDoc(n),c,h,p,d,v;if(f){h=f.id,p=f.className,d=f.tagName||"*";if(n.getElementsByTagName)h&&(n.all||n.nodeType===9||e.DOM.inDoc(n))?s=e.DOM.allById(h,n):p?s=n.getElementsByClassName(p):s=n.getElementsByTagName(d);else{o=[],c=n.firstChild,v=d==="*";while(c){while(c)c.tagName>"@"&&(v||c.tagName===d)&&s.push(c),o.push(c),c=c.firstChild;while(o.length>0&&!c)c=o.pop().nextSibling}}s.length&&(i=u._filterNodes(s,a,r))}return i},_filterNodes:function(t,n,r){var i=0,s,o=n.length,a=o-1,f=[],l=t[0],c=l,h=e.Selector.getters,p,d,v,m,g,y,b,w;for(i=0;c=l=t[i++];){a=o-1,m=null;e:while(c&&c.tagName){v=n[a],b=v.tests,s=b.length;if(s&&!g)while(w=b[--s]){p=w[1],h[w[0]]?y=h[w[0]](c,w[0]):(y=c[w[0]],w[0]==="tagName"&&!u._isXML&&(y=y.toUpperCase()),typeof y!="string"&&y!==undefined&&y.toString?y=y.toString():y===undefined&&c.getAttribute&&(y=c.getAttribute(w[0],2)));if(p==="="&&y!==w[2]||typeof p!="string"&&p.test&&!p.test(y)||!p.test&&typeof p=="function"&&!p(c,w[0],w[2])){if(c=c[m])while(c&&(!c.tagName||v.tagName&&v.tagName!==c.tagName))c=c[m];continue e}}a--;if(!!g||!(d=v.combinator)){f.push(l);if(r)return f;break}m=d.axis,c=c[m];while(c&&!c.tagName)c=c[m];d.direct&&(m=null)}}return l=c=null,f},combinators:{" ":{axis:"parentNode"},">":{axis:"parentNode",direct:!0},"+":{axis:"previousSibling",direct:!0}},_parsers:[{name:i,re:/^\uE003(-?[a-z]+[\w\-]*)+([~\|\^\$\*!=]=?)?['"]?([^\uE004'"]*)['"]?\uE004/i,fn:function(t,n){var r=t[2]||"",i=u.operators,s=t[3]?t[3].replace(/\\/g,""):"",o;if(t[1]==="id"&&r==="="||t[1]==="className"&&e.config.doc.documentElement.getElementsByClassName&&(r==="~="||r==="="))n.prefilter=t[1],t[3]=s,n[t[1]]=t[1]==="id"?t[3]:s;r in i&&(o=i[r],typeof o=="string"&&(t[3]=s.replace(u._reRegExpTokens,"\\$1"),o=new RegExp(o.replace("{val}",t[3]))),t[2]=o);if(!n.last||n.prefilter!==t[1])return t.slice(1)}},{name:r,re:/^((?:-?[_a-z]+[\w-]*)|\*)/i,fn:function(e,t){var n=e[1];u._isXML||(n=n.toUpperCase()),t.tagName=n;if(n!=="*"&&(!t.last||t.prefilter))return[r,"=",n];t.prefilter||(t.prefilter="tagName")}},{name:s,re:/^\s*([>+~]|\s)\s*/,fn:function(e,t){}},{name:o,re:/^:([\-\w]+)(?:\uE005['"]?([^\uE005]*)['"]?\uE006)*/i,fn:function(e,t){var n=u[o][e[1]];return n?(e[2]&&(e[2]=e[2].replace(/\\/g,"")),[e[2],n]):!1}}],_getToken:function(e){return{tagName:null,id:null,className:null,attributes:{},combinator:null,tests:[]}},_tokenize:function(t){t=t||"",t=u._parseSelector(e.Lang.trim(t));var n=u._getToken(),r=t,i=[],o=!1,a,f,l,c;e:do{o=!1;for(l=0;c=u._parsers[l++];)if(a=c.re.exec(t)){c.name!==s&&(n.selector=t),t=t.replace(a[0],""),t.length||(n.last=!0),u._attrFilters[a[1]]&&(a[1]=u._attrFilters[a[1]]),f=c.fn(a,n);if(f===!1){o=!1;break e}f&&n.tests.push(f);if(!t.length||c.name===s)i.push(n),n=u._getToken(n),c.name===s&&(n.combinator=e.Selector.combinators[a[1]]);o=!0}}while(o&&t.length);if(!o||t.length)i=[];return i},_replaceMarkers:function(e){return e=e.replace(/\[/g,"\ue003"),e=e.replace(/\]/g,"\ue004"),e=e.replace(/\(/g,"\ue005"),e=e.replace(/\)/g,"\ue006"),e},_replaceShorthand:function(t){var n=e.Selector.shorthand,r;for(r in n)n.hasOwnProperty(r)&&(t=t.replace(new RegExp(r,"gi"),n[r]));return t},_parseSelector:function(t){var n=e.Selector._replaceSelector(t),t=n.selector;return t=e.Selector._replaceShorthand(t),t=e.Selector._restore("attr",t,n.attrs),t=e.Selector._restore("pseudo",t,n.pseudos),t=e.Selector._replaceMarkers(t),t=e.Selector._restore("esc",t,n.esc),t},_attrFilters:{"class":"className","for":"htmlFor"},getters:{href:function(t,n){return e.DOM.getAttribute(t,n)},id:function(t,n){return e.DOM.getId(t)}}};e.mix(e.Selector,a,!0),e.Selector.getters.src=e.Selector.getters.rel=e.Selector.getters.href,e.Selector.useNative&&e.config.doc.querySelector&&(e.Selector.shorthand["\\.(-?[_a-z]+[-\\w]*)"]="[class~=$1]")},"@VERSION@",{requires:["selector-native"]}),YUI.add("selector-css3",function(e,t){e.Selector ._reNth=/^(?:([\-]?\d*)(n){1}|(odd|even)$)*([\-+]?\d*)$/,e.Selector._getNth=function(t,n,r,i){e.Selector._reNth.test(n);var s=parseInt(RegExp.$1,10),o=RegExp.$2,u=RegExp.$3,a=parseInt(RegExp.$4,10)||0,f=[],l=e.DOM._children(t.parentNode,r),c;u?(s=2,c="+",o="n",a=u==="odd"?1:0):isNaN(s)&&(s=o?1:0);if(s===0)return i&&(a=l.length-a+1),l[a-1]===t?!0:!1;s<0&&(i=!!i,s=Math.abs(s));if(!i){for(var h=a-1,p=l.length;h<p;h+=s)if(h>=0&&l[h]===t)return!0}else for(var h=l.length-a,p=l.length;h>=0;h-=s)if(h<p&&l[h]===t)return!0;return!1},e.mix(e.Selector.pseudos,{root:function(e){return e===e.ownerDocument.documentElement},"nth-child":function(t,n){return e.Selector._getNth(t,n)},"nth-last-child":function(t,n){return e.Selector._getNth(t,n,null,!0)},"nth-of-type":function(t,n){return e.Selector._getNth(t,n,t.tagName)},"nth-last-of-type":function(t,n){return e.Selector._getNth(t,n,t.tagName,!0)},"last-child":function(t){var n=e.DOM._children(t.parentNode);return n[n.length-1]===t},"first-of-type":function(t){return e.DOM._children(t.parentNode,t.tagName)[0]===t},"last-of-type":function(t){var n=e.DOM._children(t.parentNode,t.tagName);return n[n.length-1]===t},"only-child":function(t){var n=e.DOM._children(t.parentNode);return n.length===1&&n[0]===t},"only-of-type":function(t){var n=e.DOM._children(t.parentNode,t.tagName);return n.length===1&&n[0]===t},empty:function(e){return e.childNodes.length===0},not:function(t,n){return!e.Selector.test(t,n)},contains:function(e,t){var n=e.innerText||e.textContent||"";return n.indexOf(t)>-1},checked:function(e){return e.checked===!0||e.selected===!0},enabled:function(e){return e.disabled!==undefined&&!e.disabled},disabled:function(e){return e.disabled}}),e.mix(e.Selector.operators,{"^=":"^{val}","$=":"{val}$","*=":"{val}"}),e.Selector.combinators["~"]={axis:"previousSibling"}},"@VERSION@",{requires:["selector-native","selector-css2"]}),YUI.add("yui-log",function(e,t){var n=e,r="yui:log",i="undefined",s={debug:1,info:2,warn:4,error:8};n.log=function(e,t,o,u){var a,f,l,c,h,p,d=n,v=d.config,m=d.fire?d:YUI.Env.globalEvents;return v.debug&&(o=o||"",typeof o!="undefined"&&(f=v.logExclude,l=v.logInclude,!l||o in l?l&&o in l?a=!l[o]:f&&o in f&&(a=f[o]):a=1,d.config.logLevel=d.config.logLevel||"debug",p=s[d.config.logLevel.toLowerCase()],t in s&&s[t]<p&&(a=1)),a||(v.useBrowserConsole&&(c=o?o+": "+e:e,d.Lang.isFunction(v.logFn)?v.logFn.call(d,e,t,o):typeof console!==i&&console.log?(h=t&&console[t]&&t in s?t:"log",console[h](c)):typeof opera!==i&&opera.postError(c)),m&&!u&&(m===d&&!m.getEvent(r)&&m.publish(r,{broadcast:2}),m.fire(r,{msg:e,cat:t,src:o})))),d},n.message=function(){return n.log.apply(n,arguments)}},"@VERSION@",{requires:["yui-base"]}),YUI.add("dump",function(e,t){var n=e.Lang,r="{...}",i="f(){...}",s=", ",o=" => ",u=function(e,t){var u,a,f=[],l=n.type(e);if(!n.isObject(e))return e+"";if(l=="date")return e;if(e.nodeType&&e.tagName)return e.tagName+"#"+e.id;if(e.document&&e.navigator)return"window";if(e.location&&e.body)return"document";if(l=="function")return i;t=n.isNumber(t)?t:3;if(l=="array"){f.push("[");for(u=0,a=e.length;u<a;u+=1)n.isObject(e[u])?f.push(t>0?n.dump(e[u],t-1):r):f.push(e[u]),f.push(s);f.length>1&&f.pop(),f.push("]")}else if(l=="regexp")f.push(e.toString());else{f.push("{");for(u in e)if(e.hasOwnProperty(u))try{f.push(u+o),n.isObject(e[u])?f.push(t>0?n.dump(e[u],t-1):r):f.push(e[u]),f.push(s)}catch(c){f.push("Error: "+c.message)}f.length>1&&f.pop(),f.push("}")}return f.join("")};e.dump=u,n.dump=u},"@VERSION@",{requires:["yui-base"]}),YUI.add("transition-timer",function(e,t){var n=e.Transition;e.mix(n.prototype,{_start:function(){n.useNative?this._runNative():this._runTimer()},_runTimer:function(){var t=this;t._initAttrs(),n._running[e.stamp(t)]=t,t._startTime=new Date,n._startTimer()},_endTimer:function(){var t=this;delete n._running[e.stamp(t)],t._startTime=null},_runFrame:function(){var e=new Date-this._startTime;this._runAttrs(e)},_runAttrs:function(t){var r=this,i=r._node,s=r._config,o=e.stamp(i),u=n._nodeAttrs[o],a=n.behaviors,f=!1,l=!1,c,h,p,d,v,m,g,y,b;for(h in u)if((p=u[h])&&p.transition===r){g=p.duration,m=p.delay,v=(t-m)/1e3,y=t,c={type:"propertyEnd",propertyName:h,config:s,elapsedTime:v},d=b in a&&"set"in a[b]?a[b].set:n.DEFAULT_SETTER,f=y>=g,y>g&&(y=g);if(!m||t>=m)d(r,h,p.from,p.to,y-m,g-m,p.easing,p.unit),f&&(delete u[h],r._count--,s[h]&&s[h].on&&s[h].on.end&&s[h].on.end.call(e.one(i),c),!l&&r._count<=0&&(l=!0,r._end(v),r._endTimer()))}},_initAttrs:function(){var t=this,r=n.behaviors,i=e.stamp(t._node),s=n._nodeAttrs[i],o,u,a,f,l,c,h,p,d,v,m;for(c in s)(o=s[c])&&o.transition===t&&(u=o.duration*1e3,a=o.delay*1e3,f=o.easing,l=o.value,c in t._node.style||c in e.DOM.CUSTOM_STYLES?(v=c in r&&"get"in r[c]?r[c].get(t,c):n.DEFAULT_GETTER(t,c),p=n.RE_UNITS.exec(v),h=n.RE_UNITS.exec(l),v=p?p[1]:v,m=h?h[1]:l,d=h?h[2]:p?p[2]:"",!d&&n.RE_DEFAULT_UNIT.test(c)&&(d=n.DEFAULT_UNIT),typeof f=="string"&&(f.indexOf("cubic-bezier")>-1?f=f.substring(13,f.length-1).split(","):n.easings[f]&&(f=n.easings[f])),o.from=Number(v),o.to=Number(m),o.unit=d,o.easing=f,o.duration=u+a,o.delay=a):(delete s[c],t._count--))},destroy:function(){this.detachAll(),this._node=null}},!0),e.mix(e.Transition,{_runtimeAttrs:{},RE_DEFAULT_UNIT:/^width|height|top|right|bottom|left|margin.*|padding.*|border.*$/i,DEFAULT_UNIT:"px",intervalTime:20,behaviors:{left:{get:function(t,n){return e.DOM._getAttrOffset(t._node,n)}}},DEFAULT_SETTER:function(t,r,i,s,o,u,a,f){i=Number(i),s=Number(s);var l=t._node,c=n.cubicBezier(a,o/u);c=i+c[0]*(s-i);if(l){if(r in l.style||r in e.DOM.CUSTOM_STYLES)f=f||"",e.DOM.setStyle(l,r,c+f)}else t._end()},DEFAULT_GETTER:function(t,n){var r=t._node,i="";if(n in r.style||n in e.DOM.CUSTOM_STYLES)i=e.DOM.getComputedStyle(r,n);return i},_startTimer:function(){n._timer||(n._timer=setInterval(n._runFrame,n.intervalTime))},_stopTimer:function(){clearInterval(n._timer),n._timer=null},_runFrame:function(){var e=!0,t;for(t in n._running)n._running[t]._runFrame&&(e=!1,n ._running[t]._runFrame());e&&n._stopTimer()},cubicBezier:function(e,t){var n=0,r=0,i=e[0],s=e[1],o=e[2],u=e[3],a=1,f=0,l=a-3*o+3*i-n,c=3*o-6*i+3*n,h=3*i-3*n,p=n,d=f-3*u+3*s-r,v=3*u-6*s+3*r,m=3*s-3*r,g=r,y=((l*t+c)*t+h)*t+p,b=((d*t+v)*t+m)*t+g;return[y,b]},easings:{ease:[.25,0,1,.25],linear:[0,0,1,1],"ease-in":[.42,0,1,1],"ease-out":[0,0,.58,1],"ease-in-out":[.42,0,.58,1]},_running:{},_timer:null,RE_UNITS:/^(-?\d*\.?\d*){1}(em|ex|px|in|cm|mm|pt|pc|%)*$/},!0),n.behaviors.top=n.behaviors.bottom=n.behaviors.right=n.behaviors.left,e.Transition=n},"@VERSION@",{requires:["transition"]}),YUI.add("yui",function(e,t){},"@VERSION@",{use:["yui","oop","dom","event-custom-base","event-base","pluginhost","node","event-delegate","io-base","json-parse","transition","selector-css3","dom-style-ie","querystring-stringify-simple"]});var Y=YUI().use("*");
JGallardo/cdnjs
ajax/libs/yui/3.12.0/simpleyui/simpleyui-min.js
JavaScript
mit
145,058
/*! * reveal.js * http://lab.hakim.se/reveal-js * MIT licensed * * Copyright (C) 2016 Hakim El Hattab, http://hakim.se */ /********************************************* * RESET STYLES *********************************************/ html, body, .reveal div, .reveal span, .reveal applet, .reveal object, .reveal iframe, .reveal h1, .reveal h2, .reveal h3, .reveal h4, .reveal h5, .reveal h6, .reveal p, .reveal blockquote, .reveal pre, .reveal a, .reveal abbr, .reveal acronym, .reveal address, .reveal big, .reveal cite, .reveal code, .reveal del, .reveal dfn, .reveal em, .reveal img, .reveal ins, .reveal kbd, .reveal q, .reveal s, .reveal samp, .reveal small, .reveal strike, .reveal strong, .reveal sub, .reveal sup, .reveal tt, .reveal var, .reveal b, .reveal u, .reveal center, .reveal dl, .reveal dt, .reveal dd, .reveal ol, .reveal ul, .reveal li, .reveal fieldset, .reveal form, .reveal label, .reveal legend, .reveal table, .reveal caption, .reveal tbody, .reveal tfoot, .reveal thead, .reveal tr, .reveal th, .reveal td, .reveal article, .reveal aside, .reveal canvas, .reveal details, .reveal embed, .reveal figure, .reveal figcaption, .reveal footer, .reveal header, .reveal hgroup, .reveal menu, .reveal nav, .reveal output, .reveal ruby, .reveal section, .reveal summary, .reveal time, .reveal mark, .reveal audio, .reveal video { margin: 0; padding: 0; border: 0; font-size: 100%; font: inherit; vertical-align: baseline; } .reveal article, .reveal aside, .reveal details, .reveal figcaption, .reveal figure, .reveal footer, .reveal header, .reveal hgroup, .reveal menu, .reveal nav, .reveal section { display: block; } /********************************************* * GLOBAL STYLES *********************************************/ html, body { width: 100%; height: 100%; overflow: hidden; } body { position: relative; line-height: 1; background-color: #fff; color: #000; } html:-webkit-full-screen-ancestor { background-color: inherit; } html:-moz-full-screen-ancestor { background-color: inherit; } /********************************************* * VIEW FRAGMENTS *********************************************/ .reveal .slides section .fragment { opacity: 0; visibility: hidden; -webkit-transition: all .2s ease; transition: all .2s ease; } .reveal .slides section .fragment.visible { opacity: 1; visibility: visible; } .reveal .slides section .fragment.grow { opacity: 1; visibility: visible; } .reveal .slides section .fragment.grow.visible { -webkit-transform: scale(1.3); transform: scale(1.3); } .reveal .slides section .fragment.shrink { opacity: 1; visibility: visible; } .reveal .slides section .fragment.shrink.visible { -webkit-transform: scale(0.7); transform: scale(0.7); } .reveal .slides section .fragment.zoom-in { -webkit-transform: scale(0.1); transform: scale(0.1); } .reveal .slides section .fragment.zoom-in.visible { -webkit-transform: none; transform: none; } .reveal .slides section .fragment.fade-out { opacity: 1; visibility: visible; } .reveal .slides section .fragment.fade-out.visible { opacity: 0; visibility: hidden; } .reveal .slides section .fragment.semi-fade-out { opacity: 1; visibility: visible; } .reveal .slides section .fragment.semi-fade-out.visible { opacity: 0.5; visibility: visible; } .reveal .slides section .fragment.strike { opacity: 1; visibility: visible; } .reveal .slides section .fragment.strike.visible { text-decoration: line-through; } .reveal .slides section .fragment.fade-up { -webkit-transform: translate(0, 20%); transform: translate(0, 20%); } .reveal .slides section .fragment.fade-up.visible { -webkit-transform: translate(0, 0); transform: translate(0, 0); } .reveal .slides section .fragment.fade-down { -webkit-transform: translate(0, -20%); transform: translate(0, -20%); } .reveal .slides section .fragment.fade-down.visible { -webkit-transform: translate(0, 0); transform: translate(0, 0); } .reveal .slides section .fragment.fade-right { -webkit-transform: translate(-20%, 0); transform: translate(-20%, 0); } .reveal .slides section .fragment.fade-right.visible { -webkit-transform: translate(0, 0); transform: translate(0, 0); } .reveal .slides section .fragment.fade-left { -webkit-transform: translate(20%, 0); transform: translate(20%, 0); } .reveal .slides section .fragment.fade-left.visible { -webkit-transform: translate(0, 0); transform: translate(0, 0); } .reveal .slides section .fragment.current-visible { opacity: 0; visibility: hidden; } .reveal .slides section .fragment.current-visible.current-fragment { opacity: 1; visibility: visible; } .reveal .slides section .fragment.highlight-red, .reveal .slides section .fragment.highlight-current-red, .reveal .slides section .fragment.highlight-green, .reveal .slides section .fragment.highlight-current-green, .reveal .slides section .fragment.highlight-blue, .reveal .slides section .fragment.highlight-current-blue { opacity: 1; visibility: visible; } .reveal .slides section .fragment.highlight-red.visible { color: #ff2c2d; } .reveal .slides section .fragment.highlight-green.visible { color: #17ff2e; } .reveal .slides section .fragment.highlight-blue.visible { color: #1b91ff; } .reveal .slides section .fragment.highlight-current-red.current-fragment { color: #ff2c2d; } .reveal .slides section .fragment.highlight-current-green.current-fragment { color: #17ff2e; } .reveal .slides section .fragment.highlight-current-blue.current-fragment { color: #1b91ff; } /********************************************* * DEFAULT ELEMENT STYLES *********************************************/ /* Fixes issue in Chrome where italic fonts did not appear when printing to PDF */ .reveal:after { content: ''; font-style: italic; } .reveal iframe { z-index: 1; } /** Prevents layering issues in certain browser/transition combinations */ .reveal a { position: relative; } .reveal .stretch { max-width: none; max-height: none; } .reveal pre.stretch code { height: 100%; max-height: 100%; box-sizing: border-box; } /********************************************* * CONTROLS *********************************************/ .reveal .controls { display: none; position: fixed; width: 110px; height: 110px; z-index: 30; right: 10px; bottom: 10px; -webkit-user-select: none; } .reveal .controls button { padding: 0; position: absolute; opacity: 0.05; width: 0; height: 0; background-color: transparent; border: 12px solid transparent; -webkit-transform: scale(0.9999); transform: scale(0.9999); -webkit-transition: all 0.2s ease; transition: all 0.2s ease; -webkit-appearance: none; -webkit-tap-highlight-color: transparent; } .reveal .controls .enabled { opacity: 0.7; cursor: pointer; } .reveal .controls .enabled:active { margin-top: 1px; } .reveal .controls .navigate-left { top: 42px; border-right-width: 22px; border-right-color: #000; } .reveal .controls .navigate-left.fragmented { opacity: 0.3; } .reveal .controls .navigate-right { left: 74px; top: 42px; border-left-width: 22px; border-left-color: #000; } .reveal .controls .navigate-right.fragmented { opacity: 0.3; } .reveal .controls .navigate-up { left: 42px; border-bottom-width: 22px; border-bottom-color: #000; } .reveal .controls .navigate-up.fragmented { opacity: 0.3; } .reveal .controls .navigate-down { left: 42px; top: 74px; border-top-width: 22px; border-top-color: #000; } .reveal .controls .navigate-down.fragmented { opacity: 0.3; } /********************************************* * PROGRESS BAR *********************************************/ .reveal .progress { position: fixed; display: none; height: 3px; width: 100%; bottom: 0; left: 0; z-index: 10; background-color: rgba(0, 0, 0, 0.2); } .reveal .progress:after { content: ''; display: block; position: absolute; height: 20px; width: 100%; top: -20px; } .reveal .progress span { display: block; height: 100%; width: 0px; background-color: #000; -webkit-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); } /********************************************* * SLIDE NUMBER *********************************************/ .reveal .slide-number { position: fixed; display: block; right: 8px; bottom: 8px; z-index: 31; font-family: Helvetica, sans-serif; font-size: 12px; line-height: 1; color: #fff; background-color: rgba(0, 0, 0, 0.4); padding: 5px; } .reveal .slide-number-delimiter { margin: 0 3px; } /********************************************* * SLIDES *********************************************/ .reveal { position: relative; width: 100%; height: 100%; overflow: hidden; -ms-touch-action: none; touch-action: none; } .reveal .slides { position: absolute; width: 100%; height: 100%; top: 0; right: 0; bottom: 0; left: 0; margin: auto; overflow: visible; z-index: 1; text-align: center; -webkit-perspective: 600px; perspective: 600px; -webkit-perspective-origin: 50% 40%; perspective-origin: 50% 40%; } .reveal .slides > section { -ms-perspective: 600px; } .reveal .slides > section, .reveal .slides > section > section { display: none; position: absolute; width: 100%; padding: 20px 0px; z-index: 10; -webkit-transform-style: preserve-3d; transform-style: preserve-3d; -webkit-transition: -webkit-transform-origin 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985), -webkit-transform 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985), visibility 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985), opacity 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); transition: transform-origin 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985), transform 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985), visibility 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985), opacity 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); } /* Global transition speed settings */ .reveal[data-transition-speed="fast"] .slides section { -webkit-transition-duration: 400ms; transition-duration: 400ms; } .reveal[data-transition-speed="slow"] .slides section { -webkit-transition-duration: 1200ms; transition-duration: 1200ms; } /* Slide-specific transition speed overrides */ .reveal .slides section[data-transition-speed="fast"] { -webkit-transition-duration: 400ms; transition-duration: 400ms; } .reveal .slides section[data-transition-speed="slow"] { -webkit-transition-duration: 1200ms; transition-duration: 1200ms; } .reveal .slides > section.stack { padding-top: 0; padding-bottom: 0; } .reveal .slides > section.present, .reveal .slides > section > section.present { display: block; z-index: 11; opacity: 1; } .reveal.center, .reveal.center .slides, .reveal.center .slides section { min-height: 0 !important; } /* Don't allow interaction with invisible slides */ .reveal .slides > section.future, .reveal .slides > section > section.future, .reveal .slides > section.past, .reveal .slides > section > section.past { pointer-events: none; } .reveal.overview .slides > section, .reveal.overview .slides > section > section { pointer-events: auto; } .reveal .slides > section.past, .reveal .slides > section.future, .reveal .slides > section > section.past, .reveal .slides > section > section.future { opacity: 0; } /********************************************* * Mixins for readability of transitions *********************************************/ /********************************************* * SLIDE TRANSITION * Aliased 'linear' for backwards compatibility *********************************************/ .reveal.slide section { -webkit-backface-visibility: hidden; backface-visibility: hidden; } .reveal .slides > section[data-transition=slide].past, .reveal .slides > section[data-transition~=slide-out].past, .reveal.slide .slides > section:not([data-transition]).past { -webkit-transform: translate(-150%, 0); transform: translate(-150%, 0); } .reveal .slides > section[data-transition=slide].future, .reveal .slides > section[data-transition~=slide-in].future, .reveal.slide .slides > section:not([data-transition]).future { -webkit-transform: translate(150%, 0); transform: translate(150%, 0); } .reveal .slides > section > section[data-transition=slide].past, .reveal .slides > section > section[data-transition~=slide-out].past, .reveal.slide .slides > section > section:not([data-transition]).past { -webkit-transform: translate(0, -150%); transform: translate(0, -150%); } .reveal .slides > section > section[data-transition=slide].future, .reveal .slides > section > section[data-transition~=slide-in].future, .reveal.slide .slides > section > section:not([data-transition]).future { -webkit-transform: translate(0, 150%); transform: translate(0, 150%); } .reveal.linear section { -webkit-backface-visibility: hidden; backface-visibility: hidden; } .reveal .slides > section[data-transition=linear].past, .reveal .slides > section[data-transition~=linear-out].past, .reveal.linear .slides > section:not([data-transition]).past { -webkit-transform: translate(-150%, 0); transform: translate(-150%, 0); } .reveal .slides > section[data-transition=linear].future, .reveal .slides > section[data-transition~=linear-in].future, .reveal.linear .slides > section:not([data-transition]).future { -webkit-transform: translate(150%, 0); transform: translate(150%, 0); } .reveal .slides > section > section[data-transition=linear].past, .reveal .slides > section > section[data-transition~=linear-out].past, .reveal.linear .slides > section > section:not([data-transition]).past { -webkit-transform: translate(0, -150%); transform: translate(0, -150%); } .reveal .slides > section > section[data-transition=linear].future, .reveal .slides > section > section[data-transition~=linear-in].future, .reveal.linear .slides > section > section:not([data-transition]).future { -webkit-transform: translate(0, 150%); transform: translate(0, 150%); } /********************************************* * CONVEX TRANSITION * Aliased 'default' for backwards compatibility *********************************************/ .reveal .slides > section[data-transition=default].past, .reveal .slides > section[data-transition~=default-out].past, .reveal.default .slides > section:not([data-transition]).past { -webkit-transform: translate3d(-100%, 0, 0) rotateY(-90deg) translate3d(-100%, 0, 0); transform: translate3d(-100%, 0, 0) rotateY(-90deg) translate3d(-100%, 0, 0); } .reveal .slides > section[data-transition=default].future, .reveal .slides > section[data-transition~=default-in].future, .reveal.default .slides > section:not([data-transition]).future { -webkit-transform: translate3d(100%, 0, 0) rotateY(90deg) translate3d(100%, 0, 0); transform: translate3d(100%, 0, 0) rotateY(90deg) translate3d(100%, 0, 0); } .reveal .slides > section > section[data-transition=default].past, .reveal .slides > section > section[data-transition~=default-out].past, .reveal.default .slides > section > section:not([data-transition]).past { -webkit-transform: translate3d(0, -300px, 0) rotateX(70deg) translate3d(0, -300px, 0); transform: translate3d(0, -300px, 0) rotateX(70deg) translate3d(0, -300px, 0); } .reveal .slides > section > section[data-transition=default].future, .reveal .slides > section > section[data-transition~=default-in].future, .reveal.default .slides > section > section:not([data-transition]).future { -webkit-transform: translate3d(0, 300px, 0) rotateX(-70deg) translate3d(0, 300px, 0); transform: translate3d(0, 300px, 0) rotateX(-70deg) translate3d(0, 300px, 0); } .reveal .slides > section[data-transition=convex].past, .reveal .slides > section[data-transition~=convex-out].past, .reveal.convex .slides > section:not([data-transition]).past { -webkit-transform: translate3d(-100%, 0, 0) rotateY(-90deg) translate3d(-100%, 0, 0); transform: translate3d(-100%, 0, 0) rotateY(-90deg) translate3d(-100%, 0, 0); } .reveal .slides > section[data-transition=convex].future, .reveal .slides > section[data-transition~=convex-in].future, .reveal.convex .slides > section:not([data-transition]).future { -webkit-transform: translate3d(100%, 0, 0) rotateY(90deg) translate3d(100%, 0, 0); transform: translate3d(100%, 0, 0) rotateY(90deg) translate3d(100%, 0, 0); } .reveal .slides > section > section[data-transition=convex].past, .reveal .slides > section > section[data-transition~=convex-out].past, .reveal.convex .slides > section > section:not([data-transition]).past { -webkit-transform: translate3d(0, -300px, 0) rotateX(70deg) translate3d(0, -300px, 0); transform: translate3d(0, -300px, 0) rotateX(70deg) translate3d(0, -300px, 0); } .reveal .slides > section > section[data-transition=convex].future, .reveal .slides > section > section[data-transition~=convex-in].future, .reveal.convex .slides > section > section:not([data-transition]).future { -webkit-transform: translate3d(0, 300px, 0) rotateX(-70deg) translate3d(0, 300px, 0); transform: translate3d(0, 300px, 0) rotateX(-70deg) translate3d(0, 300px, 0); } /********************************************* * CONCAVE TRANSITION *********************************************/ .reveal .slides > section[data-transition=concave].past, .reveal .slides > section[data-transition~=concave-out].past, .reveal.concave .slides > section:not([data-transition]).past { -webkit-transform: translate3d(-100%, 0, 0) rotateY(90deg) translate3d(-100%, 0, 0); transform: translate3d(-100%, 0, 0) rotateY(90deg) translate3d(-100%, 0, 0); } .reveal .slides > section[data-transition=concave].future, .reveal .slides > section[data-transition~=concave-in].future, .reveal.concave .slides > section:not([data-transition]).future { -webkit-transform: translate3d(100%, 0, 0) rotateY(-90deg) translate3d(100%, 0, 0); transform: translate3d(100%, 0, 0) rotateY(-90deg) translate3d(100%, 0, 0); } .reveal .slides > section > section[data-transition=concave].past, .reveal .slides > section > section[data-transition~=concave-out].past, .reveal.concave .slides > section > section:not([data-transition]).past { -webkit-transform: translate3d(0, -80%, 0) rotateX(-70deg) translate3d(0, -80%, 0); transform: translate3d(0, -80%, 0) rotateX(-70deg) translate3d(0, -80%, 0); } .reveal .slides > section > section[data-transition=concave].future, .reveal .slides > section > section[data-transition~=concave-in].future, .reveal.concave .slides > section > section:not([data-transition]).future { -webkit-transform: translate3d(0, 80%, 0) rotateX(70deg) translate3d(0, 80%, 0); transform: translate3d(0, 80%, 0) rotateX(70deg) translate3d(0, 80%, 0); } /********************************************* * ZOOM TRANSITION *********************************************/ .reveal .slides section[data-transition=zoom], .reveal.zoom .slides section:not([data-transition]) { -webkit-transition-timing-function: ease; transition-timing-function: ease; } .reveal .slides > section[data-transition=zoom].past, .reveal .slides > section[data-transition~=zoom-out].past, .reveal.zoom .slides > section:not([data-transition]).past { visibility: hidden; -webkit-transform: scale(16); transform: scale(16); } .reveal .slides > section[data-transition=zoom].future, .reveal .slides > section[data-transition~=zoom-in].future, .reveal.zoom .slides > section:not([data-transition]).future { visibility: hidden; -webkit-transform: scale(0.2); transform: scale(0.2); } .reveal .slides > section > section[data-transition=zoom].past, .reveal .slides > section > section[data-transition~=zoom-out].past, .reveal.zoom .slides > section > section:not([data-transition]).past { -webkit-transform: translate(0, -150%); transform: translate(0, -150%); } .reveal .slides > section > section[data-transition=zoom].future, .reveal .slides > section > section[data-transition~=zoom-in].future, .reveal.zoom .slides > section > section:not([data-transition]).future { -webkit-transform: translate(0, 150%); transform: translate(0, 150%); } /********************************************* * CUBE TRANSITION *********************************************/ .reveal.cube .slides { -webkit-perspective: 1300px; perspective: 1300px; } .reveal.cube .slides section { padding: 30px; min-height: 700px; -webkit-backface-visibility: hidden; backface-visibility: hidden; box-sizing: border-box; } .reveal.center.cube .slides section { min-height: 0; } .reveal.cube .slides section:not(.stack):before { content: ''; position: absolute; display: block; width: 100%; height: 100%; left: 0; top: 0; background: rgba(0, 0, 0, 0.1); border-radius: 4px; -webkit-transform: translateZ(-20px); transform: translateZ(-20px); } .reveal.cube .slides section:not(.stack):after { content: ''; position: absolute; display: block; width: 90%; height: 30px; left: 5%; bottom: 0; background: none; z-index: 1; border-radius: 4px; box-shadow: 0px 95px 25px rgba(0, 0, 0, 0.2); -webkit-transform: translateZ(-90px) rotateX(65deg); transform: translateZ(-90px) rotateX(65deg); } .reveal.cube .slides > section.stack { padding: 0; background: none; } .reveal.cube .slides > section.past { -webkit-transform-origin: 100% 0%; transform-origin: 100% 0%; -webkit-transform: translate3d(-100%, 0, 0) rotateY(-90deg); transform: translate3d(-100%, 0, 0) rotateY(-90deg); } .reveal.cube .slides > section.future { -webkit-transform-origin: 0% 0%; transform-origin: 0% 0%; -webkit-transform: translate3d(100%, 0, 0) rotateY(90deg); transform: translate3d(100%, 0, 0) rotateY(90deg); } .reveal.cube .slides > section > section.past { -webkit-transform-origin: 0% 100%; transform-origin: 0% 100%; -webkit-transform: translate3d(0, -100%, 0) rotateX(90deg); transform: translate3d(0, -100%, 0) rotateX(90deg); } .reveal.cube .slides > section > section.future { -webkit-transform-origin: 0% 0%; transform-origin: 0% 0%; -webkit-transform: translate3d(0, 100%, 0) rotateX(-90deg); transform: translate3d(0, 100%, 0) rotateX(-90deg); } /********************************************* * PAGE TRANSITION *********************************************/ .reveal.page .slides { -webkit-perspective-origin: 0% 50%; perspective-origin: 0% 50%; -webkit-perspective: 3000px; perspective: 3000px; } .reveal.page .slides section { padding: 30px; min-height: 700px; box-sizing: border-box; } .reveal.page .slides section.past { z-index: 12; } .reveal.page .slides section:not(.stack):before { content: ''; position: absolute; display: block; width: 100%; height: 100%; left: 0; top: 0; background: rgba(0, 0, 0, 0.1); -webkit-transform: translateZ(-20px); transform: translateZ(-20px); } .reveal.page .slides section:not(.stack):after { content: ''; position: absolute; display: block; width: 90%; height: 30px; left: 5%; bottom: 0; background: none; z-index: 1; border-radius: 4px; box-shadow: 0px 95px 25px rgba(0, 0, 0, 0.2); -webkit-transform: translateZ(-90px) rotateX(65deg); } .reveal.page .slides > section.stack { padding: 0; background: none; } .reveal.page .slides > section.past { -webkit-transform-origin: 0% 0%; transform-origin: 0% 0%; -webkit-transform: translate3d(-40%, 0, 0) rotateY(-80deg); transform: translate3d(-40%, 0, 0) rotateY(-80deg); } .reveal.page .slides > section.future { -webkit-transform-origin: 100% 0%; transform-origin: 100% 0%; -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); } .reveal.page .slides > section > section.past { -webkit-transform-origin: 0% 0%; transform-origin: 0% 0%; -webkit-transform: translate3d(0, -40%, 0) rotateX(80deg); transform: translate3d(0, -40%, 0) rotateX(80deg); } .reveal.page .slides > section > section.future { -webkit-transform-origin: 0% 100%; transform-origin: 0% 100%; -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); } /********************************************* * FADE TRANSITION *********************************************/ .reveal .slides section[data-transition=fade], .reveal.fade .slides section:not([data-transition]), .reveal.fade .slides > section > section:not([data-transition]) { -webkit-transform: none; transform: none; -webkit-transition: opacity 0.5s; transition: opacity 0.5s; } .reveal.fade.overview .slides section, .reveal.fade.overview .slides > section > section { -webkit-transition: none; transition: none; } /********************************************* * NO TRANSITION *********************************************/ .reveal .slides section[data-transition=none], .reveal.none .slides section:not([data-transition]) { -webkit-transform: none; transform: none; -webkit-transition: none; transition: none; } /********************************************* * PAUSED MODE *********************************************/ .reveal .pause-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: black; visibility: hidden; opacity: 0; z-index: 100; -webkit-transition: all 1s ease; transition: all 1s ease; } .reveal.paused .pause-overlay { visibility: visible; opacity: 1; } /********************************************* * FALLBACK *********************************************/ .no-transforms { overflow-y: auto; } .no-transforms .reveal .slides { position: relative; width: 80%; height: auto !important; top: 0; left: 50%; margin: 0; text-align: center; } .no-transforms .reveal .controls, .no-transforms .reveal .progress { display: none !important; } .no-transforms .reveal .slides section { display: block !important; opacity: 1 !important; position: relative !important; height: auto; min-height: 0; top: 0; left: -50%; margin: 70px 0; -webkit-transform: none; transform: none; } .no-transforms .reveal .slides section section { left: 0; } .reveal .no-transition, .reveal .no-transition * { -webkit-transition: none !important; transition: none !important; } /********************************************* * PER-SLIDE BACKGROUNDS *********************************************/ .reveal .backgrounds { position: absolute; width: 100%; height: 100%; top: 0; left: 0; -webkit-perspective: 600px; perspective: 600px; } .reveal .slide-background { display: none; position: absolute; width: 100%; height: 100%; opacity: 0; visibility: hidden; background-color: transparent; background-position: 50% 50%; background-repeat: no-repeat; background-size: cover; -webkit-transition: all 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); transition: all 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); } .reveal .slide-background.stack { display: block; } .reveal .slide-background.present { opacity: 1; visibility: visible; } .print-pdf .reveal .slide-background { opacity: 1 !important; visibility: visible !important; } /* Video backgrounds */ .reveal .slide-background video { position: absolute; width: 100%; height: 100%; max-width: none; max-height: none; top: 0; left: 0; } /* Immediate transition style */ .reveal[data-background-transition=none] > .backgrounds .slide-background, .reveal > .backgrounds .slide-background[data-background-transition=none] { -webkit-transition: none; transition: none; } /* Slide */ .reveal[data-background-transition=slide] > .backgrounds .slide-background, .reveal > .backgrounds .slide-background[data-background-transition=slide] { opacity: 1; -webkit-backface-visibility: hidden; backface-visibility: hidden; } .reveal[data-background-transition=slide] > .backgrounds .slide-background.past, .reveal > .backgrounds .slide-background.past[data-background-transition=slide] { -webkit-transform: translate(-100%, 0); transform: translate(-100%, 0); } .reveal[data-background-transition=slide] > .backgrounds .slide-background.future, .reveal > .backgrounds .slide-background.future[data-background-transition=slide] { -webkit-transform: translate(100%, 0); transform: translate(100%, 0); } .reveal[data-background-transition=slide] > .backgrounds .slide-background > .slide-background.past, .reveal > .backgrounds .slide-background > .slide-background.past[data-background-transition=slide] { -webkit-transform: translate(0, -100%); transform: translate(0, -100%); } .reveal[data-background-transition=slide] > .backgrounds .slide-background > .slide-background.future, .reveal > .backgrounds .slide-background > .slide-background.future[data-background-transition=slide] { -webkit-transform: translate(0, 100%); transform: translate(0, 100%); } /* Convex */ .reveal[data-background-transition=convex] > .backgrounds .slide-background.past, .reveal > .backgrounds .slide-background.past[data-background-transition=convex] { opacity: 0; -webkit-transform: translate3d(-100%, 0, 0) rotateY(-90deg) translate3d(-100%, 0, 0); transform: translate3d(-100%, 0, 0) rotateY(-90deg) translate3d(-100%, 0, 0); } .reveal[data-background-transition=convex] > .backgrounds .slide-background.future, .reveal > .backgrounds .slide-background.future[data-background-transition=convex] { opacity: 0; -webkit-transform: translate3d(100%, 0, 0) rotateY(90deg) translate3d(100%, 0, 0); transform: translate3d(100%, 0, 0) rotateY(90deg) translate3d(100%, 0, 0); } .reveal[data-background-transition=convex] > .backgrounds .slide-background > .slide-background.past, .reveal > .backgrounds .slide-background > .slide-background.past[data-background-transition=convex] { opacity: 0; -webkit-transform: translate3d(0, -100%, 0) rotateX(90deg) translate3d(0, -100%, 0); transform: translate3d(0, -100%, 0) rotateX(90deg) translate3d(0, -100%, 0); } .reveal[data-background-transition=convex] > .backgrounds .slide-background > .slide-background.future, .reveal > .backgrounds .slide-background > .slide-background.future[data-background-transition=convex] { opacity: 0; -webkit-transform: translate3d(0, 100%, 0) rotateX(-90deg) translate3d(0, 100%, 0); transform: translate3d(0, 100%, 0) rotateX(-90deg) translate3d(0, 100%, 0); } /* Concave */ .reveal[data-background-transition=concave] > .backgrounds .slide-background.past, .reveal > .backgrounds .slide-background.past[data-background-transition=concave] { opacity: 0; -webkit-transform: translate3d(-100%, 0, 0) rotateY(90deg) translate3d(-100%, 0, 0); transform: translate3d(-100%, 0, 0) rotateY(90deg) translate3d(-100%, 0, 0); } .reveal[data-background-transition=concave] > .backgrounds .slide-background.future, .reveal > .backgrounds .slide-background.future[data-background-transition=concave] { opacity: 0; -webkit-transform: translate3d(100%, 0, 0) rotateY(-90deg) translate3d(100%, 0, 0); transform: translate3d(100%, 0, 0) rotateY(-90deg) translate3d(100%, 0, 0); } .reveal[data-background-transition=concave] > .backgrounds .slide-background > .slide-background.past, .reveal > .backgrounds .slide-background > .slide-background.past[data-background-transition=concave] { opacity: 0; -webkit-transform: translate3d(0, -100%, 0) rotateX(-90deg) translate3d(0, -100%, 0); transform: translate3d(0, -100%, 0) rotateX(-90deg) translate3d(0, -100%, 0); } .reveal[data-background-transition=concave] > .backgrounds .slide-background > .slide-background.future, .reveal > .backgrounds .slide-background > .slide-background.future[data-background-transition=concave] { opacity: 0; -webkit-transform: translate3d(0, 100%, 0) rotateX(90deg) translate3d(0, 100%, 0); transform: translate3d(0, 100%, 0) rotateX(90deg) translate3d(0, 100%, 0); } /* Zoom */ .reveal[data-background-transition=zoom] > .backgrounds .slide-background, .reveal > .backgrounds .slide-background[data-background-transition=zoom] { -webkit-transition-timing-function: ease; transition-timing-function: ease; } .reveal[data-background-transition=zoom] > .backgrounds .slide-background.past, .reveal > .backgrounds .slide-background.past[data-background-transition=zoom] { opacity: 0; visibility: hidden; -webkit-transform: scale(16); transform: scale(16); } .reveal[data-background-transition=zoom] > .backgrounds .slide-background.future, .reveal > .backgrounds .slide-background.future[data-background-transition=zoom] { opacity: 0; visibility: hidden; -webkit-transform: scale(0.2); transform: scale(0.2); } .reveal[data-background-transition=zoom] > .backgrounds .slide-background > .slide-background.past, .reveal > .backgrounds .slide-background > .slide-background.past[data-background-transition=zoom] { opacity: 0; visibility: hidden; -webkit-transform: scale(16); transform: scale(16); } .reveal[data-background-transition=zoom] > .backgrounds .slide-background > .slide-background.future, .reveal > .backgrounds .slide-background > .slide-background.future[data-background-transition=zoom] { opacity: 0; visibility: hidden; -webkit-transform: scale(0.2); transform: scale(0.2); } /* Global transition speed settings */ .reveal[data-transition-speed="fast"] > .backgrounds .slide-background { -webkit-transition-duration: 400ms; transition-duration: 400ms; } .reveal[data-transition-speed="slow"] > .backgrounds .slide-background { -webkit-transition-duration: 1200ms; transition-duration: 1200ms; } /********************************************* * OVERVIEW *********************************************/ .reveal.overview { -webkit-perspective-origin: 50% 50%; perspective-origin: 50% 50%; -webkit-perspective: 700px; perspective: 700px; } .reveal.overview .slides section { height: 100%; top: 0 !important; opacity: 1 !important; overflow: hidden; visibility: visible !important; cursor: pointer; box-sizing: border-box; } .reveal.overview .slides section:hover, .reveal.overview .slides section.present { outline: 10px solid rgba(150, 150, 150, 0.4); outline-offset: 10px; } .reveal.overview .slides section .fragment { opacity: 1; -webkit-transition: none; transition: none; } .reveal.overview .slides section:after, .reveal.overview .slides section:before { display: none !important; } .reveal.overview .slides > section.stack { padding: 0; top: 0 !important; background: none; outline: none; overflow: visible; } .reveal.overview .backgrounds { -webkit-perspective: inherit; perspective: inherit; } .reveal.overview .backgrounds .slide-background { opacity: 1; visibility: visible; outline: 10px solid rgba(150, 150, 150, 0.1); outline-offset: 10px; } .reveal.overview .slides section, .reveal.overview-deactivating .slides section { -webkit-transition: none; transition: none; } .reveal.overview .backgrounds .slide-background, .reveal.overview-deactivating .backgrounds .slide-background { -webkit-transition: none; transition: none; } .reveal.overview-animated .slides { -webkit-transition: -webkit-transform 0.4s ease; transition: transform 0.4s ease; } /********************************************* * RTL SUPPORT *********************************************/ .reveal.rtl .slides, .reveal.rtl .slides h1, .reveal.rtl .slides h2, .reveal.rtl .slides h3, .reveal.rtl .slides h4, .reveal.rtl .slides h5, .reveal.rtl .slides h6 { direction: rtl; font-family: sans-serif; } .reveal.rtl pre, .reveal.rtl code { direction: ltr; } .reveal.rtl ol, .reveal.rtl ul { text-align: right; } .reveal.rtl .progress span { float: right; } /********************************************* * PARALLAX BACKGROUND *********************************************/ .reveal.has-parallax-background .backgrounds { -webkit-transition: all 0.8s ease; transition: all 0.8s ease; } /* Global transition speed settings */ .reveal.has-parallax-background[data-transition-speed="fast"] .backgrounds { -webkit-transition-duration: 400ms; transition-duration: 400ms; } .reveal.has-parallax-background[data-transition-speed="slow"] .backgrounds { -webkit-transition-duration: 1200ms; transition-duration: 1200ms; } /********************************************* * LINK PREVIEW OVERLAY *********************************************/ .reveal .overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1000; background: rgba(0, 0, 0, 0.9); opacity: 0; visibility: hidden; -webkit-transition: all 0.3s ease; transition: all 0.3s ease; } .reveal .overlay.visible { opacity: 1; visibility: visible; } .reveal .overlay .spinner { position: absolute; display: block; top: 50%; left: 50%; width: 32px; height: 32px; margin: -16px 0 0 -16px; z-index: 10; background-image: url(data:image/gif;base64,R0lGODlhIAAgAPMAAJmZmf%2F%2F%2F6%2Bvr8nJybW1tcDAwOjo6Nvb26ioqKOjo7Ozs%2FLy8vz8%2FAAAAAAAAAAAACH%2FC05FVFNDQVBFMi4wAwEAAAAh%2FhpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh%2BQQJCgAAACwAAAAAIAAgAAAE5xDISWlhperN52JLhSSdRgwVo1ICQZRUsiwHpTJT4iowNS8vyW2icCF6k8HMMBkCEDskxTBDAZwuAkkqIfxIQyhBQBFvAQSDITM5VDW6XNE4KagNh6Bgwe60smQUB3d4Rz1ZBApnFASDd0hihh12BkE9kjAJVlycXIg7CQIFA6SlnJ87paqbSKiKoqusnbMdmDC2tXQlkUhziYtyWTxIfy6BE8WJt5YJvpJivxNaGmLHT0VnOgSYf0dZXS7APdpB309RnHOG5gDqXGLDaC457D1zZ%2FV%2FnmOM82XiHRLYKhKP1oZmADdEAAAh%2BQQJCgAAACwAAAAAIAAgAAAE6hDISWlZpOrNp1lGNRSdRpDUolIGw5RUYhhHukqFu8DsrEyqnWThGvAmhVlteBvojpTDDBUEIFwMFBRAmBkSgOrBFZogCASwBDEY%2FCZSg7GSE0gSCjQBMVG023xWBhklAnoEdhQEfyNqMIcKjhRsjEdnezB%2BA4k8gTwJhFuiW4dokXiloUepBAp5qaKpp6%2BHo7aWW54wl7obvEe0kRuoplCGepwSx2jJvqHEmGt6whJpGpfJCHmOoNHKaHx61WiSR92E4lbFoq%2BB6QDtuetcaBPnW6%2BO7wDHpIiK9SaVK5GgV543tzjgGcghAgAh%2BQQJCgAAACwAAAAAIAAgAAAE7hDISSkxpOrN5zFHNWRdhSiVoVLHspRUMoyUakyEe8PTPCATW9A14E0UvuAKMNAZKYUZCiBMuBakSQKG8G2FzUWox2AUtAQFcBKlVQoLgQReZhQlCIJesQXI5B0CBnUMOxMCenoCfTCEWBsJColTMANldx15BGs8B5wlCZ9Po6OJkwmRpnqkqnuSrayqfKmqpLajoiW5HJq7FL1Gr2mMMcKUMIiJgIemy7xZtJsTmsM4xHiKv5KMCXqfyUCJEonXPN2rAOIAmsfB3uPoAK%2B%2BG%2Bw48edZPK%2BM6hLJpQg484enXIdQFSS1u6UhksENEQAAIfkECQoAAAAsAAAAACAAIAAABOcQyEmpGKLqzWcZRVUQnZYg1aBSh2GUVEIQ2aQOE%2BG%2BcD4ntpWkZQj1JIiZIogDFFyHI0UxQwFugMSOFIPJftfVAEoZLBbcLEFhlQiqGp1Vd140AUklUN3eCA51C1EWMzMCezCBBmkxVIVHBWd3HHl9JQOIJSdSnJ0TDKChCwUJjoWMPaGqDKannasMo6WnM562R5YluZRwur0wpgqZE7NKUm%2BFNRPIhjBJxKZteWuIBMN4zRMIVIhffcgojwCF117i4nlLnY5ztRLsnOk%2BaV%2BoJY7V7m76PdkS4trKcdg0Zc0tTcKkRAAAIfkECQoAAAAsAAAAACAAIAAABO4QyEkpKqjqzScpRaVkXZWQEximw1BSCUEIlDohrft6cpKCk5xid5MNJTaAIkekKGQkWyKHkvhKsR7ARmitkAYDYRIbUQRQjWBwJRzChi9CRlBcY1UN4g0%2FVNB0AlcvcAYHRyZPdEQFYV8ccwR5HWxEJ02YmRMLnJ1xCYp0Y5idpQuhopmmC2KgojKasUQDk5BNAwwMOh2RtRq5uQuPZKGIJQIGwAwGf6I0JXMpC8C7kXWDBINFMxS4DKMAWVWAGYsAdNqW5uaRxkSKJOZKaU3tPOBZ4DuK2LATgJhkPJMgTwKCdFjyPHEnKxFCDhEAACH5BAkKAAAALAAAAAAgACAAAATzEMhJaVKp6s2nIkolIJ2WkBShpkVRWqqQrhLSEu9MZJKK9y1ZrqYK9WiClmvoUaF8gIQSNeF1Er4MNFn4SRSDARWroAIETg1iVwuHjYB1kYc1mwruwXKC9gmsJXliGxc%2BXiUCby9ydh1sOSdMkpMTBpaXBzsfhoc5l58Gm5yToAaZhaOUqjkDgCWNHAULCwOLaTmzswadEqggQwgHuQsHIoZCHQMMQgQGubVEcxOPFAcMDAYUA85eWARmfSRQCdcMe0zeP1AAygwLlJtPNAAL19DARdPzBOWSm1brJBi45soRAWQAAkrQIykShQ9wVhHCwCQCACH5BAkKAAAALAAAAAAgACAAAATrEMhJaVKp6s2nIkqFZF2VIBWhUsJaTokqUCoBq%2BE71SRQeyqUToLA7VxF0JDyIQh%2FMVVPMt1ECZlfcjZJ9mIKoaTl1MRIl5o4CUKXOwmyrCInCKqcWtvadL2SYhyASyNDJ0uIiRMDjI0Fd30%2FiI2UA5GSS5UDj2l6NoqgOgN4gksEBgYFf0FDqKgHnyZ9OX8HrgYHdHpcHQULXAS2qKpENRg7eAMLC7kTBaixUYFkKAzWAAnLC7FLVxLWDBLKCwaKTULgEwbLA4hJtOkSBNqITT3xEgfLpBtzE%2FjiuL04RGEBgwWhShRgQExHBAAh%2BQQJCgAAACwAAAAAIAAgAAAE7xDISWlSqerNpyJKhWRdlSAVoVLCWk6JKlAqAavhO9UkUHsqlE6CwO1cRdCQ8iEIfzFVTzLdRAmZX3I2SfZiCqGk5dTESJeaOAlClzsJsqwiJwiqnFrb2nS9kmIcgEsjQydLiIlHehhpejaIjzh9eomSjZR%2BipslWIRLAgMDOR2DOqKogTB9pCUJBagDBXR6XB0EBkIIsaRsGGMMAxoDBgYHTKJiUYEGDAzHC9EACcUGkIgFzgwZ0QsSBcXHiQvOwgDdEwfFs0sDzt4S6BK4xYjkDOzn0unFeBzOBijIm1Dgmg5YFQwsCMjp1oJ8LyIAACH5BAkKAAAALAAAAAAgACAAAATwEMhJaVKp6s2nIkqFZF2VIBWhUsJaTokqUCoBq%2BE71SRQeyqUToLA7VxF0JDyIQh%2FMVVPMt1ECZlfcjZJ9mIKoaTl1MRIl5o4CUKXOwmyrCInCKqcWtvadL2SYhyASyNDJ0uIiUd6GGl6NoiPOH16iZKNlH6KmyWFOggHhEEvAwwMA0N9GBsEC6amhnVcEwavDAazGwIDaH1ipaYLBUTCGgQDA8NdHz0FpqgTBwsLqAbWAAnIA4FWKdMLGdYGEgraigbT0OITBcg5QwPT4xLrROZL6AuQAPUS7bxLpoWidY0JtxLHKhwwMJBTHgPKdEQAACH5BAkKAAAALAAAAAAgACAAAATrEMhJaVKp6s2nIkqFZF2VIBWhUsJaTokqUCoBq%2BE71SRQeyqUToLA7VxF0JDyIQh%2FMVVPMt1ECZlfcjZJ9mIKoaTl1MRIl5o4CUKXOwmyrCInCKqcWtvadL2SYhyASyNDJ0uIiUd6GAULDJCRiXo1CpGXDJOUjY%2BYip9DhToJA4RBLwMLCwVDfRgbBAaqqoZ1XBMHswsHtxtFaH1iqaoGNgAIxRpbFAgfPQSqpbgGBqUD1wBXeCYp1AYZ19JJOYgH1KwA4UBvQwXUBxPqVD9L3sbp2BNk2xvvFPJd%2BMFCN6HAAIKgNggY0KtEBAAh%2BQQJCgAAACwAAAAAIAAgAAAE6BDISWlSqerNpyJKhWRdlSAVoVLCWk6JKlAqAavhO9UkUHsqlE6CwO1cRdCQ8iEIfzFVTzLdRAmZX3I2SfYIDMaAFdTESJeaEDAIMxYFqrOUaNW4E4ObYcCXaiBVEgULe0NJaxxtYksjh2NLkZISgDgJhHthkpU4mW6blRiYmZOlh4JWkDqILwUGBnE6TYEbCgevr0N1gH4At7gHiRpFaLNrrq8HNgAJA70AWxQIH1%2BvsYMDAzZQPC9VCNkDWUhGkuE5PxJNwiUK4UfLzOlD4WvzAHaoG9nxPi5d%2BjYUqfAhhykOFwJWiAAAIfkECQoAAAAsAAAAACAAIAAABPAQyElpUqnqzaciSoVkXVUMFaFSwlpOCcMYlErAavhOMnNLNo8KsZsMZItJEIDIFSkLGQoQTNhIsFehRww2CQLKF0tYGKYSg%2BygsZIuNqJksKgbfgIGepNo2cIUB3V1B3IvNiBYNQaDSTtfhhx0CwVPI0UJe0%2Bbm4g5VgcGoqOcnjmjqDSdnhgEoamcsZuXO1aWQy8KAwOAuTYYGwi7w5h%2BKr0SJ8MFihpNbx%2B4Erq7BYBuzsdiH1jCAzoSfl0rVirNbRXlBBlLX%2BBP0XJLAPGzTkAuAOqb0WT5AH7OcdCm5B8TgRwSRKIHQtaLCwg1RAAAOwAAAAAAAAAAAA%3D%3D); visibility: visible; opacity: 0.6; -webkit-transition: all 0.3s ease; transition: all 0.3s ease; } .reveal .overlay header { position: absolute; left: 0; top: 0; width: 100%; height: 40px; z-index: 2; border-bottom: 1px solid #222; } .reveal .overlay header a { display: inline-block; width: 40px; height: 40px; padding: 0 10px; float: right; opacity: 0.6; box-sizing: border-box; } .reveal .overlay header a:hover { opacity: 1; } .reveal .overlay header a .icon { display: inline-block; width: 20px; height: 20px; background-position: 50% 50%; background-size: 100%; background-repeat: no-repeat; } .reveal .overlay header a.close .icon { background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAABkklEQVRYR8WX4VHDMAxG6wnoJrABZQPYBCaBTWAD2g1gE5gg6OOsXuxIlr40d81dfrSJ9V4c2VLK7spHuTJ/5wpM07QXuXc5X0opX2tEJcadjHuV80li/FgxTIEK/5QBCICBD6xEhSMGHgQPgBgLiYVAB1dpSqKDawxTohFw4JSEA3clzgIBPCURwE2JucBR7rhPJJv5OpJwDX+SfDjgx1wACQeJG1aChP9K/IMmdZ8DtESV1WyP3Bt4MwM6sj4NMxMYiqUWHQu4KYA/SYkIjOsm3BXYWMKFDwU2khjCQ4ELJUJ4SmClRArOCmSXGuKma0fYD5CbzHxFpCSGAhfAVSSUGDUk2BWZaff2g6GE15BsBQ9nwmpIGDiyHQddwNTMKkbZaf9fajXQca1EX44puJZUsnY0ObGmITE3GVLCbEhQUjGVt146j6oasWN+49Vph2w1pZ5EansNZqKBm1txbU57iRRcZ86RWMDdWtBJUHBHwoQPi1GV+JCbntmvok7iTX4/Up9mgyTc/FJYDTcndgH/AA5A/CHsyEkVAAAAAElFTkSuQmCC); } .reveal .overlay header a.external .icon { background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAcElEQVRYR+2WSQoAIQwEzf8f7XiOMkUQxUPlGkM3hVmiQfQR9GYnH1SsAQlI4DiBqkCMoNb9y2e90IAEJPAcgdznU9+engMaeJ7Azh5Y1U67gAho4DqBqmB1buAf0MB1AlVBek83ZPkmJMGc1wAR+AAqod/B97TRpQAAAABJRU5ErkJggg==); } .reveal .overlay .viewport { position: absolute; display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; top: 40px; right: 0; bottom: 0; left: 0; } .reveal .overlay.overlay-preview .viewport iframe { width: 100%; height: 100%; max-width: 100%; max-height: 100%; border: 0; opacity: 0; visibility: hidden; -webkit-transition: all 0.3s ease; transition: all 0.3s ease; } .reveal .overlay.overlay-preview.loaded .viewport iframe { opacity: 1; visibility: visible; } .reveal .overlay.overlay-preview.loaded .spinner { opacity: 0; visibility: hidden; -webkit-transform: scale(0.2); transform: scale(0.2); } .reveal .overlay.overlay-help .viewport { overflow: auto; color: #fff; } .reveal .overlay.overlay-help .viewport .viewport-inner { width: 600px; margin: auto; padding: 20px 20px 80px 20px; text-align: center; letter-spacing: normal; } .reveal .overlay.overlay-help .viewport .viewport-inner .title { font-size: 20px; } .reveal .overlay.overlay-help .viewport .viewport-inner table { border: 1px solid #fff; border-collapse: collapse; font-size: 16px; } .reveal .overlay.overlay-help .viewport .viewport-inner table th, .reveal .overlay.overlay-help .viewport .viewport-inner table td { width: 200px; padding: 14px; border: 1px solid #fff; vertical-align: middle; } .reveal .overlay.overlay-help .viewport .viewport-inner table th { padding-top: 20px; padding-bottom: 20px; } /********************************************* * PLAYBACK COMPONENT *********************************************/ .reveal .playback { position: fixed; left: 15px; bottom: 20px; z-index: 30; cursor: pointer; -webkit-transition: all 400ms ease; transition: all 400ms ease; } .reveal.overview .playback { opacity: 0; visibility: hidden; } /********************************************* * ROLLING LINKS *********************************************/ .reveal .roll { display: inline-block; line-height: 1.2; overflow: hidden; vertical-align: top; -webkit-perspective: 400px; perspective: 400px; -webkit-perspective-origin: 50% 50%; perspective-origin: 50% 50%; } .reveal .roll:hover { background: none; text-shadow: none; } .reveal .roll span { display: block; position: relative; padding: 0 2px; pointer-events: none; -webkit-transition: all 400ms ease; transition: all 400ms ease; -webkit-transform-origin: 50% 0%; transform-origin: 50% 0%; -webkit-transform-style: preserve-3d; transform-style: preserve-3d; -webkit-backface-visibility: hidden; backface-visibility: hidden; } .reveal .roll:hover span { background: rgba(0, 0, 0, 0.5); -webkit-transform: translate3d(0px, 0px, -45px) rotateX(90deg); transform: translate3d(0px, 0px, -45px) rotateX(90deg); } .reveal .roll span:after { content: attr(data-title); display: block; position: absolute; left: 0; top: 0; padding: 0 2px; -webkit-backface-visibility: hidden; backface-visibility: hidden; -webkit-transform-origin: 50% 0%; transform-origin: 50% 0%; -webkit-transform: translate3d(0px, 110%, 0px) rotateX(-90deg); transform: translate3d(0px, 110%, 0px) rotateX(-90deg); } /********************************************* * SPEAKER NOTES *********************************************/ .reveal aside.notes { display: none; } .reveal .speaker-notes { display: none; position: absolute; width: 70%; max-height: 15%; left: 15%; bottom: 26px; padding: 10px; z-index: 1; font-size: 18px; line-height: 1.4; color: #fff; background-color: rgba(0, 0, 0, 0.5); overflow: auto; box-sizing: border-box; text-align: left; font-family: Helvetica, sans-serif; -webkit-overflow-scrolling: touch; } .reveal .speaker-notes.visible:not(:empty) { display: block; } @media screen and (max-width: 1024px) { .reveal .speaker-notes { font-size: 14px; } } @media screen and (max-width: 600px) { .reveal .speaker-notes { width: 90%; left: 5%; } } /********************************************* * ZOOM PLUGIN *********************************************/ .zoomed .reveal *, .zoomed .reveal *:before, .zoomed .reveal *:after { -webkit-backface-visibility: visible !important; backface-visibility: visible !important; } .zoomed .reveal .progress, .zoomed .reveal .controls { opacity: 0; } .zoomed .reveal .roll span { background: none; } .zoomed .reveal .roll span:after { visibility: hidden; }
honestree/cdnjs
ajax/libs/reveal.js/3.3.0/css/reveal.css
CSS
mit
48,698
!function(){"use strict";function t(t){return w?w+t:t}function i(){this.handlers={}}function e(t,i,e,n,s){this.item=t,this.translate=i.translate&&i.translate.map(parseFloat),this.rotate=i.rotate&&i.rotate.map(parseFloat),this.scale=i.scale,this.opacity=i.opacity,this.start=null,this.diff=null,this.duration=0|(i.duration||e),this.delay=0|(i.delay||s),this.ease=O[i.ease]||O[n]||O.linear,this.easeName=n||"linear"}function n(t,i,e,n,s,o){this.item=t,this.name=i.name||i,this.start=null,this.diff=null,this.duration=0|(i.duration||e),this.delay=0|(i.delay||s),this.ease=O.css[i.ease]||O.css[n]||O.css.linear,this._infinite=!1,this._generated=o}function s(t){i.call(this),this.start=null,this.item=t,this.delay=0,this.duration=0,this.easeName="linear",this.animations=[]}function o(t){s.call(this,t)}function r(t){s.call(this,t),this._infinite=!1}function a(t,i){!document.styleSheets.length&&this.createStyleSheet(),this.stylesheet=document.styleSheets[0],this.item=t,this.animation=t.animation,!i&&this.style()}function u(){i.call(this),this.items=[],this.frame=null,this.init()}function c(){u.call(this,!0),this.currentTime=0,this.start=0}function h(t){i.call(this),this.dom=t,this.init()}function p(){var t=x.sub(this.state.translate,this.current.position);this.current.acceleration=x.add(this.current.acceleration,t)}function l(t,i,e){t||(t=x.set(0)),i||(i=x.set(0)),e||(e=!0);for(var n=0;3>n;++n)(this.current.position[n]<t[n]||this.current.position[n]>i[n])&&(e?this.previous.position[n]=2*this.current.position[n]-this.previous.position[n]:this.current.position[n]=Math.max(t[n],Math.min(i[n],this.current.position[n])))}function f(t,i){var e=this.current,n=this.previous;e.acceleration=x.scale(e.acceleration,this.mass),e.velocity=x.sub(e.position,n.position),void 0!==i&&(e.velocity=x.scale(e.velocity,i)),n.position=e.position,e.position=x.add(e.position,x.add(e.velocity,x.scale(e.acceleration,t*t))),e.acceleration=x.zero()}function m(t,i,e,n){h.call(this,t),i===Object(i)&&(e=i.viscosity,n=i.edge,i=i.mass),i/=100,i||(i=.01),e||(e=.1),n||(n=!1),this.mass=1/i,this.viscosity=e,this.edge=n}var y={};y.world=function(){return new u},y.timeline=function(){return new c},"object"==typeof module&&"object"==typeof module.exports?module.exports=y:"function"==typeof define&&define.amd?define(y):window.anima=window.a=y;for(var d=top.requestAnimationFrame,v=top.cancelAnimationFrame,b=["moz","webkit","ms"],g=0;g<b.length&&!d;g++)d=top[b[g]+"RequestAnimationFrame"],v=top[b[g]+"CancelAnimationFrame"]||top[b[g]+"CancelRequestAnimationFrame"];var z,w=([].slice.call(getComputedStyle(document.documentElement,null)).join("").match(/(-(moz|webkit|ms)-)transform/)||[])[1],M=t("transform"),k=t("animation"),A=window.performance||Date;d(function(t){z=t>1e12!=A.now()>1e12});var x={set:function(t,i,e){return Array.isArray(t)&&(i=t[1],e=t[2],t=t[0]),void 0===t&&(t=0),void 0===i&&(i=t,e=t),[t,i,e]},length:function(t,i,e){return Array.isArray(t)&&(i=t[1],e=t[2],t=t[0]),Math.sqrt(t*t+i*i+e*e)},add:function(t,i){return[t[0]+i[0],t[1]+i[1],t[2]+i[2]]},sub:function(t,i){return[t[0]-i[0],t[1]-i[1],t[2]-i[2]]},norm:function(t,i,e){Array.isArray(t)&&(i=t[1],e=t[2],t=t[0]);var n=this.length(t,i,e);return 0!==n?(t/=n,i/=n,e/=n):(t=0,i=0,e=0),[t,i,e]},dist:function(t,i){var e=t[0]-i[0],n=t[1]-i[1],s=t[2]-i[2];return Math.sqrt(e*e+n*n+s+s)},cross:function(t,i){var e=t[1]*i[2]-t[2]*i[1],n=t[2]*i[0]-t[0]*i[2],s=t[1]*i[1]-t[1]*i[0];return[e,n,s]},clone:function(t){return t.slice()},scale:function(t,i,e,n){return Array.isArray(t)&&(n=i,i=t[1],e=t[2],t=t[0]),[t*n,i*n,e*n]},zero:function(){return[0,0,0]}},q=Math.PI/180,j={identity:function(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]},multiply:function S(t,i){var e=this.identity();return e[0]=t[0]*i[0]+t[1]*i[4]+t[2]*i[8],e[1]=t[0]*i[1]+t[1]*i[5]+t[2]*i[9],e[2]=t[0]*i[2]+t[1]*i[6]+t[2]*i[10],e[4]=t[4]*i[0]+t[5]*i[4]+t[6]*i[8],e[5]=t[4]*i[1]+t[5]*i[5]+t[6]*i[9],e[6]=t[4]*i[2]+t[5]*i[6]+t[6]*i[10],e[8]=t[8]*i[0]+t[9]*i[4]+t[10]*i[8],e[9]=t[8]*i[1]+t[9]*i[5]+t[10]*i[9],e[10]=t[8]*i[2]+t[9]*i[6]+t[10]*i[10],e[12]=t[12]*i[0]+t[13]*i[4]+t[14]*i[8]+i[12],e[13]=t[12]*i[1]+t[13]*i[5]+t[14]*i[9]+i[13],e[14]=t[12]*i[2]+t[13]*i[6]+t[14]*i[10]+i[14],2>=arguments.length?e:S.apply(this,[e].concat(Array.prototype.slice.call(arguments,2)))},translate:function(t,i,e){return t||i||e?(t||(t=0),i||(i=0),e||(e=0),[1,0,0,0,0,1,0,0,0,0,1,0,t,i,e,1]):this.identity()},scale:function(t,i,e){return t||i||e?(t||(t=1),i||(i=1),e||(e=1),[t,0,0,0,0,i,0,0,0,0,e,0,0,0,0,1]):this.identity()},rotate:function(t,i,e){if(!(t||i||e))return this.identity();t||(t=0),i||(i=0),e||(e=0),t*=q,i*=q,e*=q;var n=Math.sin(t),s=Math.cos(t),o=Math.sin(i),r=Math.cos(i),a=Math.sin(e),u=Math.cos(e);return[r*u,s*a+n*o*u,n*a-s*o*u,0,-r*a,s*u-n*o*a,n*u+s*o*a,0,o,-n*r,s*r,0,0,0,0,1]},rotate3d:function(t,i,e,n){n||(n=0),n*=q;var s=Math.sin(n),o=Math.cos(n),r=x.norm(t,i,e);t=r[0],i=r[1],e=r[2];var a=t*t,u=i*i,c=e*e,h=1-o;return[a+(1-a)*o,t*i*h+e*s,t*e*h-i*s,0,t*i*h-e*s,u+(1-u)*o,i*e*h+t*s,0,t*e*h+i*s,i*e*h-t*s,c+(1-c)*o,0,0,0,0,1]},skew:function(t,i){return t||i?(t||(t=0),i||(i=0),t*=q,i*=q,[1,Math.tan(i),0,0,Math.tan(t),1,0,0,0,0,1,0,0,0,0,1]):this.identity()},perspective:function(t){return t=-1/t,[1,0,0,0,0,1,0,0,0,0,1,t,0,0,0,1]},parse:function(t){var i=t.match(/\((.+)\)/)[1].split(/,\s?/);return 6===i.length&&(i.splice(2,0,"0","0"),i.splice(6,0,"0","0"),i.splice(8,0,"0","0","1","0"),i.push("0","1")),i},inverse:function(t){var i=this.identity(),e=t[5]*t[10]-t[6]*t[9],n=t[1]*t[10]-t[2]*t[9],s=t[1]*t[6]-t[2]*t[5],o=t[4]*t[10]-t[6]*t[8],r=t[0]*t[10]-t[2]*t[8],a=t[0]*t[6]-t[2]*t[4],u=t[4]*t[9]-t[5]*t[8],c=t[0]*t[9]-t[1]*t[8],h=t[0]*t[5]-t[1]*t[4],p=1/(t[0]*e-t[1]*o+t[2]*u);return i[0]=p*e,i[1]=-p*n,i[2]=p*s,i[4]=-p*o,i[5]=p*r,i[6]=-p*a,i[8]=p*u,i[9]=-p*c,i[10]=p*h,i[12]=-t[12]*i[0]-t[13]*i[4]-t[14]*i[8],i[13]=-t[12]*i[1]-t[13]*i[5]-t[14]*i[9],i[14]=-t[12]*i[2]-t[13]*i[6]-t[14]*i[10],i},compose:function(t,i,e){t||(t=[]),i||(i=[]),e||(e=[]);var n=this.rotate(i[0],i[1],i[2]);return e.length&&(n[0]*=e[0],n[1]*=e[0],n[2]*=e[0],n[4]*=e[1],n[5]*=e[1],n[6]*=e[1],n[8]*=e[2],n[9]*=e[2],n[10]*=e[2]),t.length&&(n[12]=t[0],n[13]=t[1],n[14]=t[2]),n},decompose:function(t){var i=x.length(t[0],t[1],t[2]),e=x.length(t[4],t[5],t[6]),n=x.length(t[8],t[9],t[10]),s=Math.atan2(-t[9]/n,t[10]/n)/q,o=Math.asin(t[8]/n)/q,r=Math.atan2(-t[4]/e,t[0]/i)/q;(1===t[4]||-1===t[4])&&(s=0,o=t[4]*-Math.PI/2,r=t[4]*Math.atan2(t[6]/e,t[5]/e)/q);var a=t[12],u=t[13],c=t[14];return{translate:[a,u,c],rotate:[s,o,r],scale:[i,e,n]}},transpose:function(t){var i;return i=t[1],t[1]=t[4],t[4]=i,i=t[2],t[2]=t[8],t[8]=i,i=t[6],t[6]=t[9],t[9]=i,i=t[3],t[3]=t[12],t[12]=i,i=t[7],t[7]=t[13],t[13]=i,i=t[11],t[11]=t[14],t[14]=i,t},lookAt:function(t,i,e){var n=x.sub(t,i);n=x.norm(n),0===x.length(n)&&(n[2]=1);var s=x.cross(e,n);0===x.length(s)&&(n[0]+=1e-4,s=x.norm(x.cross(e,n)));var o=x.cross(n,s),r=this.identity();return r[0]=s[0],r[1]=s[1],r[2]=s[2],r[4]=o[0],r[5]=o[1],r[6]=o[2],r[8]=n[0],r[9]=n[1],r[10]=n[2],r},stringify:function(t){for(var i=0;i<t.length;++i)Math.abs(t[i])<1e-6&&(t[i]=0);return"matrix3d("+t.join()+")"}};i.prototype.on=function(t,i){return(this.handlers[t]=this.handlers[t]||[]).push(i),this},i.prototype.off=function(t,i){var e=this.handlers[t];return i?e.splice(e.indexOf(i),1):delete this.handlers[t],this},i.prototype.emit=function(t){var i=Array.prototype.slice.call(arguments,1),e=this.handlers[t];if(e)for(var n=0;n<e.length;++n)e[n].apply(this,i);return this},i.prototype.listeners=function(t){return this.handlers[t]||[]};var O=function(){var t={quad:function(t){return Math.pow(t,2)},cubic:function(t){return Math.pow(t,3)},quart:function(t){return Math.pow(t,4)},quint:function(t){return Math.pow(t,5)},expo:function(t){return Math.pow(t,6)},sine:function(t){return 1-Math.cos(t*Math.PI/2)},circ:function(t){return 1-Math.sqrt(1-t*t)},back:function(t){return t*t*(3*t-2)}},i={linear:function(t){return t}};return Object.keys(t).forEach(function(e){var n=t[e];i["ease-in-"+e]=n,i["ease-out-"+e]=function(t){return 1-n(1-t)},i["ease-in-out-"+e]=function(t){return.5>t?n(2*t)/2:1-n(-2*t+2)/2}}),i.css={linear:"cubic-bezier(0.000, 0.000, 1.000, 1.000)","ease-in-quad":"cubic-bezier(0.550, 0.085, 0.680, 0.530)","ease-in-cubic":"cubic-bezier(0.550, 0.055, 0.675, 0.190)","ease-in-quart":"cubic-bezier(0.895, 0.030, 0.685, 0.220)","ease-in-quint":"cubic-bezier(0.755, 0.050, 0.855, 0.060)","ease-in-sine":"cubic-bezier(0.470, 0.000, 0.745, 0.715)","ease-in-expo":"cubic-bezier(0.950, 0.050, 0.795, 0.035)","ease-in-circ":"cubic-bezier(0.600, 0.040, 0.980, 0.335)","ease-in-back":"cubic-bezier(0.600, -0.280, 0.735, 0.045)","ease-out-quad":"cubic-bezier(0.250, 0.460, 0.450, 0.940)","ease-out-cubic":"cubic-bezier(0.215, 0.610, 0.355, 1.000)","ease-out-quart":"cubic-bezier(0.165, 0.840, 0.440, 1.000)","ease-out-quint":"cubic-bezier(0.230, 1.000, 0.320, 1.000)","ease-out-sine":"cubic-bezier(0.390, 0.575, 0.565, 1.000)","ease-out-expo":"cubic-bezier(0.190, 1.000, 0.220, 1.000)","ease-out-circ":"cubic-bezier(0.075, 0.820, 0.165, 1.000)","ease-out-back":"cubic-bezier(0.175, 0.885, 0.320, 1.275)","ease-in-out-quad":"cubic-bezier(0.455, 0.030, 0.515, 0.955)","ease-in-out-cubic":"cubic-bezier(0.645, 0.045, 0.355, 1.000)","ease-in-out-quart":"cubic-bezier(0.770, 0.000, 0.175, 1.000)","ease-in-out-quint":"cubic-bezier(0.860, 0.000, 0.070, 1.000)","ease-in-out-sine":"cubic-bezier(0.445, 0.050, 0.550, 0.950)","ease-in-out-expo":"cubic-bezier(1.000, 0.000, 0.000, 1.000)","ease-in-out-circ":"cubic-bezier(0.785, 0.135, 0.150, 0.860)","ease-in-out-back":"cubic-bezier(0.680, -0.550, 0.265, 1.550)"},i}();e.prototype.init=function(t,i){if(null===this.start||i){this.start=t+this.delay;var e=this.item.state;this.initial={translate:e.translate.slice(),rotate:e.rotate.slice(),scale:e.scale.slice(),opacity:e.opacity}}},e.prototype.run=function(t){if(!(t<this.start)){var i=(t-this.start)/this.duration;i=this.ease(i),this.transform(i)}},e.prototype.pause=function(){this.diff=A.now()-this.start},e.prototype.resume=function(){this.start=A.now()-this.diff},e.prototype.set=function(t,i){var e=this.item.state,n=this.initial;if(Array.isArray(this[t]))for(var s=0;3>s;++s)this[t][s]&&(e[t][s]=n[t][s]+this[t][s]*i);else void 0!==this[t]&&(e[t]=n[t]+(this[t]-n[t])*i)},e.prototype.transform=function(t){this.set("translate",t),this.set("rotate",t),this.set("scale",t),this.set("opacity",t)},e.prototype.end=function(t){!t&&this.transform(1),this.start=null},n.prototype.init=function(t,i){(null===this.start||i)&&(this.start=t+this.delay,this.item.style(k,this.name+" "+this.duration+"ms"+" "+this.ease+" "+this.delay+"ms"+(this._infinite?" infinite":"")+" "+"forwards"))},n.prototype.run=function(){},n.prototype.pause=function(){this.item.style(k+"PlayState","paused"),this.diff=A.now()-this.start},n.prototype.resume=function(){this.item.style(k+"PlayState","running"),this.start=A.now()-this.diff},n.prototype.end=function(){if(this._generated){var t=getComputedStyle(this.item.dom,null),i=t[M],e=t.opacity;this.item.style(k,""),this.item.state=j.decompose(j.parse(i)),this.item.state.opacity=e,this.item.style()}this.start=null},s.prototype=Object.create(i.prototype),s.prototype.constructor=s,s.prototype.add=function(t,i,a,u,c){function h(t,e){var n=new r(t);return e.forEach(function(t){n.add(t,i,a,u)}),n}function p(t,e){var n=new o(t);return e.forEach(function(e){Array.isArray(e)?n.add(h(t,e)):n.add(e,i,a,u)}),n}return Array.isArray(t)?t=p(this.item,t):"string"==typeof t||void 0!=t.name?t=new n(this.item,t,i,a,u,c):t instanceof s||(t=new e(this.item,t,i,a,u)),this.animations.push(t),i=this.animations.map(function(t){return t.duration+t.delay}),this.duration=this instanceof o?Math.max.apply(null,i):i.reduce(function(t,i){return t+i},0),this},Object.defineProperty(s.prototype,"length",{get:function(){return this.animations.length}}),s.prototype.get=function(t){return this.animations[t]},s.prototype.empty=function(){this.animations=[]},s.prototype.animate=function(t,i,e,n){return this.add(t,i,e,n)},s.prototype.css=function(){return this.item.css()},o.prototype=Object.create(s.prototype),o.prototype.constructor=o,o.prototype.all=function(t){for(var i=Array.prototype.slice.call(arguments,1),e=0;e<this.animations.length;++e){var n=this.animations[e];n[t].apply(n,i)}},o.prototype.init=function(t,i){(null===this.start||i)&&(this.start=t,this.all("init",t,i),this.emit("start"))},o.prototype.run=function(t){if(this.animations.length){for(var i=0;i<this.animations.length;++i){var e=this.animations[i];e.start+e.duration<=t?(this.animations.splice(i--,1),e.end()):e.run(t)}this.item.style(),this.animations.length||this.end()}},o.prototype.seek=function(t){this.run(t)},o.prototype.pause=function(){this.all("pause")},o.prototype.resume=function(){this.all("resume")},o.prototype.end=function(t){this.all("end",t),this.emit("end")},r.prototype=Object.create(s.prototype),r.prototype.constructor=r,r.prototype.init=function(t,i){(null===this.start||i)&&(this.start=t,this.animations[0].init(t,i),this.emit("start"))},r.prototype.run=function(t,i){if(this.animations.length){for(;0!==this.animations.length;){if(i=this.animations[0],i instanceof n&&(i._infinite=this._infinite),i.init(t),!(i.start+i.duration<=t)){i.run(t);break}if(this._infinite&&i instanceof n)break;this.animations.shift(),i.end(),!this._infinite||i instanceof n||this.animations.push(i)}i instanceof n||this.item.style(),this.animations.length||this.end()}},r.prototype.seek=function(t){if(0!==this.animations.length)for(var i=0,e=0;e<this.animations.length;++e){var n=this.animations[e];n.init(i,!0);{if(!(n.start+n.duration<=t)){n.run(t),this.item.style();break}n.end(),i+=n.delay+n.duration}}},r.prototype.infinite=function(){return this._infinite=!0,this},r.prototype.pause=function(){this.animations.length&&this.animations[0].pause()},r.prototype.resume=function(){this.animations.length&&this.animations[0].resume()},r.prototype.end=function(t){for(var i=0;i<this.animations.length;++i)this.animations[i].end(t);this.animations=[],this._infinite=!1,this.emit("end")},a.prototype.createStyleSheet=function(){var t=document.createElement("style");document.getElementsByTagName("head")[0].appendChild(t)},a.prototype.pause=function(){this.animation.pause()},a.prototype.resume=function(){this.animation.resume()},a.prototype.stop=function(){var t=getComputedStyle(this.item.dom,null),i=t[M],e=t.opacity;return this.item.style(k,""),this.item.state=j.decompose(j.parse(i)),this.item.state.opacity=e,this.item.style(),this},a.prototype.style=function(){var t="a"+Date.now()+"r"+Math.floor(1e3*Math.random());this.stylesheet.insertRule(this.keyframes(t),0),this.animation.empty(),this.animation.add(t,this.animation.duration,"",0,!0)},a.prototype.keyframes=function(i){for(var n=0,s=["@"+t("keyframes")+" "+i+"{"],o=0;o<this.animation.length;++o){var r=this.animation.get(o),a=this.animation.get(o+1);if(r.init(),r instanceof e)0===o&&s.push(this.frame(0,O.css[r.easeName])),r.delay&&s.push(this.frame(n+=r.delay)),r.transform(1),s.push(this.frame(n+=r.duration,a&&O.css[a.easeName]));else{var u=[];r.animations.forEach(function(t){t.delay&&-1===u.indexOf(t.delay)&&u.push(t.delay),t.duration&&-1===u.indexOf(t.delay+t.duration)&&u.push(t.delay+t.duration)}),u=u.sort(function(t,i){return t-i});for(var c=0;c<u.length;++c){for(var h=u[c],p=0;p<r.animations.length;++p){var l=r.animations[p];l.delay>=h||l.delay+l.duration<h||l.transform(l.ease((h-l.delay)/l.duration))}s.push(this.frame(n+=h))}}}return s.push("}"),s.join("")},a.prototype.percent=function(t){return(100*t/this.animation.duration).toFixed(3)},a.prototype.frame=function(i,e){var n=this.percent(i);return n+"% {"+(n?M+":"+this.item.transform()+";":"")+(n?"opacity:"+this.item.opacity()+";":"")+(e?t("animation-timing-function")+":"+e+";":"")+"}"},u.prototype=Object.create(i.prototype),u.prototype.constructor=u,u.prototype.init=function(){function t(e){z&&(e=A.now()),i.update(e),i.frame=d(t)}var i=this;this.frame=d(t)},u.prototype.update=function(t){for(var i=0;i<this.items.length;++i)this.items[i].update(t)},u.prototype.add=function(t,i,e,n){var s;return s=i?new m(t,i,e,n):new h(t),this.items.push(s),s},u.prototype.cancel=function(){this.frame&&v(this.frame),this.frame=0},u.prototype.stop=function(){this.cancel();for(var t=0;t<this.items.length;++t)this.items[t].stop()},u.prototype.pause=function(){this.cancel();for(var t=0;t<this.items.length;++t)this.items[t].pause()},u.prototype.resume=function(){for(var t=0;t<this.items.length;++t)this.items[t].resume();this.init()},c.prototype=Object.create(u.prototype),c.prototype.constructor=c,c.prototype.init=function(){function t(e){z&&(e=A.now()),i.running&&(i.currentTime=e-i.start),i.update(i.currentTime),i.frame=d(t)}this.frame=d(t);var i=this},c.prototype.update=function(t){for(var i=0,e=this.items.length;e>i;++i){var n=this.items[i];this.changed<e||this.running?(n.timeline(t),this.changed++,this.emit("update",t)):n.style()}},c.prototype.play=function(){this.running=!0,this.start=A.now()-this.currentTime},c.prototype.pause=function(){this.running=!1},c.prototype.stop=function(){this.currentTime=0,this.running=!1},c.prototype.seek=function(t){this.changed=0,this.currentTime=t},h.prototype=Object.create(i.prototype),h.prototype.constructor=h,h.prototype.init=function(){this.animation=new r(this),this.running=!0,this.state={translate:x.zero(),rotate:x.zero(),scale:x.set(1),opacity:1}},h.prototype.update=function(t){this.animation.run(t)},h.prototype.timeline=function(t){this.clear(),this.animation.seek(t)},h.prototype.pause=function(){this.running&&(this.animation.pause(),this.running=!1)},h.prototype.resume=function(){this.running||(this.animation.resume(),this.running=!0)},h.prototype.style=function(t,i){t&&i?this.dom.style[t]=i:(this.dom.style[M]=this.transform(),this.dom.style.opacity=this.opacity())},h.prototype.transform=function(){return j.stringify(this.matrix())},h.prototype.matrix=function(){var t=this.state;return j.compose(t.translate,t.rotate,t.scale)},h.prototype.center=function(){return j.decompose(j.inverse(this.matrix()))},h.prototype.lookAt=function(t){var i=j.decompose(j.lookAt(t,this.state.translate,x.set(0,1,0)));this.state.rotate=i.rotate},h.prototype.opacity=function(){return this.state.opacity},h.prototype.add=function(t,i){return this.state[t][0]+=i[0],this.state[t][1]+=i[1],this.state[t][2]+=i[2],this},h.prototype.set=function(t,i){return this.state[t]=i,this},h.prototype.translate=function(t){return this.add("translate",t)},h.prototype.rotate=function(t){return this.add("rotate",t)},h.prototype.scale=function(t){return this.add("scale",t)},h.prototype.clear=function(){this.state.translate=x.zero(),this.state.rotate=x.zero(),this.state.scale=x.set(1),this.state.opacity=1},h.prototype.animate=function(t,i,e,n){return this.animation.add(t,i,e,n)},h.prototype.finish=function(t){return this.animation.end(t),this},h.prototype.stop=function(){return this.finish(!0)},h.prototype.css=function(t){return new a(this,t)},m.prototype=Object.create(h.prototype),m.prototype.constructor=m,m.prototype.init=function(){h.prototype.init.call(this),this.current={position:x.zero(),velocity:x.zero(),acceleration:x.zero()},this.previous={position:x.zero(),velocity:x.zero(),acceleration:x.zero()},this.clock=null},m.prototype.update=function(t){this.animation.run(t),this.integrate(t),this.style()},m.prototype.timeline=function(t){this.clear(),this.animation.seek(t),this.integrate(t,!0),this.style()},m.prototype.integrate=function(t,i){this.clock||(this.clock=t);var e=t-this.clock;e&&(i&&(e=Math.max(-16,Math.min(16,e))),this.clock=t,e*=.001,p.call(this),this.edge&&l.call(this,x.set(this.edge.min),x.set(this.edge.max),this.edge.bounce),f.call(this,e,1-this.viscosity))},m.prototype.css=function(){throw new Error("CSS is nor supported for physics")},m.prototype.matrix=function(){var t=this.state;return j.compose(this.current.position,t.rotate,t.scale)}}(); //# sourceMappingURL=anima.min.js.map
AlexisArce/cdnjs
ajax/libs/anima/0.3.4/anima.min.js
JavaScript
mit
19,980
/** * jQuery Geocoding and Places Autocomplete Plugin - V 1.3 * * @author Martin Kleppe <kleppe@ubilabs.net>, 2012 * @author Ubilabs http://ubilabs.net, 2012 * @license MIT License <http://www.opensource.org/licenses/mit-license.php> */ // # $.geocomplete() // ## jQuery Geocoding and Places Autocomplete Plugin - V 1.3 // // * https://github.com/ubilabs/geocomplete/ // * by Martin Kleppe <kleppe@ubilabs.net> ;(function($, window, document, undefined){ // ## Options // The default options for this plugin. // // * `map` - Might be a selector, an jQuery object or a DOM element. Default is `false` which shows no map. // * `details` - The container that should be populated with data. Defaults to `false` which ignores the setting. // * `location` - Location to initialize the map on. Might be an address `string` or an `array` with [latitude, longitude] or a `google.maps.LatLng`object. Default is `false` which shows a blank map. // * `bounds` - Whether to snap geocode search to map bounds. Default: `true` if false search globally. Alternatively pass a custom `LatLngBounds object. // * `detailsAttribute` - The attribute's name to use as an indicator. Default: `"name"` // * `mapOptions` - Options to pass to the `google.maps.Map` constructor. See the full list [here](http://code.google.com/apis/maps/documentation/javascript/reference.html#MapOptions). // * `mapOptions.zoom` - The inital zoom level. Default: `14` // * `mapOptions.scrollwheel` - Whether to enable the scrollwheel to zoom the map. Default: `false` // * `mapOptions.mapTypeId` - The map type. Default: `"roadmap"` // * `markerOptions` - The options to pass to the `google.maps.Marker` constructor. See the full list [here](http://code.google.com/apis/maps/documentation/javascript/reference.html#MarkerOptions). // * `markerOptions.draggable` - If the marker is draggable. Default: `false`. Set to true to enable dragging. // * `maxZoom` - The maximum zoom level too zoom in after a geocoding response. Default: `16` // * `types` - An array containing one or more of the supported types for the places request. Default: `['geocode']` See the full list [here](http://code.google.com/apis/maps/documentation/javascript/places.html#place_search_requests). var defaults = { bounds: true, country: null, map: false, details: false, detailsAttribute: "name", location: false, mapOptions: { zoom: 14, scrollwheel: false, mapTypeId: "roadmap" }, markerOptions: { draggable: false }, maxZoom: 16, types: ['geocode'] }; // See: [Geocoding Types](https://developers.google.com/maps/documentation/geocoding/#Types) // on Google Developers. var componentTypes = ("street_address route intersection political " + "country administrative_area_level_1 administrative_area_level_2 " + "administrative_area_level_3 colloquial_area locality sublocality " + "neighborhood premise subpremise postal_code natural_feature airport " + "park point_of_interest post_box street_number floor room " + "lat lng viewport location " + "formatted_address location_type bounds").split(" "); // See: [Places Details Responses](https://developers.google.com/maps/documentation/javascript/places#place_details_responses) // on Google Developers. var placesDetails = ("id url website vicinity reference name rating " + "international_phone_number icon formatted_phone_number").split(" "); // The actual plugin constructor. function GeoComplete(input, options) { this.options = $.extend(true, {}, defaults, options); this.input = input; this.$input = $(input); this._defaults = defaults; this._name = 'geocomplete'; this.init(); } // Initialize all parts of the plugin. $.extend(GeoComplete.prototype, { init: function(){ this.initMap(); this.initMarker(); this.initGeocoder(); this.initDetails(); this.initLocation(); }, // Initialize the map but only if the option `map` was set. // This will create a `map` within the given container // using the provided `mapOptions` or link to the existing map instance. initMap: function(){ if (!this.options.map){ return; } if (typeof this.options.map.setCenter == "function"){ this.map = this.options.map; return; } this.map = new google.maps.Map( $(this.options.map)[0], this.options.mapOptions ); }, // Add a marker with the provided `markerOptions` but only // if the option was set. Additionally it listens for the `dragend` event // to notify the plugin about changes. initMarker: function(){ if (!this.map){ return; } var options = $.extend(this.options.markerOptions, { map: this.map }); this.marker = new google.maps.Marker(options); google.maps.event.addListener( this.marker, 'dragend', $.proxy(this.markerDragged, this) ); }, // Associate the input with the autocompleter and create a geocoder // to fall back when the autocompleter does not return a value. initGeocoder: function(){ var options = { types: this.options.types, bounds: this.options.bounds === true ? null : this.options.bounds }; if (this.options.country){ options.componentRestrictions = {country: this.options.country} } this.autocomplete = new google.maps.places.Autocomplete( this.input, options ); this.geocoder = new google.maps.Geocoder(); // Bind autocomplete to map bounds but only if there is a map // and `options.bindToMap` is set to true. if (this.map && this.options.bounds === true){ this.autocomplete.bindTo('bounds', this.map); } // Watch `place_changed` events on the autocomplete input field. google.maps.event.addListener( this.autocomplete, 'place_changed', $.proxy(this.placeChanged, this) ); // Prevent parent form from being submitted if user hit enter. this.$input.keypress(function(event){ if (event.keyCode === 13){ return false; } }); // Listen for "geocode" events and trigger find action. this.$input.bind("geocode", $.proxy(function(){ this.find(); }, this)); }, // Prepare a given DOM structure to be populated when we got some data. // This will cycle through the list of component types and map the // corresponding elements. initDetails: function(){ if (!this.options.details){ return; } var $details = $(this.options.details), attribute = this.options.detailsAttribute, details = {}; function setDetail(value){ details[value] = $details.find("[" + attribute + "=" + value + "]"); } $.each(componentTypes, function(index, key){ setDetail(key); setDetail(key + "_short"); }); $.each(placesDetails, function(index, key){ setDetail(key); }); this.$details = $details; this.details = details; }, // Set the initial location of the plugin if the `location` options was set. // This method will care about converting the value into the right format. initLocation: function() { var location = this.options.location, latLng; if (!location) { return; } if (typeof location == 'string') { this.find(location); return; } if (location instanceof Array) { latLng = new google.maps.LatLng(location[0], location[1]); } if (location instanceof google.maps.LatLng){ latLng = location; } if (latLng){ this.geoocode({ latLng: latLng }); } }, // Look up a given address. If no `address` was specified it uses // the current value of the input. find: function(address){ this.geocode({ address: address || this.$input.val() }); }, // Requests details about a given location. // Additionally it will bias the requests to the provided bounds. geocode: function(request){ if (this.options.bounds && !request.bounds){ if (this.options.bounds === true){ request.bounds = this.map && this.map.getBounds(); } else { request.bounds = this.options.bounds; } } if (this.options.country){ request.region = this.options.country; } this.geocoder.geocode(request, $.proxy(this.handleGeocode, this)); }, // Handles the geocode response. If more than one results was found // it triggers the "geocode:multiple" events. If there was an error // the "geocode:error" event is fired. handleGeocode: function(results, status){ if (status === google.maps.GeocoderStatus.OK) { var result = results[0]; this.$input.val(result.formatted_address); this.update(result); if (results.length > 1){ this.trigger("geocode:multiple", results); } } else { this.trigger("geocode:error", status); } }, // Triggers a given `event` with optional `arguments` on the input. trigger: function(event, argument){ this.$input.trigger(event, [argument]); }, // Set the map to a new center by passing a `geometry`. // If the geometry has a viewport, the map zooms out to fit the bounds. // Additionally it updates the marker position. center: function(geometry){ if (geometry.viewport){ this.map.fitBounds(geometry.viewport); if (this.map.getZoom() > this.options.maxZoom){ this.map.setZoom(this.options.maxZoom); } } else { this.map.setZoom(this.options.maxZoom); this.map.setCenter(geometry.location); } if (this.marker){ this.marker.setPosition(geometry.location); this.marker.setAnimation(this.options.markerOptions.animation); } }, // Update the elements based on a single places or geoocoding response // and trigger the "geocode:result" event on the input. update: function(result){ if (this.map){ this.center(result.geometry); } if (this.$details){ this.fillDetails(result); } this.trigger("geocode:result", result); }, // Populate the provided elements with new `result` data. // This will lookup all elements that has an attribute with the given // component type. fillDetails: function(result){ var data = {}, geometry = result.geometry, viewport = geometry.viewport, bounds = geometry.bounds; // Create a simplified version of the address components. $.each(result.address_components, function(index, object){ var name = object.types[0]; data[name] = object.long_name; data[name + "_short"] = object.short_name; }); // Add properties of the places details. $.each(placesDetails, function(index, key){ data[key] = result[key]; }); // Add infos about the address and geometry. $.extend(data, { formatted_address: result.formatted_address, location_type: geometry.location_type || "PLACES", viewport: viewport, bounds: bounds, location: geometry.location, lat: geometry.location.lat(), lng: geometry.location.lng() }); // Set the values for all details. $.each(this.details, $.proxy(function(key, $detail){ var value = data[key]; this.setDetail($detail, value); }, this)); this.data = data; }, // Assign a given `value` to a single `$element`. // If the element is an input, the value is set, otherwise it updates // the text content. setDetail: function($element, value){ if (value === undefined){ value = ""; } else if (typeof value.toUrlValue == "function"){ value = value.toUrlValue(); } if ($element.is(":input")){ $element.val(value); } else { $element.text(value); } }, // Fire the "geocode:dragged" event and pass the new position. markerDragged: function(event){ this.trigger("geocode:dragged", event.latLng); }, // Restore the old position of the marker to the last now location. resetMarker: function(){ this.marker.setPosition(this.data.location); this.setDetail(this.details.lat, this.data.location.lat()); this.setDetail(this.details.lng, this.data.location.lng()); }, // Update the plugin after the user has selected an autocomplete entry. // If the place has no geometry it passes it to the geocoder. placeChanged: function(){ var place = this.autocomplete.getPlace(); if (!place.geometry){ this.find(place.name); } else { this.update(place); } } }); // A plugin wrapper around the constructor. // Pass `options` with all settings that are different from the default. // The attribute is used to prevent multiple instantiations of the plugin. $.fn.geocomplete = function(options) { var attribute = 'plugin_geocomplete'; // If you call `.geocomplete()` with a string as the first paramenter // it returns the corresponding property or calls the method with the // following arguments. if (typeof options == "string"){ var instance = $(this).data(attribute), prop = instance[options]; if (typeof prop == "function"){ return prop.apply(instance, Array.prototype.slice.call(arguments, 1)); } else { if (arguments.length == 2){ prop = arguments[1]; } return prop; } } else { return this.each(function() { // Prevent against multiple instantiations. var instance = $.data(this, attribute); if (!instance) { instance = new GeoComplete( this, options ) $.data(this, attribute, instance); } }); } }; })( jQuery, window, document );
webdev1001/cdnjs
ajax/libs/geocomplete/1.3/jquery.geocomplete.js
JavaScript
mit
14,118
webshims.register('form-validation', function($, webshims, window, document, undefined, options){ "use strict"; var isWebkit = 'webkitURL' in window; var hasNative = Modernizr.formvalidation && !webshims.bugs.bustedValidity; var chromeBugs = isWebkit && hasNative; var ua = navigator.userAgent; var webkitVersion = chromeBugs && parseFloat((ua.match(/Safari\/([\d\.]+)/) || ['', '999999'])[1], 10); var iVal = options.iVal; if(!iVal.fieldWrapper){ iVal.fieldWrapper = ':not(span):not(label):not(em):not(strong):not(p):not(.ws-custom-file)'; } var invalidClass = iVal.errorClass || (iVal.errorClass = 'user-error'); var validClass = iVal.successClass || (iVal.successClass = 'user-success'); var invalidWrapperClass = iVal.errorWrapperClass || (iVal.errorWrapperClass = 'ws-invalid'); var successWrapperClass = iVal.successWrapperClass || (iVal.successWrapperClass = 'ws-success'); var errorBoxClass = iVal.errorBoxClass || (iVal.errorBoxClass = 'ws-errorbox'); var errorMessageClass = iVal.errorMessageClass || (iVal.errorMessageClass = 'ws-errormessage'); var checkTypes = {checkbox: 1, radio: 1}; var loader = webshims.loader; var addModule = loader.addModule; var emptyJ = $([]); var nonFormFilter = function(){ return !$.prop(this, 'form'); }; //TODO: cache + perftest var getGroupElements = function(elem){ elem = $(elem); var name; var form; var ret = emptyJ; if(elem[0].type == 'radio'){ form = elem.prop('form'); name = elem[0].name; if(!name){ ret = elem; } else if(form){ ret = $(form).jProp(name); } else { ret = $(document.getElementsByName(name)).filter(nonFormFilter); } ret = ret.filter('[type="radio"]'); } return ret; }; var returnValidityCause = function(validity, elem){ var ret; $.each(validity, function(name, value){ if(value){ ret = name + $.prop(elem, 'validationMessage'); return false; } }); return ret; }; var isInGroup = function(name){ var ret; try { ret = document.activeElement.name === name; } catch(e){} return ret; }; //actually we could always use the change event, but chrome messed it up and does not respect the commit action definition of the html spec //see: http://code.google.com/p/chromium/issues/detail?id=155747 var changeTypes = { radio: 1, checkbox: 1, 'select-one': 1, 'select-multiple': 1, file: 1, date: 1, month: 1, week: 1, text: 1 }; //see: http://code.google.com/p/chromium/issues/detail?id=179708 and bug above var noFocusWidgets = { time: 1, date: 1, month: 1, datetime: 1, week: 1, 'datetime-local': 1 }; var updateValidationEvents = { refreshvalidityui: 1, updatevalidation: 1 }; var iValClasses = '.'+ iVal.errorClass +', .'+iVal.successClass; var switchValidityClass = function(e){ if(!iVal.sel){return;} var elem, timer, shadowElem, shadowType; if(!e.target){return;} elem = $(e.target).getNativeElement()[0]; shadowElem = $(elem).getShadowElement(); if(elem.type == 'submit' || !$.prop(elem, 'willValidate') || (e.type == 'change' && (shadowType = shadowElem.prop('type')) && !changeTypes[shadowType])){return;} timer = $.data(elem, 'webshimsswitchvalidityclass'); var switchClass = function(){ if(!shadowType){ shadowType = shadowElem.prop('type'); } if( (chromeBugs && (e.type == 'change' || webkitVersion < 537.36) && noFocusWidgets[shadowType] && $(e.target).is(':focus')) || (e.type == 'focusout' && elem.type == 'radio' && isInGroup(elem.name)) ){ return; } if(webshims.refreshCustomValidityRules && webshims.refreshCustomValidityRules(elem) == 'async'){ $(elem).one('updatevalidation.webshims', switchValidityClass); return; } var validity = $.prop(elem, 'validity'); var addClass, removeClass, trigger, generaltrigger, validityCause; if(validity.valid){ if(!shadowElem.hasClass(validClass)){ addClass = validClass; removeClass = invalidClass; generaltrigger = 'changedvaliditystate'; trigger = 'changedvalid'; if(checkTypes[elem.type] && elem.checked){ getGroupElements(elem).not(elem).removeClass(removeClass).addClass(addClass).removeAttr('aria-invalid'); } shadowElem.removeAttr('aria-invalid'); $.removeData(elem, 'webshimsinvalidcause'); } } else { validityCause = returnValidityCause(validity, elem); if($.data(elem, 'webshimsinvalidcause') != validityCause){ $.data(elem, 'webshimsinvalidcause', validityCause); generaltrigger = 'changedvaliditystate'; } if(!shadowElem.hasClass(invalidClass)){ addClass = invalidClass; removeClass = validClass; if (checkTypes[elem.type] && !elem.checked) { getGroupElements(elem).not(elem).removeClass(removeClass).addClass(addClass).attr('aria-invalid', 'true'); } shadowElem.attr('aria-invalid', 'true'); trigger = 'changedinvalid'; } } if(addClass){ shadowElem.addClass(addClass).removeClass(removeClass); //jQuery 1.6.1 IE9 bug (doubble trigger bug) setTimeout(function(){ $(elem).trigger(trigger); }); } if(generaltrigger){ setTimeout(function(){ $(elem).trigger(generaltrigger); }); } $.removeData(elem, 'webshimsswitchvalidityclass'); }; if(shadowElem.triggerHandler('wsallowinstantvalidation', [e]) !== false){ if(timer){ clearTimeout(timer); } if(updateValidationEvents[e.type]){ if(e.type == 'refreshvalidityui'){ webshims.error('refreshvalidityui was renamed to updatevalidation'); } switchClass(); } else { $.data(elem, 'webshimsswitchvalidityclass', setTimeout(switchClass)); } } }; var eachReset = function(){ webshims.errorbox.reset(this); }; if('validityUIEvents' in options){ webshims.warn('validityUIEvents was renamed to iVal.events'); iVal.events = options.validityUIEvents; } if('events' in iVal){ iVal.events = iVal.events || ''; } else { iVal.events = 'focusout change'; } if(iVal.events){ iVal.events += ' '; } $(document.body || 'html') .on(iVal.events+'refreshvalidityui updatevalidation.webshims invalid', switchValidityClass) .on('reset resetvalidation.webshims resetvalui', function(e){ var noIValTrigger; var elems = $(e.target); if(e.type == 'resetvalui'){ webshims.warn('resetvalui was renamed to resetvalidation'); } if(elems.is('form, fieldset')){ if(elems[0].nodeName.toLowerCase() == 'form'){ noIValTrigger = !elems.is(iVal.sel); } elems = elems.jProp('elements'); } elems = elems .filter(iValClasses) .removeAttr('aria-invalid') .removeClass(iVal.errorClass +' '+ iVal.successClass) .getNativeElement() .each(function(){ $.removeData(this, 'webshimsinvalidcause'); }) ; if(!noIValTrigger){ if(noIValTrigger === false){ elems.each(eachReset); } else { elems.trigger('resetvalidityui.webshims'); } } }) ; var setRoot = function(){ webshims.scrollRoot = (isWebkit || document.compatMode == 'BackCompat') ? $(document.body) : $(document.documentElement) ; }; var minWidth = (Modernizr.boxSizing || Modernizr['display-table'] || $.support.getSetAttribute || $.support.boxSizing) ? 'minWidth' : 'width' ; var hasTransition = ('transitionDelay' in document.documentElement.style); var resetPos = {display: 'inline-block', left: 0, top: 0, marginTop: 0, marginLeft: 0, marginRight: 0, marginBottom: 0}; setRoot(); webshims.ready('DOM', setRoot); var rtlReg = /right|left/g; var rtlReplace = function(ret){ return ret == 'left' ? 'right' : 'left'; }; webshims.getRelOffset = function(posElem, relElem, opts){ var offset, bodyOffset, dirs; posElem = $(posElem); $.swap(posElem[0], resetPos, function(){ var isRtl; if($.position && opts && $.position.getScrollInfo){ if(!opts.of){ opts.of = relElem; } isRtl = $(opts.of).css('direction') == 'rtl'; if(!opts.isRtl){ opts.isRtl = false; } if(opts.isRtl != isRtl){ opts.my = (opts.my || 'center').replace(rtlReg, rtlReplace); opts.at = (opts.at || 'center').replace(rtlReg, rtlReplace); opts.isRtl = isRtl; } posElem[opts.isRtl ? 'addClass' : 'removeClass']('ws-is-rtl'); opts.using = function(calced, data){ posElem.attr({'data-horizontal': data.horizontal, 'data-vertical': data.vertical}); offset = calced; }; posElem.attr({ 'data-horizontal': '', 'data-vertical': '', 'data-my': opts.my, 'data-at': opts.at }); posElem.position(opts); } else { offset = $(relElem).offset(); bodyOffset = posElem.offset(); offset.top -= bodyOffset.top; offset.left -= bodyOffset.left; offset.top += relElem.outerHeight(); } }); return offset; }; $.extend(webshims.wsPopover, { isInElement: function(containers, contained){ if(!$.isArray(containers)){ containers = [containers]; } var i, len, container; var ret = false; for(i = 0, len = containers.length; i < len; i++){ container = containers[i]; if(container && container.jquery){ container = container[0]; } if(container && (container == contained || $.contains(container, contained))){ ret = true; break; } } return ret; }, show: function(element){ if(this.isVisible){return;} var e = $.Event('wspopoverbeforeshow'); this.element.trigger(e); if(e.isDefaultPrevented()){return;} this.isVisible = true; if(!this._shadowAdded && webshims.shadowClass){ this.element.addClass(webshims.shadowClass); this._shadowAdded = true; } element = $(element || this.options.prepareFor).getNativeElement() ; var that = this; var closeOnOutSide = function(e){ if(that.options.hideOnBlur && !that.stopBlur && !that.isInElement([that.lastElement[0], element[0], that.element[0]], e.target)){ that.hide(); } }; var visual = $(element).getShadowElement(); var delayedRepos = function(e){ clearTimeout(that.timers.repos); that.timers.repos = setTimeout(function(){ that.position(visual); }, e && e.type == 'pospopover' ? 4 : 200); }; this.clear(); this.element.removeClass('ws-po-visible').css('display', 'none'); this.prepareFor(element, visual); this.position(visual); that.timers.show = setTimeout(function(){ that.element.css('display', ''); that.timers.show = setTimeout(function(){ that.element.addClass('ws-po-visible').trigger('wspopovershow'); }, 14); }, 4); $(document.body) .on('focusin'+this.eventns+' mousedown'+this.eventns, closeOnOutSide) //http://www.quirksmode.org/m/tests/eventdelegation2.html .children(':not(script), :not(iframe), :not(noscript)') .on('mousedown'+this.eventns, closeOnOutSide) ; this.element.off('pospopover').on('pospopover', delayedRepos); $(window).on('resize'+this.eventns + ' pospopover'+this.eventns, delayedRepos); }, _getAutoAppendElement: (function(){ var invalidParent = /^(?:span|i|label|b|p|tr|thead|tbody|table|strong|em|ul|ol|dl|html)$/i; return function(element){ var appendElement; var parent = element[0]; var body = document.body; while((parent = parent[appendElement ? 'offsetParent' : 'parentNode']) && parent.nodeType == 1 && parent != body){ if(!appendElement && !invalidParent.test(parent.nodeName)){ appendElement = parent; } if(appendElement && $.css(parent, 'overflow') == 'hidden' && $.css(parent, 'position') != 'static'){ appendElement = false; } } return $(appendElement || body); }; })(), prepareFor: function(element, visual){ var onBlur, parentElem; var that = this; var css = {}; var opts = $.extend(true, {}, this.options, element.jProp('form').data('wspopover') || {}, element.data('wspopover')); this.lastOpts = opts; this.lastElement = $(element).getShadowFocusElement(); if(!this.prepared || !this.options.prepareFor){ if(opts.appendTo == 'element'){ parentElem = element.parent(); } else if(opts.appendTo == 'auto'){ parentElem = this._getAutoAppendElement(element); } else { parentElem = $(opts.appendTo); } if(!this.prepared || parentElem[0] != this.element[0].parentNode){ this.element.appendTo(parentElem); } } this.element.attr({ 'data-class': element.prop('className'), 'data-id': element.prop('id') }); css[minWidth] = opts.constrainWidth ? visual.outerWidth() : ''; this.element.css(css); if(opts.hideOnBlur){ onBlur = function(e){ if(that.stopBlur){ e.stopImmediatePropagation(); } else { that.hide(); } }; that.timers.bindBlur = setTimeout(function(){ that.lastElement.off(that.eventns).on('focusout'+that.eventns + ' blur'+that.eventns, onBlur); that.lastElement.getNativeElement().off(that.eventns); }, 10); } this.prepared = true; }, clear: function(){ $(window).off(this.eventns); $(document).off(this.eventns); $(document.body) .off(this.eventns) .children(':not(script), :not(iframe), :not(noscript)') .off(this.eventns) ; this.element.off('transitionend'+this.eventns); this.stopBlur = false; this.lastOpts = false; $.each(this.timers, function(timerName, val){ clearTimeout(val); }); }, hide: function(){ var e = $.Event('wspopoverbeforehide'); this.element.trigger(e); if(e.isDefaultPrevented() || !this.isVisible){return;} this.isVisible = false; var that = this; var forceHide = function(e){ if(!(e && e.type == 'transitionend' && (e = e.originalEvent) && e.target == that.element[0] && that.element.css('visibility') == 'hidden')){ that.element.off('transitionend'+that.eventns).css('display', 'none').attr({'data-id': '', 'data-class': '', 'hidden': 'hidden'}); clearTimeout(that.timers.forcehide); $(window).off('resize'+that.eventns); } }; this.clear(); this.element.removeClass('ws-po-visible').trigger('wspopoverhide'); $(window).on('resize'+this.eventns, forceHide); if(hasTransition){ this.element.off('transitionend'+this.eventns).on('transitionend'+this.eventns, forceHide); } that.timers.forcehide = setTimeout(forceHide, hasTransition ? 600 : 40); }, position: function(element){ var offset = webshims.getRelOffset(this.element.removeAttr('hidden'), element, (this.lastOpts || this.options).position); this.element.css(offset); } }); /* some extra validation UI */ webshims.validityAlert = (function(){ options.messagePopover.position = $.extend({}, { at: 'left bottom', my: 'left top', collision: 'none' }, options.messagePopover.position || {}); var api = webshims.objectCreate(webshims.wsPopover, undefined, options.messagePopover); var boundHide = api.hide.bind(api); api.element.addClass('validity-alert').attr({role: 'alert'}); $.extend(api, { hideDelay: 5000, showFor: function(elem, message, noFocusElem, noBubble){ elem = $(elem).getNativeElement(); this.clear(); this.hide(); if(!noBubble){ this.getMessage(elem, message); this.show(elem); if(this.hideDelay){ this.timers.delayedHide = setTimeout(boundHide, this.hideDelay); } } if(!noFocusElem){ this.setFocus(elem); } }, setFocus: function(element){ var focusElem = $(element).getShadowFocusElement(); var scrollTop = webshims.scrollRoot.scrollTop() + (options.viewportOffset || 0); var elemTop = focusElem.offset().top - (options.scrollOffset || 30); var focus = function(){ try { focusElem[0].focus(); } catch(e){} if(!focusElem[0].offsetWidth && !focusElem[0].offsetHeight){ webshims.warn('invalid element seems to be hidden. Make element either visible or use disabled/readonly to bar elements from validation. With fieldset[disabled] a group of elements can be ignored! In case of select replacement see shims/form-combat.js to fix issue.'); } api.element.triggerHandler('pospopover'); }; if(scrollTop > elemTop){ webshims.scrollRoot.animate( {scrollTop: elemTop - 5 - (options.viewportOffset || 0)}, { queue: false, duration: Math.max( Math.min( 600, (scrollTop - elemTop) * 1.5 ), 80 ), complete: focus } ); } else { focus(); } }, getMessage: function(elem, message){ if (!message) { message = elem.getErrorMessage(); } if (message) { api.contentElement.html(message); } else { this.hide(); } } }); return api; })(); var fx = { slide: { show: 'slideDown', hide: 'slideUp' }, fade: { show: 'fadeIn', hide: 'fadeOut' }, no: { show: 'show', hide: 'hide' } }; if(!iVal.fx || !fx[iVal.fx]){ iVal.fx = 'slide'; } if(!$.fn[fx[iVal.fx].show]){ iVal.fx = 'no'; } var errorBoxId = 0; webshims.errorbox = { create: function(elem, fieldWrapper){ if(!fieldWrapper){ fieldWrapper = this.getFieldWrapper(elem); } var errorBox = $('div.'+errorBoxClass, fieldWrapper); if(!errorBox.length){ errorBox = $('<div class="'+ errorBoxClass +'" hidden="hidden" style="display: none;">'); fieldWrapper.append(errorBox); } if(!errorBox.prop('id')){ errorBoxId++; errorBox.prop('id', 'errorbox-'+errorBoxId); } fieldWrapper.data('errorbox', errorBox); return errorBox; }, getFieldWrapper: function(elem){ var fieldWrapper; fieldWrapper = (typeof iVal.fieldWrapper == "function") ? iVal.fieldWrapper.apply(this, arguments) : $(elem).parent().closest(iVal.fieldWrapper); if(!fieldWrapper.length){ webshims.error("could not find fieldwrapper: "+ iVal.fieldWrapper); } return fieldWrapper; }, _createContentMessage: (function(){ var noValidate = function(){ return !noValidate.types[this.type]; }; noValidate.types = { hidden: 1, image: 1, button: 1, reset: 1, submit: 1 }; var fields = {}; var deCamelCase = function(c){ return '-'+(c).toLowerCase(); }; var getErrorName = function(elem){ var ret = $(elem).data('errortype'); if(!ret){ $.each(fields, function(errorName, cNames){ if($(elem).is(cNames)){ ret = errorName; return false; } }); } return ret || 'defaultMessage'; }; $.each(["customError","badInput","typeMismatch","rangeUnderflow","rangeOverflow","stepMismatch","tooLong","tooShort","patternMismatch","valueMissing"], function(i, name){ var cName = name.replace(/[A-Z]/, deCamelCase); fields[name] = '.'+cName+', .'+name+', .'+(name).toLowerCase()+', [data-errortype="'+ name +'"]'; }); return function(elem, errorBox, fieldWrapper){ var extended = false; var descriptiveMessages = {}; $(errorBox).children().each(function(){ var name = getErrorName(this); descriptiveMessages[name] = $(this).html(); }); $('input, select, textarea', fieldWrapper).filter(noValidate).each(function(i, elem){ var errorMessages = $(elem).data('errormessage') || {}; if(typeof errorMessages == 'string'){ errorMessages = {defaultMessage: errorMessages}; } $.each(descriptiveMessages, function(name, val){ if(!errorMessages[name]){ extended = true; errorMessages[name] = val; } }); if(extended){ $(elem).data('errormessage', errorMessages); } if(webshims.getOptions){ webshims.getOptions(elem, 'errormessage', false, true); } }); }; })(), initIvalContentMessage: function(elem){ if($(elem).jProp('form').is(iVal.sel)){ this.get(elem); } }, get: function(elem, fieldWrapper){ if(!fieldWrapper){ fieldWrapper = this.getFieldWrapper(elem); } var type; var errorBox = fieldWrapper.data('errorbox'); if((type = typeof errorBox) != 'object'){ if(!errorBox){ errorBox = this.create(elem, fieldWrapper); } else if(type == 'string'){ errorBox = $('#'+errorBox); fieldWrapper.data('errorbox', errorBox, fieldWrapper); } this._createContentMessage(elem, errorBox, fieldWrapper); } return errorBox; }, addSuccess: function(elem, fieldWrapper){ var type = $.prop(elem, 'type'); var check = function(){ var hasVal = checkTypes[type] ? $.prop(elem, 'checked') : $(elem).val(); fieldWrapper[hasVal ? 'addClass' : 'removeClass'](successWrapperClass); }; var evt = changeTypes[type] ? 'change' : 'blur'; $(elem).off('.recheckvalid').on(evt+'.recheckinvalid', check); check(); }, hideError: function(elem, reset){ var invalid, errorBox, afterHide; var fieldWrapper = this.getFieldWrapper(elem); if(fieldWrapper.hasClass(invalidWrapperClass)){ $(elem).filter('input').off('.recheckinvalid'); if(!reset && (invalid = $('input:invalid, select:invalid, textarea:invalid', fieldWrapper)[0])){ $(invalid).trigger('updatevalidation.webshims'); } else { errorBox = this.get(elem, fieldWrapper); fieldWrapper.removeClass(invalidWrapperClass); errorBox.message = ''; afterHide = function(){ if(this.id == elem.getAttribute('aria-describedby')){ elem.removeAttribute('aria-describedby'); } $(this).attr({hidden: 'hidden'}); }; if(iVal.fx != 'no'){ errorBox[fx[iVal.fx].hide](afterHide); } else { errorBox[fx[iVal.fx].hide]().each(afterHide); } } } if(!reset && !invalid){ this.addSuccess(elem, fieldWrapper); } return fieldWrapper; }, recheckInvalidInput: function(input){ if(iVal.recheckDelay && iVal.recheckDelay > 90){ var timer; var throttle = function(){ switchValidityClass({type: 'input', target: input}); }; $(input) .filter('input:not([type="checkbox"]):not([type="radio"])') .off('.recheckinvalid') .on('input.recheckinvalid', function(){ clearTimeout(timer); timer = setTimeout(throttle, iVal.recheckDelay); }) .on('focusout.recheckinvalid', function(){ clearTimeout(timer); }) ; } }, showError: function(elem){ var fieldWrapper = this.getFieldWrapper(elem); var box = this.get(elem, fieldWrapper); var message = $(elem).getErrorMessage(); if(box.message != message){ if(box.stop){ box.stop(true, true); } box.html('<p class="'+ errorMessageClass +'">'+ message +'</p>'); box.message = message; fieldWrapper.addClass(invalidWrapperClass).removeClass(successWrapperClass); this.recheckInvalidInput(elem); if(box.is('[hidden]') || box.css('display') == 'none'){ if(!elem.getAttribute('aria-describedby')){ elem.setAttribute('aria-describedby', box.prop('id')); } box .css({display: 'none'}) .removeAttr('hidden') [fx[iVal.fx].show]() ; } } fieldWrapper.removeClass(successWrapperClass); $(elem).off('.recheckvalid'); return fieldWrapper; }, reset: function(elem){ this.hideError(elem, true).removeClass(successWrapperClass); }, toggle: function(elem){ if($(elem).is(':invalid')){ this.showError(elem); } else { this.hideError(elem); } } }; $(document.body) .on({ 'changedvaliditystate': function(e){ if(iVal.sel){ var form = $(e.target).jProp('form'); if(form.is(iVal.sel)){ webshims.errorbox.toggle(e.target); } } }, 'resetvalidityui.webshims': function(e){ if (iVal.sel) { var form = $(e.target).jProp('form'); if (form.is(iVal.sel)) { webshims.errorbox.reset(e.target); } } }, firstinvalid: function(e){ if(iVal.sel && iVal.handleBubble){ var form = $(e.target).jProp('form'); if(form.is(iVal.sel)){ e.preventDefault(); if(iVal.handleBubble != 'none'){ webshims.validityAlert.showFor( e.target, false, false, iVal.handleBubble == 'hide' ); } } } }, submit: function(e){ if(iVal.sel && iVal.submitCheck && $(e.target).is(iVal.sel) && $.prop(e.target, 'noValidate') && !$(e.target).checkValidity()){ e.stopImmediatePropagation(); return false; } } }) ; webshims.modules["form-core"].getGroupElements = getGroupElements; if(/[\s\:\>\~\+]/.test(iVal.sel || '')){ webshims.error('please use a simple selector for iVal.sel: for example .validate'); } if(options.replaceValidationUI){ $(document).on('firstinvalid', function(e){ if(!e.isDefaultPrevented()){ e.preventDefault(); setTimeout(function(){ webshims.validityAlert.showFor( e.target ); }, 4); } }); } /* extension, but also used to fix native implementation workaround/bugfixes */ (function(){ var firstEvent, invalids = [], stopSubmitTimer, stop ; $(document).on('invalid', function(e){ if(e.wrongWebkitInvalid || stop){return;} var jElm = $(e.target); if(!firstEvent){ //trigger firstinvalid firstEvent = $.Event('firstinvalid'); jElm.addClass('first-invalid').trigger(firstEvent); } //if firstinvalid was prevented all invalids will be also prevented if( firstEvent && firstEvent.isDefaultPrevented() ){ e.preventDefault(); } invalids.push(e.target); e.extraData = 'fix'; clearTimeout(stopSubmitTimer); stopSubmitTimer = setTimeout(function(){ var lastEvent = {type: 'lastinvalid', cancelable: false, invalidlist: $(invalids)}; //reset firstinvalid invalids = []; stop = true; $(e.target).trigger(lastEvent, [lastEvent]); $(firstEvent.target).removeClass('first-invalid'); firstEvent = false; /* if(hasNative && !$.nodeName(e.target, 'form')){ $(e.target).jProp('form').triggerHandler('invalid'); } */ stop = false; }, 9); jElm = null; }); })(); if(!options.noInputmodeFix && document.addEventListener && Modernizr.inputtypes && Modernizr.inputtypes.tel && ua.indexOf('Mobile') != -1 && !('inputMode' in document.createElement('input') && !('inputmode' in document.createElement('input'))) ){ var removeListener = function(elem){ elem.removeEventListener('blur', switchBack, true); }; var needsPattern = (/iphone|ipod/i).test(ua); var regPattern = /^[\\d\*|\[0\-9\]]*[\+|\{\d*\,\d*\}|*]*$/; var stopPatterns = needsPattern || (/ipad|ios/i).test(ua) ? { '[0-9]*': 1, '\\d*': 1 } : false ; var switchBack = function(e){ removeListener(e.target); e.target.type = 'text'; }; var removeDocListener = function(){ document.removeEventListener('focus', addFix, true); document.removeEventListener('touchstart', addFix, true); }; var allowSwitchByPattern = function(elem){ var pattern; var switchAllowed = true; if(stopPatterns){ pattern = elem.getAttribute('pattern') || ''; if(stopPatterns[pattern] || (needsPattern && (!pattern || !regPattern.test(pattern)))){ switchAllowed = false; } } return switchAllowed; }; var addFix = function(e){ if(e.target.type == 'text' && e.target.getAttribute('inputmode') == 'numeric' && allowSwitchByPattern(e.target)){ try{ removeListener(e.target); e.target.addEventListener('blur', switchBack, true); e.target.type = 'tel'; } catch (er){ removeDocListener(); } } }; document.addEventListener('focus', addFix, true); document.addEventListener('touchstart', addFix, true); } function getFileNames(file){ return file.name; } function customFile(){ if($.data(this, 'wsCustomFile')){return;} var map = Array.prototype.map; var $module = $(this); var $file = $('input[type="file"]', $module); var $valueDisplay = $('.ws-file-value', $module); var emptyHtml = $.trim($valueDisplay.html()) || '&#160;'; var showSelected = function(){ var files = $file.prop('files') || []; var names = map.call(files, getFileNames).join(', ') || $file.val(); if(names){ $valueDisplay.text(names); } else { $valueDisplay.html(emptyHtml); } }; $.data(this, 'wsCustomFile', {showSelected: showSelected}); $('button', $module).attr('tabindex', '-1'); $file.on('change.webshim', showSelected).each(showSelected); $file.jProp('form').on('reset', function(){ setTimeout(showSelected); }); } webshims.addReady(function(context, contextElem){ $(context.querySelectorAll('.ws-custom-file')).add($(contextElem).filter('.ws-custom-file')).each(customFile); }); addModule('form-fixrangechange', { test: !(!$.event.special.change && !$.event.special.input && Modernizr.inputtypes && Modernizr.inputtypes.range && options.fixRangeChange) }); addModule('form-combat', { d: ['dom-support'], test: !(($.mobile && ($.mobile.selectmenu || $.mobile.checkboxradio)) || ($.ui && $.ui.selectmenu) || $.fn.select2 || $.fn.chosen || $.fn.selectpicker || $.fn.selectBoxIt) }); addModule('position', { src: 'plugins/jquery.ui.position.js', test: !!($.position && $.position.getScrollInfo) }); loader.loadList(['form-combat', 'position', 'form-fixrangechange']); });
boneskull/cdnjs
ajax/libs/webshim/1.14.1/dev/shims/form-validation.js
JavaScript
mit
29,286
// Underscore.js 1.1.6 // (c) 2011 Jeremy Ashkenas, DocumentCloud Inc. // Underscore is freely distributable under the MIT license. // Portions of Underscore are inspired or borrowed from Prototype, // Oliver Steele's Functional, and John Resig's Micro-Templating. // For all details and documentation: // http://documentcloud.github.com/underscore (function(){var p=this,C=p._,m={},i=Array.prototype,n=Object.prototype,f=i.slice,D=i.unshift,E=n.toString,l=n.hasOwnProperty,s=i.forEach,t=i.map,u=i.reduce,v=i.reduceRight,w=i.filter,x=i.every,y=i.some,o=i.indexOf,z=i.lastIndexOf;n=Array.isArray;var F=Object.keys,q=Function.prototype.bind,b=function(a){return new j(a)};typeof module!=="undefined"&&module.exports?(module.exports=b,b._=b):p._=b;b.VERSION="1.1.6";var h=b.each=b.forEach=function(a,c,d){if(a!=null)if(s&&a.forEach===s)a.forEach(c,d);else if(b.isNumber(a.length))for(var e= 0,k=a.length;e<k;e++){if(c.call(d,a[e],e,a)===m)break}else for(e in a)if(l.call(a,e)&&c.call(d,a[e],e,a)===m)break};b.map=function(a,c,b){var e=[];if(a==null)return e;if(t&&a.map===t)return a.map(c,b);h(a,function(a,g,G){e[e.length]=c.call(b,a,g,G)});return e};b.reduce=b.foldl=b.inject=function(a,c,d,e){var k=d!==void 0;a==null&&(a=[]);if(u&&a.reduce===u)return e&&(c=b.bind(c,e)),k?a.reduce(c,d):a.reduce(c);h(a,function(a,b,f){!k&&b===0?(d=a,k=!0):d=c.call(e,d,a,b,f)});if(!k)throw new TypeError("Reduce of empty array with no initial value"); return d};b.reduceRight=b.foldr=function(a,c,d,e){a==null&&(a=[]);if(v&&a.reduceRight===v)return e&&(c=b.bind(c,e)),d!==void 0?a.reduceRight(c,d):a.reduceRight(c);a=(b.isArray(a)?a.slice():b.toArray(a)).reverse();return b.reduce(a,c,d,e)};b.find=b.detect=function(a,c,b){var e;A(a,function(a,g,f){if(c.call(b,a,g,f))return e=a,!0});return e};b.filter=b.select=function(a,c,b){var e=[];if(a==null)return e;if(w&&a.filter===w)return a.filter(c,b);h(a,function(a,g,f){c.call(b,a,g,f)&&(e[e.length]=a)});return e}; b.reject=function(a,c,b){var e=[];if(a==null)return e;h(a,function(a,g,f){c.call(b,a,g,f)||(e[e.length]=a)});return e};b.every=b.all=function(a,c,b){var e=!0;if(a==null)return e;if(x&&a.every===x)return a.every(c,b);h(a,function(a,g,f){if(!(e=e&&c.call(b,a,g,f)))return m});return e};var A=b.some=b.any=function(a,c,d){c||(c=b.identity);var e=!1;if(a==null)return e;if(y&&a.some===y)return a.some(c,d);h(a,function(a,b,f){if(e=c.call(d,a,b,f))return m});return e};b.include=b.contains=function(a,c){var b= !1;if(a==null)return b;if(o&&a.indexOf===o)return a.indexOf(c)!=-1;A(a,function(a){if(b=a===c)return!0});return b};b.invoke=function(a,c){var d=f.call(arguments,2);return b.map(a,function(a){return(c.call?c||a:a[c]).apply(a,d)})};b.pluck=function(a,c){return b.map(a,function(a){return a[c]})};b.max=function(a,c,d){if(!c&&b.isArray(a))return Math.max.apply(Math,a);var e={computed:-Infinity};h(a,function(a,b,f){b=c?c.call(d,a,b,f):a;b>=e.computed&&(e={value:a,computed:b})});return e.value};b.min=function(a, c,d){if(!c&&b.isArray(a))return Math.min.apply(Math,a);var e={computed:Infinity};h(a,function(a,b,f){b=c?c.call(d,a,b,f):a;b<e.computed&&(e={value:a,computed:b})});return e.value};b.sortBy=function(a,c,d){return b.pluck(b.map(a,function(a,b,f){return{value:a,criteria:c.call(d,a,b,f)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;return c<d?-1:c>d?1:0}),"value")};b.sortedIndex=function(a,c,d){d||(d=b.identity);for(var e=0,f=a.length;e<f;){var g=e+f>>1;d(a[g])<d(c)?e=g+1:f=g}return e};b.toArray= function(a){if(!a)return[];if(a.toArray)return a.toArray();if(b.isArray(a))return a;if(b.isArguments(a))return f.call(a);return b.values(a)};b.size=function(a){return b.toArray(a).length};b.first=b.head=function(a,b,d){return b!=null&&!d?f.call(a,0,b):a[0]};b.rest=b.tail=function(a,b,d){return f.call(a,b==null||d?1:b)};b.last=function(a){return a[a.length-1]};b.compact=function(a){return b.filter(a,function(a){return!!a})};b.flatten=function(a){return b.reduce(a,function(a,d){if(b.isArray(d))return a.concat(b.flatten(d)); a[a.length]=d;return a},[])};b.without=function(a){var c=f.call(arguments,1);return b.filter(a,function(a){return!b.include(c,a)})};b.uniq=b.unique=function(a,c){return b.reduce(a,function(a,e,f){if(0==f||(c===!0?b.last(a)!=e:!b.include(a,e)))a[a.length]=e;return a},[])};b.intersect=function(a){var c=f.call(arguments,1);return b.filter(b.uniq(a),function(a){return b.every(c,function(c){return b.indexOf(c,a)>=0})})};b.zip=function(){for(var a=f.call(arguments),c=b.max(b.pluck(a,"length")),d=Array(c), e=0;e<c;e++)d[e]=b.pluck(a,""+e);return d};b.indexOf=function(a,c,d){if(a==null)return-1;var e;if(d)return d=b.sortedIndex(a,c),a[d]===c?d:-1;if(o&&a.indexOf===o)return a.indexOf(c);d=0;for(e=a.length;d<e;d++)if(a[d]===c)return d;return-1};b.lastIndexOf=function(a,b){if(a==null)return-1;if(z&&a.lastIndexOf===z)return a.lastIndexOf(b);for(var d=a.length;d--;)if(a[d]===b)return d;return-1};b.range=function(a,b,d){arguments.length<=1&&(b=a||0,a=0);d=arguments[2]||1;for(var e=Math.max(Math.ceil((b-a)/ d),0),f=0,g=Array(e);f<e;)g[f++]=a,a+=d;return g};b.bind=function(a,b){if(a.bind===q&&q)return q.apply(a,f.call(arguments,1));var d=f.call(arguments,2);return function(){return a.apply(b,d.concat(f.call(arguments)))}};b.bindAll=function(a){var c=f.call(arguments,1);c.length==0&&(c=b.functions(a));h(c,function(c){a[c]=b.bind(a[c],a)});return a};b.memoize=function(a,c){var d={};c||(c=b.identity);return function(){var b=c.apply(this,arguments);return l.call(d,b)?d[b]:d[b]=a.apply(this,arguments)}};b.delay= function(a,b){var d=f.call(arguments,2);return setTimeout(function(){return a.apply(a,d)},b)};b.defer=function(a){return b.delay.apply(b,[a,1].concat(f.call(arguments,1)))};var B=function(a,b,d){var e;return function(){var f=this,g=arguments,h=function(){e=null;a.apply(f,g)};d&&clearTimeout(e);if(d||!e)e=setTimeout(h,b)}};b.throttle=function(a,b){return B(a,b,!1)};b.debounce=function(a,b){return B(a,b,!0)};b.once=function(a){var b=!1,d;return function(){if(b)return d;b=!0;return d=a.apply(this,arguments)}}; b.wrap=function(a,b){return function(){var d=[a].concat(f.call(arguments));return b.apply(this,d)}};b.compose=function(){var a=f.call(arguments);return function(){for(var b=f.call(arguments),d=a.length-1;d>=0;d--)b=[a[d].apply(this,b)];return b[0]}};b.after=function(a,b){return function(){if(--a<1)return b.apply(this,arguments)}};b.keys=F||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var b=[],d;for(d in a)l.call(a,d)&&(b[b.length]=d);return b};b.values=function(a){return b.map(a, b.identity)};b.functions=b.methods=function(a){return b.filter(b.keys(a),function(c){return b.isFunction(a[c])}).sort()};b.extend=function(a){h(f.call(arguments,1),function(b){for(var d in b)b[d]!==void 0&&(a[d]=b[d])});return a};b.defaults=function(a){h(f.call(arguments,1),function(b){for(var d in b)a[d]==null&&(a[d]=b[d])});return a};b.clone=function(a){return b.isArray(a)?a.slice():b.extend({},a)};b.tap=function(a,b){b(a);return a};b.isEqual=function(a,c){if(a===c)return!0;var d=typeof a;if(d!= typeof c)return!1;if(a==c)return!0;if(!a&&c||a&&!c)return!1;if(a._chain)a=a._wrapped;if(c._chain)c=c._wrapped;if(a.isEqual)return a.isEqual(c);if(b.isDate(a)&&b.isDate(c))return a.getTime()===c.getTime();if(b.isNaN(a)&&b.isNaN(c))return!1;if(b.isRegExp(a)&&b.isRegExp(c))return a.source===c.source&&a.global===c.global&&a.ignoreCase===c.ignoreCase&&a.multiline===c.multiline;if(d!=="object")return!1;if(a.length&&a.length!==c.length)return!1;d=b.keys(a);var e=b.keys(c);if(d.length!=e.length)return!1; for(var f in a)if(!(f in c)||!b.isEqual(a[f],c[f]))return!1;return!0};b.isEmpty=function(a){if(b.isArray(a)||b.isString(a))return a.length===0;for(var c in a)if(l.call(a,c))return!1;return!0};b.isElement=function(a){return!!(a&&a.nodeType==1)};b.isArray=n||function(a){return E.call(a)==="[object Array]"};b.isArguments=function(a){return!(!a||!l.call(a,"callee"))};b.isFunction=function(a){return!(!a||!a.constructor||!a.call||!a.apply)};b.isString=function(a){return!!(a===""||a&&a.charCodeAt&&a.substr)}; b.isNumber=function(a){return!!(a===0||a&&a.toExponential&&a.toFixed)};b.isNaN=function(a){return a!==a};b.isBoolean=function(a){return a===!0||a===!1};b.isDate=function(a){return!(!a||!a.getTimezoneOffset||!a.setUTCFullYear)};b.isRegExp=function(a){return!(!a||!a.test||!a.exec||!(a.ignoreCase||a.ignoreCase===!1))};b.isNull=function(a){return a===null};b.isUndefined=function(a){return a===void 0};b.noConflict=function(){p._=C;return this};b.identity=function(a){return a};b.times=function(a,b,d){for(var e= 0;e<a;e++)b.call(d,e)};b.mixin=function(a){h(b.functions(a),function(c){H(c,b[c]=a[c])})};var I=0;b.uniqueId=function(a){var b=I++;return a?a+b:b};b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g};b.template=function(a,c){var d=b.templateSettings;d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(d.interpolate,function(a,b){return"',"+b.replace(/\\'/g,"'")+",'"}).replace(d.evaluate|| null,function(a,b){return"');"+b.replace(/\\'/g,"'").replace(/[\r\n\t]/g," ")+"__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');";d=new Function("obj",d);return c?d(c):d};var j=function(a){this._wrapped=a};b.prototype=j.prototype;var r=function(a,c){return c?b(a).chain():a},H=function(a,c){j.prototype[a]=function(){var a=f.call(arguments);D.call(a,this._wrapped);return r(c.apply(b,a),this._chain)}};b.mixin(b);h(["pop","push","reverse","shift","sort", "splice","unshift"],function(a){var b=i[a];j.prototype[a]=function(){b.apply(this._wrapped,arguments);return r(this._wrapped,this._chain)}});h(["concat","join","slice"],function(a){var b=i[a];j.prototype[a]=function(){return r(b.apply(this._wrapped,arguments),this._chain)}});j.prototype.chain=function(){this._chain=!0;return this};j.prototype.value=function(){return this._wrapped}})();
calvinf/cdnjs
ajax/libs/underscore.js/1.1.6/underscore-min.js
JavaScript
mit
9,960
.skin-yellow .main-header .navbar{background-color:#f39c12}.skin-yellow .main-header .navbar .nav>li>a{color:#fff}.skin-yellow .main-header .navbar .nav>li>a:hover,.skin-yellow .main-header .navbar .nav>li>a:active,.skin-yellow .main-header .navbar .nav>li>a:focus,.skin-yellow .main-header .navbar .nav .open>a,.skin-yellow .main-header .navbar .nav .open>a:hover,.skin-yellow .main-header .navbar .nav .open>a:focus,.skin-yellow .main-header .navbar .nav>.active>a{background:rgba(0,0,0,0.1);color:#f6f6f6}.skin-yellow .main-header .navbar .sidebar-toggle{color:#fff}.skin-yellow .main-header .navbar .sidebar-toggle:hover{color:#f6f6f6;background:rgba(0,0,0,0.1)}.skin-yellow .main-header .navbar .sidebar-toggle{color:#fff}.skin-yellow .main-header .navbar .sidebar-toggle:hover{background-color:#e08e0b}@media (max-width:767px){.skin-yellow .main-header .navbar .dropdown-menu li.divider{background-color:rgba(255,255,255,0.1)}.skin-yellow .main-header .navbar .dropdown-menu li a{color:#fff}.skin-yellow .main-header .navbar .dropdown-menu li a:hover{background:#e08e0b}}.skin-yellow .main-header .logo{background-color:#e08e0b;color:#fff;border-bottom:0 solid transparent}.skin-yellow .main-header .logo:hover{background-color:#db8b0b}.skin-yellow .main-header li.user-header{background-color:#f39c12}.skin-yellow .content-header{background:transparent}.skin-yellow .wrapper,.skin-yellow .main-sidebar,.skin-yellow .left-side{background-color:#222d32}.skin-yellow .user-panel>.info,.skin-yellow .user-panel>.info>a{color:#fff}.skin-yellow .sidebar-menu>li.header{color:#4b646f;background:#1a2226}.skin-yellow .sidebar-menu>li>a{border-left:3px solid transparent}.skin-yellow .sidebar-menu>li:hover>a,.skin-yellow .sidebar-menu>li.active>a{color:#fff;background:#1e282c;border-left-color:#f39c12}.skin-yellow .sidebar-menu>li>.treeview-menu{margin:0 1px;background:#2c3b41}.skin-yellow .sidebar a{color:#b8c7ce}.skin-yellow .sidebar a:hover{text-decoration:none}.skin-yellow .treeview-menu>li>a{color:#8aa4af}.skin-yellow .treeview-menu>li.active>a,.skin-yellow .treeview-menu>li>a:hover{color:#fff}.skin-yellow .sidebar-form{border-radius:3px;border:1px solid #374850;margin:10px 10px}.skin-yellow .sidebar-form input[type="text"],.skin-yellow .sidebar-form .btn{box-shadow:none;background-color:#374850;border:1px solid transparent;height:35px;-webkit-transition:all .3s ease-in-out;-o-transition:all .3s ease-in-out;transition:all .3s ease-in-out}.skin-yellow .sidebar-form input[type="text"]{color:#666;border-top-left-radius:2px;border-top-right-radius:0;border-bottom-right-radius:0;border-bottom-left-radius:2px}.skin-yellow .sidebar-form input[type="text"]:focus,.skin-yellow .sidebar-form input[type="text"]:focus+.input-group-btn .btn{background-color:#fff;color:#666}.skin-yellow .sidebar-form input[type="text"]:focus+.input-group-btn .btn{border-left-color:#fff}.skin-yellow .sidebar-form .btn{color:#999;border-top-left-radius:0;border-top-right-radius:2px;border-bottom-right-radius:2px;border-bottom-left-radius:0}
mike2c/scse
dist/css/skins/skin-yellow.min.css
CSS
mit
3,036
var tap = require("tap") var normalize = require("../lib/normalize") var path = require("path") var fs = require("fs") var _ = require("underscore") var async = require("async") var data, clonedData var warn tap.test("consistent normalization", function(t) { path.resolve(__dirname, "./fixtures/read-package-json.json") fs.readdir (__dirname + "/fixtures", function (err, entries) { // entries = ['coffee-script.json'] // uncomment to limit to a specific file verifyConsistency = function(entryName, next) { warn = function(msg) { // t.equal("",msg) // uncomment to have some kind of logging of warnings } filename = __dirname + "/fixtures/" + entryName fs.readFile(filename, function(err, contents) { if (err) return next(err) data = JSON.parse(contents.toString()) normalize(data, warn) clonedData = _.clone(data) normalize(data, warn) t.deepEqual(clonedData, data, "Normalization of " + entryName + " is consistent.") next(null) }) // fs.readFile } // verifyConsistency async.forEach(entries, verifyConsistency, function(err) { if (err) throw err t.end() }) }) // fs.readdir }) // tap.test
sandermarin/ChristmasCard
node_modules/gulp-imagemin/node_modules/imagemin/node_modules/imagemin-gifsicle/node_modules/gifsicle/node_modules/bin-wrapper/node_modules/bin-check/node_modules/executable/node_modules/meow/node_modules/normalize-package-data/test/consistency.js
JavaScript
mit
1,237
var tap = require("tap") var normalize = require("../lib/normalize") var path = require("path") var fs = require("fs") var _ = require("underscore") var async = require("async") var data, clonedData var warn tap.test("consistent normalization", function(t) { path.resolve(__dirname, "./fixtures/read-package-json.json") fs.readdir (__dirname + "/fixtures", function (err, entries) { // entries = ['coffee-script.json'] // uncomment to limit to a specific file verifyConsistency = function(entryName, next) { warn = function(msg) { // t.equal("",msg) // uncomment to have some kind of logging of warnings } filename = __dirname + "/fixtures/" + entryName fs.readFile(filename, function(err, contents) { if (err) return next(err) data = JSON.parse(contents.toString()) normalize(data, warn) clonedData = _.clone(data) normalize(data, warn) t.deepEqual(clonedData, data, "Normalization of " + entryName + " is consistent.") next(null) }) // fs.readFile } // verifyConsistency async.forEach(entries, verifyConsistency, function(err) { if (err) throw err t.end() }) }) // fs.readdir }) // tap.test
uroy9ch/portfolio
node_modules/time-grunt/node_modules/pretty-ms/node_modules/meow/node_modules/normalize-package-data/test/consistency.js
JavaScript
mit
1,237
/* Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com> Copyright (C) 2012 Joost-Wim Boekesteijn <joost-wim@boekesteijn.nl> Copyright (C) 2012 Yusuke Suzuki <utatane.tea@gmail.com> Copyright (C) 2012 Arpad Borsos <arpad.borsos@googlemail.com> Copyright (C) 2011 Ariya Hidayat <ariya.hidayat@gmail.com> Copyright (C) 2011 Yusuke Suzuki <utatane.tea@gmail.com> Copyright (C) 2011 Arpad Borsos <arpad.borsos@googlemail.com> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /*jslint browser:true node:true */ /*global esprima:true, testFixture:true */ var runTests; // Special handling for regular expression literal since we need to // convert it to a string literal, otherwise it will be decoded // as object "{}" and the regular expression would be lost. function adjustRegexLiteral(key, value) { 'use strict'; if (key === 'value' && value instanceof RegExp) { value = value.toString(); } return value; } function NotMatchingError(expected, actual) { 'use strict'; Error.call(this, 'Expected '); this.expected = expected; this.actual = actual; } NotMatchingError.prototype = new Error(); function errorToObject(e) { 'use strict'; var msg = e.toString(); // Opera 9.64 produces an non-standard string in toString(). if (msg.substr(0, 6) !== 'Error:') { if (typeof e.message === 'string') { msg = 'Error: ' + e.message; } } return { index: e.index, lineNumber: e.lineNumber, column: e.column, message: msg }; } function testParse(esprima, code, syntax) { 'use strict'; var expected, tree, actual, options, StringObject, i, len, err; // alias, so that JSLint does not complain. StringObject = String; options = { comment: (typeof syntax.comments !== 'undefined'), range: true, loc: true, tokens: (typeof syntax.tokens !== 'undefined'), raw: true, tolerant: (typeof syntax.errors !== 'undefined') }; if (typeof syntax.tokens !== 'undefined') { if (syntax.tokens.length > 0) { options.range = (typeof syntax.tokens[0].range !== 'undefined'); options.loc = (typeof syntax.tokens[0].loc !== 'undefined'); } } if (typeof syntax.comments !== 'undefined') { if (syntax.comments.length > 0) { options.range = (typeof syntax.comments[0].range !== 'undefined'); options.loc = (typeof syntax.comments[0].loc !== 'undefined'); } } expected = JSON.stringify(syntax, null, 4); try { tree = esprima.parse(code, options); tree = (options.comment || options.tokens || options.tolerant) ? tree : tree.body[0]; if (options.tolerant) { for (i = 0, len = tree.errors.length; i < len; i += 1) { tree.errors[i] = errorToObject(tree.errors[i]); } } actual = JSON.stringify(tree, adjustRegexLiteral, 4); // Only to ensure that there is no error when using string object. esprima.parse(new StringObject(code), options); } catch (e) { throw new NotMatchingError(expected, e.toString()); } if (expected !== actual) { throw new NotMatchingError(expected, actual); } function filter(key, value) { if (key === 'value' && value instanceof RegExp) { value = value.toString(); } return (key === 'loc' || key === 'range') ? undefined : value; } if (options.tolerant) { return; } // Check again without any location info. options.range = false; options.loc = false; expected = JSON.stringify(syntax, filter, 4); try { tree = esprima.parse(code, options); tree = (options.comment || options.tokens) ? tree : tree.body[0]; if (options.tolerant) { for (i = 0, len = tree.errors.length; i < len; i += 1) { tree.errors[i] = errorToObject(tree.errors[i]); } } actual = JSON.stringify(tree, filter, 4); } catch (e) { throw new NotMatchingError(expected, e.toString()); } if (expected !== actual) { throw new NotMatchingError(expected, actual); } } function testError(esprima, code, exception) { 'use strict'; var i, options, expected, actual, handleInvalidRegexFlag; // Different parsing options should give the same error. options = [ {}, { comment: true }, { raw: true }, { raw: true, comment: true } ]; // If handleInvalidRegexFlag is true, an invalid flag in a regular expression // will throw an exception. In some old version V8, this is not the case // and hence handleInvalidRegexFlag is false. handleInvalidRegexFlag = false; try { 'test'.match(new RegExp('[a-z]', 'x')); } catch (e) { handleInvalidRegexFlag = true; } expected = JSON.stringify(exception); for (i = 0; i < options.length; i += 1) { try { esprima.parse(code, options[i]); } catch (e) { actual = JSON.stringify(errorToObject(e)); } if (expected !== actual) { // Compensate for old V8 which does not handle invalid flag. if (exception.message.indexOf('Invalid regular expression') > 0) { if (typeof actual === 'undefined' && !handleInvalidRegexFlag) { return; } } throw new NotMatchingError(expected, actual); } } } function testAPI(esprima, code, result) { 'use strict'; var expected, res, actual; expected = JSON.stringify(result.result, null, 4); try { if (typeof result.property !== 'undefined') { res = esprima[result.property]; } else { res = esprima[result.call].apply(esprima, result.args); } actual = JSON.stringify(res, adjustRegexLiteral, 4); } catch (e) { throw new NotMatchingError(expected, e.toString()); } if (expected !== actual) { throw new NotMatchingError(expected, actual); } } function runTest(esprima, code, result) { 'use strict'; if (result.hasOwnProperty('lineNumber')) { testError(esprima, code, result); } else if (result.hasOwnProperty('result')) { testAPI(esprima, code, result); } else { testParse(esprima, code, result); } } if (typeof window !== 'undefined') { // Run all tests in a browser environment. runTests = function () { 'use strict'; var total = 0, failures = 0, category, fixture, source, tick, expected, index, len; function setText(el, str) { if (typeof el.innerText === 'string') { el.innerText = str; } else { el.textContent = str; } } function startCategory(category) { var report, e; report = document.getElementById('report'); e = document.createElement('h4'); setText(e, category); report.appendChild(e); } function reportSuccess(code) { var report, e; report = document.getElementById('report'); e = document.createElement('pre'); e.setAttribute('class', 'code'); setText(e, code); report.appendChild(e); } function reportFailure(code, expected, actual) { var report, e; report = document.getElementById('report'); e = document.createElement('p'); setText(e, 'Code:'); report.appendChild(e); e = document.createElement('pre'); e.setAttribute('class', 'code'); setText(e, code); report.appendChild(e); e = document.createElement('p'); setText(e, 'Expected'); report.appendChild(e); e = document.createElement('pre'); e.setAttribute('class', 'expected'); setText(e, expected); report.appendChild(e); e = document.createElement('p'); setText(e, 'Actual'); report.appendChild(e); e = document.createElement('pre'); e.setAttribute('class', 'actual'); setText(e, actual); report.appendChild(e); } setText(document.getElementById('version'), esprima.version); tick = new Date(); for (category in testFixture) { if (testFixture.hasOwnProperty(category)) { startCategory(category); fixture = testFixture[category]; for (source in fixture) { if (fixture.hasOwnProperty(source)) { expected = fixture[source]; total += 1; try { runTest(esprima, source, expected); reportSuccess(source, JSON.stringify(expected, null, 4)); } catch (e) { failures += 1; reportFailure(source, e.expected, e.actual); } } } } } tick = (new Date()) - tick; if (failures > 0) { setText(document.getElementById('status'), total + ' tests. ' + 'Failures: ' + failures + '. ' + tick + ' ms'); } else { setText(document.getElementById('status'), total + ' tests. ' + 'No failure. ' + tick + ' ms'); } }; } else { (function () { 'use strict'; var esprima = require('../esprima'), vm = require('vm'), fs = require('fs'), total = 0, failures = [], tick = new Date(), expected, header; vm.runInThisContext(fs.readFileSync(__dirname + '/test.js', 'utf-8')); Object.keys(testFixture).forEach(function (category) { Object.keys(testFixture[category]).forEach(function (source) { total += 1; expected = testFixture[category][source]; try { runTest(esprima, source, expected); } catch (e) { e.source = source; failures.push(e); } }); }); tick = (new Date()) - tick; header = total + ' tests. ' + failures.length + ' failures. ' + tick + ' ms'; if (failures.length) { console.error(header); failures.forEach(function (failure) { console.error(failure.source + ': Expected\n ' + failure.expected.split('\n').join('\n ') + '\nto match\n ' + failure.actual); }); } else { console.log(header); } process.exit(failures.length === 0 ? 0 : 1); }()); }
deepak2510/pearson
node_modules/grunt/node_modules/js-yaml/node_modules/esprima/test/runner.js
JavaScript
mit
12,424
// Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. // a duplex stream is just a stream that is both readable and writable. // Since JS doesn't have multiple prototypal inheritance, this class // prototypally inherits from Readable, and then parasitically from // Writable. module.exports = Duplex; /*<replacement>*/ var objectKeys = Object.keys || function (obj) { var keys = []; for (var key in obj) keys.push(key); return keys; } /*</replacement>*/ /*<replacement>*/ var util = require('core-util-is'); util.inherits = require('inherits'); /*</replacement>*/ var Readable = require('./_stream_readable'); var Writable = require('./_stream_writable'); util.inherits(Duplex, Readable); forEach(objectKeys(Writable.prototype), function(method) { if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; }); function Duplex(options) { if (!(this instanceof Duplex)) return new Duplex(options); Readable.call(this, options); Writable.call(this, options); if (options && options.readable === false) this.readable = false; if (options && options.writable === false) this.writable = false; this.allowHalfOpen = true; if (options && options.allowHalfOpen === false) this.allowHalfOpen = false; this.once('end', onend); } // the no-half-open enforcer function onend() { // if we allow half-open state, or if the writable side ended, // then we're ok. if (this.allowHalfOpen || this._writableState.ended) return; // no more data can be written. // But allow more writes to happen in this tick. process.nextTick(this.end.bind(this)); } function forEach (xs, f) { for (var i = 0, l = xs.length; i < l; i++) { f(xs[i], i); } }
Rovaron/adote-um-pet
node_modules/mongojs/node_modules/readable-stream/lib/_stream_duplex.js
JavaScript
mit
2,811
// Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. // a duplex stream is just a stream that is both readable and writable. // Since JS doesn't have multiple prototypal inheritance, this class // prototypally inherits from Readable, and then parasitically from // Writable. module.exports = Duplex; /*<replacement>*/ var objectKeys = Object.keys || function (obj) { var keys = []; for (var key in obj) keys.push(key); return keys; } /*</replacement>*/ /*<replacement>*/ var util = require('core-util-is'); util.inherits = require('inherits'); /*</replacement>*/ var Readable = require('./_stream_readable'); var Writable = require('./_stream_writable'); util.inherits(Duplex, Readable); forEach(objectKeys(Writable.prototype), function(method) { if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; }); function Duplex(options) { if (!(this instanceof Duplex)) return new Duplex(options); Readable.call(this, options); Writable.call(this, options); if (options && options.readable === false) this.readable = false; if (options && options.writable === false) this.writable = false; this.allowHalfOpen = true; if (options && options.allowHalfOpen === false) this.allowHalfOpen = false; this.once('end', onend); } // the no-half-open enforcer function onend() { // if we allow half-open state, or if the writable side ended, // then we're ok. if (this.allowHalfOpen || this._writableState.ended) return; // no more data can be written. // But allow more writes to happen in this tick. process.nextTick(this.end.bind(this)); } function forEach (xs, f) { for (var i = 0, l = xs.length; i < l; i++) { f(xs[i], i); } }
Rakart/angular-phonecat
node_modules/bower/node_modules/decompress-zip/node_modules/readable-stream/lib/_stream_duplex.js
JavaScript
mit
2,811
angular.module("ngLocale",[],["$provide",function(a){var b={ZERO:"zero",ONE:"one",TWO:"two",FEW:"few",MANY:"many",OTHER:"other"};a.value("$locale",{DATETIME_FORMATS:{AMPMS:{"0":"a.m.","1":"p.m."},DAY:{"0":"domingo","1":"lunes","2":"martes","3":"miércoles","4":"jueves","5":"viernes","6":"sábado"},MONTH:{"0":"enero","1":"febrero","2":"marzo","3":"abril","4":"mayo","5":"junio","6":"julio","7":"agosto","8":"septiembre","9":"octubre","10":"noviembre","11":"diciembre"},SHORTDAY:{"0":"dom","1":"lun","2":"mar","3":"mié","4":"jue","5":"vie","6":"sáb"},SHORTMONTH:{"0":"ene","1":"feb","2":"mar","3":"abr","4":"may","5":"jun","6":"jul","7":"ago","8":"sep","9":"oct","10":"nov","11":"dic"},fullDate:"EEEE, d 'de' MMMM 'de' y",longDate:"d 'de' MMMM 'de' y",medium:"dd/MM/yyyy HH:mm:ss",mediumDate:"dd/MM/yyyy",mediumTime:"HH:mm:ss","short":"dd/MM/yy HH:mm",shortDate:"dd/MM/yy",shortTime:"HH:mm"},NUMBER_FORMATS:{CURRENCY_SYM:"€",DECIMAL_SEP:",",GROUP_SEP:".",PATTERNS:{"0":{gSize:3,lgSize:3,macFrac:0,maxFrac:3,minFrac:0,minInt:1,negPre:"-",negSuf:"",posPre:"",posSuf:""},"1":{gSize:3,lgSize:3,macFrac:0,maxFrac:2,minFrac:2,minInt:1,negPre:"-",negSuf:" \u00A4",posPre:"",posSuf:" \u00A4"}}},id:"es-ea",pluralCat:function(c){if(c==1){return b.ONE}return b.OTHER}})}]);
iros/cdnjs
ajax/libs/angular-i18n/1.1.4/angular-locale_es-ea.min.js
JavaScript
mit
1,269
angular.module("ngLocale",[],["$provide",function(a){var b={ZERO:"zero",ONE:"one",TWO:"two",FEW:"few",MANY:"many",OTHER:"other"};a.value("$locale",{DATETIME_FORMATS:{AMPMS:{"0":"AM","1":"PM"},DAY:{"0":"niedziela","1":"poniedziałek","2":"wtorek","3":"środa","4":"czwartek","5":"piątek","6":"sobota"},MONTH:{"0":"stycznia","1":"lutego","2":"marca","3":"kwietnia","4":"maja","5":"czerwca","6":"lipca","7":"sierpnia","8":"września","9":"października","10":"listopada","11":"grudnia"},SHORTDAY:{"0":"niedz.","1":"pon.","2":"wt.","3":"śr.","4":"czw.","5":"pt.","6":"sob."},SHORTMONTH:{"0":"sty","1":"lut","2":"mar","3":"kwi","4":"maj","5":"cze","6":"lip","7":"sie","8":"wrz","9":"paź","10":"lis","11":"gru"},fullDate:"EEEE, d MMMM y",longDate:"d MMMM y",medium:"d MMM y HH:mm:ss",mediumDate:"d MMM y",mediumTime:"HH:mm:ss","short":"dd.MM.yyyy HH:mm",shortDate:"dd.MM.yyyy",shortTime:"HH:mm"},NUMBER_FORMATS:{CURRENCY_SYM:"zł",DECIMAL_SEP:",",GROUP_SEP:" ",PATTERNS:{"0":{gSize:3,lgSize:3,macFrac:0,maxFrac:3,minFrac:0,minInt:1,negPre:"-",negSuf:"",posPre:"",posSuf:""},"1":{gSize:3,lgSize:3,macFrac:0,maxFrac:2,minFrac:2,minInt:1,negPre:"(",negSuf:" \u00A4)",posPre:"",posSuf:" \u00A4"}}},id:"pl",pluralCat:function(c){if(c==1){return b.ONE}if(c==(c|0)&&c%10>=2&&c%10<=4&&(c%100<12||c%100>14)){return b.FEW}if(c!=1&&(c%10==0||c%10==1)||c==(c|0)&&c%10>=5&&c%10<=9||c==(c|0)&&c%100>=12&&c%100<=14){return b.MANY}return b.OTHER}})}]);
stefanneculai/cdnjs
ajax/libs/angular-i18n/1.0.6/angular-locale_pl.min.js
JavaScript
mit
1,436
module.exports = [ "He ","Lan ","Biao ","Rong ","Li ","Mo ","Bao ","Ruo ","Lu ","La ","Ao ","Xun ","Kuang ","Shuo ","[?] ","Li ","Lu ","Jue ","Liao ","Yan ","Xi ","Xie ","Long ","Ye ","[?] ","Rang ","Yue ","Lan ","Cong ","Jue ","Tong ","Guan ","[?] ","Che ","Mi ","Tang ","Lan ","Zhu ","[?] ","Ling ","Cuan ","Yu ","Zhua ","Tsumekanmuri ","Pa ","Zheng ","Pao ","Cheng ","Yuan ","Ai ","Wei ","[?] ","Jue ","Jue ","Fu ","Ye ","Ba ","Die ","Ye ","Yao ","Zu ","Shuang ","Er ","Qiang ","Chuang ","Ge ","Zang ","Die ","Qiang ","Yong ","Qiang ","Pian ","Ban ","Pan ","Shao ","Jian ","Pai ","Du ","Chuang ","Tou ","Zha ","Bian ","Die ","Bang ","Bo ","Chuang ","You ","[?] ","Du ","Ya ","Cheng ","Niu ","Ushihen ","Pin ","Jiu ","Mou ","Tuo ","Mu ","Lao ","Ren ","Mang ","Fang ","Mao ","Mu ","Gang ","Wu ","Yan ","Ge ","Bei ","Si ","Jian ","Gu ","You ","Ge ","Sheng ","Mu ","Di ","Qian ","Quan ","Quan ","Zi ","Te ","Xi ","Mang ","Keng ","Qian ","Wu ","Gu ","Xi ","Li ","Li ","Pou ","Ji ","Gang ","Zhi ","Ben ","Quan ","Run ","Du ","Ju ","Jia ","Jian ","Feng ","Pian ","Ke ","Ju ","Kao ","Chu ","Xi ","Bei ","Luo ","Jie ","Ma ","San ","Wei ","Li ","Dun ","Tong ","[?] ","Jiang ","Ikenie ","Li ","Du ","Lie ","Pi ","Piao ","Bao ","Xi ","Chou ","Wei ","Kui ","Chou ","Quan ","Fan ","Ba ","Fan ","Qiu ","Ji ","Cai ","Chuo ","An ","Jie ","Zhuang ","Guang ","Ma ","You ","Kang ","Bo ","Hou ","Ya ","Yin ","Huan ","Zhuang ","Yun ","Kuang ","Niu ","Di ","Qing ","Zhong ","Mu ","Bei ","Pi ","Ju ","Ni ","Sheng ","Pao ","Xia ","Tuo ","Hu ","Ling ","Fei ","Pi ","Ni ","Ao ","You ","Gou ","Yue ","Ju ","Dan ","Po ","Gu ","Xian ","Ning ","Huan ","Hen ","Jiao ","He ","Zhao ","Ji ","Xun ","Shan ","Ta ","Rong ","Shou ","Tong ","Lao ","Du ","Xia ","Shi ","Hua ","Zheng ","Yu ","Sun ","Yu ","Bi ","Mang ","Xi ","Juan ","Li ","Xia ","Yin ","Suan ","Lang ","Bei ","Zhi ","Yan " ];
ilyashrn/ilyashrn.github.io
node_modules/unidecode/data/x72.js
JavaScript
mit
1,854
/* Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ //>>built define("dojo/cldr/nls/dangi",{root:{"dateTimeFormats-appendItem-Year":"{1} {0}","field-tue-relative+-1":"last Tuesday","field-year":"Year","dateFormatItem-Hm":"HH:mm","field-wed-relative+0":"this Wednesday","quarters-format-narrow@localeAlias109":{"bundle":"gregorian","target":"quarters-standAlone-narrow"},"field-wed-relative+1":"next Wednesday","quarters@localeAlias106":{"bundle":"chinese","target":"quarters"},"dateFormatItem-ms":"mm:ss","quarters@localeAlias107":{"bundle":"gregorian","target":"quarters"},"timeFormat-short":"HH:mm","days-standAlone-abbr@localeAlias100":{"bundle":"gregorian","target":"days-format-abbr"},"field-minute":"Minute","days-standAlone-abbr@localeAlias101":{"bundle":"gregorian","target":"days-format-wide"},"dateTimeFormat-short":"{1} {0}","field-day-relative+0":"today","field-day-relative+1":"tomorrow","field-tue-relative+0":"this Tuesday","field-tue-relative+1":"next Tuesday","dayPeriods-format-narrow-am":"a","dateFormatItem-MMMd":"MMM d","dayPeriods-format-abbr-am":"AM","field-week-relative+0":"this week","field-month-relative+0":"this month","field-week-relative+1":"next week","field-month-relative+1":"next month","timeFormat-medium":"HH:mm:ss","field-second-relative+0":"now","months-format-narrow@localeAlias90":{"bundle":"chinese","target":"months-standAlone-narrow"},"months-format-abbr@localeAlias89":{"bundle":"chinese","target":"months-format-wide"},"dateTimeFormats-appendItem-Second":"{0} ({2}: {1})","dateFormatItem-yyyyQQQ":"U QQQ","months-standAlone-narrow":["1","2","3","4","5","6","7","8","9","10","11","12"],"dateFormatItem-GyMMMEd":"U MMM d, E","dateFormatItem-yyyyMd":"y-MM-dd","field-day":"Day","field-year-relative+-1":"last year","dayPeriods-format-wide-am":"AM","dateFormatItem-yyyyMEd":"y-MM-dd, E","field-wed-relative+-1":"last Wednesday","dateTimeFormat-medium":"{1} {0}","days-standAlone-narrow":["S","M","T","W","T","F","S"],"field-second":"Second","dateFormat-long":"U MMMM d","dateFormatItem-GyMMMd":"U MMM d","dateFormat@localeAlias117":{"bundle":"chinese","target":"dateFormat"},"quarters-standAlone-wide":["Q1","Q2","Q3","Q4"],"days-format-narrow":["S","M","T","W","T","F","S"],"dateTimeFormats-appendItem-Timezone":"{0} {1}","field-mon-relative+-1":"last Monday","dateFormatItem-GyMMM":"U MMM","field-month":"Month","dateFormatItem-MMM":"LLL","field-dayperiod":"Dayperiod","quarters-standAlone-wide@localeAlias112":{"bundle":"gregorian","target":"quarters-format-wide"},"dayPeriods-format-narrow-pm":"p","dateFormat-medium":"U MMM d","quarters-standAlone-abbr":["Q1","Q2","Q3","Q4"],"dayPeriods-format-abbr-pm":"PM","months-standAlone-abbr@localeAlias91":{"bundle":"chinese","target":"months-format-abbr"},"dateFormatItem-yyyyM":"y-MM","months-standAlone-abbr@localeAlias92":{"bundle":"chinese","target":"months-format-wide"},"field-mon-relative+0":"this Monday","field-mon-relative+1":"next Monday","months-format-narrow":["1","2","3","4","5","6","7","8","9","10","11","12"],"dateFormatItem-yyyyMMMd":"U MMM d","days-format-short":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"quarters-format-narrow":["1","2","3","4"],"days@localeAlias94":{"bundle":"chinese","target":"days"},"dayPeriods-format-wide-pm":"PM","days@localeAlias95":{"bundle":"gregorian","target":"days"},"field-sat-relative+-1":"last Saturday","dateTimeFormats-appendItem-Hour":"{0} ({2}: {1})","dateTimeFormat-long":"{1} {0}","dateFormatItem-Md":"MM-dd","field-hour":"Hour","months-format-wide":["M01","M02","M03","M04","M05","M06","M07","M08","M09","M10","M11","M12"],"dateFormat-full":"U MMMM d, EEEE","field-month-relative+-1":"last month","months@localeAlias88":{"bundle":"chinese","target":"months"},"dateFormatItem-Hms":"HH:mm:ss","quarters-standAlone-abbr@localeAlias110":{"bundle":"gregorian","target":"quarters-format-abbr"},"quarters-standAlone-abbr@localeAlias111":{"bundle":"gregorian","target":"quarters-format-wide"},"quarters-format-abbr@localeAlias108":{"bundle":"gregorian","target":"quarters-format-wide"},"field-fri-relative+0":"this Friday","field-fri-relative+1":"next Friday","dayPeriods-format-narrow-noon":"n","dateTimeFormats-appendItem-Quarter":"{0} ({2}: {1})","field-week-relative+-1":"last week","months-format-abbr":["M01","M02","M03","M04","M05","M06","M07","M08","M09","M10","M11","M12"],"days-standAlone-short@localeAlias102":{"bundle":"gregorian","target":"days-format-short"},"timeFormat-long":"HH:mm:ss z","days-standAlone-short@localeAlias103":{"bundle":"gregorian","target":"days-format-abbr"},"days-standAlone-short@localeAlias104":{"bundle":"gregorian","target":"days-format-wide"},"days-format-narrow@localeAlias97":{"bundle":"gregorian","target":"days-standAlone-narrow"},"dayPeriods-format-abbr@localeAlias115":{"bundle":"gregorian","target":"dayPeriods-format-wide"},"dayPeriods-format-abbr@localeAlias116":{"bundle":"gregorian","target":"dayPeriods-format-wide"},"dateFormat-short":"y-MM-dd","days-standAlone-wide":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"dateFormatItem-yyyyMMMEd":"U MMM d, E","months-standAlone-wide@localeAlias93":{"bundle":"chinese","target":"months-format-wide"},"dateTimeFormats-appendItem-Era":"{1} {0}","timeFormat@localeAlias118":{"bundle":"chinese","target":"timeFormat"},"timeFormat@localeAlias119":{"bundle":"gregorian","target":"timeFormat"},"dateFormatItem-H":"HH","dateFormatItem-yyyy":"U","dateFormatItem-M":"L","months-standAlone-wide":["M01","M02","M03","M04","M05","M06","M07","M08","M09","M10","M11","M12"],"field-sun-relative+-1":"last Sunday","days-format-short@localeAlias98":{"bundle":"gregorian","target":"days-format-abbr"},"days-format-short@localeAlias99":{"bundle":"gregorian","target":"days-format-wide"},"days-standAlone-abbr":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"dateTimeFormat-full":"{1} {0}","dateFormatItem-hm":"h:mm a","days-format-abbr@localeAlias96":{"bundle":"gregorian","target":"days-format-wide"},"dateFormatItem-d":"d","field-weekday":"Day of the Week","field-sat-relative+0":"this Saturday","dateFormatItem-h":"h a","field-sat-relative+1":"next Saturday","months-standAlone-abbr":["M01","M02","M03","M04","M05","M06","M07","M08","M09","M10","M11","M12"],"dayPeriods@localeAlias113":{"bundle":"chinese","target":"dayPeriods"},"timeFormat-full":"HH:mm:ss zzzz","dateFormatItem-MEd":"MM-dd, E","dayPeriods@localeAlias114":{"bundle":"gregorian","target":"dayPeriods"},"dateFormatItem-y":"U","field-thu-relative+0":"this Thursday","field-thu-relative+1":"next Thursday","dateFormatItem-hms":"h:mm:ss a","dateTimeFormats-appendItem-Day":"{0} ({2}: {1})","dayPeriods-format-abbr-noon":"noon","dateTimeFormats-appendItem-Week":"{0} ({2}: {1})","field-thu-relative+-1":"last Thursday","dateFormatItem-yMd":"y-MM-dd","field-week":"Week","quarters-standAlone-narrow":["1","2","3","4"],"quarters-format-wide":["Q1","Q2","Q3","Q4"],"dateFormatItem-Ed":"d, E","dateFormatItem-yyyyMMM":"U MMM","dateTimeFormats-appendItem-Day-Of-Week":"{0} {1}","days-standAlone-short":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"dateTime@localeAlias120":{"bundle":"chinese","target":"dateTime"},"dateFormatItem-yyyyQQQQ":"U QQQQ","quarters-format-abbr":["Q1","Q2","Q3","Q4"],"field-year-relative+0":"this year","field-year-relative+1":"next year","field-fri-relative+-1":"last Friday","dayPeriods-format-wide-noon":"noon","days-format-wide":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"dateTimeFormats-appendItem-Month":"{0} ({2}: {1})","field-zone":"Zone","dateFormatItem-MMMEd":"MMM d, E","field-day-relative+-1":"yesterday","days-format-abbr":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"field-sun-relative+0":"this Sunday","field-sun-relative+1":"next Sunday","dateTimeFormats-appendItem-Minute":"{0} ({2}: {1})","dateFormatItem-Gy":"U","field-era":"Era","days-standAlone-wide@localeAlias105":{"bundle":"gregorian","target":"days-format-wide"}},"fr":true,"ja":true,"ko":true,"nl":true,"sv":true,"th":true,"zh-hant":true});
panshuiqing/cdnjs
ajax/libs/dojo/1.10.0/cldr/nls/dangi.js
JavaScript
mit
8,066
/* Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ //>>built define("dojo/cldr/nls/cs/japanese",{"field-sat-relative+0":"tuto sobotu","field-sat-relative+1":"příští sobotu","field-dayperiod":"AM/PM","field-sun-relative+-1":"minulou neděli","field-mon-relative+-1":"minulé pondělí","field-minute":"Minuta","field-day-relative+-1":"včera","field-weekday":"Den v týdnu","field-day-relative+-2":"předevčírem","field-era":"Letopočet","field-hour":"Hodina","field-sun-relative+0":"tuto neděli","field-sun-relative+1":"příští neděli","field-wed-relative+-1":"minulou středu","field-day-relative+0":"dnes","field-day-relative+1":"zítra","field-day-relative+2":"pozítří","dateFormat-long":"d. MMMM y G","field-tue-relative+0":"toto úterý","field-zone":"Časové pásmo","field-tue-relative+1":"příští úterý","field-week-relative+-1":"minulý týden","dateFormat-medium":"d. M. y G","field-year-relative+0":"tento rok","field-year-relative+1":"příští rok","field-sat-relative+-1":"minulou sobotu","field-year-relative+-1":"minulý rok","field-year":"Rok","field-fri-relative+0":"tento pátek","field-fri-relative+1":"příští pátek","field-week":"Týden","field-week-relative+0":"tento týden","field-week-relative+1":"příští týden","field-month-relative+0":"tento měsíc","field-month":"Měsíc","field-month-relative+1":"příští měsíc","field-fri-relative+-1":"minulý pátek","field-second":"Sekunda","field-tue-relative+-1":"minulé úterý","field-day":"Den","field-mon-relative+0":"toto pondělí","field-mon-relative+1":"příští pondělí","field-thu-relative+0":"tento čtvrtek","field-second-relative+0":"nyní","dateFormat-short":"dd.MM.yy GGGGG","field-thu-relative+1":"příští čtvrtek","dateFormat-full":"EEEE, d. MMMM y G","field-wed-relative+0":"tuto středu","field-wed-relative+1":"příští středu","field-month-relative+-1":"minulý měsíc","field-thu-relative+-1":"minulý čtvrtek"});
pvnr0082t/cdnjs
ajax/libs/dojo/1.10.4/cldr/nls/cs/japanese.js
JavaScript
mit
2,101
define("dojo/cldr/nls/roc", { root: //begin v1.x content { "dateTimeFormats-appendItem-Year": "{1} {0}", "field-tue-relative+-1": "last Tuesday", "field-year": "Year", "dateFormatItem-Hm": "HH:mm", "field-wed-relative+0": "this Wednesday", "field-wed-relative+1": "next Wednesday", "dateFormatItem-ms": "mm:ss", "timeFormat-short": "HH:mm", "field-minute": "Minute", "dateTimeFormat-short": "{1} {0}", "field-day-relative+0": "today", "field-day-relative+1": "tomorrow", "dayPeriods@localeAlias555": { "bundle": "gregorian", "target": "dayPeriods" }, "field-tue-relative+0": "this Tuesday", "field-tue-relative+1": "next Tuesday", "dayPeriods-format-narrow-am": "a", "dateFormatItem-MMMd": "MMM d", "dayPeriods-format-abbr-am": "AM", "field-week-relative+0": "this week", "field-month-relative+0": "this month", "field-week-relative+1": "next week", "field-month-relative+1": "next month", "timeFormat-medium": "HH:mm:ss", "field-second-relative+0": "now", "dateTimeFormats-appendItem-Second": "{0} ({2}: {1})", "dateFormatItem-yyyyQQQ": "G y QQQ", "months-standAlone-narrow": [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" ], "eraNames": [ "Before R.O.C.", "R.O.C." ], "dateFormatItem-GyMMMEd": "G y MMM d, E", "dateFormatItem-yyyyMd": "GGGGG y-MM-dd", "field-day": "Day", "field-year-relative+-1": "last year", "dayPeriods-format-wide-am": "AM", "dateTime@localeAlias562": { "bundle": "generic", "target": "dateTime" }, "days-format-narrow@localeAlias540": { "bundle": "gregorian", "target": "days-standAlone-narrow" }, "dateFormatItem-yyyyMEd": "GGGGG y-MM-dd, E", "field-wed-relative+-1": "last Wednesday", "dateTimeFormat-medium": "{1} {0}", "days-standAlone-narrow": [ "S", "M", "T", "W", "T", "F", "S" ], "field-second": "Second", "days@localeAlias538": { "bundle": "gregorian", "target": "days" }, "dateFormatItem-Ehms": "E h:mm:ss a", "dateFormat-long": "G y MMMM d", "dateFormatItem-GyMMMd": "G y MMM d", "quarters-standAlone-wide": [ "Q1", "Q2", "Q3", "Q4" ], "days-format-narrow": [ "S", "M", "T", "W", "T", "F", "S" ], "dateTimeFormats-appendItem-Timezone": "{0} {1}", "eraNames@localeAlias558": { "bundle": "roc", "target": "eraAbbr" }, "field-mon-relative+-1": "last Monday", "dateFormatItem-GyMMM": "G y MMM", "field-month": "Month", "dateFormatItem-MMM": "LLL", "field-dayperiod": "Dayperiod", "dayPeriods-format-narrow-pm": "p", "dateFormat-medium": "G y MMM d", "eraAbbr": [ "Before R.O.C.", "R.O.C." ], "quarters-standAlone-abbr": [ "Q1", "Q2", "Q3", "Q4" ], "dayPeriods-format-abbr-pm": "PM", "dateFormatItem-yyyyM": "GGGGG y-MM", "field-mon-relative+0": "this Monday", "field-mon-relative+1": "next Monday", "months-format-narrow": [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" ], "dateFormatItem-yyyyMMMd": "G y MMM d", "days-standAlone-wide@localeAlias548": { "bundle": "gregorian", "target": "days-format-wide" }, "days-format-short": [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], "quarters-format-narrow": [ "1", "2", "3", "4" ], "dayPeriods-format-wide-pm": "PM", "field-sat-relative+-1": "last Saturday", "quarters@localeAlias549": { "bundle": "gregorian", "target": "quarters" }, "dateTimeFormats-appendItem-Hour": "{0} ({2}: {1})", "dateTimeFormat-long": "{1} {0}", "dateFormatItem-Md": "MM-dd", "days-standAlone-abbr@localeAlias543": { "bundle": "gregorian", "target": "days-format-abbr" }, "field-hour": "Hour", "days-standAlone-abbr@localeAlias544": { "bundle": "gregorian", "target": "days-format-wide" }, "months-format-wide": [ "M01", "M02", "M03", "M04", "M05", "M06", "M07", "M08", "M09", "M10", "M11", "M12" ], "dateFormat-full": "G y MMMM d, EEEE", "field-month-relative+-1": "last month", "dateFormatItem-Hms": "HH:mm:ss", "field-fri-relative+0": "this Friday", "field-fri-relative+1": "next Friday", "quarters-format-narrow@localeAlias551": { "bundle": "gregorian", "target": "quarters-standAlone-narrow" }, "dayPeriods-format-narrow-noon": "n", "dateTimeFormats-appendItem-Quarter": "{0} ({2}: {1})", "days-format-abbr@localeAlias539": { "bundle": "gregorian", "target": "days-format-wide" }, "field-week-relative+-1": "last week", "dateFormatItem-Ehm": "E h:mm a", "months-format-abbr": [ "M01", "M02", "M03", "M04", "M05", "M06", "M07", "M08", "M09", "M10", "M11", "M12" ], "timeFormat-long": "HH:mm:ss z", "months@localeAlias532": { "bundle": "gregorian", "target": "months" }, "dateFormat-short": "GGGGG y-MM-dd", "months-format-abbr@localeAlias533": { "bundle": "gregorian", "target": "months-format-wide" }, "days-standAlone-wide": [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], "dateFormatItem-yyyyMMMEd": "G y MMM d, E", "dateTimeFormats-appendItem-Era": "{1} {0}", "dateFormatItem-H": "HH", "dateFormatItem-yyyy": "G y", "months-format-narrow@localeAlias534": { "bundle": "gregorian", "target": "months-standAlone-narrow" }, "dateFormatItem-M": "L", "months-standAlone-wide": [ "M01", "M02", "M03", "M04", "M05", "M06", "M07", "M08", "M09", "M10", "M11", "M12" ], "field-sun-relative+-1": "last Sunday", "days-standAlone-abbr": [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], "dateTimeFormat-full": "{1} {0}", "dateFormatItem-hm": "h:mm a", "dateFormat@localeAlias560": { "bundle": "generic", "target": "dateFormat" }, "dateFormatItem-d": "d", "field-weekday": "Day of the Week", "field-sat-relative+0": "this Saturday", "dateFormatItem-h": "h a", "field-sat-relative+1": "next Saturday", "months-standAlone-abbr": [ "M01", "M02", "M03", "M04", "M05", "M06", "M07", "M08", "M09", "M10", "M11", "M12" ], "quarters-standAlone-wide@localeAlias554": { "bundle": "gregorian", "target": "quarters-format-wide" }, "timeFormat-full": "HH:mm:ss zzzz", "dateFormatItem-MEd": "MM-dd, E", "dateFormatItem-y": "G y", "field-thu-relative+0": "this Thursday", "field-thu-relative+1": "next Thursday", "dateFormatItem-hms": "h:mm:ss a", "dateTimeFormats-appendItem-Day": "{0} ({2}: {1})", "dayPeriods-format-abbr-noon": "noon", "dateTimeFormats-appendItem-Week": "{0} ({2}: {1})", "field-thu-relative+-1": "last Thursday", "field-week": "Week", "quarters-standAlone-narrow": [ "1", "2", "3", "4" ], "quarters-format-wide": [ "Q1", "Q2", "Q3", "Q4" ], "dateFormatItem-Ed": "d, E", "dateFormatItem-yyyyMMM": "G y MMM", "dateTimeFormats-appendItem-Day-Of-Week": "{0} {1}", "days-standAlone-short": [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], "quarters-standAlone-abbr@localeAlias552": { "bundle": "gregorian", "target": "quarters-format-abbr" }, "quarters-standAlone-abbr@localeAlias553": { "bundle": "gregorian", "target": "quarters-format-wide" }, "dateFormatItem-yyyyQQQQ": "G y QQQQ", "quarters-format-abbr": [ "Q1", "Q2", "Q3", "Q4" ], "field-year-relative+0": "this year", "field-year-relative+1": "next year", "field-fri-relative+-1": "last Friday", "eraNarrow": [ "Before R.O.C.", "R.O.C." ], "quarters-format-abbr@localeAlias550": { "bundle": "gregorian", "target": "quarters-format-wide" }, "days-standAlone-short@localeAlias545": { "bundle": "gregorian", "target": "days-format-short" }, "months-standAlone-wide@localeAlias537": { "bundle": "gregorian", "target": "months-format-wide" }, "days-standAlone-short@localeAlias546": { "bundle": "gregorian", "target": "days-format-abbr" }, "dayPeriods-format-wide-noon": "noon", "days-standAlone-short@localeAlias547": { "bundle": "gregorian", "target": "days-format-wide" }, "dayPeriods-format-abbr@localeAlias556": { "bundle": "gregorian", "target": "dayPeriods-format-wide" }, "dayPeriods-format-abbr@localeAlias557": { "bundle": "gregorian", "target": "dayPeriods-format-wide" }, "days-format-wide": [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], "dateTimeFormats-appendItem-Month": "{0} ({2}: {1})", "dateFormatItem-EHm": "E HH:mm", "months-standAlone-abbr@localeAlias535": { "bundle": "gregorian", "target": "months-format-abbr" }, "field-zone": "Zone", "months-standAlone-abbr@localeAlias536": { "bundle": "gregorian", "target": "months-format-wide" }, "days-format-short@localeAlias541": { "bundle": "gregorian", "target": "days-format-abbr" }, "dateFormatItem-MMMEd": "MMM d, E", "days-format-short@localeAlias542": { "bundle": "gregorian", "target": "days-format-wide" }, "dateFormatItem-EHms": "E HH:mm:ss", "eraNarrow@localeAlias559": { "bundle": "roc", "target": "eraAbbr" }, "field-day-relative+-1": "yesterday", "days-format-abbr": [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], "field-sun-relative+0": "this Sunday", "field-sun-relative+1": "next Sunday", "dateTimeFormats-appendItem-Minute": "{0} ({2}: {1})", "dateFormatItem-Gy": "G y", "field-era": "Era", "timeFormat@localeAlias561": { "bundle": "gregorian", "target": "timeFormat" } } //end v1.x content , "ar": true, "ca": true, "cs": true, "da": true, "de": true, "el": true, "en": true, "es": true, "fi": true, "fr": true, "hu": true, "it": true, "ja": true, "ko": true, "nb": true, "nl": true, "pl": true, "pt": true, "pt-pt": true, "ru": true, "sv": true, "th": true, "tr": true, "zh": true, "zh-hant": true });
blairvanderhoof/cdnjs
ajax/libs/dojo/1.10.3/cldr/nls/roc.js.uncompressed.js
JavaScript
mit
9,634
/* Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ //>>built define("dojo/cldr/nls/fr/hebrew",{"days-standAlone-short":["dim.","lun.","mar.","mer.","jeu.","ven.","sam."],"field-second-relative+0":"maintenant","field-weekday":"jour de la semaine","field-wed-relative+0":"ce mercredi","field-wed-relative+1":"mercredi prochain","dateFormatItem-GyMMMEd":"E d MMM y G","dateFormatItem-MMMEd":"E d MMM","field-tue-relative+-1":"mardi dernier","days-format-short":["di","lu","ma","me","je","ve","sa"],"dateFormat-long":"d MMMM y G","field-fri-relative+-1":"vendredi dernier","field-wed-relative+-1":"mercredi dernier","months-format-wide":["Tisseri","Hesvan","Kislev","Tébeth","Schébat","Adar I","Adar","Nissan","Iyar","Sivan","Tamouz","Ab","Elloul"],"dateFormatItem-yyyyQQQ":"QQQ y G","dateFormat-full":"EEEE d MMMM y G","dateFormatItem-yyyyMEd":"E d/M/y GGGGG","field-thu-relative+-1":"jeudi dernier","dateFormatItem-Md":"d/M","dayPeriods-format-wide-noon":"midi","field-era":"ère","months-standAlone-wide":["Tisseri","Hesvan","Kislev","Tébeth","Schébat","Adar I","Adar","Nissan","Iyar","Sivan","Tamouz","Ab","Elloul"],"quarters-format-wide":["1er trimestre","2e trimestre","3e trimestre","4e trimestre"],"field-year":"année","field-hour":"heure","months-format-abbr":["Tisseri","Hesvan","Kislev","Tébeth","Schébat","Adar I","Adar","Nissan","Iyar","Sivan","Tamouz","Ab","Elloul"],"field-sat-relative+0":"ce samedi","field-sat-relative+1":"samedi prochain","field-day-relative+0":"aujourd’hui","field-thu-relative+0":"ce jeudi","field-day-relative+1":"demain","field-thu-relative+1":"jeudi prochain","dateFormatItem-GyMMMd":"d MMM y G","field-day-relative+2":"après-demain","months-standAlone-abbr":["Tisseri","Hesvan","Kislev","Tébeth","Schébat","Adar I","Adar","Nissan","Iyar","Sivan","Tamouz","Ab","Elloul"],"quarters-format-abbr":["T1","T2","T3","T4"],"quarters-standAlone-wide":["1er trimestre","2e trimestre","3e trimestre","4e trimestre"],"dateFormatItem-Gy":"y G","dateFormatItem-yyyyMMMEd":"E d MMM y G","days-standAlone-wide":["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],"dateFormatItem-yyyyMMM":"MMM y G","dateFormatItem-yyyyMMMd":"d MMM y G","months-standAlone-wide-leap":"Adar II","field-sun-relative+0":"ce dimanche","field-sun-relative+1":"dimanche prochain","quarters-standAlone-abbr":["T1","T2","T3","T4"],"field-minute":"minute","field-dayperiod":"cadran","days-standAlone-abbr":["dim.","lun.","mar.","mer.","jeu.","ven.","sam."],"field-day-relative+-1":"hier","dateTimeFormat-long":"{1} 'à' {0}","field-day-relative+-2":"avant-hier","dateFormatItem-MMMd":"d MMM","dateFormatItem-MEd":"E d/M","dateTimeFormat-full":"{1} 'à' {0}","field-fri-relative+0":"ce vendredi","field-fri-relative+1":"vendredi prochain","field-day":"jour","days-format-wide":["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],"field-zone":"fuseau horaire","dateFormatItem-y":"y G","field-year-relative+-1":"l’année dernière","field-month-relative+-1":"le mois dernier","days-format-abbr":["dim.","lun.","mar.","mer.","jeu.","ven.","sam."],"days-format-narrow":["D","L","M","M","J","V","S"],"dateFormatItem-yyyyMd":"d/M/y GGGGG","field-month":"mois","days-standAlone-narrow":["D","L","M","M","J","V","S"],"field-tue-relative+0":"ce mardi","field-tue-relative+1":"mardi prochain","field-mon-relative+0":"ce lundi","field-mon-relative+1":"lundi prochain","dateFormat-short":"dd/MM/y GGGGG","dayPeriods-format-narrow-noon":"midi","field-second":"seconde","field-sat-relative+-1":"samedi dernier","field-sun-relative+-1":"dimanche dernier","field-month-relative+0":"ce mois-ci","field-month-relative+1":"le mois prochain","dateFormatItem-Ed":"E d","field-week":"semaine","dateFormat-medium":"d MMM y G","field-year-relative+0":"cette année","field-week-relative+-1":"la semaine dernière","dateFormatItem-yyyyM":"M/y GGGGG","field-year-relative+1":"l’année prochaine","dateFormatItem-yyyyQQQQ":"QQQQ y G","months-format-wide-leap":"Adar II","dateFormatItem-GyMMM":"MMM y G","field-mon-relative+-1":"lundi dernier","dateFormatItem-yyyy":"y G","field-week-relative+0":"cette semaine","field-week-relative+1":"la semaine prochaine"});
emmy41124/cdnjs
ajax/libs/dojo/1.10.2/cldr/nls/fr/hebrew.js
JavaScript
mit
4,320
/* Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ //>>built define("dojo/cldr/nls/ja/ethiopic",{"field-sat-relative+0":"今週の土曜日","field-sat-relative+1":"来週の土曜日","field-dayperiod":"午前/午後","field-sun-relative+-1":"先週の日曜日","field-mon-relative+-1":"先週の月曜日","field-minute":"分","field-day-relative+-1":"昨日","field-weekday":"曜日","field-day-relative+-2":"一昨日","months-standAlone-narrow":["1","2","3","4","5","6","7","8","9","10","11","12","13"],"field-era":"時代","field-hour":"時","field-sun-relative+0":"今週の日曜日","field-sun-relative+1":"来週の日曜日","months-standAlone-abbr":["メスケレム","テケムト","ヘダル","ターサス","テル","イェカティト","メガビト","ミアジア","ゲンボト","セネ","ハムレ","ネハッセ","パグメン"],"field-wed-relative+-1":"先週の水曜日","field-day-relative+0":"今日","field-day-relative+1":"明日","field-day-relative+2":"明後日","field-tue-relative+0":"今週の火曜日","field-zone":"タイムゾーン","field-tue-relative+1":"来週の火曜日","field-week-relative+-1":"先週","field-year-relative+0":"今年","field-year-relative+1":"翌年","field-sat-relative+-1":"先週の土曜日","field-year-relative+-1":"昨年","field-year":"年","field-fri-relative+0":"今週の金曜日","field-fri-relative+1":"来週の金曜日","months-standAlone-wide":["メスケレム","テケムト","ヘダル","ターサス","テル","イェカティト","メガビト","ミアジア","ゲンボト","セネ","ハムレ","ネハッセ","パグメン"],"field-week":"週","field-week-relative+0":"今週","field-week-relative+1":"翌週","months-format-abbr":["メスケレム","テケムト","ヘダル","ターサス","テル","イェカティト","メガビト","ミアジア","ゲンボト","セネ","ハムレ","ネハッセ","パグメン"],"field-month-relative+0":"今月","field-month":"月","field-month-relative+1":"翌月","field-fri-relative+-1":"先週の金曜日","field-second":"秒","field-tue-relative+-1":"先週の火曜日","field-day":"日","months-format-narrow":["1","2","3","4","5","6","7","8","9","10","11","12","13"],"field-mon-relative+0":"今週の月曜日","field-mon-relative+1":"来週の月曜日","field-thu-relative+0":"今週の木曜日","field-second-relative+0":"今すぐ","field-thu-relative+1":"来週の木曜日","months-format-wide":["メスケレム","テケムト","ヘダル","ターサス","テル","イェカティト","メガビト","ミアジア","ゲンボト","セネ","ハムレ","ネハッセ","パグメン"],"field-wed-relative+0":"今週の水曜日","field-wed-relative+1":"来週の水曜日","field-month-relative+-1":"先月","field-thu-relative+-1":"先週の木曜日"});
iamJoeTaylor/cdnjs
ajax/libs/dojo/1.10.4/cldr/nls/ja/ethiopic.js
JavaScript
mit
2,946
/* Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ //>>built define("dojo/cldr/nls/pt/indian",{"field-sat-relative+0":"este sábado","field-sat-relative+1":"próximo sábado","field-dayperiod":"Período do dia","field-sun-relative+-1":"domingo passado","field-mon-relative+-1":"segunda-feira passada","field-minute":"Minuto","field-day-relative+-1":"ontem","field-weekday":"Dia da semana","field-day-relative+-2":"anteontem","field-era":"Era","field-hour":"Hora","field-sun-relative+0":"este domingo","field-sun-relative+1":"próximo domingo","months-standAlone-abbr":["Chaitra","Vaisakha","Jyaistha","Asadha","Sravana","Bhadra","Asvina","Kartika","Agrahayana","Pausa","Magha","Phalguna"],"field-wed-relative+-1":"quarta-feira passada","field-day-relative+0":"hoje","field-day-relative+1":"amanhã","field-day-relative+2":"depois de amanhã","field-tue-relative+0":"esta terça-feira","field-zone":"Fuso","field-tue-relative+1":"próxima terça-feira","field-week-relative+-1":"semana passada","field-year-relative+0":"este ano","field-year-relative+1":"próximo ano","field-sat-relative+-1":"sábado passado","field-year-relative+-1":"ano passado","field-year":"Ano","field-fri-relative+0":"esta sexta-feira","field-fri-relative+1":"próxima sexta-feira","months-standAlone-wide":["Chaitra","Vaisakha","Jyaistha","Asadha","Sravana","Bhadra","Asvina","Kartika","Agrahayana","Pausa","Magha","Phalguna"],"field-week":"Semana","field-week-relative+0":"esta semana","field-week-relative+1":"próxima semana","months-format-abbr":["Chaitra","Vaisakha","Jyaistha","Asadha","Sravana","Bhadra","Asvina","Kartika","Agrahayana","Pausa","Magha","Phalguna"],"field-month-relative+0":"este mês","field-month":"Mês","field-month-relative+1":"próximo mês","field-fri-relative+-1":"sexta-feira passada","field-second":"Segundo","field-tue-relative+-1":"terça-feira passada","field-day":"Dia","months-format-narrow":["1","2","3","4","5","6","7","8","9","10","11","12"],"field-mon-relative+0":"esta segunda-feira","field-mon-relative+1":"próxima segunda-feira","field-thu-relative+0":"esta quinta-feira","field-second-relative+0":"agora","field-thu-relative+1":"próxima quinta-feira","field-wed-relative+0":"esta quarta-feira","field-wed-relative+1":"próxima quarta-feira","field-month-relative+-1":"mês passado","field-thu-relative+-1":"quinta-feira passada"});
kirbyfan64/cdnjs
ajax/libs/dojo/1.10.4/cldr/nls/pt/indian.js
JavaScript
mit
2,499
/* Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ //>>built define("dojo/cldr/nls/en-au/islamic",{"dateFormatItem-yyyyMMMEd":"E, MMM d, y G","dateFormatItem-MMMEd":"E, MMM d","dateTimeFormat-full":"{1} 'at' {0}","field-day-relative+-1":"Yesterday","dateTimeFormats-appendItem-Year":"{0} {1}","dateTimeFormat-short":"{1}, {0}","dateFormatItem-Gy":"y G","dateTimeFormat-medium":"{1}, {0}","dateFormatItem-y":"y G","timeFormat-full":"h:mm:ss a zzzz","dateFormatItem-yyyy":"y G","dateFormatItem-Ed":"d E","field-day-relative+0":"Today","field-day-relative+1":"Tomorrow","dateFormatItem-GyMMMd":"MMM d, y G","dateFormat-long":"d MMMM y G","timeFormat-medium":"h:mm:ss a","field-week-relative+-1":"Last week","dateFormat-medium":"d MMM y G","field-year-relative+0":"This year","field-year-relative+1":"Next year","dateFormatItem-yMd":"d/M/y","field-year-relative+-1":"Last year","dateFormatItem-yyyyQQQQ":"QQQQ y G","dateTimeFormat-long":"{1} 'at' {0}","dateFormatItem-yyyyMd":"M/d/y GGGGG","dateFormatItem-yyyyMMMd":"MMM d, y G","dateFormatItem-yyyyMEd":"E, M/d/y GGGGG","field-week-relative+0":"This week","field-week-relative+1":"Next week","timeFormat-long":"h:mm:ss a z","field-month-relative+0":"This month","timeFormat-short":"h:mm a","field-month-relative+1":"Next month","dateFormatItem-GyMMMEd":"E, MMM d, y G","dateFormatItem-GyMMM":"MMM y G","dateFormatItem-yyyyQQQ":"QQQ y G","dateFormatItem-MEd":"E, M/d","dateFormat-short":"d/MM/y GGGGG","dateFormatItem-yyyyM":"M/y GGGGG","dateFormat-full":"EEEE, d MMMM y G","dateFormatItem-Md":"M/d","dateFormatItem-yMEd":"E, d/M/y","days-format-short":["Su","Mo","Tu","We","Th","Fr","Sa"],"dateFormatItem-yyyyMMM":"MMM y G","dateTimeFormats-appendItem-Era":"{0} {1}","field-month-relative+-1":"Last month","quarters-format-wide":["1st quarter","2nd quarter","3rd quarter","4th quarter"],"days-format-wide":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]});
ahocevar/cdnjs
ajax/libs/dojo/1.10.1/cldr/nls/en-au/islamic.js
JavaScript
mit
2,074
/* Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ //>>built define("dojo/cldr/nls/en-gb/chinese",{"dateFormat-medium":"d MMM U","dateFormatItem-yMd":"dd/MM/y","dateFormatItem-MMMEd":"E d MMM","dateFormatItem-MEd":"E dd/MM","months-format-narrow":["1","2","3","4","5","6","7","8","9","10","11","12"],"dateTimeFormat-medium":"{1} {0}","dateFormatItem-GyMMMd":"d MMM U","dateFormatItem-Md":"dd/MM","months-standAlone-narrow":["1","2","3","4","5","6","7","8","9","10","11","12"],"months-standAlone-wide":["1","2","3","4","5","6","7","8","9","10","11","12"],"dateFormatItem-GyMMMEd":"E, d MMM U","dateFormatItem-M":"LL","dateFormatItem-yyyyMMMEd":"E, d MMM U","dateFormatItem-yyyyMEd":"E, dd/MM/y","dateFormatItem-yyyyMMMM":"MMMM U","dateFormatItem-MMMMd":"d MMMM","dateTimeFormat-long":"{1} {0}","months-standAlone-abbr":["1","2","3","4","5","6","7","8","9","10","11","12"],"dateFormat-long":"d MMMM U","field-dayperiod":"am/pm","dateFormat-short":"dd/MM/yy","dateTimeFormat-short":"{1} {0}","months-format-wide":["1","2","3","4","5","6","7","8","9","10","11","12"],"dateTimeFormat-full":"{1} {0}","months-format-abbr":["1","2","3","4","5","6","7","8","9","10","11","12"],"dateFormatItem-yyyyMMMd":"d MMM U","dateFormatItem-yyyyM":"MM/y","dateFormat-full":"EEEE, d MMMM U","dateFormatItem-MMMd":"d MMM","dateFormatItem-yyyyMd":"dd/MM/y","dateFormatItem-Ed":"E d"});
akiran/cdnjs
ajax/libs/dojo/1.10.3/cldr/nls/en-gb/chinese.js
JavaScript
mit
1,508
/* Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ //>>built define("dojo/cldr/nls/ro/generic",{"field-second-relative+0":"acum","field-weekday":"zi a săptămânii","field-wed-relative+0":"miercurea aceasta","field-wed-relative+1":"miercurea viitoare","dateFormatItem-GyMMMEd":"E, d MMM y G","dateFormatItem-MMMEd":"E, d MMM","field-tue-relative+-1":"marțea trecută","dateFormat-long":"d MMMM y G","field-fri-relative+-1":"vinerea trecută","field-wed-relative+-1":"miercurea trecută","dateFormatItem-yyyyQQQ":"QQQ y G","dateTimeFormat-medium":"{1}, {0}","dateFormat-full":"EEEE, d MMMM y G","dateFormatItem-yyyyMEd":"E, dd.MM.y G","field-thu-relative+-1":"joia trecută","dateFormatItem-Md":"dd.MM","field-era":"eră","field-year":"an","dateFormatItem-yyyyMMMM":"MMMM y G","field-hour":"oră","field-sat-relative+0":"sâmbăta aceasta","field-sat-relative+1":"sâmbăta viitoare","field-day-relative+0":"azi","field-day-relative+1":"mâine","field-thu-relative+0":"joia aceasta","dateFormatItem-GyMMMd":"d MMM y G","field-day-relative+2":"poimâine","field-thu-relative+1":"joia viitoare","dateFormatItem-H":"HH","dateFormatItem-Gy":"y G","dateFormatItem-yyyyMMMEd":"E, d MMM y G","dateFormatItem-M":"L","dateFormatItem-yyyyMMM":"MMM y G","dateFormatItem-yyyyMMMd":"d MMM y G","dateFormatItem-MMMMd":"d MMMM","field-sun-relative+0":"duminica aceasta","dateFormatItem-Hm":"HH:mm","field-sun-relative+1":"duminica viitoare","field-minute":"minut","field-dayperiod":"a.m./p.m","dateFormatItem-d":"d","dateFormatItem-ms":"mm:ss","field-day-relative+-1":"ieri","dateTimeFormat-long":"{1}, {0}","field-day-relative+-2":"alaltăieri","dateFormatItem-MMMd":"d MMM","dateFormatItem-MEd":"E, dd.MM","dateTimeFormat-full":"{1}, {0}","field-fri-relative+0":"vinerea aceasta","field-fri-relative+1":"vinerea viitoare","field-day":"zi","field-zone":"fus orar","dateFormatItem-y":"y","field-year-relative+-1":"anul trecut","field-month-relative+-1":"luna trecută","dateFormatItem-hm":"h:mm a","dateFormatItem-yyyyMd":"dd.MM.y G","field-month":"lună","dateFormatItem-MMM":"LLL","field-tue-relative+0":"marțea aceasta","field-tue-relative+1":"marțea viitoare","dateFormatItem-MMMMEd":"E, d MMMM","field-mon-relative+0":"lunea aceasta","field-mon-relative+1":"lunea viitoare","dateFormat-short":"dd.MM.y GGGGG","field-second":"secundă","field-sat-relative+-1":"sâmbăta trecută","field-sun-relative+-1":"duminica trecută","field-month-relative+0":"luna aceasta","field-month-relative+1":"luna viitoare","dateFormatItem-Ed":"E d","field-week":"săptămână","dateFormat-medium":"dd.MM.y G","field-year-relative+0":"anul acesta","field-week-relative+-1":"săptămâna trecută","dateFormatItem-yyyyM":"MM.y G","field-year-relative+1":"anul viitor","dateFormatItem-yyyyQQQQ":"QQQQ y G","dateTimeFormat-short":"{1}, {0}","dateFormatItem-Hms":"HH:mm:ss","dateFormatItem-hms":"h:mm:ss a","dateFormatItem-GyMMM":"MMM y G","field-mon-relative+-1":"lunea trecută","dateFormatItem-yyyy":"y G","field-week-relative+0":"săptămâna aceasta","field-week-relative+1":"săptămâna viitoare"});
emmy41124/cdnjs
ajax/libs/dojo/1.10.0/cldr/nls/ro/generic.js
JavaScript
mit
3,223
/* Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ //>>built define("dojo/cldr/nls/hu/islamic",{"days-standAlone-short":["V","H","K","Sze","Cs","P","Szo"],"field-second-relative+0":"most","quarters-standAlone-narrow":["1.","2.","3.","4."],"field-weekday":"hét napja","field-wed-relative+0":"ez a szerda","field-wed-relative+1":"következő szerda","dateFormatItem-GyMMMEd":"G y. MMM d., E","dateFormatItem-MMMEd":"MMM d., E","eraNarrow":["MF"],"field-tue-relative+-1":"előző kedd","days-format-short":["V","H","K","Sze","Cs","P","Szo"],"dateFormat-long":"G y. MMMM d.","field-fri-relative+-1":"előző péntek","field-wed-relative+-1":"előző szerda","months-format-wide":["Moharrem","Safar","Rébi el avvel","Rébi el accher","Dsemádi el avvel","Dsemádi el accher","Redseb","Sabán","Ramadán","Sevvál","Dsül kade","Dsül hedse"],"dateFormatItem-yyyyQQQ":"G y. QQQ","dayPeriods-format-wide-pm":"du.","dateFormat-full":"G y. MMMM d., EEEE","dateFormatItem-yyyyMEd":"G y. MM. dd., E","field-thu-relative+-1":"előző csütörtök","dateFormatItem-Md":"M. d.","field-era":"éra","months-standAlone-wide":["Moharrem","Safar","Rébi I","Rébi II","Dsemádi I","Dsemádi II","Redseb","Sabán","Ramadán","Sevvál","Dsül kade","Dsül hedse"],"timeFormat-short":"H:mm","quarters-format-wide":["I. negyedév","II. negyedév","III. negyedév","IV. negyedév"],"timeFormat-long":"H:mm:ss z","field-year":"év","field-hour":"óra","months-format-abbr":["Moh.","Saf.","Rébi I","Rébi II","Dsem. I","Dsem. II","Red.","Sab.","Ram.","Sev.","Dsül k.","Dsül h."],"field-sat-relative+0":"ez a szombat","field-sat-relative+1":"következő szombat","timeFormat-full":"H:mm:ss zzzz","field-day-relative+0":"ma","field-thu-relative+0":"ez a csütörtök","field-day-relative+1":"holnap","field-thu-relative+1":"következő csütörtök","dateFormatItem-GyMMMd":"G y. MMM d.","field-day-relative+2":"holnapután","dateFormatItem-H":"H","months-standAlone-abbr":["Moh.","Saf.","Rébi I","Rébi II","Dsem. I","Dsem. II","Red.","Sab.","Ram.","Sev.","Dsül k.","Dsül h."],"quarters-format-abbr":["N1","N2","N3","N4"],"quarters-standAlone-wide":["1. negyedév","2. negyedév","3. negyedév","4. negyedév"],"dateFormatItem-Gy":"G y.","dateFormatItem-yyyyMMMEd":"G y. MMM d., E","days-standAlone-wide":["vasárnap","hétfő","kedd","szerda","csütörtök","péntek","szombat"],"dateFormatItem-yyyyMMM":"G y. MMM","dateFormatItem-yyyyMMMd":"G y. MMM d.","timeFormat-medium":"H:mm:ss","field-sun-relative+0":"ez a vasárnap","dateFormatItem-Hm":"H:mm","field-sun-relative+1":"következő vasárnap","quarters-standAlone-abbr":["N1","N2","N3","N4"],"eraAbbr":["MF"],"field-minute":"perc","field-dayperiod":"napszak","days-standAlone-abbr":["V","H","K","Sze","Cs","P","Szo"],"quarters-format-narrow":["1.","2.","3.","4."],"field-day-relative+-1":"tegnap","dateFormatItem-h":"a h","dayPeriods-format-narrow-am":"de.","field-day-relative+-2":"tegnapelőtt","dateFormatItem-MMMd":"MMM d.","dateFormatItem-MEd":"M. d., E","field-fri-relative+0":"ez a péntek","field-fri-relative+1":"következő péntek","field-day":"nap","days-format-wide":["vasárnap","hétfő","kedd","szerda","csütörtök","péntek","szombat"],"field-zone":"időzóna","dateFormatItem-y":"G y.","months-standAlone-narrow":["1","2","3","4","5","6","7","8","9","10","11","12"],"field-year-relative+-1":"előző év","field-month-relative+-1":"előző hónap","dateFormatItem-hm":"a h:mm","days-format-abbr":["V","H","K","Sze","Cs","P","Szo"],"eraNames":["MF"],"days-format-narrow":["V","H","K","Sz","Cs","P","Sz"],"dateFormatItem-yyyyMd":"G y. MM. dd.","field-month":"hónap","days-standAlone-narrow":["V","H","K","Sz","Cs","P","Sz"],"field-tue-relative+0":"ez a kedd","field-tue-relative+1":"következő kedd","dayPeriods-format-wide-am":"de.","field-mon-relative+0":"ez a hétfő","field-mon-relative+1":"következő hétfő","dateFormat-short":"GGGGG y. M. d.","field-second":"másodperc","field-sat-relative+-1":"előző szombat","field-sun-relative+-1":"előző vasárnap","field-month-relative+0":"ez a hónap","field-month-relative+1":"következő hónap","dateFormatItem-Ed":"d., E","field-week":"hét","dateFormat-medium":"G y. MMM d.","field-year-relative+0":"ez az év","field-week-relative+-1":"előző hét","dateFormatItem-yyyyM":"G y. MM.","field-year-relative+1":"következő év","dayPeriods-format-narrow-pm":"du.","dateFormatItem-yyyyQQQQ":"G y. QQQQ","dateFormatItem-Hms":"H:mm:ss","dateFormatItem-hms":"a h:mm:ss","dateFormatItem-GyMMM":"G y. MMM","field-mon-relative+-1":"előző hétfő","dateFormatItem-yyyy":"G y.","field-week-relative+0":"ez a hét","field-week-relative+1":"következő hét"});
barkinet/cdnjs
ajax/libs/dojo/1.10.0/cldr/nls/hu/islamic.js
JavaScript
mit
4,814
<?php /** * List Table API: WP_Post_Comments_List_Table class * * @package WordPress * @subpackage Administration * @since 4.4.0 */ /** * Core class used to implement displaying post comments in a list table. * * @since 3.1.0 * @access private * * @see WP_Comments_List_Table */ class WP_Post_Comments_List_Table extends WP_Comments_List_Table { /** * * @return array */ protected function get_column_info() { return array( array( 'author' => __( 'Author' ), 'comment' => _x( 'Comment', 'column name' ), ), array(), array(), 'comment', ); } /** * * @return array */ protected function get_table_classes() { $classes = parent::get_table_classes(); $classes[] = 'wp-list-table'; $classes[] = 'comments-box'; return $classes; } /** * * @param bool $output_empty */ public function display( $output_empty = false ) { $singular = $this->_args['singular']; wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' ); ?> <table class="<?php echo implode( ' ', $this->get_table_classes() ); ?>" style="display:none;"> <tbody id="the-comment-list"<?php if ( $singular ) { echo " data-wp-lists='list:$singular'"; } ?>> <?php if ( ! $output_empty ) { $this->display_rows_or_placeholder(); } ?> </tbody> </table> <?php } /** * * @param bool $comment_status * @return int */ public function get_per_page( $comment_status = false ) { return 10; } }
florianduport/slowvan
wp-admin/includes/class-wp-post-comments-list-table.php
PHP
mit
1,472
(function() { "use strict"; CodeMirror.defineOption("foldGutter", false, function(cm, val, old) { if (old && old != CodeMirror.Init) { cm.clearGutter(cm.state.foldGutter.options.gutter); cm.state.foldGutter = null; cm.off("gutterClick", onGutterClick); cm.off("change", onChange); cm.off("viewportChange", onViewportChange); cm.off("fold", onFold); cm.off("unfold", onFold); cm.off("swapDoc", updateInViewport); } if (val) { cm.state.foldGutter = new State(parseOptions(val)); updateInViewport(cm); cm.on("gutterClick", onGutterClick); cm.on("change", onChange); cm.on("viewportChange", onViewportChange); cm.on("fold", onFold); cm.on("unfold", onFold); cm.on("swapDoc", updateInViewport); } }); var Pos = CodeMirror.Pos; function State(options) { this.options = options; this.from = this.to = 0; } function parseOptions(opts) { if (opts === true) opts = {}; if (opts.gutter == null) opts.gutter = "CodeMirror-foldgutter"; if (opts.indicatorOpen == null) opts.indicatorOpen = "CodeMirror-foldgutter-open"; if (opts.indicatorFolded == null) opts.indicatorFolded = "CodeMirror-foldgutter-folded"; return opts; } function isFolded(cm, line) { var marks = cm.findMarksAt(Pos(line)); for (var i = 0; i < marks.length; ++i) if (marks[i].__isFold && marks[i].find().from.line == line) return true; } function marker(spec) { if (typeof spec == "string") { var elt = document.createElement("div"); elt.className = spec; return elt; } else { return spec.cloneNode(true); } } function updateFoldInfo(cm, from, to) { var opts = cm.state.foldGutter.options, cur = from; cm.eachLine(from, to, function(line) { var mark = null; if (isFolded(cm, cur)) { mark = marker(opts.indicatorFolded); } else { var pos = Pos(cur, 0), func = opts.rangeFinder || CodeMirror.fold.auto; var range = func && func(cm, pos); if (range && range.from.line + 1 < range.to.line) mark = marker(opts.indicatorOpen); } cm.setGutterMarker(line, opts.gutter, mark); ++cur; }); } function updateInViewport(cm) { var vp = cm.getViewport(), state = cm.state.foldGutter; if (!state) return; cm.operation(function() { updateFoldInfo(cm, vp.from, vp.to); }); state.from = vp.from; state.to = vp.to; } function onGutterClick(cm, line, gutter) { var opts = cm.state.foldGutter.options; if (gutter != opts.gutter) return; cm.foldCode(Pos(line, 0), opts.rangeFinder); } function onChange(cm) { var state = cm.state.foldGutter, opts = cm.state.foldGutter.options; state.from = state.to = 0; clearTimeout(state.changeUpdate); state.changeUpdate = setTimeout(function() { updateInViewport(cm); }, opts.foldOnChangeTimeSpan || 600); } function onViewportChange(cm) { var state = cm.state.foldGutter, opts = cm.state.foldGutter.options; clearTimeout(state.changeUpdate); state.changeUpdate = setTimeout(function() { var vp = cm.getViewport(); if (state.from == state.to || vp.from - state.to > 20 || state.from - vp.to > 20) { updateInViewport(cm); } else { cm.operation(function() { if (vp.from < state.from) { updateFoldInfo(cm, vp.from, state.from); state.from = vp.from; } if (vp.to > state.to) { updateFoldInfo(cm, state.to, vp.to); state.to = vp.to; } }); } }, opts.updateViewportTimeSpan || 400); } function onFold(cm, from) { var state = cm.state.foldGutter, line = from.line; if (line >= state.from && line < state.to) updateFoldInfo(cm, line, line + 1); } })();
contolini/cdnjs
ajax/libs/codemirror/3.22.0/addon/fold/foldgutter.js
JavaScript
mit
3,874
/* NUGET: BEGIN LICENSE TEXT * * Microsoft grants you the right to use these script files for the sole * purpose of either: (i) interacting through your browser with the Microsoft * website or online service, subject to the applicable licensing or use * terms; or (ii) using the files as included with a Microsoft product subject * to that product's license terms. Microsoft reserves all other rights to the * files not expressly granted by Microsoft, whether by implication, estoppel * or otherwise. Insofar as a script file is dual licensed under GPL, * Microsoft neither took the code under GPL nor distributes it thereunder but * under the terms set out in this paragraph. All notices and licenses * below are for informational purposes only. * * NUGET: END LICENSE TEXT */ /* ** Unobtrusive validation support library for jQuery and jQuery Validate ** Copyright (C) Microsoft Corporation. All rights reserved. */ (function(a){var d=a.validator,b,e="unobtrusiveValidation";function c(a,b,c){a.rules[b]=c;if(a.message)a.messages[b]=a.message}function j(a){return a.replace(/^\s+|\s+$/g,"").split(/\s*,\s*/g)}function f(a){return a.replace(/([!"#$%&'()*+,./:;<=>?@\[\\\]^`{|}~])/g,"\\$1")}function h(a){return a.substr(0,a.lastIndexOf(".")+1)}function g(a,b){if(a.indexOf("*.")===0)a=a.replace("*.",b);return a}function m(c,e){var b=a(this).find("[data-valmsg-for='"+f(e[0].name)+"']"),d=b.attr("data-valmsg-replace"),g=d?a.parseJSON(d)!==false:null;b.removeClass("field-validation-valid").addClass("field-validation-error");c.data("unobtrusiveContainer",b);if(g){b.empty();c.removeClass("input-validation-error").appendTo(b)}else c.hide()}function l(e,d){var c=a(this).find("[data-valmsg-summary=true]"),b=c.find("ul");if(b&&b.length&&d.errorList.length){b.empty();c.addClass("validation-summary-errors").removeClass("validation-summary-valid");a.each(d.errorList,function(){a("<li />").html(this.message).appendTo(b)})}}function k(d){var b=d.data("unobtrusiveContainer"),c=b.attr("data-valmsg-replace"),e=c?a.parseJSON(c):null;if(b){b.addClass("field-validation-valid").removeClass("field-validation-error");d.removeData("unobtrusiveContainer");e&&b.empty()}}function n(){var b=a(this),c="__jquery_unobtrusive_validation_form_reset";if(b.data(c))return;b.data(c,true);try{b.data("validator").resetForm()}finally{b.removeData(c)}b.find(".validation-summary-errors").addClass("validation-summary-valid").removeClass("validation-summary-errors");b.find(".field-validation-error").addClass("field-validation-valid").removeClass("field-validation-error").removeData("unobtrusiveContainer").find(">*").removeData("unobtrusiveContainer")}function i(b){var c=a(b),f=c.data(e),i=a.proxy(n,b),g=d.unobtrusive.options||{},h=function(e,d){var c=g[e];c&&a.isFunction(c)&&c.apply(b,d)};if(!f){f={options:{errorClass:g.errorClass||"input-validation-error",errorElement:g.errorElement||"span",errorPlacement:function(){m.apply(b,arguments);h("errorPlacement",arguments)},invalidHandler:function(){l.apply(b,arguments);h("invalidHandler",arguments)},messages:{},rules:{},success:function(){k.apply(b,arguments);h("success",arguments)}},attachValidation:function(){c.off("reset."+e,i).on("reset."+e,i).validate(this.options)},validate:function(){c.validate();return c.valid()}};c.data(e,f)}return f}d.unobtrusive={adapters:[],parseElement:function(b,h){var d=a(b),f=d.parents("form")[0],c,e,g;if(!f)return;c=i(f);c.options.rules[b.name]=e={};c.options.messages[b.name]=g={};a.each(this.adapters,function(){var c="data-val-"+this.name,i=d.attr(c),h={};if(i!==undefined){c+="-";a.each(this.params,function(){h[this]=d.attr(c+this)});this.adapt({element:b,form:f,message:i,params:h,rules:e,messages:g})}});a.extend(e,{__dummy__:true});!h&&c.attachValidation()},parse:function(c){var b=a(c),e=b.parents().addBack().filter("form").add(b.find("form")).has("[data-val=true]");b.find("[data-val=true]").each(function(){d.unobtrusive.parseElement(this,true)});e.each(function(){var a=i(this);a&&a.attachValidation()})}};b=d.unobtrusive.adapters;b.add=function(c,a,b){if(!b){b=a;a=[]}this.push({name:c,params:a,adapt:b});return this};b.addBool=function(a,b){return this.add(a,function(d){c(d,b||a,true)})};b.addMinMax=function(e,g,f,a,d,b){return this.add(e,[d||"min",b||"max"],function(b){var e=b.params.min,d=b.params.max;if(e&&d)c(b,a,[e,d]);else if(e)c(b,g,e);else d&&c(b,f,d)})};b.addSingleVal=function(a,b,d){return this.add(a,[b||"val"],function(e){c(e,d||a,e.params[b])})};d.addMethod("__dummy__",function(){return true});d.addMethod("regex",function(b,c,d){var a;if(this.optional(c))return true;a=(new RegExp(d)).exec(b);return a&&a.index===0&&a[0].length===b.length});d.addMethod("nonalphamin",function(c,d,b){var a;if(b){a=c.match(/\W/g);a=a&&a.length>=b}return a});if(d.methods.extension){b.addSingleVal("accept","mimtype");b.addSingleVal("extension","extension")}else b.addSingleVal("extension","extension","accept");b.addSingleVal("regex","pattern");b.addBool("creditcard").addBool("date").addBool("digits").addBool("email").addBool("number").addBool("url");b.addMinMax("length","minlength","maxlength","rangelength").addMinMax("range","min","max","range");b.addMinMax("minlength","minlength").addMinMax("maxlength","minlength","maxlength");b.add("equalto",["other"],function(b){var i=h(b.element.name),j=b.params.other,d=g(j,i),e=a(b.form).find(":input").filter("[name='"+f(d)+"']")[0];c(b,"equalTo",e)});b.add("required",function(a){(a.element.tagName.toUpperCase()!=="INPUT"||a.element.type.toUpperCase()!=="CHECKBOX")&&c(a,"required",true)});b.add("remote",["url","type","additionalfields"],function(b){var d={url:b.params.url,type:b.params.type||"GET",data:{}},e=h(b.element.name);a.each(j(b.params.additionalfields||b.element.name),function(i,h){var c=g(h,e);d.data[c]=function(){var d=a(b.form).find(":input").filter("[name='"+f(c)+"']");return d.is(":checkbox")?d.filter(":checked").val()||d.filter(":hidden").val()||"":d.is(":radio")?d.filter(":checked").val()||"":d.val()}});c(b,"remote",d)});b.add("password",["min","nonalphamin","regex"],function(a){a.params.min&&c(a,"minlength",a.params.min);a.params.nonalphamin&&c(a,"nonalphamin",a.params.nonalphamin);a.params.regex&&c(a,"regex",a.params.regex)});a(function(){d.unobtrusive.parse(document)})})(jQuery);
Brickable/BrickWizardDemo
src/Scripts/jquery.validate.unobtrusive.min.js
JavaScript
mit
6,272
var util = require('util') var eos = require('end-of-stream') var headers = require('./headers') var Readable = require('readable-stream').Readable var Writable = require('readable-stream').Writable var PassThrough = require('readable-stream').PassThrough var END_OF_TAR = new Buffer(1024) END_OF_TAR.fill(0) var noop = function() {} var overflow = function(self, size) { size &= 511 if (size) self.push(END_OF_TAR.slice(0, 512 - size)) } var Sink = function(to) { Writable.call(this) this.written = 0 this._to = to this._destroyed = false } util.inherits(Sink, Writable) Sink.prototype._write = function(data, enc, cb) { this.written += data.length if (this._to.push(data)) return cb() this._to._drain = cb } Sink.prototype.destroy = function() { if (this._destroyed) return this._destroyed = true this.emit('close') } var Void = function() { Writable.call(this) this._destroyed = false } util.inherits(Void, Writable) Void.prototype._write = function(data, enc, cb) { cb(new Error('No body allowed for this entry')) } Void.prototype.destroy = function() { if (this._destroyed) return this._destroyed = true this.emit('close') } var Pack = function(opts) { if (!(this instanceof Pack)) return new Pack(opts) Readable.call(this, opts) this._drain = noop this._finalized = false this._finalizing = false this._destroyed = false this._stream = null } util.inherits(Pack, Readable) Pack.prototype.entry = function(header, buffer, callback) { if (this._stream) throw new Error('already piping an entry') if (this._finalized || this._destroyed) return if (typeof buffer === 'function') { callback = buffer buffer = null } if (!callback) callback = noop var self = this if (!header.size) header.size = 0 if (!header.type) header.type = 'file' if (!header.mode) header.mode = header.type === 'directory' ? 0755 : 0644 if (!header.uid) header.uid = 0 if (!header.gid) header.gid = 0 if (!header.mtime) header.mtime = new Date() if (typeof buffer === 'string') buffer = new Buffer(buffer) if (Buffer.isBuffer(buffer)) { header.size = buffer.length this._encode(header) this.push(buffer) overflow(self, header.size) process.nextTick(callback) return new Void() } if (header.type !== 'file' && header.type !== 'contigious-file') { this._encode(header) process.nextTick(callback) return new Void() } var sink = new Sink(this) this._encode(header) this._stream = sink eos(sink, function(err) { self._stream = null if (err) { // stream was closed self.destroy() return callback(err) } if (sink.written !== header.size) { // corrupting tar self.destroy() return callback(new Error('size mismatch')) } overflow(self, header.size) if (self._finalizing) self.finalize() callback() }) return sink } Pack.prototype.finalize = function() { if (this._stream) { this._finalizing = true return } if (this._finalized) return this._finalized = true this.push(END_OF_TAR) this.push(null) } Pack.prototype.destroy = function(err) { if (this._destroyed) return this._destroyed = true if (err) this.emit('error', err) this.emit('close') if (this._stream && this._stream.destroy) this._stream.destroy() } Pack.prototype._encode = function(header) { var buf = headers.encode(header) if (buf) this.push(buf) else this._encodePax(header) } Pack.prototype._encodePax = function(header) { var paxHeader = headers.encodePax({ name: header.name, linkname: header.linkname }) var newHeader = { name: 'PaxHeader', mode: header.mode, uid: header.uid, gid: header.gid, size: paxHeader.length, mtime: header.mtime, type: 'pax-header', linkname: header.linkname && 'PaxHeader', uname: header.uname, gname: header.gname, devmajor: header.devmajor, devminor: header.devminor } this.push(headers.encode(newHeader)) this.push(paxHeader) overflow(this, paxHeader.length) newHeader.size = header.size newHeader.type = header.type this.push(headers.encode(newHeader)) } Pack.prototype._read = function(n) { var drain = this._drain this._drain = noop drain() } module.exports = Pack
natewscott/holy_grail
node_modules/grunt-contrib-imagemin/node_modules/imagemin/node_modules/imagemin-optipng/node_modules/optipng-bin/node_modules/bin-build/node_modules/download/node_modules/decompress-targz/node_modules/tar-stream/pack.js
JavaScript
mit
4,291
// Load modules var Code = require('code'); var Hoek = require('../lib'); var Lab = require('lab'); // Declare internals var internals = {}; // Test shortcuts var lab = exports.lab = Lab.script(); var describe = lab.experiment; var it = lab.test; var expect = Code.expect; describe('escapeJavaScript()', function () { it('encodes / characters', function (done) { var encoded = Hoek.escapeJavaScript('<script>alert(1)</script>'); expect(encoded).to.equal('\\x3cscript\\x3ealert\\x281\\x29\\x3c\\x2fscript\\x3e'); done(); }); it('encodes \' characters', function (done) { var encoded = Hoek.escapeJavaScript('something(\'param\')'); expect(encoded).to.equal('something\\x28\\x27param\\x27\\x29'); done(); }); it('encodes large unicode characters with the correct padding', function (done) { var encoded = Hoek.escapeJavaScript(String.fromCharCode(500) + String.fromCharCode(1000)); expect(encoded).to.equal('\\u0500\\u1000'); done(); }); it('doesn\'t throw an exception when passed null', function (done) { var encoded = Hoek.escapeJavaScript(null); expect(encoded).to.equal(''); done(); }); }); describe('escapeHtml()', function () { it('encodes / characters', function (done) { var encoded = Hoek.escapeHtml('<script>alert(1)</script>'); expect(encoded).to.equal('&lt;script&gt;alert&#x28;1&#x29;&lt;&#x2f;script&gt;'); done(); }); it('encodes < and > as named characters', function (done) { var encoded = Hoek.escapeHtml('<script><>'); expect(encoded).to.equal('&lt;script&gt;&lt;&gt;'); done(); }); it('encodes large unicode characters', function (done) { var encoded = Hoek.escapeHtml(String.fromCharCode(500) + String.fromCharCode(1000)); expect(encoded).to.equal('&#500;&#1000;'); done(); }); it('doesn\'t throw an exception when passed null', function (done) { var encoded = Hoek.escapeHtml(null); expect(encoded).to.equal(''); done(); }); it('encodes {} characters', function (done) { var encoded = Hoek.escapeHtml('{}'); expect(encoded).to.equal('&#x7b;&#x7d;'); done(); }); });
hnoerdli/hussa
node_modules/gulp-sass/node_modules/node-sass/node_modules/request/node_modules/hawk/node_modules/hoek/test/escaper.js
JavaScript
mit
2,303
webshims.validityMessages["zh-CN"]={typeMismatch:{email:"\u8bf7\u8f93\u5165\u7535\u5b50\u90ae\u4ef6\u5730\u5740\u3002",url:"\u8bf7\u8f93\u5165\u4e00\u4e2a URL\u3002"},badInput:{number:"\u503c\u65e0\u6548\u3002",date:"\u503c\u65e0\u6548\u3002",time:"\u503c\u65e0\u6548\u3002",range:"\u503c\u65e0\u6548\u3002","datetime-local":"\u503c\u65e0\u6548\u3002"},tooLong:"\u503c\u65e0\u6548\u3002",patternMismatch:"\u8bf7\u5339\u914d\u8981\u6c42\u7684\u683c\u5f0f\uff1a {%title}\u3002",valueMissing:{defaultMessage:"\u8bf7\u586b\u5199\u6b64\u5b57\u6bb5\u3002",checkbox:"\u82e5\u8981\u7ee7\u7eed\uff0c\u8bf7\u68c0\u9009\u6b64\u68c0\u67e5\u6846\u3002",select:"\u8bf7\u9009\u62e9\u5217\u8868\u4e2d\u7684\u4e00\u9879\u3002",radio:"\u8bf7\u9009\u62e9\u4e00\u4e2a\u9009\u9879\u3002"},rangeUnderflow:{defaultMessage:"\u503c\u65e0\u6548\u3002",date:"\u503c\u65e0\u6548\u3002",time:"\u503c\u65e0\u6548\u3002","datetime-local":"\u503c\u65e0\u6548\u3002"},rangeOverflow:{defaultMessage:"\u503c\u65e0\u6548\u3002",date:"\u503c\u65e0\u6548\u3002",time:"\u503c\u65e0\u6548\u3002","datetime-local":"\u503c\u65e0\u6548\u3002"},stepMismatch:"\u503c\u65e0\u6548\u3002"},webshims.formcfg["zh-CN"]={numberFormat:{".":".",",":","},numberSigns:".",dateSigns:"-",timeSigns:":. ",dFormat:"-",patterns:{d:"yy-mm-dd"},date:{closeText:"\u5173\u95ed",prevText:"&#x3C;\u4e0a\u6708",nextText:"\u4e0b\u6708&#x3E;",currentText:"\u4eca\u5929",monthNames:["\u4e00\u6708","\u4e8c\u6708","\u4e09\u6708","\u56db\u6708","\u4e94\u6708","\u516d\u6708","\u4e03\u6708","\u516b\u6708","\u4e5d\u6708","\u5341\u6708","\u5341\u4e00\u6708","\u5341\u4e8c\u6708"],monthNamesShort:["\u4e00\u6708","\u4e8c\u6708","\u4e09\u6708","\u56db\u6708","\u4e94\u6708","\u516d\u6708","\u4e03\u6708","\u516b\u6708","\u4e5d\u6708","\u5341\u6708","\u5341\u4e00\u6708","\u5341\u4e8c\u6708"],dayNames:["\u661f\u671f\u65e5","\u661f\u671f\u4e00","\u661f\u671f\u4e8c","\u661f\u671f\u4e09","\u661f\u671f\u56db","\u661f\u671f\u4e94","\u661f\u671f\u516d"],dayNamesShort:["\u5468\u65e5","\u5468\u4e00","\u5468\u4e8c","\u5468\u4e09","\u5468\u56db","\u5468\u4e94","\u5468\u516d"],dayNamesMin:["\u65e5","\u4e00","\u4e8c","\u4e09","\u56db","\u4e94","\u516d"],weekHeader:"\u5468",firstDay:1,isRTL:!1,showMonthAfterYear:!0,yearSuffix:"\u5e74"}};
marxo/cdnjs
ajax/libs/webshim/1.12.4/minified/shims/i18n/formcfg-ch-CN.js
JavaScript
mit
2,255
// Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. // a transform stream is a readable/writable stream where you do // something with the data. Sometimes it's called a "filter", // but that's not a great name for it, since that implies a thing where // some bits pass through, and others are simply ignored. (That would // be a valid example of a transform, of course.) // // While the output is causally related to the input, it's not a // necessarily symmetric or synchronous transformation. For example, // a zlib stream might take multiple plain-text writes(), and then // emit a single compressed chunk some time in the future. // // Here's how this works: // // The Transform stream has all the aspects of the readable and writable // stream classes. When you write(chunk), that calls _write(chunk,cb) // internally, and returns false if there's a lot of pending writes // buffered up. When you call read(), that calls _read(n) until // there's enough pending readable data buffered up. // // In a transform stream, the written data is placed in a buffer. When // _read(n) is called, it transforms the queued up data, calling the // buffered _write cb's as it consumes chunks. If consuming a single // written chunk would result in multiple output chunks, then the first // outputted bit calls the readcb, and subsequent chunks just go into // the read buffer, and will cause it to emit 'readable' if necessary. // // This way, back-pressure is actually determined by the reading side, // since _read has to be called to start processing a new chunk. However, // a pathological inflate type of transform can cause excessive buffering // here. For example, imagine a stream where every byte of input is // interpreted as an integer from 0-255, and then results in that many // bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in // 1kb of data being output. In this case, you could write a very small // amount of input, and end up with a very large amount of output. In // such a pathological inflating mechanism, there'd be no way to tell // the system to stop doing the transform. A single 4MB write could // cause the system to run out of memory. // // However, even in such a pathological case, only a single written chunk // would be consumed, and then the rest would wait (un-transformed) until // the results of the previous transformed chunk were consumed. module.exports = Transform; var Duplex = require('./_stream_duplex'); /*<replacement>*/ var util = require('core-util-is'); util.inherits = require('inherits'); /*</replacement>*/ util.inherits(Transform, Duplex); function TransformState(options, stream) { this.afterTransform = function(er, data) { return afterTransform(stream, er, data); }; this.needTransform = false; this.transforming = false; this.writecb = null; this.writechunk = null; } function afterTransform(stream, er, data) { var ts = stream._transformState; ts.transforming = false; var cb = ts.writecb; if (!cb) return stream.emit('error', new Error('no writecb in Transform class')); ts.writechunk = null; ts.writecb = null; if (data !== null && data !== undefined) stream.push(data); if (cb) cb(er); var rs = stream._readableState; rs.reading = false; if (rs.needReadable || rs.length < rs.highWaterMark) { stream._read(rs.highWaterMark); } } function Transform(options) { if (!(this instanceof Transform)) return new Transform(options); Duplex.call(this, options); var ts = this._transformState = new TransformState(options, this); // when the writable side finishes, then flush out anything remaining. var stream = this; // start out asking for a readable event once data is transformed. this._readableState.needReadable = true; // we have implemented the _read method, and done the other things // that Readable wants before the first _read call, so unset the // sync guard flag. this._readableState.sync = false; this.once('finish', function() { if ('function' === typeof this._flush) this._flush(function(er) { done(stream, er); }); else done(stream); }); } Transform.prototype.push = function(chunk, encoding) { this._transformState.needTransform = false; return Duplex.prototype.push.call(this, chunk, encoding); }; // This is the part where you do stuff! // override this function in implementation classes. // 'chunk' is an input chunk. // // Call `push(newChunk)` to pass along transformed output // to the readable side. You may call 'push' zero or more times. // // Call `cb(err)` when you are done with this chunk. If you pass // an error, then that'll put the hurt on the whole operation. If you // never call cb(), then you'll never get another chunk. Transform.prototype._transform = function(chunk, encoding, cb) { throw new Error('not implemented'); }; Transform.prototype._write = function(chunk, encoding, cb) { var ts = this._transformState; ts.writecb = cb; ts.writechunk = chunk; ts.writeencoding = encoding; if (!ts.transforming) { var rs = this._readableState; if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); } }; // Doesn't matter what the args are here. // _transform does all the work. // That we got here means that the readable side wants more data. Transform.prototype._read = function(n) { var ts = this._transformState; if (ts.writechunk !== null && ts.writecb && !ts.transforming) { ts.transforming = true; this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); } else { // mark that we need a transform, so that any data that comes in // will get processed, now that we've asked for it. ts.needTransform = true; } }; function done(stream, er) { if (er) return stream.emit('error', er); // if there's nothing in the write buffer, then that means // that nothing more will ever be provided var ws = stream._writableState; var rs = stream._readableState; var ts = stream._transformState; if (ws.length) throw new Error('calling transform done when ws.length != 0'); if (ts.transforming) throw new Error('calling transform done when still transforming'); return stream.push(null); }
wangwei1237/promises-book
node_modules/gulp-inlining-node-require/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js
JavaScript
mit
7,396
// Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. // a transform stream is a readable/writable stream where you do // something with the data. Sometimes it's called a "filter", // but that's not a great name for it, since that implies a thing where // some bits pass through, and others are simply ignored. (That would // be a valid example of a transform, of course.) // // While the output is causally related to the input, it's not a // necessarily symmetric or synchronous transformation. For example, // a zlib stream might take multiple plain-text writes(), and then // emit a single compressed chunk some time in the future. // // Here's how this works: // // The Transform stream has all the aspects of the readable and writable // stream classes. When you write(chunk), that calls _write(chunk,cb) // internally, and returns false if there's a lot of pending writes // buffered up. When you call read(), that calls _read(n) until // there's enough pending readable data buffered up. // // In a transform stream, the written data is placed in a buffer. When // _read(n) is called, it transforms the queued up data, calling the // buffered _write cb's as it consumes chunks. If consuming a single // written chunk would result in multiple output chunks, then the first // outputted bit calls the readcb, and subsequent chunks just go into // the read buffer, and will cause it to emit 'readable' if necessary. // // This way, back-pressure is actually determined by the reading side, // since _read has to be called to start processing a new chunk. However, // a pathological inflate type of transform can cause excessive buffering // here. For example, imagine a stream where every byte of input is // interpreted as an integer from 0-255, and then results in that many // bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in // 1kb of data being output. In this case, you could write a very small // amount of input, and end up with a very large amount of output. In // such a pathological inflating mechanism, there'd be no way to tell // the system to stop doing the transform. A single 4MB write could // cause the system to run out of memory. // // However, even in such a pathological case, only a single written chunk // would be consumed, and then the rest would wait (un-transformed) until // the results of the previous transformed chunk were consumed. module.exports = Transform; var Duplex = require('./_stream_duplex'); /*<replacement>*/ var util = require('core-util-is'); util.inherits = require('inherits'); /*</replacement>*/ util.inherits(Transform, Duplex); function TransformState(options, stream) { this.afterTransform = function(er, data) { return afterTransform(stream, er, data); }; this.needTransform = false; this.transforming = false; this.writecb = null; this.writechunk = null; } function afterTransform(stream, er, data) { var ts = stream._transformState; ts.transforming = false; var cb = ts.writecb; if (!cb) return stream.emit('error', new Error('no writecb in Transform class')); ts.writechunk = null; ts.writecb = null; if (data !== null && data !== undefined) stream.push(data); if (cb) cb(er); var rs = stream._readableState; rs.reading = false; if (rs.needReadable || rs.length < rs.highWaterMark) { stream._read(rs.highWaterMark); } } function Transform(options) { if (!(this instanceof Transform)) return new Transform(options); Duplex.call(this, options); var ts = this._transformState = new TransformState(options, this); // when the writable side finishes, then flush out anything remaining. var stream = this; // start out asking for a readable event once data is transformed. this._readableState.needReadable = true; // we have implemented the _read method, and done the other things // that Readable wants before the first _read call, so unset the // sync guard flag. this._readableState.sync = false; this.once('finish', function() { if ('function' === typeof this._flush) this._flush(function(er) { done(stream, er); }); else done(stream); }); } Transform.prototype.push = function(chunk, encoding) { this._transformState.needTransform = false; return Duplex.prototype.push.call(this, chunk, encoding); }; // This is the part where you do stuff! // override this function in implementation classes. // 'chunk' is an input chunk. // // Call `push(newChunk)` to pass along transformed output // to the readable side. You may call 'push' zero or more times. // // Call `cb(err)` when you are done with this chunk. If you pass // an error, then that'll put the hurt on the whole operation. If you // never call cb(), then you'll never get another chunk. Transform.prototype._transform = function(chunk, encoding, cb) { throw new Error('not implemented'); }; Transform.prototype._write = function(chunk, encoding, cb) { var ts = this._transformState; ts.writecb = cb; ts.writechunk = chunk; ts.writeencoding = encoding; if (!ts.transforming) { var rs = this._readableState; if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); } }; // Doesn't matter what the args are here. // _transform does all the work. // That we got here means that the readable side wants more data. Transform.prototype._read = function(n) { var ts = this._transformState; if (ts.writechunk !== null && ts.writecb && !ts.transforming) { ts.transforming = true; this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); } else { // mark that we need a transform, so that any data that comes in // will get processed, now that we've asked for it. ts.needTransform = true; } }; function done(stream, er) { if (er) return stream.emit('error', er); // if there's nothing in the write buffer, then that means // that nothing more will ever be provided var ws = stream._writableState; var rs = stream._readableState; var ts = stream._transformState; if (ws.length) throw new Error('calling transform done when ws.length != 0'); if (ts.transforming) throw new Error('calling transform done when still transforming'); return stream.push(null); }
kenjiyamamoto/Sandbox
node_modules/grunt-contrib-imagemin/node_modules/imagemin/node_modules/imagemin-gifsicle/node_modules/gifsicle/node_modules/bin-build/node_modules/download/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_transform.js
JavaScript
mit
7,396
// CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS mod(require("../../lib/codemirror")); else if (typeof define == "function" && define.amd) // AMD define(["../../lib/codemirror"], mod); else // Plain browser env mod(CodeMirror); })(function(CodeMirror) { "use strict"; CodeMirror.defineMode("sql", function(config, parserConfig) { "use strict"; var client = parserConfig.client || {}, atoms = parserConfig.atoms || {"false": true, "true": true, "null": true}, builtin = parserConfig.builtin || {}, keywords = parserConfig.keywords || {}, operatorChars = parserConfig.operatorChars || /^[*+\-%<>!=&|~^]/, support = parserConfig.support || {}, hooks = parserConfig.hooks || {}, dateSQL = parserConfig.dateSQL || {"date" : true, "time" : true, "timestamp" : true}; function tokenBase(stream, state) { var ch = stream.next(); // call hooks from the mime type if (hooks[ch]) { var result = hooks[ch](stream, state); if (result !== false) return result; } if (support.hexNumber == true && ((ch == "0" && stream.match(/^[xX][0-9a-fA-F]+/)) || (ch == "x" || ch == "X") && stream.match(/^'[0-9a-fA-F]+'/))) { // hex // ref: http://dev.mysql.com/doc/refman/5.5/en/hexadecimal-literals.html return "number"; } else if (support.binaryNumber == true && (((ch == "b" || ch == "B") && stream.match(/^'[01]+'/)) || (ch == "0" && stream.match(/^b[01]+/)))) { // bitstring // ref: http://dev.mysql.com/doc/refman/5.5/en/bit-field-literals.html return "number"; } else if (ch.charCodeAt(0) > 47 && ch.charCodeAt(0) < 58) { // numbers // ref: http://dev.mysql.com/doc/refman/5.5/en/number-literals.html stream.match(/^[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/); support.decimallessFloat == true && stream.eat('.'); return "number"; } else if (ch == "?" && (stream.eatSpace() || stream.eol() || stream.eat(";"))) { // placeholders return "variable-3"; } else if (ch == "'" || (ch == '"' && support.doubleQuote)) { // strings // ref: http://dev.mysql.com/doc/refman/5.5/en/string-literals.html state.tokenize = tokenLiteral(ch); return state.tokenize(stream, state); } else if ((((support.nCharCast == true && (ch == "n" || ch == "N")) || (support.charsetCast == true && ch == "_" && stream.match(/[a-z][a-z0-9]*/i))) && (stream.peek() == "'" || stream.peek() == '"'))) { // charset casting: _utf8'str', N'str', n'str' // ref: http://dev.mysql.com/doc/refman/5.5/en/string-literals.html return "keyword"; } else if (/^[\(\),\;\[\]]/.test(ch)) { // no highlighting return null; } else if (support.commentSlashSlash && ch == "/" && stream.eat("/")) { // 1-line comment stream.skipToEnd(); return "comment"; } else if ((support.commentHash && ch == "#") || (ch == "-" && stream.eat("-") && (!support.commentSpaceRequired || stream.eat(" ")))) { // 1-line comments // ref: https://kb.askmonty.org/en/comment-syntax/ stream.skipToEnd(); return "comment"; } else if (ch == "/" && stream.eat("*")) { // multi-line comments // ref: https://kb.askmonty.org/en/comment-syntax/ state.tokenize = tokenComment; return state.tokenize(stream, state); } else if (ch == ".") { // .1 for 0.1 if (support.zerolessFloat == true && stream.match(/^(?:\d+(?:e[+-]?\d+)?)/i)) { return "number"; } // .table_name (ODBC) // // ref: http://dev.mysql.com/doc/refman/5.6/en/identifier-qualifiers.html if (support.ODBCdotTable == true && stream.match(/^[a-zA-Z_]+/)) { return "variable-2"; } } else if (operatorChars.test(ch)) { // operators stream.eatWhile(operatorChars); return null; } else if (ch == '{' && (stream.match(/^( )*(d|D|t|T|ts|TS)( )*'[^']*'( )*}/) || stream.match(/^( )*(d|D|t|T|ts|TS)( )*"[^"]*"( )*}/))) { // dates (weird ODBC syntax) // ref: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-literals.html return "number"; } else { stream.eatWhile(/^[_\w\d]/); var word = stream.current().toLowerCase(); // dates (standard SQL syntax) // ref: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-literals.html if (dateSQL.hasOwnProperty(word) && (stream.match(/^( )+'[^']*'/) || stream.match(/^( )+"[^"]*"/))) return "number"; if (atoms.hasOwnProperty(word)) return "atom"; if (builtin.hasOwnProperty(word)) return "builtin"; if (keywords.hasOwnProperty(word)) return "keyword"; if (client.hasOwnProperty(word)) return "string-2"; return null; } } // 'string', with char specified in quote escaped by '\' function tokenLiteral(quote) { return function(stream, state) { var escaped = false, ch; while ((ch = stream.next()) != null) { if (ch == quote && !escaped) { state.tokenize = tokenBase; break; } escaped = !escaped && ch == "\\"; } return "string"; }; } function tokenComment(stream, state) { while (true) { if (stream.skipTo("*")) { stream.next(); if (stream.eat("/")) { state.tokenize = tokenBase; break; } } else { stream.skipToEnd(); break; } } return "comment"; } function pushContext(stream, state, type) { state.context = { prev: state.context, indent: stream.indentation(), col: stream.column(), type: type }; } function popContext(state) { state.indent = state.context.indent; state.context = state.context.prev; } return { startState: function() { return {tokenize: tokenBase, context: null}; }, token: function(stream, state) { if (stream.sol()) { if (state.context && state.context.align == null) state.context.align = false; } if (stream.eatSpace()) return null; var style = state.tokenize(stream, state); if (style == "comment") return style; if (state.context && state.context.align == null) state.context.align = true; var tok = stream.current(); if (tok == "(") pushContext(stream, state, ")"); else if (tok == "[") pushContext(stream, state, "]"); else if (state.context && state.context.type == tok) popContext(state); return style; }, indent: function(state, textAfter) { var cx = state.context; if (!cx) return CodeMirror.Pass; var closing = textAfter.charAt(0) == cx.type; if (cx.align) return cx.col + (closing ? 0 : 1); else return cx.indent + (closing ? 0 : config.indentUnit); }, blockCommentStart: "/*", blockCommentEnd: "*/", lineComment: support.commentSlashSlash ? "//" : support.commentHash ? "#" : null }; }); (function() { "use strict"; // `identifier` function hookIdentifier(stream) { // MySQL/MariaDB identifiers // ref: http://dev.mysql.com/doc/refman/5.6/en/identifier-qualifiers.html var ch; while ((ch = stream.next()) != null) { if (ch == "`" && !stream.eat("`")) return "variable-2"; } stream.backUp(stream.current().length - 1); return stream.eatWhile(/\w/) ? "variable-2" : null; } // variable token function hookVar(stream) { // variables // @@prefix.varName @varName // varName can be quoted with ` or ' or " // ref: http://dev.mysql.com/doc/refman/5.5/en/user-variables.html if (stream.eat("@")) { stream.match(/^session\./); stream.match(/^local\./); stream.match(/^global\./); } if (stream.eat("'")) { stream.match(/^.*'/); return "variable-2"; } else if (stream.eat('"')) { stream.match(/^.*"/); return "variable-2"; } else if (stream.eat("`")) { stream.match(/^.*`/); return "variable-2"; } else if (stream.match(/^[0-9a-zA-Z$\.\_]+/)) { return "variable-2"; } return null; }; // short client keyword token function hookClient(stream) { // \N means NULL // ref: http://dev.mysql.com/doc/refman/5.5/en/null-values.html if (stream.eat("N")) { return "atom"; } // \g, etc // ref: http://dev.mysql.com/doc/refman/5.5/en/mysql-commands.html return stream.match(/^[a-zA-Z.#!?]/) ? "variable-2" : null; } // these keywords are used by all SQL dialects (however, a mode can still overwrite it) var sqlKeywords = "alter and as asc between by count create delete desc distinct drop from group having in insert into is join like not on or order select set table union update values where limit "; // turn a space-separated list into an array function set(str) { var obj = {}, words = str.split(" "); for (var i = 0; i < words.length; ++i) obj[words[i]] = true; return obj; } // A generic SQL Mode. It's not a standard, it just try to support what is generally supported CodeMirror.defineMIME("text/x-sql", { name: "sql", keywords: set(sqlKeywords + "begin"), builtin: set("bool boolean bit blob enum long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision real date datetime year unsigned signed decimal numeric"), atoms: set("false true null unknown"), operatorChars: /^[*+\-%<>!=]/, dateSQL: set("date time timestamp"), support: set("ODBCdotTable doubleQuote binaryNumber hexNumber") }); CodeMirror.defineMIME("text/x-mssql", { name: "sql", client: set("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"), keywords: set(sqlKeywords + "begin trigger proc view index for add constraint key primary foreign collate clustered nonclustered declare"), builtin: set("bigint numeric bit smallint decimal smallmoney int tinyint money float real char varchar text nchar nvarchar ntext binary varbinary image cursor timestamp hierarchyid uniqueidentifier sql_variant xml table "), atoms: set("false true null unknown"), operatorChars: /^[*+\-%<>!=]/, dateSQL: set("date datetimeoffset datetime2 smalldatetime datetime time"), hooks: { "@": hookVar } }); CodeMirror.defineMIME("text/x-mysql", { name: "sql", client: set("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"), keywords: set(sqlKeywords + "accessible action add after algorithm all analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general get global grant grants group group_concat handler hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show signal slave slow smallint snapshot soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"), builtin: set("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"), atoms: set("false true null unknown"), operatorChars: /^[*+\-%<>!=&|^]/, dateSQL: set("date time timestamp"), support: set("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"), hooks: { "@": hookVar, "`": hookIdentifier, "\\": hookClient } }); CodeMirror.defineMIME("text/x-mariadb", { name: "sql", client: set("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"), keywords: set(sqlKeywords + "accessible action add after algorithm all always analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general generated get global grant grants group groupby_concat handler hard hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password persistent phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show shutdown signal slave slow smallint snapshot soft soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views virtual warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"), builtin: set("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"), atoms: set("false true null unknown"), operatorChars: /^[*+\-%<>!=&|^]/, dateSQL: set("date time timestamp"), support: set("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"), hooks: { "@": hookVar, "`": hookIdentifier, "\\": hookClient } }); // the query language used by Apache Cassandra is called CQL, but this mime type // is called Cassandra to avoid confusion with Contextual Query Language CodeMirror.defineMIME("text/x-cassandra", { name: "sql", client: { }, keywords: set("add all allow alter and any apply as asc authorize batch begin by clustering columnfamily compact consistency count create custom delete desc distinct drop each_quorum exists filtering from grant if in index insert into key keyspace keyspaces level limit local_one local_quorum modify nan norecursive nosuperuser not of on one order password permission permissions primary quorum rename revoke schema select set storage superuser table three to token truncate ttl two type unlogged update use user users using values where with writetime"), builtin: set("ascii bigint blob boolean counter decimal double float frozen inet int list map static text timestamp timeuuid tuple uuid varchar varint"), atoms: set("false true infinity NaN"), operatorChars: /^[<>=]/, dateSQL: { }, support: set("commentSlashSlash decimallessFloat"), hooks: { } }); // this is based on Peter Raganitsch's 'plsql' mode CodeMirror.defineMIME("text/x-plsql", { name: "sql", client: set("appinfo arraysize autocommit autoprint autorecovery autotrace blockterminator break btitle cmdsep colsep compatibility compute concat copycommit copytypecheck define describe echo editfile embedded escape exec execute feedback flagger flush heading headsep instance linesize lno loboffset logsource long longchunksize markup native newpage numformat numwidth pagesize pause pno recsep recsepchar release repfooter repheader serveroutput shiftinout show showmode size spool sqlblanklines sqlcase sqlcode sqlcontinue sqlnumber sqlpluscompatibility sqlprefix sqlprompt sqlterminator suffix tab term termout time timing trimout trimspool ttitle underline verify version wrap"), keywords: set("abort accept access add all alter and any array arraylen as asc assert assign at attributes audit authorization avg base_table begin between binary_integer body boolean by case cast char char_base check close cluster clusters colauth column comment commit compress connect connected constant constraint crash create current currval cursor data_base database date dba deallocate debugoff debugon decimal declare default definition delay delete desc digits dispose distinct do drop else elseif elsif enable end entry escape exception exception_init exchange exclusive exists exit external fast fetch file for force form from function generic goto grant group having identified if immediate in increment index indexes indicator initial initrans insert interface intersect into is key level library like limited local lock log logging long loop master maxextents maxtrans member minextents minus mislabel mode modify multiset new next no noaudit nocompress nologging noparallel not nowait number_base object of off offline on online only open option or order out package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior private privileges procedure public raise range raw read rebuild record ref references refresh release rename replace resource restrict return returning returns reverse revoke rollback row rowid rowlabel rownum rows run savepoint schema segment select separate session set share snapshot some space split sql start statement storage subtype successful synonym tabauth table tables tablespace task terminate then to trigger truncate type union unique unlimited unrecoverable unusable update use using validate value values variable view views when whenever where while with work"), builtin: set("abs acos add_months ascii asin atan atan2 average bfile bfilename bigserial bit blob ceil character chartorowid chr clob concat convert cos cosh count dec decode deref dual dump dup_val_on_index empty error exp false float floor found glb greatest hextoraw initcap instr instrb int integer isopen last_day least length lengthb ln lower lpad ltrim lub make_ref max min mlslabel mod months_between natural naturaln nchar nclob new_time next_day nextval nls_charset_decl_len nls_charset_id nls_charset_name nls_initcap nls_lower nls_sort nls_upper nlssort no_data_found notfound null number numeric nvarchar2 nvl others power rawtohex real reftohex round rowcount rowidtochar rowtype rpad rtrim serial sign signtype sin sinh smallint soundex sqlcode sqlerrm sqrt stddev string substr substrb sum sysdate tan tanh to_char text to_date to_label to_multi_byte to_number to_single_byte translate true trunc uid unlogged upper user userenv varchar varchar2 variance varying vsize xml"), operatorChars: /^[*+\-%<>!=~]/, dateSQL: set("date time timestamp"), support: set("doubleQuote nCharCast zerolessFloat binaryNumber hexNumber") }); // Created to support specific hive keywords CodeMirror.defineMIME("text/x-hive", { name: "sql", keywords: set("select alter $elem$ $key$ $value$ add after all analyze and archive as asc before between binary both bucket buckets by cascade case cast change cluster clustered clusterstatus collection column columns comment compute concatenate continue create cross cursor data database databases dbproperties deferred delete delimited desc describe directory disable distinct distribute drop else enable end escaped exclusive exists explain export extended external false fetch fields fileformat first format formatted from full function functions grant group having hold_ddltime idxproperties if import in index indexes inpath inputdriver inputformat insert intersect into is items join keys lateral left like limit lines load local location lock locks mapjoin materialized minus msck no_drop nocompress not of offline on option or order out outer outputdriver outputformat overwrite partition partitioned partitions percent plus preserve procedure purge range rcfile read readonly reads rebuild recordreader recordwriter recover reduce regexp rename repair replace restrict revoke right rlike row schema schemas semi sequencefile serde serdeproperties set shared show show_database sort sorted ssl statistics stored streamtable table tables tablesample tblproperties temporary terminated textfile then tmp to touch transform trigger true unarchive undo union uniquejoin unlock update use using utc utc_tmestamp view when where while with"), builtin: set("bool boolean long timestamp tinyint smallint bigint int float double date datetime unsigned string array struct map uniontype"), atoms: set("false true null unknown"), operatorChars: /^[*+\-%<>!=]/, dateSQL: set("date timestamp"), support: set("ODBCdotTable doubleQuote binaryNumber hexNumber") }); CodeMirror.defineMIME("text/x-pgsql", { name: "sql", client: set("source"), // http://www.postgresql.org/docs/9.5/static/sql-keywords-appendix.html keywords: set(sqlKeywords + "a abort abs absent absolute access according action ada add admin after aggregate all allocate also always analyse analyze any are array array_agg array_max_cardinality asensitive assertion assignment asymmetric at atomic attribute attributes authorization avg backward base64 before begin begin_frame begin_partition bernoulli binary bit_length blob blocked bom both breadth c cache call called cardinality cascade cascaded case cast catalog catalog_name ceil ceiling chain characteristics characters character_length character_set_catalog character_set_name character_set_schema char_length check checkpoint class class_origin clob close cluster coalesce cobol collate collation collation_catalog collation_name collation_schema collect column columns column_name command_function command_function_code comment comments commit committed concurrently condition condition_number configuration conflict connect connection connection_name constraint constraints constraint_catalog constraint_name constraint_schema constructor contains content continue control conversion convert copy corr corresponding cost covar_pop covar_samp cross csv cube cume_dist current current_catalog current_date current_default_transform_group current_path current_role current_row current_schema current_time current_timestamp current_transform_group_for_type current_user cursor cursor_name cycle data database datalink datetime_interval_code datetime_interval_precision day db deallocate dec declare default defaults deferrable deferred defined definer degree delimiter delimiters dense_rank depth deref derived describe descriptor deterministic diagnostics dictionary disable discard disconnect dispatch dlnewcopy dlpreviouscopy dlurlcomplete dlurlcompleteonly dlurlcompletewrite dlurlpath dlurlpathonly dlurlpathwrite dlurlscheme dlurlserver dlvalue do document domain dynamic dynamic_function dynamic_function_code each element else empty enable encoding encrypted end end-exec end_frame end_partition enforced enum equals escape event every except exception exclude excluding exclusive exec execute exists exp explain expression extension external extract false family fetch file filter final first first_value flag float floor following for force foreign fortran forward found frame_row free freeze fs full function functions fusion g general generated get global go goto grant granted greatest grouping groups handler header hex hierarchy hold hour id identity if ignore ilike immediate immediately immutable implementation implicit import including increment indent index indexes indicator inherit inherits initially inline inner inout input insensitive instance instantiable instead integrity intersect intersection invoker isnull isolation k key key_member key_type label lag language large last last_value lateral lead leading leakproof least left length level library like_regex link listen ln load local localtime localtimestamp location locator lock locked logged lower m map mapping match matched materialized max maxvalue max_cardinality member merge message_length message_octet_length message_text method min minute minvalue mod mode modifies module month more move multiset mumps name names namespace national natural nchar nclob nesting new next nfc nfd nfkc nfkd nil no none normalize normalized nothing notify notnull nowait nth_value ntile null nullable nullif nulls number object occurrences_regex octets octet_length of off offset oids old only open operator option options ordering ordinality others out outer output over overlaps overlay overriding owned owner p pad parameter parameter_mode parameter_name parameter_ordinal_position parameter_specific_catalog parameter_specific_name parameter_specific_schema parser partial partition pascal passing passthrough password percent percentile_cont percentile_disc percent_rank period permission placing plans pli policy portion position position_regex power precedes preceding prepare prepared preserve primary prior privileges procedural procedure program public quote range rank read reads reassign recheck recovery recursive ref references referencing refresh regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy regr_syy reindex relative release rename repeatable replace replica requiring reset respect restart restore restrict result return returned_cardinality returned_length returned_octet_length returned_sqlstate returning returns revoke right role rollback rollup routine routine_catalog routine_name routine_schema row rows row_count row_number rule savepoint scale schema schema_name scope scope_catalog scope_name scope_schema scroll search second section security selective self sensitive sequence sequences serializable server server_name session session_user setof sets share show similar simple size skip snapshot some source space specific specifictype specific_name sql sqlcode sqlerror sqlexception sqlstate sqlwarning sqrt stable standalone start state statement static statistics stddev_pop stddev_samp stdin stdout storage strict strip structure style subclass_origin submultiset substring substring_regex succeeds sum symmetric sysid system system_time system_user t tables tablesample tablespace table_name temp template temporary then ties timezone_hour timezone_minute to token top_level_count trailing transaction transactions_committed transactions_rolled_back transaction_active transform transforms translate translate_regex translation treat trigger trigger_catalog trigger_name trigger_schema trim trim_array true truncate trusted type types uescape unbounded uncommitted under unencrypted unique unknown unlink unlisten unlogged unnamed unnest until untyped upper uri usage user user_defined_type_catalog user_defined_type_code user_defined_type_name user_defined_type_schema using vacuum valid validate validator value value_of varbinary variadic var_pop var_samp verbose version versioning view views volatile when whenever whitespace width_bucket window within work wrapper write xmlagg xmlattributes xmlbinary xmlcast xmlcomment xmlconcat xmldeclaration xmldocument xmlelement xmlexists xmlforest xmliterate xmlnamespaces xmlparse xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltext xmlvalidate year yes loop repeat"), // http://www.postgresql.org/docs/9.5/static/datatype.html builtin: set("bigint int8 bigserial serial8 bit varying varbit boolean bool box bytea character char varchar cidr circle date double precision float8 inet integer int int4 interval json jsonb line lseg macaddr money numeric decimal path pg_lsn point polygon real float4 smallint int2 smallserial serial2 serial serial4 text time without zone with timetz timestamp timestamptz tsquery tsvector txid_snapshot uuid xml"), atoms: set("false true null unknown"), operatorChars: /^[*+\-%<>!=&|^\/#@?~]/, dateSQL: set("date time timestamp"), support: set("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber nCharCast charsetCast") }); // Google's SQL-like query language, GQL CodeMirror.defineMIME("text/x-gql", { name: "sql", keywords: set("ancestor and asc by contains desc descendant distinct from group has in is limit offset on order select superset where"), atoms: set("false true"), builtin: set("blob datetime first key __key__ string integer double boolean null"), operatorChars: /^[*+\-%<>!=]/ }); }()); }); /* How Properties of Mime Types are used by SQL Mode ================================================= keywords: A list of keywords you want to be highlighted. builtin: A list of builtin types you want to be highlighted (if you want types to be of class "builtin" instead of "keyword"). operatorChars: All characters that must be handled as operators. client: Commands parsed and executed by the client (not the server). support: A list of supported syntaxes which are not common, but are supported by more than 1 DBMS. * ODBCdotTable: .tableName * zerolessFloat: .1 * doubleQuote * nCharCast: N'string' * charsetCast: _utf8'string' * commentHash: use # char for comments * commentSlashSlash: use // for comments * commentSpaceRequired: require a space after -- for comments atoms: Keywords that must be highlighted as atoms,. Some DBMS's support more atoms than others: UNKNOWN, INFINITY, UNDERFLOW, NaN... dateSQL: Used for date/time SQL standard syntax, because not all DBMS's support same temporal types. */
tszym/gogs
public/plugins/codemirror-5.17.0/mode/sql/sql.js
JavaScript
mit
34,202
.oo-ui-icon-articles{background-image:url(themes/apex/images/icons/articles-ltr.png);background-image:-webkit-linear-gradient(transparent,transparent),url(themes/apex/images/icons/articles-ltr.svg);background-image:linear-gradient(transparent,transparent),url(themes/apex/images/icons/articles-ltr.svg);background-image:-o-linear-gradient(transparent,transparent),url(themes/apex/images/icons/articles-ltr.png)}.oo-ui-icon-articleRedirect{background-image:url(themes/apex/images/icons/articleRedirect-ltr.png);background-image:-webkit-linear-gradient(transparent,transparent),url(themes/apex/images/icons/articleRedirect-ltr.svg);background-image:linear-gradient(transparent,transparent),url(themes/apex/images/icons/articleRedirect-ltr.svg);background-image:-o-linear-gradient(transparent,transparent),url(themes/apex/images/icons/articleRedirect-ltr.png)}.oo-ui-icon-upload{background-image:url(themes/apex/images/icons/upload-ltr.png);background-image:-webkit-linear-gradient(transparent,transparent),url(themes/apex/images/icons/upload-ltr.svg);background-image:linear-gradient(transparent,transparent),url(themes/apex/images/icons/upload-ltr.svg);background-image:-o-linear-gradient(transparent,transparent),url(themes/apex/images/icons/upload-ltr.png)}
Amomo/cdnjs
ajax/libs/oojs-ui/0.19.4/oojs-ui-apex-icons-content.min.css
CSS
mit
1,258
/*! AnythingSlider v1.9.0 minified using Google Closure Compiler Original by Chris Coyier: http://css-tricks.com Get the latest version: https://github.com/CSS-Tricks/AnythingSlider */ ;(function(d,m,l){d.anythingSlider=function(j,p){var a=this,b,k;a.el=j;a.$el=d(j).addClass("anythingBase").wrap('<div class="anythingSlider"><div class="anythingWindow" /></div>');a.$el.data("AnythingSlider",a);a.init=function(){a.options=b=d.extend({},d.anythingSlider.defaults,p);a.initialized=!1;d.isFunction(b.onBeforeInitialize)&&a.$el.bind("before_initialize",b.onBeforeInitialize);a.$el.trigger("before_initialize",a);d('\x3c!--[if lte IE 8]><script>jQuery("body").addClass("as-oldie");\x3c/script><![endif]--\x3e').appendTo("body").remove(); a.$wrapper=a.$el.parent().closest("div.anythingSlider").addClass("anythingSlider-"+b.theme);a.$outer=a.$wrapper.parent();a.$window=a.$el.closest("div.anythingWindow");a.$win=d(m);a.$controls=d('<div class="anythingControls"></div>');a.$nav=d('<ul class="thumbNav"><li><a><span></span></a></li></ul>');a.$startStop=d('<a href="#" class="start-stop"></a>');if(b.buildStartStop||b.buildNavigation)a.$controls.appendTo(b.appendControlsTo&&d(b.appendControlsTo).length?d(b.appendControlsTo):a.$wrapper);b.buildNavigation&& a.$nav.appendTo(b.appendNavigationTo&&d(b.appendNavigationTo).length?d(b.appendNavigationTo):a.$controls);b.buildStartStop&&a.$startStop.appendTo(b.appendStartStopTo&&d(b.appendStartStopTo).length?d(b.appendStartStopTo):a.$controls);a.runTimes=d(".anythingBase").length;a.regex=b.hashTags?RegExp("panel"+a.runTimes+"-(\\d+)","i"):null;1===a.runTimes&&a.makeActive();a.flag=!1;b.autoPlayLocked&&(b.autoPlay=!0);a.playing=b.autoPlay;a.slideshow=!1;a.hovered=!1;a.panelSize=[];a.currentPage=a.targetPage= b.startPanel=parseInt(b.startPanel,10)||1;b.changeBy=parseInt(b.changeBy,10)||1;k=(b.mode||"h").toLowerCase().match(/(h|v|f)/);k=b.vertical?"v":(k||["h"])[0];b.mode="v"===k?"vertical":"f"===k?"fade":"horizontal";"f"===k&&(b.showMultiple=1,b.infiniteSlides=!1);a.adj=b.infiniteSlides?0:1;a.adjustMultiple=0;b.playRtl&&a.$wrapper.addClass("rtl");b.buildStartStop&&a.buildAutoPlay();b.buildArrows&&a.buildNextBackButtons();a.$lastPage=a.$targetPage=a.$currentPage;a.updateSlider();b.expand&&(a.$window.css({width:"100%", height:"100%"}),a.checkResize());d.isFunction(d.easing[b.easing])||(b.easing="swing");b.pauseOnHover&&a.$wrapper.hover(function(){a.playing&&(a.$el.trigger("slideshow_paused",a),a.clearTimer(!0))},function(){a.playing&&(a.$el.trigger("slideshow_unpaused",a),a.startStop(a.playing,!0))});a.slideControls(!1);a.$wrapper.bind("mouseenter mouseleave",function(b){d(this)["mouseenter"===b.type?"addClass":"removeClass"]("anythingSlider-hovered");a.hovered="mouseenter"===b.type?!0:!1;a.slideControls(a.hovered)}); d(l).keyup(function(c){if(b.enableKeyboard&&(a.$wrapper.hasClass("activeSlider")&&!c.target.tagName.match("TEXTAREA|INPUT|SELECT"))&&!("vertical"!==b.mode&&(38===c.which||40===c.which)))switch(c.which){case 39:case 40:a.goForward();break;case 37:case 38:a.goBack()}});a.currentPage=(b.hashTags?a.gotoHash():"")||b.startPanel||1;a.gotoPage(a.currentPage,!1,null,-1);var c="slideshow_paused slideshow_unpaused slide_init slide_begin slideshow_stop slideshow_start initialized swf_completed".split(" ");d.each("onShowPause onShowUnpause onSlideInit onSlideBegin onShowStop onShowStart onInitialized onSWFComplete".split(" "), function(f,e){d.isFunction(b[e])&&a.$el.bind(c[f],b[e])});d.isFunction(b.onSlideComplete)&&a.$el.bind("slide_complete",function(){setTimeout(function(){b.onSlideComplete(a)},0);return!1});a.initialized=!0;a.$el.trigger("initialized",a);a.startStop(b.autoPlay)};a.updateSlider=function(){a.$el.children(".cloned").remove();a.navTextVisible="hidden"!==a.$nav.find("span:first").css("visibility");a.$nav.empty();a.currentPage=a.currentPage||1;a.$items=a.$el.children();a.pages=a.$items.length;a.dir="vertical"=== b.mode?"top":"left";b.showMultiple=parseInt(b.showMultiple,10)||1;b.navigationSize=!1===b.navigationSize?0:parseInt(b.navigationSize,10)||0;a.$items.find("a").unbind("focus.AnythingSlider").bind("focus.AnythingSlider",function(c){var f=d(this).closest(".panel"),f=a.$items.index(f)+a.adj;a.$items.find(".focusedLink").removeClass("focusedLink");d(this).addClass("focusedLink");a.$window.scrollLeft(0).scrollTop(0);if(-1!==f&&(f>=a.currentPage+b.showMultiple||f<a.currentPage))a.gotoPage(f),c.preventDefault()}); 1<b.showMultiple&&(b.showMultiple>a.pages&&(b.showMultiple=a.pages),a.adjustMultiple=b.infiniteSlides&&1<a.pages?0:b.showMultiple-1);a.$controls.add(a.$nav).add(a.$startStop).add(a.$forward).add(a.$back)[1>=a.pages?"hide":"show"]();1<a.pages&&a.buildNavigation();"fade"!==b.mode&&(b.infiniteSlides&&1<a.pages)&&(a.$el.prepend(a.$items.filter(":last").clone().addClass("cloned")),1<b.showMultiple?a.$el.append(a.$items.filter(":lt("+b.showMultiple+")").clone().addClass("cloned multiple")):a.$el.append(a.$items.filter(":first").clone().addClass("cloned")), a.$el.find(".cloned").each(function(){d(this).find("a,input,textarea,select,button,area,form").attr({disabled:"disabled",name:""});d(this).find("[id]")[d.fn.addBack?"addBack":"andSelf"]().removeAttr("id")}));a.$items=a.$el.addClass(b.mode).children().addClass("panel");a.setDimensions();b.resizeContents?(a.$items.css("width",a.width),a.$wrapper.css("width",a.getDim(a.currentPage)[0]).add(a.$items).css("height",a.height)):a.$win.load(function(){a.setDimensions();k=a.getDim(a.currentPage);a.$wrapper.css({width:k[0], height:k[1]});a.setCurrentPage(a.currentPage,!1)});a.currentPage>a.pages&&(a.currentPage=a.pages);a.setCurrentPage(a.currentPage,!1);a.$nav.find("a").eq(a.currentPage-1).addClass("cur");"fade"===b.mode&&(k=a.$items.eq(a.currentPage-1),b.resumeOnVisible?k.css({opacity:1}).siblings().css({opacity:0}):(a.$items.css("opacity",1),k.fadeIn(0).siblings().fadeOut(0)))};a.buildNavigation=function(){if(b.buildNavigation&&1<a.pages){var c,f,e,g,h;a.$items.filter(":not(.cloned)").each(function(n){h=d("<li/>"); e=n+1;f=(1===e?" first":"")+(e===a.pages?" last":"");c='<a class="panel'+e+(a.navTextVisible?'"':" "+b.tooltipClass+'" title="@"')+' href="#"><span>@</span></a>';d.isFunction(b.navigationFormatter)?(g=b.navigationFormatter(e,d(this)),"string"===typeof g?h.html(c.replace(/@/g,g)):h=d("<li/>",g)):h.html(c.replace(/@/g,e));h.appendTo(a.$nav).addClass(f).data("index",e)});a.$nav.children("li").bind(b.clickControls,function(c){!a.flag&&b.enableNavigation&&(a.flag=!0,setTimeout(function(){a.flag=!1},100), a.gotoPage(d(this).data("index")));c.preventDefault()});b.navigationSize&&b.navigationSize<a.pages&&(a.$controls.find(".anythingNavWindow").length||a.$nav.before('<ul><li class="prev"><a href="#"><span>'+b.backText+"</span></a></li></ul>").after('<ul><li class="next"><a href="#"><span>'+b.forwardText+"</span></a></li></ul>").wrap('<div class="anythingNavWindow"></div>'),a.navWidths=a.$nav.find("li").map(function(){return d(this).outerWidth(!0)+Math.ceil(parseInt(d(this).find("span").css("left"),10)/ 2||0)}).get(),a.navLeft=a.currentPage,a.$nav.width(a.navWidth(1,a.pages+1)+25),a.$controls.find(".anythingNavWindow").width(a.navWidth(1,b.navigationSize+1)).end().find(".prev,.next").bind(b.clickControls,function(c){a.flag||(a.flag=!0,setTimeout(function(){a.flag=!1},200),a.navWindow(a.navLeft+b.navigationSize*(d(this).is(".prev")?-1:1)));c.preventDefault()}))}};a.navWidth=function(b,f){var e;e=Math.min(b,f);for(var d=Math.max(b,f),h=0;e<d;e++)h+=a.navWidths[e-1]||0;return h};a.navWindow=function(c){if(b.navigationSize&& b.navigationSize<a.pages&&a.navWidths){var f=a.pages-b.navigationSize+1;c=1>=c?1:1<c&&c<f?c:f;c!==a.navLeft&&(a.$controls.find(".anythingNavWindow").animate({scrollLeft:a.navWidth(1,c),width:a.navWidth(c,c+b.navigationSize)},{queue:!1,duration:b.animationTime}),a.navLeft=c)}};a.buildNextBackButtons=function(){a.$forward=d('<span class="arrow forward"><a href="#"><span>'+b.forwardText+"</span></a></span>");a.$back=d('<span class="arrow back"><a href="#"><span>'+b.backText+"</span></a></span>");a.$back.bind(b.clickBackArrow, function(c){b.enableArrows&&!a.flag&&(a.flag=!0,setTimeout(function(){a.flag=!1},100),a.goBack());c.preventDefault()});a.$forward.bind(b.clickForwardArrow,function(c){b.enableArrows&&!a.flag&&(a.flag=!0,setTimeout(function(){a.flag=!1},100),a.goForward());c.preventDefault()});a.$back.add(a.$forward).find("a").bind("focusin focusout",function(){d(this).toggleClass("hover")});a.$back.appendTo(b.appendBackTo&&d(b.appendBackTo).length?d(b.appendBackTo):a.$wrapper);a.$forward.appendTo(b.appendForwardTo&& d(b.appendForwardTo).length?d(b.appendForwardTo):a.$wrapper);a.arrowWidth=a.$forward.width();a.arrowRight=parseInt(a.$forward.css("right"),10);a.arrowLeft=parseInt(a.$back.css("left"),10)};a.buildAutoPlay=function(){a.$startStop.html("<span>"+(a.playing?b.stopText:b.startText)+"</span>").bind(b.clickSlideshow,function(c){b.enableStartStop&&(a.startStop(!a.playing),a.makeActive(),a.playing&&!b.autoPlayDelayed&&a.goForward(!0,b.playRtl));c.preventDefault()}).bind("focusin focusout",function(){d(this).toggleClass("hover")})}; a.checkResize=function(b){var f=!(!l.hidden&&!l.webkitHidden&&!l.mozHidden&&!l.msHidden);clearTimeout(a.resizeTimer);a.resizeTimer=setTimeout(function(){var e=a.$outer.width(),d="BODY"===a.$outer[0].tagName?a.$win.height():a.$outer.height();if(!f&&(a.lastDim[0]!==e||a.lastDim[1]!==d))a.setDimensions(),a.gotoPage(a.currentPage,a.playing,null,-1);"undefined"===typeof b&&a.checkResize()},f?2E3:500)};a.setDimensions=function(){a.$wrapper.find(".anythingWindow, .anythingBase, .panel")[d.fn.addBack?"addBack": "andSelf"]().css({width:"",height:""});a.width=a.$el.width();a.height=a.$el.height();a.outerPad=[a.$wrapper.innerWidth()-a.$wrapper.width(),a.$wrapper.innerHeight()-a.$wrapper.height()];var c,f,e,g,h=0,n={width:"100%",height:"100%"},j=1<b.showMultiple&&"horizontal"===b.mode?a.width||a.$window.width()/b.showMultiple:a.$window.width(),k=1<b.showMultiple&&"vertical"===b.mode?a.height/b.showMultiple||a.$window.height()/b.showMultiple:a.$window.height();b.expand&&(a.lastDim=[a.$outer.width(),a.$outer.height()], c=a.lastDim[0]-a.outerPad[0],f=a.lastDim[1]-a.outerPad[1],a.$wrapper.add(a.$window).css({width:c,height:f}),a.height=f=1<b.showMultiple&&"vertical"===b.mode?k:f,a.width=j=1<b.showMultiple&&"horizontal"===b.mode?c/b.showMultiple:c,a.$items.css({width:j,height:k}));a.$items.each(function(k){g=d(this);e=g.children();b.resizeContents?(c=a.width,f=a.height,g.css({width:c,height:f}),e.length&&("EMBED"===e[0].tagName&&e.attr(n),"OBJECT"===e[0].tagName&&e.find("embed").attr(n),1===e.length&&e.css(n))):("vertical"=== b.mode?(c=g.css("display","inline-block").width(),g.css("display","")):c=g.width()||a.width,1===e.length&&c>=j&&(c=e.width()>=j?j:e.width(),e.css("max-width",c)),g.css({width:c,height:""}),f=1===e.length?e.outerHeight(!0):g.height(),f<=a.outerPad[1]&&(f=a.height),g.css("height",f));a.panelSize[k]=[c,f,h];h+="vertical"===b.mode?f:c});a.$el.css("vertical"===b.mode?"height":"width","fade"===b.mode?a.width:h)};a.getDim=function(c){var f,e,d=a.width,h=a.height;if(1>a.pages||isNaN(c))return[d,h];c=b.infiniteSlides&& 1<a.pages?c:c-1;if(e=a.panelSize[c])d=e[0]||d,h=e[1]||h;if(1<b.showMultiple)for(e=1;e<b.showMultiple;e++)f=c+e,"vertical"===b.mode?(d=Math.max(d,a.panelSize[f][0]),h+=a.panelSize[f][1]):(d+=a.panelSize[f][0],h=Math.max(h,a.panelSize[f][1]));return[d,h]};a.goForward=function(c,d){a.gotoPage(a[b.allowRapidChange?"targetPage":"currentPage"]+b.changeBy*(d?-1:1),c)};a.goBack=function(c){a.gotoPage(a[b.allowRapidChange?"targetPage":"currentPage"]-b.changeBy,c)};a.gotoPage=function(c,f,e,g){!0!==f&&(f=!1, a.startStop(!1),a.makeActive());/^[#|.]/.test(c)&&d(c).length&&(c=d(c).closest(".panel").index()+a.adj);if(1!==b.changeBy){var h=a.pages-a.adjustMultiple;1>c&&(c=b.stopAtEnd?1:b.infiniteSlides?a.pages+c:b.showMultiple>1-c?1:h);c>a.pages?c=b.stopAtEnd?a.pages:b.showMultiple>1-c?1:c-=h:c>=h&&(c=h)}if(!(1>=a.pages)&&(a.$lastPage=a.$currentPage,"number"!==typeof c&&(c=parseInt(c,10)||b.startPanel,a.setCurrentPage(c)),!f||!b.isVideoPlaying(a)))b.stopAtEnd&&(!b.infiniteSlides&&c>a.pages-b.showMultiple)&& (c=a.pages-b.showMultiple+1),a.exactPage=c,c>a.pages+1-a.adj&&(c=!b.infiniteSlides&&!b.stopAtEnd?1:a.pages),c<a.adj&&(c=!b.infiniteSlides&&!b.stopAtEnd?a.pages:1),b.infiniteSlides||(a.exactPage=c),a.currentPage=c>a.pages?a.pages:1>c?1:a.currentPage,a.$currentPage=a.$items.eq(a.currentPage-a.adj),a.targetPage=0===c?a.pages:c>a.pages?1:c,a.$targetPage=a.$items.eq(a.targetPage-a.adj),g="undefined"!==typeof g?g:b.animationTime,0<=g&&a.$el.trigger("slide_init",a),0<g&&a.slideControls(!0),b.buildNavigation&& a.setNavigation(a.targetPage),!0!==f&&(f=!1),(!f||b.stopAtEnd&&c===a.pages)&&a.startStop(!1),0<=g&&a.$el.trigger("slide_begin",a),setTimeout(function(d){var f,h=!0;b.allowRapidChange&&a.$wrapper.add(a.$el).add(a.$items).stop(!0,!0);b.resizeContents||(f=a.getDim(c),d={},a.$wrapper.width()!==f[0]&&(d.width=f[0]||a.width,h=!1),a.$wrapper.height()!==f[1]&&(d.height=f[1]||a.height,h=!1),h||a.$wrapper.filter(":not(:animated)").animate(d,{queue:!1,duration:0>g?0:g,easing:b.easing}));"fade"===b.mode?a.$lastPage[0]!== a.$targetPage[0]?(a.fadeIt(a.$lastPage,0,g),a.fadeIt(a.$targetPage,1,g,function(){a.endAnimation(c,e,g)})):a.endAnimation(c,e,g):(d={},d[a.dir]=-a.panelSize[b.infiniteSlides&&1<a.pages?c:c-1][2],"vertical"===b.mode&&!b.resizeContents&&(d.width=f[0]),a.$el.filter(":not(:animated)").animate(d,{queue:!1,duration:0>g?0:g,easing:b.easing,complete:function(){a.endAnimation(c,e,g)}}))},parseInt(b.delayBeforeAnimate,10)||0)};a.endAnimation=function(c,d,e){0===c?(a.$el.css(a.dir,"fade"===b.mode?0:-a.panelSize[a.pages][2]), c=a.pages):c>a.pages&&(a.$el.css(a.dir,"fade"===b.mode?0:-a.panelSize[1][2]),c=1);a.exactPage=c;a.setCurrentPage(c,!1);"fade"===b.mode&&a.fadeIt(a.$items.not(":eq("+(c-a.adj)+")"),0,0);a.hovered||a.slideControls(!1);b.hashTags&&a.setHash(c);0<=e&&a.$el.trigger("slide_complete",a);"function"===typeof d&&d(a);b.autoPlayLocked&&!a.playing&&setTimeout(function(){a.startStop(!0)},b.resumeDelay-(b.autoPlayDelayed?b.delay:0))};a.fadeIt=function(a,d,e,g){e=0>e?0:e;if(b.resumeOnVisible)a.filter(":not(:animated)").fadeTo(e, d,g);else a.filter(":not(:animated)")[0===d?"fadeOut":"fadeIn"](e,g)};a.setCurrentPage=function(c,d){c=parseInt(c,10);if(!(1>a.pages||0===c||isNaN(c))){c>a.pages+1-a.adj&&(c=a.pages-a.adj);c<a.adj&&(c=1);b.buildArrows&&(!b.infiniteSlides&&b.stopAtEnd)&&(a.$forward[c===a.pages-a.adjustMultiple?"addClass":"removeClass"]("disabled"),a.$back[1===c?"addClass":"removeClass"]("disabled"),c===a.pages&&a.playing&&a.startStop());if(!d){var e=a.getDim(c);a.$wrapper.css({width:e[0],height:e[1]}).add(a.$window).scrollLeft(0).scrollTop(0); a.$el.css(a.dir,"fade"===b.mode?0:-a.panelSize[b.infiniteSlides&&1<a.pages?c:c-1][2])}a.currentPage=c;a.$currentPage=a.$items.removeClass("activePage").eq(c-a.adj).addClass("activePage");b.buildNavigation&&a.setNavigation(c)}};a.setNavigation=function(b){a.$nav.find(".cur").removeClass("cur").end().find("a").eq(b-1).addClass("cur")};a.makeActive=function(){a.$wrapper.hasClass("activeSlider")||(d(".activeSlider").removeClass("activeSlider"),a.$wrapper.addClass("activeSlider"))};a.gotoHash=function(){var c= m.location.hash,f=c.indexOf("&"),e=c.match(a.regex);null===e&&!/^#&/.test(c)&&!/#!?\//.test(c)&&!/\=/.test(c)?(c=c.substring(0,0<=f?f:c.length),e=d(c).length&&d(c).closest(".anythingBase")[0]===a.el?a.$items.index(d(c).closest(".panel"))+a.adj:null):null!==e&&(e=b.hashTags?parseInt(e[1],10):null);return e};a.setHash=function(b){var d="panel"+a.runTimes+"-",e=m.location.hash;"undefined"!==typeof e&&(m.location.hash=0<e.indexOf(d)?e.replace(a.regex,d+b):e+"&"+d+b)};a.slideControls=function(c){var d= c?0:b.animationTime,e=c?b.animationTime:0,g=c?1:0,h=c?0:1;b.toggleControls&&a.$controls.stop(!0,!0).delay(d)[c?"slideDown":"slideUp"](b.animationTime/2).delay(e);b.buildArrows&&b.toggleArrows&&(!a.hovered&&a.playing&&(h=1,g=0),a.$forward.stop(!0,!0).delay(d).animate({right:a.arrowRight+h*a.arrowWidth,opacity:g},b.animationTime/2),a.$back.stop(!0,!0).delay(d).animate({left:a.arrowLeft+h*a.arrowWidth,opacity:g},b.animationTime/2))};a.clearTimer=function(b){a.timer&&(m.clearInterval(a.timer),!b&&a.slideshow&& (a.$el.trigger("slideshow_stop",a),a.slideshow=!1))};a.startStop=function(c,d){!0!==c&&(c=!1);if((a.playing=c)&&!d)a.$el.trigger("slideshow_start",a),a.slideshow=!0;b.buildStartStop&&(a.$startStop.toggleClass("playing",c).find("span").html(c?b.stopText:b.startText),"hidden"===a.$startStop.find("span").css("visibility")&&a.$startStop.addClass(b.tooltipClass).attr("title",c?b.stopText:b.startText));c?(a.clearTimer(!0),a.timer=m.setInterval(function(){l.hidden||l.webkitHidden||l.mozHidden||l.msHidden? b.autoPlayLocked||a.startStop():b.isVideoPlaying(a)?b.resumeOnVideoEnd||a.startStop():a.goForward(!0,b.playRtl)},b.delay)):a.clearTimer()};a.init()};d.anythingSlider.defaults={theme:"default",mode:"horiz",expand:!1,resizeContents:!0,showMultiple:!1,easing:"swing",buildArrows:!0,buildNavigation:!0,buildStartStop:!0,toggleArrows:!1,toggleControls:!1,startText:"Start",stopText:"Stop",forwardText:"&raquo;",backText:"&laquo;",tooltipClass:"tooltip",enableArrows:!0,enableNavigation:!0,enableStartStop:!0, enableKeyboard:!0,startPanel:1,changeBy:1,hashTags:!0,infiniteSlides:!0,navigationFormatter:null,navigationSize:!1,autoPlay:!1,autoPlayLocked:!1,autoPlayDelayed:!1,pauseOnHover:!0,stopAtEnd:!1,playRtl:!1,delay:3E3,resumeDelay:15E3,animationTime:600,delayBeforeAnimate:0,clickForwardArrow:"click",clickBackArrow:"click",clickControls:"click focusin",clickSlideshow:"click",allowRapidChange:!1,resumeOnVideoEnd:!0,resumeOnVisible:!0,isVideoPlaying:function(){return!1}};d.fn.anythingSlider=function(j,l){return this.each(function(){var a, b=d(this).data("AnythingSlider");(typeof j).match("object|undefined")?b?b.updateSlider():new d.anythingSlider(this,j):/\d/.test(j)&&!isNaN(j)&&b?(a="number"===typeof j?j:parseInt(d.trim(j),10),1<=a&&a<=b.pages&&b.gotoPage(a,!1,l)):/^[#|.]/.test(j)&&d(j).length&&b.gotoPage(j,!1,l)})}})(jQuery,window,document);
laurenceHR/cdnjs
ajax/libs/anythingslider/1.9.0/jquery.anythingslider.min.js
JavaScript
mit
18,147
table.dataTable{clear:both;margin:0.5em 0 !important;max-width:none !important;width:100%}table.dataTable td,table.dataTable th{-webkit-box-sizing:content-box;box-sizing:content-box}table.dataTable td.dataTables_empty,table.dataTable th.dataTables_empty{text-align:center}table.dataTable.nowrap th,table.dataTable.nowrap td{white-space:nowrap}div.dataTables_wrapper{position:relative}div.dataTables_wrapper div.dataTables_length label{float:left;text-align:left;margin-bottom:0}div.dataTables_wrapper div.dataTables_length select{width:75px;margin-bottom:0}div.dataTables_wrapper div.dataTables_filter label{float:right;margin-bottom:0}div.dataTables_wrapper div.dataTables_filter input{display:inline-block !important;width:auto !important;margin-bottom:0;margin-left:0.5em}div.dataTables_wrapper div.dataTables_info{padding-top:2px}div.dataTables_wrapper div.dataTables_paginate{float:right;margin:0}div.dataTables_wrapper div.dataTables_processing{position:absolute;top:50%;left:50%;width:200px;margin-left:-100px;margin-top:-26px;text-align:center;padding:1rem 0}table.dataTable thead>tr>th.sorting_asc,table.dataTable thead>tr>th.sorting_desc,table.dataTable thead>tr>th.sorting,table.dataTable thead>tr>td.sorting_asc,table.dataTable thead>tr>td.sorting_desc,table.dataTable thead>tr>td.sorting{padding-right:1.5rem}table.dataTable thead>tr>th:active,table.dataTable thead>tr>td:active{outline:none}table.dataTable thead .sorting,table.dataTable thead .sorting_asc,table.dataTable thead .sorting_desc{cursor:pointer}table.dataTable thead .sorting,table.dataTable thead .sorting_asc,table.dataTable thead .sorting_desc,table.dataTable thead .sorting_asc_disabled,table.dataTable thead .sorting_desc_disabled{background-repeat:no-repeat;background-position:center right}table.dataTable thead .sorting{background-image:url("../images/sort_both.png")}table.dataTable thead .sorting_asc{background-image:url("../images/sort_asc.png")}table.dataTable thead .sorting_desc{background-image:url("../images/sort_desc.png")}table.dataTable thead .sorting_asc_disabled{background-image:url("../images/sort_asc_disabled.png")}table.dataTable thead .sorting_desc_disabled{background-image:url("../images/sort_desc_disabled.png")}div.dataTables_scrollHead table{margin-bottom:0 !important}div.dataTables_scrollBody table{border-top:none;margin-top:0 !important;margin-bottom:0 !important}div.dataTables_scrollBody table tbody tr:first-child th,div.dataTables_scrollBody table tbody tr:first-child td{border-top:none}div.dataTables_scrollFoot table{margin-top:0 !important;border-top:none}
liened/exmpro
custmgr/src/main/webapp/static/vendor/dataTables/media/css/dataTables.foundation.min.css
CSS
mit
2,580
/* * jQuery File Upload Processing Plugin 1.3.0 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2012, Sebastian Tschan * https://blueimp.net * * Licensed under the MIT license: * http://www.opensource.org/licenses/MIT */ /* jshint nomen:false */ /* global define, window */ (function (factory) { 'use strict'; if (typeof define === 'function' && define.amd) { // Register as an anonymous AMD module: define([ 'jquery', './jquery.fileupload' ], factory); } else { // Browser globals: factory( window.jQuery ); } }(function ($) { 'use strict'; var originalAdd = $.blueimp.fileupload.prototype.options.add; // The File Upload Processing plugin extends the fileupload widget // with file processing functionality: $.widget('blueimp.fileupload', $.blueimp.fileupload, { options: { // The list of processing actions: processQueue: [ /* { action: 'log', type: 'debug' } */ ], add: function (e, data) { var $this = $(this); data.process(function () { return $this.fileupload('process', data); }); originalAdd.call(this, e, data); } }, processActions: { /* log: function (data, options) { console[options.type]( 'Processing "' + data.files[data.index].name + '"' ); } */ }, _processFile: function (data, originalData) { var that = this, dfd = $.Deferred().resolveWith(that, [data]), chain = dfd.promise(); this._trigger('process', null, data); $.each(data.processQueue, function (i, settings) { var func = function (data) { if (originalData.errorThrown) { return $.Deferred() .rejectWith(that, [originalData]).promise(); } return that.processActions[settings.action].call( that, data, settings ); }; chain = chain.pipe(func, settings.always && func); }); chain .done(function () { that._trigger('processdone', null, data); that._trigger('processalways', null, data); }) .fail(function () { that._trigger('processfail', null, data); that._trigger('processalways', null, data); }); return chain; }, // Replaces the settings of each processQueue item that // are strings starting with an "@", using the remaining // substring as key for the option map, // e.g. "@autoUpload" is replaced with options.autoUpload: _transformProcessQueue: function (options) { var processQueue = []; $.each(options.processQueue, function () { var settings = {}, action = this.action, prefix = this.prefix === true ? action : this.prefix; $.each(this, function (key, value) { if ($.type(value) === 'string' && value.charAt(0) === '@') { settings[key] = options[ value.slice(1) || (prefix ? prefix + key.charAt(0).toUpperCase() + key.slice(1) : key) ]; } else { settings[key] = value; } }); processQueue.push(settings); }); options.processQueue = processQueue; }, // Returns the number of files currently in the processsing queue: processing: function () { return this._processing; }, // Processes the files given as files property of the data parameter, // returns a Promise object that allows to bind callbacks: process: function (data) { var that = this, options = $.extend({}, this.options, data); if (options.processQueue && options.processQueue.length) { this._transformProcessQueue(options); if (this._processing === 0) { this._trigger('processstart'); } $.each(data.files, function (index) { var opts = index ? $.extend({}, options) : options, func = function () { if (data.errorThrown) { return $.Deferred() .rejectWith(that, [data]).promise(); } return that._processFile(opts, data); }; opts.index = index; that._processing += 1; that._processingQueue = that._processingQueue.pipe(func, func) .always(function () { that._processing -= 1; if (that._processing === 0) { that._trigger('processstop'); } }); }); } return this._processingQueue; }, _create: function () { this._super(); this._processing = 0; this._processingQueue = $.Deferred().resolveWith(this) .promise(); } }); }));
freak3dot/cdnjs
ajax/libs/blueimp-file-upload/9.5.7/jquery.fileupload-process.js
JavaScript
mit
5,986
/** * Prism: Lightweight, robust, elegant syntax highlighting * MIT license http://www.opensource.org/licenses/mit-license.php/ * @author Lea Verou http://lea.verou.me */(function(){var e=/\blang(?:uage)?-(?!\*)(\w+)\b/i,t=self.Prism={util:{type:function(e){return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1]},clone:function(e){var n=t.util.type(e);switch(n){case"Object":var r={};for(var i in e)e.hasOwnProperty(i)&&(r[i]=t.util.clone(e[i]));return r;case"Array":return e.slice()}return e}},languages:{extend:function(e,n){var r=t.util.clone(t.languages[e]);for(var i in n)r[i]=n[i];return r},insertBefore:function(e,n,r,i){i=i||t.languages;var s=i[e],o={};for(var u in s)if(s.hasOwnProperty(u)){if(u==n)for(var a in r)r.hasOwnProperty(a)&&(o[a]=r[a]);o[u]=s[u]}return i[e]=o},DFS:function(e,n){for(var r in e){n.call(e,r,e[r]);t.util.type(e)==="Object"&&t.languages.DFS(e[r],n)}}},highlightAll:function(e,n){var r=document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code');for(var i=0,s;s=r[i++];)t.highlightElement(s,e===!0,n)},highlightElement:function(r,i,s){var o,u,a=r;while(a&&!e.test(a.className))a=a.parentNode;if(a){o=(a.className.match(e)||[,""])[1];u=t.languages[o]}if(!u)return;r.className=r.className.replace(e,"").replace(/\s+/g," ")+" language-"+o;a=r.parentNode;/pre/i.test(a.nodeName)&&(a.className=a.className.replace(e,"").replace(/\s+/g," ")+" language-"+o);var f=r.textContent;if(!f)return;f=f.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ");var l={element:r,language:o,grammar:u,code:f};t.hooks.run("before-highlight",l);if(i&&self.Worker){var c=new Worker(t.filename);c.onmessage=function(e){l.highlightedCode=n.stringify(JSON.parse(e.data),o);t.hooks.run("before-insert",l);l.element.innerHTML=l.highlightedCode;s&&s.call(l.element);t.hooks.run("after-highlight",l)};c.postMessage(JSON.stringify({language:l.language,code:l.code}))}else{l.highlightedCode=t.highlight(l.code,l.grammar,l.language);t.hooks.run("before-insert",l);l.element.innerHTML=l.highlightedCode;s&&s.call(r);t.hooks.run("after-highlight",l)}},highlight:function(e,r,i){return n.stringify(t.tokenize(e,r),i)},tokenize:function(e,n,r){var i=t.Token,s=[e],o=n.rest;if(o){for(var u in o)n[u]=o[u];delete n.rest}e:for(var u in n){if(!n.hasOwnProperty(u)||!n[u])continue;var a=n[u],f=a.inside,l=!!a.lookbehind,c=0;a=a.pattern||a;for(var h=0;h<s.length;h++){var p=s[h];if(s.length>e.length)break e;if(p instanceof i)continue;a.lastIndex=0;var d=a.exec(p);if(d){l&&(c=d[1].length);var v=d.index-1+c,d=d[0].slice(c),m=d.length,g=v+m,y=p.slice(0,v+1),b=p.slice(g+1),w=[h,1];y&&w.push(y);var E=new i(u,f?t.tokenize(d,f):d);w.push(E);b&&w.push(b);Array.prototype.splice.apply(s,w)}}}return s},hooks:{all:{},add:function(e,n){var r=t.hooks.all;r[e]=r[e]||[];r[e].push(n)},run:function(e,n){var r=t.hooks.all[e];if(!r||!r.length)return;for(var i=0,s;s=r[i++];)s(n)}}},n=t.Token=function(e,t){this.type=e;this.content=t};n.stringify=function(e,r,i){if(typeof e=="string")return e;if(Object.prototype.toString.call(e)=="[object Array]")return e.map(function(t){return n.stringify(t,r,e)}).join("");var s={type:e.type,content:n.stringify(e.content,r,i),tag:"span",classes:["token",e.type],attributes:{},language:r,parent:i};s.type=="comment"&&(s.attributes.spellcheck="true");t.hooks.run("wrap",s);var o="";for(var u in s.attributes)o+=u+'="'+(s.attributes[u]||"")+'"';return"<"+s.tag+' class="'+s.classes.join(" ")+'" '+o+">"+s.content+"</"+s.tag+">"};if(!self.document){self.addEventListener("message",function(e){var n=JSON.parse(e.data),r=n.language,i=n.code;self.postMessage(JSON.stringify(t.tokenize(i,t.languages[r])));self.close()},!1);return}var r=document.getElementsByTagName("script");r=r[r.length-1];if(r){t.filename=r.src;document.addEventListener&&!r.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",t.highlightAll)}})();; Prism.languages.clike={comment:{pattern:/(^|[^\\])(\/\*[\w\W]*?\*\/|(^|[^:])\/\/.*?(\r?\n|$))/g,lookbehind:!0},string:/("|')(\\?.)*?\1/g,"class-name":{pattern:/((?:(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/ig,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/g,"boolean":/\b(true|false)\b/g,"function":{pattern:/[a-z0-9_]+\(/ig,inside:{punctuation:/\(/}}, number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,operator:/[-+]{1,2}|!|&lt;=?|>=?|={1,3}|(&amp;){1,2}|\|?\||\?|\*|\/|\~|\^|\%/g,ignore:/&(lt|gt|amp);/gi,punctuation:/[{}[\];(),.:]/g}; ; Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(var|let|if|else|while|do|for|return|in|instanceof|function|new|with|typeof|try|throw|catch|finally|null|break|continue)\b/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?|NaN|-?Infinity)\b/g});Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/g,lookbehind:!0}});Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/(&lt;|<)script[\w\W]*?(>|&gt;)[\w\W]*?(&lt;|<)\/script(>|&gt;)/ig,inside:{tag:{pattern:/(&lt;|<)script[\w\W]*?(>|&gt;)|(&lt;|<)\/script(>|&gt;)/ig,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.javascript}}}); ;
royswastik/jsdelivr
files/snap.svg/0.1.0/js/prism.js
JavaScript
mit
5,399
(function($) { /** * Thai language package * Translated by @figgaro */ FormValidation.I18n = $.extend(true, FormValidation.I18n, { 'th_TH': { base64: { 'default': 'กรุณาระบุ base 64 encoded ให้ถูกต้อง' }, between: { 'default': 'กรุณาระบุค่าระหว่าง %s และ %s', notInclusive: 'กรุณาระบุค่าระหว่าง %s และ %s เท่านั้น' }, bic: { 'default': 'กรุณาระบุหมายเลข BIC ให้ถูกต้อง' }, callback: { 'default': 'กรุณาระบุค่าให้ถูก' }, choice: { 'default': 'กรุณาระบุค่าให้ถูกต้อง', less: 'โปรดเลือกตัวเลือก %s ที่ต่ำสุด', more: 'โปรดเลือกตัวเลือก %s ที่สูงสุด', between: 'กรุณาเลือก %s - %s ที่มีอยู่' }, color: { 'default': 'กรุณาระบุค่าสี color ให้ถูกต้อง' }, creditCard: { 'default': 'กรุณาระบุเลขที่บัตรเครดิตให้ถูกต้อง' }, cusip: { 'default': 'กรุณาระบุหมายเลข CUSIP ให้ถูกต้อง' }, cvv: { 'default': 'กรุณาระบุ CVV ให้ถูกต้อง' }, date: { 'default': 'กรุณาระบุวันที่ให้ถูกต้อง', min: 'ไม่สามารถระบุวันที่ได้ก่อน %s', max: 'ไม่สามารถระบุวันที่ได้หลังจาก %s', range: 'โปรดระบุวันที่ระหว่าง %s - %s' }, different: { 'default': 'กรุณาระบุค่าอื่นที่แตกต่าง' }, digits: { 'default': 'กรุณาระบุตัวเลขเท่านั้น' }, ean: { 'default': 'กรุณาระบุหมายเลข EAN ให้ถูกต้อง' }, ein: { 'default': 'กรุณาระบุหมายเลข EIN ให้ถูกต้อง' }, emailAddress: { 'default': 'กรุณาระบุอีเมล์ให้ถูกต้อง' }, file: { 'default': 'กรุณาเลือกไฟล์' }, greaterThan: { 'default': 'กรุณาระบุค่ามากกว่าหรือเท่ากับ %s', notInclusive: 'กรุณาระบุค่ามากกว่า %s' }, grid: { 'default': 'กรุณาระบุหมายลข GRId ให้ถูกต้อง' }, hex: { 'default': 'กรุณาระบุเลขฐานสิบหกให้ถูกต้อง' }, iban: { 'default': 'กรุณาระบุหมายเลข IBAN ให้ถูกต้อง', country: 'กรุณาระบุหมายเลข IBAN ใน %s', countries: { AD: 'อันดอร์รา', AE: 'สหรัฐอาหรับเอมิเรตส์', AL: 'แอลเบเนีย', AO: 'แองโกลา', AT: 'ออสเตรีย', AZ: 'อาเซอร์ไบจาน', BA: 'บอสเนียและเฮอร์เซโก', BE: 'ประเทศเบลเยียม', BF: 'บูร์กินาฟาโซ', BG: 'บัลแกเรีย', BH: 'บาห์เรน', BI: 'บุรุนดี', BJ: 'เบนิน', BR: 'บราซิล', CH: 'สวิตเซอร์แลนด์', CI: 'ไอวอรี่โคสต์', CM: 'แคเมอรูน', CR: 'คอสตาริกา', CV: 'เคปเวิร์ด', CY: 'ไซปรัส', CZ: 'สาธารณรัฐเชค', DE: 'เยอรมนี', DK: 'เดนมาร์ก', DO: 'สาธารณรัฐโดมินิกัน', DZ: 'แอลจีเรีย', EE: 'เอสโตเนีย', ES: 'สเปน', FI: 'ฟินแลนด์', FO: 'หมู่เกาะแฟโร', FR: 'ฝรั่งเศส', GB: 'สหราชอาณาจักร', GE: 'จอร์เจีย', GI: 'ยิบรอลตา', GL: 'กรีนแลนด์', GR: 'กรีซ', GT: 'กัวเตมาลา', HR: 'โครเอเชีย', HU: 'ฮังการี', IE: 'ไอร์แลนด์', IL: 'อิสราเอล', IR: 'อิหร่าน', IS: 'ไอซ์', IT: 'อิตาลี', JO: 'จอร์แดน', KW: 'คูเวต', KZ: 'คาซัคสถาน', LB: 'เลบานอน', LI: 'Liechtenstein', LT: 'ลิทัวเนีย', LU: 'ลักเซมเบิร์ก', LV: 'ลัตเวีย', MC: 'โมนาโก', MD: 'มอลโดวา', ME: 'มอนเตเนโก', MG: 'มาดากัสการ์', MK: 'มาซิโดเนีย', ML: 'มาลี', MR: 'มอริเตเนีย', MT: 'มอลตา', MU: 'มอริเชียส', MZ: 'โมซัมบิก', NL: 'เนเธอร์แลนด์', NO: 'นอร์เวย์', PK: 'ปากีสถาน', PL: 'โปแลนด์', PS: 'ปาเลสไตน์', PT: 'โปรตุเกส', QA: 'กาตาร์', RO: 'โรมาเนีย', RS: 'เซอร์เบีย', SA: 'ซาอุดิอารเบีย', SE: 'สวีเดน', SI: 'สโลวีเนีย', SK: 'สโลวาเกีย', SM: 'ซานมาริโน', SN: 'เซเนกัล', TN: 'ตูนิเซีย', TR: 'ตุรกี', VG: 'หมู่เกาะบริติชเวอร์จิน' } }, id: { 'default': 'โปรดระบุเลขบัตรประจำตัวประชาชนให้ถูกต้อง', country: 'โปรดระบุเลขบัตรประจำตัวประชาชนใน %s ให้ถูกต้อง', countries: { BA: 'บอสเนียและเฮอร์เซโก', BG: 'บัลแกเรีย', BR: 'บราซิล', CH: 'วิตเซอร์แลนด์', CL: 'ชิลี', CN: 'จีน', CZ: 'สาธารณรัฐเชค', DK: 'เดนมาร์ก', EE: 'เอสโตเนีย', ES: 'สเปน', FI: 'ฟินแลนด์', HR: 'โครเอเชีย', IE: 'ไอร์แลนด์', IS: 'ไอซ์', LT: 'ลิทัวเนีย', LV: 'ลัตเวีย', ME: 'มอนเตเนโก', MK: 'มาซิโดเนีย', NL: 'เนเธอร์แลนด์', PL: 'โปแลนด์', RO: 'โรมาเนีย', RS: 'เซอร์เบีย', SE: 'สวีเดน', SI: 'สโลวีเนีย', SK: 'สโลวาเกีย', SM: 'ซานมาริโน', TH: 'ไทย', ZA: 'แอฟริกาใต้' } }, identical: { 'default': 'โปรดระบุค่าให้ตรง' }, imei: { 'default': 'โปรดระบุหมายเลข IMEI ให้ถูกต้อง' }, imo: { 'default': 'โปรดระบุหมายเลข IMO ให้ถูกต้อง' }, integer: { 'default': 'โปรดระบุตัวเลขให้ถูกต้อง' }, ip: { 'default': 'โปรดระบุ IP address ให้ถูกต้อง', ipv4: 'โปรดระบุ IPv4 address ให้ถูกต้อง', ipv6: 'โปรดระบุ IPv6 address ให้ถูกต้อง' }, isbn: { 'default': 'โปรดระบุหมายเลข ISBN ให้ถูกต้อง' }, isin: { 'default': 'โปรดระบุหมายเลข ISIN ให้ถูกต้อง' }, ismn: { 'default': 'โปรดระบุหมายเลข ISMN ให้ถูกต้อง' }, issn: { 'default': 'โปรดระบุหมายเลข ISSN ให้ถูกต้อง' }, lessThan: { 'default': 'โปรดระบุค่าน้อยกว่าหรือเท่ากับ %s', notInclusive: 'โปรดระบุค่าน้อยกว่า %s' }, mac: { 'default': 'โปรดระบุหมายเลข MAC address ให้ถูกต้อง' }, meid: { 'default': 'โปรดระบุหมายเลข MEID ให้ถูกต้อง' }, notEmpty: { 'default': 'โปรดระบุค่า' }, numeric: { 'default': 'โปรดระบุเลขหน่วยหรือจำนวนทศนิยม ให้ถูกต้อง' }, phone: { 'default': 'โปรดระบุหมายเลขโทรศัพท์ให้ถูกต้อง', country: 'โปรดระบุหมายเลขโทรศัพท์ใน %s ให้ถูกต้อง', countries: { AE: 'สหรัฐอาหรับเอมิเรตส์', BG: 'บัลแกเรีย', BR: 'บราซิล', CN: 'จีน', CZ: 'สาธารณรัฐเชค', DE: 'เยอรมนี', DK: 'เดนมาร์ก', ES: 'สเปน', FR: 'ฝรั่งเศส', GB: 'สหราชอาณาจักร', IN: 'อินเดีย', MA: 'โมร็อกโก', NL: 'เนเธอร์แลนด์', PK: 'ปากีสถาน', RO: 'โรมาเนีย', RU: 'รัสเซีย', SK: 'สโลวาเกีย', TH: 'ไทย', US: 'สหรัฐอเมริกา', VE: 'เวเนซูเอลา' } }, regexp: { 'default': 'โปรดระบุค่าให้ตรงกับรูปแบบที่กำหนด' }, remote: { 'default': 'โปรดระบุค่าให้ถูกต้อง' }, rtn: { 'default': 'โปรดระบุหมายเลข RTN ให้ถูกต้อง' }, sedol: { 'default': 'โปรดระบุหมายเลข SEDOL ให้ถูกต้อง' }, siren: { 'default': 'โปรดระบุหมายเลข SIREN ให้ถูกต้อง' }, siret: { 'default': 'โปรดระบุหมายเลข SIRET ให้ถูกต้อง' }, step: { 'default': 'โปรดระบุลำดับของ %s' }, stringCase: { 'default': 'โปรดระบุตัวอักษรพิมพ์เล็กเท่านั้น', upper: 'โปรดระบุตัวอักษรพิมพ์ใหญ่เท่านั้น' }, stringLength: { 'default': 'ค่าที่ระบุยังไม่ครบตามจำนวนที่กำหนด', less: 'โปรดระบุค่าตัวอักษรน้อยกว่า %s ตัว', more: 'โปรดระบุค่าตัวอักษรมากกว่า %s ตัว', between: 'โปรดระบุค่าตัวอักษรระหว่าง %s ถึง %s ตัวอักษร' }, uri: { 'default': 'โปรดระบุค่า URI ให้ถูกต้อง' }, uuid: { 'default': 'โปรดระบุหมายเลข UUID ให้ถูกต้อง', version: 'โปรดระบุหมายเลข UUID ในเวอร์ชั่น %s' }, vat: { 'default': 'โปรดระบุจำนวนภาษีมูลค่าเพิ่ม', country: 'โปรดระบุจำนวนภาษีมูลค่าเพิ่มใน %s', countries: { AT: 'ออสเตรีย', BE: 'เบลเยี่ยม', BG: 'บัลแกเรีย', BR: 'บราซิล', CH: 'วิตเซอร์แลนด์', CY: 'ไซปรัส', CZ: 'สาธารณรัฐเชค', DE: 'เยอรมัน', DK: 'เดนมาร์ก', EE: 'เอสโตเนีย', ES: 'สเปน', FI: 'ฟินแลนด์', FR: 'ฝรั่งเศส', GB: 'สหราชอาณาจักร', GR: 'กรีซ', EL: 'กรีซ', HU: 'ฮังการี', HR: 'โครเอเชีย', IE: 'ไอร์แลนด์', IS: 'ไอซ์', IT: 'อิตาลี', LT: 'ลิทัวเนีย', LU: 'ลักเซมเบิร์ก', LV: 'ลัตเวีย', MT: 'มอลตา', NL: 'เนเธอร์แลนด์', NO: 'นอร์เวย์', PL: 'โปแลนด์', PT: 'โปรตุเกส', RO: 'โรมาเนีย', RU: 'รัสเซีย', RS: 'เซอร์เบีย', SE: 'สวีเดน', SI: 'สโลวีเนีย', SK: 'สโลวาเกีย', VE: 'เวเนซูเอลา', ZA: 'แอฟริกาใต้' } }, vin: { 'default': 'โปรดระบุหมายเลข VIN ให้ถูกต้อง' }, zipCode: { 'default': 'โปรดระบุรหัสไปรษณีย์ให้ถูกต้อง', country: 'โปรดระบุรหัสไปรษณีย์ให้ถูกต้องใน %s', countries: { AT: 'ออสเตรีย', BG: 'บัลแกเรีย', BR: 'บราซิล', CA: 'แคนาดา', CH: 'วิตเซอร์แลนด์', CZ: 'สาธารณรัฐเชค', DE: 'เยอรมนี', DK: 'เดนมาร์ก', ES: 'สเปน', FR: 'ฝรั่งเศส', GB: 'สหราชอาณาจักร', IE: 'ไอร์แลนด์', IN: 'อินเดีย', IT: 'อิตาลี', MA: 'โมร็อกโก', NL: 'เนเธอร์แลนด์', PL: 'โปแลนด์', PT: 'โปรตุเกส', RO: 'โรมาเนีย', RU: 'รัสเซีย', SE: 'สวีเดน', SG: 'สิงคโปร์', SK: 'สโลวาเกีย', US: 'สหรัฐอเมริกา' } } } }); }(jQuery));
BhutanInsuranceLimited/InsuranceSystem
public/global/plugins/bootstrapValidation/js/language/th_TH.js
JavaScript
mit
20,245
/* AngularJS v1.3.0-beta.5 (c) 2010-2014 Google, Inc. http://angularjs.org License: MIT */ (function(p,h,q){'use strict';function E(a){var e=[];s(e,h.noop).chars(a);return e.join("")}function k(a){var e={};a=a.split(",");var d;for(d=0;d<a.length;d++)e[a[d]]=!0;return e}function F(a,e){function d(a,b,d,g){b=h.lowercase(b);if(t[b])for(;f.last()&&u[f.last()];)c("",f.last());v[b]&&f.last()==b&&c("",b);(g=w[b]||!!g)||f.push(b);var l={};d.replace(G,function(a,b,e,c,d){l[b]=r(e||c||d||"")});e.start&&e.start(b,l,g)}function c(a,b){var c=0,d;if(b=h.lowercase(b))for(c=f.length-1;0<=c&&f[c]!=b;c--); if(0<=c){for(d=f.length-1;d>=c;d--)e.end&&e.end(f[d]);f.length=c}}var b,g,f=[],l=a;for(f.last=function(){return f[f.length-1]};a;){g=!0;if(f.last()&&x[f.last()])a=a.replace(RegExp("(.*)<\\s*\\/\\s*"+f.last()+"[^>]*>","i"),function(b,a){a=a.replace(H,"$1").replace(I,"$1");e.chars&&e.chars(r(a));return""}),c("",f.last());else{if(0===a.indexOf("\x3c!--"))b=a.indexOf("--",4),0<=b&&a.lastIndexOf("--\x3e",b)===b&&(e.comment&&e.comment(a.substring(4,b)),a=a.substring(b+3),g=!1);else if(y.test(a)){if(b=a.match(y))a= a.replace(b[0],""),g=!1}else if(J.test(a)){if(b=a.match(z))a=a.substring(b[0].length),b[0].replace(z,c),g=!1}else K.test(a)&&(b=a.match(A))&&(a=a.substring(b[0].length),b[0].replace(A,d),g=!1);g&&(b=a.indexOf("<"),g=0>b?a:a.substring(0,b),a=0>b?"":a.substring(b),e.chars&&e.chars(r(g)))}if(a==l)throw L("badparse",a);l=a}c()}function r(a){if(!a)return"";var e=M.exec(a);a=e[1];var d=e[3];if(e=e[2])n.innerHTML=e.replace(/</g,"&lt;"),e="textContent"in n?n.textContent:n.innerText;return a+e+d}function B(a){return a.replace(/&/g, "&amp;").replace(N,function(a){return"&#"+a.charCodeAt(0)+";"}).replace(/</g,"&lt;").replace(/>/g,"&gt;")}function s(a,e){var d=!1,c=h.bind(a,a.push);return{start:function(a,g,f){a=h.lowercase(a);!d&&x[a]&&(d=a);d||!0!==C[a]||(c("<"),c(a),h.forEach(g,function(d,f){var g=h.lowercase(f),k="img"===a&&"src"===g||"background"===g;!0!==O[g]||!0===D[g]&&!e(d,k)||(c(" "),c(f),c('="'),c(B(d)),c('"'))}),c(f?"/>":">"))},end:function(a){a=h.lowercase(a);d||!0!==C[a]||(c("</"),c(a),c(">"));a==d&&(d=!1)},chars:function(a){d|| c(B(a))}}}var L=h.$$minErr("$sanitize"),A=/^<\s*([\w:-]+)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*>/,z=/^<\s*\/\s*([\w:-]+)[^>]*>/,G=/([\w:-]+)(?:\s*=\s*(?:(?:"((?:[^"])*)")|(?:'((?:[^'])*)')|([^>\s]+)))?/g,K=/^</,J=/^<\s*\//,H=/\x3c!--(.*?)--\x3e/g,y=/<!DOCTYPE([^>]*?)>/i,I=/<!\[CDATA\[(.*?)]]\x3e/g,N=/([^\#-~| |!])/g,w=k("area,br,col,hr,img,wbr");p=k("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr");q=k("rp,rt");var v=h.extend({},q,p),t=h.extend({},p,k("address,article,aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,script,section,table,ul")), u=h.extend({},q,k("a,abbr,acronym,b,bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s,samp,small,span,strike,strong,sub,sup,time,tt,u,var")),x=k("script,style"),C=h.extend({},w,t,u,v),D=k("background,cite,href,longdesc,src,usemap"),O=h.extend({},D,k("abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,scope,scrolling,shape,size,span,start,summary,target,title,type,valign,value,vspace,width")), n=document.createElement("pre"),M=/^(\s*)([\s\S]*?)(\s*)$/;h.module("ngSanitize",[]).provider("$sanitize",function(){this.$get=["$$sanitizeUri",function(a){return function(e){var d=[];F(e,s(d,function(c,b){return!/^unsafe/.test(a(c,b))}));return d.join("")}}]});h.module("ngSanitize").filter("linky",["$sanitize",function(a){var e=/((ftp|https?):\/\/|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>]/,d=/^mailto:/;return function(c,b){function g(a){a&&m.push(E(a))}function f(a,c){m.push("<a ");h.isDefined(b)&& (m.push('target="'),m.push(b),m.push('" '));m.push('href="');m.push(a);m.push('">');g(c);m.push("</a>")}if(!c)return c;for(var l,k=c,m=[],n,p;l=k.match(e);)n=l[0],l[2]==l[3]&&(n="mailto:"+n),p=l.index,g(k.substr(0,p)),f(n,l[0].replace(d,"")),k=k.substring(p+l[0].length);g(k);return a(m.join(""))}}])})(window,window.angular); //# sourceMappingURL=angular-sanitize.min.js.map
amoyeh/cdnjs
ajax/libs/angular.js/1.3.0-beta.5/angular-sanitize.min.js
JavaScript
mit
4,301
// moment.js locale configuration // locale : estonian (et) // author : Henry Kehlmann : https://github.com/madhenry // improvements : Illimar Tambek : https://github.com/ragulka (function (factory) { if (typeof define === 'function' && define.amd) { define(['moment'], factory); // AMD } else if (typeof exports === 'object') { module.exports = factory(require('../moment')); // Node } else { factory((typeof global !== 'undefined' ? global : this).moment); // node or other global } }(function (moment) { function processRelativeTime(number, withoutSuffix, key, isFuture) { var format = { 's' : ['mõne sekundi', 'mõni sekund', 'paar sekundit'], 'm' : ['ühe minuti', 'üks minut'], 'mm': [number + ' minuti', number + ' minutit'], 'h' : ['ühe tunni', 'tund aega', 'üks tund'], 'hh': [number + ' tunni', number + ' tundi'], 'd' : ['ühe päeva', 'üks päev'], 'M' : ['kuu aja', 'kuu aega', 'üks kuu'], 'MM': [number + ' kuu', number + ' kuud'], 'y' : ['ühe aasta', 'aasta', 'üks aasta'], 'yy': [number + ' aasta', number + ' aastat'] }; if (withoutSuffix) { return format[key][2] ? format[key][2] : format[key][1]; } return isFuture ? format[key][0] : format[key][1]; } return moment.defineLocale('et', { months : 'jaanuar_veebruar_märts_aprill_mai_juuni_juuli_august_september_oktoober_november_detsember'.split('_'), monthsShort : 'jaan_veebr_märts_apr_mai_juuni_juuli_aug_sept_okt_nov_dets'.split('_'), weekdays : 'pühapäev_esmaspäev_teisipäev_kolmapäev_neljapäev_reede_laupäev'.split('_'), weekdaysShort : 'P_E_T_K_N_R_L'.split('_'), weekdaysMin : 'P_E_T_K_N_R_L'.split('_'), longDateFormat : { LT : 'H:mm', LTS : 'LT:ss', L : 'DD.MM.YYYY', LL : 'D. MMMM YYYY', LLL : 'D. MMMM YYYY LT', LLLL : 'dddd, D. MMMM YYYY LT' }, calendar : { sameDay : '[Täna,] LT', nextDay : '[Homme,] LT', nextWeek : '[Järgmine] dddd LT', lastDay : '[Eile,] LT', lastWeek : '[Eelmine] dddd LT', sameElse : 'L' }, relativeTime : { future : '%s pärast', past : '%s tagasi', s : processRelativeTime, m : processRelativeTime, mm : processRelativeTime, h : processRelativeTime, hh : processRelativeTime, d : processRelativeTime, dd : '%d päeva', M : processRelativeTime, MM : processRelativeTime, y : processRelativeTime, yy : processRelativeTime }, ordinalParse: /\d{1,2}\./, ordinal : '%d.', week : { dow : 1, // Monday is the first day of the week. doy : 4 // The week that contains Jan 4th is the first week of the year. } }); }));
claudio-moya-tapia/mean_demo
node_modules/moment/locale/et.js
JavaScript
mit
3,188
(function(t,e){function n(){}function r(t){return t}function i(t,e){return B(t,e)}function o(t,e){return t-e}function s(t){return""+t}function u(t){throw t}function c(){if(this.isDisposed)throw Error(_)}function a(t){return"function"!=typeof t.toString&&"string"==typeof(t+"")}function h(t){return t&&"object"==typeof t?M.call(t)==O:!1}function l(t){return"function"==typeof t}function f(t,e,n,r){var i;if(t===e)return 0!==t||1/t==1/e;var o=typeof t,s=typeof e;if(!(t!==t||t&&N[o]||e&&N[s]))return!1;if(null==t||null==e)return t===e;var u=M.call(t),c=M.call(e);if(u==O&&(u=T),c==O&&(c=T),u!=c)return!1;switch(u){case W:case k:return+t==+e;case q:return t!=+t?e!=+e:0==t?1/t==1/e:t==+e;case I:case P:return t==e+""}var p=u==R;if(!p){if(u!=T||!x&&(a(t)||a(e)))return!1;var d=!V&&h(t)?Object:t.constructor,b=!V&&h(e)?Object:e.constructor;if(d!=b&&!(l(d)&&d instanceof d&&l(b)&&b instanceof b))return!1}for(var v=n.length;v--;)if(n[v]==t)return r[v]==e;var m=0;if(i=!0,n.push(t),r.push(e),p){for(v=t.length,m=e.length,i=m==t.length;m--;){var y=e[m];if(!(i=f(t[m],y,n,r)))break}return i}for(var w in e)if(L.call(e,w))return m++,i=L.call(t,w)&&f(t[w],e[w],n,r);if(i)for(var w in t)if(L.call(t,w))return i=--m>-1;return n.pop(),r.pop(),i}function p(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:F.call(t)}function d(t,e){for(var n=Array(t),r=0;t>r;r++)n[r]=e();return n}function b(t,e){this.scheduler=t,this.disposable=e,this.isDisposed=!1}function v(t,e,n,r,i){this.scheduler=t,this.state=e,this.action=n,this.dueTime=r,this.comparer=i||o,this.disposable=new ee}function m(t,n){return new He(function(r){var i=new ee,o=new re;return o.setDisposable(i),i.setDisposable(t.subscribe(r.onNext.bind(r),function(t){var i,s;try{s=n(t)}catch(u){return r.onError(u),e}i=new ee,o.setDisposable(i),i.setDisposable(s.subscribe(r))},r.onCompleted.bind(r))),o})}function y(t,n){var r=this;return new He(function(i){var o=0,s=t.length;return r.subscribe(function(r){if(s>o){var u,c=t[o++];try{u=n(r,c)}catch(a){return i.onError(a),e}i.onNext(u)}else i.onCompleted()},i.onError.bind(i),i.onCompleted.bind(i))})}function w(t){return this.select(t).mergeObservable()}var g="object"==typeof exports&&exports,E=("object"==typeof module&&module&&module.exports==g&&module,"object"==typeof global&&global);E.global===E&&(t=E);var x,D={Internals:{}},C=Date.now,A="Sequence contains no elements.",S="Argument out of range",_="Object has been disposed",N={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},O="[object Arguments]",R="[object Array]",W="[object Boolean]",k="[object Date]",j="[object Function]",q="[object Number]",T="[object Object]",I="[object RegExp]",P="[object String]",M=Object.prototype.toString,L=Object.prototype.hasOwnProperty,V=M.call(arguments)==O;try{x=!(M.call(document)==T&&!({toString:0}+""))}catch(z){x=!0}V||(h=function(t){return t&&"object"==typeof t?L.call(t,"callee"):!1}),l(/x/)&&(l=function(t){return"function"==typeof t&&M.call(t)==j});var B=D.Internals.isEqual=function(t,e){return f(t,e,[],[])},F=Array.prototype.slice;({}).hasOwnProperty;var H=this.inherits=D.Internals.inherits=function(t,e){function n(){this.constructor=t}n.prototype=e.prototype,t.prototype=new n},U=D.Internals.addProperties=function(t){for(var e=F.call(arguments,1),n=0,r=e.length;r>n;n++){var i=e[n];for(var o in i)t[o]=i[o]}},G=D.Internals.addRef=function(t,e){return new He(function(n){return new X(e.getDisposable(),t.subscribe(n))})},J=function(t,e){this.id=t,this.value=e};J.prototype.compareTo=function(t){var e=this.value.compareTo(t.value);return 0===e&&(e=this.id-t.id),e};var K=function(t){this.items=Array(t),this.length=0},Q=K.prototype;Q.isHigherPriority=function(t,e){return 0>this.items[t].compareTo(this.items[e])},Q.percolate=function(t){if(!(t>=this.length||0>t)){var e=t-1>>1;if(!(0>e||e===t)&&this.isHigherPriority(t,e)){var n=this.items[t];this.items[t]=this.items[e],this.items[e]=n,this.percolate(e)}}},Q.heapify=function(t){if(t===e&&(t=0),!(t>=this.length||0>t)){var n=2*t+1,r=2*t+2,i=t;if(this.length>n&&this.isHigherPriority(n,i)&&(i=n),this.length>r&&this.isHigherPriority(r,i)&&(i=r),i!==t){var o=this.items[t];this.items[t]=this.items[i],this.items[i]=o,this.heapify(i)}}},Q.peek=function(){return this.items[0].value},Q.removeAt=function(t){this.items[t]=this.items[--this.length],delete this.items[this.length],this.heapify()},Q.dequeue=function(){var t=this.peek();return this.removeAt(0),t},Q.enqueue=function(t){var e=this.length++;this.items[e]=new J(K.count++,t),this.percolate(e)},Q.remove=function(t){for(var e=0;this.length>e;e++)if(this.items[e].value===t)return this.removeAt(e),!0;return!1},K.count=0;var X=D.CompositeDisposable=function(){this.disposables=p(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},Y=X.prototype;Y.add=function(t){this.isDisposed?t.dispose():(this.disposables.push(t),this.length++)},Y.remove=function(t){var e=!1;if(!this.isDisposed){var n=this.disposables.indexOf(t);-1!==n&&(e=!0,this.disposables.splice(n,1),this.length--,t.dispose())}return e},Y.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()}},Y.clear=function(){var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()},Y.contains=function(t){return-1!==this.disposables.indexOf(t)},Y.toArray=function(){return this.disposables.slice(0)};var Z=D.Disposable=function(t){this.isDisposed=!1,this.action=t||n};Z.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var $=Z.create=function(t){return new Z(t)},te=Z.empty={dispose:n},ee=D.SingleAssignmentDisposable=function(){this.isDisposed=!1,this.current=null},ne=ee.prototype;ne.disposable=function(t){return t?this.setDisposable(t):this.getDisposable()},ne.getDisposable=function(){return this.current},ne.setDisposable=function(t){if(this.current)throw Error("Disposable has already been assigned");var e=this.isDisposed;e||(this.current=t),e&&t&&t.dispose()},ne.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()};var re=D.SerialDisposable=function(){this.isDisposed=!1,this.current=null};re.prototype.getDisposable=function(){return this.current},re.prototype.setDisposable=function(t){var e,n=this.isDisposed;n||(e=this.current,this.current=t),e&&e.dispose(),n&&t&&t.dispose()},re.prototype.disposable=function(t){return t?(this.setDisposable(t),e):this.getDisposable()},re.prototype.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()};var ie=D.RefCountDisposable=function(){function t(t){this.disposable=t,this.disposable.count++,this.isInnerDisposed=!1}function e(t){this.underlyingDisposable=t,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return t.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},e.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},e.prototype.getDisposable=function(){return this.isDisposed?te:new t(this)},e}();b.prototype.dispose=function(){var t=this;this.scheduler.schedule(function(){t.isDisposed||(t.isDisposed=!0,t.disposable.dispose())})},v.prototype.invoke=function(){this.disposable.disposable(this.invokeCore())},v.prototype.compareTo=function(t){return this.comparer(this.dueTime,t.dueTime)},v.prototype.isCancelled=function(){return this.disposable.isDisposed},v.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var oe=D.Scheduler=function(){function e(t,e,n,r){this.now=t,this._schedule=e,this._scheduleRelative=n,this._scheduleAbsolute=r}function n(t,e){var n=e.first,r=e.second,i=new X,o=function(e){r(e,function(e){var n=!1,r=!1,s=t.scheduleWithState(e,function(t,e){return n?i.remove(s):r=!0,o(e),te});r||(i.add(s),n=!0)})};return o(n),i}function r(t,e,n){var r=e.first,i=e.second,o=new X,s=function(e){i(e,function(e,r){var i=!1,u=!1,c=t[n].call(t,e,r,function(t,e){return i?o.remove(c):u=!0,s(e),te});u||(o.add(c),i=!0)})};return s(r),o}function i(t,e){return e(),te}var o=e.prototype;return o.catchException=function(t){return new pe(this,t)},o.schedulePeriodic=function(t,e){return this.schedulePeriodicWithState(null,t,function(){e()})},o.schedulePeriodicWithState=function(e,n,r){var i=e,o=t.setInterval(function(){i=r(i)},n);return $(function(){t.clearInterval(o)})},o.schedule=function(t){return this._schedule(t,i)},o.scheduleWithState=function(t,e){return this._schedule(t,e)},o.scheduleWithRelative=function(t,e){return this._scheduleRelative(e,t,i)},o.scheduleWithRelativeAndState=function(t,e,n){return this._scheduleRelative(t,e,n)},o.scheduleWithAbsolute=function(t,e){return this._scheduleAbsolute(e,t,i)},o.scheduleWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute(t,e,n)},o.scheduleRecursive=function(t){return this.scheduleRecursiveWithState(t,function(t,e){t(function(){e(t)})})},o.scheduleRecursiveWithState=function(t,e){return this.scheduleWithState({first:t,second:e},function(t,e){return n(t,e)})},o.scheduleRecursiveWithRelative=function(t,e){return this.scheduleRecursiveWithRelativeAndState(e,t,function(t,e){t(function(n){e(t,n)})})},o.scheduleRecursiveWithRelativeAndState=function(t,e,n){return this._scheduleRelative({first:t,second:n},e,function(t,e){return r(t,e,"scheduleWithRelativeAndState")})},o.scheduleRecursiveWithAbsolute=function(t,e){return this.scheduleRecursiveWithAbsoluteAndState(e,t,function(t,e){t(function(n){e(t,n)})})},o.scheduleRecursiveWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute({first:t,second:n},e,function(t,e){return r(t,e,"scheduleWithAbsoluteAndState")})},e.now=C,e.normalize=function(t){return 0>t&&(t=0),t},e}(),se="Scheduler is not allowed to block the thread",ue=oe.immediate=function(){function t(t,e){return e(this,t)}function e(t,e,n){if(e>0)throw Error(se);return n(this,t)}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new oe(C,t,e,n)}(),ce=oe.currentThread=function(){function t(){i=new K(4)}function e(t,e){return this.scheduleWithRelativeAndState(t,0,e)}function n(e,n,r){var o,s=this.now()+oe.normalize(n),u=new v(this,e,r,s);if(i)i.enqueue(u);else{o=new t;try{i.enqueue(u),o.run()}catch(c){throw c}finally{o.dispose()}}return u.disposable}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}var i;t.prototype.dispose=function(){i=null},t.prototype.run=function(){for(var t;i.length>0;)if(t=i.dequeue(),!t.isCancelled()){for(;t.dueTime-oe.now()>0;);t.isCancelled()||t.invoke()}};var o=new oe(C,e,n,r);return o.scheduleRequired=function(){return null===i},o.ensureTrampoline=function(t){return null===i?this.schedule(t):t()},o}(),ae=function(){function t(t,e){e(0,this._period);try{this._state=this._action(this._state)}catch(n){throw this._cancel.dispose(),n}}function e(t,e,n,r){this._scheduler=t,this._state=e,this._period=n,this._action=r}return e.prototype.start=function(){var e=new ee;return this._cancel=e,e.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,t.bind(this))),e},e}();D.VirtualTimeScheduler=function(t){function n(){return this.toDateTimeOffset(this.clock)}function r(t,e){return this.scheduleAbsoluteWithState(t,this.clock,e)}function i(t,e,n){return this.scheduleRelativeWithState(t,this.toRelative(e),n)}function o(t,e,n){return this.scheduleRelativeWithState(t,this.toRelative(e-this.now()),n)}function s(t,e){return e(),te}function u(e,s){this.clock=e,this.comparer=s,this.isEnabled=!1,this.queue=new K(1024),t.call(this,n,r,i,o)}H(u,t);var c=u.prototype;return c.schedulePeriodicWithState=function(t,e,n){var r=new ae(this,t,e,n);return r.start()},c.scheduleRelativeWithState=function(t,e,n){var r=this.add(this.clock,e);return this.scheduleAbsoluteWithState(t,r,n)},c.scheduleRelative=function(t,e){return this.scheduleRelativeWithState(e,t,s)},c.start=function(){var t;if(!this.isEnabled){this.isEnabled=!0;do t=this.getNext(),null!==t?(this.comparer(t.dueTime,this.clock)>0&&(this.clock=t.dueTime),t.invoke()):this.isEnabled=!1;while(this.isEnabled)}},c.stop=function(){this.isEnabled=!1},c.advanceTo=function(t){var e,n=this.comparer(this.clock,t);if(this.comparer(this.clock,t)>0)throw Error(S);if(0!==n&&!this.isEnabled){this.isEnabled=!0;do e=this.getNext(),null!==e&&0>=this.comparer(e.dueTime,t)?(this.comparer(e.dueTime,this.clock)>0&&(this.clock=e.dueTime),e.invoke()):this.isEnabled=!1;while(this.isEnabled);this.clock=t}},c.advanceBy=function(t){var n=this.add(this.clock,t),r=this.comparer(this.clock,n);if(r>0)throw Error(S);return 0!==r?this.advanceTo(n):e},c.sleep=function(t){var e=this.add(this.clock,t);if(this.comparer(this.clock,e)>=0)throw Error(S);this.clock=e},c.getNext=function(){for(var t;this.queue.length>0;){if(t=this.queue.peek(),!t.isCancelled())return t;this.queue.dequeue()}return null},c.scheduleAbsolute=function(t,e){return this.scheduleAbsoluteWithState(e,t,s)},c.scheduleAbsoluteWithState=function(t,e,n){var r=this,i=function(t,e){return r.queue.remove(o),n(t,e)},o=new v(r,t,i,e,r.comparer);return r.queue.enqueue(o),o.disposable},u}(oe),D.HistoricalScheduler=function(t){function e(e,n){var r=null==e?0:e,i=n||o;t.call(this,r,i)}H(e,t);var n=e.prototype;return n.add=function(t,e){return t+e},n.toDateTimeOffset=function(t){return new Date(t).getTime()},n.toRelative=function(t){return t},e}(D.VirtualTimeScheduler);var he,le=n;(function(){function e(){if(!t.postMessage||t.importScripts)return!1;var e=!1,n=t.onmessage;return t.onmessage=function(){e=!0},t.postMessage("","*"),t.onmessage=n,e}function n(t){if("string"==typeof t.data&&t.data.substring(0,r.length)===r){var e=t.data.substring(r.length),n=i[e];n(),delete i[e]}}if("function"==typeof t.setImmediate)he=t.setImmediate,le=clearImmediate;else if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))he=process.nextTick;else if(e()){var r="ms.rx.schedule"+Math.random(),i={},o=0;t.addEventListener?t.addEventListener("message",n,!1):t.attachEvent("onmessage",n,!1),he=function(e){var n=o++;i[n]=e,t.postMessage(r+n,"*")}}else if(t.MessageChannel){var s=new t.MessageChannel,u={},c=0;s.port1.onmessage=function(t){var e=t.data,n=u[e];n(),delete u[e]},he=function(t){var e=c++;u[e]=t,s.port2.postMessage(e)}}else"document"in t&&"onreadystatechange"in t.document.createElement("script")?he=function(e){var n=t.document.createElement("script");n.onreadystatechange=function(){e(),n.onreadystatechange=null,n.parentNode.removeChild(n),n=null},t.document.documentElement.appendChild(n)}:(he=function(e){return t.setTimeout(e,0)},le=t.clearTimeout)})();var fe=oe.timeout=function(){function e(t,e){var n=this,r=new ee,i=he(function(){r.isDisposed||r.setDisposable(e(n,t))});return new X(r,$(function(){le(i)}))}function n(e,n,r){var i=this,o=oe.normalize(n);if(0===o)return i.scheduleWithState(e,r);var s=new ee,u=t.setTimeout(function(){s.isDisposed||s.setDisposable(r(i,e))},o);return new X(s,$(function(){t.clearTimeout(u)}))}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new oe(C,e,n,r)}(),pe=function(t){function e(){return this._scheduler.now()}function n(t,e){return this._scheduler.scheduleWithState(t,this._wrap(e))}function r(t,e,n){return this._scheduler.scheduleWithRelativeAndState(t,e,this._wrap(n))}function i(t,e,n){return this._scheduler.scheduleWithAbsoluteAndState(t,e,this._wrap(n))}function o(o,s){this._scheduler=o,this._handler=s,this._recursiveOriginal=null,this._recursiveWrapper=null,t.call(this,e,n,r,i)}return H(o,t),o.prototype._clone=function(t){return new o(t,this._handler)},o.prototype._wrap=function(t){var e=this;return function(n,r){try{return t(e._getRecursiveWrapper(n),r)}catch(i){if(!e._handler(i))throw i;return te}}},o.prototype._getRecursiveWrapper=function(t){if(this._recursiveOriginal!==t){this._recursiveOriginal=t;var e=this._clone(t);e._recursiveOriginal=t,e._recursiveWrapper=e,this._recursiveWrapper=e}return this._recursiveWrapper},o.prototype.schedulePeriodicWithState=function(t,e,n){var r=this,i=!1,o=new ee;return o.setDisposable(this._scheduler.schedulePeriodicWithState(t,e,function(t){if(i)return null;try{return n(t)}catch(e){if(i=!0,!r._handler(e))throw e;return o.dispose(),null}})),o},o}(oe),de=D.Notification=function(){function t(t,e){this.hasValue=null==e?!1:e,this.kind=t}var e=t.prototype;return e.accept=function(t,e,n){return 1===arguments.length&&"object"==typeof t?this._acceptObservable(t):this._accept(t,e,n)},e.toObservable=function(t){var e=this;return t=t||ue,new He(function(n){return t.schedule(function(){e._acceptObservable(n),"N"===e.kind&&n.onCompleted()})})},t}(),be=de.createOnNext=function(){function t(t){return t(this.value)}function e(t){return t.onNext(this.value)}function n(){return"OnNext("+this.value+")"}return function(r){var i=new de("N",!0);return i.value=r,i._accept=t.bind(i),i._acceptObservable=e.bind(i),i.toString=n.bind(i),i}}(),ve=de.createOnError=function(){function t(t,e){return e(this.exception)}function e(t){return t.onError(this.exception)}function n(){return"OnError("+this.exception+")"}return function(r){var i=new de("E");return i.exception=r,i._accept=t.bind(i),i._acceptObservable=e.bind(i),i.toString=n.bind(i),i}}(),me=de.createOnCompleted=function(){function t(t,e,n){return n()}function e(t){return t.onCompleted()}function n(){return"OnCompleted()"}return function(){var r=new de("C");return r._accept=t.bind(r),r._acceptObservable=e.bind(r),r.toString=n.bind(r),r}}(),ye=D.Internals.Enumerator=function(t,e,n){this.moveNext=t,this.getCurrent=e,this.dispose=n},we=ye.create=function(t,e,r){var i=!1;return r||(r=n),new ye(function(){if(i)return!1;var e=t();return e||(i=!0,r()),e},function(){return e()},function(){i||(r(),i=!0)})},ge=D.Internals.Enumerable=function(){function t(t){this.getEnumerator=t}return t.prototype.concat=function(){var t=this;return new He(function(n){var r=t.getEnumerator(),i=!1,o=new re,s=ue.scheduleRecursive(function(t){var s,u,c=!1;if(!i){try{c=r.moveNext(),c?s=r.getCurrent():r.dispose()}catch(a){u=a,r.dispose()}if(u)return n.onError(u),e;if(!c)return n.onCompleted(),e;var h=new ee;o.setDisposable(h),h.setDisposable(s.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){t()}))}});return new X(o,s,$(function(){i=!0,r.dispose()}))})},t.prototype.catchException=function(){var t=this;return new He(function(n){var r,i=t.getEnumerator(),o=!1,s=new re,u=ue.scheduleRecursive(function(t){var u,c,a;if(a=!1,!o){try{a=i.moveNext(),a&&(u=i.getCurrent())}catch(h){c=h}if(c)return n.onError(c),e;if(!a)return r?n.onError(r):n.onCompleted(),e;var l=new ee;s.setDisposable(l),l.setDisposable(u.subscribe(n.onNext.bind(n),function(e){r=e,t()},n.onCompleted.bind(n)))}});return new X(s,u,$(function(){o=!0}))})},t}(),Ee=ge.repeat=function(t,n){return n===e&&(n=-1),new ge(function(){var e,r=n;return we(function(){return 0===r?!1:(r>0&&r--,e=t,!0)},function(){return e})})},xe=ge.forEach=function(t,e){return e||(e=r),new ge(function(){var n,r=-1;return we(function(){return++r<t.length?(n=e(t[r],r),!0):!1},function(){return n})})},De=D.Observer=function(){};De.prototype.toNotifier=function(){var t=this;return function(e){return e.accept(t)}},De.prototype.asObserver=function(){return new _e(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},De.prototype.checked=function(){return new Ne(this)};var Ce=De.create=function(t,e,r){return t||(t=n),e||(e=u),r||(r=n),new _e(t,e,r)};De.fromNotifier=function(t){return new _e(function(e){return t(be(e))},function(e){return t(ve(e))},function(){return t(me())})},De.notifyOn=function(t){return new Re(t,this)};var Ae,Se=D.Internals.AbstractObserver=function(t){function e(){this.isStopped=!1,t.call(this)}return H(e,t),e.prototype.onNext=function(t){this.isStopped||this.next(t)},e.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.error(t))},e.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},e.prototype.dispose=function(){this.isStopped=!0},e.prototype.fail=function(t){return this.isStopped?!1:(this.isStopped=!0,this.error(t),!0)},e}(De),_e=D.AnonymousObserver=function(t){function e(e,n,r){t.call(this),this._onNext=e,this._onError=n,this._onCompleted=r}return H(e,t),e.prototype.next=function(t){this._onNext(t)},e.prototype.error=function(t){this._onError(t)},e.prototype.completed=function(){this._onCompleted()},e}(Se),Ne=function(t){function e(e){t.call(this),this._observer=e,this._state=0}H(e,t);var n=e.prototype;return n.onNext=function(t){this.checkAccess();try{this._observer.onNext(t)}catch(e){throw e}finally{this._state=0}},n.onError=function(t){this.checkAccess();try{this._observer.onError(t)}catch(e){throw e}finally{this._state=2}},n.onCompleted=function(){this.checkAccess();try{this._observer.onCompleted()}catch(t){throw t}finally{this._state=2}},n.checkAccess=function(){if(1===this._state)throw Error("Re-entrancy detected");if(2===this._state)throw Error("Observer completed");0===this._state&&(this._state=1)},e}(De),Oe=D.Internals.ScheduledObserver=function(t){function n(e,n){t.call(this),this.scheduler=e,this.observer=n,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new re}return H(n,t),n.prototype.next=function(t){var e=this;this.queue.push(function(){e.observer.onNext(t)})},n.prototype.error=function(t){var e=this;this.queue.push(function(){e.observer.onError(t)})},n.prototype.completed=function(){var t=this;this.queue.push(function(){t.observer.onCompleted()})},n.prototype.ensureActive=function(){var t=!1,n=this;!this.hasFaulted&&this.queue.length>0&&(t=!this.isAcquired,this.isAcquired=!0),t&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(t){var r;if(!(n.queue.length>0))return n.isAcquired=!1,e;r=n.queue.shift();try{r()}catch(i){throw n.queue=[],n.hasFaulted=!0,i}t()}))},n.prototype.dispose=function(){t.prototype.dispose.call(this),this.disposable.dispose()},n}(Se),Re=function(t){function e(){t.apply(this,arguments)}return H(e,t),e.prototype.next=function(e){t.prototype.next.call(this,e),this.ensureActive()},e.prototype.error=function(e){t.prototype.error.call(this,e),this.ensureActive()},e.prototype.completed=function(){t.prototype.completed.call(this),this.ensureActive()},e}(Oe),We=D.Observable=function(){function t(t){this._subscribe=t}return Ae=t.prototype,Ae.finalValue=function(){var t=this;return new He(function(e){var n,r=!1;return t.subscribe(function(t){r=!0,n=t},e.onError.bind(e),function(){r?(e.onNext(n),e.onCompleted()):e.onError(Error(A))})})},Ae.subscribe=Ae.forEach=function(t,e,n){var r;return r="object"==typeof t?t:Ce(t,e,n),this._subscribe(r)},Ae.toArray=function(){function t(t,e){var n=t.slice(0);return n.push(e),n}return this.scan([],t).startWith([]).finalValue()},t}();We.start=function(t,e,n){return ke(t,e,n)()};var ke=We.toAsync=function(t,n,r){return n||(n=fe),function(){var i=arguments,o=new Qe;return n.schedule(function(){var n;try{n=t.apply(r,i)}catch(s){return o.onError(s),e}o.onNext(n),o.onCompleted()}),o.asObservable()}};Ae.observeOn=function(t){var e=this;return new He(function(n){return e.subscribe(new Re(t,n))})},Ae.subscribeOn=function(t){var e=this;return new He(function(n){var r=new ee,i=new re;return i.setDisposable(r),r.setDisposable(t.schedule(function(){i.setDisposable(new b(t,e.subscribe(n)))})),i})},We.create=function(t){return new He(function(e){return $(t(e))})},We.createWithDisposable=function(t){return new He(t)};var je=We.defer=function(t){return new He(function(e){var n;try{n=t()}catch(r){return Me(r).subscribe(e)}return n.subscribe(e)})},qe=We.empty=function(t){return t||(t=ue),new He(function(e){return t.schedule(function(){e.onCompleted()})})},Te=We.fromArray=function(t,e){return e||(e=ce),new He(function(n){var r=0;return e.scheduleRecursive(function(e){t.length>r?(n.onNext(t[r++]),e()):n.onCompleted()})})};We.generate=function(t,n,r,i,o){return o||(o=ce),new He(function(s){var u=!0,c=t;return o.scheduleRecursive(function(t){var o,a;try{u?u=!1:c=r(c),o=n(c),o&&(a=i(c))}catch(h){return s.onError(h),e}o?(s.onNext(a),t()):s.onCompleted()})})};var Ie=We.never=function(){return new He(function(){return te})};We.range=function(t,e,n){return n||(n=ce),new He(function(r){return n.scheduleRecursiveWithState(0,function(n,i){e>n?(r.onNext(t+n),i(n+1)):r.onCompleted()})})},We.repeat=function(t,e,n){return n||(n=ce),null==e&&(e=-1),Pe(t,n).repeat(e)};var Pe=We["return"]=We.returnValue=function(t,e){return e||(e=ue),new He(function(n){return e.schedule(function(){n.onNext(t),n.onCompleted()})})},Me=We["throw"]=We.throwException=function(t,e){return e||(e=ue),new He(function(n){return e.schedule(function(){n.onError(t)})})};We.using=function(t,e){return new He(function(n){var r,i,o=te;try{r=t(),r&&(o=r),i=e(r)}catch(s){return new X(Me(s).subscribe(n),o)}return new X(i.subscribe(n),o)})},Ae.amb=function(t){var e=this;return new He(function(n){function r(){o||(o=s,a.dispose())}function i(){o||(o=u,c.dispose())}var o,s="L",u="R",c=new ee,a=new ee;return c.setDisposable(e.subscribe(function(t){r(),o===s&&n.onNext(t)},function(t){r(),o===s&&n.onError(t)},function(){r(),o===s&&n.onCompleted()})),a.setDisposable(t.subscribe(function(t){i(),o===u&&n.onNext(t)},function(t){i(),o===u&&n.onError(t)},function(){i(),o===u&&n.onCompleted()})),new X(c,a)})},We.amb=function(){function t(t,e){return t.amb(e)}for(var e=Ie(),n=p(arguments,0),r=0,i=n.length;i>r;r++)e=t(e,n[r]);return e},Ae["catch"]=Ae.catchException=function(t){return"function"==typeof t?m(this,t):Le([this,t])};var Le=We.catchException=We["catch"]=function(){var t=p(arguments,0);return xe(t).catchException()};Ae.combineLatest=function(){var t=F.call(arguments);return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),Ve.apply(this,t)};var Ve=We.combineLatest=function(){var t=F.call(arguments),n=t.pop();return Array.isArray(t[0])&&(t=t[0]),new He(function(i){function o(t){var o;if(a[t]=!0,h||(h=a.every(r))){try{o=n.apply(null,f)}catch(s){return i.onError(s),e}i.onNext(o)}else l.filter(function(e,n){return n!==t}).every(r)&&i.onCompleted()}function s(t){l[t]=!0,l.every(r)&&i.onCompleted()}for(var u=function(){return!1},c=t.length,a=d(c,u),h=!1,l=d(c,u),f=Array(c),p=Array(c),b=0;c>b;b++)(function(e){p[e]=new ee,p[e].setDisposable(t[e].subscribe(function(t){f[e]=t,o(e)},i.onError.bind(i),function(){s(e)}))})(b);return new X(p)})};Ae.concat=function(){var t=F.call(arguments,0);return t.unshift(this),ze.apply(this,t)};var ze=We.concat=function(){var t=p(arguments,0);return xe(t).concat()};Ae.concatObservable=Ae.concatAll=function(){return this.merge(1)},Ae.merge=function(t){if("number"!=typeof t)return Be(this,t);var e=this;return new He(function(n){var r=0,i=new X,o=!1,s=[],u=function(t){var e=new ee;i.add(e),e.setDisposable(t.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){var t;i.remove(e),s.length>0?(t=s.shift(),u(t)):(r--,o&&0===r&&n.onCompleted())}))};return i.add(e.subscribe(function(e){t>r?(r++,u(e)):s.push(e)},n.onError.bind(n),function(){o=!0,0===r&&n.onCompleted()})),i})};var Be=We.merge=function(){var t,e;return arguments[0]?arguments[0].now?(t=arguments[0],e=F.call(arguments,1)):(t=ue,e=F.call(arguments,0)):(t=ue,e=F.call(arguments,1)),Array.isArray(e[0])&&(e=e[0]),Te(e,t).mergeObservable()};Ae.mergeObservable=Ae.mergeAll=function(){var t=this;return new He(function(e){var n=new X,r=!1,i=new ee;return n.add(i),i.setDisposable(t.subscribe(function(t){var i=new ee;n.add(i),i.setDisposable(t.subscribe(function(t){e.onNext(t)},e.onError.bind(e),function(){n.remove(i),r&&1===n.length&&e.onCompleted()}))},e.onError.bind(e),function(){r=!0,1===n.length&&e.onCompleted()})),n})},Ae.onErrorResumeNext=function(t){if(!t)throw Error("Second observable is required");return Fe([this,t])};var Fe=We.onErrorResumeNext=function(){var t=p(arguments,0);return new He(function(e){var n=0,r=new re,i=ue.scheduleRecursive(function(i){var o,s;t.length>n?(o=t[n++],s=new ee,r.setDisposable(s),s.setDisposable(o.subscribe(e.onNext.bind(e),function(){i()},function(){i()}))):e.onCompleted()});return new X(r,i)})};Ae.skipUntil=function(t){var e=this;return new He(function(n){var r=!1,i=new X(e.subscribe(function(t){r&&n.onNext(t)},n.onError.bind(n),function(){r&&n.onCompleted()})),o=new ee;return i.add(o),o.setDisposable(t.subscribe(function(){r=!0,o.dispose()},n.onError.bind(n),function(){o.dispose()})),i})},Ae["switch"]=Ae.switchLatest=function(){var t=this;return new He(function(e){var n=!1,r=new re,i=!1,o=0,s=t.subscribe(function(t){var s=new ee,u=++o;n=!0,r.setDisposable(s),s.setDisposable(t.subscribe(function(t){o===u&&e.onNext(t)},function(t){o===u&&e.onError(t)},function(){o===u&&(n=!1,i&&e.onCompleted())}))},e.onError.bind(e),function(){i=!0,n||e.onCompleted()});return new X(s,r)})},Ae.takeUntil=function(t){var e=this;return new He(function(r){return new X(e.subscribe(r),t.subscribe(r.onCompleted.bind(r),r.onError.bind(r),n))})},Ae.zip=function(){if(Array.isArray(arguments[0]))return y.apply(this,arguments);var t=this,n=F.call(arguments),i=n.pop();return n.unshift(t),new He(function(o){function s(t){a[t]=!0,a.every(function(t){return t})&&o.onCompleted()}for(var u=n.length,c=d(u,function(){return[]}),a=d(u,function(){return!1}),h=function(n){var s,u;if(c.every(function(t){return t.length>0})){try{u=c.map(function(t){return t.shift()}),s=i.apply(t,u)}catch(h){return o.onError(h),e}o.onNext(s)}else a.filter(function(t,e){return e!==n}).every(r)&&o.onCompleted()},l=Array(u),f=0;u>f;f++)(function(t){l[t]=new ee,l[t].setDisposable(n[t].subscribe(function(e){c[t].push(e),h(t)},o.onError.bind(o),function(){s(t)}))})(f);return new X(l)})},We.zip=function(){var t=F.call(arguments,0),e=t.shift();return e.zip.apply(e,t)},We.zipArray=function(){var t=F.call(arguments);return new He(function(n){function i(t){if(u.every(function(t){return t.length>0})){var i=u.map(function(t){return t.shift()});n.onNext(i)}else if(c.filter(function(e,n){return n!==t}).every(r))return n.onCompleted(),e}function o(t){return c[t]=!0,c.every(r)?(n.onCompleted(),e):e}for(var s=t.length,u=d(s,function(){return[]}),c=d(s,function(){return!1}),a=Array(s),h=0;s>h;h++)(function(e){a[e]=new ee,a[e].setDisposable(t[e].subscribe(function(t){u[e].push(t),i(e)},n.onError.bind(n),function(){o(e)}))})(h);var l=new X(a);return l.add($(function(){for(var t=0,e=u.length;e>t;t++)u[t]=[]})),l})},Ae.asObservable=function(){var t=this;return new He(function(e){return t.subscribe(e)})},Ae.bufferWithCount=function(t,n){return n===e&&(n=t),this.windowWithCount(t,n).selectMany(function(t){return t.toArray()}).where(function(t){return t.length>0})},Ae.dematerialize=function(){var t=this;return new He(function(e){return t.subscribe(function(t){return t.accept(e)},e.onError.bind(e),e.onCompleted.bind(e))})},Ae.distinctUntilChanged=function(t,n){var o=this;return t||(t=r),n||(n=i),new He(function(r){var i,s=!1;return o.subscribe(function(o){var u,c=!1;try{u=t(o)}catch(a){return r.onError(a),e}if(s)try{c=n(i,u)}catch(a){return r.onError(a),e}s&&c||(s=!0,i=u,r.onNext(o))},r.onError.bind(r),r.onCompleted.bind(r))})},Ae["do"]=Ae.doAction=function(t,e,n){var r,i=this;return"function"==typeof t?r=t:(r=t.onNext.bind(t),e=t.onError.bind(t),n=t.onCompleted.bind(t)),new He(function(t){return i.subscribe(function(e){try{r(e)}catch(n){t.onError(n)}t.onNext(e)},function(n){if(e){try{e(n)}catch(r){t.onError(r)}t.onError(n)}else t.onError(n)},function(){if(n){try{n()}catch(e){t.onError(e)}t.onCompleted()}else t.onCompleted()})})},Ae["finally"]=Ae.finallyAction=function(t){var e=this;return new He(function(n){var r=e.subscribe(n);return $(function(){try{r.dispose()}catch(e){throw e }finally{t()}})})},Ae.ignoreElements=function(){var t=this;return new He(function(e){return t.subscribe(n,e.onError.bind(e),e.onCompleted.bind(e))})},Ae.materialize=function(){var t=this;return new He(function(e){return t.subscribe(function(t){e.onNext(be(t))},function(t){e.onNext(ve(t)),e.onCompleted()},function(){e.onNext(me()),e.onCompleted()})})},Ae.repeat=function(t){return Ee(this,t).concat()},Ae.retry=function(t){return Ee(this,t).catchException()},Ae.scan=function(){var t,e,n=!1;2===arguments.length?(t=arguments[0],e=arguments[1],n=!0):e=arguments[0];var r=this;return je(function(){var i,o=!1;return r.select(function(r){return o?i=e(i,r):(i=n?e(t,r):r,o=!0),i})})},Ae.skipLast=function(t){var e=this;return new He(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&n.onNext(r.shift())},n.onError.bind(n),n.onCompleted.bind(n))})},Ae.startWith=function(){var t,e,n=0;return arguments.length&&"now"in Object(arguments[0])?(e=arguments[0],n=1):e=ue,t=F.call(arguments,n),xe([Te(t,e),this]).concat()},Ae.takeLast=function(t,e){return this.takeLastBuffer(t).selectMany(function(t){return Te(t,e)})},Ae.takeLastBuffer=function(t){var e=this;return new He(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&r.shift()},n.onError.bind(n),function(){n.onNext(r),n.onCompleted()})})},Ae.windowWithCount=function(t,e){var n=this;if(0>=t)throw Error(S);if(null==e&&(e=t),0>=e)throw Error(S);return new He(function(r){var i=new ee,o=new ie(i),s=0,u=[],c=function(){var t=new Ke;u.push(t),r.onNext(G(t,o))};return c(),i.setDisposable(n.subscribe(function(n){for(var r,i=0,o=u.length;o>i;i++)u[i].onNext(n);var a=s-t+1;a>=0&&0===a%e&&(r=u.shift(),r.onCompleted()),s++,0===s%e&&c()},function(t){for(;u.length>0;)u.shift().onError(t);r.onError(t)},function(){for(;u.length>0;)u.shift().onCompleted();r.onCompleted()})),o})},Ae.defaultIfEmpty=function(t){var n=this;return t===e&&(t=null),new He(function(e){var r=!1;return n.subscribe(function(t){r=!0,e.onNext(t)},e.onError.bind(e),function(){r||e.onNext(t),e.onCompleted()})})},Ae.distinct=function(t,n){var i=this;return t||(t=r),n||(n=s),new He(function(r){var o={};return i.subscribe(function(i){var s,u,c,a=!1;try{s=t(i),u=n(s)}catch(h){return r.onError(h),e}for(c in o)if(u===c){a=!0;break}a||(o[u]=null,r.onNext(i))},r.onError.bind(r),r.onCompleted.bind(r))})},Ae.groupBy=function(t,e,n){return this.groupByUntil(t,e,function(){return Ie()},n)},Ae.groupByUntil=function(t,i,o,u){var c=this;return i||(i=r),u||(u=s),new He(function(r){var s={},a=new X,h=new ie(a);return a.add(c.subscribe(function(c){var l,f,p,d,b,v,m,y,w,g;try{v=t(c),m=u(v)}catch(E){for(g in s)s[g].onError(E);return r.onError(E),e}d=!1;try{w=s[m],w||(w=new Ke,s[m]=w,d=!0)}catch(E){for(g in s)s[g].onError(E);return r.onError(E),e}if(d){b=new Ge(v,w,h),f=new Ge(v,w);try{l=o(f)}catch(E){for(g in s)s[g].onError(E);return r.onError(E),e}r.onNext(b),y=new ee,a.add(y);var x=function(){m in s&&(delete s[m],w.onCompleted()),a.remove(y)};y.setDisposable(l.take(1).subscribe(n,function(t){for(g in s)s[g].onError(t);r.onError(t)},function(){x()}))}try{p=i(c)}catch(E){for(g in s)s[g].onError(E);return r.onError(E),e}w.onNext(p)},function(t){for(var e in s)s[e].onError(t);r.onError(t)},function(){for(var t in s)s[t].onCompleted();r.onCompleted()})),h})},Ae.select=Ae.map=function(t,n){var r=this;return new He(function(i){var o=0;return r.subscribe(function(s){var u;try{u=t.call(n,s,o++,r)}catch(c){return i.onError(c),e}i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},Ae.pluck=function(t){return this.select(function(e){return e[t]})},Ae.selectMany=Ae.flatMap=function(t,e){return e?this.selectMany(function(n){return t(n).select(function(t){return e(n,t)})}):"function"==typeof t?w.call(this,t):w.call(this,function(){return t})},Ae.selectSwitch=Ae.flatMapLatest=function(t,e){return this.select(t,e).switchLatest()},Ae.skip=function(t){if(0>t)throw Error(S);var e=this;return new He(function(n){var r=t;return e.subscribe(function(t){0>=r?n.onNext(t):r--},n.onError.bind(n),n.onCompleted.bind(n))})},Ae.skipWhile=function(t,n){var r=this;return new He(function(i){var o=0,s=!1;return r.subscribe(function(u){if(!s)try{s=!t.call(n,u,o++,r)}catch(c){return i.onError(c),e}s&&i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},Ae.take=function(t,e){if(0>t)throw Error(S);if(0===t)return qe(e);var n=this;return new He(function(e){var r=t;return n.subscribe(function(t){r>0&&(r--,e.onNext(t),0===r&&e.onCompleted())},e.onError.bind(e),e.onCompleted.bind(e))})},Ae.takeWhile=function(t,n){var r=this;return new He(function(i){var o=0,s=!0;return r.subscribe(function(u){if(s){try{s=t.call(n,u,o++,r)}catch(c){return i.onError(c),e}s?i.onNext(u):i.onCompleted()}},i.onError.bind(i),i.onCompleted.bind(i))})},Ae.where=Ae.filter=function(t,n){var r=this;return new He(function(i){var o=0;return r.subscribe(function(s){var u;try{u=t.call(n,s,o++,r)}catch(c){return i.onError(c),e}u&&i.onNext(s)},i.onError.bind(i),i.onCompleted.bind(i))})};var He=D.Internals.AnonymousObservable=function(t){function n(r){function i(t){var e=new Ue(t);if(ce.scheduleRequired())ce.schedule(function(){try{e.disposable(r(e))}catch(t){if(!e.fail(t))throw t}});else try{e.disposable(r(e))}catch(n){if(!e.fail(n))throw n}return e}return this instanceof n?(t.call(this,i),e):new n(r)}return H(n,t),n}(We),Ue=function(t){function e(e){t.call(this),this.observer=e,this.m=new ee}H(e,t);var n=e.prototype;return n.next=function(t){var e=!1;try{this.observer.onNext(t),e=!0}catch(n){throw n}finally{e||this.dispose()}},n.error=function(t){try{this.observer.onError(t)}catch(e){throw e}finally{this.dispose()}},n.completed=function(){try{this.observer.onCompleted()}catch(t){throw t}finally{this.dispose()}},n.disposable=function(t){return this.m.disposable(t)},n.dispose=function(){t.prototype.dispose.call(this),this.m.dispose()},e}(Se),Ge=function(t){function e(t){return this.underlyingObservable.subscribe(t)}function n(n,r,i){t.call(this,e),this.key=n,this.underlyingObservable=i?new He(function(t){return new X(i.getDisposable(),r.subscribe(t))}):r}return H(n,t),n}(We),Je=function(t,e){this.subject=t,this.observer=e};Je.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1),this.observer=null}};var Ke=D.Subject=function(t){function e(t){return c.call(this),this.isStopped?this.exception?(t.onError(this.exception),te):(t.onCompleted(),te):(this.observers.push(t),new Je(this,t))}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return H(n,t),U(n.prototype,De,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(c.call(this),!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0;for(var e=0,n=t.length;n>e;e++)t[e].onCompleted();this.observers=[]}},onError:function(t){if(c.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){if(c.call(this),!this.isStopped)for(var e=this.observers.slice(0),n=0,r=e.length;r>n;n++)e[n].onNext(t)},dispose:function(){this.isDisposed=!0,this.observers=null}}),n.create=function(t,e){return new Xe(t,e)},n}(We),Qe=D.AsyncSubject=function(t){function e(t){if(c.call(this),!this.isStopped)return this.observers.push(t),new Je(this,t);var e=this.exception,n=this.hasValue,r=this.value;return e?t.onError(e):n?(t.onNext(r),t.onCompleted()):t.onCompleted(),te}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return H(n,t),U(n.prototype,De,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){var t,e,n;if(c.call(this),!this.isStopped){var r=this.observers.slice(0);this.isStopped=!0;var i=this.value,o=this.hasValue;if(o)for(e=0,n=r.length;n>e;e++)t=r[e],t.onNext(i),t.onCompleted();else for(e=0,n=r.length;n>e;e++)r[e].onCompleted();this.observers=[]}},onError:function(t){if(c.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){c.call(this),this.isStopped||(this.value=t,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),n}(We),Xe=function(t){function e(t){return this.observable.subscribe(t)}function n(n,r){t.call(this,e),this.observer=n,this.observable=r}return H(n,t),U(n.prototype,De,{onCompleted:function(){this.observer.onCompleted()},onError:function(t){this.observer.onError(t)},onNext:function(t){this.observer.onNext(t)}}),n}(We);return"function"==typeof define&&"object"==typeof define.amd&&define.amd?(t.Rx=D,define(function(){return D})):(g?"object"==typeof module&&module&&module.exports==g?module.exports=D:g=D:t.Rx=D,e)})(this);
royswastik/jsdelivr
files/rxjs/2.1.20/rx.modern.min.js
JavaScript
mit
40,965
/** @license MIT License (c) copyright 2013-2014 original author or authors */ /** * Collection of helper functions for wrapping and executing 'traditional' * synchronous functions in a promise interface. * * @author Brian Cavalier * @contributor Renato Zannon */ (function(define) { define(function(require) { var when = require('./when'); var attempt = when['try']; var _liftAll = require('./lib/liftAll'); var _apply = require('./lib/apply')(when.Promise); var slice = Array.prototype.slice; return { lift: lift, liftAll: liftAll, call: attempt, apply: apply, compose: compose }; /** * Takes a function and an optional array of arguments (that might be promises), * and calls the function. The return value is a promise whose resolution * depends on the value returned by the function. * @param {function} f function to be called * @param {Array} [args] array of arguments to func * @returns {Promise} promise for the return value of func */ function apply(f, args) { // slice args just in case the caller passed an Arguments instance return _apply(f, this, args == null ? [] : slice.call(args)); } /** * Takes a 'regular' function and returns a version of that function that * returns a promise instead of a plain value, and handles thrown errors by * returning a rejected promise. Also accepts a list of arguments to be * prepended to the new function, as does Function.prototype.bind. * * The resulting function is promise-aware, in the sense that it accepts * promise arguments, and waits for their resolution. * @param {Function} f function to be bound * @param {...*} [args] arguments to be prepended for the new function @deprecated * @returns {Function} a promise-returning function */ function lift(f /*, args... */) { var args = arguments.length > 1 ? slice.call(arguments, 1) : []; return function() { return _apply(f, this, args.concat(slice.call(arguments))); }; } /** * Lift all the functions/methods on src * @param {object|function} src source whose functions will be lifted * @param {function?} combine optional function for customizing the lifting * process. It is passed dst, the lifted function, and the property name of * the original function on src. * @param {(object|function)?} dst option destination host onto which to place lifted * functions. If not provided, liftAll returns a new object. * @returns {*} If dst is provided, returns dst with lifted functions as * properties. If dst not provided, returns a new object with lifted functions. */ function liftAll(src, combine, dst) { return _liftAll(lift, combine, dst, src); } /** * Composes multiple functions by piping their return values. It is * transparent to whether the functions return 'regular' values or promises: * the piped argument is always a resolved value. If one of the functions * throws or returns a rejected promise, the composed promise will be also * rejected. * * The arguments (or promises to arguments) given to the returned function (if * any), are passed directly to the first function on the 'pipeline'. * @param {Function} f the function to which the arguments will be passed * @param {...Function} [funcs] functions that will be composed, in order * @returns {Function} a promise-returning composition of the functions */ function compose(f /*, funcs... */) { var funcs = slice.call(arguments, 1); return function() { var thisArg = this; var args = slice.call(arguments); var firstPromise = attempt.apply(thisArg, [f].concat(args)); return when.reduce(funcs, function(arg, func) { return func.call(thisArg, arg); }, firstPromise); }; } }); })(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });
chaoliag/blog
node_modules/ghost-s3-storage/node_modules/when/function.js
JavaScript
mit
3,839
// Backbone.Marionette v0.9.3 // // Copyright (C)2012 Derick Bailey, Muted Solutions, LLC // Distributed Under MIT License // // Documentation and Full License Available at: // http://github.com/derickbailey/backbone.marionette // Marionette.Async // ---------------- // Provides asynchronous rendering implementations // for the various view types in Marionette Backbone.Marionette.Async = (function(Backbone, Marionette, _, $){ // Configure Marionette to use the async rendering for all view types var Async = { init: function(){ Marionette.TemplateCache = Async.TemplateCache; Marionette.Renderer = Async.Renderer; _.extend(Marionette.ItemView.prototype, Async.ItemView); _.extend(Marionette.CollectionView.prototype, Async.CollectionView); _.extend(Marionette.CompositeView.prototype, Async.CompositeView); _.extend(Marionette.Region.prototype, Async.Region); } }; // Async ItemView // -------------- // An asynchronous rendering method for the `ItemView`. This method // assumes template loading, data serialization, `beforRender`, and // `onRender` functions are all asynchronous, using `jQuery.Deferred()` // and `jQuery.when(...).then(...)` to manage async calls. Async.ItemView = { render: function(){ var that = this; var deferredRender = $.Deferred(); var beforeRenderDone = function() { that.trigger("before:render", that); that.trigger("item:before:render", that); var deferredData = that.serializeData(); $.when(deferredData).then(dataSerialized); } var dataSerialized = function(data){ var template = that.getTemplate(); var asyncRender = Marionette.Renderer.render(template, data); $.when(asyncRender).then(templateRendered); } var templateRendered = function(html){ that.$el.html(html); callDeferredMethod(that.onRender, onRenderDone, that); } var onRenderDone = function(){ that.trigger("render", that); that.trigger("item:rendered", that); deferredRender.resolve(); } callDeferredMethod(this.beforeRender, beforeRenderDone, this); return deferredRender.promise(); } }; // Async CollectionView // -------------------- // provides async rendering for collection views Async.CollectionView = { render: function(){ var that = this; var deferredRender = $.Deferred(); var promises; this.triggerBeforeRender(); this.closeChildren(); if (this.collection && this.collection.length > 0) { promises = this.showCollection(); } else { var promise = this.showEmptyView(); promises = [promise]; } deferredRender.done(function(){ that.triggerRendered(); }); $.when.apply(this, promises).then(function(){ deferredRender.resolveWith(that); }); return deferredRender.promise(); }, // Internal method to loop through each item in the // collection view and show it showCollection: function(){ var that = this; var promises = []; var ItemView = this.getItemView(); this.collection.each(function(item, index){ var promise = that.addItemView(item, ItemView, index); promises.push(promise); }); return promises; }, // Internal method to show an empty view in place of // a collection of item views, when the collection is // empty showEmptyView: function(promises){ var promise; var EmptyView = this.options.emptyView || this.emptyView; if (EmptyView){ this.showingEmptyView = true; var model = new Backbone.Model(); promise = this.addItemView(model, EmptyView, 0); } return promise; }, renderItemView: function(view, index) { var that = this; var viewRendered = view.render(); $.when(viewRendered).then(function(){ that.appendHtml(that, view, index); }); return viewRendered; } } // Async Composite View // -------------------- Async.CompositeView = { // Renders the model once, and the collection once. Calling // this again will tell the model's view to re-render itself // but the collection will not re-render. render: function(){ var that = this; var compositeRendered = $.Deferred(); this.resetItemViewContainer(); var modelIsRendered = this.renderModel(); $.when(modelIsRendered).then(function(html){ that.$el.html(html); that.trigger("composite:model:rendered"); that.trigger("render"); var collectionIsRendered = that.renderCollection(); $.when(collectionIsRendered).then(function(){ compositeRendered.resolve(); }); }); compositeRendered.done(function(){ that.trigger("composite:rendered"); }); return compositeRendered.promise(); }, // Render the collection for the composite view renderCollection: function(){ var collectionDeferred = Marionette.CollectionView.prototype.render.apply(this, arguments); collectionDeferred.done(function(){ this.trigger("composite:collection:rendered"); }); return collectionDeferred.promise(); } } // Async Region // ------------ // Show a view that is rendered asynchronously, waiting for the view // to be rendered before swaping it in. Async.Region = { show: function(view){ var that = this; var asyncShow = $.Deferred(); this.ensureEl(); this.close(); // Wait for the view to finish rendering $.when(view.render()).then(function () { that.open(view); if (view.onShow) { view.onShow(); } view.trigger("show"); if (that.onShow) { that.onShow(view); } that.trigger("view:show", view); asyncShow.resolve(); }); this.currentView = view; return asyncShow.promise(); } }; // Async Renderer // -------------- // Render a template with data by passing in the template // selector and the data to render. Do it all asynchronously. Async.Renderer = { // Render a template with data. The `template` parameter is // passed to the `TemplateCache` object to retrieve the // template function. Override this method to provide your own // custom rendering and template handling for all of Marionette. render: function(template, data){ var asyncRender = $.Deferred(); var templateRetrieval = Marionette.TemplateCache.get(template); $.when(templateRetrieval).then(function(templateFunc){ var html = templateFunc(data); asyncRender.resolve(html); }); return asyncRender.promise(); } }; // Async Template Cache // -------------------- // Manage templates stored in `<script>` blocks, // caching them for faster access. Async.TemplateCache = function(templateId){ this.templateId = templateId; }; // TemplateCache object-level methods. Manage the template // caches from these method calls instead of creating // your own TemplateCache instances _.extend(Async.TemplateCache, { templateCaches: {}, // Get the specified template by id. Either // retrieves the cached version, or loads it // from the DOM. get: function(templateId){ var that = this; var cachedTemplate = this.templateCaches[templateId]; if (!cachedTemplate){ cachedTemplate = new Marionette.TemplateCache(templateId); this.templateCaches[templateId] = cachedTemplate; } return cachedTemplate.load(); }, // Clear templates from the cache. If no arguments // are specified, clears all templates: // `clear()` // // If arguments are specified, clears each of the // specified templates from the cache: // `clear("#t1", "#t2", "...")` clear: function(){ var i; var length = arguments.length; if (length > 0){ for(i=0; i<length; i++){ delete this.templateCaches[arguments[i]]; } } else { this.templateCaches = {}; } } }); // TemplateCache instance methods, allowing each // template cache object to manage it's own state // and know whether or not it has been loaded _.extend(Async.TemplateCache.prototype, { // Internal method to load the template asynchronously. load: function(){ var that = this; // Guard clause to prevent loading this template more than once if (this.deferred){ return this.deferred.promise(); } // Load the template asynchronously this.deferred = $.Deferred(); this.loadTemplate(this.templateId, function(template){ that.template = template; that.deferred.resolve(template); }); return this.deferred.promise(); }, // Load a template from the DOM, by default. Override // this method to provide your own template retrieval, // such as asynchronous loading from a server. loadTemplate: function(templateId, callback){ var template = $(templateId).html(); if (!template || template.length === 0){ var msg = "Could not find template: '" + templateId + "'"; var err = new Error(msg); err.name = "NoTemplateError"; throw err; } template = this.compileTemplate(template); callback.call(this, template); }, // Pre-compile the template before caching it. Override // this method if you do not need to pre-compile a template // (JST / RequireJS for example) or if you want to change // the template engine used (Handebars, etc). compileTemplate: function(rawTemplate){ return _.template(rawTemplate); } }); // Async Helpers // ------------- // A simple wrapper method for deferring a callback until // after another method has been called, passing the // results of the first method to the second. Uses jQuery's // deferred / promise objects, and $.when/then to make it // work. var callDeferredMethod = function(fn, callback, context){ var promise; if (fn) { promise = fn.call(context); } $.when(promise).then(_.bind(callback, context)); } // Initialize the async-modules Async.init(); return Async; })(Backbone, Backbone.Marionette, _, window.jQuery || window.Zepto || window.ender);
senekis/cdnjs
ajax/libs/backbone.marionette/0.9.3-bundled/backbone.marionette.async.js
JavaScript
mit
9,944
// MarionetteJS (Backbone.Marionette) // ---------------------------------- // v1.0.0 // // Copyright (c)2013 Derick Bailey, Muted Solutions, LLC. // Distributed under MIT license // // http://marionettejs.com /*! * Includes BabySitter * https://github.com/marionettejs/backbone.babysitter/ * * Includes Wreqr * https://github.com/marionettejs/backbone.wreqr/ */ Backbone.ChildViewContainer=function(e,t){var i=function(e){this._views={},this._indexByModel={},this._indexByCollection={},this._indexByCustom={},this._updateLength(),this._addInitialViews(e)};t.extend(i.prototype,{add:function(e,t){var i=e.cid;this._views[i]=e,e.model&&(this._indexByModel[e.model.cid]=i),e.collection&&(this._indexByCollection[e.collection.cid]=i),t&&(this._indexByCustom[t]=i),this._updateLength()},findByModel:function(e){var t=this._indexByModel[e.cid];return this.findByCid(t)},findByCollection:function(e){var t=this._indexByCollection[e.cid];return this.findByCid(t)},findByCustom:function(e){var t=this._indexByCustom[e];return this.findByCid(t)},findByIndex:function(e){return t.values(this._views)[e]},findByCid:function(e){return this._views[e]},remove:function(e){var t=e.cid;e.model&&delete this._indexByModel[e.model.cid],e.collection&&delete this._indexByCollection[e.collection.cid];var i;for(var n in this._indexByCustom)if(this._indexByCustom.hasOwnProperty(n)&&this._indexByCustom[n]===t){i=n;break}i&&delete this._indexByCustom[i],delete this._views[t],this._updateLength()},call:function(e,t){t=Array.prototype.slice.call(arguments,1),this.apply(e,t)},apply:function(e,i){i=i||[],t.each(this._views,function(n){t.isFunction(n[e])&&n[e].apply(n,i)})},_updateLength:function(){this.length=t.size(this._views)},_addInitialViews:function(e){if(e){var t,i,n=e.length;for(i=0;n>i;i++)t=e[i],this.add(t)}}});var n=["forEach","each","map","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","toArray","first","initial","rest","last","without","isEmpty","pluck"];return t.each(n,function(e){i.prototype[e]=function(){var i=t.values(this._views),n=[i].concat(t.toArray(arguments));return t[e].apply(t,n)}}),i}(Backbone,_),Backbone.Wreqr=function(e,t,i){"use strict";var n={};return n.Handlers=function(e,t){var i=function(e){this.options=e,this._wreqrHandlers={},t.isFunction(this.initialize)&&this.initialize(e)};return i.extend=e.Model.extend,t.extend(i.prototype,e.Events,{setHandlers:function(e){t.each(e,function(e,i){var n=null;t.isObject(e)&&!t.isFunction(e)&&(n=e.context,e=e.callback),this.setHandler(i,e,n)},this)},setHandler:function(e,t,i){var n={callback:t,context:i};this._wreqrHandlers[e]=n,this.trigger("handler:add",e,t,i)},hasHandler:function(e){return!!this._wreqrHandlers[e]},getHandler:function(e){var t=this._wreqrHandlers[e];if(!t)throw Error("Handler not found for '"+e+"'");return function(){var e=Array.prototype.slice.apply(arguments);return t.callback.apply(t.context,e)}},removeHandler:function(e){delete this._wreqrHandlers[e]},removeAllHandlers:function(){this._wreqrHandlers={}}}),i}(e,i),n.CommandStorage=function(){var t=function(e){this.options=e,this._commands={},i.isFunction(this.initialize)&&this.initialize(e)};return i.extend(t.prototype,e.Events,{getCommands:function(e){var t=this._commands[e];return t||(t={command:e,instances:[]},this._commands[e]=t),t},addCommand:function(e,t){var i=this.getCommands(e);i.instances.push(t)},clearCommands:function(e){var t=this.getCommands(e);t.instances=[]}}),t}(),n.Commands=function(e){return e.Handlers.extend({storageType:e.CommandStorage,constructor:function(t){this.options=t||{},this._initializeStorage(this.options),this.on("handler:add",this._executeCommands,this);var i=Array.prototype.slice.call(arguments);e.Handlers.prototype.constructor.apply(this,i)},execute:function(e,t){e=arguments[0],t=Array.prototype.slice.call(arguments,1),this.hasHandler(e)?this.getHandler(e).apply(this,t):this.storage.addCommand(e,t)},_executeCommands:function(e,t,n){var r=this.storage.getCommands(e);i.each(r.instances,function(e){t.apply(n,e)}),this.storage.clearCommands(e)},_initializeStorage:function(e){var t,n=e.storageType||this.storageType;t=i.isFunction(n)?new n:n,this.storage=t}})}(n),n.RequestResponse=function(e){return e.Handlers.extend({request:function(){var e=arguments[0],t=Array.prototype.slice.call(arguments,1);return this.getHandler(e).apply(this,t)}})}(n),n.EventAggregator=function(e,t){var i=function(){};return i.extend=e.Model.extend,t.extend(i.prototype,e.Events),i}(e,i),n}(Backbone,Backbone.Marionette,_);var Marionette=function(e,t,i){"use strict";function n(e){return s.call(e)}function r(e,t){var i=Error(e);throw i.name=t||"Error",i}var o={};t.Marionette=o,o.$=t.$;var s=Array.prototype.slice;return o.extend=t.Model.extend,o.getOption=function(e,t){if(e&&t){var i;return i=e.options&&t in e.options&&void 0!==e.options[t]?e.options[t]:e[t]}},o.triggerMethod=function(){function e(e,t,i){return i.toUpperCase()}var t=/(^|:)(\w)/gi,n=function(n){var r="on"+n.replace(t,e),o=this[r];return this.trigger.apply(this,arguments),i.isFunction(o)?o.apply(this,i.tail(arguments)):void 0};return n}(),o.MonitorDOMRefresh=function(){function e(e){e._isShown=!0,n(e)}function t(e){e._isRendered=!0,n(e)}function n(e){e._isShown&&e._isRendered&&i.isFunction(e.triggerMethod)&&e.triggerMethod("dom:refresh")}return function(i){i.listenTo(i,"show",function(){e(i)}),i.listenTo(i,"render",function(){t(i)})}}(),function(e){function t(e,t,n,o){var s=o.split(/\s+/);i.each(s,function(i){var o=e[i];o||r("Method '"+i+"' was configured as an event handler, but does not exist."),e.listenTo(t,n,o,e)})}function n(e,t,i,n){e.listenTo(t,i,n,e)}function o(e,t,n,r){var o=r.split(/\s+/);i.each(o,function(){var i=e[i];e.stopListening(t,n,i,e)})}function s(e,t,i,n){e.stopListening(t,i,n,e)}function h(e,t,n,r,o){t&&n&&(i.isFunction(n)&&(n=n.call(e)),i.each(n,function(n,s){i.isFunction(n)?r(e,t,s,n):o(e,t,s,n)}))}e.bindEntityEvents=function(e,i,r){h(e,i,r,n,t)},e.unbindEntityEvents=function(e,t,i){h(e,t,i,s,o)}}(o),o.Callbacks=function(){this._deferred=o.$.Deferred(),this._callbacks=[]},i.extend(o.Callbacks.prototype,{add:function(e,t){this._callbacks.push({cb:e,ctx:t}),this._deferred.done(function(i,n){t&&(i=t),e.call(i,n)})},run:function(e,t){this._deferred.resolve(t,e)},reset:function(){var e=this._callbacks;this._deferred=o.$.Deferred(),this._callbacks=[],i.each(e,function(e){this.add(e.cb,e.ctx)},this)}}),o.Controller=function(e){this.triggerMethod=o.triggerMethod,this.options=e||{},i.isFunction(this.initialize)&&this.initialize(this.options)},o.Controller.extend=o.extend,i.extend(o.Controller.prototype,t.Events,{close:function(){this.stopListening(),this.triggerMethod("close"),this.unbind()}}),o.Region=function(e){if(this.options=e||{},this.el=o.getOption(this,"el"),!this.el){var t=Error("An 'el' must be specified for a region.");throw t.name="NoElError",t}if(this.initialize){var i=Array.prototype.slice.apply(arguments);this.initialize.apply(this,i)}},i.extend(o.Region,{buildRegion:function(e,t){var n="string"==typeof e,r="string"==typeof e.selector,o=e.regionType===void 0,s="function"==typeof e;if(!s&&!n&&!r)throw Error("Region must be specified as a Region type, a selector string or an object with selector property");var h,a;n&&(h=e),e.selector&&(h=e.selector),s&&(a=e),!s&&o&&(a=t),e.regionType&&(a=e.regionType);var l=new a({el:h});return e.parentEl&&(l.getEl=function(t){var n=e.parentEl;return i.isFunction(n)&&(n=n()),n.find(t)}),l}}),i.extend(o.Region.prototype,t.Events,{show:function(e){this.ensureEl(),e!==this.currentView?(this.close(),e.render(),this.open(e)):e.render(),o.triggerMethod.call(e,"show"),o.triggerMethod.call(this,"show",e),this.currentView=e},ensureEl:function(){this.$el&&0!==this.$el.length||(this.$el=this.getEl(this.el))},getEl:function(e){return o.$(e)},open:function(e){this.$el.empty().append(e.el)},close:function(){var e=this.currentView;e&&!e.isClosed&&(e.close?e.close():e.remove&&e.remove(),o.triggerMethod.call(this,"close"),delete this.currentView)},attachView:function(e){this.currentView=e},reset:function(){this.close(),delete this.$el}}),o.Region.extend=o.extend,o.RegionManager=function(e){var t=e.Controller.extend({constructor:function(t){this._regions={},e.Controller.prototype.constructor.call(this,t)},addRegions:function(e,t){var n={};return i.each(e,function(e,r){"string"==typeof e&&(e={selector:e}),e.selector&&(e=i.defaults({},e,t));var o=this.addRegion(r,e);n[r]=o},this),n},addRegion:function(t,n){var r,o=i.isObject(n),s=i.isString(n),h=!!n.selector;return r=s||o&&h?e.Region.buildRegion(n,e.Region):n,this._store(t,r),this.triggerMethod("region:add",t,r),r},get:function(e){return this._regions[e]},removeRegion:function(e){var t=this._regions[e];this._remove(e,t)},removeRegions:function(){i.each(this._regions,function(e,t){this._remove(t,e)},this)},closeRegions:function(){i.each(this._regions,function(e){e.close()},this)},close:function(){this.removeRegions();var t=Array.prototype.slice.call(arguments);e.Controller.prototype.close.apply(this,t)},_store:function(e,t){this._regions[e]=t,this.length=i.size(this._regions)},_remove:function(e,t){t.close(),delete this._regions[e],this.triggerMethod("region:remove",e,t)}}),n=["forEach","each","map","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","toArray","first","initial","rest","last","without","isEmpty","pluck"];return i.each(n,function(e){t.prototype[e]=function(){var t=i.values(this._regions),n=[t].concat(i.toArray(arguments));return i[e].apply(i,n)}}),t}(o),o.TemplateCache=function(e){this.templateId=e},i.extend(o.TemplateCache,{templateCaches:{},get:function(e){var t=this.templateCaches[e];return t||(t=new o.TemplateCache(e),this.templateCaches[e]=t),t.load()},clear:function(){var e,t=n(arguments),i=t.length;if(i>0)for(e=0;i>e;e++)delete this.templateCaches[t[e]];else this.templateCaches={}}}),i.extend(o.TemplateCache.prototype,{load:function(){if(this.compiledTemplate)return this.compiledTemplate;var e=this.loadTemplate(this.templateId);return this.compiledTemplate=this.compileTemplate(e),this.compiledTemplate},loadTemplate:function(e){var t=o.$(e).html();return t&&0!==t.length||r("Could not find template: '"+e+"'","NoTemplateError"),t},compileTemplate:function(e){return i.template(e)}}),o.Renderer={render:function(e,t){var i="function"==typeof e?e:o.TemplateCache.get(e);return i(t)}},o.View=t.View.extend({constructor:function(){i.bindAll(this,"render");var e=Array.prototype.slice.apply(arguments);t.View.prototype.constructor.apply(this,e),o.MonitorDOMRefresh(this),this.listenTo(this,"show",this.onShowCalled,this)},triggerMethod:o.triggerMethod,getTemplate:function(){return o.getOption(this,"template")},mixinTemplateHelpers:function(e){e=e||{};var t=this.templateHelpers;return i.isFunction(t)&&(t=t.call(this)),i.extend(e,t)},configureTriggers:function(){if(this.triggers){var e={},t=i.result(this,"triggers");return i.each(t,function(t,i){e[i]=function(e){e&&e.preventDefault&&e.preventDefault(),e&&e.stopPropagation&&e.stopPropagation();var i={view:this,model:this.model,collection:this.collection};this.triggerMethod(t,i)}},this),e}},delegateEvents:function(e){this._delegateDOMEvents(e),o.bindEntityEvents(this,this.model,o.getOption(this,"modelEvents")),o.bindEntityEvents(this,this.collection,o.getOption(this,"collectionEvents"))},_delegateDOMEvents:function(e){e=e||this.events,i.isFunction(e)&&(e=e.call(this));var n={},r=this.configureTriggers();i.extend(n,e,r),t.View.prototype.delegateEvents.call(this,n)},undelegateEvents:function(){var e=Array.prototype.slice.call(arguments);t.View.prototype.undelegateEvents.apply(this,e),o.unbindEntityEvents(this,this.model,o.getOption(this,"modelEvents")),o.unbindEntityEvents(this,this.collection,o.getOption(this,"collectionEvents"))},onShowCalled:function(){},close:function(){if(!this.isClosed){var e=this.triggerMethod("before:close");e!==!1&&(this.unbindUIElements(),this.isClosed=!0,this.triggerMethod("close"),this.remove())}},bindUIElements:function(){if(this.ui){this._uiBindings||(this._uiBindings=this.ui);var e=i.result(this,"_uiBindings");this.ui={},i.each(i.keys(e),function(t){var i=e[t];this.ui[t]=this.$(i)},this)}},unbindUIElements:function(){this.ui&&(i.each(this.ui,function(e,t){delete this.ui[t]},this),this.ui=this._uiBindings,delete this._uiBindings)}}),o.ItemView=o.View.extend({constructor:function(){o.View.prototype.constructor.apply(this,n(arguments))},serializeData:function(){var e={};return this.model?e=this.model.toJSON():this.collection&&(e={items:this.collection.toJSON()}),e},render:function(){this.isClosed=!1,this.triggerMethod("before:render",this),this.triggerMethod("item:before:render",this);var e=this.serializeData();e=this.mixinTemplateHelpers(e);var t=this.getTemplate(),i=o.Renderer.render(t,e);return this.$el.html(i),this.bindUIElements(),this.triggerMethod("render",this),this.triggerMethod("item:rendered",this),this},close:function(){this.isClosed||(this.triggerMethod("item:before:close"),o.View.prototype.close.apply(this,n(arguments)),this.triggerMethod("item:closed"))}}),o.CollectionView=o.View.extend({itemViewEventPrefix:"itemview",constructor:function(){this._initChildViewStorage(),o.View.prototype.constructor.apply(this,n(arguments)),this._initialEvents()},_initialEvents:function(){this.collection&&(this.listenTo(this.collection,"add",this.addChildView,this),this.listenTo(this.collection,"remove",this.removeItemView,this),this.listenTo(this.collection,"reset",this.render,this))},addChildView:function(e){this.closeEmptyView();var t=this.getItemView(e),i=this.collection.indexOf(e);this.addItemView(e,t,i)},onShowCalled:function(){this.children.each(function(e){o.triggerMethod.call(e,"show")})},triggerBeforeRender:function(){this.triggerMethod("before:render",this),this.triggerMethod("collection:before:render",this)},triggerRendered:function(){this.triggerMethod("render",this),this.triggerMethod("collection:rendered",this)},render:function(){return this.isClosed=!1,this.triggerBeforeRender(),this._renderChildren(),this.triggerRendered(),this},_renderChildren:function(){this.closeEmptyView(),this.closeChildren(),this.collection&&this.collection.length>0?this.showCollection():this.showEmptyView()},showCollection:function(){var e;this.collection.each(function(t,i){e=this.getItemView(t),this.addItemView(t,e,i)},this)},showEmptyView:function(){var e=o.getOption(this,"emptyView");if(e&&!this._showingEmptyView){this._showingEmptyView=!0;var i=new t.Model;this.addItemView(i,e,0)}},closeEmptyView:function(){this._showingEmptyView&&(this.closeChildren(),delete this._showingEmptyView)},getItemView:function(){var e=o.getOption(this,"itemView");return e||r("An `itemView` must be specified","NoItemViewError"),e},addItemView:function(e,t,n){var r=o.getOption(this,"itemViewOptions");i.isFunction(r)&&(r=r.call(this,e,n));var s=this.buildItemView(e,t,r);this.addChildViewEventForwarding(s),this.triggerMethod("before:item:added",s),this.children.add(s),this.renderItemView(s,n),this._isShown&&o.triggerMethod.call(s,"show"),this.triggerMethod("after:item:added",s)},addChildViewEventForwarding:function(e){var t=o.getOption(this,"itemViewEventPrefix");this.listenTo(e,"all",function(){var i=n(arguments);i[0]=t+":"+i[0],i.splice(1,0,e),o.triggerMethod.apply(this,i)},this)},renderItemView:function(e,t){e.render(),this.appendHtml(this,e,t)},buildItemView:function(e,t,n){var r=i.extend({model:e},n);return new t(r)},removeItemView:function(e){var t=this.children.findByModel(e);this.removeChildView(t),this.checkEmpty()},removeChildView:function(e){e&&(this.stopListening(e),e.close?e.close():e.remove&&e.remove(),this.children.remove(e)),this.triggerMethod("item:removed",e)},checkEmpty:function(){this.collection&&0!==this.collection.length||this.showEmptyView()},appendHtml:function(e,t){e.$el.append(t.el)},_initChildViewStorage:function(){this.children=new t.ChildViewContainer},close:function(){this.isClosed||(this.triggerMethod("collection:before:close"),this.closeChildren(),this.triggerMethod("collection:closed"),o.View.prototype.close.apply(this,n(arguments)))},closeChildren:function(){this.children.each(function(e){this.removeChildView(e)},this),this.checkEmpty()}}),o.CompositeView=o.CollectionView.extend({constructor:function(){o.CollectionView.apply(this,n(arguments)),this.itemView=this.getItemView()},_initialEvents:function(){this.collection&&(this.listenTo(this.collection,"add",this.addChildView,this),this.listenTo(this.collection,"remove",this.removeItemView,this),this.listenTo(this.collection,"reset",this._renderChildren,this))},getItemView:function(){var e=o.getOption(this,"itemView")||this.constructor;return e||r("An `itemView` must be specified","NoItemViewError"),e},serializeData:function(){var e={};return this.model&&(e=this.model.toJSON()),e},render:function(){this.isRendered=!0,this.isClosed=!1,this.resetItemViewContainer(),this.triggerBeforeRender();var e=this.renderModel();return this.$el.html(e),this.bindUIElements(),this.triggerMethod("composite:model:rendered"),this._renderChildren(),this.triggerMethod("composite:rendered"),this.triggerRendered(),this},_renderChildren:function(){this.isRendered&&(o.CollectionView.prototype._renderChildren.call(this),this.triggerMethod("composite:collection:rendered"))},renderModel:function(){var e={};e=this.serializeData(),e=this.mixinTemplateHelpers(e);var t=this.getTemplate();return o.Renderer.render(t,e)},appendHtml:function(e,t){var i=this.getItemViewContainer(e);i.append(t.el)},getItemViewContainer:function(e){if("$itemViewContainer"in e)return e.$itemViewContainer;var t;if(e.itemViewContainer){var n=i.result(e,"itemViewContainer");t=e.$(n),0>=t.length&&r("The specified `itemViewContainer` was not found: "+e.itemViewContainer,"ItemViewContainerMissingError")}else t=e.$el;return e.$itemViewContainer=t,t},resetItemViewContainer:function(){this.$itemViewContainer&&delete this.$itemViewContainer}}),o.Layout=o.ItemView.extend({regionType:o.Region,constructor:function(e){e=e||{},this._firstRender=!0,this._initializeRegions(e),o.ItemView.call(this,e)},render:function(){this._firstRender?this._firstRender=!1:this.isClosed?this._initializeRegions():this._reInitializeRegions();var e=Array.prototype.slice.apply(arguments),t=o.ItemView.prototype.render.apply(this,e);return t},close:function(){if(!this.isClosed){this.regionManager.close();var e=Array.prototype.slice.apply(arguments);o.ItemView.prototype.close.apply(this,e)}},addRegion:function(e,t){var i={};return i[e]=t,this.addRegions(i)[e]},addRegions:function(e){return this.regions=i.extend(this.regions||{},e),this._buildRegions(e)},removeRegion:function(e){return this.regionManager.removeRegion(e)},_buildRegions:function(e){var t=this,i={parentEl:function(){return t.$el}};return this.regionManager.addRegions(e,i)},_initializeRegions:function(e){var t;this._initRegionManager(),t=i.isFunction(this.regions)?this.regions(e):this.regions||{},this.addRegions(t)},_reInitializeRegions:function(){this.regionManager.closeRegions(),this.regionManager.each(function(e){e.reset()})},_initRegionManager:function(){this.regionManager=new o.RegionManager,this.listenTo(this.regionManager,"region:add",function(e,t){this[e]=t,this.trigger("region:add",e,t)}),this.listenTo(this.regionManager,"region:remove",function(e,t){delete this[e],this.trigger("region:remove",e,t)})}}),o.AppRouter=t.Router.extend({constructor:function(e){if(t.Router.prototype.constructor.apply(this,n(arguments)),this.options=e,this.appRoutes){var i=o.getOption(this,"controller");this.processAppRoutes(i,this.appRoutes)}},processAppRoutes:function(e,t){i.each(t,function(t,n){var r=e[t];if(!r)throw Error("Method '"+t+"' was not found on the controller");this.route(n,t,i.bind(r,e))},this)}}),o.Application=function(e){this._initRegionManager(),this._initCallbacks=new o.Callbacks,this.vent=new t.Wreqr.EventAggregator,this.commands=new t.Wreqr.Commands,this.reqres=new t.Wreqr.RequestResponse,this.submodules={},i.extend(this,e),this.triggerMethod=o.triggerMethod},i.extend(o.Application.prototype,t.Events,{execute:function(){var e=Array.prototype.slice.apply(arguments);this.commands.execute.apply(this.commands,e)},request:function(){var e=Array.prototype.slice.apply(arguments);return this.reqres.request.apply(this.reqres,e)},addInitializer:function(e){this._initCallbacks.add(e)},start:function(e){this.triggerMethod("initialize:before",e),this._initCallbacks.run(e,this),this.triggerMethod("initialize:after",e),this.triggerMethod("start",e)},addRegions:function(e){return this._regionManager.addRegions(e)},removeRegion:function(e){this._regionManager.removeRegion(e)},module:function(){var e=n(arguments);return e.unshift(this),o.Module.create.apply(o.Module,e)},_initRegionManager:function(){this._regionManager=new o.RegionManager,this.listenTo(this._regionManager,"region:add",function(e,t){this[e]=t}),this.listenTo(this._regionManager,"region:remove",function(e){delete this[e]})}}),o.Application.extend=o.extend,o.Module=function(e,t){this.moduleName=e,this.submodules={},this._setupInitializersAndFinalizers(),this.app=t,this.startWithParent=!0,this.triggerMethod=o.triggerMethod},i.extend(o.Module.prototype,t.Events,{addInitializer:function(e){this._initializerCallbacks.add(e)},addFinalizer:function(e){this._finalizerCallbacks.add(e)},start:function(e){this._isInitialized||(i.each(this.submodules,function(t){t.startWithParent&&t.start(e)}),this.triggerMethod("before:start",e),this._initializerCallbacks.run(e,this),this._isInitialized=!0,this.triggerMethod("start",e))},stop:function(){this._isInitialized&&(this._isInitialized=!1,o.triggerMethod.call(this,"before:stop"),i.each(this.submodules,function(e){e.stop()}),this._finalizerCallbacks.run(void 0,this),this._initializerCallbacks.reset(),this._finalizerCallbacks.reset(),o.triggerMethod.call(this,"stop"))},addDefinition:function(e,t){this._runModuleDefinition(e,t)},_runModuleDefinition:function(e,n){if(e){var r=i.flatten([this,this.app,t,o,o.$,i,n]);e.apply(this,r)}},_setupInitializersAndFinalizers:function(){this._initializerCallbacks=new o.Callbacks,this._finalizerCallbacks=new o.Callbacks}}),i.extend(o.Module,{create:function(e,t,r){var o=e,s=n(arguments);s.splice(0,3),t=t.split(".");var h=t.length,a=[];return a[h-1]=r,i.each(t,function(t,i){var n=o;o=this._getModule(n,t,e),this._addModuleDefinition(n,o,a[i],s)},this),o},_getModule:function(e,t,i){var n=e[t];return n||(n=new o.Module(t,i),e[t]=n,e.submodules[t]=n),n},_addModuleDefinition:function(e,t,n,r){var o,s;i.isFunction(n)?(o=n,s=!0):i.isObject(n)?(o=n.define,s=n.startWithParent):s=!0,o&&t.addDefinition(o,r),t.startWithParent=t.startWithParent&&s,t.startWithParent&&!t.startWithParentIsConfigured&&(t.startWithParentIsConfigured=!0,e.addInitializer(function(e){t.startWithParent&&t.start(e)}))}}),o}(this,Backbone,_); //@ sourceMappingURL=backbone.marionette.map
qooxdoo/cdnjs
ajax/libs/backbone.marionette/1.0.0/backbone.marionette.min.js
JavaScript
mit
22,946
/* * /MathJax/config/MML_HTMLorMML.js * * Copyright (c) 2010-2013 The MathJax Consortium * * Part of the MathJax library. * See http://www.mathjax.org for details. * * Licensed under the Apache License, Version 2.0; * you may not use this file except in compliance with the License. * * http://www.apache.org/licenses/LICENSE-2.0 */ MathJax.Hub.Config({delayJaxRegistration: true}); MathJax.Ajax.Preloading( "[MathJax]/jax/input/MathML/config.js", "[MathJax]/jax/output/HTML-CSS/config.js", "[MathJax]/jax/output/NativeMML/config.js", "[MathJax]/config/MMLorHTML.js", "[MathJax]/extensions/mml2jax.js", "[MathJax]/extensions/MathEvents.js", "[MathJax]/extensions/MathZoom.js", "[MathJax]/extensions/MathMenu.js", "[MathJax]/jax/element/mml/jax.js", "[MathJax]/extensions/toMathML.js", "[MathJax]/jax/input/MathML/jax.js" ); MathJax.Hub.Config({"v1.0-compatible":false}); MathJax.InputJax.MathML=MathJax.InputJax({id:"MathML",version:"2.2",directory:MathJax.InputJax.directory+"/MathML",extensionDir:MathJax.InputJax.extensionDir+"/MathML",entityDir:MathJax.InputJax.directory+"/MathML/entities",config:{useMathMLspacing:false}});MathJax.InputJax.MathML.Register("math/mml");MathJax.InputJax.MathML.loadComplete("config.js"); MathJax.OutputJax["HTML-CSS"]=MathJax.OutputJax({id:"HTML-CSS",version:"2.2",directory:MathJax.OutputJax.directory+"/HTML-CSS",extensionDir:MathJax.OutputJax.extensionDir+"/HTML-CSS",autoloadDir:MathJax.OutputJax.directory+"/HTML-CSS/autoload",fontDir:MathJax.OutputJax.directory+"/HTML-CSS/fonts",webfontDir:MathJax.OutputJax.fontDir+"/HTML-CSS",config:{scale:100,minScaleAdjust:50,availableFonts:["STIX","TeX"],preferredFont:"TeX",webFont:"TeX",imageFont:"TeX",undefinedFamily:"STIXGeneral,'Arial Unicode MS',serif",mtextFontInherit:false,EqnChunk:(MathJax.Hub.Browser.isMobile?10:50),EqnChunkFactor:1.5,EqnChunkDelay:100,linebreaks:{automatic:false,width:"container"},styles:{".MathJax_Display":{"text-align":"center",margin:"1em 0em"},".MathJax .merror":{"background-color":"#FFFF88",color:"#CC0000",border:"1px solid #CC0000",padding:"1px 3px","font-style":"normal","font-size":"90%"},"#MathJax_Tooltip":{"background-color":"InfoBackground",color:"InfoText",border:"1px solid black","box-shadow":"2px 2px 5px #AAAAAA","-webkit-box-shadow":"2px 2px 5px #AAAAAA","-moz-box-shadow":"2px 2px 5px #AAAAAA","-khtml-box-shadow":"2px 2px 5px #AAAAAA",filter:"progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')",padding:"3px 4px","z-index":401}}}});if(MathJax.Hub.Browser.isMSIE&&document.documentMode>=9){delete MathJax.OutputJax["HTML-CSS"].config.styles["#MathJax_Tooltip"].filter}if(!MathJax.Hub.config.delayJaxRegistration){MathJax.OutputJax["HTML-CSS"].Register("jax/mml")}MathJax.Hub.Register.StartupHook("End Config",[function(b,c){var a=b.Insert({minBrowserVersion:{Firefox:3,Opera:9.52,MSIE:6,Chrome:0.3,Safari:2,Konqueror:4},inlineMathDelimiters:["$","$"],displayMathDelimiters:["$$","$$"],multilineDisplay:true,minBrowserTranslate:function(f){var e=b.getJaxFor(f),k=["[Math]"],j;var h=document.createElement("span",{className:"MathJax_Preview"});if(e.inputJax==="TeX"){if(e.root.Get("displaystyle")){j=a.displayMathDelimiters;k=[j[0]+e.originalText+j[1]];if(a.multilineDisplay){k=k[0].split(/\n/)}}else{j=a.inlineMathDelimiters;k=[j[0]+e.originalText.replace(/^\s+/,"").replace(/\s+$/,"")+j[1]]}}for(var g=0,d=k.length;g<d;g++){h.appendChild(document.createTextNode(k[g]));if(g<d-1){h.appendChild(document.createElement("br"))}}f.parentNode.insertBefore(h,f)}},(b.config["HTML-CSS"]||{}));if(b.Browser.version!=="0.0"&&!b.Browser.versionAtLeast(a.minBrowserVersion[b.Browser]||0)){c.Translate=a.minBrowserTranslate;b.Config({showProcessingMessages:false});MathJax.Message.Set(["MathJaxNotSupported","Your browser does not support MathJax"],null,4000);b.Startup.signal.Post("MathJax not supported")}},MathJax.Hub,MathJax.OutputJax["HTML-CSS"]]);MathJax.OutputJax["HTML-CSS"].loadComplete("config.js"); MathJax.OutputJax.NativeMML=MathJax.OutputJax({id:"NativeMML",version:"2.2",directory:MathJax.OutputJax.directory+"/NativeMML",extensionDir:MathJax.OutputJax.extensionDir+"/NativeMML",config:{scale:100,minScaleAdjust:50,styles:{"DIV.MathJax_MathML":{"text-align":"center",margin:".75em 0px"}}}});if(!MathJax.Hub.config.delayJaxRegistration){MathJax.OutputJax.NativeMML.Register("jax/mml")}MathJax.OutputJax.NativeMML.loadComplete("config.js"); (function(c,g){var f="2.2";var a=MathJax.Hub.CombineConfig("MMLorHTML",{prefer:{MSIE:"MML",Firefox:"HTML",Opera:"HTML",Chrome:"HTML",Safari:"HTML",other:"HTML"}});var e={Firefox:3,Opera:9.52,MSIE:6,Chrome:0.3,Safari:2,Konqueror:4};var b=(g.version==="0.0"||g.versionAtLeast(e[g]||0));var d=(g.isFirefox&&g.versionAtLeast("1.5"))||(g.isMSIE&&g.hasMathPlayer)||(g.isSafari&&g.versionAtLeast("5.0"))||(g.isOpera&&g.versionAtLeast("9.52"));c.Register.StartupHook("End Config",function(){var h=(a.prefer&&typeof(a.prefer)==="object"?a.prefer[MathJax.Hub.Browser]||a.prefer.other||"HTML":a.prefer);if(b||d){if(d&&(h==="MML"||!b)){if(MathJax.OutputJax.NativeMML){MathJax.OutputJax.NativeMML.Register("jax/mml")}else{c.config.jax.unshift("output/NativeMML")}c.Startup.signal.Post("NativeMML output selected")}else{if(MathJax.OutputJax["HTML-CSS"]){MathJax.OutputJax["HTML-CSS"].Register("jax/mml")}else{c.config.jax.unshift("output/HTML-CSS")}c.Startup.signal.Post("HTML-CSS output selected")}}else{c.PreProcess.disabled=true;c.prepareScripts.disabled=true;MathJax.Message.Set(["MathJaxNotSupported","Your browser does not support MathJax"],null,4000);c.Startup.signal.Post("MathJax not supported")}})})(MathJax.Hub,MathJax.Hub.Browser);MathJax.Ajax.loadComplete("[MathJax]/config/MMLorHTML.js"); MathJax.Extension.mml2jax={version:"2.2",config:{preview:"alttext"},MMLnamespace:"http://www.w3.org/1998/Math/MathML",PreProcess:function(e){if(!this.configured){this.config=MathJax.Hub.CombineConfig("mml2jax",this.config);if(this.config.Augment){MathJax.Hub.Insert(this,this.config.Augment)}this.InitBrowser();this.configured=true}if(typeof(e)==="string"){e=document.getElementById(e)}if(!e){e=document.body}this.ProcessMathArray(e.getElementsByTagName("math"));if(e.getElementsByTagNameNS){this.ProcessMathArray(e.getElementsByTagNameNS(this.MMLnamespace,"math"))}var d,b;if(typeof(document.namespaces)!=="undefined"){try{for(d=0,b=document.namespaces.length;d<b;d++){var f=document.namespaces[d];if(f.urn===this.MMLnamespace){this.ProcessMathArray(e.getElementsByTagName(f.name+":math"))}}}catch(g){}}else{var c=document.getElementsByTagName("html")[0];if(c){for(d=0,b=c.attributes.length;d<b;d++){var a=c.attributes[d];if(a.nodeName.substr(0,6)==="xmlns:"&&a.nodeValue===this.MMLnamespace){this.ProcessMathArray(e.getElementsByTagName(a.nodeName.substr(6)+":math"))}}}}},ProcessMathArray:function(b){var a;if(b.length){if(this.MathTagBug){for(a=b.length-1;a>=0;a--){if(b[a].nodeName==="MATH"){this.ProcessMathFlattened(b[a])}else{this.ProcessMath(b[a])}}}else{for(a=b.length-1;a>=0;a--){this.ProcessMath(b[a])}}}},ProcessMath:function(e){var d=e.parentNode;var a=document.createElement("script");a.type="math/mml";d.insertBefore(a,e);if(this.AttributeBug){var b=this.OuterHTML(e);if(this.CleanupHTML){b=b.replace(/<\?import .*?>/i,"").replace(/<\?xml:namespace .*?\/>/i,"");b=b.replace(/&nbsp;/g,"&#xA0;")}MathJax.HTML.setScript(a,b);d.removeChild(e)}else{var c=MathJax.HTML.Element("span");c.appendChild(e);MathJax.HTML.setScript(a,c.innerHTML)}if(this.config.preview!=="none"){this.createPreview(e,a)}},ProcessMathFlattened:function(f){var d=f.parentNode;var b=document.createElement("script");b.type="math/mml";d.insertBefore(b,f);var c="",e,a=f;while(f&&f.nodeName!=="/MATH"){e=f;f=f.nextSibling;c+=this.NodeHTML(e);e.parentNode.removeChild(e)}if(f&&f.nodeName==="/MATH"){f.parentNode.removeChild(f)}b.text=c+"</math>";if(this.config.preview!=="none"){this.createPreview(a,b)}},NodeHTML:function(e){var c,b,a;if(e.nodeName==="#text"){c=this.quoteHTML(e.nodeValue)}else{if(e.nodeName==="#comment"){c="<!--"+e.nodeValue+"-->"}else{c="<"+e.nodeName.toLowerCase();for(b=0,a=e.attributes.length;b<a;b++){var d=e.attributes[b];if(d.specified){c+=" "+d.nodeName.toLowerCase().replace(/xmlns:xmlns/,"xmlns")+"=";var f=d.nodeValue;if(f==null&&d.nodeName==="style"&&e.style){f=e.style.cssText}c+='"'+this.quoteHTML(f)+'"'}}c+=">";if(e.outerHTML!=null&&e.outerHTML.match(/(.<\/[A-Z]+>|\/>)$/)){for(b=0,a=e.childNodes.length;b<a;b++){c+=this.OuterHTML(e.childNodes[b])}c+="</"+e.nodeName.toLowerCase()+">"}}}return c},OuterHTML:function(d){if(d.nodeName.charAt(0)==="#"){return this.NodeHTML(d)}if(!this.AttributeBug){return d.outerHTML}var c=this.NodeHTML(d);for(var b=0,a=d.childNodes.length;b<a;b++){c+=this.OuterHTML(d.childNodes[b])}c+="</"+d.nodeName.toLowerCase()+">";return c},quoteHTML:function(a){if(a==null){a=""}return a.replace(/&/g,"&#x26;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\"/g,"&quot;")},createPreview:function(b,a){var c=this.config.preview;if(c==="none"){return}if(c==="alttext"){var d=b.getAttribute("alttext");if(d!=null){c=[this.filterPreview(d)]}else{c=null}}if(c){c=MathJax.HTML.Element("span",{className:MathJax.Hub.config.preRemoveClass},c);a.parentNode.insertBefore(c,a)}},filterPreview:function(a){return a},InitBrowser:function(){var b=MathJax.HTML.Element("span",{id:"<",className:"mathjax",innerHTML:"<math><mi>x</mi><mspace /></math>"});var a=b.outerHTML||"";this.AttributeBug=a!==""&&!(a.match(/id="&lt;"/)&&a.match(/class="mathjax"/)&&a.match(/<\/math>/));this.MathTagBug=b.childNodes.length>1;this.CleanupHTML=MathJax.Hub.Browser.isMSIE}};MathJax.Hub.Register.PreProcessor(["PreProcess",MathJax.Extension.mml2jax]);MathJax.Ajax.loadComplete("[MathJax]/extensions/mml2jax.js"); (function(d,h,l,g,m,b,j){var q="2.2";var i=MathJax.Extension;var c=i.MathEvents={version:q};var k=d.config.menuSettings;var p={hover:500,frame:{x:3.5,y:5,bwidth:1,bcolor:"#A6D",hwidth:"15px",hcolor:"#83A"},button:{x:-4,y:-3,wx:-2,src:l.fileURL(b.imageDir+"/MenuArrow-15.png")},fadeinInc:0.2,fadeoutInc:0.05,fadeDelay:50,fadeoutStart:400,fadeoutDelay:15*1000,styles:{".MathJax_Hover_Frame":{"border-radius":".25em","-webkit-border-radius":".25em","-moz-border-radius":".25em","-khtml-border-radius":".25em","box-shadow":"0px 0px 15px #83A","-webkit-box-shadow":"0px 0px 15px #83A","-moz-box-shadow":"0px 0px 15px #83A","-khtml-box-shadow":"0px 0px 15px #83A",border:"1px solid #A6D ! important",display:"inline-block",position:"absolute"},".MathJax_Hover_Arrow":{position:"absolute",width:"15px",height:"11px",cursor:"pointer"}}};var n=c.Event={LEFTBUTTON:0,RIGHTBUTTON:2,MENUKEY:"altKey",Mousedown:function(r){return n.Handler(r,"Mousedown",this)},Mouseup:function(r){return n.Handler(r,"Mouseup",this)},Mousemove:function(r){return n.Handler(r,"Mousemove",this)},Mouseover:function(r){return n.Handler(r,"Mouseover",this)},Mouseout:function(r){return n.Handler(r,"Mouseout",this)},Click:function(r){return n.Handler(r,"Click",this)},DblClick:function(r){return n.Handler(r,"DblClick",this)},Menu:function(r){return n.Handler(r,"ContextMenu",this)},Handler:function(u,s,t){if(l.loadingMathMenu){return n.False(u)}var r=b[t.jaxID];if(!u){u=window.event}u.isContextMenu=(s==="ContextMenu");if(r[s]){return r[s](u,t)}if(i.MathZoom){return i.MathZoom.HandleEvent(u,s,t)}},False:function(r){if(!r){r=window.event}if(r){if(r.preventDefault){r.preventDefault()}if(r.stopPropagation){r.stopPropagation()}r.cancelBubble=true;r.returnValue=false}return false},ContextMenu:function(s,A,v){var x=b[A.jaxID],u=x.getJaxFromMath(A);var B=(x.config.showMathMenu!=null?x:d).config.showMathMenu;if(!B||(k.context!=="MathJax"&&!v)){return}if(c.msieEventBug){s=window.event||s}n.ClearSelection();f.ClearHoverTimer();if(u.hover){if(u.hover.remove){clearTimeout(u.hover.remove);delete u.hover.remove}u.hover.nofade=true}var t=MathJax.Menu;var C,z;if(t){if(t.loadingDomain){return n.False(s)}C=m.loadDomain("MathMenu");if(!C){t.jax=u;var r=t.menu.Find("Show Math As").menu;r.items[0].name=u.sourceMenuTitle;r.items[0].format=(u.sourceMenuFormat||"MathML");r.items[1].name=j[u.inputJax].sourceMenuTitle;var w=t.menu.Find("Math Settings","MathPlayer");w.hidden=!(u.outputJax==="NativeMML"&&d.Browser.hasMathPlayer);return t.menu.Post(s)}t.loadingDomain=true;z=function(){delete t.loadingDomain}}else{if(l.loadingMathMenu){return n.False(s)}l.loadingMathMenu=true;C=l.Require("[MathJax]/extensions/MathMenu.js");z=function(){delete l.loadingMathMenu;if(!MathJax.Menu){MathJax.Menu={}}}}var y={pageX:s.pageX,pageY:s.pageY,clientX:s.clientX,clientY:s.clientY};g.Queue(C,z,["ContextMenu",n,y,A,v]);return n.False(s)},AltContextMenu:function(t,s){var u=b[s.jaxID];var r=(u.config.showMathMenu!=null?u:d).config.showMathMenu;if(r){r=(u.config.showMathMenuMSIE!=null?u:d).config.showMathMenuMSIE;if(k.context==="MathJax"&&!k.mpContext&&r){if(!c.noContextMenuBug||t.button!==n.RIGHTBUTTON){return}}else{if(!t[n.MENUKEY]||t.button!==n.LEFTBUTTON){return}}return u.ContextMenu(t,s,true)}},ClearSelection:function(){if(c.safariContextMenuBug){setTimeout("window.getSelection().empty()",0)}if(document.selection){setTimeout("document.selection.empty()",0)}},getBBox:function(t){t.appendChild(c.topImg);var s=c.topImg.offsetTop,u=t.offsetHeight-s,r=t.offsetWidth;t.removeChild(c.topImg);return{w:r,h:s,d:u}}};var f=c.Hover={Mouseover:function(t,s){if(k.discoverable||k.zoom==="Hover"){var v=t.fromElement||t.relatedTarget,u=t.toElement||t.target;if(v&&u&&(v.isMathJax!=u.isMathJax||d.getJaxFor(v)!==d.getJaxFor(u))){var r=this.getJaxFromMath(s);if(r.hover){f.ReHover(r)}else{f.HoverTimer(r,s)}return n.False(t)}}},Mouseout:function(t,s){if(k.discoverable||k.zoom==="Hover"){var v=t.fromElement||t.relatedTarget,u=t.toElement||t.target;if(v&&u&&(v.isMathJax!=u.isMathJax||d.getJaxFor(v)!==d.getJaxFor(u))){var r=this.getJaxFromMath(s);if(r.hover){f.UnHover(r)}else{f.ClearHoverTimer()}return n.False(t)}}},Mousemove:function(t,s){if(k.discoverable||k.zoom==="Hover"){var r=this.getJaxFromMath(s);if(r.hover){return}if(f.lastX==t.clientX&&f.lastY==t.clientY){return}f.lastX=t.clientX;f.lastY=t.clientY;f.HoverTimer(r,s);return n.False(t)}},HoverTimer:function(r,s){this.ClearHoverTimer();this.hoverTimer=setTimeout(g(["Hover",this,r,s]),p.hover)},ClearHoverTimer:function(){if(this.hoverTimer){clearTimeout(this.hoverTimer);delete this.hoverTimer}},Hover:function(r,v){if(i.MathZoom&&i.MathZoom.Hover({},v)){return}var u=b[r.outputJax],w=u.getHoverSpan(r,v),z=u.getHoverBBox(r,w,v),x=(u.config.showMathMenu!=null?u:d).config.showMathMenu;var B=p.frame.x,A=p.frame.y,y=p.frame.bwidth;if(c.msieBorderWidthBug){y=0}r.hover={opacity:0,id:r.inputID+"-Hover"};var s=h.Element("span",{id:r.hover.id,isMathJax:true,style:{display:"inline-block",width:0,height:0,position:"relative"}},[["span",{className:"MathJax_Hover_Frame",isMathJax:true,style:{display:"inline-block",position:"absolute",top:this.Px(-z.h-A-y-(z.y||0)),left:this.Px(-B-y+(z.x||0)),width:this.Px(z.w+2*B),height:this.Px(z.h+z.d+2*A),opacity:0,filter:"alpha(opacity=0)"}}]]);var t=h.Element("span",{isMathJax:true,id:r.hover.id+"Menu",style:{display:"inline-block","z-index":1,width:0,height:0,position:"relative"}},[["img",{className:"MathJax_Hover_Arrow",isMathJax:true,math:v,src:p.button.src,onclick:this.HoverMenu,jax:u.id,style:{left:this.Px(z.w+B+y+(z.x||0)+p.button.x),top:this.Px(-z.h-A-y-(z.y||0)-p.button.y),opacity:0,filter:"alpha(opacity=0)"}}]]);if(z.width){s.style.width=t.style.width=z.width;s.style.marginRight=t.style.marginRight="-"+z.width;s.firstChild.style.width=z.width;t.firstChild.style.left="";t.firstChild.style.right=this.Px(p.button.wx)}w.parentNode.insertBefore(s,w);if(x){w.parentNode.insertBefore(t,w)}if(w.style){w.style.position="relative"}this.ReHover(r)},ReHover:function(r){if(r.hover.remove){clearTimeout(r.hover.remove)}r.hover.remove=setTimeout(g(["UnHover",this,r]),p.fadeoutDelay);this.HoverFadeTimer(r,p.fadeinInc)},UnHover:function(r){if(!r.hover.nofade){this.HoverFadeTimer(r,-p.fadeoutInc,p.fadeoutStart)}},HoverFade:function(r){delete r.hover.timer;r.hover.opacity=Math.max(0,Math.min(1,r.hover.opacity+r.hover.inc));r.hover.opacity=Math.floor(1000*r.hover.opacity)/1000;var t=document.getElementById(r.hover.id),s=document.getElementById(r.hover.id+"Menu");t.firstChild.style.opacity=r.hover.opacity;t.firstChild.style.filter="alpha(opacity="+Math.floor(100*r.hover.opacity)+")";if(s){s.firstChild.style.opacity=r.hover.opacity;s.firstChild.style.filter=t.style.filter}if(r.hover.opacity===1){return}if(r.hover.opacity>0){this.HoverFadeTimer(r,r.hover.inc);return}t.parentNode.removeChild(t);if(s){s.parentNode.removeChild(s)}if(r.hover.remove){clearTimeout(r.hover.remove)}delete r.hover},HoverFadeTimer:function(r,t,s){r.hover.inc=t;if(!r.hover.timer){r.hover.timer=setTimeout(g(["HoverFade",this,r]),(s||p.fadeDelay))}},HoverMenu:function(r){if(!r){r=window.event}return b[this.jax].ContextMenu(r,this.math,true)},ClearHover:function(r){if(r.hover.remove){clearTimeout(r.hover.remove)}if(r.hover.timer){clearTimeout(r.hover.timer)}f.ClearHoverTimer();delete r.hover},Px:function(r){if(Math.abs(r)<0.006){return"0px"}return r.toFixed(2).replace(/\.?0+$/,"")+"px"},getImages:function(){var r=new Image();r.src=p.button.src}};var a=c.Touch={last:0,delay:500,start:function(s){var r=new Date().getTime();var t=(r-a.last<a.delay&&a.up);a.last=r;a.up=false;if(t){a.timeout=setTimeout(a.menu,a.delay,s,this);s.preventDefault()}},end:function(s){var r=new Date().getTime();a.up=(r-a.last<a.delay);if(a.timeout){clearTimeout(a.timeout);delete a.timeout;a.last=0;a.up=false;s.preventDefault();return n.Handler((s.touches[0]||s.touch),"DblClick",this)}},menu:function(s,r){delete a.timeout;a.last=0;a.up=false;return n.Handler((s.touches[0]||s.touch),"ContextMenu",r)}};if(d.Browser.isMobile){var o=p.styles[".MathJax_Hover_Arrow"];o.width="25px";o.height="18px";p.button.x=-6}d.Browser.Select({MSIE:function(r){var t=(document.documentMode||0);var s=r.versionAtLeast("8.0");c.msieBorderWidthBug=(document.compatMode==="BackCompat");c.msieEventBug=r.isIE9;c.msieAlignBug=(!s||t<8);if(t<9){n.LEFTBUTTON=1}},Safari:function(r){c.safariContextMenuBug=true},Opera:function(r){c.operaPositionBug=true},Konqueror:function(r){c.noContextMenuBug=true}});c.topImg=(c.msieAlignBug?h.Element("img",{style:{width:0,height:0,position:"relative"},src:"about:blank"}):h.Element("span",{style:{width:0,height:0,display:"inline-block"}}));if(c.operaPositionBug){c.topImg.style.border="1px solid"}c.config=p=d.CombineConfig("MathEvents",p);var e=function(){var r=p.styles[".MathJax_Hover_Frame"];r.border=p.frame.bwidth+"px solid "+p.frame.bcolor+" ! important";r["box-shadow"]=r["-webkit-box-shadow"]=r["-moz-box-shadow"]=r["-khtml-box-shadow"]="0px 0px "+p.frame.hwidth+" "+p.frame.hcolor};g.Queue(d.Register.StartupHook("End Config",{}),[e],["getImages",f],["Styles",l,p.styles],["Post",d.Startup.signal,"MathEvents Ready"],["loadComplete",l,"[MathJax]/extensions/MathEvents.js"])})(MathJax.Hub,MathJax.HTML,MathJax.Ajax,MathJax.Callback,MathJax.Localization,MathJax.OutputJax,MathJax.InputJax); (function(a,d,f,c,j){var k="2.2";var i=a.CombineConfig("MathZoom",{styles:{"#MathJax_Zoom":{position:"absolute","background-color":"#F0F0F0",overflow:"auto",display:"block","z-index":301,padding:".5em",border:"1px solid black",margin:0,"font-weight":"normal","font-style":"normal","text-align":"left","text-indent":0,"text-transform":"none","line-height":"normal","letter-spacing":"normal","word-spacing":"normal","word-wrap":"normal","white-space":"nowrap","float":"none","box-shadow":"5px 5px 15px #AAAAAA","-webkit-box-shadow":"5px 5px 15px #AAAAAA","-moz-box-shadow":"5px 5px 15px #AAAAAA","-khtml-box-shadow":"5px 5px 15px #AAAAAA",filter:"progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')"},"#MathJax_ZoomOverlay":{position:"absolute",left:0,top:0,"z-index":300,display:"inline-block",width:"100%",height:"100%",border:0,padding:0,margin:0,"background-color":"white",opacity:0,filter:"alpha(opacity=0)"},"#MathJax_ZoomFrame":{position:"relative",display:"inline-block",height:0,width:0},"#MathJax_ZoomEventTrap":{position:"absolute",left:0,top:0,"z-index":302,display:"inline-block",border:0,padding:0,margin:0,"background-color":"white",opacity:0,filter:"alpha(opacity=0)"}}});var e,b,g;MathJax.Hub.Register.StartupHook("MathEvents Ready",function(){g=MathJax.Extension.MathEvents.Event;e=MathJax.Extension.MathEvents.Event.False;b=MathJax.Extension.MathEvents.Hover});var h=MathJax.Extension.MathZoom={version:k,settings:a.config.menuSettings,scrollSize:18,HandleEvent:function(n,l,m){if(h.settings.CTRL&&!n.ctrlKey){return true}if(h.settings.ALT&&!n.altKey){return true}if(h.settings.CMD&&!n.metaKey){return true}if(h.settings.Shift&&!n.shiftKey){return true}if(!h[l]){return true}return h[l](n,m)},Click:function(m,l){if(this.settings.zoom==="Click"){return this.Zoom(m,l)}},DblClick:function(m,l){if(this.settings.zoom==="Double-Click"){return this.Zoom(m,l)}},Hover:function(m,l){if(this.settings.zoom==="Hover"){this.Zoom(m,l);return true}return false},Zoom:function(n,s){this.Remove();b.ClearHoverTimer();g.ClearSelection();var q=MathJax.OutputJax[s.jaxID];var o=q.getJaxFromMath(s);if(o.hover){b.UnHover(o)}var l=Math.floor(0.85*document.body.clientWidth),r=Math.floor(0.85*Math.max(document.body.clientHeight,document.documentElement.clientHeight));var m=d.Element("span",{id:"MathJax_ZoomFrame"},[["span",{id:"MathJax_ZoomOverlay",onmousedown:this.Remove}],["span",{id:"MathJax_Zoom",onclick:this.Remove,style:{visibility:"hidden",fontSize:this.settings.zscale,"max-width":l+"px","max-height":r+"px"}},[["span",{style:{display:"inline-block","white-space":"nowrap"}}]]]]);var x=m.lastChild,u=x.firstChild,p=m.firstChild;s.parentNode.insertBefore(m,s);s.parentNode.insertBefore(s,m);if(u.addEventListener){u.addEventListener("mousedown",this.Remove,true)}if(this.msieTrapEventBug){var w=d.Element("span",{id:"MathJax_ZoomEventTrap",onmousedown:this.Remove});m.insertBefore(w,x)}if(this.msieZIndexBug){var t=d.addElement(document.body,"img",{src:"about:blank",id:"MathJax_ZoomTracker",width:0,height:0,style:{width:0,height:0,position:"relative"}});m.style.position="relative";m.style.zIndex=i.styles["#MathJax_ZoomOverlay"]["z-index"];m=t}var v=q.Zoom(o,u,s,l,r);if(this.msiePositionBug){if(this.msieSizeBug){x.style.height=v.zH+"px";x.style.width=v.zW+"px"}if(x.offsetHeight>r){x.style.height=r+"px";x.style.width=(v.zW+this.scrollSize)+"px"}if(x.offsetWidth>l){x.style.width=l+"px";x.style.height=(v.zH+this.scrollSize)+"px"}}if(this.operaPositionBug){x.style.width=Math.min(l,v.zW)+"px"}if(x.offsetWidth&&x.offsetWidth<l&&x.offsetHeight<r){x.style.overflow="visible"}this.Position(x,v);if(this.msieTrapEventBug){w.style.height=x.clientHeight+"px";w.style.width=x.clientWidth+"px";w.style.left=(parseFloat(x.style.left)+x.clientLeft)+"px";w.style.top=(parseFloat(x.style.top)+x.clientTop)+"px"}x.style.visibility="";if(this.settings.zoom==="Hover"){p.onmouseover=this.Remove}if(window.addEventListener){addEventListener("resize",this.Resize,false)}else{if(window.attachEvent){attachEvent("onresize",this.Resize)}else{this.onresize=window.onresize;window.onresize=this.Resize}}a.signal.Post(["math zoomed",o]);return e(n)},Position:function(p,r){var q=this.Resize(),m=q.x,s=q.y,l=r.mW;var o=-l-Math.floor((p.offsetWidth-l)/2),n=r.Y;p.style.left=Math.max(o,10-m)+"px";p.style.top=Math.max(n,10-s)+"px";if(!h.msiePositionBug){h.SetWH()}},Resize:function(m){if(h.onresize){h.onresize(m)}var r=document.getElementById("MathJax_ZoomFrame"),l=document.getElementById("MathJax_ZoomOverlay");var o=h.getXY(r);var n=r.parentNode,q=h.getOverflow(n);while(n.parentNode&&n!==document.body&&q==="visible"){n=n.parentNode;q=h.getOverflow(n)}if(q!=="visible"){l.scroll_parent=n;var p=h.getXY(n);o.x-=p.x;o.y-=p.y;p=h.getBorder(n);o.x-=p.x;o.y-=p.y}l.style.left=(-o.x)+"px";l.style.top=(-o.y)+"px";if(h.msiePositionBug){setTimeout(h.SetWH,0)}else{h.SetWH()}return o},SetWH:function(){var l=document.getElementById("MathJax_ZoomOverlay");l.style.width=l.style.height="1px";var m=l.scroll_parent||document.documentElement||document.body;l.style.width=m.scrollWidth+"px";l.style.height=Math.max(m.clientHeight,m.scrollHeight)+"px"},getOverflow:(window.getComputedStyle?function(l){return getComputedStyle(l).overflow}:function(l){return(l.currentStyle||{overflow:"visible"}).overflow}),getBorder:function(o){var m={thin:1,medium:2,thick:3};var n=(window.getComputedStyle?getComputedStyle(o):(o.currentStyle||{borderLeftWidth:0,borderTopWidth:0}));var l=n.borderLeftWidth,p=n.borderTopWidth;if(m[l]){l=m[l]}else{l=parseInt(l)}if(m[p]){p=m[p]}else{p=parseInt(p)}return{x:l,y:p}},getXY:function(o){var l=0,n=0,m;m=o;while(m.offsetParent){l+=m.offsetLeft;m=m.offsetParent}if(h.operaPositionBug){o.style.border="1px solid"}m=o;while(m.offsetParent){n+=m.offsetTop;m=m.offsetParent}if(h.operaPositionBug){o.style.border=""}return{x:l,y:n}},Remove:function(n){var p=document.getElementById("MathJax_ZoomFrame");if(p){var o=MathJax.OutputJax[p.previousSibling.jaxID];var l=o.getJaxFromMath(p.previousSibling);a.signal.Post(["math unzoomed",l]);p.parentNode.removeChild(p);p=document.getElementById("MathJax_ZoomTracker");if(p){p.parentNode.removeChild(p)}if(h.operaRefreshBug){var m=d.addElement(document.body,"div",{style:{position:"fixed",left:0,top:0,width:"100%",height:"100%",backgroundColor:"white",opacity:0},id:"MathJax_OperaDiv"});document.body.removeChild(m)}if(window.removeEventListener){removeEventListener("resize",h.Resize,false)}else{if(window.detachEvent){detachEvent("onresize",h.Resize)}else{window.onresize=h.onresize;delete h.onresize}}}return e(n)}};a.Browser.Select({MSIE:function(l){var n=(document.documentMode||0);var m=(n>=9);h.msiePositionBug=!m;h.msieSizeBug=l.versionAtLeast("7.0")&&(!document.documentMode||n===7||n===8);h.msieZIndexBug=(n<=7);h.msieInlineBlockAlignBug=(n<=7);h.msieTrapEventBug=!window.addEventListener;if(document.compatMode==="BackCompat"){h.scrollSize=52}if(m){delete i.styles["#MathJax_Zoom"].filter}},Opera:function(l){h.operaPositionBug=true;h.operaRefreshBug=true}});h.topImg=(h.msieInlineBlockAlignBug?d.Element("img",{style:{width:0,height:0,position:"relative"},src:"about:blank"}):d.Element("span",{style:{width:0,height:0,display:"inline-block"}}));if(h.operaPositionBug||h.msieTopBug){h.topImg.style.border="1px solid"}MathJax.Callback.Queue(["StartupHook",MathJax.Hub.Register,"Begin Styles",{}],["Styles",f,i.styles],["Post",a.Startup.signal,"MathZoom Ready"],["loadComplete",f,"[MathJax]/extensions/MathZoom.js"])})(MathJax.Hub,MathJax.HTML,MathJax.Ajax,MathJax.OutputJax["HTML-CSS"],MathJax.OutputJax.NativeMML); (function(c,g,k,f,b){var q="2.2";var j=MathJax.Callback.Signal("menu");MathJax.Extension.MathMenu={version:q,signal:j};var o=function(r){return MathJax.Localization._.apply(MathJax.Localization,[["MathMenu",r]].concat([].slice.call(arguments,1)))};var n=c.Browser.isPC,l=c.Browser.isMSIE,e=((document.documentMode||0)>8);var i=(n?null:"5px");var p=c.CombineConfig("MathMenu",{delay:150,closeImg:k.fileURL(b.imageDir+"/CloseX-31.png"),showRenderer:true,showMathPlayer:true,showFontMenu:false,showContext:false,showDiscoverable:false,showLocale:true,showLocaleURL:false,windowSettings:{status:"no",toolbar:"no",locationbar:"no",menubar:"no",directories:"no",personalbar:"no",resizable:"yes",scrollbars:"yes",width:400,height:300,left:Math.round((screen.width-400)/2),top:Math.round((screen.height-300)/3)},styles:{"#MathJax_About":{position:"fixed",left:"50%",width:"auto","text-align":"center",border:"3px outset",padding:"1em 2em","background-color":"#DDDDDD",color:"black",cursor:"default","font-family":"message-box","font-size":"120%","font-style":"normal","text-indent":0,"text-transform":"none","line-height":"normal","letter-spacing":"normal","word-spacing":"normal","word-wrap":"normal","white-space":"nowrap","float":"none","z-index":201,"border-radius":"15px","-webkit-border-radius":"15px","-moz-border-radius":"15px","-khtml-border-radius":"15px","box-shadow":"0px 10px 20px #808080","-webkit-box-shadow":"0px 10px 20px #808080","-moz-box-shadow":"0px 10px 20px #808080","-khtml-box-shadow":"0px 10px 20px #808080",filter:"progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')"},".MathJax_Menu":{position:"absolute","background-color":"white",color:"black",width:"auto",padding:(n?"2px":"5px 0px"),border:"1px solid #CCCCCC",margin:0,cursor:"default",font:"menu","text-align":"left","text-indent":0,"text-transform":"none","line-height":"normal","letter-spacing":"normal","word-spacing":"normal","word-wrap":"normal","white-space":"nowrap","float":"none","z-index":201,"border-radius":i,"-webkit-border-radius":i,"-moz-border-radius":i,"-khtml-border-radius":i,"box-shadow":"0px 10px 20px #808080","-webkit-box-shadow":"0px 10px 20px #808080","-moz-box-shadow":"0px 10px 20px #808080","-khtml-box-shadow":"0px 10px 20px #808080",filter:"progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')"},".MathJax_MenuItem":{padding:(n?"2px 2em":"1px 2em"),background:"transparent"},".MathJax_MenuArrow":{position:"absolute",right:".5em",color:"#666666","font-family":(l?"'Arial unicode MS'":null)},".MathJax_MenuActive .MathJax_MenuArrow":{color:"white"},".MathJax_MenuCheck":{position:"absolute",left:".7em","font-family":(l?"'Arial unicode MS'":null)},".MathJax_MenuRadioCheck":{position:"absolute",left:(n?"1em":".7em")},".MathJax_MenuLabel":{padding:(n?"2px 2em 4px 1.33em":"1px 2em 3px 1.33em"),"font-style":"italic"},".MathJax_MenuRule":{"border-top":(n?"1px solid #CCCCCC":"1px solid #DDDDDD"),margin:(n?"4px 1px 0px":"4px 3px")},".MathJax_MenuDisabled":{color:"GrayText"},".MathJax_MenuActive":{"background-color":(n?"Highlight":"#606872"),color:(n?"HighlightText":"white")},".MathJax_Menu_Close":{position:"absolute",width:"31px",height:"31px",top:"-15px",left:"-15px"}}});var h,d;c.Register.StartupHook("MathEvents Ready",function(){h=MathJax.Extension.MathEvents.Event.False;d=MathJax.Extension.MathEvents.Hover});var a=MathJax.Menu=MathJax.Object.Subclass({version:q,items:[],posted:false,title:null,margin:5,Init:function(r){this.items=[].slice.call(arguments,0)},With:function(r){if(r){c.Insert(this,r)}return this},Post:function(s,B){if(!s){s=window.event}var r=document.getElementById("MathJax_MenuFrame");if(!r){r=a.Background(this);delete m.lastItem;delete m.lastMenu;delete a.skipUp;j.Post(["post",a.jax])}var t=g.addElement(r,"div",{onmouseup:a.Mouseup,ondblclick:h,ondragstart:h,onselectstart:h,oncontextmenu:h,menuItem:this,className:"MathJax_Menu"});MathJax.Localization.setCSS(t);for(var v=0,u=this.items.length;v<u;v++){this.items[v].Create(t)}if(a.isMobile){g.addElement(t,"span",{className:"MathJax_Menu_Close",menu:B,ontouchstart:a.Close,ontouchend:h,onmousedown:a.Close,onmouseup:h},[["img",{src:p.closeImg,style:{width:"100%",height:"100%"}}]])}this.posted=true;t.style.width=(t.offsetWidth+2)+"px";var A=s.pageX,z=s.pageY;if(!A&&!z){A=s.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;z=s.clientY+document.body.scrollTop+document.documentElement.scrollTop}if(!B){if(A+t.offsetWidth>document.body.offsetWidth-this.margin){A=document.body.offsetWidth-t.offsetWidth-this.margin}if(a.isMobile){A=Math.max(5,A-Math.floor(t.offsetWidth/2));z-=20}a.skipUp=s.isContextMenu}else{var w="left",C=B.offsetWidth;A=(a.isMobile?30:C-2);z=0;while(B&&B!==r){A+=B.offsetLeft;z+=B.offsetTop;B=B.parentNode}if(A+t.offsetWidth>document.body.offsetWidth-this.margin&&!a.isMobile){w="right";A=Math.max(this.margin,A-C-t.offsetWidth+6)}if(!n){t.style["borderRadiusTop"+w]=0;t.style["WebkitBorderRadiusTop"+w]=0;t.style["MozBorderRadiusTop"+w]=0;t.style["KhtmlBorderRadiusTop"+w]=0}}t.style.left=A+"px";t.style.top=z+"px";if(document.selection&&document.selection.empty){document.selection.empty()}return h(s)},Remove:function(r,s){j.Post(["unpost",a.jax]);var t=document.getElementById("MathJax_MenuFrame");if(t){t.parentNode.removeChild(t);if(this.msieFixedPositionBug){detachEvent("onresize",a.Resize)}}if(a.jax.hover){delete a.jax.hover.nofade;d.UnHover(a.jax)}return h(r)},Find:function(r){return this.FindN(1,r,[].slice.call(arguments,1))},FindId:function(r){return this.FindN(0,r,[].slice.call(arguments,1))},FindN:function(v,s,u){for(var t=0,r=this.items.length;t<r;t++){if(this.items[t].name[v]===s){if(u.length){if(!this.items[t].menu){return null}return this.items[t].menu.FindN(v,u[0],u.slice(1))}return this.items[t]}}return null},IndexOf:function(r){return this.IndexOfN(1,r)},IndexOfId:function(r){return this.IndexOfN(0,r)},IndexOfN:function(u,s){for(var t=0,r=this.items.length;t<r;t++){if(this.items[t].name[u]===s){return t}}return null}},{config:p,div:null,Close:function(r){return a.Event(r,this.menu||this.parentNode,(this.menu?"Touchend":"Remove"))},Remove:function(r){return a.Event(r,this,"Remove")},Mouseover:function(r){return a.Event(r,this,"Mouseover")},Mouseout:function(r){return a.Event(r,this,"Mouseout")},Mousedown:function(r){return a.Event(r,this,"Mousedown")},Mouseup:function(r){return a.Event(r,this,"Mouseup")},Touchstart:function(r){return a.Event(r,this,"Touchstart")},Touchend:function(r){return a.Event(r,this,"Touchend")},Event:function(t,v,r,u){if(a.skipMouseover&&r==="Mouseover"&&!u){return h(t)}if(a.skipUp){if(r.match(/Mouseup|Touchend/)){delete a.skipUp;return h(t)}if(r==="Touchstart"||(r==="Mousedown"&&!a.skipMousedown)){delete a.skipUp}}if(!t){t=window.event}var s=v.menuItem;if(s&&s[r]){return s[r](t,v)}return null},BGSTYLE:{position:"absolute",left:0,top:0,"z-index":200,width:"100%",height:"100%",border:0,padding:0,margin:0},Background:function(s){var t=g.addElement(document.body,"div",{style:this.BGSTYLE,id:"MathJax_MenuFrame"},[["div",{style:this.BGSTYLE,menuItem:s,onmousedown:this.Remove}]]);var r=t.firstChild;if(a.msieBackgroundBug){r.style.backgroundColor="white";r.style.filter="alpha(opacity=0)"}if(a.msieFixedPositionBug){t.width=t.height=0;this.Resize();attachEvent("onresize",this.Resize)}else{r.style.position="fixed"}return t},Resize:function(){setTimeout(a.SetWH,0)},SetWH:function(){var r=document.getElementById("MathJax_MenuFrame");if(r){r=r.firstChild;r.style.width=r.style.height="1px";r.style.width=document.body.scrollWidth+"px";r.style.height=document.body.scrollHeight+"px"}},saveCookie:function(){g.Cookie.Set("menu",this.cookie)},getCookie:function(){this.cookie=g.Cookie.Get("menu")},getImages:function(){if(a.isMobile){var r=new Image();r.src=p.closeImg}}});var m=a.ITEM=MathJax.Object.Subclass({name:"",Create:function(s){if(!this.hidden){var r={onmouseover:a.Mouseover,onmouseout:a.Mouseout,onmouseup:a.Mouseup,onmousedown:a.Mousedown,ondragstart:h,onselectstart:h,onselectend:h,ontouchstart:a.Touchstart,ontouchend:a.Touchend,className:"MathJax_MenuItem",menuItem:this};if(this.disabled){r.className+=" MathJax_MenuDisabled"}g.addElement(s,"div",r,this.Label(r,s))}},Name:function(){return o(this.name[0],this.name[1])},Mouseover:function(v,x){if(!this.disabled){this.Activate(x)}if(!this.menu||!this.menu.posted){var w=document.getElementById("MathJax_MenuFrame").childNodes,s=x.parentNode.childNodes;for(var t=0,r=s.length;t<r;t++){var u=s[t].menuItem;if(u&&u.menu&&u.menu.posted){u.Deactivate(s[t])}}r=w.length-1;while(r>=0&&x.parentNode.menuItem!==w[r].menuItem){w[r].menuItem.posted=false;w[r].parentNode.removeChild(w[r]);r--}if(this.Timer&&!a.isMobile){this.Timer(v,x)}}},Mouseout:function(r,s){if(!this.menu||!this.menu.posted){this.Deactivate(s)}if(this.timer){clearTimeout(this.timer);delete this.timer}},Mouseup:function(r,s){return this.Remove(r,s)},Touchstart:function(r,s){return this.TouchEvent(r,s,"Mousedown")},Touchend:function(r,s){return this.TouchEvent(r,s,"Mouseup")},TouchEvent:function(s,t,r){if(this!==m.lastItem){if(m.lastMenu){a.Event(s,m.lastMenu,"Mouseout")}a.Event(s,t,"Mouseover",true);m.lastItem=this;m.lastMenu=t}if(this.nativeTouch){return null}a.Event(s,t,r);return false},Remove:function(r,s){s=s.parentNode.menuItem;return s.Remove(r,s)},Activate:function(r){this.Deactivate(r);r.className+=" MathJax_MenuActive"},Deactivate:function(r){r.className=r.className.replace(/ MathJax_MenuActive/,"")},With:function(r){if(r){c.Insert(this,r)}return this}});a.ITEM.COMMAND=a.ITEM.Subclass({action:function(){},Init:function(r,t,s){if(!(r instanceof Array)){r=[r,r]}this.name=r;this.action=t;this.With(s)},Label:function(r,s){return[this.Name()]},Mouseup:function(r,s){if(!this.disabled){this.Remove(r,s);j.Post(["command",this]);this.action.call(this,r)}return h(r)}});a.ITEM.SUBMENU=a.ITEM.Subclass({menu:null,marker:(n&&!c.Browser.isSafari?"\u25B6":"\u25B8"),Init:function(r,t){if(!(r instanceof Array)){r=[r,r]}this.name=r;var s=1;if(!(t instanceof a.ITEM)){this.With(t),s++}this.menu=a.apply(a,[].slice.call(arguments,s))},Label:function(r,s){this.menu.posted=false;return[this.Name()+" ",["span",{className:"MathJax_MenuArrow"},[this.marker]]]},Timer:function(r,s){if(this.timer){clearTimeout(this.timer)}r={clientX:r.clientX,clientY:r.clientY};this.timer=setTimeout(f(["Mouseup",this,r,s]),p.delay)},Touchend:function(s,u){var t=this.menu.posted;var r=this.SUPER(arguments).Touchend.apply(this,arguments);if(t){this.Deactivate(u);delete m.lastItem;delete m.lastMenu}return r},Mouseup:function(s,u){if(!this.disabled){if(!this.menu.posted){if(this.timer){clearTimeout(this.timer);delete this.timer}this.menu.Post(s,u)}else{var t=document.getElementById("MathJax_MenuFrame").childNodes,r=t.length-1;while(r>=0){var v=t[r];v.menuItem.posted=false;v.parentNode.removeChild(v);if(v.menuItem===this.menu){break}r--}}}return h(s)}});a.ITEM.RADIO=a.ITEM.Subclass({variable:null,marker:(n?"\u25CF":"\u2713"),Init:function(s,r,t){if(!(s instanceof Array)){s=[s,s]}this.name=s;this.variable=r;this.With(t);if(this.value==null){this.value=this.name[0]}},Label:function(s,t){var r={className:"MathJax_MenuRadioCheck"};if(p.settings[this.variable]!==this.value){r={style:{display:"none"}}}return[["span",r,[this.marker]]," "+this.Name()]},Mouseup:function(u,v){if(!this.disabled){var w=v.parentNode.childNodes;for(var s=0,r=w.length;s<r;s++){var t=w[s].menuItem;if(t&&t.variable===this.variable){w[s].firstChild.style.display="none"}}v.firstChild.display="";p.settings[this.variable]=this.value;a.cookie[this.variable]=p.settings[this.variable];a.saveCookie();j.Post(["radio button",this])}this.Remove(u,v);if(this.action&&!this.disabled){this.action.call(a,this)}return h(u)}});a.ITEM.CHECKBOX=a.ITEM.Subclass({variable:null,marker:"\u2713",Init:function(s,r,t){if(!(s instanceof Array)){s=[s,s]}this.name=s;this.variable=r;this.With(t)},Label:function(s,t){var r={className:"MathJax_MenuCheck"};if(!p.settings[this.variable]){r={style:{display:"none"}}}return[["span",r,[this.marker]]," "+this.Name()]},Mouseup:function(r,s){if(!this.disabled){s.firstChild.display=(p.settings[this.variable]?"none":"");p.settings[this.variable]=!p.settings[this.variable];a.cookie[this.variable]=p.settings[this.variable];a.saveCookie();j.Post(["checkbox",this])}this.Remove(r,s);if(this.action&&!this.disabled){this.action.call(a,this)}return h(r)}});a.ITEM.LABEL=a.ITEM.Subclass({Init:function(r,s){if(!(r instanceof Array)){r=[r,r]}this.name=r;this.With(s)},Label:function(r,s){delete r.onmouseover,delete r.onmouseout;delete r.onmousedown;r.className+=" MathJax_MenuLabel";return[this.Name()]}});a.ITEM.RULE=a.ITEM.Subclass({Label:function(r,s){delete r.onmouseover,delete r.onmouseout;delete r.onmousedown;r.className+=" MathJax_MenuRule";return null}});a.About=function(){var t=b["HTML-CSS"]||{};var s=(t.imgFonts?"image":(t.fontInUse?(t.webFonts?"web":"local")+" "+t.fontInUse:(b.SVG?"web SVG":"generic")))+" fonts";var x=(!t.webFonts||t.imgFonts?null:t.allowWebFonts.replace(/otf/,"woff or otf")+" fonts");var r=["MathJax.js v"+MathJax.fileversion,["br"]];r.push(["div",{style:{"border-top":"groove 2px",margin:".25em 0"}}]);a.About.GetJax(r,MathJax.InputJax,["InputJax","%1 Input Jax v%2"]);a.About.GetJax(r,MathJax.OutputJax,["OutputJax","%1 Output Jax v%2"]);a.About.GetJax(r,MathJax.ElementJax,["ElementJax","%1 Element Jax v%2"]);r.push(["div",{style:{"border-top":"groove 2px",margin:".25em 0"}}]);a.About.GetJax(r,MathJax.Extension,["Extension","%1 Extension v%2"],true);r.push(["div",{style:{"border-top":"groove 2px",margin:".25em 0"}}],["center",{},[c.Browser+" v"+c.Browser.version+(x?" \u2014 "+o(x.replace(/ /g,""),x):"")]]);a.About.div=a.Background(a.About);var v=g.addElement(a.About.div,"div",{id:"MathJax_About"},[["b",{style:{fontSize:"120%"}},["MathJax"]]," v"+MathJax.version,["br"],o(s.replace(/ /g,""),"using "+s),["br"],["br"],["span",{style:{display:"inline-block","text-align":"left","font-size":"80%","max-height":"20em",overflow:"auto","background-color":"#E4E4E4",padding:".4em .6em",border:"1px inset"}},r],["br"],["br"],["a",{href:"http://www.mathjax.org/"},["www.mathjax.org"]],["img",{src:p.closeImg,style:{width:"21px",height:"21px",position:"absolute",top:".2em",right:".2em"},onclick:a.About.Remove}]]);MathJax.Localization.setCSS(v);var w=(document.documentElement||{});var u=window.innerHeight||w.clientHeight||w.scrollHeight||0;if(a.prototype.msieAboutBug){v.style.width="20em";v.style.position="absolute";v.style.left=Math.floor((document.documentElement.scrollWidth-v.offsetWidth)/2)+"px";v.style.top=(Math.floor((u-v.offsetHeight)/3)+document.body.scrollTop)+"px"}else{v.style.marginLeft=Math.floor(-v.offsetWidth/2)+"px";v.style.top=Math.floor((u-v.offsetHeight)/3)+"px"}};a.About.Remove=function(r){if(a.About.div){document.body.removeChild(a.About.div);delete a.About.div}};a.About.GetJax=function(s,x,v,u){var w=[];for(var y in x){if(x.hasOwnProperty(y)&&x[y]){if((u&&x[y].version)||(x[y].isa&&x[y].isa(x))){w.push(o(v[0],v[1],(x[y].id||y),x[y].version))}}}w.sort();for(var t=0,r=w.length;t<r;t++){s.push(w[t],["br"])}return s};a.Help=function(){k.Require("[MathJax]/extensions/HelpDialog.js",function(){MathJax.Extension.Help.Dialog()})};a.ShowSource=function(u){if(!u){u=window.event}var t={screenX:u.screenX,screenY:u.screenY};if(!a.jax){return}if(this.format==="MathML"){var r=MathJax.ElementJax.mml;if(r&&typeof(r.mbase.prototype.toMathML)!=="undefined"){try{a.ShowSource.Text(a.jax.root.toMathML(),u)}catch(s){if(!s.restart){throw s}f.After([this,a.ShowSource,t],s.restart)}}else{if(!k.loadingToMathML){k.loadingToMathML=true;a.ShowSource.Window(u);f.Queue(k.Require("[MathJax]/extensions/toMathML.js"),function(){delete k.loadingToMathML;if(!r.mbase.prototype.toMathML){r.mbase.prototype.toMathML=function(){}}},[this,a.ShowSource,t]);return}}}else{if(this.format==="Error"){a.ShowSource.Text(a.jax.errorText,u)}else{if(a.jax.originalText==null){alert(o("NoOriginalForm","No original form available"));return}a.ShowSource.Text(a.jax.originalText,u)}}};a.ShowSource.Window=function(s){if(!a.ShowSource.w){var t=[],r=p.windowSettings;for(var u in r){if(r.hasOwnProperty(u)){t.push(u+"="+r[u])}}a.ShowSource.w=window.open("","_blank",t.join(","))}return a.ShowSource.w};a.ShowSource.Text=function(v,t){var r=a.ShowSource.Window(t);delete a.ShowSource.w;v=v.replace(/^\s*/,"").replace(/\s*$/,"");v=v.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");var u=o("EqSource","MathJax Equation Source");if(a.isMobile){r.document.open();r.document.write("<html><head><meta name='viewport' content='width=device-width, initial-scale=1.0' /><title>"+u+"</title></head><body style='font-size:85%'>");r.document.write("<pre>"+v+"</pre>");r.document.write("<hr><input type='button' value='"+o("Close","Close")+"' onclick='window.close()' />");r.document.write("</body></html>");r.document.close()}else{r.document.open();r.document.write("<html><head><title>"+u+"</title></head><body style='font-size:85%'>");r.document.write("<table><tr><td><pre>"+v+"</pre></td></tr></table>");r.document.write("</body></html>");r.document.close();var s=r.document.body.firstChild;setTimeout(function(){var A=(r.outerHeight-r.innerHeight)||30,z=(r.outerWidth-r.innerWidth)||30,w,B;z=Math.max(100,Math.min(Math.floor(0.5*screen.width),s.offsetWidth+z+25));A=Math.max(40,Math.min(Math.floor(0.5*screen.height),s.offsetHeight+A+25));r.resizeTo(z,A);if(t&&t.screenX!=null){w=Math.max(0,Math.min(t.screenX-Math.floor(z/2),screen.width-z-20));B=Math.max(0,Math.min(t.screenY-Math.floor(A/2),screen.height-A-20));r.moveTo(w,B)}},50)}};a.Scale=function(){var s=b["HTML-CSS"],r=b.NativeMML,v=b.SVG;var u=(s||r||v||{config:{scale:100}}).config.scale;var t=prompt(o("ScaleMath","Scale all mathematics (compared to surrounding text) by"),u+"%");if(t){if(t.match(/^\s*\d+(\.\d*)?\s*%?\s*$/)){t=parseFloat(t);if(t){if(t!==u){if(s){s.config.scale=t}if(r){r.config.scale=t}if(v){v.config.scale=t}a.cookie.scale=t;a.saveCookie();c.Reprocess()}}else{alert(o("NonZeroScale","The scale should not be zero"))}}else{alert(o("PercentScale","The scale should be a percentage (e.g., 120%%)"))}}};a.Zoom=function(){if(!MathJax.Extension.MathZoom){k.Require("[MathJax]/extensions/MathZoom.js")}};a.Renderer=function(){var s=c.outputJax["jax/mml"];if(s[0]!==p.settings.renderer){var v=c.Browser,u,r=a.Renderer.Messages,t;switch(p.settings.renderer){case"NativeMML":if(!p.settings.warnedMML){if(v.isChrome&&v.version.substr(0,3)!=="24."){u=r.MML.WebKit}else{if(v.isSafari&&!v.versionAtLeast("5.0")){u=r.MML.WebKit}else{if(v.isMSIE){if(!v.hasMathPlayer){u=r.MML.MSIE}}else{u=r.MML[v]}}}t="warnedMML"}break;case"SVG":if(!p.settings.warnedSVG){if(v.isMSIE&&!e){u=r.SVG.MSIE}}break}if(u){u=o(u[0],u[1]);u+="\n\n";u+=o("SwitchAnyway","Switch the renderer anyway?\n\n(Press OK to switch, CANCEL to continue with the current renderer)");a.cookie.renderer=s[0].id;a.saveCookie();if(!confirm(u)){a.cookie.renderer=p.settings.renderer=g.Cookie.Get("menu").renderer;a.saveCookie();return}if(t){a.cookie.warned=p.settings.warned=true}a.cookie.renderer=p.settings.renderer;a.saveCookie()}c.Queue(["setRenderer",c,p.settings.renderer,"jax/mml"],["Rerender",c])}};a.Renderer.Messages={MML:{WebKit:["WebkitNativeMMLWarning","Your browser doesn't seem to support MathML natively, so switching to MathML output may cause the mathematics on the page to become unreadable."],MSIE:["MSIENativeMMLWarning","Internet Explorer requires the MathPlayer plugin in order to process MathML output."],Opera:["OperaNativeMMLWarning","Opera's support for MathML is limited, so switching to MathML output may cause some expressions to render poorly."],Safari:["SafariNativeMMLWarning","Your browser's native MathML does not implement all the features used by MathJax, so some expressions may not render properly."],Firefox:["FirefoxNativeMMLWarning","Your browser's native MathML does not implement all the features used by MathJax, so some expressions may not render properly."]},SVG:{MSIE:["MSIESVGWarning","SVG is not implemented in Internet Explorer prior to IE9 or when it is emulating IE8 or below. Switching to SVG output will cause the mathematics to not display properly."]}};a.Font=function(){var r=b["HTML-CSS"];if(!r){return}document.location.reload()};a.Locale=function(){MathJax.Localization.setLocale(p.settings.locale);MathJax.Hub.Queue(["Reprocess",MathJax.Hub])};a.LoadLocale=function(){var r=prompt(o("LoadURL","Load translation data from this URL:"));if(r){if(!r.match(/\.js$/)){alert(o("BadURL","The URL should be for a javascript file that defines MathJax translation data. Javascript file names should end with '.js'"))}k.Require(r,function(s){if(s!=k.STATUS.OK){alert(o("BadData","Failed to load translation data from %1",r))}})}};a.MPEvents=function(t){var s=p.settings.discoverable,r=a.MPEvents.Messages;if(!e){if(p.settings.mpMouse&&!confirm(o.apply(o,r.IE8warning))){delete a.cookie.mpContext;delete p.settings.mpContext;delete a.cookie.mpMouse;delete p.settings.mpMouse;a.saveCookie();return}p.settings.mpContext=p.settings.mpMouse;a.cookie.mpContext=a.cookie.mpMouse=p.settings.mpMouse;a.saveCookie();MathJax.Hub.Queue(["Rerender",MathJax.Hub])}else{if(!s&&t.name[1]==="Menu Events"&&p.settings.mpContext){alert(o.apply(o,r.IE9warning))}}};a.MPEvents.Messages={IE8warning:["IE8warning","This will disable the MathJax menu and zoom features, but you can Alt-Click on an expression to obtain the MathJax menu instead.\n\nReally change the MathPlayer settings?"],IE9warning:["IE9warning","The MathJax contextual menu will be disabled, but you can Alt-Click on an expression to obtain the MathJax menu instead."]};c.Browser.Select({MSIE:function(r){var s=(document.compatMode==="BackCompat");var t=r.versionAtLeast("8.0")&&document.documentMode>7;a.Augment({margin:20,msieBackgroundBug:(document.documentMode<9),msieFixedPositionBug:(s||!t),msieAboutBug:s});if(e){delete p.styles["#MathJax_About"].filter;delete p.styles[".MathJax_Menu"].filter}},Firefox:function(r){a.skipMouseover=r.isMobile&&r.versionAtLeast("6.0");a.skipMousedown=r.isMobile}});a.isMobile=c.Browser.isMobile;a.noContextMenu=c.Browser.noContextMenu;a.CreateLocaleMenu=function(){if(!a.menu){return}var w=a.menu.Find("Language").menu,t=w.items;var s=[],y=MathJax.Localization.strings;for(var x in y){if(y.hasOwnProperty(x)){s.push(x)}}s=s.sort();w.items=[];for(var u=0,r=s.length;u<r;u++){var v=y[s[u]].menuTitle;if(v){v+=" ("+s[u]+")"}else{v=s[u]}w.items.push(m.RADIO([s[u],v],"locale",{action:a.Locale}))}w.items.push(t[t.length-2],t[t.length-1])};c.Register.StartupHook("End Config",function(){p.settings=c.config.menuSettings;if(typeof(p.settings.showRenderer)!=="undefined"){p.showRenderer=p.settings.showRenderer}if(typeof(p.settings.showFontMenu)!=="undefined"){p.showFontMenu=p.settings.showFontMenu}if(typeof(p.settings.showContext)!=="undefined"){p.showContext=p.settings.showContext}a.getCookie();a.menu=a(m.SUBMENU(["Show","Show Math As"],m.COMMAND(["MathMLcode","MathML Code"],a.ShowSource,{nativeTouch:true,format:"MathML"}),m.COMMAND(["Original","Original Form"],a.ShowSource,{nativeTouch:true}),m.RULE(),m.CHECKBOX(["texHints","Show TeX hints in MathML"],"texHints")),m.RULE(),m.SUBMENU(["Settings","Math Settings"],m.SUBMENU(["ZoomTrigger","Zoom Trigger"],m.RADIO(["Hover","Hover"],"zoom",{action:a.Zoom}),m.RADIO(["Click","Click"],"zoom",{action:a.Zoom}),m.RADIO(["DoubleClick","Double-Click"],"zoom",{action:a.Zoom}),m.RADIO(["NoZoom","No Zoom"],"zoom",{value:"None"}),m.RULE(),m.LABEL(["TriggerRequires","Trigger Requires:"]),m.CHECKBOX((c.Browser.isMac?["Option","Option"]:["Alt","Alt"]),"ALT"),m.CHECKBOX(["Command","Command"],"CMD",{hidden:!c.Browser.isMac}),m.CHECKBOX(["Control","Control"],"CTRL",{hidden:c.Browser.isMac}),m.CHECKBOX(["Shift","Shift"],"Shift")),m.SUBMENU(["ZoomFactor","Zoom Factor"],m.RADIO("125%","zscale"),m.RADIO("133%","zscale"),m.RADIO("150%","zscale"),m.RADIO("175%","zscale"),m.RADIO("200%","zscale"),m.RADIO("250%","zscale"),m.RADIO("300%","zscale"),m.RADIO("400%","zscale")),m.RULE(),m.SUBMENU(["Renderer","Math Renderer"],{hidden:!p.showRenderer},m.RADIO("HTML-CSS","renderer",{action:a.Renderer}),m.RADIO("MathML","renderer",{action:a.Renderer,value:"NativeMML"}),m.RADIO("SVG","renderer",{action:a.Renderer})),m.SUBMENU("MathPlayer",{hidden:!c.Browser.isMSIE||!p.showMathPlayer,disabled:!c.Browser.hasMathPlayer},m.LABEL(["MPHandles","Let MathPlayer Handle:"]),m.CHECKBOX(["MenuEvents","Menu Events"],"mpContext",{action:a.MPEvents,hidden:!e}),m.CHECKBOX(["MouseEvents","Mouse Events"],"mpMouse",{action:a.MPEvents,hidden:!e}),m.CHECKBOX(["MenuAndMouse","Mouse and Menu Events"],"mpMouse",{action:a.MPEvents,hidden:e})),m.SUBMENU(["FontPrefs","Font Preference"],{hidden:!p.showFontMenu},m.LABEL(["ForHTMLCSS","For HTML-CSS:"]),m.RADIO(["Auto","Auto"],"font",{action:a.Font}),m.RULE(),m.RADIO(["TeXLocal","TeX (local)"],"font",{action:a.Font}),m.RADIO(["TeXWeb","TeX (web)"],"font",{action:a.Font}),m.RADIO(["TeXImage","TeX (image)"],"font",{action:a.Font}),m.RULE(),m.RADIO(["STIXlocal","STIX (local)"],"font",{action:a.Font})),m.SUBMENU(["ContextMenu","Contextual Menu"],{hidden:!p.showContext},m.RADIO("MathJax","context"),m.RADIO(["Browser","Browser"],"context")),m.COMMAND(["Scale","Scale All Math ..."],a.Scale),m.RULE().With({hidden:!p.showDiscoverable,name:["","discover_rule"]}),m.CHECKBOX(["Discoverable","Highlight on Hover"],"discoverable",{hidden:!p.showDiscoverable})),m.SUBMENU(["Locale","Language"],{hidden:!p.showLocale},m.RADIO("en","locale",{action:a.Locale}),m.RULE().With({hidden:!p.showLocaleURL,name:["","localURL_rule"]}),m.COMMAND(["LoadLocale","Load from URL ..."],a.LoadLocale,{hidden:!p.showLocaleURL})),m.RULE(),m.COMMAND(["About","About MathJax"],a.About),m.COMMAND(["Help","MathJax Help"],a.Help));if(a.isMobile){(function(){var s=p.settings;var r=a.menu.Find("Math Settings","Zoom Trigger").menu;r.items[0].disabled=r.items[1].disabled=true;if(s.zoom==="Hover"||s.zoom=="Click"){s.zoom="None"}r.items=r.items.slice(0,4);if(navigator.appVersion.match(/[ (]Android[) ]/)){a.ITEM.SUBMENU.Augment({marker:"\u00BB"})}})()}a.CreateLocaleMenu()});a.showRenderer=function(r){a.cookie.showRenderer=p.showRenderer=r;a.saveCookie();a.menu.Find("Math Settings","Math Renderer").hidden=!r};a.showMathPlayer=function(r){a.cookie.showMathPlayer=p.showMathPlayer=r;a.saveCookie();a.menu.Find("Math Settings","MathPlayer").hidden=!r};a.showFontMenu=function(r){a.cookie.showFontMenu=p.showFontMenu=r;a.saveCookie();a.menu.Find("Math Settings","Font Preference").hidden=!r};a.showContext=function(r){a.cookie.showContext=p.showContext=r;a.saveCookie();a.menu.Find("Math Settings","Contextual Menu").hidden=!r};a.showDiscoverable=function(r){a.cookie.showDiscoverable=p.showDiscoverable=r;a.saveCookie();a.menu.Find("Math Settings","Highlight on Hover").hidden=!r;a.menu.Find("Math Settings","discover_rule").hidden=!r};a.showLocale=function(r){a.cookie.showLocale=p.showLocale=r;a.saveCookie();a.menu.Find("Language").hidden=!r};MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function(){if(!MathJax.OutputJax["HTML-CSS"].config.imageFont){a.menu.Find("Math Settings","Font Preference","TeX (image)").disabled=true}});f.Queue(c.Register.StartupHook("End Config",{}),["getImages",a],["Styles",k,p.styles],["Post",c.Startup.signal,"MathMenu Ready"],["loadComplete",k,"[MathJax]/extensions/MathMenu.js"])})(MathJax.Hub,MathJax.HTML,MathJax.Ajax,MathJax.CallBack,MathJax.OutputJax); MathJax.ElementJax.mml=MathJax.ElementJax({mimeType:"jax/mml"},{id:"mml",version:"2.2",directory:MathJax.ElementJax.directory+"/mml",extensionDir:MathJax.ElementJax.extensionDir+"/mml",optableDir:MathJax.ElementJax.directory+"/mml/optable"});MathJax.ElementJax.mml.Augment({Init:function(){if(arguments.length===1&&arguments[0].type==="math"){this.root=arguments[0]}else{this.root=MathJax.ElementJax.mml.math.apply(this,arguments)}if(this.root.attr&&this.root.attr.mode){if(!this.root.display&&this.root.attr.mode==="display"){this.root.display="block";this.root.attrNames.push("display")}delete this.root.attr.mode;for(var b=0,a=this.root.attrNames.length;b<a;b++){if(this.root.attrNames[b]==="mode"){this.root.attrNames.splice(b,1);break}}}}},{INHERIT:"_inherit_",AUTO:"_auto_",SIZE:{INFINITY:"infinity",SMALL:"small",NORMAL:"normal",BIG:"big"},COLOR:{TRANSPARENT:"transparent"},VARIANT:{NORMAL:"normal",BOLD:"bold",ITALIC:"italic",BOLDITALIC:"bold-italic",DOUBLESTRUCK:"double-struck",FRAKTUR:"fraktur",BOLDFRAKTUR:"bold-fraktur",SCRIPT:"script",BOLDSCRIPT:"bold-script",SANSSERIF:"sans-serif",BOLDSANSSERIF:"bold-sans-serif",SANSSERIFITALIC:"sans-serif-italic",SANSSERIFBOLDITALIC:"sans-serif-bold-italic",MONOSPACE:"monospace",INITIAL:"inital",TAILED:"tailed",LOOPED:"looped",STRETCHED:"stretched",CALIGRAPHIC:"-tex-caligraphic",OLDSTYLE:"-tex-oldstyle"},FORM:{PREFIX:"prefix",INFIX:"infix",POSTFIX:"postfix"},LINEBREAK:{AUTO:"auto",NEWLINE:"newline",NOBREAK:"nobreak",GOODBREAK:"goodbreak",BADBREAK:"badbreak"},LINEBREAKSTYLE:{BEFORE:"before",AFTER:"after",DUPLICATE:"duplicate",INFIXLINBREAKSTYLE:"infixlinebreakstyle"},INDENTALIGN:{LEFT:"left",CENTER:"center",RIGHT:"right",AUTO:"auto",ID:"id",INDENTALIGN:"indentalign"},INDENTSHIFT:{INDENTSHIFT:"indentshift"},LINETHICKNESS:{THIN:"thin",MEDIUM:"medium",THICK:"thick"},NOTATION:{LONGDIV:"longdiv",ACTUARIAL:"actuarial",RADICAL:"radical",BOX:"box",ROUNDEDBOX:"roundedbox",CIRCLE:"circle",LEFT:"left",RIGHT:"right",TOP:"top",BOTTOM:"bottom",UPDIAGONALSTRIKE:"updiagonalstrike",DOWNDIAGONALSTRIKE:"downdiagonalstrike",VERTICALSTRIKE:"verticalstrike",HORIZONTALSTRIKE:"horizontalstrike",MADRUWB:"madruwb"},ALIGN:{TOP:"top",BOTTOM:"bottom",CENTER:"center",BASELINE:"baseline",AXIS:"axis",LEFT:"left",RIGHT:"right"},LINES:{NONE:"none",SOLID:"solid",DASHED:"dashed"},SIDE:{LEFT:"left",RIGHT:"right",LEFTOVERLAP:"leftoverlap",RIGHTOVERLAP:"rightoverlap"},WIDTH:{AUTO:"auto",FIT:"fit"},ACTIONTYPE:{TOGGLE:"toggle",STATUSLINE:"statusline",TOOLTIP:"tooltip",INPUT:"input"},LENGTH:{VERYVERYTHINMATHSPACE:"veryverythinmathspace",VERYTHINMATHSPACE:"verythinmathspace",THINMATHSPACE:"thinmathspace",MEDIUMMATHSPACE:"mediummathspace",THICKMATHSPACE:"thickmathspace",VERYTHICKMATHSPACE:"verythickmathspace",VERYVERYTHICKMATHSPACE:"veryverythickmathspace",NEGATIVEVERYVERYTHINMATHSPACE:"negativeveryverythinmathspace",NEGATIVEVERYTHINMATHSPACE:"negativeverythinmathspace",NEGATIVETHINMATHSPACE:"negativethinmathspace",NEGATIVEMEDIUMMATHSPACE:"negativemediummathspace",NEGATIVETHICKMATHSPACE:"negativethickmathspace",NEGATIVEVERYTHICKMATHSPACE:"negativeverythickmathspace",NEGATIVEVERYVERYTHICKMATHSPACE:"negativeveryverythickmathspace"},OVERFLOW:{LINBREAK:"linebreak",SCROLL:"scroll",ELIDE:"elide",TRUNCATE:"truncate",SCALE:"scale"},UNIT:{EM:"em",EX:"ex",PX:"px",IN:"in",CM:"cm",MM:"mm",PT:"pt",PC:"pc"},TEXCLASS:{ORD:0,OP:1,BIN:2,REL:3,OPEN:4,CLOSE:5,PUNCT:6,INNER:7,VCENTER:8,NONE:-1},TEXCLASSNAMES:["ORD","OP","BIN","REL","OPEN","CLOSE","PUNCT","INNER","VCENTER"],copyAttributes:{fontfamily:true,fontsize:true,fontweight:true,fontstyle:true,color:true,background:true,id:true,"class":true,href:true,style:true},skipAttributes:{texClass:true,useHeight:true,texprimestyle:true},copyAttributeNames:["fontfamily","fontsize","fontweight","fontstyle","color","background","id","class","href","style"]});(function(a){a.mbase=MathJax.Object.Subclass({type:"base",isToken:false,defaults:{mathbackground:a.INHERIT,mathcolor:a.INHERIT},noInherit:{},noInheritAttribute:{texClass:true},linebreakContainer:false,Init:function(){this.data=[];if(this.inferRow&&!(arguments.length===1&&arguments[0].inferred)){this.Append(a.mrow().With({inferred:true,notParent:true}))}this.Append.apply(this,arguments)},With:function(d){for(var e in d){if(d.hasOwnProperty(e)){this[e]=d[e]}}return this},Append:function(){if(this.inferRow&&this.data.length){this.data[0].Append.apply(this.data[0],arguments)}else{for(var e=0,d=arguments.length;e<d;e++){this.SetData(this.data.length,arguments[e])}}},SetData:function(d,e){if(e!=null){if(!(e instanceof a.mbase)){e=(this.isToken?a.chars(e):a.mtext(e))}e.parent=this;e.setInherit(this.inheritFromMe?this:this.inherit)}this.data[d]=e},Parent:function(){var d=this.parent;while(d&&d.notParent){d=d.parent}return d},Get:function(e,j){if(this[e]!=null){return this[e]}if(this.attr&&this.attr[e]!=null){return this.attr[e]}var f=this.Parent();if(f&&f["adjustChild_"+e]!=null){return(f["adjustChild_"+e])(this.childPosition(),j)}var i=this.inherit;var d=i;while(i){var h=i[e];if(h==null&&i.attr){h=i.attr[e]}if(h!=null&&i.noInheritAttribute&&!i.noInheritAttribute[e]){var g=i.noInherit[this.type];if(!(g&&g[e])){return h}}d=i;i=i.inherit}if(!j){if(this.defaults[e]===a.AUTO){return this.autoDefault(e)}if(this.defaults[e]!==a.INHERIT&&this.defaults[e]!=null){return this.defaults[e]}if(d){return d.defaults[e]}}return null},hasValue:function(d){return(this.Get(d,true)!=null)},getValues:function(){var e={};for(var f=0,d=arguments.length;f<d;f++){e[arguments[f]]=this.Get(arguments[f])}return e},adjustChild_scriptlevel:function(e,d){return this.Get("scriptlevel",d)},adjustChild_displaystyle:function(e,d){return this.Get("displaystyle",d)},adjustChild_texprimestyle:function(e,d){return this.Get("texprimestyle",d)},childPosition:function(){var g=this,f=g.parent;while(f.notParent){g=f;f=g.parent}for(var e=0,d=f.data.length;e<d;e++){if(f.data[e]===g){return e}}return null},setInherit:function(f){if(f!==this.inherit&&this.inherit==null){this.inherit=f;for(var e=0,d=this.data.length;e<d;e++){if(this.data[e]&&this.data[e].setInherit){this.data[e].setInherit(f)}}}},setTeXclass:function(d){this.getPrevClass(d);return(typeof(this.texClass)!=="undefined"?this:d)},getPrevClass:function(d){if(d){this.prevClass=d.Get("texClass");this.prevLevel=d.Get("scriptlevel")}},updateTeXclass:function(d){if(d){this.prevClass=d.prevClass;delete d.prevClass;this.prevLevel=d.prevLevel;delete d.prevLevel;this.texClass=d.Get("texClass")}},texSpacing:function(){var e=(this.prevClass!=null?this.prevClass:a.TEXCLASS.NONE);var d=(this.Get("texClass")||a.TEXCLASS.ORD);if(e===a.TEXCLASS.NONE||d===a.TEXCLASS.NONE){return""}if(e===a.TEXCLASS.VCENTER){e=a.TEXCLASS.ORD}if(d===a.TEXCLASS.VCENTER){d=a.TEXCLASS.ORD}var f=this.TEXSPACE[e][d];if(this.prevLevel>0&&this.Get("scriptlevel")>0&&f>=0){return""}return this.TEXSPACELENGTH[Math.abs(f)]},TEXSPACELENGTH:["",a.LENGTH.THINMATHSPACE,a.LENGTH.MEDIUMMATHSPACE,a.LENGTH.THICKMATHSPACE],TEXSPACE:[[0,-1,2,3,0,0,0,1],[-1,-1,0,3,0,0,0,1],[2,2,0,0,2,0,0,2],[3,3,0,0,3,0,0,3],[0,0,0,0,0,0,0,0],[0,-1,2,3,0,0,0,1],[1,1,0,1,1,1,1,1],[1,-1,2,3,1,0,1,1]],autoDefault:function(d){return""},isSpacelike:function(){return false},isEmbellished:function(){return false},Core:function(){return this},CoreMO:function(){return this},hasNewline:function(){if(this.isEmbellished()){return this.CoreMO().hasNewline()}if(this.isToken||this.linebreakContainer){return false}for(var e=0,d=this.data.length;e<d;e++){if(this.data[e]&&this.data[e].hasNewline()){return true}}return false},array:function(){if(this.inferred){return this.data}else{return[this]}},toString:function(){return this.type+"("+this.data.join(",")+")"}},{childrenSpacelike:function(){for(var e=0,d=this.data.length;e<d;e++){if(!this.data[e].isSpacelike()){return false}}return true},childEmbellished:function(){return(this.data[0]&&this.data[0].isEmbellished())},childCore:function(){return this.data[0]},childCoreMO:function(){return(this.data[0]?this.data[0].CoreMO():null)},setChildTeXclass:function(d){if(this.data[0]){d=this.data[0].setTeXclass(d);this.updateTeXclass(this.data[0])}return d},setBaseTeXclasses:function(f){this.getPrevClass(f);this.texClass=null;if(this.data[0]){if(this.isEmbellished()||this.data[0].isa(a.mi)){f=this.data[0].setTeXclass(f);this.updateTeXclass(this.Core())}else{this.data[0].setTeXclass();f=this}}else{f=this}for(var e=1,d=this.data.length;e<d;e++){if(this.data[e]){this.data[e].setTeXclass()}}return f},setSeparateTeXclasses:function(f){this.getPrevClass(f);for(var e=0,d=this.data.length;e<d;e++){if(this.data[e]){this.data[e].setTeXclass()}}if(this.isEmbellished()){this.updateTeXclass(this.Core())}return this}});a.mi=a.mbase.Subclass({type:"mi",isToken:true,texClass:a.TEXCLASS.ORD,defaults:{mathvariant:a.AUTO,mathsize:a.INHERIT,mathbackground:a.INHERIT,mathcolor:a.INHERIT},autoDefault:function(e){if(e==="mathvariant"){var d=(this.data[0]||"").toString();return(d.length===1||(d.length===2&&d.charCodeAt(0)>=55296&&d.charCodeAt(0)<56320)?a.VARIANT.ITALIC:a.VARIANT.NORMAL)}return""},setTeXclass:function(e){this.getPrevClass(e);var d=this.data.join("");if(d.length>1&&d.match(/^[a-z][a-z0-9]*$/i)&&this.texClass===a.TEXCLASS.ORD){this.texClass=a.TEXCLASS.OP;this.autoOP=true}return this}});a.mn=a.mbase.Subclass({type:"mn",isToken:true,texClass:a.TEXCLASS.ORD,defaults:{mathvariant:a.INHERIT,mathsize:a.INHERIT,mathbackground:a.INHERIT,mathcolor:a.INHERIT}});a.mo=a.mbase.Subclass({type:"mo",isToken:true,defaults:{mathvariant:a.INHERIT,mathsize:a.INHERIT,mathbackground:a.INHERIT,mathcolor:a.INHERIT,form:a.AUTO,fence:a.AUTO,separator:a.AUTO,lspace:a.AUTO,rspace:a.AUTO,stretchy:a.AUTO,symmetric:a.AUTO,maxsize:a.AUTO,minsize:a.AUTO,largeop:a.AUTO,movablelimits:a.AUTO,accent:a.AUTO,linebreak:a.LINEBREAK.AUTO,lineleading:a.INHERIT,linebreakstyle:a.AUTO,linebreakmultchar:a.INHERIT,indentalign:a.INHERIT,indentshift:a.INHERIT,indenttarget:a.INHERIT,indentalignfirst:a.INHERIT,indentshiftfirst:a.INHERIT,indentalignlast:a.INHERIT,indentshiftlast:a.INHERIT,texClass:a.AUTO},defaultDef:{form:a.FORM.INFIX,fence:false,separator:false,lspace:a.LENGTH.THICKMATHSPACE,rspace:a.LENGTH.THICKMATHSPACE,stretchy:false,symmetric:true,maxsize:a.SIZE.INFINITY,minsize:"0em",largeop:false,movablelimits:false,accent:false,linebreak:a.LINEBREAK.AUTO,lineleading:"1ex",linebreakstyle:"before",indentalign:a.INDENTALIGN.AUTO,indentshift:"0",indenttarget:"",indentalignfirst:a.INDENTALIGN.INDENTALIGN,indentshiftfirst:a.INDENTSHIFT.INDENTSHIFT,indentalignlast:a.INDENTALIGN.INDENTALIGN,indentshiftlast:a.INDENTSHIFT.INDENTSHIFT,texClass:a.TEXCLASS.REL},SPACE_ATTR:{lspace:1,rspace:2,form:4},useMMLspacing:7,autoDefault:function(f,l){var k=this.def;if(!k){if(f==="form"){this.useMMLspacing&=~this.SPACE_ATTR.form;return this.getForm()}var j=this.data.join("");var e=[this.Get("form"),a.FORM.INFIX,a.FORM.POSTFIX,a.FORM.PREFIX];for(var g=0,d=e.length;g<d;g++){var h=this.OPTABLE[e[g]][j];if(h){k=this.makeDef(h);break}}if(!k){k=this.CheckRange(j)}if(!k&&l){k={}}else{if(!k){k=MathJax.Hub.Insert({},this.defaultDef)}k.form=e[0];this.def=k}}this.useMMLspacing&=~(this.SPACE_ATTR[f]||0);if(k[f]!=null){return k[f]}else{if(!l){return this.defaultDef[f]}}return""},CheckRange:function(h){var j=h.charCodeAt(0);if(j>=55296&&j<56320){j=(((j-55296)<<10)+(h.charCodeAt(1)-56320))+65536}for(var f=0,d=this.RANGES.length;f<d&&this.RANGES[f][0]<=j;f++){if(j<=this.RANGES[f][1]){if(this.RANGES[f][3]){var e=a.optableDir+"/"+this.RANGES[f][3]+".js";this.RANGES[f][3]=null;MathJax.Hub.RestartAfter(MathJax.Ajax.Require(e))}var g=a.TEXCLASSNAMES[this.RANGES[f][2]];g=this.OPTABLE.infix[h]=a.mo.OPTYPES[g==="BIN"?"BIN3":g];return this.makeDef(g)}}return null},makeDef:function(e){if(e[2]==null){e[2]=this.defaultDef.texClass}if(!e[3]){e[3]={}}var d=MathJax.Hub.Insert({},e[3]);d.lspace=this.SPACE[e[0]];d.rspace=this.SPACE[e[1]];d.texClass=e[2];if(d.texClass===a.TEXCLASS.REL&&(this.movablelimits||this.data.join("").match(/^[a-z]+$/i))){d.texClass=a.TEXCLASS.OP}return d},getForm:function(){var d=this,f=this.parent,e=this.Parent();while(e&&e.isEmbellished()){d=f;f=e.parent;e=e.Parent()}if(f&&f.type==="mrow"&&f.NonSpaceLength()!==1){if(f.FirstNonSpace()===d){return a.FORM.PREFIX}if(f.LastNonSpace()===d){return a.FORM.POSTFIX}}return a.FORM.INFIX},isEmbellished:function(){return true},hasNewline:function(){return(this.Get("linebreak")===a.LINEBREAK.NEWLINE)},setTeXclass:function(d){this.getValues("lspace","rspace");if(this.useMMLspacing){this.texClass=a.TEXCLASS.NONE;return this}this.texClass=this.Get("texClass");if(this.data.join("")==="\u2061"){if(d){d.texClass=a.TEXCLASS.OP}this.texClass=this.prevClass=a.TEXCLASS.NONE;return d}return this.adjustTeXclass(d)},adjustTeXclass:function(d){if(this.texClass===a.TEXCLASS.NONE){return d}if(d){if(d.autoOP&&(this.texClass===a.TEXCLASS.BIN||this.texClass===a.TEXCLASS.REL)){d.texClass=a.TEXCLASS.ORD}this.prevClass=d.texClass||a.TEXCLASS.ORD;this.prevLevel=d.Get("scriptlevel")}else{this.prevClass=a.TEXCLASS.NONE}if(this.texClass===a.TEXCLASS.BIN&&(this.prevClass===a.TEXCLASS.NONE||this.prevClass===a.TEXCLASS.BIN||this.prevClass===a.TEXCLASS.OP||this.prevClass===a.TEXCLASS.REL||this.prevClass===a.TEXCLASS.OPEN||this.prevClass===a.TEXCLASS.PUNCT)){this.texClass=a.TEXCLASS.ORD}else{if(this.prevClass===a.TEXCLASS.BIN&&(this.texClass===a.TEXCLASS.REL||this.texClass===a.TEXCLASS.CLOSE||this.texClass===a.TEXCLASS.PUNCT)){d.texClass=this.prevClass=a.TEXCLASS.ORD}}return this}});a.mtext=a.mbase.Subclass({type:"mtext",isToken:true,isSpacelike:function(){return true},texClass:a.TEXCLASS.ORD,defaults:{mathvariant:a.INHERIT,mathsize:a.INHERIT,mathbackground:a.INHERIT,mathcolor:a.INHERIT}});a.mspace=a.mbase.Subclass({type:"mspace",isToken:true,isSpacelike:function(){return true},defaults:{mathbackground:a.INHERIT,mathcolor:a.INHERIT,width:"0em",height:"0ex",depth:"0ex",linebreak:a.LINEBREAK.AUTO},hasDimAttr:function(){return(this.hasValue("width")||this.hasValue("height")||this.hasValue("depth"))},hasNewline:function(){return(!this.hasDimAttr()&&this.Get("linebreak")===a.LINEBREAK.NEWLINE)}});a.ms=a.mbase.Subclass({type:"ms",isToken:true,texClass:a.TEXCLASS.ORD,defaults:{mathvariant:a.INHERIT,mathsize:a.INHERIT,mathbackground:a.INHERIT,mathcolor:a.INHERIT,lquote:'"',rquote:'"'}});a.mglyph=a.mbase.Subclass({type:"mglyph",isToken:true,texClass:a.TEXCLASS.ORD,defaults:{mathbackground:a.INHERIT,mathcolor:a.INHERIT,alt:"",src:"",width:a.AUTO,height:a.AUTO,valign:"0em"}});a.mrow=a.mbase.Subclass({type:"mrow",isSpacelike:a.mbase.childrenSpacelike,inferred:false,notParent:false,isEmbellished:function(){var e=false;for(var f=0,d=this.data.length;f<d;f++){if(this.data[f]==null){continue}if(this.data[f].isEmbellished()){if(e){return false}e=true;this.core=f}else{if(!this.data[f].isSpacelike()){return false}}}return e},NonSpaceLength:function(){var f=0;for(var e=0,d=this.data.length;e<d;e++){if(this.data[e]&&!this.data[e].isSpacelike()){f++}}return f},FirstNonSpace:function(){for(var e=0,d=this.data.length;e<d;e++){if(this.data[e]&&!this.data[e].isSpacelike()){return this.data[e]}}return null},LastNonSpace:function(){for(var d=this.data.length-1;d>=0;d--){if(this.data[0]&&!this.data[d].isSpacelike()){return this.data[d]}}return null},Core:function(){if(!(this.isEmbellished())||typeof(this.core)==="undefined"){return this}return this.data[this.core]},CoreMO:function(){if(!(this.isEmbellished())||typeof(this.core)==="undefined"){return this}return this.data[this.core].CoreMO()},toString:function(){if(this.inferred){return"["+this.data.join(",")+"]"}return this.SUPER(arguments).toString.call(this)},setTeXclass:function(f){for(var e=0,d=this.data.length;e<d;e++){if(this.data[e]){f=this.data[e].setTeXclass(f)}}if(this.data[0]){this.updateTeXclass(this.data[0])}return f}});a.mfrac=a.mbase.Subclass({type:"mfrac",num:0,den:1,linebreakContainer:true,texClass:a.TEXCLASS.INNER,isEmbellished:a.mbase.childEmbellished,Core:a.mbase.childCore,CoreMO:a.mbase.childCoreMO,defaults:{mathbackground:a.INHERIT,mathcolor:a.INHERIT,linethickness:a.LINETHICKNESS.MEDIUM,numalign:a.ALIGN.CENTER,denomalign:a.ALIGN.CENTER,bevelled:false},adjustChild_displaystyle:function(d){return false},adjustChild_scriptlevel:function(e){var d=this.Get("scriptlevel");if(!this.Get("displaystyle")||d>0){d++}return d},adjustChild_texprimestyle:function(d){if(d==this.den){return true}return this.Get("texprimestyle")},setTeXclass:a.mbase.setSeparateTeXclasses});a.msqrt=a.mbase.Subclass({type:"msqrt",inferRow:true,linebreakContainer:true,texClass:a.TEXCLASS.ORD,setTeXclass:a.mbase.setSeparateTeXclasses,adjustChild_texprimestyle:function(d){return true}});a.mroot=a.mbase.Subclass({type:"mroot",linebreakContainer:true,texClass:a.TEXCLASS.ORD,adjustChild_displaystyle:function(d){if(d===1){return false}return this.Get("displaystyle")},adjustChild_scriptlevel:function(e){var d=this.Get("scriptlevel");if(e===1){d+=2}return d},adjustChild_texprimestyle:function(d){if(d===0){return true}return this.Get("texprimestyle")},setTeXclass:a.mbase.setSeparateTeXclasses});a.mstyle=a.mbase.Subclass({type:"mstyle",isSpacelike:a.mbase.childrenSpacelike,isEmbellished:a.mbase.childEmbellished,Core:a.mbase.childCore,CoreMO:a.mbase.childCoreMO,inferRow:true,defaults:{scriptlevel:a.INHERIT,displaystyle:a.INHERIT,scriptsizemultiplier:Math.sqrt(1/2),scriptminsize:"8pt",mathbackground:a.INHERIT,mathcolor:a.INHERIT,infixlinebreakstyle:a.LINEBREAKSTYLE.BEFORE,decimalseparator:"."},adjustChild_scriptlevel:function(f){var e=this.scriptlevel;if(e==null){e=this.Get("scriptlevel")}else{if(String(e).match(/^ *[-+]/)){delete this.scriptlevel;var d=this.Get("scriptlevel");this.scriptlevel=e;e=d+parseInt(e)}}return e},inheritFromMe:true,noInherit:{mpadded:{width:true,height:true,depth:true,lspace:true,voffset:true},mtable:{width:true,height:true,depth:true,align:true}},setTeXclass:a.mbase.setChildTeXclass});a.merror=a.mbase.Subclass({type:"merror",inferRow:true,linebreakContainer:true,texClass:a.TEXCLASS.ORD});a.mpadded=a.mbase.Subclass({type:"mpadded",inferRow:true,isSpacelike:a.mbase.childrenSpacelike,isEmbellished:a.mbase.childEmbellished,Core:a.mbase.childCore,CoreMO:a.mbase.childCoreMO,defaults:{mathbackground:a.INHERIT,mathcolor:a.INHERIT,width:"",height:"",depth:"",lspace:0,voffset:0},setTeXclass:a.mbase.setChildTeXclass});a.mphantom=a.mbase.Subclass({type:"mphantom",texClass:a.TEXCLASS.ORD,inferRow:true,isSpacelike:a.mbase.childrenSpacelike,isEmbellished:a.mbase.childEmbellished,Core:a.mbase.childCore,CoreMO:a.mbase.childCoreMO,setTeXclass:a.mbase.setChildTeXclass});a.mfenced=a.mbase.Subclass({type:"mfenced",defaults:{mathbackground:a.INHERIT,mathcolor:a.INHERIT,open:"(",close:")",separators:","},texClass:a.TEXCLASS.OPEN,setTeXclass:function(g){this.getPrevClass(g);var e=this.getValues("open","close","separators");e.open=e.open.replace(/[ \t\n\r]/g,"");e.close=e.close.replace(/[ \t\n\r]/g,"");e.separators=e.separators.replace(/[ \t\n\r]/g,"");if(e.open!==""){this.SetData("open",a.mo(e.open).With({stretchy:true,texClass:a.TEXCLASS.OPEN}));g=this.data.open.setTeXclass(g)}if(e.separators!==""){while(e.separators.length<this.data.length){e.separators+=e.separators.charAt(e.separators.length-1)}}if(this.data[0]){g=this.data[0].setTeXclass(g)}for(var f=1,d=this.data.length;f<d;f++){if(this.data[f]){if(e.separators!==""){this.SetData("sep"+f,a.mo(e.separators.charAt(f-1)));g=this.data["sep"+f].setTeXclass(g)}g=this.data[f].setTeXclass(g)}}if(e.close!==""){this.SetData("close",a.mo(e.close).With({stretchy:true,texClass:a.TEXCLASS.CLOSE}));g=this.data.close.setTeXclass(g)}this.updateTeXclass(this.data.open);return g}});a.menclose=a.mbase.Subclass({type:"menclose",inferRow:true,linebreakContainer:true,defaults:{mathbackground:a.INHERIT,mathcolor:a.INHERIT,notation:a.NOTATION.LONGDIV,texClass:a.TEXCLASS.ORD},setTeXclass:a.mbase.setSeparateTeXclasses});a.msubsup=a.mbase.Subclass({type:"msubsup",base:0,sub:1,sup:2,isEmbellished:a.mbase.childEmbellished,Core:a.mbase.childCore,CoreMO:a.mbase.childCoreMO,defaults:{mathbackground:a.INHERIT,mathcolor:a.INHERIT,subscriptshift:"",superscriptshift:"",texClass:a.AUTO},autoDefault:function(d){if(d==="texClass"){return(this.isEmbellished()?this.CoreMO().Get(d):a.TEXCLASS.ORD)}return 0},adjustChild_displaystyle:function(d){if(d>0){return false}return this.Get("displaystyle")},adjustChild_scriptlevel:function(e){var d=this.Get("scriptlevel");if(e>0){d++}return d},adjustChild_texprimestyle:function(d){if(d===this.sub){return true}return this.Get("texprimestyle")},setTeXclass:a.mbase.setBaseTeXclasses});a.msub=a.msubsup.Subclass({type:"msub"});a.msup=a.msubsup.Subclass({type:"msup",sub:2,sup:1});a.mmultiscripts=a.msubsup.Subclass({type:"mmultiscripts",adjustChild_texprimestyle:function(d){if(d%2===1){return true}return this.Get("texprimestyle")}});a.mprescripts=a.mbase.Subclass({type:"mprescripts"});a.none=a.mbase.Subclass({type:"none"});a.munderover=a.mbase.Subclass({type:"munderover",base:0,under:1,over:2,sub:1,sup:2,ACCENTS:["","accentunder","accent"],linebreakContainer:true,isEmbellished:a.mbase.childEmbellished,Core:a.mbase.childCore,CoreMO:a.mbase.childCoreMO,defaults:{mathbackground:a.INHERIT,mathcolor:a.INHERIT,accent:a.AUTO,accentunder:a.AUTO,align:a.ALIGN.CENTER,texClass:a.AUTO,subscriptshift:"",superscriptshift:""},autoDefault:function(d){if(d==="texClass"){return(this.isEmbellished()?this.CoreMO().Get(d):a.TEXCLASS.ORD)}if(d==="accent"&&this.data[this.over]){return this.data[this.over].CoreMO().Get("accent")}if(d==="accentunder"&&this.data[this.under]){return this.data[this.under].CoreMO().Get("accent")}return false},adjustChild_displaystyle:function(d){if(d>0){return false}return this.Get("displaystyle")},adjustChild_scriptlevel:function(f){var e=this.Get("scriptlevel");var d=(this.data[this.base]&&!this.Get("displaystyle")&&this.data[this.base].CoreMO().Get("movablelimits"));if(f==this.under&&(d||!this.Get("accentunder"))){e++}if(f==this.over&&(d||!this.Get("accent"))){e++}return e},adjustChild_texprimestyle:function(d){if(d===this.base&&this.data[this.over]){return true}return this.Get("texprimestyle")},setTeXclass:a.mbase.setBaseTeXclasses});a.munder=a.munderover.Subclass({type:"munder"});a.mover=a.munderover.Subclass({type:"mover",over:1,under:2,sup:1,sub:2,ACCENTS:["","accent","accentunder"]});a.mtable=a.mbase.Subclass({type:"mtable",defaults:{mathbackground:a.INHERIT,mathcolor:a.INHERIT,align:a.ALIGN.AXIS,rowalign:a.ALIGN.BASELINE,columnalign:a.ALIGN.CENTER,groupalign:"{left}",alignmentscope:true,columnwidth:a.WIDTH.AUTO,width:a.WIDTH.AUTO,rowspacing:"1ex",columnspacing:".8em",rowlines:a.LINES.NONE,columnlines:a.LINES.NONE,frame:a.LINES.NONE,framespacing:"0.4em 0.5ex",equalrows:false,equalcolumns:false,displaystyle:false,side:a.SIDE.RIGHT,minlabelspacing:"0.8em",texClass:a.TEXCLASS.ORD,useHeight:1},inheritFromMe:true,noInherit:{mover:{align:true},munder:{align:true},munderover:{align:true},mtable:{align:true,rowalign:true,columnalign:true,groupalign:true,alignmentscope:true,columnwidth:true,width:true,rowspacing:true,columnspacing:true,rowlines:true,columnlines:true,frame:true,framespacing:true,equalrows:true,equalcolumns:true,side:true,minlabelspacing:true,texClass:true,useHeight:1}},linebreakContainer:true,Append:function(){for(var e=0,d=arguments.length;e<d;e++){if(!((arguments[e] instanceof a.mtr)||(arguments[e] instanceof a.mlabeledtr))){arguments[e]=a.mtd(arguments[e])}}this.SUPER(arguments).Append.apply(this,arguments)},setTeXclass:a.mbase.setSeparateTeXclasses});a.mtr=a.mbase.Subclass({type:"mtr",defaults:{mathbackground:a.INHERIT,mathcolor:a.INHERIT,rowalign:a.INHERIT,columnalign:a.INHERIT,groupalign:a.INHERIT},inheritFromMe:true,noInherit:{mrow:{rowalign:true,columnalign:true,groupalign:true},mtable:{rowalign:true,columnalign:true,groupalign:true}},linebreakContainer:true,Append:function(){for(var e=0,d=arguments.length;e<d;e++){if(!(arguments[e] instanceof a.mtd)){arguments[e]=a.mtd(arguments[e])}}this.SUPER(arguments).Append.apply(this,arguments)},setTeXclass:a.mbase.setSeparateTeXclasses});a.mtd=a.mbase.Subclass({type:"mtd",inferRow:true,linebreakContainer:true,isEmbellished:a.mbase.childEmbellished,Core:a.mbase.childCore,CoreMO:a.mbase.childCoreMO,defaults:{mathbackground:a.INHERIT,mathcolor:a.INHERIT,rowspan:1,columnspan:1,rowalign:a.INHERIT,columnalign:a.INHERIT,groupalign:a.INHERIT},setTeXclass:a.mbase.setSeparateTeXclasses});a.maligngroup=a.mbase.Subclass({type:"malign",isSpacelike:function(){return true},defaults:{mathbackground:a.INHERIT,mathcolor:a.INHERIT,groupalign:a.INHERIT},inheritFromMe:true,noInherit:{mrow:{groupalign:true},mtable:{groupalign:true}}});a.malignmark=a.mbase.Subclass({type:"malignmark",defaults:{mathbackground:a.INHERIT,mathcolor:a.INHERIT,edge:a.SIDE.LEFT},isSpacelike:function(){return true}});a.mlabeledtr=a.mtr.Subclass({type:"mlabeledtr"});a.maction=a.mbase.Subclass({type:"maction",defaults:{mathbackground:a.INHERIT,mathcolor:a.INHERIT,actiontype:a.ACTIONTYPE.TOGGLE,selection:1},selected:function(){return this.data[this.Get("selection")-1]||a.NULL},isEmbellished:function(){return this.selected().isEmbellished()},isSpacelike:function(){return this.selected().isSpacelike()},Core:function(){return this.selected().Core()},CoreMO:function(){return this.selected().CoreMO()},setTeXclass:function(d){if(this.Get("actiontype")===a.ACTIONTYPE.TOOLTIP&&this.data[1]){this.data[1].setTeXclass()}return this.selected().setTeXclass(d)}});a.semantics=a.mbase.Subclass({type:"semantics",notParent:true,isEmbellished:a.mbase.childEmbellished,Core:a.mbase.childCore,CoreMO:a.mbase.childCoreMO,defaults:{definitionURL:null,encoding:null},setTeXclass:a.mbase.setChildTeXclass});a.annotation=a.mbase.Subclass({type:"annotation",isToken:true,linebreakContainer:true,defaults:{definitionURL:null,encoding:null,cd:"mathmlkeys",name:"",src:null}});a["annotation-xml"]=a.mbase.Subclass({type:"annotation-xml",linebreakContainer:true,defaults:{definitionURL:null,encoding:null,cd:"mathmlkeys",name:"",src:null}});a.math=a.mstyle.Subclass({type:"math",defaults:{mathvariant:a.VARIANT.NORMAL,mathsize:a.SIZE.NORMAL,mathcolor:"",mathbackground:a.COLOR.TRANSPARENT,scriptlevel:0,displaystyle:a.AUTO,display:"inline",maxwidth:"",overflow:a.OVERFLOW.LINEBREAK,altimg:"","altimg-width":"","altimg-height":"","altimg-valign":"",alttext:"",cdgroup:"",scriptsizemultiplier:Math.sqrt(1/2),scriptminsize:"8px",infixlinebreakstyle:a.LINEBREAKSTYLE.BEFORE,lineleading:"1ex",indentshift:"auto",indentalign:a.INDENTALIGN.AUTO,indentalignfirst:a.INDENTALIGN.INDENTALIGN,indentshiftfirst:a.INDENTSHIFT.INDENTSHIFT,indentalignlast:a.INDENTALIGN.INDENTALIGN,indentshiftlast:a.INDENTSHIFT.INDENTSHIFT,decimalseparator:".",texprimestyle:false},autoDefault:function(d){if(d==="displaystyle"){return this.Get("display")==="block"}return""},linebreakContainer:true,setTeXclass:a.mbase.setChildTeXclass});a.chars=a.mbase.Subclass({type:"chars",Append:function(){this.data.push.apply(this.data,arguments)},value:function(){return this.data.join("")},toString:function(){return this.data.join("")}});a.entity=a.mbase.Subclass({type:"entity",Append:function(){this.data.push.apply(this.data,arguments)},value:function(){if(this.data[0].substr(0,2)==="#x"){return parseInt(this.data[0].substr(2),16)}else{if(this.data[0].substr(0,1)==="#"){return parseInt(this.data[0].substr(1))}else{return 0}}},toString:function(){var d=this.value();if(d<=65535){return String.fromCharCode(d)}d-=65536;return String.fromCharCode((d>>10)+55296)+String.fromCharCode((d&1023)+56320)}});a.xml=a.mbase.Subclass({type:"xml",Init:function(){this.div=document.createElement("div");return this.SUPER(arguments).Init.apply(this,arguments)},Append:function(){for(var e=0,d=arguments.length;e<d;e++){var f=this.Import(arguments[e]);this.data.push(f);this.div.appendChild(f)}},Import:function(h){if(document.importNode){return document.importNode(h,true)}var e,f,d;if(h.nodeType===1){e=document.createElement(h.nodeName);for(f=0,d=h.attributes.length;f<d;f++){var g=h.attributes[f];if(g.specified&&g.nodeValue!=null&&g.nodeValue!=""){e.setAttribute(g.nodeName,g.nodeValue)}if(g.nodeName==="style"){e.style.cssText=g.nodeValue}}if(h.className){e.className=h.className}}else{if(h.nodeType===3||h.nodeType===4){e=document.createTextNode(h.nodeValue)}else{if(h.nodeType===8){e=document.createComment(h.nodeValue)}else{return document.createTextNode("")}}}for(f=0,d=h.childNodes.length;f<d;f++){e.appendChild(this.Import(h.childNodes[f]))}return e},value:function(){return this.div},toString:function(){return this.div.innerHTML}});a.TeXAtom=a.mbase.Subclass({type:"texatom",inferRow:true,notParent:true,texClass:a.TEXCLASS.ORD,Core:a.mbase.childCore,CoreMO:a.mbase.childCoreMO,isEmbellished:a.mbase.childEmbellished,setTeXclass:function(d){this.data[0].setTeXclass();return this.adjustTeXclass(d)},adjustTeXclass:a.mo.prototype.adjustTeXclass});a.NULL=a.mbase().With({type:"null"});var b=a.TEXCLASS;var c={ORD:[0,0,b.ORD],ORD11:[1,1,b.ORD],ORD21:[2,1,b.ORD],ORD02:[0,2,b.ORD],ORD55:[5,5,b.ORD],OP:[1,2,b.OP,{largeop:true,movablelimits:true,symmetric:true}],OPFIXED:[1,2,b.OP,{largeop:true,movablelimits:true}],INTEGRAL:[0,1,b.OP,{largeop:true,symmetric:true}],INTEGRAL2:[1,2,b.OP,{largeop:true,symmetric:true}],BIN3:[3,3,b.BIN],BIN4:[4,4,b.BIN],BIN01:[0,1,b.BIN],BIN5:[5,5,b.BIN],TALLBIN:[4,4,b.BIN,{stretchy:true}],BINOP:[4,4,b.BIN,{largeop:true,movablelimits:true}],REL:[5,5,b.REL],REL1:[1,1,b.REL,{stretchy:true}],REL4:[4,4,b.REL],RELSTRETCH:[5,5,b.REL,{stretchy:true}],RELACCENT:[5,5,b.REL,{accent:true}],WIDEREL:[5,5,b.REL,{accent:true,stretchy:true}],OPEN:[0,0,b.OPEN,{fence:true,stretchy:true,symmetric:true}],CLOSE:[0,0,b.CLOSE,{fence:true,stretchy:true,symmetric:true}],INNER:[0,0,b.INNER],PUNCT:[0,3,b.PUNCT],ACCENT:[0,0,b.ORD,{accent:true}],WIDEACCENT:[0,0,b.ORD,{accent:true,stretchy:true}]};a.mo.Augment({SPACE:["0em","0.1111em","0.1667em","0.2222em","0.2667em","0.3333em"],RANGES:[[32,127,b.REL,"BasicLatin"],[160,255,b.ORD,"Latin1Supplement"],[256,383,b.ORD],[384,591,b.ORD],[688,767,b.ORD,"SpacingModLetters"],[768,879,b.ORD,"CombDiacritMarks"],[880,1023,b.ORD,"GreekAndCoptic"],[7680,7935,b.ORD],[8192,8303,b.PUNCT,"GeneralPunctuation"],[8304,8351,b.ORD],[8352,8399,b.ORD],[8400,8447,b.ORD,"CombDiactForSymbols"],[8448,8527,b.ORD,"LetterlikeSymbols"],[8528,8591,b.ORD],[8592,8703,b.REL,"Arrows"],[8704,8959,b.BIN,"MathOperators"],[8960,9215,b.ORD,"MiscTechnical"],[9312,9471,b.ORD],[9472,9631,b.ORD],[9632,9727,b.ORD,"GeometricShapes"],[9984,10175,b.ORD,"Dingbats"],[10176,10223,b.ORD,"MiscMathSymbolsA"],[10224,10239,b.REL,"SupplementalArrowsA"],[10496,10623,b.REL,"SupplementalArrowsB"],[10624,10751,b.ORD,"MiscMathSymbolsB"],[10752,11007,b.BIN,"SuppMathOperators"],[11008,11263,b.ORD,"MiscSymbolsAndArrows"],[119808,120831,b.ORD]],OPTABLE:{prefix:{"\u2200":c.ORD21,"\u2202":c.ORD21,"\u2203":c.ORD21,"\u2207":c.ORD21,"\u220F":c.OP,"\u2210":c.OP,"\u2211":c.OP,"\u2212":c.BIN01,"\u2213":c.BIN01,"\u221A":[1,1,b.ORD,{stretchy:true}],"\u2220":c.ORD,"\u222B":c.INTEGRAL,"\u222E":c.INTEGRAL,"\u22C0":c.OP,"\u22C1":c.OP,"\u22C2":c.OP,"\u22C3":c.OP,"\u2308":c.OPEN,"\u230A":c.OPEN,"\u27E8":c.OPEN,"\u27EE":c.OPEN,"\u2A00":c.OP,"\u2A01":c.OP,"\u2A02":c.OP,"\u2A04":c.OP,"\u2A06":c.OP,"\u00AC":c.ORD21,"\u00B1":c.BIN01,"(":c.OPEN,"+":c.BIN01,"-":c.BIN01,"[":c.OPEN,"{":c.OPEN,"|":c.OPEN},postfix:{"!":[1,0,b.CLOSE],"&":c.ORD,"\u2032":c.ORD02,"\u203E":c.WIDEACCENT,"\u2309":c.CLOSE,"\u230B":c.CLOSE,"\u23DE":c.WIDEACCENT,"\u23DF":c.WIDEACCENT,"\u266D":c.ORD02,"\u266E":c.ORD02,"\u266F":c.ORD02,"\u27E9":c.CLOSE,"\u27EF":c.CLOSE,"\u02C6":c.WIDEACCENT,"\u02C7":c.WIDEACCENT,"\u02C9":c.WIDEACCENT,"\u02CA":c.ACCENT,"\u02CB":c.ACCENT,"\u02D8":c.ACCENT,"\u02D9":c.ACCENT,"\u02DC":c.WIDEACCENT,"\u0302":c.WIDEACCENT,"\u00A8":c.ACCENT,"\u00AF":c.WIDEACCENT,")":c.CLOSE,"]":c.CLOSE,"^":c.WIDEACCENT,_:c.WIDEACCENT,"`":c.ACCENT,"|":c.CLOSE,"}":c.CLOSE,"~":c.WIDEACCENT},infix:{"":c.ORD,"%":[3,3,b.ORD],"\u2022":c.BIN4,"\u2026":c.INNER,"\u2044":c.TALLBIN,"\u2061":c.ORD,"\u2062":c.ORD,"\u2063":[0,0,b.ORD,{linebreakstyle:"after",separator:true}],"\u2064":c.ORD,"\u2190":c.WIDEREL,"\u2191":c.RELSTRETCH,"\u2192":c.WIDEREL,"\u2193":c.RELSTRETCH,"\u2194":c.WIDEREL,"\u2195":c.RELSTRETCH,"\u2196":c.RELSTRETCH,"\u2197":c.RELSTRETCH,"\u2198":c.RELSTRETCH,"\u2199":c.RELSTRETCH,"\u21A6":c.WIDEREL,"\u21A9":c.WIDEREL,"\u21AA":c.WIDEREL,"\u21BC":c.WIDEREL,"\u21BD":c.WIDEREL,"\u21C0":c.WIDEREL,"\u21C1":c.WIDEREL,"\u21CC":c.WIDEREL,"\u21D0":c.WIDEREL,"\u21D1":c.RELSTRETCH,"\u21D2":c.WIDEREL,"\u21D3":c.RELSTRETCH,"\u21D4":c.WIDEREL,"\u21D5":c.RELSTRETCH,"\u2208":c.REL,"\u2209":c.REL,"\u220B":c.REL,"\u2212":c.BIN4,"\u2213":c.BIN4,"\u2215":c.TALLBIN,"\u2216":c.BIN4,"\u2217":c.BIN4,"\u2218":c.BIN4,"\u2219":c.BIN4,"\u221D":c.REL,"\u2223":c.REL,"\u2225":c.REL,"\u2227":c.BIN4,"\u2228":c.BIN4,"\u2229":c.BIN4,"\u222A":c.BIN4,"\u223C":c.REL,"\u2240":c.BIN4,"\u2243":c.REL,"\u2245":c.REL,"\u2248":c.REL,"\u224D":c.REL,"\u2250":c.REL,"\u2260":c.REL,"\u2261":c.REL,"\u2264":c.REL,"\u2265":c.REL,"\u226A":c.REL,"\u226B":c.REL,"\u227A":c.REL,"\u227B":c.REL,"\u2282":c.REL,"\u2283":c.REL,"\u2286":c.REL,"\u2287":c.REL,"\u228E":c.BIN4,"\u2291":c.REL,"\u2292":c.REL,"\u2293":c.BIN4,"\u2294":c.BIN4,"\u2295":c.BIN4,"\u2296":c.BIN4,"\u2297":c.BIN4,"\u2298":c.BIN4,"\u2299":c.BIN4,"\u22A2":c.REL,"\u22A3":c.REL,"\u22A4":c.ORD55,"\u22A5":c.REL,"\u22A8":c.REL,"\u22C4":c.BIN4,"\u22C5":c.BIN4,"\u22C6":c.BIN4,"\u22C8":c.REL,"\u22EE":c.ORD55,"\u22EF":c.INNER,"\u22F1":[5,5,b.INNER],"\u25B3":c.BIN4,"\u25B5":c.BIN4,"\u25B9":c.BIN4,"\u25BD":c.BIN4,"\u25BF":c.BIN4,"\u25C3":c.BIN4,"\u2758":c.REL,"\u27F5":c.WIDEREL,"\u27F6":c.WIDEREL,"\u27F7":c.WIDEREL,"\u27F8":c.WIDEREL,"\u27F9":c.WIDEREL,"\u27FA":c.WIDEREL,"\u27FC":c.WIDEREL,"\u2A2F":c.BIN4,"\u2A3F":c.BIN4,"\u2AAF":c.REL,"\u2AB0":c.REL,"\u00B1":c.BIN4,"\u00B7":c.BIN4,"\u00D7":c.BIN4,"\u00F7":c.BIN4,"*":c.BIN3,"+":c.BIN4,",":[0,3,b.PUNCT,{linebreakstyle:"after",separator:true}],"-":c.BIN4,".":[3,3,b.ORD],"/":c.ORD11,":":[1,2,b.REL],";":[0,3,b.PUNCT,{linebreakstyle:"after",separator:true}],"<":c.REL,"=":c.REL,">":c.REL,"?":[1,1,b.CLOSE],"\\":c.ORD,"^":c.ORD11,_:c.ORD11,"|":[2,2,b.ORD,{fence:true,stretchy:true,symmetric:true}],"#":c.ORD,"$":c.ORD,"\u002E":[0,3,b.PUNCT,{separator:true}],"\u02B9":c.ORD,"\u0300":c.ACCENT,"\u0301":c.ACCENT,"\u0303":c.WIDEACCENT,"\u0304":c.ACCENT,"\u0306":c.ACCENT,"\u0307":c.ACCENT,"\u0308":c.ACCENT,"\u030C":c.ACCENT,"\u0332":c.WIDEACCENT,"\u0338":c.REL4,"\u2015":[0,0,b.ORD,{stretchy:true}],"\u2017":[0,0,b.ORD,{stretchy:true}],"\u2020":c.BIN3,"\u2021":c.BIN3,"\u20D7":c.ACCENT,"\u2111":c.ORD,"\u2113":c.ORD,"\u2118":c.ORD,"\u211C":c.ORD,"\u2205":c.ORD,"\u221E":c.ORD,"\u2305":c.BIN3,"\u2306":c.BIN3,"\u2322":c.REL4,"\u2323":c.REL4,"\u2329":c.OPEN,"\u232A":c.CLOSE,"\u23AA":c.ORD,"\u23AF":[0,0,b.ORD,{stretchy:true}],"\u23B0":c.OPEN,"\u23B1":c.CLOSE,"\u2500":c.ORD,"\u25EF":c.BIN3,"\u2660":c.ORD,"\u2661":c.ORD,"\u2662":c.ORD,"\u2663":c.ORD,"\u3008":c.OPEN,"\u3009":c.CLOSE,"\uFE37":c.WIDEACCENT,"\uFE38":c.WIDEACCENT}}},{OPTYPES:c});a.mo.prototype.OPTABLE.infix["^"]=c.WIDEREL;a.mo.prototype.OPTABLE.infix._=c.WIDEREL})(MathJax.ElementJax.mml);MathJax.ElementJax.mml.loadComplete("jax.js"); MathJax.Hub.Register.LoadHook("[MathJax]/jax/element/mml/jax.js",function(){var b="2.2";var a=MathJax.ElementJax.mml;SETTINGS=MathJax.Hub.config.menuSettings;a.mbase.Augment({toMathML:function(k){var g=(this.inferred&&this.parent.inferRow);if(k==null){k=""}var e=this.type,d=this.toMathMLattributes();if(e==="mspace"){return k+"<"+e+d+" />"}var j=[];var h=(this.isToken?"":k+(g?"":" "));for(var f=0,c=this.data.length;f<c;f++){if(this.data[f]){j.push(this.data[f].toMathML(h))}else{if(!this.isToken){j.push(h+"<mrow />")}}}if(this.isToken){return k+"<"+e+d+">"+j.join("")+"</"+e+">"}if(g){return j.join("\n")}if(j.length===0||(j.length===1&&j[0]==="")){return k+"<"+e+d+" />"}return k+"<"+e+d+">\n"+j.join("\n")+"\n"+k+"</"+e+">"},toMathMLattributes:function(){var j=[],g=this.defaults;var c=(this.attrNames||a.copyAttributeNames),l=a.skipAttributes;if(this.type==="math"&&(!this.attr||!this.attr.xmlns)){j.push('xmlns="http://www.w3.org/1998/Math/MathML"')}if(!this.attrNames){if(this.type==="mstyle"){g=a.math.prototype.defaults}for(var d in g){if(!l[d]&&g.hasOwnProperty(d)){var e=(d==="open"||d==="close");if(this[d]!=null&&(e||this[d]!==g[d])){var k=this[d];delete this[d];if(e||this.Get(d)!==k){j.push(d+'="'+this.toMathMLattribute(k)+'"')}this[d]=k}}}}for(var h=0,f=c.length;h<f;h++){if(c[h]==="class"){continue}k=(this.attr||{})[c[h]];if(k==null){k=this[c[h]]}if(k!=null){j.push(c[h]+'="'+this.toMathMLquote(k)+'"')}}this.toMathMLclass(j);if(j.length){return" "+j.join(" ")}else{return""}},toMathMLclass:function(c){var e=[];if(this["class"]){e.push(this["class"])}if(this.isa(a.TeXAtom)&&SETTINGS.texHints){var d=["ORD","OP","BIN","REL","OPEN","CLOSE","PUNCT","INNER","VCENTER"][this.texClass];if(d){e.push("MJX-TeXAtom-"+d)}}if(this.mathvariant&&this.toMathMLvariants[this.mathvariant]){e.push("MJX"+this.mathvariant)}if(this.arrow){e.push("MJX-arrow")}if(this.variantForm){e.push("MJX-variant")}if(e.length){c.unshift('class="'+e.join(" ")+'"')}},toMathMLattribute:function(c){if(typeof(c)==="string"&&c.replace(/ /g,"").match(/^(([-+])?(\d+(\.\d*)?|\.\d+))mu$/)){return RegExp.$2+((1/18)*RegExp.$3).toFixed(3).replace(/\.?0+$/,"")+"em"}else{if(this.toMathMLvariants[c]){return this.toMathMLvariants[c]}}return this.toMathMLquote(c)},toMathMLvariants:{"-tex-caligraphic":a.VARIANT.SCRIPT,"-tex-caligraphic-bold":a.VARIANT.BOLDSCRIPT,"-tex-oldstyle":a.VARIANT.NORMAL,"-tex-oldstyle-bold":a.VARIANT.BOLD,"-tex-mathit":a.VARIANT.ITALIC},toMathMLquote:function(f){f=String(f).split("");for(var g=0,d=f.length;g<d;g++){var k=f[g].charCodeAt(0);if(k<=55295||57344<=k){if(k<32||k>126){f[g]="&#x"+k.toString(16).toUpperCase()+";"}else{var j={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"}[f[g]];if(j){f[g]=j}}}else{if(g+1<d){var h=f[g+1].charCodeAt(0);var e=(((k-55296)<<10)+(h-56320)+65536);f[g]="&#x"+e.toString(16).toUpperCase()+";";f[g+1]="";g++}else{f[g]=""}}}return f.join("")}});a.msubsup.Augment({toMathML:function(h){var e=this.type;if(this.data[this.sup]==null){e="msub"}if(this.data[this.sub]==null){e="msup"}var d=this.toMathMLattributes();delete this.data[0].inferred;var g=[];for(var f=0,c=this.data.length;f<c;f++){if(this.data[f]){g.push(this.data[f].toMathML(h+" "))}}return h+"<"+e+d+">\n"+g.join("\n")+"\n"+h+"</"+e+">"}});a.munderover.Augment({toMathML:function(h){var e=this.type;if(this.data[this.under]==null){e="mover"}if(this.data[this.over]==null){e="munder"}var d=this.toMathMLattributes();delete this.data[0].inferred;var g=[];for(var f=0,c=this.data.length;f<c;f++){if(this.data[f]){g.push(this.data[f].toMathML(h+" "))}}return h+"<"+e+d+">\n"+g.join("\n")+"\n"+h+"</"+e+">"}});a.TeXAtom.Augment({toMathML:function(d){var c=this.toMathMLattributes();if(!c&&this.data[0].data.length===1){return d.substr(2)+this.data[0].toMathML(d)}return d+"<mrow"+c+">\n"+this.data[0].toMathML(d+" ")+"\n"+d+"</mrow>"}});a.chars.Augment({toMathML:function(c){return(c||"")+this.toMathMLquote(this.toString())}});a.entity.Augment({toMathML:function(c){return(c||"")+"&"+this.data[0]+";<!-- "+this.toString()+" -->"}});a.xml.Augment({toMathML:function(c){return(c||"")+this.toString()}});MathJax.Hub.Register.StartupHook("TeX mathchoice Ready",function(){a.TeXmathchoice.Augment({toMathML:function(c){return this.Core().toMathML(c)}})});MathJax.Hub.Startup.signal.Post("toMathML Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/toMathML.js"); (function(c,d){var a;var b=function(e){return MathJax.Localization._.apply(MathJax.Localization,[["MathML",e]].concat([].slice.call(arguments,1)))};c.Parse=MathJax.Object.Subclass({Init:function(e){this.Parse(e)},Parse:function(g){var h;if(typeof g!=="string"){h=g.parentNode}else{h=c.ParseXML(this.preProcessMath.call(this,g));if(h==null){c.Error(["ErrorParsingMathML","Error parsing MathML"])}}var f=h.getElementsByTagName("parsererror")[0];if(f){c.Error(["ParsingError","Error parsing MathML: %1",f.textContent.replace(/This page.*?errors:|XML Parsing Error: |Below is a rendering of the page.*/g,"")])}if(h.childNodes.length!==1){c.Error(["MathMLSingleElement","MathML must be formed by a single element"])}if(h.firstChild.nodeName.toLowerCase()==="html"){var e=h.getElementsByTagName("h1")[0];if(e&&e.textContent==="XML parsing error"&&e.nextSibling){c.Error(["ParsingError","Error parsing MathML: %1",String(e.nextSibling.nodeValue).replace(/fatal parsing error: /,"")])}}if(h.firstChild.nodeName.toLowerCase().replace(/^[a-z]+:/,"")!=="math"){c.Error(["MathMLRootElement","MathML must be formed by a <math> element, not %1","<"+h.firstChild.nodeName+">"])}this.mml=this.MakeMML(h.firstChild)},MakeMML:function(h){var i=String(h.getAttribute("class")||"");var f,g=h.nodeName.toLowerCase().replace(/^[a-z]+:/,"");var e=(i.match(/(^| )MJX-TeXAtom-([^ ]*)/));if(e){f=this.TeXAtom(e[2])}else{if(!(a[g]&&a[g].isa&&a[g].isa(a.mbase))){MathJax.Hub.signal.Post(["MathML Jax - unknown node type",g]);return a.merror(b("UnknownNodeType","Unknown node type: %1",g))}else{f=a[g]()}}this.AddAttributes(f,h);this.CheckClass(f,f["class"]);this.AddChildren(f,h);if(c.config.useMathMLspacing){f.useMMLspacing=8}return f},TeXAtom:function(f){var e=a.TeXAtom().With({texClass:a.TEXCLASS[f]});if(e.texClass===a.TEXCLASS.OP){e.movesupsub=e.movablelimits=true}return e},CheckClass:function(f,h){h=(h||"").split(/ /);var j=[];for(var g=0,e=h.length;g<e;g++){if(h[g].substr(0,4)==="MJX-"){if(h[g]==="MJX-arrow"){f.arrow=true}else{if(h[g]==="MJX-variant"){f.variantForm=true;if(!MathJax.Extension["TeX/AMSsymbols"]){MathJax.Hub.RestartAfter(MathJax.Ajax.Require("[MathJax]/extensions/TeX/AMSsymbols.js"))}}else{if(h[g].substr(0,11)!=="MJX-TeXAtom"){f.mathvariant=h[g].substr(3);if(f.mathvariant==="-tex-caligraphic-bold"||f.mathvariant==="-tex-oldstyle-bold"){if(!MathJax.Extension["TeX/boldsymbol"]){MathJax.Hub.RestartAfter(MathJax.Ajax.Require("[MathJax]/extensions/TeX/boldsymbol.js"))}}}}}}else{j.push(h[g])}}if(j.length){f["class"]=j.join(" ")}else{delete f["class"]}},AddAttributes:function(g,j){g.attr={};g.attrNames=[];for(var h=0,e=j.attributes.length;h<e;h++){var f=j.attributes[h].name;if(f=="xlink:href"){f="href"}if(f.match(/:/)){continue}if(f.match(/^_moz-math-((column|row)(align|line)|font-style)$/)){continue}var k=j.attributes[h].value;k=this.filterAttribute(f,k);if(k!=null){if(k.toLowerCase()==="true"){k=true}else{if(k.toLowerCase()==="false"){k=false}}if(g.defaults[f]!=null||a.copyAttributes[f]){g[f]=k}else{g.attr[f]=k}g.attrNames.push(f)}}},filterAttribute:function(e,f){return f},AddChildren:function(e,g){for(var k=0,j=g.childNodes.length;k<j;k++){var f=g.childNodes[k];if(f.nodeName==="#comment"){continue}if(f.nodeName==="#text"){if(e.isToken&&!e.mmlSelfClosing){var o=f.nodeValue.replace(/&([a-z][a-z0-9]*);/ig,this.replaceEntity);e.Append(a.chars(this.trimSpace(o)))}else{if(f.nodeValue.match(/\S/)){c.Error(["UnexpectedTextNode","Unexpected text node: %1","'"+f.nodeValue+"'"])}}}else{if(e.type==="annotation-xml"){e.Append(a.xml(f))}else{var h=this.MakeMML(f);e.Append(h);if(h.mmlSelfClosing&&h.data.length){e.Append.apply(e,h.data);h.data=[]}}}}if(e.type==="mrow"&&e.data.length>=2){var l=e.data[0],n=e.data[e.data.length-1];if(l.type==="mo"&&l.Get("fence")&&n.type==="mo"&&n.Get("fence")){if(l.data[0]){e.open=l.data.join("")}if(n.data[0]){e.close=n.data.join("")}}}},preProcessMath:function(f){if(f.match(/^<[a-z]+:/i)&&!f.match(/^<[^<>]* xmlns:/)){f=f.replace(/^<([a-z]+)(:math)/i,'<$1$2 xmlns:$1="http://www.w3.org/1998/Math/MathML"')}var e=f.match(/^(<math( ('.*?'|".*?"|[^>])+)>)/i);if(e&&e[2].match(/ (?!xmlns=)[a-z]+=\"http:/i)){f=e[1].replace(/ (?!xmlns=)([a-z]+=(['"])http:.*?\2)/ig," xmlns:$1 $1")+f.substr(e[0].length)}if(f.match(/^<math/i)&&!f.match(/^<[^<>]* xmlns=/)){f=f.replace(/^<(math)/i,'<math xmlns="http://www.w3.org/1998/Math/MathML"')}f=f.replace(/^\s*(?:\/\/)?<!(--)?\[CDATA\[((.|\n)*)(\/\/)?\]\]\1>\s*$/,"$2");return f.replace(/&([a-z][a-z0-9]*);/ig,this.replaceEntity)},trimSpace:function(e){return e.replace(/[\t\n\r]/g," ").replace(/^ +/,"").replace(/ +$/,"").replace(/ +/g," ")},replaceEntity:function(g,f){if(f.match(/^(lt|amp|quot)$/)){return g}if(c.Parse.Entity[f]){return c.Parse.Entity[f]}var h=f.charAt(0).toLowerCase();var e=f.match(/^[a-zA-Z](fr|scr|opf)$/);if(e){h=e[1]}if(!c.Parse.loaded[h]){c.Parse.loaded[h]=true;MathJax.Hub.RestartAfter(MathJax.Ajax.Require(c.entityDir+"/"+h+".js"))}return g}},{loaded:[]});c.Augment({sourceMenuTitle:["OriginalMathML","Original MathML"],prefilterHooks:MathJax.Callback.Hooks(true),postfilterHooks:MathJax.Callback.Hooks(true),Translate:function(e){if(!this.ParseXML){this.ParseXML=this.createParser()}var f,h,i={script:e};if(e.firstChild&&e.firstChild.nodeName.toLowerCase().replace(/^[a-z]+:/,"")==="math"){i.math=e.firstChild;this.prefilterHooks.Execute(i);h=i.math}else{h=MathJax.HTML.getScript(e);if(d.isMSIE){h=h.replace(/(&nbsp;)+$/,"")}i.math=h;this.prefilterHooks.Execute(i);h=i.math}try{f=c.Parse(h).mml}catch(g){if(!g.mathmlError){throw g}f=this.formatError(g,h,e)}i.math=a(f);this.postfilterHooks.Execute(i);return i.math},prefilterMath:function(f,e){return f},prefilterMathML:function(f,e){return f},formatError:function(h,g,e){var f=h.message.replace(/\n.*/,"");MathJax.Hub.signal.Post(["MathML Jax - parse error",f,g,e]);return a.merror(f)},Error:function(e){if(e instanceof Array){e=b.apply(b,e)}throw MathJax.Hub.Insert(Error(e),{mathmlError:true})},parseDOM:function(e){return this.parser.parseFromString(e,"text/xml")},parseMS:function(e){return(this.parser.loadXML(e)?this.parser:null)},parseDIV:function(e){this.div.innerHTML=e.replace(/<([a-z]+)([^>]*)\/>/g,"<$1$2></$1>");return this.div},parseError:function(e){return null},createMSParser:function(){var j=null;var f=["MSXML2.DOMDocument.6.0","MSXML2.DOMDocument.5.0","MSXML2.DOMDocument.4.0","MSXML2.DOMDocument.3.0","MSXML2.DOMDocument.2.0","Microsoft.XMLDOM"];for(var g=0,e=f.length;g<e&&!j;g++){try{j=new ActiveXObject(f[g])}catch(h){}}return j},createParser:function(){if(window.DOMParser){this.parser=new DOMParser();return(this.parseDOM)}else{if(window.ActiveXObject){this.parser=this.createMSParser();if(!this.parser){MathJax.Localization.Try(this.parserCreationError);return(this.parseError)}this.parser.async=false;return(this.parseMS)}}this.div=MathJax.Hub.Insert(document.createElement("div"),{style:{visibility:"hidden",overflow:"hidden",height:"1px",position:"absolute",top:0}});if(!document.body.firstChild){document.body.appendChild(this.div)}else{document.body.insertBefore(this.div,document.body.firstChild)}return(this.parseDIV)},parserCreationError:function(){alert(b("CantCreateXMLParser","MathJax can't create an XML parser for MathML. Check that\nthe 'Script ActiveX controls marked safe for scripting' security\nsetting is enabled (use the Internet Options item in the Tools\nmenu, and select the Security panel, then press the Custom Level\nbutton to check this).\n\nMathML equations will not be able to be processed by MathJax."))},Startup:function(){a=MathJax.ElementJax.mml;a.mspace.Augment({mmlSelfClosing:true});a.none.Augment({mmlSelfClosing:true});a.mprescripts.Augment({mmlSelfClosing:true})}});c.prefilterHooks.Add(function(e){e.math=(typeof(e.math)==="string"?c.prefilterMath(e.math,e.script):c.prefilterMathML(e.math,e.script))});c.Parse.Entity={ApplyFunction:"\u2061",Backslash:"\u2216",Because:"\u2235",Breve:"\u02D8",Cap:"\u22D2",CenterDot:"\u00B7",CircleDot:"\u2299",CircleMinus:"\u2296",CirclePlus:"\u2295",CircleTimes:"\u2297",Congruent:"\u2261",ContourIntegral:"\u222E",Coproduct:"\u2210",Cross:"\u2A2F",Cup:"\u22D3",CupCap:"\u224D",Dagger:"\u2021",Del:"\u2207",Delta:"\u0394",Diamond:"\u22C4",DifferentialD:"\u2146",DotEqual:"\u2250",DoubleDot:"\u00A8",DoubleRightTee:"\u22A8",DoubleVerticalBar:"\u2225",DownArrow:"\u2193",DownLeftVector:"\u21BD",DownRightVector:"\u21C1",DownTee:"\u22A4",Downarrow:"\u21D3",Element:"\u2208",EqualTilde:"\u2242",Equilibrium:"\u21CC",Exists:"\u2203",ExponentialE:"\u2147",FilledVerySmallSquare:"\u25AA",ForAll:"\u2200",Gamma:"\u0393",Gg:"\u22D9",GreaterEqual:"\u2265",GreaterEqualLess:"\u22DB",GreaterFullEqual:"\u2267",GreaterLess:"\u2277",GreaterSlantEqual:"\u2A7E",GreaterTilde:"\u2273",Hacek:"\u02C7",Hat:"\u005E",HumpDownHump:"\u224E",HumpEqual:"\u224F",Im:"\u2111",ImaginaryI:"\u2148",Integral:"\u222B",Intersection:"\u22C2",InvisibleComma:"\u2063",InvisibleTimes:"\u2062",Lambda:"\u039B",Larr:"\u219E",LeftAngleBracket:"\u27E8",LeftArrow:"\u2190",LeftArrowRightArrow:"\u21C6",LeftCeiling:"\u2308",LeftDownVector:"\u21C3",LeftFloor:"\u230A",LeftRightArrow:"\u2194",LeftTee:"\u22A3",LeftTriangle:"\u22B2",LeftTriangleEqual:"\u22B4",LeftUpVector:"\u21BF",LeftVector:"\u21BC",Leftarrow:"\u21D0",Leftrightarrow:"\u21D4",LessEqualGreater:"\u22DA",LessFullEqual:"\u2266",LessGreater:"\u2276",LessSlantEqual:"\u2A7D",LessTilde:"\u2272",Ll:"\u22D8",Lleftarrow:"\u21DA",LongLeftArrow:"\u27F5",LongLeftRightArrow:"\u27F7",LongRightArrow:"\u27F6",Longleftarrow:"\u27F8",Longleftrightarrow:"\u27FA",Longrightarrow:"\u27F9",Lsh:"\u21B0",MinusPlus:"\u2213",NestedGreaterGreater:"\u226B",NestedLessLess:"\u226A",NotDoubleVerticalBar:"\u2226",NotElement:"\u2209",NotEqual:"\u2260",NotExists:"\u2204",NotGreater:"\u226F",NotGreaterEqual:"\u2271",NotLeftTriangle:"\u22EA",NotLeftTriangleEqual:"\u22EC",NotLess:"\u226E",NotLessEqual:"\u2270",NotPrecedes:"\u2280",NotPrecedesSlantEqual:"\u22E0",NotRightTriangle:"\u22EB",NotRightTriangleEqual:"\u22ED",NotSubsetEqual:"\u2288",NotSucceeds:"\u2281",NotSucceedsSlantEqual:"\u22E1",NotSupersetEqual:"\u2289",NotTilde:"\u2241",NotVerticalBar:"\u2224",Omega:"\u03A9",OverBar:"\u203E",OverBrace:"\u23DE",PartialD:"\u2202",Phi:"\u03A6",Pi:"\u03A0",PlusMinus:"\u00B1",Precedes:"\u227A",PrecedesEqual:"\u2AAF",PrecedesSlantEqual:"\u227C",PrecedesTilde:"\u227E",Product:"\u220F",Proportional:"\u221D",Psi:"\u03A8",Rarr:"\u21A0",Re:"\u211C",ReverseEquilibrium:"\u21CB",RightAngleBracket:"\u27E9",RightArrow:"\u2192",RightArrowLeftArrow:"\u21C4",RightCeiling:"\u2309",RightDownVector:"\u21C2",RightFloor:"\u230B",RightTee:"\u22A2",RightTeeArrow:"\u21A6",RightTriangle:"\u22B3",RightTriangleEqual:"\u22B5",RightUpVector:"\u21BE",RightVector:"\u21C0",Rightarrow:"\u21D2",Rrightarrow:"\u21DB",Rsh:"\u21B1",Sigma:"\u03A3",SmallCircle:"\u2218",Sqrt:"\u221A",Square:"\u25A1",SquareIntersection:"\u2293",SquareSubset:"\u228F",SquareSubsetEqual:"\u2291",SquareSuperset:"\u2290",SquareSupersetEqual:"\u2292",SquareUnion:"\u2294",Star:"\u22C6",Subset:"\u22D0",SubsetEqual:"\u2286",Succeeds:"\u227B",SucceedsEqual:"\u2AB0",SucceedsSlantEqual:"\u227D",SucceedsTilde:"\u227F",SuchThat:"\u220B",Sum:"\u2211",Superset:"\u2283",SupersetEqual:"\u2287",Supset:"\u22D1",Therefore:"\u2234",Theta:"\u0398",Tilde:"\u223C",TildeEqual:"\u2243",TildeFullEqual:"\u2245",TildeTilde:"\u2248",UnderBar:"\u005F",UnderBrace:"\u23DF",Union:"\u22C3",UnionPlus:"\u228E",UpArrow:"\u2191",UpDownArrow:"\u2195",UpTee:"\u22A5",Uparrow:"\u21D1",Updownarrow:"\u21D5",Upsilon:"\u03A5",Vdash:"\u22A9",Vee:"\u22C1",VerticalBar:"\u2223",VerticalTilde:"\u2240",Vvdash:"\u22AA",Wedge:"\u22C0",Xi:"\u039E",acute:"\u00B4",aleph:"\u2135",alpha:"\u03B1",amalg:"\u2A3F",and:"\u2227",ang:"\u2220",angmsd:"\u2221",angsph:"\u2222",ape:"\u224A",backprime:"\u2035",backsim:"\u223D",backsimeq:"\u22CD",beta:"\u03B2",beth:"\u2136",between:"\u226C",bigcirc:"\u25EF",bigodot:"\u2A00",bigoplus:"\u2A01",bigotimes:"\u2A02",bigsqcup:"\u2A06",bigstar:"\u2605",bigtriangledown:"\u25BD",bigtriangleup:"\u25B3",biguplus:"\u2A04",blacklozenge:"\u29EB",blacktriangle:"\u25B4",blacktriangledown:"\u25BE",blacktriangleleft:"\u25C2",bowtie:"\u22C8",boxdl:"\u2510",boxdr:"\u250C",boxminus:"\u229F",boxplus:"\u229E",boxtimes:"\u22A0",boxul:"\u2518",boxur:"\u2514",bsol:"\u005C",bull:"\u2022",cap:"\u2229",check:"\u2713",chi:"\u03C7",circ:"\u02C6",circeq:"\u2257",circlearrowleft:"\u21BA",circlearrowright:"\u21BB",circledR:"\u00AE",circledS:"\u24C8",circledast:"\u229B",circledcirc:"\u229A",circleddash:"\u229D",clubs:"\u2663",colon:"\u003A",comp:"\u2201",ctdot:"\u22EF",cuepr:"\u22DE",cuesc:"\u22DF",cularr:"\u21B6",cup:"\u222A",curarr:"\u21B7",curlyvee:"\u22CE",curlywedge:"\u22CF",dagger:"\u2020",daleth:"\u2138",ddarr:"\u21CA",deg:"\u00B0",delta:"\u03B4",digamma:"\u03DD",div:"\u00F7",divideontimes:"\u22C7",dot:"\u02D9",doteqdot:"\u2251",dotplus:"\u2214",dotsquare:"\u22A1",dtdot:"\u22F1",ecir:"\u2256",efDot:"\u2252",egs:"\u2A96",ell:"\u2113",els:"\u2A95",empty:"\u2205",epsi:"\u03B5",epsiv:"\u03F5",erDot:"\u2253",eta:"\u03B7",eth:"\u00F0",flat:"\u266D",fork:"\u22D4",frown:"\u2322",gEl:"\u2A8C",gamma:"\u03B3",gap:"\u2A86",gimel:"\u2137",gnE:"\u2269",gnap:"\u2A8A",gne:"\u2A88",gnsim:"\u22E7",gt:"\u003E",gtdot:"\u22D7",harrw:"\u21AD",hbar:"\u210F",hellip:"\u2026",hookleftarrow:"\u21A9",hookrightarrow:"\u21AA",imath:"\u0131",infin:"\u221E",intcal:"\u22BA",iota:"\u03B9",jmath:"\u0237",kappa:"\u03BA",kappav:"\u03F0",lEg:"\u2A8B",lambda:"\u03BB",lap:"\u2A85",larrlp:"\u21AB",larrtl:"\u21A2",lbrace:"\u007B",lbrack:"\u005B",le:"\u2264",leftleftarrows:"\u21C7",leftthreetimes:"\u22CB",lessdot:"\u22D6",lmoust:"\u23B0",lnE:"\u2268",lnap:"\u2A89",lne:"\u2A87",lnsim:"\u22E6",longmapsto:"\u27FC",looparrowright:"\u21AC",lowast:"\u2217",loz:"\u25CA",lt:"\u003C",ltimes:"\u22C9",ltri:"\u25C3",macr:"\u00AF",malt:"\u2720",mho:"\u2127",mu:"\u03BC",multimap:"\u22B8",nLeftarrow:"\u21CD",nLeftrightarrow:"\u21CE",nRightarrow:"\u21CF",nVDash:"\u22AF",nVdash:"\u22AE",natur:"\u266E",nearr:"\u2197",nharr:"\u21AE",nlarr:"\u219A",not:"\u00AC",nrarr:"\u219B",nu:"\u03BD",nvDash:"\u22AD",nvdash:"\u22AC",nwarr:"\u2196",omega:"\u03C9",omicron:"\u03BF",or:"\u2228",osol:"\u2298",period:"\u002E",phi:"\u03C6",phiv:"\u03D5",pi:"\u03C0",piv:"\u03D6",prap:"\u2AB7",precnapprox:"\u2AB9",precneqq:"\u2AB5",precnsim:"\u22E8",prime:"\u2032",psi:"\u03C8",rarrtl:"\u21A3",rbrace:"\u007D",rbrack:"\u005D",rho:"\u03C1",rhov:"\u03F1",rightrightarrows:"\u21C9",rightthreetimes:"\u22CC",ring:"\u02DA",rmoust:"\u23B1",rtimes:"\u22CA",rtri:"\u25B9",scap:"\u2AB8",scnE:"\u2AB6",scnap:"\u2ABA",scnsim:"\u22E9",sdot:"\u22C5",searr:"\u2198",sect:"\u00A7",sharp:"\u266F",sigma:"\u03C3",sigmav:"\u03C2",simne:"\u2246",smile:"\u2323",spades:"\u2660",sub:"\u2282",subE:"\u2AC5",subnE:"\u2ACB",subne:"\u228A",supE:"\u2AC6",supnE:"\u2ACC",supne:"\u228B",swarr:"\u2199",tau:"\u03C4",theta:"\u03B8",thetav:"\u03D1",tilde:"\u02DC",times:"\u00D7",triangle:"\u25B5",triangleq:"\u225C",upsi:"\u03C5",upuparrows:"\u21C8",veebar:"\u22BB",vellip:"\u22EE",weierp:"\u2118",xi:"\u03BE",yen:"\u00A5",zeta:"\u03B6",zigrarr:"\u21DD"};c.loadComplete("jax.js")})(MathJax.InputJax.MathML,MathJax.Hub.Browser); MathJax.Ajax.loadComplete("[MathJax]/config/MML_HTMLorMML.js");
idleberg/cdnjs
ajax/libs/mathjax/2.2/config/MML_HTMLorMML.js
JavaScript
mit
109,052
<?php /* * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ namespace Doctrine\ORM\Proxy; use Doctrine\Common\Proxy\Proxy as BaseProxy; /** * Interface for proxy classes. * * @author Roman Borschel <roman@code-factory.org> * @since 2.0 */ interface Proxy extends BaseProxy { }
chromediaDarl/blog-with-login
vendor/doctrine/orm/lib/Doctrine/ORM/Proxy/Proxy.php
PHP
mit
1,213
var baseFlatten = require('../internal/baseFlatten'), bindCallback = require('../internal/bindCallback'), pickByArray = require('../internal/pickByArray'), pickByCallback = require('../internal/pickByCallback'), restParam = require('../function/restParam'); /** * Creates an object composed of the picked `object` properties. Property * names may be specified as individual arguments or as arrays of property * names. If `predicate` is provided it is invoked for each property of `object` * picking the properties `predicate` returns truthy for. The predicate is * bound to `thisArg` and invoked with three arguments: (value, key, object). * * @static * @memberOf _ * @category Object * @param {Object} object The source object. * @param {Function|...(string|string[])} [predicate] The function invoked per * iteration or property names to pick, specified as individual property * names or arrays of property names. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {Object} Returns the new object. * @example * * var object = { 'user': 'fred', 'age': 40 }; * * _.pick(object, 'user'); * // => { 'user': 'fred' } * * _.pick(object, _.isString); * // => { 'user': 'fred' } */ var pick = restParam(function(object, props) { if (object == null) { return {}; } return typeof props[0] == 'function' ? pickByCallback(object, bindCallback(props[0], props[1], 3)) : pickByArray(object, baseFlatten(props)); }); module.exports = pick;
Cameron-Burkholder/rose-framework
node_modules/jshint/node_modules/lodash/object/pick.js
JavaScript
mit
1,508
YUI.add('anim-easing', function (Y, NAME) { /* TERMS OF USE - EASING EQUATIONS Open source under the BSD License. Copyright 2001 Robert Penner All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * The easing module provides methods for customizing * how an animation behaves during each run. * @class Easing * @module anim * @submodule anim-easing */ var Easing = { /** * Uniform speed between points. * @for Easing * @method easeNone * @param {Number} t Time value used to compute current value * @param {Number} b Starting value * @param {Number} c Delta between start and end values * @param {Number} d Total length of animation * @return {Number} The computed value for the current animation frame */ easeNone: function (t, b, c, d) { return c*t/d + b; }, /** * Begins slowly and accelerates towards end. (quadratic) * @method easeIn * @param {Number} t Time value used to compute current value * @param {Number} b Starting value * @param {Number} c Delta between start and end values * @param {Number} d Total length of animation * @return {Number} The computed value for the current animation frame */ easeIn: function (t, b, c, d) { return c*(t/=d)*t + b; }, /** * Begins quickly and decelerates towards end. (quadratic) * @method easeOut * @param {Number} t Time value used to compute current value * @param {Number} b Starting value * @param {Number} c Delta between start and end values * @param {Number} d Total length of animation * @return {Number} The computed value for the current animation frame */ easeOut: function (t, b, c, d) { return -c *(t/=d)*(t-2) + b; }, /** * Begins slowly and decelerates towards end. (quadratic) * @method easeBoth * @param {Number} t Time value used to compute current value * @param {Number} b Starting value * @param {Number} c Delta between start and end values * @param {Number} d Total length of animation * @return {Number} The computed value for the current animation frame */ easeBoth: function (t, b, c, d) { if ((t /= d/2) < 1) { return c/2*t*t + b; } return -c/2 * ((--t)*(t-2) - 1) + b; }, /** * Begins slowly and accelerates towards end. (quartic) * @method easeInStrong * @param {Number} t Time value used to compute current value * @param {Number} b Starting value * @param {Number} c Delta between start and end values * @param {Number} d Total length of animation * @return {Number} The computed value for the current animation frame */ easeInStrong: function (t, b, c, d) { return c*(t/=d)*t*t*t + b; }, /** * Begins quickly and decelerates towards end. (quartic) * @method easeOutStrong * @param {Number} t Time value used to compute current value * @param {Number} b Starting value * @param {Number} c Delta between start and end values * @param {Number} d Total length of animation * @return {Number} The computed value for the current animation frame */ easeOutStrong: function (t, b, c, d) { return -c * ((t=t/d-1)*t*t*t - 1) + b; }, /** * Begins slowly and decelerates towards end. (quartic) * @method easeBothStrong * @param {Number} t Time value used to compute current value * @param {Number} b Starting value * @param {Number} c Delta between start and end values * @param {Number} d Total length of animation * @return {Number} The computed value for the current animation frame */ easeBothStrong: function (t, b, c, d) { if ((t /= d/2) < 1) { return c/2*t*t*t*t + b; } return -c/2 * ((t-=2)*t*t*t - 2) + b; }, /** * Snap in elastic effect. * @method elasticIn * @param {Number} t Time value used to compute current value * @param {Number} b Starting value * @param {Number} c Delta between start and end values * @param {Number} d Total length of animation * @param {Number} a Amplitude (optional) * @param {Number} p Period (optional) * @return {Number} The computed value for the current animation frame */ elasticIn: function (t, b, c, d, a, p) { var s; if (t === 0) { return b; } if ( (t /= d) === 1 ) { return b+c; } if (!p) { p = d* 0.3; } if (!a || a < Math.abs(c)) { a = c; s = p/4; } else { s = p/(2*Math.PI) * Math.asin (c/a); } return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; }, /** * Snap out elastic effect. * @method elasticOut * @param {Number} t Time value used to compute current value * @param {Number} b Starting value * @param {Number} c Delta between start and end values * @param {Number} d Total length of animation * @param {Number} a Amplitude (optional) * @param {Number} p Period (optional) * @return {Number} The computed value for the current animation frame */ elasticOut: function (t, b, c, d, a, p) { var s; if (t === 0) { return b; } if ( (t /= d) === 1 ) { return b+c; } if (!p) { p=d * 0.3; } if (!a || a < Math.abs(c)) { a = c; s = p / 4; } else { s = p/(2*Math.PI) * Math.asin (c/a); } return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; }, /** * Snap both elastic effect. * @method elasticBoth * @param {Number} t Time value used to compute current value * @param {Number} b Starting value * @param {Number} c Delta between start and end values * @param {Number} d Total length of animation * @param {Number} a Amplitude (optional) * @param {Number} p Period (optional) * @return {Number} The computed value for the current animation frame */ elasticBoth: function (t, b, c, d, a, p) { var s; if (t === 0) { return b; } if ( (t /= d/2) === 2 ) { return b+c; } if (!p) { p = d*(0.3*1.5); } if ( !a || a < Math.abs(c) ) { a = c; s = p/4; } else { s = p/(2*Math.PI) * Math.asin (c/a); } if (t < 1) { return -0.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; } return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*0.5 + c + b; }, /** * Backtracks slightly, then reverses direction and moves to end. * @method backIn * @param {Number} t Time value used to compute current value * @param {Number} b Starting value * @param {Number} c Delta between start and end values * @param {Number} d Total length of animation * @param {Number} s Overshoot (optional) * @return {Number} The computed value for the current animation frame */ backIn: function (t, b, c, d, s) { if (s === undefined) { s = 1.70158; } if (t === d) { t -= 0.001; } return c*(t/=d)*t*((s+1)*t - s) + b; }, /** * Overshoots end, then reverses and comes back to end. * @method backOut * @param {Number} t Time value used to compute current value * @param {Number} b Starting value * @param {Number} c Delta between start and end values * @param {Number} d Total length of animation * @param {Number} s Overshoot (optional) * @return {Number} The computed value for the current animation frame */ backOut: function (t, b, c, d, s) { if (typeof s === 'undefined') { s = 1.70158; } return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; }, /** * Backtracks slightly, then reverses direction, overshoots end, * then reverses and comes back to end. * @method backBoth * @param {Number} t Time value used to compute current value * @param {Number} b Starting value * @param {Number} c Delta between start and end values * @param {Number} d Total length of animation * @param {Number} s Overshoot (optional) * @return {Number} The computed value for the current animation frame */ backBoth: function (t, b, c, d, s) { if (typeof s === 'undefined') { s = 1.70158; } if ((t /= d/2 ) < 1) { return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; } return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; }, /** * Bounce off of start. * @method bounceIn * @param {Number} t Time value used to compute current value * @param {Number} b Starting value * @param {Number} c Delta between start and end values * @param {Number} d Total length of animation * @return {Number} The computed value for the current animation frame */ bounceIn: function (t, b, c, d) { return c - Y.Easing.bounceOut(d-t, 0, c, d) + b; }, /** * Bounces off end. * @method bounceOut * @param {Number} t Time value used to compute current value * @param {Number} b Starting value * @param {Number} c Delta between start and end values * @param {Number} d Total length of animation * @return {Number} The computed value for the current animation frame */ bounceOut: function (t, b, c, d) { if ((t/=d) < (1/2.75)) { return c*(7.5625*t*t) + b; } else if (t < (2/2.75)) { return c*(7.5625*(t-=(1.5/2.75))*t + 0.75) + b; } else if (t < (2.5/2.75)) { return c*(7.5625*(t-=(2.25/2.75))*t + 0.9375) + b; } return c*(7.5625*(t-=(2.625/2.75))*t + 0.984375) + b; }, /** * Bounces off start and end. * @method bounceBoth * @param {Number} t Time value used to compute current value * @param {Number} b Starting value * @param {Number} c Delta between start and end values * @param {Number} d Total length of animation * @return {Number} The computed value for the current animation frame */ bounceBoth: function (t, b, c, d) { if (t < d/2) { return Y.Easing.bounceIn(t * 2, 0, c, d) * 0.5 + b; } return Y.Easing.bounceOut(t * 2 - d, 0, c, d) * 0.5 + c * 0.5 + b; } }; Y.Easing = Easing; }, '@VERSION@', {"requires": ["anim-base"]});
iskitz/cdnjs
ajax/libs/yui/3.10.3/anim-easing/anim-easing.js
JavaScript
mit
12,231
### ### $Release: 2.7.0 $ ### copyright(c) 2006-2011 kuwata-lab.com all rights reserved. ### module Erubis module Helpers module RailsFormHelper end end end module Erubis::Helpers::RailsFormHelper if ActionPack::VERSION::MAJOR == 1 ### Rails 1.X def pp_template_filename(basename) return "#{RAILS_ROOT}/app/views/#{controller.controller_name}/#{basename}.rhtml" end else ### Rails 2.X def pp_template_filename(basename) fname = "#{RAILS_ROOT}/app/views/#{controller.controller_name}/#{basename}.html.erb" return fname if test(?f, fname) return "#{RAILS_ROOT}/app/views/#{controller.controller_name}/#{basename}.rhtml" end end def pp_render_partial(basename) basename = "_#{basename}" unless basename[0] == ?_ filename = pp_template_filename(basename) preprocessor = _create_preprocessor(File.read(filename)) return preprocessor.evaluate(_preprocessing_context_object()) end def pp_error_on(object_name, method) s = '' s << "<% _stag, _etag = _pp_error_tags(@#{object_name}.errors.on('#{method}')) %>" s << "<%= _stag %>" s << yield(object_name, method) s << "<%= _etag %>" return s end def _pp_error_tags(value) return value ? ['<div class="fieldWithErrors">', '</div>'] : ['', ''] end def _pp_remove_error_div(s) s.sub!(/\A<div class="fieldWithErrors">(.*)<\/div>\z/, '\1') return s end def pp_tag_helper(helper, object_name, method, options={}) if object_name.is_a?(ActionView::Helpers::FormHelper) object_name = object_name.object_name end unless options.key?(:value) || options.key?('value') options['value'] = _?("h @#{object_name}.#{method}") end #$stderr.puts "*** debug: pp_tag_helper(): options=#{options.inspect}" return pp_error_on(object_name, method) { s = __send__(helper, object_name, method, options) _pp_remove_error_div(s) } end def pp_form_tag(url_for_options={}, options={}, *parameters_for_url, &block) return form_tag(url_for_options, options, *parameters_for_url, &block) end #-- #def pp_form_for(object_name, *args, &block) # return form_for(object_name, *args, &block) #end #++ def pp_text_field(object_name, method, options={}) return pp_tag_helper(:text_field, object_name, method, options) end def pp_password_field(object_name, method, options={}) return pp_tag_helper(:password_field, object_name, method, options) end def pp_hidden_field(object_name, method, options={}) return pp_tag_helper(:hidden_field, object_name, method, options) end def pp_file_field(object_name, method, options={}) return pp_tag_helper(:file_field, object_name, method, options) end def pp_text_area(object_name, method, options={}) return pp_tag_helper(:text_area, object_name, method, options) end def pp_check_box(object_name, method, options={}, checked_value="1", unchecked_value="0") s = check_box(object_name, method, options, checked_value, unchecked_value) s.sub!(/\schecked=\"checked\"/, '') s.sub!(/type="checkbox"/, "\\&<%= _pp_check_box_checked?(@#{object_name}.#{method}, #{checked_value.inspect}) ? ' checked=\"checked\"' : '' %>") return pp_error_on(object_name, method) { _pp_remove_error_div(s) } end def _pp_check_box_checked?(value, checked_value) return ActionView::Helpers::InstanceTag::check_box_checked?(value, checked_value) end def pp_radio_button(object_name, method, tag_value, options={}) s = radio_button(object_name, method, tag_value, options) s.sub!(/\schecked=\"checked\"/, '') s.sub!(/type="radio"/, "\\&<%= _pp_radio_button_checked?(@#{object_name}.#{method}, #{tag_value.inspect}) ? ' checked=\"checked\"' : '' %>") return pp_error_on(object_name, method) { _pp_remove_error_div(s) } end def _pp_radio_button_checked?(value, tag_value) return ActionView::Helpers::InstanceTag::radio_button_checked?(value, tag_value) end def _pp_select(object, method, collection, priority_collection, options={}, html_options={}) return pp_error_on(object, method) do s = "" ## start tag s << "<select id=\"#{object}_#{method}\" name=\"#{object}[#{method}]\"" for key, val in html_options: s << " #{key}=\"#{val}\"" end s << ">\n" ## selected table key = options.key?(:value) ? :value : (options.key?('value') ? 'value' : nil) if key.nil? ; selected = "@#{object}.#{method}" elsif (val=options[key]).nil? ; selected = nil elsif val =~ /\A<%=(.*)%>\z/ ; selected = $1 else ; selected = val.inspect end s << "<% _table = {#{selected}=>' selected=\"selected\"'} %>\n" if selected ## <option> tags if options[:include_blank] || options['include_blank'] s << "<option value=\"\"></option>\n" end unless priority_collection.blank? _pp_select_options(s, priority_collection, selected, 'delete') s << "<option value=\"\">-------------</option>\n" end _pp_select_options(s, collection, selected, '[]') ## end tag s << "</select>" s end end def _pp_select_options(s, collection, selected, operator) for item in collection value, text = item.is_a?(Array) ? item : [item, item] if !selected t = '' elsif operator == 'delete' t = "<%= _table.delete(#{value.inspect}) %>" else t = "<%= _table[#{value.inspect}] %>" end s << "<option value=\"#{h value}\"#{t}>#{h text}</option>\n" end end def pp_select(object, method, collection, options={}, html_options={}) return _pp_select(object, method, collection, nil, options, html_options) end def pp_collection_select(object, method, collection, value_method, text_method, options={}, html_options={}) collection2 = collection.collect { |e| [e.__send__(value_method), e.__send__(text_method)] } return _pp_select(object, method, collection2, nil, options, html_options) end def pp_country_select(object, method, priority_countries=nil, options={}, html_options={}) collection = ActionView::Helpers::FormOptionsHelper::COUNTRIES return _pp_select(object, method, collection, priority_countries, options, html_options) end def pp_time_zone_select(object, method, priority_zones=nil, options={}, html_options={}) model = options[:model] || options['model'] || TimeZone collection = model.all.collect { |e| [e.name, e.to_s] } return _pp_select(object, method, collection, priority_zones, options, html_options) end def pp_submit_tag(value="Save changes", options={}) return submit_tag(value, options) end def pp_image_submit_tag(source, options={}) return image_submit_tag(source, options) end end
msaintemarie/msaintemarie.github.io
vendor/cache/ruby/2.6.0/gems/erubis-2.7.0/lib/erubis/helpers/rails_form_helper.rb
Ruby
mit
6,874
#!/usr/bin/env python # Copyright (c) 2012 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Make sure optimization settings are extracted properly. """ import TestGyp import sys if sys.platform == 'win32': test = TestGyp.TestGyp(formats=['ninja']) CHDIR = 'compiler-flags' test.run_gyp('optimizations.gyp', chdir=CHDIR) # It's hard to map flags to output contents in a non-fragile way (especially # handling both 2008/2010), so just verify the correct ninja command line # contents. ninja_file = test.built_file_path('obj/test_opt_off.ninja', chdir=CHDIR) test.must_contain(ninja_file, 'cflags = /Od') ninja_file = test.built_file_path('obj/test_opt_lev_size.ninja', chdir=CHDIR) test.must_contain(ninja_file, 'cflags = /O1') ninja_file = test.built_file_path('obj/test_opt_lev_speed.ninja', chdir=CHDIR) test.must_contain(ninja_file, 'cflags = /O2') ninja_file = test.built_file_path('obj/test_opt_lev_max.ninja', chdir=CHDIR) test.must_contain(ninja_file, 'cflags = /Ox') ninja_file = test.built_file_path('obj/test_opt_unset.ninja', chdir=CHDIR) test.must_not_contain(ninja_file, '/Od') test.must_not_contain(ninja_file, '/O1') test.must_not_contain(ninja_file, '/Ox') # Set by default if none specified. test.must_contain(ninja_file, '/O2') ninja_file = test.built_file_path('obj/test_opt_fpo.ninja', chdir=CHDIR) test.must_contain(ninja_file, '/Oy') test.must_not_contain(ninja_file, '/Oy-') ninja_file = test.built_file_path('obj/test_opt_fpo_off.ninja', chdir=CHDIR) test.must_contain(ninja_file, '/Oy-') ninja_file = test.built_file_path('obj/test_opt_intrinsic.ninja', chdir=CHDIR) test.must_contain(ninja_file, '/Oi') test.must_not_contain(ninja_file, '/Oi-') ninja_file = test.built_file_path('obj/test_opt_intrinsic_off.ninja', chdir=CHDIR) test.must_contain(ninja_file, '/Oi-') ninja_file = test.built_file_path('obj/test_opt_inline_off.ninja', chdir=CHDIR) test.must_contain(ninja_file, '/Ob0') ninja_file = test.built_file_path('obj/test_opt_inline_manual.ninja', chdir=CHDIR) test.must_contain(ninja_file, '/Ob1') ninja_file = test.built_file_path('obj/test_opt_inline_auto.ninja', chdir=CHDIR) test.must_contain(ninja_file, '/Ob2') ninja_file = test.built_file_path('obj/test_opt_neither.ninja', chdir=CHDIR) test.must_not_contain(ninja_file, '/Os') test.must_not_contain(ninja_file, '/Ot') ninja_file = test.built_file_path('obj/test_opt_size.ninja', chdir=CHDIR) test.must_contain(ninja_file, '/Os') ninja_file = test.built_file_path('obj/test_opt_speed.ninja', chdir=CHDIR) test.must_contain(ninja_file, '/Ot') ninja_file = test.built_file_path('obj/test_opt_wpo.ninja', chdir=CHDIR) test.must_contain(ninja_file, '/GL') ninja_file = test.built_file_path('obj/test_opt_sp.ninja', chdir=CHDIR) test.must_contain(ninja_file, '/GF') ninja_file = test.built_file_path('obj/test_opt_sp_off.ninja', chdir=CHDIR) test.must_not_contain(ninja_file, '/GF') ninja_file = test.built_file_path('obj/test_opt_fso.ninja', chdir=CHDIR) test.must_contain(ninja_file, '/GT') ninja_file = test.built_file_path('obj/test_opt_fso_off.ninja', chdir=CHDIR) test.must_not_contain(ninja_file, '/GT') test.pass_test()
junhuac/MQUIC
src/tools/gyp/test/win/gyptest-cl-optimizations.py
Python
mit
3,416
OpenLayers.Strategy.Fixed=OpenLayers.Class(OpenLayers.Strategy,{preload:!1,activate:function(){return OpenLayers.Strategy.prototype.activate.apply(this,arguments)?(this.layer.events.on({refresh:this.load,scope:this}),1==this.layer.visibility||this.preload?this.load():this.layer.events.on({visibilitychanged:this.load,scope:this}),!0):!1},deactivate:function(){var e=OpenLayers.Strategy.prototype.deactivate.call(this);return e&&this.layer.events.un({refresh:this.load,visibilitychanged:this.load,scope:this}),e},load:function(e){var t=this.layer;t.events.triggerEvent("loadstart"),t.protocol.read(OpenLayers.Util.applyDefaults({callback:OpenLayers.Function.bind(this.merge,this,t.map.getProjectionObject()),filter:t.filter},e)),t.events.un({visibilitychanged:this.load,scope:this})},merge:function(e,t){var i=this.layer;i.destroyFeatures();var n=t.features;if(n&&n.length>0){if(!e.equals(i.projection))for(var r,s=0,o=n.length;o>s;++s)r=n[s].geometry,r&&r.transform(i.projection,e);i.addFeatures(n)}i.events.triggerEvent("loadend")},CLASS_NAME:"OpenLayers.Strategy.Fixed"});
julian-maughan/cdnjs
ajax/libs/openlayers/2.12/lib/OpenLayers/Strategy/Fixed.min.js
JavaScript
mit
1,075
function MCTabs(){this.settings=[],this.onChange=tinyMCEPopup.editor.windowManager.createInstance("tinymce.util.Dispatcher")}MCTabs.prototype.init=function(e){this.settings=e},MCTabs.prototype.getParam=function(e,t){var i=null;return i=this.settings[e]===void 0?t:this.settings[e],"true"==i||"false"==i?"true"==i:i},MCTabs.prototype.showTab=function(e){e.className="current",e.setAttribute("aria-selected",!0),e.setAttribute("aria-expanded",!0),e.tabIndex=0},MCTabs.prototype.hideTab=function(e){e.className="",e.setAttribute("aria-selected",!1),e.setAttribute("aria-expanded",!1),e.tabIndex=-1},MCTabs.prototype.showPanel=function(e){e.className="current",e.setAttribute("aria-hidden",!1)},MCTabs.prototype.hidePanel=function(e){e.className="panel",e.setAttribute("aria-hidden",!0)},MCTabs.prototype.getPanelForTab=function(e){return tinyMCEPopup.dom.getAttrib(e,"aria-controls")},MCTabs.prototype.displayTab=function(e,t,i){var n,r,o,s,a,l,c,h=this;if(o=document.getElementById(e),void 0===t&&(t=h.getPanelForTab(o)),n=document.getElementById(t),r=n?n.parentNode:null,s=o?o.parentNode:null,a=h.getParam("selection_class","current"),o&&s){for(l=s.childNodes,c=0;l.length>c;c++)"LI"==l[c].nodeName&&h.hideTab(l[c]);h.showTab(o)}if(n&&r){for(l=r.childNodes,c=0;l.length>c;c++)"DIV"==l[c].nodeName&&h.hidePanel(l[c]);i||o.focus(),h.showPanel(n)}},MCTabs.prototype.getAnchor=function(){var e,t=document.location.href;return-1!=(e=t.lastIndexOf("#"))?t.substring(e+1):""};var mcTabs=new MCTabs;tinyMCEPopup.onInit.add(function(){var e=tinyMCEPopup.getWin().tinymce,t=tinyMCEPopup.dom,i=e.each;i(t.select("div.tabs"),function(n){var r;t.setAttrib(n,"role","tablist");var o=tinyMCEPopup.dom.select("li",n),s=function(e){mcTabs.displayTab(e,mcTabs.getPanelForTab(e)),mcTabs.onChange.dispatch(e)};i(o,function(e){t.setAttrib(e,"role","tab"),t.bind(e,"click",function(){s(e.id)})}),t.bind(t.getRoot(),"keydown",function(t){9===t.keyCode&&t.ctrlKey&&!t.altKey&&(r.moveFocus(t.shiftKey?-1:1),e.dom.Event.cancel(t))}),i(t.select("a",n),function(e){t.setAttrib(e,"tabindex","-1")}),r=tinyMCEPopup.editor.windowManager.createInstance("tinymce.ui.KeyboardNavigation",{root:n,items:o,onAction:s,actOnFocus:!0,enableLeftRight:!0,enableUpDown:!0},tinyMCEPopup.dom)})});
bergie/cdnjs
ajax/libs/tinymce/3.5.8/utils/mctabs.min.js
JavaScript
mit
2,251
var JXG={};(function(){var e,t;for(JXG.countDrawings=0,JXG.countTime=0,JXG.require=function(){},JXG.rendererFiles=[],JXG.rendererFiles.svg="SVGRenderer",JXG.rendererFiles.vml="VMLRenderer",JXG.rendererFiles.canvas="CanvasRenderer",JXG.baseFiles=null,JXG.requirePath="",e=0;document.getElementsByTagName("script").length>e;e++)t=document.getElementsByTagName("script")[e],t.src&&t.src.match(/loadjsxgraphInOneFile\.js(\?.*)?$/)&&(JXG.requirePath=t.src.replace(/loadjsxgraphInOneFile\.js(\?.*)?$/,""));JXG.serverBase=JXG.requirePath+"server/"})(),JXG.extend=function(e,t,n,i){var r,o;n=n||!1,i=i||!1;for(r in t)(!n||n&&t.hasOwnProperty(r))&&(o=i?r.toLowerCase():r,e[o]=t[r])},JXG.shortcut=function(e,t){return function(){return e[t].apply(this,arguments)}},JXG.extend(JXG,{supportsVML:function(){return!!document.namespaces},supportsSVG:function(){return document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")},supportsCanvas:function(){return!!document.createElement("canvas").getContext},isAndroid:function(){return navigator.userAgent.toLowerCase().search("android")>-1},isWebkitAndroid:function(){return this.isAndroid()&&navigator.userAgent.search(" AppleWebKit/")>-1},getReference:function(e,t){return"string"==typeof t&&(JXG.exists(e.objects[t])?t=e.objects[t]:JXG.exists(e.elementsByName[t])?t=e.elementsByName[t]:JXG.exists(e.groups[t])&&(t=e.groups[t])),t},getRef:JXG.shortcut(JXG,"getReference"),isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isFunction:function(e){return"function"==typeof e},isArray:function(e){return null!==e&&"object"==typeof e&&"splice"in e&&"join"in e},isPoint:function(e){return"object"==typeof e?e.elementClass==JXG.OBJECT_CLASS_POINT:!1},exists:function(e){return function(t){return!(t===e||null===t)}}(),str2Bool:function(e){return JXG.exists(e)?"boolean"==typeof e?e:"true"==e.toLowerCase():!0},_board:function(e,t){return JXG.JSXGraph.initBoard(e,t)},createEvalFunction:function(e,t,n){var i,r,o=[];for(i=0;n>i;i++)"string"==typeof t[i]&&(r=JXG.GeonextParser.geonext2JS(t[i],e),r=r.replace(/this\.board\./g,"board."),o[i]=Function("","return "+r+";"));return function(e){var n=t[e];return"string"==typeof n?o[e]():"function"==typeof n?n():"number"==typeof n?n:0}},createFunction:function(e,t,n,i){var r;return(null==i||i)&&JXG.isString(e)?(r=JXG.GeonextParser.geonext2JS(e,t),Function(n,"return "+r+";")):JXG.isFunction(e)?e:JXG.isNumber(e)?function(){return e}:JXG.isString(e)?function(){return e}:null},checkParents:function(e,t,n){var i,r,o,a,s=[],l=t.slice(0),c=function(e,t){var n=(typeof e).toLowerCase();if("number"===n)return t&&(t.type&&t.type===e||t.elementClass&&t.elementClass===e);switch(e.toLowerCase()){case"string":case"object":case"function":case"number":return(typeof t).toLowerCase()===e.toLowerCase();case"array":return JXG.isArray(t)}return!1};for(i=0;n.length>i;i++){for(r=0;n[i].length>r&&t.length>=n[i].length;r++){for(o=0;l.length>o&&!c(n[i][r],l[o]);)o++;l.length>o&&s.push(l.splice(a-o-1,1)[0])}if(!l.length)return s;l=t.slice(0),s=[]}},readOption:function(e,t,n){var i=e.elements[n];return JXG.exists(e[t][n])&&(i=e[t][n]),i},checkAttributes:function(e,t){var n;JXG.exists(e)||(e={});for(n in t)JXG.exists(e[n])||(e[n]=t[n]);return e},copyAttributes:function(e,t){var n,i,r,o,a;for(n=this.deepCopy(t.elements,null,!0),r=arguments.length,4>r&&this.exists(arguments[2])&&this.exists(t.layer[arguments[2]])&&(n.layer=t.layer[arguments[2]]),o=t,a=!0,i=2;r>i;i++){if(!JXG.exists(o[arguments[i]])){a=!1;break}o=o[arguments[i]]}for(a&&(n=this.deepCopy(n,o,!0)),o=e,a=!0,i=3;r>i;i++){if(!JXG.exists(o[arguments[i]])){a=!1;break}o=o[arguments[i]]}return a&&this.extend(n,o,null,!0),n},getDimensions:function(e){var t,n,i,r,o,a,s,l;if(t=document.getElementById(e),!JXG.exists(t))throw Error("\nJSXGraph: HTML container element '"+e+"' not found.");return n=t.style.display,"none"!=n&&null!=n?{width:t.offsetWidth,height:t.offsetHeight}:(i=t.style,r=i.visibility,o=i.position,a=i.display,i.visibility="hidden",i.position="absolute",i.display="block",s=t.clientWidth,l=t.clientHeight,i.display=a,i.position=o,i.visibility=r,{width:s,height:l})},addEvent:function(e,t,n,i){i["x_internal"+t]=function(){return n.apply(i,arguments)},JXG.exists(e.addEventListener)?e.addEventListener(t,i["x_internal"+t],!1):e.attachEvent("on"+t,i["x_internal"+t])},removeEvent:function(e,t,n,i){try{JXG.exists(e.addEventListener)?e.removeEventListener(t,i["x_internal"+t],!1):e.detachEvent("on"+t,i["x_internal"+t])}catch(r){JXG.debug("JSXGraph: Can't remove event listener on"+t+": "+i["x_internal"+t])}},bind:function(e,t){return function(){return e.apply(t,arguments)}},getPosition:function(e,t){var n=0,i=0;return e||(e=window.event),JXG.exists(t)&&(e=e.targetTouches[t]),e.pageX||e.pageY?(n=e.pageX,i=e.pageY):(e.clientX||e.clientY)&&(n=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,i=e.clientY+document.body.scrollTop+document.documentElement.scrollTop),[n,i]},getOffset:function(e){for(var t=e,n=e,i=t.offsetLeft-t.scrollLeft,r=t.offsetTop-t.scrollTop;t=t.offsetParent;)for(i+=t.offsetLeft,r+=t.offsetTop,t.offsetParent&&(i+=t.clientLeft-t.scrollLeft,r+=t.clientTop-t.scrollTop),n=n.parentNode;n!=t;)i+=n.clientLeft-n.scrollLeft,r+=n.clientTop-n.scrollTop,n=n.parentNode;return[i,r]},getStyle:function(e,t){return e.style[t]},keys:function(e,t){var n,i=[];for(n in e)t?e.hasOwnProperty(n)&&i.push(n):i.push(n);return i},escapeHTML:function(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},unescapeHTML:function(e){return e.replace(/<\/?[^>]+>/gi,"").replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">")},clone:function(e){var t={};return t.prototype=e,t},cloneAndCopy:function(e,t){var n,i=function(){};i.prototype=e;for(n in t)i[n]=t[n];return i},deepCopy:function(e,t,n){var i,r,o,a;if(n=n||!1,"object"!=typeof e||null==e)return e;if(this.isArray(e))for(i=[],r=0;e.length>r;r++)o=e[r],i[r]="object"==typeof o?this.deepCopy(o):o;else{i={};for(r in e)a=n?r.toLowerCase():r,o=e[r],i[a]="object"==typeof o?this.deepCopy(o):o;for(r in t)a=n?r.toLowerCase():r,o=t[r],i[a]="object"==typeof o?JXG.isArray(o)||!JXG.exists(i[a])?this.deepCopy(o):this.deepCopy(i[a],o,n):o}return i},toJSON:function(e){var t;if(window.JSON&&window.JSON.stringify)try{return t=JSON.stringify(e)}catch(n){}switch(typeof e){case"object":if(e){var i=[];if(e instanceof Array){for(var r=0;e.length>r;r++)i.push(JXG.toJSON(e[r]));return"["+i.join(",")+"]"}for(var o in e)i.push('"'+o+'":'+JXG.toJSON(e[o]));return"{"+i.join(",")+"}"}return"null";case"string":return'"'+e.replace(/(["'])/g,"\\$1")+'"';case"number":case"boolean":return new String(e)}},capitalize:function(e){return e.charAt(0).toUpperCase()+e.substring(1).toLowerCase()},timedChunk:function(e,t,n,i){var r=e.concat();setTimeout(function(){var o=+new Date;do t.call(n,r.shift());while(r.length>0&&300>+new Date-o);r.length>0?setTimeout(arguments.callee,1):i(e)},1)},trimNumber:function(e){return e=e.replace(/^0+/,""),e=e.replace(/0+$/,""),("."==e[e.length-1]||","==e[e.length-1])&&(e=e.slice(0,-1)),("."==e[0]||","==e[0])&&(e="0"+e),e},trim:function(e){return e=e.replace(/^w+/,""),e=e.replace(/w+$/,"")},evaluate:function(e){return JXG.isFunction(e)?e():e},debug:function(e){var t;for(t=0;arguments.length>t;t++)e=arguments[t],window.console&&console.log?("string"==typeof e&&(e=e.replace(/<\S[^><]*>/g,"")),console.log(e)):document.getElementById("debug")&&(document.getElementById("debug").innerHTML+=e+"<br/>")}}),JXG.addEvent(window,"load",function(){var e,t,n,i,r,o,a,s,l,c,u=document.getElementsByTagName("script");for(t=0;u.length>t;t++)if(e=u[t].getAttribute("type",!1),JXG.exists(e)&&("text/jessiescript"===e.toLowerCase()||"jessiescript"===e.toLowerCase)){if(o=u[t].getAttribute("width",!1)||"500px",a=u[t].getAttribute("height",!1)||"500px",s=u[t].getAttribute("boundingbox",!1)||"-5, 5, 5, -5",s=s.split(","),4!==s.length)s=[-5,5,5,-5];else for(n=0;s.length>n;n++)s[n]=parseFloat(s[n]);l=JXG.str2Bool(u[t].getAttribute("axis",!1)||"false"),c=JXG.str2Bool(u[t].getAttribute("grid",!1)||"false"),i=document.createElement("div"),i.setAttribute("id","jessiescript_autgen_jxg_"+t),i.setAttribute("style","width:"+o+"; height:"+a+"; float:left"),i.setAttribute("class","jxgbox"),document.body.insertBefore(i,u[t]),r=JXG.JSXGraph.initBoard("jessiescript_autgen_jxg_"+t,{boundingbox:s,keepaspectratio:!0,grid:c,axis:l}),r.construct(u[t].innerHTML)}},window),JXG.Math=function(e,t,n){var i=function(e){var t,i;return e.memo?e.memo:(t={},i=Array.prototype.join,e.memo=function(){var r=i.call(arguments);return t[r]!==n?t[r]:t[r]=e.apply(this,arguments)})};return{eps:1e-6,vector:function(e,n){var i,r;for(n=n||0,i=Array(t.ceil(e)),r=0;e>r;r++)i[r]=n;return i},matrix:function(e,n,i){var r,o,a;for(i=i||0,n=n||e,r=Array(t.ceil(e)),o=0;e>o;o++)for(r[o]=Array(t.ceil(n)),a=0;n>a;a++)r[o][a]=i;return r},identity:function(e,i){var r,o;for(i===n&&"number"!=typeof i&&(i=e),r=this.matrix(e,i),o=0;t.min(e,i)>o;o++)r[o][o]=1;return r},frustum:function(t,n,i,r,o,a){var s=e.Math.matrix(4,4);return s[0][0]=2*o/(n-t),s[0][1]=0,s[0][2]=(n+t)/(n-t),s[0][3]=0,s[1][0]=0,s[1][1]=2*o/(r-i),s[1][2]=(r+i)/(r-i),s[1][3]=0,s[2][0]=0,s[2][1]=0,s[2][2]=-(a+o)/(a-o),s[2][3]=-(2*a*o)/(a-o),s[3][0]=0,s[3][1]=0,s[3][2]=-1,s[3][3]=0,s},projection:function(e,n,i,r){var o=i*t.tan(e/2),a=o*n;return this.frustum(-a,a,-o,o,i,r)},matVecMult:function(e,t){var n,i,r,o=e.length,a=t.length,s=[];if(3===a)for(n=0;o>n;n++)s[n]=e[n][0]*t[0]+e[n][1]*t[1]+e[n][2]*t[2];else for(n=0;o>n;n++){for(i=0,r=0;a>r;r++)i+=e[n][r]*t[r];s[n]=i}return s},matMatMult:function(e,t){var n,i,r,o,a=e.length,s=a>0?t[0].length:0,l=t.length,c=this.matrix(a,s);for(n=0;a>n;n++)for(i=0;s>i;i++){for(r=0,o=0;l>o;o++)r+=e[n][o]*t[o][i];c[n][i]=r}return c},transpose:function(e){var t,n,i,r,o;for(r=e.length,o=e.length>0?e[0].length:0,t=this.matrix(o,r),n=0;o>n;n++)for(i=0;r>i;i++)t[n][i]=e[i][n];return t},inverse:function(n){var i,r,o,a,s,l,c,u=n.length,d=[],h=[],p=[];for(i=0;u>i;i++){for(d[i]=[],r=0;u>r;r++)d[i][r]=n[i][r];h[i]=i}for(r=0;u>r;r++){for(s=t.abs(d[r][r]),l=r,i=r+1;u>i;i++)t.abs(d[i][r])>s&&(s=t.abs(d[i][r]),l=i);if(e.Math.eps>=s)return!1;if(l>r){for(o=0;u>o;o++)c=d[r][o],d[r][o]=d[l][o],d[l][o]=c;c=h[r],h[r]=h[l],h[l]=c}for(a=1/d[r][r],i=0;u>i;i++)d[i][r]*=a;for(d[r][r]=a,o=0;u>o;o++)if(o!=r){for(i=0;u>i;i++)i!=r&&(d[i][o]-=d[i][r]*d[r][o]);d[r][o]=-a*d[r][o]}}for(i=0;u>i;i++){for(o=0;u>o;o++)p[h[o]]=d[i][o];for(o=0;u>o;o++)d[i][o]=p[o]}return d},innerProduct:function(e,t,i){var r,o=0;for((i===n||"number"!=typeof i)&&(i=e.length),r=0;i>r;r++)o+=e[r]*t[r];return o},crossProduct:function(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]},factorial:i(function(e){return 0>e?0/0:(e=t.floor(e),0===e||1===e?1:e*arguments.callee(e-1))}),binomial:i(function(e,n){var i,r;if(n>e||0>n)return 0/0;if(n=t.floor(n),e=t.floor(e),0===n||n===e)return 1;for(i=1,r=0;n>r;r++)i*=e-r,i/=r+1;return i}),cosh:function(e){return.5*(t.exp(e)+t.exp(-e))},sinh:function(e){return.5*(t.exp(e)-t.exp(-e))},pow:function(e,n){return 0===e?0===n?1:0:t.floor(n)===n?t.pow(e,n):e>0?t.exp(n*t.log(t.abs(e))):0/0},squampow:function(e,n){var i;if(t.floor(n)===n){for(i=1,0>n&&(e=1/e,n*=-1);0!=n;)1&n&&(i*=e),n>>=1,e*=e;return i}return this.pow(e,n)},normalize:function(e){var n,i,r=2*e[3],o=e[4]/r;return e[5]=o,e[6]=-e[1]/r,e[7]=-e[2]/r,1/0===o||isNaN(o)?(n=t.sqrt(e[1]*e[1]+e[2]*e[2]),e[0]/=n,e[1]/=n,e[2]/=n,e[3]=0,e[4]=1):t.abs(o)>=1?(e[0]=(e[6]*e[6]+e[7]*e[7]-o*o)/(2*o),e[1]=-e[6]/o,e[2]=-e[7]/o,e[3]=1/(2*o),e[4]=1):(i=0>=o?-1:1,e[0]=.5*i*(e[6]*e[6]+e[7]*e[7]-o*o),e[1]=-i*e[6],e[2]=-i*e[7],e[3]=i/2,e[4]=i*o),e},toGL:function(e){var t,n,i;if(t="undefined"!=typeof Float32Array?new Float32Array(16):Array(16),4!==e.length&&4!==e[0].length)return t;for(n=0;4>n;n++)for(i=0;4>i;i++)t[n+4*i]=e[n][i];return t}}}(JXG,Math),JXG.Math.Numerics=function(e,t){var n={rk4:{s:4,A:[[0,0,0,0],[.5,0,0,0],[0,.5,0,0],[0,0,1,0]],b:[1/6,1/3,1/3,1/6],c:[0,.5,.5,1]},heun:{s:2,A:[[0,0],[1,0]],b:[.5,.5],c:[0,1]},euler:{s:1,A:[[0]],b:[1],c:[0]}};return{Gauss:function(n,i){var r,o,a,s,l,c=e.Math.eps,u=n.length>0?n[0].length:0,d=function(e,t){var n=this[e];this[e]=this[t],this[t]=n};if(u!==i.length||u!==n.length)throw Error("JXG.Math.Numerics.Gauss: Dimensions don't match. A must be a square matrix and b must be of the same length as A.");for(r=Array(u),o=i.slice(0,u),a=0;u>a;a++)r[a]=n[a].slice(0,u);for(s=0;u>s;s++){for(a=u-1;a>s;a--)if(t.abs(r[a][s])>c)if(c>t.abs(r[s][s]))d.apply(r,[a,s]),d.apply(o,[a,s]);else for(r[a][s]/=r[s][s],o[a]-=r[a][s]*o[s],l=s+1;u>l;l++)r[a][l]-=r[a][s]*r[s][l];if(c>t.abs(r[s][s]))throw Error("JXG.Math.Numerics.Gauss(): The given matrix seems to be singular.")}return this.backwardSolve(r,o,!0),o},backwardSolve:function(e,t,n){var i,r,o,a,s;for(i=n?t:t.slice(0,t.length),r=e.length,o=e.length>0?e[0].length:0,a=r-1;a>=0;a--){for(s=o-1;s>a;s--)i[a]-=e[a][s]*i[s];i[a]/=e[a][a]}return i},gaussBareiss:function(n){var i,r,o,a,s,l,c,u,d,h=e.Math.eps;if(c=n.length,0>=c)return 0;for(c>n[0].length&&(c=n[0].length),u=Array(c),a=0;c>a;a++)u[a]=n[a].slice(0,c);for(r=1,o=1,i=0;c-1>i;i++){if(l=u[i][i],h>t.abs(l)){for(a=0;c>a&&!(t.abs(u[a][i])>=h);a++);if(a==c)return 0;for(s=i;c>s;s++)d=u[a][s],u[a][s]=u[i][s],u[i][s]=d;o=-o,l=u[i][i]}for(a=i+1;c>a;a++)for(s=i+1;c>s;s++)d=l*u[a][s]-u[a][i]*u[i][s],u[a][s]=d/r;r=l}return o*u[c-1][c-1]},det:function(e){return this.gaussBareiss(e)},Jacobi:function(n){var i,r,o,a,s,l,c,u,d,h=e.Math.eps,p=0,f=n.length,g=[[0,0,0],[0,0,0],[0,0,0]],m=[[0,0,0],[0,0,0],[0,0,0]],v=0;for(i=0;f>i;i++){for(r=0;f>r;r++)g[i][r]=0,m[i][r]=n[i][r],p+=t.abs(m[i][r]);g[i][i]=1}if(1==f)return[m,g];if(0>=p)return[m,g];p/=f*f;do{for(u=0,d=0,r=1;f>r;r++)for(i=0;r>i;i++)if(a=t.abs(m[i][r]),a>d&&(d=a),u+=a,a>=h){for(a=.5*t.atan2(2*m[i][r],m[i][i]-m[r][r]),s=t.sin(a),l=t.cos(a),o=0;f>o;o++)c=m[o][i],m[o][i]=l*c+s*m[o][r],m[o][r]=-s*c+l*m[o][r],c=g[o][i],g[o][i]=l*c+s*g[o][r],g[o][r]=-s*c+l*g[o][r];for(m[i][i]=l*m[i][i]+s*m[r][i],m[r][r]=-s*m[i][r]+l*m[r][r],m[i][r]=0,o=0;f>o;o++)m[i][o]=m[o][i],m[r][o]=m[o][r]}v++}while(t.abs(u)/p>h&&2e3>v);return[m,g]},NewtonCotes:function(e,t,n){var i,r,o,a=0,s=n&&"number"==typeof n.number_of_nodes?n.number_of_nodes:28,l={trapez:!0,simpson:!0,milne:!0},c=n&&n.integration_type&&l.hasOwnProperty(n.integration_type)&&l[n.integration_type]?n.integration_type:"milne",u=(e[1]-e[0])/s;switch(c){case"trapez":for(a=.5*(t(e[0])+t(e[1])),i=e[0],r=0;s-1>r;r++)i+=u,a+=t(i);a*=u;break;case"simpson":if(s%2>0)throw Error("JSXGraph: INT_SIMPSON requires config.number_of_nodes dividable by 2.");for(o=s/2,a=t(e[0])+t(e[1]),i=e[0],r=0;o-1>r;r++)i+=2*u,a+=2*t(i);for(i=e[0]-u,r=0;o>r;r++)i+=2*u,a+=4*t(i);a*=u/3;break;default:if(s%4>0)throw Error("JSXGraph: Error in INT_MILNE: config.number_of_nodes must be a multiple of 4");for(o=.25*s,a=7*(t(e[0])+t(e[1])),i=e[0],r=0;o-1>r;r++)i+=4*u,a+=14*t(i);for(i=e[0]-3*u,r=0;o>r;r++)i+=4*u,a+=32*(t(i)+t(i+2*u));for(i=e[0]-2*u,r=0;o>r;r++)i+=4*u,a+=12*t(i);a*=2*u/45}return a},I:function(e,t){return this.NewtonCotes(e,t,{number_of_nodes:16,integration_type:"milne"})},Newton:function(n,i,r){var o,a=0,s=e.Math.eps,l=n.apply(r,[i]),c=1;for(e.isArray(i)&&(i=i[0]);50>a&&t.abs(l)>s;)o=this.D(n,r)(i),c+=2,t.abs(o)>s?i-=l/o:i+=.2*t.random()-1,l=n.apply(r,[i]),c++,a++;return i},root:function(e,t,n){return this.fzero(e,t,n)},Neville:function(t){var n=[],i=function(i){return function(r,o){var a,s,l,c=e.Math.binomial,u=t.length,d=u-1,h=0,p=0;if(!o)for(l=1,a=0;u>a;a++)n[a]=c(d,a)*l,l*=-1;for(s=r,a=0;u>a;a++){if(0===s)return t[a][i]();l=n[a]/s,s--,h+=t[a][i]()*l,p+=l}return h/p}},r=i("X"),o=i("Y");return[r,o,0,function(){return t.length-1}]},splineDef:function(e,n){var i,r,o,a=t.min(e.length,n.length),s=[],l=[],c=[],u=[],d=[],h=[];if(2===a)return[0,0];for(r=0;a>r;r++)i={X:e[r],Y:n[r]},c.push(i);for(c.sort(function(e,t){return e.X-t.X}),r=0;a>r;r++)e[r]=c[r].X,n[r]=c[r].Y;for(r=0;a-1>r;r++)u.push(e[r+1]-e[r]);for(r=0;a-2>r;r++)d.push(6*(n[r+2]-n[r+1])/u[r+1]-6*(n[r+1]-n[r])/u[r]);for(s.push(2*(u[0]+u[1])),l.push(d[0]),r=0;a-3>r;r++)o=u[r+1]/s[r],s.push(2*(u[r+1]+u[r+2])-o*u[r+1]),l.push(d[r+1]-o*l[r]);for(h[a-3]=l[a-3]/s[a-3],r=a-4;r>=0;r--)h[r]=(l[r]-u[r+1]*h[r+1])/s[r];for(r=a-3;r>=0;r--)h[r+1]=h[r];return h[0]=0,h[a-1]=0,h},splineEval:function(n,i,r,o){var a,s,l,c,u,d,h,p=t.min(i.length,r.length),f=1,g=!1,m=[];for(e.isArray(n)?(f=n.length,g=!0):n=[n],a=0;f>a;a++){if(n[a]<i[0]||i[a]>i[p-1])return 0/0;for(s=1;p>s&&!(n[a]<=i[s]);s++);s--,l=r[s],c=(r[s+1]-r[s])/(i[s+1]-i[s])-(i[s+1]-i[s])/6*(o[s+1]+2*o[s]),u=o[s]/2,d=(o[s+1]-o[s])/(6*(i[s+1]-i[s])),h=n[a]-i[s],m.push(l+(c+(u+d*h)*h)*h)}return g?m:m[0]},generatePolynomialTerm:function(e,t,n,i){var r,o=[];for(r=t;r>=0;r--)o=o.concat(["(",e[r].toPrecision(i),")"]),r>1?o=o.concat(["*",n,"<sup>",r,"<","/sup> + "]):1===r&&(o=o.concat(["*",n," + "]));return o.join("")},lagrangePolynomial:function(e){var t=[],n=function(n,i){var r,o,a,s,l,c,u,d=0,h=0;if(a=e.length,!i){for(r=0;a>r;r++){for(t[r]=1,s=e[r].X(),o=0;a>o;o++)o!=r&&(t[r]*=s-e[o].X());t[r]=1/t[r]}for(c=[],u=0;a>u;u++)c.push([1])}for(r=0;a>r;r++){if(s=e[r].X(),n===s)return e[r].Y();l=t[r]/(n-s),h+=l,d+=l*e[r].Y()}return d/h};return n.getTerm=function(){return""},n},regressionPolynomial:function(n,i,r){var o,a,s,l,c,u,d="";if(e.isPoint(n)&&"function"==typeof n.Value)a=function(){return n.Value()};else if(e.isFunction(n))a=n;else{if(!e.isNumber(n))throw Error("JSXGraph: Can't create regressionPolynomial from degree of type'"+typeof n+"'.");a=function(){return n}}if(3==arguments.length&&e.isArray(i)&&e.isArray(r))c=0;else{if(!(2==arguments.length&&e.isArray(i)&&i.length>0&&e.isPoint(i[0])))throw Error("JSXGraph: Can't create regressionPolynomial. Wrong parameters.");c=1}return u=function(n,u){var h,p,f,g,m,v,b,y,x,w=i.length;if(x=t.floor(a()),!u){if(1===c)for(s=[],l=[],h=0;w>h;h++)s[h]=i[h].X(),l[h]=i[h].Y();if(0===c)for(s=[],l=[],h=0;w>h;h++)e.isFunction(i[h])?s.push(i[h]()):s.push(i[h]),e.isFunction(r[h])?l.push(r[h]()):l.push(r[h]);for(f=[],p=0;w>p;p++)f.push([1]);for(h=1;x>=h;h++)for(p=0;w>p;p++)f[p][h]=f[p][h-1]*s[p];m=l,g=e.Math.transpose(f),v=e.Math.matMatMult(g,f),b=e.Math.matVecMult(g,m),o=e.Math.Numerics.Gauss(v,b),d=e.Math.Numerics.generatePolynomialTerm(o,x,"x",3)}for(y=o[x],h=x-1;h>=0;h--)y=y*n+o[h];return y},u.getTerm=function(){return d},u},bezier:function(e){var n,i=function(i){return function(r,o){var a=3*t.floor(r),s=r%1,l=1-s;return o||(n=t.floor(e.length/3)),0>r?e[0][i]():r>=n?e[e.length-1][i]():isNaN(r)?0/0:l*l*(l*e[a][i]()+3*s*e[a+1][i]())+(3*l*e[a+2][i]()+s*e[a+3][i]())*s*s}};return[i("X"),i("Y"),0,function(){return t.floor(e.length/3)}]},bspline:function(e,n){var i,r=[],o=function(e,t){var n,i=[];for(n=0;e+t+1>n;n++)i[n]=t>n?0:e>=n?n-t+1:e-t+2;return i},a=function(e,t,n,i,r){var o,a,s,l,c,u=[];for(u[r]=e>=t[r]&&t[r+1]>e?1:0,o=2;i>=o;o++)for(a=r-o+1;r>=a;a++)s=r-o+1>=a||0>a?0:u[a],l=a>=r?0:u[a+1],c=t[a+o-1]-t[a],u[a]=0==c?0:(e-t[a])/c*s,c=t[a+o]-t[a+1],0!=c&&(u[a]+=(t[a+o]-e)/c*l);return u},s=function(s){return function(l){var c,u,d,h=e.length,p=h-1,f=n;if(0>=p)return 0/0;if(f>=p+2&&(f=p+1),0>=l)return e[0][s]();if(l>=p-f+2)return e[p][s]();for(i=o(p,f),d=t.floor(l)+f-1,r=a(l,i,p,f,d),c=0,u=d-f+1;d>=u;u++)h>u&&u>=0&&(c+=e[u][s]()*r[u]);return c}};return[s("X"),s("Y"),0,function(){return e.length-1}]},D:function(t,n){var i=1e-5,r=1/(2*i);return 1==arguments.length||arguments.length>1&&!e.exists(arguments[1])?function(e,n){return(t(e+i,n)-t(e-i,n))*r}:function(e,o){return(t.apply(n,[e+i,o])-t.apply(n,[e-i,o]))*r}},riemann:function(e,n,i,r,o){var a,s,l,c,u,d,h=[],p=[],f=0,g=r;if(n=t.floor(n),h[f]=g,p[f]=0,n>0)for(s=(o-r)/n,d=.01*s,a=0;n>a;a++){if("right"===i)l=e(g+s);else if("middle"===i)l=e(g+.5*s);else if("left"===i||"trapezodial"===i)l=e(g);else if("lower"===i)for(l=e(g),c=g+d;g+s>=c;c+=d)u=e(c),l>u&&(l=u);else for(l=e(g),c=g+d;g+s>=c;c+=d)u=e(c),u>l&&(l=u);f++,h[f]=g,p[f]=l,f++,g+=s,"trapezodial"===i&&(l=e(g)),h[f]=g,p[f]=l,f++,h[f]=g,p[f]=0}return[h,p]},riemannsum:function(e,n,i,r,o){var a,s,l,c,u,d,h=0,p=r;if(n=t.floor(n),n>0)for(s=(o-r)/n,d=.01*s,a=0;n>a;a++){if("right"===i)l=e(p+s);else if("middle"===i)l=e(p+.5*s);else if("trapezodial"===i)l=.5*(e(p+s)+e(p));else if("left"===i)l=e(p);else if("lower"===i)for(l=e(p),c=p+d;p+s>=c;c+=d)u=e(c),l>u&&(l=u);else for(l=e(p),c=p+d;p+s>=c;c+=d)u=e(c),u>l&&(l=u);h+=s*l,p+=s}return h},rungeKutta:function(t,i,r,o,a){var s,l,c,u,d,h,p=[],f=[],g=(r[1]-r[0])/o,m=r[0],v=i.length,b=[],y=0;for(e.isString(t)&&(t=n[t]||n.euler),h=t.s,s=0;v>s;s++)p[s]=i[s];for(l=0;o>l;l++){for(b[y]=[],s=0;v>s;s++)b[y][s]=p[s];for(y++,u=[],c=0;h>c;c++){for(s=0;v>s;s++)f[s]=0;for(d=0;c>d;d++)for(s=0;v>s;s++)f[s]+=t.A[c][d]*g*u[d][s];for(s=0;v>s;s++)f[s]+=p[s];u.push(a(m+t.c[c]*g,f))}for(s=0;v>s;s++)f[s]=0;for(d=0;h>d;d++)for(s=0;v>s;s++)f[s]+=t.b[d]*u[d][s];for(s=0;v>s;s++)p[s]=p[s]+g*f[s];m+=g}return b},maxIterationsRoot:80,maxIterationsMinimize:500,fzero:function(n,i,r){var o,a,s,l,c,u,d,h,p,f,g,m,v,b,y,x,w,k,C,_,T=e.Math.eps,E=this.maxIterationsRoot,S=0,A=0,I=T;if(e.isArray(i)){if(2>i.length)throw Error("JXG.Math.Numerics.fzero: length of array x0 has to be at least two.");o=i[0],l=n.apply(r,[o]),A++,a=i[1],c=n.apply(r,[a]),A++}else{for(o=i,l=n.apply(r,[o]),A++,d=0==o?1:o,h=[.9*d,1.1*d,d-1,d+1,.5*d,1.5*d,-d,2*d,-10*d,10*d],f=h.length,p=0;f>p&&(a=h[p],c=n.apply(r,[a]),A++,!(0>=l*c));p++);o>a&&(g=o,o=a,a=g,m=l,l=c,c=m)}if(l*c>0)return e.isArray(i)?this.fminbr(n,[o,a],r):this.Newton(n,o,r);for(s=o,u=l;E>S;){if(v=a-o,t.abs(u)<t.abs(c)&&(o=a,a=s,s=o,l=c,c=u,u=l),b=2*I*t.abs(a)+.5*T,w=.5*(s-a),b>=t.abs(w)&&I>=t.abs(c))return a;t.abs(v)>=b&&t.abs(l)>t.abs(c)&&(C=s-a,o==s?(k=c/l,y=C*k,x=1-k):(x=l/u,k=c/u,_=c/l,y=_*(C*x*(x-k)-(a-o)*(k-1)),x=(x-1)*(k-1)*(_-1)),y>0?x=-x:y=-y,.75*C*x-.5*t.abs(b*x)>y&&t.abs(.5*v*x)>y&&(w=y/x)),b>t.abs(w)&&(w=w>0?b:-b),o=a,l=c,a+=w,c=n.apply(r,[a]),A++,(c>0&&u>0||0>c&&0>u)&&(s=o,u=l),S++}return a},fminbr:function(n,i,r){var o,a,s,l,c,u,d,h,p,f,g,m,v,b,y,x,w=.5*(3-t.sqrt(5)),k=e.Math.eps,C=t.sqrt(e.Math.eps),_=this.maxIterationsMinimize,T=0,E=0;if(!e.isArray(i)||2>i.length)throw Error("JXG.Math.Numerics.fminbr: length of array x0 has to be at least two.");for(o=i[0],a=i[1],l=o+w*(a-o),d=n.apply(r,[l]),E++,s=l,c=l,u=d,h=d;_>T;){if(p=a-o,f=.5*(o+a),g=C*t.abs(s)+k/3,2*g>=t.abs(s-f)+.5*p)return s;m=w*(f>s?a-s:o-s),t.abs(s-c)>=g&&(y=(s-c)*(u-d),b=(s-l)*(u-h),v=(s-l)*b-(s-c)*y,b=2*(b-y),b>0?v=-v:b=-b,t.abs(v)<t.abs(m*b)&&v>b*(o-s+2*g)&&b*(a-s-2*g)>v&&(m=v/b)),g>t.abs(m)&&(m=m>0?g:-g),y=s+m,x=n.apply(r,[y]),E++,u>=x?(s>y?a=s:o=s,l=c,c=s,s=y,d=h,h=u,u=x):(s>y?o=y:a=y,h>=x||c==s?(l=c,c=y,d=h,h=x):(d>=x||l==s||l==c)&&(l=y,d=x)),T++}return s},reuleauxPolygon:function(n,i){var r,o=2*t.PI,a=o/i,s=(i-1)/2,l=0,c=function(c,u){return function(d,h){h||(l=n[0].Dist(n[s]),r=e.Math.Geometry.rad([n[0].X()+1,n[0].Y()],n[0],n[s%i]));var p=(d%o+o)%o,f=t.floor(p/a)%i;return isNaN(f)?f:(p=.5*p+.5*f*a+r,n[f][c]()+l*t[u](p))}};return[c("X","cos"),c("Y","sin"),0,2*t.PI]},RamerDouglasPeuker:function(n,i){var r,o,a,s=[],l=function(e,t,n,i,r){var o=c(e,t,n);o[0]>i?(l(e,t,o[1],i,r),l(e,o[1],n,i,r)):r.push(e[n])},c=function(n,i,r){var o,a,s,l,c,u,d,h,p,f,g,m=0,v=i;if(2>r-i)return[-1,0];if(s=n[i].scrCoords,l=n[r].scrCoords,isNaN(s[1]+s[2]+l[1]+l[2]))return[0/0,r];for(a=i+1;r>a;a++)c=n[a].scrCoords,u=c[1]-s[1],d=c[2]-s[2],h=l[1]-s[1],p=l[2]-s[2],f=h*h+p*p,f>=e.Math.eps?(g=(u*h+d*p)/f,0>g?g=0:g>1&&(g=1),u-=g*h,d-=g*p,o=u*u+d*d):(g=0,o=u*u+d*d),o>m&&(m=o,v=a);return[t.sqrt(m),v]};for(a=n.length,r=0;a>r&&isNaN(n[r].scrCoords[1]+n[r].scrCoords[2]);)r++;for(o=a-1;o>r&&isNaN(n[o].scrCoords[1]+n[o].scrCoords[2]);)o--;return r>o||r==a||(s[0]=n[r],l(n,r,o,i,s)),s}}}(JXG,Math),JXG.Math.Statistics={sum:function(e){var t,n=e.length,i=0;for(t=0;n>t;t++)i+=e[t];return i},prod:function(e){var t,n=e.length,i=1;for(t=0;n>t;t++)i*=e[t];return i},mean:function(e){return e.length>0?this.sum(e)/e.length:0},median:function(e){var t,n;return e.length>0?(t=e.slice(0),t.sort(function(e,t){return e-t}),n=t.length,1==n%2?t[parseInt(.5*n)]:.5*(t[.5*n-1]+t[.5*n])):0},variance:function(e){var t,n,i,r=e.length;if(r>1){for(t=this.mean(e),n=0,i=0;r>i;i++)n+=(e[i]-t)*(e[i]-t);return n/(e.length-1)}return 0},sd:function(e){return Math.sqrt(this.variance(e))},weightedMean:function(e,t){if(e.length!=t.length)throw Error("JSXGraph error (Math.Statistics.weightedMean): Array dimension mismatch.");return e.length>0?this.mean(this.multiply(e,t)):0},max:function(e){return Math.max.apply(this,e)},min:function(e){return Math.min.apply(this,e)},range:function(e){return[this.min(e),this.max(e)]},abs:function(e){var t,n,i;if(JXG.isArray(e))for(n=e.length,i=[],t=0;n>t;t++)i[t]=Math.abs(e[t]);else{if(!JXG.isNumber(e))throw Error("JSXGraph Error (Math.Statistics.abs): Invalid input.");i=Math.abs(e)}return i},add:function(e,t){var n,i,r=[];if(JXG.isArray(e)&&JXG.isNumber(t))for(i=e.length,n=0;i>n;n++)r[n]=e[n]+t;else if(JXG.isNumber(e)&&JXG.isArray(t))for(i=t.length,n=0;i>n;n++)r[n]=e+t[n];else if(JXG.isArray(e)&&JXG.isArray(t))for(i=Math.min(e.length,t.length),n=0;i>n;n++)r[n]=e[n]+t[n];else{if(!JXG.isNumber(e)||!JXG.isNumber(t))throw Error("JSXGraph Error (Math.Statistics.add): Invalid input.");r=e+t}return r},div:function(e,t){var n,i,r=[];if(JXG.isArray(e)&&JXG.isNumber(t))for(i=e.length,n=0;i>n;n++)r[n]=e[n]/t;else if(JXG.isNumber(e)&&JXG.isArray(t))for(i=t.length,n=0;i>n;n++)r[n]=e/t[n];else if(JXG.isArray(e)&&JXG.isArray(t))for(i=Math.min(e.length,t.length),n=0;i>n;n++)r[n]=e[n]/t[n];else{if(!JXG.isNumber(e)||!JXG.isNumber(t))throw Error("JSXGraph Error (Math.Statistics.div): Invalid input.");r=e/t}return r},divide:JXG.shortcut(JXG.Math.Statistics,"div"),mod:function(e,t){var n,i,r=[];if(JXG.isArray(e)&&JXG.isNumber(t))for(i=e.length,n=0;i>n;n++)r[n]=e[n]%t;else if(JXG.isNumber(e)&&JXG.isArray(t))for(i=t.length,n=0;i>n;n++)r[n]=e%t[n];else if(JXG.isArray(e)&&JXG.isArray(t))for(i=Math.min(e.length,t.length),n=0;i>n;n++)r[n]=e[n]%t[n];else{if(!JXG.isNumber(e)||!JXG.isNumber(t))throw Error("JSXGraph Error (Math.Statistics.mod): Invalid input.");r=e%t}return r},multiply:function(e,t){var n,i,r=[];if(JXG.isArray(e)&&JXG.isNumber(t))for(i=e.length,n=0;i>n;n++)r[n]=e[n]*t;else if(JXG.isNumber(e)&&JXG.isArray(t))for(i=t.length,n=0;i>n;n++)r[n]=e*t[n];else if(JXG.isArray(e)&&JXG.isArray(t))for(i=Math.min(e.length,t.length),n=0;i>n;n++)r[n]=e[n]*t[n];else{if(!JXG.isNumber(e)||!JXG.isNumber(t))throw Error("JSXGraph Error (Math.Statistics.mod): Invalid input.");r=e*t}return r},subtract:function(e,t){var n,i,r=[];if(JXG.isArray(e)&&JXG.isNumber(t))for(i=e.length,n=0;i>n;n++)r[n]=e[n]-t;else if(JXG.isNumber(e)&&JXG.isArray(t))for(i=t.length,n=0;i>n;n++)r[n]=e-t[n];else if(JXG.isArray(e)&&JXG.isArray(t))for(i=Math.min(e.length,t.length),n=0;i>n;n++)r[n]=e[n]-t[n];else{if(!JXG.isNumber(e)||!JXG.isNumber(t))throw Error("JSXGraph Error (Math.Statistics.mod): Invalid input.");r=e-t}return r}},JXG.Math.Symbolic=function(e,t){return{generateSymbolicCoordinatesPartial:function(t,n,i,r){var o,a,s,l=function(e){var t;return t="underscore"===r?""+i+"_{"+e+"}":"brace"==r?""+i+"["+e+"]":""+i+e},c=n.ancestors,u=0;t.listOfFreePoints=[],t.listOfDependantPoints=[];for(a in c)if(o=0,e.isPoint(c[a])){for(s in c[a].ancestors)o++;0===o?(c[a].symbolic.x=c[a].coords.usrCoords[1],c[a].symbolic.y=c[a].coords.usrCoords[2],t.listOfFreePoints.push(c[a])):(u++,c[a].symbolic.x=l(u),u++,c[a].symbolic.y=l(u),t.listOfDependantPoints.push(c[a]))}return e.isPoint(n)&&(n.symbolic.x="x",n.symbolic.y="y"),u},clearSymbolicCoordinates:function(t){var n=function(t){var n,i=t&&t.length||0;for(n=0;i>n;n++)e.isPoint(t[n])&&(t[n].symbolic.x="",t[n].symbolic.y="")};n(t.listOfFreePoints),n(t.listOfDependantPoints),delete t.listOfFreePoints,delete t.listOfDependantPoints},generatePolynomials:function(t,n,i){var r,o,a,s,l=n.ancestors,c=[],u=[];i&&this.generateSymbolicCoordinatesPartial(t,n,"u","brace"),l[n.id]=n;for(o in l)if(r=0,c=[],e.isPoint(l[o])){for(a in l[o].ancestors)r++;if(r>0)for(c=l[o].generatePolynomial(),s=0;c.length>s;s++)u.push(c[s])}return i&&this.clearSymbolicCoordinates(t),u},geometricLocusByGroebnerBase:function(n,i){var r,o,a,s,l,c,u,d,h,p,f,g,m,v=this.generateSymbolicCoordinatesPartial(n,i,"u","brace"),b={},y=new e.Coords(e.COORDS_BY_USR,[0,0],n),x=new e.Coords(e.COORDS_BY_USR,[n.canvasWidth,n.canvasHeight],n),w=1,k=0,C=0,_=0,T=function(e,t){var n;for(n=0;t.length>n;n++)if(t[n].id===e)return!0;return!1},E=n.options.locus;if(e.Server.modules.geoloci===t&&e.Server.loadModule("geoloci"),e.Server.modules.geoloci===t)throw Error("JSXGraph: Unable to load JXG.Server module 'geoloci.py'.");if(p=y.usrCoords[1],f=x.usrCoords[1],g=x.usrCoords[2],m=y.usrCoords[2],E.translateToOrigin&&n.listOfFreePoints.length>0){for(s=E.toOrigin!==t&&null!=E.toOrigin&&T(E.toOrigin.id,n.listOfFreePoints)?E.toOrigin:n.listOfFreePoints[0],k=s.symbolic.x,C=s.symbolic.y,c=0;n.listOfFreePoints.length>c;c++)n.listOfFreePoints[c].symbolic.x-=k,n.listOfFreePoints[c].symbolic.y-=C;if(p-=k,f-=k,g-=C,m-=C,E.translateTo10&&n.listOfFreePoints.length>1){for(l=E.to10!==t&&null!=E.to10&&E.to10.id!=E.toOrigin.id&&T(E.to10.id,n.listOfFreePoints)?E.to10:n.listOfFreePoints[0].id==s.id?n.listOfFreePoints[1]:n.listOfFreePoints[0],_=e.Math.Geometry.rad([1,0],[0,0],[l.symbolic.x,l.symbolic.y]),u=Math.cos(-_),d=Math.sin(-_),c=0;n.listOfFreePoints.length>c;c++)h=n.listOfFreePoints[c].symbolic.x,n.listOfFreePoints[c].symbolic.x=u*n.listOfFreePoints[c].symbolic.x-d*n.listOfFreePoints[c].symbolic.y,n.listOfFreePoints[c].symbolic.y=d*h+u*n.listOfFreePoints[c].symbolic.y;if(l.symbolic.y=0,h=p,p=u*p-d*g,g=d*h+u*g,h=f,f=u*f-d*m,m=d*h+u*m,E.stretch&&Math.abs(l.symbolic.x)>e.Math.eps){for(w=l.symbolic.x,c=0;n.listOfFreePoints.length>c;c++)n.listOfFreePoints[c].symbolic.x/=w,n.listOfFreePoints[c].symbolic.y/=w;for(c in n.objects)n.objects[c].elementClass==e.OBJECT_CLASS_CIRCLE&&"pointRadius"==n.objects[c].method&&(b[c]=n.objects[c].radius,n.objects[c].radius/=w);p/=w,f/=w,g/=w,m/=w,l.symbolic.x=1}}for(c=0;n.listOfFreePoints.length>c;c++)h=n.listOfFreePoints[c].symbolic.x,Math.abs(h)<e.Math.eps&&(n.listOfFreePoints[c].symbolic.x=0),Math.abs(h-Math.round(h))<e.Math.eps&&(n.listOfFreePoints[c].symbolic.x=Math.round(h)),h=n.listOfFreePoints[c].symbolic.y,Math.abs(h)<e.Math.eps&&(n.listOfFreePoints[c].symbolic.y=0),Math.abs(h-Math.round(h))<e.Math.eps&&(n.listOfFreePoints[c].symbolic.y=Math.round(h))}r=this.generatePolynomials(n,i),o=r.join(","),this.cbp=function(e){a=e},this.cb=e.bind(this.cbp,this),e.Server.modules.geoloci.lociCoCoA(p,f,g,m,v,o,w,_,k,C,this.cb,!0),this.clearSymbolicCoordinates(n);for(c in b)n.objects[c].radius=b[c];return a}}}(JXG),JXG.Math.Geometry={angle:function(e,t,n){var i,r,o,a,s=[],l=[],c=[];return null==e.coords?(s[0]=e[0],s[1]=e[1]):(s[0]=e.coords.usrCoords[1],s[1]=e.coords.usrCoords[2]),null==t.coords?(l[0]=t[0],l[1]=t[1]):(l[0]=t.coords.usrCoords[1],l[1]=t.coords.usrCoords[2]),null==n.coords?(c[0]=n[0],c[1]=n[1]):(c[0]=n.coords.usrCoords[1],c[1]=n.coords.usrCoords[2]),i=s[0]-l[0],r=s[1]-l[1],o=c[0]-l[0],a=c[1]-l[1],Math.atan2(i*a-r*o,i*o+r*a)},trueAngle:function(e,t,n){return 57.29577951308232*this.rad(e,t,n)},rad:function(e,t,n){var i,r,o,a,s,l,c;return null==e.coords?(i=e[0],r=e[1]):(i=e.coords.usrCoords[1],r=e.coords.usrCoords[2]),null==t.coords?(o=t[0],a=t[1]):(o=t.coords.usrCoords[1],a=t.coords.usrCoords[2]),null==n.coords?(s=n[0],l=n[1]):(s=n.coords.usrCoords[1],l=n.coords.usrCoords[2]),c=Math.atan2(l-a,s-o)-Math.atan2(r-a,i-o),0>c&&(c+=6.283185307179586),c},angleBisector:function(e,t,n,i){var r,o,a,s=e.coords.usrCoords,l=t.coords.usrCoords,c=n.coords.usrCoords,u=s[1]-l[1],d=s[2]-l[2],h=Math.sqrt(u*u+d*d);return JXG.exists(i)||(i=e.board),u/=h,d/=h,r=Math.acos(u),0>d&&(r*=-1),0>r&&(r+=2*Math.PI),u=c[1]-l[1],d=c[2]-l[2],h=Math.sqrt(u*u+d*d),u/=h,d/=h,o=Math.acos(u),0>d&&(o*=-1),0>o&&(o+=2*Math.PI),a=.5*(r+o),r>o&&(a+=Math.PI),u=Math.cos(a)+l[1],d=Math.sin(a)+l[2],new JXG.Coords(JXG.COORDS_BY_USER,[u,d],i) },reflection:function(e,t,n){var i,r,o,a,s,l,c,u=t.coords.usrCoords,d=e.point1.coords.usrCoords,h=e.point2.coords.usrCoords;return JXG.exists(n)||(n=t.board),s=h[1]-d[1],l=h[2]-d[2],i=u[1]-d[1],r=u[2]-d[2],c=(s*r-l*i)/(s*s+l*l),o=u[1]+2*c*l,a=u[2]-2*c*s,new JXG.Coords(JXG.COORDS_BY_USER,[o,a],n)},rotation:function(e,t,n,i){var r,o,a,s,l,c,u=t.coords.usrCoords,d=e.coords.usrCoords;return JXG.exists(i)||(i=t.board),r=u[1]-d[1],o=u[2]-d[2],a=Math.cos(n),s=Math.sin(n),l=r*a-o*s+d[1],c=r*s+o*a+d[2],new JXG.Coords(JXG.COORDS_BY_USER,[l,c],i)},perpendicular:function(e,t,n){var i,r,o,a,s,l,c,u,d=e.point1.coords.usrCoords,h=e.point2.coords.usrCoords,p=t.coords.usrCoords;return JXG.exists(n)||(n=t.board),t==e.point1?(i=d[1]+h[2]-d[2],r=d[2]-h[1]+d[1],o=!0):t==e.point2?(i=h[1]+d[2]-h[2],r=h[2]-d[1]+h[1],o=!1):Math.abs(d[1]-h[1])>JXG.Math.eps&&Math.abs(p[2]-(d[2]-h[2])*(p[1]-d[1])/(d[1]-h[1])-d[2])<JXG.Math.eps||Math.abs(d[1]-h[1])<=JXG.Math.eps&&Math.abs(d[1]-p[1])<JXG.Math.eps?(i=p[1]+h[2]-p[2],r=p[2]-h[1]+p[1],o=!0,Math.abs(i-p[1])<JXG.Math.eps&&Math.abs(r-p[2])<JXG.Math.eps&&(i=p[1]+d[2]-p[2],r=p[2]-d[1]+p[1],o=!1)):(a=d[2]-h[2],s=d[1]-h[1],l=h[1]*a-h[2]*s,c=p[1]*s+p[2]*a,u=a*a+s*s,Math.abs(u)<JXG.Math.eps&&(u=JXG.Math.eps),i=(l*a+c*s)/u,r=(c*a-l*s)/u,o=!0),[new JXG.Coords(JXG.COORDS_BY_USER,[i,r],n),o]},circumcenterMidpoint:function(e,t,n,i){var r,o,a,s,l,c=e.coords.usrCoords,u=t.coords.usrCoords,d=n.coords.usrCoords;return JXG.exists(i)||(i=e.board),r=.5*((c[1]-u[1])*(c[1]+u[1])+(c[2]-u[2])*(c[2]+u[2])),o=.5*((u[1]-d[1])*(u[1]+d[1])+(u[2]-d[2])*(u[2]+d[2])),a=(c[1]-u[1])*(u[2]-d[2])-(u[1]-d[1])*(c[2]-u[2]),Math.abs(a)<JXG.Math.eps&&(a=JXG.Math.eps),s=(r*(u[2]-d[2])-o*(c[2]-u[2]))/a,l=(o*(c[1]-u[1])-r*(u[1]-d[1]))/a,new JXG.Coords(JXG.COORDS_BY_USER,[s,l],i)},distance:function(e,t){var n,i,r=0;if(e.length!=t.length)return 0/0;for(i=e.length,n=0;i>n;n++)r+=(e[n]-t[n])*(e[n]-t[n]);return Math.sqrt(r)},affineDistance:function(e,t){var n;return e.length!=t.length?0/0:(n=this.distance(e,t),n>JXG.Math.eps&&(Math.abs(e[0])<JXG.Math.eps||Math.abs(t[0])<JXG.Math.eps)?1/0:n)},calcStraight:function(e,t,n){var i,r,o,a,s,l,c,u,d,h,p,f;if(s=e.visProp.straightfirst,l=e.visProp.straightlast,Math.abs(t.scrCoords[0])<JXG.Math.eps&&(s=!0),Math.abs(n.scrCoords[0])<JXG.Math.eps&&(l=!0),(s||l)&&(c=[],c[0]=e.stdform[0]-e.stdform[1]*e.board.origin.scrCoords[1]/e.board.unitX+e.stdform[2]*e.board.origin.scrCoords[2]/e.board.unitY,c[1]=e.stdform[1]/e.board.unitX,c[2]=e.stdform[2]/-e.board.unitY,!isNaN(c[0]+c[1]+c[2]))){for(u=[],u[0]=JXG.Math.crossProduct(c,[0,0,1]),u[1]=JXG.Math.crossProduct(c,[0,1,0]),u[2]=JXG.Math.crossProduct(c,[-e.board.canvasHeight,0,1]),u[3]=JXG.Math.crossProduct(c,[-e.board.canvasWidth,1,0]),d=0;4>d;d++)if(Math.abs(u[d][0])>JXG.Math.eps){for(h=2;h>0;h--)u[d][h]/=u[d][0];u[d][0]=1}if(i=!1,r=!1,!s&&t.scrCoords[1]>=0&&t.scrCoords[1]<=e.board.canvasWidth&&t.scrCoords[2]>=0&&t.scrCoords[2]<=e.board.canvasHeight&&(i=!0),!l&&n.scrCoords[1]>=0&&n.scrCoords[1]<=e.board.canvasWidth&&n.scrCoords[2]>=0&&n.scrCoords[2]<=e.board.canvasHeight&&(r=!0),Math.abs(u[1][0])<JXG.Math.eps?(o=u[0],a=u[2]):Math.abs(u[0][0])<JXG.Math.eps?(o=u[1],a=u[3]):0>u[1][2]?(o=u[0],a=u[3][2]>e.board.canvasHeight?u[2]:u[3]):u[1][2]>e.board.canvasHeight?(o=u[2],a=0>u[3][2]?u[0]:u[3]):(o=u[1],a=0>u[3][2]?u[0]:u[3][2]>e.board.canvasHeight?u[2]:u[3]),o=new JXG.Coords(JXG.COORDS_BY_SCREEN,o.slice(1),e.board),a=new JXG.Coords(JXG.COORDS_BY_SCREEN,a.slice(1),e.board),!i&&!r){if(!s&&l&&!this.isSameDirection(t,n,o)&&!this.isSameDirection(t,n,a))return;if(s&&!l&&!this.isSameDirection(n,t,o)&&!this.isSameDirection(n,t,a))return}i?r||(f=this.isSameDir(t,n,o,a)?a:o):r?p=this.isSameDir(t,n,o,a)?o:a:this.isSameDir(t,n,o,a)?(p=o,f=a):(f=o,p=a),p&&t.setCoordinates(JXG.COORDS_BY_USER,p.usrCoords.slice(1)),f&&n.setCoordinates(JXG.COORDS_BY_USER,f.usrCoords.slice(1))}},isSameDir:function(e,t,n,i){var r=t.usrCoords[1]-e.usrCoords[1],o=t.usrCoords[2]-e.usrCoords[2],a=i.usrCoords[1]-n.usrCoords[1],s=i.usrCoords[2]-n.usrCoords[2];return r*a+o*s>=0?!0:!1},isSameDirection:function(e,t,n){var i,r,o,a,s=!1;return i=t.usrCoords[1]-e.usrCoords[1],r=t.usrCoords[2]-e.usrCoords[2],o=n.usrCoords[1]-e.usrCoords[1],a=n.usrCoords[2]-e.usrCoords[2],Math.abs(i)<JXG.Math.eps&&(i=0),Math.abs(r)<JXG.Math.eps&&(r=0),Math.abs(o)<JXG.Math.eps&&(o=0),Math.abs(a)<JXG.Math.eps&&(a=0),i>=0&&o>=0?(r>=0&&a>=0||0>=r&&0>=a)&&(s=!0):0>=i&&0>=o&&(r>=0&&a>=0||0>=r&&0>=a)&&(s=!0),s},intersectLineLine:function(e,t,n){var i,r,o,a,s,l=e.point1.coords.usrCoords,c=e.point2.coords.usrCoords,u=t.point1.coords.usrCoords,d=t.point2.coords.usrCoords;return JXG.exists(n)||(n=e.board),i=l[1]*c[2]-l[2]*c[1],r=u[1]*d[2]-u[2]*d[1],o=(c[2]-l[2])*(u[1]-d[1])-(l[1]-c[1])*(d[2]-u[2]),Math.abs(o)<JXG.Math.eps&&(o=JXG.Math.eps),a=(i*(u[1]-d[1])-r*(l[1]-c[1]))/o,s=(r*(c[2]-l[2])-i*(d[2]-u[2]))/o,new JXG.Coords(JXG.COORDS_BY_USER,[a,s],n)},intersectCircleLine:function(e,t,n){var i,r,o,a,s,l,c,u,d,h,p,f,g,m,v,b,y,x,w,k=t.point1.coords.usrCoords,C=t.point2.coords.usrCoords,_=e.midpoint.coords.usrCoords;return JXG.exists(n)||(n=t.board),i=t.point1.Dist(t.point2),i>0?(r=e.midpoint.Dist(t.point1),o=e.midpoint.Dist(t.point2),a=(r*r+i*i-o*o)/(2*i),s=r*r-a*a,s=0>s?0:s,l=Math.sqrt(s),c=e.Radius(),u=Math.sqrt(c*c-l*l),d=C[1]-k[1],h=C[2]-k[2],p=_[1]+l/i*h,f=_[2]-l/i*d,r=C[1]*h-C[2]*d,o=p*d+f*h,g=h*h+d*d,Math.abs(g)<JXG.Math.eps&&(g=JXG.Math.eps),m=(r*h+o*d)/g,v=(o*h-r*d)/g,b=u/i,y=new JXG.Coords(JXG.COORDS_BY_USER,[m+b*d,v+b*h],n),x=new JXG.Coords(JXG.COORDS_BY_USER,[m-b*d,v-b*h],n),w=e.midpoint.coords.distance(JXG.COORDS_BY_USER,y),w-1>c||isNaN(w)?[0]:[2,y,x]):[0]},intersectCircleCircle:function(e,t,n){var i,r,o,a,s,l,c,u={},d=e.Radius(),h=t.Radius(),p=e.midpoint.coords.usrCoords,f=t.midpoint.coords.usrCoords;return JXG.exists(n)||(n=e.board),i=d+h,r=Math.abs(d-h),o=e.midpoint.coords.distance(JXG.COORDS_BY_USER,t.midpoint.coords),o>i?[0]:r>o?[0]:0==o?[0]:(u[0]=1,a=f[1]-p[1],s=f[2]-p[2],l=(o*o-h*h+d*d)/(2*o),c=Math.sqrt(d*d-l*l),u[1]=new JXG.Coords(JXG.COORDS_BY_USER,[p[1]+l/o*a+c/o*s,p[2]+l/o*s-c/o*a],n),u[2]=new JXG.Coords(JXG.COORDS_BY_USER,[p[1]+l/o*a-c/o*s,p[2]+l/o*s+c/o*a],n),u)},meet:function(e,t,n,i){var r=JXG.Math.eps;return r>Math.abs(e[3])&&r>Math.abs(t[3])?this.meetLineLine(e,t,n,i):Math.abs(e[3])>=r&&r>Math.abs(t[3])?this.meetLineCircle(t,e,n,i):r>Math.abs(e[3])&&Math.abs(t[3])>=r?this.meetLineCircle(e,t,n,i):this.meetCircleCircle(e,t,n,i)},meetLineLine:function(e,t,n,i){var r=JXG.Math.crossProduct(e,t);return Math.abs(r[0])>JXG.Math.eps&&(r[1]/=r[0],r[2]/=r[0],r[0]=1),new JXG.Coords(JXG.COORDS_BY_USER,r,i)},meetLineCircle:function(e,t,n,i){var r,o,a,s,l,c,u,d,h,p;return t[4]<JXG.Math.eps?new JXG.Coords(JXG.COORDS_BY_USER,t.slice(6,8),i):(a=t[0],o=t.slice(1,3),r=t[3],s=e[0],l=e.slice(1,3),c=r,u=o[0]*l[1]-o[1]*l[0],d=r*s*s-(o[0]*l[0]+o[1]*l[1])*s+a,h=u*u-4*c*d,h>=0?(h=Math.sqrt(h),p=[(-u+h)/(2*c),(-u-h)/(2*c)],0==n?new JXG.Coords(JXG.COORDS_BY_USER,[-p[0]*-l[1]-s*l[0],-p[0]*l[0]-s*l[1]],i):new JXG.Coords(JXG.COORDS_BY_USER,[-p[1]*-l[1]-s*l[0],-p[1]*l[0]-s*l[1]],i)):new JXG.Coords(JXG.COORDS_BY_USER,[0,0,0],i))},meetCircleCircle:function(e,t,n,i){var r;return e[4]<JXG.Math.eps?Math.abs(this.distance(e.slice(6,2),t.slice(6,8))-t[4])<JXG.Math.eps?new JXG.Coords(JXG.COORDS_BY_USER,e.slice(6,8),i):new JXG.Coords(JXG.COORDS_BY_USER,[0,0,0],i):t[4]<JXG.Math.eps?Math.abs(this.distance(t.slice(6,2),e.slice(6,8))-e[4])<JXG.Math.eps?new JXG.Coords(JXG.COORDS_BY_USER,t.slice(6,8),i):new JXG.Coords(JXG.COORDS_BY_USER,[0,0,0],i):(r=[t[3]*e[0]-e[3]*t[0],t[3]*e[1]-e[3]*t[1],t[3]*e[2]-e[3]*t[2],0,1,1/0,1/0,1/0],r=JXG.Math.normalize(r),this.meetLineCircle(r,e,n,i))},meetCurveCurve:function(e,t,n,i,r){var o,a,s,l,c,u,d,h,p,f,g,m,v,b,y=0;for(JXG.exists(r)||(r=e.board),arguments.callee.t1memo?(o=arguments.callee.t1memo,a=arguments.callee.t2memo):(o=n,a=i),h=e.X(o)-t.X(a),p=e.Y(o)-t.Y(a),f=h*h+p*p,g=e.board.D(e.X,e),m=t.board.D(t.X,t),v=e.board.D(e.Y,e),b=t.board.D(t.Y,t);f>JXG.Math.eps&&10>y;)s=g(o),l=-m(a),c=v(o),u=-b(a),d=s*u-l*c,o-=(u*h-l*p)/d,a-=(s*p-c*h)/d,h=e.X(o)-t.X(a),p=e.Y(o)-t.Y(a),f=h*h+p*p,y++;return arguments.callee.t1memo=o,arguments.callee.t2memo=a,Math.abs(o)<Math.abs(a)?new JXG.Coords(JXG.COORDS_BY_USER,[e.X(o),e.Y(o)],r):new JXG.Coords(JXG.COORDS_BY_USER,[t.X(a),t.Y(a)],r)},meetCurveLine:function(e,t,n,i){var r,o,a,s,l,c,u,d,h,p,f,g,m,v;for(JXG.exists(i)||(i=e.board),a=0;1>=a;a++)if(arguments[a].elementClass==JXG.OBJECT_CLASS_CURVE)s=arguments[a];else{if(arguments[a].elementClass!=JXG.OBJECT_CLASS_LINE)throw Error("JSXGraph: Can't call meetCurveLine with parent class "+arguments[a].elementClass+".");l=arguments[a]}if(c=function(e){return l.stdform[0]+l.stdform[1]*s.X(e)+l.stdform[2]*s.Y(e)},arguments.callee.t1memo?(f=arguments.callee.t1memo,r=JXG.Math.Numerics.root(c,f)):(f=s.minX(),g=s.maxX(),r=JXG.Math.Numerics.root(c,[f,g])),arguments.callee.t1memo=r,m=s.X(r),v=s.Y(r),1==n){if(arguments.callee.t2memo&&(f=arguments.callee.t2memo,o=JXG.Math.Numerics.root(c,f)),!(Math.abs(o-r)>.1&&Math.abs(m-s.X(o))>.1&&Math.abs(v-s.Y(o))>.1))for(h=20,p=(s.maxX()-s.minX())/h,d=s.minX(),a=0;h>a&&(o=JXG.Math.Numerics.root(c,[d,d+p]),!(Math.abs(o-r)>.1&&Math.abs(m-s.X(o))>.1&&Math.abs(v-s.Y(o))>.1));a++)d+=p;r=o,arguments.callee.t2memo=r}return u=Math.abs(c(r))>JXG.Math.eps?0:1,new JXG.Coords(JXG.COORDS_BY_USER,[u,s.X(r),s.Y(r)],i)},projectPointToCircle:function(e,t,n){var i,r,o,a=e.coords.distance(JXG.COORDS_BY_USER,t.midpoint.coords),s=e.coords.usrCoords,l=t.midpoint.coords.usrCoords;return JXG.exists(n)||(n=e.board),Math.abs(a)<JXG.Math.eps&&(a=JXG.Math.eps),o=t.Radius()/a,i=l[1]+o*(s[1]-l[1]),r=l[2]+o*(s[2]-l[2]),new JXG.Coords(JXG.COORDS_BY_USER,[i,r],n)},projectPointToLine:function(e,t,n){var i=[0,t.stdform[1],t.stdform[2]];return JXG.exists(n)||(n=e.board),i=JXG.Math.crossProduct(i,e.coords.usrCoords),this.meetLineLine(i,t.stdform,0,n)},projectPointToCurve:function(e,t,n){JXG.exists(n)||(n=e.board);var i=e.X(),r=e.Y(),o=e.position||0,a=this.projectCoordsToCurve(i,r,o,t,n);return e.position=a[1],a[0]},projectCoordsToCurve:function(e,t,n,i,r){var o,a,s,l,c,u,d,h,p,f,g,m,v,b,y,x,w,k=1e6;if(JXG.exists(r)||(r=i.board),"parameter"==i.visProp.curvetype||"polar"==i.visProp.curvetype){for(m=function(n){var r=e-i.X(n),o=t-i.Y(n);return r*r+o*o},y=m(n),w=20,x=(i.maxX()-i.minX())/w,v=i.minX(),g=0;w>g;g++)b=m(v),y>b&&(n=v,y=b),v+=x;n=JXG.Math.Numerics.root(JXG.Math.Numerics.D(m),n),i.minX()>n&&(n=i.maxX()+n-i.minX()),n>i.maxX()&&(n=i.minX()+n-i.maxX()),o=new JXG.Coords(JXG.COORDS_BY_USER,[i.X(n),i.Y(n)],r)}else if("plot"==i.visProp.curvetype){for(h=k,d=0;i.numberPoints>d;d++)a=e-i.X(d),s=t-i.Y(d),p=Math.sqrt(a*a+s*s),h>p&&(h=p,n=d),d!=i.numberPoints-1&&(l=i.X(d+1)-i.X(d),c=i.Y(d+1)-i.Y(d),u=l*l+c*c,u>=JXG.Math.eps?(f=(a*l+s*c)/u,p=Math.sqrt(a*a+s*s-f*(a*l+s*c))):(f=0,p=Math.sqrt(a*a+s*s)),f>=0&&1>=f&&h>p&&(n=d+f,h=p));d=Math.floor(n),f=n-d,i.numberPoints-1>d?(e=f*i.X(d+1)+(1-f)*i.X(d),t=f*i.Y(d+1)+(1-f)*i.Y(d)):(e=i.X(d),t=i.Y(d)),o=new JXG.Coords(JXG.COORDS_BY_USER,[e,t],r)}else n=e,e=n,t=i.Y(n),o=new JXG.Coords(JXG.COORDS_BY_USER,[e,t],r);return[i.updateTransform(o),n]},projectPointToTurtle:function(e,t,n){var i,r,o,a,s,l,c,u,d=0,h=0,p=1e6,f=t.objects.length;for(JXG.exists(n)||(n=e.board),s=0;f>s;s++)c=t.objects[s],c.elementClass==JXG.OBJECT_CLASS_CURVE&&(i=this.projectPointToCurve(e,c),l=this.distance(i.usrCoords,e.coords.usrCoords),p>l&&(o=i.usrCoords[1],a=i.usrCoords[2],r=e.position,p=l,u=c,h=d),d+=c.numberPoints);return i=new JXG.Coords(JXG.COORDS_BY_USER,[o,a],n),e.position=r+h,u.updateTransform(i)}},JXG.Complex=function(e,t){this.isComplex=!0,e===void 0&&(e=0),t===void 0&&(t=0),e.isComplex&&(t=e.imaginary,e=e.real),this.real=e,this.imaginary=t,this.absval=0,this.angle=0},JXG.extend(JXG.Complex.prototype,{toString:function(){return""+this.real+" + "+this.imaginary+"i"},add:function(e){"number"==typeof e?this.real+=e:(this.real+=e.real,this.imaginary+=e.imaginary)},sub:function(e){"number"==typeof e?this.real-=e:(this.real-=e.real,this.imaginary-=e.imaginary)},mult:function(e){var t,n;"number"==typeof e?(this.real*=e,this.imaginary*=e):(t=this.real,n=this.imaginary,this.real=t*e.real-n*e.imaginary,this.imaginary=t*e.imaginary+n*e.real)},div:function(e){var t,n,i;if("number"==typeof e){if(Math.abs(e)<Math.eps)return this.real=1/0,this.imaginary=1/0,void 0;this.real/=e,this.imaginary/=e}else{if(Math.abs(e.real)<Math.eps&&Math.abs(e.imaginary)<Math.eps)return this.real=1/0,this.imaginary=1/0,void 0;t=e.real*e.real+e.imaginary*e.imaginary,i=this.real,n=this.imaginary,this.real=(i*e.real+n*e.imaginary)/t,this.imaginary=(n*e.real-i*e.imaginary)/t}},conj:function(){this.imaginary*=-1}}),JXG.C={},JXG.C.add=function(e,t){var n=new JXG.Complex(e);return n.add(t),n},JXG.C.sub=function(e,t){var n=new JXG.Complex(e);return n.sub(t),n},JXG.C.mult=function(e,t){var n=new JXG.Complex(e);return n.mult(t),n},JXG.C.div=function(e,t){var n=new JXG.Complex(e);return n.div(t),n},JXG.C.conj=function(e){var t=new JXG.Complex(e);return t.conj(),t},JXG.C.abs=function(e){var t=new JXG.Complex(e);return t.conj(),t.mult(e),Math.sqrt(t.real)},JXG.AbstractRenderer=function(){this.vOffsetText=3,this.enhancedRendering=!0,this.container=null,this.type=""},JXG.extend(JXG.AbstractRenderer.prototype,{_updateVisual:function(e,t,n){(n||this.enhancedRendering)&&(t=t||{},e.visProp.draft?this.setDraft(e):(t.stroke||(this.setObjectStrokeWidth(e,e.visProp.strokewidth),this.setObjectStrokeColor(e,e.visProp.strokecolor,e.visProp.strokeopacity)),t.fill||this.setObjectFillColor(e,e.visProp.fillcolor,e.visProp.fillopacity),t.dash||this.setDashStyle(e,e.visProp),t.shadow||this.setShadow(e),t.gradient||this.setShadow(e)))},drawPoint:function(e){var t,n=JXG.Point.prototype.normalizeFace.call(this,e.visProp.face);t="o"===n?"ellipse":"[]"===n?"rect":"path",this.appendChildPrim(this.createPrim(t,e.id),e.visProp.layer),this.appendNodesToElement(e,t),this._updateVisual(e,{dash:!0,shadow:!0},!0),this.updatePoint(e)},updatePoint:function(e){var t=e.visProp.size,n=JXG.Point.prototype.normalizeFace.call(this,e.visProp.face);isNaN(e.coords.scrCoords[2]+e.coords.scrCoords[1])||(this._updateVisual(e,{dash:!1,shadow:!1}),t*=e.board&&e.board.options.point.zoom?Math.sqrt(e.board.zoomX*e.board.zoomY):1,"o"===n?this.updateEllipsePrim(e.rendNode,e.coords.scrCoords[1],e.coords.scrCoords[2],t+1,t+1):"[]"===n?this.updateRectPrim(e.rendNode,e.coords.scrCoords[1]-t,e.coords.scrCoords[2]-t,2*t,2*t):this.updatePathPrim(e.rendNode,this.updatePathStringPoint(e,t,n),e.board),this.setShadow(e))},changePointStyle:function(e){var t=this.getElementById(e.id);JXG.exists(t)&&this.remove(t),this.drawPoint(e),JXG.clearVisPropOld(e),e.visProp.visible||this.hide(e),e.visProp.draft&&this.setDraft(e)},drawLine:function(e){this.appendChildPrim(this.createPrim("line",e.id),e.visProp.layer),this.appendNodesToElement(e,"lines"),this.updateLine(e)},updateLine:function(e){var t=new JXG.Coords(JXG.COORDS_BY_USER,e.point1.coords.usrCoords,e.board),n=new JXG.Coords(JXG.COORDS_BY_USER,e.point2.coords.usrCoords,e.board);JXG.Math.Geometry.calcStraight(e,t,n),this.updateLinePrim(e.rendNode,t.scrCoords[1],t.scrCoords[2],n.scrCoords[1],n.scrCoords[2],e.board),this.makeArrows(e),this._updateVisual(e,{fill:!0})},drawTicks:function(e){var t=this.createPrim("path",e.id);this.appendChildPrim(t,e.visProp.layer),this.appendNodesToElement(e,"path")},updateTicks:function(){},drawCurve:function(e){this.appendChildPrim(this.createPrim("path",e.id),e.visProp.layer),this.appendNodesToElement(e,"path"),this._updateVisual(e,{shadow:!0},!0),this.updateCurve(e)},updateCurve:function(e){this._updateVisual(e),this.updatePathPrim(e.rendNode,this.updatePathStringPrim(e),e.board),this.makeArrows(e)},drawEllipse:function(e){this.appendChildPrim(this.createPrim("ellipse",e.id),e.visProp.layer),this.appendNodesToElement(e,"ellipse"),this.updateEllipse(e)},updateEllipse:function(e){this._updateVisual(e);var t=e.Radius();t>0&&!isNaN(t+e.midpoint.coords.scrCoords[1]+e.midpoint.coords.scrCoords[2])&&2e4>t*e.board.unitX&&this.updateEllipsePrim(e.rendNode,e.midpoint.coords.scrCoords[1],e.midpoint.coords.scrCoords[2],t*e.board.unitX,t*e.board.unitY)},drawPolygon:function(e){this.appendChildPrim(this.createPrim("polygon",e.id),e.visProp.layer),this.appendNodesToElement(e,"polygon"),this.updatePolygon(e)},updatePolygon:function(e){this._updateVisual(e,{stroke:!0,dash:!0}),this.updatePolygonPrim(e.rendNode,e)},displayCopyright:function(){},drawInternalText:function(){},updateInternalText:function(){},drawText:function(e){var t;"html"===e.visProp.display?(t=this.container.ownerDocument.createElement("div"),t.style.position="absolute",t.className="JXGtext",t.style.zIndex="10",this.container.appendChild(t),t.setAttribute("id",this.container.id+"_"+e.id)):t=this.drawInternalText(e),e.rendNode=t,e.htmlStr="",this.updateText(e)},updateText:function(e){var t=e.plaintext;e.visProp.visible&&(this.updateTextStyle(e),"html"===e.visProp.display?(isNaN(e.coords.scrCoords[1]+e.coords.scrCoords[2])||(e.rendNode.style.left=parseInt(e.coords.scrCoords[1])+"px",e.rendNode.style.top=parseInt(e.coords.scrCoords[2]-parseInt(e.visProp.fontsize)+this.vOffsetText)+"px"),e.htmlStr!==t&&(e.rendNode.innerHTML=t,e.htmlStr=t,e.visProp.useasciimathml&&AMprocessNode(e.rendNode,!1),e.visProp.usemathjax&&MathJax.Hub.Typeset(e.rendNode)),this.transformImage(e,e.transformations)):this.updateInternalText(e))},updateTextStyle:function(e){var t=JXG.evaluate(e.visProp.fontsize);if("html"===e.visProp.display||"canvas"!=this.type)try{e.rendNode.style.fontSize=t+"px"}catch(n){e.rendNode.style.fontSize=t}this.setObjectStrokeColor(e,e.visProp.strokecolor,e.visProp.strokeopacity)},drawImage:function(){},updateImage:function(e){this.updateRectPrim(e.rendNode,e.coords.scrCoords[1],e.coords.scrCoords[2]-e.size[1],e.size[0],e.size[1]),this.updateImageURL(e),this.transformImage(e,e.transformations),this._updateVisual(e,{stroke:!0,dash:!0},!0)},joinTransforms:function(e,t){var n,i=[[1,0,0],[0,1,0],[0,0,1]],r=e.board.origin.scrCoords[1],o=e.board.origin.scrCoords[2],a=e.board.unitX,s=e.board.unitY,l=[[1,0,0],[-r,1,0],[-o,0,1]],c=[[1,0,0],[0,1/a,0],[0,0,-1/s]],u=[[1,0,0],[0,a,0],[0,0,-s]],d=[[1,0,0],[r,1,0],[o,0,1]],h=t.length;for(n=0;h>n;n++)i=JXG.Math.matMatMult(l,i),i=JXG.Math.matMatMult(c,i),i=JXG.Math.matMatMult(t[n].matrix,i),i=JXG.Math.matMatMult(u,i),i=JXG.Math.matMatMult(d,i);return i},transformImage:function(){},updateImageURL:function(){},appendChildPrim:function(){},appendNodesToElement:function(){},createPrim:function(){return null},remove:function(){},makeArrows:function(){},updateEllipsePrim:function(){},updateLinePrim:function(){},updatePathPrim:function(){},updatePathStringPoint:function(){},updatePathStringPrim:function(){},updatePolygonPrim:function(){},updateRectPrim:function(){},setPropertyPrim:function(){},show:function(){},hide:function(){},setBuffering:function(){},setDashStyle:function(){},setDraft:function(e){if(e.visProp.draft){var t=e.board.options.elements.draft.color,n=e.board.options.elements.draft.opacity;e.type===JXG.OBJECT_TYPE_POLYGON?this.setObjectFillColor(e,t,n):(e.elementClass===JXG.OBJECT_CLASS_POINT?this.setObjectFillColor(e,t,n):this.setObjectFillColor(e,"none",0),this.setObjectStrokeColor(e,t,n),this.setObjectStrokeWidth(e,e.board.options.elements.draft.strokeWidth))}},removeDraft:function(e){e.type===JXG.OBJECT_TYPE_POLYGON?this.setObjectFillColor(e,e.visProp.fillcolor,e.visProp.fillopacity):(e.type===JXG.OBJECT_CLASS_POINT&&this.setObjectFillColor(e,e.visProp.fillcolor,e.visProp.fillopacity),this.setObjectStrokeColor(e,e.visProp.strokecolor,e.visProp.strokeopacity),this.setObjectStrokeWidth(e,e.visProp.strokewidth))},setGradient:function(){},updateGradient:function(){},setObjectFillColor:function(){},setObjectStrokeColor:function(){},setObjectStrokeWidth:function(){},setShadow:function(){},highlight:function(e){var t,n=e.visProp;if(!n.draft){if(e.type===JXG.OBJECT_CLASS_POINT)this.setObjectStrokeColor(e,n.highlightstrokecolor,n.highlightstrokeopacity),this.setObjectFillColor(e,n.highlightstrokecolor,n.highlightstrokeopacity);else if(e.type===JXG.OBJECT_TYPE_POLYGON)for(this.setObjectFillColor(e,n.highlightfillcolor,n.highlightfillopacity),t=0;e.borders.length>t;t++)this.setObjectStrokeColor(e.borders[t],e.borders[t].visProp.highlightstrokecolor,e.borders[t].visProp.highlightstrokeopacity);else this.setObjectStrokeColor(e,n.highlightstrokecolor,n.highlightstrokeopacity),this.setObjectFillColor(e,n.highlightfillcolor,n.highlightfillopacity);n.highlightstrokewidth&&this.setObjectStrokeWidth(e,n.highlightstrokewidth)}return this},noHighlight:function(e){var t,n=e.visProp;if(!e.visProp.draft){if(e.type===JXG.OBJECT_CLASS_POINT)this.setObjectStrokeColor(e,n.strokecolor,n.strokeopacity),this.setObjectFillColor(e,n.strokecolor,n.strokeopacity);else if(e.type===JXG.OBJECT_TYPE_POLYGON)for(this.setObjectFillColor(e,n.fillcolor,n.fillopacity),t=0;e.borders.length>t;t++)this.setObjectStrokeColor(e.borders[t],e.borders[t].visProp.strokecolor,e.borders[t].visProp.strokeopacity);else this.setObjectStrokeColor(e,n.strokecolor,n.strokeopacity),this.setObjectFillColor(e,n.fillcolor,n.fillopacity);this.setObjectStrokeWidth(e,n.strokewidth)}return this},suspendRedraw:function(){},unsuspendRedraw:function(){},drawZoomBar:function(e){var t,n,i=function(i,r){var o;o=t.createElement("span"),n.appendChild(o),o.appendChild(document.createTextNode(i)),JXG.addEvent(o,"click",r,e)};t=e.containerObj.ownerDocument,n=t.createElement("div"),n.setAttribute("id",e.containerObj.id+"_navigationbar"),n.style.color=e.options.navbar.strokeColor,n.style.backgroundColor=e.options.navbar.fillColor,n.style.padding=e.options.navbar.padding,n.style.position=e.options.navbar.position,n.style.fontSize=e.options.navbar.fontSize,n.style.cursor=e.options.navbar.cursor,n.style.zIndex=e.options.navbar.zIndex,e.containerObj.appendChild(n),n.style.right=e.options.navbar.right,n.style.bottom=e.options.navbar.bottom,i(" – ",e.zoomOut),i(" o ",e.zoom100),i(" + ",e.zoomIn),i(" ← ",e.clickLeftArrow),i(" ↓ ",e.clickUpArrow),i(" ↑ ",e.clickDownArrow),i(" → ",e.clickRightArrow)},getElementById:function(e){return document.getElementById(this.container.id+"_"+e)},resize:function(){}}),JXG.FileReader=new function(){this.parseFileContent=function(e,t,n,i){JXG.exists(i)||(i=!0),this.request=!1;try{this.request=new XMLHttpRequest,"raw"==n.toLowerCase()?this.request.overrideMimeType("text/plain; charset=iso-8859-1"):this.request.overrideMimeType("text/xml; charset=iso-8859-1")}catch(r){try{this.request=new ActiveXObject("Msxml2.XMLHTTP")}catch(r){try{this.request=new ActiveXObject("Microsoft.XMLHTTP")}catch(r){this.request=!1}}}if(!this.request)return alert("AJAX not activated!"),void 0;this.request.open("GET",e,i),this.cbp="raw"==n.toLowerCase()?function(){var e=this.request;4==e.readyState&&t(e.responseText)}:function(){var e=this.request;if(4==e.readyState){var i="";i=void 0===e.responseStream||"PK"!=e.responseText.slice(0,2)&&31!=JXG.Util.asciiCharCodeAt(e.responseText.slice(0,1),0)?e.responseText:JXG.Util.Base64.decode(BinFileReader(e)),this.parseString(i,t,n,!1)}},this.cb=JXG.bind(this.cbp,this),this.request.onreadystatechange=this.cb;try{this.request.send(null)}catch(r){throw Error("JSXGraph: problems opening "+e+" !")}},this.cleanWhitespace=function(e){for(var t=e.firstChild;null!=t;)3!=t.nodeType||/\S/.test(t.nodeValue)?1==t.nodeType&&this.cleanWhitespace(t):e.removeChild(t),t=t.nextSibling},this.stringToXMLTree=function(e){"undefined"==typeof DOMParser&&(DOMParser=function(){},DOMParser.prototype.parseFromString=function(e){if("undefined"!=typeof ActiveXObject){var t=new ActiveXObject("MSXML.DomDocument");return t.loadXML(e),t}});var t=new DOMParser,n=t.parseFromString(e,"text/xml");return this.cleanWhitespace(n),n},this.parseString=function(e,t,n,i){var r;return"cdy"==n.toLowerCase()||"cinderella"==n.toLowerCase()?(i&&(e=JXG.Util.Base64.decode(e)),e=JXG.CinderellaReader.readCinderella(e,t),t.xmlString=e,void 0):"tracenpoche"==n.toLowerCase()?(t.xmlString=JXG.TracenpocheReader.readTracenpoche(e,t),void 0):"graph"==n.toLowerCase()?(e=JXG.GraphReader.readGraph(e,t,!1),void 0):"digraph"==n.toLowerCase()?(e=JXG.GraphReader.readGraph(e,t,!0),void 0):("geonext"==n.toLowerCase()&&(e=JXG.GeonextReader.prepareString(e)),"geogebra"==n.toLowerCase()&&(i="PK"!==e.slice(0,2),e=JXG.GeogebraReader.prepareString(e,i)),"intergeo"==n.toLowerCase()&&(i&&(e=JXG.Util.Base64.decode(e)),e=JXG.IntergeoReader.prepareString(e)),t.xmlString=e,r=this.stringToXMLTree(e),this.readElements(r,t,n),void 0)},this.readElements=function(e,t,n){"geonext"==n.toLowerCase()?(t.suspendUpdate(),0!=e.getElementsByTagName("GEONEXT").length&&JXG.GeonextReader.readGeonext(e,t),t.unsuspendUpdate()):0!=e.getElementsByTagName("geogebra").length?JXG.GeogebraReader.readGeogebra(e,t):"intergeo"==n.toLowerCase()&&JXG.IntergeoReader.readIntergeo(e,t)}},/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent)&&document.write('<script type="text/vbscript">\nFunction Base64Encode(inData)\n Const Base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"\n Dim cOut, sOut, I\n For I = 1 To LenB(inData) Step 3\n Dim nGroup, pOut, sGroup\n nGroup = &H10000 * AscB(MidB(inData, I, 1)) + _\n &H100 * MyASC(MidB(inData, I + 1, 1)) + MyASC(MidB(inData, I + 2, 1))\n nGroup = Oct(nGroup)\n nGroup = String(8 - Len(nGroup), "0") & nGroup\n pOut = Mid(Base64, CLng("&o" & Mid(nGroup, 1, 2)) + 1, 1) + _\n Mid(Base64, CLng("&o" & Mid(nGroup, 3, 2)) + 1, 1) + _\n Mid(Base64, CLng("&o" & Mid(nGroup, 5, 2)) + 1, 1) + _\n Mid(Base64, CLng("&o" & Mid(nGroup, 7, 2)) + 1, 1)\n sOut = sOut + pOut\n Next\n Select Case LenB(inData) Mod 3\n Case 1: \'8 bit final\n sOut = Left(sOut, Len(sOut) - 2) + "=="\n Case 2: \'16 bit final\n sOut = Left(sOut, Len(sOut) - 1) + "="\n End Select\n Base64Encode = sOut\nEnd Function\n\nFunction MyASC(OneChar)\n If OneChar = "" Then MyASC = 0 Else MyASC = AscB(OneChar)\nEnd Function\n\nFunction BinFileReader(xhr)\n Dim byteString\n Dim b64String\n Dim i\n byteString = xhr.responseBody\n ReDim byteArray(LenB(byteString))\n For i = 1 To LenB(byteString)\n byteArray(i-1) = AscB(MidB(byteString, i, 1))\n Next\n b64String = Base64Encode(byteString)\n BinFileReader = b64String\nEnd Function\n</script>\n'),JXG.GeonextParser={},JXG.GeonextParser.replacePow=function(e){var t,n,i,r,o,a,s,l,c,u,d;for(e=e.replace(/(\s*)\^(\s*)/g,"^"),c=e.indexOf("^");c>=0;){if(l=e.slice(0,c),u=e.slice(c+1),")"==l.charAt(l.length-1)){for(t=1,n=l.length-2;n>=0&&t>0;)i=l.charAt(n),")"==i?t++:"("==i&&t--,n--;if(0!=t)throw Error("JSXGraph: Missing '(' in expression");for(r="",a=l.substring(0,n+1),s=n;s>=0&&a.substr(s,1).match(/([\w\.]+)/);)r=RegExp.$1+r,s--;r+=l.substring(n+1,l.length),r=r.replace(/([\(\)\+\*\%\^\-\/\]\[])/g,"\\$1")}else r="[\\w\\.]+";if(u.match(/^([\w\.]*\()/)){for(t=1,n=RegExp.$1.length;u.length>n&&t>0;)i=u.charAt(n),")"==i?t--:"("==i&&t++,n++;if(0!=t)throw Error("JSXGraph: Missing ')' in expression");o=u.substring(0,n),o=o.replace(/([\(\)\+\*\%\^\-\/\[\]])/g,"\\$1")}else o="[\\w\\.]+";d=RegExp("("+r+")\\^("+o+")"),e=e.replace(d,"JXG.Math.pow($1,$2)"),c=e.indexOf("^")}return e},JXG.GeonextParser.replaceIf=function(e){var t,n,i,r,o,a,s,l,c,u="",d=null,h=null,p=null;if(i=e.indexOf("If("),0>i)return e;for(e=e.replace(/""/g,"0");i>=0;){for(t=e.slice(0,i),n=e.slice(i+3),o=1,r=0,a=-1,s=-1;n.length>r&&o>0;)l=n.charAt(r),")"==l?o--:"("==l?o++:","==l&&1==o&&(0>a?a=r:s=r),r++;if(c=n.slice(0,r-1),n=n.slice(r),0>a)return"";if(0>s)return"";d=c.slice(0,a),h=c.slice(a+1,s),p=c.slice(s+1),d=this.replaceIf(d),h=this.replaceIf(h),p=this.replaceIf(p),u+=t+"(("+d+")?("+h+"):("+p+"))",e=n,d=null,h=null,i=e.indexOf("If(")}return u+=n},JXG.GeonextParser.replaceSub=function(e){if(!e.indexOf)return e;for(var t,n=e.indexOf("_{");n>=0;)e=e.substr(0,n)+e.substr(n).replace(/_\{/,"<sub>"),t=e.substr(n).indexOf("}"),t>=0&&(e=e.substr(0,t)+e.substr(t).replace(/\}/,"</sub>")),n=e.indexOf("_{");for(n=e.indexOf("_");n>=0;)e=e.substr(0,n)+e.substr(n).replace(/_(.?)/,"<sub>$1</sub>"),n=e.indexOf("_");return e},JXG.GeonextParser.replaceSup=function(e){if(!e.indexOf)return e;for(var t,n=e.indexOf("^{");n>=0;)e=e.substr(0,n)+e.substr(n).replace(/\^\{/,"<sup>"),t=e.substr(n).indexOf("}"),t>=0&&(e=e.substr(0,t)+e.substr(t).replace(/\}/,"</sup>")),n=e.indexOf("^{");for(n=e.indexOf("^");n>=0;)e=e.substr(0,n)+e.substr(n).replace(/\^(.?)/,"<sup>$1</sup>"),n=e.indexOf("^");return e},JXG.GeonextParser.replaceNameById=function(e,t){var n,i,r,o,a=0,s=["X","Y","L","V"];for(o=0;s.length>o;o++)for(a=e.indexOf(s[o]+"(");a>=0;)a>=0&&(n=e.indexOf(")",a+2),n>=0&&(i=e.slice(a+2,n),i=i.replace(/\\(['"])?/g,"$1"),r=t.elementsByName[i],e=e.slice(0,a+2)+r.id+e.slice(n))),n=e.indexOf(")",a+2),a=e.indexOf(s[o]+"(",n);for(a=e.indexOf("Dist(");a>=0;)a>=0&&(n=e.indexOf(",",a+5),n>=0&&(i=e.slice(a+5,n),i=i.replace(/\\(['"])?/g,"$1"),r=t.elementsByName[i],e=e.slice(0,a+5)+r.id+e.slice(n))),n=e.indexOf(",",a+5),a=e.indexOf(",",n),n=e.indexOf(")",a+1),n>=0&&(i=e.slice(a+1,n),i=i.replace(/\\(['"])?/g,"$1"),r=t.elementsByName[i],e=e.slice(0,a+1)+r.id+e.slice(n)),n=e.indexOf(")",a+1),a=e.indexOf("Dist(",n);for(s=["Deg","Rad"],o=0;s.length>o;o++)for(a=e.indexOf(s[o]+"(");a>=0;)a>=0&&(n=e.indexOf(",",a+4),n>=0&&(i=e.slice(a+4,n),i=i.replace(/\\(['"])?/g,"$1"),r=t.elementsByName[i],e=e.slice(0,a+4)+r.id+e.slice(n))),n=e.indexOf(",",a+4),a=e.indexOf(",",n),n=e.indexOf(",",a+1),n>=0&&(i=e.slice(a+1,n),i=i.replace(/\\(['"])?/g,"$1"),r=t.elementsByName[i],e=e.slice(0,a+1)+r.id+e.slice(n)),n=e.indexOf(",",a+1),a=e.indexOf(",",n),n=e.indexOf(")",a+1),n>=0&&(i=e.slice(a+1,n),i=i.replace(/\\(['"])?/g,"$1"),r=t.elementsByName[i],e=e.slice(0,a+1)+r.id+e.slice(n)),n=e.indexOf(")",a+1),a=e.indexOf(s[o]+"(",n);return e},JXG.GeonextParser.replaceIdByObj=function(e){var t=/(X|Y|L)\(([\w_]+)\)/g;return e=e.replace(t,'this.board.objects["$2"].$1()'),t=/(V)\(([\w_]+)\)/g,e=e.replace(t,'this.board.objects["$2"].Value()'),t=/(Dist)\(([\w_]+),([\w_]+)\)/g,e=e.replace(t,'this.board.objects["$2"].Dist(this.board.objects["$3"])'),t=/(Deg)\(([\w_]+),([ \w\[\w_]+),([\w_]+)\)/g,e=e.replace(t,'JXG.Math.Geometry.trueAngle(this.board.objects["$2"],this.board.objects["$3"],this.board.objects["$4"])'),t=/Rad\(([\w_]+),([\w_]+),([\w_]+)\)/g,e=e.replace(t,'JXG.Math.Geometry.rad(this.board.objects["$1"],this.board.objects["$2"],this.board.objects["$3"])')},JXG.GeonextParser.geonext2JS=function(e,t){var n,i,r,o=["Abs","ACos","ASin","ATan","Ceil","Cos","Exp","Factorial","Floor","Log","Max","Min","Random","Round","Sin","Sqrt","Tan","Trunc"],a=["Math.abs","Math.acos","Math.asin","Math.atan","Math.ceil","Math.cos","Math.exp","JXG.Math.factorial","Math.floor","Math.log","Math.max","Math.min","Math.random","this.board.round","Math.sin","Math.sqrt","Math.tan","Math.ceil"];for(e=e.replace(/&lt;/g,"<"),e=e.replace(/&gt;/g,">"),e=e.replace(/&amp;/g,"&"),i=e,i=this.replaceNameById(i,t),i=this.replaceIf(i),i=this.replacePow(i),i=this.replaceIdByObj(i),r=0;o.length>r;r++)n=RegExp(["(\\W|^)(",o[r],")"].join(""),"ig"),i=i.replace(n,["$1",a[r]].join(""));return i=i.replace(/True/g,"true"),i=i.replace(/False/g,"false"),i=i.replace(/fasle/g,"false"),i=i.replace(/Pi/g,"Math.PI")},JXG.GeonextParser.findDependencies=function(e,t,n){n===void 0&&(n=e.board);var i,r,o,a=n.elementsByName;for(i in a)i!=e.name&&(a[i].type==JXG.OBJECT_TYPE_TEXT?a[i].visProp.islabel||(o=i.replace(/\[/g,"\\["),o=o.replace(/\]/g,"\\]"),r=RegExp("\\(([\\w\\[\\]'_ ]+,)*("+o+")(,[\\w\\[\\]'_ ]+)*\\)","g"),t.search(r)>=0&&a[i].addChild(e)):(o=i.replace(/\[/g,"\\["),o=o.replace(/\]/g,"\\]"),r=RegExp("\\(([\\w\\[\\]'_ ]+,)*("+o+")(,[\\w\\[\\]'_ ]+)*\\)","g"),t.search(r)>=0&&a[i].addChild(e)))},JXG.Board=function(e,t,n,i,r,o,a,s,l,c,u){if(this.BOARD_MODE_NONE=0,this.BOARD_MODE_DRAG=1,this.BOARD_MODE_MOVE_ORIGIN=2,this.BOARD_QUALITY_LOW=1,this.BOARD_QUALITY_HIGH=2,this.BOARD_MODE_CONSTRUCT=16,this.CONSTRUCTION_TYPE_POINT=1129599060,this.CONSTRUCTION_TYPE_CIRCLE=1129595724,this.CONSTRUCTION_TYPE_LINE=1129598030,this.CONSTRUCTION_TYPE_GLIDER=1129596740,this.CONSTRUCTION_TYPE_MIDPOINT=1129598288,this.CONSTRUCTION_TYPE_PERPENDICULAR=1129599044,this.CONSTRUCTION_TYPE_PARALLEL=1129599052,this.CONSTRUCTION_TYPE_INTERSECTION=1129597267,this.container=e,this.containerObj=document.getElementById(this.container),null==this.containerObj)throw Error("\nJSXGraph: HTML container element '"+e+"' not found."); this.renderer=t,this.grids=[],this.options=JXG.deepCopy(JXG.Options),this.dimension=2,this.origin={},this.origin.usrCoords=[1,0,0],this.origin.scrCoords=[1,i[0],i[1]],this.zoomX=r,this.zoomY=o,this.unitX=a*this.zoomX,this.unitY=s*this.zoomY,this.canvasWidth=l,this.canvasHeight=c,this.id=JXG.exists(n)&&""!==n&&!JXG.exists(document.getElementById(n))?n:this.generateId(),this.hooks=[],this.dependentBoards=[],this.objects={},this.groups={},this.animationObjects={},this.highlightedObjects={},this.numObjects=0,this.elementsByName={},this.mode=this.BOARD_MODE_NONE,this.updateQuality=this.BOARD_QUALITY_HIGH,this.isSuspendedRedraw=!1,this.calculateSnapSizes(),this.drag_dx=0,this.drag_dy=0,this.mouse=null,this.touches=[],this.xmlString="",this.cPos=[],this.touchMoveLast=0,this.showCopyright=!1,(null!=u&&u||null==u&&this.options.showCopyright)&&(this.showCopyright=!0,this.renderer.displayCopyright(JXG.JSXGraph.licenseText,this.options.text.fontSize)),this.needsFullUpdate=!1,this.reducedUpdate=!1,this.currentCBDef="none",this.geonextCompatibilityMode=!1,this.options.text.useASCIIMathML&&translateASCIIMath?init():this.options.text.useASCIIMathML=!1,this.addEventHandlers()},JXG.extend(JXG.Board.prototype,{generateName:function(e){if(e.type==JXG.OBJECT_TYPE_TICKS)return"";var t,n,i=3,r="",o="",a=[],s="";switch(t=e.elementClass==JXG.OBJECT_CLASS_POINT?["","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]:["","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],e.type){case JXG.OBJECT_TYPE_POLYGON:r="P_{",o="}";break;case JXG.OBJECT_TYPE_CIRCLE:r="k_{",o="}";break;case JXG.OBJECT_TYPE_ANGLE:r="W_{",o="}";break;default:e.elementClass!=JXG.OBJECT_CLASS_POINT&&e.elementClass!=JXG.OBJECT_CLASS_LINE&&(r="s_{",o="}")}for(n=0;i>n;n++)a[n]=0;for(;a[i-1]<t.length;){for(a[0]=1;a[0]<t.length;a[0]++){for(s=r,n=i;n>0;n--)s+=t[a[n-1]];if(null==this.elementsByName[s+o])return s+o}for(a[0]=t.length,n=1;i>n;n++)a[n-1]==t.length&&(a[n-1]=1,a[n]++)}return""},generateId:function(){for(var e=1;null!=JXG.JSXGraph.boards["jxgBoard"+e];)e=Math.round(65535*Math.random());return"jxgBoard"+e},setId:function(e,t){var n=this.numObjects++,i=e.id;return""!=i&&JXG.exists(i)||(i=this.id+t+n),e.id=i,this.objects[i]=e,i},finalizeAdding:function(e){e.visProp.visible||this.renderer.hide(e)},finalizeLabel:function(e){!e.hasLabel||e.label.content.visProp.islabel||e.label.content.visProp.visible||this.renderer.hide(e.label.content)},getCoordsTopLeftCorner:function(){var e,t=this.containerObj,n=JXG.getOffset(t);return this.mode===JXG.BOARD_MODE_DRAG||this.mode===JXG.BOARD_MODE_MOVE_ORIGIN?this.cPos:(e=parseInt(JXG.getStyle(t,"borderLeftWidth")),isNaN(e)&&(e=0),n[0]+=e,e=parseInt(JXG.getStyle(t,"borderTopWidth")),isNaN(e)&&(e=0),n[1]+=e,e=parseInt(JXG.getStyle(t,"paddingLeft")),isNaN(e)&&(e=0),n[0]+=e,e=parseInt(JXG.getStyle(t,"paddingTop")),isNaN(e)&&(e=0),n[1]+=e,this.cPos=n,n)},getMousePosition:function(e,t){var n,i=this.getCoordsTopLeftCorner();return n=JXG.getPosition(e,t),[n[0]-i[0],n[1]-i[1]]},initMoveOrigin:function(e,t){this.drag_dx=e-this.origin.scrCoords[1],this.drag_dy=t-this.origin.scrCoords[2],this.mode=this.BOARD_MODE_MOVE_ORIGIN},initMoveObject:function(e,t){var n,i,r,o,a,s=[];this.mode=this.BOARD_MODE_DRAG;for(i in this.objects)if(n=this.objects[i],(this.geonextCompatibilityMode&&(n.elementClass==JXG.OBJECT_CLASS_POINT||n.type==JXG.OBJECT_TYPE_TEXT)||!this.geonextCompatibilityMode)&&n.isDraggable&&n.visProp.visible&&!n.visProp.fixed&&!n.visProp.frozen&&JXG.exists(n.hasPoint)&&n.hasPoint(e,t)){if(a=!1,!JXG.isPoint(n))for(r=s.length,o=0;r>o;o++)if(JXG.exists(n.ancestors[s[o].id])){a=!0;break}a||s.push(n)}return s},moveObject:function(e,t,n){var i,r=new JXG.Coords(JXG.COORDS_BY_SCREEN,this.getScrCoordsOfMouse(e,t),this),o=n.obj;o.type!=JXG.OBJECT_TYPE_GLIDER?(isNaN(n.targets[0].Xprev+n.targets[0].Yprev)||o.setPositionDirectly(JXG.COORDS_BY_SCREEN,r.scrCoords[1],r.scrCoords[2],n.targets[0].Xprev,n.targets[0].Yprev),n.targets[0].Xprev=r.scrCoords[1],n.targets[0].Yprev=r.scrCoords[2],this.update(o)):o.type==JXG.OBJECT_TYPE_GLIDER&&(i=o.coords,o.setPositionDirectly(JXG.COORDS_BY_USER,r.usrCoords[1],r.usrCoords[2]),o.slideObject.type==JXG.OBJECT_TYPE_CIRCLE?o.coords=JXG.Math.Geometry.projectPointToCircle(o,o.slideObject,this):o.slideObject.elementClass==JXG.OBJECT_CLASS_LINE&&(o.coords=JXG.Math.Geometry.projectPointToLine(o,o.slideObject,this)),0!=o.group.length?(o.group[o.group.length-1].dX=o.coords.scrCoords[1]-i.scrCoords[1],o.group[o.group.length-1].dY=o.coords.scrCoords[2]-i.scrCoords[2],o.group[o.group.length-1].update(this)):this.update(o)),this.updateInfobox(o)},highlightElements:function(e,t){var n,i;for(n in this.objects)i=this.objects[n],JXG.exists(i.hasPoint)&&i.visProp.visible&&i.hasPoint(e,t)&&(this.updateInfobox(i),null==this.highlightedObjects[n]&&(this.highlightedObjects[n]=i,i.highlight()))},addEventHandlers:function(){JXG.addEvent(this.containerObj,"mousedown",this.mouseDownListener,this),JXG.addEvent(this.containerObj,"mousemove",this.mouseMoveListener,this),JXG.addEvent(document,"mouseup",this.mouseUpListener,this),JXG.addEvent(this.containerObj,"touchstart",this.touchStartListener,this),JXG.addEvent(this.containerObj,"touchmove",this.touchMoveListener,this),JXG.addEvent(this.containerObj,"touchend",this.touchEndListener,this),JXG.addEvent(this.containerObj,"mousewheel",this.mouseWheelListener,this),JXG.addEvent(this.containerObj,"DOMMouseScroll",this.mouseWheelListener,this),this.containerObj.oncontextmenu=function(e){return JXG.exists(e)&&e.preventDefault(),!1}},removeEventHandlers:function(){JXG.removeEvent(this.containerObj,"mousedown",this.mouseDownListener,this),JXG.removeEvent(this.containerObj,"mousemove",this.mouseMoveListener,this),JXG.removeEvent(document,"mouseup",this.mouseUpListener,this),JXG.removeEvent(this.containerObj,"touchstart",this.touchStartListener,this),JXG.removeEvent(this.containerObj,"touchmove",this.touchMoveListener,this),JXG.removeEvent(this.containerObj,"touchend",this.touchEndListener,this),JXG.removeEvent(this.containerObj,"mousewheel",this.mouseWheelListener,this),JXG.removeEvent(this.containerObj,"DOMMouseScroll",this.mouseWheelListener,this)},clickLeftArrow:function(){return this.moveOrigin(this.origin.scrCoords[1]+.1*this.canvasWidth,this.origin.scrCoords[2]),this},clickRightArrow:function(){return this.moveOrigin(this.origin.scrCoords[1]-.1*this.canvasWidth,this.origin.scrCoords[2]),this},clickUpArrow:function(){return this.moveOrigin(this.origin.scrCoords[1],this.origin.scrCoords[2]+.1*this.canvasHeight),this},clickDownArrow:function(){return this.moveOrigin(this.origin.scrCoords[1],this.origin.scrCoords[2]-.1*this.canvasHeight),this},touchStartListener:function(e){var t,n,i,r,o,a=this.options.precision.touch,s=!1,l=[];if(e.preventDefault(),e.stopPropagation(),this.updateHooks("mousedown",e),this.mode===this.BOARD_MODE_NONE&&2==e.targetTouches.length&&80>JXG.Math.Geometry.distance([e.targetTouches[0].screenX,e.targetTouches[0].screenY],[e.targetTouches[1].screenX,e.targetTouches[1].screenY]))return n=this.getMousePosition(e,0),this.initMoveOrigin(n[0],n[1]),void 0;for(this.options.precision.hasPoint=this.options.precision.touch,t=0;this.touches.length>t;t++)l[t]=this.touches[t];for(this.touches.length=0,t=0;e.targetTouches.length>t;t++){for(r=0;l.length>r;r++)if(a*a>Math.abs(Math.pow(e.targetTouches[t].screenX-l[r].targets[0].X,2)+Math.pow(e.targetTouches[t].screenY-l[r].targets[0].Y,2))){this.touches.push({obj:l[r].obj,targets:[{num:t,X:e.targetTouches[t].screenX,Y:e.targetTouches[t].screenY,Xprev:0/0,Yprev:0/0}]}),s=!0;break}s||(n=this.getMousePosition(e,t),i=this.initMoveObject(n[0],n[1]),0!=i.length&&(o=this.options.takeFirst?i[0]:i[i.length-1],this.touches.push({obj:o,targets:[{num:t,X:e.targetTouches[t].screenX,Y:e.targetTouches[t].screenY,Xprev:0/0,Yprev:0/0}]}))),s=!1}if(JXG.isWebkitAndroid()){var c=new Date;this.touchMoveLast=c.getTime()-200}this.options.precision.hasPoint=this.options.precision.mouse},touchMoveListener:function(e){var t,n;if(e.preventDefault(),e.stopPropagation(),JXG.isWebkitAndroid()){var i=new Date;if(i=i.getTime(),80>i-this.touchMoveLast)return this.updateQuality=this.BOARD_QUALITY_HIGH,void 0;this.touchMoveLast=i}if(this.updateHooks("mousemove",e,this.mode),this.mode!=this.BOARD_MODE_DRAG&&this.renderer.hide(this.infobox),this.options.precision.hasPoint=this.options.precision.touch,this.mode==this.BOARD_MODE_MOVE_ORIGIN)n=this.getMousePosition(e,0),this.moveOrigin(n[0],n[1]);else if(this.mode==this.BOARD_MODE_DRAG)for(t=0;this.touches.length>t;t++)this.touches[t].targets[0].X=e.targetTouches[this.touches[t].targets[0].num].screenX,this.touches[t].targets[0].Y=e.targetTouches[this.touches[t].targets[0].num].screenY,n=this.getMousePosition(e,this.touches[t].targets[0].num),this.moveObject(n[0],n[1],this.touches[t]);else for(t=0;e.targetTouches.length>t;t++)n=this.getMousePosition(e,t),this.highlightElements(n[0],n[1]);this.mode!=this.BOARD_MODE_DRAG&&this.renderer.hide(this.infobox),this.options.precision.hasPoint=this.options.precision.mouse},touchEndListener:function(e){var t,n,i=this.options.precision.touch,r=[];if(this.updateHooks("mouseup",e),e.targetTouches.length>0){for(t=0;this.touches.length>t;t++)r[t]=this.touches[t];for(this.touches.length=0,t=0;e.targetTouches.length>t;t++)for(n=0;r.length>n;n++)if(i*i>Math.abs(Math.pow(e.targetTouches[t].screenX-r[n].targets[0].X,2)+Math.pow(e.targetTouches[t].screenY-r[n].targets[0].Y,2))){this.touches.push({obj:r[n].obj,targets:[{num:t,X:e.targetTouches[t].screenX,Y:e.targetTouches[t].screenY,Xprev:0/0,Yprev:0/0}]});break}}else this.updateQuality=this.BOARD_QUALITY_HIGH,this.mode=this.BOARD_MODE_NONE,this.mode!==this.BOARD_MODE_MOVE_ORIGIN&&this.update(),this.touches.length=0},mouseDownListener:function(e){var t,n;return this.updateHooks("mousedown",e),document.selection&&"function"==typeof document.selection.empty?document.selection.empty():window.getSelection&&window.getSelection().removeAllRanges(),t=this.getMousePosition(e),e.shiftKey?(this.initMoveOrigin(t[0],t[1]),!1):this.mode==this.BOARD_MODE_CONSTRUCT?!1:(n=this.initMoveObject(t[0],t[1]),0==n.length?(this.mode=this.BOARD_MODE_NONE,!0):(this.mouse={obj:null,targets:[{X:t[0],Y:t[1],Xprev:0/0,Yprev:0/0}]},this.mouse.obj=this.options.takeFirst?n[0]:n[n.length-1],e&&e.preventDefault?e.preventDefault():window.event.returnValue=!1,!1))},mouseUpListener:function(e){this.updateHooks("mouseup",e),this.updateQuality=this.BOARD_QUALITY_HIGH,this.mode=this.BOARD_MODE_NONE,this.mode!==this.BOARD_MODE_MOVE_ORIGIN&&this.update(),this.mouse=null},mouseMoveListener:function(e,t){var n;this.updateHooks("mousemove",e,this.mode),t=0,n=this.getMousePosition(e),this.updateQuality=this.BOARD_QUALITY_LOW,this.dehighlightAll(),this.mode!=this.BOARD_MODE_DRAG&&this.renderer.hide(this.infobox),this.mode==this.BOARD_MODE_MOVE_ORIGIN?this.moveOrigin(n[0]-this.drag_dx,n[1]-this.drag_dy):this.mode==this.BOARD_MODE_DRAG?this.moveObject(n[0],n[1],this.mouse):this.highlightElements(n[0],n[1]),this.updateQuality=this.BOARD_QUALITY_HIGH},mouseWheelListener:function(e){e=e?e:window.event;var t=e.detail?-1*e.detail:e.wheelDelta/40,n=new JXG.Coords(JXG.COORDS_BY_SCREEN,this.getMousePosition(e),this);return t>0?this.zoomIn(n.usrCoords[1],n.usrCoords[2]):this.zoomOut(n.usrCoords[1],n.usrCoords[2]),e.preventDefault(),!1},updateInfobox:function(e){var t,n,i,r;return e.visProp.showinfobox?(e.elementClass==JXG.OBJECT_CLASS_POINT&&(i=e.coords.usrCoords[1],r=e.coords.usrCoords[2],this.infobox.setCoords(i+this.infobox.distanceX/this.unitX,r+this.infobox.distanceY/this.unitY),"string"!=typeof e.infoboxText?(t=Math.abs(i),t=t>.1?i.toFixed(2):t>=.01?i.toFixed(4):t>=1e-4?i.toFixed(6):i,n=Math.abs(r),n=n>.1?r.toFixed(2):n>=.01?r.toFixed(4):n>=1e-4?r.toFixed(6):r,this.highlightInfobox(t,n,e)):this.highlightCustomInfobox(e.infoboxText,e),this.renderer.show(this.infobox),this.renderer.updateText(this.infobox)),this):this},highlightCustomInfobox:function(e){return this.infobox.setText('<span style="color:#bbbbbb;">'+e+"</span>"),this},highlightInfobox:function(e,t){return this.highlightCustomInfobox("("+e+", "+t+")"),this},dehighlightAll:function(){var e,t,n=!1;for(e in this.highlightedObjects)t=this.highlightedObjects[e],t.noHighlight(),delete this.highlightedObjects[e],n=!0;return"canvas"==this.options.renderer&&n&&(this.prepareUpdate(),this.renderer.suspendRedraw(this),this.updateRenderer(),this.renderer.unsuspendRedraw()),this},getScrCoordsOfMouse:function(e,t){if(this.options.grid.snapToGrid){var n=new JXG.Coords(JXG.COORDS_BY_SCREEN,[e,t],this);return n.setCoordinates(JXG.COORDS_BY_USER,[Math.round(n.usrCoords[1]*this.options.grid.snapSizeX)/this.options.grid.snapSizeX,Math.round(n.usrCoords[2]*this.options.grid.snapSizeY)/this.options.grid.snapSizeY]),[n.scrCoords[1],n.scrCoords[2]]}return[e,t]},getUsrCoordsOfMouse:function(e){var t=this.getCoordsTopLeftCorner(),n=JXG.getPosition(e),i=n[0]-t[0],r=n[1]-t[1],o=new JXG.Coords(JXG.COORDS_BY_SCREEN,[i,r],this);return this.options.grid.snapToGrid&&o.setCoordinates(JXG.COORDS_BY_USER,[Math.round(o.usrCoords[1]*this.options.grid.snapSizeX)/this.options.grid.snapSizeX,Math.round(o.usrCoords[2]*this.options.grid.snapSizeY)/this.options.grid.snapSizeY]),[o.usrCoords[1],o.usrCoords[2]]},getAllUnderMouse:function(e){var t=this.getAllObjectsUnderMouse();return t.push(this.getUsrCoordsOfMouse(e)),t},getAllObjectsUnderMouse:function(e){var t=this.getCoordsTopLeftCorner(),n=JXG.getPosition(e),i=n[0]-t[0],r=n[1]-t[1],o=[];for(var a in this.objects)this.objects[a].visProp.visible&&this.objects[a].hasPoint&&this.objects[a].hasPoint(i,r)&&o.push(this.objects[a]);return o},moveOrigin:function(e,t){var n,i;JXG.exists(e)&&JXG.exists(t)&&(this.origin.scrCoords[1]=e,this.origin.scrCoords[2]=t);for(i in this.objects)n=this.objects[i],n.visProp.frozen||n.elementClass!=JXG.OBJECT_CLASS_POINT&&n.elementClass!=JXG.OBJECT_CLASS_CURVE&&n.type!=JXG.OBJECT_TYPE_AXIS&&n.type!=JXG.OBJECT_TYPE_TEXT||n.elementClass!=JXG.OBJECT_CLASS_CURVE&&n.type!=JXG.OBJECT_TYPE_AXIS&&n.coords.usr2screen();return this.clearTraces(),this.fullUpdate(),this},addConditions:function(e){var t,n,i,r,o,a,s="var el, x, y, c, rgbo;\n",l=e.indexOf("<data>"),c=e.indexOf("</data>");if(!(0>l)){for(;l>=0;){t=e.slice(l+6,c),n=t.indexOf("="),i=t.slice(0,n),r=t.slice(n+1),n=i.indexOf("."),o=i.slice(0,n),a=this.elementsByName[JXG.unescapeHTML(o)];var u=i.slice(n+1).replace(/\s+/g,"").toLowerCase();switch(r=JXG.GeonextParser.geonext2JS(r,this),r=r.replace(/this\.board\./g,"this."),JXG.exists(this.elementsByName[o])||JXG.debug("debug conditions: |"+o+"| undefined"),s+='el = this.objects["'+a.id+'"];\n',u){case"x":s+="var y=el.coords.usrCoords[2];\n",s+="el.setPositionDirectly(JXG.COORDS_BY_USER,"+r+",y);\n",s+="el.prepareUpdate().update();\n";break;case"y":s+="var x=el.coords.usrCoords[1];\n",s+="el.coords=new JXG.Coords(JXG.COORDS_BY_USER,[x,"+r+"],this);\n",s+="el.setPositionDirectly(JXG.COORDS_BY_USER,x,"+r+");\n",s+="el.prepareUpdate().update();\n";break;case"visible":s+="var c="+r+";\n",s+="el.visProp.visible = c;\n",s+="if (c) {el.showElement();} else {el.hideElement();}\n";break;case"position":s+="el.position = "+r+";\n",s+="el.prepareUpdate().update(true);\n";break;case"stroke":s+="rgbo = JXG.rgba2rgbo("+r+");\n",s+="el.visProp.strokecolor = rgbo[0];\n",s+="el.visProp.strokeopacity = rgbo[1];\n";break;case"style":s+="el.setStyle("+r+");\n";break;case"strokewidth":s+="el.strokeWidth = "+r+";\n";break;case"fill":s+="var rgbo = JXG.rgba2rgbo("+r+");\n",s+="el.visProp.fillcolor = rgbo[0];\n",s+="el.visProp.fillopacity = rgbo[1];\n";break;case"label":break;default:JXG.debug("property '"+u+"' in conditions not yet implemented:"+r)}e=e.slice(c+7),l=e.indexOf("<data>"),c=e.indexOf("</data>")}s+="this.prepareUpdate().updateElements();\n",s+="return true;\n",this.updateConditions=Function(s),this.updateConditions()}},updateConditions:function(){return!1},calculateSnapSizes:function(){var e=new JXG.Coords(JXG.COORDS_BY_USER,[0,0],this),t=new JXG.Coords(JXG.COORDS_BY_USER,[this.options.grid.gridX,this.options.grid.gridY],this),n=e.scrCoords[1]-t.scrCoords[1],i=e.scrCoords[2]-t.scrCoords[2];for(this.options.grid.snapSizeX=this.options.grid.gridX;Math.abs(n)>25;)this.options.grid.snapSizeX*=2,n/=2;for(this.options.grid.snapSizeY=this.options.grid.gridY;Math.abs(i)>25;)this.options.grid.snapSizeY*=2,i/=2;return this},applyZoom:function(){var e,t;for(t in this.objects)e=this.objects[t],e.visProp.frozen||e.elementClass!=JXG.OBJECT_CLASS_POINT&&e.elementClass!=JXG.OBJECT_CLASS_CURVE&&e.type!=JXG.OBJECT_TYPE_AXIS&&e.type!=JXG.OBJECT_TYPE_TEXT||e.elementClass!=JXG.OBJECT_CLASS_CURVE&&e.type!=JXG.OBJECT_TYPE_AXIS&&e.coords.usr2screen();return this.calculateSnapSizes(),this.clearTraces(),this.fullUpdate(),this},zoomIn:function(e,t){var n=this.getBoundingBox(),i=this.options.zoom.factorX,r=this.options.zoom.factorY,o=(n[2]-n[0])*(1-1/i),a=(n[1]-n[3])*(1-1/r),s=.5,l=.5;return"number"==typeof e&&"number"==typeof t&&(s=(e-n[0])/(n[2]-n[0]),l=(n[1]-t)/(n[1]-n[3])),this.setBoundingBox([n[0]+o*s,n[1]-a*l,n[2]-o*(1-s),n[3]+a*(1-l)],!1),this.zoomX*=i,this.zoomY*=r,this.applyZoom(),this},zoomOut:function(e,t){var n=this.getBoundingBox(),i=this.options.zoom.factorX,r=this.options.zoom.factorY,o=(n[2]-n[0])*(1-i),a=(n[1]-n[3])*(1-r),s=.5,l=.5;return"number"==typeof e&&"number"==typeof t&&(s=(e-n[0])/(n[2]-n[0]),l=(n[1]-t)/(n[1]-n[3])),this.setBoundingBox([n[0]+o*s,n[1]-a*l,n[2]-o*(1-s),n[3]+a*(1-l)],!1),this.zoomX/=i,this.zoomY/=r,this.applyZoom(),this},zoom100:function(){var e=this.getBoundingBox(),t=.5*(e[2]-e[0])*(1-this.zoomX),n=.5*(e[1]-e[3])*(1-this.zoomY);return this.setBoundingBox([e[0]+t,e[1]-n,e[2]-t,e[3]+n],!1),this.zoomX=1,this.zoomY=1,this.applyZoom(),this},zoomAllPoints:function(){var e,t,n,i,r=0,o=0,a=0,s=0;for(e in this.objects)JXG.isPoint(this.objects[e])&&this.objects[e].visProp.visible&&(r>this.objects[e].coords.usrCoords[1]?r=this.objects[e].coords.usrCoords[1]:this.objects[e].coords.usrCoords[1]>o&&(o=this.objects[e].coords.usrCoords[1]),this.objects[e].coords.usrCoords[2]>s?s=this.objects[e].coords.usrCoords[2]:a>this.objects[e].coords.usrCoords[2]&&(a=this.objects[e].coords.usrCoords[2]));return t=50,n=t/this.unitX,i=t/this.unitY,this.zoomX=1,this.zoomY=1,this.setBoundingBox([r-n,s+i,o+n,a-i],!0),this.applyZoom(),this},zoomElements:function(e){var t,n,i,r,o=[0,0,0,0],a=[1,-1,-1,1];if(!JXG.isArray(e)||0===e.length)return this;for(t=0;e.length>t;t++)if(i=JXG.getRef(this,e[t]),r=i.bounds(),JXG.isArray(r))if(JXG.isArray(o))for(n=0;4>n;n++)a[n]*r[n]<a[n]*o[n]&&(o[n]=r[n]);else o=r;if(JXG.isArray(o)){for(n=0;4>n;n++)o[n]-=a[n];this.zoomX=1,this.zoomY=1,this.setBoundingBox(o,!0)}return this},removeObject:function(e){var t,n;if(JXG.isArray(e))for(n=0;e.length>n;n++)this.removeObject(e[n]);if(e=JXG.getReference(this,e),!JXG.exists(e))return this;try{for(t in e.childElements)e.childElements[t].board.removeObject(e.childElements[t]);for(t in this.objects)JXG.exists(this.objects[t].childElements)&&delete this.objects[t].childElements[e.id];delete this.objects[e.id],delete this.elementsByName[e.name],JXG.exists(e.remove)&&e.remove()}catch(i){JXG.debug(e.id+": Could not be removed, JS says:\n\n"+i)}return this},removeAncestors:function(e){for(var t in e.ancestors)this.removeAncestors(e.ancestors[t]);return this.removeObject(e),this},initGeonextBoard:function(){var e,t,n,i,r;return e=this.create("point",[0,0],{id:this.id+"g00e0",name:"Ursprung",withLabel:!1,visible:!1,fixed:!0}),t=this.create("point",[1,0],{id:this.id+"gX0e0",name:"Punkt_1_0",withLabel:!1,visible:!1,fixed:!0}),n=this.create("point",[0,1],{id:this.id+"gY0e0",name:"Punkt_0_1",withLabel:!1,visible:!1,fixed:!0}),i=this.create("line",[e,t],{id:this.id+"gXLe0",name:"X-Achse",withLabel:!1,visible:!1}),r=this.create("line",[e,n],{id:this.id+"gYLe0",name:"Y-Achse",withLabel:!1,visible:!1}),this},initInfobox:function(){return this.infobox=this.create("text",[0,0,"0,0"],{id:this.id+"_infobox",display:"html"}),this.infobox.distanceX=-20,this.infobox.distanceY=25,this.renderer.hide(this.infobox),this},resizeContainer:function(e,t){return this.canvasWidth=parseFloat(e),this.canvasHeight=parseFloat(t),this.containerObj.style.width=this.canvasWidth+"px",this.containerObj.style.height=this.canvasHeight+"px",this.renderer.resize(this.canvasWidth,this.canvasHeight),this},showDependencies:function(){var e,t,n,i,r;t="<p>\n";for(e in this.objects){r=0;for(n in this.objects[e].childElements)r++;r>=0&&(t+="<b>"+this.objects[e].id+":</b> ");for(n in this.objects[e].childElements)t+=this.objects[e].childElements[n].id+"("+this.objects[e].childElements[n].name+"), ";t+="<p>\n"}return t+="</p>\n",i=window.open(),i.document.open(),i.document.write(t),i.document.close(),this},showXML:function(){var e=window.open("");return e.document.open(),e.document.write("<pre>"+JXG.escapeHTML(this.xmlString)+"</pre>"),e.document.close(),this},prepareUpdate:function(){var e,t;for(e in this.objects)t=this.objects[e],(this.needsFullUpdate||t.needsRegularUpdate)&&(t.needsUpdate=!0);return this},updateElements:function(e){var t,n;e=JXG.getRef(this,e);for(t in this.objects)n=this.objects[t],null==e||n.id!=e.id?n.update(!0):n.update(!1);return this},updateRenderer:function(e){var t,n;if("canvas"==this.options.renderer)this.updateRendererCanvas(e);else for(t in this.objects)n=this.objects[t],n.updateRenderer();return this},updateRendererCanvas:function(){var e,t,n,i,r,o=this.options.layer,a=this.options.layer.numlayers,s=Number.NEGATIVE_INFINITY;for(n=0;a>n;n++){i=Number.POSITIVE_INFINITY;for(r in o)o[r]>s&&i>o[r]&&(i=o[r]);s=i;for(e in this.objects)t=this.objects[e],t.visProp.layer===i&&t.prepareUpdate().updateRenderer()}return this},addHook:function(e,t,n){return JXG.exists(t)||(t="update"),n=n||this,this.hooks.push({fn:e,mode:t,context:n}),"update"==t&&e.apply(n,[this]),this.hooks.length-1},removeHook:function(e){return this.hooks[e]=null,this},updateHooks:function(e){var t,n=arguments.length>1?Array.prototype.slice.call(arguments,1):[];for(JXG.exists(e)||(e="update"),t=0;this.hooks.length>t;t++)null!=this.hooks[t]&&this.hooks[t].mode==e&&this.hooks[t].fn.apply(this.hooks[t].context,n);return this},addChild:function(e){return this.dependentBoards.push(e),this.update(),this},removeChild:function(e){var t;for(t=this.dependentBoards.length-1;t>=0;t--)this.dependentBoards[t]==e&&this.dependentBoards.splice(t,1);return this},update:function(e){var t,n,i,r;if(this.isSuspendedUpdate)return this;for(this.prepareUpdate(e).updateElements(e).updateConditions(),this.renderer.suspendRedraw(this),this.updateRenderer(e),this.renderer.unsuspendRedraw(),this.updateHooks(),n=this.dependentBoards.length,t=0;n>t;t++)i=this.dependentBoards[t].id,r=JXG.JSXGraph.boards[i],r!=this&&(r.updateQuality=this.updateQuality,r.prepareUpdate().updateElements().updateConditions(),r.renderer.suspendRedraw(),r.updateRenderer(),r.renderer.unsuspendRedraw(),r.updateHooks());return this},fullUpdate:function(){return this.needsFullUpdate=!0,this.update(),this.needsFullUpdate=!1,this},addGrid:function(){return this.create("grid",[]),this},removeGrids:function(){var e;for(e=0;this.grids.length>e;e++)this.removeObject(this.grids[e]);return this.grids.length=0,this.update(),this},create:function(e,t,n){var i,r;for(e=e.toLowerCase(),JXG.exists(t)||(t=[]),JXG.exists(n)||(n={}),r=0;t.length>r;r++)("text"!=e||2!=r)&&(t[r]=JXG.getReference(this,t[r]));if(null==JXG.JSXGraph.elements[e])throw Error("JSXGraph: JXG.createElement: Unknown element type given: "+e);return i="function"==typeof JXG.JSXGraph.elements[e]?JXG.JSXGraph.elements[e](this,t,n):JXG.JSXGraph.elements[e].creator(this,t,n),JXG.exists(i)?(i.prepareUpdate&&i.update&&i.updateRenderer&&i.prepareUpdate().update().updateRenderer(),i):(JXG.debug("JSXGraph: JXG.createElement: failure creating "+e),i)},createElement:JXG.shortcut(JXG.Board.prototype,"create"),clearTraces:function(){var e;for(e in this.objects)this.objects[e].visProp.trace&&this.objects[e].clearTrace();return this.numTraces=0,this},suspendUpdate:function(){return this.isSuspendedUpdate=!0,this},unsuspendUpdate:function(){return this.isSuspendedUpdate=!1,this.update(),this},setBoundingBox:function(e,t){if(!JXG.isArray(e))return this;var n,i,r=JXG.getDimensions(this.container);return this.canvasWidth=parseInt(r.width),this.canvasHeight=parseInt(r.height),i=this.canvasWidth,n=this.canvasHeight,t?(this.unitX=i/(e[2]-e[0]),this.unitY=n/(e[1]-e[3]),this.unitX<this.unitY?this.unitY=this.unitX:this.unitX=this.unitY):(this.unitX=i/(e[2]-e[0]),this.unitY=n/(e[1]-e[3])),this.moveOrigin(-this.unitX*e[0],this.unitY*e[1]),this},getBoundingBox:function(){var e=new JXG.Coords(JXG.COORDS_BY_SCREEN,[0,0],this),t=new JXG.Coords(JXG.COORDS_BY_SCREEN,[this.canvasWidth,this.canvasHeight],this);return[e.usrCoords[1],e.usrCoords[2],t.usrCoords[1],t.usrCoords[2]]},addAnimation:function(e){return this.animationObjects[e.id]=e,this.animationIntervalCode||(this.animationIntervalCode=window.setInterval("JXG.JSXGraph.boards['"+this.id+"'].animate();",35)),this},stopAllAnimation:function(){var e;for(e in this.animationObjects)null!==this.animationObjects[e]&&(this.animationObjects[e]=null,delete this.animationObjects[e]);return window.clearInterval(this.animationIntervalCode),delete this.animationIntervalCode,this},animate:function(){var e,t,n,i,r,o,a,s=0,l=null;for(e in this.animationObjects)if(null!==this.animationObjects[e]){if(s++,t=this.animationObjects[e],t.animationPath&&(n=JXG.isFunction(t.animationPath)?t.animationPath((new Date).getTime()-t.animationStart):t.animationPath.pop(),!JXG.exists(n)||!JXG.isArray(n)&&isNaN(n)?delete t.animationPath:(t.setPositionDirectly(JXG.COORDS_BY_USER,n[0],n[1]),t.prepareUpdate().update().updateRenderer(),l=t)),t.animationData){o=0;for(i in t.animationData)r=t.animationData[i].pop(),JXG.exists(r)?(o++,t.setProperty(i+":"+r)):delete t.animationData[r];0==o&&delete t.animationData}JXG.exists(t.animationData)||JXG.exists(t.animationPath)||(this.animationObjects[e]=null,delete this.animationObjects[e],JXG.exists(t.animationCallback)&&(a=t.animationCallback,t.animationCallback=null,a()))}return 0==s?(window.clearInterval(this.animationIntervalCode),delete this.animationIntervalCode):this.update(l),this},emulateColorblindness:function(e){var t,n,i=this;if(JXG.exists(e)||(e="none"),this.currentCBDef==e)return this;for(t in i.objects)n=i.objects[t],"none"!=e?("none"==this.currentCBDef&&(n.visPropOriginal={strokecolor:n.visProp.strokecolor,fillcolor:n.visProp.fillcolor,highlightstrokecolor:n.visProp.highlightstrokecolor,highlightfillcolor:n.visProp.highlightfillcolor}),n.setProperty({strokecolor:JXG.rgb2cb(n.visPropOriginal.strokecolor,e),fillcolor:JXG.rgb2cb(n.visPropOriginal.fillcolor,e),highlightstrokecolor:JXG.rgb2cb(n.visPropOriginal.highlightstrokecolor,e),highlightfillcolor:JXG.rgb2cb(n.visPropOriginal.highlightfillcolor,e)})):JXG.exists(n.visPropOriginal)&&JXG.extend(n.visProp,n.visPropOriginal);return this.currentCBDef=e,this.update(),this},getPartialConstruction:function(){var e,t;for(t=1;arguments.length>t;t++)e.push(arguments[t])},createRoulette:function(e,t,n,i,r,o,a){var s=this,l=function(){var l,c=0,u=0,d=0,h=n,p=JXG.Math.Numerics.root(function(n){var i=e.X(h),r=e.Y(h),o=t.X(n),a=t.Y(n);return(i-o)*(i-o)+(r-a)*(r-a)},[0,2*Math.PI]),f=0,g=0,m=s.create("transform",[function(){return c}],{type:"rotate"}),v=s.create("transform",[function(){return c},function(){return e.X(h)},function(){return e.Y(h)}],{type:"rotate"}),b=s.create("transform",[function(){return u},function(){return d}],{type:"translate"}),y=function(e,t,n){var i=JXG.Math.Numerics.D(e.X)(t),r=JXG.Math.Numerics.D(e.Y)(t),o=JXG.Math.Numerics.D(e.X)(n),a=JXG.Math.Numerics.D(e.Y)(n),s=JXG.Math.Numerics.D(e.X)(.5*(t+n)),l=JXG.Math.Numerics.D(e.Y)(.5*(t+n)),c=Math.sqrt(i*i+r*r),u=Math.sqrt(o*o+a*a),d=Math.sqrt(s*s+l*l);return(c+4*d+u)*(n-t)/6},x=function(e){return l-y(t,p,e)},w=Math.PI/18,k=9*w,C=null;return this.rolling=function(){f=h+r*i,l=y(e,h,f),g=JXG.Math.Numerics.root(x,p);var n=new JXG.Complex(e.X(f),e.Y(f)),o=new JXG.Complex(t.X(g),t.Y(g)),C=new JXG.Complex(JXG.Math.Numerics.D(e.X)(f),JXG.Math.Numerics.D(e.Y)(f)),_=new JXG.Complex(JXG.Math.Numerics.D(t.X)(g),JXG.Math.Numerics.D(t.Y)(g)),T=JXG.C.div(C,_);c=Math.atan2(T.imaginary,T.real),T.div(JXG.C.abs(T)),T.mult(o),u=n.real-T.real,d=n.imaginary-T.imaginary,-w>c&&c>-k?(c=-w,v.applyOnce(a)):c>w&&k>c?(c=w,v.applyOnce(a)):(m.applyOnce(a),b.applyOnce(a),h=f,p=g),s.update()},this.start=function(){return o>0&&(C=setInterval(this.rolling,o)),this},this.stop=function(){return clearInterval(C),this},this};return new l}}),JXG.Options={showCopyright:!0,showNavigation:!0,takeSizeFromFile:!1,renderer:"svg",takeFirst:!1,zoom:{factorX:1.25,factorY:1.25},navbar:{strokeColor:"#aaaaaa",fillColor:"#f5f5f5",padding:"2px",position:"absolute",fontSize:"10px",cursor:"pointer",zIndex:"100",right:"5px",bottom:"5px"},elements:{strokeColor:"#0000ff",highlightStrokeColor:"#C3D9FF",fillColor:"red",highlightFillColor:"none",strokeOpacity:1,highlightStrokeOpacity:1,fillOpacity:1,highlightFillOpacity:1,strokeWidth:2,highlightStrokeWidth:2,fixed:!1,frozen:!1,withLabel:!1,visible:!0,layer:0,dash:0,shadow:!1,trace:!1,needsRegularUpdate:!0,draft:{draft:!1,strokeColor:"#565656",fillColor:"#565656",strokeOpacity:.8,fillOpacity:.8,strokeWidth:1}},ticks:{drawLabels:!1,drawZero:!1,insertTicks:!1,minTicksDistance:50,minorHeight:4,majorHeight:10,minorTicks:4,ticksDistance:1,strokeOpacity:1,strokeWidth:1,strokeColor:"black",highlightStrokeColor:"#888888"},precision:{touch:30,mouse:4,epsilon:1e-4,hasPoint:4},layer:{numlayers:20,text:9,point:9,arc:8,line:7,circle:6,curve:5,polygon:3,sector:3,angle:3,integral:3,axis:2,grid:1,image:0,trace:0},angle:{withLabel:!0,radius:1,fillColor:"#FF7F00",highlightFillColor:"#FF7F00",strokeColor:"#FF7F00",textColor:"#0000FF",fillOpacity:.3,highlightFillOpacity:.3,point:{withLabel:!1,visible:!1,name:""},dot:{visible:!1,strokeColor:"none",fillColor:"black",size:2,face:"o",withLabel:!1,name:""}},arc:{firstArrow:!1,lastArrow:!1,fillColor:"none",highlightFillColor:"none",strokeColor:"#0000ff",highlightStrokeColor:"#C3D9FF",useDirection:!1,center:{visible:!1,withLabel:!1,fixed:!1,name:""}},axis:{needsRegularUpdate:!1,strokeWidth:1,strokeColor:"#666666",highlightStrokeWidth:1,highlightStrokeColor:"#888888",withTicks:!0,straightFirst:!0,straightLast:!0,lastArrow:!0,withLabel:!1,ticks:{needsRegularUpdate:!1,strokeWidth:1,strokeColor:"#666666",highlightStrokeColor:"#888888",drawLabels:!0,drawZero:!0,insertTicks:!0,minTicksDistance:50,minorHeight:4,majorHeight:-1,minorTicks:4,ticksDistance:1,strokeOpacity:.25},point1:{needsRegularUpdate:!1},point2:{needsRegularUpdate:!1}},bisector:{strokeColor:"#000000",point:{visible:!1,fixed:!1,withLabel:!1,name:""}},bisectorlines:{line1:{strokeColor:"red"},line2:{strokeColor:"black"}},chart:{chartStyle:"line",colors:["#B02B2C","#3F4C6B","#C79810","#D15600","#FFFF88","#C3D9FF","#4096EE","#008C00"],highlightcolors:null,fillcolor:null,highlightonsector:!1,highlightbysize:!1},circle:{fillColor:"none",highlightFillColor:"none",strokeColor:"#0000ff",highlightStrokeColor:"#C3D9FF",center:{visible:!1,withLabel:!1,fixed:!1,name:""}},circumcircle:{fillColor:"none",highlightFillColor:"none",strokeColor:"#0000ff",highlightStrokeColor:"#C3D9FF",point:{visible:!1,fixed:!1,withLabel:!1,name:""}},circumcirclesector:{useDirection:!0,fillColor:"#00FF00",highlightFillColor:"#00FF00",fillOpacity:.3,highlightFillOpacity:.3,strokeColor:"#0000ff",highlightStrokeColor:"#C3D9FF",point:{visible:!1,fixed:!1,withLabel:!1,name:""}},conic:{fillColor:"none",highlightFillColor:"none",strokeColor:"#0000ff",highlightStrokeColor:"#C3D9FF",foci:{fixed:!1,visible:!1,withLabel:!1,name:""}},curve:{strokeWidth:1,strokeColor:"#0000ff",fillColor:"none",curveType:null,RDPsmoothing:!1,numberPointsHigh:1600,numberPointsLow:400,doAdvancedPlot:!0},grid:{needsRegularUpdate:!1,hasGrid:!1,gridX:1,gridY:1,strokeColor:"#C0C0C0",strokeOpacity:"0.5",strokeWidth:1,dash:2,snapToGrid:!1,snapSizeX:2,snapSizeY:2},image:{imageString:null,fillOpacity:1},incircle:{fillColor:"none",highlightFillColor:"none",strokeColor:"#0000ff",highlightStrokeColor:"#C3D9FF",point:{visible:!1,fixed:!1,withLabel:!1,name:""}},integral:{withLabel:!0,strokeWidth:0,strokeOpacity:0,start:{visible:!0},startproject:{visible:!1,fixed:!1,withLabel:!1,name:""},end:{visible:!0},endproject:{visible:!1,fixed:!1,withLabel:!1,name:""},text:{fontSize:20}},legend:{style:"vertical",labels:["1","2","3","4","5","6","7","8"],colors:["#B02B2C","#3F4C6B","#C79810","#D15600","#FFFF88","#C3D9FF","#4096EE","#008C00"]},line:{firstArrow:!1,lastArrow:!1,straightFirst:!0,straightLast:!0,fillColor:"none",highlightFillColor:"none",strokeColor:"#0000ff",highlightStrokeColor:"#888888",withTicks:!1,point1:{visible:!1,withLabel:!1,fixed:!1,name:""},point2:{visible:!1,withLabel:!1,fixed:!1,name:""},ticks:{drawLabels:!0,drawZero:!1,insertTicks:!1,minTicksDistance:50,maxTicksDistance:300,minorHeight:4,majorHeight:-1,minorTicks:4,defaultDistance:1,strokeOpacity:.3},labelOffsets:[10,10]},locus:{translateToOrigin:!1,translateTo10:!1,stretch:!1,toOrigin:null,to10:null},parallel:{strokeColor:"#000000",point:{visible:!1,fixed:!0,withLabel:!1,name:""}},perpendicular:{strokeColor:"#000000",straightFirst:!1,straightLast:!1,point:{visible:!1,fixed:!0,withLabel:!1,name:""}},point:{withLabel:!0,style:5,face:"o",size:3,fillColor:"#ff0000",highlightFillColor:"#EEEEEE",strokeWidth:2,strokeColor:"#ff0000",highlightStrokeColor:"#C3D9FF",zoom:!1,showInfobox:!0,draft:!1},polygon:{fillColor:"#00FF00",highlightFillColor:"#00FF00",fillOpacity:.3,highlightFillOpacity:.3,withLines:!0,lines:{withLabel:!1,strokeWidth:1,highlightStrokeWidth:1,layer:5},points:{withLabel:!0,strokeColor:"#ff0000",fillColor:"#ff0000",fixed:!0}},riemannsum:{withLabel:!1,fillOpacity:.3,fillColor:"#ffff00"},sector:{fillColor:"#00FF00",highlightFillColor:"#00FF00",fillOpacity:.3,highlightFillOpacity:.3},slider:{snapWidth:-1,precision:2,firstArrow:!1,lastArrow:!1,withTicks:!0,withLabel:!0,point1:{needsRegularUpdate:!1,showInfobox:!1,withLabel:!1,visible:!1,fixed:!0,name:""},point2:{needsRegularUpdate:!1,showInfobox:!1,withLabel:!1,visible:!1,fixed:!0,name:""},glider:{showInfobox:!1,name:"",withLabel:!1,visible:!0,strokeColor:"#000000",highlightStrokeColor:"#888888",fillColor:"#ffffff",highlightFillColor:"none",size:6},segment1:{needsRegularUpdate:!1,name:"",strokeWidth:1,strokeColor:"#000000",highlightStrokeColor:"#888888"},ticks:{needsRegularUpdate:!1,drawLabels:!1,drawZero:!0,insertTicks:!0,minorHeight:4,majorHeight:10,minorTicks:0,defaultDistance:1,strokeOpacity:1,strokeWidth:1,strokeColor:"#000000"},segment2:{strokeWidth:3,name:"",strokeColor:"#000000",highlightStrokeColor:"#888888"},text:{strokeColor:"#000000"}},text:{fontSize:12,digits:2,isLabel:!1,strokeColor:"#000000",useASCIIMathML:!1,useMathJax:!1,display:"html",withLabel:!1},shortcuts:{color:["strokeColor","fillColor"],opacity:["strokeOpacity","fillOpacity"],highlightColor:["highlightStrokeColor","highlightFillColor"],highlightOpacity:["highlightStrokeOpacity","highlightFillOpacity"],strokeWidth:["strokeWidth","highlightStrokeWidth"]}},JXG.Validator=function(){var e,t=function(e){return/^[0-9]+px$/.test(e) },n=function(e){return e in{html:0,internal:0}},i=function(e){return JXG.isString(e)},r=function(e){return JXG.exists(JXG.Point.prototype.normalizeFace.call(this,e))},o=function(e){return Math.abs(e-Math.round(e))<JXG.Math.eps},a=function(e){return o(e)&&e>0},s=function(e){return e.length>=2&&o(e[0])&&o(e[1])},l=function(e){return e in{vml:0,svg:0,canvas:0}},c={},u={color:i,defaultDistance:JXG.isNumber,display:n,doAdvancedPlot:!1,draft:!1,drawLabels:!1,drawZero:!1,face:r,factor:JXG.isNumber,fillColor:i,fillOpacity:JXG.isNumber,firstArrow:!1,fontSize:o,dash:o,gridX:JXG.isNumber,gridY:JXG.isNumber,hasGrid:!1,highlightFillColor:i,highlightFillOpacity:JXG.isNumber,highlightStrokeColor:i,highlightStrokeOpacity:JXG.isNumber,insertTicks:!1,labelOffsets:s,lastArrow:!1,majorHeight:o,maxTicksDistance:a,minorHeight:o,minorTicks:a,minTicksDistance:a,numberPointsHigh:a,numberPointsLow:a,opacity:JXG.isNumber,radius:JXG.isNumber,RDPsmoothing:!1,renderer:l,right:t,showCopyright:!1,showInfobox:!1,showNavigation:!1,size:o,snapSizeX:JXG.isNumber,snapSizeY:JXG.isNumber,snapWidth:JXG.isNumber,snapToGrid:!1,straightFirst:!1,straightLast:!1,stretch:!1,strokeColor:i,strokeOpacity:JXG.isNumber,strokeWidth:o,takeFirst:!1,takeSizeFromFile:!1,textColor:i,to10:!1,toOrigin:!1,translateTo10:!1,translateToOrigin:!1,useASCIIMathML:!1,useDirection:!1,useMathJax:!1,withLabel:!1,withTicks:!1,zoom:!1};for(e in u)c[e.toLowerCase()]=u[e];return c}(),JXG.useStandardOptions=function(e){var t,n,i,r,o=JXG.Options,a=e.hasGrid;e.options.grid.hasGrid=o.grid.hasGrid,e.options.grid.gridX=o.grid.gridX,e.options.grid.gridY=o.grid.gridY,e.options.grid.gridColor=o.grid.gridColor,e.options.grid.gridOpacity=o.grid.gridOpacity,e.options.grid.gridDash=o.grid.gridDash,e.options.grid.snapToGrid=o.grid.snapToGrid,e.options.grid.snapSizeX=o.grid.SnapSizeX,e.options.grid.snapSizeY=o.grid.SnapSizeY,e.takeSizeFromFile=o.takeSizeFromFile,r=function(e,t){e.visProp.fillcolor=t.fillColor,e.visProp.highlightfillcolor=t.highlightFillColor,e.visProp.strokecolor=t.strokeColor,e.visProp.highlightstrokecolor=t.highlightStrokeColor};for(t in e.objects)if(i=e.objects[t],i.elementClass==JXG.OBJECT_CLASS_POINT)r(i,o.point);else if(i.elementClass==JXG.OBJECT_CLASS_LINE){r(i,o.line);for(n in i.ticks)n.majorTicks=o.line.ticks.majorTicks,n.minTicksDistance=o.line.ticks.minTicksDistance,n.visProp.minorheight=o.line.ticks.minorHeight,n.visProp.majorheight=o.line.ticks.majorHeight}else i.elementClass==JXG.OBJECT_CLASS_CIRCLE?r(i,o.circle):i.type==JXG.OBJECT_TYPE_ANGLE?r(i,o.angle):i.type==JXG.OBJECT_TYPE_ARC?r(i,o.arc):i.type==JXG.OBJECT_TYPE_POLYGON?r(i,o.polygon):i.type==JXG.OBJECT_TYPE_CONIC?r(i,o.conic):i.type==JXG.OBJECT_TYPE_CURVE?r(i,o.curve):i.type==JXG.OBJECT_TYPE_SECTOR&&(i.arc.visProp.fillcolor=o.sector.fillColor,i.arc.visProp.highlightfillcolor=o.sector.highlightFillColor,i.arc.visProp.fillopacity=o.sector.fillOpacity,i.arc.visProp.highlightfillopacity=o.sector.highlightFillOpacity);e.fullUpdate(),a&&!e.hasGrid?e.removeGrids(e):!a&&e.hasGrid&&e.create("grid",[])},JXG.useBlackWhiteOptions=function(e){var t=JXG.Options;t.point.fillColor=JXG.rgb2bw(t.point.fillColor),t.point.highlightFillColor=JXG.rgb2bw(t.point.highlightFillColor),t.point.strokeColor=JXG.rgb2bw(t.point.strokeColor),t.point.highlightStrokeColor=JXG.rgb2bw(t.point.highlightStrokeColor),t.line.fillColor=JXG.rgb2bw(t.line.fillColor),t.line.highlightFillColor=JXG.rgb2bw(t.line.highlightFillColor),t.line.strokeColor=JXG.rgb2bw(t.line.strokeColor),t.line.highlightStrokeColor=JXG.rgb2bw(t.line.highlightStrokeColor),t.circle.fillColor=JXG.rgb2bw(t.circle.fillColor),t.circle.highlightFillColor=JXG.rgb2bw(t.circle.highlightFillColor),t.circle.strokeColor=JXG.rgb2bw(t.circle.strokeColor),t.circle.highlightStrokeColor=JXG.rgb2bw(t.circle.highlightStrokeColor),t.arc.fillColor=JXG.rgb2bw(t.arc.fillColor),t.arc.highlightFillColor=JXG.rgb2bw(t.arc.highlightFillColor),t.arc.strokeColor=JXG.rgb2bw(t.arc.strokeColor),t.arc.highlightStrokeColor=JXG.rgb2bw(t.arc.highlightStrokeColor),t.polygon.fillColor=JXG.rgb2bw(t.polygon.fillColor),t.polygon.highlightFillColor=JXG.rgb2bw(t.polygon.highlightFillColor),t.sector.fillColor=JXG.rgb2bw(t.sector.fillColor),t.sector.highlightFillColor=JXG.rgb2bw(t.sector.highlightFillColor),t.curve.strokeColor=JXG.rgb2bw(t.curve.strokeColor),t.grid.gridColor=JXG.rgb2bw(t.grid.gridColor),JXG.useStandardOptions(e)},JXG.JSXGraph={licenseText:"JSXGraph v0.92 Copyright (C) see http://jsxgraph.org",boards:{},elements:{},rendererType:function(){function e(){document.body.scrollLeft,document.body.scrollTop}var t,n;for(JXG.supportsSVG()?JXG.Options.renderer="svg":JXG.supportsVML()?(JXG.Options.renderer="vml",document.onmousemove=e):JXG.Options.renderer="canvas",n=JXG.rendererFiles[JXG.Options.renderer].split(","),t=0;n.length>t;t++)(function(e){JXG.require(JXG.requirePath+e+".js")})(n[t]);return JXG.Options.renderer}(),initBoard:function(e,t){var n,i,r,o,a,s,l,c,u,d,h,p,f,g,m;return c=JXG.getDimensions(e),t===void 0&&(t={}),t.boundingbox!==void 0?(u=t.boundingbox,s=parseInt(c.width),l=parseInt(c.height),t.keepaspectratio?(o=s/(u[2]-u[0]),a=l/(-u[3]+u[1]),a>o?a=o:o=a):(o=s/(u[2]-u[0]),a=l/(-u[3]+u[1])),i=-o*u[0],r=a*u[1]):(i=t.originX===void 0?150:t.originX,r=t.originY===void 0?150:t.originY,o=t.unitX===void 0?50:t.unitX,a=t.unitY===void 0?50:t.unitY),d=t.zoom===void 0?1:t.zoom,h=d*(t.zoomX===void 0?1:t.zoomX),p=d*(t.zoomY===void 0?1:t.zoomY),f=t.showCopyright===void 0?JXG.Options.showCopyright:t.showCopyright,n="svg"==JXG.Options.renderer?new JXG.SVGRenderer(document.getElementById(e)):"vml"==JXG.Options.renderer?new JXG.VMLRenderer(document.getElementById(e)):"silverlight"==JXG.Options.renderer?new JXG.SilverlightRenderer(document.getElementById(e),c.width,c.height):new JXG.CanvasRenderer(document.getElementById(e)),m=new JXG.Board(e,n,"",[i,r],h,p,o,a,c.width,c.height,f),this.boards[m.id]=m,m.keepaspectratio=t.keepaspectratio,m.suspendUpdate(),m.initInfobox(),t.axis&&(m.defaultAxes={},m.defaultAxes.x=m.create("axis",[[0,0],[1,0]],{ticks:{drawZero:!0}}),m.defaultAxes.y=m.create("axis",[[0,0],[0,1]],{ticks:{drawZero:!1}})),t.grid&&m.create("grid",[]),t.shownavigation!==void 0&&(t.showNavigation=t.shownavigation),g=t.showNavigation===void 0?m.options.showNavigation:t.showNavigation,g&&m.renderer.drawZoomBar(m),m.unsuspendUpdate(),m},loadBoardFromFile:function(e,t,n){var i,r,o;return i="svg"==JXG.Options.renderer?new JXG.SVGRenderer(document.getElementById(e)):"vml"==JXG.Options.renderer?new JXG.VMLRenderer(document.getElementById(e)):"silverlight"==JXG.Options.renderer?new JXG.SilverlightRenderer(document.getElementById(e),o.width,o.height):new JXG.CanvasRenderer(document.getElementById(e)),o=JXG.getDimensions(e),r=new JXG.Board(e,i,"",[150,150],1,1,50,50,o.width,o.height),r.initInfobox(),JXG.FileReader.parseFileContent(t,r,n),r.options.showNavigation&&r.renderer.drawZoomBar(r),this.boards[r.id]=r,r},loadBoardFromString:function(e,t,n){var i,r,o;return i="svg"==JXG.Options.renderer?new JXG.SVGRenderer(document.getElementById(e)):"vml"==JXG.Options.renderer?new JXG.VMLRenderer(document.getElementById(e)):"silverlight"==JXG.Options.renderer?new JXG.SilverlightRenderer(document.getElementById(e),r.width,r.height):new JXG.CanvasRenderer(document.getElementById(e)),r=JXG.getDimensions(e),o=new JXG.Board(e,i,"",[150,150],1,1,50,50,r.width,r.height),o.initInfobox(),JXG.FileReader.parseString(t,o,n,!0),o.options.showNavigation&&o.renderer.drawZoomBar(o),this.boards[o.id]=o,o},freeBoard:function(e){var t,n;"string"==typeof e&&(e=this.boards[e]),e.removeEventHandlers();for(t in e.objects)e.removeObject(e.objects[t]);for(n=0;e.containerObj.childNodes.length>n;n++)e.containerObj.removeChild(e.containerObj.childNodes[n]);for(t in e.objects)delete e.objects[t];delete e.renderer,delete e.algebra,delete this.boards[e.id]},registerElement:function(e,t){if(e=e.toLowerCase(),this.elements[e]=t,JXG.Board.prototype["_"+e])throw Error("JSXGraph: Can't create wrapper method in JXG.Board because member '_"+e+"' already exists'");JXG.Board.prototype["_"+e]=function(t,n){return this.create(e,t,n)}},unregisterElement:function(e){delete this.elements[e.toLowerCase()],delete JXG.Board.prototype["_"+e.toLowerCase()]}},JXG.OBJECT_TYPE_ARC=1330921795,JXG.OBJECT_TYPE_ARROW=1330921815,JXG.OBJECT_TYPE_AXIS=1330921816,JXG.OBJECT_TYPE_AXISPOINT=83181904,JXG.OBJECT_TYPE_TICKS=1330926680,JXG.OBJECT_TYPE_CIRCLE=1330922316,JXG.OBJECT_TYPE_CONIC=1330922319,JXG.OBJECT_TYPE_CURVE=1330923344,JXG.OBJECT_TYPE_GLIDER=1330923340,JXG.OBJECT_TYPE_IMAGE=1330926157,JXG.OBJECT_TYPE_LINE=1330924622,JXG.OBJECT_TYPE_POINT=1330925652,JXG.OBJECT_TYPE_SLIDER=1330926404,JXG.OBJECT_TYPE_CAS=1330922320,JXG.OBJECT_TYPE_POLYGON=1330925657,JXG.OBJECT_TYPE_SECTOR=1330926403,JXG.OBJECT_TYPE_TEXT=1330926661,JXG.OBJECT_TYPE_ANGLE=1330921799,JXG.OBJECT_TYPE_INTERSECTION=1330926158,JXG.OBJECT_TYPE_TURTLE=5198933,JXG.OBJECT_TYPE_VECTOR=1330927188,JXG.OBJECT_CLASS_POINT=1,JXG.OBJECT_CLASS_LINE=2,JXG.OBJECT_CLASS_CIRCLE=3,JXG.OBJECT_CLASS_CURVE=4,JXG.OBJECT_CLASS_AREA=5,JXG.OBJECT_CLASS_OTHER=6,JXG.GeometryElement=function(e,t,n,i){var r,o;if(this.needsUpdate=!0,this.isDraggable=!1,this.isReal=!0,this.childElements={},this.hasLabel=!1,this.notExistingParents={},this.traces={},this.numTraces=0,this.transformations=[],this.baseElement=null,this.descendants={},this.ancestors={},this.symbolic={},this.stdform=[1,0,0,0,1,1,0,0],this.quadraticform=[[1,0,0],[0,1,0],[0,0,1]],arguments.length>0){this.board=e,this.type=n,this.elementClass=i||JXG.OBJECT_CLASS_OTHER,this.id=t.id,r=t.name,JXG.exists(r)||(r=this.board.generateName(this)),this.board.elementsByName[r]=this,this.name=r,this.needsRegularUpdate=t.needsregularupdate,this.visProp={},JXG.clearVisPropOld(this),t=this.resolveShortcuts(t);for(o in t)this._set(o,t[o]);this.visProp.draft=t.draft&&t.draft.draft,this.visProp.gradientangle="270",this.visProp.gradientsecondopacity=this.visProp.fillopacity,this.visProp.gradientpositionx=.5,this.visProp.gradientpositiony=.5}},JXG.extend(JXG.GeometryElement.prototype,{addChild:function(e){var t,n;this.childElements[e.id]=e,this.addDescendants(e),e.ancestors[this.id]=this;for(t in this.descendants){this.descendants[t].ancestors[this.id]=this;for(n in this.ancestors)this.descendants[t].ancestors[this.ancestors[n].id]=this.ancestors[n]}for(t in this.ancestors)for(n in this.descendants)this.ancestors[t].descendants[this.descendants[n].id]=this.descendants[n];return this},addDescendants:function(e){var t;this.descendants[e.id]=e;for(t in e.childElements)this.addDescendants(e.childElements[t]);return this},countChildren:function(){var e,t,n=0;t=this.childElements;for(e in t)t.hasOwnProperty(e)&&0>e.indexOf("Label")&&n++;return n},draggable:function(){return this.isDraggable&&!this.visProp.fixed&&!this.visProp.frozen&&this.type!=JXG.OBJECT_TYPE_GLIDER&&1>=this.countChildren()?!0:!1},generatePolynomial:function(){return[]},animate:function(e,t,n){n=n||{};var i,r,o,a=35,s=Math.ceil(t/(1*a)),l=this;this.animationData={};var c=function(e,t,n){var i,r,a,c,u;for(i=JXG.rgb2hsv(e),r=JXG.rgb2hsv(t),a=(r[0]-i[0])/(1*s),c=(r[1]-i[1])/(1*s),u=(r[2]-i[2])/(1*s),l.animationData[n]=Array(s),o=0;s>o;o++)l.animationData[n][s-o-1]=JXG.hsv2rgb(i[0]+(o+1)*a,i[1]+(o+1)*c,i[2]+(o+1)*u)},u=function(e,t,n){if(e=parseFloat(e),t=parseFloat(t),!isNaN(e)&&!isNaN(t)){var i=(t-e)/(1*s);for(l.animationData[n]=Array(s),o=0;s>o;o++)l.animationData[n][s-o-1]=e+(o+1)*i}};for(i in e)switch(r=i.toLowerCase()){case"strokecolor":case"fillcolor":c(this.visProp[r],e[i],r);break;case"strokeopacity":case"strokewidth":case"fillopacity":u(this.visProp[r],e[i],r)}return this.animationCallback=n.callback,this.board.addAnimation(this),this},update:function(){return this.visProp.trace&&this.cloneToBackground(!0),this},updateRenderer:function(){return this},hideElement:function(){return this.visProp.visible=!1,this.board.renderer.hide(this),null!=this.label&&this.hasLabel&&(this.label.hiddenByParent=!0,this.label.content.visProp.visible&&this.board.renderer.hide(this.label.content)),this},showElement:function(){return this.visProp.visible=!0,this.board.renderer.show(this),null!=this.label&&this.hasLabel&&this.label.hiddenByParent&&(this.label.hiddenByParent=!1,this.label.content.visProp.visible&&this.board.renderer.show(this.label.content)),this},_set:function(e,t){e=e.toLocaleLowerCase(),this.visProp.hasOwnProperty(e)&&e.indexOf("color")>=0&&JXG.isString(t)&&9==t.length&&"#"===t.charAt(0)?(t=JXG.rgba2rgbo(t),this.visProp[e]=t[0],this.visProp[e.replace("color","opacity")]=t[1]):this.visProp[e]=t},resolveShortcuts:function(e){var t,n;for(t in JXG.Options.shortcuts)if(JXG.exists(e[t]))for(n=0;JXG.Options.shortcuts[t].length>n;n++)JXG.exists(e[JXG.Options.shortcuts[t][n]])||(e[JXG.Options.shortcuts[t][n]]=e[t]);return e},setAttribute:JXG.shortcut(JXG.GeometryElement.prototype,"setProperty"),setProperty:function(){var e,t,n,i,r,o,a={};for(e=0;arguments.length>e;e++)i=arguments[e],JXG.isString(i)?(o=i.split(":"),a[JXG.trim(o[0])]=JXG.trim(o[1])):JXG.isArray(i)?a[i[0]]=i[1]:JXG.extend(a,i);a=this.resolveShortcuts(a);for(e in a)switch(t=e.replace(/\s+/g,"").toLowerCase(),n=a[e],t){case"name":delete this.board.elementsByName[this.name],this.name=n,this.board.elementsByName[this.name]=this;break;case"needsregularupdate":this.needsRegularUpdate=!("false"==n||0==n),this.board.renderer.setBuffering(this,this.needsRegularUpdate?"auto":"static");break;case"labelcolor":n=JXG.rgba2rgbo(n),r=n[1],n=n[0],0==r&&null!=this.label&&this.hasLabel&&this.label.content.hideElement(),null!=this.label&&this.hasLabel&&(this.label.color=n,this.board.renderer.setObjectStrokeColor(this.label.content,n,r)),this.type==JXG.OBJECT_TYPE_TEXT&&(this.visProp.strokecolor=n,this.visProp.strokeopacity=r,this.board.renderer.setObjectStrokeColor(this,this.visProp.strokecolor,this.visProp.strokeopacity));break;case"infoboxtext":this.infoboxText="string"==typeof n?n:!1;break;case"visible":"false"==n||0==n?(this.visProp.visible=!1,this.hideElement()):("true"==n||1==n)&&(this.visProp.visible=!0,this.showElement());break;case"face":this.elementClass==JXG.OBJECT_CLASS_POINT&&(this.visProp.face=n,this.board.renderer.changePointStyle(this));break;case"gradient":this.visProp.gradient=n,this.board.renderer.setGradient(this);break;case"gradientsecondcolor":n=JXG.rgba2rgbo(n),this.visProp.gradientsecondcolor=n[1],this.visProp.gradientsecondopacity=n[0],this.board.renderer.updateGradient(this);break;case"gradientsecondopacity":this.visProp.gradientsecondopacity=n,this.board.renderer.updateGradient(this);break;case"withlabel":this.visProp.withlabel=n,n?null!=this.label&&this.hasLabel?this.visProp.visible&&this.label.content.showElement():(this.createLabel(),this.visProp.visible||this.label.content.hideElement()):JXG.exists(this.label)&&this.hasLabel&&this.label.content.hideElement(),this.hasLabel=n;break;default:JXG.exists(this.visProp[t])&&(!JXG.Validator[t]||JXG.Validator[t]&&JXG.Validator[t](n))&&(n=n.toLowerCase&&"false"===n.toLowerCase()?!1:n,this._set(t,n))}return this.board.update(this),this},getAttribute:JXG.shortcut(JXG.GeometryElement.prototype,"getProperty"),getProperty:function(e){var t;switch(e=e.toLowerCase()){case"needsregularupdate":t=this.needsRegularUpdate;break;case"labelcolor":t=this.label.color;break;case"infoboxtext":t=this.infoboxText;break;case"withlabel":t=this.hasLabel;break;default:t=this.visProp[e]}return t},setDash:function(e){return this.setProperty({dash:e}),this},prepareUpdate:function(){return this.needsUpdate=!0,this},remove:function(){return this.board.renderer.remove(this.board.renderer.getElementById(this.id)),this.hasLabel&&this.board.renderer.remove(this.board.renderer.getElementById(this.label.content.id)),this},getTextAnchor:function(){return new JXG.Coords(JXG.COORDS_BY_USER,[0,0],this.board)},getLabelAnchor:function(){return new JXG.Coords(JXG.COORDS_BY_USER,[0,0],this.board)},setStraight:function(){return this},setArrow:function(e,t){return this.visProp.firstarrow=e,this.visProp.lastarrow=t,this.prepareUpdate().update(),this},createGradient:function(){("linear"===this.visProp.gradient||"radial"===this.visProp.gradient)&&this.board.renderer.setGradient(this)},createLabel:function(e){return JXG.exists(e)||(e=[10,10]),this.nameHTML=JXG.GeonextParser.replaceSup(JXG.GeonextParser.replaceSub(this.name)),this.label={},this.visProp.withlabel&&(this.label.relativeCoords=e,this.label.content=JXG.createText(this.board,[this.label.relativeCoords[0],-this.label.relativeCoords[1],this.nameHTML],{anchor:this,id:this.id+"Label",isLabel:!0,visible:this.visProp.visible,strokeColor:this.visProp.labelcolor||this.board.options.text.strokeColor}),this.label.color=this.label.content.visProp.strokecolor,this.visProp.visible||(this.label.hiddenByParent=!0,this.label.content.visProp.visible=!1),this.hasLabel=!0),this},highlight:function(){return this.board.renderer.highlight(this),this},noHighlight:function(){return this.board.renderer.noHighlight(this),this},clearTrace:function(){var e;for(e in this.traces)this.board.renderer.remove(this.traces[e]);return this.numTraces=0,this},cloneToBackground:function(){return this},bounds:function(){},normalize:function(){return this.stdform=JXG.Math.normalize(this.stdform),this},toJSON:function(){var e='{"name":'+this.name;e+=', "id":'+this.id;var t=[];for(var n in this.visProp)null!=this.visProp[n]&&t.push('"'+n+'":'+this.visProp[n]);return e+=', "visProp":{'+(""+t)+"}",e+="}"},highlightStrokeColor:function(e){return this.setProperty({highlightStrokeColor:e}),this},strokeColor:function(e){return this.setProperty({strokeColor:e}),this},strokeWidth:function(e){return this.setProperty({strokeWidth:e}),this},fillColor:function(e){return this.setProperty({fillColor:e}),this},highlightFillColor:function(e){return this.setProperty({highlightFillColor:e}),this},labelColor:function(e){return this.setProperty({labelColor:e}),this},dash:function(e){return this.setProperty({dash:e}),this},visible:function(e){return this.setProperty({visible:e}),this},shadow:function(e){return this.setProperty({shadow:e}),this}}),JXG.clearVisPropOld=function(e){e.visPropOld={strokecolor:"",strokeopacity:"",strokewidth:"",fillcolor:"",fillopacity:"",shadow:!1,firstarrow:!1,lastarrow:!1}},JXG.COORDS_BY_USER=1,JXG.COORDS_BY_SCREEN=2,JXG.Coords=function(e,t,n){this.board=n,this.usrCoords=[],this.scrCoords=[],this.setCoordinates(e,t)},JXG.extend(JXG.Coords.prototype,{normalizeUsrCoords:function(){var e=JXG.Math.eps;Math.abs(this.usrCoords[0])>e&&(this.usrCoords[1]/=this.usrCoords[0],this.usrCoords[2]/=this.usrCoords[0],this.usrCoords[0]=1)},usr2screen:function(e){var t=Math.round,n=this.board,i=this.usrCoords,r=n.origin.scrCoords;null===e||e?(this.scrCoords[0]=t(i[0]),this.scrCoords[1]=t(i[0]*r[1]+i[1]*n.unitX),this.scrCoords[2]=t(i[0]*r[2]-i[2]*n.unitY)):(this.scrCoords[0]=i[0],this.scrCoords[1]=i[0]*r[1]+i[1]*n.unitX,this.scrCoords[2]=i[0]*r[2]-i[2]*n.unitY)},screen2usr:function(){var e=this.board.origin.scrCoords,t=this.scrCoords,n=this.board;this.usrCoords[0]=1,this.usrCoords[1]=(t[1]-e[1])/n.unitX,this.usrCoords[2]=(e[2]-t[2])/n.unitY},distance:function(e,t){var n,i,r=0,o=this.usrCoords,a=this.scrCoords;return e===JXG.COORDS_BY_USER?(n=t.usrCoords,i=o[0]-n[0],r=i*i,i=o[1]-n[1],r+=i*i,i=o[2]-n[2],r+=i*i):(n=t.scrCoords,i=a[0]-n[0],r=i*i,i=a[1]-n[1],r+=i*i,i=a[2]-n[2],r+=i*i),Math.sqrt(r)},setCoordinates:function(e,t,n){var i=this.usrCoords,r=this.scrCoords;e===JXG.COORDS_BY_USER?(2===t.length?(i[0]=1,i[1]=t[0],i[2]=t[1]):(i[0]=t[0],i[1]=t[1],i[2]=t[2],this.normalizeUsrCoords()),this.usr2screen(n)):(r[1]=t[0],r[2]=t[1],this.screen2usr())}}),JXG.Point=function(e,t,n){this.constructor(e,n,JXG.OBJECT_TYPE_POINT,JXG.OBJECT_CLASS_POINT),null==t&&(t=[0,0]),this.coords=new JXG.Coords(JXG.COORDS_BY_USER,t,this.board),this.initialCoords=new JXG.Coords(JXG.COORDS_BY_USER,t,this.board),this.position=null,this.onPolygon=!1,this.slideObject=null,this.group=[],this.id=this.board.setId(this,"P"),this.board.renderer.drawPoint(this),this.board.finalizeAdding(this),this.createLabel()},JXG.Point.prototype=new JXG.GeometryElement,JXG.extend(JXG.Point.prototype,{hasPoint:function(e,t){var n,i=this.coords.scrCoords;return n=parseFloat(this.visProp.size),this.board.options.precision.hasPoint>n&&(n=this.board.options.precision.hasPoint),n+2>Math.abs(i[1]-e)&&n+2>Math.abs(i[2]-t)},updateConstraint:function(){return this},update:function(e){var t,n,i,r,o,a,s,l,c,u,d,h,p,f;if(!this.needsUpdate)return this;if(e===void 0&&(e=!1),this.visProp.trace&&this.cloneToBackground(!0),this.type==JXG.OBJECT_TYPE_GLIDER)if(this.slideObject.elementClass==JXG.OBJECT_CLASS_CIRCLE)e?(this.coords.setCoordinates(JXG.COORDS_BY_USER,[this.slideObject.midpoint.X()+Math.cos(this.position),this.slideObject.midpoint.Y()+Math.sin(this.position)]),this.coords=JXG.Math.Geometry.projectPointToCircle(this,this.slideObject,this.board)):(this.coords=JXG.Math.Geometry.projectPointToCircle(this,this.slideObject,this.board),this.position=JXG.Math.Geometry.rad([this.slideObject.midpoint.X()+1,this.slideObject.midpoint.Y()],this.slideObject.midpoint,this));else if(this.slideObject.elementClass==JXG.OBJECT_CLASS_LINE){if(this.coords=JXG.Math.Geometry.projectPointToLine(this,this.slideObject,this.board),n=this.slideObject.point1.coords,i=this.slideObject.point2.coords,e?Math.abs(n.usrCoords[0])>=JXG.Math.eps&&Math.abs(i.usrCoords[0])>=JXG.Math.eps&&this.coords.setCoordinates(JXG.COORDS_BY_USER,[n.usrCoords[1]+this.position*(i.usrCoords[1]-n.usrCoords[1]),n.usrCoords[2]+this.position*(i.usrCoords[2]-n.usrCoords[2])]):(r=1,o=n.distance(JXG.COORDS_BY_USER,this.coords),a=n.distance(JXG.COORDS_BY_USER,i),s=i.distance(JXG.COORDS_BY_USER,this.coords),(o>a||s>a)&&s>o&&(r=-1),this.position=r*o/a,this.visProp.snapwidth>0&&Math.abs(this._smax-this._smin)>=JXG.Math.eps&&(0>this.position&&(this.position=0),this.position>1&&(this.position=1),l=this.position*(this._smax-this._smin)+this._smin,l=Math.round(l/this.visProp.snapwidth)*this.visProp.snapwidth,this.position=(l-this._smin)/(this._smax-this._smin),this.update(!0))),c=this.slideObject.point1.coords.scrCoords,u=this.slideObject.point2.coords.scrCoords,t=0==this.slideObject.getSlope()?1:2,d=this.coords.scrCoords[t],this.slideObject.visProp.straightfirst||(c[t]<u[t]?c[t]>d&&(this.coords=this.slideObject.point1.coords,this.position=0):c[t]>u[t]&&d>c[t]&&(this.coords=this.slideObject.point1.coords,this.position=0)),this.slideObject.visProp.straightlast||(c[t]<u[t]?d>u[t]&&(this.coords=this.slideObject.point2.coords,this.position=1):c[t]>u[t]&&u[t]>d&&(this.coords=this.slideObject.point2.coords,this.position=1)),this.onPolygon)if(h=this.slideObject.point1.coords,p=this.slideObject.point2.coords,Math.abs(this.coords.scrCoords[1]-h.scrCoords[1])<this.board.options.precision.hasPoint&&Math.abs(this.coords.scrCoords[2]-h.scrCoords[2])<this.board.options.precision.hasPoint){for(f=this.slideObject.parentPolygon,t=0;f.borders.length>t;t++)if(this.slideObject==f.borders[t]){this.slideObject=f.borders[(t-1+f.borders.length)%f.borders.length];break}}else if(Math.abs(this.coords.scrCoords[1]-p.scrCoords[1])<this.board.options.precision.hasPoint&&Math.abs(this.coords.scrCoords[2]-p.scrCoords[2])<this.board.options.precision.hasPoint)for(f=this.slideObject.parentPolygon,t=0;f.borders.length>t;t++)if(this.slideObject==f.borders[t]){this.slideObject=f.borders[(t+1+f.borders.length)%f.borders.length];break}}else this.slideObject.type==JXG.OBJECT_TYPE_TURTLE?(this.updateConstraint(),this.coords=JXG.Math.Geometry.projectPointToTurtle(this,this.slideObject,this.board)):this.slideObject.elementClass==JXG.OBJECT_CLASS_CURVE&&(this.updateConstraint(),this.coords=JXG.Math.Geometry.projectPointToCurve(this,this.slideObject,this.board));return this.type==JXG.OBJECT_TYPE_CAS&&this.updateConstraint(),this.updateTransform(),this},updateRenderer:function(){if(!this.needsUpdate)return this;if(this.visProp.visible){var e=this.isReal;this.isReal=!isNaN(this.coords.usrCoords[1]+this.coords.usrCoords[2]),this.isReal=Math.abs(this.coords.usrCoords[0])>JXG.Math.eps?this.isReal:!1,this.isReal?(e!=this.isReal&&(this.board.renderer.show(this),this.hasLabel&&this.label.content.visProp.visible&&this.board.renderer.show(this.label.content)),this.board.renderer.updatePoint(this)):e!=this.isReal&&(this.board.renderer.hide(this),this.hasLabel&&this.label.content.visProp.visible&&this.board.renderer.hide(this.label.content))}return this.hasLabel&&this.visProp.visible&&this.label.content&&this.label.content.visProp.visible&&this.isReal&&(this.label.content.update(),this.board.renderer.updateText(this.label.content)),this.needsUpdate=!1,this},X:function(){return this.coords.usrCoords[1]},Y:function(){return this.coords.usrCoords[2]},Z:function(){return this.coords.usrCoords[0]},XEval:function(){return this.coords.usrCoords[1]},YEval:function(){return this.coords.usrCoords[2]},ZEval:function(){return this.coords.usrCoords[0]},bounds:function(){return this.coords.usrCoords.slice(1).concat(this.coords.usrCoords.slice(1))},Dist:function(e){var t,n,i=e.coords.usrCoords,r=this.coords.usrCoords;return n=r[0]-i[0],t=n*n,n=r[1]-i[1],t+=n*n,n=r[2]-i[2],t+=n*n,Math.sqrt(t)},setPositionDirectly:function(e,t,n){var i,r,o,a,s,l,c=this.coords;if(this.coords=new JXG.Coords(e,[t,n],this.board),0!=this.group.length){for(r=this.coords.usrCoords[1]-c.usrCoords[1],o=this.coords.usrCoords[2]-c.usrCoords[2],i=0;this.group.length>i;i++)for(a in this.group[i].objects)s=this.group[i].objects[a],s.initialCoords=new JXG.Coords(JXG.COORDS_BY_USER,[s.initialCoords.usrCoords[1]+r,s.initialCoords.usrCoords[2]+o],this.board);this.group[this.group.length-1].dX=this.coords.scrCoords[1]-c.scrCoords[1],this.group[this.group.length-1].dY=this.coords.scrCoords[2]-c.scrCoords[2],this.group[this.group.length-1].update(this)}else{for(i=this.transformations.length-1;i>=0;i--)l=e==JXG.COORDS_BY_SCREEN?new JXG.Coords(e,[t,n],this.board).usrCoords:[1,t,n],this.initialCoords=new JXG.Coords(JXG.COORDS_BY_USER,JXG.Math.matVecMult(JXG.Math.inverse(this.transformations[i].matrix),l),this.board);this.update()}return this},setPositionByTransform:function(e,t,n){var i=this.board.create("transform",[t,n],{type:"translate"});return this.transformations.length>0&&this.transformations[this.transformations.length-1].isNumericMatrix?this.transformations[this.transformations.length-1].melt(i):this.addTransform(this,i),0==this.group.length&&this.update(),this},setPosition:function(e,t,n){return this.setPositionDirectly(e,t,n),this},makeGlider:function(e){return this.slideObject=JXG.getReference(this.board,e),this.type=JXG.OBJECT_TYPE_GLIDER,this.visProp.snapwidth=-1,this.slideObject.addChild(this),this.isDraggable=!0,this.generatePolynomial=function(){return this.slideObject.generatePolynomial(this)},this},addConstraint:function(e){this.type=JXG.OBJECT_TYPE_CAS,this.board.elementsByName;var t,n=[];this.isDraggable=!1;for(var i=0;e.length>i;i++){var r=e[i];if("string"==typeof r){var o=JXG.GeonextParser.geonext2JS(r,this.board);n[i]=Function("","return "+o+";")}else"function"==typeof r?n[i]=r:"number"==typeof r?n[i]=function(e){return function(){return e}}(r):"object"==typeof r&&"function"==typeof r.Value&&(n[i]=function(e){return function(){return e.Value()}}(r))}return 1==e.length?this.updateConstraint=function(){var e=n[0]();JXG.isArray(e)?this.coords.setCoordinates(JXG.COORDS_BY_USER,e):this.coords=e}:2==e.length?(this.XEval=n[0],this.YEval=n[1],t="this.coords.setCoordinates(JXG.COORDS_BY_USER,[this.XEval(),this.YEval()]);",this.updateConstraint=Function("",t)):(this.ZEval=n[0],this.XEval=n[1],this.YEval=n[2],t="this.coords.setCoordinates(JXG.COORDS_BY_USER,[this.ZEval(),this.XEval(),this.YEval()]);",this.updateConstraint=Function("",t)),this},updateTransform:function(){if(0!=this.transformations.length&&null!=this.baseElement){var e,t;for(e=this===this.baseElement?this.transformations[0].apply(this.baseElement,"self"):this.transformations[0].apply(this.baseElement),this.coords.setCoordinates(JXG.COORDS_BY_USER,e),t=1;this.transformations.length>t;t++)this.coords.setCoordinates(JXG.COORDS_BY_USER,this.transformations[t].apply(this));return this}},addTransform:function(e,t){var n,i,r;for(0==this.transformations.length&&(this.baseElement=e),n=JXG.isArray(t)?t:[t],r=n.length,i=0;r>i;i++)this.transformations.push(n[i]);return this},startAnimation:function(e,t){return this.type==JXG.OBJECT_TYPE_GLIDER&&this.intervalCode===void 0&&(this.intervalCode=window.setInterval("JXG.JSXGraph.boards['"+this.board.id+"'].objects['"+this.id+"']._anim("+e+", "+t+")",250),this.intervalCount===void 0&&(this.intervalCount=0)),this},stopAnimation:function(){return this.intervalCode!==void 0&&(window.clearInterval(this.intervalCode),delete this.intervalCode),this},moveAlong:function(e,t,n){n=n||{};var i,r,o=[],a=35,s=function(t,n){return function(){return e[t][n]}},l=[],c=t/a;if(JXG.isArray(e)){for(i=0;e.length>i;i++)l[i]=JXG.isPoint(e[i])?e[i]:{elementClass:JXG.OBJECT_CLASS_POINT,X:s(i,0),Y:s(i,1)};if(t=t||0,0===t)return this.setPosition(JXG.COORDS_BY_USER,l[l.length-1].X(),l[l.length-1].Y()),this.board.update(this);for(r=JXG.Math.Numerics.Neville(l),i=0;c>i;i++)o[i]=[],o[i][0]=r[0]((c-i)/c*r[3]()),o[i][1]=r[1]((c-i)/c*r[3]());this.animationPath=o}else JXG.isFunction(e)&&(this.animationPath=e,this.animationStart=(new Date).getTime());return this.animationCallback=n.callback,this.board.addAnimation(this),this},moveTo:function(e,t,n){if(t===void 0||0==t)return this.setPosition(JXG.COORDS_BY_USER,e[0],e[1]),this.board.update(this);n=n||{};var i,r=35,o=Math.ceil(t/(1*r)),a=Array(o+1),s=this.coords.usrCoords[1],l=this.coords.usrCoords[2],c=e[0]-s,u=e[1]-l,d=function(e){return n.effect&&"<>"==n.effect?Math.pow(Math.sin(e/(1*o)*Math.PI/2),2):e/o};if(Math.abs(c)<JXG.Math.eps&&Math.abs(u)<JXG.Math.eps)return this;for(i=o;i>=0;i--)a[o-i]=[s+c*d(i),l+u*d(i)];return this.animationPath=a,this.animationCallback=n.callback,this.board.addAnimation(this),this},visit:function(e,t,n){"number"==typeof n?n={repeat:n}:(n=n||{},n.repeat===void 0&&(n.repeat=1));var i,r,o=35,a=Math.ceil(t/(1*o)),s=Array(repeat*(a+1)),l=this.coords.usrCoords[1],c=this.coords.usrCoords[2],u=e[0]-l,d=e[1]-c,h=function(e){return n.effect&&"<>"==n.effect?Math.pow(Math.sin(e/(1*a)*Math.PI/2),2):e/a};for(r=0;n.repeat>r;r++)for(i=a;i>=0;i--)s[r*(a+1)+a-i]=[l+u*h(i),c+d*h(i)];return this.animationPath=s,this.animationCallback=n.callback,this.board.addAnimation(this),this},_anim:function(e,t){var n,i,r,o,a,s,l,c,u=1;return this.intervalCount++,this.intervalCount>t&&(this.intervalCount=0),this.slideObject.elementClass==JXG.OBJECT_CLASS_LINE?(n=this.slideObject.point1.coords.distance(JXG.COORDS_BY_SCREEN,this.slideObject.point2.coords),i=this.slideObject.getSlope(),"INF"!=i?(a=Math.atan(i),r=Math.round(this.intervalCount/t*n*Math.cos(a)),o=Math.round(this.intervalCount/t*n*Math.sin(a))):(r=0,o=Math.round(this.intervalCount/t*n)),0>e?(s=this.slideObject.point2,this.slideObject.point2.coords.scrCoords[1]-this.slideObject.point1.coords.scrCoords[1]>0?u=-1:0==this.slideObject.point2.coords.scrCoords[1]-this.slideObject.point1.coords.scrCoords[1]&&this.slideObject.point2.coords.scrCoords[2]-this.slideObject.point1.coords.scrCoords[2]>0&&(u=-1)):(s=this.slideObject.point1,this.slideObject.point1.coords.scrCoords[1]-this.slideObject.point2.coords.scrCoords[1]>0?u=-1:0==this.slideObject.point1.coords.scrCoords[1]-this.slideObject.point2.coords.scrCoords[1]&&this.slideObject.point1.coords.scrCoords[2]-this.slideObject.point2.coords.scrCoords[2]>0&&(u=-1)),this.coords.setCoordinates(JXG.COORDS_BY_SCREEN,[s.coords.scrCoords[1]+u*r,s.coords.scrCoords[2]+u*o])):this.slideObject.elementClass==JXG.OBJECT_CLASS_CURVE?(l=e>0?Math.round(this.intervalCount/t*this.board.canvasWidth):Math.round((t-this.intervalCount)/t*this.board.canvasWidth),this.coords.setCoordinates(JXG.COORDS_BY_SCREEN,[l,0]),this.coords=JXG.Math.Geometry.projectPointToCurve(this,this.slideObject,this.board)):this.slideObject.elementClass==JXG.OBJECT_CLASS_CIRCLE&&(a=0>e?2*(this.intervalCount/t)*Math.PI:2*((t-this.intervalCount)/t)*Math.PI,c=this.slideObject.Radius(),this.coords.setCoordinates(JXG.COORDS_BY_USER,[this.slideObject.midpoint.coords.usrCoords[1]+c*Math.cos(a),this.slideObject.midpoint.coords.usrCoords[2]+c*Math.sin(a)])),this.board.update(this),this },setStyle:function(e){var t=["cross","cross","cross","circle","circle","circle","circle","square","square","square","plus","plus","plus"],n=[2,3,4,1,2,3,4,2,3,4,2,3,4];return this.visProp.face=t[e],this.visProp.size=n[e],this.board.renderer.changePointStyle(this),this},normalizeFace:function(e){var t={cross:"x",x:"x",circle:"o",o:"o",square:"[]","[]":"[]",plus:"+","+":"+",diamond:"<>","<>":"<>",triangleup:"^",a:"^","^":"^",triangledown:"v",v:"v",triangleleft:"<","<":"<",triangleright:">",">":">"};return t[e]},remove:function(){this.hasLabel&&this.board.renderer.remove(this.board.renderer.getElementById(this.label.content.id)),this.board.renderer.remove(this.board.renderer.getElementById(this.id))},getTextAnchor:function(){return this.coords},getLabelAnchor:function(){return this.coords},face:function(e){this.setProperty({face:e})},size:function(e){this.setProperty({size:e})},cloneToBackground:function(){var e={};return e.id=this.id+"T"+this.numTraces,this.numTraces++,e.coords=this.coords,e.visProp=this.visProp,e.visProp.layer=this.board.options.layer.trace,e.elementClass=JXG.OBJECT_CLASS_POINT,e.board=this.board,JXG.clearVisPropOld(e),this.board.renderer.drawPoint(e),this.traces[e.id]=e.rendNode,this}}),JXG.createPoint=function(e,t,n){var i,r,o,a=!1;for(o=JXG.copyAttributes(n,e.options,"point"),r=0;t.length>r;r++)("function"==typeof t[r]||"string"==typeof t[r])&&(a=!0);if(a)i=new JXG.Point(e,[0/0,0/0],o),i.addConstraint(t);else if(JXG.isNumber(t[0])&&JXG.isNumber(t[1]))i=new JXG.Point(e,t,o),JXG.exists(o.slideobject)?i.makeGlider(o.slideobject):i.baseElement=i,i.isDraggable=!0;else{if("object"!=typeof t[0]||"object"!=typeof t[1])throw Error("JSXGraph: Can't create point with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'.\nPossible parent types: [x,y], [z,x,y], [point,transformation]");i=new JXG.Point(e,[0,0],o),i.addTransform(t[0],t[1]),i.isDraggable=!1}return i},JXG.createGlider=function(e,t,n){var i,r=JXG.copyAttributes(n,e.options,"point");return i=1===t.length?e.create("point",[0,0],r):e.create("point",t.slice(0,2),r),i.makeGlider(t[t.length-1]),i},JXG.createIntersectionPoint=function(e,t,n){var i;return t.length>=3&&(3==t.length&&t.push(null),i=e.create("point",[e.intersection(t[0],t[1],t[2],t[3])],n)),t[0].addChild(i),t[1].addChild(i),i.generatePolynomial=function(){var e=t[0].generatePolynomial(i),n=t[1].generatePolynomial(i);return 0==e.length||0==n.length?[]:[e[0],n[0]]},i},JXG.createOtherIntersectionPoint=function(e,t,n){var i;if(3!=t.length||!JXG.isPoint(t[2])||t[0].elementClass!=JXG.OBJECT_CLASS_LINE&&t[0].elementClass!=JXG.OBJECT_CLASS_CIRCLE||t[1].elementClass!=JXG.OBJECT_CLASS_LINE&&t[1].elementClass!=JXG.OBJECT_CLASS_CIRCLE)throw Error("JSXGraph: Can't create 'other intersection point' with parent types '"+typeof t[0]+"', '"+typeof t[1]+"'and '"+typeof t[2]+"'.\nPossible parent types: [circle|line,circle|line,point]");return i=e.create("point",[e.otherIntersection(t[0],t[1],t[2])],n),t[0].addChild(i),t[1].addChild(i),i.generatePolynomial=function(){var e=t[0].generatePolynomial(i),n=t[1].generatePolynomial(i);return 0==e.length||0==n.length?[]:[e[0],n[0]]},i},JXG.JSXGraph.registerElement("point",JXG.createPoint),JXG.JSXGraph.registerElement("glider",JXG.createGlider),JXG.JSXGraph.registerElement("intersection",JXG.createIntersectionPoint),JXG.JSXGraph.registerElement("otherintersection",JXG.createOtherIntersectionPoint),JXG.Line=function(e,t,n,i){this.constructor(e,i,JXG.OBJECT_TYPE_LINE,JXG.OBJECT_CLASS_LINE),this.point1=JXG.getReference(this.board,t),this.point2=JXG.getReference(this.board,n),this.ticks=[],this.defaultTicks=null,this.parentPolygon=null,this.labelOffsets=[].concat(i.labeloffsets),this.labelOffsets[0]=Math.abs(this.labelOffsets[0]),this.labelOffsets[1]=Math.abs(this.labelOffsets[1]),this.id=this.board.setId(this,"L"),this.board.renderer.drawLine(this),this.board.finalizeAdding(this),this.createLabel(),this.point1.addChild(this),this.point2.addChild(this),this.updateStdform()},JXG.Line.prototype=new JXG.GeometryElement,JXG.extend(JXG.Line.prototype,{hasPoint:function(e,t){var n,i,r,o,a,s,l=[],c=[1,e,t],u=[];l[0]=this.stdform[0]-this.stdform[1]*this.board.origin.scrCoords[1]/this.board.unitX+this.stdform[2]*this.board.origin.scrCoords[2]/this.board.unitY,l[1]=this.stdform[1]/this.board.unitX,l[2]=this.stdform[2]/-this.board.unitY;var u=[0,l[1],l[2]];if(u=JXG.Math.crossProduct(u,c),u=JXG.Math.crossProduct(u,l),u[1]/=u[0],u[2]/=u[0],u[0]=1,n=(c[0]-u[0])*(c[0]-u[0])+(c[1]-u[1])*(c[1]-u[1])+(c[2]-u[2])*(c[2]-u[2]),isNaN(n)||n>this.board.options.precision.hasPoint*this.board.options.precision.hasPoint)return!1;if(this.visProp.straightfirst&&this.visProp.straightlast)return!0;if(i=this.point1.coords.scrCoords,r=this.point2.coords.scrCoords,s=(r[1]-i[1])*(r[1]-i[1])+(r[2]-i[2])*(r[2]-i[2]),o=(u[1]-i[1])*(u[1]-i[1])+(u[2]-i[2])*(u[2]-i[2]),a=(u[1]-r[1])*(u[1]-r[1])+(u[2]-r[2])*(u[2]-r[2]),o>s||a>s)if(a>o){if(!this.visProp.straightfirst)return!1}else if(!this.visProp.straightlast)return!1;return!0},update:function(){var e;return this.needsUpdate&&(this.constrained&&(this.funps!==void 0?(e=this.funps(),this.point1=e[0],this.point2=e[1]):(this.point1=this.funp1(),this.point2=this.funp2())),this.updateStdform(),this.visProp.trace&&this.cloneToBackground(!0)),this},updateStdform:function(){var e=JXG.Math.crossProduct(this.point1.coords.usrCoords,this.point2.coords.usrCoords);this.stdform[0]=e[0],this.stdform[1]=e[1],this.stdform[2]=e[2],this.stdform[3]=0,this.normalize()},updateRenderer:function(){var e;return this.needsUpdate&&this.visProp.visible&&(e=this.isReal,this.isReal=!isNaN(this.point1.coords.usrCoords[1]+this.point1.coords.usrCoords[2]+this.point2.coords.usrCoords[1]+this.point2.coords.usrCoords[2])&&JXG.Math.innerProduct(this.stdform,this.stdform,3)>=JXG.Math.eps*JXG.Math.eps,this.isReal?(e!=this.isReal&&(this.board.renderer.show(this),this.hasLabel&&this.label.content.visProp.visible&&this.board.renderer.show(this.label.content)),this.board.renderer.updateLine(this)):e!=this.isReal&&(this.board.renderer.hide(this),this.hasLabel&&this.label.content.visProp.visible&&this.board.renderer.hide(this.label.content)),this.needsUpdate=!1),this.hasLabel&&this.label.content.visProp.visible&&this.isReal&&(this.label.content.update(),this.board.renderer.updateText(this.label.content)),this},generatePolynomial:function(e){var t=this.point1.symbolic.x,n=this.point1.symbolic.y,i=this.point2.symbolic.x,r=this.point2.symbolic.y,o=e.symbolic.x,a=e.symbolic.y;return[["(",n,")*(",o,")-(",n,")*(",i,")+(",a,")*(",i,")-(",t,")*(",a,")+(",t,")*(",r,")-(",o,")*(",r,")"].join("")]},getRise:function(){return Math.abs(this.stdform[2])>=JXG.Math.eps?-this.stdform[0]/this.stdform[2]:1/0},getSlope:function(){return Math.abs(this.stdform[2])>=JXG.Math.eps?-this.stdform[1]/this.stdform[2]:1/0},getAngle:function(){var e=Math.atan2(this.point2.Y()-this.point1.Y(),this.point2.X()-this.point1.X());return e},setStraight:function(e,t){return this.visProp.straightfirst=e,this.visProp.straightlast=t,this.board.renderer.updateLine(this),this},getTextAnchor:function(){return new JXG.Coords(JXG.COORDS_BY_USER,[.5*(this.point2.X()+this.point1.X()),.5*(this.point2.Y()+this.point1.Y())],this.board)},setLabelRelativeCoords:function(e){JXG.exists(this.label.content)&&(this.label.content.relativeCoords=new JXG.Coords(JXG.COORDS_BY_SCREEN,[e[0],-e[1]],this.board))},getLabelAnchor:function(){var e,t,n,i,r,o=this.labelOffsets[0],a=this.labelOffsets[1];return this.visProp.straightfirst||this.visProp.straightlast?(t=new JXG.Coords(JXG.COORDS_BY_USER,this.point1.coords.usrCoords,this.board),n=new JXG.Coords(JXG.COORDS_BY_USER,this.point2.coords.usrCoords,this.board),JXG.Math.Geometry.calcStraight(this,t,n),e=this.visProp.straightfirst&&this.type!=JXG.OBJECT_TYPE_AXIS?t:n,null!=this.label.content&&(i=[0,0],r=this.getSlope(),0==e.scrCoords[2]?i=1/0==r?[o,-a]:r>=0?[o,-a]:[-o,-a]:e.scrCoords[2]==this.board.canvasHeight&&(i=1/0==r?[o,a]:r>=0?[-o,a]:[o,a]),0==e.scrCoords[1]?i=1/0==r?[o,a]:r>=0?[o,-a]:[o,a]:e.scrCoords[1]==this.board.canvasWidth&&(i=1/0==r?[-o,a]:r>=0?[-o,a]:[-o,-a]),this.setLabelRelativeCoords(i)),e):(this.setLabelRelativeCoords(this.labelOffsets),new JXG.Coords(JXG.COORDS_BY_USER,[this.point2.X()-.5*(this.point2.X()-this.point1.X()),this.point2.Y()-.5*(this.point2.Y()-this.point1.Y())],this.board))},cloneToBackground:function(){var e,t,n,i={};i.id=this.id+"T"+this.numTraces,i.elementClass=JXG.OBJECT_CLASS_LINE,this.numTraces++,i.point1=this.point1,i.point2=this.point2,i.stdform=this.stdform,i.board=this.board,i.visProp=this.visProp,i.visProp.layer=this.board.options.layer.trace,JXG.clearVisPropOld(i),t=this.getSlope(),e=this.getRise(),i.getSlope=function(){return t},i.getRise=function(){return e},n=this.board.renderer.enhancedRendering,this.board.renderer.enhancedRendering=!0,this.board.renderer.drawLine(i),this.board.renderer.enhancedRendering=n,this.traces[i.id]=i.rendNode,delete i},addTransform:function(e){var t,n;for(t=JXG.isArray(e)?e:[e],n=0;t.length>n;n++)this.point1.transformations.push(t[n]),this.point2.transformations.push(t[n])},setPosition:function(e,t,n){var i=this.board.create("transform",[t,n],{type:"translate"});this.point1.transformations.length>0&&this.point1.transformations[this.point1.transformations.length-1].isNumericMatrix?this.point1.transformations[this.point1.transformations.length-1].melt(i):this.point1.addTransform(this.point1,i),this.point2.transformations.length>0&&this.point2.transformations[this.point2.transformations.length-1].isNumericMatrix?this.point2.transformations[this.point2.transformations.length-1].melt(i):this.point2.addTransform(this.point2,i)},setPositionDirectly:function(e,t,n,i,r){var o,a,s,l=t-i,c=n-r;return this.point1.draggable()&&this.point2.draggable()?(s=this.point1.coords,e==JXG.COORDS_BY_SCREEN?(o=s.scrCoords[1]+l,a=s.scrCoords[2]+c):(o=s.usrCoords[1]+l,a=s.usrCoords[2]+c),this.point1.setPositionDirectly(e,o,a),s=this.point2.coords,e==JXG.COORDS_BY_SCREEN?(o=s.scrCoords[1]+l,a=s.scrCoords[2]+c):(o=s.usrCoords[1]+l,a=s.usrCoords[2]+c),this.point2.setPositionDirectly(e,o,a),this.update(),this):this},X:function(e){var t,n,i,r,o,a=this.stdform[1],s=this.stdform[2],l=this.stdform[0];return e*=Math.PI,t=a*Math.cos(e)+s*Math.sin(e),n=l,i=Math.sqrt(t*t+n*n),r=-n/i,o=t/i,Math.abs(o)<JXG.Math.eps&&(o=1),r*Math.cos(e)/o},Y:function(e){var t,n,i,r,o,a=this.stdform[1],s=this.stdform[2],l=this.stdform[0];return e*=Math.PI,t=a*Math.cos(e)+s*Math.sin(e),n=l,i=Math.sqrt(t*t+n*n),r=-n/i,o=t/i,Math.abs(o)<JXG.Math.eps&&(o=1),r*Math.sin(e)/o},Z:function(e){var t,n,i,r,o=this.stdform[1],a=this.stdform[2],s=this.stdform[0];return e*=Math.PI,t=o*Math.cos(e)+a*Math.sin(e),n=s,i=Math.sqrt(t*t+n*n),r=t/i,Math.abs(r)>=JXG.Math.eps?1:0},L:function(){return this.point1.Dist(this.point2)},minX:function(){return 0},maxX:function(){return 1},bounds:function(){var e=this.point1.coords.usrCoords,t=this.point2.coords.usrCoords;return[Math.min(e[1],t[1]),Math.max(e[2],t[2]),Math.max(e[1],t[1]),Math.min(e[2],t[2])]},addTicks:function(e){return(""==e.id||e.id===void 0)&&(e.id=this.id+"_ticks_"+(this.ticks.length+1)),this.board.renderer.drawTicks(e),this.ticks.push(e),e.id},removeAllTicks:function(){var e;for(e=this.ticks.length;e>0;e--)this.removeTicks(this.ticks[e-1]);this.ticks=[],this.board.update()},removeTicks:function(e){var t,n;for(null!=this.defaultTicks&&this.defaultTicks==e&&(this.defaultTicks=null),t=this.ticks.length;t>0;t--)if(this.ticks[t-1]==e){for(this.board.removeObject(this.ticks[t-1]),n=0;this.ticks[t-1].ticks.length>n;n++)null!=this.ticks[t-1].labels[n]&&this.board.removeObject(this.ticks[t-1].labels[n]);delete this.ticks[t-1];break}}}),JXG.createLine=function(e,t,n){var i,r,o,a,s,l,c=[],u=!1;if(2==t.length){if(JXG.isArray(t[0])&&t[0].length>1)s=JXG.copyAttributes(n,e.options,"line","point1"),r=e.create("point",t[0],s);else if(JXG.isString(t[0])||t[0].elementClass==JXG.OBJECT_CLASS_POINT)r=JXG.getReference(e,t[0]);else{if("function"!=typeof t[0]||t[0]().elementClass!=JXG.OBJECT_CLASS_POINT)throw Error("JSXGraph: Can't create line with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]], [a,b,c]");r=t[0](),u=!0}if(JXG.isArray(t[1])&&t[1].length>1)s=JXG.copyAttributes(n,e.options,"line","point2"),o=e.create("point",t[1],s);else if(JXG.isString(t[1])||t[1].elementClass==JXG.OBJECT_CLASS_POINT)o=JXG.getReference(e,t[1]);else{if("function"!=typeof t[1]||t[1]().elementClass!=JXG.OBJECT_CLASS_POINT)throw Error("JSXGraph: Can't create line with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]], [a,b,c]");o=t[1](),u=!0}s=JXG.copyAttributes(n,e.options,"line"),i=new JXG.Line(e,r,o,s),u?(i.constrained=!0,i.funp1=t[0],i.funp2=t[1]):i.isDraggable=!0}else if(3==t.length){for(l=!0,a=0;3>a;a++)if("number"==typeof t[a])c[a]=function(e){return function(){return e}}(t[a]);else{if("function"!=typeof t[a])throw Error("JSXGraph: Can't create line with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"' and '"+typeof t[2]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]], [a,b,c]");c[a]=t[a],l=!1}s=JXG.copyAttributes(n,e.options,"line","point1"),r=l?e.create("point",[c[2]()*c[2]()+c[1]()*c[1](),c[2]()-c[1]()*c[0]()+c[2](),-c[1]()-c[2]()*c[0]()-c[1]()],s):e.create("point",[function(){return.5*(0+c[2]()*c[2]()+c[1]()*c[1]())},function(){return.5*(c[2]()-c[1]()*c[0]()+c[2]())},function(){return.5*(-c[1]()-c[2]()*c[0]()-c[1]())}],s),s=JXG.copyAttributes(n,e.options,"line","point2"),o=l?e.create("point",[c[2]()*c[2]()+c[1]()*c[1](),-c[1]()*c[0]()+c[2](),-c[2]()*c[0]()-c[1]()],s):e.create("point",[function(){return c[2]()*c[2]()+c[1]()*c[1]()},function(){return-c[1]()*c[0]()+c[2]()},function(){return-c[2]()*c[0]()-c[1]()}],s),r.prepareUpdate().update(),o.prepareUpdate().update(),s=JXG.copyAttributes(n,e.options,"line"),i=new JXG.Line(e,r,o,s),i.isDraggable=l}else{if(1!=t.length||"function"!=typeof t[0]||2!=t[0]().length||t[0]()[0].elementClass!=JXG.OBJECT_CLASS_POINT||t[0]()[1].elementClass!=JXG.OBJECT_CLASS_POINT)throw Error("JSXGraph: Can't create line with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]], [a,b,c]");var d=t[0]();s=JXG.copyAttributes(n,e.options,"line"),i=new JXG.Line(e,d[0],d[1],s),i.constrained=!0,i.funps=t[0]}return i},JXG.JSXGraph.registerElement("line",JXG.createLine),JXG.createSegment=function(e,t,n){return n.straightFirst=!1,n.straightLast=!1,e.create("line",t,n)},JXG.JSXGraph.registerElement("segment",JXG.createSegment),JXG.createArrow=function(e,t,n){var i;return i=e.create("line",t,n).setStraight(!1,!1),i.setArrow(!1,!0),i.type=JXG.OBJECT_TYPE_VECTOR,i},JXG.JSXGraph.registerElement("arrow",JXG.createArrow),JXG.createAxis=function(e,t,n){var i,r,o;if(!JXG.isArray(t[0])&&!JXG.isPoint(t[0])||!JXG.isArray(t[1])&&!JXG.isPoint(t[1]))throw Error("JSXGraph: Can't create point with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]]");i=JXG.copyAttributes(n,e.options,"axis"),r=e.create("line",t,i),r.type=JXG.OBJECT_TYPE_AXIS;for(var a in r.ancestors)r.ancestors[a].type=JXG.OBJECT_TYPE_AXISPOINT;return i=JXG.copyAttributes(n,e.options,"axis","ticks"),o=JXG.exists(i.ticksdistance)?i.ticksdistance:JXG.isArray(i.ticks)?i.ticks:1,r.defaultTicks=e.create("ticks",[r,o],i),r},JXG.JSXGraph.registerElement("axis",JXG.createAxis),JXG.createTangent=function(e,t,n){var i,r,o,a,s,l,c,u;if(1==t.length)i=t[0],r=i.slideObject;else{if(2!=t.length)throw Error("JSXGraph: Can't create tangent with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'.\nPossible parent types: [glider], [point,line|curve|circle|conic]");if(JXG.isPoint(t[0]))i=t[0],r=t[1];else{if(!JXG.isPoint(t[1]))throw Error("JSXGraph: Can't create tangent with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'.\nPossible parent types: [glider], [point,line|curve|circle|conic]");r=t[0],i=t[1]}}return r.elementClass==JXG.OBJECT_CLASS_LINE?u=e.create("line",[r.point1,r.point2],n):r.elementClass==JXG.OBJECT_CLASS_CURVE&&r.type!=JXG.OBJECT_TYPE_CONIC?"plot"!=r.visProp.curvetype?(o=r.X,a=r.Y,u=e.create("line",[function(){return-i.X()*e.D(a)(i.position)+i.Y()*e.D(o)(i.position)},function(){return e.D(a)(i.position)},function(){return-e.D(o)(i.position)}],n),i.addChild(u),u.glider=i):(u=e.create("line",[function(){return s=Math.floor(i.position),s==r.numberPoints-1&&s--,0>s?1:r.Y(s)*r.X(s+1)-r.X(s)*r.Y(s+1)},function(){return s=Math.floor(i.position),s==r.numberPoints-1&&s--,0>s?0:r.Y(s+1)-r.Y(s)},function(){return s=Math.floor(i.position),s==r.numberPoints-1&&s--,0>s?0:r.X(s)-r.X(s+1)}],n),i.addChild(u),u.glider=i):r.type==JXG.OBJECT_TYPE_TURTLE?(u=e.create("line",[function(){for(s=Math.floor(i.position),l=0;r.objects.length>l;l++)if(c=r.objects[l],c.type==JXG.OBJECT_TYPE_CURVE){if(c.numberPoints>s)break;s-=c.numberPoints}return s==c.numberPoints-1&&s--,0>s?1:c.Y(s)*c.X(s+1)-c.X(s)*c.Y(s+1)},function(){for(s=Math.floor(i.position),l=0;r.objects.length>l;l++)if(c=r.objects[l],c.type==JXG.OBJECT_TYPE_CURVE){if(c.numberPoints>s)break;s-=c.numberPoints}return s==c.numberPoints-1&&s--,0>s?0:c.Y(s+1)-c.Y(s)},function(){for(s=Math.floor(i.position),l=0;r.objects.length>l;l++)if(c=r.objects[l],c.type==JXG.OBJECT_TYPE_CURVE){if(c.numberPoints>s)break;s-=c.numberPoints}return s==c.numberPoints-1&&s--,0>s?0:c.X(s)-c.X(s+1)}],n),i.addChild(u),u.glider=i):(r.elementClass==JXG.OBJECT_CLASS_CIRCLE||r.type==JXG.OBJECT_TYPE_CONIC)&&(u=e.create("line",[function(){return JXG.Math.matVecMult(r.quadraticform,i.coords.usrCoords)[0]},function(){return JXG.Math.matVecMult(r.quadraticform,i.coords.usrCoords)[1]},function(){return JXG.Math.matVecMult(r.quadraticform,i.coords.usrCoords)[2]}],n),i.addChild(u),u.glider=i),u},JXG.JSXGraph.registerElement("tangent",JXG.createTangent),JXG.JSXGraph.registerElement("polar",JXG.createTangent),JXG.Group=function(e,t,n){var i,r,o,a,s;if(this.board=e,this.objects={},i=this.board.numObjects,this.board.numObjects++,this.id=""!=t&&JXG.exists(t)?t:this.board.id+"Group"+i,this.board.groups[this.id]=this,this.type=JXG.OBJECT_TYPE_POINT,this.elementClass=JXG.OBJECT_CLASS_POINT,this.name=""!=n&&JXG.exists(n)?n:"group_"+this.board.generateName(this),delete this.type,4==arguments.length&&JXG.isArray(arguments[3]))r=arguments[3];else for(r=[],o=3;arguments.length>o;o++)r.push(arguments[o]);for(o=0;r.length>o;o++)a=JXG.getReference(this.board,r[o]),a.visProp.fixed||a.type!=JXG.OBJECT_TYPE_POINT&&a.type!=JXG.OBJECT_TYPE_GLIDER||(0!=a.group.length?this.addGroup(a.group[a.group.length-1]):this.addPoint(a));for(s in this.objects)this.objects[s].group.push(this);this.dX=0,this.dY=0},JXG.extend(JXG.Group.prototype,{ungroup:function(){var e;for(e in this.objects)this.objects[e].group[this.objects[e].group.length-1]==this&&this.objects[e].group.pop(),delete this.objects[e]},update:function(e){var t,n=null;for(t in this.objects)n=this.objects[t],n.id!=e.id&&(n.coords=new JXG.Coords(JXG.COORDS_BY_SCREEN,[n.coords.scrCoords[1]+this.dX,n.coords.scrCoords[2]+this.dY],n.board));for(t in this.objects)JXG.exists(this.board.objects[t])?this.objects[t].update(!1):delete this.objects[t];return this},addPoint:function(e){this.objects[e.id]=e},addPoints:function(e){var t;for(t in e)this.objects[t.id]=t},addGroup:function(e){var t;for(t in e.objects)this.addPoint(e.objects[t])}}),JXG.createGroup=function(e,t,n){return new JXG.Group(e,n.id,n.name,t)},JXG.JSXGraph.registerElement("group",JXG.createGroup),JXG.Circle=function(e,t,n,i,r){this.constructor(e,r,JXG.OBJECT_TYPE_CIRCLE,JXG.OBJECT_CLASS_CIRCLE),this.method=t,this.midpoint=JXG.getReference(this.board,n),this.point2=null,this.radius=0,this.line=null,this.circle=null,"twoPoints"==t?(this.point2=JXG.getReference(e,i),this.radius=this.Radius()):"pointRadius"==t?(this.generateTerm(i),this.updateRadius()):"pointLine"==t?(this.line=JXG.getReference(e,i),this.radius=this.line.point1.coords.distance(JXG.COORDS_BY_USER,this.line.point2.coords)):"pointCircle"==t&&(this.circle=JXG.getReference(e,i),this.radius=this.circle.Radius()),this.id=this.board.setId(this,"C"),this.board.renderer.drawEllipse(this),this.board.finalizeAdding(this),this.createGradient(),this.createLabel(),this.midpoint.addChild(this),"pointRadius"==t?this.notifyParents(i):"pointLine"==t?this.line.addChild(this):"pointCircle"==t?this.circle.addChild(this):"twoPoints"==t&&this.point2.addChild(this)},JXG.Circle.prototype=new JXG.GeometryElement,JXG.extend(JXG.Circle.prototype,{hasPoint:function(e,t){var n=this.board.options.precision.hasPoint/this.board.unitX,i=this.midpoint.coords.usrCoords,r=new JXG.Coords(JXG.COORDS_BY_SCREEN,[e,t],this.board),o=this.Radius(),a=Math.sqrt((i[1]-r.usrCoords[1])*(i[1]-r.usrCoords[1])+(i[2]-r.usrCoords[2])*(i[2]-r.usrCoords[2]));return n>Math.abs(a-o)},generatePolynomial:function(e){var t=this.midpoint.symbolic.x,n=this.midpoint.symbolic.y,i=e.symbolic.x,r=e.symbolic.y,o=this.generateRadiusSquared();if(""==o)return[];var a="(("+i+")-("+t+"))^2 + (("+r+")-("+n+"))^2 - ("+o+")";return[a]},generateRadiusSquared:function(){var e="";if("twoPoints"==this.method){var t=this.midpoint.symbolic.x,n=this.midpoint.symbolic.y,i=this.point2.symbolic.x,r=this.point2.symbolic.y;e="(("+i+")-("+t+"))^2 + (("+r+")-("+n+"))^2"}else if("pointRadius"==this.method)"number"==typeof this.radius&&(e=""+this.radius*this.radius);else if("pointLine"==this.method){var i=this.line.point1.symbolic.x,r=this.line.point1.symbolic.y,o=this.line.point2.symbolic.x,a=this.line.point2.symbolic.y;e="(("+i+")-("+o+"))^2 + (("+r+")-("+a+"))^2"}else"pointCircle"==this.method&&(e=this.circle.Radius());return e},update:function(){return this.needsUpdate&&(this.visProp.trace&&this.cloneToBackground(!0),"pointLine"==this.method?this.radius=this.line.point1.coords.distance(JXG.COORDS_BY_USER,this.line.point2.coords):"pointCircle"==this.method?this.radius=this.circle.Radius():"pointRadius"==this.method&&(this.radius=this.updateRadius()),this.updateStdform(),this.updateQuadraticform()),this},updateQuadraticform:function(){var e=this.midpoint,t=e.X(),n=e.Y(),i=this.Radius();this.quadraticform=[[t*t+n*n-i*i,-t,-n],[-t,1,0],[-n,0,1]]},updateStdform:function(){this.stdform[3]=.5,this.stdform[4]=this.Radius(),this.stdform[1]=-this.midpoint.coords.usrCoords[1],this.stdform[2]=-this.midpoint.coords.usrCoords[2],this.normalize()},updateRenderer:function(){if(this.needsUpdate&&this.visProp.visible){var e=this.isReal;this.isReal=isNaN(this.midpoint.coords.usrCoords[1]+this.midpoint.coords.usrCoords[2]+this.Radius())?!1:!0,this.isReal?(e!=this.isReal&&(this.board.renderer.show(this),this.hasLabel&&this.label.content.visProp.visible&&this.board.renderer.show(this.label.content)),this.board.renderer.updateEllipse(this)):e!=this.isReal&&(this.board.renderer.hide(this),this.hasLabel&&this.label.content.visProp.visible&&this.board.renderer.hide(this.label.content)),this.needsUpdate=!1}this.hasLabel&&this.label.content.visProp.visible&&this.isReal&&(this.label.content.update(),this.board.renderer.updateText(this.label.content))},generateTerm:function(e){if("string"==typeof e){this.board.elementsByName;var t=JXG.GeonextParser.geonext2JS(e+"",this.board);this.updateRadius=Function("return "+t+";")}else this.updateRadius="number"==typeof e?function(){return e}:e},notifyParents:function(e){this.board.elementsByName,"string"==typeof e&&JXG.GeonextParser.findDependencies(this,e+"",this.board)},Radius:function(){return"twoPoints"==this.method?Math.sqrt(Math.pow(this.midpoint.coords.usrCoords[1]-this.point2.coords.usrCoords[1],2)+Math.pow(this.midpoint.coords.usrCoords[2]-this.point2.coords.usrCoords[2],2)):"pointLine"==this.method||"pointCircle"==this.method?this.radius:"pointRadius"==this.method?this.updateRadius():void 0},getRadius:function(){return this.Radius()},getTextAnchor:function(){return this.midpoint.coords},getLabelAnchor:function(){if("twoPoints"==this.method){var e=this.midpoint.coords.usrCoords[1]-this.point2.coords.usrCoords[1],t=this.midpoint.coords.usrCoords[2]-this.point2.coords.usrCoords[2];return new JXG.Coords(JXG.COORDS_BY_USER,[this.midpoint.coords.usrCoords[1]+e,this.midpoint.coords.usrCoords[2]+t],this.board)}return"pointLine"==this.method||"pointCircle"==this.method||"pointRadius"==this.method?new JXG.Coords(JXG.COORDS_BY_USER,[this.midpoint.coords.usrCoords[1]-this.Radius(),this.midpoint.coords.usrCoords[2]],this.board):void 0},cloneToBackground:function(){var e,t,n={};n.id=this.id+"T"+this.numTraces,n.elementClass=JXG.OBJECT_CLASS_CIRCLE,this.numTraces++,n.midpoint={},n.midpoint.coords=this.midpoint.coords,e=this.Radius(),n.Radius=function(){return e},n.getRadius=function(){return e},n.board=this.board,n.visProp=this.visProp,n.visProp.layer=this.board.options.layer.trace,JXG.clearVisPropOld(n),t=this.board.renderer.enhancedRendering,this.board.renderer.enhancedRendering=!0,this.board.renderer.drawEllipse(n),this.board.renderer.enhancedRendering=t,this.traces[n.id]=n.rendNode},addTransform:function(e){var t;t=JXG.isArray(e)?e:[e];for(var n=0;t.length>n;n++)this.midpoint.transformations.push(t[n]),"twoPoints"==this.method&&this.point2.transformations.push(t[n])},setPosition:function(e,t,n){var i=this.board.create("transform",[t,n],{type:"translate"});return this.addTransform(i),this},setPositionDirectly:function(e,t,n,i,r){var o,a,s=t-i,l=n-r;return this.midpoint.draggable()?"twoPoints"!=this.method||this.point2.draggable()?(e==JXG.COORDS_BY_SCREEN?(o=this.midpoint.coords.scrCoords[1]+s,a=this.midpoint.coords.scrCoords[2]+l):(o=this.midpoint.coords.usrCoords[1]+s,a=this.midpoint.coords.usrCoords[2]+l),this.midpoint.setPositionDirectly(e,o,a),"twoPoints"==this.method&&(e==JXG.COORDS_BY_SCREEN?(o=this.point2.coords.scrCoords[1]+s,a=this.point2.coords.scrCoords[2]+l):(o=this.point2.coords.usrCoords[1]+s,a=this.point2.coords.usrCoords[2]+l),this.point2.setPositionDirectly(e,o,a)),this.update(),this):this:this},X:function(e){return e*=2*Math.PI,this.Radius()*Math.cos(e)+this.midpoint.coords.usrCoords[1]},Y:function(e){return e*=2*Math.PI,this.Radius()*Math.sin(e)+this.midpoint.coords.usrCoords[2]},minX:function(){return 0},maxX:function(){return 1},Area:function(){var e=this.Radius();return e*e*Math.PI},bounds:function(){var e=this.midpoint.coords.usrCoords,t=this.Radius();return[e[1]-t,e[2]+t,e[1]+t,e[2]-t]}}),JXG.createCircle=function(e,t,n){var i,r,o,a,s=!0;for(r=[],o=0;t.length>o;o++)JXG.isPoint(t[o])?r[o]=t[o]:t[o].length>1?(a=JXG.copyAttributes(n,e.options,"circle","center"),r[o]=e.create("point",t[o],a)):r[o]=t[o];if(a=JXG.copyAttributes(n,e.options,"circle"),2==t.length&&JXG.isPoint(r[0])&&JXG.isPoint(r[1]))i=new JXG.Circle(e,"twoPoints",r[0],r[1],a);else if((JXG.isNumber(r[0])||JXG.isFunction(r[0])||JXG.isString(r[0]))&&JXG.isPoint(r[1]))i=new JXG.Circle(e,"pointRadius",r[1],r[0],a);else if((JXG.isNumber(r[1])||JXG.isFunction(r[1])||JXG.isString(r[1]))&&JXG.isPoint(r[0]))i=new JXG.Circle(e,"pointRadius",r[0],r[1],a);else if(r[0].elementClass==JXG.OBJECT_CLASS_CIRCLE&&JXG.isPoint(r[1]))i=new JXG.Circle(e,"pointCircle",r[1],r[0],a);else if(r[1].elementClass==JXG.OBJECT_CLASS_CIRCLE&&JXG.isPoint(r[0]))i=new JXG.Circle(e,"pointCircle",r[0],r[1],a);else if(r[0].elementClass==JXG.OBJECT_CLASS_LINE&&JXG.isPoint(r[1]))i=new JXG.Circle(e,"pointLine",r[1],r[0],a);else if(r[1].elementClass==JXG.OBJECT_CLASS_LINE&&JXG.isPoint(r[0]))i=new JXG.Circle(e,"pointLine",r[0],r[1],a);else{if(!(3==t.length&&JXG.isPoint(r[0])&&JXG.isPoint(r[1])&&JXG.isPoint(r[2])))throw Error("JSXGraph: Can't create circle with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'.\nPossible parent types: [point,point], [point,number], [point,function], [point,circle], [point,point,point]");i=JXG.createCircumcircle(e,r,n),i.midpoint.setProperty({visible:!1}),s=!1}return i.isDraggable=s,i},JXG.JSXGraph.registerElement("circle",JXG.createCircle),JXG.createEllipse=function(e,t,n){var i,r,o,a,s=[],l=JXG.copyAttributes(n,e.options,"conic","foci"),c=JXG.copyAttributes(n,e.options,"conic");for(o=0;2>o;o++)if(t[o].length>1)s[o]=e.create("point",t[o],l);else if(JXG.isPoint(t[o]))s[o]=JXG.getReference(e,t[o]);else if("function"==typeof t[o]&&t[o]().elementClass===JXG.OBJECT_CLASS_POINT)s[o]=t[o]();else{if(!JXG.isString(t[o]))throw Error("JSXGraph: Can't create Ellipse with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'.\nPossible parent types: [point,point,point], [point,point,number|function]");s[o]=JXG.getReference(e,t[o])}if(JXG.isNumber(t[2]))r=JXG.createFunction(t[2],e);else if("function"==typeof t[2]&&JXG.isNumber(t[2]()))r=t[2];else{if(JXG.isPoint(t[2]))i=JXG.getReference(e,t[2]);else if(t[2].length>1)i=e.create("point",t[2],l);else if("function"==typeof t[2]&&t[2]().elementClass==JXG.OBJECT_CLASS_POINT)i=t[2]();else{if(!JXG.isString(t[2]))throw Error("JSXGraph: Can't create Ellipse with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"' and '"+typeof t[2]+"'.\nPossible parent types: [point,point,point], [point,point,number|function]");i=JXG.getReference(e,t[2])}r=function(){return i.Dist(s[0])+i.Dist(s[1])}}t[4]===void 0&&(t[4]=1.0001*Math.PI),t[3]===void 0&&(t[3]=-1.0001*Math.PI);var u=e.create("point",[function(){return.5*(s[0].X()+s[1].X())},function(){return.5*(s[0].Y()+s[1].Y())}],l),d=function(){var e,t,n,i=s[0].X(),r=s[0].Y(),o=s[1].X(),a=s[1].Y(),l=o-i>0?1:-1;e=Math.abs(o-i)>1e-7?Math.atan2(a-r,o-i)+(0>l?Math.PI:0):(a-r>0?.5:-.5)*Math.PI,t=Math.cos(e),n=Math.sin(e);var c=[[1,0,0],[u.X(),t,-n],[u.Y(),n,t]];return c},h=e.create("curve",[function(){return 0},function(){return 0},t[3],t[4]],c),p=function(e,t){var n,i,o=.5*r(),l=o*o,c=.5*s[1].Dist(s[0]),p=l-c*c,f=Math.sqrt(p),g=[[1,0,0],[0,1,0],[0,0,1]];return t||(a=d(),n=u.X(),i=u.Y(),g[0][0]=a[0][0],g[0][1]=0,g[0][2]=0,g[1][0]=n*(1-a[1][1])+i*a[1][2],g[1][1]=a[1][1],g[1][2]=a[2][1],g[2][0]=i*(1-a[1][1])-n*a[1][2],g[2][1]=a[1][2],g[2][2]=a[2][2],h.quadraticform=JXG.Math.matMatMult(JXG.Math.transpose(g),JXG.Math.matMatMult([[-1+n*n/(o*o)+i*i/p,-n/l,-n/p],[-n/l,1/l,0],[-i/p,0,1/p]],g))),JXG.Math.matVecMult(a,[1,o*Math.cos(e),f*Math.sin(e)])};return h.X=function(e,t){return p(e,t)[1]},h.Y=function(e,t){return p(e,t)[2]},h.midpoint=u,h.type=JXG.OBJECT_TYPE_CONIC,h},JXG.createHyperbola=function(e,t,n){var i,r,o,a,s=[],l=JXG.copyAttributes(n,e.options,"conic","foci"),c=JXG.copyAttributes(n,e.options,"conic");for(o=0;2>o;o++)if(t[o].length>1)s[o]=e.create("point",t[o],attr_focu);else if(JXG.isPoint(t[o]))s[o]=JXG.getReference(e,t[o]);else if("function"==typeof t[o]&&t[o]().elementClass==JXG.OBJECT_CLASS_POINT)s[o]=t[o]();else{if(!JXG.isString(t[o]))throw Error("JSXGraph: Can't create Hyperbola with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'.\nPossible parent types: [point,point,point], [point,point,number|function]");s[o]=JXG.getReference(e,t[o])}if(JXG.isNumber(t[2]))r=JXG.createFunction(t[2],e);else if("function"==typeof t[2]&&JXG.isNumber(t[2]()))r=t[2];else{if(JXG.isPoint(t[2]))i=JXG.getReference(e,t[2]);else if(t[2].length>1)i=e.create("point",t[2],l);else if("function"==typeof t[2]&&t[2]().elementClass==JXG.OBJECT_CLASS_POINT)i=t[2]();else{if(!JXG.isString(t[2]))throw Error("JSXGraph: Can't create Hyperbola with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"' and '"+typeof t[2]+"'.\nPossible parent types: [point,point,point], [point,point,number|function]");i=JXG.getReference(e,t[2])}r=function(){return i.Dist(s[0])-i.Dist(s[1])}}t[4]===void 0&&(t[4]=1.0001*Math.PI),t[3]===void 0&&(t[3]=-1.0001*Math.PI);var u=e.create("point",[function(){return.5*(s[0].X()+s[1].X())},function(){return.5*(s[0].Y()+s[1].Y())}],l),d=function(){var e,t=s[0].X(),n=s[0].Y(),i=s[1].X(),r=s[1].Y(),o=i-t>0?1:-1;e=Math.abs(i-t)>1e-7?Math.atan2(r-n,i-t)+(0>o?Math.PI:0):(r-n>0?.5:-.5)*Math.PI;var a=[[1,0,0],[u.X(),Math.cos(e),-Math.sin(e)],[u.Y(),Math.sin(e),Math.cos(e)]];return a},h=e.create("curve",[function(){return 0},function(){return 0},t[3],t[4]],c),p=function(e,t){var n,i,o=.5*r(),l=o*o,c=.5*s[1].Dist(s[0]),p=Math.sqrt(-o*o+c*c),f=p*p,g=[[1,0,0],[0,1,0],[0,0,1]]; return t||(a=d(),n=u.X(),i=u.Y(),g[0][0]=a[0][0],g[0][1]=0,g[0][2]=0,g[1][0]=n*(1-a[1][1])+i*a[1][2],g[1][1]=a[1][1],g[1][2]=a[2][1],g[2][0]=i*(1-a[1][1])-n*a[1][2],g[2][1]=a[1][2],g[2][2]=a[2][2],h.quadraticform=JXG.Math.matMatMult(JXG.Math.transpose(g),JXG.Math.matMatMult([[-1+n*n/l+i*i/f,-n/l,i/f],[-n/l,1/l,0],[i/f,0,-1/f]],g))),JXG.Math.matVecMult(a,[1,o/Math.cos(e),p*Math.tan(e)])};return h.X=function(e,t){return p(e,t)[1]},h.Y=function(e,t){return p(e,t)[2]},h.midpoint=u,h.type=JXG.OBJECT_TYPE_CONIC,h},JXG.createParabola=function(e,t,n){var i,r=t[0],o=t[1],a=JXG.copyAttributes(n,e.options,"conic","foci"),s=JXG.copyAttributes(n,e.options,"conic");if(t[0].length>1)r=e.create("point",t[0],a);else if(JXG.isPoint(t[0]))r=JXG.getReference(e,t[0]);else if("function"==typeof t[0]&&t[0]().elementClass==JXG.OBJECT_CLASS_POINT)r=t[0]();else{if(!JXG.isString(t[0]))throw Error("JSXGraph: Can't create Parabola with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'.\nPossible parent types: [point,line]");r=JXG.getReference(e,t[0])}t[3]===void 0&&(t[3]=10),t[2]===void 0&&(t[2]=-10);var l=e.create("point",[function(){var t=[0,o.stdform[1],o.stdform[2]];return t=JXG.Math.crossProduct(t,r.coords.usrCoords),JXG.Math.Geometry.meetLineLine(t,o.stdform,0,e).usrCoords}],a),c=function(){var e=Math.atan(o.getSlope()),t=.5*(l.X()+r.X()),n=.5*(l.Y()+r.Y());e+=0>r.Y()-l.Y()||r.Y()==l.Y()&&r.X()>l.X()?Math.PI:0;var i=[[1,0,0],[t*(1-Math.cos(e))+n*Math.sin(e),Math.cos(e),-Math.sin(e)],[n*(1-Math.cos(e))-t*Math.sin(e),Math.sin(e),Math.cos(e)]];return i},u=e.create("curve",[function(){return 0},function(){return 0},t[2],t[3]],s),d=function(e,t){var n=.5*l.Dist(r),o=[[1,0,0],[0,1,0],[0,0,1]],a=.5*(l.X()+r.X()),s=.5*(l.Y()+r.Y());return t||(i=c(),o[0][0]=i[0][0],o[0][1]=0,o[0][2]=0,o[1][0]=a*(1-i[1][1])+s*i[1][2],o[1][1]=i[1][1],o[1][2]=i[2][1],o[2][0]=s*(1-i[1][1])-a*i[1][2],o[2][1]=i[1][2],o[2][2]=i[2][2],u.quadraticform=JXG.Math.matMatMult(JXG.Math.transpose(o),JXG.Math.matMatMult([[4*-s*n-a*a,a,2*n],[a,-1,0],[2*n,0,0]],o))),JXG.Math.matVecMult(i,[1,e+a,e*e/(4*n)+s])};return u.X=function(e,t){return d(e,t)[1]},u.Y=function(e,t){return d(e,t)[2]},u.type=JXG.OBJECT_TYPE_CONIC,u},JXG.createConic=function(e,t,n){var i,r,o,a,s,l,c,u,d,h=[[1,0,0],[0,1,0],[0,0,1]],p=[[1,0,0],[0,1,0],[0,0,1]],f=[],g=[],m=JXG.copyAttributes(n,e.options,"conic","foci"),v=JXG.copyAttributes(n,e.options,"conic");if(5==t.length)d=!0;else{if(6!=t.length)throw Error("JSXGraph: Can't create generic Conic with "+parent.length+" parameters.");d=!1}if(d)for(c=0;5>c;c++)if(t[c].length>1)f[c]=e.create("point",t[c],m);else if(JXG.isPoint(t[c]))f[c]=JXG.getReference(e,t[c]);else if("function"==typeof t[c]&&t[c]().elementClass==JXG.OBJECT_CLASS_POINT)f[c]=t[c]();else{if(!JXG.isString(t[c]))throw Error("JSXGraph: Can't create Conic section with parent types '"+typeof t[c]+"'.\nPossible parent types: [point,point,point,point,point], [a00,a11,a22,a01,a02,a12]");f[c]=JXG.getReference(e,t[c])}else u=[[0,0,0],[0,0,0],[0,0,0]],u[0][0]=JXG.isFunction(t[2])?function(){return t[2]()}:function(){return t[2]},u[0][1]=JXG.isFunction(t[4])?function(){return t[4]()}:function(){return t[4]},u[0][2]=JXG.isFunction(t[5])?function(){return t[5]()}:function(){return t[5]},u[1][1]=JXG.isFunction(t[0])?function(){return t[0]()}:function(){return t[0]},u[1][2]=JXG.isFunction(t[3])?function(){return t[3]()}:function(){return t[3]},u[2][2]=JXG.isFunction(t[1])?function(){return t[1]()}:function(){return t[1]};var b=function(e){var t,n;for(t=0;3>t;t++)for(n=t;3>n;n++)e[t][n]+=e[n][t];for(t=0;3>t;t++)for(n=0;t>n;n++)e[t][n]=e[n][t];return e},y=function(e,t){var n,i,r=[[0,0,0],[0,0,0],[0,0,0]];for(n=0;3>n;n++)for(i=0;3>i;i++)r[n][i]=e[n]*t[i];return b(r)},x=function(e,t,n){var i,r,o,a,s,l=[[0,0,0],[0,0,0],[0,0,0]];for(o=JXG.Math.matVecMult(t,n),i=JXG.Math.innerProduct(n,o),o=JXG.Math.matVecMult(e,n),r=JXG.Math.innerProduct(n,o),a=0;3>a;a++)for(s=0;3>s;s++)l[a][s]=i*e[a][s]-r*t[a][s];return l},w=e.create("curve",[function(){return 0},function(){return 0},0,2*Math.PI],v),k=function(e,t){var n,c,m,v;if(!t){if(d){for(n=0;5>n;n++)g[n]=f[n].coords.usrCoords;s=y(JXG.Math.crossProduct(g[0],g[1]),JXG.Math.crossProduct(g[2],g[3])),l=y(JXG.Math.crossProduct(g[0],g[2]),JXG.Math.crossProduct(g[1],g[3])),p=x(s,l,g[4])}else for(n=0;3>n;n++)for(c=n;3>c;c++)p[n][c]=u[n][c](),c>n&&(p[c][n]=p[n][c]);for(w.quadraticform=p,i=JXG.Math.Numerics.Jacobi(p),0>i[0][0][0]&&(i[0][0][0]*=-1,i[0][1][1]*=-1,i[0][2][2]*=-1),n=0;3>n;n++){for(m=0,c=0;3>c;c++)m+=i[1][c][n]*i[1][c][n];for(m=Math.sqrt(m),c=0;3>c;c++);}h=i[1],a=Math.sqrt(Math.abs(i[0][0][0])),r=Math.sqrt(Math.abs(i[0][1][1])),o=Math.sqrt(Math.abs(i[0][2][2]))}return 0>=i[0][1][1]&&0>=i[0][2][2]?v=JXG.Math.matVecMult(h,[1/a,Math.cos(e)/r,Math.sin(e)/o]):0>=i[0][1][1]&&i[0][2][2]>0?v=JXG.Math.matVecMult(h,[Math.cos(e)/a,1/r,Math.sin(e)/o]):0>i[0][2][2]&&(v=JXG.Math.matVecMult(h,[Math.sin(e)/a,Math.cos(e)/r,1/o])),v[1]/=v[0],v[2]/=v[0],v[0]=1,v};return w.X=function(e,t){return k(e,t)[1]},w.Y=function(e,t){return k(e,t)[2]},w.midpoint=e.create("point",[function(){var e=w.quadraticform;return[e[1][1]*e[2][2]-e[1][2]*e[1][2],e[1][2]*e[0][2]-e[2][2]*e[0][1],e[0][1]*e[1][2]-e[1][1]*e[0][2]]}],m),w.type=JXG.OBJECT_TYPE_CONIC,w},JXG.JSXGraph.registerElement("ellipse",JXG.createEllipse),JXG.JSXGraph.registerElement("hyperbola",JXG.createHyperbola),JXG.JSXGraph.registerElement("parabola",JXG.createParabola),JXG.JSXGraph.registerElement("conic",JXG.createConic),JXG.Polygon=function(e,t,n){this.constructor(e,n,JXG.OBJECT_TYPE_POLYGON,JXG.OBJECT_CLASS_AREA);var i,r,o,a=JXG.copyAttributes(n,e.options,"polygon","lines");for(this.withLines=n.withlines,this.vertices=[],i=0;t.length>i;i++)r=JXG.getRef(this.board,t[i]),this.vertices[i]=r;if(this.vertices[this.vertices.length-1]!=this.vertices[0]&&this.vertices.push(this.vertices[0]),this.borders=[],this.withLines)for(i=0;this.vertices.length-1>i;i++)a.id=a.ids&&a.ids[i],a.strokecolor=JXG.isArray(a.colors)&&a.colors[i%a.colors.length]||a.strokecolor,a.strokecolor===!1&&(a.strokecolor="none"),o=JXG.createSegment(e,[this.vertices[i],this.vertices[i+1]],a),this.borders[i]=o,o.parentPolygon=this;for(i=0;this.vertices.length-1>i;i++)r=JXG.getReference(this.board,this.vertices[i]),r.addChild(this);this.createLabel([0,0]),this.id=this.board.setId(this,"Py"),this.board.renderer.drawPolygon(this),this.board.finalizeAdding(this)},JXG.Polygon.prototype=new JXG.GeometryElement,JXG.extend(JXG.Polygon.prototype,{hasPoint:function(e,t){var n,i,r=!1;for(n=0,i=this.vertices.length-2;this.vertices.length-1>n;i=n++)this.vertices[n].coords.scrCoords[2]>t!=this.vertices[i].coords.scrCoords[2]>t&&(this.vertices[i].coords.scrCoords[1]-this.vertices[n].coords.scrCoords[1])*(t-this.vertices[n].coords.scrCoords[2])/(this.vertices[i].coords.scrCoords[2]-this.vertices[n].coords.scrCoords[2])+this.vertices[n].coords.scrCoords[1]>e&&(r=!r);return r},updateRenderer:function(){this.needsUpdate&&(this.board.renderer.updatePolygon(this),this.needsUpdate=!1),this.hasLabel&&this.label.content.visProp.visible&&(this.label.content.update(),this.board.renderer.updateText(this.label.content))},getTextAnchor:function(){var e,t=this.vertices[0].X(),n=this.vertices[0].Y(),i=t,r=n;for(e=0;this.vertices.length>e;e++)t>this.vertices[e].X()&&(t=this.vertices[e].X()),this.vertices[e].X()>i&&(i=this.vertices[e].X()),this.vertices[e].Y()>n&&(n=this.vertices[e].Y()),r>this.vertices[e].Y()&&(r=this.vertices[e].Y());return new JXG.Coords(JXG.COORDS_BY_USER,[.5*(t+i),.5*(n+r)],this.board)},getLabelAnchor:JXG.shortcut(JXG.Polygon.prototype,"getTextAnchor"),cloneToBackground:function(){var e,t={};t.id=this.id+"T"+this.numTraces,this.numTraces++,t.vertices=this.vertices,t.visProp=this.visProp,t.visProp.layer=this.board.options.layer.trace,t.board=this.board,JXG.clearVisPropOld(t),e=this.board.renderer.enhancedRendering,this.board.renderer.enhancedRendering=!0,this.board.renderer.drawPolygon(t),this.board.renderer.enhancedRendering=e,this.traces[t.id]=t.rendNode},hideElement:function(){var e;for(this.visProp.visible=!1,this.board.renderer.hide(this),e=0;this.borders.length>e;e++)this.borders[e].hideElement();this.hasLabel&&JXG.exists(this.label)&&(this.label.hiddenByParent=!0,this.label.content.visProp.visible&&this.board.renderer.hide(this.label.content))},showElement:function(){var e;for(this.visProp.visible=!0,this.board.renderer.show(this),e=0;this.borders.length>e;e++)this.borders[e].showElement();this.hasLabel&&JXG.exists(this.label)&&this.label.content.visProp.visible&&this.board.renderer.show(this.label.content)},Area:function(){var e,t=0;for(e=0;this.vertices.length-1>e;e++)t+=this.vertices[e].X()*this.vertices[e+1].Y()-this.vertices[e+1].X()*this.vertices[e].Y();return t/=2,Math.abs(t)},remove:function(){var e;for(e=0;this.borders.length>e;e++)this.borders[e].remove();this.board.renderer.remove(this.rendNode)}}),JXG.createPolygon=function(e,t,n){var i,r,o=JXG.copyAttributes(n,e.options,"polygon");for(r=0;t.length>r;r++)if(t[r]=JXG.getReference(e,t[r]),!JXG.isPoint(t[r]))throw Error("JSXGraph: Can't create polygon with parent types other than 'point'.");return i=new JXG.Polygon(e,t,o)},JXG.createRegularPolygon=function(e,t,n){var i,r,o,a,s,l,c,u=[];if(JXG.isNumber(t[t.length-1])&&3!=t.length)throw Error("JSXGraph: A regular polygon needs two point and a number as input.");if(s=t.length,o=t[s-1],!JXG.isNumber(o)&&!JXG.isPoint(JXG.getReference(e,o))||3>o)throw Error("JSXGraph: The third parameter has to be number greater than 2 or a point.");for(JXG.isPoint(JXG.getReference(e,o))?(o=s,l=!0):(s--,l=!1),r=0;s>r;r++)if(t[r]=JXG.getReference(e,t[r]),!JXG.isPoint(t[r]))throw Error("JSXGraph: Can't create regular polygon if the first two parameters aren't points.");for(u[0]=t[0],u[1]=t[1],c=JXG.copyAttributes(n,e.options,"polygon","points"),r=2;o>r;r++)a=e.create("transform",[Math.PI*(2-(o-2)/o),u[r-1]],{type:"rotate"}),l?(u[r]=t[r],u[r].addTransform(t[r-2],a)):u[r]=e.create("point",[u[r-2],a],c);return c=JXG.copyAttributes(n,e.options,"polygon"),i=e.create("polygon",u,c)},JXG.JSXGraph.registerElement("polygon",JXG.createPolygon),JXG.JSXGraph.registerElement("regularpolygon",JXG.createRegularPolygon),JXG.Curve=function(e,t,n){this.constructor(e,n,JXG.OBJECT_TYPE_CURVE,JXG.OBJECT_CLASS_CURVE),this.points=[],this.doAdvancedPlot=n.doadvancedplot,this.numberPointsHigh=n.numberpointshigh,this.numberPointsLow=n.numberpointslow,this.numberPoints=this.numberPointsHigh,this.dataX=null,this.dataY=null,this.varname=null!=t[0]?t[0]:"x",this.xterm=t[1],this.yterm=t[2],this.generateTerm(this.varname,this.xterm,this.yterm,t[3],t[4]),this.updateCurve(),this.id=this.board.setId(this,"G"),this.board.renderer.drawCurve(this),this.board.finalizeAdding(this),this.createGradient(),this.createLabel(),"string"==typeof this.xterm&&this.notifyParents(this.xterm),"string"==typeof this.yterm&&this.notifyParents(this.yterm)},JXG.Curve.prototype=new JXG.GeometryElement,JXG.extend(JXG.Curve.prototype,{minX:function(){if("polar"==this.visProp.curvetype)return 0;var e=new JXG.Coords(JXG.COORDS_BY_SCREEN,[0,0],this.board);return e.usrCoords[1]},maxX:function(){var e;return"polar"==this.visProp.curvetype?2*Math.PI:(e=new JXG.Coords(JXG.COORDS_BY_SCREEN,[this.board.canvasWidth,0],this.board),e.usrCoords[1])},hasPoint:function(e,t){var n,i,r,o,a,s,l,c,u,d,h,p,f,g,m,v,b,y,x,w,k=1/0,C=this.numberPointsLow,_=(this.maxX()-this.minX())/C,T=this.board.options.precision.hasPoint/this.board.unitX,E=!0;if(T*=T,x=new JXG.Coords(JXG.COORDS_BY_SCREEN,[e,t],this.board),e=x.usrCoords[1],t=x.usrCoords[2],"parameter"==this.visProp.curvetype||"polar"==this.visProp.curvetype||"functiongraph"==this.visProp.curvetype)for(w=this.transformations.length,o=0,n=this.minX();C>o;o++){for(s=this.X(n,E),l=this.Y(n,E),a=0;w>a;a++)r=this.transformations[a],r.update(),i=JXG.Math.matVecMult(r.matrix,[1,s,l]),s=i[1],l=i[2];if(k=(e-s)*(e-s)+(t-l)*(t-l),T>k)return!0;n+=_}else if("plot"==this.visProp.curvetype){for(w=this.numberPoints,o=0;w-1>o;o++)if(c=this.X(o),u=this.X(o+1),d=this.Y(o),h=this.Y(o+1),m=u-c,v=h-d,f=e-c,g=t-d,y=m*m+v*v,y>=JXG.Math.eps?(b=f*m+g*v,p=b/y,k=f*f+g*g-p*b):(p=0,k=f*f+g*g),p>=0&&1>=p&&T>k)return!0;return!1}return T>k},allocatePoints:function(){var e,t;if(t=this.numberPoints,this.points.length<this.numberPoints)for(e=this.points.length;t>e;e++)this.points[e]=new JXG.Coords(JXG.COORDS_BY_USER,[0,0],this.board)},update:function(){return this.needsUpdate&&(this.visProp.trace&&this.cloneToBackground(!0),this.updateCurve()),this},updateRenderer:function(){return this.needsUpdate&&(this.board.renderer.updateCurve(this),this.needsUpdate=!1,this.hasLabel&&this.label.content.visProp.visible&&(this.label.content.update(),this.board.renderer.updateText(this.label.content))),this},updateDataArray:function(){return this},updateCurve:function(){var e,t,n,i,r,o,a=!1;if(this.updateDataArray(),t=this.minX(),n=this.maxX(),null!=this.dataX)for(this.numberPoints=this.dataX.length,e=this.numberPoints,this.allocatePoints(),o=0;e>o;o++)i=o,r=null!=this.dataY?o:this.X(i),this.points[o].setCoordinates(JXG.COORDS_BY_USER,[this.X(i,a),this.Y(r,a)],!1),this.updateTransform(this.points[o]),a=!0;else this.doAdvancedPlot?this.updateParametricCurve(t,n,e):(this.numberPoints=this.board.updateQuality==this.board.BOARD_QUALITY_HIGH?this.numberPointsHigh:this.numberPointsLow,e=this.numberPoints,this.allocatePoints(),this.updateParametricCurveNaive(t,n,e));return this},updateParametricCurveNaive:function(e,t,n){var i,r,o=!1,a=(t-e)/n;for(i=0;n>i;i++)r=e+i*a,this.points[i].setCoordinates(JXG.COORDS_BY_USER,[this.X(r,o),this.Y(r,o)],!1),this.updateTransform(this.points[i]),o=!0;return this},updateParametricCurve:function(e,t){var n,i,r,o,a,s,l,c,u,d,h,p,f,g=!1,m=new JXG.Coords(JXG.COORDS_BY_USER,[0,0],this.board),v=[],b=[],y=[],x=[],w=!1,k=0,C=function(e,t,n){var i,r,o=n[1]-e[1],a=n[2]-e[2],s=t[0]-e[1],l=t[1]-e[2],c=s*s+l*l;return c>=JXG.Math.eps&&(i=(o*s+a*l)/c,i>0&&(1>=i?(o-=i*s,a-=i*l):(o-=s,a-=l))),r=o*o+a*a,Math.sqrt(r)};for(this.board.updateQuality==this.board.BOARD_QUALITY_LOW?(d=15,h=10,p=10):(d=21,h=.7,p=.7),x[0]=t-e,n=1;d>n;n++)x[n]=.5*x[n-1];n=1,v[0]=1,b[0]=0,i=e,m.setCoordinates(JXG.COORDS_BY_USER,[this.X(i,g),this.Y(i,g)],!1),g=!0,s=m.scrCoords[1],l=m.scrCoords[2],r=i,i=t,m.setCoordinates(JXG.COORDS_BY_USER,[this.X(i,g),this.Y(i,g)],!1),o=m.scrCoords[1],a=m.scrCoords[2],y[0]=[o,a],c=1,u=0,this.points=[],this.points[k++]=new JXG.Coords(JXG.COORDS_BY_SCREEN,[s,l],this.board);do{for(w=this.isDistOK(o-s,a-l,h,p)||this.isSegmentOutside(s,l,o,a);d>u&&(!w||3>u)&&(this.isSegmentDefined(s,l,o,a)||7>=u);)v[c]=n,b[c]=u,y[c]=[o,a],c++,n=2*n-1,u++,i=e+n*x[u],m.setCoordinates(JXG.COORDS_BY_USER,[this.X(i,g),this.Y(i,g)],!1),o=m.scrCoords[1],a=m.scrCoords[2],w=this.isDistOK(o-s,a-l,h,p)||this.isSegmentOutside(s,l,o,a);k>1&&(f=C(this.points[k-2].scrCoords,[o,a],this.points[k-1].scrCoords),.015>f&&k--),this.points[k]=new JXG.Coords(JXG.COORDS_BY_SCREEN,[o,a],this.board),this.updateTransform(this.points[k]),k++,s=o,l=a,r=i,c--,o=y[c][0],a=y[c][1],u=b[c]+1,n=2*v[c]}while(c>0&&5e5>k);return this.numberPoints=this.points.length,this},isSegmentOutside:function(e,t,n,i){return 0>t&&0>i?!0:t>this.board.canvasHeight&&i>this.board.canvasHeight?!0:0>e&&0>n?!0:e>this.board.canvasWidth&&n>this.board.canvasWidth?!0:!1},isDistOK:function(e,t,n,i){return isNaN(e+t)?!1:i>Math.abs(e)&&i>Math.abs(t)},isSegmentDefined:function(e,t,n,i){return!(isNaN(e+t)&&isNaN(n+i))},updateTransform:function(e){var t,n,i,r=this.transformations.length;if(0==r)return e;for(i=0;r>i;i++)t=this.transformations[i],t.update(),n=JXG.Math.matVecMult(t.matrix,e.usrCoords),e.setCoordinates(JXG.COORDS_BY_USER,[n[1],n[2]]);return e},addTransform:function(e){var t,n,i;for(t=JXG.isArray(e)?e:[e],i=t.length,n=0;i>n;n++)this.transformations.push(t[n]);return this},setPosition:function(e,t,n){var i=this.board.create("transform",[t,n],{type:"translate"});return this.transformations.length>0&&this.transformations[this.transformations.length-1].isNumericMatrix?this.transformations[this.transformations.length-1].melt(i):this.addTransform(i),this},generateTerm:function(e,t,n,i,r){var o,a;JXG.isArray(t)?(this.dataX=t,this.X=function(e){var t,n,i=parseInt(Math.floor(e));return 0>e?i=0:e>this.dataX.length-2&&(i=this.dataX.length-2),i==e?this.dataX[i]:(t=this.dataX[i],n=this.dataX[i+1],t+(n-t)*(e-i))},this.visProp.curvetype="plot",this.numberPoints=this.dataX.length):(this.X=JXG.createFunction(t,this.board,e),JXG.isString(t)?this.visProp.curvetype="functiongraph":(JXG.isFunction(t)||JXG.isNumber(t))&&(this.visProp.curvetype="parameter")),JXG.isArray(n)?(this.dataY=n,this.Y=function(e){var t,n,i=parseInt(Math.floor(e));return 0>e?i=0:e>this.dataY.length-2&&(i=this.dataY.length-2),i==e?JXG.isFunction(this.dataY[i])?this.dataY[i]():this.dataY[i]:(t=JXG.isFunction(this.dataY[i])?this.dataY[i]():this.dataY[i],n=JXG.isFunction(this.dataY[i+1])?this.dataY[i+1]():this.dataY[i+1],t+(n-t)*(e-i))}):this.Y=JXG.createFunction(n,this.board,e),JXG.isFunction(t)&&JXG.isArray(n)&&(o=JXG.createFunction(n[0],this.board,""),a=JXG.createFunction(n[1],this.board,""),this.X=function(e){return t(e)*Math.cos(e)+o()},this.Y=function(e){return t(e)*Math.sin(e)+a()},this.visProp.curvetype="polar"),null!=i&&(this.minX=JXG.createFunction(i,this.board,"")),null!=r&&(this.maxX=JXG.createFunction(r,this.board,""))},notifyParents:function(e){JXG.GeonextParser.findDependencies(this,e,this.board)},getLabelAnchor:function(){var e=new JXG.Coords(JXG.COORDS_BY_SCREEN,[0,.5*this.board.canvasHeight],this.board);return e=JXG.Math.Geometry.projectCoordsToCurve(e.usrCoords[1],e.usrCoords[2],0,this,this.board)[0]},cloneToBackground:function(){var e,t={};t.id=this.id+"T"+this.numTraces,t.elementClass=JXG.OBJECT_CLASS_CURVE,this.numTraces++,t.points=this.points.slice(0),t.numberPoints=this.numberPoints,t.board=this.board,t.visProp=this.visProp,t.visProp.layer=this.board.options.layer.trace,t.visProp.curvetype=this.visProp.curvetype,JXG.clearVisPropOld(t),e=this.board.renderer.enhancedRendering,this.board.renderer.enhancedRendering=!0,this.board.renderer.drawCurve(t),this.board.renderer.enhancedRendering=e,this.traces[t.id]=t.rendNode},bounds:function(){var e,t,n,i,r,o,a,s,l=this.numberPointsLow,c=(this.maxX()-this.minX())/l,u=[this.minX(),0,this.maxX(),0];if("parameter"==this.visProp.curvetype||"polar"==this.visProp.curvetype||"functiongraph"==this.visProp.curvetype)for(o=this.transformations.length,i=this.minX(),e=0;l>e;e++){for(a=this.X(i,!0),s=this.Y(i,!0),t=0;o>t;t++)n=this.transformations[t],n.update(),r=JXG.Math.matVecMult(n.matrix,[1,a,s]),a=r[1],s=r[2];s>u[1]&&(u[1]=s),u[3]>s&&(u[3]=s),i+=c}else if("plot"==this.visProp.curvetype)for(o=this.numberPoints,e=0;o>e;e++)s=this.Y(e),s>u[1]&&(u[1]=s),u[3]>s&&(u[3]=s);return u}}),JXG.createCurve=function(e,t,n){var i=JXG.copyAttributes(n,e.options,"curve");return new JXG.Curve(e,["x"].concat(t),i)},JXG.JSXGraph.registerElement("curve",JXG.createCurve),JXG.createFunctiongraph=function(e,t,n){var i,r=["x","x"].concat(t);return i=JXG.copyAttributes(n,e.options,"curve"),i.curvetype="functiongraph",new JXG.Curve(e,r,i)},JXG.JSXGraph.registerElement("functiongraph",JXG.createFunctiongraph),JXG.JSXGraph.registerElement("plot",JXG.createFunctiongraph),JXG.createSpline=function(e,t,n){var i;return i=function(){var e,n=[],i=[],r=function(r,o){var a;if(!o){if(n=[],i=[],2==t.length&&JXG.isArray(t[0])&&JXG.isArray(t[1])&&t[0].length==t[1].length)for(a=0;t[0].length>a;a++)"function"==typeof t[0][a]?n.push(t[0][a]()):n.push(t[0][a]),"function"==typeof t[1][a]?i.push(t[1][a]()):i.push(t[1][a]);else for(a=0;t.length>a;a++)if(JXG.isPoint(t[a]))n.push(t[a].X()),i.push(t[a].Y());else if(JXG.isArray(t[a])&&2==t[a].length)for(a=0;t.length>a;a++)"function"==typeof t[a][0]?n.push(t[a][0]()):n.push(t[a][0]),"function"==typeof t[a][1]?i.push(t[a][1]()):i.push(t[a][1]);e=JXG.Math.Numerics.splineDef(n,i)}return JXG.Math.Numerics.splineEval(r,n,i,e)};return r},e.create("curve",["x",i()],n)},JXG.JSXGraph.registerElement("spline",JXG.createSpline),JXG.createRiemannsum=function(e,t,n){var i,r,o,a,s,l;if(l=JXG.copyAttributes(n,e.options,"riemannsum"),l.curvetype="plot",o=t[0],i=JXG.createFunction(t[1],e,""),null==i)throw Error("JSXGraph: JXG.createRiemannsum: argument '2' n has to be number or function.\nPossible parent types: [function,n:number|function,type,start:number|function,end:number|function]");if(r=JXG.createFunction(t[2],e,"",!1),null==r)throw Error("JSXGraph: JXG.createRiemannsum: argument 3 'type' has to be string or function.\nPossible parent types: [function,n:number|function,type,start:number|function,end:number|function]");return a=[[0],[0]].concat(t.slice(3)),s=e.create("curve",a,l),s.updateDataArray=function(){var e=JXG.Math.Numerics.riemann(o,i(),r(),this.minX(),this.maxX());this.dataX=e[0],this.dataY=e[1]},s},JXG.JSXGraph.registerElement("riemannsum",JXG.createRiemannsum),JXG.createArc=function(e,t,n){var i,r;if(!(t=JXG.checkParents("arc",t,[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT],[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT]])))throw Error("JSXGraph: Can't create Arc with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"' and '"+typeof t[2]+"'.\nPossible parent types: [point,point,point]");return r=JXG.copyAttributes(n,e.options,"arc"),i=e.create("curve",[[0],[0]],r),i.type=JXG.OBJECT_TYPE_ARC,i.midpoint=JXG.getReference(e,t[0]),i.radiuspoint=JXG.getReference(e,t[1]),i.point2=i.radiuspoint,i.anglepoint=JXG.getReference(e,t[2]),i.point3=i.anglepoint,i.midpoint.addChild(i),i.radiuspoint.addChild(i),i.anglepoint.addChild(i),i.useDirection=r.usedirection,i.updateDataArray=function(){var e,n,i,r,o,a,s,l,c,u,d=this.radiuspoint,h=this.midpoint,p=this.anglepoint,f=JXG.Math.Geometry.rad(d,h,p),g=Math.ceil(90*(f/Math.PI))+1,m=f/g,v=h.X(),b=h.Y();for(this.useDirection&&(l=t[1].coords.usrCoords,c=t[3].coords.usrCoords,u=t[2].coords.usrCoords,s=(l[1]-u[1])*(l[2]-c[2])-(l[2]-u[2])*(l[1]-c[1]),0>s?(this.radiuspoint=t[1],this.anglepoint=t[2]):(this.radiuspoint=t[2],this.anglepoint=t[1])),this.dataX=[d.X()],this.dataY=[d.Y()],e=m,o=1;g>=o;o++,e+=m)n=Math.cos(e),i=Math.sin(e),r=[[1,0,0],[v*(1-n)+b*i,n,-i],[b*(1-n)-v*i,i,n]],a=JXG.Math.matVecMult(r,d.coords.usrCoords),this.dataX.push(a[1]/a[0]),this.dataY.push(a[2]/a[0]);this.updateStdform(),this.updateQuadraticform()},i.Radius=function(){return this.radiuspoint.Dist(this.midpoint)},i.getRadius=function(){return this.Radius()},i.hasPoint=function(e,t){var n,i=this.board.options.precision.hasPoint/this.board.unitX,r=new JXG.Coords(JXG.COORDS_BY_SCREEN,[e,t],this.board),o=this.Radius(),a=this.midpoint.coords.distance(JXG.COORDS_BY_USER,r),s=i>Math.abs(a-o);return s&&(n=JXG.Math.Geometry.rad(this.radiuspoint,this.midpoint,r.usrCoords.slice(1)),n>JXG.Math.Geometry.rad(this.radiuspoint,this.midpoint,this.anglepoint)&&(s=!1)),s},i.hasPointSector=function(e,t){var n,i=new JXG.Coords(JXG.COORDS_BY_SCREEN,[e,t],this.board),r=this.Radius(),o=this.midpoint.coords.distance(JXG.COORDS_BY_USER,i),a=r>o;return a&&(n=JXG.Math.Geometry.rad(this.radiuspoint,this.midpoint,i.usrCoords.slice(1)),n>JXG.Math.Geometry.rad(this.radiuspoint,this.midpoint,this.anglepoint)&&(a=!1)),a},i.getTextAnchor=function(){return this.midpoint.coords},i.getLabelAnchor=function(){var e,t,n,i,r=JXG.Math.Geometry.rad(this.radiuspoint,this.midpoint,this.anglepoint),o=10/this.board.unitX,a=10/this.board.unitY,s=this.point2.coords.usrCoords,l=this.midpoint.coords.usrCoords,c=s[1]-l[1],u=s[2]-l[2];return null!=this.label.content&&(this.label.content.relativeCoords=new JXG.Coords(JXG.COORDS_BY_SCREEN,[0,0],this.board)),e=new JXG.Coords(JXG.COORDS_BY_USER,[l[1]+Math.cos(.5*r)*c-Math.sin(.5*r)*u,l[2]+Math.sin(.5*r)*c+Math.cos(.5*r)*u],this.board),t=e.usrCoords[1]-l[1],n=e.usrCoords[2]-l[2],i=Math.sqrt(t*t+n*n),t=t*(i+o)/i,n=n*(i+a)/i,new JXG.Coords(JXG.COORDS_BY_USER,[l[1]+t,l[2]+n],this.board)},i.updateQuadraticform=function(){var e=this.midpoint,t=e.X(),n=e.Y(),i=this.Radius();this.quadraticform=[[t*t+n*n-i*i,-t,-n],[-t,1,0],[-n,0,1]]},i.updateStdform=function(){this.stdform[3]=.5,this.stdform[4]=this.Radius(),this.stdform[1]=-this.midpoint.coords.usrCoords[1],this.stdform[2]=-this.midpoint.coords.usrCoords[2],this.normalize()},i.prepareUpdate().update(),i},JXG.JSXGraph.registerElement("arc",JXG.createArc),JXG.createSemicircle=function(e,t,n){var i,r,o;if(!JXG.isPoint(t[0])||!JXG.isPoint(t[1]))throw Error("JSXGraph: Can't create Semicircle with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'.\nPossible parent types: [point,point]");return o=JXG.copyAttributes(n,e.options,"circle","center"),r=e.create("midpoint",[t[0],t[1]],o),o=JXG.copyAttributes(n,e.options,"circle"),i=e.create("arc",[r,t[1],t[0]],o),i.midpoint=r,i},JXG.JSXGraph.registerElement("semicircle",JXG.createSemicircle),JXG.createCircumcircleArc=function(e,t,n){var i,r,o;if(!(JXG.isPoint(t[0])&&JXG.isPoint(t[1])&&JXG.isPoint(t[2])))throw Error("JSXGraph: create Circumcircle Arc with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"' and '"+typeof t[2]+"'.\nPossible parent types: [point,point,point]");return o=JXG.copyAttributes(n,e.options,"arc","center"),r=e.create("circumcirclemidpoint",[t[0],t[1],t[2]],o),o=JXG.copyAttributes(n,e.options,"arc"),o.usedirection=!0,i=e.create("arc",[r,t[0],t[2],t[1]],o),i.midpoint=r,i},JXG.JSXGraph.registerElement("circumcirclearc",JXG.createCircumcircleArc),JXG.createSector=function(e,t,n){var i,r;if(!(JXG.isPoint(t[0])&&JXG.isPoint(t[1])&&JXG.isPoint(t[2])))throw Error("JSXGraph: Can't create Sector with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"' and '"+typeof t[2]+"'.");return r=JXG.copyAttributes(n,e.options,"sector"),i=e.create("curve",[[0],[0]],r),i.type=JXG.OBJECT_TYPE_SECTOR,i.point1=JXG.getReference(e,t[0]),i.point2=JXG.getReference(e,t[1]),i.point3=JXG.getReference(e,t[2]),i.point1.addChild(i),i.point2.addChild(i),i.point3.addChild(i),i.useDirection=n.usedirection,i.updateDataArray=function(){var e,n,i,r,o,a,s,l,c,u,d=this.point2,h=this.point1,p=this.point3,f=JXG.Math.Geometry.rad(d,h,p),g=Math.ceil(90*(f/Math.PI))+1,m=f/g,v=h.X(),b=h.Y();for(this.useDirection&&(l=t[1].coords.usrCoords,c=t[3].coords.usrCoords,u=t[2].coords.usrCoords,s=(l[1]-u[1])*(l[2]-c[2])-(l[2]-u[2])*(l[1]-c[1]),0>s?(this.point2=t[1],this.point3=t[2]):(this.point2=t[2],this.point3=t[1])),this.dataX=[h.X(),d.X()],this.dataY=[h.Y(),d.Y()],e=m,o=1;g>=o;o++,e+=m)n=Math.cos(e),i=Math.sin(e),r=[[1,0,0],[v*(1-n)+b*i,n,-i],[b*(1-n)-v*i,i,n]],a=JXG.Math.matVecMult(r,d.coords.usrCoords),this.dataX.push(a[1]/a[0]),this.dataY.push(a[2]/a[0]);this.dataX.push(h.X()),this.dataY.push(h.Y())},i.Radius=function(){return this.point2.Dist(this.point1)},i.getRadius=function(){return this.Radius()},i.hasPointSector=function(e,t){var n,i=new JXG.Coords(JXG.COORDS_BY_SCREEN,[e,t],this.board),r=this.Radius(),o=this.point1.coords.distance(JXG.COORDS_BY_USER,i),a=r>o;return a&&(n=JXG.Math.Geometry.rad(this.point2,this.point1,i.usrCoords.slice(1)),n>JXG.Math.Geometry.rad(this.point2,this.point1,this.point3)&&(a=!1)),a},i.getTextAnchor=function(){return this.point1.coords},i.getLabelAnchor=function(){var e,t,n,i,r=JXG.Math.Geometry.rad(this.point2,this.point1,this.point3),o=10/this.board.unitX,a=10/this.board.unitY,s=this.point2.coords.usrCoords,l=this.point1.coords.usrCoords,c=s[1]-l[1],u=s[2]-l[2];return null!=this.label.content&&(this.label.content.relativeCoords=new JXG.Coords(JXG.COORDS_BY_SCREEN,[0,0],this.board)),e=new JXG.Coords(JXG.COORDS_BY_USER,[l[1]+Math.cos(.5*r)*c-Math.sin(.5*r)*u,l[2]+Math.sin(.5*r)*c+Math.cos(.5*r)*u],this.board),t=e.usrCoords[1]-l[1],n=e.usrCoords[2]-l[2],i=Math.sqrt(t*t+n*n),t=t*(i+o)/i,n=n*(i+a)/i,new JXG.Coords(JXG.COORDS_BY_USER,[l[1]+t,l[2]+n],this.board)},i.prepareUpdate().update(),i},JXG.JSXGraph.registerElement("sector",JXG.createSector),JXG.createCircumcircleSector=function(e,t,n){var i,r,o;if(!(JXG.isPoint(t[0])&&JXG.isPoint(t[1])&&JXG.isPoint(t[2])))throw Error("JSXGraph: Can't create circumcircle sector with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"' and '"+typeof t[2]+"'.");return o=JXG.copyAttributes(n,e.options,"circumcirclesector","point"),r=e.create("circumcirclemidpoint",[t[0],t[1],t[2]],o),o=JXG.copyAttributes(n,e.options,"circumcirclesector"),i=e.create("sector",[r,t[0],t[2],t[1]],o),i},JXG.JSXGraph.registerElement("circumcirclesector",JXG.createCircumcircleSector),JXG.createAngle=function(e,t,n){var i,r,o,a,s,l,c,u,d,h,p=["&alpha;","&beta;","&gamma;","&delta;","&epsilon;","&zeta;","&eta","&theta;","&iota;","&kappa;","&lambda;","&mu;","&nu;","&xi;","&omicron;","&pi;","&rho;","&sigmaf;","&sigma;","&tau;","&upsilon;","&phi;","&chi;","&psi;","&omega;"],f=0;if(!(JXG.isPoint(t[0])&&JXG.isPoint(t[1])&&JXG.isPoint(t[2])))throw Error("JSXGraph: Can't create angle with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"' and '"+typeof t[2]+"'.");if(o=n.text,""==o){for(;p.length>f;){s=f,l=p[f];for(i in e.objects)if(e.objects[i].type==JXG.OBJECT_TYPE_ANGLE&&e.objects[i].text==l){f++;break}f==s&&(o=l,f=p.length+1)}if(f==p.length)for(c="&alpha;_{",u="}",d=!1,s=0;!d;){for(i in e.objects)if(e.objects[i].type==JXG.OBJECT_TYPE_ANGLE&&e.objects[i].text==c+s+u){d=!0;break}d?d=!1:(d=!0,o=c+s+u)}}for(a=JXG.copyAttributes(n,e.options,"angle","point"),r=e.create("point",[function(){var e=t[0],n=t[1],i=a.radius,r=n.Dist(e);return[n.X()+(e.X()-n.X())*i/r,n.Y()+(e.Y()-n.Y())*i/r]}],a),a=JXG.copyAttributes(n,e.options,"angle"),i=e.create("sector",[t[1],r,t[2]],a),i.radiuspoint=r,h=JXG.copyAttributes(n,e.options,"angle","dot"),i.dot=e.create("point",[function(){if(JXG.exists(i.dot)&&i.dot.visProp.visible===!1)return[0,0];var n=r.coords.usrCoords,o=e.create("transform",[-t[1].X(),-t[1].Y()],{type:"translate"});return o.melt(e.create("transform",[.5,.5],{type:"scale"})),o.melt(e.create("transform",[JXG.Math.Geometry.rad(t[0],t[1],t[2])/2,0,0],{type:"rotate"})),o.melt(e.create("transform",[t[1].X(),t[1].Y()],{type:"translate"})),o.update(),JXG.Math.matVecMult(o.matrix,n)}],h),f=0;3>f;f++)JXG.getRef(e,t[f]).addChild(r),JXG.getRef(e,t[f]).addChild(i.dot);return i.type=JXG.OBJECT_TYPE_ANGLE,i.visProp.withlabel&&(i.label.content.setText(o),i.label.content.setProperty({fontSize:i.visProp.fontsize,strokeColor:i.visProp.textcolor})),JXG.getRef(e,t[0]).addChild(i),i.getLabelAnchor=function(){var e,t,n,i,r=JXG.Math.Geometry.rad(this.point2,this.point1,this.point3),o=10/this.board.unitX,a=10/this.board.unitY,s=this.point2.coords.usrCoords,l=this.point1.coords.usrCoords,c=s[1]-l[1],u=s[2]-l[2];return null!=this.label.content&&(this.label.content.relativeCoords=new JXG.Coords(JXG.COORDS_BY_SCREEN,[0,0],this.board)),e=new JXG.Coords(JXG.COORDS_BY_USER,[l[1]+Math.cos(1.125*.5*r)*c-Math.sin(1.125*.5*r)*u,l[2]+Math.sin(1.125*.5*r)*c+Math.cos(1.125*.5*r)*u],this.board),t=e.usrCoords[1]-l[1],n=e.usrCoords[2]-l[2],i=Math.sqrt(t*t+n*n),t=t*(i+o)/i,n=n*(i+a)/i,new JXG.Coords(JXG.COORDS_BY_USER,[l[1]+t,l[2]+n],this.board)},i},JXG.JSXGraph.registerElement("angle",JXG.createAngle),JXG.Composition=function(e){var t,n=["setProperty","prepareUpdate","updateRenderer","update","highlight","noHighlight"],i=function(e){return function(){var t;for(t in r.elements)JXG.exists(r.elements[t][e])&&r.elements[t][e].apply(r.elements[t],arguments);return r}},r=this;for(t=0;n.length>t;t++)this[n[t]]=i(n[t]);this.elements={};for(t in e)e.hasOwnProperty(t)&&this.add(t,e[t])},JXG.extend(JXG.Composition.prototype,{add:function(e,t){return!JXG.exists(this[e])&&JXG.exists(t)?(JXG.exists(t.id)?this.elements[t.id]=t:this.elements[e]=t,this[e]=t,!0):!1},remove:function(e){var t,n=!1;for(t in this.elements)if(this.elements[t].id===this[e].id){n=!0;break}return n&&(delete this.elements[this[e].id],delete this[e]),n}}),JXG.createPerpendicularPoint=function(e,t,n){var i,r,o;if(JXG.isPoint(t[0])&&t[1].elementClass==JXG.OBJECT_CLASS_LINE)r=t[0],i=t[1];else{if(!JXG.isPoint(t[1])||t[0].elementClass!=JXG.OBJECT_CLASS_LINE)throw Error("JSXGraph: Can't create perpendicular point with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'.\nPossible parent types: [point,line]"); r=t[1],i=t[0]}return o=e.create("point",[function(){return JXG.Math.Geometry.perpendicular(i,r,e)[0]}],n),r.addChild(o),i.addChild(o),o.update(),o.generatePolynomial=function(){var e=i.point1.symbolic.x,t=i.point1.symbolic.y,n=i.point2.symbolic.x,a=i.point2.symbolic.y,s=r.symbolic.x,l=r.symbolic.y,c=o.symbolic.x,u=o.symbolic.y,d="("+t+")*("+c+")-("+t+")*("+n+")+("+u+")*("+n+")-("+e+")*("+u+")+("+e+")*("+a+")-("+c+")*("+a+")",h="("+l+")*("+t+")-("+l+")*("+a+")-("+u+")*("+t+")+("+u+")*("+a+")+("+s+")*("+e+")-("+s+")*("+n+")-("+c+")*("+e+")+("+c+")*("+n+")";return[d,h]},o},JXG.createPerpendicular=function(e,t,n){var i,r,o,a,s;if(t[0]=JXG.getReference(e,t[0]),t[1]=JXG.getReference(e,t[1]),JXG.isPoint(t[0])&&t[1].elementClass==JXG.OBJECT_CLASS_LINE)r=t[1],i=t[0];else{if(!JXG.isPoint(t[1])||t[0].elementClass!=JXG.OBJECT_CLASS_LINE)throw Error("JSXGraph: Can't create perpendicular with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'.\nPossible parent types: [line,point]");r=t[0],i=t[1]}return s=JXG.copyAttributes(n,e.options,"perpendicular","point"),a=JXG.createPerpendicularPoint(e,[r,i],s),JXG.exists(n.layer)||(n.layer=e.options.layer.line),s=JXG.copyAttributes(n,e.options,"perpendicular"),o=JXG.createLine(e,[function(){return JXG.Math.Geometry.perpendicular(r,i,e)[1]?[a,i]:[i,a]}],s),o.perpendicularpoint=a,o},JXG.createMidpoint=function(e,t,n){var i,r,o;if(2==t.length&&JXG.isPoint(t[0])&&JXG.isPoint(t[1]))i=t[0],r=t[1];else{if(1!=t.length||t[0].elementClass!=JXG.OBJECT_CLASS_LINE)throw Error("JSXGraph: Can't create midpoint.\nPossible parent types: [point,point], [line]");i=t[0].point1,r=t[0].point2}return o=e.create("point",[function(){return(i.coords.usrCoords[1]+r.coords.usrCoords[1])/2},function(){return(i.coords.usrCoords[2]+r.coords.usrCoords[2])/2}],n),i.addChild(o),r.addChild(o),o.prepareUpdate().update(),o.generatePolynomial=function(){var e=i.symbolic.x,t=i.symbolic.y,n=r.symbolic.x,a=r.symbolic.y,s=o.symbolic.x,l=o.symbolic.y,c="("+t+")*("+s+")-("+t+")*("+n+")+("+l+")*("+n+")-("+e+")*("+l+")+("+e+")*("+a+")-("+s+")*("+a+")",u="("+e+")^2 - 2*("+e+")*("+s+")+("+t+")^2-2*("+t+")*("+l+")-("+n+")^2+2*("+n+")*("+s+")-("+a+")^2+2*("+a+")*("+l+")";return[c,u]},o},JXG.createParallelPoint=function(e,t,n){var i,r,o,a;if(3==t.length&&t[0].elementClass==JXG.OBJECT_CLASS_POINT&&t[1].elementClass==JXG.OBJECT_CLASS_POINT&&t[2].elementClass==JXG.OBJECT_CLASS_POINT)i=t[0],r=t[1],o=t[2];else if(t[0].elementClass==JXG.OBJECT_CLASS_POINT&&t[1].elementClass==JXG.OBJECT_CLASS_LINE)o=t[0],i=t[1].point1,r=t[1].point2;else{if(t[1].elementClass!=JXG.OBJECT_CLASS_POINT||t[0].elementClass!=JXG.OBJECT_CLASS_LINE)throw Error("JSXGraph: Can't create parallel point with parent types '"+typeof t[0]+"', '"+typeof t[1]+"' and '"+typeof t[2]+"'.\nPossible parent types: [line,point], [point,point,point]");o=t[1],i=t[0].point1,r=t[0].point2}return a=e.create("point",[function(){return o.coords.usrCoords[1]+r.coords.usrCoords[1]-i.coords.usrCoords[1]},function(){return o.coords.usrCoords[2]+r.coords.usrCoords[2]-i.coords.usrCoords[2]}],n),i.addChild(a),r.addChild(a),o.addChild(a),a.prepareUpdate().update(),a.generatePolynomial=function(){var e=i.symbolic.x,t=i.symbolic.y,n=r.symbolic.x,s=r.symbolic.y,l=o.symbolic.x,c=o.symbolic.y,u=a.symbolic.x,d=a.symbolic.y,h="("+s+")*("+u+")-("+s+")*("+l+")-("+t+")*("+u+")+("+t+")*("+l+")-("+d+")*("+n+")+("+d+")*("+e+")+("+c+")*("+n+")-("+c+")*("+e+")",p="("+d+")*("+e+")-("+d+")*("+l+")-("+s+")*("+e+")+("+s+")*("+l+")-("+u+")*("+t+")+("+u+")*("+c+")+("+n+")*("+t+")-("+n+")*("+c+")";return[h,p]},a},JXG.createParallel=function(e,t,n){var i,r,o,a;try{a=JXG.copyAttributes(n,e.options,"parallel","point"),r=JXG.createParallelPoint(e,t,a)}catch(s){throw Error("JSXGraph: Can't create parallel with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'.\nPossible parent types: [line,point], [point,point,point]")}return i=null,3==t.length?i=t[2]:t[0].elementClass==JXG.OBJECT_CLASS_POINT?i=t[0]:t[1].elementClass==JXG.OBJECT_CLASS_POINT&&(i=t[1]),JXG.exists(n.layer)||(n.layer=e.options.layer.line),a=JXG.copyAttributes(n,e.options,"parallel"),o=e.create("line",[i,r],a),o.parallelpoint=r,o},JXG.createArrowParallel=function(e,t,n){try{return JXG.createParallel(e,t,n).setStraight(!1,!1).setArrow(!1,!0)}catch(i){throw Error("JSXGraph: Can't create arrowparallel with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'.\nPossible parent types: [line,point], [point,point,point]")}},JXG.createNormal=function(e,t,n){var i,r;if(1==t.length)i=t[0],r=i.slideObject;else{if(2!=t.length)throw Error("JSXGraph: Can't create normal with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'.\nPossible parent types: [point,line], [point,circle], [glider]");if(JXG.isPoint(t[0]))i=t[0],r=t[1];else{if(!JXG.isPoint(t[1]))throw Error("JSXGraph: Can't create normal with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'.\nPossible parent types: [point,line], [point,circle], [glider]");r=t[0],i=t[1]}}if(r.elementClass==JXG.OBJECT_CLASS_LINE)return e.create("line",[function(){return r.stdform[1]*i.Y()-r.stdform[2]*i.X()},function(){return r.stdform[2]*i.Z()},function(){return-r.stdform[1]*i.Z()}],n);if(r.elementClass==JXG.OBJECT_CLASS_CIRCLE)return e.create("line",[r.midpoint,i],n);if(r.elementClass==JXG.OBJECT_CLASS_CURVE){if("plot"!=r.visProp.curvetype){var o=r.X,a=r.Y;return e.create("line",[function(){return-i.X()*e.D(o)(i.position)-i.Y()*e.D(a)(i.position)},function(){return e.D(o)(i.position)},function(){return e.D(a)(i.position)}],n)}return e.create("line",[function(){var e=Math.floor(i.position),t=i.position-e;return e==r.numberPoints-1&&(e--,t=1),0>e?1:(r.Y(e)+t*(r.Y(e+1)-r.Y(e)))*(r.Y(e)-r.Y(e+1))-(r.X(e)+t*(r.X(e+1)-r.X(e)))*(r.X(e+1)-r.X(e))},function(){var e=Math.floor(i.position);return e==r.numberPoints-1&&e--,0>e?0:r.X(e+1)-r.X(e)},function(){var e=Math.floor(i.position);return e==r.numberPoints-1&&e--,0>e?0:r.Y(e+1)-r.Y(e)}],n)}if(r.type==JXG.OBJECT_TYPE_TURTLE)return e.create("line",[function(){var e,t,n=Math.floor(i.position),o=i.position-n;for(t=0;r.objects.length>t;t++)if(e=r.objects[t],e.type==JXG.OBJECT_TYPE_CURVE){if(e.numberPoints>n)break;n-=e.numberPoints}return n==e.numberPoints-1&&(n--,o=1),0>n?1:(e.Y(n)+o*(e.Y(n+1)-e.Y(n)))*(e.Y(n)-e.Y(n+1))-(e.X(n)+o*(e.X(n+1)-e.X(n)))*(e.X(n+1)-e.X(n))},function(){var e,t,n=Math.floor(i.position);for(t=0;r.objects.length>t;t++)if(e=r.objects[t],e.type==JXG.OBJECT_TYPE_CURVE){if(e.numberPoints>n)break;n-=e.numberPoints}return n==e.numberPoints-1&&n--,0>n?0:e.X(n+1)-e.X(n)},function(){var e,t,n=Math.floor(i.position);for(t=0;r.objects.length>t;t++)if(e=r.objects[t],e.type==JXG.OBJECT_TYPE_CURVE){if(e.numberPoints>n)break;n-=e.numberPoints}return n==e.numberPoints-1&&n--,0>n?0:e.Y(n+1)-e.Y(n)}],n);throw Error("JSXGraph: Can't create normal with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'.\nPossible parent types: [point,line], [point,circle], [glider]")},JXG.createBisector=function(e,t,n){var i,r,o,a;if(t[0].elementClass==JXG.OBJECT_CLASS_POINT&&t[1].elementClass==JXG.OBJECT_CLASS_POINT&&t[2].elementClass==JXG.OBJECT_CLASS_POINT){for(a=JXG.copyAttributes(n,e.options,"bisector","point"),i=e.create("point",[function(){return JXG.Math.Geometry.angleBisector(t[0],t[1],t[2],e)}],a),o=0;3>o;o++)t[o].addChild(i);return JXG.exists(n.layer)||(n.layer=e.options.layer.line),a=JXG.copyAttributes(n,e.options,"bisector"),r=JXG.createLine(e,[t[1],i],a)}throw Error("JSXGraph: Can't create angle bisector with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'.\nPossible parent types: [point,point,point]")},JXG.createAngularBisectorsOfTwoLines=function(e,t,n){var i,r,o,a,s=JXG.getReference(e,t[0]),l=JXG.getReference(e,t[1]);if(s.elementClass!=JXG.OBJECT_CLASS_LINE||l.elementClass!=JXG.OBJECT_CLASS_LINE)throw Error("JSXGraph: Can't create angle bisectors of two lines with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'.\nPossible parent types: [line,line]");return JXG.exists(n.layer)||(n.layer=e.options.layer.line),o=JXG.copyAttributes(n,e.options,"bisectorlines","line1"),i=e.create("line",[function(){var e=Math.sqrt(s.stdform[1]*s.stdform[1]+s.stdform[2]*s.stdform[2]),t=Math.sqrt(l.stdform[1]*l.stdform[1]+l.stdform[2]*l.stdform[2]);return s.stdform[0]/e-l.stdform[0]/t},function(){var e=Math.sqrt(s.stdform[1]*s.stdform[1]+s.stdform[2]*s.stdform[2]),t=Math.sqrt(l.stdform[1]*l.stdform[1]+l.stdform[2]*l.stdform[2]);return s.stdform[1]/e-l.stdform[1]/t},function(){var e=Math.sqrt(s.stdform[1]*s.stdform[1]+s.stdform[2]*s.stdform[2]),t=Math.sqrt(l.stdform[1]*l.stdform[1]+l.stdform[2]*l.stdform[2]);return s.stdform[2]/e-l.stdform[2]/t}],o),JXG.exists(n.layer)||(n.layer=e.options.layer.line),o=JXG.copyAttributes(n,e.options,"bisectorlines","line2"),r=e.create("line",[function(){var e=Math.sqrt(s.stdform[1]*s.stdform[1]+s.stdform[2]*s.stdform[2]),t=Math.sqrt(l.stdform[1]*l.stdform[1]+l.stdform[2]*l.stdform[2]);return s.stdform[0]/e+l.stdform[0]/t},function(){var e=Math.sqrt(s.stdform[1]*s.stdform[1]+s.stdform[2]*s.stdform[2]),t=Math.sqrt(l.stdform[1]*l.stdform[1]+l.stdform[2]*l.stdform[2]);return s.stdform[1]/e+l.stdform[1]/t},function(){var e=Math.sqrt(s.stdform[1]*s.stdform[1]+s.stdform[2]*s.stdform[2]),t=Math.sqrt(l.stdform[1]*l.stdform[1]+l.stdform[2]*l.stdform[2]);return s.stdform[2]/e+l.stdform[2]/t}],o),a=new JXG.Composition({line1:i,line2:r})},JXG.createCircumcircleMidpoint=function(e,t,n){var i,r;if(t[0].elementClass==JXG.OBJECT_CLASS_POINT&&t[1].elementClass==JXG.OBJECT_CLASS_POINT&&t[2].elementClass==JXG.OBJECT_CLASS_POINT){for(i=JXG.createPoint(e,[function(){return JXG.Math.Geometry.circumcenterMidpoint(t[0],t[1],t[2],e)}],n),r=0;3>r;r++)t[r].addChild(i);return i.generatePolynomial=function(){var e=a.symbolic.x,t=a.symbolic.y,n=b.symbolic.x,r=b.symbolic.y,o=c.symbolic.x,s=c.symbolic.y,l=i.symbolic.x,u=i.symbolic.y,d=["((",l,")-(",e,"))^2+((",u,")-(",t,"))^2-((",l,")-(",n,"))^2-((",u,")-(",r,"))^2"].join(""),h=["((",l,")-(",e,"))^2+((",u,")-(",t,"))^2-((",l,")-(",o,"))^2-((",u,")-(",s,"))^2"].join("");return[d,h]},i}throw Error("JSXGraph: Can't create circumcircle midpoint with parent types '"+typeof t[0]+"', '"+typeof t[1]+"' and '"+typeof t[2]+"'.\nPossible parent types: [point,point,point]")},JXG.createIncenter=function(e,t,n){var i,r,o,a;if(!(t.length>=3&&JXG.isPoint(t[0])&&JXG.isPoint(t[1])&&JXG.isPoint(t[2])))throw Error("JSXGraph: Can't create incenter with parent types '"+typeof t[0]+"', '"+typeof t[1]+"' and '"+typeof t[2]+"'.\nPossible parent types: [point,point,point]");return r=t[0],o=t[1],a=t[2],i=e.create("point",[function(){var t,n,i;return t=Math.sqrt((o.X()-a.X())*(o.X()-a.X())+(o.Y()-a.Y())*(o.Y()-a.Y())),n=Math.sqrt((r.X()-a.X())*(r.X()-a.X())+(r.Y()-a.Y())*(r.Y()-a.Y())),i=Math.sqrt((o.X()-r.X())*(o.X()-r.X())+(o.Y()-r.Y())*(o.Y()-r.Y())),new JXG.Coords(JXG.COORDS_BY_USER,[(t*r.X()+n*o.X()+i*a.X())/(t+n+i),(t*r.Y()+n*o.Y()+i*a.Y())/(t+n+i)],e)}],n),i},JXG.createCircumcircle=function(e,t,n){var i,r,o;try{o=JXG.copyAttributes(n,e.options,"circumcircle","point"),i=JXG.createCircumcircleMidpoint(e,t,o),JXG.exists(n.layer)||(n.layer=e.options.layer.circle),o=JXG.copyAttributes(n,e.options,"circumcircle"),r=JXG.createCircle(e,[i,t[0]],o)}catch(a){throw Error("JSXGraph: Can't create circumcircle with parent types '"+typeof t[0]+"', '"+typeof t[1]+"' and '"+typeof t[2]+"'.\nPossible parent types: [point,point,point]")}return r},JXG.createIncircle=function(e,t,n){var i,r,o;try{o=JXG.copyAttributes(n,e.options,"incircle","point"),i=JXG.createIncenter(e,t,o),JXG.exists(n.layer)||(n.layer=e.options.layer.circle),o=JXG.copyAttributes(n,e.options,"incircle"),r=JXG.createCircle(e,[i,function(){var e=Math.sqrt((t[1].X()-t[2].X())*(t[1].X()-t[2].X())+(t[1].Y()-t[2].Y())*(t[1].Y()-t[2].Y())),n=Math.sqrt((t[0].X()-t[2].X())*(t[0].X()-t[2].X())+(t[0].Y()-t[2].Y())*(t[0].Y()-t[2].Y())),i=Math.sqrt((t[1].X()-t[0].X())*(t[1].X()-t[0].X())+(t[1].Y()-t[0].Y())*(t[1].Y()-t[0].Y())),r=(e+n+i)/2;return Math.sqrt((r-e)*(r-n)*(r-i)/r)}],o)}catch(a){throw Error("JSXGraph: Can't create circumcircle with parent types '"+typeof t[0]+"', '"+typeof t[1]+"' and '"+typeof t[2]+"'.\nPossible parent types: [point,point,point]")}return r},JXG.createReflection=function(e,t,n){var i,r,o;if(t[0].elementClass==JXG.OBJECT_CLASS_POINT&&t[1].elementClass==JXG.OBJECT_CLASS_LINE)r=t[0],i=t[1];else{if(t[1].elementClass!=JXG.OBJECT_CLASS_POINT||t[0].elementClass!=JXG.OBJECT_CLASS_LINE)throw Error("JSXGraph: Can't create reflection point with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'.\nPossible parent types: [line,point]");r=t[1],i=t[0]}return o=JXG.createPoint(e,[function(){return JXG.Math.Geometry.reflection(i,r,e)}],n),r.addChild(o),i.addChild(o),o.prepareUpdate().update(),o.generatePolynomial=function(){var e=i.point1.symbolic.x,t=i.point1.symbolic.y,n=i.point2.symbolic.x,a=i.point2.symbolic.y,s=r.symbolic.x,l=r.symbolic.y,c=o.symbolic.x,u=o.symbolic.y,d=["((",u,")-(",l,"))*((",t,")-(",a,"))+((",e,")-(",n,"))*((",c,")-(",s,"))"].join(""),h=["((",c,")-(",e,"))^2+((",u,")-(",t,"))^2-((",s,")-(",e,"))^2-((",l,")-(",t,"))^2"].join("");return[d,h]},o},JXG.createMirrorPoint=function(e,t,n){var i,r;if(!JXG.isPoint(t[0])||!JXG.isPoint(t[1]))throw Error("JSXGraph: Can't create mirror point with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'.\nPossible parent types: [point,point]");for(i=JXG.createPoint(e,[function(){return JXG.Math.Geometry.rotation(t[0],t[1],Math.PI,e)}],n),r=0;2>r;r++)t[r].addChild(i);return i.prepareUpdate().update(),i},JXG.createIntegral=function(e,t,n){var i,r,o,a,s,l,c,u,d,h,p,f,g,m,v=0,b=0,y=1;if(JXG.isArray(t[0])&&t[1].elementClass==JXG.OBJECT_CLASS_CURVE)i=t[0],r=t[1];else{if(!JXG.isArray(t[1])||t[0].elementClass!=JXG.OBJECT_CLASS_CURVE)throw Error("JSXGraph: Can't create integral with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'.\nPossible parent types: [[number|function,number|function],curve]");i=t[1],r=t[0]}return v=i[0],b=i[1],JXG.isFunction(v)?(a=v,s=function(){return r.yterm(a())},v=a()):(a=v,s=r.yterm(v)),JXG.isFunction(v)?(l=b,c=function(){return r.yterm(l())},b=l()):(l=b,c=r.yterm(b)),v>b&&(y=-1),o=JXG.copyAttributes(n,e.options,"integral","start"),u=e.create("glider",[a,s,r],o),JXG.isFunction(a)&&u.hideElement(),o=JXG.copyAttributes(n,e.options,"integral","startproject"),d=e.create("point",[function(){return u.X()},0],o),o=JXG.copyAttributes(n,e.options,"integral","end"),h=e.create("glider",[l,c,r],o),JXG.isFunction(l)&&h.hideElement(),o=JXG.copyAttributes(n,e.options,"integral","endproject"),p=e.create("point",[function(){return h.X()},0],o),o=JXG.copyAttributes(n,e.options,"integral"),o.withLabel!==!1&&(o=JXG.copyAttributes(n,e.options,"integral","text"),f=JXG.Math.Numerics.I([v,b],r.yterm),g=e.create("text",[function(){return h.X()+.2},function(){return h.Y()-.8},function(){var e=JXG.Math.Numerics.I([d.X(),p.X()],r.yterm);return"&int; = "+e.toFixed(4)}],o),u.addChild(g),h.addChild(g)),o=JXG.copyAttributes(n,e.options,"integral"),m=e.create("curve",[[0],[0]],o),m.updateDataArray=function(){var e,t,n,i,o;for(d.X()<p.X()?(i=d.X(),o=p.X()):(i=p.X(),o=d.X()),e=[i,i],t=[0,r.yterm(i)],n=0;r.numberPoints>n;n++)r.points[n].usrCoords[1]>=i&&o>=r.points[n].usrCoords[1]&&(e.push(r.points[n].usrCoords[1]),t.push(r.points[n].usrCoords[2]));e.push(o),t.push(r.yterm(o)),e.push(o),t.push(0),e.push(i),t.push(0),this.dataX=e,this.dataY=t},u.addChild(m),h.addChild(m),m.baseLeft=d,m.baseRight=p,m.curveLeft=u,m.curveRight=h,m.label={content:g},m},JXG.createLocus=function(e,t,n){var i,r;if(!JXG.isArray(t)||1!=t.length||t[0].elementClass!=JXG.OBJECT_CLASS_POINT)throw Error("JSXGraph: Can't create locus with parent of type other than point.\nPossible parent types: [point]");return r=t[0],i=e.create("curve",[[null],[null]],n),i.dontCallServer=!1,i.updateDataArray=function(){if(!(i.board.mode>0)){var t=JXG.Math.Symbolic.generatePolynomials(e,r,!0).join("|");if(t!==i.spe){i.spe=t;var n=function(e,t,n,r){i.dataX=e,i.dataY=t,i.eq=n,i.ctime=r,i.generatePolynomial=function(e){return function(t){var n,i="("+t.symbolic.x+")",r="("+t.symbolic.y+")",o=[];for(n=0;e.length>n;n++)o[n]=e[n].replace(/\*\*/g,"^").replace(/x/g,i).replace(/y/g,r);return o}}(n)},o=JXG.Math.Symbolic.geometricLocusByGroebnerBase(e,r,n);n(o.datax,o.datay,o.polynomial,o.exectime)}}},i},JXG.createGrid=function(e,t,n){var i,r;return r=JXG.copyAttributes(n,e.options,"grid"),i=e.create("curve",[[null],[null]],r),e.options.grid.dash&&i.setProperty({dash:2}),i.updateDataArray=function(){var t,n=e.options.grid.gridX,r=e.options.grid.gridY,o=new JXG.Coords(JXG.COORDS_BY_SCREEN,[0,0],e),a=new JXG.Coords(JXG.COORDS_BY_SCREEN,[e.canvasWidth,e.canvasHeight],e);for(e.options.grid.hasGrid=!0,o.setCoordinates(JXG.COORDS_BY_USER,[Math.floor(o.usrCoords[1]/n)*n,Math.ceil(o.usrCoords[2]/r)*r]),a.setCoordinates(JXG.COORDS_BY_USER,[Math.ceil(a.usrCoords[1]/n)*n,Math.floor(a.usrCoords[2]/r)*r]),i.dataX=[],i.dataY=[],t=o.usrCoords[2];t>a.usrCoords[2]-r;t-=r)i.dataX.push(o.usrCoords[1],a.usrCoords[1],0/0),i.dataY.push(t,t,0/0);for(t=o.usrCoords[1];a.usrCoords[1]+n>t;t+=n)i.dataX.push(t,t,0/0),i.dataY.push(o.usrCoords[2],a.usrCoords[2],0/0)},i.hasPoint=function(){return!1},e.grids.push(i),i},JXG.JSXGraph.registerElement("arrowparallel",JXG.createArrowParallel),JXG.JSXGraph.registerElement("bisector",JXG.createBisector),JXG.JSXGraph.registerElement("bisectorlines",JXG.createAngularBisectorsOfTwoLines),JXG.JSXGraph.registerElement("circumcircle",JXG.createCircumcircle),JXG.JSXGraph.registerElement("circumcirclemidpoint",JXG.createCircumcircleMidpoint),JXG.JSXGraph.registerElement("circumcenter",JXG.createCircumcircleMidpoint),JXG.JSXGraph.registerElement("incenter",JXG.createIncenter),JXG.JSXGraph.registerElement("incircle",JXG.createIncircle),JXG.JSXGraph.registerElement("integral",JXG.createIntegral),JXG.JSXGraph.registerElement("midpoint",JXG.createMidpoint),JXG.JSXGraph.registerElement("mirrorpoint",JXG.createMirrorPoint),JXG.JSXGraph.registerElement("normal",JXG.createNormal),JXG.JSXGraph.registerElement("parallel",JXG.createParallel),JXG.JSXGraph.registerElement("parallelpoint",JXG.createParallelPoint),JXG.JSXGraph.registerElement("perpendicular",JXG.createPerpendicular),JXG.JSXGraph.registerElement("perpendicularpoint",JXG.createPerpendicularPoint),JXG.JSXGraph.registerElement("reflection",JXG.createReflection),JXG.JSXGraph.registerElement("locus",JXG.createLocus),JXG.JSXGraph.registerElement("grid",JXG.createGrid),JXG.Text=function(e,t,n,i){if(this.constructor(e,i,JXG.OBJECT_TYPE_TEXT,JXG.OBJECT_CLASS_OTHER),this.content=t,this.plaintext="",this.element=JXG.getRef(this.board,i.anchor)){var r;this.visProp.islabel?(r=this.element.getLabelAnchor(),this.relativeCoords=new JXG.Coords(JXG.COORDS_BY_SCREEN,[parseFloat(n[0]),parseFloat(n[1])],this.board)):(r=this.element.getTextAnchor(),this.relativeCoords=new JXG.Coords(JXG.COORDS_BY_USER,[parseFloat(n[0]),parseFloat(n[1])],this.board)),this.element.addChild(this),this.coords=new JXG.Coords(JXG.COORDS_BY_SCREEN,[this.relativeCoords.scrCoords[1]+r.scrCoords[1],this.relativeCoords.scrCoords[2]+r.scrCoords[2]],this.board),this.isDraggable=!0}else{JXG.isFunction(n[0])||JXG.isFunction(n[1])||(this.isDraggable=!0),this.X=JXG.createFunction(n[0],this.board,""),this.Y=JXG.createFunction(n[1],this.board,""),this.coords=new JXG.Coords(JXG.COORDS_BY_USER,[this.X(),this.Y()],this.board);var o="this.coords.setCoordinates(JXG.COORDS_BY_USER,[this.X(),this.Y()]);";this.updateCoords=Function("",o)}return"function"==typeof this.content?this.updateText=function(){this.plaintext=this.content()}:(this.content=JXG.isNumber(this.content)?this.content.toFixed(this.visProp.digits):this.visProp.useasciimathml?"'`"+this.content+"`'":this.generateTerm(this.content),this.updateText=Function("this.plaintext = "+this.content+";")),this.updateText(),this.id=this.board.setId(this,"T"),this.board.renderer.drawText(this),this.visProp.visible||this.board.renderer.hide(this),"string"==typeof this.content&&this.notifyParents(this.content),this.size=[1,1],this},JXG.Text.prototype=new JXG.GeometryElement,JXG.extend(JXG.Text.prototype,{hasPoint:function(e,t){var n=e-this.coords.scrCoords[1],i=this.coords.scrCoords[2]-t,r=this.board.options.precision.hasPoint;return n>=-r&&2*r>=n&&i>=-r&&2*r>=i?!0:!1},setText:function(e){return"function"==typeof e?this.updateText=function(){this.plaintext=e()}:(this.content=JXG.isNumber(e)?e.toFixed(this.visProp.digits):this.visProp.useasciimathml?"'`"+e+"`'":this.generateTerm(e),this.updateText=Function("this.plaintext = "+this.content+";")),this.updateText(),this.updateSize(),this},updateSize:function(){"html"==this.display&&"vml"!=this.board.renderer.type?this.size=[this.rendNode.offsetWidth,this.rendNode.offsetHeight]:"internal"==this.display&&"svg"==this.board.renderer.type?this.size=[this.rendNode.getBBox().width,this.rendNode.getBBox().height]:("vml"==this.board.renderer.type||"internal"==this.display&&"canvas"==this.board.renderer.type)&&(this.size=[.45*parseFloat(this.visProp.fontsize)*this.plaintext.length,.9*parseFloat(this.visProp.fontsize)])},getSize:function(){return this.size},setCoords:function(e,t){return this.X=function(){return e},this.Y=function(){return t},this.coords=new JXG.Coords(JXG.COORDS_BY_USER,[e,t],this.board),this},update:function(){var e;return this.needsUpdate&&(this.relativeCoords?this.visProp.islabel?(e=this.element.getLabelAnchor(),this.coords.setCoordinates(JXG.COORDS_BY_SCREEN,[this.relativeCoords.scrCoords[1]+e.scrCoords[1],this.relativeCoords.scrCoords[2]+e.scrCoords[2]])):(e=this.element.getTextAnchor(),this.coords.setCoordinates(JXG.COORDS_BY_USER,[this.relativeCoords.usrCoords[1]+e.usrCoords[1],this.relativeCoords.usrCoords[2]+e.usrCoords[2]])):this.updateCoords(),this.updateText(),this.updateSize(),this.updateTransform()),this},updateRenderer:function(){return this.needsUpdate&&(this.board.renderer.updateText(this),this.needsUpdate=!1),this},updateTransform:function(){if(0!=this.transformations.length)for(var e=0;this.transformations.length>e;e++)this.transformations[e].update()},generateTerm:function(e){var t,n,i='""';e=e||"",e=e.replace(/\r/g,""),e=e.replace(/\n/g,""),e=e.replace(/\"/g,'\\"'),e=e.replace(/\'/g,"\\'"),e=e.replace(/&amp;arc;/g,"&ang;"),e=e.replace(/<arc\s*\/>/g,"&ang;"),e=e.replace(/<sqrt\s*\/>/g,"&radic;");var r;r=e.indexOf("<value>");var o=e.indexOf("</value>");if(r>=0)for(;r>=0;)i+=' + "'+JXG.GeonextParser.replaceSub(JXG.GeonextParser.replaceSup(e.slice(0,r)))+'"',n=e.slice(r+7,o),t=JXG.GeonextParser.geonext2JS(n,this.board),t=t.replace(/\\"/g,'"'),t=t.replace(/\\'/g,"'"),i+=0>t.indexOf("toFixed")?JXG.isNumber(JXG.bind(Function("return "+t+";"),this)())?"+("+t+").toFixed("+this.visProp.digits+")":"+("+t+")":"+("+t+")",e=e.slice(o+8),r=e.indexOf("<value>"),o=e.indexOf("</value>");return i+=' + "'+JXG.GeonextParser.replaceSub(JXG.GeonextParser.replaceSup(e))+'"',i=i.replace(/<overline>/g,"<span style=text-decoration:overline>"),i=i.replace(/<\/overline>/g,"</span>"),i=i.replace(/<arrow>/g,"<span style=text-decoration:overline>"),i=i.replace(/<\/arrow>/g,"</span>"),i=i.replace(/&amp;/g,"&")},notifyParents:function(e){var t=null;do{var n=/<value>([\w\s\*\/\^\-\+\(\)\[\],<>=!]+)<\/value>/;t=n.exec(e),null!=t&&(JXG.GeonextParser.findDependencies(this,t[1],this.board),e=e.substr(t.index),e=e.replace(n,""))}while(null!=t);return this},bounds:function(){var e=this.coords.usrCoords;return this.visProp.islabel?[0,0,0,0]:[e[1],e[2]+this.size[1],e[1]+this.size[0],e[2]]},setPositionDirectly:function(e,t,n,i,r){var o,a,s,l;return this.relativeCoords?this.visProp.islabel?(e==JXG.COORDS_BY_USER?(l=new JXG.Coords(JXG.COORDS_BY_USER,[i,r],this.board),s=new JXG.Coords(JXG.COORDS_BY_USER,[t,n],this.board),o=s.scrCoords[1]-l.scrCoords[1],a=s.scrCoords[2]-l.scrCoords[2]):(o=t-i,a=n-r),this.relativeCoords.scrCoords[1]+=o,this.relativeCoords.scrCoords[2]+=a):(e==JXG.COORDS_BY_SCREEN?(l=new JXG.Coords(JXG.COORDS_BY_SCREEN,[i,r],this.board),s=new JXG.Coords(JXG.COORDS_BY_SCREEN,[t,n],this.board),o=s.usrCoords[1]-l.usrCoords[1],a=s.usrCoords[2]-l.usrCoords[2]):(o=t-i,a=n-r),this.relativeCoords.usrCoords[1]+=o,this.relativeCoords.usrCoords[2]+=a):(e==JXG.COORDS_BY_SCREEN&&(s=new JXG.Coords(JXG.COORDS_BY_SCREEN,[t,n],this.board),t=s.usrCoords[1],n=s.usrCoords[2]),this.X=JXG.createFunction(t,this.board,""),this.Y=JXG.createFunction(n,this.board,"")),this}}),JXG.createText=function(e,t,n){var i;return i=JXG.copyAttributes(n,e.options,"text"),i.anchor=i.parent||i.anchor,new JXG.Text(e,t[t.length-1],t,i)},JXG.JSXGraph.registerElement("text",JXG.createText),JXG.Image=function(e,t,n,i,r){this.constructor(e,r,JXG.OBJECT_TYPE_IMAGE,JXG.OBJECT_CLASS_OTHER),this.initialCoords=new JXG.Coords(JXG.COORDS_BY_USER,n,this.board),JXG.isFunction(n[0])||JXG.isFunction(n[1])||(this.isDraggable=!0),this.X=JXG.createFunction(n[0],this.board,""),this.Y=JXG.createFunction(n[1],this.board,""),this.W=JXG.createFunction(i[0],this.board,""),this.H=JXG.createFunction(i[1],this.board,""),this.coords=new JXG.Coords(JXG.COORDS_BY_USER,[this.X(),this.Y()],this.board),this.updateCoords=Function("","this.coords.setCoordinates(JXG.COORDS_BY_USER,[this.X(),this.Y()]);"),this.updateSize=Function("","this.coords.setCoordinates(JXG.COORDS_BY_USER,[this.W(),this.H()]);"),this.usrSize=[this.W(),this.H()],this.size=[this.usrSize[0]*e.unitX,this.usrSize[1]*e.unitY],this.url=t,this.parent=JXG.getRef(r.anchor),this.id=this.board.setId(this,"Im"),this.board.renderer.drawImage(this),this.visProp.visible||this.board.renderer.hide(this)},JXG.Image.prototype=new JXG.GeometryElement,JXG.extend(JXG.Image.prototype,{hasPoint:function(e,t){var n=e-this.coords.scrCoords[1],i=this.coords.scrCoords[2]-t,r=this.board.options.precision.hasPoint;return n>=-r&&2*r>=n&&i>=-r&&r>=i?!0:!1},update:function(){return this.needsUpdate&&(this.updateCoords(),this.usrSize=[this.W(),this.H()],this.size=[this.usrSize[0]*this.board.unitX,this.usrSize[1]*this.board.unitY],this.updateTransform()),this},updateRenderer:function(){return this.needsUpdate&&(this.board.renderer.updateImage(this),this.needsUpdate=!1),this},updateTransform:function(){if(0!=this.transformations.length)for(var e=0;this.transformations.length>e;e++)this.transformations[e].update()},addTransform:function(e){if(JXG.isArray(e))for(var t=0;e.length>t;t++)this.transformations.push(e[t]);else this.transformations.push(e)},setPositionDirectly:function(e,t,n){var i;return e==JXG.COORDS_BY_SCREEN&&(i=new JXG.Coords(JXG.COORDS_BY_SCREEN,[t,n],this.board),t=i.usrCoords[1],n=i.usrCoords[2]),this.X=JXG.createFunction(t,this.board,""),this.Y=JXG.createFunction(n,this.board,""),this}}),JXG.createImage=function(e,t,n){var i;return i=JXG.copyAttributes(n,e.options,"image"),new JXG.Image(e,t[0],t[1],t[2],i)},JXG.JSXGraph.registerElement("image",JXG.createImage),JXG.createSlider=function(e,t,n){var i,r,o,a,s,l,c,u,d,h,p,f,g,m,v,b,y,x,w,k,C;return i=t[0],r=t[1],o=t[2][0],a=t[2][1],s=t[2][2],l=s-o,C=JXG.copyAttributes(n,e.options,"slider"),w=C.withticks,x=C.withlabel,k=C.snapwidth,precision=C.precision,C=JXG.copyAttributes(n,e.options,"slider","point1"),c=e.create("point",i,C),C=JXG.copyAttributes(n,e.options,"slider","point2"),u=e.create("point",r,C),e.create("group",[c,u]),C=JXG.copyAttributes(n,e.options,"slider","segment1"),d=e.create("segment",[c,u],C),d.updateStdform(),w&&(C=JXG.copyAttributes(n,e.options,"slider","ticks"),h=2,p=e.create("ticks",[d,u.Dist(c)/h],C)),f=i[0]+(r[0]-i[0])*(a-o)/(s-o),g=i[1]+(r[1]-i[1])*(a-o)/(s-o),C=JXG.copyAttributes(n,e.options,"slider","glider"),n.name&&""!=n.name&&(C.name=n.name),m=e.create("glider",[f,g,d],C),m.setProperty({snapwidth:k}),C=JXG.copyAttributes(n,e.options,"slider","segment2"),v=e.create("segment",[c,m],C),m.Value=function(){return this.position*l+o},m._smax=s,m._smin=o,x&&(b=n.name&&""!=n.name?n.name+" = ":"",C=JXG.copyAttributes(n,e.options,"slider","text"),y=e.create("text",[function(){return.05*(u.X()-c.X())+u.X()},function(){return.05*(u.Y()-c.Y())+u.Y()},function(){return b+m.Value().toFixed(precision)}],C),m.text=y),m.point1=c,m.point2=u,m.baseline=d,m.highline=v,w&&(m.ticks=p),m.remove=function(){x&&e.removeObject(y),e.removeObject(v),w&&d.removeTicks(p),e.removeObject(d),e.removeObject(u),e.removeObject(c),JXG.Point.prototype.remove.call(m)},m},JXG.JSXGraph.registerElement("slider",JXG.createSlider),JXG.Chart=function(e,t,n){this.constructor(e,n);var i,r,o,a,s,l;if(!JXG.isArray(t)||0===t.length)throw Error("JSXGraph: Can't create a chart without data");if(this.elements=[],JXG.isNumber(t[0]))for(r=t,i=[],o=0;r.length>o;o++)i[o]=o+1;else if(1===t.length&&JXG.isArray(t[0]))for(r=t[0],i=[],l=JXG.evaluate(r).length,o=0;l>o;o++)i[o]=o+1;else 2===t.length&&(l=Math.min(t[0].length,t[1].length),i=t[0].slice(0,l),r=t[1].slice(0,l));if(JXG.isArray(r)&&0===r.length)throw Error("JSXGraph: Can't create charts without data.");for(s=n.chartstyle.replace(/ /g,"").split(","),o=0;s.length>o;o++){switch(s[o]){case"bar":a=this.drawBar(e,i,r,n);break;case"line":a=this.drawLine(e,i,r,n);break;case"fit":a=this.drawFit(e,i,r,n);break;case"spline":a=this.drawSpline(e,i,r,n);break;case"pie":a=this.drawPie(e,r,n);break;case"point":a=this.drawPoints(e,i,r,n);break;case"radar":a=this.drawRadar(e,t,n)}this.elements.push(a)}return this.id=this.board.setId(this,"Chart"),this.elements},JXG.Chart.prototype=new JXG.GeometryElement,JXG.extend(JXG.Chart.prototype,{drawLine:function(e,t,n,i){return i.fillcolor="none",i.highlightfillcolor="none",e.create("curve",[t,n],i)},drawSpline:function(e,t,n,i){return i.fillColor="none",i.highlightfillcolor="none",e.create("spline",[t,n],i)},drawFit:function(e,t,n,i){var r=i.degree;return r=!JXG.exists(r)||0/0==parseInt(r)||1>parseInt(r)?1:parseInt(r),i.fillcolor="none",i.highlightfillcolor="none",e.create("functiongraph",[JXG.Math.Numerics.regressionPolynomial(r,t,n)],i)},drawBar:function(e,t,n,i){var r,o,a,s,l,c,u,d,h,p,f,g=[],m=[],v={fixed:!0,withLabel:!1,visible:!1,name:""};if(JXG.exists(i.fillopacity)||(i.fillopacity=.6),i&&i.width)c=i.width;else{if(1>=t.length)c=1;else for(c=t[1]-t[0],r=1;t.length-1>r;r++)c=c>t[r+1]-t[r]?t[r+1]-t[r]:c;c*=.8}for(a=i.fillcolor,s=parseFloat(e.options.text.fontSize),r=0;t.length>r;r++)isNaN(JXG.evaluate(t[r]))||isNaN(n[r]),JXG.isFunction(t[r])?(u=function(){return t[r]()-.5*c},d=function(){return t[r]()},h=function(){return t[r]()+.5*c}):(u=t[r]-.5*c,d=t[r],h=t[r]+.5*c),p=n[r],"horizontal"==i.dir?(m[0]=e.create("point",[0,u],v),m[1]=e.create("point",[p,u],v),m[2]=e.create("point",[p,h],v),m[3]=e.create("point",[0,h],v),JXG.exists(i.labels)&&JXG.exists(i.labels[r])&&(o=(""+i.labels[r]).length,o=2*o*s/e.unitX,p>=0?p+=.5*s/e.unitX:p-=s*o/e.unitX,d-=.2*s/e.unitY,l=e.create("text",[p,d,i.labels[r]],i))):(m[0]=e.create("point",[u,0],v),m[1]=e.create("point",[u,p],v),m[2]=e.create("point",[h,p],v),m[3]=e.create("point",[h,0],v),JXG.exists(i.labels)&&JXG.exists(i.labels[r])&&(o=(""+i.labels[r]).length,o=.6*o*s/e.unitX,p>=0?p+=.5*s/e.unitY:p-=1*s/e.unitY,l=e.create("text",[d-.5*o,p,i.labels[r]],i))),i.withlines=!1,JXG.exists(i.colors)&&JXG.isArray(i.colors)&&(f=i.colors,i.fillcolor=f[r%f.length]),g[r]=e.create("polygon",m,i),JXG.exists(i.labels)&&JXG.exists(i.labels[r])&&(g[r].text=l);return g},drawPoints:function(e,t,n,i){var r,o=[],a=i.infoboxarray;for(i.fixed=!0,i.name="",r=0;t.length>r;r++)i.infoboxtext=a?a[r%a.length]:!1,o[r]=e.create("point",[t[r],n[r]],i);return o},drawPie:function(e,t,n){var i,r,o=[],a=[],s=(JXG.Math.Statistics.sum(t),n.colors),l=n.highlightcolors,c=n.labels,u=n.radius||4,d=u,h=n.center||[0,0],p=h[0],f=h[1],g={fixed:!0,withLabel:!1,visible:!1,name:""};if(!JXG.isArray(c))for(c=[],i=0;t.length>i;i++)c[i]="";for(JXG.isFunction(u)||(d=function(){return u}),n.highlightonsector=n.highlightonsector||!1,n.straightfirst=!1,n.straightlast=!1,r=e.create("point",[p,f],g),o[0]=e.create("point",[function(){return d()+p},function(){return f}],g),i=0;t.length>i;i++)o[i+1]=e.create("point",[function(e){return function(){var n,i,r,o=0;for(i=0;e>=i;i++)o+=parseFloat(JXG.evaluate(t[i])); for(n=o,i=e+1;t.length>i;i++)n+=parseFloat(JXG.evaluate(t[i]));return r=0!=n?2*Math.PI*o/n:0,d()*Math.cos(r)+p}}(i),function(e){return function(){var n,i,r,o=0;for(i=0;e>=i;i++)o+=parseFloat(JXG.evaluate(t[i]));for(n=o,i=e+1;t.length>i;i++)n+=parseFloat(JXG.evaluate(t[i]));return r=0!=n?2*Math.PI*o/n:0,d()*Math.sin(r)+f}}(i)],g),n.name=c[i],n.withlabel=""!=n.name,n.fillcolor=s&&s[i%s.length],n.labelcolor=s&&s[i%s.length],n.highlightfillcolor=l&&l[i%l.length],a[i]=e.create("sector",[r,o[i],o[i+1]],n),n.highlightonsector&&(a[i].hasPoint=a[i].hasPointSector),n.highlightbysize&&(a[i].highlight=function(){this.board.renderer.highlight(this);var e=-this.point1.coords.usrCoords[1]+this.point2.coords.usrCoords[1],t=-this.point1.coords.usrCoords[2]+this.point2.coords.usrCoords[2];null!=this.label.content&&(this.label.content.rendNode.style.fontSize=2*this.board.options.text.fontSize+"px"),this.point2.coords=new JXG.Coords(JXG.COORDS_BY_USER,[this.point1.coords.usrCoords[1]+1.1*e,this.point1.coords.usrCoords[2]+1.1*t],this.board),this.prepareUpdate().update().updateRenderer()},a[i].noHighlight=function(){this.board.renderer.noHighlight(this);var e=-this.point1.coords.usrCoords[1]+this.point2.coords.usrCoords[1],t=-this.point1.coords.usrCoords[2]+this.point2.coords.usrCoords[2];null!=this.label.content&&(this.label.content.rendNode.style.fontSize=this.board.options.text.fontSize+"px"),this.point2.coords=new JXG.Coords(JXG.COORDS_BY_USER,[this.point1.coords.usrCoords[1]+e/1.1,this.point1.coords.usrCoords[2]+t/1.1],this.board),this.prepareUpdate().update().updateRenderer()});return{sectors:a,points:o,midpoint:r}},drawRadar:function(e,t,n){var i,r,o,a,s,l,c,u,d,h,p,f,g,m,v,b,y,x,w,k,C,_,T,E,S,A,I,O,L,D,R,P,M,N,B,F,j,z,G,H,X,$=t.length;if(0>=$)return JXG.debug("No data"),void 0;if(o=n.paramarray,!JXG.exists(o))return JXG.debug("Need paramArray attribute"),void 0;if(a=o.length,1>=a)return JXG.debug("Need more than 1 param"),void 0;for(i=0;$>i;i++)if(a!=t[i].length)return JXG.debug("Use data length equal to number of params ("+t[i].length+" != "+a+")"),void 0;for(s=Array(a),l=Array(a),r=0;a>r;r++)s[r]=t[0][r],l[r]=s[r];for(i=1;$>i;i++)for(r=0;a>r;r++)t[i][r]>s[r]&&(s[r]=t[i][r]),t[i][r]<l[r]&&(l[r]=t[i][r]);for(c=Array($),u=Array($),i=0;$>i;i++)c[i]="",u[i]=[];for(d=Array(a),h=Array(a),p=n.startshiftratio||0,f=n.endshiftratio||0,i=0;a>i;i++)d[i]=(s[i]-l[i])*p,h[i]=(s[i]-l[i])*f;if(g=n.startshiftarray||d,m=n.endshiftarray||h,v=n.startarray||l,JXG.exists(n.start))for(i=0;a>i;i++)v[i]=n.start;if(b=n.endarray||s,JXG.exists(n.end))for(i=0;a>i;i++)b[i]=n.end;if(g.length!=a)return JXG.debug("Start shifts length is not equal to number of parameters"),void 0;if(m.length!=a)return JXG.debug("End shifts length is not equal to number of parameters"),void 0;if(v.length!=a)return JXG.debug("Starts length is not equal to number of parameters"),void 0;if(b.length!=a)return JXG.debug("Ends length is not equal to number of parameters"),void 0;y=n.labelarray||c,x=n.colors,w=n.highlightcolors,k=n.radius||10,C={},JXG.exists(n.highlightonsector)||(n.highlightonsector=!1),C.name=n.name,C.id=n.id,C.strokewidth=n.strokewidth||1,C.polystrokewidth=n.polystrokewidth||2*C.strokewidth,C.strokecolor=n.strokecolor||"black",C.straightfirst=!1,C.straightlast=!1,C.fillcolor=n.fillcolor||"#FFFF88",C.fillopacity=n.fillopacity||.4,C.highlightfillcolor=n.highlightfillcolor||"#FF7400",C.highlightstrokecolor=n.highlightstrokecolor||"black",C.gradient=n.gradient||"none",_=n.center||[0,0],T=_[0],E=_[1],S=e.create("point",[T,E],{name:"",fixed:!0,withlabel:!1,visible:!1}),A=Math.PI/2-Math.PI/a,(n.startangle||0===n.startangle)&&(A=n.startangle),I=A,O=[],L=[];var J=function(){var e,t,n,i,r=[].concat(this.labelOffsets);return e=this.point1.X(),t=this.point2.X(),n=this.point1.Y(),i=this.point2.Y(),e>t&&(r[0]=-r[0]),n>i&&(r[1]=-r[1]),this.setLabelRelativeCoords(r),new JXG.Coords(JXG.COORDS_BY_USER,[this.point2.X(),this.point2.Y()],this.board)},W=function(t,n){var i,r,o;return i=e.create("transform",[-(v[n]-g[n]),0],{type:"translate"}),r=e.create("transform",[k/(b[n]+m[n]-(v[n]-g[n])),1],{type:"scale"}),i.melt(r),o=e.create("transform",[t],{type:"rotate"}),i.melt(o),i};for(i=0;a>i;i++)for(I+=2*Math.PI/a,R=k*Math.cos(I)+T,P=k*Math.sin(I)+E,O[i]=e.create("point",[R,P],{name:"",fixed:!0,withlabel:!1,visible:!1}),L[i]=e.create("line",[S,O[i]],{name:o[i],strokeColor:C.strokecolor,strokeWidth:C.strokewidth,strokeOpacity:1,straightFirst:!1,straightLast:!1,withLabel:!0,highlightStrokeColor:C.highlightstrokecolor}),L[i].getLabelAnchor=J,D=W(I,i),r=0;t.length>r;r++){var K=t[r][i];u[r][i]=e.create("point",[K,0],{name:"",fixed:!0,withlabel:!1,visible:!1}),u[r][i].addTransform(u[r][i],D)}for(M=Array($),i=0;$>i;i++)for(C.labelcolor=x&&x[i%x.length],C.strokecolor=x&&x[i%x.length],C.fillcolor=x&&x[i%x.length],M[i]=e.create("polygon",u[i],{withLines:!0,withLabel:!1,fillColor:C.fillcolor,fillOpacity:C.fillopacity}),r=0;a>r;r++)M[i].borders[r].setProperty("strokecolor:"+x[i%x.length]),M[i].borders[r].setProperty("strokewidth:"+C.polystrokewidth);switch(N=n.legendposition||"none"){case"right":var U=n.legendleftoffset||2,V=n.legendtopoffset||1;this.legend=e.create("legend",[T+k+U,E+k-V],{labelArray:y,colorArray:x});break;case"none":break;default:JXG.debug("Unknown legend position")}if(B=[],0!=n.showcircles){for(F=[],i=0;6>i;i++)F[i]=20*i;if(F[0]="0",j=n.circlelabelarray||F,z=j.length,2>z)return alert("Too less circles"),void 0;for(G=[],H=A+Math.PI/a,D=W(H,0),C.fillcolor="none",C.highlightfillcolor="none",C.strokecolor=n.strokecolor||"black",C.strokewidth=n.circlestrokewidth||.5,X=(b[0]-v[0])/(z-1),i=0;z>i;i++)G[i]=e.create("point",[v[0]+i*X,0],{name:j[i],size:0,withLabel:!0,visible:!0}),G[i].addTransform(G[i],D),B[i]=e.create("circle",[S,G[i]],C)}return this.rendNode=M[0].rendNode,{circles:B,lines:L,points:u,midpoint:S,polygons:M}},updateRenderer:function(){return this},update:function(){return this.needsUpdate&&this.updateDataArray(),this},updateDataArray:function(){}}),JXG.createChart=function(e,t,n){if(1==t.length&&"string"==typeof t[0]){var i,r,o,a,s,l,c,u,d,h,p,f,g,m,v,b,y=document.getElementById(t[0]),x=[];if(JXG.exists(y)){if(b=JXG.copyAttributes(n,e.options,"chart"),y=(new JXG.DataSource).loadFromTable(t[0],b.withheaders,b.withheaders),i=y.data,s=y.columnHeaders,r=y.rowHeaders,d=b.width,h=b.name,p=b.strokecolor,f=b.fillcolor,g=b.highlightstrokecolor,m=b.highlightfillcolor,e.suspendUpdate(),v=i.length,u=[],b.rows&&JXG.isArray(b.rows)){for(o=0;v>o;o++)for(a=0;b.rows.length>a;a++)if(b.rows[a]==o||b.withheaders&&b.rows[a]==r[o]){u.push(i[o]);break}}else u=i;for(v=u.length,o=0;v>o;o++){if(c=[],b.chartstyle&&-1!=b.chartstyle.indexOf("bar")){for(l=d?d:.8,c.push(1-l/2+(o+.5)*l/(1*v)),a=1;u[o].length>a;a++)c.push(c[a-1]+1);b.width=l/(1*v)}h&&h.length==v?b.name=h[o]:b.withheaders&&(b.name=s[o]),b.strokecolor=p&&p.length==v?p[o]:JXG.hsv2rgb(360*((o+1)/(1*v)),.9,.6),b.fillcolor=f&&f.length==v?f[o]:JXG.hsv2rgb(360*((o+1)/(1*v)),.9,1),b.highlightstrokecolor=g&&g.length==v?g[o]:JXG.hsv2rgb(360*((o+1)/(1*v)),.9,1),b.highlightfillcolor=m&&m.length==v?m[o]:JXG.hsv2rgb(360*((o+1)/(1*v)),.9,.6),b.chartstyle&&-1!=b.chartstyle.indexOf("bar")?x.push(new JXG.Chart(e,[c,u[o]],b)):x.push(new JXG.Chart(e,[u[o]],b))}e.unsuspendUpdate()}return x}return b=JXG.copyAttributes(n,e.options,"chart"),new JXG.Chart(e,t,b)},JXG.JSXGraph.registerElement("chart",JXG.createChart),JXG.Legend=function(e,t,n){var i;switch(this.constructor(),i=JXG.copyAttributes(n,e.options,"legend"),this.board=e,this.coords=new JXG.Coords(JXG.COORDS_BY_USER,t,this.board),this.myAtts={},this.label_array=i.labelarray||i.labels,this.color_array=i.colorarray||i.colors,this.lines=[],this.myAtts.strokewidth=i.strokewidth||5,this.myAtts.straightfirst=!1,this.myAtts.straightlast=!1,this.myAtts.withlabel=!0,this.style=i.legendstyle||i.style,this.style){case"vertical":this.drawVerticalLegend(e,i);break;default:throw Error("JSXGraph: Unknown legend style: "+this.style)}},JXG.Legend.prototype=new JXG.GeometryElement,JXG.Legend.prototype.drawVerticalLegend=function(e,t){var n,i=t.linelength||1,r=(t.rowheight||20)/this.board.unitY;for(n=0;this.label_array.length>n;n++)this.myAtts.strokecolor=this.color_array[n],this.myAtts.highlightstrokecolor=this.color_array[n],this.myAtts.name=this.label_array[n],this.myAtts.labeloffsets=[10,0],this.lines[n]=e.create("line",[[this.coords.usrCoords[1],this.coords.usrCoords[2]-n*r],[this.coords.usrCoords[1]+i,this.coords.usrCoords[2]-n*r]],this.myAtts),this.lines[n].getLabelAnchor=function(){return this.setLabelRelativeCoords(this.labelOffsets),new JXG.Coords(JXG.COORDS_BY_USER,[this.point2.X(),this.point2.Y()],this.board)}},JXG.createLegend=function(e,t,n){var i=[0,0];return JXG.exists(t)&&2==t.length&&(i=t),new JXG.Legend(e,i,n)},JXG.JSXGraph.registerElement("legend",JXG.createLegend),JXG.Transformation=function(e,t,n){this.elementClass=JXG.OBJECT_CLASS_OTHER,this.matrix=[[1,0,0],[0,1,0],[0,0,1]],this.board=e,this.isNumericMatrix=!1,this.setMatrix(e,t,n)},JXG.Transformation.prototype={},JXG.extend(JXG.Transformation.prototype,{update:function(){return this},setMatrix:function(e,t,n){var i;for(this.isNumericMatrix=!0,i=0;n.length>i;i++)if("number"!=typeof n[i]){this.isNumericMatrix=!1;break}"translate"==t?(this.evalParam=JXG.createEvalFunction(e,n,2),this.update=function(){this.matrix[1][0]=this.evalParam(0),this.matrix[2][0]=this.evalParam(1)}):"scale"==t?(this.evalParam=JXG.createEvalFunction(e,n,2),this.update=function(){this.matrix[1][1]=this.evalParam(0),this.matrix[2][2]=this.evalParam(1)}):"reflect"==t?(4>n.length&&(n[0]=JXG.getReference(e,n[0])),2==n.length&&(n[1]=JXG.getReference(e,n[1])),4==n.length&&(this.evalParam=JXG.createEvalFunction(e,n,4)),this.update=function(){var e,t,i,r,o;1==n.length?(e=n[0].point2.X()-n[0].point1.X(),t=n[0].point2.Y()-n[0].point1.Y(),i=n[0].point1.X(),r=n[0].point1.Y()):2==n.length?(e=n[1].X()-n[0].X(),t=n[1].Y()-n[0].Y(),i=n[0].X(),r=n[0].Y()):4==n.length&&(e=this.evalParam(2)-this.evalParam(0),t=this.evalParam(3)-this.evalParam(1),i=this.evalParam(0),r=this.evalParam(1)),o=e*e+t*t,this.matrix[1][1]=(e*e-t*t)/o,this.matrix[1][2]=2*e*t/o,this.matrix[2][1]=2*e*t/o,this.matrix[2][2]=(-e*e+t*t)/o,this.matrix[1][0]=i*(1-this.matrix[1][1])-r*this.matrix[1][2],this.matrix[2][0]=r*(1-this.matrix[2][2])-i*this.matrix[2][1]}):"rotate"==t?(3==n.length?this.evalParam=JXG.createEvalFunction(e,n,3):2>=n.length&&(this.evalParam=JXG.createEvalFunction(e,n,1),2==n.length&&(n[1]=JXG.getReference(e,n[1]))),this.update=function(){var e,t,i=this.evalParam(0),r=Math.cos(i),o=Math.sin(i);this.matrix[1][1]=r,this.matrix[1][2]=-o,this.matrix[2][1]=o,this.matrix[2][2]=r,n.length>1&&(3==n.length?(e=this.evalParam(1),t=this.evalParam(2)):(e=n[1].X(),t=n[1].Y()),this.matrix[1][0]=e*(1-r)+t*o,this.matrix[2][0]=t*(1-r)-e*o)}):"shear"==t?(this.evalParam=JXG.createEvalFunction(e,n,1),this.update=function(){var e=this.evalParam(0);this.matrix[1][1]=Math.tan(e)}):"generic"==t&&(this.evalParam=JXG.createEvalFunction(e,n,9),this.update=function(){this.matrix[0][0]=this.evalParam(0),this.matrix[0][1]=this.evalParam(1),this.matrix[0][2]=this.evalParam(2),this.matrix[1][0]=this.evalParam(3),this.matrix[1][1]=this.evalParam(4),this.matrix[1][2]=this.evalParam(5),this.matrix[2][0]=this.evalParam(6),this.matrix[2][1]=this.evalParam(7),this.matrix[2][2]=this.evalParam(8)})},apply:function(e){return this.update(),null!=arguments[1]?JXG.Math.matVecMult(this.matrix,e.initialCoords.usrCoords):JXG.Math.matVecMult(this.matrix,e.coords.usrCoords)},applyOnce:function(e){var t,n,i;if(JXG.isArray(e))for(n=e.length,i=0;n>i;i++)this.update(),t=JXG.Math.matVecMult(this.matrix,e[i].coords.usrCoords),e[i].coords.setCoordinates(JXG.COORDS_BY_USER,[t[1],t[2]]);else this.update(),t=JXG.Math.matVecMult(this.matrix,e.coords.usrCoords),e.coords.setCoordinates(JXG.COORDS_BY_USER,[t[1],t[2]])},bindTo:function(e){var t,n;if(JXG.isArray(e))for(n=e.length,t=0;n>t;t++)e[t].transformations.push(this);else e.transformations.push(this)},setProperty:function(){},melt:function(e){var t,n,i,r,o,a,s=[];for(n=e.matrix.length,i=this.matrix[0].length,t=0;n>t;t++)s[t]=[];for(this.update(),e.update(),t=0;n>t;t++)for(a=0;i>a;a++){for(o=0,r=0;n>r;r++)o+=e.matrix[t][r]*this.matrix[r][a];s[t][a]=o}return this.update=function(){var e=this.matrix.length,n=this.matrix[0].length;for(t=0;e>t;t++)for(a=0;n>a;a++)this.matrix[t][a]=s[t][a]},!0}}),JXG.createTransform=function(e,t,n){return new JXG.Transformation(e,n.type,t)},JXG.JSXGraph.registerElement("transform",JXG.createTransform),JXG.Turtle=function(e,t,n){this.constructor(e,n,JXG.OBJECT_TYPE_TURTLE,JXG.OBJECT_CLASS_OTHER);var i,r,o;return this.turtleIsHidden=!1,this.board=e,this.attributes=JXG.checkAttributes(n,{withLabel:!1,layer:null}),this.attributes.straightFirst=!1,this.attributes.straightLast=!1,i=0,r=0,o=90,0!=t.length&&(3==t.length?(i=t[0],r=t[1],o=t[2]):2==t.length?JXG.isArray(t[0])?(i=t[0][0],r=t[0][1],o=t[1]):(i=t[0],r=t[1]):(i=t[0][0],r=t[0][1])),this.init(i,r,o),this},JXG.Turtle.prototype=new JXG.GeometryElement,JXG.extend(JXG.Turtle.prototype,{init:function(e,t,n){this.arrowLen=20/Math.sqrt(this.board.unitX*this.board.unitX+this.board.unitY*this.board.unitY),this.pos=[e,t],this.isPenDown=!0,this.dir=90,this.stack=[],this.objects=[],this.attributes.curveType="plot",this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this.attributes),this.objects.push(this.curve),this.turtle=this.board.create("point",this.pos,{fixed:!0,name:" ",visible:!1,withLabel:!1}),this.objects.push(this.turtle),this.turtle2=this.board.create("point",[this.pos[0],this.pos[1]+this.arrowLen],{fixed:!0,name:" ",visible:!1,withLabel:!1}),this.objects.push(this.turtle2);var i=this.attributes.strokeWidth||this.attributes.strokewidth||2;this.arrow=this.board.create("line",[this.turtle,this.turtle2],{strokeColor:"#ff0000",straightFirst:!1,straightLast:!1,strokeWidth:i,withLabel:!1,lastArrow:!0}),this.objects.push(this.arrow),this.right(90-n),this.board.update()},forward:function(e){if(0===e)return this;var t=e*Math.cos(this.dir*Math.PI/180),n=e*Math.sin(this.dir*Math.PI/180);if(!this.turtleIsHidden){var i=this.board.create("transform",[t,n],{type:"translate"});i.applyOnce(this.turtle),i.applyOnce(this.turtle2)}return this.isPenDown&&this.curve.dataX.length>=8192&&(this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this.attributes),this.objects.push(this.curve)),this.pos[0]+=t,this.pos[1]+=n,this.isPenDown&&(this.curve.dataX.push(this.pos[0]),this.curve.dataY.push(this.pos[1])),this.board.update(),this},back:function(e){return this.forward(-e)},right:function(e){if(this.dir-=e,this.dir%=360,!this.turtleIsHidden){var t=this.board.create("transform",[-e*Math.PI/180,this.turtle],{type:"rotate"});t.applyOnce(this.turtle2)}return this.board.update(),this},left:function(e){return this.right(-e)},penUp:function(){return this.isPenDown=!1,this},penDown:function(){return this.isPenDown=!0,this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this.attributes),this.objects.push(this.curve),this},clean:function(){for(var e=0;this.objects.length>e;e++){var t=this.objects[e];t.type==JXG.OBJECT_TYPE_CURVE&&(this.board.removeObject(t.id),this.objects.splice(e,1))}return this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this.attributes),this.objects.push(this.curve),this.board.update(),this},clearScreen:function(){for(var e=0;this.objects.length>e;e++){var t=this.objects[e];this.board.removeObject(t.id)}return this.init(0,0,90),this},setPos:function(e,t){if(this.pos=JXG.isArray(e)?e:[e,t],!this.turtleIsHidden){this.turtle.setPositionDirectly(JXG.COORDS_BY_USER,e,t),this.turtle2.setPositionDirectly(JXG.COORDS_BY_USER,e,t+this.arrowLen);var n=this.board.create("transform",[-(this.dir-90)*Math.PI/180,this.turtle],{type:"rotate"});n.applyOnce(this.turtle2)}return this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this.attributes),this.objects.push(this.curve),this.board.update(),this},setPenSize:function(e){return this.attributes.strokeWidth=e,this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this.attributes),this.objects.push(this.curve),this},setPenColor:function(e){return this.attributes.strokeColor=e,this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this.attributes),this.objects.push(this.curve),this},setHighlightPenColor:function(e){return this.attributes.highlightStrokeColor=e,this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this.attributes),this.objects.push(this.curve),this},setProperty:function(){var e,t,n,i,r;for(n=0;arguments.length>n;n++){if(t=arguments[n],"string"==typeof t)e=t.split(":");else{if(!JXG.isArray(t)){for(var r in t)this.setProperty([r,t[r]]);return this}e=t}this.attributes[e[0]]=e[1]}for(n=0;this.objects.length>n;n++)i=this.objects[n],i.type==JXG.OBJECT_TYPE_CURVE&&i.setProperty(this.attributes);return this},showTurtle:function(){return this.turtleIsHidden=!1,this.arrow.setProperty("visible:true"),this.setPos(this.pos[0],this.pos[1]),this.board.update(),this},hideTurtle:function(){return this.turtleIsHidden=!0,this.arrow.setProperty("visible:false"),this.setPos(this.pos[0],this.pos[1]),this.board.update(),this},home:function(){return this.pos=[0,0],this.setPos(this.pos[0],this.pos[1]),this},pushTurtle:function(){return this.stack.push([this.pos[0],this.pos[1],this.dir]),this},popTurtle:function(){var e=this.stack.pop();return this.pos[0]=e[0],this.pos[1]=e[1],this.dir=e[2],this.setPos(this.pos[0],this.pos[1]),this},lookTo:function(e){if(JXG.isArray(e)){var t,n=this.pos[0],i=this.pos[1],r=e[0],o=e[1];t=Math.atan2(o-i,r-n),this.right(this.dir-180*t/Math.PI)}else JXG.isNumber(e)&&this.right(this.dir-e);return this},moveTo:function(e){if(JXG.isArray(e)){var t=e[0]-this.pos[0],n=e[1]-this.pos[1];if(!this.turtleIsHidden){var i=this.board.create("transform",[t,n],{type:"translate"});i.applyOnce(this.turtle),i.applyOnce(this.turtle2)}this.isPenDown&&this.curve.dataX.length>=8192&&(this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this.attributes),this.objects.push(this.curve)),this.pos[0]=e[0],this.pos[1]=e[1],this.isPenDown&&(this.curve.dataX.push(this.pos[0]),this.curve.dataY.push(this.pos[1])),this.board.update()}return this},fd:function(e){return this.forward(e)},bk:function(e){return this.back(e)},lt:function(e){return this.left(e)},rt:function(e){return this.right(e)},pu:function(){return this.penUp()},pd:function(){return this.penDown()},ht:function(){return this.hideTurtle()},st:function(){return this.showTurtle()},cs:function(){return this.clearScreen()},push:function(){return this.pushTurtle()},pop:function(){return this.popTurtle()},X:function(){return this.pos[0]},Y:function(){return this.pos[1]},hasPoint:function(e,t){var n,i;for(n=0;this.objects.length>n;n++)if(i=this.objects[n],i.type==JXG.OBJECT_TYPE_CURVE&&i.hasPoint(e,t))return!0;return!1}}),JXG.createTurtle=function(e,t,n){return t=t||[],new JXG.Turtle(e,t,n)},JXG.JSXGraph.registerElement("turtle",JXG.createTurtle),JXG.rgbParser=function(){if(0==arguments.length)return[0,0,0];arguments.length>=3&&(arguments[0]=[arguments[0],arguments[1],arguments[2]],arguments.length=1);var e=arguments[0];if(JXG.isArray(e)){var t,n=!1;for(t=0;3>t;t++)n|=/\./.test(""+arguments[0][t]);for(t=0;3>t;t++)n&=arguments[0][t]>=0&1>=arguments[0][t];return n?[Math.ceil(255*arguments[0][0]),Math.ceil(255*arguments[0][1]),Math.ceil(255*arguments[0][2])]:(arguments[0].length=3,arguments[0])}"string"==typeof arguments[0]&&(e=arguments[0]);var i,r,o;"#"==e.charAt(0)&&(e=e.substr(1,6)),e=e.replace(/ /g,""),e=e.toLowerCase();var a={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"};for(var s in a)e==s&&(e=a[s]);for(var l=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(e){return[parseInt(e[1]),parseInt(e[2]),parseInt(e[3])]}},{re:/^(\w{2})(\w{2})(\w{2})$/,example:["#00ff00","336699"],process:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:["#fb0","f0f"],process:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}}],t=0;l.length>t;t++){var c,u=l[t].re,d=l[t].process,h=u.exec(e);h&&(c=d(h),i=c[0],r=c[1],o=c[2])}return i=0>i||isNaN(i)?0:i>255?255:i,r=0>r||isNaN(r)?0:r>255?255:r,o=0>o||isNaN(o)?0:o>255?255:o,[i,r,o]},JXG.rgb2css=function(){var e,t,n;return e=JXG.rgbParser.apply(JXG.rgbParser,arguments),t=e[1],n=e[2],e=e[0],"rgb("+e+", "+t+", "+n+")"},JXG.rgb2hex=function(){var e,t,n;return e=JXG.rgbParser.apply(JXG.rgbParser,arguments),t=e[1],n=e[2],e=e[0],e=e.toString(16),t=t.toString(16),n=n.toString(16),1==e.length&&(e="0"+e),1==t.length&&(t="0"+t),1==n.length&&(n="0"+n),"#"+e+t+n},JXG.hsv2rgb=function(e,t,n){var i,r,o,a,s,l,c,u,d;if(e=(e%360+360)%360,0==t){if(!(isNaN(e)||JXG.Math.eps>e))return"#ffffff";i=n,r=n,o=n}else switch(l=e>=360?0:e,l/=60,s=Math.floor(l),a=l-s,c=n*(1-t),u=n*(1-t*a),d=n*(1-t*(1-a)),s){case 0:i=n,r=d,o=c;break;case 1:i=u,r=n,o=c;break;case 2:i=c,r=n,o=d;break;case 3:i=c,r=u,o=n;break;case 4:i=d,r=c,o=n;break;case 5:i=n,r=c,o=u}return i=Math.round(255*i).toString(16),i=2==i.length?i:1==i.length?"0"+i:"00",r=Math.round(255*r).toString(16),r=2==r.length?r:1==r.length?"0"+r:"00",o=Math.round(255*o).toString(16),o=2==o.length?o:1==o.length?"0"+o:"00",["#",i,r,o].join("")},JXG.rgb2hsv=function(){var e,t,n,i,r,o,a,s,l,c,u,d,h,p;return e=JXG.rgbParser.apply(JXG.rgbParser,arguments),t=e[1],n=e[2],e=e[0],p=JXG.Math.Statistics,i=e/255,r=t/255,o=n/255,d=p.max([e,t,n]),h=p.min([e,t,n]),a=d/255,s=h/255,u=a,c=0,u>0&&(c=(u-s)/(1*u)),l=1/(a-s),c>0&&(l=d==e?(r-o)*l:d==t?2+(o-i)*l:4+(i-r)*l),l*=60,0>l&&(l+=360),d==h&&(l=0),[l,c,u]},JXG.rgb2LMS=function(){var e,t,n,i,r,o,a,s=[[.05059983,.08585369,.0095242],[.01893033,.08925308,.01370054],[.00292202,.00975732,.07145979]];return e=JXG.rgbParser.apply(JXG.rgbParser,arguments),t=e[1],n=e[2],e=e[0],e=Math.pow(e,.476190476),t=Math.pow(t,.476190476),n=Math.pow(n,.476190476),i=e*s[0][0]+t*s[0][1]+n*s[0][2],r=e*s[1][0]+t*s[1][1]+n*s[1][2],o=e*s[2][0]+t*s[2][1]+n*s[2][2],a=[i,r,o],a.l=i,a.m=r,a.s=o,a},JXG.LMS2rgb=function(e,t,n){var i,r,o,a,s=[[30.830854,-29.832659,1.610474],[-6.481468,17.715578,-2.532642],[-.37569,-1.199062,14.273846]];i=e*s[0][0]+t*s[0][1]+n*s[0][2],r=e*s[1][0]+t*s[1][1]+n*s[1][2],o=e*s[2][0]+t*s[2][1]+n*s[2][2];var l=function(e){for(var t=127,n=64;n>0;){if(Math.pow(t,.476190476)>e)t-=n;else{if(Math.pow(t+1,.476190476)>e)return t;t+=n}n/=2}return 254==t&&e>13.994955247?255:t};return i=l(i),r=l(r),o=l(o),a=[i,r,o],a.r=i,a.g=r,a.b=o,a},JXG.rgba2rgbo=function(e){var t;return 9==e.length&&"#"==e.charAt(0)?(t=parseInt(e.substr(7,2).toUpperCase(),16)/255,e=e.substr(0,7)):t=1,[e,t]},JXG.rgb2bw=function(e){if("none"==e)return e;var t,n,i,r="0123456789ABCDEF";return i=JXG.rgbParser(e),t=.3*i[0]+.59*i[1]+.11*i[2],n=r.charAt(15&t>>4)+r.charAt(15&t),e="#"+n+n+n},JXG.rgb2cb=function(e,t){if("none"==e)return e;var n,i,r,o,a,s,l,c,u,d,h,p,f;switch(a=JXG.rgb2LMS(e),i=a.l,r=a.m,o=a.s,t=t.toLowerCase()){case"protanopia":l=-.06150039994295001,c=.08277001656812001,u=-.013200141220000003,d=.05858939668799999,h=-.07934519995360001,p=.013289415272000003,f=.6903216543277437,s=o/r,i=f>s?-(c*r+u*o)/l:-(h*r+p*o)/d;break;case"tritanopia":l=-.00058973116217,c=.007690316482,u=-.01011703519052,d=.025495080838999994,h=-.0422740347,p=.017005316784,f=.8349489908460004,s=r/i,o=f>s?-(l*i+c*r)/u:-(d*i+h*r)/p;break;default:l=-.06150039994295001,c=.08277001656812001,u=-.013200141220000003,d=.05858939668799999,h=-.07934519995360001,p=.013289415272000003,f=.5763833686400911,s=o/i,r=f>s?-(l*i+u*o)/c:-(d*i+p*o)/h}n=JXG.LMS2rgb(i,r,o);var g="0123456789ABCDEF";return s=g.charAt(15&n.r>>4)+g.charAt(15&n.r),e="#"+s,s=g.charAt(15&n.g>>4)+g.charAt(15&n.g),e+=s,s=g.charAt(15&n.b>>4)+g.charAt(15&n.b),e+=s},JXG.extend(JXG.Board.prototype,{angle:function(e,t,n){return JXG.Math.Geometry.angle(e,t,n)},rad:function(e,t,n){return JXG.Math.Geometry.rad(e,t,n)},distance:function(e,t){return JXG.Math.Geometry.distance(e,t)},pow:function(e,t){return JXG.Math.pow(e,t)},round:function(e,t){return e.toFixed(t)},cosh:function(e){return JXG.Math.cosh(e)},sinh:function(e){return JXG.Math.sinh(e)},sgn:function(e){return 0==e?0:e/Math.abs(e)},D:function(e,t){return JXG.Math.Numerics.D(e,t)},I:function(e,t){return JXG.Math.Numerics.I(e,t)},root:function(e,t,n){return JXG.Math.Numerics.root(e,t,n)},lagrangePolynomial:function(e){return JXG.Math.Numerics.lagrangePolynomial(e)},neville:function(e){return JXG.Math.Numerics.Neville(e)},riemannsum:function(e,t,n,i,r){return JXG.Math.Numerics.riemannsum(e,t,n,i,r)},abs:Math.abs,acos:Math.acos,asin:Math.asin,atan:Math.atan,ceil:Math.ceil,cos:Math.cos,exp:Math.exp,floor:Math.floor,log:Math.log,max:Math.max,min:Math.min,random:Math.random,sin:Math.sin,sqrt:Math.sqrt,tan:Math.tan,trunc:Math.ceil,factorial:function(e){return JXG.Math.factorial(e)},binomial:function(e,t){return JXG.Math.binomial(e,t)},getElement:function(e){return JXG.getReference(this,e)},intersectionOptions:["point",[[JXG.OBJECT_CLASS_LINE,JXG.OBJECT_CLASS_LINE],[JXG.OBJECT_CLASS_LINE,JXG.OBJECT_CLASS_CIRCLE],[JXG.OBJECT_CLASS_CIRCLE,JXG.OBJECT_CLASS_CIRCLE]]],intersection:function(e,t,n,i){return e=JXG.getReference(this,e),t=JXG.getReference(this,t),e.elementClass==JXG.OBJECT_CLASS_CURVE&&t.elementClass==JXG.OBJECT_CLASS_CURVE?function(){return JXG.Math.Geometry.meetCurveCurve(e,t,n,i,e.board)}:e.type==JXG.OBJECT_TYPE_ARC&&t.elementClass==JXG.OBJECT_CLASS_LINE||t.type==JXG.OBJECT_TYPE_ARC&&e.elementClass==JXG.OBJECT_CLASS_LINE?function(){return JXG.Math.Geometry.meet(e.stdform,t.stdform,n,e.board)}:e.elementClass==JXG.OBJECT_CLASS_CURVE&&t.elementClass==JXG.OBJECT_CLASS_LINE||t.elementClass==JXG.OBJECT_CLASS_CURVE&&e.elementClass==JXG.OBJECT_CLASS_LINE?function(){return JXG.Math.Geometry.meetCurveLine(e,t,n,e.board)}:function(){return JXG.Math.Geometry.meet(e.stdform,t.stdform,n,e.board)}},intersectionFunc:function(e,t,n,i){return this.intersection(e,t,n,i)},otherIntersection:function(e,t,n){return e=JXG.getReference(this,e),t=JXG.getReference(this,t),function(){var i=JXG.Math.Geometry.meet(e.stdform,t.stdform,0,e.board);return Math.abs(n.X()-i.usrCoords[1])>JXG.Math.eps||Math.abs(n.Y()-i.usrCoords[2])>JXG.Math.eps||Math.abs(n.Z()-i.usrCoords[0])>JXG.Math.eps?i:JXG.Math.Geometry.meet(e.stdform,t.stdform,1,e.board)}},pointFunc:function(){return[null]},pointOptions:["point",[[JXG.OBJECT_CLASS_POINT]]],lineFunc:function(){return arguments},lineOptions:["line",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT]]],linesegmentFunc:function(){return arguments},linesegmentOptions:["line",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT]]],linesegmentAtts:{straightFirst:!1,straightLast:!1},arrowFunc:function(){return arguments},arrowOptions:["arrow",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT]]],circleFunc:function(){return arguments},circleOptions:["circle",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT],[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_LINE],[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_CIRCLE]]],arrowparallelOptions:["arrowparallel",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_LINE]]],arrowparallelFunc:function(){return arguments},bisectorOptions:["bisector",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT]]],bisectorFunc:function(){return arguments},circumcircleOptions:["circumcircle",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT]]],circumcircleFunc:function(){return arguments},circumcirclemidpointOptions:["circumcirclemidpoint",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT]]],circumcirclemidpointFunc:function(){return arguments},integralOptions:["integral",[[]]],integralFunc:function(){return arguments},midpointOptions:["midpoint",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT],[JXG.OBJECT_CLASS_LINE]]],midpointFunc:function(){return arguments},mirrorpointOptions:["mirrorpoint",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT]]],mirrorpointFunc:function(){return arguments},normalOptions:["normal",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_LINE]]],normalFunc:function(){return arguments},parallelOptions:["parallel",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_LINE]]],parallelFunc:function(){return arguments},parallelpointOptions:["parallelpoint",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_POINT]]],parallelpointFunc:function(){return arguments},perpendicularOptions:["perpendicular",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_LINE]]],perpendicularFunc:function(){return arguments},perpendicularpointOptions:["perpendicularpoint",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_LINE]]],perpendicularpointFunc:function(){return arguments},reflectionOptions:["reflection",[[JXG.OBJECT_CLASS_POINT,JXG.OBJECT_CLASS_LINE]]],reflectionFunc:function(){return arguments}}),JXG.Point.prototype.setPositionX=function(e,t){var n=e==JXG.COORDS_BY_USER?this.coords.usrCoords[2]:this.coords.scrCoords[2];this.setPosition(e,t,n)},JXG.Point.prototype.setPositionY=function(e,t){var n=e==JXG.COORDS_BY_USER?this.coords.usrCoords[1]:this.coords.scrCoords[1];this.setPosition(e,n,t)},JXG.Ticks=function(e,t,n){if(this.constructor(e.board,n,JXG.OBJECT_TYPE_TICKS,JXG.OBJECT_CLASS_OTHER),this.line=e,this.board=this.line.board,this.ticksFunction=null,this.fixedTicks=null,this.equidistant=!1,JXG.isFunction(t))throw this.ticksFunction=t,Error("Function arguments are no longer supported."); JXG.isArray(t)?this.fixedTicks=t:(Math.abs(t)<JXG.Math.eps&&(t=n.defaultdistance),this.ticksFunction=function(){return t},this.equidistant=!0),this.minTicksDistance=n.minticksdistance,this.maxTicksDistance=n.maxticksdistance,this.labels=[],this.id=this.line.addTicks(this),this.board.setId(this,"Ti")},JXG.Ticks.prototype=new JXG.GeometryElement,JXG.extend(JXG.Ticks.prototype,{hasPoint:function(){return!1},calculateTicksCoordinates:function(){0>this.visProp.minorheight&&(this.visProp.minorheight=2*(this.board.canvasWidth+this.board.canvasHeight)),0>this.visProp.majorheight&&(this.visProp.majorheight=2*(this.board.canvasWidth+this.board.canvasHeight));var e,t,n,i,r,o,a,s,l=this.line.point1,c=this.line.point2,u=l.coords.distance(JXG.COORDS_BY_USER,c.coords),d=(c.coords.usrCoords[1]-l.coords.usrCoords[1])/u,h=(c.coords.usrCoords[2]-l.coords.usrCoords[2])/u,p=l.coords.distance(JXG.COORDS_BY_SCREEN,new JXG.Coords(JXG.COORDS_BY_USER,[l.coords.usrCoords[1]+d,l.coords.usrCoords[2]+h],this.board)),f=this.equidistant?this.ticksFunction(1):1,g=5,m=function(e,t,n,i,r){var o,s;return i?(o=""+e,Math.abs(e)<JXG.Math.eps&&(o="0"),(o.length>5||-1!=o.indexOf("e"))&&(o=""+e.toPrecision(3)),o.indexOf(".")>-1&&(o=o.replace(/0+$/,""),o=o.replace(/\.$/,"")),s=JXG.createText(n,[t.usrCoords[1],t.usrCoords[2],o],{id:r+a+"Label",isLabel:!0,layer:n.options.layer.line,highlightStrokeColor:n.options.text.strokeColor,highlightStrokeWidth:n.options.text.strokeWidth,highlightStrokeOpacity:n.options.text.strokeOpacity}),s.isDraggable=!1,s.distanceX=4,s.distanceY=-parseInt(s.visProp.fontsize)+3,s.setCoords(t.usrCoords[1]+s.distanceX/n.unitX,t.usrCoords[2]+s.distanceY/n.unitY),s.visProp.visible=i,s.prepareUpdate().update().updateRenderer(),s):null},v=function(e){return Math.ceil(e/f)*f},b=JXG.Math.eps,y=-this.line.getSlope(),x=this.visProp.majorheight/2,w=this.visProp.minorheight/2,k=0,C=0,_=0,T=0;if(b>Math.abs(y)?(k=0,C=x,_=0,T=w):Math.abs(y)>1/b||isNaN(y)?(k=x,C=0,_=w,T=0):(k=-x/Math.sqrt(1/(y*y)+1),C=k/y,_=-w/Math.sqrt(1/(y*y)+1),T=_/y),this.removeTickLabels(),this.ticks=[],this.labels=[],e=new JXG.Coords(JXG.COORDS_BY_USER,[l.coords.usrCoords[1],l.coords.usrCoords[2]],this.board),t=new JXG.Coords(JXG.COORDS_BY_USER,[c.coords.usrCoords[1],c.coords.usrCoords[2]],this.board),JXG.Math.Geometry.calcStraight(this.line,e,t),!this.equidistant){var E=l.coords.usrCoords[1]-e.usrCoords[1],S=l.coords.usrCoords[2]-e.usrCoords[2],A=Math.sqrt(E*E+S*S),I=l.coords.usrCoords[1]-t.usrCoords[1],O=l.coords.usrCoords[2]-t.usrCoords[2],L=Math.sqrt(I*I+O*O),D=0,R=0;for(a=0;this.fixedTicks.length>a;a++)this.fixedTicks[a]>=-A&&L>=this.fixedTicks[a]&&(0>this.fixedTicks[a]?(D=Math.abs(E)*this.fixedTicks[a]/A,R=Math.abs(S)*this.fixedTicks[a]/A):(D=Math.abs(I)*this.fixedTicks[a]/L,R=Math.abs(O)*this.fixedTicks[a]/L),r=new JXG.Coords(JXG.COORDS_BY_USER,[l.coords.usrCoords[1]+D,l.coords.usrCoords[2]+R],this.board),this.ticks.push(r),this.ticks[this.ticks.length-1].major=!0,this.labels.push(m(this.fixedTicks[a],r,this.board,this.visProp.drawlabels,this.id)));return this.dxMaj=k,this.dyMaj=C,this.dxMin=_,this.dyMin=T,void 0}if(this.visProp.insertticks&&this.minTicksDistance>JXG.Math.eps){for(;p>4*this.minTicksDistance;)f/=10,p=l.coords.distance(JXG.COORDS_BY_SCREEN,new JXG.Coords(JXG.COORDS_BY_USER,[l.coords.usrCoords[1]+d*f,l.coords.usrCoords[2]+h*f],this.board));for(;this.minTicksDistance>p;)f*=g,g=5==g?2:5,p=l.coords.distance(JXG.COORDS_BY_SCREEN,new JXG.Coords(JXG.COORDS_BY_USER,[l.coords.usrCoords[1]+d*f,l.coords.usrCoords[2]+h*f],this.board))}for(JXG.Math.Geometry.isSameDirection(l.coords,e,t)?(n=l.coords.distance(JXG.COORDS_BY_USER,e),i=l.coords.distance(JXG.COORDS_BY_USER,t),JXG.Math.Geometry.isSameDirection(l.coords,c.coords,e)?this.line.visProp.straightfirst&&(n-=2*f):(i=-1*i,n=-1*n,this.line.visProp.straightfirst&&(n-=2*f)),n>i&&(a=n,n=i,i=a),n=v(n),this.line.visProp.straightlast&&(i+=2*f)):(n=this.line.visProp.straightfirst?-v(l.coords.distance(JXG.COORDS_BY_USER,e)):0,i=this.line.visProp.straightlast?l.coords.distance(JXG.COORDS_BY_USER,t):u),o=new JXG.Coords(JXG.COORDS_BY_USER,[l.coords.usrCoords[1]+n*d,l.coords.usrCoords[2]+n*h],this.board),r=new JXG.Coords(JXG.COORDS_BY_USER,[l.coords.usrCoords[1]+n*d,l.coords.usrCoords[2]+n*h],this.board),d/=this.visProp.minorticks+1,h/=this.visProp.minorticks+1,a=0,s=n;o.distance(JXG.COORDS_BY_USER,r)<Math.abs(i-n)+JXG.Math.eps;)0===a%(this.visProp.minorticks+1)?(r.major=!0,this.labels.push(m(s,r,this.board,this.visProp.drawlabels,this.id)),s+=f):(r.major=!1,this.labels.push(null)),a++,this.ticks.push(r),r=new JXG.Coords(JXG.COORDS_BY_USER,[r.usrCoords[1]+d*f,r.usrCoords[2]+h*f],this.board),!this.visProp.drawzero&&r.distance(JXG.COORDS_BY_USER,l.coords)<=JXG.Math.eps&&(a++,s+=f,r=new JXG.Coords(JXG.COORDS_BY_USER,[r.usrCoords[1]+d*f,r.usrCoords[2]+h*f],this.board));this.dxMaj=k,this.dyMaj=C,this.dxMin=_,this.dyMin=T},removeTickLabels:function(){var e;if(null!=this.ticks&&(this.board.needsFullUpdate||this.needsRegularUpdate)&&("canvas"!=this.board.options.renderer||"internal"!=this.board.options.text.display))for(e=0;this.ticks.length>e;e++)null!=this.labels[e]&&this.labels[e].visProp.visible&&this.board.removeObject(this.labels[e])},update:function(){return this.needsUpdate&&this.calculateTicksCoordinates(),this},updateRenderer:function(){return this.needsUpdate&&(this.ticks&&this.board.renderer.updateTicks(this,this.dxMaj,this.dyMaj,this.dxMin,this.dyMin),this.needsUpdate=!1),this},hideElement:function(){var e;for(this.visProp.visible=!1,this.board.renderer.hide(this),e=0;this.labels.length>e;e++)JXG.exists(this.labels[e])&&this.labels[e].hideElement();return this},showElement:function(){var e;for(this.visProp.visible=!0,this.board.renderer.show(this),e=0;this.labels.length>e;e++)JXG.exists(this.labels[e])&&this.labels[e].showElement();return this}}),JXG.createTicks=function(e,t,n){var i,r,o=JXG.copyAttributes(n,e.options,"ticks");if(r=2>t.length?n.ticksDistance:t[1],t[0].elementClass!=JXG.OBJECT_CLASS_LINE||!(JXG.isFunction(t[1])||JXG.isArray(t[1])||JXG.isNumber(t[1])))throw Error("JSXGraph: Can't create Ticks with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'.");return i=new JXG.Ticks(t[0],r,o)},JXG.JSXGraph.registerElement("ticks",JXG.createTicks),JXG.Util={},JXG.Util.Unzip=function(e){function t(){return M+=8,D.length>R?D[R++]:-1}function n(){P=1}function i(){var e;return M++,e=1&P,P>>=1,0==P&&(P=t(),e=1&P,P=128|P>>1),e}function r(e){for(var t=0,n=e;n--;)t=t<<1|i();return e&&(t=E[t]>>8-e),t}function o(){_=0}function a(e){v++,C[_++]=e,y.push(String.fromCharCode(e)),32768==_&&(_=0)}function s(){this.b0=0,this.b1=0,this.jump=null,this.jumppos=-1}function l(){for(;;){if($[X]>=W)return-1;if(J[$[X]]==X)return $[X]++;$[X]++}}function c(){var e,t=H[G];if(x&&document.write("<br>len:"+X+" treepos:"+G),17==X)return-1;if(G++,X++,e=l(),x&&document.write("<br>IsPat "+e),e>=0)t.b0=e,x&&document.write("<br>b0 "+t.b0);else if(t.b0=32768,x&&document.write("<br>b0 "+t.b0),c())return-1;if(e=l(),e>=0)t.b1=e,x&&document.write("<br>b1 "+t.b1),t.jump=null;else if(t.b1=32768,x&&document.write("<br>b1 "+t.b1),t.jump=H[G],t.jumppos=G,c())return-1;return X--,0}function u(e,t,n,i){var r;for(x&&document.write("currentTree "+e+" numval "+t+" lengths "+n+" show "+i),H=e,G=0,J=n,W=t,r=0;17>r;r++)$[r]=0;if(X=0,c())return x&&alert("invalid huffman tree\n"),-1;if(x){document.write("<br>Tree: "+H.length);for(var o=0;32>o;o++)document.write("Places["+o+"].b0="+H[o].b0+"<br>"),document.write("Places["+o+"].b1="+H[o].b1+"<br>")}return 0}function d(e){for(var t,n,r,o=0,a=e[o];;)if(r=i(),x&&document.write("b="+r),r){if(!(32768&a.b1))return x&&document.write("ret1"),a.b1;for(a=a.jump,t=e.length,n=0;t>n;n++)if(e[n]===a){o=n;break}}else{if(!(32768&a.b0))return x&&document.write("ret2"),a.b0;o++,a=e[o]}return x&&document.write("ret3"),-1}function h(){var e,l,c,h,p;do{switch(e=i(),c=r(2)){case 0:x&&alert("Stored\n");break;case 1:x&&alert("Fixed Huffman codes\n");break;case 2:x&&alert("Dynamic Huffman codes\n");break;case 3:x&&alert("Reserved block type!!\n");break;default:x&&alert("Unexpected value %d!\n",c)}if(0==c){var f,g;for(n(),f=t(),f|=t()<<8,g=t(),g|=t()<<8,65535&(f^~g)&&document.write("BlockLen checksum mismatch\n");f--;)l=t(),a(l)}else if(1==c)for(var m;;)if(m=E[r(7)]>>1,m>23?(m=m<<1|i(),m>199?(m-=128,m=m<<1|i()):(m-=48,m>143&&(m+=136))):m+=256,256>m)a(m);else{if(256==m)break;var p,v;for(m-=257,p=r(A[m])+S[m],m=E[r(5)]>>3,O[m]>8?(v=r(8),v|=r(O[m]-8)<<8):v=r(O[m]),v+=I[m],m=0;p>m;m++){var l=C[32767&_-v];a(l)}}else if(2==c){var m,b,y,w,k,T=Array(320);for(y=257+r(5),w=1+r(5),k=4+r(4),m=0;19>m;m++)T[m]=0;for(m=0;k>m;m++)T[L[m]]=r(3);for(p=z.length,h=0;p>h;h++)z[h]=new s;if(u(z,19,T,0))return o(),1;if(x){document.write("<br>distanceTree");for(var D=0;z.length>D;D++)document.write("<br>"+z[D].b0+" "+z[D].b1+" "+z[D].jump+" "+z[D].jumppos)}b=y+w,h=0;var R=-1;for(x&&document.write("<br>n="+b+" bits: "+M+"<br>");b>h;)if(R++,m=d(z),x&&document.write("<br>"+R+" i:"+h+" decode: "+m+" bits "+M+"<br>"),16>m)T[h++]=m;else if(16==m){var P;if(m=3+r(2),h+m>b)return o(),1;for(P=h?T[h-1]:0;m--;)T[h++]=P}else{if(m=17==m?3+r(3):11+r(7),h+m>b)return o(),1;for(;m--;)T[h++]=0}for(p=j.length,h=0;p>h;h++)j[h]=new s;if(u(j,y,T,0))return o(),1;for(p=j.length,h=0;p>h;h++)z[h]=new s;var N=[];for(h=y;T.length>h;h++)N[h-y]=T[h];if(u(z,w,N,0))return o(),1;for(x&&document.write("<br>literalTree");;)if(m=d(j),m>=256){var p,v;if(m-=256,0==m)break;for(m--,p=r(A[m])+S[m],m=d(z),O[m]>8?(v=r(8),v|=r(O[m]-8)<<8):v=r(O[m]),v+=I[m];p--;){var l=C[32767&_-v];a(l)}}else a(m)}}while(!e);return o(),n(),0}function p(){x&&alert("NEXTFILE"),y=[];var e=[];if(T=!1,e[0]=t(),e[1]=t(),x&&alert("type: "+e[0]+" "+e[1]),e[0]==parseInt("78",16)&&e[1]==parseInt("da",16)&&(x&&alert("GEONExT-GZIP"),h(),x&&alert(y.join("")),k[w]=Array(2),k[w][0]=y.join(""),k[w][1]="geonext.gxt",w++),e[0]==parseInt("1f",16)&&e[1]==parseInt("8b",16)&&(x&&alert("GZIP"),f(),x&&alert(y.join("")),k[w]=Array(2),k[w][0]=y.join(""),k[w][1]="file",w++),e[0]==parseInt("50",16)&&e[1]==parseInt("4b",16)&&(T=!0,e[2]=t(),e[3]=t(),e[2]==parseInt("3",16)&&e[3]==parseInt("4",16))){e[0]=t(),e[1]=t(),x&&alert("ZIP-Version: "+e[1]+" "+e[0]/10+"."+e[0]%10),g=t(),g|=t()<<8,x&&alert("gpflags: "+g);var n=t();n|=t()<<8,x&&alert("method: "+n),t(),t(),t(),t();var i=t();i|=t()<<8,i|=t()<<16,i|=t()<<24;var r=t();r|=t()<<8,r|=t()<<16,r|=t()<<24;var o=t();o|=t()<<8,o|=t()<<16,o|=t()<<24,x&&alert("local CRC: "+i+"\nlocal Size: "+o+"\nlocal CompSize: "+r);var a=t();a|=t()<<8;var s=t();for(s|=t()<<8,x&&alert("filelen "+a),c=0,B=[];a--;){var l=t();"/"==l|":"==l?c=0:N-1>c&&(B[c++]=String.fromCharCode(l))}x&&alert("nameBuf: "+B),b||(b=B);for(var c=0;s>c;)l=t(),c++;m=4294967295,v=0,(o=0)&&x&&alert("skipdir"),8==n&&(h(),x&&alert(y.join("")),k[w]=Array(2),k[w][0]=y.join(""),k[w][1]=B.join(""),w++),f()}}function f(){var e,n,i,r,o,a,s=[];if(8&g&&(s[0]=t(),s[1]=t(),s[2]=t(),s[3]=t(),s[0]==parseInt("50",16)&&s[1]==parseInt("4b",16)&&s[2]==parseInt("07",16)&&s[3]==parseInt("08",16)?(e=t(),e|=t()<<8,e|=t()<<16,e|=t()<<24):e=s[0]|s[1]<<8|s[2]<<16|s[3]<<24,n=t(),n|=t()<<8,n|=t()<<16,n|=t()<<24,i=t(),i|=t()<<8,i|=t()<<16,i|=t()<<24,x&&alert("CRC:")),T&&p(),s[0]=t(),8!=s[0])return x&&alert("Unknown compression method!"),0;if(g=t(),x&&g&~parseInt("1f",16)&&alert("Unknown flags set!"),t(),t(),t(),t(),t(),r=t(),4&g)for(s[0]=t(),s[2]=t(),X=s[0]+256*s[1],x&&alert("Extra field size: "+X),o=0;X>o;o++)t();if(8&g){for(o=0,B=[];a=t();)("7"==a||":"==a)&&(o=0),N-1>o&&(B[o++]=a);x&&alert("original file name: "+B)}if(16&g)for(;a=t(););2&g&&(t(),t()),h(),e=t(),e|=t()<<8,e|=t()<<16,e|=t()<<24,i=t(),i|=t()<<8,i|=t()<<16,i|=t()<<24,T&&p()}var g,m,v,b,y=[],x=!1,w=0,k=[],C=Array(32768),_=0,T=!1,E=[0,128,64,192,32,160,96,224,16,144,80,208,48,176,112,240,8,136,72,200,40,168,104,232,24,152,88,216,56,184,120,248,4,132,68,196,36,164,100,228,20,148,84,212,52,180,116,244,12,140,76,204,44,172,108,236,28,156,92,220,60,188,124,252,2,130,66,194,34,162,98,226,18,146,82,210,50,178,114,242,10,138,74,202,42,170,106,234,26,154,90,218,58,186,122,250,6,134,70,198,38,166,102,230,22,150,86,214,54,182,118,246,14,142,78,206,46,174,110,238,30,158,94,222,62,190,126,254,1,129,65,193,33,161,97,225,17,145,81,209,49,177,113,241,9,137,73,201,41,169,105,233,25,153,89,217,57,185,121,249,5,133,69,197,37,165,101,229,21,149,85,213,53,181,117,245,13,141,77,205,45,173,109,237,29,157,93,221,61,189,125,253,3,131,67,195,35,163,99,227,19,147,83,211,51,179,115,243,11,139,75,203,43,171,107,235,27,155,91,219,59,187,123,251,7,135,71,199,39,167,103,231,23,151,87,215,55,183,119,247,15,143,79,207,47,175,111,239,31,159,95,223,63,191,127,255],S=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],A=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,99,99],I=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],O=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],L=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],D=e,R=0,P=1,M=0,N=256,B=[],F=288,j=Array(F),z=Array(32),G=0,H=null;Array(64),Array(64);var X=0,$=Array(17);$[0]=0;var J,W;JXG.Util.Unzip.prototype.unzipFile=function(e){var t;for(this.unzip(),t=0;k.length>t;t++)if(k[t][1]==e)return k[t][0]},JXG.Util.Unzip.prototype.unzip=function(){return x&&alert(D),p(),k}},JXG.Util.Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){var t,n,i,r,o,a,s,l=[],c=0;for(e=JXG.Util.Base64._utf8_encode(e);e.length>c;)t=e.charCodeAt(c++),n=e.charCodeAt(c++),i=e.charCodeAt(c++),r=t>>2,o=(3&t)<<4|n>>4,a=(15&n)<<2|i>>6,s=63&i,isNaN(n)?a=s=64:isNaN(i)&&(s=64),l.push([this._keyStr.charAt(r),this._keyStr.charAt(o),this._keyStr.charAt(a),this._keyStr.charAt(s)].join(""));return l.join("")},decode:function(e,t){var n,i,r,o,a,s,l,c=[],u=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");e.length>u;)o=this._keyStr.indexOf(e.charAt(u++)),a=this._keyStr.indexOf(e.charAt(u++)),s=this._keyStr.indexOf(e.charAt(u++)),l=this._keyStr.indexOf(e.charAt(u++)),n=o<<2|a>>4,i=(15&a)<<4|s>>2,r=(3&s)<<6|l,c.push(String.fromCharCode(n)),64!=s&&c.push(String.fromCharCode(i)),64!=l&&c.push(String.fromCharCode(r));return c=c.join(""),t&&(c=JXG.Util.Base64._utf8_decode(c)),c},_utf8_encode:function(e){e=e.replace(/\r\n/g,"\n");for(var t="",n=0;e.length>n;n++){var i=e.charCodeAt(n);128>i?t+=String.fromCharCode(i):i>127&&2048>i?(t+=String.fromCharCode(192|i>>6),t+=String.fromCharCode(128|63&i)):(t+=String.fromCharCode(224|i>>12),t+=String.fromCharCode(128|63&i>>6),t+=String.fromCharCode(128|63&i))}return t},_utf8_decode:function(e){for(var t=[],n=0,i=0,r=0,o=0;e.length>n;)i=e.charCodeAt(n),128>i?(t.push(String.fromCharCode(i)),n++):i>191&&224>i?(r=e.charCodeAt(n+1),t.push(String.fromCharCode((31&i)<<6|63&r)),n+=2):(r=e.charCodeAt(n+1),o=e.charCodeAt(n+2),t.push(String.fromCharCode((15&i)<<12|(63&r)<<6|63&o)),n+=3);return t.join("")},_destrip:function(e,t){var n,i,r=[],o=[];for(null==t&&(t=76),e.replace(/ /g,""),n=e.length/t,i=0;n>i;i++)r[i]=e.substr(i*t,t);for(n!=e.length/t&&(r[r.length]=e.substr(n*t,e.length-n*t)),i=0;r.length>i;i++)o.push(r[i]);return o.join("\n")},decodeAsArray:function(e){var t,n=this.decode(e),i=[];for(t=0;n.length>t;t++)i[t]=n.charCodeAt(t);return i},decodeGEONExT:function(e){return decodeAsArray(destrip(e),!1)}},JXG.Util.asciiCharCodeAt=function(e,t){var n=e.charCodeAt(t);if(n>255)switch(n){case 8364:n=128;break;case 8218:n=130;break;case 402:n=131;break;case 8222:n=132;break;case 8230:n=133;break;case 8224:n=134;break;case 8225:n=135;break;case 710:n=136;break;case 8240:n=137;break;case 352:n=138;break;case 8249:n=139;break;case 338:n=140;break;case 381:n=142;break;case 8216:n=145;break;case 8217:n=146;break;case 8220:n=147;break;case 8221:n=148;break;case 8226:n=149;break;case 8211:n=150;break;case 8212:n=151;break;case 732:n=152;break;case 8482:n=153;break;case 353:n=154;break;case 8250:n=155;break;case 339:n=156;break;case 382:n=158;break;case 376:n=159;break;default:}return n},JXG.Util.utf8Decode=function(e){var t,n=[],i=0,r=0,o=0;if(!JXG.exists(e))return"";for(;e.length>i;)r=e.charCodeAt(i),128>r?(n.push(String.fromCharCode(r)),i++):r>191&&224>r?(o=e.charCodeAt(i+1),n.push(String.fromCharCode((31&r)<<6|63&o)),i+=2):(o=e.charCodeAt(i+1),t=e.charCodeAt(i+2),n.push(String.fromCharCode((15&r)<<12|(63&o)<<6|63&t)),i+=3);return n.join("")},JXG.Util.genUUID=function(){for(var e,t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),n=Array(36),i=0,r=0;36>r;r++)8==r||13==r||18==r||23==r?n[r]="-":14==r?n[r]="4":(2>=i&&(i=0|33554432+16777216*Math.random()),e=15&i,i>>=4,n[r]=t[19==r?8|3&e:e]);return n.join("")},JXG.PsTricks={convert:function(e){var t,n,i=new JXG.Coords(JXG.COORDS_BY_SCREEN,[0,0],e),r=new JXG.Coords(JXG.COORDS_BY_SCREEN,[e.canvasWidth,e.canvasHeight],e),o=[];o.push("\\begin{pspicture*}("+i.usrCoords[1]+","+r.usrCoords[2]+")("+r.usrCoords[1]+","+i.usrCoords[2]+")\n");for(t in e.objects)if(n=e.objects[t],n.visProp.visible)switch(n.elementClass){case JXG.OBJECT_CLASS_CIRCLE:o.push(this.addCircle(n));break;case JXG.OBJECT_CLASS_LINE:o.push(this.addLine(n));break;case JXG.OBJECT_CLASS_POINT:o.push(this.addPoint(n));break;default:switch(n.type){case JXG.OBJECT_TYPE_ARC:o.push(this.addArc(n));break;case JXG.OBJECT_TYPE_SECTOR:o.push(this.addArc(n)),o.push(this.addSector(n));break;case JXG.OBJECT_TYPE_POLYGON:o.push(this.addPolygon(n));break;case JXG.OBJECT_TYPE_ANGLE:o.push(this.addAngle(n))}}return o.push("\\end{pspicture*}"),o.join("\n")},setArrows:function(e){var t="";return e.visProp.firstarrow&&e.visProp.lastarrow?t="{<->}":e.visProp.firstarrow?t="{<-}":e.visProp.lastarrow&&(t="{->}"),t},drawWedge:function(e,t,n,i,r,o){var a="";return"none"!=e&&t>0&&(a+="\\pswedge[linestyle=none, fillstyle=solid, fillcolor="+this.parseColor(e)+", opacity="+t.toFixed(5)+"]",a+="("+n.join(",")+"){"+i+"}{"+r+"}{"+o+"}\n"),a},addPoint:function(e){var t="\\psdot[linecolor="+this.parseColor(e.visProp.strokecolor)+",dotstyle=",n=e.normalizeFace(e.visProp.face)||"o",i=e.visProp.size>4?4:e.visProp.size,r=[0,0,"2pt 2","5pt 2","5pt 3"];return"x"==n?t+="x, dotsize="+r[i]:"o"==n?(t+="*, dotsize=",1==i?t+="2pt 2":2==i?t+="4pt 2":3==i?t+="6pt 2":4==i&&(t+="6pt 3")):"[]"==n?t+="square*, dotsize="+r[i]:"+"==n&&(t+="+, dotsize="+r[i]),t+="]("+e.coords.usrCoords.slice(1).join(",")+")\n",t+="\\rput("+(e.coords.usrCoords[1]+15/e.board.unitY)+","+(e.coords.usrCoords[2]+15/e.board.unitY)+"){\\small $"+e.name+"$}\n"},addLine:function(e){var t=new JXG.Coords(JXG.COORDS_BY_USER,e.point1.coords.usrCoords,e.board),n=new JXG.Coords(JXG.COORDS_BY_USER,e.point2.coords.usrCoords,e.board),i="\\psline[linecolor="+this.parseColor(e.visProp.strokecolor)+", linewidth="+e.visProp.strokewidth+"px]";return(e.visProp.straightfirst||e.visProp.straightlast)&&JXG.Math.Geometry.calcStraight(e,t,n),i+=this.setArrows(e),i+="("+t.usrCoords.slice(1).join(",")+")("+n.usrCoords.slice(2).join(",")+")\n"},addCircle:function(e){var t=e.Radius(),n="\\pscircle[linecolor="+this.parseColor(e.visProp.strokecolor)+", linewidth="+e.visProp.strokewidth+"px";return"none"!=e.visProp.fillcolor&&0!=e.visProp.fillopacity&&(n+=", fillstyle=solid, fillcolor="+this.parseColor(e.visProp.fillcolor)+", opacity="+e.visProp.fillopacity.toFixed(5)),n+="]("+e.midpoint.coords.usrCoords.slice(1).join("1")+"){"+t+"}\n"},addPolygon:function(e){var t,n="\\pspolygon[linestyle=none, fillstyle=solid, fillcolor="+this.parseColor(e.visProp.fillcolor)+", opacity="+e.visProp.fillopacity.toFixed(5)+"]";for(t=0;e.vertices.length>t;t++)n+="("+e.vertices[t].coords.usrCoords.slice(1).join(",")+")";return n+="\n"},addArc:function(e){var t=e.Radius(),n={coords:new JXG.Coords(JXG.COORDS_BY_USER,[e.board.canvasWidth/e.board.unitY,e.midpoint.coords.usrCoords[2]],e.board)},i=JXG.Math.Geometry.trueAngle(n,e.midpoint,e.point2).toFixed(4),r=JXG.Math.Geometry.trueAngle(n,e.midpoint,e.point3).toFixed(4),o="\\psarc[linecolor="+this.parseColor(e.visProp.strokecolor)+", linewidth="+e.visProp.strokewidth+"px]";return o+=this.setArrows(e),o+="("+e.midpoint.coords.usrCoords.slice(1).join(",")+"){"+t+"}{"+i+"}{"+r+"}\n"},addSector:function(e){var t=e.Radius(),n={coords:new JXG.Coords(JXG.COORDS_BY_USER,[e.board.canvasWidth/e.board.unitY,e.midpoint.coords.usrCoords[2]],e.board)},i=JXG.Math.Geometry.trueAngle(n,e.midpoint,e.point2).toFixed(4),r=JXG.Math.Geometry.trueAngle(n,e.midpoint,e.point3).toFixed(4);return this.drawWedge(e.visProp.fillcolor,e.visProp.fillopacity,e.midpoint.coords.usrCoords.slice(1),t,i,r)},addAngle:function(e){var t,n=e.radius,i={coords:new JXG.Coords(JXG.COORDS_BY_USER,[e.board.canvasWidth/e.board.unitY,e.point2.coords.usrCoords[2]],e.board)},r=JXG.Math.Geometry.trueAngle(i,e.point2,e.point1).toFixed(4),o=JXG.Math.Geometry.trueAngle(i,e.point2,e.point3).toFixed(4);return t=this.drawWedge(e.visProp.fillcolor,e.visProp.fillopacity,e.point2.coords.usrCoords.slice(1),n,r,o),t+="\\psarc[linecolor="+this.parseColor(e.visProp.strokecolor)+", linewidth="+e.visProp.strokewidth+"px]",t+="("+e.point2.coords.usrCoords.slice(1).join(",")+"){"+n+"}{"+r+"}{"+o+"}\n"},parseColor:function(e){var t=JXG.rgbParser(e);return"{[rgb]{"+t[0]/255+","+t[1]/255+","+t[2]/255+"}}"}},JXG.Server=function(){},JXG.Server.modules=function(){},JXG.Server.runningCalls={},JXG.Server.handleError=function(e){alert("error occured, server says: "+e.message)},JXG.Server.callServer=function(e,t,n,i){var r,o,a,s,l,c,u;i=i||!1,s="";for(u in n)s+="&"+escape(u)+"="+escape(n[u]);c=JXG.toJSON(n);do l=e+Math.floor(4096*Math.random());while(this.runningCalls[l]!==void 0);return this.runningCalls[l]={action:e},n.module!==void 0&&(this.runningCalls[l].module=n.module),r=JXG.serverBase+"JXGServer.py",o="action="+escape(e)+"&id="+l+"&dataJSON="+escape(JXG.Util.Base64.encode(c)),this.cbp=function(e){var n,i,r,o,a,s,l,c;if(n=new JXG.Util.Unzip(JXG.Util.Base64.decodeAsArray(e)).unzip(),JXG.isArray(n)&&n.length>0&&(n=n[0][0]),"string"==typeof n)if(i=window.JSON&&window.JSON.parse?window.JSON.parse(n):Function("return "+n)(),"error"==i.type)this.handleError(i);else if("response"==i.type){for(s=i.id,l=0;i.fields.length>l;l++)r=i.fields[l],o=r.namespace+("object"==typeof Function("return "+r.namespace)()?".":".prototype.")+r.name+" = "+r.value,Function(o)();for(l=0;i.handler.length>l;l++){for(r=i.handler[l],a=[],c=0;r.parameters.length>c;c++)a[c]='"'+r.parameters[c]+'": '+r.parameters[c];o="if(typeof JXG.Server.modules."+this.runningCalls[s].module+' == "undefined")JXG.Server.modules.'+this.runningCalls[s].module+" = {};",o+="JXG.Server.modules."+this.runningCalls[s].module+"."+r.name+"_cb = "+r.callback+";",o+="JXG.Server.modules."+this.runningCalls[s].module+"."+r.name+" = function ("+r.parameters.join(",")+', __JXGSERVER_CB__, __JXGSERVER_SYNC) {if(typeof __JXGSERVER_CB__ == "undefined") __JXGSERVER_CB__ = JXG.Server.modules.'+this.runningCalls[s].module+"."+r.name+"_cb;var __JXGSERVER_PAR__ = {"+a.join(",")+', "module": "'+this.runningCalls[s].module+'", "handler": "'+r.name+'" };JXG.Server.callServer("exec", __JXGSERVER_CB__, __JXGSERVER_PAR__, __JXGSERVER_SYNC);};',Function(o)()}delete this.runningCalls[s],t(i.data)}},this.cb=JXG.bind(this.cbp,this),window.XMLHttpRequest?(a=new XMLHttpRequest,a.overrideMimeType("text/plain; charset=iso-8859-1")):a=new ActiveXObject("Microsoft.XMLHTTP"),a?(a.open("POST",r,!i),a.setRequestHeader("Content-type","application/x-www-form-urlencoded"),i||(a.onreadystatechange=function(e){return function(){switch(a.readyState){case 4:200!=a.status||e(a.responseText);break;default:return!1}}}(this.cb)),a.send(o),i&&this.cb(a.responseText),void 0):!1},JXG.Server.loadModule_cb=function(e){var t;for(t=0;e.length>t;t++)alert(e[t].name+": "+e[t].value)},JXG.Server.loadModule=function(e){return JXG.Server.callServer("load",JXG.Server.loadModule_cb,{module:e},!0)},JXG.Server.load=JXG.Server.loadModule,JXG.DataSource=function(){return this.data=[],this.columnHeaders=[],this.rowHeaders=[],this},JXG.extend(JXG.DataSource.prototype,{loadFromArray:function(e,t,n){var i,r,o;if(t===void 0&&(t=!1),n===void 0&&(n=!1),JXG.isArray(t)&&(this.columnHeaders=t,t=!1),JXG.isArray(n)&&(this.rowHeaders=n,n=!1),this.data=[],t&&(this.columnHeaders=[]),n&&(this.rowHeaders=[]),e!==void 0){for(this.data=Array(e.length),i=0;e.length>i;i++)for(this.data[i]=Array(e[i].length),r=0;e[i].length>r;r++)o=e[i][r],this.data[i][r]=""+parseFloat(o)==o?parseFloat(o):"-"!=o?o:0/0;if(t&&(this.columnHeaders=this.data[0].slice(1),this.data=this.data.slice(1)),n)for(this.rowHeaders=[],i=0;this.data.length>i;i++)this.rowHeaders.push(this.data[i][0]),this.data[i]=this.data[i].slice(1)}return this},loadFromTable:function(e,t,n){var i,r,o,a,s;if(t===void 0&&(t=!1),n===void 0&&(n=!1),JXG.isArray(t)&&(this.columnHeaders=t,t=!1),JXG.isArray(n)&&(this.rowHeaders=n,n=!1),this.data=[],t&&(this.columnHeaders=[]),n&&(this.rowHeaders=[]),e=document.getElementById(e),e!==void 0){for(i=e.getElementsByTagName("tr"),this.data=Array(i.length),r=0;i.length>r;r++)for(a=i[r].getElementsByTagName("td"),this.data[r]=Array(a.length),o=0;a.length>o;o++)s=a[o].innerHTML,this.data[r][o]=""+parseFloat(s)==s?parseFloat(s):"-"!=s?s:0/0;if(t&&(this.columnHeaders=this.data[0].slice(1),this.data=this.data.slice(1)),n)for(this.rowHeaders=[],r=0;this.data.length>r;r++)this.rowHeaders.push(this.data[r][0]),this.data[r]=this.data[r].slice(1)}return this},addColumn:function(){},addRow:function(){},getColumn:function(e){var t,n=Array(this.data.length);if("string"==typeof e)for(t=0;this.columnHeaders.length>t;t++)if(e==this.columnHeaders[t]){e=t;break}for(t=0;this.data.length>t;t++)this.data[t].length>e&&(n[t]=parseFloat(this.data[t][e]));return n},getRow:function(e){var t,n;if("string"==typeof e)for(n=0;this.rowHeaders.length>n;n++)if(e==this.rowHeaders[n]){e=n;break}for(t=Array(this.data[e].length),n=0;this.data[e].length>n;n++)t[n]=this.data[e][n];return t}}),JXG.Board.prototype.construct=function(e,t,n,i,r){var o,a,s,l,c,u,d,h,p,f,g,m,v,b,y,x,w,k,C,_,T={};if(JXG.exists(t)?b=[]:t="normal",T.lines=[],T.circles=[],T.points=[],T.intersections=[],T.angles=[],T.macros=[],T.functions=[],T.texts=[],T.polygons=[],-1!=e.search(/\{/))for(p=e.match(/\{/),p=p.length,m=0,s=0;p>s;s++)g=e.slice(m).search(/\{/),x=e.slice(g),x=x.slice(0,x.search(/\}/)+1),x=x.replace(/;/g,"?"),e=e.slice(0,g)+x+e.slice(g+x.length),m=g+1;for(o=e.split(";"),a=0;o.length>a;a++)if(o[a]=o[a].replace(/^\s+/,"").replace(/\s+$/,""),-1!=o[a].search(/\{/)&&(o[a]=o[a].replace(/\?/g,";")),-1!=o[a].search(/Macro/))this.addMacro(o[a]);else if(o[a].length>0){if(w=!1,-1!=o[a].search(/=/)&&(l=o[a].split("="),C=l[1],C=C.replace(/^\s+/,"").replace(/\s+$/,""),-1!=l[0].search(/\./))){if(w=!0,l=l[0].split("."),k=l[l.length-1],k=k.replace(/^\s+/,"").replace(/\s+$/,""),l.pop(),l=l.join("."),"macro"==t)for(s=0;n.length>s;s++)l==n[s]&&(l=i[s]);JXG.getReference(this,l).setProperty(k+":"+C)}if(!w){for(-1!=o[a].search(/=/)?(l=o[a].split("="),o[a]=l[1].replace(/^\s+/,""),l=l[0].replace(/\s+$/,"")):l="",_={},y=!0;y;)-1!=o[a].search(/(.*)draft$/)&&(_.draft=!0,o[a]=RegExp.$1,o[a]=o[a].replace(/\s+$/,"")),-1!=o[a].search(/(.*)invisible$/)&&(_.visible=!1,o[a]=RegExp.$1,o[a]=o[a].replace(/\s+$/,"")),-1!=o[a].search(/(.*)nolabel$/)&&(_.withLabel=!1,o[a]=RegExp.$1,o[a]=o[a].replace(/\s+$/,"")),-1==o[a].search(/nolabel|invisible|draft/)&&(y=!1);if(f=!0,this.definedMacros)for(s=0;this.definedMacros.macros.length>s;s++)if(v=RegExp("^"+this.definedMacros.macros[s][0]+"\\s*\\("),-1!=o[a].search(v)){for(f=!1,o[a].match(/\((.*)\)/),p=RegExp.$1,p=p.split(","),g=0;p.length>g;g++)p[g].match(/\s*(\S*)\s*/),p[g]=RegExp.$1;T[l]=this.construct(this.definedMacros.macros[s][2],"macro",this.definedMacros.macros[s][1],p,l),T.macros.push(T[l]);break}if(f)if(-1!=o[a].search(/^[\[\]].*[\[\]]$/)){if(o[a].match(/([\[\]])(.*)([\[\]])/),_.straightFirst="["!=RegExp.$1,_.straightLast="["==RegExp.$3,c=RegExp.$2.replace(/^\s+/,"").replace(/\s+$/,""),-1!=c.search(/ /)&&(c.match(/(\S*) +(\S*)/),c=[],c[0]=RegExp.$1,c[1]=RegExp.$2),""!=l&&(JXG.exists(_.withLabel)||(_.withLabel=!0),_.name=l,"macro"==t&&b.push(l)),"macro"==t){if(""!=r)for(s=0;b.length>s;s++)c[0]==b[s]&&(c[0]=r+"."+c[0]),c[1]==b[s]&&(c[1]=r+"."+c[1]);for(s=0;n.length>s;s++)c[0]==n[s]&&(c=[i[s],c[1]]),c[1]==n[s]&&(c=[c[0],i[s]]);""!=r&&(_.id=r+"."+l)}c="string"==typeof c?[JXG.getReference(this,c.charAt(0)),JXG.getReference(this,c.charAt(1))]:[JXG.getReference(this,c[0]),JXG.getReference(this,c[1])],T.lines.push(this.create("line",c,_)),""!=l&&(T[l]=T.lines[T.lines.length-1])}else if(-1!=o[a].search(/k\s*\(.*/)){for(o[a].match(/k\s*\(\s*(\S.*\S|\S)\s*,\s*(\S.*\S|\S)\s*\)/),c=[],c[0]=RegExp.$1,c[1]=RegExp.$2,s=0;1>=s;s++)if(-1!=c[s].search(/[\[\]]/)){if(c[s].match(/^[\[\]]\s*(\S.*\S)\s*[\[\]]$/),c[s]=RegExp.$1,-1!=c[s].search(/ /)&&(c[s].match(/(\S*) +(\S*)/),c[s]=[],c[s][0]=RegExp.$1,c[s][1]=RegExp.$2),"macro"==t){if(""!=r)for(g=0;b.length>g;g++)c[s][0]==b[g]&&(c[s][0]=r+"."+c[s][0]),c[s][1]==b[g]&&(c[s][1]=r+"."+c[s][1]);for(g=0;n.length>g;g++)c[s][0]==n[g]&&(c[s]=[i[g],c[s][1]]),c[s][1]==n[g]&&(c[s]=[c[s][0],i[g]])}c[s]="string"==typeof c[s]?function(e,t){return function(){return JXG.getReference(t,e.charAt(0)).Dist(JXG.getReference(t,e.charAt(1)))}}(c[s],this):function(e,t){return function(){return JXG.getReference(t,e[0]).Dist(JXG.getReference(t,e[1]))}}(c[s],this)}else if(-1!=c[s].search(/[0-9\.\s]+/))c[s]=1*c[s];else{if("macro"==t){if(""!=r)for(g=0;b.length>g;g++)c[s]==b[g]&&(c[s]=r+"."+b[g]);for(g=0;n.length>g;g++)c[s]==n[g]&&(c[s]=i[g])}c[s]=JXG.getReference(this,c[s])}""!=l&&(JXG.exists(_.withLabel)||(_.withLabel=!0),_.name=l,"macro"==t&&(""!=r&&(_.id=r+"."+l),b.push(l))),T.circles.push(this.create("circle",c,_)),""!=l&&(T[l]=T.circles[T.circles.length-1])}else if(-1!=o[a].search(/^[A-Z]+.*\(\s*[0-9\.\-]+\s*[,\|]\s*[0-9\.\-]+\s*\)/)&&-1==o[a].search(/Macro\((.*)\)/))o[a].match(/^([A-Z]+\S*)\s*\(\s*(.*)\s*[,\|]\s*(.*)\s*\)$/),l=RegExp.$1,_.name=l,"macro"==t&&(""!=r&&(_.id=r+"."+l),b.push(l)),T.points.push(this.create("point",[1*RegExp.$2,1*RegExp.$3],_)),T[l]=T.points[T.points.length-1];else if(-1!=o[a].search(/^[A-Z]+.*\(.+(([,\|]\s*[0-9\.\-]+\s*){2})?/)&&-1==o[a].search(/Macro\((.*)\)/)){if(o[a].match(/([A-Z]+.*)\((.*)\)/),l=RegExp.$1,c=RegExp.$2,l=l.replace(/^\s+/,"").replace(/\s+$/,""),c=c.replace(/^\s+/,"").replace(/\s+$/,""),-1!=c.search(/[,\|]/)?(c.match(/(\S*)\s*[,\|]\s*([0-9\.]+)\s*[,\|]\s*([0-9\.]+)\s*/),c=[],c[0]=RegExp.$1,c[1]=1*RegExp.$2,c[2]=1*RegExp.$3):(u=c,c=[],c[0]=u,c[1]=0,c[2]=0),_.name=l,"macro"==t){if(""!=r)for(g=0;b.length>g;g++)c[0]==b[g]&&(c[0]=r+"."+b[g]);for(g=0;n.length>g;g++)c[0]==n[g]&&(c[0]=i[g]);""!=r&&(_.id=r+"."+l),b.push(l)}T.points.push(this.create("glider",[c[1],c[2],JXG.getReference(this,c[0])],_)),T[l]=T.points[T.points.length-1]}else if(-1!=o[a].search(/&/)){if(o[a].match(/(.*)&(.*)/),c=[],c[0]=RegExp.$1,c[1]=RegExp.$2,c[0]=c[0].replace(/\s+$/,""),c[1]=c[1].replace(/^\s+/,""),"macro"==t)for(s=0;1>=s;s++){if(""!=r)for(g=0;b.length>g;g++)c[s]==b[g]&&(c[s]=r+"."+b[g]);for(g=0;n.length>g;g++)c[s]==n[g]&&(c[s]=i[g])}c[0]=JXG.getReference(this,c[0]),c[1]=JXG.getReference(this,c[1]),c[0].elementClass!=JXG.OBJECT_CLASS_LINE&&c[0].elementClass!=JXG.OBJECT_CLASS_CURVE||c[1].elementClass!=JXG.OBJECT_CLASS_LINE&&c[1].elementClass!=JXG.OBJECT_CLASS_CURVE?(""!=l&&(_.name=l+"_1","macro"==t&&(""!=r&&(_.id=r+"."+l+"_1"),b.push(l+"_1"))),u=this.create("intersection",[c[0],c[1],0],_),T.intersections.push(u),""!=l&&(T[_.name]=u),""!=l&&(_.name=l+"_2","macro"==t&&(""!=r&&(_.id=r+"."+l+"_2"),b.push(l+"_2"))),u=this.create("intersection",[c[0],c[1],1],_),T.intersections.push(u),""!=l&&(T[_.name]=u)):(""!=l&&(_.name=l,"macro"==t&&(""!=r&&(_.id=r+"."+l),b.push(l))),u=this.create("intersection",[c[0],c[1],0],_),T.intersections.push(u),""!=l&&(T[_.name]=u))}else if(-1!=o[a].search(/\|[\|_]\s*\(/)){if(o[a].match(/\|([\|_])\s*\(\s*(\S*)\s*,\s*(\S*)\s*\)/),d=RegExp.$1,d="|"==d?"parallel":"normal",c=[],c[0]=RegExp.$2,c[1]=RegExp.$3,"macro"==t)for(s=0;1>=s;s++){if(""!=r)for(g=0;b.length>g;g++)c[s]==b[g]&&(c[s]=r+"."+b[g]); for(g=0;n.length>g;g++)c[s]==n[g]&&(c[s]=i[g])}""!=l&&(_.name=l,JXG.exists(_.withLabel)||(_.withLabel=!0),"macro"==t&&(""!=r&&(_.id=r+"."+l),b.push(l))),T.lines.push(this.create(d,[JXG.getReference(this,c[0]),JXG.getReference(this,c[1])],_)),""!=l&&(T[l]=T.lines[T.lines.length-1])}else if(-1!=o[a].search(/^</)){if(o[a].match(/<\s*\(\s*(\S*)\s*,\s*(\S*)\s*,\s*(\S*)\s*\)/),c=[],c[0]=RegExp.$1,c[1]=RegExp.$2,c[2]=RegExp.$3,"macro"==t)for(s=0;2>=s;s++){if(""!=r)for(g=0;b.length>g;g++)c[s]==b[g]&&(c[s]=r+"."+b[g]);for(g=0;n.length>g;g++)c[s]==n[g]&&(c[s]=i[g])}if(""==l)T.lines.push(this.create("angle",[JXG.getReference(this,c[0]),JXG.getReference(this,c[1]),JXG.getReference(this,c[2])],_));else{for(h=["alpha","beta","gamma","delta","epsilon","zeta","eta","theta","iota","kappa","lambda","mu","nu","xi","omicron","pi","rho","sigmaf","sigma","tau","upsilon","phi","chi","psi","omega"],d="",s=0;h.length>s;s++){if(l==h[s]){_.text="&"+l+";",_.name="&"+l+";",d="greek";break}s==h.length-1&&(_.text=l,_.name=l)}JXG.exists(_.withLabel)||(_.withLabel=!0),"macro"==t&&(""!=r&&(_.id=r+"."+l),b.push(l)),T.angles.push(this.create("angle",[JXG.getReference(this,c[0]),JXG.getReference(this,c[1]),JXG.getReference(this,c[2])],_)),T[l]=T.angles[T.angles.length-1]}}else if(-1!=o[a].search(/([0-9]+)\/([0-9]+)\(\s*(\S*)\s*,\s*(\S*)\s*\)/)){if(c=[],c[0]=1*RegExp.$1/(1*RegExp.$2),c[1]=RegExp.$3,c[2]=RegExp.$4,"macro"==t)for(s=1;2>=s;s++){if(""!=r)for(g=0;b.length>g;g++)c[s]==b[g]&&(c[s]=r+"."+b[g]);for(g=0;n.length>g;g++)c[s]==n[g]&&(c[s]=i[g])}c[1]=JXG.getReference(this,RegExp.$3),c[2]=JXG.getReference(this,RegExp.$4),u=[],u[0]=function(e){return function(){return(1-e[0])*e[1].coords.usrCoords[1]+e[0]*e[2].coords.usrCoords[1]}}(c,this),u[1]=function(e){return function(){return(1-e[0])*e[1].coords.usrCoords[2]+e[0]*e[2].coords.usrCoords[2]}}(c,this),""!=l&&(_.name=l,"macro"==t&&(""!=r&&(_.id=r+"."+l),b.push(l))),T.points.push(this.create("point",[u[0],u[1]],_)),""!=l&&(T[l]=T.points[T.points.length-1])}else if(-1!=o[a].search(/(\S*)\s*:\s*(.*)/))l=RegExp.$1,p=JXG.GeonextParser.geonext2JS(RegExp.$2,this),c=[Function("x","var y = "+p+"; return y;")],_.name=l,T.functions.push(this.create("functiongraph",c,_)),T[l]=T.functions[T.functions.length-1];else if(-1!=o[a].search(/#(.*)\(\s*([0-9])\s*[,|]\s*([0-9])\s*\)/))c=[],c[0]=RegExp.$1,c[1]=1*RegExp.$2,c[2]=1*RegExp.$3,c[0]=c[0].replace(/^\s+/,"").replace(/\s+$/,""),T.texts.push(this.create("text",[c[1],c[2],c[0]],_));else if(-1!=o[a].search(/(\S*)\s*\[(.*)\]/)){for(_.name=RegExp.$1,JXG.exists(_.withLabel)||(_.withLabel=!0),c=RegExp.$2,c=c.split(","),s=0;c.length>s;s++){if(c[s]=c[s].replace(/^\s+/,"").replace(/\s+$/,""),"macro"==t){if(""!=r)for(g=0;b.length>g;g++)c[s]==b[g]&&(c[s]=r+"."+b[g]);for(g=0;n.length>g;g++)c[s]==n[g]&&(c[s]=i[g])}c[s]=JXG.getReference(this,c[s])}T.polygons.push(this.create("polygon",c,_)),T[_.name]=T.polygons[T.polygons.length-1]}}}return this.update(),T},JXG.Board.prototype.addMacro=function(e){var t,n,i,r="";for(e.match(/(.*)\{(.*)\}/),t=RegExp.$1,n=RegExp.$2,-1!=t.search(/=/)&&(t.match(/\s*(\S*)\s*=.*/),r=RegExp.$1,t=t.split("=")[1]),t.match(/Macro\((.*)\)/),t=RegExp.$1,t=t.split(","),i=0;t.length>i;i++)t[i].match(/\s*(\S*)\s*/),t[i]=RegExp.$1;null==this.definedMacros&&(this.definedMacros={},this.definedMacros.macros=[]),this.definedMacros.macros.push([r,t,n]),""!=r&&(this.definedMacros.defName=this.definedMacros.macros[this.definedMacros.macros.length-1])},JXG.SVGRenderer=function(e){var t;for(this.type="svg",this.svgRoot=null,this.svgNamespace="http://www.w3.org/2000/svg",this.xlinkNamespace="http://www.w3.org/1999/xlink",this.container=e,this.container.style.MozUserSelect="none",this.container.style.overflow="hidden",""===this.container.style.position&&(this.container.style.position="relative"),this.svgRoot=this.container.ownerDocument.createElementNS(this.svgNamespace,"svg"),this.svgRoot.style.overflow="hidden",this.svgRoot.style.width=this.container.style.width,this.svgRoot.style.height=this.container.style.height,this.container.appendChild(this.svgRoot),this.defs=this.container.ownerDocument.createElementNS(this.svgNamespace,"defs"),this.svgRoot.appendChild(this.defs),this.filter=this.container.ownerDocument.createElementNS(this.svgNamespace,"filter"),this.filter.setAttributeNS(null,"id",this.container.id+"_f1"),this.filter.setAttributeNS(null,"width","300%"),this.filter.setAttributeNS(null,"height","300%"),this.filter.setAttributeNS(null,"filterUnits","userSpaceOnUse"),this.feOffset=this.container.ownerDocument.createElementNS(this.svgNamespace,"feOffset"),this.feOffset.setAttributeNS(null,"result","offOut"),this.feOffset.setAttributeNS(null,"in","SourceAlpha"),this.feOffset.setAttributeNS(null,"dx","5"),this.feOffset.setAttributeNS(null,"dy","5"),this.filter.appendChild(this.feOffset),this.feGaussianBlur=this.container.ownerDocument.createElementNS(this.svgNamespace,"feGaussianBlur"),this.feGaussianBlur.setAttributeNS(null,"result","blurOut"),this.feGaussianBlur.setAttributeNS(null,"in","offOut"),this.feGaussianBlur.setAttributeNS(null,"stdDeviation","3"),this.filter.appendChild(this.feGaussianBlur),this.feBlend=this.container.ownerDocument.createElementNS(this.svgNamespace,"feBlend"),this.feBlend.setAttributeNS(null,"in","SourceGraphic"),this.feBlend.setAttributeNS(null,"in2","blurOut"),this.feBlend.setAttributeNS(null,"mode","normal"),this.filter.appendChild(this.feBlend),this.defs.appendChild(this.filter),this.layer=[],t=0;JXG.Options.layer.numlayers>t;t++)this.layer[t]=this.container.ownerDocument.createElementNS(this.svgNamespace,"g"),this.svgRoot.appendChild(this.layer[t]);this.dashArray=["2, 2","5, 5","10, 10","20, 20","20, 10, 10, 10","20, 5, 10, 5"]},JXG.SVGRenderer.prototype=new JXG.AbstractRenderer,JXG.extend(JXG.SVGRenderer.prototype,{_createArrowHead:function(e,t){var n,i,r=e.id+"Triangle";return JXG.exists(t)&&(r+=t),n=this.createPrim("marker",r),n.setAttributeNS(null,"viewBox","0 0 10 6"),n.setAttributeNS(null,"refY","3"),n.setAttributeNS(null,"markerUnits","userSpaceOnUse"),n.setAttributeNS(null,"markerHeight","12"),n.setAttributeNS(null,"markerWidth","10"),n.setAttributeNS(null,"orient","auto"),n.setAttributeNS(null,"stroke",e.visProp.strokecolor),n.setAttributeNS(null,"stroke-opacity",e.visProp.strokeopacity),n.setAttributeNS(null,"fill",e.visProp.strokecolor),n.setAttributeNS(null,"fill-opacity",e.visProp.strokeopacity),i=this.container.ownerDocument.createElementNS(this.svgNamespace,"path"),"End"===t?(n.setAttributeNS(null,"refX","0"),i.setAttributeNS(null,"d","M 0 3 L 10 6 L 10 0 z")):(n.setAttributeNS(null,"refX","10"),i.setAttributeNS(null,"d","M 0 0 L 10 3 L 0 6 z")),n.appendChild(i),n},_setArrowAtts:function(e,t,n){e&&(e.setAttributeNS(null,"stroke",t),e.setAttributeNS(null,"stroke-opacity",n),e.setAttributeNS(null,"fill",t),e.setAttributeNS(null,"fill-opacity",n))},updateTicks:function(e,t,n,i,r){var o,a,s,l="",c=e.ticks.length;for(o=0;c>o;o++)a=e.ticks[o].scrCoords,e.ticks[o].major?((e.board.needsFullUpdate||e.needsRegularUpdate)&&e.labels[o]&&e.labels[o].visProp.visible&&this.updateText(e.labels[o]),l+="M "+(a[1]+t)+" "+(a[2]-n)+" L "+(a[1]-t)+" "+(a[2]+n)+" "):l+="M "+(a[1]+i)+" "+(a[2]-r)+" L "+(a[1]-i)+" "+(a[2]+r)+" ";s=this.getElementById(e.id),JXG.exists(s)||(s=this.createPrim("path",e.id),this.appendChildPrim(s,e.visProp.layer),this.appendNodesToElement(e,"path")),s.setAttributeNS(null,"stroke",e.visProp.strokecolor),s.setAttributeNS(null,"stroke-opacity",e.visProp.strokeopacity),s.setAttributeNS(null,"stroke-width",e.visProp.strokewidth),this.updatePathPrim(s,l,e.board)},displayCopyright:function(e,t){var n,i=this.createPrim("text","licenseText");i.setAttributeNS(null,"x","20px"),i.setAttributeNS(null,"y",2+t+"px"),i.setAttributeNS(null,"style","font-family:Arial,Helvetica,sans-serif; font-size:"+t+"px; fill:#356AA0; opacity:0.3;"),n=document.createTextNode(e),i.appendChild(n),this.appendChildPrim(i,0)},drawInternalText:function(e){var t=this.createPrim("text",e.id);return t.setAttributeNS(null,"class","JXGtext"),e.rendNodeText=document.createTextNode(""),t.appendChild(e.rendNodeText),this.appendChildPrim(t,9),t},updateInternalText:function(e){var t=e.plaintext;isNaN(e.coords.scrCoords[1]+e.coords.scrCoords[2])||(e.rendNode.setAttributeNS(null,"x",e.coords.scrCoords[1]+"px"),e.rendNode.setAttributeNS(null,"y",e.coords.scrCoords[2]+.5*this.vOffsetText+"px")),e.htmlStr!==t&&(e.rendNodeText.data=t,e.htmlStr=t),this.transformImage(e,e.transformations)},drawImage:function(e){var t=this.createPrim("image",e.id);t.setAttributeNS(null,"preserveAspectRatio","none"),this.appendChildPrim(t,e.visProp.layer),e.rendNode=t,this.updateImage(e)},transformImage:function(e,t){var n,i,r=e.rendNode,o="",a=t.length;a>0&&(n=this.joinTransforms(e,t),i=[n[1][1],n[2][1],n[1][2],n[2][2],n[1][0],n[2][0]].join(","),o+=" matrix("+i+") ",r.setAttributeNS(null,"transform",o))},updateImageURL:function(e){var t=JXG.evaluate(e.url);e.rendNode.setAttributeNS(this.xlinkNamespace,"xlink:href",t)},appendChildPrim:function(e,t){JXG.exists(t)?t>=JXG.Options.layer.numlayers&&(t=JXG.Options.layer.numlayers-1):t=0,this.layer[t].appendChild(e)},appendNodesToElement:function(e){e.rendNode=this.getElementById(e.id)},createPrim:function(e,t){var n=this.container.ownerDocument.createElementNS(this.svgNamespace,e);return n.setAttributeNS(null,"id",this.container.id+"_"+t),n.style.position="absolute","path"===e&&(n.setAttributeNS(null,"stroke-linecap","butt"),n.setAttributeNS(null,"stroke-linejoin","round")),n},remove:function(e){JXG.exists(e)&&JXG.exists(e.parentNode)&&e.parentNode.removeChild(e)},makeArrows:function(e){var t;(e.visPropOld.firstarrow!==e.visProp.firstarrow||e.visPropOld.lastarrow!==e.visProp.lastarrow)&&(e.visProp.firstarrow?(t=e.rendNodeTriangleStart,JXG.exists(t)||(t=this._createArrowHead(e,"End"),this.defs.appendChild(t),e.rendNodeTriangleStart=t,e.rendNode.setAttributeNS(null,"marker-start","url(#"+this.container.id+"_"+e.id+"TriangleEnd)"))):(t=e.rendNodeTriangleStart,JXG.exists(t)&&this.remove(t)),e.visProp.lastarrow?(t=e.rendNodeTriangleEnd,JXG.exists(t)||(t=this._createArrowHead(e,"Start"),this.defs.appendChild(t),e.rendNodeTriangleEnd=t,e.rendNode.setAttributeNS(null,"marker-end","url(#"+this.container.id+"_"+e.id+"TriangleStart)"))):(t=e.rendNodeTriangleEnd,JXG.exists(t)&&this.remove(t)),e.visPropOld.firstarrow=e.visProp.firstarrow,e.visPropOld.lastarrow=e.visProp.lastarrow)},updateEllipsePrim:function(e,t,n,i,r){e.setAttributeNS(null,"cx",t),e.setAttributeNS(null,"cy",n),e.setAttributeNS(null,"rx",i),e.setAttributeNS(null,"ry",r)},updateLinePrim:function(e,t,n,i,r){isNaN(t+n+i+r)||(e.setAttributeNS(null,"x1",t),e.setAttributeNS(null,"y1",n),e.setAttributeNS(null,"x2",i),e.setAttributeNS(null,"y2",r))},updatePathPrim:function(e,t){""==t&&(t="M 0 0"),e.setAttributeNS(null,"d",t)},updatePathStringPoint:function(e,t,n){var i="",r=e.coords.scrCoords,o=.5*t*Math.sqrt(3),a=.5*t;return"x"===n?i=" M "+(r[1]-t)+" "+(r[2]-t)+" L "+(r[1]+t)+" "+(r[2]+t)+" M "+(r[1]+t)+" "+(r[2]-t)+" L "+(r[1]-t)+" "+(r[2]+t):"+"===n?i=" M "+(r[1]-t)+" "+r[2]+" L "+(r[1]+t)+" "+r[2]+" M "+r[1]+" "+(r[2]-t)+" L "+r[1]+" "+(r[2]+t):"<>"===n?i=" M "+(r[1]-t)+" "+r[2]+" L "+r[1]+" "+(r[2]+t)+" L "+(r[1]+t)+" "+r[2]+" L "+r[1]+" "+(r[2]-t)+" Z ":"^"===n?i=" M "+r[1]+" "+(r[2]-t)+" L "+(r[1]-o)+" "+(r[2]+a)+" L "+(r[1]+o)+" "+(r[2]+a)+" Z ":"v"===n?i=" M "+r[1]+" "+(r[2]+t)+" L "+(r[1]-o)+" "+(r[2]-a)+" L "+(r[1]+o)+" "+(r[2]-a)+" Z ":">"===n?i=" M "+(r[1]+t)+" "+r[2]+" L "+(r[1]-a)+" "+(r[2]-o)+" L "+(r[1]-a)+" "+(r[2]+o)+" Z ":"<"===n&&(i=" M "+(r[1]-t)+" "+r[2]+" L "+(r[1]+a)+" "+(r[2]-o)+" L "+(r[1]+a)+" "+(r[2]+o)+" Z "),i},updatePathStringPrim:function(e){var t,n,i,r=" M ",o=" L ",a=r,s=5e3,l="",c="plot"!==e.visProp.curvetype;if(0>=e.numberPoints)return"";for(c&&e.board.options.curve.RDPsmoothing&&(e.points=JXG.Math.Numerics.RamerDouglasPeuker(e.points,.5)),i=Math.min(e.points.length,e.numberPoints),t=0;i>t;t++)n=e.points[t].scrCoords,isNaN(n[1])||isNaN(n[2])?a=r:(n[1]>s?n[1]=s:-s>n[1]&&(n[1]=-s),n[2]>s?n[2]=s:-s>n[2]&&(n[2]=-s),l+=[a,n[1]," ",n[2]].join(""),a=o);return l},updatePolygonPrim:function(e,t){var n,i,r="",o=t.vertices.length;for(e.setAttributeNS(null,"stroke","none"),i=0;o-1>i;i++)n=t.vertices[i].coords.scrCoords,r=r+n[1]+","+n[2],o-2>i&&(r+=" ");-1==r.indexOf("NaN")&&e.setAttributeNS(null,"points",r)},updateRectPrim:function(e,t,n,i,r){e.setAttributeNS(null,"x",t),e.setAttributeNS(null,"y",n),e.setAttributeNS(null,"width",i),e.setAttributeNS(null,"height",r)},setPropertyPrim:function(e,t,n){"stroked"!==t&&e.setAttributeNS(null,t,n)},show:function(e){var t;e&&e.rendNode&&(t=e.rendNode,t.setAttributeNS(null,"display","inline"),t.style.visibility="inherit")},hide:function(e){var t;e&&e.rendNode&&(t=e.rendNode,t.setAttributeNS(null,"display","none"),t.style.visibility="hidden")},setBuffering:function(e,t){e.rendNode.setAttribute("buffered-rendering",t)},setDashStyle:function(e){var t=e.visProp.dash,n=e.rendNode;e.visProp.dash>0?n.setAttributeNS(null,"stroke-dasharray",this.dashArray[t-1]):n.hasAttributeNS(null,"stroke-dasharray")&&n.removeAttributeNS(null,"stroke-dasharray")},setGradient:function(e){var t,n,i,r,o,a,s,l,c,u=e.rendNode;n=JXG.evaluate(e.visProp.fillopacity),n=n>0?n:0,t=JXG.evaluate(e.visProp.fillcolor),"linear"===e.visProp.gradient?(i=this.createPrim("linearGradient",e.id+"_gradient"),a="0%",s="100%",l="0%",c="0%",i.setAttributeNS(null,"x1",a),i.setAttributeNS(null,"x2",s),i.setAttributeNS(null,"y1",l),i.setAttributeNS(null,"y2",c),r=this.createPrim("stop",e.id+"_gradient1"),r.setAttributeNS(null,"offset","0%"),r.setAttributeNS(null,"style","stop-color:"+t+";stop-opacity:"+n),o=this.createPrim("stop",e.id+"_gradient2"),o.setAttributeNS(null,"offset","100%"),o.setAttributeNS(null,"style","stop-color:"+e.visProp.gradientsecondcolor+";stop-opacity:"+e.visProp.gradientsecondopacity),i.appendChild(r),i.appendChild(o),this.defs.appendChild(i),u.setAttributeNS(null,"style","fill:url(#"+this.container.id+"_"+e.id+"_gradient)"),e.gradNode1=r,e.gradNode2=o):"radial"===e.visProp.gradient?(i=this.createPrim("radialGradient",e.id+"_gradient"),i.setAttributeNS(null,"cx","50%"),i.setAttributeNS(null,"cy","50%"),i.setAttributeNS(null,"r","50%"),i.setAttributeNS(null,"fx",100*e.visProp.gradientpositionx+"%"),i.setAttributeNS(null,"fy",100*e.visProp.gradientpositiony+"%"),r=this.createPrim("stop",e.id+"_gradient1"),r.setAttributeNS(null,"offset","0%"),r.setAttributeNS(null,"style","stop-color:"+e.visProp.gradientsecondcolor+";stop-opacity:"+e.visProp.gradientsecondopacity),o=this.createPrim("stop",e.id+"_gradient2"),o.setAttributeNS(null,"offset","100%"),o.setAttributeNS(null,"style","stop-color:"+t+";stop-opacity:"+n),i.appendChild(r),i.appendChild(o),this.defs.appendChild(i),u.setAttributeNS(null,"style","fill:url(#"+this.container.id+"_"+e.id+"_gradient)"),e.gradNode1=r,e.gradNode2=o):u.removeAttributeNS(null,"style")},updateGradient:function(e){var t,n,i=e.gradNode1,r=e.gradNode2;JXG.exists(i)&&JXG.exists(r)&&(n=JXG.evaluate(e.visProp.fillopacity),n=n>0?n:0,t=JXG.evaluate(e.visProp.fillcolor),"linear"===e.visProp.gradient?(i.setAttributeNS(null,"style","stop-color:"+t+";stop-opacity:"+n),r.setAttributeNS(null,"style","stop-color:"+e.visProp.gradientsecondcolor+";stop-opacity:"+e.visProp.gradientsecondopacity)):"radial"===e.visProp.gradient&&(i.setAttributeNS(null,"style","stop-color:"+e.visProp.gradientsecondcolor+";stop-opacity:"+e.visProp.gradientsecondopacity),r.setAttributeNS(null,"style","stop-color:"+t+";stop-opacity:"+n)))},setObjectFillColor:function(e,t,n){var i,r,o,a,s=JXG.evaluate(t),l=JXG.evaluate(n);l=l>0?l:0,(e.visPropOld.fillcolor!==s||e.visPropOld.fillopacity!==l)&&(s!==!1&&(9!=s.length?(r=s,a=l):(o=JXG.rgba2rgbo(s),r=o[0],a=l*o[1]),i=e.rendNode,i.setAttributeNS(null,"fill",r),e.type===JXG.OBJECT_TYPE_IMAGE?i.setAttributeNS(null,"opacity",a):i.setAttributeNS(null,"fill-opacity",a),JXG.exists(e.visProp.gradient)&&this.updateGradient(e)),e.visPropOld.fillcolor=s,e.visPropOld.fillopacity=l)},setObjectStrokeColor:function(e,t,n){var i,r,o,a,s=JXG.evaluate(t),l=JXG.evaluate(n);l=l>0?l:0,(e.visPropOld.strokecolor!==s||e.visPropOld.strokeopacity!==l)&&(s!==!1&&(9!=s.length?(i=s,o=l):(r=JXG.rgba2rgbo(s),i=r[0],o=l*r[1]),a=e.rendNode,e.type===JXG.OBJECT_TYPE_TEXT?("html"===e.visProp.display?a.style.color=i:a.setAttributeNS(null,"style","fill:"+i),a.style.opacity=o):(a.setAttributeNS(null,"stroke",i),a.setAttributeNS(null,"stroke-opacity",o)),e.type===JXG.OBJECT_TYPE_ARROW?this._setArrowAtts(e.rendNodeTriangle,i,o):(e.elementClass===JXG.OBJECT_CLASS_CURVE||e.elementClass===JXG.OBJECT_CLASS_LINE)&&(e.visProp.firstarrow&&this._setArrowAtts(e.rendNodeTriangleStart,i,o),e.visProp.lastarrow&&this._setArrowAtts(e.rendNodeTriangleEnd,i,o))),e.visPropOld.strokecolor=s,e.visPropOld.strokeopacity=l)},setObjectStrokeWidth:function(e,t){var n,i=JXG.evaluate(t);e.visPropOld.strokewidth!==i&&(n=e.rendNode,this.setPropertyPrim(n,"stroked","true"),JXG.exists(i)&&this.setPropertyPrim(n,"stroke-width",i+"px"),e.visPropOld.strokewidth=i)},setShadow:function(e){e.visPropOld.shadow!==e.visProp.shadow&&(JXG.exists(e.rendNode)&&(e.visProp.shadow?e.rendNode.setAttributeNS(null,"filter","url(#"+this.container.id+"_f1)"):e.rendNode.removeAttributeNS(null,"filter")),e.visPropOld.shadow=e.visProp.shadow)},suspendRedraw:function(){},unsuspendRedraw:function(){},resize:function(e,t){this.svgRoot.style.width=parseFloat(e)+"px",this.svgRoot.style.height=parseFloat(t)+"px"}}),JXG.VMLRenderer=function(e){this.type="vml",this.container=e,this.container.style.overflow="hidden",this.container.onselectstart=function(){return!1},this.resolution=10,JXG.exists(JXG.vmlStylesheet)||(e.ownerDocument.namespaces.add("jxgvml","urn:schemas-microsoft-com:vml"),JXG.vmlStylesheet=this.container.ownerDocument.createStyleSheet(),JXG.vmlStylesheet.addRule(".jxgvml","behavior:url(#default#VML)"));try{!e.ownerDocument.namespaces.jxgvml&&e.ownerDocument.namespaces.add("jxgvml","urn:schemas-microsoft-com:vml"),this.createNode=function(t){return e.ownerDocument.createElement("<jxgvml:"+t+' class="jxgvml">')}}catch(t){this.createNode=function(t){return e.ownerDocument.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="jxgvml">')}}this.dashArray=["Solid","1 1","ShortDash","Dash","LongDash","ShortDashDot","LongDashDot"]},JXG.VMLRenderer.prototype=new JXG.AbstractRenderer,JXG.extend(JXG.VMLRenderer.prototype,{_setAttr:function(e,t,n,i){try{8===document.documentMode?e[t]=n:e.setAttribute(t,n,i)}catch(r){JXG.debug(e.id+" "+t+" "+n+"<br>\n")}},updateTicks:function(e,t,n,i,r){var o,a,s,l,c=[],u=this.resolution;for(a=e.ticks.length,o=0;a>o;o++)s=e.ticks[o].scrCoords,e.ticks[o].major?((e.board.needsFullUpdate||e.needsRegularUpdate)&&e.labels[o]&&e.labels[o].visProp.visible&&this.updateText(e.labels[o]),c.push(" m "+Math.round(u*(s[1]+t))+", "+Math.round(u*(s[2]-n))+" l "+Math.round(u*(s[1]-t))+", "+Math.round(u*(s[2]+n))+" ")):c.push(" m "+Math.round(u*(s[1]+i))+", "+Math.round(u*(s[2]-r))+" l "+Math.round(u*(s[1]-i))+", "+Math.round(u*(s[2]+r))+" ");JXG.exists(e)||(l=this.createPrim("path",e.id),this.appendChildPrim(l,e.visProp.layer),this.appendNodesToElement(e,"path")),this._setAttr(e.rendNode,"stroked","true"),this._setAttr(e.rendNode,"strokecolor",e.visProp.strokecolor,1),this._setAttr(e.rendNode,"strokeweight",e.visProp.strokewidth),this._setAttr(e.rendNodeStroke,"opacity",100*e.visProp.strokeopacity+"%"),this.updatePathPrim(e.rendNode,c,e.board)},displayCopyright:function(e,t){var n,i;n=this.createNode("textbox"),n.style.position="absolute",this._setAttr(n,"id",this.container.id+"_licenseText"),n.style.left=20,n.style.top=2,n.style.fontSize=t,n.style.color="#356AA0",n.style.fontFamily="Arial,Helvetica,sans-serif",this._setAttr(n,"opacity","30%"),n.style.filter="alpha(opacity = 30)",i=document.createTextNode(e),n.appendChild(i),this.appendChildPrim(n,0)},drawInternalText:function(e){var t;return t=this.createNode("textbox"),t.style.position="absolute",8===document.documentMode?t.setAttribute("class","JXGtext"):t.setAttribute(document.all?"className":"class","JXGtext"),e.rendNodeText=document.createTextNode(""),t.appendChild(e.rendNodeText),this.appendChildPrim(t,9),t},updateInternalText:function(e){var t=e.plaintext;isNaN(e.coords.scrCoords[1]+e.coords.scrCoords[2])||(e.rendNode.style.left=parseInt(e.coords.scrCoords[1])+"px",e.rendNode.style.top=parseInt(e.coords.scrCoords[2]-parseInt(e.visProp.fontsize)+this.vOffsetText)+"px"),e.htmlStr!==t&&(e.rendNodeText.data=t,e.htmlStr=t),this.transformImage(e,e.transformations)},drawImage:function(e){var t;t=this.container.ownerDocument.createElement("img"),t.style.position="absolute",this._setAttr(t,"id",this.container.id+"_"+e.id),this.container.appendChild(t),this.appendChildPrim(t,e.visProp.layer),t.style.filter=t.style["-ms-filter"]="progid:DXImageTransform.Microsoft.Matrix(M11='1.0', sizingMethod='auto expand')",e.rendNode=t,this.updateImage(e)},transformImage:function(e,t){var n,i,r,o,a,s,l,c=e.rendNode,u=[],d=t.length;if(e.type===JXG.OBJECT_TYPE_TEXT&&e.updateSize(),d>0){for(l=""+e.rendNode.style.filter,l.match(/DXImageTransform/)||(c.style.filter=c.style["-ms-filter"]="progid:DXImageTransform.Microsoft.Matrix(M11='1.0', sizingMethod='auto expand') "+l),n=this.joinTransforms(e,t),u[0]=JXG.Math.matVecMult(n,e.coords.scrCoords),u[0][1]/=u[0][0],u[0][2]/=u[0][0],u[1]=JXG.Math.matVecMult(n,[1,e.coords.scrCoords[1]+e.size[0],e.coords.scrCoords[2]]),u[1][1]/=u[1][0],u[1][2]/=u[1][0],u[2]=JXG.Math.matVecMult(n,[1,e.coords.scrCoords[1]+e.size[0],e.coords.scrCoords[2]-e.size[1]]),u[2][1]/=u[2][0],u[2][2]/=u[2][0],u[3]=JXG.Math.matVecMult(n,[1,e.coords.scrCoords[1],e.coords.scrCoords[2]-e.size[1]]),u[3][1]/=u[3][0],u[3][2]/=u[3][0],i=u[0][1],o=u[0][1],r=u[0][2],a=u[0][2],s=1;4>s;s++)i=Math.max(i,u[s][1]),o=Math.min(o,u[s][1]),r=Math.max(r,u[s][2]),a=Math.min(a,u[s][2]);c.style.left=parseInt(o)+"px",c.style.top=parseInt(a)+"px",c.filters.item(0).M11=n[1][1],c.filters.item(0).M12=n[1][2],c.filters.item(0).M21=n[2][1],c.filters.item(0).M22=n[2][2]}},updateImageURL:function(e){var t=JXG.evaluate(e.url);this._setAttr(e.rendNode,"src",t)},appendChildPrim:function(e,t){JXG.exists(t)||(t=0),e.style.zIndex=t,this.container.appendChild(e)},appendNodesToElement:function(e,t){("shape"===t||"path"===t||"polygon"===t)&&(e.rendNodePath=this.getElementById(e.id+"_path")),e.rendNodeFill=this.getElementById(e.id+"_fill"),e.rendNodeStroke=this.getElementById(e.id+"_stroke"),e.rendNodeShadow=this.getElementById(e.id+"_shadow"),e.rendNode=this.getElementById(e.id)},createPrim:function(e,t){var n,i,r=this.createNode("fill"),o=this.createNode("stroke"),a=this.createNode("shadow");return this._setAttr(r,"id",this.container.id+"_"+t+"_fill"),this._setAttr(o,"id",this.container.id+"_"+t+"_stroke"),this._setAttr(a,"id",this.container.id+"_"+t+"_shadow"),"circle"===e||"ellipse"===e?(n=this.createNode("oval"),n.appendChild(r),n.appendChild(o),n.appendChild(a)):"polygon"===e||"path"===e||"shape"===e||"line"===e?(n=this.createNode("shape"),n.appendChild(r),n.appendChild(o),n.appendChild(a),i=this.createNode("path"),this._setAttr(i,"id",this.container.id+"_"+t+"_path"),n.appendChild(i)):(n=this.createNode(e),n.appendChild(r),n.appendChild(o),n.appendChild(a)),n.style.position="absolute",n.style.left="0px",n.style.top="0px",this._setAttr(n,"id",this.container.id+"_"+t),n},remove:function(e){JXG.exists(e)&&e.removeNode(!0)},makeArrows:function(e){var t;(e.visPropOld.firstarrow!==e.visProp.firstarrow||e.visPropOld.lastarrow!==e.visProp.lastarrow)&&(e.visProp.firstarrow?(t=e.rendNodeStroke,this._setAttr(t,"startarrow","block"),this._setAttr(t,"startarrowlength","long")):(t=e.rendNodeStroke,JXG.exists(t)&&this._setAttr(t,"startarrow","none")),e.visProp.lastarrow?(t=e.rendNodeStroke,this._setAttr(t,"id",this.container.id+"_"+e.id+"stroke"),this._setAttr(t,"endarrow","block"),this._setAttr(t,"endarrowlength","long")):(t=e.rendNodeStroke,JXG.exists(t)&&this._setAttr(t,"endarrow","none")),e.visPropOld.firstarrow=e.visProp.firstarrow,e.visPropOld.lastarrow=e.visProp.lastarrow)},updateEllipsePrim:function(e,t,n,i,r){e.style.left=parseInt(t-i)+"px",e.style.top=parseInt(n-r)+"px",e.style.width=parseInt(2*i)+"px",e.style.height=parseInt(2*r)+"px"},updateLinePrim:function(e,t,n,i,r,o){var a,s=this.resolution;isNaN(t+n+i+r)||(a=["m ",parseInt(s*t),", ",parseInt(s*n)," l ",parseInt(s*i),", ",parseInt(s*r)],this.updatePathPrim(e,a,o))},updatePathPrim:function(e,t,n){var i=n.canvasWidth,r=n.canvasHeight;0>=t.length&&(t=["m 0,0"]),e.style.width=i,e.style.height=r,this._setAttr(e,"coordsize",[parseInt(this.resolution*i),parseInt(this.resolution*r)].join(",")),this._setAttr(e,"path",t.join(""))},updatePathStringPoint:function(e,t,n){var i=[],r=Math.round,o=e.coords.scrCoords,a=.5*t*Math.sqrt(3),s=.5*t,l=this.resolution;return"x"===n?i.push([" m ",r(l*(o[1]-t)),", ",r(l*(o[2]-t))," l ",r(l*(o[1]+t)),", ",r(l*(o[2]+t))," m ",r(l*(o[1]+t)),", ",r(l*(o[2]-t))," l ",r(l*(o[1]-t)),", ",r(l*(o[2]+t))].join("")):"+"===n?i.push([" m ",r(l*(o[1]-t)),", ",r(l*o[2])," l ",r(l*(o[1]+t)),", ",r(l*o[2])," m ",r(l*o[1]),", ",r(l*(o[2]-t))," l ",r(l*o[1]),", ",r(l*(o[2]+t))].join("")):"<>"===n?i.push([" m ",r(l*(o[1]-t)),", ",r(l*o[2])," l ",r(l*o[1]),", ",r(l*(o[2]+t))," l ",r(l*(o[1]+t)),", ",r(l*o[2])," l ",r(l*o[1]),", ",r(l*(o[2]-t))," x e "].join("")):"^"===n?i.push([" m ",r(l*o[1]),", ",r(l*(o[2]-t))," l ",r(l*(o[1]-a)),", ",r(l*(o[2]+s))," l ",r(l*(o[1]+a)),", ",r(l*(o[2]+s))," x e "].join("")):"v"===n?i.push([" m ",r(l*o[1]),", ",r(l*(o[2]+t))," l ",r(l*(o[1]-a)),", ",r(l*(o[2]-s))," l ",r(l*(o[1]+a)),", ",r(l*(o[2]-s))," x e "].join("")):">"===n?i.push([" m ",r(l*(o[1]+t)),", ",r(l*o[2])," l ",r(l*(o[1]-s)),", ",r(l*(o[2]-a))," l ",r(l*(o[1]-s)),", ",r(l*(o[2]+a))," l ",r(l*(o[1]+t)),", ",r(l*o[2])].join("")):"<"===n&&i.push([" m ",r(l*(o[1]-t)),", ",r(l*o[2])," l ",r(l*(o[1]+s)),", ",r(l*(o[2]-a))," l ",r(l*(o[1]+s)),", ",r(l*(o[2]+a))," x e "].join("")),i},updatePathStringPrim:function(e){var t,n,i=[],r=this.resolution,o=Math.round,a=" m ",s=" l ",l=a,c="plot"!==e.visProp.curvetype,u=Math.min(e.numberPoints,8192);if(0>=e.numberPoints)return"";for(c&&e.board.options.curve.RDPsmoothing&&(e.points=JXG.Math.Numerics.RamerDouglasPeuker(e.points,1)),u=Math.min(u,e.points.length),t=0;u>t;t++)n=e.points[t].scrCoords,isNaN(n[1])||isNaN(n[2])?l=a:(n[1]>2e4?n[1]=2e4:-2e4>n[1]&&(n[1]=-2e4),n[2]>2e4?n[2]=2e4:-2e4>n[2]&&(n[2]=-2e4),i.push([l,o(r*n[1]),", ",o(r*n[2])].join("")),l=s);return i.push(" e"),i},updatePolygonPrim:function(e,t){var n,i,r=t.vertices.length,o=this.resolution,a=[];if(this._setAttr(e,"stroked","false"),i=t.vertices[0].coords.scrCoords,!isNaN(i[1]+i[2])){for(a.push(["m ",parseInt(o*i[1]),",",parseInt(o*i[2])," l "].join("")),n=1;r-1>n;n++){if(i=t.vertices[n].coords.scrCoords,isNaN(i[1]+i[2]))return;a.push(parseInt(o*i[1])+","+parseInt(o*i[2])),r-2>n&&a.push(", ")}a.push(" x e"),this.updatePathPrim(e,a,t.board)}},updateRectPrim:function(e,t,n,i,r){e.style.left=parseInt(t)+"px",e.style.top=parseInt(n)+"px",i>=0&&(e.style.width=i+"px"),r>=0&&(e.style.height=r+"px")},setPropertyPrim:function(e,t,n){var i,r="";switch(t){case"stroke":r="strokecolor";break;case"stroke-width":r="strokeweight";break;case"stroke-dasharray":r="dashstyle"}""!==r&&(i=JXG.evaluate(n),this._setAttr(e,r,i))},show:function(e){e&&e.rendNode&&(e.rendNode.style.visibility="inherit")},hide:function(e){e&&e.rendNode&&(e.rendNode.style.visibility="hidden")},setDashStyle:function(e,t){var n;t.dash>=0&&(n=e.rendNodeStroke,this._setAttr(n,"dashstyle",this.dashArray[t.dash]))},setGradient:function(e){var t=e.rendNodeFill;"linear"===e.visProp.gradient?(this._setAttr(t,"type","gradient"),this._setAttr(t,"color2",e.visProp.gradientsecondcolor),this._setAttr(t,"opacity2",e.visProp.gradientsecondopacity),this._setAttr(t,"angle",e.visProp.gradientangle)):"radial"===e.visProp.gradient?(this._setAttr(t,"type","gradientradial"),this._setAttr(t,"color2",e.visProp.gradientsecondcolor),this._setAttr(t,"opacity2",e.visProp.gradientsecondopacity),this._setAttr(t,"focusposition",100*e.visProp.gradientpositionx+"%,"+100*e.visProp.gradientpositiony+"%"),this._setAttr(t,"focussize","0,0")):this._setAttr(t,"type","solid")},setObjectFillColor:function(e,t,n){var i,r,o,a,s=JXG.evaluate(t),l=JXG.evaluate(n);e.rendNode,l=l>0?l:0,(e.visPropOld.fillcolor!==s||e.visPropOld.fillopacity!==l)&&(9!=s.length?(i=s,o=l):(r=JXG.rgba2rgbo(s),i=r[0],o=l*r[1]),"none"===i||i===!1?this._setAttr(e.rendNode,"filled","false"):(this._setAttr(e.rendNode,"filled","true"),this._setAttr(e.rendNode,"fillcolor",i),JXG.exists(o)&&e.rendNodeFill&&this._setAttr(e.rendNodeFill,"opacity",100*o+"%")),e.type===JXG.OBJECT_TYPE_IMAGE&&(a=""+e.rendNode.style.filter,a.match(/alpha/)?e.rendNode.style.filter=a.replace(/alpha\(opacity *= *[0-9\.]+\)/,"alpha(opacity = "+100*o+")"):e.rendNode.style.filter+=" alpha(opacity = "+100*o+")"),e.visPropOld.fillcolor=s,e.visPropOld.fillopacity=l)},setObjectStrokeColor:function(e,t,n){var i,r,o,a,s=JXG.evaluate(t),l=JXG.evaluate(n),c=e.rendNode;l=l>0?l:0,(e.visPropOld.strokecolor!==s||e.visPropOld.strokeopacity!==l)&&(9!=s.length?(i=s,o=l):(r=JXG.rgba2rgbo(s),i=r[0],o=l*r[1]),e.type===JXG.OBJECT_TYPE_TEXT?(o=Math.round(100*o),c.style.filter=" alpha(opacity = "+o+")",c.style.color=i):(i!==!1&&(this._setAttr(c,"stroked","true"),this._setAttr(c,"strokecolor",i)),a=e.rendNodeStroke,JXG.exists(o)&&this._setAttr(a,"opacity",100*o+"%")),e.visPropOld.strokecolor=s,e.visPropOld.strokeopacity=l)},setObjectStrokeWidth:function(e,t){var n,i=JXG.evaluate(t);e.visPropOld.strokewidth!==i&&(n=e.rendNode,this.setPropertyPrim(n,"stroked","true"),JXG.exists(i)&&this.setPropertyPrim(n,"stroke-width",i),e.visPropOld.strokewidth=i)},setShadow:function(e){var t=e.rendNodeShadow;t&&e.visPropOld.shadow!==e.visProp.shadow&&(e.visProp.shadow?(this._setAttr(t,"On","True"),this._setAttr(t,"Offset","3pt,3pt"),this._setAttr(t,"Opacity","60%"),this._setAttr(t,"Color","#aaaaaa")):this._setAttr(t,"On","False"),e.visPropOld.shadow=e.visProp.shadow)},suspendRedraw:function(){this.container.style.display="none"},unsuspendRedraw:function(){this.container.style.display=""}}),JXG.CanvasRenderer=function(e){this.type="canvas",this.canvasRoot=null,this.suspendHandle=null,this.canvasId=JXG.Util.genUUID(),this.canvasNamespace=null,this.container=e,this.container.style.MozUserSelect="none",this.container.style.overflow="hidden",""===this.container.style.position&&(this.container.style.position="relative"),this.container.innerHTML=['<canvas id="',this.canvasId,'" width="',this.container.style.width,'" height="',this.container.style.height,'"><',"/canvas>"].join(""),this.canvasRoot=document.getElementById(this.canvasId),this.context=this.canvasRoot.getContext("2d"),this.dashArray=[[2,2],[5,5],[10,10],[20,20],[20,10,10,10],[20,5,10,5]]},JXG.CanvasRenderer.prototype=new JXG.AbstractRenderer,JXG.extend(JXG.CanvasRenderer.prototype,{_drawFilledPolygon:function(e){var t,n=e.length,i=this.context;if(n>0){for(i.beginPath(),i.moveTo(e[0][0],e[0][1]),t=0;n>t;t++)t>0&&i.lineTo(e[t][0],e[t][1]);i.lineTo(e[0][0],e[0][1]),i.fill()}},_fill:function(e){var t=this.context;t.save(),this._setColor(e,"fill")&&t.fill(),t.restore()},_rotatePoint:function(e,t,n){return[t*Math.cos(e)-n*Math.sin(e),t*Math.sin(e)+n*Math.cos(e)]},_rotateShape:function(e,t){var n,i=[],r=e.length;if(0>=r)return e;for(n=0;r>n;n++)i.push(this._rotatePoint(t,e[n][0],e[n][1]));return i},_setColor:function(e,t,n){var i,r,o,a,s,l,c=!0,u=!1,d=e.visProp;return t=t||"stroke",n=n||t,JXG.exists(e.board)&&JXG.exists(e.board.highlightedObjects)||(u=!0),i=!u&&JXG.exists(e.board.highlightedObjects[e.id])?"highlight":"",r=JXG.evaluate(d[i+t+"color"]),"none"!==r&&r!==!1?(s=JXG.evaluate(d[i+t+"opacity"]),s=s>0?s:0,9!=r.length?(a=r,l=s):(o=JXG.rgba2rgbo(r),a=o[0],l=s*o[1]),this.context.globalAlpha=l,this.context[n+"Style"]=a):c=!1,"stroke"===t&&(this.context.lineWidth=parseFloat(d.strokewidth)),c },_stroke:function(e){var t=this.context;t.save(),e.visProp.dash>0||(this.context.lineDashArray=[]),this._setColor(e,"stroke")&&t.stroke(),t.restore()},_translateShape:function(e,t,n){var i,r=[],o=e.length;if(0>=o)return e;for(i=0;o>i;i++)r.push([e[i][0]+t,e[i][1]+n]);return r},drawPoint:function(e){var t=e.visProp.face,n=e.visProp.size,i=e.coords.scrCoords,r=.5*n*Math.sqrt(3),o=.5*n,a=parseFloat(e.visProp.strokewidth)/2,s=this.context;if(!(0>=n)&&e.visProp.visible)switch(t){case"cross":case"x":s.beginPath(),s.moveTo(i[1]-n,i[2]-n),s.lineTo(i[1]+n,i[2]+n),s.moveTo(i[1]+n,i[2]-n),s.lineTo(i[1]-n,i[2]+n),s.closePath(),this._stroke(e);break;case"circle":case"o":s.beginPath(),s.arc(i[1],i[2],n+1+a,0,2*Math.PI,!1),s.closePath(),this._fill(e),this._stroke(e);break;case"square":case"[]":if(0>=n)break;s.save(),this._setColor(e,"stroke","fill")&&s.fillRect(i[1]-n-a,i[2]-n-a,2*n+3*a,2*n+3*a),s.restore(),s.save(),this._setColor(e,"fill"),s.fillRect(i[1]-n+a,i[2]-n+a,2*n-a,2*n-a),s.restore();break;case"plus":case"+":s.beginPath(),s.moveTo(i[1]-n,i[2]),s.lineTo(i[1]+n,i[2]),s.moveTo(i[1],i[2]-n),s.lineTo(i[1],i[2]+n),s.closePath(),this._stroke(e);break;case"diamond":case"<>":s.beginPath(),s.moveTo(i[1]-n,i[2]),s.lineTo(i[1],i[2]+n),s.lineTo(i[1]+n,i[2]),s.lineTo(i[1],i[2]-n),s.closePath(),this._fill(e),this._stroke(e);break;case"triangleup":case"a":case"^":s.beginPath(),s.moveTo(i[1],i[2]-n),s.lineTo(i[1]-r,i[2]+o),s.lineTo(i[1]+r,i[2]+o),s.closePath(),this._fill(e),this._stroke(e);break;case"triangledown":case"v":s.beginPath(),s.moveTo(i[1],i[2]+n),s.lineTo(i[1]-r,i[2]-o),s.lineTo(i[1]+r,i[2]-o),s.closePath(),this._fill(e),this._stroke(e);break;case"triangleleft":case"<":s.beginPath(),s.moveTo(i[1]-n,i[2]),s.lineTo(i[1]+o,i[2]-r),s.lineTo(i[1]+o,i[2]+r),s.closePath(),this.fill(e),this._stroke(e);break;case"triangleright":case">":s.beginPath(),s.moveTo(i[1]+n,i[2]),s.lineTo(i[1]-o,i[2]-r),s.lineTo(i[1]-o,i[2]+r),s.closePath(),this._fill(e),this._stroke(e)}},updatePoint:function(e){this.drawPoint(e)},drawLine:function(e){var t=new JXG.Coords(JXG.COORDS_BY_USER,e.point1.coords.usrCoords,e.board),n=new JXG.Coords(JXG.COORDS_BY_USER,e.point2.coords.usrCoords,e.board);JXG.Math.Geometry.calcStraight(e,t,n),this.context.beginPath(),this.context.moveTo(t.scrCoords[1],t.scrCoords[2]),this.context.lineTo(n.scrCoords[1],n.scrCoords[2]),this._stroke(e),this.makeArrows(e,t,n)},updateLine:function(e){this.drawLine(e)},drawTicks:function(){},updateTicks:function(e,t,n,i,r){var o,a,s=e.ticks.length,l=this.context;for(l.beginPath(),o=0;s>o;o++)a=e.ticks[o].scrCoords,e.ticks[o].major?(e.labels[o]&&(e.board.needsFullUpdate||e.needsRegularUpdate||"internal"===e.labels[o].visProp.display)&&e.labels[o].visProp.visible&&this.updateText(e.labels[o]),l.moveTo(a[1]+t,a[2]-n),l.lineTo(a[1]-t,a[2]+n)):(l.moveTo(a[1]+i,a[2]-r),l.lineTo(a[1]-i,a[2]+r));this._stroke(e)},drawCurve:function(e){this.updatePathStringPrim(e)},updateCurve:function(e){this.drawCurve(e)},drawEllipse:function(e){var t=e.midpoint.coords.scrCoords[1],n=e.midpoint.coords.scrCoords[2],i=e.board.unitX,r=e.board.unitY,o=2*e.Radius(),a=2*e.Radius(),s=o*i,l=a*r,c=t-s/2,u=n-l/2,d=.5522848*(s/2),h=.5522848*(l/2),p=c+s,f=u+l,g=c+s/2,m=u+l/2,v=this.context;o>0&&a>0&&!isNaN(t+n)&&(v.beginPath(),v.moveTo(c,m),v.bezierCurveTo(c,m-h,g-d,u,g,u),v.bezierCurveTo(g+d,u,p,m-h,p,m),v.bezierCurveTo(p,m+h,g+d,f,g,f),v.bezierCurveTo(g-d,f,c,m+h,c,m),v.closePath(),this._fill(e),this._stroke(e))},updateEllipse:function(e){return this.drawEllipse(e)},displayCopyright:function(e,t){var n=this.context;n.save(),n.font=t+"px Arial",n.fillStyle="#aaa",n.lineWidth=.5,n.fillText(e,10,2+t),n.restore()},drawInternalText:function(e){var t,n=this.context;return n.save(),this._setColor(e,"stroke","fill")&&!isNaN(e.coords.scrCoords[1]+e.coords.scrCoords[2])&&(e.visProp.fontsize&&("function"==typeof e.visProp.fontsize?(t=e.visProp.fontsize(),n.font=(t>0?t:0)+"px Arial"):n.font=e.visProp.fontsize+"px Arial"),this.transformImage(e,e.transformations),n.fillText(e.plaintext,e.coords.scrCoords[1],e.coords.scrCoords[2])),n.restore(),null},updateInternalText:function(e){this.drawInternalText(e)},setObjectStrokeColor:function(e,t,n){var i,r,o,a,s=JXG.evaluate(t),l=JXG.evaluate(n);l=l>0?l:0,(e.visPropOld.strokecolor!==s||e.visPropOld.strokeopacity!==l)&&(s!==!1&&(9!=s.length?(i=s,o=l):(r=JXG.rgba2rgbo(s),i=r[0],o=l*r[1]),a=e.rendNode,e.type===JXG.OBJECT_TYPE_TEXT&&"html"===e.visProp.display&&(a.style.color=i,a.style.opacity=o)),e.visPropOld.strokecolor=s,e.visPropOld.strokeopacity=l)},drawImage:function(e){e.rendNode=new Image,e._src="",this.updateImage(e)},updateImage:function(e){var t=this.context,n=JXG.evaluate(e.visProp.fillopacity),i=JXG.bind(function(){e.imgIsLoaded=!0,0>=e.size[0]||0>=e.size[1]||(t.save(),t.globalAlpha=n,this.transformImage(e,e.transformations),t.drawImage(e.rendNode,e.coords.scrCoords[1],e.coords.scrCoords[2]-e.size[1],e.size[0],e.size[1]),t.restore())},this);this.updateImageURL(e)?e.rendNode.onload=i:e.imgIsLoaded&&i()},transformImage:function(e,t){var n,i=t.length,r=this.context;i>0&&(n=this.joinTransforms(e,t),Math.abs(JXG.Math.Numerics.det(n))>=JXG.Math.eps&&r.transform(n[1][1],n[2][1],n[1][2],n[2][2],n[1][0],n[2][0]))},updateImageURL:function(e){var t;return t=JXG.evaluate(e.url),e._src!==t?(e.imgIsLoaded=!1,e.rendNode.src=t,e._src=t,!0):!1},remove:function(e){JXG.exists(e)&&JXG.exists(e.parentNode)&&e.parentNode.removeChild(e)},makeArrows:function(e,t,n){var i,r,o,a,s,l=[[2,0],[-10,-4],[-10,4]],c=[[-2,0],[10,-4],[10,4]],u=this.context;if("none"!==e.visProp.strokecolor&&(e.visProp.lastarrow||e.visProp.firstarrow)){if(e.elementClass!==JXG.OBJECT_CLASS_LINE)return;i=t.scrCoords[1],r=t.scrCoords[2],o=n.scrCoords[1],a=n.scrCoords[2],u.save(),this._setColor(e,"stroke","fill")&&(s=Math.atan2(a-r,o-i),e.visProp.lastarrow&&this._drawFilledPolygon(this._translateShape(this._rotateShape(l,s),o,a)),e.visProp.firstarrow&&this._drawFilledPolygon(this._translateShape(this._rotateShape(c,s),i,r))),u.restore()}},updatePathStringPrim:function(e){var t,n,i,r="M",o="L",a=r,s=5e3,l="plot"!==e.visProp.curvetype,c=this.context;if(!(0>=e.numberPoints)){for(l&&e.board.options.curve.RDPsmoothing&&(e.points=JXG.Math.Numerics.RamerDouglasPeuker(e.points,.5)),i=Math.min(e.points.length,e.numberPoints),c.beginPath(),t=0;i>t;t++)n=e.points[t].scrCoords,isNaN(n[1])||isNaN(n[2])?a=r:(n[1]>s?n[1]=s:-s>n[1]&&(n[1]=-s),n[2]>s?n[2]=s:-s>n[2]&&(n[2]=-s),"M"===a?c.moveTo(n[1],n[2]):c.lineTo(n[1],n[2]),a=o);this._fill(e),this._stroke(e)}},updatePolygonPrim:function(e,t){var n,i,r=t.vertices.length,o=this.context;if(!(0>=r)){for(o.beginPath(),n=t.vertices[0].coords.scrCoords,o.moveTo(n[1],n[2]),i=1;r>i;i++)n=t.vertices[i].coords.scrCoords,o.lineTo(n[1],n[2]);o.closePath(),this._fill(t)}},show:function(e){JXG.exists(e.rendNode)&&(e.rendNode.style.visibility="inherit")},hide:function(e){JXG.exists(e.rendNode)&&(e.rendNode.style.visibility="hidden")},setGradient:function(e){var t,n;n=JXG.evaluate(e.visProp.fillopacity),n=n>0?n:0,t=JXG.evaluate(e.visProp.fillcolor)},setShadow:function(e){e.visPropOld.shadow!==e.visProp.shadow&&(e.visPropOld.shadow=e.visProp.shadow)},highlight:function(e){return e.board.prepareUpdate(),e.board.renderer.suspendRedraw(e.board),e.board.updateRenderer(),e.board.renderer.unsuspendRedraw(),this},noHighlight:function(e){return e.board.prepareUpdate(),e.board.renderer.suspendRedraw(e.board),e.board.updateRenderer(),e.board.renderer.unsuspendRedraw(),this},suspendRedraw:function(e){this.context.save(),this.context.clearRect(0,0,this.canvasRoot.width,this.canvasRoot.height),e&&e.showCopyright&&this.displayCopyright(JXG.JSXGraph.licenseText,12)},unsuspendRedraw:function(){this.context.restore()},resize:function(e,t){this.canvasRoot.style.width=parseFloat(e)+"px",this.canvasRoot.style.height=parseFloat(t)+"px"}});
Rbeuque74/cdnjs
ajax/libs/jsxgraph/0.92/jsxgraphcore.min.js
JavaScript
mit
332,728
OpenLayers.Control.Permalink=OpenLayers.Class(OpenLayers.Control,{argParserClass:OpenLayers.Control.ArgParser,element:null,anchor:!1,base:"",displayProjection:null,initialize:function(e,t,i){null===e||"object"!=typeof e||OpenLayers.Util.isElement(e)?(OpenLayers.Control.prototype.initialize.apply(this,[i]),this.element=OpenLayers.Util.getElement(e),this.base=t||document.location.href):(i=e,this.base=document.location.href,OpenLayers.Control.prototype.initialize.apply(this,[i]),null!=this.element&&(this.element=OpenLayers.Util.getElement(this.element)))},destroy:function(){this.element&&this.element.parentNode==this.div&&(this.div.removeChild(this.element),this.element=null),this.map&&this.map.events.unregister("moveend",this,this.updateLink),OpenLayers.Control.prototype.destroy.apply(this,arguments)},setMap:function(){OpenLayers.Control.prototype.setMap.apply(this,arguments);for(var e=0,t=this.map.controls.length;t>e;e++){var i=this.map.controls[e];if(i.CLASS_NAME==this.argParserClass.CLASS_NAME){i.displayProjection!=this.displayProjection&&(this.displayProjection=i.displayProjection);break}}e==this.map.controls.length&&this.map.addControl(new this.argParserClass({displayProjection:this.displayProjection}))},draw:function(){return OpenLayers.Control.prototype.draw.apply(this,arguments),this.element||this.anchor||(this.element=document.createElement("a"),this.element.innerHTML=OpenLayers.i18n("Permalink"),this.element.href="",this.div.appendChild(this.element)),this.map.events.on({moveend:this.updateLink,changelayer:this.updateLink,changebaselayer:this.updateLink,scope:this}),this.updateLink(),this.div},updateLink:function(){var e=this.anchor?"#":"?",t=this.base;-1!=t.indexOf(e)&&(t=t.substring(0,t.indexOf(e))),t+=e+OpenLayers.Util.getParameterString(this.createParams()),this.anchor&&!this.element?window.location.href=t:this.element.href=t},createParams:function(e,t,i){e=e||this.map.getCenter();var n=OpenLayers.Util.getParameters(this.base);if(e){n.zoom=t||this.map.getZoom();var r=e.lat,o=e.lon;if(this.displayProjection){var s=OpenLayers.Projection.transform({x:o,y:r},this.map.getProjectionObject(),this.displayProjection);o=s.x,r=s.y}n.lat=Math.round(1e5*r)/1e5,n.lon=Math.round(1e5*o)/1e5,i=i||this.map.layers,n.layers="";for(var a=0,l=i.length;l>a;a++){var h=i[a];n.layers+=h.isBaseLayer?h==this.map.baseLayer?"B":"0":h.getVisibility()?"T":"F"}}return n},CLASS_NAME:"OpenLayers.Control.Permalink"});
joscha/cdnjs
ajax/libs/openlayers/2.12/lib/OpenLayers/Control/Permalink.min.js
JavaScript
mit
2,437
(function(){function e(e,t){var n;e||(e={});for(n in t)e[n]=t[n];return e}function t(e,t){return parseInt(e,t||10)}function n(e){return"string"==typeof e}function i(e){return"object"==typeof e}function r(e){return"number"==typeof e}function o(e,t){for(var n=e.length;n--;)if(e[n]===t){e.splice(n,1);break}}function a(e){return e!==A&&null!==e}function s(e,t,r){var o,s;if(n(t))a(r)?e.setAttribute(t,r):e&&e.getAttribute&&(s=e.getAttribute(t));else if(a(t)&&i(t))for(o in t)e.setAttribute(o,t[o]);return s}function l(e){return e&&e.constructor===Array||(e=[e]),e}function c(){var e,t,n=arguments,i=n.length;for(e=0;i>e;e++)if(t=n[e],t!==void 0&&null!==t)return t}function u(e){var t,n="";for(t in e)n+=t+":"+e[t]+";";return n}function d(t,n){tt&&n&&n.opacity!==A&&(n.filter="alpha(opacity="+100*n.opacity+")"),e(t.style,n)}function p(t,n,i,r,o){return t=$.createElement(t),n&&e(t,n),o&&d(t,{padding:0,border:bt,margin:0}),i&&d(t,i),r&&r.appendChild(t),t}function h(t,n){var i=function(){};return i.prototype=new t,e(i.prototype,n),i}function f(e,n,i,r){var o=C.lang;e=e;var a=isNaN(n=X(n))?2:n;n=void 0===i?o.decimalPoint:i,r=void 0===r?o.thousandsSep:r,o=0>e?"-":"",i=t(e=X(+e||0).toFixed(a))+"";var s=i.length>3?i.length%3:0;return o+(s?i.substr(0,s)+r:"")+i.substr(s).replace(/(\d{3})(?=\d)/g,"$1"+r)+(a?n+X(e-i).toFixed(a).slice(2):"")}function g(e,t){E=c(e,t.animation)}function m(){var e=C.global.useUTC;D=e?Date.UTC:function(e,t,n,i,r,o){return new Date(e,t,c(n,1),c(i,0),c(r,0),c(o,0)).getTime()},I=e?"getUTCMinutes":"getMinutes",R=e?"getUTCHours":"getHours",O=e?"getUTCDay":"getDay",L=e?"getUTCDate":"getDate",F=e?"getUTCMonth":"getMonth",N=e?"getUTCFullYear":"getFullYear",P=e?"setUTCMinutes":"setMinutes",B=e?"setUTCHours":"setHours",M=e?"setUTCDate":"setDate",j=e?"setUTCMonth":"setMonth",z=e?"setUTCFullYear":"setFullYear"}function b(e){w||(w=p(ut)),e&&w.appendChild(e),w.innerHTML=""}function v(){}function y(r,u){function h(n,i){function r(e,t){this.pos=e,this.minor=t,this.isNew=!0,t||this.addLabel()}function s(e){return e&&(this.options=e,this.id=e.id),this}function l(e,t,n){this.isNegative=t,this.options=e,this.x=n,this.alignOptions={align:e.align||(An?t?"left":"right":"center"),verticalAlign:e.verticalAlign||(An?"middle":t?"bottom":"top"),y:c(e.y,An?4:t?14:-6),x:c(e.x,An?t?-6:6:0)},this.textAlign=e.textAlign||(An?t?"right":"left":"center")}function u(){var e,t=[],n=[];et=tt=null,nt=[],Tt(Qn,function(r){if(e=!1,Tt(["xAxis","yAxis"],function(t){r.isCartesian&&("xAxis"===t&&y||"yAxis"===t&&!y)&&(r.options[t]===i.index||r.options[t]===A&&0===i.index)&&(r[t]=dt,nt.push(r),e=!0)}),!r.visible&&wt.ignoreHiddenSeries&&(e=!1),e){var o,s,u,d,p;y||(o=r.options.stacking,ut="percent"===o,o&&(d=r.type+c(r.options.stack,""),p="-"+d,r.stackKey=d,s=t[d]||[],t[d]=s,u=n[p]||[],n[p]=u),ut&&(et=0,tt=99)),r.isCartesian&&(Tt(r.data,function(e){var t=e.x,n=e.y,r=0>n,h=r?u:s,f=r?p:d;null===et&&(et=tt=e[xt]),y?t>tt?tt=t:et>t&&(et=t):a(n)&&(o&&(h[t]=a(h[t])?h[t]+n:n),n=h?h[t]:n,e=c(e.low,n),ut||(n>tt?tt=n:et>e&&(et=e)),o&&(w[f]||(w[f]={}),w[f][t]||(w[f][t]=new l(i.stackLabels,r,t)),w[f][t].setTotal(n)))}),/(area|column|bar)/.test(r.type)&&!y&&(et>=0?(et=0,st=!0):0>tt&&(tt=0,lt=!0)))}})}function d(e,t){var n,r;for(Pt=t?1:K.pow(10,W(K.log(e)/K.LN10)),n=e/Pt,t||(t=[1,2,2.5,5,10],(i.allowDecimals===!1||bt)&&(1===Pt?t=[1,2,5,10]:.1>=Pt&&(t=[1/Pt]))),r=0;t.length>r&&(e=t[r],!((t[r]+(t[r+1]||t[r]))/2>=n));r++);return e*=Pt}function p(e){var t;return t=e,Pt=c(Pt,K.pow(10,W(K.log(Ft)/K.LN10))),1>Pt&&(t=10*q(1/Pt),t=q(e*t)/t),t}function h(){var e,t,r,o,s=i.tickInterval,l=i.tickPixelInterval;if(e=i.maxZoom||(!y||a(i.min)||a(i.max)?null:G(5*n.smallestInterval,tt-et)),E=x?yn:vn,Rt?(r=n[y?"xAxis":"yAxis"][i.linkedTo],o=r.getExtremes(),Et=c(o.min,o.dataMin),Ct=c(o.max,o.dataMax)):(Et=c(it,i.min,et),Ct=c(rt,i.max,tt)),bt&&(Et=K.log(Et)/K.LN10,Ct=K.log(Ct)/K.LN10),e>Ct-Et&&(o=(e-Ct+Et)/2,Et=V(Et-o,c(i.min,Et-o),et),Ct=G(Et+e,c(i.max,Et+e),tt)),ln||ut||Rt||!a(Et)||!a(Ct)||(e=Ct-Et||1,a(i.min)||a(it)||!St||!(0>et)&&st||(Et-=e*St),a(i.max)||a(rt)||!Dt||!(tt>0)&&lt||(Ct+=e*Dt)),Ft=Et===Ct?1:Rt&&!s&&l===r.options.tickPixelInterval?r.tickInterval:c(s,ln?1:(Ct-Et)*l/E),ft||a(i.tickInterval)||(Ft=d(Ft)),dt.tickInterval=Ft,Nt="auto"===i.minorTickInterval&&Ft?Ft/5:i.minorTickInterval,ft){Bt=[],s=C.global.useUTC;var u=1e3/ct,h=6e4/ct,f=36e5/ct;l=864e5/ct,e=6048e5/ct,o=2592e6/ct;var g=31556952e3/ct,m=[["second",u,[1,2,5,10,15,30]],["minute",h,[1,2,5,10,15,30]],["hour",f,[1,2,3,4,6,8,12]],["day",l,[1,2]],["week",e,[1,2]],["month",o,[1,2,3,4,6]],["year",g,null]],b=m[6],v=b[1],_=b[2];for(r=0;m.length>r&&(b=m[r],v=b[1],_=b[2],!(m[r+1]&&(v*_[_.length-1]+m[r+1][1])/2>=Ft));r++);for(v===g&&5*v>Ft&&(_=[1,2,5]),m=d(Ft/v,_),_=new Date(Et*ct),_.setMilliseconds(0),v>=u&&_.setSeconds(v>=h?0:m*W(_.getSeconds()/m)),v>=h&&_[P](v>=f?0:m*W(_[I]()/m)),v>=f&&_[B](v>=l?0:m*W(_[R]()/m)),v>=l&&_[M](v>=o?1:m*W(_[L]()/m)),v>=o&&(_[j](v>=g?0:m*W(_[F]()/m)),t=_[N]()),v>=g&&(t-=t%m,_[z](t)),v===e&&_[M](_[L]()-_[O]()+i.startOfWeek),r=1,t=_[N](),u=_.getTime()/ct,h=_[F](),f=_[L]();Ct>u&&yn>r;)Bt.push(u),v===g?u=D(t+r*m,0)/ct:v===o?u=D(t,h+r*m)/ct:s||v!==l&&v!==e?u+=v*m:u=D(t,h,f+r*m*(v===l?1:7)),r++;Bt.push(u),Zt=i.dateTimeLabelFormats[b[0]]}else for(r=p(W(Et/Ft)*Ft),t=p(U(Ct/Ft)*Ft),Bt=[],r=p(r);t>=r;)Bt.push(r),r=p(r+Ft);Rt||((ln||y&&n.hasColumn)&&(t=.5*(ln?1:Ft),(ln||!a(c(i.min,it)))&&(Et-=t),(ln||!a(c(i.max,rt)))&&(Ct+=t)),t=Bt[0],r=Bt[Bt.length-1],i.startOnTick?Et=t:Et>t&&Bt.shift(),i.endOnTick?Ct=r:r>Ct&&Bt.pop(),Sn||(Sn={x:0,y:0}),!ft&&Bt.length>Sn[xt]&&(Sn[xt]=Bt.length))}function g(){var e,t;if(ot=Et,at=Ct,u(),h(),$=S,S=E/(Ct-Et||1),!y)for(e in w)for(t in w[e])w[e][t].cum=w[e][t].total;dt.isDirty||(dt.isDirty=Et!==ot||Ct!==at)}function m(e){return e=new s(e).render(),Qt.push(e),e}function b(){var e,o,l=i.title,c=i.stackLabels,u=i.alternateGridColor,d=i.lineWidth,p=n.hasRendered,h=p&&a(ot)&&!isNaN(ot);if(e=nt.length&&a(Et)&&a(Ct),E=x?yn:vn,S=E/(Ct-Et||1),kt=x?Gt:Ut,e||Rt){if(Nt&&!ln)for(e=Et+(Bt[0]-Et)%Nt;Ct>=e;e+=Nt)tn[e]||(tn[e]=new r(e,!0)),h&&tn[e].isNew&&tn[e].render(null,!0),tn[e].isActive=!0,tn[e].render();Tt(Bt,function(e,t){(!Rt||e>=Et&&Ct>=e)&&(h&&en[e].isNew&&en[e].render(t,!0),en[e].isActive=!0,en[e].render(t))}),u&&Tt(Bt,function(e,t){0===t%2&&Ct>e&&(sn[e]||(sn[e]=new s),sn[e].options={from:e,to:Bt[t+1]!==A?Bt[t+1]:Ct,color:u},sn[e].render(),sn[e].isActive=!0)}),p||Tt((i.plotLines||[]).concat(i.plotBands||[]),function(e){Qt.push(new s(e).render())})}if(Tt([en,tn,sn],function(e){for(var t in e)e[t].isActive?e[t].isActive=!1:(e[t].destroy(),delete e[t])}),d&&(e=Gt+(_?yn:0)+_t,o=rn-Ut-(_?vn:0)+_t,e=Dn.crispLine([vt,x?Gt:e,x?o:Mt,yt,x?nn-Wt:e,x?o:rn-Ut],d),Q?Q.animate({d:e}):Q=Dn.path(e).attr({stroke:i.lineColor,"stroke-width":d,zIndex:7}).add()),dt.axisTitle&&(e=x?Gt:Mt,d=t(l.style.fontSize||12),e={low:e+(x?0:E),middle:e+E/2,high:e+(x?E:0)}[l.align],d=(x?Mt+vn:Gt)+(x?1:-1)*(_?-1:1)*Jt+(2===k?d:0),dt.axisTitle[p?"animate":"attr"]({x:x?e:d+(_?yn:0)+_t+(l.x||0),y:x?d-(_?vn:0)+_t:e+(l.y||0)})),c&&c.enabled){var f,g;c=dt.stackTotalGroup,c||(dt.stackTotalGroup=c=Dn.g("stack-labels").attr({visibility:gt,zIndex:6}).translate(Gt,Mt).add());for(f in w){l=w[f];for(g in l)l[g].render(c)}}dt.isDirty=!1}function v(e){for(var t=Qt.length;t--;)Qt[t].id===e&&Qt[t].destroy()}var y=i.isX,_=i.opposite,x=An?!y:y,k=x?_?0:2:_?1:3,w={};i=At(y?jt:zt,[qt,Ht,Kt,$t][k],i);var E,S,$,H,Y,J,Z,Q,et,tt,nt,it,rt,ot,at,st,lt,ut,dt=this,pt=i.type,ft="datetime"===pt,bt="logarithmic"===pt,_t=i.offset||0,xt=y?"x":"y",kt=x?Gt:Ut,Ct=null,Et=null,St=i.minPadding,Dt=i.maxPadding,Rt=a(i.linkedTo);pt=i.events;var Lt,Ft,Nt,Pt,Bt,Vt,Yt,Jt,Zt,Qt=[],en={},tn={},sn={},ln=i.categories,cn=i.labels.formatter||function(){var e=this.value;return Zt?T(Zt,e):0===Ft%1e6?e/1e6+"M":0===Ft%1e3?e/1e3+"k":!ln&&e>=1e3?f(e,0):e},un=x&&i.labels.staggerLines,dn=i.reversed,pn=ln&&"between"===i.tickmarkPlacement?.5:0;r.prototype={addLabel:function(){var t=this.pos,n=i.labels,r=!(t===Et&&!c(i.showFirstLabel,1)||t===Ct&&!c(i.showLastLabel,0)),o=ln&&x&&ln.length&&!n.step&&!n.staggerLines&&!n.rotation&&yn/ln.length||!x&&yn/2,s=this.label;t=cn.call({isFirst:t===Bt[0],isLast:t===Bt[Bt.length-1],dateTimeLabelFormat:Zt,value:ln&&ln[t]?ln[t]:t}),o=o&&{width:V(1,q(o-2*(n.padding||10)))+mt},o=e(o,n.style),s===A?this.label=a(t)&&r&&n.enabled?Dn.text(t,0,0).attr({align:n.align,rotation:n.rotation}).css(o).add(J):null:s&&s.attr({text:t}).css(o)},getLabelSize:function(){var e=this.label;return e?(this.labelBBox=e.getBBox())[x?"height":"width"]:0},render:function(e,n){var r=!this.minor,o=this.label,s=this.pos,l=i.labels,c=this.gridLine,u=r?i.gridLineWidth:i.minorGridLineWidth,d=r?i.gridLineColor:i.minorGridLineColor,p=r?i.gridLineDashStyle:i.minorGridLineDashStyle,h=this.mark,f=r?i.tickLength:i.minorTickLength,g=r?i.tickWidth:i.minorTickWidth||0,m=r?i.tickColor:i.minorTickColor,b=r?i.tickPosition:i.minorTickPosition;r=l.step;var v,y=n&&an||rn;v=x?H(s+pn,null,null,n)+kt:Gt+_t+(_?(n&&on||nn)-Wt-Gt:0),y=x?y-Ut+_t-(_?vn:0):y-H(s+pn,null,null,n)-kt,u&&(s=Y(s+pn,u,n),c===A&&(c={stroke:d,"stroke-width":u},p&&(c.dashstyle=p),this.gridLine=c=u?Dn.path(s).attr(c).add(Z):null),c&&s&&c.animate({d:s})),g&&("inside"===b&&(f=-f),_&&(f=-f),u=Dn.crispLine([vt,v,y,yt,v+(x?0:-f),y+(x?f:0)],g),h?h.animate({d:u}):this.mark=Dn.path(u).attr({stroke:m,"stroke-width":g}).add(J)),o&&!isNaN(v)&&(v=v+l.x-(pn&&x?pn*S*(dn?-1:1):0),y=y+l.y-(pn&&!x?pn*S*(dn?1:-1):0),a(l.y)||(y+=.9*t(o.styles.lineHeight)-o.getBBox().height/2),un&&(y+=16*(e/(r||1)%un)),r&&o[e%r?"hide":"show"](),o[this.isNew?"attr":"animate"]({x:v,y:y})),this.isNew=!1},destroy:function(){for(var e in this)this[e]&&this[e].destroy&&this[e].destroy()}},s.prototype={render:function(){var e,t,n,i=this,r=i.options,o=r.label,s=i.label,l=r.width,u=r.to,d=r.from,p=r.dashStyle,h=i.svgElem,f=[],g=r.color;n=r.zIndex;var m=r.events;if(l)f=Y(r.value,l),r={stroke:g,"stroke-width":l},p&&(r.dashstyle=p);else{if(!a(d)||!a(u))return;d=V(d,Et),u=G(u,Ct),e=Y(u),(f=Y(d))&&e?f.push(e[4],e[5],e[1],e[2]):f=null,r={fill:g}}if(a(n)&&(r.zIndex=n),h)f?h.animate({d:f},null,h.onGetPath):(h.hide(),h.onGetPath=function(){h.show()});else if(f&&f.length&&(i.svgElem=h=Dn.path(f).attr(r).add(),m)){p=function(e){h.on(e,function(t){m[e].apply(i,[t])})};for(t in m)p(t)}return o&&a(o.text)&&f&&f.length&&yn>0&&vn>0?(o=At({align:x&&e&&"center",x:x?!e&&4:10,verticalAlign:!x&&e&&"middle",y:x?e?16:10:e?6:-4,rotation:x&&!e&&90},o),s||(i.label=s=Dn.text(o.text,0,0).attr({align:o.textAlign||o.align,rotation:o.rotation,zIndex:n}).css(o.style).add()),e=[f[1],f[4],c(f[6],f[1])],f=[f[2],f[5],c(f[7],f[2])],t=G.apply(K,e),n=G.apply(K,f),s.align(o,!1,{x:t,y:n,width:V.apply(K,e)-t,height:V.apply(K,f)-n}),s.show()):s&&s.hide(),i},destroy:function(){for(var e in this)this[e]&&this[e].destroy&&this[e].destroy(),delete this[e];o(Qt,this)}},l.prototype={setTotal:function(e){this.cum=this.total=e},render:function(e){var t=this.options.formatter.call(this);this.label?this.label.attr({text:t,visibility:ht}):this.label=n.renderer.text(t,0,0).css(this.options.style).attr({align:this.textAlign,rotation:this.options.rotation,visibility:ht}).add(e)},setOffset:function(e,t){var i=this.isNegative,r=dt.translate(this.total),o=dt.translate(0);o=X(r-o);var a=n.xAxis[0].translate(this.x)+e,s=n.plotHeight;i={x:An?i?r:r-o:a,y:An?s-a-t:i?s-r-o:s-r,width:An?o:t,height:An?t:o},this.label&&this.label.align(this.alignOptions,null,i).attr({visibility:gt})}},H=function(e,t,n,i,r){var o=1,a=0,s=i?$:S;return i=i?ot:Et,s||(s=S),n&&(o*=-1,a=E),dn&&(o*=-1,a-=o*E),t?(dn&&(e=E-e),e=e/s+i,bt&&r&&(e=K.pow(10,e))):(bt&&r&&(e=K.log(e)/K.LN10),e=o*(e-i)*s+a),e},Y=function(e,t,n){var i,r,o;e=H(e,null,null,n);var a,s=n&&an||rn,l=n&&on||nn;return n=r=q(e+kt),i=o=q(s-e-kt),isNaN(e)?a=!0:x?(i=Mt,o=s-Ut,(Gt>n||n>Gt+yn)&&(a=!0)):(n=Gt,r=l-Wt,(Mt>i||i>Mt+vn)&&(a=!0)),a?null:Dn.crispLine([vt,n,i,yt,r,o],t||0)},An&&y&&dn===A&&(dn=!0),e(dt,{addPlotBand:m,addPlotLine:m,adjustTickAmount:function(){if(Sn&&!ft&&!ln&&!Rt){var e=Vt,t=Bt.length;if(Vt=Sn[xt],Vt>t){for(;Vt>Bt.length;)Bt.push(p(Bt[Bt.length-1]+Ft));S*=(t-1)/(Vt-1),Ct=Bt[Bt.length-1]}a(e)&&Vt!==e&&(dt.isDirty=!0)}},categories:ln,getExtremes:function(){return{min:Et,max:Ct,dataMin:et,dataMax:tt,userMin:it,userMax:rt}},getPlotLinePath:Y,getThreshold:function(e){return Et>e?e=Et:e>Ct&&(e=Ct),H(e,0,1)},isXAxis:y,options:i,plotLinesAndBands:Qt,getOffset:function(){var e,t=nt.length&&a(Et)&&a(Ct),n=0,o=0,s=i.title,l=i.labels,u=[-1,1,1,-1][k];if(J||(J=Dn.g("axis").attr({zIndex:7}).add(),Z=Dn.g("grid").attr({zIndex:1}).add()),Yt=0,t||Rt)Tt(Bt,function(e){en[e]?en[e].addLabel():en[e]=new r(e),(0===k||2===k||{1:"left",3:"right"}[k]===l.align)&&(Yt=V(en[e].getLabelSize(),Yt))}),un&&(Yt+=16*(un-1));else for(e in en)en[e].destroy(),delete en[e];s&&s.text&&(dt.axisTitle||(dt.axisTitle=Dn.text(s.text,0,0).attr({zIndex:7,rotation:s.rotation||0,align:s.textAlign||{low:"left",middle:"center",high:"right"}[s.align]}).css(s.style).add()),n=dt.axisTitle.getBBox()[x?"height":"width"],o=c(s.margin,x?5:10)),_t=u*(i.offset||Xt[k]),Jt=Yt+(2!==k&&Yt&&u*i.labels[x?"y":"x"])+o,Xt[k]=V(Xt[k],Jt+n+u*_t)},render:b,setCategories:function(e,t){dt.categories=ln=e,Tt(nt,function(e){e.translate(),e.setTooltipPoints(!0)}),dt.isDirty=!0,c(t,!0)&&n.redraw()},setExtremes:function(e,t,i,r){i=c(i,!0),Ot(dt,"setExtremes",{min:e,max:t},function(){it=e,rt=t,i&&n.redraw(r)})},setScale:g,setTickPositions:h,translate:H,redraw:function(){_n.resetTracker&&_n.resetTracker(),b(),Tt(Qt,function(e){e.render()}),Tt(nt,function(e){e.isDirty=!0})},removePlotBand:v,removePlotLine:v,reversed:dn,stacks:w});for(Lt in pt)It(dt,Lt,pt[Lt]);g()}function m(){var e={};return{add:function(t,n,i,o){e[t]||(n=Dn.text(n,0,0).css(r.toolbar.itemStyle).align({align:"right",x:-Wt-20,y:Mt+30}).on("click",o).attr({align:"right",zIndex:20}).add(),e[t]=n)},remove:function(t){b(e[t].element),e[t]=null}}}function v(e){function i(){var e=this.points||l(this),t=e[0].series.xAxis,i=this.x;t=t&&"datetime"===t.options.type;var r,o=n(i)||t;return r=o?['<span style="font-size: 10px">'+(t?T("%A, %b %e, %Y",i):i)+"</span>"]:[],Tt(e,function(e){r.push(e.point.tooltipFormatter(o))}),r.join("<br/>")}function r(e,t){v=b?e:(2*v+e)/3,y=b?t:(y+t)/2,_.translate(v,y),In=X(e-v)>1||X(t-y)>1?function(){r(e,t)}:null}function o(){if(!b){var e=Gn.hoverPoints;_.hide(),Tt(p,function(e){e&&e.hide()}),e&&Tt(e,function(e){e.setState()}),Gn.hoverPoints=null,b=!0}}var a,s,c,u=e.borderWidth,d=e.crosshairs,p=[],h=e.style,f=e.shared,g=t(h.padding),m=u+g,b=!0,v=0,y=0;h.padding=0;var _=Dn.g("tooltip").attr({zIndex:8}).add(),x=Dn.rect(m,m,0,0,e.borderRadius,u).attr({fill:e.backgroundColor,"stroke-width":u}).add(_).shadow(e.shadow),k=Dn.text("",g+m,t(h.fontSize)+g+m).attr({zIndex:1}).css(h).add(_);return _.hide(),{shared:f,refresh:function(t){var n,u,h,v=0,y={},w=[];if(h=t.tooltipPos,n=e.formatter||i,y=Gn.hoverPoints,f?(y&&Tt(y,function(e){e.setState()}),Gn.hoverPoints=t,Tt(t,function(e){e.setState(kt),v+=e.plotY,w.push(e.getLabelConfig())}),u=t[0].plotX,v=q(v)/t.length,y={x:t[0].category},y.points=w,t=t[0]):y=t.getLabelConfig(),y=n.call(y),a=t.series,u=f?u:t.plotX,v=f?v:t.plotY,n=q(h?h[0]:An?yn-v:u),u=q(h?h[1]:An?vn-u:v),h=f||!t.series.isCartesian||pn(n,u),y!==!1&&h?(b&&(_.show(),b=!1),k.attr({text:y}),h=k.getBBox(),s=h.width+2*g,c=h.height+2*g,x.attr({width:s,height:c,stroke:e.borderColor||t.color||a.color||"#606060"}),n=n-s+Gt-25,u=u-c+Mt+10,7>n&&(n=7,u-=30),5>u?u=5:u+c>rn&&(u=rn-c-5),r(q(n-m),q(u-m))):o(),d)for(d=l(d),n=d.length;n--;)u=t.series[n?"yAxis":"xAxis"],d[n]&&u&&(u=u.getPlotLinePath(t[n?"y":"x"],1),p[n]?p[n].attr({d:u,visibility:gt}):(h={"stroke-width":d[n].width||1,stroke:d[n].color||"#C0C0C0",zIndex:2},d[n].dashStyle&&(h.dashstyle=d[n].dashStyle),p[n]=Dn.path(u).attr(h).add()))},hide:o}}function y(t,n){function i(t){var n,i,r,o,a=it&&$.width/$.documentElement.clientWidth-1;if(t=t||H.event,t.target||(t.target=t.srcElement),n=t.touches?t.touches.item(0):t,"mousemove"!==t.type||H.opera||a){for(i=Zt,r={left:i.offsetLeft,top:i.offsetTop},i=i.offsetParent;i;)r.left+=i.offsetLeft,r.top+=i.offsetTop,i!==$.body&&i!==$.documentElement&&(r.left-=i.scrollLeft,r.top-=i.scrollTop),i=i.offsetParent;En=r,i=En.left,r=En.top}return tt?(o=t.x,n=t.y):n.layerX===A?(o=n.pageX-i,n=n.pageY-r):(o=t.layerX,n=t.layerY),a&&(o+=q((a+1)*i-i),n+=q((a+1)*r-r)),e(t,{chartX:o,chartY:n})}function r(e){var t={xAxis:[],yAxis:[]};return Tt(Zn,function(n){var i=n.translate,r=n.isXAxis;t[r?"xAxis":"yAxis"].push({axis:n,value:i((An?!r:r)?e.chartX-Gt:vn-e.chartY+Mt,!0)})}),t}function o(){var e=t.hoverSeries,n=t.hoverPoint;n&&n.onMouseOut(),e&&e.onMouseOut(),hn&&hn.hide(),On=null}function a(){if(d){var e={xAxis:[],yAxis:[]},n=d.getBBox(),i=n.x-Gt,r=n.y-Mt;u&&(Tt(Zn,function(t){var o=t.translate,a=t.isXAxis,s=An?!a:a,l=o(s?i:vn-r-n.height,!0,0,0,1);o=o(s?i+n.width:vn-r,!0,0,0,1),e[a?"xAxis":"yAxis"].push({axis:t,min:G(l,o),max:V(l,o)})}),Ot(t,"selection",e,Mn)),d=d.destroy()}t.mouseIsDown=fn=u=!1,Rt($,at?"touchend":"mouseup",a)}var l,c,u,d,p=wt.zoomType,h=/x/.test(p),f=/y/.test(p),g=h&&!An||f&&An,m=f&&!An||h&&An;kn=function(){xn?(xn.translate(Gt,Mt),An&&xn.attr({width:t.plotWidth,height:t.plotHeight}).invert()):t.trackerGroup=xn=Dn.g("tracker").attr({zIndex:9}).add()},kn(),n.enabled&&(t.tooltip=hn=v(n)),function(){var p=!0;Zt.onmousedown=function(e){e=i(e),t.mouseIsDown=fn=!0,l=e.chartX,c=e.chartY,It($,at?"touchend":"mouseup",a)};var b=function(e){if(!(e&&e.touches&&e.touches.length>1)){e=i(e),at||(e.returnValue=!1);var r=e.chartX,a=e.chartY,b=!pn(r-Gt,a-Mt);if(at&&"touchstart"===e.type&&(s(e.target,"isTracker")?t.runTrackerClick||e.preventDefault():!Xn&&!b&&e.preventDefault()),b&&(p||o(),Gt>r?r=Gt:r>Gt+yn&&(r=Gt+yn),Mt>a?a=Mt:a>Mt+vn&&(a=Mt+vn)),fn&&"touchstart"!==e.type)u=Math.sqrt(Math.pow(l-r,2)+Math.pow(c-a,2)),u>10&&(Yn&&(h||f)&&pn(l-Gt,c-Mt)&&(d||(d=Dn.rect(Gt,Mt,g?1:yn,m?1:vn,0).attr({fill:"rgba(69,114,167,0.25)",zIndex:7}).add())),d&&g&&(r-=l,d.attr({width:X(r),x:(r>0?0:r)+l})),d&&m&&(a-=c,d.attr({height:X(a),y:(a>0?0:a)+c})));else if(!b){var v;a=t.hoverPoint,r=t.hoverSeries;var y,_,x=nn,k=An?e.chartY:e.chartX-Gt;if(hn&&n.shared){for(v=[],y=Qn.length,_=0;y>_;_++)Qn[_].visible&&Qn[_].tooltipPoints.length&&(e=Qn[_].tooltipPoints[k],e._dist=X(k-e.plotX),x=G(x,e._dist),v.push(e));for(y=v.length;y--;)v[y]._dist>x&&v.splice(y,1);v.length&&v[0].plotX!==On&&(hn.refresh(v),On=v[0].plotX)}r&&r.tracker&&(e=r.tooltipPoints[k])&&e!==a&&e.onMouseOver()}return(p=b)||!Yn}};Zt.onmousemove=b,It(Zt,"mouseleave",o),Zt.ontouchstart=function(e){(h||f)&&Zt.onmousedown(e),b(e)},Zt.ontouchmove=b,Zt.ontouchend=function(){u&&o()},Zt.onclick=function(n){var o=t.hoverPoint;if(n=i(n),n.cancelBubble=!0,!u)if(o&&s(n.target,"isTracker")){var a=o.plotX,l=o.plotY;e(o,{pageX:En.left+Gt+(An?yn-l:a),pageY:En.top+Mt+(An?vn-a:l)}),Ot(o.series,"click",e(n,{point:o})),o.firePointEvent("click",n)}else e(n,r(n)),pn(n.chartX-Gt,n.chartY-Mt)&&Ot(t,"click",n);u=!1}}(),Rn=setInterval(function(){In&&In()},32),e(this,{zoomX:h,zoomY:f,resetTracker:o})}function w(e){var t=e.type||wt.type||wt.defaultSeriesType,n=Nt[t],i=Gn.hasRendered;return i&&(An&&"column"===t?n=Nt.bar:An||"bar"!==t||(n=Nt.column)),t=new n,t.init(Gn,e),!i&&t.inverted&&(An=!0),t.isCartesian&&(Yn=t.isCartesian),Qn.push(t),t}function S(){wt.alignTicks!==!1&&Tt(Zn,function(e){e.adjustTickAmount()}),Sn=null}function Y(e){var t,n=Gn.isDirtyLegend,i=Gn.isDirtyBox,r=Qn.length,o=r,a=Gn.clipRect;for(g(e,Gn);o--;)if(e=Qn[o],e.isDirty&&e.options.stacking){t=!0;break}if(t)for(o=r;o--;)e=Qn[o],e.options.stacking&&(e.isDirty=!0);Tt(Qn,function(e){e.isDirty&&(e.cleanData(),e.getSegments(),"point"===e.options.legendType&&(n=!0))}),n&&wn.renderLegend&&(wn.renderLegend(),Gn.isDirtyLegend=!1),Yn&&(Jn||(Sn=null,Tt(Zn,function(e){e.setScale()})),S(),Fn(),Tt(Zn,function(e){(e.isDirty||i)&&(e.redraw(),i=!0)})),i&&(Ln(),kn(),a&&(Ft(a),a.animate({width:Gn.plotSizeX,height:Gn.plotSizeY}))),Tt(Qn,function(e){e.isDirty&&e.visible&&(!e.isCartesian||e.xAxis)&&e.redraw()}),_n&&_n.resetTracker&&_n.resetTracker(),Ot(Gn,"redraw")}function J(){var e,t=r.xAxis||{},n=r.yAxis||{};t=l(t),Tt(t,function(e,t){e.index=t,e.isX=!0}),n=l(n),Tt(n,function(e,t){e.index=t}),Zn=t.concat(n),Gn.xAxis=[],Gn.yAxis=[],Zn=St(Zn,function(t){return e=new h(Gn,t),Gn[e.isXAxis?"xAxis":"yAxis"].push(e),e}),S()}function Z(e,t){Pt=At(r.title,e),Bt=At(r.subtitle,t),Tt([["title",e,Pt],["subtitle",t,Bt]],function(e){var t=e[0],n=Gn[t],i=e[1];e=e[2],n&&i&&(n.destroy(),n=null),e&&e.text&&!n&&(Gn[t]=Dn.text(e.text,0,0).attr({align:e.align,"class":"highcharts-"+t,zIndex:1}).css(e.style).add().align(e,!1,Dt))})}function Q(){Yt=wt.renderTo,Qt=ft+lt++,n(Yt)&&(Yt=$.getElementById(Yt)),Yt.innerHTML="",Yt.offsetWidth||(Jt=Yt.cloneNode(0),d(Jt,{position:dt,top:"-9999px",display:""}),$.body.appendChild(Jt)),en=(Jt||Yt).offsetWidth,tn=(Jt||Yt).offsetHeight,Gn.chartWidth=nn=wt.width||en||600,Gn.chartHeight=rn=wt.height||(tn>19?tn:400),Gn.container=Zt=p(ut,{className:"highcharts-container"+(wt.className?" "+wt.className:""),id:Qt},e({position:pt,overflow:ht,width:nn+mt,height:rn+mt,textAlign:"left"},wt.style),Jt||Yt),Gn.renderer=Dn=wt.forExport?new Vt(Zt,nn,rn,!0):new _(Zt,nn,rn);var i,r;rt&&Zt.getBoundingClientRect&&(i=function(){d(Zt,{left:0,top:0}),r=Zt.getBoundingClientRect(),d(Zt,{left:-(r.left-t(r.left))+mt,top:-(r.top-t(r.top))+mt})},i(),It(H,"resize",i),It(Gn,"destroy",function(){Rt(H,"resize",i)}))}function et(){function e(){var e=wt.width||Yt.offsetWidth,n=wt.height||Yt.offsetHeight;e&&n&&((e!==en||n!==tn)&&(clearTimeout(t),t=setTimeout(function(){Bn(e,n,!1)},100)),en=e,tn=n)}var t;It(H,"resize",e),It(Gn,"destroy",function(){Rt(H,"resize",e)})}function nt(){var n,i=r.labels,o=r.credits;Z(),wn=Gn.legend=new ei(Gn),Fn(),Tt(Zn,function(e){e.setTickPositions(!0)}),S(),Fn(),Ln(),Yn&&Tt(Zn,function(e){e.render()}),Gn.seriesGroup||(Gn.seriesGroup=Dn.g("series-group").attr({zIndex:3}).add()),Tt(Qn,function(e){e.translate(),e.setTooltipPoints(),e.render()}),i.items&&Tt(i.items,function(){var n=e(i.style,this.style),r=t(n.left)+Gt,o=t(n.top)+Mt+12;delete n.left,delete n.top,Dn.text(this.html,r,o).attr({zIndex:2}).css(n).add()}),Gn.toolbar||(Gn.toolbar=m(Gn)),o.enabled&&!Gn.credits&&(n=o.href,Dn.text(o.text,0,0).on("click",function(){n&&(location.href=n)}).attr({align:o.position.align,zIndex:8}).css(o.style).add().align(o.position)),kn(),Gn.hasRendered=!0,Jt&&(Yt.appendChild(Zt),b(Jt))}function st(){var e=Qn.length,t=Zt&&Zt.parentNode;for(Ot(Gn,"destroy"),Rt(H,"unload",st),Rt(Gn),Tt(Zn,function(e){Rt(e)});e--;)Qn[e].destroy();Zt&&(Zt.innerHTML="",Rt(Zt),t&&t.removeChild(Zt),Zt=null),Dn&&(Dn.alignedObjects=null),clearInterval(Rn);for(e in Gn)delete Gn[e]}function _t(){ot||H!=H.top||"complete"===$.readyState?(k=x=0,Q(),Nn(),Pn(),Tt(r.series||[],function(e){w(e)}),Gn.inverted=An=c(An,r.chart.inverted),J(),Gn.render=nt,Gn.tracker=_n=new y(Gn,r.tooltip),nt(),Ot(Gn,"load"),u&&u.apply(Gn,[Gn]),Tt(Gn.callbacks,function(e){e.apply(Gn,[Gn])})):$.attachEvent("onreadystatechange",function(){$.detachEvent("onreadystatechange",_t),"complete"===$.readyState&&_t()})}jt=At(jt,C.xAxis),zt=At(zt,C.yAxis),C.xAxis=C.yAxis=null,r=At(C,r);var wt=r.chart,Ct=wt.margin;Ct=i(Ct)?Ct:[Ct,Ct,Ct,Ct];var Dt,Pt,Bt,Mt,Wt,Ut,Gt,Xt,Yt,Jt,Zt,Qt,en,tn,nn,rn,on,an,sn,ln,cn,un,dn,pn,hn,fn,gn,mn,bn,vn,yn,_n,xn,kn,wn,Cn,Tn,En,Sn,An,Dn,In,Rn,On,Ln,Fn,Nn,Pn,Bn,Mn,jn,zn=c(wt.marginTop,Ct[0]),$n=c(wt.marginRight,Ct[1]),Hn=c(wt.marginBottom,Ct[2]),Kn=c(wt.marginLeft,Ct[3]),qn=wt.spacingTop,Wn=wt.spacingRight,Un=wt.spacingBottom,Vn=wt.spacingLeft,Gn=this,Xn=(Ct=wt.events)&&!!Ct.click,Yn=wt.showAxes,Jn=0,Zn=[],Qn=[],ei=function(n){function i(e,t){var n=e.legendItem,i=e.legendLine,r=e.legendSymbol,o=T.color,a=t?l.itemStyle.color:o,s=t?e.color:o;o=t?e.pointAttr[xt]:{stroke:o,fill:o},n&&n.css({fill:a}),i&&i.attr({stroke:s}),r&&r.attr(o)}function r(e,t,n){var i=e.legendItem,r=e.legendLine,o=e.legendSymbol;e=e.checkbox,i&&i.attr({x:t,y:n}),r&&r.translate(t,n-4),o&&o.attr({x:t+o.xOff,y:n+o.yOff}),e&&(e.x=t,e.y=n)}function o(){Tt(c,function(e){var t=e.checkbox,n=m.alignAttr;t&&d(t,{left:n.translateX+e.legendItemWidth+t.x-40+mt,top:n.translateY+t.y-11+mt})})}function a(e){var t,n,o,a,s=e.legendItem;a=e.series||e;var c=a.options,d=c&&c.borderWidth||0;if(!s){if(a=/^(bar|pie|area|column)$/.test(a.type),e.legendItem=s=Dn.text(l.labelFormatter.call(e),0,0).css(e.visible?w:T).on("mouseover",function(){e.setState(kt),s.css(C)}).on("mouseout",function(){s.css(e.visible?w:T),e.setState()}).on("click",function(){var t=function(){e.setVisible()};e.firePointEvent?e.firePointEvent("legendItemClick",null,t):Ot(e,"legendItemClick",null,t)}).attr({zIndex:2}).add(m),!a&&c&&c.lineWidth){var g={"stroke-width":c.lineWidth,zIndex:2};c.dashStyle&&(g.dashstyle=c.dashStyle),e.legendLine=Dn.path([vt,-_-x,0,yt,-x,0]).attr(g).add(m)}a?t=Dn.rect(n=-_-x,o=-11,_,12,2).attr({zIndex:3}).add(m):c&&c.marker&&c.marker.enabled&&(t=Dn.symbol(e.symbol,n=-_/2-x,o=-4,c.marker.radius).attr({zIndex:3}).add(m)),t&&(t.xOff=n+d%2/2,t.yOff=o+d%2/2),e.legendSymbol=t,i(e,e.visible),c&&c.showCheckbox&&(e.checkbox=p("input",{type:"checkbox",checked:e.selected,defaultChecked:e.selected},l.itemCheckboxStyle,Zt),It(e.checkbox,"click",function(t){Ot(e,"checkboxClick",{checked:t.target.checked},function(){e.select()})}))}t=s.getBBox(),n=e.legendItemWidth=l.itemWidth||_+x+t.width+S,I=t.height,y&&u-D+n>(L||nn-2*E-D)&&(u=D,h+=I),f=h,r(e,u,h),y?u+=n:h+=I,v=L||V(y?u-D:n,v)}function s(){u=D,h=A,f=v=0,m||(m=Dn.g("legend").attr({zIndex:7}).add()),c=[],Tt(F,function(e){var t=e.options;t.showInLegend&&(c=c.concat("point"===t.legendType?e.data:e))}),c.sort(function(e,t){return(e.options.legendIndex||0)-(t.options.legendIndex||0)}),N&&c.reverse(),Tt(c,a),Cn=L||v,Tn=f-A+I,(R||O)&&(Cn+=2*E,Tn+=2*E,g?Cn>0&&Tn>0&&g.animate(g.crisp(null,null,null,Cn,Tn)):g=Dn.rect(0,0,Cn,Tn,l.borderRadius,R||0).attr({stroke:l.borderColor,"stroke-width":R||0,fill:O||bt}).add(m).shadow(l.shadow),g[c.length?"show":"hide"]());for(var n,i=["left","right","top","bottom"],r=4;r--;)n=i[r],k[n]&&"auto"!==k[n]&&(l[2>r?"align":"verticalAlign"]=n,l[2>r?"x":"y"]=t(k[n])*(r%2?-1:1));m.align(e(l,{width:Cn,height:Tn}),!0,Dt),Jn||o()}var l=n.options.legend;if(l.enabled){var c,u,h,f,g,m,v,y="horizontal"===l.layout,_=l.symbolWidth,x=l.symbolPadding,k=l.style,w=l.itemStyle,C=l.itemHoverStyle,T=l.itemHiddenStyle,E=t(k.padding),S=20,A=18,D=4+E+_+x,I=0,R=l.borderWidth,O=l.backgroundColor,L=l.width,F=n.series,N=l.reversed;return s(),It(n,"endResize",o),{colorizeItem:i,destroyItem:function(e){var t=e.checkbox;Tt(["legendItem","legendLine","legendSymbol"],function(t){e[t]&&e[t].destroy()}),t&&b(e.checkbox)},renderLegend:s}}};if(pn=function(e,t){return e>=0&&yn>=e&&t>=0&&vn>=t},jn=function(){Ot(Gn,"selection",{resetSelection:!0},Mn),Gn.toolbar.remove("zoom")},Mn=function(e){var t=C.lang,n=100>Gn.pointCount;Gn.toolbar.add("zoom",t.resetZoom,t.resetZoomTitle,jn),!e||e.resetSelection?Tt(Zn,function(e){e.setExtremes(null,null,!1,n)}):Tt(e.xAxis.concat(e.yAxis),function(e){var t=e.axis;Gn.tracker[t.isXAxis?"zoomX":"zoomY"]&&t.setExtremes(e.min,e.max,!1,n)}),Y()},Fn=function(){var e,t=r.legend,n=c(t.margin,10),i=t.x,o=t.y,s=t.align,l=t.verticalAlign;Nn(),!Gn.title&&!Gn.subtitle||a(zn)||(e=V(Gn.title&&!Pt.floating&&!Pt.verticalAlign&&Pt.y||0,Gn.subtitle&&!Bt.floating&&!Bt.verticalAlign&&Bt.y||0))&&(Mt=V(Mt,e+c(Pt.margin,15)+qn)),t.enabled&&!t.floating&&("right"===s?a($n)||(Wt=V(Wt,Cn-i+n+Wn)):"left"===s?a(Kn)||(Gt=V(Gt,Cn+i+n+Vn)):"top"===l?a(zn)||(Mt=V(Mt,Tn+o+n+qn)):"bottom"===l&&(a(Hn)||(Ut=V(Ut,Tn-o+n+Un)))),Yn&&Tt(Zn,function(e){e.getOffset()}),a(Kn)||(Gt+=Xt[3]),a(zn)||(Mt+=Xt[0]),a(Hn)||(Ut+=Xt[2]),a($n)||(Wt+=Xt[1]),Pn()},Bn=function(e,t,n){var i=Gn.title,r=Gn.subtitle;Jn+=1,g(n,Gn),an=rn,on=nn,Gn.chartWidth=nn=q(e),Gn.chartHeight=rn=q(t),d(Zt,{width:nn+mt,height:rn+mt}),Dn.setSize(nn,rn,n),yn=nn-Gt-Wt,vn=rn-Mt-Ut,Sn=null,Tt(Zn,function(e){e.isDirty=!0,e.setScale()}),Tt(Qn,function(e){e.isDirty=!0}),Gn.isDirtyLegend=!0,Gn.isDirtyBox=!0,Fn(),i&&i.align(null,null,Dt),r&&r.align(null,null,Dt),Y(n),an=null,Ot(Gn,"resize"),setTimeout(function(){Ot(Gn,"endResize",null,function(){Jn-=1})},E&&E.duration||500)},Pn=function(){Gn.plotLeft=Gt=q(Gt),Gn.plotTop=Mt=q(Mt),Gn.plotWidth=yn=q(nn-Gt-Wt),Gn.plotHeight=vn=q(rn-Mt-Ut),Gn.plotSizeX=An?vn:yn,Gn.plotSizeY=An?yn:vn,Dt={x:Vn,y:qn,width:nn-Vn-Wn,height:rn-qn-Un}},Nn=function(){Mt=c(zn,qn),Wt=c($n,Wn),Ut=c(Hn,Un),Gt=c(Kn,Vn),Xt=[0,0,0,0]},Ln=function(){var e,t=wt.borderWidth||0,n=wt.backgroundColor,i=wt.plotBackgroundColor,r=wt.plotBackgroundImage,o={x:Gt,y:Mt,width:yn,height:vn};e=t+(wt.shadow?8:0),(t||n)&&(sn?sn.animate(sn.crisp(null,null,null,nn-e,rn-e)):sn=Dn.rect(e/2,e/2,nn-e,rn-e,wt.borderRadius,t).attr({stroke:wt.borderColor,"stroke-width":t,fill:n||bt}).add().shadow(wt.shadow)),i&&(ln?ln.animate(o):ln=Dn.rect(Gt,Mt,yn,vn,0).attr({fill:i}).add().shadow(wt.plotShadow)),r&&(cn?cn.animate(o):cn=Dn.image(r,Gt,Mt,yn,vn).add()),wt.plotBorderWidth&&(un?un.animate(un.crisp(null,Gt,Mt,yn,vn)):un=Dn.rect(Gt,Mt,yn,vn,0,wt.plotBorderWidth).attr({stroke:wt.plotBorderColor,"stroke-width":wt.plotBorderWidth,zIndex:4}).add()),Gn.isDirtyBox=!1},It(H,"unload",st),wt.reflow!==!1&&It(Gn,"load",et),Ct)for(dn in Ct)It(Gn,dn,Ct[dn]);Gn.options=r,Gn.series=Qn,Gn.addSeries=function(e,t,n){var i;return e&&(g(n,Gn),t=c(t,!0),Ot(Gn,"addSeries",{options:e},function(){i=w(e),i.isDirty=!0,Gn.isDirtyLegend=!0,t&&Gn.redraw()})),i},Gn.animation=c(wt.animation,!0),Gn.destroy=st,Gn.get=function(e){var t,n,i;for(t=0;Zn.length>t;t++)if(Zn[t].options.id===e)return Zn[t];for(t=0;Qn.length>t;t++)if(Qn[t].options.id===e)return Qn[t];for(t=0;Qn.length>t;t++)for(i=Qn[t].data,n=0;i.length>n;n++)if(i[n].id===e)return i[n];return null},Gn.getSelectedPoints=function(){var e=[];return Tt(Qn,function(t){e=e.concat(Et(t.data,function(e){return e.selected}))}),e},Gn.getSelectedSeries=function(){return Et(Qn,function(e){return e.selected})},Gn.hideLoading=function(){Lt(gn,{opacity:0},{duration:r.loading.hideDuration,complete:function(){d(gn,{display:bt})}}),bn=!1},Gn.isInsidePlot=pn,Gn.redraw=Y,Gn.setSize=Bn,Gn.setTitle=Z,Gn.showLoading=function(t){var n=r.loading;gn||(gn=p(ut,{className:"highcharts-loading"},e(n.style,{left:Gt+mt,top:Mt+mt,width:yn+mt,height:vn+mt,zIndex:10,display:bt}),Zt),mn=p("span",null,n.labelStyle,gn)),mn.innerHTML=t||r.lang.loading,bn||(d(gn,{opacity:0,display:""}),Lt(gn,{opacity:n.style.opacity},{duration:n.showDuration}),bn=!0)},Gn.pointCount=0,_t()}var _,x,k,w,C,T,E,S,A,D,I,R,O,L,F,N,P,B,M,j,z,$=document,H=window,K=Math,q=K.round,W=K.floor,U=K.ceil,V=K.max,G=K.min,X=K.abs,Y=K.cos,J=K.sin,Z=K.PI,Q=2*Z/360,et=navigator.userAgent,tt=/msie/i.test(et)&&!H.opera,nt=8===$.documentMode,it=/AppleWebKit/.test(et),rt=/Firefox/.test(et),ot=!!$.createElementNS&&!!$.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect,at=void 0!==$.documentElement.ontouchstart,st={},lt=0,ct=1,ut="div",dt="absolute",pt="relative",ht="hidden",ft="highcharts-",gt="visible",mt="px",bt="none",vt="M",yt="L",_t="rgba(192,192,192,"+(ot?1e-6:.002)+")",xt="",kt="hover",wt=H.HighchartsAdapter,Ct=wt||{},Tt=Ct.each,Et=Ct.grep,St=Ct.map,At=Ct.merge,Dt=Ct.hyphenate,It=Ct.addEvent,Rt=Ct.removeEvent,Ot=Ct.fireEvent,Lt=Ct.animate,Ft=Ct.stop,Nt={};if(T=function(e,t,n){function i(e){return(""+e).replace(/^([0-9])$/,"0$1")}if(!a(t)||isNaN(t))return"Invalid date";e=c(e,"%Y-%m-%d %H:%M:%S"),t=new Date(t*ct);var r,o=t[R](),s=t[O](),l=t[L](),u=t[F](),d=t[N](),p=C.lang,h=p.weekdays;p=p.months,t={a:h[s].substr(0,3),A:h[s],d:i(l),e:l,b:p[u].substr(0,3),B:p[u],m:i(u+1),y:(""+d).substr(2,2),Y:d,H:i(o),I:i(o%12||12),l:o%12||12,M:i(t[I]()),p:12>o?"AM":"PM",P:12>o?"am":"pm",S:i(t.getSeconds())};for(r in t)e=e.replace("%"+r,t[r]);return n?e.substr(0,1).toUpperCase()+e.substr(1):e},wt&&wt.init&&wt.init(),!wt&&H.jQuery){var Pt=jQuery;Tt=function(e,t){for(var n=0,i=e.length;i>n;n++)if(t.call(e[n],e[n],n,e)===!1)return n},Et=Pt.grep,St=function(e,t){for(var n=[],i=0,r=e.length;r>i;i++)n[i]=t.call(e[i],e[i],i,e); return n},At=function(){var e=arguments;return Pt.extend(!0,null,e[0],e[1],e[2],e[3])},Dt=function(e){return e.replace(/([A-Z])/g,function(e,t){return"-"+t.toLowerCase()})},It=function(e,t,n){Pt(e).bind(t,n)},Rt=function(e,t,n){var i=$.removeEventListener?"removeEventListener":"detachEvent";$[i]&&!e[i]&&(e[i]=function(){}),Pt(e).unbind(t,n)},Ot=function(t,n,i,r){var o=Pt.Event(n),a="detached"+n;e(o,i),t[n]&&(t[a]=t[n],t[n]=null),Pt(t).trigger(o),t[a]&&(t[n]=t[a],t[a]=null),r&&!o.isDefaultPrevented()&&r(o)},Lt=function(e,t,n){var i=Pt(e);t.d&&(e.toD=t.d,t.d=1),i.stop(),i.animate(t,n)},Ft=function(e){Pt(e).stop()},Pt.extend(Pt.easing,{easeOutQuad:function(e,t,n,i,r){return-i*(t/=r)*(t-2)+n}});var Bt=jQuery.fx.step._default,Mt=jQuery.fx.prototype.cur;Pt.fx.step._default=function(e){var t=e.elem;t.attr?t.attr(e.prop,e.now):Bt.apply(this,arguments)},Pt.fx.step.d=function(e){var t=e.elem;if(!e.started){var n=S.init(t,t.d,t.toD);e.start=n[0],e.end=n[1],e.started=!0}t.attr("d",S.step(e.start,e.end,e.pos,t.toD))},Pt.fx.prototype.cur=function(){var e=this.elem;return e.attr?e.attr(this.prop):Mt.apply(this,arguments)}}S={init:function(e,t,n){t=t||"";var i,r=e.shift,o=t.indexOf("C")>-1,a=o?7:3;t=t.split(" "),n=[].concat(n);var s,l,c=function(e){for(i=e.length;i--;)e[i]===vt&&e.splice(i+1,0,e[i+1],e[i+2],e[i+1],e[i+2])};if(o&&(c(t),c(n)),e.isArea&&(s=t.splice(t.length-6,6),l=n.splice(n.length-6,6)),r&&(n=[].concat(n).splice(0,a).concat(n),e.shift=!1),t.length)for(e=n.length;e>t.length;)r=[].concat(t).splice(t.length-a,a),o&&(r[a-6]=r[a-2],r[a-5]=r[a-1]),t=t.concat(r);return s&&(t=t.concat(s),n=n.concat(l)),[t,n]},step:function(e,t,n,i){var r=[],o=e.length;if(1===n)r=i;else if(o===t.length&&1>n)for(;o--;)i=parseFloat(e[o]),r[o]=isNaN(i)?e[o]:n*parseFloat(t[o]-i)+i;else r=t;return r}},wt={enabled:!0,align:"center",x:0,y:15,style:{color:"#666",fontSize:"11px",lineHeight:"14px"}},C={colors:["#4572A7","#AA4643","#89A54E","#80699B","#3D96AE","#DB843D","#92A8CD","#A47D7C","#B5CA92"],symbols:["circle","diamond","square","triangle","triangle-down"],lang:{loading:"Loading...",months:["January","February","March","April","May","June","July","August","September","October","November","December"],weekdays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],decimalPoint:".",resetZoom:"Reset zoom",resetZoomTitle:"Reset zoom level 1:1",thousandsSep:","},global:{useUTC:!0},chart:{borderColor:"#4572A7",borderRadius:5,defaultSeriesType:"line",ignoreHiddenSeries:!0,spacingTop:10,spacingRight:10,spacingBottom:15,spacingLeft:10,style:{fontFamily:'"Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif',fontSize:"12px"},backgroundColor:"#FFFFFF",plotBorderColor:"#C0C0C0"},title:{text:"Chart title",align:"center",y:15,style:{color:"#3E576F",fontSize:"16px"}},subtitle:{text:"",align:"center",y:30,style:{color:"#6D869F"}},plotOptions:{line:{allowPointSelect:!1,showCheckbox:!1,animation:{duration:1e3},events:{},lineWidth:2,shadow:!0,marker:{enabled:!0,lineWidth:0,radius:4,lineColor:"#FFFFFF",states:{hover:{},select:{fillColor:"#FFFFFF",lineColor:"#000000",lineWidth:2}}},point:{events:{}},dataLabels:At(wt,{enabled:!1,y:-6,formatter:function(){return this.y}}),showInLegend:!0,states:{hover:{marker:{}},select:{marker:{}}},stickyTracking:!0}},labels:{style:{position:dt,color:"#3E576F"}},legend:{enabled:!0,align:"center",layout:"horizontal",labelFormatter:function(){return this.name},borderWidth:1,borderColor:"#909090",borderRadius:5,shadow:!1,style:{padding:"5px"},itemStyle:{cursor:"pointer",color:"#3E576F"},itemHoverStyle:{cursor:"pointer",color:"#000000"},itemHiddenStyle:{color:"#C0C0C0"},itemCheckboxStyle:{position:dt,width:"13px",height:"13px"},symbolWidth:16,symbolPadding:5,verticalAlign:"bottom",x:0,y:0},loading:{hideDuration:100,labelStyle:{fontWeight:"bold",position:pt,top:"1em"},showDuration:100,style:{position:dt,backgroundColor:"white",opacity:.5,textAlign:"center"}},tooltip:{enabled:!0,backgroundColor:"rgba(255, 255, 255, .85)",borderWidth:2,borderRadius:5,shadow:!0,snap:at?25:10,style:{color:"#333333",fontSize:"12px",padding:"5px",whiteSpace:"nowrap"}},toolbar:{itemStyle:{color:"#4572A7",cursor:"pointer"}},credits:{enabled:!0,text:"Highcharts.com",href:"http://www.highcharts.com",position:{align:"right",x:-10,verticalAlign:"bottom",y:-5},style:{cursor:"pointer",color:"#909090",fontSize:"10px"}}};var jt={dateTimeLabelFormats:{second:"%H:%M:%S",minute:"%H:%M",hour:"%H:%M",day:"%e. %b",week:"%e. %b",month:"%b '%y",year:"%Y"},endOnTick:!1,gridLineColor:"#C0C0C0",labels:wt,lineColor:"#C0D0E0",lineWidth:1,max:null,min:null,minPadding:.01,maxPadding:.01,minorGridLineColor:"#E0E0E0",minorGridLineWidth:1,minorTickColor:"#A0A0A0",minorTickLength:2,minorTickPosition:"outside",startOfWeek:1,startOnTick:!1,tickColor:"#C0D0E0",tickLength:5,tickmarkPlacement:"between",tickPixelInterval:100,tickPosition:"outside",tickWidth:1,title:{align:"middle",style:{color:"#6D869F",fontWeight:"bold"}},type:"linear"},zt=At(jt,{endOnTick:!0,gridLineWidth:1,tickPixelInterval:72,showLastLabel:!0,labels:{align:"right",x:-8,y:3},lineWidth:0,maxPadding:.05,minPadding:.05,startOnTick:!0,tickWidth:0,title:{rotation:270,text:"Y-values"},stackLabels:{enabled:!1,formatter:function(){return this.total},style:wt.style}}),$t={labels:{align:"right",x:-8,y:null},title:{rotation:270}},Ht={labels:{align:"left",x:8,y:null},title:{rotation:90}},Kt={labels:{align:"center",x:0,y:14},title:{rotation:0}},qt=At(Kt,{labels:{y:-5}}),Wt=C.plotOptions;wt=Wt.line,Wt.spline=At(wt),Wt.scatter=At(wt,{lineWidth:0,states:{hover:{lineWidth:0}}}),Wt.area=At(wt,{}),Wt.areaspline=At(Wt.area),Wt.column=At(wt,{borderColor:"#FFFFFF",borderWidth:1,borderRadius:0,groupPadding:.2,marker:null,pointPadding:.1,minPointLength:0,states:{hover:{brightness:.1,shadow:!1},select:{color:"#C0C0C0",borderColor:"#000000",shadow:!1}},dataLabels:{y:null,verticalAlign:null}}),Wt.bar=At(Wt.column,{dataLabels:{align:"left",x:5,y:0}}),Wt.pie=At(wt,{borderColor:"#FFFFFF",borderWidth:1,center:["50%","50%"],colorByPoint:!0,dataLabels:{distance:30,enabled:!0,formatter:function(){return this.point.name},y:5},legendType:"point",marker:null,size:"75%",showInLegend:!1,slicedOffset:10,states:{hover:{brightness:.1,shadow:!1}}}),m();var Ut=function(e){var n,i=[];return function(e){(n=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]?(?:\.[0-9]+)?)\s*\)/.exec(e))?i=[t(n[1]),t(n[2]),t(n[3]),parseFloat(n[4],10)]:(n=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(e))&&(i=[t(n[1],16),t(n[2],16),t(n[3],16),1])}(e),{get:function(t){return i&&!isNaN(i[0])?"rgb"===t?"rgb("+i[0]+","+i[1]+","+i[2]+")":"a"===t?i[3]:"rgba("+i.join(",")+")":e},brighten:function(e){if(r(e)&&0!==e){var n;for(n=0;3>n;n++)i[n]+=t(255*e),0>i[n]&&(i[n]=0),i[n]>255&&(i[n]=255)}return this},setOpacity:function(e){return i[3]=e,this}}};v.prototype={init:function(e,t){this.element=$.createElementNS("http://www.w3.org/2000/svg",t),this.renderer=e},animate:function(e,t,n){(t=c(t,E,!0))?(t=At(t),n&&(t.complete=n),Lt(this,e,t)):(this.attr(e),n&&n())},attr:function(e,i){var r,o,l,c,u,d,p=this.element,h=p.nodeName,f=this.renderer,g=this.shadows,m=this;if(n(e)&&a(i)&&(r=e,e={},e[r]=i),n(e))r=e,"circle"===h?r={x:"cx",y:"cy"}[r]||r:"strokeWidth"===r&&(r="stroke-width"),m=s(p,r)||this[r]||0,"d"!==r&&"visibility"!==r&&(m=parseFloat(m));else for(r in e){if(u=!1,o=e[r],"d"===r)o&&o.join&&(o=o.join(" ")),/(NaN| {2}|^$)/.test(o)&&(o="M 0 0"),this.d=o;else if("x"===r&&"text"===h){for(l=0;p.childNodes.length>l;l++)c=p.childNodes[l],s(c,"x")===s(p,"x")&&s(c,"x",o);this.rotation&&s(p,"transform","rotate("+this.rotation+" "+o+" "+t(e.y||s(p,"y"))+")")}else if("fill"===r)o=f.color(o,p,r);else if("circle"!==h||"x"!==r&&"y"!==r)if("translateX"===r||"translateY"===r||"rotation"===r||"verticalAlign"===r)this[r]=o,this.updateTransform(),u=!0;else if("stroke"===r)o=f.color(o,p,r);else if("dashstyle"===r){if(r="stroke-dasharray",o=o&&o.toLowerCase(),"solid"===o)o=bt;else if(o){for(o=o.replace("shortdashdotdot","3,1,1,1,1,1,").replace("shortdashdot","3,1,1,1").replace("shortdot","1,1,").replace("shortdash","3,1,").replace("longdash","8,3,").replace(/dot/g,"1,3,").replace("dash","4,3,").replace(/,$/,"").split(","),l=o.length;l--;)o[l]=t(o[l])*e["stroke-width"];o=o.join(",")}}else"isTracker"===r?this[r]=o:"width"===r?o=t(o):"align"===r&&(r="text-anchor",o={left:"start",center:"middle",right:"end"}[o]);else r={x:"cx",y:"cy"}[r]||r;if("strokeWidth"===r&&(r="stroke-width"),it&&"stroke-width"===r&&0===o&&(o=1e-6),this.symbolName&&/^(x|y|r|start|end|innerR)/.test(r)&&(d||(this.symbolAttr(e),d=!0),u=!0),g&&/^(width|height|visibility|x|y|d)$/.test(r))for(l=g.length;l--;)s(g[l],r,o);("width"===r||"height"===r)&&"rect"===h&&0>o&&(o=0),"text"===r?(this.textStr=o,this.added&&f.buildText(this)):u||s(p,r,o)}return m},symbolAttr:function(e){var t=this;Tt(["x","y","r","start","end","width","height","innerR"],function(n){t[n]=c(e[n],t[n])}),t.attr({d:t.renderer.symbols[t.symbolName](q(2*t.x)/2,q(2*t.y)/2,t.r,{start:t.start,end:t.end,width:t.width,height:t.height,innerR:t.innerR})})},clip:function(e){return this.attr("clip-path","url("+this.renderer.url+"#"+e.id+")")},crisp:function(e,t,n,i,r){var o,a,s={},l={};e=e||this.strokeWidth||0,a=e%2/2,l.x=W(t||this.x||0)+a,l.y=W(n||this.y||0)+a,l.width=W((i||this.width||0)-2*a),l.height=W((r||this.height||0)-2*a),l.strokeWidth=e;for(o in l)this[o]!==l[o]&&(this[o]=s[o]=l[o]);return s},css:function(t){var n=this.element;n=t&&t.width&&"text"===n.nodeName;var i,r=t;if(t&&t.color&&(t.fill=t.color),this.styles=t=e(this.styles,t),a(t)){t={};for(i in r)t[Dt(i)]=r[i]}return tt&&!ot?(n&&delete t.width,d(this.element,t)):this.attr({style:u(t)}),n&&this.added&&this.renderer.buildText(this),this},on:function(e,t){var n=t;return at&&"click"===e&&(e="touchstart",n=function(e){e.preventDefault(),t()}),this.element["on"+e]=n,this},translate:function(e,t){return this.attr({translateX:e,translateY:t})},invert:function(){return this.inverted=!0,this.updateTransform(),this},updateTransform:function(){var e=this.translateX||0,t=this.translateY||0,n=this.inverted,i=this.rotation,r=[];n&&(e+=this.attr("width"),t+=this.attr("height")),(e||t)&&r.push("translate("+e+","+t+")"),n?r.push("rotate(90) scale(-1,1)"):i&&r.push("rotate("+i+" "+this.x+" "+this.y+")"),r.length&&s(this.element,"transform",r.join(" "))},toFront:function(){var e=this.element;return e.parentNode.appendChild(e),this},align:function(e,t,n){e?(this.alignOptions=e,this.alignByTranslate=t,n||this.renderer.alignedObjects.push(this)):(e=this.alignOptions,t=this.alignByTranslate),n=c(n,this.renderer);var i=e.align,r=e.verticalAlign,o=(n.x||0)+(e.x||0),a=(n.y||0)+(e.y||0),s={};return/^(right|center)$/.test(i)&&(o+=(n.width-(e.width||0))/{right:1,center:2}[i]),s[t?"translateX":"x"]=q(o),/^(bottom|middle)$/.test(r)&&(a+=(n.height-(e.height||0))/({bottom:1,middle:2}[r]||1)),s[t?"translateY":"y"]=q(a),this[this.placed?"animate":"attr"](s),this.placed=!0,this.alignAttr=s,this},getBBox:function(){var t,n,i,r=this.rotation,o=r*Q;try{t=e({},this.element.getBBox())}catch(a){t={width:0,height:0}}return n=t.width,i=t.height,r&&(t.width=X(i*J(o))+X(n*Y(o)),t.height=X(i*Y(o))+X(n*J(o))),t},show:function(){return this.attr({visibility:gt})},hide:function(){return this.attr({visibility:ht})},add:function(e){var n=this.renderer,i=e||n,r=i.element||n.box,o=r.childNodes,l=this.element,c=s(l,"zIndex");if(this.parentInverted=e&&e.inverted,void 0!==this.textStr&&n.buildText(this),c&&(i.handleZ=!0,c=t(c)),i.handleZ)for(i=0;o.length>i;i++)if(e=o[i],n=s(e,"zIndex"),e!==l&&(t(n)>c||!a(c)&&a(n)))return r.insertBefore(l,e),this;return r.appendChild(l),this.added=!0,this},destroy:function(){var e,t=this.element||{},n=this.shadows,i=t.parentNode;t.onclick=t.onmouseout=t.onmouseover=t.onmousemove=null,Ft(this),i&&i.removeChild(t),n&&Tt(n,function(e){(i=e.parentNode)&&i.removeChild(e)}),o(this.renderer.alignedObjects,this);for(e in this)delete this[e];return null},empty:function(){for(var e=this.element,t=e.childNodes,n=t.length;n--;)e.removeChild(t[n])},shadow:function(e,t){var n,i,r=[],o=this.element,a=this.parentInverted?"(-1,-1)":"(1,1)";if(e){for(n=1;3>=n;n++)i=o.cloneNode(0),s(i,{isShadow:"true",stroke:"rgb(0, 0, 0)","stroke-opacity":.05*n,"stroke-width":7-2*n,transform:"translate"+a,fill:bt}),t?t.element.appendChild(i):o.parentNode.insertBefore(i,o),r.push(i);this.shadows=r}return this}};var Vt=function(){this.init.apply(this,arguments)};Vt.prototype={Element:v,init:function(e,t,n,i){var r,o=location;r=this.createElement("svg").attr({xmlns:"http://www.w3.org/2000/svg",version:"1.1"}),e.appendChild(r.element),this.box=r.element,this.boxWrapper=r,this.alignedObjects=[],this.url=tt?"":o.href.replace(/#.*?$/,""),this.defs=this.createElement("defs").add(),this.forExport=i,this.setSize(t,n,!1)},createElement:function(e){var t=new this.Element;return t.init(this,e),t},buildText:function(e){for(var n,i,r=e.element,o=(""+c(e.textStr,"")).replace(/<(b|strong)>/g,'<span style="font-weight:bold">').replace(/<(i|em)>/g,'<span style="font-style:italic">').replace(/<a/g,"<span").replace(/<\/(b|strong|i|em|a)>/g,"</span>").split(/<br.*?>/g),a=r.childNodes,l=/style="([^"]+)"/,u=/href="([^"]+)"/,p=s(r,"x"),h=e.styles,f=rt&&h&&"rtl"===h["-hc-direction"]&&!this.forExport&&4>t(et.split("Firefox/")[1]),g=h&&t(h.width),m=h&&h["line-height"],b=a.length;b--;)r.removeChild(a[b]);g&&!e.added&&this.box.appendChild(r),Tt(o,function(t,o){var a,c,h=0;t=t.replace(/<span/g,"|||<span").replace(/<\/span>/g,"</span>|||"),a=t.split("|||"),Tt(a,function(t){if(""!==t||1===a.length){var v={},y=$.createElementNS("http://www.w3.org/2000/svg","tspan");if(l.test(t)&&s(y,"style",t.match(l)[1].replace(/(;| |^)color([ :])/,"$1fill$2")),u.test(t)&&(s(y,"onclick",'location.href="'+t.match(u)[1]+'"'),d(y,{cursor:"pointer"})),t=(t.replace(/<(.|\n)*?>/g,"")||" ").replace(/&lt;/g,"<").replace(/&gt;/g,">"),f){for(n=[],b=t.length;b--;)n.push(t.charAt(b));t=n.join("")}if(y.appendChild($.createTextNode(t)),h?v.dx=3:v.x=p,h||(o&&(!ot&&e.renderer.forExport&&d(y,{display:"block"}),c=H.getComputedStyle&&H.getComputedStyle(i,null).getPropertyValue("line-height"),(!c||isNaN(c))&&(c=m||i.offsetHeight||18),s(y,"dy",c)),i=y),s(y,v),r.appendChild(y),h++,g){t=t.replace(/-/g,"- ").split(" ");for(var _,x=[];t.length||x.length;)_=r.getBBox().width,v=_>g,v&&1!==t.length?(y.removeChild(y.firstChild),x.unshift(t.pop())):(t=x,x=[],t.length&&(y=$.createElementNS("http://www.w3.org/2000/svg","tspan"),s(y,{dy:m||16,x:p}),r.appendChild(y),_>g&&(g=_))),t.length&&y.appendChild($.createTextNode(t.join(" ").replace(/- /g,"-")))}}})})},crispLine:function(e,t){return e[1]===e[4]&&(e[1]=e[4]=q(e[1])+t%2/2),e[2]===e[5]&&(e[2]=e[5]=q(e[2])+t%2/2),e},path:function(e){return this.createElement("path").attr({d:e,fill:bt})},circle:function(e,t,n){return e=i(e)?e:{x:e,y:t,r:n},this.createElement("circle").attr(e)},arc:function(e,t,n,r,o,a){return i(e)&&(t=e.y,n=e.r,r=e.innerR,o=e.start,a=e.end,e=e.x),this.symbol("arc",e||0,t||0,n||0,{innerR:r||0,start:o||0,end:a||0})},rect:function(e,t,n,r,o,a){return i(e)&&(t=e.y,n=e.width,r=e.height,o=e.r,a=e.strokeWidth,e=e.x),o=this.createElement("rect").attr({rx:o,ry:o,fill:bt}),o.attr(o.crisp(a,e,t,V(n,0),V(r,0)))},setSize:function(e,t,n){var i=this.alignedObjects,r=i.length;for(this.width=e,this.height=t,this.boxWrapper[c(n,!0)?"animate":"attr"]({width:e,height:t});r--;)i[r].align()},g:function(e){return this.createElement("g").attr(a(e)&&{"class":ft+e})},image:function(t,n,i,r,o){var a={preserveAspectRatio:bt};return arguments.length>1&&e(a,{x:n,y:i,width:r,height:o}),a=this.createElement("image").attr(a),a.element.setAttributeNS?a.element.setAttributeNS("http://www.w3.org/1999/xlink","href",t):a.element.setAttribute("hc-svg-href",t),a},symbol:function(t,n,i,r,o){var a,s=this.symbols[t];s=s&&s(q(n),q(i),r,o);var l,c=/^url\((.*?)\)$/;if(s)a=this.path(s),e(a,{symbolName:t,x:n,y:i,r:r}),o&&e(a,o);else if(c.test(t)){var u=function(e,t){e.attr({width:t[0],height:t[1]}).translate(-q(t[0]/2),-q(t[1]/2))};l=t.match(c)[1],t=st[l],a=this.image(l).attr({x:n,y:i}),t?u(a,t):(a.attr({width:0,height:0}),p("img",{onload:function(){u(a,st[l]=[this.width,this.height])},src:l}))}else a=this.circle(n,i,r);return a},symbols:{square:function(e,t,n){return n=.707*n,[vt,e-n,t-n,yt,e+n,t-n,e+n,t+n,e-n,t+n,"Z"]},triangle:function(e,t,n){return[vt,e,t-1.33*n,yt,e+n,t+.67*n,e-n,t+.67*n,"Z"]},"triangle-down":function(e,t,n){return[vt,e,t+1.33*n,yt,e-n,t-.67*n,e+n,t-.67*n,"Z"]},diamond:function(e,t,n){return[vt,e,t-n,yt,e+n,t,e,t+n,e-n,t,"Z"]},arc:function(e,t,n,i){var r=i.start,o=i.end-1e-6,a=i.innerR,s=Y(r),l=J(r),c=Y(o);return o=J(o),i=Z>i.end-r?0:1,[vt,e+n*s,t+n*l,"A",n,n,0,i,1,e+n*c,t+n*o,yt,e+a*c,t+a*o,"A",a,a,0,i,0,e+a*s,t+a*l,"Z"]}},clipRect:function(e,t,n,i){var r=ft+lt++,o=this.createElement("clipPath").attr({id:r}).add(this.defs);return e=this.rect(e,t,n,i,0).add(o),e.id=r,e},color:function(e,t,n){var i,r=/^rgba/;if(e&&e.linearGradient){var o=this;t=e.linearGradient,n=ft+lt++;var a,l,c;return a=o.createElement("linearGradient").attr({id:n,gradientUnits:"userSpaceOnUse",x1:t[0],y1:t[1],x2:t[2],y2:t[3]}).add(o.defs),Tt(e.stops,function(e){r.test(e[1])?(i=Ut(e[1]),l=i.get("rgb"),c=i.get("a")):(l=e[1],c=1),o.createElement("stop").attr({offset:e[0],"stop-color":l,"stop-opacity":c}).add(a)}),"url("+this.url+"#"+n+")"}return r.test(e)?(i=Ut(e),s(t,n+"-opacity",i.get("a")),i.get("rgb")):e},text:function(e,t,n){var i=C.chart.style;return t=q(c(t,0)),n=q(c(n,0)),e=this.createElement("text").attr({x:t,y:n,text:e}).css({"font-family":i.fontFamily,"font-size":i.fontSize}),e.x=t,e.y=n,e}},_=Vt,ot||(Ct=h(v,{init:function(e,t){var n=["<",t,' filled="f" stroked="f"'],i=["position: ",dt,";"];("shape"===t||t===ut)&&i.push("left:0;top:0;width:10px;height:10px;"),nt&&i.push("visibility: ",t===ut?ht:gt),n.push(' style="',i.join(""),'"/>'),t&&(n=t===ut||"span"===t||"img"===t?n.join(""):e.prepVML(n),this.element=p(n)),this.renderer=e},add:function(e){var t=this.renderer,n=this.element,i=t.box;return i=e?e.element||e:i,e&&e.inverted&&t.invertChild(n,i),nt&&i.gVis===ht&&d(n,{visibility:ht}),i.appendChild(n),this.added=!0,this.alignOnAdd&&this.updateTransform(),this},attr:function(e,t){var i,o,l,c,u,h=this.element||{},f=h.style,g=h.nodeName,m=this.renderer,b=this.symbolName,v=this.shadows,y=this;if(n(e)&&a(t)&&(i=e,e={},e[i]=t),n(e))i=e,y="strokeWidth"===i||"stroke-width"===i?this.strokeweight:this[i];else for(i in e){if(o=e[i],c=!1,b&&/^(x|y|r|start|end|width|height|innerR)/.test(i))u||(this.symbolAttr(e),u=!0),c=!0;else if("d"===i){for(o=o||[],this.d=o.join(" "),l=o.length,c=[];l--;)c[l]=r(o[l])?q(10*o[l])-5:"Z"===o[l]?"x":o[l];if(o=c.join(" ")||"x",h.path=o,v)for(l=v.length;l--;)v[l].path=o;c=!0}else if("zIndex"===i||"visibility"===i){if(nt&&"visibility"===i&&"DIV"===g){for(h.gVis=o,c=h.childNodes,l=c.length;l--;)d(c[l],{visibility:o});o===gt&&(o=null)}o&&(f[i]=o),c=!0}else/^(width|height)$/.test(i)?(this.updateClipping?(this[i]=o,this.updateClipping()):f[i]=o,c=!0):/^(x|y)$/.test(i)?(this[i]=o,"SPAN"===h.tagName?this.updateTransform():f[{x:"left",y:"top"}[i]]=o):"class"===i?h.className=o:"stroke"===i?(o=m.color(o,h,i),i="strokecolor"):"stroke-width"===i||"strokeWidth"===i?(h.stroked=o?!0:!1,i="strokeweight",this[i]=o,r(o)&&(o+=mt)):"dashstyle"===i?((h.getElementsByTagName("stroke")[0]||p(m.prepVML(["<stroke/>"]),null,null,h))[i]=o||"solid",this.dashstyle=o,c=!0):"fill"===i?"SPAN"===g?f.color=o:(h.filled=o!==bt?!0:!1,o=m.color(o,h,i),i="fillcolor"):"translateX"===i||"translateY"===i||"rotation"===i||"align"===i?("align"===i&&(i="textAlign"),this[i]=o,this.updateTransform(),c=!0):"text"===i&&(this.bBox=null,h.innerHTML=o,c=!0);if(v&&"visibility"===i)for(l=v.length;l--;)v[l].style[i]=o;c||(nt?h[i]=o:s(h,i,o))}return y},clip:function(e){var t=this,n=e.members;return n.push(t),t.destroyClip=function(){o(n,t)},t.css(e.getCSS(t.inverted))},css:function(t){var n=this.element;return(n=t&&"SPAN"===n.tagName&&t.width)&&(delete t.width,this.textWidth=n,this.updateTransform()),this.styles=e(this.styles,t),d(this.element,t),this},destroy:function(){this.destroyClip&&this.destroyClip(),v.prototype.destroy.apply(this)},empty:function(){for(var e,t=this.element.childNodes,n=t.length;n--;)e=t[n],e.parentNode.removeChild(e)},getBBox:function(){var e=this.element,t=this.bBox;return t||("text"===e.nodeName&&(e.style.position=dt),t=this.bBox={x:e.offsetLeft,y:e.offsetTop,width:e.offsetWidth,height:e.offsetHeight}),t},on:function(e,t){return this.element["on"+e]=function(){var e=H.event;e.target=e.srcElement,t(e)},this},updateTransform:function(){if(this.added){var e=this,n=e.element,i=e.translateX||0,r=e.translateY||0,o=e.x||0,s=e.y||0,l=e.textAlign||"left",c={left:0,center:.5,right:1}[l],u=l&&"left"!==l;if((i||r)&&e.css({marginLeft:i,marginTop:r}),e.inverted&&Tt(n.childNodes,function(t){e.renderer.invertChild(t,n)}),"SPAN"===n.tagName){var p,h;i=e.rotation;var f;p=0,r=1;var g,m=0;f=t(e.textWidth);var b=e.xCorr||0,v=e.yCorr||0,y=[i,l,n.innerHTML,e.textWidth].join(",");y!==e.cTT&&(a(i)&&(p=i*Q,r=Y(p),m=J(p),d(n,{filter:i?["progid:DXImageTransform.Microsoft.Matrix(M11=",r,", M12=",-m,", M21=",m,", M22=",r,", sizingMethod='auto expand')"].join(""):bt})),p=n.offsetWidth,h=n.offsetHeight,p>f&&(d(n,{width:f+mt,display:"block",whiteSpace:"normal"}),p=f),f=q(1.2*(t(n.style.fontSize)||12)),b=0>r&&-p,v=0>m&&-h,g=0>r*m,b+=m*f*(g?1-c:c),v-=r*f*(i?g?c:1-c:1),u&&(b-=p*c*(0>r?-1:1),i&&(v-=h*c*(0>m?-1:1)),d(n,{textAlign:l})),e.xCorr=b,e.yCorr=v),d(n,{left:o+b,top:s+v}),e.cTT=y}}else this.alignOnAdd=!0},shadow:function(e,n){var i,r,o,a=[],s=this.element,l=this.renderer,c=s.style,u=s.path;if(u&&"string"!=typeof u.value&&(u="x"),e){for(i=1;3>=i;i++)o=['<shape isShadow="true" strokeweight="',7-2*i,'" filled="false" path="',u,'" coordsize="100,100" style="',s.style.cssText,'" />'],r=p(l.prepVML(o),null,{left:t(c.left)+1,top:t(c.top)+1}),o=['<stroke color="black" opacity="',.05*i,'"/>'],p(l.prepVML(o),null,null,r),n?n.element.appendChild(r):s.parentNode.insertBefore(r,s),a.push(r);this.shadows=a}return this}}),wt=function(){this.init.apply(this,arguments)},wt.prototype=At(Vt.prototype,{Element:Ct,isIE8:et.indexOf("MSIE 8.0")>-1,init:function(e,t,n){var i;this.alignedObjects=[],i=this.createElement(ut),e.appendChild(i.element),this.box=i.element,this.boxWrapper=i,this.setSize(t,n,!1),$.namespaces.hcv||($.namespaces.add("hcv","urn:schemas-microsoft-com:vml"),$.createStyleSheet().cssText="hcv\\:fill, hcv\\:path, hcv\\:shape, hcv\\:stroke{ behavior:url(#default#VML); display: inline-block; } ")},clipRect:function(t,n,i,r){var o=this.createElement();return e(o,{members:[],left:t,top:n,width:i,height:r,getCSS:function(t){var n=this.top,i=this.left,r=i+this.width,o=n+this.height;return n={clip:"rect("+q(t?i:n)+"px,"+q(t?o:r)+"px,"+q(t?r:o)+"px,"+q(t?n:i)+"px)"},!t&&nt&&e(n,{width:r+mt,height:o+mt}),n},updateClipping:function(){Tt(o.members,function(e){e.css(o.getCSS(e.inverted))})}})},color:function(e,t,n){var i,r=/^rgba/;if(!e||!e.linearGradient)return r.test(e)&&"IMG"!==t.tagName?(i=Ut(e),n=["<",n,' opacity="',i.get("a"),'"/>'],p(this.prepVML(n),null,null,t),i.get("rgb")):e;var o,a,s,l,c,u,d=e.linearGradient;Tt(e.stops,function(e,t){r.test(e[1])?(i=Ut(e[1]),o=i.get("rgb"),a=i.get("a")):(o=e[1],a=1),t?(c=o,u=a):(s=o,l=a)}),e=90-180*K.atan((d[3]-d[1])/(d[2]-d[0]))/Z,n=["<",n,' colors="0% ',s,",100% ",c,'" angle="',e,'" opacity="',u,'" o:opacity2="',l,'" type="gradient" focus="100%" />'],p(this.prepVML(n),null,null,t)},prepVML:function(e){var t=this.isIE8;return e=e.join(""),t?(e=e.replace("/>",' xmlns="urn:schemas-microsoft-com:vml" />'),e=-1===e.indexOf('style="')?e.replace("/>",' style="display:inline-block;behavior:url(#default#VML);" />'):e.replace('style="','style="display:inline-block;behavior:url(#default#VML);')):e=e.replace("<","<hcv:"),e},text:function(e,t,n){var i=C.chart.style;return this.createElement("span").attr({text:e,x:q(t),y:q(n)}).css({whiteSpace:"nowrap",fontFamily:i.fontFamily,fontSize:i.fontSize})},path:function(e){return this.createElement("shape").attr({coordsize:"100 100",d:e})},circle:function(e,t,n){return this.symbol("circle").attr({x:e,y:t,r:n})},g:function(e){var t;return e&&(t={className:ft+e,"class":ft+e}),this.createElement(ut).attr(t)},image:function(e,t,n,i,r){var o=this.createElement("img").attr({src:e});return arguments.length>1&&o.css({left:t,top:n,width:i,height:r}),o},rect:function(e,t,n,r,o,a){i(e)&&(t=e.y,n=e.width,r=e.height,o=e.r,a=e.strokeWidth,e=e.x);var s=this.symbol("rect");return s.r=o,s.attr(s.crisp(a,e,t,V(n,0),V(r,0)))},invertChild:function(e,n){var i=n.style;d(e,{flip:"x",left:t(i.width)-10,top:t(i.height)-10,rotation:-90})},symbols:{arc:function(e,t,n,i){var r=i.start,o=i.end,a=Y(r),s=J(r),l=Y(o),c=J(o);i=i.innerR;var u=.07/n,d=i&&.1/i||0;return 0===o-r?["x"]:(u>2*Z-o+r?l=-u:d>o-r&&(l=Y(r+d)),["wa",e-n,t-n,e+n,t+n,e+n*a,t+n*s,e+n*l,t+n*c,"at",e-i,t-i,e+i,t+i,e+i*l,t+i*c,e+i*a,t+i*s,"x","e"])},circle:function(e,t,n){return["wa",e-n,t-n,e+n,t+n,e+n,t,e+n,t,"e"]},rect:function(e,t,n,i){if(!a(i))return[];var r=i.width;i=i.height;var o=e+r,s=t+i;return n=G(n,r,i),[vt,e+n,t,yt,o-n,t,"wa",o-2*n,t,o,t+2*n,o-n,t,o,t+n,yt,o,s-n,"wa",o-2*n,s-2*n,o,s,o,s-n,o-n,s,yt,e+n,s,"wa",e,s-2*n,e+2*n,s,e+n,s,e,s-n,yt,e,t+n,"wa",e,t,e+2*n,t+2*n,e,t+n,e+n,t,"x","e"]}}}),_=wt),y.prototype.callbacks=[];var Gt=function(){};Gt.prototype={init:function(e,t){var n;return this.series=e,this.applyOptions(t),this.pointAttr={},e.options.colorByPoint&&(n=e.chart.options.colors,this.options||(this.options={}),this.color=this.options.color=this.color||n[x++],x>=n.length&&(x=0)),e.chart.pointCount++,this},applyOptions:function(t){var o=this.series;this.config=t,r(t)||null===t?this.y=t:i(t)&&!r(t.length)?(e(this,t),this.options=t):n(t[0])?(this.name=t[0],this.y=t[1]):r(t[0])&&(this.x=t[0],this.y=t[1]),this.x===A&&(this.x=o.autoIncrement())},destroy:function(){var e,t=this,n=t.series;n.chart.pointCount--,t===n.chart.hoverPoint&&t.onMouseOut(),n.chart.hoverPoints=null,Rt(t),Tt(["graphic","tracker","group","dataLabel","connector"],function(e){t[e]&&t[e].destroy()}),t.legendItem&&t.series.chart.legend.destroyItem(t);for(e in t)t[e]=null},getLabelConfig:function(){return{x:this.category,y:this.y,series:this.series,point:this,percentage:this.percentage,total:this.total||this.stackTotal}},select:function(e,t){var n=this,i=n.series.chart;n.selected=e=c(e,!n.selected),n.firePointEvent(e?"select":"unselect"),n.setState(e&&"select"),t||Tt(i.getSelectedPoints(),function(e){e.selected&&e!==n&&(e.selected=!1,e.setState(xt),e.firePointEvent("unselect"))})},onMouseOver:function(){var e=this.series.chart,t=e.tooltip,n=e.hoverPoint;n&&n!==this&&n.onMouseOut(),this.firePointEvent("mouseOver"),t&&!t.shared&&t.refresh(this),this.setState(kt),e.hoverPoint=this},onMouseOut:function(){this.firePointEvent("mouseOut"),this.setState(),this.series.chart.hoverPoint=null},tooltipFormatter:function(e){var t=this.series;return['<span style="color:'+t.color+'">',this.name||t.name,"</span>: ",e?"":"<b>x = "+(this.name||this.x)+",</b> ","<b>",e?"":"y = ",this.y,"</b>"].join("")},update:function(e,t,n){var r=this,o=r.series,a=r.graphic,s=o.chart;t=c(t,!0),r.firePointEvent("update",{options:e},function(){r.applyOptions(e),i(e)&&(o.getAttribs(),a&&a.attr(r.pointAttr[o.state])),o.isDirty=!0,t&&s.redraw(n)})},remove:function(e,t){var n=this,i=n.series,r=i.chart,a=i.data;g(t,r),e=c(e,!0),n.firePointEvent("remove",null,function(){o(a,n),n.destroy(),i.isDirty=!0,e&&r.redraw()})},firePointEvent:function(e,t,n){var i=this,r=this.series.options;(r.point.events[e]||i.options&&i.options.events&&i.options.events[e])&&this.importEvents(),"click"===e&&r.allowPointSelect&&(n=function(e){i.select(null,e.ctrlKey||e.metaKey||e.shiftKey)}),Ot(this,e,t,n)},importEvents:function(){if(!this.hasImportedEvents){var e,t=At(this.series.options.point,this.options).events;this.events=t;for(e in t)It(this,e,t[e]);this.hasImportedEvents=!0}},setState:function(e){var t=this.series,n=t.options.states,i=Wt[t.type].marker&&t.options.marker,r=i&&!i.enabled,o=(i=i&&i.states[e])&&i.enabled===!1,a=t.stateMarkerGraphic,s=t.chart,l=this.pointAttr;e=e||xt,e===this.state||this.selected&&"select"!==e||n[e]&&n[e].enabled===!1||e&&(o||r&&!i.enabled)||(this.graphic?this.graphic.attr(l[e]):(e&&(a||(t.stateMarkerGraphic=a=s.renderer.circle(0,0,l[e].r).attr(l[e]).add(t.group)),a.translate(this.plotX,this.plotY)),a&&a[e?"show":"hide"]()),this.state=e)}};var Xt=function(){};Xt.prototype={isCartesian:!0,type:"line",pointClass:Gt,pointAttrToOptions:{stroke:"lineColor","stroke-width":"lineWidth",fill:"fillColor",r:"radius"},init:function(t,n){var i,r;r=t.series.length,this.chart=t,n=this.setOptions(n),e(this,{index:r,options:n,name:n.name||"Series "+(r+1),state:xt,pointAttr:{},visible:n.visible!==!1,selected:n.selected===!0}),r=n.events;for(i in r)It(this,i,r[i]);(r&&r.click||n.point&&n.point.events&&n.point.events.click||n.allowPointSelect)&&(t.runTrackerClick=!0),this.getColor(),this.getSymbol(),this.setData(n.data,!1)},autoIncrement:function(){var e=this.options,t=this.xIncrement;return t=c(t,e.pointStart,0),this.pointInterval=c(this.pointInterval,e.pointInterval,1),this.xIncrement=t+this.pointInterval,t},cleanData:function(){var e,t,n,i,r=this.chart,o=this.data,a=r.smallestInterval;if(o.sort(function(e,t){return e.x-t.x}),this.options.connectNulls)for(i=o.length-1;i>=0;i--)null===o[i].y&&o[i-1]&&o[i+1]&&o.splice(i,1);for(i=o.length-1;i>=0;i--)o[i-1]&&(n=o[i].x-o[i-1].x,n>0&&(t===A||t>n)&&(t=n,e=i));(a===A||a>t)&&(r.smallestInterval=t),this.closestPoints=e},getSegments:function(){var e=-1,t=[],n=this.data;Tt(n,function(i,r){null===i.y?(r>e+1&&t.push(n.slice(e+1,r)),e=r):r===n.length-1&&t.push(n.slice(e+1,r+1))}),this.segments=t},setOptions:function(e){var t=this.chart.options.plotOptions;return At(t[this.type],t.series,e)},getColor:function(){var e=this.chart.options.colors;this.color=this.options.color||e[x++]||"#0000ff",x>=e.length&&(x=0)},getSymbol:function(){var e=this.chart.options.symbols;this.symbol=this.options.marker.symbol||e[k++],k>=e.length&&(k=0)},addPoint:function(e,t,n,i){var r=this.data,o=this.graph,a=this.area,s=this.chart;e=(new this.pointClass).init(this,e),g(i,s),o&&n&&(o.shift=n),a&&(a.shift=n,a.isArea=!0),t=c(t,!0),r.push(e),n&&r[0].remove(!1),this.getAttribs(),this.isDirty=!0,t&&s.redraw()},setData:function(e,t){var n=this,i=n.data,r=n.initialColor,o=n.chart,s=i&&i.length||0;for(n.xIncrement=null,a(r)&&(x=r),e=St(l(e||[]),function(e){return(new n.pointClass).init(n,e)});s--;)i[s].destroy();n.data=e,n.cleanData(),n.getSegments(),n.getAttribs(),n.isDirty=!0,o.isDirtyBox=!0,c(t,!0)&&o.redraw(!1)},remove:function(e,t){var n=this,i=n.chart;e=c(e,!0),n.isRemoving||(n.isRemoving=!0,Ot(n,"remove",null,function(){n.destroy(),i.isDirtyLegend=i.isDirtyBox=!0,e&&i.redraw(t)})),n.isRemoving=!1},translate:function(){for(var e=this.chart,t=this.options.stacking,n=this.xAxis.categories,i=this.yAxis,r=this.data,o=r.length;o--;){var s=r[o],l=s.x,c=s.y,u=s.low,d=i.stacks[(0>c?"-":"")+this.stackKey];s.plotX=this.xAxis.translate(l),t&&this.visible&&d&&d[l]&&(u=d[l],l=u.total,u.cum=u=u.cum-c,c=u+c,"percent"===t&&(u=l?100*u/l:0,c=l?100*c/l:0),s.percentage=l?100*s.y/l:0,s.stackTotal=l),a(u)&&(s.yBottom=i.translate(u,0,1,0,1)),null!==c&&(s.plotY=i.translate(c,0,1,0,1)),s.clientX=e.inverted?e.plotHeight-s.plotX:s.plotX,s.category=n&&n[s.x]!==A?n[s.x]:s.x}},setTooltipPoints:function(e){var t,n,i=this.chart,r=i.inverted,o=[],a=q((r?i.plotTop:i.plotLeft)+i.plotSizeX),s=[];e&&(this.tooltipPoints=null),Tt(this.segments,function(e){o=o.concat(e)}),this.xAxis&&this.xAxis.reversed&&(o=o.reverse()),Tt(o,function(e,i){for(t=o[i-1]?o[i-1]._high+1:0,n=e._high=o[i+1]?W((e.plotX+(o[i+1]?o[i+1].plotX:a))/2):a;n>=t;)s[r?a-t++:t++]=e}),this.tooltipPoints=s},onMouseOver:function(){var e=this.chart,t=e.hoverSeries;(at||!e.mouseIsDown)&&(t&&t!==this&&t.onMouseOut(),this.options.events.mouseOver&&Ot(this,"mouseOver"),this.tracker&&this.tracker.toFront(),this.setState(kt),e.hoverSeries=this) },onMouseOut:function(){var e=this.options,t=this.chart,n=t.tooltip,i=t.hoverPoint;i&&i.onMouseOut(),this&&e.events.mouseOut&&Ot(this,"mouseOut"),n&&!e.stickyTracking&&n.hide(),this.setState(),t.hoverSeries=null},animate:function(e){var t=this.chart,n=this.clipRect,r=this.options.animation;r&&!i(r)&&(r={}),e?n.isAnimating||(n.attr("width",0),n.isAnimating=!0):(n.animate({width:t.plotSizeX},r),this.animate=null)},drawPoints:function(){var e,t,n,i,r,o,a,s=this.data,l=this.chart;if(this.options.marker.enabled)for(i=s.length;i--;)r=s[i],t=r.plotX,n=r.plotY,a=r.graphic,n===A||isNaN(n)||(e=r.pointAttr[r.selected?"select":xt],o=e.r,a?a.animate({x:t,y:n,r:o}):r.graphic=l.renderer.symbol(c(r.marker&&r.marker.symbol,this.symbol),t,n,o).attr(e).add(this.group))},convertAttribs:function(e,t,n,i){var r,o,a=this.pointAttrToOptions,s={};e=e||{},t=t||{},n=n||{},i=i||{};for(r in a)o=a[r],s[r]=c(e[o],t[r],n[r],i[r]);return s},getAttribs:function(){var e,t,n,i=this,r=Wt[i.type].marker?i.options.marker:i.options,o=r.states,s=o[kt],l=i.color,c={stroke:l,fill:l},u=i.data,d=[],p=i.pointAttrToOptions;for(i.options.marker?(s.radius=s.radius||r.radius+2,s.lineWidth=s.lineWidth||r.lineWidth+1):s.color=s.color||Ut(s.color||l).brighten(s.brightness).get(),d[xt]=i.convertAttribs(r,c),Tt([kt,"select"],function(e){d[e]=i.convertAttribs(o[e],d[xt])}),i.pointAttr=d,l=u.length;l--;){if(c=u[l],(r=c.options&&c.options.marker||c.options)&&r.enabled===!1&&(r.radius=0),e=!1,c.options)for(n in p)a(r[p[n]])&&(e=!0);e?(t=[],o=r.states||{},e=o[kt]=o[kt]||{},i.options.marker||(e.color=Ut(e.color||c.options.color).brighten(e.brightness||s.brightness).get()),t[xt]=i.convertAttribs(r,d[xt]),t[kt]=i.convertAttribs(o[kt],d[kt],t[xt]),t.select=i.convertAttribs(o.select,d.select,t[xt])):t=d,c.pointAttr=t}},destroy:function(){var e,t,n=this,i=n.chart,r=/\/5[0-9\.]+ (Safari|Mobile)\//.test(et);Rt(n),n.legendItem&&n.chart.legend.destroyItem(n),Tt(n.data,function(e){e.destroy()}),Tt(["area","graph","dataLabelsGroup","group","tracker"],function(t){n[t]&&(e=r&&"group"===t?"hide":"destroy",n[t][e]())}),i.hoverSeries===n&&(i.hoverSeries=null),o(i.series,n);for(t in n)delete n[t]},drawDataLabels:function(){if(this.options.dataLabels.enabled){var e,n,i,r,o=this,s=o.data,l=o.options.dataLabels,u=o.dataLabelsGroup,d=o.chart,p=d.inverted,h=o.type;r=o.options.stacking;var f="column"===h||"bar"===h,g=null===l.verticalAlign,m=null===l.y;f&&(r?(g&&(l=At(l,{verticalAlign:"middle"})),m&&(l=At(l,{y:{top:14,middle:4,bottom:-6}[l.verticalAlign]}))):(g&&(l=At(l,{verticalAlign:"top"})),m&&(l=At(l,{y:-6})))),u||(u=o.dataLabelsGroup=d.renderer.g("data-labels").attr({visibility:o.visible?gt:ht,zIndex:6}).translate(d.plotLeft,d.plotTop).add()),r=l.color,"auto"===r&&(r=null),l.style.color=c(r,o.color),Tt(s,function(r){var s=r.barX,g=s&&s+r.barW/2||r.plotX||-999,m=c(r.plotY,-999),b=r.dataLabel,v=l.align;i=l.formatter.call(r.getLabelConfig()),e=(p?d.plotWidth-m:g)+l.x,n=(p?d.plotHeight-g:m)+l.y,"column"===h&&(e+={left:-1,right:1}[v]*r.barW/2||0),b?(p&&!l.y&&(n=n+.9*t(b.styles.lineHeight)-b.getBBox().height/2),b.attr({text:i}).animate({x:e,y:n})):a(i)&&(b=r.dataLabel=d.renderer.text(i,e,n).attr({align:v,rotation:l.rotation,zIndex:1}).css(l.style).add(u),p&&!l.y&&b.attr({y:n+.9*t(b.styles.lineHeight)-b.getBBox().height/2})),f&&o.options.stacking&&(g=r.barY,m=r.barW,r=r.barH,b.align(l,null,{x:p?d.plotWidth-g-r:s,y:p?d.plotHeight-s-m:g,width:p?r:m,height:p?m:r}))})}},drawGraph:function(){var e,t,n=this,i=n.options,r=n.graph,o=[],a=n.area,s=n.group,l=i.lineColor||n.color,u=i.lineWidth,d=i.dashStyle,p=n.chart.renderer,h=n.yAxis.getThreshold(i.threshold||0),f=/^area/.test(n.type),g=[],m=[];Tt(n.segments,function(e){if(t=[],Tt(e,function(r,o){n.getPointSpline?t.push.apply(t,n.getPointSpline(e,r,o)):(t.push(o?yt:vt),o&&i.step&&t.push(r.plotX,e[o-1].plotY),t.push(r.plotX,r.plotY))}),e.length>1?o=o.concat(t):g.push(e[0]),f){var r,a=[],s=t.length;for(r=0;s>r;r++)a.push(t[r]);if(3===s&&a.push(yt,t[1],t[2]),i.stacking&&"areaspline"!==n.type)for(r=e.length-1;r>=0;r--)a.push(e[r].plotX,e[r].yBottom);else a.push(yt,e[e.length-1].plotX,h,yt,e[0].plotX,h);m=m.concat(a)}}),n.graphPath=o,n.singlePoints=g,f&&(e=c(i.fillColor,Ut(n.color).setOpacity(i.fillOpacity||.75).get()),a?a.animate({d:m}):n.area=n.chart.renderer.path(m).attr({fill:e}).add(s)),r?r.animate({d:o}):u&&(r={stroke:l,"stroke-width":u},d&&(r.dashstyle=d),n.graph=p.path(o).attr(r).add(s).shadow(i.shadow))},render:function(){var e,t,n=this,i=n.chart,r=n.options,o=r.animation,a=o&&n.animate;o=a?o&&o.duration||500:0;var s=n.clipRect;t=i.renderer,s||(s=n.clipRect=!i.hasRendered&&i.clipRect?i.clipRect:t.clipRect(0,0,i.plotSizeX,i.plotSizeY),i.clipRect||(i.clipRect=s)),n.group||(e=n.group=t.g("series"),i.inverted&&(t=function(){e.attr({width:i.plotWidth,height:i.plotHeight}).invert()},t(),It(i,"resize",t)),e.clip(n.clipRect).attr({visibility:n.visible?gt:ht,zIndex:r.zIndex}).translate(i.plotLeft,i.plotTop).add(i.seriesGroup)),n.drawDataLabels(),a&&n.animate(!0),n.drawGraph&&n.drawGraph(),n.drawPoints(),n.options.enableMouseTracking!==!1&&n.drawTracker(),a&&n.animate(),setTimeout(function(){s.isAnimating=!1,(e=n.group)&&s!==i.clipRect&&s.renderer&&(e.clip(n.clipRect=i.clipRect),s.destroy())},o),n.isDirty=!1},redraw:function(){var e=this.chart,t=this.group;t&&(e.inverted&&t.attr({width:e.plotWidth,height:e.plotHeight}),t.animate({translateX:e.plotLeft,translateY:e.plotTop})),this.translate(),this.setTooltipPoints(!0),this.render()},setState:function(e){var t=this.options,n=this.graph,i=t.states;t=t.lineWidth,e=e||xt,this.state!==e&&(this.state=e,i[e]&&i[e].enabled===!1||(e&&(t=i[e].lineWidth||t+1),n&&!n.dashstyle&&n.attr({"stroke-width":t},e?0:500)))},setVisible:function(e,t){var n,i=this.chart,r=this.legendItem,o=this.group,a=this.tracker,s=this.dataLabelsGroup,l=this.data,c=i.options.chart.ignoreHiddenSeries;if(n=this.visible,n=(this.visible=e=e===A?!n:e)?"show":"hide",o&&o[n](),a)a[n]();else for(o=l.length;o--;)a=l[o],a.tracker&&a.tracker[n]();s&&s[n](),r&&i.legend.colorizeItem(this,e),this.isDirty=!0,this.options.stacking&&Tt(i.series,function(e){e.options.stacking&&e.visible&&(e.isDirty=!0)}),c&&(i.isDirtyBox=!0),t!==!1&&i.redraw(),Ot(this,n)},show:function(){this.setVisible(!0)},hide:function(){this.setVisible(!1)},select:function(e){this.selected=e=e===A?!this.selected:e,this.checkbox&&(this.checkbox.checked=e),Ot(this,e?"select":"unselect")},drawTracker:function(){var e=this,t=e.options,n=[].concat(e.graphPath),i=n.length,r=e.chart,o=r.options.tooltip.snap,a=e.tracker,s=t.cursor;s=s&&{cursor:s};var l,c=e.singlePoints;if(i)for(l=i+1;l--;)n[l]===vt&&n.splice(l+1,0,n[l+1]-o,n[l+2],yt),(l&&n[l]===vt||l===i)&&n.splice(l,0,yt,n[l-2]+o,n[l-1]);for(l=0;c.length>l;l++)i=c[l],n.push(vt,i.plotX-o,i.plotY,yt,i.plotX+o,i.plotY);a?a.attr({d:n}):e.tracker=r.renderer.path(n).attr({isTracker:!0,stroke:_t,fill:bt,"stroke-width":t.lineWidth+2*o,visibility:e.visible?gt:ht,zIndex:1}).on(at?"touchstart":"mouseover",function(){r.hoverSeries!==e&&e.onMouseOver()}).on("mouseout",function(){t.stickyTracking||e.onMouseOut()}).css(s).add(r.trackerGroup)}},wt=h(Xt),Nt.line=wt,wt=h(Xt,{type:"area"}),Nt.area=wt,wt=h(Xt,{type:"spline",getPointSpline:function(e,t,n){var i,r,o,a,s=t.plotX,l=t.plotY,c=e[n-1],u=e[n+1];if(n&&e.length-1>n){e=c.plotY,o=u.plotX,u=u.plotY;var d;i=(1.5*s+c.plotX)/2.5,r=(1.5*l+e)/2.5,o=(1.5*s+o)/2.5,a=(1.5*l+u)/2.5,d=(a-r)*(o-s)/(o-i)+l-a,r+=d,a+=d,r>e&&r>l?(r=V(e,l),a=2*l-r):e>r&&l>r&&(r=G(e,l),a=2*l-r),a>u&&a>l?(a=V(u,l),r=2*l-a):u>a&&l>a&&(a=G(u,l),r=2*l-a),t.rightContX=o,t.rightContY=a}return n?(t=["C",c.rightContX||c.plotX,c.rightContY||c.plotY,i||s,r||l,s,l],c.rightContX=c.rightContY=null):t=[vt,s,l],t}}),Nt.spline=wt,wt=h(wt,{type:"areaspline"}),Nt.areaspline=wt;var Yt=h(Xt,{type:"column",pointAttrToOptions:{stroke:"borderColor","stroke-width":"borderWidth",fill:"color",r:"borderRadius"},init:function(){Xt.prototype.init.apply(this,arguments);var e=this,t=e.chart;t.hasColumn=!0,t.hasRendered&&Tt(t.series,function(t){t.type===e.type&&(t.isDirty=!0)})},translate:function(){var t,n,i=this,r=i.chart,o=i.options,s=o.stacking,l=o.borderWidth,u=0,d=i.xAxis.reversed,p=i.xAxis.categories,h={};Xt.prototype.translate.apply(i),Tt(r.series,function(e){e.type===i.type&&e.visible&&(e.options.stacking?(t=e.stackKey,h[t]===A&&(h[t]=u++),n=h[t]):n=u++,e.columnIndex=n)});var f=i.data,g=i.closestPoints;p=X(f[1]?f[g].plotX-f[g-1].plotX:r.plotSizeX/(p&&p.length||1)),g=p*o.groupPadding;var m=(p-2*g)/u,b=o.pointWidth,v=a(b)?(m-b)/2:m*o.pointPadding,y=V(c(b,m-2*v),1),_=v+(g+((d?u-i.columnIndex:i.columnIndex)||0)*m-p/2)*(d?-1:1),x=i.yAxis.getThreshold(o.threshold||0),k=c(o.minPointLength,5);Tt(f,function(t){var n,c=t.plotY,u=t.yBottom||x,d=t.plotX+_,p=U(G(c,u)),h=U(V(c,u)-p),f=i.yAxis.stacks[(0>t.y?"-":"")+i.stackKey];s&&i.visible&&f&&f[t.x]&&f[t.x].setOffset(_,y),k>X(h)&&(k&&(h=k,p=X(p-x)>k?u-k:x-(x>=c?k:0)),n=p-3),e(t,{barX:d,barY:p,barW:y,barH:h}),t.shapeType="rect",c=e(r.renderer.Element.prototype.crisp.apply({},[l,d,p,y,h]),{r:o.borderRadius}),l%2&&(c.y-=1,c.height+=1),t.shapeArgs=c,t.trackerArgs=a(n)&&At(t.shapeArgs,{height:V(6,h+3),y:n})})},getSymbol:function(){},drawGraph:function(){},drawPoints:function(){var e,t,n=this,i=n.options,r=n.chart.renderer;Tt(n.data,function(o){var a=o.plotY;a===A||isNaN(a)||null===o.y||(e=o.graphic,t=o.shapeArgs,e?(Ft(e),e.animate(t)):o.graphic=r[o.shapeType](t).attr(o.pointAttr[o.selected?"select":xt]).add(n.group).shadow(i.shadow))})},drawTracker:function(){var e,t,n,i=this,r=i.chart,o=r.renderer,a=+new Date,l=i.options.cursor,c=l&&{cursor:l};Tt(i.data,function(l){t=l.tracker,e=l.trackerArgs||l.shapeArgs,delete e.strokeWidth,null!==l.y&&(t?t.attr(e):l.tracker=o[l.shapeType](e).attr({isTracker:a,fill:_t,visibility:i.visible?gt:ht,zIndex:1}).on(at?"touchstart":"mouseover",function(e){n=e.relatedTarget||e.fromElement,r.hoverSeries!==i&&s(n,"isTracker")!==a&&i.onMouseOver(),l.onMouseOver()}).on("mouseout",function(e){i.options.stickyTracking||(n=e.relatedTarget||e.toElement,s(n,"isTracker")!==a&&i.onMouseOut())}).css(c).add(l.group||r.trackerGroup))})},animate:function(e){var t=this,n=t.data;e||(Tt(n,function(e){var n=e.graphic;e=e.shapeArgs,n&&(n.attr({height:0,y:t.yAxis.translate(0,0,1)}),n.animate({height:e.height,y:e.y},t.options.animation))}),t.animate=null)},remove:function(){var e=this,t=e.chart;t.hasRendered&&Tt(t.series,function(t){t.type===e.type&&(t.isDirty=!0)}),Xt.prototype.remove.apply(e,arguments)}});Nt.column=Yt,wt=h(Yt,{type:"bar",init:function(e){e.inverted=this.inverted=!0,Yt.prototype.init.apply(this,arguments)}}),Nt.bar=wt,wt=h(Xt,{type:"scatter",translate:function(){var e=this;Xt.prototype.translate.apply(e),Tt(e.data,function(t){t.shapeType="circle",t.shapeArgs={x:t.plotX,y:t.plotY,r:e.chart.options.tooltip.snap}})},drawTracker:function(){var e,t=this,n=t.options.cursor,i=n&&{cursor:n};Tt(t.data,function(n){(e=n.graphic)&&e.attr({isTracker:!0}).on("mouseover",function(){t.onMouseOver(),n.onMouseOver()}).on("mouseout",function(){t.options.stickyTracking||t.onMouseOut()}).css(i)})},cleanData:function(){}}),Nt.scatter=wt,wt=h(Gt,{init:function(){Gt.prototype.init.apply(this,arguments);var t,n=this;return e(n,{visible:n.visible!==!1,name:c(n.name,"Slice")}),t=function(){n.slice()},It(n,"select",t),It(n,"unselect",t),n},setVisible:function(e){var t,n=this.series.chart,i=this.tracker,r=this.dataLabel,o=this.connector;t=(this.visible=e=e===A?!this.visible:e)?"show":"hide",this.group[t](),i&&i[t](),r&&r[t](),o&&o[t](),this.legendItem&&n.legend.colorizeItem(this,e)},slice:function(e,t,n){var i=this.series.chart,r=this.slicedTranslation;g(n,i),c(t,!0),e=this.sliced=a(e)?e:!this.sliced,e={translateX:e?r[0]:i.plotLeft,translateY:e?r[1]:i.plotTop},this.group.animate(e),this.shadowGroup&&this.shadowGroup.animate(e)}}),wt=h(Xt,{type:"pie",isCartesian:!1,pointClass:wt,pointAttrToOptions:{stroke:"borderColor","stroke-width":"borderWidth",fill:"color"},getColor:function(){this.initialColor=x},animate:function(){var e=this;Tt(e.data,function(t){var n=t.graphic;t=t.shapeArgs;var i=-Z/2;n&&(n.attr({r:0,start:i,end:i}),n.animate({r:t.r,start:t.start,end:t.end},e.options.animation))}),e.animate=null},translate:function(){var e,n,i,r,o,a,s,l=0,c=-.25,u=this.options,d=u.slicedOffset,p=d+u.borderWidth,h=u.center.concat([u.size,u.innerSize||0]),f=this.chart,g=f.plotWidth,m=f.plotHeight,b=this.data,v=2*Z,y=G(g,m),_=u.dataLabels.distance;h=St(h,function(e,n){return(o=/%$/.test(e))?[g,m,y,y][n]*t(e)/100:e}),this.getX=function(e,t){return i=K.asin((e-h[1])/(h[2]/2+_)),h[0]+(t?-1:1)*Y(i)*(h[2]/2+_)},this.center=h,Tt(b,function(e){l+=e.y}),Tt(b,function(t){r=l?t.y/l:0,e=q(1e3*c*v)/1e3,c+=r,n=q(1e3*c*v)/1e3,t.shapeType="arc",t.shapeArgs={x:h[0],y:h[1],r:h[2]/2,innerR:h[3]/2,start:e,end:n},i=(n+e)/2,t.slicedTranslation=St([Y(i)*d+f.plotLeft,J(i)*d+f.plotTop],q),a=Y(i)*h[2]/2,s=J(i)*h[2]/2,t.tooltipPos=[h[0]+.7*a,h[1]+.7*s],t.labelPos=[h[0]+a+Y(i)*_,h[1]+s+J(i)*_,h[0]+a+Y(i)*p,h[1]+s+J(i)*p,h[0]+a,h[1]+s,0>_?"center":v/4>i?"left":"right",i],t.percentage=100*r,t.total=l}),this.setTooltipPoints()},render:function(){this.drawPoints(),this.options.enableMouseTracking!==!1&&this.drawTracker(),this.drawDataLabels(),this.options.animation&&this.animate&&this.animate(),this.isDirty=!1},drawPoints:function(){var t,n,i,r,o,a=this.chart,s=a.renderer,l=this.options.shadow;Tt(this.data,function(c){n=c.graphic,o=c.shapeArgs,i=c.group,r=c.shadowGroup,l&&!r&&(r=c.shadowGroup=s.g("shadow").attr({zIndex:4}).add()),i||(i=c.group=s.g("point").attr({zIndex:5}).add()),t=c.sliced?c.slicedTranslation:[a.plotLeft,a.plotTop],i.translate(t[0],t[1]),r&&r.translate(t[0],t[1]),n?n.animate(o):c.graphic=s.arc(o).attr(e(c.pointAttr[xt],{"stroke-linejoin":"round"})).add(c.group).shadow(l,r),c.visible===!1&&c.setVisible(!1)})},drawDataLabels:function(){var e,t,n,i,r,o,a,s,l,u,d,p,h,f=this.data,g=this.chart,m=this.options.dataLabels,b=c(m.connectorPadding,10),v=c(m.connectorWidth,1),y=m.distance>0,_=this.center[1],x=[[],[],[],[]],k=4;for(Xt.prototype.drawDataLabels.apply(this),Tt(f,function(e){var t=e.labelPos[7];x[0>t?0:Z/2>t?1:Z>t?2:3].push(e)}),x[1].reverse(),x[3].reverse(),p=function(e,t){return e.y>t.y};k--;){for(f=0,e=[].concat(x[k]),e.sort(p),h=e.length;h--;)e[h].rank=h;for(l=0;2>l;l++)for(r=(d=k%3)?9999:-9999,u=d?-1:1,h=0;x[k].length>h;h++)e=x[k][h],(t=e.dataLabel)&&(n=e.labelPos,s=gt,o=n[0],a=n[1],i||(i=t&&t.getBBox().height),y&&(l&&f>e.rank?s=ht:(!d&&r+i>a||d&&a>r-i)&&(a=r+u*i,o=this.getX(a,k>1),(!d&&a+i>_||d&&_>a-i)&&(l?s=ht:f++))),e.visible===!1&&(s=ht),s===gt&&(r=a),l&&(t.attr({visibility:s,align:n[6]})[t.moved?"animate":"attr"]({x:o+m.x+({left:b,right:-b}[n[6]]||0),y:a+m.y}),t.moved=!0,y&&v&&(t=e.connector,n=[vt,o+("left"===n[6]?5:-5),a,yt,o,a,yt,n[2],n[3],yt,n[4],n[5]],t?(t.animate({d:n}),t.attr("visibility",s)):e.connector=t=this.chart.renderer.path(n).attr({"stroke-width":v,stroke:m.connectorColor||"#606060",visibility:s,zIndex:3}).translate(g.plotLeft,g.plotTop).add())))}},drawTracker:Yt.prototype.drawTracker,getSymbol:function(){}}),Nt.pie=wt,H.Highcharts={Chart:y,dateFormat:T,pathAnim:S,getOptions:function(){return C},numberFormat:f,Point:Gt,Color:Ut,Renderer:_,seriesTypes:Nt,setOptions:function(e){return C=At(C,e),m(),C},Series:Xt,addEvent:It,createElement:p,discardElement:b,css:d,each:Tt,extend:e,map:St,merge:At,pick:c,extendClass:h,version:"2.1.5"}})();
Pranay92/cdnjs
ajax/libs/highcharts/2.1.5/highcharts.min.js
JavaScript
mit
79,523
var ImageDialog={preInit:function(){var e;tinyMCEPopup.requireLangPack(),(e=tinyMCEPopup.getParam("external_image_list_url"))&&document.write('<script language="javascript" type="text/javascript" src="'+tinyMCEPopup.editor.documentBaseURI.toAbsolute(e)+'"></script>')},init:function(e){var t=document.forms[0],i=t.elements,e=tinyMCEPopup.editor,n=e.dom,r=e.selection.getNode(),s=tinyMCEPopup.getParam("external_image_list","tinyMCEImageList");tinyMCEPopup.resizeToInnerSize(),this.fillClassList("class_list"),this.fillFileList("src_list",s),this.fillFileList("over_list",s),this.fillFileList("out_list",s),TinyMCE_EditableSelects.init(),"IMG"==r.nodeName&&(i.src.value=n.getAttrib(r,"src"),i.width.value=n.getAttrib(r,"width"),i.height.value=n.getAttrib(r,"height"),i.alt.value=n.getAttrib(r,"alt"),i.title.value=n.getAttrib(r,"title"),i.vspace.value=this.getAttrib(r,"vspace"),i.hspace.value=this.getAttrib(r,"hspace"),i.border.value=this.getAttrib(r,"border"),selectByValue(t,"align",this.getAttrib(r,"align")),selectByValue(t,"class_list",n.getAttrib(r,"class"),!0,!0),i.style.value=n.getAttrib(r,"style"),i.id.value=n.getAttrib(r,"id"),i.dir.value=n.getAttrib(r,"dir"),i.lang.value=n.getAttrib(r,"lang"),i.usemap.value=n.getAttrib(r,"usemap"),i.longdesc.value=n.getAttrib(r,"longdesc"),i.insert.value=e.getLang("update"),/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/.test(n.getAttrib(r,"onmouseover"))&&(i.onmouseoversrc.value=n.getAttrib(r,"onmouseover").replace(/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/,"$1")),/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/.test(n.getAttrib(r,"onmouseout"))&&(i.onmouseoutsrc.value=n.getAttrib(r,"onmouseout").replace(/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/,"$1")),e.settings.inline_styles&&(n.getAttrib(r,"align")&&this.updateStyle("align"),n.getAttrib(r,"hspace")&&this.updateStyle("hspace"),n.getAttrib(r,"border")&&this.updateStyle("border"),n.getAttrib(r,"vspace")&&this.updateStyle("vspace"))),document.getElementById("srcbrowsercontainer").innerHTML=getBrowserHTML("srcbrowser","src","image","theme_advanced_image"),isVisible("srcbrowser")&&(document.getElementById("src").style.width="260px"),document.getElementById("onmouseoversrccontainer").innerHTML=getBrowserHTML("overbrowser","onmouseoversrc","image","theme_advanced_image"),isVisible("overbrowser")&&(document.getElementById("onmouseoversrc").style.width="260px"),document.getElementById("onmouseoutsrccontainer").innerHTML=getBrowserHTML("outbrowser","onmouseoutsrc","image","theme_advanced_image"),isVisible("outbrowser")&&(document.getElementById("onmouseoutsrc").style.width="260px"),e.getParam("advimage_constrain_proportions",!0)&&(t.constrain.checked=!0),i.onmouseoversrc.value||i.onmouseoutsrc.value?this.setSwapImage(!0):this.setSwapImage(!1),this.changeAppearance(),this.showPreviewImage(i.src.value,1)},insert:function(){var e=tinyMCEPopup.editor,t=this,i=document.forms[0];return""===i.src.value?("IMG"==e.selection.getNode().nodeName&&(e.dom.remove(e.selection.getNode()),e.execCommand("mceRepaint")),tinyMCEPopup.close(),void 0):tinyMCEPopup.getParam("accessibility_warnings",1)&&!i.alt.value?(tinyMCEPopup.confirm(tinyMCEPopup.getLang("advimage_dlg.missing_alt"),function(e){e&&t.insertAndClose()}),void 0):(t.insertAndClose(),void 0)},insertAndClose:function(){var e,t=tinyMCEPopup.editor,i=document.forms[0],n=i.elements,r={};tinyMCEPopup.restoreSelection(),tinymce.isWebKit&&t.getWin().focus(),r=t.settings.inline_styles?{vspace:"",hspace:"",border:"",align:""}:{vspace:n.vspace.value,hspace:n.hspace.value,border:n.border.value,align:getSelectValue(i,"align")},tinymce.extend(r,{src:n.src.value.replace(/ /g,"%20"),width:n.width.value,height:n.height.value,alt:n.alt.value,title:n.title.value,"class":getSelectValue(i,"class_list"),style:n.style.value,id:n.id.value,dir:n.dir.value,lang:n.lang.value,usemap:n.usemap.value,longdesc:n.longdesc.value}),r.onmouseover=r.onmouseout="",i.onmousemovecheck.checked&&(n.onmouseoversrc.value&&(r.onmouseover="this.src='"+n.onmouseoversrc.value+"';"),n.onmouseoutsrc.value&&(r.onmouseout="this.src='"+n.onmouseoutsrc.value+"';")),e=t.selection.getNode(),e&&"IMG"==e.nodeName?t.dom.setAttribs(e,r):(tinymce.each(r,function(e,t){""===e&&delete r[t]}),t.execCommand("mceInsertContent",!1,tinyMCEPopup.editor.dom.createHTML("img",r),{skip_undo:1}),t.undoManager.add()),tinyMCEPopup.editor.execCommand("mceRepaint"),tinyMCEPopup.editor.focus(),tinyMCEPopup.close()},getAttrib:function(e,t){var i,n,r=tinyMCEPopup.editor,s=r.dom;if(r.settings.inline_styles)switch(t){case"align":if(i=s.getStyle(e,"float"))return i;if(i=s.getStyle(e,"vertical-align"))return i;break;case"hspace":if(i=s.getStyle(e,"margin-left"),n=s.getStyle(e,"margin-right"),i&&i==n)return parseInt(i.replace(/[^0-9]/g,""));break;case"vspace":if(i=s.getStyle(e,"margin-top"),n=s.getStyle(e,"margin-bottom"),i&&i==n)return parseInt(i.replace(/[^0-9]/g,""));break;case"border":if(i=0,tinymce.each(["top","right","bottom","left"],function(t){return t=s.getStyle(e,"border-"+t+"-width"),!t||t!=i&&0!==i?(i=0,!1):(t&&(i=t),void 0)}),i)return parseInt(i.replace(/[^0-9]/g,""))}return(i=s.getAttrib(e,t))?i:""},setSwapImage:function(e){var t=document.forms[0];t.onmousemovecheck.checked=e,setBrowserDisabled("overbrowser",!e),setBrowserDisabled("outbrowser",!e),t.over_list&&(t.over_list.disabled=!e),t.out_list&&(t.out_list.disabled=!e),t.onmouseoversrc.disabled=!e,t.onmouseoutsrc.disabled=!e},fillClassList:function(e){var t,i,n=tinyMCEPopup.dom,r=n.get(e);(t=tinyMCEPopup.getParam("theme_advanced_styles"))?(i=[],tinymce.each(t.split(";"),function(e){var t=e.split("=");i.push({title:t[0],"class":t[1]})})):i=tinyMCEPopup.editor.dom.getClasses(),i.length>0?(r.options.length=0,r.options[r.options.length]=new Option(tinyMCEPopup.getLang("not_set"),""),tinymce.each(i,function(e){r.options[r.options.length]=new Option(e.title||e["class"],e["class"])})):n.remove(n.getParent(e,"tr"))},fillFileList:function(e,t){var i=tinyMCEPopup.dom,n=i.get(e);t="function"==typeof t?t():window[t],n.options.length=0,t&&t.length>0?(n.options[n.options.length]=new Option("",""),tinymce.each(t,function(e){n.options[n.options.length]=new Option(e[0],e[1])})):i.remove(i.getParent(e,"tr"))},resetImageData:function(){var e=document.forms[0];e.elements.width.value=e.elements.height.value=""},updateImageData:function(e,t){var i=document.forms[0];t||(i.elements.width.value=e.width,i.elements.height.value=e.height),this.preloadImg=e},changeAppearance:function(){var e=tinyMCEPopup.editor,t=document.forms[0],i=document.getElementById("alignSampleImg");i&&(e.getParam("inline_styles")?e.dom.setAttrib(i,"style",t.style.value):(i.align=t.align.value,i.border=t.border.value,i.hspace=t.hspace.value,i.vspace=t.vspace.value))},changeHeight:function(){var e,t=document.forms[0],i=this;t.constrain.checked&&i.preloadImg&&""!=t.width.value&&""!=t.height.value&&(e=parseInt(t.width.value)/parseInt(i.preloadImg.width)*i.preloadImg.height,t.height.value=e.toFixed(0))},changeWidth:function(){var e,t=document.forms[0],i=this;t.constrain.checked&&i.preloadImg&&""!=t.width.value&&""!=t.height.value&&(e=parseInt(t.height.value)/parseInt(i.preloadImg.height)*i.preloadImg.width,t.width.value=e.toFixed(0))},updateStyle:function(e){var t,i,n,r,s=tinyMCEPopup.dom,o=tinymce.isIE,a=document.forms[0],l=s.create("img",{style:s.get("style").value});if(tinyMCEPopup.editor.settings.inline_styles){if("align"==e&&(s.setStyle(l,"float",""),s.setStyle(l,"vertical-align",""),r=getSelectValue(a,"align"),r&&("left"==r||"right"==r?s.setStyle(l,"float",r):l.style.verticalAlign=r)),"border"==e&&(t=l.style.border?l.style.border.split(" "):[],i=s.getStyle(l,"border-style"),n=s.getStyle(l,"border-color"),s.setStyle(l,"border",""),r=a.border.value,r||"0"==r))if("0"==r)l.style.border=o?"0":"0 none none";else{var h=tinymce.isIE&&(!document.documentMode||9>document.documentMode);3==t.length&&t[h?2:1]?i=t[h?2:1]:i&&"none"!=i||(i="solid"),3==t.length&&t[o?0:2]?n=t[h?0:2]:n&&"none"!=n||(n="black"),l.style.border=r+"px "+i+" "+n}"hspace"==e&&(s.setStyle(l,"marginLeft",""),s.setStyle(l,"marginRight",""),r=a.hspace.value,r&&(l.style.marginLeft=r+"px",l.style.marginRight=r+"px")),"vspace"==e&&(s.setStyle(l,"marginTop",""),s.setStyle(l,"marginBottom",""),r=a.vspace.value,r&&(l.style.marginTop=r+"px",l.style.marginBottom=r+"px")),s.get("style").value=s.serializeStyle(s.parseStyle(l.style.cssText),"img")}},changeMouseMove:function(){},showPreviewImage:function(e,t){return e?(!t&&tinyMCEPopup.getParam("advimage_update_dimensions_onchange",!0)&&this.resetImageData(),e=tinyMCEPopup.editor.documentBaseURI.toAbsolute(e),t?tinyMCEPopup.dom.setHTML("prev",'<img id="previewImg" src="'+e+'" border="0" onload="ImageDialog.updateImageData(this, 1);" />'):tinyMCEPopup.dom.setHTML("prev",'<img id="previewImg" src="'+e+'" border="0" onload="ImageDialog.updateImageData(this);" onerror="ImageDialog.resetImageData();" />'),void 0):(tinyMCEPopup.dom.setHTML("prev",""),void 0)}};ImageDialog.preInit(),tinyMCEPopup.onInit.add(ImageDialog.init,ImageDialog);
gagan-bansal/cdnjs
ajax/libs/tinymce/3.5.8/plugins/advimage/js/image.min.js
JavaScript
mit
9,014
(function(){function e(e,t){var n;e||(e={});for(n in t)e[n]=t[n];return e}function t(){for(var e=0,t=arguments,n=t.length,i={};n>e;e++)i[t[e++]]=t[e];return i}function n(e,t){return parseInt(e,t||10)}function i(e){return"string"==typeof e}function r(e){return"object"==typeof e}function o(e){return"[object Array]"===Object.prototype.toString.call(e)}function a(e){return"number"==typeof e}function s(e){return ht.log(e)/ht.LN10}function l(e){return ht.pow(10,e)}function c(e,t){for(var n=e.length;n--;)if(e[n]===t){e.splice(n,1);break}}function u(e){return e!==W&&null!==e}function d(e,t,n){var o,a,s="setAttribute";if(i(t))u(n)?e[s](t,n):e&&e.getAttribute&&(a=e.getAttribute(t));else if(u(t)&&r(t))for(o in t)e[s](o,t[o]);return a}function h(e){return o(e)?e:[e]}function p(){var e,t,n=arguments,i=n.length;for(e=0;i>e;e++)if(t=n[e],t!==void 0&&null!==t)return t}function f(t,n){Ct&&n&&n.opacity!==W&&(n.filter="alpha(opacity="+100*n.opacity+")"),e(t.style,n)}function g(t,n,i,r,o){var a=ut.createElement(t);return n&&e(a,n),o&&f(a,{padding:0,border:Kt,margin:0}),i&&f(a,i),r&&r.appendChild(a),a}function m(t,n){var i=function(){};return i.prototype=new t,e(i.prototype,n),i}function v(e){return e=""+(e||0),e.indexOf(".")>-1?e.split(".")[1].length:0}function b(e,t,i,r){var o=V.lang,a=e,s=-1===t?v(e):isNaN(t=bt(t))?2:t,l=void 0===i?o.decimalPoint:i,c=void 0===r?o.thousandsSep:r,u=0>a?"-":"",d=n(a=bt(+a||0).toFixed(s))+"",h=d.length>3?d.length%3:0;return u+(h?d.substr(0,h)+c:"")+d.substr(h).replace(/(\d{3})(?=\d)/g,"$1"+c)+(s?l+bt(a-d).toFixed(s).slice(2):"")}function y(e,t){return Array((t||2)+1-(e+"").length).join(0)+e}function x(e,t,n,i){var r,o;for(n=p(n,1),r=e/n,t||(t=[1,2,2.5,5,10],i&&i.allowDecimals===!1&&(1===n?t=[1,2,5,10]:.1>=n&&(t=[1/n]))),o=0;t.length>o&&(e=t[o],!((t[o]+(t[o+1]||t[o]))/2>=r));o++);return e*=n}function k(e,t){var n,i,r=t||[[Yt,[1,2,5,10,20,25,50,100,200,500]],[Jt,[1,2,5,10,15,30]],[Zt,[1,2,5,10,15,30]],[Qt,[1,2,3,4,6,8,12]],[en,[1,2]],[tn,[1,2]],[nn,[1,2,3,4,6]],[rn,null]],o=r[r.length-1],a=J[o[0]],s=o[1];for(i=0;r.length>i;i++)if(o=r[i],a=J[o[0]],s=o[1],r[i+1]){var l=(a*s[s.length-1]+J[r[i+1][0]])/2;if(l>=e)break}return a===J[rn]&&5*a>e&&(s=[1,2,5]),a===J[rn]&&5*a>e&&(s=[1,2,5]),n=x(e/a,s),{unitRange:a,count:n,unitName:o[0]}}function w(t,n,i,r){var o,a,s=[],l={},c=V.global.useUTC,u=new Date(n),d=t.unitRange,h=t.count;d>=J[Jt]&&(u.setMilliseconds(0),u.setSeconds(d>=J[Zt]?0:h*ft(u.getSeconds()/h))),d>=J[Zt]&&u[ot](d>=J[Qt]?0:h*ft(u[Q]()/h)),d>=J[Qt]&&u[at](d>=J[en]?0:h*ft(u[et]()/h)),d>=J[en]&&u[st](d>=J[nn]?1:h*ft(u[nt]()/h)),d>=J[nn]&&(u[lt](d>=J[rn]?0:h*ft(u[it]()/h)),a=u[rt]()),d>=J[rn]&&(a-=a%h,u[ct](a)),d===J[tn]&&u[st](u[nt]()-u[tt]()+p(r,1)),o=1,a=u[rt]();for(var f=u.getTime(),g=u[it](),m=u[nt](),v=c?0:(864e5+1e3*60*u.getTimezoneOffset())%864e5;i>f;)s.push(f),d===J[rn]?f=Z(a+o*h,0):d===J[nn]?f=Z(a,g+o*h):c||d!==J[en]&&d!==J[tn]?(f+=d*h,J[Qt]>=d&&f%J[en]===v&&(l[f]=en)):f=Z(a,g,m+o*h*(d===J[en]?1:7)),o++;return s.push(f),s.info=e(t,{higherRanks:l,totalRange:d*h}),s}function _(){this.color=0,this.symbol=0}function C(e,t){var n,i,r=e.length;for(i=0;r>i;i++)e[i].ss_i=i;for(e.sort(function(e,i){return n=t(e,i),0===n?e.ss_i-i.ss_i:n}),i=0;r>i;i++)delete e[i].ss_i}function T(e){for(var t=e.length,n=e[0];t--;)n>e[t]&&(n=e[t]);return n}function E(e){for(var t=e.length,n=e[0];t--;)e[t]>n&&(n=e[t]);return n}function S(e,t){var n;for(n in e)e[n]&&e[n]!==t&&e[n].destroy&&e[n].destroy(),delete e[n]}function A(e){U||(U=g(Pt)),e&&U.appendChild(e),U.innerHTML=""}function D(e,t){var n="Highcharts error #"+e+": www.highcharts.com/errors/"+e;if(t)throw n;dt.console&&console.log(n)}function I(e){return parseFloat(e.toPrecision(14))}function R(e,t){X=p(e,t.animation)}function L(){var e=V.global.useUTC,t=e?"getUTC":"get",n=e?"setUTC":"set";Z=e?Date.UTC:function(e,t,n,i,r,o){return new Date(e,t,p(n,1),p(i,0),p(r,0),p(o,0)).getTime()},Q=t+"Minutes",et=t+"Hours",tt=t+"Day",nt=t+"Date",it=t+"Month",rt=t+"FullYear",ot=n+"Minutes",at=n+"Hours",st=n+"Date",lt=n+"Month",ct=n+"FullYear"}function O(e){return V=yn(V,e),L(),V}function F(){return V}function N(){}function P(e,t,n){this.axis=e,this.pos=t,this.type=n||"",this.isNew=!0,n||this.addLabel()}function M(e,t){return this.axis=e,t&&(this.options=t,this.id=t.id),this}function B(e,t,n,i,r){var o=e.chart.inverted;this.axis=e,this.isNegative=n,this.options=t,this.x=i,this.stack=r,this.alignOptions={align:t.align||(o?n?"left":"right":"center"),verticalAlign:t.verticalAlign||(o?"middle":n?"bottom":"top"),y:p(t.y,o?4:n?14:-6),x:p(t.x,o?n?-6:6:0)},this.textAlign=t.textAlign||(o?n?"right":"left":"center")}function j(){this.init.apply(this,arguments)}function z(e,t){var i=t.borderWidth,r=t.style,o=t.shared,a=n(r.padding);this.chart=e,this.options=t,r.padding=0,this.crosshairs=[],this.currentX=0,this.currentY=0,this.tooltipIsHidden=!0,this.label=e.renderer.label("",0,0,null,null,null,t.useHTML,null,"tooltip").attr({padding:a,fill:t.backgroundColor,"stroke-width":i,r:t.borderRadius,zIndex:8}).css(r).hide().add(),Rt||this.label.shadow(t.shadow),this.shared=o}function H(e,t){var n=Rt?"":t.chart.zoomType;this.zoomX=/x/.test(n),this.zoomY=/y/.test(n),this.options=t,this.chart=e,this.init(e,t.tooltip)}function $(e){this.init(e)}function K(e,t){var n,i=e.series;e.series=null,n=yn(V,e),n.series=e.series=i;var o=n.chart,a=o.margin,s=r(a)?a:[a,a,a,a];this.optionsMarginTop=p(o.marginTop,s[0]),this.optionsMarginRight=p(o.marginRight,s[1]),this.optionsMarginBottom=p(o.marginBottom,s[2]),this.optionsMarginLeft=p(o.marginLeft,s[3]);var l=o.events;this.runChartClick=l&&!!l.click,this.callback=t,this.isResizing=0,this.options=n,this.axes=[],this.series=[],this.hasCartesianSeries=o.showAxes,this.init(l)}var W,q,U,V,G,X,Y,J,Z,Q,et,tt,nt,it,rt,ot,at,st,lt,ct,ut=document,dt=window,ht=Math,pt=ht.round,ft=ht.floor,gt=ht.ceil,mt=ht.max,vt=ht.min,bt=ht.abs,yt=ht.cos,xt=ht.sin,kt=ht.PI,wt=2*kt/360,_t=navigator.userAgent,Ct=/msie/i.test(_t)&&!dt.opera,Tt=8===ut.documentMode,Et=/AppleWebKit/.test(_t),St=/Firefox/.test(_t),At="http://www.w3.org/2000/svg",Dt=!!ut.createElementNS&&!!ut.createElementNS(At,"svg").createSVGRect,It=St&&4>parseInt(_t.split("Firefox/")[1],10),Rt=!Dt&&!Ct&&!!ut.createElement("canvas").getContext,Lt=ut.documentElement.ontouchstart!==W,Ot={},Ft=0,Nt=function(){},Pt="div",Mt="absolute",Bt="relative",jt="hidden",zt="highcharts-",Ht="visible",$t="px",Kt="none",Wt="M",qt="L",Ut="rgba(192,192,192,"+(Dt?1e-6:.002)+")",Vt="",Gt="hover",Xt="select",Yt="millisecond",Jt="second",Zt="minute",Qt="hour",en="day",tn="week",nn="month",rn="year",on="fill",an="linearGradient",sn="stops",ln="stroke",cn="stroke-width",un={};dt.Highcharts={},G=function(e,t,n){if(!u(t)||isNaN(t))return"Invalid date";e=p(e,"%Y-%m-%d %H:%M:%S");var i,r=new Date(t),o=r[et](),a=r[tt](),s=r[nt](),l=r[it](),c=r[rt](),d=V.lang,h=d.weekdays,f={a:h[a].substr(0,3),A:h[a],d:y(s),e:s,b:d.shortMonths[l],B:d.months[l],m:y(l+1),y:(""+c).substr(2,2),Y:c,H:y(o),I:y(o%12||12),l:o%12||12,M:y(r[Q]()),p:12>o?"AM":"PM",P:12>o?"am":"pm",S:y(r.getSeconds()),L:y(pt(t%1e3),3)};for(i in f)e=e.replace("%"+i,f[i]);return n?e.substr(0,1).toUpperCase()+e.substr(1):e},_.prototype={wrapColor:function(e){this.color>=e&&(this.color=0)},wrapSymbol:function(e){this.symbol>=e&&(this.symbol=0)}},J=t(Yt,1,Jt,1e3,Zt,6e4,Qt,36e5,en,864e5,tn,6048e5,nn,2592e6,rn,31556952e3),Y={init:function(e,t,n){t=t||"";var i,r,o,a,s,l=e.shift,c=t.indexOf("C")>-1,u=c?7:3,d=t.split(" "),h=[].concat(n),p=function(e){for(o=e.length;o--;)e[o]===Wt&&e.splice(o+1,0,e[o+1],e[o+2],e[o+1],e[o+2])};if(c&&(p(d),p(h)),e.isArea&&(a=d.splice(d.length-6,6),s=h.splice(h.length-6,6)),h.length/u>=l)for(;l--;)h=[].concat(h).splice(0,u).concat(h);if(e.shift=0,d.length)for(i=h.length;i>d.length;)r=[].concat(d).splice(d.length-u,u),c&&(r[u-6]=r[u-2],r[u-5]=r[u-1]),d=d.concat(r);return a&&(d=d.concat(a),h=h.concat(s)),[d,h]},step:function(e,t,n,i){var r,o=[],a=e.length;if(1===n)o=i;else if(a===t.length&&1>n)for(;a--;)r=parseFloat(e[a]),o[a]=isNaN(r)?e[a]:n*parseFloat(t[a]-r)+r;else o=t;return o}};var dn=dt.HighchartsAdapter,hn=dn||{},pn=hn.adapterRun,fn=hn.getScript,gn=hn.each,mn=hn.grep,vn=hn.offset,bn=hn.map,yn=hn.merge,xn=hn.addEvent,kn=hn.removeEvent,wn=hn.fireEvent,_n=hn.washMouseEvent,Cn=hn.animate,Tn=hn.stop;if(dn&&dn.init&&dn.init(Y),!dn&&dt.jQuery){var En=jQuery;fn=En.getScript,pn=function(e,t){return En(e)[t]()},gn=function(e,t){for(var n=0,i=e.length;i>n;n++)if(t.call(e[n],e[n],n,e)===!1)return n},mn=En.grep,bn=function(e,t){for(var n=[],i=0,r=e.length;r>i;i++)n[i]=t.call(e[i],e[i],i,e);return n},yn=function(){var e=arguments;return En.extend(!0,null,e[0],e[1],e[2],e[3])},vn=function(e){return En(e).offset()},xn=function(e,t,n){En(e).bind(t,n)},kn=function(e,t,n){var i=ut.removeEventListener?"removeEventListener":"detachEvent";ut[i]&&!e[i]&&(e[i]=function(){}),En(e).unbind(t,n)},wn=function(t,n,i,r){var o,a=En.Event(n),s="detached"+n;!Ct&&i&&(delete i.layerX,delete i.layerY),e(a,i),t[n]&&(t[s]=t[n],t[n]=null),gn(["preventDefault","stopPropagation"],function(e){var t=a[e];a[e]=function(){try{t.call(a)}catch(n){"preventDefault"===e&&(o=!0)}}}),En(t).trigger(a),t[s]&&(t[n]=t[s],t[s]=null),!r||a.isDefaultPrevented()||o||r(a)},_n=function(e){return e},Cn=function(e,t,n){var i=En(e);t.d&&(e.toD=t.d,t.d=1),i.stop(),i.animate(t,n)},Tn=function(e){En(e).stop()},En.extend(En.easing,{easeOutQuad:function(e,t,n,i,r){return-i*(t/=r)*(t-2)+n}});var Sn=En.fx,An=Sn.step;gn(["cur","_default","width","height"],function(e,t){var n,i,r=An;"cur"===e?r=Sn.prototype:"_default"===e&&En.Tween&&(r=En.Tween.propHooks[e],e="set"),n=r[e],n&&(r[e]=function(r){return r=t?r:this,i=r.elem,i.attr?i.attr(r.prop,"cur"===e?W:r.now):n.apply(this,arguments)})}),An.d=function(e){var t=e.elem;if(!e.started){var n=Y.init(t,t.d,t.toD);e.start=n[0],e.end=n[1],e.started=!0}t.attr("d",Y.step(e.start,e.end,e.pos,t.toD))}}var Dn={enabled:!0,align:"center",x:0,y:15,style:{color:"#666",fontSize:"11px",lineHeight:"14px"}};V={colors:["#4572A7","#AA4643","#89A54E","#80699B","#3D96AE","#DB843D","#92A8CD","#A47D7C","#B5CA92"],symbols:["circle","diamond","square","triangle","triangle-down"],lang:{loading:"Loading...",months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],decimalPoint:".",resetZoom:"Reset zoom",resetZoomTitle:"Reset zoom level 1:1",thousandsSep:","},global:{useUTC:!0,canvasToolsURL:"http://code.highcharts.com/2.2.5/modules/canvas-tools.js"},chart:{borderColor:"#4572A7",borderRadius:5,defaultSeriesType:"line",ignoreHiddenSeries:!0,spacingTop:10,spacingRight:10,spacingBottom:15,spacingLeft:10,style:{fontFamily:'"Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif',fontSize:"12px"},backgroundColor:"#FFFFFF",plotBorderColor:"#C0C0C0",resetZoomButton:{theme:{zIndex:20},position:{align:"right",x:-10,y:10}}},title:{text:"Chart title",align:"center",y:15,style:{color:"#3E576F",fontSize:"16px"}},subtitle:{text:"",align:"center",y:30,style:{color:"#6D869F"}},plotOptions:{line:{allowPointSelect:!1,showCheckbox:!1,animation:{duration:1e3},events:{},lineWidth:2,shadow:!0,marker:{enabled:!0,lineWidth:0,radius:4,lineColor:"#FFFFFF",states:{hover:{},select:{fillColor:"#FFFFFF",lineColor:"#000000",lineWidth:2}}},point:{events:{}},dataLabels:yn(Dn,{enabled:!1,y:-6,formatter:function(){return this.y}}),cropThreshold:300,pointRange:0,showInLegend:!0,states:{hover:{marker:{}},select:{marker:{}}},stickyTracking:!0}},labels:{style:{position:Mt,color:"#3E576F"}},legend:{enabled:!0,align:"center",layout:"horizontal",labelFormatter:function(){return this.name},borderWidth:1,borderColor:"#909090",borderRadius:5,navigation:{activeColor:"#3E576F",inactiveColor:"#CCC"},shadow:!1,itemStyle:{cursor:"pointer",color:"#3E576F",fontSize:"12px"},itemHoverStyle:{color:"#000"},itemHiddenStyle:{color:"#CCC"},itemCheckboxStyle:{position:Mt,width:"13px",height:"13px"},symbolWidth:16,symbolPadding:5,verticalAlign:"bottom",x:0,y:0},loading:{labelStyle:{fontWeight:"bold",position:Bt,top:"1em"},style:{position:Mt,backgroundColor:"white",opacity:.5,textAlign:"center"}},tooltip:{enabled:!0,backgroundColor:"rgba(255, 255, 255, .85)",borderWidth:2,borderRadius:5,dateTimeLabelFormats:{millisecond:"%A, %b %e, %H:%M:%S.%L",second:"%A, %b %e, %H:%M:%S",minute:"%A, %b %e, %H:%M",hour:"%A, %b %e, %H:%M",day:"%A, %b %e, %Y",week:"Week from %A, %b %e, %Y",month:"%B %Y",year:"%Y"},headerFormat:'<span style="font-size: 10px">{point.key}</span><br/>',pointFormat:'<span style="color:{series.color}">{series.name}</span>: <b>{point.y}</b><br/>',shadow:!0,shared:Rt,snap:Lt?25:10,style:{color:"#333333",fontSize:"12px",padding:"5px",whiteSpace:"nowrap"}},credits:{enabled:!0,text:"Highcharts.com",href:"http://www.highcharts.com",position:{align:"right",x:-10,verticalAlign:"bottom",y:-5},style:{cursor:"pointer",color:"#909090",fontSize:"10px"}}};var In=V.plotOptions,Rn=In.line;L();var Ln=function(e){function t(e){s=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]?(?:\.[0-9]+)?)\s*\)/.exec(e),s?l=[n(s[1]),n(s[2]),n(s[3]),parseFloat(s[4],10)]:(s=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(e),s&&(l=[n(s[1],16),n(s[2],16),n(s[3],16),1]))}function i(t){var n;return n=l&&!isNaN(l[0])?"rgb"===t?"rgb("+l[0]+","+l[1]+","+l[2]+")":"a"===t?l[3]:"rgba("+l.join(",")+")":e}function r(e){if(a(e)&&0!==e){var t;for(t=0;3>t;t++)l[t]+=n(255*e),0>l[t]&&(l[t]=0),l[t]>255&&(l[t]=255)}return this}function o(e){return l[3]=e,this}var s,l=[];return t(e),{get:i,brighten:r,setOpacity:o}};N.prototype={init:function(e,t){var n=this;n.element="span"===t?g(t):ut.createElementNS(At,t),n.renderer=e,n.attrSetters={}},animate:function(e,t,n){var i=p(t,X,!0);Tn(this),i?(i=yn(i),n&&(i.complete=n),Cn(this,e,i)):(this.attr(e),n&&n())},attr:function(e,t){var r,o,a,s,l,c,h,p,f,g=this,m=g.element,v=m.nodeName,b=g.renderer,y=g.attrSetters,x=g.shadows,k=g;if(i(e)&&u(t)&&(r=e,e={},e[r]=t),i(e))r=e,"circle"===v?r={x:"cx",y:"cy"}[r]||r:"strokeWidth"===r&&(r="stroke-width"),k=d(m,r)||g[r]||0,"d"!==r&&"visibility"!==r&&(k=parseFloat(k));else for(r in e)if(c=!1,o=e[r],a=y[r]&&y[r](o,r),a!==!1){if(a!==W&&(o=a),"d"===r)o&&o.join&&(o=o.join(" ")),/(NaN| {2}|^$)/.test(o)&&(o="M 0 0");else if("x"===r&&"text"===v){for(s=0;m.childNodes.length>s;s++)l=m.childNodes[s],d(l,"x")===d(m,"x")&&d(l,"x",o);g.rotation&&d(m,"transform","rotate("+g.rotation+" "+o+" "+n(e.y||d(m,"y"))+")")}else if("fill"===r)o=b.color(o,m,r);else if("circle"!==v||"x"!==r&&"y"!==r)if("rect"===v&&"r"===r)d(m,{rx:o,ry:o}),c=!0;else if("translateX"===r||"translateY"===r||"rotation"===r||"verticalAlign"===r)f=!0,c=!0;else if("stroke"===r)o=b.color(o,m,r);else if("dashstyle"===r){if(r="stroke-dasharray",o=o&&o.toLowerCase(),"solid"===o)o=Kt;else if(o){for(o=o.replace("shortdashdotdot","3,1,1,1,1,1,").replace("shortdashdot","3,1,1,1").replace("shortdot","1,1,").replace("shortdash","3,1,").replace("longdash","8,3,").replace(/dot/g,"1,3,").replace("dash","4,3,").replace(/,$/,"").split(","),s=o.length;s--;)o[s]=n(o[s])*e["stroke-width"];o=o.join(",")}}else"isTracker"===r?g[r]=o:"width"===r?o=n(o):"align"===r?(r="text-anchor",o={left:"start",center:"middle",right:"end"}[o]):"title"===r&&(h=m.getElementsByTagName("title")[0],h||(h=ut.createElementNS(At,"title"),m.appendChild(h)),h.textContent=o);else r={x:"cx",y:"cy"}[r]||r;if("strokeWidth"===r&&(r="stroke-width"),Et&&"stroke-width"===r&&0===o&&(o=1e-6),g.symbolName&&/^(x|y|width|height|r|start|end|innerR|anchorX|anchorY)/.test(r)&&(p||(g.symbolAttr(e),p=!0),c=!0),x&&/^(width|height|visibility|x|y|d|transform)$/.test(r))for(s=x.length;s--;)d(x[s],r,"height"===r?mt(o-(x[s].cutHeight||0),0):o);("width"===r||"height"===r)&&"rect"===v&&0>o&&(o=0),g[r]=o,f&&g.updateTransform(),"text"===r?(g.textStr=o,g.added&&b.buildText(g)):c||d(m,r,o)}if(Et&&/Chrome\/(18|19)/.test(_t)&&"text"===v&&(e.x!==W||e.y!==W)){var w=m.parentNode,_=m.nextSibling;w&&(w.removeChild(m),_?w.insertBefore(m,_):w.appendChild(m))}return k},symbolAttr:function(e){var t=this;gn(["x","y","r","start","end","width","height","innerR","anchorX","anchorY"],function(n){t[n]=p(e[n],t[n])}),t.attr({d:t.renderer.symbols[t.symbolName](t.x,t.y,t.width,t.height,t)})},clip:function(e){return this.attr("clip-path","url("+this.renderer.url+"#"+e.id+")")},crisp:function(e,t,n,i,r){var o,a,s=this,l={},c={};e=e||s.strokeWidth||s.attr&&s.attr("stroke-width")||0,a=pt(e)%2/2,c.x=ft(t||s.x||0)+a,c.y=ft(n||s.y||0)+a,c.width=ft((i||s.width||0)-2*a),c.height=ft((r||s.height||0)-2*a),c.strokeWidth=e;for(o in c)s[o]!==c[o]&&(s[o]=l[o]=c[o]);return l},css:function(t){var n,i=this,r=i.element,o=t&&t.width&&"text"===r.nodeName,a="",s=function(e,t){return"-"+t.toLowerCase()};if(t&&t.color&&(t.fill=t.color),t=e(i.styles,t),i.styles=t,Ct&&!Dt)o&&delete t.width,f(i.element,t);else{for(n in t)a+=n.replace(/([A-Z])/g,s)+":"+t[n]+";";i.attr({style:a})}return o&&i.added&&i.renderer.buildText(i),i},on:function(e,t){var n=t;return Lt&&"click"===e&&(e="touchstart",n=function(e){e.preventDefault(),t()}),this.element["on"+e]=n,this},setRadialReference:function(e){return this.element.radialReference=e,this},translate:function(e,t){return this.attr({translateX:e,translateY:t})},invert:function(){var e=this;return e.inverted=!0,e.updateTransform(),e},htmlCss:function(t){var n=this,i=n.element,r=t&&"SPAN"===i.tagName&&t.width;return r&&(delete t.width,n.textWidth=r,n.updateTransform()),n.styles=e(n.styles,t),f(n.element,t),n},htmlGetBBox:function(e){var t=this,n=t.element,i=t.bBox;return(!i||e)&&("text"===n.nodeName&&(n.style.position=Mt),i=t.bBox={x:n.offsetLeft,y:n.offsetTop,width:n.offsetWidth,height:n.offsetHeight}),i},htmlUpdateTransform:function(){if(!this.added)return this.alignOnAdd=!0,void 0;var e=this,t=e.renderer,i=e.element,r=e.translateX||0,o=e.translateY||0,a=e.x||0,s=e.y||0,l=e.textAlign||"left",c={left:0,center:.5,right:1}[l],d=l&&"left"!==l,h=e.shadows;if((r||o)&&(f(i,{marginLeft:r,marginTop:o}),h&&gn(h,function(e){f(e,{marginLeft:r+1,marginTop:o+1})})),e.inverted&&gn(i.childNodes,function(e){t.invertChild(e,i)}),"SPAN"===i.tagName){var g,m,v,b,y=e.rotation,x=0,k=1,w=0,_=n(e.textWidth),C=e.xCorr||0,T=e.yCorr||0,E=[y,l,i.innerHTML,e.textWidth].join(",");E!==e.cTT&&(u(y)&&(x=y*wt,k=yt(x),w=xt(x),f(i,{filter:y?["progid:DXImageTransform.Microsoft.Matrix(M11=",k,", M12=",-w,", M21=",w,", M22=",k,", sizingMethod='auto expand')"].join(""):Kt})),g=p(e.elemWidth,i.offsetWidth),m=p(e.elemHeight,i.offsetHeight),g>_&&/[ \-]/.test(i.innerText)&&(f(i,{width:_+$t,display:"block",whiteSpace:"normal"}),g=_),v=t.fontMetrics(i.style.fontSize).b,C=0>k&&-g,T=0>w&&-m,b=0>k*w,C+=w*v*(b?1-c:c),T-=k*v*(y?b?c:1-c:1),d&&(C-=g*c*(0>k?-1:1),y&&(T-=m*c*(0>w?-1:1)),f(i,{textAlign:l})),e.xCorr=C,e.yCorr=T),f(i,{left:a+C+$t,top:s+T+$t}),e.cTT=E}},updateTransform:function(){var e=this,t=e.translateX||0,n=e.translateY||0,i=e.inverted,r=e.rotation,o=[];i&&(t+=e.attr("width"),n+=e.attr("height")),(t||n)&&o.push("translate("+t+","+n+")"),i?o.push("rotate(90) scale(-1,1)"):r&&o.push("rotate("+r+" "+(e.x||0)+" "+(e.y||0)+")"),o.length&&d(e.element,"transform",o.join(" "))},toFront:function(){var e=this.element;return e.parentNode.appendChild(e),this},align:function(e,t,n){var i=this;e?(i.alignOptions=e,i.alignByTranslate=t,n||i.renderer.alignedObjects.push(i)):(e=i.alignOptions,t=i.alignByTranslate),n=p(n,i.renderer);var r=e.align,o=e.verticalAlign,a=(n.x||0)+(e.x||0),s=(n.y||0)+(e.y||0),l={};return/^(right|center)$/.test(r)&&(a+=(n.width-(e.width||0))/{right:1,center:2}[r]),l[t?"translateX":"x"]=pt(a),/^(bottom|middle)$/.test(o)&&(s+=(n.height-(e.height||0))/({bottom:1,middle:2}[o]||1)),l[t?"translateY":"y"]=pt(s),i[i.placed?"animate":"attr"](l),i.placed=!0,i.alignAttr=l,i},getBBox:function(t){var n,i,r,o=this,a=o.rotation,s=o.element,l=a*wt;if(s.namespaceURI===At||o.renderer.forExport){try{n=s.getBBox?e({},s.getBBox()):{width:s.offsetWidth,height:s.offsetHeight}}catch(c){}(!n||0>n.width)&&(n={width:0,height:0}),i=n.width,r=n.height,a&&(n.width=bt(r*xt(l))+bt(i*yt(l)),n.height=bt(r*yt(l))+bt(i*xt(l)))}else n=o.htmlGetBBox(t);return n},show:function(){return this.attr({visibility:Ht})},hide:function(){return this.attr({visibility:jt})},add:function(e){var t,i,r,o,a=this.renderer,s=e||a,l=s.element||a.box,c=l.childNodes,h=this.element,p=d(h,"zIndex");if(this.parentInverted=e&&e.inverted,void 0!==this.textStr&&a.buildText(this),p&&(s.handleZ=!0,p=n(p)),s.handleZ)for(r=0;c.length>r;r++)if(t=c[r],i=d(t,"zIndex"),t!==h&&(n(i)>p||!u(p)&&u(i))){l.insertBefore(h,t),o=!0;break}return o||l.appendChild(h),this.added=!0,wn(this,"add"),this},safeRemoveChild:function(e){var t=e.parentNode;t&&t.removeChild(e)},destroy:function(){var e,t,n=this,i=n.element||{},r=n.shadows,o=n.box;if(i.onclick=i.onmouseout=i.onmouseover=i.onmousemove=null,Tn(n),n.clipPath&&(n.clipPath=n.clipPath.destroy()),n.stops){for(t=0;n.stops.length>t;t++)n.stops[t]=n.stops[t].destroy();n.stops=null}n.safeRemoveChild(i),r&&gn(r,function(e){n.safeRemoveChild(e)}),o&&o.destroy(),c(n.renderer.alignedObjects,n);for(e in n)delete n[e];return null},empty:function(){for(var e=this.element,t=e.childNodes,n=t.length;n--;)e.removeChild(t[n])},shadow:function(e,t,n){var i,r,o,a=[],s=this.element,l=this.parentInverted?"(-1,-1)":"(1,1)";if(e){for(i=1;3>=i;i++)r=s.cloneNode(0),o=7-2*i,d(r,{isShadow:"true",stroke:"rgb(0, 0, 0)","stroke-opacity":.05*i,"stroke-width":o,transform:"translate"+l,fill:Kt}),n&&(d(r,"height",mt(d(r,"height")-o,0)),r.cutHeight=o),t?t.element.appendChild(r):s.parentNode.insertBefore(r,s),a.push(r);this.shadows=a}return this}};var On=function(){this.init.apply(this,arguments)};On.prototype={Element:N,init:function(e,t,n,i){var r,o=this,a=location;r=o.createElement("svg").attr({xmlns:At,version:"1.1"}),e.appendChild(r.element),o.isSVG=!0,o.box=r.element,o.boxWrapper=r,o.alignedObjects=[],o.url=Ct?"":a.href.replace(/#.*?$/,"").replace(/([\('\)])/g,"\\$1"),o.defs=this.createElement("defs").add(),o.forExport=i,o.gradients={},o.setSize(t,n,!1);var s,l;St&&e.getBoundingClientRect&&(o.subPixelFix=s=function(){f(e,{left:0,top:0}),l=e.getBoundingClientRect(),f(e,{left:gt(l.left)-l.left+$t,top:gt(l.top)-l.top+$t})},s(),xn(dt,"resize",s))},isHidden:function(){return!this.boxWrapper.getBBox().width},destroy:function(){var e=this,t=e.defs;return e.box=null,e.boxWrapper=e.boxWrapper.destroy(),S(e.gradients||{}),e.gradients=null,t&&(e.defs=t.destroy()),e.subPixelFix&&kn(dt,"resize",e.subPixelFix),e.alignedObjects=null,null},createElement:function(e){var t=new this.Element;return t.init(this,e),t},draw:function(){},buildText:function(e){function t(e){return b[e]=r.getBBox().height,pt(b[e]-(b[e-1]||0))}for(var i,r=e.element,o=(""+p(e.textStr,"")).replace(/<(b|strong)>/g,'<span style="font-weight:bold">').replace(/<(i|em)>/g,'<span style="font-style:italic">').replace(/<a/g,"<span").replace(/<\/(b|strong|i|em|a)>/g,"</span>").split(/<br.*?>/g),a=r.childNodes,s=/style="([^"]+)"/,l=/href="([^"]+)"/,c=d(r,"x"),u=e.styles,h=u&&n(u.width),g=u&&u.lineHeight,m="getComputedStyle",v=a.length,b=[];v--;)r.removeChild(a[v]);h&&!e.added&&this.box.appendChild(r),""===o[o.length-1]&&o.pop(),gn(o,function(o,a){var u,p,v=0;o=o.replace(/<span/g,"|||<span").replace(/<\/span>/g,"</span>|||"),u=o.split("|||"),gn(u,function(o){if(""!==o||1===u.length){var b={},y=ut.createElementNS(At,"tspan");if(s.test(o)&&d(y,"style",o.match(s)[1].replace(/(;| |^)color([ :])/,"$1fill$2")),l.test(o)&&(d(y,"onclick",'location.href="'+o.match(l)[1]+'"'),f(y,{cursor:"pointer"})),o=(o.replace(/<(.|\n)*?>/g,"")||" ").replace(/&lt;/g,"<").replace(/&gt;/g,">"),y.appendChild(ut.createTextNode(o)),v?b.dx=3:b.x=c,v||(a&&(!Dt&&e.renderer.forExport&&f(y,{display:"block"}),p=dt[m]&&n(dt[m](i,null).getPropertyValue("line-height")),(!p||isNaN(p))&&(p=g||i.offsetHeight||t(a)||18),d(y,"dy",p)),i=y),d(y,b),r.appendChild(y),v++,h)for(var x,k,w=o.replace(/-/g,"- ").split(" "),_=[];w.length||_.length;)k=e.getBBox().width,x=k>h,x&&1!==w.length?(y.removeChild(y.firstChild),_.unshift(w.pop())):(w=_,_=[],w.length&&(y=ut.createElementNS(At,"tspan"),d(y,{dy:g||16,x:c}),r.appendChild(y),k>h&&(h=k))),w.length&&y.appendChild(ut.createTextNode(w.join(" ").replace(/- /g,"-")))}})})},button:function(n,i,r,o,a,s,l){var c,u,d,h,p,f=this.label(n,i,r),g=0,m="style",v={x1:0,y1:0,x2:0,y2:1};return a=yn(t(cn,1,ln,"#999",on,t(an,v,sn,[[0,"#FFF"],[1,"#DDD"]]),"r",3,"padding",3,m,t("color","black")),a),d=a[m],delete a[m],s=yn(a,t(ln,"#68A",on,t(an,v,sn,[[0,"#FFF"],[1,"#ACF"]])),s),h=s[m],delete s[m],l=yn(a,t(ln,"#68A",on,t(an,v,sn,[[0,"#9BD"],[1,"#CDF"]])),l),p=l[m],delete l[m],xn(f.element,"mouseenter",function(){f.attr(s).css(h)}),xn(f.element,"mouseleave",function(){c=[a,s,l][g],u=[d,h,p][g],f.attr(c).css(u)}),f.setState=function(e){g=e,e?2===e&&f.attr(l).css(p):f.attr(a).css(d)},f.on("click",function(){o.call(f)}).attr(a).css(e({cursor:"default"},d))},crispLine:function(e,t){return e[1]===e[4]&&(e[1]=e[4]=pt(e[1])+t%2/2),e[2]===e[5]&&(e[2]=e[5]=pt(e[2])+t%2/2),e},path:function(t){var n={fill:Kt};return o(t)?n.d=t:r(t)&&e(n,t),this.createElement("path").attr(n)},circle:function(e,t,n){var i=r(e)?e:{x:e,y:t,r:n};return this.createElement("circle").attr(i)},arc:function(e,t,n,i,o,a){return r(e)&&(t=e.y,n=e.r,i=e.innerR,o=e.start,a=e.end,e=e.x),this.symbol("arc",e||0,t||0,n||0,n||0,{innerR:i||0,start:o||0,end:a||0})},rect:function(e,t,n,i,o,a){o=r(e)?e.r:o;var s=this.createElement("rect").attr({rx:o,ry:o,fill:Kt});return s.attr(r(e)?e:s.crisp(a,e,t,mt(n,0),mt(i,0)))},setSize:function(e,t,n){var i=this,r=i.alignedObjects,o=r.length;for(i.width=e,i.height=t,i.boxWrapper[p(n,!0)?"animate":"attr"]({width:e,height:t});o--;)r[o].align()},g:function(e){var t=this.createElement("g");return u(e)?t.attr({"class":zt+e}):t},image:function(t,n,i,r,o){var a,s={preserveAspectRatio:Kt};return arguments.length>1&&e(s,{x:n,y:i,width:r,height:o}),a=this.createElement("image").attr(s),a.element.setAttributeNS?a.element.setAttributeNS("http://www.w3.org/1999/xlink","href",t):a.element.setAttribute("hc-svg-href",t),a},symbol:function(t,n,i,r,o,a){var s,l,c,u,d=this.symbols[t],h=d&&d(pt(n),pt(i),r,o,a),p=/^url\((.*?)\)$/;return h?(s=this.path(h),e(s,{symbolName:t,x:n,y:i,width:r,height:o}),a&&e(s,a)):p.test(t)&&(u=function(e,t){e.attr({width:t[0],height:t[1]}),e.alignByTranslate||e.translate(-pt(t[0]/2),-pt(t[1]/2))},l=t.match(p)[1],c=Ot[l],s=this.image(l).attr({x:n,y:i}),c?u(s,c):(s.attr({width:0,height:0}),g("img",{onload:function(){var e=this;u(s,Ot[l]=[e.width,e.height])},src:l}))),s},symbols:{circle:function(e,t,n,i){var r=.166*n;return[Wt,e+n/2,t,"C",e+n+r,t,e+n+r,t+i,e+n/2,t+i,"C",e-r,t+i,e-r,t,e+n/2,t,"Z"]},square:function(e,t,n,i){return[Wt,e,t,qt,e+n,t,e+n,t+i,e,t+i,"Z"]},triangle:function(e,t,n,i){return[Wt,e+n/2,t,qt,e+n,t+i,e,t+i,"Z"]},"triangle-down":function(e,t,n,i){return[Wt,e,t,qt,e+n,t,e+n/2,t+i,"Z"]},diamond:function(e,t,n,i){return[Wt,e+n/2,t,qt,e+n,t+i/2,e+n/2,t+i,e,t+i/2,"Z"]},arc:function(e,t,n,i,r){var o=r.start,a=r.r||n||i,s=r.end-1e-6,l=r.innerR,c=r.open,u=yt(o),d=xt(o),h=yt(s),p=xt(s),f=kt>r.end-o?0:1;return[Wt,e+a*u,t+a*d,"A",a,a,0,f,1,e+a*h,t+a*p,c?Wt:qt,e+l*h,t+l*p,"A",l,l,0,f,0,e+l*u,t+l*d,c?"":"Z"]}},clipRect:function(e,t,n,i){var r,o=zt+Ft++,a=this.createElement("clipPath").attr({id:o}).add(this.defs);return r=this.rect(e,t,n,i,0).add(a),r.id=o,r.clipPath=a,r},color:function(t,n,i){var r,a,s=this,l=/^rgba/;if(t&&t.linearGradient?a="linearGradient":t&&t.radialGradient&&(a="radialGradient"),a){var c,h,p,f=t[a],g=s.gradients,m=n.radialReference;return f.id&&g[f.id]||(o(f)&&(t[a]=f={x1:f[0],y1:f[1],x2:f[2],y2:f[3],gradientUnits:"userSpaceOnUse"}),"radialGradient"===a&&m&&!u(f.gradientUnits)&&e(f,{cx:m[0]-m[2]/2+f.cx*m[2],cy:m[1]-m[2]/2+f.cy*m[2],r:f.r*m[2],gradientUnits:"userSpaceOnUse"}),f.id=zt+Ft++,g[f.id]=c=s.createElement(a).attr(f).add(s.defs),c.stops=[],gn(t.stops,function(e){var t;l.test(e[1])?(r=Ln(e[1]),h=r.get("rgb"),p=r.get("a")):(h=e[1],p=1),t=s.createElement("stop").attr({offset:e[0],"stop-color":h,"stop-opacity":p}).add(c),c.stops.push(t)})),"url("+s.url+"#"+f.id+")"}return l.test(t)?(r=Ln(t),d(n,i+"-opacity",r.get("a")),r.get("rgb")):(n.removeAttribute(i+"-opacity"),t)},text:function(e,t,n,i){var r,o=this,a=V.chart.style;return i&&!o.forExport?o.html(e,t,n):(t=pt(p(t,0)),n=pt(p(n,0)),r=o.createElement("text").attr({x:t,y:n,text:e}).css({fontFamily:a.fontFamily,fontSize:a.fontSize}),r.x=t,r.y=n,r)},html:function(t,n,i){var r=V.chart.style,o=this.createElement("span"),a=o.attrSetters,s=o.element,l=o.renderer;return a.text=function(e){return s.innerHTML=e,!1},a.x=a.y=a.align=function(e,t){return"align"===t&&(t="textAlign"),o[t]=e,o.htmlUpdateTransform(),!1},o.attr({text:t,x:pt(n),y:pt(i)}).css({position:Mt,whiteSpace:"nowrap",fontFamily:r.fontFamily,fontSize:r.fontSize}),o.css=o.htmlCss,l.isSVG&&(o.add=function(t){var n,i,r=l.box.parentNode;return t?(n=t.div,n||(n=t.div=g(Pt,{className:d(t.element,"class")},{position:Mt,left:t.attr("translateX")+$t,top:t.attr("translateY")+$t},r),i=n.style,e(t.attrSetters,{translateX:function(e){i.left=e+$t},translateY:function(e){i.top=e+$t},visibility:function(e,t){i[t]=e}}))):n=r,n.appendChild(s),o.added=!0,o.alignOnAdd&&o.htmlUpdateTransform(),o}),o},fontMetrics:function(e){e=n(e||11);var t=24>e?e+4:pt(1.2*e),i=pt(.8*t);return{h:t,b:i}},label:function(t,n,i,r,o,a,s,l,c){function d(){var e,t=C.element.style;m=(void 0===v||void 0===b||_.styles.textAlign)&&C.getBBox(!0),_.width=(v||m.width||0)+2*E,_.height=(b||m.height||0)+2*E,k=E+w.fontMetrics(t&&t.fontSize).b,g||(e=l?-k:0,_.box=g=r?w.symbol(r,-T*E,e,_.width,_.height):w.rect(-T*E,e,_.width,_.height,0,A[cn]),g.add(_)),g.attr(yn({width:_.width,height:_.height},A)),A=null}function h(){var e,t=_.styles,n=t&&t.textAlign,i=E*(1-T);e=l?0:k,!u(v)||"center"!==n&&"right"!==n||(i+={center:.5,right:1}[n]*(v-m.width)),(i!==C.x||e!==C.y)&&C.attr({x:i,y:e}),C.x=i,C.y=e}function p(e,t){g?g.attr(e,t):A[e]=t}function f(){_.attr({text:t,x:n,y:i}),u(o)&&_.attr({anchorX:o,anchorY:a})}var g,m,v,b,y,x,k,w=this,_=w.g(c),C=w.text("",0,0,s).attr({zIndex:1}).add(_),T=0,E=3,S=0,A={},D=_.attrSetters;xn(_,"add",f),D.width=function(e){return v=e,!1},D.height=function(e){return b=e,!1},D.padding=function(e){return u(e)&&e!==E&&(E=e,h()),!1},D.align=function(e){return T={left:0,center:.5,right:1}[e],!1},D.text=function(e,t){return C.attr(t,e),d(),h(),!1},D[cn]=function(e,t){return S=e%2/2,p(t,e),!1},D.stroke=D.fill=D.r=function(e,t){return p(t,e),!1},D.anchorX=function(e,t){return o=e,p(t,e+S-y),!1},D.anchorY=function(e,t){return a=e,p(t,e-x),!1},D.x=function(e){return _.x=e,e-=T*((v||m.width)+E),y=pt(e),_.attr("translateX",y),!1},D.y=function(e){return x=_.y=pt(e),_.attr("translateY",e),!1};var I=_.css;return e(_,{css:function(e){if(e){var t={};e=yn({},e),gn(["fontSize","fontWeight","fontFamily","color","lineHeight","width"],function(n){e[n]!==W&&(t[n]=e[n],delete e[n])}),C.css(t)}return I.call(_,e)},getBBox:function(){return g.getBBox()},shadow:function(e){return g.shadow(e),_},destroy:function(){kn(_,"add",f),kn(_.element,"mouseenter"),kn(_.element,"mouseleave"),C&&(C=C.destroy()),N.prototype.destroy.call(_)}})}},q=On;var Fn;if(!Dt&&!Rt){var Nn={init:function(e,t){var n=this,i=["<",t,' filled="f" stroked="f"'],r=["position: ",Mt,";"];("shape"===t||t===Pt)&&r.push("left:0;top:0;width:1px;height:1px;"),Tt&&r.push("visibility: ",t===Pt?jt:Ht),i.push(' style="',r.join(""),'"/>'),t&&(i=t===Pt||"span"===t||"img"===t?i.join(""):e.prepVML(i),n.element=g(i)),n.renderer=e,n.attrSetters={}},add:function(e){var t=this,n=t.renderer,i=t.element,r=n.box,o=e&&e.inverted,a=e?e.element||e:r;return o&&n.invertChild(i,a),Tt&&a.gVis===jt&&f(i,{visibility:jt}),a.appendChild(i),t.added=!0,t.alignOnAdd&&!t.deferUpdateTransform&&t.updateTransform(),wn(t,"add"),t},toggleChildren:function(e,t){for(var n=e.childNodes,i=n.length;i--;)f(n[i],{visibility:t}),"DIV"===n[i].nodeName&&this.toggleChildren(n[i],t) },updateTransform:N.prototype.htmlUpdateTransform,attr:function(e,t){var n,r,o,s,l,c,h=this,p=h.element||{},f=p.style,m=p.nodeName,v=h.renderer,b=h.symbolName,y=h.shadows,x=h.attrSetters,k=h;if(i(e)&&u(t)&&(n=e,e={},e[n]=t),i(e))n=e,k="strokeWidth"===n||"stroke-width"===n?h.strokeweight:h[n];else for(n in e)if(r=e[n],c=!1,s=x[n]&&x[n](r,n),s!==!1&&null!==r){if(s!==W&&(r=s),b&&/^(x|y|r|start|end|width|height|innerR|anchorX|anchorY)/.test(n))l||(h.symbolAttr(e),l=!0),c=!0;else if("d"===n){r=r||[],h.d=r.join(" "),o=r.length;for(var w=[];o--;)w[o]=a(r[o])?pt(10*r[o])-5:"Z"===r[o]?"x":r[o];if(r=w.join(" ")||"x",p.path=r,y)for(o=y.length;o--;)y[o].path=y[o].cutOff?this.cutOffPath(r,y[o].cutOff):r;c=!0}else if("zIndex"===n||"visibility"===n)Tt&&"visibility"===n&&"DIV"===m&&(p.gVis=r,h.toggleChildren(p,r),r===Ht&&(r=null)),r&&(f[n]=r),c=!0;else if("width"===n||"height"===n)r=mt(0,r),this[n]=r,h.updateClipping?(h[n]=r,h.updateClipping()):f[n]=r,c=!0;else if("x"===n||"y"===n)h[n]=r,f[{x:"left",y:"top"}[n]]=r;else if("class"===n)p.className=r;else if("stroke"===n)r=v.color(r,p,n),n="strokecolor";else if("stroke-width"===n||"strokeWidth"===n)p.stroked=r?!0:!1,n="strokeweight",h[n]=r,a(r)&&(r+=$t);else if("dashstyle"===n){var _=p.getElementsByTagName("stroke")[0]||g(v.prepVML(["<stroke/>"]),null,null,p);_[n]=r||"solid",h.dashstyle=r,c=!0}else"fill"===n?"SPAN"===m?f.color=r:(p.filled=r!==Kt?!0:!1,r=v.color(r,p,n),n="fillcolor"):"shape"===m&&"rotation"===n?h[n]=r:"translateX"===n||"translateY"===n||"rotation"===n?(h[n]=r,h.updateTransform(),c=!0):"text"===n&&(this.bBox=null,p.innerHTML=r,c=!0);if(y&&"visibility"===n)for(o=y.length;o--;)y[o].style[n]=r;c||(Tt?p[n]=r:d(p,n,r))}return k},clip:function(e){var t=this,n=e.members,i=t.element,r=i.parentNode;return n.push(t),t.destroyClip=function(){c(n,t)},r&&"highcharts-tracker"===r.className&&!Tt&&f(i,{visibility:jt}),t.css(e.getCSS(t))},css:N.prototype.htmlCss,safeRemoveChild:function(e){var t=e.parentNode;t&&A(e)},destroy:function(){var e=this;return e.destroyClip&&e.destroyClip(),N.prototype.destroy.apply(e)},empty:function(){for(var e,t=this.element,n=t.childNodes,i=n.length;i--;)e=n[i],e.parentNode.removeChild(e)},on:function(e,t){return this.element["on"+e]=function(){var e=dt.event;e.target=e.srcElement,t(e)},this},cutOffPath:function(e,t){var i;return e=e.split(/[ ,]/),i=e.length,(9===i||11===i)&&(e[i-4]=e[i-2]=n(e[i-2])-10*t),e.join(" ")},shadow:function(e,t,i){var r,o,a,s,l,c=[],u=this.element,d=this.renderer,h=u.style,p=u.path;if(p&&"string"!=typeof p.value&&(p="x"),l=p,e){for(r=1;3>=r;r++)s=7-2*r,i&&(l=this.cutOffPath(p.value,s+.5)),a=['<shape isShadow="true" strokeweight="',7-2*r,'" filled="false" path="',l,'" coordsize="10 10" style="',u.style.cssText,'" />'],o=g(d.prepVML(a),null,{left:n(h.left)+1,top:n(h.top)+1}),i&&(o.cutOff=s+1),a=['<stroke color="black" opacity="',.05*r,'"/>'],g(d.prepVML(a),null,null,o),t?t.element.appendChild(o):u.parentNode.insertBefore(o,u),c.push(o);this.shadows=c}return this}};Nn=m(N,Nn);var Pn={Element:Nn,isIE8:_t.indexOf("MSIE 8.0")>-1,init:function(e,t,n){var i,r,o=this;o.alignedObjects=[],i=o.createElement(Pt),r=i.element,r.style.position=Bt,e.appendChild(i.element),o.box=r,o.boxWrapper=i,o.setSize(t,n,!1),ut.namespaces.hcv||(ut.namespaces.add("hcv","urn:schemas-microsoft-com:vml"),ut.createStyleSheet().cssText="hcv\\:fill, hcv\\:path, hcv\\:shape, hcv\\:stroke{ behavior:url(#default#VML); display: inline-block; } ")},isHidden:function(){return!this.box.offsetWidth},clipRect:function(t,n,i,r){var o=this.createElement();return e(o,{members:[],left:t,top:n,width:i,height:r,getCSS:function(t){var n=t.inverted,i=this,r=i.top,o=i.left,a=o+i.width,s=r+i.height,l={clip:"rect("+pt(n?o:r)+"px,"+pt(n?s:a)+"px,"+pt(n?a:s)+"px,"+pt(n?r:o)+"px)"};return!n&&Tt&&"IMG"!==t.element.nodeName&&e(l,{width:a+$t,height:s+$t}),l},updateClipping:function(){gn(o.members,function(e){e.css(o.getCSS(e))})}})},color:function(e,t,n){var i,r,o,a=/^rgba/,s=Kt;if(e&&e.linearGradient?o="gradient":e&&e.radialGradient&&(o="pattern"),o){var l,c,u,d,h,p,f,m,v,b,y,x,k,w=e.linearGradient||e.radialGradient,_="",C=e.stops,T=[];if(x=C[0],k=C[C.length-1],x[0]>0&&C.unshift([0,x[1]]),1>k[0]&&C.push([1,k[1]]),gn(C,function(e,t){a.test(e[1])?(i=Ln(e[1]),l=i.get("rgb"),c=i.get("a")):(l=e[1],c=1),T.push(100*e[0]+"% "+l),t?(v=c,b=l):(m=c,y=l)}),"gradient"===o)u=w.x1||w[0]||0,d=w.y1||w[1]||0,h=w.x2||w[2]||0,p=w.y2||w[3]||0,f=90-180*ht.atan((p-d)/(h-u))/kt;else{var E=w.r,S=2*E,A=w.cx,D=w.cy;_='src="http://code.highcharts.com/gfx/radial-gradient.png" size="'+S+","+S+'" '+'origin="0.5,0.5" '+'position="'+A+","+D+'" '+'color2="'+y+'" ',s=b}"fill"===n?(r=['<fill colors="'+T.join(",")+'" angle="',f,'" opacity="',v,'" o:opacity2="',m,'" type="',o,'" ',_,'focus="100%" method="any" />'],g(this.prepVML(r),null,null,t)):s=l}else if(a.test(e)&&"IMG"!==t.tagName)i=Ln(e),r=["<",n,' opacity="',i.get("a"),'"/>'],g(this.prepVML(r),null,null,t),s=i.get("rgb");else{var I=t.getElementsByTagName(n);I.length&&(I[0].opacity=1),s=e}return s},prepVML:function(e){var t="display:inline-block;behavior:url(#default#VML);",n=this.isIE8;return e=e.join(""),n?(e=e.replace("/>",' xmlns="urn:schemas-microsoft-com:vml" />'),e=-1===e.indexOf('style="')?e.replace("/>",' style="'+t+'" />'):e.replace('style="','style="'+t)):e=e.replace("<","<hcv:"),e},text:On.prototype.html,path:function(t){var n={coordsize:"10 10"};return o(t)?n.d=t:r(t)&&e(n,t),this.createElement("shape").attr(n)},circle:function(e,t,n){return this.symbol("circle").attr({x:e-n,y:t-n,width:2*n,height:2*n})},g:function(e){var t,n;return e&&(n={className:zt+e,"class":zt+e}),t=this.createElement(Pt).attr(n)},image:function(e,t,n,i,r){var o=this.createElement("img").attr({src:e});return arguments.length>1&&o.css({left:t,top:n,width:i,height:r}),o},rect:function(e,t,n,i,o,a){r(e)&&(t=e.y,n=e.width,i=e.height,a=e.strokeWidth,e=e.x);var s=this.symbol("rect");return s.r=o,s.attr(s.crisp(a,e,t,mt(n,0),mt(i,0)))},invertChild:function(e,t){var i=t.style;f(e,{flip:"x",left:n(i.width)-1,top:n(i.height)-1,rotation:-90})},symbols:{arc:function(e,t,n,i,r){var o,a=r.start,s=r.end,l=r.r||n||i,c=yt(a),u=xt(a),d=yt(s),h=xt(s),p=r.innerR,f=.08/l,g=p&&.1/p||0;return 0===s-a?["x"]:(f>2*kt-s+a?d=-f:g>s-a&&(d=yt(a+g)),o=["wa",e-l,t-l,e+l,t+l,e+l*c,t+l*u,e+l*d,t+l*h],r.open&&o.push(Wt,e-p,t-p),o.push("at",e-p,t-p,e+p,t+p,e+p*d,t+p*h,e+p*c,t+p*u,"x","e"),o)},circle:function(e,t,n,i){return["wa",e,t,e+n,t+i,e+n,t+i/2,e+n,t+i/2,"e"]},rect:function(e,t,n,i,r){var o,a,s=e+n,l=t+i;return u(r)&&r.r?(a=vt(r.r,n,i),o=[Wt,e+a,t,qt,s-a,t,"wa",s-2*a,t,s,t+2*a,s-a,t,s,t+a,qt,s,l-a,"wa",s-2*a,l-2*a,s,l,s,l-a,s-a,l,qt,e+a,l,"wa",e,l-2*a,e+2*a,l,e+a,l,e,l-a,qt,e,t+a,"wa",e,t,e+2*a,t+2*a,e,t+a,e+a,t,"x","e"]):o=On.prototype.symbols.square.apply(0,arguments),o}}};Fn=function(){this.init.apply(this,arguments)},Fn.prototype=yn(On.prototype,Pn),q=Fn}var Mn,Bn;Rt&&(Mn=function(){},Mn.prototype.symbols={},Bn=function(){function e(){var e,n=t.length;for(e=0;n>e;e++)t[e]();t=[]}var t=[];return{push:function(n,i){0===t.length&&fn(i,e),t.push(n)}}}()),q=Fn||Mn||On,P.prototype={addLabel:function(){var t,n,i,r,o=this,s=o.axis,c=s.options,d=s.chart,h=s.horiz,p=s.categories,f=o.pos,g=c.labels,m=s.tickPositions,v=p&&h&&p.length&&!g.step&&!g.staggerLines&&!g.rotation&&d.plotWidth/m.length||!h&&d.plotWidth/2,b=f===m[0],y=f===m[m.length-1],x=p&&u(p[f])?p[f]:f,k=o.label,w=m.info;s.isDatetimeAxis&&w&&(r=c.dateTimeLabelFormats[w.higherRanks[f]||w.unitName]),o.isFirst=b,o.isLast=y,t=s.labelFormatter.call({axis:s,chart:d,isFirst:b,isLast:y,dateTimeLabelFormat:r,value:s.isLog?I(l(x)):x}),n=v&&{width:mt(1,pt(v-2*(g.padding||10)))+$t},n=e(n,g.style),u(k)?k&&k.attr({text:t}).css(n):(i={align:g.align},a(g.rotation)&&(i.rotation=g.rotation),o.label=u(t)&&g.enabled?d.renderer.text(t,0,0,g.useHTML).attr(i).css(n).add(s.axisGroup):null)},getLabelSize:function(){var e=this.label,t=this.axis;return e?(this.labelBBox=e.getBBox(!0))[t.horiz?"height":"width"]:0},getLabelSides:function(){var e=this.labelBBox,t=this.axis,n=t.options,i=n.labels,r=e.width,o=r*{left:0,center:.5,right:1}[i.align]-i.x;return[-o,r-o]},handleOverflow:function(e,t){var n=!0,i=this.axis,r=i.chart,o=this.isFirst,a=this.isLast,s=t.x,l=i.reversed,c=i.tickPositions;if(o||a){var u=this.getLabelSides(),d=u[0],h=u[1],p=r.plotLeft,f=p+i.len,g=i.ticks[c[e+(o?1:-1)]],m=g&&g.label.xy.x+g.getLabelSides()[o?0:1];o&&!l||a&&l?p>s+d&&(s=p-d,g&&s+h>m&&(n=!1)):s+h>f&&(s=f-h,g&&m>s+d&&(n=!1)),t.x=s}return n},getPosition:function(e,t,n,i){var r=this.axis,o=r.chart,a=i&&o.oldChartHeight||o.chartHeight;return{x:e?r.translate(t+n,null,null,i)+r.transB:r.left+r.offset+(r.opposite?(i&&o.oldChartWidth||o.chartWidth)-r.right-r.left:0),y:e?a-r.bottom+r.offset-(r.opposite?r.height:0):a-r.translate(t+n,null,null,i)-r.transB}},getLabelPosition:function(e,t,i,r,o,a,s,l){var c=this.axis,d=c.transA,h=c.reversed,p=c.staggerLines;return e=e+o.x-(a&&r?a*d*(h?-1:1):0),t=t+o.y-(a&&!r?a*d*(h?1:-1):0),u(o.y)||(t+=.9*n(i.styles.lineHeight)-i.getBBox().height/2),p&&(t+=16*(s/(l||1)%p)),{x:e,y:t}},getMarkPath:function(e,t,n,i,r,o){return o.crispLine([Wt,e,t,qt,e+(r?0:-n),t+(r?n:0)],i)},render:function(e,t){var n,i,r,o=this,a=o.axis,s=a.options,l=a.chart,c=l.renderer,u=a.horiz,d=o.type,h=o.label,f=o.pos,g=s.labels,m=o.gridLine,v=d?d+"Grid":"grid",b=d?d+"Tick":"tick",y=s[v+"LineWidth"],x=s[v+"LineColor"],k=s[v+"LineDashStyle"],w=s[b+"Length"],_=s[b+"Width"]||0,C=s[b+"Color"],T=s[b+"Position"],E=o.mark,S=g.step,A=!0,D=s.categories&&"between"===s.tickmarkPlacement?.5:0,I=o.getPosition(u,f,D,t),R=I.x,L=I.y,O=a.staggerLines;y&&(n=a.getPlotLinePath(f+D,y,t),m===W&&(r={stroke:x,"stroke-width":y},k&&(r.dashstyle=k),d||(r.zIndex=1),o.gridLine=m=y?c.path(n).attr(r).add(a.gridGroup):null),!t&&m&&n&&m[o.isNew?"attr":"animate"]({d:n})),_&&("inside"===T&&(w=-w),a.opposite&&(w=-w),i=o.getMarkPath(R,L,w,_,u,c),E?E.animate({d:i}):o.mark=c.path(i).attr({stroke:C,"stroke-width":_}).add(a.axisGroup)),h&&!isNaN(R)&&(h.xy=I=o.getLabelPosition(R,L,h,u,g,D,e,S),o.isFirst&&!p(s.showFirstLabel,1)||o.isLast&&!p(s.showLastLabel,1)?A=!1:O||!u||"justify"!==g.overflow||o.handleOverflow(e,I)||(A=!1),S&&e%S&&(A=!1),A?(h[o.isNew?"attr":"animate"](I),h.show(),o.isNew=!1):h.hide())},destroy:function(){S(this,this.axis)}},M.prototype={render:function(){var e,t,n,i,r,o,a,l=this,c=l.axis,d=c.horiz,h=(c.pointRange||0)/2,f=l.options,g=f.label,m=l.label,v=f.width,b=f.to,y=f.from,x=u(y)&&u(b),k=f.value,w=f.dashStyle,_=l.svgElem,C=[],S=f.color,A=f.zIndex,D=f.events,I=c.chart.renderer;if(c.isLog&&(y=s(y),b=s(b),k=s(k)),v)C=c.getPlotLinePath(k,v),a={stroke:S,"stroke-width":v},w&&(a.dashstyle=w);else{if(!x)return;y=mt(y,c.min-h),b=vt(b,c.max+h),C=c.getPlotBandPath(y,b,f),a={fill:S},f.borderWidth&&(a.stroke=f.borderColor,a["stroke-width"]=f.borderWidth)}if(u(A)&&(a.zIndex=A),_)C?_.animate({d:C},null,_.onGetPath):(_.hide(),_.onGetPath=function(){_.show()});else if(C&&C.length&&(l.svgElem=_=I.path(C).attr(a).add(),D)){e=function(e){_.on(e,function(t){D[e].apply(l,[t])})};for(t in D)e(t)}return g&&u(g.text)&&C&&C.length&&c.width>0&&c.height>0?(g=yn({align:d&&x&&"center",x:d?!x&&4:10,verticalAlign:!d&&x&&"middle",y:d?x?16:10:x?6:-4,rotation:d&&!x&&90},g),m||(l.label=m=I.text(g.text,0,0).attr({align:g.textAlign||g.align,rotation:g.rotation,zIndex:A}).css(g.style).add()),n=[C[1],C[4],p(C[6],C[1])],i=[C[2],C[5],p(C[7],C[2])],r=T(n),o=T(i),m.align(g,!1,{x:r,y:o,width:E(n)-r,height:E(i)-o}),m.show()):m&&m.hide(),l},destroy:function(){var e=this,t=e.axis;c(t.plotLinesAndBands,e),S(e,this.axis)}},B.prototype={destroy:function(){S(this,this.axis)},setTotal:function(e){this.total=e,this.cum=e},render:function(e){var t=this.options.formatter.call(this);this.label?this.label.attr({text:t,visibility:jt}):this.label=this.axis.chart.renderer.text(t,0,0).css(this.options.style).attr({align:this.textAlign,rotation:this.options.rotation,visibility:jt}).add(e)},setOffset:function(e,t){var n=this,i=n.axis,r=i.chart,o=r.inverted,a=this.isNegative,s=i.translate(this.total,0,0,0,1),l=i.translate(0),c=bt(s-l),u=r.xAxis[0].translate(this.x)+e,d=r.plotHeight,h={x:o?a?s:s-c:u,y:o?d-u-t:a?d-s-c:d-s,width:o?c:t,height:o?t:c};this.label&&this.label.align(this.alignOptions,null,h).attr({visibility:Ht})}},j.prototype={defaultOptions:{dateTimeLabelFormats:{millisecond:"%H:%M:%S.%L",second:"%H:%M:%S",minute:"%H:%M",hour:"%H:%M",day:"%e. %b",week:"%e. %b",month:"%b '%y",year:"%Y"},endOnTick:!1,gridLineColor:"#C0C0C0",labels:Dn,lineColor:"#C0D0E0",lineWidth:1,minPadding:.01,maxPadding:.01,minorGridLineColor:"#E0E0E0",minorGridLineWidth:1,minorTickColor:"#A0A0A0",minorTickLength:2,minorTickPosition:"outside",startOfWeek:1,startOnTick:!1,tickColor:"#C0D0E0",tickLength:5,tickmarkPlacement:"between",tickPixelInterval:100,tickPosition:"outside",tickWidth:1,title:{align:"middle",style:{color:"#6D869F",fontWeight:"bold"}},type:"linear"},defaultYAxisOptions:{endOnTick:!0,gridLineWidth:1,tickPixelInterval:72,showLastLabel:!0,labels:{align:"right",x:-8,y:3},lineWidth:0,maxPadding:.05,minPadding:.05,startOnTick:!0,tickWidth:0,title:{rotation:270,text:"Y-values"},stackLabels:{enabled:!1,formatter:function(){return this.total},style:Dn.style}},defaultLeftAxisOptions:{labels:{align:"right",x:-8,y:null},title:{rotation:270}},defaultRightAxisOptions:{labels:{align:"left",x:8,y:null},title:{rotation:90}},defaultBottomAxisOptions:{labels:{align:"center",x:0,y:14},title:{rotation:0}},defaultTopAxisOptions:{labels:{align:"center",x:0,y:-5},title:{rotation:0}},init:function(e,t){var n=t.isX,i=this;i.horiz=e.inverted?!n:n,i.isXAxis=n,i.xOrY=n?"x":"y",i.opposite=t.opposite,i.side=i.horiz?i.opposite?0:2:i.opposite?1:3,i.setOptions(t);var r=this.options,o=r.type,a="datetime"===o;i.labelFormatter=r.labels.formatter||i.defaultLabelFormatter,i.staggerLines=i.horiz&&r.labels.staggerLines,i.userOptions=t,i.minPixelPadding=0,i.chart=e,i.reversed=r.reversed,i.categories=r.categories,i.isLog="logarithmic"===o,i.isLinked=u(r.linkedTo),i.isDatetimeAxis=a,i.ticks={},i.minorTicks={},i.plotLinesAndBands=[],i.alternateBands={},i.len=0,i.minRange=i.userMinRange=r.minRange||r.maxZoom,i.range=r.range,i.offset=r.offset||0,i.stacks={},i.max=null,i.min=null;var c,d=i.options.events;e.axes.push(i),e[n?"xAxis":"yAxis"].push(i),i.series=[],e.inverted&&n&&i.reversed===W&&(i.reversed=!0),i.removePlotBand=i.removePlotBandOrLine,i.removePlotLine=i.removePlotBandOrLine,i.addPlotBand=i.addPlotBandOrLine,i.addPlotLine=i.addPlotBandOrLine;for(c in d)xn(i,c,d[c]);i.isLog&&(i.val2lin=s,i.lin2val=l)},setOptions:function(e){this.options=yn(this.defaultOptions,this.isXAxis?{}:this.defaultYAxisOptions,[this.defaultTopAxisOptions,this.defaultRightAxisOptions,this.defaultBottomAxisOptions,this.defaultLeftAxisOptions][this.side],e)},defaultLabelFormatter:function(){var e,t=this.axis,n=this.value,i=t.categories,r=t.tickInterval,o=this.dateTimeLabelFormat;return e=i?n:o?G(o,n):0===r%1e6?n/1e6+"M":0===r%1e3?n/1e3+"k":n>=1e3?b(n,0):b(n,-1)},getSeriesExtremes:function(){var e,t=this,n=t.chart,i=t.stacks,r=[],o=[];t.dataMin=t.dataMax=null,gn(t.series,function(a){if(a.visible||!n.options.chart.ignoreHiddenSeries){var s,l,c,d,h,f,g,m,v,b,y,x=a.options,k=x.threshold,w=[],_=0;if(t.isLog&&0>=k&&(k=x.threshold=null),t.isXAxis)g=a.xData,g.length&&(t.dataMin=vt(p(t.dataMin,g[0]),T(g)),t.dataMax=mt(p(t.dataMax,g[0]),E(g)));else{var C,S,A,D,I=a.cropped,R=a.xAxis.getExtremes(),L=!!a.modifyValue;for(s=x.stacking,t.usePercentage="percent"===s,s&&(h=x.stack,d=a.type+p(h,""),f="-"+d,a.stackKey=d,l=r[d]||[],r[d]=l,c=o[f]||[],o[f]=c),t.usePercentage&&(t.dataMin=0,t.dataMax=99),g=a.processedXData,m=a.processedYData,y=m.length,e=0;y>e;e++)if(v=g[e],b=m[e],null!==b&&b!==W&&(s?(C=k>b,S=C?c:l,A=C?f:d,b=S[v]=u(S[v])?S[v]+b:b,i[A]||(i[A]={}),i[A][v]||(i[A][v]=new B(t,t.options.stackLabels,C,v,h)),i[A][v].setTotal(b)):L&&(b=a.modifyValue(b)),I||(g[e+1]||v)>=R.min&&(g[e-1]||v)<=R.max))if(D=b.length)for(;D--;)null!==b[D]&&(w[_++]=b[D]);else w[_++]=b;!t.usePercentage&&w.length&&(t.dataMin=vt(p(t.dataMin,w[0]),T(w)),t.dataMax=mt(p(t.dataMax,w[0]),E(w))),u(k)&&(t.dataMin>=k?(t.dataMin=k,t.ignoreMinPadding=!0):k>t.dataMax&&(t.dataMax=k,t.ignoreMaxPadding=!0))}}})},translate:function(e,t,n,i,r){var o,a=this,s=a.len,l=1,c=0,u=i?a.oldTransA:a.transA,d=i?a.oldMin:a.min,h=a.options.ordinal||a.isLog&&r;return u||(u=a.transA),n&&(l*=-1,c=s),a.reversed&&(l*=-1,c-=l*s),t?(a.reversed&&(e=s-e),o=e/u+d,h&&(o=a.lin2val(o))):(h&&(e=a.val2lin(e)),o=l*(e-d)*u+c+l*a.minPixelPadding),o},getPlotLinePath:function(e,t,n){var i,r,o,a,s,l=this,c=l.chart,u=l.left,d=l.top,h=l.translate(e,null,null,n),p=n&&c.oldChartHeight||c.chartHeight,f=n&&c.oldChartWidth||c.chartWidth,g=l.transB;return i=o=pt(h+g),r=a=pt(p-h-g),isNaN(h)?s=!0:l.horiz?(r=d,a=p-l.bottom,(u>i||i>u+l.width)&&(s=!0)):(i=u,o=f-l.right,(d>r||r>d+l.height)&&(s=!0)),s?null:c.renderer.crispLine([Wt,i,r,qt,o,a],t||0)},getPlotBandPath:function(e,t){var n=this.getPlotLinePath(t),i=this.getPlotLinePath(e);return i&&n?i.push(n[4],n[5],n[1],n[2]):i=null,i},getLinearTickPositions:function(e,t,n){var i,r,o=I(ft(t/e)*e),a=I(gt(n/e)*e),s=[];for(i=o;a>=i&&(s.push(i),i=I(i+e),i!==r);)r=i;return s},getLogTickPositions:function(e,t,n,i){var r=this,o=r.options,a=r.len,c=[];if(i||(r._minorAutoInterval=null),e>=.5)e=pt(e),c=r.getLinearTickPositions(e,t,n);else if(e>=.08){var u,d,h,f,g,m,v,b=ft(t);for(u=e>.3?[1,2,4]:e>.15?[1,2,4,6,8]:[1,2,3,4,5,6,7,8,9],d=b;n+1>d&&!v;d++)for(f=u.length,h=0;f>h&&!v;h++)g=s(l(d)*u[h]),g>t&&c.push(m),m>n&&(v=!0),m=g}else{var y=l(t),k=l(n),w=o[i?"minorTickInterval":"tickInterval"],_="auto"===w?null:w,C=o.tickPixelInterval/(i?5:1),T=i?a/r.tickPositions.length:a;e=p(_,r._minorAutoInterval,(k-y)*C/(T||1)),e=x(e,null,ht.pow(10,ft(ht.log(e)/ht.LN10))),c=bn(r.getLinearTickPositions(e,y,k),s),i||(r._minorAutoInterval=e/5)}return i||(r.tickInterval=e),c},getMinorTickPositions:function(){var e,t,n,i=this,r=i.tickPositions,o=i.minorTickInterval,a=[];if(i.isLog)for(n=r.length,t=1;n>t;t++)a=a.concat(i.getLogTickPositions(o,r[t-1],r[t],!0));else for(e=i.min+(r[0]-i.min)%o;i.max>=e;e+=o)a.push(e);return a},adjustForMinRange:function(){var e,t,n,i,r,o,a,s,l=this,c=l.options,d=l.min,h=l.max,f=l.dataMax-l.dataMin>=l.minRange;if(l.isXAxis&&l.minRange===W&&!l.isLog&&(u(c.min)||u(c.max)?l.minRange=null:(gn(l.series,function(e){for(r=e.xData,o=e.xIncrement?1:r.length-1,n=o;n>0;n--)i=r[n]-r[n-1],(t===W||t>i)&&(t=i)}),l.minRange=vt(5*t,l.dataMax-l.dataMin))),l.minRange>h-d){var g=l.minRange;e=(g-h+d)/2,a=[d-e,p(c.min,d-e)],f&&(a[2]=l.dataMin),d=E(a),s=[d+g,p(c.max,d+g)],f&&(s[2]=l.dataMax),h=T(s),g>h-d&&(a[0]=h-g,a[1]=p(c.min,h-g),d=E(a))}l.min=d,l.max=h},setAxisTranslation:function(){var e,t,n=this,i=n.max-n.min,r=0,o=n.transA;n.isXAxis&&(n.isLinked?r=n.linkedParent.pointRange:gn(n.series,function(n){r=mt(r,n.pointRange),t=n.closestPointRange,!n.noSharedTooltip&&u(t)&&(e=u(e)?vt(e,t):t)}),n.pointRange=r,n.closestPointRange=e),n.oldTransA=o,n.translationSlope=n.transA=o=n.len/(i+r||1),n.transB=n.horiz?n.left:n.bottom,n.minPixelPadding=o*(r/2)},setTickPositions:function(e){var t,n,i,r,o=this,a=o.chart,l=o.options,c=o.isLog,d=o.isDatetimeAxis,h=o.isXAxis,f=o.isLinked,g=o.options.tickPositioner,m=l.maxPadding,v=l.minPadding,b=l.tickInterval,y=l.tickPixelInterval,_=o.categories;if(f?(o.linkedParent=a[h?"xAxis":"yAxis"][l.linkedTo],i=o.linkedParent.getExtremes(),o.min=p(i.min,i.dataMin),o.max=p(i.max,i.dataMax),l.type!==o.linkedParent.options.type&&D(11,1)):(o.min=p(o.userMin,l.min,o.dataMin),o.max=p(o.userMax,l.max,o.dataMax)),c&&(!e&&0>=vt(o.min,p(o.dataMin,o.min))&&D(10,1),o.min=I(s(o.min)),o.max=I(s(o.max))),o.range&&(o.userMin=o.min=mt(o.min,o.max-o.range),o.userMax=o.max,e&&(o.range=null)),o.adjustForMinRange(),_||o.usePercentage||f||!u(o.min)||!u(o.max)||(n=o.max-o.min||1,u(l.min)||u(o.userMin)||!v||!(0>o.dataMin)&&o.ignoreMinPadding||(o.min-=n*v),u(l.max)||u(o.userMax)||!m||!(o.dataMax>0)&&o.ignoreMaxPadding||(o.max+=n*m)),o.tickInterval=o.min===o.max||void 0===o.min||void 0===o.max?1:f&&!b&&y===o.linkedParent.options.tickPixelInterval?o.linkedParent.tickInterval:p(b,_?1:(o.max-o.min)*y/(o.len||1)),h&&!e&&gn(o.series,function(e){e.processData(o.min!==o.oldMin||o.max!==o.oldMax)}),o.setAxisTranslation(),o.beforeSetTickPositions&&o.beforeSetTickPositions(),o.postProcessTickInterval&&(o.tickInterval=o.postProcessTickInterval(o.tickInterval)),d||c||(t=ht.pow(10,ft(ht.log(o.tickInterval)/ht.LN10)),u(l.tickInterval)||(o.tickInterval=x(o.tickInterval,null,t,l))),o.minorTickInterval="auto"===l.minorTickInterval&&o.tickInterval?o.tickInterval/5:l.minorTickInterval,o.tickPositions=r=l.tickPositions||g&&g.apply(o,[o.min,o.max]),r||(r=d?(o.getNonLinearTimeTicks||w)(k(o.tickInterval,l.units),o.min,o.max,l.startOfWeek,o.ordinalPositions,o.closestPointRange,!0):c?o.getLogTickPositions(o.tickInterval,o.min,o.max):o.getLinearTickPositions(o.tickInterval,o.min,o.max),o.tickPositions=r),!f){var C=r[0],T=r[r.length-1];l.startOnTick?o.min=C:o.min>C&&r.shift(),l.endOnTick?o.max=T:T>o.max&&r.pop()}},setMaxTicks:function(){var e=this.chart,t=e.maxTicks,n=this.tickPositions,i=this.xOrY;t||(t={x:0,y:0}),!this.isLinked&&!this.isDatetimeAxis&&n.length>t[i]&&this.options.alignTicks!==!1&&(t[i]=n.length),e.maxTicks=t},adjustTickAmount:function(){var e=this,t=e.chart,n=e.xOrY,i=e.tickPositions,r=t.maxTicks;if(r&&r[n]&&!e.isDatetimeAxis&&!e.categories&&!e.isLinked&&e.options.alignTicks!==!1){var o,a=e.tickAmount,s=i.length;if(e.tickAmount=o=r[n],o>s){for(;o>i.length;)i.push(I(i[i.length-1]+e.tickInterval));e.transA*=(s-1)/(o-1),e.max=i[i.length-1]}u(a)&&o!==a&&(e.isDirty=!0)}},setScale:function(){var e,t,n,i,r=this,o=r.stacks;if(r.oldMin=r.min,r.oldMax=r.max,r.oldAxisLength=r.len,r.setAxisSize(),i=r.len!==r.oldAxisLength,gn(r.series,function(e){(e.isDirtyData||e.isDirty||e.xAxis.isDirty)&&(n=!0)}),(i||n||r.isLinked||r.userMin!==r.oldUserMin||r.userMax!==r.oldUserMax)&&(r.getSeriesExtremes(),r.setTickPositions(),r.oldUserMin=r.userMin,r.oldUserMax=r.userMax,r.isDirty||(r.isDirty=i||r.min!==r.oldMin||r.max!==r.oldMax)),!r.isXAxis)for(e in o)for(t in o[e])o[e][t].cum=o[e][t].total;r.setMaxTicks()},setExtremes:function(t,n,i,r,o){var a=this,s=a.chart;i=p(i,!0),o=e(o,{min:t,max:n}),wn(a,"setExtremes",o,function(){a.userMin=t,a.userMax=n,a.isDirtyExtremes=!0,i&&s.redraw(r)})},setAxisSize:function(){var e=this,t=e.chart,n=e.options,i=n.offsetLeft||0,r=n.offsetRight||0;e.left=p(n.left,t.plotLeft+i),e.top=p(n.top,t.plotTop),e.width=p(n.width,t.plotWidth-i+r),e.height=p(n.height,t.plotHeight),e.bottom=t.chartHeight-e.height-e.top,e.right=t.chartWidth-e.width-e.left,e.len=mt(e.horiz?e.width:e.height,0)},getExtremes:function(){var e=this,t=e.isLog;return{min:t?I(l(e.min)):e.min,max:t?I(l(e.max)):e.max,dataMin:e.dataMin,dataMax:e.dataMax,userMin:e.userMin,userMax:e.userMax}},getThreshold:function(e){var t=this,n=t.isLog,i=n?l(t.min):t.min,r=n?l(t.max):t.max;return i>e||null===e?e=i:e>r&&(e=r),t.translate(e,0,1,0,1)},addPlotBandOrLine:function(e){var t=new M(this,e).render();return this.plotLinesAndBands.push(t),t},getOffset:function(){var e,t,n,i,r=this,o=r.chart,a=o.renderer,s=r.options,l=r.tickPositions,c=r.ticks,d=r.horiz,h=r.side,f=0,g=0,m=s.title,v=s.labels,b=0,y=o.axisOffset,x=[-1,1,1,-1][h];if(r.hasData=e=r.series.length&&u(r.min)&&u(r.max),r.showAxis=t=e||p(s.showEmpty,!0),r.axisGroup||(r.axisGroup=a.g("axis").attr({zIndex:s.zIndex||7}).add(),r.gridGroup=a.g("grid").attr({zIndex:s.gridZIndex||1}).add()),e||r.isLinked)gn(l,function(e){c[e]?c[e].addLabel():c[e]=new P(r,e)}),gn(l,function(e){(0===h||2===h||{1:"left",3:"right"}[h]===v.align)&&(b=mt(c[e].getLabelSize(),b))}),r.staggerLines&&(b+=16*(r.staggerLines-1));else for(i in c)c[i].destroy(),delete c[i];m&&m.text&&(r.axisTitle||(r.axisTitle=a.text(m.text,0,0,m.useHTML).attr({zIndex:7,rotation:m.rotation||0,align:m.textAlign||{low:"left",middle:"center",high:"right"}[m.align]}).css(m.style).add(r.axisGroup),r.axisTitle.isNew=!0),t&&(f=r.axisTitle.getBBox()[d?"height":"width"],g=p(m.margin,d?5:10),n=m.offset),r.axisTitle[t?"show":"hide"]()),r.offset=x*p(s.offset,y[h]),r.axisTitleMargin=p(n,b+g+(2!==h&&b&&x*s.labels[d?"y":"x"])),y[h]=mt(y[h],r.axisTitleMargin+f+x*r.offset)},getLinePath:function(e){var t=this.chart,n=this.opposite,i=this.offset,r=this.horiz,o=this.left+(n?this.width:0)+i,a=t.chartHeight-this.bottom-(n?this.height:0)+i;return t.renderer.crispLine([Wt,r?this.left:o,r?a:this.top,qt,r?t.chartWidth-this.right:o,r?a:t.chartHeight-this.bottom],e)},getTitlePosition:function(){var e=this.horiz,t=this.left,i=this.top,r=this.len,o=this.options.title,a=e?t:i,s=this.opposite,l=this.offset,c=n(o.style.fontSize||12),u={low:a+(e?0:r),middle:a+r/2,high:a+(e?r:0)}[o.align],d=(e?i+this.height:t)+(e?1:-1)*(s?-1:1)*this.axisTitleMargin+(2===this.side?c:0);return{x:e?u:d+(s?this.width:0)+l+(o.x||0),y:e?d-(s?this.height:0)+l:u+(o.y||0)}},render:function(){var e,t,n,i=this,r=i.chart,o=r.renderer,a=i.options,s=i.isLog,c=i.isLinked,d=i.tickPositions,h=i.axisTitle,p=i.stacks,f=i.ticks,g=i.minorTicks,m=i.alternateBands,v=a.stackLabels,b=a.alternateGridColor,y=a.lineWidth,x=r.hasRendered,k=x&&u(i.oldMin)&&!isNaN(i.oldMin),w=i.hasData,_=i.showAxis;if((w||c)&&(i.minorTickInterval&&!i.categories&&gn(i.getMinorTickPositions(),function(e){g[e]||(g[e]=new P(i,e,"minor")),k&&g[e].isNew&&g[e].render(null,!0),g[e].isActive=!0,g[e].render()}),gn(d.slice(1).concat([d[0]]),function(e,t){t=t===d.length-1?0:t+1,(!c||e>=i.min&&i.max>=e)&&(f[e]||(f[e]=new P(i,e)),k&&f[e].isNew&&f[e].render(t,!0),f[e].isActive=!0,f[e].render(t))}),b&&gn(d,function(e,r){0===r%2&&i.max>e&&(m[e]||(m[e]=new M(i)),t=e,n=d[r+1]!==W?d[r+1]:i.max,m[e].options={from:s?l(t):t,to:s?l(n):n,color:b},m[e].render(),m[e].isActive=!0)}),i._addedPlotLB||(gn((a.plotLines||[]).concat(a.plotBands||[]),function(e){i.addPlotBandOrLine(e)}),i._addedPlotLB=!0)),gn([f,g,m],function(e){var t;for(t in e)e[t].isActive?e[t].isActive=!1:(e[t].destroy(),delete e[t])}),y&&(e=i.getLinePath(y),i.axisLine?i.axisLine.animate({d:e}):i.axisLine=o.path(e).attr({stroke:a.lineColor,"stroke-width":y,zIndex:7}).add(),i.axisLine[_?"show":"hide"]()),h&&_&&(h[h.isNew?"attr":"animate"](i.getTitlePosition()),h.isNew=!1),v&&v.enabled){var C,T,E,S=i.stackTotalGroup;S||(i.stackTotalGroup=S=o.g("stack-labels").attr({visibility:Ht,zIndex:6}).add()),S.translate(r.plotLeft,r.plotTop);for(C in p){T=p[C];for(E in T)T[E].render(S)}}i.isDirty=!1},removePlotBandOrLine:function(e){for(var t=this.plotLinesAndBands,n=t.length;n--;)t[n].id===e&&t[n].destroy()},setTitle:function(e,t){var n,i=this,r=i.chart,o=i.options;o.title=yn(o.title,e),i.axisTitle=n&&n.destroy(),i.isDirty=!0,p(t,!0)&&r.redraw()},redraw:function(){var e=this,t=e.chart;t.tracker.resetTracker&&t.tracker.resetTracker(!0),e.render(),gn(e.plotLinesAndBands,function(e){e.render()}),gn(e.series,function(e){e.isDirty=!0})},setCategories:function(e,t){var n=this,i=n.chart;n.categories=n.userOptions.categories=e,gn(n.series,function(e){e.translate(),e.setTooltipPoints(!0)}),n.isDirty=!0,p(t,!0)&&i.redraw()},destroy:function(){var e,t=this,n=t.stacks;kn(t);for(e in n)S(n[e]),n[e]=null;gn([t.ticks,t.minorTicks,t.alternateBands,t.plotLinesAndBands],function(e){S(e)}),gn(["stackTotalGroup","axisLine","axisGroup","gridGroup","axisTitle"],function(e){t[e]&&(t[e]=t[e].destroy())})}},z.prototype={destroy:function(){gn(this.crosshairs,function(e){e&&e.destroy()}),this.label&&(this.label=this.label.destroy())},move:function(e,t){var n=this;n.currentX=n.tooltipIsHidden?e:(2*n.currentX+e)/3,n.currentY=n.tooltipIsHidden?t:(n.currentY+t)/2,n.label.attr({x:n.currentX,y:n.currentY}),n.tooltipTick=bt(e-n.currentX)>1||bt(t-n.currentY)>1?function(){n.move(e,t)}:null},hide:function(){if(!this.tooltipIsHidden){var e=this.chart.hoverPoints;this.label.hide(),e&&gn(e,function(e){e.setState()}),this.chart.hoverPoints=null,this.tooltipIsHidden=!0}},hideCrosshairs:function(){gn(this.crosshairs,function(e){e&&e.hide()})},getAnchor:function(e,t){var n,i=this.chart,r=i.inverted,o=0,a=0;return e=h(e),n=e[0].tooltipPos,n||(gn(e,function(e){o+=e.plotX,a+=e.plotLow?(e.plotLow+e.plotHigh)/2:e.plotY}),o/=e.length,a/=e.length,n=[r?i.plotWidth-a:o,this.shared&&!r&&e.length>1&&t?t.chartY-i.plotTop:r?i.plotHeight-o:a]),bn(n,pt)},getPosition:function(e,t,n){var i,r=this.chart,o=r.plotLeft,a=r.plotTop,s=r.plotWidth,l=r.plotHeight,c=p(this.options.distance,12),u=n.plotX,d=n.plotY,h=u+o+(r.inverted?c:-e-c),f=d-t+a+15;return 7>h&&(h=o+u+c),h+e>o+s&&(h-=h+e-(o+s),f=d-t+a-c,i=!0),a+5>f&&(f=a+5,i&&d>=f&&f+t>=d&&(f=d+a+c)),f+t>a+l&&(f=mt(a,a+l-t-c)),{x:h,y:f}},refresh:function(e,t){function n(){var e,t=this,n=t.points||h(t),i=n[0].series;return e=[i.tooltipHeaderFormatter(n[0].key)],gn(n,function(t){i=t.series,e.push(i.tooltipFormatter&&i.tooltipFormatter(t)||t.point.tooltipFormatter(i.tooltipOptions.pointFormat))}),e.push(m.footerFormat||""),e.join("")}var i,r,o,a,s,l,c,u,d=this,f=d.chart,g=d.label,m=d.options,v={},b=[],y=m.formatter||n,x=f.hoverPoints,k=m.crosshairs,w=d.shared;if(a=d.getAnchor(e,t),i=a[0],r=a[1],!w||e.series&&e.series.noSharedTooltip?v=e.getLabelConfig():(x&&gn(x,function(e){e.setState()}),f.hoverPoints=e,gn(e,function(e){e.setState(Gt),b.push(e.getLabelConfig())}),v={x:e[0].category,y:e[0].y},v.points=b,e=e[0]),s=y.call(v),u=e.series,o=w||!u.isCartesian||u.tooltipOutsidePlot||f.isInsidePlot(i,r),s!==!1&&o?(d.tooltipIsHidden&&g.show(),g.attr({text:s}),c=m.borderColor||e.color||u.color||"#606060",g.attr({stroke:c}),l=(m.positioner||d.getPosition).call(d,g.width,g.height,{plotX:i,plotY:r}),d.move(pt(l.x),pt(l.y)),d.tooltipIsHidden=!1):this.hide(),k){k=h(k);for(var _,C,T,E=k.length;E--;)T=e.series[E?"yAxis":"xAxis"],k[E]&&T&&(_=T.getPlotLinePath(E?p(e.stackY,e.y):e.x,1),d.crosshairs[E]?d.crosshairs[E].attr({d:_,visibility:Ht}):(C={"stroke-width":k[E].width||1,stroke:k[E].color||"#C0C0C0",zIndex:k[E].zIndex||2},k[E].dashStyle&&(C.dashstyle=k[E].dashStyle),d.crosshairs[E]=f.renderer.path(_).attr(C).add()))}wn(f,"tooltipRefresh",{text:s,x:i+f.plotLeft,y:r+f.plotTop,borderColor:c})},tick:function(){this.tooltipTick&&this.tooltipTick()}},H.prototype={normalizeMouseEvent:function(t){var n,i,r,o;return t=t||dt.event,t.target||(t.target=t.srcElement),t.originalEvent&&(t=t.originalEvent),t.event&&(t=t.event),o=t.touches?t.touches.item(0):t,this.chartPosition=n=vn(this.chart.container),o.pageX===W?(i=t.x,r=t.y):(i=o.pageX-n.left,r=o.pageY-n.top),e(t,{chartX:pt(i),chartY:pt(r)})},getMouseCoordinates:function(e){var t={xAxis:[],yAxis:[]},n=this.chart;return gn(n.axes,function(i){var r=i.isXAxis,o=n.inverted?!r:r;t[r?"xAxis":"yAxis"].push({axis:i,value:i.translate(o?e.chartX-n.plotLeft:n.plotHeight-e.chartY+n.plotTop,!0)})}),t},onmousemove:function(e){var t,n,i,r,o=this,a=o.chart,s=a.series,l=a.hoverPoint,c=a.hoverSeries,u=a.chartWidth,d=a.inverted?a.plotHeight+a.plotTop-e.chartY:e.chartX-a.plotLeft;if(a.tooltip&&o.options.tooltip.shared&&(!c||!c.noSharedTooltip)){for(n=[],i=s.length,r=0;i>r;r++)s[r].visible&&s[r].options.enableMouseTracking!==!1&&!s[r].noSharedTooltip&&s[r].tooltipPoints.length&&(t=s[r].tooltipPoints[d],t._dist=bt(d-t.plotX),u=vt(u,t._dist),n.push(t));for(i=n.length;i--;)n[i]._dist>u&&n.splice(i,1);n.length&&n[0].plotX!==o.hoverX&&(a.tooltip.refresh(n,e),o.hoverX=n[0].plotX)}c&&c.tracker&&(t=c.tooltipPoints[d],t&&t!==l&&t.onMouseOver())},resetTracker:function(e){var t=this,n=t.chart,i=n.hoverSeries,r=n.hoverPoint,o=n.hoverPoints||r,a=n.tooltip;e=e&&a&&o,e&&h(o)[0].plotX===W&&(e=!1),e?a.refresh(o):(r&&r.onMouseOut(),i&&i.onMouseOut(),a&&(a.hide(),a.hideCrosshairs()),t.hoverX=null)},setDOMEvents:function(){function t(){if(r.selectionMarker){var e,i={xAxis:[],yAxis:[]},s=r.selectionMarker.getBBox(),l=s.x-o.plotLeft,c=s.y-o.plotTop;n&&(gn(o.axes,function(t){if(t.options.zoomEnabled!==!1){var n=t.isXAxis,r=o.inverted?!n:n,a=t.translate(r?l:o.plotHeight-c-s.height,!0,0,0,1),u=t.translate(r?l+s.width:o.plotHeight-c,!0,0,0,1);isNaN(a)||isNaN(u)||(i[n?"xAxis":"yAxis"].push({axis:t,min:vt(a,u),max:mt(a,u)}),e=!0) }}),e&&wn(o,"selection",i,function(e){o.zoom(e)})),r.selectionMarker=r.selectionMarker.destroy()}o&&(f(a,{cursor:"auto"}),o.cancelClick=n,o.mouseIsDown=n=!1),kn(ut,Lt?"touchend":"mouseup",t)}var n,i=!0,r=this,o=r.chart,a=o.container,s=r.zoomX&&!o.inverted||r.zoomY&&o.inverted,l=r.zoomY&&!o.inverted||r.zoomX&&o.inverted;r.hideTooltipOnMouseMove=function(e){_n(e),r.chartPosition&&o.hoverSeries&&o.hoverSeries.isCartesian&&!o.isInsidePlot(e.pageX-r.chartPosition.left-o.plotLeft,e.pageY-r.chartPosition.top-o.plotTop)&&r.resetTracker()},r.hideTooltipOnMouseLeave=function(){r.resetTracker(),r.chartPosition=null},a.onmousedown=function(e){e=r.normalizeMouseEvent(e),!Lt&&e.preventDefault&&e.preventDefault(),o.mouseIsDown=!0,o.cancelClick=!1,o.mouseDownX=r.mouseDownX=e.chartX,r.mouseDownY=e.chartY,xn(ut,Lt?"touchend":"mouseup",t)};var c=function(e){if(!(e&&e.touches&&e.touches.length>1)){e=r.normalizeMouseEvent(e),Lt||(e.returnValue=!1);var t=e.chartX,a=e.chartY,c=!o.isInsidePlot(t-o.plotLeft,a-o.plotTop);if(Lt&&"touchstart"===e.type&&(d(e.target,"isTracker")?o.runTrackerClick||e.preventDefault():o.runChartClick||c||e.preventDefault()),c&&(o.plotLeft>t?t=o.plotLeft:t>o.plotLeft+o.plotWidth&&(t=o.plotLeft+o.plotWidth),o.plotTop>a?a=o.plotTop:a>o.plotTop+o.plotHeight&&(a=o.plotTop+o.plotHeight)),o.mouseIsDown&&"touchstart"!==e.type){if(n=Math.sqrt(Math.pow(r.mouseDownX-t,2)+Math.pow(r.mouseDownY-a,2)),n>10){var u=o.isInsidePlot(r.mouseDownX-o.plotLeft,r.mouseDownY-o.plotTop);if(o.hasCartesianSeries&&(r.zoomX||r.zoomY)&&u&&(r.selectionMarker||(r.selectionMarker=o.renderer.rect(o.plotLeft,o.plotTop,s?1:o.plotWidth,l?1:o.plotHeight,0).attr({fill:r.options.chart.selectionMarkerFill||"rgba(69,114,167,0.25)",zIndex:7}).add())),r.selectionMarker&&s){var h=t-r.mouseDownX;r.selectionMarker.attr({width:bt(h),x:(h>0?0:h)+r.mouseDownX})}if(r.selectionMarker&&l){var p=a-r.mouseDownY;r.selectionMarker.attr({height:bt(p),y:(p>0?0:p)+r.mouseDownY})}u&&!r.selectionMarker&&r.options.chart.panning&&o.pan(t)}}else c||r.onmousemove(e);return i=c,c||!o.hasCartesianSeries}};a.onmousemove=c,xn(a,"mouseleave",r.hideTooltipOnMouseLeave),xn(ut,"mousemove",r.hideTooltipOnMouseMove),a.ontouchstart=function(e){(r.zoomX||r.zoomY)&&a.onmousedown(e),c(e)},a.ontouchmove=c,a.ontouchend=function(){n&&r.resetTracker()},a.onclick=function(t){var n,i,a=o.hoverPoint;t=r.normalizeMouseEvent(t),t.cancelBubble=!0,o.cancelClick||(a&&(d(t.target,"isTracker")||d(t.target.parentNode,"isTracker"))?(n=a.plotX,i=a.plotY,e(a,{pageX:r.chartPosition.left+o.plotLeft+(o.inverted?o.plotWidth-i:n),pageY:r.chartPosition.top+o.plotTop+(o.inverted?o.plotHeight-n:i)}),wn(a.series,"click",e(t,{point:a})),a.firePointEvent("click",t)):(e(t,r.getMouseCoordinates(t)),o.isInsidePlot(t.chartX-o.plotLeft,t.chartY-o.plotTop)&&wn(o,"click",t)))}},destroy:function(){var e=this,t=e.chart,n=t.container;t.trackerGroup&&(t.trackerGroup=t.trackerGroup.destroy()),kn(n,"mouseleave",e.hideTooltipOnMouseLeave),kn(ut,"mousemove",e.hideTooltipOnMouseMove),n.onclick=n.onmousedown=n.onmousemove=n.ontouchstart=n.ontouchend=n.ontouchmove=null,clearInterval(this.tooltipInterval)},init:function(e,t){e.trackerGroup||(e.trackerGroup=e.renderer.g("tracker").attr({zIndex:9}).add()),t.enabled&&(e.tooltip=new z(e,t),this.tooltipInterval=setInterval(function(){e.tooltip.tick()},32)),this.setDOMEvents()}},$.prototype={init:function(e){var t=this,i=t.options=e.options.legend;if(i.enabled){var r=i.itemStyle,o=p(i.padding,8),a=i.itemMarginTop||0;t.baseline=n(r.fontSize)+3+a,t.itemStyle=r,t.itemHiddenStyle=yn(r,i.itemHiddenStyle),t.itemMarginTop=a,t.padding=o,t.initialItemX=o,t.initialItemY=o-5,t.maxItemWidth=0,t.chart=e,t.itemHeight=0,t.lastLineHeight=0,t.render(),xn(t.chart,"endResize",function(){t.positionCheckboxes()})}},colorizeItem:function(e,t){var n=this,i=n.options,r=e.legendItem,o=e.legendLine,a=e.legendSymbol,s=n.itemHiddenStyle.color,l=t?i.itemStyle.color:s,c=t?e.color:s;r&&r.css({fill:l}),o&&o.attr({stroke:c}),a&&a.attr({stroke:c,fill:c})},positionItem:function(e){var t=this,n=t.options,i=n.symbolPadding,r=!n.rtl,o=e._legendItemPos,a=o[0],s=o[1],l=e.checkbox;e.legendGroup&&e.legendGroup.translate(r?a:t.legendWidth-a-2*i-4,s),l&&(l.x=a,l.y=s)},destroyItem:function(e){var t=e.checkbox;gn(["legendItem","legendLine","legendSymbol","legendGroup"],function(t){e[t]&&e[t].destroy()}),t&&A(e.checkbox)},destroy:function(){var e=this,t=e.group,n=e.box;n&&(e.box=n.destroy()),t&&(e.group=t.destroy())},positionCheckboxes:function(){var e=this;gn(e.allItems,function(t){var n=t.checkbox,i=e.group.alignAttr;n&&f(n,{left:i.translateX+t.legendItemWidth+n.x-20+$t,top:i.translateY+n.y+3+$t})})},renderItem:function(e){var t,n,i,r=this,o=r.chart,a=o.renderer,s=r.options,l="horizontal"===s.layout,c=s.symbolWidth,u=s.symbolPadding,d=r.itemStyle,h=r.itemHiddenStyle,p=r.padding,f=!s.rtl,m=s.width,v=s.itemMarginBottom||0,b=r.itemMarginTop,y=r.initialItemX,x=e.legendItem,k=e.series||e,w=k.options,_=w.showCheckbox;x||(e.legendGroup=a.g("legend-item").attr({zIndex:1}).add(r.scrollGroup),k.drawLegendSymbol(r,e),e.legendItem=x=a.text(s.labelFormatter.call(e),f?c+u:-u,r.baseline,s.useHTML).css(yn(e.visible?d:h)).attr({align:f?"left":"right",zIndex:2}).add(e.legendGroup),e.legendGroup.on("mouseover",function(){e.setState(Gt),x.css(r.options.itemHoverStyle)}).on("mouseout",function(){x.css(e.visible?d:h),e.setState()}).on("click",function(t){var n="legendItemClick",i=function(){e.setVisible()};t={browserEvent:t},e.firePointEvent?e.firePointEvent(n,t,i):wn(e,n,t,i)}),r.colorizeItem(e,e.visible),w&&_&&(e.checkbox=g("input",{type:"checkbox",checked:e.selected,defaultChecked:e.selected},s.itemCheckboxStyle,o.container),xn(e.checkbox,"click",function(t){var n=t.target;wn(e,"checkboxClick",{checked:n.checked},function(){e.select()})}))),n=x.getBBox(),i=e.legendItemWidth=s.itemWidth||c+u+n.width+p+(_?20:0),r.itemHeight=t=n.height,l&&r.itemX-y+i>(m||o.chartWidth-2*p-y)&&(r.itemX=y,r.itemY+=b+r.lastLineHeight+v,r.lastLineHeight=0),r.maxItemWidth=mt(r.maxItemWidth,i),r.lastItemY=b+r.itemY+v,r.lastLineHeight=mt(t,r.lastLineHeight),e._legendItemPos=[r.itemX,r.itemY],l?r.itemX+=i:(r.itemY+=b+t+v,r.lastLineHeight=t),r.offsetWidth=m||mt(l?r.itemX-y:i,r.offsetWidth)},render:function(){var t,n,i,r,o=this,a=o.chart,s=a.renderer,l=o.group,c=o.box,u=o.options,d=o.padding,h=u.borderWidth,p=u.backgroundColor;o.itemX=o.initialItemX,o.itemY=o.initialItemY,o.offsetWidth=0,o.lastItemY=0,l||(o.group=l=s.g("legend").attr({zIndex:7}).add(),o.contentGroup=s.g().attr({zIndex:1}).add(l),o.scrollGroup=s.g().add(o.contentGroup),o.clipRect=s.clipRect(0,0,9999,a.chartHeight),o.contentGroup.clip(o.clipRect)),t=[],gn(a.series,function(e){var n=e.options;n.showInLegend&&(t=t.concat(e.legendItems||("point"===n.legendType?e.data:e)))}),C(t,function(e,t){return(e.options.legendIndex||0)-(t.options.legendIndex||0)}),u.reversed&&t.reverse(),o.allItems=t,o.display=n=!!t.length,gn(t,function(e){o.renderItem(e)}),i=u.width||o.offsetWidth,r=o.lastItemY+o.lastLineHeight,r=o.handleOverflow(r),(h||p)&&(i+=d,r+=d,c?i>0&&r>0&&(c[c.isNew?"attr":"animate"](c.crisp(null,null,null,i,r)),c.isNew=!1):(o.box=c=s.rect(0,0,i,r,u.borderRadius,h||0).attr({stroke:u.borderColor,"stroke-width":h||0,fill:p||Kt}).add(l).shadow(u.shadow),c.isNew=!0),c[n?"show":"hide"]()),o.legendWidth=i,o.legendHeight=r,gn(t,function(e){o.positionItem(e)}),n&&l.align(e({width:i,height:r},u),!0,a.spacingBox),a.isResizing||this.positionCheckboxes()},handleOverflow:function(e){var t,n,i=this,r=this.chart,o=r.renderer,a=this.options,s=a.y,l="top"===a.verticalAlign,c=r.spacingBox.height+(l?-s:s)-this.padding,u=a.maxHeight,d=this.clipRect,h=a.navigation,f=p(h.animation,!0),g=h.arrowSize||12,m=this.nav;return"horizontal"===a.layout&&(c/=2),u&&(c=vt(c,u)),e>c?(this.clipHeight=n=c-20,this.pageCount=t=gt(e/n),this.currentPage=p(this.currentPage,1),this.fullHeight=e,d.attr({height:n}),m||(this.nav=m=o.g().attr({zIndex:1}).add(this.group),this.up=o.symbol("triangle",0,0,g,g).on("click",function(){i.scroll(-1,f)}).add(m),this.pager=o.text("",15,10).css(h.style).add(m),this.down=o.symbol("triangle-down",0,0,g,g).on("click",function(){i.scroll(1,f)}).add(m)),i.scroll(0),e=c):m&&(d.attr({height:r.chartHeight}),m.hide(),this.scrollGroup.attr({translateY:1})),e},scroll:function(e,t){var n=this.pageCount,i=this.currentPage+e,r=this.clipHeight,o=this.options.navigation,a=o.activeColor,s=o.inactiveColor,l=this.pager,c=this.padding;i>n&&(i=n),i>0&&(t!==W&&R(t,this.chart),this.nav.attr({translateX:c,translateY:r+7,visibility:Ht}),this.up.attr({fill:1===i?s:a}).css({cursor:1===i?"default":"pointer"}),l.attr({text:i+"/"+this.pageCount}),this.down.attr({x:18+this.pager.getBBox().width,fill:i===n?s:a}).css({cursor:i===n?"default":"pointer"}),this.scrollGroup.animate({translateY:-vt(r*(i-1),this.fullHeight-r+c)+1}),l.attr({text:i+"/"+n}),this.currentPage=i)}},K.prototype={initSeries:function(e){var t=this,n=t.options.chart,i=e.type||n.type||n.defaultSeriesType,r=new un[i];return r.init(this,e),r},addSeries:function(e,t,n){var i,r=this;return e&&(R(n,r),t=p(t,!0),wn(r,"addSeries",{options:e},function(){r.initSeries(e),r.isDirtyLegend=!0,t&&r.redraw()})),i},isInsidePlot:function(e,t){return e>=0&&this.plotWidth>=e&&t>=0&&this.plotHeight>=t},adjustTickAmounts:function(){this.options.chart.alignTicks!==!1&&gn(this.axes,function(e){e.adjustTickAmount()}),this.maxTicks=null},redraw:function(e){var t,n,i=this,r=i.axes,o=i.series,a=i.tracker,s=i.legend,l=i.isDirtyLegend,c=i.isDirtyBox,u=o.length,d=u,h=i.clipRect,p=i.renderer,f=p.isHidden();for(R(e,i),f&&i.cloneRenderTo();d--;)if(n=o[d],n.isDirty&&n.options.stacking){t=!0;break}if(t)for(d=u;d--;)n=o[d],n.options.stacking&&(n.isDirty=!0);gn(o,function(e){e.isDirty&&"point"===e.options.legendType&&(l=!0)}),l&&s.options.enabled&&(s.render(),i.isDirtyLegend=!1),i.hasCartesianSeries&&(i.isResizing||(i.maxTicks=null,gn(r,function(e){e.setScale()})),i.adjustTickAmounts(),i.getMargins(),gn(r,function(e){e.isDirtyExtremes&&(e.isDirtyExtremes=!1,wn(e,"afterSetExtremes",e.getExtremes())),(e.isDirty||c||t)&&(e.redraw(),c=!0)})),c&&(i.drawChartBox(),h&&(Tn(h),h.animate({width:i.plotSizeX,height:i.plotSizeY+1}))),gn(o,function(e){e.isDirty&&e.visible&&(!e.isCartesian||e.xAxis)&&e.redraw()}),a&&a.resetTracker&&a.resetTracker(!0),p.draw(),wn(i,"redraw"),f&&i.cloneRenderTo(!0)},showLoading:function(t){var n=this,i=n.options,r=n.loadingDiv,o=i.loading;r||(n.loadingDiv=r=g(Pt,{className:zt+"loading"},e(o.style,{left:n.plotLeft+$t,top:n.plotTop+$t,width:n.plotWidth+$t,height:n.plotHeight+$t,zIndex:10,display:Kt}),n.container),n.loadingSpan=g("span",null,o.labelStyle,r)),n.loadingSpan.innerHTML=t||i.lang.loading,n.loadingShown||(f(r,{opacity:0,display:""}),Cn(r,{opacity:o.style.opacity},{duration:o.showDuration||0}),n.loadingShown=!0)},hideLoading:function(){var e=this.options,t=this.loadingDiv;t&&Cn(t,{opacity:0},{duration:e.loading.hideDuration||100,complete:function(){f(t,{display:Kt})}}),this.loadingShown=!1},get:function(e){var t,n,i,r=this,o=r.axes,a=r.series;for(t=0;o.length>t;t++)if(o[t].options.id===e)return o[t];for(t=0;a.length>t;t++)if(a[t].options.id===e)return a[t];for(t=0;a.length>t;t++)for(i=a[t].points||[],n=0;i.length>n;n++)if(i[n].id===e)return i[n];return null},getAxes:function(){var e,t,n=this,i=this.options,r=i.xAxis||{},o=i.yAxis||{};r=h(r),gn(r,function(e,t){e.index=t,e.isX=!0}),o=h(o),gn(o,function(e,t){e.index=t}),e=r.concat(o),gn(e,function(e){t=new j(n,e)}),n.adjustTickAmounts()},getSelectedPoints:function(){var e=[];return gn(this.series,function(t){e=e.concat(mn(t.points,function(e){return e.selected}))}),e},getSelectedSeries:function(){return mn(this.series,function(e){return e.selected})},showResetZoom:function(){var e=this,t=V.lang,n=e.options.chart.resetZoomButton,i=n.theme,r=i.states,o="chart"===n.relativeTo?null:{x:e.plotLeft,y:e.plotTop,width:e.plotWidth,height:e.plotHeight};this.resetZoomButton=e.renderer.button(t.resetZoom,null,null,function(){e.zoomOut()},i,r&&r.hover).attr({align:n.position.align,title:t.resetZoomTitle}).add().align(n.position,!1,o)},zoomOut:function(){var e=this,t=e.resetZoomButton;wn(e,"selection",{resetSelection:!0},function(){e.zoom()}),t&&(e.resetZoomButton=t.destroy())},zoom:function(e){var t,n=this,i=n.options.chart;n.resetZoomEnabled===!1||n.resetZoomButton||n.showResetZoom(),!e||e.resetSelection?gn(n.axes,function(e){e.options.zoomEnabled!==!1&&(e.setExtremes(null,null,!1),t=!0)}):gn(e.xAxis.concat(e.yAxis),function(e){var i=e.axis;n.tracker[i.isXAxis?"zoomX":"zoomY"]&&(i.setExtremes(e.min,e.max,!1),t=!0)}),t&&n.redraw(p(i.animation,100>n.pointCount))},pan:function(e){var t=this,n=t.xAxis[0],i=t.mouseDownX,r=n.pointRange/2,o=n.getExtremes(),a=n.translate(i-e,!0)+r,s=n.translate(i+t.plotWidth-e,!0)-r,l=t.hoverPoints;l&&gn(l,function(e){e.setState()}),n.series.length&&a>vt(o.dataMin,o.min)&&mt(o.dataMax,o.max)>s&&n.setExtremes(a,s,!0,!1),t.mouseDownX=e,f(t.container,{cursor:"move"})},setTitle:function(e,t){var n,i,r=this,o=r.options;r.chartTitleOptions=n=yn(o.title,e),r.chartSubtitleOptions=i=yn(o.subtitle,t),gn([["title",e,n],["subtitle",t,i]],function(e){var t=e[0],n=r[t],i=e[1],o=e[2];n&&i&&(n=n.destroy()),o&&o.text&&!n&&(r[t]=r.renderer.text(o.text,0,0,o.useHTML).attr({align:o.align,"class":zt+t,zIndex:o.zIndex||4}).css(o.style).add().align(o,!1,r.spacingBox))})},getChartSize:function(){var e=this,t=e.options.chart,n=e.renderToClone||e.renderTo;e.containerWidth=pn(n,"width"),e.containerHeight=pn(n,"height"),e.chartWidth=t.width||e.containerWidth||600,e.chartHeight=t.height||(e.containerHeight>19?e.containerHeight:400)},cloneRenderTo:function(e){var t=this.renderToClone,n=this.container;e?t&&(this.renderTo.appendChild(n),A(t),delete this.renderToClone):(n&&this.renderTo.removeChild(n),this.renderToClone=t=this.renderTo.cloneNode(0),f(t,{position:Mt,top:"-9999px",display:"block"}),ut.body.appendChild(t),n&&t.appendChild(n))},getContainer:function(){var t,n,r,o,a,s=this,l=s.options.chart;s.renderTo=o=l.renderTo,a=zt+Ft++,i(o)&&(s.renderTo=o=ut.getElementById(o)),o||D(13,!0),o.innerHTML="",o.offsetWidth||s.cloneRenderTo(),s.getChartSize(),n=s.chartWidth,r=s.chartHeight,s.container=t=g(Pt,{className:zt+"container"+(l.className?" "+l.className:""),id:a},e({position:Bt,overflow:jt,width:n+$t,height:r+$t,textAlign:"left",lineHeight:"normal"},l.style),s.renderToClone||o),s.renderer=l.forExport?new On(t,n,r,!0):new q(t,n,r),Rt&&s.renderer.create(s,t,n,r)},getMargins:function(){var e,t,n=this,i=n.options.chart,r=i.spacingTop,o=i.spacingRight,a=i.spacingBottom,s=i.spacingLeft,l=n.legend,c=n.optionsMarginTop,d=n.optionsMarginLeft,h=n.optionsMarginRight,f=n.optionsMarginBottom,g=n.chartTitleOptions,m=n.chartSubtitleOptions,v=n.options.legend,b=p(v.margin,10),y=v.x,x=v.y,k=v.align,w=v.verticalAlign;n.resetMargins(),e=n.axisOffset,!n.title&&!n.subtitle||u(n.optionsMarginTop)||(t=mt(n.title&&!g.floating&&!g.verticalAlign&&g.y||0,n.subtitle&&!m.floating&&!m.verticalAlign&&m.y||0),t&&(n.plotTop=mt(n.plotTop,t+p(g.margin,15)+r))),l.display&&!v.floating&&("right"===k?u(h)||(n.marginRight=mt(n.marginRight,l.legendWidth-y+b+o)):"left"===k?u(d)||(n.plotLeft=mt(n.plotLeft,l.legendWidth+y+b+s)):"top"===w?u(c)||(n.plotTop=mt(n.plotTop,l.legendHeight+x+b+r)):"bottom"===w&&(u(f)||(n.marginBottom=mt(n.marginBottom,l.legendHeight-x+b+a)))),n.extraBottomMargin&&(n.marginBottom+=n.extraBottomMargin),n.extraTopMargin&&(n.plotTop+=n.extraTopMargin),n.hasCartesianSeries&&gn(n.axes,function(e){e.getOffset()}),u(d)||(n.plotLeft+=e[3]),u(c)||(n.plotTop+=e[0]),u(f)||(n.marginBottom+=e[2]),u(h)||(n.marginRight+=e[1]),n.setChartSize()},initReflow:function(){function e(e){var o=i.width||pn(r,"width"),a=i.height||pn(r,"height"),s=e?e.target:dt;o&&a&&(s===dt||s===ut)&&((o!==n.containerWidth||a!==n.containerHeight)&&(clearTimeout(t),t=setTimeout(function(){n.resize(o,a,!1)},100)),n.containerWidth=o,n.containerHeight=a)}var t,n=this,i=n.options.chart,r=n.renderTo;xn(dt,"resize",e),xn(n,"destroy",function(){kn(dt,"resize",e)})},fireEndResize:function(){var e=this;e&&wn(e,"endResize",null,function(){e.isResizing-=1})},resize:function(e,t,n){var i,r,o,a=this,s=a.title,l=a.subtitle;a.isResizing+=1,R(n,a),a.oldChartHeight=a.chartHeight,a.oldChartWidth=a.chartWidth,u(e)&&(a.chartWidth=i=pt(e)),u(t)&&(a.chartHeight=r=pt(t)),f(a.container,{width:i+$t,height:r+$t}),a.renderer.setSize(i,r,n),a.plotWidth=i-a.plotLeft-a.marginRight,a.plotHeight=r-a.plotTop-a.marginBottom,a.maxTicks=null,gn(a.axes,function(e){e.isDirty=!0,e.setScale()}),gn(a.series,function(e){e.isDirty=!0}),a.isDirtyLegend=!0,a.isDirtyBox=!0,a.getMargins(),o=a.spacingBox,s&&s.align(null,null,o),l&&l.align(null,null,o),a.redraw(n),a.oldChartHeight=null,wn(a,"resize"),X===!1?a.fireEndResize():setTimeout(a.fireEndResize,X&&X.duration||500)},setChartSize:function(){var e=this,t=e.inverted,n=e.chartWidth,i=e.chartHeight,r=e.options.chart,o=r.spacingTop,a=r.spacingRight,s=r.spacingBottom,l=r.spacingLeft;e.plotLeft=pt(e.plotLeft),e.plotTop=pt(e.plotTop),e.plotWidth=pt(n-e.plotLeft-e.marginRight),e.plotHeight=pt(i-e.plotTop-e.marginBottom),e.plotSizeX=t?e.plotHeight:e.plotWidth,e.plotSizeY=t?e.plotWidth:e.plotHeight,e.spacingBox={x:l,y:o,width:n-l-a,height:i-o-s},gn(e.axes,function(e){e.setAxisSize(),e.setAxisTranslation()})},resetMargins:function(){var e=this,t=e.options.chart,n=t.spacingTop,i=t.spacingRight,r=t.spacingBottom,o=t.spacingLeft;e.plotTop=p(e.optionsMarginTop,n),e.marginRight=p(e.optionsMarginRight,i),e.marginBottom=p(e.optionsMarginBottom,r),e.plotLeft=p(e.optionsMarginLeft,o),e.axisOffset=[0,0,0,0]},drawChartBox:function(){var e,t,n=this,i=n.options.chart,r=n.renderer,o=n.chartWidth,a=n.chartHeight,s=n.chartBackground,l=n.plotBackground,c=n.plotBorder,u=n.plotBGImage,d=i.borderWidth||0,h=i.backgroundColor,p=i.plotBackgroundColor,f=i.plotBackgroundImage,g={x:n.plotLeft,y:n.plotTop,width:n.plotWidth,height:n.plotHeight};e=d+(i.shadow?8:0),(d||h)&&(s?s.animate(s.crisp(null,null,null,o-e,a-e)):(t={fill:h||Kt},d&&(t.stroke=i.borderColor,t["stroke-width"]=d),n.chartBackground=r.rect(e/2,e/2,o-e,a-e,i.borderRadius,d).attr(t).add().shadow(i.shadow))),p&&(l?l.animate(g):n.plotBackground=r.rect(n.plotLeft,n.plotTop,n.plotWidth,n.plotHeight,0).attr({fill:p}).add().shadow(i.plotShadow)),f&&(u?u.animate(g):n.plotBGImage=r.image(f,n.plotLeft,n.plotTop,n.plotWidth,n.plotHeight).add()),i.plotBorderWidth&&(c?c.animate(c.crisp(null,n.plotLeft,n.plotTop,n.plotWidth,n.plotHeight)):n.plotBorder=r.rect(n.plotLeft,n.plotTop,n.plotWidth,n.plotHeight,0,i.plotBorderWidth).attr({stroke:i.plotBorderColor,"stroke-width":i.plotBorderWidth,zIndex:4}).add()),n.isDirtyBox=!1},propFromSeries:function(){var e,t,n,i=this,r=i.options.chart,o=i.options.series;gn(["inverted","angular","polar"],function(a){for(e=un[r.type||r.defaultSeriesType],n=i[a]||r[a]||e&&e.prototype[a],t=o&&o.length;!n&&t--;)e=un[o[t].type],e&&e.prototype[a]&&(n=!0);i[a]=n})},render:function(){var t,i=this,r=i.axes,o=i.renderer,a=i.options,s=a.labels,l=a.credits;i.setTitle(),i.legend=new $(i),gn(r,function(e){e.setScale()}),i.getMargins(),i.maxTicks=null,gn(r,function(e){e.setTickPositions(!0),e.setMaxTicks()}),i.adjustTickAmounts(),i.getMargins(),i.drawChartBox(),i.hasCartesianSeries&&gn(r,function(e){e.render()}),i.seriesGroup||(i.seriesGroup=o.g("series-group").attr({zIndex:3}).add()),gn(i.series,function(e){e.translate(),e.setTooltipPoints(),e.render()}),s.items&&gn(s.items,function(){var t=e(s.style,this.style),r=n(t.left)+i.plotLeft,a=n(t.top)+i.plotTop+12;delete t.left,delete t.top,o.text(this.html,r,a).attr({zIndex:2}).css(t).add()}),l.enabled&&!i.credits&&(t=l.href,i.credits=o.text(l.text,0,0).on("click",function(){t&&(location.href=t)}).attr({align:l.position.align,zIndex:8}).css(l.style).add().align(l.position)),i.hasRendered=!0},destroy:function(){var e,t=this,n=t.axes,i=t.series,r=t.container,o=r&&r.parentNode;if(null!==t){for(wn(t,"destroy"),kn(t),e=n.length;e--;)n[e]=n[e].destroy();for(e=i.length;e--;)i[e]=i[e].destroy();gn(["title","subtitle","chartBackground","plotBackground","plotBGImage","plotBorder","seriesGroup","clipRect","credits","tracker","scroller","rangeSelector","legend","resetZoomButton","tooltip","renderer"],function(e){var n=t[e];n&&(t[e]=n.destroy())}),r&&(r.innerHTML="",kn(r),o&&A(r),r=null);for(e in t)delete t[e];t.options=null,t=null}},firstRender:function(){var e=this,t=e.options,n=e.callback,i="onreadystatechange",r="complete";return!Dt&&dt==dt.top&&ut.readyState!==r||Rt&&!dt.canvg?(Rt?Bn.push(function(){e.firstRender()},t.global.canvasToolsURL):ut.attachEvent(i,function(){ut.detachEvent(i,e.firstRender),ut.readyState===r&&e.firstRender()}),void 0):(e.getContainer(),wn(e,"init"),Highcharts.RangeSelector&&t.rangeSelector.enabled&&(e.rangeSelector=new Highcharts.RangeSelector(e)),e.resetMargins(),e.setChartSize(),e.propFromSeries(),e.getAxes(),gn(t.series||[],function(t){e.initSeries(t)}),Highcharts.Scroller&&(t.navigator.enabled||t.scrollbar.enabled)&&(e.scroller=new Highcharts.Scroller(e)),e.tracker=new H(e,t),e.render(),e.renderer.draw(),n&&n.apply(e,[e]),gn(e.callbacks,function(t){t.apply(e,[e])}),e.cloneRenderTo(!0),wn(e,"load"),void 0)},init:function(e){var t,n=this,i=n.options.chart;if(i.reflow!==!1&&xn(n,"load",n.initReflow),e)for(t in e)xn(n,t,e[t]);n.xAxis=[],n.yAxis=[],n.animation=Rt?!1:p(i.animation,!0),n.setSize=n.resize,n.pointCount=0,n.counters=new _,n.firstRender()}},K.prototype.callbacks=[];var jn=function(){};jn.prototype={init:function(e,t,n){var i,r=this,o=e.chart.counters;return r.series=e,r.applyOptions(t,n),r.pointAttr={},e.options.colorByPoint&&(i=e.chart.options.colors,r.options||(r.options={}),r.color=r.options.color=r.color||i[o.color++],o.wrapColor(i.length)),e.chart.pointCount++,r},applyOptions:function(t,n){var i=this,r=i.series,o=typeof t;i.config=t,"number"===o||null===t?i.y=t:"number"==typeof t[0]?(i.x=t[0],i.y=t[1]):"object"===o&&"number"!=typeof t.length?(e(i,t),i.options=t,t.dataLabels&&(r._hasPointLabels=!0)):"string"==typeof t[0]&&(i.name=t[0],i.y=t[1]),i.x===W&&(i.x=n===W?r.autoIncrement():n)},destroy:function(){var e,t=this,n=t.series,i=n.chart,r=i.hoverPoints;i.pointCount--,r&&(t.setState(),c(r,t),r.length||(i.hoverPoints=null)),t===i.hoverPoint&&t.onMouseOut(),(t.graphic||t.dataLabel)&&(kn(t),t.destroyElements()),t.legendItem&&i.legend.destroyItem(t);for(e in t)t[e]=null},destroyElements:function(){for(var e,t=this,n=["graphic","tracker","dataLabel","group","connector","shadowGroup"],i=6;i--;)e=n[i],t[e]&&(t[e]=t[e].destroy())},getLabelConfig:function(){var e=this;return{x:e.category,y:e.y,key:e.name||e.category,series:e.series,point:e,percentage:e.percentage,total:e.total||e.stackTotal}},select:function(e,t){var n=this,i=n.series,r=i.chart;e=p(e,!n.selected),n.firePointEvent(e?"select":"unselect",{accumulate:t},function(){n.selected=e,n.setState(e&&Xt),t||gn(r.getSelectedPoints(),function(e){e.selected&&e!==n&&(e.selected=!1,e.setState(Vt),e.firePointEvent("unselect"))})})},onMouseOver:function(){var e=this,t=e.series,n=t.chart,i=n.tooltip,r=n.hoverPoint;r&&r!==e&&r.onMouseOut(),e.firePointEvent("mouseOver"),!i||i.shared&&!t.noSharedTooltip||i.refresh(e),e.setState(Gt),n.hoverPoint=e},onMouseOut:function(){var e=this;e.firePointEvent("mouseOut"),e.setState(),e.series.chart.hoverPoint=null},tooltipFormatter:function(e){var t,n,r,o,a,s,l,c=this,u=c.series,d=u.tooltipOptions,h=e.match(/\{(series|point)\.[a-zA-Z]+\}/g),f=/[{\.}]/,g={y:0,open:0,high:0,low:0,close:0,percentage:1,total:1};d.valuePrefix=d.valuePrefix||d.yPrefix,d.valueDecimals=d.valueDecimals||d.yDecimals,d.valueSuffix=d.valueSuffix||d.ySuffix;for(l in h)n=h[l],i(n)&&n!==e&&(a=(" "+n).split(f),t={point:c,series:u}[a[1]],s=a[2],t===c&&g.hasOwnProperty(s)?(o=g[s]?s:"value",r=(d[o+"Prefix"]||"")+b(c[s],p(d[o+"Decimals"],-1))+(d[o+"Suffix"]||"")):r=t[s],e=e.replace(n,r));return e},update:function(e,t,n){var i,o=this,a=o.series,s=o.graphic,l=a.data,c=l.length,u=a.chart;t=p(t,!0),o.firePointEvent("update",{options:e},function(){for(o.applyOptions(e),r(e)&&(a.getAttribs(),s&&s.attr(o.pointAttr[a.state])),i=0;c>i;i++)if(l[i]===o){a.xData[i]=o.x,a.yData[i]=o.y,a.options.data[i]=e;break}a.isDirty=!0,a.isDirtyData=!0,t&&u.redraw(n)})},remove:function(e,t){var n,i=this,r=i.series,o=r.chart,a=r.data,s=a.length;R(t,o),e=p(e,!0),i.firePointEvent("remove",null,function(){for(n=0;s>n;n++)if(a[n]===i){a.splice(n,1),r.options.data.splice(n,1),r.xData.splice(n,1),r.yData.splice(n,1);break}i.destroy(),r.isDirty=!0,r.isDirtyData=!0,e&&o.redraw()})},firePointEvent:function(e,t,n){var i=this,r=this.series,o=r.options;(o.point.events[e]||i.options&&i.options.events&&i.options.events[e])&&this.importEvents(),"click"===e&&o.allowPointSelect&&(n=function(e){i.select(null,e.ctrlKey||e.metaKey||e.shiftKey)}),wn(this,e,t,n)},importEvents:function(){if(!this.hasImportedEvents){var e,t=this,n=yn(t.series.options.point,t.options),i=n.events;t.events=i;for(e in i)xn(t,e,i[e]);this.hasImportedEvents=!0}},setState:function(e){var t,n=this,i=n.plotX,r=n.plotY,o=n.series,a=o.options.states,s=In[o.type].marker&&o.options.marker,l=s&&!s.enabled,c=s&&s.states[e],u=c&&c.enabled===!1,d=o.stateMarkerGraphic,h=o.chart,p=n.pointAttr;e=e||Vt,e===n.state||n.selected&&e!==Xt||a[e]&&a[e].enabled===!1||e&&(u||l&&!c.enabled)||(n.graphic?(t=s&&n.graphic.symbolName&&p[e].r,n.graphic.attr(yn(p[e],t?{x:i-t,y:r-t,width:2*t,height:2*t}:{}))):(e&&c&&(d||(t=c.radius,o.stateMarkerGraphic=d=h.renderer.symbol(o.symbol,-t,-t,2*t,2*t).attr(p[e]).add(o.group)),d.translate(i,r)),d&&d[e?"show":"hide"]()),n.state=e)}};var zn=function(){};zn.prototype={isCartesian:!0,type:"line",pointClass:jn,sorted:!0,pointAttrToOptions:{stroke:"lineColor","stroke-width":"lineWidth",fill:"fillColor",r:"radius"},init:function(t,n){var i,r,o=this,a=t.series.length;o.chart=t,o.options=n=o.setOptions(n),o.bindAxes(),e(o,{index:a,name:n.name||"Series "+(a+1),state:Vt,pointAttr:{},visible:n.visible!==!1,selected:n.selected===!0}),Rt&&(n.animation=!1),r=n.events;for(i in r)xn(o,i,r[i]);(r&&r.click||n.point&&n.point.events&&n.point.events.click||n.allowPointSelect)&&(t.runTrackerClick=!0),o.getColor(),o.getSymbol(),o.setData(n.data,!1),o.isCartesian&&(t.hasCartesianSeries=!0),t.series.push(o)},bindAxes:function(){var e,t=this,n=t.options,i=t.chart;t.isCartesian&&gn(["xAxis","yAxis"],function(r){gn(i[r],function(i){e=i.options,(n[r]===e.index||n[r]===W&&0===e.index)&&(i.series.push(t),t[r]=i,i.isDirty=!0)})})},autoIncrement:function(){var e=this,t=e.options,n=e.xIncrement;return n=p(n,t.pointStart,0),e.pointInterval=p(e.pointInterval,t.pointInterval,1),e.xIncrement=n+e.pointInterval,n},getSegments:function(){var e,t=this,n=-1,i=[],r=t.points,o=r.length;if(o)if(t.options.connectNulls){for(e=o;e--;)null===r[e].y&&r.splice(e,1);r.length&&(i=[r])}else gn(r,function(e,t){null===e.y?(t>n+1&&i.push(r.slice(n+1,t)),n=t):t===o-1&&i.push(r.slice(n+1,t+1))});t.segments=i},setOptions:function(e){var t,n=this,i=n.chart,r=i.options,o=r.plotOptions,a=e.data;return e.data=null,t=yn(o[this.type],o.series,e),t.data=e.data=a,n.tooltipOptions=yn(r.tooltip,t.tooltip),t},getColor:function(){var e=this.options,t=this.chart.options.colors,n=this.chart.counters;this.color=e.color||!e.colorByPoint&&t[n.color++]||"gray",n.wrapColor(t.length)},getSymbol:function(){var e=this,t=e.options.marker,n=e.chart,i=n.options.symbols,r=n.counters;e.symbol=t.symbol||i[r.symbol++],/^url/.test(e.symbol)&&(t.radius=0),r.wrapSymbol(i.length)},drawLegendSymbol:function(e){var t,n,i,r=this.options,o=r.marker,a=e.options,s=a.symbolWidth,l=this.chart.renderer,c=this.legendGroup,u=e.baseline;r.lineWidth&&(i={"stroke-width":r.lineWidth},r.dashStyle&&(i.dashstyle=r.dashStyle),this.legendLine=l.path([Wt,0,u-4,qt,s,u-4]).attr(i).add(c)),o&&o.enabled&&(t=o.radius,this.legendSymbol=n=l.symbol(this.symbol,s/2-t,u-4-t,2*t,2*t).attr(this.pointAttr[Vt]).add(c))},addPoint:function(e,t,n,i){var r,o=this,a=o.data,s=o.graph,l=o.area,c=o.chart,u=o.xData,d=o.yData,h=s&&s.shift||0,f=o.options.data;R(i,c),s&&n&&(s.shift=h+1),l&&(n&&(l.shift=h+1),l.isArea=!0),t=p(t,!0),r={series:o},o.pointClass.prototype.applyOptions.apply(r,[e]),u.push(r.x),d.push(4===o.valueCount?[r.open,r.high,r.low,r.close]:r.y),f.push(e),n&&(a[0]&&a[0].remove?a[0].remove(!1):(a.shift(),u.shift(),d.shift(),f.shift())),o.getAttribs(),o.isDirty=!0,o.isDirtyData=!0,t&&c.redraw()},setData:function(e,t){var n,i=this,r=i.points,s=i.options,l=i.initialColor,c=i.chart,d=null,h=i.xAxis,f=i.pointClass.prototype;i.xIncrement=null,i.pointRange=h&&h.categories&&1||s.pointRange,u(l)&&(c.counters.color=l);var g,m=[],v=[],b=e?e.length:[],y=s.turboThreshold||1e3,x=i.valueCount;if(b>y){for(n=0;null===d&&b>n;)d=e[n],n++;if(a(d)){var k=p(s.pointStart,0),w=p(s.pointInterval,1);for(n=0;b>n;n++)m[n]=k,v[n]=e[n],k+=w;i.xIncrement=k}else if(o(d))if(x)for(n=0;b>n;n++)g=e[n],m[n]=g[0],v[n]=g.slice(1,x+1);else for(n=0;b>n;n++)g=e[n],m[n]=g[0],v[n]=g[1]}else for(n=0;b>n;n++)g={series:i},f.applyOptions.apply(g,[e[n]]),m[n]=g.x,v[n]=f.toYData?f.toYData.apply(g):g.y;for(i.data=[],i.options.data=e,i.xData=m,i.yData=v,n=r&&r.length||0;n--;)r[n]&&r[n].destroy&&r[n].destroy();h&&(h.minRange=h.userMinRange),i.isDirty=i.isDirtyData=c.isDirtyBox=!0,p(t,!0)&&c.redraw(!1)},remove:function(e,t){var n=this,i=n.chart;e=p(e,!0),n.isRemoving||(n.isRemoving=!0,wn(n,"remove",null,function(){n.destroy(),i.isDirtyLegend=i.isDirtyBox=!0,e&&i.redraw(t)})),n.isRemoving=!1},processData:function(e){var t,n,i,r,o=this,a=o.xData,s=o.yData,l=a.length,c=0,u=l,d=o.xAxis,h=o.options,p=h.cropThreshold,f=o.isCartesian;if(f&&!o.isDirty&&!d.isDirty&&!o.yAxis.isDirty&&!e)return!1;if(f&&o.sorted&&(!p||l>p||o.forceCrop)){var g=d.getExtremes(),m=g.min,v=g.max;if(m>a[l-1]||a[0]>v)a=[],s=[];else if(m>a[0]||a[l-1]>v){for(r=0;l>r;r++)if(a[r]>=m){c=mt(0,r-1);break}for(;l>r;r++)if(a[r]>v){u=r+1;break}a=a.slice(c,u),s=s.slice(c,u),t=!0}}for(r=a.length-1;r>0;r--)n=a[r]-a[r-1],n>0&&(i===W||i>n)&&(i=n);o.cropped=t,o.cropStart=c,o.processedXData=a,o.processedYData=s,null===h.pointRange&&(o.pointRange=i||1),o.closestPointRange=i},generatePoints:function(){var e,t,n,i,r=this,o=r.options,a=o.data,s=r.data,l=r.processedXData,c=r.processedYData,u=r.pointClass,d=l.length,p=r.cropStart||0,f=r.hasGroupedData,g=[];if(!s&&!f){var m=[];m.length=a.length,s=r.data=m}for(i=0;d>i;i++)t=p+i,f?g[i]=(new u).init(r,[l[i]].concat(h(c[i]))):(s[t]?n=s[t]:a[t]!==W&&(s[t]=n=(new u).init(r,a[t],l[i])),g[i]=n);if(s&&(d!==(e=s.length)||f))for(i=0;e>i;i++)i!==p||f||(i+=d),s[i]&&(s[i].destroyElements(),s[i].plotX=W);r.data=s,r.points=g},translate:function(){this.processedXData||this.processData(),this.generatePoints();for(var e,t=this,n=t.chart,i=t.options,r=i.stacking,o=t.xAxis,a=o.categories,s=t.yAxis,l=t.points,c=l.length,d=!!t.modifyValue,h=s.series,p=h.length;p--;)if(h[p].visible){p===t.index&&(e=!0);break}for(p=0;c>p;p++){var f,g,m=l[p],v=m.x,b=m.y,y=m.low,x=s.stacks[(i.threshold>b?"-":"")+t.stackKey];m.plotX=o.translate(v,0,0,0,1),r&&t.visible&&x&&x[v]&&(f=x[v],g=f.total,f.cum=y=f.cum-b,b=y+b,e&&(y=i.threshold),"percent"===r&&(y=g?100*y/g:0,b=g?100*b/g:0),m.percentage=g?100*m.y/g:0,m.stackTotal=g,m.stackY=b),m.yBottom=u(y)?s.translate(y,0,1,0,1):null,d&&(b=t.modifyValue(b,m)),m.plotY="number"==typeof b?pt(10*s.translate(b,0,1,0,1))/10:W,m.clientX=n.inverted?n.plotHeight-m.plotX:m.plotX,m.category=a&&a[m.x]!==W?a[m.x]:m.x}t.getSegments()},setTooltipPoints:function(e){var t,n,i,r,o,a=this,s=a.chart,l=[],c=s.plotSizeX,u=a.xAxis,d=[];if(a.options.enableMouseTracking!==!1){for(e&&(a.tooltipPoints=null),gn(a.segments||a.points,function(e){l=l.concat(e)}),u&&u.reversed&&(l=l.reverse()),t=l.length,o=0;t>o;o++)for(r=l[o],n=l[o-1]?l[o-1]._high+1:0,r._high=i=l[o+1]?mt(0,ft((r.plotX+(l[o+1]?l[o+1].plotX:c))/2)):c;n>=0&&i>=n;)d[n++]=r;a.tooltipPoints=d}},tooltipHeaderFormatter:function(e){var t,n=this,i=n.tooltipOptions,r=i.xDateFormat,o=n.xAxis,a=o&&"datetime"===o.options.type;if(a&&!r)for(t in J)if(J[t]>=o.closestPointRange){r=i.dateTimeLabelFormats[t]; break}return i.headerFormat.replace("{point.key}",a?G(r,e):e).replace("{series.name}",n.name).replace("{series.color}",n.color)},onMouseOver:function(){var e=this,t=e.chart,n=t.hoverSeries;(Lt||!t.mouseIsDown)&&(n&&n!==e&&n.onMouseOut(),e.options.events.mouseOver&&wn(e,"mouseOver"),e.setState(Gt),t.hoverSeries=e)},onMouseOut:function(){var e=this,t=e.options,n=e.chart,i=n.tooltip,r=n.hoverPoint;r&&r.onMouseOut(),e&&t.events.mouseOut&&wn(e,"mouseOut"),!i||t.stickyTracking||i.shared||i.hide(),e.setState(),n.hoverSeries=null},animate:function(e){var t=this,n=t.chart,i=t.clipRect,o=t.options.animation;o&&!r(o)&&(o={}),e?i.isAnimating||(i.attr("width",0),i.isAnimating=!0):(i.animate({width:n.plotSizeX},o),this.animate=null)},drawPoints:function(){var t,n,i,r,o,a,s,l,c,u=this,d=u.points,h=u.chart;if(u.options.marker.enabled)for(r=d.length;r--;)o=d[r],n=o.plotX,i=o.plotY,c=o.graphic,i===W||isNaN(i)||(t=o.pointAttr[o.selected?Xt:Vt],a=t.r,s=p(o.marker&&o.marker.symbol,u.symbol),l=0===s.indexOf("url"),c?c.animate(e({x:n-a,y:i-a},c.symbolName?{width:2*a,height:2*a}:{})):(a>0||l)&&(o.graphic=h.renderer.symbol(s,n-a,i-a,2*a,2*a).attr(t).add(u.group)))},convertAttribs:function(e,t,n,i){var r,o,a=this.pointAttrToOptions,s={};e=e||{},t=t||{},n=n||{},i=i||{};for(r in a)o=a[r],s[r]=p(e[o],t[r],n[r],i[r]);return s},getAttribs:function(){var e,t,n,i,r,o,a=this,s=In[a.type].marker?a.options.marker:a.options,l=s.states,c=l[Gt],d=a.color,h={stroke:d,fill:d},p=a.points||[],f=[],g=a.pointAttrToOptions;for(a.options.marker?(c.radius=c.radius||s.radius+2,c.lineWidth=c.lineWidth||s.lineWidth+1):c.color=c.color||Ln(c.color||d).brighten(c.brightness).get(),f[Vt]=a.convertAttribs(s,h),gn([Gt,Xt],function(e){f[e]=a.convertAttribs(l[e],f[Vt])}),a.pointAttr=f,t=p.length;t--;){if(n=p[t],s=n.options&&n.options.marker||n.options,s&&s.enabled===!1&&(s.radius=0),r=!1,n.options)for(o in g)u(s[g[o]])&&(r=!0);r?(i=[],l=s.states||{},e=l[Gt]=l[Gt]||{},a.options.marker||(e.color=Ln(e.color||n.options.color).brighten(e.brightness||c.brightness).get()),i[Vt]=a.convertAttribs(s,f[Vt]),i[Gt]=a.convertAttribs(l[Gt],f[Gt],i[Vt]),i[Xt]=a.convertAttribs(l[Xt],f[Xt],i[Vt])):i=f,n.pointAttr=i}},destroy:function(){var e,t,n,i,r,o=this,a=o.chart,s=o.clipRect,l=/AppleWebKit\/533/.test(_t),u=o.data||[];for(wn(o,"destroy"),kn(o),gn(["xAxis","yAxis"],function(e){r=o[e],r&&(c(r.series,o),r.isDirty=!0)}),o.legendItem&&o.chart.legend.destroyItem(o),t=u.length;t--;)n=u[t],n&&n.destroy&&n.destroy();o.points=null,s&&s!==a.clipRect&&(o.clipRect=s.destroy()),gn(["area","graph","dataLabelsGroup","group","tracker","trackerGroup"],function(t){o[t]&&(e=l&&"group"===t?"hide":"destroy",o[t][e]())}),a.hoverSeries===o&&(a.hoverSeries=null),c(a.series,o);for(i in o)delete o[i]},drawDataLabels:function(){var e=this,t=e.options,n=t.dataLabels;if(n.enabled||e._hasPointLabels){var i,r,o,a,s,l,c,d=e.points,h=e.dataLabelsGroup,f=e.chart,g=e.xAxis,m=g?g.left:f.plotLeft,v=e.yAxis,b=v?v.top:f.plotTop,y=f.renderer,x=f.inverted,k=e.type,w=t.stacking,_="column"===k||"bar"===k,C=null===n.verticalAlign,T=null===n.y,E=y.fontMetrics(n.style.fontSize),S=E.h,A=E.b;if(_){var D={top:A,middle:A-S/2,bottom:-S+A};w?(C&&(n=yn(n,{verticalAlign:"middle"})),T&&(n=yn(n,{y:D[n.verticalAlign]}))):C?n=yn(n,{verticalAlign:"top"}):T&&(n=yn(n,{y:D[n.verticalAlign]}))}h?h.translate(m,b):h=e.dataLabelsGroup=y.g("data-labels").attr({visibility:e.visible?Ht:jt,zIndex:6}).translate(m,b).add(),a=n,gn(d,function(d){if(l=d.dataLabel,n=a,o=d.options,o&&o.dataLabels&&(n=yn(n,o.dataLabels)),c=n.enabled){var g=d.barX&&d.barX+d.barW/2||p(d.plotX,-999),m=p(d.plotY,-999),v=null===n.y?d.y>=t.threshold?-S+A:A:n.y;i=(x?f.plotWidth-m:g)+n.x,r=pt((x?f.plotHeight-g:m)+v)}if(!l||!e.isCartesian||f.isInsidePlot(i,r)&&c){if(c){var b,C,T=n.align;if(s=n.formatter.call(d.getLabelConfig(),n),"column"===k&&(i+={left:-1,right:1}[T]*d.barW/2||0),!w&&x&&0>d.y&&(T="right",i-=10),n.style.color=p(n.color,n.style.color,e.color,"black"),l)l.attr({text:s}).animate({x:i,y:r});else if(u(s)){b={align:T,fill:n.backgroundColor,stroke:n.borderColor,"stroke-width":n.borderWidth,r:n.borderRadius||0,rotation:n.rotation,padding:n.padding,zIndex:1};for(C in b)b[C]===W&&delete b[C];l=d.dataLabel=y[n.rotation?"text":"label"](s,i,r,null,null,null,n.useHTML,!0).attr(b).css(n.style).add(h).shadow(n.shadow)}if(_&&t.stacking&&l){var E=d.barX,D=d.barY,I=d.barW,R=d.barH;l.align(n,null,{x:x?f.plotWidth-D-R:E,y:x?f.plotHeight-E-I:D,width:x?R:I,height:x?I:R})}}}else d.dataLabel=l.destroy()})}},getSegmentPath:function(e){var t=this,n=[];return gn(e,function(i,r){if(t.getPointSpline)n.push.apply(n,t.getPointSpline(e,i,r));else{if(n.push(r?qt:Wt),r&&t.options.step){var o=e[r-1];n.push(i.plotX,o.plotY)}n.push(i.plotX,i.plotY)}}),n},drawGraph:function(){var e,t,n=this,i=n.options,r=n.chart,o=n.graph,a=[],s=n.group,l=i.lineColor||n.color,c=i.lineWidth,u=i.dashStyle,d=r.renderer,h=[];gn(n.segments,function(t){e=n.getSegmentPath(t),t.length>1?a=a.concat(e):h.push(t[0])}),n.graphPath=a,n.singlePoints=h,o?(Tn(o),o.animate({d:a})):c&&(t={stroke:l,"stroke-width":c},u&&(t.dashstyle=u),n.graph=d.path(a).attr(t).add(s).shadow(i.shadow))},invertGroups:function(){function e(){var e={width:t.yAxis.len,height:t.xAxis.len};n.attr(e).invert(),i&&i.attr(e).invert()}var t=this,n=t.group,i=t.trackerGroup,r=t.chart;xn(r,"resize",e),xn(t,"destroy",function(){kn(r,"resize",e)}),e(),t.invertGroups=e},createGroup:function(){var e=this.chart,t=this.group=e.renderer.g("series");t.attr({visibility:this.visible?Ht:jt,zIndex:this.options.zIndex}).translate(this.xAxis.left,this.yAxis.top).add(e.seriesGroup),this.createGroup=Nt},render:function(){var e,t=this,n=t.chart,i=t.options,r=i.clip!==!1,o=i.animation,a=o&&t.animate,s=a?o&&o.duration||500:0,l=t.clipRect,c=n.renderer;l||(l=t.clipRect=!n.hasRendered&&n.clipRect?n.clipRect:c.clipRect(0,0,n.plotSizeX,n.plotSizeY+1),n.clipRect||(n.clipRect=l)),t.createGroup(),e=t.group,t.drawDataLabels(),a&&t.animate(!0),t.getAttribs(),t.drawGraph&&t.drawGraph(),t.drawPoints(),t.options.enableMouseTracking!==!1&&t.drawTracker(),n.inverted&&t.invertGroups(),r&&!t.hasRendered&&(e.clip(l),t.trackerGroup&&t.trackerGroup.clip(n.clipRect)),a&&t.animate(),setTimeout(function(){l.isAnimating=!1,e=t.group,e&&l!==n.clipRect&&l.renderer&&(r&&e.clip(t.clipRect=n.clipRect),l.destroy())},s),t.isDirty=t.isDirtyData=!1,t.hasRendered=!0},redraw:function(){var e=this,t=e.chart,n=e.isDirtyData,i=e.group;i&&(t.inverted&&i.attr({width:t.plotWidth,height:t.plotHeight}),i.animate({translateX:e.xAxis.left,translateY:e.yAxis.top})),e.translate(),e.setTooltipPoints(!0),e.render(),n&&wn(e,"updatedData")},setState:function(e){var t=this,n=t.options,i=t.graph,r=n.states,o=n.lineWidth;if(e=e||Vt,t.state!==e){if(t.state=e,r[e]&&r[e].enabled===!1)return;e&&(o=r[e].lineWidth||o+1),i&&!i.dashstyle&&i.attr({"stroke-width":o},e?0:500)}},setVisible:function(e,t){var n,i,r,o=this,a=o.chart,s=o.legendItem,l=o.group,c=o.tracker,u=o.dataLabelsGroup,d=o.points,h=a.options.chart.ignoreHiddenSeries,p=o.visible;if(o.visible=e=e===W?!p:e,n=e?"show":"hide",l&&l[n](),c)c[n]();else if(d)for(i=d.length;i--;)r=d[i],r.tracker&&r.tracker[n]();u&&u[n](),s&&a.legend.colorizeItem(o,e),o.isDirty=!0,o.options.stacking&&gn(a.series,function(e){e.options.stacking&&e.visible&&(e.isDirty=!0)}),h&&(a.isDirtyBox=!0),t!==!1&&a.redraw(),wn(o,n)},show:function(){this.setVisible(!0)},hide:function(){this.setVisible(!1)},select:function(e){var t=this;t.selected=e=e===W?!t.selected:e,t.checkbox&&(t.checkbox.checked=e),wn(t,e?"select":"unselect")},drawTrackerGroup:function(){var e=this.trackerGroup,t=this.chart;return this.isCartesian&&(e||(this.trackerGroup=e=t.renderer.g().attr({zIndex:this.options.zIndex||1}).add(t.trackerGroup)),e.translate(this.xAxis.left,this.yAxis.top)),e},drawTracker:function(){var e,t,n=this,i=n.options,r=i.trackByArea,o=[].concat(r?n.areaPath:n.graphPath),a=o.length,s=n.chart,l=s.renderer,c=s.options.tooltip.snap,u=n.tracker,d=i.cursor,h=d&&{cursor:d},p=n.singlePoints,f=n.drawTrackerGroup();if(a&&!r)for(t=a+1;t--;)o[t]===Wt&&o.splice(t+1,0,o[t+1]-c,o[t+2],qt),(t&&o[t]===Wt||t===a)&&o.splice(t,0,qt,o[t-2]+c,o[t-1]);for(t=0;p.length>t;t++)e=p[t],o.push(Wt,e.plotX-c,e.plotY,qt,e.plotX+c,e.plotY);u?u.attr({d:o}):n.tracker=l.path(o).attr({isTracker:!0,"stroke-linejoin":"bevel",visibility:n.visible?Ht:jt,stroke:Ut,fill:r?Ut:Kt,"stroke-width":i.lineWidth+(r?0:2*c)}).on(Lt?"touchstart":"mouseover",function(){s.hoverSeries!==n&&n.onMouseOver()}).on("mouseout",function(){i.stickyTracking||n.onMouseOut()}).css(h).add(f)}};var Hn=m(zn);un.line=Hn,In.area=yn(Rn,{threshold:0});var $n=m(zn,{type:"area",getSegmentPath:function(e){var t,n=zn.prototype.getSegmentPath.call(this,e),i=[].concat(n),r=this.options,o=n.length,a=this.yAxis.getThreshold(r.threshold);if(3===o&&i.push(qt,n[1],n[2]),r.stacking&&"areaspline"!==this.type)for(t=e.length-1;t>=0;t--)e.length-1>t&&r.step&&i.push(e[t+1].plotX,e[t].yBottom),i.push(e[t].plotX,e[t].yBottom);else i.push(qt,e[e.length-1].plotX,a,qt,e[0].plotX,a);return this.areaPath=this.areaPath.concat(i),n},drawGraph:function(){this.areaPath=[],zn.prototype.drawGraph.apply(this);var e=this.areaPath,t=this.options,n=this.area;n?n.animate({d:e}):this.area=this.chart.renderer.path(e).attr({fill:p(t.fillColor,Ln(this.color).setOpacity(t.fillOpacity||.75).get())}).add(this.group)},drawLegendSymbol:function(e,t){t.legendSymbol=this.chart.renderer.rect(0,e.baseline-11,e.options.symbolWidth,12,2).attr({zIndex:3}).add(t.legendGroup)}});un.area=$n,In.spline=yn(Rn);var Kn=m(zn,{type:"spline",getPointSpline:function(e,t,n){var i,r,o,a,s,l=1.5,c=l+1,u=t.plotX,d=t.plotY,h=e[n-1],p=e[n+1];if(n&&e.length-1>n){var f,g=h.plotX,m=h.plotY,v=p.plotX,b=p.plotY;i=(l*u+g)/c,r=(l*d+m)/c,o=(l*u+v)/c,a=(l*d+b)/c,f=(a-r)*(o-u)/(o-i)+d-a,r+=f,a+=f,r>m&&r>d?(r=mt(m,d),a=2*d-r):m>r&&d>r&&(r=vt(m,d),a=2*d-r),a>b&&a>d?(a=mt(b,d),r=2*d-a):b>a&&d>a&&(a=vt(b,d),r=2*d-a),t.rightContX=o,t.rightContY=a}return n?(s=["C",h.rightContX||h.plotX,h.rightContY||h.plotY,i||u,r||d,u,d],h.rightContX=h.rightContY=null):s=[Wt,u,d],s}});un.spline=Kn,In.areaspline=yn(In.area);var Wn=$n.prototype,qn=m(Kn,{type:"areaspline",getSegmentPath:Wn.getSegmentPath,drawGraph:Wn.drawGraph});un.areaspline=qn,In.column=yn(Rn,{borderColor:"#FFFFFF",borderWidth:1,borderRadius:0,groupPadding:.2,marker:null,pointPadding:.1,minPointLength:0,cropThreshold:50,pointRange:null,states:{hover:{brightness:.1,shadow:!1},select:{color:"#C0C0C0",borderColor:"#000000",shadow:!1}},dataLabels:{y:null,verticalAlign:null},threshold:0});var Un=m(zn,{type:"column",tooltipOutsidePlot:!0,pointAttrToOptions:{stroke:"borderColor","stroke-width":"borderWidth",fill:"color",r:"borderRadius"},init:function(){zn.prototype.init.apply(this,arguments);var e=this,t=e.chart;t.hasRendered&&gn(t.series,function(t){t.type===e.type&&(t.isDirty=!0)})},translate:function(){var t,n,i=this,r=i.chart,o=i.options,a=o.stacking,s=o.borderWidth,l=0,c=i.xAxis,d=c.reversed,h={};zn.prototype.translate.apply(i),gn(r.series,function(e){e.type===i.type&&e.visible&&i.options.group===e.options.group&&(e.options.stacking?(t=e.stackKey,h[t]===W&&(h[t]=l++),n=h[t]):n=l++,e.columnIndex=n)});var f=i.points,g=bt(c.transA)*(c.ordinalSlope||o.pointRange||c.closestPointRange||1),m=g*o.groupPadding,v=g-2*m,b=v/l,y=o.pointWidth,x=u(y)?(b-y)/2:b*o.pointPadding,k=p(y,b-2*x),w=gt(mt(k,1+2*s)),_=(d?l-i.columnIndex:i.columnIndex)||0,C=x+(m+_*b-g/2)*(d?-1:1),T=o.threshold,E=i.yAxis.getThreshold(T),S=p(o.minPointLength,5);gn(f,function(t){var n,o=t.plotY,l=p(t.yBottom,E),c=t.plotX+C,u=gt(vt(o,l)),d=gt(mt(o,l)-u),h=i.yAxis.stacks[(0>t.y?"-":"")+i.stackKey];a&&i.visible&&h&&h[t.x]&&h[t.x].setOffset(C,w),S>bt(d)&&S&&(d=S,u=bt(u-E)>S?l-S:E-(E>=o?S:0)),e(t,{barX:c,barY:u,barW:w,barH:d,pointWidth:k}),t.shapeType="rect",t.shapeArgs=n=r.renderer.Element.prototype.crisp.call(0,s,c,u,w,d),s%2&&(n.y-=1,n.height+=1),t.trackerArgs=3>bt(d)&&yn(t.shapeArgs,{height:6,y:u-3})})},getSymbol:function(){},drawLegendSymbol:$n.prototype.drawLegendSymbol,drawGraph:function(){},drawPoints:function(){var e,t,n=this,i=n.options,r=n.chart.renderer;gn(n.points,function(o){var a=o.plotY;a===W||isNaN(a)||null===o.y||(e=o.graphic,t=o.shapeArgs,e?(Tn(e),e.animate(yn(t))):o.graphic=e=r[o.shapeType](t).attr(o.pointAttr[o.selected?Xt:Vt]).add(n.group).shadow(i.shadow,null,i.stacking&&!i.borderRadius))})},drawTracker:function(){var e,t,n,i,r,o=this,a=o.chart,s=a.renderer,l=+new Date,c=o.options,u=c.cursor,h=u&&{cursor:u},p=o.drawTrackerGroup();gn(o.points,function(u){t=u.tracker,e=u.trackerArgs||u.shapeArgs,i=u.plotY,r=!o.isCartesian||i!==W&&!isNaN(i),delete e.strokeWidth,null!==u.y&&r&&(t?t.attr(e):u.tracker=s[u.shapeType](e).attr({isTracker:l,fill:Ut,visibility:o.visible?Ht:jt}).on(Lt?"touchstart":"mouseover",function(e){n=e.relatedTarget||e.fromElement,a.hoverSeries!==o&&d(n,"isTracker")!==l&&o.onMouseOver(),u.onMouseOver()}).on("mouseout",function(e){c.stickyTracking||(n=e.relatedTarget||e.toElement,d(n,"isTracker")!==l&&o.onMouseOut())}).css(h).add(u.group||p))})},animate:function(e){var t=this,n=t.points,i=t.options;e||(gn(n,function(e){var n=e.graphic,r=e.shapeArgs,o=t.yAxis,a=i.threshold;n&&(n.attr({height:0,y:u(a)?o.getThreshold(a):o.translate(o.getExtremes().min,0,1,0,1)}),n.animate({height:r.height,y:r.y},i.animation))}),t.animate=null)},remove:function(){var e=this,t=e.chart;t.hasRendered&&gn(t.series,function(t){t.type===e.type&&(t.isDirty=!0)}),zn.prototype.remove.apply(e,arguments)}});un.column=Un,In.bar=yn(In.column,{dataLabels:{align:"left",x:5,y:null,verticalAlign:"middle"}});var Vn=m(Un,{type:"bar",inverted:!0});un.bar=Vn,In.scatter=yn(Rn,{lineWidth:0,states:{hover:{lineWidth:0}},tooltip:{headerFormat:'<span style="font-size: 10px; color:{series.color}">{series.name}</span><br/>',pointFormat:"x: <b>{point.x}</b><br/>y: <b>{point.y}</b><br/>"}});var Gn=m(zn,{type:"scatter",sorted:!1,translate:function(){var e=this;zn.prototype.translate.apply(e),gn(e.points,function(t){t.shapeType="circle",t.shapeArgs={x:t.plotX,y:t.plotY,r:e.chart.options.tooltip.snap}})},drawTracker:function(){for(var e,t=this,n=t.options.cursor,i=n&&{cursor:n},r=t.points,o=r.length;o--;)e=r[o].graphic,e&&(e.element._i=o);t._hasTracking?t._hasTracking=!0:t.group.attr({isTracker:!0}).on(Lt?"touchstart":"mouseover",function(e){t.onMouseOver(),e.target._i!==W&&r[e.target._i].onMouseOver()}).on("mouseout",function(){t.options.stickyTracking||t.onMouseOut()}).css(i)}});un.scatter=Gn,In.pie=yn(Rn,{borderColor:"#FFFFFF",borderWidth:1,center:["50%","50%"],colorByPoint:!0,dataLabels:{distance:30,enabled:!0,formatter:function(){return this.point.name},y:5},legendType:"point",marker:null,size:"75%",showInLegend:!1,slicedOffset:10,states:{hover:{brightness:.1,shadow:!1}}});var Xn=m(jn,{init:function(){jn.prototype.init.apply(this,arguments);var t,n=this;return e(n,{visible:n.visible!==!1,name:p(n.name,"Slice")}),t=function(){n.slice()},xn(n,"select",t),xn(n,"unselect",t),n},setVisible:function(e){var t,n=this,i=n.series.chart,r=n.tracker,o=n.dataLabel,a=n.connector,s=n.shadowGroup;n.visible=e=e===W?!n.visible:e,t=e?"show":"hide",n.group[t](),r&&r[t](),o&&o[t](),a&&a[t](),s&&s[t](),n.legendItem&&i.legend.colorizeItem(n,e)},slice:function(e,t,n){var i,r=this,o=r.series,a=o.chart,s=r.slicedTranslation;R(n,a),t=p(t,!0),e=r.sliced=u(e)?e:!r.sliced,i={translateX:e?s[0]:a.plotLeft,translateY:e?s[1]:a.plotTop},r.group.animate(i),r.shadowGroup&&r.shadowGroup.animate(i)}}),Yn={type:"pie",isCartesian:!1,pointClass:Xn,pointAttrToOptions:{stroke:"borderColor","stroke-width":"borderWidth",fill:"color"},getColor:function(){this.initialColor=this.chart.counters.color},animate:function(){var e=this,t=e.points;gn(t,function(t){var n=t.graphic,i=t.shapeArgs,r=-kt/2;n&&(n.attr({r:0,start:r,end:r}),n.animate({r:i.r,start:i.start,end:i.end},e.options.animation))}),e.animate=null},setData:function(e,t){zn.prototype.setData.call(this,e,!1),this.processData(),this.generatePoints(),p(t,!0)&&this.chart.redraw()},getCenter:function(){var e,t=this.options,i=this.chart,r=i.plotWidth,o=i.plotHeight,a=t.center.concat([t.size,t.innerSize||0]),s=vt(r,o);return bn(a,function(t,i){return e=/%$/.test(t),e?[r,o,s,s][i]*n(t)/100:t})},translate:function(){this.generatePoints();var e,t,n,i,r,o,a,s=0,l=this,c=-.25,u=1e3,d=l.options,h=d.slicedOffset,p=h+d.borderWidth,f=l.chart,g=l.points,m=2*kt,v=d.dataLabels.distance;l.center=e=l.getCenter(),l.getX=function(t,n){return i=ht.asin((t-e[1])/(e[2]/2+v)),e[0]+(n?-1:1)*yt(i)*(e[2]/2+v)},gn(g,function(e){s+=e.y}),gn(g,function(l){r=s?l.y/s:0,t=pt(c*m*u)/u,c+=r,n=pt(c*m*u)/u,l.shapeType="arc",l.shapeArgs={x:e[0],y:e[1],r:e[2]/2,innerR:e[3]/2,start:t,end:n},i=(n+t)/2,l.slicedTranslation=bn([yt(i)*h+f.plotLeft,xt(i)*h+f.plotTop],pt),o=yt(i)*e[2]/2,a=xt(i)*e[2]/2,l.tooltipPos=[e[0]+.7*o,e[1]+.7*a],l.labelPos=[e[0]+o+yt(i)*v,e[1]+a+xt(i)*v,e[0]+o+yt(i)*p,e[1]+a+xt(i)*p,e[0]+o,e[1]+a,0>v?"center":m/4>i?"left":"right",i],l.percentage=100*r,l.total=s}),this.setTooltipPoints()},render:function(){var e=this;e.getAttribs(),this.drawPoints(),e.options.enableMouseTracking!==!1&&e.drawTracker(),this.drawDataLabels(),e.options.animation&&e.animate&&e.animate(),e.isDirty=!1},drawPoints:function(){var t,n,i,r,o,a=this,s=a.chart,l=s.renderer,c=a.options.shadow;gn(a.points,function(u){n=u.graphic,o=u.shapeArgs,i=u.group,r=u.shadowGroup,c&&!r&&(r=u.shadowGroup=l.g("shadow").attr({zIndex:4}).add()),i||(i=u.group=l.g("point").attr({zIndex:5}).add()),t=u.sliced?u.slicedTranslation:[s.plotLeft,s.plotTop],i.translate(t[0],t[1]),r&&r.translate(t[0],t[1]),n?n.animate(o):u.graphic=n=l.arc(o).setRadialReference(a.center).attr(e(u.pointAttr[Vt],{"stroke-linejoin":"round"})).add(u.group).shadow(c,r),u.visible===!1&&u.setVisible(!1)})},drawDataLabels:function(){var e,t,n,i,r,o,a,s,l,c,u,d,h=this,f=h.data,g=h.chart,m=h.options.dataLabels,v=p(m.connectorPadding,10),b=p(m.connectorWidth,1),y=p(m.softConnector,!0),x=m.distance,k=h.center,w=k[2]/2,_=k[1],C=x>0,T=[[],[]],E=2;if(m.enabled)for(zn.prototype.drawDataLabels.apply(h),gn(f,function(e){e.dataLabel&&T[kt/2>e.labelPos[7]?0:1].push(e)}),T[1].reverse(),u=function(e,t){return t.y-e.y},o=T[0][0]&&T[0][0].dataLabel&&(T[0][0].dataLabel.getBBox().height||21);E--;){var S,A,D,I=[],R=[],L=T[E],O=L.length;if(x>0){for(A=_-w-x;_+w+x>=A;A+=o)I.push(A);if(S=I.length,O>S){for(c=[].concat(L),c.sort(u),d=O;d--;)c[d].rank=d;for(d=O;d--;)L[d].rank>=S&&L.splice(d,1);O=L.length}for(d=0;O>d;d++){e=L[d],r=e.labelPos;var F,N,P=9999;for(N=0;S>N;N++)F=bt(I[N]-r[1]),P>F&&(P=F,D=N);if(d>D&&null!==I[d])D=d;else if(O-d+D>S&&null!==I[d])for(D=S-O+d;null===I[D];)D++;else for(;null===I[D];)D++;R.push({i:D,y:I[D]}),I[D]=null}R.sort(u)}for(d=0;O>d;d++){var M,B;e=L[d],r=e.labelPos,i=e.dataLabel,l=e.visible===!1?jt:Ht,B=r[1],x>0?(M=R.pop(),D=M.i,s=M.y,(B>s&&null!==I[D+1]||s>B&&null!==I[D-1])&&(s=B)):s=B,a=m.justify?k[0]+(E?-1:1)*(w+x):h.getX(0===D||D===I.length-1?B:s,E),i.attr({visibility:l,align:r[6]})[i.moved?"animate":"attr"]({x:a+m.x+({left:v,right:-v}[r[6]]||0),y:s+m.y}),i.moved=!0,C&&b&&(t=e.connector,n=y?[Wt,a+("left"===r[6]?5:-5),s,"C",a,s,2*r[2]-r[4],2*r[3]-r[5],r[2],r[3],qt,r[4],r[5]]:[Wt,a+("left"===r[6]?5:-5),s,qt,r[2],r[3],qt,r[4],r[5]],t?(t.animate({d:n}),t.attr("visibility",l)):e.connector=t=h.chart.renderer.path(n).attr({"stroke-width":b,stroke:m.connectorColor||e.color||"#606060",visibility:l,zIndex:3}).translate(g.plotLeft,g.plotTop).add())}}},drawTracker:Un.prototype.drawTracker,drawLegendSymbol:$n.prototype.drawLegendSymbol,getSymbol:function(){}};Yn=m(zn,Yn),un.pie=Yn,e(Highcharts,{Axis:j,CanVGRenderer:Mn,Chart:K,Color:Ln,Legend:$,Point:jn,Tick:P,Tooltip:z,Renderer:q,Series:zn,SVGRenderer:On,VMLRenderer:Fn,dateFormat:G,pathAnim:Y,getOptions:F,hasBidiBug:It,numberFormat:b,seriesTypes:un,setOptions:O,addEvent:xn,removeEvent:kn,createElement:g,discardElement:A,css:f,each:gn,extend:e,map:bn,merge:yn,pick:p,splat:h,extendClass:m,pInt:n,product:"Highcharts",version:"2.2.5"})})();
ankitjamuar/cdnjs
ajax/libs/highcharts/2.2.5/highcharts.src.min.js
JavaScript
mit
116,052
OpenLayers.Strategy.Cluster=OpenLayers.Class(OpenLayers.Strategy,{distance:20,threshold:null,features:null,clusters:null,clustering:!1,resolution:null,activate:function(){var e=OpenLayers.Strategy.prototype.activate.call(this);return e&&this.layer.events.on({beforefeaturesadded:this.cacheFeatures,moveend:this.cluster,scope:this}),e},deactivate:function(){var e=OpenLayers.Strategy.prototype.deactivate.call(this);return e&&(this.clearCache(),this.layer.events.un({beforefeaturesadded:this.cacheFeatures,moveend:this.cluster,scope:this})),e},cacheFeatures:function(e){var t=!0;return this.clustering||(this.clearCache(),this.features=e.features,this.cluster(),t=!1),t},clearCache:function(){this.features=null},cluster:function(e){if((!e||e.zoomChanged)&&this.features){var t=this.layer.map.getResolution();if(t!=this.resolution||!this.clustersExist()){this.resolution=t;for(var i,n,r,s=[],o=0;this.features.length>o;++o)if(i=this.features[o],i.geometry){n=!1;for(var a=s.length-1;a>=0;--a)if(r=s[a],this.shouldCluster(r,i)){this.addToCluster(r,i),n=!0;break}n||s.push(this.createCluster(this.features[o]))}if(this.layer.removeAllFeatures(),s.length>0){if(this.threshold>1){var l=s.slice();s=[];for(var h,o=0,c=l.length;c>o;++o)h=l[o],h.attributes.count<this.threshold?Array.prototype.push.apply(s,h.cluster):s.push(h)}this.clustering=!0,this.layer.addFeatures(s),this.clustering=!1}this.clusters=s}}},clustersExist:function(){var e=!1;if(this.clusters&&this.clusters.length>0&&this.clusters.length==this.layer.features.length){e=!0;for(var t=0;this.clusters.length>t;++t)if(this.clusters[t]!=this.layer.features[t]){e=!1;break}}return e},shouldCluster:function(e,t){var i=e.geometry.getBounds().getCenterLonLat(),n=t.geometry.getBounds().getCenterLonLat(),r=Math.sqrt(Math.pow(i.lon-n.lon,2)+Math.pow(i.lat-n.lat,2))/this.resolution;return this.distance>=r},addToCluster:function(e,t){e.cluster.push(t),e.attributes.count+=1},createCluster:function(e){var t=e.geometry.getBounds().getCenterLonLat(),i=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(t.lon,t.lat),{count:1});return i.cluster=[e],i},CLASS_NAME:"OpenLayers.Strategy.Cluster"});
Xotic750/cdnjs
ajax/libs/openlayers/2.12/lib/OpenLayers/Strategy/Cluster.min.js
JavaScript
mit
2,154
OpenLayers.Lang.en={unhandledRequest:"Unhandled request return ${statusText}",Permalink:"Permalink",Overlays:"Overlays","Base Layer":"Base Layer",readNotImplemented:"Read not implemented.",writeNotImplemented:"Write not implemented.",noFID:"Can't update a feature for which there is no FID.",errorLoadingGML:"Error in loading GML file ${url}",browserNotSupported:"Your browser does not support vector rendering. Currently supported renderers are:\n${renderers}",componentShouldBe:"addFeatures : component should be an ${geomType}",getFeatureError:"getFeatureFromEvent called on layer with no renderer. This usually means you destroyed a layer, but not some handler which is associated with it.",minZoomLevelError:"The minZoomLevel property is only intended for use with the FixedZoomLevels-descendent layers. That this wfs layer checks for minZoomLevel is a relic of thepast. We cannot, however, remove it without possibly breaking OL based applications that may depend on it. Therefore we are deprecating it -- the minZoomLevel check below will be removed at 3.0. Please instead use min/max resolution setting as described here: http://trac.openlayers.org/wiki/SettingZoomLevels",commitSuccess:"WFS Transaction: SUCCESS ${response}",commitFailed:"WFS Transaction: FAILED ${response}",googleWarning:"The Google Layer was unable to load correctly.<br><br>To get rid of this message, select a new BaseLayer in the layer switcher in the upper-right corner.<br><br>Most likely, this is because the Google Maps library script was either not included, or does not contain the correct API key for your site.<br><br>Developers: For help getting this working correctly, <a href='http://trac.openlayers.org/wiki/Google' target='_blank'>click here</a>",getLayerWarning:"The ${layerType} Layer was unable to load correctly.<br><br>To get rid of this message, select a new BaseLayer in the layer switcher in the upper-right corner.<br><br>Most likely, this is because the ${layerLib} library script was not correctly included.<br><br>Developers: For help getting this working correctly, <a href='http://trac.openlayers.org/wiki/${layerLib}' target='_blank'>click here</a>","Scale = 1 : ${scaleDenom}":"Scale = 1 : ${scaleDenom}",W:"W",E:"E",N:"N",S:"S",Graticule:"Graticule",layerAlreadyAdded:"You tried to add the layer: ${layerName} to the map, but it has already been added",reprojectDeprecated:"You are using the 'reproject' option on the ${layerName} layer. This option is deprecated: its use was designed to support displaying data over commercial basemaps, but that functionality should now be achieved by using Spherical Mercator support. More information is available from http://trac.openlayers.org/wiki/SphericalMercator.",methodDeprecated:"This method has been deprecated and will be removed in 3.0. Please use ${newMethod} instead.",boundsAddError:"You must pass both x and y values to the add function.",lonlatAddError:"You must pass both lon and lat values to the add function.",pixelAddError:"You must pass both x and y values to the add function.",unsupportedGeometryType:"Unsupported geometry type: ${geomType}",filterEvaluateNotImplemented:"evaluate is not implemented for this filter type.",proxyNeeded:"You probably need to set OpenLayers.ProxyHost to access ${url}.See http://trac.osgeo.org/openlayers/wiki/FrequentlyAskedQuestions#ProxyHost",end:""};
redmunds/cdnjs
ajax/libs/openlayers/2.11/lib/OpenLayers/Lang/en.min.js
JavaScript
mit
3,360
(function(e,t,n){"use strict";Foundation.libs.section={name:"section",version:"4.1.2",settings:{deep_linking:!1,one_up:!0,callback:function(){}},init:function(e,t,n){return Foundation.inherit(this,"throttle data_options position_right offset_right"),"string"!=typeof t?(this.set_active_from_hash(),this.events(),!0):this[t].call(this,n)},events:function(){var i=this;e(this.scope).on("click.fndtn.section","[data-section] .title, [data-section] [data-section-title]",function(t){var n=e(this);n.closest("[data-section]"),i.toggle_active.call(this,t,i)}),e(t).on("resize.fndtn.section",i.throttle(function(){i.resize.call(this)},30)).on("hashchange",function(){i.settings.toggled||(i.set_active_from_hash(),e(this).trigger("resize"))}).trigger("resize"),e(n).on("click.fndtn.section",function(t){1>e(t.target).closest(".title, [data-section-title]").length&&e('[data-section="vertical-nav"], [data-section="horizontal-nav"]').find("section, .section, [data-section-region]").removeClass("active").attr("style","")})},toggle_active:function(t,n){var i=e(this),r=i.closest("section, .section, [data-section-region]"),o=r.find(".content, [data-section-content]"),a=r.closest("[data-section]"),n=Foundation.libs.section,s=e.extend({},n.settings,n.data_options(a));if(n.settings.toggled=!0,!s.deep_linking&&o.length>0&&t.preventDefault(),r.hasClass("active"))(n.small(a)||n.is_vertical(a)||n.is_horizontal(a)||n.is_accordion(a))&&r.removeClass("active").attr("style","");else{var l=null,c=n.outerHeight(r.find(".title, [data-section-title]"));(n.small(a)||s.one_up)&&(l=i.closest("[data-section]").find("section.active, .section.active, .active[data-section-region]"),n.small(a)?l.attr("style",""):l.attr("style","visibility: hidden; padding-top: "+c+"px;")),n.small(a)?r.attr("style",""):r.css("padding-top",c),r.addClass("active"),null!==l&&l.removeClass("active").attr("style","")}setTimeout(function(){n.settings.toggled=!1},300),s.callback()},resize:function(){var t=e("[data-section]"),n=Foundation.libs.section;t.each(function(){var t=e(this),i=t.find("section.active, .section.active, .active[data-section-region]"),r=e.extend({},n.settings,n.data_options(t));if(i.length>1)i.not(":first").removeClass("active").attr("style","");else if(1>i.length&&!n.is_vertical(t)&&!n.is_horizontal(t)&&!n.is_accordion(t)){var o=t.find("section, .section, [data-section-region]").first();r.one_up&&o.addClass("active"),n.small(t)?o.attr("style",""):o.css("padding-top",n.outerHeight(o.find(".title, [data-section-title]")))}n.small(t)?i.attr("style",""):i.css("padding-top",n.outerHeight(i.find(".title, [data-section-title]"))),n.position_titles(t),n.is_horizontal(t)&&!n.small(t)?n.position_content(t):n.position_content(t,!1)})},is_vertical:function(e){return/vertical-nav/i.test(e.data("section"))},is_horizontal:function(e){return/horizontal-nav/i.test(e.data("section"))},is_accordion:function(e){return/accordion/i.test(e.data("section"))},is_tabs:function(e){return/tabs/i.test(e.data("section"))},set_active_from_hash:function(){var n=t.location.hash.substring(1),i=e("[data-section]"),r=this;i.each(function(){var t=e(this),i=e.extend({},r.settings,r.data_options(t));n.length>0&&i.deep_linking&&(t.find("section, .section, [data-section-region]").attr("style","").removeClass("active"),t.find('.content[data-slug="'+n+'"], [data-section-content][data-slug="'+n+'"]').closest("section, .section, [data-section-region]").addClass("active"))})},position_titles:function(t,n){var i=t.find(".title, [data-section-title]"),r=0,o=this;"boolean"==typeof n?i.attr("style",""):i.each(function(){o.rtl?e(this).css("right",r):e(this).css("left",r),r+=o.outerWidth(e(this))})},position_content:function(t,n){var i=t.find(".title, [data-section-title]"),r=t.find(".content, [data-section-content]"),o=this;"boolean"==typeof n?(r.attr("style",""),t.attr("style","")):(t.find("section, .section, [data-section-region]").each(function(){var t=e(this).find(".title, [data-section-title]"),n=e(this).find(".content, [data-section-content]");o.rtl?n.css({right:o.position_right(t)+1,top:o.outerHeight(t)-2}):n.css({left:t.position().left-1,top:o.outerHeight(t)-2})}),"function"==typeof Zepto?t.height(this.outerHeight(i.first())):t.height(this.outerHeight(i.first())-2))},position_right:function(e){var t=e.closest("[data-section]"),n=e.closest("[data-section]").width(),i=t.find(".title, [data-section-title]").length;return n-e.position().left-e.width()*(e.index()+1)-i},reflow:function(){e("[data-section]").trigger("resize")},small:function(t){return e.extend({},this.settings,this.data_options(t)),this.is_tabs(t)?!1:t&&this.is_accordion(t)?!0:e("html").hasClass("lt-ie9")?!0:e("html").hasClass("ie8compat")?!0:768>e(this.scope).width()},off:function(){e(this.scope).off(".fndtn.section"),e(t).off(".fndtn.section"),e(n).off(".fndtn.section")}}})(Foundation.zj,this,this.document);
luislobo/cdnjs
ajax/libs/foundation/4.1.2/js/foundation/foundation.section.min.js
JavaScript
mit
4,865
/* ------------------------------ clean blue ------------------------------ */ .cleanbluewarning .cleanblue{ background-color: #acb4c4; } .cleanbluefade{ position: absolute; background-color: #aaaaaa; } div.cleanblue{ font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; position: absolute; background-color: #ffffff; width: 300px; font-size: 11px; text-align: left; border: solid 1px #213e80; } div.cleanblue .cleanbluecontainer{ background-color: #ffffff; border-top: solid 14px #213e80; padding: 5px; font-weight: bold; } div.cleanblue .cleanblueclose{ float: right; width: 18px; cursor: default; margin: -19px -12px 0 0; color: #ffffff; font-weight: bold; } div.cleanblue .cleanbluemessage{ padding: 10px; line-height: 20px; font-size: 11px; color: #333333; } div.cleanblue .cleanbluebuttons{ text-align: right; padding: 5px 0 5px 0; border: solid 1px #eeeeee; background-color: #f4f4f4; } div.cleanblue button{ padding: 3px 10px; margin: 0 10px; background-color: #314e90; border: solid 1px #f4f4f4; color: #ffffff; font-weight: bold; font-size: 12px; } div.cleanblue button:hover{ border: solid 1px #d4d4d4; }
boneskull/cdnjs
ajax/libs/jquery-impromptu/5.2.3/themes/clean-blue.css
CSS
mit
1,160
/*! * VERSION: beta 0.1.1 * DATE: 2013-03-25 * JavaScript * UPDATES AND DOCS AT: http://www.greensock.com * * @license Copyright (c) 2008-2013, GreenSock. All rights reserved. * This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for * Club GreenSock members, the software agreement that was issued with your membership. * * @author: Jack Doyle, jack@greensock.com **/ (window._gsQueue||(window._gsQueue=[])).push(function(){"use strict";window._gsDefine.plugin({propName:"directionalRotation",API:2,init:function(a,b){"object"!=typeof b&&(b={rotation:b}),this.finals={};var e,f,g,h,i,j,k,d=b.useRadians===!0?2*Math.PI:360;for(e in b)"useRadians"!==e&&(j=(b[e]+"").split("_"),f=j[0],k=j[1],g=parseFloat("function"!=typeof a[e]?a[e]:a[e.indexOf("set")||"function"!=typeof a["get"+e.substr(3)]?e:"get"+e.substr(3)]()),h=this.finals[e]="string"==typeof f&&"="===f.charAt(1)?g+parseInt(f.charAt(0)+"1",10)*Number(f.substr(2)):Number(f)||0,i=h-g,"short"===k?(i%=d,i!==i%(d/2)&&(i=0>i?i+d:i-d)):"cw"===k&&0>i?i=(i+9999999999*d)%d-(0|i/d)*d:"ccw"===k&&i>0&&(i=(i-9999999999*d)%d-(0|i/d)*d),this._addTween(a,e,g,g+i,e),this._overwriteProps.push(e));return!0},set:function(a){var b;if(1!==a)this._super.setRatio.call(this,a);else for(b=this._firstPT;b;)b.f?b.t[b.p](this.finals[b.p]):b.t[b.p]=this.finals[b.p],b=b._next}})._autoCSS=!0}),window._gsDefine&&window._gsQueue.pop()();
lxsli/cdnjs
ajax/libs/gsap/1.9.4/plugins/DirectionalRotationPlugin.min.js
JavaScript
mit
1,415
<?php /* * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ namespace Doctrine\ORM\Query\Expr; /** * Expression class for generating DQL functions. * * @link www.doctrine-project.org * @since 2.0 * @author Guilherme Blanco <guilhermeblanco@hotmail.com> * @author Jonathan Wage <jonwage@gmail.com> * @author Roman Borschel <roman@code-factory.org> */ class Func { /** * @var string */ protected $name; /** * @var array */ protected $arguments; /** * Creates a function, with the given argument. * * @param string $name * @param array $arguments */ public function __construct($name, $arguments) { $this->name = $name; $this->arguments = (array) $arguments; } /** * @return string */ public function getName() { return $this->name; } /** * @return array */ public function getArguments() { return $this->arguments; } /** * @return string */ public function __toString() { return $this->name . '(' . implode(', ', $this->arguments) . ')'; } }
houhaitao/htshops
vendor/doctrine/orm/lib/Doctrine/ORM/Query/Expr/Func.php
PHP
mit
2,099
<?php /* * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ namespace Doctrine\ORM\Query\AST; /** * SelectStatement = SelectClause FromClause [WhereClause] [GroupByClause] [HavingClause] [OrderByClause] * * @link www.doctrine-project.org * @since 2.0 * @author Guilherme Blanco <guilhermeblanco@hotmail.com> * @author Jonathan Wage <jonwage@gmail.com> * @author Roman Borschel <roman@code-factory.org> */ class SelectStatement extends Node { /** * @var SelectClause */ public $selectClause; /** * @var FromClause */ public $fromClause; /** * @var WhereClause|null */ public $whereClause; /** * @var GroupByClause|null */ public $groupByClause; /** * @var HavingClause|null */ public $havingClause; /** * @var OrderByClause|null */ public $orderByClause; /** * @param SelectClause $selectClause * @param FromClause $fromClause */ public function __construct($selectClause, $fromClause) { $this->selectClause = $selectClause; $this->fromClause = $fromClause; } /** * {@inheritdoc} */ public function dispatch($sqlWalker) { return $sqlWalker->walkSelectStatement($this); } }
about-dev/sf_application_form
vendor/doctrine/orm/lib/Doctrine/ORM/Query/AST/SelectStatement.php
PHP
mit
2,216
/*! JavaScript Hooker - v0.2.3 - 1/29/2012 * http://github.com/cowboy/javascript-hooker * Copyright (c) 2012 "Cowboy" Ben Alman; Licensed MIT */ (function(a){function d(a){this.value=a}function e(a){this.value=a}function f(a,b){this.context=a,this.args=b}function g(a,b,d){var e;if(typeof b=="string")b=[b];else if(b==null){b=[];for(e in a)a.hasOwnProperty(e)&&b.push(e)}var f=b.length;while(f--)(c.call(a[b[f]])!=="[object Function]"||d(a,b[f])===!1)&&b.splice(f,1);return b}var b=[].slice,c={}.toString;a.override=function(a){return new d(a)},a.preempt=function(a){return new e(a)},a.filter=function(a,b){return new f(a,b)},a.hook=function(c,h,i){return i==null&&(i=h,h=null),typeof i=="function"&&(i={pre:i}),g(c,h,function(c,g){function j(){var j,k,l,m=b.call(arguments);return i.passName&&m.unshift(g),i.pre&&(j=i.pre.apply(this,m)),j instanceof f?k=j=h.apply(j.context,j.args):j instanceof e?k=j=j.value:(k=h.apply(this,arguments),j=j instanceof d?j.value:k),i.post&&(l=i.post.apply(this,[k].concat(m)),l instanceof d&&(j=l.value)),i.once&&a.unhook(c,g),j}var h=c[g];c[g]=j;if(c[g]!==j)return!1;c[g]._orig=h})},a.orig=function(a,b){return a[b]._orig},a.unhook=function(b,c){return g(b,c,function(b,c){var d=a.orig(b,c);if(!d)return!1;b[c]=d})}})(typeof exports=="object"&&exports||this)
infsci2560sp16/full-stack-web-project-ruinan
node_modules/hooker/dist/ba-hooker.min.js
JavaScript
mit
1,292
// mksysctl_openbsd.pl // MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT package unix type mibentry struct { ctlname string ctloid []_C_int } var sysctlMib = []mibentry{ {"ddb.console", []_C_int{9, 6}}, {"ddb.log", []_C_int{9, 7}}, {"ddb.max_line", []_C_int{9, 3}}, {"ddb.max_width", []_C_int{9, 2}}, {"ddb.panic", []_C_int{9, 5}}, {"ddb.radix", []_C_int{9, 1}}, {"ddb.tab_stop_width", []_C_int{9, 4}}, {"ddb.trigger", []_C_int{9, 8}}, {"fs.posix.setuid", []_C_int{3, 1, 1}}, {"hw.allowpowerdown", []_C_int{6, 22}}, {"hw.byteorder", []_C_int{6, 4}}, {"hw.cpuspeed", []_C_int{6, 12}}, {"hw.diskcount", []_C_int{6, 10}}, {"hw.disknames", []_C_int{6, 8}}, {"hw.diskstats", []_C_int{6, 9}}, {"hw.machine", []_C_int{6, 1}}, {"hw.model", []_C_int{6, 2}}, {"hw.ncpu", []_C_int{6, 3}}, {"hw.ncpufound", []_C_int{6, 21}}, {"hw.pagesize", []_C_int{6, 7}}, {"hw.physmem", []_C_int{6, 19}}, {"hw.product", []_C_int{6, 15}}, {"hw.serialno", []_C_int{6, 17}}, {"hw.setperf", []_C_int{6, 13}}, {"hw.usermem", []_C_int{6, 20}}, {"hw.uuid", []_C_int{6, 18}}, {"hw.vendor", []_C_int{6, 14}}, {"hw.version", []_C_int{6, 16}}, {"kern.arandom", []_C_int{1, 37}}, {"kern.argmax", []_C_int{1, 8}}, {"kern.boottime", []_C_int{1, 21}}, {"kern.bufcachepercent", []_C_int{1, 72}}, {"kern.ccpu", []_C_int{1, 45}}, {"kern.clockrate", []_C_int{1, 12}}, {"kern.consdev", []_C_int{1, 75}}, {"kern.cp_time", []_C_int{1, 40}}, {"kern.cp_time2", []_C_int{1, 71}}, {"kern.cryptodevallowsoft", []_C_int{1, 53}}, {"kern.domainname", []_C_int{1, 22}}, {"kern.file", []_C_int{1, 73}}, {"kern.forkstat", []_C_int{1, 42}}, {"kern.fscale", []_C_int{1, 46}}, {"kern.fsync", []_C_int{1, 33}}, {"kern.hostid", []_C_int{1, 11}}, {"kern.hostname", []_C_int{1, 10}}, {"kern.intrcnt.nintrcnt", []_C_int{1, 63, 1}}, {"kern.job_control", []_C_int{1, 19}}, {"kern.malloc.buckets", []_C_int{1, 39, 1}}, {"kern.malloc.kmemnames", []_C_int{1, 39, 3}}, {"kern.maxclusters", []_C_int{1, 67}}, {"kern.maxfiles", []_C_int{1, 7}}, {"kern.maxlocksperuid", []_C_int{1, 70}}, {"kern.maxpartitions", []_C_int{1, 23}}, {"kern.maxproc", []_C_int{1, 6}}, {"kern.maxthread", []_C_int{1, 25}}, {"kern.maxvnodes", []_C_int{1, 5}}, {"kern.mbstat", []_C_int{1, 59}}, {"kern.msgbuf", []_C_int{1, 48}}, {"kern.msgbufsize", []_C_int{1, 38}}, {"kern.nchstats", []_C_int{1, 41}}, {"kern.netlivelocks", []_C_int{1, 76}}, {"kern.nfiles", []_C_int{1, 56}}, {"kern.ngroups", []_C_int{1, 18}}, {"kern.nosuidcoredump", []_C_int{1, 32}}, {"kern.nprocs", []_C_int{1, 47}}, {"kern.nselcoll", []_C_int{1, 43}}, {"kern.nthreads", []_C_int{1, 26}}, {"kern.numvnodes", []_C_int{1, 58}}, {"kern.osrelease", []_C_int{1, 2}}, {"kern.osrevision", []_C_int{1, 3}}, {"kern.ostype", []_C_int{1, 1}}, {"kern.osversion", []_C_int{1, 27}}, {"kern.pool_debug", []_C_int{1, 77}}, {"kern.posix1version", []_C_int{1, 17}}, {"kern.proc", []_C_int{1, 66}}, {"kern.random", []_C_int{1, 31}}, {"kern.rawpartition", []_C_int{1, 24}}, {"kern.saved_ids", []_C_int{1, 20}}, {"kern.securelevel", []_C_int{1, 9}}, {"kern.seminfo", []_C_int{1, 61}}, {"kern.shminfo", []_C_int{1, 62}}, {"kern.somaxconn", []_C_int{1, 28}}, {"kern.sominconn", []_C_int{1, 29}}, {"kern.splassert", []_C_int{1, 54}}, {"kern.stackgap_random", []_C_int{1, 50}}, {"kern.sysvipc_info", []_C_int{1, 51}}, {"kern.sysvmsg", []_C_int{1, 34}}, {"kern.sysvsem", []_C_int{1, 35}}, {"kern.sysvshm", []_C_int{1, 36}}, {"kern.timecounter.choice", []_C_int{1, 69, 4}}, {"kern.timecounter.hardware", []_C_int{1, 69, 3}}, {"kern.timecounter.tick", []_C_int{1, 69, 1}}, {"kern.timecounter.timestepwarnings", []_C_int{1, 69, 2}}, {"kern.tty.maxptys", []_C_int{1, 44, 6}}, {"kern.tty.nptys", []_C_int{1, 44, 7}}, {"kern.tty.tk_cancc", []_C_int{1, 44, 4}}, {"kern.tty.tk_nin", []_C_int{1, 44, 1}}, {"kern.tty.tk_nout", []_C_int{1, 44, 2}}, {"kern.tty.tk_rawcc", []_C_int{1, 44, 3}}, {"kern.tty.ttyinfo", []_C_int{1, 44, 5}}, {"kern.ttycount", []_C_int{1, 57}}, {"kern.userasymcrypto", []_C_int{1, 60}}, {"kern.usercrypto", []_C_int{1, 52}}, {"kern.usermount", []_C_int{1, 30}}, {"kern.version", []_C_int{1, 4}}, {"kern.vnode", []_C_int{1, 13}}, {"kern.watchdog.auto", []_C_int{1, 64, 2}}, {"kern.watchdog.period", []_C_int{1, 64, 1}}, {"net.bpf.bufsize", []_C_int{4, 31, 1}}, {"net.bpf.maxbufsize", []_C_int{4, 31, 2}}, {"net.inet.ah.enable", []_C_int{4, 2, 51, 1}}, {"net.inet.ah.stats", []_C_int{4, 2, 51, 2}}, {"net.inet.carp.allow", []_C_int{4, 2, 112, 1}}, {"net.inet.carp.log", []_C_int{4, 2, 112, 3}}, {"net.inet.carp.preempt", []_C_int{4, 2, 112, 2}}, {"net.inet.carp.stats", []_C_int{4, 2, 112, 4}}, {"net.inet.divert.recvspace", []_C_int{4, 2, 258, 1}}, {"net.inet.divert.sendspace", []_C_int{4, 2, 258, 2}}, {"net.inet.divert.stats", []_C_int{4, 2, 258, 3}}, {"net.inet.esp.enable", []_C_int{4, 2, 50, 1}}, {"net.inet.esp.stats", []_C_int{4, 2, 50, 4}}, {"net.inet.esp.udpencap", []_C_int{4, 2, 50, 2}}, {"net.inet.esp.udpencap_port", []_C_int{4, 2, 50, 3}}, {"net.inet.etherip.allow", []_C_int{4, 2, 97, 1}}, {"net.inet.etherip.stats", []_C_int{4, 2, 97, 2}}, {"net.inet.gre.allow", []_C_int{4, 2, 47, 1}}, {"net.inet.gre.wccp", []_C_int{4, 2, 47, 2}}, {"net.inet.icmp.bmcastecho", []_C_int{4, 2, 1, 2}}, {"net.inet.icmp.errppslimit", []_C_int{4, 2, 1, 3}}, {"net.inet.icmp.maskrepl", []_C_int{4, 2, 1, 1}}, {"net.inet.icmp.rediraccept", []_C_int{4, 2, 1, 4}}, {"net.inet.icmp.redirtimeout", []_C_int{4, 2, 1, 5}}, {"net.inet.icmp.stats", []_C_int{4, 2, 1, 7}}, {"net.inet.icmp.tstamprepl", []_C_int{4, 2, 1, 6}}, {"net.inet.igmp.stats", []_C_int{4, 2, 2, 1}}, {"net.inet.ip.arpqueued", []_C_int{4, 2, 0, 36}}, {"net.inet.ip.encdebug", []_C_int{4, 2, 0, 12}}, {"net.inet.ip.forwarding", []_C_int{4, 2, 0, 1}}, {"net.inet.ip.ifq.congestion", []_C_int{4, 2, 0, 30, 4}}, {"net.inet.ip.ifq.drops", []_C_int{4, 2, 0, 30, 3}}, {"net.inet.ip.ifq.len", []_C_int{4, 2, 0, 30, 1}}, {"net.inet.ip.ifq.maxlen", []_C_int{4, 2, 0, 30, 2}}, {"net.inet.ip.maxqueue", []_C_int{4, 2, 0, 11}}, {"net.inet.ip.mforwarding", []_C_int{4, 2, 0, 31}}, {"net.inet.ip.mrtproto", []_C_int{4, 2, 0, 34}}, {"net.inet.ip.mrtstats", []_C_int{4, 2, 0, 35}}, {"net.inet.ip.mtu", []_C_int{4, 2, 0, 4}}, {"net.inet.ip.mtudisc", []_C_int{4, 2, 0, 27}}, {"net.inet.ip.mtudisctimeout", []_C_int{4, 2, 0, 28}}, {"net.inet.ip.multipath", []_C_int{4, 2, 0, 32}}, {"net.inet.ip.portfirst", []_C_int{4, 2, 0, 7}}, {"net.inet.ip.porthifirst", []_C_int{4, 2, 0, 9}}, {"net.inet.ip.porthilast", []_C_int{4, 2, 0, 10}}, {"net.inet.ip.portlast", []_C_int{4, 2, 0, 8}}, {"net.inet.ip.redirect", []_C_int{4, 2, 0, 2}}, {"net.inet.ip.sourceroute", []_C_int{4, 2, 0, 5}}, {"net.inet.ip.stats", []_C_int{4, 2, 0, 33}}, {"net.inet.ip.ttl", []_C_int{4, 2, 0, 3}}, {"net.inet.ipcomp.enable", []_C_int{4, 2, 108, 1}}, {"net.inet.ipcomp.stats", []_C_int{4, 2, 108, 2}}, {"net.inet.ipip.allow", []_C_int{4, 2, 4, 1}}, {"net.inet.ipip.stats", []_C_int{4, 2, 4, 2}}, {"net.inet.mobileip.allow", []_C_int{4, 2, 55, 1}}, {"net.inet.pfsync.stats", []_C_int{4, 2, 240, 1}}, {"net.inet.pim.stats", []_C_int{4, 2, 103, 1}}, {"net.inet.tcp.ackonpush", []_C_int{4, 2, 6, 13}}, {"net.inet.tcp.always_keepalive", []_C_int{4, 2, 6, 22}}, {"net.inet.tcp.baddynamic", []_C_int{4, 2, 6, 6}}, {"net.inet.tcp.drop", []_C_int{4, 2, 6, 19}}, {"net.inet.tcp.ecn", []_C_int{4, 2, 6, 14}}, {"net.inet.tcp.ident", []_C_int{4, 2, 6, 9}}, {"net.inet.tcp.keepidle", []_C_int{4, 2, 6, 3}}, {"net.inet.tcp.keepinittime", []_C_int{4, 2, 6, 2}}, {"net.inet.tcp.keepintvl", []_C_int{4, 2, 6, 4}}, {"net.inet.tcp.mssdflt", []_C_int{4, 2, 6, 11}}, {"net.inet.tcp.reasslimit", []_C_int{4, 2, 6, 18}}, {"net.inet.tcp.rfc1323", []_C_int{4, 2, 6, 1}}, {"net.inet.tcp.rfc3390", []_C_int{4, 2, 6, 17}}, {"net.inet.tcp.rstppslimit", []_C_int{4, 2, 6, 12}}, {"net.inet.tcp.sack", []_C_int{4, 2, 6, 10}}, {"net.inet.tcp.sackholelimit", []_C_int{4, 2, 6, 20}}, {"net.inet.tcp.slowhz", []_C_int{4, 2, 6, 5}}, {"net.inet.tcp.stats", []_C_int{4, 2, 6, 21}}, {"net.inet.tcp.synbucketlimit", []_C_int{4, 2, 6, 16}}, {"net.inet.tcp.syncachelimit", []_C_int{4, 2, 6, 15}}, {"net.inet.udp.baddynamic", []_C_int{4, 2, 17, 2}}, {"net.inet.udp.checksum", []_C_int{4, 2, 17, 1}}, {"net.inet.udp.recvspace", []_C_int{4, 2, 17, 3}}, {"net.inet.udp.sendspace", []_C_int{4, 2, 17, 4}}, {"net.inet.udp.stats", []_C_int{4, 2, 17, 5}}, {"net.inet6.divert.recvspace", []_C_int{4, 24, 86, 1}}, {"net.inet6.divert.sendspace", []_C_int{4, 24, 86, 2}}, {"net.inet6.divert.stats", []_C_int{4, 24, 86, 3}}, {"net.inet6.icmp6.errppslimit", []_C_int{4, 24, 30, 14}}, {"net.inet6.icmp6.mtudisc_hiwat", []_C_int{4, 24, 30, 16}}, {"net.inet6.icmp6.mtudisc_lowat", []_C_int{4, 24, 30, 17}}, {"net.inet6.icmp6.nd6_debug", []_C_int{4, 24, 30, 18}}, {"net.inet6.icmp6.nd6_delay", []_C_int{4, 24, 30, 8}}, {"net.inet6.icmp6.nd6_maxnudhint", []_C_int{4, 24, 30, 15}}, {"net.inet6.icmp6.nd6_mmaxtries", []_C_int{4, 24, 30, 10}}, {"net.inet6.icmp6.nd6_prune", []_C_int{4, 24, 30, 6}}, {"net.inet6.icmp6.nd6_umaxtries", []_C_int{4, 24, 30, 9}}, {"net.inet6.icmp6.nd6_useloopback", []_C_int{4, 24, 30, 11}}, {"net.inet6.icmp6.nodeinfo", []_C_int{4, 24, 30, 13}}, {"net.inet6.icmp6.rediraccept", []_C_int{4, 24, 30, 2}}, {"net.inet6.icmp6.redirtimeout", []_C_int{4, 24, 30, 3}}, {"net.inet6.ip6.accept_rtadv", []_C_int{4, 24, 17, 12}}, {"net.inet6.ip6.auto_flowlabel", []_C_int{4, 24, 17, 17}}, {"net.inet6.ip6.dad_count", []_C_int{4, 24, 17, 16}}, {"net.inet6.ip6.dad_pending", []_C_int{4, 24, 17, 49}}, {"net.inet6.ip6.defmcasthlim", []_C_int{4, 24, 17, 18}}, {"net.inet6.ip6.forwarding", []_C_int{4, 24, 17, 1}}, {"net.inet6.ip6.forwsrcrt", []_C_int{4, 24, 17, 5}}, {"net.inet6.ip6.hdrnestlimit", []_C_int{4, 24, 17, 15}}, {"net.inet6.ip6.hlim", []_C_int{4, 24, 17, 3}}, {"net.inet6.ip6.log_interval", []_C_int{4, 24, 17, 14}}, {"net.inet6.ip6.maxdynroutes", []_C_int{4, 24, 17, 48}}, {"net.inet6.ip6.maxfragpackets", []_C_int{4, 24, 17, 9}}, {"net.inet6.ip6.maxfrags", []_C_int{4, 24, 17, 41}}, {"net.inet6.ip6.maxifdefrouters", []_C_int{4, 24, 17, 47}}, {"net.inet6.ip6.maxifprefixes", []_C_int{4, 24, 17, 46}}, {"net.inet6.ip6.mforwarding", []_C_int{4, 24, 17, 42}}, {"net.inet6.ip6.mrtproto", []_C_int{4, 24, 17, 8}}, {"net.inet6.ip6.mtudisctimeout", []_C_int{4, 24, 17, 50}}, {"net.inet6.ip6.multicast_mtudisc", []_C_int{4, 24, 17, 44}}, {"net.inet6.ip6.multipath", []_C_int{4, 24, 17, 43}}, {"net.inet6.ip6.neighborgcthresh", []_C_int{4, 24, 17, 45}}, {"net.inet6.ip6.redirect", []_C_int{4, 24, 17, 2}}, {"net.inet6.ip6.rr_prune", []_C_int{4, 24, 17, 22}}, {"net.inet6.ip6.sourcecheck", []_C_int{4, 24, 17, 10}}, {"net.inet6.ip6.sourcecheck_logint", []_C_int{4, 24, 17, 11}}, {"net.inet6.ip6.use_deprecated", []_C_int{4, 24, 17, 21}}, {"net.inet6.ip6.v6only", []_C_int{4, 24, 17, 24}}, {"net.key.sadb_dump", []_C_int{4, 30, 1}}, {"net.key.spd_dump", []_C_int{4, 30, 2}}, {"net.mpls.ifq.congestion", []_C_int{4, 33, 3, 4}}, {"net.mpls.ifq.drops", []_C_int{4, 33, 3, 3}}, {"net.mpls.ifq.len", []_C_int{4, 33, 3, 1}}, {"net.mpls.ifq.maxlen", []_C_int{4, 33, 3, 2}}, {"net.mpls.mapttl_ip", []_C_int{4, 33, 5}}, {"net.mpls.mapttl_ip6", []_C_int{4, 33, 6}}, {"net.mpls.maxloop_inkernel", []_C_int{4, 33, 4}}, {"net.mpls.ttl", []_C_int{4, 33, 2}}, {"net.pflow.stats", []_C_int{4, 34, 1}}, {"net.pipex.enable", []_C_int{4, 35, 1}}, {"vm.anonmin", []_C_int{2, 7}}, {"vm.loadavg", []_C_int{2, 2}}, {"vm.maxslp", []_C_int{2, 10}}, {"vm.nkmempages", []_C_int{2, 6}}, {"vm.psstrings", []_C_int{2, 3}}, {"vm.swapencrypt.enable", []_C_int{2, 5, 0}}, {"vm.swapencrypt.keyscreated", []_C_int{2, 5, 1}}, {"vm.swapencrypt.keysdeleted", []_C_int{2, 5, 2}}, {"vm.uspace", []_C_int{2, 11}}, {"vm.uvmexp", []_C_int{2, 4}}, {"vm.vmmeter", []_C_int{2, 1}}, {"vm.vnodemin", []_C_int{2, 9}}, {"vm.vtextmin", []_C_int{2, 8}}, }
maddevsio/screen-monitoring
agents/ahrefs_native/vendor/golang.org/x/sys/unix/zsysctl_openbsd.go
GO
mit
11,986
// angular-formly version 5.1.2 built with ♥ by Astrism <astrisms@gmail.com>, Kent C. Dodds <kent@doddsfamily.us> (ó ì_í)=óò=(ì_í ò) !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("api-check"),require("angular")):"function"==typeof define&&define.amd?define(["api-check","angular"],t):"object"==typeof exports?exports.ngFormly=t(require("api-check"),require("angular")):e.ngFormly=t(e.apiCheck,e.angular)}(this,function(e,t){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";e.exports=n(10)},function(e,t,n){"use strict";var r=n(24);r.version||(r=window.angular),e.exports=r},function(e){"use strict";e.exports="https://github.com/formly-js/angular-formly/blob/5.1.2/other/ERRORS_AND_WARNINGS.md#"},function(e,t,n){"use strict";function r(e,t,n,r){return l.isFunction(t)?t(r||n,n,e):e.$eval(t,{$viewValue:r||n,$modelValue:n})}function o(e,t,n){var r=t.type;return!r&&t.template?r="template":!r&&t.templateUrl&&(r="templateUrl"),[e,r,t.key,n].join("_")}function i(e){l.forEach(arguments,function(t,n){n&&l.forEach(t,function(t,n){l.isDefined(e[n])?a(e[n],t)&&i(e[n],t):e[n]=l.copy(t)})})}function a(e,t){return l.isObject(e)&&l.isObject(t)&&Object.getPrototypeOf(e)===Object.getPrototypeOf(t)}function s(e,t){if(e.prop||(e=l.element(e)),e.prop("nodeName")===t.toUpperCase())return e;for(var n=e.children(),r=0;n&&r<n.length;r++){var o=s(n[r],t);if(o)return o}}var l=n(1);e.exports={formlyEval:r,getFieldId:o,reverseDeepMerge:i,findByNodeName:s}},function(t){t.exports=e},function(e){"use strict";e.exports=function(e){function t(e,t){function n(e){return e&&angular.isFunction(e.then)}function r(e){var t=["expression","message"],n={};if(angular.forEach(e,function(e,r){if(!angular.isString(e)){var o=[];angular.forEach(e,function(e,n){-1===t.indexOf(n)&&o.push(n)}),o.length&&(n[r]=o)}}),Object.keys(n).length)throw new Error(["Validators are only allowed to be functions or objects that have "+t.join(", ")+".","You provided some extra properties: "+JSON.stringify(n)].join(" "))}return{restrict:"A",require:"ngModel",link:function(o,i,a,s){var l=o.options;l.validators&&r(l.validators),l.validation.messages=l.validation.messages||{},angular.forEach(l.validation.messages,function(t,n){l.validation.messages[n]=function(){return e.formlyEval(o,t,s.$modelValue,s.$viewValue)}});var p=s.hasOwnProperty("$validators")&&!a.hasOwnProperty("useParsers");angular.forEach(l.validators,function(r,i){function a(){var a=c?"$asyncValidators":"$validators";s[a][i]=function(i,a){var s=e.formlyEval(o,r,i,a);return c?n(s)?s:s?t.when(s):t.reject(s):s}}function f(){var t=void 0;s.$parsers.unshift(function(a){var l=e.formlyEval(o,r,s.$modelValue,a);return n(l)?(s.$pending=s.$pending||{},s.$pending[i]=!0,t=l,l.then(function(){t===l&&s.$setValidity(i,!0)})["catch"](function(){t===l&&s.$setValidity(i,!1)})["finally"](function(){1===Object.keys(s.$pending).length?delete s.$pending:delete s.$pending[i]})):s.$setValidity(i,l),a})}var u=r.message;u&&(l.validation.messages[i]=function(){return e.formlyEval(o,u,s.$modelValue,s.$viewValue)}),r=angular.isObject(r)?r.expression:r;var c=!angular.isString(r);p?a():f()})}}}e.directive("formlyCustomValidation",t),t.tests=null,t.$inject=["formlyUtil","$q"]}},function(e,t,n){"use strict";var r=n(1);e.exports=function(e){function t(e,t,o,i,a,s,l,p,f,u){function c(e){var t=r.element("<a></a>");return t.append(e).html()}function d(e){var t=a.getType(e.type,!0,e),n=e.template||t&&t.template,r=e.templateUrl||t&&t.templateUrl;if(!n&&!r)throw f.getFieldError("type-type-has-no-template","Type '"+e.type+"' has not template. On element:",e);return m(n||r,!n)}function m(n,r){if(r){var o={cache:i};return e.get(n,o).then(function(e){return e.data})["catch"](function(e){u("problem-loading-template-for-templateurl","Problem loading template for "+n,e)})}return t.when(n)}function y(e){var n=g(e);return function(r){if(!n.length)return t.when(r);n.forEach(function(t){f.checkWrapper(t,e),t.validateOptions&&t.validateOptions(e),O(t,e)});var o=n.map(function(e){return m(e.template||e.templateUrl,!e.template)});return t.all(o).then(function(e){e.forEach(function(e,t){f.checkWrapperTemplate(e,n[t])}),e.reverse();var t=e.shift();return e.forEach(function(e){t=h(t,e)}),h(t,r)})}}function h(e,t){var n=r.element("<a></a>");n.append(e);var o=n.find("formly-transclude");return o.length||(o=p.findByNodeName(n,"formly-transclude")),o.replaceWith(t),n.html()}function g(e){var t=e.wrapper;if(null===t)return[];t=t?n(t).map(a.getWrapper):n(a.getWrapperByType(e.type));var r=a.getType(e.type,!0,e);if(r&&r.wrapper){var o=n(r.wrapper).map(a.getWrapper);t=t.concat(o)}var i=a.getWrapper();return i&&t.push(i),t}function v(e){l["throw"](l.formlyFieldOptions,arguments,{prefix:"formly-field directive",url:"formly-field-directive-validation-failed"});var t=e.type&&a.getType(e.type);t&&(t.validateOptions&&t.validateOptions(e),O(t,e))}function O(e,t){var n=e.apiCheck,r=e.apiCheckInstance,o=e.apiCheckFunction,i=e.apiCheckOptions;if(n){var a=r||l,s=o||"warn",p=a.shape(n);a[s](p,[t],i||{prefix:"formly-field "+name,url:l.config.output.docsBaseUrl+"formly-field-type-apicheck-failed"})}}return{restrict:"AE",transclude:!0,scope:{options:"=",model:"=",formId:"@",index:"=?",fields:"=?",formState:"=?",form:"=?"},controller:["$scope","$timeout","$parse","$controller",function(e,o,i,l){function f(){o(function(){var n=e.options,o=u();r.forEach(n.expressionProperties,function(r,a){var s=i(a).assign,l=t.when(p.formlyEval(e,r,o));l.then(function(e){s(n,e)})})})}function u(t){return e.model&&e.options.key?(r.isDefined(t)&&(e.model[e.options.key]=t),e.model[e.options.key]):void 0}function c(e){p.reverseDeepMerge(e,{data:{},templateOptions:{},validation:{}})}function d(e,t){t&&m(e,t.defaultOptions);var o=n(e.optionsTypes).reverse();r.forEach(o,function(t){m(e,a.getType(t,!0,e).defaultOptions)})}function m(e,t){t&&(r.isFunction(t)&&(t=t(e)),p.reverseDeepMerge(e,t))}function y(e,t){r.extend(e,{key:e.key||t||0,value:u,runExpressions:f})}function h(e,t){t.noFormControl||e.$watch('form["'+e.id+'"]',function(n){n&&(e.fc=n,e.options.formControl=n,O(e,t))})}function g(e,t){t.model&&e.$watch("options.model",f,!0)}function O(e,t){e.$watch(function(){if("boolean"==typeof e.options.validation.show)return e.fc.$invalid&&e.options.validation.show;var t=r.isUndefined(e.fc.$touched)&&e.fc.$dirty;return e.fc.$invalid&&(e.fc.$touched||t)},function(n){t.validation.errorExistsAndShouldBeVisible=n,e.showError=n})}function b(e){e.validation.messages=e.validation.messages||{},r.forEach(s.messages,function(t,n){e.validation.messages[n]||(e.validation.messages[n]=function(e,n,r){return p.formlyEval(r,t,n,e)})})}function x(e){var t=void 0===arguments[1]?{}:arguments[1],n=void 0===arguments[2]?{}:arguments[2];r.forEach([n.controller,t.controller],function(t){t&&l(t,{$scope:e})})}var w=e.options,k=w.type&&a.getType(w.type);c(w),d(w,k),y(w,e.index),v(w),e.id=p.getFieldId(e.formId,w,e.index),f(),h(e,w),g(e,w),b(w),e.to=e.options.templateOptions,x(e,w,k)}],link:function(e,n){function i(t){n.html(c(t)),o(n.contents())(e),l&&l.link&&l.link.apply(f,p),e.options.link&&e.options.link.apply(f,p)}function s(n){return function(o){var i=t.when(o);return r.forEach(n,function(n){i=i.then(function(o){return t.when(n(o,e.options,e)).then(function(e){return r.isString(e)?e:c(e)})})}),i}}var l=e.options.type&&a.getType(e.options.type),p=arguments,f=this;d(e.options).then(s(a.templateManipulators.preWrapper)).then(y(e.options)).then(s(a.templateManipulators.postWrapper)).then(i)["catch"](function(t){u("there-was-a-problem-setting-the-template-for-this-field","There was a problem setting the template for this field ",e.options,t)})}}}function n(e){return e&&!r.isArray(e)?e=[e]:e||(e=[]),e}e.directive("formlyField",t),t.tests=null,t.$inject=["$http","$q","$compile","$templateCache","formlyConfig","formlyValidationMessages","formlyApiCheck","formlyUtil","formlyUsability","formlyWarn"]}},function(e){"use strict";e.exports=function(e){e.directive("formlyFocus",["$timeout","$document",function(e,t){return{restrict:"A",link:function(n,r,o){var i=null,a=r[0],s=t[0];o.$observe("formlyFocus",function(t){"true"===t?e(function(){i=s.activeElement,a.focus()},~~o.focusWait):"false"===t&&s.activeElement===a&&(a.blur(),o.hasOwnProperty("refocus")&&i&&i.focus())})}}}])}},function(e,t,n){"use strict";var r=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)},o=Array.prototype.slice,i=n(1);e.exports=function(e){function t(e,t){var n=1;return{restrict:"E",template:function(e,t){var r=t.rootEl||"ng-form",o="formly_"+n++;return"\n <"+r+' class="formly"\n name="'+o+'"\n role="form">\n <div formly-field\n ng-repeat="field in fields track by $index"\n ng-if="!field.hide"\n class="formly-field {{field.type ? \'formly-field-\' + field.type : \'\'}}"\n options="field"\n model="field.model || model"\n fields="fields"\n form="'+o+'"\n form-id="'+o+'"\n form-state="options.formState"\n index="$index">\n </div>\n <div ng-transclude></div>\n </'+r+">\n "},replace:!0,transclude:!0,scope:{fields:"=",model:"=",form:"=?",options:"=?"},controller:["$scope",function(t){function n(e,t){e.key=e.key||t||0}function a(n,r){if(i.isDefined(n.watcher)){var o=n.watcher;i.isArray(o)||(o=[o]),i.forEach(o,function(o){if(!i.isDefined(o.listener))throw e.getFieldError("all-field-watchers-must-have-a-listener","All field watchers must have a listener",n);var a=s(o,n,r),p=l(o,n,r),f=o.type||"$watch";o.stopWatching=t[f](a,p,o.watchDeep)})}}function s(e,t,n){var a=e.expression||"model['"+t.key+"']";if(i.isFunction(a)){var s=a;a=function(){var t=p.apply(void 0,[e,n].concat(o.call(arguments)));return s.apply(void 0,r(t))},a.displayName="Formly Watch Expression for field for "+t.key}return a}function l(e,t,n){var a=e.listener;if(i.isFunction(a)){var s=a;a=function(){var t=p.apply(void 0,[e,n].concat(o.call(arguments)));return s.apply(void 0,r(t))},a.displayName="Formly Watch Listener for field for "+t.key}return a}function p(e,n){for(var r=arguments.length,o=Array(r>2?r-2:0),i=2;r>i;i++)o[i-2]=arguments[i];return[t.fields[n]].concat(o,[e.stopWatching])}t.options=t.options||{},t.options.formState=t.options.formState||{},i.forEach(t.fields,n),i.forEach(t.fields,a),t.$watch("model",function(e){i.forEach(t.fields,function(t){t.runExpressions&&t.runExpressions(e)})},!0)}],link:function(e,n,r){if(r.form){var o=r.name;t(r.form).assign(e.$parent,e[o])}}}}e.directive("formlyForm",t),t.tests=null,t.$inject=["formlyUsability","$parse"]}},function(e,t,n){"use strict";e.exports=function(e){n(5)(e),n(6)(e),n(8)(e),n(7)(e)}},function(e,t,n){"use strict";var r=n(4);if(!r)throw new Error("angular-formly requires the library apiCheck.js! Please include it! "+n(2)+"apicheckjs-dependency-required");var o="formly",i=n(1),a=i.module(o,[]);n(17)(a),n(23)(a),n(9)(a),n(20)(a),e.exports=o},function(e,t,n){"use strict";e.exports=function(e){function t(e,t){function n(n,i,a,s){var l=s&&s.hasOwnProperty(i),p=e.some(function(e){return s&&s.hasOwnProperty(e)});return p||l?l?t(n,i,a,s):void 0:r.utils.getError(i,a,o)}angular.isArray(e)||(e=[e]);var o="specified if these are not specified: `"+e.join(", ")+"` (otherwise it's optional)";return n.type=o,r.utils.checkerHelpers.setupChecker(n),n}var r=n(4)({output:{prefix:"angular-formly:",docsBaseUrl:n(2)}});e.constant("formlyApiCheck",r);var o=r.oneOfType([r.string,r.func]),i=r.oneOfType([r.oneOf([null]),r.typeOrArrayOf(r.string)]),a=r.objectOf(r.func),s=r.shape.onlyIf("apiCheck",r.func.withProperties({warn:r.func,"throw":r.func,shape:r.func})),l=r.shape.onlyIf("apiCheck",r.oneOf(["throw","warn"])),p=r.shape({name:t("types",r.string).optional,template:r.shape.ifNot("templateUrl",r.string).optional,templateUrl:r.shape.ifNot("template",r.string).optional,types:r.typeOrArrayOf(r.string).optional,overwriteOk:r.bool.optional,validateOptions:r.func.optional,apiCheck:a.optional,apiCheckInstance:s.optional,apiCheckFunction:l.optional,apiCheckOptions:r.object.optional}).strict,f={type:r.shape.ifNot(["template","templateUrl"],r.string).optional,template:r.shape.ifNot(["type","templateUrl"],r.string).optional,templateUrl:r.shape.ifNot(["type","template"],r.string).optional,key:r.oneOfType([r.string,r.number]),model:r.object.optional,expressionProperties:r.objectOf(r.oneOfType([o,r.shape({expression:o,message:o.optional}).strict])).optional,data:r.object.optional,templateOptions:r.object.optional,wrapper:i.optional,modelOptions:r.shape({updateOn:r.string.optional,debounce:r.oneOfType([r.object,r.string]).optional,allowInvalid:r.bool.optional,getterSetter:r.bool.optional,timezone:r.string.optional}).optional,watcher:r.typeOrArrayOf(r.shape({expression:o.optional,listener:o})).optional,validators:r.objectOf(r.oneOfType([o,r.shape({expression:o,message:o.optional}).strict])).optional,noFormControl:r.bool.optional,hide:r.bool.optional,ngModelAttrs:r.objectOf(r.shape({expression:r.shape.ifNot(["value","attribute","bound"],r.any).optional,value:r.shape.ifNot("expression",r.any).optional,attribute:r.shape.ifNot("expression",r.any).optional,bound:r.shape.ifNot("expression",r.any).optional}).strict).optional,optionsTypes:r.typeOrArrayOf(r.string).optional,link:r.func.optional,controller:r.oneOfType([r.string,r.func,r.array]).optional,validation:r.shape({show:r.oneOfType([r.bool,r.oneOf([null])]).optional,messages:r.objectOf(o).optional,errorExistsAndShouldBeVisible:r.bool.optional}).optional,formControl:r.object.optional,value:r.func.optional,runExpressions:r.func.optional},u=r.shape(f).strict,c=angular.copy(f);c.key=r.string.optional;var d=r.shape({name:r.string,template:r.shape.ifNot("templateUrl",r.string).optional,templateUrl:r.shape.ifNot("template",r.string).optional,controller:r.oneOfType([r.func,r.string,r.array]).optional,link:r.func.optional,defaultOptions:r.oneOfType([r.func,r.shape(c)]).optional,"extends":r.string.optional,wrapper:i.optional,data:r.object.optional,validateOptions:r.func.optional,apiCheck:a.optional,apiCheckInstance:s.optional,apiCheckFunction:l.optional,apiCheckOptions:r.object.optional,overwriteOk:r.bool.optional}).strict;angular.extend(r,{formlyTypeOptions:d,formlyFieldOptions:u,formlyExpression:o,formlyWrapperType:p})}},function(e,t,n){"use strict";var r=n(1),o=n(3);e.exports=function(e){function t(e,t){function n(e){if(r.isArray(e))r.forEach(e,n);else{if(!r.isObject(e))throw j("You must provide an object or array for setType. You provided: "+JSON.stringify(arguments));i(e),e["extends"]&&a(e),E[e.name]=e}}function i(e){t["throw"](t.formlyTypeOptions,arguments,{prefix:"formlyConfig.setType",url:"settype-validation-failed"}),e.overwriteOk?e.overwriteOk=void 0:g(e.name,E,e,"types")}function a(e){var t=u(e["extends"],!0,e);s(e,t),l(e,t),p(e,t),f(e,t),o.reverseDeepMerge(e,t)}function s(e,t){var n=t.controller;if(r.isDefined(n)){var o=e.controller;r.isDefined(o)?(e.controller=function(e,t){t(n,{$scope:e}),t(o,{$scope:e})},e.controller.$inject=["$scope","$controller"]):e.controller=n}}function l(e,t){var n=t.link;if(r.isDefined(n)){var o=e.link;e.link=r.isDefined(o)?function(){n.apply(void 0,arguments),o.apply(void 0,arguments)}:n}}function p(e,t){var n=t.validateOptions;if(r.isDefined(n)){var i=e.validateOptions,a=e.defaultOptions;e.validateOptions=r.isDefined(i)?function(e){i(e);var t=r.copy(e),s=a;s&&(r.isFunction(s)&&(s=s(t)),o.reverseDeepMerge(t,s)),n(t)}:n}}function f(e,t){var n=t.defaultOptions;if(r.isDefined(n)){var i=e.defaultOptions,a=r.isFunction(i),s=r.isFunction(n);s?e.defaultOptions=function(e){var t=n(e),r={};o.reverseDeepMerge(r,e,t);var s=i;return a&&(s=s(r)),o.reverseDeepMerge(t,s),t}:a&&(e.defaultOptions=function(e){var t={};return o.reverseDeepMerge(t,e,n),i(t)})}}function u(e,t,n){if(!e)return void 0;var r=E[e];if(r||t!==!0)return r;throw j('There is no type by the name of "'+e+'": '+JSON.stringify(n))}function c(e,t){for(var n=!0;n;){n=!1;var o=e,i=t;if(r.isArray(o))return o.map(function(e){return c(e)});if(r.isObject(o))return o.types=d(o),o.name=m(o,i),y(o),$[o.name]=o,o;r.isString(o)&&(e={template:o,name:i},n=!0)}}function d(e){return r.isString(e.types)?[e.types]:r.isDefined(e.types)?e.types:[]}function m(e,t){return e.name||t||e.types.join(" ")||A}function y(t){e.checkWrapper(t),t.template&&e.checkWrapperTemplate(t.template,t),t.overwriteOk?delete t.overwriteOk:g(t.name,$,t,"templateWrappers"),h(t)}function h(e){var t=!r.isArray(e.types)||!e.types.every(r.isString);if(t)throw j("Attempted to create a template wrapper with types that is not a string or an array of strings")}function g(e,t,n,r){t.hasOwnProperty(e)&&w(["Attempting to overwrite "+e+" on "+r+" which is currently",""+JSON.stringify(t[e])+" with "+JSON.stringify(n),'To supress this warning, specify the property "overwriteOk: true"'].join(" "))}function v(e){return $[e||A]}function O(e){var t=[];for(var n in $)$.hasOwnProperty(n)&&$[n].types&&-1!==$[n].types.indexOf(e)&&t.push($[n]);return t}function b(e){var t=$[e];return delete $[e],t}function x(e){var t=O(e);if(t)return r.isArray(t)?(t.forEach(function(e){return b(e.name)}),t):b(t.name)}function w(){T.disableWarnings||console.warn.apply(console,arguments)}var k=this,E={},$={},A="default",T=this,j=e.getFormlyError;r.extend(this,{setType:n,getType:u,setWrapper:c,getWrapper:v,getWrapperByType:O,removeWrapperByName:b,removeWrappersForType:x,disableWarnings:!1,extras:{disableNgModelAttrsManipulator:!1,ngModelAttrsManipulatorPreferBound:!1},templateManipulators:{preWrapper:[],postWrapper:[]},$get:function(){return k}})}e.provider("formlyConfig",t),t.tests=null,t.$inject=["formlyUsabilityProvider","formlyApiCheck"]}},function(e){"use strict";e.exports=function(e){e.constant("formlyErrorAndWarningsUrlPrefix","https://github.com/formly-js/angular-formly/blob/5.1.2/other/ERRORS_AND_WARNINGS.md#")}},function(e,t,n){"use strict";var r=n(1);e.exports=function(e){e.provider("formlyUsability",["formlyVersion","formlyApiCheck",function(e,t){function n(e,t,n){return arguments.length<3&&(n=t,t=e,e=null),new Error(i(e,t)+(" Field definition: "+r.toJson(n)))}function o(e,t){return t||(t=e,e=null),new Error(i(e,t))}function i(e,t){var n="";return null!==e&&(n=""+p+e),"Formly Error: "+t+". "+n}function a(){t["throw"](t.formlyWrapperType,arguments,{prefix:"formlyConfig.setWrapper",urlSuffix:"setwrapper-validation-failed"})}function s(e,t){var n="<formly-transclude></formly-transclude>";if(-1===e.indexOf(n))throw o('Template wrapper templates must use "'+n+'" somewhere in them. This one does not have "<formly-transclude></formly-transclude>" in it: '+e+"\nAdditional information: "+JSON.stringify(t))}var l=this,p="https://github.com/formly-js/angular-formly/blob/"+e+"/other/ERRORS_AND_WARNINGS.md#";r.extend(this,{getFormlyError:o,getFieldError:n,checkWrapper:a,checkWrapperTemplate:s,$get:function(){return l}})}])}},function(e){"use strict";e.exports=function(e){e.factory("formlyValidationMessages",function(){function e(e,t,o,i,a){r.messages[e]=n(t,o,i,a)}function t(e,t){r.messages[e]=function(){return t}}function n(e,t,n,r){return function(o,i,a){return a.options.templateOptions[e]?""+t+" "+a.options.templateOptions[e]+" "+n:r}}var r={addTemplateOptionValueMessage:e,addStringMessage:t,messages:{}};return r})}},function(e){"use strict";e.exports=function(e){e.constant("formlyVersion","5.1.2")}},function(e,t,n){"use strict";e.exports=function(e){n(11)(e),n(14)(e),n(12)(e),n(16)(e),n(13)(e),n(15)(e)}},function(e){"use strict";e.exports=function(e){function t(e){if(e&&e.get){var t=e.get(0),n=t.createElement("div");n.innerHTML="<!--[if lt IE 9]><i></i><![endif]-->";var r=1===n.getElementsByTagName("i").length;if(r)for(var o=["formly-field","formly-form","formly-custom-validation","formly-focus","formly-transpose"],i=0;i<o.length;i++)t.createElement(o[i])}}e.run(t),t.$inject=["$document"]}},function(e){"use strict";e.exports=function(e){function t(e,t){function n(e,n,a){function s(){(angular.isDefined(n.validators)||angular.isDefined(n.validation.messages))&&i(c,"formly-custom-validation","")}function l(){angular.isDefined(n.modelOptions)&&(i(c,"ng-model-options","options.modelOptions"),n.modelOptions.getterSetter&&c.attr("ng-model","options.value"))}function p(){if(n.templateOptions||n.expressionProperties){var e=n.templateOptions||{},t=n.expressionProperties||{},a=r();angular.extend(a,n.ngModelAttrs),angular.forEach(a,function(r,a){var s=void 0,l=void 0,p="options.templateOptions['"+a+"']",f=e[a],u=o(t,a),d=angular.isDefined(f),m=angular.isDefined(u);if(r.value)l=r.value,s=a;else if(r.expression&&d)if(l=r.expression,angular.isString(e[a]))s="$eval("+p+")";else{if(!angular.isFunction(e[a]))throw new Error("options.templateOptions."+a+" must be a string or function: "+JSON.stringify(n));s=""+p+"(model[options.key], options, this, $event)"}else r.bound&&m?(l=r.bound,s=p):r.attribute&&m?(l=r.attribute,s="{{"+p+"}}"):r.attribute&&d?(l=r.attribute,s=f):r.bound&&d&&(l=r.bound,s=p);angular.isDefined(l)&&angular.isDefined(s)&&i(c,l,s)})}}var f=document.createElement("div"),u=n.data;if(u.noTouchy&&t.getFormlyError("data.noTouchy is going to be removed in an upcoming release. This was an awful name to begin with. Please use `data.skipNgModelAttrsManipulator = true` instead."),u.noTouchy||u.skipNgModelAttrsManipulator===!0)return e;f.innerHTML=e;var c=f.querySelectorAll("[ng-model]");return c&&c.length?(i(c,"id",a.id),i(c,"name",a.id),s(),l(),p(),f.innerHTML):e}function r(){var t={focus:{attribute:"formly-focus"}},n=[],r=["required","disabled","pattern","minlength"],o=["change","keydown","keyup","keypress","click","focus","blur"],i=["placeholder","min","max","tabindex","type"];return e.extras.ngModelAttrsManipulatorPreferBound?n.push("maxlength"):r.push("maxlength"),angular.forEach(n,function(e){t[e]={bound:"ng-"+e}}),angular.forEach(r,function(e){t[e]={attribute:e,bound:"ng-"+e}}),angular.forEach(o,function(e){var n="on"+e.substr(0,1).toUpperCase()+e.substr(1);t[n]={expression:"ng-"+e}}),angular.forEach(i,function(e){t[e]={attribute:e}}),t}function o(e,t){return e["templateOptions."+t]||e["templateOptions['"+t+"']"]||e['templateOptions["'+t+'"]']}function i(e,t,n){angular.forEach(e,function(e){e.getAttribute(t)||e.setAttribute(t,n)})}e.extras.disableNgModelAttrsManipulator||e.templateManipulators.preWrapper.push(n)}e.run(t),t.$inject=["formlyConfig","formlyUsability"]}},function(e,t,n){"use strict";e.exports=function(e){n(19)(e),n(18)(e)}},function(e,t,n){"use strict";var r=n(3);e.exports=function(e){function t(){return r}e.factory("formlyUtil",t),t.tests=null}},function(e){"use strict";var t=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)};e.exports=function(e){e.factory("formlyWarn",["formlyConfig","formlyErrorAndWarningsUrlPrefix","$log",function(e,n,r){return function(){if(!e.disableWarnings){var o=Array.prototype.slice.call(arguments),i=o.shift();o.unshift("Formly Warning:"),o.push(""+n+i),r.warn.apply(r,t(o))}}}])}},function(e,t,n){"use strict";e.exports=function(e){n(21)(e),n(22)(e)}},function(e){e.exports=t}])}); //# sourceMappingURL=formly.min.js.map
CyrusSUEN/cdnjs
ajax/libs/angular-formly/5.1.2/formly.min.js
JavaScript
mit
23,552
<?php $UTF8_TO_ASCII[0xac] = array( 'Cheng ','Tiao ','Zhi ','Cui ','Mei ','Xie ','Cui ','Xie ','Mo ','Mai ','Ji ','Obiyaakasu ','[?] ','Kuai ','Sa ','Zang ','Qi ','Nao ','Mi ','Nong ','Luan ','Wan ','Bo ','Wen ','Guan ','Qiu ','Jiao ','Jing ','Rou ','Heng ','Cuo ','Lie ','Shan ','Ting ','Mei ','Chun ','Shen ','Xie ','De ','Zui ','Cu ','Xiu ','Xin ','Tuo ','Pao ','Cheng ','Nei ','Fu ','Dou ','Tuo ','Niao ','Noy ','Pi ','Gu ','Gua ','Li ','Lian ','Zhang ','Cui ','Jie ','Liang ','Zhou ','Pi ','Biao ','Lun ','Pian ','Guo ','Kui ','Chui ','Dan ','Tian ','Nei ','Jing ','Jie ','La ','Yi ','An ','Ren ','Shen ','Chuo ','Fu ','Fu ','Ju ','Fei ','Qiang ','Wan ','Dong ','Pi ','Guo ','Zong ','Ding ','Wu ','Mei ','Ruan ','Zhuan ','Zhi ','Cou ','Gua ','Ou ','Di ','An ','Xing ','Nao ','Yu ','Chuan ','Nan ','Yun ','Zhong ','Rou ','E ','Sai ','Tu ','Yao ','Jian ','Wei ','Jiao ','Yu ','Jia ','Duan ','Bi ','Chang ','Fu ','Xian ','Ni ','Mian ','Wa ','Teng ','Tui ','Bang ','Qian ','Lu ','Wa ','Sou ','Tang ','Su ','Zhui ','Ge ','Yi ','Bo ','Liao ','Ji ','Pi ','Xie ','Gao ','Lu ','Bin ','Ou ','Chang ','Lu ','Guo ','Pang ','Chuai ','Piao ','Jiang ','Fu ','Tang ','Mo ','Xi ','Zhuan ','Lu ','Jiao ','Ying ','Lu ','Zhi ','Tara ','Chun ','Lian ','Tong ','Peng ','Ni ','Zha ','Liao ','Cui ','Gui ','Xiao ','Teng ','Fan ','Zhi ','Jiao ','Shan ','Wu ','Cui ','Run ','Xiang ','Sui ','Fen ','Ying ','Tan ','Zhua ','Dan ','Kuai ','Nong ','Tun ','Lian ','Bi ','Yong ','Jue ','Chu ','Yi ','Juan ','La ','Lian ','Sao ','Tun ','Gu ','Qi ','Cui ','Bin ','Xun ','Ru ','Huo ','Zang ','Xian ','Biao ','Xing ','Kuan ','La ','Yan ','Lu ','Huo ','Zang ','Luo ','Qu ','Zang ','Luan ','Ni ','Zang ','Chen ','Qian ','Wo ','Guang ','Zang ','Lin ','Guang ','Zi ','Jiao ','Nie ','Chou ','Ji ','Gao ','Chou ','Mian ','Nie ','Zhi ','Zhi ','Ge ','Jian ','Die ','Zhi ','Xiu ','Tai ','Zhen ','Jiu ','Xian ','Yu ','Cha ', );
Militree/improved-magento-layered-navigation
app/code/community/Catalin/SEO/Helper/data/xac.php
PHP
mit
1,886
/*! DataTables 1.10.13 * ©2008-2016 SpryMedia Ltd - datatables.net/license */ /** * @summary DataTables * @description Paginate, search and order HTML tables * @version 1.10.13 * @file jquery.dataTables.js * @author SpryMedia Ltd * @contact www.datatables.net * @copyright Copyright 2008-2016 SpryMedia Ltd. * * This source file is free software, available under the following license: * MIT license - http://datatables.net/license * * This source file is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details. * * For details please refer to: http://www.datatables.net */ /*jslint evil: true, undef: true, browser: true */ /*globals $,require,jQuery,define,_selector_run,_selector_opts,_selector_first,_selector_row_indexes,_ext,_Api,_api_register,_api_registerPlural,_re_new_lines,_re_html,_re_formatted_numeric,_re_escape_regex,_empty,_intVal,_numToDecimal,_isNumber,_isHtml,_htmlNumeric,_pluck,_pluck_order,_range,_stripHtml,_unique,_fnBuildAjax,_fnAjaxUpdate,_fnAjaxParameters,_fnAjaxUpdateDraw,_fnAjaxDataSrc,_fnAddColumn,_fnColumnOptions,_fnAdjustColumnSizing,_fnVisibleToColumnIndex,_fnColumnIndexToVisible,_fnVisbleColumns,_fnGetColumns,_fnColumnTypes,_fnApplyColumnDefs,_fnHungarianMap,_fnCamelToHungarian,_fnLanguageCompat,_fnBrowserDetect,_fnAddData,_fnAddTr,_fnNodeToDataIndex,_fnNodeToColumnIndex,_fnGetCellData,_fnSetCellData,_fnSplitObjNotation,_fnGetObjectDataFn,_fnSetObjectDataFn,_fnGetDataMaster,_fnClearTable,_fnDeleteIndex,_fnInvalidate,_fnGetRowElements,_fnCreateTr,_fnBuildHead,_fnDrawHead,_fnDraw,_fnReDraw,_fnAddOptionsHtml,_fnDetectHeader,_fnGetUniqueThs,_fnFeatureHtmlFilter,_fnFilterComplete,_fnFilterCustom,_fnFilterColumn,_fnFilter,_fnFilterCreateSearch,_fnEscapeRegex,_fnFilterData,_fnFeatureHtmlInfo,_fnUpdateInfo,_fnInfoMacros,_fnInitialise,_fnInitComplete,_fnLengthChange,_fnFeatureHtmlLength,_fnFeatureHtmlPaginate,_fnPageChange,_fnFeatureHtmlProcessing,_fnProcessingDisplay,_fnFeatureHtmlTable,_fnScrollDraw,_fnApplyToChildren,_fnCalculateColumnWidths,_fnThrottle,_fnConvertToWidth,_fnGetWidestNode,_fnGetMaxLenString,_fnStringToCss,_fnSortFlatten,_fnSort,_fnSortAria,_fnSortListener,_fnSortAttachListener,_fnSortingClasses,_fnSortData,_fnSaveState,_fnLoadState,_fnSettingsFromNode,_fnLog,_fnMap,_fnBindAction,_fnCallbackReg,_fnCallbackFire,_fnLengthOverflow,_fnRenderer,_fnDataSource,_fnRowAttributes*/ (function( factory ) { "use strict"; if ( typeof define === 'function' && define.amd ) { // AMD define( ['jquery'], function ( $ ) { return factory( $, window, document ); } ); } else if ( typeof exports === 'object' ) { // CommonJS module.exports = function (root, $) { if ( ! root ) { // CommonJS environments without a window global must pass a // root. This will give an error otherwise root = window; } if ( ! $ ) { $ = typeof window !== 'undefined' ? // jQuery's factory checks for a global window require('jquery') : require('jquery')( root ); } return factory( $, root, root.document ); }; } else { // Browser factory( jQuery, window, document ); } } (function( $, window, document, undefined ) { "use strict"; /** * DataTables is a plug-in for the jQuery Javascript library. It is a highly * flexible tool, based upon the foundations of progressive enhancement, * which will add advanced interaction controls to any HTML table. For a * full list of features please refer to * [DataTables.net](href="http://datatables.net). * * Note that the `DataTable` object is not a global variable but is aliased * to `jQuery.fn.DataTable` and `jQuery.fn.dataTable` through which it may * be accessed. * * @class * @param {object} [init={}] Configuration object for DataTables. Options * are defined by {@link DataTable.defaults} * @requires jQuery 1.7+ * * @example * // Basic initialisation * $(document).ready( function { * $('#example').dataTable(); * } ); * * @example * // Initialisation with configuration options - in this case, disable * // pagination and sorting. * $(document).ready( function { * $('#example').dataTable( { * "paginate": false, * "sort": false * } ); * } ); */ var DataTable = function ( options ) { /** * Perform a jQuery selector action on the table's TR elements (from the tbody) and * return the resulting jQuery object. * @param {string|node|jQuery} sSelector jQuery selector or node collection to act on * @param {object} [oOpts] Optional parameters for modifying the rows to be included * @param {string} [oOpts.filter=none] Select TR elements that meet the current filter * criterion ("applied") or all TR elements (i.e. no filter). * @param {string} [oOpts.order=current] Order of the TR elements in the processed array. * Can be either 'current', whereby the current sorting of the table is used, or * 'original' whereby the original order the data was read into the table is used. * @param {string} [oOpts.page=all] Limit the selection to the currently displayed page * ("current") or not ("all"). If 'current' is given, then order is assumed to be * 'current' and filter is 'applied', regardless of what they might be given as. * @returns {object} jQuery object, filtered by the given selector. * @dtopt API * @deprecated Since v1.10 * * @example * $(document).ready(function() { * var oTable = $('#example').dataTable(); * * // Highlight every second row * oTable.$('tr:odd').css('backgroundColor', 'blue'); * } ); * * @example * $(document).ready(function() { * var oTable = $('#example').dataTable(); * * // Filter to rows with 'Webkit' in them, add a background colour and then * // remove the filter, thus highlighting the 'Webkit' rows only. * oTable.fnFilter('Webkit'); * oTable.$('tr', {"search": "applied"}).css('backgroundColor', 'blue'); * oTable.fnFilter(''); * } ); */ this.$ = function ( sSelector, oOpts ) { return this.api(true).$( sSelector, oOpts ); }; /** * Almost identical to $ in operation, but in this case returns the data for the matched * rows - as such, the jQuery selector used should match TR row nodes or TD/TH cell nodes * rather than any descendants, so the data can be obtained for the row/cell. If matching * rows are found, the data returned is the original data array/object that was used to * create the row (or a generated array if from a DOM source). * * This method is often useful in-combination with $ where both functions are given the * same parameters and the array indexes will match identically. * @param {string|node|jQuery} sSelector jQuery selector or node collection to act on * @param {object} [oOpts] Optional parameters for modifying the rows to be included * @param {string} [oOpts.filter=none] Select elements that meet the current filter * criterion ("applied") or all elements (i.e. no filter). * @param {string} [oOpts.order=current] Order of the data in the processed array. * Can be either 'current', whereby the current sorting of the table is used, or * 'original' whereby the original order the data was read into the table is used. * @param {string} [oOpts.page=all] Limit the selection to the currently displayed page * ("current") or not ("all"). If 'current' is given, then order is assumed to be * 'current' and filter is 'applied', regardless of what they might be given as. * @returns {array} Data for the matched elements. If any elements, as a result of the * selector, were not TR, TD or TH elements in the DataTable, they will have a null * entry in the array. * @dtopt API * @deprecated Since v1.10 * * @example * $(document).ready(function() { * var oTable = $('#example').dataTable(); * * // Get the data from the first row in the table * var data = oTable._('tr:first'); * * // Do something useful with the data * alert( "First cell is: "+data[0] ); * } ); * * @example * $(document).ready(function() { * var oTable = $('#example').dataTable(); * * // Filter to 'Webkit' and get all data for * oTable.fnFilter('Webkit'); * var data = oTable._('tr', {"search": "applied"}); * * // Do something with the data * alert( data.length+" rows matched the search" ); * } ); */ this._ = function ( sSelector, oOpts ) { return this.api(true).rows( sSelector, oOpts ).data(); }; /** * Create a DataTables Api instance, with the currently selected tables for * the Api's context. * @param {boolean} [traditional=false] Set the API instance's context to be * only the table referred to by the `DataTable.ext.iApiIndex` option, as was * used in the API presented by DataTables 1.9- (i.e. the traditional mode), * or if all tables captured in the jQuery object should be used. * @return {DataTables.Api} */ this.api = function ( traditional ) { return traditional ? new _Api( _fnSettingsFromNode( this[ _ext.iApiIndex ] ) ) : new _Api( this ); }; /** * Add a single new row or multiple rows of data to the table. Please note * that this is suitable for client-side processing only - if you are using * server-side processing (i.e. "bServerSide": true), then to add data, you * must add it to the data source, i.e. the server-side, through an Ajax call. * @param {array|object} data The data to be added to the table. This can be: * <ul> * <li>1D array of data - add a single row with the data provided</li> * <li>2D array of arrays - add multiple rows in a single call</li> * <li>object - data object when using <i>mData</i></li> * <li>array of objects - multiple data objects when using <i>mData</i></li> * </ul> * @param {bool} [redraw=true] redraw the table or not * @returns {array} An array of integers, representing the list of indexes in * <i>aoData</i> ({@link DataTable.models.oSettings}) that have been added to * the table. * @dtopt API * @deprecated Since v1.10 * * @example * // Global var for counter * var giCount = 2; * * $(document).ready(function() { * $('#example').dataTable(); * } ); * * function fnClickAddRow() { * $('#example').dataTable().fnAddData( [ * giCount+".1", * giCount+".2", * giCount+".3", * giCount+".4" ] * ); * * giCount++; * } */ this.fnAddData = function( data, redraw ) { var api = this.api( true ); /* Check if we want to add multiple rows or not */ var rows = $.isArray(data) && ( $.isArray(data[0]) || $.isPlainObject(data[0]) ) ? api.rows.add( data ) : api.row.add( data ); if ( redraw === undefined || redraw ) { api.draw(); } return rows.flatten().toArray(); }; /** * This function will make DataTables recalculate the column sizes, based on the data * contained in the table and the sizes applied to the columns (in the DOM, CSS or * through the sWidth parameter). This can be useful when the width of the table's * parent element changes (for example a window resize). * @param {boolean} [bRedraw=true] Redraw the table or not, you will typically want to * @dtopt API * @deprecated Since v1.10 * * @example * $(document).ready(function() { * var oTable = $('#example').dataTable( { * "sScrollY": "200px", * "bPaginate": false * } ); * * $(window).on('resize', function () { * oTable.fnAdjustColumnSizing(); * } ); * } ); */ this.fnAdjustColumnSizing = function ( bRedraw ) { var api = this.api( true ).columns.adjust(); var settings = api.settings()[0]; var scroll = settings.oScroll; if ( bRedraw === undefined || bRedraw ) { api.draw( false ); } else if ( scroll.sX !== "" || scroll.sY !== "" ) { /* If not redrawing, but scrolling, we want to apply the new column sizes anyway */ _fnScrollDraw( settings ); } }; /** * Quickly and simply clear a table * @param {bool} [bRedraw=true] redraw the table or not * @dtopt API * @deprecated Since v1.10 * * @example * $(document).ready(function() { * var oTable = $('#example').dataTable(); * * // Immediately 'nuke' the current rows (perhaps waiting for an Ajax callback...) * oTable.fnClearTable(); * } ); */ this.fnClearTable = function( bRedraw ) { var api = this.api( true ).clear(); if ( bRedraw === undefined || bRedraw ) { api.draw(); } }; /** * The exact opposite of 'opening' a row, this function will close any rows which * are currently 'open'. * @param {node} nTr the table row to 'close' * @returns {int} 0 on success, or 1 if failed (can't find the row) * @dtopt API * @deprecated Since v1.10 * * @example * $(document).ready(function() { * var oTable; * * // 'open' an information row when a row is clicked on * $('#example tbody tr').click( function () { * if ( oTable.fnIsOpen(this) ) { * oTable.fnClose( this ); * } else { * oTable.fnOpen( this, "Temporary row opened", "info_row" ); * } * } ); * * oTable = $('#example').dataTable(); * } ); */ this.fnClose = function( nTr ) { this.api( true ).row( nTr ).child.hide(); }; /** * Remove a row for the table * @param {mixed} target The index of the row from aoData to be deleted, or * the TR element you want to delete * @param {function|null} [callBack] Callback function * @param {bool} [redraw=true] Redraw the table or not * @returns {array} The row that was deleted * @dtopt API * @deprecated Since v1.10 * * @example * $(document).ready(function() { * var oTable = $('#example').dataTable(); * * // Immediately remove the first row * oTable.fnDeleteRow( 0 ); * } ); */ this.fnDeleteRow = function( target, callback, redraw ) { var api = this.api( true ); var rows = api.rows( target ); var settings = rows.settings()[0]; var data = settings.aoData[ rows[0][0] ]; rows.remove(); if ( callback ) { callback.call( this, settings, data ); } if ( redraw === undefined || redraw ) { api.draw(); } return data; }; /** * Restore the table to it's original state in the DOM by removing all of DataTables * enhancements, alterations to the DOM structure of the table and event listeners. * @param {boolean} [remove=false] Completely remove the table from the DOM * @dtopt API * @deprecated Since v1.10 * * @example * $(document).ready(function() { * // This example is fairly pointless in reality, but shows how fnDestroy can be used * var oTable = $('#example').dataTable(); * oTable.fnDestroy(); * } ); */ this.fnDestroy = function ( remove ) { this.api( true ).destroy( remove ); }; /** * Redraw the table * @param {bool} [complete=true] Re-filter and resort (if enabled) the table before the draw. * @dtopt API * @deprecated Since v1.10 * * @example * $(document).ready(function() { * var oTable = $('#example').dataTable(); * * // Re-draw the table - you wouldn't want to do it here, but it's an example :-) * oTable.fnDraw(); * } ); */ this.fnDraw = function( complete ) { // Note that this isn't an exact match to the old call to _fnDraw - it takes // into account the new data, but can hold position. this.api( true ).draw( complete ); }; /** * Filter the input based on data * @param {string} sInput String to filter the table on * @param {int|null} [iColumn] Column to limit filtering to * @param {bool} [bRegex=false] Treat as regular expression or not * @param {bool} [bSmart=true] Perform smart filtering or not * @param {bool} [bShowGlobal=true] Show the input global filter in it's input box(es) * @param {bool} [bCaseInsensitive=true] Do case-insensitive matching (true) or not (false) * @dtopt API * @deprecated Since v1.10 * * @example * $(document).ready(function() { * var oTable = $('#example').dataTable(); * * // Sometime later - filter... * oTable.fnFilter( 'test string' ); * } ); */ this.fnFilter = function( sInput, iColumn, bRegex, bSmart, bShowGlobal, bCaseInsensitive ) { var api = this.api( true ); if ( iColumn === null || iColumn === undefined ) { api.search( sInput, bRegex, bSmart, bCaseInsensitive ); } else { api.column( iColumn ).search( sInput, bRegex, bSmart, bCaseInsensitive ); } api.draw(); }; /** * Get the data for the whole table, an individual row or an individual cell based on the * provided parameters. * @param {int|node} [src] A TR row node, TD/TH cell node or an integer. If given as * a TR node then the data source for the whole row will be returned. If given as a * TD/TH cell node then iCol will be automatically calculated and the data for the * cell returned. If given as an integer, then this is treated as the aoData internal * data index for the row (see fnGetPosition) and the data for that row used. * @param {int} [col] Optional column index that you want the data of. * @returns {array|object|string} If mRow is undefined, then the data for all rows is * returned. If mRow is defined, just data for that row, and is iCol is * defined, only data for the designated cell is returned. * @dtopt API * @deprecated Since v1.10 * * @example * // Row data * $(document).ready(function() { * oTable = $('#example').dataTable(); * * oTable.$('tr').click( function () { * var data = oTable.fnGetData( this ); * // ... do something with the array / object of data for the row * } ); * } ); * * @example * // Individual cell data * $(document).ready(function() { * oTable = $('#example').dataTable(); * * oTable.$('td').click( function () { * var sData = oTable.fnGetData( this ); * alert( 'The cell clicked on had the value of '+sData ); * } ); * } ); */ this.fnGetData = function( src, col ) { var api = this.api( true ); if ( src !== undefined ) { var type = src.nodeName ? src.nodeName.toLowerCase() : ''; return col !== undefined || type == 'td' || type == 'th' ? api.cell( src, col ).data() : api.row( src ).data() || null; } return api.data().toArray(); }; /** * Get an array of the TR nodes that are used in the table's body. Note that you will * typically want to use the '$' API method in preference to this as it is more * flexible. * @param {int} [iRow] Optional row index for the TR element you want * @returns {array|node} If iRow is undefined, returns an array of all TR elements * in the table's body, or iRow is defined, just the TR element requested. * @dtopt API * @deprecated Since v1.10 * * @example * $(document).ready(function() { * var oTable = $('#example').dataTable(); * * // Get the nodes from the table * var nNodes = oTable.fnGetNodes( ); * } ); */ this.fnGetNodes = function( iRow ) { var api = this.api( true ); return iRow !== undefined ? api.row( iRow ).node() : api.rows().nodes().flatten().toArray(); }; /** * Get the array indexes of a particular cell from it's DOM element * and column index including hidden columns * @param {node} node this can either be a TR, TD or TH in the table's body * @returns {int} If nNode is given as a TR, then a single index is returned, or * if given as a cell, an array of [row index, column index (visible), * column index (all)] is given. * @dtopt API * @deprecated Since v1.10 * * @example * $(document).ready(function() { * $('#example tbody td').click( function () { * // Get the position of the current data from the node * var aPos = oTable.fnGetPosition( this ); * * // Get the data array for this row * var aData = oTable.fnGetData( aPos[0] ); * * // Update the data array and return the value * aData[ aPos[1] ] = 'clicked'; * this.innerHTML = 'clicked'; * } ); * * // Init DataTables * oTable = $('#example').dataTable(); * } ); */ this.fnGetPosition = function( node ) { var api = this.api( true ); var nodeName = node.nodeName.toUpperCase(); if ( nodeName == 'TR' ) { return api.row( node ).index(); } else if ( nodeName == 'TD' || nodeName == 'TH' ) { var cell = api.cell( node ).index(); return [ cell.row, cell.columnVisible, cell.column ]; } return null; }; /** * Check to see if a row is 'open' or not. * @param {node} nTr the table row to check * @returns {boolean} true if the row is currently open, false otherwise * @dtopt API * @deprecated Since v1.10 * * @example * $(document).ready(function() { * var oTable; * * // 'open' an information row when a row is clicked on * $('#example tbody tr').click( function () { * if ( oTable.fnIsOpen(this) ) { * oTable.fnClose( this ); * } else { * oTable.fnOpen( this, "Temporary row opened", "info_row" ); * } * } ); * * oTable = $('#example').dataTable(); * } ); */ this.fnIsOpen = function( nTr ) { return this.api( true ).row( nTr ).child.isShown(); }; /** * This function will place a new row directly after a row which is currently * on display on the page, with the HTML contents that is passed into the * function. This can be used, for example, to ask for confirmation that a * particular record should be deleted. * @param {node} nTr The table row to 'open' * @param {string|node|jQuery} mHtml The HTML to put into the row * @param {string} sClass Class to give the new TD cell * @returns {node} The row opened. Note that if the table row passed in as the * first parameter, is not found in the table, this method will silently * return. * @dtopt API * @deprecated Since v1.10 * * @example * $(document).ready(function() { * var oTable; * * // 'open' an information row when a row is clicked on * $('#example tbody tr').click( function () { * if ( oTable.fnIsOpen(this) ) { * oTable.fnClose( this ); * } else { * oTable.fnOpen( this, "Temporary row opened", "info_row" ); * } * } ); * * oTable = $('#example').dataTable(); * } ); */ this.fnOpen = function( nTr, mHtml, sClass ) { return this.api( true ) .row( nTr ) .child( mHtml, sClass ) .show() .child()[0]; }; /** * Change the pagination - provides the internal logic for pagination in a simple API * function. With this function you can have a DataTables table go to the next, * previous, first or last pages. * @param {string|int} mAction Paging action to take: "first", "previous", "next" or "last" * or page number to jump to (integer), note that page 0 is the first page. * @param {bool} [bRedraw=true] Redraw the table or not * @dtopt API * @deprecated Since v1.10 * * @example * $(document).ready(function() { * var oTable = $('#example').dataTable(); * oTable.fnPageChange( 'next' ); * } ); */ this.fnPageChange = function ( mAction, bRedraw ) { var api = this.api( true ).page( mAction ); if ( bRedraw === undefined || bRedraw ) { api.draw(false); } }; /** * Show a particular column * @param {int} iCol The column whose display should be changed * @param {bool} bShow Show (true) or hide (false) the column * @param {bool} [bRedraw=true] Redraw the table or not * @dtopt API * @deprecated Since v1.10 * * @example * $(document).ready(function() { * var oTable = $('#example').dataTable(); * * // Hide the second column after initialisation * oTable.fnSetColumnVis( 1, false ); * } ); */ this.fnSetColumnVis = function ( iCol, bShow, bRedraw ) { var api = this.api( true ).column( iCol ).visible( bShow ); if ( bRedraw === undefined || bRedraw ) { api.columns.adjust().draw(); } }; /** * Get the settings for a particular table for external manipulation * @returns {object} DataTables settings object. See * {@link DataTable.models.oSettings} * @dtopt API * @deprecated Since v1.10 * * @example * $(document).ready(function() { * var oTable = $('#example').dataTable(); * var oSettings = oTable.fnSettings(); * * // Show an example parameter from the settings * alert( oSettings._iDisplayStart ); * } ); */ this.fnSettings = function() { return _fnSettingsFromNode( this[_ext.iApiIndex] ); }; /** * Sort the table by a particular column * @param {int} iCol the data index to sort on. Note that this will not match the * 'display index' if you have hidden data entries * @dtopt API * @deprecated Since v1.10 * * @example * $(document).ready(function() { * var oTable = $('#example').dataTable(); * * // Sort immediately with columns 0 and 1 * oTable.fnSort( [ [0,'asc'], [1,'asc'] ] ); * } ); */ this.fnSort = function( aaSort ) { this.api( true ).order( aaSort ).draw(); }; /** * Attach a sort listener to an element for a given column * @param {node} nNode the element to attach the sort listener to * @param {int} iColumn the column that a click on this node will sort on * @param {function} [fnCallback] callback function when sort is run * @dtopt API * @deprecated Since v1.10 * * @example * $(document).ready(function() { * var oTable = $('#example').dataTable(); * * // Sort on column 1, when 'sorter' is clicked on * oTable.fnSortListener( document.getElementById('sorter'), 1 ); * } ); */ this.fnSortListener = function( nNode, iColumn, fnCallback ) { this.api( true ).order.listener( nNode, iColumn, fnCallback ); }; /** * Update a table cell or row - this method will accept either a single value to * update the cell with, an array of values with one element for each column or * an object in the same format as the original data source. The function is * self-referencing in order to make the multi column updates easier. * @param {object|array|string} mData Data to update the cell/row with * @param {node|int} mRow TR element you want to update or the aoData index * @param {int} [iColumn] The column to update, give as null or undefined to * update a whole row. * @param {bool} [bRedraw=true] Redraw the table or not * @param {bool} [bAction=true] Perform pre-draw actions or not * @returns {int} 0 on success, 1 on error * @dtopt API * @deprecated Since v1.10 * * @example * $(document).ready(function() { * var oTable = $('#example').dataTable(); * oTable.fnUpdate( 'Example update', 0, 0 ); // Single cell * oTable.fnUpdate( ['a', 'b', 'c', 'd', 'e'], $('tbody tr')[0] ); // Row * } ); */ this.fnUpdate = function( mData, mRow, iColumn, bRedraw, bAction ) { var api = this.api( true ); if ( iColumn === undefined || iColumn === null ) { api.row( mRow ).data( mData ); } else { api.cell( mRow, iColumn ).data( mData ); } if ( bAction === undefined || bAction ) { api.columns.adjust(); } if ( bRedraw === undefined || bRedraw ) { api.draw(); } return 0; }; /** * Provide a common method for plug-ins to check the version of DataTables being used, in order * to ensure compatibility. * @param {string} sVersion Version string to check for, in the format "X.Y.Z". Note that the * formats "X" and "X.Y" are also acceptable. * @returns {boolean} true if this version of DataTables is greater or equal to the required * version, or false if this version of DataTales is not suitable * @method * @dtopt API * @deprecated Since v1.10 * * @example * $(document).ready(function() { * var oTable = $('#example').dataTable(); * alert( oTable.fnVersionCheck( '1.9.0' ) ); * } ); */ this.fnVersionCheck = _ext.fnVersionCheck; var _that = this; var emptyInit = options === undefined; var len = this.length; if ( emptyInit ) { options = {}; } this.oApi = this.internal = _ext.internal; // Extend with old style plug-in API methods for ( var fn in DataTable.ext.internal ) { if ( fn ) { this[fn] = _fnExternApiFunc(fn); } } this.each(function() { // For each initialisation we want to give it a clean initialisation // object that can be bashed around var o = {}; var oInit = len > 1 ? // optimisation for single table case _fnExtend( o, options, true ) : options; /*global oInit,_that,emptyInit*/ var i=0, iLen, j, jLen, k, kLen; var sId = this.getAttribute( 'id' ); var bInitHandedOff = false; var defaults = DataTable.defaults; var $this = $(this); /* Sanity check */ if ( this.nodeName.toLowerCase() != 'table' ) { _fnLog( null, 0, 'Non-table node initialisation ('+this.nodeName+')', 2 ); return; } /* Backwards compatibility for the defaults */ _fnCompatOpts( defaults ); _fnCompatCols( defaults.column ); /* Convert the camel-case defaults to Hungarian */ _fnCamelToHungarian( defaults, defaults, true ); _fnCamelToHungarian( defaults.column, defaults.column, true ); /* Setting up the initialisation object */ _fnCamelToHungarian( defaults, $.extend( oInit, $this.data() ) ); /* Check to see if we are re-initialising a table */ var allSettings = DataTable.settings; for ( i=0, iLen=allSettings.length ; i<iLen ; i++ ) { var s = allSettings[i]; /* Base check on table node */ if ( s.nTable == this || s.nTHead.parentNode == this || (s.nTFoot && s.nTFoot.parentNode == this) ) { var bRetrieve = oInit.bRetrieve !== undefined ? oInit.bRetrieve : defaults.bRetrieve; var bDestroy = oInit.bDestroy !== undefined ? oInit.bDestroy : defaults.bDestroy; if ( emptyInit || bRetrieve ) { return s.oInstance; } else if ( bDestroy ) { s.oInstance.fnDestroy(); break; } else { _fnLog( s, 0, 'Cannot reinitialise DataTable', 3 ); return; } } /* If the element we are initialising has the same ID as a table which was previously * initialised, but the table nodes don't match (from before) then we destroy the old * instance by simply deleting it. This is under the assumption that the table has been * destroyed by other methods. Anyone using non-id selectors will need to do this manually */ if ( s.sTableId == this.id ) { allSettings.splice( i, 1 ); break; } } /* Ensure the table has an ID - required for accessibility */ if ( sId === null || sId === "" ) { sId = "DataTables_Table_"+(DataTable.ext._unique++); this.id = sId; } /* Create the settings object for this table and set some of the default parameters */ var oSettings = $.extend( true, {}, DataTable.models.oSettings, { "sDestroyWidth": $this[0].style.width, "sInstance": sId, "sTableId": sId } ); oSettings.nTable = this; oSettings.oApi = _that.internal; oSettings.oInit = oInit; allSettings.push( oSettings ); // Need to add the instance after the instance after the settings object has been added // to the settings array, so we can self reference the table instance if more than one oSettings.oInstance = (_that.length===1) ? _that : $this.dataTable(); // Backwards compatibility, before we apply all the defaults _fnCompatOpts( oInit ); if ( oInit.oLanguage ) { _fnLanguageCompat( oInit.oLanguage ); } // If the length menu is given, but the init display length is not, use the length menu if ( oInit.aLengthMenu && ! oInit.iDisplayLength ) { oInit.iDisplayLength = $.isArray( oInit.aLengthMenu[0] ) ? oInit.aLengthMenu[0][0] : oInit.aLengthMenu[0]; } // Apply the defaults and init options to make a single init object will all // options defined from defaults and instance options. oInit = _fnExtend( $.extend( true, {}, defaults ), oInit ); // Map the initialisation options onto the settings object _fnMap( oSettings.oFeatures, oInit, [ "bPaginate", "bLengthChange", "bFilter", "bSort", "bSortMulti", "bInfo", "bProcessing", "bAutoWidth", "bSortClasses", "bServerSide", "bDeferRender" ] ); _fnMap( oSettings, oInit, [ "asStripeClasses", "ajax", "fnServerData", "fnFormatNumber", "sServerMethod", "aaSorting", "aaSortingFixed", "aLengthMenu", "sPaginationType", "sAjaxSource", "sAjaxDataProp", "iStateDuration", "sDom", "bSortCellsTop", "iTabIndex", "fnStateLoadCallback", "fnStateSaveCallback", "renderer", "searchDelay", "rowId", [ "iCookieDuration", "iStateDuration" ], // backwards compat [ "oSearch", "oPreviousSearch" ], [ "aoSearchCols", "aoPreSearchCols" ], [ "iDisplayLength", "_iDisplayLength" ], [ "bJQueryUI", "bJUI" ] ] ); _fnMap( oSettings.oScroll, oInit, [ [ "sScrollX", "sX" ], [ "sScrollXInner", "sXInner" ], [ "sScrollY", "sY" ], [ "bScrollCollapse", "bCollapse" ] ] ); _fnMap( oSettings.oLanguage, oInit, "fnInfoCallback" ); /* Callback functions which are array driven */ _fnCallbackReg( oSettings, 'aoDrawCallback', oInit.fnDrawCallback, 'user' ); _fnCallbackReg( oSettings, 'aoServerParams', oInit.fnServerParams, 'user' ); _fnCallbackReg( oSettings, 'aoStateSaveParams', oInit.fnStateSaveParams, 'user' ); _fnCallbackReg( oSettings, 'aoStateLoadParams', oInit.fnStateLoadParams, 'user' ); _fnCallbackReg( oSettings, 'aoStateLoaded', oInit.fnStateLoaded, 'user' ); _fnCallbackReg( oSettings, 'aoRowCallback', oInit.fnRowCallback, 'user' ); _fnCallbackReg( oSettings, 'aoRowCreatedCallback', oInit.fnCreatedRow, 'user' ); _fnCallbackReg( oSettings, 'aoHeaderCallback', oInit.fnHeaderCallback, 'user' ); _fnCallbackReg( oSettings, 'aoFooterCallback', oInit.fnFooterCallback, 'user' ); _fnCallbackReg( oSettings, 'aoInitComplete', oInit.fnInitComplete, 'user' ); _fnCallbackReg( oSettings, 'aoPreDrawCallback', oInit.fnPreDrawCallback, 'user' ); oSettings.rowIdFn = _fnGetObjectDataFn( oInit.rowId ); /* Browser support detection */ _fnBrowserDetect( oSettings ); var oClasses = oSettings.oClasses; // @todo Remove in 1.11 if ( oInit.bJQueryUI ) { /* Use the JUI classes object for display. You could clone the oStdClasses object if * you want to have multiple tables with multiple independent classes */ $.extend( oClasses, DataTable.ext.oJUIClasses, oInit.oClasses ); if ( oInit.sDom === defaults.sDom && defaults.sDom === "lfrtip" ) { /* Set the DOM to use a layout suitable for jQuery UI's theming */ oSettings.sDom = '<"H"lfr>t<"F"ip>'; } if ( ! oSettings.renderer ) { oSettings.renderer = 'jqueryui'; } else if ( $.isPlainObject( oSettings.renderer ) && ! oSettings.renderer.header ) { oSettings.renderer.header = 'jqueryui'; } } else { $.extend( oClasses, DataTable.ext.classes, oInit.oClasses ); } $this.addClass( oClasses.sTable ); if ( oSettings.iInitDisplayStart === undefined ) { /* Display start point, taking into account the save saving */ oSettings.iInitDisplayStart = oInit.iDisplayStart; oSettings._iDisplayStart = oInit.iDisplayStart; } if ( oInit.iDeferLoading !== null ) { oSettings.bDeferLoading = true; var tmp = $.isArray( oInit.iDeferLoading ); oSettings._iRecordsDisplay = tmp ? oInit.iDeferLoading[0] : oInit.iDeferLoading; oSettings._iRecordsTotal = tmp ? oInit.iDeferLoading[1] : oInit.iDeferLoading; } /* Language definitions */ var oLanguage = oSettings.oLanguage; $.extend( true, oLanguage, oInit.oLanguage ); if ( oLanguage.sUrl ) { /* Get the language definitions from a file - because this Ajax call makes the language * get async to the remainder of this function we use bInitHandedOff to indicate that * _fnInitialise will be fired by the returned Ajax handler, rather than the constructor */ $.ajax( { dataType: 'json', url: oLanguage.sUrl, success: function ( json ) { _fnLanguageCompat( json ); _fnCamelToHungarian( defaults.oLanguage, json ); $.extend( true, oLanguage, json ); _fnInitialise( oSettings ); }, error: function () { // Error occurred loading language file, continue on as best we can _fnInitialise( oSettings ); } } ); bInitHandedOff = true; } /* * Stripes */ if ( oInit.asStripeClasses === null ) { oSettings.asStripeClasses =[ oClasses.sStripeOdd, oClasses.sStripeEven ]; } /* Remove row stripe classes if they are already on the table row */ var stripeClasses = oSettings.asStripeClasses; var rowOne = $this.children('tbody').find('tr').eq(0); if ( $.inArray( true, $.map( stripeClasses, function(el, i) { return rowOne.hasClass(el); } ) ) !== -1 ) { $('tbody tr', this).removeClass( stripeClasses.join(' ') ); oSettings.asDestroyStripes = stripeClasses.slice(); } /* * Columns * See if we should load columns automatically or use defined ones */ var anThs = []; var aoColumnsInit; var nThead = this.getElementsByTagName('thead'); if ( nThead.length !== 0 ) { _fnDetectHeader( oSettings.aoHeader, nThead[0] ); anThs = _fnGetUniqueThs( oSettings ); } /* If not given a column array, generate one with nulls */ if ( oInit.aoColumns === null ) { aoColumnsInit = []; for ( i=0, iLen=anThs.length ; i<iLen ; i++ ) { aoColumnsInit.push( null ); } } else { aoColumnsInit = oInit.aoColumns; } /* Add the columns */ for ( i=0, iLen=aoColumnsInit.length ; i<iLen ; i++ ) { _fnAddColumn( oSettings, anThs ? anThs[i] : null ); } /* Apply the column definitions */ _fnApplyColumnDefs( oSettings, oInit.aoColumnDefs, aoColumnsInit, function (iCol, oDef) { _fnColumnOptions( oSettings, iCol, oDef ); } ); /* HTML5 attribute detection - build an mData object automatically if the * attributes are found */ if ( rowOne.length ) { var a = function ( cell, name ) { return cell.getAttribute( 'data-'+name ) !== null ? name : null; }; $( rowOne[0] ).children('th, td').each( function (i, cell) { var col = oSettings.aoColumns[i]; if ( col.mData === i ) { var sort = a( cell, 'sort' ) || a( cell, 'order' ); var filter = a( cell, 'filter' ) || a( cell, 'search' ); if ( sort !== null || filter !== null ) { col.mData = { _: i+'.display', sort: sort !== null ? i+'.@data-'+sort : undefined, type: sort !== null ? i+'.@data-'+sort : undefined, filter: filter !== null ? i+'.@data-'+filter : undefined }; _fnColumnOptions( oSettings, i ); } } } ); } var features = oSettings.oFeatures; var loadedInit = function () { /* * Sorting * @todo For modularisation (1.11) this needs to do into a sort start up handler */ // If aaSorting is not defined, then we use the first indicator in asSorting // in case that has been altered, so the default sort reflects that option if ( oInit.aaSorting === undefined ) { var sorting = oSettings.aaSorting; for ( i=0, iLen=sorting.length ; i<iLen ; i++ ) { sorting[i][1] = oSettings.aoColumns[ i ].asSorting[0]; } } /* Do a first pass on the sorting classes (allows any size changes to be taken into * account, and also will apply sorting disabled classes if disabled */ _fnSortingClasses( oSettings ); if ( features.bSort ) { _fnCallbackReg( oSettings, 'aoDrawCallback', function () { if ( oSettings.bSorted ) { var aSort = _fnSortFlatten( oSettings ); var sortedColumns = {}; $.each( aSort, function (i, val) { sortedColumns[ val.src ] = val.dir; } ); _fnCallbackFire( oSettings, null, 'order', [oSettings, aSort, sortedColumns] ); _fnSortAria( oSettings ); } } ); } _fnCallbackReg( oSettings, 'aoDrawCallback', function () { if ( oSettings.bSorted || _fnDataSource( oSettings ) === 'ssp' || features.bDeferRender ) { _fnSortingClasses( oSettings ); } }, 'sc' ); /* * Final init * Cache the header, body and footer as required, creating them if needed */ // Work around for Webkit bug 83867 - store the caption-side before removing from doc var captions = $this.children('caption').each( function () { this._captionSide = $(this).css('caption-side'); } ); var thead = $this.children('thead'); if ( thead.length === 0 ) { thead = $('<thead/>').appendTo($this); } oSettings.nTHead = thead[0]; var tbody = $this.children('tbody'); if ( tbody.length === 0 ) { tbody = $('<tbody/>').appendTo($this); } oSettings.nTBody = tbody[0]; var tfoot = $this.children('tfoot'); if ( tfoot.length === 0 && captions.length > 0 && (oSettings.oScroll.sX !== "" || oSettings.oScroll.sY !== "") ) { // If we are a scrolling table, and no footer has been given, then we need to create // a tfoot element for the caption element to be appended to tfoot = $('<tfoot/>').appendTo($this); } if ( tfoot.length === 0 || tfoot.children().length === 0 ) { $this.addClass( oClasses.sNoFooter ); } else if ( tfoot.length > 0 ) { oSettings.nTFoot = tfoot[0]; _fnDetectHeader( oSettings.aoFooter, oSettings.nTFoot ); } /* Check if there is data passing into the constructor */ if ( oInit.aaData ) { for ( i=0 ; i<oInit.aaData.length ; i++ ) { _fnAddData( oSettings, oInit.aaData[ i ] ); } } else if ( oSettings.bDeferLoading || _fnDataSource( oSettings ) == 'dom' ) { /* Grab the data from the page - only do this when deferred loading or no Ajax * source since there is no point in reading the DOM data if we are then going * to replace it with Ajax data */ _fnAddTr( oSettings, $(oSettings.nTBody).children('tr') ); } /* Copy the data index array */ oSettings.aiDisplay = oSettings.aiDisplayMaster.slice(); /* Initialisation complete - table can be drawn */ oSettings.bInitialised = true; /* Check if we need to initialise the table (it might not have been handed off to the * language processor) */ if ( bInitHandedOff === false ) { _fnInitialise( oSettings ); } }; /* Must be done after everything which can be overridden by the state saving! */ if ( oInit.bStateSave ) { features.bStateSave = true; _fnCallbackReg( oSettings, 'aoDrawCallback', _fnSaveState, 'state_save' ); _fnLoadState( oSettings, oInit, loadedInit ); } else { loadedInit(); } } ); _that = null; return this; }; /* * It is useful to have variables which are scoped locally so only the * DataTables functions can access them and they don't leak into global space. * At the same time these functions are often useful over multiple files in the * core and API, so we list, or at least document, all variables which are used * by DataTables as private variables here. This also ensures that there is no * clashing of variable names and that they can easily referenced for reuse. */ // Defined else where // _selector_run // _selector_opts // _selector_first // _selector_row_indexes var _ext; // DataTable.ext var _Api; // DataTable.Api var _api_register; // DataTable.Api.register var _api_registerPlural; // DataTable.Api.registerPlural var _re_dic = {}; var _re_new_lines = /[\r\n]/g; var _re_html = /<.*?>/g; // This is not strict ISO8601 - Date.parse() is quite lax, although // implementations differ between browsers. var _re_date = /^\d{2,4}[\.\/\-]\d{1,2}[\.\/\-]\d{1,2}([T ]{1}\d{1,2}[:\.]\d{2}([\.:]\d{2})?)?$/; // Escape regular expression special characters var _re_escape_regex = new RegExp( '(\\' + [ '/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\', '$', '^', '-' ].join('|\\') + ')', 'g' ); // http://en.wikipedia.org/wiki/Foreign_exchange_market // - \u20BD - Russian ruble. // - \u20a9 - South Korean Won // - \u20BA - Turkish Lira // - \u20B9 - Indian Rupee // - R - Brazil (R$) and South Africa // - fr - Swiss Franc // - kr - Swedish krona, Norwegian krone and Danish krone // - \u2009 is thin space and \u202F is narrow no-break space, both used in many // standards as thousands separators. var _re_formatted_numeric = /[',$£€¥%\u2009\u202F\u20BD\u20a9\u20BArfk]/gi; var _empty = function ( d ) { return !d || d === true || d === '-' ? true : false; }; var _intVal = function ( s ) { var integer = parseInt( s, 10 ); return !isNaN(integer) && isFinite(s) ? integer : null; }; // Convert from a formatted number with characters other than `.` as the // decimal place, to a Javascript number var _numToDecimal = function ( num, decimalPoint ) { // Cache created regular expressions for speed as this function is called often if ( ! _re_dic[ decimalPoint ] ) { _re_dic[ decimalPoint ] = new RegExp( _fnEscapeRegex( decimalPoint ), 'g' ); } return typeof num === 'string' && decimalPoint !== '.' ? num.replace( /\./g, '' ).replace( _re_dic[ decimalPoint ], '.' ) : num; }; var _isNumber = function ( d, decimalPoint, formatted ) { var strType = typeof d === 'string'; // If empty return immediately so there must be a number if it is a // formatted string (this stops the string "k", or "kr", etc being detected // as a formatted number for currency if ( _empty( d ) ) { return true; } if ( decimalPoint && strType ) { d = _numToDecimal( d, decimalPoint ); } if ( formatted && strType ) { d = d.replace( _re_formatted_numeric, '' ); } return !isNaN( parseFloat(d) ) && isFinite( d ); }; // A string without HTML in it can be considered to be HTML still var _isHtml = function ( d ) { return _empty( d ) || typeof d === 'string'; }; var _htmlNumeric = function ( d, decimalPoint, formatted ) { if ( _empty( d ) ) { return true; } var html = _isHtml( d ); return ! html ? null : _isNumber( _stripHtml( d ), decimalPoint, formatted ) ? true : null; }; var _pluck = function ( a, prop, prop2 ) { var out = []; var i=0, ien=a.length; // Could have the test in the loop for slightly smaller code, but speed // is essential here if ( prop2 !== undefined ) { for ( ; i<ien ; i++ ) { if ( a[i] && a[i][ prop ] ) { out.push( a[i][ prop ][ prop2 ] ); } } } else { for ( ; i<ien ; i++ ) { if ( a[i] ) { out.push( a[i][ prop ] ); } } } return out; }; // Basically the same as _pluck, but rather than looping over `a` we use `order` // as the indexes to pick from `a` var _pluck_order = function ( a, order, prop, prop2 ) { var out = []; var i=0, ien=order.length; // Could have the test in the loop for slightly smaller code, but speed // is essential here if ( prop2 !== undefined ) { for ( ; i<ien ; i++ ) { if ( a[ order[i] ][ prop ] ) { out.push( a[ order[i] ][ prop ][ prop2 ] ); } } } else { for ( ; i<ien ; i++ ) { out.push( a[ order[i] ][ prop ] ); } } return out; }; var _range = function ( len, start ) { var out = []; var end; if ( start === undefined ) { start = 0; end = len; } else { end = start; start = len; } for ( var i=start ; i<end ; i++ ) { out.push( i ); } return out; }; var _removeEmpty = function ( a ) { var out = []; for ( var i=0, ien=a.length ; i<ien ; i++ ) { if ( a[i] ) { // careful - will remove all falsy values! out.push( a[i] ); } } return out; }; var _stripHtml = function ( d ) { return d.replace( _re_html, '' ); }; /** * Find the unique elements in a source array. * * @param {array} src Source array * @return {array} Array of unique items * @ignore */ var _unique = function ( src ) { // A faster unique method is to use object keys to identify used values, // but this doesn't work with arrays or objects, which we must also // consider. See jsperf.com/compare-array-unique-versions/4 for more // information. var out = [], val, i, ien=src.length, j, k=0; again: for ( i=0 ; i<ien ; i++ ) { val = src[i]; for ( j=0 ; j<k ; j++ ) { if ( out[j] === val ) { continue again; } } out.push( val ); k++; } return out; }; /** * DataTables utility methods * * This namespace provides helper methods that DataTables uses internally to * create a DataTable, but which are not exclusively used only for DataTables. * These methods can be used by extension authors to save the duplication of * code. * * @namespace */ DataTable.util = { /** * Throttle the calls to a function. Arguments and context are maintained * for the throttled function. * * @param {function} fn Function to be called * @param {integer} freq Call frequency in mS * @return {function} Wrapped function */ throttle: function ( fn, freq ) { var frequency = freq !== undefined ? freq : 200, last, timer; return function () { var that = this, now = +new Date(), args = arguments; if ( last && now < last + frequency ) { clearTimeout( timer ); timer = setTimeout( function () { last = undefined; fn.apply( that, args ); }, frequency ); } else { last = now; fn.apply( that, args ); } }; }, /** * Escape a string such that it can be used in a regular expression * * @param {string} val string to escape * @returns {string} escaped string */ escapeRegex: function ( val ) { return val.replace( _re_escape_regex, '\\$1' ); } }; /** * Create a mapping object that allows camel case parameters to be looked up * for their Hungarian counterparts. The mapping is stored in a private * parameter called `_hungarianMap` which can be accessed on the source object. * @param {object} o * @memberof DataTable#oApi */ function _fnHungarianMap ( o ) { var hungarian = 'a aa ai ao as b fn i m o s ', match, newKey, map = {}; $.each( o, function (key, val) { match = key.match(/^([^A-Z]+?)([A-Z])/); if ( match && hungarian.indexOf(match[1]+' ') !== -1 ) { newKey = key.replace( match[0], match[2].toLowerCase() ); map[ newKey ] = key; if ( match[1] === 'o' ) { _fnHungarianMap( o[key] ); } } } ); o._hungarianMap = map; } /** * Convert from camel case parameters to Hungarian, based on a Hungarian map * created by _fnHungarianMap. * @param {object} src The model object which holds all parameters that can be * mapped. * @param {object} user The object to convert from camel case to Hungarian. * @param {boolean} force When set to `true`, properties which already have a * Hungarian value in the `user` object will be overwritten. Otherwise they * won't be. * @memberof DataTable#oApi */ function _fnCamelToHungarian ( src, user, force ) { if ( ! src._hungarianMap ) { _fnHungarianMap( src ); } var hungarianKey; $.each( user, function (key, val) { hungarianKey = src._hungarianMap[ key ]; if ( hungarianKey !== undefined && (force || user[hungarianKey] === undefined) ) { // For objects, we need to buzz down into the object to copy parameters if ( hungarianKey.charAt(0) === 'o' ) { // Copy the camelCase options over to the hungarian if ( ! user[ hungarianKey ] ) { user[ hungarianKey ] = {}; } $.extend( true, user[hungarianKey], user[key] ); _fnCamelToHungarian( src[hungarianKey], user[hungarianKey], force ); } else { user[hungarianKey] = user[ key ]; } } } ); } /** * Language compatibility - when certain options are given, and others aren't, we * need to duplicate the values over, in order to provide backwards compatibility * with older language files. * @param {object} oSettings dataTables settings object * @memberof DataTable#oApi */ function _fnLanguageCompat( lang ) { var defaults = DataTable.defaults.oLanguage; var zeroRecords = lang.sZeroRecords; /* Backwards compatibility - if there is no sEmptyTable given, then use the same as * sZeroRecords - assuming that is given. */ if ( ! lang.sEmptyTable && zeroRecords && defaults.sEmptyTable === "No data available in table" ) { _fnMap( lang, lang, 'sZeroRecords', 'sEmptyTable' ); } /* Likewise with loading records */ if ( ! lang.sLoadingRecords && zeroRecords && defaults.sLoadingRecords === "Loading..." ) { _fnMap( lang, lang, 'sZeroRecords', 'sLoadingRecords' ); } // Old parameter name of the thousands separator mapped onto the new if ( lang.sInfoThousands ) { lang.sThousands = lang.sInfoThousands; } var decimal = lang.sDecimal; if ( decimal ) { _addNumericSort( decimal ); } } /** * Map one parameter onto another * @param {object} o Object to map * @param {*} knew The new parameter name * @param {*} old The old parameter name */ var _fnCompatMap = function ( o, knew, old ) { if ( o[ knew ] !== undefined ) { o[ old ] = o[ knew ]; } }; /** * Provide backwards compatibility for the main DT options. Note that the new * options are mapped onto the old parameters, so this is an external interface * change only. * @param {object} init Object to map */ function _fnCompatOpts ( init ) { _fnCompatMap( init, 'ordering', 'bSort' ); _fnCompatMap( init, 'orderMulti', 'bSortMulti' ); _fnCompatMap( init, 'orderClasses', 'bSortClasses' ); _fnCompatMap( init, 'orderCellsTop', 'bSortCellsTop' ); _fnCompatMap( init, 'order', 'aaSorting' ); _fnCompatMap( init, 'orderFixed', 'aaSortingFixed' ); _fnCompatMap( init, 'paging', 'bPaginate' ); _fnCompatMap( init, 'pagingType', 'sPaginationType' ); _fnCompatMap( init, 'pageLength', 'iDisplayLength' ); _fnCompatMap( init, 'searching', 'bFilter' ); // Boolean initialisation of x-scrolling if ( typeof init.sScrollX === 'boolean' ) { init.sScrollX = init.sScrollX ? '100%' : ''; } if ( typeof init.scrollX === 'boolean' ) { init.scrollX = init.scrollX ? '100%' : ''; } // Column search objects are in an array, so it needs to be converted // element by element var searchCols = init.aoSearchCols; if ( searchCols ) { for ( var i=0, ien=searchCols.length ; i<ien ; i++ ) { if ( searchCols[i] ) { _fnCamelToHungarian( DataTable.models.oSearch, searchCols[i] ); } } } } /** * Provide backwards compatibility for column options. Note that the new options * are mapped onto the old parameters, so this is an external interface change * only. * @param {object} init Object to map */ function _fnCompatCols ( init ) { _fnCompatMap( init, 'orderable', 'bSortable' ); _fnCompatMap( init, 'orderData', 'aDataSort' ); _fnCompatMap( init, 'orderSequence', 'asSorting' ); _fnCompatMap( init, 'orderDataType', 'sortDataType' ); // orderData can be given as an integer var dataSort = init.aDataSort; if ( dataSort && ! $.isArray( dataSort ) ) { init.aDataSort = [ dataSort ]; } } /** * Browser feature detection for capabilities, quirks * @param {object} settings dataTables settings object * @memberof DataTable#oApi */ function _fnBrowserDetect( settings ) { // We don't need to do this every time DataTables is constructed, the values // calculated are specific to the browser and OS configuration which we // don't expect to change between initialisations if ( ! DataTable.__browser ) { var browser = {}; DataTable.__browser = browser; // Scrolling feature / quirks detection var n = $('<div/>') .css( { position: 'fixed', top: 0, left: $(window).scrollLeft()*-1, // allow for scrolling height: 1, width: 1, overflow: 'hidden' } ) .append( $('<div/>') .css( { position: 'absolute', top: 1, left: 1, width: 100, overflow: 'scroll' } ) .append( $('<div/>') .css( { width: '100%', height: 10 } ) ) ) .appendTo( 'body' ); var outer = n.children(); var inner = outer.children(); // Numbers below, in order, are: // inner.offsetWidth, inner.clientWidth, outer.offsetWidth, outer.clientWidth // // IE6 XP: 100 100 100 83 // IE7 Vista: 100 100 100 83 // IE 8+ Windows: 83 83 100 83 // Evergreen Windows: 83 83 100 83 // Evergreen Mac with scrollbars: 85 85 100 85 // Evergreen Mac without scrollbars: 100 100 100 100 // Get scrollbar width browser.barWidth = outer[0].offsetWidth - outer[0].clientWidth; // IE6/7 will oversize a width 100% element inside a scrolling element, to // include the width of the scrollbar, while other browsers ensure the inner // element is contained without forcing scrolling browser.bScrollOversize = inner[0].offsetWidth === 100 && outer[0].clientWidth !== 100; // In rtl text layout, some browsers (most, but not all) will place the // scrollbar on the left, rather than the right. browser.bScrollbarLeft = Math.round( inner.offset().left ) !== 1; // IE8- don't provide height and width for getBoundingClientRect browser.bBounding = n[0].getBoundingClientRect().width ? true : false; n.remove(); } $.extend( settings.oBrowser, DataTable.__browser ); settings.oScroll.iBarWidth = DataTable.__browser.barWidth; } /** * Array.prototype reduce[Right] method, used for browsers which don't support * JS 1.6. Done this way to reduce code size, since we iterate either way * @param {object} settings dataTables settings object * @memberof DataTable#oApi */ function _fnReduce ( that, fn, init, start, end, inc ) { var i = start, value, isSet = false; if ( init !== undefined ) { value = init; isSet = true; } while ( i !== end ) { if ( ! that.hasOwnProperty(i) ) { continue; } value = isSet ? fn( value, that[i], i, that ) : that[i]; isSet = true; i += inc; } return value; } /** * Add a column to the list used for the table with default values * @param {object} oSettings dataTables settings object * @param {node} nTh The th element for this column * @memberof DataTable#oApi */ function _fnAddColumn( oSettings, nTh ) { // Add column to aoColumns array var oDefaults = DataTable.defaults.column; var iCol = oSettings.aoColumns.length; var oCol = $.extend( {}, DataTable.models.oColumn, oDefaults, { "nTh": nTh ? nTh : document.createElement('th'), "sTitle": oDefaults.sTitle ? oDefaults.sTitle : nTh ? nTh.innerHTML : '', "aDataSort": oDefaults.aDataSort ? oDefaults.aDataSort : [iCol], "mData": oDefaults.mData ? oDefaults.mData : iCol, idx: iCol } ); oSettings.aoColumns.push( oCol ); // Add search object for column specific search. Note that the `searchCols[ iCol ]` // passed into extend can be undefined. This allows the user to give a default // with only some of the parameters defined, and also not give a default var searchCols = oSettings.aoPreSearchCols; searchCols[ iCol ] = $.extend( {}, DataTable.models.oSearch, searchCols[ iCol ] ); // Use the default column options function to initialise classes etc _fnColumnOptions( oSettings, iCol, $(nTh).data() ); } /** * Apply options for a column * @param {object} oSettings dataTables settings object * @param {int} iCol column index to consider * @param {object} oOptions object with sType, bVisible and bSearchable etc * @memberof DataTable#oApi */ function _fnColumnOptions( oSettings, iCol, oOptions ) { var oCol = oSettings.aoColumns[ iCol ]; var oClasses = oSettings.oClasses; var th = $(oCol.nTh); // Try to get width information from the DOM. We can't get it from CSS // as we'd need to parse the CSS stylesheet. `width` option can override if ( ! oCol.sWidthOrig ) { // Width attribute oCol.sWidthOrig = th.attr('width') || null; // Style attribute var t = (th.attr('style') || '').match(/width:\s*(\d+[pxem%]+)/); if ( t ) { oCol.sWidthOrig = t[1]; } } /* User specified column options */ if ( oOptions !== undefined && oOptions !== null ) { // Backwards compatibility _fnCompatCols( oOptions ); // Map camel case parameters to their Hungarian counterparts _fnCamelToHungarian( DataTable.defaults.column, oOptions ); /* Backwards compatibility for mDataProp */ if ( oOptions.mDataProp !== undefined && !oOptions.mData ) { oOptions.mData = oOptions.mDataProp; } if ( oOptions.sType ) { oCol._sManualType = oOptions.sType; } // `class` is a reserved word in Javascript, so we need to provide // the ability to use a valid name for the camel case input if ( oOptions.className && ! oOptions.sClass ) { oOptions.sClass = oOptions.className; } $.extend( oCol, oOptions ); _fnMap( oCol, oOptions, "sWidth", "sWidthOrig" ); /* iDataSort to be applied (backwards compatibility), but aDataSort will take * priority if defined */ if ( oOptions.iDataSort !== undefined ) { oCol.aDataSort = [ oOptions.iDataSort ]; } _fnMap( oCol, oOptions, "aDataSort" ); } /* Cache the data get and set functions for speed */ var mDataSrc = oCol.mData; var mData = _fnGetObjectDataFn( mDataSrc ); var mRender = oCol.mRender ? _fnGetObjectDataFn( oCol.mRender ) : null; var attrTest = function( src ) { return typeof src === 'string' && src.indexOf('@') !== -1; }; oCol._bAttrSrc = $.isPlainObject( mDataSrc ) && ( attrTest(mDataSrc.sort) || attrTest(mDataSrc.type) || attrTest(mDataSrc.filter) ); oCol._setter = null; oCol.fnGetData = function (rowData, type, meta) { var innerData = mData( rowData, type, undefined, meta ); return mRender && type ? mRender( innerData, type, rowData, meta ) : innerData; }; oCol.fnSetData = function ( rowData, val, meta ) { return _fnSetObjectDataFn( mDataSrc )( rowData, val, meta ); }; // Indicate if DataTables should read DOM data as an object or array // Used in _fnGetRowElements if ( typeof mDataSrc !== 'number' ) { oSettings._rowReadObject = true; } /* Feature sorting overrides column specific when off */ if ( !oSettings.oFeatures.bSort ) { oCol.bSortable = false; th.addClass( oClasses.sSortableNone ); // Have to add class here as order event isn't called } /* Check that the class assignment is correct for sorting */ var bAsc = $.inArray('asc', oCol.asSorting) !== -1; var bDesc = $.inArray('desc', oCol.asSorting) !== -1; if ( !oCol.bSortable || (!bAsc && !bDesc) ) { oCol.sSortingClass = oClasses.sSortableNone; oCol.sSortingClassJUI = ""; } else if ( bAsc && !bDesc ) { oCol.sSortingClass = oClasses.sSortableAsc; oCol.sSortingClassJUI = oClasses.sSortJUIAscAllowed; } else if ( !bAsc && bDesc ) { oCol.sSortingClass = oClasses.sSortableDesc; oCol.sSortingClassJUI = oClasses.sSortJUIDescAllowed; } else { oCol.sSortingClass = oClasses.sSortable; oCol.sSortingClassJUI = oClasses.sSortJUI; } } /** * Adjust the table column widths for new data. Note: you would probably want to * do a redraw after calling this function! * @param {object} settings dataTables settings object * @memberof DataTable#oApi */ function _fnAdjustColumnSizing ( settings ) { /* Not interested in doing column width calculation if auto-width is disabled */ if ( settings.oFeatures.bAutoWidth !== false ) { var columns = settings.aoColumns; _fnCalculateColumnWidths( settings ); for ( var i=0 , iLen=columns.length ; i<iLen ; i++ ) { columns[i].nTh.style.width = columns[i].sWidth; } } var scroll = settings.oScroll; if ( scroll.sY !== '' || scroll.sX !== '') { _fnScrollDraw( settings ); } _fnCallbackFire( settings, null, 'column-sizing', [settings] ); } /** * Covert the index of a visible column to the index in the data array (take account * of hidden columns) * @param {object} oSettings dataTables settings object * @param {int} iMatch Visible column index to lookup * @returns {int} i the data index * @memberof DataTable#oApi */ function _fnVisibleToColumnIndex( oSettings, iMatch ) { var aiVis = _fnGetColumns( oSettings, 'bVisible' ); return typeof aiVis[iMatch] === 'number' ? aiVis[iMatch] : null; } /** * Covert the index of an index in the data array and convert it to the visible * column index (take account of hidden columns) * @param {int} iMatch Column index to lookup * @param {object} oSettings dataTables settings object * @returns {int} i the data index * @memberof DataTable#oApi */ function _fnColumnIndexToVisible( oSettings, iMatch ) { var aiVis = _fnGetColumns( oSettings, 'bVisible' ); var iPos = $.inArray( iMatch, aiVis ); return iPos !== -1 ? iPos : null; } /** * Get the number of visible columns * @param {object} oSettings dataTables settings object * @returns {int} i the number of visible columns * @memberof DataTable#oApi */ function _fnVisbleColumns( oSettings ) { var vis = 0; // No reduce in IE8, use a loop for now $.each( oSettings.aoColumns, function ( i, col ) { if ( col.bVisible && $(col.nTh).css('display') !== 'none' ) { vis++; } } ); return vis; } /** * Get an array of column indexes that match a given property * @param {object} oSettings dataTables settings object * @param {string} sParam Parameter in aoColumns to look for - typically * bVisible or bSearchable * @returns {array} Array of indexes with matched properties * @memberof DataTable#oApi */ function _fnGetColumns( oSettings, sParam ) { var a = []; $.map( oSettings.aoColumns, function(val, i) { if ( val[sParam] ) { a.push( i ); } } ); return a; } /** * Calculate the 'type' of a column * @param {object} settings dataTables settings object * @memberof DataTable#oApi */ function _fnColumnTypes ( settings ) { var columns = settings.aoColumns; var data = settings.aoData; var types = DataTable.ext.type.detect; var i, ien, j, jen, k, ken; var col, cell, detectedType, cache; // For each column, spin over the for ( i=0, ien=columns.length ; i<ien ; i++ ) { col = columns[i]; cache = []; if ( ! col.sType && col._sManualType ) { col.sType = col._sManualType; } else if ( ! col.sType ) { for ( j=0, jen=types.length ; j<jen ; j++ ) { for ( k=0, ken=data.length ; k<ken ; k++ ) { // Use a cache array so we only need to get the type data // from the formatter once (when using multiple detectors) if ( cache[k] === undefined ) { cache[k] = _fnGetCellData( settings, k, i, 'type' ); } detectedType = types[j]( cache[k], settings ); // If null, then this type can't apply to this column, so // rather than testing all cells, break out. There is an // exception for the last type which is `html`. We need to // scan all rows since it is possible to mix string and HTML // types if ( ! detectedType && j !== types.length-1 ) { break; } // Only a single match is needed for html type since it is // bottom of the pile and very similar to string if ( detectedType === 'html' ) { break; } } // Type is valid for all data points in the column - use this // type if ( detectedType ) { col.sType = detectedType; break; } } // Fall back - if no type was detected, always use string if ( ! col.sType ) { col.sType = 'string'; } } } } /** * Take the column definitions and static columns arrays and calculate how * they relate to column indexes. The callback function will then apply the * definition found for a column to a suitable configuration object. * @param {object} oSettings dataTables settings object * @param {array} aoColDefs The aoColumnDefs array that is to be applied * @param {array} aoCols The aoColumns array that defines columns individually * @param {function} fn Callback function - takes two parameters, the calculated * column index and the definition for that column. * @memberof DataTable#oApi */ function _fnApplyColumnDefs( oSettings, aoColDefs, aoCols, fn ) { var i, iLen, j, jLen, k, kLen, def; var columns = oSettings.aoColumns; // Column definitions with aTargets if ( aoColDefs ) { /* Loop over the definitions array - loop in reverse so first instance has priority */ for ( i=aoColDefs.length-1 ; i>=0 ; i-- ) { def = aoColDefs[i]; /* Each definition can target multiple columns, as it is an array */ var aTargets = def.targets !== undefined ? def.targets : def.aTargets; if ( ! $.isArray( aTargets ) ) { aTargets = [ aTargets ]; } for ( j=0, jLen=aTargets.length ; j<jLen ; j++ ) { if ( typeof aTargets[j] === 'number' && aTargets[j] >= 0 ) { /* Add columns that we don't yet know about */ while( columns.length <= aTargets[j] ) { _fnAddColumn( oSettings ); } /* Integer, basic index */ fn( aTargets[j], def ); } else if ( typeof aTargets[j] === 'number' && aTargets[j] < 0 ) { /* Negative integer, right to left column counting */ fn( columns.length+aTargets[j], def ); } else if ( typeof aTargets[j] === 'string' ) { /* Class name matching on TH element */ for ( k=0, kLen=columns.length ; k<kLen ; k++ ) { if ( aTargets[j] == "_all" || $(columns[k].nTh).hasClass( aTargets[j] ) ) { fn( k, def ); } } } } } } // Statically defined columns array if ( aoCols ) { for ( i=0, iLen=aoCols.length ; i<iLen ; i++ ) { fn( i, aoCols[i] ); } } } /** * Add a data array to the table, creating DOM node etc. This is the parallel to * _fnGatherData, but for adding rows from a Javascript source, rather than a * DOM source. * @param {object} oSettings dataTables settings object * @param {array} aData data array to be added * @param {node} [nTr] TR element to add to the table - optional. If not given, * DataTables will create a row automatically * @param {array} [anTds] Array of TD|TH elements for the row - must be given * if nTr is. * @returns {int} >=0 if successful (index of new aoData entry), -1 if failed * @memberof DataTable#oApi */ function _fnAddData ( oSettings, aDataIn, nTr, anTds ) { /* Create the object for storing information about this new row */ var iRow = oSettings.aoData.length; var oData = $.extend( true, {}, DataTable.models.oRow, { src: nTr ? 'dom' : 'data', idx: iRow } ); oData._aData = aDataIn; oSettings.aoData.push( oData ); /* Create the cells */ var nTd, sThisType; var columns = oSettings.aoColumns; // Invalidate the column types as the new data needs to be revalidated for ( var i=0, iLen=columns.length ; i<iLen ; i++ ) { columns[i].sType = null; } /* Add to the display array */ oSettings.aiDisplayMaster.push( iRow ); var id = oSettings.rowIdFn( aDataIn ); if ( id !== undefined ) { oSettings.aIds[ id ] = oData; } /* Create the DOM information, or register it if already present */ if ( nTr || ! oSettings.oFeatures.bDeferRender ) { _fnCreateTr( oSettings, iRow, nTr, anTds ); } return iRow; } /** * Add one or more TR elements to the table. Generally we'd expect to * use this for reading data from a DOM sourced table, but it could be * used for an TR element. Note that if a TR is given, it is used (i.e. * it is not cloned). * @param {object} settings dataTables settings object * @param {array|node|jQuery} trs The TR element(s) to add to the table * @returns {array} Array of indexes for the added rows * @memberof DataTable#oApi */ function _fnAddTr( settings, trs ) { var row; // Allow an individual node to be passed in if ( ! (trs instanceof $) ) { trs = $(trs); } return trs.map( function (i, el) { row = _fnGetRowElements( settings, el ); return _fnAddData( settings, row.data, el, row.cells ); } ); } /** * Take a TR element and convert it to an index in aoData * @param {object} oSettings dataTables settings object * @param {node} n the TR element to find * @returns {int} index if the node is found, null if not * @memberof DataTable#oApi */ function _fnNodeToDataIndex( oSettings, n ) { return (n._DT_RowIndex!==undefined) ? n._DT_RowIndex : null; } /** * Take a TD element and convert it into a column data index (not the visible index) * @param {object} oSettings dataTables settings object * @param {int} iRow The row number the TD/TH can be found in * @param {node} n The TD/TH element to find * @returns {int} index if the node is found, -1 if not * @memberof DataTable#oApi */ function _fnNodeToColumnIndex( oSettings, iRow, n ) { return $.inArray( n, oSettings.aoData[ iRow ].anCells ); } /** * Get the data for a given cell from the internal cache, taking into account data mapping * @param {object} settings dataTables settings object * @param {int} rowIdx aoData row id * @param {int} colIdx Column index * @param {string} type data get type ('display', 'type' 'filter' 'sort') * @returns {*} Cell data * @memberof DataTable#oApi */ function _fnGetCellData( settings, rowIdx, colIdx, type ) { var draw = settings.iDraw; var col = settings.aoColumns[colIdx]; var rowData = settings.aoData[rowIdx]._aData; var defaultContent = col.sDefaultContent; var cellData = col.fnGetData( rowData, type, { settings: settings, row: rowIdx, col: colIdx } ); if ( cellData === undefined ) { if ( settings.iDrawError != draw && defaultContent === null ) { _fnLog( settings, 0, "Requested unknown parameter "+ (typeof col.mData=='function' ? '{function}' : "'"+col.mData+"'")+ " for row "+rowIdx+", column "+colIdx, 4 ); settings.iDrawError = draw; } return defaultContent; } // When the data source is null and a specific data type is requested (i.e. // not the original data), we can use default column data if ( (cellData === rowData || cellData === null) && defaultContent !== null && type !== undefined ) { cellData = defaultContent; } else if ( typeof cellData === 'function' ) { // If the data source is a function, then we run it and use the return, // executing in the scope of the data object (for instances) return cellData.call( rowData ); } if ( cellData === null && type == 'display' ) { return ''; } return cellData; } /** * Set the value for a specific cell, into the internal data cache * @param {object} settings dataTables settings object * @param {int} rowIdx aoData row id * @param {int} colIdx Column index * @param {*} val Value to set * @memberof DataTable#oApi */ function _fnSetCellData( settings, rowIdx, colIdx, val ) { var col = settings.aoColumns[colIdx]; var rowData = settings.aoData[rowIdx]._aData; col.fnSetData( rowData, val, { settings: settings, row: rowIdx, col: colIdx } ); } // Private variable that is used to match action syntax in the data property object var __reArray = /\[.*?\]$/; var __reFn = /\(\)$/; /** * Split string on periods, taking into account escaped periods * @param {string} str String to split * @return {array} Split string */ function _fnSplitObjNotation( str ) { return $.map( str.match(/(\\.|[^\.])+/g) || [''], function ( s ) { return s.replace(/\\\./g, '.'); } ); } /** * Return a function that can be used to get data from a source object, taking * into account the ability to use nested objects as a source * @param {string|int|function} mSource The data source for the object * @returns {function} Data get function * @memberof DataTable#oApi */ function _fnGetObjectDataFn( mSource ) { if ( $.isPlainObject( mSource ) ) { /* Build an object of get functions, and wrap them in a single call */ var o = {}; $.each( mSource, function (key, val) { if ( val ) { o[key] = _fnGetObjectDataFn( val ); } } ); return function (data, type, row, meta) { var t = o[type] || o._; return t !== undefined ? t(data, type, row, meta) : data; }; } else if ( mSource === null ) { /* Give an empty string for rendering / sorting etc */ return function (data) { // type, row and meta also passed, but not used return data; }; } else if ( typeof mSource === 'function' ) { return function (data, type, row, meta) { return mSource( data, type, row, meta ); }; } else if ( typeof mSource === 'string' && (mSource.indexOf('.') !== -1 || mSource.indexOf('[') !== -1 || mSource.indexOf('(') !== -1) ) { /* If there is a . in the source string then the data source is in a * nested object so we loop over the data for each level to get the next * level down. On each loop we test for undefined, and if found immediately * return. This allows entire objects to be missing and sDefaultContent to * be used if defined, rather than throwing an error */ var fetchData = function (data, type, src) { var arrayNotation, funcNotation, out, innerSrc; if ( src !== "" ) { var a = _fnSplitObjNotation( src ); for ( var i=0, iLen=a.length ; i<iLen ; i++ ) { // Check if we are dealing with special notation arrayNotation = a[i].match(__reArray); funcNotation = a[i].match(__reFn); if ( arrayNotation ) { // Array notation a[i] = a[i].replace(__reArray, ''); // Condition allows simply [] to be passed in if ( a[i] !== "" ) { data = data[ a[i] ]; } out = []; // Get the remainder of the nested object to get a.splice( 0, i+1 ); innerSrc = a.join('.'); // Traverse each entry in the array getting the properties requested if ( $.isArray( data ) ) { for ( var j=0, jLen=data.length ; j<jLen ; j++ ) { out.push( fetchData( data[j], type, innerSrc ) ); } } // If a string is given in between the array notation indicators, that // is used to join the strings together, otherwise an array is returned var join = arrayNotation[0].substring(1, arrayNotation[0].length-1); data = (join==="") ? out : out.join(join); // The inner call to fetchData has already traversed through the remainder // of the source requested, so we exit from the loop break; } else if ( funcNotation ) { // Function call a[i] = a[i].replace(__reFn, ''); data = data[ a[i] ](); continue; } if ( data === null || data[ a[i] ] === undefined ) { return undefined; } data = data[ a[i] ]; } } return data; }; return function (data, type) { // row and meta also passed, but not used return fetchData( data, type, mSource ); }; } else { /* Array or flat object mapping */ return function (data, type) { // row and meta also passed, but not used return data[mSource]; }; } } /** * Return a function that can be used to set data from a source object, taking * into account the ability to use nested objects as a source * @param {string|int|function} mSource The data source for the object * @returns {function} Data set function * @memberof DataTable#oApi */ function _fnSetObjectDataFn( mSource ) { if ( $.isPlainObject( mSource ) ) { /* Unlike get, only the underscore (global) option is used for for * setting data since we don't know the type here. This is why an object * option is not documented for `mData` (which is read/write), but it is * for `mRender` which is read only. */ return _fnSetObjectDataFn( mSource._ ); } else if ( mSource === null ) { /* Nothing to do when the data source is null */ return function () {}; } else if ( typeof mSource === 'function' ) { return function (data, val, meta) { mSource( data, 'set', val, meta ); }; } else if ( typeof mSource === 'string' && (mSource.indexOf('.') !== -1 || mSource.indexOf('[') !== -1 || mSource.indexOf('(') !== -1) ) { /* Like the get, we need to get data from a nested object */ var setData = function (data, val, src) { var a = _fnSplitObjNotation( src ), b; var aLast = a[a.length-1]; var arrayNotation, funcNotation, o, innerSrc; for ( var i=0, iLen=a.length-1 ; i<iLen ; i++ ) { // Check if we are dealing with an array notation request arrayNotation = a[i].match(__reArray); funcNotation = a[i].match(__reFn); if ( arrayNotation ) { a[i] = a[i].replace(__reArray, ''); data[ a[i] ] = []; // Get the remainder of the nested object to set so we can recurse b = a.slice(); b.splice( 0, i+1 ); innerSrc = b.join('.'); // Traverse each entry in the array setting the properties requested if ( $.isArray( val ) ) { for ( var j=0, jLen=val.length ; j<jLen ; j++ ) { o = {}; setData( o, val[j], innerSrc ); data[ a[i] ].push( o ); } } else { // We've been asked to save data to an array, but it // isn't array data to be saved. Best that can be done // is to just save the value. data[ a[i] ] = val; } // The inner call to setData has already traversed through the remainder // of the source and has set the data, thus we can exit here return; } else if ( funcNotation ) { // Function call a[i] = a[i].replace(__reFn, ''); data = data[ a[i] ]( val ); } // If the nested object doesn't currently exist - since we are // trying to set the value - create it if ( data[ a[i] ] === null || data[ a[i] ] === undefined ) { data[ a[i] ] = {}; } data = data[ a[i] ]; } // Last item in the input - i.e, the actual set if ( aLast.match(__reFn ) ) { // Function call data = data[ aLast.replace(__reFn, '') ]( val ); } else { // If array notation is used, we just want to strip it and use the property name // and assign the value. If it isn't used, then we get the result we want anyway data[ aLast.replace(__reArray, '') ] = val; } }; return function (data, val) { // meta is also passed in, but not used return setData( data, val, mSource ); }; } else { /* Array or flat object mapping */ return function (data, val) { // meta is also passed in, but not used data[mSource] = val; }; } } /** * Return an array with the full table data * @param {object} oSettings dataTables settings object * @returns array {array} aData Master data array * @memberof DataTable#oApi */ function _fnGetDataMaster ( settings ) { return _pluck( settings.aoData, '_aData' ); } /** * Nuke the table * @param {object} oSettings dataTables settings object * @memberof DataTable#oApi */ function _fnClearTable( settings ) { settings.aoData.length = 0; settings.aiDisplayMaster.length = 0; settings.aiDisplay.length = 0; settings.aIds = {}; } /** * Take an array of integers (index array) and remove a target integer (value - not * the key!) * @param {array} a Index array to target * @param {int} iTarget value to find * @memberof DataTable#oApi */ function _fnDeleteIndex( a, iTarget, splice ) { var iTargetIndex = -1; for ( var i=0, iLen=a.length ; i<iLen ; i++ ) { if ( a[i] == iTarget ) { iTargetIndex = i; } else if ( a[i] > iTarget ) { a[i]--; } } if ( iTargetIndex != -1 && splice === undefined ) { a.splice( iTargetIndex, 1 ); } } /** * Mark cached data as invalid such that a re-read of the data will occur when * the cached data is next requested. Also update from the data source object. * * @param {object} settings DataTables settings object * @param {int} rowIdx Row index to invalidate * @param {string} [src] Source to invalidate from: undefined, 'auto', 'dom' * or 'data' * @param {int} [colIdx] Column index to invalidate. If undefined the whole * row will be invalidated * @memberof DataTable#oApi * * @todo For the modularisation of v1.11 this will need to become a callback, so * the sort and filter methods can subscribe to it. That will required * initialisation options for sorting, which is why it is not already baked in */ function _fnInvalidate( settings, rowIdx, src, colIdx ) { var row = settings.aoData[ rowIdx ]; var i, ien; var cellWrite = function ( cell, col ) { // This is very frustrating, but in IE if you just write directly // to innerHTML, and elements that are overwritten are GC'ed, // even if there is a reference to them elsewhere while ( cell.childNodes.length ) { cell.removeChild( cell.firstChild ); } cell.innerHTML = _fnGetCellData( settings, rowIdx, col, 'display' ); }; // Are we reading last data from DOM or the data object? if ( src === 'dom' || ((! src || src === 'auto') && row.src === 'dom') ) { // Read the data from the DOM row._aData = _fnGetRowElements( settings, row, colIdx, colIdx === undefined ? undefined : row._aData ) .data; } else { // Reading from data object, update the DOM var cells = row.anCells; if ( cells ) { if ( colIdx !== undefined ) { cellWrite( cells[colIdx], colIdx ); } else { for ( i=0, ien=cells.length ; i<ien ; i++ ) { cellWrite( cells[i], i ); } } } } // For both row and cell invalidation, the cached data for sorting and // filtering is nulled out row._aSortData = null; row._aFilterData = null; // Invalidate the type for a specific column (if given) or all columns since // the data might have changed var cols = settings.aoColumns; if ( colIdx !== undefined ) { cols[ colIdx ].sType = null; } else { for ( i=0, ien=cols.length ; i<ien ; i++ ) { cols[i].sType = null; } // Update DataTables special `DT_*` attributes for the row _fnRowAttributes( settings, row ); } } /** * Build a data source object from an HTML row, reading the contents of the * cells that are in the row. * * @param {object} settings DataTables settings object * @param {node|object} TR element from which to read data or existing row * object from which to re-read the data from the cells * @param {int} [colIdx] Optional column index * @param {array|object} [d] Data source object. If `colIdx` is given then this * parameter should also be given and will be used to write the data into. * Only the column in question will be written * @returns {object} Object with two parameters: `data` the data read, in * document order, and `cells` and array of nodes (they can be useful to the * caller, so rather than needing a second traversal to get them, just return * them from here). * @memberof DataTable#oApi */ function _fnGetRowElements( settings, row, colIdx, d ) { var tds = [], td = row.firstChild, name, col, o, i=0, contents, columns = settings.aoColumns, objectRead = settings._rowReadObject; // Allow the data object to be passed in, or construct d = d !== undefined ? d : objectRead ? {} : []; var attr = function ( str, td ) { if ( typeof str === 'string' ) { var idx = str.indexOf('@'); if ( idx !== -1 ) { var attr = str.substring( idx+1 ); var setter = _fnSetObjectDataFn( str ); setter( d, td.getAttribute( attr ) ); } } }; // Read data from a cell and store into the data object var cellProcess = function ( cell ) { if ( colIdx === undefined || colIdx === i ) { col = columns[i]; contents = $.trim(cell.innerHTML); if ( col && col._bAttrSrc ) { var setter = _fnSetObjectDataFn( col.mData._ ); setter( d, contents ); attr( col.mData.sort, cell ); attr( col.mData.type, cell ); attr( col.mData.filter, cell ); } else { // Depending on the `data` option for the columns the data can // be read to either an object or an array. if ( objectRead ) { if ( ! col._setter ) { // Cache the setter function col._setter = _fnSetObjectDataFn( col.mData ); } col._setter( d, contents ); } else { d[i] = contents; } } } i++; }; if ( td ) { // `tr` element was passed in while ( td ) { name = td.nodeName.toUpperCase(); if ( name == "TD" || name == "TH" ) { cellProcess( td ); tds.push( td ); } td = td.nextSibling; } } else { // Existing row object passed in tds = row.anCells; for ( var j=0, jen=tds.length ; j<jen ; j++ ) { cellProcess( tds[j] ); } } // Read the ID from the DOM if present var rowNode = row.firstChild ? row : row.nTr; if ( rowNode ) { var id = rowNode.getAttribute( 'id' ); if ( id ) { _fnSetObjectDataFn( settings.rowId )( d, id ); } } return { data: d, cells: tds }; } /** * Create a new TR element (and it's TD children) for a row * @param {object} oSettings dataTables settings object * @param {int} iRow Row to consider * @param {node} [nTrIn] TR element to add to the table - optional. If not given, * DataTables will create a row automatically * @param {array} [anTds] Array of TD|TH elements for the row - must be given * if nTr is. * @memberof DataTable#oApi */ function _fnCreateTr ( oSettings, iRow, nTrIn, anTds ) { var row = oSettings.aoData[iRow], rowData = row._aData, cells = [], nTr, nTd, oCol, i, iLen; if ( row.nTr === null ) { nTr = nTrIn || document.createElement('tr'); row.nTr = nTr; row.anCells = cells; /* Use a private property on the node to allow reserve mapping from the node * to the aoData array for fast look up */ nTr._DT_RowIndex = iRow; /* Special parameters can be given by the data source to be used on the row */ _fnRowAttributes( oSettings, row ); /* Process each column */ for ( i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ ) { oCol = oSettings.aoColumns[i]; nTd = nTrIn ? anTds[i] : document.createElement( oCol.sCellType ); nTd._DT_CellIndex = { row: iRow, column: i }; cells.push( nTd ); // Need to create the HTML if new, or if a rendering function is defined if ( (!nTrIn || oCol.mRender || oCol.mData !== i) && (!$.isPlainObject(oCol.mData) || oCol.mData._ !== i+'.display') ) { nTd.innerHTML = _fnGetCellData( oSettings, iRow, i, 'display' ); } /* Add user defined class */ if ( oCol.sClass ) { nTd.className += ' '+oCol.sClass; } // Visibility - add or remove as required if ( oCol.bVisible && ! nTrIn ) { nTr.appendChild( nTd ); } else if ( ! oCol.bVisible && nTrIn ) { nTd.parentNode.removeChild( nTd ); } if ( oCol.fnCreatedCell ) { oCol.fnCreatedCell.call( oSettings.oInstance, nTd, _fnGetCellData( oSettings, iRow, i ), rowData, iRow, i ); } } _fnCallbackFire( oSettings, 'aoRowCreatedCallback', null, [nTr, rowData, iRow] ); } // Remove once webkit bug 131819 and Chromium bug 365619 have been resolved // and deployed row.nTr.setAttribute( 'role', 'row' ); } /** * Add attributes to a row based on the special `DT_*` parameters in a data * source object. * @param {object} settings DataTables settings object * @param {object} DataTables row object for the row to be modified * @memberof DataTable#oApi */ function _fnRowAttributes( settings, row ) { var tr = row.nTr; var data = row._aData; if ( tr ) { var id = settings.rowIdFn( data ); if ( id ) { tr.id = id; } if ( data.DT_RowClass ) { // Remove any classes added by DT_RowClass before var a = data.DT_RowClass.split(' '); row.__rowc = row.__rowc ? _unique( row.__rowc.concat( a ) ) : a; $(tr) .removeClass( row.__rowc.join(' ') ) .addClass( data.DT_RowClass ); } if ( data.DT_RowAttr ) { $(tr).attr( data.DT_RowAttr ); } if ( data.DT_RowData ) { $(tr).data( data.DT_RowData ); } } } /** * Create the HTML header for the table * @param {object} oSettings dataTables settings object * @memberof DataTable#oApi */ function _fnBuildHead( oSettings ) { var i, ien, cell, row, column; var thead = oSettings.nTHead; var tfoot = oSettings.nTFoot; var createHeader = $('th, td', thead).length === 0; var classes = oSettings.oClasses; var columns = oSettings.aoColumns; if ( createHeader ) { row = $('<tr/>').appendTo( thead ); } for ( i=0, ien=columns.length ; i<ien ; i++ ) { column = columns[i]; cell = $( column.nTh ).addClass( column.sClass ); if ( createHeader ) { cell.appendTo( row ); } // 1.11 move into sorting if ( oSettings.oFeatures.bSort ) { cell.addClass( column.sSortingClass ); if ( column.bSortable !== false ) { cell .attr( 'tabindex', oSettings.iTabIndex ) .attr( 'aria-controls', oSettings.sTableId ); _fnSortAttachListener( oSettings, column.nTh, i ); } } if ( column.sTitle != cell[0].innerHTML ) { cell.html( column.sTitle ); } _fnRenderer( oSettings, 'header' )( oSettings, cell, column, classes ); } if ( createHeader ) { _fnDetectHeader( oSettings.aoHeader, thead ); } /* ARIA role for the rows */ $(thead).find('>tr').attr('role', 'row'); /* Deal with the footer - add classes if required */ $(thead).find('>tr>th, >tr>td').addClass( classes.sHeaderTH ); $(tfoot).find('>tr>th, >tr>td').addClass( classes.sFooterTH ); // Cache the footer cells. Note that we only take the cells from the first // row in the footer. If there is more than one row the user wants to // interact with, they need to use the table().foot() method. Note also this // allows cells to be used for multiple columns using colspan if ( tfoot !== null ) { var cells = oSettings.aoFooter[0]; for ( i=0, ien=cells.length ; i<ien ; i++ ) { column = columns[i]; column.nTf = cells[i].cell; if ( column.sClass ) { $(column.nTf).addClass( column.sClass ); } } } } /** * Draw the header (or footer) element based on the column visibility states. The * methodology here is to use the layout array from _fnDetectHeader, modified for * the instantaneous column visibility, to construct the new layout. The grid is * traversed over cell at a time in a rows x columns grid fashion, although each * cell insert can cover multiple elements in the grid - which is tracks using the * aApplied array. Cell inserts in the grid will only occur where there isn't * already a cell in that position. * @param {object} oSettings dataTables settings object * @param array {objects} aoSource Layout array from _fnDetectHeader * @param {boolean} [bIncludeHidden=false] If true then include the hidden columns in the calc, * @memberof DataTable#oApi */ function _fnDrawHead( oSettings, aoSource, bIncludeHidden ) { var i, iLen, j, jLen, k, kLen, n, nLocalTr; var aoLocal = []; var aApplied = []; var iColumns = oSettings.aoColumns.length; var iRowspan, iColspan; if ( ! aoSource ) { return; } if ( bIncludeHidden === undefined ) { bIncludeHidden = false; } /* Make a copy of the master layout array, but without the visible columns in it */ for ( i=0, iLen=aoSource.length ; i<iLen ; i++ ) { aoLocal[i] = aoSource[i].slice(); aoLocal[i].nTr = aoSource[i].nTr; /* Remove any columns which are currently hidden */ for ( j=iColumns-1 ; j>=0 ; j-- ) { if ( !oSettings.aoColumns[j].bVisible && !bIncludeHidden ) { aoLocal[i].splice( j, 1 ); } } /* Prep the applied array - it needs an element for each row */ aApplied.push( [] ); } for ( i=0, iLen=aoLocal.length ; i<iLen ; i++ ) { nLocalTr = aoLocal[i].nTr; /* All cells are going to be replaced, so empty out the row */ if ( nLocalTr ) { while( (n = nLocalTr.firstChild) ) { nLocalTr.removeChild( n ); } } for ( j=0, jLen=aoLocal[i].length ; j<jLen ; j++ ) { iRowspan = 1; iColspan = 1; /* Check to see if there is already a cell (row/colspan) covering our target * insert point. If there is, then there is nothing to do. */ if ( aApplied[i][j] === undefined ) { nLocalTr.appendChild( aoLocal[i][j].cell ); aApplied[i][j] = 1; /* Expand the cell to cover as many rows as needed */ while ( aoLocal[i+iRowspan] !== undefined && aoLocal[i][j].cell == aoLocal[i+iRowspan][j].cell ) { aApplied[i+iRowspan][j] = 1; iRowspan++; } /* Expand the cell to cover as many columns as needed */ while ( aoLocal[i][j+iColspan] !== undefined && aoLocal[i][j].cell == aoLocal[i][j+iColspan].cell ) { /* Must update the applied array over the rows for the columns */ for ( k=0 ; k<iRowspan ; k++ ) { aApplied[i+k][j+iColspan] = 1; } iColspan++; } /* Do the actual expansion in the DOM */ $(aoLocal[i][j].cell) .attr('rowspan', iRowspan) .attr('colspan', iColspan); } } } } /** * Insert the required TR nodes into the table for display * @param {object} oSettings dataTables settings object * @memberof DataTable#oApi */ function _fnDraw( oSettings ) { /* Provide a pre-callback function which can be used to cancel the draw is false is returned */ var aPreDraw = _fnCallbackFire( oSettings, 'aoPreDrawCallback', 'preDraw', [oSettings] ); if ( $.inArray( false, aPreDraw ) !== -1 ) { _fnProcessingDisplay( oSettings, false ); return; } var i, iLen, n; var anRows = []; var iRowCount = 0; var asStripeClasses = oSettings.asStripeClasses; var iStripes = asStripeClasses.length; var iOpenRows = oSettings.aoOpenRows.length; var oLang = oSettings.oLanguage; var iInitDisplayStart = oSettings.iInitDisplayStart; var bServerSide = _fnDataSource( oSettings ) == 'ssp'; var aiDisplay = oSettings.aiDisplay; oSettings.bDrawing = true; /* Check and see if we have an initial draw position from state saving */ if ( iInitDisplayStart !== undefined && iInitDisplayStart !== -1 ) { oSettings._iDisplayStart = bServerSide ? iInitDisplayStart : iInitDisplayStart >= oSettings.fnRecordsDisplay() ? 0 : iInitDisplayStart; oSettings.iInitDisplayStart = -1; } var iDisplayStart = oSettings._iDisplayStart; var iDisplayEnd = oSettings.fnDisplayEnd(); /* Server-side processing draw intercept */ if ( oSettings.bDeferLoading ) { oSettings.bDeferLoading = false; oSettings.iDraw++; _fnProcessingDisplay( oSettings, false ); } else if ( !bServerSide ) { oSettings.iDraw++; } else if ( !oSettings.bDestroying && !_fnAjaxUpdate( oSettings ) ) { return; } if ( aiDisplay.length !== 0 ) { var iStart = bServerSide ? 0 : iDisplayStart; var iEnd = bServerSide ? oSettings.aoData.length : iDisplayEnd; for ( var j=iStart ; j<iEnd ; j++ ) { var iDataIndex = aiDisplay[j]; var aoData = oSettings.aoData[ iDataIndex ]; if ( aoData.nTr === null ) { _fnCreateTr( oSettings, iDataIndex ); } var nRow = aoData.nTr; /* Remove the old striping classes and then add the new one */ if ( iStripes !== 0 ) { var sStripe = asStripeClasses[ iRowCount % iStripes ]; if ( aoData._sRowStripe != sStripe ) { $(nRow).removeClass( aoData._sRowStripe ).addClass( sStripe ); aoData._sRowStripe = sStripe; } } // Row callback functions - might want to manipulate the row // iRowCount and j are not currently documented. Are they at all // useful? _fnCallbackFire( oSettings, 'aoRowCallback', null, [nRow, aoData._aData, iRowCount, j] ); anRows.push( nRow ); iRowCount++; } } else { /* Table is empty - create a row with an empty message in it */ var sZero = oLang.sZeroRecords; if ( oSettings.iDraw == 1 && _fnDataSource( oSettings ) == 'ajax' ) { sZero = oLang.sLoadingRecords; } else if ( oLang.sEmptyTable && oSettings.fnRecordsTotal() === 0 ) { sZero = oLang.sEmptyTable; } anRows[ 0 ] = $( '<tr/>', { 'class': iStripes ? asStripeClasses[0] : '' } ) .append( $('<td />', { 'valign': 'top', 'colSpan': _fnVisbleColumns( oSettings ), 'class': oSettings.oClasses.sRowEmpty } ).html( sZero ) )[0]; } /* Header and footer callbacks */ _fnCallbackFire( oSettings, 'aoHeaderCallback', 'header', [ $(oSettings.nTHead).children('tr')[0], _fnGetDataMaster( oSettings ), iDisplayStart, iDisplayEnd, aiDisplay ] ); _fnCallbackFire( oSettings, 'aoFooterCallback', 'footer', [ $(oSettings.nTFoot).children('tr')[0], _fnGetDataMaster( oSettings ), iDisplayStart, iDisplayEnd, aiDisplay ] ); var body = $(oSettings.nTBody); body.children().detach(); body.append( $(anRows) ); /* Call all required callback functions for the end of a draw */ _fnCallbackFire( oSettings, 'aoDrawCallback', 'draw', [oSettings] ); /* Draw is complete, sorting and filtering must be as well */ oSettings.bSorted = false; oSettings.bFiltered = false; oSettings.bDrawing = false; } /** * Redraw the table - taking account of the various features which are enabled * @param {object} oSettings dataTables settings object * @param {boolean} [holdPosition] Keep the current paging position. By default * the paging is reset to the first page * @memberof DataTable#oApi */ function _fnReDraw( settings, holdPosition ) { var features = settings.oFeatures, sort = features.bSort, filter = features.bFilter; if ( sort ) { _fnSort( settings ); } if ( filter ) { _fnFilterComplete( settings, settings.oPreviousSearch ); } else { // No filtering, so we want to just use the display master settings.aiDisplay = settings.aiDisplayMaster.slice(); } if ( holdPosition !== true ) { settings._iDisplayStart = 0; } // Let any modules know about the draw hold position state (used by // scrolling internally) settings._drawHold = holdPosition; _fnDraw( settings ); settings._drawHold = false; } /** * Add the options to the page HTML for the table * @param {object} oSettings dataTables settings object * @memberof DataTable#oApi */ function _fnAddOptionsHtml ( oSettings ) { var classes = oSettings.oClasses; var table = $(oSettings.nTable); var holding = $('<div/>').insertBefore( table ); // Holding element for speed var features = oSettings.oFeatures; // All DataTables are wrapped in a div var insert = $('<div/>', { id: oSettings.sTableId+'_wrapper', 'class': classes.sWrapper + (oSettings.nTFoot ? '' : ' '+classes.sNoFooter) } ); oSettings.nHolding = holding[0]; oSettings.nTableWrapper = insert[0]; oSettings.nTableReinsertBefore = oSettings.nTable.nextSibling; /* Loop over the user set positioning and place the elements as needed */ var aDom = oSettings.sDom.split(''); var featureNode, cOption, nNewNode, cNext, sAttr, j; for ( var i=0 ; i<aDom.length ; i++ ) { featureNode = null; cOption = aDom[i]; if ( cOption == '<' ) { /* New container div */ nNewNode = $('<div/>')[0]; /* Check to see if we should append an id and/or a class name to the container */ cNext = aDom[i+1]; if ( cNext == "'" || cNext == '"' ) { sAttr = ""; j = 2; while ( aDom[i+j] != cNext ) { sAttr += aDom[i+j]; j++; } /* Replace jQuery UI constants @todo depreciated */ if ( sAttr == "H" ) { sAttr = classes.sJUIHeader; } else if ( sAttr == "F" ) { sAttr = classes.sJUIFooter; } /* The attribute can be in the format of "#id.class", "#id" or "class" This logic * breaks the string into parts and applies them as needed */ if ( sAttr.indexOf('.') != -1 ) { var aSplit = sAttr.split('.'); nNewNode.id = aSplit[0].substr(1, aSplit[0].length-1); nNewNode.className = aSplit[1]; } else if ( sAttr.charAt(0) == "#" ) { nNewNode.id = sAttr.substr(1, sAttr.length-1); } else { nNewNode.className = sAttr; } i += j; /* Move along the position array */ } insert.append( nNewNode ); insert = $(nNewNode); } else if ( cOption == '>' ) { /* End container div */ insert = insert.parent(); } // @todo Move options into their own plugins? else if ( cOption == 'l' && features.bPaginate && features.bLengthChange ) { /* Length */ featureNode = _fnFeatureHtmlLength( oSettings ); } else if ( cOption == 'f' && features.bFilter ) { /* Filter */ featureNode = _fnFeatureHtmlFilter( oSettings ); } else if ( cOption == 'r' && features.bProcessing ) { /* pRocessing */ featureNode = _fnFeatureHtmlProcessing( oSettings ); } else if ( cOption == 't' ) { /* Table */ featureNode = _fnFeatureHtmlTable( oSettings ); } else if ( cOption == 'i' && features.bInfo ) { /* Info */ featureNode = _fnFeatureHtmlInfo( oSettings ); } else if ( cOption == 'p' && features.bPaginate ) { /* Pagination */ featureNode = _fnFeatureHtmlPaginate( oSettings ); } else if ( DataTable.ext.feature.length !== 0 ) { /* Plug-in features */ var aoFeatures = DataTable.ext.feature; for ( var k=0, kLen=aoFeatures.length ; k<kLen ; k++ ) { if ( cOption == aoFeatures[k].cFeature ) { featureNode = aoFeatures[k].fnInit( oSettings ); break; } } } /* Add to the 2D features array */ if ( featureNode ) { var aanFeatures = oSettings.aanFeatures; if ( ! aanFeatures[cOption] ) { aanFeatures[cOption] = []; } aanFeatures[cOption].push( featureNode ); insert.append( featureNode ); } } /* Built our DOM structure - replace the holding div with what we want */ holding.replaceWith( insert ); oSettings.nHolding = null; } /** * Use the DOM source to create up an array of header cells. The idea here is to * create a layout grid (array) of rows x columns, which contains a reference * to the cell that that point in the grid (regardless of col/rowspan), such that * any column / row could be removed and the new grid constructed * @param array {object} aLayout Array to store the calculated layout in * @param {node} nThead The header/footer element for the table * @memberof DataTable#oApi */ function _fnDetectHeader ( aLayout, nThead ) { var nTrs = $(nThead).children('tr'); var nTr, nCell; var i, k, l, iLen, jLen, iColShifted, iColumn, iColspan, iRowspan; var bUnique; var fnShiftCol = function ( a, i, j ) { var k = a[i]; while ( k[j] ) { j++; } return j; }; aLayout.splice( 0, aLayout.length ); /* We know how many rows there are in the layout - so prep it */ for ( i=0, iLen=nTrs.length ; i<iLen ; i++ ) { aLayout.push( [] ); } /* Calculate a layout array */ for ( i=0, iLen=nTrs.length ; i<iLen ; i++ ) { nTr = nTrs[i]; iColumn = 0; /* For every cell in the row... */ nCell = nTr.firstChild; while ( nCell ) { if ( nCell.nodeName.toUpperCase() == "TD" || nCell.nodeName.toUpperCase() == "TH" ) { /* Get the col and rowspan attributes from the DOM and sanitise them */ iColspan = nCell.getAttribute('colspan') * 1; iRowspan = nCell.getAttribute('rowspan') * 1; iColspan = (!iColspan || iColspan===0 || iColspan===1) ? 1 : iColspan; iRowspan = (!iRowspan || iRowspan===0 || iRowspan===1) ? 1 : iRowspan; /* There might be colspan cells already in this row, so shift our target * accordingly */ iColShifted = fnShiftCol( aLayout, i, iColumn ); /* Cache calculation for unique columns */ bUnique = iColspan === 1 ? true : false; /* If there is col / rowspan, copy the information into the layout grid */ for ( l=0 ; l<iColspan ; l++ ) { for ( k=0 ; k<iRowspan ; k++ ) { aLayout[i+k][iColShifted+l] = { "cell": nCell, "unique": bUnique }; aLayout[i+k].nTr = nTr; } } } nCell = nCell.nextSibling; } } } /** * Get an array of unique th elements, one for each column * @param {object} oSettings dataTables settings object * @param {node} nHeader automatically detect the layout from this node - optional * @param {array} aLayout thead/tfoot layout from _fnDetectHeader - optional * @returns array {node} aReturn list of unique th's * @memberof DataTable#oApi */ function _fnGetUniqueThs ( oSettings, nHeader, aLayout ) { var aReturn = []; if ( !aLayout ) { aLayout = oSettings.aoHeader; if ( nHeader ) { aLayout = []; _fnDetectHeader( aLayout, nHeader ); } } for ( var i=0, iLen=aLayout.length ; i<iLen ; i++ ) { for ( var j=0, jLen=aLayout[i].length ; j<jLen ; j++ ) { if ( aLayout[i][j].unique && (!aReturn[j] || !oSettings.bSortCellsTop) ) { aReturn[j] = aLayout[i][j].cell; } } } return aReturn; } /** * Create an Ajax call based on the table's settings, taking into account that * parameters can have multiple forms, and backwards compatibility. * * @param {object} oSettings dataTables settings object * @param {array} data Data to send to the server, required by * DataTables - may be augmented by developer callbacks * @param {function} fn Callback function to run when data is obtained */ function _fnBuildAjax( oSettings, data, fn ) { // Compatibility with 1.9-, allow fnServerData and event to manipulate _fnCallbackFire( oSettings, 'aoServerParams', 'serverParams', [data] ); // Convert to object based for 1.10+ if using the old array scheme which can // come from server-side processing or serverParams if ( data && $.isArray(data) ) { var tmp = {}; var rbracket = /(.*?)\[\]$/; $.each( data, function (key, val) { var match = val.name.match(rbracket); if ( match ) { // Support for arrays var name = match[0]; if ( ! tmp[ name ] ) { tmp[ name ] = []; } tmp[ name ].push( val.value ); } else { tmp[val.name] = val.value; } } ); data = tmp; } var ajaxData; var ajax = oSettings.ajax; var instance = oSettings.oInstance; var callback = function ( json ) { _fnCallbackFire( oSettings, null, 'xhr', [oSettings, json, oSettings.jqXHR] ); fn( json ); }; if ( $.isPlainObject( ajax ) && ajax.data ) { ajaxData = ajax.data; var newData = $.isFunction( ajaxData ) ? ajaxData( data, oSettings ) : // fn can manipulate data or return ajaxData; // an object object or array to merge // If the function returned something, use that alone data = $.isFunction( ajaxData ) && newData ? newData : $.extend( true, data, newData ); // Remove the data property as we've resolved it already and don't want // jQuery to do it again (it is restored at the end of the function) delete ajax.data; } var baseAjax = { "data": data, "success": function (json) { var error = json.error || json.sError; if ( error ) { _fnLog( oSettings, 0, error ); } oSettings.json = json; callback( json ); }, "dataType": "json", "cache": false, "type": oSettings.sServerMethod, "error": function (xhr, error, thrown) { var ret = _fnCallbackFire( oSettings, null, 'xhr', [oSettings, null, oSettings.jqXHR] ); if ( $.inArray( true, ret ) === -1 ) { if ( error == "parsererror" ) { _fnLog( oSettings, 0, 'Invalid JSON response', 1 ); } else if ( xhr.readyState === 4 ) { _fnLog( oSettings, 0, 'Ajax error', 7 ); } } _fnProcessingDisplay( oSettings, false ); } }; // Store the data submitted for the API oSettings.oAjaxData = data; // Allow plug-ins and external processes to modify the data _fnCallbackFire( oSettings, null, 'preXhr', [oSettings, data] ); if ( oSettings.fnServerData ) { // DataTables 1.9- compatibility oSettings.fnServerData.call( instance, oSettings.sAjaxSource, $.map( data, function (val, key) { // Need to convert back to 1.9 trad format return { name: key, value: val }; } ), callback, oSettings ); } else if ( oSettings.sAjaxSource || typeof ajax === 'string' ) { // DataTables 1.9- compatibility oSettings.jqXHR = $.ajax( $.extend( baseAjax, { url: ajax || oSettings.sAjaxSource } ) ); } else if ( $.isFunction( ajax ) ) { // Is a function - let the caller define what needs to be done oSettings.jqXHR = ajax.call( instance, data, callback, oSettings ); } else { // Object to extend the base settings oSettings.jqXHR = $.ajax( $.extend( baseAjax, ajax ) ); // Restore for next time around ajax.data = ajaxData; } } /** * Update the table using an Ajax call * @param {object} settings dataTables settings object * @returns {boolean} Block the table drawing or not * @memberof DataTable#oApi */ function _fnAjaxUpdate( settings ) { if ( settings.bAjaxDataGet ) { settings.iDraw++; _fnProcessingDisplay( settings, true ); _fnBuildAjax( settings, _fnAjaxParameters( settings ), function(json) { _fnAjaxUpdateDraw( settings, json ); } ); return false; } return true; } /** * Build up the parameters in an object needed for a server-side processing * request. Note that this is basically done twice, is different ways - a modern * method which is used by default in DataTables 1.10 which uses objects and * arrays, or the 1.9- method with is name / value pairs. 1.9 method is used if * the sAjaxSource option is used in the initialisation, or the legacyAjax * option is set. * @param {object} oSettings dataTables settings object * @returns {bool} block the table drawing or not * @memberof DataTable#oApi */ function _fnAjaxParameters( settings ) { var columns = settings.aoColumns, columnCount = columns.length, features = settings.oFeatures, preSearch = settings.oPreviousSearch, preColSearch = settings.aoPreSearchCols, i, data = [], dataProp, column, columnSearch, sort = _fnSortFlatten( settings ), displayStart = settings._iDisplayStart, displayLength = features.bPaginate !== false ? settings._iDisplayLength : -1; var param = function ( name, value ) { data.push( { 'name': name, 'value': value } ); }; // DataTables 1.9- compatible method param( 'sEcho', settings.iDraw ); param( 'iColumns', columnCount ); param( 'sColumns', _pluck( columns, 'sName' ).join(',') ); param( 'iDisplayStart', displayStart ); param( 'iDisplayLength', displayLength ); // DataTables 1.10+ method var d = { draw: settings.iDraw, columns: [], order: [], start: displayStart, length: displayLength, search: { value: preSearch.sSearch, regex: preSearch.bRegex } }; for ( i=0 ; i<columnCount ; i++ ) { column = columns[i]; columnSearch = preColSearch[i]; dataProp = typeof column.mData=="function" ? 'function' : column.mData ; d.columns.push( { data: dataProp, name: column.sName, searchable: column.bSearchable, orderable: column.bSortable, search: { value: columnSearch.sSearch, regex: columnSearch.bRegex } } ); param( "mDataProp_"+i, dataProp ); if ( features.bFilter ) { param( 'sSearch_'+i, columnSearch.sSearch ); param( 'bRegex_'+i, columnSearch.bRegex ); param( 'bSearchable_'+i, column.bSearchable ); } if ( features.bSort ) { param( 'bSortable_'+i, column.bSortable ); } } if ( features.bFilter ) { param( 'sSearch', preSearch.sSearch ); param( 'bRegex', preSearch.bRegex ); } if ( features.bSort ) { $.each( sort, function ( i, val ) { d.order.push( { column: val.col, dir: val.dir } ); param( 'iSortCol_'+i, val.col ); param( 'sSortDir_'+i, val.dir ); } ); param( 'iSortingCols', sort.length ); } // If the legacy.ajax parameter is null, then we automatically decide which // form to use, based on sAjaxSource var legacy = DataTable.ext.legacy.ajax; if ( legacy === null ) { return settings.sAjaxSource ? data : d; } // Otherwise, if legacy has been specified then we use that to decide on the // form return legacy ? data : d; } /** * Data the data from the server (nuking the old) and redraw the table * @param {object} oSettings dataTables settings object * @param {object} json json data return from the server. * @param {string} json.sEcho Tracking flag for DataTables to match requests * @param {int} json.iTotalRecords Number of records in the data set, not accounting for filtering * @param {int} json.iTotalDisplayRecords Number of records in the data set, accounting for filtering * @param {array} json.aaData The data to display on this page * @param {string} [json.sColumns] Column ordering (sName, comma separated) * @memberof DataTable#oApi */ function _fnAjaxUpdateDraw ( settings, json ) { // v1.10 uses camelCase variables, while 1.9 uses Hungarian notation. // Support both var compat = function ( old, modern ) { return json[old] !== undefined ? json[old] : json[modern]; }; var data = _fnAjaxDataSrc( settings, json ); var draw = compat( 'sEcho', 'draw' ); var recordsTotal = compat( 'iTotalRecords', 'recordsTotal' ); var recordsFiltered = compat( 'iTotalDisplayRecords', 'recordsFiltered' ); if ( draw ) { // Protect against out of sequence returns if ( draw*1 < settings.iDraw ) { return; } settings.iDraw = draw * 1; } _fnClearTable( settings ); settings._iRecordsTotal = parseInt(recordsTotal, 10); settings._iRecordsDisplay = parseInt(recordsFiltered, 10); for ( var i=0, ien=data.length ; i<ien ; i++ ) { _fnAddData( settings, data[i] ); } settings.aiDisplay = settings.aiDisplayMaster.slice(); settings.bAjaxDataGet = false; _fnDraw( settings ); if ( ! settings._bInitComplete ) { _fnInitComplete( settings, json ); } settings.bAjaxDataGet = true; _fnProcessingDisplay( settings, false ); } /** * Get the data from the JSON data source to use for drawing a table. Using * `_fnGetObjectDataFn` allows the data to be sourced from a property of the * source object, or from a processing function. * @param {object} oSettings dataTables settings object * @param {object} json Data source object / array from the server * @return {array} Array of data to use */ function _fnAjaxDataSrc ( oSettings, json ) { var dataSrc = $.isPlainObject( oSettings.ajax ) && oSettings.ajax.dataSrc !== undefined ? oSettings.ajax.dataSrc : oSettings.sAjaxDataProp; // Compatibility with 1.9-. // Compatibility with 1.9-. In order to read from aaData, check if the // default has been changed, if not, check for aaData if ( dataSrc === 'data' ) { return json.aaData || json[dataSrc]; } return dataSrc !== "" ? _fnGetObjectDataFn( dataSrc )( json ) : json; } /** * Generate the node required for filtering text * @returns {node} Filter control element * @param {object} oSettings dataTables settings object * @memberof DataTable#oApi */ function _fnFeatureHtmlFilter ( settings ) { var classes = settings.oClasses; var tableId = settings.sTableId; var language = settings.oLanguage; var previousSearch = settings.oPreviousSearch; var features = settings.aanFeatures; var input = '<input type="search" class="'+classes.sFilterInput+'"/>'; var str = language.sSearch; str = str.match(/_INPUT_/) ? str.replace('_INPUT_', input) : str+input; var filter = $('<div/>', { 'id': ! features.f ? tableId+'_filter' : null, 'class': classes.sFilter } ) .append( $('<label/>' ).append( str ) ); var searchFn = function() { /* Update all other filter input elements for the new display */ var n = features.f; var val = !this.value ? "" : this.value; // mental IE8 fix :-( /* Now do the filter */ if ( val != previousSearch.sSearch ) { _fnFilterComplete( settings, { "sSearch": val, "bRegex": previousSearch.bRegex, "bSmart": previousSearch.bSmart , "bCaseInsensitive": previousSearch.bCaseInsensitive } ); // Need to redraw, without resorting settings._iDisplayStart = 0; _fnDraw( settings ); } }; var searchDelay = settings.searchDelay !== null ? settings.searchDelay : _fnDataSource( settings ) === 'ssp' ? 400 : 0; var jqFilter = $('input', filter) .val( previousSearch.sSearch ) .attr( 'placeholder', language.sSearchPlaceholder ) .on( 'keyup.DT search.DT input.DT paste.DT cut.DT', searchDelay ? _fnThrottle( searchFn, searchDelay ) : searchFn ) .on( 'keypress.DT', function(e) { /* Prevent form submission */ if ( e.keyCode == 13 ) { return false; } } ) .attr('aria-controls', tableId); // Update the input elements whenever the table is filtered $(settings.nTable).on( 'search.dt.DT', function ( ev, s ) { if ( settings === s ) { // IE9 throws an 'unknown error' if document.activeElement is used // inside an iframe or frame... try { if ( jqFilter[0] !== document.activeElement ) { jqFilter.val( previousSearch.sSearch ); } } catch ( e ) {} } } ); return filter[0]; } /** * Filter the table using both the global filter and column based filtering * @param {object} oSettings dataTables settings object * @param {object} oSearch search information * @param {int} [iForce] force a research of the master array (1) or not (undefined or 0) * @memberof DataTable#oApi */ function _fnFilterComplete ( oSettings, oInput, iForce ) { var oPrevSearch = oSettings.oPreviousSearch; var aoPrevSearch = oSettings.aoPreSearchCols; var fnSaveFilter = function ( oFilter ) { /* Save the filtering values */ oPrevSearch.sSearch = oFilter.sSearch; oPrevSearch.bRegex = oFilter.bRegex; oPrevSearch.bSmart = oFilter.bSmart; oPrevSearch.bCaseInsensitive = oFilter.bCaseInsensitive; }; var fnRegex = function ( o ) { // Backwards compatibility with the bEscapeRegex option return o.bEscapeRegex !== undefined ? !o.bEscapeRegex : o.bRegex; }; // Resolve any column types that are unknown due to addition or invalidation // @todo As per sort - can this be moved into an event handler? _fnColumnTypes( oSettings ); /* In server-side processing all filtering is done by the server, so no point hanging around here */ if ( _fnDataSource( oSettings ) != 'ssp' ) { /* Global filter */ _fnFilter( oSettings, oInput.sSearch, iForce, fnRegex(oInput), oInput.bSmart, oInput.bCaseInsensitive ); fnSaveFilter( oInput ); /* Now do the individual column filter */ for ( var i=0 ; i<aoPrevSearch.length ; i++ ) { _fnFilterColumn( oSettings, aoPrevSearch[i].sSearch, i, fnRegex(aoPrevSearch[i]), aoPrevSearch[i].bSmart, aoPrevSearch[i].bCaseInsensitive ); } /* Custom filtering */ _fnFilterCustom( oSettings ); } else { fnSaveFilter( oInput ); } /* Tell the draw function we have been filtering */ oSettings.bFiltered = true; _fnCallbackFire( oSettings, null, 'search', [oSettings] ); } /** * Apply custom filtering functions * @param {object} oSettings dataTables settings object * @memberof DataTable#oApi */ function _fnFilterCustom( settings ) { var filters = DataTable.ext.search; var displayRows = settings.aiDisplay; var row, rowIdx; for ( var i=0, ien=filters.length ; i<ien ; i++ ) { var rows = []; // Loop over each row and see if it should be included for ( var j=0, jen=displayRows.length ; j<jen ; j++ ) { rowIdx = displayRows[ j ]; row = settings.aoData[ rowIdx ]; if ( filters[i]( settings, row._aFilterData, rowIdx, row._aData, j ) ) { rows.push( rowIdx ); } } // So the array reference doesn't break set the results into the // existing array displayRows.length = 0; $.merge( displayRows, rows ); } } /** * Filter the table on a per-column basis * @param {object} oSettings dataTables settings object * @param {string} sInput string to filter on * @param {int} iColumn column to filter * @param {bool} bRegex treat search string as a regular expression or not * @param {bool} bSmart use smart filtering or not * @param {bool} bCaseInsensitive Do case insenstive matching or not * @memberof DataTable#oApi */ function _fnFilterColumn ( settings, searchStr, colIdx, regex, smart, caseInsensitive ) { if ( searchStr === '' ) { return; } var data; var out = []; var display = settings.aiDisplay; var rpSearch = _fnFilterCreateSearch( searchStr, regex, smart, caseInsensitive ); for ( var i=0 ; i<display.length ; i++ ) { data = settings.aoData[ display[i] ]._aFilterData[ colIdx ]; if ( rpSearch.test( data ) ) { out.push( display[i] ); } } settings.aiDisplay = out; } /** * Filter the data table based on user input and draw the table * @param {object} settings dataTables settings object * @param {string} input string to filter on * @param {int} force optional - force a research of the master array (1) or not (undefined or 0) * @param {bool} regex treat as a regular expression or not * @param {bool} smart perform smart filtering or not * @param {bool} caseInsensitive Do case insenstive matching or not * @memberof DataTable#oApi */ function _fnFilter( settings, input, force, regex, smart, caseInsensitive ) { var rpSearch = _fnFilterCreateSearch( input, regex, smart, caseInsensitive ); var prevSearch = settings.oPreviousSearch.sSearch; var displayMaster = settings.aiDisplayMaster; var display, invalidated, i; var filtered = []; // Need to take account of custom filtering functions - always filter if ( DataTable.ext.search.length !== 0 ) { force = true; } // Check if any of the rows were invalidated invalidated = _fnFilterData( settings ); // If the input is blank - we just want the full data set if ( input.length <= 0 ) { settings.aiDisplay = displayMaster.slice(); } else { // New search - start from the master array if ( invalidated || force || prevSearch.length > input.length || input.indexOf(prevSearch) !== 0 || settings.bSorted // On resort, the display master needs to be // re-filtered since indexes will have changed ) { settings.aiDisplay = displayMaster.slice(); } // Search the display array display = settings.aiDisplay; for ( i=0 ; i<display.length ; i++ ) { if ( rpSearch.test( settings.aoData[ display[i] ]._sFilterRow ) ) { filtered.push( display[i] ); } } settings.aiDisplay = filtered; } } /** * Build a regular expression object suitable for searching a table * @param {string} sSearch string to search for * @param {bool} bRegex treat as a regular expression or not * @param {bool} bSmart perform smart filtering or not * @param {bool} bCaseInsensitive Do case insensitive matching or not * @returns {RegExp} constructed object * @memberof DataTable#oApi */ function _fnFilterCreateSearch( search, regex, smart, caseInsensitive ) { search = regex ? search : _fnEscapeRegex( search ); if ( smart ) { /* For smart filtering we want to allow the search to work regardless of * word order. We also want double quoted text to be preserved, so word * order is important - a la google. So this is what we want to * generate: * * ^(?=.*?\bone\b)(?=.*?\btwo three\b)(?=.*?\bfour\b).*$ */ var a = $.map( search.match( /"[^"]+"|[^ ]+/g ) || [''], function ( word ) { if ( word.charAt(0) === '"' ) { var m = word.match( /^"(.*)"$/ ); word = m ? m[1] : word; } return word.replace('"', ''); } ); search = '^(?=.*?'+a.join( ')(?=.*?' )+').*$'; } return new RegExp( search, caseInsensitive ? 'i' : '' ); } /** * Escape a string such that it can be used in a regular expression * @param {string} sVal string to escape * @returns {string} escaped string * @memberof DataTable#oApi */ var _fnEscapeRegex = DataTable.util.escapeRegex; var __filter_div = $('<div>')[0]; var __filter_div_textContent = __filter_div.textContent !== undefined; // Update the filtering data for each row if needed (by invalidation or first run) function _fnFilterData ( settings ) { var columns = settings.aoColumns; var column; var i, j, ien, jen, filterData, cellData, row; var fomatters = DataTable.ext.type.search; var wasInvalidated = false; for ( i=0, ien=settings.aoData.length ; i<ien ; i++ ) { row = settings.aoData[i]; if ( ! row._aFilterData ) { filterData = []; for ( j=0, jen=columns.length ; j<jen ; j++ ) { column = columns[j]; if ( column.bSearchable ) { cellData = _fnGetCellData( settings, i, j, 'filter' ); if ( fomatters[ column.sType ] ) { cellData = fomatters[ column.sType ]( cellData ); } // Search in DataTables 1.10 is string based. In 1.11 this // should be altered to also allow strict type checking. if ( cellData === null ) { cellData = ''; } if ( typeof cellData !== 'string' && cellData.toString ) { cellData = cellData.toString(); } } else { cellData = ''; } // If it looks like there is an HTML entity in the string, // attempt to decode it so sorting works as expected. Note that // we could use a single line of jQuery to do this, but the DOM // method used here is much faster http://jsperf.com/html-decode if ( cellData.indexOf && cellData.indexOf('&') !== -1 ) { __filter_div.innerHTML = cellData; cellData = __filter_div_textContent ? __filter_div.textContent : __filter_div.innerText; } if ( cellData.replace ) { cellData = cellData.replace(/[\r\n]/g, ''); } filterData.push( cellData ); } row._aFilterData = filterData; row._sFilterRow = filterData.join(' '); wasInvalidated = true; } } return wasInvalidated; } /** * Convert from the internal Hungarian notation to camelCase for external * interaction * @param {object} obj Object to convert * @returns {object} Inverted object * @memberof DataTable#oApi */ function _fnSearchToCamel ( obj ) { return { search: obj.sSearch, smart: obj.bSmart, regex: obj.bRegex, caseInsensitive: obj.bCaseInsensitive }; } /** * Convert from camelCase notation to the internal Hungarian. We could use the * Hungarian convert function here, but this is cleaner * @param {object} obj Object to convert * @returns {object} Inverted object * @memberof DataTable#oApi */ function _fnSearchToHung ( obj ) { return { sSearch: obj.search, bSmart: obj.smart, bRegex: obj.regex, bCaseInsensitive: obj.caseInsensitive }; } /** * Generate the node required for the info display * @param {object} oSettings dataTables settings object * @returns {node} Information element * @memberof DataTable#oApi */ function _fnFeatureHtmlInfo ( settings ) { var tid = settings.sTableId, nodes = settings.aanFeatures.i, n = $('<div/>', { 'class': settings.oClasses.sInfo, 'id': ! nodes ? tid+'_info' : null } ); if ( ! nodes ) { // Update display on each draw settings.aoDrawCallback.push( { "fn": _fnUpdateInfo, "sName": "information" } ); n .attr( 'role', 'status' ) .attr( 'aria-live', 'polite' ); // Table is described by our info div $(settings.nTable).attr( 'aria-describedby', tid+'_info' ); } return n[0]; } /** * Update the information elements in the display * @param {object} settings dataTables settings object * @memberof DataTable#oApi */ function _fnUpdateInfo ( settings ) { /* Show information about the table */ var nodes = settings.aanFeatures.i; if ( nodes.length === 0 ) { return; } var lang = settings.oLanguage, start = settings._iDisplayStart+1, end = settings.fnDisplayEnd(), max = settings.fnRecordsTotal(), total = settings.fnRecordsDisplay(), out = total ? lang.sInfo : lang.sInfoEmpty; if ( total !== max ) { /* Record set after filtering */ out += ' ' + lang.sInfoFiltered; } // Convert the macros out += lang.sInfoPostFix; out = _fnInfoMacros( settings, out ); var callback = lang.fnInfoCallback; if ( callback !== null ) { out = callback.call( settings.oInstance, settings, start, end, max, total, out ); } $(nodes).html( out ); } function _fnInfoMacros ( settings, str ) { // When infinite scrolling, we are always starting at 1. _iDisplayStart is used only // internally var formatter = settings.fnFormatNumber, start = settings._iDisplayStart+1, len = settings._iDisplayLength, vis = settings.fnRecordsDisplay(), all = len === -1; return str. replace(/_START_/g, formatter.call( settings, start ) ). replace(/_END_/g, formatter.call( settings, settings.fnDisplayEnd() ) ). replace(/_MAX_/g, formatter.call( settings, settings.fnRecordsTotal() ) ). replace(/_TOTAL_/g, formatter.call( settings, vis ) ). replace(/_PAGE_/g, formatter.call( settings, all ? 1 : Math.ceil( start / len ) ) ). replace(/_PAGES_/g, formatter.call( settings, all ? 1 : Math.ceil( vis / len ) ) ); } /** * Draw the table for the first time, adding all required features * @param {object} settings dataTables settings object * @memberof DataTable#oApi */ function _fnInitialise ( settings ) { var i, iLen, iAjaxStart=settings.iInitDisplayStart; var columns = settings.aoColumns, column; var features = settings.oFeatures; var deferLoading = settings.bDeferLoading; // value modified by the draw /* Ensure that the table data is fully initialised */ if ( ! settings.bInitialised ) { setTimeout( function(){ _fnInitialise( settings ); }, 200 ); return; } /* Show the display HTML options */ _fnAddOptionsHtml( settings ); /* Build and draw the header / footer for the table */ _fnBuildHead( settings ); _fnDrawHead( settings, settings.aoHeader ); _fnDrawHead( settings, settings.aoFooter ); /* Okay to show that something is going on now */ _fnProcessingDisplay( settings, true ); /* Calculate sizes for columns */ if ( features.bAutoWidth ) { _fnCalculateColumnWidths( settings ); } for ( i=0, iLen=columns.length ; i<iLen ; i++ ) { column = columns[i]; if ( column.sWidth ) { column.nTh.style.width = _fnStringToCss( column.sWidth ); } } _fnCallbackFire( settings, null, 'preInit', [settings] ); // If there is default sorting required - let's do it. The sort function // will do the drawing for us. Otherwise we draw the table regardless of the // Ajax source - this allows the table to look initialised for Ajax sourcing // data (show 'loading' message possibly) _fnReDraw( settings ); // Server-side processing init complete is done by _fnAjaxUpdateDraw var dataSrc = _fnDataSource( settings ); if ( dataSrc != 'ssp' || deferLoading ) { // if there is an ajax source load the data if ( dataSrc == 'ajax' ) { _fnBuildAjax( settings, [], function(json) { var aData = _fnAjaxDataSrc( settings, json ); // Got the data - add it to the table for ( i=0 ; i<aData.length ; i++ ) { _fnAddData( settings, aData[i] ); } // Reset the init display for cookie saving. We've already done // a filter, and therefore cleared it before. So we need to make // it appear 'fresh' settings.iInitDisplayStart = iAjaxStart; _fnReDraw( settings ); _fnProcessingDisplay( settings, false ); _fnInitComplete( settings, json ); }, settings ); } else { _fnProcessingDisplay( settings, false ); _fnInitComplete( settings ); } } } /** * Draw the table for the first time, adding all required features * @param {object} oSettings dataTables settings object * @param {object} [json] JSON from the server that completed the table, if using Ajax source * with client-side processing (optional) * @memberof DataTable#oApi */ function _fnInitComplete ( settings, json ) { settings._bInitComplete = true; // When data was added after the initialisation (data or Ajax) we need to // calculate the column sizing if ( json || settings.oInit.aaData ) { _fnAdjustColumnSizing( settings ); } _fnCallbackFire( settings, null, 'plugin-init', [settings, json] ); _fnCallbackFire( settings, 'aoInitComplete', 'init', [settings, json] ); } function _fnLengthChange ( settings, val ) { var len = parseInt( val, 10 ); settings._iDisplayLength = len; _fnLengthOverflow( settings ); // Fire length change event _fnCallbackFire( settings, null, 'length', [settings, len] ); } /** * Generate the node required for user display length changing * @param {object} settings dataTables settings object * @returns {node} Display length feature node * @memberof DataTable#oApi */ function _fnFeatureHtmlLength ( settings ) { var classes = settings.oClasses, tableId = settings.sTableId, menu = settings.aLengthMenu, d2 = $.isArray( menu[0] ), lengths = d2 ? menu[0] : menu, language = d2 ? menu[1] : menu; var select = $('<select/>', { 'name': tableId+'_length', 'aria-controls': tableId, 'class': classes.sLengthSelect } ); for ( var i=0, ien=lengths.length ; i<ien ; i++ ) { select[0][ i ] = new Option( language[i], lengths[i] ); } var div = $('<div><label/></div>').addClass( classes.sLength ); if ( ! settings.aanFeatures.l ) { div[0].id = tableId+'_length'; } div.children().append( settings.oLanguage.sLengthMenu.replace( '_MENU_', select[0].outerHTML ) ); // Can't use `select` variable as user might provide their own and the // reference is broken by the use of outerHTML $('select', div) .val( settings._iDisplayLength ) .on( 'change.DT', function(e) { _fnLengthChange( settings, $(this).val() ); _fnDraw( settings ); } ); // Update node value whenever anything changes the table's length $(settings.nTable).on( 'length.dt.DT', function (e, s, len) { if ( settings === s ) { $('select', div).val( len ); } } ); return div[0]; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Note that most of the paging logic is done in * DataTable.ext.pager */ /** * Generate the node required for default pagination * @param {object} oSettings dataTables settings object * @returns {node} Pagination feature node * @memberof DataTable#oApi */ function _fnFeatureHtmlPaginate ( settings ) { var type = settings.sPaginationType, plugin = DataTable.ext.pager[ type ], modern = typeof plugin === 'function', redraw = function( settings ) { _fnDraw( settings ); }, node = $('<div/>').addClass( settings.oClasses.sPaging + type )[0], features = settings.aanFeatures; if ( ! modern ) { plugin.fnInit( settings, node, redraw ); } /* Add a draw callback for the pagination on first instance, to update the paging display */ if ( ! features.p ) { node.id = settings.sTableId+'_paginate'; settings.aoDrawCallback.push( { "fn": function( settings ) { if ( modern ) { var start = settings._iDisplayStart, len = settings._iDisplayLength, visRecords = settings.fnRecordsDisplay(), all = len === -1, page = all ? 0 : Math.ceil( start / len ), pages = all ? 1 : Math.ceil( visRecords / len ), buttons = plugin(page, pages), i, ien; for ( i=0, ien=features.p.length ; i<ien ; i++ ) { _fnRenderer( settings, 'pageButton' )( settings, features.p[i], i, buttons, page, pages ); } } else { plugin.fnUpdate( settings, redraw ); } }, "sName": "pagination" } ); } return node; } /** * Alter the display settings to change the page * @param {object} settings DataTables settings object * @param {string|int} action Paging action to take: "first", "previous", * "next" or "last" or page number to jump to (integer) * @param [bool] redraw Automatically draw the update or not * @returns {bool} true page has changed, false - no change * @memberof DataTable#oApi */ function _fnPageChange ( settings, action, redraw ) { var start = settings._iDisplayStart, len = settings._iDisplayLength, records = settings.fnRecordsDisplay(); if ( records === 0 || len === -1 ) { start = 0; } else if ( typeof action === "number" ) { start = action * len; if ( start > records ) { start = 0; } } else if ( action == "first" ) { start = 0; } else if ( action == "previous" ) { start = len >= 0 ? start - len : 0; if ( start < 0 ) { start = 0; } } else if ( action == "next" ) { if ( start + len < records ) { start += len; } } else if ( action == "last" ) { start = Math.floor( (records-1) / len) * len; } else { _fnLog( settings, 0, "Unknown paging action: "+action, 5 ); } var changed = settings._iDisplayStart !== start; settings._iDisplayStart = start; if ( changed ) { _fnCallbackFire( settings, null, 'page', [settings] ); if ( redraw ) { _fnDraw( settings ); } } return changed; } /** * Generate the node required for the processing node * @param {object} settings dataTables settings object * @returns {node} Processing element * @memberof DataTable#oApi */ function _fnFeatureHtmlProcessing ( settings ) { return $('<div/>', { 'id': ! settings.aanFeatures.r ? settings.sTableId+'_processing' : null, 'class': settings.oClasses.sProcessing } ) .html( settings.oLanguage.sProcessing ) .insertBefore( settings.nTable )[0]; } /** * Display or hide the processing indicator * @param {object} settings dataTables settings object * @param {bool} show Show the processing indicator (true) or not (false) * @memberof DataTable#oApi */ function _fnProcessingDisplay ( settings, show ) { if ( settings.oFeatures.bProcessing ) { $(settings.aanFeatures.r).css( 'display', show ? 'block' : 'none' ); } _fnCallbackFire( settings, null, 'processing', [settings, show] ); } /** * Add any control elements for the table - specifically scrolling * @param {object} settings dataTables settings object * @returns {node} Node to add to the DOM * @memberof DataTable#oApi */ function _fnFeatureHtmlTable ( settings ) { var table = $(settings.nTable); // Add the ARIA grid role to the table table.attr( 'role', 'grid' ); // Scrolling from here on in var scroll = settings.oScroll; if ( scroll.sX === '' && scroll.sY === '' ) { return settings.nTable; } var scrollX = scroll.sX; var scrollY = scroll.sY; var classes = settings.oClasses; var caption = table.children('caption'); var captionSide = caption.length ? caption[0]._captionSide : null; var headerClone = $( table[0].cloneNode(false) ); var footerClone = $( table[0].cloneNode(false) ); var footer = table.children('tfoot'); var _div = '<div/>'; var size = function ( s ) { return !s ? null : _fnStringToCss( s ); }; if ( ! footer.length ) { footer = null; } /* * The HTML structure that we want to generate in this function is: * div - scroller * div - scroll head * div - scroll head inner * table - scroll head table * thead - thead * div - scroll body * table - table (master table) * thead - thead clone for sizing * tbody - tbody * div - scroll foot * div - scroll foot inner * table - scroll foot table * tfoot - tfoot */ var scroller = $( _div, { 'class': classes.sScrollWrapper } ) .append( $(_div, { 'class': classes.sScrollHead } ) .css( { overflow: 'hidden', position: 'relative', border: 0, width: scrollX ? size(scrollX) : '100%' } ) .append( $(_div, { 'class': classes.sScrollHeadInner } ) .css( { 'box-sizing': 'content-box', width: scroll.sXInner || '100%' } ) .append( headerClone .removeAttr('id') .css( 'margin-left', 0 ) .append( captionSide === 'top' ? caption : null ) .append( table.children('thead') ) ) ) ) .append( $(_div, { 'class': classes.sScrollBody } ) .css( { position: 'relative', overflow: 'auto', width: size( scrollX ) } ) .append( table ) ); if ( footer ) { scroller.append( $(_div, { 'class': classes.sScrollFoot } ) .css( { overflow: 'hidden', border: 0, width: scrollX ? size(scrollX) : '100%' } ) .append( $(_div, { 'class': classes.sScrollFootInner } ) .append( footerClone .removeAttr('id') .css( 'margin-left', 0 ) .append( captionSide === 'bottom' ? caption : null ) .append( table.children('tfoot') ) ) ) ); } var children = scroller.children(); var scrollHead = children[0]; var scrollBody = children[1]; var scrollFoot = footer ? children[2] : null; // When the body is scrolled, then we also want to scroll the headers if ( scrollX ) { $(scrollBody).on( 'scroll.DT', function (e) { var scrollLeft = this.scrollLeft; scrollHead.scrollLeft = scrollLeft; if ( footer ) { scrollFoot.scrollLeft = scrollLeft; } } ); } $(scrollBody).css( scrollY && scroll.bCollapse ? 'max-height' : 'height', scrollY ); settings.nScrollHead = scrollHead; settings.nScrollBody = scrollBody; settings.nScrollFoot = scrollFoot; // On redraw - align columns settings.aoDrawCallback.push( { "fn": _fnScrollDraw, "sName": "scrolling" } ); return scroller[0]; } /** * Update the header, footer and body tables for resizing - i.e. column * alignment. * * Welcome to the most horrible function DataTables. The process that this * function follows is basically: * 1. Re-create the table inside the scrolling div * 2. Take live measurements from the DOM * 3. Apply the measurements to align the columns * 4. Clean up * * @param {object} settings dataTables settings object * @memberof DataTable#oApi */ function _fnScrollDraw ( settings ) { // Given that this is such a monster function, a lot of variables are use // to try and keep the minimised size as small as possible var scroll = settings.oScroll, scrollX = scroll.sX, scrollXInner = scroll.sXInner, scrollY = scroll.sY, barWidth = scroll.iBarWidth, divHeader = $(settings.nScrollHead), divHeaderStyle = divHeader[0].style, divHeaderInner = divHeader.children('div'), divHeaderInnerStyle = divHeaderInner[0].style, divHeaderTable = divHeaderInner.children('table'), divBodyEl = settings.nScrollBody, divBody = $(divBodyEl), divBodyStyle = divBodyEl.style, divFooter = $(settings.nScrollFoot), divFooterInner = divFooter.children('div'), divFooterTable = divFooterInner.children('table'), header = $(settings.nTHead), table = $(settings.nTable), tableEl = table[0], tableStyle = tableEl.style, footer = settings.nTFoot ? $(settings.nTFoot) : null, browser = settings.oBrowser, ie67 = browser.bScrollOversize, dtHeaderCells = _pluck( settings.aoColumns, 'nTh' ), headerTrgEls, footerTrgEls, headerSrcEls, footerSrcEls, headerCopy, footerCopy, headerWidths=[], footerWidths=[], headerContent=[], footerContent=[], idx, correction, sanityWidth, zeroOut = function(nSizer) { var style = nSizer.style; style.paddingTop = "0"; style.paddingBottom = "0"; style.borderTopWidth = "0"; style.borderBottomWidth = "0"; style.height = 0; }; // If the scrollbar visibility has changed from the last draw, we need to // adjust the column sizes as the table width will have changed to account // for the scrollbar var scrollBarVis = divBodyEl.scrollHeight > divBodyEl.clientHeight; if ( settings.scrollBarVis !== scrollBarVis && settings.scrollBarVis !== undefined ) { settings.scrollBarVis = scrollBarVis; _fnAdjustColumnSizing( settings ); return; // adjust column sizing will call this function again } else { settings.scrollBarVis = scrollBarVis; } /* * 1. Re-create the table inside the scrolling div */ // Remove the old minimised thead and tfoot elements in the inner table table.children('thead, tfoot').remove(); if ( footer ) { footerCopy = footer.clone().prependTo( table ); footerTrgEls = footer.find('tr'); // the original tfoot is in its own table and must be sized footerSrcEls = footerCopy.find('tr'); } // Clone the current header and footer elements and then place it into the inner table headerCopy = header.clone().prependTo( table ); headerTrgEls = header.find('tr'); // original header is in its own table headerSrcEls = headerCopy.find('tr'); headerCopy.find('th, td').removeAttr('tabindex'); /* * 2. Take live measurements from the DOM - do not alter the DOM itself! */ // Remove old sizing and apply the calculated column widths // Get the unique column headers in the newly created (cloned) header. We want to apply the // calculated sizes to this header if ( ! scrollX ) { divBodyStyle.width = '100%'; divHeader[0].style.width = '100%'; } $.each( _fnGetUniqueThs( settings, headerCopy ), function ( i, el ) { idx = _fnVisibleToColumnIndex( settings, i ); el.style.width = settings.aoColumns[idx].sWidth; } ); if ( footer ) { _fnApplyToChildren( function(n) { n.style.width = ""; }, footerSrcEls ); } // Size the table as a whole sanityWidth = table.outerWidth(); if ( scrollX === "" ) { // No x scrolling tableStyle.width = "100%"; // IE7 will make the width of the table when 100% include the scrollbar // - which is shouldn't. When there is a scrollbar we need to take this // into account. if ( ie67 && (table.find('tbody').height() > divBodyEl.offsetHeight || divBody.css('overflow-y') == "scroll") ) { tableStyle.width = _fnStringToCss( table.outerWidth() - barWidth); } // Recalculate the sanity width sanityWidth = table.outerWidth(); } else if ( scrollXInner !== "" ) { // legacy x scroll inner has been given - use it tableStyle.width = _fnStringToCss(scrollXInner); // Recalculate the sanity width sanityWidth = table.outerWidth(); } // Hidden header should have zero height, so remove padding and borders. Then // set the width based on the real headers // Apply all styles in one pass _fnApplyToChildren( zeroOut, headerSrcEls ); // Read all widths in next pass _fnApplyToChildren( function(nSizer) { headerContent.push( nSizer.innerHTML ); headerWidths.push( _fnStringToCss( $(nSizer).css('width') ) ); }, headerSrcEls ); // Apply all widths in final pass _fnApplyToChildren( function(nToSize, i) { // Only apply widths to the DataTables detected header cells - this // prevents complex headers from having contradictory sizes applied if ( $.inArray( nToSize, dtHeaderCells ) !== -1 ) { nToSize.style.width = headerWidths[i]; } }, headerTrgEls ); $(headerSrcEls).height(0); /* Same again with the footer if we have one */ if ( footer ) { _fnApplyToChildren( zeroOut, footerSrcEls ); _fnApplyToChildren( function(nSizer) { footerContent.push( nSizer.innerHTML ); footerWidths.push( _fnStringToCss( $(nSizer).css('width') ) ); }, footerSrcEls ); _fnApplyToChildren( function(nToSize, i) { nToSize.style.width = footerWidths[i]; }, footerTrgEls ); $(footerSrcEls).height(0); } /* * 3. Apply the measurements */ // "Hide" the header and footer that we used for the sizing. We need to keep // the content of the cell so that the width applied to the header and body // both match, but we want to hide it completely. We want to also fix their // width to what they currently are _fnApplyToChildren( function(nSizer, i) { nSizer.innerHTML = '<div class="dataTables_sizing" style="height:0;overflow:hidden;">'+headerContent[i]+'</div>'; nSizer.style.width = headerWidths[i]; }, headerSrcEls ); if ( footer ) { _fnApplyToChildren( function(nSizer, i) { nSizer.innerHTML = '<div class="dataTables_sizing" style="height:0;overflow:hidden;">'+footerContent[i]+'</div>'; nSizer.style.width = footerWidths[i]; }, footerSrcEls ); } // Sanity check that the table is of a sensible width. If not then we are going to get // misalignment - try to prevent this by not allowing the table to shrink below its min width if ( table.outerWidth() < sanityWidth ) { // The min width depends upon if we have a vertical scrollbar visible or not */ correction = ((divBodyEl.scrollHeight > divBodyEl.offsetHeight || divBody.css('overflow-y') == "scroll")) ? sanityWidth+barWidth : sanityWidth; // IE6/7 are a law unto themselves... if ( ie67 && (divBodyEl.scrollHeight > divBodyEl.offsetHeight || divBody.css('overflow-y') == "scroll") ) { tableStyle.width = _fnStringToCss( correction-barWidth ); } // And give the user a warning that we've stopped the table getting too small if ( scrollX === "" || scrollXInner !== "" ) { _fnLog( settings, 1, 'Possible column misalignment', 6 ); } } else { correction = '100%'; } // Apply to the container elements divBodyStyle.width = _fnStringToCss( correction ); divHeaderStyle.width = _fnStringToCss( correction ); if ( footer ) { settings.nScrollFoot.style.width = _fnStringToCss( correction ); } /* * 4. Clean up */ if ( ! scrollY ) { /* IE7< puts a vertical scrollbar in place (when it shouldn't be) due to subtracting * the scrollbar height from the visible display, rather than adding it on. We need to * set the height in order to sort this. Don't want to do it in any other browsers. */ if ( ie67 ) { divBodyStyle.height = _fnStringToCss( tableEl.offsetHeight+barWidth ); } } /* Finally set the width's of the header and footer tables */ var iOuterWidth = table.outerWidth(); divHeaderTable[0].style.width = _fnStringToCss( iOuterWidth ); divHeaderInnerStyle.width = _fnStringToCss( iOuterWidth ); // Figure out if there are scrollbar present - if so then we need a the header and footer to // provide a bit more space to allow "overflow" scrolling (i.e. past the scrollbar) var bScrolling = table.height() > divBodyEl.clientHeight || divBody.css('overflow-y') == "scroll"; var padding = 'padding' + (browser.bScrollbarLeft ? 'Left' : 'Right' ); divHeaderInnerStyle[ padding ] = bScrolling ? barWidth+"px" : "0px"; if ( footer ) { divFooterTable[0].style.width = _fnStringToCss( iOuterWidth ); divFooterInner[0].style.width = _fnStringToCss( iOuterWidth ); divFooterInner[0].style[padding] = bScrolling ? barWidth+"px" : "0px"; } // Correct DOM ordering for colgroup - comes before the thead table.children('colgroup').insertBefore( table.children('thead') ); /* Adjust the position of the header in case we loose the y-scrollbar */ divBody.scroll(); // If sorting or filtering has occurred, jump the scrolling back to the top // only if we aren't holding the position if ( (settings.bSorted || settings.bFiltered) && ! settings._drawHold ) { divBodyEl.scrollTop = 0; } } /** * Apply a given function to the display child nodes of an element array (typically * TD children of TR rows * @param {function} fn Method to apply to the objects * @param array {nodes} an1 List of elements to look through for display children * @param array {nodes} an2 Another list (identical structure to the first) - optional * @memberof DataTable#oApi */ function _fnApplyToChildren( fn, an1, an2 ) { var index=0, i=0, iLen=an1.length; var nNode1, nNode2; while ( i < iLen ) { nNode1 = an1[i].firstChild; nNode2 = an2 ? an2[i].firstChild : null; while ( nNode1 ) { if ( nNode1.nodeType === 1 ) { if ( an2 ) { fn( nNode1, nNode2, index ); } else { fn( nNode1, index ); } index++; } nNode1 = nNode1.nextSibling; nNode2 = an2 ? nNode2.nextSibling : null; } i++; } } var __re_html_remove = /<.*?>/g; /** * Calculate the width of columns for the table * @param {object} oSettings dataTables settings object * @memberof DataTable#oApi */ function _fnCalculateColumnWidths ( oSettings ) { var table = oSettings.nTable, columns = oSettings.aoColumns, scroll = oSettings.oScroll, scrollY = scroll.sY, scrollX = scroll.sX, scrollXInner = scroll.sXInner, columnCount = columns.length, visibleColumns = _fnGetColumns( oSettings, 'bVisible' ), headerCells = $('th', oSettings.nTHead), tableWidthAttr = table.getAttribute('width'), // from DOM element tableContainer = table.parentNode, userInputs = false, i, column, columnIdx, width, outerWidth, browser = oSettings.oBrowser, ie67 = browser.bScrollOversize; var styleWidth = table.style.width; if ( styleWidth && styleWidth.indexOf('%') !== -1 ) { tableWidthAttr = styleWidth; } /* Convert any user input sizes into pixel sizes */ for ( i=0 ; i<visibleColumns.length ; i++ ) { column = columns[ visibleColumns[i] ]; if ( column.sWidth !== null ) { column.sWidth = _fnConvertToWidth( column.sWidthOrig, tableContainer ); userInputs = true; } } /* If the number of columns in the DOM equals the number that we have to * process in DataTables, then we can use the offsets that are created by * the web- browser. No custom sizes can be set in order for this to happen, * nor scrolling used */ if ( ie67 || ! userInputs && ! scrollX && ! scrollY && columnCount == _fnVisbleColumns( oSettings ) && columnCount == headerCells.length ) { for ( i=0 ; i<columnCount ; i++ ) { var colIdx = _fnVisibleToColumnIndex( oSettings, i ); if ( colIdx !== null ) { columns[ colIdx ].sWidth = _fnStringToCss( headerCells.eq(i).width() ); } } } else { // Otherwise construct a single row, worst case, table with the widest // node in the data, assign any user defined widths, then insert it into // the DOM and allow the browser to do all the hard work of calculating // table widths var tmpTable = $(table).clone() // don't use cloneNode - IE8 will remove events on the main table .css( 'visibility', 'hidden' ) .removeAttr( 'id' ); // Clean up the table body tmpTable.find('tbody tr').remove(); var tr = $('<tr/>').appendTo( tmpTable.find('tbody') ); // Clone the table header and footer - we can't use the header / footer // from the cloned table, since if scrolling is active, the table's // real header and footer are contained in different table tags tmpTable.find('thead, tfoot').remove(); tmpTable .append( $(oSettings.nTHead).clone() ) .append( $(oSettings.nTFoot).clone() ); // Remove any assigned widths from the footer (from scrolling) tmpTable.find('tfoot th, tfoot td').css('width', ''); // Apply custom sizing to the cloned header headerCells = _fnGetUniqueThs( oSettings, tmpTable.find('thead')[0] ); for ( i=0 ; i<visibleColumns.length ; i++ ) { column = columns[ visibleColumns[i] ]; headerCells[i].style.width = column.sWidthOrig !== null && column.sWidthOrig !== '' ? _fnStringToCss( column.sWidthOrig ) : ''; // For scrollX we need to force the column width otherwise the // browser will collapse it. If this width is smaller than the // width the column requires, then it will have no effect if ( column.sWidthOrig && scrollX ) { $( headerCells[i] ).append( $('<div/>').css( { width: column.sWidthOrig, margin: 0, padding: 0, border: 0, height: 1 } ) ); } } // Find the widest cell for each column and put it into the table if ( oSettings.aoData.length ) { for ( i=0 ; i<visibleColumns.length ; i++ ) { columnIdx = visibleColumns[i]; column = columns[ columnIdx ]; $( _fnGetWidestNode( oSettings, columnIdx ) ) .clone( false ) .append( column.sContentPadding ) .appendTo( tr ); } } // Tidy the temporary table - remove name attributes so there aren't // duplicated in the dom (radio elements for example) $('[name]', tmpTable).removeAttr('name'); // Table has been built, attach to the document so we can work with it. // A holding element is used, positioned at the top of the container // with minimal height, so it has no effect on if the container scrolls // or not. Otherwise it might trigger scrolling when it actually isn't // needed var holder = $('<div/>').css( scrollX || scrollY ? { position: 'absolute', top: 0, left: 0, height: 1, right: 0, overflow: 'hidden' } : {} ) .append( tmpTable ) .appendTo( tableContainer ); // When scrolling (X or Y) we want to set the width of the table as // appropriate. However, when not scrolling leave the table width as it // is. This results in slightly different, but I think correct behaviour if ( scrollX && scrollXInner ) { tmpTable.width( scrollXInner ); } else if ( scrollX ) { tmpTable.css( 'width', 'auto' ); tmpTable.removeAttr('width'); // If there is no width attribute or style, then allow the table to // collapse if ( tmpTable.width() < tableContainer.clientWidth && tableWidthAttr ) { tmpTable.width( tableContainer.clientWidth ); } } else if ( scrollY ) { tmpTable.width( tableContainer.clientWidth ); } else if ( tableWidthAttr ) { tmpTable.width( tableWidthAttr ); } // Get the width of each column in the constructed table - we need to // know the inner width (so it can be assigned to the other table's // cells) and the outer width so we can calculate the full width of the // table. This is safe since DataTables requires a unique cell for each // column, but if ever a header can span multiple columns, this will // need to be modified. var total = 0; for ( i=0 ; i<visibleColumns.length ; i++ ) { var cell = $(headerCells[i]); var border = cell.outerWidth() - cell.width(); // Use getBounding... where possible (not IE8-) because it can give // sub-pixel accuracy, which we then want to round up! var bounding = browser.bBounding ? Math.ceil( headerCells[i].getBoundingClientRect().width ) : cell.outerWidth(); // Total is tracked to remove any sub-pixel errors as the outerWidth // of the table might not equal the total given here (IE!). total += bounding; // Width for each column to use columns[ visibleColumns[i] ].sWidth = _fnStringToCss( bounding - border ); } table.style.width = _fnStringToCss( total ); // Finished with the table - ditch it holder.remove(); } // If there is a width attr, we want to attach an event listener which // allows the table sizing to automatically adjust when the window is // resized. Use the width attr rather than CSS, since we can't know if the // CSS is a relative value or absolute - DOM read is always px. if ( tableWidthAttr ) { table.style.width = _fnStringToCss( tableWidthAttr ); } if ( (tableWidthAttr || scrollX) && ! oSettings._reszEvt ) { var bindResize = function () { $(window).on('resize.DT-'+oSettings.sInstance, _fnThrottle( function () { _fnAdjustColumnSizing( oSettings ); } ) ); }; // IE6/7 will crash if we bind a resize event handler on page load. // To be removed in 1.11 which drops IE6/7 support if ( ie67 ) { setTimeout( bindResize, 1000 ); } else { bindResize(); } oSettings._reszEvt = true; } } /** * Throttle the calls to a function. Arguments and context are maintained for * the throttled function * @param {function} fn Function to be called * @param {int} [freq=200] call frequency in mS * @returns {function} wrapped function * @memberof DataTable#oApi */ var _fnThrottle = DataTable.util.throttle; /** * Convert a CSS unit width to pixels (e.g. 2em) * @param {string} width width to be converted * @param {node} parent parent to get the with for (required for relative widths) - optional * @returns {int} width in pixels * @memberof DataTable#oApi */ function _fnConvertToWidth ( width, parent ) { if ( ! width ) { return 0; } var n = $('<div/>') .css( 'width', _fnStringToCss( width ) ) .appendTo( parent || document.body ); var val = n[0].offsetWidth; n.remove(); return val; } /** * Get the widest node * @param {object} settings dataTables settings object * @param {int} colIdx column of interest * @returns {node} widest table node * @memberof DataTable#oApi */ function _fnGetWidestNode( settings, colIdx ) { var idx = _fnGetMaxLenString( settings, colIdx ); if ( idx < 0 ) { return null; } var data = settings.aoData[ idx ]; return ! data.nTr ? // Might not have been created when deferred rendering $('<td/>').html( _fnGetCellData( settings, idx, colIdx, 'display' ) )[0] : data.anCells[ colIdx ]; } /** * Get the maximum strlen for each data column * @param {object} settings dataTables settings object * @param {int} colIdx column of interest * @returns {string} max string length for each column * @memberof DataTable#oApi */ function _fnGetMaxLenString( settings, colIdx ) { var s, max=-1, maxIdx = -1; for ( var i=0, ien=settings.aoData.length ; i<ien ; i++ ) { s = _fnGetCellData( settings, i, colIdx, 'display' )+''; s = s.replace( __re_html_remove, '' ); s = s.replace( /&nbsp;/g, ' ' ); if ( s.length > max ) { max = s.length; maxIdx = i; } } return maxIdx; } /** * Append a CSS unit (only if required) to a string * @param {string} value to css-ify * @returns {string} value with css unit * @memberof DataTable#oApi */ function _fnStringToCss( s ) { if ( s === null ) { return '0px'; } if ( typeof s == 'number' ) { return s < 0 ? '0px' : s+'px'; } // Check it has a unit character already return s.match(/\d$/) ? s+'px' : s; } function _fnSortFlatten ( settings ) { var i, iLen, k, kLen, aSort = [], aiOrig = [], aoColumns = settings.aoColumns, aDataSort, iCol, sType, srcCol, fixed = settings.aaSortingFixed, fixedObj = $.isPlainObject( fixed ), nestedSort = [], add = function ( a ) { if ( a.length && ! $.isArray( a[0] ) ) { // 1D array nestedSort.push( a ); } else { // 2D array $.merge( nestedSort, a ); } }; // Build the sort array, with pre-fix and post-fix options if they have been // specified if ( $.isArray( fixed ) ) { add( fixed ); } if ( fixedObj && fixed.pre ) { add( fixed.pre ); } add( settings.aaSorting ); if (fixedObj && fixed.post ) { add( fixed.post ); } for ( i=0 ; i<nestedSort.length ; i++ ) { srcCol = nestedSort[i][0]; aDataSort = aoColumns[ srcCol ].aDataSort; for ( k=0, kLen=aDataSort.length ; k<kLen ; k++ ) { iCol = aDataSort[k]; sType = aoColumns[ iCol ].sType || 'string'; if ( nestedSort[i]._idx === undefined ) { nestedSort[i]._idx = $.inArray( nestedSort[i][1], aoColumns[iCol].asSorting ); } aSort.push( { src: srcCol, col: iCol, dir: nestedSort[i][1], index: nestedSort[i]._idx, type: sType, formatter: DataTable.ext.type.order[ sType+"-pre" ] } ); } } return aSort; } /** * Change the order of the table * @param {object} oSettings dataTables settings object * @memberof DataTable#oApi * @todo This really needs split up! */ function _fnSort ( oSettings ) { var i, ien, iLen, j, jLen, k, kLen, sDataType, nTh, aiOrig = [], oExtSort = DataTable.ext.type.order, aoData = oSettings.aoData, aoColumns = oSettings.aoColumns, aDataSort, data, iCol, sType, oSort, formatters = 0, sortCol, displayMaster = oSettings.aiDisplayMaster, aSort; // Resolve any column types that are unknown due to addition or invalidation // @todo Can this be moved into a 'data-ready' handler which is called when // data is going to be used in the table? _fnColumnTypes( oSettings ); aSort = _fnSortFlatten( oSettings ); for ( i=0, ien=aSort.length ; i<ien ; i++ ) { sortCol = aSort[i]; // Track if we can use the fast sort algorithm if ( sortCol.formatter ) { formatters++; } // Load the data needed for the sort, for each cell _fnSortData( oSettings, sortCol.col ); } /* No sorting required if server-side or no sorting array */ if ( _fnDataSource( oSettings ) != 'ssp' && aSort.length !== 0 ) { // Create a value - key array of the current row positions such that we can use their // current position during the sort, if values match, in order to perform stable sorting for ( i=0, iLen=displayMaster.length ; i<iLen ; i++ ) { aiOrig[ displayMaster[i] ] = i; } /* Do the sort - here we want multi-column sorting based on a given data source (column) * and sorting function (from oSort) in a certain direction. It's reasonably complex to * follow on it's own, but this is what we want (example two column sorting): * fnLocalSorting = function(a,b){ * var iTest; * iTest = oSort['string-asc']('data11', 'data12'); * if (iTest !== 0) * return iTest; * iTest = oSort['numeric-desc']('data21', 'data22'); * if (iTest !== 0) * return iTest; * return oSort['numeric-asc']( aiOrig[a], aiOrig[b] ); * } * Basically we have a test for each sorting column, if the data in that column is equal, * test the next column. If all columns match, then we use a numeric sort on the row * positions in the original data array to provide a stable sort. * * Note - I know it seems excessive to have two sorting methods, but the first is around * 15% faster, so the second is only maintained for backwards compatibility with sorting * methods which do not have a pre-sort formatting function. */ if ( formatters === aSort.length ) { // All sort types have formatting functions displayMaster.sort( function ( a, b ) { var x, y, k, test, sort, len=aSort.length, dataA = aoData[a]._aSortData, dataB = aoData[b]._aSortData; for ( k=0 ; k<len ; k++ ) { sort = aSort[k]; x = dataA[ sort.col ]; y = dataB[ sort.col ]; test = x<y ? -1 : x>y ? 1 : 0; if ( test !== 0 ) { return sort.dir === 'asc' ? test : -test; } } x = aiOrig[a]; y = aiOrig[b]; return x<y ? -1 : x>y ? 1 : 0; } ); } else { // Depreciated - remove in 1.11 (providing a plug-in option) // Not all sort types have formatting methods, so we have to call their sorting // methods. displayMaster.sort( function ( a, b ) { var x, y, k, l, test, sort, fn, len=aSort.length, dataA = aoData[a]._aSortData, dataB = aoData[b]._aSortData; for ( k=0 ; k<len ; k++ ) { sort = aSort[k]; x = dataA[ sort.col ]; y = dataB[ sort.col ]; fn = oExtSort[ sort.type+"-"+sort.dir ] || oExtSort[ "string-"+sort.dir ]; test = fn( x, y ); if ( test !== 0 ) { return test; } } x = aiOrig[a]; y = aiOrig[b]; return x<y ? -1 : x>y ? 1 : 0; } ); } } /* Tell the draw function that we have sorted the data */ oSettings.bSorted = true; } function _fnSortAria ( settings ) { var label; var nextSort; var columns = settings.aoColumns; var aSort = _fnSortFlatten( settings ); var oAria = settings.oLanguage.oAria; // ARIA attributes - need to loop all columns, to update all (removing old // attributes as needed) for ( var i=0, iLen=columns.length ; i<iLen ; i++ ) { var col = columns[i]; var asSorting = col.asSorting; var sTitle = col.sTitle.replace( /<.*?>/g, "" ); var th = col.nTh; // IE7 is throwing an error when setting these properties with jQuery's // attr() and removeAttr() methods... th.removeAttribute('aria-sort'); /* In ARIA only the first sorting column can be marked as sorting - no multi-sort option */ if ( col.bSortable ) { if ( aSort.length > 0 && aSort[0].col == i ) { th.setAttribute('aria-sort', aSort[0].dir=="asc" ? "ascending" : "descending" ); nextSort = asSorting[ aSort[0].index+1 ] || asSorting[0]; } else { nextSort = asSorting[0]; } label = sTitle + ( nextSort === "asc" ? oAria.sSortAscending : oAria.sSortDescending ); } else { label = sTitle; } th.setAttribute('aria-label', label); } } /** * Function to run on user sort request * @param {object} settings dataTables settings object * @param {node} attachTo node to attach the handler to * @param {int} colIdx column sorting index * @param {boolean} [append=false] Append the requested sort to the existing * sort if true (i.e. multi-column sort) * @param {function} [callback] callback function * @memberof DataTable#oApi */ function _fnSortListener ( settings, colIdx, append, callback ) { var col = settings.aoColumns[ colIdx ]; var sorting = settings.aaSorting; var asSorting = col.asSorting; var nextSortIdx; var next = function ( a, overflow ) { var idx = a._idx; if ( idx === undefined ) { idx = $.inArray( a[1], asSorting ); } return idx+1 < asSorting.length ? idx+1 : overflow ? null : 0; }; // Convert to 2D array if needed if ( typeof sorting[0] === 'number' ) { sorting = settings.aaSorting = [ sorting ]; } // If appending the sort then we are multi-column sorting if ( append && settings.oFeatures.bSortMulti ) { // Are we already doing some kind of sort on this column? var sortIdx = $.inArray( colIdx, _pluck(sorting, '0') ); if ( sortIdx !== -1 ) { // Yes, modify the sort nextSortIdx = next( sorting[sortIdx], true ); if ( nextSortIdx === null && sorting.length === 1 ) { nextSortIdx = 0; // can't remove sorting completely } if ( nextSortIdx === null ) { sorting.splice( sortIdx, 1 ); } else { sorting[sortIdx][1] = asSorting[ nextSortIdx ]; sorting[sortIdx]._idx = nextSortIdx; } } else { // No sort on this column yet sorting.push( [ colIdx, asSorting[0], 0 ] ); sorting[sorting.length-1]._idx = 0; } } else if ( sorting.length && sorting[0][0] == colIdx ) { // Single column - already sorting on this column, modify the sort nextSortIdx = next( sorting[0] ); sorting.length = 1; sorting[0][1] = asSorting[ nextSortIdx ]; sorting[0]._idx = nextSortIdx; } else { // Single column - sort only on this column sorting.length = 0; sorting.push( [ colIdx, asSorting[0] ] ); sorting[0]._idx = 0; } // Run the sort by calling a full redraw _fnReDraw( settings ); // callback used for async user interaction if ( typeof callback == 'function' ) { callback( settings ); } } /** * Attach a sort handler (click) to a node * @param {object} settings dataTables settings object * @param {node} attachTo node to attach the handler to * @param {int} colIdx column sorting index * @param {function} [callback] callback function * @memberof DataTable#oApi */ function _fnSortAttachListener ( settings, attachTo, colIdx, callback ) { var col = settings.aoColumns[ colIdx ]; _fnBindAction( attachTo, {}, function (e) { /* If the column is not sortable - don't to anything */ if ( col.bSortable === false ) { return; } // If processing is enabled use a timeout to allow the processing // display to be shown - otherwise to it synchronously if ( settings.oFeatures.bProcessing ) { _fnProcessingDisplay( settings, true ); setTimeout( function() { _fnSortListener( settings, colIdx, e.shiftKey, callback ); // In server-side processing, the draw callback will remove the // processing display if ( _fnDataSource( settings ) !== 'ssp' ) { _fnProcessingDisplay( settings, false ); } }, 0 ); } else { _fnSortListener( settings, colIdx, e.shiftKey, callback ); } } ); } /** * Set the sorting classes on table's body, Note: it is safe to call this function * when bSort and bSortClasses are false * @param {object} oSettings dataTables settings object * @memberof DataTable#oApi */ function _fnSortingClasses( settings ) { var oldSort = settings.aLastSort; var sortClass = settings.oClasses.sSortColumn; var sort = _fnSortFlatten( settings ); var features = settings.oFeatures; var i, ien, colIdx; if ( features.bSort && features.bSortClasses ) { // Remove old sorting classes for ( i=0, ien=oldSort.length ; i<ien ; i++ ) { colIdx = oldSort[i].src; // Remove column sorting $( _pluck( settings.aoData, 'anCells', colIdx ) ) .removeClass( sortClass + (i<2 ? i+1 : 3) ); } // Add new column sorting for ( i=0, ien=sort.length ; i<ien ; i++ ) { colIdx = sort[i].src; $( _pluck( settings.aoData, 'anCells', colIdx ) ) .addClass( sortClass + (i<2 ? i+1 : 3) ); } } settings.aLastSort = sort; } // Get the data to sort a column, be it from cache, fresh (populating the // cache), or from a sort formatter function _fnSortData( settings, idx ) { // Custom sorting function - provided by the sort data type var column = settings.aoColumns[ idx ]; var customSort = DataTable.ext.order[ column.sSortDataType ]; var customData; if ( customSort ) { customData = customSort.call( settings.oInstance, settings, idx, _fnColumnIndexToVisible( settings, idx ) ); } // Use / populate cache var row, cellData; var formatter = DataTable.ext.type.order[ column.sType+"-pre" ]; for ( var i=0, ien=settings.aoData.length ; i<ien ; i++ ) { row = settings.aoData[i]; if ( ! row._aSortData ) { row._aSortData = []; } if ( ! row._aSortData[idx] || customSort ) { cellData = customSort ? customData[i] : // If there was a custom sort function, use data from there _fnGetCellData( settings, i, idx, 'sort' ); row._aSortData[ idx ] = formatter ? formatter( cellData ) : cellData; } } } /** * Save the state of a table * @param {object} oSettings dataTables settings object * @memberof DataTable#oApi */ function _fnSaveState ( settings ) { if ( !settings.oFeatures.bStateSave || settings.bDestroying ) { return; } /* Store the interesting variables */ var state = { time: +new Date(), start: settings._iDisplayStart, length: settings._iDisplayLength, order: $.extend( true, [], settings.aaSorting ), search: _fnSearchToCamel( settings.oPreviousSearch ), columns: $.map( settings.aoColumns, function ( col, i ) { return { visible: col.bVisible, search: _fnSearchToCamel( settings.aoPreSearchCols[i] ) }; } ) }; _fnCallbackFire( settings, "aoStateSaveParams", 'stateSaveParams', [settings, state] ); settings.oSavedState = state; settings.fnStateSaveCallback.call( settings.oInstance, settings, state ); } /** * Attempt to load a saved table state * @param {object} oSettings dataTables settings object * @param {object} oInit DataTables init object so we can override settings * @param {function} callback Callback to execute when the state has been loaded * @memberof DataTable#oApi */ function _fnLoadState ( settings, oInit, callback ) { var i, ien; var columns = settings.aoColumns; var loaded = function ( s ) { if ( ! s || ! s.time ) { callback(); return; } // Allow custom and plug-in manipulation functions to alter the saved data set and // cancelling of loading by returning false var abStateLoad = _fnCallbackFire( settings, 'aoStateLoadParams', 'stateLoadParams', [settings, state] ); if ( $.inArray( false, abStateLoad ) !== -1 ) { callback(); return; } // Reject old data var duration = settings.iStateDuration; if ( duration > 0 && s.time < +new Date() - (duration*1000) ) { callback(); return; } // Number of columns have changed - all bets are off, no restore of settings if ( s.columns && columns.length !== s.columns.length ) { callback(); return; } // Store the saved state so it might be accessed at any time settings.oLoadedState = $.extend( true, {}, state ); // Restore key features - todo - for 1.11 this needs to be done by // subscribed events if ( s.start !== undefined ) { settings._iDisplayStart = s.start; settings.iInitDisplayStart = s.start; } if ( s.length !== undefined ) { settings._iDisplayLength = s.length; } // Order if ( s.order !== undefined ) { settings.aaSorting = []; $.each( s.order, function ( i, col ) { settings.aaSorting.push( col[0] >= columns.length ? [ 0, col[1] ] : col ); } ); } // Search if ( s.search !== undefined ) { $.extend( settings.oPreviousSearch, _fnSearchToHung( s.search ) ); } // Columns // if ( s.columns ) { for ( i=0, ien=s.columns.length ; i<ien ; i++ ) { var col = s.columns[i]; // Visibility if ( col.visible !== undefined ) { columns[i].bVisible = col.visible; } // Search if ( col.search !== undefined ) { $.extend( settings.aoPreSearchCols[i], _fnSearchToHung( col.search ) ); } } } _fnCallbackFire( settings, 'aoStateLoaded', 'stateLoaded', [settings, state] ); callback(); } if ( ! settings.oFeatures.bStateSave ) { callback(); return; } var state = settings.fnStateLoadCallback.call( settings.oInstance, settings, loaded ); if ( state !== undefined ) { loaded( state ); } // otherwise, wait for the loaded callback to be executed } /** * Return the settings object for a particular table * @param {node} table table we are using as a dataTable * @returns {object} Settings object - or null if not found * @memberof DataTable#oApi */ function _fnSettingsFromNode ( table ) { var settings = DataTable.settings; var idx = $.inArray( table, _pluck( settings, 'nTable' ) ); return idx !== -1 ? settings[ idx ] : null; } /** * Log an error message * @param {object} settings dataTables settings object * @param {int} level log error messages, or display them to the user * @param {string} msg error message * @param {int} tn Technical note id to get more information about the error. * @memberof DataTable#oApi */ function _fnLog( settings, level, msg, tn ) { msg = 'DataTables warning: '+ (settings ? 'table id='+settings.sTableId+' - ' : '')+msg; if ( tn ) { msg += '. For more information about this error, please see '+ 'http://datatables.net/tn/'+tn; } if ( ! level ) { // Backwards compatibility pre 1.10 var ext = DataTable.ext; var type = ext.sErrMode || ext.errMode; if ( settings ) { _fnCallbackFire( settings, null, 'error', [ settings, tn, msg ] ); } if ( type == 'alert' ) { alert( msg ); } else if ( type == 'throw' ) { throw new Error(msg); } else if ( typeof type == 'function' ) { type( settings, tn, msg ); } } else if ( window.console && console.log ) { console.log( msg ); } } /** * See if a property is defined on one object, if so assign it to the other object * @param {object} ret target object * @param {object} src source object * @param {string} name property * @param {string} [mappedName] name to map too - optional, name used if not given * @memberof DataTable#oApi */ function _fnMap( ret, src, name, mappedName ) { if ( $.isArray( name ) ) { $.each( name, function (i, val) { if ( $.isArray( val ) ) { _fnMap( ret, src, val[0], val[1] ); } else { _fnMap( ret, src, val ); } } ); return; } if ( mappedName === undefined ) { mappedName = name; } if ( src[name] !== undefined ) { ret[mappedName] = src[name]; } } /** * Extend objects - very similar to jQuery.extend, but deep copy objects, and * shallow copy arrays. The reason we need to do this, is that we don't want to * deep copy array init values (such as aaSorting) since the dev wouldn't be * able to override them, but we do want to deep copy arrays. * @param {object} out Object to extend * @param {object} extender Object from which the properties will be applied to * out * @param {boolean} breakRefs If true, then arrays will be sliced to take an * independent copy with the exception of the `data` or `aaData` parameters * if they are present. This is so you can pass in a collection to * DataTables and have that used as your data source without breaking the * references * @returns {object} out Reference, just for convenience - out === the return. * @memberof DataTable#oApi * @todo This doesn't take account of arrays inside the deep copied objects. */ function _fnExtend( out, extender, breakRefs ) { var val; for ( var prop in extender ) { if ( extender.hasOwnProperty(prop) ) { val = extender[prop]; if ( $.isPlainObject( val ) ) { if ( ! $.isPlainObject( out[prop] ) ) { out[prop] = {}; } $.extend( true, out[prop], val ); } else if ( breakRefs && prop !== 'data' && prop !== 'aaData' && $.isArray(val) ) { out[prop] = val.slice(); } else { out[prop] = val; } } } return out; } /** * Bind an event handers to allow a click or return key to activate the callback. * This is good for accessibility since a return on the keyboard will have the * same effect as a click, if the element has focus. * @param {element} n Element to bind the action to * @param {object} oData Data object to pass to the triggered function * @param {function} fn Callback function for when the event is triggered * @memberof DataTable#oApi */ function _fnBindAction( n, oData, fn ) { $(n) .on( 'click.DT', oData, function (e) { n.blur(); // Remove focus outline for mouse users fn(e); } ) .on( 'keypress.DT', oData, function (e){ if ( e.which === 13 ) { e.preventDefault(); fn(e); } } ) .on( 'selectstart.DT', function () { /* Take the brutal approach to cancelling text selection */ return false; } ); } /** * Register a callback function. Easily allows a callback function to be added to * an array store of callback functions that can then all be called together. * @param {object} oSettings dataTables settings object * @param {string} sStore Name of the array storage for the callbacks in oSettings * @param {function} fn Function to be called back * @param {string} sName Identifying name for the callback (i.e. a label) * @memberof DataTable#oApi */ function _fnCallbackReg( oSettings, sStore, fn, sName ) { if ( fn ) { oSettings[sStore].push( { "fn": fn, "sName": sName } ); } } /** * Fire callback functions and trigger events. Note that the loop over the * callback array store is done backwards! Further note that you do not want to * fire off triggers in time sensitive applications (for example cell creation) * as its slow. * @param {object} settings dataTables settings object * @param {string} callbackArr Name of the array storage for the callbacks in * oSettings * @param {string} eventName Name of the jQuery custom event to trigger. If * null no trigger is fired * @param {array} args Array of arguments to pass to the callback function / * trigger * @memberof DataTable#oApi */ function _fnCallbackFire( settings, callbackArr, eventName, args ) { var ret = []; if ( callbackArr ) { ret = $.map( settings[callbackArr].slice().reverse(), function (val, i) { return val.fn.apply( settings.oInstance, args ); } ); } if ( eventName !== null ) { var e = $.Event( eventName+'.dt' ); $(settings.nTable).trigger( e, args ); ret.push( e.result ); } return ret; } function _fnLengthOverflow ( settings ) { var start = settings._iDisplayStart, end = settings.fnDisplayEnd(), len = settings._iDisplayLength; /* If we have space to show extra rows (backing up from the end point - then do so */ if ( start >= end ) { start = end - len; } // Keep the start record on the current page start -= (start % len); if ( len === -1 || start < 0 ) { start = 0; } settings._iDisplayStart = start; } function _fnRenderer( settings, type ) { var renderer = settings.renderer; var host = DataTable.ext.renderer[type]; if ( $.isPlainObject( renderer ) && renderer[type] ) { // Specific renderer for this type. If available use it, otherwise use // the default. return host[renderer[type]] || host._; } else if ( typeof renderer === 'string' ) { // Common renderer - if there is one available for this type use it, // otherwise use the default return host[renderer] || host._; } // Use the default return host._; } /** * Detect the data source being used for the table. Used to simplify the code * a little (ajax) and to make it compress a little smaller. * * @param {object} settings dataTables settings object * @returns {string} Data source * @memberof DataTable#oApi */ function _fnDataSource ( settings ) { if ( settings.oFeatures.bServerSide ) { return 'ssp'; } else if ( settings.ajax || settings.sAjaxSource ) { return 'ajax'; } return 'dom'; } /** * Computed structure of the DataTables API, defined by the options passed to * `DataTable.Api.register()` when building the API. * * The structure is built in order to speed creation and extension of the Api * objects since the extensions are effectively pre-parsed. * * The array is an array of objects with the following structure, where this * base array represents the Api prototype base: * * [ * { * name: 'data' -- string - Property name * val: function () {}, -- function - Api method (or undefined if just an object * methodExt: [ ... ], -- array - Array of Api object definitions to extend the method result * propExt: [ ... ] -- array - Array of Api object definitions to extend the property * }, * { * name: 'row' * val: {}, * methodExt: [ ... ], * propExt: [ * { * name: 'data' * val: function () {}, * methodExt: [ ... ], * propExt: [ ... ] * }, * ... * ] * } * ] * * @type {Array} * @ignore */ var __apiStruct = []; /** * `Array.prototype` reference. * * @type object * @ignore */ var __arrayProto = Array.prototype; /** * Abstraction for `context` parameter of the `Api` constructor to allow it to * take several different forms for ease of use. * * Each of the input parameter types will be converted to a DataTables settings * object where possible. * * @param {string|node|jQuery|object} mixed DataTable identifier. Can be one * of: * * * `string` - jQuery selector. Any DataTables' matching the given selector * with be found and used. * * `node` - `TABLE` node which has already been formed into a DataTable. * * `jQuery` - A jQuery object of `TABLE` nodes. * * `object` - DataTables settings object * * `DataTables.Api` - API instance * @return {array|null} Matching DataTables settings objects. `null` or * `undefined` is returned if no matching DataTable is found. * @ignore */ var _toSettings = function ( mixed ) { var idx, jq; var settings = DataTable.settings; var tables = $.map( settings, function (el, i) { return el.nTable; } ); if ( ! mixed ) { return []; } else if ( mixed.nTable && mixed.oApi ) { // DataTables settings object return [ mixed ]; } else if ( mixed.nodeName && mixed.nodeName.toLowerCase() === 'table' ) { // Table node idx = $.inArray( mixed, tables ); return idx !== -1 ? [ settings[idx] ] : null; } else if ( mixed && typeof mixed.settings === 'function' ) { return mixed.settings().toArray(); } else if ( typeof mixed === 'string' ) { // jQuery selector jq = $(mixed); } else if ( mixed instanceof $ ) { // jQuery object (also DataTables instance) jq = mixed; } if ( jq ) { return jq.map( function(i) { idx = $.inArray( this, tables ); return idx !== -1 ? settings[idx] : null; } ).toArray(); } }; /** * DataTables API class - used to control and interface with one or more * DataTables enhanced tables. * * The API class is heavily based on jQuery, presenting a chainable interface * that you can use to interact with tables. Each instance of the API class has * a "context" - i.e. the tables that it will operate on. This could be a single * table, all tables on a page or a sub-set thereof. * * Additionally the API is designed to allow you to easily work with the data in * the tables, retrieving and manipulating it as required. This is done by * presenting the API class as an array like interface. The contents of the * array depend upon the actions requested by each method (for example * `rows().nodes()` will return an array of nodes, while `rows().data()` will * return an array of objects or arrays depending upon your table's * configuration). The API object has a number of array like methods (`push`, * `pop`, `reverse` etc) as well as additional helper methods (`each`, `pluck`, * `unique` etc) to assist your working with the data held in a table. * * Most methods (those which return an Api instance) are chainable, which means * the return from a method call also has all of the methods available that the * top level object had. For example, these two calls are equivalent: * * // Not chained * api.row.add( {...} ); * api.draw(); * * // Chained * api.row.add( {...} ).draw(); * * @class DataTable.Api * @param {array|object|string|jQuery} context DataTable identifier. This is * used to define which DataTables enhanced tables this API will operate on. * Can be one of: * * * `string` - jQuery selector. Any DataTables' matching the given selector * with be found and used. * * `node` - `TABLE` node which has already been formed into a DataTable. * * `jQuery` - A jQuery object of `TABLE` nodes. * * `object` - DataTables settings object * @param {array} [data] Data to initialise the Api instance with. * * @example * // Direct initialisation during DataTables construction * var api = $('#example').DataTable(); * * @example * // Initialisation using a DataTables jQuery object * var api = $('#example').dataTable().api(); * * @example * // Initialisation as a constructor * var api = new $.fn.DataTable.Api( 'table.dataTable' ); */ _Api = function ( context, data ) { if ( ! (this instanceof _Api) ) { return new _Api( context, data ); } var settings = []; var ctxSettings = function ( o ) { var a = _toSettings( o ); if ( a ) { settings = settings.concat( a ); } }; if ( $.isArray( context ) ) { for ( var i=0, ien=context.length ; i<ien ; i++ ) { ctxSettings( context[i] ); } } else { ctxSettings( context ); } // Remove duplicates this.context = _unique( settings ); // Initial data if ( data ) { $.merge( this, data ); } // selector this.selector = { rows: null, cols: null, opts: null }; _Api.extend( this, this, __apiStruct ); }; DataTable.Api = _Api; // Don't destroy the existing prototype, just extend it. Required for jQuery 2's // isPlainObject. $.extend( _Api.prototype, { any: function () { return this.count() !== 0; }, concat: __arrayProto.concat, context: [], // array of table settings objects count: function () { return this.flatten().length; }, each: function ( fn ) { for ( var i=0, ien=this.length ; i<ien; i++ ) { fn.call( this, this[i], i, this ); } return this; }, eq: function ( idx ) { var ctx = this.context; return ctx.length > idx ? new _Api( ctx[idx], this[idx] ) : null; }, filter: function ( fn ) { var a = []; if ( __arrayProto.filter ) { a = __arrayProto.filter.call( this, fn, this ); } else { // Compatibility for browsers without EMCA-252-5 (JS 1.6) for ( var i=0, ien=this.length ; i<ien ; i++ ) { if ( fn.call( this, this[i], i, this ) ) { a.push( this[i] ); } } } return new _Api( this.context, a ); }, flatten: function () { var a = []; return new _Api( this.context, a.concat.apply( a, this.toArray() ) ); }, join: __arrayProto.join, indexOf: __arrayProto.indexOf || function (obj, start) { for ( var i=(start || 0), ien=this.length ; i<ien ; i++ ) { if ( this[i] === obj ) { return i; } } return -1; }, iterator: function ( flatten, type, fn, alwaysNew ) { var a = [], ret, i, ien, j, jen, context = this.context, rows, items, item, selector = this.selector; // Argument shifting if ( typeof flatten === 'string' ) { alwaysNew = fn; fn = type; type = flatten; flatten = false; } for ( i=0, ien=context.length ; i<ien ; i++ ) { var apiInst = new _Api( context[i] ); if ( type === 'table' ) { ret = fn.call( apiInst, context[i], i ); if ( ret !== undefined ) { a.push( ret ); } } else if ( type === 'columns' || type === 'rows' ) { // this has same length as context - one entry for each table ret = fn.call( apiInst, context[i], this[i], i ); if ( ret !== undefined ) { a.push( ret ); } } else if ( type === 'column' || type === 'column-rows' || type === 'row' || type === 'cell' ) { // columns and rows share the same structure. // 'this' is an array of column indexes for each context items = this[i]; if ( type === 'column-rows' ) { rows = _selector_row_indexes( context[i], selector.opts ); } for ( j=0, jen=items.length ; j<jen ; j++ ) { item = items[j]; if ( type === 'cell' ) { ret = fn.call( apiInst, context[i], item.row, item.column, i, j ); } else { ret = fn.call( apiInst, context[i], item, i, j, rows ); } if ( ret !== undefined ) { a.push( ret ); } } } } if ( a.length || alwaysNew ) { var api = new _Api( context, flatten ? a.concat.apply( [], a ) : a ); var apiSelector = api.selector; apiSelector.rows = selector.rows; apiSelector.cols = selector.cols; apiSelector.opts = selector.opts; return api; } return this; }, lastIndexOf: __arrayProto.lastIndexOf || function (obj, start) { // Bit cheeky... return this.indexOf.apply( this.toArray.reverse(), arguments ); }, length: 0, map: function ( fn ) { var a = []; if ( __arrayProto.map ) { a = __arrayProto.map.call( this, fn, this ); } else { // Compatibility for browsers without EMCA-252-5 (JS 1.6) for ( var i=0, ien=this.length ; i<ien ; i++ ) { a.push( fn.call( this, this[i], i ) ); } } return new _Api( this.context, a ); }, pluck: function ( prop ) { return this.map( function ( el ) { return el[ prop ]; } ); }, pop: __arrayProto.pop, push: __arrayProto.push, // Does not return an API instance reduce: __arrayProto.reduce || function ( fn, init ) { return _fnReduce( this, fn, init, 0, this.length, 1 ); }, reduceRight: __arrayProto.reduceRight || function ( fn, init ) { return _fnReduce( this, fn, init, this.length-1, -1, -1 ); }, reverse: __arrayProto.reverse, // Object with rows, columns and opts selector: null, shift: __arrayProto.shift, sort: __arrayProto.sort, // ? name - order? splice: __arrayProto.splice, toArray: function () { return __arrayProto.slice.call( this ); }, to$: function () { return $( this ); }, toJQuery: function () { return $( this ); }, unique: function () { return new _Api( this.context, _unique(this) ); }, unshift: __arrayProto.unshift } ); _Api.extend = function ( scope, obj, ext ) { // Only extend API instances and static properties of the API if ( ! ext.length || ! obj || ( ! (obj instanceof _Api) && ! obj.__dt_wrapper ) ) { return; } var i, ien, j, jen, struct, inner, methodScoping = function ( scope, fn, struc ) { return function () { var ret = fn.apply( scope, arguments ); // Method extension _Api.extend( ret, ret, struc.methodExt ); return ret; }; }; for ( i=0, ien=ext.length ; i<ien ; i++ ) { struct = ext[i]; // Value obj[ struct.name ] = typeof struct.val === 'function' ? methodScoping( scope, struct.val, struct ) : $.isPlainObject( struct.val ) ? {} : struct.val; obj[ struct.name ].__dt_wrapper = true; // Property extension _Api.extend( scope, obj[ struct.name ], struct.propExt ); } }; // @todo - Is there need for an augment function? // _Api.augment = function ( inst, name ) // { // // Find src object in the structure from the name // var parts = name.split('.'); // _Api.extend( inst, obj ); // }; // [ // { // name: 'data' -- string - Property name // val: function () {}, -- function - Api method (or undefined if just an object // methodExt: [ ... ], -- array - Array of Api object definitions to extend the method result // propExt: [ ... ] -- array - Array of Api object definitions to extend the property // }, // { // name: 'row' // val: {}, // methodExt: [ ... ], // propExt: [ // { // name: 'data' // val: function () {}, // methodExt: [ ... ], // propExt: [ ... ] // }, // ... // ] // } // ] _Api.register = _api_register = function ( name, val ) { if ( $.isArray( name ) ) { for ( var j=0, jen=name.length ; j<jen ; j++ ) { _Api.register( name[j], val ); } return; } var i, ien, heir = name.split('.'), struct = __apiStruct, key, method; var find = function ( src, name ) { for ( var i=0, ien=src.length ; i<ien ; i++ ) { if ( src[i].name === name ) { return src[i]; } } return null; }; for ( i=0, ien=heir.length ; i<ien ; i++ ) { method = heir[i].indexOf('()') !== -1; key = method ? heir[i].replace('()', '') : heir[i]; var src = find( struct, key ); if ( ! src ) { src = { name: key, val: {}, methodExt: [], propExt: [] }; struct.push( src ); } if ( i === ien-1 ) { src.val = val; } else { struct = method ? src.methodExt : src.propExt; } } }; _Api.registerPlural = _api_registerPlural = function ( pluralName, singularName, val ) { _Api.register( pluralName, val ); _Api.register( singularName, function () { var ret = val.apply( this, arguments ); if ( ret === this ) { // Returned item is the API instance that was passed in, return it return this; } else if ( ret instanceof _Api ) { // New API instance returned, want the value from the first item // in the returned array for the singular result. return ret.length ? $.isArray( ret[0] ) ? new _Api( ret.context, ret[0] ) : // Array results are 'enhanced' ret[0] : undefined; } // Non-API return - just fire it back return ret; } ); }; /** * Selector for HTML tables. Apply the given selector to the give array of * DataTables settings objects. * * @param {string|integer} [selector] jQuery selector string or integer * @param {array} Array of DataTables settings objects to be filtered * @return {array} * @ignore */ var __table_selector = function ( selector, a ) { // Integer is used to pick out a table by index if ( typeof selector === 'number' ) { return [ a[ selector ] ]; } // Perform a jQuery selector on the table nodes var nodes = $.map( a, function (el, i) { return el.nTable; } ); return $(nodes) .filter( selector ) .map( function (i) { // Need to translate back from the table node to the settings var idx = $.inArray( this, nodes ); return a[ idx ]; } ) .toArray(); }; /** * Context selector for the API's context (i.e. the tables the API instance * refers to. * * @name DataTable.Api#tables * @param {string|integer} [selector] Selector to pick which tables the iterator * should operate on. If not given, all tables in the current context are * used. This can be given as a jQuery selector (for example `':gt(0)'`) to * select multiple tables or as an integer to select a single table. * @returns {DataTable.Api} Returns a new API instance if a selector is given. */ _api_register( 'tables()', function ( selector ) { // A new instance is created if there was a selector specified return selector ? new _Api( __table_selector( selector, this.context ) ) : this; } ); _api_register( 'table()', function ( selector ) { var tables = this.tables( selector ); var ctx = tables.context; // Truncate to the first matched table return ctx.length ? new _Api( ctx[0] ) : tables; } ); _api_registerPlural( 'tables().nodes()', 'table().node()' , function () { return this.iterator( 'table', function ( ctx ) { return ctx.nTable; }, 1 ); } ); _api_registerPlural( 'tables().body()', 'table().body()' , function () { return this.iterator( 'table', function ( ctx ) { return ctx.nTBody; }, 1 ); } ); _api_registerPlural( 'tables().header()', 'table().header()' , function () { return this.iterator( 'table', function ( ctx ) { return ctx.nTHead; }, 1 ); } ); _api_registerPlural( 'tables().footer()', 'table().footer()' , function () { return this.iterator( 'table', function ( ctx ) { return ctx.nTFoot; }, 1 ); } ); _api_registerPlural( 'tables().containers()', 'table().container()' , function () { return this.iterator( 'table', function ( ctx ) { return ctx.nTableWrapper; }, 1 ); } ); /** * Redraw the tables in the current context. */ _api_register( 'draw()', function ( paging ) { return this.iterator( 'table', function ( settings ) { if ( paging === 'page' ) { _fnDraw( settings ); } else { if ( typeof paging === 'string' ) { paging = paging === 'full-hold' ? false : true; } _fnReDraw( settings, paging===false ); } } ); } ); /** * Get the current page index. * * @return {integer} Current page index (zero based) *//** * Set the current page. * * Note that if you attempt to show a page which does not exist, DataTables will * not throw an error, but rather reset the paging. * * @param {integer|string} action The paging action to take. This can be one of: * * `integer` - The page index to jump to * * `string` - An action to take: * * `first` - Jump to first page. * * `next` - Jump to the next page * * `previous` - Jump to previous page * * `last` - Jump to the last page. * @returns {DataTables.Api} this */ _api_register( 'page()', function ( action ) { if ( action === undefined ) { return this.page.info().page; // not an expensive call } // else, have an action to take on all tables return this.iterator( 'table', function ( settings ) { _fnPageChange( settings, action ); } ); } ); /** * Paging information for the first table in the current context. * * If you require paging information for another table, use the `table()` method * with a suitable selector. * * @return {object} Object with the following properties set: * * `page` - Current page index (zero based - i.e. the first page is `0`) * * `pages` - Total number of pages * * `start` - Display index for the first record shown on the current page * * `end` - Display index for the last record shown on the current page * * `length` - Display length (number of records). Note that generally `start * + length = end`, but this is not always true, for example if there are * only 2 records to show on the final page, with a length of 10. * * `recordsTotal` - Full data set length * * `recordsDisplay` - Data set length once the current filtering criterion * are applied. */ _api_register( 'page.info()', function ( action ) { if ( this.context.length === 0 ) { return undefined; } var settings = this.context[0], start = settings._iDisplayStart, len = settings.oFeatures.bPaginate ? settings._iDisplayLength : -1, visRecords = settings.fnRecordsDisplay(), all = len === -1; return { "page": all ? 0 : Math.floor( start / len ), "pages": all ? 1 : Math.ceil( visRecords / len ), "start": start, "end": settings.fnDisplayEnd(), "length": len, "recordsTotal": settings.fnRecordsTotal(), "recordsDisplay": visRecords, "serverSide": _fnDataSource( settings ) === 'ssp' }; } ); /** * Get the current page length. * * @return {integer} Current page length. Note `-1` indicates that all records * are to be shown. *//** * Set the current page length. * * @param {integer} Page length to set. Use `-1` to show all records. * @returns {DataTables.Api} this */ _api_register( 'page.len()', function ( len ) { // Note that we can't call this function 'length()' because `length` // is a Javascript property of functions which defines how many arguments // the function expects. if ( len === undefined ) { return this.context.length !== 0 ? this.context[0]._iDisplayLength : undefined; } // else, set the page length return this.iterator( 'table', function ( settings ) { _fnLengthChange( settings, len ); } ); } ); var __reload = function ( settings, holdPosition, callback ) { // Use the draw event to trigger a callback if ( callback ) { var api = new _Api( settings ); api.one( 'draw', function () { callback( api.ajax.json() ); } ); } if ( _fnDataSource( settings ) == 'ssp' ) { _fnReDraw( settings, holdPosition ); } else { _fnProcessingDisplay( settings, true ); // Cancel an existing request var xhr = settings.jqXHR; if ( xhr && xhr.readyState !== 4 ) { xhr.abort(); } // Trigger xhr _fnBuildAjax( settings, [], function( json ) { _fnClearTable( settings ); var data = _fnAjaxDataSrc( settings, json ); for ( var i=0, ien=data.length ; i<ien ; i++ ) { _fnAddData( settings, data[i] ); } _fnReDraw( settings, holdPosition ); _fnProcessingDisplay( settings, false ); } ); } }; /** * Get the JSON response from the last Ajax request that DataTables made to the * server. Note that this returns the JSON from the first table in the current * context. * * @return {object} JSON received from the server. */ _api_register( 'ajax.json()', function () { var ctx = this.context; if ( ctx.length > 0 ) { return ctx[0].json; } // else return undefined; } ); /** * Get the data submitted in the last Ajax request */ _api_register( 'ajax.params()', function () { var ctx = this.context; if ( ctx.length > 0 ) { return ctx[0].oAjaxData; } // else return undefined; } ); /** * Reload tables from the Ajax data source. Note that this function will * automatically re-draw the table when the remote data has been loaded. * * @param {boolean} [reset=true] Reset (default) or hold the current paging * position. A full re-sort and re-filter is performed when this method is * called, which is why the pagination reset is the default action. * @returns {DataTables.Api} this */ _api_register( 'ajax.reload()', function ( callback, resetPaging ) { return this.iterator( 'table', function (settings) { __reload( settings, resetPaging===false, callback ); } ); } ); /** * Get the current Ajax URL. Note that this returns the URL from the first * table in the current context. * * @return {string} Current Ajax source URL *//** * Set the Ajax URL. Note that this will set the URL for all tables in the * current context. * * @param {string} url URL to set. * @returns {DataTables.Api} this */ _api_register( 'ajax.url()', function ( url ) { var ctx = this.context; if ( url === undefined ) { // get if ( ctx.length === 0 ) { return undefined; } ctx = ctx[0]; return ctx.ajax ? $.isPlainObject( ctx.ajax ) ? ctx.ajax.url : ctx.ajax : ctx.sAjaxSource; } // set return this.iterator( 'table', function ( settings ) { if ( $.isPlainObject( settings.ajax ) ) { settings.ajax.url = url; } else { settings.ajax = url; } // No need to consider sAjaxSource here since DataTables gives priority // to `ajax` over `sAjaxSource`. So setting `ajax` here, renders any // value of `sAjaxSource` redundant. } ); } ); /** * Load data from the newly set Ajax URL. Note that this method is only * available when `ajax.url()` is used to set a URL. Additionally, this method * has the same effect as calling `ajax.reload()` but is provided for * convenience when setting a new URL. Like `ajax.reload()` it will * automatically redraw the table once the remote data has been loaded. * * @returns {DataTables.Api} this */ _api_register( 'ajax.url().load()', function ( callback, resetPaging ) { // Same as a reload, but makes sense to present it for easy access after a // url change return this.iterator( 'table', function ( ctx ) { __reload( ctx, resetPaging===false, callback ); } ); } ); var _selector_run = function ( type, selector, selectFn, settings, opts ) { var out = [], res, a, i, ien, j, jen, selectorType = typeof selector; // Can't just check for isArray here, as an API or jQuery instance might be // given with their array like look if ( ! selector || selectorType === 'string' || selectorType === 'function' || selector.length === undefined ) { selector = [ selector ]; } for ( i=0, ien=selector.length ; i<ien ; i++ ) { // Only split on simple strings - complex expressions will be jQuery selectors a = selector[i] && selector[i].split && ! selector[i].match(/[\[\(:]/) ? selector[i].split(',') : [ selector[i] ]; for ( j=0, jen=a.length ; j<jen ; j++ ) { res = selectFn( typeof a[j] === 'string' ? $.trim(a[j]) : a[j] ); if ( res && res.length ) { out = out.concat( res ); } } } // selector extensions var ext = _ext.selector[ type ]; if ( ext.length ) { for ( i=0, ien=ext.length ; i<ien ; i++ ) { out = ext[i]( settings, opts, out ); } } return _unique( out ); }; var _selector_opts = function ( opts ) { if ( ! opts ) { opts = {}; } // Backwards compatibility for 1.9- which used the terminology filter rather // than search if ( opts.filter && opts.search === undefined ) { opts.search = opts.filter; } return $.extend( { search: 'none', order: 'current', page: 'all' }, opts ); }; var _selector_first = function ( inst ) { // Reduce the API instance to the first item found for ( var i=0, ien=inst.length ; i<ien ; i++ ) { if ( inst[i].length > 0 ) { // Assign the first element to the first item in the instance // and truncate the instance and context inst[0] = inst[i]; inst[0].length = 1; inst.length = 1; inst.context = [ inst.context[i] ]; return inst; } } // Not found - return an empty instance inst.length = 0; return inst; }; var _selector_row_indexes = function ( settings, opts ) { var i, ien, tmp, a=[], displayFiltered = settings.aiDisplay, displayMaster = settings.aiDisplayMaster; var search = opts.search, // none, applied, removed order = opts.order, // applied, current, index (original - compatibility with 1.9) page = opts.page; // all, current if ( _fnDataSource( settings ) == 'ssp' ) { // In server-side processing mode, most options are irrelevant since // rows not shown don't exist and the index order is the applied order // Removed is a special case - for consistency just return an empty // array return search === 'removed' ? [] : _range( 0, displayMaster.length ); } else if ( page == 'current' ) { // Current page implies that order=current and fitler=applied, since it is // fairly senseless otherwise, regardless of what order and search actually // are for ( i=settings._iDisplayStart, ien=settings.fnDisplayEnd() ; i<ien ; i++ ) { a.push( displayFiltered[i] ); } } else if ( order == 'current' || order == 'applied' ) { a = search == 'none' ? displayMaster.slice() : // no search search == 'applied' ? displayFiltered.slice() : // applied search $.map( displayMaster, function (el, i) { // removed search return $.inArray( el, displayFiltered ) === -1 ? el : null; } ); } else if ( order == 'index' || order == 'original' ) { for ( i=0, ien=settings.aoData.length ; i<ien ; i++ ) { if ( search == 'none' ) { a.push( i ); } else { // applied | removed tmp = $.inArray( i, displayFiltered ); if ((tmp === -1 && search == 'removed') || (tmp >= 0 && search == 'applied') ) { a.push( i ); } } } } return a; }; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Rows * * {} - no selector - use all available rows * {integer} - row aoData index * {node} - TR node * {string} - jQuery selector to apply to the TR elements * {array} - jQuery array of nodes, or simply an array of TR nodes * */ var __row_selector = function ( settings, selector, opts ) { var rows; var run = function ( sel ) { var selInt = _intVal( sel ); var i, ien; // Short cut - selector is a number and no options provided (default is // all records, so no need to check if the index is in there, since it // must be - dev error if the index doesn't exist). if ( selInt !== null && ! opts ) { return [ selInt ]; } if ( ! rows ) { rows = _selector_row_indexes( settings, opts ); } if ( selInt !== null && $.inArray( selInt, rows ) !== -1 ) { // Selector - integer return [ selInt ]; } else if ( sel === null || sel === undefined || sel === '' ) { // Selector - none return rows; } // Selector - function if ( typeof sel === 'function' ) { return $.map( rows, function (idx) { var row = settings.aoData[ idx ]; return sel( idx, row._aData, row.nTr ) ? idx : null; } ); } // Get nodes in the order from the `rows` array with null values removed var nodes = _removeEmpty( _pluck_order( settings.aoData, rows, 'nTr' ) ); // Selector - node if ( sel.nodeName ) { if ( sel._DT_RowIndex !== undefined ) { return [ sel._DT_RowIndex ]; // Property added by DT for fast lookup } else if ( sel._DT_CellIndex ) { return [ sel._DT_CellIndex.row ]; } else { var host = $(sel).closest('*[data-dt-row]'); return host.length ? [ host.data('dt-row') ] : []; } } // ID selector. Want to always be able to select rows by id, regardless // of if the tr element has been created or not, so can't rely upon // jQuery here - hence a custom implementation. This does not match // Sizzle's fast selector or HTML4 - in HTML5 the ID can be anything, // but to select it using a CSS selector engine (like Sizzle or // querySelect) it would need to need to be escaped for some characters. // DataTables simplifies this for row selectors since you can select // only a row. A # indicates an id any anything that follows is the id - // unescaped. if ( typeof sel === 'string' && sel.charAt(0) === '#' ) { // get row index from id var rowObj = settings.aIds[ sel.replace( /^#/, '' ) ]; if ( rowObj !== undefined ) { return [ rowObj.idx ]; } // need to fall through to jQuery in case there is DOM id that // matches } // Selector - jQuery selector string, array of nodes or jQuery object/ // As jQuery's .filter() allows jQuery objects to be passed in filter, // it also allows arrays, so this will cope with all three options return $(nodes) .filter( sel ) .map( function () { return this._DT_RowIndex; } ) .toArray(); }; return _selector_run( 'row', selector, run, settings, opts ); }; _api_register( 'rows()', function ( selector, opts ) { // argument shifting if ( selector === undefined ) { selector = ''; } else if ( $.isPlainObject( selector ) ) { opts = selector; selector = ''; } opts = _selector_opts( opts ); var inst = this.iterator( 'table', function ( settings ) { return __row_selector( settings, selector, opts ); }, 1 ); // Want argument shifting here and in __row_selector? inst.selector.rows = selector; inst.selector.opts = opts; return inst; } ); _api_register( 'rows().nodes()', function () { return this.iterator( 'row', function ( settings, row ) { return settings.aoData[ row ].nTr || undefined; }, 1 ); } ); _api_register( 'rows().data()', function () { return this.iterator( true, 'rows', function ( settings, rows ) { return _pluck_order( settings.aoData, rows, '_aData' ); }, 1 ); } ); _api_registerPlural( 'rows().cache()', 'row().cache()', function ( type ) { return this.iterator( 'row', function ( settings, row ) { var r = settings.aoData[ row ]; return type === 'search' ? r._aFilterData : r._aSortData; }, 1 ); } ); _api_registerPlural( 'rows().invalidate()', 'row().invalidate()', function ( src ) { return this.iterator( 'row', function ( settings, row ) { _fnInvalidate( settings, row, src ); } ); } ); _api_registerPlural( 'rows().indexes()', 'row().index()', function () { return this.iterator( 'row', function ( settings, row ) { return row; }, 1 ); } ); _api_registerPlural( 'rows().ids()', 'row().id()', function ( hash ) { var a = []; var context = this.context; // `iterator` will drop undefined values, but in this case we want them for ( var i=0, ien=context.length ; i<ien ; i++ ) { for ( var j=0, jen=this[i].length ; j<jen ; j++ ) { var id = context[i].rowIdFn( context[i].aoData[ this[i][j] ]._aData ); a.push( (hash === true ? '#' : '' )+ id ); } } return new _Api( context, a ); } ); _api_registerPlural( 'rows().remove()', 'row().remove()', function () { var that = this; this.iterator( 'row', function ( settings, row, thatIdx ) { var data = settings.aoData; var rowData = data[ row ]; var i, ien, j, jen; var loopRow, loopCells; data.splice( row, 1 ); // Update the cached indexes for ( i=0, ien=data.length ; i<ien ; i++ ) { loopRow = data[i]; loopCells = loopRow.anCells; // Rows if ( loopRow.nTr !== null ) { loopRow.nTr._DT_RowIndex = i; } // Cells if ( loopCells !== null ) { for ( j=0, jen=loopCells.length ; j<jen ; j++ ) { loopCells[j]._DT_CellIndex.row = i; } } } // Delete from the display arrays _fnDeleteIndex( settings.aiDisplayMaster, row ); _fnDeleteIndex( settings.aiDisplay, row ); _fnDeleteIndex( that[ thatIdx ], row, false ); // maintain local indexes // Check for an 'overflow' they case for displaying the table _fnLengthOverflow( settings ); // Remove the row's ID reference if there is one var id = settings.rowIdFn( rowData._aData ); if ( id !== undefined ) { delete settings.aIds[ id ]; } } ); this.iterator( 'table', function ( settings ) { for ( var i=0, ien=settings.aoData.length ; i<ien ; i++ ) { settings.aoData[i].idx = i; } } ); return this; } ); _api_register( 'rows.add()', function ( rows ) { var newRows = this.iterator( 'table', function ( settings ) { var row, i, ien; var out = []; for ( i=0, ien=rows.length ; i<ien ; i++ ) { row = rows[i]; if ( row.nodeName && row.nodeName.toUpperCase() === 'TR' ) { out.push( _fnAddTr( settings, row )[0] ); } else { out.push( _fnAddData( settings, row ) ); } } return out; }, 1 ); // Return an Api.rows() extended instance, so rows().nodes() etc can be used var modRows = this.rows( -1 ); modRows.pop(); $.merge( modRows, newRows ); return modRows; } ); /** * */ _api_register( 'row()', function ( selector, opts ) { return _selector_first( this.rows( selector, opts ) ); } ); _api_register( 'row().data()', function ( data ) { var ctx = this.context; if ( data === undefined ) { // Get return ctx.length && this.length ? ctx[0].aoData[ this[0] ]._aData : undefined; } // Set ctx[0].aoData[ this[0] ]._aData = data; // Automatically invalidate _fnInvalidate( ctx[0], this[0], 'data' ); return this; } ); _api_register( 'row().node()', function () { var ctx = this.context; return ctx.length && this.length ? ctx[0].aoData[ this[0] ].nTr || null : null; } ); _api_register( 'row.add()', function ( row ) { // Allow a jQuery object to be passed in - only a single row is added from // it though - the first element in the set if ( row instanceof $ && row.length ) { row = row[0]; } var rows = this.iterator( 'table', function ( settings ) { if ( row.nodeName && row.nodeName.toUpperCase() === 'TR' ) { return _fnAddTr( settings, row )[0]; } return _fnAddData( settings, row ); } ); // Return an Api.rows() extended instance, with the newly added row selected return this.row( rows[0] ); } ); var __details_add = function ( ctx, row, data, klass ) { // Convert to array of TR elements var rows = []; var addRow = function ( r, k ) { // Recursion to allow for arrays of jQuery objects if ( $.isArray( r ) || r instanceof $ ) { for ( var i=0, ien=r.length ; i<ien ; i++ ) { addRow( r[i], k ); } return; } // If we get a TR element, then just add it directly - up to the dev // to add the correct number of columns etc if ( r.nodeName && r.nodeName.toLowerCase() === 'tr' ) { rows.push( r ); } else { // Otherwise create a row with a wrapper var created = $('<tr><td/></tr>').addClass( k ); $('td', created) .addClass( k ) .html( r ) [0].colSpan = _fnVisbleColumns( ctx ); rows.push( created[0] ); } }; addRow( data, klass ); if ( row._details ) { row._details.detach(); } row._details = $(rows); // If the children were already shown, that state should be retained if ( row._detailsShow ) { row._details.insertAfter( row.nTr ); } }; var __details_remove = function ( api, idx ) { var ctx = api.context; if ( ctx.length ) { var row = ctx[0].aoData[ idx !== undefined ? idx : api[0] ]; if ( row && row._details ) { row._details.remove(); row._detailsShow = undefined; row._details = undefined; } } }; var __details_display = function ( api, show ) { var ctx = api.context; if ( ctx.length && api.length ) { var row = ctx[0].aoData[ api[0] ]; if ( row._details ) { row._detailsShow = show; if ( show ) { row._details.insertAfter( row.nTr ); } else { row._details.detach(); } __details_events( ctx[0] ); } } }; var __details_events = function ( settings ) { var api = new _Api( settings ); var namespace = '.dt.DT_details'; var drawEvent = 'draw'+namespace; var colvisEvent = 'column-visibility'+namespace; var destroyEvent = 'destroy'+namespace; var data = settings.aoData; api.off( drawEvent +' '+ colvisEvent +' '+ destroyEvent ); if ( _pluck( data, '_details' ).length > 0 ) { // On each draw, insert the required elements into the document api.on( drawEvent, function ( e, ctx ) { if ( settings !== ctx ) { return; } api.rows( {page:'current'} ).eq(0).each( function (idx) { // Internal data grab var row = data[ idx ]; if ( row._detailsShow ) { row._details.insertAfter( row.nTr ); } } ); } ); // Column visibility change - update the colspan api.on( colvisEvent, function ( e, ctx, idx, vis ) { if ( settings !== ctx ) { return; } // Update the colspan for the details rows (note, only if it already has // a colspan) var row, visible = _fnVisbleColumns( ctx ); for ( var i=0, ien=data.length ; i<ien ; i++ ) { row = data[i]; if ( row._details ) { row._details.children('td[colspan]').attr('colspan', visible ); } } } ); // Table destroyed - nuke any child rows api.on( destroyEvent, function ( e, ctx ) { if ( settings !== ctx ) { return; } for ( var i=0, ien=data.length ; i<ien ; i++ ) { if ( data[i]._details ) { __details_remove( api, i ); } } } ); } }; // Strings for the method names to help minification var _emp = ''; var _child_obj = _emp+'row().child'; var _child_mth = _child_obj+'()'; // data can be: // tr // string // jQuery or array of any of the above _api_register( _child_mth, function ( data, klass ) { var ctx = this.context; if ( data === undefined ) { // get return ctx.length && this.length ? ctx[0].aoData[ this[0] ]._details : undefined; } else if ( data === true ) { // show this.child.show(); } else if ( data === false ) { // remove __details_remove( this ); } else if ( ctx.length && this.length ) { // set __details_add( ctx[0], ctx[0].aoData[ this[0] ], data, klass ); } return this; } ); _api_register( [ _child_obj+'.show()', _child_mth+'.show()' // only when `child()` was called with parameters (without ], function ( show ) { // it returns an object and this method is not executed) __details_display( this, true ); return this; } ); _api_register( [ _child_obj+'.hide()', _child_mth+'.hide()' // only when `child()` was called with parameters (without ], function () { // it returns an object and this method is not executed) __details_display( this, false ); return this; } ); _api_register( [ _child_obj+'.remove()', _child_mth+'.remove()' // only when `child()` was called with parameters (without ], function () { // it returns an object and this method is not executed) __details_remove( this ); return this; } ); _api_register( _child_obj+'.isShown()', function () { var ctx = this.context; if ( ctx.length && this.length ) { // _detailsShown as false or undefined will fall through to return false return ctx[0].aoData[ this[0] ]._detailsShow || false; } return false; } ); /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Columns * * {integer} - column index (>=0 count from left, <0 count from right) * "{integer}:visIdx" - visible column index (i.e. translate to column index) (>=0 count from left, <0 count from right) * "{integer}:visible" - alias for {integer}:visIdx (>=0 count from left, <0 count from right) * "{string}:name" - column name * "{string}" - jQuery selector on column header nodes * */ // can be an array of these items, comma separated list, or an array of comma // separated lists var __re_column_selector = /^([^:]+):(name|visIdx|visible)$/; // r1 and r2 are redundant - but it means that the parameters match for the // iterator callback in columns().data() var __columnData = function ( settings, column, r1, r2, rows ) { var a = []; for ( var row=0, ien=rows.length ; row<ien ; row++ ) { a.push( _fnGetCellData( settings, rows[row], column ) ); } return a; }; var __column_selector = function ( settings, selector, opts ) { var columns = settings.aoColumns, names = _pluck( columns, 'sName' ), nodes = _pluck( columns, 'nTh' ); var run = function ( s ) { var selInt = _intVal( s ); // Selector - all if ( s === '' ) { return _range( columns.length ); } // Selector - index if ( selInt !== null ) { return [ selInt >= 0 ? selInt : // Count from left columns.length + selInt // Count from right (+ because its a negative value) ]; } // Selector = function if ( typeof s === 'function' ) { var rows = _selector_row_indexes( settings, opts ); return $.map( columns, function (col, idx) { return s( idx, __columnData( settings, idx, 0, 0, rows ), nodes[ idx ] ) ? idx : null; } ); } // jQuery or string selector var match = typeof s === 'string' ? s.match( __re_column_selector ) : ''; if ( match ) { switch( match[2] ) { case 'visIdx': case 'visible': var idx = parseInt( match[1], 10 ); // Visible index given, convert to column index if ( idx < 0 ) { // Counting from the right var visColumns = $.map( columns, function (col,i) { return col.bVisible ? i : null; } ); return [ visColumns[ visColumns.length + idx ] ]; } // Counting from the left return [ _fnVisibleToColumnIndex( settings, idx ) ]; case 'name': // match by name. `names` is column index complete and in order return $.map( names, function (name, i) { return name === match[1] ? i : null; } ); default: return []; } } // Cell in the table body if ( s.nodeName && s._DT_CellIndex ) { return [ s._DT_CellIndex.column ]; } // jQuery selector on the TH elements for the columns var jqResult = $( nodes ) .filter( s ) .map( function () { return $.inArray( this, nodes ); // `nodes` is column index complete and in order } ) .toArray(); if ( jqResult.length || ! s.nodeName ) { return jqResult; } // Otherwise a node which might have a `dt-column` data attribute, or be // a child or such an element var host = $(s).closest('*[data-dt-column]'); return host.length ? [ host.data('dt-column') ] : []; }; return _selector_run( 'column', selector, run, settings, opts ); }; var __setColumnVis = function ( settings, column, vis ) { var cols = settings.aoColumns, col = cols[ column ], data = settings.aoData, row, cells, i, ien, tr; // Get if ( vis === undefined ) { return col.bVisible; } // Set // No change if ( col.bVisible === vis ) { return; } if ( vis ) { // Insert column // Need to decide if we should use appendChild or insertBefore var insertBefore = $.inArray( true, _pluck(cols, 'bVisible'), column+1 ); for ( i=0, ien=data.length ; i<ien ; i++ ) { tr = data[i].nTr; cells = data[i].anCells; if ( tr ) { // insertBefore can act like appendChild if 2nd arg is null tr.insertBefore( cells[ column ], cells[ insertBefore ] || null ); } } } else { // Remove column $( _pluck( settings.aoData, 'anCells', column ) ).detach(); } // Common actions col.bVisible = vis; _fnDrawHead( settings, settings.aoHeader ); _fnDrawHead( settings, settings.aoFooter ); _fnSaveState( settings ); }; _api_register( 'columns()', function ( selector, opts ) { // argument shifting if ( selector === undefined ) { selector = ''; } else if ( $.isPlainObject( selector ) ) { opts = selector; selector = ''; } opts = _selector_opts( opts ); var inst = this.iterator( 'table', function ( settings ) { return __column_selector( settings, selector, opts ); }, 1 ); // Want argument shifting here and in _row_selector? inst.selector.cols = selector; inst.selector.opts = opts; return inst; } ); _api_registerPlural( 'columns().header()', 'column().header()', function ( selector, opts ) { return this.iterator( 'column', function ( settings, column ) { return settings.aoColumns[column].nTh; }, 1 ); } ); _api_registerPlural( 'columns().footer()', 'column().footer()', function ( selector, opts ) { return this.iterator( 'column', function ( settings, column ) { return settings.aoColumns[column].nTf; }, 1 ); } ); _api_registerPlural( 'columns().data()', 'column().data()', function () { return this.iterator( 'column-rows', __columnData, 1 ); } ); _api_registerPlural( 'columns().dataSrc()', 'column().dataSrc()', function () { return this.iterator( 'column', function ( settings, column ) { return settings.aoColumns[column].mData; }, 1 ); } ); _api_registerPlural( 'columns().cache()', 'column().cache()', function ( type ) { return this.iterator( 'column-rows', function ( settings, column, i, j, rows ) { return _pluck_order( settings.aoData, rows, type === 'search' ? '_aFilterData' : '_aSortData', column ); }, 1 ); } ); _api_registerPlural( 'columns().nodes()', 'column().nodes()', function () { return this.iterator( 'column-rows', function ( settings, column, i, j, rows ) { return _pluck_order( settings.aoData, rows, 'anCells', column ) ; }, 1 ); } ); _api_registerPlural( 'columns().visible()', 'column().visible()', function ( vis, calc ) { var ret = this.iterator( 'column', function ( settings, column ) { if ( vis === undefined ) { return settings.aoColumns[ column ].bVisible; } // else __setColumnVis( settings, column, vis ); } ); // Group the column visibility changes if ( vis !== undefined ) { // Second loop once the first is done for events this.iterator( 'column', function ( settings, column ) { _fnCallbackFire( settings, null, 'column-visibility', [settings, column, vis, calc] ); } ); if ( calc === undefined || calc ) { this.columns.adjust(); } } return ret; } ); _api_registerPlural( 'columns().indexes()', 'column().index()', function ( type ) { return this.iterator( 'column', function ( settings, column ) { return type === 'visible' ? _fnColumnIndexToVisible( settings, column ) : column; }, 1 ); } ); _api_register( 'columns.adjust()', function () { return this.iterator( 'table', function ( settings ) { _fnAdjustColumnSizing( settings ); }, 1 ); } ); _api_register( 'column.index()', function ( type, idx ) { if ( this.context.length !== 0 ) { var ctx = this.context[0]; if ( type === 'fromVisible' || type === 'toData' ) { return _fnVisibleToColumnIndex( ctx, idx ); } else if ( type === 'fromData' || type === 'toVisible' ) { return _fnColumnIndexToVisible( ctx, idx ); } } } ); _api_register( 'column()', function ( selector, opts ) { return _selector_first( this.columns( selector, opts ) ); } ); var __cell_selector = function ( settings, selector, opts ) { var data = settings.aoData; var rows = _selector_row_indexes( settings, opts ); var cells = _removeEmpty( _pluck_order( data, rows, 'anCells' ) ); var allCells = $( [].concat.apply([], cells) ); var row; var columns = settings.aoColumns.length; var a, i, ien, j, o, host; var run = function ( s ) { var fnSelector = typeof s === 'function'; if ( s === null || s === undefined || fnSelector ) { // All cells and function selectors a = []; for ( i=0, ien=rows.length ; i<ien ; i++ ) { row = rows[i]; for ( j=0 ; j<columns ; j++ ) { o = { row: row, column: j }; if ( fnSelector ) { // Selector - function host = data[ row ]; if ( s( o, _fnGetCellData(settings, row, j), host.anCells ? host.anCells[j] : null ) ) { a.push( o ); } } else { // Selector - all a.push( o ); } } } return a; } // Selector - index if ( $.isPlainObject( s ) ) { return [s]; } // Selector - jQuery filtered cells var jqResult = allCells .filter( s ) .map( function (i, el) { return { // use a new object, in case someone changes the values row: el._DT_CellIndex.row, column: el._DT_CellIndex.column }; } ) .toArray(); if ( jqResult.length || ! s.nodeName ) { return jqResult; } // Otherwise the selector is a node, and there is one last option - the // element might be a child of an element which has dt-row and dt-column // data attributes host = $(s).closest('*[data-dt-row]'); return host.length ? [ { row: host.data('dt-row'), column: host.data('dt-column') } ] : []; }; return _selector_run( 'cell', selector, run, settings, opts ); }; _api_register( 'cells()', function ( rowSelector, columnSelector, opts ) { // Argument shifting if ( $.isPlainObject( rowSelector ) ) { // Indexes if ( rowSelector.row === undefined ) { // Selector options in first parameter opts = rowSelector; rowSelector = null; } else { // Cell index objects in first parameter opts = columnSelector; columnSelector = null; } } if ( $.isPlainObject( columnSelector ) ) { opts = columnSelector; columnSelector = null; } // Cell selector if ( columnSelector === null || columnSelector === undefined ) { return this.iterator( 'table', function ( settings ) { return __cell_selector( settings, rowSelector, _selector_opts( opts ) ); } ); } // Row + column selector var columns = this.columns( columnSelector, opts ); var rows = this.rows( rowSelector, opts ); var a, i, ien, j, jen; var cells = this.iterator( 'table', function ( settings, idx ) { a = []; for ( i=0, ien=rows[idx].length ; i<ien ; i++ ) { for ( j=0, jen=columns[idx].length ; j<jen ; j++ ) { a.push( { row: rows[idx][i], column: columns[idx][j] } ); } } return a; }, 1 ); $.extend( cells.selector, { cols: columnSelector, rows: rowSelector, opts: opts } ); return cells; } ); _api_registerPlural( 'cells().nodes()', 'cell().node()', function () { return this.iterator( 'cell', function ( settings, row, column ) { var data = settings.aoData[ row ]; return data && data.anCells ? data.anCells[ column ] : undefined; }, 1 ); } ); _api_register( 'cells().data()', function () { return this.iterator( 'cell', function ( settings, row, column ) { return _fnGetCellData( settings, row, column ); }, 1 ); } ); _api_registerPlural( 'cells().cache()', 'cell().cache()', function ( type ) { type = type === 'search' ? '_aFilterData' : '_aSortData'; return this.iterator( 'cell', function ( settings, row, column ) { return settings.aoData[ row ][ type ][ column ]; }, 1 ); } ); _api_registerPlural( 'cells().render()', 'cell().render()', function ( type ) { return this.iterator( 'cell', function ( settings, row, column ) { return _fnGetCellData( settings, row, column, type ); }, 1 ); } ); _api_registerPlural( 'cells().indexes()', 'cell().index()', function () { return this.iterator( 'cell', function ( settings, row, column ) { return { row: row, column: column, columnVisible: _fnColumnIndexToVisible( settings, column ) }; }, 1 ); } ); _api_registerPlural( 'cells().invalidate()', 'cell().invalidate()', function ( src ) { return this.iterator( 'cell', function ( settings, row, column ) { _fnInvalidate( settings, row, src, column ); } ); } ); _api_register( 'cell()', function ( rowSelector, columnSelector, opts ) { return _selector_first( this.cells( rowSelector, columnSelector, opts ) ); } ); _api_register( 'cell().data()', function ( data ) { var ctx = this.context; var cell = this[0]; if ( data === undefined ) { // Get return ctx.length && cell.length ? _fnGetCellData( ctx[0], cell[0].row, cell[0].column ) : undefined; } // Set _fnSetCellData( ctx[0], cell[0].row, cell[0].column, data ); _fnInvalidate( ctx[0], cell[0].row, 'data', cell[0].column ); return this; } ); /** * Get current ordering (sorting) that has been applied to the table. * * @returns {array} 2D array containing the sorting information for the first * table in the current context. Each element in the parent array represents * a column being sorted upon (i.e. multi-sorting with two columns would have * 2 inner arrays). The inner arrays may have 2 or 3 elements. The first is * the column index that the sorting condition applies to, the second is the * direction of the sort (`desc` or `asc`) and, optionally, the third is the * index of the sorting order from the `column.sorting` initialisation array. *//** * Set the ordering for the table. * * @param {integer} order Column index to sort upon. * @param {string} direction Direction of the sort to be applied (`asc` or `desc`) * @returns {DataTables.Api} this *//** * Set the ordering for the table. * * @param {array} order 1D array of sorting information to be applied. * @param {array} [...] Optional additional sorting conditions * @returns {DataTables.Api} this *//** * Set the ordering for the table. * * @param {array} order 2D array of sorting information to be applied. * @returns {DataTables.Api} this */ _api_register( 'order()', function ( order, dir ) { var ctx = this.context; if ( order === undefined ) { // get return ctx.length !== 0 ? ctx[0].aaSorting : undefined; } // set if ( typeof order === 'number' ) { // Simple column / direction passed in order = [ [ order, dir ] ]; } else if ( order.length && ! $.isArray( order[0] ) ) { // Arguments passed in (list of 1D arrays) order = Array.prototype.slice.call( arguments ); } // otherwise a 2D array was passed in return this.iterator( 'table', function ( settings ) { settings.aaSorting = order.slice(); } ); } ); /** * Attach a sort listener to an element for a given column * * @param {node|jQuery|string} node Identifier for the element(s) to attach the * listener to. This can take the form of a single DOM node, a jQuery * collection of nodes or a jQuery selector which will identify the node(s). * @param {integer} column the column that a click on this node will sort on * @param {function} [callback] callback function when sort is run * @returns {DataTables.Api} this */ _api_register( 'order.listener()', function ( node, column, callback ) { return this.iterator( 'table', function ( settings ) { _fnSortAttachListener( settings, node, column, callback ); } ); } ); _api_register( 'order.fixed()', function ( set ) { if ( ! set ) { var ctx = this.context; var fixed = ctx.length ? ctx[0].aaSortingFixed : undefined; return $.isArray( fixed ) ? { pre: fixed } : fixed; } return this.iterator( 'table', function ( settings ) { settings.aaSortingFixed = $.extend( true, {}, set ); } ); } ); // Order by the selected column(s) _api_register( [ 'columns().order()', 'column().order()' ], function ( dir ) { var that = this; return this.iterator( 'table', function ( settings, i ) { var sort = []; $.each( that[i], function (j, col) { sort.push( [ col, dir ] ); } ); settings.aaSorting = sort; } ); } ); _api_register( 'search()', function ( input, regex, smart, caseInsen ) { var ctx = this.context; if ( input === undefined ) { // get return ctx.length !== 0 ? ctx[0].oPreviousSearch.sSearch : undefined; } // set return this.iterator( 'table', function ( settings ) { if ( ! settings.oFeatures.bFilter ) { return; } _fnFilterComplete( settings, $.extend( {}, settings.oPreviousSearch, { "sSearch": input+"", "bRegex": regex === null ? false : regex, "bSmart": smart === null ? true : smart, "bCaseInsensitive": caseInsen === null ? true : caseInsen } ), 1 ); } ); } ); _api_registerPlural( 'columns().search()', 'column().search()', function ( input, regex, smart, caseInsen ) { return this.iterator( 'column', function ( settings, column ) { var preSearch = settings.aoPreSearchCols; if ( input === undefined ) { // get return preSearch[ column ].sSearch; } // set if ( ! settings.oFeatures.bFilter ) { return; } $.extend( preSearch[ column ], { "sSearch": input+"", "bRegex": regex === null ? false : regex, "bSmart": smart === null ? true : smart, "bCaseInsensitive": caseInsen === null ? true : caseInsen } ); _fnFilterComplete( settings, settings.oPreviousSearch, 1 ); } ); } ); /* * State API methods */ _api_register( 'state()', function () { return this.context.length ? this.context[0].oSavedState : null; } ); _api_register( 'state.clear()', function () { return this.iterator( 'table', function ( settings ) { // Save an empty object settings.fnStateSaveCallback.call( settings.oInstance, settings, {} ); } ); } ); _api_register( 'state.loaded()', function () { return this.context.length ? this.context[0].oLoadedState : null; } ); _api_register( 'state.save()', function () { return this.iterator( 'table', function ( settings ) { _fnSaveState( settings ); } ); } ); /** * Provide a common method for plug-ins to check the version of DataTables being * used, in order to ensure compatibility. * * @param {string} version Version string to check for, in the format "X.Y.Z". * Note that the formats "X" and "X.Y" are also acceptable. * @returns {boolean} true if this version of DataTables is greater or equal to * the required version, or false if this version of DataTales is not * suitable * @static * @dtopt API-Static * * @example * alert( $.fn.dataTable.versionCheck( '1.9.0' ) ); */ DataTable.versionCheck = DataTable.fnVersionCheck = function( version ) { var aThis = DataTable.version.split('.'); var aThat = version.split('.'); var iThis, iThat; for ( var i=0, iLen=aThat.length ; i<iLen ; i++ ) { iThis = parseInt( aThis[i], 10 ) || 0; iThat = parseInt( aThat[i], 10 ) || 0; // Parts are the same, keep comparing if (iThis === iThat) { continue; } // Parts are different, return immediately return iThis > iThat; } return true; }; /** * Check if a `<table>` node is a DataTable table already or not. * * @param {node|jquery|string} table Table node, jQuery object or jQuery * selector for the table to test. Note that if more than more than one * table is passed on, only the first will be checked * @returns {boolean} true the table given is a DataTable, or false otherwise * @static * @dtopt API-Static * * @example * if ( ! $.fn.DataTable.isDataTable( '#example' ) ) { * $('#example').dataTable(); * } */ DataTable.isDataTable = DataTable.fnIsDataTable = function ( table ) { var t = $(table).get(0); var is = false; if ( table instanceof DataTable.Api ) { return true; } $.each( DataTable.settings, function (i, o) { var head = o.nScrollHead ? $('table', o.nScrollHead)[0] : null; var foot = o.nScrollFoot ? $('table', o.nScrollFoot)[0] : null; if ( o.nTable === t || head === t || foot === t ) { is = true; } } ); return is; }; /** * Get all DataTable tables that have been initialised - optionally you can * select to get only currently visible tables. * * @param {boolean} [visible=false] Flag to indicate if you want all (default) * or visible tables only. * @returns {array} Array of `table` nodes (not DataTable instances) which are * DataTables * @static * @dtopt API-Static * * @example * $.each( $.fn.dataTable.tables(true), function () { * $(table).DataTable().columns.adjust(); * } ); */ DataTable.tables = DataTable.fnTables = function ( visible ) { var api = false; if ( $.isPlainObject( visible ) ) { api = visible.api; visible = visible.visible; } var a = $.map( DataTable.settings, function (o) { if ( !visible || (visible && $(o.nTable).is(':visible')) ) { return o.nTable; } } ); return api ? new _Api( a ) : a; }; /** * Convert from camel case parameters to Hungarian notation. This is made public * for the extensions to provide the same ability as DataTables core to accept * either the 1.9 style Hungarian notation, or the 1.10+ style camelCase * parameters. * * @param {object} src The model object which holds all parameters that can be * mapped. * @param {object} user The object to convert from camel case to Hungarian. * @param {boolean} force When set to `true`, properties which already have a * Hungarian value in the `user` object will be overwritten. Otherwise they * won't be. */ DataTable.camelToHungarian = _fnCamelToHungarian; /** * */ _api_register( '$()', function ( selector, opts ) { var rows = this.rows( opts ).nodes(), // Get all rows jqRows = $(rows); return $( [].concat( jqRows.filter( selector ).toArray(), jqRows.find( selector ).toArray() ) ); } ); // jQuery functions to operate on the tables $.each( [ 'on', 'one', 'off' ], function (i, key) { _api_register( key+'()', function ( /* event, handler */ ) { var args = Array.prototype.slice.call(arguments); // Add the `dt` namespace automatically if it isn't already present args[0] = $.map( args[0].split( /\s/ ), function ( e ) { return ! e.match(/\.dt\b/) ? e+'.dt' : e; } ).join( ' ' ); var inst = $( this.tables().nodes() ); inst[key].apply( inst, args ); return this; } ); } ); _api_register( 'clear()', function () { return this.iterator( 'table', function ( settings ) { _fnClearTable( settings ); } ); } ); _api_register( 'settings()', function () { return new _Api( this.context, this.context ); } ); _api_register( 'init()', function () { var ctx = this.context; return ctx.length ? ctx[0].oInit : null; } ); _api_register( 'data()', function () { return this.iterator( 'table', function ( settings ) { return _pluck( settings.aoData, '_aData' ); } ).flatten(); } ); _api_register( 'destroy()', function ( remove ) { remove = remove || false; return this.iterator( 'table', function ( settings ) { var orig = settings.nTableWrapper.parentNode; var classes = settings.oClasses; var table = settings.nTable; var tbody = settings.nTBody; var thead = settings.nTHead; var tfoot = settings.nTFoot; var jqTable = $(table); var jqTbody = $(tbody); var jqWrapper = $(settings.nTableWrapper); var rows = $.map( settings.aoData, function (r) { return r.nTr; } ); var i, ien; // Flag to note that the table is currently being destroyed - no action // should be taken settings.bDestroying = true; // Fire off the destroy callbacks for plug-ins etc _fnCallbackFire( settings, "aoDestroyCallback", "destroy", [settings] ); // If not being removed from the document, make all columns visible if ( ! remove ) { new _Api( settings ).columns().visible( true ); } // Blitz all `DT` namespaced events (these are internal events, the // lowercase, `dt` events are user subscribed and they are responsible // for removing them jqWrapper.off('.DT').find(':not(tbody *)').off('.DT'); $(window).off('.DT-'+settings.sInstance); // When scrolling we had to break the table up - restore it if ( table != thead.parentNode ) { jqTable.children('thead').detach(); jqTable.append( thead ); } if ( tfoot && table != tfoot.parentNode ) { jqTable.children('tfoot').detach(); jqTable.append( tfoot ); } settings.aaSorting = []; settings.aaSortingFixed = []; _fnSortingClasses( settings ); $( rows ).removeClass( settings.asStripeClasses.join(' ') ); $('th, td', thead).removeClass( classes.sSortable+' '+ classes.sSortableAsc+' '+classes.sSortableDesc+' '+classes.sSortableNone ); if ( settings.bJUI ) { $('th span.'+classes.sSortIcon+ ', td span.'+classes.sSortIcon, thead).detach(); $('th, td', thead).each( function () { var wrapper = $('div.'+classes.sSortJUIWrapper, this); $(this).append( wrapper.contents() ); wrapper.detach(); } ); } // Add the TR elements back into the table in their original order jqTbody.children().detach(); jqTbody.append( rows ); // Remove the DataTables generated nodes, events and classes var removedMethod = remove ? 'remove' : 'detach'; jqTable[ removedMethod ](); jqWrapper[ removedMethod ](); // If we need to reattach the table to the document if ( ! remove && orig ) { // insertBefore acts like appendChild if !arg[1] orig.insertBefore( table, settings.nTableReinsertBefore ); // Restore the width of the original table - was read from the style property, // so we can restore directly to that jqTable .css( 'width', settings.sDestroyWidth ) .removeClass( classes.sTable ); // If the were originally stripe classes - then we add them back here. // Note this is not fool proof (for example if not all rows had stripe // classes - but it's a good effort without getting carried away ien = settings.asDestroyStripes.length; if ( ien ) { jqTbody.children().each( function (i) { $(this).addClass( settings.asDestroyStripes[i % ien] ); } ); } } /* Remove the settings object from the settings array */ var idx = $.inArray( settings, DataTable.settings ); if ( idx !== -1 ) { DataTable.settings.splice( idx, 1 ); } } ); } ); // Add the `every()` method for rows, columns and cells in a compact form $.each( [ 'column', 'row', 'cell' ], function ( i, type ) { _api_register( type+'s().every()', function ( fn ) { var opts = this.selector.opts; var api = this; return this.iterator( type, function ( settings, arg1, arg2, arg3, arg4 ) { // Rows and columns: // arg1 - index // arg2 - table counter // arg3 - loop counter // arg4 - undefined // Cells: // arg1 - row index // arg2 - column index // arg3 - table counter // arg4 - loop counter fn.call( api[ type ]( arg1, type==='cell' ? arg2 : opts, type==='cell' ? opts : undefined ), arg1, arg2, arg3, arg4 ); } ); } ); } ); // i18n method for extensions to be able to use the language object from the // DataTable _api_register( 'i18n()', function ( token, def, plural ) { var ctx = this.context[0]; var resolved = _fnGetObjectDataFn( token )( ctx.oLanguage ); if ( resolved === undefined ) { resolved = def; } if ( plural !== undefined && $.isPlainObject( resolved ) ) { resolved = resolved[ plural ] !== undefined ? resolved[ plural ] : resolved._; } return resolved.replace( '%d', plural ); // nb: plural might be undefined, } ); /** * Version string for plug-ins to check compatibility. Allowed format is * `a.b.c-d` where: a:int, b:int, c:int, d:string(dev|beta|alpha). `d` is used * only for non-release builds. See http://semver.org/ for more information. * @member * @type string * @default Version number */ DataTable.version = "1.10.13"; /** * Private data store, containing all of the settings objects that are * created for the tables on a given page. * * Note that the `DataTable.settings` object is aliased to * `jQuery.fn.dataTableExt` through which it may be accessed and * manipulated, or `jQuery.fn.dataTable.settings`. * @member * @type array * @default [] * @private */ DataTable.settings = []; /** * Object models container, for the various models that DataTables has * available to it. These models define the objects that are used to hold * the active state and configuration of the table. * @namespace */ DataTable.models = {}; /** * Template object for the way in which DataTables holds information about * search information for the global filter and individual column filters. * @namespace */ DataTable.models.oSearch = { /** * Flag to indicate if the filtering should be case insensitive or not * @type boolean * @default true */ "bCaseInsensitive": true, /** * Applied search term * @type string * @default <i>Empty string</i> */ "sSearch": "", /** * Flag to indicate if the search term should be interpreted as a * regular expression (true) or not (false) and therefore and special * regex characters escaped. * @type boolean * @default false */ "bRegex": false, /** * Flag to indicate if DataTables is to use its smart filtering or not. * @type boolean * @default true */ "bSmart": true }; /** * Template object for the way in which DataTables holds information about * each individual row. This is the object format used for the settings * aoData array. * @namespace */ DataTable.models.oRow = { /** * TR element for the row * @type node * @default null */ "nTr": null, /** * Array of TD elements for each row. This is null until the row has been * created. * @type array nodes * @default [] */ "anCells": null, /** * Data object from the original data source for the row. This is either * an array if using the traditional form of DataTables, or an object if * using mData options. The exact type will depend on the passed in * data from the data source, or will be an array if using DOM a data * source. * @type array|object * @default [] */ "_aData": [], /** * Sorting data cache - this array is ostensibly the same length as the * number of columns (although each index is generated only as it is * needed), and holds the data that is used for sorting each column in the * row. We do this cache generation at the start of the sort in order that * the formatting of the sort data need be done only once for each cell * per sort. This array should not be read from or written to by anything * other than the master sorting methods. * @type array * @default null * @private */ "_aSortData": null, /** * Per cell filtering data cache. As per the sort data cache, used to * increase the performance of the filtering in DataTables * @type array * @default null * @private */ "_aFilterData": null, /** * Filtering data cache. This is the same as the cell filtering cache, but * in this case a string rather than an array. This is easily computed with * a join on `_aFilterData`, but is provided as a cache so the join isn't * needed on every search (memory traded for performance) * @type array * @default null * @private */ "_sFilterRow": null, /** * Cache of the class name that DataTables has applied to the row, so we * can quickly look at this variable rather than needing to do a DOM check * on className for the nTr property. * @type string * @default <i>Empty string</i> * @private */ "_sRowStripe": "", /** * Denote if the original data source was from the DOM, or the data source * object. This is used for invalidating data, so DataTables can * automatically read data from the original source, unless uninstructed * otherwise. * @type string * @default null * @private */ "src": null, /** * Index in the aoData array. This saves an indexOf lookup when we have the * object, but want to know the index * @type integer * @default -1 * @private */ "idx": -1 }; /** * Template object for the column information object in DataTables. This object * is held in the settings aoColumns array and contains all the information that * DataTables needs about each individual column. * * Note that this object is related to {@link DataTable.defaults.column} * but this one is the internal data store for DataTables's cache of columns. * It should NOT be manipulated outside of DataTables. Any configuration should * be done through the initialisation options. * @namespace */ DataTable.models.oColumn = { /** * Column index. This could be worked out on-the-fly with $.inArray, but it * is faster to just hold it as a variable * @type integer * @default null */ "idx": null, /** * A list of the columns that sorting should occur on when this column * is sorted. That this property is an array allows multi-column sorting * to be defined for a column (for example first name / last name columns * would benefit from this). The values are integers pointing to the * columns to be sorted on (typically it will be a single integer pointing * at itself, but that doesn't need to be the case). * @type array */ "aDataSort": null, /** * Define the sorting directions that are applied to the column, in sequence * as the column is repeatedly sorted upon - i.e. the first value is used * as the sorting direction when the column if first sorted (clicked on). * Sort it again (click again) and it will move on to the next index. * Repeat until loop. * @type array */ "asSorting": null, /** * Flag to indicate if the column is searchable, and thus should be included * in the filtering or not. * @type boolean */ "bSearchable": null, /** * Flag to indicate if the column is sortable or not. * @type boolean */ "bSortable": null, /** * Flag to indicate if the column is currently visible in the table or not * @type boolean */ "bVisible": null, /** * Store for manual type assignment using the `column.type` option. This * is held in store so we can manipulate the column's `sType` property. * @type string * @default null * @private */ "_sManualType": null, /** * Flag to indicate if HTML5 data attributes should be used as the data * source for filtering or sorting. True is either are. * @type boolean * @default false * @private */ "_bAttrSrc": false, /** * Developer definable function that is called whenever a cell is created (Ajax source, * etc) or processed for input (DOM source). This can be used as a compliment to mRender * allowing you to modify the DOM element (add background colour for example) when the * element is available. * @type function * @param {element} nTd The TD node that has been created * @param {*} sData The Data for the cell * @param {array|object} oData The data for the whole row * @param {int} iRow The row index for the aoData data store * @default null */ "fnCreatedCell": null, /** * Function to get data from a cell in a column. You should <b>never</b> * access data directly through _aData internally in DataTables - always use * the method attached to this property. It allows mData to function as * required. This function is automatically assigned by the column * initialisation method * @type function * @param {array|object} oData The data array/object for the array * (i.e. aoData[]._aData) * @param {string} sSpecific The specific data type you want to get - * 'display', 'type' 'filter' 'sort' * @returns {*} The data for the cell from the given row's data * @default null */ "fnGetData": null, /** * Function to set data for a cell in the column. You should <b>never</b> * set the data directly to _aData internally in DataTables - always use * this method. It allows mData to function as required. This function * is automatically assigned by the column initialisation method * @type function * @param {array|object} oData The data array/object for the array * (i.e. aoData[]._aData) * @param {*} sValue Value to set * @default null */ "fnSetData": null, /** * Property to read the value for the cells in the column from the data * source array / object. If null, then the default content is used, if a * function is given then the return from the function is used. * @type function|int|string|null * @default null */ "mData": null, /** * Partner property to mData which is used (only when defined) to get * the data - i.e. it is basically the same as mData, but without the * 'set' option, and also the data fed to it is the result from mData. * This is the rendering method to match the data method of mData. * @type function|int|string|null * @default null */ "mRender": null, /** * Unique header TH/TD element for this column - this is what the sorting * listener is attached to (if sorting is enabled.) * @type node * @default null */ "nTh": null, /** * Unique footer TH/TD element for this column (if there is one). Not used * in DataTables as such, but can be used for plug-ins to reference the * footer for each column. * @type node * @default null */ "nTf": null, /** * The class to apply to all TD elements in the table's TBODY for the column * @type string * @default null */ "sClass": null, /** * When DataTables calculates the column widths to assign to each column, * it finds the longest string in each column and then constructs a * temporary table and reads the widths from that. The problem with this * is that "mmm" is much wider then "iiii", but the latter is a longer * string - thus the calculation can go wrong (doing it properly and putting * it into an DOM object and measuring that is horribly(!) slow). Thus as * a "work around" we provide this option. It will append its value to the * text that is found to be the longest string for the column - i.e. padding. * @type string */ "sContentPadding": null, /** * Allows a default value to be given for a column's data, and will be used * whenever a null data source is encountered (this can be because mData * is set to null, or because the data source itself is null). * @type string * @default null */ "sDefaultContent": null, /** * Name for the column, allowing reference to the column by name as well as * by index (needs a lookup to work by name). * @type string */ "sName": null, /** * Custom sorting data type - defines which of the available plug-ins in * afnSortData the custom sorting will use - if any is defined. * @type string * @default std */ "sSortDataType": 'std', /** * Class to be applied to the header element when sorting on this column * @type string * @default null */ "sSortingClass": null, /** * Class to be applied to the header element when sorting on this column - * when jQuery UI theming is used. * @type string * @default null */ "sSortingClassJUI": null, /** * Title of the column - what is seen in the TH element (nTh). * @type string */ "sTitle": null, /** * Column sorting and filtering type * @type string * @default null */ "sType": null, /** * Width of the column * @type string * @default null */ "sWidth": null, /** * Width of the column when it was first "encountered" * @type string * @default null */ "sWidthOrig": null }; /* * Developer note: The properties of the object below are given in Hungarian * notation, that was used as the interface for DataTables prior to v1.10, however * from v1.10 onwards the primary interface is camel case. In order to avoid * breaking backwards compatibility utterly with this change, the Hungarian * version is still, internally the primary interface, but is is not documented * - hence the @name tags in each doc comment. This allows a Javascript function * to create a map from Hungarian notation to camel case (going the other direction * would require each property to be listed, which would at around 3K to the size * of DataTables, while this method is about a 0.5K hit. * * Ultimately this does pave the way for Hungarian notation to be dropped * completely, but that is a massive amount of work and will break current * installs (therefore is on-hold until v2). */ /** * Initialisation options that can be given to DataTables at initialisation * time. * @namespace */ DataTable.defaults = { /** * An array of data to use for the table, passed in at initialisation which * will be used in preference to any data which is already in the DOM. This is * particularly useful for constructing tables purely in Javascript, for * example with a custom Ajax call. * @type array * @default null * * @dtopt Option * @name DataTable.defaults.data * * @example * // Using a 2D array data source * $(document).ready( function () { * $('#example').dataTable( { * "data": [ * ['Trident', 'Internet Explorer 4.0', 'Win 95+', 4, 'X'], * ['Trident', 'Internet Explorer 5.0', 'Win 95+', 5, 'C'], * ], * "columns": [ * { "title": "Engine" }, * { "title": "Browser" }, * { "title": "Platform" }, * { "title": "Version" }, * { "title": "Grade" } * ] * } ); * } ); * * @example * // Using an array of objects as a data source (`data`) * $(document).ready( function () { * $('#example').dataTable( { * "data": [ * { * "engine": "Trident", * "browser": "Internet Explorer 4.0", * "platform": "Win 95+", * "version": 4, * "grade": "X" * }, * { * "engine": "Trident", * "browser": "Internet Explorer 5.0", * "platform": "Win 95+", * "version": 5, * "grade": "C" * } * ], * "columns": [ * { "title": "Engine", "data": "engine" }, * { "title": "Browser", "data": "browser" }, * { "title": "Platform", "data": "platform" }, * { "title": "Version", "data": "version" }, * { "title": "Grade", "data": "grade" } * ] * } ); * } ); */ "aaData": null, /** * If ordering is enabled, then DataTables will perform a first pass sort on * initialisation. You can define which column(s) the sort is performed * upon, and the sorting direction, with this variable. The `sorting` array * should contain an array for each column to be sorted initially containing * the column's index and a direction string ('asc' or 'desc'). * @type array * @default [[0,'asc']] * * @dtopt Option * @name DataTable.defaults.order * * @example * // Sort by 3rd column first, and then 4th column * $(document).ready( function() { * $('#example').dataTable( { * "order": [[2,'asc'], [3,'desc']] * } ); * } ); * * // No initial sorting * $(document).ready( function() { * $('#example').dataTable( { * "order": [] * } ); * } ); */ "aaSorting": [[0,'asc']], /** * This parameter is basically identical to the `sorting` parameter, but * cannot be overridden by user interaction with the table. What this means * is that you could have a column (visible or hidden) which the sorting * will always be forced on first - any sorting after that (from the user) * will then be performed as required. This can be useful for grouping rows * together. * @type array * @default null * * @dtopt Option * @name DataTable.defaults.orderFixed * * @example * $(document).ready( function() { * $('#example').dataTable( { * "orderFixed": [[0,'asc']] * } ); * } ) */ "aaSortingFixed": [], /** * DataTables can be instructed to load data to display in the table from a * Ajax source. This option defines how that Ajax call is made and where to. * * The `ajax` property has three different modes of operation, depending on * how it is defined. These are: * * * `string` - Set the URL from where the data should be loaded from. * * `object` - Define properties for `jQuery.ajax`. * * `function` - Custom data get function * * `string` * -------- * * As a string, the `ajax` property simply defines the URL from which * DataTables will load data. * * `object` * -------- * * As an object, the parameters in the object are passed to * [jQuery.ajax](http://api.jquery.com/jQuery.ajax/) allowing fine control * of the Ajax request. DataTables has a number of default parameters which * you can override using this option. Please refer to the jQuery * documentation for a full description of the options available, although * the following parameters provide additional options in DataTables or * require special consideration: * * * `data` - As with jQuery, `data` can be provided as an object, but it * can also be used as a function to manipulate the data DataTables sends * to the server. The function takes a single parameter, an object of * parameters with the values that DataTables has readied for sending. An * object may be returned which will be merged into the DataTables * defaults, or you can add the items to the object that was passed in and * not return anything from the function. This supersedes `fnServerParams` * from DataTables 1.9-. * * * `dataSrc` - By default DataTables will look for the property `data` (or * `aaData` for compatibility with DataTables 1.9-) when obtaining data * from an Ajax source or for server-side processing - this parameter * allows that property to be changed. You can use Javascript dotted * object notation to get a data source for multiple levels of nesting, or * it my be used as a function. As a function it takes a single parameter, * the JSON returned from the server, which can be manipulated as * required, with the returned value being that used by DataTables as the * data source for the table. This supersedes `sAjaxDataProp` from * DataTables 1.9-. * * * `success` - Should not be overridden it is used internally in * DataTables. To manipulate / transform the data returned by the server * use `ajax.dataSrc`, or use `ajax` as a function (see below). * * `function` * ---------- * * As a function, making the Ajax call is left up to yourself allowing * complete control of the Ajax request. Indeed, if desired, a method other * than Ajax could be used to obtain the required data, such as Web storage * or an AIR database. * * The function is given four parameters and no return is required. The * parameters are: * * 1. _object_ - Data to send to the server * 2. _function_ - Callback function that must be executed when the required * data has been obtained. That data should be passed into the callback * as the only parameter * 3. _object_ - DataTables settings object for the table * * Note that this supersedes `fnServerData` from DataTables 1.9-. * * @type string|object|function * @default null * * @dtopt Option * @name DataTable.defaults.ajax * @since 1.10.0 * * @example * // Get JSON data from a file via Ajax. * // Note DataTables expects data in the form `{ data: [ ...data... ] }` by default). * $('#example').dataTable( { * "ajax": "data.json" * } ); * * @example * // Get JSON data from a file via Ajax, using `dataSrc` to change * // `data` to `tableData` (i.e. `{ tableData: [ ...data... ] }`) * $('#example').dataTable( { * "ajax": { * "url": "data.json", * "dataSrc": "tableData" * } * } ); * * @example * // Get JSON data from a file via Ajax, using `dataSrc` to read data * // from a plain array rather than an array in an object * $('#example').dataTable( { * "ajax": { * "url": "data.json", * "dataSrc": "" * } * } ); * * @example * // Manipulate the data returned from the server - add a link to data * // (note this can, should, be done using `render` for the column - this * // is just a simple example of how the data can be manipulated). * $('#example').dataTable( { * "ajax": { * "url": "data.json", * "dataSrc": function ( json ) { * for ( var i=0, ien=json.length ; i<ien ; i++ ) { * json[i][0] = '<a href="/message/'+json[i][0]+'>View message</a>'; * } * return json; * } * } * } ); * * @example * // Add data to the request * $('#example').dataTable( { * "ajax": { * "url": "data.json", * "data": function ( d ) { * return { * "extra_search": $('#extra').val() * }; * } * } * } ); * * @example * // Send request as POST * $('#example').dataTable( { * "ajax": { * "url": "data.json", * "type": "POST" * } * } ); * * @example * // Get the data from localStorage (could interface with a form for * // adding, editing and removing rows). * $('#example').dataTable( { * "ajax": function (data, callback, settings) { * callback( * JSON.parse( localStorage.getItem('dataTablesData') ) * ); * } * } ); */ "ajax": null, /** * This parameter allows you to readily specify the entries in the length drop * down menu that DataTables shows when pagination is enabled. It can be * either a 1D array of options which will be used for both the displayed * option and the value, or a 2D array which will use the array in the first * position as the value, and the array in the second position as the * displayed options (useful for language strings such as 'All'). * * Note that the `pageLength` property will be automatically set to the * first value given in this array, unless `pageLength` is also provided. * @type array * @default [ 10, 25, 50, 100 ] * * @dtopt Option * @name DataTable.defaults.lengthMenu * * @example * $(document).ready( function() { * $('#example').dataTable( { * "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]] * } ); * } ); */ "aLengthMenu": [ 10, 25, 50, 100 ], /** * The `columns` option in the initialisation parameter allows you to define * details about the way individual columns behave. For a full list of * column options that can be set, please see * {@link DataTable.defaults.column}. Note that if you use `columns` to * define your columns, you must have an entry in the array for every single * column that you have in your table (these can be null if you don't which * to specify any options). * @member * * @name DataTable.defaults.column */ "aoColumns": null, /** * Very similar to `columns`, `columnDefs` allows you to target a specific * column, multiple columns, or all columns, using the `targets` property of * each object in the array. This allows great flexibility when creating * tables, as the `columnDefs` arrays can be of any length, targeting the * columns you specifically want. `columnDefs` may use any of the column * options available: {@link DataTable.defaults.column}, but it _must_ * have `targets` defined in each object in the array. Values in the `targets` * array may be: * <ul> * <li>a string - class name will be matched on the TH for the column</li> * <li>0 or a positive integer - column index counting from the left</li> * <li>a negative integer - column index counting from the right</li> * <li>the string "_all" - all columns (i.e. assign a default)</li> * </ul> * @member * * @name DataTable.defaults.columnDefs */ "aoColumnDefs": null, /** * Basically the same as `search`, this parameter defines the individual column * filtering state at initialisation time. The array must be of the same size * as the number of columns, and each element be an object with the parameters * `search` and `escapeRegex` (the latter is optional). 'null' is also * accepted and the default will be used. * @type array * @default [] * * @dtopt Option * @name DataTable.defaults.searchCols * * @example * $(document).ready( function() { * $('#example').dataTable( { * "searchCols": [ * null, * { "search": "My filter" }, * null, * { "search": "^[0-9]", "escapeRegex": false } * ] * } ); * } ) */ "aoSearchCols": [], /** * An array of CSS classes that should be applied to displayed rows. This * array may be of any length, and DataTables will apply each class * sequentially, looping when required. * @type array * @default null <i>Will take the values determined by the `oClasses.stripe*` * options</i> * * @dtopt Option * @name DataTable.defaults.stripeClasses * * @example * $(document).ready( function() { * $('#example').dataTable( { * "stripeClasses": [ 'strip1', 'strip2', 'strip3' ] * } ); * } ) */ "asStripeClasses": null, /** * Enable or disable automatic column width calculation. This can be disabled * as an optimisation (it takes some time to calculate the widths) if the * tables widths are passed in using `columns`. * @type boolean * @default true * * @dtopt Features * @name DataTable.defaults.autoWidth * * @example * $(document).ready( function () { * $('#example').dataTable( { * "autoWidth": false * } ); * } ); */ "bAutoWidth": true, /** * Deferred rendering can provide DataTables with a huge speed boost when you * are using an Ajax or JS data source for the table. This option, when set to * true, will cause DataTables to defer the creation of the table elements for * each row until they are needed for a draw - saving a significant amount of * time. * @type boolean * @default false * * @dtopt Features * @name DataTable.defaults.deferRender * * @example * $(document).ready( function() { * $('#example').dataTable( { * "ajax": "sources/arrays.txt", * "deferRender": true * } ); * } ); */ "bDeferRender": false, /** * Replace a DataTable which matches the given selector and replace it with * one which has the properties of the new initialisation object passed. If no * table matches the selector, then the new DataTable will be constructed as * per normal. * @type boolean * @default false * * @dtopt Options * @name DataTable.defaults.destroy * * @example * $(document).ready( function() { * $('#example').dataTable( { * "srollY": "200px", * "paginate": false * } ); * * // Some time later.... * $('#example').dataTable( { * "filter": false, * "destroy": true * } ); * } ); */ "bDestroy": false, /** * Enable or disable filtering of data. Filtering in DataTables is "smart" in * that it allows the end user to input multiple words (space separated) and * will match a row containing those words, even if not in the order that was * specified (this allow matching across multiple columns). Note that if you * wish to use filtering in DataTables this must remain 'true' - to remove the * default filtering input box and retain filtering abilities, please use * {@link DataTable.defaults.dom}. * @type boolean * @default true * * @dtopt Features * @name DataTable.defaults.searching * * @example * $(document).ready( function () { * $('#example').dataTable( { * "searching": false * } ); * } ); */ "bFilter": true, /** * Enable or disable the table information display. This shows information * about the data that is currently visible on the page, including information * about filtered data if that action is being performed. * @type boolean * @default true * * @dtopt Features * @name DataTable.defaults.info * * @example * $(document).ready( function () { * $('#example').dataTable( { * "info": false * } ); * } ); */ "bInfo": true, /** * Enable jQuery UI ThemeRoller support (required as ThemeRoller requires some * slightly different and additional mark-up from what DataTables has * traditionally used). * @type boolean * @default false * * @dtopt Features * @name DataTable.defaults.jQueryUI * * @example * $(document).ready( function() { * $('#example').dataTable( { * "jQueryUI": true * } ); * } ); */ "bJQueryUI": false, /** * Allows the end user to select the size of a formatted page from a select * menu (sizes are 10, 25, 50 and 100). Requires pagination (`paginate`). * @type boolean * @default true * * @dtopt Features * @name DataTable.defaults.lengthChange * * @example * $(document).ready( function () { * $('#example').dataTable( { * "lengthChange": false * } ); * } ); */ "bLengthChange": true, /** * Enable or disable pagination. * @type boolean * @default true * * @dtopt Features * @name DataTable.defaults.paging * * @example * $(document).ready( function () { * $('#example').dataTable( { * "paging": false * } ); * } ); */ "bPaginate": true, /** * Enable or disable the display of a 'processing' indicator when the table is * being processed (e.g. a sort). This is particularly useful for tables with * large amounts of data where it can take a noticeable amount of time to sort * the entries. * @type boolean * @default false * * @dtopt Features * @name DataTable.defaults.processing * * @example * $(document).ready( function () { * $('#example').dataTable( { * "processing": true * } ); * } ); */ "bProcessing": false, /** * Retrieve the DataTables object for the given selector. Note that if the * table has already been initialised, this parameter will cause DataTables * to simply return the object that has already been set up - it will not take * account of any changes you might have made to the initialisation object * passed to DataTables (setting this parameter to true is an acknowledgement * that you understand this). `destroy` can be used to reinitialise a table if * you need. * @type boolean * @default false * * @dtopt Options * @name DataTable.defaults.retrieve * * @example * $(document).ready( function() { * initTable(); * tableActions(); * } ); * * function initTable () * { * return $('#example').dataTable( { * "scrollY": "200px", * "paginate": false, * "retrieve": true * } ); * } * * function tableActions () * { * var table = initTable(); * // perform API operations with oTable * } */ "bRetrieve": false, /** * When vertical (y) scrolling is enabled, DataTables will force the height of * the table's viewport to the given height at all times (useful for layout). * However, this can look odd when filtering data down to a small data set, * and the footer is left "floating" further down. This parameter (when * enabled) will cause DataTables to collapse the table's viewport down when * the result set will fit within the given Y height. * @type boolean * @default false * * @dtopt Options * @name DataTable.defaults.scrollCollapse * * @example * $(document).ready( function() { * $('#example').dataTable( { * "scrollY": "200", * "scrollCollapse": true * } ); * } ); */ "bScrollCollapse": false, /** * Configure DataTables to use server-side processing. Note that the * `ajax` parameter must also be given in order to give DataTables a * source to obtain the required data for each draw. * @type boolean * @default false * * @dtopt Features * @dtopt Server-side * @name DataTable.defaults.serverSide * * @example * $(document).ready( function () { * $('#example').dataTable( { * "serverSide": true, * "ajax": "xhr.php" * } ); * } ); */ "bServerSide": false, /** * Enable or disable sorting of columns. Sorting of individual columns can be * disabled by the `sortable` option for each column. * @type boolean * @default true * * @dtopt Features * @name DataTable.defaults.ordering * * @example * $(document).ready( function () { * $('#example').dataTable( { * "ordering": false * } ); * } ); */ "bSort": true, /** * Enable or display DataTables' ability to sort multiple columns at the * same time (activated by shift-click by the user). * @type boolean * @default true * * @dtopt Options * @name DataTable.defaults.orderMulti * * @example * // Disable multiple column sorting ability * $(document).ready( function () { * $('#example').dataTable( { * "orderMulti": false * } ); * } ); */ "bSortMulti": true, /** * Allows control over whether DataTables should use the top (true) unique * cell that is found for a single column, or the bottom (false - default). * This is useful when using complex headers. * @type boolean * @default false * * @dtopt Options * @name DataTable.defaults.orderCellsTop * * @example * $(document).ready( function() { * $('#example').dataTable( { * "orderCellsTop": true * } ); * } ); */ "bSortCellsTop": false, /** * Enable or disable the addition of the classes `sorting\_1`, `sorting\_2` and * `sorting\_3` to the columns which are currently being sorted on. This is * presented as a feature switch as it can increase processing time (while * classes are removed and added) so for large data sets you might want to * turn this off. * @type boolean * @default true * * @dtopt Features * @name DataTable.defaults.orderClasses * * @example * $(document).ready( function () { * $('#example').dataTable( { * "orderClasses": false * } ); * } ); */ "bSortClasses": true, /** * Enable or disable state saving. When enabled HTML5 `localStorage` will be * used to save table display information such as pagination information, * display length, filtering and sorting. As such when the end user reloads * the page the display display will match what thy had previously set up. * * Due to the use of `localStorage` the default state saving is not supported * in IE6 or 7. If state saving is required in those browsers, use * `stateSaveCallback` to provide a storage solution such as cookies. * @type boolean * @default false * * @dtopt Features * @name DataTable.defaults.stateSave * * @example * $(document).ready( function () { * $('#example').dataTable( { * "stateSave": true * } ); * } ); */ "bStateSave": false, /** * This function is called when a TR element is created (and all TD child * elements have been inserted), or registered if using a DOM source, allowing * manipulation of the TR element (adding classes etc). * @type function * @param {node} row "TR" element for the current row * @param {array} data Raw data array for this row * @param {int} dataIndex The index of this row in the internal aoData array * * @dtopt Callbacks * @name DataTable.defaults.createdRow * * @example * $(document).ready( function() { * $('#example').dataTable( { * "createdRow": function( row, data, dataIndex ) { * // Bold the grade for all 'A' grade browsers * if ( data[4] == "A" ) * { * $('td:eq(4)', row).html( '<b>A</b>' ); * } * } * } ); * } ); */ "fnCreatedRow": null, /** * This function is called on every 'draw' event, and allows you to * dynamically modify any aspect you want about the created DOM. * @type function * @param {object} settings DataTables settings object * * @dtopt Callbacks * @name DataTable.defaults.drawCallback * * @example * $(document).ready( function() { * $('#example').dataTable( { * "drawCallback": function( settings ) { * alert( 'DataTables has redrawn the table' ); * } * } ); * } ); */ "fnDrawCallback": null, /** * Identical to fnHeaderCallback() but for the table footer this function * allows you to modify the table footer on every 'draw' event. * @type function * @param {node} foot "TR" element for the footer * @param {array} data Full table data (as derived from the original HTML) * @param {int} start Index for the current display starting point in the * display array * @param {int} end Index for the current display ending point in the * display array * @param {array int} display Index array to translate the visual position * to the full data array * * @dtopt Callbacks * @name DataTable.defaults.footerCallback * * @example * $(document).ready( function() { * $('#example').dataTable( { * "footerCallback": function( tfoot, data, start, end, display ) { * tfoot.getElementsByTagName('th')[0].innerHTML = "Starting index is "+start; * } * } ); * } ) */ "fnFooterCallback": null, /** * When rendering large numbers in the information element for the table * (i.e. "Showing 1 to 10 of 57 entries") DataTables will render large numbers * to have a comma separator for the 'thousands' units (e.g. 1 million is * rendered as "1,000,000") to help readability for the end user. This * function will override the default method DataTables uses. * @type function * @member * @param {int} toFormat number to be formatted * @returns {string} formatted string for DataTables to show the number * * @dtopt Callbacks * @name DataTable.defaults.formatNumber * * @example * // Format a number using a single quote for the separator (note that * // this can also be done with the language.thousands option) * $(document).ready( function() { * $('#example').dataTable( { * "formatNumber": function ( toFormat ) { * return toFormat.toString().replace( * /\B(?=(\d{3})+(?!\d))/g, "'" * ); * }; * } ); * } ); */ "fnFormatNumber": function ( toFormat ) { return toFormat.toString().replace( /\B(?=(\d{3})+(?!\d))/g, this.oLanguage.sThousands ); }, /** * This function is called on every 'draw' event, and allows you to * dynamically modify the header row. This can be used to calculate and * display useful information about the table. * @type function * @param {node} head "TR" element for the header * @param {array} data Full table data (as derived from the original HTML) * @param {int} start Index for the current display starting point in the * display array * @param {int} end Index for the current display ending point in the * display array * @param {array int} display Index array to translate the visual position * to the full data array * * @dtopt Callbacks * @name DataTable.defaults.headerCallback * * @example * $(document).ready( function() { * $('#example').dataTable( { * "fheaderCallback": function( head, data, start, end, display ) { * head.getElementsByTagName('th')[0].innerHTML = "Displaying "+(end-start)+" records"; * } * } ); * } ) */ "fnHeaderCallback": null, /** * The information element can be used to convey information about the current * state of the table. Although the internationalisation options presented by * DataTables are quite capable of dealing with most customisations, there may * be times where you wish to customise the string further. This callback * allows you to do exactly that. * @type function * @param {object} oSettings DataTables settings object * @param {int} start Starting position in data for the draw * @param {int} end End position in data for the draw * @param {int} max Total number of rows in the table (regardless of * filtering) * @param {int} total Total number of rows in the data set, after filtering * @param {string} pre The string that DataTables has formatted using it's * own rules * @returns {string} The string to be displayed in the information element. * * @dtopt Callbacks * @name DataTable.defaults.infoCallback * * @example * $('#example').dataTable( { * "infoCallback": function( settings, start, end, max, total, pre ) { * return start +" to "+ end; * } * } ); */ "fnInfoCallback": null, /** * Called when the table has been initialised. Normally DataTables will * initialise sequentially and there will be no need for this function, * however, this does not hold true when using external language information * since that is obtained using an async XHR call. * @type function * @param {object} settings DataTables settings object * @param {object} json The JSON object request from the server - only * present if client-side Ajax sourced data is used * * @dtopt Callbacks * @name DataTable.defaults.initComplete * * @example * $(document).ready( function() { * $('#example').dataTable( { * "initComplete": function(settings, json) { * alert( 'DataTables has finished its initialisation.' ); * } * } ); * } ) */ "fnInitComplete": null, /** * Called at the very start of each table draw and can be used to cancel the * draw by returning false, any other return (including undefined) results in * the full draw occurring). * @type function * @param {object} settings DataTables settings object * @returns {boolean} False will cancel the draw, anything else (including no * return) will allow it to complete. * * @dtopt Callbacks * @name DataTable.defaults.preDrawCallback * * @example * $(document).ready( function() { * $('#example').dataTable( { * "preDrawCallback": function( settings ) { * if ( $('#test').val() == 1 ) { * return false; * } * } * } ); * } ); */ "fnPreDrawCallback": null, /** * This function allows you to 'post process' each row after it have been * generated for each table draw, but before it is rendered on screen. This * function might be used for setting the row class name etc. * @type function * @param {node} row "TR" element for the current row * @param {array} data Raw data array for this row * @param {int} displayIndex The display index for the current table draw * @param {int} displayIndexFull The index of the data in the full list of * rows (after filtering) * * @dtopt Callbacks * @name DataTable.defaults.rowCallback * * @example * $(document).ready( function() { * $('#example').dataTable( { * "rowCallback": function( row, data, displayIndex, displayIndexFull ) { * // Bold the grade for all 'A' grade browsers * if ( data[4] == "A" ) { * $('td:eq(4)', row).html( '<b>A</b>' ); * } * } * } ); * } ); */ "fnRowCallback": null, /** * __Deprecated__ The functionality provided by this parameter has now been * superseded by that provided through `ajax`, which should be used instead. * * This parameter allows you to override the default function which obtains * the data from the server so something more suitable for your application. * For example you could use POST data, or pull information from a Gears or * AIR database. * @type function * @member * @param {string} source HTTP source to obtain the data from (`ajax`) * @param {array} data A key/value pair object containing the data to send * to the server * @param {function} callback to be called on completion of the data get * process that will draw the data on the page. * @param {object} settings DataTables settings object * * @dtopt Callbacks * @dtopt Server-side * @name DataTable.defaults.serverData * * @deprecated 1.10. Please use `ajax` for this functionality now. */ "fnServerData": null, /** * __Deprecated__ The functionality provided by this parameter has now been * superseded by that provided through `ajax`, which should be used instead. * * It is often useful to send extra data to the server when making an Ajax * request - for example custom filtering information, and this callback * function makes it trivial to send extra information to the server. The * passed in parameter is the data set that has been constructed by * DataTables, and you can add to this or modify it as you require. * @type function * @param {array} data Data array (array of objects which are name/value * pairs) that has been constructed by DataTables and will be sent to the * server. In the case of Ajax sourced data with server-side processing * this will be an empty array, for server-side processing there will be a * significant number of parameters! * @returns {undefined} Ensure that you modify the data array passed in, * as this is passed by reference. * * @dtopt Callbacks * @dtopt Server-side * @name DataTable.defaults.serverParams * * @deprecated 1.10. Please use `ajax` for this functionality now. */ "fnServerParams": null, /** * Load the table state. With this function you can define from where, and how, the * state of a table is loaded. By default DataTables will load from `localStorage` * but you might wish to use a server-side database or cookies. * @type function * @member * @param {object} settings DataTables settings object * @param {object} callback Callback that can be executed when done. It * should be passed the loaded state object. * @return {object} The DataTables state object to be loaded * * @dtopt Callbacks * @name DataTable.defaults.stateLoadCallback * * @example * $(document).ready( function() { * $('#example').dataTable( { * "stateSave": true, * "stateLoadCallback": function (settings, callback) { * $.ajax( { * "url": "/state_load", * "dataType": "json", * "success": function (json) { * callback( json ); * } * } ); * } * } ); * } ); */ "fnStateLoadCallback": function ( settings ) { try { return JSON.parse( (settings.iStateDuration === -1 ? sessionStorage : localStorage).getItem( 'DataTables_'+settings.sInstance+'_'+location.pathname ) ); } catch (e) {} }, /** * Callback which allows modification of the saved state prior to loading that state. * This callback is called when the table is loading state from the stored data, but * prior to the settings object being modified by the saved state. Note that for * plug-in authors, you should use the `stateLoadParams` event to load parameters for * a plug-in. * @type function * @param {object} settings DataTables settings object * @param {object} data The state object that is to be loaded * * @dtopt Callbacks * @name DataTable.defaults.stateLoadParams * * @example * // Remove a saved filter, so filtering is never loaded * $(document).ready( function() { * $('#example').dataTable( { * "stateSave": true, * "stateLoadParams": function (settings, data) { * data.oSearch.sSearch = ""; * } * } ); * } ); * * @example * // Disallow state loading by returning false * $(document).ready( function() { * $('#example').dataTable( { * "stateSave": true, * "stateLoadParams": function (settings, data) { * return false; * } * } ); * } ); */ "fnStateLoadParams": null, /** * Callback that is called when the state has been loaded from the state saving method * and the DataTables settings object has been modified as a result of the loaded state. * @type function * @param {object} settings DataTables settings object * @param {object} data The state object that was loaded * * @dtopt Callbacks * @name DataTable.defaults.stateLoaded * * @example * // Show an alert with the filtering value that was saved * $(document).ready( function() { * $('#example').dataTable( { * "stateSave": true, * "stateLoaded": function (settings, data) { * alert( 'Saved filter was: '+data.oSearch.sSearch ); * } * } ); * } ); */ "fnStateLoaded": null, /** * Save the table state. This function allows you to define where and how the state * information for the table is stored By default DataTables will use `localStorage` * but you might wish to use a server-side database or cookies. * @type function * @member * @param {object} settings DataTables settings object * @param {object} data The state object to be saved * * @dtopt Callbacks * @name DataTable.defaults.stateSaveCallback * * @example * $(document).ready( function() { * $('#example').dataTable( { * "stateSave": true, * "stateSaveCallback": function (settings, data) { * // Send an Ajax request to the server with the state object * $.ajax( { * "url": "/state_save", * "data": data, * "dataType": "json", * "method": "POST" * "success": function () {} * } ); * } * } ); * } ); */ "fnStateSaveCallback": function ( settings, data ) { try { (settings.iStateDuration === -1 ? sessionStorage : localStorage).setItem( 'DataTables_'+settings.sInstance+'_'+location.pathname, JSON.stringify( data ) ); } catch (e) {} }, /** * Callback which allows modification of the state to be saved. Called when the table * has changed state a new state save is required. This method allows modification of * the state saving object prior to actually doing the save, including addition or * other state properties or modification. Note that for plug-in authors, you should * use the `stateSaveParams` event to save parameters for a plug-in. * @type function * @param {object} settings DataTables settings object * @param {object} data The state object to be saved * * @dtopt Callbacks * @name DataTable.defaults.stateSaveParams * * @example * // Remove a saved filter, so filtering is never saved * $(document).ready( function() { * $('#example').dataTable( { * "stateSave": true, * "stateSaveParams": function (settings, data) { * data.oSearch.sSearch = ""; * } * } ); * } ); */ "fnStateSaveParams": null, /** * Duration for which the saved state information is considered valid. After this period * has elapsed the state will be returned to the default. * Value is given in seconds. * @type int * @default 7200 <i>(2 hours)</i> * * @dtopt Options * @name DataTable.defaults.stateDuration * * @example * $(document).ready( function() { * $('#example').dataTable( { * "stateDuration": 60*60*24; // 1 day * } ); * } ) */ "iStateDuration": 7200, /** * When enabled DataTables will not make a request to the server for the first * page draw - rather it will use the data already on the page (no sorting etc * will be applied to it), thus saving on an XHR at load time. `deferLoading` * is used to indicate that deferred loading is required, but it is also used * to tell DataTables how many records there are in the full table (allowing * the information element and pagination to be displayed correctly). In the case * where a filtering is applied to the table on initial load, this can be * indicated by giving the parameter as an array, where the first element is * the number of records available after filtering and the second element is the * number of records without filtering (allowing the table information element * to be shown correctly). * @type int | array * @default null * * @dtopt Options * @name DataTable.defaults.deferLoading * * @example * // 57 records available in the table, no filtering applied * $(document).ready( function() { * $('#example').dataTable( { * "serverSide": true, * "ajax": "scripts/server_processing.php", * "deferLoading": 57 * } ); * } ); * * @example * // 57 records after filtering, 100 without filtering (an initial filter applied) * $(document).ready( function() { * $('#example').dataTable( { * "serverSide": true, * "ajax": "scripts/server_processing.php", * "deferLoading": [ 57, 100 ], * "search": { * "search": "my_filter" * } * } ); * } ); */ "iDeferLoading": null, /** * Number of rows to display on a single page when using pagination. If * feature enabled (`lengthChange`) then the end user will be able to override * this to a custom setting using a pop-up menu. * @type int * @default 10 * * @dtopt Options * @name DataTable.defaults.pageLength * * @example * $(document).ready( function() { * $('#example').dataTable( { * "pageLength": 50 * } ); * } ) */ "iDisplayLength": 10, /** * Define the starting point for data display when using DataTables with * pagination. Note that this parameter is the number of records, rather than * the page number, so if you have 10 records per page and want to start on * the third page, it should be "20". * @type int * @default 0 * * @dtopt Options * @name DataTable.defaults.displayStart * * @example * $(document).ready( function() { * $('#example').dataTable( { * "displayStart": 20 * } ); * } ) */ "iDisplayStart": 0, /** * By default DataTables allows keyboard navigation of the table (sorting, paging, * and filtering) by adding a `tabindex` attribute to the required elements. This * allows you to tab through the controls and press the enter key to activate them. * The tabindex is default 0, meaning that the tab follows the flow of the document. * You can overrule this using this parameter if you wish. Use a value of -1 to * disable built-in keyboard navigation. * @type int * @default 0 * * @dtopt Options * @name DataTable.defaults.tabIndex * * @example * $(document).ready( function() { * $('#example').dataTable( { * "tabIndex": 1 * } ); * } ); */ "iTabIndex": 0, /** * Classes that DataTables assigns to the various components and features * that it adds to the HTML table. This allows classes to be configured * during initialisation in addition to through the static * {@link DataTable.ext.oStdClasses} object). * @namespace * @name DataTable.defaults.classes */ "oClasses": {}, /** * All strings that DataTables uses in the user interface that it creates * are defined in this object, allowing you to modified them individually or * completely replace them all as required. * @namespace * @name DataTable.defaults.language */ "oLanguage": { /** * Strings that are used for WAI-ARIA labels and controls only (these are not * actually visible on the page, but will be read by screenreaders, and thus * must be internationalised as well). * @namespace * @name DataTable.defaults.language.aria */ "oAria": { /** * ARIA label that is added to the table headers when the column may be * sorted ascending by activing the column (click or return when focused). * Note that the column header is prefixed to this string. * @type string * @default : activate to sort column ascending * * @dtopt Language * @name DataTable.defaults.language.aria.sortAscending * * @example * $(document).ready( function() { * $('#example').dataTable( { * "language": { * "aria": { * "sortAscending": " - click/return to sort ascending" * } * } * } ); * } ); */ "sSortAscending": ": activate to sort column ascending", /** * ARIA label that is added to the table headers when the column may be * sorted descending by activing the column (click or return when focused). * Note that the column header is prefixed to this string. * @type string * @default : activate to sort column ascending * * @dtopt Language * @name DataTable.defaults.language.aria.sortDescending * * @example * $(document).ready( function() { * $('#example').dataTable( { * "language": { * "aria": { * "sortDescending": " - click/return to sort descending" * } * } * } ); * } ); */ "sSortDescending": ": activate to sort column descending" }, /** * Pagination string used by DataTables for the built-in pagination * control types. * @namespace * @name DataTable.defaults.language.paginate */ "oPaginate": { /** * Text to use when using the 'full_numbers' type of pagination for the * button to take the user to the first page. * @type string * @default First * * @dtopt Language * @name DataTable.defaults.language.paginate.first * * @example * $(document).ready( function() { * $('#example').dataTable( { * "language": { * "paginate": { * "first": "First page" * } * } * } ); * } ); */ "sFirst": "First", /** * Text to use when using the 'full_numbers' type of pagination for the * button to take the user to the last page. * @type string * @default Last * * @dtopt Language * @name DataTable.defaults.language.paginate.last * * @example * $(document).ready( function() { * $('#example').dataTable( { * "language": { * "paginate": { * "last": "Last page" * } * } * } ); * } ); */ "sLast": "Last", /** * Text to use for the 'next' pagination button (to take the user to the * next page). * @type string * @default Next * * @dtopt Language * @name DataTable.defaults.language.paginate.next * * @example * $(document).ready( function() { * $('#example').dataTable( { * "language": { * "paginate": { * "next": "Next page" * } * } * } ); * } ); */ "sNext": "Next", /** * Text to use for the 'previous' pagination button (to take the user to * the previous page). * @type string * @default Previous * * @dtopt Language * @name DataTable.defaults.language.paginate.previous * * @example * $(document).ready( function() { * $('#example').dataTable( { * "language": { * "paginate": { * "previous": "Previous page" * } * } * } ); * } ); */ "sPrevious": "Previous" }, /** * This string is shown in preference to `zeroRecords` when the table is * empty of data (regardless of filtering). Note that this is an optional * parameter - if it is not given, the value of `zeroRecords` will be used * instead (either the default or given value). * @type string * @default No data available in table * * @dtopt Language * @name DataTable.defaults.language.emptyTable * * @example * $(document).ready( function() { * $('#example').dataTable( { * "language": { * "emptyTable": "No data available in table" * } * } ); * } ); */ "sEmptyTable": "No data available in table", /** * This string gives information to the end user about the information * that is current on display on the page. The following tokens can be * used in the string and will be dynamically replaced as the table * display updates. This tokens can be placed anywhere in the string, or * removed as needed by the language requires: * * * `\_START\_` - Display index of the first record on the current page * * `\_END\_` - Display index of the last record on the current page * * `\_TOTAL\_` - Number of records in the table after filtering * * `\_MAX\_` - Number of records in the table without filtering * * `\_PAGE\_` - Current page number * * `\_PAGES\_` - Total number of pages of data in the table * * @type string * @default Showing _START_ to _END_ of _TOTAL_ entries * * @dtopt Language * @name DataTable.defaults.language.info * * @example * $(document).ready( function() { * $('#example').dataTable( { * "language": { * "info": "Showing page _PAGE_ of _PAGES_" * } * } ); * } ); */ "sInfo": "Showing _START_ to _END_ of _TOTAL_ entries", /** * Display information string for when the table is empty. Typically the * format of this string should match `info`. * @type string * @default Showing 0 to 0 of 0 entries * * @dtopt Language * @name DataTable.defaults.language.infoEmpty * * @example * $(document).ready( function() { * $('#example').dataTable( { * "language": { * "infoEmpty": "No entries to show" * } * } ); * } ); */ "sInfoEmpty": "Showing 0 to 0 of 0 entries", /** * When a user filters the information in a table, this string is appended * to the information (`info`) to give an idea of how strong the filtering * is. The variable _MAX_ is dynamically updated. * @type string * @default (filtered from _MAX_ total entries) * * @dtopt Language * @name DataTable.defaults.language.infoFiltered * * @example * $(document).ready( function() { * $('#example').dataTable( { * "language": { * "infoFiltered": " - filtering from _MAX_ records" * } * } ); * } ); */ "sInfoFiltered": "(filtered from _MAX_ total entries)", /** * If can be useful to append extra information to the info string at times, * and this variable does exactly that. This information will be appended to * the `info` (`infoEmpty` and `infoFiltered` in whatever combination they are * being used) at all times. * @type string * @default <i>Empty string</i> * * @dtopt Language * @name DataTable.defaults.language.infoPostFix * * @example * $(document).ready( function() { * $('#example').dataTable( { * "language": { * "infoPostFix": "All records shown are derived from real information." * } * } ); * } ); */ "sInfoPostFix": "", /** * This decimal place operator is a little different from the other * language options since DataTables doesn't output floating point * numbers, so it won't ever use this for display of a number. Rather, * what this parameter does is modify the sort methods of the table so * that numbers which are in a format which has a character other than * a period (`.`) as a decimal place will be sorted numerically. * * Note that numbers with different decimal places cannot be shown in * the same table and still be sortable, the table must be consistent. * However, multiple different tables on the page can use different * decimal place characters. * @type string * @default * * @dtopt Language * @name DataTable.defaults.language.decimal * * @example * $(document).ready( function() { * $('#example').dataTable( { * "language": { * "decimal": "," * "thousands": "." * } * } ); * } ); */ "sDecimal": "", /** * DataTables has a build in number formatter (`formatNumber`) which is * used to format large numbers that are used in the table information. * By default a comma is used, but this can be trivially changed to any * character you wish with this parameter. * @type string * @default , * * @dtopt Language * @name DataTable.defaults.language.thousands * * @example * $(document).ready( function() { * $('#example').dataTable( { * "language": { * "thousands": "'" * } * } ); * } ); */ "sThousands": ",", /** * Detail the action that will be taken when the drop down menu for the * pagination length option is changed. The '_MENU_' variable is replaced * with a default select list of 10, 25, 50 and 100, and can be replaced * with a custom select box if required. * @type string * @default Show _MENU_ entries * * @dtopt Language * @name DataTable.defaults.language.lengthMenu * * @example * // Language change only * $(document).ready( function() { * $('#example').dataTable( { * "language": { * "lengthMenu": "Display _MENU_ records" * } * } ); * } ); * * @example * // Language and options change * $(document).ready( function() { * $('#example').dataTable( { * "language": { * "lengthMenu": 'Display <select>'+ * '<option value="10">10</option>'+ * '<option value="20">20</option>'+ * '<option value="30">30</option>'+ * '<option value="40">40</option>'+ * '<option value="50">50</option>'+ * '<option value="-1">All</option>'+ * '</select> records' * } * } ); * } ); */ "sLengthMenu": "Show _MENU_ entries", /** * When using Ajax sourced data and during the first draw when DataTables is * gathering the data, this message is shown in an empty row in the table to * indicate to the end user the the data is being loaded. Note that this * parameter is not used when loading data by server-side processing, just * Ajax sourced data with client-side processing. * @type string * @default Loading... * * @dtopt Language * @name DataTable.defaults.language.loadingRecords * * @example * $(document).ready( function() { * $('#example').dataTable( { * "language": { * "loadingRecords": "Please wait - loading..." * } * } ); * } ); */ "sLoadingRecords": "Loading...", /** * Text which is displayed when the table is processing a user action * (usually a sort command or similar). * @type string * @default Processing... * * @dtopt Language * @name DataTable.defaults.language.processing * * @example * $(document).ready( function() { * $('#example').dataTable( { * "language": { * "processing": "DataTables is currently busy" * } * } ); * } ); */ "sProcessing": "Processing...", /** * Details the actions that will be taken when the user types into the * filtering input text box. The variable "_INPUT_", if used in the string, * is replaced with the HTML text box for the filtering input allowing * control over where it appears in the string. If "_INPUT_" is not given * then the input box is appended to the string automatically. * @type string * @default Search: * * @dtopt Language * @name DataTable.defaults.language.search * * @example * // Input text box will be appended at the end automatically * $(document).ready( function() { * $('#example').dataTable( { * "language": { * "search": "Filter records:" * } * } ); * } ); * * @example * // Specify where the filter should appear * $(document).ready( function() { * $('#example').dataTable( { * "language": { * "search": "Apply filter _INPUT_ to table" * } * } ); * } ); */ "sSearch": "Search:", /** * Assign a `placeholder` attribute to the search `input` element * @type string * @default * * @dtopt Language * @name DataTable.defaults.language.searchPlaceholder */ "sSearchPlaceholder": "", /** * All of the language information can be stored in a file on the * server-side, which DataTables will look up if this parameter is passed. * It must store the URL of the language file, which is in a JSON format, * and the object has the same properties as the oLanguage object in the * initialiser object (i.e. the above parameters). Please refer to one of * the example language files to see how this works in action. * @type string * @default <i>Empty string - i.e. disabled</i> * * @dtopt Language * @name DataTable.defaults.language.url * * @example * $(document).ready( function() { * $('#example').dataTable( { * "language": { * "url": "http://www.sprymedia.co.uk/dataTables/lang.txt" * } * } ); * } ); */ "sUrl": "", /** * Text shown inside the table records when the is no information to be * displayed after filtering. `emptyTable` is shown when there is simply no * information in the table at all (regardless of filtering). * @type string * @default No matching records found * * @dtopt Language * @name DataTable.defaults.language.zeroRecords * * @example * $(document).ready( function() { * $('#example').dataTable( { * "language": { * "zeroRecords": "No records to display" * } * } ); * } ); */ "sZeroRecords": "No matching records found" }, /** * This parameter allows you to have define the global filtering state at * initialisation time. As an object the `search` parameter must be * defined, but all other parameters are optional. When `regex` is true, * the search string will be treated as a regular expression, when false * (default) it will be treated as a straight string. When `smart` * DataTables will use it's smart filtering methods (to word match at * any point in the data), when false this will not be done. * @namespace * @extends DataTable.models.oSearch * * @dtopt Options * @name DataTable.defaults.search * * @example * $(document).ready( function() { * $('#example').dataTable( { * "search": {"search": "Initial search"} * } ); * } ) */ "oSearch": $.extend( {}, DataTable.models.oSearch ), /** * __Deprecated__ The functionality provided by this parameter has now been * superseded by that provided through `ajax`, which should be used instead. * * By default DataTables will look for the property `data` (or `aaData` for * compatibility with DataTables 1.9-) when obtaining data from an Ajax * source or for server-side processing - this parameter allows that * property to be changed. You can use Javascript dotted object notation to * get a data source for multiple levels of nesting. * @type string * @default data * * @dtopt Options * @dtopt Server-side * @name DataTable.defaults.ajaxDataProp * * @deprecated 1.10. Please use `ajax` for this functionality now. */ "sAjaxDataProp": "data", /** * __Deprecated__ The functionality provided by this parameter has now been * superseded by that provided through `ajax`, which should be used instead. * * You can instruct DataTables to load data from an external * source using this parameter (use aData if you want to pass data in you * already have). Simply provide a url a JSON object can be obtained from. * @type string * @default null * * @dtopt Options * @dtopt Server-side * @name DataTable.defaults.ajaxSource * * @deprecated 1.10. Please use `ajax` for this functionality now. */ "sAjaxSource": null, /** * This initialisation variable allows you to specify exactly where in the * DOM you want DataTables to inject the various controls it adds to the page * (for example you might want the pagination controls at the top of the * table). DIV elements (with or without a custom class) can also be added to * aid styling. The follow syntax is used: * <ul> * <li>The following options are allowed: * <ul> * <li>'l' - Length changing</li> * <li>'f' - Filtering input</li> * <li>'t' - The table!</li> * <li>'i' - Information</li> * <li>'p' - Pagination</li> * <li>'r' - pRocessing</li> * </ul> * </li> * <li>The following constants are allowed: * <ul> * <li>'H' - jQueryUI theme "header" classes ('fg-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix')</li> * <li>'F' - jQueryUI theme "footer" classes ('fg-toolbar ui-widget-header ui-corner-bl ui-corner-br ui-helper-clearfix')</li> * </ul> * </li> * <li>The following syntax is expected: * <ul> * <li>'&lt;' and '&gt;' - div elements</li> * <li>'&lt;"class" and '&gt;' - div with a class</li> * <li>'&lt;"#id" and '&gt;' - div with an ID</li> * </ul> * </li> * <li>Examples: * <ul> * <li>'&lt;"wrapper"flipt&gt;'</li> * <li>'&lt;lf&lt;t&gt;ip&gt;'</li> * </ul> * </li> * </ul> * @type string * @default lfrtip <i>(when `jQueryUI` is false)</i> <b>or</b> * <"H"lfr>t<"F"ip> <i>(when `jQueryUI` is true)</i> * * @dtopt Options * @name DataTable.defaults.dom * * @example * $(document).ready( function() { * $('#example').dataTable( { * "dom": '&lt;"top"i&gt;rt&lt;"bottom"flp&gt;&lt;"clear"&gt;' * } ); * } ); */ "sDom": "lfrtip", /** * Search delay option. This will throttle full table searches that use the * DataTables provided search input element (it does not effect calls to * `dt-api search()`, providing a delay before the search is made. * @type integer * @default 0 * * @dtopt Options * @name DataTable.defaults.searchDelay * * @example * $(document).ready( function() { * $('#example').dataTable( { * "searchDelay": 200 * } ); * } ) */ "searchDelay": null, /** * DataTables features six different built-in options for the buttons to * display for pagination control: * * * `numbers` - Page number buttons only * * `simple` - 'Previous' and 'Next' buttons only * * 'simple_numbers` - 'Previous' and 'Next' buttons, plus page numbers * * `full` - 'First', 'Previous', 'Next' and 'Last' buttons * * `full_numbers` - 'First', 'Previous', 'Next' and 'Last' buttons, plus page numbers * * `first_last_numbers` - 'First' and 'Last' buttons, plus page numbers * * Further methods can be added using {@link DataTable.ext.oPagination}. * @type string * @default simple_numbers * * @dtopt Options * @name DataTable.defaults.pagingType * * @example * $(document).ready( function() { * $('#example').dataTable( { * "pagingType": "full_numbers" * } ); * } ) */ "sPaginationType": "simple_numbers", /** * Enable horizontal scrolling. When a table is too wide to fit into a * certain layout, or you have a large number of columns in the table, you * can enable x-scrolling to show the table in a viewport, which can be * scrolled. This property can be `true` which will allow the table to * scroll horizontally when needed, or any CSS unit, or a number (in which * case it will be treated as a pixel measurement). Setting as simply `true` * is recommended. * @type boolean|string * @default <i>blank string - i.e. disabled</i> * * @dtopt Features * @name DataTable.defaults.scrollX * * @example * $(document).ready( function() { * $('#example').dataTable( { * "scrollX": true, * "scrollCollapse": true * } ); * } ); */ "sScrollX": "", /** * This property can be used to force a DataTable to use more width than it * might otherwise do when x-scrolling is enabled. For example if you have a * table which requires to be well spaced, this parameter is useful for * "over-sizing" the table, and thus forcing scrolling. This property can by * any CSS unit, or a number (in which case it will be treated as a pixel * measurement). * @type string * @default <i>blank string - i.e. disabled</i> * * @dtopt Options * @name DataTable.defaults.scrollXInner * * @example * $(document).ready( function() { * $('#example').dataTable( { * "scrollX": "100%", * "scrollXInner": "110%" * } ); * } ); */ "sScrollXInner": "", /** * Enable vertical scrolling. Vertical scrolling will constrain the DataTable * to the given height, and enable scrolling for any data which overflows the * current viewport. This can be used as an alternative to paging to display * a lot of data in a small area (although paging and scrolling can both be * enabled at the same time). This property can be any CSS unit, or a number * (in which case it will be treated as a pixel measurement). * @type string * @default <i>blank string - i.e. disabled</i> * * @dtopt Features * @name DataTable.defaults.scrollY * * @example * $(document).ready( function() { * $('#example').dataTable( { * "scrollY": "200px", * "paginate": false * } ); * } ); */ "sScrollY": "", /** * __Deprecated__ The functionality provided by this parameter has now been * superseded by that provided through `ajax`, which should be used instead. * * Set the HTTP method that is used to make the Ajax call for server-side * processing or Ajax sourced data. * @type string * @default GET * * @dtopt Options * @dtopt Server-side * @name DataTable.defaults.serverMethod * * @deprecated 1.10. Please use `ajax` for this functionality now. */ "sServerMethod": "GET", /** * DataTables makes use of renderers when displaying HTML elements for * a table. These renderers can be added or modified by plug-ins to * generate suitable mark-up for a site. For example the Bootstrap * integration plug-in for DataTables uses a paging button renderer to * display pagination buttons in the mark-up required by Bootstrap. * * For further information about the renderers available see * DataTable.ext.renderer * @type string|object * @default null * * @name DataTable.defaults.renderer * */ "renderer": null, /** * Set the data property name that DataTables should use to get a row's id * to set as the `id` property in the node. * @type string * @default DT_RowId * * @name DataTable.defaults.rowId */ "rowId": "DT_RowId" }; _fnHungarianMap( DataTable.defaults ); /* * Developer note - See note in model.defaults.js about the use of Hungarian * notation and camel case. */ /** * Column options that can be given to DataTables at initialisation time. * @namespace */ DataTable.defaults.column = { /** * Define which column(s) an order will occur on for this column. This * allows a column's ordering to take multiple columns into account when * doing a sort or use the data from a different column. For example first * name / last name columns make sense to do a multi-column sort over the * two columns. * @type array|int * @default null <i>Takes the value of the column index automatically</i> * * @name DataTable.defaults.column.orderData * @dtopt Columns * * @example * // Using `columnDefs` * $(document).ready( function() { * $('#example').dataTable( { * "columnDefs": [ * { "orderData": [ 0, 1 ], "targets": [ 0 ] }, * { "orderData": [ 1, 0 ], "targets": [ 1 ] }, * { "orderData": 2, "targets": [ 2 ] } * ] * } ); * } ); * * @example * // Using `columns` * $(document).ready( function() { * $('#example').dataTable( { * "columns": [ * { "orderData": [ 0, 1 ] }, * { "orderData": [ 1, 0 ] }, * { "orderData": 2 }, * null, * null * ] * } ); * } ); */ "aDataSort": null, "iDataSort": -1, /** * You can control the default ordering direction, and even alter the * behaviour of the sort handler (i.e. only allow ascending ordering etc) * using this parameter. * @type array * @default [ 'asc', 'desc' ] * * @name DataTable.defaults.column.orderSequence * @dtopt Columns * * @example * // Using `columnDefs` * $(document).ready( function() { * $('#example').dataTable( { * "columnDefs": [ * { "orderSequence": [ "asc" ], "targets": [ 1 ] }, * { "orderSequence": [ "desc", "asc", "asc" ], "targets": [ 2 ] }, * { "orderSequence": [ "desc" ], "targets": [ 3 ] } * ] * } ); * } ); * * @example * // Using `columns` * $(document).ready( function() { * $('#example').dataTable( { * "columns": [ * null, * { "orderSequence": [ "asc" ] }, * { "orderSequence": [ "desc", "asc", "asc" ] }, * { "orderSequence": [ "desc" ] }, * null * ] * } ); * } ); */ "asSorting": [ 'asc', 'desc' ], /** * Enable or disable filtering on the data in this column. * @type boolean * @default true * * @name DataTable.defaults.column.searchable * @dtopt Columns * * @example * // Using `columnDefs` * $(document).ready( function() { * $('#example').dataTable( { * "columnDefs": [ * { "searchable": false, "targets": [ 0 ] } * ] } ); * } ); * * @example * // Using `columns` * $(document).ready( function() { * $('#example').dataTable( { * "columns": [ * { "searchable": false }, * null, * null, * null, * null * ] } ); * } ); */ "bSearchable": true, /** * Enable or disable ordering on this column. * @type boolean * @default true * * @name DataTable.defaults.column.orderable * @dtopt Columns * * @example * // Using `columnDefs` * $(document).ready( function() { * $('#example').dataTable( { * "columnDefs": [ * { "orderable": false, "targets": [ 0 ] } * ] } ); * } ); * * @example * // Using `columns` * $(document).ready( function() { * $('#example').dataTable( { * "columns": [ * { "orderable": false }, * null, * null, * null, * null * ] } ); * } ); */ "bSortable": true, /** * Enable or disable the display of this column. * @type boolean * @default true * * @name DataTable.defaults.column.visible * @dtopt Columns * * @example * // Using `columnDefs` * $(document).ready( function() { * $('#example').dataTable( { * "columnDefs": [ * { "visible": false, "targets": [ 0 ] } * ] } ); * } ); * * @example * // Using `columns` * $(document).ready( function() { * $('#example').dataTable( { * "columns": [ * { "visible": false }, * null, * null, * null, * null * ] } ); * } ); */ "bVisible": true, /** * Developer definable function that is called whenever a cell is created (Ajax source, * etc) or processed for input (DOM source). This can be used as a compliment to mRender * allowing you to modify the DOM element (add background colour for example) when the * element is available. * @type function * @param {element} td The TD node that has been created * @param {*} cellData The Data for the cell * @param {array|object} rowData The data for the whole row * @param {int} row The row index for the aoData data store * @param {int} col The column index for aoColumns * * @name DataTable.defaults.column.createdCell * @dtopt Columns * * @example * $(document).ready( function() { * $('#example').dataTable( { * "columnDefs": [ { * "targets": [3], * "createdCell": function (td, cellData, rowData, row, col) { * if ( cellData == "1.7" ) { * $(td).css('color', 'blue') * } * } * } ] * }); * } ); */ "fnCreatedCell": null, /** * This parameter has been replaced by `data` in DataTables to ensure naming * consistency. `dataProp` can still be used, as there is backwards * compatibility in DataTables for this option, but it is strongly * recommended that you use `data` in preference to `dataProp`. * @name DataTable.defaults.column.dataProp */ /** * This property can be used to read data from any data source property, * including deeply nested objects / properties. `data` can be given in a * number of different ways which effect its behaviour: * * * `integer` - treated as an array index for the data source. This is the * default that DataTables uses (incrementally increased for each column). * * `string` - read an object property from the data source. There are * three 'special' options that can be used in the string to alter how * DataTables reads the data from the source object: * * `.` - Dotted Javascript notation. Just as you use a `.` in * Javascript to read from nested objects, so to can the options * specified in `data`. For example: `browser.version` or * `browser.name`. If your object parameter name contains a period, use * `\\` to escape it - i.e. `first\\.name`. * * `[]` - Array notation. DataTables can automatically combine data * from and array source, joining the data with the characters provided * between the two brackets. For example: `name[, ]` would provide a * comma-space separated list from the source array. If no characters * are provided between the brackets, the original array source is * returned. * * `()` - Function notation. Adding `()` to the end of a parameter will * execute a function of the name given. For example: `browser()` for a * simple function on the data source, `browser.version()` for a * function in a nested property or even `browser().version` to get an * object property if the function called returns an object. Note that * function notation is recommended for use in `render` rather than * `data` as it is much simpler to use as a renderer. * * `null` - use the original data source for the row rather than plucking * data directly from it. This action has effects on two other * initialisation options: * * `defaultContent` - When null is given as the `data` option and * `defaultContent` is specified for the column, the value defined by * `defaultContent` will be used for the cell. * * `render` - When null is used for the `data` option and the `render` * option is specified for the column, the whole data source for the * row is used for the renderer. * * `function` - the function given will be executed whenever DataTables * needs to set or get the data for a cell in the column. The function * takes three parameters: * * Parameters: * * `{array|object}` The data source for the row * * `{string}` The type call data requested - this will be 'set' when * setting data or 'filter', 'display', 'type', 'sort' or undefined * when gathering data. Note that when `undefined` is given for the * type DataTables expects to get the raw data for the object back< * * `{*}` Data to set when the second parameter is 'set'. * * Return: * * The return value from the function is not required when 'set' is * the type of call, but otherwise the return is what will be used * for the data requested. * * Note that `data` is a getter and setter option. If you just require * formatting of data for output, you will likely want to use `render` which * is simply a getter and thus simpler to use. * * Note that prior to DataTables 1.9.2 `data` was called `mDataProp`. The * name change reflects the flexibility of this property and is consistent * with the naming of mRender. If 'mDataProp' is given, then it will still * be used by DataTables, as it automatically maps the old name to the new * if required. * * @type string|int|function|null * @default null <i>Use automatically calculated column index</i> * * @name DataTable.defaults.column.data * @dtopt Columns * * @example * // Read table data from objects * // JSON structure for each row: * // { * // "engine": {value}, * // "browser": {value}, * // "platform": {value}, * // "version": {value}, * // "grade": {value} * // } * $(document).ready( function() { * $('#example').dataTable( { * "ajaxSource": "sources/objects.txt", * "columns": [ * { "data": "engine" }, * { "data": "browser" }, * { "data": "platform" }, * { "data": "version" }, * { "data": "grade" } * ] * } ); * } ); * * @example * // Read information from deeply nested objects * // JSON structure for each row: * // { * // "engine": {value}, * // "browser": {value}, * // "platform": { * // "inner": {value} * // }, * // "details": [ * // {value}, {value} * // ] * // } * $(document).ready( function() { * $('#example').dataTable( { * "ajaxSource": "sources/deep.txt", * "columns": [ * { "data": "engine" }, * { "data": "browser" }, * { "data": "platform.inner" }, * { "data": "platform.details.0" }, * { "data": "platform.details.1" } * ] * } ); * } ); * * @example * // Using `data` as a function to provide different information for * // sorting, filtering and display. In this case, currency (price) * $(document).ready( function() { * $('#example').dataTable( { * "columnDefs": [ { * "targets": [ 0 ], * "data": function ( source, type, val ) { * if (type === 'set') { * source.price = val; * // Store the computed dislay and filter values for efficiency * source.price_display = val=="" ? "" : "$"+numberFormat(val); * source.price_filter = val=="" ? "" : "$"+numberFormat(val)+" "+val; * return; * } * else if (type === 'display') { * return source.price_display; * } * else if (type === 'filter') { * return source.price_filter; * } * // 'sort', 'type' and undefined all just use the integer * return source.price; * } * } ] * } ); * } ); * * @example * // Using default content * $(document).ready( function() { * $('#example').dataTable( { * "columnDefs": [ { * "targets": [ 0 ], * "data": null, * "defaultContent": "Click to edit" * } ] * } ); * } ); * * @example * // Using array notation - outputting a list from an array * $(document).ready( function() { * $('#example').dataTable( { * "columnDefs": [ { * "targets": [ 0 ], * "data": "name[, ]" * } ] * } ); * } ); * */ "mData": null, /** * This property is the rendering partner to `data` and it is suggested that * when you want to manipulate data for display (including filtering, * sorting etc) without altering the underlying data for the table, use this * property. `render` can be considered to be the the read only companion to * `data` which is read / write (then as such more complex). Like `data` * this option can be given in a number of different ways to effect its * behaviour: * * * `integer` - treated as an array index for the data source. This is the * default that DataTables uses (incrementally increased for each column). * * `string` - read an object property from the data source. There are * three 'special' options that can be used in the string to alter how * DataTables reads the data from the source object: * * `.` - Dotted Javascript notation. Just as you use a `.` in * Javascript to read from nested objects, so to can the options * specified in `data`. For example: `browser.version` or * `browser.name`. If your object parameter name contains a period, use * `\\` to escape it - i.e. `first\\.name`. * * `[]` - Array notation. DataTables can automatically combine data * from and array source, joining the data with the characters provided * between the two brackets. For example: `name[, ]` would provide a * comma-space separated list from the source array. If no characters * are provided between the brackets, the original array source is * returned. * * `()` - Function notation. Adding `()` to the end of a parameter will * execute a function of the name given. For example: `browser()` for a * simple function on the data source, `browser.version()` for a * function in a nested property or even `browser().version` to get an * object property if the function called returns an object. * * `object` - use different data for the different data types requested by * DataTables ('filter', 'display', 'type' or 'sort'). The property names * of the object is the data type the property refers to and the value can * defined using an integer, string or function using the same rules as * `render` normally does. Note that an `_` option _must_ be specified. * This is the default value to use if you haven't specified a value for * the data type requested by DataTables. * * `function` - the function given will be executed whenever DataTables * needs to set or get the data for a cell in the column. The function * takes three parameters: * * Parameters: * * {array|object} The data source for the row (based on `data`) * * {string} The type call data requested - this will be 'filter', * 'display', 'type' or 'sort'. * * {array|object} The full data source for the row (not based on * `data`) * * Return: * * The return value from the function is what will be used for the * data requested. * * @type string|int|function|object|null * @default null Use the data source value. * * @name DataTable.defaults.column.render * @dtopt Columns * * @example * // Create a comma separated list from an array of objects * $(document).ready( function() { * $('#example').dataTable( { * "ajaxSource": "sources/deep.txt", * "columns": [ * { "data": "engine" }, * { "data": "browser" }, * { * "data": "platform", * "render": "[, ].name" * } * ] * } ); * } ); * * @example * // Execute a function to obtain data * $(document).ready( function() { * $('#example').dataTable( { * "columnDefs": [ { * "targets": [ 0 ], * "data": null, // Use the full data source object for the renderer's source * "render": "browserName()" * } ] * } ); * } ); * * @example * // As an object, extracting different data for the different types * // This would be used with a data source such as: * // { "phone": 5552368, "phone_filter": "5552368 555-2368", "phone_display": "555-2368" } * // Here the `phone` integer is used for sorting and type detection, while `phone_filter` * // (which has both forms) is used for filtering for if a user inputs either format, while * // the formatted phone number is the one that is shown in the table. * $(document).ready( function() { * $('#example').dataTable( { * "columnDefs": [ { * "targets": [ 0 ], * "data": null, // Use the full data source object for the renderer's source * "render": { * "_": "phone", * "filter": "phone_filter", * "display": "phone_display" * } * } ] * } ); * } ); * * @example * // Use as a function to create a link from the data source * $(document).ready( function() { * $('#example').dataTable( { * "columnDefs": [ { * "targets": [ 0 ], * "data": "download_link", * "render": function ( data, type, full ) { * return '<a href="'+data+'">Download</a>'; * } * } ] * } ); * } ); */ "mRender": null, /** * Change the cell type created for the column - either TD cells or TH cells. This * can be useful as TH cells have semantic meaning in the table body, allowing them * to act as a header for a row (you may wish to add scope='row' to the TH elements). * @type string * @default td * * @name DataTable.defaults.column.cellType * @dtopt Columns * * @example * // Make the first column use TH cells * $(document).ready( function() { * $('#example').dataTable( { * "columnDefs": [ { * "targets": [ 0 ], * "cellType": "th" * } ] * } ); * } ); */ "sCellType": "td", /** * Class to give to each cell in this column. * @type string * @default <i>Empty string</i> * * @name DataTable.defaults.column.class * @dtopt Columns * * @example * // Using `columnDefs` * $(document).ready( function() { * $('#example').dataTable( { * "columnDefs": [ * { "class": "my_class", "targets": [ 0 ] } * ] * } ); * } ); * * @example * // Using `columns` * $(document).ready( function() { * $('#example').dataTable( { * "columns": [ * { "class": "my_class" }, * null, * null, * null, * null * ] * } ); * } ); */ "sClass": "", /** * When DataTables calculates the column widths to assign to each column, * it finds the longest string in each column and then constructs a * temporary table and reads the widths from that. The problem with this * is that "mmm" is much wider then "iiii", but the latter is a longer * string - thus the calculation can go wrong (doing it properly and putting * it into an DOM object and measuring that is horribly(!) slow). Thus as * a "work around" we provide this option. It will append its value to the * text that is found to be the longest string for the column - i.e. padding. * Generally you shouldn't need this! * @type string * @default <i>Empty string<i> * * @name DataTable.defaults.column.contentPadding * @dtopt Columns * * @example * // Using `columns` * $(document).ready( function() { * $('#example').dataTable( { * "columns": [ * null, * null, * null, * { * "contentPadding": "mmm" * } * ] * } ); * } ); */ "sContentPadding": "", /** * Allows a default value to be given for a column's data, and will be used * whenever a null data source is encountered (this can be because `data` * is set to null, or because the data source itself is null). * @type string * @default null * * @name DataTable.defaults.column.defaultContent * @dtopt Columns * * @example * // Using `columnDefs` * $(document).ready( function() { * $('#example').dataTable( { * "columnDefs": [ * { * "data": null, * "defaultContent": "Edit", * "targets": [ -1 ] * } * ] * } ); * } ); * * @example * // Using `columns` * $(document).ready( function() { * $('#example').dataTable( { * "columns": [ * null, * null, * null, * { * "data": null, * "defaultContent": "Edit" * } * ] * } ); * } ); */ "sDefaultContent": null, /** * This parameter is only used in DataTables' server-side processing. It can * be exceptionally useful to know what columns are being displayed on the * client side, and to map these to database fields. When defined, the names * also allow DataTables to reorder information from the server if it comes * back in an unexpected order (i.e. if you switch your columns around on the * client-side, your server-side code does not also need updating). * @type string * @default <i>Empty string</i> * * @name DataTable.defaults.column.name * @dtopt Columns * * @example * // Using `columnDefs` * $(document).ready( function() { * $('#example').dataTable( { * "columnDefs": [ * { "name": "engine", "targets": [ 0 ] }, * { "name": "browser", "targets": [ 1 ] }, * { "name": "platform", "targets": [ 2 ] }, * { "name": "version", "targets": [ 3 ] }, * { "name": "grade", "targets": [ 4 ] } * ] * } ); * } ); * * @example * // Using `columns` * $(document).ready( function() { * $('#example').dataTable( { * "columns": [ * { "name": "engine" }, * { "name": "browser" }, * { "name": "platform" }, * { "name": "version" }, * { "name": "grade" } * ] * } ); * } ); */ "sName": "", /** * Defines a data source type for the ordering which can be used to read * real-time information from the table (updating the internally cached * version) prior to ordering. This allows ordering to occur on user * editable elements such as form inputs. * @type string * @default std * * @name DataTable.defaults.column.orderDataType * @dtopt Columns * * @example * // Using `columnDefs` * $(document).ready( function() { * $('#example').dataTable( { * "columnDefs": [ * { "orderDataType": "dom-text", "targets": [ 2, 3 ] }, * { "type": "numeric", "targets": [ 3 ] }, * { "orderDataType": "dom-select", "targets": [ 4 ] }, * { "orderDataType": "dom-checkbox", "targets": [ 5 ] } * ] * } ); * } ); * * @example * // Using `columns` * $(document).ready( function() { * $('#example').dataTable( { * "columns": [ * null, * null, * { "orderDataType": "dom-text" }, * { "orderDataType": "dom-text", "type": "numeric" }, * { "orderDataType": "dom-select" }, * { "orderDataType": "dom-checkbox" } * ] * } ); * } ); */ "sSortDataType": "std", /** * The title of this column. * @type string * @default null <i>Derived from the 'TH' value for this column in the * original HTML table.</i> * * @name DataTable.defaults.column.title * @dtopt Columns * * @example * // Using `columnDefs` * $(document).ready( function() { * $('#example').dataTable( { * "columnDefs": [ * { "title": "My column title", "targets": [ 0 ] } * ] * } ); * } ); * * @example * // Using `columns` * $(document).ready( function() { * $('#example').dataTable( { * "columns": [ * { "title": "My column title" }, * null, * null, * null, * null * ] * } ); * } ); */ "sTitle": null, /** * The type allows you to specify how the data for this column will be * ordered. Four types (string, numeric, date and html (which will strip * HTML tags before ordering)) are currently available. Note that only date * formats understood by Javascript's Date() object will be accepted as type * date. For example: "Mar 26, 2008 5:03 PM". May take the values: 'string', * 'numeric', 'date' or 'html' (by default). Further types can be adding * through plug-ins. * @type string * @default null <i>Auto-detected from raw data</i> * * @name DataTable.defaults.column.type * @dtopt Columns * * @example * // Using `columnDefs` * $(document).ready( function() { * $('#example').dataTable( { * "columnDefs": [ * { "type": "html", "targets": [ 0 ] } * ] * } ); * } ); * * @example * // Using `columns` * $(document).ready( function() { * $('#example').dataTable( { * "columns": [ * { "type": "html" }, * null, * null, * null, * null * ] * } ); * } ); */ "sType": null, /** * Defining the width of the column, this parameter may take any CSS value * (3em, 20px etc). DataTables applies 'smart' widths to columns which have not * been given a specific width through this interface ensuring that the table * remains readable. * @type string * @default null <i>Automatic</i> * * @name DataTable.defaults.column.width * @dtopt Columns * * @example * // Using `columnDefs` * $(document).ready( function() { * $('#example').dataTable( { * "columnDefs": [ * { "width": "20%", "targets": [ 0 ] } * ] * } ); * } ); * * @example * // Using `columns` * $(document).ready( function() { * $('#example').dataTable( { * "columns": [ * { "width": "20%" }, * null, * null, * null, * null * ] * } ); * } ); */ "sWidth": null }; _fnHungarianMap( DataTable.defaults.column ); /** * DataTables settings object - this holds all the information needed for a * given table, including configuration, data and current application of the * table options. DataTables does not have a single instance for each DataTable * with the settings attached to that instance, but rather instances of the * DataTable "class" are created on-the-fly as needed (typically by a * $().dataTable() call) and the settings object is then applied to that * instance. * * Note that this object is related to {@link DataTable.defaults} but this * one is the internal data store for DataTables's cache of columns. It should * NOT be manipulated outside of DataTables. Any configuration should be done * through the initialisation options. * @namespace * @todo Really should attach the settings object to individual instances so we * don't need to create new instances on each $().dataTable() call (if the * table already exists). It would also save passing oSettings around and * into every single function. However, this is a very significant * architecture change for DataTables and will almost certainly break * backwards compatibility with older installations. This is something that * will be done in 2.0. */ DataTable.models.oSettings = { /** * Primary features of DataTables and their enablement state. * @namespace */ "oFeatures": { /** * Flag to say if DataTables should automatically try to calculate the * optimum table and columns widths (true) or not (false). * Note that this parameter will be set by the initialisation routine. To * set a default use {@link DataTable.defaults}. * @type boolean */ "bAutoWidth": null, /** * Delay the creation of TR and TD elements until they are actually * needed by a driven page draw. This can give a significant speed * increase for Ajax source and Javascript source data, but makes no * difference at all fro DOM and server-side processing tables. * Note that this parameter will be set by the initialisation routine. To * set a default use {@link DataTable.defaults}. * @type boolean */ "bDeferRender": null, /** * Enable filtering on the table or not. Note that if this is disabled * then there is no filtering at all on the table, including fnFilter. * To just remove the filtering input use sDom and remove the 'f' option. * Note that this parameter will be set by the initialisation routine. To * set a default use {@link DataTable.defaults}. * @type boolean */ "bFilter": null, /** * Table information element (the 'Showing x of y records' div) enable * flag. * Note that this parameter will be set by the initialisation routine. To * set a default use {@link DataTable.defaults}. * @type boolean */ "bInfo": null, /** * Present a user control allowing the end user to change the page size * when pagination is enabled. * Note that this parameter will be set by the initialisation routine. To * set a default use {@link DataTable.defaults}. * @type boolean */ "bLengthChange": null, /** * Pagination enabled or not. Note that if this is disabled then length * changing must also be disabled. * Note that this parameter will be set by the initialisation routine. To * set a default use {@link DataTable.defaults}. * @type boolean */ "bPaginate": null, /** * Processing indicator enable flag whenever DataTables is enacting a * user request - typically an Ajax request for server-side processing. * Note that this parameter will be set by the initialisation routine. To * set a default use {@link DataTable.defaults}. * @type boolean */ "bProcessing": null, /** * Server-side processing enabled flag - when enabled DataTables will * get all data from the server for every draw - there is no filtering, * sorting or paging done on the client-side. * Note that this parameter will be set by the initialisation routine. To * set a default use {@link DataTable.defaults}. * @type boolean */ "bServerSide": null, /** * Sorting enablement flag. * Note that this parameter will be set by the initialisation routine. To * set a default use {@link DataTable.defaults}. * @type boolean */ "bSort": null, /** * Multi-column sorting * Note that this parameter will be set by the initialisation routine. To * set a default use {@link DataTable.defaults}. * @type boolean */ "bSortMulti": null, /** * Apply a class to the columns which are being sorted to provide a * visual highlight or not. This can slow things down when enabled since * there is a lot of DOM interaction. * Note that this parameter will be set by the initialisation routine. To * set a default use {@link DataTable.defaults}. * @type boolean */ "bSortClasses": null, /** * State saving enablement flag. * Note that this parameter will be set by the initialisation routine. To * set a default use {@link DataTable.defaults}. * @type boolean */ "bStateSave": null }, /** * Scrolling settings for a table. * @namespace */ "oScroll": { /** * When the table is shorter in height than sScrollY, collapse the * table container down to the height of the table (when true). * Note that this parameter will be set by the initialisation routine. To * set a default use {@link DataTable.defaults}. * @type boolean */ "bCollapse": null, /** * Width of the scrollbar for the web-browser's platform. Calculated * during table initialisation. * @type int * @default 0 */ "iBarWidth": 0, /** * Viewport width for horizontal scrolling. Horizontal scrolling is * disabled if an empty string. * Note that this parameter will be set by the initialisation routine. To * set a default use {@link DataTable.defaults}. * @type string */ "sX": null, /** * Width to expand the table to when using x-scrolling. Typically you * should not need to use this. * Note that this parameter will be set by the initialisation routine. To * set a default use {@link DataTable.defaults}. * @type string * @deprecated */ "sXInner": null, /** * Viewport height for vertical scrolling. Vertical scrolling is disabled * if an empty string. * Note that this parameter will be set by the initialisation routine. To * set a default use {@link DataTable.defaults}. * @type string */ "sY": null }, /** * Language information for the table. * @namespace * @extends DataTable.defaults.oLanguage */ "oLanguage": { /** * Information callback function. See * {@link DataTable.defaults.fnInfoCallback} * @type function * @default null */ "fnInfoCallback": null }, /** * Browser support parameters * @namespace */ "oBrowser": { /** * Indicate if the browser incorrectly calculates width:100% inside a * scrolling element (IE6/7) * @type boolean * @default false */ "bScrollOversize": false, /** * Determine if the vertical scrollbar is on the right or left of the * scrolling container - needed for rtl language layout, although not * all browsers move the scrollbar (Safari). * @type boolean * @default false */ "bScrollbarLeft": false, /** * Flag for if `getBoundingClientRect` is fully supported or not * @type boolean * @default false */ "bBounding": false, /** * Browser scrollbar width * @type integer * @default 0 */ "barWidth": 0 }, "ajax": null, /** * Array referencing the nodes which are used for the features. The * parameters of this object match what is allowed by sDom - i.e. * <ul> * <li>'l' - Length changing</li> * <li>'f' - Filtering input</li> * <li>'t' - The table!</li> * <li>'i' - Information</li> * <li>'p' - Pagination</li> * <li>'r' - pRocessing</li> * </ul> * @type array * @default [] */ "aanFeatures": [], /** * Store data information - see {@link DataTable.models.oRow} for detailed * information. * @type array * @default [] */ "aoData": [], /** * Array of indexes which are in the current display (after filtering etc) * @type array * @default [] */ "aiDisplay": [], /** * Array of indexes for display - no filtering * @type array * @default [] */ "aiDisplayMaster": [], /** * Map of row ids to data indexes * @type object * @default {} */ "aIds": {}, /** * Store information about each column that is in use * @type array * @default [] */ "aoColumns": [], /** * Store information about the table's header * @type array * @default [] */ "aoHeader": [], /** * Store information about the table's footer * @type array * @default [] */ "aoFooter": [], /** * Store the applied global search information in case we want to force a * research or compare the old search to a new one. * Note that this parameter will be set by the initialisation routine. To * set a default use {@link DataTable.defaults}. * @namespace * @extends DataTable.models.oSearch */ "oPreviousSearch": {}, /** * Store the applied search for each column - see * {@link DataTable.models.oSearch} for the format that is used for the * filtering information for each column. * @type array * @default [] */ "aoPreSearchCols": [], /** * Sorting that is applied to the table. Note that the inner arrays are * used in the following manner: * <ul> * <li>Index 0 - column number</li> * <li>Index 1 - current sorting direction</li> * </ul> * Note that this parameter will be set by the initialisation routine. To * set a default use {@link DataTable.defaults}. * @type array * @todo These inner arrays should really be objects */ "aaSorting": null, /** * Sorting that is always applied to the table (i.e. prefixed in front of * aaSorting). * Note that this parameter will be set by the initialisation routine. To * set a default use {@link DataTable.defaults}. * @type array * @default [] */ "aaSortingFixed": [], /** * Classes to use for the striping of a table. * Note that this parameter will be set by the initialisation routine. To * set a default use {@link DataTable.defaults}. * @type array * @default [] */ "asStripeClasses": null, /** * If restoring a table - we should restore its striping classes as well * @type array * @default [] */ "asDestroyStripes": [], /** * If restoring a table - we should restore its width * @type int * @default 0 */ "sDestroyWidth": 0, /** * Callback functions array for every time a row is inserted (i.e. on a draw). * @type array * @default [] */ "aoRowCallback": [], /** * Callback functions for the header on each draw. * @type array * @default [] */ "aoHeaderCallback": [], /** * Callback function for the footer on each draw. * @type array * @default [] */ "aoFooterCallback": [], /** * Array of callback functions for draw callback functions * @type array * @default [] */ "aoDrawCallback": [], /** * Array of callback functions for row created function * @type array * @default [] */ "aoRowCreatedCallback": [], /** * Callback functions for just before the table is redrawn. A return of * false will be used to cancel the draw. * @type array * @default [] */ "aoPreDrawCallback": [], /** * Callback functions for when the table has been initialised. * @type array * @default [] */ "aoInitComplete": [], /** * Callbacks for modifying the settings to be stored for state saving, prior to * saving state. * @type array * @default [] */ "aoStateSaveParams": [], /** * Callbacks for modifying the settings that have been stored for state saving * prior to using the stored values to restore the state. * @type array * @default [] */ "aoStateLoadParams": [], /** * Callbacks for operating on the settings object once the saved state has been * loaded * @type array * @default [] */ "aoStateLoaded": [], /** * Cache the table ID for quick access * @type string * @default <i>Empty string</i> */ "sTableId": "", /** * The TABLE node for the main table * @type node * @default null */ "nTable": null, /** * Permanent ref to the thead element * @type node * @default null */ "nTHead": null, /** * Permanent ref to the tfoot element - if it exists * @type node * @default null */ "nTFoot": null, /** * Permanent ref to the tbody element * @type node * @default null */ "nTBody": null, /** * Cache the wrapper node (contains all DataTables controlled elements) * @type node * @default null */ "nTableWrapper": null, /** * Indicate if when using server-side processing the loading of data * should be deferred until the second draw. * Note that this parameter will be set by the initialisation routine. To * set a default use {@link DataTable.defaults}. * @type boolean * @default false */ "bDeferLoading": false, /** * Indicate if all required information has been read in * @type boolean * @default false */ "bInitialised": false, /** * Information about open rows. Each object in the array has the parameters * 'nTr' and 'nParent' * @type array * @default [] */ "aoOpenRows": [], /** * Dictate the positioning of DataTables' control elements - see * {@link DataTable.model.oInit.sDom}. * Note that this parameter will be set by the initialisation routine. To * set a default use {@link DataTable.defaults}. * @type string * @default null */ "sDom": null, /** * Search delay (in mS) * @type integer * @default null */ "searchDelay": null, /** * Which type of pagination should be used. * Note that this parameter will be set by the initialisation routine. To * set a default use {@link DataTable.defaults}. * @type string * @default two_button */ "sPaginationType": "two_button", /** * The state duration (for `stateSave`) in seconds. * Note that this parameter will be set by the initialisation routine. To * set a default use {@link DataTable.defaults}. * @type int * @default 0 */ "iStateDuration": 0, /** * Array of callback functions for state saving. Each array element is an * object with the following parameters: * <ul> * <li>function:fn - function to call. Takes two parameters, oSettings * and the JSON string to save that has been thus far created. Returns * a JSON string to be inserted into a json object * (i.e. '"param": [ 0, 1, 2]')</li> * <li>string:sName - name of callback</li> * </ul> * @type array * @default [] */ "aoStateSave": [], /** * Array of callback functions for state loading. Each array element is an * object with the following parameters: * <ul> * <li>function:fn - function to call. Takes two parameters, oSettings * and the object stored. May return false to cancel state loading</li> * <li>string:sName - name of callback</li> * </ul> * @type array * @default [] */ "aoStateLoad": [], /** * State that was saved. Useful for back reference * @type object * @default null */ "oSavedState": null, /** * State that was loaded. Useful for back reference * @type object * @default null */ "oLoadedState": null, /** * Source url for AJAX data for the table. * Note that this parameter will be set by the initialisation routine. To * set a default use {@link DataTable.defaults}. * @type string * @default null */ "sAjaxSource": null, /** * Property from a given object from which to read the table data from. This * can be an empty string (when not server-side processing), in which case * it is assumed an an array is given directly. * Note that this parameter will be set by the initialisation routine. To * set a default use {@link DataTable.defaults}. * @type string */ "sAjaxDataProp": null, /** * Note if draw should be blocked while getting data * @type boolean * @default true */ "bAjaxDataGet": true, /** * The last jQuery XHR object that was used for server-side data gathering. * This can be used for working with the XHR information in one of the * callbacks * @type object * @default null */ "jqXHR": null, /** * JSON returned from the server in the last Ajax request * @type object * @default undefined */ "json": undefined, /** * Data submitted as part of the last Ajax request * @type object * @default undefined */ "oAjaxData": undefined, /** * Function to get the server-side data. * Note that this parameter will be set by the initialisation routine. To * set a default use {@link DataTable.defaults}. * @type function */ "fnServerData": null, /** * Functions which are called prior to sending an Ajax request so extra * parameters can easily be sent to the server * @type array * @default [] */ "aoServerParams": [], /** * Send the XHR HTTP method - GET or POST (could be PUT or DELETE if * required). * Note that this parameter will be set by the initialisation routine. To * set a default use {@link DataTable.defaults}. * @type string */ "sServerMethod": null, /** * Format numbers for display. * Note that this parameter will be set by the initialisation routine. To * set a default use {@link DataTable.defaults}. * @type function */ "fnFormatNumber": null, /** * List of options that can be used for the user selectable length menu. * Note that this parameter will be set by the initialisation routine. To * set a default use {@link DataTable.defaults}. * @type array * @default [] */ "aLengthMenu": null, /** * Counter for the draws that the table does. Also used as a tracker for * server-side processing * @type int * @default 0 */ "iDraw": 0, /** * Indicate if a redraw is being done - useful for Ajax * @type boolean * @default false */ "bDrawing": false, /** * Draw index (iDraw) of the last error when parsing the returned data * @type int * @default -1 */ "iDrawError": -1, /** * Paging display length * @type int * @default 10 */ "_iDisplayLength": 10, /** * Paging start point - aiDisplay index * @type int * @default 0 */ "_iDisplayStart": 0, /** * Server-side processing - number of records in the result set * (i.e. before filtering), Use fnRecordsTotal rather than * this property to get the value of the number of records, regardless of * the server-side processing setting. * @type int * @default 0 * @private */ "_iRecordsTotal": 0, /** * Server-side processing - number of records in the current display set * (i.e. after filtering). Use fnRecordsDisplay rather than * this property to get the value of the number of records, regardless of * the server-side processing setting. * @type boolean * @default 0 * @private */ "_iRecordsDisplay": 0, /** * Flag to indicate if jQuery UI marking and classes should be used. * Note that this parameter will be set by the initialisation routine. To * set a default use {@link DataTable.defaults}. * @type boolean */ "bJUI": null, /** * The classes to use for the table * @type object * @default {} */ "oClasses": {}, /** * Flag attached to the settings object so you can check in the draw * callback if filtering has been done in the draw. Deprecated in favour of * events. * @type boolean * @default false * @deprecated */ "bFiltered": false, /** * Flag attached to the settings object so you can check in the draw * callback if sorting has been done in the draw. Deprecated in favour of * events. * @type boolean * @default false * @deprecated */ "bSorted": false, /** * Indicate that if multiple rows are in the header and there is more than * one unique cell per column, if the top one (true) or bottom one (false) * should be used for sorting / title by DataTables. * Note that this parameter will be set by the initialisation routine. To * set a default use {@link DataTable.defaults}. * @type boolean */ "bSortCellsTop": null, /** * Initialisation object that is used for the table * @type object * @default null */ "oInit": null, /** * Destroy callback functions - for plug-ins to attach themselves to the * destroy so they can clean up markup and events. * @type array * @default [] */ "aoDestroyCallback": [], /** * Get the number of records in the current record set, before filtering * @type function */ "fnRecordsTotal": function () { return _fnDataSource( this ) == 'ssp' ? this._iRecordsTotal * 1 : this.aiDisplayMaster.length; }, /** * Get the number of records in the current record set, after filtering * @type function */ "fnRecordsDisplay": function () { return _fnDataSource( this ) == 'ssp' ? this._iRecordsDisplay * 1 : this.aiDisplay.length; }, /** * Get the display end point - aiDisplay index * @type function */ "fnDisplayEnd": function () { var len = this._iDisplayLength, start = this._iDisplayStart, calc = start + len, records = this.aiDisplay.length, features = this.oFeatures, paginate = features.bPaginate; if ( features.bServerSide ) { return paginate === false || len === -1 ? start + records : Math.min( start+len, this._iRecordsDisplay ); } else { return ! paginate || calc>records || len===-1 ? records : calc; } }, /** * The DataTables object for this table * @type object * @default null */ "oInstance": null, /** * Unique identifier for each instance of the DataTables object. If there * is an ID on the table node, then it takes that value, otherwise an * incrementing internal counter is used. * @type string * @default null */ "sInstance": null, /** * tabindex attribute value that is added to DataTables control elements, allowing * keyboard navigation of the table and its controls. */ "iTabIndex": 0, /** * DIV container for the footer scrolling table if scrolling */ "nScrollHead": null, /** * DIV container for the footer scrolling table if scrolling */ "nScrollFoot": null, /** * Last applied sort * @type array * @default [] */ "aLastSort": [], /** * Stored plug-in instances * @type object * @default {} */ "oPlugins": {}, /** * Function used to get a row's id from the row's data * @type function * @default null */ "rowIdFn": null, /** * Data location where to store a row's id * @type string * @default null */ "rowId": null }; /** * Extension object for DataTables that is used to provide all extension * options. * * Note that the `DataTable.ext` object is available through * `jQuery.fn.dataTable.ext` where it may be accessed and manipulated. It is * also aliased to `jQuery.fn.dataTableExt` for historic reasons. * @namespace * @extends DataTable.models.ext */ /** * DataTables extensions * * This namespace acts as a collection area for plug-ins that can be used to * extend DataTables capabilities. Indeed many of the build in methods * use this method to provide their own capabilities (sorting methods for * example). * * Note that this namespace is aliased to `jQuery.fn.dataTableExt` for legacy * reasons * * @namespace */ DataTable.ext = _ext = { /** * Buttons. For use with the Buttons extension for DataTables. This is * defined here so other extensions can define buttons regardless of load * order. It is _not_ used by DataTables core. * * @type object * @default {} */ buttons: {}, /** * Element class names * * @type object * @default {} */ classes: {}, /** * DataTables build type (expanded by the download builder) * * @type string */ builder: "-source-", /** * Error reporting. * * How should DataTables report an error. Can take the value 'alert', * 'throw', 'none' or a function. * * @type string|function * @default alert */ errMode: "alert", /** * Feature plug-ins. * * This is an array of objects which describe the feature plug-ins that are * available to DataTables. These feature plug-ins are then available for * use through the `dom` initialisation option. * * Each feature plug-in is described by an object which must have the * following properties: * * * `fnInit` - function that is used to initialise the plug-in, * * `cFeature` - a character so the feature can be enabled by the `dom` * instillation option. This is case sensitive. * * The `fnInit` function has the following input parameters: * * 1. `{object}` DataTables settings object: see * {@link DataTable.models.oSettings} * * And the following return is expected: * * * {node|null} The element which contains your feature. Note that the * return may also be void if your plug-in does not require to inject any * DOM elements into DataTables control (`dom`) - for example this might * be useful when developing a plug-in which allows table control via * keyboard entry * * @type array * * @example * $.fn.dataTable.ext.features.push( { * "fnInit": function( oSettings ) { * return new TableTools( { "oDTSettings": oSettings } ); * }, * "cFeature": "T" * } ); */ feature: [], /** * Row searching. * * This method of searching is complimentary to the default type based * searching, and a lot more comprehensive as it allows you complete control * over the searching logic. Each element in this array is a function * (parameters described below) that is called for every row in the table, * and your logic decides if it should be included in the searching data set * or not. * * Searching functions have the following input parameters: * * 1. `{object}` DataTables settings object: see * {@link DataTable.models.oSettings} * 2. `{array|object}` Data for the row to be processed (same as the * original format that was passed in as the data source, or an array * from a DOM data source * 3. `{int}` Row index ({@link DataTable.models.oSettings.aoData}), which * can be useful to retrieve the `TR` element if you need DOM interaction. * * And the following return is expected: * * * {boolean} Include the row in the searched result set (true) or not * (false) * * Note that as with the main search ability in DataTables, technically this * is "filtering", since it is subtractive. However, for consistency in * naming we call it searching here. * * @type array * @default [] * * @example * // The following example shows custom search being applied to the * // fourth column (i.e. the data[3] index) based on two input values * // from the end-user, matching the data in a certain range. * $.fn.dataTable.ext.search.push( * function( settings, data, dataIndex ) { * var min = document.getElementById('min').value * 1; * var max = document.getElementById('max').value * 1; * var version = data[3] == "-" ? 0 : data[3]*1; * * if ( min == "" && max == "" ) { * return true; * } * else if ( min == "" && version < max ) { * return true; * } * else if ( min < version && "" == max ) { * return true; * } * else if ( min < version && version < max ) { * return true; * } * return false; * } * ); */ search: [], /** * Selector extensions * * The `selector` option can be used to extend the options available for the * selector modifier options (`selector-modifier` object data type) that * each of the three built in selector types offer (row, column and cell + * their plural counterparts). For example the Select extension uses this * mechanism to provide an option to select only rows, columns and cells * that have been marked as selected by the end user (`{selected: true}`), * which can be used in conjunction with the existing built in selector * options. * * Each property is an array to which functions can be pushed. The functions * take three attributes: * * * Settings object for the host table * * Options object (`selector-modifier` object type) * * Array of selected item indexes * * The return is an array of the resulting item indexes after the custom * selector has been applied. * * @type object */ selector: { cell: [], column: [], row: [] }, /** * Internal functions, exposed for used in plug-ins. * * Please note that you should not need to use the internal methods for * anything other than a plug-in (and even then, try to avoid if possible). * The internal function may change between releases. * * @type object * @default {} */ internal: {}, /** * Legacy configuration options. Enable and disable legacy options that * are available in DataTables. * * @type object */ legacy: { /** * Enable / disable DataTables 1.9 compatible server-side processing * requests * * @type boolean * @default null */ ajax: null }, /** * Pagination plug-in methods. * * Each entry in this object is a function and defines which buttons should * be shown by the pagination rendering method that is used for the table: * {@link DataTable.ext.renderer.pageButton}. The renderer addresses how the * buttons are displayed in the document, while the functions here tell it * what buttons to display. This is done by returning an array of button * descriptions (what each button will do). * * Pagination types (the four built in options and any additional plug-in * options defined here) can be used through the `paginationType` * initialisation parameter. * * The functions defined take two parameters: * * 1. `{int} page` The current page index * 2. `{int} pages` The number of pages in the table * * Each function is expected to return an array where each element of the * array can be one of: * * * `first` - Jump to first page when activated * * `last` - Jump to last page when activated * * `previous` - Show previous page when activated * * `next` - Show next page when activated * * `{int}` - Show page of the index given * * `{array}` - A nested array containing the above elements to add a * containing 'DIV' element (might be useful for styling). * * Note that DataTables v1.9- used this object slightly differently whereby * an object with two functions would be defined for each plug-in. That * ability is still supported by DataTables 1.10+ to provide backwards * compatibility, but this option of use is now decremented and no longer * documented in DataTables 1.10+. * * @type object * @default {} * * @example * // Show previous, next and current page buttons only * $.fn.dataTableExt.oPagination.current = function ( page, pages ) { * return [ 'previous', page, 'next' ]; * }; */ pager: {}, renderer: { pageButton: {}, header: {} }, /** * Ordering plug-ins - custom data source * * The extension options for ordering of data available here is complimentary * to the default type based ordering that DataTables typically uses. It * allows much greater control over the the data that is being used to * order a column, but is necessarily therefore more complex. * * This type of ordering is useful if you want to do ordering based on data * live from the DOM (for example the contents of an 'input' element) rather * than just the static string that DataTables knows of. * * The way these plug-ins work is that you create an array of the values you * wish to be ordering for the column in question and then return that * array. The data in the array much be in the index order of the rows in * the table (not the currently ordering order!). Which order data gathering * function is run here depends on the `dt-init columns.orderDataType` * parameter that is used for the column (if any). * * The functions defined take two parameters: * * 1. `{object}` DataTables settings object: see * {@link DataTable.models.oSettings} * 2. `{int}` Target column index * * Each function is expected to return an array: * * * `{array}` Data for the column to be ordering upon * * @type array * * @example * // Ordering using `input` node values * $.fn.dataTable.ext.order['dom-text'] = function ( settings, col ) * { * return this.api().column( col, {order:'index'} ).nodes().map( function ( td, i ) { * return $('input', td).val(); * } ); * } */ order: {}, /** * Type based plug-ins. * * Each column in DataTables has a type assigned to it, either by automatic * detection or by direct assignment using the `type` option for the column. * The type of a column will effect how it is ordering and search (plug-ins * can also make use of the column type if required). * * @namespace */ type: { /** * Type detection functions. * * The functions defined in this object are used to automatically detect * a column's type, making initialisation of DataTables super easy, even * when complex data is in the table. * * The functions defined take two parameters: * * 1. `{*}` Data from the column cell to be analysed * 2. `{settings}` DataTables settings object. This can be used to * perform context specific type detection - for example detection * based on language settings such as using a comma for a decimal * place. Generally speaking the options from the settings will not * be required * * Each function is expected to return: * * * `{string|null}` Data type detected, or null if unknown (and thus * pass it on to the other type detection functions. * * @type array * * @example * // Currency type detection plug-in: * $.fn.dataTable.ext.type.detect.push( * function ( data, settings ) { * // Check the numeric part * if ( ! $.isNumeric( data.substring(1) ) ) { * return null; * } * * // Check prefixed by currency * if ( data.charAt(0) == '$' || data.charAt(0) == '&pound;' ) { * return 'currency'; * } * return null; * } * ); */ detect: [], /** * Type based search formatting. * * The type based searching functions can be used to pre-format the * data to be search on. For example, it can be used to strip HTML * tags or to de-format telephone numbers for numeric only searching. * * Note that is a search is not defined for a column of a given type, * no search formatting will be performed. * * Pre-processing of searching data plug-ins - When you assign the sType * for a column (or have it automatically detected for you by DataTables * or a type detection plug-in), you will typically be using this for * custom sorting, but it can also be used to provide custom searching * by allowing you to pre-processing the data and returning the data in * the format that should be searched upon. This is done by adding * functions this object with a parameter name which matches the sType * for that target column. This is the corollary of <i>afnSortData</i> * for searching data. * * The functions defined take a single parameter: * * 1. `{*}` Data from the column cell to be prepared for searching * * Each function is expected to return: * * * `{string|null}` Formatted string that will be used for the searching. * * @type object * @default {} * * @example * $.fn.dataTable.ext.type.search['title-numeric'] = function ( d ) { * return d.replace(/\n/g," ").replace( /<.*?>/g, "" ); * } */ search: {}, /** * Type based ordering. * * The column type tells DataTables what ordering to apply to the table * when a column is sorted upon. The order for each type that is defined, * is defined by the functions available in this object. * * Each ordering option can be described by three properties added to * this object: * * * `{type}-pre` - Pre-formatting function * * `{type}-asc` - Ascending order function * * `{type}-desc` - Descending order function * * All three can be used together, only `{type}-pre` or only * `{type}-asc` and `{type}-desc` together. It is generally recommended * that only `{type}-pre` is used, as this provides the optimal * implementation in terms of speed, although the others are provided * for compatibility with existing Javascript sort functions. * * `{type}-pre`: Functions defined take a single parameter: * * 1. `{*}` Data from the column cell to be prepared for ordering * * And return: * * * `{*}` Data to be sorted upon * * `{type}-asc` and `{type}-desc`: Functions are typical Javascript sort * functions, taking two parameters: * * 1. `{*}` Data to compare to the second parameter * 2. `{*}` Data to compare to the first parameter * * And returning: * * * `{*}` Ordering match: <0 if first parameter should be sorted lower * than the second parameter, ===0 if the two parameters are equal and * >0 if the first parameter should be sorted height than the second * parameter. * * @type object * @default {} * * @example * // Numeric ordering of formatted numbers with a pre-formatter * $.extend( $.fn.dataTable.ext.type.order, { * "string-pre": function(x) { * a = (a === "-" || a === "") ? 0 : a.replace( /[^\d\-\.]/g, "" ); * return parseFloat( a ); * } * } ); * * @example * // Case-sensitive string ordering, with no pre-formatting method * $.extend( $.fn.dataTable.ext.order, { * "string-case-asc": function(x,y) { * return ((x < y) ? -1 : ((x > y) ? 1 : 0)); * }, * "string-case-desc": function(x,y) { * return ((x < y) ? 1 : ((x > y) ? -1 : 0)); * } * } ); */ order: {} }, /** * Unique DataTables instance counter * * @type int * @private */ _unique: 0, // // Depreciated // The following properties are retained for backwards compatiblity only. // The should not be used in new projects and will be removed in a future // version // /** * Version check function. * @type function * @depreciated Since 1.10 */ fnVersionCheck: DataTable.fnVersionCheck, /** * Index for what 'this' index API functions should use * @type int * @deprecated Since v1.10 */ iApiIndex: 0, /** * jQuery UI class container * @type object * @deprecated Since v1.10 */ oJUIClasses: {}, /** * Software version * @type string * @deprecated Since v1.10 */ sVersion: DataTable.version }; // // Backwards compatibility. Alias to pre 1.10 Hungarian notation counter parts // $.extend( _ext, { afnFiltering: _ext.search, aTypes: _ext.type.detect, ofnSearch: _ext.type.search, oSort: _ext.type.order, afnSortData: _ext.order, aoFeatures: _ext.feature, oApi: _ext.internal, oStdClasses: _ext.classes, oPagination: _ext.pager } ); $.extend( DataTable.ext.classes, { "sTable": "dataTable", "sNoFooter": "no-footer", /* Paging buttons */ "sPageButton": "paginate_button", "sPageButtonActive": "current", "sPageButtonDisabled": "disabled", /* Striping classes */ "sStripeOdd": "odd", "sStripeEven": "even", /* Empty row */ "sRowEmpty": "dataTables_empty", /* Features */ "sWrapper": "dataTables_wrapper", "sFilter": "dataTables_filter", "sInfo": "dataTables_info", "sPaging": "dataTables_paginate paging_", /* Note that the type is postfixed */ "sLength": "dataTables_length", "sProcessing": "dataTables_processing", /* Sorting */ "sSortAsc": "sorting_asc", "sSortDesc": "sorting_desc", "sSortable": "sorting", /* Sortable in both directions */ "sSortableAsc": "sorting_asc_disabled", "sSortableDesc": "sorting_desc_disabled", "sSortableNone": "sorting_disabled", "sSortColumn": "sorting_", /* Note that an int is postfixed for the sorting order */ /* Filtering */ "sFilterInput": "", /* Page length */ "sLengthSelect": "", /* Scrolling */ "sScrollWrapper": "dataTables_scroll", "sScrollHead": "dataTables_scrollHead", "sScrollHeadInner": "dataTables_scrollHeadInner", "sScrollBody": "dataTables_scrollBody", "sScrollFoot": "dataTables_scrollFoot", "sScrollFootInner": "dataTables_scrollFootInner", /* Misc */ "sHeaderTH": "", "sFooterTH": "", // Deprecated "sSortJUIAsc": "", "sSortJUIDesc": "", "sSortJUI": "", "sSortJUIAscAllowed": "", "sSortJUIDescAllowed": "", "sSortJUIWrapper": "", "sSortIcon": "", "sJUIHeader": "", "sJUIFooter": "" } ); (function() { // Reused strings for better compression. Closure compiler appears to have a // weird edge case where it is trying to expand strings rather than use the // variable version. This results in about 200 bytes being added, for very // little preference benefit since it this run on script load only. var _empty = ''; _empty = ''; var _stateDefault = _empty + 'ui-state-default'; var _sortIcon = _empty + 'css_right ui-icon ui-icon-'; var _headerFooter = _empty + 'fg-toolbar ui-toolbar ui-widget-header ui-helper-clearfix'; $.extend( DataTable.ext.oJUIClasses, DataTable.ext.classes, { /* Full numbers paging buttons */ "sPageButton": "fg-button ui-button "+_stateDefault, "sPageButtonActive": "ui-state-disabled", "sPageButtonDisabled": "ui-state-disabled", /* Features */ "sPaging": "dataTables_paginate fg-buttonset ui-buttonset fg-buttonset-multi "+ "ui-buttonset-multi paging_", /* Note that the type is postfixed */ /* Sorting */ "sSortAsc": _stateDefault+" sorting_asc", "sSortDesc": _stateDefault+" sorting_desc", "sSortable": _stateDefault+" sorting", "sSortableAsc": _stateDefault+" sorting_asc_disabled", "sSortableDesc": _stateDefault+" sorting_desc_disabled", "sSortableNone": _stateDefault+" sorting_disabled", "sSortJUIAsc": _sortIcon+"triangle-1-n", "sSortJUIDesc": _sortIcon+"triangle-1-s", "sSortJUI": _sortIcon+"carat-2-n-s", "sSortJUIAscAllowed": _sortIcon+"carat-1-n", "sSortJUIDescAllowed": _sortIcon+"carat-1-s", "sSortJUIWrapper": "DataTables_sort_wrapper", "sSortIcon": "DataTables_sort_icon", /* Scrolling */ "sScrollHead": "dataTables_scrollHead "+_stateDefault, "sScrollFoot": "dataTables_scrollFoot "+_stateDefault, /* Misc */ "sHeaderTH": _stateDefault, "sFooterTH": _stateDefault, "sJUIHeader": _headerFooter+" ui-corner-tl ui-corner-tr", "sJUIFooter": _headerFooter+" ui-corner-bl ui-corner-br" } ); }()); var extPagination = DataTable.ext.pager; function _numbers ( page, pages ) { var numbers = [], buttons = extPagination.numbers_length, half = Math.floor( buttons / 2 ), i = 1; if ( pages <= buttons ) { numbers = _range( 0, pages ); } else if ( page <= half ) { numbers = _range( 0, buttons-2 ); numbers.push( 'ellipsis' ); numbers.push( pages-1 ); } else if ( page >= pages - 1 - half ) { numbers = _range( pages-(buttons-2), pages ); numbers.splice( 0, 0, 'ellipsis' ); // no unshift in ie6 numbers.splice( 0, 0, 0 ); } else { numbers = _range( page-half+2, page+half-1 ); numbers.push( 'ellipsis' ); numbers.push( pages-1 ); numbers.splice( 0, 0, 'ellipsis' ); numbers.splice( 0, 0, 0 ); } numbers.DT_el = 'span'; return numbers; } $.extend( extPagination, { simple: function ( page, pages ) { return [ 'previous', 'next' ]; }, full: function ( page, pages ) { return [ 'first', 'previous', 'next', 'last' ]; }, numbers: function ( page, pages ) { return [ _numbers(page, pages) ]; }, simple_numbers: function ( page, pages ) { return [ 'previous', _numbers(page, pages), 'next' ]; }, full_numbers: function ( page, pages ) { return [ 'first', 'previous', _numbers(page, pages), 'next', 'last' ]; }, first_last_numbers: function (page, pages) { return ['first', _numbers(page, pages), 'last']; }, // For testing and plug-ins to use _numbers: _numbers, // Number of number buttons (including ellipsis) to show. _Must be odd!_ numbers_length: 7 } ); $.extend( true, DataTable.ext.renderer, { pageButton: { _: function ( settings, host, idx, buttons, page, pages ) { var classes = settings.oClasses; var lang = settings.oLanguage.oPaginate; var aria = settings.oLanguage.oAria.paginate || {}; var btnDisplay, btnClass, counter=0; var attach = function( container, buttons ) { var i, ien, node, button; var clickHandler = function ( e ) { _fnPageChange( settings, e.data.action, true ); }; for ( i=0, ien=buttons.length ; i<ien ; i++ ) { button = buttons[i]; if ( $.isArray( button ) ) { var inner = $( '<'+(button.DT_el || 'div')+'/>' ) .appendTo( container ); attach( inner, button ); } else { btnDisplay = null; btnClass = ''; switch ( button ) { case 'ellipsis': container.append('<span class="ellipsis">&#x2026;</span>'); break; case 'first': btnDisplay = lang.sFirst; btnClass = button + (page > 0 ? '' : ' '+classes.sPageButtonDisabled); break; case 'previous': btnDisplay = lang.sPrevious; btnClass = button + (page > 0 ? '' : ' '+classes.sPageButtonDisabled); break; case 'next': btnDisplay = lang.sNext; btnClass = button + (page < pages-1 ? '' : ' '+classes.sPageButtonDisabled); break; case 'last': btnDisplay = lang.sLast; btnClass = button + (page < pages-1 ? '' : ' '+classes.sPageButtonDisabled); break; default: btnDisplay = button + 1; btnClass = page === button ? classes.sPageButtonActive : ''; break; } if ( btnDisplay !== null ) { node = $('<a>', { 'class': classes.sPageButton+' '+btnClass, 'aria-controls': settings.sTableId, 'aria-label': aria[ button ], 'data-dt-idx': counter, 'tabindex': settings.iTabIndex, 'id': idx === 0 && typeof button === 'string' ? settings.sTableId +'_'+ button : null } ) .html( btnDisplay ) .appendTo( container ); _fnBindAction( node, {action: button}, clickHandler ); counter++; } } } }; // IE9 throws an 'unknown error' if document.activeElement is used // inside an iframe or frame. Try / catch the error. Not good for // accessibility, but neither are frames. var activeEl; try { // Because this approach is destroying and recreating the paging // elements, focus is lost on the select button which is bad for // accessibility. So we want to restore focus once the draw has // completed activeEl = $(host).find(document.activeElement).data('dt-idx'); } catch (e) {} attach( $(host).empty(), buttons ); if ( activeEl !== undefined ) { $(host).find( '[data-dt-idx='+activeEl+']' ).focus(); } } } } ); // Built in type detection. See model.ext.aTypes for information about // what is required from this methods. $.extend( DataTable.ext.type.detect, [ // Plain numbers - first since V8 detects some plain numbers as dates // e.g. Date.parse('55') (but not all, e.g. Date.parse('22')...). function ( d, settings ) { var decimal = settings.oLanguage.sDecimal; return _isNumber( d, decimal ) ? 'num'+decimal : null; }, // Dates (only those recognised by the browser's Date.parse) function ( d, settings ) { // V8 tries _very_ hard to make a string passed into `Date.parse()` // valid, so we need to use a regex to restrict date formats. Use a // plug-in for anything other than ISO8601 style strings if ( d && !(d instanceof Date) && ! _re_date.test(d) ) { return null; } var parsed = Date.parse(d); return (parsed !== null && !isNaN(parsed)) || _empty(d) ? 'date' : null; }, // Formatted numbers function ( d, settings ) { var decimal = settings.oLanguage.sDecimal; return _isNumber( d, decimal, true ) ? 'num-fmt'+decimal : null; }, // HTML numeric function ( d, settings ) { var decimal = settings.oLanguage.sDecimal; return _htmlNumeric( d, decimal ) ? 'html-num'+decimal : null; }, // HTML numeric, formatted function ( d, settings ) { var decimal = settings.oLanguage.sDecimal; return _htmlNumeric( d, decimal, true ) ? 'html-num-fmt'+decimal : null; }, // HTML (this is strict checking - there must be html) function ( d, settings ) { return _empty( d ) || (typeof d === 'string' && d.indexOf('<') !== -1) ? 'html' : null; } ] ); // Filter formatting functions. See model.ext.ofnSearch for information about // what is required from these methods. // // Note that additional search methods are added for the html numbers and // html formatted numbers by `_addNumericSort()` when we know what the decimal // place is $.extend( DataTable.ext.type.search, { html: function ( data ) { return _empty(data) ? data : typeof data === 'string' ? data .replace( _re_new_lines, " " ) .replace( _re_html, "" ) : ''; }, string: function ( data ) { return _empty(data) ? data : typeof data === 'string' ? data.replace( _re_new_lines, " " ) : data; } } ); var __numericReplace = function ( d, decimalPlace, re1, re2 ) { if ( d !== 0 && (!d || d === '-') ) { return -Infinity; } // If a decimal place other than `.` is used, it needs to be given to the // function so we can detect it and replace with a `.` which is the only // decimal place Javascript recognises - it is not locale aware. if ( decimalPlace ) { d = _numToDecimal( d, decimalPlace ); } if ( d.replace ) { if ( re1 ) { d = d.replace( re1, '' ); } if ( re2 ) { d = d.replace( re2, '' ); } } return d * 1; }; // Add the numeric 'deformatting' functions for sorting and search. This is done // in a function to provide an easy ability for the language options to add // additional methods if a non-period decimal place is used. function _addNumericSort ( decimalPlace ) { $.each( { // Plain numbers "num": function ( d ) { return __numericReplace( d, decimalPlace ); }, // Formatted numbers "num-fmt": function ( d ) { return __numericReplace( d, decimalPlace, _re_formatted_numeric ); }, // HTML numeric "html-num": function ( d ) { return __numericReplace( d, decimalPlace, _re_html ); }, // HTML numeric, formatted "html-num-fmt": function ( d ) { return __numericReplace( d, decimalPlace, _re_html, _re_formatted_numeric ); } }, function ( key, fn ) { // Add the ordering method _ext.type.order[ key+decimalPlace+'-pre' ] = fn; // For HTML types add a search formatter that will strip the HTML if ( key.match(/^html\-/) ) { _ext.type.search[ key+decimalPlace ] = _ext.type.search.html; } } ); } // Default sort methods $.extend( _ext.type.order, { // Dates "date-pre": function ( d ) { return Date.parse( d ) || -Infinity; }, // html "html-pre": function ( a ) { return _empty(a) ? '' : a.replace ? a.replace( /<.*?>/g, "" ).toLowerCase() : a+''; }, // string "string-pre": function ( a ) { // This is a little complex, but faster than always calling toString, // http://jsperf.com/tostring-v-check return _empty(a) ? '' : typeof a === 'string' ? a.toLowerCase() : ! a.toString ? '' : a.toString(); }, // string-asc and -desc are retained only for compatibility with the old // sort methods "string-asc": function ( x, y ) { return ((x < y) ? -1 : ((x > y) ? 1 : 0)); }, "string-desc": function ( x, y ) { return ((x < y) ? 1 : ((x > y) ? -1 : 0)); } } ); // Numeric sorting types - order doesn't matter here _addNumericSort( '' ); $.extend( true, DataTable.ext.renderer, { header: { _: function ( settings, cell, column, classes ) { // No additional mark-up required // Attach a sort listener to update on sort - note that using the // `DT` namespace will allow the event to be removed automatically // on destroy, while the `dt` namespaced event is the one we are // listening for $(settings.nTable).on( 'order.dt.DT', function ( e, ctx, sorting, columns ) { if ( settings !== ctx ) { // need to check this this is the host return; // table, not a nested one } var colIdx = column.idx; cell .removeClass( column.sSortingClass +' '+ classes.sSortAsc +' '+ classes.sSortDesc ) .addClass( columns[ colIdx ] == 'asc' ? classes.sSortAsc : columns[ colIdx ] == 'desc' ? classes.sSortDesc : column.sSortingClass ); } ); }, jqueryui: function ( settings, cell, column, classes ) { $('<div/>') .addClass( classes.sSortJUIWrapper ) .append( cell.contents() ) .append( $('<span/>') .addClass( classes.sSortIcon+' '+column.sSortingClassJUI ) ) .appendTo( cell ); // Attach a sort listener to update on sort $(settings.nTable).on( 'order.dt.DT', function ( e, ctx, sorting, columns ) { if ( settings !== ctx ) { return; } var colIdx = column.idx; cell .removeClass( classes.sSortAsc +" "+classes.sSortDesc ) .addClass( columns[ colIdx ] == 'asc' ? classes.sSortAsc : columns[ colIdx ] == 'desc' ? classes.sSortDesc : column.sSortingClass ); cell .find( 'span.'+classes.sSortIcon ) .removeClass( classes.sSortJUIAsc +" "+ classes.sSortJUIDesc +" "+ classes.sSortJUI +" "+ classes.sSortJUIAscAllowed +" "+ classes.sSortJUIDescAllowed ) .addClass( columns[ colIdx ] == 'asc' ? classes.sSortJUIAsc : columns[ colIdx ] == 'desc' ? classes.sSortJUIDesc : column.sSortingClassJUI ); } ); } } } ); /* * Public helper functions. These aren't used internally by DataTables, or * called by any of the options passed into DataTables, but they can be used * externally by developers working with DataTables. They are helper functions * to make working with DataTables a little bit easier. */ var __htmlEscapeEntities = function ( d ) { return typeof d === 'string' ? d.replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;') : d; }; /** * Helpers for `columns.render`. * * The options defined here can be used with the `columns.render` initialisation * option to provide a display renderer. The following functions are defined: * * * `number` - Will format numeric data (defined by `columns.data`) for * display, retaining the original unformatted data for sorting and filtering. * It takes 5 parameters: * * `string` - Thousands grouping separator * * `string` - Decimal point indicator * * `integer` - Number of decimal points to show * * `string` (optional) - Prefix. * * `string` (optional) - Postfix (/suffix). * * `text` - Escape HTML to help prevent XSS attacks. It has no optional * parameters. * * @example * // Column definition using the number renderer * { * data: "salary", * render: $.fn.dataTable.render.number( '\'', '.', 0, '$' ) * } * * @namespace */ DataTable.render = { number: function ( thousands, decimal, precision, prefix, postfix ) { return { display: function ( d ) { if ( typeof d !== 'number' && typeof d !== 'string' ) { return d; } var negative = d < 0 ? '-' : ''; var flo = parseFloat( d ); // If NaN then there isn't much formatting that we can do - just // return immediately, escaping any HTML (this was supposed to // be a number after all) if ( isNaN( flo ) ) { return __htmlEscapeEntities( d ); } flo = flo.toFixed( precision ); d = Math.abs( flo ); var intPart = parseInt( d, 10 ); var floatPart = precision ? decimal+(d - intPart).toFixed( precision ).substring( 2 ): ''; return negative + (prefix||'') + intPart.toString().replace( /\B(?=(\d{3})+(?!\d))/g, thousands ) + floatPart + (postfix||''); } }; }, text: function () { return { display: __htmlEscapeEntities }; } }; /* * This is really a good bit rubbish this method of exposing the internal methods * publicly... - To be fixed in 2.0 using methods on the prototype */ /** * Create a wrapper function for exporting an internal functions to an external API. * @param {string} fn API function name * @returns {function} wrapped function * @memberof DataTable#internal */ function _fnExternApiFunc (fn) { return function() { var args = [_fnSettingsFromNode( this[DataTable.ext.iApiIndex] )].concat( Array.prototype.slice.call(arguments) ); return DataTable.ext.internal[fn].apply( this, args ); }; } /** * Reference to internal functions for use by plug-in developers. Note that * these methods are references to internal functions and are considered to be * private. If you use these methods, be aware that they are liable to change * between versions. * @namespace */ $.extend( DataTable.ext.internal, { _fnExternApiFunc: _fnExternApiFunc, _fnBuildAjax: _fnBuildAjax, _fnAjaxUpdate: _fnAjaxUpdate, _fnAjaxParameters: _fnAjaxParameters, _fnAjaxUpdateDraw: _fnAjaxUpdateDraw, _fnAjaxDataSrc: _fnAjaxDataSrc, _fnAddColumn: _fnAddColumn, _fnColumnOptions: _fnColumnOptions, _fnAdjustColumnSizing: _fnAdjustColumnSizing, _fnVisibleToColumnIndex: _fnVisibleToColumnIndex, _fnColumnIndexToVisible: _fnColumnIndexToVisible, _fnVisbleColumns: _fnVisbleColumns, _fnGetColumns: _fnGetColumns, _fnColumnTypes: _fnColumnTypes, _fnApplyColumnDefs: _fnApplyColumnDefs, _fnHungarianMap: _fnHungarianMap, _fnCamelToHungarian: _fnCamelToHungarian, _fnLanguageCompat: _fnLanguageCompat, _fnBrowserDetect: _fnBrowserDetect, _fnAddData: _fnAddData, _fnAddTr: _fnAddTr, _fnNodeToDataIndex: _fnNodeToDataIndex, _fnNodeToColumnIndex: _fnNodeToColumnIndex, _fnGetCellData: _fnGetCellData, _fnSetCellData: _fnSetCellData, _fnSplitObjNotation: _fnSplitObjNotation, _fnGetObjectDataFn: _fnGetObjectDataFn, _fnSetObjectDataFn: _fnSetObjectDataFn, _fnGetDataMaster: _fnGetDataMaster, _fnClearTable: _fnClearTable, _fnDeleteIndex: _fnDeleteIndex, _fnInvalidate: _fnInvalidate, _fnGetRowElements: _fnGetRowElements, _fnCreateTr: _fnCreateTr, _fnBuildHead: _fnBuildHead, _fnDrawHead: _fnDrawHead, _fnDraw: _fnDraw, _fnReDraw: _fnReDraw, _fnAddOptionsHtml: _fnAddOptionsHtml, _fnDetectHeader: _fnDetectHeader, _fnGetUniqueThs: _fnGetUniqueThs, _fnFeatureHtmlFilter: _fnFeatureHtmlFilter, _fnFilterComplete: _fnFilterComplete, _fnFilterCustom: _fnFilterCustom, _fnFilterColumn: _fnFilterColumn, _fnFilter: _fnFilter, _fnFilterCreateSearch: _fnFilterCreateSearch, _fnEscapeRegex: _fnEscapeRegex, _fnFilterData: _fnFilterData, _fnFeatureHtmlInfo: _fnFeatureHtmlInfo, _fnUpdateInfo: _fnUpdateInfo, _fnInfoMacros: _fnInfoMacros, _fnInitialise: _fnInitialise, _fnInitComplete: _fnInitComplete, _fnLengthChange: _fnLengthChange, _fnFeatureHtmlLength: _fnFeatureHtmlLength, _fnFeatureHtmlPaginate: _fnFeatureHtmlPaginate, _fnPageChange: _fnPageChange, _fnFeatureHtmlProcessing: _fnFeatureHtmlProcessing, _fnProcessingDisplay: _fnProcessingDisplay, _fnFeatureHtmlTable: _fnFeatureHtmlTable, _fnScrollDraw: _fnScrollDraw, _fnApplyToChildren: _fnApplyToChildren, _fnCalculateColumnWidths: _fnCalculateColumnWidths, _fnThrottle: _fnThrottle, _fnConvertToWidth: _fnConvertToWidth, _fnGetWidestNode: _fnGetWidestNode, _fnGetMaxLenString: _fnGetMaxLenString, _fnStringToCss: _fnStringToCss, _fnSortFlatten: _fnSortFlatten, _fnSort: _fnSort, _fnSortAria: _fnSortAria, _fnSortListener: _fnSortListener, _fnSortAttachListener: _fnSortAttachListener, _fnSortingClasses: _fnSortingClasses, _fnSortData: _fnSortData, _fnSaveState: _fnSaveState, _fnLoadState: _fnLoadState, _fnSettingsFromNode: _fnSettingsFromNode, _fnLog: _fnLog, _fnMap: _fnMap, _fnBindAction: _fnBindAction, _fnCallbackReg: _fnCallbackReg, _fnCallbackFire: _fnCallbackFire, _fnLengthOverflow: _fnLengthOverflow, _fnRenderer: _fnRenderer, _fnDataSource: _fnDataSource, _fnRowAttributes: _fnRowAttributes, _fnCalculateEnd: function () {} // Used by a lot of plug-ins, but redundant // in 1.10, so this dead-end function is // added to prevent errors } ); // jQuery access $.fn.dataTable = DataTable; // Provide access to the host jQuery object (circular reference) DataTable.$ = $; // Legacy aliases $.fn.dataTableSettings = DataTable.settings; $.fn.dataTableExt = DataTable.ext; // With a capital `D` we return a DataTables API instance rather than a // jQuery object $.fn.DataTable = function ( opts ) { return $(this).dataTable( opts ).api(); }; // All properties that are available to $.fn.dataTable should also be // available on $.fn.DataTable $.each( DataTable, function ( prop, val ) { $.fn.DataTable[ prop ] = val; } ); // Information about events fired by DataTables - for documentation. /** * Draw event, fired whenever the table is redrawn on the page, at the same * point as fnDrawCallback. This may be useful for binding events or * performing calculations when the table is altered at all. * @name DataTable#draw.dt * @event * @param {event} e jQuery event object * @param {object} o DataTables settings object {@link DataTable.models.oSettings} */ /** * Search event, fired when the searching applied to the table (using the * built-in global search, or column filters) is altered. * @name DataTable#search.dt * @event * @param {event} e jQuery event object * @param {object} o DataTables settings object {@link DataTable.models.oSettings} */ /** * Page change event, fired when the paging of the table is altered. * @name DataTable#page.dt * @event * @param {event} e jQuery event object * @param {object} o DataTables settings object {@link DataTable.models.oSettings} */ /** * Order event, fired when the ordering applied to the table is altered. * @name DataTable#order.dt * @event * @param {event} e jQuery event object * @param {object} o DataTables settings object {@link DataTable.models.oSettings} */ /** * DataTables initialisation complete event, fired when the table is fully * drawn, including Ajax data loaded, if Ajax data is required. * @name DataTable#init.dt * @event * @param {event} e jQuery event object * @param {object} oSettings DataTables settings object * @param {object} json The JSON object request from the server - only * present if client-side Ajax sourced data is used</li></ol> */ /** * State save event, fired when the table has changed state a new state save * is required. This event allows modification of the state saving object * prior to actually doing the save, including addition or other state * properties (for plug-ins) or modification of a DataTables core property. * @name DataTable#stateSaveParams.dt * @event * @param {event} e jQuery event object * @param {object} oSettings DataTables settings object * @param {object} json The state information to be saved */ /** * State load event, fired when the table is loading state from the stored * data, but prior to the settings object being modified by the saved state * - allowing modification of the saved state is required or loading of * state for a plug-in. * @name DataTable#stateLoadParams.dt * @event * @param {event} e jQuery event object * @param {object} oSettings DataTables settings object * @param {object} json The saved state information */ /** * State loaded event, fired when state has been loaded from stored data and * the settings object has been modified by the loaded data. * @name DataTable#stateLoaded.dt * @event * @param {event} e jQuery event object * @param {object} oSettings DataTables settings object * @param {object} json The saved state information */ /** * Processing event, fired when DataTables is doing some kind of processing * (be it, order, searcg or anything else). It can be used to indicate to * the end user that there is something happening, or that something has * finished. * @name DataTable#processing.dt * @event * @param {event} e jQuery event object * @param {object} oSettings DataTables settings object * @param {boolean} bShow Flag for if DataTables is doing processing or not */ /** * Ajax (XHR) event, fired whenever an Ajax request is completed from a * request to made to the server for new data. This event is called before * DataTables processed the returned data, so it can also be used to pre- * process the data returned from the server, if needed. * * Note that this trigger is called in `fnServerData`, if you override * `fnServerData` and which to use this event, you need to trigger it in you * success function. * @name DataTable#xhr.dt * @event * @param {event} e jQuery event object * @param {object} o DataTables settings object {@link DataTable.models.oSettings} * @param {object} json JSON returned from the server * * @example * // Use a custom property returned from the server in another DOM element * $('#table').dataTable().on('xhr.dt', function (e, settings, json) { * $('#status').html( json.status ); * } ); * * @example * // Pre-process the data returned from the server * $('#table').dataTable().on('xhr.dt', function (e, settings, json) { * for ( var i=0, ien=json.aaData.length ; i<ien ; i++ ) { * json.aaData[i].sum = json.aaData[i].one + json.aaData[i].two; * } * // Note no return - manipulate the data directly in the JSON object. * } ); */ /** * Destroy event, fired when the DataTable is destroyed by calling fnDestroy * or passing the bDestroy:true parameter in the initialisation object. This * can be used to remove bound events, added DOM nodes, etc. * @name DataTable#destroy.dt * @event * @param {event} e jQuery event object * @param {object} o DataTables settings object {@link DataTable.models.oSettings} */ /** * Page length change event, fired when number of records to show on each * page (the length) is changed. * @name DataTable#length.dt * @event * @param {event} e jQuery event object * @param {object} o DataTables settings object {@link DataTable.models.oSettings} * @param {integer} len New length */ /** * Column sizing has changed. * @name DataTable#column-sizing.dt * @event * @param {event} e jQuery event object * @param {object} o DataTables settings object {@link DataTable.models.oSettings} */ /** * Column visibility has changed. * @name DataTable#column-visibility.dt * @event * @param {event} e jQuery event object * @param {object} o DataTables settings object {@link DataTable.models.oSettings} * @param {int} column Column index * @param {bool} vis `false` if column now hidden, or `true` if visible */ return $.fn.dataTable; }));
ahocevar/cdnjs
ajax/libs/datatables/1.10.13/js/jquery.dataTables.js
JavaScript
mit
448,547
<?php $UTF8_TO_ASCII[0x7b] = array( 'Guo ','Yin ','Hun ','Pu ','Yu ','Han ','Yuan ','Lun ','Quan ','Yu ','Qing ','Guo ','Chuan ','Wei ','Yuan ','Quan ','Ku ','Fu ','Yuan ','Yuan ','E ','Tu ','Tu ','Tu ','Tuan ','Lue ','Hui ','Yi ','Yuan ','Luan ','Luan ','Tu ','Ya ','Tu ','Ting ','Sheng ','Pu ','Lu ','Iri ','Ya ','Zai ','Wei ','Ge ','Yu ','Wu ','Gui ','Pi ','Yi ','Di ','Qian ','Qian ','Zhen ','Zhuo ','Dang ','Qia ','Akutsu ','Yama ','Kuang ','Chang ','Qi ','Nie ','Mo ','Ji ','Jia ','Zhi ','Zhi ','Ban ','Xun ','Tou ','Qin ','Fen ','Jun ','Keng ','Tun ','Fang ','Fen ','Ben ','Tan ','Kan ','Pi ','Zuo ','Keng ','Bi ','Xing ','Di ','Jing ','Ji ','Kuai ','Di ','Jing ','Jian ','Tan ','Li ','Ba ','Wu ','Fen ','Zhui ','Po ','Pan ','Tang ','Kun ','Qu ','Tan ','Zhi ','Tuo ','Gan ','Ping ','Dian ','Gua ','Ni ','Tai ','Pi ','Jiong ','Yang ','Fo ','Ao ','Liu ','Qiu ','Mu ','Ke ','Gou ','Xue ','Ba ','Chi ','Che ','Ling ','Zhu ','Fu ','Hu ','Zhi ','Chui ','La ','Long ','Long ','Lu ','Ao ','Tay ','Pao ','[?] ','Xing ','Dong ','Ji ','Ke ','Lu ','Ci ','Chi ','Lei ','Gai ','Yin ','Hou ','Dui ','Zhao ','Fu ','Guang ','Yao ','Duo ','Duo ','Gui ','Cha ','Yang ','Yin ','Fa ','Gou ','Yuan ','Die ','Xie ','Ken ','Jiong ','Shou ','E ','Ha ','Dian ','Hong ','Wu ','Kua ','[?] ','Tao ','Dang ','Kai ','Gake ','Nao ','An ','Xing ','Xian ','Huan ','Bang ','Pei ','Ba ','Yi ','Yin ','Han ','Xu ','Chui ','Cen ','Geng ','Ai ','Peng ','Fang ','Que ','Yong ','Xun ','Jia ','Di ','Mai ','Lang ','Xuan ','Cheng ','Yan ','Jin ','Zhe ','Lei ','Lie ','Bu ','Cheng ','Gomi ','Bu ','Shi ','Xun ','Guo ','Jiong ','Ye ','Nian ','Di ','Yu ','Bu ','Ya ','Juan ','Sui ','Pi ','Cheng ','Wan ','Ju ','Lun ','Zheng ','Kong ','Chong ','Dong ','Dai ','Tan ','An ','Cai ','Shu ','Beng ','Kan ','Zhi ','Duo ','Yi ','Zhi ','Yi ','Pei ','Ji ','Zhun ','Qi ','Sao ','Ju ','Ni ', );
craue/DoctrineExtensions
lib/Gedmo/Sluggable/Util/data/x7b.php
PHP
mit
1,844
/** * @ngdoc service * @name $ionicNavBarDelegate * @module ionic * @description * Delegate for controlling the {@link ionic.directive:ionNavBar} directive. * * @usage * * ```html * <body ng-controller="MyCtrl"> * <ion-nav-bar> * <button ng-click="setNavTitle('banana')"> * Set title to banana! * </button> * </ion-nav-bar> * </body> * ``` * ```js * function MyCtrl($scope, $ionicNavBarDelegate) { * $scope.setNavTitle = function(title) { * $ionicNavBarDelegate.title(title); * } * } * ``` */ IonicModule .service('$ionicNavBarDelegate', ionic.DelegateService([ /** * @ngdoc method * @name $ionicNavBarDelegate#align * @description Aligns the title with the buttons in a given direction. * @param {string=} direction The direction to the align the title text towards. * Available: 'left', 'right', 'center'. Default: 'center'. */ 'align', /** * @ngdoc method * @name $ionicNavBarDelegate#showBackButton * @description * Set/get whether the {@link ionic.directive:ionNavBackButton} is shown * (if it exists and there is a previous view that can be navigated to). * @param {boolean=} show Whether to show the back button. * @returns {boolean} Whether the back button is shown. */ 'showBackButton', /** * @ngdoc method * @name $ionicNavBarDelegate#showBar * @description * Set/get whether the {@link ionic.directive:ionNavBar} is shown. * @param {boolean} show Whether to show the bar. * @returns {boolean} Whether the bar is shown. */ 'showBar', /** * @ngdoc method * @name $ionicNavBarDelegate#title * @description * Set the title for the {@link ionic.directive:ionNavBar}. * @param {string} title The new title to show. */ 'title', // DEPRECATED, as of v1.0.0-beta14 ------- 'changeTitle', 'setTitle', 'getTitle', 'back', 'getPreviousTitle' // END DEPRECATED ------- ]));
r14r-work/fork_ionic_master
js/angular/service/navBarDelegate.js
JavaScript
mit
1,936
<?php $UTF8_TO_ASCII[0x84] = array( 'Huai ','Tai ','Song ','Wu ','Ou ','Chang ','Chuang ','Ju ','Yi ','Bao ','Chao ','Min ','Pei ','Zuo ','Zen ','Yang ','Kou ','Ban ','Nu ','Nao ','Zheng ','Pa ','Bu ','Tie ','Gu ','Hu ','Ju ','Da ','Lian ','Si ','Chou ','Di ','Dai ','Yi ','Tu ','You ','Fu ','Ji ','Peng ','Xing ','Yuan ','Ni ','Guai ','Fu ','Xi ','Bi ','You ','Qie ','Xuan ','Cong ','Bing ','Huang ','Xu ','Chu ','Pi ','Xi ','Xi ','Tan ','Koraeru ','Zong ','Dui ','[?] ','Ki ','Yi ','Chi ','Ren ','Xun ','Shi ','Xi ','Lao ','Heng ','Kuang ','Mu ','Zhi ','Xie ','Lian ','Tiao ','Huang ','Die ','Hao ','Kong ','Gui ','Heng ','Xi ','Xiao ','Shu ','S ','Kua ','Qiu ','Yang ','Hui ','Hui ','Chi ','Jia ','Yi ','Xiong ','Guai ','Lin ','Hui ','Zi ','Xu ','Chi ','Xiang ','Nu ','Hen ','En ','Ke ','Tong ','Tian ','Gong ','Quan ','Xi ','Qia ','Yue ','Peng ','Ken ','De ','Hui ','E ','Kyuu ','Tong ','Yan ','Kai ','Ce ','Nao ','Yun ','Mang ','Yong ','Yong ','Yuan ','Pi ','Kun ','Qiao ','Yue ','Yu ','Yu ','Jie ','Xi ','Zhe ','Lin ','Ti ','Han ','Hao ','Qie ','Ti ','Bu ','Yi ','Qian ','Hui ','Xi ','Bei ','Man ','Yi ','Heng ','Song ','Quan ','Cheng ','Hui ','Wu ','Wu ','You ','Li ','Liang ','Huan ','Cong ','Yi ','Yue ','Li ','Nin ','Nao ','E ','Que ','Xuan ','Qian ','Wu ','Min ','Cong ','Fei ','Bei ','Duo ','Cui ','Chang ','Men ','Li ','Ji ','Guan ','Guan ','Xing ','Dao ','Qi ','Kong ','Tian ','Lun ','Xi ','Kan ','Kun ','Ni ','Qing ','Chou ','Dun ','Guo ','Chan ','Liang ','Wan ','Yuan ','Jin ','Ji ','Lin ','Yu ','Huo ','He ','Quan ','Tan ','Ti ','Ti ','Nie ','Wang ','Chuo ','Bu ','Hun ','Xi ','Tang ','Xin ','Wei ','Hui ','E ','Rui ','Zong ','Jian ','Yong ','Dian ','Ju ','Can ','Cheng ','De ','Bei ','Qie ','Can ','Dan ','Guan ','Duo ','Nao ','Yun ','Xiang ','Zhui ','Die ','Huang ','Chun ','Qiong ','Re ','Xing ','Ce ','Bian ','Hun ','Zong ','Ti ', );
evgenikozlov/test-task
vendor/gedmo/doctrine-extensions/lib/Gedmo/Sluggable/Util/data/x84.php
PHP
mit
1,855
/* * /MathJax/jax/input/MathML/entities/v.js * * Copyright (c) 2009-2014 The MathJax Consortium * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ (function(a){MathJax.Hub.Insert(a.Parse.Entity,{VDash:"\u22AB",Vbar:"\u2AEB",Vcy:"\u0412",Vdashl:"\u2AE6",Verbar:"\u2016",Vert:"\u2016",VerticalLine:"\u007C",VerticalSeparator:"\u2758",VeryThinSpace:"\u200A",vArr:"\u21D5",vBar:"\u2AE8",vBarv:"\u2AE9",vDash:"\u22A8",vangrt:"\u299C",varepsilon:"\u03F5",varkappa:"\u03F0",varnothing:"\u2205",varphi:"\u03D5",varpi:"\u03D6",varpropto:"\u221D",varr:"\u2195",varrho:"\u03F1",varsigma:"\u03C2",varsubsetneq:"\u228A\uFE00",varsubsetneqq:"\u2ACB\uFE00",varsupsetneq:"\u228B\uFE00",varsupsetneqq:"\u2ACC\uFE00",vartheta:"\u03D1",vartriangleleft:"\u22B2",vartriangleright:"\u22B3",vcy:"\u0432",vdash:"\u22A2",vee:"\u2228",veeeq:"\u225A",verbar:"\u007C",vert:"\u007C",vltri:"\u22B2",vnsub:"\u2282\u20D2",vnsup:"\u2283\u20D2",vprop:"\u221D",vrtri:"\u22B3",vsubnE:"\u2ACB\uFE00",vsubne:"\u228A\uFE00",vsupnE:"\u2ACC\uFE00",vsupne:"\u228B\uFE00",vzigzag:"\u299A"});MathJax.Ajax.loadComplete(a.entityDir+"/v.js")})(MathJax.InputJax.MathML);
Eruant/cdnjs
ajax/libs/mathjax/2.4.0/jax/input/MathML/entities/v.js
JavaScript
mit
1,649
/* * /MathJax/jax/input/MathML/entities/c.js * * Copyright (c) 2009-2014 The MathJax Consortium * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ (function(a){MathJax.Hub.Insert(a.Parse.Entity,{CHcy:"\u0427",COPY:"\u00A9",Cacute:"\u0106",CapitalDifferentialD:"\u2145",Cayleys:"\u212D",Ccaron:"\u010C",Ccedil:"\u00C7",Ccirc:"\u0108",Cconint:"\u2230",Cdot:"\u010A",Cedilla:"\u00B8",Chi:"\u03A7",ClockwiseContourIntegral:"\u2232",CloseCurlyDoubleQuote:"\u201D",CloseCurlyQuote:"\u2019",Colon:"\u2237",Colone:"\u2A74",Conint:"\u222F",CounterClockwiseContourIntegral:"\u2233",cacute:"\u0107",capand:"\u2A44",capbrcup:"\u2A49",capcap:"\u2A4B",capcup:"\u2A47",capdot:"\u2A40",caps:"\u2229\uFE00",caret:"\u2041",caron:"\u02C7",ccaps:"\u2A4D",ccaron:"\u010D",ccedil:"\u00E7",ccirc:"\u0109",ccups:"\u2A4C",ccupssm:"\u2A50",cdot:"\u010B",cedil:"\u00B8",cemptyv:"\u29B2",cent:"\u00A2",centerdot:"\u00B7",chcy:"\u0447",checkmark:"\u2713",cir:"\u25CB",cirE:"\u29C3",cire:"\u2257",cirfnint:"\u2A10",cirmid:"\u2AEF",cirscir:"\u29C2",clubsuit:"\u2663",colone:"\u2254",coloneq:"\u2254",comma:"\u002C",commat:"\u0040",compfn:"\u2218",complement:"\u2201",complexes:"\u2102",cong:"\u2245",congdot:"\u2A6D",conint:"\u222E",coprod:"\u2210",copy:"\u00A9",copysr:"\u2117",crarr:"\u21B5",cross:"\u2717",csub:"\u2ACF",csube:"\u2AD1",csup:"\u2AD0",csupe:"\u2AD2",cudarrl:"\u2938",cudarrr:"\u2935",cularrp:"\u293D",cupbrcap:"\u2A48",cupcap:"\u2A46",cupcup:"\u2A4A",cupdot:"\u228D",cupor:"\u2A45",cups:"\u222A\uFE00",curarrm:"\u293C",curlyeqprec:"\u22DE",curlyeqsucc:"\u22DF",curren:"\u00A4",curvearrowleft:"\u21B6",curvearrowright:"\u21B7",cuvee:"\u22CE",cuwed:"\u22CF",cwconint:"\u2232",cwint:"\u2231",cylcty:"\u232D"});MathJax.Ajax.loadComplete(a.entityDir+"/c.js")})(MathJax.InputJax.MathML);
CrossEye/cdnjs
ajax/libs/mathjax/2.4.0/jax/input/MathML/entities/c.js
JavaScript
mit
2,294
CKEDITOR.plugins.setLang("specialchar","ku",{euro:"نیشانه‌ی یۆرۆ",lsquo:"نیشانه‌ی فاریزه‌ی سه‌رووژێری تاکی چه‌پ",rsquo:"نیشانه‌ی فاریزه‌ی سه‌رووژێری تاکی ڕاست",ldquo:"نیشانه‌ی فاریزه‌ی سه‌رووژێری دووهێنده‌ی چه‌پ",rdquo:"نیشانه‌ی فاریزه‌ی سه‌رووژێری دووهێنده‌ی ڕاست",ndash:"ته‌قه‌ڵی کورت",mdash:"ته‌قه‌ڵی درێژ",iexcl:"نیشانه‌ی هه‌ڵه‌وگێڕی سه‌رسوڕمێنه‌ر",cent:"نیشانه‌ی سه‌نت",pound:"نیشانه‌ی پاوه‌ند",curren:"نیشانه‌ی دراو",yen:"نیشانه‌ی یه‌نی ژاپۆنی",brvbar:"شریتی ئه‌ستوونی پچڕاو",sect:"نیشانه‌ی دوو s له‌سه‌ریه‌ك",uml:"خاڵ",copy:"نیشانه‌ی مافی چاپ",ordf:"هێڵ له‌سه‌ر پیتی a",laquo:"دوو تیری به‌دووایه‌کی چه‌پ",not:"نیشانه‌ی نه‌خێر",reg:"نیشانه‌ی R له‌ناو بازنه‌دا",macr:"ماکڕوون",deg:"نیشانه‌ی پله",sup2:"سه‌رنووسی دوو",sup3:"سه‌رنووسی سێ",acute:"لاری تیژ",micro:"نیشانه‌ی u لق درێژی چه‌پی خواروو",para:"نیشانه‌یپه‌ڕه‌گراف",middot:"ناوه‌ڕاستی خاڵ",cedil:"نیشانه‌ی c ژێر چووکره‌",sup1:"سه‌رنووسی یه‌ك",ordm:"هێڵ له‌ژێر پیتی o",raquo:"دوو تیری به‌دووایه‌کی ڕاست",frac14:"یه‌ك له‌سه‌ر چووار",frac12:"یه‌ك له‌سه‌ر دوو",frac34:"سێ له‌سه‌ر چووار",iquest:"هێمای هه‌ڵه‌وگێری پرسیار",Agrave:"پیتی لاتینی A-ی گه‌وره‌ له‌گه‌ڵ ڕوومه‌تداری لار",Aacute:"پیتی لاتینی A-ی گه‌وره‌ له‌گه‌ڵ ڕوومه‌تداری تیژ",Acirc:"پیتی لاتینی A-ی گه‌وره‌ له‌گه‌ڵ نیشانه‌ له‌سه‌ری",Atilde:"پیتی لاتینی A-ی گه‌وره‌ له‌گه‌ڵ زه‌ڕه‌",Auml:"پیتی لاتینی A-ی گه‌وره‌ له‌گه‌ڵ نیشانه‌ له‌سه‌ری",Aring:"پیتی لاتینی گه‌وره‌ی Å",AElig:"پیتی لاتینی گه‌وره‌ی Æ",Ccedil:"پیتی لاتینی C-ی گه‌وره‌ له‌گه‌ڵ ژێر چووکره‌",Egrave:"پیتی لاتینی E-ی گه‌وره‌ له‌گه‌ڵ ڕوومه‌تداری لار",Eacute:"پیتی لاتینی E-ی گه‌وره‌ له‌گه‌ڵ ڕوومه‌تداری تیژ",Ecirc:"پیتی لاتینی E-ی گه‌وره‌ له‌گه‌ڵ نیشانه‌ له‌سه‌ری",Euml:"پیتی لاتینی E-ی گه‌وره‌ له‌گه‌ڵ نیشانه‌ له‌سه‌ری",Igrave:"پیتی لاتینی I-ی گه‌وره‌ له‌گه‌ڵ ڕوومه‌تداری لار",Iacute:"پیتی لاتینی I-ی گه‌وره‌ له‌گه‌ڵ ڕوومه‌تداری تیژ",Icirc:"پیتی لاتینی I-ی گه‌وره‌ له‌گه‌ڵ نیشانه‌ له‌سه‌ری",Iuml:"پیتی لاتینی I-ی گه‌وره‌ له‌گه‌ڵ نیشانه‌ له‌سه‌ری",ETH:"پیتی لاتینی E-ی گه‌وره‌ی",Ntilde:"پیتی لاتینی N-ی گه‌وره‌ له‌گه‌ڵ زه‌ڕه‌",Ograve:"پیتی لاتینی O-ی گه‌وره‌ له‌گه‌ڵ ڕوومه‌تداری لار",Oacute:"پیتی لاتینی O-ی گه‌وره‌ له‌گه‌ڵ ڕوومه‌تداری تیژ",Ocirc:"پیتی لاتینی O-ی گه‌وره‌ له‌گه‌ڵ نیشانه‌ له‌سه‌ری",Otilde:"پیتی لاتینی O-ی گه‌وره‌ له‌گه‌ڵ زه‌ڕه‌",Ouml:"پیتی لاتینی O-ی گه‌وره‌ له‌گه‌ڵ نیشانه‌ له‌سه‌ری",times:"نیشانه‌ی لێکدان",Oslash:"پیتی لاتینی گه‌وره‌ی Ø له‌گه‌ڵ هێمای دڵ وه‌ستان",Ugrave:"پیتی لاتینی U-ی گه‌وره‌ له‌گه‌ڵ ڕوومه‌تداری لار",Uacute:"پیتی لاتینی U-ی گه‌وره‌ له‌گه‌ڵ ڕوومه‌تداری تیژ",Ucirc:"پیتی لاتینی U-ی گه‌وره‌ له‌گه‌ڵ نیشانه‌ له‌سه‌ری",Uuml:"پیتی لاتینی U-ی گه‌وره‌ له‌گه‌ڵ نیشانه‌ له‌سه‌ری",Yacute:"پیتی لاتینی Y-ی گه‌وره‌ له‌گه‌ڵ ڕوومه‌تداری تیژ",THORN:"پیتی لاتینی دڕکی گه‌وره",szlig:"پیتی لاتنی نووك تیژی s",agrave:"پیتی لاتینی a-ی بچووك له‌گه‌ڵ ڕوومه‌تداری لار",aacute:"پیتی لاتینی a-ی بچووك له‌گه‌ڵ ڕوومه‌تداری تیژ",acirc:"پیتی لاتینی a-ی بچووك له‌گه‌ڵ نیشانه‌ له‌سه‌ری",atilde:"پیتی لاتینی a-ی بچووك له‌گه‌ڵ زه‌ڕه‌",auml:"پیتی لاتینی a-ی بچووك له‌گه‌ڵ نیشانه‌ له‌سه‌ری",aring:"پیتی لاتینی å-ی بچووك",aelig:"پیتی لاتینی æ-ی بچووك",ccedil:"پیتی لاتینی c-ی بچووك له‌گه‌ڵ ژێر چووکره‌",egrave:"پیتی لاتینی e-ی بچووك له‌گه‌ڵ ڕوومه‌تداری لار",eacute:"پیتی لاتینی e-ی بچووك له‌گه‌ڵ ڕوومه‌تداری تیژ",ecirc:"پیتی لاتینی e-ی بچووك له‌گه‌ڵ نیشانه‌ له‌سه‌ری",euml:"پیتی لاتینی e-ی بچووك له‌گه‌ڵ نیشانه‌ له‌سه‌ری",igrave:"پیتی لاتینی i-ی بچووك له‌گه‌ڵ ڕوومه‌تداری لار",iacute:"پیتی لاتینی i-ی بچووك له‌گه‌ڵ ڕوومه‌تداری تیژ",icirc:"پیتی لاتینی i-ی بچووك له‌گه‌ڵ نیشانه‌ له‌سه‌ری",iuml:"پیتی لاتینی i-ی بچووك له‌گه‌ڵ نیشانه‌ له‌سه‌ری",eth:"پیتی لاتینی e-ی بچووك",ntilde:"پیتی لاتینی n-ی بچووك له‌گه‌ڵ زه‌ڕه‌",ograve:"پیتی لاتینی o-ی بچووك له‌گه‌ڵ ڕوومه‌تداری لار",oacute:"پیتی لاتینی o-ی بچووك له‌گه‌ڵ ڕوومه‌تداری تیژ",ocirc:"پیتی لاتینی o-ی بچووك له‌گه‌ڵ نیشانه‌ له‌سه‌ری",otilde:"پیتی لاتینی o-ی بچووك له‌گه‌ڵ زه‌ڕه‌",ouml:"پیتی لاتینی o-ی بچووك له‌گه‌ڵ نیشانه‌ له‌سه‌ری",divide:"نیشانه‌ی دابه‌ش",oslash:"پیتی لاتینی گه‌وره‌ی ø له‌گه‌ڵ هێمای دڵ وه‌ستان",ugrave:"پیتی لاتینی u-ی بچووك له‌گه‌ڵ ڕوومه‌تداری لار",uacute:"پیتی لاتینی u-ی بچووك له‌گه‌ڵ ڕوومه‌تداری تیژ",ucirc:"پیتی لاتینی u-ی بچووك له‌گه‌ڵ نیشانه‌ له‌سه‌ری",uuml:"پیتی لاتینی u-ی بچووك له‌گه‌ڵ نیشانه‌ له‌سه‌ری",yacute:"پیتی لاتینی y-ی بچووك له‌گه‌ڵ ڕوومه‌تداری تیژ",thorn:"پیتی لاتینی دڕکی بچووك",yuml:"پیتی لاتینی y-ی بچووك له‌گه‌ڵ نیشانه‌ له‌سه‌ری",OElig:"پیتی لاتینی گه‌وره‌ی پێکه‌وه‌نووسراوی OE",oelig:"پیتی لاتینی بچووکی پێکه‌وه‌نووسراوی oe",372:"پیتی لاتینی W-ی گه‌وره‌ له‌گه‌ڵ نیشانه‌ له‌سه‌ری",374:"پیتی لاتینی Y-ی گه‌وره‌ له‌گه‌ڵ نیشانه‌ له‌سه‌ری",373:"پیتی لاتینی w-ی بچووکی له‌گه‌ڵ نیشانه‌ له‌سه‌ری",375:"پیتی لاتینی y-ی بچووکی له‌گه‌ڵ نیشانه‌ له‌سه‌ری",sbquo:"نیشانه‌ی فاریزه‌ی نزم",8219:"نیشانه‌ی فاریزه‌ی به‌رزی پێچه‌وانه",bdquo:"دوو فاریزه‌ی ته‌نیش یه‌ك",hellip:"ئاسۆیی بازنه",trade:"نیشانه‌ی بازرگانی",9658:"ئاراسته‌ی ڕه‌شی ده‌ستی ڕاست",bull:"فیشه‌ك",rarr:"تیری ده‌ستی ڕاست",rArr:"دووتیری ده‌ستی ڕاست",hArr:"دوو تیری ڕاست و چه‌پ",diams:"ڕه‌شی پاقڵاوه‌یی",asymp:"نیشانه‌ی یه‌کسانه"});
Mrkebubun/cdnjs
ajax/libs/ckeditor/4.0.1/plugins/specialchar/dialogs/lang/ku.min.js
JavaScript
mit
8,590