@qratilabs/qrati-connect 2.22.3 → 2.22.4

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.
package/react/index.mjs CHANGED
@@ -29,7 +29,7 @@ import{n as e,t}from"./DdACKOZr-sMfJsued.js";import{A as r,C as n,D as o,E as i,
29
29
  /* @__PURE__ */p(ns,{placeholder:f("content.search_placeholder","Search using text"),value:g,className:"py-2",onChange:e=>v(e.target.value),onKeyUp:e=>{const t=e.key;"Enter"===t?d&&d(g.length>0?g:""):"Escape"===t&&(v(""),d&&d(""))}}),g?.length>0&&/* @__PURE__ */p("button",{className:"absolute inset-y-0 right-10 flex items-center",onClick:()=>{v(""),d&&d("")},children:/* @__PURE__ */p(Fe,{name:"material-symbols:close-rounded",className:"text-foreground w-5"})}),
30
30
  /* @__PURE__ */p("button",{className:"absolute inset-y-0 right-3 flex items-center",onClick:()=>d&&d(g),children:/* @__PURE__ */p(Fe,{name:"material-symbols:search-rounded",className:"text-foreground w-5"})})]})}),m?.integrationSettings?.showFacialSearch&&/* @__PURE__ */p(Ds,{value:b,onChange:e=>{w(e),h?.(e?URL.createObjectURL(e):void 0)}})]}),
31
31
  /* @__PURE__ */p("div",{className:"col-span-3 md:col-span-1"}),
32
- /* @__PURE__ */p("div",{className:"col-span-3 mt-3 md:col-span-1 md:mt-0 lg:justify-self-end",children:/* @__PURE__ */p(os,{engagementStyle:e,sort:i,order:l,onSortChange:a,onSortOrderChange:c})})]})},Gs=({position:e,gamConfig:t,eventId:r,organizationId:n})=>{const{trackGamAnalytics:i}=Ee(),a=k(null),s=`gam-${e}-banner-${r??"ev"}`,l=t.placementCategories?.[e];return o(()=>{let e=!1,o=null,c=null,d=null,u=null,p=null,h=null;const f=l?[l]:[],m=document.createElement("div");m.id=s,document.body.appendChild(m);const g=()=>{const e=a.current;if(!e)return;const t=e.getBoundingClientRect(),r=t.width>0&&t.height>0;m.style.display=r?"block":"none",r&&(m.style.position="fixed",m.style.top=`${t.top}px`,m.style.left=`${t.left}px`,m.style.width="728px",m.style.height="90px",m.style.zIndex="20")};return g(),window.addEventListener("scroll",g,{passive:!0}),window.addEventListener("resize",g),(async()=>{await Ie(),e||window.googletag.cmd.push(()=>{if(e)return;Se(s);const a=window.googletag.defineSlot(t.adUnitPath,[[728,90]],s)?.addService(window.googletag.pubads());a&&(o=a,u=window.googletag.pubads(),r?a.setConfig({targeting:{qrati_event:r,...f.length>0?{qrati_category:f}:{}}}):f.length>0&&a.setConfig({targeting:{qrati_category:f}}),p=e=>{e.slot===a&&i({eventId:r,organizationId:n,type:Y.GAM_IMPRESSION,creativeId:String(e.creativeId??""),lineItemId:String(e.lineItemId??""),advertiserId:String(e.advertiserId??""),isEmpty:e.isEmpty??!1})},u.addEventListener("slotRenderEnded",p),h=e=>{e.slot===a&&i({eventId:r,organizationId:n,type:Y.GAM_VIEWABLE})},u.addEventListener("impressionViewable",h),d=Me({container:m,onClick:()=>{i({eventId:r,organizationId:n,type:Y.GAM_CLICK})}}),Te(),window.googletag.display(s),c=window.setTimeout(()=>{e||(g(),a.getResponseInformation?.()||window.googletag.pubads().refresh([a]))},1500))})})(),()=>{e=!0,window.removeEventListener("scroll",g),window.removeEventListener("resize",g),null!==c&&window.clearTimeout(c),d?.(),u&&"function"==typeof u.removeEventListener&&(p&&u.removeEventListener("slotRenderEnded",p),h&&u.removeEventListener("impressionViewable",h));const t=o;o=null,t&&window.googletag?.cmd?.push(()=>{window.googletag.destroySlots([t])}),m.parentNode&&m.parentNode.removeChild(m)}},[r,t.adUnitPath,n,l,e,s]),/* @__PURE__ */p("div",{className:"flex w-full items-center justify-center overflow-x-auto py-2",children:/* @__PURE__ */p("div",{ref:a,style:{width:728,height:90,minWidth:728}})})},Hs=({gamConfig:e,eventId:t,organizationId:r})=>{const{trackGamAnalytics:n}=Ee(),i=k(null),a=`gam-right-${t??"ev"}`,s=e.placementCategories?.right??e.placementCategories?.sidebar;return o(()=>{let o=!1,l=null,c=null,d=null,u=null,p=null,h=null;const f=s?[s]:[],m=document.createElement("div");m.id=a,document.body.appendChild(m);const g=()=>{const e=i.current;if(!e)return;const t=e.getBoundingClientRect(),r=e.parentElement?.getBoundingClientRect(),n=t.width>0&&t.height>0;if(m.style.display=n?"block":"none",!n)return;const o=t.top<=0&&r?Math.min(0,r.bottom-600):t.top;m.style.position="fixed",m.style.top=`${o}px`,m.style.left=`${t.left}px`,m.style.width="160px",m.style.height="600px",m.style.zIndex="20"};return g(),window.addEventListener("scroll",g,{passive:!0}),window.addEventListener("resize",g),(async()=>{await Ie(),o||window.googletag.cmd.push(()=>{if(o)return;Se(a);const i=window.googletag.defineSlot(e.adUnitPath,[[160,600]],a)?.addService(window.googletag.pubads());i&&(l=i,u=window.googletag.pubads(),t?i.setConfig({targeting:{qrati_event:t,...f.length>0?{qrati_category:f}:{}}}):f.length>0&&i.setConfig({targeting:{qrati_category:f}}),p=e=>{e.slot===i&&n({eventId:t,organizationId:r,type:Y.GAM_IMPRESSION,creativeId:String(e.creativeId??""),lineItemId:String(e.lineItemId??""),advertiserId:String(e.advertiserId??""),isEmpty:e.isEmpty??!1})},u.addEventListener("slotRenderEnded",p),h=e=>{e.slot===i&&n({eventId:t,organizationId:r,type:Y.GAM_VIEWABLE})},u.addEventListener("impressionViewable",h),d=Me({container:m,onClick:()=>{n({eventId:t,organizationId:r,type:Y.GAM_CLICK})}}),Te(),window.googletag.display(a),c=window.setTimeout(()=>{o||(g(),i.getResponseInformation?.()||window.googletag.pubads().refresh([i]))},1500))})})(),()=>{o=!0,window.removeEventListener("scroll",g),window.removeEventListener("resize",g),null!==c&&window.clearTimeout(c),d?.(),u&&"function"==typeof u.removeEventListener&&(p&&u.removeEventListener("slotRenderEnded",p),h&&u.removeEventListener("impressionViewable",h));const e=l;l=null,e&&window.googletag?.cmd?.push(()=>{window.googletag.destroySlots([e])}),m.parentNode&&m.parentNode.removeChild(m)}},[t,e.adUnitPath,r,s,a]),/* @__PURE__ */p("div",{ref:i,style:{width:160,height:600},className:"hidden shrink-0 self-start lg:block"})},Ws=e=>e?.meta?.currentPage<e?.meta?.totalPages?e.meta.currentPage+1:void 0,qs=m(()=>import("./B1h4rQf7-BlCih4CD.js")),Vs=()=>{const e=we().eventSlug,{loadingUser:t,organization:r}=J(),n=z(),[a,l]=s(""),[c,d]=s(void 0),[u,h]=s(be),[f,m]=s(ue),[g,v]=s("undefined"!=typeof window&&window.innerWidth<768?de.SINGLE:de.GRID),b=k(null),{event:w,ads:x,gamConfig:C}=et({eventSlug:e}),{loading:S,isError:E,error:A,refetch:M,contentsWithAds:N,hasNextPage:L,fetchNextPage:T,isFetchingNextPage:U}=(({event:e,ads:t=[],gamConfig:r,sort:n=be,order:o=ue,keywords:a,face:s,limit:l=20,includeSummary:c=!1})=>{const{props:d,loadingUser:u,user:p}=J(),h=d?.organizationId,{isLoading:f,isError:m,error:g,data:v,hasNextPage:b,fetchNextPage:w,isFetchingNextPage:y,refetch:_}=function(e){return P(e,We,void 0)}({queryKey:[Q.CONTENTS_BY_EVENT(e?._id??""),n,o,a,s],queryFn:async({pageParam:t=1})=>{try{return await oe.get(F.GET_CONTENTS,{searchParams:{eventId:e?._id,page:t,keywords:a,faceImageUrl:s,sort:`${Z[o].sortOrder}${H[n].sortField}`,limit:l,includeSummary:c},headers:{"x-org-id":h,Authorization:p?`Bearer ${p.token}`:void 0}}).json()}catch(g){throw new Error(g instanceof Error?g.message:String(g)||"Failed to fetch contents")}},enabled:!u&&!!e,initialPageParam:1,getPreviousPageParam:e=>(e=>e?.meta?.currentPage>1?e.meta.currentPage-1:void 0)(e),getNextPageParam:Ws}),x=i(()=>v?.pages?.flatMap(e=>e?.data??[])??[],[v]);return{contents:x,contentsWithAds:i(()=>"gam"===e?.adMode?r?.inGalleryEnabled?((e=[],t,r)=>{if(!r||r<=0)return e;const[n,o]=t.sizes[0]??[300,250];let i=0;const a=[];for(let s=0;s<e.length;s++)a.push(e[s]),r>0&&(s+1)%r===0&&(a.push({_id:`gam-ad-slot-${i}`,type:O.GAM_AD,slotIndex:i,width:n,height:o}),i++);return a})(x,r,e?.adPosition??5):x:((e=[],t=[],r)=>{if(!r||r<=0)return e;let n=0;const o=[];for(let i=0;i<(e?.length||0);i++)o.push(e[i]),t.length>0&&r>0&&(i+1)%r===0&&(o.push({...t[n],type:O.AD,adType:t[n].type}),n=(n+1)%t.length);return o})(x,t,e?.adPosition),[t,x,e?.adMode,e?.adPosition,r]),loading:f,isError:m,error:g,refetch:_,hasNextPage:b,fetchNextPage:w,isFetchingNextPage:y}})({event:w,ads:x,gamConfig:C,sort:u,order:f,keywords:a,face:c,includeSummary:r?.integrationSettings?.showAIDescription}),{incrementEventView:R}=Ee(),{start:D,initializing:j,running:G}=(({ref:e,onBottomReached:t,hasNextPage:r,fetchNextPage:n,isFetchingNextPage:i})=>{const a=k(1),l=k(null),c=k(null),d=k(null),[u,p]=s(!1),[h,f]=s(!1);o(()=>(u&&(c.current&&window.clearTimeout(c.current),c.current=window.setTimeout(()=>{l.current=window.requestAnimationFrame(m)},300)),()=>{l.current&&window.cancelAnimationFrame(l.current)}),[u,r,i,n,t]);const m=()=>{e.current&&(e.current.scrollTop+=a.current,r&&!i&&n&&e.current.scrollTop+e.current.clientHeight>=.5*e.current.scrollHeight&&n(),e.current.scrollTop+e.current.clientHeight>=e.current.scrollHeight?(p(!1),l.current&&window.cancelAnimationFrame(l.current),c.current=window.setTimeout(()=>{f(!0),t?.(),c.current=window.setTimeout(()=>{e.current&&(e.current.scrollTop=0),f(!1),p(!0)},1e3)},1e3)):l.current=window.requestAnimationFrame(m))},g=e=>{"+"===e.key&&(a.current=Math.min(a.current+1,10)),"-"===e.key&&(a.current=Math.max(a.current-1,1))},v=()=>{document.fullscreenElement||(null!==d.current?d.current.release().then(()=>(d.current=null,!0)).catch(e=>console.error(`Failed to release wake lock: ${e instanceof Error?e.message:String(e)}`)):console.error("No Wake Lock to release."),p(!1),f(!1),e.current&&(e.current.scrollTop=0),l.current&&window.cancelAnimationFrame(l.current),c.current&&window.clearTimeout(c.current),document.removeEventListener("keydown",g),document.removeEventListener("fullscreenchange",v))};return{start:()=>{if(e?.current?.requestFullscreen)e.current.requestFullscreen();else{const t=e.current;t?.webkitRequestFullscreen?t.webkitRequestFullscreen():t?.mozRequestFullScreen?t.mozRequestFullScreen():t?.msRequestFullscreen&&t.msRequestFullscreen()}(async()=>{try{"wakeLock"in navigator?(d.current=await navigator.wakeLock.request("screen"),document.addEventListener("visibilitychange",async()=>{null!==d.current&&"visible"===document.visibilityState&&(d.current=await navigator.wakeLock.request("screen"))})):console.error("Wake Lock API is not supported in this browser.")}catch(zw){console.error(`Failed to acquire wake lock: ${zw instanceof Error?zw.message:String(zw)}`)}})(),p(!0),document.addEventListener("keydown",g),document.addEventListener("fullscreenchange",v)},initializing:h,running:u}})({ref:b,hasNextPage:L,fetchNextPage:T,isFetchingNextPage:U,onBottomReached:()=>w?._id&&n.refetchQueries({queryKey:[Q.CONTENTS_BY_EVENT(w._id)]})});o(()=>{w?.slug&&R(w.slug)},[w]);const W=i(()=>g===de.SINGLE,[g]),q=i(()=>/* @__PURE__ */p(es,{event:w,onAutoscrollClick:D}),[w?.galleryLayout,D]),V=k(null),$=k(null);o(()=>(V.current&&V.current.disconnect(),V.current=new IntersectionObserver(e=>{e[0].isIntersecting&&L&&!U&&!S&&T()},{rootMargin:"200px"}),$.current&&V.current.observe($.current),()=>{V.current&&V.current.disconnect()}),[L,U,S,T]);const X=C?.bannerPositions??[],Y=r?._id,te=C&&X.includes("right");return p("div",{className:"bg-background mx-auto min-h-[80vh]",children:[
32
+ /* @__PURE__ */p("div",{className:"col-span-3 mt-3 md:col-span-1 md:mt-0 lg:justify-self-end",children:/* @__PURE__ */p(os,{engagementStyle:e,sort:i,order:l,onSortChange:a,onSortOrderChange:c})})]})},Gs=({position:e,gamConfig:t,eventId:r,organizationId:n})=>{const{trackGamAnalytics:i}=Ee(),a=k(null),s=`gam-${e}-banner-${r??"ev"}`,l=t.placementCategories?.[e];return o(()=>{let e=!1,o=null,c=null,d=null,u=null,p=null,h=null;const f=l?[l]:[],m=document.createElement("div");m.id=s,document.body.appendChild(m);const g=()=>{const e=a.current;if(!e)return;const t=e.getBoundingClientRect(),r=t.width>0&&t.height>0;m.style.display=r?"block":"none",r&&(m.style.position="fixed",m.style.top=`${t.top}px`,m.style.left=`${t.left}px`,m.style.width="728px",m.style.height="90px",m.style.zIndex="20")};return g(),window.addEventListener("scroll",g,{passive:!0}),window.addEventListener("resize",g),(async()=>{await Ie(),e||window.googletag.cmd.push(()=>{if(e)return;Se(s);const a=window.googletag.defineSlot(t.adUnitPath,[[728,90]],s)?.addService(window.googletag.pubads());a&&(o=a,u=window.googletag.pubads(),r?a.setConfig({targeting:{qrati_event:r,...f.length>0?{qrati_category:f}:{}}}):f.length>0&&a.setConfig({targeting:{qrati_category:f}}),p=e=>{e.slot===a&&i({eventId:r,organizationId:n,type:Y.GAM_IMPRESSION,creativeId:String(e.creativeId??""),lineItemId:String(e.lineItemId??""),advertiserId:String(e.advertiserId??""),isEmpty:e.isEmpty??!1})},u.addEventListener("slotRenderEnded",p),h=e=>{e.slot===a&&i({eventId:r,organizationId:n,type:Y.GAM_VIEWABLE})},u.addEventListener("impressionViewable",h),d=Me({container:m,onClick:()=>{i({eventId:r,organizationId:n,type:Y.GAM_CLICK})}}),Te(),window.googletag.display(s),c=window.setTimeout(()=>{e||(g(),a.getResponseInformation?.()||window.googletag.pubads().refresh([a]))},1500))})})(),()=>{e=!0,window.removeEventListener("scroll",g),window.removeEventListener("resize",g),null!==c&&window.clearTimeout(c),d?.(),u&&"function"==typeof u.removeEventListener&&(p&&u.removeEventListener("slotRenderEnded",p),h&&u.removeEventListener("impressionViewable",h));const t=o;o=null,t&&window.googletag?.cmd?.push(()=>{window.googletag.destroySlots([t])}),m.parentNode&&m.parentNode.removeChild(m)}},[r,t.adUnitPath,n,l,e,s]),/* @__PURE__ */p("div",{className:"flex w-full items-center justify-center overflow-x-auto py-2",children:/* @__PURE__ */p("div",{ref:a,style:{width:728,height:90,minWidth:728}})})},Hs=({gamConfig:e,eventId:t,organizationId:r})=>{const{trackGamAnalytics:n}=Ee(),i=k(null),a=`gam-right-${t??"ev"}`,s=e.placementCategories?.right??e.placementCategories?.sidebar;return o(()=>{let o=!1,l=null,c=null,d=null,u=null,p=null,h=null;const f=s?[s]:[],m=document.createElement("div");m.id=a,document.body.appendChild(m);const g=()=>{const e=i.current;if(!e)return;const t=e.getBoundingClientRect(),r=e.parentElement?.getBoundingClientRect(),n=t.width>0&&t.height>0;if(m.style.display=n?"block":"none",!n)return;const o=t.top<=0&&r?Math.min(0,r.bottom-600):t.top;m.style.position="fixed",m.style.top=`${o}px`,m.style.left=`${t.left}px`,m.style.width="160px",m.style.height="600px",m.style.zIndex="20"};return g(),window.addEventListener("scroll",g,{passive:!0}),window.addEventListener("resize",g),(async()=>{await Ie(),o||window.googletag.cmd.push(()=>{if(o)return;Se(a);const i=window.googletag.defineSlot(e.adUnitPath,[[160,600]],a)?.addService(window.googletag.pubads());i&&(l=i,u=window.googletag.pubads(),t?i.setConfig({targeting:{qrati_event:t,...f.length>0?{qrati_category:f}:{}}}):f.length>0&&i.setConfig({targeting:{qrati_category:f}}),p=e=>{e.slot===i&&n({eventId:t,organizationId:r,type:Y.GAM_IMPRESSION,creativeId:String(e.creativeId??""),lineItemId:String(e.lineItemId??""),advertiserId:String(e.advertiserId??""),isEmpty:e.isEmpty??!1})},u.addEventListener("slotRenderEnded",p),h=e=>{e.slot===i&&n({eventId:t,organizationId:r,type:Y.GAM_VIEWABLE})},u.addEventListener("impressionViewable",h),d=Me({container:m,onClick:()=>{n({eventId:t,organizationId:r,type:Y.GAM_CLICK})}}),Te(),window.googletag.display(a),c=window.setTimeout(()=>{o||(g(),i.getResponseInformation?.()||window.googletag.pubads().refresh([i]))},1500))})})(),()=>{o=!0,window.removeEventListener("scroll",g),window.removeEventListener("resize",g),null!==c&&window.clearTimeout(c),d?.(),u&&"function"==typeof u.removeEventListener&&(p&&u.removeEventListener("slotRenderEnded",p),h&&u.removeEventListener("impressionViewable",h));const e=l;l=null,e&&window.googletag?.cmd?.push(()=>{window.googletag.destroySlots([e])}),m.parentNode&&m.parentNode.removeChild(m)}},[t,e.adUnitPath,r,s,a]),/* @__PURE__ */p("div",{ref:i,style:{width:160,height:600},className:"hidden shrink-0 self-start lg:block"})},Ws=e=>e?.meta?.currentPage<e?.meta?.totalPages?e.meta.currentPage+1:void 0,qs=m(()=>import("./DfFolhWq-DcXZkFxN.js")),Vs=()=>{const e=we().eventSlug,{loadingUser:t,organization:r}=J(),n=z(),[a,l]=s(""),[c,d]=s(void 0),[u,h]=s(be),[f,m]=s(ue),[g,v]=s("undefined"!=typeof window&&window.innerWidth<768?de.SINGLE:de.GRID),b=k(null),{event:w,ads:x,gamConfig:C}=et({eventSlug:e}),{loading:S,isError:E,error:A,refetch:M,contentsWithAds:N,hasNextPage:L,fetchNextPage:T,isFetchingNextPage:U}=(({event:e,ads:t=[],gamConfig:r,sort:n=be,order:o=ue,keywords:a,face:s,limit:l=20,includeSummary:c=!1})=>{const{props:d,loadingUser:u,user:p}=J(),h=d?.organizationId,{isLoading:f,isError:m,error:g,data:v,hasNextPage:b,fetchNextPage:w,isFetchingNextPage:y,refetch:_}=function(e){return P(e,We,void 0)}({queryKey:[Q.CONTENTS_BY_EVENT(e?._id??""),n,o,a,s],queryFn:async({pageParam:t=1})=>{try{return await oe.get(F.GET_CONTENTS,{searchParams:{eventId:e?._id,page:t,keywords:a,faceImageUrl:s,sort:`${Z[o].sortOrder}${H[n].sortField}`,limit:l,includeSummary:c},headers:{"x-org-id":h,Authorization:p?`Bearer ${p.token}`:void 0}}).json()}catch(g){throw new Error(g instanceof Error?g.message:String(g)||"Failed to fetch contents")}},enabled:!u&&!!e,initialPageParam:1,getPreviousPageParam:e=>(e=>e?.meta?.currentPage>1?e.meta.currentPage-1:void 0)(e),getNextPageParam:Ws}),x=i(()=>v?.pages?.flatMap(e=>e?.data??[])??[],[v]);return{contents:x,contentsWithAds:i(()=>"gam"===e?.adMode?r?.inGalleryEnabled?((e=[],t,r)=>{if(!r||r<=0)return e;const[n,o]=t.sizes[0]??[300,250];let i=0;const a=[];for(let s=0;s<e.length;s++)a.push(e[s]),r>0&&(s+1)%r===0&&(a.push({_id:`gam-ad-slot-${i}`,type:O.GAM_AD,slotIndex:i,width:n,height:o}),i++);return a})(x,r,e?.adPosition??5):x:((e=[],t=[],r)=>{if(!r||r<=0)return e;let n=0;const o=[];for(let i=0;i<(e?.length||0);i++)o.push(e[i]),t.length>0&&r>0&&(i+1)%r===0&&(o.push({...t[n],type:O.AD,adType:t[n].type}),n=(n+1)%t.length);return o})(x,t,e?.adPosition),[t,x,e?.adMode,e?.adPosition,r]),loading:f,isError:m,error:g,refetch:_,hasNextPage:b,fetchNextPage:w,isFetchingNextPage:y}})({event:w,ads:x,gamConfig:C,sort:u,order:f,keywords:a,face:c,includeSummary:r?.integrationSettings?.showAIDescription}),{incrementEventView:R}=Ee(),{start:D,initializing:j,running:G}=(({ref:e,onBottomReached:t,hasNextPage:r,fetchNextPage:n,isFetchingNextPage:i})=>{const a=k(1),l=k(null),c=k(null),d=k(null),[u,p]=s(!1),[h,f]=s(!1);o(()=>(u&&(c.current&&window.clearTimeout(c.current),c.current=window.setTimeout(()=>{l.current=window.requestAnimationFrame(m)},300)),()=>{l.current&&window.cancelAnimationFrame(l.current)}),[u,r,i,n,t]);const m=()=>{e.current&&(e.current.scrollTop+=a.current,r&&!i&&n&&e.current.scrollTop+e.current.clientHeight>=.5*e.current.scrollHeight&&n(),e.current.scrollTop+e.current.clientHeight>=e.current.scrollHeight?(p(!1),l.current&&window.cancelAnimationFrame(l.current),c.current=window.setTimeout(()=>{f(!0),t?.(),c.current=window.setTimeout(()=>{e.current&&(e.current.scrollTop=0),f(!1),p(!0)},1e3)},1e3)):l.current=window.requestAnimationFrame(m))},g=e=>{"+"===e.key&&(a.current=Math.min(a.current+1,10)),"-"===e.key&&(a.current=Math.max(a.current-1,1))},v=()=>{document.fullscreenElement||(null!==d.current?d.current.release().then(()=>(d.current=null,!0)).catch(e=>console.error(`Failed to release wake lock: ${e instanceof Error?e.message:String(e)}`)):console.error("No Wake Lock to release."),p(!1),f(!1),e.current&&(e.current.scrollTop=0),l.current&&window.cancelAnimationFrame(l.current),c.current&&window.clearTimeout(c.current),document.removeEventListener("keydown",g),document.removeEventListener("fullscreenchange",v))};return{start:()=>{if(e?.current?.requestFullscreen)e.current.requestFullscreen();else{const t=e.current;t?.webkitRequestFullscreen?t.webkitRequestFullscreen():t?.mozRequestFullScreen?t.mozRequestFullScreen():t?.msRequestFullscreen&&t.msRequestFullscreen()}(async()=>{try{"wakeLock"in navigator?(d.current=await navigator.wakeLock.request("screen"),document.addEventListener("visibilitychange",async()=>{null!==d.current&&"visible"===document.visibilityState&&(d.current=await navigator.wakeLock.request("screen"))})):console.error("Wake Lock API is not supported in this browser.")}catch(zw){console.error(`Failed to acquire wake lock: ${zw instanceof Error?zw.message:String(zw)}`)}})(),p(!0),document.addEventListener("keydown",g),document.addEventListener("fullscreenchange",v)},initializing:h,running:u}})({ref:b,hasNextPage:L,fetchNextPage:T,isFetchingNextPage:U,onBottomReached:()=>w?._id&&n.refetchQueries({queryKey:[Q.CONTENTS_BY_EVENT(w._id)]})});o(()=>{w?.slug&&R(w.slug)},[w]);const W=i(()=>g===de.SINGLE,[g]),q=i(()=>/* @__PURE__ */p(es,{event:w,onAutoscrollClick:D}),[w?.galleryLayout,D]),V=k(null),$=k(null);o(()=>(V.current&&V.current.disconnect(),V.current=new IntersectionObserver(e=>{e[0].isIntersecting&&L&&!U&&!S&&T()},{rootMargin:"200px"}),$.current&&V.current.observe($.current),()=>{V.current&&V.current.disconnect()}),[L,U,S,T]);const X=C?.bannerPositions??[],Y=r?._id,te=C&&X.includes("right");return p("div",{className:"bg-background mx-auto min-h-[80vh]",children:[
33
33
  /* @__PURE__ */p("div",{className:"flex flex-row justify-end gap-4 pt-2",children:q}),
34
34
  /* @__PURE__ */p("div",{className:"pb-3",children:/* @__PURE__ */p(lt,{})}),C&&X.includes("top")&&/* @__PURE__ */p(Gs,{position:"top",gamConfig:C,eventId:w?._id,organizationId:Y}),
35
35
  /* @__PURE__ */p(Bs,{engagementStyle:w?.engagementStyle,disabled:t||S,mode:g,onModeChange:e=>v(e),sort:u,sortOrder:f,onSortChange:e=>h(e),onSortOrderChange:()=>m("asc"===f?"desc":"asc"),handleChange:l,face:c,onFaceImageChange:e=>d(e)}),c&&/* @__PURE__ */p("div",{className:"flex gap-4 py-2",children:[/* @__PURE__ */p("div",{className:"space-y-2",children:[/* @__PURE__ */p(ze,{variant:"h4",children:"Searching using"}),/* @__PURE__ */p("img",{src:c,alt:"face",className:"h-32 rounded"})]}),/* @__PURE__ */p("div",{className:"flex flex-col justify-end gap-2",children:/* @__PURE__ */p(je,{color:"error",iconName:"material-symbols:close-rounded",onClick:()=>d(void 0),children:"Clear search"})})]}),