"use strict";(function($){$(document).ready(function(){let targetSticky=$(".site-header");let positionTop=0;$(window).on("scroll",function(){let scroll=$(window).scrollTop();if(scroll>0){targetSticky.addClass("sticky-active");if(scroll<positionTop){targetSticky.addClass("sticky-up");targetSticky.removeClass("sticky-down")}else{targetSticky.addClass("sticky-down");targetSticky.removeClass("sticky-up")}}else{targetSticky.removeClass("sticky-active");targetSticky.removeClass("sticky-up");targetSticky.removeClass("sticky-down")}
positionTop=scroll});function preventScroll(){$("html").toggleClass("prevent-scroll")}
$(".main-navigation .menu-item-has-children").each(function(){$(this).append($("<i class='icon-submenu'></i>"))});$(".btn-toggle-state").on("click",function(e){e.preventDefault();let $this=$(this);let idtargetParent=$this.attr("data-parenttarget");let stateScroll=$this.attr("data-scrollstate");let targetParent=$("#"+idtargetParent);if(!targetParent.hasClass("toggle-onactive")){$(".toggle-onactive").removeClass("toggle-onactive")}
targetParent.toggleClass("toggle-onactive");if(stateScroll==="yes"){preventScroll()}});$(document).on("click",function(e){let parentToggle=$(e.target).parents();if(!parentToggle.is(".site-header",".toggle-onactive")){$(".site-header.toggle-onactive").removeClass("toggle-onactive");$(".prevent-scroll").removeClass("prevent-scroll")}});$(".menu-item-has-children .icon-submenu").on("click",function(){let $thisParent=$(this).parent();if($thisParent.hasClass("menu-item-active")){$thisParent.find(".menu-item-active").removeClass("menu-item-active")}
$(this).parent().toggleClass("menu-item-active")});$("#site-header .menu a").on("click",function(){$("#site-header.toggle-onactive").removeClass("toggle-onactive")});var observer=new MutationObserver(function(mutations){mutations.forEach(function(mutation){if($(mutation.target).find(".vc_tta-tab > a").length){$(mutation.target).find(".vc_tta-tab > a").off("click").on("click",function(e){e.preventDefault();var $tab=$(this).parent();var $container=$(this).closest(".vc_tta-container");var $content=$container.find($(this).attr("href"));$tab.addClass("vc_active").siblings().removeClass("vc_active");$content.addClass("vc_active").siblings().removeClass("vc_active")})}})});observer.observe(document.body,{childList:!0,subtree:!0});$(".list-tab-target li").on("click",function(e){e.preventDefault();e.stopPropagation();var targetId=$(this).data("target");$(".list-tab-target li").removeClass("active");$(this).addClass("active");if($(targetId).length){$(".tab-side-list").removeClass("show");$(targetId).addClass("show")}else{console.error(`Elemen dengan id ${targetId} tidak ditemukan!`)}});document.querySelectorAll(".related").forEach(function(section){if(!section.querySelector(".listing-item")){section.remove()}});if(window.location.pathname.includes("/informasi")){var selectedCategoryId=localStorage.getItem("selectedCategoryBlogId");if(selectedCategoryId){var radioInput=$('input.meta-input[type="radio"][value="'+selectedCategoryId+'"]');if(radioInput.length){radioInput.prop("checked",!0);setTimeout(function(){radioInput.trigger("change");localStorage.removeItem("selectedCategoryBlogId")},100)}}}
if(window.location.pathname.includes("/informasi")){var selectedCategoryIdSide=localStorage.getItem("selectedCategoryBlogIdSide");if(selectedCategoryIdSide){var radioInput=$('input.meta-input[type="radio"][value="'+selectedCategoryIdSide+'"]');if(radioInput.length){radioInput.prop("checked",!0);setTimeout(function(){radioInput.trigger("change");localStorage.removeItem("selectedCategoryBlogIdSide")},100)}}}
const $input=$("#searchForm input");const $searchService=$(".search-service");$input.on("focus",function(){if($input.val().trim()===""){$searchService.addClass("show")}});$input.on("input",function(){if($input.val().trim()===""){$searchService.addClass("show")}else{$searchService.removeClass("show")}});$input.on("blur",function(e){setTimeout(()=>{if(!$searchService.is(":hover")){$searchService.removeClass("show")}
$('.search-wrapper').removeClass("active")},100)});$(".icon-search").on("click",function(){$("html").addClass("prevent-default");$(".search-wrapper").toggleClass("active");$("#site-header").removeClass("toggle-onactive")});$(".overlay-search").on("click",function(){$("html").removeClass("prevent-default");$(".search-wrapper").removeClass("active")});if($("input[type='tel']")[0]){$("input[type='tel']").on("input",function(e){$(this).val($(this).val().replace(/[^0-9\\+]/g,""))})}})})(jQuery);document.addEventListener("DOMContentLoaded",function(){var ColumnLink={fallback:function(){String.prototype.startsWith||(String.prototype.startsWith=function(t,n){return(n=n||0),this.indexOf(t,n)===n})},func:function(t){var n=t.querySelector("a");n?n.click():console.warn(t.className+" doesnt have anchor link.")},init:function(t){var n=document.querySelectorAll(t.el),e=0,i=this;for(i.fallback(),e=0;e<n.length;e++)
n[e].addEventListener("click",function(){i.func(this)})},};ColumnLink.init({el:".row-column-link .wpb_column, .row-social-media",})});function addWheelListener(){const searchResults=document.querySelector(".wh-autocomplete");if(searchResults){searchResults.addEventListener("wheel",(event)=>{searchResults.scrollTop+=event.deltaY;event.preventDefault()})}else{setTimeout(addWheelListener,100)}}
addWheelListener()