1import{o as r,d as u,a as e,b as x,w as W,u as I,l as Le,D as Ge,F as J,p as ne,r as a,q as me,G as He,c as Ee,t as v,g as oe,x as Je,z as b,A as Te,C as ce,e as H,h as Ye,i as fe,n as We,j as ge,f as te,m as he,J as Ze,H as Qe,k as G}from"./app-TTdzKPnM.js";import{G as Xe,Y as et}from"./transition-DltcNvxI.js";import{_ as pe}from"./Modal-BA21F3ob.js";import{_ as ve}from"./SaturnButton-DBZVI7YW.js";import{g as tt,_ as st,a as nt,b as ot,c as lt,d as at,e as it,f as rt,u as ut}from"./RequiredTimeNotesModal-DZN3rUr3.js";import{g as dt}from"./settings-BbY5TtVV.js";import{g as Oe,a as ct}from"./time-Dbkcteiz.js";import"./keyboard-CzNjPGSE.js";import"./helpers-BPt12C6K.js";import"./menu-A14RFTf7.js";import"./calculate-active-index-Bycd8yjO.js";import"./use-text-value-C-16F2Us.js";import"./use-tree-walker-DJZM5ldf.js";import"./combobox-B_67Ev-D.js";import"./form-lyMEILLx.js";import"./localizationHelpers-CCOM6LKU.js";try{let f=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},g=new f.Error().stack;g&&(f._sentryDebugIds=f._sentryDebugIds||{},f._sentryDebugIds[g]="9293da9f-9298-42f9-a31f-1be12e3b52b1",f._sentryDebugIdIdentifier="sentry-dbid-9293da9f-9298-42f9-a31f-1be12e3b52b1")}catch{}function Ie(f,g){return r(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"})])}const vt={__name:"KioskLayout",props:{title:String},setup(f){return(g,p)=>(r(),u(J,null,[x(I(Le),{title:f.title},{default:W(()=>p[0]||(p[0]=[e("meta",{name:"robots",content:"noindex"},null,-1)])),_:1},8,["title"]),Ge(g.$slots,"default")],64))}},ft={class:"fixed inset-0 z-10 w-screen overflow-y-auto"},gt={class:"flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0"},pt={class:"flex items-center justify-between"},mt={class:"font-bold text-2xl"},ht={class:"gap-9 flex justify-center mt-6 mx-auto text-saturn-gray w-72"},yt=["data-pin-circle"],kt={class:"font-medium font-number gap-4 grid grid-cols-3 mt-6 mx-auto text-4xl text-center w-72"},bt={__name:"KioskPinModal",props:{open:Boolean,user:Object},emits:["kioskPinModalClose","kioskPinModalLoginSuccess"],setup(f,{emit:g}){const p=ne(),l=g,B=f,w=a("");me(()=>{document.addEventListener("keydown",R)});function R(m){B.open!=!1&&(m.key>=0&&m.key<=9&&c(parseInt(m.key)),m.key=="Backspace"&&c())}He(()=>{document.removeEventListener("keydown",R)});function k(){w.value="",l("kioskPinModalClose")}async function c(m){var n;m==null?w.value=w.value.slice(0,-1):w.value+=m,y();for(let i=0;i<w.value.length;
1i++)document.querySelector(`[data-pin-circle="${i+1}"]`).classList.add("text-void");if(w.value.length==4){const i=await axios.get("/api/settings",{params:{group:"user",user_id:B.user.id,name:"kiosk_pin",team_id:p.props.auth.user.current_team.id}});w.value==((n=i.data.data[0])==null?void 0:n.value)?(l("kioskPinModalLoginSuccess",B.user),y(),w.value=""):(document.getElementById("kiosk-pin-modal").classList.add("animate-shake"),document.getElementById("kiosk-pin-modal").classList.remove("animate-rise"),setTimeout(()=>{document.getElementById("kiosk-pin-modal").classList.remove("animate-shake")},1e3),w.value="",y())}}function y(){document.querySelectorAll("[data-pin-circle]").forEach(m=>m.classList.remove("text-void"))}return(m,n)=>(r(),Ee(I(et),{class:"relative z-10",open:f.open,onClose:k},{default:W(()=>[e("div",ft,[e("div",gt,[x(I(Xe),{id:"kiosk-pin-modal",class:"animate-rise relative transform overflow-hidden rounded-4xl bg-white p-8 text-left shadow-xl transition-all w-125"},{default:W(()=>[e("div",pt,[e("div",mt,v(f.user.first_name)+"'s PIN",1),e("div",null,[e("button",{type:"button",class:"bg-white focus:outline-none",onClick:k},n[11]||(n[11]=[e("span",{class:"sr-only"},"Close",-1),e("span",{class:"material-symbols-outlined text-5xl",style:{"font-variation-settings":"'FILL' 1, 'wght' 700, 'GRAD' 0, 'opsz' 48"}},"close",-1)]))])]),e("div",ht,[(r(),u(J,null,oe(4,i=>e("span",{"data-pin-circle":i,class:"material-symbols-outlined text-3xl",style:{"font-variation-settings":"'FILL' 1, 'wght' 700, 'GRAD' 0, 'opsz' 48"}},"circle",8,yt)),64))]),e("div",kt,[e("button",{onClick:n[0]||(n[0]=i=>c(1)),class:"focus:bg-light-lunar hover:bg-light-lunar h-20 leading-20 rounded-lg w-20"},"1"),e("button",{onClick:n[1]||(n[1]=i=>c(2)),class:"focus:bg-light-sky hover:bg-light-sky h-20 leading-20 rounded-lg w-20"},"2"),e("button",{onClick:n[2]||(n[2]=i=>c(3)),class:"focus:bg-light-sun hover:bg-light-sun h-20 leading-20 rounded-lg w-20"},"3"),e("button",{onClick:n[3]||(n[3]=i=>c(4)),class:"focus:bg-light-thruster hover:bg-light-thruster h-20 leading-20 rounded-lg w-20"},"4"),e("button",{onClick:n[4]||(n[4]=i=>c(5)),class:"focus:bg-light-ignition hover:bg-light-ignition h-20 leading-20 rounded-lg w-20"},"5"),e("button",{onClick:n[5]||(n[5]=i=>c(6)),class:"focus:bg-light-lunar hover:bg-light-lunar h-20 leading-20 rounded-lg w-20"},"6"),e("button",{onClick:n[6]||(n[6]=i=>c(7)),class:"focus:bg-light-sky hover:bg-light-sky h-20 leading-20 rounded-lg w-20"},"7"),e("button",{onClick:n[7]||(n[7]=i=>c(8)),class:"focus:bg-light-sun hover:bg-light-sun h-20 leading-20 rounded-lg w-20"},"8"),e("button",{onClick:n[8]||(n[8]=i=>c(9)),class:"focus:bg-light-thruster hover:bg-light-thruster h-20 leading-20 rounded-lg w-20"},"9"),n[13]||(n[13]=e("div",{class:"h-20 w-20"},null,-1)),e("button",{onClick:n[9]||(n[9]=i=>c(0)),class:"focus:bg-light-ignition hover:bg-light-ignition h-20 leading-20 rounded-lg w-20"},"0"),e("button",{onClick:n[10]||(n[10]=i=>c()),class:"h-20 w-20"},n[12]||(n[12]=[e("span",{class:"leading-20 material-symbols-outlined text-5xl",style:{"font-variation-settings":"'FILL' 0, 'wght' 700, 'GRAD' 0, 'opsz' 48"}},"backspace",-1)]))])]),_:1})])])]),_:1},8,["open"]))}},wt={class:"flex items-center"},xt={key:0},_t={key:0},$t=["placeholder"],Ct={key:0,class:"font-semibold mt-2 text-ignition"},Dt={class:"mt-4 mb-2 text-lg text-gray-600 dark:text-gray-400"},St={key:1},Ot={key:0},It={class:"text-xl"},Lt={class:"mt-2 flex items-center gap-1.5 text-sm text-gray-600 dark:text-gray-400"},Et=["title"],Tt={key:0,class:"font-semibold mt-2 text-ignition"},Wt={class:"mt-6"},Bt={key:1},Mt={key:0,class:"mb-4 rounded-lg bg-green-50 dark:bg-green-900/20 px-3 py-2 text-base font-medium text-green-800 dark:text-green-200"},Pt={key:1,class:"mb-4 text-base text-gray-700 dark:text-gray-300"},Ut={class:"flex justify-center gap-3 mb-4"},Ft=["onUpdate:modelValue","onInput","onKeydown"],qt={key:2,class:"font-semibold mt-2 text-ignition text-center"},Kt={class:"mt-2 flex items-center gap-1.5 text-sm text-gray-600 dark:text-gray-400"},Rt=["title"],jt={class:"mt-6"},zt={key:2,class:"mt-8"},At={key:1,class:"flex flex-col"},Nt={__name:"KioskSettingsModal",props:{show:Boolean,otpExitChannel:{type:String,default:null,validator:f=>f===null||f==="email"||f==="phone"}},emits:["close"],setup(f,{emit:g}){const p=f,l=Je({password:"",code:""}),B=b(()=>p.otpExitChannel==="email"?"We'll send a verification code to your email.":p.otpExitChannel==="phone"?"We'll send a verification code to your phone.":"We'll send a verification code to your email or phone."),w=b(()=>p.otpExitChannel==="email"?"We sent a 4-digit code to your email.":p.otpExitChannel==="phone"?"We sent a 4-digit code to your phone.":"We sent a 4-digit code to your email or phone."),R=b(()=>p.otpExitChannel==="email"?"Code delivery hint email only":p.otpExitChannel==="phone"?"Code delivery hint SMS only":"Code delivery hint with SMS"),k=a(!1),c=a(!1),y=a(""),m=a(""),n=a(!1),i=a(["","","",""]),T=a([]);function _(o){const d=T.value[o];d&&d.focus()}function D(){i.value=["","","",""],l.code=""}function j(o,d){const $=d.target.value;if($.length>1){const C=$.slice(0,4).replace(/\D/g,"").split("");
1C.forEach((S,E)=>{E<4&&(i.value[E]=S)});for(let S=C.length;S<4;S++)i.value[S]="";_(Math.min(C.length,3))}else i.value[o]=$.replace(/\D/g,"").slice(0,1),$&&o<3&&_(o+1);A()}function Y(o){const d=o.target.value;if(d&&d.replace(/\D/g,"").length>=4){const $=d.replace(/\D/g,"").slice(0,4).split("");$.forEach((C,S)=>{i.value[S]=C});for(let C=$.length;C<4;C++)i.value[C]="";A(),o.target.value=""}}function z(o,d){d.key==="Backspace"&&!i.value[o]&&o>0&&_(o-1)}function A(){l.code=i.value.join(""),l.code.length===4&&!l.processing&&L()}function P(){Q("close"),M.value=!1,l.reset(),k.value=!1,c.value=!1,y.value="",m.value="",D()}function Z(){M.value=!1,l.reset(),k.value=!1,c.value=!1,y.value="",m.value="",D()}async function N(){var o,d,$,C,S,E,U,O;y.value="",m.value="",n.value=!0;try{const{data:F}=await he.post(route("kiosk-disable.send-otp"));m.value=(F==null?void 0:F.message)??__("Verification code sent! Please check your email or phone."),D(),c.value=!0,k.value=!0,await ce(),_(0)}catch(F){const le=((d=(o=F.response)==null?void 0:o.data)==null?void 0:d.message)??((E=(S=(C=($=F.response)==null?void 0:$.data)==null?void 0:C.errors)==null?void 0:S.identifier)==null?void 0:E[0])??(typeof((O=(U=F.response)==null?void 0:U.data)==null?void 0:O.message)=="string"?F.response.data.message:null)??__("Failed to send verification code. Please try again.");y.value=le}finally{n.value=!1}}function L(){l.post(route("kiosk-disable"),{onSuccess:()=>Ze.visit("/time"),onError:()=>{D(),ce(()=>_(0))}})}const Q=g,M=a(!1);return Te(M,async o=>{if(o){await ce();const d=document.getElementById("password");d&&d.focus()}}),(o,d)=>(r(),Ee(pe,{show:f.show,onClose:P,width:"50",size:"lg"},{title:W(()=>[e("div",wt,[M.value?(r(),u("span",{key:0,class:"cursor-pointer material-symbols-outlined mr-6 text-5xl",onClick:Z},"arrow_back")):H("",!0),e("h4",null,v(M.value?o.$t("Disable Kiosk"):"Settings"),1)])]),content:W(()=>{var $,C,S;return[M.value?(r(),u("div",xt,[e("form",{onSubmit:Ye(L,["prevent"])},[k.value?(r(),u("div",St,[c.value?(r(),u("div",Bt,[m.value?(r(),u("p",Mt,v(m.value),1)):(r(),u("p",Pt,v(o.$t(w.value)),1)),e("input",{type:"text",inputmode:"numeric",autocomplete:"one-time-code","aria-hidden":"true",tabindex:"-1",class:"absolute opacity-0 w-0 h-0 pointer-events-none",onInput:Y},null,32),e("div",Ut,[(r(!0),u(J,null,oe(i.value,(E,U)=>fe((r(),u("input",{key:U,ref_for:!0,ref:O=>{O&&(T.value[U]=O)},"onUpdate:modelValue":O=>i.value[U]=O,type:"text",inputmode:"numeric",maxlength:"4",class:"w-14 h-14 text-center text-2xl font-semibold text-gray-900 border border-gray-300 dark:border-gray-600 focus:border-lunar focus:ring-lunar rounded-lg shadow-sm bg-white dark:bg-gray-800 dark:text-gray-100",onInput:O=>j(U,O),onKeydown:O=>z(U,O)},null,40,Ft)),[[ge,i.value[U]]])),128))]),(S=I(l).errors)!=null&&S.code?(r(),u("div",qt,v(I(l).errors.code),1)):H("",!0),e("p",Kt,[e("span",{class:"inline-flex shrink-0 cursor-help",title:o.$t("Code delivery hint with SMS")},[x(I(Ie),{class:"h-4 w-4 text-gray-500","aria-hidden":"true"})],8,Rt),e("span",null,v(o.$t("Code delivery hint with SMS")),1)]),e("div",jt,[x(ve,{fullWidth:!0,size:"lg",disabled:I(l).code.length!==4,onSaturnButtonClicked:L},{default:W(()=>[te(v(o.$t("Disable Kiosk")),1)]),_:1},8,["disabled"])]),e("button",{type:"button",class:"mt-4 text-lunar text-xl underline focus:outline-0 focus:ring-0",onClick:d[3]||(d[3]=E=>{k.value=!1,c.value=!1,y.value="",m.value="",D()})},v(o.$t("Use password instead")),1)])):(r(),u("div",Ot,[e("p",It,v(o.$t(B.value)),1),e("p",Lt,[e("span",{class:"inline-flex shrink-0 cursor-help",title:o.$t(R.value)},[x(I(Ie),{class:"h-4 w-4 text-gray-500","aria-hidden":"true"})],8,Et),e("span",null,v(o.$t(R.value)),1)]),y.value?(r(),u("div",Tt,v(y.value),1)):H("",!0),e("div",Wt,[x(ve,{fullWidth:!0,size:"lg",disabled:n.value,onSaturnButtonClicked:N},{default:W(()=>[te(v(n.value?o.$t("Sendingâ¦"):o.$t("Send verification code")),1)]),_:1},8,["disabled"])]),e("button",{type:"button",class:"mt-4 text-lunar text-xl underline focus:outline-0 focus:ring-0",onClick:d[2]||(d[2]=E=>{k.value=!1,y.value=""})},v(o.$t("Use password instead")),1)]))])):(r(),u("div",_t,[fe(e("input",{type:"password",id:"password",name:"password",placeholder:o.$t("Admin password"),"onUpdate:modelValue":d[
10]||(d[0]=E=>I(l).password=E),class:We([($=I(l).errors)!=null&&$.password?"ring-ignition":"ring-saturn-gray","border-0 font-bold ring-1 focus:outline-0 focus:ring-lunar p-4 rounded-lg placeholder:text-[#B1B0BA] text-2xl w-full"])},null,10,$t),[[ge,I(l).password]]),(C=I(l).errors)!=null&&C.password?(r(),u("div",Ct,v(I(l).errors.password),1)):H("",!0),e("p",Dt,v(o.$t("Or")),1),e("button",{type:"button",class:"text-lunar font-semibold text-xl underline hover:no-underline focus:outline-0 focus:ring-0",onClick:d[1]||(d[1]=E=>{k.value=!0,y.value=""})},v(o.$t("Use verification code instead")),1)])),k.value?H("",!0):(r(),u("div",zt,[x(ve,{fullWidth:!0,size:"lg",onSaturnButtonClicked:L},{default:W(()=>[te(v(o.$t("Disable Kiosk")),1)]),_:1})]))],32)])):(r(),u("div",At,[d[5]||(d[5]=e("a",{href:"/kiosk",class:"border-t border-saturn-gray font-bold focus:outline-0 py-4 focus:ring-0 text-2xl"},"Refresh Kiosk",-1)),e("button",{onClick:d[4]||(d[4]=E=>M.value=!0),class:"border-y border-saturn-gray font-bold focus:outline-0 py-4 focus:ring-0 text-2xl text-left"},v(o.$t("Disable Kiosk (Admin password required)")),1)]))]}),_:1},8,["show"]))}};ne();const Vt=Qe("user",{state:()=>({metaData:{},usersData:null}),getters:{meta:f=>f.metaData||null,users:f=>f.usersData||null},actions:{async getUsers(f={}){await he.get("/api/users",{params:f}).then(g=>{const p=g.data.data,l=g.data.meta;p.length>0?this.usersData=p:this.usersData=null,l?this.metaData=l:this.metaData=null})}}}),Gt={role:"list",class:"divide-y divide-saturn-gray"},Ht={class:"flex px-6 py-3.5"},Jt=["placeholder"],Yt=["onClick"],Zt={class:"px-6"},Qt={class:"flex justify-between"},Xt={class:"flex"},es={class:"flex-auto"},ts={class:"font-bold text-2xl"},ss={__name:"UserList",setup(f){const g=ne(),p=a([]),l=a(""),B=Vt(),w=b(()=>B.users);me(async()=>{await B.getUsers({kiosk_user:1,per_page:1e3,team_id:g.props.auth.user.current_team.id}),p.value=w.value});function R(){if(!l.value){p.value=w.value;return}p.value=w.value.filter(k=>k.name.toLowerCase().includes(l.value.toLowerCase()))}return(k,c)=>(r(),u("ul",Gt,[e("li",Ht,[c[1]||(c[1]=e("span",{class:"material-symbols-outlined pr-2 text-3xl",style:{"font-variation-settings":"'FILL' 1, 'wght' 700, 'GRAD' 0, 'opsz' 48"}},"search",-1)),fe(e("input",{"onUpdate:modelValue":c[0]||(c[0]=y=>l.value=y),class:"border-none focus:border-none focus:ring-0 font-bold p-0 placeholder:text-[#B1B0BA] text-2xl",placeholder:k.$t("Search..."),onKeyup:R},null,40,Jt),[[ge,l.value]])]),(r(!0),u(J,null,oe(p.value,y=>(r(),u("li",{key:y.email,onClick:m=>k.$emit("userListUserSelected",y),class:"hover:bg-light-sky py-4 relative"},[e("div",Zt,[e("div",Qt,[e("div",Xt,[e("div",es,[e("p",ts,[e("a",null,[c[2]||(c[2]=e("span",{class:"absolute inset-x-0 -top-px bottom-0 cursor-pointer"},null,-1)),te(" "+v(y.name),1)])])])])])])],8,Yt))),128))]))}},ns={class:"flex overflow-hidden max-h-200"},os={key:0,class:"flex h-screen"},ls={class:"h-full p-8"},as={class:"flex grow relative"},is={class:"flex flex-col grow justify-center px-8 xl:px-20 text-white"},rs={class:"font-bold text-2xl"},us={class:"font-medium font-number pt-2.5 text-xl"},ds={class:"font-bold leading-16 pt-4 xl:pt-8 xl:text-[3.5rem] text-4xl"},cs={class:"after:content-['âº'] after:px-2 last:after:content-[''] last:after:px-0"},vs={key:1},fs={key:2},gs={key:3},ps={class:"flex pt-4 xl:pt-10"},ms={class:"font-medium font-number pt-3.5 xl:text-[2.5rem] text-2xl"},hs={class:"pl-8 xl:pl-32"},ys={class:"font-medium font-number pt-3.5 xl:text-[2.5rem] text-2xl"},ks={class:"pt-12 xl:pt-28"},bs={key:0,class:"flex gap-9"},ws={key:1,class:"bg-[url('/img/rings.svg')] bg-no-repeat bg-bottom-right bg-void h-screen flex"},xs={class:"bg-white overflow-auto"},_s={class:"ml-20 mt-36 text-white"},$s={class:"font-bold leading-10 mb-4 text-[2rem]"},Cs={class:"font-medium font-number xl:text-8xl text-6xl"},js={__name:"Kiosk",setup(f){const g=ne(),p=a(!1),l=a(null),B=a(null),w=a(new Date),R=a(null),k=a([]),c=a(null),y=a(null),m=a(!1),n=a(!1),i=a(!1),T=a(null),_=a(null),D=a(null),j=a(!1),Y=a(!1),z=a(!1),A=a(!1),P=a(null),Z=a({}),N=a(!1),L=a(!1),Q=a([]),M=a(0),o=b(()=>{var t;
1return((t=g.props.auth)==null?void 0:t.time_custom_field_definitions)||[]}),d=b(()=>{var t;return!!((t=g.props.auth.features)!=null&&t.CustomFields)}),$=b(()=>{const t=l.value;return t?!!t.break_rule_id||t.is_break===!0||t.is_break===1:!1}),C=b(()=>d.value?o.value.some(t=>!(!t.is_required||$.value&&!t.is_required_for_breaks)):!1),S=b(()=>{var t,s,h;return!!((h=(s=(t=g.props.auth)==null?void 0:t.user)==null?void 0:s.settings)!=null&&h.time_notes_required)}),E=b(()=>{var t,s,h;return!!((h=(s=(t=g.props.auth)==null?void 0:t.user)==null?void 0:s.settings)!=null&&h.time_notes_required_for_breaks)}),U=b(()=>S.value&&(!$.value||E.value)),O=b(()=>T.value?"switch":"clockOut"),F=b(()=>O.value==="switch"?G("Please fill in the following before switching."):G("Please fill in the following before clocking out.")),le=b(()=>O.value==="switch"?G("Enter a note before switching."):G("Enter a note before clocking out.")),ye=b(()=>O.value==="switch"?G("Switch"):G("Clock out"));async function ke(t){var q;const s=String(t.notes??((q=l.value)==null?void 0:q.notes)??"").trim(),h=s!==""?{...t,notes:s}:t;if(U.value&&s===""){P.value=t,N.value=!0;return}await _e(h)}const X=b(()=>Q.value.some(t=>(l.value=t,!t.end))),be=b(()=>w.value.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric"})),Be=b(()=>{const t=new Date().toLocaleDateString(navigator.language,{weekday:"long",month:"long",day:"numeric"});return Oe(k.value[t]/1e3)}),we=b(()=>w.value.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit"})),Me=b(()=>Oe(Object.values(k.value).reduce((t,s)=>t+s,0)/1e3));me(async()=>{setInterval(()=>{!navigator.userActivation.isActive&&!_.value&&location.reload()},9e5),R.value=setInterval(()=>{w.value=new Date},1e3);let t=null;try{t=await navigator.wakeLock.request("screen")}catch(h){console.error(`${h.name}, ${h.message}`)}try{const h=await dt(g.props.auth.user.current_team.id);M.value=h.value}catch(h){console.error(`${h.name}, ${h.message}`)}(await tt({per_page:1,team_id:g.props.auth.user.current_team.id})).data.data.length&&(m.value=!0)}),Te(l,async t=>{if(t!=null&&t.work_id){const s=await at({id:t.work_id});B.value=s.data.data.path}});async function ae(){if(m.value&&!D.value){p.value=!0,z.value=!0;return}const s={start:new Date().toISOString(),team_id:g.props.auth.user.current_team.id};if(_.value)s.user_id=_.value.id;else return;D.value&&(s.work_id=D.value.id),await Pe(s)}async function Pe(t){const s=await it(t);l.value=s.data.data,await ie(),p.value=!1,j.value=!0,y.value=setTimeout(()=>{ue()},1e3)}async function Ue(t){N.value=!1;const s=P.value||{};P.value=null,await _e({...s,notes:t})}function Fe(){N.value=!1,P.value=null,p.value=!1,T.value=null,L.value=!1}async function ie(){var s;const t=await rt({user_ids:[(s=_.value)==null?void 0:s.id],start:re().toISOString(),per_page:100,team_id:g.props.auth.user.current_team.id});Q.value=t.data.data}function re(){const t=new Date().getDay();let s=0;s+=M.value<=t?t-M.value:7-(M.value-t);const h=new Date;return h.setDate(w.value.getDate()-s),h.setHours(0,0,0,0),h}function qe(){const t=re();return t.setDate(t.getDate()+6),t.setHours(23,59,59,999),t}async function xe(){if(!_.value)return;const t={...l.value,end:new Date().toISOString()};if(C.value){P.value=t;try{const{data:s}=await he.get(`/api/times/${l.value.id}/custom-field-values`);Z.value=(s==null?void 0:s.data)??{}}catch{Z.value={}}A.value=!0;return}await ke(t)}async function _e(t){try{if(await ut(t),l.value=null,await ie(),D.value=null,T.value){const s=T.value;T.value=null,D.value=s,L.value=!1,await ae();return}L.value||(j.value=!0,y.value=setTimeout(()=>{ue()},1e3)),L.value=!1}catch(s){throw T.value=null,L.value=!1,s}}function Ke(t){A.value=!1;const s=P.value||{};P.value=null,ke({...s,custom_field_values:t})}function Re(){A.value=!1,P.value=null,T.value=null,L.value=!1}const je=b(()=>ct());function ue(){j.value=!1,clearInterval(c.value),l.value=null,_.value=null,D.value=null,k.value=[],i.value=!1}function ze(){const t=re(),s=qe();return Q.value.reduce((q,K)=>{let ee=new Date(K.start),se=new Date;for(K.end&&(se=new Date(K.end));ee<se;){let De=0,V=new Date(new Date(ee).toLocaleDateString({weekday:"long",month:"long",day:"numeric"})).setHours(23,59,59,999);const Se=new Date(new Date(ee).toLocaleDateString({weekday:"long",month:"long",day:"numeric"})).setHours(0,0,0,0);if(V>se.getTime()?V=se.getTime():De=1,V>=t.getTime()&&V<=s.getTime()){const de=new Date(V).toLocaleDateString(navigator.language,{weekday:"long",month:"long",day:"numeric"});q[de]||(q[de]=0),q[de]+=V-ee+De}ee=new Date(new Date(Se).setDate(new Date(Se).getDate()+1))}return q},[])}function $e(){n.value=!1}function Ae(t){_.value=t,n.value=!0}async function Ne(t){$e(),_.value=t,await ie(),c.value=setInterval(()=>{k.value=ze()},1e3),i.value=!0}function Ve(t){z.value=!1,p.value?(D.value=t,ae()):L.value&&(T.value=t,Ce())}
1async function Ce(){if(!T.value){L.value=!0,z.value=!0;return}try{await xe()}catch(t){throw T.value=null,L.value=!1,t}}return(t,s)=>(r(),u(J,null,[x(I(Le),null,{default:W(()=>s[5]||(s[5]=[e("meta",{name:"mobile-web-app-capable",content:"yes"},null,-1)])),_:1}),x(vt,{title:"Kiosk"},{default:W(()=>{var h,q;return[x(pe,{show:z.value,closeable:!0,onClose:s[0]||(s[0]=K=>z.value=!1)},{title:W(()=>s[6]||(s[6]=[e("h4",null,"Select work",-1)])),default:W(()=>[e("div",ns,[x(st,{user:_.value,onWorkListWorkSelected:Ve},null,8,["user"])])]),_:1},8,["show"]),x(pe,{show:j.value,onClose:s[1]||(s[1]=K=>j.value=!1),width:"31.25",closeable:!1},{title:W(()=>s[7]||(s[7]=[te("Exiting your time card...")])),_:1},8,["show"]),x(nt,{show:A.value,definitions:o.value,"is-break":$.value,"initial-values":Z.value,"intro-body":F.value,"primary-button-label":ye.value,onSubmitted:Ke,onCancelled:Re},null,8,["show","definitions","is-break","initial-values","intro-body","primary-button-label"]),x(ot,{show:N.value,"primary-button-label":ye.value,"intro-body":le.value,"initial-notes":String(((h=P.value)==null?void 0:h.notes)??((q=l.value)==null?void 0:q.notes)??"").trim(),onSubmitted:Ue,onCancelled:Fe},null,8,["show","primary-button-label","intro-body","initial-notes"]),i.value?(r(),u("div",os,[e("div",ls,[e("button",{onClick:s[2]||(s[2]=K=>ue()),class:"bg-light-lunar hover:bg-lunar flex flex-col justify-center items-center h-full p-32 rounded"},s[8]||(s[8]=[e("span",{class:"material-symbols-outlined px-1 rotate-180 text-7xl"},"logout",-1),e("span",{class:"font-bold mt-4 text-[2rem]"},"Exit",-1)]))]),e("div",as,[x(lt,{activated:X.value},null,8,["activated"]),e("div",is,[e("div",null,[e("div",rs,v(be.value),1),e("div",us,v(we.value),1)]),e("div",ds,[X.value&&B.value?(r(!0),u(J,{key:0},oe(B.value,K=>(r(),u("span",cs,v(K.name),1))),256)):X.value&&D.value?(r(),u("span",vs,v(D.value.name),1)):X.value?(r(),u("span",fs,"Good "+v(je.value)+" "+v(_.value.first_name),1)):(r(),u("span",gs,"Clocked out"))]),e("div",ps,[e("div",null,[s[9]||(s[9]=e("div",{class:"font-bold text-2xl"},"Today",-1)),e("div",ms,v(Be.value),1)]),e("div",hs,[s[10]||(s[10]=e("div",{class:"font-bold text-2xl"},"This week",-1)),e("div",ys,v(Me.value),1)])]),e("div",ks,[X.value?(r(),u("div",bs,[m.value?(r(),u("button",{key:0,onClick:Ce,class:"basis-2/6 bg-sun font-bold hover:bg-dark-sun py-12 rounded text-4xl text-void w-full"},s[11]||(s[11]=[e("div",{class:"py-1"},"Switch",-1)]))):H("",!0),e("button",{onClick:xe,class:We([m.value?"basis-4/6":"","bg-ignition font-bold hover:bg-dark-ignition py-12 rounded text-4xl text-void w-full"])},s[12]||(s[12]=[e("div",{class:"py-1"},"Clock out",-1)]),2)])):(r(),u("button",{key:1,onClick:ae,class:"bg-sky font-bold hover:bg-dark-sky py-12 rounded text-4xl text-white w-full"},s[13]||(s[13]=[e("div",{class:"py-1"},"Clock in",-1)])))])])])])):(r(),u("div",ws,[e("div",xs,[x(ss,{onUserListUserSelected:Ae})]),e("div",_s,[e("div",$s,v(be.value),1),e("div",Cs,v(we.value),1)]),e("div",{onClick:s[3]||(s[3]=K=>{Y.value=!0}),class:"absolute flex items-center hover:bg-lunar cursor-pointer p-2 right-4 rounded-lg top-4"},s[14]||(s[14]=[e("span",{class:"material-symbols-outlined text-5xl text-white"},"settings",-1)])),x(bt,{user:_.value,open:n.value,onKioskPinModalClose:$e,onKioskPinModalLoginSuccess:Ne},null,8,["user","open"])])),x(Nt,{show:Y.value,"otp-exit-channel":I(g).props.otpExitChannel??null,onClose:s[4]||(s[4]=K=>Y.value=!1)},null,8,["show","otp-exit-channel"])]}),_:1})],64))}};export{js as default}; 2//# sourceMappingURL=Kiosk-DTpEJ0Nd.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.