@qratilabs/qrati-connect 2.31.0 → 2.31.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/element/{ydzHqf5r.js → 5r_0x4aK.js} +1 -1
  2. package/element/{WYFR_OYu.js → ASQv5Ahv.js} +1 -1
  3. package/element/{CS8uERGc.js → BCmdnJKF.js} +1 -1
  4. package/element/{CLnFGdWV.js → BOs_rBYA.js} +1 -1
  5. package/element/{QxKjlE-j.js → BWKUiudT.js} +1 -1
  6. package/element/{DKxH7j1t2.js → BWjYmdOz2.js} +1 -1
  7. package/element/{Dng1_dLU.js → BXUp7Zp4.js} +1 -1
  8. package/element/{CQMPBmQq2.js → B_SYJsyF2.js} +1 -1
  9. package/element/{BHZLezAf2.js → BaYMN8qa2.js} +2 -2
  10. package/element/{DMTh6mDu.js → Bc-phiG6.js} +1 -1
  11. package/element/{oZRYetXV.js → BpAijsfn.js} +1 -1
  12. package/element/{CXRH3zmy.js → Bq48A0Iv.js} +1 -1
  13. package/element/{cBUXG_uS.js → BszsxRY6.js} +1 -1
  14. package/element/{BxQf2Aj9.js → Bvc6t1Gu.js} +1 -1
  15. package/element/{DLlq90qS2.js → CFRIlHtK2.js} +1 -1
  16. package/element/CHYm7f-K2.js +2 -0
  17. package/element/{DqAzUQcH.js → CJ_l5BYI.js} +1 -1
  18. package/element/{B6VNWZAH.js → CNyy8GGA.js} +1 -1
  19. package/element/{BVxovwox.js → CQJ3AK1w.js} +1 -1
  20. package/element/CV7KmbT-.js +17 -0
  21. package/element/{Bon1RRdW2.js → CYGIt75r2.js} +3 -3
  22. package/element/Cj_TL6Ks2.js +36 -0
  23. package/element/{fb68GFFw.js → CkBayeWW.js} +1 -1
  24. package/element/{Be3fjihP2.js → D1eaRhKY2.js} +1 -1
  25. package/element/{BhSnOrEj.js → D54cshAo.js} +1 -1
  26. package/element/D5Ja4Yts.js +1 -0
  27. package/element/{B4_a0yK9.js → DJMlQk40.js} +1 -1
  28. package/element/{BHa93rAe.js → DTPNRhMK.js} +1 -1
  29. package/element/{D_uU1Yt72.js → DWwbkxCM2.js} +1 -1
  30. package/element/{DIWjXG_0.js → Do4y0nPe.js} +1 -1
  31. package/element/{CdivXyOP.js → Dpwx5KMy.js} +5 -5
  32. package/element/{DLHvSz1a2.js → Te9ieH1R2.js} +1 -1
  33. package/element/{CuX3CHnz.js → V_pvG6Pc.js} +4 -4
  34. package/element/{D6q-D1kv.js → Z3MoLpu5.js} +5 -5
  35. package/element/{CHOgSp57.js → a_rT1I0D.js} +2 -2
  36. package/element/{2RASYw2m.js → erXAfWWY.js} +1 -1
  37. package/element/{9E5bMl4h.js → rlutojb0.js} +1 -1
  38. package/element/{BJPxuSLA2.js → tbcqJrU_2.js} +1 -1
  39. package/element/web.es.js +43 -43
  40. package/element/{DgRZv6hc2.js → xPoQq2aN2.js} +1 -1
  41. package/package.json +1 -1
  42. package/element/B1PRJBoi.js +0 -17
  43. package/element/B5UCbssB2.js +0 -36
  44. package/element/DT0jsFeS.js +0 -1
  45. package/element/mZxLLxIK2.js +0 -2
@@ -1,3 +1,3 @@
1
- import{f as e,t,v as n}from"./BXMw4kNf.js";import{n as r,r as o}from"./CdivXyOP.js";import{t as a}from"./DmpmrPE5.js";import{i,n as s,r as c}from"./Bb9ydqSB.js";import{n as l,t as d}from"./Bki5T_lb.js";function w({className:e}){/* @__PURE__ */
1
+ import{f as e,t,v as n}from"./BXMw4kNf.js";import{n as r,r as o}from"./Dpwx5KMy.js";import{t as a}from"./DmpmrPE5.js";import{i,n as s,r as c}from"./Bb9ydqSB.js";import{n as l,t as d}from"./Bki5T_lb.js";function w({className:e}){/* @__PURE__ */
2
2
  return t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:e,"aria-hidden":"true",focusable:"false",children:/* @__PURE__ */t("path",{fill:"currentColor",d:"M12 7.125v7.8l3.15 1.925l-.825-3.6l2.775-2.4l-3.65-.325zm0 10.15l-4.15 2.5q-.275.175-.575.15t-.525-.2t-.35-.437t-.05-.588l1.1-4.725L3.775 10.8q-.25-.225-.312-.513t.037-.562t.3-.45t.55-.225l4.85-.425l1.875-4.45q.125-.3.388-.45t.537-.15t.537.15t.388.45l1.875 4.45l4.85.425q.35.05.55.225t.3.45t.038.563t-.313.512l-3.675 3.175l1.1 4.725q.075.325-.05.588t-.35.437t-.525.2t-.575-.15z"})})}function u({className:e}){/* @__PURE__ */
3
3
  return t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:e,"aria-hidden":"true",focusable:"false",children:/* @__PURE__ */t("path",{fill:"currentColor",d:"M12 20q-3.35 0-5.675-2.325T4 12t2.325-5.675T12 4t5.675 2.325T20 12t-2.325 5.675T12 20m0-2q2.5 0 4.25-1.75T18 12q0-.425-.062-.837t-.188-.813q-.375.075-.75.113t-.75.037q-1.575 0-3-.6T10.7 8.15q-.7 1.425-1.925 2.475T6 12.15q.075 2.45 1.812 4.15T12 18M6.4 9.85q1.1-.575 1.675-1.337T9.2 6.7q-.95.5-1.675 1.313T6.4 9.85m2.388 3.863Q8.5 13.425 8.5 13t.288-.712T9.5 12t.713.288t.287.712t-.288.713T9.5 14t-.712-.288M16.25 8.5h.3q.15 0 .3-.025q-.825-1.125-2.087-1.8T12 6h-.3q-.15 0-.275.025q.975 1.125 2.062 1.8t2.763.675m-2.463 5.213Q13.5 13.425 13.5 13t.288-.712T14.5 12t.713.288t.287.712t-.288.713T14.5 14t-.712-.288M1 5V3q0-.825.588-1.412T3 1h2q.425 0 .713.288T6 2t-.288.713T5 3H3v2q0 .425-.288.713T2 6t-.712-.288T1 5m4 18H3q-.825 0-1.412-.587T1 21v-2q0-.425.288-.712T2 18t.713.288T3 19v2h2q.425 0 .713.288T6 22t-.288.713T5 23m16 0h-2q-.425 0-.712-.288T18 22t.288-.712T19 21h2v-3h2v3q0 .825-.587 1.413T21 23m0-18V3h-2q-.425 0-.712-.288T18 2t.288-.712T19 1h2q.825 0 1.413.588T23 3v2q0 .425-.288.713T22 6t-.712-.288T21 5M9.2 6.7"})})}var m=null,p=!1,g=()=>m||(m=new Promise(e=>{if("undefined"==typeof window)return void e();if(window.googletag=window.googletag||{cmd:[]},document.querySelector('script[src*="gpt.js"]'))return void e();const t=document.createElement("script");t.src="https://securepubads.g.doubleclick.net/tag/js/gpt.js",t.async=!0,t.crossOrigin="anonymous",t.onload=()=>e(),t.onerror=()=>e(),document.head.appendChild(t)})),h=()=>{p||(p=!0,window.googletag.enableServices())},T=e=>{try{const t=(window.googletag.pubads().getSlots?.()??[]).find(t=>t.getSlotElementId?.()===e);t&&window.googletag.destroySlots([t])}catch{}},v=async()=>{try{return await(async()=>{const e=await o();return"string"==typeof e?e:e?.fingerprint})()}catch(e){return console.error("[Qrati Connect] Browser fingerprint unavailable:",e),null}},f=()=>{const t=e(null),{props:o,sessionId:w,user:u}=r(),m=o?.organizationId,p=e(null),g=e(null),h=n(async e=>{if(e&&(t.current||(t.current=await v()),t.current))try{await a.post(i.TRACK_EVENT,{json:{kind:"view",eventSlug:e,browserFingerprint:t.current},headers:{"x-org-id":m,...u?{Authorization:`Bearer ${u.token}`}:{}}})}catch(n){console.error(n)}},[m,u]),T=n(async(e,n)=>{if(e&&n&&(t.current||(t.current=await v()),t.current))try{await a.post(i.TRACK_EVENT,{json:{kind:"ad",adId:e,type:n,browserFingerprint:t.current},headers:{"x-org-id":m}})}catch(r){console.error(r)}},[m]),f=n(async e=>T(e,s.AD_IMPRESSION),[T]),E=n(async e=>T(e,s.AD_ENGAGEMENT),[T]),q=n((e,t,n)=>{if(T(e,s.AD_CLICK),!n)return;const r=String(n);switch(t){case c.LINK:d(r,["http:","https:"])&&window.open(r,"_blank","noopener,noreferrer");break;case c.EMAIL:{const e=l(r);e&&(window.location.href=`mailto:${e}`);break}case c.PHONE:{const e=l(r);e&&(window.location.href=`tel:${e}`);break}case c.SMS:{const e=l(r);e&&(window.location.href=`sms:${e}`);break}case c.WHATSAPP:{const e=l(r);e&&(window.location.href=`https://wa.me/${encodeURIComponent(e)}`);break}case c.MESSENGER:{const e=l(r);e&&(window.location.href=`https://m.me/${encodeURIComponent(e)}`);break}default:d(r,["http:","https:"])&&window.open(r,"_blank","noopener,noreferrer")}},[T]),y=n(e=>{if(p.current&&g.current){const e={page:p.current,entryTime:g.current,exitTime:Date.now()};I([e])}p.current=e??null,g.current=Date.now()},[]),I=n(async e=>{if(w)try{await a.post(i.UPDATE_SESSION,{headers:{"x-org-id":m},json:{sessionId:w,pageViews:e}})}catch(t){console.error(t)}},[m,w]);return{incrementEventView:h,captureAdImpression:f,captureAdEngagement:E,captureAdClick:q,trackPageView:y,exportPageViewsData:I,trackGamAnalytics:n(async({eventId:e,organizationId:n,type:r,creativeId:o,lineItemId:s,advertiserId:c,isEmpty:l})=>{if(!e||!r)return;if(t.current||(t.current=await v()),!t.current)return;const d=n||m;if(d)try{await a.post(i.TRACK_EVENT,{json:{kind:"gam",eventId:e,organizationId:d,type:r,browserFingerprint:t.current,...o?{creativeId:o}:{},...s?{lineItemId:s}:{},...c?{advertiserId:c}:{},...void 0!==l?{isEmpty:l}:{}},headers:{"x-org-id":d}})}catch(w){console.error(w)}},[m])}},E=({container:e,onClick:t})=>{let n=!1,r=!1,o=0,a=null;const i=()=>{n=!0,o=Date.now()},s=()=>{n=!1},c=()=>{null!==a&&(window.clearTimeout(a),a=null)},l=()=>{a=window.setTimeout(()=>{const a=document.activeElement,i=a instanceof HTMLIFrameElement&&e.contains(a),s=Date.now()-o<=1500;!r&&(i||n&&s)&&(r=!0,t())},0)};return e.addEventListener("pointerenter",i),e.addEventListener("pointerleave",s),window.addEventListener("blur",l),window.addEventListener("focus",c),()=>{e.removeEventListener("pointerenter",i),e.removeEventListener("pointerleave",s),window.removeEventListener("blur",l),window.removeEventListener("focus",c),null!==a&&window.clearTimeout(a)}};export{g as a,h as i,f as n,u as o,T as r,w as s,E as t};
@@ -1,4 +1,4 @@
1
- import{_ as r,t as e}from"./BXMw4kNf.js";import{i as a,n as s}from"./CdivXyOP.js";import{x as t}from"./Bb9ydqSB.js";import{i,l as o,n as m,u as d}from"./D6q-D1kv.js";import{t as l}from"./BxQf2Aj9.js";import{t as n}from"./BxZobjC-.js";import{t as c}from"./CLnFGdWV.js";var p=()=>{const p=o(),b=d(),{initializing:f,organization:h,user:x}=s(),u=p.pathname.endsWith("/login")||p.pathname.endsWith("/register");return r(()=>{if(x){const r=p.state?.referrer;b(r||"/",{replace:!0})}},[x]),f?/* @__PURE__ */e("div",{className:"mx-auto max-w-lg space-y-8 py-8",children:[
1
+ import{_ as r,t as e}from"./BXMw4kNf.js";import{i as a,n as s}from"./Dpwx5KMy.js";import{x as t}from"./Bb9ydqSB.js";import{i,l as o,n as m,u as d}from"./Z3MoLpu5.js";import{t as l}from"./Bvc6t1Gu.js";import{t as n}from"./BxZobjC-.js";import{t as c}from"./BOs_rBYA.js";var p=()=>{const p=o(),b=d(),{initializing:f,organization:h,user:x}=s(),u=p.pathname.endsWith("/login")||p.pathname.endsWith("/register");return r(()=>{if(x){const r=p.state?.referrer;b(r||"/",{replace:!0})}},[x]),f?/* @__PURE__ */e("div",{className:"mx-auto max-w-lg space-y-8 py-8",children:[
2
2
  /* @__PURE__ */e(l,{className:"h-8"}),
3
3
  /* @__PURE__ */e(l,{className:"h-8"}),
4
4
  /* @__PURE__ */e(l,{className:"h-8"}),
@@ -0,0 +1 @@
1
+ import{p as t,t as s,w as e}from"./BXMw4kNf.js";import{c as i}from"./Bb9ydqSB.js";import{t as r}from"./Z3MoLpu5.js";import{t as o}from"./BWKUiudT.js";import{t as a}from"./Bki5T_lb.js";var h=({url:h,alt:l="",thumbnailUrl:n,blurhash:u,pswpData:p={},curateLink:c,onClick:w})=>{const v=t(()=>(t=>Object.keys(t).reduce((s,e)=>{const i=t[e];return null==i||""===i||(s[`data-pswp-${r=e,r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}`]=i),s;var r},{}))(p),[p]),d=/* @__PURE__ */s(e,{children:[/* @__PURE__ */s(o,{threshold:.1,src:n||h,blurhash:u,alt:l}),p.type===i.VIDEO&&/* @__PURE__ */s("div",{className:"absolute inset-0 top-0 left-0 flex items-center justify-center opacity-75",children:/* @__PURE__ */s("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-16 text-white lg:w-24",viewBox:"0 0 24 24",children:/* @__PURE__ */s("path",{fill:"currentColor",d:"M8 17.175V6.825q0-.425.3-.713t.7-.287q.125 0 .263.037t.262.113l8.15 5.175q.225.15.338.375t.112.475t-.112.475t-.338.375l-8.15 5.175q-.125.075-.262.113T9 18.175q-.4 0-.7-.288t-.3-.712"})})})]});if(w)/* @__PURE__ */return s("button",{className:"h-full w-full",onClick:w,children:d});if(c)/* @__PURE__ */return s(r,{to:c,className:"h-full w-full",children:d});const y=h&&a(h,["http:","https:"])?h:void 0;return y?/* @__PURE__ */s("a",{href:y,className:"pswp-item block h-full w-full",...v,...n?{"data-pswp-thumbnail-url":n}:{},...u?{"data-pswp-blurhash":u}:{},target:"_blank",rel:"noreferrer",children:d}):/* @__PURE__ */s("span",{className:"pswp-item block h-full w-full",...v,...n?{"data-pswp-thumbnail-url":n}:{},...u?{"data-pswp-blurhash":u}:{},children:d})},l="__qrati_photoswipe",n=t=>Boolean(t&&"object"==typeof t&&t[l]),u=class{active=!1;closingByBackButton=!1;previousState;previousUrl="";previousBrowserState;previousBrowserUrl="";nativeHistoryActive=!1;getPhotoSwipe;routerHistory;constructor(t,s){this.getPhotoSwipe=t,this.routerHistory=s}open(){if(this.active)return;this.active=!0,this.previousState=this.routerHistory?this.routerHistory.state:window.history.state,this.previousUrl=this.routerHistory?this.routerHistory.location:window.location.href,this.previousBrowserState=window.history.state,this.previousBrowserUrl=window.location.href;const t=this.previousState&&"object"==typeof this.previousState?{...this.previousState,[l]:!0}:{[l]:!0};this.routerHistory?(this.routerHistory.push(this.previousUrl,t),window.history.pushState({...this.previousBrowserState??{},[l]:!0},document.title,this.previousBrowserUrl),this.nativeHistoryActive=!0,window.addEventListener("popstate",this.handlePopState)):(window.history.pushState(t,document.title,this.previousUrl),this.nativeHistoryActive=!0,window.addEventListener("popstate",this.handlePopState))}close(){if(!this.active)return;const t=this.closingByBackButton;this.cleanup(),t?this.routerHistory&&this.routerHistory.go(-1):this.routerHistory?(this.routerHistory.go(-1),this.nativeHistoryActive&&window.history.back()):window.history.back()}destroy(){this.active&&(this.routerHistory&&n(this.routerHistory.state)?this.routerHistory.replace(this.previousUrl,this.previousState):!this.routerHistory&&n(window.history.state)&&window.history.replaceState(this.previousState,document.title,this.previousUrl),this.nativeHistoryActive&&n(window.history.state)&&window.history.replaceState(this.previousBrowserState,document.title,this.previousBrowserUrl)),this.cleanup()}isActive(){return this.active}handleBack(){this.active&&(this.closingByBackButton=!0,this.getPhotoSwipe()?.close?.())}handlePopState=()=>{this.active&&this.handleBack()};cleanup(){this.active=!1,this.closingByBackButton=!1,this.previousState=void 0,this.previousUrl="",window.removeEventListener("popstate",this.handlePopState)}};export{n,h as r,u as t};
@@ -1,4 +1,4 @@
1
- import{d as e,s as r,t,v as o}from"./BXMw4kNf.js";import{n as s}from"./CdivXyOP.js";import{x as l}from"./Bb9ydqSB.js";import{u as i}from"./D6q-D1kv.js";import"./BVxovwox.js";var n=e(()=>import("./oZRYetXV.js")),a=e(()=>import("./DMTh6mDu.js")),c=e(()=>import("./2RASYw2m.js")),p=e(()=>import("./WYFR_OYu.js")),d=()=>/* @__PURE__ */t("div",{class:"flex h-full items-center justify-center",children:/* @__PURE__ */t("div",{class:"text-center",children:[
1
+ import{d as e,s as r,t,v as o}from"./BXMw4kNf.js";import{n as s}from"./Dpwx5KMy.js";import{x as l}from"./Bb9ydqSB.js";import{u as i}from"./Z3MoLpu5.js";import"./CQJ3AK1w.js";var n=e(()=>import("./BpAijsfn.js")),a=e(()=>import("./Bc-phiG6.js")),c=e(()=>import("./erXAfWWY.js")),p=e(()=>import("./ASQv5Ahv.js")),d=()=>/* @__PURE__ */t("div",{class:"flex h-full items-center justify-center",children:/* @__PURE__ */t("div",{class:"text-center",children:[
2
2
  /* @__PURE__ */t("svg",{xmlns:"http://www.w3.org/2000/svg",class:"text-muted-foreground mx-auto mb-3 size-10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5",children:[/* @__PURE__ */t("path",{d:"M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7z"}),/* @__PURE__ */t("circle",{cx:"12",cy:"9",r:"2.5"})]}),
3
3
  /* @__PURE__ */t("p",{class:"text-foreground",children:"No location data available."}),
4
4
  /* @__PURE__ */t("p",{class:"text-muted-foreground mt-1 text-xs",children:"Events need location data to appear on the map."})]})}),m=()=>/* @__PURE__ */t("div",{class:"flex h-full items-center justify-center",children:/* @__PURE__ */t("div",{class:"border-primary size-8 animate-spin rounded-full border-4 border-t-transparent"})}),g=({events:e,isLoading:g=!1})=>{const{organization:x}=s(),f=i(),u=x?.integrationSettings??{},h=u.mapProvider??"openstreetmap",v=o(e=>{f(l.GALLERY(e))},[f]);if("openstreetmap_free"===h)/* @__PURE__ */return t("div",{class:"relative mt-3 h-screen sm:mt-6",children:/* @__PURE__ */t(r,{fallback:/* @__PURE__ */t(m,{}),children:/* @__PURE__ */t(n,{onExplore:v,logoUrl:x?.logoUrl})})});const y=u.mapTilerApiKey??"",b=u.googleMapsApiKey??"",j=u.mapboxApiKey??"",w=e.filter(e=>"number"==typeof e.location?.x&&"number"==typeof e.location?.y);/* @__PURE__ */
@@ -1,4 +1,4 @@
1
- import{h as a,t as s}from"./BXMw4kNf.js";import{n as o}from"./CdivXyOP.js";import{x as e}from"./Bb9ydqSB.js";import{l as r,t as l}from"./D6q-D1kv.js";import{t as i}from"./cBUXG_uS.js";import{n as t}from"./JY9kGm742.js";import{t as n}from"./DKxH7j1t2.js";import{a as d,i as m,o as p,r as w,s as c,t as g}from"./CQMPBmQq2.js";import{n as h,r as f,t as u}from"./D2-DJv4T2.js";var C=()=>{const{t:C}=t(),[b,v]=a(""),[P,y]=a(""),[N,j]=a(""),[x,A]=a(""),[k,S]=a(""),[z,F]=a(null),[L,E]=a({}),[O,R]=a(!1),[W,D]=a({google:!1,apple:!1}),[G,H]=a({showPassword:!1,showConfirmPassword:!1}),I=r(),{registerUsingEmail:U,loginWithGoogle:Q,loginWithApple:T}=o(),V=a=>{E(s=>s[a]?{...s,[a]:void 0}:s)},Y=async(a,s)=>{D(s=>({...s,[a]:!0})),F(null);try{await(s?.())}catch(o){o instanceof Error?F(o.message):F(`Failed to sign up with ${a.charAt(0).toUpperCase()+a.slice(1)}`)}finally{D(s=>({...s,[a]:!1}))}};/* @__PURE__ */
1
+ import{h as a,t as s}from"./BXMw4kNf.js";import{n as o}from"./Dpwx5KMy.js";import{x as e}from"./Bb9ydqSB.js";import{l as r,t as l}from"./Z3MoLpu5.js";import{t as i}from"./BszsxRY6.js";import{n as t}from"./JY9kGm742.js";import{t as n}from"./BWjYmdOz2.js";import{a as d,i as m,o as p,r as w,s as c,t as g}from"./B_SYJsyF2.js";import{n as h,r as f,t as u}from"./D2-DJv4T2.js";var C=()=>{const{t:C}=t(),[b,v]=a(""),[P,y]=a(""),[N,j]=a(""),[x,A]=a(""),[k,S]=a(""),[z,F]=a(null),[L,E]=a({}),[O,R]=a(!1),[W,D]=a({google:!1,apple:!1}),[G,H]=a({showPassword:!1,showConfirmPassword:!1}),I=r(),{registerUsingEmail:U,loginWithGoogle:Q,loginWithApple:T}=o(),V=a=>{E(s=>s[a]?{...s,[a]:void 0}:s)},Y=async(a,s)=>{D(s=>({...s,[a]:!0})),F(null);try{await(s?.())}catch(o){o instanceof Error?F(o.message):F(`Failed to sign up with ${a.charAt(0).toUpperCase()+a.slice(1)}`)}finally{D(s=>({...s,[a]:!1}))}};/* @__PURE__ */
2
2
  return s("div",{className:"bg-background w-full space-y-8",children:[/* @__PURE__ */s("form",{noValidate:!0,onSubmit:async a=>{a.preventDefault();const s=d(b),o=p(P),e=m(N),r=c(x),l=w(k,x);if(s||o||e||r||l)return void E({fname:s,lname:o,email:e,password:r,confirmPassword:l});E({}),R(!0),F(null);const i=await(U?.(N.toLowerCase(),x,b,P));i?.error&&F(i.error),R(!1)},className:"space-y-4",children:[
3
3
  /* @__PURE__ */s("div",{className:"grid grid-cols-2 gap-4",children:[/* @__PURE__ */s(g,{label:C("auth.firstName","First name"),name:"fname",disabled:O,type:"text",value:b,onChange:a=>{v(a.target.value),V("fname")},error:L.fname}),/* @__PURE__ */s(g,{label:C("auth.lastName","Last name"),name:"lname",disabled:O,type:"text",value:P,onChange:a=>{y(a.target.value),V("lname")},error:L.lname})]}),
4
4
  /* @__PURE__ */s(g,{label:C("auth.email","Email address"),name:"email",disabled:O,type:"email",value:N,onChange:a=>{j(a.target.value),V("email")},autoComplete:"email",error:L.email}),
@@ -1,4 +1,4 @@
1
- import{h as e,p as a,t as r}from"./BXMw4kNf.js";import{n as s}from"./CdivXyOP.js";import{x as i}from"./Bb9ydqSB.js";import{u as t}from"./D6q-D1kv.js";import{t as o}from"./cBUXG_uS.js";import{n as l}from"./JY9kGm742.js";import{t as n}from"./DKxH7j1t2.js";import{i as d,s as c,t as u}from"./CQMPBmQq2.js";var m=({count:e=1,currentStep:a=0,disabled:s,onStepClick:i})=>{const t=s||!i;/* @__PURE__ */
1
+ import{h as e,p as a,t as r}from"./BXMw4kNf.js";import{n as s}from"./Dpwx5KMy.js";import{x as i}from"./Bb9ydqSB.js";import{u as t}from"./Z3MoLpu5.js";import{t as o}from"./BszsxRY6.js";import{n as l}from"./JY9kGm742.js";import{t as n}from"./BWjYmdOz2.js";import{i as d,s as c,t as u}from"./B_SYJsyF2.js";var m=({count:e=1,currentStep:a=0,disabled:s,onStepClick:i})=>{const t=s||!i;/* @__PURE__ */
2
2
  return r("ol",{className:"flex items-center space-x-6 pl-1.5",children:Array.from({length:e}).map((e,s)=>/* @__PURE__ */r("li",{children:/* @__PURE__ */r("button",s<a?{type:"button","aria-label":`Go to step ${s+1}`,className:"bg-primary block h-3 w-3 rounded-full",disabled:t,onClick:()=>i?.(s)}:s===a?{type:"button","aria-label":`Current step ${s+1}`,className:"relative flex items-center justify-center","aria-current":"step",disabled:t,onClick:()=>i?.(s),children:[/* @__PURE__ */r("span",{className:"absolute flex size-6 p-px","aria-hidden":"true",children:/* @__PURE__ */r("span",{className:"bg-primary/40 size-full rounded-full"})}),/* @__PURE__ */r("span",{className:"bg-primary relative block size-3 rounded-full","aria-hidden":"true"})]}:{type:"button","aria-label":`Go to step ${s+1}`,className:"bg-muted block size-3 rounded-full",disabled:t,onClick:()=>i?.(s)})},`progress-dot-${s}`))})},h=({onCodeSent:a})=>{const{t:i}=l(),{sendPasswordResetCode:t}=s(),[c,m]=e(""),[h,p]=e(!1),[f,y]=e(null),[w,v]=e(null);/* @__PURE__ */
3
3
  return r("div",{className:"space-y-4",children:[
4
4
  /* @__PURE__ */r(o,{variant:"h4",children:i("auth.forgotPassword","Forgot Password")}),
@@ -1 +1 @@
1
- import{_ as t,b as e,v as s}from"./CdivXyOP.js";var i=class extends t{#t;#e;#s;#i;constructor(t){super(),this.#t=t.client,this.mutationId=t.mutationId,this.#s=t.mutationCache,this.#e=[],this.state=t.state||{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0},this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){this.#e.includes(t)||(this.#e.push(t),this.clearGcTimeout(),this.#s.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#e=this.#e.filter(e=>e!==t),this.scheduleGc(),this.#s.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#e.length||("pending"===this.state.status?this.scheduleGc():this.#s.remove(this))}continue(){return this.#i?.continue()??this.execute(this.state.variables)}async execute(t){const e=()=>{this.#a({type:"continue"})},i={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#i=s({fn:()=>this.options.mutationFn?this.options.mutationFn(t,i):Promise.reject(/* @__PURE__ */new Error("No mutationFn found")),onFail:(t,e)=>{this.#a({type:"failed",failureCount:t,error:e})},onPause:()=>{this.#a({type:"pause"})},onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#s.canRun(this)});const a="pending"===this.state.status,o=!this.#i.canStart();try{if(a)e();else{this.#a({type:"pending",variables:t,isPaused:o}),this.#s.config.onMutate&&await this.#s.config.onMutate(t,this,i);const e=await(this.options.onMutate?.(t,i));e!==this.state.context&&this.#a({type:"pending",context:e,variables:t,isPaused:o})}const s=await this.#i.start();return await(this.#s.config.onSuccess?.(s,t,this.state.context,this,i)),await(this.options.onSuccess?.(s,t,this.state.context,i)),await(this.#s.config.onSettled?.(s,null,this.state.variables,this.state.context,this,i)),await(this.options.onSettled?.(s,null,t,this.state.context,i)),this.#a({type:"success",data:s}),s}catch(r){try{await(this.#s.config.onError?.(r,t,this.state.context,this,i))}catch(n){Promise.reject(n)}try{await(this.options.onError?.(r,t,this.state.context,i))}catch(n){Promise.reject(n)}try{await(this.#s.config.onSettled?.(void 0,r,this.state.variables,this.state.context,this,i))}catch(n){Promise.reject(n)}try{await(this.options.onSettled?.(void 0,r,t,this.state.context,i))}catch(n){Promise.reject(n)}throw this.#a({type:"error",error:r}),r}finally{this.#s.runNext(this)}}#a(t){this.state=(e=>{switch(t.type){case"failed":return{...e,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...e,isPaused:!0};case"continue":return{...e,isPaused:!1};case"pending":return{...e,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...e,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...e,data:void 0,error:t.error,failureCount:e.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}})(this.state),e.batch(()=>{this.#e.forEach(e=>{e.onMutationUpdate(t)}),this.#s.notify({mutation:this,type:"updated",action:t})})}};function a(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}export{a as n,i as t};
1
+ import{_ as t,b as e,v as s}from"./Dpwx5KMy.js";var i=class extends t{#t;#e;#s;#i;constructor(t){super(),this.#t=t.client,this.mutationId=t.mutationId,this.#s=t.mutationCache,this.#e=[],this.state=t.state||{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0},this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){this.#e.includes(t)||(this.#e.push(t),this.clearGcTimeout(),this.#s.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#e=this.#e.filter(e=>e!==t),this.scheduleGc(),this.#s.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#e.length||("pending"===this.state.status?this.scheduleGc():this.#s.remove(this))}continue(){return this.#i?.continue()??this.execute(this.state.variables)}async execute(t){const e=()=>{this.#a({type:"continue"})},i={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#i=s({fn:()=>this.options.mutationFn?this.options.mutationFn(t,i):Promise.reject(/* @__PURE__ */new Error("No mutationFn found")),onFail:(t,e)=>{this.#a({type:"failed",failureCount:t,error:e})},onPause:()=>{this.#a({type:"pause"})},onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#s.canRun(this)});const a="pending"===this.state.status,o=!this.#i.canStart();try{if(a)e();else{this.#a({type:"pending",variables:t,isPaused:o}),this.#s.config.onMutate&&await this.#s.config.onMutate(t,this,i);const e=await(this.options.onMutate?.(t,i));e!==this.state.context&&this.#a({type:"pending",context:e,variables:t,isPaused:o})}const s=await this.#i.start();return await(this.#s.config.onSuccess?.(s,t,this.state.context,this,i)),await(this.options.onSuccess?.(s,t,this.state.context,i)),await(this.#s.config.onSettled?.(s,null,this.state.variables,this.state.context,this,i)),await(this.options.onSettled?.(s,null,t,this.state.context,i)),this.#a({type:"success",data:s}),s}catch(r){try{await(this.#s.config.onError?.(r,t,this.state.context,this,i))}catch(n){Promise.reject(n)}try{await(this.options.onError?.(r,t,this.state.context,i))}catch(n){Promise.reject(n)}try{await(this.#s.config.onSettled?.(void 0,r,this.state.variables,this.state.context,this,i))}catch(n){Promise.reject(n)}try{await(this.options.onSettled?.(void 0,r,t,this.state.context,i))}catch(n){Promise.reject(n)}throw this.#a({type:"error",error:r}),r}finally{this.#s.runNext(this)}}#a(t){this.state=(e=>{switch(t.type){case"failed":return{...e,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...e,isPaused:!0};case"continue":return{...e,isPaused:!1};case"pending":return{...e,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...e,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...e,data:void 0,error:t.error,failureCount:e.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}})(this.state),e.batch(()=>{this.#e.forEach(e=>{e.onMutationUpdate(t)}),this.#s.notify({mutation:this,type:"updated",action:t})})}};function a(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}export{a as n,i as t};
@@ -1,4 +1,4 @@
1
- import{E as e,_ as t,h as r,p as n,r as i,s,t as o,v as a,y as c}from"./BXMw4kNf.js";import{n as l,t as u}from"./DmpmrPE5.js";import{S as h,h as d,i as f}from"./Bb9ydqSB.js";var p=class{constructor(){this.listeners=/* @__PURE__ */new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},m=new class extends p{#e;#t;#r;constructor(){super(),this.#r=e=>{if("undefined"!=typeof window&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#r=e,this.#t?.(),this.#t=e(e=>{"boolean"==typeof e?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return"boolean"==typeof this.#e?this.#e:"hidden"!==globalThis.document?.visibilityState}},g={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},y=new class{#n=g;#i=!1;setTimeoutProvider(e){this.#n=e}setTimeout(e,t){return this.#n.setTimeout(e,t)}clearTimeout(e){this.#n.clearTimeout(e)}setInterval(e,t){return this.#n.setInterval(e,t)}clearInterval(e){this.#n.clearInterval(e)}},v="undefined"==typeof window||"Deno"in globalThis;function w(){}function b(e,t){return"function"==typeof e?e(t):e}function S(e){return"number"==typeof e&&e>=0&&e!==1/0}function R(e,t){return Math.max(e+(t||0)-Date.now(),0)}function I(e,t){return"function"==typeof e?e(t):e}function O(e,t){return"function"==typeof e?e(t):e}function T(e,t){const{type:r="all",exact:n,fetchStatus:i,predicate:s,queryKey:o,stale:a}=e;if(o)if(n){if(t.queryHash!==E(o,t.options))return!1}else if(!A(t.queryKey,o))return!1;if("all"!==r){const e=t.isActive();if("active"===r&&!e)return!1;if("inactive"===r&&e)return!1}return!("boolean"==typeof a&&t.isStale()!==a||i&&i!==t.state.fetchStatus||s&&!s(t))}function C(e,t){const{exact:r,status:n,predicate:i,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return!1;if(r){if(k(t.options.mutationKey)!==k(s))return!1}else if(!A(t.options.mutationKey,s))return!1}return!(n&&t.state.status!==n||i&&!i(t))}function E(e,t){return(t?.queryKeyHashFn||k)(e)}function k(e){return JSON.stringify(e,(e,t)=>M(t)?Object.keys(t).sort().reduce((e,r)=>(e[r]=t[r],e),{}):t)}function A(e,t){return e===t||typeof e==typeof t&&!(!e||!t||"object"!=typeof e||"object"!=typeof t)&&Object.keys(t).every(r=>A(e[r],t[r]))}var x=Object.prototype.hasOwnProperty;function F(e,t,r=0){if(e===t)return e;if(r>500)return t;const n=D(e)&&D(t);if(!(n||M(e)&&M(t)))return t;const i=(n?e:Object.keys(e)).length,s=n?t:Object.keys(t),o=s.length,a=n?new Array(o):{};let c=0;for(let l=0;l<o;l++){const o=n?l:s[l],u=e[o],h=t[o];if(u===h){a[o]=u,(n?l<i:x.call(e,o))&&c++;continue}if(null===u||null===h||"object"!=typeof u||"object"!=typeof h){a[o]=h;continue}const d=F(u,h,r+1);a[o]=d,d===u&&c++}return i===o&&c===i?e:a}function P(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function D(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function M(e){if(!q(e))return!1;const t=e.constructor;if(void 0===t)return!0;const r=t.prototype;return!!q(r)&&!!r.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(e)===Object.prototype}function q(e){return"[object Object]"===Object.prototype.toString.call(e)}function U(e,t,r){return"function"==typeof r.structuralSharing?r.structuralSharing(e,t):!1!==r.structuralSharing?F(e,t):t}function Q(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function L(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var j=/* @__PURE__ */Symbol();function _(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:e.queryFn&&e.queryFn!==j?e.queryFn:()=>Promise.reject(/* @__PURE__ */new Error(`Missing queryFn: '${e.queryHash}'`))}function z(e,t){return"function"==typeof e?e(...t):!!e}var N=/* @__PURE__ */(()=>{let e=()=>v;return{isServer:()=>e(),setIsServer(t){e=t}}})();function $(){let e,t;const r=new Promise((r,n)=>{e=r,t=n});function n(e){Object.assign(r,e),delete r.resolve,delete r.reject}return r.status="pending",r.catch(()=>{}),r.resolve=t=>{n({status:"fulfilled",value:t}),e(t)},r.reject=e=>{n({status:"rejected",reason:e}),t(e)},r}var H=function(e){setTimeout(e,0)},V=function(){let e=[],t=0,r=e=>{e()},n=e=>{e()},i=H;const s=n=>{t?e.push(n):i(()=>{r(n)})};return{batch:s=>{let o;t++;try{o=s()}finally{t--,t||(()=>{const t=e;e=[],t.length&&i(()=>{n(()=>{t.forEach(e=>{r(e)})})})})()}return o},batchCalls:e=>(...t)=>{s(()=>{e(...t)})},schedule:s,setNotifyFunction:e=>{r=e},setBatchNotifyFunction:e=>{n=e},setScheduler:e=>{i=e}}}(),W=new class extends p{#s=!0;#t;#r;constructor(){super(),this.#r=e=>{if("undefined"!=typeof window&&window.addEventListener){const t=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}}}onSubscribe(){this.#t||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#r=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#s!==e&&(this.#s=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#s}};function G(e){return Math.min(1e3*2**e,3e4)}function Z(e){return"online"!==(e??"online")||W.isOnline()}var K=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function B(e){let t,r=!1,n=0;const i=$(),s=()=>"pending"!==i.status,o=()=>m.isFocused()&&("always"===e.networkMode||W.isOnline())&&e.canRun(),a=()=>Z(e.networkMode)&&e.canRun(),c=e=>{s()||(t?.(),i.resolve(e))},l=e=>{s()||(t?.(),i.reject(e))},u=()=>new Promise(r=>{t=e=>{(s()||o())&&r(e)},e.onPause?.()}).then(()=>{t=void 0,s()||e.onContinue?.()}),h=()=>{if(s())return;let t;const i=0===n?e.initialPromise:void 0;try{t=i??e.fn()}catch(a){t=Promise.reject(a)}Promise.resolve(t).then(c).catch(t=>{if(s())return;const i=e.retry??(N.isServer()?0:3),a=e.retryDelay??G,c="function"==typeof a?a(n,t):a,d=!0===i||"number"==typeof i&&n<i||"function"==typeof i&&i(n,t);var f;!r&&d?(n++,e.onFail?.(n,t),(f=c,new Promise(e=>{y.setTimeout(e,f)})).then(()=>o()?void 0:u()).then(()=>{r?l(t):h()})):l(t)})};return{promise:i,status:()=>i.status,cancel:t=>{if(!s()){const r=new K(t);l(r),e.onCancel?.(r)}},continue:()=>(t?.(),i),cancelRetry:()=>{r=!0},continueRetry:()=>{r=!1},canStart:a,start:()=>(a()?h():u().then(h),i)}}var J=class{#o;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),S(this.gcTime)&&(this.#o=y.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(N.isServer()?1/0:3e5))}clearGcTimeout(){void 0!==this.#o&&(y.clearTimeout(this.#o),this.#o=void 0)}};function Y(e){return{onFetch:(t,r)=>{const n=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,s=t.state.data?.pages||[],o=t.state.data?.pageParams||[];let a={pages:[],pageParams:[]},c=0;const l=async()=>{let r=!1;const l=e=>{!function(e,r,n){let i,s=!1;Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t.signal,s||(s=!0,i.aborted?n():i.addEventListener("abort",n,{once:!0})),i)})}(e,0,()=>r=!0)},u=_(t.options,t.fetchOptions),h=async(e,n,i)=>{if(r)return Promise.reject(t.signal.reason);if(null==n&&e.pages.length)return Promise.resolve(e);const s=(()=>{const e={client:t.client,queryKey:t.queryKey,pageParam:n,direction:i?"backward":"forward",meta:t.options.meta};return l(e),e})(),o=await u(s),{maxPages:a}=t.options,c=i?L:Q;return{pages:c(e.pages,o,a),pageParams:c(e.pageParams,n,a)}};if(i&&s.length){const e="backward"===i,t=e?ee:X,r={pages:s,pageParams:o};a=await h(r,t(n,r),e)}else{const t=e??s.length;do{const e=0===c?o[0]??n.initialPageParam:X(n,a);if(c>0&&null==e)break;a=await h(a,e),c++}while(c<t)}return a};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=l}}}function X(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function ee(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}function te(e,t){return!!t&&null!=X(e,t)}function re(e,t){return!(!t||!e.getPreviousPageParam)&&null!=ee(e,t)}var ne=class extends J{#a;#c;#l;#u;#h;#d;#f;#p;constructor(e){super(),this.#p=!1,this.#f=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#h=e.client,this.#u=this.#h.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#c=oe(this.options),this.state=e.state??this.#c,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#a}get promise(){return this.#d?.promise}setOptions(e){if(this.options={...this.#f,...e},e?._type&&(this.#a=e._type),this.updateGcTime(this.options.gcTime),this.state&&void 0===this.state.data){const e=oe(this.options);void 0!==e.data&&(this.setState(se(e.data,e.dataUpdatedAt)),this.#c=e)}}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#u.remove(this)}setData(e,t){const r=U(this.state.data,e,this.options);return this.#m({data:r,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),r}setState(e){this.#m({type:"setState",state:e})}cancel(e){const t=this.#d?.promise;return this.#d?.cancel(e),t?t.then(w).catch(w):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#c}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>!1!==O(e.options.enabled,this))}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===j||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>"static"===I(e.options.staleTime,this))}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):void 0===this.state.data||this.state.isInvalidated}isStaleByTime(e=0){return void 0===this.state.data||"static"!==e&&(!!this.state.isInvalidated||!R(this.state.dataUpdatedAt,e))}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#d?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#d?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#u.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#d&&(this.#p||this.#g()?this.#d.cancel({revert:!0}):this.#d.cancelRetry()),this.scheduleGc()),this.#u.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}#g(){return"paused"===this.state.fetchStatus&&"pending"===this.state.status}invalidate(){this.state.isInvalidated||this.#m({type:"invalidate"})}async fetch(e,t){if("idle"!==this.state.fetchStatus&&"rejected"!==this.#d?.status())if(void 0!==this.state.data&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#d)return this.#d.continueRetry(),this.#d.promise;if(e&&this.setOptions(e),!this.options.queryFn){const e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}const r=new AbortController,n=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#p=!0,r.signal)})},i=()=>{const e=_(this.options,t),r=(()=>{const e={client:this.#h,queryKey:this.queryKey,meta:this.meta};return n(e),e})();return this.#p=!1,this.options.persister?this.options.persister(e,r,this):e(r)},s=(()=>{const e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#h,state:this.state,fetchFn:i};return n(e),e})();("infinite"===this.#a?Y(this.options.pages):this.options.behavior)?.onFetch(s,this),this.#l=this.state,"idle"!==this.state.fetchStatus&&this.state.fetchMeta===s.fetchOptions?.meta||this.#m({type:"fetch",meta:s.fetchOptions?.meta}),this.#d=B({initialPromise:t?.initialPromise,fn:s.fetchFn,onCancel:e=>{e instanceof K&&e.revert&&this.setState({...this.#l,fetchStatus:"idle"}),r.abort()},onFail:(e,t)=>{this.#m({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#m({type:"pause"})},onContinue:()=>{this.#m({type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0});try{const e=await this.#d.start();if(void 0===e)throw new Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#u.config.onSuccess?.(e,this),this.#u.config.onSettled?.(e,this.state.error,this),e}catch(o){if(o instanceof K){if(o.silent)return this.#d.promise;if(o.revert){if(void 0===this.state.data)throw o;return this.state.data}}throw this.#m({type:"error",error:o}),this.#u.config.onError?.(o,this),this.#u.config.onSettled?.(this.state.data,o,this),o}finally{this.scheduleGc()}}#m(e){this.state=(t=>{switch(e.type){case"failed":return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...t,fetchStatus:"paused"};case"continue":return{...t,fetchStatus:"fetching"};case"fetch":return{...t,...ie(t.data,this.options),fetchMeta:e.meta??null};case"success":const r={...t,...se(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#l=e.manual?r:void 0,r;case"error":const n=e.error;return{...t,error:n,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...e.state}}})(this.state),V.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#u.notify({query:this,type:"updated",action:e})})}};function ie(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Z(t.networkMode)?"fetching":"paused",...void 0===e&&{error:null,status:"pending"}}}function se(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function oe(e){const t="function"==typeof e.initialData?e.initialData():e.initialData,r=void 0!==t,n=r?"function"==typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var ae=class extends p{constructor(e,t){super(),this.options=t,this.#h=e,this.#y=null,this.#v=$(),this.bindMethods(),this.setOptions(t)}#h;#w=void 0;#b=void 0;#S=void 0;#R;#I;#v;#y;#O;#T;#C;#E;#k;#A;#x=/* @__PURE__ */new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#w.addObserver(this),ce(this.#w,this.options)?this.#F():this.updateResult(),this.#P())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return le(this.#w,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return le(this.#w,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=/* @__PURE__ */new Set,this.#D(),this.#M(),this.#w.removeObserver(this)}setOptions(e){const t=this.options,r=this.#w;if(this.options=this.#h.defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof O(this.options.enabled,this.#w))throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#q(),this.#w.setOptions(this.options),t._defaulted&&!P(this.options,t)&&this.#h.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#w,observer:this});const n=this.hasListeners();n&&ue(this.#w,r,this.options,t)&&this.#F(),this.updateResult(),!n||this.#w===r&&O(this.options.enabled,this.#w)===O(t.enabled,this.#w)&&I(this.options.staleTime,this.#w)===I(t.staleTime,this.#w)||this.#U();const i=this.#Q();!n||this.#w===r&&O(this.options.enabled,this.#w)===O(t.enabled,this.#w)&&i===this.#A||this.#L(i)}getOptimisticResult(e){const t=this.#h.getQueryCache().build(this.#h,e),r=this.createResult(t,e);var n;return n=r,P(this.getCurrentResult(),n)||(this.#S=r,this.#I=this.options,this.#R=this.#w.state),r}getCurrentResult(){return this.#S}trackResult(e,t){return new Proxy(e,{get:(e,r)=>(this.trackProp(r),t?.(r),"promise"===r&&(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==this.#v.status||this.#v.reject(/* @__PURE__ */new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(e,r))})}trackProp(e){this.#x.add(e)}getCurrentQuery(){return this.#w}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#h.defaultQueryOptions(e),r=this.#h.getQueryCache().build(this.#h,t);return r.fetch().then(()=>this.createResult(r,t))}fetch(e){return this.#F({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#S))}#F(e){this.#q();let t=this.#w.fetch(this.options,e);return e?.throwOnError||(t=t.catch(w)),t}#U(){this.#D();const e=I(this.options.staleTime,this.#w);if(N.isServer()||this.#S.isStale||!S(e))return;const t=R(this.#S.dataUpdatedAt,e)+1;this.#E=y.setTimeout(()=>{this.#S.isStale||this.updateResult()},t)}#Q(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#w):this.options.refetchInterval)??!1}#L(e){this.#M(),this.#A=e,!N.isServer()&&!1!==O(this.options.enabled,this.#w)&&S(this.#A)&&0!==this.#A&&(this.#k=y.setInterval(()=>{(this.options.refetchIntervalInBackground||m.isFocused())&&this.#F()},this.#A))}#P(){this.#U(),this.#L(this.#Q())}#D(){void 0!==this.#E&&(y.clearTimeout(this.#E),this.#E=void 0)}#M(){void 0!==this.#k&&(y.clearInterval(this.#k),this.#k=void 0)}createResult(e,t){const r=this.#w,n=this.options,i=this.#S,s=this.#R,o=this.#I,a=e!==r?e.state:this.#b,{state:c}=e;let l,u={...c},h=!1;if(t._optimisticResults){const i=this.hasListeners(),s=!i&&ce(e,t),o=i&&ue(e,r,t,n);(s||o)&&(u={...u,...ie(c.data,e.options)}),"isRestoring"===t._optimisticResults&&(u.fetchStatus="idle")}let{error:d,errorUpdatedAt:f,status:p}=u;l=u.data;let m=!1;if(void 0!==t.placeholderData&&void 0===l&&"pending"===p){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,m=!0):e="function"==typeof t.placeholderData?t.placeholderData(this.#C?.state.data,this.#C):t.placeholderData,void 0!==e&&(p="success",l=U(i?.data,e,t),h=!0)}if(t.select&&void 0!==l&&!m)if(i&&l===s?.data&&t.select===this.#O)l=this.#T;else try{this.#O=t.select,l=t.select(l),l=U(i?.data,l,t),this.#T=l,this.#y=null}catch(R){this.#y=R}this.#y&&(d=this.#y,l=this.#T,f=Date.now(),p="error");const g="fetching"===u.fetchStatus,y="pending"===p,v="error"===p,w=y&&g,b=void 0!==l,S={status:p,fetchStatus:u.fetchStatus,isPending:y,isSuccess:"success"===p,isError:v,isInitialLoading:w,isLoading:w,data:l,dataUpdatedAt:u.dataUpdatedAt,error:d,errorUpdatedAt:f,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:u.dataUpdateCount>a.dataUpdateCount||u.errorUpdateCount>a.errorUpdateCount,isFetching:g,isRefetching:g&&!y,isLoadingError:v&&!b,isPaused:"paused"===u.fetchStatus,isPlaceholderData:h,isRefetchError:v&&b,isStale:he(e,t),refetch:this.refetch,promise:this.#v,isEnabled:!1!==O(t.enabled,e)};if(this.options.experimental_prefetchInRender){const t=void 0!==S.data,n="error"===S.status&&!t,i=e=>{n?e.reject(S.error):t&&e.resolve(S.data)},s=()=>{const e=this.#v=S.promise=$();i(e)},o=this.#v;switch(o.status){case"pending":e.queryHash===r.queryHash&&i(o);break;case"fulfilled":(n||S.data!==o.value)&&s();break;case"rejected":n&&S.error===o.reason||s()}}return S}updateResult(){const e=this.#S,t=this.createResult(this.#w,this.options);this.#R=this.#w.state,this.#I=this.options,void 0!==this.#R.data&&(this.#C=this.#w),P(t,e)||(this.#S=t,this.#j({listeners:(()=>{if(!e)return!0;const{notifyOnChangeProps:t}=this.options,r="function"==typeof t?t():t;if("all"===r||!r&&!this.#x.size)return!0;const n=new Set(r??this.#x);return this.options.throwOnError&&n.add("error"),Object.keys(this.#S).some(t=>{const r=t;return this.#S[r]!==e[r]&&n.has(r)})})()}))}#q(){const e=this.#h.getQueryCache().build(this.#h,this.options);if(e===this.#w)return;const t=this.#w;this.#w=e,this.#b=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#P()}#j(e){V.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#S)}),this.#h.getQueryCache().notify({query:this.#w,type:"observerResultsUpdated"})})}};function ce(e,t){return function(e,t){return!1!==O(t.enabled,e)&&void 0===e.state.data&&!("error"===e.state.status&&!1===O(t.retryOnMount,e))}(e,t)||void 0!==e.state.data&&le(e,t,t.refetchOnMount)}function le(e,t,r){if(!1!==O(t.enabled,e)&&"static"!==I(t.staleTime,e)){const n="function"==typeof r?r(e):r;return"always"===n||!1!==n&&he(e,t)}return!1}function ue(e,t,r,n){return(e!==t||!1===O(n.enabled,e))&&(!r.suspense||"error"!==e.state.status)&&he(e,r)}function he(e,t){return!1!==O(t.enabled,e)&&e.isStaleByTime(I(t.staleTime,e))}var de=e(void 0),fe=e=>{const t=c(de);if(e)return e;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},pe=({client:e,children:r})=>(t(()=>(e.mount(),()=>{e.unmount()}),[e]),/* @__PURE__ */o(de.Provider,{value:e,children:r})),me=e(!1);me.Provider;var ge=e(function(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}()),ye=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function ve(e,n,s){const o=c(me),l=c(ge),u=fe(s),h=u.defaultQueryOptions(e);u.getDefaultOptions().queries?._experimental_beforeQuery?.(h);const d=u.getQueryCache().get(h.queryHash),f=!1!==e.subscribed;h._optimisticResults=o?"isRestoring":f?"optimistic":void 0,(e=>{if(e.suspense){const t=1e3,r=e=>"static"===e?e:Math.max(e??t,t),n=e.staleTime;e.staleTime="function"==typeof n?(...e)=>r(n(...e)):r(n),"number"==typeof e.gcTime&&(e.gcTime=Math.max(e.gcTime,t))}})(h),((e,t,r)=>{const n=r?.state.error&&"function"==typeof e.throwOnError?z(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||n)&&(t.isReset()||(e.retryOnMount=!1))})(h,l,d),(e=>{t(()=>{e.clearReset()},[e])})(l);const p=!u.getQueryCache().get(h.queryHash),[m]=r(()=>new n(u,h)),g=m.getOptimisticResult(h),y=!o&&f;if(i(a(e=>{const t=y?m.subscribe(V.batchCalls(e)):w;return m.updateResult(),t},[m,y]),()=>m.getCurrentResult(),()=>m.getCurrentResult()),t(()=>{m.setOptions(h)},[h,m]),((e,t)=>e?.suspense&&t.isPending)(h,g))throw ye(h,m,l);if((({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(i&&void 0===e.data||z(r,[e.error,n])))({result:g,errorResetBoundary:l,throwOnError:h.throwOnError,query:d,suspense:h.suspense}))throw g.error;return u.getDefaultOptions().queries?._experimental_afterQuery?.(h,g),h.experimental_prefetchInRender&&!N.isServer()&&((e,t)=>e.isLoading&&e.isFetching&&!t)(g,o)&&(p?ye(h,m,l):d?.promise)?.catch(w).finally(()=>{m.updateResult()}),h.notifyOnChangeProps?g:m.trackResult(g)}function we(e,t){return ve(e,ae,t)}var be=null;function Se(e){be=e}function Re(e){try{const t=JSON.stringify(e);fetch(f.REPORT_ERROR,{method:"POST",headers:{"Content-Type":"application/json",...be?{"x-org-id":be}:{}},body:t,keepalive:!0}).catch(()=>{})}catch{}}function Ie(e,t){Re({message:e instanceof Error?e.message:String(e),stack:e instanceof Error?e.stack:void 0,level:t?.level??"error",component:t?.component,tags:t?.tags,context:t?.extra,url:"undefined"!=typeof window?window.location.href:void 0,userAgent:"undefined"!=typeof navigator?navigator.userAgent:void 0})}function Oe(e,t="info",r){Re({message:e,level:t,component:r?.component,tags:r?.tags,context:r?.extra,url:"undefined"!=typeof window?window.location.href:void 0,userAgent:"undefined"!=typeof navigator?navigator.userAgent:void 0})}function Te({title:e,children:t}){/* @__PURE__ */
1
+ import{E as e,_ as t,h as r,p as n,r as i,s,t as o,v as a,y as c}from"./BXMw4kNf.js";import{n as l,t as u}from"./DmpmrPE5.js";import{S as h,h as d,i as f}from"./Bb9ydqSB.js";var p=class{constructor(){this.listeners=/* @__PURE__ */new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},m=new class extends p{#e;#t;#r;constructor(){super(),this.#r=e=>{if("undefined"!=typeof window&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#r=e,this.#t?.(),this.#t=e(e=>{"boolean"==typeof e?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return"boolean"==typeof this.#e?this.#e:"hidden"!==globalThis.document?.visibilityState}},g={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},y=new class{#n=g;#i=!1;setTimeoutProvider(e){this.#n=e}setTimeout(e,t){return this.#n.setTimeout(e,t)}clearTimeout(e){this.#n.clearTimeout(e)}setInterval(e,t){return this.#n.setInterval(e,t)}clearInterval(e){this.#n.clearInterval(e)}},v="undefined"==typeof window||"Deno"in globalThis;function w(){}function b(e,t){return"function"==typeof e?e(t):e}function S(e){return"number"==typeof e&&e>=0&&e!==1/0}function R(e,t){return Math.max(e+(t||0)-Date.now(),0)}function I(e,t){return"function"==typeof e?e(t):e}function O(e,t){return"function"==typeof e?e(t):e}function T(e,t){const{type:r="all",exact:n,fetchStatus:i,predicate:s,queryKey:o,stale:a}=e;if(o)if(n){if(t.queryHash!==k(o,t.options))return!1}else if(!A(t.queryKey,o))return!1;if("all"!==r){const e=t.isActive();if("active"===r&&!e)return!1;if("inactive"===r&&e)return!1}return!("boolean"==typeof a&&t.isStale()!==a||i&&i!==t.state.fetchStatus||s&&!s(t))}function C(e,t){const{exact:r,status:n,predicate:i,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return!1;if(r){if(E(t.options.mutationKey)!==E(s))return!1}else if(!A(t.options.mutationKey,s))return!1}return!(n&&t.state.status!==n||i&&!i(t))}function k(e,t){return(t?.queryKeyHashFn||E)(e)}function E(e){return JSON.stringify(e,(e,t)=>M(t)?Object.keys(t).sort().reduce((e,r)=>(e[r]=t[r],e),{}):t)}function A(e,t){return e===t||typeof e==typeof t&&!(!e||!t||"object"!=typeof e||"object"!=typeof t)&&Object.keys(t).every(r=>A(e[r],t[r]))}var x=Object.prototype.hasOwnProperty;function F(e,t,r=0){if(e===t)return e;if(r>500)return t;const n=D(e)&&D(t);if(!(n||M(e)&&M(t)))return t;const i=(n?e:Object.keys(e)).length,s=n?t:Object.keys(t),o=s.length,a=n?new Array(o):{};let c=0;for(let l=0;l<o;l++){const o=n?l:s[l],u=e[o],h=t[o];if(u===h){a[o]=u,(n?l<i:x.call(e,o))&&c++;continue}if(null===u||null===h||"object"!=typeof u||"object"!=typeof h){a[o]=h;continue}const d=F(u,h,r+1);a[o]=d,d===u&&c++}return i===o&&c===i?e:a}function P(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function D(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function M(e){if(!q(e))return!1;const t=e.constructor;if(void 0===t)return!0;const r=t.prototype;return!!q(r)&&!!r.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(e)===Object.prototype}function q(e){return"[object Object]"===Object.prototype.toString.call(e)}function U(e,t,r){return"function"==typeof r.structuralSharing?r.structuralSharing(e,t):!1!==r.structuralSharing?F(e,t):t}function Q(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function L(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var j=/* @__PURE__ */Symbol();function _(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:e.queryFn&&e.queryFn!==j?e.queryFn:()=>Promise.reject(/* @__PURE__ */new Error(`Missing queryFn: '${e.queryHash}'`))}function z(e,t){return"function"==typeof e?e(...t):!!e}var N=/* @__PURE__ */(()=>{let e=()=>v;return{isServer:()=>e(),setIsServer(t){e=t}}})();function $(){let e,t;const r=new Promise((r,n)=>{e=r,t=n});function n(e){Object.assign(r,e),delete r.resolve,delete r.reject}return r.status="pending",r.catch(()=>{}),r.resolve=t=>{n({status:"fulfilled",value:t}),e(t)},r.reject=e=>{n({status:"rejected",reason:e}),t(e)},r}var H=function(e){setTimeout(e,0)},V=function(){let e=[],t=0,r=e=>{e()},n=e=>{e()},i=H;const s=n=>{t?e.push(n):i(()=>{r(n)})};return{batch:s=>{let o;t++;try{o=s()}finally{t--,t||(()=>{const t=e;e=[],t.length&&i(()=>{n(()=>{t.forEach(e=>{r(e)})})})})()}return o},batchCalls:e=>(...t)=>{s(()=>{e(...t)})},schedule:s,setNotifyFunction:e=>{r=e},setBatchNotifyFunction:e=>{n=e},setScheduler:e=>{i=e}}}(),W=new class extends p{#s=!0;#t;#r;constructor(){super(),this.#r=e=>{if("undefined"!=typeof window&&window.addEventListener){const t=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}}}onSubscribe(){this.#t||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#r=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#s!==e&&(this.#s=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#s}};function G(e){return Math.min(1e3*2**e,3e4)}function Z(e){return"online"!==(e??"online")||W.isOnline()}var B=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function K(e){let t,r=!1,n=0;const i=$(),s=()=>"pending"!==i.status,o=()=>m.isFocused()&&("always"===e.networkMode||W.isOnline())&&e.canRun(),a=()=>Z(e.networkMode)&&e.canRun(),c=e=>{s()||(t?.(),i.resolve(e))},l=e=>{s()||(t?.(),i.reject(e))},u=()=>new Promise(r=>{t=e=>{(s()||o())&&r(e)},e.onPause?.()}).then(()=>{t=void 0,s()||e.onContinue?.()}),h=()=>{if(s())return;let t;const i=0===n?e.initialPromise:void 0;try{t=i??e.fn()}catch(a){t=Promise.reject(a)}Promise.resolve(t).then(c).catch(t=>{if(s())return;const i=e.retry??(N.isServer()?0:3),a=e.retryDelay??G,c="function"==typeof a?a(n,t):a,d=!0===i||"number"==typeof i&&n<i||"function"==typeof i&&i(n,t);var f;!r&&d?(n++,e.onFail?.(n,t),(f=c,new Promise(e=>{y.setTimeout(e,f)})).then(()=>o()?void 0:u()).then(()=>{r?l(t):h()})):l(t)})};return{promise:i,status:()=>i.status,cancel:t=>{if(!s()){const r=new B(t);l(r),e.onCancel?.(r)}},continue:()=>(t?.(),i),cancelRetry:()=>{r=!0},continueRetry:()=>{r=!1},canStart:a,start:()=>(a()?h():u().then(h),i)}}var J=class{#o;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),S(this.gcTime)&&(this.#o=y.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(N.isServer()?1/0:3e5))}clearGcTimeout(){void 0!==this.#o&&(y.clearTimeout(this.#o),this.#o=void 0)}};function Y(e){return{onFetch:(t,r)=>{const n=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,s=t.state.data?.pages||[],o=t.state.data?.pageParams||[];let a={pages:[],pageParams:[]},c=0;const l=async()=>{let r=!1;const l=e=>{!function(e,r,n){let i,s=!1;Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t.signal,s||(s=!0,i.aborted?n():i.addEventListener("abort",n,{once:!0})),i)})}(e,0,()=>r=!0)},u=_(t.options,t.fetchOptions),h=async(e,n,i)=>{if(r)return Promise.reject(t.signal.reason);if(null==n&&e.pages.length)return Promise.resolve(e);const s=(()=>{const e={client:t.client,queryKey:t.queryKey,pageParam:n,direction:i?"backward":"forward",meta:t.options.meta};return l(e),e})(),o=await u(s),{maxPages:a}=t.options,c=i?L:Q;return{pages:c(e.pages,o,a),pageParams:c(e.pageParams,n,a)}};if(i&&s.length){const e="backward"===i,t=e?ee:X,r={pages:s,pageParams:o};a=await h(r,t(n,r),e)}else{const t=e??s.length;do{const e=0===c?o[0]??n.initialPageParam:X(n,a);if(c>0&&null==e)break;a=await h(a,e),c++}while(c<t)}return a};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=l}}}function X(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function ee(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}function te(e,t){return!!t&&null!=X(e,t)}function re(e,t){return!(!t||!e.getPreviousPageParam)&&null!=ee(e,t)}var ne=class extends J{#a;#c;#l;#u;#h;#d;#f;#p;constructor(e){super(),this.#p=!1,this.#f=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#h=e.client,this.#u=this.#h.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#c=oe(this.options),this.state=e.state??this.#c,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#a}get promise(){return this.#d?.promise}setOptions(e){if(this.options={...this.#f,...e},e?._type&&(this.#a=e._type),this.updateGcTime(this.options.gcTime),this.state&&void 0===this.state.data){const e=oe(this.options);void 0!==e.data&&(this.setState(se(e.data,e.dataUpdatedAt)),this.#c=e)}}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#u.remove(this)}setData(e,t){const r=U(this.state.data,e,this.options);return this.#m({data:r,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),r}setState(e){this.#m({type:"setState",state:e})}cancel(e){const t=this.#d?.promise;return this.#d?.cancel(e),t?t.then(w).catch(w):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#c}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>!1!==O(e.options.enabled,this))}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===j||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>"static"===I(e.options.staleTime,this))}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):void 0===this.state.data||this.state.isInvalidated}isStaleByTime(e=0){return void 0===this.state.data||"static"!==e&&(!!this.state.isInvalidated||!R(this.state.dataUpdatedAt,e))}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#d?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#d?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#u.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#d&&(this.#p||this.#g()?this.#d.cancel({revert:!0}):this.#d.cancelRetry()),this.scheduleGc()),this.#u.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}#g(){return"paused"===this.state.fetchStatus&&"pending"===this.state.status}invalidate(){this.state.isInvalidated||this.#m({type:"invalidate"})}async fetch(e,t){if("idle"!==this.state.fetchStatus&&"rejected"!==this.#d?.status())if(void 0!==this.state.data&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#d)return this.#d.continueRetry(),this.#d.promise;if(e&&this.setOptions(e),!this.options.queryFn){const e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}const r=new AbortController,n=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#p=!0,r.signal)})},i=()=>{const e=_(this.options,t),r=(()=>{const e={client:this.#h,queryKey:this.queryKey,meta:this.meta};return n(e),e})();return this.#p=!1,this.options.persister?this.options.persister(e,r,this):e(r)},s=(()=>{const e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#h,state:this.state,fetchFn:i};return n(e),e})();("infinite"===this.#a?Y(this.options.pages):this.options.behavior)?.onFetch(s,this),this.#l=this.state,"idle"!==this.state.fetchStatus&&this.state.fetchMeta===s.fetchOptions?.meta||this.#m({type:"fetch",meta:s.fetchOptions?.meta}),this.#d=K({initialPromise:t?.initialPromise,fn:s.fetchFn,onCancel:e=>{e instanceof B&&e.revert&&this.setState({...this.#l,fetchStatus:"idle"}),r.abort()},onFail:(e,t)=>{this.#m({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#m({type:"pause"})},onContinue:()=>{this.#m({type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0});try{const e=await this.#d.start();if(void 0===e)throw new Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#u.config.onSuccess?.(e,this),this.#u.config.onSettled?.(e,this.state.error,this),e}catch(o){if(o instanceof B){if(o.silent)return this.#d.promise;if(o.revert){if(void 0===this.state.data)throw o;return this.state.data}}throw this.#m({type:"error",error:o}),this.#u.config.onError?.(o,this),this.#u.config.onSettled?.(this.state.data,o,this),o}finally{this.scheduleGc()}}#m(e){this.state=(t=>{switch(e.type){case"failed":return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...t,fetchStatus:"paused"};case"continue":return{...t,fetchStatus:"fetching"};case"fetch":return{...t,...ie(t.data,this.options),fetchMeta:e.meta??null};case"success":const r={...t,...se(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#l=e.manual?r:void 0,r;case"error":const n=e.error;return{...t,error:n,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...e.state}}})(this.state),V.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#u.notify({query:this,type:"updated",action:e})})}};function ie(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Z(t.networkMode)?"fetching":"paused",...void 0===e&&{error:null,status:"pending"}}}function se(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function oe(e){const t="function"==typeof e.initialData?e.initialData():e.initialData,r=void 0!==t,n=r?"function"==typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var ae=class extends p{constructor(e,t){super(),this.options=t,this.#h=e,this.#y=null,this.#v=$(),this.bindMethods(),this.setOptions(t)}#h;#w=void 0;#b=void 0;#S=void 0;#R;#I;#v;#y;#O;#T;#C;#k;#E;#A;#x=/* @__PURE__ */new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#w.addObserver(this),ce(this.#w,this.options)?this.#F():this.updateResult(),this.#P())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return le(this.#w,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return le(this.#w,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=/* @__PURE__ */new Set,this.#D(),this.#M(),this.#w.removeObserver(this)}setOptions(e){const t=this.options,r=this.#w;if(this.options=this.#h.defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof O(this.options.enabled,this.#w))throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#q(),this.#w.setOptions(this.options),t._defaulted&&!P(this.options,t)&&this.#h.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#w,observer:this});const n=this.hasListeners();n&&ue(this.#w,r,this.options,t)&&this.#F(),this.updateResult(),!n||this.#w===r&&O(this.options.enabled,this.#w)===O(t.enabled,this.#w)&&I(this.options.staleTime,this.#w)===I(t.staleTime,this.#w)||this.#U();const i=this.#Q();!n||this.#w===r&&O(this.options.enabled,this.#w)===O(t.enabled,this.#w)&&i===this.#A||this.#L(i)}getOptimisticResult(e){const t=this.#h.getQueryCache().build(this.#h,e),r=this.createResult(t,e);var n;return n=r,P(this.getCurrentResult(),n)||(this.#S=r,this.#I=this.options,this.#R=this.#w.state),r}getCurrentResult(){return this.#S}trackResult(e,t){return new Proxy(e,{get:(e,r)=>(this.trackProp(r),t?.(r),"promise"===r&&(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==this.#v.status||this.#v.reject(/* @__PURE__ */new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(e,r))})}trackProp(e){this.#x.add(e)}getCurrentQuery(){return this.#w}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#h.defaultQueryOptions(e),r=this.#h.getQueryCache().build(this.#h,t);return r.fetch().then(()=>this.createResult(r,t))}fetch(e){return this.#F({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#S))}#F(e){this.#q();let t=this.#w.fetch(this.options,e);return e?.throwOnError||(t=t.catch(w)),t}#U(){this.#D();const e=I(this.options.staleTime,this.#w);if(N.isServer()||this.#S.isStale||!S(e))return;const t=R(this.#S.dataUpdatedAt,e)+1;this.#k=y.setTimeout(()=>{this.#S.isStale||this.updateResult()},t)}#Q(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#w):this.options.refetchInterval)??!1}#L(e){this.#M(),this.#A=e,!N.isServer()&&!1!==O(this.options.enabled,this.#w)&&S(this.#A)&&0!==this.#A&&(this.#E=y.setInterval(()=>{(this.options.refetchIntervalInBackground||m.isFocused())&&this.#F()},this.#A))}#P(){this.#U(),this.#L(this.#Q())}#D(){void 0!==this.#k&&(y.clearTimeout(this.#k),this.#k=void 0)}#M(){void 0!==this.#E&&(y.clearInterval(this.#E),this.#E=void 0)}createResult(e,t){const r=this.#w,n=this.options,i=this.#S,s=this.#R,o=this.#I,a=e!==r?e.state:this.#b,{state:c}=e;let l,u={...c},h=!1;if(t._optimisticResults){const i=this.hasListeners(),s=!i&&ce(e,t),o=i&&ue(e,r,t,n);(s||o)&&(u={...u,...ie(c.data,e.options)}),"isRestoring"===t._optimisticResults&&(u.fetchStatus="idle")}let{error:d,errorUpdatedAt:f,status:p}=u;l=u.data;let m=!1;if(void 0!==t.placeholderData&&void 0===l&&"pending"===p){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,m=!0):e="function"==typeof t.placeholderData?t.placeholderData(this.#C?.state.data,this.#C):t.placeholderData,void 0!==e&&(p="success",l=U(i?.data,e,t),h=!0)}if(t.select&&void 0!==l&&!m)if(i&&l===s?.data&&t.select===this.#O)l=this.#T;else try{this.#O=t.select,l=t.select(l),l=U(i?.data,l,t),this.#T=l,this.#y=null}catch(R){this.#y=R}this.#y&&(d=this.#y,l=this.#T,f=Date.now(),p="error");const g="fetching"===u.fetchStatus,y="pending"===p,v="error"===p,w=y&&g,b=void 0!==l,S={status:p,fetchStatus:u.fetchStatus,isPending:y,isSuccess:"success"===p,isError:v,isInitialLoading:w,isLoading:w,data:l,dataUpdatedAt:u.dataUpdatedAt,error:d,errorUpdatedAt:f,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:u.dataUpdateCount>a.dataUpdateCount||u.errorUpdateCount>a.errorUpdateCount,isFetching:g,isRefetching:g&&!y,isLoadingError:v&&!b,isPaused:"paused"===u.fetchStatus,isPlaceholderData:h,isRefetchError:v&&b,isStale:he(e,t),refetch:this.refetch,promise:this.#v,isEnabled:!1!==O(t.enabled,e)};if(this.options.experimental_prefetchInRender){const t=void 0!==S.data,n="error"===S.status&&!t,i=e=>{n?e.reject(S.error):t&&e.resolve(S.data)},s=()=>{const e=this.#v=S.promise=$();i(e)},o=this.#v;switch(o.status){case"pending":e.queryHash===r.queryHash&&i(o);break;case"fulfilled":(n||S.data!==o.value)&&s();break;case"rejected":n&&S.error===o.reason||s()}}return S}updateResult(){const e=this.#S,t=this.createResult(this.#w,this.options);this.#R=this.#w.state,this.#I=this.options,void 0!==this.#R.data&&(this.#C=this.#w),P(t,e)||(this.#S=t,this.#j({listeners:(()=>{if(!e)return!0;const{notifyOnChangeProps:t}=this.options,r="function"==typeof t?t():t;if("all"===r||!r&&!this.#x.size)return!0;const n=new Set(r??this.#x);return this.options.throwOnError&&n.add("error"),Object.keys(this.#S).some(t=>{const r=t;return this.#S[r]!==e[r]&&n.has(r)})})()}))}#q(){const e=this.#h.getQueryCache().build(this.#h,this.options);if(e===this.#w)return;const t=this.#w;this.#w=e,this.#b=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#P()}#j(e){V.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#S)}),this.#h.getQueryCache().notify({query:this.#w,type:"observerResultsUpdated"})})}};function ce(e,t){return function(e,t){return!1!==O(t.enabled,e)&&void 0===e.state.data&&!("error"===e.state.status&&!1===O(t.retryOnMount,e))}(e,t)||void 0!==e.state.data&&le(e,t,t.refetchOnMount)}function le(e,t,r){if(!1!==O(t.enabled,e)&&"static"!==I(t.staleTime,e)){const n="function"==typeof r?r(e):r;return"always"===n||!1!==n&&he(e,t)}return!1}function ue(e,t,r,n){return(e!==t||!1===O(n.enabled,e))&&(!r.suspense||"error"!==e.state.status)&&he(e,r)}function he(e,t){return!1!==O(t.enabled,e)&&e.isStaleByTime(I(t.staleTime,e))}var de=e(void 0),fe=e=>{const t=c(de);if(e)return e;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},pe=({client:e,children:r})=>(t(()=>(e.mount(),()=>{e.unmount()}),[e]),/* @__PURE__ */o(de.Provider,{value:e,children:r})),me=e(!1);me.Provider;var ge=e(function(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}()),ye=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function ve(e,n,s){const o=c(me),l=c(ge),u=fe(s),h=u.defaultQueryOptions(e);u.getDefaultOptions().queries?._experimental_beforeQuery?.(h);const d=u.getQueryCache().get(h.queryHash),f=!1!==e.subscribed;h._optimisticResults=o?"isRestoring":f?"optimistic":void 0,(e=>{if(e.suspense){const t=1e3,r=e=>"static"===e?e:Math.max(e??t,t),n=e.staleTime;e.staleTime="function"==typeof n?(...e)=>r(n(...e)):r(n),"number"==typeof e.gcTime&&(e.gcTime=Math.max(e.gcTime,t))}})(h),((e,t,r)=>{const n=r?.state.error&&"function"==typeof e.throwOnError?z(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||n)&&(t.isReset()||(e.retryOnMount=!1))})(h,l,d),(e=>{t(()=>{e.clearReset()},[e])})(l);const p=!u.getQueryCache().get(h.queryHash),[m]=r(()=>new n(u,h)),g=m.getOptimisticResult(h),y=!o&&f;if(i(a(e=>{const t=y?m.subscribe(V.batchCalls(e)):w;return m.updateResult(),t},[m,y]),()=>m.getCurrentResult(),()=>m.getCurrentResult()),t(()=>{m.setOptions(h)},[h,m]),((e,t)=>e?.suspense&&t.isPending)(h,g))throw ye(h,m,l);if((({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(i&&void 0===e.data||z(r,[e.error,n])))({result:g,errorResetBoundary:l,throwOnError:h.throwOnError,query:d,suspense:h.suspense}))throw g.error;return u.getDefaultOptions().queries?._experimental_afterQuery?.(h,g),h.experimental_prefetchInRender&&!N.isServer()&&((e,t)=>e.isLoading&&e.isFetching&&!t)(g,o)&&(p?ye(h,m,l):d?.promise)?.catch(w).finally(()=>{m.updateResult()}),h.notifyOnChangeProps?g:m.trackResult(g)}function we(e,t){return ve(e,ae,t)}var be=null;function Se(e){be=e}function Re(e){try{const t=JSON.stringify(e);fetch(f.REPORT_ERROR,{method:"POST",headers:{"Content-Type":"application/json",...be?{"x-org-id":be}:{}},body:t,keepalive:!0}).catch(()=>{})}catch{}}function Ie(e,t){Re({message:e instanceof Error?e.message:String(e),stack:e instanceof Error?e.stack:void 0,level:t?.level??"error",component:t?.component,tags:t?.tags,context:t?.extra,url:"undefined"!=typeof window?window.location.href:void 0,userAgent:"undefined"!=typeof navigator?navigator.userAgent:void 0})}function Oe(e,t="info",r){Re({message:e,level:t,component:r?.component,tags:r?.tags,context:r?.extra,url:"undefined"!=typeof window?window.location.href:void 0,userAgent:"undefined"!=typeof navigator?navigator.userAgent:void 0})}function Te({title:e,children:t}){/* @__PURE__ */
2
2
  return o("div",{className:"mx-auto mt-24 w-fit max-w-xl space-y-8",children:[/* @__PURE__ */o("svg",{xmlns:"http://www.w3.org/2000/svg",className:"mx-auto h-64 w-fit text-[#ff4800]",width:"800",height:"469.317",viewBox:"0 0 800 469.317",role:"img","aria-label":"Error illustration",children:/* @__PURE__ */o("g",{transform:"translate(-443.142 -257.876)",children:[
3
3
  /* @__PURE__ */o("path",{d:"M898.247,664.1H371.155a30.276,30.276,0,0,1-30.241-30.241V352.525a30.276,30.276,0,0,1,30.241-30.241H898.247a30.276,30.276,0,0,1,30.241,30.241V633.862A30.276,30.276,0,0,1,898.247,664.1Z",transform:"translate(308.867 25.517)",fill:"#fff"}),
4
4
  /* @__PURE__ */o("path",{d:"M557.334,341.82H30.241A30.276,30.276,0,0,1,0,311.578V30.241A30.276,30.276,0,0,1,30.241,0H557.334a30.276,30.276,0,0,1,30.241,30.241V311.578A30.276,30.276,0,0,1,557.334,341.82ZM30.241,1.833A28.441,28.441,0,0,0,1.833,30.241V311.578a28.441,28.441,0,0,0,28.409,28.409H557.334a28.441,28.441,0,0,0,28.409-28.409V30.241A28.441,28.441,0,0,0,557.334,1.833Z",transform:"matrix(0.999, -0.035, 0.035, 0.999, 643.995, 358.158)",fill:"#d6d6e3"}),
@@ -26,7 +26,7 @@ return o("div",{className:"mx-auto mt-24 w-fit max-w-xl space-y-8",children:[/*
26
26
  /* @__PURE__ */o("ellipse",{cx:"78.271",cy:"97.971",rx:"78.271",ry:"97.971",transform:"translate(0 127.808)",fill:"#e6e6e6"}),
27
27
  /* @__PURE__ */o("path",{d:"M513.962,637.661h0a1.936,1.936,0,0,0-2.614-.811l-7.837,4.126-2.684-153.9h-.215l-4.085,221.91H504.7l-1.111-63.68,9.565-5.036A1.936,1.936,0,0,0,513.962,637.661Z",transform:"translate(-422.126 -281.002)",fill:"#ccc"}),
28
28
  /* @__PURE__ */o("path",{d:"M612.666,280.653c54.774,0,99.294,103.207,99.294,171.768s-44.4,124.14-99.177,124.14-99.177-55.579-99.177-124.14S557.892,280.653,612.666,280.653Z",transform:"translate(-422.155 -280.653)",fill:"currentColor"}),
29
- /* @__PURE__ */o("path",{d:"M630.131,617.508a2.452,2.452,0,0,0-3.312-1.027l-9.931,5.228-3.4-195h-.272L608.039,707.89h10.353l-1.408-80.69,12.119-6.38A2.452,2.452,0,0,0,630.131,617.508Z",transform:"translate(-422.315 -280.9)",fill:"#3f3d56"})]})]})}),/* @__PURE__ */o("div",{className:"space-y-4",children:[/* @__PURE__ */o("h4",{className:"text-foreground text-center text-lg font-semibold",children:e}),/* @__PURE__ */o("p",{className:"text-muted-foreground text-center",children:t})]})]})}var Ce=({organizationId:e})=>/* @__PURE__ */o("a",{className:"font-medium text-blue-500",href:d.ORGANIZATION_SETTINGS_INTEGRATION(e),target:"_blank",rel:"noreferrer",children:"Guide"});function Ee({organizationId:e,errorType:t,errorMessage:r}){/* @__PURE__ */
29
+ /* @__PURE__ */o("path",{d:"M630.131,617.508a2.452,2.452,0,0,0-3.312-1.027l-9.931,5.228-3.4-195h-.272L608.039,707.89h10.353l-1.408-80.69,12.119-6.38A2.452,2.452,0,0,0,630.131,617.508Z",transform:"translate(-422.315 -280.9)",fill:"#3f3d56"})]})]})}),/* @__PURE__ */o("div",{className:"space-y-4",children:[/* @__PURE__ */o("h4",{className:"text-foreground text-center text-lg font-semibold",children:e}),/* @__PURE__ */o("p",{className:"text-muted-foreground text-center",children:t})]})]})}var Ce=({organizationId:e})=>/* @__PURE__ */o("a",{className:"font-medium text-blue-500",href:d.ORGANIZATION_SETTINGS_INTEGRATION(e),target:"_blank",rel:"noreferrer",children:"Guide"});function ke({organizationId:e,errorType:t,errorMessage:r}){/* @__PURE__ */
30
30
  return o(Te,"custom-auth-invalid"===t?{title:"Setup needed",children:["Custom auth is enabled. Pass ",
31
31
  /* @__PURE__ */o("code",{children:"uid"}),", ",
32
32
  /* @__PURE__ */o("code",{children:"fname"}),", and ",
@@ -36,6 +36,6 @@ return o(Te,"custom-auth-invalid"===t?{title:"Setup needed",children:["Custom au
36
36
  /* @__PURE__ */o(Ce,{organizationId:e})," for details."]}:"page-not-registered"===t?{title:"Page not registered",children:["Add the current page URL in Allowed URLs under"," ",
37
37
  /* @__PURE__ */o("a",{className:"font-medium text-blue-500",href:d.ORGANIZATION_SETTINGS(e),target:"_blank",rel:"noreferrer",children:"Organization Settings"})," ","⇨ Integration Settings. See our ",
38
38
  /* @__PURE__ */o(Ce,{organizationId:e})," for details."]}:{title:"Heads up",children:["Something needs attention. See our ",
39
- /* @__PURE__ */o(Ce,{organizationId:e})," for details or contact Qrati support."]})}var ke='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',Ae=e=>e.trim().replace(/\s+/g," "),xe=e=>e?.replace(/\/+$/,"")||"",Fe=e=>{if(!e)return ke;const t=Ae("string"==typeof e?e:e.fontFamily||""),r="string"==typeof e?void 0:e.customFontName;return t&&"system"!==t?"custom"===t?`"${r||"QratiCustomFont"}", ${ke}`:`"${t}", ${ke}`:"inherit"};function Pe(e){var t,r,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=Pe(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function De(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=Pe(e))&&(n&&(n+=" "),n+=t);return n}var Me=(...e)=>De(e.filter(Boolean)),qe=e=>{const t=e.replace(/#/g,"");return(299*parseInt(t.slice(0,2),16)+587*parseInt(t.slice(2,4),16)+114*parseInt(t.slice(4,6),16))/1e3>=128?"#000000":"#FFFFFF"},Ue="px",Qe=(e,t="light")=>{const r=e?.themeSettings?.colors??{},n=e?.themeSettings?.border,i=e?.themeSettings?.shadow,s=e?.integrationSettings,o="dark"===t,a=(e,t,n,i)=>{const s=o?i:n;return r[o?t:e]||s},c=a("primaryLight","primaryDark","#ff4800","#ff4800");return{"--background":a("backgroundLight","backgroundDark","#fafafa","#0a0a0a"),"--foreground":a("foregroundLight","foregroundDark","#252629","#f5f5f5"),"--muted":a("mutedLight","mutedDark","#e5e5e5","#171717"),"--muted-foreground":a("mutedForegroundLight","mutedForegroundDark","#484848","#b5b8bb"),"--border":a("borderLight","borderDark","#dddddd","#353538"),"--input":a("inputLight","inputDark","#f5f5f5","#171717"),"--primary":c,"--primary-foreground":qe(c),"--popover":a("popoverLight","popoverDark","#f5f5f5","#171717"),"--popover-foreground":a("popoverForegroundLight","popoverForegroundDark","#252629","#fafafa"),"--info":a("infoLight","infoDark","#2563eb","#5b8def"),"--warning":a("warningLight","warningDark","#f59e0b","#fbbf24"),"--success":a("successLight","successDark","#10b981","#34d399"),"--destructive":a("destructiveLight","destructiveDark","#ef4444","#f87171"),"--border-width":`${n?.width??"1"}${n?.unit??"px"}`,"--radius":`${n?.radius??"10"}${n?.unit??"px"}`,"--shadow-outer-horizontal-offset":`${i?.outerHorizontalOffset??"0"}${i?.unit??Ue}`,"--shadow-outer-vertical-offset":`${i?.outerVerticalOffset??"0"}${i?.unit??Ue}`,"--shadow-outer-blur":`${i?.outerBlur??"0"}${i?.unit??Ue}`,"--shadow-outer-spread":`${i?.outerSpread??"0"}${i?.unit??Ue}`,...s?.fontFamily&&"system"!==s.fontFamily?{"--font-family":Fe(s)}:{}}},Le=async e=>{try{return await e()}catch{return null}},je=(e,t=1)=>{const r=(new TextEncoder).encode(e),n=3432918353,i=461845907;let s=t>>>0;const o=Math.floor(r.length/4),a=new DataView(r.buffer,r.byteOffset,r.byteLength);for(let h=0;h<o;h++){let e=a.getUint32(4*h,!0);e=Math.imul(e,n),e=e<<15|e>>>17,e=Math.imul(e,i),s^=e,s=s<<13|s>>>19,s=Math.imul(s,5)+3864292196>>>0}let c=0;const l=4*o,u=3&r.length;return 3===u&&(c^=r[l+2]<<16),u>=2&&(c^=r[l+1]<<8),u>=1&&(c^=r[l],c=Math.imul(c,n),c=c<<15|c>>>17,c=Math.imul(c,i),s^=c),s^=r.length,s^=s>>>16,s=Math.imul(s,2246822507)>>>0,s^=s>>>13,s=Math.imul(s,3266489909)>>>0,s^=s>>>16,s.toString(16).padStart(8,"0")},_e=e=>{if(null===e||"object"!=typeof e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(_e).join(",")}]`;const t=Object.keys(e).sort(),r=[];for(const n of t){const t=e[n];void 0!==t&&r.push(`${_e(n)}:${_e(t)}`)}return`{${r.join(",")}}`},ze=async({debug:e=!1}={})=>{const t=performance.now(),r=await Le(async()=>{if(!window.navigator.userAgentData||"function"!=typeof window.navigator.userAgentData.getHighEntropyValues)return null;const e=await window.navigator.userAgentData.getHighEntropyValues(["architecture","bitness","platformVersion","model","fullVersionList"]);return _e(e)}),n=await Le(()=>(()=>{const e=document.createElement("video"),t=["video/webm","video/mp4","video/ogg","audio/mp4","audio/webm","audio/ogg","audio/mpeg"],r={};for(const n of t){const t=e.canPlayType(n);r[n]=""===t?"no":t}return _e(r)})()),i=await Le(()=>(()=>{const e=["monospace","serif","sans-serif"],t=["Arial","Helvetica","Verdana","Trebuchet MS","Comic Sans MS","Georgia","Times New Roman","Courier New","Segoe UI","Roboto","Open Sans","Noto Sans","system-ui","-apple-system","BlinkMacSystemFont"],r=document.createElement("span");r.style.fontSize="72px",r.style.position="absolute",r.style.visibility="hidden",r.style.whiteSpace="nowrap",r.textContent="mmmmmmmmmwwwwwww",document.body.appendChild(r);const n={};for(const s of e)r.style.fontFamily=s,n[s]=r.offsetWidth;const i=[];for(const s of t){let t=!1;for(const o of e)if(r.style.fontFamily=`"${s}", ${o}`,r.offsetWidth!==n[o]){i.push(s),t=!0;break}t||(r.style.fontFamily=`"${s}"`,r.offsetWidth!==n.monospace&&r.offsetWidth!==n.serif&&i.push(s))}return document.body.removeChild(r),i.length?i.sort().join(","):null})()),s=await Le(()=>new Intl.NumberFormat(window.navigator.languages?.[0]||"en").resolvedOptions().numberingSystem),o=window.navigator.languages?Array.from(window.navigator.languages).join(","):window.navigator.language||null,a=Intl.DateTimeFormat().resolvedOptions(),c=a.timeZone,l=/* @__PURE__ */(new Date).getTimezoneOffset(),u=a.calendar||null,h=void 0!==a.hour12?a.hour12?"h12":"h23":a.hourCycle||null,d=window.matchMedia("(prefers-reduced-motion: reduce)").matches?"reduce":"no-preference",f=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",p=window.matchMedia("(prefers-contrast: more)").matches?"more":window.matchMedia("(prefers-contrast: less)").matches?"less":window.matchMedia("(prefers-contrast: custom)").matches?"custom":"no-preference",m=window.matchMedia("(prefers-reduced-transparency: reduce)").matches?"reduce":"no-preference",g=window.matchMedia("(forced-colors: active)").matches?"active":null,y="number"==typeof window.devicePixelRatio?Math.round(100*window.devicePixelRatio)/100:null,{pixelDepth:v,colorDepth:w}=window.screen,b="ontouchstart"in window||window.navigator.maxTouchPoints>0,S=await Le(()=>(async e=>{const t=document.createElement("canvas");t.width=280,t.height=100;const r=t.getContext("2d"),n=r.createLinearGradient(0,0,280,100);n.addColorStop(0,"#f60"),n.addColorStop(.4,"#09f"),n.addColorStop(.7,"#f09"),n.addColorStop(1,"#0f9"),r.fillStyle=n,r.fillRect(0,0,280,100),r.font='18px "Arial","Helvetica","DejaVu Sans",sans-serif',r.fillStyle="#000",r.textBaseline="alphabetic",r.fillText("Fingerprint ¼½¾™©®∆π∑€¶§",12,45),r.font='bold 22px "Georgia","Times New Roman",serif',r.fillStyle="#222",r.fillText("🦊🐱🚀 2026",12,78),r.globalAlpha=.7,r.fillStyle="rgba(255, 80, 0, 0.35)",r.fillRect(180,20,80,60),r.beginPath(),r.arc(220,50,32,0,2*Math.PI),r.strokeStyle="#fff",r.lineWidth=4,r.stroke(),r.beginPath(),r.moveTo(30,85),r.quadraticCurveTo(140,20,240,85),r.strokeStyle="#00f",r.lineWidth=3,r.stroke(),e&&(t.style.border="1px solid #444",document.body.appendChild(t));const i=t.toDataURL("image/png");return je(i)})(e)),R=await Le(()=>(async()=>{const e=document.createElement("canvas"),t=e.getContext("webgl")||e.getContext("experimental-webgl"),r=t.getExtension("WEBGL_debug_renderer_info"),n={vendor:r?t.getParameter(r.UNMASKED_VENDOR_WEBGL):t.getParameter(t.VENDOR),renderer:r?t.getParameter(r.UNMASKED_RENDERER_WEBGL):t.getParameter(t.RENDERER)};return je(_e(n))})()),I=await Le(()=>(async e=>{const t=await navigator.gpu.requestAdapter({powerPreference:"high-performance"}),r={vendor:t.info?.vendor??"",architecture:t.info?.architecture??"",description:t.info?.description??"",features:Array.from(t.features).sort(),limits:Array.from(t.limits).sort()};if(e){const e=document.createElement("pre");e.style.margin="10px 0",e.style.padding="10px",e.style.border="1px solid #444",e.style.background="#111",e.style.color="#0f8",e.style.fontFamily="monospace",e.textContent=`WebGPU:\n${JSON.stringify(r,null,2)}`,document.body.appendChild(e)}return je(_e(r))})(e)),O=await Le(()=>(async e=>{const t=new(window.OfflineAudioContext||window.webkitOfflineAudioContext)(1,6e3,44100),r=t.createOscillator();r.type="sawtooth",r.frequency.value=8800;const n=t.createDynamicsCompressor();n.threshold.value=-48,n.knee.value=30,n.ratio.value=14,n.attack.value=0,n.release.value=.3;const i=t.createGain();i.gain.value=.4,r.connect(n),n.connect(i),i.connect(t.destination),r.start(0);const s=(await t.startRendering()).getChannelData(0);let o=0,a=0;for(let l=3e3;l<5800;l+=2){const e=s[l];o=31*o+Math.floor(1e5*(e+1))|0,a=Math.imul(a^Math.floor(98765*e),2246822519)}const c=o>>>0^a>>>0;if(e){const e=document.createElement("canvas");e.width=500,e.height=120,e.style.border="1px solid #444",e.style.margin="10px 0",e.title="Audio buffer snippet (4500–5000 samples)";const t=e.getContext("2d");t.fillStyle="#111",t.fillRect(0,0,e.width,e.height),t.font="14px monospace",t.fillStyle="#0f8",t.textAlign="left",t.fillText("AudioID",10,20),t.strokeStyle="#0f8",t.lineWidth=1.5,t.beginPath();const r=Array.from(s.slice(4500,5e3)),n=e.width/r.length;for(let i=0;i<r.length;i++){const s=i*n,o=(r[i]+1)/2*e.height;0===i?t.moveTo(s,o):t.lineTo(s,o)}t.stroke(),document.body.appendChild(e)}return je(c.toString(16))})(e)),T=window.screen.width&&window.screen.height?(window.screen.width/window.screen.height).toFixed(4):null,C=await Le(()=>window.screen.orientation?.type||null),E=window.navigator.connection||window.navigator.mozConnection||window.navigator.webkitConnection,k=E&&E.type||null,A=E?.effectiveType||null,x=!0===E?.saveData,F="boolean"==typeof window.navigator.pdfViewerEnabled?window.navigator.pdfViewerEnabled:null,P="boolean"==typeof window.navigator.webdriver?window.navigator.webdriver:null,D=await Le(()=>"function"!=typeof Intl.supportedValuesOf?null:Intl.supportedValuesOf("calendar").join(",")),M=await Le(async()=>{if(!window.navigator.permissions||"function"!=typeof window.navigator.permissions.query)return null;const e=["geolocation","notifications"],t={};for(const r of e)try{t[r]=(await window.navigator.permissions.query({name:r})).state}catch{t[r]="unsupported"}return _e(t)}),q={vendor:window.navigator.vendor||null,platform:window.navigator.platform||null,userAgentHighEntropy:r||null,mediaCodecs:n||null,fonts:i,numberingSystem:s,languages:o,timezone:c,timezoneOffset:l,intlCalendar:u,hourCycle:h,reducedMotion:d,colorScheme:f,prefersContrast:p,prefersReducedTransparency:m,pdfViewerEnabled:F,webdriver:P,intlSupportedCalendars:D||null,permissionsState:M||null,hardwareConcurrency:window.navigator.hardwareConcurrency||null,deviceMemory:window.navigator.deviceMemory||null,forcedColors:g,devicePixelRatio:y,pixelDepth:v,colorDepth:w,touchSupport:b,screenOrientation:C||null,connectionType:k,effectiveType:A,saveData:x,canvasID:S,webglID:R,webgpuID:I,audioID:O},U={aspectRatio:T,width:window.screen.width,height:window.screen.height,maxTouchPoints:window.navigator.maxTouchPoints};(!0===navigator.userAgentData?.mobile||/Mobi|Android|iPhone|iPad|iPod|webOS|BlackBerry|Windows Phone/i.test(navigator.userAgent)||navigator.maxTouchPoints>0&&matchMedia("(pointer:coarse)").matches&&innerWidth<=1024)&&Object.assign(q,U);const Q=_e(q),L=je(Q),j=Math.round(performance.now()-t);return{fingerprint:L,...q,elapsedMs:j}};"undefined"!=typeof window&&(window.getBrowserFingerprint=ze);var Ne=e=>e?`qrati_token:${e}`:"qrati_token",$e=e=>e?.trim()||void 0,He=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),Ve=async(e,t)=>{if(e instanceof l){try{const t=e.data;if(t?.error)return t.error;if(t?.message)return t.message;if("INVALID_EMAIL_OR_PASSWORD"===t?.code)return"Invalid email or password"}catch{return t||e.message}return t||e.message}return e instanceof Error?t||e.message:t||String(e)},We=e(void 0),Ge=({props:e={},children:i})=>{const{organizationId:c,uid:d,fname:p,lname:m,theme:g="light"}=e,y=fe(),[v,w]=r(null);t(()=>(Se(c??null),()=>Se(null)),[c]);const[b,S]=r(()=>{if("undefined"==typeof window)return null;const e=localStorage.getItem(Ne(c));return e?{token:e}:null}),[R,I]=r(0),{isLoading:O,data:T,error:C}=we({queryKey:[h.QRATI_CONNECT_SESSION,c,d??null,p??null,m??null,R],queryFn:()=>(async({organizationId:e,uid:t,fname:r,lname:n,userToken:i})=>{const s=e.trim();if(!s)throw new Error("Organization ID is required for session initialization");const o=$e(t),a=$e(r),c=$e(n),h=(({userToken:e,uid:t,fname:r,lname:n})=>!e||t||r||n?null:e)({organizationId:s,uid:o,fname:a,lname:c,userToken:i}),d=await(async()=>{const e=await ze();return"string"==typeof e?e:e?.fingerprint})();try{const e=await u.post(f.INITIALIZE_SESSION,{json:{uid:o,fname:a,lname:c,browserFingerprint:d},headers:{"x-org-id":s,...h?{Authorization:`Bearer ${h}`}:{}}}).json();if(!He(e)||!He(e.data))throw new Error("Invalid session initialization response");const t=e.data;if("string"!=typeof t.sessionId||!He(t.organization)||!Array.isArray(t.folders)||void 0!==t.authSession&&null!==t.authSession&&!He(t.authSession)||void 0!==t.orgRole&&null!==t.orgRole&&"string"!=typeof t.orgRole)throw new Error("Invalid session initialization response");return{...t,requestToken:h}}catch(p){if(p instanceof l)try{const e=p.data;p.apiMessage=e?.message||e?.error}catch{}throw p}})({organizationId:c,uid:d,fname:p,lname:m,userToken:b?.token}),enabled:!!c,staleTime:1/0,refetchOnWindowFocus:!1,refetchOnMount:!1,refetchOnReconnect:!1});t(()=>{T&&(({data:e,setUser:t,uid:r,fname:n,lname:i,organizationId:s})=>{const o=(({data:e,uid:t,fname:r,lname:n})=>{const i=e.authSession?.session?.token??e.authSession?.token,s=e.authSession?.user;return s&&i?{kind:"authenticated",sessionUser:s,sessionToken:i}:e.organization?.customAuth&&t&&r?{kind:"custom-auth",fallbackUser:{_id:t,uid:t,name:n?`${r} ${n}`:r,fname:r,lname:n}}:e.requestToken?{kind:"expired",requestToken:e.requestToken}:{kind:"none"}})({data:e,uid:r,fname:n,lname:i});"authenticated"===o.kind?(t(e=>({...e,...o.sessionUser,token:o.sessionToken,tcAccepted:void 0===o.sessionUser.tcAccepted?e?.tcAccepted:o.sessionUser.tcAccepted})),localStorage.setItem(Ne(s),o.sessionToken)):"custom-auth"===o.kind?t(e=>e??o.fallbackUser):"expired"===o.kind&&t(e=>e?.token!==o.requestToken?e:(localStorage.removeItem(Ne(s)),null))})({data:T,setUser:S,uid:d,fname:p,lname:m,organizationId:c})},[T]);const E=n(()=>{const e=T?.organization?.integrationSettings?.fontFamily,t=((e,t)=>{const r=xe("https://qrati.com"),n=t?Ae(t):"";return r&&n?`${r}/api/connect/organization/google-font?family=${encodeURIComponent(n)}`:null})(0,e),r=((e,t)=>{const r=xe("https://qrati.com");return r&&t?`${r}/api/connect/organization/custom-font?organizationId=${encodeURIComponent(t)}`:null})(0,c);return((e,t,r)=>{if(!e?.fontFamily||"system"===e.fontFamily)return"";const n=Ae(e.fontFamily);if("custom"===n&&t){const r=e.customFontName||"QratiCustomFont",n=/\.woff2(\?|$)/i.test(t)?"woff2":/\.ttf(\?|$)/i.test(t)?"truetype":"woff";return`@font-face{font-family:"${i=r,i.replace(/"/g,'\\"')}";src:url("${t}") format("${n}");font-weight:400 700;font-style:normal;font-display:swap;}`}var i;const s=r||(e=>{if(!e)return null;const t=Ae(e);return t&&"system"!==t.toLowerCase()&&"custom"!==t.toLowerCase()?`https://fonts.googleapis.com/css2?family=${t.replace(/\s+/g,"+")}:wght@400;500;600;700&display=swap`:null})(n);return s?`@import url("${s}");`:""})(T?.organization?.integrationSettings,T?.organization?.customFontUrl?r||T.organization.customFontUrl:void 0,t||void 0)},[T?.organization?.integrationSettings,T?.organization?.customFontUrl,c]);t(()=>{const e=`data-qrati-font-${c}`;if(document.head.querySelector(`[${e}]`)?.remove(),E){if(E.startsWith("@import")){const t=E.match(/@import url\("([^"]+)"\)/);if(!t?.[1])return;const r=document.createElement("link");r.rel="stylesheet",r.href=t[1],r.setAttribute(e,""),document.head.appendChild(r)}else{const t=document.createElement("style");t.textContent=E,t.setAttribute(e,""),document.head.appendChild(t)}return()=>{document.head.querySelector(`[${e}]`)?.remove()}}},[E,c]);const k=a(async e=>{S(t=>({...t,...e}))},[]),A=a(async(e,t,r,n)=>{try{const i=await u.post(f.REGISTER,{json:{email:e,password:t,fname:r,lname:n},headers:{"x-org-id":c}}).json();if(i.error)return{error:i.error};const s={...i.user,token:i.token};return S(s),I(e=>e+1),i.token&&localStorage.setItem(Ne(c),i.token),i}catch(C){return{error:await Ve(C,"Registration failed")}}},[c]),x=a(async(e,t)=>{try{const r=await u.post(f.LOGIN,{json:{email:e,password:t},headers:{"x-org-id":c}}).json();if(r.error)return{error:r.error};const n={...r.user,token:r.token};return S(n),I(e=>e+1),r.token&&localStorage.setItem(Ne(c),r.token),r}catch(C){return{error:await Ve(C,"Invalid email or password")}}},[c]),F=a(async e=>{const t=await((e,t,r)=>new Promise((n,i)=>{if(!e)return void i(/* @__PURE__ */new Error("Provider is required"));if(!t)return void i(/* @__PURE__ */new Error("Organization ID is required"));const s=new URL(`${r}/qc-social-auth`);s.searchParams.set("provider",e),s.searchParams.set("organizationId",t),s.searchParams.set("origin",window.location.origin);const o=(window.screen.width-500)/2,a=(window.screen.height-600)/2,c=window.open(s.toString(),"qrati_social_auth",`width=500,height=600,left=${o},top=${a},scrollbars=yes,resizable=yes,status=yes`);if(!c)return void i(/* @__PURE__ */new Error("Failed to open popup window. Please allow popups and try again."));const l=()=>{clearInterval(h),clearTimeout(d),window.removeEventListener("message",u)},u=e=>{try{const t=new URL(r).origin;if(e.origin!==t)return void console.warn("Origin mismatch:",e.origin,"expected:",t)}catch(h){return void console.warn("Could not parse origin for verification")}const{type:s,data:o,error:a,organizationId:u}=e.data||{};if(u===t)switch(s){case"QRATI_SOCIAL_AUTH_SUCCESS":l(),c.close(),n({user:o.user,session:o.session,token:o.token});break;case"QRATI_SOCIAL_AUTH_ERROR":console.error("Authentication error:",a),l(),c.close(),i(new Error(a||"Social authentication failed"));break;case"QRATI_SOCIAL_AUTH_CANCELLED":l(),c.close(),i(/* @__PURE__ */new Error("Authentication was cancelled"))}else console.warn("Organization ID mismatch:",u,"expected:",t)},h=setInterval(()=>{try{c.closed&&(l(),i(/* @__PURE__ */new Error("Authentication was cancelled")))}catch(e){}},1e3);window.addEventListener("message",u);const d=setTimeout(()=>{l(),c.closed||c.close(),i(/* @__PURE__ */new Error("Authentication timeout. Please try again."))},3e5)}))(e,c??"","https://qrati.com");return t?.user&&t?.token&&(S({...t.user,token:t.token}),I(e=>e+1),localStorage.setItem(Ne(c),t.token)),t},[c]),P=a(async()=>F("google"),[F]),D=a(async()=>F("apple"),[F]),M=a(async e=>{try{const t=await u.post(f.SEND_PASSWORD_RESET_CODE,{json:{email:e.toLowerCase()},headers:{"x-org-id":c}}).json();return t.error?{error:t.error}:t}catch(C){return{error:await Ve(C,"Failed to send password reset code")}}},[c]),q=a(async(e,t)=>{try{const r=await u.post(f.VERIFY_PASSWORD_RESET_CODE,{json:{email:e.toLowerCase(),code:t},headers:{"x-org-id":c}}).json();return r.error?{error:r.error}:r}catch(C){return{error:await Ve(C,"Invalid code, please check your email")}}},[c]),U=a(async(e,t)=>{try{const r=await u.post(f.RESET_PASSWORD,{json:{passwordResetCodeId:e,newPassword:t},headers:{"x-org-id":c}}).json();return r.error?{error:r.error}:r}catch(C){return{error:C?.message}}},[c]),Q=a(async()=>{try{const e=await u.post(f.LOGOUT,{headers:{"x-org-id":c,Authorization:`Bearer ${b?.token}`}}).json();return e.error?{error:e.error}:(S(null),localStorage.removeItem(Ne(c)),await y.invalidateQueries({queryKey:[h.QRATI_CONNECT_SESSION]}),e)}catch(C){return{error:C?.message}}},[c,b?.token]),L=n(()=>({props:e,initializing:O,sessionId:T?.sessionId,organization:T?.organization,folders:T?.folders,orgRole:T?.orgRole??null,loadingUser:O,user:b,updateUser:k,registerUsingEmail:A,loginWithGoogle:P,loginWithApple:D,loginUsingEmail:x,sendPasswordResetCode:M,verifyPasswordResetCode:q,resetPassword:U,signout:Q,error:C,portalContainer:v}),[e,O,T,b,k,A,P,D,x,M,q,U,Q,C,v]);if(C){const e=C,t=401===e?.response?.status?"page-not-registered":e?.response?"generic-error":"service-unavailable";/* @__PURE__ */
40
- return o(s,{fallback:null,children:/* @__PURE__ */o(Ee,{organizationId:c??"",errorType:t,errorMessage:"generic-error"===t?e.apiMessage:void 0})})}/* @__PURE__ */
41
- return o(We.Provider,{value:L,children:/* @__PURE__ */o("div",{ref:w,id:"qrati-connect-container",style:{...Qe(T?.organization,g),fontFamily:T?.organization?.integrationSettings?.fontFamily&&"system"!==T.organization.integrationSettings.fontFamily?"var(--font-family)":"inherit"},className:Me("bg-background text-foreground relative min-h-[80vh]"),children:i})})},Ze=()=>{const e=c(We);if(void 0===e)throw new Error("useSession must be used within SessionProvider");return e};export{z as A,E as C,A as D,w as E,m as M,p as N,I as O,k as S,T,J as _,Qe as a,V as b,Oe as c,pe as d,fe as f,re as g,te as h,Me as i,j,P as k,we as l,ne as m,Ze as n,De as o,ae as p,ze as r,Ie as s,Ge as t,ve as u,B as v,C as w,b as x,W as y};
39
+ /* @__PURE__ */o(Ce,{organizationId:e})," for details or contact Qrati support."]})}var Ee='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',Ae=e=>e.trim().replace(/\s+/g," "),xe=e=>e?.replace(/\/+$/,"")||"",Fe=e=>{if(!e)return Ee;const t=Ae("string"==typeof e?e:e.fontFamily||""),r="string"==typeof e?void 0:e.customFontName;return t&&"system"!==t?"custom"===t?`"${r||"QratiCustomFont"}", ${Ee}`:`"${t}", ${Ee}`:"inherit"};function Pe(e){var t,r,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=Pe(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function De(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=Pe(e))&&(n&&(n+=" "),n+=t);return n}var Me=(...e)=>De(e.filter(Boolean)),qe=e=>{const t=e.replace(/#/g,"");return(299*parseInt(t.slice(0,2),16)+587*parseInt(t.slice(2,4),16)+114*parseInt(t.slice(4,6),16))/1e3>=128?"#000000":"#FFFFFF"},Ue="px",Qe=(e,t="light")=>{const r=e?.themeSettings?.colors??{},n=e?.themeSettings?.border,i=e?.themeSettings?.shadow,s=e?.integrationSettings,o="dark"===t,a=(e,t,n,i)=>{const s=o?i:n;return r[o?t:e]||s},c=a("primaryLight","primaryDark","#ff4800","#ff4800");return{"--background":a("backgroundLight","backgroundDark","#fafafa","#0a0a0a"),"--foreground":a("foregroundLight","foregroundDark","#252629","#f5f5f5"),"--muted":a("mutedLight","mutedDark","#e5e5e5","#171717"),"--muted-foreground":a("mutedForegroundLight","mutedForegroundDark","#484848","#b5b8bb"),"--border":a("borderLight","borderDark","#dddddd","#353538"),"--input":a("inputLight","inputDark","#f5f5f5","#171717"),"--primary":c,"--primary-foreground":qe(c),"--popover":a("popoverLight","popoverDark","#f5f5f5","#171717"),"--popover-foreground":a("popoverForegroundLight","popoverForegroundDark","#252629","#fafafa"),"--info":a("infoLight","infoDark","#2563eb","#5b8def"),"--warning":a("warningLight","warningDark","#f59e0b","#fbbf24"),"--success":a("successLight","successDark","#10b981","#34d399"),"--destructive":a("destructiveLight","destructiveDark","#ef4444","#f87171"),"--border-width":`${n?.width??"1"}${n?.unit??"px"}`,"--radius":`${n?.radius??"10"}${n?.unit??"px"}`,"--shadow-outer-horizontal-offset":`${i?.outerHorizontalOffset??"0"}${i?.unit??Ue}`,"--shadow-outer-vertical-offset":`${i?.outerVerticalOffset??"0"}${i?.unit??Ue}`,"--shadow-outer-blur":`${i?.outerBlur??"0"}${i?.unit??Ue}`,"--shadow-outer-spread":`${i?.outerSpread??"0"}${i?.unit??Ue}`,...s?.fontFamily&&"system"!==s.fontFamily?{"--font-family":Fe(s)}:{}}},Le=async e=>{try{return await e()}catch{return null}},je=(e,t=1)=>{const r=(new TextEncoder).encode(e),n=3432918353,i=461845907;let s=t>>>0;const o=Math.floor(r.length/4),a=new DataView(r.buffer,r.byteOffset,r.byteLength);for(let h=0;h<o;h++){let e=a.getUint32(4*h,!0);e=Math.imul(e,n),e=e<<15|e>>>17,e=Math.imul(e,i),s^=e,s=s<<13|s>>>19,s=Math.imul(s,5)+3864292196>>>0}let c=0;const l=4*o,u=3&r.length;return 3===u&&(c^=r[l+2]<<16),u>=2&&(c^=r[l+1]<<8),u>=1&&(c^=r[l],c=Math.imul(c,n),c=c<<15|c>>>17,c=Math.imul(c,i),s^=c),s^=r.length,s^=s>>>16,s=Math.imul(s,2246822507)>>>0,s^=s>>>13,s=Math.imul(s,3266489909)>>>0,s^=s>>>16,s.toString(16).padStart(8,"0")},_e=e=>{if(null===e||"object"!=typeof e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(_e).join(",")}]`;const t=Object.keys(e).sort(),r=[];for(const n of t){const t=e[n];void 0!==t&&r.push(`${_e(n)}:${_e(t)}`)}return`{${r.join(",")}}`},ze=async({debug:e=!1}={})=>{const t=performance.now(),r=await Le(async()=>{if(!window.navigator.userAgentData||"function"!=typeof window.navigator.userAgentData.getHighEntropyValues)return null;const e=await window.navigator.userAgentData.getHighEntropyValues(["architecture","bitness","platformVersion","model","fullVersionList"]);return _e(e)}),n=await Le(()=>(()=>{const e=document.createElement("video"),t=["video/webm","video/mp4","video/ogg","audio/mp4","audio/webm","audio/ogg","audio/mpeg"],r={};for(const n of t){const t=e.canPlayType(n);r[n]=""===t?"no":t}return _e(r)})()),i=await Le(()=>(()=>{const e=["monospace","serif","sans-serif"],t=["Arial","Helvetica","Verdana","Trebuchet MS","Comic Sans MS","Georgia","Times New Roman","Courier New","Segoe UI","Roboto","Open Sans","Noto Sans","system-ui","-apple-system","BlinkMacSystemFont"],r=document.createElement("span");r.style.fontSize="72px",r.style.position="absolute",r.style.visibility="hidden",r.style.whiteSpace="nowrap",r.textContent="mmmmmmmmmwwwwwww",document.body.appendChild(r);const n={};for(const s of e)r.style.fontFamily=s,n[s]=r.offsetWidth;const i=[];for(const s of t){let t=!1;for(const o of e)if(r.style.fontFamily=`"${s}", ${o}`,r.offsetWidth!==n[o]){i.push(s),t=!0;break}t||(r.style.fontFamily=`"${s}"`,r.offsetWidth!==n.monospace&&r.offsetWidth!==n.serif&&i.push(s))}return document.body.removeChild(r),i.length?i.sort().join(","):null})()),s=await Le(()=>new Intl.NumberFormat(window.navigator.languages?.[0]||"en").resolvedOptions().numberingSystem),o=window.navigator.languages?Array.from(window.navigator.languages).join(","):window.navigator.language||null,a=Intl.DateTimeFormat().resolvedOptions(),c=a.timeZone,l=/* @__PURE__ */(new Date).getTimezoneOffset(),u=a.calendar||null,h=void 0!==a.hour12?a.hour12?"h12":"h23":a.hourCycle||null,d=window.matchMedia("(prefers-reduced-motion: reduce)").matches?"reduce":"no-preference",f=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",p=window.matchMedia("(prefers-contrast: more)").matches?"more":window.matchMedia("(prefers-contrast: less)").matches?"less":window.matchMedia("(prefers-contrast: custom)").matches?"custom":"no-preference",m=window.matchMedia("(prefers-reduced-transparency: reduce)").matches?"reduce":"no-preference",g=window.matchMedia("(forced-colors: active)").matches?"active":null,y="number"==typeof window.devicePixelRatio?Math.round(100*window.devicePixelRatio)/100:null,{pixelDepth:v,colorDepth:w}=window.screen,b="ontouchstart"in window||window.navigator.maxTouchPoints>0,S=await Le(()=>(async e=>{const t=document.createElement("canvas");t.width=280,t.height=100;const r=t.getContext("2d"),n=r.createLinearGradient(0,0,280,100);n.addColorStop(0,"#f60"),n.addColorStop(.4,"#09f"),n.addColorStop(.7,"#f09"),n.addColorStop(1,"#0f9"),r.fillStyle=n,r.fillRect(0,0,280,100),r.font='18px "Arial","Helvetica","DejaVu Sans",sans-serif',r.fillStyle="#000",r.textBaseline="alphabetic",r.fillText("Fingerprint ¼½¾™©®∆π∑€¶§",12,45),r.font='bold 22px "Georgia","Times New Roman",serif',r.fillStyle="#222",r.fillText("🦊🐱🚀 2026",12,78),r.globalAlpha=.7,r.fillStyle="rgba(255, 80, 0, 0.35)",r.fillRect(180,20,80,60),r.beginPath(),r.arc(220,50,32,0,2*Math.PI),r.strokeStyle="#fff",r.lineWidth=4,r.stroke(),r.beginPath(),r.moveTo(30,85),r.quadraticCurveTo(140,20,240,85),r.strokeStyle="#00f",r.lineWidth=3,r.stroke(),e&&(t.style.border="1px solid #444",document.body.appendChild(t));const i=t.toDataURL("image/png");return je(i)})(e)),R=await Le(()=>(async()=>{const e=document.createElement("canvas"),t=e.getContext("webgl")||e.getContext("experimental-webgl"),r=t.getExtension("WEBGL_debug_renderer_info"),n={vendor:r?t.getParameter(r.UNMASKED_VENDOR_WEBGL):t.getParameter(t.VENDOR),renderer:r?t.getParameter(r.UNMASKED_RENDERER_WEBGL):t.getParameter(t.RENDERER)};return je(_e(n))})()),I=await Le(()=>(async e=>{const t=await navigator.gpu.requestAdapter({powerPreference:"high-performance"}),r={vendor:t.info?.vendor??"",architecture:t.info?.architecture??"",description:t.info?.description??"",features:Array.from(t.features).sort(),limits:Array.from(t.limits).sort()};if(e){const e=document.createElement("pre");e.style.margin="10px 0",e.style.padding="10px",e.style.border="1px solid #444",e.style.background="#111",e.style.color="#0f8",e.style.fontFamily="monospace",e.textContent=`WebGPU:\n${JSON.stringify(r,null,2)}`,document.body.appendChild(e)}return je(_e(r))})(e)),O=await Le(()=>(async e=>{const t=new(window.OfflineAudioContext||window.webkitOfflineAudioContext)(1,6e3,44100),r=t.createOscillator();r.type="sawtooth",r.frequency.value=8800;const n=t.createDynamicsCompressor();n.threshold.value=-48,n.knee.value=30,n.ratio.value=14,n.attack.value=0,n.release.value=.3;const i=t.createGain();i.gain.value=.4,r.connect(n),n.connect(i),i.connect(t.destination),r.start(0);const s=(await t.startRendering()).getChannelData(0);let o=0,a=0;for(let l=3e3;l<5800;l+=2){const e=s[l];o=31*o+Math.floor(1e5*(e+1))|0,a=Math.imul(a^Math.floor(98765*e),2246822519)}const c=o>>>0^a>>>0;if(e){const e=document.createElement("canvas");e.width=500,e.height=120,e.style.border="1px solid #444",e.style.margin="10px 0",e.title="Audio buffer snippet (4500–5000 samples)";const t=e.getContext("2d");t.fillStyle="#111",t.fillRect(0,0,e.width,e.height),t.font="14px monospace",t.fillStyle="#0f8",t.textAlign="left",t.fillText("AudioID",10,20),t.strokeStyle="#0f8",t.lineWidth=1.5,t.beginPath();const r=Array.from(s.slice(4500,5e3)),n=e.width/r.length;for(let i=0;i<r.length;i++){const s=i*n,o=(r[i]+1)/2*e.height;0===i?t.moveTo(s,o):t.lineTo(s,o)}t.stroke(),document.body.appendChild(e)}return je(c.toString(16))})(e)),T=window.screen.width&&window.screen.height?(window.screen.width/window.screen.height).toFixed(4):null,C=await Le(()=>window.screen.orientation?.type||null),k=window.navigator.connection||window.navigator.mozConnection||window.navigator.webkitConnection,E=k&&k.type||null,A=k?.effectiveType||null,x=!0===k?.saveData,F="boolean"==typeof window.navigator.pdfViewerEnabled?window.navigator.pdfViewerEnabled:null,P="boolean"==typeof window.navigator.webdriver?window.navigator.webdriver:null,D=await Le(()=>"function"!=typeof Intl.supportedValuesOf?null:Intl.supportedValuesOf("calendar").join(",")),M=await Le(async()=>{if(!window.navigator.permissions||"function"!=typeof window.navigator.permissions.query)return null;const e=["geolocation","notifications"],t={};for(const r of e)try{t[r]=(await window.navigator.permissions.query({name:r})).state}catch{t[r]="unsupported"}return _e(t)}),q={vendor:window.navigator.vendor||null,platform:window.navigator.platform||null,userAgentHighEntropy:r||null,mediaCodecs:n||null,fonts:i,numberingSystem:s,languages:o,timezone:c,timezoneOffset:l,intlCalendar:u,hourCycle:h,reducedMotion:d,colorScheme:f,prefersContrast:p,prefersReducedTransparency:m,pdfViewerEnabled:F,webdriver:P,intlSupportedCalendars:D||null,permissionsState:M||null,hardwareConcurrency:window.navigator.hardwareConcurrency||null,deviceMemory:window.navigator.deviceMemory||null,forcedColors:g,devicePixelRatio:y,pixelDepth:v,colorDepth:w,touchSupport:b,screenOrientation:C||null,connectionType:E,effectiveType:A,saveData:x,canvasID:S,webglID:R,webgpuID:I,audioID:O},U={aspectRatio:T,width:window.screen.width,height:window.screen.height,maxTouchPoints:window.navigator.maxTouchPoints};(!0===navigator.userAgentData?.mobile||/Mobi|Android|iPhone|iPad|iPod|webOS|BlackBerry|Windows Phone/i.test(navigator.userAgent)||navigator.maxTouchPoints>0&&matchMedia("(pointer:coarse)").matches&&innerWidth<=1024)&&Object.assign(q,U);const Q=_e(q),L=je(Q),j=Math.round(performance.now()-t);return{fingerprint:L,...q,elapsedMs:j}};"undefined"!=typeof window&&(window.getBrowserFingerprint=ze);var Ne=e=>e?`qrati_token:${e}`:"qrati_token",$e=e=>e?.trim()||void 0,He=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),Ve=async(e,t)=>{if(e instanceof l){try{const t=e.data;if(t?.error)return t.error;if(t?.message)return t.message;if("INVALID_EMAIL_OR_PASSWORD"===t?.code)return"Invalid email or password"}catch{return t||e.message}return t||e.message}return e instanceof Error?t||e.message:t||String(e)},We=e(void 0),Ge=({props:e={},children:i})=>{const{organizationId:c,uid:d,fname:p,lname:m,theme:g="light"}=e,y=fe(),[v,w]=r(null),b=Boolean(d);t(()=>(Se(c??null),()=>Se(null)),[c]);const[S,R]=r(()=>{if("undefined"==typeof window)return null;if(b)return null;const e=localStorage.getItem(Ne(c));return e?{token:e}:null}),[I,O]=r(0),{isLoading:T,data:C,error:k}=we({queryKey:[h.QRATI_CONNECT_SESSION,c,d??null,p??null,m??null,I],queryFn:()=>(async({organizationId:e,uid:t,fname:r,lname:n,userToken:i})=>{const s=e.trim();if(!s)throw new Error("Organization ID is required for session initialization");const o=$e(t),a=$e(r),c=$e(n),h=(({userToken:e,uid:t,fname:r,lname:n})=>!e||t||r||n?null:e)({organizationId:s,uid:o,fname:a,lname:c,userToken:i}),d=await(async()=>{const e=await ze();return"string"==typeof e?e:e?.fingerprint})();try{const e=await u.post(f.INITIALIZE_SESSION,{json:{uid:o,fname:a,lname:c,browserFingerprint:d},headers:{"x-org-id":s,...h?{Authorization:`Bearer ${h}`}:{}}}).json();if(!He(e)||!He(e.data))throw new Error("Invalid session initialization response");const t=e.data;if("string"!=typeof t.sessionId||!He(t.organization)||!Array.isArray(t.folders)||void 0!==t.authSession&&null!==t.authSession&&!He(t.authSession)||void 0!==t.orgRole&&null!==t.orgRole&&"string"!=typeof t.orgRole)throw new Error("Invalid session initialization response");return{...t,requestToken:h}}catch(p){if(p instanceof l)try{const e=p.data;p.apiMessage=e?.message||e?.error}catch{}throw p}})({organizationId:c,uid:d,fname:p,lname:m,userToken:S?.token}),enabled:!!c,staleTime:1/0,refetchOnWindowFocus:!1,refetchOnMount:!1,refetchOnReconnect:!1});t(()=>{C&&(({data:e,setUser:t,uid:r,fname:n,lname:i,organizationId:s,persistToken:o=!0})=>{const a=(({data:e,uid:t,fname:r,lname:n})=>{const i=e.authSession?.session?.token??e.authSession?.token,s=e.authSession?.user;return s&&i?{kind:"authenticated",sessionUser:s,sessionToken:i}:e.organization?.customAuth&&t&&r?{kind:"custom-auth",fallbackUser:{_id:t,uid:t,name:n?`${r} ${n}`:r,fname:r,lname:n}}:e.requestToken?{kind:"expired",requestToken:e.requestToken}:{kind:"none"}})({data:e,uid:r,fname:n,lname:i});"authenticated"===a.kind?(t(e=>({...e,...a.sessionUser,token:a.sessionToken,tcAccepted:void 0===a.sessionUser.tcAccepted?e?.tcAccepted:a.sessionUser.tcAccepted})),o&&localStorage.setItem(Ne(s),a.sessionToken)):"custom-auth"===a.kind?t(e=>e??a.fallbackUser):"expired"===a.kind&&t(e=>e?.token!==a.requestToken?e:(o&&localStorage.removeItem(Ne(s)),null))})({data:C,setUser:R,uid:d,fname:p,lname:m,organizationId:c,persistToken:!b})},[C,p,b,m,c,d]);const E=n(()=>{const e=C?.organization?.integrationSettings?.fontFamily,t=((e,t)=>{const r=xe("https://qrati.com"),n=t?Ae(t):"";return r&&n?`${r}/api/connect/organization/google-font?family=${encodeURIComponent(n)}`:null})(0,e),r=((e,t)=>{const r=xe("https://qrati.com");return r&&t?`${r}/api/connect/organization/custom-font?organizationId=${encodeURIComponent(t)}`:null})(0,c);return((e,t,r)=>{if(!e?.fontFamily||"system"===e.fontFamily)return"";const n=Ae(e.fontFamily);if("custom"===n&&t){const r=e.customFontName||"QratiCustomFont",n=/\.woff2(\?|$)/i.test(t)?"woff2":/\.ttf(\?|$)/i.test(t)?"truetype":"woff";return`@font-face{font-family:"${i=r,i.replace(/"/g,'\\"')}";src:url("${t}") format("${n}");font-weight:400 700;font-style:normal;font-display:swap;}`}var i;const s=r||(e=>{if(!e)return null;const t=Ae(e);return t&&"system"!==t.toLowerCase()&&"custom"!==t.toLowerCase()?`https://fonts.googleapis.com/css2?family=${t.replace(/\s+/g,"+")}:wght@400;500;600;700&display=swap`:null})(n);return s?`@import url("${s}");`:""})(C?.organization?.integrationSettings,C?.organization?.customFontUrl?r||C.organization.customFontUrl:void 0,t||void 0)},[C?.organization?.integrationSettings,C?.organization?.customFontUrl,c]);t(()=>{const e=`data-qrati-font-${c}`;if(document.head.querySelector(`[${e}]`)?.remove(),E){if(E.startsWith("@import")){const t=E.match(/@import url\("([^"]+)"\)/);if(!t?.[1])return;const r=document.createElement("link");r.rel="stylesheet",r.href=t[1],r.setAttribute(e,""),document.head.appendChild(r)}else{const t=document.createElement("style");t.textContent=E,t.setAttribute(e,""),document.head.appendChild(t)}return()=>{document.head.querySelector(`[${e}]`)?.remove()}}},[E,c]);const A=a(async e=>{R(t=>({...t,...e}))},[]),x=a(async(e,t,r,n)=>{try{const i=await u.post(f.REGISTER,{json:{email:e,password:t,fname:r,lname:n},headers:{"x-org-id":c}}).json();if(i.error)return{error:i.error};const s={...i.user,token:i.token};return R(s),O(e=>e+1),i.token&&!b&&localStorage.setItem(Ne(c),i.token),i}catch(k){return{error:await Ve(k,"Registration failed")}}},[c,b]),F=a(async(e,t)=>{try{const r=await u.post(f.LOGIN,{json:{email:e,password:t},headers:{"x-org-id":c}}).json();if(r.error)return{error:r.error};const n={...r.user,token:r.token};return R(n),O(e=>e+1),r.token&&!b&&localStorage.setItem(Ne(c),r.token),r}catch(k){return{error:await Ve(k,"Invalid email or password")}}},[c,b]),P=a(async e=>{const t=await((e,t,r)=>new Promise((n,i)=>{if(!e)return void i(/* @__PURE__ */new Error("Provider is required"));if(!t)return void i(/* @__PURE__ */new Error("Organization ID is required"));const s=new URL(`${r}/qc-social-auth`);s.searchParams.set("provider",e),s.searchParams.set("organizationId",t),s.searchParams.set("origin",window.location.origin);const o=(window.screen.width-500)/2,a=(window.screen.height-600)/2,c=window.open(s.toString(),"qrati_social_auth",`width=500,height=600,left=${o},top=${a},scrollbars=yes,resizable=yes,status=yes`);if(!c)return void i(/* @__PURE__ */new Error("Failed to open popup window. Please allow popups and try again."));const l=()=>{clearInterval(h),clearTimeout(d),window.removeEventListener("message",u)},u=e=>{try{const t=new URL(r).origin;if(e.origin!==t)return void console.warn("Origin mismatch:",e.origin,"expected:",t)}catch(h){return void console.warn("Could not parse origin for verification")}const{type:s,data:o,error:a,organizationId:u}=e.data||{};if(u===t)switch(s){case"QRATI_SOCIAL_AUTH_SUCCESS":l(),c.close(),n({user:o.user,session:o.session,token:o.token});break;case"QRATI_SOCIAL_AUTH_ERROR":console.error("Authentication error:",a),l(),c.close(),i(new Error(a||"Social authentication failed"));break;case"QRATI_SOCIAL_AUTH_CANCELLED":l(),c.close(),i(/* @__PURE__ */new Error("Authentication was cancelled"))}else console.warn("Organization ID mismatch:",u,"expected:",t)},h=setInterval(()=>{try{c.closed&&(l(),i(/* @__PURE__ */new Error("Authentication was cancelled")))}catch(e){}},1e3);window.addEventListener("message",u);const d=setTimeout(()=>{l(),c.closed||c.close(),i(/* @__PURE__ */new Error("Authentication timeout. Please try again."))},3e5)}))(e,c??"","https://qrati.com");return t?.user&&t?.token&&(R({...t.user,token:t.token}),O(e=>e+1),b||localStorage.setItem(Ne(c),t.token)),t},[c,b]),D=a(async()=>P("google"),[P]),M=a(async()=>P("apple"),[P]),q=a(async e=>{try{const t=await u.post(f.SEND_PASSWORD_RESET_CODE,{json:{email:e.toLowerCase()},headers:{"x-org-id":c}}).json();return t.error?{error:t.error}:t}catch(k){return{error:await Ve(k,"Failed to send password reset code")}}},[c]),U=a(async(e,t)=>{try{const r=await u.post(f.VERIFY_PASSWORD_RESET_CODE,{json:{email:e.toLowerCase(),code:t},headers:{"x-org-id":c}}).json();return r.error?{error:r.error}:r}catch(k){return{error:await Ve(k,"Invalid code, please check your email")}}},[c]),Q=a(async(e,t)=>{try{const r=await u.post(f.RESET_PASSWORD,{json:{passwordResetCodeId:e,newPassword:t},headers:{"x-org-id":c}}).json();return r.error?{error:r.error}:r}catch(k){return{error:k?.message}}},[c]),L=a(async()=>{try{const e=await u.post(f.LOGOUT,{headers:{"x-org-id":c,Authorization:`Bearer ${S?.token}`}}).json();return e.error?{error:e.error}:(R(null),b||localStorage.removeItem(Ne(c)),await y.invalidateQueries({queryKey:[h.QRATI_CONNECT_SESSION]}),e)}catch(k){return{error:k?.message}}},[b,c,S?.token]),j=n(()=>({props:e,initializing:T,sessionId:C?.sessionId,organization:C?.organization,folders:C?.folders,orgRole:C?.orgRole??null,loadingUser:T,user:S,updateUser:A,registerUsingEmail:x,loginWithGoogle:D,loginWithApple:M,loginUsingEmail:F,sendPasswordResetCode:q,verifyPasswordResetCode:U,resetPassword:Q,signout:L,error:k,portalContainer:v}),[e,T,C,S,A,x,D,M,F,q,U,Q,L,k,v]);if(k){const e=k,t=401===e?.response?.status?"page-not-registered":e?.response?"generic-error":"service-unavailable";/* @__PURE__ */
40
+ return o(s,{fallback:null,children:/* @__PURE__ */o(ke,{organizationId:c??"",errorType:t,errorMessage:"generic-error"===t?e.apiMessage:void 0})})}/* @__PURE__ */
41
+ return o(We.Provider,{value:j,children:/* @__PURE__ */o("div",{ref:w,id:"qrati-connect-container",style:{...Qe(C?.organization,g),fontFamily:C?.organization?.integrationSettings?.fontFamily&&"system"!==C.organization.integrationSettings.fontFamily?"var(--font-family)":"inherit"},className:Me("bg-background text-foreground relative min-h-[80vh]"),children:i})})},Ze=()=>{const e=c(We);if(void 0===e)throw new Error("useSession must be used within SessionProvider");return e};export{z as A,k as C,A as D,w as E,m as M,p as N,I as O,E as S,T,J as _,Qe as a,V as b,Oe as c,pe as d,fe as f,re as g,te as h,Me as i,j,P as k,we as l,ne as m,Ze as n,De as o,ae as p,ze as r,Ie as s,Ge as t,ve as u,K as v,C as w,b as x,W as y};
@@ -1 +1 @@
1
- import{l as r,n as e}from"./CdivXyOP.js";import{t as a}from"./DmpmrPE5.js";import{i as t}from"./Bb9ydqSB.js";var o=({eventSlug:o})=>{const{props:s}=e(),n=s?.organizationId,{isLoading:i,data:d,isError:g,error:m}=r({queryKey:[`event-data-${n??""}-${o??""}`],queryFn:async()=>{try{const r=await a.get(t.EVENT_DATA,{searchParams:o?{eventSlug:o}:void 0,headers:{"x-org-id":n}}).json();if(r.error)throw new Error(r.error);return r.data}catch(r){throw new Error(r instanceof Error?r.message:String(r)||"Failed to fetch event data")}},enabled:!!n&&!!o,staleTime:3e5,gcTime:6e5,refetchOnWindowFocus:"always"});return{loading:i,event:d?.event,ads:d?.ads,gamConfig:d?.gamConfig,parameters:d?.parameters,isError:g,error:m}};export{o as t};
1
+ import{l as r,n as e}from"./Dpwx5KMy.js";import{t as a}from"./DmpmrPE5.js";import{i as t}from"./Bb9ydqSB.js";var o=({eventSlug:o})=>{const{props:s}=e(),n=s?.organizationId,{isLoading:i,data:d,isError:g,error:m}=r({queryKey:[`event-data-${n??""}-${o??""}`],queryFn:async()=>{try{const r=await a.get(t.EVENT_DATA,{searchParams:o?{eventSlug:o}:void 0,headers:{"x-org-id":n}}).json();if(r.error)throw new Error(r.error);return r.data}catch(r){throw new Error(r instanceof Error?r.message:String(r)||"Failed to fetch event data")}},enabled:!!n&&!!o,staleTime:3e5,gcTime:6e5,refetchOnWindowFocus:"always"});return{loading:i,event:d?.event,ads:d?.ads,gamConfig:d?.gamConfig,parameters:d?.parameters,isError:g,error:m}};export{o as t};
@@ -1,10 +1,10 @@
1
- import{r as e,t}from"./DdACKOZr.js";import{E as r,_ as i,c as n,d as o,f as s,g as a,h as l,o as d,p as c,s as u,t as h,v as p,y as m}from"./BXMw4kNf.js";import{c as g,i as f,n as v,s as b}from"./CdivXyOP.js";import{t as y}from"./DmpmrPE5.js";import{b as w,i as x,p as S,s as T,x as C,y as F}from"./Bb9ydqSB.js";import{d as k,l as E,n as _,u as M}from"./D6q-D1kv.js";import{t as U}from"./cBUXG_uS.js";import{t as R}from"./Dl6jcv9I.js";import{t as I}from"./BkIDQGIs.js";import{t as P}from"./C0eP2utz.js";import{n as O}from"./CXRH3zmy.js";import{r as N}from"./JY9kGm742.js";import{t as A}from"./DLHvSz1a2.js";import{t as q}from"./DKxH7j1t2.js";import{a as D,c as L,i as j,o as z,r as $,s as B,t as H}from"./C2WFktw12.js";import{a as V,i as W,n as G,o as X,r as Y,t as K}from"./mZxLLxIK2.js";import{t as Q}from"./DMnbtDXS2.js";import{i as J,n as Z,r as ee,t as te}from"./Dng1_dLU.js";var re=[];for(let mn=0;mn<256;++mn)re.push((mn+256).toString(16).slice(1));var ie=/* @__PURE__ */new Uint8Array(16);function ne(e,t,r){return t||e||!crypto.randomUUID?function(e,t,r){const i=(e=e||{}).random??e.rng?.()??crypto.getRandomValues(ie);if(i.length<16)throw new Error("Random bytes length must be >= 16");if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){if((r=r||0)<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[r+e]=i[e];return t}return function(e,t=0){return(re[e[t+0]]+re[e[t+1]]+re[e[t+2]]+re[e[t+3]]+"-"+re[e[t+4]]+re[e[t+5]]+"-"+re[e[t+6]]+re[e[t+7]]+"-"+re[e[t+8]]+re[e[t+9]]+"-"+re[e[t+10]]+re[e[t+11]]+re[e[t+12]]+re[e[t+13]]+re[e[t+14]]+re[e[t+15]]).toLowerCase()}(i)}(e,t,r):crypto.randomUUID()}function oe({checked:e,defaultChecked:t,onChange:r,onBlur:i,label:n,className:o,disabled:s}){const l=e??t??!1,d=l?"checked":"unchecked",c=a();/* @__PURE__ */
2
- return h("label",{htmlFor:c,className:f("flex items-center gap-2",s&&"cursor-not-allowed opacity-50",!s&&"cursor-pointer"),children:[/* @__PURE__ */h("button",{type:"button",id:c,role:"switch","aria-checked":l,disabled:s,"data-state":d,onBlur:i,onClick:()=>!s&&r?.(!l),className:f("peer relative inline-flex h-6 w-11 shrink-0 items-center rounded-full border-2 transition-colors","border-border bg-muted","focus-visible:ring-2 focus-visible:ring-offset-2","data-[state=checked]:border-primary data-[state=checked]:bg-primary","disabled:cursor-not-allowed disabled:opacity-50",!s&&"cursor-pointer",o),children:/* @__PURE__ */h("span",{"data-state":d,className:f("pointer-events-none block size-5 translate-x-0 rounded-full shadow transition-transform","border-border bg-background border","data-[state=checked]:bg-primary-foreground data-[state=checked]:translate-x-5 data-[state=checked]:border-transparent")})}),n&&/* @__PURE__ */h("span",{className:"text-sm font-medium",children:n})]})}var se=["jpg","jpeg","png","webp","heic","tiff","bmp","avif"],ae=["mp4","webm","ogg","mov","avi","flv","wmv","mkv","3gp","m4v","mpg","mpeg"];function le({open:e,oversizedUids:t,onClose:r,onRemoveAndUpload:i}){const n=Object.values(t),o=n.filter(e=>"image"===e).length,s=n.filter(e=>"video"===e).length,a=[];return o>0&&a.push(`${o} image${o>1?"s":""}`),s>0&&a.push(`${s} video${s>1?"s":""}`),/* @__PURE__ */h(K,{open:e,onOpenChange:e=>!e&&r(),children:/* @__PURE__ */h(G,{children:[/* @__PURE__ */h(V,{children:[/* @__PURE__ */h(X,{children:"Some files are too large"}),/* @__PURE__ */h(Y,{children:[a.join(" and ")," exceed",1===n.length?"s":""," the size limit (25 MB for images, 250 MB for videos) and won't be uploaded."]})]}),/* @__PURE__ */h(W,{children:/* @__PURE__ */h(q,{onClick:i,children:"Remove and Upload"})})]})})}function de({open:e,count:t,onResume:r,onDiscard:i}){/* @__PURE__ */
1
+ import{r as e,t}from"./DdACKOZr.js";import{E as r,_ as i,c as n,d as o,f as s,g as a,h as l,o as d,p as c,s as u,t as h,v as p,y as m}from"./BXMw4kNf.js";import{c as g,i as f,n as v,s as b}from"./Dpwx5KMy.js";import{t as y}from"./DmpmrPE5.js";import{b as w,i as x,p as S,s as T,x as C,y as F}from"./Bb9ydqSB.js";import{d as k,l as E,n as _,u as M}from"./Z3MoLpu5.js";import{t as U}from"./BszsxRY6.js";import{t as R}from"./Dl6jcv9I.js";import{t as I}from"./BkIDQGIs.js";import{t as P}from"./C0eP2utz.js";import{n as O}from"./Bq48A0Iv.js";import{r as N}from"./JY9kGm742.js";import{t as A}from"./Te9ieH1R2.js";import{t as q}from"./BWjYmdOz2.js";import{a as D,c as L,i as j,o as z,r as $,s as B,t as H}from"./C2WFktw12.js";import{a as V,i as W,n as G,o as X,r as Y,t as K}from"./CHYm7f-K2.js";import{t as Q}from"./DMnbtDXS2.js";import{i as J,n as Z,r as ee,t as te}from"./BXUp7Zp4.js";var re=[];for(let mn=0;mn<256;++mn)re.push((mn+256).toString(16).slice(1));var ie=/* @__PURE__ */new Uint8Array(16);function ne(e,t,r){return t||e||!crypto.randomUUID?function(e,t,r){const i=(e=e||{}).random??e.rng?.()??crypto.getRandomValues(ie);if(i.length<16)throw new Error("Random bytes length must be >= 16");if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){if((r=r||0)<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[r+e]=i[e];return t}return function(e,t=0){return(re[e[t+0]]+re[e[t+1]]+re[e[t+2]]+re[e[t+3]]+"-"+re[e[t+4]]+re[e[t+5]]+"-"+re[e[t+6]]+re[e[t+7]]+"-"+re[e[t+8]]+re[e[t+9]]+"-"+re[e[t+10]]+re[e[t+11]]+re[e[t+12]]+re[e[t+13]]+re[e[t+14]]+re[e[t+15]]).toLowerCase()}(i)}(e,t,r):crypto.randomUUID()}function oe({checked:e,defaultChecked:t,onChange:r,onBlur:i,label:n,className:o,disabled:s}){const l=e??t??!1,d=l?"checked":"unchecked",c=a();/* @__PURE__ */
2
+ return h("label",{htmlFor:c,className:f("flex items-center gap-2",s&&"cursor-not-allowed opacity-50",!s&&"cursor-pointer"),children:[/* @__PURE__ */h("button",{type:"button",id:c,role:"switch","aria-checked":l,disabled:s,"data-state":d,onBlur:i,onClick:()=>!s&&r?.(!l),className:f("peer relative inline-flex h-6 w-11 shrink-0 items-center rounded-full border-2 transition-colors","border-border bg-muted","focus-visible:ring-2 focus-visible:ring-offset-2","data-[state=checked]:border-primary data-[state=checked]:bg-primary","disabled:cursor-not-allowed disabled:opacity-50",!s&&"cursor-pointer",o),children:/* @__PURE__ */h("span",{"data-state":d,style:{transform:l?"translateX(1.25rem)":"translateX(0)"},className:f("pointer-events-none block size-5 translate-x-0 rounded-full shadow transition-transform","border-border bg-background border","data-[state=checked]:bg-primary-foreground data-[state=checked]:translate-x-5 data-[state=checked]:border-transparent")})}),n&&/* @__PURE__ */h("span",{className:"text-sm font-medium",children:n})]})}var se=["jpg","jpeg","png","webp","heic","tiff","bmp","avif"],ae=["mp4","webm","ogg","mov","avi","flv","wmv","mkv","3gp","m4v","mpg","mpeg"];function le({open:e,oversizedUids:t,onClose:r,onRemoveAndUpload:i}){const n=Object.values(t),o=n.filter(e=>"image"===e).length,s=n.filter(e=>"video"===e).length,a=[];return o>0&&a.push(`${o} image${o>1?"s":""}`),s>0&&a.push(`${s} video${s>1?"s":""}`),/* @__PURE__ */h(K,{open:e,onOpenChange:e=>!e&&r(),children:/* @__PURE__ */h(G,{children:[/* @__PURE__ */h(V,{children:[/* @__PURE__ */h(X,{children:"Some files are too large"}),/* @__PURE__ */h(Y,{children:[a.join(" and ")," exceed",1===n.length?"s":""," the size limit (25 MB for images, 250 MB for videos) and won't be uploaded."]})]}),/* @__PURE__ */h(W,{children:/* @__PURE__ */h(q,{onClick:i,children:"Remove and Upload"})})]})})}function de({open:e,count:t,onResume:r,onDiscard:i}){/* @__PURE__ */
3
3
  return h(K,{open:e,onOpenChange:e=>!e&&i(),children:/* @__PURE__ */h(G,{children:[/* @__PURE__ */h(V,{children:[/* @__PURE__ */h(X,{children:"Resume your upload?"}),/* @__PURE__ */h(Y,{children:["We found ",t," unfinished upload",t>1?"s":""," from your last visit. Resume where you left off, or remove ",t>1?"them":"it"," and start over."]})]}),/* @__PURE__ */h(W,{children:[/* @__PURE__ */h(q,{variant:"outlined",onClick:i,children:"Remove All"}),/* @__PURE__ */h(q,{onClick:r,children:"Resume"})]})]})})}var ce=["6a385dabb04f4d8783b14fe1","69ada0f82889f080a9ca53df"],ue=({open:e,onClose:t,onSuccess:r})=>{const{t:i}=N(),[n,o]=l(!1),s=v(),a=s.props?.organizationId??s.organization?._id,{user:d,updateUser:c}=s,u=!!a&&ce.includes(a.trim()),p=u?"https://qrati.com/terms-of-use-wedding-private-events":"https://qrati.com/terms-of-use",m=u?"https://qrati.com/privacy-policy-wedding-private-events":"https://qrati.com/privacy-policy";/* @__PURE__ */
4
- return h(K,{open:e,onOpenChange:e=>!e&&t(),children:/* @__PURE__ */h(G,{children:/* @__PURE__ */h("div",{className:"mx-auto max-w-sm p-4 text-center sm:max-w-lg",children:[
4
+ return h(K,{open:e,onOpenChange:e=>!e&&t(),children:/* @__PURE__ */h(G,{className:"text-foreground",children:/* @__PURE__ */h("div",{className:"mx-auto max-w-sm p-4 text-center sm:max-w-lg",children:[
5
5
  /* @__PURE__ */h(X,{children:i("upload.terms_title","Terms & Conditions")}),
6
6
  /* @__PURE__ */h(Y,{hidden:!0,children:i("upload.terms_description","Please accept our terms to proceed")}),
7
- /* @__PURE__ */h("div",{className:"mt-4 mb-6",children:/* @__PURE__ */h("p",{className:"bg-background text-base",children:[i("upload.terms_prompt","I agree to the")," ",
7
+ /* @__PURE__ */h("div",{className:"mt-4 mb-6",children:/* @__PURE__ */h("p",{className:"bg-background text-foreground text-base",children:[i("upload.terms_prompt","I agree to the")," ",
8
8
  /* @__PURE__ */h("a",{href:p,className:"text-info inline-flex items-center gap-1 underline",target:"_blank",rel:"noopener noreferrer",children:i("upload.terms_of_use","Terms of Use")})," ",i("upload.and","and")," ",
9
9
  /* @__PURE__ */h("a",{href:m,className:"text-info inline-flex items-center gap-1 underline",target:"_blank",rel:"noopener noreferrer",children:i("upload.privacy_policy","Privacy Policy")})," "]})}),
10
10
  /* @__PURE__ */h(q,{fullWidth:!0,color:"success",disabled:n,loading:n,onClick:async()=>{o(!0);try{const e=await y.post(x.ACCEPT_TERMS,{headers:{"x-org-id":a,Authorization:d?.token?`Bearer ${d.token}`:void 0}}).json();if(e.error)throw new Error(e.error);await c({tcAccepted:!0}),o(!1),r()}catch(e){b(e instanceof Error?e:new Error(String(e)),{component:"TermsAndConditionsModal",tags:["upload","terms-accept"]}),O.error(i("upload.accept_failed","Failed to accept terms"))}o(!1)},children:i("button.accept","Accept")})]})})})},he=({eventSlug:e,locationState:t})=>{const{t:r}=N(),i=e?C.GALLERY(e):C.PUBLIC_EVENTS;/* @__PURE__ */
@@ -1,5 +1,5 @@
1
- import{E as t,S as e,_ as n,f as s,h as r,p as i,t as a,v as o,w as c,y as l}from"./BXMw4kNf.js";import{i as u}from"./CdivXyOP.js";var h=t(null),p=t(null),d=class{entries;index=0;listeners=/* @__PURE__ */new Set;constructor(t="/"){this.entries=[{path:t}]}get location(){return this.entries[this.index]?.path??"/"}get state(){return this.entries[this.index]?.state}push(t,e){this.entries=this.entries.slice(0,this.index+1),this.index=this.entries.push({path:t,state:e})-1,this.notify()}replace(t,e){this.entries[this.index]={path:t,state:e},this.notify()}go(t){const e=this.index+t;e>=0&&e<this.entries.length&&(this.index=e,this.notify())}canGoBack(){return this.index>0}listen(t){return this.listeners.add(t),()=>this.listeners.delete(t)}notify(){this.listeners.forEach(t=>t(this.location))}},f=class{listeners=/* @__PURE__ */new Set;appPushCount=0;get location(){return window.location.hash.replace(/^#/,"")||"/"}get state(){return window.history.state?.__qrati_state}makeUrl(t){return`${window.location.pathname+window.location.search}#${t}`}push(t,e){window.history.pushState({__qrati_state:e},"",this.makeUrl(t)),this.appPushCount+=1,this.notify()}replace(t,e){window.history.replaceState({__qrati_state:e},"",this.makeUrl(t)),this.notify()}go(t){this.appPushCount=Math.max(0,this.appPushCount+t),window.history.go(t)}canGoBack(){return this.appPushCount>0}listen(t){this.listeners.add(t);const e=()=>this.notify();return window.addEventListener("popstate",e),window.addEventListener("hashchange",e),queueMicrotask(()=>t(this.location)),()=>{this.listeners.delete(t),window.removeEventListener("popstate",e),window.removeEventListener("hashchange",e)}}notify(){this.listeners.forEach(t=>t(this.location))}};function m(t){const e=t.search(/[?#]/);return-1===e?t||"/":t.slice(0,e)||"/"}function w(t,e,n=!0){const s=t.split("/").filter(Boolean),r=function(t){const e=[],n=t.split("/").filter(Boolean);for(const s of n)if("*"===s)e.push({type:"wildcard"});else if(s.startsWith(":")){const t=s.endsWith("?"),n=t?s.slice(1,-1):s.slice(1);e.push({type:"param",name:n,optional:t})}else e.push({type:"static",value:s});return e}(e),i={};let a=0;for(const o of r)if("static"===o.type){if(s[a]!==o.value)return null;a++}else if("param"===o.type){if(a<s.length){try{i[o.name]=decodeURIComponent(s[a])}catch{i[o.name]=s[a]}a++}else if(!o.optional)return null}else if("wildcard"===o.type){i["*"]=s.slice(a).join("/"),a=s.length;break}return n&&a<s.length?null:{params:i}}function v(t,e){return e.startsWith("/")?e:t.endsWith("/")?t+e:`${t}/${e}`}function y(t,e,n=""){const s=m(t);for(const r of e){const t=r.path.startsWith("/")?r.path:v(n,r.path);if(r.children&&r.children.length>0){const e=w(s,t,!1);if(e){const n=[{route:r,params:e.params}],i=y(s,r.children,t);if(i)n.push(...i);else{const t=r.children.find(t=>""===t.path);t&&n.push({route:t,params:{}})}return n}}const e=w(s,t,!0);if(e)return[{route:r,params:e.params}]}return null}function g(){const t=l(p);if(!t)throw new Error("useParams must be used inside a Route");return t.params}function k(){const t=l(h);if(!t)throw new Error("useNavigate must be used inside a Router");const{navigate:e,go:n}=t;return o((t,s)=>{"number"!=typeof t?e(t,s):n(t)},[e,n])}function x(){const t=l(h);if(!t)throw new Error("useCanGoBack must be used inside a Router");return t.canGoBack}function C(){const t=l(h);if(!t)throw new Error("useLocation must be used inside a Router");return function(t,e){const n=m(t),s=t.indexOf("?"),r=t.indexOf("#");return{pathname:n,state:e,search:-1===s?"":t.slice(s,-1===r?void 0:r),hash:-1===r?"":t.slice(r)}}(t.location,t.state)}function E({mode:t,initialPath:e,children:c}){const l=s("memory"===t?new d(e):new f),[u,p]=r(l.current.location),[m,w]=r(l.current.state),[v,y]=r(l.current.canGoBack());n(()=>(p(l.current.location),w(l.current.state),y(l.current.canGoBack()),l.current.listen(t=>{p(t),w(l.current.state),y(l.current.canGoBack())})),[]);const g=o((t,e)=>{const n=l.current;e&&e.replace?n.replace(t,e.state):n.push(t,e?.state)},[]),k=o(t=>{l.current.go(t)},[]),x=i(()=>({location:u,state:m,navigate:g,go:k,canGoBack:v,mode:t}),[u,m,g,k,v,t]);/* @__PURE__ */
2
- return a(h.Provider,{value:x,children:c})}function B(t){return null}function _(t){return e(t).filter(t=>t?.type===B).map(t=>({path:t.props.path,element:t.props.element,children:t.props.children?_(t.props.children):void 0}))}function P({children:t}){const{location:n}=l(h),r=s([]),o=e(t).filter(t=>t?.type===B).map(t=>t.props.path).join("\0"),u=s("");o!==u.current&&(u.current=o,r.current=_(t));const d=r.current,f=i(()=>y(n,d),[n,d]),m=i(()=>(f??[]).reduce((t,e)=>({...t,...e.params}),{}),[f]),w=i(()=>{if(!f)return null;let t=null;for(let e=f.length-1;e>=0;e--){const n=f[e].route.element;t=/* @__PURE__ */a(p.Provider,{value:{params:m,outlet:t},children:/* @__PURE__ */a(n,{})})}return t},[f,m]);return f?/* @__PURE__ */a(c,{children:w}):null}function G(){/* @__PURE__ */
3
- return a(c,{children:l(p)?.outlet})}function b({to:t,state:e,replace:n,children:s,className:r,onClick:i,...c}){const u=l(h);/* @__PURE__ */
4
- return a("a",{href:t,onClick:o(s=>{s.preventDefault(),i?.(s),u?.navigate(t,{state:e,replace:n})},[u,t,e,n,i]),className:r,...c,children:s})}function N({to:t,state:e,replace:n,children:s,className:r,activeClassName:c,onClick:p,...d}){const f=l(h),w=i(()=>{if(!f)return!1;const e=m(f.location);return e===t||!("/"===t||!e.startsWith(`${t}/`))},[f?.location,t]);/* @__PURE__ */
5
- return a("a",{href:t,onClick:o(s=>{s.preventDefault(),p?.(s),f?.navigate(t,{state:e,replace:n})},[f,t,e,n,p]),className:"function"==typeof r?r({isActive:w}):u(r,w&&c),...d,children:s})}function W({to:t,state:e,replace:s}){const r=k();return n(()=>{queueMicrotask(()=>{r(t,{state:e,replace:s})})},[r,t,e,s]),null}export{B as a,x as c,g as d,G as i,C as l,N as n,E as o,W as r,P as s,b as t,k as u};
1
+ import{E as t,S as e,_ as n,f as s,h as r,p as i,t as a,v as o,w as c,y as u}from"./BXMw4kNf.js";import{i as l}from"./Dpwx5KMy.js";var h=t(null),p=t(null),d=class{entries;index=0;listeners=/* @__PURE__ */new Set;constructor(t="/"){this.entries=[{path:t}]}get location(){return this.entries[this.index]?.path??"/"}get state(){return this.entries[this.index]?.state}push(t,e){this.entries=this.entries.slice(0,this.index+1),this.index=this.entries.push({path:t,state:e})-1,this.notify()}replace(t,e){this.entries[this.index]={path:t,state:e},this.notify()}go(t){const e=this.index+t;e>=0&&e<this.entries.length&&(this.index=e,this.notify())}canGoBack(){return this.index>0}listen(t){return this.listeners.add(t),()=>this.listeners.delete(t)}notify(){this.listeners.forEach(t=>t(this.location))}},f=class{listeners=/* @__PURE__ */new Set;appPushCount=0;get location(){return window.location.hash.replace(/^#/,"")||"/"}get state(){return window.history.state?.__qrati_state}makeUrl(t){return`${window.location.pathname+window.location.search}#${t}`}push(t,e){window.history.pushState({__qrati_state:e},"",this.makeUrl(t)),this.appPushCount+=1,this.notify()}replace(t,e){window.history.replaceState({__qrati_state:e},"",this.makeUrl(t)),this.notify()}go(t){this.appPushCount=Math.max(0,this.appPushCount+t),window.history.go(t)}canGoBack(){return this.appPushCount>0}listen(t){this.listeners.add(t);const e=()=>this.notify();return window.addEventListener("popstate",e),window.addEventListener("hashchange",e),queueMicrotask(()=>t(this.location)),()=>{this.listeners.delete(t),window.removeEventListener("popstate",e),window.removeEventListener("hashchange",e)}}notify(){this.listeners.forEach(t=>t(this.location))}};function m(t){const e=t.search(/[?#]/);return-1===e?t||"/":t.slice(0,e)||"/"}function w(t,e,n=!0){const s=t.split("/").filter(Boolean),r=function(t){const e=[],n=t.split("/").filter(Boolean);for(const s of n)if("*"===s)e.push({type:"wildcard"});else if(s.startsWith(":")){const t=s.endsWith("?"),n=t?s.slice(1,-1):s.slice(1);e.push({type:"param",name:n,optional:t})}else e.push({type:"static",value:s});return e}(e),i={};let a=0;for(const o of r)if("static"===o.type){if(s[a]!==o.value)return null;a++}else if("param"===o.type){if(a<s.length){try{i[o.name]=decodeURIComponent(s[a])}catch{i[o.name]=s[a]}a++}else if(!o.optional)return null}else if("wildcard"===o.type){i["*"]=s.slice(a).join("/"),a=s.length;break}return n&&a<s.length?null:{params:i}}function v(t,e){return e.startsWith("/")?e:t.endsWith("/")?t+e:`${t}/${e}`}function y(t,e,n=""){const s=m(t);for(const r of e){const t=r.path.startsWith("/")?r.path:v(n,r.path);if(r.children&&r.children.length>0){const e=w(s,t,!1);if(e){const n=[{route:r,params:e.params}],i=y(s,r.children,t);if(i)n.push(...i);else{const t=r.children.find(t=>""===t.path);t&&n.push({route:t,params:{}})}return n}}const e=w(s,t,!0);if(e)return[{route:r,params:e.params}]}return null}function g(){const t=u(p);if(!t)throw new Error("useParams must be used inside a Route");return t.params}function k(){const t=u(h);if(!t)throw new Error("useNavigate must be used inside a Router");const{navigate:e,go:n}=t;return o((t,s)=>{"number"!=typeof t?e(t,s):n(t)},[e,n])}function x(){const t=u(h);if(!t)throw new Error("useCanGoBack must be used inside a Router");return t.canGoBack}function C(){const t=u(h);if(!t)throw new Error("useRouterMode must be used inside a Router");return t.mode}function E(){const t=u(h);if(!t)throw new Error("useLocation must be used inside a Router");return function(t,e){const n=m(t),s=t.indexOf("?"),r=t.indexOf("#");return{pathname:n,state:e,search:-1===s?"":t.slice(s,-1===r?void 0:r),hash:-1===r?"":t.slice(r)}}(t.location,t.state)}function B({mode:t,initialPath:e,children:c}){const u=s("memory"===t?new d(e):new f),[l,p]=r(u.current.location),[m,w]=r(u.current.state),[v,y]=r(u.current.canGoBack());n(()=>(p(u.current.location),w(u.current.state),y(u.current.canGoBack()),u.current.listen(t=>{p(t),w(u.current.state),y(u.current.canGoBack())})),[]);const g=o((t,e)=>{const n=u.current;e&&e.replace?n.replace(t,e.state):n.push(t,e?.state)},[]),k=o(t=>{u.current.go(t)},[]),x=i(()=>({location:l,state:m,navigate:g,go:k,canGoBack:v,mode:t}),[l,m,g,k,v,t]);/* @__PURE__ */
2
+ return a(h.Provider,{value:x,children:c})}function _(t){return null}function P(t){return e(t).filter(t=>t?.type===_).map(t=>({path:t.props.path,element:t.props.element,children:t.props.children?P(t.props.children):void 0}))}function G({children:t}){const{location:n}=u(h),r=s([]),o=e(t).filter(t=>t?.type===_).map(t=>t.props.path).join("\0"),l=s("");o!==l.current&&(l.current=o,r.current=P(t));const d=r.current,f=i(()=>y(n,d),[n,d]),m=i(()=>(f??[]).reduce((t,e)=>({...t,...e.params}),{}),[f]),w=i(()=>{if(!f)return null;let t=null;for(let e=f.length-1;e>=0;e--){const n=f[e].route.element;t=/* @__PURE__ */a(p.Provider,{value:{params:m,outlet:t},children:/* @__PURE__ */a(n,{})})}return t},[f,m]);return f?/* @__PURE__ */a(c,{children:w}):null}function b(){/* @__PURE__ */
3
+ return a(c,{children:u(p)?.outlet})}function R({to:t,state:e,replace:n,children:s,className:r,onClick:i,...c}){const l=u(h);/* @__PURE__ */
4
+ return a("a",{href:t,onClick:o(s=>{s.preventDefault(),i?.(s),l?.navigate(t,{state:e,replace:n})},[l,t,e,n,i]),className:r,...c,children:s})}function N({to:t,state:e,replace:n,children:s,className:r,activeClassName:c,onClick:p,...d}){const f=u(h),w=i(()=>{if(!f)return!1;const e=m(f.location);return e===t||!("/"===t||!e.startsWith(`${t}/`))},[f?.location,t]);/* @__PURE__ */
5
+ return a("a",{href:t,onClick:o(s=>{s.preventDefault(),p?.(s),f?.navigate(t,{state:e,replace:n})},[f,t,e,n,p]),className:"function"==typeof r?r({isActive:w}):l(r,w&&c),...d,children:s})}function W({to:t,state:e,replace:s}){const r=k();return n(()=>{queueMicrotask(()=>{r(t,{state:e,replace:s})})},[r,t,e,s]),null}export{_ as a,x as c,g as d,C as f,b as i,E as l,N as n,B as o,W as r,G as s,R as t,k as u};
@@ -1,5 +1,5 @@
1
- import{_ as e,h as t,t as l,w as n}from"./BXMw4kNf.js";import{i as r}from"./CdivXyOP.js";import{t as s}from"./QxKjlE-j.js";var a=()=>/* @__PURE__ */l("svg",{className:"size-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:/* @__PURE__ */l("path",{d:"m15 18-6-6 6-6"})}),o=()=>/* @__PURE__ */l("svg",{className:"size-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:/* @__PURE__ */l("path",{d:"m9 18 6-6-6-6"})});function i({items:s,autoplayInterval:i=3e3,showControls:d=!1,className:c}){const[u,h]=t(0);return e(()=>{if(s.length<=1)return;const e=setInterval(()=>h(e=>(e+1)%s.length),i);return()=>clearInterval(e)},[s.length,i]),0===s.length?null:/* @__PURE__ */l("div",{className:r("relative size-full overflow-hidden",c),children:[s.map((e,t)=>/* @__PURE__ */l("div",{className:r("absolute inset-0 transition-opacity duration-500",t===u?"opacity-100":"opacity-0"),children:e},t)),s.length>1&&/* @__PURE__ */l("div",{className:"absolute bottom-2 left-1/2 z-10 flex -translate-x-1/2 gap-1",children:s.map((e,t)=>/* @__PURE__ */l("button",{onClick:()=>h(t),className:r("h-1.5 rounded-full transition-all",t===u?"w-4 bg-white":"w-1.5 bg-white/50 hover:bg-white/75"),"aria-label":`Go to slide ${t+1}`},t))}),d&&s.length>1&&/* @__PURE__ */l(n,{children:[/* @__PURE__ */l("button",{onClick:()=>h(e=>0===e?s.length-1:e-1),className:"absolute top-1/2 left-2 z-10 flex size-8 -translate-y-1/2 items-center justify-center rounded-full bg-black/40 text-white hover:bg-black/60","aria-label":"Previous",children:/* @__PURE__ */l(a,{})}),/* @__PURE__ */l("button",{onClick:()=>h(e=>(e+1)%s.length),className:"absolute top-1/2 right-2 z-10 flex size-8 -translate-y-1/2 items-center justify-center rounded-full bg-black/40 text-white hover:bg-black/60","aria-label":"Next",children:/* @__PURE__ */l(o,{})})]})]})}var d=({event:e,onExplore:t})=>{const n=(e.contents||[]).map(t=>/* @__PURE__ */l(s,{alt:e.name,src:t.thumbnailUrl||t.url,containerClassName:"size-full",imgClassName:"rounded"},t._id)),r=e?.status?.toUpperCase();/* @__PURE__ */
2
- return l("div",{className:"w-56 max-w-full overflow-hidden rounded-lg bg-white",children:[/* @__PURE__ */l("div",{className:"relative h-32 w-full overflow-hidden",children:[/* @__PURE__ */l(i,{items:n,autoplayInterval:3e3}),"OPEN"===r&&/* @__PURE__ */l("span",{className:"absolute top-2 left-2 inline-flex items-center gap-1 rounded-full bg-green-500 px-2 py-0.5 text-[10px] font-medium text-white",children:[/* @__PURE__ */l("span",{className:"size-1.5 animate-pulse rounded-full bg-white"}),"Open"]})]}),/* @__PURE__ */l("div",{className:"p-2",children:[
1
+ import{_ as e,h as t,t as l,w as n}from"./BXMw4kNf.js";import{i as r}from"./Dpwx5KMy.js";import{t as s}from"./BWKUiudT.js";var a=()=>/* @__PURE__ */l("svg",{className:"size-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:/* @__PURE__ */l("path",{d:"m15 18-6-6 6-6"})}),o=()=>/* @__PURE__ */l("svg",{className:"size-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:/* @__PURE__ */l("path",{d:"m9 18 6-6-6-6"})});function i({items:s,autoplayInterval:i=3e3,showControls:d=!1,className:c}){const[u,h]=t(0);return e(()=>{if(s.length<=1)return;const e=setInterval(()=>h(e=>(e+1)%s.length),i);return()=>clearInterval(e)},[s.length,i]),0===s.length?null:/* @__PURE__ */l("div",{className:r("relative size-full overflow-hidden",c),children:[s.map((e,t)=>/* @__PURE__ */l("div",{className:r("absolute inset-0 transition-opacity duration-500",t===u?"opacity-100":"opacity-0"),children:e},t)),s.length>1&&/* @__PURE__ */l("div",{className:"absolute bottom-2 left-1/2 z-10 flex -translate-x-1/2 gap-1",children:s.map((e,t)=>/* @__PURE__ */l("button",{onClick:()=>h(t),className:r("h-1.5 rounded-full transition-all",t===u?"w-4 bg-white":"w-1.5 bg-white/50 hover:bg-white/75"),"aria-label":`Go to slide ${t+1}`},t))}),d&&s.length>1&&/* @__PURE__ */l(n,{children:[/* @__PURE__ */l("button",{onClick:()=>h(e=>0===e?s.length-1:e-1),className:"absolute top-1/2 left-2 z-10 flex size-8 -translate-y-1/2 items-center justify-center rounded-full bg-black/40 text-white hover:bg-black/60","aria-label":"Previous",children:/* @__PURE__ */l(a,{})}),/* @__PURE__ */l("button",{onClick:()=>h(e=>(e+1)%s.length),className:"absolute top-1/2 right-2 z-10 flex size-8 -translate-y-1/2 items-center justify-center rounded-full bg-black/40 text-white hover:bg-black/60","aria-label":"Next",children:/* @__PURE__ */l(o,{})})]})]})}var d=({event:e,onExplore:t})=>{const n=(e.contents||[]).map(t=>/* @__PURE__ */l(s,{alt:e.name,src:t.thumbnailUrl||t.url,containerClassName:"size-full",imgClassName:"rounded"},t._id)),r=e?.status?.toUpperCase();/* @__PURE__ */
2
+ return l("div",{className:"w-48 max-w-full overflow-hidden rounded-lg bg-white",children:[/* @__PURE__ */l("div",{className:"relative h-40 w-full overflow-hidden",children:[/* @__PURE__ */l(i,{items:n,autoplayInterval:3e3}),"OPEN"===r&&/* @__PURE__ */l("span",{className:"absolute top-2 left-2 inline-flex items-center gap-1 rounded-full bg-green-500 px-2 py-0.5 text-[10px] font-medium text-white",children:[/* @__PURE__ */l("span",{className:"size-1.5 animate-pulse rounded-full bg-white"}),"Open"]})]}),/* @__PURE__ */l("div",{className:"p-2",children:[
3
3
  /* @__PURE__ */l("div",{className:"line-clamp-2 pb-0.5 text-sm font-medium text-black",children:e.name}),
4
4
  /* @__PURE__ */l("div",{className:"pb-2 text-xs text-gray-600",children:e.location?.label}),
5
5
  /* @__PURE__ */l("button",{type:"button",onClick:()=>t?.(e.slug||""),className:"bg-primary text-primary-foreground flex w-full items-center justify-center rounded py-1",children:"Explore"})]})]})},c=(e,t)=>e&&(/^#[0-9a-fA-F]{3,8}$/.test(e)||/^rgb\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*\)$/.test(e))?e:t,u=e=>{if(e)try{const{protocol:t}=new URL(e);return"https:"===t||"http:"===t?e:void 0}catch{return}},h=({node:e,depth:n,activeFolderId:r,onSelect:s})=>{const[a,o]=t(!1),i=e.folder._id===r,d=e.children.length>0,c=e.eventCount>0;/* @__PURE__ */