(function($, elementor){
"use strict";
var JetMenuWidget={
init: function(){
var widgets={
'jet-mega-menu.default':JetMenuWidget.widgetMegaMenu,
'jet-custom-menu.default':JetMenuWidget.widgetCustomMenu,
'jet-mobile-menu.default':JetMenuWidget.widgetMobileMenu,
};
$.each(widgets, function(widget, callback){
elementor.hooks.addAction('frontend/element_ready/' + widget, callback);
});
},
widgetMegaMenu: function($scope){
let $desktopTarget=$scope.find('.jet-menu-container'),
$mobileTarget=$scope.find('.jet-mobile-menu');
if($desktopTarget[0]){
let rollUp=false,
jetMenuMouseleaveDelay=500,
jetMenuMegaWidthType='container',
jetMenuMegaWidthSelector='',
jetMenuMegaOpenSubType='hover',
jetMenuMegaAjax=false;
if(window.jetMenuPublicSettings&&window.jetMenuPublicSettings.menuSettings){
rollUp=('true'===jetMenuPublicSettings.menuSettings.jetMenuRollUp) ? true:false;
jetMenuMouseleaveDelay=jetMenuPublicSettings.menuSettings.jetMenuMouseleaveDelay||500;
jetMenuMegaWidthType=jetMenuPublicSettings.menuSettings.jetMenuMegaWidthType||'container';
jetMenuMegaWidthSelector=jetMenuPublicSettings.menuSettings.jetMenuMegaWidthSelector||'';
jetMenuMegaOpenSubType=jetMenuPublicSettings.menuSettings.jetMenuMegaOpenSubType||'hover';
jetMenuMegaAjax=('true'===jetMenuPublicSettings.menuSettings.jetMenuMegaAjax)  ? true:false;
}
$desktopTarget.JetMenuPlugin({
enabled: rollUp,
mouseLeaveDelay: +jetMenuMouseleaveDelay,
megaWidthType: jetMenuMegaWidthType,
megaWidthSelector: jetMenuMegaWidthSelector,
openSubType: jetMenuMegaOpenSubType,
ajaxLoad: jetMenuMegaAjax,
});
}
if($mobileTarget[0]){
let menuInstanceId=$mobileTarget.attr('id'),
menuId=$mobileTarget.data('menu-id')||false,
menuOptions=$mobileTarget.data('menu-options')||{};
window.jetMenu.createMobileMenuInstance(menuInstanceId, menuId, menuOptions);
}},
widgetCustomMenu: function($scope){
var $target=$scope.find('.jet-custom-nav'),
instance=null,
menuItem=null;
if(! $target.length){
return;
}
if(JetMenuWidget.mobileAndTabletcheck()){
$scope.on('touchstart', '.jet-custom-nav__item > a, .jet-custom-nav__item > a .jet-dropdown-arrow', touchStartItem);
$scope.on('touchend', '.jet-custom-nav__item > a, .jet-custom-nav__item > a .jet-dropdown-arrow', touchEndItem);
}else{
$scope.on('mouseenter mouseover', '.jet-custom-nav__item', mouseEnterHandler);
$scope.on('mouseleave', '.jet-custom-nav__item', mouseLeaveHandler);
}
function mouseEnterHandler(event){
menuItem=$(event.target).parents('.jet-custom-nav__item');
menuItem.addClass('hover-state');
}
function mouseLeaveHandler(event){
menuItem=$(event.target).parents('.jet-custom-nav__item');
menuItem.removeClass('hover-state');
}
function touchStartItem(event){
var $this=$(event.currentTarget).closest('.jet-custom-nav__item');
$this.data('offset', $this.offset().top);
$this.data('windowOffset', $(window).scrollTop());
}
function touchEndItem(event){
var $currentTarget,
$this,
$siblingsItems,
$link,
linkHref,
subMenu,
offset,
windowOffset;
event.preventDefault();
event.stopPropagation();
$currentTarget=$(event.currentTarget);
$this=$currentTarget.closest('.jet-custom-nav__item');
$siblingsItems=$this.siblings('.jet-custom-nav__item.menu-item-has-children');
$link=$('> a', $this);
linkHref=$link.attr('href');
subMenu=$('.jet-custom-nav__sub:first, .jet-custom-nav__mega-sub:first', $this);
offset=$this.data('offset');
windowOffset=$this.data('windowOffset');
if(offset!==$this.offset().top||windowOffset!==$(window).scrollTop()){
return false;
}
if($currentTarget.hasClass('jet-dropdown-arrow')){
if(!subMenu[0]){
return false;
}
if(! $this.hasClass('hover-state')){
$this.addClass('hover-state');
$siblingsItems.removeClass('hover-state');
$('.jet-custom-nav__item.menu-item-has-children', $siblingsItems).removeClass('hover-state');
}else{
$this.removeClass('hover-state');
$('.jet-custom-nav__item.menu-item-has-children', $this).removeClass('hover-state');
}}
if($currentTarget.hasClass('jet-custom-nav__item-link')){
if('#'===linkHref){
if(! $this.hasClass('hover-state')){
$this.addClass('hover-state');
$siblingsItems.removeClass('hover-state');
$('.jet-custom-nav__item.menu-item-has-children', $siblingsItems).removeClass('hover-state');
}else{
$this.removeClass('hover-state');
$('.jet-custom-nav__item.menu-item-has-children', $this).removeClass('hover-state');
}}else{
window.location=linkHref;
return false;
}}
}
var initSubMenuPosition=false;
function setSubMenuPosition(){
if(initSubMenuPosition){
$target.find('.jet-custom-nav__sub.inverse-side').removeClass('inverse-side');
initSubMenuPosition=false;
}
var subMenu=$('.jet-custom-nav__sub', $target),
$body=$('body'),
maxWidth=$body.outerWidth(true),
isMobile='mobile'===elementor.getCurrentDeviceMode();
if(isMobile){
return;
}
if(subMenu[0]){
subMenu.each(function(){
var $this=$(this),
subMenuOffsetLeft=$this.offset().left,
subMenuOffsetRight=subMenuOffsetLeft + $this.outerWidth(true),
subMenuPosition=$this.closest('.jet-custom-nav').hasClass('jet-custom-nav--dropdown-left-side') ? 'left-side':'right-side';
if('right-side'===subMenuPosition){
if(subMenuOffsetRight >=maxWidth){
$this.addClass('inverse-side');
$this.find('.jet-custom-nav__sub').addClass('inverse-side');
initSubMenuPosition=true;
}else if(subMenuOffsetLeft < 0){
$this.removeClass('inverse-side');
$this.find('.jet-custom-nav__sub').removeClass('inverse-side');
}}else{
if(subMenuOffsetLeft < 0){
$this.addClass('inverse-side');
$this.find('.jet-custom-nav__sub').addClass('inverse-side');
initSubMenuPosition=true;
}else if(subMenuOffsetRight >=maxWidth){
$this.removeClass('inverse-side');
$this.find('.jet-custom-nav__sub').removeClass('inverse-side');
}}
});
}}
setSubMenuPosition();
$(window).on('resize.JetCustomMenu orientationchange.JetCustomMenu', setSubMenuPosition);
var initMaxMegaMenuWidth=false;
function setMaxMegaMenuWidth(){
var megaMenu=$('.jet-custom-nav__mega-sub', $target),
$body=$('body'),
maxWidth=$body.outerWidth(true),
isMobile='mobile'===elementor.getCurrentDeviceMode();
if(initMaxMegaMenuWidth){
megaMenu.css({
'maxWidth': ''
});
initMaxMegaMenuWidth=false;
}
if(isMobile){
return;
}
if(megaMenu[0]){
megaMenu.each(function(){
var $this=$(this),
megaMenuTranslateX=$this.css('transform').replace(/,/g, "").split(" ")[4]||0,
megaMenuOffsetLeft=$this.offset().left - megaMenuTranslateX,
megaMenuOffsetRight=megaMenuOffsetLeft + $this.outerWidth(true),
megaMenuPosition=$this.closest('.jet-custom-nav').hasClass('jet-custom-nav--dropdown-left-side') ? 'left-side':'right-side';
if('right-side'===megaMenuPosition){
if(megaMenuOffsetRight >=maxWidth){
$this.css({
'maxWidth': maxWidth - megaMenuOffsetLeft - 10
});
initMaxMegaMenuWidth=true;
}}else{
if(megaMenuOffsetLeft < 0){
$this.css({
'maxWidth': megaMenuOffsetRight - 10
});
initMaxMegaMenuWidth=true;
}}
});
}}
setMaxMegaMenuWidth();
$(window).on('resize.JetCustomMenu orientationchange.JetCustomMenu', setMaxMegaMenuWidth);
},
widgetMobileMenu: function($scope){
let $target=$scope.find('.jet-mobile-menu'),
menuInstanceId=$target.attr('id'),
menuId=$target.data('menu-id')||false,
menuOptions=$target.data('menu-options')||{};
if(! $target[0]){
return;
}
window.jetMenu.createMobileMenuInstance(menuInstanceId, menuId, menuOptions);
},
mobileAndTabletcheck: function(){
var check=false;
(function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm(os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s)|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp(i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac(|\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt(|\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg(g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v)|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v)|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-|)|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))) check=true;})(navigator.userAgent||navigator.vendor||window.opera);
return check;
}};
$(window).on('elementor/frontend/init', JetMenuWidget.init);
}(jQuery, window.elementorFrontend));
document.documentElement.className+=" js_active ",document.documentElement.className+="ontouchstart"in document.documentElement?" vc_mobile ":" vc_desktop ",function(){for(var prefix=["-webkit-","-moz-","-ms-","-o-",""],i=0;i<prefix.length;i++)prefix[i]+"transform"in document.documentElement.style&&(document.documentElement.className+=" vc_transform ")}(),function($){"function"!=typeof window.vc_js&&(window.vc_js=function(){"use strict";vc_toggleBehaviour(),vc_tabsBehaviour(),vc_accordionBehaviour(),vc_teaserGrid(),vc_carouselBehaviour(),vc_slidersBehaviour(),vc_prettyPhoto(),vc_pinterest(),vc_progress_bar(),vc_plugin_flexslider(),vc_gridBehaviour(),vc_rowBehaviour(),vc_prepareHoverBox(),vc_googleMapsPointer(),vc_ttaActivation(),jQuery(document).trigger("vc_js"),window.setTimeout(vc_waypoints,500)}),"function"!=typeof window.vc_plugin_flexslider&&(window.vc_plugin_flexslider=function($parent){($parent?$parent.find(".wpb_flexslider"):jQuery(".wpb_flexslider")).each(function(){var this_element=jQuery(this),sliderTimeout=1e3*parseInt(this_element.attr("data-interval"),10),sliderFx=this_element.attr("data-flex_fx"),slideshow=0==sliderTimeout?!1:!0;this_element.is(":visible")&&this_element.flexslider({animation:sliderFx,slideshow:slideshow,slideshowSpeed:sliderTimeout,sliderSpeed:800,smoothHeight:!0})})}),"function"!=typeof window.vc_googleplus&&(window.vc_googleplus=function(){0<jQuery(".wpb_googleplus").length&&function(){var po=document.createElement("script");po.type="text/javascript",po.async=!0,po.src="https://apis.google.com/js/plusone.js";var s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(po,s)}()}),"function"!=typeof window.vc_pinterest&&(window.vc_pinterest=function(){0<jQuery(".wpb_pinterest").length&&function(){var po=document.createElement("script");po.type="text/javascript",po.async=!0,po.src="https://assets.pinterest.com/js/pinit.js";var s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(po,s)}()}),"function"!=typeof window.vc_progress_bar&&(window.vc_progress_bar=function(){void 0!==jQuery.fn.vcwaypoint&&jQuery(".vc_progress_bar").each(function(){var $el=jQuery(this);$el.vcwaypoint(function(){$el.find(".vc_single_bar").each(function(index){var bar=jQuery(this).find(".vc_bar"),val=bar.data("percentage-value");setTimeout(function(){bar.css({width:val+"%"})},200*index)})},{offset:"85%"})})}),"function"!=typeof window.vc_waypoints&&(window.vc_waypoints=function(){void 0!==jQuery.fn.vcwaypoint&&jQuery(".wpb_animate_when_almost_visible:not(.wpb_start_animation)").each(function(){var $el=jQuery(this);$el.vcwaypoint(function(){$el.addClass("wpb_start_animation animated")},{offset:"85%"})})}),"function"!=typeof window.vc_toggleBehaviour&&(window.vc_toggleBehaviour=function($el){function event(content){content&&content.preventDefault&&content.preventDefault();var element=jQuery(this).closest(".vc_toggle"),content=element.find(".vc_toggle_content");element.hasClass("vc_toggle_active")?content.slideUp({duration:300,complete:function(){element.removeClass("vc_toggle_active")}}):content.slideDown({duration:300,complete:function(){element.addClass("vc_toggle_active")}})}($el?$el.hasClass("vc_toggle_title")?$el.unbind("click"):$el.find(".vc_toggle_title").off("click"):jQuery(".vc_toggle_title").off("click")).on("click",event)}),"function"!=typeof window.vc_tabsBehaviour&&(window.vc_tabsBehaviour=function(ver){var $call,old_version;jQuery.ui&&($call=ver||jQuery(".wpb_tabs, .wpb_tour"),ver=jQuery.ui&&jQuery.ui.version?jQuery.ui.version.split("."):"1.10",old_version=1===parseInt(ver[0],10)&&parseInt(ver[1],10)<9,$call.each(function(index){var interval=jQuery(this).attr("data-interval"),tabs_array=[],$tabs=jQuery(this).find(".wpb_tour_tabs_wrapper").tabs({show:function(event,ui){wpb_prepare_tab_content(event,ui)},activate:function(event,ui){wpb_prepare_tab_content(event,ui)}});if(interval&&0<interval)try{$tabs.tabs("rotate",1e3*interval)}catch(err){window.console&&window.console.warn&&console.warn("tabs behaviours error",err)}jQuery(this).find(".wpb_tab").each(function(){tabs_array.push(this.id)}),jQuery(this).find(".wpb_tabs_nav li").on("click",function(e){return e&&e.preventDefault&&e.preventDefault(),old_version?$tabs.tabs("select",jQuery("a",this).attr("href")):$tabs.tabs("option","active",jQuery(this).index()),!1}),jQuery(this).find(".wpb_prev_slide a, .wpb_next_slide a").on("click",function(length){var index;length&&length.preventDefault&&length.preventDefault(),old_version?(index=$tabs.tabs("option","selected"),jQuery(this).parent().hasClass("wpb_next_slide")?index++:index--,index<0?index=$tabs.tabs("length")-1:index>=$tabs.tabs("length")&&(index=0),$tabs.tabs("select",index)):(index=$tabs.tabs("option","active"),length=$tabs.find(".wpb_tab").length,index=jQuery(this).parent().hasClass("wpb_next_slide")?length<=index+1?0:index+1:index-1<0?length-1:index-1,$tabs.tabs("option","active",index))})}))}),"function"!=typeof window.vc_accordionBehaviour&&(window.vc_accordionBehaviour=function(){jQuery(".wpb_accordion").each(function(index){var $this=jQuery(this),active_tab=($this.attr("data-interval"),!isNaN(jQuery(this).data("active-tab"))&&0<parseInt($this.data("active-tab"),10)&&parseInt($this.data("active-tab"),10)-1),$tabs=!1===active_tab||"yes"===$this.data("collapsible"),$tabs=$this.find(".wpb_accordion_wrapper").accordion({header:"> div > h3",autoHeight:!1,heightStyle:"content",active:active_tab,collapsible:$tabs,navigation:!0,activate:vc_accordionActivate,change:function(event,ui){void 0!==jQuery.fn.isotope&&ui.newContent.find(".isotope").isotope("layout"),vc_carouselBehaviour(ui.newPanel)}});!0===$this.data("vcDisableKeydown")&&($tabs.data("uiAccordion")._keydown=function(){})})}),"function"!=typeof window.vc_teaserGrid&&(window.vc_teaserGrid=function(){var layout_modes={fitrows:"fitRows",masonry:"masonry"};jQuery(".wpb_grid .teaser_grid_container:not(.wpb_carousel), .wpb_filtered_grid .teaser_grid_container:not(.wpb_carousel)").each(function(){var $container=jQuery(this),$thumbs=$container.find(".wpb_thumbnails"),layout_mode=$thumbs.attr("data-layout-mode");$thumbs.isotope({itemSelector:".isotope-item",layoutMode:void 0===layout_modes[layout_mode]?"fitRows":layout_modes[layout_mode]}),$container.find(".categories_filter a").data("isotope",$thumbs).on("click",function($thumbs){$thumbs&&$thumbs.preventDefault&&$thumbs.preventDefault();$thumbs=jQuery(this).data("isotope");jQuery(this).parent().parent().find(".active").removeClass("active"),jQuery(this).parent().addClass("active"),$thumbs.isotope({filter:jQuery(this).attr("data-filter")})}),jQuery(window).on("load resize",function(){$thumbs.isotope("layout")})})}),"function"!=typeof window.vc_carouselBehaviour&&(window.vc_carouselBehaviour=function($parent){($parent?$parent.find(".wpb_carousel"):jQuery(".wpb_carousel")).each(function(){var fluid_ul=jQuery(this);!0!==fluid_ul.data("carousel_enabled")&&fluid_ul.is(":visible")&&(fluid_ul.data("carousel_enabled",!0),getColumnsCount(jQuery(this)),jQuery(this).hasClass("columns_count_1"),(fluid_ul=jQuery(this).find(".wpb_thumbnails-fluid li")).css({"margin-right":fluid_ul.css("margin-left"),"margin-left":0}),(fluid_ul=jQuery(this).find("ul.wpb_thumbnails-fluid")).width(fluid_ul.width()+300))})}),"function"!=typeof window.vc_slidersBehaviour&&(window.vc_slidersBehaviour=function(){jQuery(".wpb_gallery_slides").each(function(index){var $imagesGrid,sliderTimeout,this_element=jQuery(this);this_element.hasClass("wpb_slider_nivo")?(0===(sliderTimeout=1e3*this_element.attr("data-interval"))&&(sliderTimeout=9999999999),this_element.find(".nivoSlider").nivoSlider({effect:"boxRainGrow,boxRain,boxRainReverse,boxRainGrowReverse",slices:15,boxCols:8,boxRows:4,animSpeed:800,pauseTime:sliderTimeout,startSlide:0,directionNav:!0,directionNavHide:!0,controlNav:!0,keyboardNav:!1,pauseOnHover:!0,manualAdvance:!1,prevText:"Prev",nextText:"Next"})):this_element.hasClass("wpb_image_grid")&&(jQuery.fn.imagesLoaded?$imagesGrid=this_element.find(".wpb_image_grid_ul").imagesLoaded(function(){$imagesGrid.isotope({itemSelector:".isotope-item",layoutMode:"fitRows"})}):this_element.find(".wpb_image_grid_ul").isotope({itemSelector:".isotope-item",layoutMode:"fitRows"}))})}),"function"!=typeof window.vc_prettyPhoto&&(window.vc_prettyPhoto=function(){try{jQuery&&jQuery.fn&&jQuery.fn.prettyPhoto&&jQuery('a.prettyphoto, .gallery-icon a[href*=".jpg"]').prettyPhoto({animationSpeed:"normal",hook:"data-rel",padding:15,opacity:.7,showTitle:!0,allowresize:!0,counter_separator_label:"/",hideflash:!1,deeplinking:!1,modal:!1,callback:function(){-1<location.href.indexOf("#!prettyPhoto")&&(location.hash="")},social_tools:""})}catch(err){window.console&&window.console.warn&&window.console.warn("vc_prettyPhoto initialize error",err)}}),"function"!=typeof window.vc_google_fonts&&(window.vc_google_fonts=function(){return window.console&&window.console.warn&&window.console.warn("function vc_google_fonts is deprecated, no need to use it"),!1}),window.vcParallaxSkroll=!1,"function"!=typeof window.vc_rowBehaviour&&(window.vc_rowBehaviour=function(){var callSkrollInit,$=window.jQuery;function fullWidthRow(){var $elements=$('[data-vc-full-width="true"]');$.each($elements,function(key,item){var $el=$(this);$el.addClass("vc_hidden");var el_margin_left,el_margin_right,offset,width,padding,paddingRight,$el_full=$el.next(".vc_row-full-width");($el_full=!$el_full.length?$el.parent().next(".vc_row-full-width"):$el_full).length&&(el_margin_left=parseInt($el.css("margin-left"),10),el_margin_right=parseInt($el.css("margin-right"),10),offset=0-$el_full.offset().left-el_margin_left,width=$(window).width(),"rtl"===$el.css("direction")&&(offset-=$el_full.width(),offset+=width,offset+=el_margin_left,offset+=el_margin_right),$el.css({position:"relative",left:offset,"box-sizing":"border-box",width:width}),$el.data("vcStretchContent")||("rtl"===$el.css("direction")?((padding=offset)<0&&(padding=0),(paddingRight=offset)<0&&(paddingRight=0)):(paddingRight=width-(padding=(padding=-1*offset)<0?0:padding)-$el_full.width()+el_margin_left+el_margin_right)<0&&(paddingRight=0),$el.css({"padding-left":padding+"px","padding-right":paddingRight+"px"})),$el.attr("data-vc-full-width-init","true"),$el.removeClass("vc_hidden"),$(document).trigger("vc-full-width-row-single",{el:$el,offset:offset,marginLeft:el_margin_left,marginRight:el_margin_right,elFull:$el_full,width:width}))}),$(document).trigger("vc-full-width-row",$elements)}function fullHeightRow(){var windowHeight,offsetTop,$element=$(".vc_row-o-full-height:first");$element.length&&(windowHeight=$(window).height(),(offsetTop=$element.offset().top)<windowHeight&&$element.css("min-height",100-offsetTop/(windowHeight/100)+"vh")),$(document).trigger("vc-full-height-row",$element)}$(window).off("resize.vcRowBehaviour").on("resize.vcRowBehaviour",fullWidthRow).on("resize.vcRowBehaviour",fullHeightRow),fullWidthRow(),fullHeightRow(),(0<window.navigator.userAgent.indexOf("MSIE ")||navigator.userAgent.match(/Trident.*rv\:11\./))&&$(".vc_row-o-full-height").each(function(){"flex"===$(this).css("display")&&$(this).wrap('<div class="vc_ie-flexbox-fixer"></div>')}),vc_initVideoBackgrounds(),callSkrollInit=!1,window.vcParallaxSkroll&&window.vcParallaxSkroll.destroy(),$(".vc_parallax-inner").remove(),$("[data-5p-top-bottom]").removeAttr("data-5p-top-bottom data-30p-top-bottom"),$("[data-vc-parallax]").each(function(){var skrollrSize,$parallaxElement,parallaxImage,youtubeId;callSkrollInit=!0,"on"===$(this).data("vcParallaxOFade")&&$(this).children().attr("data-5p-top-bottom","opacity:0;").attr("data-30p-top-bottom","opacity:1;"),skrollrSize=100*$(this).data("vcParallax"),($parallaxElement=$("<div />").addClass("vc_parallax-inner").appendTo($(this))).height(skrollrSize+"%"),parallaxImage=$(this).data("vcParallaxImage"),(youtubeId=vcExtractYoutubeId(parallaxImage))?insertYoutubeVideoAsBackground($parallaxElement,youtubeId):void 0!==parallaxImage&&$parallaxElement.css("background-image","url("+parallaxImage+")"),$parallaxElement.attr("data-bottom-top","top: "+-(skrollrSize-100)+"%;").attr("data-top-bottom","top: 0%;")}),callSkrollInit&&window.skrollr&&(window.vcParallaxSkroll=skrollr.init({forceHeight:!1,smoothScrolling:!1,mobileCheck:function(){return!1}}),window.vcParallaxSkroll)}),"function"!=typeof window.vc_gridBehaviour&&(window.vc_gridBehaviour=function(){jQuery.fn.vcGrid&&jQuery("[data-vc-grid]").vcGrid()}),"function"!=typeof window.getColumnsCount&&(window.getColumnsCount=function(el){for(var find=!1,i=1;!1===find;){if(el.hasClass("columns_count_"+i))return find=!0,i;i++}}),"function"!=typeof window.wpb_prepare_tab_content&&(window.wpb_prepare_tab_content=function(event,ui){var panel=ui.panel||ui.newPanel,$pie_charts=panel.find(".vc_pie_chart:not(.vc_ready)"),$round_charts=panel.find(".vc_round-chart"),$frame=panel.find(".vc_line-chart"),$google_maps=panel.find('[data-ride="vc_carousel"]');vc_carouselBehaviour(),vc_plugin_flexslider(panel),ui.newPanel.find(".vc_masonry_media_grid, .vc_masonry_grid").length&&ui.newPanel.find(".vc_masonry_media_grid, .vc_masonry_grid").each(function(){var grid=jQuery(this).data("vcGrid");grid&&grid.gridBuilder&&grid.gridBuilder.setMasonry&&grid.gridBuilder.setMasonry()}),panel.find(".vc_masonry_media_grid, .vc_masonry_grid").length&&panel.find(".vc_masonry_media_grid, .vc_masonry_grid").each(function(){var grid=jQuery(this).data("vcGrid");grid&&grid.gridBuilder&&grid.gridBuilder.setMasonry&&grid.gridBuilder.setMasonry()}),$pie_charts.length&&jQuery.fn.vcChat&&$pie_charts.vcChat(),$round_charts.length&&jQuery.fn.vcRoundChart&&$round_charts.vcRoundChart({reload:!1}),$frame.length&&jQuery.fn.vcLineChart&&$frame.vcLineChart({reload:!1}),$google_maps.length&&jQuery.fn.carousel&&$google_maps.carousel("resizeAction"),$frame=panel.find(".isotope, .wpb_image_grid_ul"),$google_maps=panel.find(".wpb_gmaps_widget"),0<$frame.length&&$frame.isotope("layout"),$google_maps.length&&!$google_maps.is(".map_ready")&&(($frame=$google_maps.find("iframe")).attr("src",$frame.attr("src")),$google_maps.addClass("map_ready")),panel.parents(".isotope").length&&panel.parents(".isotope").each(function(){jQuery(this).isotope("layout")}),$(document).trigger("wpb_prepare_tab_content",panel)}),"function"!=typeof window.vc_ttaActivation&&(window.vc_ttaActivation=function(){jQuery("[data-vc-accordion]").on("show.vc.accordion",function(e){var $=window.jQuery,ui={};ui.newPanel=$(this).data("vc.accordion").getTarget(),window.wpb_prepare_tab_content(e,ui)})}),"function"!=typeof window.vc_accordionActivate&&(window.vc_accordionActivate=function(event,ui){var $pie_charts,$round_charts,$line_charts,$carousel;ui.newPanel.length&&ui.newHeader.length&&($pie_charts=ui.newPanel.find(".vc_pie_chart:not(.vc_ready)"),$round_charts=ui.newPanel.find(".vc_round-chart"),$line_charts=ui.newPanel.find(".vc_line-chart"),$carousel=ui.newPanel.find('[data-ride="vc_carousel"]'),void 0!==jQuery.fn.isotope&&ui.newPanel.find(".isotope, .wpb_image_grid_ul").isotope("layout"),ui.newPanel.find(".vc_masonry_media_grid, .vc_masonry_grid").length&&ui.newPanel.find(".vc_masonry_media_grid, .vc_masonry_grid").each(function(){var grid=jQuery(this).data("vcGrid");grid&&grid.gridBuilder&&grid.gridBuilder.setMasonry&&grid.gridBuilder.setMasonry()}),vc_carouselBehaviour(ui.newPanel),vc_plugin_flexslider(ui.newPanel),$pie_charts.length&&jQuery.fn.vcChat&&$pie_charts.vcChat(),$round_charts.length&&jQuery.fn.vcRoundChart&&$round_charts.vcRoundChart({reload:!1}),$line_charts.length&&jQuery.fn.vcLineChart&&$line_charts.vcLineChart({reload:!1}),$carousel.length&&jQuery.fn.carousel&&$carousel.carousel("resizeAction"),ui.newPanel.parents(".isotope").length&&ui.newPanel.parents(".isotope").each(function(){jQuery(this).isotope("layout")}))}),"function"!=typeof window.initVideoBackgrounds&&(window.initVideoBackgrounds=function(){return window.console&&window.console.warn&&window.console.warn("this function is deprecated use vc_initVideoBackgrounds"),vc_initVideoBackgrounds()}),"function"!=typeof window.vc_initVideoBackgrounds&&(window.vc_initVideoBackgrounds=function(){jQuery("[data-vc-video-bg]").each(function(){var youtubeId,$element=jQuery(this);$element.data("vcVideoBg")?(youtubeId=$element.data("vcVideoBg"),(youtubeId=vcExtractYoutubeId(youtubeId))&&($element.find(".vc_video-bg").remove(),insertYoutubeVideoAsBackground($element,youtubeId)),jQuery(window).on("grid:items:added",function(event,$grid){$element.has($grid).length&&vcResizeVideoBackground($element)})):$element.find(".vc_video-bg").remove()})}),"function"!=typeof window.insertYoutubeVideoAsBackground&&(window.insertYoutubeVideoAsBackground=function($element,youtubeId,counter){if("undefined"==typeof YT||void 0===YT.Player)return 100<(counter=void 0===counter?0:counter)?void console.warn("Too many attempts to load YouTube api"):void setTimeout(function(){insertYoutubeVideoAsBackground($element,youtubeId,counter++)},100);var $container=$element.prepend('<div class="vc_video-bg vc_hidden-xs"><div class="inner"></div></div>').find(".inner");new YT.Player($container[0],{width:"100%",height:"100%",videoId:youtubeId,playerVars:{playlist:youtubeId,iv_load_policy:3,enablejsapi:1,disablekb:1,autoplay:1,controls:0,showinfo:0,rel:0,loop:1,wmode:"transparent"},events:{onReady:function(event){event.target.mute().setLoop(!0)}}}),vcResizeVideoBackground($element),jQuery(window).on("resize",function(){vcResizeVideoBackground($element)})}),"function"!=typeof window.vcResizeVideoBackground&&(window.vcResizeVideoBackground=function($element){var iframeW,iframeH,marginLeft,marginTop,containerW=$element.innerWidth(),containerH=$element.innerHeight();containerW/containerH<16/9?(iframeW=containerH*(16/9),iframeH=containerH,marginLeft=-Math.round((iframeW-containerW)/2)+"px",marginTop=-Math.round((iframeH-containerH)/2)+"px"):(iframeH=(iframeW=containerW)*(9/16),marginTop=-Math.round((iframeH-containerH)/2)+"px",marginLeft=-Math.round((iframeW-containerW)/2)+"px"),iframeW+="px",iframeH+="px",$element.find(".vc_video-bg iframe").css({maxWidth:"1000%",marginLeft:marginLeft,marginTop:marginTop,width:iframeW,height:iframeH})}),"function"!=typeof window.vcExtractYoutubeId&&(window.vcExtractYoutubeId=function(id){if(void 0===id)return!1;id=id.match(/(?:https?:\/{2})?(?:w{3}\.)?youtu(?:be)?\.(?:com|be)(?:\/watch\?v=|\/)([^\s&]+)/);return null!==id&&id[1]}),"function"!=typeof window.vc_googleMapsPointer&&(window.vc_googleMapsPointer=function(){var $=window.jQuery,$wpbGmapsWidget=$(".wpb_gmaps_widget");$wpbGmapsWidget.on("click",function(){$("iframe",this).css("pointer-events","auto")}),$wpbGmapsWidget.on("mouseleave",function(){$("iframe",this).css("pointer-events","none")}),$(".wpb_gmaps_widget iframe").css("pointer-events","none")}),"function"!=typeof window.vc_setHoverBoxPerspective&&(window.vc_setHoverBoxPerspective=function(hoverBox){hoverBox.each(function(){var $this=jQuery(this),width=$this.width();$this.css("perspective",4*width+"px")})}),"function"!=typeof window.vc_setHoverBoxHeight&&(window.vc_setHoverBoxHeight=function(hoverBox){hoverBox.each(function(){var hoverBoxHeight=jQuery(this),hoverBoxInner=hoverBoxHeight.find(".vc-hoverbox-inner");hoverBoxInner.css("min-height",0);var frontHeight=hoverBoxHeight.find(".vc-hoverbox-front-inner").outerHeight(),hoverBoxHeight=hoverBoxHeight.find(".vc-hoverbox-back-inner").outerHeight(),hoverBoxHeight=hoverBoxHeight<frontHeight?frontHeight:hoverBoxHeight;hoverBoxInner.css("min-height",(hoverBoxHeight=hoverBoxHeight<250?250:hoverBoxHeight)+"px")})}),"function"!=typeof window.vc_prepareHoverBox&&(window.vc_prepareHoverBox=function(){var hoverBox=jQuery(".vc-hoverbox");vc_setHoverBoxHeight(hoverBox),vc_setHoverBoxPerspective(hoverBox)}),jQuery(document).ready(window.vc_prepareHoverBox),jQuery(window).on("resize",window.vc_prepareHoverBox),jQuery(document).ready(function($){window.vc_js()})}(window.jQuery);
(function (){
'use strict';
const PERSIAN_CALENDAR_STYLES=`
.persian-calendar-wrapper {
background: #ffffff;
font-family: inherit;
direction: rtl;
text-align: right;
position: relative;
padding: 8px;
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
max-width: 320px;
-webkit-animation: fpFadeInDown 300ms cubic-bezier(0.23, 1, 0.32, 1);
animation: fpFadeInDown 300ms cubic-bezier(0.23, 1, 0.32, 1);
}
@-webkit-keyframes fpFadeInDown {
from { opacity: 0; -webkit-transform: translate3d(0, -20px, 0); transform: translate3d(0, -20px, 0); }
to { opacity: 1; -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); }}
@keyframes fpFadeInDown {
from { opacity: 0; -webkit-transform: translate3d(0, -20px, 0); transform: translate3d(0, -20px, 0); }
to { opacity: 1; -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); }}
.persian-calendar-nav {
display: flex;
justify-content: center;
align-items: center;
gap: 8px;
padding: 8px 0;
}
.persian-calendar-prev,
.persian-calendar-next {
width: 32px;
height: 32px;
border: none;
background: transparent!important;
border-radius: 2px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
font-size: 20px;
color: #007cba!important;
transition: background-color 0.2s ease;
}
.persian-calendar-prev:hover,
.persian-calendar-next:hover {
background: #f5fafc!important;
}
.persian-calendar-month-select {
padding: 4px 8px;
font-size: 13px;
font-weight: 600;
font-family: inherit;
border: 0px solid #ddd;
background: #fff;
cursor: pointer;
color: #1a1a1a;
min-width: 90px;
}
.persian-calendar-month-select:hover {
background: #f2f2f2;
}
.persian-calendar-month-select:focus {
outline: none;
border-color: #007cba;
}
.persian-calendar-year-input {
width: 60px !important;
padding: 4px 8px !important;
font-size: 13px !important;
font-weight: 600 !important;
font-family: inherit !important;
border: 0px solid #ddd !important;
background: #fff;
text-align: center !important;
color: #1a1a1a;
-moz-appearance: textfield;
}
.persian-calendar-year-input::-webkit-outer-spin-button,
.persian-calendar-year-input::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
.persian-calendar-year-input:hover {
background: #f2f2f2;
}
.persian-calendar-year-input:focus {
outline: none;
border-color: #007cba;
}
.persian-calendar-grid { margin-top: 12px; }
.persian-calendar-weekdays {
display: grid;
grid-template-columns: repeat(7, 1fr);
gap: 4px;
margin-bottom: 8px;
}
.persian-calendar-weekday {
text-align: center;
font-size: 12px;
font-weight: 500;
color: #757575;
padding: 4px;
}
.persian-calendar-days {
display: grid;
grid-template-columns: repeat(7, 1fr);
gap: 4px;
}
.persian-calendar-day {
display: flex;
align-items: center;
justify-content: center;
font-size: 14px;
border-radius: 50%;
cursor: pointer;
position: relative;
height: 32px;
width: 32px;
margin: 0 auto;
transition: all 0.15s ease;
}
.persian-calendar-day:not(.empty):hover { color: #007cba; }
.persian-calendar-day.today { background: #e0e0e0; font-weight: 500; }
.persian-calendar-day.selected { background: #007cba; color: white; font-weight: 600; }
.persian-calendar-day.selected:hover {color: white; }
.persian-calendar-day.empty { cursor: default; pointer-events: none; }
.persian-calendar-day:not(.empty):focus {
box-shadow: 0 0 0 var(--wp-admin-border-width-focus, 2px) var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
outline-offset: 2px;
}
@media (max-width: 480px){
.persian-calendar-wrapper { max-width: 100%; margin: 0 auto; }}
@media (prefers-contrast: high){
.persian-calendar-wrapper { border: 2px solid #000; }
.persian-calendar-day.selected { border: 2px solid #000; }}
@media (prefers-reduced-motion: reduce){
.persian-calendar-day, .persian-calendar-prev, .persian-calendar-next { transition: none; }}
`;
let stylesInjected=false;
function injectStyles(){
if(stylesInjected) return;
const styleElement=document.createElement('style');
styleElement.id='persian-calendar-styles';
styleElement.textContent=PERSIAN_CALENDAR_STYLES;
document.head.appendChild(styleElement);
stylesInjected=true;
}
const G_DAYS_IN_MONTH_NON_LEAP=[0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334];
const JALALI_EPOCH_DIFFERENCE=355666;
const JALALI_33_YEAR_CYCLE_DAYS=12053;
const GREGORIAN_4_YEAR_CYCLE_DAYS=1461;
const JALALI_YEAR_START_OFFSET=-1595;
const GREGORIAN_EPOCH_DIFFERENCE=-355668;
const JALALI_33_YEAR_CYCLE_LEAP_DAYS=8;
const GREGORIAN_400_YEAR_CYCLE_DAYS=146097;
const GREGORIAN_100_YEAR_CYCLE_DAYS=36524;
const isValidGregorian=(gy, gm, gd)=> {
if(!Number.isInteger(gy)||!Number.isInteger(gm)||!Number.isInteger(gd)) return false;
return !(gy < 1||gy > 3000||gm < 1||gm > 12||gd < 1||gd > 31);
};
const isValidJalali=(jy, jm, jd)=> {
if(!Number.isInteger(jy)||!Number.isInteger(jm)||!Number.isInteger(jd)) return false;
return !(jy < 1||jy > 3000||jm < 1||jm > 12||jd < 1||jd > 31);
};
const gregorianToJalali=(gy, gm, gd)=> {
if(!isValidGregorian(gy, gm, gd)) return [0, 0, 0];
const gy2=gm > 2 ? (gy + 1):gy;
let days=JALALI_EPOCH_DIFFERENCE + (365 * gy) + Math.floor((gy2 + 3) / 4) -
Math.floor((gy2 + 99) / 100) + Math.floor((gy2 + 399) / 400) + gd + G_DAYS_IN_MONTH_NON_LEAP[gm - 1];
let jy=JALALI_YEAR_START_OFFSET + 33 * Math.floor(days / JALALI_33_YEAR_CYCLE_DAYS);
days %=JALALI_33_YEAR_CYCLE_DAYS;
jy +=4 * Math.floor(days / GREGORIAN_4_YEAR_CYCLE_DAYS);
days %=GREGORIAN_4_YEAR_CYCLE_DAYS;
if(days > 365){ jy +=Math.floor((days - 1) / 365); days=(days - 1) % 365; }
let jm, jd;
if(days < 186){ jm=1 + Math.floor(days / 31); jd=1 + (days % 31); }else{ jm=7 + Math.floor((days - 186) / 30); jd=1 + ((days - 186) % 30); }
return [jy, jm, jd];
};
const jalaliToGregorian=(jy, jm, jd)=> {
if(!isValidJalali(jy, jm, jd)) return [0, 0, 0];
const jy_adj=jy + 1595;
let days=GREGORIAN_EPOCH_DIFFERENCE + (365 * jy_adj) +
(Math.floor(jy_adj / 33) * JALALI_33_YEAR_CYCLE_LEAP_DAYS) + Math.floor(((jy_adj % 33) + 3) / 4) + jd;
if(jm < 7) days +=(jm - 1) * 31; else days +=(jm - 7) * 30 + 186;
let gy=400 * Math.floor(days / GREGORIAN_400_YEAR_CYCLE_DAYS);
days %=GREGORIAN_400_YEAR_CYCLE_DAYS;
if(days > GREGORIAN_100_YEAR_CYCLE_DAYS){
gy +=100 * Math.floor(--days / GREGORIAN_100_YEAR_CYCLE_DAYS);
days %=GREGORIAN_100_YEAR_CYCLE_DAYS;
if(days >=365) days++;
}
gy +=4 * Math.floor(days / GREGORIAN_4_YEAR_CYCLE_DAYS);
days %=GREGORIAN_4_YEAR_CYCLE_DAYS;
if(days > 365){ gy +=Math.floor((days - 1) / 365); days=(days - 1) % 365; }
let gd=days + 1;
const isLeap=((gy % 4===0)&&(gy % 100!==0))||(gy % 400===0);
const G_DAYS_IN_MONTH=[0, 31, isLeap ? 29:28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
let gm;
for (gm=1; gm <=12; gm++){ if(gd <=G_DAYS_IN_MONTH[gm]) break; gd -=G_DAYS_IN_MONTH[gm]; }
return [gy, gm, gd];
};
const safeParseInt=(value, defaultValue=0, min=null, max=null)=> {
const parsed=parseInt(value, 10);
if(isNaN(parsed)) return defaultValue;
if(min!==null&&parsed < min) return min;
if(max!==null&&parsed > max) return max;
return parsed;
};
const isValidJalaliDate=(year, month, day)=> year >=1&&year <=3000&&month >=1&&month <=12&&day >=1&&day <=31;
const PERSIAN_MONTHS=['فروردین', 'اردیبهشت', 'خرداد', 'تیر', 'مرداد', 'شهریور', 'مهر', 'آبان', 'آذر', 'دی', 'بهمن', 'اسفند'];
const PERSIAN_WEEKDAYS=['ش', 'ی', 'د', 'س', 'چ', 'پ', 'ج'];
const PERSIAN_DIGITS=['۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹'];
const toPersianDigits=(str)=> String(str).replace(/[0-9]/g, (d)=> PERSIAN_DIGITS[d]);
const toAsciiDigits=(str)=> String(str).replace(/[۰-۹]/g, (d)=> PERSIAN_DIGITS.indexOf(d).toString());
const getDaysInJalaliMonth=(jy, jm)=> {
if(jm <=6) return 31;
if(jm <=11) return 30;
const leapYears=[1, 5, 9, 13, 17, 22, 26, 30];
return leapYears.includes(jy % 33) ? 30:29;
};
const IRAN_OFFSET_MINUTES=210;
const getIranLocalDate=()=> {
const now=new Date();
const browserOffsetMinutes=-now.getTimezoneOffset();
const diffMinutes=IRAN_OFFSET_MINUTES - browserOffsetMinutes;
return new Date(now.getTime() + diffMinutes * 60 * 1000);
};
class PersianCalendar {
constructor(container, options={}){
if(!container||!(container instanceof Element)) throw new Error('PersianCalendar: Invalid container element');
injectStyles();
this.container=container;
this.options={
selectedDate: (options.selectedDate instanceof Date) ? options.selectedDate:new Date(),
onDateSelect: (typeof options.onDateSelect==='function') ? options.onDateSelect:()=> { },
onClose: (typeof options.onClose==='function') ? options.onClose:()=> { },
title: options.title||'انتخاب تاریخ',
...options
};
let initialDate=this.options.selectedDate;
const browserOffsetMinutes=-initialDate.getTimezoneOffset();
const diffMinutes=IRAN_OFFSET_MINUTES - browserOffsetMinutes;
initialDate=new Date(initialDate.getTime() + diffMinutes * 60 * 1000);
const [jy, jm, jd]=gregorianToJalali(initialDate.getFullYear(), initialDate.getMonth() + 1, initialDate.getDate());
this.currentYear=jy;
this.currentMonth=jm;
this.selectedDate={ year: jy, month: jm, day: jd };
this._boundClickHandler=null;
this.render();
this.attachEventListeners();
}
render(){
this.container.textContent='';
const wrapper=document.createElement('div');
wrapper.className='persian-calendar-wrapper';
wrapper.appendChild(this.createDatePickerElement());
this.container.appendChild(wrapper);
this.dom={
monthSelect: this.container.querySelector('.persian-calendar-month-select'),
yearInput: this.container.querySelector('.persian-calendar-year-input'),
daysContainer: this.container.querySelector('.persian-calendar-days')
};
this.updateCalendarView();
}
createDatePickerElement(){
const datePicker=document.createElement('div');
datePicker.className='persian-calendar-date-picker';
const nav=document.createElement('div');
nav.className='persian-calendar-nav';
nav.innerHTML=`
<button class="persian-calendar-prev" type="button" aria-label="ماه قبل">‹</button>
<select class="persian-calendar-month-select" aria-label="انتخاب ماه">
${PERSIAN_MONTHS.map((m, i)=> `<option value="${i + 1}"${(i + 1)===this.currentMonth ? ' selected':''}>${m}</option>`).join('')}
</select>
<input type="number" class="persian-calendar-year-input" value="${this.currentYear}" min="1300" max="1500" aria-label="سال">
<button class="persian-calendar-next" type="button" aria-label="ماه بعد">›</button>
`;
const grid=document.createElement('div');
grid.className='persian-calendar-grid';
grid.innerHTML=`
<div class="persian-calendar-weekdays">${PERSIAN_WEEKDAYS.map(day=> `<div class="persian-calendar-weekday">${day}</div>`).join('')}</div>
<div class="persian-calendar-days" role="grid" aria-label="تقویم"></div>
`;
datePicker.appendChild(nav);
datePicker.appendChild(grid);
return datePicker;
}
createDaysFragment(){
const daysInMonth=getDaysInJalaliMonth(this.currentYear, this.currentMonth);
const [gy, gm, gd]=jalaliToGregorian(this.currentYear, this.currentMonth, 1);
const jsDay=new Date(Date.UTC(gy, gm - 1, gd)).getUTCDay();
const startDay=(jsDay + 1) % 7;
const today=getIranLocalDate();
const [todayJy, todayJm, todayJd]=gregorianToJalali(today.getFullYear(), today.getMonth() + 1, today.getDate());
const isTodayMonth=(this.currentMonth===todayJm&&this.currentYear===todayJy);
const isSelectedMonth=(this.currentMonth===this.selectedDate.month&&this.currentYear===this.selectedDate.year);
const fragment=document.createDocumentFragment();
for (let i=0; i < startDay; i++){
const emptyDay=document.createElement('div');
emptyDay.className='persian-calendar-day empty';
emptyDay.setAttribute('aria-hidden', 'true');
fragment.appendChild(emptyDay);
}
for (let day=1; day <=daysInMonth; day++){
const dayElement=document.createElement('div');
dayElement.className='persian-calendar-day';
dayElement.setAttribute('data-day', day.toString());
dayElement.setAttribute('role', 'gridcell');
dayElement.setAttribute('tabindex', '0');
dayElement.textContent=toPersianDigits(day);
if(isTodayMonth&&day===todayJd){ dayElement.classList.add('today'); dayElement.setAttribute('aria-current', 'date'); }
if(isSelectedMonth&&day===this.selectedDate.day){ dayElement.classList.add('selected'); dayElement.setAttribute('aria-selected', 'true'); }
fragment.appendChild(dayElement);
}
return fragment;
}
attachEventListeners(){
this._boundClickHandler=(e)=> {
const target=e.target;
if(target.matches('.persian-calendar-day:not(.empty)')){
const day=safeParseInt(target.dataset.day, 1, 1, 31);
if(isValidJalaliDate(this.currentYear, this.currentMonth, day)) this.selectDate(this.currentYear, this.currentMonth, day);
}else if(target.matches('.persian-calendar-prev')){ this.previousMonth(); }
else if(target.matches('.persian-calendar-next')){ this.nextMonth(); }};
this.container.addEventListener('click', this._boundClickHandler);
if(this.dom.monthSelect){
this.dom.monthSelect.addEventListener('change', (e)=> {
this.currentMonth=parseInt(e.target.value, 10);
this.updateCalendarView();
});
}
if(this.dom.yearInput){
this.dom.yearInput.addEventListener('change', (e)=> {
const year=parseInt(e.target.value, 10);
if(year >=1300&&year <=1500){
this.currentYear=year;
this.updateCalendarView();
}else{
e.target.value=this.currentYear;
}});
}}
selectDate(year, month, day){
this.selectedDate={ year, month, day };
this.updateCalendarView();
this.notifyDateChange();
}
previousMonth(){
this.currentMonth--;
if(this.currentMonth < 1){ this.currentMonth=12; this.currentYear--; }
this.updateCalendarView();
}
nextMonth(){
this.currentMonth++;
if(this.currentMonth > 12){ this.currentMonth=1; this.currentYear++; }
this.updateCalendarView();
}
updateCalendarView(){
if(this.dom.monthSelect) this.dom.monthSelect.value=this.currentMonth;
if(this.dom.yearInput) this.dom.yearInput.value=this.currentYear;
if(this.dom.daysContainer){ this.dom.daysContainer.textContent=''; this.dom.daysContainer.appendChild(this.createDaysFragment()); }}
notifyDateChange(){
const [gy, gm, gd]=jalaliToGregorian(this.selectedDate.year, this.selectedDate.month, this.selectedDate.day);
this.options.onDateSelect({ jalali: { ...this.selectedDate }, gregorian: { year: gy, month: gm, day: gd }, date: new Date(gy, gm - 1, gd) });
}
getSelectedDate(){
const [gy, gm, gd]=jalaliToGregorian(this.selectedDate.year, this.selectedDate.month, this.selectedDate.day);
return new Date(gy, gm - 1, gd);
}
destroy(){
if(this._boundClickHandler) this.container.removeEventListener('click', this._boundClickHandler);
this.container.textContent='';
this.dom=null;
this._boundClickHandler=null;
}}
window.PersianDateConverter={ gregorianToJalali, jalaliToGregorian, isValidGregorian, isValidJalali, toPersianDigits, toAsciiDigits, getDaysInJalaliMonth, PERSIAN_MONTHS, PERSIAN_WEEKDAYS };
window.PersianCalendar=PersianCalendar;
})();
(function (){
'use strict';
var activeCalendars=new WeakMap();
var calendarPopup=null;
var currentInput=null;
var lastOpenTime=0;
function getOrCreatePopup(){
if(!calendarPopup){
calendarPopup=document.createElement('div');
calendarPopup.className='persian-date-popup';
calendarPopup.style.cssText='position:absolute;z-index:999999;display:none;';
document.body.appendChild(calendarPopup);
}
return calendarPopup;
}
function positionPopup(input){
var popup=getOrCreatePopup();
var rect=input.getBoundingClientRect();
var scrollTop=window.pageYOffset||document.documentElement.scrollTop;
var scrollLeft=window.pageXOffset||document.documentElement.scrollLeft;
popup.style.top=(rect.bottom + scrollTop + 5) + 'px';
popup.style.left=(rect.left + scrollLeft) + 'px';
setTimeout(function (){
var popupRect=popup.getBoundingClientRect();
if(popupRect.right > window.innerWidth){
popup.style.left=(window.innerWidth - popupRect.width - 10 + scrollLeft) + 'px';
}
if(popupRect.bottom > window.innerHeight){
popup.style.top=(rect.top + scrollTop - popupRect.height - 5) + 'px';
}}, 0);
}
function isCalendarOpen(){
return calendarPopup&&calendarPopup.style.display!=='none';
}
function showCalendar(input){
if(typeof PersianCalendar==='undefined'){
console.error('Persian Elementor: PersianCalendar not loaded');
return;
}
if(isCalendarOpen()&&currentInput!==input){
hideCalendar();
}
if(isCalendarOpen()&&currentInput===input){
return;
}
var popup=getOrCreatePopup();
currentInput=input;
lastOpenTime=Date.now();
if(activeCalendars.has(popup)){
var oldCalendar=activeCalendars.get(popup);
if(oldCalendar&&typeof oldCalendar.destroy==='function'){
oldCalendar.destroy();
}
activeCalendars.delete(popup);
}
popup.innerHTML='';
var targetInput=input;
var selectedDate=new Date();
var existingValue=targetInput.value;
if(existingValue&&typeof PersianDateConverter!=='undefined'){
var parts=existingValue.split('/');
if(parts.length===3){
var jy=parseInt(parts[0], 10);
var jm=parseInt(parts[1], 10);
var jd=parseInt(parts[2], 10);
var gregorian=PersianDateConverter.jalaliToGregorian(jy, jm, jd);
if(gregorian[0] > 0){
selectedDate=new Date(gregorian[0], gregorian[1] - 1, gregorian[2]);
}}
}
var calendar=new PersianCalendar(popup, {
selectedDate: selectedDate,
title: 'انتخاب تاریخ',
showCloseButton: true,
onDateSelect: function (dateInfo){
var jalali=dateInfo.jalali;
var formatted=jalali.year + '/' +
String(jalali.month).padStart(2, '0') + '/' +
String(jalali.day).padStart(2, '0');
targetInput.value=formatted;
var event=new Event('change', { bubbles: true });
targetInput.dispatchEvent(event);
hideCalendar();
},
onClose: function (){
hideCalendar();
}});
activeCalendars.set(popup, calendar);
var labelElement=targetInput.closest('.elementor-field-group');
if(labelElement){
var label=labelElement.querySelector('label');
if(label){
var computedStyle=window.getComputedStyle(label);
popup.style.fontFamily=computedStyle.fontFamily;
}}
popup.addEventListener('click', function (e){
e.stopPropagation();
});
popup.style.display='block';
positionPopup(input);
input.setAttribute('data-calendar-open', 'true');
}
function hideCalendar(){
if(calendarPopup){
calendarPopup.style.display='none';
calendarPopup.innerHTML='';
}
if(currentInput){
currentInput.removeAttribute('data-calendar-open');
currentInput=null;
}}
function initPersianDateField(inputOrId){
var input=typeof inputOrId==='string' ?
document.getElementById(inputOrId):inputOrId;
if(!input) return false;
if(input.getAttribute('data-persian-date-initialized')) return true;
input.setAttribute('data-persian-date-initialized', 'true');
input.addEventListener('click', function (e){
e.preventDefault();
e.stopPropagation();
if(isCalendarOpen()&&currentInput===input){
hideCalendar();
}else{
showCalendar(input);
}});
input.addEventListener('focus', function (e){
});
return true;
}
function initAllDateFields(){
var fields=document.querySelectorAll('[data-persian-date]:not([data-persian-date-initialized])');
fields.forEach(function (field){
initPersianDateField(field);
});
}
document.addEventListener('click', function (e){
if(!isCalendarOpen()) return;
if(Date.now() - lastOpenTime < 100) return;
if(calendarPopup.contains(e.target)) return;
if(currentInput&&e.target===currentInput) return;
hideCalendar();
});
if(document.readyState==='loading'){
document.addEventListener('DOMContentLoaded', function (){
initAllDateFields();
});
}else{
initAllDateFields();
}
var observer=new MutationObserver(function (mutations){
var shouldReinit=false;
mutations.forEach(function (mutation){
if(mutation.type==='childList'){
mutation.addedNodes.forEach(function (node){
if(node.nodeType===Node.ELEMENT_NODE){
if(node.matches&&node.matches('[data-persian-date]')){
shouldReinit=true;
}else if(node.querySelector&&node.querySelector('[data-persian-date]')){
shouldReinit=true;
}}
});
}});
if(shouldReinit){
initAllDateFields();
}});
observer.observe(document.body, {
childList: true,
subtree: true
});
window.initPersianDateField=initPersianDateField;
window.initAllPersianDateFields=initAllDateFields;
window.hidePersianCalendar=hideCalendar;
})();