6 lines
144 KiB
JavaScript
6 lines
144 KiB
JavaScript
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});
|
|
//# sourceMappingURL=ink-ui.min.map
|