9 |
10 | ## 2. Usage
11 |
12 | ### 2.1 Data Source
13 |
14 | #### 2.1.1 Get a list
15 |
16 | ```
17 | D("user").get() //get user list
18 | D("user").get({name:"Gilgamesh"}) //get user list with parameters
19 | ```
20 |
21 | #### 2.1.2 Get a certain object
22 |
23 | ```
24 | //id can be replace by any name you defined as primary key
25 | D("user").get({id:1})
26 | D("user").get(1)
27 | ```
28 |
29 | #### 2.1.3 Create a new object and save it
30 |
31 | ```
32 | var newUser = D("user").new()
33 | newUser.name = "me"
34 | newUser.save()
35 | ```
36 |
37 | #### 2.1.4 Publish data with a name
38 |
39 | ```
40 | D("user").get(id).publish("global.user")
41 | D("user").receive("global.user")
42 | ```
43 |
44 | #### 2.1.5 Available data status and methods
45 |
46 | ```
47 | $$filled //is data filled from ajax data
48 | $$valid //need method validate implemented
49 | $$dirty //is data changed?
50 | $$empty //is data equal to undefined, null, or "".
51 | $$validating
52 | $$validated
53 | $$saving
54 | $$saved
55 | $$actions //map of current action status. example: {"saving":false,"saved":"true","deleting":true}
56 | ```
57 |
58 | ```
59 | .validate() //need to be validate manually
60 | .delete()
61 | .save()
62 | .watch("attribute", callback) //watch certain attribute
63 | .watch(callback) //watch object
64 | .notify() //manualy call watch callbacks
65 | ```
66 |
67 | #### 2.1.6 Execute actions
68 |
69 | Actions will generate `PUT` http request with url "/{id}/{action}". Example:
70 |
71 | ```
72 | D("user").get(id).action("doSomething")({/*parameters*/})
73 | ```
74 |
75 | Batch Actions example:
76 | ```
77 | D("user").get({name:"Gilgamesh"}.action("batchAction")(params).
78 |
79 | D("user").get({name:"Gilgamesh"}.filter("id",[ids]).action("batchAction")(params).
80 |
81 | //or you can use it via DataSource directly. The difference is that actions on
82 | //collection will change the status of current collection.
83 | D("user").action("batchAction")(params)
84 | ```
85 |
86 | #### 2.1.7 Overwrite an action
87 |
88 | ```
89 | D("user").action("doSomething",function( instanceOrCollections, params, dataSource ){
90 | //return setting to overwrite default ajax settings
91 | return {
92 | url : "/url",
93 | method : "POST",
94 | data : {}
95 | success : function( res ){
96 | dataSource.parse(res)
97 | }
98 | }
99 | })
100 | ```
101 |
102 |
103 | ### 2.2 Element
104 |
105 | #### 2.2.1 Use it with Data Source
106 |
107 |
108 |
109 | name :
110 | gender :
111 | save
112 |
113 |
114 | #### 2.2.2 Use template overwrite
115 |
116 | First, use `component` instead of `directive`:
117 |
118 | ```
119 | .component("userCardForm", function(){
120 | return {
121 | //require : "gmSource",
122 | priority : 98,
123 | template:
124 | ' '+
125 | ' '+
126 | ' '+
127 | '
'+
128 | ' save '
129 | link : function( $scope, $el, $attrs){
130 | console.log("watch $$saved")
131 | $scope.user.watch("$$saved", function( saved ){
132 | if( saved ){
133 | try{
134 | if($el.attr('onSubmit') ) (new Function( $el.attr('onSubmit')))()
135 | console.log( $el.attr('onSubmit'))
136 | console.log( "on submit", saved)
137 |
138 | }catch(e){
139 | console.log( e )
140 | }
141 | }
142 | })
143 | }
144 | }
145 | })
146 | ```
147 |
148 | Secondly, overwrite template with child element:
149 |
150 |
151 | name :
152 | gender :
153 |
save
154 |
saving : {{user.$$saving}}
155 |
saved : {{user.$$saved}}
156 |
157 |
158 | #### 2.2.3 Overwrite part of template
159 |
160 | As you may notice that a extra attribute `gm-role` was added to child element of directive `user-card-form`. We can do partial overwriting with `gm-tpl` set to `include`:
161 |
162 |
163 |
164 | only changed button
165 |
166 |
167 | What if you only want to exclude certain part? For instance, We can exlude the save button like:
168 |
169 |
170 |
171 | #### 2.2.4 Import child element from a directive
172 |
173 | Magic here, We can break the fence of html structure. Surpose we need to place the save button outside the `user-card-form` due to some insane reason, we simply do:
174 |
175 | save from outside
176 |
177 |
178 | `gm-import` is used to specify the id of which element you want to import from, and `gm-role` is used to identify the import part.
179 |
180 | #### 2.2.5 Import directive's scope
181 |
182 | In some cases interaction between directives requires a lot of api or event, and sharing scope would make it much easier. We cant still use `gm-import` to do that.
183 |
184 | {{user.name}}
185 |
186 |
187 | #### 2.2.6 Component extend
188 |
189 | Extending a exist component is easy:
190 |
191 | ```
192 | .component("userCardForm", function(){
193 | return {
194 | extend : "otherComponent",
195 | link : function( $scope, $el, $attrs){
196 | //parent link function will apply first
197 | }
198 | }
199 | })
200 | ```
201 |
202 | Waht happend in the background is that parent component link function will apply on the same scope and element. So public method or event listenner will be inherited.
203 |
204 | #### 2.2.7 Element event listener
205 |
206 | ```
207 | //HTML markup
208 |
209 |
210 |
211 | .component("userCardForm", function(){
212 | return {
213 | link : function( $scope, $el, $attrs){
214 | var e = new Event("submit")
215 | $el[0].dipatchEvent(e)
216 | }
217 | }
218 | })
219 | ```
220 |
221 | ## 3. Conventions
222 |
223 | ### 3.1 Expose api on element
224 |
225 | Api should be exposed on element.
226 |
227 | ### 3.2 Use gm-src on the right element
228 |
229 | We provided various ways like role-based element import for cases require scope or method sharing, please use it instead of lifting angular scope.
230 |
231 | ### 3.3 Invoke callbacks and trigger event like build-in element
232 |
233 | As title says, for example, implementing attribute `onSubmit` on a custom form would be the right way to invoke callback.
234 |
235 | ## 4. Demo
236 |
237 | ### 4.1 How to use a modal to wrap a form.
238 |
239 | **Directives**
240 |
241 | ```
242 | .component( "myModal", function(){
243 | return {
244 | link : function( $scope, $el, $attrs ){
245 | $el.css({/*your modal css*/})
246 |
247 | $el[0].open = function(){
248 | $el.show()
249 | }
250 |
251 | $el[0].hide = function(){
252 | console.log("closing")
253 | $el.hide()
254 | }
255 |
256 | $el.hide()
257 | }
258 | }
259 | })
260 | ```
261 |
262 | ```
263 | .component("userCardForm", function(){
264 | return {
265 | template:
266 | ''+
267 | ' '+
268 | ' '+
269 | '
'+
270 | 'save ',
271 | link : function( $scope, $el, $attrs){
272 | $scope.user.watch("$$saved", function( saved ){
273 | saved && $el.attr('onSubmit') ) && (new Function( $el.attr('onSubmit')))()
274 | })
275 | }
276 | }
277 | })
278 | ```
279 |
280 | **HTML**
281 |
282 | open modal
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 | save
292 |
293 |
294 |
295 |
296 | ### 4.2 A custom element explaining `gm-import`
297 |
298 |
299 |
300 | ## 5. Todo
301 |
302 | - [ ] Polymer support
303 | - [ ] React support
304 | - [x] Event system
--------------------------------------------------------------------------------
/src/DataSource.js:
--------------------------------------------------------------------------------
1 | var util = require("./util.js")
2 | var DataObject = require("./DataObject.js")
3 | var DataArray = require("./DataArray")
4 | //var $ = require("../libs/jquery-1.11.1.min.js")
5 |
6 | function DataSource( name, def ){
7 | //caution, cloneDeep may change function to object if not using custom callback
8 |
9 | var config = util.cloneDeep( DataSource.prototype.config )
10 | util.extend( this, util.merge( config, def, true ) )
11 | this.name = name
12 | }
13 |
14 | //allow overwrite
15 | DataSource.prototype.config = {
16 | url : {
17 | base : "",
18 | collection : function(name){return "/" + name+"/{action}"},
19 | single: function(name){return "/" + name+"/{id}/{action}"}
20 | },
21 | pk : "id", //TODO allow array
22 | publicDataSources : {},
23 | publicDataSourceProxies : {},
24 | actions : {
25 | save : function( instance, params, dataSource ){
26 | return {
27 | url : dataSource.makeUrl( {id:instance.id} ),
28 | method : util.isUndefined( instance[dataSource.pk] ) ? "POST" : "PUT",
29 | data : util.extend( instance.toObject(), params)
30 | }
31 | },
32 | delete: function( instance, params, dataSource ){
33 | return {
34 | url : dataSource.makeUrl( {id:instance.id} ) ,
35 | method : "DELETE",
36 | data : params
37 | }
38 | }
39 | },
40 | singular : function( item, doNotWatch ){
41 | if( !doNotWatch){
42 | item.$$collection.watchItem( item )
43 | }
44 | return item
45 | },
46 | interceptors : {
47 | "get" : [],
48 | "query" : [],
49 | "parse" : [],
50 | "action" : {
51 |
52 | }
53 | }
54 | }
55 |
56 | DataSource.prototype.query = function( settings ){
57 | var queryInterceptors = [].concat( this.interceptors.query)
58 | queryInterceptors.forEach(function(interceptor){
59 | interceptor( settings )
60 | })
61 | return $.ajax(settings)
62 | }
63 |
64 | DataSource.prototype.parse = function( data ){
65 | return data
66 | }
67 |
68 | DataSource.prototype.interpolate = function( text, obj ){
69 | return text.replace(/(\{\w+\})/g, function( m ){ return obj[m.slice(1,m.length-1)] || "" })
70 | }
71 |
72 | DataSource.prototype.makeUrl = function( params ){
73 | var url = (this.url.base +
74 | util.result(
75 | this.hasPrimaryKey(params )
76 | ? this.url.single
77 | : this.url.collection,
78 | this.name,
79 | params
80 | ))
81 |
82 | return this.interpolate( url, params).replace(/\/+\s*$/,"").replace(/\/{2,}/,"/")
83 | }
84 |
85 |
86 | DataSource.prototype.hasPrimaryKey = function( params ){
87 | return !util.isObject( params ) || util.difference( [].concat(this.pk), Object.keys(params)).length == 0
88 | }
89 |
90 |
91 | //we need to extract primary key from params
92 | DataSource.prototype.makeQuery = function( params){
93 | var result = util.clone(util.isObject(params)?params:{})
94 | util.forEach([].concat(this.pk), function(r){
95 | delete result[r]
96 | })
97 | return result
98 | }
99 |
100 | DataSource.prototype.makeData = function( data ){
101 | var result = util.cloneDeep(data)
102 | util.forEach(result, function(v, k){
103 | if(util.isFunction(v) || /^\$\$/.test(k) ) delete result[k]
104 | })
105 | return result
106 | }
107 |
108 |
109 |
110 | DataSource.prototype.get = function( params, instanceOrCollection ){
111 | params = params ? (util.isObject(params) ? params : util.zipObject([this.pk],[params]) ) : {}
112 | var root = this
113 | var config = {dataSource:root}
114 | if( !instanceOrCollection ){
115 | instanceOrCollection = this.hasPrimaryKey(params) ? new DataObject(config) : new DataArray(config, params)
116 | }
117 |
118 | var settings = {url:this.makeUrl(params),type:"GET",data:this.makeQuery(params)}
119 | var isSingle = root.hasPrimaryKey(params)
120 |
121 | var getInterceptors = [].concat( root.interceptors.get )
122 | getInterceptors.forEach(function(interceptor){
123 | interceptor( settings, isSingle )
124 | })
125 |
126 | this.query( settings ).then(function( res ){
127 | var parseInterceptors = [].concat( root.interceptors.parse )
128 | parseInterceptors.forEach(function(interceptor){
129 | res = interceptor( res, isSingle, settings )
130 | })
131 |
132 | instanceOrCollection.set( res )
133 | })
134 |
135 | return instanceOrCollection
136 | }
137 |
138 | DataSource.prototype.new = function( data ){
139 | var object = new DataObject({dataSource:this})
140 | object.definePrivateProp("$$new", true)
141 | if( data ) object.set(data)
142 | return object
143 | }
144 |
145 | DataSource.prototype.newArray = function( data, params ){
146 | var object = new DataArray({dataSource:this}, params||{})
147 | object.definePrivateProp("$$new", true)
148 |
149 | if( data ){
150 | if( util.isFunction(data.then) ){
151 | //promise
152 | data.then(function( resolvedData ){
153 | object.set( resolvedData )
154 | })
155 | }else{
156 | object.set(data)
157 | }
158 | }
159 | return object
160 | }
161 |
162 | DataSource.prototype.recycle = function( name ){
163 | if( this.publicDataSources[name] ) delete this.publicDataSources[name]
164 | if( this.publicDataSourceProxies[name] ) this.publicDataSourceProxies[name].destroy()
165 | }
166 |
167 | DataSource.prototype.publish = function( instance, name ){
168 | if( !instance ){
169 | throw new Error("cannot publish undefined", name)
170 | }
171 |
172 | this.publicDataSources[name] = instance
173 |
174 | if( this.publicDataSourceProxies[name] ){
175 | this.makePublicProxy( name, instance, this.publicDataSourceProxies[name] )
176 | }else{
177 | this.publicDataSourceProxies[name] = this.makePublicProxy( name, instance )
178 | }
179 |
180 | console.log("publishing",this.publicDataSourceProxies[name])
181 | return this.publicDataSourceProxies[name]
182 | }
183 |
184 | DataSource.prototype.makePublicProxy = function( name, instance, proxy ){
185 | var root =this
186 |
187 | if( !proxy ){
188 | if( instance instanceof DataObject || util.isNaiveObject(instance) ){
189 | proxy = new DataObject({dataSource:this})
190 | }else{
191 | proxy = new DataArray({dataSource:this})
192 | }
193 | }
194 |
195 | if( proxy.$$filled ){
196 | if( proxy instanceof DataArray ){
197 | proxy.splice(0)
198 | }else{
199 | for( var i in proxy ){
200 | delete proxy[i]
201 | }
202 | }
203 | }
204 |
205 | if( proxy instanceof DataArray ){
206 | var _proxy = []
207 | root.defineProxyProperties(name, instance, _proxy)
208 | proxy.set(_proxy)
209 | }else{
210 | root.defineProxyProperties(name, instance, proxy)
211 | }
212 |
213 | proxy.changePropAndNotify("$$filled",true)
214 |
215 | return proxy
216 | }
217 |
218 | DataSource.prototype.defineProxyProperties = function( name, instance , proxy){
219 | var root = this
220 | util.forOwn( instance, function( value, i){
221 | if( typeof instance[i] !== "function"){
222 | Object.defineProperty( proxy, i, {
223 | enumerable : true,
224 | configurable: true,
225 | get : function(){
226 | return root.publicDataSources[name][i]
227 | },
228 | set : function( newValue ){
229 | root.publicDataSources[name][i] = newValue
230 | return newValue
231 | }
232 | })
233 | }
234 | })
235 | return proxy
236 | }
237 |
238 |
239 | DataSource.prototype.receive = function(name){
240 | return this.publicDataSourceProxies[name]
241 | }
242 |
243 | DataSource.prototype.receiveObject = function(name){
244 | if( !this.publicDataSourceProxies[name] ){
245 | this.publicDataSourceProxies[name] = new DataObject({dataSource:this})
246 | }
247 |
248 | return this.publicDataSourceProxies[name]
249 | }
250 |
251 | DataSource.prototype.receiveArray = function(name){
252 | var obj
253 | if( this.publicDataSourceProxies[name] ){
254 | obj = this.publicDataSourceProxies[name]
255 | }else{
256 | this.publicDataSourceProxies[name] = obj = new DataArray({dataSource:this})
257 | }
258 |
259 | return obj
260 | }
261 |
262 | DataSource.prototype.generateAction = function( action ){
263 | var root = this
264 | return function( instanceOrCollections, params ){
265 | var def = util.isFunction(root.actions[action]) ?
266 | root.actions[action](instanceOrCollections,params,root) :
267 | util.isObject( root.actions[action] ) ?
268 | root.actions[action] : {}
269 |
270 |
271 | var isBatch = instanceOrCollections instanceof DataArray
272 | var settings = util.defaults( def ||{}, {
273 | url : root.makeUrl({id:instanceOrCollections.id,action:action}),
274 | method : "PUT",
275 | data : util.extend( isBatch? util.zipObject([root.pk], [instanceOrCollections.pluck("id") ]):{}, params)
276 | })
277 |
278 |
279 | return root.query(settings).then(function( res ){
280 | if( root.interceptors.action[action] ){
281 | root.interceptors.action[action].forEach(function(interceptor){
282 | res = interceptor(res, settings)
283 | })
284 | }
285 | return res
286 | })
287 | }
288 | }
289 |
290 | DataSource.prototype.action = function( action, defFn ){
291 | if( defFn ){
292 | this.actions[action] = defFn
293 | }
294 | return this.generateAction(action).bind(this)
295 | }
296 |
297 |
298 |
299 | DataSource.prototype.save = function( instance){
300 | return this.action("save")(instance)
301 | }
302 |
303 | DataSource.prototype.delete = function( instance){
304 | return this.action("delete")(instance)
305 | }
306 |
307 | module.exports = DataSource
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
65 |
66 |
67 |
68 | Gilgamesh
69 |
70 |
71 | Gilgamesh is a collection of useful plugins and extensions of AngularJS( Polymer version is coming soon)
72 | to help you build modern web application. This demo page only shows the magic of element extensions. For
73 | more information please visit
http://github.com/sskyy/Gilgamesh .
74 |
75 |
76 |
77 |
78 |
1. Original Component
79 |
80 | This is the basic component(directive) we will use to explain the features of Gilgamesh.
81 | You may notice that a new method named `component` is attached to angular. Consider it a `directive` decorator
82 | which is compatible with the origin directive usage, but with more functionality.
83 |
84 |
85 | angular.module("demo",["Gilgamesh"])
86 | .component("userCardForm", function(){
87 | return {
88 | templateUrl : "/Gilgamesh/adapters/angular/components/user-card-form.html",
89 | link : function( $scope, $el){
90 | }
91 | }
92 | })
93 |
94 |
95 |
96 |
97 |
98 |
99 | save
100 | delete
101 | ally to
102 |
103 |
status:
104 |
105 |
106 | {{name}}:{{status}}
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
117 |
118 |
119 |
120 |
2. Total Overwrite
121 |
122 | Using `component` enables you to overwrite template at runtime with simply add write what you want as child element.
123 |
124 |
125 |
126 | name :
127 | gender :
128 |
save also
129 |
save : {{user.$$actions.save}}
130 |
131 |
132 |
133 |
134 | name :
135 | gender :
136 |
save also
137 |
save : {{user.$$actions.save}}
138 |
139 |
140 |
141 |
142 |
143 |
144 |
3. Partial overwrite
145 |
146 | Sometime total overwrite is too verbose when you only want to change a small part of the original template.
147 | `gm-tpl-partial` and `gm-role` can save you from that. First, add `gm-role` to the part of which may be overwrite just
148 | like we did in the example component template above. Then add `gm-tpl-partial` to the element and use `gm-role` to specify
149 | which part you want to overwrite in the child element.
150 |
151 |
152 |
153 | only changed button
154 |
155 |
156 |
157 |
158 | only changed button
159 |
160 |
161 |
162 |
163 |
164 |
4. Partial include
165 |
166 | The combination of `gm-tpl-include` and `gm-role` is used to include particular part of template.
167 |
168 |
169 |
172 |
173 |
178 |
179 |
180 |
181 |
182 |
5. Partial Exclude
183 |
184 | `gm-tpl-exclude` is used to exclude part of the template.
185 |
186 |
187 | open modal
188 |
189 |
190 |
193 |
194 |
195 |
196 |
197 |
open modal
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
6. Import Elements
208 |
209 | This feature brings the reusability of component to the next level by breaking down the boundary of component with `gm-import` and `gm-from-role`.
210 | You can now use part of a component anywhere. Take a look the examples below to see how we import part of the basic component.
211 |
212 |
213 |
6.1 Import Scope
214 |
215 | Use the basic component to change user name and check out the result here.
216 |
217 |
218 | user.name:{{user.name}}
219 |
220 |
221 |
user.name:{{user.name}}
222 |
223 |
224 |
225 |
6.2 Import Role-Element
226 |
227 | Click the save button of the basic component and check out the result here.
228 |
229 |
230 |
231 |
232 |
235 |
236 |
6.3 Import Overwrote Role-Element
237 |
238 | Imported element can be overwrote as well.
239 | Click the save button of the basic component and check out the result here.
240 |
241 |
242 |
243 |
STATUS:
244 |
245 |
246 | {{name}}==={{status}}
247 |
248 |
249 |
250 |
251 |
252 |
253 |
STATUS:
254 |
255 |
256 | {{name}}==={{status}}
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
7. Event Listener
266 |
267 | Dealing with element event has never been easier than using Gilgamesh. Let the code speak for itself, only remember if you want
268 | use a scope method on as event listener, use `scope-on-` instead of `on-`.
269 |
270 |
271 | angular.module("demo")
272 | .component("modal",function(){
273 | return {
274 | link : function( $scope, $el){
275 | $el[0].open = function(){
276 | $el[0].style.display = "block"
277 | $el[0].dispatchEvent(new Event("open"))
278 | console.log("event fired")
279 | }
280 |
281 | $el[0].hide = function(){
282 | $el[0].dispatchEvent(new Event("hide"))
283 | }
284 |
285 | $el[0].hide()
286 | }
287 | }
288 | })
289 |
290 |
291 | open modal and trigger open event
292 |
293 |
294 | This modal has a listener on open event.
295 |
296 |
297 |
298 |
299 | open modal and trigger open event
300 |
301 |
302 | This modal has a listener on open event.
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
8. Component Inherit
312 |
313 | Component's behavior and public method can be inherit easily like code below:
314 |
315 |
316 | angular.module("demo")
317 | .component("modalExtra",function(){
318 | return {
319 | extend : 'modal',
320 | link : function( $scope, $el){
321 | //will automatically inherit modal's open method
322 | }
323 | }
324 | })
325 |
326 |
327 | open modal-extra and trigger open event
328 |
333 |
334 |
335 | open modal-extra and trigger open event
336 |
341 |
342 |
343 |
344 |
345 |
346 |
347 |
348 |
349 |
350 |
351 |
375 |
376 |
--------------------------------------------------------------------------------
/adapters/angular/adapter.js:
--------------------------------------------------------------------------------
1 | (function(global){
2 |
3 | /*
4 | * tools
5 | */
6 |
7 | var FN_ARGS = /^function\s*[^\(]*\(\s*([^\)]*)\)/m;
8 | var FN_ARG_SPLIT = /,/;
9 | var FN_ARG = /^\s*(_?)(\S+?)\1\s*$/;
10 | var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
11 |
12 | function annotate (fn) {
13 | var $inject = [];
14 | fn = fn.toString();
15 | var first = fn.replace(STRIP_COMMENTS, '');
16 | var second = first.match(FN_ARGS)[1];
17 | var third = second.split(FN_ARG_SPLIT);
18 | third.forEach(function (arg) {
19 | arg.replace(FN_ARG, function (all, underscore, name) {
20 | $inject.push(name);
21 | });
22 | });
23 | return $inject;
24 | }
25 |
26 | function replaceEmptyInnerHTML( $target, $source ){
27 | if( isEmptyInnerHTML($target) ){
28 | $target.innerHTML = $source.innerHTML
29 | }
30 | }
31 |
32 | function replaceSourceInnerHTML( $target, $source ){
33 | if( !isEmptyInnerHTML($source) ){
34 | $target.innerHTML = $source.innerHTML
35 | }
36 | }
37 |
38 | function isEmptyInnerHTML( el ){
39 | return /^\s*$/.test( el.innerHTML)
40 | }
41 |
42 | function replaceWith( toReplace, target){
43 | var parent = target.parentNode
44 | parent.replaceChild( toReplace, target)
45 | }
46 |
47 | function removeElement( el ){
48 | el.parentNode.removeChild(el)
49 | return el
50 | }
51 |
52 | function replaceInnerHTML( toReplace, target){
53 | target.innerHTML = toReplace.innerHTML
54 | }
55 |
56 | function mergeArray( target, source ){
57 | for( var i in source){
58 | if( target.indexOf( source[i]) == -1 ){
59 | target.push( source[i])
60 | }
61 | }
62 | return target
63 | }
64 |
65 | function mergeEl( target, source ){
66 | for( var i in source.attributes ){
67 | if( source.attributes[i].nodeName
68 | && target.getAttribute(source.attributes[i].nodeName) === null
69 | && source.attributes[i].nodeName !== "class"
70 | && source.attributes[i].nodeName !== "style" ){
71 |
72 |
73 | target.setAttribute(source.attributes[i].nodeName,source.attributes[i].value )
74 | }
75 | }
76 |
77 | target.className = mergeArray( target.className.split(" "), source.className.split(" ")).join(" ")
78 | return target
79 | }
80 |
81 | /*
82 | * compile overwrite
83 | */
84 |
85 | global._CACHE_ID = -1
86 | global._CACHE_ATTRIBUTE = "gm-child-cache-id"
87 | global._ORIGIN_ELEMENT_CACHE = {}
88 | global._GM_DIRECTIVE_NAMES = []
89 | global._CACHED_URL = {}
90 |
91 | angular.module("Gilgamesh",[])
92 | .config(["$compileProvider","$httpProvider",function( $compileProvider, $httpProvider){
93 |
94 | var $httpFactory = $httpProvider.$get[$httpProvider.$get.length -1]
95 |
96 | $httpProvider.$get[$httpProvider.$get.length -1] = function($httpBackend, $browser, $cacheFactory, $rootScope, $q, $injector){
97 |
98 | var $http = $httpFactory($httpBackend, $browser, $cacheFactory, $rootScope, $q, $injector)
99 |
100 | var _get = $http.get
101 | $http.get = function(url, config){
102 | var promise = _get( url, config).then(function(res){
103 | var container
104 |
105 | if( !global._CACHED_URL[url] && /html?$/.test(url) ){
106 | container= $("
").append(res.data)[0]
107 |
108 | global._GM_DIRECTIVE_NAMES.forEach(function(name){
109 | angular.forEach( container.querySelectorAll("["+name.replace(/([A-Z])/g,"-$1").toLowerCase()+"]"), function( el ){
110 | if( el.getAttribute(global._CACHE_ATTRIBUTE) !== null ) return
111 | global._CACHE_ID++
112 | global._ORIGIN_ELEMENT_CACHE[global._CACHE_ID] = el
113 | el.setAttribute(global._CACHE_ATTRIBUTE,global._CACHE_ID)
114 | })
115 | })
116 |
117 | global._CACHED_URL[url] = container.innerHTML
118 | res.data = global._CACHED_URL[url]
119 | }
120 |
121 | return res
122 | })
123 |
124 | //overwrite
125 | promise.success = function( fn ){
126 | promise.then(function(response) {
127 | fn(response.data, response.status, response.headers, config);
128 | });
129 | return promise
130 | }
131 |
132 | promise.error = function( fn ){
133 | promise.then(null,function(response) {
134 | fn(response.data, response.status, response.headers, config);
135 | });
136 | return promise
137 | }
138 |
139 | return promise
140 | }
141 |
142 | return $http
143 | }
144 | }])
145 | .run(["$rootScope",function($rootScope){
146 | $rootScope.D = D
147 | $rootScope.E = E
148 | $rootScope.Ecall = function( id, method ){
149 | return E(id)[method]
150 | }
151 | }])
152 |
153 |
154 | /*
155 | * Directive overwrite
156 | */
157 |
158 | //gm directive map, used for extend
159 | var directives = {}
160 |
161 | var _module = angular.module
162 | angular.module = function(){
163 | var module = _module.apply( angular, arguments)
164 |
165 | module.component = function(name, directiveDef){
166 | var directiveDefArgs = annotate( directiveDef )
167 | global._GM_DIRECTIVE_NAMES.push(name)
168 |
169 |
170 | var replacedDirectiveDef = function(){
171 | var directive = directiveDef.apply( directiveDef, arguments)
172 |
173 | if( directive.template || directive.templateUrl ){
174 |
175 | //TODO add tag name support
176 | angular.forEach( document.querySelectorAll("["+name.replace(/([A-Z])/g,"-$1").toLowerCase()+"]"), function( el ){
177 | if( el.getAttribute(global._CACHE_ATTRIBUTE) !== null ) return
178 |
179 | global._CACHE_ID++
180 | global._ORIGIN_ELEMENT_CACHE[global._CACHE_ID] = el.cloneNode(true)
181 | el.setAttribute(global._CACHE_ATTRIBUTE,global._CACHE_ID)
182 | })
183 | }
184 |
185 | if( directive.compile ){
186 | directive.preCompile = directive.compile
187 | delete directive.compile
188 | }
189 | if( directive.transclude ) throw new Error("you cannot wrap a directive with transclude")
190 |
191 | //must init a scope
192 | if( !directive.scope ) directive.scope = true
193 | //deal with replace, we do manually replace
194 | directive._replace = directive.replace
195 | delete directive.replace
196 |
197 |
198 | directive.compile = function( $el ){
199 | var compilingImportEls = []
200 |
201 | //should only compile once and only compile with the one that has template
202 | if( $el[0].getAttribute("gm-tpl-overwrote") === null ) {
203 |
204 | if(directive.template || directive.templateUrl ){
205 | if( directive._replace){
206 | if( $el[0].childNodes.length >1 ){
207 | console.log("you have multiple child nodes in directive", name, "cannot replace")
208 | }else{
209 | mergeEl($el[0], $el[0].childNodes[0])
210 | $el[0].innerHTML = $el[0].childNodes[0].innerHTML
211 | }
212 | }
213 |
214 | var originEl = global._ORIGIN_ELEMENT_CACHE[$el[0].getAttribute(global._CACHE_ATTRIBUTE)]
215 | if( !originEl ){
216 | console.log("can't find",name,$el[0].getAttribute(global._CACHE_ATTRIBUTE))
217 | throw new Error("origin component's element not exist, can't replace template.")
218 | }else{
219 | //Caution!!! When using original element, must clone one to prevent origin template being overwrite
220 | originEl = originEl.cloneNode(true)
221 | }
222 | var compileElClone = $el[0].cloneNode(true)
223 | var totalOverwrite = !isEmptyInnerHTML(originEl)
224 |
225 | //only include particular child element
226 | if( originEl.getAttribute("gm-tpl-include") !== null ){
227 | totalOverwrite = false
228 | angular.forEach( originEl.childNodes, function( childEl ){
229 | if( !childEl.getAttribute ) return
230 | var roleEl = $el[0].querySelector("[gm-role="+ childEl.getAttribute("gm-role")+"]")
231 | if( roleEl ){
232 | replaceEmptyInnerHTML(childEl,roleEl )
233 | }
234 | $el[0].innerHTML = originEl.innerHTML
235 | })
236 | }
237 |
238 | //only overwrite particular element
239 | if( originEl.getAttribute('gm-tpl-partial') !==null ){
240 |
241 | totalOverwrite = false
242 | angular.forEach(originEl.childNodes,function(roleEl){
243 | //exclude text, comment and other node type
244 | if( !roleEl.getAttribute ) return
245 | var role = roleEl.getAttribute("gm-role")
246 |
247 | angular.forEach($el[0].querySelectorAll("[gm-role="+role+"]"),function( targetEl){
248 | replaceEmptyInnerHTML( roleEl, targetEl)
249 | mergeEl(roleEl,targetEl)
250 | replaceWith( roleEl, targetEl)
251 | })
252 | })
253 | }
254 |
255 |
256 | if( originEl.getAttribute('gm-tpl-exclude') !==null ){
257 | totalOverwrite = false
258 | $el[0].getAttribute('gm-tpl-exclude').split(",").forEach(function( roleToExclude){
259 |
260 | removeElement($el[0].querySelector("[gm-role="+roleToExclude+"]"))
261 | })
262 | }
263 |
264 | if( totalOverwrite ){
265 | $el[0].innerHTML = originEl.innerHTML
266 | }
267 | }
268 |
269 |
270 | //handle import with gm-role
271 | var id = $el[0].getAttribute("id")
272 | angular.forEach(document.querySelectorAll("[gm-import="+id+"]"),function(importEl){
273 | var tobeCompiledCloneEl
274 | var roleEl,roleName
275 |
276 | if( importEl.getAttribute("gm-from-role")!==null ){
277 | roleName = importEl.getAttribute("gm-from-role")
278 |
279 | roleEl = compileElClone.querySelector("[gm-role="+ roleName+"]")
280 | if( roleEl ){
281 |
282 | tobeCompiledCloneEl = roleEl.cloneNode(true)
283 | tobeCompiledCloneEl.setAttribute("gm-import",id)
284 | if( !isEmptyInnerHTML(importEl)){
285 | replaceInnerHTML(importEl, tobeCompiledCloneEl)
286 | }
287 |
288 | //attribute overwrite
289 | mergeEl(tobeCompiledCloneEl,importEl)
290 |
291 | }else{
292 | console.log("no such role",roleName,"in element", $el[0])
293 | }
294 |
295 | }else{
296 | tobeCompiledCloneEl = importEl.cloneNode(true)
297 | }
298 |
299 | $el[0].appendChild( tobeCompiledCloneEl )
300 | tobeCompiledCloneEl.setAttribute("gm-imported",importEl.getAttribute("gm-import"))
301 | tobeCompiledCloneEl.removeAttribute("gm-import")
302 |
303 |
304 | compilingImportEls.push([ importEl, tobeCompiledCloneEl ])
305 | })
306 |
307 | $el[0].setAttribute("gm-tpl-overwrote",true)
308 | }
309 |
310 | //---------------------
311 | return function link( $scope, $el, $attrs){
312 | //deal with imported elements
313 | if( compilingImportEls.length){
314 | window.setTimeout(function(){
315 | var resetEl
316 | while( resetEl = compilingImportEls.pop() ){
317 | replaceWith( resetEl[1],resetEl[0] )
318 | }
319 | },1)
320 | }
321 |
322 | //define magic attributes
323 | $scope.$$id = $el[0].id
324 |
325 | //deal with extend
326 | var ancestors = [],
327 | currentAncestor
328 | if( directive.extend ){
329 | if( !directives[directive.extend] ){
330 | console.log("parent gm directive not found", directive.extend)
331 | }else{
332 |
333 | currentAncestor = directive.extend
334 | while( currentAncestor ) {
335 | if( !directives[currentAncestor].ins){
336 | directives[currentAncestor].ins = angular.element(document).injector().invoke(directives[currentAncestor].def);
337 | }
338 | ancestors.push( directives[currentAncestor].ins )
339 | currentAncestor = directives[currentAncestor].ins.extend //string or undefined
340 | }
341 |
342 | //caution!!! we reused var currentAncestor
343 | while( currentAncestor = ancestors.pop()){
344 | currentAncestor.link.call(directive, $scope, $el, $attrs)
345 | }
346 | }
347 | }
348 |
349 | //deal with events
350 | if( $el[0].getAttribute("gm-linked") === null){
351 | angular.forEach( $el[0].attributes, function( attribute, i ){
352 | if( attribute.nodeName && /^(on|scope-on)-/.test(attribute.nodeName)){
353 | //Caution, we run callbacks on parent scope
354 | var event = attribute.nodeName.replace(/^(on|scope-on)-/,"")
355 | var handler = attribute.value
356 | $el[0].addEventListener(event, function(e){
357 | console.log("event",event,"apply ",attribute.nodeName)
358 | if( /^scope-on-/.test(attribute.nodeName) ){
359 | $scope.$parent.$eval(handler+"( $event)", {"$event":e})
360 | }else{
361 | (new Function('e',handler+".call(this,e)"))(e)
362 | }
363 | })
364 | }
365 | })
366 | }
367 |
368 | $el[0].getAttribute("gm-linked",true)
369 | return directive.link.call(directive, $scope, $el, $attrs)
370 | }
371 | }
372 |
373 | //trick angular to save the previous element
374 | directives[name].ins = directive
375 | return directive
376 | }
377 |
378 | //save it
379 | directives[name]= {
380 | def : directiveDef
381 | }
382 |
383 | replacedDirectiveDef.$inject = directiveDefArgs
384 | return module.directive( name, replacedDirectiveDef)
385 | }
386 |
387 | return module
388 | }
389 |
390 |
391 | //copy from angular source code
392 | function extend(dst) {
393 | var h = dst.$$hashKey;
394 | forEach(arguments, function(obj){
395 | if (obj !== dst) {
396 | forEach(obj, function(value, key){
397 | dst[key] = value;
398 | });
399 | }
400 | });
401 |
402 | setHashKey(dst,h);
403 | return dst;
404 | }
405 |
406 | function setHashKey(obj, h) {
407 | if (h) {
408 | obj.$$hashKey = h;
409 | }
410 | else {
411 | delete obj.$$hashKey;
412 | }
413 | }
414 |
415 |
416 |
417 |
418 | })(window||this)
419 |
420 |
421 |
422 |
423 |
424 |
425 |
426 |
--------------------------------------------------------------------------------
/libs/lodash.min.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @license
3 | * Lo-Dash 3.0.0-pre (Custom Build) lodash.com/license | Underscore.js 1.7.0 underscorejs.org/LICENSE
4 | * Build: `lodash modern -o ./dist/lodash.js`
5 | */
6 | ;(function(){function n(n,t){for(var r=-1,e=n.length;++rt||!r||typeof n=="undefined"&&e)return 1;if(n=n&&9<=n&&13>=n||32==n||160==n||5760==n||6158==n||8192<=n&&(8202>=n||8232==n||8233==n||8239==n||8287==n||12288==n||65279==n)}function A(n,t){for(var r=-1,e=n.length,u=-1,o=[];++re&&(e=u)}return e}function Jt(n){for(var t=-1,r=n.length,e=uo;++to(t,a)&&e.push(a);return e}function ir(n,t){var r=n?n.length:0;if(!re(r))return vr(n,t);for(var e=-1,u=le(n);++ee(a,s)&&((t||i)&&a.push(s),l.push(c))}return l}function Cr(n,t){for(var r=-1,e=t.length,u=gu(e);++rao)){u=r,u=null==u?lu:u,t=u(t),o=0,r=n.length;for(var i=t!==t,a=typeof t=="undefined";o>>1,i=n[r],(e?i<=t:it||null==r)return r;if(3=o&&r<=i&&(e=L&&t>u||e>u&&t>=L)||o)&&(t&C&&(n[2]=h[2],r|=e&C?0:T),(e=h[3])&&(u=n[3],n[3]=u?Ur(u,e,h[4]):l(e),n[4]=u?A(n[3],Y):l(h[4])),(e=h[5])&&(u=n[5],n[5]=u?Lr(u,e,h[6]):l(e),n[6]=u?A(n[5],Y):l(h[6])),(e=h[7])&&(n[7]=l(e)),t&$&&(n[8]=null==n[8]?h[8]:Hu(n[8],h[8])),null==n[9]&&(n[9]=h[9]),n[0]=h[0],n[1]=r)}return n[9]=null==n[9]?f?0:n[0].length:Xu(n[9]-c,0)||0,t=n[1],(h?ho:yo)(t==C?zr(n[0],n[2]):t!=F&&t!=(C|F)||n[4].length?qr.apply(null,n):Kr.apply(null,n),n)}function Yr(n,t,r,e,u,o,i){var a=-1,f=n.length,l=t.length,c=true;
28 | if(f!=l&&(!u||l<=f))return false;for(;c&&++at?0:t)}function se(n,t,r){return(r?te(n,t,r):null==t)&&(t=1),t=n?n.length-(+t||0):0,de(n,0,0>t?0:t)}function pe(n,t,r){var e=-1,u=n?n.length:0;for(t=Jr(t,r,3);++er?Xu(e+r,0):r||0;else if(r)return r=Tr(n,t),n=n[r],(t===t?t===n:n!==n)?r:-1;return f(n,t,r)}function ve(n){return ce(n,1)
34 | }function de(n,t,r){var e=-1,u=n?n.length:0,o=typeof r;if(r&&"number"!=o&&te(n,t,r)&&(t=0,r=u),t=null==t?0:+t||0,0>t&&(t=-t>u?0:u+t),r="undefined"==o||r>u?u:+r||0,0>r&&(r+=u),r&&r==u&&!t)return l(n);for(u=t>r?0:r-t,r=gu(u);++e>>0,u=gu(r);++tr?Xu(e+r,0):r||0:0,typeof n=="string"||!Ao(n)&&Je(n)?rarguments.length,ir)}function Oe(n,t,r,e){return(Ao(n)?o:kr)(n,Jr(t,e,4),r,3>arguments.length,ar)}function Ce(n){n=fe(n);for(var t=-1,r=n.length,e=gu(r);++t=r||r>t?(a&&Lu(a),r=p,a=s=p=I,r&&(h=xo(),f=n.apply(c,i),s||a||(i=c=null))):s=qu(e,r)}function u(){s&&Lu(s),a=s=p=I,(v||g!==t)&&(h=xo(),f=n.apply(c,i),s||a||(i=c=null))}function o(){if(i=arguments,l=xo(),c=this,p=v&&(s||!d),false===g)var r=d&&!s;else{a||d||(h=l);var o=g-(l-h),y=0>=o||o>g;y?(a&&(a=Lu(a)),h=l,f=n.apply(c,i)):a||(a=qu(u,o))}return y&&s?s=Lu(s):s||t===g||(s=qu(e,t)),r&&(y=true,f=n.apply(c,i)),!y||s||a||(i=c=null),f}var i,a,f,l,c,s,p,h=0,g=false,v=true;if(!Ke(n))throw new Au(V);if(t=0>t?0:t,true===r)var d=true,v=false;
40 | else Ve(r)&&(d=r.leading,g="maxWait"in r&&Xu(+r.maxWait||0,t),v="trailing"in r?r.trailing:v);return o.cancel=function(){s&&Lu(s),a&&Lu(a),a=s=p=I},o}function $e(){var n=arguments,r=n.length-1;if(0>r)return function(){};if(!t(n,Ke))throw new Au(V);return function(){for(var t=r,e=n[t].apply(this,arguments);t--;)e=n[t].call(this,e);return e}}function Be(n,t){function r(){var e=r.cache,u=t?t.apply(this,arguments):arguments[0];if(e.has(u))return e.get(u);var o=n.apply(this,arguments);return e.set(u,o),o
41 | }if(!Ke(n)||t&&!Ke(t))throw new Au(V);return r.cache=new Be.Cache,r}function ze(n){var t=de(arguments,1),r=A(t,ze.placeholder);return Vr(n,F,null,t,r)}function De(n){var t=de(arguments,1),r=A(t,De.placeholder);return Vr(n,U,null,t,r)}function Me(n){return re(w(n)?n.length:I)&&Tu.call(n)==mt||false}function qe(n){return n&&1===n.nodeType&&w(n)&&-1t||null==n||!Gu(t))return r;n=xu(n);do t%2&&(r+=n),t=$u(t/2),n+=n;while(t);return r}function uu(n,t,r){var e=n;return(n=null==n?"":xu(n))?(r?te(e,t,r):null==t)?n.slice(j(n),E(n)+1):(t=xu(t),n.slice(p(n,t),h(n,t)+1)):n
44 | }function ou(n,t,r){return r&&te(n,t,r)&&(t=null),(n=null!=n&&xu(n))&&n.match(t||vt)||[]}function iu(n){try{return n()}catch(t){return Pe(t)?t:du(t)}}function au(n,t,r){return r&&te(n,t,r)&&(t=null),rr(n,t)}function fu(n){return function(){return n}}function lu(n){return n}function cu(n){return Ar(n,true)}function su(n,t,r){var e=true,u=Ve(t),o=null==r,i=o&&u&&ko(t),a=i&&yr(t,i);(i&&i.length&&!a.length||o&&!u)&&(o&&(r=t),a=false,t=n,n=this),a||(a=yr(t,ko(t))),false===r?e=false:Ve(r)&&"chain"in r&&(e=r.chain),r=-1,u=Ke(n);
45 | for(o=a.length;++r>>1,fo=Yu?Yu.BYTES_PER_ELEMENT:0,lo=mu.pow(2,53)-1,co=Vu&&new Vu,so=Dt.support={};!function(n){so.funcDecomp=!Ye(x.WinRTError)&&ht.test(k),so.funcNames=typeof yu.name=="string";try{so.dom=11===Ru.createDocumentFragment().nodeType}catch(t){so.dom=false
47 | }try{so.nonEnumArgs=!Du.call(arguments,1)}catch(r){so.nonEnumArgs=true}}(0,0),Dt.templateSettings={escape:tt,evaluate:rt,interpolate:et,variable:"",imports:{_:Dt}};var po=function(){function n(){}return function(t){if(Ve(t)){n.prototype=t;var r=new n;n.prototype=null}return r||x.Object()}}(),ho=co?function(n,t){return co.set(n,t),n}:lu;Fu||(Nr=Nu&&Ku?function(n){var t=n.byteLength,r=Yu?$u(t/fo):0,e=r*fo,u=new Nu(t);if(r){var o=new Yu(u,0,r);o.set(new Yu(n,0,r))}return t!=e&&(o=new Ku(u,e),o.set(new Ku(n,e))),u
48 | }:fu(null));var go=Mu?function(n){return new Kt(n)}:fu(null),vo=co?function(n){return co.get(n)}:pu,yo=function(){var n=0,t=0;return function(r,e){var u=xo(),o=M-(u-t);if(t=u,0=D)return r}else n=0;return ho(r,e)}}(),mo=$r(function(n,t,r){Ou.call(n,r)?++n[r]:n[r]=1}),_o=$r(function(n,t,r){Ou.call(n,r)?n[r].push(t):n[r]=[t]}),bo=$r(function(n,t,r){n[r]=t}),wo=$r(function(n,t,r){n[r?0:1].push(t)},function(){return[[],[]]}),xo=Qu||function(){return(new vu).getTime()},Ao=Zu||function(n){return w(n)&&re(n.length)&&Tu.call(n)==_t||false
49 | };so.dom||(qe=function(n){return n&&1===n.nodeType&&w(n)&&!Eo(n)||false});var jo=no||function(n){return typeof n=="number"&&Gu(n)};(Ke(/x/)||Ku&&!Ke(Ku))&&(Ke=function(n){return Tu.call(n)==At});var Eo=Bu?function(n){if(!n||Tu.call(n)!=Et)return false;var t=n.valueOf,r=Ye(t)&&(r=Bu(t))&&Bu(r);return r?n==r||Bu(n)==r:ie(n)}:ie,Ro=Br(nr),ko=Ju?function(n){if(n)var t=n.constructor,r=n.length;return typeof t=="function"&&t.prototype===n||typeof n!="function"&&r&&re(r)?ae(n):Ve(n)?Ju(n):[]}:ae,Io=Br(jr),Oo=Dr(function(n,t,r){return t=t.toLowerCase(),r?n+t.charAt(0).toUpperCase()+t.slice(1):t
50 | }),Co=Dr(function(n,t,r){return n+(r?"-":"")+t.toLowerCase()});8!=to(dt+"08")&&(ru=function(n,t,r){return t=r&&te(n,t,r)?0:+t,n=uu(n),to(n,t||(at.test(n)?16:10))});var So=Dr(function(n,t,r){return n+(r?"_":"")+t.toLowerCase()});return Mt.prototype=Dt.prototype,Pt.prototype["delete"]=function(n){return this.has(n)&&delete this.__data__[n]},Pt.prototype.get=function(n){return"__proto__"==n?I:this.__data__[n]},Pt.prototype.has=function(n){return"__proto__"!=n&&Ou.call(this.__data__,n)},Pt.prototype.set=function(n,t){return"__proto__"!=n&&(this.__data__[n]=t),this
51 | },Kt.prototype.push=function(n){var t=this.data,r=typeof n;"number"==r?t[r][n]=true:t.set.add(n)},Be.Cache=Pt,Dt.after=function(n,t){if(!Ke(t)){if(!Ke(n))throw new Au(V);var r=n;n=t,t=r}return n=Gu(n=+n)?n:0,function(){return 1>--n?t.apply(this,arguments):void 0}},Dt.ary=function(n,t,r){return r&&te(n,t,r)&&(t=null),t=null==t?n.length:+t||0,Vr(n,$,null,null,null,null,t)},Dt.assign=Ro,Dt.at=function(n){return re(n?n.length:0)&&(n=fe(n)),tr(n,sr(arguments,false,false,1))},Dt.before=Te,Dt.bind=We,Dt.bindAll=function(n){for(var t=n,r=1(s?Yt(s,i):u(c,i))){for(t=r;--t;){var p=e[t];if(0>(p?Yt(p,i):u(n[t],i)))continue n}s&&s.push(i),c.push(i)}return c},Dt.invert=function(n,t,r){r&&te(n,t,r)&&(t=null),r=-1;for(var e=ko(n),u=e.length,o={};++rt?0:t)},Dt.takeRight=function(n,t,r){return(r?te(n,t,r):null==t)&&(t=1),t=n?n.length-(+t||0):0,de(n,0>t?0:t)
61 | },Dt.takeRightWhile=function(n,t,r){var e=n?n.length:0;for(t=Jr(t,r,3);e--&&t(n[e],e,n););return de(n,e+1)},Dt.takeWhile=function(n,t,r){var e=-1,u=n?n.length:0;for(t=Jr(t,r,3);++en||!Gu(n))return[];var e=-1,u=gu(Hu(n,oo));for(t=Wr(t,r,1);++er?0:+r||0,e))-t.length,0<=r&&n.indexOf(t,r)==r},Dt.escape=function(n){return(n=null==n?"":xu(n))&&nt.test(n)?n.replace(H,y):n},Dt.escapeRegExp=tu,Dt.every=xe,Dt.find=je,Dt.findIndex=pe,Dt.findKey=function(n,t,r){return t=Jr(t,r,3),cr(n,t,vr,true)
65 | },Dt.findLast=function(n,t,r){return t=Jr(t,r,3),cr(n,t,ar)},Dt.findLastIndex=function(n,t,r){var e=n?n.length:0;for(t=Jr(t,r,3);e--;)if(t(n[e],e,n))return e;return-1},Dt.findLastKey=function(n,t,r){return t=Jr(t,r,3),cr(n,t,dr,true)},Dt.findWhere=function(n,t){return je(n,cu(t))},Dt.first=he,Dt.has=function(n,t){return n?Ou.call(n,t):false},Dt.identity=lu,Dt.includes=we,Dt.indexOf=ge,Dt.isArguments=Me,Dt.isArray=Ao,Dt.isBoolean=function(n){return true===n||false===n||w(n)&&Tu.call(n)==bt||false},Dt.isDate=function(n){return w(n)&&Tu.call(n)==wt||false
66 | },Dt.isElement=qe,Dt.isEmpty=function(n){if(null==n)return true;var t=n.length;return re(t)&&(Ao(n)||Je(n)||Me(n)||w(n)&&Ke(n.splice))?!t:!ko(n).length},Dt.isEqual=function(n,t,r,e){return r=typeof r=="function"&&Wr(r,e,3),!r&&ee(n)&&ee(t)?n===t:(e=r?r(n,t):I,typeof e=="undefined"?_r(n,t,r):!!e)},Dt.isError=Pe,Dt.isFinite=jo,Dt.isFunction=Ke,Dt.isMatch=function(n,t,r,e){var u=ko(t),o=u.length;if(r=typeof r=="function"&&Wr(r,e,3),!r&&1==o){var i=u[0];if(e=t[i],ee(e))return null!=n&&e===n[i]&&Ou.call(n,i)
67 | }for(var i=gu(o),a=gu(o);o--;)e=i[o]=t[u[o]],a[o]=ee(e);return wr(n,u,i,a,r)},Dt.isNaN=function(n){return Ze(n)&&n!=+n},Dt.isNative=Ye,Dt.isNull=function(n){return null===n},Dt.isNumber=Ze,Dt.isObject=Ve,Dt.isPlainObject=Eo,Dt.isRegExp=Ge,Dt.isString=Je,Dt.isUndefined=function(n){return typeof n=="undefined"},Dt.kebabCase=Co,Dt.last=function(n){var t=n?n.length:0;return t?n[t-1]:I},Dt.lastIndexOf=function(n,t,r){var e=n?n.length:0;if(!e)return-1;var u=e;if(typeof r=="number")u=(0>r?Xu(e+r,0):Hu(r||0,e-1))+1;
68 | else if(r)return u=Tr(n,t,null,true)-1,n=n[u],(t===t?t===n:n!==n)?u:-1;if(t!==t)return _(n,u,true);for(;u--;)if(n[u]===t)return u;return-1},Dt.max=function(n,t,r){r&&te(n,t,r)&&(t=null);var e=null==t,u=e&&Ao(n),o=!u&&Je(n);if(e&&!o)return Gt(u?n:fe(n));var i=eo,a=i;return t=e&&o?s:Jr(t,r,3),ir(n,function(n,r,e){r=t(n,r,e),(r>i||r===eo&&r===a)&&(i=r,a=n)}),a},Dt.min=function(n,t,r){r&&te(n,t,r)&&(t=null);var e=null==t,u=e&&Ao(n),o=!u&&Je(n);if(e&&!o)return Jt(u?n:fe(n));var i=uo,a=i;return t=e&&o?s:Jr(t,r,3),ir(n,function(n,r,e){r=t(n,r,e),(rr?0:+r||0,n.length),n.lastIndexOf(t,r)==r
71 | },Dt.template=function(n,t,r){var e=Dt.templateSettings;r&&te(n,t,r)&&(t=r=null),n=xu(null==n?"":n),t=nr(nr({},r||t),e,Qt),r=nr(nr({},t.imports),e.imports,Qt);var u,o,i=ko(r),a=Cr(r,i),f=0;r=t.interpolate||ct;var l="__p+='";r=wu((t.escape||ct).source+"|"+r.source+"|"+(r===et?ut:ct).source+"|"+(t.evaluate||ct).source+"|$","g");var c="sourceURL"in t?"//# sourceURL="+t.sourceURL+"\n":"";if(n.replace(r,function(t,r,e,i,a,c){return e||(e=i),l+=n.slice(f,c).replace(gt,m),r&&(u=true,l+="'+__e("+r+")+'"),a&&(o=true,l+="';"+a+";\n__p+='"),e&&(l+="'+((__t=("+e+"))==null?'':__t)+'"),f=c+t.length,t
72 | }),l+="';",(t=t.variable)||(l="with(obj){"+l+"}"),l=(o?l.replace(Z,""):l).replace(G,"$1").replace(J,"$1;"),l="function("+(t||"obj")+"){"+(t?"":"obj||(obj={});")+"var __t,__p=''"+(u?",__e=_.escape":"")+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}",t=iu(function(){return yu(i,c+"return "+l).apply(I,a)}),t.source=l,Pe(t))throw t;return t},Dt.trim=uu,Dt.trimLeft=function(n,t,r){var e=n;return(n=null==n?"":xu(n))?(r?te(e,t,r):null==t)?n.slice(j(n)):(t=xu(t),n.slice(p(n,t))):n
73 | },Dt.trimRight=function(n,t,r){var e=n;return(n=null==n?"":xu(n))?(r?te(e,t,r):null==t)?n.slice(0,E(n)+1):(t=xu(t),n.slice(0,h(n,t)+1)):n},Dt.trunc=function(n,t,r){r&&te(n,t,r)&&(t=null);var e=B;if(r=z,Ve(t)){var u="separator"in t?t.separator:u,e="length"in t?+t.length||0:e;r="omission"in t?xu(t.omission):r}else null!=t&&(e=+t||0);if(n=null==n?"":xu(n),e>=n.length)return n;if(e-=r.length,1>e)return r;if(t=n.slice(0,e),null==u)return t+r;if(Ge(u)){if(n.slice(e).search(u)){var o,i=n.slice(0,e);for(u.global||(u=wu(u.source,(ot.exec(u)||"")+"g")),u.lastIndex=0;n=u.exec(i);)o=n.index;
74 | t=t.slice(0,null==o?e:o)}}else n.indexOf(u,e)!=e&&(u=t.lastIndexOf(u),-1t?0:+t||0,n.length),n)
75 | },Dt.prototype.sample=function(n){return this.__chain__||null!=n?this.thru(function(t){return Dt.sample(t,n)}):Dt.sample(this.value())},Dt.VERSION=O,n("bind bindKey curry curryRight partial partialRight".split(" "),function(n){Dt[n].placeholder=Dt}),n(["filter","map","takeWhile"],function(n,t){var r=t==q;qt.prototype[n]=function(n,e){n=Jr(n,e,3);var u=this.clone(),o=u.filtered,i=u.iteratees||(u.iteratees=[]);return u.filtered=o||r||t==K&&0>u.dir,i.push({iteratee:n,type:t}),u}}),n(["drop","take"],function(n,t){var r=n+"Count",e=n+"While";
76 | qt.prototype[n]=function(e){e=null==e?1:Xu(+e||0,0);var u=this.clone();if(u.filtered){var o=u[r];u[r]=t?Hu(o,e):o+e}else(u.views||(u.views=[])).push({size:e,type:n+(0>u.dir?"Right":"")});return u},qt.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()},qt.prototype[n+"RightWhile"]=function(n,t){return this.reverse()[e](n,t).reverse()}}),n(["first","last"],function(n,t){var r="take"+(t?"Right":"");qt.prototype[n]=function(){return this[r](1).value()[0]}}),n(["initial","rest"],function(n,t){var r="drop"+(t?"":"Right");
77 | qt.prototype[n]=function(){return this[r](1)}}),n(["pluck","where"],function(n,t){var r=t?"filter":"map",e=t?cu:hu;qt.prototype[n]=function(n){return this[r](e(n))}}),qt.prototype.dropWhile=function(n,t){n=Jr(n,t,3);var r,e,u=0>this.dir;return this.filter(function(t,o,i){return r=r&&(u?oe),e=o,r||(r=!n(t,o,i))})},qt.prototype.reject=function(n,t){return n=Jr(n,t,3),this.filter(function(t,r,e){return!n(t,r,e)})},qt.prototype.slice=function(n,t){n=null==n?0:+n||0;var r=0>n?this.takeRight(-n):this.drop(n);
78 | return typeof t!="undefined"&&(t=+t||0,r=0>t?r.dropRight(-t):r.take(t-n)),r},vr(qt.prototype,function(n,t){var r=/^(?:first|last)$/.test(t);Dt.prototype[t]=function(){function e(n){return n=[n],zu.apply(n,o),Dt[t].apply(Dt,n)}var u=this.__wrapped__,o=arguments,i=this.__chain__,a=!!this.__actions__.length,f=u instanceof qt,l=f&&!a;return r&&!i?l?n.call(u):Dt[t](this.value()):f||Ao(u)?(u=n.apply(l?u:new qt(this),o),r||!a&&!u.actions||(u.actions||(u.actions=[])).push({args:[e],object:Dt,name:"thru"}),new Mt(u,i)):this.thru(e)
79 | }}),n("concat join pop push shift sort splice unshift".split(" "),function(n){var t=ju[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:join|pop|shift)$/.test(n);Dt.prototype[n]=function(){var n=arguments;return e&&!this.__chain__?t.apply(this.value(),n):this[r](function(r){return t.apply(r,n)})}}),qt.prototype.clone=function(){var n=this.actions,t=this.iteratees,r=this.views,e=new qt(this.wrapped);return e.actions=n?l(n):null,e.dir=this.dir,e.dropCount=this.dropCount,e.filtered=this.filtered,e.iteratees=t?l(t):null,e.takeCount=this.takeCount,e.views=r?l(r):null,e
80 | },qt.prototype.reverse=function(){var n=this.filtered,t=n?new qt(this):this.clone();return t.dir=-1*this.dir,t.filtered=n,t},qt.prototype.value=function(){var n=this.wrapped.value();if(!Ao(n))return Sr(n,this.actions);var t,r=this.dir,e=0>r,u=n.length;t=u;for(var o=this.views,i=0,a=-1,f=o?o.length:0;++a"'`]/g,Q=RegExp(X.source),nt=RegExp(H.source),tt=/<%-([\s\S]+?)%>/g,rt=/<%([\s\S]+?)%>/g,et=/<%=([\s\S]+?)%>/g,ut=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ot=/\w*$/,it=/^\s*function[ \n\r\t]+\w/,at=/^0[xX]/,ft=/^\[object .+?Constructor\]$/,lt=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,ct=/($^)/,st=/[.*+?^${}()|[\]\/\\]/g,pt=RegExp(st.source),ht=/\bthis\b/,gt=/['\n\r\u2028\u2029\\]/g,vt=RegExp("[A-Z\\xc0-\\xd6\\xd8-\\xde]{2,}(?=[A-Z\\xc0-\\xd6\\xd8-\\xde][a-z\\xdf-\\xf6\\xf8-\\xff]+)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+|[A-Z\\xc0-\\xd6\\xd8-\\xde]+|[0-9]+","g"),dt=" \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",yt="Array ArrayBuffer Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Math Number Object RegExp Set String _ clearTimeout document isFinite parseInt setTimeout TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap window WinRTError".split(" "),mt="[object Arguments]",_t="[object Array]",bt="[object Boolean]",wt="[object Date]",xt="[object Error]",At="[object Function]",jt="[object Number]",Et="[object Object]",Rt="[object RegExp]",kt="[object String]",It="[object ArrayBuffer]",Ot="[object Float32Array]",Ct="[object Float64Array]",St="[object Int8Array]",Tt="[object Int16Array]",Wt="[object Int32Array]",Nt="[object Uint8Array]",Ft="[object Uint8ClampedArray]",Ut="[object Uint16Array]",Lt="[object Uint32Array]",$t={};
83 | $t[mt]=$t[_t]=$t[Ot]=$t[Ct]=$t[St]=$t[Tt]=$t[Wt]=$t[Nt]=$t[Ft]=$t[Ut]=$t[Lt]=true,$t[It]=$t[bt]=$t[wt]=$t[xt]=$t[At]=$t["[object Map]"]=$t[jt]=$t[Et]=$t[Rt]=$t["[object Set]"]=$t[kt]=$t["[object WeakMap]"]=false;var Bt={};Bt[mt]=Bt[_t]=Bt[It]=Bt[bt]=Bt[wt]=Bt[Ot]=Bt[Ct]=Bt[St]=Bt[Tt]=Bt[Wt]=Bt[jt]=Bt[Et]=Bt[Rt]=Bt[kt]=Bt[Nt]=Bt[Ft]=Bt[Ut]=Bt[Lt]=true,Bt[xt]=Bt[At]=Bt["[object Map]"]=Bt["[object Set]"]=Bt["[object WeakMap]"]=false;var zt={leading:false,maxWait:0,trailing:false},Dt={"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss"},Mt={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},qt={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},Pt={"function":true,object:true},Kt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Vt=Pt[typeof window]&&window!==(this&&this.window)?window:this,Yt=Pt[typeof exports]&&exports&&!exports.nodeType&&exports,Zt=Pt[typeof module]&&module&&!module.nodeType&&module,Gt=Yt&&Zt&&typeof global=="object"&&global;
84 | !Gt||Gt.global!==Gt&&Gt.window!==Gt&&Gt.self!==Gt||(Vt=Gt);var Jt=Zt&&Zt.exports===Yt&&Yt,Xt=k();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Vt._=Xt, define(function(){return Xt})):Yt&&Zt?Jt?(Zt.exports=Xt)._=Xt:Yt._=Xt:Vt._=Xt}).call(this);
--------------------------------------------------------------------------------
/libs/jquery-only-alax.min.js:
--------------------------------------------------------------------------------
1 | /*! jQuery v3.0.0-pre -css,-css/addGetHookIf,-css/curCSS,-css/defaultDisplay,-css/hiddenVisibleSelectors,-css/support,-css/swap,-css/var/cssExpand,-css/var/getStyles,-css/var/isHidden,-css/var/rmargin,-css/var/rnumnonpx,-effects,-effects/Tween,-effects/animatedSelector,-dimensions,-offset,-deprecated,-event,-event/ajax,-event/alias,-event/support,-wrap | (c) jQuery Foundation | jquery.org/license */
2 | !function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=a.document,e=c.slice,f=c.concat,g=c.push,h=c.indexOf,i={},j=i.toString,k=i.hasOwnProperty,l={},m="3.0.0-pre -css,-css/addGetHookIf,-css/curCSS,-css/defaultDisplay,-css/hiddenVisibleSelectors,-css/support,-css/swap,-css/var/cssExpand,-css/var/getStyles,-css/var/isHidden,-css/var/rmargin,-css/var/rnumnonpx,-effects,-effects/Tween,-effects/animatedSelector,-dimensions,-offset,-deprecated,-event,-event/ajax,-event/alias,-event/support,-wrap",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return e.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:e.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(e.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:g,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return!n.isArray(a)&&a-parseFloat(a)+1>=0},isPlainObject:function(a){return"object"!==n.type(a)||a.nodeType||n.isWindow(a)?!1:a.constructor&&!k.call(a.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?i[j.call(a)]||"object":typeof a},globalEval:function(a){var b=d.createElement("script");b.text=a,d.head.appendChild(b).parentNode.removeChild(b)},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d=0,e=a.length,f=s(a);if(c){if(f){for(;e>d;d++)if(b.apply(a[d],c)===!1)break}else for(d in a)if(b.apply(a[d],c)===!1)break}else if(f){for(;e>d;d++)if(b.call(a[d],d,a[d])===!1)break}else for(d in a)if(b.call(a[d],d,a[d])===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):g.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:h.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,e=0,g=a.length,h=s(a),i=[];if(h)for(;g>e;e++)d=b(a[e],e,c),null!=d&&i.push(d);else for(e in a)d=b(a[e],e,c),null!=d&&i.push(d);return f.apply([],i)},guid:1,proxy:function(a,b){var c,d,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(d=e.call(arguments,2),f=function(){return a.apply(b||this,d.concat(e.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:l}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){i["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=gb(),z=gb(),A=gb(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+M+"))|)"+L+"*\\]",O=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+N+")*)|.*)\\)|)",P=new RegExp(L+"+","g"),Q=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),R=new RegExp("^"+L+"*,"+L+"*"),S=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),T=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),U=new RegExp(O),V=new RegExp("^"+M+"$"),W={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M+"|[*])"),ATTR:new RegExp("^"+N),PSEUDO:new RegExp("^"+O),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},X=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Z=/^[^{]+\{\s*\[native \w/,$=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,_=/[+~]/,ab=/'|\\/g,bb=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),cb=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},db=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(eb){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],!a||"string"!=typeof a)return d;if(1!==(k=b.nodeType)&&9!==k&&11!==k)return[];if(p&&!e){if(11!==k&&(f=$.exec(a)))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName)return H.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=1!==k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(ab,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+qb(o[l]);w=_.test(a)&&ob(b.parentNode)||b,x=o.join(",")}if(x)try{return H.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(Q,"$1"),b,d,e)}function gb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function hb(a){return a[u]=!0,a}function ib(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function jb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function kb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function lb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function nb(a){return hb(function(b){return b=+b,hb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function ob(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=fb.support={},f=fb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fb.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=g.documentElement,e=g.defaultView,e&&e!==e.top&&(e.addEventListener?e.addEventListener("unload",db,!1):e.attachEvent&&e.attachEvent("onunload",db)),p=!f(g),c.attributes=ib(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ib(function(a){return a.appendChild(g.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Z.test(g.getElementsByClassName),c.getById=ib(function(a){return o.appendChild(a).id=u,!g.getElementsByName||!g.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(bb,cb);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(bb,cb);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=Z.test(g.querySelectorAll))&&(ib(function(a){o.appendChild(a).innerHTML=" ",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ib(function(a){var b=g.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Z.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ib(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",O)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Z.test(o.compareDocumentPosition),t=b||Z.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===g||a.ownerDocument===v&&t(v,a)?-1:b===g||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return kb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?kb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},fb.matches=function(a,b){return fb(a,null,null,b)},fb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(T,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fb(b,n,null,[a]).length>0},fb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fb.selectors={cacheLength:50,createPseudo:hb,match:W,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(bb,cb),a[3]=(a[3]||a[4]||a[5]||"").replace(bb,cb),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return W.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&U.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(bb,cb).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(P," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?hb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:hb(function(a){var b=[],c=[],d=h(a.replace(Q,"$1"));return d[u]?hb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:hb(function(a){return function(b){return fb(a,b).length>0}}),contains:hb(function(a){return a=a.replace(bb,cb),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:hb(function(a){return V.test(a||"")||fb.error("unsupported lang: "+a),a=a.replace(bb,cb).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Y.test(a.nodeName)},input:function(a){return X.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:nb(function(){return[0]}),last:nb(function(a,b){return[b-1]}),eq:nb(function(a,b,c){return[0>c?c+b:c]}),even:nb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:nb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:nb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:nb(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function rb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function sb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function tb(a,b,c){for(var d=0,e=b.length;e>d;d++)fb(a,b[d],c);return c}function ub(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function vb(a,b,c,d,e,f){return d&&!d[u]&&(d=vb(d)),e&&!e[u]&&(e=vb(e,f)),hb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||tb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ub(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ub(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ub(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function wb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=rb(function(a){return a===b},h,!0),l=rb(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[rb(sb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return vb(i>1&&sb(m),i>1&&qb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(Q,"$1"),c,e>i&&wb(a.slice(i,e)),f>e&&wb(a=a.slice(e)),f>e&&qb(a))}m.push(c)}return sb(m)}function xb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=F.call(i));s=ub(s)}H.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&fb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?hb(f):f}return h=fb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xb(e,d)),f.selector=a}return f},i=fb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(bb,cb),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=W.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(bb,cb),_.test(j[0].type)&&ob(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qb(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,_.test(a)&&ob(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ib(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ib(function(a){return a.innerHTML=" ","#"===a.firstChild.getAttribute("href")})||jb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ib(function(a){return a.innerHTML=" ",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||jb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ib(function(a){return null==a.getAttribute("disabled")})||jb(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fb}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return h.call(b,a)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,A=n.fn.init=function(a,b){var c,e;if(!a)return this;if("string"==typeof a){if(c="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return e=d.getElementById(c[2]),e&&(this.length=1,this[0]=e),this.context=d,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?void 0!==y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};A.prototype=n.fn,y=n(d);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?"string"==typeof a?h.call(n(a),this[0]):h.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(C[a]||n.unique(e),B.test(a)&&e.reverse()),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return n.each(a.match(E)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(b=a.memory&&l,c=!0,g=e||0,e=0,f=h.length,d=!0;h&&f>g;g++)if(h[g].apply(l[0],l[1])===!1&&a.stopOnFalse){b=!1;break}d=!1,h&&(i?i.length&&j(i.shift()):b?h=[]:k.disable())},k={add:function(){if(h){var c=h.length;!function g(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this},remove:function(){return h&&n.each(arguments,function(a,b){var c;while((c=n.inArray(b,h,c))>-1)h.splice(c,1),d&&(f>=c&&f--,g>=c&&g--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h&&(h=[],f=0),this},disable:function(){return h=i=b=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,b||k.disable(),this},locked:function(){return!i},fireWith:function(a,b){return!h||c&&!i||(b=b||[],b=[a,b.slice?b.slice():b],d?i.push(b):j(b)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!c}};return k},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=e.call(arguments),d=c.length,f=1!==d||a&&n.isFunction(a.promise)?d:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(d){b[a]=this,c[a]=arguments.length>1?e.call(arguments):d,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(d>1)for(i=new Array(d),j=new Array(d),k=new Array(d);d>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().progress(h(b,j,i)).done(h(b,k,c)).fail(g.reject):--f;return f||g.resolveWith(k,c),g.promise()}});var H;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(H.resolveWith(d,[n]),n.fn.triggerHandler&&(n(d).triggerHandler("ready"),n(d).off("ready"))))}});function I(){d.removeEventListener("DOMContentLoaded",I,!1),a.removeEventListener("load",I,!1),n.ready()}n.ready.promise=function(b){return H||(H=n.Deferred(),"complete"===d.readyState?setTimeout(n.ready):(d.addEventListener("DOMContentLoaded",I,!1),a.addEventListener("load",I,!1))),H.promise(b)},n.ready.promise();var J=n.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)J(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f};n.acceptData=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function K(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=n.expando+K.uid++}K.uid=1,K.accepts=n.acceptData,K.prototype={key:function(a){if(!K.accepts(a))return 0;var b={},c=a[this.expando];if(!c){c=K.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,n.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if("string"==typeof b)f[b]=c;else if(n.isEmptyObject(f))n.extend(this.cache[e],b);else for(d in b)f[d]=b[d];return f},get:function(a,b){var c=this.cache[this.key(a)];return void 0===b?c:c[b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=this.key(a),g=this.cache[f];if(void 0===b)this.cache[f]={};else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in g?d=[b,e]:(d=e,d=d in g?[d]:d.match(E)||[])),c=d.length;while(c--)delete g[d[c]]}},hasData:function(a){return!n.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}};var L=new K,M=new K,N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/[A-Z]/g;function P(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(O,"-$&").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c
3 | }catch(e){}M.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return M.hasData(a)||L.hasData(a)},data:function(a,b,c){return M.access(a,b,c)},removeData:function(a,b){M.remove(a,b)},_data:function(a,b,c){return L.access(a,b,c)},_removeData:function(a,b){L.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=M.get(f),1===f.nodeType&&!L.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d])));L.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){M.set(this,a)}):J(this,function(b){var c,d;if(f&&void 0===b){if(c=M.get(f,a),void 0!==c)return c;if(d=n.camelCase(a),c=M.get(f,d),void 0!==c)return c;if(c=P(f,d,void 0),void 0!==c)return c}else d=n.camelCase(a),this.each(function(){var c=M.get(this,d);M.set(this,d,b),-1!==a.indexOf("-")&&void 0!==c&&M.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){M.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=L.get(a,b),c&&(!d||n.isArray(c)?d=L.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return L.get(a,c)||L.access(a,c,{empty:n.Callbacks("once memory").add(function(){L.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthx",l.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var S=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,T=/<([\w:]+)/,U=/<|?\w+;/,V=/<(?:script|style|link)/i,W=/checked\s*(?:[^=]|=\s*.checked.)/i,X=/^$|\/(?:java|ecma)script/i,Y=/^true\/(.*)/,Z=/^\s*\s*$/g,$={option:[1,""," "],thead:[1,""],col:[2,""],tr:[2,""],td:[3,""],_default:[0,"",""]};$.optgroup=$.option,$.tbody=$.tfoot=$.colgroup=$.caption=$.thead,$.th=$.td;function _(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function ab(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function bb(a){var b=Y.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function cb(a,b){for(var c=0,d=a.length;d>c;c++)L.set(a[c],"globalEval",!b||L.get(b[c],"globalEval"))}function db(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(L.hasData(a)&&(f=L.access(a),g=L.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}M.hasData(a)&&(h=M.access(a),i=n.extend({},h),M.set(b,i))}}function eb(a,b){var c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function fb(a,b){var c=b.nodeName.toLowerCase();"input"===c&&R.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}n.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(l.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=eb(h),f=eb(a),d=0,e=f.length;e>d;d++)fb(f[d],g[d]);if(b)if(c)for(f=f||eb(a),g=g||eb(h),d=0,e=f.length;e>d;d++)db(f[d],g[d]);else db(a,h);return g=eb(h,"script"),g.length>0&&cb(g,!i&&eb(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,o=a.length;o>m;m++)if(e=a[m],e||0===e)if("object"===n.type(e))n.merge(l,e.nodeType?[e]:e);else if(U.test(e)){f=f||k.appendChild(b.createElement("div")),g=(T.exec(e)||["",""])[1].toLowerCase(),h=$[g]||$._default,f.innerHTML=h[1]+e.replace(S,"<$1>$2>")+h[2],j=h[0];while(j--)f=f.lastChild;n.merge(l,f.childNodes),f=k.firstChild,f.textContent=""}else l.push(b.createTextNode(e));k.textContent="",m=0;while(e=l[m++])if((!d||-1===n.inArray(e,d))&&(i=n.contains(e.ownerDocument,e),f=eb(k.appendChild(e),"script"),i&&cb(f),c)){j=0;while(e=f[j++])X.test(e.type||"")&&c.push(e)}return k},cleanData:function(a){for(var b,c,d,e,f=n.event.special,g=0;void 0!==(c=a[g]);g++){if(n.acceptData(c)&&(e=c[L.expando],e&&(b=L.cache[e]))){if(b.events)for(d in b.events)f[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);L.cache[e]&&delete L.cache[e]}delete M.cache[c[M.expando]]}}}),n.fn.extend({text:function(a){return J(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=a)})},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=_(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=_(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(eb(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&cb(eb(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(eb(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return J(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!V.test(a)&&!$[(T.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(S,"<$1>$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(eb(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(eb(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=f.apply([],a);var c,d,e,g,h,i,j=0,k=this.length,m=this,o=k-1,p=a[0],q=n.isFunction(p);if(q||k>1&&"string"==typeof p&&!l.checkClone&&W.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(k&&(c=n.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(e=n.map(eb(c,"script"),ab),g=e.length;k>j;j++)h=c,j!==o&&(h=n.clone(h,!0,!0),g&&n.merge(e,eb(h,"script"))),b.call(this[j],h,j);if(g)for(i=e[e.length-1].ownerDocument,n.map(e,bb),j=0;g>j;j++)h=e[j],X.test(h.type||"")&&!L.access(h,"globalEval")&&n.contains(i,h)&&(h.src?n._evalUrl&&n._evalUrl(h.src):n.globalEval(h.textContent.replace(Z,"")))}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),f=e.length-1,h=0;f>=h;h++)c=h===f?this:this.clone(!0),n(e[h])[b](c),g.apply(d,c.get());return this.pushStack(d)}});var gb=d.documentElement;n.fn.delay=function(a,b){return a=n.fx?n.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a=d.createElement("input"),b=d.createElement("select"),c=b.appendChild(d.createElement("option"));a.type="checkbox",l.checkOn=""!==a.value,l.optSelected=c.selected,b.disabled=!0,l.optDisabled=!c.disabled,a=d.createElement("input"),a.value="t",a.type="radio",l.radioValue="t"===a.value}();var hb,ib,jb=n.expr.attrHandle;n.fn.extend({attr:function(a,b){return J(this,n.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){n.removeAttr(this,a)})}}),n.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return"undefined"==typeof a.getAttribute?n.prop(a,b,c):(1===f&&n.isXMLDoc(a)||(b=b.toLowerCase(),d=n.attrHooks[b]||(n.expr.match.bool.test(b)?ib:hb)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=n.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void n.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=n.propFix[c]||c,n.expr.match.bool.test(c)&&(a[d]=!1),a.removeAttribute(c)},attrHooks:{type:{set:function(a,b){if(!l.radioValue&&"radio"===b&&n.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),ib={set:function(a,b,c){return b===!1?n.removeAttr(a,c):a.setAttribute(c,c),c}},n.each(n.expr.match.bool.source.match(/\w+/g),function(a,b){var c=jb[b]||n.find.attr;jb[b]=function(a,b,d){var e,f;return d||(f=jb[b],jb[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,jb[b]=f),e}});var kb=/^(?:input|select|textarea|button)$/i;n.fn.extend({prop:function(a,b){return J(this,n.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[n.propFix[a]||a]})}}),n.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!n.isXMLDoc(a),f&&(b=n.propFix[b]||b,e=n.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){return a.hasAttribute("tabindex")||kb.test(a.nodeName)||a.href?a.tabIndex:-1}}}}),l.optSelected||(n.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null}}),n.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){n.propFix[this.toLowerCase()]=this});var lb=/[\t\r\n\f]/g;n.fn.extend({addClass:function(a){var b,c,d,e,f,g,h="string"==typeof a&&a,i=0,j=this.length;if(n.isFunction(a))return this.each(function(b){n(this).addClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(lb," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=n.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0===arguments.length||"string"==typeof a&&a,i=0,j=this.length;if(n.isFunction(a))return this.each(function(b){n(this).removeClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(lb," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?n.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(n.isFunction(a)?function(c){n(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=n(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(void 0===a||"boolean"===c)&&(this.className&&L.set(this,"__className__",this.className),this.className=this.className||a===!1?"":L.get(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(lb," ").indexOf(b)>=0)return!0;return!1}});var mb=/\r/g;n.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=n.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,n(this).val()):a,null==e?e="":"number"==typeof e?e+="":n.isArray(e)&&(e=n.map(e,function(a){return null==a?"":a+""})),b=n.valHooks[this.type]||n.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=n.valHooks[e.type]||n.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(mb,""):null==c?"":c)}}}),n.extend({valHooks:{option:{get:function(a){return n.trim(a.value)}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(l.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&n.nodeName(c.parentNode,"optgroup"))){if(b=n(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=n.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=n.inArray(n.valHooks.option.get(d),f)>=0)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),n.each(["radio","checkbox"],function(){n.valHooks[this]={set:function(a,b){return n.isArray(b)?a.checked=n.inArray(n(a).val(),b)>=0:void 0}},l.checkOn||(n.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var nb=a.location,ob=n.now(),pb=/\?/;n.parseJSON=function(a){return JSON.parse(a+"")},n.parseXML=function(b){var c;if(!b||"string"!=typeof b)return null;try{c=(new a.DOMParser).parseFromString(b,"text/xml")}catch(d){c=void 0}return(!c||c.getElementsByTagName("parsererror").length)&&n.error("Invalid XML: "+b),c};var qb=/#.*$/,rb=/([?&])_=[^&]*/,sb=/^(.*?):[ \t]*([^\r\n]*)$/gm,tb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,ub=/^(?:GET|HEAD)$/,vb=/^\/\//,wb={},xb={},yb="*/".concat("*"),zb=d.createElement("a");zb.href=nb.href;function Ab(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(n.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Bb(a,b,c,d){var e={},f=a===xb;function g(h){var i;return e[h]=!0,n.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Cb(a,b){var c,d,e=n.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&n.extend(!0,a,d),a}function Db(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Eb(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}n.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:nb.href,type:"GET",isLocal:tb.test(nb.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":yb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":n.parseJSON,"text xml":n.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Cb(Cb(a,n.ajaxSettings),b):Cb(n.ajaxSettings,a)},ajaxPrefilter:Ab(wb),ajaxTransport:Ab(xb),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,e,f,g,h,i,j,k,l=n.ajaxSetup({},b),m=l.context||l,o=l.context&&(m.nodeType||m.jquery)?n(m):n.event,p=n.Deferred(),q=n.Callbacks("once memory"),r=l.statusCode||{},s={},t={},u=0,v="canceled",w={readyState:0,getResponseHeader:function(a){var b;if(2===u){if(!g){g={};while(b=sb.exec(f))g[b[1].toLowerCase()]=b[2]}b=g[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===u?f:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return u||(a=t[c]=t[c]||a,s[a]=b),this},overrideMimeType:function(a){return u||(l.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>u)for(b in a)r[b]=[r[b],a[b]];else w.always(a[w.status]);return this},abort:function(a){var b=a||v;return c&&c.abort(b),y(0,b),this}};if(p.promise(w).complete=q.add,w.success=w.done,w.error=w.fail,l.url=((a||l.url||nb.href)+"").replace(qb,"").replace(vb,nb.protocol+"//"),l.type=b.method||b.type||l.method||l.type,l.dataTypes=n.trim(l.dataType||"*").toLowerCase().match(E)||[""],null==l.crossDomain){i=d.createElement("a");try{i.href=l.url,i.href=i.href,l.crossDomain=zb.protocol+"//"+zb.host!=i.protocol+"//"+i.host}catch(x){l.crossDomain=!0}}if(l.data&&l.processData&&"string"!=typeof l.data&&(l.data=n.param(l.data,l.traditional)),Bb(wb,l,b,w),2===u)return w;j=n.event&&l.global,j&&0===n.active++&&n.event.trigger("ajaxStart"),l.type=l.type.toUpperCase(),l.hasContent=!ub.test(l.type),e=l.url,l.hasContent||(l.data&&(e=l.url+=(pb.test(e)?"&":"?")+l.data,delete l.data),l.cache===!1&&(l.url=rb.test(e)?e.replace(rb,"$1_="+ob++):e+(pb.test(e)?"&":"?")+"_="+ob++)),l.ifModified&&(n.lastModified[e]&&w.setRequestHeader("If-Modified-Since",n.lastModified[e]),n.etag[e]&&w.setRequestHeader("If-None-Match",n.etag[e])),(l.data&&l.hasContent&&l.contentType!==!1||b.contentType)&&w.setRequestHeader("Content-Type",l.contentType),w.setRequestHeader("Accept",l.dataTypes[0]&&l.accepts[l.dataTypes[0]]?l.accepts[l.dataTypes[0]]+("*"!==l.dataTypes[0]?", "+yb+"; q=0.01":""):l.accepts["*"]);for(k in l.headers)w.setRequestHeader(k,l.headers[k]);if(l.beforeSend&&(l.beforeSend.call(m,w,l)===!1||2===u))return w.abort();v="abort";for(k in{success:1,error:1,complete:1})w[k](l[k]);if(c=Bb(xb,l,b,w)){if(w.readyState=1,j&&o.trigger("ajaxSend",[w,l]),2===u)return w;l.async&&l.timeout>0&&(h=setTimeout(function(){w.abort("timeout")},l.timeout));try{u=1,c.send(s,y)}catch(x){if(!(2>u))throw x;y(-1,x)}}else y(-1,"No Transport");function y(a,b,d,g){var i,k,s,t,v,x=b;2!==u&&(u=2,h&&clearTimeout(h),c=void 0,f=g||"",w.readyState=a>0?4:0,i=a>=200&&300>a||304===a,d&&(t=Db(l,w,d)),t=Eb(l,t,w,i),i?(l.ifModified&&(v=w.getResponseHeader("Last-Modified"),v&&(n.lastModified[e]=v),v=w.getResponseHeader("etag"),v&&(n.etag[e]=v)),204===a||"HEAD"===l.type?x="nocontent":304===a?x="notmodified":(x=t.state,k=t.data,s=t.error,i=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),w.status=a,w.statusText=(b||x)+"",i?p.resolveWith(m,[k,x,w]):p.rejectWith(m,[w,x,s]),w.statusCode(r),r=void 0,j&&o.trigger(i?"ajaxSuccess":"ajaxError",[w,l,i?k:s]),q.fireWith(m,[w,x]),j&&(o.trigger("ajaxComplete",[w,l]),--n.active||n.event.trigger("ajaxStop")))}return w},getJSON:function(a,b,c){return n.get(a,b,c,"json")},getScript:function(a,b){return n.get(a,void 0,b,"script")}}),n.each(["get","post"],function(a,b){n[b]=function(a,c,d,e){return n.isFunction(c)&&(e=e||d,d=c,c=void 0),n.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),n._evalUrl=function(a){return n.ajax({url:a,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})};var Fb=/%20/g,Gb=/\[\]$/,Hb=/\r?\n/g,Ib=/^(?:submit|button|image|reset|file)$/i,Jb=/^(?:input|select|textarea|keygen)/i;function Kb(a,b,c,d){var e;if(n.isArray(b))n.each(b,function(b,e){c||Gb.test(a)?d(a,e):Kb(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==n.type(b))d(a,b);else for(e in b)Kb(a+"["+e+"]",b[e],c,d)}n.param=function(a,b){var c,d=[],e=function(a,b){b=n.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=n.ajaxSettings&&n.ajaxSettings.traditional),n.isArray(a)||a.jquery&&!n.isPlainObject(a))n.each(a,function(){e(this.name,this.value)});else for(c in a)Kb(c,a[c],b,e);return d.join("&").replace(Fb,"+")},n.fn.extend({serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=n.prop(this,"elements");return a?n.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!n(this).is(":disabled")&&Jb.test(this.nodeName)&&!Ib.test(a)&&(this.checked||!R.test(a))}).map(function(a,b){var c=n(this).val();return null==c?null:n.isArray(c)?n.map(c,function(a){return{name:b.name,value:a.replace(Hb,"\r\n")}}):{name:b.name,value:c.replace(Hb,"\r\n")}}).get()}}),n.ajaxSettings.xhr=function(){try{return new a.XMLHttpRequest}catch(b){}};var Lb=0,Mb={},Nb={0:200,1223:204},Ob=n.ajaxSettings.xhr();a.attachEvent&&a.attachEvent("onunload",function(){for(var a in Mb)Mb[a]()}),l.cors=!!Ob&&"withCredentials"in Ob,l.ajax=Ob=!!Ob,n.ajaxTransport(function(a){var b;return l.cors||Ob&&!a.crossDomain?{send:function(c,d){var e,f=a.xhr(),g=++Lb;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)f.setRequestHeader(e,c[e]);b=function(a){return function(){b&&(delete Mb[g],b=f.onload=f.onerror=null,"abort"===a?f.abort():"error"===a?d(f.status,f.statusText):d(Nb[f.status]||f.status,f.statusText,"string"==typeof f.responseText?{text:f.responseText}:void 0,f.getAllResponseHeaders()))}},f.onload=b(),f.onerror=b("error"),b=Mb[g]=b("abort");try{f.send(a.hasContent&&a.data||null)}catch(h){if(b)throw h}},abort:function(){b&&b()}}:void 0}),n.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return n.globalEval(a),a}}}),n.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),n.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(e,f){b=n("