nope/resources/w2ui/w2ui-fields.min.js
2020-09-01 17:48:26 +02:00

3 lines
127 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* w2ui-fields.js 1.5.x (nightly), part of w2ui (c) http://w2ui.com, vitmalina@gmail.com */
var w2ui=w2ui||{},w2obj=w2obj||{},w2utils=function(m){var e={};return{version:"1.5.x",settings:{locale:"en-us",dateFormat:"m/d/yyyy",timeFormat:"hh:mi pm",datetimeFormat:"m/d/yyyy|hh:mi pm",currencyPrefix:"$",currencySuffix:"",currencyPrecision:2,groupSymbol:",",decimalSymbol:".",shortmonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],fullmonths:["January","February","March","April","May","June","July","August","September","October","November","December"],shortdays:["M","T","W","T","F","S","S"],fulldays:["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],weekStarts:"M",dataType:"HTTPJSON",phrases:{},dateStartYear:1950,dateEndYear:2030,macButtonOrder:!1},isBin:function(e){return/^[0-1]+$/.test(e)},isInt:p,isFloat:function(e){"string"==typeof e&&(e=e.replace(/\s+/g,"").replace(w2utils.settings.groupSymbol,"").replace(w2utils.settings.decimalSymbol,"."));return("number"==typeof e||"string"==typeof e&&""!==e)&&!isNaN(Number(e))},isMoney:function(e){var t=w2utils.settings,i=new RegExp("^"+(t.currencyPrefix?"\\"+t.currencyPrefix+"?":"")+"[-+]?"+(t.currencyPrefix?"\\"+t.currencyPrefix+"?":"")+"[0-9]*[\\"+t.decimalSymbol+"]?[0-9]+"+(t.currencySuffix?"\\"+t.currencySuffix+"?":"")+"$","i");"string"==typeof e&&(e=e.replace(new RegExp(t.groupSymbol,"g"),""));return"object"!=typeof e&&""!==e&&i.test(e)},isHex:function(e){return/^(0x)?[0-9a-fA-F]+$/.test(e)},isAlphaNumeric:function(e){return/^[a-zA-Z0-9_-]+$/.test(e)},isEmail:function(e){return/^[a-zA-Z0-9._%\-+]+@[а-яА-Яa-zA-Z0-9.-]+\.[а-яА-Яa-zA-Z]+$/.test(e)},isIpAddress:function(e){return new RegExp("^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$").test(e)},isDate:function(e,t,i){if(!e)return!1;var n,o,s,a="Invalid Date";null==t&&(t=w2utils.settings.dateFormat);if("function"==typeof e.getFullYear)s=e.getFullYear(),n=e.getMonth()+1,o=e.getDate();else if(parseInt(e)==e&&0<parseInt(e))e=new Date(parseInt(e)),s=e.getFullYear(),n=e.getMonth()+1,o=e.getDate();else{if(e=String(e),new RegExp("mon","ig").test(t)){t=t.replace(/month/gi,"m").replace(/mon/gi,"m").replace(/dd/gi,"d").replace(/[, ]/gi,"/").replace(/\/\//g,"/").toLowerCase(),e=e.replace(/[, ]/gi,"/").replace(/\/\//g,"/").toLowerCase();for(var r=0,l=w2utils.settings.fullmonths.length;r<l;r++){var d=w2utils.settings.fullmonths[r];e=e.replace(new RegExp(d,"ig"),parseInt(r)+1).replace(new RegExp(d.substr(0,3),"ig"),parseInt(r)+1)}}var u=e.replace(/-/g,"/").replace(/\./g,"/").toLowerCase().split("/"),c=t.replace(/-/g,"/").replace(/\./g,"/").toLowerCase();"mm/dd/yyyy"===c&&(n=u[0],o=u[1],s=u[2]),"m/d/yyyy"===c&&(n=u[0],o=u[1],s=u[2]),"dd/mm/yyyy"===c&&(n=u[1],o=u[0],s=u[2]),"d/m/yyyy"===c&&(n=u[1],o=u[0],s=u[2]),"yyyy/dd/mm"===c&&(n=u[2],o=u[1],s=u[0]),"yyyy/d/m"===c&&(n=u[2],o=u[1],s=u[0]),"yyyy/mm/dd"===c&&(n=u[1],o=u[2],s=u[0]),"yyyy/m/d"===c&&(n=u[1],o=u[2],s=u[0]),"mm/dd/yy"===c&&(n=u[0],o=u[1],s=u[2]),"m/d/yy"===c&&(n=u[0],o=u[1],s=parseInt(u[2])+1900),"dd/mm/yy"===c&&(n=u[1],o=u[0],s=parseInt(u[2])+1900),"d/m/yy"===c&&(n=u[1],o=u[0],s=parseInt(u[2])+1900),"yy/dd/mm"===c&&(n=u[2],o=u[1],s=parseInt(u[0])+1900),"yy/d/m"===c&&(n=u[2],o=u[1],s=parseInt(u[0])+1900),"yy/mm/dd"===c&&(n=u[1],o=u[2],s=parseInt(u[0])+1900),"yy/m/d"===c&&(n=u[1],o=u[2],s=parseInt(u[0])+1900)}if(!p(s))return!1;if(!p(n))return!1;if(!p(o))return!1;if(s=+s,n=+n,o=+o,a=new Date(s,n-1,o),null==n)return!1;if("Invalid Date"===String(a))return!1;if(a.getMonth()+1!==n||a.getDate()!==o||a.getFullYear()!==s)return!1;return!0!==i||a},isTime:function(e,t){if(null==e)return!1;var i,n,o;e=(e=String(e)).toUpperCase(),n=0<=e.indexOf("AM");var s=(o=0<=e.indexOf("PM"))||n;i=s?12:24;e=e.replace("AM","").replace("PM","");var a=(e=m.trim(e)).split(":"),r=parseInt(a[0]||0),l=parseInt(a[1]||0),d=parseInt(a[2]||0);if((!s||1!==a.length)&&2!==a.length&&3!==a.length)return!1;if(""===a[0]||r<0||i<r||!this.isInt(a[0])||2<a[0].length)return!1;if(1<a.length&&(""===a[1]||l<0||59<l||!this.isInt(a[1])||2!==a[1].length))return!1;if(2<a.length&&(""===a[2]||d<0||59<d||!this.isInt(a[2])||2!==a[2].length))return!1;if(!s&&i===r&&(0!==l||0!==d))return!1;if(s&&1===a.length&&0===r)return!1;if(!0!==t)return!0;o&&12!==r&&(r+=12);n&&12===r&&(r+=12);return{hours:r,minutes:l,seconds:d}},isDateTime:function(e,t,i){if("function"==typeof e.getFullYear)return!0!==i||e;var n=parseInt(e);if(n===e)return!(n<0)&&(!0!==i||new Date(n));var o=String(e).indexOf(" ");{if(o<0)return!(String(e).indexOf("T")<0||"Invalid Date"==String(new Date(e)))&&(!0!==i||new Date(e));null==t&&(t=w2utils.settings.datetimeFormat);var s=t.split("|"),a=[e.substr(0,o),e.substr(o).trim()];s[0]=s[0].trim(),s[1]&&(s[1]=s[1].trim());var r=w2utils.isDate(a[0],s[0],!0),l=w2utils.isTime(a[1],!0);return!1!==r&&!1!==l&&(!0!==i||(r.setHours(l.hours),r.setMinutes(l.minutes),r.setSeconds(l.seconds),r))}},age:function(e){var t;if(""===e||null==e)return"";t="function"==typeof e.getFullYear?e:parseInt(e)==e&&0<parseInt(e)?new Date(parseInt(e)):new Date(e);if("Invalid Date"===String(t))return"";var i=((new Date).getTime()-t.getTime())/1e3,n="",o="";i<0?(n=0,o="sec"):i<60?(n=Math.floor(i),o="sec",i<0&&(n=0,o="sec")):i<3600?(n=Math.floor(i/60),o="min"):i<86400?(n=Math.floor(i/60/60),o="hour"):i<2592e3?(n=Math.floor(i/24/60/60),o="day"):i<31536e3?(n=Math.floor(i/30/24/60/60*10)/10,o="month"):i<126144e3?(n=Math.floor(i/365/24/60/60*10)/10,o="year"):126144e3<=i&&(n=Math.floor(i/365.25/24/60/60*10)/10,o="year");return n+" "+o+(1<n?"s":"")},interval:function(e){var t="";t=e<1e3?"< 1 sec":e<6e4?Math.floor(e/1e3)+" secs":e<36e5?Math.floor(e/6e4)+" mins":e<864e5?Math.floor(e/36e5*10)/10+" hours":e<2628e6?Math.floor(e/864e5*10)/10+" days":e<31536e6?Math.floor(e/2628e6*10)/10+" months":Math.floor(e/31536e5)/10+" years";return t},date:function(e){if(""===e||null==e||"object"==typeof e&&!e.getMonth)return"";var t=new Date(e);w2utils.isInt(e)&&(t=new Date(Number(e)));if("Invalid Date"===String(t))return"";var i=w2utils.settings.shortmonths,n=new Date,o=new Date;o.setTime(o.getTime()-864e5);var s=i[t.getMonth()]+" "+t.getDate()+", "+t.getFullYear(),a=i[n.getMonth()]+" "+n.getDate()+", "+n.getFullYear(),r=i[o.getMonth()]+" "+o.getDate()+", "+o.getFullYear(),l=t.getHours()-(12<t.getHours()?12:0)+":"+(t.getMinutes()<10?"0":"")+t.getMinutes()+" "+(12<=t.getHours()?"pm":"am"),d=t.getHours()-(12<t.getHours()?12:0)+":"+(t.getMinutes()<10?"0":"")+t.getMinutes()+":"+(t.getSeconds()<10?"0":"")+t.getSeconds()+" "+(12<=t.getHours()?"pm":"am"),u=s;s==a&&(u=l);s==r&&(u=w2utils.lang("Yesterday"));return'<span title="'+s+" "+d+'">'+u+"</span>"},formatSize:function(e){if(!w2utils.isFloat(e)||""===e)return"";if(0===(e=parseFloat(e)))return 0;var t=parseInt(Math.floor(Math.log(e)/Math.log(1024)));return(Math.floor(e/Math.pow(1024,t)*10)/10).toFixed(0===t?0:1)+" "+(["Bt","KB","MB","GB","TB","PB","EB","ZB"][t]||"??")},formatNumber:function(e,t,i){if(null==e||""===e||"object"==typeof e)return"";var n={minimumFractionDigits:t,maximumFractionDigits:t,useGrouping:i};(null==t||t<0)&&(n.minimumFractionDigits=0,n.maximumFractionDigits=20);return parseFloat(e).toLocaleString(w2utils.settings.locale,n)},formatDate:function(e,t){t=t||this.settings.dateFormat;if(""===e||null==e||"object"==typeof e&&!e.getMonth)return"";var i=new Date(e);w2utils.isInt(e)&&(i=new Date(Number(e)));if("Invalid Date"===String(i))return"";var n=i.getFullYear(),o=i.getMonth(),s=i.getDate();return t.toLowerCase().replace("month",w2utils.settings.fullmonths[o]).replace("mon",w2utils.settings.shortmonths[o]).replace(/yyyy/g,n).replace(/yyy/g,n).replace(/yy/g,2e3<n?100+parseInt(String(n).substr(2)):String(n).substr(2)).replace(/(^|[^a-z$])y/g,"$1"+n).replace(/mm/g,(o+1<10?"0":"")+(o+1)).replace(/dd/g,(s<10?"0":"")+s).replace(/th/g,1==s?"st":"th").replace(/th/g,2==s?"nd":"th").replace(/th/g,3==s?"rd":"th").replace(/(^|[^a-z$])m/g,"$1"+(o+1)).replace(/(^|[^a-z$])d/g,"$1"+s)},formatTime:function(e,t){w2utils.settings.shortmonths,w2utils.settings.fullmonths;t=t||this.settings.timeFormat;if(""===e||null==e||"object"==typeof e&&!e.getMonth)return"";var i=new Date(e);w2utils.isInt(e)&&(i=new Date(Number(e)));if(w2utils.isTime(e)){var n=w2utils.isTime(e,!0);(i=new Date).setHours(n.hours),i.setMinutes(n.minutes)}if("Invalid Date"===String(i))return"";var o="am",s=i.getHours(),a=i.getHours(),r=i.getMinutes(),l=i.getSeconds();r<10&&(r="0"+r);l<10&&(l="0"+l);-1===t.indexOf("am")&&-1===t.indexOf("pm")||(12<=s&&(o="pm"),12<s&&(s-=12),0===s&&(s=12));return t.toLowerCase().replace("am",o).replace("pm",o).replace("hhh",s<10?"0"+s:s).replace("hh24",a<10?"0"+a:a).replace("h24",a).replace("hh",s).replace("mm",r).replace("mi",r).replace("ss",l).replace(/(^|[^a-z$])h/g,"$1"+s).replace(/(^|[^a-z$])m/g,"$1"+r).replace(/(^|[^a-z$])s/g,"$1"+l)},formatDateTime:function(e,t){var i;if(""===e||null==e||"object"==typeof e&&!e.getMonth)return"";"string"!=typeof t?i=[this.settings.dateFormat,this.settings.timeFormat]:((i=t.split("|"))[0]=i[0].trim(),i[1]=1<i.length?i[1].trim():this.settings.timeFormat);"h12"===i[1]&&(i[1]="h:m pm");"h24"===i[1]&&(i[1]="h24:m");return this.formatDate(e,i[0])+" "+this.formatTime(e,i[1])},stripTags:function(e){if(null==e)return e;switch(typeof e){case"number":break;case"string":e=String(e).replace(/<(?:[^>=]|='[^']*'|="[^"]*"|=[^'"][^\s>]*)*>/gi,"");break;case"object":if(Array.isArray(e)){e=m.extend(!0,[],e);for(var t=0;t<e.length;t++)e[t]=this.stripTags(e[t])}else for(var t in e=m.extend(!0,{},e))e[t]=this.stripTags(e[t])}return e},encodeTags:o,decodeTags:function(e){if(null==e)return e;switch(typeof e){case"number":break;case"string":e=String(e).replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quot;/g,'"').replace(/&amp;/g,"&");break;case"object":if(Array.isArray(e)){e=m.extend(!0,[],e);for(var t=0;t<e.length;t++)e[t]=this.decodeTags(e[t])}else for(var t in e=m.extend(!0,{},e))e[t]=this.decodeTags(e[t])}return e},escapeId:function(e){return""===e||null==e?"":String(e).replace(/([;&,\.\+\*\~'`:"\!\^#$%@\[\]\(\)=<>\|\/? {}\\])/g,"\\$1")},base64encode:function(e){var t,i,n,o,s,a,r,l="",d=0,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e=function(e){e=String(e).replace(/\r\n/g,"\n");for(var t="",i=0;i<e.length;i++){var n=e.charCodeAt(i);n<128?t+=String.fromCharCode(n):(127<n&&n<2048?t+=String.fromCharCode(n>>6|192):(t+=String.fromCharCode(n>>12|224),t+=String.fromCharCode(n>>6&63|128)),t+=String.fromCharCode(63&n|128))}return t}(e);for(;d<e.length;)t=e.charCodeAt(d++),i=e.charCodeAt(d++),n=e.charCodeAt(d++),o=t>>2,s=(3&t)<<4|i>>4,a=(15&i)<<2|n>>6,r=63&n,isNaN(i)?a=r=64:isNaN(n)&&(r=64),l=l+u.charAt(o)+u.charAt(s)+u.charAt(a)+u.charAt(r);return l},base64decode:function(e){var t,i,n,o,s,a,r,l="",d=0,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(;d<e.length;)o=u.indexOf(e.charAt(d++)),s=u.indexOf(e.charAt(d++)),a=u.indexOf(e.charAt(d++)),r=u.indexOf(e.charAt(d++)),t=o<<2|s>>4,i=(15&s)<<4|a>>2,n=(3&a)<<6|r,l+=String.fromCharCode(t),64!==a&&(l+=String.fromCharCode(i)),64!==r&&(l+=String.fromCharCode(n));return l=function(e){var t,i,n="",o=0,s=0;for(;o<e.length;)(s=e.charCodeAt(o))<128?(n+=String.fromCharCode(s),o++):191<s&&s<224?(t=e.charCodeAt(o+1),n+=String.fromCharCode((31&s)<<6|63&t),o+=2):(t=e.charCodeAt(o+1),i=e.charCodeAt(o+2),n+=String.fromCharCode((15&s)<<12|(63&t)<<6|63&i),o+=3);return n}(l)},md5:function(e){var s=0;function t(e){return a(r(o(e),8*e.length))}function i(e){for(var t,i=s?"0123456789ABCDEF":"0123456789abcdef",n="",o=0;o<e.length;o++)t=e.charCodeAt(o),n+=i.charAt(t>>>4&15)+i.charAt(15&t);return n}function n(e){for(var t,i,n="",o=-1;++o<e.length;)t=e.charCodeAt(o),i=o+1<e.length?e.charCodeAt(o+1):0,55296<=t&&t<=56319&&56320<=i&&i<=57343&&(t=65536+((1023&t)<<10)+(1023&i),o++),t<=127?n+=String.fromCharCode(t):t<=2047?n+=String.fromCharCode(192|t>>>6&31,128|63&t):t<=65535?n+=String.fromCharCode(224|t>>>12&15,128|t>>>6&63,128|63&t):t<=2097151&&(n+=String.fromCharCode(240|t>>>18&7,128|t>>>12&63,128|t>>>6&63,128|63&t));return n}function o(e){for(var t=Array(e.length>>2),i=0;i<t.length;i++)t[i]=0;for(i=0;i<8*e.length;i+=8)t[i>>5]|=(255&e.charCodeAt(i/8))<<i%32;return t}function a(e){for(var t="",i=0;i<32*e.length;i+=8)t+=String.fromCharCode(e[i>>5]>>>i%32&255);return t}function r(e,t){e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;for(var i=1732584193,n=-271733879,o=-1732584194,s=271733878,a=0;a<e.length;a+=16){var r=i,l=n,d=o,u=s;n=f(n=f(n=f(n=f(n=h(n=h(n=h(n=h(n=p(n=p(n=p(n=p(n=c(n=c(n=c(n=c(n,o=c(o,s=c(s,i=c(i,n,o,s,e[a+0],7,-680876936),n,o,e[a+1],12,-389564586),i,n,e[a+2],17,606105819),s,i,e[a+3],22,-1044525330),o=c(o,s=c(s,i=c(i,n,o,s,e[a+4],7,-176418897),n,o,e[a+5],12,1200080426),i,n,e[a+6],17,-1473231341),s,i,e[a+7],22,-45705983),o=c(o,s=c(s,i=c(i,n,o,s,e[a+8],7,1770035416),n,o,e[a+9],12,-1958414417),i,n,e[a+10],17,-42063),s,i,e[a+11],22,-1990404162),o=c(o,s=c(s,i=c(i,n,o,s,e[a+12],7,1804603682),n,o,e[a+13],12,-40341101),i,n,e[a+14],17,-1502002290),s,i,e[a+15],22,1236535329),o=p(o,s=p(s,i=p(i,n,o,s,e[a+1],5,-165796510),n,o,e[a+6],9,-1069501632),i,n,e[a+11],14,643717713),s,i,e[a+0],20,-373897302),o=p(o,s=p(s,i=p(i,n,o,s,e[a+5],5,-701558691),n,o,e[a+10],9,38016083),i,n,e[a+15],14,-660478335),s,i,e[a+4],20,-405537848),o=p(o,s=p(s,i=p(i,n,o,s,e[a+9],5,568446438),n,o,e[a+14],9,-1019803690),i,n,e[a+3],14,-187363961),s,i,e[a+8],20,1163531501),o=p(o,s=p(s,i=p(i,n,o,s,e[a+13],5,-1444681467),n,o,e[a+2],9,-51403784),i,n,e[a+7],14,1735328473),s,i,e[a+12],20,-1926607734),o=h(o,s=h(s,i=h(i,n,o,s,e[a+5],4,-378558),n,o,e[a+8],11,-2022574463),i,n,e[a+11],16,1839030562),s,i,e[a+14],23,-35309556),o=h(o,s=h(s,i=h(i,n,o,s,e[a+1],4,-1530992060),n,o,e[a+4],11,1272893353),i,n,e[a+7],16,-155497632),s,i,e[a+10],23,-1094730640),o=h(o,s=h(s,i=h(i,n,o,s,e[a+13],4,681279174),n,o,e[a+0],11,-358537222),i,n,e[a+3],16,-722521979),s,i,e[a+6],23,76029189),o=h(o,s=h(s,i=h(i,n,o,s,e[a+9],4,-640364487),n,o,e[a+12],11,-421815835),i,n,e[a+15],16,530742520),s,i,e[a+2],23,-995338651),o=f(o,s=f(s,i=f(i,n,o,s,e[a+0],6,-198630844),n,o,e[a+7],10,1126891415),i,n,e[a+14],15,-1416354905),s,i,e[a+5],21,-57434055),o=f(o,s=f(s,i=f(i,n,o,s,e[a+12],6,1700485571),n,o,e[a+3],10,-1894986606),i,n,e[a+10],15,-1051523),s,i,e[a+1],21,-2054922799),o=f(o,s=f(s,i=f(i,n,o,s,e[a+8],6,1873313359),n,o,e[a+15],10,-30611744),i,n,e[a+6],15,-1560198380),s,i,e[a+13],21,1309151649),o=f(o,s=f(s,i=f(i,n,o,s,e[a+4],6,-145523070),n,o,e[a+11],10,-1120210379),i,n,e[a+2],15,718787259),s,i,e[a+9],21,-343485551),i=m(i,r),n=m(n,l),o=m(o,d),s=m(s,u)}return Array(i,n,o,s)}function l(e,t,i,n,o,s){return m(function(e,t){return e<<t|e>>>32-t}(m(m(t,e),m(n,s)),o),i)}function c(e,t,i,n,o,s,a){return l(t&i|~t&n,e,t,o,s,a)}function p(e,t,i,n,o,s,a){return l(t&n|i&~n,e,t,o,s,a)}function h(e,t,i,n,o,s,a){return l(t^i^n,e,t,o,s,a)}function f(e,t,i,n,o,s,a){return l(i^(t|~n),e,t,o,s,a)}function m(e,t){var i=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(i>>16)<<16|65535&i}return function(e){return i(t(n(e)))}(e)},transition:function(e,t,i,n){var o=m(e).width(),s=m(e).height();if(!e||!t)return void console.log("ERROR: Cannot do transition when one of the divs is null");switch(e.parentNode.style.cssText+="perspective: 900px; overflow: hidden;",e.style.cssText+="; position: absolute; z-index: 1019; backface-visibility: hidden",t.style.cssText+="; position: absolute; z-index: 1020; backface-visibility: hidden",i){case"slide-left":e.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",t.style.cssText+="overflow: hidden; transform: translate3d("+o+"px, 0, 0)",m(t).show(),window.setTimeout(function(){t.style.cssText+="transition: 0.5s; transform: translate3d(0, 0, 0)",e.style.cssText+="transition: 0.5s; transform: translate3d(-"+o+"px, 0, 0)"},1);break;case"slide-right":e.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",t.style.cssText+="overflow: hidden; transform: translate3d(-"+o+"px, 0, 0)",m(t).show(),window.setTimeout(function(){t.style.cssText+="transition: 0.5s; transform: translate3d(0px, 0, 0)",e.style.cssText+="transition: 0.5s; transform: translate3d("+o+"px, 0, 0)"},1);break;case"slide-down":e.style.cssText+="overflow: hidden; z-index: 1; transform: translate3d(0, 0, 0)",t.style.cssText+="overflow: hidden; z-index: 0; transform: translate3d(0, 0, 0)",m(t).show(),window.setTimeout(function(){t.style.cssText+="transition: 0.5s; transform: translate3d(0, 0, 0)",e.style.cssText+="transition: 0.5s; transform: translate3d(0, "+s+"px, 0)"},1);break;case"slide-up":e.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",t.style.cssText+="overflow: hidden; transform: translate3d(0, "+s+"px, 0)",m(t).show(),window.setTimeout(function(){t.style.cssText+="transition: 0.5s; transform: translate3d(0, 0, 0)",e.style.cssText+="transition: 0.5s; transform: translate3d(0, 0, 0)"},1);break;case"flip-left":e.style.cssText+="overflow: hidden; transform: rotateY(0deg)",t.style.cssText+="overflow: hidden; transform: rotateY(-180deg)",m(t).show(),window.setTimeout(function(){t.style.cssText+="transition: 0.5s; transform: rotateY(0deg)",e.style.cssText+="transition: 0.5s; transform: rotateY(180deg)"},1);break;case"flip-right":e.style.cssText+="overflow: hidden; transform: rotateY(0deg)",t.style.cssText+="overflow: hidden; transform: rotateY(180deg)",m(t).show(),window.setTimeout(function(){t.style.cssText+="transition: 0.5s; transform: rotateY(0deg)",e.style.cssText+="transition: 0.5s; transform: rotateY(-180deg)"},1);break;case"flip-down":e.style.cssText+="overflow: hidden; transform: rotateX(0deg)",t.style.cssText+="overflow: hidden; transform: rotateX(180deg)",m(t).show(),window.setTimeout(function(){t.style.cssText+="transition: 0.5s; transform: rotateX(0deg)",e.style.cssText+="transition: 0.5s; transform: rotateX(-180deg)"},1);break;case"flip-up":e.style.cssText+="overflow: hidden; transform: rotateX(0deg)",t.style.cssText+="overflow: hidden; transform: rotateX(-180deg)",m(t).show(),window.setTimeout(function(){t.style.cssText+="transition: 0.5s; transform: rotateX(0deg)",e.style.cssText+="transition: 0.5s; transform: rotateX(180deg)"},1);break;case"pop-in":e.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",t.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0); transform: scale(.8); opacity: 0;",m(t).show(),window.setTimeout(function(){t.style.cssText+="transition: 0.5s; transform: scale(1); opacity: 1;",e.style.cssText+="transition: 0.5s;"},1);break;case"pop-out":e.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0); transform: scale(1); opacity: 1;",t.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0); opacity: 0;",m(t).show(),window.setTimeout(function(){t.style.cssText+="transition: 0.5s; opacity: 1;",e.style.cssText+="transition: 0.5s; transform: scale(1.7); opacity: 0;"},1);break;default:e.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",t.style.cssText+="overflow: hidden; translate3d(0, 0, 0); opacity: 0;",m(t).show(),window.setTimeout(function(){t.style.cssText+="transition: 0.5s; opacity: 1;",e.style.cssText+="transition: 0.5s"},1)}setTimeout(function(){"slide-down"===i&&(m(e).css("z-index","1019"),m(t).css("z-index","1020")),t&&m(t).css({opacity:"1"}).css(w2utils.cssPrefix({transition:"",transform:""})),e&&m(e).css({opacity:"1"}).css(w2utils.cssPrefix({transition:"",transform:""})),"function"==typeof n&&n()},500)},lock:function(e,t,i){var n={};"object"==typeof t?n=t:(n.msg=t,n.spinner=i);n.msg||0===n.msg||(n.msg="");w2utils.unlock(e),m(e).prepend('<div class="w2ui-lock"></div><div class="w2ui-lock-msg"></div>');var o=m(e).find(".w2ui-lock"),s=m(e).find(".w2ui-lock-msg");n.msg||s.css({"background-color":"transparent",border:"0px"});!0===n.spinner&&(n.msg='<div class="w2ui-spinner" '+(n.msg?"":'style="width: 35px; height: 35px"')+"></div>"+n.msg);null!=n.opacity&&o.css("opacity",n.opacity);"function"==typeof o.fadeIn?(o.fadeIn(200),s.html(n.msg).fadeIn(200)):(o.show(),s.html(n.msg).show(0))},unlock:function(e,t){p(t)?(m(e).find(".w2ui-lock").fadeOut(t),setTimeout(function(){m(e).find(".w2ui-lock").remove(),m(e).find(".w2ui-lock-msg").remove()},t)):(m(e).find(".w2ui-lock").remove(),m(e).find(".w2ui-lock-msg").remove())},message:function(n,e){var t,o,s=this;m().w2tag(),e=e||{width:200,height:100};null==e.on&&m.extend(e,w2utils.event);null==e.width&&(e.width=200);null==e.height&&(e.height=100);var i=parseInt(m(n.box).width()),a=parseInt(m(n.box).height()),r=parseInt(m(n.box).find(n.title).css("height")||0);e.width>i&&(e.width=i-10);e.height>a-r&&(e.height=a-10-r);e.originalWidth=e.width,e.originalHeight=e.height,parseInt(e.width)<0&&(e.width=i+e.width);parseInt(e.width)<10&&(e.width=10);parseInt(e.height)<0&&(e.height=a+e.height-r);parseInt(e.height)<10&&(e.height=10);null==e.hideOnClick&&(e.hideOnClick=!1);var l=m(n.box).data("options")||{};(null==e.width||e.width>l.width-10)&&(e.width=l.width-10);(null==e.height||e.height>l.height-r-5)&&(e.height=l.height-r-5);e.originalHeight<0&&(e.height=a+e.originalHeight-r);e.originalWidth<0&&(e.width=i+2*e.originalWidth);var d=m(n.box).find(n.title),u=m(n.box).find(".w2ui-message.w2ui-closing");0<m(n.box).find(".w2ui-message.w2ui-closing").length&&(clearTimeout(t),f(u,u.data("options")||{}));var c=m(n.box).find(".w2ui-message").length;if(""===m.trim(e.html)&&""===m.trim(e.body)&&""===m.trim(e.buttons)){if(0===c)return;var p=m(n.box).find("#w2ui-message"+(c-1));e=p.data("options")||{};if(!0===(o=e.trigger({phase:"before",type:"close",target:"self"})).isCancelled)return;p.css(w2utils.cssPrefix({transition:"0.15s",transform:"translateY(-"+e.height+"px)"})).addClass("w2ui-closing"),1===c?this.unlock&&(n.param?this.unlock(n.param,150):this.unlock(150)):m(n.box).find("#w2ui-message"+(c-2)).css("z-index",1500),t=setTimeout(function(){f(p,e)},150)}else{""===m.trim(e.body)&&""===m.trim(e.buttons)||(e.html='<div class="w2ui-message-body">'+(e.body||"")+'</div><div class="w2ui-message-buttons">'+(e.buttons||"")+"</div>"),m(n.box).find(".w2ui-message").css("z-index",1390),d.data("old-z-index",d.css("z-index")),d.css("z-index",1501),m(n.box).find(n.body).before('<div id="w2ui-message'+c+'" onmousedown="event.stopPropagation();" class="w2ui-message" style="display: none; z-index: 1500; '+(0===d.length?"top: 0px;":"top: "+w2utils.getSize(d,"height")+"px;")+(null!=e.width?"width: "+e.width+"px; left: "+(i-e.width)/2+"px;":"left: 10px; right: 10px;")+(null!=e.height?"height: "+e.height+"px;":"bottom: 6px;")+w2utils.cssPrefix("transition",".3s",!0)+'"'+(!0===e.hideOnClick?n.param?'onclick="'+n.path+".message('"+n.param+"');\"":'onclick="'+n.path+'.message();"':"")+"></div>"),m(n.box).find("#w2ui-message"+c).data("options",e).data("prev_focus",m(":focus"));var h=m(n.box).find("#w2ui-message"+c).css("display");if(m(n.box).find("#w2ui-message"+c).css(w2utils.cssPrefix({transform:"none"===h?"translateY(-"+e.height+"px)":"translateY(0px)"})),"none"===h){if(m(n.box).find("#w2ui-message"+c).show().html(e.html),e.box=m(n.box).find("#w2ui-message"+c),!0===(o=e.trigger({phase:"before",type:"open",target:"self"})).isCancelled)return d.css("z-index",d.data("old-z-index")),void m(n.box).find("#w2ui-message"+c).remove();setTimeout(function(){m(n.box).find("#w2ui-message"+c).css(w2utils.cssPrefix({transform:"none"===h?"translateY(0px)":"translateY(-"+e.height+"px)"}))},1),0===c&&this.lock&&(n.param?this.lock(n.param):this.lock()),setTimeout(function(){m(n.box).find("#w2ui-message"+c).css(w2utils.cssPrefix({transition:"0s"})),e.trigger(m.extend(o,{phase:"after"}))},350)}}function f(e,t){if(null==o&&!0===(o=t.trigger({phase:"before",type:"open",target:"self"})).isCancelled)return d.css("z-index",d.data("old-z-index")),void m(n.box).find("#w2ui-message"+c).remove();var i=e.data("prev_focus");e.remove(),i&&0<i.length?i.focus():s&&s.focus&&s.focus(),d.css("z-index",d.data("old-z-index")),t.trigger(m.extend(o,{phase:"after"}))}},naturalCompare:function(e,t){var n,i,o=1,s=0,a=0,r=String.alphabet;function l(e,t,i){if(i){for(n=t;(i=l(e,n))<76&&65<i;)++n;return+e.slice(t-1,n)}return-1<(i=r&&r.indexOf(e.charAt(t)))?i+76:(i=e.charCodeAt(t)||0)<45||127<i?i:i<46?65:i<48?i-1:i<58?i+18:i<65?i-11:i<91?i+11:i<97?i-37:i<123?i+5:i-63}if((e+="")!=(t+=""))for(;o;)if(i=l(e,s++),o=l(t,a++),i<76&&o<76&&66<i&&66<o&&(i=l(e,s,s),o=l(t,a,s=n),a=n),i!=o)return i<o?-1:1;return 0},lang:function(e){var t=this.settings.phrases[e];return null==t?e:t},locale:function(n,o){n=n||"en-us";if("string"!=typeof n)return void(w2utils.settings=m.extend(!0,w2utils.settings,n));5===n.length&&(n="locale/"+n+".json");w2utils.settings.phrases={},m.ajax({url:n,type:"GET",dataType:"JSON",success:function(e,t,i){w2utils.settings=m.extend(!0,w2utils.settings,e),"function"==typeof o&&o()},error:function(e,t,i){console.log("ERROR: Cannot load locale "+n)}})},getSize:function(e,t){var i=m(e),n={left:parseInt(i.css("border-left-width"))||0,right:parseInt(i.css("border-right-width"))||0,top:parseInt(i.css("border-top-width"))||0,bottom:parseInt(i.css("border-bottom-width"))||0},o={left:parseInt(i.css("margin-left"))||0,right:parseInt(i.css("margin-right"))||0,top:parseInt(i.css("margin-top"))||0,bottom:parseInt(i.css("margin-bottom"))||0},s={left:parseInt(i.css("padding-left"))||0,right:parseInt(i.css("padding-right"))||0,top:parseInt(i.css("padding-top"))||0,bottom:parseInt(i.css("padding-bottom"))||0};switch(t){case"top":return n.top+o.top+s.top;case"bottom":return n.bottom+o.bottom+s.bottom;case"left":return n.left+o.left+s.left;case"right":return n.right+o.right+s.right;case"width":return n.left+n.right+o.left+o.right+s.left+s.right+parseInt(i.width());case"height":return n.top+n.bottom+o.top+o.bottom+s.top+s.bottom+parseInt(i.height());case"+width":return n.left+n.right+o.left+o.right+s.left+s.right;case"+height":return n.top+n.bottom+o.top+o.bottom+s.top+s.bottom}return 0},getStrWidth:function(e,t){var i,n='<div id="_tmp_width" style="position: absolute; top: -900px;'+(t||"")+'">'+o(e)+"</div>";return m("body").append(n),i=m("#_tmp_width").width(),m("#_tmp_width").remove(),i},scrollBarSize:function(){if(e.scrollBarSize)return e.scrollBarSize;m("body").append('<div id="_scrollbar_width" style="position: absolute; top: -300px; width: 100px; height: 100px; overflow-y: scroll;"> <div style="height: 120px">1</div></div>'),e.scrollBarSize=100-m("#_scrollbar_width > div").width(),m("#_scrollbar_width").remove(),0<=String(navigator.userAgent).indexOf("MSIE")&&(e.scrollBarSize=e.scrollBarSize/2);return e.scrollBarSize},checkName:function(e,t){return e&&null!=e.name?null==w2ui[e.name]?!!w2utils.isAlphaNumeric(e.name)||(console.log('ERROR: The parameter "name" has to be alpha-numeric (a-z, 0-9, dash and underscore). '),!1):(console.log('ERROR: The parameter "name" is not unique. There are other objects already created with the same name (obj: '+e.name+")."),!1):(console.log('ERROR: The parameter "name" is required but not supplied in $().'+t+"()."),!1)},checkUniqueId:function(e,t,i,n){m.isArray(t)||(t=[t]);for(var o=0;o<t.length;o++)if(t[o].id===e)return console.log('ERROR: The parameter "id='+e+'" is not unique within the current '+i+". (obj: "+n+")"),!1;return!0},parseRoute:function(e){var a=[],t=e.replace(/\/\(/g,"(?:/").replace(/\+/g,"__plus__").replace(/(\/)?(\.)?:(\w+)(?:(\(.*?\)))?(\?)?/g,function(e,t,i,n,o,s){return a.push({name:n,optional:!!s}),t=t||"",(s?"":t)+"(?:"+(s?t:"")+(i||"")+(o||(i?"([^/.]+?)":"([^/]+?)"))+")"+(s||"")}).replace(/([\/.])/g,"\\$1").replace(/__plus__/g,"(.+)").replace(/\*/g,"(.*)");return{path:new RegExp("^"+t+"$","i"),keys:a}},cssPrefix:function(e,t,i){var n={},o={},s="";m.isPlainObject(e)?(n=e,!0===t&&(i=!0)):n[e]=t;for(var a in n)o[a]=n[a],o["-webkit-"+a]=n[a],o["-moz-"+a]=n[a].replace("-webkit-","-moz-"),o["-ms-"+a]=n[a].replace("-webkit-","-ms-"),o["-o-"+a]=n[a].replace("-webkit-","-o-");if(!0===i)for(var a in o)s+=a+": "+o[a]+"; ";else s=o;return s},parseColor:function(e){{if("string"!=typeof e)return null;e=e.trim().toUpperCase()}"#"===e[0]&&(e=e.substr(1));var t={};if(3===e.length)t={r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:1};else if(6===e.length)t={r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:1};else if(8===e.length)t={r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:parseInt(e.substr(6,2),16)};else if(4<e.length&&"RGB("===e.substr(0,4)){var i=e.replace("RGB","").replace(/\(/g,"").replace(/\)/g,"").split(",");t={r:parseInt(i[0],10),g:parseInt(i[1],10),b:parseInt(i[2],10),a:1}}else{if(!(5<e.length&&"RGBA("===e.substr(0,5)))return null;i=e.replace("RGBA","").replace(/\(/g,"").replace(/\)/g,"").split(",");t={r:parseInt(i[0],10),g:parseInt(i[1],10),b:parseInt(i[2],10),a:parseFloat(i[3])}}return t},hsv2rgb:function(e,t,i,n){var o,s,a,r,l,d,u,c;1===arguments.length&&(t=e.s,i=e.v,n=e.a,e=e.h);switch(e/=360,t/=100,i/=100,r=Math.floor(6*e),d=i*(1-t),u=i*(1-(l=6*e-r)*t),c=i*(1-(1-l)*t),r%6){case 0:o=i,s=c,a=d;break;case 1:o=u,s=i,a=d;break;case 2:o=d,s=i,a=c;break;case 3:o=d,s=u,a=i;break;case 4:o=c,s=d,a=i;break;case 5:o=i,s=d,a=u}return{r:Math.round(255*o),g:Math.round(255*s),b:Math.round(255*a),a:null!=n?n:1}},rgb2hsv:function(e,t,i,n){1===arguments.length&&(t=e.g,i=e.b,n=e.a,e=e.r);var o,s=Math.max(e,t,i),a=Math.min(e,t,i),r=s-a,l=0===s?0:r/s,d=s/255;switch(s){case a:o=0;break;case e:o=t-i+r*(t<i?6:0),o/=6*r;break;case t:o=i-e+2*r,o/=6*r;break;case i:o=e-t+4*r,o/=6*r}return{h:Math.round(360*o),s:Math.round(100*l),v:Math.round(100*d),a:null!=n?n:1}},tooltip:function(e,t){var i="mouseenter",n="mouseleave";(t=t||{}).showOn&&(i=t.showOn,delete t.showOn);t.hideOn&&(n=t.hideOn,delete t.hideOn);return"on"+i+"=\"$(this).w2tag(w2utils.base64decode('"+w2utils.base64encode(e)+"'),JSON.parse(w2utils.base64decode('"+w2utils.base64encode(JSON.stringify(t))+"')))\"on"+n+'="$(this).w2tag()"'},getCursorPosition:function(e){if(null==e)return null;var t,i=0,n=e.ownerDocument||e.document,o=n.defaultView||n.parentWindow;if(e.tagName&&"INPUT"===e.tagName.toUpperCase()&&e.selectionStart)i=e.selectionStart;else if(o.getSelection){if(0<(t=o.getSelection()).rangeCount){var s=t.getRangeAt(0),a=s.cloneRange();a.selectNodeContents(e),a.setEnd(s.endContainer,s.endOffset),i=a.toString().length}}else if((t=n.selection)&&"Control"!==t.type){var r=t.createRange(),l=n.body.createTextRange();l.moveToElementText(e),l.setEndPoint("EndToEnd",r),i=l.text.length}return i},setCursorPosition:function(e,t,i){var n,o=document.createRange(),s=window.getSelection();if(null==e)return;for(var a=0;a<e.childNodes.length;a++){var r=m(e.childNodes[a]).text();if(e.childNodes[a].tagName&&(r=(r=m(e.childNodes[a]).html()).replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&nbsp;/g," ")),t<=r.length){(n=e.childNodes[a]).childNodes&&0<n.childNodes.length&&(n=n.childNodes[0]),n.childNodes&&0<n.childNodes.length&&(n=n.childNodes[0]);break}t-=r.length}if(null==n)return;t>n.length&&(t=n.length);o.setStart(n,t),i?o.setEnd(n,i):o.collapse(!0);s.removeAllRanges(),s.addRange(o)},testLocalStorage:t,hasLocalStorage:t(),isIOS:-1!==navigator.userAgent.toLowerCase().indexOf("iphone")||-1!==navigator.userAgent.toLowerCase().indexOf("ipod")||-1!==navigator.userAgent.toLowerCase().indexOf("ipad")||-1!==navigator.userAgent.toLowerCase().indexOf("mobile")||-1!==navigator.userAgent.toLowerCase().indexOf("android"),isIE:-1!==navigator.userAgent.toLowerCase().indexOf("msie")||-1!==navigator.userAgent.toLowerCase().indexOf("trident")};function p(e){return/^[-+]?[0-9]+$/.test(e)}function o(e){if(null==e)return e;switch(typeof e){case"number":break;case"string":e=String(e).replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;");break;case"object":if(Array.isArray(e)){e=m.extend(!0,[],e);for(var t=0;t<e.length;t++)e[t]=this.encodeTags(e[t])}else for(var t in e=m.extend(!0,{},e))e[t]=this.encodeTags(e[t])}return e}function t(){var e="w2ui_test";try{return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(e){return!1}}}(jQuery);w2utils.formatters={number:function(e,t){return 20<parseInt(t)&&(t=20),parseInt(t)<0&&(t=0),null==e||""===e?"":w2utils.formatNumber(parseFloat(e),t,!0)},float:function(e,t){return w2utils.formatters.number(e,t)},int:function(e,t){return w2utils.formatters.number(e,0)},money:function(e,t){if(null==e||""===e)return"";var i=w2utils.formatNumber(Number(e),w2utils.settings.currencyPrecision||2);return(w2utils.settings.currencyPrefix||"")+i+(w2utils.settings.currencySuffix||"")},currency:function(e,t){return w2utils.formatters.money(e,t)},percent:function(e,t){return null==e||""===e?"":w2utils.formatNumber(e,t||1)+"%"},size:function(e,t){return null==e||""===e?"":w2utils.formatSize(parseInt(e))},date:function(e,t){if(""===t&&(t=w2utils.settings.dateFormat),null==e||0===e||""===e)return"";var i=w2utils.isDateTime(e,t,!0);return!1===i&&(i=w2utils.isDate(e,t,!0)),'<span title="'+i+'">'+w2utils.formatDate(i,t)+"</span>"},datetime:function(e,t){if(""===t&&(t=w2utils.settings.datetimeFormat),null==e||0===e||""===e)return"";var i=w2utils.isDateTime(e,t,!0);return!1===i&&(i=w2utils.isDate(e,t,!0)),'<span title="'+i+'">'+w2utils.formatDateTime(i,t)+"</span>"},time:function(e,t){if(""===t&&(t=w2utils.settings.timeFormat),"h12"===t&&(t="hh:mi pm"),"h24"===t&&(t="h24:mi"),null==e||0===e||""===e)return"";var i=w2utils.isDateTime(e,t,!0);return!1===i&&(i=w2utils.isDate(e,t,!0)),'<span title="'+i+'">'+w2utils.formatTime(e,t)+"</span>"},timestamp:function(e,t){if(""===t&&(t=w2utils.settings.datetimeFormat),null==e||0===e||""===e)return"";var i=w2utils.isDateTime(e,t,!0);return!1===i&&(i=w2utils.isDate(e,t,!0)),i.toString?i.toString():""},gmt:function(e,t){if(""===t&&(t=w2utils.settings.datetimeFormat),null==e||0===e||""===e)return"";var i=w2utils.isDateTime(e,t,!0);return!1===i&&(i=w2utils.isDate(e,t,!0)),i.toUTCString?i.toUTCString():""},age:function(e,t){if(null==e||0===e||""===e)return"";var i=w2utils.isDateTime(e,null,!0);return!1===i&&(i=w2utils.isDate(e,null,!0)),'<span title="'+i+'">'+w2utils.age(e)+(t?" "+t:"")+"</span>"},interval:function(e,t){return null==e||0===e||""===e?"":w2utils.interval(e)+(t?" "+t:"")},toggle:function(e,t){return e?"Yes":""},password:function(e,t){for(var i="",n=0;n<e.length;n++)i+="*";return i}},w2utils.event={on:function(e,t){var i,n=jQuery;"string"==typeof e&&-1!==e.indexOf(".")&&(e=(o=e.split("."))[0],i=o[1]);if("string"==typeof e&&-1!==e.indexOf(":")){var o=e.split(":");-1!==["complete","done"].indexOf(e[1])&&(e[1]="after"),e={type:o[0],execute:o[1]}}n.isPlainObject(e)||(e={type:e,scope:i}),(e=n.extend({type:null,execute:"before",target:null,onComplete:null},e)).type?t?(n.isArray(this.handlers)||(this.handlers=[]),this.handlers.push({edata:e,handler:t})):console.log("ERROR: You must specify event handler function when calling .on() method of "+this.name):console.log("ERROR: You must specify event type when calling .on() method of "+this.name)},off:function(e,t){var i,n=jQuery;"string"==typeof e&&-1!==e.indexOf(".")&&(e=(o=e.split("."))[0],i=o[1],""===e&&(e="*"));if("string"==typeof e&&-1!==e.indexOf(":")){var o=e.split(":");-1!==["complete","done"].indexOf(e[1])&&(e[1]="after"),e={type:o[0],execute:o[1]}}if(n.isPlainObject(e)||(e={type:e}),(e=n.extend({},{type:null,execute:null,target:null,onComplete:null},e)).type||i){t=t||null;for(var s=[],a=0,r=this.handlers.length;a<r;a++){var l=this.handlers[a];(l.edata.type!==e.type&&"*"!==e.type&&(null==l.edata.scope||""!=e.type)||l.edata.target!==e.target&&null!=e.target||l.edata.execute!==e.execute&&null!=e.execute||!(l.handler===t&&null!=t||null!=i&&l.edata.scope==i))&&s.push(l)}this.handlers=s}else console.log("ERROR: You must specify event type when calling .off() method of "+this.name)},trigger:function(e){var t,i,n,o=jQuery;"before"===(e=o.extend({type:null,phase:"before",target:null,doneHandlers:[]},e,{isStopped:!1,isCancelled:!1,done:function(e){this.doneHandlers.push(e)},preventDefault:function(){this.isCancelled=!0},stopPropagation:function(){this.isStopped=!0}})).phase&&(e.onComplete=null),null==e.target&&(e.target=null),o.isArray(this.handlers)||(this.handlers=[]);for(var s=this.handlers.length-1;0<=s;s--){var a=this.handlers[s];if(!(null==a||a.edata.type!==e.type&&"*"!==a.edata.type||a.edata.target!==e.target&&null!=a.edata.target||a.edata.execute!==e.phase&&"*"!==a.edata.execute&&"*"!==a.edata.phase)&&(e=o.extend({},a.edata,e),t=[],(n=new RegExp(/\((.*?)\)/).exec(a.handler))&&(t=n[1].split(/\s*,\s*/)),2===t.length?a.handler.call(this,e.target,e):a.handler.call(this,e),!0===e.isStopped||!0===e.stop))return e}var r="on"+e.type.substr(0,1).toUpperCase()+e.type.substr(1);if("before"===e.phase&&"function"==typeof this[r]&&(i=this[r],t=[],(n=new RegExp(/\((.*?)\)/).exec(i))&&(t=n[1].split(/\s*,\s*/)),2===t.length?i.call(this,e.target,e):i.call(this,e),!0===e.isStopped||!0===e.stop))return e;if(null!=e.object&&"before"===e.phase&&"function"==typeof e.object[r]&&(i=e.object[r],t=[],(n=new RegExp(/\((.*?)\)/).exec(i))&&(t=n[1].split(/\s*,\s*/)),2===t.length?i.call(this,e.target,e):i.call(this,e),!0===e.isStopped||!0===e.stop))return e;if("after"===e.phase){"function"==typeof e.onComplete&&e.onComplete.call(this,e);for(var l=0;l<e.doneHandlers.length;l++)"function"==typeof e.doneHandlers[l]&&e.doneHandlers[l].call(this,e)}return e}},function(k){k.fn.w2render=function(e){0<k(this).length&&("string"==typeof e&&w2ui[e]&&w2ui[e].render(k(this)[0]),"object"==typeof e&&e.render(k(this)[0]))},k.fn.w2destroy=function(e){!e&&0<this.length&&(e=this.attr("name")),"string"==typeof e&&w2ui[e]&&w2ui[e].destroy(),"object"==typeof e&&e.destroy()},k.fn.w2marker=function(){var a=Array.prototype.slice.call(arguments,0);return Array.isArray(a[0])&&(a=a[0]),0!==a.length&&a[0]?k(this).each(function(e,t){r(e,t);for(var i=0;i<a.length;i++){var n=a[i];"string"!=typeof n&&(n=String(n)),n=n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&").replace(/&/g,"&amp;").replace(/</g,"&gt;").replace(/>/g,"&lt;");var o=new RegExp(n+"(?!([^<]+)?>)","gi");t.innerHTML=t.innerHTML.replace(o,s)}function s(e){return'<span class="w2ui-marker">'+e+"</span>"}}):k(this).each(r);function r(e,t){for(;-1!==t.innerHTML.indexOf('<span class="w2ui-marker">');)t.innerHTML=t.innerHTML.replace(/\<span class=\"w2ui\-marker\"\>((.|\n|\r)*)\<\/span\>/gi,"$1")}},k.fn.w2tag=function(l,d){if(1===arguments.length&&"object"==typeof l&&null!=(d=l).html&&(l=d.html),null!=(d=k.extend({id:null,auto:null,html:l,position:"right|top",align:"none",left:0,top:0,maxWidth:null,style:"",css:{},className:"",inputClass:"",onShow:null,onHide:null,hideOnKeyPress:!0,hideOnFocus:!1,hideOnBlur:!1,hideOnClick:!1,hideOnChange:!0},d)).name&&null==d.id&&(d.id=d.name),""!==d.class&&""===d.inputClass&&(d.inputClass=d.class),0!==k(this).length)return!0===d.auto||null!=d.showOn||null!=d.hideOn?0!=arguments.length&&l?k(this).each(function(e,t){var i="mouseenter",n="mouseleave";d.showOn&&(i=String(d.showOn).toLowerCase(),delete d.showOn),d.hideOn&&(n=String(d.hideOn).toLowerCase(),delete d.hideOn),d.potision||(d.position="top|bottom"),k(t).off(".w2tooltip").on(i+".w2tooltip",function(){d.auto=!1,k(this).w2tag(l,d)}).on(n+".w2tooltip",function(){k(this).w2tag()})}):k(this).each(function(e,t){k(t).off(".w2tooltip")}):k(this).each(function(e,t){var c,i=d.id?d.id:t.id;""==i&&(i=k(t).find("input").attr("id")),i=i||"noid";var n=w2utils.escapeId(i);if(null!=k(this).data("w2tag")?(c=k(this).data("w2tag"),k.extend(c.options,d)):c={id:i,attachedTo:t,box:k("#w2ui-tag-"+n),options:k.extend({},d),init:s,hide:function(){if(c.box.length<=0)return;c.tmp.timer&&clearTimeout(c.tmp.timer);c.box.remove(),c.options.hideOnClick&&k("body").off(".w2tag"+(c.id||""));k(c.attachedTo).off(".w2tag").removeClass(c.options.inputClass).removeData("w2tag"),0<k(c.attachedTo).length&&(k(c.attachedTo)[0].style.cssText=c.tmp.originalCSS);"function"==typeof c.options.onHide&&c.options.onHide()},getPos:r,isMoved:a,tmp:{}},""===l||null==l)c.hide();else if(0!==c.box.length)c.box.find(".w2ui-tag-body").css(c.options.css).attr("style",c.options.style).addClass(c.options.className).html(c.options.html);else{c.tmp.originalCSS="",0<k(c.attachedTo).length&&(c.tmp.originalCSS=k(c.attachedTo)[0].style.cssText);var o="white-space: nowrap;";c.options.maxWidth&&w2utils.getStrWidth(l)>c.options.maxWidth&&(o="width: "+c.options.maxWidth+"px"),k("body").append('<div onclick="event.stopPropagation()" style="display: none;" id="w2ui-tag-'+c.id+'" class="w2ui-tag '+(0<k(c.attachedTo).parents(".w2ui-popup, .w2ui-overlay-popup, .w2ui-message").length?"w2ui-tag-popup":"")+'"> <div style="margin: -2px 0px 0px -2px; '+o+'"> <div class="w2ui-tag-body '+c.options.className+'" style="'+(c.options.style||"")+'">'+l+"</div> </div></div>"),c.box=k("#w2ui-tag-"+n),k(c.attachedTo).data("w2tag",c),setTimeout(s,1)}return;function s(){if(c.box.css("display","block"),c&&c.box&&k(c.attachedTo).offset()){var e=c.getPos();c.box.css({opacity:"1",left:e.left+"px",top:e.top+"px"}).data("w2tag",c).find(".w2ui-tag-body").addClass(e.posClass),c.tmp.pos=e.left+"x"+e.top,k(c.attachedTo).off(".w2tag").css(c.options.css).addClass(c.options.inputClass),c.options.hideOnKeyPress&&k(c.attachedTo).on("keypress.w2tag",c.hide),c.options.hideOnFocus&&k(c.attachedTo).on("focus.w2tag",c.hide),d.hideOnChange&&("INPUT"===t.nodeName?k(t).on("change.w2tag",c.hide):k(t).find("input").on("change.w2tag",c.hide)),c.options.hideOnBlur&&k(c.attachedTo).on("blur.w2tag",c.hide),c.options.hideOnClick&&k("body").on("click.w2tag"+(c.id||""),c.hide),"function"==typeof c.options.onShow&&c.options.onShow(),a()}}function a(e){var t=k(c.attachedTo).offset();if(0===k(c.attachedTo).length||0===t.left&&0===t.top||0===c.box.find(".w2ui-tag-body").length)c.hide();else{var i=r();c.tmp.pos!==i.left+"x"+i.top&&(c.box.css(w2utils.cssPrefix({transition:e?"0s":".2s"})).css({left:i.left+"px",top:i.top+"px"}),c.tmp.pos=i.left+"x"+i.top),c.tmp.timer&&clearTimeout(c.tmp.timer),c.tmp.timer=setTimeout(a,100)}}function r(){var e=k(c.attachedTo).offset(),t="w2ui-tag-right",i=parseInt(e.left+c.attachedTo.offsetWidth+(c.options.left?c.options.left:0)),n=parseInt(e.top+(c.options.top?c.options.top:0)),o=c.box.find(".w2ui-tag-body"),s=o[0].offsetWidth,a=o[0].offsetHeight;if("string"==typeof c.options.position&&-1!==c.options.position.indexOf("|")&&(c.options.position=c.options.position.split("|")),"top"===c.options.position)t="w2ui-tag-top",i=parseInt(e.left+(c.options.left?c.options.left:0))-14,n=parseInt(e.top+(c.options.top?c.options.top:0))-a-10;else if("bottom"===c.options.position)t="w2ui-tag-bottom",i=parseInt(e.left+(c.options.left?c.options.left:0))-14,n=parseInt(e.top+c.attachedTo.offsetHeight+(c.options.top?c.options.top:0))+10;else if("left"===c.options.position)t="w2ui-tag-left",i=parseInt(e.left+(c.options.left?c.options.left:0))-s-20,n=parseInt(e.top+(c.options.top?c.options.top:0));else if(Array.isArray(c.options.position)){for(var r=window.innerWidth,l=window.innerHeight,d=0;d<c.options.position.length;d++){var u=c.options.position[d];if("right"===u){if(t="w2ui-tag-right",i=parseInt(e.left+c.attachedTo.offsetWidth+(c.options.left?c.options.left:0)),n=parseInt(e.top+(c.options.top?c.options.top:0)),i+s<=r)break}else if("left"===u){if(t="w2ui-tag-left",i=parseInt(e.left+(c.options.left?c.options.left:0))-s-20,n=parseInt(e.top+(c.options.top?c.options.top:0)),0<=i)break}else if("top"===u){if(t="w2ui-tag-top",i=parseInt(e.left+(c.options.left?c.options.left:0))-14,n=parseInt(e.top+(c.options.top?c.options.top:0))-a-10,i+s<=r&&0<=n)break}else if("bottom"===u&&(t="w2ui-tag-bottom",i=parseInt(e.left+(c.options.left?c.options.left:0))-14,n=parseInt(e.top+c.attachedTo.offsetHeight+(c.options.top?c.options.top:0))+10,i+s<=r&&n+a<=l))break}o.data("posClass")!==t&&o.removeClass("w2ui-tag-right w2ui-tag-left w2ui-tag-top w2ui-tag-bottom").addClass(t).data("posClass",t)}return{left:i,top:n,posClass:t}}});k(".w2ui-tag").each(function(e,t){var i=k(t).data("w2tag");i&&i.hide()})},k.fn.w2overlay=function(e,w){var t,y=this,x="";if(1===arguments.length&&(w="object"==typeof e?e:{html:e}),2===arguments.length&&(w.html=e),k.isPlainObject(w)||(w={}),(w=k.extend({},{name:null,html:"",align:"none",left:0,top:0,tipLeft:30,noTip:!1,selectable:!1,width:0,height:0,maxWidth:null,maxHeight:null,contextMenu:!1,pageX:null,pageY:null,originalEvent:null,style:"",class:"",overlayStyle:"",onShow:null,onHide:null,openAbove:!1,tmp:{}},w)).name&&(x="-"+w.name),0===this.length||""===w.html||null==w.html)return 0<k("#w2ui-overlay"+x).length?"function"==typeof(t=k("#w2ui-overlay"+x)[0].hide)&&t():k("#w2ui-overlay"+x).remove(),k(this);0<k("#w2ui-overlay"+x).length&&(t=k("#w2ui-overlay"+x)[0].hide,k(document).off(".w2overlay"+x),"function"==typeof t&&t()),0<y.length&&(null==y[0].tagName||"BODY"===y[0].tagName.toUpperCase())&&(w.contextMenu=!0),w.contextMenu&&w.originalEvent&&(w.pageX=w.originalEvent.pageX,w.pageY=w.originalEvent.pageY),!w.contextMenu||null!=w.pageX&&null!=w.pageY||console.log("ERROR: to display menu at mouse location, pass options.pageX and options.pageY."),k("body").append('<div id="w2ui-overlay'+x+'" style="display: none; left: 0px; top: 0px; '+w.overlayStyle+'" class="w2ui-reset w2ui-overlay '+(0<k(this).parents(".w2ui-popup, .w2ui-overlay-popup, .w2ui-message").length?"w2ui-overlay-popup":"")+'"> <style></style> <div style="min-width: 100%; '+w.style+'" class="'+w.class+'"></div></div>');var i=k("#w2ui-overlay"+x),n=i.find(" > div");n.html(w.html);var o=n.css("background-color");null!=o&&"rgba(0, 0, 0, 0)"!==o&&"transparent"!==o&&i.css({"background-color":o,"border-color":o});var s=k(y).offset()||{};return i.data("element",0<y.length?y[0]:null).data("options",w).data("position",s.left+"x"+s.top).fadeIn("fast").on("click",function(e){k("#w2ui-overlay"+x).data("keepOpen",!0),"LABEL"===e.target.tagName.toUpperCase()&&e.stopPropagation()}).on("mousedown",function(e){var t=e.target.tagName.toUpperCase();-1!==["INPUT","TEXTAREA","SELECT"].indexOf(t)||w.selectable||e.preventDefault()}),i[0].hide=a,i[0].resize=b,setTimeout(function(){k(document).off(".w2overlay"+x).on("click.w2overlay"+x,a),"function"==typeof w.onShow&&w.onShow(),b()},10),function e(){var t=k("#w2ui-overlay"+x);if(t.data("element")!==y[0])return;if(0===t.length)return;var i=k(y).offset()||{};var n=i.left+"x"+i.top;t.data("position")!==n?a():setTimeout(e,250)}(),k(this);function a(e){if(!e||0===e.button){var t,i=k("#w2ui-overlay"+x);if(!e||k(k(e.target).closest(".w2ui-overlay").data("element")).closest(".w2ui-overlay")[0]!==i[0])if(!0!==i.data("keepOpen"))"function"==typeof w.onHide&&(t=w.onHide()),!1!==t&&(i.remove(),k(document).off(".w2overlay"+x),clearInterval(i.data("timer")));else i.removeData("keepOpen")}}function b(){var e=k("#w2ui-overlay"+x),t=e.find(" > div"),i=k("#w2ui-overlay"+x+" div.w2ui-menu"),n={};if(0<i.length&&(i.css("overflow-y","hidden"),n.scrollTop=i.scrollTop(),n.scrollLeft=i.scrollLeft()),0<e.length){t.height("auto").width("auto");var o=!1,s=t.height(),a=t.width();w.width&&w.width<a&&(a=w.width),a<30&&(a=30),w.tmp.contentHeight&&(s=parseInt(w.tmp.contentHeight),t.height(s),setTimeout(function(){var e=t.find("div.w2ui-menu");s>e.height()&&t.find("div.w2ui-menu").css("overflow-y","hidden")},1),setTimeout(function(){var e=t.find("div.w2ui-menu");"auto"!==e.css("overflow-y")&&e.css("overflow-y","auto")},10)),w.tmp.contentWidth&&"both"!==w.align?(a=parseInt(w.tmp.contentWidth),t.width(a),setTimeout(function(){a>t.find("div.w2ui-menu > table").width()&&t.find("div.w2ui-menu > table").css("overflow-x","hidden")},1),setTimeout(function(){t.find("div.w2ui-menu > table").css("overflow-x","auto")},10)):t.find("div.w2ui-menu").css("width","100%");var r=w.left,l=w.width,d=w.tipLeft;switch(w.align){case"both":r=17,0===w.width&&(w.width=w2utils.getSize(k(y),"width")),w.maxWidth&&w.width>w.maxWidth&&(w.width=w.maxWidth);break;case"left":r=17;break;case"right":r=w2utils.getSize(k(y),"width")-a+10,d=a-40}l=30!==a||l?w.width?w.width:"auto":30;var u,c,p,h=(a-17)/2;if("auto"!==l&&(h=(l-17)/2),h<25&&(r=25-h,d=Math.floor(h)),w.contextMenu)u=w.pageX+8,c=w.pageY-0,p=w.pageY;else u=(25<(m=y.offset()||{}).left?m.left:25)+r,c=m.top+w2utils.getSize(y,"height")+w.top+7,p=m.top;e.css({left:u+"px",top:c+"px","min-width":l,"min-height":w.height?w.height:"auto"});var f,m=t.offset()||{},g=window.innerHeight+k(document).scrollTop()-m.top-7,v=window.innerWidth+k(document).scrollLeft()-m.left-7;if(w.contextMenu&&(g=window.innerHeight+k(document).scrollTop()-w.pageY-15,v=window.innerWidth+k(document).scrollLeft()-w.pageX),-50<g&&g<210||!0===w.openAbove)f=w.contextMenu?(g=w.pageY-7,5):(g=m.top-k(document).scrollTop()-7,24),w.maxHeight&&g>w.maxHeight&&(g=w.maxHeight),g<s&&(o=!0,t.height(g).width(a).css({"overflow-y":"auto"}),s=g),e.addClass("bottom-arrow"),e.css("top",p-s-f+w.top+"px"),e.find(">style").html("#w2ui-overlay"+x+":before { margin-left: "+parseInt(d)+"px; }#w2ui-overlay"+x+":after { margin-left: "+parseInt(d)+"px; }");else w.maxHeight&&g>w.maxHeight&&(g=w.maxHeight),g<s&&(o=!0,t.height(g).width(a).css({"overflow-y":"auto"})),e.addClass("top-arrow"),e.find(">style").html("#w2ui-overlay"+x+":before { margin-left: "+parseInt(d)+"px; }#w2ui-overlay"+x+":after { margin-left: "+parseInt(d)+"px; }");a=t.width(),v=window.innerWidth+k(document).scrollLeft()-m.left-7,w.maxWidth&&v>w.maxWidth&&(v=w.maxWidth),v<a&&"both"!==w.align&&(w.align="right",setTimeout(function(){b()},1)),(w.contextMenu||w.noTip)&&e.find(">style").html("#w2ui-overlay"+x+":before { display: none; }#w2ui-overlay"+x+":after { display: none; }"),o&&"both"!==w.align&&t.width(a+w2utils.scrollBarSize()+2)}0<i.length&&(i.css("overflow-y","auto"),i.scrollTop(n.scrollTop),i.scrollLeft(n.scrollLeft))}},k.fn.w2menu=function(e,w){w&&"function"==typeof w.items&&(w.items=w.items());var t,l=this,d="";if("refresh"===e)if(k.fn.w2menuOptions&&k.fn.w2menuOptions.name&&(d="-"+k.fn.w2menuOptions.name),w.name&&(d="-"+w.name),0<k("#w2ui-overlay"+d).length){w=k.extend(k.fn.w2menuOptions,w);var i=k("#w2ui-overlay"+d+" div.w2ui-menu").scrollTop();k("#w2ui-overlay"+d+" div.w2ui-menu").html(y()),k("#w2ui-overlay"+d+" div.w2ui-menu").scrollTop(i),p()}else k(this).w2menu(w);else if("refresh-index"===e){var n=k("#w2ui-overlay"+d+" div.w2ui-menu"),o=n.find("tr[index="+w.index+"]");i=n.scrollTop();if(n.find("tr.w2ui-selected").removeClass("w2ui-selected"),o.addClass("w2ui-selected"),0<o.length){var s=o[0].offsetTop-5,a=n.height();n.scrollTop(i),(s<i||s+o.height()>i+a)&&n.animate({scrollTop:s-(a-2*o.height())/2},200,"linear")}p()}else{1===arguments.length?w=e:w.items=e,"object"!=typeof w&&(w={}),w=k.extend({},{type:"normal",index:null,items:[],render:null,msgNoItems:"No items",onSelect:null,hideOnRemove:!1,tmp:{}},w),(k.fn.w2menuOptions=w).name&&(d="-"+w.name),"function"==typeof w.select&&"function"!=typeof w.onSelect&&(w.onSelect=w.select),"function"==typeof w.remove&&"function"!=typeof w.onRemove&&(w.onRemove=w.remove),"function"==typeof w.onRender&&"function"!=typeof w.render&&(w.render=w.onRender),k.fn.w2menuClick=function(e,t,i){var n=!1,o=k(e.target).closest("tr");if((e.shiftKey||e.metaKey||e.ctrlKey)&&(n=!0),items=null==i?w.items:w.items[i].items,k(e.target).hasClass("remove"))"function"==typeof w.onRemove&&w.onRemove({index:t,parentIndex:i,item:items[t],keepOpen:n,originalEvent:e}),n=!w.hideOnRemove,k(e.target).closest("tr").remove(),p();else if(o.hasClass("has-sub-menu"))n=!0,o.hasClass("expanded")?(items[t].expanded=!1,o.removeClass("expanded").addClass("collapsed").next().hide()):(items[t].expanded=!0,o.addClass("expanded").removeClass("collapsed").next().show()),p();else if("function"==typeof w.onSelect){var s=items;"function"==typeof items&&(s=items(w.items[i])),null!=s[t].keepOpen&&(n=s[t].keepOpen),w.onSelect({index:t,parentIndex:i,item:s[t],keepOpen:n,originalEvent:e})}if(null==items[t]||!0!==items[t].keepOpen){var a=k("#w2ui-overlay"+d);a.removeData("keepOpen"),0<a.length&&"function"==typeof a[0].hide&&!n&&a[0].hide()}},k.fn.w2menuDown=function(e,t,i){var n,o=k(e.target).closest("tr"),s=k(o.get(0)).find(".w2ui-icon"),a=(n=null==i?w.items:w.items[i].items)[t];"check"!==w.type&&"radio"!==w.type||!1===a.group||k(e.target).hasClass("remove")||k(e.target).closest("tr").hasClass("has-sub-menu")||(a.checked=!a.checked,a.checked?("radio"===w.type&&s.parents("table").find(".w2ui-icon").removeClass("w2ui-icon-check").addClass("w2ui-icon-empty"),"check"===w.type&&null!=a.group&&n.forEach(function(e,t){e.id!=a.id&&e.group===a.group&&e.checked&&(s.closest("table").find("tr[index="+t+"] .w2ui-icon").removeClass("w2ui-icon-check").addClass("w2ui-icon-empty"),n[t].checked=!1)}),s.removeClass("w2ui-icon-empty").addClass("w2ui-icon-check")):"check"===w.type&&null==a.group&&!1!==a.group&&s.removeClass("w2ui-icon-check").addClass("w2ui-icon-empty")),o.parent().find("tr").removeClass("w2ui-selected"),o.addClass("w2ui-selected")};var r="";if(w.search){r+='<div style="position: absolute; top: 0px; height: 40px; left: 0px; right: 0px; border-bottom: 1px solid silver; background-color: #ECECEC; padding: 8px 5px;"> <div class="w2ui-icon icon-search" style="position: absolute; margin-top: 4px; margin-left: 6px; width: 11px; background-position: left !important;"></div> <input id="menu-search" type="text" style="width: 100%; outline: none; padding-left: 20px;" onclick="event.stopPropagation();"/></div>',w.style+=";background-color: #ECECEC";for(var u=w.index=0;u<w.items.length;u++)w.items[u].hidden=!1}r+=(w.topHTML||"")+'<div class="w2ui-menu" style="top: '+(w.search?40:0)+"px;"+(w.menuStyle||"")+'">'+y()+"</div>",t=k(this).w2overlay(r,w),setTimeout(function(){if(k("#w2ui-overlay"+d+" #menu-search").on("keyup",h).on("keydown",function(e){9===e.keyCode&&(e.stopPropagation(),e.preventDefault())}),w.search){if(-1!==["text","password"].indexOf(k(l)[0].type)||"TEXTAREA"===k(l)[0].tagName.toUpperCase())return;k("#w2ui-overlay"+d+" #menu-search").focus()}p()},250),p();var c=k("#w2ui-overlay"+d);0<c.length&&(c[0].mresize=p,c[0].change=h)}return t;function p(){setTimeout(function(){k("#w2ui-overlay"+d+" tr.w2ui-selected").removeClass("w2ui-selected");var e=k("#w2ui-overlay"+d+" tr[index="+w.index+"]"),t=k("#w2ui-overlay"+d+" div.w2ui-menu").scrollTop();if(e.addClass("w2ui-selected"),w.tmp&&(w.tmp.contentHeight=k("#w2ui-overlay"+d+" table").height()+(w.search?50:10)+(parseInt(k("#w2ui-overlay"+d+" .w2ui-menu").css("top"))||0)+(parseInt(k("#w2ui-overlay"+d+" .w2ui-menu").css("bottom"))||0),w.tmp.contentWidth=k("#w2ui-overlay"+d+" table").width()),0<k("#w2ui-overlay"+d).length&&k("#w2ui-overlay"+d)[0].resize(),0<e.length){var i=e[0].offsetTop-5,n=k("#w2ui-overlay"+d+" div.w2ui-menu").height();k("#w2ui-overlay"+d+" div.w2ui-menu").scrollTop(t),(i<t||i+e.height()>t+n)&&k("#w2ui-overlay"+d+" div.w2ui-menu").animate({scrollTop:i-(n-2*e.height())/2},200,"linear")}},1)}function h(e){var t=this.value,i=!1;switch(e.keyCode){case 13:k("#w2ui-overlay"+d).remove(),k.fn.w2menuClick(e,w.index);break;case 9:case 27:k("#w2ui-overlay"+d).remove(),k.fn.w2menuClick(e,-1);break;case 38:for(w.index=w2utils.isInt(w.index)?parseInt(w.index):0,w.index--;0<w.index&&w.items[w.index].hidden;)w.index--;if(0===w.index&&w.items[w.index].hidden)for(;w.items[w.index]&&w.items[w.index].hidden;)w.index++;w.index<0&&(w.index=0),i=!0;break;case 40:for(w.index=w2utils.isInt(w.index)?parseInt(w.index):0,w.index++;w.index<w.items.length-1&&w.items[w.index].hidden;)w.index++;if(w.index===w.items.length-1&&w.items[w.index].hidden)for(;w.items[w.index]&&w.items[w.index].hidden;)w.index--;w.index>=w.items.length&&(w.index=w.items.length-1),i=!0}if(!i){for(var n=0,o=0;o<w.items.length;o++){var s=w.items[o],a="",r="";-1!==["is","begins with"].indexOf(w.match)&&(a="^"),-1!==["is","ends with"].indexOf(w.match)&&(r="$");try{new RegExp(a+t+r,"i").test(s.text)||"..."===s.text?s.hidden=!1:s.hidden=!0}catch(e){}"enum"===l.type&&-1!==k.inArray(s.id,ids)&&(s.hidden=!0),!0!==s.hidden&&n++}for(w.index=0;w.index<w.items.length-1&&w.items[w.index].hidden;)w.index++;n<=0&&(w.index=-1)}k(l).w2menu("refresh",w),p()}function y(e,t,i,n){if(w.spinner)return'<table><tbody><tr><td style="padding: 5px 10px 13px 10px; text-align: center"> <div class="w2ui-spinner" style="width: 18px; height: 18px; position: relative; top: 5px;"></div> <div style="display: inline-block; padding: 3px; color: #999;">'+w2utils.lang("Loading...")+"</div></td></tr></tbody></table>";var o=0,s='<table cellspacing="0" cellpadding="0" class="'+(t?" sub-menu":"")+'"><tbody>',a=null,r=null;null==e&&(e=w.items),Array.isArray(e)||(e=[]);for(var l=0;l<e.length;l++){var d=e[l];if("string"==typeof d?d={id:d,text:d}:(null!=d.text&&null==d.id&&(d.id=d.text),null==d.text&&null!=d.id&&(d.text=d.id),null!=d.caption&&(d.text=d.caption),null==(a=d.img)&&(a=null),null==(r=d.icon)&&(r=null)),-1==["radio","check"].indexOf(w.type)||Array.isArray(d.items)||!1===d.group||(r=!0===d.checked?"w2ui-icon-check":"w2ui-icon-empty"),!0!==d.hidden){var u="",c=d.text,p="";if("function"==typeof w.render&&(c=w.render(d,w)),"function"==typeof c&&(c=c(d,w)),a&&(u='<td class="menu-icon"><div class="w2ui-tb-image w2ui-icon '+a+'"></div></td>'),r&&(u='<td class="menu-icon" align="center"><span class="w2ui-icon '+r+'"></span></td>'),"break"!==d.type&&null!=c&&""!==c&&"--"!=String(c).substr(0,2)){var h=o%2==0?"w2ui-item-even":"w2ui-item-odd";!0!==w.altRows&&(h="");var f=1;""===u&&f++,null==d.count&&null==d.hotkey&&!0!==d.remove&&null==d.items&&f++,null==d.tooltip&&null!=d.hint&&(d.tooltip=d.hint);var m="";if(!0===d.remove)m='<span class="remove">X</span>';else if(null!=d.items){var g=[];"function"==typeof d.items?g=d.items(d):Array.isArray(d.items)&&(g=d.items),m="<span></span>",p='<tr style="'+(d.expanded?"":"display: none")+'"> <td colspan="3">'+y(g,!0,!d.expanded,l)+"</td><tr>"}else null!=d.count&&(m+="<span>"+d.count+"</span>"),null!=d.hotkey&&(m+='<span class="hotkey">'+d.hotkey+"</span>");s+='<tr index="'+l+'" style="'+(d.style?d.style:"")+'" '+(d.tooltip?'title="'+w2utils.lang(d.tooltip)+'"':"")+' class="'+h+(w.index===l?" w2ui-selected":"")+(!0===d.disabled?" w2ui-disabled":"")+(""!==p?" has-sub-menu"+(d.expanded?" expanded":" collapsed"):"")+'" onmousedown="if ('+(!0===d.disabled?"true":"false")+") return; jQuery.fn.w2menuDown(event, "+l+", "+n+');" onclick="event.stopPropagation(); if ('+(!0===d.disabled?"true":"false")+") return; jQuery.fn.w2menuClick(event, "+l+", "+n+');">'+(t?"<td></td>":"")+u+' <td class="menu-text" colspan="'+f+'">'+w2utils.lang(c)+'</td> <td class="menu-count">'+m+"</td></tr>"+p,o++}else{var v=c.replace(/^-+/g,"");s+='<tr><td colspan="3" class="menu-divider '+(""!=v?"divider-text":"")+'"> <div class="line">'+v+'</div> <div class="text">'+v+"</div></td></tr>"}}e[l]=d}return 0===o&&w.msgNoItems&&(s+='<tr><td style="padding: 13px; color: #999; text-align: center">'+w.msgNoItems+"</div></td></tr>"),s+="</tbody></table>"}},k.fn.w2color=function(o,e){var t=k(this),s=t[0];if(t.data("skipInit"))t.removeData("skipInit");else{var a=[-1,-1];null==k.fn.w2colorPalette&&(k.fn.w2colorPalette=[["000000","333333","555555","777777","888888","999999","AAAAAA","CCCCCC","DDDDDD","EEEEEE","F7F7F7","FFFFFF"],["FF011B","FF9838","FFC300","FFFD59","86FF14","14FF7A","2EFFFC","2693FF","006CE7","9B24F4","FF21F5","FF0099"],["FFEAEA","FCEFE1","FCF4DC","FFFECF","EBFFD9","D9FFE9","E0FFFF","E8F4FF","ECF4FC","EAE6F4","FFF5FE","FCF0F7"],["F4CCCC","FCE5CD","FFF1C2","FFFDA1","D5FCB1","B5F7D0","BFFFFF","D6ECFF","CFE2F3","D9D1E9","FFE3FD","FFD9F0"],["EA9899","F9CB9C","FFE48C","F7F56F","B9F77E","84F0B1","83F7F7","B5DAFF","9FC5E8","B4A7D6","FAB9F6","FFADDE"],["E06666","F6B26B","DEB737","E0DE51","8FDB48","52D189","4EDEDB","76ACE3","6FA8DC","8E7CC3","E07EDA","F26DBD"],["CC0814","E69138","AB8816","B5B20E","6BAB30","27A85F","1BA8A6","3C81C7","3D85C6","674EA7","A14F9D","BF4990"],["99050C","B45F17","80650E","737103","395E14","10783D","13615E","094785","0A5394","351C75","780172","782C5A"]]);var c,r=k.fn.w2colorPalette;"string"==typeof o&&(o={color:o,transparent:!0}),null==o.onSelect&&null!=e&&(o.onSelect=e),o.transparent&&"333333"==r[0][1]&&(r[0].splice(1,1),r[0].push("")),o.transparent||"333333"==r[0][1]||(r[0].splice(1,0,"333333"),r[0].pop()),o.color&&(o.color=String(o.color).toUpperCase()),"string"==typeof o.color&&"#"===o.color.substr(0,1)&&(o.color=o.color.substr(1)),null==o.fireChange&&(o.fireChange=!0),0===k("#w2ui-overlay").length?k(s).w2overlay(v(o),o):(k("#w2ui-overlay .w2ui-color").parent().html(v(o)),k("#w2ui-overlay").show()),k("#w2ui-overlay .color").off(".w2color").on("mousedown.w2color",function(e){var t=k(e.originalEvent.target).attr("name");a=k(e.originalEvent.target).attr("index").split(":"),"INPUT"===s.tagName.toUpperCase()?(o.fireChange&&k(s).change(),k(s).next().find(">div").css("background-color",t)):k(s).data("_color",t),"function"==typeof o.onSelect&&o.onSelect(t)}).on("mouseup.w2color",function(){setTimeout(function(){0<k("#w2ui-overlay").length&&k("#w2ui-overlay").removeData("keepOpen")[0].hide()},10)}),k("#w2ui-overlay .color-original").off(".w2color").on("click.w2color",function(e){var t=w2utils.parseColor(k(e.target).css("background-color"));null!=t&&(d=t,l=w2utils.rgb2hsv(d),p(l),u(),h())}),k("#w2ui-overlay input").off(".w2color").on("mousedown.w2color",function(e){k("#w2ui-overlay").data("keepOpen",!0),setTimeout(function(){k("#w2ui-overlay").data("keepOpen",!0)},10),e.stopPropagation()}).on("change.w2color",function(){var e=k(this),t=parseFloat(e.val()),i=parseFloat(e.attr("max"));isNaN(t)&&(t=0),1<i&&(t=parseInt(t)),0<i&&i<t&&(e.val(i),t=i),t<0&&(e.val(0),t=0);var n=e.attr("name"),o={};-1!==["r","g","b","a"].indexOf(n)?(d[n]=t,l=w2utils.rgb2hsv(d)):-1!==["h","s","v"].indexOf(n)&&(o[n]=t),p(o),u(),h()});var l,d=w2utils.parseColor(o.color);null==d&&(d={r:140,g:150,b:160,a:1},l=w2utils.rgb2hsv(d)),l=w2utils.rgb2hsv(d);function i(e){var t=k(this).find(".value1, .value2"),i=parseInt(t.width())/2;t.hasClass("move-x")&&t.css({left:e.offsetX-i+"px"}),t.hasClass("move-y")&&t.css({top:e.offsetY-i+"px"}),c={$el:t,x:e.pageX,y:e.pageY,width:t.parent().width(),height:t.parent().height(),left:parseInt(t.css("left")),top:parseInt(t.css("top"))},f(e),k("body").off(".w2color").on(g,f).on(m,n)}var p=function(e,t){null!=e.h&&(l.h=e.h),null!=e.s&&(l.s=e.s),null!=e.v&&(l.v=e.v),null!=e.a&&(d.a=e.a,l.a=e.a);var i="rgba("+(d=w2utils.hsv2rgb(l)).r+","+d.g+","+d.b+","+d.a+")",n=[Number(d.r).toString(16).toUpperCase(),Number(d.g).toString(16).toUpperCase(),Number(d.b).toString(16).toUpperCase()];n.forEach(function(e,t){1===e.length&&(n[t]="0"+e)}),1===d.a&&(i=n[0]+n[1]+n[2]),k("#w2ui-overlay .color-preview").css("background-color",i),k("#w2ui-overlay input").each(function(e,t){t.name&&(null!=d[t.name]&&(t.value=d[t.name]),null!=l[t.name]&&(t.value=l[t.name]),"a"===t.name&&(t.value=d.a))}),t?k("#w2ui-overlay .color-original").css("background-color",i):("INPUT"===s.tagName.toUpperCase()?(k(s).val(i).data("skipInit",!0),o.fireChange&&k(s).change(),k(s).next().find(">div").css("background-color",i)):k(s).data("_color",i),"function"==typeof o.onSelect&&o.onSelect(i))},u=function(){var e=k("#w2ui-overlay .palette .value1"),t=k("#w2ui-overlay .rainbow .value2"),i=k("#w2ui-overlay .alpha .value2"),n=parseInt(e.width())/2,o=parseInt(t.width())/2;e.css({left:150*l.s/100-n,top:125*(100-l.v)/100-n}),t.css("left",l.h/2.4-o),i.css("left",150*d.a-o)},h=function(){var e=w2utils.hsv2rgb(l.h,100,100),t=e.r+","+e.g+","+e.b;k("#w2ui-overlay .palette").css("background-image","linear-gradient(90deg, rgba("+t+",0) 0%, rgba("+t+",1) 100%)")},n=function(e){k("body").off(".w2color")},f=function(e){var t=c.$el,i=e.pageX-c.x,n=e.pageY-c.y,o=c.left+i,s=c.top+n,a=parseInt(t.width())/2;o<-a&&(o=-a),s<-a&&(s=-a),o>c.width-a&&(o=c.width-a),s>c.height-a&&(s=c.height-a),t.hasClass("move-x")&&t.css({left:o+"px"}),t.hasClass("move-y")&&t.css({top:s+"px"});var r=t.parent().attr("name"),l=parseInt(t.css("left"))+a,d=parseInt(t.css("top"))+a;if("palette"===r&&p({s:Math.round(l/c.width*100),v:Math.round(100-d/c.height*100)}),"rainbow"===r){var u=Math.round(2.4*l);p({h:u}),h()}"alpha"===r&&p({a:parseFloat(Number(l/150).toFixed(2))})};!0!==k.fn._colorAdvanced&&!0!==o.advanced||(k("#w2ui-overlay .w2ui-color-tabs :nth-child(2)").click(),k("#w2ui-overlay").removeData("keepOpen")),p({},!0),h(),u();var m="mouseup.w2color",g="mousemove.w2color";w2utils.isIOS&&("touchstart.w2color",m="touchend.w2color",g="touchmove.w2color "),k("#w2ui-overlay .palette").off(".w2color").on("mousedown.w2color",i),k("#w2ui-overlay .rainbow").off(".w2color").on("mousedown.w2color",i),k("#w2ui-overlay .alpha").off(".w2color").on("mousedown.w2color",i),s.nav=function(e){switch(e){case"up":a[0]--;break;case"down":a[0]++;break;case"right":a[1]++;break;case"left":a[1]--}return a[0]<0&&(a[0]=0),a[0]>r.length-2&&(a[0]=r.length-2),a[1]<0&&(a[1]=0),a[1]>r[0].length-1&&(a[1]=r[0].length-1),color=r[a[0]][a[1]],k(s).data("_color",color),color}}function v(e){e.color;for(var t,i='<div class="w2ui-color" onmousedown="jQuery(this).parents(\'.w2ui-overlay\').data(\'keepOpen\', true)"><div class="w2ui-color-palette"><table cellspacing="5"><tbody>',n=0;n<r.length;n++){i+="<tr>";for(var o=0;o<r[n].length;o++)t="FFFFFF"===r[n][o]?";border: 1px solid #efefef":"",i+='<td> <div class="color '+(""===r[n][o]?"no-color":"")+'" style="background-color: #'+r[n][o]+t+';" name="'+r[n][o]+'" index="'+n+":"+o+'">'+(e.color==r[n][o]?"&#149;":"&#160;")+" </div></td>",e.color==r[n][o]&&(a=[n,o]);i+="</tr>",n<2&&(i+='<tr><td style="height: 8px" colspan="8"></td></tr>')}return i+="</tbody></table></div>",i+='<div class="w2ui-color-advanced" style="display: none"> <div class="color-info"> <div class="color-preview-bg"><div class="color-preview"></div><div class="color-original"></div></div> <div class="color-part"> <span>H</span> <input name="h" maxlength="3" max="360" tabindex="101"> <span>R</span> <input name="r" maxlength="3" max="255" tabindex="104"> </div> <div class="color-part"> <span>S</span> <input name="s" maxlength="3" max="100" tabindex="102"> <span>G</span> <input name="g" maxlength="3" max="255" tabindex="105"> </div> <div class="color-part"> <span>V</span> <input name="v" maxlength="3" max="100" tabindex="103"> <span>B</span> <input name="b" maxlength="3" max="255" tabindex="106"> </div> <div class="color-part" style="margin: 30px 0px 0px 2px"> <span style="width: 40px">Opacity</span> <input name="a" maxlength="5" max="1" style="width: 32px !important" tabindex="107"> </div> </div> <div class="palette" name="palette"> <div class="palette-bg"></div> <div class="value1 move-x move-y"></div> </div> <div class="rainbow" name="rainbow"> <div class="value2 move-x"></div> </div> <div class="alpha" name="alpha"> <div class="alpha-bg"></div> <div class="value2 move-x"></div> </div></div>',i+="<div class=\"w2ui-color-tabs\"> <div class=\"w2ui-color-tab selected\" onclick=\"jQuery(this).addClass('selected').next().removeClass('selected').parents('.w2ui-overlay').find('.w2ui-color-advanced').hide().parent().find('.w2ui-color-palette').show(); jQuery.fn._colorAdvanced = false; jQuery('#w2ui-overlay')[0].resize()\"><span class=\"w2ui-icon w2ui-icon-colors\"></span></div> <div class=\"w2ui-color-tab\" onclick=\"jQuery(this).addClass('selected').prev().removeClass('selected').parents('.w2ui-overlay').find('.w2ui-color-advanced').show().parent().find('.w2ui-color-palette').hide(); jQuery.fn._colorAdvanced = true; jQuery('#w2ui-overlay')[0].resize()\"><span class=\"w2ui-icon w2ui-icon-settings\"></span></div> <div style=\"padding: 8px; text-align: right;\">"+("string"==typeof e.html?e.html:"")+'</div></div></div><div style="clear: both; height: 0"></div>'}}}(jQuery),function(x){function o(e){this.el=null,this.helpers={},this.type=e.type||"text",this.options=x.extend(!0,{},e),this.onSearch=e.onSearch||null,this.onRequest=e.onRequest||null,this.onLoad=e.onLoad||null,this.onError=e.onError||null,this.onClick=e.onClick||null,this.onAdd=e.onAdd||null,this.onNew=e.onNew||null,this.onRemove=e.onRemove||null,this.onMouseOver=e.onMouseOver||null,this.onMouseOut=e.onMouseOut||null,this.onIconClick=e.onIconClick||null,this.onScroll=e.onScroll||null,this.tmp={},delete this.options.type,delete this.options.onSearch,delete this.options.onRequest,delete this.options.onLoad,delete this.options.onError,delete this.options.onClick,delete this.options.onMouseOver,delete this.options.onMouseOut,delete this.options.onIconClick,delete this.options.onScroll,x.extend(!0,this,w2obj.field)}x.fn.w2field=function(n,e){if(0!==this.length)return 0===arguments.length?x(this).data("w2field"):("string"==typeof n&&"object"==typeof e&&(n=x.extend(!0,{},e,{type:n})),"string"==typeof n&&null==e&&(n={type:n}),n&&(n.type=String(n.type).toLowerCase()),this.each(function(e,t){var i=x(t).data("w2field");return null==i?(i=new o(n),x.extend(i,{handlers:[]}),t&&(i.el=x(t)[0]),i.init(),x(t).data("w2field",i),i):(i.clear(),"clear"!==n.type?(i=new o(n),x.extend(i,{handlers:[]}),t&&(i.el=x(t)[0]),i.init(),x(t).data("w2field",i),i):void 0)}));var t=o.prototype;return t[n]?t[n].apply(t,Array.prototype.slice.call(arguments,1)):void 0},o.prototype={custom:{},addType:function(e,t){return e=String(e).toLowerCase(),this.custom[e]=t,!0},removeType:function(e){return e=String(e).toLowerCase(),!!this.custom[e]&&(delete this.custom[e],!0)},init:function(){var e,t=this,i=this.options;if("function"!=typeof this.custom[this.type])if(-1!=["INPUT","TEXTAREA"].indexOf(this.el.tagName.toUpperCase())){switch(this.type){case"text":case"int":case"float":case"money":case"currency":case"percent":case"alphanumeric":case"bin":case"hex":e={min:null,max:null,step:1,autoFormat:!0,currencyPrefix:w2utils.settings.currencyPrefix,currencySuffix:w2utils.settings.currencySuffix,currencyPrecision:w2utils.settings.currencyPrecision,decimalSymbol:w2utils.settings.decimalSymbol,groupSymbol:w2utils.settings.groupSymbol,arrows:!1,keyboard:!0,precision:null,silent:!0,prefix:"",suffix:""},this.options=x.extend(!0,{},e,i),(i=this.options).numberRE=new RegExp("["+i.groupSymbol+"]","g"),i.moneyRE=new RegExp("["+i.currencyPrefix+i.currencySuffix+i.groupSymbol+"]","g"),i.percentRE=new RegExp("["+i.groupSymbol+"%]","g"),-1!==["text","alphanumeric","hex","bin"].indexOf(this.type)&&(i.arrows=!1,i.keyboard=!1),this.addPrefix(),this.addSuffix();break;case"color":e={prefix:"",suffix:'<div style="width: '+(parseInt(x(this.el).css("font-size"))||12)+'px">&#160;</div>',arrows:!1,keyboard:!1,advanced:null,transparent:!0},x.extend(i,e),this.addPrefix(),this.addSuffix(),""!==x(this.el).val()&&setTimeout(function(){t.change()},1);break;case"date":e={format:w2utils.settings.dateFormat,keyboard:!0,silent:!0,start:"",end:"",blocked:{},colored:{},blockWeekDays:null},this.options=x.extend(!0,{},e,i),i=this.options,null==x(this.el).attr("placeholder")&&x(this.el).attr("placeholder",i.format);break;case"time":e={format:w2utils.settings.timeFormat,keyboard:!0,silent:!0,start:"",end:"",noMinutes:!1},this.options=x.extend(!0,{},e,i),i=this.options,null==x(this.el).attr("placeholder")&&x(this.el).attr("placeholder",i.format);break;case"datetime":e={format:w2utils.settings.dateFormat+" | "+w2utils.settings.timeFormat,keyboard:!0,silent:!0,start:"",end:"",blocked:[],colored:{},placeholder:null,btn_now:!0,noMinutes:!1},this.options=x.extend(!0,{},e,i),i=this.options,null==x(this.el).attr("placeholder")&&x(this.el).attr("placeholder",i.placeholder||i.format);break;case"list":case"combo":if(e={items:[],selected:{},url:null,recId:null,recText:null,method:null,interval:350,postData:{},minLength:1,cacheMax:250,maxDropHeight:350,maxDropWidth:null,match:"begins",silent:!0,icon:null,iconStyle:"",align:"both",altRows:!0,onSearch:null,onRequest:null,onLoad:null,onError:null,onIconClick:null,renderDrop:null,compare:null,filter:!0,prefix:"",suffix:"",openOnFocus:!1,markSearch:!1},"function"==typeof i.items&&(i._items_fun=i.items),i.items=w2obj.field.prototype.normMenu.call(this,i.items),"list"===this.type){if(e.openOnFocus=!0,x(this.el).addClass("w2ui-select"),!x.isPlainObject(i.selected)&&Array.isArray(i.items))for(var n=0;n<i.items.length;n++){var o=i.items[n];if(o&&o.id===i.selected){i.selected=x.extend(!0,{},o);break}}this.watchSize()}i=x.extend({},e,i),this.options=i,x.isPlainObject(i.selected)||(i.selected={}),x(this.el).data("selected",i.selected),i.url&&(i.items=[],this.request(0)),"list"===this.type&&this.addFocus(),this.addPrefix(),this.addSuffix(),setTimeout(function(){t.refresh()},10),x(this.el).attr("autocapitalize","off").attr("autocomplete","off").attr("autocorrect","off").attr("spellcheck","false"),null!=i.selected.text&&x(this.el).val(i.selected.text);break;case"enum":e={items:[],selected:[],max:0,url:null,recId:null,recText:null,interval:350,method:null,postData:{},minLength:1,cacheMax:250,maxWidth:250,maxHeight:350,maxDropHeight:350,maxDropWidth:null,match:"contains",silent:!0,align:"both",altRows:!0,openOnFocus:!1,markSearch:!0,renderDrop:null,renderItem:null,compare:null,filter:!0,style:"",onSearch:null,onRequest:null,onLoad:null,onError:null,onClick:null,onAdd:null,onNew:null,onRemove:null,onMouseOver:null,onMouseOut:null,onScroll:null},"function"==typeof(i=x.extend({},e,i,{suffix:""})).items&&(i._items_fun=i.items),i.items=w2obj.field.prototype.normMenu.call(this,i.items),i.selected=w2obj.field.prototype.normMenu.call(this,i.selected),this.options=i,x.isArray(i.selected)||(i.selected=[]),x(this.el).data("selected",i.selected),i.url&&(i.items=[],this.request(0)),this.addSuffix(),this.addMulti(),this.watchSize();break;case"file":e={selected:[],max:0,maxSize:0,maxFileSize:0,maxWidth:250,maxHeight:350,maxDropHeight:350,maxDropWidth:null,readContent:!0,silent:!0,align:"both",altRows:!0,renderItem:null,style:"",onClick:null,onAdd:null,onRemove:null,onMouseOver:null,onMouseOut:null},i=x.extend({},e,i),this.options=i,x.isArray(i.selected)||(i.selected=[]),x(this.el).data("selected",i.selected),null==x(this.el).attr("placeholder")&&x(this.el).attr("placeholder",w2utils.lang("Attach files by dragging and dropping or Click to Select")),this.addMulti(),this.watchSize()}this.tmp={onChange:function(e){t.change.call(t,e)},onClick:function(e){t.click.call(t,e)},onFocus:function(e){t.focus.call(t,e)},onBlur:function(e){t.blur.call(t,e)},onKeydown:function(e){t.keyDown.call(t,e)},onKeyup:function(e){t.keyUp.call(t,e)},onKeypress:function(e){t.keyPress.call(t,e)}},x(this.el).addClass("w2field w2ui-input").data("w2field",this).on("change.w2field",this.tmp.onChange).on("click.w2field",this.tmp.onClick).on("focus.w2field",this.tmp.onFocus).on("blur.w2field",this.tmp.onBlur).on("keydown.w2field",this.tmp.onKeydown).on("keyup.w2field",this.tmp.onKeyup).on("keypress.w2field",this.tmp.onKeypress).css(w2utils.cssPrefix("box-sizing","border-box")),this.change(x.Event("change"))}else console.log("ERROR: w2field could only be applied to INPUT or TEXTAREA.",this.el);else this.custom[this.type].call(this,i)},watchSize:function(){var e=this,t=x(e.el).data("tmp")||{};t.sizeTimer=setInterval(function(){0<x(e.el).parents("body").length?e.resize():clearInterval(t.sizeTimer)},200),x(e.el).data("tmp",t)},get:function(){return-1!==["list","enum","file"].indexOf(this.type)?x(this.el).data("selected"):x(this.el).val()},set:function(e,t){if(-1!==["list","enum","file"].indexOf(this.type)){if("list"!==this.type&&t)null==x(this.el).data("selected")&&x(this.el).data("selected",[]),x(this.el).data("selected").push(e),x(this.el).change();else{var i="enum"===this.type?[e]:e;x(this.el).data("selected",i).change()}this.refresh()}else x(this.el).val(e)},setIndex:function(e,t){if(-1!==["list","enum"].indexOf(this.type)){var i=this.options.items;if(i&&i[e]){if("list"!==this.type&&t)null==x(this.el).data("selected")&&x(this.el).data("selected",[]),x(this.el).data("selected").push(i[e]),x(this.el).change();else{var n="enum"===this.type?[i[e]]:i[e];x(this.el).data("selected",n).change()}return this.refresh(),!0}}return!1},clear:function(){var e=this.options;-1!==["money","currency"].indexOf(this.type)&&x(this.el).val(x(this.el).val().replace(e.moneyRE,"")),"percent"===this.type&&x(this.el).val(x(this.el).val().replace(/%/g,"")),"list"===this.type&&x(this.el).removeClass("w2ui-select"),this.type="clear";var t=x(this.el).data("tmp");if(this.tmp){for(var i in null!=t&&(x(this.el).height("auto"),t&&t["old-padding-left"]&&x(this.el).css("padding-left",t["old-padding-left"]),t&&t["old-padding-right"]&&x(this.el).css("padding-right",t["old-padding-right"]),t&&t["old-background-color"]&&x(this.el).css("background-color",t["old-background-color"]),t&&t["old-border-color"]&&x(this.el).css("border-color",t["old-border-color"]),clearInterval(t.sizeTimer)),x(this.el).val(this.clean(x(this.el).val())).removeClass("w2field").removeData().off(".w2field"),this.helpers)x(this.helpers[i]).remove();this.helpers={}}},refresh:function(){var r=this,i=this.options,l=x(this.el).data("selected"),e=(new Date).getTime();if(-1!==["list"].indexOf(this.type)&&(x(r.el).parent().css("white-space","nowrap"),r.helpers.prefix&&r.helpers.prefix.hide(),setTimeout(function(){if(r.helpers.focus){!x.isEmptyObject(l)&&i.icon?i.prefix='<span class="w2ui-icon '+i.icon+'"style="cursor: pointer; font-size: 14px; display: inline-block; margin-top: -1px; color: #7F98AD;'+i.iconStyle+'"></span>':i.prefix="",r.addPrefix();var t=r.helpers.focus.find("input");""===x(t).val()?(x(t).css("text-indent","-9999em").prev().css("opacity",0),x(r.el).val(l&&null!=l.text?w2utils.lang(l.text):"")):(x(t).css("text-indent",0).prev().css("opacity",1),x(r.el).val(""),setTimeout(function(){r.helpers.prefix&&r.helpers.prefix.hide();var e="position: absolute; opacity: 0; margin: 4px 0px 0px 2px; background-position: left !important;";i.icon?(x(t).css("margin-left","17px"),x(r.helpers.focus).find(".icon-search").attr("style",e+"width: 11px !important; opacity: 1; display: block")):(x(t).css("margin-left","0px"),x(r.helpers.focus).find(".icon-search").attr("style",e+"width: 0px !important; opacity: 0; display: none"))},1)),x(r.el).prop("readonly")||x(r.el).prop("disabled")?setTimeout(function(){x(r.helpers.prefix).css("opacity","0.6"),x(r.helpers.suffix).css("opacity","0.6")},1):setTimeout(function(){x(r.helpers.prefix).css("opacity","1"),x(r.helpers.suffix).css("opacity","1")},1)}},1)),-1!==["enum","file"].indexOf(this.type)){var t="";if(l)for(var n=0;n<l.length;n++){var o=l[n],s="";s="function"==typeof i.renderItem?i.renderItem(o,n,'<div class="w2ui-list-remove" title="'+w2utils.lang("Remove")+'" index="'+n+'">&#160;&#160;</div>'):'<div class="w2ui-list-remove" title="'+w2utils.lang("Remove")+'" index="'+n+'">&#160;&#160;</div>'+("enum"===r.type?o.text:o.name+'<span class="file-size"> - '+w2utils.formatSize(o.size)+"</span>"),t+='<li index="'+n+'" style="max-width: '+parseInt(i.maxWidth)+"px; "+(o.style?o.style:"")+'">'+s+"</li>"}var a=r.helpers.multi,d=a.find("ul");if(a.attr("style",a.attr("style")+";"+i.style),x(r.el).css("z-index","-1"),x(r.el).prop("readonly")||x(r.el).prop("disabled")?setTimeout(function(){a[0].scrollTop=0,a.addClass("w2ui-readonly").find("li").css("opacity","0.9").parent().find("li.nomouse").hide().find("input").prop("readonly",!0).parents("ul").find(".w2ui-list-remove").hide()},1):setTimeout(function(){a.removeClass("w2ui-readonly").find("li").css("opacity","1").parent().find("li.nomouse").show().find("input").prop("readonly",!1).parents("ul").find(".w2ui-list-remove").show()},1),a.find(".w2ui-enum-placeholder").remove(),d.find("li").not("li.nomouse").remove(),""!==t)d.prepend(t);else if(null!=x(r.el).attr("placeholder")&&""===a.find("input").val()){var u="padding-top: "+x(this.el).css("padding-top")+";padding-left: "+x(this.el).css("padding-left")+"; box-sizing: "+x(this.el).css("box-sizing")+"; line-height: "+x(this.el).css("line-height")+"; font-size: "+x(this.el).css("font-size")+"; font-family: "+x(this.el).css("font-family")+"; ";a.prepend('<div class="w2ui-enum-placeholder" style="'+u+'">'+x(r.el).attr("placeholder")+"</div>")}a.off("scroll.w2field").on("scroll.w2field",function(e){var t=r.trigger({phase:"before",type:"scroll",target:r.el,originalEvent:e});!0!==t.isCancelled&&r.trigger(x.extend(t,{phase:"after"}))}).find("li").data("mouse","out").on("click",function(e){var t="LI"===e.target.tagName.toUpperCase()?e.target:x(e.target).parents("LI"),i=l[x(t).attr("index")];if(!x(t).hasClass("nomouse"))if(e.stopPropagation(),x(e.target).hasClass("w2ui-list-remove")){if(x(r.el).prop("readonly")||x(r.el).prop("disabled"))return;if(!0===(n=r.trigger({phase:"before",type:"remove",target:r.el,originalEvent:e.originalEvent,item:i})).isCancelled)return;x().w2overlay(),l.splice(x(e.target).attr("index"),1),x(r.el).trigger("input").trigger("change"),x(e.target).parent().fadeOut("fast"),setTimeout(function(){r.refresh(),r.trigger(x.extend(n,{phase:"after"}))},300)}else{var n;if(!0===(n=r.trigger({phase:"before",type:"click",target:r.el,originalEvent:e.originalEvent,item:i})).isCancelled)return;if("file"===r.type){var o="";/image/i.test(i.type)&&(o='<div style="padding: 3px;"> <img src="'+(i.content?"data:"+i.type+";base64,"+i.content:"")+'" style="max-width: 300px;" onload="var w = jQuery(this).width(); var h = jQuery(this).height(); if (w < 300 & h < 300) return; if (w >= h && w > 300) jQuery(this).width(300); if (w < h && h > 300) jQuery(this).height(300);" onerror="this.style.display = \'none\'" ></div>');var s='style="padding: 3px; text-align: right; color: #777;"',a='style="padding: 3px"';o+='<div style="padding: 8px;"> <table cellpadding="2"><tbody> <tr><td '+s+">"+w2utils.lang("Name")+":</td><td "+a+">"+i.name+"</td></tr> <tr><td "+s+">"+w2utils.lang("Size")+":</td><td "+a+">"+w2utils.formatSize(i.size)+"</td></tr> <tr><td "+s+">"+w2utils.lang("Type")+":</td><td "+a+'> <span style="width: 200px; display: block-inline; overflow: hidden; text-overflow: ellipsis; white-space: nowrap="nowrap";">'+i.type+"</span> </td></tr> <tr><td "+s+">"+w2utils.lang("Modified")+":</td><td "+a+">"+w2utils.date(i.modified)+"</td></tr> </tbody></table></div>",x("#w2ui-overlay").remove(),x(t).w2overlay(o)}r.trigger(x.extend(n,{phase:"after"}))}}).on("mouseover",function(e){var t="LI"===e.target.tagName.toUpperCase()?e.target:x(e.target).parents("LI");if(!x(t).hasClass("nomouse")){if("out"===x(t).data("mouse")){var i=l[x(e.target).attr("index")],n=r.trigger({phase:"before",type:"mouseOver",target:r.el,originalEvent:e.originalEvent,item:i});if(!0===n.isCancelled)return;r.trigger(x.extend(n,{phase:"after"}))}x(t).data("mouse","over")}}).on("mouseout",function(i){var n="LI"===i.target.tagName.toUpperCase()?i.target:x(i.target).parents("LI");x(n).hasClass("nomouse")||(x(n).data("mouse","leaving"),setTimeout(function(){if("leaving"===x(n).data("mouse")){x(n).data("mouse","out");var e=l[x(i.target).attr("index")],t=r.trigger({phase:"before",type:"mouseOut",target:r.el,originalEvent:i.originalEvent,item:e});if(!0===t.isCancelled)return;r.trigger(x.extend(t,{phase:"after"}))}},0))}),x(this.el).height("auto");var c=x(a).find("> div.w2ui-multi-items").height()+2*w2utils.getSize(a,"+height");c<26&&(c=26),c>i.maxHeight&&(c=i.maxHeight),0<a.length&&(a[0].scrollTop=1e3);var p=w2utils.getSize(x(this.el),"height")-2;if(c<p&&(c=p),x(a).css({height:c+"px",overflow:c==i.maxHeight?"auto":"hidden"}),c<i.maxHeight&&x(a).prop("scrollTop",0),x(this.el).css({height:c+0+"px"}),"enum"===r.type){var h=r.helpers.multi.find("input");h.width(8*(h.val().length+2)+"px")}}return(new Date).getTime()-e},reset:function(){var e=this.type;this.clear(),this.type=e,this.init()},resize:function(){var e=this,t=x(e.el).width(),i=x(e.el).height();if(!(e.tmp.current_width==t&&0<i)){var n=this.helpers.focus,o=this.helpers.multi,s=this.helpers.suffix,a=this.helpers.prefix;if(n&&n.width(x(e.el).width()),o){var r=w2utils.getSize(e.el,"width")-parseInt(x(e.el).css("margin-left"),10)-parseInt(x(e.el).css("margin-right"),10);x(o).width(r)}s&&(e.options.suffix='<div class="arrow-down" style="margin-top: '+(parseInt(x(e.el).height())-6)/2+'px;"></div>',e.addSuffix()),a&&e.addPrefix(),e.tmp.current_width=t}},clean:function(e){if("number"==typeof e)return e;var t=this.options;return e=String(e).trim(),-1!==["int","float","money","currency","percent"].indexOf(this.type)&&("string"==typeof e&&(t.autoFormat&&-1!==["money","currency"].indexOf(this.type)&&(e=String(e).replace(t.moneyRE,"")),t.autoFormat&&"percent"===this.type&&(e=String(e).replace(t.percentRE,"")),t.autoFormat&&-1!==["int","float"].indexOf(this.type)&&(e=String(e).replace(t.numberRE,"")),e=e.replace(/\s+/g,"").replace(w2utils.settings.groupSymbol,"").replace(w2utils.settings.decimalSymbol,".")),parseFloat(e)==e&&(null!=t.min&&e<t.min&&(e=t.min,x(this.el).val(t.min)),null!=t.max&&e>t.max&&(e=t.max,x(this.el).val(t.max))),e=""!==e&&w2utils.isFloat(e)?Number(e):""),e},format:function(e){var t=this.options;if(t.autoFormat&&""!==e)switch(this.type){case"money":case"currency":""!==(e=w2utils.formatNumber(e,t.currencyPrecision,t.groupSymbol))&&(e=t.currencyPrefix+e+t.currencySuffix);break;case"percent":""!==(e=w2utils.formatNumber(e,t.precision,t.groupSymbol))&&(e+="%");break;case"float":e=w2utils.formatNumber(e,t.precision,t.groupSymbol);break;case"int":e=w2utils.formatNumber(e,0,t.groupSymbol)}return e},change:function(e){var t=this,i=t.options;if(-1!==["int","float","money","currency","percent"].indexOf(this.type)){var n=x(this.el).val(),o=this.format(this.clean(x(this.el).val()));if(""!==n&&n!=o)return x(this.el).val(o).change(),e.stopPropagation(),e.preventDefault(),!1}if("color"===this.type){var s=x(this.el).val();"rgb"!==s.substr(0,3).toLowerCase()&&(s="#"+s,6!==x(this.el).val().length&&3!==x(this.el).val().length&&(s="")),x(this.el).next().find("div").css("background-color",s),x(this.el).hasClass("has-focus")&&!0!==x(this.el).data("skipInit")&&this.updateOverlay()}if(-1!==["list","enum","file"].indexOf(this.type)&&(t.refresh(),setTimeout(function(){t.refresh()},5)),-1!==["date","time","datetime"].indexOf(this.type)){var a=parseInt(t.el.value);w2utils.isInt(t.el.value)&&3e3<a&&("time"===this.type&&x(t.el).val(w2utils.formatTime(new Date(a),i.format)).change(),"date"===this.type&&x(t.el).val(w2utils.formatDate(new Date(a),i.format)).change(),"datetime"===this.type&&x(t.el).val(w2utils.formatDateTime(new Date(a),i.format)).change())}},click:function(e){e.stopPropagation(),-1!==["list","combo","enum"].indexOf(this.type)&&(x(this.el).hasClass("has-focus")||this.focus(e)),-1!==["date","time","color","datetime"].indexOf(this.type)&&this.updateOverlay()},focus:function(e){var t=this;if(x(t.el).addClass("has-focus"),-1!==["color","date","time","datetime"].indexOf(t.type)){if(x(t.el).prop("readonly")||x(t.el).prop("disabled"))return;0<x("#w2ui-overlay").length&&x("#w2ui-overlay")[0].hide(),setTimeout(function(){t.updateOverlay()},150)}if(-1!==["list","combo","enum"].indexOf(t.type)){if(x(t.el).prop("readonly")||x(t.el).prop("disabled"))return;0<x("#w2ui-overlay").length&&x("#w2ui-overlay")[0].hide(),t.resize(),setTimeout(function(){"list"===t.type&&x(t.el).is(":focus")?x(t.helpers.focus).find("input").focus():(t.search(),setTimeout(function(){t.updateOverlay()},1))},1),"function"==typeof t.options._items_fun&&(t.options.items=w2obj.field.prototype.normMenu.call(this,t.options._items_fun))}"file"===t.type&&x(t.helpers.multi).css({outline:"auto 5px #7DB4F3","outline-offset":"-2px"})},blur:function(e){var t=this,i=t.options,n=x(t.el).val().trim(),o=x("#w2ui-overlay");if(x(t.el).removeClass("has-focus"),-1!==["color","date","time","list","combo","enum","datetime"].indexOf(t.type)){var s=window.setTimeout(function(){!0!==o.data("keepOpen")&&o.hide()},0);x(".menu",o).one("focus",function(){clearTimeout(s),x(this).one("focusout",function(e){o.hide()})})}-1!==["int","float","money","currency","percent"].indexOf(t.type)&&(""===n||t.checkType(n)||(x(t.el).val("").change(),!1===i.silent&&(x(t.el).w2tag("Not a valid number"),setTimeout(function(){x(t.el).w2tag("")},3e3)))),-1!==["date","time","datetime"].indexOf(t.type)&&(""===n||t.inRange(t.el.value)?"date"!==t.type||""===n||w2utils.isDate(t.el.value,i.format)?"time"!==t.type||""===n||w2utils.isTime(t.el.value)?"datetime"!==t.type||""===n||w2utils.isDateTime(t.el.value,i.format)||(x(t.el).val("").removeData("selected").change(),!1===i.silent&&(x(t.el).w2tag("Not a valid date"),setTimeout(function(){x(t.el).w2tag("")},3e3))):(x(t.el).val("").removeData("selected").change(),!1===i.silent&&(x(t.el).w2tag("Not a valid time"),setTimeout(function(){x(t.el).w2tag("")},3e3))):(x(t.el).val("").removeData("selected").change(),!1===i.silent&&(x(t.el).w2tag("Not a valid date"),setTimeout(function(){x(t.el).w2tag("")},3e3))):(x(t.el).val("").removeData("selected").change(),!1===i.silent&&(x(t.el).w2tag("Not in range"),setTimeout(function(){x(t.el).w2tag("")},3e3)))),"enum"===t.type&&x(t.helpers.multi).find("input").val("").width(20),"file"===t.type&&x(t.helpers.multi).css({outline:"none"})},keyPress:function(e){var t=this;t.options;if(-1!==["int","float","money","currency","percent","hex","bin","color","alphanumeric"].indexOf(t.type)){if(e.metaKey||e.ctrlKey||e.altKey||e.charCode!=e.keyCode&&0<e.keyCode)return;var i=String.fromCharCode(e.charCode);if(!t.checkType(i,!0)&&13!=e.keyCode)return e.preventDefault(),e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,!1}-1!==["date","time","datetime"].indexOf(t.type)&&9!==e.keyCode&&setTimeout(function(){t.updateOverlay()},1)},keyDown:function(e,t){var i=this,n=i.options,o=e.keyCode||t&&t.keyCode,s=!1;if(-1!==["int","float","money","currency","percent"].indexOf(i.type)){if(!n.keyboard||x(i.el).prop("readonly")||x(i.el).prop("disabled"))return;var a=parseFloat(x(i.el).val().replace(n.moneyRE,""))||0,r=n.step;switch((e.ctrlKey||e.metaKey)&&(r=10),o){case 38:if(e.shiftKey)break;x(i.el).val(a+r<=n.max||null==n.max?Number((a+r).toFixed(12)):n.max).change(),s=!0;break;case 40:if(e.shiftKey)break;x(i.el).val(a-r>=n.min||null==n.min?Number((a-r).toFixed(12)):n.min).change(),s=!0}s&&(e.preventDefault(),setTimeout(function(){i.el.setSelectionRange(i.el.value.length,i.el.value.length)},0))}if("date"===i.type){if(!n.keyboard||x(i.el).prop("readonly")||x(i.el).prop("disabled"))return;var l=864e5;r=1;switch((e.ctrlKey||e.metaKey)&&(r=10),(c=w2utils.isDate(x(i.el).val(),n.format,!0))||(c=new Date,l=0),o){case 38:if(e.shiftKey)break;var d=w2utils.formatDate(c.getTime()+l,n.format);10==r&&(d=w2utils.formatDate(new Date(c.getFullYear(),c.getMonth()+1,c.getDate()),n.format)),x(i.el).val(d).trigger("input").change(),s=!0;break;case 40:if(e.shiftKey)break;d=w2utils.formatDate(c.getTime()-l,n.format);10==r&&(d=w2utils.formatDate(new Date(c.getFullYear(),c.getMonth()-1,c.getDate()),n.format)),x(i.el).val(d).trigger("input").change(),s=!0}s&&(e.preventDefault(),setTimeout(function(){i.el.setSelectionRange(i.el.value.length,i.el.value.length),i.updateOverlay()},0))}if("time"===i.type){if(!n.keyboard||x(i.el).prop("readonly")||x(i.el).prop("disabled"))return;r=e.ctrlKey||e.metaKey?60:1,a=x(i.el).val();var u=i.toMin(a)||i.toMin((new Date).getHours()+":"+((new Date).getMinutes()-1));switch(o){case 38:if(e.shiftKey)break;u+=r,s=!0;break;case 40:if(e.shiftKey)break;u-=r,s=!0}s&&(x(i.el).val(i.fromMin(u)).trigger("input").change(),e.preventDefault(),setTimeout(function(){i.el.setSelectionRange(i.el.value.length,i.el.value.length)},0))}if("datetime"===i.type){if(!n.keyboard||x(i.el).prop("readonly")||x(i.el).prop("disabled"))return;l=864e5,r=1;(e.ctrlKey||e.metaKey)&&(r=10);var c,p=x(i.el).val();switch((c=w2utils.isDateTime(p,this.options.format,!0))||(c=new Date,l=0),o){case 38:if(e.shiftKey)break;d=w2utils.formatDateTime(c.getTime()+l,n.format);10==r&&(d=w2utils.formatDateTime(new Date(c.getFullYear(),c.getMonth()+1,c.getDate()),n.format)),x(i.el).val(d).trigger("input").change(),s=!0;break;case 40:if(e.shiftKey)break;d=w2utils.formatDateTime(c.getTime()-l,n.format);10==r&&(d=w2utils.formatDateTime(new Date(c.getFullYear(),c.getMonth()-1,c.getDate()),n.format)),x(i.el).val(d).trigger("input").change(),s=!0}s&&(e.preventDefault(),setTimeout(function(){i.el.setSelectionRange(i.el.value.length,i.el.value.length),i.updateOverlay()},0))}if("color"===i.type){if(x(i.el).prop("readonly")||x(i.el).prop("disabled"))return;if((e.ctrlKey||e.metaKey)&&!e.shiftKey){var h=null,f=null;switch(o){case 38:h="up";break;case 40:h="down";break;case 39:h="right";break;case 37:h="left"}i.el.nav&&null!=h&&(f=i.el.nav(h),x(i.el).val(f).change(),e.preventDefault())}}if(-1!==["list","combo","enum"].indexOf(i.type)){if(x(i.el).prop("readonly")||x(i.el).prop("disabled"))return;var m=x(i.el).data("selected"),g=x(i.el),v=!1;switch(-1!==["list","enum"].indexOf(i.type)&&("list"===i.type&&(g=x(i.helpers.focus).find("input")),"enum"===i.type&&(g=x(i.helpers.multi).find("input")),-1==[37,38,39,40].indexOf(o)&&setTimeout(function(){i.refresh()},1),86==e.keyCode&&(e.ctrlKey||e.metaKey)&&setTimeout(function(){i.refresh(),i.search(),i.request()},50)),o){case 27:"list"===i.type&&(""!==g.val()&&g.val(""),e.stopPropagation());break;case 37:case 39:break;case 13:if(0===x("#w2ui-overlay").length)break;var w=n.items[n.index];if("enum"===i.type)if(null!=w){if(!0===(y=i.trigger({phase:"before",type:"add",target:i.el,originalEvent:e.originalEvent,item:w})).isCancelled)return;w=y.item,m.length>=n.max&&0<n.max&&m.pop(),delete w.hidden,delete i.tmp.force_open,m.push(w),x(i.el).change(),g.val("").width(20),i.refresh(),i.trigger(x.extend(y,{phase:"after"}))}else{if(w={id:g.val(),text:g.val()},!0===(y=i.trigger({phase:"before",type:"new",target:i.el,originalEvent:e.originalEvent,item:w})).isCancelled)return;w=y.item,"function"==typeof i.onNew&&(m.length>=n.max&&0<n.max&&m.pop(),delete i.tmp.force_open,m.push(w),x(i.el).change(),g.val("").width(20),i.refresh()),i.trigger(x.extend(y,{phase:"after"}))}else w&&x(i.el).data("selected",w).val(w.text).change(),""===x(i.el).val()&&x(i.el).data("selected")&&x(i.el).removeData("selected").val("").change(),"list"===i.type&&(g.val(""),i.refresh()),i.tmp.force_hide=!0;break;case 8:case 46:if("enum"===i.type&&8===o&&""===g.val()&&0<m.length){var y;w=m[m.length-1];if(!0===(y=i.trigger({phase:"before",type:"remove",target:i.el,originalEvent:e.originalEvent,item:w})).isCancelled)return;m.pop(),x(i.el).trigger("input").trigger("change"),i.refresh(),i.trigger(x.extend(y,{phase:"after"}))}"list"===i.type&&""===g.val()&&(x(i.el).data("selected",{}).change(),i.refresh());break;case 38:for(n.index=w2utils.isInt(n.index)?parseInt(n.index):0,n.index--;0<n.index&&(n.items[n.index].hidden||n.items[n.index].disabled);)n.index--;if(0===n.index&&(n.items[n.index].hidden||n.items[n.index].disabled))for(;n.items[n.index]&&(n.items[n.index].hidden||n.items[n.index].disabled);)n.index++;v=!0;break;case 40:for(n.index=w2utils.isInt(n.index)?parseInt(n.index):-1,n.index++;n.index<n.items.length-1&&(n.items[n.index].hidden||n.items[n.index].disabled);)n.index++;if(n.index==n.items.length-1&&(n.items[n.index].hidden||n.items[n.index].disabled))for(;n.items[n.index]&&(n.items[n.index].hidden||n.items[n.index].disabled);)n.index--;""===g.val()&&0===x("#w2ui-overlay").length?i.tmp.force_open=!0:v=!0}if(v)return n.index<0&&(n.index=0),n.index>=n.items.length&&(n.index=n.items.length-1),i.updateOverlay(v),e.preventDefault(),void setTimeout(function(){if("enum"===i.type)(e=g.get(0)).setSelectionRange(e.value.length,e.value.length);else if("list"===i.type){var e;(e=g.get(0)).setSelectionRange(e.value.length,e.value.length)}else i.el.setSelectionRange(i.el.value.length,i.el.value.length)},0);"enum"===i.type&&g.width(8*(g.val().length+2)+"px")}},keyUp:function(e){if(-1!==["list","combo","enum"].indexOf(this.type)){if(x(this.el).prop("readonly")||x(this.el).prop("disabled"))return;if(-1==[16,17,18,20,37,39,91].indexOf(e.keyCode)){var t=x(this.helpers.focus).find("input");0===t.length&&(t=x(this.el));var i=this.trigger({phase:"before",type:"search",originalEvent:e,target:t,search:t.val()});if(!0===i.isCancelled)return;this.tmp.force_hide||this.request(),1==t.val().length&&this.refresh(),0!==x("#w2ui-overlay").length&&-1!=[38,40].indexOf(e.keyCode)||this.search(),this.trigger(x.extend(i,{phase:"after"}))}}},clearCache:function(){this.options.items=[],this.tmp.xhr_loading=!1,this.tmp.xhr_search="",this.tmp.xhr_total=-1},request:function(e){var r=this,l=this.options,d=x(r.el).val()||"";if(l.url){if("enum"===r.type){var t=x(r.helpers.multi).find("input");d=0===t.length?"":t.val()}if("list"===r.type){t=x(r.helpers.focus).find("input");d=0===t.length?"":t.val()}if(0!==l.minLength&&d.length<l.minLength)return l.items=[],void this.updateOverlay();if(null==e&&(e=l.interval),null==r.tmp.xhr_search&&(r.tmp.xhr_search=""),null==r.tmp.xhr_total&&(r.tmp.xhr_total=-1),l.url&&(0===l.items.length&&0!==r.tmp.xhr_total||r.tmp.xhr_total==l.cacheMax&&d.length>r.tmp.xhr_search.length||d.length>=r.tmp.xhr_search.length&&d.substr(0,r.tmp.xhr_search.length)!==r.tmp.xhr_search||d.length<r.tmp.xhr_search.length)){if(r.tmp.xhr)try{r.tmp.xhr.abort()}catch(e){}r.tmp.xhr_loading=!0,r.search(),clearTimeout(r.tmp.timeout),r.tmp.timeout=setTimeout(function(){var e=l.url,a={search:d,max:l.cacheMax};x.extend(a,l.postData);var t=r.trigger({phase:"before",type:"request",search:d,target:r.el,url:e,postData:a});if(!0!==t.isCancelled){var i={type:"GET",url:e=t.url,data:a=t.postData,dataType:"JSON"};l.method&&(i.type=l.method),"JSON"===w2utils.settings.dataType&&(i.type="POST",i.data=JSON.stringify(i.data),i.contentType="application/json"),"HTTPJSON"===w2utils.settings.dataType&&(i.data={request:JSON.stringify(i.data)}),null!=l.method&&(i.type=l.method),r.tmp.xhr=x.ajax(i).done(function(e,t,i){var n=r.trigger({phase:"before",type:"load",target:r.el,search:a.search,data:e,xhr:i});if(!0!==n.isCancelled)if("string"==typeof(e=n.data)&&(e=JSON.parse(e)),null==e.records&&null!=e.items&&(e.records=e.items,delete e.items),"success"===e.status&&null==e.records&&(e.records=[]),"success"===e.status&&Array.isArray(e.records)){e.records.length>l.cacheMax&&e.records.splice(l.cacheMax,1e5),null==l.recId&&null!=l.recid&&(l.recId=l.recid),(l.recId||l.recText)&&e.records.forEach(function(e){"string"==typeof l.recId&&(e.id=e[l.recId]),"function"==typeof l.recId&&(e.id=l.recId(e)),"string"==typeof l.recText&&(e.text=e[l.recText]),"function"==typeof l.recText&&(e.text=l.recText(e))}),r.tmp.xhr_loading=!1,r.tmp.xhr_search=d,r.tmp.xhr_total=e.records.length,r.tmp.lastError="",l.items=r.normMenu(e.records),""===d&&0===e.records.length?r.tmp.emptySet=!0:r.tmp.emptySet=!1;var o,s=x(r.el).data("find_selected");if(s)Array.isArray(s)?(o=[],s.forEach(function(t){var i=!1;l.items.forEach(function(e){(e.id==t||t&&t.id==e.id)&&(o.push(x.extend(!0,{},e)),i=!0)}),i||o.push(t)})):(o=s,l.items.forEach(function(e){(e.id==s||s&&s.id==e.id)&&(o=e)})),x(r.el).data("selected",o).removeData("find_selected").change();r.search(),r.trigger(x.extend(n,{phase:"after"}))}else console.log("ERROR: server did not return proper structure. It should return",{status:"success",records:[{id:1,text:"item"}]})}).fail(function(e,t,i){var n={status:t,error:i,rawResponseText:e.responseText},o=r.trigger({phase:"before",type:"error",target:r.el,search:d,error:n,xhr:e});if(!0!==o.isCancelled){if("abort"!==t){var s;try{s=x.parseJSON(e.responseText)}catch(e){}console.log("ERROR: Server communication failed.","\n EXPECTED:",{status:"success",records:[{id:1,text:"item"}]},"\n OR:",{status:"error",message:"error message"},"\n RECEIVED:","object"==typeof s?s:e.responseText)}r.tmp.xhr_loading=!1,r.tmp.xhr_search=d,r.tmp.xhr_total=0,r.tmp.emptySet=!0,r.tmp.lastError=o.error||"Server communication failed",l.items=[],r.clearCache(),r.search(),r.updateOverlay(!1),r.trigger(x.extend(o,{phase:"after"}))}}),r.trigger(x.extend(t,{phase:"after"}))}},e)}}},search:function(){var e=this,t=this.options,i=x(e.el).val(),n=e.el,o=[],s=x(e.el).data("selected");if("enum"===e.type)for(var a in n=x(e.helpers.multi).find("input"),i=n.val(),s)s[a]&&o.push(s[a].id);else if("list"===e.type)for(var a in n=x(e.helpers.focus).find("input"),i=n.val(),s)s[a]&&o.push(s[a].id);var r=t.items;if(!0!==e.tmp.xhr_loading){for(var l=0,d=0;d<r.length;d++){var u=r[d];if(null!=t.compare)"function"==typeof t.compare&&(u.hidden=!1===t.compare.call(this,u,i));else{var c="",p="";-1!==["is","begins"].indexOf(t.match)&&(c="^"),-1!==["is","ends"].indexOf(t.match)&&(p="$");try{new RegExp(c+i+p,"i").test(u.text)||"..."===u.text?u.hidden=!1:u.hidden=!0}catch(e){}}!1===t.filter&&(u.hidden=!1),"enum"===e.type&&-1!==x.inArray(u.id,o)&&(u.hidden=!0),!0!==u.hidden&&(l++,delete u.hidden)}for(t.index=-1;r[t.index]&&r[t.index].hidden;)t.index++;l<=0&&(t.index=-1),t.spinner=!1,e.updateOverlay(),setTimeout(function(){var e=x("#w2ui-overlay").html()||"";t.markSearch&&-1!==e.indexOf("$.fn.w2menuHandler")&&x("#w2ui-overlay").w2marker(i)},1)}else r.splice(0,t.cacheMax),t.spinner=!0,e.updateOverlay()},updateOverlay:function(e){var o=this,s=this.options;if("color"===this.type){if(x(o.el).prop("readonly")||x(o.el).prop("disabled"))return;x(this.el).w2color({color:x(this.el).val(),transparent:s.transparent,advanced:s.advanced},function(e){null!=e&&x(o.el).val(e).trigger("input").change()})}if("date"===this.type){if(x(o.el).prop("readonly")||x(o.el).prop("disabled"))return;0===x("#w2ui-overlay").length&&x(o.el).w2overlay('<div class="w2ui-reset w2ui-calendar"></div>',{css:{"background-color":"#f5f5f5"},onShow:function(e){w2utils.isIE&&(console.log("IE"),x(".w2ui-calendar").on("mousedown",function(e){var t=x(e.target);1===t.length&&"w2ui-jump-year"===t[0].id&&x("#w2ui-overlay").data("keepOpen",!0)}))}}),(a=w2utils.isDate(x(o.el).val(),o.options.format,!0))&&(t=a.getMonth()+1,n=a.getFullYear()),function i(e,t){x("#w2ui-overlay > div > div").html(o.getMonthHTML(e,t,x(o.el).val())),x("#w2ui-overlay .w2ui-calendar-title").on("mousedown",function(){var e,t;x(this).next().hasClass("w2ui-calendar-jump")?x(this).next().remove():(x(this).after('<div class="w2ui-calendar-jump" style=""></div>'),x(this).next().hide().html(o.getYearHTML()).fadeIn(200),setTimeout(function(){x("#w2ui-overlay .w2ui-calendar-jump").find(".w2ui-jump-month, .w2ui-jump-year").on("click",function(){x(this).hasClass("w2ui-jump-month")&&(x(this).parent().find(".w2ui-jump-month").removeClass("selected"),x(this).addClass("selected"),t=x(this).attr("name")),x(this).hasClass("w2ui-jump-year")&&(x(this).parent().find(".w2ui-jump-year").removeClass("selected"),x(this).addClass("selected"),e=x(this).attr("name")),null!=e&&null!=t&&(x("#w2ui-overlay .w2ui-calendar-jump").fadeOut(100),setTimeout(function(){i(parseInt(t)+1,e)},100))}),x("#w2ui-overlay .w2ui-calendar-jump >:last-child").prop("scrollTop",2e3)},1))}),x("#w2ui-overlay .w2ui-date").on("mousedown",function(){var e=x(this).attr("date");x(o.el).val(e).trigger("input").change(),x(this).css({"background-color":"#B6D5FB","border-color":"#aaa"})}).on("mouseup",function(){setTimeout(function(){0<x("#w2ui-overlay").length&&x("#w2ui-overlay").removeData("keepOpen")[0].hide()},10)}),x("#w2ui-overlay .previous").on("mousedown",function(){var e=o.options.current.split("/");e[0]=parseInt(e[0])-1,i(e[0],e[1])}),x("#w2ui-overlay .next").on("mousedown",function(){var e=o.options.current.split("/");e[0]=parseInt(e[0])+1,i(e[0],e[1])})}(t,n)}if("time"===this.type){if(x(o.el).prop("readonly")||x(o.el).prop("disabled"))return;0===x("#w2ui-overlay").length&&x(o.el).w2overlay('<div class="w2ui-reset w2ui-calendar-time" onclick="event.stopPropagation();"></div>',{css:{"background-color":"#fff"}});var i="h24"===this.options.format;x("#w2ui-overlay > div").html(o.getHourHTML()),x("#w2ui-overlay .w2ui-time").on("mousedown",function(e){x(this).css({"background-color":"#B6D5FB","border-color":"#aaa"});var t=x(this).attr("hour");x(o.el).val((12<t&&!i?t-12:t)+":00"+(i?"":t<12?" am":" pm")).trigger("input").change()}),null==this.options.noMinutes||!1===this.options.noMinutes?x("#w2ui-overlay .w2ui-time").on("mouseup",function(){var t=x(this).attr("hour");0<x("#w2ui-overlay").length&&x("#w2ui-overlay")[0].hide(),x(o.el).w2overlay('<div class="w2ui-reset w2ui-calendar-time"></div>',{css:{"background-color":"#fff"}}),x("#w2ui-overlay > div").html(o.getMinHTML(t)),x("#w2ui-overlay .w2ui-time").on("mousedown",function(){x(this).css({"background-color":"#B6D5FB","border-color":"#aaa"});var e=x(this).attr("min");x(o.el).val((12<t&&!i?t-12:t)+":"+(e<10?0:"")+e+(i?"":t<12?" am":" pm")).trigger("input").change()}).on("mouseup",function(){setTimeout(function(){0<x("#w2ui-overlay").length&&x("#w2ui-overlay").removeData("keepOpen")[0].hide()},10)})}):x("#w2ui-overlay .w2ui-time").on("mouseup",function(){setTimeout(function(){0<x("#w2ui-overlay").length&&x("#w2ui-overlay").removeData("keepOpen")[0].hide()},10)})}if("datetime"===this.type){if(x(o.el).prop("readonly")||x(o.el).prop("disabled"))return;var t,n,a;0<x("#w2ui-overlay .w2ui-time").length&&x("#w2ui-overlay")[0].hide(),0===x("#w2ui-overlay").length&&x(o.el).w2overlay('<div class="w2ui-reset w2ui-calendar" onclick="event.stopPropagation();"></div>',{css:{"background-color":"#f5f5f5"},onShow:function(e){w2utils.isIE&&(console.log("IE"),x(".w2ui-calendar").on("mousedown",function(e){var t=x(e.target);1===t.length&&"w2ui-jump-year"===t[0].id&&x("#w2ui-overlay").data("keepOpen",!0)}))}}),(a=w2utils.isDateTime(x(o.el).val(),o.options.format,!0))&&(t=a.getMonth()+1,n=a.getFullYear());var r=null;!function i(e,t){x("#w2ui-overlay > div > div").html(o.getMonthHTML(e,t,x(o.el).val())+(s.btn_now?'<div class="w2ui-calendar-now now">'+w2utils.lang("Current Date & Time")+"</div>":"")),x("#w2ui-overlay .w2ui-calendar-title").on("mousedown",function(){var e,t;x(this).next().hasClass("w2ui-calendar-jump")?x(this).next().remove():(x(this).after('<div class="w2ui-calendar-jump" style=""></div>'),x(this).next().hide().html(o.getYearHTML()).fadeIn(200),setTimeout(function(){x("#w2ui-overlay .w2ui-calendar-jump").find(".w2ui-jump-month, .w2ui-jump-year").on("click",function(){x(this).hasClass("w2ui-jump-month")&&(x(this).parent().find(".w2ui-jump-month").removeClass("selected"),x(this).addClass("selected"),t=x(this).attr("name")),x(this).hasClass("w2ui-jump-year")&&(x(this).parent().find(".w2ui-jump-year").removeClass("selected"),x(this).addClass("selected"),e=x(this).attr("name")),null!=e&&null!=t&&(x("#w2ui-overlay .w2ui-calendar-jump").fadeOut(100),setTimeout(function(){i(parseInt(t)+1,e)},100))}),x("#w2ui-overlay .w2ui-calendar-jump >:last-child").prop("scrollTop",2e3)},1))}),x("#w2ui-overlay .w2ui-date").on("mousedown",function(){var e=x(this).attr("date");x(o.el).val(e).trigger("input").change(),x(this).css({"background-color":"#B6D5FB","border-color":"#aaa"}),r=new Date(x(this).attr("data-date"))}).on("mouseup",function(){var i,t;0<x("#w2ui-overlay").length&&x("#w2ui-overlay")[0].hide(),x(o.el).w2overlay('<div class="w2ui-reset w2ui-calendar-time"></div>',{css:{"background-color":"#fff"}});o.options.format;x("#w2ui-overlay > div").html(o.getHourHTML()),x("#w2ui-overlay .w2ui-time").on("mousedown",function(e){x(this).css({"background-color":"#B6D5FB","border-color":"#aaa"}),i=x(this).attr("hour"),r.setHours(i);var t=w2utils.formatDateTime(r,o.options.format);x(o.el).val(t).trigger("input").change()}),null==o.options.noMinutes||!1===o.options.noMinutes?x("#w2ui-overlay .w2ui-time").on("mouseup",function(){var e=x(this).attr("hour");0<x("#w2ui-overlay").length&&x("#w2ui-overlay")[0].hide(),x(o.el).w2overlay('<div class="w2ui-reset w2ui-calendar-time"></div>',{css:{"background-color":"#fff"}}),x("#w2ui-overlay > div").html(o.getMinHTML(e)),x("#w2ui-overlay .w2ui-time").on("mousedown",function(){x(this).css({"background-color":"#B6D5FB","border-color":"#aaa"}),t=x(this).attr("min"),r.setHours(i,t);var e=w2utils.formatDateTime(r,o.options.format);x(o.el).val(e).trigger("input").change()}).on("mouseup",function(){setTimeout(function(){0<x("#w2ui-overlay").length&&x("#w2ui-overlay").removeData("keepOpen")[0].hide()},10)})}):x("#w2ui-overlay .w2ui-time").on("mouseup",function(){setTimeout(function(){0<x("#w2ui-overlay").length&&x("#w2ui-overlay").removeData("keepOpen")[0].hide()},10)})}),x("#w2ui-overlay .previous").on("mousedown",function(){var e=o.options.current.split("/");e[0]=parseInt(e[0])-1,i(e[0],e[1])}),x("#w2ui-overlay .next").on("mousedown",function(){var e=o.options.current.split("/");e[0]=parseInt(e[0])+1,i(e[0],e[1])}),x("#w2ui-overlay .now").on("mousedown",function(){var e=w2utils.formatDateTime(new Date,o.options.format);return x(o.el).val(e).trigger("input").change(),!1}).on("mouseup",function(){setTimeout(function(){0<x("#w2ui-overlay").length&&x("#w2ui-overlay").removeData("keepOpen")[0].hide()},10)})}(t,n)}if(-1!==["list","combo","enum"].indexOf(this.type)){var l=this.el,d=this.el;if("enum"===this.type&&(l=x(this.helpers.multi),d=x(l).find("input")),"list"===this.type){var u=x(d).data("selected");x.isPlainObject(u)&&!x.isEmptyObject(u)&&-1==s.index&&s.items.forEach(function(e,t){e.id===u.id&&(s.index=t)}),d=x(this.helpers.focus).find("input")}if(x(this.el).hasClass("has-focus")){if(!1===s.openOnFocus&&""===x(d).val()&&!0!==o.tmp.force_open)return void x().w2overlay();if(o.tmp.force_hide)return x().w2overlay(),void setTimeout(function(){delete o.tmp.force_hide},1);""!==x(d).val()&&delete o.tmp.force_open;var c=w2utils.lang("No matches");if(null!=s.url&&String(x(d).val()).length<s.minLength&&!0!==o.tmp.emptySet&&(c=s.minLength+" "+w2utils.lang("letters or more...")),null!=s.url&&""===x(d).val()&&!0!==o.tmp.emptySet&&(c=w2utils.lang(s.msgSearch||"Type to search...")),null==s.url&&0===s.items.length&&(c=w2utils.lang("Empty list")),null!=s.msgNoItems){var p={search:x(d).val(),options:x.extend(!0,{},s)};s.url&&(p.remote={url:s.url,empty:!!o.tmp.emptySet,error:o.tmp.lastError,minLength:s.minLength}),c="function"==typeof s.msgNoItems?s.msgNoItems(p):s.msgNoItems}o.tmp.lastError&&(c=o.tmp.lastError),c=c&&'<div style="white-space: normal; line-height: 1.3">'+c+"</div>";var h=x.extend(!0,{},s,{search:!1,render:s.renderDrop,maxHeight:s.maxDropHeight,maxWidth:s.maxDropWidth,msgNoItems:c,onSelect:function(i){if("enum"===o.type){var e=x(o.el).data("selected");if(i.item){var n,t=o.trigger({phase:"before",type:"add",target:o.el,originalEvent:i.originalEvent,item:i.item});if(!0===t.isCancelled)return;if(e.length>=s.max&&0<s.max&&e.pop(),delete i.item.hidden,e.push(i.item),x(o.el).data("selected",e).trigger("input").change(),x(o.helpers.multi).find("input").val("").width(20),o.refresh(),!0!==i.keepOpen)0<x("#w2ui-overlay").length&&x("#w2ui-overlay")[0].hide();else h.items.forEach(function(e,t){e.id==i.item.id&&(n=t)}),null!=n&&h.items.splice(n,1),h.selected=e,x(l).w2menu("refresh",h);o.trigger(x.extend(t,{phase:"after"}))}}else x(o.el).data("selected",i.item).val(i.item.text).trigger("input").change(),o.helpers.focus&&o.helpers.focus.find("input").val("")}});x(l).w2menu(e?"refresh-index":"refresh",h)}}},inRange:function(e,t){var i=!1;if("date"===this.type){if(h=w2utils.isDate(e,this.options.format,!0)){if(this.options.start||this.options.end){var n="string"==typeof this.options.start?this.options.start:x(this.options.start).val(),o="string"==typeof this.options.end?this.options.end:x(this.options.end).val(),s=w2utils.isDate(n,this.options.format,!0),a=w2utils.isDate(o,this.options.format,!0),r=new Date(h);a=a||r,(s=s||r)<=r&&r<=a&&(i=!0)}else i=!0;if(this.options.blocked&&-1!==x.inArray(e,this.options.blocked)&&(i=!1),null!==this.options.blockWeekDays&&void 0!==this.options.blockWeekDays&&null!=this.options.blockWeekDays.length)for(var l=this.options.blockWeekDays.length,d=0;d<l;d++)h.getDay()==this.options.blockWeekDays[d]&&(i=!1)}}else if("time"===this.type)if(this.options.start||this.options.end){var u=this.toMin(e),c=this.toMin(this.options.start),p=this.toMin(this.options.end);p=p||u,(c=c||u)<=u&&u<=p&&(i=!0)}else i=!0;else if("datetime"===this.type){var h;if(h=w2utils.isDateTime(e,this.options.format,!0)){if(this.options.start||this.options.end){if("object"==typeof this.options.start&&this.options.start instanceof Date)s=this.options.start;else s=""!==(n="string"==typeof this.options.start?this.options.start:x(this.options.start).val()).trim()?w2utils.isDateTime(n,this.options.format,!0):"";if("object"==typeof this.options.end&&this.options.end instanceof Date)a=this.options.end;else a=""!==(o="string"==typeof this.options.end?this.options.end:x(this.options.end).val()).trim()?w2utils.isDateTime(o,this.options.format,!0):"";r=h;s=s||r,a=a||r,t&&s instanceof Date&&(s.setHours(0),s.setMinutes(0),s.setSeconds(0)),s<=r&&r<=a&&(i=!0)}else i=!0;if(i&&this.options.blocked)for(d=0;d<this.options.blocked.length;d++){var f=this.options.blocked[d];if("string"==typeof f&&(f=w2utils.isDateTime(f,this.options.format,!0)),"object"==typeof f&&f instanceof Date&&f.getFullYear()==h.getFullYear()&&f.getMonth()==h.getMonth()&&f.getDate()==h.getDate()){i=!1;break}}}}return i},checkType:function(e,t){var i=this;switch(i.type){case"int":return!(!t||-1===["-",i.options.groupSymbol].indexOf(e))||w2utils.isInt(e.replace(i.options.numberRE,""));case"percent":e=e.replace(/%/g,"");case"float":return!(!t||-1===["-",w2utils.settings.decimalSymbol,i.options.groupSymbol].indexOf(e))||w2utils.isFloat(e.replace(i.options.numberRE,""));case"money":case"currency":return!(!t||-1===["-",i.options.decimalSymbol,i.options.groupSymbol,i.options.currencyPrefix,i.options.currencySuffix].indexOf(e))||w2utils.isFloat(e.replace(i.options.moneyRE,""));case"bin":return w2utils.isBin(e);case"hex":return w2utils.isHex(e);case"alphanumeric":return w2utils.isAlphaNumeric(e)}return!0},addPrefix:function(){var i=this;setTimeout(function(){if("clear"!==i.type){var e,t=x(i.el).data("tmp")||{};t["old-padding-left"]&&x(i.el).css("padding-left",t["old-padding-left"]),t["old-padding-left"]=x(i.el).css("padding-left"),x(i.el).data("tmp",t),i.helpers.prefix&&x(i.helpers.prefix).remove(),""!==i.options.prefix&&(x(i.el).before('<div class="w2ui-field-helper">'+i.options.prefix+"</div>"),(e=x(i.el).prev()).css({color:x(i.el).css("color"),"font-family":x(i.el).css("font-family"),"font-size":x(i.el).css("font-size"),"padding-top":x(i.el).css("padding-top"),"padding-bottom":x(i.el).css("padding-bottom"),"padding-left":x(i.el).css("padding-left"),"padding-right":0,"margin-top":parseInt(x(i.el).css("margin-top"),10)+2+"px","margin-bottom":parseInt(x(i.el).css("margin-bottom"),10)+1+"px","margin-left":x(i.el).css("margin-left"),"margin-right":0}).on("click",function(e){if(i.options.icon&&"function"==typeof i.onIconClick){var t=i.trigger({phase:"before",type:"iconClick",target:i.el,el:x(this).find("span.w2ui-icon")[0]});if(!0===t.isCancelled)return;i.trigger(x.extend(t,{phase:"after"}))}else"list"===i.type?x(i.helpers.focus).find("input").focus():x(i.el).focus()}),x(i.el).css("padding-left",e.width()+parseInt(x(i.el).css("padding-left"),10)+"px"),i.helpers.prefix=e)}},1)},addSuffix:function(){var t,i,o=this;setTimeout(function(){if("clear"!==o.type){var e=x(o.el).data("tmp")||{};e["old-padding-right"]&&x(o.el).css("padding-right",e["old-padding-right"]),e["old-padding-right"]=x(o.el).css("padding-right"),x(o.el).data("tmp",e),i=parseInt(x(o.el).css("padding-right"),10),o.options.arrows&&(o.helpers.arrows&&x(o.helpers.arrows).remove(),x(o.el).after('<div class="w2ui-field-helper" style="border: 1px solid transparent">&#160; <div class="w2ui-field-up" type="up"> <div class="arrow-up" type="up"></div> </div> <div class="w2ui-field-down" type="down"> <div class="arrow-down" type="down"></div> </div></div>'),(t=x(o.el).next()).css({color:x(o.el).css("color"),"font-family":x(o.el).css("font-family"),"font-size":x(o.el).css("font-size"),height:x(o.el).height()+parseInt(x(o.el).css("padding-top"),10)+parseInt(x(o.el).css("padding-bottom"),10)+"px",padding:0,"margin-top":parseInt(x(o.el).css("margin-top"),10)+1+"px","margin-bottom":0,"border-left":"1px solid silver"}).css("margin-left","-"+(t.width()+parseInt(x(o.el).css("margin-right"),10)+12)+"px").on("mousedown",function(t){var i=x("body");function n(e){x(o.el).focus(),o.keyDown(x.Event("keydown"),{keyCode:"up"===x(t.target).attr("type")?38:40}),!1!==e&&x("body").data("_field_update_timer",setTimeout(n,60))}i.on("mouseup",function e(){clearTimeout(i.data("_field_update_timer"));i.off("mouseup",e)}),i.data("_field_update_timer",setTimeout(n,700)),n(!1)}),i+=t.width()+12,x(o.el).css("padding-right",i+"px"),o.helpers.arrows=t),""!==o.options.suffix&&(o.helpers.suffix&&x(o.helpers.suffix).remove(),x(o.el).after('<div class="w2ui-field-helper">'+o.options.suffix+"</div>"),(t=x(o.el).next()).css({color:x(o.el).css("color"),"font-family":x(o.el).css("font-family"),"font-size":x(o.el).css("font-size"),"padding-top":x(o.el).css("padding-top"),"padding-bottom":x(o.el).css("padding-bottom"),"padding-left":"3px","padding-right":x(o.el).css("padding-right"),"margin-top":parseInt(x(o.el).css("margin-top"),10)+2+"px","margin-bottom":parseInt(x(o.el).css("margin-bottom"),10)+1+"px"}).on("click",function(e){"list"===o.type?x(o.helpers.focus).find("input").focus():x(o.el).focus()}),t.css("margin-left","-"+(w2utils.getSize(t,"width")+parseInt(x(o.el).css("margin-right"),10)+2)+"px"),i+=t.width()+3,x(o.el).css("padding-right",i+"px"),o.helpers.suffix=t)}},1)},addFocus:function(){var i,n=this;this.options;x(n.helpers.focus).remove();var e=parseInt(x(n.el).attr("tabIndex"));isNaN(e)||-1===e||(n.el._tabIndex=e),n.el._tabIndex&&(e=n.el._tabIndex),null==e&&(e=-1),isNaN(e)&&(e=0);var t="";null!=x(n.el).attr("id")&&(t='id="'+x(n.el).attr("id")+'_search"');var o='<div class="w2ui-field-helper"> <div class="w2ui-icon icon-search" style="opacity: 0; display: none"></div> <input '+t+' type="text" tabIndex="'+e+'" autocapitalize="off" autocomplete="off" autocorrect="off" spellcheck="false"/></div>';x(n.el).attr("tabindex",-1).before(o);var s=x(n.el).prev();(n.helpers.focus=s).css({width:x(n.el).width(),"margin-top":x(n.el).css("margin-top"),"margin-left":parseInt(x(n.el).css("margin-left"))+parseInt(x(n.el).css("padding-left"))+"px","margin-bottom":x(n.el).css("margin-bottom"),"margin-right":x(n.el).css("margin-right")}).find("input").css({cursor:"default",width:"100%",outline:"none",opacity:1,margin:0,border:"1px solid transparent",padding:x(n.el).css("padding-top"),"padding-left":0,"margin-left":0,"background-color":"transparent"}),s.find("input").on("click",function(e){0===x("#w2ui-overlay").length&&n.focus(e),e.stopPropagation()}).on("focus",function(e){i=x(n.el).attr("placeholder"),x(n.el).css({outline:"auto 5px #7DB4F3","outline-offset":"-2px"}),x(this).val(""),x(n.el).triggerHandler("focus"),e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}).on("blur",function(e){x(n.el).css("outline","none"),x(this).val(""),n.refresh(),x(n.el).triggerHandler("blur"),e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,null!=i&&x(n.el).attr("placeholder",i)}).on("keydown",function(e){var t=this;n.keyDown(e),setTimeout(function(){""===t.value?x(n.el).attr("placeholder",i):x(n.el).attr("placeholder","")},10)}).on("keyup",function(e){n.keyUp(e)}).on("keypress",function(e){n.keyPress(e)}),s.on("click",function(e){x(this).find("input").focus()}),n.refresh()},addMulti:function(){var o=this;this.options;x(o.helpers.multi).remove();var e="",t="margin-top : 0px; margin-bottom : 0px; margin-left : "+x(o.el).css("margin-left")+"; margin-right : "+x(o.el).css("margin-right")+"; width : "+(w2utils.getSize(o.el,"width")-parseInt(x(o.el).css("margin-left"),10)-parseInt(x(o.el).css("margin-right"),10))+"px;",i="";if(null!=x(o.el).attr("id")&&(i='id="'+x(o.el).attr("id")+'_search" '),"enum"===o.type){var n=x(o.el).attr("tabIndex");n&&-1!==n&&(o.el._tabIndex=n),o.el._tabIndex&&(n=o.el._tabIndex),null==n&&(n=0),e='<div class="w2ui-field-helper w2ui-list" style="'+t+'; box-sizing: border-box"> <div style="padding: 0px; margin: 0px; display: inline-block" class="w2ui-multi-items"> <ul> <li style="padding-left: 0px; padding-right: 0px" class="nomouse"> <input '+i+' type="text" style="width: 20px; margin: -3px 0 0; padding: 2px 0; border-color: white" autocapitalize="off" autocomplete="off" autocorrect="off" spellcheck="false"'+(x(o.el).prop("readonly")?' readonly="readonly"':"")+(x(o.el).prop("disabled")?' disabled="disabled"':"")+' tabindex="'+n+'"/> </li> </ul> </div></div>'}"file"===o.type&&(e='<div class="w2ui-field-helper w2ui-list" style="'+t+'; box-sizing: border-box"> <div style="position: absolute; left: 0px; right: 0px; top: 0px; bottom: 0px;"> <input '+i+' name="attachment" class="file-input" type="file" style="width: 100%; height: 100%; opacity: 0;" tabindex="-1"'+(1!==o.options.max?' multiple="multiple"':"")+(x(o.el).prop("readonly")?' readonly="readonly"':"")+(x(o.el).prop("disabled")?' disabled="disabled"':"")+(x(o.el).attr("accept")?' accept="'+x(o.el).attr("accept")+'"':"")+'/> </div> <div style="position: absolute; padding: 0px; margin: 0px; display: inline-block" class="w2ui-multi-items"> <ul><li style="padding-left: 0px; padding-right: 0px" class="nomouse"></li></ul> </div></div>');var s=x(o.el).data("tmp")||{};s["old-background-color"]=x(o.el).css("background-color"),s["old-border-color"]=x(o.el).css("border-color"),x(o.el).data("tmp",s),x(o.el).before(e).css({"background-color":"transparent","border-color":"transparent"});var a=x(o.el).prev();o.helpers.multi=a,"enum"===o.type&&(x(o.el).attr("tabindex",-1),a.find("input").on("click",function(e){0===x("#w2ui-overlay").length&&o.focus(e),x(o.el).triggerHandler("click")}).on("focus",function(e){x(a).css({outline:"auto 5px #7DB4F3","outline-offset":"-2px"}),x(o.el).triggerHandler("focus"),e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}).on("blur",function(e){x(a).css("outline","none"),x(o.el).triggerHandler("blur"),e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}).on("keyup",function(e){o.keyUp(e)}).on("keydown",function(e){o.keyDown(e)}).on("keypress",function(e){o.keyPress(e)}),a.on("click",function(e){x(this).find("input").focus()})),"file"===o.type&&(x(o.el).css("outline","none"),a.find("input").off(".drag").on("click.drag",function(e){e.stopPropagation(),x(o.el).prop("readonly")||x(o.el).prop("disabled")||x(o.el).focus()}).on("dragenter.drag",function(e){x(o.el).prop("readonly")||x(o.el).prop("disabled")||x(a).addClass("w2ui-file-dragover")}).on("dragleave.drag",function(e){x(o.el).prop("readonly")||x(o.el).prop("disabled")||x(a).removeClass("w2ui-file-dragover")}).on("drop.drag",function(e){if(!x(o.el).prop("readonly")&&!x(o.el).prop("disabled")){x(a).removeClass("w2ui-file-dragover");for(var t=e.originalEvent.dataTransfer.files,i=0,n=t.length;i<n;i++)o.addFile.call(o,t[i]);x(o.el).focus(),e.preventDefault(),e.stopPropagation()}}).on("dragover.drag",function(e){e.preventDefault(),e.stopPropagation()}).on("change.drag",function(){if(x(o.el).focus(),void 0!==this.files)for(var e=0,t=this.files.length;e<t;e++)o.addFile.call(o,this.files[e])})),o.refresh()},addFile:function(e){var t,n=this,i=this.options,o=x(n.el).data("selected"),s={name:e.name,type:e.type,modified:e.lastModifiedDate,size:e.size,content:null,file:e},a=0,r=0;if(o)for(var l=0;l<o.length;l++){if(o[l].name==e.name&&o[l].size==e.size)return;a+=o[l].size,r++}var d=n.trigger({phase:"before",type:"add",target:n.el,file:s,total:r,totalSize:a});if(!0!==d.isCancelled){if(0!==i.maxFileSize&&s.size>i.maxFileSize)return t="Maximum file size is "+w2utils.formatSize(i.maxFileSize),!1===i.silent&&x(n.el).w2tag(t),void console.log("ERROR: "+t);if(0!==i.maxSize&&a+s.size>i.maxSize)return t=w2utils.lang("Maximum total size is")+" "+w2utils.formatSize(i.maxSize),void(!1===i.silent?x(n.el).w2tag(t):console.log("ERROR: "+t));if(0!==i.max&&r>=i.max)return t=w2utils.lang("Maximum number of files is")+" "+i.max,void(!1===i.silent?x(n.el).w2tag(t):console.log("ERROR: "+t));if(o.push(s),"undefined"!=typeof FileReader&&!0===i.readContent){var u=new FileReader;u.onload=function(e){var t=e.target.result,i=t.indexOf(",");s.content=t.substr(i+1),n.refresh(),x(n.el).trigger("input").trigger("change"),n.trigger(x.extend(d,{phase:"after"}))},u.readAsDataURL(e)}else n.refresh(),x(n.el).trigger("input").trigger("change"),n.trigger(x.extend(d,{phase:"after"}))}},normMenu:function(e,t){if(x.isArray(e)){for(var i=0;i<e.length;i++)"string"==typeof e[i]?e[i]={id:e[i],text:e[i]}:null!=e[i]?(null!=e[i].text&&null==e[i].id&&(e[i].id=e[i].text),null==e[i].text&&null!=e[i].id&&(e[i].text=e[i].id),null!=e[i].caption&&(e[i].text=e[i].caption)):e[i]={id:null,text:"null"};return e}if("function"==typeof e)return w2obj.field.prototype.normMenu.call(this,e.call(this,t));if("object"==typeof e){var n=[];for(var i in e)n.push({id:i,text:e[i]});return n}},getMonthHTML:function(e,t,i){var n=new Date,o=w2utils.settings.fullmonths,s=["31","28","31","30","31","30","31","31","30","31","30","31"],a=n.getFullYear()+"/"+(Number(n.getMonth())+1)+"/"+n.getDate(),r=w2utils.settings.fulldays.slice(),l=w2utils.settings.shortdays.slice();"M"!==w2utils.settings.weekStarts&&(r.unshift(r.pop()),l.unshift(l.pop()));var d=this.options;null==d&&(d={}),t=w2utils.isInt(t)?parseInt(t):n.getFullYear(),12<(e=w2utils.isInt(e)?parseInt(e):n.getMonth()+1)&&(e-=12,t++),(e<1||0===e)&&(e+=12,t--),t/4==Math.floor(t/4)?s[1]="29":s[1]="28",d.current=e+"/"+t;for(var u=(n=new Date(t,e-1,1)).getDay(),c="",p=0;p<l.length;p++)c+='<td title="'+r[p]+'">'+l[p]+"</td>";var h='<div class="w2ui-calendar-title title"> <div class="w2ui-calendar-previous previous"> <div></div> </div> <div class="w2ui-calendar-next next"> <div></div> </div> '+o[e-1]+", "+t+'</div><table class="w2ui-calendar-days" cellspacing="0"><tbody> <tr class="w2ui-day-title">'+c+"</tr> <tr>",f=1;if("M"!==w2utils.settings.weekStarts&&u++,"datetime"===this.type){var m=w2utils.isDateTime(i,d.format,!0);i=w2utils.formatDate(m,w2utils.settings.dateFormat)}for(var g=1;g<43;g++){if(0===u&&1==g){for(var v=0;v<6;v++)h+='<td class="w2ui-day-empty">&#160;</td>';g+=6}else if(g<u||f>s[e-1]){h+='<td class="w2ui-day-empty">&#160;</td>',g%7==0&&(h+="</tr><tr>");continue}var w=t+"/"+e+"/"+f,y=new Date(w),x="";6===y.getDay()&&(x=" w2ui-saturday"),0===y.getDay()&&(x=" w2ui-sunday"),w==a&&(x+=" w2ui-today");var b,k,T=f,C="",S="";if(k="datetime"===this.type?(b=w2utils.formatDateTime(w,d.format),w2utils.formatDate(w,w2utils.settings.dateFormat)):b=w2utils.formatDate(w,d.format),d.colored&&void 0!==d.colored[k]){var D=d.colored[k].split(":");S="background-color: "+D[0]+";",C="color: "+D[1]+";"}h+='<td class="'+(this.inRange(b,!0)?"w2ui-date "+(k==i?"w2ui-date-selected":""):"w2ui-blocked")+x+'" style="'+C+S+'" date="'+b+'" data-date="'+y+'">'+T+"</td>",(g%7==0||0===u&&1==g)&&(h+="</tr><tr>"),f++}return h+="</tr></tbody></table>"},getYearHTML:function(){for(var e=w2utils.settings.shortmonths,t=w2utils.settings.dateStartYear,i=w2utils.settings.dateEndYear,n="",o="",s=0;s<e.length;s++)n+='<div class="w2ui-jump-month" name="'+s+'">'+e[s]+"</div>";for(var a=t;a<=i;a++)o+='<div class="w2ui-jump-year" name="'+a+'">'+a+"</div>";return'<div id="w2ui-jump-month">'+n+'</div><div id="w2ui-jump-year">'+o+"</div>"},getHourHTML:function(){var e=[],t=this.options;null==t&&(t={format:w2utils.settings.timeFormat});for(var i=-1<t.format.indexOf("h24"),n=0;n<24;n++){var o=(12<=n&&!i?n-12:n)+":00"+(i?"":n<12?" am":" pm");12!=n||i||(o="12:00 pm"),e[Math.floor(n/8)]||(e[Math.floor(n/8)]="");var s=this.fromMin(this.toMin(o)),a=this.fromMin(this.toMin(o)+59);if("datetime"===this.type){var r=w2utils.isDateTime(this.el.value,t.format,!0),l=t.format.split("|")[0].trim();s=w2utils.formatDate(r,l)+" "+s,a=w2utils.formatDate(r,l)+" "+a}e[Math.floor(n/8)]+='<div class="'+(this.inRange(s)||this.inRange(a)?"w2ui-time ":"w2ui-blocked")+'" hour="'+n+'">'+o+"</div>"}return'<div class="w2ui-calendar"> <div class="w2ui-calendar-title">'+w2utils.lang("Select Hour")+'</div> <div class="w2ui-calendar-time"><table><tbody><tr> <td>'+e[0]+"</td> <td>"+e[1]+"</td> <td>"+e[2]+"</td> </tr></tbody></table></div></div>"},getMinHTML:function(e){null==e&&(e=0);var t=this.options;null==t&&(t={format:w2utils.settings.timeFormat});for(var i=-1<t.format.indexOf("h24"),n=[],o=0;o<60;o+=5){var s=(12<e&&!i?e-12:e)+":"+(o<10?0:"")+o+" "+(i?"":e<12?"am":"pm"),a=s,r=o<20?0:o<40?1:2;if(n[r]||(n[r]=""),"datetime"===this.type){var l=w2utils.isDateTime(this.el.value,t.format,!0),d=t.format.split("|")[0].trim();a=w2utils.formatDate(l,d)+" "+a}n[r]+='<div class="'+(this.inRange(a)?"w2ui-time ":"w2ui-blocked")+'" min="'+o+'">'+s+"</div>"}return'<div class="w2ui-calendar"> <div class="w2ui-calendar-title">'+w2utils.lang("Select Minute")+'</div> <div class="w2ui-calendar-time"><table><tbody><tr> <td>'+n[0]+"</td> <td>"+n[1]+"</td> <td>"+n[2]+"</td> </tr></tbody></table></div></div>"},toMin:function(e){if("string"!=typeof e)return null;var t=e.split(":");return 2!==t.length?null:(t[0]=parseInt(t[0]),t[1]=parseInt(t[1]),-1!==e.indexOf("pm")&&12!==t[0]&&(t[0]+=12),60*t[0]+t[1])},fromMin:function(e){1440<=e&&(e%=1440),e<0&&(e=1440+e);var t=Math.floor(e/60),i=(e%60<10?"0":"")+e%60,n=this.options;return null==n&&(n={format:w2utils.settings.timeFormat}),-1!==n.format.indexOf("h24")?t+":"+i:(t<=12?t:t-12)+":"+i+" "+(12<=t?"pm":"am")}},x.extend(o.prototype,w2utils.event),w2obj.field=o}(jQuery);