You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
37 KiB
Plaintext

(()=>{var e,t,a={420:()=>{window.wteL10n=window.wteL10n||{},window.wteL10n.api=window.wteapi=window.WTEApi=class{constructor(){}static async get(e,t={},a={}){let n={packages:this.getPackages,categories:this.getPackageCategories,trip:this.getTrip};return wteL10n.locale&&(t.lang=wteL10n.locale),this[e]||(this[e]="trip"==e?await n[e](t,a):lodash.keyBy(await n[e](t,a),"id")),this[e]}static async getTrip(e,t){const a=await fetch(`${wteL10n.wpapi.root+wteL10n.wpapi.versionString}trip/${e.id}?context=${e.context||"view"}`,t);return await a.json()}static async getPackageCategories(e){const t=await fetch(`${wteL10n.wpapi.root+wteL10n.wpapi.versionString}package-categories?per_page=100`);return await t.json()}static async getPackages(e,t){var a;const n=Object.entries(e).map((([e,t])=>`${e}=${t}`)).join("&"),i=await fetch(`${wteL10n.wpapi.root+wteL10n.wpapi.versionString}packages/${null!==(a=e.id)&&void 0!==a?a:`?${n}`}`,t);return await i.json()}static async addNewPackage(e){const t=await fetch(`${wteL10n.wpapi.root+wteL10n.wpapi.versionString}packages`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":wteL10n.wpapi.nonce},body:JSON.stringify({title:"Untitled Package",status:"publish",post_type:"trip-packages",...e})});return await t.json()}static async removePackage(e){const t=await fetch(`${wteL10n.wpapi.root+wteL10n.wpapi.versionString}packages/${e.id}`,{method:"DELETE",headers:{"Content-Type":"application/json","X-WP-Nonce":wteL10n.wpapi.nonce}});return await t.json()}}},1778:(e,t,a)=>{"use strict";function n(){}a.d(t,{A:()=>i}),n.hasClass=function(e,t){return e.classList?e.classList.contains(t):!!e.getAttribute("class").match(new RegExp("(\\s|^)"+t+"(\\s|$)"))},n.addClass=function(e,t){var a=t.split(" ");e.classList?e.classList.add(a[0]):n.hasClass(e,a[0])||e.setAttribute("class",e.getAttribute("class")+" "+a[0]),a.length>1&&n.addClass(e,a.slice(1).join(" "))},n.removeClass=function(e,t){var a=t.split(" ");if(e.classList)e.classList.remove(a[0]);else if(n.hasClass(e,a[0])){var i=new RegExp("(\\s|^)"+a[0]+"(\\s|$)");e.setAttribute("class",e.getAttribute("class").replace(i," "))}a.length>1&&n.removeClass(e,a.slice(1).join(" "))},n.toggleClass=function(e,t,a){a?n.addClass(e,t):n.removeClass(e,t)},n.setAttributes=function(e,t){for(var a in t)e?.setAttribute&&e.setAttribute(a,t[a])},n.getChildrenByClassName=function(e,t){e.children;for(var a=[],i=0;i<e.children.length;i++)n.hasClass(e.children[i],t)&&a.push(e.children[i]);return a},n.getIndexInArray=function(e,t){return Array.prototype.indexOf.call(e,t)},n.on=function(e,t,a){document.addEventListener(e,(function(e){for(var n=e.target;n&&n!=this;n=n.parentNode)if(n.matches(t)){a.call(n,e);break}}),!1)};const i=n},3051:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>n});const n=()=>{new MutationObserver((()=>{const e=document.querySelectorAll(".wpte-material-ui-input-control");e&&e.forEach((e=>{const t=e.querySelector('input:not([type="hidden"])')||e.querySelector("select")||e.querySelector("textarea");((e,t)=>{e.value?t.classList.add("focus"):t.classList.remove("focus")})(t,e),"date"===t.type?e.classList.add("focus"):(t.addEventListener("blur",(()=>{t.value?e.classList.add("focus"):e.classList.remove("focus")})),t.addEventListener("focus",(()=>{e.classList.add("focus")})))}))})).observe(document.body,{childList:!0,subtree:!0})}},4126:(e,t,a)=>{"use strict";a.d(t,{A:()=>n});const n=function(e){const t=e.querySelectorAll(".tab-anchor-wrapper");t&&Array.from(t).forEach((function(a){a.querySelector(".nb-tab-trigger").addEventListener("click",(function(n){n.preventDefault(),Array.from(t).forEach((e=>{e.classList.remove("nav-tab-active");let t=e.querySelector(".nb-tab-trigger");t.classList.remove("nav-tab-active");let a=document.getElementById(`nb-${t.dataset.configuration}-configurations`);a&&(a.style.display="none")}));let i=this.dataset.target,o=null;o=i?document.getElementById(i):document.getElementById(`nb-${this.dataset.configuration}-configurations`),a.classList.toggle("nav-tab-active"),this.classList.toggle("nav-tab-active"),"block"===o.style.display?o.style.display="none":o.style.display="block",(e.classList.contains("in-mobile")||e.classList.contains("wpte-tabs-sticky"))&&o.scrollIntoView({behavior:"smooth"})}))})),window.addEventListener("scroll",(function(){var e=document.querySelectorAll(".wpte-tabs-container.wpte-tabs-sticky .tab-content .nb-configurations"),t={},a=0;Array.prototype.forEach.call(e,(function(e){t[e.id]=e.offsetTop}));var n=document.documentElement.scrollTop||document.body.scrollTop;for(a in t)if(t[a]<=n+100){const e=a.split("");var i=document.querySelector('[data-configuration="'+e[3]+'"]');document.querySelector(".nav-tab-active").classList.remove("nav-tab-active"),i.classList.add("nav-tab-active")}document.querySelector(".wpte-tabs-container"),n=document.documentElement.scrollTop||document.body.scrollTop}))}}},n={};function i(e){var t=n[e];if(void 0!==t)return t.exports;var o=n[e]={exports:{}};return a[e](o,o.exports,i),o.exports}i.m=a,i.d=(e,t)=>{for(var a in t)i.o(t,a)&&!i.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},i.f={},i.e=e=>Promise.all(Object.keys(i.f).reduce(((t,a)=>(i.f[a](e,t),t)),[])),i.u=e=>{if(702===e)return"chunks/702.js"},i.miniCssF=e=>{},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="wp-travel-engine:",i.l=(a,n,o,r)=>{if(e[a])e[a].push(n);else{var s,l;if(void 0!==o)for(var c=document.getElementsByTagName("script"),d=0;d<c.length;d++){var u=c[d];if(u.getAttribute("src")==a||u.getAttribute("data-webpack")==t+o){s=u;break}}s||(l=!0,(s=document.createElement("script")).charset="utf-8",s.timeout=120,i.nc&&s.setAttribute("nonce",i.nc),s.setAttribute("data-webpack",t+o),s.src=a),e[a]=[n];var p=(t,n)=>{s.onerror=s.onload=null,clearTimeout(m);var i=e[a];if(delete e[a],s.parentNode&&s.parentNode.removeChild(s),i&&i.forEach((e=>e(n))),t)return t(n)},m=setTimeout(p.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=p.bind(null,s.onerror),s.onload=p.bind(null,s.onload),l&&document.head.appendChild(s)}},i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;i.g.importScripts&&(e=i.g.location+"");var t=i.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var a=t.getElementsByTagName("script");if(a.length)for(var n=a.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=a[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.p=e+"../"})(),(()=>{var e={458:0,708:0,978:0};i.f.j=(t,a)=>{var n=i.o(e,t)?e[t]:void 0;if(0!==n)if(n)a.push(n[2]);else{var o=new Promise(((a,i)=>n=e[t]=[a,i]));a.push(n[2]=o);var r=i.p+i.u(t),s=new Error;i.l(r,(a=>{if(i.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var o=a&&("load"===a.type?"missing":a.type),r=a&&a.target&&a.target.src;s.message="Loading chunk "+t+" failed.\n("+o+": "+r+")",s.name="ChunkLoadError",s.type=o,s.request=r,n[1](s)}}),"chunk-"+t,t)}};var t=(t,a)=>{var n,o,[r,s,l]=a,c=0;if(r.some((t=>0!==e[t]))){for(n in s)i.o(s,n)&&(i.m[n]=s[n]);l&&l(i)}for(t&&t(a);c<r.length;c++)o=r[c],i.o(e,o)&&e[o]&&e[o][0](),e[o]=0},a=globalThis.webpackChunkwp_travel_engine=globalThis.webpackChunkwp_travel_engine||[];a.forEach(t.bind(null,0)),a.push=t.bind(null,a.push.bind(a))})(),(()=>{"use strict";var e={};i.r(e),i.d(e,{calculateGrandTotal:()=>s,numberFormat:()=>l,phpToMomentDF:()=>d,priceFormat:()=>c,wteGetFormatedPrice:()=>a,wteGetFormatedPriceWithCurrencyCode:()=>n,wteGetFormatedPriceWithCurrencyCodeSymbol:()=>o,wteGetFormatedPriceWithCurrencySymbol:()=>r});var t=i(1778);i(420);function a(e,t,a){return e=e||0,t=t||!0,a=a||0,"undefined"!=typeof WTE_CC_convData&&WTE_CC_convData.rate&&(e*=parseFloat(WTE_CC_convData.rate)),0==t?e:(e=(e=(e=parseFloat(e)).toFixed(a)).replace(".00",""),e=addCommas(e))}function n(e,t,a,n){return wteL10n.priceFormat(e).format(!0,!!a)}function o(e,t,a,n,i){return wteL10n.priceFormat(e).format(!1,!!n)}function r(e,t,a,n){return wteL10n.priceFormat(e).format(!1,!!a)}function s(){return parseFloat(window.wte.trip.travellersCost)+parseFloat(window.wte.trip.extraServicesCost)}function l(e,t=2,a=".",n=","){try{t=Math.abs(t),t=isNaN(t)?2:t;const i=e<0?"-":"";let o=parseInt(e=Math.abs(Number(e)||0).toFixed(t)).toString(),r=o.length>3?o.length%3:0;return i+(r?o.substr(0,r)+n:"")+o.substr(r).replace(/(\d{3})(?=\d)/g,"$1"+n)+(t?a+Math.abs(e-o).toFixed(t).slice(2):"")}catch(e){console.log(e)}}function c(e,t,a,n="%CURRENCY_SYMBOL%%FORMATED_AMOUNT%",i=2,o=".",r=",",s=!1){e<0&&(n.includes("%AMOUNT%")||n.includes("%FORMATED_AMOUNT%"))&&(e=Math.abs(e),n="-"+n);let c={"%CURRENCY_CODE%":s?t:`<span class="wpte-currency-code currency">${t}</span>`,"%CURRENCY_SYMBOL%":s?a:`<span class="wpte-currency-code currency">${a}</span>`,"%AMOUNT%":s?e:`<strong class="wpte-price amount">${e}</strong>`,"%FORMATED_AMOUNT%":s?l(e,i,o,r):`<strong class="wpte-price amount">${l(e,i,o,r)}</strong>`};return n.split(/(%\w+%)/g).reduce(((e="",t)=>{const a=c[t];return a||0===a?e+a:e+t}))}function d(e){let t={d:"DD",D:"ddd",j:"D",l:"dddd",w:"d",F:"MMMM",M:"MMM",m:"MM",n:"M",S:"o",jS:"Do",Y:"YYYY",y:"YY"};return e.match(/(\\?\\?[\w\W])/g)?.map((e=>t[e]||e)).join("")}window.wteL10n.util=window.wteutil=t.A,window.wteL10n.ui=window.wteui=window.wteL10n.ui||{},window.wteL10n.ui.Accordion=window.wteui.Accordion=class{constructor(e){this.element=e,t.A.addClass(this.element,"wte-accordion-initialized"),this.items=t.A.getChildrenByClassName(this.element,"wte-accordion-item"),this.version=this.element.getAttribute("data-version")?"-"+this.element.getAttribute("data-version"):"",this.showClass="wte-accordion-open",this.animateHeight="on"==this.element.getAttribute("data-animation"),this.multiItems=!("off"==this.element.getAttribute("data-multi-items")),this.deepLinkOn="on"==this.element.getAttribute("data-deep-link"),this.initAccordion()}initAccordion(){for(var e=0;e<this.items.length;e++){var a=this.items[e].getElementsByClassName("wte-accordion-button")[0];if(a){var n=this.items[e].getElementsByClassName("wte-accordion-collapse")[0],i=t.A.hasClass(this.items[e],this.showClass)?"true":"false";t.A.setAttributes(a,{"aria-expanded":i,"aria-controls":"accordion-content-"+e,id:"accordion-header-"+e}),t.A.addClass(a,"wte-accordion-trigger"),t.A.setAttributes(n,{"aria-labelledby":"accordion-header-"+e,id:"accordion-content-"+e})}}this.initAccordionEvents(),this.initDeepLink()}initAccordionEvents(){var e=this;this.element.addEventListener("click",(function(a){var n=a.target.closest(".wte-accordion-trigger");n&&t.A.getIndexInArray(e.items,n.closest(".wte-accordion-item"))>=0&&e.triggerAccordion(n)}))}triggerAccordion(e){var t="true"===e.getAttribute("aria-expanded");this.animateAccordion(e,t,!1),!t&&this.deepLinkOn&&history.replaceState(null,"","#"+e.getAttribute("aria-controls"))}animateAccordion(e,a,n){var i=e.closest(".wte-accordion-item"),o=i.getElementsByClassName("wte-accordion-collapse")[0],r=a?"false":"true";t.A.toggleClass(i,this.showClass,!a),e.setAttribute("aria-expanded",r),o&&this.resetContentVisibility(i,o,a),(!this.multiItems&&!a||n)&&this.closeSiblings(i)}resetContentVisibility(e,a,n){t.A.toggleClass(e,this.showClass,!n),a.removeAttribute("style"),n&&!this.multiItems&&this.moveContent()}closeSiblings(e){for(var a=t.A.getIndexInArray(this.items,e),n=0;n<this.items.length;n++)if(t.A.hasClass(this.items[n],this.showClass)&&n!=a)return this.animateAccordion(this.items[n].getElementsByClassName("wte-accordion-trigger")[0],!0,!1),!1}moveContent(){var e=this.element.getElementsByClassName(this.showClass);if(0!=e.length){var t=e[0].getBoundingClientRect();if(t.top<0||t.top>window.innerHeight){var a=window.scrollY||document.documentElement.scrollTop;window.scrollTo(0,t.top+a)}}}initDeepLink(){if(this.deepLinkOn){var e=window.location.hash.substr(1);if(e&&""!=e){var t=this.element.querySelector('.wte-accordion-trigger[aria-controls="'+e+'"]');t&&"true"!==t.getAttribute("aria-expanded")&&(this.animateAccordion(t,!1,!0),setTimeout((function(){t.scrollIntoView(!0)})))}}}},window.wteL10n.helpers=window.wtehelpers=e,window.addCommas||(window.addCommas=e=>{for(var t=(e+="").split("."),a=t[0],n=t.length>1?"."+t[1]:"",i=/(\d+)(\d{3})/;i.test(a);)a=a.replace(i,"$1"+WPTE_Price_Separator+"$2");return a+n}),window.wteGetFormatedPrice=a,window.wteGetFormatedPriceWithCurrencyCode=n,window.wteGetFormatedPriceWithCurrencyCodeSymbol=o,window.wteGetFormatedPriceWithCurrencySymbol=r,window.calculateGrandTotal=s;const u=function(e){const{currency:t,baseCurrency:a,currencySymbol:n,format:{number:i,price:o}}=wteL10n;let r={"%CURRENCY_CODE%":`${t}`,"%CURRENCY_SYMBOL%":`${n}`,"%AMOUNT%":""+(e*=+{[a]:1}[t]),"%FORMATED_AMOUNT%":`${l(e,+i.decimal,i.decimalSeparator,i.thousansSeparator)}`};return o.split(/(%\w+%)/g).reduce(((e="",t)=>r[t]?e+r[t]:e+t))};t.A.on("click",".wte-popper button",(function(e){let a=this.closest(".wte-popper");a&&t.A.toggleClass(a,"active",!t.A.hasClass(a,"active"))}));const p=function(e){if(!t.A.hasClass(e,"wte-price-field")){let t=e.parentElement,a=document.createElement("input");a.type="hidden",a.name=e.name,a.value=e.value,e.name="",e.value=u(e.value),t.appendChild(a),e.addEventListener("focus",(function(){e.value=a.value})),e.addEventListener("blur",(function(){a.value=e.value,e.value=u(e.value)})),e.classList.add("wte-price-field")}};function m(e){var t=wteL10n.version,a=document.querySelectorAll("[class*=_wte_update_notice_], [data-wte-update]");if(a)for(var n in a){var i=a[n];if(i.classList)if(i.classList.contains(`_wte_update_notice_${t}`))i.classList.remove(`_wte_update_notice_${t}`);else{var o=new RegExp(`^(wte_(new|updated|note)_${t})$`);if(i.dataset.wteUpdate.match(o)){var r=i.dataset.wteUpdate;i.classList.add(r),i.removeAttribute("data-wte-update")}}}}window.wteL10n.ui.priceField=p,document.addEventListener("wteEditPackageRender",(function(){document.querySelectorAll('[data-wte-field-type="price"]')?.forEach((function(e){p(e)}))})),t.A.on("change","[data-toggle-target]",(function(e){let t=document.querySelector(this.dataset.toggleTarget);t&&(this.checked?t.style.removeProperty("display"):t.style.display="none")})),t.A.on("click",".wpte-edit-booking-detail",(function(e){e.preventDefault(),this.closest(".wpte-block").querySelectorAll("select, input").forEach((function(e){e.dataset.attribName&&(e.name=e.dataset.attribName),e.dataset.attribValue&&(e.value=e.dataset.attribValue),e.dataset.attribType&&(e.type=e.dataset.attribType),e.disabled&&(e.disabled=!1),e.type&&(e.readOnly=!1)})),this.closest(".wpte-block").querySelectorAll(".show_on_edit").forEach((function(){this.style.removeProperty("display")}))})),t.A.on("click",".wpte-edit-additional-note",(function(e){e.preventDefault(),this.closest(".wpte-block").querySelectorAll("select, input").forEach((function(e){e.dataset.attribName&&(e.name=e.dataset.attribName),e.dataset.attribValue&&(e.value=e.dataset.attribValue),e.dataset.attribType&&(e.type=e.dataset.attribType),e.disabled&&(e.disabled=!1),e.type&&(e.readOnly=!1)})),this.closest(".wpte-block").querySelectorAll(".show_on_edit").forEach((function(){this.style.removeProperty("display")}))})),t.A.on("click",".wte-email-template-updater",(function(e){e.preventDefault();var t=document.getElementById(this.dataset.target);t&&t.submit()})),document.addEventListener("wteSettingsTabContentLoaded",m),document.addEventListener("DOMContentLoaded",(e=>{m();var a=document.querySelectorAll(".wte-code");a&&a.forEach((function(e){e.dataset.height&&(e.style.height=e.dataset.height+"px"),hljs&&hljs.highlightBlock(e)})),t.A.on("click",".wte-onclick-toggler",(function(e){if(e.preventDefault(),this.dataset.target){var t=document.querySelector(this.dataset.target);t&&(Array.from(t.classList).includes("visible")?(t.classList.remove("visible"),t.style.display="none"):(t.style.removeProperty("display"),t.classList.add("visible")))}}))})),window.wteL10n=window.wteL10n||{};const h=function(e){this._value=e,this._getPriceFormat=function(){return wteL10n.format.price},this.get=function(){return this._value},this.format=function(e=!1,t=!0){const{currency:a,baseCurrency:n,currencySymbol:i,baseCurrencySymbol:o,format:{number:r,price:s}}=wteL10n;let l={[n]:1};if("undefined"!=typeof wteCc&&wteCc?.code&&t)for(let e in wteCc.code)l={...l,[wteCc.code[e]]:wteCc.rate[e]};let c=+this._value*(t?+l[a]:1),d=+r.decimal;return wtehelpers.priceFormat(c,t?a:n,t?i:o,s,d,r.decimalSeparator,r.thousandSeparator,e)}};window.wteL10n.priceFormat=window.wteL10n.priceFormat||function(e){return new h(e)};const w=function(e){this._time=e,this.get=function(){return this._time},this.set=function(e){this._time=e},this._getTimeFormat=function(){return wteL10n.helpers.phpToMomentDF(wteL10n.format.datetime.date)},this.format=function(e=null,t=!1){if(wteL10n.format.datetime.timezone,!this._time)return this._time;if(e)return moment(this._time).format(e);let a=moment(this._time).format(this._getTimeFormat());return a+=t?" at "+moment(this._time).format("h:mm A"):"",a},this.getDatewithOffset=function(e){if(this._time){let t=moment(this._time).utc().format("YYYY-MM-DDTHH:mm:ss")+e;return new Date(t)}}};window.wteL10n.dateFormat=window.wteL10n.dateFormat||function(e){return new w(e)}})(),(()=>{const{default:e}=i(3051);function t(e){for(var t=(e+="").split("."),a=t[0],n=t.length>1?"."+t[1]:"",i=/(\d+)(\d{3})/;i.test(a);)a=a.replace(i,"$1"+WPTE_Price_Separator+"$2");return a+n}jQuery((function(e){const a=()=>{document.querySelector(".tippy-exist")&&tippy(".tippy-exist",{content:e=>e.getAttribute("data-content"),allowHTML:!0})};if(document.addEventListener("tripfetched",(function(e){a()})),a(),!wte.single_showtabs){e(".tab-inner-wrapper .tab-anchor-wrapper:first-child").addClass("nav-tab-active");const t=document.getElementById("tabs-container");t&&new(0,i(4126).A)(t),e(".tab_content").hide(),e(".tab_content:first").show(),e("ul.tabs li").click((function(){e(".tab_content").hide();var t=e(this).attr("rel");e("#"+t).fadeIn(),e("ul.tabs li").removeClass("active"),e(this).addClass("active"),e(".tab_drawer_heading").removeClass("d_active"),e(".tab_drawer_heading[rel^='"+t+"']").addClass("d_active")})),e(".tab_drawer_heading").click((function(){e(".tab_content").hide();var t=e(this).attr("rel");e("#"+t).fadeIn(),e(".tab_drawer_heading").removeClass("d_active"),e(this).addClass("d_active"),e("ul.tabs li").removeClass("active"),e("ul.tabs li[rel^='"+t+"']").addClass("active")})),e("ul.tabs li").last().addClass("tab_last")}e((function(){var t=e(".payment-check");!1===t.is(":checked")&&t.is(":visible")&&(t.filter("[value=paypal]").prop("checked",!0),e(".stripe-button").removeClass("active"),e(".stripe-button-el").hide(),e("#wp-travel-engine-order-form").attr("action",WP_OBJ.link.paypal_link))})),e("body").on("click",".paypal-form",(function(t){var a=e(".stripe_checkout_app").attr("src");e(".stripe_checkout_app").attr("src",""),e(".stripe_checkout_app").attr("src",a),e("#wp-travel-engine-order-form").submit()})),e("body").on("click",".payment-check",(function(t){e(this).is(":checked")&&("stripe"==e(this).attr("value")&&(e("#wp-travel-engine-order-form").attr("action",WP_OBJ.link.form_link),e(".paypal-form").hide(),e(".stripe-form").fadeIn("slow"),e(".stripe-button").addClass("active"),e(".stripe-button-el").show()),"paypal"==e(this).attr("value")&&(e("#wp-travel-engine-order-form").attr("action",WP_OBJ.link.paypal_link),e(".stripe-button").removeClass("active"),e(".stripe-button-el").hide(),e(".paypal-form").fadeIn("slow")))})),e("body").on("click",".check-availability",(function(t){t.preventDefault(),e(".date-time-wrapper").fadeIn("slow")})),e("body").on("click",".check-availability",(function(t){t.preventDefault(),e(".wp-travel-engine-price-datetime").focus()})),e("body").on("click",".wp-travel-engine-cart",(function(t){t.preventDefault(),trip_id=e(this).attr("data-id"),nonce=e(this).attr("data-nonce"),jQuery.ajax({type:"post",dataType:"json",url:WTEAjaxData.ajaxurl,data:{action:"wp_add_trip_cart",trip_id,nonce},success:function(t){"already"===t.type?(e(".wp-cart-message-"+trip_id).css("color","orange"),e(".wp-cart-message-"+trip_id).html(t.message).fadeIn("slow").delay(3e3).fadeOut("slow")):"success"===t.type?(e(".wp-cart-message-"+trip_id).css("color","green"),e(".wp-cart-message-"+trip_id).html(t.message).fadeIn("slow").delay(3e3).fadeOut("slow")):(e(".wp-cart-message-"+trip_id).css("color","red"),e(".wp-cart-message-"+trip_id).html(t.message).fadeIn("slow").delay(3e3).fadeOut("slow")),e(".wte-update-cart-button-wrapper:visible").length<1&&e(".wte-update-cart-button-wrapper").css("display","block")}})})),e("#price-loading").fadeOut(2e3),e(".price-holder").fadeIn(2e3),e("body").on("change",".travelers-number",(function(a){$val=e(this).val(),$new_val=e(this).parent().parent().siblings(".trip-price-holder").children(".cart-price-holder").text().replace(/,/g,""),$total=$val*$new_val,$total=t($total),e(this).parent().parent().siblings(".cart-trip-total-price").children(".cart-trip-total-price-holder").text($total),$sum=0,e(".cart-trip-total-price-holder").each((function(t){$tcost=e(this).text().replace(/,/g,""),$sum=parseInt($sum)+parseInt($tcost)})),$sum=t($sum),e(".total-trip-price").text($sum),$value=0,$val1=parseInt(e("span.travelers-number").text()),e("input.travelers-number").each((function(t){""!==e(this).val()&&($value=parseInt($value)+parseInt(e(this).val()))})),$travelers=parseInt($value)+parseInt($val1),e(".total-trip-travelers").text($travelers)})),e("#wp-travel-engine-cart-form").on("submit",(function(t){t.preventDefault();var a=e("#wp-travel-engine-cart-form").serialize(),n=e("#update_cart_action_nonce").val();jQuery.ajax({type:"post",url:WTEAjaxData.ajaxurl,data:{action:"wte_update_cart",nonce:n,data2:a},success:function(){e(".wte-update-cart-msg").text(WPMSG_OBJ.ajax.success),e(".wte-update-cart-msg").css("color","green").fadeIn("slow").delay(3e3).fadeOut("slow")}})})),e("#wte_payment_options").on("change",(function(t){var a=e("#wte_payment_options :selected").val();t.preventDefault(),""!=a&&e("#price-loader").fadeIn("slow").delay("3000").fadeOut("3000")})),e('form[name="wte_enquiry_contact_form"]').submit((function(t){if(t.preventDefault(),e("#wte_enquiry_contact_form").parsley().isValid()){e("#enquiry_submit_button").prop("disabled",!0),jQuery("#redirect-url").val();var a=new FormData(this);e.ajax({dataType:"json",type:"post",processData:!1,contentType:!1,url:WTEAjaxData.ajaxurl,data:a,success:function(t){jQuery(".success-msg, .failed-msg").html(""),t.success?jQuery(".success-msg").html(t.data.message).fadeIn("slow").delay("3000").fadeOut("3000",(function(){t.data.redirect&&(window.location.href=t.data.redirect)})):(jQuery(".failed-msg").html(t.data.message).delay("1000"),e("#enquiry_submit_button").prop("disabled",!1))}})}})),e("#wp-travel-engine-order-form").submit((function(t){if("Himalayan-Bank"!=e("#wte_payment_options :selected").val()){var a=e(this),n=a.find("input[name=amount]").val();!isNaN(n)&&n.length>0&&(options_val=n,e("<input>").attr({type:"hidden",id:"amount",name:"amount",value:options_val}).appendTo(a))}})),e("#wte_payment_options").on("change",(function(t){var a=e("#wte_payment_options :selected").val();if(t.preventDefault(),""==a||"Test Payment"==a)return e("#wte-checkout-payment-fields").html(""),e("#wp-travel-engine-order-form").attr("action",Url.normalurl),e(".wp-travel-engine-billing-details-wrapper").html(response.data),e(".stripe-button:visible").remove(),e(".stripe-button-el").remove(),e(".wp-travel-engine-submit").show(),void e(".wte-authorize-net-wrap").remove();"PayPal"==a&&jQuery.ajax({type:"post",url:WTEAjaxData.ajaxurl,data:{action:"wte_payment_gateway",val:a,_nonce:WTEAjaxData.nonce},success:function(t){"PayPal"==a&&(e("#wp-travel-engine-order-form").attr("action",Url.paypalurl),e(".wp-travel-engine-billing-details-wrapper").html(t.data),e("#wte-checkout-payment-fields").html(t.data),e(".stripe-button:visible").remove(),e(".stripe-button-el").remove(),e(".wp-travel-engine-submit").show(),e(".wte-authorize-net-wrap").remove()),"Test Payment"==a&&(e("#wp-travel-engine-order-form").attr("action",Url.normalurl),e(".wp-travel-engine-billing-details-wrapper").html(t.data),e(".stripe-button:visible").remove(),e(".stripe-button-el").remove(),e(".wp-travel-engine-submit").show(),e(".wte-authorize-net-wrap").remove())}})})),e("body").on("keyup","#cost_includes",(function(t){e("#include-result").val(e("#cost_includes").val()),e("#include-result").val("<li>"+e("#include-result").val().replace(/\n/g,"</li><li>")+"</li>")})),e("body").on("keyup","#cost_excludes",(function(t){e("#exclude-result").val(e("#cost_excludes").val()),e("#exclude-result").val("<li>"+e("#exclude-result").val().replace(/\n/g,"</li><li>")+"</li>")})),e("body").on("keyup",".itinerary-content",(function(t){e(this).siblings(".itinerary-content-inner").val(e(this).val()),e(this).siblings(".itinerary-content-inner").val("<p>"+e(this).val().replace(/\n/g,"</p><p>")+"</p>")})),e(document).on("click",".expand-all-itinerary",(function(t){t.preventDefault(),e(".itinerary-row").children(".itinerary-content").slideToggle(350),e(this).children("svg").hasClass("fa-toggle-on")?e(this).children("svg").addClass("fa-toggle-off"):e(this).children("svg").addClass("fa-toggle-on"),e(".itinerary-row").children(".itinerary-content").toggleClass("show"),e(".itinerary-row").find(".dashicons.dashicons-arrow-down.custom-toggle-tabs").toggleClass("open")})),e(document).on("click",".less-no",(function(t){$val=e(this).next("input").val(),0!=$val&&($val=parseInt($val)-1,e(this).next("input").val($val))})),e(document).on("click",".more-no",(function(t){if($val=e(this).prev("input").val(),""==$val)return $val=1,void e(this).prev("input").val($val);$val=parseInt($val)+1,e(this).prev("input").val($val)})),document.getElementById("wp-travel-engine-new-checkout-form")&&"function"==typeof jQuery.fn.parsley&&(e("#wp-travel-engine-new-checkout-form").parsley(),e("form.wpte-lrf-form").parsley()),e("#wte-send-enquiry-message").click((function(e){e.preventDefault(),document.getElementById("wte_enquiry_form_scroll_wrapper").scrollIntoView({behavior:"smooth",block:"center"})}));const n=document.getElementById("wte_enquiry_contact_form");n&&"function"==typeof jQuery.fn.parsley&&e(n).parsley(),e(".wte-ordering").on("change","select.orderby",(function(){e(this).closest("form").submit()}));var o=document.querySelectorAll(".wpte-enhanced-select");function r(e,t){null!=e&&null!=t&&e.contentWindow.postMessage(JSON.stringify(t),"*")}function s(e,t){var a,n,i,o,s;if(n=(a=e.find(".slick-current")).attr("class").split(" ")[1],o=a.find("iframe").get(0),i=a.data("video-start"),"vimeo"===n)switch(t){case"play":null!=i&&i>0&&!a.hasClass("started")&&(a.addClass("started"),r(o,{method:"setCurrentTime",value:i})),r(o,{method:"play",value:1});break;case"pause":r(o,{method:"pause",value:1})}else if("youtube"===n)switch(t){case"play":r(o,{event:"command"}),r(o,{event:"command",func:"playVideo"});break;case"pause":r(o,{event:"command",func:"pauseVideo"})}else"video"===n&&null!=(s=a.children("video").get(0))&&("play"===t?s.play():s.pause())}o&&o.forEach((function(t){e(t).select2({closeOnSelect:!1,allowClear:!1})})),document.querySelectorAll(".wte-trip-vidgal-popup-trigger").forEach((function(e){e.addEventListener("click",(function(e){var t;e.preventDefault();const a=JSON.parse(null!==(t=this.getAttribute("data-items"))&&void 0!==t?t:[]);jQuery?.fancybox.open(a,{buttons:["zoom","slideShow","fullScreen","close"]})}))}));var l=e(".main-slider");l.slick&&(l.on("beforeChange",(function(t,a){s(a=e(a.$slider),"pause")})),l.on("afterChange",(function(t,a){s(a=e(a.$slider),"play")})),l.slick({lazyLoad:"progressive",slidesToShow:1,slidesToScroll:1,arrows:!1,dots:!1,fade:!0,asNavFor:".slider-nav",cssEase:"cubic-bezier(0.87, 0.03, 0.41, 0.9)"}),e(".slider-nav").slick({slidesToShow:3,slidesToScroll:1,asNavFor:".main-slider",dots:!1,arrows:!0,focusOnSelect:!0}))})),function(){e();var t=document.querySelectorAll(".wpte-bf-toggle-wrap");function a(e,t){return function a(n){var i=e.querySelector(".wpte-bf-toggle-content");e.className.indexOf("wpte-bf-active")>-1?function(e,t){var a=1;!function n(){if((a-=.05)<=0)return e.style.removeProperty("opacity"),e.style.display="none",void t();e.style.opacity=a,requestAnimationFrame(n)}()}(i,(function(){document.removeEventListener("click",a),e.classList.remove("wpte-bf-active"),t()})):(e.className.indexOf("wpte-bf-active")<0?e.classList.add("wpte-bf-active"):e.classList.remove("wpte-bf-active"),t())}}t&&t.forEach((function(e){var t=e.querySelector(".wpte-bf-toggle-title"),n=(e.querySelector(".wpte-bf-toggle-content"),e.querySelector(".wpte-bf-toggle-close"));n&&n.addEventListener("click",(function(t){t.preventDefault(),a(e)})),t&&t.addEventListener("click",(function(n){document.addEventListener("click",a(e,(function(){var a=t.querySelector(".wtebf-toggle-title"),n=t.querySelector(".wtebf-toggle-title-active");n&&(n.style.display=e.className.indexOf("wpte-bf-active")>-1?"block":"none"),a&&(a.style.display=e.className.indexOf("wpte-bf-active")<0?"block":"none")})))}))}));var n=document.getElementById("wpte_price-toggle-btn-mb");if(n){var i=document.getElementById("wpte_price-toggle-btn-mb-layout-3"),o=n.closest(".wpte-booking-area, .wp-block-wptravelenginetripblocks-booking"),r=o?.querySelector(".wpte-bf-price-wrap"),s=o.querySelector(".wp-block-wptravelenginetripblocks-trip-pricing");function l(){o?.classList.remove("show"),n?.classList.remove("active")}n.onclick=function(){this.classList.toggle("active"),o?.classList.toggle("show"),r?.classList.toggle("show"),r?.style.maxHeight?(r.style.maxHeight=null,s.style.maxHeight=null):(r.style.maxHeight=r.scrollHeight+"px",s.style.maxHeight=s.scrollHeight+"px")};var c=document.getElementById("open-booking-modal");if(o&&(i&&i.addEventListener("click",(function(){l()})),c?.addEventListener("click",(function(){l()}))),o&&o.matches(".wpte-form-layout-2")&&window.matchMedia("(max-width: 1024px)").matches){var d=o.clientHeight;document.body.style.padding=`0 0 ${d}px`}}let u=document.querySelector(".advanced-search-wrapper");if(u){let y=u.querySelector(".sidebar"),g=document.getElementById("wte-filterbar-toggle-btn");g?.addEventListener("click",(()=>{u.classList.add("open"),document.body.classList.add("advance-search-open")})),u?.addEventListener("click",(e=>{y.contains(e.target)||(u.classList.remove("open"),document.body.classList.remove("advance-search-open"))}))}var p=function(e,t=null){var a=e.querySelector(".itinerary-content"),n=e.querySelector(".accordion-tabs-toggle"),i=null===t?!n.classList.contains("active"):t,o=a.scrollHeight+.9;a.classList.toggle("show",i),a.style.maxHeight=i?o+"px":"0px",n.classList.toggle("active",i)},m=document.querySelector(".wte-trip-itinerary-v2");if(m){var h=document.getElementById("itinerary-toggle-button"),w=m.querySelectorAll(".itinerary-row");h&&h.addEventListener("change",(function(){w&&w.forEach((e=>{p(e,this.checked)}))})),w&&w.forEach((function(e){!function(e){var t=e.querySelector(".itinerary-content"),a=t.getBoundingClientRect().height;t.classList.contains("show")?t.style.maxHeight=a+"px":t.style.maxHeight="0px"}(e),e.onclick=function(e){return function(t){t.target.closest(".wte-itinerary-head-wrap")&&p(e)}}(e)}))}let f=document.querySelectorAll(".itinerary-sleep-mode");f&&f.forEach((function(e){e.addEventListener("click",(function(e){let t=e.target.closest(".itinerary-content").querySelector(".content-additional-sleep-mode");t.style.display="flex"==t.style.display?"none":"flex"}))})),window.addEventListener("scroll",(()=>{const e=document.querySelector(".wpte_has-sticky-booking-widget");if(e){const t=e.querySelector(".wpte-booking-area-wrapper");if(t){const e=t.parentNode;let a=e.offsetTop;if(e.children.length>1)for(const t of e.children)a+=t.scrollHeight;window.scrollY>a?t.classList.add("is-sticky"):t.classList.remove("is-sticky")}}}))}()})(),document.getElementById("wp-travel-engine-new-checkout-form")&&new class{constructor(e){this.checkoutForm=e,this.defaultPaymentMethods=["booking_only"],this.initialize()}initialize(){this.paymentMethods=this.checkoutForm.querySelectorAll("[name=wpte_checkout_paymnet_method]"),this.paymentModes=this.checkoutForm.querySelectorAll("[name=wp_travel_engine_payment_mode]"),this.selectedPaymentMethod=this.paymentMethods?.[0]?.value,this.handlePaymentModeChange.bind(this),this.submitButton=this.checkoutForm.querySelector("[type=submit]"),this.addEventListener(this.paymentMethods,"change",this.handlePaymentMethodChange),this.addEventListener(this.paymentModes,"change",this.handlePaymentModeChange),window.addEventListener("load",this.updateButtonLabel.bind(this)),window.addEventListener("load",(()=>{if("createEvent"in document){let e=new Event("change"),t=this.checkoutForm.querySelector("[name=wpte_checkout_paymnet_method]:checked");t&&t.dispatchEvent(e);let a=this.checkoutForm.querySelector("[name=wp_travel_engine_payment_mode]:checked");a&&a.dispatchEvent(e)}})),this.submitButton.disabled=!1}disablePartialPayment(){this.checkoutForm.querySelector(".wpte-bf_downpayment-options")}addEventListener(e,t,a){e.forEach((e=>{e.addEventListener(t,a.bind(this))}))}priceFormat(e){return wteL10n.priceFormat(e)}getButtonLabel(){this.defaultBtnLabel||(this.defaultBtnLabel=this.submitButton?.value||"Book Now",this.customBtnLabel=this.submitButton.dataset.checkoutLabel||"Pay %s");const e=this.getPaymentMethod();return["booking_only","direct_bank_transfer","check_payments"].includes(e)?this.defaultBtnLabel:this.customBtnLabel.replace("%s",this.priceFormat(this.getTotalByMode()).format(!0))}updateButtonLabel(){this.submitButton&&(this.submitButton.value=this.getButtonLabel())}getTotalByMode(e=null){e||(e=this.getPaymentMode());const t={partial:window?.wptravelengineCart?.cart_totals?.cart_total_partial||0,full_payment:window?.wptravelengineCart?.cart_totals?.total||0,remaining_payment:wte.payments.total-wte.payments.total_partial};return t?.[e]||t.full_payment}getPaymentMode(){if("booking_only"==this.getPaymentMethod())return"full_payment";const e=this.checkoutForm.querySelectorAll("[name=wp_travel_engine_payment_mode]");if(e){let t=Array.from(e).find((e=>e.checked));return t||(t=e[0]),t?t.value:"full_payment"}return"full_payment"}getPaymentMethod(){return this.checkoutForm.querySelector("[name=wpte_checkout_paymnet_method]:checked")?.value||"booking_only"}handlePaymentMethodChange(e){e.target.checked&&(this.selectedPaymentMethod=e.target.value);const t=this.checkoutForm.querySelectorAll(".wpte-checkout-payment-info");t&&t.forEach((function(e){e.classList.add("hidden"),e.parentElement.classList.remove("wpte-active-payment-method")})),e.target.parentElement.classList.add("wpte-active-payment-method");var a=document.getElementById(e.target.dataset.targetInfo);a&&!a.classList.remove("hidden",!1)&&a.style.removeProperty("display");const n=this.defaultPaymentMethods.includes(this.selectedPaymentMethod);this.togglePaymentOptions(n),n&&document.getElementById("wp_travel_engine_payment_mode-full")&&(document.getElementById("wp_travel_engine_payment_mode-full").checked=!0),this.handlePaymentModeChange();const i=document.getElementById("wp_travel_engine_payment_mode-full")?.checked;this.toggleInfoTable(n||i),this.updateButtonLabel()}toggleInfoTable(e){const t=document.querySelector(".wpte-bf-extra-info-table"),a=this.getPaymentMode();if(t){t.classList.toggle("hidden",e);const n=t.classList.contains("hidden");t&&n&&"partial"==a&&t.classList.remove("hidden"),"full_payment"==a&&t.classList.add("hidden")}}togglePaymentOptions(e){let t=this.checkoutForm.querySelector(".wpte-bf_downpayment-options");t&&t.classList.toggle("hidden",e)}async handlePaymentModeChange(){const e=await fetch(`${wteL10n.wpxhr.root}?action=wptravelengine_cart&_nonce=${wteL10n.wpxhr.nonce}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cart_action:"update_payment_type",data:{payment_type:this.getPaymentMode(),payment_gateway:this.getPaymentMethod()}})}),t=await e.json();var a;t.success&&null!==(a=t.data.fragments)&&void 0!==a&&a&&Object.entries(t.data.fragments).forEach((([e,t])=>{const a=document.querySelector(e);a&&(a.innerHTML=t)})),this.updateButtonLabel()}}(document.getElementById("wp-travel-engine-new-checkout-form")),function(){(async()=>{if(document.getElementById("wte-checkout-coupon")){const{default:e}=await i.e(702).then(i.bind(i,702));console.log(e),new e(document.getElementById("wte-checkout-coupon")||null)}})();const e=document.querySelectorAll(".wpte-pay-btn");e&&Array.from(e).forEach((e=>{e.addEventListener("click",(async function(e){var t;e.preventDefault();const a=e.target.dataset.xhrUrl,n=null!==(t=e.target.dataset.nonce)&&void 0!==t?t:"";if(a){const t=await fetch(`${a}?action=wte_add_trip_to_cart&cart_version=2.0&_nonce=${n}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({booking_id:e.target.dataset.bookingId})}),i=await t.json();i.success&&i.data.redirect?window.location.href=i.data.redirect:window.location.reload()}}))}))}(),Array.from(document.querySelectorAll("div.wte-filterby-dropdown")).filter((e=>e.querySelector(".wte-ordering"))).forEach((e=>{e.addEventListener("click",(({target:e})=>{const t=e.parentElement.querySelector(".wpte__select-field")||e.closest(".wpte__select-field");t&&(t.classList.toggle("options-open"),t.querySelector(".wpte__select-options").addEventListener("click",(({target:e})=>{const t=e.closest("li[data-value]");if(!t)return;const a=new URL(window.location.href);a.searchParams.set("wte_orderby",t.dataset.value),window.location.href=a.toString()})))}))}))})()