(()=>{"use strict";var s={n:e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return s.d(n,{a:n}),n},d:(e,n)=>{for(var t in n)s.o(n,t)&&!s.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:n[t]})},o:(s,e)=>Object.prototype.hasOwnProperty.call(s,e),r:s=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})}},e={};s.r(e),s.d(e,{setClicks:()=>P,setPage:()=>I,setSessionExpired:()=>M,setSessionStartTime:()=>U,setTimer:()=>D});var n={};s.r(n),s.d(n,{getClicks:()=>B,getPage:()=>O,getSessionStartTime:()=>R,getTimeoutId:()=>A});const t=window.wp.domReady;var i=s.n(t);const o=window.wp.data,a=window.lodash;var r=s.n(a);let m,d,u,c,f,_,l,S,b,p,T;"undefined"!=typeof nf_submissions&&(m=void 0!==nf_submissions.forms?nf_submissions.forms:{},S=void 0!==nf_submissions.dateFormat?nf_submissions.dateFormat:"",l=void 0!==nf_submissions.timeFormat?nf_submissions.timeFormat:"",d=void 0!==nf_submissions.siteUrl?nf_submissions.siteUrl:"",u=void 0!==nf_submissions.pluginsUrl?nf_submissions.pluginsUrl:"",c=void 0!==nf_submissions.adminUrl?nf_submissions.adminUrl:"",f=void 0!==nf_submissions.restUrl?nf_submissions.restUrl:"",_=void 0!==nf_submissions.token?nf_submissions.token:"",b=void 0!==nf_submissions.submissionsSettings?nf_submissions.submissionsSettings:{},p=void 0!==nf_submissions.nf_user_management_data_access?nf_submissions.nf_user_management_data_access:{},T=void 0!==nf_submissions.nf_user_management_current_user?nf_submissions.nf_user_management_current_user:{});let g=[];r().forEach(m,s=>{s&&Object.keys(s).length>0&&g.push(s)});const E=window.wp.i18n;let v,w;(0,E.__)("Trigger Email Action Title","ninja-forms"),(0,E.__)("Bulk Export Title","ninja-forms"),(0,E.__)("Bulk Actions","ninja-forms"),(0,E.__)("Move to Trash","ninja-forms"),(0,E.__)("Trigger Email Action","ninja-forms"),(0,E.__)("Export","ninja-forms"),"undefined"!=typeof nfBeData&&(v=void 0!==nfBeData.restUrl?nfBeData.restUrl:"",w=void 0!==nfBeData.token?nfBeData.token:"");const y={restUrl:v,token:w},h=async s=>{const e=new FormData;e.append("data",JSON.stringify(s)),e.append("_wpnonce",y.token),navigator.sendBeacon(y.restUrl+"nf-be-data/store",e)},j=(s,e,n,t,i)=>[s,e,n,t,i],k={page:"",clicks:[],sessionStartTime:0,timeoutId:null},I=s=>({type:"SET_PAGE",page:s}),P=s=>({type:"SET_CLICKS",element:s}),U=()=>({type:"SET_SESSION_START_TIME"}),D=()=>({type:"SET_TIMER"}),M=s=>({type:"SET_SESSION_EXPIRED",endSessionMotive:s});function O(s){const{page:e}=s;return e}function B(s){const{clicks:e}=s;return e}function R(s){const{sessionStartTime:e}=s;return e}function A(s){const{timeoutId:e}=s;return e}const C=(0,o.createReduxStore)("ninja-forms/be-data",{reducer:function(s=k,e){switch(e.type){case"SET_PAGE":const n=new URLSearchParams(window.location.search),t=window.location.hash;return{...s,page:n.get("page")+t};case"SET_CLICKS":let i=s.clicks;const o=[e.element,+new Date];return i.push(o),{...s,clicks:i};case"SET_SESSION_START_TIME":return{...s,sessionStartTime:+new Date};case"SET_TIMER":s.timeoutId&&clearTimeout(s.timeoutId);const a=setTimeout(()=>{const e=+new Date,n=j(s.page,s.clicks,s.sessionStartTime,e,"Browser session timeout");h(n)},9e5);return{...s,timeoutId:a};case"SET_SESSION_EXPIRED":const r=+new Date,m=j(s.page,s.clicks,s.sessionStartTime,r,e.endSessionMotive);return h(m),{...s,sessionStartTime:0,sessionPartialTime:0,timeoutId:null};default:return s}},actions:e,selectors:n});(0,o.register)(C);const L=["#ninja-forms-dashboard .sections a","#toplevel_page_ninja-forms a","#nf-app-header .nf-app-menu a","#ninja-forms-dashboard button.add.nf-button.primary","#ninja-forms-dashboard button.cancel.nf-button.secondary"];i()(()=>{setTimeout(()=>{(0,o.dispatch)("ninja-forms/be-data").setSessionStartTime(),(0,o.dispatch)("ninja-forms/be-data").setPage(),L.forEach(s=>{const e=document.querySelectorAll(s);e&&e.forEach(s=>{s.addEventListener("click",e=>{(0,o.dispatch)("ninja-forms/be-data").setClicks(s.outerHTML)})})}),document.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState&&(0,o.dispatch)("ninja-forms/be-data").setSessionExpired("Nav away or closed Tab/Browser")})},500)})})();