10 lines
263 KiB
JavaScript
10 lines
263 KiB
JavaScript
!function(a,b){"use strict";if(!("Ink"in a)){var c={},d={},e=[],f={},g=[],h={},i=Function.prototype.apply,j=function(a){if("object"!=typeof a)return!1;for(var b in a)if(a.hasOwnProperty(b))return!1;return!0};a.Ink={VERSION:"3.0.5",_checkPendingRequireModules:function(){var a,b,c,e,f,h,i=[];for(a=0,b=g.length;b>a;++a)if(c=g[a]){for(e in c.left)c.left.hasOwnProperty(e)&&(f=d[e],f&&(c.args[c.left[e]]=f,delete c.left[e],--c.remaining));if(c.remaining>0)i.push(c);else{if(h=c.cb,!h)continue;delete c.cb,h.apply(!1,c.args)}}g=i,g.length>0&&setTimeout(function(){Ink._checkPendingRequireModules()},0)},getPath:function(a,b){var d=a.split(/[._]/g),e,f,g,h;for(f=d.length;f>=0;f-=1)if(e=d.slice(0,f+1).join("."),c[e]){g=e;break}return g in c?(h=c[g],/\/$/.test(h)||(h+="/"),f<d.length&&(h+=d.slice(f+1).join("/")+"/"),b||(h+="lib.js"),h):null},setPath:function(a,b){c[a.replace(/_/,".")]=b},loadScript:function(c,d){if(-1===c.indexOf("/")){var e=c;if(c=this.getPath(c),null===c)throw new Error('Could not load script "'+e+'". Path not found in the registry. Did you misspell the name, or forgot to call setPath()?')}var f=b.createElement("script");f.setAttribute("type",d||"text/javascript"),f.setAttribute("src",c),f.onerror=f.onreadystatechange=function(b){b=b||a.event,("readystatechange"!==b.type||"loaded"===f.readyState)&&Ink.error(["Failed to load script from ",c,"."].join(""))};var g=b.getElementsByTagName("head");g.length>0&&g[0].appendChild(f)},_loadLater:function(a){setTimeout(function(){d[a]||f[a]||h[a]||(f[a]=!0,Ink.loadScript(a))},0)},namespace:function(b,c){if(!b||!b.length)return null;for(var d=b.split("."),e=a,f,g=0,h=d.length;h>g;++g)e[d[g]]=e[d[g]]||{},f=e,e=e[d[g]];return c?[f,d[g-1]]:e},getModule:function(a,b){var c=b?[a,"_",b].join(""):a;return d[c]},createModule:function(b,c,g,i){if("string"!=typeof b)throw new Error("module name must be a string!");if(!("number"==typeof c||"string"==typeof c&&c.length>0))throw new Error("version number missing!");var k=[b,"_",c].join("");h[k]=!0;var l=function(){if(!d[k]){delete f[k],delete f[b];var g=Array.prototype.slice.call(arguments),l=i.apply(a,g);e.push(k),"object"==typeof l?l._version=c:"function"==typeof l&&(l.prototype._version=c,l._version=c);var m=0===b.indexOf("Ink."),n;m&&(n=Ink.namespace(b,!0)),d[k]=l,delete h[k],m&&(n[0][n[1]+"_"+c]=l),d[b]=l,m&&j(n[0][n[1]])&&(n[0][n[1]]=l),this&&Ink._checkPendingRequireModules()}};this.requireModules(g,l)},requireModules:function(a,b){var c,e,h,i,j;if(e=a&&a.length,h={args:new Array(e),left:{},remaining:e,cb:b},"object"!=typeof a||void 0===a.length)throw new Error("Dependency list should be an array!");if("function"!=typeof b)throw new Error("Callback should be a function!");for(c=0;e>c;++c)Ink._moduleRenames[a[c]]?(Ink.warn(a[c]+" was renamed to "+Ink._moduleRenames[a[c]]),i=Ink._moduleRenames[a[c]]):i=a[c],i?(j=d[i],j?(h.args[c]=j,--h.remaining):(f[i]||Ink._loadLater(i),h.left[i]=c)):--h.remaining;h.remaining>0?g.push(h):b.apply(!0,h.args)},_moduleRenames:{"Ink.UI.Aux_1":"Ink.UI.Common_1"},getModulesLoadOrder:function(){return e.slice()},getModuleScripts:function(){var a=this.getModulesLoadOrder();return a.unshift("Ink_1"),a=a.map(function(a){return["<scr",'ipt type="text/javascript" src="',Ink.getModuleURL(a),'"></scr',"ipt>"].join("")}),a.join("\n")},createExt:function(a,b,c,d){return Ink.createModule("Ink.Ext."+a,b,c,d)},bind:function(a,b){var c=Array.prototype.slice.call(arguments,2);return function(){var d=Array.prototype.slice.call(arguments),e=c.concat(d);return a.apply(b===!1?this:b,e)}},bindMethod:function(a,b){return Ink.bind.apply(Ink,[a[b],a].concat([].slice.call(arguments,2)))},bindEvent:function(b,c){var d=Array.prototype.slice.call(arguments,2);return function(e){var f=d.slice();return f.unshift(e||a.event),b.apply(c===!1?this:c,f)}},i:function(a){if(!a)throw new Error("Ink.i => id or element must be passed");return"string"==typeof a?b.getElementById(a):a},ss:function(a,c){if("undefined"==typeof Ink.Dom||"undefined"==typeof Ink.Dom.Selector)throw new Error("This method requires Ink.Dom.Selector");return Ink.Dom.Selector.select(a,c||b)},s:function(a,c){if("undefined"==typeof Ink.Dom||"undefined"==typeof Ink.Dom.Selector)throw new Error("This method requires Ink.Dom.Selector");return Ink.Dom.Selector.select(a,c||b)[0]||null},extendObj:function(a){for(var b=[].slice.call(arguments,1),c=0,d=b.length;d>c;c++)if(b[c])for(var e in b[c])Object.prototype.hasOwnProperty.call(b[c],e)&&(a[e]=b[c][e]);return a},log:function(){var b=a.console;b&&b.log&&i.call(b.log,b,arguments)},warn:function(){var b=a.console;b&&b.warn&&i.call(b.warn,b,arguments)},error:function(){var b=a.console;b&&b.error&&i.call(b.error,b,arguments)}}}}(window,document),Ink.createModule("Ink.Net.Ajax","1",[],function(){"use strict";var Ajax=function(a,b){this.init(a,b)};Ajax.globalOptions={parameters:{},requestHeaders:{}};var xMLHttpRequestWithCredentials="XMLHttpRequest"in window&&"withCredentials"in new XMLHttpRequest;return Ajax.prototype={init:function(a,b){if(!a)throw new Error("WRONG_ARGUMENTS_ERR");var c=Ink.extendObj({asynchronous:!0,method:"POST",parameters:null,timeout:0,delay:0,postBody:"",contentType:"application/x-www-form-urlencoded",requestHeaders:null,onComplete:null,onSuccess:null,onFailure:null,onException:null,onHeaders:null,onCreate:null,onInit:null,onTimeout:null,sanitizeJSON:!1,evalJS:!0,xhrProxy:"",cors:!1,debug:!1,useCredentials:!1,signRequest:!1},Ajax.globalOptions);if(b&&"object"==typeof b){if(c=Ink.extendObj(c,b),"object"==typeof b.parameters)c.parameters=Ink.extendObj(Ink.extendObj({},Ajax.globalOptions.parameters),b.parameters);else if(null!==b.parameters){var d=this.paramsObjToStr(Ajax.globalOptions.parameters);d&&(c.parameters=b.parameters+"&"+d)}c.requestHeaders=Ink.extendObj({},Ajax.globalOptions.requestHeaders),c.requestHeaders=Ink.extendObj(c.requestHeaders,b.requestHeaders)}this.options=c,this.safeCall("onInit"),this.url=a;var e=this._locationFromURL(a);this.isHTTP=this._locationIsHTTP(e),this.isCrossDomain=this._locationIsCrossDomain(e,location),this.requestHasBody=c.method.search(/^get|head$/i)<0,this.options.cors&&(this.isCrossDomain=!1),this.transport=this.getTransport(),this.request()},_locationFromURL:function(a){var b=document.createElementNS?document.createElementNS("http://www.w3.org/1999/xhtml","a"):document.createElement("a");return b.href=a,b},_locationIsHTTP:function(a){return a.protocol.match(/^https?:/i)?!0:!1},_locationIsCrossDomain:function(a,b){return b=b||window.location,Ajax.prototype._locationIsHTTP(a)&&"widget:"!==b.protocol&&"object"!=typeof window.widget?b.protocol!==a.protocol||b.host.split(":")[0]!==a.host.split(":")[0]:!1},getTransport:function(){if(!xMLHttpRequestWithCredentials&&this.options.cors&&"XDomainRequest"in window)return this.usingXDomainReq=!0,new XDomainRequest;if("undefined"!=typeof XMLHttpRequest)return new XMLHttpRequest;if("undefined"==typeof ActiveXObject)return null;try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(a){return new ActiveXObject("Microsoft.XMLHTTP")}},setHeaders:function(){if(this.transport)try{var a={Accept:"text/javascript,text/xml,application/xml,application/xhtml+xml,text/html,application/json;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1","Accept-Language":navigator.language,"X-Requested-With":"XMLHttpRequest","X-Ink-Version":"2"};if(this.options.cors&&(this.options.signRequest||delete a["X-Requested-With"],delete a["X-Ink-Version"]),this.options.requestHeaders&&"object"==typeof this.options.requestHeaders)for(var b in this.options.requestHeaders)this.options.requestHeaders.hasOwnProperty(b)&&(a[b]=this.options.requestHeaders[b]);this.transport.overrideMimeType&&(navigator.userAgent.match(/Gecko\/(\d{4})/)||[0,2005])[1]<2005&&(a.Connection="close");for(var c in a)a.hasOwnProperty(c)&&this.transport.setRequestHeader(c,a[c])}catch(d){}},paramsObjToStr:function(a){var b,c,d,e,f=[];if("object"!=typeof a)return a;for(d in a)if(a.hasOwnProperty(d))if(e=a[d],"[object Array]"!==Object.prototype.toString.call(e)||isNaN(e.length))f=f.concat([encodeURIComponent(d),"=",encodeURIComponent(e),"&"]);else for(b=0,c=e.length;c>b;b++)f=f.concat([encodeURIComponent(d),"[]","=",encodeURIComponent(e[b]),"&"]);return f.length>0&&f.pop(),f.join("")},setParams:function(){var a=null,b=this.options.parameters;a="object"==typeof b?this.paramsObjToStr(b):""+b,a&&(this.url=this.url.indexOf("?")>-1?this.url.split("#")[0]+"&"+a:this.url.split("#")[0]+"?"+a)},getHeader:function(a){if(this.usingXDomainReq&&"Content-Type"===a)return this.transport.contentType;try{return this.transport.getResponseHeader(a)}catch(b){return null}},getAllHeaders:function(){try{return this.transport.getAllResponseHeaders()}catch(a){return null}},getResponse:function(){var a=this.transport,b={headerJSON:null,responseJSON:null,getHeader:this.getHeader,getAllHeaders:this.getAllHeaders,request:this,transport:a,timeTaken:new Date-this.startTime,requestedUrl:this.url};b.readyState=a.readyState;try{b.responseText=a.responseText}catch(c){}try{b.responseXML=a.responseXML}catch(c){}try{b.status=a.status}catch(c){b.status=0}try{b.statusText=a.statusText}catch(c){b.statusText=""}return b},abort:function(){if(this.transport){clearTimeout(this.delayTimeout),clearTimeout(this.stoTimeout);try{this.transport.abort()}catch(a){}this.finish()}},runStateChange:function(){var a=this.transport.readyState;if(3===a)this.isHTTP&&this.safeCall("onHeaders");else if(4===a||this.usingXDomainReq){if(this.options.asynchronous&&this.options.delay&&this.startTime+this.options.delay>(new Date).getTime())return void(this.delayTimeout=setTimeout(Ink.bind(this.runStateChange,this),this.options.delay+this.startTime-(new Date).getTime()));var b,c=this.transport.responseText,d=this.getResponse(),e=this.transport.status;this.isHTTP&&!this.options.asynchronous&&this.safeCall("onHeaders"),clearTimeout(this.stoTimeout),0===e?this.isHTTP?this.safeCall("onException",this.makeError(18,"NETWORK_ERR")):e=c?200:404:304===e&&(e=200);var f=this.usingXDomainReq||e>=200&&300>e,g=this.getHeader("Content-Type")||"";if(this.options.evalJS&&(g.indexOf("application/json")>=0||"force"===this.options.evalJS))try{b=this.evalJSON(c,this.sanitizeJSON),b&&(c=d.responseJSON=b)}catch(h){f&&this.safeCall("onException",h)}if(this.usingXDomainReq&&-1!==g.indexOf("xml")&&"DOMParser"in window){var i;switch(g){case"application/xml":case"application/xhtml+xml":case"image/svg+xml":i=g;break;default:i="text/xml"}var j=(new DOMParser).parseFromString(this.transport.responseText,i);this.transport.responseXML=j,d.responseXML=j}null!==this.transport.responseXML&&null===d.responseJSON&&""!==this.transport.responseXML.xml&&(c=this.transport.responseXML),(e||this.usingXDomainReq)&&(f?this.safeCall("onSuccess",d,c):this.safeCall("onFailure",d,c),this.safeCall("on"+e,d,c)),this.finish(d,c)}},finish:function(a,b){if(a&&this.safeCall("onComplete",a,b),clearTimeout(this.stoTimeout),this.transport){try{this.transport.onreadystatechange=null}catch(c){}"function"==typeof this.transport.destroy&&this.transport.destroy(),this.transport=null}},safeCall:function(a,b){function c(a){setTimeout(function(){throw a.message&&(a.message+="\n"+(a.stacktrace||a.stack||"")),a},1)}if("function"==typeof this.options[a])try{this.options[a].apply(this,[].slice.call(arguments,1))}catch(d){c(d)}else b&&window.Error&&b instanceof Error&&c(b)},setRequestHeader:function(a,b){this.options.requestHeaders||(this.options.requestHeaders={}),this.options.requestHeaders[a]=b},request:function(){if(this.transport){var a=null;this.requestHasBody?(null!==this.options.postBody&&""!==this.options.postBody?(a=this.options.postBody,this.setParams()):null!==this.options.parameters&&""!==this.options.parameters&&(a=this.options.parameters),"object"!=typeof a||a.nodeType?"object"!=typeof a&&null!==a&&(a=""+a):a=this.paramsObjToStr(a),this.options.contentType&&this.setRequestHeader("Content-Type",this.options.contentType)):this.setParams();var b=this.url,c=this.options.method,d=this.isCrossDomain;d&&this.options.xhrProxy&&(this.setRequestHeader("X-Url",b),b=this.options.xhrProxy+encodeURIComponent(b),d=!1);try{this.transport.open(c,b,this.options.asynchronous)}catch(e){return this.safeCall("onException",e),this.finish(this.getResponse(),null)}this.setHeaders(),this.safeCall("onCreate"),this.options.timeout&&!isNaN(this.options.timeout)&&(this.stoTimeout=setTimeout(Ink.bind(function(){this.options.onTimeout&&(this.safeCall("onTimeout"),this.abort())},this),1e3*this.options.timeout)),this.options.useCredentials&&!this.usingXDomainReq&&(this.transport.withCredentials=!0),this.options.asynchronous&&!this.usingXDomainReq?this.transport.onreadystatechange=Ink.bind(this.runStateChange,this):this.usingXDomainReq&&(this.transport.onload=Ink.bind(this.runStateChange,this));try{if(d)throw this.makeError(18,"NETWORK_ERR");this.startTime=(new Date).getTime(),this.transport.send(a)}catch(e){return this.safeCall("onException",e),this.finish(this.getResponse(),null)}this.options.asynchronous||this.runStateChange()}},makeError:function(a,b){if("function"!=typeof Error)return{code:a,message:b};var c=new Error(b);return c.code=a,c},isJSON:function(a){return"string"==typeof a&&a?(a=a.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,""),/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/.test(a)):!1},evalJSON:function(strJSON,sanitize){if(strJSON&&(!sanitize||this.isJSON(strJSON)))try{return"undefined"!=typeof JSON&&"undefined"!=typeof JSON.parse?JSON.parse(strJSON):eval("("+strJSON+")")}catch(e){throw new Error("ERROR: Bad JSON string...")}return null}},Ajax.load=function(a,b){return new Ajax(a,{method:"GET",onSuccess:function(a){b(a.responseJSON||a.responseText,a)}})},Ajax.ping=function(a,b){return new Ajax(a,{method:"HEAD",onSuccess:function(a){"function"==typeof b&&b(a)}})},Ajax}),Ink.createModule("Ink.Net.JsonP","1",[],function(){"use strict";var a=function(a,b){this.init(a,b)};return a.prototype={init:function(a,b){if(this.options=Ink.extendObj({onSuccess:void 0,onFailure:void 0,failureObj:{},timeout:10,params:{},callbackParam:"jsoncallback",internalCallback:"_cb",randVar:!1},b||{}),this.randVar=this.options.randVar!==!1?this.options.randVar:parseInt(1e5*Math.random(),10),this.options.internalCallback+=this.randVar,this.uri=a,"function"==typeof this.options.onComplete&&(this.options.onSuccess=this.options.onComplete),"string"!=typeof this.uri)throw"Please define an URI";if("function"!=typeof this.options.onSuccess)throw"please define a callback function on option onSuccess!";Ink.Net.JsonP[this.options.internalCallback]=Ink.bind(function(){window.clearTimeout(this.timeout),delete window.Ink.Net.JsonP[this.options.internalCallback],this._removeScriptTag(),this.options.onSuccess(arguments[0])},this),this._addScriptTag()},_addParamsToGet:function(a,b){var c=-1!==a.indexOf("?"),d,e,f,g=[a];for(e in b)b.hasOwnProperty(e)&&(c?d="&":(d="?",c=!0),f=b[e],"number"==typeof f||f||(f=""),g=g.concat([d,e,"=",encodeURIComponent(f)]));return g.join("")},_getScriptContainer:function(){var a=document.getElementsByTagName("head");if(0===a.length){var b=document.getElementsByTagName("script");return b[0]}return a[0]},_addScriptTag:function(){this.options.params[this.options.callbackParam]="Ink.Net.JsonP."+this.options.internalCallback,this.options.params.rnd_seed=this.randVar,this.uri=this._addParamsToGet(this.uri,this.options.params);var a=document.createElement("script");a.type="text/javascript",a.src=this.uri;var b=this._getScriptContainer();b.appendChild(a),this.timeout=setTimeout(Ink.bind(this._requestFailed,this),1e3*this.options.timeout)},_requestFailed:function(){delete Ink.Net.JsonP[this.options.internalCallback],this._removeScriptTag(),"function"==typeof this.options.onFailure&&this.options.onFailure(this.options.failureObj)},_removeScriptTag:function(){for(var a,b=document.getElementsByTagName("script"),c,d=0,e=b.length;e>d;++d)if(a=b[d],c=a.getAttribute("src")||a.src,null!==c&&c===this.uri)return void a.parentNode.removeChild(a)}},a}),Ink.createModule("Ink.Dom.Browser","1",[],function(){"use strict";var a={IE:!1,GECKO:!1,OPERA:!1,SAFARI:!1,KONQUEROR:!1,CHROME:!1,model:!1,version:!1,userAgent:!1,cssPrefix:!1,domPrefix:!1,init:function(){this.detectBrowser(),this.setDimensions(),this.setReferrer()},setDimensions:function(){var a=0,b=0;"number"==typeof window.innerWidth?(a=window.innerWidth,b=window.innerHeight):document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)?(a=document.documentElement.clientWidth,b=document.documentElement.clientHeight):document.body&&(document.body.clientWidth||document.body.clientHeight)&&(a=document.body.clientWidth,b=document.body.clientHeight),this.windowWidth=a,this.windowHeight=b},setReferrer:function(){this.referrer=document.referrer&&document.referrer.length?window.escape(document.referrer):!1},detectBrowser:function(){this._sniffUserAgent(navigator.userAgent)},_sniffUserAgent:function(a){if(this.userAgent=a,a=a.toLowerCase(),/applewebkit\//.test(a))if(this.cssPrefix="-webkit-",this.domPrefix="Webkit",/(chrome|crios)\//.test(a))this.CHROME=!0,this.model="chrome",this.version=a.replace(/(.*)chrome\/([^\s]+)(.*)/,"$2");else{this.SAFARI=!0,this.model="safari";var b=/version\/([^) ]+)/;this.version=b.test(a)?a.match(b)[1]:a.replace(/(.*)applewebkit\/([^\s]+)(.*)/,"$2")}else if(/opera/.test(a))this.OPERA=!0,this.model="opera",this.version=a.replace(/(.*)opera.([^\s$]+)(.*)/,"$2"),this.cssPrefix="-o-",this.domPrefix="O";else if(/konqueror/.test(a))this.KONQUEROR=!0,this.model="konqueror",this.version=a.replace(/(.*)konqueror\/([^;]+);(.*)/,"$2"),this.cssPrefix="-khtml-",this.domPrefix="Khtml";else if(/(msie|trident)/i.test(a))this.IE=!0,this.model="ie",this.version=/rv:((?:\d|\.)+)/.test(a)?a.match(/rv:((?:\d|\.)+)/)[1]:a.replace(/(.*)\smsie\s([^;]+);(.*)/,"$2"),this.cssPrefix="-ms-",this.domPrefix="ms";else if(/gecko/.test(a)){this.cssPrefix="-moz-",this.domPrefix="Moz",this.GECKO=!0;var c=/(camino|chimera|epiphany|minefield|firefox|firebird|phoenix|galeon|iceweasel|k\-meleon|seamonkey|netscape|songbird|sylera)/;if(c.test(a))this.model=a.match(c)[1],this.version=a.replace(new RegExp("(.*)"+this.model+"/([^;\\s$]+)(.*)"),"$2");else{this.model="mozilla";var d=/(.*)rv:([^)]+)(.*)/;d.test(a)&&(this.version=a.replace(d,"$2"))}}},debug:function(){var a="known browsers: (ie, gecko, opera, safari, konqueror) \n";a+=[this.IE,this.GECKO,this.OPERA,this.SAFARI,this.KONQUEROR]+"\n",a+="cssPrefix -> "+this.cssPrefix+"\n",a+="domPrefix -> "+this.domPrefix+"\n",a+="model -> "+this.model+"\n",a+="version -> "+this.version+"\n",a+="\n",a+="original UA -> "+this.userAgent,alert(a)}};return a.init(),a}),Ink.createModule("Ink.Dom.Css",1,[],function(){"use strict";var a="defaultView"in document&&"getComputedStyle"in document.defaultView?document.defaultView.getComputedStyle:window.getComputedStyle,b={addRemoveClassName:function(a,b,c){return c?this.addClassName(a,b):void this.removeClassName(a,b)},addClassName:function(a,c){if(a=Ink.i(a),!a||!c)return null;c=(""+c).split(/[, ]+/);for(var d=0,e=c.length;e>d;d++)c[d].replace(/^\s+|\s+$/g,"")&&("undefined"!=typeof a.classList?a.classList.add(c[d]):b.hasClassName(a,c[d])||(a.className+=(a.className?" ":"")+c[d]))},removeClassName:function(a,b){if(a=Ink.i(a),!a||!b)return null;b=(""+b).split(/[, ]+/);var c=0,d=b.length;if("undefined"!=typeof a.classList)for(;d>c;c++)a.classList.remove(b[c]);else{for(var e=a.className||"",f;d>c;c++)f=new RegExp("(^|\\s+)"+b[c]+"(\\s+|$)"),e=e.replace(f," ");a.className=e.replace(/^\s+/,"").replace(/\s+$/,"")}},setClassName:function(a,b,c){this.addRemoveClassName(a,b,c||!1)},hasClassName:function(a,b,c){if(a=Ink.i(a),!a||!b)return!1;b=(""+b).split(/[, ]+/);for(var d=0,e=b.length,f,g;e>d;d++){if("undefined"!=typeof a.classList)f=a.classList.contains(b[d]);else{var h=a.className;h===b[d]?f=!0:(g=new RegExp("(^|\\s)"+b[d]+"(\\s|$)"),f=g.test(h))}if(f&&!c)return!0;if(!f&&c)return!1}return c?!0:!1},blinkClass:function(a,c,d,e){a=Ink.i(a),b.addRemoveClassName(a,c,!e),setTimeout(function(){b.addRemoveClassName(a,c,e)},Number(d)||100)},toggleClassName:function(a,c,d){return a&&c&&"undefined"!=typeof a.classList&&!/[, ]/.test(c)?(a=Ink.i(a),null!==a&&a.classList.toggle(c),!0):void("undefined"!=typeof d?d===!0?b.addClassName(a,c):d===!1&&b.removeClassName(a,c):b.hasClassName(a,c)?b.removeClassName(a,c):b.addClassName(a,c))},setOpacity:function(a,b){if(a=Ink.i(a),null!==a){var c=1;isNaN(Number(b))||(c=0>=b?0:1>=b?b:100>=b?b/100:1),"undefined"!=typeof a.style.opacity?a.style.opacity=c:a.style.filter="alpha(opacity:"+(100*c|0)+")"}},_camelCase:function(a){return a?a.replace(/-(\w)/g,function(a,b){return b.toUpperCase()}):a},getStyle:function(b,c){if(b=Ink.i(b),null!==b&&b.style){c="float"===c?"cssFloat":this._camelCase(c);var d=b.style[c];if(!a||d&&"auto"!==d)!d&&b.currentStyle&&(d=b.currentStyle[c],"auto"!==d||"width"!==c&&"height"!==c||(d=b["offset"+c.charAt(0).toUpperCase()+c.slice(1)]+"px"));else{var e=a(b,null);d=e?e[c]:null}if("opacity"===c)return d?parseFloat(d,10):1;if("borderTopWidth"===c||"borderBottomWidth"===c||"borderRightWidth"===c||"borderLeftWidth"===c){if("thin"===d)return"1px";if("medium"===d)return"3px";if("thick"===d)return"5px"}return"auto"===d?null:d}},setStyle:function(a,b){if(a=Ink.i(a),null!==a)if("string"==typeof b)a.style.cssText+="; "+b,-1!==b.indexOf("opacity")&&this.setOpacity(a,b.match(/opacity:\s*(\d?\.?\d*)/)[1]);else for(var c in b)b.hasOwnProperty(c)&&("opacity"===c?this.setOpacity(a,b[c]):"float"===c||"cssFloat"===c?"undefined"==typeof a.style.styleFloat?a.style.cssFloat=b[c]:a.style.styleFloat=b[c]:a.style[c]=b[c])},show:function(a,b){a=Ink.i(a),null!==a&&(a.style.display=b?b:"")},hide:function(a){a=Ink.i(a),null!==a&&(a.style.display="none")},showHide:function(a,b){a=Ink.i(a),a&&(a.style.display=b?"":"none")},toggle:function(a,b){a=Ink.i(a),null!==a&&("undefined"!=typeof b?b===!0?this.show(a):this.hide(a):"none"===this.getStyle(a,"display").toLowerCase()?this.show(a):this.hide(a))},_getRefTag:function(a){if(a.firstElementChild)return a.firstElementChild;for(var b=a.firstChild;b;b=b.nextSibling)if(1===b.nodeType)return b;return null},appendStyleTag:function(a,b,c){c=Ink.extendObj({type:"text/css",force:!1},c||{});var d=document.getElementsByTagName("style"),e=!1,f=!0,g,h;for(g=0,h=d.length;h>g;g++)e=d[g].innerHTML,e.indexOf(a)>=0&&(f=!1);if(f){var i=document.createElement("style"),j=document.getElementsByTagName("head")[0],k=!1,l="";i.type=c.type,l+=a+" {",l+=b,l+="} ","undefined"!=typeof i.styleSheet?i.styleSheet.cssText=l:i.appendChild(document.createTextNode(l)),c.force?j.appendChild(i):(k=this._getRefTag(j),k&&j.insertBefore(i,k))}},appendStylesheet:function(a,b){b=Ink.extendObj({media:"screen",type:"text/css",force:!1},b||{});var c,d=document.createElement("link"),e=document.getElementsByTagName("head")[0];d.media=b.media,d.type=b.type,d.href=a,d.rel="Stylesheet",b.force?e.appendChild(d):(c=this._getRefTag(e),c&&e.insertBefore(d,c))},_loadingCSSFiles:{},_loadedCSSFiles:{},appendStylesheetCb:function(a,b){if(!a)return b(a);if(this._loadedCSSFiles[a])return b(a);var c=this._loadingCSSFiles[a];if(c)return c.push(b);this._loadingCSSFiles[a]=[b];var d=document.createElement("link");d.type="text/css",d.rel="stylesheet",d.href=a;var e=document.getElementsByTagName("head")[0];e.appendChild(d);var f=document.createElement("img");f.onerror=Ink.bindEvent(function(a,b){var c=b;this._loadedCSSFiles[c]=!0;for(var d=this._loadingCSSFiles[c],e=0,f=d.length;f>e;++e)d[e](c);delete this._loadingCSSFiles[c]},this,a),f.src=a},decToHex:function(a){var b=function(a){return 1===a.length&&(a="0"+a),a=a.toUpperCase()};if("object"==typeof a){var c=b(parseInt(a.r,10).toString(16)),d=b(parseInt(a.g,10).toString(16)),e=b(parseInt(a.b,10).toString(16));return c+d+e}a+="";var f=a.match(/\((\d+),\s?(\d+),\s?(\d+)\)/);return null!==f?b(parseInt(f[1],10).toString(16))+b(parseInt(f[2],10).toString(16))+b(parseInt(f[3],10).toString(16)):b(parseInt(a,10).toString(16))},hexToDec:function(a){return 0===a.indexOf("#")&&(a=a.substr(1)),6===a.length?{r:parseInt(a.substr(0,2),16),g:parseInt(a.substr(2,2),16),b:parseInt(a.substr(4,2),16)}:3===a.length?{r:parseInt(a.charAt(0)+a.charAt(0),16),g:parseInt(a.charAt(1)+a.charAt(1),16),b:parseInt(a.charAt(2)+a.charAt(2),16)}:a.length<=2?parseInt(a,16):void 0},getPropertyFromStylesheet:function(a,b){var c=this.getRuleFromStylesheet(a);return c?c.style[b]:null},getPropertyFromStylesheet2:function(a,b){for(var c=this.getRulesFromStylesheet(a),d,e=0,f=c.length;f>e;e++)if(d=c[e].style[b],null!==d&&void 0!==d)return d;return null},getRuleFromStylesheet:function(a){var b,c,d,e,f,g=document.styleSheets;if(!g)return null;for(var h=0,i=document.styleSheets.length;i>h;++h){if(b=document.styleSheets[h],c=b.rules?b.rules:b.cssRules,!c)return null;for(d=0,e=c.length;e>d;++d)if(f=c[d],f.selectorText&&f.selectorText===a)return f}return null},getRulesFromStylesheet:function(a){var b=[],c,d,e,f,g,h=document.styleSheets;if(!h)return b;for(var i=0,j=document.styleSheets.length;j>i;++i){if(c=document.styleSheets[i],d=c.rules?c.rules:c.cssRules,!d)return null;for(e=0,f=d.length;f>e;++e)g=d[e],g.selectorText&&g.selectorText===a&&b.push(g)}return b},getPropertiesFromRule:function(a){var b=this.getRuleFromStylesheet(a),c={},d,e,f;b=b.style.cssText;var g=b.split(";"),h,i,j,k;for(e=0,f=g.length;f>e;++e)" "===g[e].charAt(0)&&(g[e]=g[e].substring(1)),h=g[e].split(":"),d=this._camelCase(h[0].toLowerCase()),i=h[1],i&&(i=i.substring(1),"padding"===d||"margin"===d||"borderWidth"===d?("borderWidth"===d?(j="border",k="Width"):(j=d,k=""),-1!==i.indexOf(" ")?(i=i.split(" "),c[j+"Top"+k]=i[0],c[j+"Bottom"+k]=i[0],c[j+"Left"+k]=i[1],c[j+"Right"+k]=i[1]):(c[j+"Top"+k]=i,c[j+"Bottom"+k]=i,c[j+"Left"+k]=i,c[j+"Right"+k]=i)):"borderRadius"===d?-1!==i.indexOf(" ")?(i=i.split(" "),c.borderTopLeftRadius=i[0],c.borderBottomRightRadius=i[0],c.borderTopRightRadius=i[1],c.borderBottomLeftRadius=i[1]):(c.borderTopLeftRadius=i,c.borderTopRightRadius=i,c.borderBottomLeftRadius=i,c.borderBottomRightRadius=i):c[d]=i);return c},changeFontSize:function(a,b,c,d,e){var f=this;Ink.requireModules(["Ink.Dom.Selector_1"],function(g){var h;if("string"!=typeof a?h="1st argument must be a CSS selector rule.":"number"!=typeof b?h="2nd argument must be a number.":void 0!==c&&"+"!==c&&"*"!==c?h='3rd argument must be one of "+", "*".':void 0!==d&&("number"!=typeof d||0>=d)?h="4th argument must be a positive number.":void 0!==e&&("number"!=typeof e||e>e)&&(h="5th argument must be a positive number greater than minValue."),h)throw new TypeError(h);var i,j,k=g.select(a);void 0===d&&(d=1),c="*"===c?function(a,b){return a*b}:function(a,b){return a+b};for(var l=0,m=k.length;m>l;++l)j=k[l],i=parseFloat(f.getStyle(j,"fontSize")),i=c(i,b),d>i||"number"==typeof e&&i>e||(j.style.fontSize=i+"px")})}};return b}),Ink.createModule("Ink.Dom.Element",1,[],function(){"use strict";function a(a){var b={};try{b=a.getBoundingClientRect()}catch(c){b={top:a.offsetTop,left:a.offsetLeft}}return b}var b="function"==typeof document.createRange&&"function"==typeof window.Range.prototype.createContextualFragment,c="Ink.Dom.Element tbody: "+Math.random(),d=function(){var a=document.createElement("div");return a.innerHTML="<table>",0!==a.getElementsByTagName("tbody").length}(),e={isDOMElement:function(a){return null!==a&&"object"==typeof a&&"nodeType"in a&&1===a.nodeType},get:function(a){return"undefined"!=typeof a?"string"==typeof a?document.getElementById(a):a:null},create:function(a,b){var c=document.createElement(a);for(var d in b)b.hasOwnProperty(d)&&(d in e?e[d](c,b[d]):"className"===d||"class"===d?c.className=b.className||b["class"]:c.setAttribute(d,b[d]));return c},remove:function(a){a=Ink.i(a);var b;a&&(b=a.parentNode)&&b.removeChild(a)},scrollTo:function(a){if(a=e.get(a)){if(a.scrollIntoView)return a.scrollIntoView();var b={},c=0,d=0;do c+=a.offsetTop||0,d+=a.offsetLeft||0,a=a.offsetParent;while(a);b={x:d,y:c},window.scrollTo(b.x,b.y)}},offsetTop:function(a){return e.offset(a)[1]},offsetLeft:function(a){return e.offset(a)[0]},positionedOffset:function(a){var b=0,c=0;a=e.get(a);do if(b+=a.offsetTop||0,c+=a.offsetLeft||0,a=a.offsetParent){if("body"===a.tagName.toLowerCase())break;var d=a.style.position;if(!d&&a.currentStyle&&(d=a.currentStyle.position),(!d||"auto"===d)&&"undefined"!=typeof getComputedStyle){var f=getComputedStyle(a,null);d=f?f.position:null}if("relative"===d||"absolute"===d)break}while(a);return[c,b]},offset:function(b){b=Ink.i(b);var c=[0,0],d=b.ownerDocument,e=d.documentElement,f=a(b),g=d.body,h=e.clientTop||g.clientTop||0,i=e.clientLeft||g.clientLeft||0,j=d.pageYOffset||e.scrollTop||g.scrollTop,k=d.pageXOffset||e.scrollLeft||g.scrollLeft,l=f.top+j-h,m=f.left+k-i;return c=[m,l]},scroll:function(a){return a=a?Ink.i(a):document.body,[window.pageXOffset?window.pageXOffset:a.scrollLeft,window.pageYOffset?window.pageYOffset:a.scrollTop]},_getPropPx:function(a,b){var c,d,e=a.getPropertyValue?a.getPropertyValue(b):a[b];return e?(d=e.indexOf("px"),c=-1===d?0:parseFloat(e,10)):c=0,c},offset2:function(a){return e.offset(a)},hasAttribute:function(a,b){return a=Ink.i(a),a.hasAttribute?a.hasAttribute(b):!!a.getAttribute(b)},insertAfter:function(a,b){(b=e.get(b))&&(null!==b.nextSibling?b.parentNode.insertBefore(a,b.nextSibling):b.parentNode.appendChild(a))},insertBefore:function(a,b){(b=e.get(b))&&b.parentNode.insertBefore(a,b)},insertTop:function(a,b){(b=e.get(b))&&(b.firstChild?b.insertBefore(a,b.firstChild):b.appendChild(a))},insertBottom:function(a,b){b=Ink.i(b),b.appendChild(a)},textContent:function(a){a=Ink.i(a);var b,c,d,f;switch(a&&a.nodeType){case 9:return e.textContent(a.documentElement||a.body&&a.body.parentNode||a.body);case 1:if(b=a.innerText,"undefined"!=typeof b)return b;case 11:if(b=a.textContent,"undefined"!=typeof b)return b;if(a.firstChild===a.lastChild)return e.textContent(a.firstChild);for(b=[],d=a.childNodes,c=0,f=d.length;f>c;++c)b.push(e.textContent(d[c]));return b.join("");case 3:case 4:return a.nodeValue}return""},setTextContent:function(a,b){switch(a=Ink.i(a),a&&a.nodeType){case 1:if("innerText"in a){a.innerText=b;break}case 11:if("textContent"in a){a.textContent=b;break}case 9:for(;a.firstChild;)a.removeChild(a.firstChild);if(""!==b){var c=a.ownerDocument||a;a.appendChild(c.createTextNode(b))}break;case 3:case 4:a.nodeValue=b}},isLink:function(a){var b=a&&1===a.nodeType&&(/^a|area$/i.test(a.tagName)||a.hasAttributeNS&&a.hasAttributeNS("http://www.w3.org/1999/xlink","href"));return!!b},isAncestorOf:function(a,b){if(!b||!a)return!1;if(b.compareDocumentPosition)return 0!==(16&a.compareDocumentPosition(b));for(;b=b.parentNode;)if(b===a)return!0;return!1},descendantOf:function(a,b){return a!==b&&e.isAncestorOf(a,b)},firstElementChild:function(a){if(!a)return null;if("firstElementChild"in a)return a.firstElementChild;for(var b=a.firstChild;b&&1!==b.nodeType;)b=b.nextSibling;return b},lastElementChild:function(a){if(!a)return null;if("lastElementChild"in a)return a.lastElementChild;for(var b=a.lastChild;b&&1!==b.nodeType;)b=b.previousSibling;return b},nextElementSibling:function(a){var b=null;if(!a)return b;if("nextElementSibling"in a)return a.nextElementSibling;for(b=a.nextSibling;b&&1!==b.nodeType;)b=b.nextSibling;return b},previousElementSibling:function(a){var b=null;if(!a)return b;if("previousElementSibling"in a)return a.previousElementSibling;for(b=a.previousSibling;b&&1!==b.nodeType;)b=b.previousSibling;return b},elementWidth:function(a){return"string"==typeof a&&(a=document.getElementById(a)),a.offsetWidth},elementHeight:function(a){return"string"==typeof a&&(a=document.getElementById(a)),a.offsetHeight},elementLeft:function(a){return e.offsetLeft(a)},elementTop:function(a){return e.offsetTop(a)},elementDimensions:function(a){return a=Ink.i(a),[a.offsetWidth,a.offsetHeight]},outerDimensions:function(b){var c=a(b),d=Ink.getModule("Ink.Dom.Css_1"),e=Ink.bindMethod(d,"getStyle",b);return[c.right-c.left+parseFloat(e("marginLeft")||0)+parseFloat(e("marginRight")||0),c.bottom-c.top+parseFloat(e("marginTop")||0)+parseFloat(e("marginBottom")||0)]
|
||
},inViewport:function(b,c){var d=a(Ink.i(b));return"boolean"==typeof c&&(c={partial:c,margin:0}),c=Ink.extendObj({partial:!1,margin:0},c||{}),c.partial?d.bottom+c.margin>0&&d.left-c.margin<e.viewportWidth()&&d.top-c.margin<e.viewportHeight()&&d.right+c.margin>0:d.top+c.margin>0&&d.right-c.margin<e.viewportWidth()&&d.bottom-c.margin<e.viewportHeight()&&d.left+c.margin>0},isHidden:function(a){var b=a.offsetWidth,c=a.offsetHeight,d="tr"===a.tagName.toLowerCase(),e=Ink.getModule("Ink.Dom.Css_1");return 0!==b||0!==c||d?0===b||0===c||d?"none"===e.getStyle(a,"display").toLowerCase():!1:!0},isVisible:function(a){return!this.isHidden(a)},clonePosition:function(a,b){var c=e.offset(b);return a.style.left=c[0]+"px",a.style.top=c[1]+"px",a},ellipsizeText:function(a){(a=Ink.i(a))&&(a.style.overflow="hidden",a.style.whiteSpace="nowrap",a.style.textOverflow="ellipsis")},findUpwardsHaving:function(a,b){for(;a&&1===a.nodeType;){if(b(a))return a;a=a.parentNode}return!1},findUpwardsByClass:function(a,b){var c=new RegExp("(^|\\s)"+b+"(\\s|$)"),d=function(a){var b=a.className;return b&&c.test(b)};return e.findUpwardsHaving(a,d)},findUpwardsByTag:function(a,b){b=b.toUpperCase();var c=function(a){return a.nodeName&&a.nodeName.toUpperCase()===b};return e.findUpwardsHaving(a,c)},findUpwardsById:function(a,b){var c=function(a){return a.id===b};return e.findUpwardsHaving(a,c)},findUpwardsBySelector:function(a,b){var c=Ink.getModule("Ink.Dom.Selector","1");if(!c)throw new Error("This method requires Ink.Dom.Selector");var d=function(a){return c.matchesSelector(a,b)};return e.findUpwardsHaving(a,d)},getChildrenText:function(a,b){var c,d,f,g=a.childNodes,h=g.length,i="";if(!a)return i;for(d=0;h>d;++d)c=g[d],c&&3===c.nodeType&&(f=e._trimString(String(c.data)),f.length>0?(i+=f,b&&a.removeChild(c)):a.removeChild(c));return i},_trimString:function(a){return String.prototype.trim?a.trim():a.replace(/^\s*/,"").replace(/\s*$/,"")},getSelectValues:function(a){for(var b=Ink.i(a),c=[],d=0;d<b.options.length;++d)c.push(b.options[d].value);return c},_normalizeData:function(a){for(var b,c=[],d=0,e=a.length;e>d;++d)b=a[d],b instanceof Array?1===b.length&&b.push(b[0]):b=[b,b],c.push(b);return c},fillSelect:function(a,b,c,d){var f=Ink.i(a);if(f){f.innerHTML="";var g,h;c||(h=document.createElement("option"),h.setAttribute("value",""),f.appendChild(h)),b=e._normalizeData(b);for(var i=0,j=b.length;j>i;++i)g=b[i],h=document.createElement("option"),h.setAttribute("value",g[0]),g.length>2&&h.setAttribute("extra",g[2]),h.appendChild(document.createTextNode(g[1])),g[0]===d&&h.setAttribute("selected","selected"),f.appendChild(h)}},fillRadios:function(a,b,c,d,f,g){a=Ink.i(a);var h=document.createElement("span");e.insertAfter(h,a),c=e._normalizeData(c);var i,j;d||(j=document.createElement("input"),j.setAttribute("type","radio"),j.setAttribute("name",b),j.setAttribute("value",""),h.appendChild(j),g&&h.appendChild(document.createElement(g)));for(var k=0;k<c.length;++k)i=c[k],j=document.createElement("input"),j.setAttribute("type","radio"),j.setAttribute("name",b),j.setAttribute("value",i[0]),h.appendChild(j),h.appendChild(document.createTextNode(i[1])),g&&h.appendChild(document.createElement(g)),i[0]===f&&(j.checked=!0);return h},fillChecks:function(a,b,c,d,f){a=Ink.i(a);var g=document.createElement("span");e.insertAfter(g,a),c=e._normalizeData(c),"]"!==b.substring(b.length-1)&&(b+="[]");for(var h,i,j=0;j<c.length;++j)h=c[j],i=document.createElement("input"),i.setAttribute("type","checkbox"),i.setAttribute("name",b),i.setAttribute("value",h[0]),g.appendChild(i),g.appendChild(document.createTextNode(h[1])),f&&g.appendChild(document.createElement(f)),h[0]===d&&(i.checked=!0);return g},parentIndexOf:function(a,b){for(var c,d=0,e=0,f=a.childNodes.length;f>e;++e)if(c=a.childNodes[e],1===c.nodeType){if(c===b)return d;++d}return-1},nextSiblings:function(a){if(a=Ink.i(a),"object"==typeof a&&null!==a&&a.nodeType&&1===a.nodeType){for(var b=[],c=a.parentNode.children,d=e.parentIndexOf(a.parentNode,a),f=++d,g=c.length;g>f;f++)b.push(c[f]);return b}return[]},previousSiblings:function(a){if(a=Ink.i(a),"object"==typeof a&&null!==a&&a.nodeType&&1===a.nodeType){for(var b=[],c=a.parentNode.children,d=e.parentIndexOf(a.parentNode,a),f=0,g=d;g>f;f++)b.push(c[f]);return b}return[]},siblings:function(a){if(a=Ink.i(a),"object"==typeof a&&null!==a&&a.nodeType&&1===a.nodeType){for(var b=[],c=a.parentNode.children,d=0,e=c.length;e>d;d++)a!==c[d]&&b.push(c[d]);return b}return[]},childElementCount:function(a){return a=Ink.i(a),"childElementCount"in a?a.childElementCount:a?e.siblings(a).length+1:0},_wrapElements:{TABLE:function(a,b){return a.innerHTML=d?"<table>"+b+"<tbody><tr><td>"+c+"</tr></td></tbody></table>":"<table>"+b+"</table>",a.firstChild},TBODY:function(a,b){return a.innerHTML="<table><tbody>"+b+"</tbody></table>",a.firstChild.getElementsByTagName("tbody")[0]},THEAD:function(a,b){return a.innerHTML="<table><thead>"+b+"</thead><tbody></tbody></table>",a.firstChild.getElementsByTagName("thead")[0]},TFOOT:function(a,b){return a.innerHTML="<table><tfoot>"+b+"</tfoot><tbody></tbody></table>",a.firstChild.getElementsByTagName("tfoot")[0]},TR:function(a,b){return a.innerHTML="<table><tbody><tr>"+b+"</tr></tbody></table>",a.firstChild.firstChild.firstChild}},_getWrapper:function(a,b){var f=a.nodeName&&a.nodeName.toUpperCase(),g=document.createElement("div"),h=e._wrapElements[f];if(!h)return g.innerHTML=b,g;if(g=h(g,b),d&&"TABLE"===f)for(var i=g.getElementsByTagName("td"),j=0,k=i.length;k>j;j++)if(i[j].innerHTML===c){var l=i[j].parentNode.parentNode;l.parentNode.removeChild(l)}return g},appendHTML:function(a,b){if(a=Ink.i(a),null!==a)for(var c=e._getWrapper(a,b);c.firstChild;)a.appendChild(c.firstChild)},prependHTML:function(a,b){if(a=Ink.i(a),null!==a)for(var c=e._getWrapper(a,b);c.lastChild;)a.insertBefore(c.lastChild,a.firstChild)},setHTML:function(a,b){if(a=Ink.i(a),null!==a)try{a.innerHTML=b}catch(c){for(;a.firstChild;)a.removeChild(a.firstChild);e.appendHTML(a,b)}},wrap:function(a,b){a=Ink.i(a),b=Ink.i(b);var c=a.nextSibling,d=a.parentNode;return b.appendChild(a),null!==c?d.insertBefore(b,c):d.appendChild(b),b},unwrap:function(a,b){a=Ink.i(a);var c;c="string"==typeof b?e.findUpwardsBySelector(a,b):"object"==typeof b&&b.tagName?e.findUpwardsHaving(a,function(a){return a===b}):a.parentNode,c&&c.parentNode&&e.insertBefore(a,c)},replace:function(a,b){a=Ink.i(a),null!==a&&a.parentNode.replaceChild(b,a)},removeTextNodeChildren:function(a){if(a=Ink.i(a),null!==a){var b,c,d=a;for(a=a.firstChild;a;)c=3===a.nodeType,b=a,a=a.nextSibling,c&&d.removeChild(b)}},htmlToFragment:b?function(a){var b;return"string"!=typeof a?document.createDocumentFragment():(b=document.createRange(),b.selectNode(document.body),b.createContextualFragment(a))}:function(a){var b=document.createDocumentFragment(),c,d;if("string"!=typeof a)return b;for(c=document.createElement("div"),c.innerHTML=a;d=c.firstChild;)b.appendChild(d);return b},_camelCase:function(a){return a?a.replace(/-(\w)/g,function(a,b){return b.toUpperCase()}):a},data:function(a){var b;if("object"!=typeof a&&"string"!=typeof a)throw"[Ink.Dom.Element.data] :: Invalid selector defined";if("object"==typeof a)b=a;else{var c=Ink.getModule("Ink.Dom.Selector",1);if(!c)throw"[Ink.Dom.Element.data] :: this method requires Ink.Dom.Selector - v1";if(b=c.select(a),b.length<=0)throw"[Ink.Dom.Element.data] :: Can't find any element with the specified selector";b=b[0]}var d={},f=b.attributes||[],g,h,i;if(f)for(var j=0,k=f.length;k>j;++j)g=f[j],h=g.name,i=g.value,h&&0===h.indexOf("data-")&&(d[e._camelCase(h.replace("data-",""))]=i);return d},moveCursorTo:function(a,b){if(a=Ink.i(a),null!==a)if(a.setSelectionRange)a.setSelectionRange(b,b);else{var c=a.createTextRange();c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",b),c.select()}},pageWidth:function(){var a;a=window.innerWidth&&window.scrollMaxX?window.innerWidth+window.scrollMaxX:document.body.scrollWidth>document.body.offsetWidth?document.body.scrollWidth:document.body.offsetWidth;var b;return window.self.innerWidth?b=document.documentElement.clientWidth?document.documentElement.clientWidth:window.self.innerWidth:document.documentElement&&document.documentElement.clientWidth?b=document.documentElement.clientWidth:document.body&&(b=document.body.clientWidth),b>a?a:b},pageHeight:function(){var a;a=window.innerHeight&&window.scrollMaxY?window.innerHeight+window.scrollMaxY:document.body.scrollHeight>document.body.offsetHeight?document.body.scrollHeight:document.body.offsetHeight;var b;return window.self.innerHeight?b=window.self.innerHeight:document.documentElement&&document.documentElement.clientHeight?b=document.documentElement.clientHeight:document.body&&(b=document.body.clientHeight),b>a?b:a},viewportWidth:function(){return"undefined"!=typeof window.innerWidth?window.innerWidth:document.documentElement&&"undefined"!=typeof document.documentElement.offsetWidth?document.documentElement.offsetWidth:void 0},viewportHeight:function(){return"undefined"!=typeof window.innerHeight?window.innerHeight:document.documentElement&&"undefined"!=typeof document.documentElement.offsetHeight?document.documentElement.offsetHeight:void 0},scrollWidth:function(){return"undefined"!=typeof window.self.pageXOffset?window.self.pageXOffset:"undefined"!=typeof document.documentElement&&"undefined"!=typeof document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft},scrollHeight:function(){return"undefined"!=typeof window.self.pageYOffset?window.self.pageYOffset:"undefined"!=typeof document.documentElement&&"undefined"!=typeof document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop}};return e}),Ink.createModule("Ink.Dom.Event",1,[],function(){var a=function(a,b,c){return c()}("bean",this,function(a,b){a=a||"bean",b=b||this;var c=window,d=b[a],e=/[^\.]*(?=\..*)\.|.*/,f=/\..*/,g="addEventListener",h="removeEventListener",i=document||{},j=i.documentElement||{},k=j[g],l=k?g:"attachEvent",m={},n=Array.prototype.slice,o=function(a,b){return a.split(b||" ")},p=function(a){return"string"==typeof a},q=function(a){return"function"==typeof a},r="click dblclick mouseup mousedown contextmenu mousewheel mousemultiwheel DOMMouseScroll mouseover mouseout mousemove selectstart selectend keydown keypress keyup orientationchange focus blur change reset select submit load unload beforeunload resize move DOMContentLoaded readystatechange message error abort scroll ",s="show input invalid touchstart touchmove touchend touchcancel gesturestart gesturechange gestureend textinputreadystatechange pageshow pagehide popstate hashchange offline online afterprint beforeprint dragstart dragenter dragover dragleave drag drop dragend loadstart progress suspend emptied stalled loadmetadata loadeddata canplay canplaythrough playing waiting seeking seeked ended durationchange timeupdate play pause ratechange volumechange cuechange checking noupdate downloading cached updateready obsolete ",t=function(a,b,c){for(c=0;c<b.length;c++)b[c]&&(a[b[c]]=1);return a}({},o(r+(k?s:""))),u=function(){var a="compareDocumentPosition"in j?function(a,b){return b.compareDocumentPosition&&16===(16&b.compareDocumentPosition(a))}:"contains"in j?function(a,b){return b=9===b.nodeType||b===window?j:b,b!==a&&b.contains(a)}:function(a,b){for(;a=a.parentNode;)if(a===b)return 1;return 0},b=function(b){var c=b.relatedTarget;return c?c!==this&&"xul"!==c.prefix&&!/document/.test(this.toString())&&!a(c,this):null==c};return{mouseenter:{base:"mouseover",condition:b},mouseleave:{base:"mouseout",condition:b},mousewheel:{base:/Firefox/.test(navigator.userAgent)?"DOMMouseScroll":"mousewheel"}}}(),v=function(){var a=o("altKey attrChange attrName bubbles cancelable ctrlKey currentTarget detail eventPhase getModifierState isTrusted metaKey relatedNode relatedTarget shiftKey srcElement target timeStamp type view which propertyName"),b=a.concat(o("button buttons clientX clientY dataTransfer fromElement offsetX offsetY pageX pageY screenX screenY toElement")),d=b.concat(o("wheelDelta wheelDeltaX wheelDeltaY wheelDeltaZ axis")),e=a.concat(o("char charCode key keyCode keyIdentifier keyLocation location")),f=a.concat(o("data")),g=a.concat(o("touches targetTouches changedTouches scale rotation")),h=a.concat(o("data origin source")),k=a.concat(o("state")),l=/over|out/,m=[{reg:/key/i,fix:function(a,b){return b.keyCode=a.keyCode||a.which,e}},{reg:/click|mouse(?!(.*wheel|scroll))|menu|drag|drop/i,fix:function(a,c,d){return c.rightClick=3===a.which||2===a.button,c.pos={x:0,y:0},a.pageX||a.pageY?(c.clientX=a.pageX,c.clientY=a.pageY):(a.clientX||a.clientY)&&(c.clientX=a.clientX+i.body.scrollLeft+j.scrollLeft,c.clientY=a.clientY+i.body.scrollTop+j.scrollTop),l.test(d)&&(c.relatedTarget=a.relatedTarget||a[("mouseover"==d?"from":"to")+"Element"]),b}},{reg:/mouse.*(wheel|scroll)/i,fix:function(){return d}},{reg:/^text/i,fix:function(){return f}},{reg:/^touch|^gesture/i,fix:function(){return g}},{reg:/^message$/i,fix:function(){return h}},{reg:/^popstate$/i,fix:function(){return k}},{reg:/.*/,fix:function(){return a}}],n={},p=function(a,b,d){if(arguments.length&&(a=a||((b.ownerDocument||b.document||b).parentWindow||c).event,this.originalEvent=a,this.isNative=d,this.isBean=!0,a)){var e=a.type,f=a.target||a.srcElement,g,h,i,j,k;if(this.target=f&&3===f.nodeType?f.parentNode:f,d){if(k=n[e],!k)for(g=0,h=m.length;h>g;g++)if(m[g].reg.test(e)){n[e]=k=m[g].fix;break}for(j=k(a,this,e),g=j.length;g--;)!((i=j[g])in this)&&i in a&&(this[i]=a[i])}}};return p.prototype.preventDefault=function(){this.originalEvent.preventDefault?this.originalEvent.preventDefault():this.originalEvent.returnValue=!1},p.prototype.stopPropagation=function(){this.originalEvent.stopPropagation?this.originalEvent.stopPropagation():this.originalEvent.cancelBubble=!0},p.prototype.stop=function(){this.preventDefault(),this.stopPropagation(),this.stopped=!0},p.prototype.stopImmediatePropagation=function(){this.originalEvent.stopImmediatePropagation&&this.originalEvent.stopImmediatePropagation(),this.isImmediatePropagationStopped=function(){return!0}},p.prototype.isImmediatePropagationStopped=function(){return this.originalEvent.isImmediatePropagationStopped&&this.originalEvent.isImmediatePropagationStopped()},p.prototype.clone=function(a){var b=new p(this,this.element,this.isNative);return b.currentTarget=a,b},p}(),w=function(a,b){return k||b||a!==i&&a!==c?a:j},x=function(){var a=function(a,b,c,d){var e=function(c,e){return b.apply(a,d?n.call(e,c?0:1).concat(d):e)},f=function(c,d){return b.__beanDel?b.__beanDel.ft(c.target,a):d},g=c?function(a){var b=f(a,this);return c.apply(b,arguments)?(a&&(a.currentTarget=b),e(a,arguments)):void 0}:function(a){return b.__beanDel&&(a=a.clone(f(a))),e(a,arguments)};return g.__beanDel=b.__beanDel,g},b=function(b,c,d,e,f,g,h){var i=u[c],j;"unload"==c&&(d=D(E,b,c,d,e)),i&&(i.condition&&(d=a(b,d,i.condition,g)),c=i.base||c),this.isNative=j=t[c]&&!!b[l],this.customType=!k&&!j&&c,this.element=b,this.type=c,this.original=e,this.namespaces=f,this.eventType=k||j?c:"propertychange",this.target=w(b,j),this[l]=!!this.target[l],this.root=h,this.handler=a(b,d,null,g)};return b.prototype.inNamespaces=function(a){var b,c,d=0;if(!a)return!0;if(!this.namespaces)return!1;for(b=a.length;b--;)for(c=this.namespaces.length;c--;)a[b]==this.namespaces[c]&&d++;return a.length===d},b.prototype.matches=function(a,b,c){return!(this.element!==a||b&&this.original!==b||c&&this.handler!==c)},b}(),y=function(){var a={},b=function(c,d,e,f,g,h){var i=g?"r":"$";if(d&&"*"!=d){var j=0,k,l=a[i+d],m="*"==c;if(!l)return;for(k=l.length;k>j;j++)if((m||l[j].matches(c,e,f))&&!h(l[j],l,j,d))return}else for(var n in a)n.charAt(0)==i&&b(c,n.substr(1),e,f,g,h)},c=function(b,c,d,e){var f,g=a[(e?"r":"$")+c];if(g)for(f=g.length;f--;)if(!g[f].root&&g[f].matches(b,d,null))return!0;return!1},d=function(a,c,d,e){var f=[];return b(a,c,d,null,e,function(a){return f.push(a)}),f},e=function(b){var c=!b.root&&!this.has(b.element,b.type,null,!1),d=(b.root?"r":"$")+b.type;return(a[d]||(a[d]=[])).push(b),c},f=function(c){b(c.element,c.type,null,c.handler,c.root,function(b,c,d){return c.splice(d,1),b.removed=!0,0===c.length&&delete a[(b.root?"r":"$")+b.type],!1})},g=function(){var b,c=[];for(b in a)"$"==b.charAt(0)&&(c=c.concat(a[b]));return c};return{has:c,get:d,put:e,del:f,entries:g}}(),z,A=function(a){z=arguments.length?a:i.querySelectorAll?function(a,b){return b.querySelectorAll(a)}:function(){throw new Error("Bean: No selector engine installed")}},B=function(a,b){if(k||!b||!a||a.propertyName=="_on"+b){var c=y.get(this,b||a.type,null,!1),d=c.length,e=0;for(a=new v(a,this,!0),b&&(a.type=b);d>e&&!a.isImmediatePropagationStopped();e++)c[e].removed||c[e].handler.call(this,a)}},C=k?function(a,b,c){a[c?g:h](b,B,!1)}:function(a,b,c,d){var e;c?(y.put(e=new x(a,d||b,function(b){B.call(a,b,d)},B,null,null,!0)),d&&null==a["_on"+d]&&(a["_on"+d]=0),e.target.attachEvent("on"+e.eventType,e.handler)):(e=y.get(a,d||b,B,!0)[0],e&&(e.target.detachEvent("on"+e.eventType,e.handler),y.del(e)))},D=function(a,b,c,d,e){return function(){d.apply(this,arguments),a(b,c,e)}},E=function(a,b,c,d){var e=b&&b.replace(f,""),g=y.get(a,e,null,!1),h={},i,j;for(i=0,j=g.length;j>i;i++)c&&g[i].original!==c||!g[i].inNamespaces(d)||(y.del(g[i]),!h[g[i].eventType]&&g[i][l]&&(h[g[i].eventType]={t:g[i].eventType,c:g[i].type}));for(i in h)y.has(a,h[i].t,null,!1)||C(a,h[i].t,!1,h[i].c)},F=function(a,b){var c=function(b,c){for(var d,e=p(a)?z(a,c):a;b&&b!==c;b=b.parentNode)for(d=e.length;d--;)if(e[d]===b)return b},d=function(a){var d=c(a.target,this);d&&b.apply(d,arguments)};return d.__beanDel={ft:c,selector:a},d},G=k?function(a,b,d){var e=i.createEvent(a?"HTMLEvents":"UIEvents");e[a?"initEvent":"initUIEvent"](b,!0,!0,c,1),d.dispatchEvent(e)}:function(a,b,c){c=w(c,a),a?c.fireEvent("on"+b,i.createEventObject()):c["_on"+b]++},H=function(a,b,c){var d=p(b),g,h,i,j;if(d&&b.indexOf(" ")>0){for(b=o(b),j=b.length;j--;)H(a,b[j],c);return a}if(h=d&&b.replace(f,""),h&&u[h]&&(h=u[h].base),!b||d)(i=d&&b.replace(e,""))&&(i=o(i,".")),E(a,h,c,i);else if(q(b))E(a,null,b);else for(g in b)b.hasOwnProperty(g)&&H(a,g,b[g]);return a},I=function(a,b,c,d){var g,h,i,j,k,p,r;{if(void 0!==c||"object"!=typeof b){for(q(c)?(k=n.call(arguments,3),d=g=c):(g=d,k=n.call(arguments,4),d=F(c,g,z)),i=o(b),this===m&&(d=D(H,a,b,d,g)),j=i.length;j--;)r=y.put(p=new x(a,i[j].replace(f,""),d,g,o(i[j].replace(e,""),"."),k,!1)),p[l]&&r&&C(a,p.eventType,!0,p.customType);return a}for(h in b)b.hasOwnProperty(h)&&I.call(this,a,h,b[h])}},J=function(a,b,c,d){return I.apply(null,p(c)?[a,c,b,d].concat(arguments.length>3?n.call(arguments,5):[]):n.call(arguments))},K=function(){return I.apply(m,arguments)},L=function(a,b,c){var d=o(b),g,h,i,j,k;for(g=d.length;g--;)if(b=d[g].replace(f,""),(j=d[g].replace(e,""))&&(j=o(j,".")),j||c||!a[l])for(k=y.get(a,b,null,!1),c=[!1].concat(c),h=0,i=k.length;i>h;h++)k[h].inNamespaces(j)&&k[h].handler.apply(a,c);else G(t[b],b,a);return a},M=function(a,b,c){for(var d=y.get(b,c,null,!1),e=d.length,f=0,g,h;e>f;f++)d[f].original&&(g=[a,d[f].type],(h=d[f].handler.__beanDel)&&g.push(h.selector),g.push(d[f].original),I.apply(null,g));return a},N={on:I,add:J,one:K,off:H,remove:H,clone:M,fire:L,Event:v,setSelectorEngine:A,noConflict:function(){return b[a]=d,this}};if(c.attachEvent){var O=function(){var a,b=y.entries();for(a in b)b[a].type&&"unload"!==b[a].type&&H(b[a].element,b[a].type);c.detachEvent("onunload",O),c.CollectGarbage&&c.CollectGarbage()};c.attachEvent("onunload",O)}return A(Ink.ss),N}),b={KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_SPACE:32,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY_PAGEDOWN:34,KEY_INSERT:45,throttle:function(a,b){b=b||0;var c=0,d,e=function(){var f=+new Date,g=f-c;if(g>=b)return c=f,a.apply(this,[].slice.call(arguments));var h=this,i=[].slice.call(arguments);d||(d=setTimeout(function(){return d=null,e.apply(h,i)},b-g))};return e},element:function(a){var b=a.delegationTarget||a.target||"mouseout"===a.type&&a.fromElement||"mouseleave"===a.type&&a.fromElement||"mouseover"===a.type&&a.toElement||"mouseenter"===a.type&&a.toElement||a.srcElement||null;return!b||3!==b.nodeType&&4!==b.nodeType?b:b.parentNode},relatedTarget:function(a){var b=a.relatedTarget||"mouseout"===a.type&&a.toElement||"mouseleave"===a.type&&a.toElement||"mouseover"===a.type&&a.fromElement||"mouseenter"===a.type&&a.fromElement||null;return!b||3!==b.nodeType&&4!==b.nodeType?b:b.parentNode},findElement:function(a,b,c){for(var d=this.element(a);;){if(d.nodeName.toLowerCase()===b.toLowerCase())return d;if(d=d.parentNode,!d)return c?!1:document;if(!d.parentNode)return c?!1:document}},observe:function(a,b,c,d){return a=Ink.i(a),a?(a.addEventListener?a.addEventListener(b,c,!!d):a.attachEvent("on"+b,c=Ink.bind(c,a)),c):void 0},observeOnce:function(a,c,d,e){var f=function(){return b.stopObserving(a,c,f),d()};return b.observe(a,c,f,e)},observeMulti:function(a,b,c,d){if("string"==typeof a?a=Ink.ss(a):a&&1===a.nodeType&&(a=[a]),!a[0])return!1;for(var e=0,f=a.length;f>e;e++)this.observe(a[e],b,c,d);return c},observeDelegated:function(a,c,d,e){return b.observe(a,c,function(c){var f=b.element(c);if(f&&f!==a)for(var g=f;g!==a&&g!==document&&g;){if(Ink.Dom.Selector_1.matchesSelector(g,d))return c.delegationTarget=g,e(c);g=g.parentNode}})},stopObserving:function(a,b,c,d){a=Ink.i(a),a&&(a.removeEventListener?a.removeEventListener(b,c,!!d):a.detachEvent("on"+b,c))},stop:function(a){null!==a.cancelBubble&&(a.cancelBubble=!0),a.stopPropagation&&a.stopPropagation(),a.preventDefault&&a.preventDefault(),window.attachEvent&&(a.returnValue=!1),null!==a.cancel&&(a.cancel=!0)},stopPropagation:function(a){null!==a.cancelBubble&&(a.cancelBubble=!0),a.stopPropagation&&a.stopPropagation()},stopDefault:function(a){a.preventDefault&&a.preventDefault(),window.attachEvent&&(a.returnValue=!1),null!==a.cancel&&(a.cancel=!0)},pointer:function(a){return{x:this.pointerX(a),y:this.pointerY(a)}},pointerX:function(a){return a.touches&&a.touches[0]&&a.touches[0].clientX||a.pageX||a.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft)},pointerY:function(a){return a.touches&&a.touches[0]&&a.touches[0].clientY||a.pageY||a.clientY+(document.documentElement.scrollTop||document.body.scrollTop)},isLeftClick:function(a){if(window.addEventListener){if(0===a.button)return!0;if("touchend"===a.type&&null===a.button)return!0}else if(1===a.button)return!0;return!1},isRightClick:function(a){return 2===a.button},isMiddleClick:function(a){return window.addEventListener?1===a.button:4===a.button;return!1},getCharFromKeyboardEvent:function(a,b){var c=a.keyCode,d=String.fromCharCode(c),e=a.shiftKey;if(c>=65&&90>=c)return"boolean"==typeof b&&(e=b),e?d:d.toLowerCase();if(c>=96&&105>=c)return String.fromCharCode(48+(c-96));switch(c){case 109:case 189:return"-";case 107:case 187:return"+"}return d},debug:function(){}};return Ink.extendObj(b,a)}),Ink.createModule("Ink.Dom.FormSerialize",1,["Ink.Util.Array_1","Ink.Dom.Element_1","Ink.Dom.Selector_1"],function(a,b,c){"use strict";function d(c){return null!=c&&!b.isDOMElement(c)&&(a.isArray(c)||"string"!=typeof c&&"number"==typeof c.length)}function e(a){return d(a)?a:[a]}var f={serialize:function(b){var c={},d={},e=this.asPairs(b,{elements:!0,emptyArray:d});return null==e?e:(a.forEach(e,function(a){var b=a[0].replace(/\[\]$/,""),e=a[1],g=a[2];e===d?c[b]=[]:f._resultsInArray(g)||/\[\]$/.test(a[0])?(c[b]=c[b]||[],c[b].push(e)):c[b]=e}),c)},asPairs:function(b,d){function e(a,b,c){h.push(d.elements?[a,b,c]:[a,b])}function g(b){if("select"===b.nodeName.toLowerCase()&&b.multiple){var f=!1;a.forEach(c.select("option:checked",b),function(a){e(b.name,a.value,b),f=!0}),!f&&"emptyArray"in d&&e(b.name,d.emptyArray,b)}else e(b.name,b.value,b)}var h=[];if(d=d||{},b=Ink.i(b)){for(var i=a.filter(b.elements,f._isSerialized),j=0,k=i.length;k>j;j++)g(i[j]);return h}return null},fillIn:function(a,b){if(!(a=Ink.i(a)))return null;var c;if("object"!=typeof b||d(b)){if(!d(b))return null;c=b}else c=f._objToPairs(b);return f._fillInPairs(a,c)},_objToPairs:function(a){var b=[],c;for(var d in a)if(a.hasOwnProperty(d)){c=e(a[d]);for(var f=0,g=c.length;g>f;f++)b.push([d,c[f]]);0===g&&b.push([d,[]])}return b},_fillInPairs:function(b,c){c=a.groupBy(c,{key:function(a){return a[0].replace(/\[\]$/,"")}}),c=a.map(c,function(b){var c=a.reduce(b,function(a,b){return[null,a[1].concat([b[1]])]},[null,[]])[1];return[b[0][0],c]});for(var d,g,h,i=0,j=c.length;j>i;i++){if(d=c[i][0],d in b)g=b[d];else{if(!(d+"[]"in b))continue;g=b[d+"[]"],d+="[]"}g=e(g),h=c[i][1],f._fillInOne(d,g,h)}},_fillInOne:function(a,c,d){var e=c[0],g=e.nodeName.toLowerCase(),h=e.getAttribute("type");h=h&&h.toLowerCase();var i="select"===g&&b.hasAttribute(e,"multiple");if("checkbox"===h||"radio"===h)f._fillInBoolean(c,d,"checked");else if(i)f._fillInBoolean(c[0].options,d,"selected");else{c.length!==d.length&&Ink.warn("Form had "+c.length+' inputs named "'+a+'", but received '+d.length+" values.");for(var j=0,k=Math.min(c.length,d.length);k>j;j+=1)c[j].value=d[j]}},_fillInBoolean:function(b,c,d){a.forEach(b,function(b){var e=a.inArray(b.value,c);b[d]=e})},_resultsInArray:function(a){var c=a.getAttribute("type"),d=a.nodeName.toLowerCase();return"checkbox"===c||"select"===d&&b.hasAttribute(a,"multiple")},_isSerialized:function(a){if(!b.isDOMElement(a))return!1;if(!b.hasAttribute(a,"name"))return!1;var c=a.nodeName.toLowerCase();return c&&"fieldset"!==c?"checkbox"===a.type||"radio"===a.type?!!a.checked:!0:!1}};return f}),Ink.createModule("Ink.Dom.Loaded",1,[],function(){"use strict";var a={_contexts:[],run:function(a,b){b||(b=a,a=window);for(var c,d=0,e=this._contexts.length;e>d;d++)if(this._contexts[d][0]===a){c=this._contexts[d][1];break}c||(c={cbQueue:[],win:a,doc:a.document,root:a.document.documentElement,done:!1,top:!0},c.handlers={checkState:Ink.bindEvent(this._checkState,this,c),poll:Ink.bind(this._poll,this,c)},this._contexts.push([a,c]));var f=c.doc.addEventListener;c.add=f?"addEventListener":"attachEvent",c.rem=f?"removeEventListener":"detachEvent",c.pre=f?"":"on",c.det=f?"DOMContentLoaded":"onreadystatechange",c.wet=c.pre+"load";var g=c.handlers.checkState,h=/complete|interactive|loaded/.test(c.doc.readyState)&&"about:blank"!==c.win.location.toString();if(h)setTimeout(Ink.bind(function(){b.call(c.win,"lazy")},this),0);else{c.cbQueue.push(b),c.doc[c.add](c.det,g),c.win[c.add](c.wet,g);var i=1;try{i=c.win.frameElement}catch(j){}if(!f&&c.root&&c.root.doScroll){try{c.top=!i}catch(j){}c.top&&this._poll(c)}}},_checkState:function(a,b){if(a&&("readystatechange"!==a.type||"complete"===b.doc.readyState)){var c="load"===a.type?b.win:b.doc;c[b.rem](b.pre+a.type,b.handlers.checkState,!1),this._ready(b)}},_poll:function(a){try{a.root.doScroll("left")}catch(b){return setTimeout(a.handlers.poll,50)}this._ready(a)},_ready:function(a){if(!a.done){a.done=!0;for(var b=0;b<a.cbQueue.length;++b)a.cbQueue[b].call(a.win);a.cbQueue=[]}}};return a}),Ink.createModule("Ink.Dom.Selector",1,[],function(){"use strict";function a(a){return ob.test(a+"")}function b(){var a,b=[];return a=function(c,d){return b.push(c+=" ")>w.cacheLength&&delete a[b.shift()],a[c]=d}}function c(a){return a[L]=!0,a}function d(a){var b=E.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b=null}}function e(a,b,c,d){var e,f,g,h,i,l,m,n,o,p;if((b?b.ownerDocument||b:M)!==E&&D(b),b=b||E,c=c||[],!a||"string"!=typeof a)return c;if(1!==(h=b.nodeType)&&9!==h)return[];if(G&&!d){if(e=pb.exec(a))if(g=e[1]){if(9===h){if(f=b.getElementById(g),!f||!f.parentNode)return c;if(f.id===g)return c.push(f),c}else if(b.ownerDocument&&(f=b.ownerDocument.getElementById(g))&&K(b,f)&&f.id===g)return c.push(f),c}else{if(e[2])return $.apply(c,b.getElementsByTagName(a)),c;if((g=e[3])&&N.getElementsByClassName&&b.getElementsByClassName)return $.apply(c,b.getElementsByClassName(g)),c}if(N.qsa&&!H.test(a)){if(m=!0,n=L,o=b,p=9===h&&a,1===h&&"object"!==b.nodeName.toLowerCase()){for(l=j(a),(m=b.getAttribute("id"))?n=m.replace(sb,"\\$&"):b.setAttribute("id",n),n="[id='"+n+"'] ",i=l.length;i--;)l[i]=n+k(l[i]);o=nb.test(a)&&b.parentNode||b,p=l.join(",")}if(p)try{return $.apply(c,o.querySelectorAll(p)),c}catch(q){}finally{m||b.removeAttribute("id")}}}return s(a.replace(hb,"$1"),b,c,d)}function f(a,b){var c=b&&a,d=c&&(~b.sourceIndex||W)-(~a.sourceIndex||W);if(d)return d;if(c)for(;c=c.nextSibling;)if(c===b)return-1;return a?1:-1}function g(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function h(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function i(a){return c(function(b){return b=+b,c(function(c,d){for(var e,f=a([],c.length,b),g=f.length;g--;)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function j(a,b){var c,d,f,g,h,i,j,k=R[a+" "];if(k)return b?0:k.slice(0);for(h=a,i=[],j=w.preFilter;h;){(!c||(d=ib.exec(h)))&&(d&&(h=h.slice(d[0].length)||h),i.push(f=[])),c=!1,(d=jb.exec(h))&&(c=d.shift(),f.push({value:c,type:d[0].replace(hb," ")}),h=h.slice(c.length));for(g in w.filter)!(d=mb[g].exec(h))||j[g]&&!(d=j[g](d))||(c=d.shift(),f.push({value:c,type:g,matches:d}),h=h.slice(c.length));if(!c)break}return b?h.length:h?e.error(a):R(a,i).slice(0)}function k(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function l(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=P++;return b.first?function(b,c,f){for(;b=b[d];)if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j,k=O+" "+f;if(g){for(;b=b[d];)if((1===b.nodeType||e)&&a(b,c,g))return!0}else for(;b=b[d];)if(1===b.nodeType||e)if(j=b[L]||(b[L]={}),(i=j[d])&&i[0]===k){if((h=i[1])===!0||h===v)return h===!0}else if(i=j[d]=[k],i[1]=a(b,c,g)||v,i[1]===!0)return!0}}function m(a){return a.length>1?function(b,c,d){for(var e=a.length;e--;)if(!a[e](b,c,d))return!1;return!0}:a[0]}function n(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 o(a,b,d,e,f,g){return e&&!e[L]&&(e=o(e)),f&&!f[L]&&(f=o(f,g)),c(function(c,g,h,i){var j,k,l,m=[],o=[],p=g.length,q=c||r(b||"*",h.nodeType?[h]:h,[]),s=!a||!c&&b?q:n(q,m,a,h,i),t=d?f||(c?a:p||e)?[]:g:s;if(d&&d(s,t,h,i),e)for(j=n(t,o),e(j,[],h,i),k=j.length;k--;)(l=j[k])&&(t[o[k]]=!(s[o[k]]=l));if(c){if(f||a){if(f){for(j=[],k=t.length;k--;)(l=t[k])&&j.push(s[k]=l);f(null,t=[],j,i)}for(k=t.length;k--;)(l=t[k])&&(j=f?ab.call(c,l):m[k])>-1&&(c[j]=!(g[j]=l))}}else t=n(t===g?t.splice(p,t.length):t),f?f(null,g,t,i):$.apply(g,t)})}function p(a){for(var b,c,d,e=a.length,f=w.relative[a[0].type],g=f||w.relative[" "],h=f?1:0,i=l(function(a){return a===b},g,!0),j=l(function(a){return ab.call(b,a)>-1},g,!0),n=[function(a,c,d){return!f&&(d||c!==A)||((b=c).nodeType?i(a,c,d):j(a,c,d))}];e>h;h++)if(c=w.relative[a[h].type])n=[l(m(n),c)];else{if(c=w.filter[a[h].type].apply(null,a[h].matches),c[L]){for(d=++h;e>d&&!w.relative[a[d].type];d++);return o(h>1&&m(n),h>1&&k(a.slice(0,h-1)).replace(hb,"$1"),c,d>h&&p(a.slice(h,d)),e>d&&p(a=a.slice(d)),e>d&&k(a))}n.push(c)}return m(n)}function q(a,b){var d=0,f=b.length>0,g=a.length>0,h=function(c,h,i,j,k){var l,m,o,p=[],q=0,r="0",s=c&&[],t=null!=k,u=A,x=c||g&&w.find.TAG("*",k&&h.parentNode||h),y=O+=null==u?1:Math.random()||.1;for(t&&(A=h!==E&&h,v=d);null!=(l=x[r]);r++){if(g&&l){for(m=0;o=a[m++];)if(o(l,h,i)){j.push(l);break}t&&(O=y,v=++d)}f&&((l=!o&&l)&&q--,c&&s.push(l))}if(q+=r,f&&r!==q){for(m=0;o=b[m++];)o(s,p,h,i);if(c){if(q>0)for(;r--;)s[r]||p[r]||(p[r]=Y.call(j));p=n(p)}$.apply(j,p),t&&!c&&p.length>0&&q+b.length>1&&e.uniqueSort(j)}return t&&(O=y,A=u),s};return f?c(h):h}function r(a,b,c){for(var d=0,f=b.length;f>d;d++)e(a,b[d],c);return c}function s(a,b,c,d){var e,f,g,h,i,l=j(a);if(!d&&1===l.length){if(f=l[0]=l[0].slice(0),f.length>2&&"ID"===(g=f[0]).type&&9===b.nodeType&&G&&w.relative[f[1].type]){if(b=(w.find.ID(g.matches[0].replace(ub,vb),b)||[])[0],!b)return c;a=a.slice(f.shift().value.length)}for(e=mb.needsContext.test(a)?0:f.length;e--&&(g=f[e],!w.relative[h=g.type]);)if((i=w.find[h])&&(d=i(g.matches[0].replace(ub,vb),nb.test(f[0].type)&&b.parentNode||b))){if(f.splice(e,1),a=d.length&&k(f),!a)return $.apply(c,d),c;
|
||
break}}return z(a,l)(d,b,!G,c,nb.test(a)),c}function t(){}var u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L="sizzle"+-new Date,M=window.document,N={},O=0,P=0,Q=b(),R=b(),S=b(),T=!1,U=function(){return 0},V="undefined",W=1<<31,X=[],Y=X.pop,Z=X.push,$=X.push,_=X.slice,ab=X.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},bb="[\\x20\\t\\r\\n\\f]",cb="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",db=cb.replace("w","w#"),eb="([*^$|!~]?=)",fb="\\["+bb+"*("+cb+")"+bb+"*(?:"+eb+bb+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+db+")|)|)"+bb+"*\\]",gb=":("+cb+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+fb.replace(3,8)+")*)|.*)\\)|)",hb=new RegExp("^"+bb+"+|((?:^|[^\\\\])(?:\\\\.)*)"+bb+"+$","g"),ib=new RegExp("^"+bb+"*,"+bb+"*"),jb=new RegExp("^"+bb+"*([\\x20\\t\\r\\n\\f>+~])"+bb+"*"),kb=new RegExp(gb),lb=new RegExp("^"+db+"$"),mb={ID:new RegExp("^#("+cb+")"),CLASS:new RegExp("^\\.("+cb+")"),NAME:new RegExp("^\\[name=['\"]?("+cb+")['\"]?\\]"),TAG:new RegExp("^("+cb.replace("w","w*")+")"),ATTR:new RegExp("^"+fb),PSEUDO:new RegExp("^"+gb),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+bb+"*(even|odd|(([+-]|)(\\d*)n|)"+bb+"*(?:([+-]|)"+bb+"*(\\d+)|))"+bb+"*\\)|)","i"),needsContext:new RegExp("^"+bb+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+bb+"*((?:-\\d)?\\d*)"+bb+"*\\)|)(?=[^-]|$)","i")},nb=/[\x20\t\r\n\f]*[+~]/,ob=/^[^{]+\{\s*\[native code/,pb=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,qb=/^(?:input|select|textarea|button)$/i,rb=/^h\d$/i,sb=/'|\\/g,tb=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,ub=/\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,vb=function(a,b){var c="0x"+b-65536;return c!==c?b:0>c?String.fromCharCode(c+65536):String.fromCharCode(c>>10|55296,1023&c|56320)};try{$.apply(X=_.call(M.childNodes),M.childNodes),X[M.childNodes.length].nodeType}catch(wb){$={apply:X.length?function(a,b){Z.apply(a,_.call(b))}:function(a,b){for(var c=a.length,d=0;a[c++]=b[d++];);a.length=c-1}}}y=e.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},D=e.setDocument=function(b){var c=b?b.ownerDocument||b:M;return c!==E&&9===c.nodeType&&c.documentElement?(E=c,F=c.documentElement,G=!y(c),N.getElementsByTagName=d(function(a){return a.appendChild(c.createComment("")),!a.getElementsByTagName("*").length}),N.attributes=d(function(a){a.innerHTML="<select></select>";var b=typeof a.lastChild.getAttribute("multiple");return"boolean"!==b&&"string"!==b}),N.getElementsByClassName=d(function(a){return a.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",a.getElementsByClassName&&a.getElementsByClassName("e").length?(a.lastChild.className="e",2===a.getElementsByClassName("e").length):!1}),N.getByName=d(function(a){a.id=L+0,a.appendChild(E.createElement("a")).setAttribute("name",L),a.appendChild(E.createElement("i")).setAttribute("name",L),F.appendChild(a);var b=c.getElementsByName&&c.getElementsByName(L).length===2+c.getElementsByName(L+0).length;return F.removeChild(a),b}),N.sortDetached=d(function(a){return a.compareDocumentPosition&&1&a.compareDocumentPosition(E.createElement("div"))}),w.attrHandle=d(function(a){return a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!==V&&"#"===a.firstChild.getAttribute("href")})?{}:{href:function(a){return a.getAttribute("href",2)},type:function(a){return a.getAttribute("type")}},N.getByName?(w.find.ID=function(a,b){if(typeof b.getElementById!==V&&G){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},w.filter.ID=function(a){var b=a.replace(ub,vb);return function(a){return a.getAttribute("id")===b}}):(w.find.ID=function(a,b){if(typeof b.getElementById!==V&&G){var c=b.getElementById(a);return c?c.id===a||typeof c.getAttributeNode!==V&&c.getAttributeNode("id").value===a?[c]:void 0:[]}},w.filter.ID=function(a){var b=a.replace(ub,vb);return function(a){var c=typeof a.getAttributeNode!==V&&a.getAttributeNode("id");return c&&c.value===b}}),w.find.TAG=N.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==V?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){for(;c=f[e++];)1===c.nodeType&&d.push(c);return d}return f},w.find.NAME=N.getByName&&function(a,b){return typeof b.getElementsByName!==V?b.getElementsByName(name):void 0},w.find.CLASS=N.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==V&&G?b.getElementsByClassName(a):void 0},I=[],H=[":focus"],(N.qsa=a(c.querySelectorAll))&&(d(function(a){a.innerHTML="<select><option selected=''></option></select>",a.querySelectorAll("[selected]").length||H.push("\\["+bb+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),a.querySelectorAll(":checked").length||H.push(":checked")}),d(function(a){a.innerHTML="<input type='hidden' i=''/>",a.querySelectorAll("[i^='']").length&&H.push("[*^$]="+bb+"*(?:\"\"|'')"),a.querySelectorAll(":enabled").length||H.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),H.push(",.*:")})),(N.matchesSelector=a(J=F.matchesSelector||F.mozMatchesSelector||F.webkitMatchesSelector||F.oMatchesSelector||F.msMatchesSelector))&&d(function(a){N.disconnectedMatch=J.call(a,"div"),J.call(a,"[s!='']:x"),I.push("!=",gb)}),H=new RegExp(H.join("|")),I=I.length&&new RegExp(I.join("|")),K=a(F.contains)||F.compareDocumentPosition?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)for(;b=b.parentNode;)if(b===a)return!0;return!1},U=F.compareDocumentPosition?function(a,b){if(a===b)return T=!0,0;var d=b.compareDocumentPosition&&a.compareDocumentPosition&&a.compareDocumentPosition(b);return d?1&d||B&&b.compareDocumentPosition(a)===d?a===c||K(M,a)?-1:b===c||K(M,b)?1:C?ab.call(C,a)-ab.call(C,b):0:4&d?-1:1:a.compareDocumentPosition?-1:1}:function(a,b){var d,e=0,g=a.parentNode,h=b.parentNode,i=[a],j=[b];if(a===b)return T=!0,0;if(!g||!h)return a===c?-1:b===c?1:g?-1:h?1:0;if(g===h)return f(a,b);for(d=a;d=d.parentNode;)i.unshift(d);for(d=b;d=d.parentNode;)j.unshift(d);for(;i[e]===j[e];)e++;return e?f(i[e],j[e]):i[e]===M?-1:j[e]===M?1:0},E):E},e.matches=function(a,b){return e(a,null,null,b)},e.matchesSelector=function(a,b){if((a.ownerDocument||a)!==E&&D(a),b=b.replace(tb,"='$1']"),N.matchesSelector&&G&&(!I||!I.test(b))&&!H.test(b))try{var c=J.call(a,b);if(c||N.disconnectedMatch||a.document&&11!==a.document.nodeType)return c}catch(d){}return e(b,E,null,[a]).length>0},e.contains=function(a,b){return(a.ownerDocument||a)!==E&&D(a),K(a,b)},e.attr=function(a,b){var c;return(a.ownerDocument||a)!==E&&D(a),G&&(b=b.toLowerCase()),(c=w.attrHandle[b])?c(a):!G||N.attributes?a.getAttribute(b):((c=a.getAttributeNode(b))||a.getAttribute(b))&&a[b]===!0?b:c&&c.specified?c.value:null},e.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},e.uniqueSort=function(a){var b,c=[],d=0,e=0;if(T=!N.detectDuplicates,B=!N.sortDetached,C=!N.sortStable&&a.slice(0),a.sort(U),T){for(;b=a[e++];)b===a[e]&&(d=c.push(e));for(;d--;)a.splice(c[d],1)}return a},x=e.getText=function(a){var b,c="",d=0,e=a.nodeType;if(e){if(1===e||9===e||11===e){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=x(a)}else if(3===e||4===e)return a.nodeValue}else for(;b=a[d];d++)c+=x(b);return c},w=e.selectors={cacheLength:50,createPseudo:c,match:mb,find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ub,vb),a[3]=(a[4]||a[5]||"").replace(ub,vb),"~="===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]||e.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]&&e.error(a[0]),a},PSEUDO:function(a){var b,c=!a[5]&&a[2];return mb.CHILD.test(a[0])?null:(a[4]?a[2]=a[4]:c&&kb.test(c)&&(b=j(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){return"*"===a?function(){return!0}:(a=a.replace(ub,vb).toLowerCase(),function(b){return b.nodeName&&b.nodeName.toLowerCase()===a})},CLASS:function(a){var b=Q[a+" "];return b||(b=new RegExp("(^|"+bb+")"+a+"("+bb+"|$)"))&&Q(a,function(a){return b.test(a.className||typeof a.getAttribute!==V&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var f=e.attr(d,a);return null==f?"!="===b:b?(f+="","="===b?f===c:"!="===b?f!==c:"^="===b?c&&0===f.indexOf(c):"*="===b?c&&f.indexOf(c)>-1:"$="===b?c&&f.slice(-c.length)===c:"~="===b?(" "+f+" ").indexOf(c)>-1:"|="===b?f===c||f.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){for(;p;){for(l=b;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){for(k=q[L]||(q[L]={}),j=k[a]||[],n=j[0]===O&&j[1],m=j[0]===O&&j[2],l=n&&q.childNodes[n];l=++n&&l&&l[p]||(m=n=0)||o.pop();)if(1===l.nodeType&&++m&&l===b){k[a]=[O,n,m];break}}else if(s&&(j=(b[L]||(b[L]={}))[a])&&j[0]===O)m=j[1];else for(;(l=++n&&l&&l[p]||(m=n=0)||o.pop())&&((h?l.nodeName.toLowerCase()!==r:1!==l.nodeType)||!++m||(s&&((l[L]||(l[L]={}))[a]=[O,m]),l!==b)););return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var d,f=w.pseudos[a]||w.setFilters[a.toLowerCase()]||e.error("unsupported pseudo: "+a);return f[L]?f(b):f.length>1?(d=[a,a,"",b],w.setFilters.hasOwnProperty(a.toLowerCase())?c(function(a,c){for(var d,e=f(a,b),g=e.length;g--;)d=ab.call(a,e[g]),a[d]=!(c[d]=e[g])}):function(a){return f(a,0,d)}):f}},pseudos:{not:c(function(a){var b=[],d=[],e=z(a.replace(hb,"$1"));return e[L]?c(function(a,b,c,d){for(var f,g=e(a,null,d,[]),h=a.length;h--;)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,c,f){return b[0]=a,e(b,null,f,d),!d.pop()}}),has:c(function(a){return function(b){return e(a,b).length>0}}),contains:c(function(a){return function(b){return(b.textContent||b.innerText||x(b)).indexOf(a)>-1}}),lang:c(function(a){return lb.test(a||"")||e.error("unsupported lang: "+a),a=a.replace(ub,vb).toLowerCase(),function(b){var c;do if(c=G?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(a){var b=window.location&&window.location.hash;return b&&b.slice(1)===a.id},root:function(a){return a===F},focus:function(a){return a===E.activeElement&&(!E.hasFocus||E.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.nodeName>"@"||3===a.nodeType||4===a.nodeType)return!1;return!0},parent:function(a){return!w.pseudos.empty(a)},header:function(a){return rb.test(a.nodeName)},input:function(a){return qb.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"))||b.toLowerCase()===a.type)},first:i(function(){return[0]}),last:i(function(a,b){return[b-1]}),eq:i(function(a,b,c){return[0>c?c+b:c]}),even:i(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:i(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:i(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:i(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}};for(u in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})w.pseudos[u]=g(u);for(u in{submit:!0,reset:!0})w.pseudos[u]=h(u);return z=e.compile=function(a,b){var c,d=[],e=[],f=S[a+" "];if(!f){for(b||(b=j(a)),c=b.length;c--;)f=p(b[c]),f[L]?d.push(f):e.push(f);f=S(a,q(e,d))}return f},w.pseudos.nth=w.pseudos.eq,t.prototype=w.filters=w.pseudos,w.setFilters=new t,N.sortStable=L.split("").sort(U).join("")===L,D(),[0,0].sort(U),N.detectDuplicates=T,{select:e,matches:e.matches,matchesSelector:e.matchesSelector}}),Ink.createModule("Ink.UI.Animate",1,["Ink.UI.Common_1","Ink.Dom.Event_1","Ink.Dom.Css_1"],function(a,b,c){"use strict";function d(){a.BaseUIComponent.apply(this,arguments)}var e=function(a){return"animationName"in a.style?"animation":"oAnimationName"in a.style?"oAnimation":"msAnimationName"in a.style?"msAnimation":"webkitAnimationName"in a.style?"webkitAnimation":null}(document.createElement("div")),f={animation:"animationend",oAnimation:"oanimationend",msAnimation:"MSAnimationEnd",webkitAnimation:"webkitAnimationEnd"}[e];return d._name="Animate_1",d._optionDefinition={trigger:["Element",null],duration:["String","slow"],animation:["String"],removeClass:["Boolean",!0],onEnd:["Function",function(){}]},d.prototype._init=function(){isNaN(parseInt(this._options.duration,10))||(this._options.duration=parseInt(this._options.duration,10)),this._options.trigger?b.observe(this._options.trigger,"click",Ink.bind(function(){this.animate()},this)):this.animate()},d.prototype.animate=function(){d.animate(this._element,this._options.animation,this._options)},Ink.extendObj(d,{_animationPrefix:e,animationSupported:!!e,animationEndEventName:f,animate:function(b,g,h){function i(a){a.target===b&&a.animationName===g&&(h.onEnd&&h.onEnd(a),h.removeClass&&c.removeClassName(b,g),"string"==typeof h.duration&&c.removeClassName(b,h.duration),b.removeEventListener(f,i,!1))}return b=a.elOrSelector(b),"number"==typeof h||"string"==typeof h?h={duration:h}:h||(h={}),"function"==typeof arguments[3]&&(h.onEnd=arguments[3]),"number"!=typeof h.duration&&"string"!=typeof h.duration&&(h.duration=400),d.animationSupported?("number"==typeof h.duration?b.style[e+"Duration"]=h.duration+"ms":"string"==typeof h.duration&&c.addClassName(b,h.duration),c.addClassName(b,["animated",g]),void b.addEventListener(f,i,!1)):void(h.onEnd&&setTimeout(function(){h.onEnd(null)},0))}}),a.createUIComponent(d),d}),Ink.createModule("Ink.UI.Carousel","1",["Ink.UI.Common_1","Ink.Dom.Event_1","Ink.Dom.Css_1","Ink.Dom.Element_1","Ink.UI.Pagination_1","Ink.Dom.Browser_1","Ink.Dom.Selector_1"],function(a,b,c,d,e,f){"use strict";function g(a,b,c){return Math.min(c,Math.max(b,a))}function h(){a.BaseUIComponent.apply(this,arguments)}function i(a,b){a.style.transitionProperty=a.style.oTransitionProperty=a.style.msTransitionProperty=a.style.mozTransitionProperty=a.style.webkitTransitionProperty=b}var j=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||function(a){return setTimeout(a,1e3/30)};return h._name="Carousel_1",h._optionDefinition={autoAdvance:["Integer",0],axis:["String","x"],initialPage:["Integer",0],spaceAfterLastSlide:["Boolean",!0],hideLast:["Boolean",!1],center:["Boolean",!1],keyboardSupport:["Boolean",!1],pagination:["String",null],onChange:["Function",null],onInit:["Function",function(){}],swipe:["Boolean",!0]},h.prototype={_init:function(){this._handlers={paginationChange:Ink.bindMethod(this,"_onPaginationChange"),windowResize:b.throttle(Ink.bindMethod(this,"refit"),200)},b.observe(window,"resize",this._handlers.windowResize),this._isY="y"===this._options.axis;var a=Ink.s("ul.stage",this._element);this._ulEl=a,d.removeTextNodeChildren(a),null==this._options.pagination&&(this._currentPage=this._options.initialPage),this.refit(),this._isY&&(this._ulEl.style.whiteSpace="normal"),this._options.swipe&&(b.observe(this._element,"touchstart",Ink.bindMethod(this,"_onTouchStart")),b.observe(this._element,"touchmove",Ink.bindMethod(this,"_onTouchMove")),b.observe(this._element,"touchend",Ink.bindMethod(this,"_onTouchEnd"))),this._setUpPagination(),this._setUpAutoAdvance(),this._setUpHider(),this._options.onInit.call(this,this)},refit:function(){var a=this._isY,b=function(b,c){return b?c?d.outerDimensions(b)[a?0:1]:d.outerDimensions(b)[a?1:0]:0};this._liEls=Ink.ss("li.slide",this._ulEl);var c=this._liEls.length,e=this._ulEl.getBoundingClientRect();this._ctnLength=a?e.bottom-e.top:e.right-e.left,this._elLength=b(this._liEls[0]),this._slidesPerPage=Math.floor(this._ctnLength/this._elLength)||1,isFinite(this._slidesPerPage)||(this._slidesPerPage=1);var f=Math.ceil(c/this._slidesPerPage),h=this._numPages!==f;this._numPages=f,this._deltaLength=this._slidesPerPage*this._elLength,this._center(),this._updateHider(),this._IE7(),this._pagination&&h&&this._pagination.setSize(this._numPages),this.setPage(g(this.getPage(),0,this._numPages))},_setUpPagination:function(){this._options.pagination?(a.isDOMElement(this._options.pagination)||"string"==typeof this._options.pagination?this._pagination=new e(this._options.pagination,{size:this._numPages,onChange:this._handlers.paginationChange}):(this._pagination=this._options.pagination,this._pagination._options.onChange=this._handlers.paginationChange,this._pagination.setSize(this._numPages)),this._pagination.setCurrent(this._options.initialPage||0)):this._currentPage=this._options.initialPage||0},_setUpAutoAdvance:function(){if(this._options.autoAdvance){var a=this;setTimeout(function b(){a.nextPage(!0),setTimeout(b,a._options.autoAdvance)},this._options.autoAdvance)}},_setUpHider:function(){if(this._options.hideLast){var a=d.create("div",{className:"hider",insertBottom:this._element});a.style.position="absolute",a.style[this._isY?"left":"top"]="0",a.style[this._isY?"right":"bottom"]="0",a.style[this._isY?"bottom":"right"]="0",this._hiderEl=a}},_center:function(){if(this._options.center){var a=Math.floor((this._ctnLength-this._elLength*this._slidesPerPage)/2),b;b=this._isY?[a,"px 0"]:["0 ",a,"px"],this._ulEl.style.padding=b.join("")}},_updateHider:function(){if(this._hiderEl)if(0===this.getPage()){var a=Math.floor(this._ctnLength-this._elLength*this._slidesPerPage);this._options.center&&(a/=2),this._hiderEl.style[this._isY?"height":"width"]=a+"px"}else this._hiderEl.style[this._isY?"height":"width"]="0px"},_IE7:function(){if(f.IE&&""+f.version.split(".")[0]=="7")for(var a=Ink.ss("li.slide",this._ulEl),b=function(b,d){a[c].style[b]=d},c=0,d=a.length;d>c;c++)b("position","absolute"),b(this._isY?"top":"left",c*this._elLength+"px")},_onTouchStart:function(a){if(!(a.touches.length>1)){this._swipeData={x:b.pointerX(a),y:b.pointerY(a)};var c=this._ulEl.getBoundingClientRect();this._swipeData.firstUlPos=c[this._isY?"top":"left"],this._swipeData.inUlX=this._swipeData.x-c.left,this._swipeData.inUlY=this._swipeData.y-c.top,i(this._ulEl,"none"),this._touchMoveIsFirstTouchMove=!0}},_onTouchMove:function(a){if(!(a.touches.length>1)){var c=b.pointerX(a),d=b.pointerY(a),e=Math.abs(d-this._swipeData.y),f=Math.abs(c-this._swipeData.x);this._touchMoveIsFirstTouchMove&&(this._touchMoveIsFirstTouchMove=void 0,this._scrolling=this._isY?f>e:e>f,this._scrolling||this._onAnimationFrame()),!this._scrolling&&this._swipeData&&(b.stopDefault(a),this._swipeData.pointerPos=this._isY?d:c)}},_onAnimationFrame:function(){var a=this._swipeData;if(a&&!this._scrolling&&!this._touchMoveIsFirstTouchMove){var b=this._element.getBoundingClientRect(),c;c=this._isY?a.pointerPos-a.inUlY-b.top:a.pointerPos-a.inUlX-b.left,this._ulEl.style[this._isY?"top":"left"]=c+"px",j(Ink.bindMethod(this,"_onAnimationFrame"))}},_onTouchEnd:function(a){if(this._swipeData&&this._swipeData.pointerPos&&!this._scrolling&&!this._touchMoveIsFirstTouchMove){var c=.1,d=this._swipeData.firstUlPos-this._ulEl.getBoundingClientRect()[this._isY?"top":"left"],e=this.getPage(),f=d/this._elLength/this._slidesPerPage;Math.abs(f)>c&&(e+=Math[0>d?"floor":"ceil"](f)),isNaN(e)||this.setPage(e),b.stopDefault(a)}i(this._ulEl,null),this._swipeData=null,this._touchMoveIsFirstTouchMove=void 0,this._scrolling=void 0},_onPaginationChange:function(a){this._setPage(a.getCurrent())},getPage:function(){return this._pagination?this._pagination.getCurrent():this._currentPage||0},setPage:function(a,b){b&&(a%=this._numPages,0>a&&(a=this._numPages-a)),a=g(a,0,this._numPages-1),this._pagination?this._pagination.setCurrent(a):this._setPage(a)},_setPage:function(a){var b=a*this._deltaLength,c=a===this._numPages-1;if(!this._options.spaceAfterLastSlide&&c&&a>0){var d=this._liEls.length-a*this._slidesPerPage;d<this._slidesPerPage&&(b=(a-1)*this._deltaLength+d*this._elLength)}this._ulEl.style[this._isY?"top":"left"]=["-",b,"px"].join(""),this._options.onChange&&this._options.onChange.call(this,a),this._currentPage=a,this._updateHider()},nextPage:function(a){this.setPage(this.getPage()+1,a)},previousPage:function(a){this.setPage(this.getPage()-1,a)},getSlidesPerPage:function(){return this._slidesPerPage},getTotalPages:function(){return this._numPages},getStageElm:function(){return this._ulEl},getSlidesList:function(){return this._liEls},getTotalSlides:function(){return this.getSlidesList().length}},a.createUIComponent(h),h}),Ink.createModule("Ink.UI.Close","1",["Ink.Dom.Event_1","Ink.Dom.Element_1"],function(a,b){"use strict";var c=function(){a.observe(document.body,"click",function(c){var d=a.element(c);if(d=b.findUpwardsByClass(d,"ink-close")||b.findUpwardsByClass(d,"ink-dismiss")){var e=b.findUpwardsByClass(d,"ink-alert")||b.findUpwardsByClass(d,"ink-alert-block")||d;e&&(a.stop(c),b.remove(e))}})};return c._name="Close_1",c}),Ink.createModule("Ink.UI.Common","1",["Ink.Dom.Element_1","Ink.Net.Ajax_1","Ink.Dom.Css_1","Ink.Dom.Selector_1","Ink.Util.Url_1"],function(a,b,c,d,e){"use strict";function f(){this&&this!==window&&"function"==typeof this.constructor&&Ink.warn("You called a method on an incorrectly instantiated "+this.constructor._name+" component. Check the warnings above to see what went wrong.")}function g(a,b){for(var c in a)if(a.hasOwnProperty(c)){if("constructor"===c)continue;"function"==typeof b[c]&&(b[c]=f)}}function h(a,b){var c=this.constructor,d=c._name;if(!this||this===window)throw new Error('Use "new InkComponent()" instead of "InkComponent()"');if(this&&!(this instanceof h))throw new Error("You forgot to call Ink.UI.Common.createUIComponent() on this module!");if(!a&&!c._componentOptions.elementIsOptional)return void Ink.error(new Error(d+': You need to pass an element or a selector as the first argument to "new '+d+'()"'));this._element=n.elsOrSelector(a,d+': An element with the selector "'+a+'" was not found!')[0],this._element||c._componentOptions.elementIsOptional||(e=!1,Ink.error(new Error(a+' does not match an element on the page. You need to pass a valid selector to "new '+d+'".'))),this._options=n.options(d,c._optionDefinition,b,this._element);var e=h._validateInstance(this)===!0;if(e&&"function"==typeof this._init)try{this._init.apply(this,arguments)}catch(f){e=!1,Ink.error(f)}e?this._element&&n.registerInstance(this,this._element):h._stubInstance(this,c,d)}var i={},j=Object.keys||function(a){var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(c);return b},k="WeakMap"in window,l=k?new WeakMap:null,m={get:function o(a){return k?l.get(a):a.__InkInstances},set:function p(a,b){k?l.set(a,b):a.__InkInstances=b}},n={Layouts:{TINY:"tiny",SMALL:"small",MEDIUM:"medium",LARGE:"large",XLARGE:"xlarge"},isDOMElement:a.isDOMElement,isInteger:function(a){return"number"==typeof a&&a%1===0},elOrSelector:function(a,b){if(!this.isDOMElement(a)){var c=d.select(a);return 0===c.length?(Ink.warn(b+" must either be a DOM Element or a selector expression!\nThe script element must also be after the DOM Element itself."),null):c[0]}return a},elsOrSelector:function(a,b,c){var e;if("string"==typeof a?e=d.select(a):n.isDOMElement(a)?e=[a]:a&&"object"==typeof a&&"number"==typeof a.length&&(e=a),e&&e.length)return e;if(c)throw new TypeError(b+" must either be a DOM Element, an Array of elements, or a selector expression!\nThe script element must also be after the DOM Element itself.");return[]},options:function(b,c,d,e){function f(a){return l=c[a][0],m=l.toLowerCase(),o=2===c[a].length?c[a][1]:i,l||r("Ink.UI.Common.options: Always specify a type!"),m in n._coerce_funcs||r("Ink.UI.Common.options: "+c[a][0]+" is not a valid type. Use one of "+j(n._coerce_funcs).join(", ")),(!c[a].length||c[a].length>2)&&r('the "defaults" argument must be an object mapping option names to [typestring, optional] arrays.'),k=a in h?n._coerce_from_string(m,h[a],a,b):i,k!==i?n._options_validate(k,m)?k:(s("("+a+" option) Invalid "+m+" "+q(k)),o):a in d?d[a]:o!==i?o:void r("Option "+a+" is required!")}"string"!=typeof b&&(e=d,d=c,c=b,b=""),d=d||{};var g={},h=e?a.data(e):{},k,l,m,o,p=function(a){return b&&(a=b+': "'+(""+a).replace(/"/,'\\"')+'"'),a},q=function(a){return'"'+(""+a).replace(/"/,'\\"')+'"'},r=function(a){throw new Error(p(a))},s=function(a){Ink.error(p(a)+". Ignoring option.")};for(var t in c)c.hasOwnProperty(t)&&(g[t]=f(t));return g},_coerce_from_string:function(a,b,c,d){return a in n._coerce_funcs?n._coerce_funcs[a](b,c,d):b},_options_validate:function(a,b){return b in n._options_validate_types?n._options_validate_types[b].call(n,a):!1},_coerce_funcs:function(){var a={element:function(a){return n.elOrSelector(a,"")},elements:function(a){return n.elsOrSelector(a,"",!1)},object:function(a){return a},number:function(a){return parseFloat(a)},"boolean":function(a){return!("false"===a||""===a||null===a)},string:function(a){return a},"function":function(a,b,c){return Ink.error(c+': You cannot specify the option "'+b+"\" through data-attributes because it's a function"),i}};return a["float"]=a.integer=a.number,a}(),_options_validate_types:function(){var a={string:function(a){return"string"==typeof a},number:function(a){return"number"==typeof a&&!isNaN(a)&&isFinite(a)},integer:function(a){return a===Math.round(a)},element:function(a){return n.isDOMElement(a)},elements:function(a){return a&&"object"==typeof a&&"number"==typeof a.length&&a.length},"boolean":function(a){return"boolean"==typeof a},object:function(){return!0}};return a["float"]=a.number,a}(),clone:function(a){try{return JSON.parse(JSON.stringify(a))}catch(b){throw new Error("Given object cannot have loops!")}},childIndex:function(a){if(n.isDOMElement(a))for(var b=d.select("> *",a.parentNode),c=0,e=b.length;e>c;++c)if(b[c]===a)return c;throw"not found!"},ajaxJSON:function(a,c,d){new b(a,{evalJS:"force",method:"POST",parameters:c,onSuccess:function(a){try{if(a=a.responseJSON,"ok"!==a.status)throw"server error: "+a.message;d(null,a)}catch(b){d(b)}},onFailure:function(){d("communication failure")}})},currentLayout:function(){var a,b,e,f,g,h=d.select("#ink-layout-detector")[0];if(!h){h=document.createElement("div"),h.id="ink-layout-detector";for(e in this.Layouts)this.Layouts.hasOwnProperty(e)&&(f=this.Layouts[e],g=document.createElement("div"),g.className="show-"+f+" hide-all",g.setAttribute("data-ink-layout",f),h.appendChild(g));document.body.appendChild(h)}for(a=0,b=h.children.length;b>a;++a)if(g=h.children[a],"block"===c.getStyle(g,"display"))return g.getAttribute("data-ink-layout");return"large"},hashSet:function(a){if("object"!=typeof a)throw new TypeError("o should be an object!");var b=e.getAnchorString();b=Ink.extendObj(b,a),window.location.hash=e.genQueryString("",b).substring(1)},cleanChildren:function(a){if(!n.isDOMElement(a))throw"Please provide a valid DOMElement";for(var b,c=a.lastChild;c;)b=c.previousSibling,a.removeChild(c),c=b},storeIdAndClasses:function(a,b){if(!n.isDOMElement(a))throw"Please provide a valid DOMElement as first parameter";var c=a.id;c&&(b._id=c);var d=a.className;d&&(b._classes=d)},restoreIdAndClasses:function(a,b){if(!n.isDOMElement(a))throw"Please provide a valid DOMElement as first parameter";b._id&&a.id!==b._id&&(a.id=b._id),b._classes&&-1===a.className.indexOf(b._classes)&&(a.className?a.className+=" "+b._classes:a.className=b._classes),b._instanceId&&!a.getAttribute("data-instance")&&a.setAttribute("data-instance",b._instanceId)},_warnDoubleInstantiation:function(a,b){function c(a){return(a.constructor&&a.constructor._name||a._name||"").replace(/_.*?$/,"")}var d=n.getInstance(a);if(""!==c(b)&&d){var e=c(b);if(e){for(var f=0,g=d.length;g>f;f++)if(e===c(d[f]))return Ink.warn("Creating more than one "+e+".","(Was creating a "+e+" on:",a,")."),!1;return!0}}},registerInstance:function(a,b){if(a){if(!n.isDOMElement(b))throw new TypeError("Ink.UI.Common.registerInstance: The element passed in is not a DOM element!");if(n._warnDoubleInstantiation(b,a)===!1)return!1;var c=m.get(b);return c||(c=[],m.set(b,c)),c.push(a),!0}},unregisterInstance:function(a){if(a&&a._element)for(var b=m.get(a._element),c=0,d=b.length;d>c;c++)b[c]===a&&b.splice(c,1)},getInstance:function(a,b){a=n.elOrSelector(a);var c=m.get(a);if(c||(c=[]),"function"!=typeof b)return c;for(var d=0,e=c.length;e>d;d++)if(c[d]instanceof b)return c[d];return null},getInstanceFromSelector:function(a){return n.getInstance(n.elOrSelector(a))},getInstanceIds:function(){var a=[];for(var b in l)l.hasOwnProperty(b)&&a.push(b);return a},getInstances:function(){var a=[];for(var b in l)l.hasOwnProperty(b)&&a.push(l[b]);return a},destroyComponent:function(){n.unregisterInstance(this),this._element.parentNode.removeChild(this._element)}};return h._validateInstance=function(a){var b;if("function"!=typeof a._validate)return!0;try{b=a._validate()}catch(c){b=c}return b instanceof Error?(a._validationError=b,!1):!0},h._stubInstance=function(a,b,c){g(b.prototype,a),g(h.prototype,a),Ink.warn(c+" was not correctly created. "+(a._validationError||""))},h.getInstance=function(a){return a=n.elOrSelector(a),n.getInstance(a,this)},Ink.extendObj(h.prototype,{getOption:function(a){return!this.constructor||a in this.constructor._optionDefinition?this._options[a]:void Ink.error('"'+a+'" is not an option for '+this.constructor._name)},setOption:function(a,b){return!this.constructor||a in this.constructor._optionDefinition?void(this._options[a]=b):void Ink.error('"'+a+" is not an option for "+this.constructor._name)},getElement:function(){return this._element}}),n.BaseUIComponent=h,n.createUIComponent=function q(a,b){function c(a,b){if(!a)throw new Error("Ink.UI_1.createUIComponent: "+b)}function d(b,d,e){var f=a[b];c("undefined"!=typeof f,a+" doesn't have a \""+b+'" property. '+e),c(d&&typeof f===d,"typeof "+a+"."+b+' is not "'+d+'". '+e)}a._componentOptions=b||{},c("function"==typeof a,"constructor argument is not a function!"),d("_name","string","This property is used for error messages. Set it to the full module path and version (Ink.My.Module_1)."),d("_optionDefinition","object","This property contains the option names, types and defaults. See Ink.UI.Common.options() for reference.");var e=a.prototype;a.prototype="function"==typeof Object.create?Object.create(h.prototype):function f(){function a(){}return a.prototype=h.prototype,new a}(),Ink.extendObj(a.prototype,e),a.prototype.constructor=a,Ink.extendObj(a,h)},n}),Ink.createModule("Ink.UI.DatePicker","1",["Ink.UI.Common_1","Ink.Dom.Event_1","Ink.Dom.Css_1","Ink.Dom.Element_1","Ink.Dom.Selector_1","Ink.Util.Array_1","Ink.Util.Date_1","Ink.Dom.Browser_1"],function(a,b,c,d,e,f,g){"use strict";function h(a,b,c){return a>c&&(a=c),b>a&&(a=b),a}function i(a){var b=a.split("-");return j(+b[0],+b[1]-1,+b[2])}function j(a,b,c){return{_year:a,_month:b,_day:c}}function k(a){return{_year:a.getFullYear(),_month:a.getMonth(),_day:a.getDate()}}var l=function(){a.BaseUIComponent.apply(this,arguments)};return l._name="DatePicker_1",l._optionDefinition={autoOpen:["Boolean",!1],cleanText:["String","Clear"],closeText:["String","Close"],pickerField:["Element",null],containerElement:["Element",null],cssClass:["String","ink-calendar bottom"],dateRange:["String",null],displayInSelect:["Boolean",!1],dayField:["Element",null],monthField:["Element",null],yearField:["Element",null],format:["String","yyyy-mm-dd"],nextLinkText:["String","»"],ofText:["String"," of "],onFocus:["Boolean",!0],onMonthSelected:["Function",null],onSetDate:["Function",null],onYearSelected:["Function",null],position:["String","right"],prevLinkText:["String","«"],showClean:["Boolean",!0],showClose:["Boolean",!0],shy:["Boolean",!0],startDate:["String",null],startWeekDay:["Number",1],validDayFn:["Function",null],validMonthFn:["Function",null],validYearFn:["Function",null],nextValidDateFn:["Function",null],prevValidDateFn:["Function",null],yearRange:["String",null],month:["Object",{1:"January",2:"February",3:"March",4:"April",5:"May",6:"June",7:"July",8:"August",9:"September",10:"October",11:"November",12:"December"}],wDay:["Object",{0:"Sunday",1:"Monday",2:"Tuesday",3:"Wednesday",4:"Thursday",5:"Friday",6:"Saturday"}]},l.prototype={_init:function(){this._options.format=this._dateParsers[this._options.format]||this._options.format,this._hoverPicker=!1,this._picker=this._options.pickerField||null,this._setMinMax(this._options.dateRange||this._options.yearRange),this.setDate(this._options.startDate?this._options.startDate:this._element&&this._element.value?this._element.value:new Date),(this._options.startWeekDay<0||this._options.startWeekDay>6)&&(Ink.warn('Ink.UI.DatePicker_1: option "startWeekDay" must be between 0 (sunday) and 6 (saturday)'),this._options.startWeekDay=h(this._options.startWeekDay,0,6)),Ink.extendObj(this._options,this._lang||{}),this._render(),this._listenToContainerObjectEvents()
|
||
},_validate:function(){if(this._options.displayInSelect&&!(this._options.dayField&&this._options.monthField&&this._options.yearField))throw new Error("Ink.UI.DatePicker: displayInSelect option enabled.Please specify dayField, monthField and yearField selectors.")},_render:function(){this._containerObject=document.createElement("div"),this._containerObject.className=this._options.cssClass+" ink-datepicker-calendar hide-all",this._renderSuperTopBar();var b=document.createElement("div");b.className="ink-calendar-top",this._monthDescContainer=document.createElement("div"),this._monthDescContainer.className="ink-calendar-month_desc",this._monthPrev=document.createElement("div"),this._monthPrev.className="ink-calendar-prev",this._monthPrev.appendChild(d.create("a",{href:"#prev",className:"change_month_prev",setHTML:this._options.prevLinkText})),this._monthNext=document.createElement("div"),this._monthNext.className="ink-calendar-next",this._monthNext.appendChild(d.create("a",{href:"#next",className:"change_month_next",setHTML:this._options.nextLinkText})),b.appendChild(this._monthPrev),b.appendChild(this._monthDescContainer),b.appendChild(this._monthNext),this._monthContainer=document.createElement("div"),this._monthContainer.className="ink-calendar-month",this._containerObject.appendChild(b),this._containerObject.appendChild(this._monthContainer),this._monthSelector=this._renderMonthSelector(),this._containerObject.appendChild(this._monthSelector),this._yearSelector=document.createElement("ul"),this._yearSelector.className="ink-calendar-year-selector",this._containerObject.appendChild(this._yearSelector),(!this._options.onFocus||this._options.displayInSelect)&&(this._picker=this._options.pickerField?a.elOrSelector(this._options.pickerField,"pickerField"):d.create("a",{href:"#open_cal",setHTML:"open",insertBottom:this._element.parentNode,className:"ink-datepicker-picker-field"})),this._appendDatePickerToDom(),this._renderMonth(),this._monthChanger=d.create("a",{href:"#monthchanger",className:"ink-calendar-link-month",setTextContent:this._options.month[this._month+1]}),this._ofText=d.create("span",{className:"ink-calendar-of-text",setHTML:this._options.ofText}),this._yearChanger=d.create("a",{href:"#yearchanger",className:"ink-calendar-link-year",setTextContent:this._year}),this._monthDescContainer.appendChild(this._monthChanger),this._monthDescContainer.appendChild(this._ofText),this._monthDescContainer.appendChild(this._yearChanger),this._options.inline?this.show():this._addOpenCloseEvents(),this._addDateChangeHandlersToInputs()},_addDateChangeHandlersToInputs:function(){var a=this._element;this._options.displayInSelect&&(a=[this._options.dayField,this._options.monthField,this._options.yearField]),b.observeMulti(a,"change",Ink.bindEvent(function(){this._updateDate(),this._showDefaultView(),this.setDate(),this._inline||this._hoverPicker||this._hide(!0)},this))},show:function(){this._updateDate(),this._renderMonth(),c.removeClassName(this._containerObject,"hide-all")},_addOpenCloseEvents:function(){var a=this._picker||this._element;b.observe(a,"click",Ink.bindEvent(function(a){b.stop(a),this.show()},this)),this._options.autoOpen&&this.show(),this._options.displayInSelect||b.observe(a,"blur",Ink.bindEvent(function(){this._hoverPicker||this._hide(!0)},this)),this._options.shy&&b.observe(document,"click",Ink.bindEvent(function(a){for(var c=b.element(a),e=[this._options.dayField,this._options.monthField,this._options.yearField,this._picker,this._element],f=0,g=e.length;g>f;f++)if(e[f]&&d.descendantOf(e[f],c))return;this._hide(!0)},this))},_renderMonthSelector:function(){var a=document.createElement("ul");a.className="ink-calendar-month-selector";for(var b=document.createElement("ul"),c=1;12>=c;c++)b.appendChild(this._renderMonthButton(c)),c%4===0&&(a.appendChild(b),b=document.createElement("ul"));return a},_renderMonthButton:function(a){var b=document.createElement("li");return b.appendChild(d.create("a",{"data-cal-month":a,setTextContent:this._options.month[a].substring(0,3)})),b},_appendDatePickerToDom:function(){if(this._options.containerElement){var b=a.elOrSelector(this._options.containerElement);b.appendChild(this._containerObject)}var c=e.matchesSelector(this._element.parentNode,".ink-form .control-group .control");c?(this._wrapper=this._element.parentNode,this._wrapperIsControl=!0):(this._wrapper=d.create("div",{className:"ink-datepicker-wrapper"}),d.wrap(this._element,this._wrapper)),d.insertAfter(this._containerObject,this._element)},_renderSuperTopBar:function(){this._options.showClose&&this._options.showClean&&(this._superTopBar=document.createElement("div"),this._superTopBar.className="ink-calendar-top-options",this._options.showClean&&this._superTopBar.appendChild(d.create("a",{className:"clean",setHTML:this._options.cleanText})),this._options.showClose&&this._superTopBar.appendChild(d.create("a",{className:"close",setHTML:this._options.closeText})),this._containerObject.appendChild(this._superTopBar))},_listenToContainerObjectEvents:function(){b.observe(this._containerObject,"mouseover",Ink.bindEvent(function(a){b.stop(a),this._hoverPicker=!0},this)),b.observe(this._containerObject,"mouseout",Ink.bindEvent(function(a){b.stop(a),this._hoverPicker=!1},this)),b.observe(this._containerObject,"click",Ink.bindEvent(this._onClick,this))},_onClick:function(a){var d=b.element(a);return c.hasClassName(d,"ink-calendar-off")?(b.stopDefault(a),null):(b.stop(a),this._onRelativeChangerClick(d),this._onAbsoluteChangerClick(d),c.hasClassName(d,"ink-calendar-link-month")?this._showMonthSelector():c.hasClassName(d,"ink-calendar-link-year")?this._showYearSelector():c.hasClassName(d,"clean")?this._clean():c.hasClassName(d,"close")&&this._hide(!1),void this._updateDescription())},_onRelativeChangerClick:function(a){var b={change_year_next:1,change_year_prev:-1},c={change_month_next:1,change_month_prev:-1};a.className in c?this._updateCal(c[a.className]):a.className in b&&this._showYearSelector(b[a.className])},_onAbsoluteChangerClick:function(a){var b=d.data(a);Number(b.calDay)?(this.setDate(new Date(this._year,this._month,b.calDay)),this._hide()):Number(b.calMonth)?(this._month=Number(b.calMonth)-1,this._showDefaultView(),this._updateCal()):Number(b.calYear)&&this._changeYear(Number(b.calYear))},_changeYear:function(a){a=+a,isNaN(a)||(this._year=a,"function"==typeof this._options.onYearSelected&&this._options.onYearSelected(this,{year:this._year}),this._showMonthSelector())},_clean:function(){this._options.displayInSelect?(this._options.yearField.selectedIndex=0,this._options.monthField.selectedIndex=0,this._options.dayField.selectedIndex=0):this._element.value=""},_hide:function(a){a=void 0===a?!0:a,(a===!1||a&&this._options.shy)&&c.addClassName(this._containerObject,"hide-all")},_setMinMax:function(a){function b(){c._min=d,c._max=e}var c=this,d={_year:-Number.MAX_VALUE,_month:0,_day:1},e={_year:Number.MAX_VALUE,_month:11,_day:31};if(!a)return b();var g=a.split(":"),j=/^(\d{4})((\-)(\d{1,2})((\-)(\d{1,2}))?)?$/;f.each([{name:"_min",date:g[0],noLim:d},{name:"_max",date:g[1],noLim:e}],Ink.bind(function(a){var b=a.noLim;if("NOW"===a.date.toUpperCase()){var c=new Date;b=k(c)}else"EVER"===a.date.toUpperCase()?b=a.noLim:j.test(a.date)&&(b=i(a.date),b._month=h(b._month,0,11),b._day=h(b._day,1,this._daysInMonth(b._year,b._month+1)));this[a.name]=b},this));var l=-1!==this._dateCmp(this._max,this._min);l||b()},_fitDateToRange:function(a){return this._isValidDate(a)||(a=k(new Date)),-1===this._dateCmp(a,this._min)?Ink.extendObj({},this._min):1===this._dateCmp(a,this._max)?Ink.extendObj({},this._max):Ink.extendObj({},a)},_dateWithinRange:function(a){return arguments.length||(a=this),!this._dateAboveMax(a)&&!this._dateBelowMin(a)},_dateAboveMax:function(a){return 1===this._dateCmp(a,this._max)},_dateBelowMin:function(a){return-1===this._dateCmp(a,this._min)},_dateCmp:function(a,b){return this._dateCmpUntil(a,b,"_day")},_dateCmpUntil:function(a,b,c){var d=["_year","_month","_day"],e=-1;do{if(e++,a[d[e]]>b[d[e]])return 1;if(a[d[e]]<b[d[e]])return-1}while(d[e]!==c&&void 0!==a[d[e+1]]&&void 0!==b[d[e+1]]);return 0},_showDefaultView:function(){this._yearSelector.style.display="none",this._monthSelector.style.display="none",this._monthPrev.childNodes[0].className="change_month_prev",this._monthNext.childNodes[0].className="change_month_next",this._getPrevMonth()||(this._monthPrev.childNodes[0].className="action_inactive"),this._getNextMonth()||(this._monthNext.childNodes[0].className="action_inactive"),this._monthContainer.style.display="block"},_updateDate:function(){var a;!this._options.displayInSelect&&this._element.value?a=this._parseDate(this._element.value):this._options.displayInSelect&&(a={_year:this._options.yearField[this._options.yearField.selectedIndex].value,_month:this._options.monthField[this._options.monthField.selectedIndex].value-1,_day:this._options.dayField[this._options.dayField.selectedIndex].value}),a&&(a=this._fitDateToRange(a),this._year=a._year,this._month=a._month,this._day=a._day),this._setDate(),this._updateDescription(),this._renderMonth()},_updateDescription:function(){d.setTextContent(this._monthChanger,this._options.month[this._month+1]),d.setTextContent(this._ofText,this._options.ofText),d.setTextContent(this._yearChanger,this._year)},_showYearSelector:function(a){this._incrementViewingYear(a);var b=this._year-this._year%10,c=b-1;d.setHTML(this._yearSelector,"");var e=d.create("ul");if(this._yearSelector.appendChild(e),c>this._min._year){var f=d.create("li");f.appendChild(d.create("a",{href:"#year_prev",className:"change_year_prev",setHTML:this._options.prevLinkText})),e.appendChild(f)}else e.appendChild(d.create("li",{setHTML:" "}));for(var g=1;11>g;g++)g%4===0&&(e=d.create("ul"),this._yearSelector.appendChild(e)),c=b+g-1,e.appendChild(this._getYearButton(c));if(c<this._max._year){var h=d.create("li");h.appendChild(d.create("a",{href:"#year_next",className:"change_year_next",setHTML:this._options.nextLinkText})),e.appendChild(h)}else e.appendChild(d.create("li",{setHTML:" "}));this._monthPrev.childNodes[0].className="action_inactive",this._monthNext.childNodes[0].className="action_inactive",this._monthSelector.style.display="none",this._monthContainer.style.display="none",this._yearSelector.style.display="block"},_incrementViewingYear:function(a){if(a){var b=+this._year+10*a;b-=b%10,b>this._max._year||b+9<this._min._year||(this._year=+this._year+10*a)}},_getYearButton:function(a){var b="";this._acceptableYear({_year:a})?a===this._year&&(b="ink-calendar-on"):b="ink-calendar-off";var c=d.create("li");return c.appendChild(d.create("a",{href:"#","data-cal-year":a,className:b,setTextContent:a})),c},_showMonthSelector:function(){this._yearSelector.style.display="none",this._monthContainer.style.display="none",this._monthPrev.childNodes[0].className="action_inactive",this._monthNext.childNodes[0].className="action_inactive",this._addMonthClassNames(),this._monthSelector.style.display="block"},_parseDate:function(a){var b=g.set(this._options.format,a);return b?k(b):null},_isValidDate:function(a){var b=/^\d{4}$/,c=/^\d{1,2}$/;return b.test(a._year)&&c.test(a._month)&&c.test(a._day)&&+a._month+1>=1&&+a._month+1<=12&&+a._day>=1&&+a._day<=this._daysInMonth(a._year,a._month+1)},_isDate:function(a,b){try{if("undefined"==typeof a)return!1;var c=g.set(a,b);if(c&&this._isValidDate(k(c)))return!0}catch(d){}return!1},_acceptableDay:function(a){return this._acceptableDateComponent(a,"validDayFn")},_acceptableMonth:function(a){return this._acceptableDateComponent(a,"validMonthFn")},_acceptableYear:function(a){return this._acceptableDateComponent(a,"validYearFn")},_acceptableDateComponent:function(a,b){return this._options[b]?this._callUserCallbackBool(this._options[b],a):this._dateWithinRange(a)},_writeDateInFormat:function(){return g.get(this._options.format,this.getDate())},setDate:function(a){if(a&&"function"==typeof a.getDate&&(a=[a.getFullYear(),a.getMonth()+1,a.getDate()].join("-")),/\d{4}-\d{1,2}-\d{1,2}/.test(a)){var b=a.split("-");this._year=+b[0],this._month=+b[1]-1,this._day=+b[2]}this._setDate()},getDate:function(){if(!this._day)throw"Ink.UI.DatePicker: Still picking a date. Cannot getDate now!";return new Date(this._year,this._month,this._day)},_setDate:function(a){if(a){var b=d.data(a);this._day=+b.calDay||this._day}var c=this._fitDateToRange(this);this._year=c._year,this._month=c._month,this._day=c._day,this._options.displayInSelect?(this._options.dayField.value=this._day,this._options.monthField.value=this._month+1,this._options.yearField.value=this._year):this._element.value=this._writeDateInFormat(),this._options.onSetDate&&this._options.onSetDate(this,{date:this.getDate()})},_updateCal:function(a){"function"==typeof this._options.onMonthSelected&&this._options.onMonthSelected(this,{year:this._year,month:this._month}),a&&null===this._updateMonth(a)||this._renderMonth()},_daysInMonth:function(a,b){var c={2:a%400===0||a%4===0&&a%100!==0?29:28,4:30,6:30,9:30,11:30};return c[b]||31},_updateMonth:function(a){var b;return a>0?b=this._getNextMonth():0>a&&(b=this._getPrevMonth()),b?(this._year=b._year,this._month=b._month,void(this._day=b._day)):null},_getNextMonth:function(a){return this._tryLeap(a,"Month","next",function(a){return a._month+=1,a._month>11&&(a._month=0,a._year+=1),a})},_getPrevMonth:function(a){return this._tryLeap(a,"Month","prev",function(a){return a._month-=1,a._month<0&&(a._month=11,a._year-=1),a})},_getPrevYear:function(a){return this._tryLeap(a,"Year","prev",function(a){return a._year-=1,a})},_getNextYear:function(a){return this._tryLeap(a,"Year","next",function(a){return a._year+=1,a})},_tryLeap:function(a,b,c,d){a=a||{_year:this._year,_month:this._month,_day:this._day};var e="prev"===c?"_min":"_max",f=this[e];if(0===this._dateCmpUntil(a,f,b))return null;var g=this._options[c+"ValidDateFn"];return g?this._callUserCallbackDate(g,a):(a=d(a),a=this._fitDateToRange(a),this["_acceptable"+b](a)?a:null)},_getNextDecade:function(a){a=a||{_year:this._year,_month:this._month,_day:this._day};var b=this._getCurrentDecade(a);return b+10>this._max._year?null:b+10},_getPrevDecade:function(a){a=a||{_year:this._year,_month:this._month,_day:this._day};var b=this._getCurrentDecade(a);return b-10<this._min._year?null:b-10},_getCurrentDecade:function(a){return a=a?a._year||a:this._year,10*Math.floor(a/10)},_callUserCallbackBase:function(a,b){return a.call(this,b._year,b._month+1,b._day)},_callUserCallbackBool:function(a,b){return!!this._callUserCallbackBase(a,b)},_callUserCallbackDate:function(a,b){var c=this._callUserCallbackBase(a,b);return c?k(c):null},_dateParsers:{"yyyy-mm-dd":"Y-m-d","yyyy/mm/dd":"Y/m/d","yy-mm-dd":"y-m-d","yy/mm/dd":"y/m/d","dd-mm-yyyy":"d-m-Y","dd/mm/yyyy":"d/m/Y","dd-mm-yy":"d-m-y","dd/mm/yy":"d/m/y","mm/dd/yyyy":"m/d/Y","mm-dd-yyyy":"m-d-Y"},_renderMonth:function(){var a=this._month,b=this._year;this._showDefaultView(),d.setHTML(this._monthContainer,""),this._monthContainer.appendChild(this._getMonthCalendarHeader(this._options.startWeekDay)),this._monthContainer.appendChild(this._getDayButtons(b,a))},_getFirstDayIndex:function(a,b){var c=new Date(a,b,1).getDay(),d=this._options.startWeekDay||0,e=c-d;return e%=7,0>e&&(e+=6),e},_getDayButtons:function(a,b){var c=this._daysInMonth(a,b+1),e=document.createDocumentFragment(),f=d.create("ul");e.appendChild(f);for(var g=this._getFirstDayIndex(a,b),h=0;g>h;h++)f.appendChild(d.create("li",{className:"ink-calendar-empty",setHTML:" "}));for(var i=1;c>=i;i++)(i-1+g)%7===0&&(f=d.create("ul"),e.appendChild(f)),f.appendChild(this._getDayButton(a,b,i));return e},_getDayButton:function(a,b,c){var e={},f=j(a,b,c);this._acceptableDay(f)?(e["data-cal-day"]=c,this._day&&0===this._dateCmp(f,this)&&(e.className="ink-calendar-on")):e.className="ink-calendar-off",e.setTextContent=c;var g=d.create("li");return g.appendChild(d.create("a",e)),g},_getMonthCalendarHeader:function(a){for(var b=d.create("ul",{className:"ink-calendar-header"}),c,e=0;7>e;e++)c=(a+e)%7,b.appendChild(d.create("li",{setTextContent:this._options.wDay[c].substring(0,1)}));return b},_addMonthClassNames:function(a){f.forEach((a||this._monthSelector).getElementsByTagName("a"),Ink.bindMethod(this,"_addMonthButtonClassNames"))},_addMonthButtonClassNames:function(a){var b=d.data(a);if(!b.calMonth)throw"not a calendar month button!";var e=+b.calMonth-1;if(e===this._month)c.addClassName(a,"ink-calendar-on"),c.removeClassName(a,"ink-calendar-off");else{c.removeClassName(a,"ink-calendar-on");var f=!this._acceptableMonth({_year:this._year,_month:e});c.addRemoveClassName(a,"ink-calendar-off",f)}},lang:function(a){this._lang=a},showMonth:function(){this._renderMonth()},isMonthRendered:function(){var a=e.select(".ink-calendar-header",this._containerObject)[0];return"none"!==c.getStyle(a.parentNode,"display")&&"none"!==c.getStyle(a.parentNode.parentNode,"display")},destroy:function(){d.unwrap(this._element),d.remove(this._wrapper),d.remove(this._containerObject),a.unregisterInstance.call(this)}},a.createUIComponent(l),l}),Ink.createModule("Ink.UI.Draggable","1",["Ink.Dom.Element_1","Ink.Dom.Event_1","Ink.Dom.Css_1","Ink.Dom.Browser_1","Ink.Dom.Selector_1","Ink.UI.Common_1"],function(a,b,c,d,e,f){"use strict";function g(a,b,c){return a=Math.min(a,c),a=Math.max(a,b)}function h(){f.BaseUIComponent.apply(this,arguments)}var i=0,j=1;return h._name="Draggable_1",h._optionDefinition={constraint:["String",!1],constraintElm:["Element",!1],top:["Number",!1],right:["Number",!1],bottom:["Number",!1],left:["Number",!1],handle:["Element",!1],revert:["Boolean",!1],cursor:["String","move"],zIndex:["Number",9999],fps:["Number",0],droppableProxy:["Element",!1],mouseAnchor:["String",void 0],dragClass:["String","drag"],skipChildren:["Boolean",!0],onStart:["Function",!1],onEnd:["Function",!1],onDrag:["Function",!1],onChange:["Function",!1]},h.prototype={_init:function(){var a=this._options;this.constraintElm=a.constraintElm&&f.elOrSelector(a.constraintElm),this.handle=!1,this.elmStartPosition=!1,this.active=!1,this.dragged=!1,this.prevCoords=!1,this.placeholder=!1,this.position=!1,this.zindex=!1,this.firstDrag=!0,a.fps&&(this.deltaMs=1e3/a.fps,this.lastRunAt=0),this.handlers={},this.handlers.start=Ink.bindEvent(this._onStart,this),this.handlers.dragFacade=Ink.bindEvent(this._onDragFacade,this),this.handlers.drag=Ink.bindEvent(this._onDrag,this),this.handlers.end=Ink.bindEvent(this._onEnd,this),this.handlers.selectStart=function(a){return b.stop(a),!1},this.handle=this._options.handle?f.elOrSelector(this._options.handle):this._element,this.handle.style.cursor=a.cursor,b.observe(this.handle,"touchstart",this.handlers.start),b.observe(this.handle,"mousedown",this.handlers.start),d.IE&&b.observe(this._element,"selectstart",this.handlers.selectStart)},destroy:function(){b.stopObserving(this.handle,"touchstart",this.handlers.start),b.stopObserving(this.handle,"mousedown",this.handlers.start),d.IE&&b.stopObserving(this._element,"selectstart",this.handlers.selectStart)},_getCoords:function(b){var c=[a.scrollWidth(),a.scrollHeight()];return{x:(b.touches?b.touches[0].clientX:b.clientX)+c[i],y:(b.touches?b.touches[0].clientY:b.clientY)+c[j]}},_cloneStyle:function(b,d){d.className=b.className,d.style.borderWidth="0",d.style.padding="0",d.style.position="absolute",d.style.width=a.elementWidth(b)+"px",d.style.height=a.elementHeight(b)+"px",d.style.left=a.elementLeft(b)+"px",d.style.top=a.elementTop(b)+"px",d.style.cssFloat=c.getStyle(b,"float"),d.style.display=c.getStyle(b,"display")},_onStart:function(d){if(!this.active&&b.isLeftClick(d)||"undefined"==typeof d.button){var e=b.element(d);if(this._options.skipChildren&&e!==this.handle)return;b.stop(d),c.addClassName(this._element,this._options.dragClass),this.elmStartPosition=[a.elementLeft(this._element),a.elementTop(this._element)];var f=[parseInt(c.getStyle(this._element,"left"),10),parseInt(c.getStyle(this._element,"top"),10)],g=a.elementDimensions(this._element);this.originalPosition=[f[i]?f[i]:null,f[j]?f[j]:null],this.delta=this._getCoords(d),this.active=!0,this.position=c.getStyle(this._element,"position"),this.zindex=c.getStyle(this._element,"zIndex");var h=document.createElement("div");if(h.style.position=this.position,h.style.width=g[i]+"px",h.style.height=g[j]+"px",h.style.marginTop=c.getStyle(this._element,"margin-top"),h.style.marginBottom=c.getStyle(this._element,"margin-bottom"),h.style.marginLeft=c.getStyle(this._element,"margin-left"),h.style.marginRight=c.getStyle(this._element,"margin-right"),h.style.borderWidth="0",h.style.padding="0",h.style.cssFloat=c.getStyle(this._element,"float"),h.style.display=c.getStyle(this._element,"display"),h.style.visibility="hidden",this.delta2=[this.delta.x-this.elmStartPosition[i],this.delta.y-this.elmStartPosition[j]],this._options.mouseAnchor){var k=this._options.mouseAnchor.split(" "),l=[g[i],g[j]];"left"===k[0]?l[i]=0:"center"===k[0]&&(l[i]=parseInt(l[i]/2,10)),"top"===k[1]?l[j]=0:"center"===k[1]&&(l[j]=parseInt(l[j]/2,10)),this.applyDelta=[this.delta2[i]-l[i],this.delta2[j]-l[j]]}var m=this._options.fps?"dragFacade":"drag";if(this.placeholder=h,this._options.onStart&&this._options.onStart(this._element,d),this._options.droppableProxy){this.proxy=document.createElement("div"),g=[window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight];var n=this.proxy.style;n.width=g[i]+"px",n.height=g[j]+"px",n.position="fixed",n.left="0",n.top="0",n.zIndex=this._options.zindex+1,n.backgroundColor="#FF0000",c.setOpacity(this.proxy,0);for(var o=document.body.firstChild;o&&1!==o.nodeType;)o=o.nextSibling;document.body.insertBefore(this.proxy,o),b.observe(this.proxy,"mousemove",this.handlers[m]),b.observe(this.proxy,"touchmove",this.handlers[m])}else b.observe(document,"mousemove",this.handlers[m]);return this._element.style.position="absolute",this._element.style.zIndex=this._options.zindex,this._element.parentNode.insertBefore(this.placeholder,this._element),this._onDrag(d),b.observe(document,"mouseup",this.handlers.end),b.observe(document,"touchend",this.handlers.end),!1}},_onDragFacade:function(a){var b=+new Date;(!this.lastRunAt||b>this.lastRunAt+this.deltaMs)&&(this.lastRunAt=b,this._onDrag(a))},_onDrag:function(c){if(this.active){b.stop(c),this.dragged=!0;var d=this._getCoords(c),e=d.x,f=d.y,h=this._options,k=!1,l=!1;if(this.prevCoords&&e!==this.prevCoords.x||f!==this.prevCoords.y){h.onDrag&&h.onDrag(this._element,c),this.prevCoords=d,k=this.elmStartPosition[i]+e-this.delta.x,l=this.elmStartPosition[j]+f-this.delta.y;var m=a.elementDimensions(this._element);if(this.constraintElm){var n=a.offset(this.constraintElm),o=a.elementDimensions(this.constraintElm),p=n[j]+(h.top||0),q=n[j]+o[j]-(h.bottom||0),r=n[i]+(h.left||0),s=n[i]+o[i]-(h.right||0);l=g(l,p,q-m[j]),k=g(k,r,s-m[i])}else if(h.constraint){var t=h.right===!1?a.pageWidth()-m[i]:h.right,u=h.left===!1?0:h.left,v=h.top===!1?0:h.top,w=h.bottom===!1?a.pageHeight()-m[j]:h.bottom;("horizontal"===h.constraint||"both"===h.constraint)&&(k=g(k,u,t)),("vertical"===h.constraint||"both"===h.constraint)&&(l=g(l,v,w))}var x=Ink.getModule("Ink.UI.Droppable_1");if(this.firstDrag&&(x&&x.updateAll(),this.firstDrag=!1),k&&(this._element.style.left=k+"px"),l&&(this._element.style.top=l+"px"),x){var y=this._options.mouseAnchor?{x:e-this.applyDelta[i],y:f-this.applyDelta[j]}:d;x.action(y,"drag",c,this._element)}h.onChange&&h.onChange(this)}}},_onEnd:function(d){if(b.stopObserving(document,"mousemove",this.handlers.drag),b.stopObserving(document,"touchmove",this.handlers.drag),this._options.fps&&this._onDrag(d),c.removeClassName(this._element,this._options.dragClass),this.active&&this.dragged){this._options.droppableProxy&&document.body.removeChild(this.proxy),this.pt&&(a.remove(this.pt),this.pt=void 0),this.placeholder&&a.remove(this.placeholder),this._options.revert&&(this._element.style.position=this.position,this._element.style.zIndex=null!==this.zindex?this.zindex:"auto",this._element.style.left=this.originalPosition[i]?this.originalPosition[i]+"px":"",this._element.style.top=this.originalPosition[j]?this.originalPosition[j]+"px":""),this._options.onEnd&&this._options.onEnd(this._element,d);var e=Ink.getModule("Ink.UI.Droppable_1");e&&e.action(this._getCoords(d),"drop",d,this._element),this.position=!1,this.zindex=!1,this.firstDrag=!0}this.active=!1,this.dragged=!1}},f.createUIComponent(h),h}),Ink.createModule("Ink.UI.Drawer","1",["Ink.UI.Common_1","Ink.Dom.Loaded_1","Ink.Dom.Selector_1","Ink.Dom.Element_1","Ink.Dom.Event_1","Ink.Dom.Css_1"],function(a,b,c,d,e,f){"use strict";function g(a){Ink.warn('Ink.UI.Drawer_1: Could not find the "'+a+'" element on this page. Please make sure it exists.')}function h(b){a.BaseUIComponent.apply(this,[document.body,b])}return h._name="Drawer_1",h._optionDefinition={parentSelector:["String",".ink-drawer"],leftDrawer:["String",".left-drawer"],leftTrigger:["String",".left-drawer-trigger"],rightDrawer:["String",".right-drawer"],rightTrigger:["String",".right-drawer-trigger"],contentDrawer:["String",".content-drawer"],closeOnContentClick:["Boolean",!0],closeOnLinkClick:["Boolean",!0],mode:["String","push"],sides:["String","both"]},h.prototype={_init:function(){if(this._contentDrawers=Ink.ss(this._options.contentDrawer),this._leftDrawer=Ink.s(this._options.leftDrawer),this._leftTriggers=Ink.ss(this._options.leftTrigger),this._rightDrawer=Ink.s(this._options.rightDrawer),this._rightTriggers=Ink.ss(this._options.rightTrigger),f.addClassName(document.body,"ink-drawer"),0===this._contentDrawers.length)throw new Error('Ink.UI.Drawer_1: Could not find any "'+this._options.contentDrawer+'" elements on this page. Please make sure you have at least one.');switch(this._options.sides){case"both":this._triggers=this._options.leftTrigger+", "+this._options.rightTrigger+", "+this._options.contentDrawer;break;case"left":this._triggers=this._options.leftTrigger+", "+this._options.contentDrawer;break;case"right":this._triggers=this._options.rightTrigger+", "+this._options.contentDrawer}"left"===this._options.sides||"both"===this._options.sides?(this._leftDrawer||g(this._options.leftDrawer),0===this._leftTriggers.length&&g(this._options.leftTrigger)):(this._rightDrawer||g(this._options.rightDrawer),0===this._rightTriggers.length&&g(this._options.rightTrigger)),this._isOpen=!1,this._direction=void 0,this._handlers={click:Ink.bindEvent(this._onClick,this),afterTransition:Ink.bindEvent(this._afterTransition,this)},this._delay=10,this._addEvents()},_onClick:function(a){var b=Ink.bind(function(b){this._isOpen?this.close():this.open(b),a.preventDefault()},this);d.findUpwardsBySelector(a.currentTarget,this._options.leftTrigger)?b("left"):d.findUpwardsBySelector(a.currentTarget,this._options.rightTrigger)?b("right"):d.findUpwardsBySelector(a.currentTarget,this._options.contentDrawer)?this._options.closeOnContentClick&&this.close():this._options.closeOnLinkClick&&d.isLink(a.target)&&this.close()},_afterTransition:function(){this._isOpen||("left"===this._direction?f.removeClassName(this._leftDrawer,"show"):f.removeClassName(this._rightDrawer,"show"))},_addEvents:function(){e.on(document.body,"click",this._triggers+', a[href*="#"]',this._handlers.click)},open:function(a){this._isOpen=!0,this._direction=a;var b="left"===a?this._leftDrawer:this._rightDrawer;f.addClassName(b,"show"),setTimeout(Ink.bind(function(){f.addClassName(document.body,[this._options.mode,a])},this),this._delay)},close:function(){this._isOpen!==!1&&(this._isOpen=!1,e.one(document.body,"transitionend oTransitionEnd webkitTransitionEnd",this._handlers.afterTransition),f.removeClassName(document.body,[this._options.mode,this._direction]))}},a.createUIComponent(h),h}),Ink.createModule("Ink.UI.Dropdown","1",["Ink.UI.Common_1","Ink.UI.Toggle_1","Ink.Dom.Event_1","Ink.Dom.Element_1"],function(a,b,c,d){"use strict";function e(){a.BaseUIComponent.apply(this,arguments)}return e._name="Dropdown_1",e._optionDefinition={target:["Element"],hoverOpen:["Number",null],dismissOnInsideClick:["Boolean",!1],dismissOnOutsideClick:["Boolean",!0],dismissAfter:["Number",null],onInsideClick:["Function",null],onOutsideClick:["Function",null],onOpen:["Function",null],onDismiss:["Function",null]},e.prototype={_init:function(){this._toggle=new b(this._element,{target:this._options.target,closeOnInsideClick:null,closeOnClick:!1,onChangeState:Ink.bind(function(a){return this._openOrDismiss(a,!0,!0)},this)}),c.observeMulti([this._options.target,this._element],"mouseout",Ink.bindMethod(this,"_onMouseOut")),c.observeMulti([this._options.target,this._element],"mouseover",Ink.bindMethod(this,"_onMouseOver")),c.observe(this._options.target,"click",Ink.bindMethod(this,"_onInsideClick")),c.observe(document,"click",Ink.bindMethod(this,"_onOutsideClick"))},_onMouseOver:function(){"number"==typeof this._options.hoverOpen&&this._toggle.getState()===!1&&(clearTimeout(this._openTimeout),this._openTimeout=setTimeout(Ink.bindMethod(this,"open",!0),1e3*this._options.hoverOpen)),"number"==typeof this._options.dismissAfter&&clearTimeout(this._dismissTimeout)},_onMouseOut:function(){"number"==typeof this._options.dismissAfter&&this._toggle.getState()===!0&&(clearTimeout(this._dismissTimeout),this._dismissTimeout=setTimeout(Ink.bindMethod(this,"dismiss",!0),1e3*this._options.dismissAfter)),"number"==typeof this._options.hoverOpen&&clearTimeout(this._openTimeout)},_onInsideClick:function(a){var b=this._handlerCall("onInsideClick",c.element(a));b!==!1&&this._options.dismissOnInsideClick&&this.dismiss(!0)},_onOutsideClick:function(a){var b=c.element(a),e=d.findUpwardsHaving(b,Ink.bind(function(a){return a===this._element},this)),f=d.findUpwardsHaving(b,Ink.bind(function(a){return a===this._options.target},this));if(!e&&!f){var g=this._handlerCall("onOutsideClick",b);if(g===!1)return;this._options.dismissOnOutsideClick&&this.dismiss(!0)}},dismiss:function(a,b){this._openOrDismiss(!1,a,b)},open:function(a,b){this._openOrDismiss(!0,a,b)},_openOrDismiss:function(a,b,c){if(!this._toggle||this._toggle.getState()!==a){if(b&&this._handlerCall(a?"onOpen":"onDismiss")===!1)return!1;c||this._toggle.setState(a),clearTimeout(this._dismissTimeout),clearTimeout(this._openTimeout)}},_handlerCall:function(a){return this._options[a]?this._options[a].call(this,[].slice.call(arguments,1)):void 0}},a.createUIComponent(e),e}),Ink.createModule("Ink.UI.Droppable","1",["Ink.Dom.Element_1","Ink.Dom.Event_1","Ink.Dom.Css_1","Ink.UI.Common_1","Ink.Util.Array_1","Ink.Dom.Selector_1"],function(a,b,c,d,e,f){"use strict";var g=function(a){return function(b){return c.addClassName(a,b)}},h=function(a){return function(b){return c.removeClassName(a,b)}},i={debug:!1,_droppables:[],_draggables:[],add:function(b,c){function e(a){a.style.position="inherit"}b=d.elOrSelector(b,"Droppable.add target element");var f=Ink.extendObj({hoverClass:c.hoverclass||!1,accept:!1,onHover:!1,onDrop:!1,onDropOut:!1},c||{},a.data(b));"string"==typeof f.hoverClass&&(f.hoverClass=f.hoverClass.split(/\s+/));var g=this,h={move:function(a,b){e(a),b.appendChild(a)},copy:function(a,b){e(a),b.appendChild(a.cloneNode(!0))},revert:function(a){g._findDraggable(a).originalParent.appendChild(a),e(a)}},i;if("string"==typeof f.onHover&&(i=f.onHover,f.onHover=h[i],void 0===f.onHover))throw new Error("Unknown hover event handler: "+i);if("string"==typeof f.onDrop&&(i=f.onDrop,f.onDrop=h[i],void 0===f.onDrop))throw new Error("Unknown drop event handler: "+i);if("string"==typeof f.onDropOut&&(i=f.onDropOut,f.onDropOut=h[i],void 0===f.onDropOut))throw new Error("Unknown dropOut event handler: "+i);var j={element:b,data:{},options:f};this._droppables.push(j),this._update(j)},_findData:function(a){for(var b=this._droppables,c=0,d=b.length;d>c;c++)if(b[c].element===a)return b[c]},_findDraggable:function(a){for(var b=this._draggables,c=0,d=b.length;d>c;c++)if(b[c].element===a)return b[c]},updateAll:function(){e.each(this._droppables,i._update)
|
||
},update:function(a){this._update(this._findData(a))},_update:function(b){var c=b.data,d=b.element;c.left=a.offsetLeft(d),c.top=a.offsetTop(d),c.right=c.left+a.elementWidth(d),c.bottom=c.top+a.elementHeight(d)},remove:function(a){a=d.elOrSelector(a);for(var b=this._droppables.length,c=0;b>c;c++)if(this._droppables[c].element===a){this._droppables.splice(c,1);break}return b!==this._droppables.length},action:function(a,b,c,d){e.each(this._droppables,Ink.bind(function(i){var j=i.data,k=i.options,l=i.element;(!k.accept||f.matches(k.accept,[d]).length)&&("drag"!==b||this._findDraggable(d)||this._draggables.push({element:d,originalParent:d.parentNode}),a.x>=j.left&&a.x<=j.right&&a.y>=j.top&&a.y<=j.bottom?"drag"===b?(k.hoverClass&&e.each(k.hoverClass,g(l)),k.onHover&&k.onHover(d,l)):"drop"===b&&(k.hoverClass&&e.each(k.hoverClass,h(l)),k.onDrop&&k.onDrop(d,l,c)):"drag"===b&&k.hoverClass?e.each(k.hoverClass,h(l)):"drop"===b&&k.onDropOut&&k.onDropOut(d,l,c))},this))}};return i}),Ink.createModule("Ink.UI.FormValidator","1",["Ink.Dom.Element_1","Ink.Dom.Css_1","Ink.Util.Validator_1","Ink.Dom.Selector_1"],function(a,b,c,d){"use strict";function e(a){if(!a.name)return[];if(!a.form)return d.select('name="'+a.name+'"');var b=a.form[a.name];return"undefined"==typeof b.length&&(b=[b]),b}var f={version:"1",_flagMap:{"ink-fv-required":{msg:"Required field"},"ink-fv-email":{msg:"Invalid e-mail address"},"ink-fv-url":{msg:"Invalid URL"},"ink-fv-number":{msg:"Invalid number"},"ink-fv-phone_pt":{msg:"Invalid phone number"},"ink-fv-phone_cv":{msg:"Invalid phone number"},"ink-fv-phone_mz":{msg:"Invalid phone number"},"ink-fv-phone_ao":{msg:"Invalid phone number"},"ink-fv-date":{msg:"Invalid date"},"ink-fv-confirm":{msg:"Confirmation does not match"},"ink-fv-custom":{msg:""}},elements:{},confirmElms:{},hasConfirm:{},_errorClassName:"tip error",_errorValidationClassName:"validaton",_errorTypeWarningClassName:"warning",_errorTypeErrorClassName:"error",validate:function(a,b){if(this._free(),b=Ink.extendObj({onSuccess:!1,onError:!1,customFlag:!1,confirmGroup:[]},b||{}),"string"==typeof a&&(a=document.getElementById(a)),null===a)return!1;this.element=a,("undefined"==typeof this.element.id||null===this.element.id||""===this.element.id)&&(this.element.id="ink-fv_randomid_"+Math.round(99999*Math.random())),this.custom=b.customFlag,this.confirmGroup=b.confirmGroup;var c=this._validateElements();return c.length>0?(b.onError?b.onError(c):this._showError(a,c),!1):(b.onError||this._clearError(a),this._clearCache(),b.onSuccess&&b.onSuccess(),!0)},reset:function(){this._clearError(),this._clearCache()},_free:function(){this.element=null,this.custom=!1,this.confirmGroup=!1},_clearCache:function(){this.element=null,this.elements=[],this.custom=!1,this.confirmGroup=!1},_getElements:function(){var a=this.elements[this.element.id]=[];this.confirmElms[this.element.id]=[];for(var c=d.select(":input",this.element),e=!1,f=0,g=c.length;g>f;f++){e=c[f];var h=(e.getAttribute("type")+"").toLowerCase();if("radio"===h||"checkbox"===h){if(0===a.length||e.getAttribute("type")!==a[a.length-1].getAttribute("type")&&e.getAttribute("name")!==a[a.length-1].getAttribute("name"))for(var i in this._flagMap)if(b.hasClassName(e,i)){a.push(e);break}}else{for(var j in this._flagMap)if(b.hasClassName(e,j)&&"ink-fv-confirm"!==j){a.push(e);break}b.hasClassName(e,"ink-fv-confirm")&&(this.confirmElms[this.element.id].push(e),this.hasConfirm[this.element.id]=!0)}}},_validateElements:function(){var a;this._getElements(),this.hasConfirm[this.element.id]===!0&&(a=this._makeConfirmGroups());for(var c=[],d=!1,e=!1,f,g=0,h=this.elements[this.element.id].length;h>g;g++)if(f=!1,d=this.elements[this.element.id][g],!d.disabled)for(var i in this._flagMap)if(b.hasClassName(d,i))if("ink-fv-custom"!==i&&"ink-fv-confirm"!==i)this._isValid(d,i)||(f?c[c.length-1].errors.push(i):(c.push({elm:d,errors:[i]}),f=!0));else if("ink-fv-confirm"!==i)e=this._isCustomValid(d),e.length>0&&c.push({elm:d,errors:[i],custom:e});else if("ink-fv-confirm"===i)continue;return c=this._validateConfirmGroups(a,c)},_validateConfirmGroups:function(a,b){var c=!1;for(var d in a)a.hasOwnProperty(d)&&(c=a[d],2===c.length&&c[0].value!==c[1].value&&b.push({elm:c[1],errors:["ink-fv-confirm"]}));return b},_makeConfirmGroups:function(){var a;if(this.confirmGroup&&this.confirmGroup.length>0){a={};for(var c=!1,d=!1,e=0,f=this.confirmElms[this.element.id].length;f>e;e++){c=this.confirmElms[this.element.id][e];for(var g=0,h=this.confirmGroup.length;h>g;g++)d=this.confirmGroup[g],b.hasClassName(c,d)&&("undefined"==typeof a[d]?a[d]=[c]:a[d].push(c))}return a}return 2===this.confirmElms[this.element.id].length&&(a={"ink-fv-confirm":[this.confirmElms[this.element.id][0],this.confirmElms[this.element.id][1]]}),a;return!1},_isCustomValid:function(a){for(var c=[],d=!1,e=0,f=this.custom.length;f>e;e++)d=this.custom[e],b.hasClassName(a,d.flag)&&(d.callback(a,d.msg)||c.push({flag:d.flag,msg:d.msg}));return c},_isValid:function(a,d){var f=a.nodeName.toLowerCase(),g=(a.getAttribute("type")||"").toLowerCase(),h=this._trim(a.value);if("ink-fv-required"!==d&&"checkbox"!==g&&"radio"!==g&&""===h)return!b.hasClassName(a,"ink-fv-required");switch(d){case"ink-fv-required":if("select"===f)return a.selectedIndex>0?!0:!1;if("checkbox"!==g&&"radio"!==g&&""!==h)return!0;if("checkbox"===g||"radio"===g){for(var i=e(a),j=!1,k=0,l=i.length;l>k;k++)if(i[k].checked===!0){j=!0;break}return j}return!1;case"ink-fv-email":return c.mail(a.value);case"ink-fv-url":return c.url(a.value);case"ink-fv-number":return!isNaN(Number(a.value))&&isFinite(Number(a.value));case"ink-fv-phone_pt":return c.isPTPhone(a.value);case"ink-fv-phone_cv":return c.isCVPhone(a.value);case"ink-fv-phone_ao":return c.isAOPhone(a.value);case"ink-fv-phone_mz":return c.isMZPhone(a.value);case"ink-fv-date":var m=Ink.getModule("Ink.Dom.Element",1),n=m.data(a),o="yyyy-mm-dd";if(b.hasClassName(a,"ink-datepicker")&&"format"in n?o=n.format:"validFormat"in n&&(o=n.validFormat),!(o in c._dateParsers)){var p=[];for(var q in c._dateParsers)c._dateParsers.hasOwnProperty(q)&&p.push(q);throw new Error("The attribute data-valid-format must be one of the following values: "+p.join(", "))}return c.isDate(o,a.value);case"ink-fv-custom":}return!1},_showError:function(a,b){this._clearError(a);for(var c=!1,d=0,e=b.length;e>d;d++)c=b[d].elm,c&&this._showAnErrorOnElement(c,b[d])},_showAnErrorOnElement:function(c,d){var e=a.findUpwardsByClass(c,"control-group"),f=a.findUpwardsByClass(c,"control"),g=[this._errorClassName,this._errorTypeClassName].join(" "),h=a.create("p",{className:g});h.innerHTML="ink-fv-custom"!==d.errors[0]?this._flagMap[d.errors[0]].msg:d.custom[0].msg;var i=f||e;i?i.appendChild(h):a.insertAfter(h,c),f&&("ink-fv-required"===d.errors[0]?b.addClassName(e,"validation error"):b.addClassName(e,"validation warning"))},_clearError:function(c){for(var d=c.getElementsByTagName("p"),e,f,g=d.length-1;g>=0;g--)e=d[g],b.hasClassName(e,this._errorClassName)&&(f=a.findUpwardsBySelector(e,".control-group"),f&&b.removeClassName(f,["validation","error","warning"]),b.hasClassName(e,this._errorClassName,!0)&&a.remove(e));var h=c.getElementsByTagName("ul");for(g=h.length-1;g>=0;g--)e=h[g],b.hasClassName(e,"control-group")&&b.removeClassName(e,"validation error")},_trim:function(a){return"string"==typeof a?a.replace(/^\s+|\s+$|\n+$/g,""):void 0}};return f}),Ink.createModule("Ink.UI.FormValidator","2",["Ink.UI.Common_1","Ink.Dom.Element_1","Ink.Dom.Event_1","Ink.Dom.Selector_1","Ink.Dom.Css_1","Ink.Util.Array_1","Ink.Util.I18n_1","Ink.Util.Validator_1"],function(a,b,c,d,e,f,g,h){"use strict";function i(){a.BaseUIComponent.apply(this,arguments)}function j(){a.BaseUIComponent.apply(this,arguments)}var k={required:function(a){return"undefined"!=typeof a&&!/^\s*$/.test(a)},min_length:function(a,b){return"string"==typeof a&&a.length>=parseInt(b,10)},max_length:function(a,b){return"string"==typeof a&&a.length<=parseInt(b,10)},exact_length:function(a,b){return"string"==typeof a&&a.length===parseInt(b,10)},email:function(a){return"string"==typeof a&&h.mail(a)},url:function(a,b){return b=b||!1,"string"==typeof a&&h.url(a,b)},ip:function(a,b){return"string"!=typeof a?!1:h.isIP(a,b)},phone:function(a,b){if("string"!=typeof a)return!1;var c=b?b.toUpperCase():"";return h["is"+c+"Phone"](a)},credit_card:function(a,b){return"string"!=typeof a?!1:h.isCreditCard(a,b||"default")},date:function(a,b){return"string"==typeof a&&h.isDate(b,a)},alpha:function(a,b){return h.ascii(a,{singleLineWhitespace:b})},text:function(a,b,c){return h.unicode(a,{singleLineWhitespace:b,unicodePunctuation:c})},latin:function(a,b,c){return"string"!=typeof a?!1:h.latin1(a,{latin1Punctuation:b,singleLineWhitespace:c})},alpha_numeric:function(a){return h.ascii(a,{numbers:!0})},alpha_dash:function(a){return h.ascii(a,{dash:!0,underscore:!0})},digit:function(a){return"string"==typeof a&&/^[0-9]{1}$/.test(a)},integer:function(a,b){return h.number(a,{negative:!b,decimalPlaces:0})},decimal:function(a,b,c,d){return h.number(a,{decimalSep:b||".",decimalPlaces:+c||null,maxDigits:+d})},numeric:function(a,b,c,d){return b=b||".",-1!==a.indexOf(b)?k.decimal(a,b,c,d):k.integer(a)},range:function(a,b,c,d){return a=+a,b=+b,c=+c,isNaN(a)||isNaN(b)||isNaN(c)?!1:b>a||a>c?!1:d?(a-b)%d===0:!0},color:function(a){return h.isColor(a)},matches:function(a,b){return a===this.getFormElements()[b][0].getValue()}},l=new g({en_US:{"formvalidator.required":"The {field} filling is mandatory","formvalidator.min_length":"The {field} must have a minimum size of {param1} characters","formvalidator.max_length":"The {field} must have a maximum size of {param1} characters","formvalidator.exact_length":"The {field} must have an exact size of {param1} characters","formvalidator.email":"The {field} must have a valid e-mail address","formvalidator.url":"The {field} must have a valid URL","formvalidator.ip":"The {field} does not contain a valid {param1} IP address","formvalidator.phone":"The {field} does not contain a valid {param1} phone number","formvalidator.credit_card":"The {field} does not contain a valid {param1} credit card","formvalidator.date":"The {field} should contain a date in the {param1} format","formvalidator.alpha":"The {field} should only contain letters","formvalidator.text":"The {field} should only contain alphabetic characters","formvalidator.latin":"The {field} should only contain alphabetic characters","formvalidator.alpha_numeric":"The {field} should only contain letters or numbers","formvalidator.alpha_dash":"The {field} should only contain letters or dashes","formvalidator.digit":"The {field} should only contain a digit","formvalidator.integer":"The {field} should only contain an integer","formvalidator.decimal":"The {field} should contain a valid decimal number","formvalidator.numeric":"The {field} should contain a number","formvalidator.range":"The {field} should contain a number between {param1} and {param2}","formvalidator.color":"The {field} should contain a valid color","formvalidator.matches":"The {field} should match the field {param1}","formvalidator.validation_function_not_found":"The rule {rule} has not been defined"},pt_PT:{"formvalidator.required":"Preencher {field} é obrigatório","formvalidator.min_length":"{field} deve ter no mínimo {param1} caracteres","formvalidator.max_length":"{field} tem um tamanho máximo de {param1} caracteres","formvalidator.exact_length":"{field} devia ter exactamente {param1} caracteres","formvalidator.email":"{field} deve ser um e-mail válido","formvalidator.url":"O {field} deve ser um URL válido","formvalidator.ip":"{field} não tem um endereço IP {param1} válido","formvalidator.phone":"{field} deve ser preenchido com um número de telefone {param1} válido.","formvalidator.credit_card":"{field} não tem um cartão de crédito {param1} válido","formvalidator.date":"{field} deve conter uma data no formato {param1}","formvalidator.alpha":"O campo {field} deve conter apenas caracteres alfabéticos","formvalidator.text":"O campo {field} deve conter apenas caracteres alfabéticos","formvalidator.latin":"O campo {field} deve conter apenas caracteres alfabéticos","formvalidator.alpha_numeric":"{field} deve conter apenas letras e números","formvalidator.alpha_dash":"{field} deve conter apenas letras e traços","formvalidator.digit":"{field} destina-se a ser preenchido com apenas um dígito","formvalidator.integer":"{field} deve conter um número inteiro","formvalidator.decimal":"{field} deve conter um número válido","formvalidator.numeric":"{field} deve conter um número válido","formvalidator.range":"{field} deve conter um número entre {param1} e {param2}","formvalidator.color":"{field} deve conter uma cor válida","formvalidator.matches":"{field} deve corresponder ao campo {param1}","formvalidator.validation_function_not_found":"[A regra {rule} não foi definida]"}},"en_US");return i._name="FormElement_1",i._optionDefinition={label:["String",null],rules:["String",null],form:["Object"]},i.prototype={_init:function(){this._errors={},this._rules={},this._value=null,null===this._options.label&&(this._options.label=this._getLabel())},_getLabel:function(){var a=b.findUpwardsBySelector(this._element,".control-group label");return a?b.textContent(a):this._element.name||this._element.id||""},_parseRules:function(a){this._rules={},a=a.split("|");var b,c=a.length,d,e,f;if(c>0)for(b=0;c>b;b++)if(d=a[b])if(-1!==(f=d.indexOf("["))){e=d.substr(f+1),e=e.split("]"),e=e[0],e=e.split(",");for(var g=0,h=e.length;h>g;g++)e[g]="true"===e[g]?!0:"false"===e[g]?!1:e[g];e.splice(0,0,this.getValue()),d=d.substr(0,f),this._rules[d]=e}else this._rules[d]=[this.getValue()]},_addError:function(a){for(var b=this._rules[a]||[],c={field:this._options.label,value:this.getValue()},d=1;d<b.length;d++)c["param"+d]=b[d];var e="formvalidator."+a;this._errors[a]=l.text(e,c),this._errors[a]===e&&(this._errors[a]="Validation message not found")},getValue:function(){switch(this._element.nodeName.toLowerCase()){case"select":return Ink.s("option:selected",this._element).value;case"textarea":return this._element.value;case"input":if(!("type"in this._element))return this._element.value;if("radio"===this._element.type||"checkbox"===this._element.type){if(this._element.checked)return this._element.value}else if("file"!==this._element.type)return this._element.value;return;default:return this._element.innerHTML}},getErrors:function(){return this._errors},getElement:function(){return this._element},getFormElements:function(){return this._options.form._formElements},validate:function(){if(this._errors={},0||this._parseRules(this._options.rules),"required"in this._rules||""!==this.getValue())for(var a in this._rules)if(this._rules.hasOwnProperty(a)){if("function"!=typeof k[a])return Ink.warn('Rule "'+a+'" not found. Used in element:',this._element),this._addError(null),!1;if(k[a].apply(this,this._rules[a])===!1)return this._addError(a),!1}return!0}},a.createUIComponent(i),j._name="FormValidator_1",j._optionDefinition={eventTrigger:["String","submit"],neverSubmit:["Boolean","false"],searchFor:["String","input, select, textarea, .control-group"],beforeValidation:["Function",void 0],onError:["Function",void 0],onSuccess:["Function",void 0]},j.setRule=function(a,b,c){if(k[a]=c,l.getKey("formvalidator."+a)!==b){var d={};d["formvalidator."+a]=b;var e={};e[l.lang()]=d,l.append(e)}},j.getI18n=function(){return l},j.setI18n=function(a){l=a},j.appendI18n=function(){l.append.apply(l,[].slice.call(arguments))},j.setLanguage=function(a){l.lang(a)},j.getRules=function(){return k},j.prototype={_init:function(){this._rootElement=this._element,this._formElements={},this._errorMessages=[],this._markedErrorElements=[],"string"==typeof this._options.eventTrigger&&c.observe(this._rootElement,this._options.eventTrigger,Ink.bindEvent(this.validate,this))},getElements:function(){this._formElements={};var a=d.select(this._options.searchFor,this._rootElement);if(a.length){var c,e;for(c=0;c<a.length;c+=1){e=a[c];var f=b.data(e);if("rules"in f){var g={form:this},h;"name"in e&&e.name?h=e.name:"id"in e&&e.id?h=e.id:(h="element_"+Math.floor(100*Math.random()),e.id=h),h in this._formElements||(this._formElements[h]=[]),this._formElements[h].push(new i(e,g))}}}return this._formElements},validate:function(a){this._options.neverSubmit+""=="true"&&a&&c.stopDefault(a),"function"==typeof this._options.beforeValidation&&this._options.beforeValidation(),f.each(this._markedErrorElements,function(a){e.removeClassName(a,["validation","error"])}),f.each(this._errorMessages,b.remove),this.getElements();var d=[];for(var g in this._formElements)if(this._formElements.hasOwnProperty(g))for(var h=0;h<this._formElements[g].length;h+=1)this._formElements[g][h].validate()||d.push(this._formElements[g][h]);return 0===d.length?("function"==typeof this._options.onSuccess&&this._options.onSuccess(),a&&this._options.cancelEventOnSuccess+""=="true"?(c.stopDefault(a),!1):!0):(a&&c.stopDefault(a),"function"==typeof this._options.onError&&this._options.onError(d),this._errorMessages=[],this._markedErrorElements=[],f.each(d,Ink.bind(function(a){var c,d;e.hasClassName(a.getElement(),"control-group")?(c=a.getElement(),d=Ink.s(".control",a.getElement())):(c=b.findUpwardsByClass(a.getElement(),"control-group"),d=b.findUpwardsByClass(a.getElement(),"control")),c&&(e.addClassName(c,["validation","error"]),this._markedErrorElements.push(c));var f=document.createElement("p");e.addClassName(f,"tip"),d||c?(d||c).appendChild(f):b.insertAfter(f,a.getElement());var g=a.getErrors(),h=[];for(var i in g)g.hasOwnProperty(i)&&h.push(g[i]);f.innerHTML=h.join("<br/>"),this._errorMessages.push(f)},this)),!1)}},a.createUIComponent(j),j}),Ink.createModule("Ink.UI.ImageQuery","1",["Ink.UI.Common_1","Ink.Dom.Event_1","Ink.Dom.Element_1","Ink.Util.Array_1"],function(a,b,c,d){"use strict";function e(){a.BaseUIComponent.apply(this,arguments)}return e._name="ImageQuery_1",e._optionDefinition={src:["String"],retina:["String",void 0],queries:["Object"],onLoad:["Function",null]},e.prototype={_init:function(){var a;if(-1!==(a=this._element.src.lastIndexOf("?"))){var c=this._element.src.substr(a);this._filename=this._element.src.replace(c,"").split("/").pop()+c}else this._filename=this._element.src.split("/").pop();this._options.queries||(this._options.queries=[]),this._options.queries=d.sortMulti(this._options.queries,"width").reverse(),"function"==typeof this._options.onLoad&&b.observe(this._element,"onload",Ink.bindEvent(this._onLoad,this)),this._onResize(),b.observe(window,"resize",b.throttle(Ink.bindMethod(this,"_onResize"),400))},_onResize:function(){if(this._options.queries.length){var a=this._findCurrentQuery(),b=a.src||this._options.src;if(window.devicePixelRatio>1&&void 0!==this._options.retina&&(b=a.retina||this._options.retina),a.file=this._filename,"function"==typeof b&&(b=b.apply(this,[this._element,a]),"string"!=typeof b))throw'[ImageQuery] :: "src" callback does not return a string';b=b.replace(/{:(.*?)}/g,function(b,c){return a[c]}),this._element.src=b,delete a.file}},_findCurrentQuery:function(){for(var a=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,b=this._options.queries,c=b.length-1,d=0;c>d;d+=1)if(b[d].width<=a)return b[d];return b[c]},_onLoad:function(){this._options.onLoad.call(this)}},a.createUIComponent(e),e}),Ink.createModule("Ink.UI.LazyLoad","1",["Ink.UI.Common_1","Ink.Dom.Event_1","Ink.Dom.Element_1"],function(a,b,c){"use strict";function d(){a.BaseUIComponent.apply(this,arguments)}return d._name="LazyLoad_1",d._optionDefinition={item:["String",".lazyload-item"],placeholder:["String",null],source:["String","data-src"],destination:["String","src"],delay:["Number",100],delta:["Number",0],image:["Boolean",!0],scrollElement:["Element",window],touchEvents:["Boolean",!0],onInsideViewport:["Function",!1],onAfterAttributeChange:["Function",!1],autoInit:["Boolean",!0]},d.prototype={_init:function(){this._rootElm=this._element,this._aData=[],this._hasEvents=!1,this._options.autoInit&&this._activate()},_activate:function(){this._getData(),this._hasEvents||this._addEvents(),this._onScrollThrottled()},_getData:function(){for(var a=Ink.ss(this._options.item),b=null,d=0,e=a.length;e>d;d++)null==this._options.placeholder||c.hasAttribute(a[d],this._options.destination)||a[d].setAttribute(this._options.destination,this._options.placeholder),b=a[d].getAttribute(this._options.source),null===b&&this._options.image||this._aData.push({elm:a[d],original:b})},_addEvents:function(){this._onScrollThrottled=b.throttle(Ink.bindEvent(this._onScroll,this),this._options.delay),"ontouchmove"in document.documentElement&&this._options.touchEvents&&b.observe(document.documentElement,"touchmove",this._onScrollThrottled),b.observe(this._options.scrollElement,"scroll",this._onScrollThrottled),this._hasEvents=!0},_removeEvents:function(){"ontouchmove"in document.documentElement&&this._options.touchEvents&&b.stopObserving(document.documentElement,"touchmove",this._onScrollThrottled),b.stopObserving(this._options.scrollElement,"scroll",this._onScrollThrottled),this._hasEvents=!1},_onScroll:function(){for(var a,b=0;b<this._aData.length;b++)a=this._aData[b],c.inViewport(a.elm,{partial:!0,margin:this._options.delta})&&(this._elInViewport(a),this._options.image&&(this._aData.splice(b,1),b-=1));0===this._aData.length&&this._removeEvents()},_elInViewport:function(a){this._userCallback("onInsideViewport",{element:a.elm}),this._options.image&&(a.elm.setAttribute(this._options.destination,a.original),a.elm.removeAttribute(this._options.source)),this._userCallback("onAfterAttributeChange",{element:a.elm})},_userCallback:function(a){"function"==typeof this._options[a]&&this._options[a].apply(this,[].slice.call(arguments,1))},reload:function(){this._activate()},destroy:function(){this._hasEvents&&this._removeEvents(),a.destroyComponent.call(this)}},a.createUIComponent(d),d}),Ink.createModule("Ink.UI.Modal","1",["Ink.UI.Common_1","Ink.Dom.Event_1","Ink.Dom.Css_1","Ink.Dom.Element_1","Ink.Dom.Selector_1","Ink.Util.Array_1"],function(a,b,c,d,e,f){"use strict";function g(a){var b=a.match(/^./)[0];return b.toUpperCase()+a.replace(/^./,"")}function h(a){return"max"+g(a)}function i(){a.BaseUIComponent.apply(this,arguments)}var j=function(a){return a.style.opacity="invalid","invalid"!==a.style.opacity}(d.create("div",{style:"opacity: 1"})),k=[];return i._name="Modal_1",i._optionDefinition={width:["String",void 0],height:["String",void 0],shadeClass:["String",void 0],modalClass:["String",void 0],trigger:["String",void 0],triggerEvent:["String","click"],autoDisplay:["Boolean",!0],markup:["String",void 0],onShow:["Function",void 0],onDismiss:["Function",void 0],closeOnClick:["Boolean",!1],closeOnEscape:["Boolean",!0],responsive:["Boolean",!0]},i.prototype={_init:function(){if(this._handlers={click:Ink.bindEvent(this._onShadeClick,this),keyDown:Ink.bindEvent(this._onKeyDown,this),resize:Ink.bindEvent(this._onResize,this)},this._wasDismissed=!1,this._markupMode=this._element?c.hasClassName(this._element,"ink-modal"):!1,this._markupMode){if(this._modalDiv=this._element,this._modalDivStyle=this._modalDiv.style,this._modalShadow=this._modalDiv.parentNode,this._modalShadowStyle=this._modalShadow.style,this._contentContainer=e.select(".modal-body",this._modalDiv)[0],!this._contentContainer)throw new Error('Ink.UI.Modal: Missing div with class "modal-body"');this._options.markup=this._contentContainer.innerHTML}else this._modalShadow=document.createElement("div"),this._modalShadowStyle=this._modalShadow.style,this._modalDiv=document.createElement("div"),this._modalDivStyle=this._modalDiv.style,this._element&&(this._options.markup=this._element.innerHTML),c.addClassName(this._modalShadow,"ink-shade"),c.addClassName(this._modalDiv,"ink-modal ink-space"),this._modalShadow.appendChild(this._modalDiv),document.body.appendChild(this._modalShadow);if(this._markupMode||this.setContentMarkup(this._options.markup),"string"==typeof this._options.shadeClass&&c.addClassName(this._modalShadow,this._options.shadeClass),"string"==typeof this._options.modalClass&&c.addClassName(this._modalDiv,this._options.modalClass),this._options.trigger){var d=a.elsOrSelector(this._options.trigger,"");b.observeMulti(d,this._options.triggerEvent,Ink.bindEvent(this.open,this))}else"true"===this._options.autoDisplay.toString()&&this.open()},_reposition:function(){this._modalDivStyle.marginTop=-d.elementHeight(this._modalDiv)/2+"px",this._modalDivStyle.marginLeft=-d.elementWidth(this._modalDiv)/2+"px"},_onResize:function(a){"boolean"==typeof a?this._timeoutResizeFunction.call(this):!this._resizeTimeout&&a&&"object"==typeof a&&(this._resizeTimeout=setTimeout(Ink.bind(this._timeoutResizeFunction,this),250))},_timeoutResizeFunction:function(){var a={width:-1!==(""+this._options.width).indexOf("%"),height:-1!==(""+this._options.height).indexOf("%")},b={height:d.viewportHeight(),width:d.viewportWidth()};f.forEach(["height","width"],Ink.bind(function(c){a[c]||(this._modalDivStyle[c]=b[c]>this.originalStatus[c]?this._modalDivStyle[h(c)]:Math.round(.9*b[c])+"px")},this)),this._resizeContainer(),this._reposition(),this._resizeTimeout=void 0},_onShadeClick:function(a){var f=b.element(a);if(c.hasClassName(f,"ink-close")||c.hasClassName(f,"ink-dismiss")||d.findUpwardsBySelector(f,".ink-close,.ink-dismiss")||this._options.closeOnClick&&(!d.descendantOf(this._shadeElement,f)||f===this._shadeElement)){for(var g=e.select(".ink-alert",this._shadeElement),h=g.length,i=0;h>i;i++)if(d.descendantOf(g[i],f))return;this.dismiss(),this._wasDismissed&&b.stop(a)}},_onKeyDown:function(a){27!==a.keyCode||this._wasDismissed||"true"===this._options.closeOnEscape.toString()&&k[k.length-1]===this&&(this.dismiss(),this._wasDismissed&&b.stop(a))},_resizeContainer:function(){var a=d.elementHeight(this._modalDiv);this._modalHeader=e.select(".modal-header",this._modalDiv)[0],this._modalHeader&&(a-=d.elementHeight(this._modalHeader)),this._modalFooter=e.select(".modal-footer",this._modalDiv)[0],this._modalFooter&&(a-=d.elementHeight(this._modalFooter)),this._contentContainer.style.height=a+"px",a!==d.elementHeight(this._contentContainer)&&(this._contentContainer.style.height=~~(a-(d.elementHeight(this._contentContainer)-a))+"px"),this._markupMode},open:function(a){a&&b.stop(a);var e="CSS1Compat"===document.compatMode?document.documentElement:document.body;this._resizeTimeout=null,c.addClassName(this._modalShadow,"ink-shade"),this._modalShadowStyle.display=this._modalDivStyle.display="block",setTimeout(Ink.bind(function(){c.addClassName(this._modalShadow,"visible"),c.addClassName(this._modalDiv,"visible")},this),100),this._contentElement=this._modalDiv,this._shadeElement=this._modalShadow,this._markupMode||this.setContentMarkup(this._options.markup);var i={width:-1!==(""+this._options.width).indexOf("%"),height:-1!==(""+this._options.height).indexOf("%")};f.forEach(["width","height"],Ink.bind(function(a){void 0!==this._options[a]?(this._modalDivStyle[a]=this._options[a],i[a]||(this._modalDivStyle[h(a)]=d["element"+g(a)](this._modalDiv)+"px")):this._modalDivStyle[h(a)]=d["element"+g(a)](this._modalDiv)+"px",i[a]&&parseInt(e["client"+h(a)],10)<=parseInt(this._modalDivStyle[a],10)&&(this._modalDivStyle[a]=Math.round(.9*parseInt(e["client"+h(a)],10))+"px")},this)),this.originalStatus={viewportHeight:d.elementHeight(e),viewportWidth:d.elementWidth(e),height:d.elementHeight(this._modalDiv),width:d.elementWidth(this._modalDiv)},"true"===this._options.responsive.toString()?(this._onResize(!0),b.observe(window,"resize",this._handlers.resize)):(this._resizeContainer(),this._reposition()),this._options.onShow&&this._options.onShow(this),b.observe(this._shadeElement,"click",this._handlers.click),"true"===this._options.closeOnEscape.toString()&&b.observe(document,"keydown",this._handlers.keyDown),this._wasDismissed=!1,k.push(this),c.addClassName(document.documentElement,"ink-modal-open")},dismiss:function(){if(!this._wasDismissed){if(this._options.onDismiss){var a=this._options.onDismiss(this);if(a===!1)return}if(this._wasDismissed=!0,this._options.responsive&&b.stopObserving(window,"resize",this._handlers.resize),this._markupMode?(c.removeClassName(this._modalDiv,"visible"),c.removeClassName(this._modalShadow,"visible"),this._waitForFade(this._modalShadow,Ink.bind(function(){this._modalShadowStyle.display="none"},this))):(this._modalShadow.parentNode.removeChild(this._modalShadow),this.destroy()),k=f.remove(k,f.keyValue(this,k),1),0===k.length){var d=document.documentElement;c.removeClassName(d,"ink-modal-open")}}},_waitForFade:function(a,d){if(!j)return d();for(var e=["transitionEnd","oTransitionEnd","webkitTransitionEnd"],f,g,h=0,i=e.length;i>h;h++)if(g=e[h],f="on"+g.toLowerCase(),f in a)return void b.observeOnce(a,g,d);var k=function(){+c.getStyle(a,"opacity")>0?setTimeout(k,250):d()};setTimeout(k,500)},destroy:function(){a.unregisterInstance(this._instanceId)},getContentElement:function(){return this._contentContainer},setContentMarkup:function(a){if(this._markupMode)this._contentContainer.innerHTML=a;else{if(this._modalDiv.innerHTML=[a].join(""),this._contentContainer=e.select(".modal-body",this._modalDiv),!this._contentContainer.length){var b=e.select(".modal-header",this._modalDiv),g=e.select(".modal-footer",this._modalDiv);f.each(b,d.remove),f.each(g,d.remove);var h=document.createElement("div");c.addClassName(h,"modal-body"),h.innerHTML=this._modalDiv.innerHTML,this._modalDiv.innerHTML="";var i=b.concat([h]).concat(g);f.each(i,Ink.bindMethod(this._modalDiv,"appendChild")),this._contentContainer=e.select(".modal-body",this._modalDiv)}this._contentContainer=this._contentContainer[0]}this._contentElement=this._modalDiv,this._resizeContainer()}},a.createUIComponent(i,{elementIsOptional:!0}),i}),Ink.createModule("Ink.UI.Pagination","1",["Ink.UI.Common_1","Ink.Dom.Event_1","Ink.Dom.Css_1","Ink.Dom.Element_1","Ink.Dom.Selector_1"],function(a,b,c,d,e){"use strict";function f(){a.BaseUIComponent.apply(this,arguments)}var g=function(a,b,c){var d=document.createElement("a");if(d.setAttribute("href","#"),"number"==typeof b&&d.setAttribute("data-index",b),c&&c.wrapText){var e=document.createElement("span");d.appendChild(e),e.innerHTML=a}else d.innerHTML=a;return d};return f._name="Pagination_1",f._optionDefinition={size:["Integer",null],totalItemCount:["Integer",null],itemsPerPage:["Integer",null],maxSize:["Integer",null],start:["Integer",1],sideButtons:["Boolean",1],firstLabel:["String","First"],lastLabel:["String","Last"],previousLabel:["String","Previous"],nextLabel:["String","Next"],previousPageLabel:["String",null],nextPageLabel:["String",null],onChange:["Function",void 0],hashParameter:["String","page"],parentTag:["String","ul"],childTag:["String","li"],wrapperClass:["String","ink-navigation"],paginationClass:["String","pagination"],activeClass:["String","active"],disabledClass:["String","disabled"],hideClass:["String","hide-all"],previousClass:["String","previous"],previousPageClass:["String","previousPage"],nextClass:["String","next"],nextPageClass:["String","nextPage"],numberFormatter:["Function",function(a){return a+1}]},f.prototype={_init:function(){this._options.previousPageLabel||(this._options.previousPageLabel=this._options.previousLabel+" "+this._options.maxSize),this._options.nextPageLabel||(this._options.nextPageLabel=this._options.nextLabel+" "+this._options.maxSize),this._handlers={click:Ink.bindEvent(this._onClick,this)},a.isInteger(this._options.totalItemCount)&&a.isInteger(this._options.itemsPerPage)?this._size=this._calculateSize(this._options.totalItemCount,this._options.itemsPerPage):a.isInteger(this._options.size)?this._size=this._options.size:(Ink.error("Ink.UI.Pagination: Please supply a size option or totalItemCount and itemsPerPage options."),this._size=0),this._current=this._options.start-1,this._itemLiEls=[],this._generateMarkup(this._element),this._updateItems(),this._observe()},_observe:function(){b.observeDelegated(this._element,"click","."+this._options.paginationClass+" > "+this._options.childTag,this._handlers.click)
|
||
},_calculateSize:function(a,b){return Math.ceil(a/b)},_updateItems:function(){var a=this._itemLiEls,b=this._size===a.length,d,e,f;if(b)for(d=0,e=this._size;e>d;++d)c.setClassName(a[d],this._options.activeClass,d===this._current);else{for(d=a.length-1;d>=0;--d)this._ulEl.removeChild(a[d]);for(a=[],d=0,e=this._size;e>d;++d)f=document.createElement(this._options.childTag),f.appendChild(g(this._options.numberFormatter(d),d)),c.setClassName(f,this._options.activeClass,d===this._current),this._nextEl?this._ulEl.insertBefore(f,this._nextEl):this._ulEl.appendChild(f),a.push(f);this._itemLiEls=a}if(this._options.maxSize){var h=Math.floor(this._current/this._options.maxSize),i=this._options.maxSize*h,j=i+this._options.maxSize-1;for(d=0,e=this._size;e>d;++d)f=a[d],c.setClassName(f,this._options.hideClass,i>d||d>j);this._pageStart=i,this._pageEnd=j,this._page=h,c.setClassName(this._prevPageEl,this._options.disabledClass,!this.hasPreviousPage()),c.setClassName(this._nextPageEl,this._options.disabledClass,!this.hasNextPage()),c.setClassName(this._firstEl,this._options.disabledClass,this.isFirst()),c.setClassName(this._lastEl,this._options.disabledClass,this.isLast())}this._prevEl&&c.setClassName(this._prevEl,this._options.disabledClass,!this.hasPrevious()),this._nextEl&&c.setClassName(this._nextEl,this._options.disabledClass,!this.hasNext())},_generateMarkup:function(a){c.addClassName(a,"ink-navigation");var b=Ink.s("."+this._options.paginationClass,a),d=!1;b?d=!0:(b=document.createElement(this._options.parentTag),c.addClassName(b,this._options.paginationClass));var e=c.hasClassName(b,"chevron"),f=c.hasClassName(b,"dotted"),h=Ink.bind(function(a,d){var e=document.createElement(this._options.childTag),f=g(this._options[a+"Label"],void 0,{wrapText:d&&d.wrapText});return c.addClassName(e,this._options[a+"Class"]),e.appendChild(f),b.appendChild(e),e},this);!f&&this._options.maxSize&&(this._firstEl=h("first"),this._prevPageEl=h("previousPage")),(f&&this._options.sideButtons===!0||!f&&this._options.sideButtons)&&(this._prevEl=h("previous",{wrapText:e}),this._nextEl=h("next",{wrapText:e})),!f&&this._options.maxSize&&(this._nextPageEl=h("nextPage"),this._lastEl=h("last")),d||a.appendChild(b),this._ulEl=b},_onClick:function(a){b.stop(a);var d=b.element(a);if(!c.hasClassName(d,this._options.activeClass)&&!c.hasClassName(d,this._options.disabledClass)){var f=c.hasClassName(d,this._options.previousClass),g=c.hasClassName(d,this._options.nextClass),h=c.hasClassName(d,this._options.previousPageClass),i=c.hasClassName(d,this._options.nextPageClass),j=c.hasClassName(d,this._options.firstClass),k=c.hasClassName(d,this._options.lastClass);if(j)this.setCurrent(0);else if(k)this.setCurrent(this._size-1);else if(h||i)this.setCurrent((h?-1:1)*this._options.maxSize,!0);else if(f||g)this.setCurrent(f?-1:1,!0);else{var l=e.select("[data-index]",d)[0],m=l&&parseInt(l.getAttribute("data-index"),10);this.setCurrent(m)}}},setOnChange:function(a){if(void 0!==a&&"function"!=typeof a)throw new TypeError("onChange option must be a function!");this._options.onChange=a},setSize:function(b){if(!a.isInteger(b))throw new TypeError("1st argument must be an integer number!");this._size=b,this._updateItems(),this._current=0},setSizeInItems:function(a,b){var c=Math.ceil(a/b);this.setSize(c)},setCurrent:function(b,c){if(!a.isInteger(b))throw new TypeError("1st argument must be an integer number!");c&&(b+=this._current),b>this._size-1&&(b=this._size-1),0>b&&(b=0),this._current=b,this._updateItems(),this._options.onChange&&this._options.onChange(this,b)},getSize:function(){return this._size},getCurrent:function(){return this._current},isFirst:function(){return 0===this._current},isLast:function(){return this._current===this._size-1},hasPrevious:function(){return this._current>0},hasNext:function(){return this._current<this._size-1},hasPreviousPage:function(){return this._options.maxSize&&this._current>this._options.maxSize-1},hasNextPage:function(){return this._options.maxSize&&this._size-this._current>=this._options.maxSize+1},destroy:a.destroyComponent},a.createUIComponent(f),f}),Ink.createModule("Ink.UI.ProgressBar","1",["Ink.UI.Common_1","Ink.Dom.Selector_1"],function(a,b){"use strict";function c(){a.BaseUIComponent.apply(this,arguments)}return c._name="ProgressBar_1",c._optionDefinition={startValue:["Number",0],onStart:["Function",function(){}],onEnd:["Function",function(){}]},c.prototype={_init:function(){if(this._value=this._options.startValue,this._elementBar=b.select(".bar",this._element),this._elementBar.length<1)throw new Error("[Ink.UI.ProgressBar] :: Bar element not found");this._elementBar=this._elementBar[0],this.setValue(this._options.startValue)},setValue:function(a){this._options.onStart.call(this,this._value),a=parseInt(a,10),isNaN(a)||0>a?a=0:a>100&&(a=100),this._value=a,this._elementBar.style.width=this._value+"%",this._options.onEnd.call(this,this._value)}},a.createUIComponent(c),c}),Ink.createModule("Ink.UI.SmoothScroller","1",["Ink.UI.Common_1","Ink.Dom.Event_1","Ink.Dom.Element_1","Ink.Dom.Selector_1","Ink.Dom.Css_1"],function(a,b,c,d,e){"use strict";var f=window.requestAnimationFrame||function(a){return setTimeout(a,10)},g=window.cancelAnimationFrame||function(a){clearTimeout(a)},h={speed:10,changeHash:!0,margin:0,scroll:function(a,b){var d=Math.round(c.scrollHeight()),e=Math.round(a-b.margin);d+=e>d?Math.ceil((e-d)/b.speed):(e-d)/b.speed,g(h.interval),d!==e&&h.offsetTop!==d?h.interval=f(Ink.bindMethod(h,"scroll",a,b),document.body):h.onDone(b),window.scrollTo(0,d),h.offsetTop=d},init:function(a){b.on(document,"click",a||"a.scrollableLink, a.ink-smooth-scroll",h.onClick)},render:function(){},onClick:function(b){var d=b.currentTarget,f=(location+"").replace(/#.*?$/,""),g=(d.href+"").replace(/#.*?$/,"");if(g===f){var i=d.getAttribute("data-hash")||(d.getAttribute("href")||"").replace(/^.*?#/,"");if(i){b.preventDefault();var j="ul > li.active > "+k,k='a[name="'+i+'"],#'+i,l=Ink.s(k),m=Ink.s(j);if(m=m&&m.parentNode,l){e.hasClassName(d.parentNode,"active")||(m&&e.removeClassName(m,"active"),e.addClassName(d.parentNode,"active"));var n=a.options("SmoothScroller link options",{margin:["Number",h.margin],speed:["Number",h.speed],changeHash:["Boolean",h.changeHash]},{},d);h.hash=i,h.scroll(c.offsetTop(l),n)}}}},onDone:function(a){a.changeHash===!0&&(window.location.hash=h.hash),h.hash=h.offsetTop=null}};return h}),Ink.createModule("Ink.UI.SortableList","1",["Ink.UI.Common_1","Ink.Dom.Css_1","Ink.Dom.Event_1","Ink.Dom.Element_1","Ink.Dom.Selector_1"],function(a,b,c,d,e){"use strict";function f(){a.BaseUIComponent.apply(this,arguments)}var g="ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0;return f._name="SortableList_1",f._optionDefinition={placeholderClass:["String","placeholder"],draggedClass:["String","hide-all"],draggingClass:["String","dragging"],dragSelector:["String","li"],dragObject:["String",null],handleSelector:["String",null],moveSelector:["String",!1],swap:["Boolean",!1],cancelMouseOut:["Boolean",!1],onDrop:["Function",function(){}]},f.prototype={_init:function(){null!=this._options.dragObject&&(Ink.warn("Ink.UI.SortableList: options.dragObject is now deprecated. Please use options.handleSelector instead."),this._options.handleSelector=this._options.handleSelector||this._options.dragObject),this._handlers={down:Ink.bind(this._onDown,this),move:Ink.bind(this._onMove,this),up:Ink.bind(this._onUp,this)},this._isMoving=!1,this._down=g?"touchstart mousedown":"mousedown",this._move=g?"touchmove mousemove":"mousemove",this._up=g?"touchend mouseup":"mouseup",this._observe()},_observe:function(){c.on(this._element,this._down,this._options.dragSelector,this._handlers.down),c.on(this._element,this._move,this._options.dragSelector,this._handlers.move),this._options.cancelMouseOut&&c.on(this._element,"mouseleave",Ink.bind(this.stopMoving,this)),c.on(document.documentElement,this._up,this._handlers.up)},_onDown:function(a){if(!(this._isMoving||this._placeholder||this._options.handleSelector&&!e.matchesSelector(a.target,this._options.handleSelector))){var b=a.currentTarget;return this._isMoving=b,this._placeholder=b.cloneNode(!0),this._movePlaceholder(b),this._addMovingClasses(),!1}},_onMove:function(a){var b=a.currentTarget;if("touchmove"===a.type){var c=a.touches[0];b=document.elementFromPoint(c.clientX,c.clientY),b=d.findUpwardsBySelector(b,this._options.dragSelector)}this.validateMove(b),a.preventDefault()},_onUp:function(a){return this._isMoving&&this._placeholder&&a.currentTarget!==this._isMoving&&a.currentTarget!==this._placeholder?(d.insertBefore(this._isMoving,this._placeholder),this.stopMoving(),this._options.onDrop.call(this,{droppedElement:a.currentTarget}),!1):void 0},_addMovingClasses:function(){b.addClassName(this._placeholder,this._options.placeholderClass),b.addClassName(this._isMoving,this._options.draggedClass),b.addClassName(document.documentElement,this._options.draggingClass)},_removeMovingClasses:function(){this._isMoving&&b.removeClassName(this._isMoving,this._options.draggedClass),this._placeholder&&b.removeClassName(this._placeholder,this._options.placeholderClass),b.removeClassName(document.documentElement,this._options.draggingClass)},_movePlaceholder:function(a){var b=this._placeholder,c,e,f,g;b?this._options.swap?(d.insertAfter(b,a),d.insertBefore(a,this._isMoving),d.insertBefore(this._isMoving,b)):(c=d.offset(a),e=d.offset(this._placeholder),f=c[1]>e[1],g=c[0]>e[0],f&&g||!f&&!g?d.insertBefore(b,a):d.insertAfter(b,a),d.insertBefore(this._isMoving,b)):d.insertAfter(b,a)},destroy:a.destroyComponent,stopMoving:function(){this._removeMovingClasses(),d.remove(this._placeholder),this._placeholder=!1,this._isMoving=!1},validateMove:function(a){a&&this._isMoving&&this._placeholder&&a!==this._placeholder&&a!==this._isMoving&&(!this._options.moveSelector||e.matchesSelector(a,this._options.moveSelector)?this._movePlaceholder(a):this.stopMoving())}},a.createUIComponent(f),f}),Ink.createModule("Ink.UI.Spy","1",["Ink.UI.Common_1","Ink.Dom.Event_1","Ink.Dom.Css_1","Ink.Dom.Element_1","Ink.Dom.Selector_1"],function(a,b,c,d,e){"use strict";function f(a){for(var b=0,c=m.length;c>b;b++)if(m[b][0]===a)return b;return null}function g(a,b){var c=f(b);null===c?m.push([b,[a]]):m[c][1].push(a)}function h(){n||(n=!0,b.observe(document,"scroll",b.throttle(i,300)))}function i(){for(var a=0,b=m.length;b>a;a++)j(m[a][0],m[a][1])}function j(a,b){for(var f=k(b),g=e.select("li.active",a),h=0,i=g.length;i>h;h++)c.removeClassName(g[h],"active");if(null!==f){var j='a[href$="#'+(f.name||f.id)+'"]',l=e.select(j,a);for(h=0,i=l.length;i>h;h++)c.addClassName(d.findUpwardsByTag(l[h],"li"),"active")}}function k(a){for(var b=-1/0,c,d,e=0,f=a.length;f>e;e++)d=a[e].getBoundingClientRect(),d.top<=0&&d.top>b&&(b=d.top,c=e);return void 0===c?null:a[c]}function l(){a.BaseUIComponent.apply(this,arguments)}var m=[],n=!1;return l._name="Spy_1",l._optionDefinition={target:["Element",void 0],activeClass:["String","active"]},l.prototype={_init:function(){g(this._element,this._options.target),h(),i()}},a.createUIComponent(l),l}),Ink.createModule("Ink.UI.Stacker",1,["Ink.UI.Common_1","Ink.Dom.Event_1","Ink.Dom.Element_1"],function(a,b,c){"use strict";function d(){a.BaseUIComponent.apply(this,arguments)}return d._name="Stacker_1",d._optionDefinition={column:["String",".stacker-column"],item:["String",".stacker-item"],customBreakPoints:["Object",null],largeMax:["Number",Number.MAX_VALUE],largeMin:["Number",961],mediumMax:["Number",960],mediumMin:["Number",651],smallMax:["Number",650],smallMin:["Number",0],largeCols:["Integer",3],mediumCols:["Integer",2],smallCols:["Integer",1],isOrdered:["Boolean",!0],onRunCallback:["Function",null],onResizeCallback:["Function",null],onAPIReloadCallback:["Function",null]},d.prototype={_init:function(){this._aList=[],this._curLayout="large",this._runFirstTime=!1,this._getPageItemsToList(),(this._canApplyLayoutChange()||!this._runFirstTime)&&(this._runFirstTime=!0,this._applyLayoutChange(),"function"==typeof this._options.onRunCallback&&this._options.onRunCallback(this._curLayout)),this._addEvents()},addItem:function(a){this._aList.push(a)},reloadItems:function(){this._applyLayoutChange(),"function"==typeof this._options.onAPIReloadCallback&&this._options.onAPIReloadCallback(this._curLayout)},_addEvents:function(){b.observe(window,"resize",Ink.bindEvent(this._onResize,this))},_onResize:function(){this._canApplyLayoutChange()&&(this._removeDomItems(),this._applyLayoutChange(),"function"==typeof this._options.onResizeCallback&&this._options.onResizeCallback(this._curLayout))},_setCurLayout:function(){var a=c.viewportWidth();if(this._options.customBreakpoints&&"object"==typeof this._options.customBreakPoints){for(var b in this._options.customBreakPoints)if(this._options.customBreakPoints.hasOwnProperty(b)&&a>=Number(this._options.customBreakPoints[b].min)&&a<=Number(this._options.customBreakPoints[b].max)&&this._curLayout!==b)return void(this._curLayout=b)}else a<=Number(this._options.largeMax)&&a>=Number(this._options.largeMin)&&"large"!==this._curLayout?this._curLayout="large":a>=Number(this._options.mediumMin)&&a<=Number(this._options.mediumMax)&&"medium"!==this._curLayout?this._curLayout="medium":a>=Number(this._options.smallMin)&&a<=Number(this._options.smallMax)&&"small"!==this._curLayout&&(this._curLayout="small")},_getColumnsToShow:function(){return Number(this._options.customBreakPoints&&"object"==typeof this._options.customBreakPoints?this._options.customBreakPoints[this._curLayout].cols:this._options[this._curLayout+"Cols"])},_canApplyLayoutChange:function(){var a=this._curLayout;return this._setCurLayout(),a!==this._curLayout?!0:!1},_getPageItemsToList:function(){this._aColumn=Ink.ss(this._options.column,this._element);var a=this._aColumn.length,b=0;if(a>0){for(var c=0;c<this._aColumn.length;c++)for(var d=Ink.ss(this._options.item,this._aColumn[c]),e=0;e<d.length;e++)this._options.isOrdered&&(b=c+e*a),this._aList[b]=d[e],this._options.isOrdered||b++,d[e].parentNode.removeChild(d[e]);if(this._aList.length>0&&this._options.isOrdered){for(var f=[],g=0;g<this._aList.length;g++)"undefined"!=typeof this._aList[g]&&f.push(this._aList[g]);this._aList=f}}},_removeDomItems:function(){var a=this._aColumn.length;if(a>0)for(var b=0;a>b;b++)for(var c=Ink.ss(this._options.item,this._aColumn[b]),d=c.length-1;d>=0;d--)c[d].parentNode.removeChild(c[d])},_applyLayoutChange:function(){var a=this._getColumnsToShow(),b=this._aList.length,c=0,d=0;if(a>0)for(;a>d;){if(this._aColumn[d].appendChild(this._aList[c]),c++,d++,c===b)return;d===a&&(d=0)}}},a.createUIComponent(d),d}),Ink.createModule("Ink.UI.Sticky","1",["Ink.UI.Common_1","Ink.Dom.Event_1","Ink.Dom.Element_1","Ink.Dom.Css_1"],function(a,b,c,d){"use strict";function e(){a.BaseUIComponent.apply(this,arguments)}return e._name="Sticky_1",e._optionDefinition={offsetBottom:["Integer",0],offsetTop:["Integer",0],topElement:["Element",null],wrapperClass:["String","ink-sticky-wrapper"],stickyClass:["String","ink-sticky-stuck"],inlineDimensions:["Boolean",!0],inlinePosition:["Boolean",!0],bottomElement:["Element",null],activateInLayouts:["String","tiny,small,medium,large,xlarge"]},e.prototype={_init:function(){this._options.activateInLayouts=this._options.activateInLayouts.toString(),this._dims=null,this._options.offsetTop=parseInt(this._options.offsetTop,10)||0,this._options.offsetBottom=parseInt(this._options.offsetBottom,10)||0,this._options.topElement&&(this._options.topElement=a.elOrSelector(this._options.topElement,"Top Element")),this._options.bottomElement&&(this._options.bottomElement=a.elOrSelector(this._options.bottomElement,"Sticky bottom Element")),this._wrapper=c.create("div",{className:this._options.wrapperClass}),c.wrap(this._element,this._wrapper);var d=document.addEventListener?document:window;this._onScroll=Ink.bind(b.throttle(this._onScroll,33),this),b.observe(d,"scroll",this._onScroll),b.observe(window,"resize",Ink.bindEvent(b.throttle(this._onResize,100),this)),this._onScroll()},_isDisabledInLayout:function(){var b=a.currentLayout();return b?-1===this._options.activateInLayouts.indexOf(b):!1},_onScroll:function(){var a=this._getDims(),b=c.scrollHeight(),d=this._isDisabledInLayout()||b<=a.top-this._options.offsetTop||this._options.topElement&&this._options.topElement.getBoundingClientRect().bottom+this._options.offsetTop>0;if(d)return void this._unstick();var e=this._options.offsetTop+a.height+c.scrollHeight(),f=document.body.scrollHeight;this._options.bottomElement&&(f=this._options.bottomElement.getBoundingClientRect().top+c.scrollHeight()),f-=this._options.offsetBottom,this._stickTo(f>e?"screen":"bottom")},_stickTo:function(a){var b=this._element.style,e=this._getDims();if(d.addClassName(this._element,this._options.stickyClass),this._wrapper.style.height=e.height+"px",this._inlineDimensions(e.height+"px",e.width+"px"),this._options.inlinePosition!==!1)if(b.left=e.left+"px","screen"===a)b.bottom=null,b.top=this._options.offsetTop+"px";else if("bottom"===a){var f=this._getBottomOffset(),g=c.scrollHeight()+c.viewportHeight(),h=c.pageHeight()-g;b.bottom=f-h+"px",b.top="auto"}},_unstick:function(){d.removeClassName(this._element,this._options.stickyClass),this._inlineDimensions(null,null),this._options.inlinePosition&&(this._element.style.left=null,this._element.style.top=null,this._element.style.bottom=null),this._wrapper.style.height=null,this._wrapper.style.width=null,this._dims=null},_onResize:function(){this._dims=null,this._onScroll()},_getDims:function(){if(null!==this._dims)return this._dims;var a=this._element.style,b=a.position,d=a.width;a.position="static",a.width=null;var e=c.outerDimensions(this._element),f=this._wrapper.getBoundingClientRect();return this._dims={height:e[1],width:e[0],left:f.left+c.scrollWidth(),top:f.top+c.scrollHeight()},a.position=b,a.width=d,this._dims},_inlineDimensions:function(a,b){this._options.inlineDimensions&&(this._element.style.height=a,this._element.style.width=b)},_getBottomOffset:function(){var a=this._options.offsetBottom;return this._options.bottomElement&&(a+=c.pageHeight()-c.offsetTop(this._options.bottomElement)),a}},a.createUIComponent(e),e}),Ink.createModule("Ink.UI.Swipe","1",["Ink.Dom.Event_1","Ink.Dom.Element_1","Ink.UI.Common_1"],function(a,b,c){"use strict";function d(){"function"==typeof arguments[1]&&(arguments[1]={onEnd:arguments[1]}),c.BaseUIComponent.apply(this,arguments)}return d._name="Swipe_1",d._optionDefinition={onEnd:["Function",void 0],onStart:["Function",void 0],onMove:["Function",void 0],minDist:["Number",void 0],maxDist:["Number",void 0],minDuration:["Number",void 0],maxDuration:["Number",void 0],axis:["String",void 0],storeGesture:["Boolean",!1],stopEvents:["Boolean",!0]},d.prototype={_supported:"ontouchstart"in document.documentElement,_init:function(){this._handlers={down:Ink.bindEvent(this._onDown,this),move:Ink.bindEvent(this._onMove,this),up:Ink.bindEvent(this._onUp,this)};var b=document.body;a.observe(b,"touchstart",this._handlers.down),(this._options.storeGesture||this._options.onMove)&&a.observe(b,"touchmove",this._handlers.move),a.observe(b,"touchend",this._handlers.up),this._isOn=!1},_isMeOrParent:function(a,b){if(a){do{if(a===b)return!0;a=a.parentNode}while(a);return!1}},_pushGesture:function(a,b){this._options.storeGesture&&(this._gesture.push(a),this._time.push(b))},_onDown:function(b){1===b.changedTouches.length&&this._isMeOrParent(b.target,this._element)&&(this._options.stopEvents===!0&&a.stop(b),b=b.changedTouches[0],this._isOn=!0,this._target=b.target,this._t0=+new Date,this._p0=[b.pageX,b.pageY],this._options.storeGesture&&(this._gesture=[],this._time=[]),this._pushGesture(this._p0,0),this._options.onStart&&this._options.onStart({event:b,element:this._element,instance:this,position:this._p0,dt:0}))},_onMove:function(b){if(this._isOn&&1===b.changedTouches.length){this._options.stopEvents===!0&&a.stop(b),b=b.changedTouches[0];var c=+new Date,d=c-this._t0,e=[b.pageX,b.pageY];this._pushGesture(e,d),this._options.onMove&&this._options.onMove({event:b,element:this._element,instance:this,position:e,dt:d})}},_onUp:function(b){if(this._isOn&&1===b.changedTouches.length){this._options.stopEvents===!0&&a.stop(b),b=b.changedTouches[0],this._isOn=!1;var c=+new Date,d=[b.pageX,b.pageY],e=c-this._t0,f=[d[0]-this._p0[0],d[1]-this._p0[1]],g=Math.sqrt(f[0]*f[0]+f[1]*f[1]),h=Math.abs(f[0])>Math.abs(f[1])?"x":"y",i=this._options;i.minDist&&g<i.minDist||i.maxDist&&g>i.maxDist||i.minDuration&&e<i.minDuration||i.maxDuration&&e>i.maxDuration||i.axis&&h!==i.axis||this._options.onEnd&&this._options.onEnd({event:b,element:this._element,instance:this,gesture:this._gesture,time:this._time,axis:h,overallMovement:f,overallTime:e})}}},c.createUIComponent(d),d}),Ink.createModule("Ink.UI.Table","1",["Ink.Util.Url_1","Ink.UI.Pagination_1","Ink.Net.Ajax_1","Ink.UI.Common_1","Ink.Dom.Event_1","Ink.Dom.Css_1","Ink.Dom.Element_1","Ink.Dom.Selector_1","Ink.Util.Array_1","Ink.Util.String_1","Ink.Util.Json_1"],function(a,b,c,d,e,f,g,h,i,j,k){"use strict";function l(a){return!isNaN(a)&&r.test(a)?parseInt(a,10):isNaN(a)?a:parseFloat(a)}function m(a,b){return a===b?0:a>b?1:-1}function n(a,b){var c=l(g.textContent(a)),d=l(g.textContent(b));return m(c,d)}function o(a){if("undefined"!=typeof Object.keys)return Object.keys(a);var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(c);return b}function p(){d.BaseUIComponent.apply(this,arguments)}function q(a){return a}var r=/\d/g;return p._name="Table_1",p._optionDefinition={pageSize:["Integer",null],caretUpClass:["String","fa fa-caret-up"],caretDownClass:["String","fa fa-caret-down"],endpoint:["String",null],createEndpointUrl:["Function",null],getDataFromEndPoint:["Function",null],processJSONRows:["Function",q],processJSONRow:["Function",q],processJSONField:["Function",q],processJSONHeaders:["Function",function(a){return a.fields}],processJSONTotalRows:["Function",function(a){return a.length||a.totalRows}],getSortKey:["Function",null],pagination:["Element",null],allowResetSorting:["Boolean",!1],visibleFields:["String",null],tdClassNames:["Object",{}],paginationOptions:["Object",null]},p.prototype={_validate:function(){if("table"!==this._element.nodeName.toLowerCase())throw new Error("[Ink.UI.Table] :: The element is not a table")},_init:function(){this._markupMode=!this._options.endpoint,this._options.visibleFields&&(this._options.visibleFields=this._options.visibleFields.toString().split(/[, ]+/g)),this._thead=this._element.tHead||this._element.createTHead(),this._headers=h.select("th",this._thead),this._handlers={thClick:null},this._originalFields=[],this._sortableFields={},this._originalData=this._data=[],this._pagination=null,this._totalRows=0,this._handlers.thClick=e.observeDelegated(this._element,"click",'thead th[data-sortable="true"]',Ink.bindMethod(this,"_onThClick")),this._markupMode?(this._resetSortOrder(),this._addHeadersClasses(),this._data=h.select("tbody tr",this._element),this._originalData=this._data.slice(0),this._totalRows=this._data.length,this._setPagination()):this._getData()},_addHeadersClasses:function(){for(var a,b,c=0,d=this._headers.length;d>c;c++)a=g.textContent(this._headers[c]),b=this._options.tdClassNames[a],b&&f.addClassName(this._headers[c],b)},_onThClick:function(a){var b=e.element(a),c=void 0!==this._options.pageSize;e.stop(a);var f=i.keyValue(b,this._headers,!0),g=f!==!1&&void 0!==this._sortableFields[f];if(g)if(!this._markupMode&&c)this._invertSortOrder(f,!1);else{"desc"===this._sortableFields[f]&&this._options.allowResetSorting?(this._setSortOrderOfColumn(f,null),this._data=this._originalData.slice(0)):this._invertSortOrder(f,!0);var j=h.select("tbody",this._element)[0];d.cleanChildren(j),i.each(this._data,Ink.bindMethod(j,"appendChild")),this._pagination&&(this._pagination.setCurrent(0),this._paginate(1))}},_invertSortOrder:function(a,b){for(var c="asc"===this._sortableFields[a],d=0,e=this._headers.length;e>d;d++)this._setSortOrderOfColumn(d,null);b&&(this._sort(a),c&&this._data.reverse()),this._setSortOrderOfColumn(a,!c)},_setSortOrderOfColumn:function(a,b){var c=this._headers[a],d=[""],e="none";b===!0?(d=['<i class="',this._options.caretUpClass,'"></i>'],e="asc"):b===!1&&(d=['<i class="',this._options.caretDownClass,'"></i>'],e="desc"),this._sortableFields[a]=e,c.innerHTML=g.textContent(c)+d.join("")},_paginate:function(a){if(this._pagination){var b=this._options.pageSize,c=(a-1)*b,d=c+b;i.each(this._data,function(a,b){b>=c&&d>b?f.removeClassName(a,"hide-all"):f.addClassName(a,"hide-all")})}},_registerFieldNames:function(a){this._originalFields=[],i.forEach(a,Ink.bind(function(a){this._fieldIsVisible(a)&&this._originalFields.push(a)},this))},_fieldIsVisible:function(a){return!this._options.visibleFields||-1!==this._options.visibleFields.indexOf(a)},_sort:function(a){function b(b){return d.call(e,{columnIndex:a,columnName:c,data:g.textContent(b),element:b})}var c=g.textContent(this._headers[a]),d=this._options.getSortKey;d&&(d="function"==typeof d[c]?d[c]:"function"==typeof d?d:null);var e=this;this._data.sort(function(c,e){var f=Ink.ss("td",c)[a],g=Ink.ss("td",e)[a];return d?m(b(f),b(g)):n(f,g,a)})},_createHeadersFromJson:function(a){if(this._registerFieldNames(o(a)),!this._thead.children.length)for(var b=this._thead.insertRow(0),c,d=0,e=a.length;e>d;d++)this._fieldIsVisible(a[d])&&(c=g.create("th"),c=this._createSingleHeaderFromJson(a[d],c),b.appendChild(c),this._headers.push(c))},_createSingleHeaderFromJson:function(a,b){return a.sortable&&b.setAttribute("data-sortable","true"),a.label&&g.setTextContent(b,a.label),b},_resetSortOrder:function(){for(var a=0,b=this._headers.length;b>a;a++){var c=g.data(this._headers[a]);c.sortable&&"true"===c.sortable.toString()&&(this._sortableFields[a]="none")}},_createRowsFromJSON:function(a){var b=h.select("tbody",this._element)[0];b?g.setHTML(b,""):(b=document.createElement("tbody"),this._element.appendChild(b)),this._data=[];var c;for(var d in a)a.hasOwnProperty(d)&&(c=this._options.processJSONRow(a[d]),this._createSingleRowFromJson(b,c,d));this._originalData=this._data.slice(0)},_createSingleRowFromJson:function(a,b,c){var d=document.createElement("tr");a.appendChild(d);for(var e in b)b.hasOwnProperty(e)&&this._createFieldFromJson(d,b[e],e,c);this._data.push(d)},_createFieldFromJson:function(a,b,c,d){if(this._fieldIsVisible(c)){var e=this._options.processJSONField[c]||this._options.processJSONField,g;g="function"==typeof e?e(b,c,d):b;var h=this._elOrFieldData(g),i=this._options.tdClassNames[c];i&&f.addClassName(h,i),a.appendChild(h)}},_elOrFieldData:function(a){if(d.isDOMElement(a))return a;var b="string"==typeof a,c="number"==typeof a,e=g.create("td");if(b&&/^\s*?</.test(a))g.setHTML(e,a);else{if(!b&&!c)throw new Error("Ink.UI.Table Unknown result from processJSONField: "+a);g.setTextContent(e,a)}return e},setEndpoint:function(a,b){this._markupMode||(this._options.endpoint=a,this._pagination&&this._pagination.setCurrent(b?parseInt(b,10):0))},_setPagination:function(){if(null!=this._options.pageSize){var a=this._options.pagination;if(a instanceof b)return void(this._pagination=a);a||(a=g.create("nav",{className:"ink-navigation",insertAfter:this._element}),g.create("ul",{className:"pagination",insertBottom:a}));var c=Ink.extendObj({totalItemCount:this._totalRows,itemsPerPage:this._options.pageSize,onChange:Ink.bind(function(a,b){this._paginate(b+1)},this)},this._options.paginationOptions||{});this._pagination=new b(a,c),this._paginate(1)}},_getData:function(){var a=this._getSortOrder()||null,b=null;this._pagination&&(b={size:this._options.pageSize,page:this._pagination.getCurrent()+1}),this._getDataViaAjax(this._getUrl(a,b))},_getSortOrder:function(){var a;for(a in this._sortableFields)if(this._sortableFields.hasOwnProperty(a)&&"none"!==this._sortableFields[a])break;return a?{field:this._originalFields[a],order:this._sortableFields[a]}:null},_getUrl:function(b,c){var d=this._options.createEndpointUrl||function(b,c,d){return b=a.parseUrl(b),b.query=b.query||{},c&&(b.query.sortOrder=c.order,b.query.sortField=c.field),d&&(b.query.rows_per_page=d.size,b.query.page=d.page),a.format(b)},e=d(this._options.endpoint,b,c);if("string"!=typeof e)throw new TypeError("Ink.UI.Table_1: createEndpointUrl did not return a string!");return e},_getDataViaAjax:function(a){var b=Ink.bind(function(a){this._onAjaxSuccess(a)},this);this._options.getDataFromEndpoint?this._options.getDataFromEndpoint(a,b):new c(a,{method:"GET",contentType:"application/json",sanitizeJSON:!0,onSuccess:Ink.bind(function(a){200===a.status&&b(k.parse(a.responseText))},this)})},_onAjaxSuccess:function(a){var b=null!=this._options.pageSize,c=this._options.processJSONRows(a);if(this._headers=h.select("th",this._thead),0===this._headers.length){var d=this._options.processJSONHeaders(a);if(!d||!d.length||!d[0])throw new Error("Ink.UI.Table: processJSONHeaders option must return an array of objects!");this._createHeadersFromJson(d),this._resetSortOrder(),this._addHeadersClasses()}this._createRowsFromJSON(c),this._totalRows=this._rowLength=c.length,b&&(this._totalRows=this._options.processJSONTotalRows(a),this._setPagination())}},d.createUIComponent(p),p}),Ink.createModule("Ink.UI.Tabs","1",["Ink.UI.Common_1","Ink.Dom.Event_1","Ink.Dom.Css_1","Ink.Dom.Element_1","Ink.Dom.Selector_1"],function(a,b,c,d,e){"use strict";function f(){a.BaseUIComponent.apply(this,arguments)}return f._name="Tabs_1",f._optionDefinition={preventUrlChange:["Boolean",!1],active:["String",void 0],disabled:["Object",[]],onBeforeChange:["Function",void 0],onChange:["Function",void 0],menuSelector:["String",".tabs-nav"],contentSelector:["String",".tabs-content"],tabSelector:["String",".tabs-tab"],triggerEventsOnLoad:["Boolean",!0]},f.prototype={_init:function(){return this._handlers={resize:Ink.bindEvent(b.throttle(this._onResize,100),this)},this._menu=e.select(this._options.menuSelector,this._element)[0],this._menu?(this._initializeDom(),this._observe(),this._setFirstActive(),void this._handlers.resize()):void Ink.warn('Ink.UI.Tabs: An element selected by ".tabs-nav" needs to exist inside the element!')},_initializeDom:function(){for(var a=e.select(this._options.contentSelector,this._element),b=0;b<a.length;b++)c.addClassName(a[b],"hide-all")},_observe:function(){b.on(this._menu,"click","a",Ink.bindMethod(this,"_onTabClickedGeneric")),b.observe(window,"resize",this._handlers.resize)},_setFirstActive:function(){var a=window.location.hash,b=this._findLinkByHref(a)||this._options.active&&this._findLinkByHref(this._options.active)||e.select(".active a",this._menu)[0]||e.select("a",this._menu)[0];b&&this._changeTab(b,this._options.triggerEventsOnLoad)},_changeTab:function(a,b){b&&"undefined"!=typeof this._options.onBeforeChange&&this._options.onBeforeChange(this);for(var d=a.getAttribute("href"),f=e.select("> li.active",this._menu),g=0,h=f.length;h>g;g++)f[g]!==a&&c.removeClassName(f[g],"active");return this._activeMenuTab&&(c.removeClassName(this._activeMenuTab,"active"),c.removeClassName(this._activeSection,"active"),c.addClassName(this._activeSection,"hide-all")),this._activeMenuLink=a,this._activeMenuTab=this._activeMenuLink.parentNode,this._activeSection=e.select(d.substr(d.indexOf("#")),this._element)[0],this._activeSection?(c.addClassName(this._activeMenuTab,"active"),c.addClassName(this._activeSection,"active"),c.removeClassName(this._activeSection,"hide-all"),void(b&&"undefined"!=typeof this._options.onChange&&this._options.onChange(this))):void(this._activeMenuLink=this._activeMenuTab=this._activeSection=null)},_onTabClickedGeneric:function(a){a.preventDefault(),c.hasClassName(a.currentTarget,"ink-disabled")||this._onTabClicked(a.currentTarget)},_onTabClicked:function(a){var b=a.getAttribute("href");b=b.substr(b.indexOf("#")),b&&null!==Ink.i(this._dehashify(b))&&(this._options.preventUrlChange||(window.location.hash=b),a!==this._activeMenuLink&&this.changeTab(a))},_onResize:function(){var b=a.currentLayout();if(b!==this._lastLayout){var d=b===a.Layouts.TINY||b===a.Layouts.SMALL||b===a.Layouts.MEDIUM;
|
||
d?(c.removeClassName(this._menu,"menu"),c.removeClassName(this._menu,"horizontal")):(c.addClassName(this._menu,"menu"),c.addClassName(this._menu,"horizontal")),this._lastLayout=b}},_hashify:function(a){return a?0===a.indexOf("#")?a:"#"+a:""},_dehashify:function(a){return a?(""+a).replace(/^#/,""):""},_findLinkByHref:function(a){if(!a)return null;if(1===a.nodeType){if(d.isAncestorOf(a,this._element))return null;for(var b=e.select("a",this._menu),c=a.getAttribute("id"),f=0,g=b.length;g>f;f++){if(b[f]===a||d.isAncestorOf(a,b[f]))return b[f];if(c&&c===this._dehashify(b[f].getAttribute("href")))return b[f]}return null}return a=this._hashify(a),e.select('a[href$="'+a+'"]',this._menu)[0]||null},changeTab:function(a){a=this._findLinkByHref(a),a&&!c.hasClassName(a,"ink-disabled")&&this._changeTab(a,!0)},disable:function(a){c.addClassName(this._findLinkByHref(a),"ink-disabled")},enable:function(a){c.removeClassName(this._findLinkByHref(a),"ink-disabled")},activeTab:function(){return this._activeSection.getAttribute("id")},activeMenuTab:function(){return Ink.warn("Ink.UI.Tabs.activeMenuTab() is deprecated"),this._activeMenuTab},activeMenuLink:function(){return this._activeMenuLink},activeSection:function(){return this._activeSection},activeContentTab:function(){return Ink.warn("Ink.UI.Tabs.activeContentTab() is deprecated. Use activeSection instead."),this._activeSection()},destroy:a.destroyComponent},a.createUIComponent(f),f}),Ink.createModule("Ink.UI.TagField","1",["Ink.Dom.Element_1","Ink.Dom.Event_1","Ink.Dom.Css_1","Ink.Dom.Browser_1","Ink.UI.Droppable_1","Ink.Util.Array_1","Ink.Dom.Selector_1","Ink.UI.Common_1"],function(a,b,c,d,e,f,g,h){"use strict";function i(){h.BaseUIComponent.apply(this,arguments)}var j=13,k=8,l=function(a){return!!a};return i._name="TagField_1",i._optionDefinition={tags:["String",[]],tagQuery:["Object",null],tagQueryAsync:["Object",null],allowRepeated:["Boolean",!1],maxTags:["Integer",-1],outSeparator:["String",","],separator:["String",/[,; ]+/g],autoSplit:["Boolean",!0]},i.prototype={_init:function(){var d=this._options;"string"==typeof d.separator&&(d.separator=new RegExp(d.separator,"g")),"string"==typeof d.tags&&(d.tags=this._readInput(d.tags)),c.addClassName(this._element,"hide-all"),this._viewElm=a.create("div",{className:"ink-tagfield",insertAfter:this._element}),this._input=a.create("input",{type:"text",className:"new-tag-input",insertBottom:this._viewElm});var e=[].concat(d.tags,this._tagsFromMarkup(this._element));this._tags=[],f.each(e,Ink.bindMethod(this,"_addTag")),b.observe(this._input,"keyup",Ink.bindEvent(this._onKeyUp,this)),b.observe(this._input,"change",Ink.bindEvent(this._onKeyUp,this)),b.observe(this._input,"keydown",Ink.bindEvent(this._onKeyDown,this)),b.observe(this._input,"blur",Ink.bindEvent(this._onBlur,this)),b.observe(this._viewElm,"click",Ink.bindEvent(this._refocus,this))},destroy:function(){a.remove(this._viewElm),c.removeClassName(this._element,"hide-all")},_tagsFromMarkup:function(b){var c=b.tagName.toLowerCase();if("input"===c)return this._readInput(b.value);if("select"===c)return f.map(b.getElementsByTagName("option"),function(b){return a.textContent(b)});throw new Error("Cannot read tags from a "+c+" tag. Unknown tag")},_tagsToMarkup:function(b,c){var d=c.tagName.toLowerCase();if("input"===d)this._options.separator&&(c.value=b.join(this._options.outSeparator));else{if("select"!==d)throw new Error("TagField: Cannot read tags from a "+d+" tag. Unknown tag");c.innerHTML="",f.each(b,function(b){var d=a.create("option",{selected:"selected"});a.setTextContent(d,b),c.appendChild(d)})}},_addTag:function(c){if(!(-1!==this._options.maxTags&&this._tags.length>=this._options.maxTags)){if(!this._options.allowRepeated&&f.inArray(c,this._tags,c)||!c)return!1;var d=a.create("span",{className:"ink-tag",setTextContent:c+" "}),e=a.create("span",{className:"remove fa fa-times",insertBottom:d});b.observe(e,"click",Ink.bindEvent(this._removeTag,this,null));var g=document.createTextNode(" ");this._tags.push(c),this._viewElm.insertBefore(d,this._input),this._viewElm.insertBefore(g,this._input),this._tagsToMarkup(this._tags,this._element)}},_readInput:function(a){return this._options.separator?f.filter(a.split(this._options.separator),l):[a]},_onKeyUp:function(){if(this._options.autoSplit){var a=this._input.value.split(this._options.separator);if(!(a.length<=1)){var b=a[a.length-1];a=a.splice(0,a.length-1),a=f.filter(a,l),f.each(a,Ink.bind(this._addTag,this)),this._input.value=b}}},_onKeyDown:function(a){return a.which===j?this._onEnterKeyDown(a):a.which===k?this._onBackspaceKeyDown():void(this._removeConfirm&&this._unsetRemovingVisual(this._tags.length-1))},_onBackspaceKeyDown:function(){this._input.value||(this._removeConfirm?(this._unsetRemovingVisual(this._tags.length-1),this._removeTag(this._tags.length-1),this._removeConfirm=null):this._setRemovingVisual(this._tags.length-1))},_onEnterKeyDown:function(a){var c=this._input.value;c&&(this._addTag(c),this._input.value=""),b.stopDefault(a)},_onBlur:function(){this._addTag(this._input.value),this._input.value=""},_setRemovingVisual:function(a){var d=this._viewElm.children[a];d&&(c.addClassName(d,"tag-deleting"),this._removeRemovingVisualTimeout=setTimeout(Ink.bindMethod(this,"_unsetRemovingVisual",a),4e3),b.observe(this._input,"blur",Ink.bindMethod(this,"_unsetRemovingVisual",a)),this._removeConfirm=!0)},_unsetRemovingVisual:function(a){var b=this._viewElm.children[a];b&&(c.removeClassName(b,"tag-deleting"),clearTimeout(this._removeRemovingVisualTimeout)),this._removeConfirm=null},_removeTag:function(c){var d;if("object"==typeof c){var e=b.element(c).parentNode;d=a.parentIndexOf(this._viewElm,e)}else"number"==typeof c&&(d=c);this._tags=f.remove(this._tags,d,1),a.remove(this._viewElm.children[d]),this._tagsToMarkup(this._tags,this._element)},_refocus:function(a){return this._input.focus(),b.stop(a),!1}},h.createUIComponent(i),i}),Ink.createModule("Ink.UI.Toggle","1",["Ink.UI.Common_1","Ink.Dom.Event_1","Ink.Dom.Css_1","Ink.Dom.Element_1","Ink.Dom.Selector_1","Ink.Util.Array_1"],function(a,b,c,d,e,f){"use strict";function g(){a.BaseUIComponent.apply(this,arguments)}return g._name="Toggle_1",g._optionDefinition={target:["Elements"],triggerEvent:["String","click"],closeOnClick:["Boolean",!0],isAccordion:["Boolean",!1],initialState:["Boolean",null],classNameOn:["String","show-all"],classNameOff:["String","hide-all"],closeOnInsideClick:["String","a[href]"],onChangeState:["Function",null]},g.prototype={_init:function(){var b,d;if(this._targets=a.elsOrSelector(this._options.target),this._options.closeOnClick="true"===this._options.closeOnClick.toString(),this._options.initialState=null!==this._options.initialState?"true"===this._options.initialState.toString():"none"!==c.getStyle(this._targets[0],"display"),"show-all"!==this._options.classNameOn||"hide-all"!==this._options.classNameOff)for(b=0,d=this._targets.length;d>b;b++)c.removeClassName(this._targets[b],"show-all"),c.removeClassName(this._targets[b],"hide-all");if(this._accordion=c.hasClassName(this._element.parentNode,"accordion")||c.hasClassName(this._targets[0].parentNode,"accordion"),this._firstTime=!0,this._bindEvents(),null!==this._options.initialState)this.setState(this._options.initialState,!0);else{var e="none"!==c.getStyle(this._targets[0],"display");this.setState(e,!0)}for(b=0,d=this._targets.length;d>b;b++)this._targets[b].style.display&&(this._targets[b].style.display="");this._element.setAttribute("data-is-toggle-trigger","true")},_bindEvents:function(){if(this._options.triggerEvent&&b.observe(this._element,this._options.triggerEvent,Ink.bind(this._onTriggerEvent,this)),this._options.closeOnClick&&b.observe(document,"click",Ink.bind(this._onOutsideClick,this)),this._options.closeOnInsideClick&&"false"!==this._options.closeOnInsideClick){var a=this._options.closeOnInsideClick;"true"===a.toString()&&(a="*"),b.observeMulti(this._targets,"click",Ink.bind(function(c){d.findUpwardsBySelector(b.element(c),a)&&this.setState(!1,!0)},this))}},_onTriggerEvent:function(a){var c=b.element(a),e=f.some(this._targets,function(a){return a===c||d.isAncestorOf(a,c)});if(!e){this._accordion&&this._updateAccordion();var g=this.getState();this.setState(!g,!0),!g&&this._firstTime&&(this._firstTime=!1),b.stopDefault(a)}},_updateAccordion:function(){var a,b;b=c.hasClassName(this._targets[0].parentNode,"accordion")?this._targets[0].parentNode:this._targets[0].parentNode.parentNode,a=e.select(".toggle, .ink-toggle",b);for(var f=0;f<a.length;f+=1){var g=d.data(a[f]),h=e.select(g.target,b);h.length>0&&h[0]!==this._targets[0]&&(h[0].style.display="none")}},_onOutsideClick:function(a){var c=b.element(a),e;if(!d.findUpwardsBySelector(c,'[data-is-toggle-trigger="true"]')){var g=f.some(this._targets,function(a){return d.isAncestorOf(a,c)||a===c});if(this._element!==c&&!d.isAncestorOf(this._element,c)&&!g){if((e=Ink.ss(".ink-shade")).length)for(var h=e.length,i=0;h>i;i++)if(d.isAncestorOf(e[i],c)&&d.isAncestorOf(e[i],this._element))return;this.setState(!1,!0)}}},setState:function(a,b){if(a!==this.getState()){if(b&&"function"==typeof this._options.onChangeState){var d=this._options.onChangeState(a);if(d===!1)return!1}for(var e=0,f=this._targets.length;f>e;e++)c.addRemoveClassName(this._targets[e],this._options.classNameOn,a),c.addRemoveClassName(this._targets[e],this._options.classNameOff,!a);c.addRemoveClassName(this._element,"active",a)}},getState:function(){return c.hasClassName(this._element,"active")}},a.createUIComponent(g),g}),Ink.createModule("Ink.UI.Tooltip","1",["Ink.UI.Common_1","Ink.Dom.Event_1","Ink.Dom.Element_1","Ink.Dom.Selector_1","Ink.Util.Array_1","Ink.Dom.Css_1","Ink.Dom.Browser_1"],function(a,b,c,d,e,f){"use strict";function g(a,b){this._init(a,b||{})}function h(a,b){this._init(a,b)}var i,j,k;!function(){for(var a=document.createElement("DIV"),b=["transition","oTransition","msTransition","mozTransition","webkitTransition"],c=0;c<b.length;c++)if("undefined"!=typeof a.style[b[c]+"Duration"]){i=b[c]+"Duration",j=b[c]+"Property",k=b[c]+"TimingFunction";break}}();var l=document.getElementsByTagName("body"),m=l.length?l[0]:document.documentElement;return g.prototype={_init:function(a,b){var c;if(this.options=Ink.extendObj({where:"up",zIndex:1e4,left:10,top:10,spacing:8,forever:0,color:"",timeout:0,delay:0,template:null,templatefield:null,fade:.3,text:""},b||{}),"string"==typeof a)c=d.select(a);else{if("object"!=typeof a)throw"Element expected";c=[a]}this.tooltips=[];for(var e=0,f=c.length;f>e;e++)this.tooltips[e]=new h(this,c[e])},destroy:function(){e.each(this.tooltips,function(a){a._destroy()}),this.tooltips=null,this.options=null}},h.prototype={_oppositeDirections:{left:"right",right:"left",up:"down",down:"up"},_init:function(c,d){b.observe(d,"mouseover",Ink.bindEvent(this._onMouseOver,this)),b.observe(d,"mouseout",Ink.bindEvent(this._onMouseOut,this)),b.observe(d,"mousemove",Ink.bindEvent(this._onMouseMove,this)),this.root=c,this.element=d,this._delayTimeout=null,this.tooltip=null,a.registerInstance(this,this.element)},_makeTooltip:function(a){if(!this._getOpt("text")&&!this._getOpt("html")&&!c.hasAttribute(this.element,"title"))return!1;var d=this._createTooltipElement();this.tooltip&&this._removeTooltip(),this.tooltip=d,this._fadeInTooltipElement(d),this._placeTooltipElement(d,a),b.observe(d,"mouseover",Ink.bindEvent(this._onTooltipMouseOver,this));var e=this._getFloatOpt("timeout");e&&setTimeout(Ink.bind(function(){this.tooltip===d&&this._removeTooltip()},this),1e3*e)},_createTooltipElement:function(){var b=this._getOpt("template"),e=this._getOpt("templatefield"),g,h;if(b){var i=document.createElement("DIV");if(i.innerHTML=a.elOrSelector(b,"options.template").outerHTML,g=i.firstChild,e){if(h=d.select(e,g),!h)throw"options.templatefield must be a valid selector within options.template";h=h[0]}else h=g}else g=document.createElement("DIV"),f.addClassName(g,"ink-tooltip"),f.addClassName(g,this._getOpt("color")),h=document.createElement("DIV"),f.addClassName(h,"content"),g.appendChild(h);return this._getOpt("html")?h.innerHTML=this._getOpt("html"):this._getOpt("text")?c.setTextContent(h,this._getOpt("text")):c.setTextContent(h,this.element.getAttribute("title")),g.style.display="block",g.style.position="absolute",g.style.zIndex=this._getIntOpt("zIndex"),g},_fadeInTooltipElement:function(a){var b=this._getFloatOpt("fade");i&&b&&(a.style.opacity="0",a.style[i]=b+"s",a.style[j]="opacity",a.style[k]="ease-in-out",setTimeout(function(){a.style.opacity="1"},0))},_placeTooltipElement:function(a,b){var d=this._getOpt("where");if("mousemove"===d||"mousefix"===d){var e=b;this._setPos(e[0],e[1]),m.appendChild(a)}else if(d.match(/(up|down|left|right)/)){m.appendChild(a);var g=c.offset(this.element),h=g[0],i=g[1],j=c.elementWidth(this.element)/2-c.elementWidth(a)/2,k=c.elementHeight(this.element)/2-c.elementHeight(a)/2,l=this._getIntOpt("spacing"),n=c.elementDimensions(a),o=c.elementDimensions(this.element),p=c.scrollWidth()+c.viewportWidth(),q=c.scrollHeight()+c.viewportHeight();d=this._getWhereValueInsideViewport(d,{left:h-n[0],right:h+n[0],top:i+n[1],bottom:i+n[1]},{right:p,bottom:q}),"up"===d?(i-=n[1],i-=l,h+=j):"down"===d?(i+=o[1],i+=l,h+=j):"left"===d?(h-=n[0],h-=l,i+=k):"right"===d&&(h+=o[0],h+=l,i+=k);var r=null;d.match(/(up|down|left|right)/)&&(r=document.createElement("SPAN"),f.addClassName(r,"arrow"),f.addClassName(r,this._oppositeDirections[d]),a.appendChild(r));var s=h,t=i,u=t+n[1]-q,v=s+n[0]-p,w=0-s,x=0-t;u>0?(r&&(r.style.top=n[1]/2+u+"px"),t-=u):x>0?(r&&(r.style.top=n[1]/2-x+"px"),t+=x):v>0?(r&&(r.style.left=n[0]/2+v+"px"),s-=v):w>0&&(r&&(r.style.left=n[0]/2-w+"px"),s+=w),a.style.left=s+"px",a.style.top=t+"px"}},_getWhereValueInsideViewport:function(a,b,c){return"left"===a&&b.left<0?"right":"right"===a&&b.right>c.right?"left":"up"===a&&b.top<0?"down":"down"===a&&b.bottom>c.bottom?"up":a},_removeTooltip:function(){var a=this.tooltip;if(a){var b=Ink.bind(c.remove,{},a);"mousemove"!==this._getOpt("where")&&i?(a.style.opacity=0,setTimeout(b,1e3*this._getFloatOpt("fade"))):b(),this.tooltip=null}},_getOpt:function(a){var b=c.data(this.element)[c._camelCase("tip-"+a)];if(b)return b;var d=this.root.options[a];return"undefined"!=typeof d?d:void 0},_getIntOpt:function(a){return parseInt(this._getOpt(a),10)},_getFloatOpt:function(a){return parseFloat(this._getOpt(a),10)},_destroy:function(){this.tooltip&&c.remove(this.tooltip),this.root=null,this.element=null,this.tooltip=null},_onMouseOver:function(a){var b=this._getMousePosition(a),c=this._getFloatOpt("delay");c?this._delayTimeout=setTimeout(Ink.bind(function(){this.tooltip||this._makeTooltip(b),this._delayTimeout=null},this),1e3*c):this._makeTooltip(b)},_onMouseMove:function(a){if("mousemove"===this._getOpt("where")&&this.tooltip){var b=this._getMousePosition(a);this._setPos(b[0],b[1])}},_onMouseOut:function(){this._getIntOpt("forever")||this._removeTooltip(),this._delayTimeout&&(clearTimeout(this._delayTimeout),this._delayTimeout=null)},_onTooltipMouseOver:function(){this.tooltip&&this._removeTooltip()},_setPos:function(a,b){a+=this._getIntOpt("left"),b+=this._getIntOpt("top");var d=this._getPageXY();if(this.tooltip){var e=[c.elementWidth(this.tooltip),c.elementHeight(this.tooltip)],f=this._getScroll();e[0]+a-f[0]>=d[0]-20&&(a=a-e[0]-this._getIntOpt("left")-10),e[1]+b-f[1]>=d[1]-20&&(b=b-e[1]-this._getIntOpt("top")-10),this.tooltip.style.left=a+"px",this.tooltip.style.top=b+"px"}},_getPageXY:function(){var a=0,b=0;return"number"==typeof window.innerWidth?(a=window.innerWidth,b=window.innerHeight):document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)?(a=document.documentElement.clientWidth,b=document.documentElement.clientHeight):document.body&&(document.body.clientWidth||document.body.clientHeight)&&(a=document.body.clientWidth,b=document.body.clientHeight),[parseInt(a,10),parseInt(b,10)]},_getScroll:function(){var a=document.documentElement,b=document.body;return a&&(a.scrollLeft||a.scrollTop)?[a.scrollLeft,a.scrollTop]:b?[b.scrollLeft,b.scrollTop]:[0,0]},_getMousePosition:function(a){return[parseInt(b.pointerX(a),10),parseInt(b.pointerY(a),10)]}},g}),Ink.createModule("Ink.UI.TreeView","1",["Ink.UI.Common_1","Ink.Dom.Event_1","Ink.Dom.Css_1","Ink.Dom.Element_1","Ink.Dom.Selector_1","Ink.Util.Array_1"],function(a,b,c,d,e,f){"use strict";function g(){a.BaseUIComponent.apply(this,arguments)}return g._name="TreeView_1",g._optionDefinition={node:["String","li"],child:["String",null],children:["String","ul"],parentClass:["String","parent"],openNodeClass:["String","open"],openClass:["String","fa fa-minus-circle"],closedClass:["String","fa fa-plus-circle"],hideClass:["String","hide-all"],iconTag:["String","i"],stopDefault:["Boolean",!0]},g.prototype={_init:function(){this._options.child&&(Ink.warn("Ink.UI.TreeView: options.child is being renamed to options.children."),this._options.children=this._options.child),this._handlers={click:Ink.bindEvent(this._onClick,this)},b.on(this._element,"click",this._options.node,this._handlers.click),f.each(Ink.ss(this._options.node,this._element),Ink.bind(function(a){if(this.isParent(a)){c.addClassName(a,this._options.parentClass);var b=this.isOpen(a);this._getIcon(a)||d.create(this._options.iconTag,{insertTop:a}),this._setNodeOpen(a,b)}},this))},_getIcon:function(a){return Ink.s("> "+this._options.iconTag,a)},isOpen:function(a){if(!this._getChild(a))throw new Error("not a node!");return"true"===d.data(a).open||c.hasClassName(a,this._options.openNodeClass)},isParent:function(a){return c.hasClassName(a,this._options.parentClass)||null!=this._getChild(a)},_setNodeOpen:function(a,b){var d=this._getChild(a);if(d){c.setClassName(d,this._options.hideClass,!b);var e=this._getIcon(a);a.setAttribute("data-open",b);var f=b?this._options.openClass:this._options.closedClass,g=b?this._options.closedClass:this._options.openClass;c.removeClassName(e,g),c.addClassName(e,f),c.setClassName(a,this._options.openNodeClass,b)}else Ink.error("Ink.UI.TreeView: node",a,"is not a node!")},open:function(a){this._setNodeOpen(a,!0)},close:function(a){this._setNodeOpen(a,!1)},toggle:function(a){this.isOpen(a)?this.close(a):this.open(a)},_getChild:function(a){return e.select(this._options.children,a)[0]||null},_onClick:function(a){!this.isParent(a.currentTarget)||e.matchesSelector(a.target,this._options.node)||e.matchesSelector(a.target,this._options.children)||(this._options.stopDefault&&a.preventDefault(),this.toggle(a.currentTarget))}},a.createUIComponent(g),g}),Ink.createModule("Ink.UI.Upload","1",["Ink.Dom.Event_1","Ink.Dom.Element_1","Ink.Dom.Browser_1","Ink.UI.Common_1"],function(a,b,c,d){"use strict";var e=function(a){this.init(a)};e.prototype={init:function(a){this._options=Ink.extendObj({entry:void 0,maxDepth:10},a||{});try{this._read()}catch(b){Ink.error(b)}},_read:function(){if(!this._options.entry)return void Ink.error("You must specify the entry!");try{this._readDirectories()}catch(a){Ink.error(a)}},_readDirectories:function(){var a=[],b=!1,c=0,d=Ink.bind(function(e){var f=e.createReader();b=!0,f.readEntries(Ink.bind(function(e){if(e.length>0){for(var f=0,g=e.length;g>f;f++)a.push(e[f]),e[f].isDirectory&&(c=this.clearArray(e[f].fullPath.split("/")),c.shift(),c=c.length,c<=this._options.maxDepth&&d(e[f]));this._stopActivityTimeout&&clearTimeout(this._stopActivityTimeout),this._stopActivityTimeout=setTimeout(function(){b=!1},250)}e.length||(b=!1)},this),Ink.bind(function(a){this._options.readError(a,e)},this))},this);d(this._options.entry);var e,f=function(){return b?!1:(clearInterval(e),this._options.readComplete&&"function"==typeof this._options.readComplete&&this._options.readComplete(a),!0)};e=setInterval(Ink.bind(f,this),250)},clearArray:function(a){for(var b=a.length-1;b>=0;b--)("undefined"==typeof a[b]||null===a[b]||""===a[b])&&a.splice(b,1);return a}};var f={lists:[],items:[],create:function(a){var b;return a=String(a),this.lists.push({name:a}),b=this.lists.length-1},getItems:function(a){if(!a)return this.items;for(var b=[],c=0,d=this.items.length;d>c;c++)this.items[c].parentId===a&&b.push(this.items[c]);return b},purge:function(a,b){if("number"!=typeof a||isNaN(Number(a)))return!1;try{for(var c=this.items.length;c>=0;c--)this.items[c]&&a===this.items[c].parentId&&this.remove(this.items[c].parentId,this.items[c].pid);return b||this.lists.splice(a,1),!0}catch(d){return Ink.error("Purge: invalid id"),!1}},add:function(a,b,c){if(!this.lists[a])return!1;"object"!=typeof b&&(b=String(b));var d=parseInt(Math.round(1e5*Math.random())+""+Math.round(1e5*Math.random()),10);return c=c||0,this.items.push({parentId:a,item:b,priority:c||0,pid:d}),d},view:function(a,b){var c=this._searchByPid(a,b);return c===!1?!1:this.items[c]},remove:function(a,b){try{var c=this._searchByPid(a,b);return c===!1?!1:(this.items.splice(c,1),!0)}catch(d){return Ink.error("Remove: invalid id"),!1}},_searchByPid:function(a,b){if(!a&&"boolean"==typeof a||!b)return!1;if(a=parseInt(a,10),b=parseInt(b,10),isNaN(a)||isNaN(b))return!1;for(var c=0,d=this.items.length;d>c;c++)if(this.items[c].parentId===a&&this.items[c].pid===b)return c;return!1}},g=function(a){this.Upload=a,this.init()};g.prototype={init:function(){this._fileButton=this.Upload._options.fileButton,this._dropzone=this.Upload._options.dropzone,this._setDropEvent(),this._setFileButton()},_setDropEvent:function(){var a=this._dropzone;if(a)for(var b=0,c=a.length;c>b;b++)a[b].ondrop=Ink.bindEvent(this.Upload._dropEventHandler,this.Upload),a[b].ondragleave=Ink.bindEvent(this._onDragLeave,this),a[b].ondragend=Ink.bindEvent(this._onDragEndEventHandler,this),a[b].ondragdrop=Ink.bindEvent(this._onDragEndEventHandler,this),a[b].ondragenter=Ink.bindEvent(this._onDragEnterHandler,this),a[b].ondragover=Ink.bindEvent(this._onDragOverHandler,this)},_onDragEnterHandler:function(a){return a&&a.stopPropagation&&a.stopPropagation(),a&&a.preventDefault&&a.preventDefault(),a&&(a.returnValue=!1),this.Upload.publish("DragEnter",a),!1},_onDragOverHandler:function(a){return a?(a.preventDefault(),a.stopPropagation(),a.returnValue=!1,!0):!1},_onDragLeave:function(a){return this.Upload.publish("DragLeave",a)},_onDragEndEventHandler:function(a){return this.Upload.publish("DragEnd",a)},_setFileButton:function(){var b=this._fileButton;b&&a.observeMulti(b,"change",Ink.bindEvent(this._fileChangeHandler,this))},_fileChangeHandler:function(c){var d=a.element(c),e=d.files,f=b.findUpwardsByTag(d,"form");return e&&window.FormData&&"withCredentials"in new XMLHttpRequest?(this.Upload._addFilesToQueue(e),void(d.value="")):(f.parentNode.submit(),!1)}};var h=function(a){this.Queue=f,this.init(a),this._events={}};return h.prototype={init:function(a){if("string"==typeof a&&(a=b.data(d.elOrSelector(a,"1st argument"))),this._options=Ink.extendObj({dropzone:void 0,fileButton:void 0,fileFormName:"Ink_Filelist",endpoint:"",maxFilesize:300<<20,INVALID_FILE_NAME:void 0,extraData:{},useChunks:!1,chunkSize:4194304,minSizeToUseChunks:20971520,endpointChunk:"",endpointChunkCommit:"",foldersEnabled:!1,directoryMaxDepth:10},a||{}),this._queueId=f.create("Ink_UPLOAD"),this._queueRunning=!1,this._folders={},this._options.dropzone&&(this._options.dropzone=d.elsOrSelector(this._options.dropzone,"Ink.UI.Upload - dropzone")),this._options.fileButton&&(this._options.fileButton=d.elsOrSelector(this._options.fileButton,"Ink.UI.Upload - fileButton")),!this._options.dropzone&&!this._options.fileButton)throw new TypeError("Ink.UI.Upload: Specify a fileButton or a Dropzone!");new g(this)},_supportChunks:function(a){return this._options.useChunks&&"Blob"in window&&(new Blob).slice&&a>this._options.minSizeToUseChunks},_dropEventHandler:function(b){a.stop(b),this.publish("DropComplete",b.dataTransfer);var c=b.dataTransfer;if(!c||!c.files||!c.files.length)return!1;if(this._files=c.files,this._files=Array.prototype.slice.call(this._files||[],0),c.items&&c.items[0]&&c.items[0].webkitGetAsEntry){if(!this._options.foldersEnabled)return setTimeout(Ink.bind(this._addFilesToQueue,this,this._files),0);for(var d,e=[],f=b.dataTransfer.items.length-1;f>=0;f--)d=b.dataTransfer.items[f].webkitGetAsEntry(),d&&d.isDirectory&&(e.push(d),this._files[f].isDirectory=!0,this._files.splice(f,1));this._addFolderToQueue(e,Ink.bind(function(){setTimeout(Ink.bind(this._addFilesToQueue,this,this._files),0)},this))}else setTimeout(Ink.bind(this._addFilesToQueue,this,this._files),0);return!0},_addFolderToQueue:function(a,b){var c=[],d={};if(!a||!a.length)return b(),c;var f=function(a){for(var b=[],c=0,d=a.length;d>c;c++)a[c].isFile&&b.push(a[c]);return b},g=function(a,b){var d;return b=b||0,this._files[b]?"fileentry"!==this._files[b].constructor.name.toLowerCase()?g.apply(this,[a,++b]):void this._files[b].file(Ink.bind(function(c){d=this._files[b].fullPath,this._files[b]=c,this._files[b].hasParent=!0,this._files[b].fullPath||(this._files[b].fullPath=d),g.apply(this,[a,++b])},this),Ink.bind(function(){this._files.splice(b,1),g.apply(this,[a,b])},this)):(a(),c)},h=Ink.bind(function(i){return a[i]?void new e({entry:a[i],maxDepth:this._options.directoryMaxDepth,readComplete:Ink.bind(function(b){if(c=c.concat(f(b)),a[i]&&!(a[i].fullPath in this._folders)){this._folders[a[i].fullPath]={items:b,files:c,length:b.length,created:!1,root:!0};for(var e=0,g=b.length;g>e;e++)b[e].isFile||(b[e].fullPath in d?delete d[b[e].fullPath]:this._folders[b[e].fullPath]={created:!1,root:!1});h(++i)}},this),readError:Ink.bind(function(a,b){d[b.fullPath]={},d[b.fullPath].error=a},this)}):(this._files=this._files.concat(c),g.call(this,b),!1)},this);return h(0),c},_addFilesToQueue:function(a){for(var b,d,e,g=0,h=a.length;h>g;g++)b=a[g],b.isDirectory||null!==b&&(b.type||b.size%4096!==0||c.CHROME&&this._options.foldersEnabled)?b.size>this._options.maxFilesize?this.publish("MaxSizeFailure",b,this._options.maxFilesize):(d=parseInt(Math.round(1e5*Math.random())+""+Math.round(1e5*Math.random()),10),e={id:g,data:b,fileID:d,directory:b.isDirectory},f.add(this._queueId,e),this.publish("FileAddedToQueue",e)):this.publish("InvalidFile",b,"size");this._processQueue(!0),this._files=[]},_processQueue:function(a){if(this._queueRunning)return!1;this.running=0;var b=1,c=0,d,e=f.items.length;this._queueRunning=!0,this.interval=setInterval(Ink.bind(function(){if(f.items.length===c&&0===this.running&&(f.purge(this._queueId,!0),this._queueRunning=!1,clearInterval(this.interval),this.publish("QueueEnd",this._queueId,e)),d=f.getItems(this._queueId),this.running<b&&d[c]){if(d[c].canceled)for(var h=c;d[h]&&d[h].canceled;)c++,h++;else g.call(this,d[c].pid,d[c].item.data,d[c].item.fileID,d[c].item.directory,a),this.running++,c++;return!0}return!1},this),100);var g=function(a,b,c,d,e){var f={file:b,fileID:c,cb:Ink.bind(function(){this.running--},this)};e&&(d?f.cb():this._upload(f))};return!0},_upload:function(a){var b=a.file,c=new XMLHttpRequest,d=a.fileID;this.publish("BeforeUpload",b,this._options.extraData,d,c,this._supportChunks(b.size));var e=function(e){a.cb&&a.cb(),this.publish("OnProgress",{length:b.size,lengthComputable:!0,loaded:b.size,total:b.size},b,d),this.publish("EndUpload",b,d,e?{error:!0}:!0),this.publish("InvalidFile",b,"name"),c.abort()};if(this._options.INVALID_FILE_NAME&&this._options.INVALID_FILE_NAME instanceof RegExp&&this._options.INVALID_FILE_NAME.test(a.file.name))return void e.call(this);if(!b.lastModifiedDate&&!Ink.Dom.Browser.OPERA)return void e.call(this,!0);c.upload.onprogress=Ink.bind(this.publish,this,"OnProgress",b,d);var f,g;this._supportChunks(b.size)?b.size<=b.chunk_offset?(f=this._options.endpointChunkCommit,g="POST"):(f=this._options.endpointChunk,b.chunk_upload_id&&(f+="?upload_id="+b.chunk_upload_id),b.chunk_offset&&(f+="&offset="+b.chunk_offset),g="PUT"):(f=this._options.endpoint,g="POST"),c.open(g,f,!0),c.withCredentials=!0,c.setRequestHeader("x-requested-with","XMLHttpRequest"),this._supportChunks(b.size)&&c.setRequestHeader("Content-type","application/x-www-form-urlencoded");var h=new FormData,i;if("Blob"in window&&"function"==typeof Blob?(i=new Blob([b],{type:b.type}),this._supportChunks(b.size)?(b.chunk_offset=b.chunk_offset||0,i=i.slice(b.chunk_offset,b.chunk_offset+this._options.chunkSize)):h.append(this._options.fileFormName,i,b.name)):h.append(this._options.fileFormName,b),this._supportChunks(b.size))h.append("upload_id",b.chunk_upload_id),h.append("path",b.upload_path);else for(var j in this._options.extraData)this._options.extraData.hasOwnProperty(j)&&h.append(j,this._options.extraData[j]);b.hasParent?this.publish("cbCreateFolder",b.parentID,b.fullPath,this._options.extraData,this._folders,b.rootPath,Ink.bind(function(){c.send(this._supportChunks(b.size)?b.size<=b.chunk_offset?"upload_id="+b.chunk_upload_id+"&path="+b.upload_path+"/"+b.name:i:h)},this)):c.send(this._supportChunks(b.size)?b.size<=b.chunk_offset?"upload_id="+b.chunk_upload_id+"&path="+b.upload_path+"/"+b.name:i:h),c.onload=Ink.bindEvent(function(){if(this._supportChunks(b.size)&&b.size>b.chunk_offset){if(c.response){var e=JSON.parse(c.response),f=b.chunk_offset&&e.offset!==b.chunk_offset+this._options.chunkSize&&b.size!==e.offset;f?(a.cb&&a.cb(),this.publish("ErrorUpload",b,d)):(b.chunk_upload_id=e.upload_id,b.chunk_offset=e.offset,b.chunk_expires=e.expires,this._upload(a))}else a.cb&&a.cb(),this.publish("ErrorUpload",b,d);return c=null}return a.cb&&a.cb(),c.responseText&&c.status<400?this.publish("EndUpload",b,d,c.responseText):this.publish("ErrorUpload",b,d),c=null},this),c.onerror=Ink.bindEvent(function(){a.cb&&a.cb(),this.publish("ErrorUpload",b,d)},this),c.onabort=Ink.bindEvent(function(){a.cb&&a.cb(),this.publish("AbortUpload",b,d,{abortAll:Ink.bind(this.abortAll,this),abortOne:Ink.bind(this.abortOne,this)})},this)},abortAll:function(){return this._queueRunning?(clearInterval(this.interval),this._queueRunning=!1,f.purge(this._queueId,!0),!0):!1},abortOne:function(a,b){for(var c=f.getItems(0),d,e=0,g=c.length;g>e;e++)if(c[e].item.fileID===a)return d={id:c[e].item.fileID,name:c[e].item.data.name,size:c[e].item.data.size,hasParent:c[e].item.data.hasParent},f.remove(0,c[e].pid),b&&b(d),!0;return!1},subscribe:function(a,b){return this._events[a]||(this._events[a]=[]),this._events[a].push(b),this._events[a]},publish:function(a){var b=this._events[a],c=Array.prototype.slice.call(arguments||[],0);if(b)for(var d=0,e=b.length;e>d;d++)try{b[d].apply(this,c.splice(1,c.length))}catch(f){Ink.error(a+": "+f)}}},h}),Ink.createModule("Ink.Util.Array","1",[],function(){"use strict";var a=Array.prototype,b={isArray:Array.isArray||function(a){return"[object Array]"==={}.toString.call(a)},groupBy:function(a,b){function c(a,b){return d(a)===d(b)}function d(a){return"function"==typeof b.key?b.key(a):a}b=b||{};for(var e=[],f,g=0,h=a.length;h>g;g++){for(f=[a[g]];h>g+1&&c(a[g],a[g+1]);)f.push(a[g+1]),g++;e.push(b.pairs?[d(a[g]),f]:f)}return e},reduce:function(b,c,d){if(a.reduce)return a.reduce.apply(b,[].slice.call(arguments,1));var e=Object(b),f=e.length>>>0,g=0,h;if(arguments.length>=3)h=d;else{for(;f>g&&!(g in e);)g++;if(g>=f)throw new TypeError("Reduce of empty array with no initial value");h=e[g++]}for(;f>g;g++)g in e&&(h=c(h,e[g],g,e));return h},inArray:function(a,b){if("object"==typeof b)for(var c=0,d=b.length;d>c;++c)if(b[c]===a)return!0;return!1},sortMulti:function(a,b){if("undefined"==typeof a||a.constructor!==Array)return!1;if("string"!=typeof b)return a.sort();if(a.length>0){if("undefined"==typeof a[0][b])return!1;a.sort(function(a,c){var d=a[b],e=c[b];return e>d?-1:d>e?1:0})}return a},keyValue:function(a,b,c){if("undefined"!=typeof a&&"object"==typeof b&&this.inArray(a,b)){for(var d=[],e=0,f=b.length;f>e;++e)if(b[e]===a){if("undefined"!=typeof c&&c===!0)return e;d.push(e)}return d}return!1},shuffle:function(a){if("undefined"!=typeof a&&a.constructor!==Array)return!1;for(var b=a.length,c=!1,d=!1;b--;)d=Math.floor(Math.random()*(b+1)),c=a[b],a[b]=a[d],a[d]=c;return a},forEach:function(b,c,d){if(a.forEach)return a.forEach.call(b,c,d);for(var e=0,f=b.length>>>0;f>e;e++)c.call(d,b[e],e,b)
|
||
},each:function(){b.forEach.apply(b,[].slice.call(arguments))},map:function(b,c,d){if(a.map)return a.map.call(b,c,d);for(var e=new Array(g),f=0,g=b.length>>>0;g>f;f++)e[f]=c.call(d,b[f],f,b);return e},filter:function(b,c,d){if(a.filter)return a.filter.call(b,c,d);for(var e=[],f=null,g=0,h=b.length;h>g;g++)f=b[g],c.call(d,f,g,b)&&e.push(f);return e},some:function(a,b,c){if(null===a)throw new TypeError("First argument is invalid.");var d=Object(a),e=d.length>>>0;if("function"!=typeof b)throw new TypeError("Second argument must be a function.");for(var f=0;e>f;f++)if(f in d&&b.call(c,d[f],f,d))return!0;return!1},intersect:function(a,b){if(!a||!b||a instanceof Array==!1||b instanceof Array==!1)return[];for(var c=[],d=0,e=a.length;e>d;++d)for(var f=0,g=b.length;g>f;++f)a[d]===b[f]&&c.push(a[d]);return c},convert:function(b){return a.slice.call(b||[],0)},unique:function(a){if(!Array.prototype.lastIndexOf){var c=[];return b.forEach(b.convert(a),function(a){b.inArray(a,c)||c.push(a)}),c}return b.filter(b.convert(a),function(a,b,c){return c.lastIndexOf(a)===b})},range:function c(a,b,d){d||(d=1);var e=[],f;if(d>0)for(f=a;b>f;f+=d)e.push(f);else for(f=a;f>b;f+=d)e.push(f);return e},insert:function(a,b,c){a.splice(b,0,c)},remove:function(a,b,c){for(var d=[],e=0,f=a.length;f>e;e++)e>=b&&b+c>e||d.push(a[e]);return d}};return b}),Ink.createModule("Ink.Util.BinPack","1",[],function(){"use strict";var a=function(a,b){this.init(a,b)};a.prototype={init:function(a,b){this.root={x:0,y:0,w:a,h:b}},fit:function(a){var b,c,d;for(b=0;b<a.length;++b)d=a[b],(c=this.findNode(this.root,d.w,d.h))&&(d.fit=this.splitNode(c,d.w,d.h))},findNode:function(a,b,c){return a.used?this.findNode(a.right,b,c)||this.findNode(a.down,b,c):b<=a.w&&c<=a.h?a:null},splitNode:function(a,b,c){return a.used=!0,a.down={x:a.x,y:a.y+c,w:a.w,h:a.h-c},a.right={x:a.x+b,y:a.y,w:a.w-b,h:c},a}};var b=function(){};b.prototype={fit:function(a){var b,c,d,e=a.length,f=e>0?a[0].w:0,g=e>0?a[0].h:0;for(this.root={x:0,y:0,w:f,h:g},b=0;e>b;b++)d=a[b],d.fit=(c=this.findNode(this.root,d.w,d.h))?this.splitNode(c,d.w,d.h):this.growNode(d.w,d.h)},findNode:function(a,b,c){return a.used?this.findNode(a.right,b,c)||this.findNode(a.down,b,c):b<=a.w&&c<=a.h?a:null},splitNode:function(a,b,c){return a.used=!0,a.down={x:a.x,y:a.y+c,w:a.w,h:a.h-c},a.right={x:a.x+b,y:a.y,w:a.w-b,h:c},a},growNode:function(a,b){var c=a<=this.root.w,d=b<=this.root.h,e=d&&this.root.h>=this.root.w+a,f=c&&this.root.w>=this.root.h+b;return e?this.growRight(a,b):f?this.growDown(a,b):d?this.growRight(a,b):c?this.growDown(a,b):null},growRight:function(a,b){this.root={used:!0,x:0,y:0,w:this.root.w+a,h:this.root.h,down:this.root,right:{x:this.root.w,y:0,w:a,h:this.root.h}};var c;return(c=this.findNode(this.root,a,b))?this.splitNode(c,a,b):null},growDown:function(a,b){this.root={used:!0,x:0,y:0,w:this.root.w,h:this.root.h+b,down:{x:0,y:this.root.h,w:this.root.w,h:b},right:this.root};var c;return(c=this.findNode(this.root,a,b))?this.splitNode(c,a,b):null}};var c={random:function(){return Math.random()-.5},w:function(a,b){return b.w-a.w},h:function(a,b){return b.h-a.h},a:function(a,b){return b.area-a.area},max:function(a,b){return Math.max(b.w,b.h)-Math.max(a.w,a.h)},min:function(a,b){return Math.min(b.w,b.h)-Math.min(a.w,a.h)},height:function(a,b){return c.msort(a,b,["h","w"])},width:function(a,b){return c.msort(a,b,["w","h"])},area:function(a,b){return c.msort(a,b,["a","h","w"])},maxside:function(a,b){return c.msort(a,b,["max","min","h","w"])},msort:function(a,b,d){var e,f;for(f=0;f<d.length;++f)if(e=c[d[f]](a,b),0!==e)return e;return 0}},d=function(){return[this.w," x ",this.h].join("")},e={binPack:function(e){var f,g,h;for(f=0,g=e.blocks.length;g>f;++f)h=e.blocks[f],"area"in h||(h.area=h.w*h.h);var i=e.dimensions?new a(e.dimensions[0],e.dimensions[1]):new b;e.sorter||(e.sorter="maxside"),e.blocks.sort(c[e.sorter]),i.fit(e.blocks);var j=[i.root.w,i.root.h],k=[],l=[];for(f=0,g=e.blocks.length;g>f;++f)h=e.blocks[f],h.fit?k.push(h):(h.toString=d,l.push(h));var m=j[0]*j[1],n=0;for(f=0,g=k.length;g>f;++f)h=k[f],n+=h.area;return{dimensions:j,filled:n/m,blocks:e.blocks,fitted:k,unfitted:l}}};return e}),Ink.createModule("Ink.Util.Cookie","1",[],function(){"use strict";var a={get:function(a){var b=document.cookie||!1,c={};if(b){b=b.replace(new RegExp("; ","g"),";");var d=b.split(";"),e=[];if(d.length>0)for(var f=0;f<d.length;f++)e=d[f].split("="),2===e.length&&(c[e[0]]=decodeURIComponent(e[1])),e=[]}return a?"undefined"!=typeof c[a]?c[a]:null:c},set:function(a,b,c,d,e,f){var g;if(!a||b===!1||"undefined"==typeof a||"undefined"==typeof b)return!1;g=a+"="+encodeURIComponent(b);var h=!1,i=!1,j=!1,k=!1;if(c&&"undefined"!=typeof c&&!isNaN(c)){var l=new Date,m=parseInt(Number(l.valueOf()),10)+1e3*Number(parseInt(c,10)),n=new Date(m),o=n.toGMTString(),p=new RegExp("([^\\s]+)(\\s\\d\\d)\\s(\\w\\w\\w)\\s(.*)");o=o.replace(p,"$1$2-$3-$4"),h="expires="+o}else h="undefined"==typeof c||isNaN(c)||0!==Number(parseInt(c,10))?"expires=Thu, 01-Jan-2037 00:00:01 GMT":"";if(i=d&&"undefined"!=typeof d?"path="+d:"path=/",e&&"undefined"!=typeof e)j="domain="+e;else{var q=new RegExp(":(.*)");j="domain="+window.location.host,j=j.replace(q,"")}k=f&&"undefined"!=typeof f?f:!1,document.cookie=g+"; "+h+"; "+i+"; "+j+"; "+k},remove:function(a,b,c){var d=!1,e=!1,f=-999999999;d=b&&"undefined"!=typeof b?b:"/",e=c&&"undefined"!=typeof c?c:window.location.host,this.set(a,"deleted",f,d,e)}};return a}),Ink.createModule("Ink.Util.Date","1",[],function(){"use strict";var a={_months:function(a){var b=["Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"];return b[a]},_iMonth:function(a){return Number(a)?+a-1:{janeiro:0,jan:0,fevereiro:1,fev:1,março:2,mar:2,abril:3,abr:3,maio:4,mai:4,junho:5,jun:5,julho:6,jul:6,agosto:7,ago:7,setembro:8,set:8,outubro:9,out:9,novembro:10,nov:10,dezembro:11,dez:11}[a.toLowerCase()]},_wDays:function(a){var b=["Domingo","Segunda","Terça","Quarta","Quinta","Sexta","Sábado"];return b[a]},_iWeek:function(a){return Number(a)?+a||7:{segunda:1,seg:1,terça:2,ter:2,quarta:3,qua:3,quinta:4,qui:4,sexta:5,sex:5,sábado:6,sáb:6,domingo:7,dom:7}[a.toLowerCase()]},_daysInMonth:function(a,b){var c;return c=1===a||3===a||5===a||7===a||8===a||10===a||12===a?31:4===a||6===a||9===a||11===a?30:b%400===0||b%4===0&&b%100!==0?29:28},get:function(a,b){("undefined"==typeof a||""===a)&&(a="Y-m-d");var c=a.split(""),d=new Array(c.length),e="\\",f;f="undefined"==typeof b?new Date:new Date("number"==typeof b?1e3*b:b);for(var g,h,i,j=0;j<c.length;j++)switch(c[j]){case e:d[j]=c[j+1],j++;break;case"d":var k=f.getDate();d[j]=String(k).length>1?k:"0"+k;break;case"D":d[j]=this._wDays(f.getDay()).substring(0,3);break;case"j":d[j]=f.getDate();break;case"l":d[j]=this._wDays(f.getDay());break;case"N":d[j]=f.getDay()||7;break;case"S":var l=f.getDate(),m=["st","nd","rd"],n="";d[j]=l>=11&&13>=l?"th":(n=m[String(l).substr(-1)-1])?n:"th";break;case"w":d[j]=f.getDay();break;case"z":g=Date.UTC(f.getFullYear(),0,0),h=Date.UTC(f.getFullYear(),f.getMonth(),f.getDate()),d[j]=Math.floor((h-g)/864e5);break;case"W":var o=new Date(f.getFullYear(),0,1);g=o.getDay()||7;var p=Math.floor((f-o)/864e5+1);d[j]=Math.ceil((p-(8-g))/7)+1;break;case"F":d[j]=this._months(f.getMonth());break;case"m":var q=String(f.getMonth()+1);d[j]=q.length>1?q:"0"+q;break;case"M":d[j]=this._months(f.getMonth()).substring(0,3);break;case"n":d[j]=f.getMonth()+1;break;case"t":d[j]=this._daysInMonth(f.getMonth()+1,f.getYear());break;case"L":var r=f.getFullYear();d[j]=r%4?!1:r%100?!0:r%400?!1:!0;break;case"o":throw'"o" not implemented!';case"Y":d[j]=f.getFullYear();break;case"y":d[j]=String(f.getFullYear()).substring(2);break;case"a":d[j]=f.getHours()<12?"am":"pm";break;case"A":d[j]=f.getHours<12?"AM":"PM";break;case"B":throw'"B" not implemented!';case"g":i=f.getHours(),d[j]=12>=i?i:i-12;break;case"G":d[j]=String(f.getHours());break;case"h":i=String(f.getHours()),i=12>=i?i:i-12,d[j]=i.length>1?i:"0"+i;break;case"H":i=String(f.getHours()),d[j]=i.length>1?i:"0"+i;break;case"i":var s=String(f.getMinutes());d[j]=s.length>1?s:"0"+s;break;case"s":var t=String(f.getSeconds());d[j]=t.length>1?t:"0"+t;break;case"u":throw'"u" not implemented!';case"e":throw'"e" not implemented!';case"I":g=new Date(f.getFullYear(),0,1),d[j]=f.getTimezoneOffset()!==g.getTimezoneOffset()?1:0;break;case"O":var u=f.getTimezoneOffset(),v=u%60;i=String((u-v)/60*-1),"-"!==i.charAt(0)&&(i="+"+i),i=3===i.length?i:i.replace(/([+\-])(\d)/,"$10$2"),d[j]=i+v+"0";break;case"P":throw'"P" not implemented!';case"T":throw'"T" not implemented!';case"Z":d[j]=60*f.getTimezoneOffset();break;case"c":throw'"c" not implemented!';case"r":var w=this._wDays(f.getDay()).substr(0,3),x=this._months(f.getMonth()).substr(0,3);d[j]=w+", "+f.getDate()+" "+x+this.get(" Y H:i:s O",f);break;case"U":d[j]=Math.floor(f.getTime()/1e3);break;default:d[j]=c[j]}return d.join("")},set:function(a,b){if("undefined"!=typeof b){("undefined"==typeof a||""===a)&&(a="Y-m-d");for(var c=a.split(""),d=new Array(c.length),e="\\",f,g={year:void 0,month:void 0,day:void 0,dayY:void 0,dayW:void 0,week:void 0,hour:void 0,hourD:void 0,min:void 0,sec:void 0,msec:void 0,ampm:void 0,diffM:void 0,diffH:void 0,date:void 0},h=0,i=0;i<c.length;i++)switch(c[i]){case e:d[i]=c[i+1],i++;break;case"d":d[i]="(\\d{2})",g.day={original:i,match:h++};break;case"j":d[i]="(\\d{1,2})",g.day={original:i,match:h++};break;case"D":d[i]="([\\wá]{3})",g.dayW={original:i,match:h++};break;case"l":d[i]="([\\wá]{5,7})",g.dayW={original:i,match:h++};break;case"N":d[i]="(\\d)",g.dayW={original:i,match:h++};break;case"w":d[i]="(\\d)",g.dayW={original:i,match:h++};break;case"S":d[i]="\\w{2}";break;case"z":d[i]="(\\d{1,3})",g.dayY={original:i,match:h++};break;case"W":d[i]="(\\d{1,2})",g.week={original:i,match:h++};break;case"F":d[i]="([\\wç]{4,9})",g.month={original:i,match:h++};break;case"M":d[i]="(\\w{3})",g.month={original:i,match:h++};break;case"m":d[i]="(\\d{2})",g.month={original:i,match:h++};break;case"n":d[i]="(\\d{1,2})",g.month={original:i,match:h++};break;case"t":d[i]="\\d{2}";break;case"L":d[i]="\\w{4,5}";break;case"o":throw'"o" not implemented!';case"Y":d[i]="(\\d{4})",g.year={original:i,match:h++};break;case"y":d[i]="(\\d{2})",("undefined"==typeof g.year||"Y"!==c[g.year.original])&&(g.year={original:i,match:h++});break;case"a":d[i]="(am|pm)",g.ampm={original:i,match:h++};break;case"A":d[i]="(AM|PM)",g.ampm={original:i,match:h++};break;case"B":throw'"B" not implemented!';case"g":d[i]="(\\d{1,2})",g.hourD={original:i,match:h++};break;case"G":d[i]="(\\d{1,2})",g.hour={original:i,match:h++};break;case"h":d[i]="(\\d{2})",g.hourD={original:i,match:h++};break;case"H":d[i]="(\\d{2})",g.hour={original:i,match:h++};break;case"i":d[i]="(\\d{2})",g.min={original:i,match:h++};break;case"s":d[i]="(\\d{2})",g.sec={original:i,match:h++};break;case"u":throw'"u" not implemented!';case"e":throw'"e" not implemented!';case"I":d[i]="\\d";break;case"O":d[i]="([-+]\\d{4})",g.diffH={original:i,match:h++};break;case"P":throw'"P" not implemented!';case"T":throw'"T" not implemented!';case"Z":d[i]="(\\-?\\d{1,5})",g.diffM={original:i,match:h++};break;case"c":throw'"c" not implemented!';case"r":d[i]="([\\wá]{3}, \\d{1,2} \\w{3} \\d{4} \\d{2}:\\d{2}:\\d{2} [+\\-]\\d{4})",g.date={original:i,match:h++};break;case"U":d[i]="(\\d{1,13})",g.date={original:i,match:h++};break;default:d[i]=c[i]}var j=new RegExp(d.join(""));try{if(f=b.match(j),!f)return}catch(k){return}var l="undefined"!=typeof g.date,m="undefined"!=typeof g.year,n="undefined"!=typeof g.dayY,o="undefined"!=typeof g.day,p="undefined"!=typeof g.month,q=p&&o,r=!p&&o,s="undefined"!=typeof g.dayW,t="undefined"!=typeof g.week,u=t&&s,v=!t&&s,w=n||q||!m&&r||u||!m&&v,x=!(m||n||o||p||s||t),y="undefined"!=typeof g.hourD&&"undefined"!=typeof g.ampm,z="undefined"!=typeof g.hour,A=y||z,B="undefined"!=typeof g.min,C="undefined"!=typeof g.sec,D="undefined"!=typeof g.msec,E=!x||A,F=E||B,G="undefined"!=typeof g.diffM,H="undefined"!=typeof g.diffH,I,J;if(l){if("U"===c[g.date.original])return new Date(1e3*+f[g.date.match+1]);var K=f[g.date.match+1].match(/\w{3}, (\d{1,2}) (\w{3}) (\d{4}) (\d{2}):(\d{2}):(\d{2}) ([+\-]\d{4})/);return I=+K[4]+ +K[7].slice(0,3),J=+K[5]+(K[7].slice(0,1)+K[7].slice(3))/100*60,new Date(K[3],this._iMonth(K[2]),K[1],I,J,K[6])}var L=new Date,M,N,O,P,Q,R;if(w||x){if(w){if(m){var S=L.getFullYear()-50+"";M=f[g.year.match+1],"y"===c[g.year.original]&&(M=+S.slice(0,2)+(M>=S.slice(2)?0:1)+M)}else M=L.getFullYear();if(n)N=0,O=f[g.dayY.match+1];else if(o)N=p?this._iMonth(f[g.month.match+1]):L.getMonth(),O=f[g.day.match+1];else{N=0;var T;T=t?f[g.week.match+1]:this.get("W",L),O=7*(T-2)+(8-(new Date(M,0,1).getDay()||7))+this._iWeek(f[g.week.match+1])}if(0===N&&O>31){var U=new Date(M,N,O);N=U.getMonth(),O=U.getDate()}}else M=L.getFullYear(),N=L.getMonth(),O=L.getDate();return I=y?+f[g.hourD.match+1]+("pm"===f[g.ampm.match+1]?12:0):z?f[g.hour.match+1]:x?L.getHours():"00",J=B?f[g.min.match+1]:E?"00":L.getMinutes(),P=C?f[g.sec.match+1]:F?"00":L.getSeconds(),Q=D?f[g.msec.match+1]:"000",R=H?f[g.diffH.match+1]:G?String(-1*f[g.diffM.match+1]/60*100).replace(/^(\d)/,"+$1").replace(/(^[\-+])(\d{3}$)/,"$10$2"):"+0000",new Date(M,N,O,I,J,P)}}}};return a}),Ink.createModule("Ink.Util.Dumper","1",[],function(){"use strict";var a={_tab:" ",_formatParam:function(a){var b="";switch(typeof a){case"string":b="(string) "+a;break;case"number":b="(number) "+a;break;case"boolean":b="(boolean) "+a;break;case"object":b=null!==a?a.constructor===Array?"Array \n{\n"+this._outputFormat(a,0)+"\n}":"Object \n{\n"+this._outputFormat(a,0)+"\n}":"null";break;default:b=!1}return b},_getTabs:function(a){for(var b="",c=0;a>c;c++)b+=this._tab;return b},_outputFormat:function(a,b){var c="",d=!1;for(var e in a)if(null!==a[e])if("object"!=typeof a[e]||a[e].constructor!==Array&&a[e].constructor!==Object){if(a[e].constructor===Function)continue;c=c+this._tab+this._getTabs(b)+"["+e+"] => "+a[e]+"\n"}else a[e].constructor===Array?d="Array":a[e].constructor===Object&&(d="Object"),c+=this._tab+this._getTabs(b)+"["+e+"] => <b>"+d+"</b>\n",c+=this._tab+this._getTabs(b)+"{\n",c+=this._outputFormat(a[e],b+1)+this._tab+this._getTabs(b)+"}\n";else c=c+this._tab+this._getTabs(b)+"["+e+"] => null \n";return c},printDump:function(a,b){if(b&&"undefined"!=typeof b)if("string"==typeof b)document.getElementById(b).innerHTML="<pre>"+this._formatParam(a)+"</pre>";else{if("object"!=typeof b)throw"TARGET must be an element or an element ID";b.innerHTML="<pre>"+this._formatParam(a)+"</pre>"}else document.write("<pre>"+this._formatParam(a)+"</pre>")},returnDump:function(a){return this._formatParam(a)},alertDump:function(a){window.alert(this._formatParam(a).replace(/(<b>)(Array|Object)(<\/b>)/g,"$2"))},windowDump:function(a){var b="dumperwindow_"+1e4*Math.random(),c=window.open("",b,"width=400,height=300,left=50,top=50,status,menubar,scrollbars,resizable");c.document.open(),c.document.write("<pre>"+this._formatParam(a)+"</pre>"),c.document.close(),c.focus()}};return a}),Ink.createModule("Ink.Util.I18n","1",[],function(){"use strict";var a=/\{(?:(\{.*?})|(?:%s:)?(\d+)|(?:%s)?|([\w-]+))}/g,b=function(a,b){return"function"==typeof a?a.apply(this,b):void 0!==typeof a?a:""},c=function(a,b,d){return this instanceof c?void this.reset().lang(b).testMode(d).append(a||{},b):new c(a,b,d)};return c.prototype={reset:function(){return this._dicts=[],this._dict={},this._testMode=!1,this._lang=this._gLang,this},append:function(a){return this._dicts.push(a),this._dict=Ink.extendObj(this._dict,a[this._lang]),this},lang:function(a){if(!arguments.length)return this._lang;if(a&&this._lang!==a){this._lang=a,this._dict={};for(var b=0,c=this._dicts.length;c>b;b++)this._dict=Ink.extendObj(this._dict,this._dicts[b][a]||{})}return this},testMode:function(a){return arguments.length?(void 0!==a&&(this._testMode=!!a),this):!!this._testMode},getKey:function(a){var b,d=this._gLang,e=this._lang;return a in this._dict?b=this._dict[a]:(c.langGlobal(e),b=this._gDict[a],c.langGlobal(d)),b},text:function(c){if("string"==typeof c){var d=Array.prototype.slice.call(arguments,1),e=0,f="object"==typeof d[0],g=this.getKey(c);return void 0===g&&(g=this._testMode?"["+c+"]":c),"number"==typeof g&&(g+=""),"string"==typeof g?g=g.replace(a,function(a,c,g,h){var i=c?c:g?d[g-(f?0:1)]:h?d[0][h]||"":d[e++ +(f?1:0)];return b(i,[e].concat(d))}):"function"==typeof g?g.apply(this,d):g instanceof Array?b(g[d[0]],d):"object"==typeof g?b(g[d[0]],d):""}},ntext:function(a,b,c){var d=Array.prototype.slice.apply(arguments),e;if(2===d.length&&"number"==typeof b){if(e=this.getKey(a),!(e instanceof Array))return"";d.splice(0,1),e=e[1===b?0:1]}else d.splice(0,2),e=1===c?a:b;return this.text.apply(this,[e].concat(d))},ordinal:function(a){if(void 0===a)return"";var c=+a.toString().slice(-1),d=this.getKey("_ordinals");if(void 0===d)return"";if("string"==typeof d)return d;var e;return"function"==typeof d&&(e=d(a,c),"string"==typeof e)?e:"exceptions"in d&&(e="function"==typeof d.exceptions?d.exceptions(a,c):a in d.exceptions?b(d.exceptions[a],[a,c]):void 0,"string"==typeof e)?e:"byLastDigit"in d&&(e="function"==typeof d.byLastDigit?d.byLastDigit(c,a):c in d.byLastDigit?b(d.byLastDigit[c],[c,a]):void 0,"string"==typeof e)?e:"default"in d&&(e=b(d["default"],[a,c]),"string"==typeof e)?e:""},alias:function(){var a=Ink.bind(c.prototype.text,this);return a.ntext=Ink.bind(c.prototype.ntext,this),a.append=Ink.bind(c.prototype.append,this),a.ordinal=Ink.bind(c.prototype.ordinal,this),a.testMode=Ink.bind(c.prototype.testMode,this),a}},c.reset=function(){c.prototype._gDicts=[],c.prototype._gDict={},c.prototype._gLang="pt_PT"},c.reset(),c.appendGlobal=function(a,b){if(b){if(!(b in a)){var d={};d[b]=a,a=d}b!==c.prototype._gLang&&c.langGlobal(b)}c.prototype._gDicts.push(a),Ink.extendObj(c.prototype._gDict,a[c.prototype._gLang])},c.append=function(){return Ink.warn("Ink.Util.I18n.append() was renamed to appendGlobal()."),c.appendGlobal.apply(c,[].slice.call(arguments))},c.langGlobal=function(a){if(!arguments.length)return c.prototype._gLang;if(a&&c.prototype._gLang!==a){c.prototype._gLang=a,c.prototype._gDict={};for(var b=0,d=c.prototype._gDicts.length;d>b;b++)Ink.extendObj(c.prototype._gDict,c.prototype._gDicts[b][a]||{})}},c.lang=function(){return Ink.warn("Ink.Util.I18n.lang() was renamed to langGlobal()."),c.langGlobal.apply(c,[].slice.call(arguments))},c}),Ink.createModule("Ink.Util.Json","1",[],function(){"use strict";function twoDigits(a){var b=""+a;return 1===b.length?"0"+b:b}var function_call=Function.prototype.call,cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,dateToISOString=Date.prototype.toISOString?Ink.bind(function_call,Date.prototype.toISOString):function(a){return a.getUTCFullYear()+"-"+twoDigits(a.getUTCMonth()+1)+"-"+twoDigits(a.getUTCDate())+"T"+twoDigits(a.getUTCHours())+":"+twoDigits(a.getUTCMinutes())+":"+twoDigits(a.getUTCSeconds())+"."+String((a.getUTCMilliseconds()/1e3).toFixed(3)).slice(2,5)+"Z"},InkJson={_nativeJSON:window.JSON||null,_convertToUnicode:!1,_escape:function(a){var b={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return/["\\\x00-\x1f]/.test(a)&&(a=a.replace(/([\x00-\x1f\\"])/g,function(a,c){var d=b[c];return d?d:(d=c.charCodeAt(),"\\u00"+Math.floor(d/16).toString(16)+(d%16).toString(16))})),a},_toUnicode:function(a){if(this._convertToUnicode){for(var b="",c=!1,d=!1,e=0,f=a.length;f>e;){if(c=a.charCodeAt(e),c>=32&&126>=c||8===c||9===c||10===c||12===c||13===c||32===c||34===c||47===c||58===c||92===c)d=34===c||92===c||47===c?"\\"+a.charAt(e):8===c?"\\b":9===c?"\\t":10===c?"\\n":12===c?"\\f":13===c?"\\r":a.charAt(e);else if(this._convertToUnicode){for(d=a.charCodeAt(e).toString(16)+"".toUpperCase();d.length<4;)d="0"+d;d="\\u"+d}else d=a.charAt(e);b+=d,e++}return b}return this._escape(a)},_stringifyValue:function(a){if("string"==typeof a)return'"'+this._toUnicode(a)+'"';if("number"!=typeof a||!isNaN(a)&&isFinite(a)){if("undefined"==typeof a||null===a)return"null";if("function"==typeof a.toJSON){var b=a.toJSON();return"string"==typeof b?'"'+this._escape(b)+'"':this._escape(b.toString())}if("number"==typeof a||"boolean"==typeof a)return""+a;if("function"==typeof a)return"null";if(a.constructor===Date)return'"'+this._escape(dateToISOString(a))+'"';if(a.constructor===Array){for(var c="",d=0,e=a.length;e>d;d++)d>0&&(c+=","),c+=this._stringifyValue(a[d]);return"["+c+"]"}var f="";for(var g in a)({}).hasOwnProperty.call(a,g)&&(""!==f&&(f+=","),f+='"'+this._escape(g)+'": '+this._stringifyValue(a[g]));return"{"+f+"}"}return"null"},stringify:function(a,b){return this._convertToUnicode=!!b,!this._convertToUnicode&&this._nativeJSON?this._nativeJSON.stringify(a):this._stringifyValue(a)},parse:function(text,reviver){function walk(a,b){var c,d,e=a[b];if(e&&"object"==typeof e)for(c in e)Object.prototype.hasOwnProperty.call(e,c)&&(d=walk(e,c),void 0!==d?e[c]=d:delete e[c]);return reviver.call(a,b,e)}var j;if(text=String(text),cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})),/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse")}};return InkJson}),Ink.createModule("Ink.Util.String","1",[],function(){"use strict";var InkUtilString={_chars:["&","à","á","â","ã","ä","å","æ","ç","è","é","ê","ë","ì","í","î","ï","ð","ñ","ò","ó","ô","õ","ö","ø","ù","ú","û","ü","ý","þ","ÿ","À","Á","Â","Ã","Ä","Å","Æ","Ç","È","É","Ê","Ë","Ì","Í","Î","Ï","Ð","Ñ","Ò","Ó","Ô","Õ","Ö","Ø","Ù","Ú","Û","Ü","Ý","Þ","€",'"',"ß","<",">","¢","£","¤","¥","¦","§","¨","©","ª","«","¬","","®","¯","°","±","²","³","´","µ","¶","·","¸","¹","º","»","¼","½","¾"],_entities:["amp","agrave","aacute","acirc","atilde","auml","aring","aelig","ccedil","egrave","eacute","ecirc","euml","igrave","iacute","icirc","iuml","eth","ntilde","ograve","oacute","ocirc","otilde","ouml","oslash","ugrave","uacute","ucirc","uuml","yacute","thorn","yuml","Agrave","Aacute","Acirc","Atilde","Auml","Aring","AElig","Ccedil","Egrave","Eacute","Ecirc","Euml","Igrave","Iacute","Icirc","Iuml","ETH","Ntilde","Ograve","Oacute","Ocirc","Otilde","Ouml","Oslash","Ugrave","Uacute","Ucirc","Uuml","Yacute","THORN","euro","quot","szlig","lt","gt","cent","pound","curren","yen","brvbar","sect","uml","copy","ordf","laquo","not","shy","reg","macr","deg","plusmn","sup2","sup3","acute","micro","para","middot","cedil","sup1","ordm","raquo","frac14","frac12","frac34"],_accentedChars:["à","á","â","ã","ä","å","è","é","ê","ë","ì","í","î","ï","ò","ó","ô","õ","ö","ù","ú","û","ü","ç","ñ","À","Á","Â","Ã","Ä","Å","È","É","Ê","Ë","Ì","Í","Î","Ï","Ò","Ó","Ô","Õ","Ö","Ù","Ú","Û","Ü","Ç","Ñ"],_accentedRemovedChars:["a","a","a","a","a","a","e","e","e","e","i","i","i","i","o","o","o","o","o","u","u","u","u","c","n","A","A","A","A","A","A","E","E","E","E","I","I","I","I","O","O","O","O","O","U","U","U","U","C","N"],_htmlUnsafeChars:{"<":"<",">":">","&":"&",'"':""","'":"'"},ucFirst:function(a,b){var c=b?/(^|\s)(\w)(\S{2,})/:/(^|\s)(\w)(\S{2,})/g;return a?String(a).replace(c,function(a,b,c,d){return b+c.toUpperCase()+d.toLowerCase()}):a},trim:function(a){return"string"==typeof a?a.replace(/^\s+|\s+$|\n+$/g,""):a},stripTags:function(a,b){if(b&&"string"==typeof b){for(var c=InkUtilString.trim(b).split(","),d=[],e=!1,f=0;f<c.length;f++)""!==InkUtilString.trim(c[f])&&(e=InkUtilString.trim(c[f].replace(/(<|\>)/g,"").replace(/\s/,"")),d.push("(<"+e+"\\s[^>]+>|<(\\s|\\/)?(\\s|\\/)?"+e+">)"));for(var g=d.join("|"),h=new RegExp(g,"i"),i=a.match(new RegExp("<[^>]*>","g")),j=0;j<i.length;j++)i[j].match(h)||(a=a.replace(new RegExp(i[j],"gm"),""));return a}return a.replace(/<[^\>]+\>/g,"")},htmlEntitiesEncode:function(a){if(a&&a.replace)for(var b=!1,c=0;c<InkUtilString._chars.length;c++)b=new RegExp(InkUtilString._chars[c],"gm"),a=a.replace(b,"&"+InkUtilString._entities[c]+";");return a},htmlEntitiesDecode:function(a){if(a&&a.replace){for(var b=!1,c=0;c<InkUtilString._entities.length;c++)b=new RegExp("&"+InkUtilString._entities[c]+";","gm"),a=a.replace(b,InkUtilString._chars[c]);a=a.replace(/&#[^;]+;?/g,function(a){return String.fromCharCode("x"===a.charAt(2)?parseInt(a.substring(3),16):parseInt(a.substring(2),10))})}return a},utf8Encode:function(a){a=a.replace(/\r\n/g,"\n");for(var b="",c=0;c<a.length;c++){var d=a.charCodeAt(c);128>d?b+=String.fromCharCode(d):d>127&&2048>d?(b+=String.fromCharCode(d>>6|192),b+=String.fromCharCode(63&d|128)):(b+=String.fromCharCode(d>>12|224),b+=String.fromCharCode(d>>6&63|128),b+=String.fromCharCode(63&d|128))}return b},shortString:function(a,b){for(var c=a.split(" "),d="",e=0;e<c.length;e++){if((d+c[e]+" ").length>=b){d+="…";break}d+=c[e]+" "}return d},truncateString:function(a,b){return a.length-1>b?a.substr(0,b-1)+"…":a},utf8Decode:function(a){for(var b="",c=0,d=0,e=0,f=0;c<a.length;)d=a.charCodeAt(c),128>d?(b+=String.fromCharCode(d),c++):d>191&&224>d?(e=a.charCodeAt(c+1),b+=String.fromCharCode((31&d)<<6|63&e),c+=2):(e=a.charCodeAt(c+1),f=a.charCodeAt(c+2),b+=String.fromCharCode((15&d)<<12|(63&e)<<6|63&f),c+=3);return b},removeAccentedChars:function(a){for(var b=a,c=!1,d=0;d<InkUtilString._accentedChars.length;d++)c=new RegExp(InkUtilString._accentedChars[d],"gm"),b=b.replace(c,""+InkUtilString._accentedRemovedChars[d]);return b},substrCount:function(a,b){return a?a.split(b).length-1:0},evalJSON:function(strJSON,sanitize){if("undefined"==typeof sanitize||null===sanitize||InkUtilString.isJSON(strJSON))try{return"undefined"!=typeof JSON&&"undefined"!=typeof JSON.parse?JSON.parse(strJSON):eval("("+strJSON+")")}catch(e){throw new Error("ERROR: Bad JSON string...")}},isJSON:function(a){return a=a.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,""),/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/.test(a)},htmlEscapeUnsafe:function(a){var b=InkUtilString._htmlUnsafeChars;return null!==a?String(a).replace(/[<>&'"]/g,function(a){return b[a]}):a},normalizeWhitespace:function(a){return null!==a?InkUtilString.trim(String(a).replace(/\s+/g," ")):a},toUnicode:function(a){if("string"==typeof a){for(var b="",c=!1,d=!1,e=a.length,f=0;e>f;){if(c=a.charCodeAt(f),c>=32&&126>=c||8===c||9===c||10===c||12===c||13===c||32===c||34===c||47===c||58===c||92===c)d=8===c?"\\b":9===c?"\\t":10===c?"\\n":12===c?"\\f":13===c?"\\r":a.charAt(f);else{for(d=a.charCodeAt(f).toString(16)+"".toUpperCase();d.length<4;)d="0"+d;d="\\u"+d}b+=d,f++}return b}},escape:function(a){var b=a.charCodeAt(0).toString(16).split("");if(b.length<3){for(;b.length<2;)b.unshift("0");b.unshift("x")}else{for(;b.length<4;)b.unshift("0");b.unshift("u")}return b.unshift("\\"),b.join("")},unescape:function(a){var b=a.lastIndexOf("0");b=-1===b?2:Math.min(b,2);var c=a.substring(b),d=parseInt(c,16);return String.fromCharCode(d)},escapeText:function(a,b){void 0===b&&(b=["[","]","'",","]);for(var c=[],d,e,f=0,g=a.length;g>f;++f)d=a[f],e=d.charCodeAt(0),(32>e||e>126&&-1===b.indexOf(d))&&(d=InkUtilString.escape(d)),c.push(d);return c.join("")},escapedCharRegex:/(\\x[0-9a-fA-F]{2})|(\\u[0-9a-fA-F]{4})/g,unescapeText:function(a){for(var b;b=InkUtilString.escapedCharRegex.exec(a);)b=b[0],a=a.replace(b,InkUtilString.unescape(b)),InkUtilString.escapedCharRegex.lastIndex=0;return a},strcmp:function(a,b){return a===b?0:a>b?1:-1},packetize:function(a,b){for(var c=a.length,d=new Array(Math.ceil(c/b)),e=a.split(""),f,g=0;c;)f=Math.min(b,c),d[g++]=e.splice(0,f).join(""),c-=f;return d}};return InkUtilString}),Ink.createModule("Ink.Util.Url","1",[],function(){"use strict";var a={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",getUrl:function(){return window.location.href},genQueryString:function(a,b){var c=-1!==a.indexOf("?"),d,e,f,g=[a];for(e in b)b.hasOwnProperty(e)&&(c?d="&":(d="?",c=!0),f=b[e],"number"==typeof f||f||(f=""),g=g.concat([d,encodeURIComponent(e),"=",encodeURIComponent(f)]));return g.join("")},getQueryString:function(a){var b;b=a&&"undefined"!=typeof a?a:this.getUrl();var c={};if(b.match(/\?(.+)/i)){var d=b.replace(/^(.*)\?([^\#]+)(\#(.*))?/g,"$2");if(d.length>0)for(var e=d.split(/[;&]/),f=0;f<e.length;f++){var g=e[f].split("=");c[decodeURIComponent(g[0])]="undefined"!=typeof g[1]&&g[1]?decodeURIComponent(g[1]):!1}}return c},getAnchor:function(a){var b;b=a&&"undefined"!=typeof a?a:this.getUrl();var c=!1;return b.match(/#(.+)/)&&(c=b.replace(/([^#]+)#(.*)/,"$2")),c},getAnchorString:function(a){var b;b=a&&"undefined"!=typeof a?a:this.getUrl();var c={};if(b.match(/#(.+)/i)){var d=b.replace(/^([^#]+)#(.*)?/g,"$2");if(d.length>0)for(var e=d.split(/[;&]/),f=0;f<e.length;f++){var g=e[f].split("=");c[decodeURIComponent(g[0])]="undefined"!=typeof g[1]&&g[1]?decodeURIComponent(g[1]):!1}}return c},parseUrl:function(a){var b={};if(a&&"string"==typeof a){if(a.match(/^([^:]+):\/\//i)){var c=/^([^:]+):\/\/([^\/]*)\/?([^\?#]*)\??([^#]*)#?(.*)/i;a.match(c)&&(b.scheme=a.replace(c,"$1"),b.host=a.replace(c,"$2"),b.path="/"+a.replace(c,"$3"),b.query=a.replace(c,"$4")||!1,b.fragment=a.replace(c,"$5")||!1)}else{var d=new RegExp("^([^\\?]+)\\?([^#]+)#(.*)","i"),e=new RegExp("^([^\\?]+)\\?([^#]+)#?","i"),f=new RegExp("^([^\\?]+)\\??","i");a.match(d)?(b.scheme=!1,b.host=!1,b.path=a.replace(d,"$1"),b.query=a.replace(d,"$2"),b.fragment=a.replace(d,"$3")):a.match(e)?(b.scheme=!1,b.host=!1,b.path=a.replace(e,"$1"),b.query=a.replace(e,"$2"),b.fragment=!1):a.match(f)&&(b.scheme=!1,b.host=!1,b.path=a.replace(f,"$1"),b.query=!1,b.fragment=!1)}if(b.host){var g=/^(.*?)\\:(\\d+)$/i;if(b.host.match(g)){var h=b.host;b.host=h.replace(g,"$1"),b.port=h.replace(g,"$2")}else b.port=!1;if(b.host.match(/@/i)){var i=b.host;b.host=i.split("@")[1];var j=i.split("@")[0];j.match(/\:/)?(b.user=j.split(":")[0],b.pass=j.split(":")[1]):(b.user=j,b.pass=!1)}}}return b},format:function(a){var b="",c="",d="",e="",f="";return"string"==typeof a.protocol?b=a.protocol+"//":"string"==typeof a.scheme&&(b=a.scheme+"://"),c=a.host||a.hostname||"",d=a.path||"","string"==typeof a.query?f=a.query:"string"==typeof a.search&&(f=a.search.replace(/^\?/,"")),"string"==typeof a.fragment?e=a.fragment:"string"==typeof a.hash&&(e=a.hash.replace(/#$/,"")),[b,c,d,f&&"?"+f,e&&"#"+e].join("")},currentScriptElement:function(a){var b=document.getElementsByTagName("script");if("undefined"==typeof a)return b.length>0?b[b.length-1]:!1;for(var c=!1,d=new RegExp(""+a,"i"),e=0,f=b.length;f>e;e++)if(c=b[e],d.test(c.src))return c;return!1},_debug:function(){}};return a}),Ink.createModule("Ink.Util.Validator","1",[],function(){"use strict";var a={_countryCodes:["AO","CV","MZ","PT"],_internacionalPT:351,_indicativosPT:{21:"lisboa",22:"porto",231:"mealhada",232:"viseu",233:"figueira da foz",234:"aveiro",235:"arganil",236:"pombal",238:"seia",239:"coimbra",241:"abrantes",242:"ponte de sôr",243:"santarém",244:"leiria",245:"portalegre",249:"torres novas",251:"valença",252:"vila nova de famalicão",253:"braga",254:"peso da régua",255:"penafiel",256:"são joão da madeira",258:"viana do castelo",259:"vila real",261:"torres vedras",262:"caldas da raínha",263:"vila franca de xira",265:"setúbal",266:"évora",268:"estremoz",269:"santiago do cacém",271:"guarda",272:"castelo branco",273:"bragança",274:"proença-a-nova",275:"covilhã",276:"chaves",277:"idanha-a-nova",278:"mirandela",279:"moncorvo",281:"tavira",282:"portimão",283:"odemira",284:"beja",285:"moura",286:"castro verde",289:"faro",291:"funchal, porto santo",292:"corvo, faial, flores, horta, pico",295:"angra do heroísmo, graciosa, são jorge, terceira",296:"ponta delgada, são miguel, santa maria",91:"rede móvel 91 (Vodafone / Yorn)",93:"rede móvel 93 (Optimus)",96:"rede móvel 96 (TMN)",92:"rede móvel 92 (TODOS)",707:"número único",760:"número único",800:"número grátis",808:"chamada local",30:"voip"},_internacionalCV:238,_indicativosCV:{2:"fixo",91:"móvel 91",95:"móvel 95",97:"móvel 97",98:"móvel 98",99:"móvel 99"},_internacionalAO:244,_indicativosAO:{2:"fixo",91:"móvel 91",92:"móvel 92"},_internacionalMZ:258,_indicativosMZ:{2:"fixo",82:"móvel 82",84:"móvel 84"},_internacionalTL:670,_indicativosTL:{3:"fixo",7:"móvel 7"},_characterGroups:{numbers:["0-9"],asciiAlpha:["a-zA-Z"],latin1Alpha:["a-zA-Z","À-ÿ"],unicodeAlpha:["a-zA-Z","À-ÿ","Ā-","Ⰰ-"],space:[" "],dash:["-"],underscore:["_"],nicknamePunctuation:["_.-"],singleLineWhitespace:[" "],newline:["\n"],whitespace:[" \n\f\r "],asciiPunctuation:["!-/",":-@","[-`","{-~"],latin1Punctuation:["!-/",":-@","[-`","{-~","¡-¿","×","÷"],unicodePunctuation:["!-/",":-@","[-`","{-~","¡-¿","×","÷"," -","⸀-"," -〿"]},createRegExp:function(b){var c="^[";
|
||
for(var d in b)if(b.hasOwnProperty(d)){if(!(d in a._characterGroups))throw new Error("group "+d+" is not a valid character group");b[d]&&(c+=a._characterGroups[d].join(""))}return new RegExp("^["===c?"$^":c+"]*?$")},checkCharacterGroups:function(b,c){return a.createRegExp(c).test(b)},unicode:function(b,c){return a.checkCharacterGroups(b,Ink.extendObj({unicodeAlpha:!0},c))},latin1:function(b,c){return a.checkCharacterGroups(b,Ink.extendObj({latin1Alpha:!0},c))},ascii:function(b,c){return a.checkCharacterGroups(b,Ink.extendObj({asciiAlpha:!0},c))},number:function(b,c){b+="";var d=Ink.extendObj({decimalSep:".",thousandSep:"",negative:!0,decimalPlaces:null,maxDigits:null,max:null,min:null,returnNumber:!1},c||{});if(d.thousandSep)return b=b.replace(new RegExp("\\"+d.thousandSep,"g"),""),d.thousandSep="",a.number(b,d);if(d.negative===!1)return d.min=0,d.negative=!0,a.number(b,d);if("."!==d.decimalSep&&(b=b.replace(new RegExp("\\"+d.decimalSep,"g"),".")),!/^(-)?(\d+)?(\.\d+)?$/.test(b)||""===b)return!1;var e;if(d.decimalSep&&-1!==b.indexOf(d.decimalSep)){if(e=b.split(d.decimalSep),null!==d.decimalPlaces&&e[1].length>d.decimalPlaces)return!1}else e=[""+b,""];if(null!==d.maxDigits&&e[0].replace(/-/g,"").length>d.maxDigits)return e;var f=parseFloat(b);return null!==d.maxExcl&&f>=d.maxExcl||null!==d.minExcl&&f<=d.minExcl?!1:null!==d.max&&f>d.max||null!==d.min&&f<d.min?!1:d.returnNumber?f:!0},_isLeapYear:function(a){var b=/^\d{4}$/;return b.test(a)?a%4?!1:a%100?!0:a%400?!1:!0:!1},_dateParsers:{"yyyy-mm-dd":{day:5,month:3,year:1,sep:"-",parser:/^(\d{4})(\-)(\d{1,2})(\-)(\d{1,2})$/},"yyyy/mm/dd":{day:5,month:3,year:1,sep:"/",parser:/^(\d{4})(\/)(\d{1,2})(\/)(\d{1,2})$/},"yy-mm-dd":{day:5,month:3,year:1,sep:"-",parser:/^(\d{2})(\-)(\d{1,2})(\-)(\d{1,2})$/},"yy/mm/dd":{day:5,month:3,year:1,sep:"/",parser:/^(\d{2})(\/)(\d{1,2})(\/)(\d{1,2})$/},"dd-mm-yyyy":{day:1,month:3,year:5,sep:"-",parser:/^(\d{1,2})(\-)(\d{1,2})(\-)(\d{4})$/},"dd/mm/yyyy":{day:1,month:3,year:5,sep:"/",parser:/^(\d{1,2})(\/)(\d{1,2})(\/)(\d{4})$/},"dd-mm-yy":{day:1,month:3,year:5,sep:"-",parser:/^(\d{1,2})(\-)(\d{1,2})(\-)(\d{2})$/},"dd/mm/yy":{day:1,month:3,year:5,sep:"/",parser:/^(\d{1,2})(\/)(\d{1,2})(\/)(\d{2})$/}},_daysInMonth:function(a,b){var c=0;return a=parseInt(a,10),b=parseInt(b,10),1===a||3===a||5===a||7===a||8===a||10===a||12===a?c=31:4===a||6===a||9===a||11===a?c=30:2===a&&(c=b%400===0||b%4===0&&b%100!==0?29:28),c},_isValidDate:function(a,b,c){var d=/^\d{4}$/,e=/^\d{1,2}$/;return d.test(a)&&e.test(b)&&e.test(c)&&b>=1&&12>=b&&c>=1&&this._daysInMonth(b,a)>=c?!0:!1},email:function(a){var b=new RegExp("^[_a-z0-9-]+((\\.|\\+)[_a-z0-9-]+)*@([\\w]*-?[\\w]*\\.)+[a-z]{2,4}$","i");return b.test(a)?!0:!1},mail:function(b){return a.email(b)},url:function(a,b){if("undefined"==typeof b||b===!1){var c=new RegExp("(^(http\\:\\/\\/|https\\:\\/\\/)(.+))","i");c.test(a)===!1&&(a="http://"+a)}var d=new RegExp("^(http:\\/\\/|https:\\/\\/)([\\w]*(-?[\\w]*)*\\.)+[a-z]{2,4}","i");return d.test(a)===!1?!1:!0},isPTPhone:function(a){a=a.toString();var b=[];for(var c in this._indicativosPT)"string"==typeof this._indicativosPT[c]&&b.push(c);var d=b.join("|"),e=/^(00351|\+351)/;e.test(a)&&(a=a.replace(e,""));var f=/(\s|\-|\.)+/g;a=a.replace(f,"");var g=/[\d]{9}/i;if(9===a.length&&g.test(a)){var h=new RegExp("^("+d+")");if(h.test(a))return!0}return!1},isPortuguesePhone:function(a){return this.isPTPhone(a)},isCVPhone:function(a){a=a.toString();var b=[];for(var c in this._indicativosCV)"string"==typeof this._indicativosCV[c]&&b.push(c);var d=b.join("|"),e=/^(00238|\+238)/;e.test(a)&&(a=a.replace(e,""));var f=/(\s|\-|\.)+/g;a=a.replace(f,"");var g=/[\d]{7}/i;if(7===a.length&&g.test(a)){var h=new RegExp("^("+d+")");if(h.test(a))return!0}return!1},isAOPhone:function(a){a=a.toString();var b=[];for(var c in this._indicativosAO)"string"==typeof this._indicativosAO[c]&&b.push(c);var d=b.join("|"),e=/^(00244|\+244)/;e.test(a)&&(a=a.replace(e,""));var f=/(\s|\-|\.)+/g;a=a.replace(f,"");var g=/[\d]{9}/i;if(9===a.length&&g.test(a)){var h=new RegExp("^("+d+")");if(h.test(a))return!0}return!1},isMZPhone:function(a){a=a.toString();var b=[];for(var c in this._indicativosMZ)"string"==typeof this._indicativosMZ[c]&&b.push(c);var d=b.join("|"),e=/^(00258|\+258)/;e.test(a)&&(a=a.replace(e,""));var f=/(\s|\-|\.)+/g;a=a.replace(f,"");var g=/[\d]{8,9}/i;if((9===a.length||8===a.length)&&g.test(a)){var h=new RegExp("^("+d+")");if(h.test(a)){if(0===a.indexOf("2")&&8===a.length)return!0;if(0===a.indexOf("8")&&9===a.length)return!0}}return!1},isTLPhone:function(a){a=a.toString();var b=[];for(var c in this._indicativosTL)"string"==typeof this._indicativosTL[c]&&b.push(c);var d=b.join("|"),e=/^(00670|\+670)/;e.test(a)&&(a=a.replace(e,""));var f=/(\s|\-|\.)+/g;a=a.replace(f,"");var g=/[\d]{7}/i;if(7===a.length&&g.test(a)){var h=new RegExp("^("+d+")");if(h.test(a))return!0}return!1},isPhone:function(){var a;if(0===arguments.length)return!1;var b=arguments[0];if(arguments.length>1){if(arguments[1].constructor!==Array){if("function"==typeof this["is"+arguments[1].toUpperCase()+"Phone"])return this["is"+arguments[1].toUpperCase()+"Phone"](b);throw"Invalid Country Code!"}var c;for(a=0;a<arguments[1].length;a++){if("function"!=typeof(c=this["is"+arguments[1][a].toUpperCase()+"Phone"]))throw"Invalid Country Code!";if(c(b))return!0}}else for(a=0;a<this._countryCodes.length;a++)if(this["is"+this._countryCodes[a]+"Phone"](b))return!0;return!1},codPostal:function(a,b,c){var d=/^(\s*\-\s*|\s+)$/,e=/^\s+|\s+$/g,f=/^[1-9]\d{3}$/,g=/^\d{3}$/,h=/^(.{4})(.*)(.{3})$/;if(c=!!c,a=a.replace(e,""),"undefined"!=typeof b){if(b=b.replace(e,""),f.test(a)&&g.test(b))return c===!0?[!0,!0]:!0}else{if(f.test(a))return c===!0?[!0,!1]:!0;var i=a.match(h);if(null!==i&&f.test(i[1])&&d.test(i[2])&&g.test(i[3]))return c===!0?[!0,!1]:!0}return c===!0?[!1,!1]:!1},isDate:function(a,b){if("undefined"==typeof this._dateParsers[a])return!1;var c=this._dateParsers[a].year,d=this._dateParsers[a].month,e=this._dateParsers[a].day,f=this._dateParsers[a].parser,g=this._dateParsers[a].sep,h=b.match(f);if(null!==h&&h[2]===h[4]&&h[2]===g){var i=2===h[c].length?"20"+h[c].toString():h[c];if(this._isValidDate(i,h[d].toString(),h[e].toString()))return!0}return!1},isColor:function(a){var b,c=!1,d=/^[a-zA-Z]+$/,e=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/,f=/^rgb\(\s*([0-9]{1,3})(%)?\s*,\s*([0-9]{1,3})(%)?\s*,\s*([0-9]{1,3})(%)?\s*\)$/,g=/^rgba\(\s*([0-9]{1,3})(%)?\s*,\s*([0-9]{1,3})(%)?\s*,\s*([0-9]{1,3})(%)?\s*,\s*(1(\.0)?|0(\.[0-9])?)\s*\)$/,h=/^hsl\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})(%)?\s*,\s*([0-9]{1,3})(%)?\s*\)$/,i=/^hsla\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})(%)?\s*,\s*([0-9]{1,3})(%)?\s*,\s*(1(\.0)?|0(\.[0-9])?)\s*\)$/;if(d.test(a)||e.test(a))return!0;var j;if(null!==(b=f.exec(a))||null!==(b=g.exec(a)))for(j=b.length;j--;){if((2===j||4===j||6===j)&&"undefined"!=typeof b[j]&&""!==b[j]){if(!("undefined"!=typeof b[j-1]&&b[j-1]>=0&&b[j-1]<=100))return!1;c=!0}if(1===j||3===j||5===j&&("undefined"==typeof b[j+1]||""===b[j+1])){if(!("undefined"!=typeof b[j]&&b[j]>=0&&b[j]<=255))return!1;c=!0}}if(null!==(b=h.exec(a))||null!==(b=i.exec(a)))for(j=b.length;j--;){if(3===j||5===j){if(!("undefined"!=typeof b[j-1]&&"undefined"!=typeof b[j]&&""!==b[j]&&b[j-1]>=0&&b[j-1]<=100))return!1;c=!0}if(1===j){if(!("undefined"!=typeof b[j]&&b[j]>=0&&b[j]<=360))return!1;c=!0}}return c},isIP:function(a,b){if("string"!=typeof a)return!1;switch(b=(b||"ipv4").toLowerCase()){case"ipv4":return/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(a);case"ipv6":return/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/.test(a);default:return!1}},_creditCardSpecs:{"default":{length:"13,14,15,16,17,18,19",prefix:/^.+/,luhn:!0},"american express":{length:"15",prefix:/^3[47]/,luhn:!0},"diners club":{length:"14,16",prefix:/^36|55|30[0-5]/,luhn:!0},discover:{length:"16",prefix:/^6(?:5|011)/,luhn:!0},jcb:{length:"15,16",prefix:/^3|1800|2131/,luhn:!0},maestro:{length:"16,18",prefix:/^50(?:20|38)|6(?:304|759)/,luhn:!0},mastercard:{length:"16",prefix:/^5[1-5]/,luhn:!0},visa:{length:"13,16",prefix:/^4/,luhn:!0}},_luhn:function(a){if(a=parseInt(a,10),"number"!=typeof a&&a%1!==0)return!1;a+="";var b=a.length,c,d=0;for(c=b-1;c>=0;c-=2)d+=parseInt(a.substr(c,1),10);for(c=b-2;c>=0;c-=2){var e=parseInt(2*a.substr(c,1),10);d+=e>=10?e-9:e}return d%10===0},isCreditCard:function(a,b){if(/\d+/.test(a)===!1)return!1;if("undefined"==typeof b)b="default";else if(b instanceof Array){var c,d=b.length;for(c=0;d>c;c++)if(this.isCreditCard(a,b[c]))return!0;return!1}if(b=b.toLowerCase(),"undefined"==typeof this._creditCardSpecs[b])return!1;var e=a.length+"";return-1===this._creditCardSpecs[b].length.split(",").indexOf(e)?!1:this._creditCardSpecs[b].prefix.test(a)?this._creditCardSpecs[b].luhn===!1?!0:this._luhn(a):!1}};return a});
|
||
//# sourceMappingURL=ink-all.min.map
|