HOME


Mini Shell 1.0
DIR: /home/dhnidqcz/pragmaticsng.org/wp-content/plugins/event-tickets/build/Seating/frontend/
Upload File :
Current File : /home/dhnidqcz/pragmaticsng.org/wp-content/plugins/event-tickets/build/Seating/frontend/session.js
(()=>{"use strict";var t,e={"7F0X":(t,e,n)=>{n.r(e),n.d(e,{beaconInterrupt:()=>N,checkoutControlsSelectors:()=>C,findTimerData:()=>U,getCountdownTimeoutId:()=>V,getHealthcheckTimeoutId:()=>Q,getResumeTimeoutId:()=>Z,getWatchedCheckoutControls:()=>K,interrupt:()=>A,isExpired:()=>I,isInterruptable:()=>O,isStarted:()=>E,pause:()=>G,pauseToCheckout:()=>B,reset:()=>q,resume:()=>J,setHealthcheckLoopId:()=>z,setIsInterruptable:()=>L,setTargetDom:()=>W,start:()=>H,syncOnLoad:()=>X,syncWithBackend:()=>M,watchCheckoutControls:()=>Y});const r=tec.tickets.seating.frontend.sessionData,o=window.wp.hooks;var i=n("Lc+o");const a=window.wp.i18n,{ajaxUrl:c,ajaxNonce:s,checkoutGraceTime:l,ACTION_START:u,ACTION_SYNC:d,ACTION_INTERRUPT_GET_DATA:m,ACTION_PAUSE_TO_CHECKOUT:f}=r,p=".tec-tickets-seating__timer",h="tec-tickets-seating__timer--hidden";let k=null,b=null,g=null,w=!1,_=!0,v=!1,y=null,T=document,S=[];const C=[".tribe-tickets__commerce-checkout-form-submit-button",".tribe-tickets__commerce-checkout-paypal-buttons button"];function L(t){_=t}function O(){return _}function I(){return v}function x(t){w=t}function E(){return w}function P(){return T.querySelectorAll(p)}function U(){const t=P();if(0===t.length)return null;let e=null,n=null,r=null;return Array.from(t).find((t=>!!(t.dataset.token&&t.dataset.postId&&t.dataset.redirectUrl)&&(e=t.dataset.token,n=t.dataset.postId,r=t.dataset.redirectUrl,!0))),e&&n&&r?{token:e,postId:n,redirectUrl:r}:null}function j(t,e,n){t.classList.remove(h);const r=t.querySelector(".tec-tickets-seating__time-minutes"),o=t.querySelector(".tec-tickets-seating__time-seconds");r&&o&&(r.innerText=e,o.innerText=String(n).padStart(2,"0"))}async function A(){if(!O())return!0;L(!0),P().forEach((t=>{j(t,0,0)})),v=!0,clearTimeout(k),k=null,clearTimeout(b),b=null;const t=await async function(){const t=P()?.[0];if(!t)return console.warn("No timer element found"),null;const e="dialog-content-tec-tickets-seating-timer-interrupt",{title:n,content:r,buttonLabel:o,redirectUrl:l}=await async function(){const{postId:t,token:e}=U(),n=new URL(c);n.searchParams.set("_ajaxNonce",s),n.searchParams.set("action",m),n.searchParams.set("postId",t),n.searchParams.set("token",e);const r=await fetch(n.toString(),{method:"GET"}),o={title:(0,a._x)("Time limit expired","Seat selection expired timer title","event-tickets"),content:(0,a._x)("Your seat selections are no longer reserved, but tickets are still available.","Seat selection expired timer content","event-tickets"),buttonLabel:(0,a._x)("Find Seats","Seat selection expired timer button label","event-tickets"),redirectUrl:window.location.href};if(!r.ok)return console.error("Failed to fetch interrupt modal data"),o;const i=await r.json();return i.success&&i.data?{title:i.data.title||o.title,content:i.data.content||o.content,buttonLabel:i.data.buttonLabel||o.buttonLabel,redirectUrl:i.data.redirectUrl||o.redirectUrl}:(console.error("Failed to fetch interrupt modal data"),o)}();t.dataset.content=e;let u=".tec-tickets-seating__timer";var d;return t.closest(".tribe-dialog")&&(u=".tribe-tickets__tickets-form, .tec-tickets-seating__tickets-block"),y||(d={dataJs:e,title:n,content:r,buttonLabel:o,redirectUrl:l},y=(0,i.createHtmlComponentFromTemplateString)('<script\n\t\tid="tec-tickets-seating-interrupt-dialog-template"\n\t\ttype="text/template"\n\t\tdata-js="{dataJs}"\n\t>\n\t\t<div class="tribe-tickets-seating__interrupt-dialog" role="dialog">\n\t\t\t<div class="tribe-tickets-seating__interrupt-header">\n\t\t\t\t<div class="dashicons dashicons-clock"></div>\n\t\t\t\t<div class="tribe-tickets-seating__interrupt-title">{title}</div>\n\t\t\t</div>\n\t\t\t<div class="tribe-dialog__content tribe-modal__content tribe-tickets-seating__interrupt-content">{content}</div>\n\t\t\t<div class="tribe-tickets-seating__interrupt-footer">\n\t\t\t\t<button\n\t\t\t\t\ttype="button"\n\t\t\t\t\tonclick="window.location.href=\'{redirectUrl}\'"\n\t\t\t\t\tclass="tribe-common-c-btn tribe-common-c-btn--small"\n\t\t\t\t>\n\t\t\t\t\t{buttonLabel}\n\t\t\t\t</button>\n\t\t</div>\n\t<\/script>',d),T.querySelector(u)?.appendChild(y)),new window.tec.common.tecA11yDialog({trigger:".tec-tickets-seating__timer",appendTarget:u,wrapperClasses:"tribe-dialog",overlayClasses:"tribe-dialog__overlay tribe-modal__overlay",contentClasses:"tribe-dialog__wrapper tribe-tickets-seating__interrupt-wrapper",overlayClickCloses:!1})}();(0,o.doAction)("tec.tickets.seating.timer_interrupt"),t&&(t.show(),t.shown=!1),L(!1)}function N(){if(!O())return;const{postId:t,token:e}=U(),n=new URL(c);n.searchParams.set("_ajaxNonce",s),n.searchParams.set("action",m),n.searchParams.set("postId",t),n.searchParams.set("token",e),window.navigator.sendBeacon(n.toString())}function R(t){t<=0?A():(x(!0),k=setTimeout((()=>{t-=1,P().forEach((e=>{j(e,Math.floor(t/60),t%60)})),I()||R(t)}),1e3))}function F(){I()||(b=setTimeout((async()=>{await M(),F()}),3e3))}async function M(){if(I()||0===P().length)return;const t=await D(d);t<=0?A():(k&&(clearTimeout(k),k=null),R(t),b||F())}async function D(t){const e=U();if(null===e)return!1;if(-1===[u,d,f].indexOf(t))return!1;const n=new URL(c);n.searchParams.set("_ajaxNonce",s),n.searchParams.set("action",t),n.searchParams.set("token",e.token),n.searchParams.set("postId",e.postId);const r=await fetch(n.toString(),{method:"POST"});if(!r.ok)return!1;const o=await r.json();if(!(o.success&&o.data.secondsLeft&&o.data.timestamp))return console.error("Failed to communicate with the backend"),!1;const i=o.data;return i.secondsLeft-Math.max(0,Math.floor(i.timestamp-Date.now()/1e3))}async function H(){if(x()||0===P().length)return;const t=await D(u),{postId:e,token:n}=U();if(!(t&&e&&n))return void A();const r=Math.floor(t/60),o=t%60;P().forEach((t=>{j(t,r,o)})),x(!0),R(t),F()}function q(){k&&clearTimeout(k),b&&clearTimeout(b),g&&clearTimeout(g),w=!1,v=!1,b=null,k=null,g=null,_=!0,S.forEach((t=>{t.removeEventListener("click",B),t.removeEventListener("submit",B)})),S=[]}function G(t){t=t||0,L(!1),b&&(clearTimeout(b),b=null),k&&(clearTimeout(k),k=null),t&&(g=setTimeout(J,1e3*t))}async function B(){await D(f)<=0?A():G(l)}async function J(){g&&(clearTimeout(g),g=null),L(!0),await M()}function W(t){T=t||document}async function X(){0!==Array.from(P()).filter((t=>"syncOnLoad"in t.dataset)).length&&(L(!0),window.addEventListener("beforeunload",N),await M())}function Y(){const t=(0,o.applyFilters)("tec.tickets.seating.frontend.session.checkoutControls",C);T.querySelectorAll(t.join(", ")).forEach((t=>{S.push(t),t.addEventListener("click",B),t.addEventListener("submit",B)}))}function K(){return S}function z(t){return b=t,b}function Q(){return b}function V(){return k}function Z(){return g}(0,i.onReady)((()=>X())),(0,i.onReady)((()=>Y()))},"Lc+o":(t,e,n)=>{function r(t,e){const n=t.replace(/{(\w*)}/g,(function(t,n){return e?.[n]||""})),r=document.createElement("template");return r.innerHTML=n.trim(),r.content.children[0]}n.d(e,{createHtmlComponentFromTemplateString:()=>r,onReady:()=>o});const o=t=>{"loading"!==document.readyState?t():document.addEventListener("DOMContentLoaded",t)}}},n={};function r(t){var o=n[t];if(void 0!==o)return o.exports;var i=n[t]={exports:{}};return e[t](i,i.exports,r),i.exports}r.m=e,t=[],r.O=(e,n,o,i)=>{if(!n){var a=1/0;for(u=0;u<t.length;u++){for(var[n,o,i]=t[u],c=!0,s=0;s<n.length;s++)(!1&i||a>=i)&&Object.keys(r.O).every((t=>r.O[t](n[s])))?n.splice(s--,1):(c=!1,i<a&&(a=i));if(c){t.splice(u--,1);var l=o();void 0!==l&&(e=l)}}return e}i=i||0;for(var u=t.length;u>0&&t[u-1][2]>i;u--)t[u]=t[u-1];t[u]=[n,o,i]},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t={1490:0,6998:0,7274:0};r.O.j=e=>0===t[e];var e=(e,n)=>{var o,i,[a,c,s]=n,l=0;if(a.some((e=>0!==t[e]))){for(o in c)r.o(c,o)&&(r.m[o]=c[o]);if(s)var u=s(r)}for(e&&e(n);l<a.length;l++)i=a[l],r.o(t,i)&&t[i]&&t[i][0](),t[i]=0;return r.O(u)},n=globalThis.webpackChunkevent_tickets=globalThis.webpackChunkevent_tickets||[];n.forEach(e.bind(null,0)),n.push=e.bind(null,n.push.bind(n))})();var o=r.O(void 0,[7274],(()=>r("7F0X")));o=r.O(o),window.tec=window.tec||{},window.tec.tickets=window.tec.tickets||{},window.tec.tickets.seating=window.tec.tickets.seating||{},window.tec.tickets.seating.frontend=window.tec.tickets.seating.frontend||{},window.tec.tickets.seating.frontend.session=o})();