PrimeFacesExt={getRequestUrlExtension:function(){return PrimeFacesExt.getUrlExtension(location.href)},getUrlExtension:function(a){return(a=a.substr(1+a.lastIndexOf("/")).split("?")[0]).substr(a.lastIndexOf("."))},getFacesResource:function(a,b,c){var d=PrimeFacesExt.getPrimeFacesExtensionsScriptURI(),d=d.replace("/primefaces-extensions.js",a),d=PrimeFacesExt.useUncompressedResources?d.replace("ln="+PrimeFacesExt.RESOURCE_LIBRARY_UNCOMPRESSED,"ln="+b):d.replace("ln="+PrimeFacesExt.RESOURCE_LIBRARY,
"ln="+b),a=/[?&]v=([^&]*)/.exec(d)[1],d=c?d.replace("v="+a,"v="+c):d.replace("v="+a,"");return location.protocol+"//"+location.host+d},getPrimeFacesExtensionsVersion:function(){if(!PrimeFacesExt.VERSION){var a=PrimeFacesExt.getPrimeFacesExtensionsScriptURI();PrimeFacesExt.VERSION=/[?&]v=([^&]*)/.exec(a)[1]}return PrimeFacesExt.VERSION},getPrimeFacesExtensionsResource:function(a){var b=PrimeFacesExt.RESOURCE_LIBRARY;PrimeFacesExt.useUncompressedResources&&(b=PrimeFacesExt.RESOURCE_LIBRARY_UNCOMPRESSED);
return PrimeFacesExt.getFacesResource(a,b,PrimeFacesExt.getPrimeFacesExtensionsVersion())},getPrimeFacesExtensionsCompressedResource:function(a){return PrimeFacesExt.getFacesResource(a,PrimeFacesExt.RESOURCE_LIBRARY,PrimeFacesExt.getPrimeFacesExtensionsVersion())},isExtensionMapping:function(){if(!PrimeFacesExt.IS_EXTENSION_MAPPING){var a=PrimeFacesExt.getPrimeFacesExtensionsScriptURI();PrimeFacesExt.IS_EXTENSION_MAPPING="."===a.charAt(a.indexOf("primefaces-extensions.js")+24)}return PrimeFacesExt.IS_EXTENSION_MAPPING},
getResourceUrlExtension:function(){if(!PrimeFacesExt.RESOURCE_URL_EXTENSION){var a=PrimeFacesExt.getPrimeFacesExtensionsScriptURI();PrimeFacesExt.RESOURCE_URL_EXTENSION=/primefaces-extensions.js.([^?]*)/.exec(a)[1]}return PrimeFacesExt.RESOURCE_URL_EXTENSION},useUncompressedResources:function(){if(!PrimeFacesExt.USE_UNCOMPRESSED_RESOURCES){var a=PrimeFacesExt.getPrimeFacesExtensionsScriptURI();PrimeFacesExt.USE_UNCOMPRESSED_RESOURCES=-1!==a.indexOf(RESOURCE_LIBRARY_UNCOMPRESSED)}return PrimeFacesExt.USE_UNCOMPRESSED_RESOURCES},
getPrimeFacesExtensionsScriptURI:function(){PrimeFacesExt.SCRIPT_URI||(PrimeFacesExt.SCRIPT_URI=$('script[src*="'+PrimeFacesExt.RESOURCE_IDENTIFIER+'/primefaces-extensions.js"]').attr("src"));return PrimeFacesExt.SCRIPT_URI},getScript:function(a,b,c){$.ajax({type:"GET",url:a,success:b,dataType:"script",cache:c})},cw:function(a,b,c,d){PrimeFacesExt.createWidget(a,b,c,d)},createWidget:function(a,b,c,d){if(PrimeFacesExt.widget[a])PrimeFacesExt.initWidget(a,b,c);else{if(!0===d)if(d=PrimeFacesExt.getPrimeFacesExtensionsResource("/"+
a.toLowerCase()+"/"+a.toLowerCase()+".css"),$.browser.msie){for(var e,f=0;f<document.styleSheets.length;f++)-1!==document.styleSheets[f].href.toString().indexOf("ln=primefaces")&&(e=f+1);e?document.createStyleSheet(d,e):PrimeFaces.error("No style sheet from PrimeFaces or PrimeFaces Extensions included. StyleSheet for PrimeFaces Extensions Widget "+a+" will not be added.")}else e=$('link[href*="ln=primefaces"]:last'),0<e.length?e.after('<link type="text/css" rel="stylesheet" href="'+d+'" />'):PrimeFaces.error("No style sheet from PrimeFaces or PrimeFaces Extensions included. StyleSheet for PrimeFaces Extensions Widget "+
a+" will not be added.");d=PrimeFacesExt.getPrimeFacesExtensionsResource("/"+a.toLowerCase()+"/"+a.toLowerCase()+".js");PrimeFacesExt.getScript(d,function(){PrimeFacesExt.initWidget(a,b,c)},!0)}},initWidget:function(a,b,c){window[b]?window[b].refresh(c):window[b]=new PrimeFacesExt.widget[a](c)},configureLocale:function(a,b){if(PrimeFacesExt.locales&&PrimeFacesExt.locales[a]&&b.locale){var c=PrimeFacesExt.locales[a][b.locale];if(c)for(var d in c)c.hasOwnProperty(d)&&(b[d]=c[d])}return b},removeWidgetScript:function(a){$(PrimeFaces.escapeClientId(a)+
"_s").remove()},handleInitialize:function(a,b){var c=function(){return b.apply(a,arguments)};if(a.jq.is(":visible"))a.widgetInitialized=!0,c();else{var d=a.jq.parents(".ui-hidden-container:first").data("widget");d&&d.addOnshowHandler(function(){!a.widgetInitialized&&a.jq.is(":visible")&&(a.widgetInitialized=!0,c())})}},RESOURCE_IDENTIFIER:"/javax.faces.resource",RESOURCE_LIBRARY:"primefaces-extensions",RESOURCE_LIBRARY_UNCOMPRESSED:"primefaces-extensions-uncompressed",behavior:{},widget:{},locales:{}};
PrimeFacesExt.locales.TimePicker={};PrimeFacesExt.locales.Timeline={};PrimeFacesExt.behavior.Javascript=function(a,b){return a.execute.call(this,a.source,a.event,a.params,b)};PrimeFacesExt.getAjaxErrorHandlerInstance=function(){if(!PrimeFacesExt.AJAX_ERROR_HANDLER_INSTANCE){var a=new PrimeFacesExt.widget.AjaxErrorHandler;PrimeFacesExt.AJAX_ERROR_HANDLER_INSTANCE=a}return PrimeFacesExt.AJAX_ERROR_HANDLER_INSTANCE};
PrimeFacesExt.widget.AjaxErrorHandler=PrimeFaces.widget.BaseWidget.extend({DEFAULT_HOSTNAME:"???unknown???",init:function(){this.popupWindowMask=this.popupWindowRoot=this.popupWindow=null;this.hostname=this.DEFAULT_HOSTNAME;this.settings=this.defaultSettings={title:"{error-name}",body:"{error-message}",button:"Reload",buttonOnclick:function(){document.location.href=document.location.href},onerror:function(){}};this.otherSettings={};this.overwritePrimeFacesAjaxResponse()},overwritePrimeFacesAjaxResponse:function(){var a=
this;a.isOveritedAjaxResponse||(a.isOveritedAjaxResponse=!0,a.isOveritedAjaxResponse=!0,$(document).ajaxComplete(function(b,c,d,e){try{if(b=e,!b&&(c&&c.responseXML)&&(b=c.responseXML),c=null,b&&(c=b.getElementsByTagName("error")),c&&c.length&&c[0].childNodes&&c[0].childNodes.length){b={};for(e=0;e<c[0].childNodes.length;e++){var f=c[0].childNodes[e],h=f.nodeName,g=f.nodeValue;f.childNodes&&f.childNodes.length&&(g=f.childNodes[0].nodeValue);b[h]=g}if(b["error-name"]){var i=a.findErrorSettings(b["error-name"]);
if(i.onerror&&!1===i.onerror.call(this,b,d))return!0;b.updateCustomContent&&"<exception />"==b.updateCustomContent.substring(-13)&&(b.updateCustomContent=null);b.updateTitle&&"<exception />"==b.updateTitle.substring(-13)&&(b.updateTitle=null);b.updateBody&&"<exception />"==b.updateBody.substring(-13)&&(b.updateBody=null);b.updateViewState&&"<exception />"==b.updateViewState.substring(-13)&&(b.updateViewState=null);i.updateCustomContent=b.updateCustomContent;i.updateTitle=b.updateTitle;i.updateBody=
b.updateBody;i.updateViewState=b.updateViewState;var s=a.replaceVariables(i,b);a.show(s);return!0}}}catch(o){try{console.error("Unknown response in AjaxExceptionHandler:",o)}catch(p){}}}))},isVisible:function(){return this.popupWindow&&this.popupWindow.isVisible()},hide:function(){this.dialogWidget&&(this.dialogWidget.hide(),this.dialogWidget=null,this.dialog.remove())},show:function(a){this.hide();this.dialog=$('<div id="ajaxErrorHandlerDialog" class="ui-dialog ui-widget ui-widget-content ui-overlay-hidden ui-corner-all ui-shadow pe-ajax-error-handler" style="width: auto; height: auto;"></div>');
$("body").append(this.dialog);if(a.updateCustomContent)this.dialog.append(a.updateCustomContent);else{var b=$('<div class="ui-dialog-titlebar ui-widget-header ui-helper-clearfix ui-corner-top"></div>'),c=$('<span class="ui-dialog-title"></span>'),d=$('<div class="ui-dialog-content ui-widget-content" style="height: auto;"></div>'),e=$('<div class="ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"></div>');b.append(c);this.dialog.append(b);this.dialog.append(d);this.dialog.append(e);var b=
$('<button class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"><span class="ui-button-text">'+a.button+"</span></button>"),f=a.buttonOnclick;b.click(function(){f.call(this)});e.append(b);a.updateTitle?c.append(a.updateTitle):c.append(a.title);a.updateBody?d.append(a.updateBody):d.append(a.body)}this.dialogWidget=new PrimeFaces.widget.Dialog({id:"ajaxErrorHandlerDialog",resizable:!0,draggable:!0,modal:!0});this.dialogWidget.show()},getDefaultErrorTime:function(){return(new Date).toString()},
findErrorSettings:function(a){if(!a)return jQuery.extend({},this.settings);this.otherSettings[a]||jQuery.extend({},this.settings);return jQuery.extend({},this.settings,this.otherSettings[a])},addErrorSettings:function(a){a&&(a.type?this.otherSettings[a.type]=jQuery.extend({},this.otherSettings[a.type]||{},a):this.settings=jQuery.extend({},this.settings,a))},replaceAll:function(a,b,c){for(var d;(d=a.replace(b,c))!=a;)a=d;return a},replaceVariables:function(a,b){if(!a)return text;var b=jQuery.extend({"error-hostname":this.hostname,
"error-stacktrace":"","error-time":this.getDefaultErrorTime()},b),c={};jQuery.each(a,$.proxy(function(a,e){"string"==typeof e&&jQuery.each(b,$.proxy(function(a,b){e=this.replaceAll(e,"{"+a+"}",b.replace(/\n/g,"<br />"))},this));c[a]=e},this));return c},setHostname:function(a){this.hostname=a}});PrimeFacesExt.widget.Spotlight=PrimeFaces.widget.BaseWidget.extend({init:function(a){this.id=a.id;this.blocked=a.blocked;this.content=$(PrimeFaces.escapeClientId(this.id));PrimeFacesExt.widget.Spotlight.cache=PrimeFacesExt.widget.Spotlight.cache||{};this.getMask=function(){var a=PrimeFacesExt.widget.Spotlight.cache["PrimeFacesExt.widget.Spotlight.MaskAround:"+this.id];a||(a=new PrimeFacesExt.widget.Spotlight.MaskAround(this.id),PrimeFacesExt.widget.Spotlight.cache["PrimeFacesExt.widget.Spotlight.MaskAround:"+
this.id]=a);return(this.getMask=function(){return a})()};this.block=function(){this.blocked=!0;this.getMask().show();this.enableModality()};this.unblock=function(){this.blocked=!1;this.getMask().hide();this.disableModality()};this.blocked?this.block():this.unblock();PrimeFacesExt.removeWidgetScript(this.id)},enableModality:function(){this.disableModality();this.content.bind("keydown.lightspot",function(a){if(a.keyCode===$.ui.keyCode.TAB){var c=$(":tabbable",this),d=c.filter(":first"),c=c.filter(":last");
if(a.target===c[0]&&!a.shiftKey)return d.focus(1),!1;if(a.target===d[0]&&a.shiftKey)return c.focus(1),!1}});var a=$(":focus",this.content);(!a||!a.length)&&$(":tabbable",this.content).filter(":first").focus(1)},disableModality:function(){this.content.unbind(".lightspot")},block:function(){this.block()},unblock:function(){this.unblock()}});
PrimeFacesExt.widget.Spotlight.MaskAround=function(a){var b=a+"_maskAround",c=$('<div class="ui-widget-overlay"></div>');$("body").append(c);var d=c.css("opacity");c.remove();var c=function(c,e){var f=b+c,g=$(PrimeFaces.escapeClientId(f)).is(":visible"),i=function(){var c=$(PrimeFaces.escapeClientId(f));if(!c||!c.length)c=$('<div id="'+f+'" />'),c.css({position:!$.browser.webkit?"fixed":"absolute",top:0,left:0,display:"none",zIndex:e,overflow:"hidden",border:"none"}),c.append($('<div class="ui-widget-overlay" style="position:absolute;"></div>').css("opacity",
1)),$("body").append(c),c.click(function(){var c=$(PrimeFaces.escapeClientId(a));$(":tabbable",c).filter(":first").focus(1)});return c},h=function(){var a=$(PrimeFaces.escapeClientId(f));return!a||!a.length?!1:a.is(":visible")},j=function(){if(g){if(!h()){var a=i();a.css("zIndex",e);a.fadeTo("fast",d,j)}}else h()?i().fadeOut("fast",function(){j()}):(a=$(PrimeFaces.escapeClientId(f)),a=!a||!a.length?!1:!0,a&&i().remove())};return{updatePosition:function(a,c,b,d){if("fixed"==i().css("position"))var e=
$(window).scrollLeft(),f=$(window).scrollTop(),a=a-e,b=b-e,c=c-f,d=d-f;$('<div class="ui-widget-overlay"></div>');e=i();e.css({left:a,top:c,width:b-a,height:d-c});b=s();$(e.children()[0]).css({left:0-a,top:0-c,height:b.height,width:b.width})},show:function(a){g=!0;e=a;j()},hide:function(){g=!1;j()}}},e=++PrimeFaces.zindex,f=new c("_top",e),h=new c("_left",e),g=new c("_bottom",e),i=new c("_right",e),s=function(){var a=$(window).width(),c=$(window).height(),b=$(document).width(),d=$(document).height();
return{width:a>b?a:b,height:c>d?c:d}},o=!1,p=null;$(window).bind("resize",function(){p&&clearTimeout(p);p=setTimeout(t,100)});var t=function(){if(!0===o){for(var c=s(),b=c.width,c=c.height,d=$(PrimeFaces.escapeClientId(a)),e=d.offset().left,m=d.offset().top,q=e+d.outerWidth(),j=m+d.outerHeight(),l=d.parent();0<l.length&&"HTML"!=l[0].tagName;){var k=l.css("overflow");if(("auto"==k||"hidden"==k||"scroll"==k)&&0<l.height())k=l.offset(),e<k.left&&(e=k.left),m<k.top&&(m=k.top),q>k.left+l.outerWidth()&&
(q=k.left+l.outerWidth()),j>k.top+l.outerHeight()&&(j=k.top+l.outerHeight());l=l.parent()}0>e&&(e=0);0>m&&(m=0);q<e&&(q=e);j<m&&(j=m);if(0<d.outerHeight()&&5>=j-m)try{var n=$(PrimeFaces.escapeClientId(a)+" :focusable");if(2>n.length){var r=$('<a href="#"> </a>');d.append(r);r.focus();r.remove()}else $(n[1]).focus();$(n[0]).focus()}catch(p){}n=0;r=$.browser.msie&&document.documentMode&&!window.performance?!0:!1;r&&(n=1);f.updatePosition(0,0,b-0,m-0);g.updatePosition(0,j-0,b-0,c-0);h.updatePosition(0,
m-0+n,e-0,j-0-n);i.updatePosition(q-0,m-0+n,b-0,j-0-n);setTimeout(t,150)}};return{show:function(){o=!0;t();var a=++PrimeFaces.zindex;f.show(a);g.show(a);h.show(a);i.show(a)},hide:function(){o=!1;f.hide();g.hide();h.hide();i.hide()}}};CKEDITOR_GETURL=function(a){if(-1!==a.indexOf("?resolve=false"))a=a.replace("?resolve=false","");else{var b=a.indexOf("v="+PrimeFacesExt.getPrimeFacesExtensionsVersion());if(-1!==b){if(b=a.substring(b+("v="+PrimeFacesExt.getPrimeFacesExtensionsVersion()).length),0<b.length)var a=a.substring(0,a.length-b.length),c=a.indexOf(PrimeFacesExt.RESOURCE_IDENTIFIER),d=PrimeFacesExt.isExtensionMapping()?a.lastIndexOf("."+PrimeFacesExt.getResourceUrlExtension()):a.indexOf("?"),a=a.substring(c+PrimeFacesExt.RESOURCE_IDENTIFIER.length,
d),a=PrimeFacesExt.getPrimeFacesExtensionsCompressedResource(a+b)}else a=PrimeFacesExt.getPrimeFacesExtensionsCompressedResource("/ckeditor/"+a)}return a};
PrimeFacesExt.widget.CKEditor=PrimeFaces.widget.BaseWidget.extend({init:function(a){this._super(a);this.dirtyEventDefined=this.cfg.behaviors&&this.cfg.behaviors.dirty;this.changeEventDefined=this.cfg.behaviors&&this.cfg.behaviors.change;this.dirtyState=!1;this.instance=null;this.options={};this.options.widget=this;this.cfg.skin&&(this.options.skin=this.cfg.skin);this.cfg.width&&(this.options.width=this.cfg.width);this.cfg.height&&(this.options.height=this.cfg.height);this.cfg.theme&&(this.options.theme=
this.cfg.theme);this.cfg.toolbar&&(this.options.toolbar=this.cfg.toolbar);this.cfg.readOnly&&(this.options.readOnly=this.cfg.readOnly);this.cfg.interfaceColor&&(this.options.uiColor=this.cfg.interfaceColor);this.cfg.language&&(this.options.language=this.cfg.language);this.cfg.defaultLanguage&&(this.options.defaultLanguage=this.cfg.defaultLanguage);this.cfg.contentsCss&&(this.options.contentsCss=this.cfg.contentsCss);this.cfg.customConfig&&(this.options.customConfig=this.cfg.customConfig+"?resolve=false");
if($.fn.ckeditor)this.initialize();else{var a=PrimeFacesExt.getPrimeFacesExtensionsCompressedResource("/ckeditor/ckeditor.js"),b=PrimeFacesExt.getPrimeFacesExtensionsCompressedResource("/ckeditor/adapters/jquery.js");PrimeFacesExt.getScript(a,$.proxy(function(){PrimeFacesExt.getScript(b,$.proxy(function(){PrimeFacesExt.handleInitialize(this,this.initialize)},this),true)},this),!0)}},initialize:function(){if(!this.instance){this.overwriteSaveButton();var a=CKEDITOR.instances[this.id];a&&a.destroy(!0);
this.jq.ckeditor($.proxy(function(){this.initialized()},this),this.options)}},overwriteSaveButton:function(){CKEDITOR.plugins.registered.save={init:function(a){var b=a.config.widget;a.addCommand("save",{modes:{wysiwyg:1,source:1},exec:function(){if(b.cfg.behaviors){var a=b.cfg.behaviors.save;a&&a.call(b,null,{params:[]})}}});a.ui.addButton("Save",{label:a.lang.save,command:"save"})}}},initialized:function(){this.instance=this.jq.ckeditorGet();this.fireEvent("initialize");this.instance.on("blur",$.proxy(function(){this.handleBlur()},
this));this.instance.on("focus",$.proxy(function(){this.fireEvent("focus")},this));if(this.changeEventDefined||this.dirtyEventDefined)this.bindChangeEventsForWYSIWYGMode(),this.bindCommonChangeEvents(),this.instance.on("contentDom",$.proxy(function(){this.bindChangeEventsForWYSIWYGMode();this.fireEvent("wysiwygMode")},this)),this.instance.on("mode",$.proxy(function(){"source"==this.instance.mode&&(this.bindChangeEventsForSourceMode(),this.fireEvent("sourceMode"))},this));this.dirtyEventDefined&&0!==
this.cfg.checkDirtyInterval&&(this.dirtyCheckInterval=setInterval($.proxy(this.checkDirtyFromTimer,this),this.cfg.checkDirtyInterval))},bindCommonChangeEvents:function(){this.instance.on("paste",$.proxy(this.checkDirty,this));this.instance.getCommand("undo").on("afterUndo",$.proxy(this.checkDirty,this));this.instance.getCommand("redo").on("afterRedo",$.proxy(this.checkDirty,this));this.instance.on("saveSnapshot",$.proxy(function(a){(!a.data||!a.data.contentOnly)&&this.checkDirty()},this));this.instance.on("afterCommandExec",
$.proxy(function(a){"source"!=a.data.name&&!1!==a.data.command.canUndo&&this.checkDirty()},this))},bindChangeEventsForWYSIWYGMode:function(){this.instance.document.on("drop",$.proxy(this.checkDirty,this));this.instance.document.getBody().on("drop",$.proxy(this.checkDirty,this));this.instance.document.on("keydown",$.proxy(function(a){!a.data.$.ctrlKey&&!a.data.$.metaKey&&(a=a.data.$.keyCode,(8==a||13==a||32==a||46<=a&&90>=a||96<=a&&111>=a||186<=a&&222>=a)&&this.checkDirty())},this))},bindChangeEventsForSourceMode:function(){this.instance.textarea.on("drop",
$.proxy(this.checkDirty,this));this.instance.textarea.on("input",$.proxy(this.checkDirty,this))},checkDirty:function(){this.isDirty()&&(this.instance.resetDirty(),!1===this.dirtyState&&(this.dirtyState=!0),this.dirtyEventDefined&&this.fireEvent("dirty"))},checkDirtyFromTimer:function(){this.dirtyState=!1;this.checkDirty()},handleBlur:function(){this.fireEvent("blur");this.changeEventDefined&&(this.dirtyState&&(this.instance.resetDirty(),this.fireEvent("change")),this.dirtyState=!1)},fireEvent:function(a){this.cfg.behaviors&&
(a=this.cfg.behaviors[a])&&a.call(this,null,{params:[]})},destroy:function(){this.dirtyCheckInterval&&clearInterval(this.dirtyCheckInterval);this.instance&&(this.instance.destroy(!0),this.instance=null);this.jq.show()},isDirty:function(){return!this.instance?!1:this.dirtyState||this.instance.checkDirty()},setReadOnly:function(a){this.instance.setReadOnly(!1!==a)},isReadOnly:function(){return this.instance.readOnly},hasFocus:function(){return this.instance.focusManager.hasFocus},getEditorInstance:function(){return this.instance}});PrimeFacesExt.widget.DynaForm=PrimeFaces.widget.BaseWidget.extend({init:function(a){this._super(a);a.isPostback||(this.toggledExtended=!1);if(a.autoSubmit&&!window[a.widgetVar])this.submitForm();else if(a.isPostback&&this.toggledExtended&&this.uuid==a.uuid){var b=this.jq.find("tr.pe-dynaform-extendedrow");0<b.length&&(this.openExtended?b.show():b.hide())}this.uuid=a.uuid},toggleExtended:function(){var a=this.jq.find("tr.pe-dynaform-extendedrow");0<a.length&&(a.toggle(),this.toggledExtended=!0,this.openExtended=
"none"!=$(a[0]).css("display"))},submitForm:function(){this.jq.find(":submit").trigger("click")}});PrimeFacesExt.widget.ImageRotateAndResize=PrimeFaces.widget.BaseWidget.extend({init:function(a){this.id=a.id;this.cfg=a;this.initialized=!1;PrimeFacesExt.removeWidgetScript(this.id)},initializeLazy:function(){this.initialized||(this.target=$(this.cfg.target)[0],this.imageSrc=this.target.src,this.imageWidth=this.target.width,this.imageHeight=this.target.height,this.degree=0,this.newImageWidth=this.target.width,this.newImageHeight=this.target.height,this.initialized=!0)},reload:function(){this.initialized=
!1;this.initializeLazy()},rotateLeft:function(a){this.initializeLazy();this.degree=0>=this.degree-a?360- -1*(this.degree-a):this.degree-a;this.redrawImage(!1,!0)},rotateRight:function(a){this.initializeLazy();this.degree=360<=this.degree+a?this.degree+a-360:this.degree+a;this.redrawImage(!1,!0)},resize:function(a,b){this.initializeLazy();this.newImageWidth=a;this.newImageHeight=b;this.redrawImage(!0,!1)},scale:function(a){this.initializeLazy();this.newImageWidth*=a;this.newImageHeight*=a;this.redrawImage(!0,
!1)},restoreDefaults:function(){this.initializeLazy();this.newImageWidth=this.imageWidth;this.newImageHeight=this.imageHeight;this.degree=0;this.redrawImage(!0,!0)},redrawImage:function(a,b){var c;c=0<=this.degree?Math.PI*this.degree/180:Math.PI*(360+this.degree)/180;var d=Math.cos(c),e=Math.sin(c);if($.browser.msie&&8>=parseInt($.browser.version)){var f=document.createElement("img");f.onload=$.proxy(function(){f.height=this.newImageHeight;f.width=this.newImageWidth;f.style.filter="progid:DXImageTransform.Microsoft.Matrix(M11="+
d+",M12="+-1*e+",M21="+e+",M22="+d+",SizingMethod='auto expand')";f.id=this.target.id;this.target.parentNode.replaceChild(f,this.target);this.target=f;a&&this.fireResizeEvent();b&&this.fireRotateEvent()},this);f.src=this.imageSrc}else{var h=document.createElement("canvas"),g=new Image;g.onload=$.proxy(function(){h.style.width=h.width=Math.abs(d*g.width)+Math.abs(e*g.height);h.style.height=h.height=Math.abs(d*g.height)+Math.abs(e*g.width);var f=h.getContext("2d");f.save();c<=Math.PI/2?f.translate(e*
g.height,0):c<=Math.PI?f.translate(h.width,-1*d*g.height):c<=1.5*Math.PI?f.translate(-1*d*g.width,h.height):f.translate(0,-1*e*g.width);f.rotate(c);f.drawImage(g,0,0,g.width,g.height);f.restore();h.id=this.target.id;h.src=this.target.src;this.target.parentNode.replaceChild(h,this.target);this.target=h;a&&this.fireResizeEvent();b&&this.fireRotateEvent()},this);g.src=this.imageSrc;g.width=this.newImageWidth;g.height=this.newImageHeight}},fireRotateEvent:function(){if(this.cfg.behaviors){var a=this.cfg.behaviors.rotate;
a&&a.call(this,null,{params:[{name:this.id+"_degree",value:this.degree}]})}},fireResizeEvent:function(){if(this.cfg.behaviors){var a=this.cfg.behaviors.resize;a&&a.call(this,null,{params:[{name:this.id+"_width",value:this.newImageWidth},{name:this.id+"_height",value:this.newImageHeight}]})}}});PrimeFacesExt.widget.TriStateCheckbox=PrimeFaces.widget.BaseWidget.extend({init:function(a){this._super(a);this.input=$(this.jqId+"_input");this.box=this.jq.find(".ui-chkbox-box");this.icon=this.box.children(".ui-chkbox-icon");this.itemLabel=this.jq.find(".ui-chkbox-label");this.disabled=this.input.is(":disabled");this.fixedMod=function(a,b){return(a%b+b)%b};var b=this;this.disabled||(this.box.mouseover(function(){b.box.addClass("ui-state-hover")}).mouseout(function(){b.box.removeClass("ui-state-hover")}).click(function(){b.toggle(1);
event.preventDefault?event.preventDefault():event.returnValue=!1}),this.itemLabel.click(function(){b.toggle(1);event.preventDefault?event.preventDefault():event.returnValue=!1}),this.box.bind("keydown",function(a){switch(a.keyCode){case 38:b.toggle(1);a.preventDefault?a.preventDefault():a.returnValue=!1;break;case 40:b.toggle(-1);a.preventDefault?a.preventDefault():a.returnValue=!1;break;case 39:b.toggle(1);a.preventDefault?a.preventDefault():a.returnValue=!1;break;case 37:b.toggle(-1);a.preventDefault?
a.preventDefault():a.returnValue=!1;break;case 32:b.toggle(1),a.preventDefault?a.preventDefault():a.returnValue=!1}}),this.cfg.behaviors&&PrimeFaces.attachBehaviors(this.input,this.cfg.behaviors));this.input.data(PrimeFaces.CLIENT_ID_DATA,this.id)},toggle:function(a){if(!this.disabled){var b=parseInt(this.input.val()),a=this.fixedMod(b+a,3);this.input.val(a);0==a?this.box.removeClass("ui-state-active"):this.box.addClass("ui-state-active");var c=this.box.data("iconstates");this.icon.removeClass(c[b]).addClass(c[a]);
b=this.box.data("titlestates");null!=b&&0<b.length&&this.box.attr("title",b[a]);this.input.change()}}});PrimeFacesExt.widget.TriStateManyCheckbox=PrimeFaces.widget.BaseWidget.extend({init:function(a){this._super(a);this.outputs=this.jq.find(".ui-chkbox-box:not(.ui-state-disabled)");this.inputs=this.jq.find(":text:not(:disabled)");this.labels=this.jq.find("label:not(.ui-state-disabled)");this.fixedMod=function(a,b){return(a%b+b)%b};var b=this;this.outputs.mouseover(function(){$(this).addClass("ui-state-hover")}).mouseout(function(){$(this).removeClass("ui-state-hover")}).click(function(){b.toggle($(this),
1);event.preventDefault?event.preventDefault():event.returnValue=!1});this.labels.click(function(){var a=$(this);$(PrimeFaces.escapeClientId(a.attr("for"))).parent().next().click();event.preventDefault?event.preventDefault():event.returnValue=!1});this.outputs.bind("keydown",function(a){switch(a.keyCode){case 38:b.toggle($(this),1);a.preventDefault?a.preventDefault():a.returnValue=!1;break;case 40:b.toggle($(this),-1);a.preventDefault?a.preventDefault():a.returnValue=!1;break;case 39:b.toggle($(this),
1);a.preventDefault?a.preventDefault():a.returnValue=!1;break;case 37:b.toggle($(this),-1);a.preventDefault?a.preventDefault():a.returnValue=!1;break;case 32:b.toggle($(this),1),a.preventDefault?a.preventDefault():a.returnValue=!1}});this.cfg.behaviors&&PrimeFaces.attachBehaviors(this.inputs,this.cfg.behaviors);this.inputs.data(PrimeFaces.CLIENT_ID_DATA,this.id)},toggle:function(a,b){var c=a.prev().find(":input");if(!a.hasClass("ui-state-disabled")){var d=parseInt(c.val()),e=this.fixedMod(d+b,3);
c.val(e);0==e?a.removeClass("ui-state-active"):a.addClass("ui-state-active");var f=a.data("iconstates");a.children().removeClass(f[d]).addClass(f[e]);d=a.data("titlestates");null!=d&&0<d.length&&a.attr("title",d[e]);c.change()}}});